ZHANGYUXUAN-zR commited on
Commit
50b98ab
·
verified ·
1 Parent(s): 0f26636

Add files using upload-large-folder tool

Browse files
Files changed (50) hide show
  1. md/train/6EWOVxvJ5FI/6EWOVxvJ5FI.md +462 -0
  2. md/train/9p2ekP904Rs/9p2ekP904Rs.md +255 -0
  3. md/train/B18WgG-CZ/B18WgG-CZ.md +361 -0
  4. md/train/B1Gi6LeRZ/B1Gi6LeRZ.md +247 -0
  5. md/train/BJ6anzb0Z/BJ6anzb0Z.md +293 -0
  6. md/train/Bkepl7cee/Bkepl7cee.md +210 -0
  7. md/train/BkgStySKPB/BkgStySKPB.md +480 -0
  8. md/train/H1tSsb-AW/H1tSsb-AW.md +481 -0
  9. md/train/H1z-PsR5KX/H1z-PsR5KX.md +344 -0
  10. md/train/HJCXZQbAZ/HJCXZQbAZ.md +350 -0
  11. md/train/HJe6uANtwH/HJe6uANtwH.md +255 -0
  12. md/train/HkGSniC9FQ/HkGSniC9FQ.md +432 -0
  13. md/train/Hyl9ahVFwH/Hyl9ahVFwH.md +0 -0
  14. md/train/J8_GttYLFgr/J8_GttYLFgr.md +511 -0
  15. md/train/QDm4QXNOsuQVE/QDm4QXNOsuQVE.md +299 -0
  16. md/train/S1HEBe_Jl/S1HEBe_Jl.md +291 -0
  17. md/train/S1XolQbRW/S1XolQbRW.md +624 -0
  18. md/train/S1g6xeSKDS/S1g6xeSKDS.md +0 -0
  19. md/train/S1gTA5VggE/S1gTA5VggE.md +187 -0
  20. md/train/S1nQvfgA-/S1nQvfgA-.md +361 -0
  21. md/train/SJgNkpVFPr/SJgNkpVFPr.md +0 -0
  22. md/train/SkgGCkrKvH/SkgGCkrKvH.md +631 -0
  23. md/train/SkgsACVKPH/SkgsACVKPH.md +277 -0
  24. md/train/Syx5V2CcFm/Syx5V2CcFm.md +0 -0
  25. md/train/TtYSU29zgR/TtYSU29zgR.md +428 -0
  26. md/train/UlSjqPEkI1V/UlSjqPEkI1V.md +352 -0
  27. md/train/Z3yd722b5X5/Z3yd722b5X5.md +536 -0
  28. md/train/aM7UsuOAzB3/aM7UsuOAzB3.md +283 -0
  29. md/train/bDP7I2fYwLj/bDP7I2fYwLj.md +471 -0
  30. md/train/bJxgv5C3sYc/bJxgv5C3sYc.md +315 -0
  31. md/train/jB0Nlbwlybm/jB0Nlbwlybm.md +319 -0
  32. md/train/nHRGW_wETLQ/nHRGW_wETLQ.md +276 -0
  33. md/train/nIAxjsniDzg/nIAxjsniDzg.md +192 -0
  34. md/train/oRMRIR4qPC1/oRMRIR4qPC1.md +531 -0
  35. md/train/pBKOx_dxYAN/pBKOx_dxYAN.md +288 -0
  36. md/train/px0-N3_KjA/px0-N3_KjA.md +315 -0
  37. md/train/r1Oen--RW/r1Oen--RW.md +305 -0
  38. md/train/r1lYRjC9F7/r1lYRjC9F7.md +275 -0
  39. md/train/rJNwDjAqYX/rJNwDjAqYX.md +278 -0
  40. md/train/rJe2syrtvS/rJe2syrtvS.md +342 -0
  41. md/train/rcQdycl0zyk/rcQdycl0zyk.md +344 -0
  42. md/train/rkHVZWZAZ/rkHVZWZAZ.md +450 -0
  43. md/train/rkTS8lZAb/rkTS8lZAb.md +406 -0
  44. md/train/rkg98yBFDr/rkg98yBFDr.md +333 -0
  45. md/train/rkxn7nR5KX/rkxn7nR5KX.md +341 -0
  46. md/train/rydeCEhs-/rydeCEhs-.md +311 -0
  47. md/train/tFbuFKWX3MFC8/tFbuFKWX3MFC8.md +259 -0
  48. md/train/ttnAE7vaATtaK/ttnAE7vaATtaK.md +132 -0
  49. md/train/vVjIW3sEc1s/vVjIW3sEc1s.md +0 -0
  50. md/train/zoQJBVrhnn3/zoQJBVrhnn3.md +498 -0
md/train/6EWOVxvJ5FI/6EWOVxvJ5FI.md ADDED
@@ -0,0 +1,462 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Stateless actor-critic for instance segmentation with high-level priors
2
+
3
+ Anonymous Author(s)
4
+ Affiliation
5
+ Address
6
+ email
7
+
8
+ # Abstract
9
+
10
+ Instance segmentation is an important computer vision problem which remains challenging despite impressive recent advances due to deep learning-based methods. Given sufficient training data, fully supervised methods can yield excellent performance, but annotation of ground-truth data remains a major bottleneck, especially for biomedical applications where it has to be performed by domain experts. The amount of labels required can be drastically reduced by using rules derived from prior knowledge to guide the segmentation. However, these rules are in general not differentiable and thus cannot be used with existing methods. Here, we relax this requirement by using stateless actor critic reinforcement learning, which enables non-differentiable rewards. We formulate the instance segmentation problem as graph partitioning and the actor critic predicts the edge weights driven by the rewards, which are based on the conformity of segmented instances to high-level priors on object shape, position or size. The experiments on toy and real datasets demonstrate that we can achieve excellent performance without any direct supervision based only on a rich set of priors.
11
+
12
+ # 16 1 Introduction
13
+
14
+ 17 Instance segmentation is the task of segmenting all objects in an image and assigning each of them
15
+ 18 a different label. It forms the necessary first step to the analysis of individual objects in a scene
16
+ 19 and is thus of paramount importance in many practical applications of computer vision. Over the
17
+ 20 recent years, fully supervised instance segmentation methods have made tremendous progress both
18
+ 21 in natural image applications and in scientific imaging, achieving excellent segmentations for very
19
+ 22 difficult tasks [1, 2].
20
+ 23 A large corpus of training images is hard to avoid when the segmentation method needs to take
21
+ 24 into account the full variability of the natural world. However, in many practical segmentation
22
+ 25 tasks the appearance of the objects can be expected to conform to certain rules which are known a
23
+ 26 priori. Examples include surveillance, industrial quality control and especially medical and biological
24
+ 27 imaging applications where full exploitation of such prior knowledge is particularly important as the
25
+ 28 training data is sparse and difficult to acquire: pixelwise annotation of the necessary instance-level
26
+ 29 groundtruth for a microscopy experiment can take weeks or even months of expert time. The use of
27
+ 30 shape priors has a strong history in this domain [3, 4], but the most powerful learned shape models
28
+ 31 still require groundtruth [5] and generic shapes are hard to combine with the CNN losses and other,
29
+ 32 non-shape, priors. For many high-level priors it has already been demonstrated that integration of
30
+ 33 the prior directly into the CNN loss can lead to superior segmentations while significantly reducing
31
+ 34 the necessary amounts of training data [6]. However, the requirement of formulating the prior as
32
+ 35 a differentiable function poses a severe limitation on the kinds of high-level knowledge that can
33
+ 36 be exploited with such an approach. The aim of our contribution is to address this limitation and
34
+ 37 establish a framework in which a rich set of non-differentiable rules and expectations can be used to
35
+ 38 steer the network training.
36
+ 39 To circumvent the requirement of a differentiable loss function, we turn to the reinforcement learning
37
+ 40 paradigm, where the rewards can be computed from a non-differentiable cost function. We base
38
+ 41 our framework on a stateless actor-critic setup [7], providing one of the first practical applications
39
+ 42 of this important theoretical construct. In more detail, we solve the instance segmentation problem
40
+ 43 as agglomeration of image superpixels, with the agent predicting the weights of the edges in the
41
+ 44 superpixel region adjacency graph. Based on the predicted weights, the segmentation is obtained
42
+ 45 through (non-differentiable) graph partitioning and the segmented objects are then evaluated by the
43
+ 46 critic, which learns to approximate the rewards based on the object- and image-level reasoning (see
44
+ 47 Fig. 1).
45
+ 48 The main contributions of this work can be summarized as follows: (i) we formulate instance segmen
46
+ 49 tation as a RL problem based on a stateless actor-critic setup, encapsulating the non-differentiable step
47
+ 50 of instance extraction into the environment and thus achieving end-to-end learning; (ii) we exploit
48
+ 51 prior knowledge on instance appearance and morphology by tying the rewards to the conformity of
49
+ 52 the predicted objects to pre-defined rules and learning to approximate the (non-differentiable) reward
50
+ 53 function with the critic; (iii) we introduce a strategy for spatial decomposition of rewards based on
51
+ 54 fixed-sized subgraphs to enable localized supervision from combinations of object- and image-level
52
+ 55 rules. (iv) we demonstrate the feasibility of our approach on synthetic and real images and show
53
+ 56 an application to an important segmentation task in developmental biology, where our framework
54
+ 57 delivers an excellent segmentation with no supervision other than high-level rules.
55
+
56
+ # 2 Related work
57
+
58
+ Reinforcement learning has so far not found significant adoption in the segmentation domain. The closest to our work are two methods in which RL has been introduced to learn a sequence of segmentation decision steps as a Markov Decision Process. In the actor critic framework of [8], the actor recurrently predicts one instance mask at a time based on the gradient provided by the critic. The training needs fully segmented images as supervision and the overall system, including an LSTM sub-network between the encoder and the decoder, is fairly complex. In [9], the individual decision steps correspond to merges of clusters while their sequence defines a hierarchical agglomeration process on a superpixel graph. The reward function is based on Rand index and thus not differentiable, but the overall framework requires full (super)pixelwise supervision for training.
59
+
60
+ 68 Reward decomposition was introduced for multi agent RL by [10] where a global reward is decom
61
+ 69 posed into a per agent reward. [11] proves that a stateless RL setup with decomposed rewards requires
62
+ 70 far less training samples than a RL setup with a global reward. In [12] reward decomposition is
63
+ 71 applied both temporally and spatially for zero-shot inference on unseen environments by training on
64
+ 72 locally selected samples to learn the underlying physics of the environment.
65
+ 73 The restriction to differentiable losses is present in all application domains of deep learning. Common
66
+ 74 ways to address it are usually based on a soft relaxation of the loss that can be differentiated. The
67
+ 75 relaxation can be designed specifically for the loss, such as, for example, Area-under-Curve [13] for
68
+ 76 classification or Jaccard Index [14] for semantic segmentation. These approaches are not directly
69
+ 77 applicable to our use case as we aim to enable the use of a variety of object- and image-level priors
70
+ 78 which can easily be combined without handcrafting an approximate loss for each case. More generally,
71
+ 79 but still for a concrete task loss, Direct Loss Minimization has been proposed for CNN training in
72
+ 80 [15]. For semi-supervised learning of a classification or ranking task, Discriminative Adversarial
73
+ 81 Networks have been proposed as a means to learn an approximation to the loss [16]. Most generally,
74
+ 82 Grabocka et al. in [17] propose to train a surrogate neural network which will serve as a smooth
75
+ 83 approximation of the true loss. In our setup, the critic can informally be viewed as a surrogate network
76
+ 84 as it learns to approximate the priors through the rewards by Q-learning.
77
+ 85 Incorporation of rules and priors is particularly important in biomedical imaging applications, where
78
+ 86 such knowledge can be exploited to augment or even substitute scarce groundtruth annotations.
79
+ 87 For example, the shape prior is explicitly encoded in the popular nuclear [18] and cellular [19]
80
+ 88 segmentation algorithms based on spatial embedding learning. Learned non-linear representations
81
+ 89 of the shape are used in [5], while in [20] the loss for object boundary prediction is made topology
82
+ 90 aware. Domain-specific priors can also be exploited in post-processing by graph partitioning [21].
83
+ 91 Interestingly, the energy minimization procedure underlying the graph partitioning can also be
84
+ 92 incorporated into the learning step [22, 23].
85
+
86
+ ![](images/b462ff7155eab119962a555dc5ed84447cb771088463b1c8eedcae8d77fef305.jpg)
87
+ Figure 1: Interaction of the agent with the environment: (a) shows the state which is composed of the raw image and the superpixel over-segmentation; (b) depicts the agent and the superpixel graph, which accumulates the features for nodes of the GNN from pixels which belong to the corresponding superpixels; (c) given the state, the agent performs the actions by predicting edge weights on the superpixel graph; (d) the environment, which includes the graph partitioning built from the weights predicted through agent actions; (e) rewards are obtained by evaluating the segmentation arising from the graph partitioning, based on pre-defined and data dependent rules. The rewards are given back to the agent where they are used for training.
88
+
89
+ # 93 3 Methods
90
+
91
+ The task of instance segmentation can be formalized as transforming an image $x$ into a labeling $y$ where $y$ maps each pixel to a label value. An instance corresponds to the maximal set of pixels with the same label value. Typically, the instance segmentation problem is solved via supervised learning, i.e. using a training set with ground-truth labels $\hat { y }$ . Note that $y$ is invariant under the permutation of label values. In general, it is difficult to formulate instance segmentation in a fully differentiable manner. Most approaches first predict a "soft" representation with a CNN, e.g. affinities [1, 24, 25], boundaries [26, 27] or embeddings [28, 29] and apply non-differentiable post-processing, such as agglomeration [27, 30], clustering [31, 32] or partitioning [33], to obtain the instance segmentation. Alternatively, proposal-based methods predict a bounding-box per instance and then predict the instance mask for each bounding-box [34]. Furthermore, the common evaluation metrics for instance segmentation [35, 36] are also not differentiable.
92
+
93
+ 105 Our main motivation to explore RL for the instance segmentation task is to circumvent the restriction
94
+ 106 to differentiable losses and - regardless of the loss - to make the whole pipeline differentiable end-to
95
+ 107 end even in presence of non-differentiable steps which transform pixelwise CNN predictions into
96
+ 108 individual instances.
97
+ 109 We formulate the instance segmentation problem using a region adjacency graph $G = ( V , E )$ ,
98
+ 110 where the nodes $V$ correspond to superpixels (homogeneous clusters of pixels) and the edges $E$
99
+ 111 connect nodes which belong to spatially adjacent superpixels. Given edge weights $W$ , an instance
100
+ 112 segmentation can be obtained by partitioning the graph, here using an approximate multicut solver
101
+ 113 [37]. Together, the image data, superpixels, graph and the graph partitioning make up the environment
102
+ 114 $\mathcal { E }$ of our RL setup. Based on the state $s$ of $\mathcal { E }$ , the agent $\mathcal { A }$ predicts actions $a$ , which are used to
103
+ 115 compute the partitioning. The reward $r$ is then computed based on this partitioning. Our agent $\mathcal { A }$ is a
104
+ 116 stateless actor-critic [38], represented by two graph neural networks (GNN) [39]. The actor predicts
105
+ 117 the actions $a$ based on the graph and its node features $F$ . The node(superpixel) features are computed
106
+ 118 by pooling together the corrresponding pixel features based on the raw image data.
107
+ 119 Here, we make use of two different setups: Method 1, where the per-pixel features are computed
108
+ 120 based on the image data with the feature extractor being part of the agent $\mathcal { A }$ and Method 2 where the
109
+ 121 feature extractor is part of the environment $\mathcal { E }$ . The feature extractor is trained end-to-end in Method
110
+ 122 1, whereas it is fixed and thus needs to be pre-trained in Method 2. We use a U-Net [40] as feature
111
+ 123 extractor and can use hand-crafted features in addition to the learned features. More details about
112
+ 124 the pre- training can be found in the Appendix. The agent - environment interaction for Method 1 is
113
+ 125 depicted in Figure 1. For Method 2 we refer to the Appendix.
114
+ 126 Importantly, this setup enables us to use both a non-differentiable instance segmentation step and
115
+ 127 reward function, by encapsulation of the “pixels to instances” step in the environment and learning a
116
+ 128 policy based on the rewards with a stateless actor critic.
117
+
118
+ # 29 3.1 Stateless Reinforcement Learning Setup
119
+
120
+ 130 Unlike most RL settings [41], our approach does not require an explicitly time dependent state: the
121
+ 131 actions returned by the agent correspond to the real-valued edge weights in [0, 1], which are used to
122
+ 132 compute the graph partitioning. Any state can be reached by a single step from the initial state and
123
+ 133 there exists no time dependency in the state transition. Unlike [9], we predict all edge values at once
124
+ 134 which allows us to avoid the iterative strategy of [8] and deliver and evaluate a complete segmentation
125
+ 135 in every step. We implement a stateless actor critic formulation with episodes of length 1.
126
+ 136 To the best of our knowledge, stateless RL was introduced in [7] to study the connection between
127
+ 137 generative adversarial networks and actor critics and our method is one of the first practical applica
128
+ 138 tions of this concept. Here, the agent consists of an actor, which predicts the actions $a$ and a critic,
129
+ 139 which predicts the action value $Q$ (expected future discounted reward) given the actions. The stateless
130
+ 140 approach simplifies the action value function: the action value has to estimate the reward for a single
131
+ 141 step instead of estimating the expected sum of discounted future rewards for many steps. We have
132
+ 142 explored a multi-step setup as well, but found that it yields inferior results for our application; details
133
+ 143 can be found in the Appendix. As described in detail in 3.2, we compute localized sub-graph rewards
134
+ 144 instead of relying on a single global reward.
135
+ 145 The actor corresponds to a single GNN, which predicts the mean and variance of a normal distribution
136
+ 146 for each edge. The actions $a$ are determined by sampling from this distribution and applying a
137
+ 147 sigmoid to the result to obtain continuous edge weights in the value range $[ 0 , 1 ]$ . The GNN takes the
138
+ 148 state $s = ( G , F )$ as input arguments and its graph convolution for the $i ^ { t h }$ node is defined as in [39]:
139
+
140
+ $$
141
+ f _ { i } = \gamma _ { \pi } \left( f _ { i } , \frac { 1 } { | N ( i ) | } \sum _ { j \in N ( i ) } \phi _ { \pi } \left( f _ { i } , f _ { j } \right) \right)
142
+ $$
143
+
144
+ 149 where $\gamma _ { \pi }$ as well as $\phi _ { \pi }$ are MLPs, $( \cdot , \cdot )$ is the concatenation of vectors and $N ( i )$ is the set of neighbors
145
+ 150 of node $i$ . The gradient of the loss for the actor is given by:
146
+
147
+ $$
148
+ \nabla _ { \theta } \mathcal { L } _ { a c t o r } = \nabla _ { \theta } \frac { 1 } { | S G | } \sum _ { s g \in G } \left[ \alpha \sum _ { \hat { a } \in s g } l o g ( \pi ^ { \theta } ( \hat { a } | s ) ) - Q _ { s g } ( s , a ) \right]
149
+ $$
150
+
151
+ 151 This loss gradient is derived following [38]. We adapt it to the sub-graph reward structure by
152
+ 152 calculating the joint action probability of the policy $\bar { \pi ^ { \theta } }$ over each sub-graph $s g$ in the set of all
153
+ 153 sub-graphs $_ { S G }$ . Using this loss to optimize the policy parameters $\theta$ minimizes the Kullback-Leibler
154
+ 154 divergence between the Gibbs distribution of action values for each sub-graph $Q _ { s g } ( s , a )$ and the
155
+ 155 policy with respect to the parameters $\theta$ of the policy. $\alpha$ is a trainable temperature parameter which is
156
+ 156 optimized following the method introduced by [38].
157
+ 158 The critic predicts the action value $Q _ { s g }$ for each sub-graph $s g \in S G$ . It consists of a GNN $Q _ { s g } ( s , a )$
158
+ 159 that takes the state $s = ( G , F )$ as well as the actions $a$ predicted by the actor as input and predicts a
159
+ 160 feature vector for each edge. The graph convolution from Equation 2 is slightly modified:
160
+
161
+ $$
162
+ f _ { i } = \gamma _ { Q } \left( f _ { i } , \frac { 1 } { | N ( i ) | } \sum _ { j \in N ( i ) } \phi _ { Q } \left( f _ { i } , f _ { j } , a _ { ( i , j ) } \right) \right)
163
+ $$
164
+
165
+ 161 again $\gamma _ { Q }$ and $\phi _ { Q }$ are MLPs. Based on these edge features $Q _ { s g }$ is predicted for each sub-graph via an
166
+ 162 MLP. Here, we use a set of subgraph sizes (typically, 6, 12, 32, 128) to generate a supervison signal
167
+ 163 for different neighborhood scales. A given MLP is only valid for a fixed graph size, so we employ a
168
+ 164 different MLP for each size. The loss for the critic is given by:
169
+
170
+ ![](images/3f4493ed09180ba81a14d1690c547c95c135b09c821df0c11e547cc937d7ab20.jpg)
171
+ Figure 2: The graph is subdivided into subgraphs, each sub-graph is highlighted by a different color. All sub-graphs have the same number of edges (here 3). Overall, we use a variety of sizes covering different notions of locality.
172
+
173
+ ![](images/31e7a00696e002558ca681b315911998f5079bf312633c750b9833e3606aa907.jpg)
174
+ Figure 3: An example reward landscape Circle Hough Transform (CHT) rewards. High rewards are given if the overall number of predicted objects is not too high and if the respective object has a large CHT value. We found an exponential gradient of the reward landscape to work best.
175
+
176
+ $$
177
+ \mathcal { L } _ { c r i t i c } = \frac { 1 } { | S G | } \sum _ { s g \in G } \frac { 1 } { 2 } ( Q _ { s g } ^ { \delta } ( s , a ) - r ) ^ { 2 }
178
+ $$
179
+
180
+ 165 Minimizing this loss with respect to the action value function’s parameters $\delta$ minimizes the difference
181
+ 166 between the expected reward and action values $Q _ { s g } ^ { \delta } ( s , a )$ .
182
+
183
+ # 3.2 Localized Supervision Signals
184
+
185
+ 168 The RL paradigm is to provide a global reward for a given state transition [41]. However, we find
186
+ 169 that for our application it is possible and desirable to instead provide several more localized rewards
187
+ 170 per state transition: Given a large action space with a policy represented by a complex multivariate
188
+ 171 probability distribution, it is beneficial to learn from rewards for the specific actions rather than from
189
+ 172 a scalar global reward for the union of all actions. Of course then requirement arises that the union of
190
+ 173 local rewards must resemble to the global reward. E.g. the optimal policy is the same for local as for
191
+ 174 the global reward.
192
+ 175 Our actor critic setup (Section 3.1) expects rewards per sub-graph. A good set of sub-graphs should
193
+ 176 fulfill the following requirements: each sub-graph should be connected so that the information
194
+ 177 presented to the MLP computing the action value for this sub-graph is correlated. The size of
195
+ 178 the sub-graphs, given by the number of edges, should be a parameter and all sub-graphs should
196
+ 179 be extracted with exactly that size to serve as valid input for one of the MLPs. The union of all
197
+ 180 sub-graphs should cover the complete graph so that each edge contributes to at least one action
198
+ 181 value $Q _ { s g }$ . The sub-graphs should overlap to provide a smooth sum of action values. We introduce
199
+ 182 Algorithm 1 to extract such a set of sub-graphs (see Appendix). Figure 2 shows the sub-graphs for a
200
+ 183 small example graph.
201
+ 184 While some of the rewards used in our experiments can be directly defined for the sub-graphs, most
202
+ 185 are instead defined per object (see Appendix for details on reward design). We use the following
203
+ 186 general procedure to map object-level rewards to sub-graphs: first assign to each superpixel the
204
+ 187 reward of its corresponding object, then determine the reward per edge as the maximum value of its
205
+ 188 two incident superpixels’ rewards and average the edge rewards to obtain the reward per sub-graph.
206
+ 189 Here, we use the maximum because high object scores indicate that all actions contributing to the
207
+ 190 respective object should get a high reward. However, for low object scores it is not possible to localize
208
+ 191 the specific action responsible for the low score. Hence, by taking the maximum we assign the
209
+ 192 higher score to edges whose incident superpixels belong to different objects, because they probably
210
+ 193 correspond to a correct split. Note that the uncertainty in the assignment of low rewards can lead to
211
+ 194 a noisy reward signal, but the averaging of the edge rewards over the sub-graphs and the overlaps
212
+
213
+ between the sub-graphs smooth and partially denoise the rewards. We have also explored a different actor critic setup that can use object level rewards directly, eliminating the need for the sub-graph extraction and mapping. However, this approach yields inferior results, see the Appendix for details.
214
+
215
+ # 4 Experiments
216
+
217
+ The agent of our setup acts on the superpixel graph and thus depends on the features assigned to the nodes of the graph. We introduced two variants of our algorithm: in the base variant (Method 1) we start from random features and make them part of the agent, allowing them to change through back-propagation (Fig. 1). In contrast, Method 2 acts on predefined features which are provided as part of the environment and are computed before training, e.g. through unsupervised clustering. A very accurate clustering in the features produces an easy problem for the agent to solve where even a global reward for all actions might be sufficient. However, in a real-world setting with no supervision, the noisier the features become the more local the reward has to be. We evaluate Method 2 on synthetic data where self-supervised pretraining can deliver noisy, but meaningful node features. Our full setup with Method 1 is evaluated on a dataset from a light microscopy experiment, where highly regular object shapes are to be expected, but no good feature pre-training is possible.
218
+
219
+ To transform the edge weight predictions of the agent into an instance segmentation we use the Multicut [42] algorithm. Here, other options are also possible such as hierarchical clustering used in [9], but we choose the Multicut for its global optimality property. Hyperparameters of the pipeline were found by cross-validation (see Appendix).
220
+
221
+ # 4.1 Synthetic dataset: circles on structured ground
222
+
223
+ To evaluate the feasibility of our approach, we create a synthetic dataset with prominent structured background. Our aim is to segment irregular disks on such background using only rule-based supervision. We generate the superpixels by the mutex watershed algorithm [25] which we run on the Gaussian gradient image. The node features of the superpixel graph were computed through self-supervised pretraining with contrastive loss as described in Appendix and fixed as part of the environment.
224
+
225
+ 221 As we aim to segment disks, we compute the circularity of the segmented objects for the rewards
226
+ 222 using the Circle Hough Transform [43]. This object-level reward is combined with the global rough
227
+ 223 estimate of the number of objects in the image to create the reward surface depicted in Fig. 3. The
228
+ 224 reward for the number of objects provides useful gradient during early training stages: for example,
229
+ 225 when too few potential objects are found in the prediction, a low reward can be given to what is
230
+ 226 thought to be the background object. On the other hand, if too many potential objects are found, a
231
+ 227 low reward can be given to all the foreground objects with a low CHT value.
232
+ 228 In more detail, the object rewards $r _ { f g }$ are composed as follows. We define a threshold $\gamma$ on the CHT
233
+ 229 value $( \gamma = 0 . 8$ in the reward surface shown in Fig. 3). Let $c \in [ 0 , 1 ]$ be the CHT value corresponding
234
+ 230 to the object and let $k$ be the total number of objects that we expect and $n$ be the number of predicted
235
+ 231 objects. Then
236
+
237
+ $$
238
+ \begin{array}{c} \begin{array} { r l } & { r _ { l o c a l } = \{ \sigma ( ( \frac { c - \gamma } { 1 - \gamma } - 0 . 5 ) 6 ) 0 . 4 , \mathrm { i f } c \geq \gamma } \\ & { \begin{array} { l l } { 0 , } & { \mathrm { o t w } } \\ { r _ { e x p } ( \frac { k } { n } ) , } & { \mathrm { i f } n \geq k } \end{array} } \\ & { r _ { g l o b a l } = \{ \begin{array} { l l } { \sigma ( \frac { c - \gamma } { 1 - \gamma } - 0 . 5 ) 6 ) 0 . 4 , } & { \mathrm { i f } c \geq \gamma } \\ { 0 . } & { \mathrm { o t o } } \end{array} } \\ & { \quad r _ { f g } = r _ { l o c a l } + r _ { g l o b a l } } \end{array} \end{array}
239
+ $$
240
+
241
+ 232 Here $\sigma ( \cdot )$ is the sigmoid function. The input to the sigmoid function is normalized to the interval
242
+ 233 $[ - 3 , 3 ]$ which was empirically found to be a good range. The rewards are always in $[ 0 , 1 ]$ here this is
243
+ 234 split up into $[ 0 , 0 . 5 ]$ for the local reward as well as for the global reward.
244
+ 235 For the largest predicted object we strongly suspect the background object. For this object background
245
+ 236 rewards $\boldsymbol { r } _ { b g }$ are calculated by
246
+
247
+ $$
248
+ r _ { b g } = { \left\{ \begin{array} { l l } { r _ { e x p } \left( { \frac { n } { k } } \right) , } & { { \mathrm { i f } } n \leq k } \\ { 1 , } & { { \mathrm { o t w } } } \end{array} \right. }
249
+ $$
250
+
251
+ 237 Note that this rewards have a large globally calculated part which makes this setup not fit for Method
252
+ 238 1. It needs some feature representation that already gives a good idea for the clustering. The only
253
+ 239 useful local information in the reward is the CHT value. Therefore, if the features have a fairly
254
+ 240 distinct structure for circles, the agent should be able to find and to correctly cluster them.
255
+
256
+ ![](images/4ddef94fe3a6f308d581972337cc7e5968de6c09d759549412cf6f46d648f43f.jpg)
257
+ Figure 4: The “Circles” dataset. Top left to right: ground truth segmentation, raw data, superpixel oversegmentation and a visualizataion for the actions on every edge, where a merge action is displayed in green and a split action in red. Bottom left to right: the pre-trained pixel embeddings projected to their first 3 PCA components shown as RGB, an edge image of the superpixels, the segmentation resulting from the graph agglomeration on the predicted edge weights and a visualization of the rewards based on the CHT, where light green shows high rewards and dark red low rewards.
258
+
259
+ Fig. 4 shows the output of all algorithm components on a sample image. For comparison, we also computed mutex watershed [25] predictions. Texture within objects and structured background are inherently difficult for region-growing algorithms, but our approach can exploit higher-level reasoning along with low-level information and achieve a good segmentation.
260
+
261
+ # 4.2 Real dataset: light microscopy imaging
262
+
263
+ Biomedical applications often require segmentation of objects of known morphology which are positioned in regular patterns, while extensive prior knowledge is available on variability of both under normal experimental conditions [44]. Such data presents the best use case for our algorithm as the reward function can leverage the known characteristics of individual object shape and texture and the overall similarity of the objects.
264
+
265
+ The dataset used for this experiment contains 317 2D images extracted from a video of a developing fruitfly embryo acquired with a light-sheet microscope [45] (Fig. 5). The image shows boundaries (plasma membranes) of the embryo cells. Across the dataset, 10 images were fully segmented by an expert, we use those for validation.
266
+
267
+ 55 Fruitfly embryo is a well-studied system for which we can exploit the prior knowledge on the expected
268
+ 56 cell shape and the radial pattern of cells. Furthermore, as the analysis of cell shape dynamics is
269
+ 57 a paramount part of many biological experiments, multiple pre-trained networks are available for
270
+ 58 the cell segmentation task [18, 19, 46, 47]. Due to the differences in sample preparation and image
271
+ 59 acquisition settings, none of these would work out-of-the-box for our data. However, the CNNs in
272
+ 60 [47] which are trained to predict boundaries in confocal microscope images of plant tissue, can serve
273
+ 61 as a strong edge detector to create superpixels in our images. The superpixels are obtained using the
274
+ 62 seeded watershed algorithm on seeds at the local minima of the predicted edge map.
275
+ 263 The rewards for this experiment are designed as follows: we set a high reward for merging the
276
+ 264 superpixels which are certain to lie in the background (close to the image boundary or the image
277
+ 265 center). For the background edges near the foreground area we modulate the reward by the circularity
278
+ 266 of the overall foreground contour. Finally, for the edges which are likely to be in the foreground
279
+ 267 we compute object-level rewards by fitting a rotated bounding box to each object and comparing its
280
+ 268 side lengths as well as its orientation to predefined template values. We do not perform semantic
281
+ 269 segmentation to define precise foreground/background boundaries, but instead use a soft weighting
282
+ 270 scheme with Gaussian weights to combine object and background rewards based on on the prior
283
+ 271 knowledge of the embryo width. An image of the weights for different locations in the image can be
284
+ 272 found in the appendix.
285
+ 273 More formally the edge rewards $r _ { e d g e }$ are calculated as follows. For each edge, we define the distance
286
+ 274 $h$ between the edge and the center of the image as the average distance of the incident objects’ center
287
+ 275 of mass and the center $c$ of the image. $j$ is the approximate radius of the circle that lies within the
288
+ 276 foreground and $m$ is the maximal distance between $c$ and the image boarder. Let further $\kappa ( \cdot )$ be the
289
+ 277 Gaussian kernel function. Then $r _ { e d g e }$ yields
290
+
291
+ ![](images/e9d1cd28100b429d214e13f4c9e439d9119d936de6460bae5a4b5c89b9ec8c3b.jpg)
292
+ Figure 5: Microscopy dataset experiment. Top left to right: ground truth segmentation; raw data; edge map; superpixel over-segmentation; visualization for the actions on every edge, where a merge action is displayed in green and a split action in red. Bottom left to right: a) handcrafted features; b) learned features accumulated on superpixels; c) learned features projected to their first 3 PCA components shown as RGB; the segmentation resulting from the Multicut on the predicted edge weights; visualization of the rewards, where light green shows high rewards and dark red low rewards.
293
+
294
+ $$
295
+ \begin{array} { l l } { r _ { b g } = \left\{ \begin{array} { l l } { K \left( \frac { | | h - c | | } { \gamma } \right) ( 1 - a ) , } & { \mathrm { ~ i f ~ } h \leq j } \\ { K \left( \frac { | | m - h | | } { \eta } \right) ( 1 - a ) , } & { \mathrm { ~ o t w } } \end{array} \right. } \\ { r _ { f g } = \mathcal { K } \left( \frac { | | h - j | | } { \delta } \right) m a x ( r _ { o 1 } , r _ { o 2 } ) } \\ { r _ { e d g e } = r _ { f g } + r _ { b g } } \end{array}
296
+ $$
297
+
298
+ 278 Here $\gamma , \eta , \delta$ are normalization constants. Equation 9 first determines the background probability for
299
+ 279 an edge by the kernel values. $1 - a$ constitutes a reward that directly favors merges which is scaled
300
+ 280 by the background probability. For each edge, $r _ { o 1 }$ and $r _ { o 2 }$ are the rewards corresponding to the two
301
+ 281 objects connected to that edge. The object rewards are given by fitting a rotated bounding box to the
302
+ 282 object and then compare rotation and dimensions to template values.
303
+ 283 Note that in this experiment no self-supervised pretraining is used for the node features in the
304
+ 284 agent’s GNNs. Unlike the “Circles” dataset, all objects in these images have very similar intensity
305
+ 285 distributions and can only be separated through the detection of boundaries between them. Instead
306
+ 286 of the pretraining, we experiment with using a few hand-crafted features like the polar coordinate
307
+ 287 of the node’s respective superpixel’s center of mass with respect to the coordinate system sitting
308
+ 288 at the center of the image as well as the superpixel’s mass, and with learning other features by
309
+ 289 back-propagation from the agent. The handcrafted features are normalized, concatenated to the
310
+ 290 learned features and used as input to the GNN. The projection of the first 3 PCA components of these
311
+ 291 features into RGB space is shown in Fig. 5 respectively for learned feature maps, their projection
312
+ 292 to node features through the accumulation procedure and finally the concatenation of those and the
313
+ 293 handcrafted features. Note that the learned features converge to a representation which resembles a
314
+ 294 semantic segmentation of boundaries in the image.
315
+
316
+ Table 1: Quantitative evaluation on the microscopy dataset. Note that the projection of superpixels to the ground truth (sp gt) sets an upper (lower for VI) bound for our method. We use Symmetric Best Dice as well as the Variation of Information metric to compare all results on the validation set.
317
+
318
+ <table><tr><td>Method</td><td>SBD</td><td>VI merge</td><td>VI split</td></tr><tr><td>sp gt</td><td>0.656 ± 0.019</td><td>0.672 ± 0.061</td><td>0.594 ± 0.028</td></tr><tr><td rowspan="2">ours + augmentation noise ours</td><td>0.508 ± 0.031</td><td>1.233 ± 0.156</td><td>1.060 ± 0.258</td></tr><tr><td>0.482 ± 0.020</td><td>0.839 ± 0.118</td><td>1.374 ± 0.357</td></tr><tr><td>ours without edges</td><td>0.446 ± 0.041</td><td>0.953 ± 0.212</td><td>0.994 ± 0.200</td></tr><tr><td>ours only handcrafted</td><td>0.408 ± 0.087</td><td>0.987 ± 0.101</td><td>1.536 ± 0.410</td></tr><tr><td>edge + mc [47]</td><td>0.283 ± 0.023</td><td>3.019 ± 0.040</td><td>0.342 ± 0.045</td></tr><tr><td>contrastive [28]</td><td>0.215 ± 0.009</td><td>1.155 ± 0.037</td><td>3.285 ± 0.084</td></tr><tr><td>contrastive + edge [28]</td><td>0.248 ± 0.014</td><td>1.229 ± 0.048</td><td>3.336 ± 0.073</td></tr></table>
319
+
320
+ We train the complete setup for Method 1 end-to-end on a Nvidia GeForce RTX 3090 GPU for 4 days. For comparison we keep the model which achieved the highest reward on the test set. This makes training as well as the validation independent from ground truth annotations. The evolution of the rewards on the validation set for different random seeds is shown in the Appendix. All of the conducted trainings show a stride for high rewards regardless of different random seeding.
321
+
322
+ 300 For the validation scores we use the variation of information (VI) for both input combinations (merge
323
+ 301 and split) and the Symmetric Best Dice score. To show the influence of the imperfect superpixels on
324
+ 302 the final clustering, we project the superpixels to their respective ground truth clustering ("sp gt" in
325
+ 303 Table 1) which sets an upper (lower in case of VI) bound for our method. In this study we use several
326
+ 304 versions of our approach. In Table 1 (ours) refers to method 1 as described in section 4.2, (ours $^ +$
327
+ 305 augmentation noise) is the same method but add some noise to the input data during training, (ours
328
+ 306 without edges) is our method but without the additional edge prediction as an input and (ours only
329
+ 307 handcrafted) is our method where we only use the handcrafted features as described in section 4.2.
330
+ 308 We find that learned features significantly contribute to the performance of our method.
331
+ 309 We compare to the following baseline approaches: $e d g e + m c$ , which solves the Multicut graph
332
+ 310 partitioning based on edge weights derived from boundary predictions used for superpixel creation,
333
+ 311 contrastive, which predicts a pixel-wise embedding space that is clustered into instances using
334
+ 312 $\mathbf { k }$ -means and for which the embeddings are trained using the discriminative loss function of [28] on
335
+ 313 the ovules dataset from [47] and contrastive $^ +$ edge, which is similar to contrastive, but receives the
336
+ 314 [47] boundary predictions as additional input channel.
337
+
338
+ # 315 5 Discussion
339
+
340
+ 316 We introduced an end-to-end instance segmentation algorithm which can exploit non-differentiable
341
+ 317 loss functions and high-level prior information. Our RL approach is based on stateless actor-critic
342
+ 318 and predicts the full segmentation at every step, allowing us to assign rewards to all objects and
343
+ 319 reach stable convergence. The segmentation problem is formulated as graph partitioning; we design
344
+ 320 a reward decomposition algorithm which maps object- and image-level rewards to sub-graphs for
345
+ 321 localized supervision.
346
+ 322 We performed proof-of-concept experiments to demonstrate the feasibility of our approach on
347
+ 323 synthetic and real data and showed in particular that our setup can segment microscopy images
348
+ 324 with no direct supervision other than high-level reasoning. In the future, we plan to explore other
349
+ 325 problems and reward functions as well as a semi-supervised setup (briefly introduced in Appendix)
350
+ 326 where we think our approach can be very beneficial. Furthermore, even in case of full supervision
351
+ 327 with ample groundtruth, our RL-based formulation enables end-to-end instance segmentation with
352
+ 328 direct object-level reasoning, which will allow for post-processing-aware training of the CNN which
353
+ 329 predicts object boundaries or embeddings.
354
+ 330 References
355
+ 331 [1] Kisuk Lee, Jonathan Zung, Peter Li, Viren Jain, and H Sebastian Seung. Superhuman accuracy
356
+ 332 on the snemi3d connectomics challenge. arXiv preprint arXiv:1706.00120, 2017.
357
+ 333 [2] Liang-Chieh Chen, Huiyu Wang, and Siyuan Qiao. Scaling wide residual networks for panoptic
358
+ 334 segmentation, 2021.
359
+ 335 [3] S. Osher and N. Paragios. Geometric Level Set Methods in Imaging, Vision, and Graphics.
360
+ 336 Springer New York, 2007. ISBN 9780387218106. URL https://books.google.de/books?
361
+ 337 id=ZWzrBwAAQBAJ.
362
+ 338 [4] Ricard Delgado-Gonzalo, Virginie Uhlmann, Daniel Schmitter, and Michael Unser. Snakes on
363
+ 339 a plane: A perfect snap for bioimage analysis. IEEE Signal Processing Magazine, 32(1):41–48,
364
+ 340 2014.
365
+ 341 [5] Ozan Oktay, Enzo Ferrante, Konstantinos Kamnitsas, Mattias Heinrich, Wenjia Bai, Jose
366
+ 342 Caballero, Stuart A. Cook, Antonio de Marvao, Timothy Dawes, Declan P. O‘Regan, Bernhard
367
+ 343 Kainz, Ben Glocker, and Daniel Rueckert. Anatomically constrained neural networks (acnns):
368
+ 344 Application to cardiac image enhancement and segmentation. IEEE Transactions on Medical
369
+ 345 Imaging, 37(2):384–395, 2018. doi: 10.1109/TMI.2017.2743464.
370
+ 346 [6] Hoel Kervadec, Jose Dolz, Meng Tang, Eric Granger, Yuri Boykov, and Ismail Ben Ayed.
371
+ 347 Constrained-cnn losses for weakly supervised segmentation. Medical Image Analysis, 54:88–99,
372
+ 348 2019. ISSN 1361-8415. doi: https://doi.org/10.1016/j.media.2019.02.009.
373
+ 349 [7] David Pfau and Oriol Vinyals. Connecting generative adversarial networks and actor-critic
374
+ 350 methods. CoRR, abs/1610.01945, 2016. URL http://arxiv.org/abs/1610.01945.
375
+ 351 [8] Nikita Araslanov, Constantin Rothkopf, and Stefan Roth. Actor-critic instance segmentation.
376
+ 352 In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR),
377
+ 353 2019.
378
+ 354 [9] Viren Jain, Srinivas Turaga, Kevin Briggman, Moritz Helmstaedter, Winfried Denk, and Hyun
379
+ 355 june Seung. Learning to agglomerate superpixel hierarchies. Advances in Neural Information
380
+ 356 Processing Systems, 24, 01 2011.
381
+ 357 [10] Peter Sunehag, Guy Lever, Audrunas Gruslys, Wojciech Marian Czarnecki, Vinicius Zambaldi,
382
+ 358 Max Jaderberg, Marc Lanctot, Nicolas Sonnerat, Joel Z. Leibo, Karl Tuyls, and Thore Graepel.
383
+ 359 Value-decomposition networks for cooperative multi-agent learning, 2017.
384
+ 360 [11] Drew Bagnell and Andrew Ng. On local rewards and scaling distributed reinforcement learning.
385
+ 361 In Y. Weiss, B. Schölkopf, and J. Platt, editors, Advances in Neural Information Processing
386
+ 362 Systems, volume 18. MIT Press, 2006. URL https://proceedings.neurips.cc/paper/
387
+ 363 2005/file/02180771a9b609a26dcea07f272e141f-Paper.pdf.
388
+ 364 [12] Huazhe Xu, Boyuan Chen, Yang Gao, and Trevor Darrell. Scoring-aggregating-planning:
389
+ 365 Learning task-agnostic priors from interactions and sparse rewards for zero-shot generalization.
390
+ 366 CoRR, abs/1910.08143, 2019. URL http://arxiv.org/abs/1910.08143.
391
+ 367 [13] Elad Eban, Mariano Schain, Alan Mackey, Ariel Gordon, Ryan Rifkin, and Gal Elidan. Scalable
392
+ 368 learning of non-decomposable objectives. In Artificial intelligence and statistics, pages 832–840.
393
+ 369 PMLR, 2017.
394
+ 370 [14] Maxim Berman, Amal Rannen Triki, and Matthew B Blaschko. The lovász-softmax loss:
395
+ 371 A tractable surrogate for the optimization of the intersection-over-union measure in neural
396
+ 372 networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition,
397
+ 373 pages 4413–4421, 2018.
398
+ 374 [15] Yang Song, Alexander G. Schwing, Richard S. Zemel, and Raquel Urtasun. Training deep
399
+ 375 neural networks via direct loss minimization. International Conference on Machine Learning,
400
+ 376 2016.
401
+
402
+ 77 [16] Cicero Nogueira dos Santos, Kahini Wadhawan, and Bowen Zhou. Learning loss functions for semi-supervised learning via discriminative adversarial networks, 2017.
403
+ 379 [17] Josif Grabocka, Randolf Scholz, and Lars Schmidt-Thieme. Learning surrogate losses. arXiv preprint arXiv:1905.10108, 2019. [18] Uwe Schmidt, Martin Weigert, Coleman Broaddus, and Gene Myers. Cell detection with star-convex polygons. In International Conference on Medical Image Computing and ComputerAssisted Intervention, pages 265–273. Springer, 2018. [19] Carsen Stringer, Tim Wang, Michalis Michaelos, and Marius Pachitariu. Cellpose: a generalist algorithm for cellular segmentation. Nature Methods, 18(1):100–106, 2021.
404
+ 86 [20] Xiaoling Hu, Fuxin Li, Dimitris Samaras, and Chao Chen. Topology-preserving deep image segmentation. In Advances in Neural Information Processing Systems, volume 32, 2019. URL https://proceedings.neurips.cc/paper/2019/file/ 2d95666e2649fcfc6e3af75e09f5adb9-Paper.pdf. [21] Constantin Pape, Alex Matskevych, Adrian Wolny, Julian Hennies, Giulia Mizzon, Marion Louveaux, Jacob Musser, Alexis Maizel, Detlev Arendt, and Anna Kreshuk. Leveraging domain knowledge to improve microscopy image segmentation with lifted multicuts. Frontiers in Computer Science, 1:6, 2019. [22] Jeremy B Maitin-Shepard, Viren Jain, Michal Januszewski, Peter Li, and Pieter Abbeel. Combinatorial energy learning for image segmentation. In D. Lee, M. Sugiyama, U. Luxburg, I. Guyon, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 29. Curran Associates, Inc., 2016. URL https://proceedings.neurips.cc/paper/2016/file/ 31857b449c407203749ae32dd0e7d64a-Paper.pdf.
405
+ 99 [23] Jie Song, Bjoern Andres, Michael J Black, Otmar Hilliges, and Siyu Tang. End-to-end learning for graph decomposition. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 10093–10102, 2019.
406
+ 02 [24] Naiyu Gao, Yanhu Shan, Yupei Wang, Xin Zhao, Yinan Yu, Ming Yang, and Kaiqi Huang. Ssap: Single-shot instance segmentation with affinity pyramid. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 642–651, 2019. [25] Steffen Wolf, Alberto Bailoni, Constantin Pape, Nasim Rahaman, Anna Kreshuk, Ullrich Köthe, and Fred A Hamprecht. The mutex watershed and its objective: Efficient, parameter-free graph partitioning. IEEE transactions on pattern analysis and machine intelligence, 2020. [26] Thorsten Beier, Constantin Pape, Nasim Rahaman, Timo Prange, Stuart Berg, Davi D Bock, Albert Cardona, Graham W Knott, Stephen M Plaza, Louis K Scheffer, et al. Multicut brings automated neurite segmentation closer to human performance. Nature methods, 14(2):101–102, 2017. [27] Jan Funke, Fabian Tschopp, William Grisaitis, Arlo Sheridan, Chandan Singh, Stephan Saalfeld, and Srinivas C Turaga. Large scale image segmentation with structured loss based deep learning for connectome reconstruction. IEEE transactions on pattern analysis and machine intelligence, 41(7):1669–1680, 2018.
407
+ 16 [28] Bert De Brabandere, Davy Neven, and Luc Van Gool. Semantic instance segmentation with a discriminative loss function. arXiv preprint arXiv:1708.02551, 2017.
408
+ 18 [29] Davy Neven, Bert De Brabandere, Marc Proesmans, and Luc Van Gool. Instance segmentation by jointly optimizing spatial embeddings and clustering bandwidth. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 8837–8845, 2019.
409
+ 21 [30] Alberto Bailoni, Constantin Pape, Steffen Wolf, Thorsten Beier, Anna Kreshuk, and Fred A Hamprecht. A generalized framework for agglomerative clustering of signed graphs applied to instance segmentation. arXiv preprint arXiv:1906.11713, 2019.
410
+ [31] Leland McInnes and John Healy. Accelerated hierarchical density based clustering. In 2017 IEEE International Conference on Data Mining Workshops (ICDMW), pages 33–42. IEEE, 2017.
411
+ [32] Dorin Comaniciu and Peter Meer. Mean shift: A robust approach toward feature space analysis. IEEE Transactions on pattern analysis and machine intelligence, 24(5):603–619, 2002.
412
+ [33] Bjoern Andres, Thorben Kroeger, Kevin L Briggman, Winfried Denk, Natalya Korogod, Graham Knott, Ullrich Koethe, and Fred A Hamprecht. Globally optimal closed-surface segmentation for connectomics. In European Conference on Computer Vision, pages 778–791. Springer, 2012.
413
+ [34] Kaiming He, Georgia Gkioxari, Piotr Dollár, and Ross Girshick. Mask r-cnn. In Proceedings of the IEEE international conference on computer vision, pages 2961–2969, 2017.
414
+ [35] Marina Meila. Comparing clusterings by the variation of information. In ˘ Learning theory and kernel machines, pages 173–187. Springer, 2003.
415
+ [36] William M Rand. Objective criteria for the evaluation of clustering methods. Journal of the American Statistical association, 66(336):846–850, 1971.
416
+ [37] Brian W Kernighan and Shen Lin. An efficient heuristic procedure for partitioning graphs. The Bell system technical journal, 49(2):291–307, 1970.
417
+ [38] Tuomas Haarnoja, Aurick Zhou, Kristian Hartikainen, George Tucker, Sehoon Ha, Jie Tan, Vikash Kumar, Henry Zhu, Abhishek Gupta, Pieter Abbeel, and Sergey Levine. Soft actor-critic algorithms and applications. CoRR, abs/1812.05905, 2018. URL http://arxiv.org/abs/ 1812.05905.
418
+ [39] Justin Gilmer, Samuel S. Schoenholz, Patrick F. Riley, Oriol Vinyals, and George E. Dahl. Neural message passing for quantum chemistry. CoRR, abs/1704.01212, 2017. URL http: //arxiv.org/abs/1704.01212.
419
+ [40] Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. CoRR, abs/1505.04597, 2015. URL http://arxiv.org/ abs/1505.04597.
420
+ [41] Richard S. Sutton and Andrew G. Barto. Reinforcement Learning: An Introduction. The MIT Press, second edition, 2018. URL http://incompleteideas.net/book/the-book-2nd. html.
421
+ [42] Jörg Hendrik Kappes, Markus Speth, Björn Andres, Gerhard Reinelt, and Christoph Schn. Globally optimal image partitioning by multicuts. In Yuri Boykov, Fredrik Kahl, Victor Lempitsky, and Frank R. Schmidt, editors, Energy Minimization Methods in Computer Vision and Pattern Recognition, pages 31–44, Berlin, Heidelberg, 2011. Springer Berlin Heidelberg. ISBN 978-3-642-23094-3.
422
+ [43] Allam Shehata Hassanein, Sherien Mohammad, Mohamed Sameer, and Mohammad Ehab Ragab. A survey on hough transform, theory, techniques and applications. CoRR, abs/1502.02160, 2015. URL http://arxiv.org/abs/1502.02160.
423
+ [44] D’Arcy Wentworth Thompson. On Growth and Form. Canto. Cambridge University Press, 1992. doi: 10.1017/CBO9781107325852.
424
+ [45] Sourabh Bhide, Ralf Mikut, Maria Leptin, and Johannes Stegmaier. Semi-automatic generation of tight binary masks and non-convex isosurfaces for quantitative analysis of 3d biological samples, 2020.
425
+ [46] Lucas von Chamier, Romain F Laine, Johanna Jukkala, Christoph Spahn, Daniel Krentzel, Elias Nehme, Martina Lerche, Sara Hernández-Pérez, Pieta K Mattila, Eleni Karinou, Séamus Holden, Ahmet Can Solak, Alexander Krull, Tim-Oliver Buchholz, Martin L Jones, Loïc A Royer, Christophe Leterrier, Yoav Shechtman, Florian Jug, Mike Heilemann, Guillaume Jacquemet, and Ricardo Henriques. Democratising deep learning for microscopy with ZeroCostDL4Mic. Nature Communications, 4 2021.
426
+ [47] Adrian Wolny, Lorenzo Cerrone, Athul Vijayan, Rachele Tofanelli, Amaya Vilches Barro, Marion Louveaux, Christian Wenzl, Sören Strauss, David Wilson-Sánchez, Rena Lymbouridou, et al. Accurate and versatile 3d segmentation of plant tissues at cellular resolution. Elife, 9: e57613, 2020.
427
+ [48] Bert De Brabandere, Davy Neven, and Luc Van Gool. Semantic instance segmentation with a discriminative loss function, 2017.
428
+ [49] Reuben R. Shamir, Yuval Duchin, Jinyoung Kim, Guillermo Sapiro, and Noam Harel. Continuous dice coefficient: a method for evaluating probabilistic segmentations. CoRR, abs/1906.11031, 2019. URL http://arxiv.org/abs/1906.11031.
429
+
430
+ # Checklist
431
+
432
+ 1. For all authors...
433
+
434
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
435
+ (b) Did you describe the limitations of your work? [Yes]
436
+ (c) Did you discuss any potential negative societal impacts of your work? [No] It does not have any negative societal impacts.
437
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
438
+
439
+ 2. If you are including theoretical results...
440
+
441
+ (a) Did you state the full set of assumptions of all theoretical results? [N/A] We do not claim any theoretical assumptions. (b) Did you include complete proofs of all theoretical results? [N/A] See above.
442
+
443
+ 3. If you ran experiments...
444
+
445
+ (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] Yes, see the Supplementary.
446
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See the Supplementary
447
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] The bars are reported w.r.t. to the samples within the best seed, see Supplementary section for further details
448
+ (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]
449
+
450
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
451
+
452
+ (a) If your work uses existing assets, did you cite the creators? [Yes]
453
+ (b) Did you mention the license of the assets? [Yes]
454
+ (c) Did you include any new assets either in the supplemental material or as a URL? [Yes] The link to the biological dataset is given in the Supplementary
455
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? The dataset was provided from the other laboratory as a part of collaboration.
456
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No] No human data is used
457
+
458
+ 5. If you used crowdsourcing or conducted research with human subjects...
459
+
460
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
461
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
462
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
md/train/9p2ekP904Rs/9p2ekP904Rs.md ADDED
@@ -0,0 +1,255 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # REPRESENTATION LEARNING VIA INVARIANT CAUSAL MECHANISMS
2
+
3
+ Jovana Mitrovic Brian McWilliams Jacob Walker Lars Buesing Charles Blundell
4
+ DeepMind
5
+ London, UK
6
+ {mitrovic, bmcw, jcwalker, lbuesing, cblundell}@google.com
7
+
8
+ # ABSTRACT
9
+
10
+ Self-supervised learning has emerged as a strategy to reduce the reliance on costly supervised signals by pretraining representations only using unlabeled data. These methods combine heuristic proxy classification tasks with data augmentations and have achieved significant success, but our theoretical understanding of this success remains limited. In this paper we analyze self-supervised representation learning using a causal framework. We show how data augmentations can be more effectively utilized through explicit invariance constraints on the proxy classifiers employed during pretraining. Based on this, we propose a novel selfsupervised objective, Representation Learning via Invariant Causal Mechanisms (RELIC), that enforces invariant prediction of proxy targets across augmentations through an invariance regularizer which yields improved generalization guarantees. Further, using causality we generalize contrastive learning, a particular kind of self-supervised method, and provide an alternative theoretical explanation for the success of these methods. Empirically, RELIC significantly outperforms competing methods in terms of robustness and out-of-distribution generalization on ImageNet, while also significantly outperforming these methods on Atari achieving above human-level performance on 51 out of 57 games.
11
+
12
+ # 1 INTRODUCTION
13
+
14
+ Training deep networks often relies heavily on large amounts of useful supervisory signal, such as labels for supervised learning or rewards for reinforcement learning. These training signals can be costly or otherwise impractical to acquire. On the other hand, unsupervised data is often abundantly available. Therefore, pretraining representations for unknown downstream tasks without the need for labels or extrinsic reward holds great promise for reducing the cost of applying machine learning models. To pretrain representations, self-supervised learning makes use of proxy tasks defined on unsupervised data. Recently, self-supervised methods using contrastive objectives have emerged as one of the most successful strategies for unsupervised representation learning (Oord et al., 2018; Hjelm et al., 2018; Chen et al., 2020a). These methods learn a representation by classifying every datapoint against all others datapoints (negative examples). Under assumptions on how the negative examples are sampled, minimizing the resulting contrastive loss has been justified as maximizing a lower bound on the mutual information (MI) between representations (Poole et al., 2019). However, (Tschannen et al., 2019) has shown that performance on downstream tasks may be more tightly correlated with the choice of encoder architecture than the achieved MI bound, highlighting issues with the MI theory of contrastive learning. Further, contrastive approaches compare different views of the data (usually under different data augmentations) to calculate similarity scores. This approach to computing scores has been empirically observed as a key success factor of contrastive methods, but has yet to be theoretically justified. This lack of a solid theoretical explanation for the effectiveness of contrastive methods hinders their further development.
15
+
16
+ To remedy the theoretical shortcomings, we analyze the problem of self-supervised representation learning through a causal lens. We formalize intuitions about the data generating process using a causal graph and leverage causal tools to derive properties of the optimal representation. We show that a representation should be an invariant predictor of proxy targets under interventions on features that are only correlated, but not causally related to the downstream targets of interest.
17
+
18
+ Since neither causally nor purely correlationally related features are observed and thus performing actual interventions on them is not feasible, for learning representation with this property we use data augmentations to simulate a subset of possible interventions. Based on our causal interpretation, we propose a regularizer which enforces that the prediction of the proxy targets is invariant across data augmentations. We propose a novel objective for self-supervised representation learning called REpresentation Learning with Invariant Causal mechanisms (RELIC). We show how this explicit invariance regularization leverages augmentations more effectively than previous self-supervised methods and that representations learned using RELIC are guaranteed to generalize well to downstream tasks under weaker assumptions than those required by previous work (Saunshi et al., 2019).
19
+
20
+ Next we generalize contrastive learning and provide an alternative theoretical explanation to MI for the success of these methods. We generalize the proxy task of instance discrimination commonly used in contrastive learning using the causal concept of refinements (Chalupka et al., 2014). Intuitively, a refinement of a task can be understood as a more fine-grained variant of the original problem. For example, a refinement for classifying cats against dogs would be the task of classifying individual cat and dog breeds. The instance discrimination task results from the most fine-grained refinement, e.g. discriminating individual cats and dogs from one another. We show that using refinements as proxy tasks enables us to learn useful representations for downstream tasks. Specifically, using causal tools, we show that learning a representation on refinements such that it is an invariant predictor of proxy targets across augmentations is a sufficient condition for these representations to generalize to downstream tasks (cf. Theorem 1). In summary, we provide theoretical support both for the general form of the contrastive objective as well as for the use of data augmentations. Thus, we provide an alternative explanation to mutual information for the success of recent contrastive approaches namely that of causal refinements of downstream tasks.
21
+
22
+ We test RELIC on a variety of prediction and reinforcement learning problems. First, we evaluate the quality of representations pretrained on ImageNet with a special focus on robustness and out-ofdistribution generalization. RELIC performs competitively with current state-of-the-art methods on ImageNet, while significantly outperforming competing methods on robustness and out-of-distribution generalization of the learned representations when tested on corrupted ImageNet (ImageNet-C (Hendrycks & Dietterich, 2019)) and a version of ImageNet that consist of different renditions of the same classes (ImageNet-R (Hendrycks et al., 2020)). In terms of robustness, RELIC also significantly outperforms the supervised baseline with an absolute reduction of $4 . 9 \%$ in error. Unlike much prior work that specifically focuses on computer vision tasks, we test RELIC for representation learning in the context of reinforcement learning on the Atari suite (Bellemare et al., 2013). There we find that RELIC significantly outperforms competing methods and achieves above human-level performance on 51 out of 57 games.
23
+
24
+ # Contributions.
25
+
26
+ • We formalize problem of self-supervised representation learning using causality and propose to more effectively leverage data augmentations through invariant prediction.
27
+ • We propose a new self-supervised objective, REpresentation Learning with Invariance Causal mechanisms (RELIC), that enforces invariant prediction through an explicit regularizer and show improved generalization guarantees. We generalize contrastive learning using refinements and show that learning on refinements is a sufficient condition for learning useful representations; this provides an alternative explanation to MI for the success of contrastive methods.
28
+
29
+ # 2 REPRESENTATION LEARNING VIA INVARIANT CAUSAL MECHANISMS
30
+
31
+ Problem setting. Let $X$ denote the unlabelled observed data and $\mathcal { V } = \{ Y _ { t } \} _ { t = 1 } ^ { T }$ be a set of unknown tasks with $Y _ { t }$ denoting the targets for task $t$ . The tasks $\{ Y _ { t } \} _ { t = 1 } ^ { T }$ can represent both a multi-environment as well as a multi-task setup. Our goal is to pretrain with unsupervised data a representation $f ( X )$ that will be useful for solving the downstream tasks $\mathcal { V }$ .
32
+
33
+ Causal interpretation. To effectively leverage common assumptions and intuitions about data generation of the unknown downstream tasks for the learning algorithm, we propose to formalize them using a causal graph. We start from the following assumptions: a) the data is generated from content and style variables, with b) only content (and not style) being relevant for the unknown downstream tasks and c) content and style are independent, i.e. style changes are content-preserving. For example, when classifying dogs against giraffes from images, different parts of the animals constitute content, while style could be, for example, background, lighting conditions and camera lens characteristics. By assumption, content is a good representation of the data for downstream tasks and we therefore cast the goal of representation learning as estimating content. In the following, we compactly formalize these assumptions with a causal graph1, see Figure 1a.
34
+
35
+ ![](images/7d6b18a05d7010061f63fdf863493b0e8d6f15c64a17ca006f14b072fe70c129.jpg)
36
+ Figure 1: (a) Causal graph formalizing assumptions about content and style of the data and the relationship between targets and proxy tasks. The dashed arrows are not causal and represent learning, while the dashdotted lines denote that $Y ^ { R }$ is a refinement $Y _ { t }$ ’s. All other arrows are causal. (b) RELIC objective. KL refers to the Kullback-Leibler divergence, while $\mathbf { X }$ -entropy denotes cross entropy.
37
+
38
+ Let $C$ and $S$ be the latent variables describing content and style. In Figure 1a, the directed arrows from $C$ and $S$ to the observed data $X$ (e.g. images) indicate that $X$ is generated based on content and style. The directed arrow from $C$ to the target $Y _ { t }$ (e.g. class labels) encodes the assumption that content directly influences the target tasks, while the absence of any directed arrow from $S$ to $Y _ { t }$ indicates that style does not. Thus, content $C$ has all the necessary information to predict $Y _ { t }$ . The absence of any directed path between $C$ and $S$ in Figure 1a encodes the intuition that these variables are independent, i.e. $C \perp \perp S$ .
39
+
40
+ Using the independence of mechanisms (Peters et al., 2017), we can conclude that under this causal model performing interventions on $S$ does not change the conditional distribution $P ( Y _ { t } | C )$ , i.e. manipulating the value of $S$ does not influence this conditional distribution. Thus, $P ( Y _ { t } | C )$ is invariant under changes in style $S$ . We call $C$ an invariant representation for $Y _ { t }$ under $S$ , i.e.
41
+
42
+ $$
43
+ p ^ { d o ( S = s _ { i } ) } ( Y _ { t } \mid C ) = p ^ { d o ( S = s _ { j } ) } ( Y _ { t } \mid C ) \quad \forall s _ { i } , s _ { j } \in \mathcal { S } ,
44
+ $$
45
+
46
+ where $p ^ { d o ( S = s ) }$ denotes the distribution arising from assigning $S$ the value $s$ with $s$ the domain of $S$ (Pearl, 2009). Specifically, using $C$ as a representation allows for us to predict targets stably across perturbations, i.e. content $C$ is both a useful and robust representation for tasks $\mathcal { V }$ .
47
+
48
+ Since the targets $Y _ { t }$ are unknown, we will construct a proxy task $Y ^ { R }$ in order to learn representations from unlabeled data $X$ only. In order to learn useful representations for $Y _ { t }$ , we will construct proxy tasks that represents more fine-grained problems than $Y _ { t }$ ; for a more formal treatment of proxy tasks please refer to Section 3. Further, to learn invariant representations, such as $C$ , we enforce Equation 1 which requires us to observe data under different style interventions, i.e. we need data that describes the same content under varying style. Since we do not have access to $S$ , to simulate style variability we use content-preserving data augmentations (e.g. rotation, grayscaling, translation, cropping for images). Specifically, we utilize data augmentations as interventions on the style variable $S$ , i.e.
49
+
50
+ applying data augmentation $a _ { i }$ corresponds to intervening on $S$ and setting it to $s _ { a _ { i } }$ . 2 Although we are not able to generate all possible styles using a fixed set of data augmentations, we will use augmentations that generate large sets of diverse styles as this allows us to learn better representations. Note that the heuristic of estimating similarity based on different views from contrastive learning can be interpreted as an implicit invariance constraint.
51
+
52
+ RELIC objective. Equation 1 provides a general scheme to estimate content (c.f. Figure 1a). We operationalize this by proposing to learn representations such that prediction of proxy targets from the representation is invariant under data augmentations. The representation $f ( X )$ must fulfill the following invariant prediction criteria
53
+
54
+ (Invarian
55
+
56
+ $$
57
+ \begin{array} { r l r } { \prime p r e d i c t i o n ) } & { } & { p ^ { \mathrm { d o } ( a _ { i } ) } ( Y ^ { R } | f ( X ) ) = p ^ { \mathrm { d o } ( a _ { j } ) } ( Y ^ { R } | f ( X ) ) \quad \forall a _ { i } , a _ { j } \in \mathcal { A } . } \end{array}
58
+ $$
59
+
60
+ $\mathcal { A } = \{ a _ { 1 } , \ldots , a _ { m } \}$ is the set of data augmentations which simulate interventions on the style variables and $p ^ { d o ( a ) }$ denotes $p ^ { d o ( S = s _ { a } ) }$ .
61
+
62
+ To achieve invariant prediction, we propose to explicitly enforce invariance under augmentations through a regularizer. This gives rise to an objective for self-supervised learning we call Representation Learning via Invariant Causal Mechanisms (RELIC). We write this objective as
63
+
64
+ $$
65
+ \begin{array} { r } { \operatorname* { m i n } _ { \stackrel { X \warrow p ( X ) } { \sim \sim p ( X ) } } \underset { \sim \mathcal { A } \times \mathcal { A } } { \mathbb { E } } \quad \underset { b \in \{ a _ { l k } , a _ { q t } \} } { \sum } \mathcal { L } _ { b } ( Y ^ { R } , f ( X ) ) } \\ { s . t . \quad K L \left( p ^ { d o ( a _ { l k } ) } ( Y ^ { R } | f ( X ) ) , p ^ { d o ( a _ { q t } ) } ( Y ^ { R } | f ( X ) ) \right) \leq \rho } \end{array}
66
+ $$
67
+
68
+ where $\mathcal { L }$ is the proxy task loss and $K L$ is the Kullback-Leibler (KL) divergence. Note that any distance measure on distributions can be used in place of the KL divergence. We explain the remaining terms in detail below.
69
+
70
+ Concretely, as proxy task we associate to every datapoint $x _ { i }$ the label $y _ { i } ^ { R } = i$ . This corresponds to the instance discrimination task, commonly used in contrastive learning (Hadsell et al., 2006). We take pairs of points $( x _ { i } , x _ { j } )$ to compute similarity scores and use pairs of augmentations $a _ { l k } = ( a _ { l } , a _ { k } ) \in$ $A \times A$ to perform a style intervention. Given a batch of samples $\{ x _ { i } \} _ { i = 1 } ^ { N } \sim \mathcal { D }$ , we use
71
+
72
+ $$
73
+ p ^ { d o ( a _ { l k } ) } ( Y ^ { R } = j | f ( x _ { i } ) ) \propto \exp \left( \phi ( f ( x _ { i } ^ { a _ { l } } ) , h ( x _ { j } ^ { a _ { k } } ) ) / \tau \right) .
74
+ $$
75
+
76
+ with $x ^ { a }$ data augmented with $a$ and $\tau$ a softmax temperature parameter. We encode $f$ using a neural network and choose $h$ to be related to $f$ , e.g. $h = f$ or as a network with an exponential moving average of the weights of $f$ (e.g. target networks similar to (Grill et al., 2020)). To compare representations we use the function $\bar { \phi } ( f ( \bar { x _ { i } } ) , h ( x _ { j } ) ) \ : = \ : \langle g ( f ( x _ { i } ) ) , g ( h ( x _ { j } ) ) \rangle$ where $g$ is a fullyconnected neural network often called the critic.
77
+
78
+ Combining these pieces, we learn representations by minimizing the following objective over the full set of data $x _ { i } \in \mathcal { D }$ and augmentations $a _ { l k } \in \mathcal { A } \times \mathcal { A }$
79
+
80
+ $$
81
+ \operatorname* { m i n } - \sum _ { i = 1 } ^ { N } \sum _ { a _ { l k } } \log \frac { \exp { ( \phi ( f ( x _ { i } ^ { a _ { l } } ) , h ( x _ { i } ^ { a _ { k } } ) ) / \tau ) } } { \sum _ { m = 1 } ^ { M } \exp { ( \phi ( f ( x _ { i } ^ { a _ { l } } ) , h ( x _ { m } ^ { a _ { k } } ) ) / \tau ) } } + \alpha \sum _ { a _ { l k } , a _ { q t } } K L ( p ^ { d o ( a _ { l k } ) } , p ^ { d o ( a _ { q t } ) } )
82
+ $$
83
+
84
+ with $M$ the number of points we use to construct the contrast set and $\alpha$ the weighting of the invariance penalty. We used the shorthand $p ^ { d o ( a ) }$ for $p ^ { d o ( a ) } ( Y ^ { R } = j \mid f ( x _ { i } ) )$ . With appropriate choices for $\phi$ , $g$ , $f$ and $h$ above, Equation 3 recovers many recent state-of-the-art methods (c.f. Table 5 in Section A). Figure 1b presents a schematic of the RELIC objective.
85
+
86
+ The explicit invariance penalty encourages the within-class distances (for a downstream task of interest) of the representations learned by RELIC to be tightly concentrated. We show this empirically in Figure 2 and theoretically in Appendix B. In the following section we provide theoretical justification for using an instance discrimination-based contrastive loss using a causal perspective. We also show (cf. Theorem 1 below) that minimizing the contrastive loss alone (i.e. $\alpha = 0$ ) does not guarantee generalization. Instead, invariance across augmentations must be explicitly enforced.
87
+
88
+ # 3 GENERALIZING CONTRASTIVE LEARNING
89
+
90
+ Learning with refinements. In contrastive learning, the task of instance discrimination, i.e. classifying the dataset $\{ ( x _ { i } , y _ { i } ^ { R } = i ) | x _ { i } \in \mathcal { D } \}$ , is used as the proxy task. To better understand contrastive learning and motivate this proxy task, we generalize instance discrimination using the causal concept of refinements (Chalupka et al., 2014). Intuitively, a refinement of one problem is another more fine-grained problem. If task $Y _ { t }$ is to classify cats against dogs, then a refinement of $Y _ { t }$ is the task of classifying cats and dogs into their individual breeds. See Figure 4 for a further visual example. For any set of tasks, there exist many different refinements. However, the most fine-grained refinement corresponds exactly to classifying the dataset $\{ ( x _ { i } , y _ { i } ^ { R } = i ) | x _ { i } \in \mathcal { D } \}$ . Thus, the instance discrimination task used in contrastive learning is a specific type of refinement. For a definition and formal treatment of refinements please refer to Appendix D.
91
+
92
+ Let $Y ^ { R }$ be targets of a proxy task that is a refinement for all tasks in $\mathcal { V }$ . Leveraging causal tools, we connect learning on refinements to learning on downstream tasks. Specifically, we provide a theoretical justification for exchanging unknown downstream tasks with these specially constructed proxy tasks. We show that if $f ( X )$ is an invariant representation for $Y ^ { R }$ under changes in style $S$ , then $f ( X )$ is also an invariant representation for tasks in $\mathcal { V }$ under changes in style $S$ . Thus by enforcing invariance under style interventions on a refinement, we learn representations that generalize to downstream tasks.3 This is summarized in the following theorem.
93
+
94
+ Theorem 1. Let $\mathcal { V } = \{ Y _ { t } \} _ { t = 1 } ^ { T }$ be a family of downstream tasks. Let $Y ^ { R }$ be a refinement for all tasks in $\mathcal { V }$ . If $f ( X )$ is an invariant representation for $Y ^ { R }$ under style interventions $S$ , then $f ( X )$ is an invariant representation for all tasks in $\mathcal { V }$ under style interventions $S$ , i.e.
95
+
96
+ $$
97
+ \begin{array} { r l r } { p ^ { d o ( s _ { i } ) } ( Y ^ { R } \mid f ( X ) ) = p ^ { d o ( s _ { j } ) } ( Y ^ { R } \mid f ( X ) ) } & { { } \Rightarrow } & { p ^ { d o ( s _ { i } ) } ( Y _ { t } \mid f ( X ) ) = p ^ { d o ( s _ { j } ) } ( Y _ { t } \mid f ( X ) ) } \end{array}
98
+ $$
99
+
100
+ for all $s _ { i } , s _ { j } \in S$ with $p ^ { d o ( s _ { i } ) } = p ^ { d o ( S = s _ { i } ) }$ . Thus, $f ( X )$ is a representation that generalizes to $\mathcal { V }$
101
+
102
+ Theorem 1 states that if $Y ^ { R }$ is a refinement of $\mathcal { V }$ then learning a representation on $Y ^ { R }$ is a sufficient condition for this representation to be useful on $\mathcal { V }$ . For a formal exposition of these points and accompanying proofs, please refer to Appendix D. Recall that the instance discrimination proxy task is the most fine-grained refinement, and so the right hand side of 4 is satisfied for any downstream task satisfying the stated assumptions of the theorem.
103
+
104
+ We generalize contrastive learning through refinements and connect representations learned on refinements and downstream tasks in Theorem 1. Thus, using causality we provide an alternative explanation to mutual information for the success of contrastive learning. Note that our methodology of refinements is not limited to instance discrimination tasks and is thus more general than currently used contrastive losses. Real world data often includes rich sources of metadata which can be used to guide the construction of refinements by grouping the data according to any available meta-data. Note that the coarser we can create a refinement, the more data efficient we can expect to be when learning representations for downstream tasks. Further, we can also expect to require less supervised data to finetune the representation.
105
+
106
+ # 4 RELATED WORK
107
+
108
+ Contrastive objectives and mutual information maximization. Many recent approaches to selfsupervised learning are rooted in the well-established idea of maximizing mutual information (MI), e.g. Contrastive Predictive Coding (CPC) (Oord et al., 2018; Henaff et al., 2019), Deep InfoMax ´ (DIM) (Hjelm et al., 2018) and Augmented Multiscale DIM (AMDIM) (Bachman et al., 2019). These methods are based on noise contrastive estimation (NCE) (Gutmann & Hyvarinen, 2010) which, ¨ under specific conditions, can be viewed as a bound on MI (Poole et al., 2019). The resulting objective functions are commonly referred to as InfoNCE.
109
+
110
+ The precise role played by mutual information maximization in self-supervised learning is subject to some debate. (Tschannen et al., 2019) argue that the performance on downstream tasks is not correlated with the achieved bound on MI, but may be more tightly correlated with encoder architecture and capacity. Importantly, InfoNCE objectives require custom architectures to ensure the network does not converge to non-informative solutions thus precluding the use of standard architectures. Recently, several works (He et al., 2019; Chen et al., 2020a) successfully combined contrastive estimation with a standard ResNet-50 architecture. In particular, SimCLR (Chen et al., 2020a) relies on a set of strong augmentations4, while (He et al., 2019) uses a memory bank. Inspired by target networks in reinforcement learning, (Grill et al., 2020) proposed BYOL: an algorithm for self-supervised learning which remarkably does not use a contrastive objective. Although theoretical explanation for the good performance of BYOL is presently missing, interestingly the objective, an $\ell _ { 2 }$ distance between two different embeddings of the input data resembles the $\ell _ { 2 }$ form of our regularizer proposed in Equation 5 in Appendix B.
111
+
112
+ Recently, (Saunshi et al., 2019) proposed a learning theoretic framework to analyze the performance of contrastive objectives. However, without strong assumptions on intra-class concentration they note that contrastive objectives are fundamentally limited in the representations they are able to learn. RELIC explicitly enforces intra-class concentration via the invariance regularizer, ensuring that it generalizes under weaker assumptions. Unlike (Saunshi et al., 2019) who do not discuss augmentations, we incorporate augmentations into our theoretical explanation of contrastive methods.
113
+
114
+ The reasons for the improvement in performance from AMDIM through to SimCLR and BYOL are not easily explained by either the MI maximization or the learning theoretic viewpoint. Further, it is not clear why relatively minor architectural differences between the methods result in significant differences in performance nor is it obvious how current state-of-the-art can be improved. In contrast to prior art, the performance of RELIC is explained by connections to causal theory. As such it gives a clear path for improving results by devising problem appropriate refinements, interventions and invariance penalties. Furthermore, the use of invariance penalties in RELIC as dictated by causal theory yields significantly more robust representations that generalize better than those learned with SimCLR or BYOL.
115
+
116
+ ![](images/b9bdc1c7a4b16d60eb71a077be525dc6413a7049dc4f90a27f4eeb110e4847d9.jpg)
117
+ Figure 2: Distribution of the linear discriminant ratio $F _ { \mathrm { L D A } }$ , see text) of $f$ for RELIC, SimCLR and AMDIM $y$ -axis clipped to aid visualization).
118
+
119
+ Causality and invariance. Recently, the notion of invariant prediction has emerged as an important operational concept in causal inference (Peters et al., 2016). This idea has been used to learn classifiers which are robust against domain shifts (Gong et al., 2016). Notably, (Heinze-Deml & Meinshausen, 2017) propose to use group structure to delineate between different environments where the aim is to minimize the classification loss while also ensuring that the conditional variance of the prediction function within each group remains small. Unlike (Heinze-Deml & Meinshausen, 2017) who use supervised data and rely on having a grouping in the training data, our approach does not rely on ground-truth targets and can flexibly create groupings of the training data if none are present. Further, we enforce invariant prediction within the group by constraining the distance between distributions resulting from contrasting data across groups.
120
+
121
+ The relationship between causal inference and semi-supervised learning has been explored in (Scholkopf et al., 2012). In particular, in order for ¨ unlabeled data to be helpful for learning, the relationship between the predictors and targets must be anti-causal. Our setting is somewhat different as we assume a latent decomposition of the observed variables and learn representations based on proxy targets which are refinements of the true targets.
122
+
123
+ Our invariance penalty is similar in practise to consistency regularizers which have recently gained popularity in semi-supervised learning (Sajjadi et al., 2016; Xie et al., 2019; Sohn et al., 2020). These typically supplement the supervised training signal with a term which enforces similarity between the function’s output on two views of data. Although recently proposed consistency methods are heuristic, they have deeper roots in the more rigorous co-training approach to semi-supervised learning from multiple views (Blum & Mitchell, 1998; Kakade & Foster, 2007; Sridharan & Kakade, 2008; McWilliams & Montana, 2012; McWilliams et al., 2013). The main conceptual difference between our approach and consistency-based methods is that we do not have access to a supervised training signal and that the RELIC penalty is motivated from the underlying causal graph.
124
+
125
+ # 5 EXPERIMENTS
126
+
127
+ We first visualize the influence of the explicit invariance constraint in RELIC on the linear separability of the learned representations. We then evaluate RELIC on a number of prediction and reinforcement learning tasks for usefulness and robustness. For the prediction tasks, we test RELIC after pretraining the representation in a self-supervised way on the training set of the ImageNet ILSVRC-2012 dataset (Russakovsky et al., 2015). We evaluate RELIC in the linear evaluation setup on ImageNet and test its robustness and out-of-distribution generalization on datasets related to ImageNet. Unlike much prior work in contrastive learning which focuses specifically on computer vision tasks, we test RELIC also in the context of learning representations for reinforcement learning. Specifically, we test RELIC on the suite of Atari games (Bellemare et al., 2013) which consists of 57 diverse games of varying difficulty.
128
+
129
+ Linear evaluation. In order to understand how representations learned by RELIC differ from other methods, we compare it against those learned by AMDIM and SimCLR in terms of Fischer’s linear discriminant ratio (Friedman et al., 2009): $\begin{array} { r } { \dot { F _ { \mathrm { L D A } } } { } = \| \mu _ { k } - \mu _ { k ^ { \prime } } \| ^ { 2 } / \sum _ { i , j \in \mathcal { C } _ { k } } \| f ( x _ { i } ) - f ( x _ { j } ) \| ^ { 2 } } \end{array}$ where $\begin{array} { r } { \mu _ { k } = \frac { 1 } { | { \mathcal C } _ { k } | } \sum _ { i \in { \mathcal C } _ { k } } f ( x _ { i } ) } \end{array}$ is the mean of the representations of class $k$ and $\mathcal { C } _ { k }$ is the index set of that class. A larger $F _ { \mathrm { L D A } }$ implies that classes are more easily separated with a linear classifier. This can be achieved by either increasing distances between classes (numerator) or shrinking within-class variance (denominator).
130
+
131
+ Figure 2 shows the distribution of $F _ { \mathrm { L D A } }$ for RELIC, SimCLR and AMDIM after training as measured on the (downsampled) ImageNet validation set. The distance between medians of RELIC and SimCLR is 162. AMDIM is tightly concentrated close to 20. The invariance penalty ensures that— even though labels are $a$ -priori unknown—for RELIC within-class variability of $f$ is concentrated leading to better linear separability between classes in the downstream task of interest.This is reflected in the rightward shift of the distribution of $F _ { \mathrm { L D A } }$ in Figure 2 for RELIC compared with SimCLR and AMDIM which do not impose such a constraint.
132
+
133
+ Next we evaluate RELIC’s representation by training a linear classifier of top of the fixed encoder following the procedure in (Kolesnikov et al., 2019; Chen et al., 2020a) and Appendix E.4. In Table 1, we report top-1 and top-5 accuracy on the ImageNet test set. Methods denoted with \* use SimCLR augmentations (Chen et al., 2020a), while methods denoted $\dagger$ use custom, stronger augmentations. Comparing methods which use SimCLR augmentations, RELIC outperforms competing approaches on both ResNet-50 and ResNet-50 with target network. For completeness, we report results for SwAV (Caron et al., 2020) and InfoMin (Tian et al., 2020), but note that these methods use stronger augmentations which alone have been shown to boost performance by over $5 \%$ A fair comparison between different objectives can only be achieved under the same architecture and the same set of augmentations.
134
+
135
+ Table 1: Accuracy $( \mathrm { i n } \% )$ ) under linear evaluation on ImageNet for different self-supervised representation learning methods. Methods with \* use SimCLR augmentations. Methods with $\dagger$ use custom, stronger augmentations.
136
+
137
+ <table><tr><td>Method</td><td>Top-1</td><td>Top-5</td></tr><tr><td>ResNet-50architecture</td><td></td><td></td></tr><tr><td>PIRL</td><td>63.6</td><td></td></tr><tr><td>CPC v2</td><td>63.8</td><td>85.3</td></tr><tr><td>CMC</td><td>66.2</td><td>87.0</td></tr><tr><td>SimCLR(Chen et al.,2020a)</td><td>* 69.3</td><td>89.0</td></tr><tr><td>SwAV (Caron et al., 2020)</td><td>* 70.1</td><td>=</td></tr><tr><td>RELIC (ours)</td><td>* 70.3</td><td>89.5</td></tr><tr><td>InfoMin Aug.(Tian et al.,2020)</td><td>+ 73.0</td><td>91.1</td></tr><tr><td>SwAV (Caron et al., 2020)</td><td>+ 75.3</td><td>=</td></tr><tr><td>ResNet-50 with target network</td><td></td><td></td></tr><tr><td>MoCo v2 (Chen et al., 2020b)</td><td>71.1</td><td></td></tr><tr><td>BYOL (Grill et al., 2020)</td><td>* 74.3</td><td>91.6</td></tr><tr><td>RELIC (ours)</td><td>* 74.8</td><td>92.2</td></tr></table>
138
+
139
+ Robustness and generalization. We evaluate robustness and out-of-distribution generalization of RELIC’s representation on datasets Imagenet-C (Hendrycks & Dietterich, 2019) and ImageNet-R (Hendrycks et al., 2020), respectively. To evaluate RELIC’s representation, we train a linear classifier on top of the frozen representation following the procedure described in (Chen et al., 2020a) and appendix E.5.2. For Imagenet-C we report the mean Corruption Error (mCE) and Corruption Errors for Noise corruptions in Table 3. RELIC has significantly lower mCE than both the supervised ResNet-50 baseline and the unsupervised methods SimCLR and BYOL. Also, it has the lowest Corruption Error on 14 out of 15 corruptions when compared to SimCLR and BYOL. Thus, we see that RELIC learns the most robust representation. RELIC also outperforms SimCLR and BYOL on ImageNet-R showing its superior out-of-distribution generalization ability; see Table 2. For further details and results please consult E.5.
140
+
141
+ Table 2: Top-1 error rates for different self-supervised representation learning methods on ImageNetR. All models are trained only on clean ImageNet images and $\mathrm { R E L I C } _ { T }$ refers to RELIC using a ResNet-50 with target network as in BYOL (Grill et al., 2020).
142
+
143
+ <table><tr><td>Method</td><td>Supervised</td><td>SimCLR</td><td>RELIC</td><td>BYOL</td><td>RELICT</td></tr><tr><td>Top-1 Error (%)</td><td>63.9</td><td>81.7</td><td>77.4</td><td>77.0</td><td>76.2</td></tr></table>
144
+
145
+ Table 3: Mean Corruption Error (mCE), mean relative Corruption Error (mrCE) and Corruption Errors for the “Noise” class of corruptions (Gaussian, Shot, Impulse) on ImageNet-C. The mCE value is the average across 75 different corruptions. Methods are trained only on clean ImageNet images.
146
+
147
+ <table><tr><td>Method</td><td>mCE</td><td>mrCE</td><td>Gaussian</td><td>Shot</td><td>Impulse</td></tr><tr><td>Supervised</td><td>76.7</td><td>105.0</td><td>80.0</td><td>82.0</td><td>83.0</td></tr><tr><td>ResNet-50 architecture:</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>SimCLR</td><td>87.5</td><td>111.9</td><td>79.4</td><td>81.9</td><td>89.6</td></tr><tr><td>ReLIC</td><td>76.4</td><td>87.7</td><td>67.8</td><td>70.7</td><td>77.0</td></tr><tr><td>ResNet-50 with target network:</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>BYOL</td><td>72.3</td><td>90.0</td><td>65.9</td><td>68.4</td><td>73.7</td></tr><tr><td>ReLIC</td><td>70.8</td><td>88.4</td><td>63.6</td><td>65.7</td><td>69.2</td></tr></table>
148
+
149
+ Reinforcement Learning. Much prior work in contrastive learning has focused specifically on computer vision tasks. In order to compare these approaches in a different domain, we investigate representation learning in the context of reinforcement learning. We compare RELIC as an auxiliary loss against other state of the art self-supervised losses on an agent trained on 57 Atari games. Using human normalized scores as a metric, we use the original architecture and hyperparameters of the R2D2 agent (Kapturowski et al., 2019) and supplement it with a second encoder trained with a given representation learning loss. When auxiliary losses are present, the Q-Network takes the output of the second encoder as an input. The Q-Network and the encoder are trained with separate optimizers. For the augmentation baseline, the Q-Network takes two identical encoders trained end-to-end. Table 4 shows a comparison between RELIC, SimCLR, BYOL, CURL (Srinivas et al., 2020), and feeding augmented observations directly to the agent (Kostrikov et al., 2020). We find that RELIC has a significant advantage over competing self-supervised methods, performing best in 25 out of 57 games. The next best performing method, CURL performs best in 11 games. Note that none of these methods outperform R2D2 (Kapturowski et al., 2019) which achieves superhuman performance in 52 games. Although previously published work shows the auxiliary tasks help on Atari, this is in the very low-data regime. Here we show that ReLIC is able to close the gap in the more common Atari set up. We hypothesize that the performance penalty resulting from adding auxiliary self-supervised losses stems from the naive combining of the outputs of the two encoders; we will explore alternative options for combining encoder outputs in future. Full details are presented in Section E.6.
150
+
151
+ # 6 CONCLUSION
152
+
153
+ In this work we have analyzed self-supervised learning using a causal framework. Using a causal graph, we have formalized the problem of self-supervised representation learning and derived properties of the optimal representation. We have shown that representations need to be invariant predictors of proxy targets under interventions on features that are only correlated, but not causally related to the downstream tasks. We have leveraged data augmentations to simulate these interventions and have proposed to explicitly enforce this invariance constraint. Based on this, we have proposed a new self-supervised objective, Representation Learning via Invariant Causal Mechanisms (RELIC), that enforces invariant prediction of proxy targets across augmentations using an invariance regularizer. Further, we have generalized contrastive methods using the concept of refinements and have shown that learning a representation on refinements using the principle of invariant prediction is a sufficient condition for these representations to generalize to downstream tasks. With this, we have provided an alternative explanation to mutual information for the success of contrastive methods. Empirically we have compared RELIC against recent self-supervised methods on a variety of prediction and reinforcement learning tasks. Specifically, RELIC significantly outperforms competing methods in terms of robustness and out-of-distribution generalization of the representations it learns on ImageNet. RELIC also significantly outperforms related self-supervised methods on the Atari suite achieving superhuman performance on 51 out of 57 games. We aim to investigate the construction of more coarse-grained refinements and the empirical evaluation of different kinds of refinements in future work.
154
+
155
+ Table 4: Human Normalized Scores of Auxiliary Methods over 57 Atari Games.
156
+
157
+ <table><tr><td>AtariPerformance</td><td>RELIC</td><td>SimCLR</td><td>CURL</td><td>BYOL</td><td>Augmentation</td></tr><tr><td>Capped mean</td><td>91.46</td><td>88.76</td><td>90.72</td><td>89.43</td><td>80.60</td></tr><tr><td>Number of superhuman games</td><td>51</td><td>49</td><td>49</td><td>49</td><td>34</td></tr><tr><td>Mean</td><td>3003.73</td><td>2086.16</td><td>2413.12</td><td>1769.43</td><td>503.15</td></tr><tr><td>Median</td><td>832.50</td><td>592.83</td><td>819.56</td><td>483.39</td><td>132.17</td></tr><tr><td>40% Percentile</td><td>356.27</td><td>266.07</td><td>409.46</td><td>224.80</td><td>94.35</td></tr><tr><td>30% Percentile</td><td>202.49</td><td>174.19</td><td>190.96</td><td>150.21</td><td>80.04</td></tr><tr><td>20% Percentile</td><td>133.93</td><td>120.84</td><td>126.10</td><td>118.36</td><td>57.95</td></tr><tr><td>10% Percentile</td><td>83.79</td><td>37.19</td><td>59.09</td><td>44.14</td><td>32.74</td></tr><tr><td>5% Percentile</td><td>20.87</td><td>12.74</td><td>20.56</td><td>7.75</td><td>2.85</td></tr></table>
158
+
159
+ Acknowledgements. We thank David Balduzzi, Melanie Rey, Christina Heinze-Deml, Ilja Kuzborskij, Ali Eslami, Jeffrey de Fauw and Josip Djolonga for invaluable discussions.
160
+
161
+ # REFERENCES
162
+
163
+ Philip Bachman, R Devon Hjelm, and William Buchwalter. Learning representations by maximizing mutual information across views. In Advances in Neural Information Processing Systems, pp. 15509–15519, 2019.
164
+
165
+ Marc G. Bellemare, Yavar Naddaf, J. Veness, and Michael Bowling. The arcade learning environment: An evaluation platform for general agents (extended abstract). J. Artif. Intell. Res., 47:253–279, 2013.
166
+
167
+ Avrim Blum and Tom Mitchell. Combining labeled and unlabeled data with co-training. In Proceedings of the eleventh annual conference on Computational learning theory, pp. 92–100, 1998.
168
+
169
+ M. Caron, I. Misra, J. Mairal, Priya Goyal, P. Bojanowski, and Armand Joulin. Unsupervised learning of visual features by contrasting cluster assignments. ArXiv, abs/2006.09882, 2020.
170
+
171
+ Krzysztof Chalupka, Pietro Perona, and Frederick Eberhardt. Visual causal feature learning. arXiv preprint arXiv:1412.2309, 2014.
172
+
173
+ Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. arXiv preprint arXiv:2002.05709, 2020a.
174
+
175
+ Xinlei Chen, Haoqi Fan, Ross B. Girshick, and Kaiming He. Improved baselines with momentum contrastive learning. ArXiv, abs/2003.04297, 2020b.
176
+
177
+ Paul Erdos and Alfr ˝ ed R ´ enyi. On the evolution of random graphs. ´ Publ. Math. Inst. Hung. Acad. Sci, 5(1):17–60, 1960.
178
+
179
+ Jerome Friedman, Trevor Hastie, and Robert Tibshirani. The elements of statistical learning, volume 2. Springer series in statistics New York, 2009.
180
+
181
+ Alan Frieze and Michał Karonski. ´ Introduction to random graphs. Cambridge University Press, 2016.
182
+
183
+ Mingming Gong, Kun Zhang, Tongliang Liu, Dacheng Tao, Clark Glymour, and Bernhard Scholkopf. ¨ Domain adaptation with conditional transferable components. In International conference on machine learning, pp. 2839–2848, 2016.
184
+
185
+ Jean-Bastien Grill, Florian Strub, Florent Altche, Corentin Tallec, Pierre H Richemond, Elena ´ Buchatskaya, Carl Doersch, Bernardo Avila Pires, Zhaohan Daniel Guo, Mohammad Gheshlaghi Azar, et al. Bootstrap your own latent: A new approach to self-supervised learning. arXiv preprint arXiv:2006.07733, 2020.
186
+
187
+ Michael Gutmann and Aapo Hyvarinen. Noise-contrastive estimation: A new estimation principle ¨ for unnormalized statistical models. In Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, pp. 297–304, 2010.
188
+
189
+ Raia Hadsell, Sumit Chopra, and Yann LeCun. Dimensionality reduction by learning an invariant mapping. In 2006 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR’06), volume 2, pp. 1735–1742. IEEE, 2006.
190
+
191
+ 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.
192
+
193
+ Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross Girshick. Momentum contrast for unsupervised visual representation learning. arXiv preprint arXiv:1911.05722, 2019.
194
+
195
+ Christina Heinze-Deml and Nicolai Meinshausen. Conditional variance penalties and domain shift robustness. arXiv preprint arXiv:1710.11469, 2017.
196
+
197
+ 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.
198
+
199
+ Dan Hendrycks and Thomas Dietterich. Benchmarking neural network robustness to common corruptions and perturbations. Proceedings of the International Conference on Learning Representations, 2019.
200
+
201
+ Dan Hendrycks, Steven Basart, Norman Mu, Saurav Kadavath, Frank Wang, Evan Dorundo, Rahul Desai, Tyler Zhu, Samyak Parajuli, Mike Guo, et al. The many faces of robustness: A critical analysis of out-of-distribution generalization. arXiv preprint arXiv:2006.16241, 2020.
202
+
203
+ R Devon Hjelm, Alex Fedorov, Samuel Lavoie-Marchildon, Karan Grewal, Phil Bachman, Adam Trischler, and Yoshua Bengio. Learning deep representations by mutual information estimation and maximization. arXiv preprint arXiv:1808.06670, 2018.
204
+
205
+ S. Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. ArXiv, abs/1502.03167, 2015.
206
+
207
+ Sham M Kakade and Dean P Foster. Multi-view regression via canonical correlation analysis. In International Conference on Computational Learning Theory, pp. 82–96. Springer, 2007.
208
+
209
+ Steven Kapturowski, Georg Ostrovski, Will Dabney, John Quan, and Remi Munos. Recurrent experience replay in distributed reinforcement learning. Iclr, 2019.
210
+
211
+ A. Kolesnikov, Xiaohua Zhai, and Lucas Beyer. Revisiting self-supervised visual representation learning. 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 1920–1929, 2019.
212
+
213
+ Ilya Kostrikov, Denis Yarats, and Rob Fergus. Image augmentation is all you need: Regularizing deep reinforcement learning from pixels. arXiv preprint arXiv:2004.13649, 2020.
214
+
215
+ I. Loshchilov and F. Hutter. Sgdr: Stochastic gradient descent with warm restarts. In ICLR, 2017.
216
+
217
+ Brian McWilliams and Giovanni Montana. Multi-view predictive partitioning in high dimensions. Statistical Analysis and Data Mining: The ASA Data Science Journal, 5(4):304–321, 2012.
218
+
219
+ Brian McWilliams, David Balduzzi, and Joachim M Buhmann. Correlated random features for fast semi-supervised learning. In Advances in Neural Information Processing Systems, pp. 440–448, 2013.
220
+
221
+ V. Nair and Geoffrey E. Hinton. Rectified linear units improve restricted boltzmann machines. In ICML, 2010.
222
+
223
+ Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018.
224
+
225
+ Judea Pearl. Causality. Cambridge university press, 2009.
226
+
227
+ Jonas Peters, Peter Buhlmann, and Nicolai 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.
228
+
229
+ Jonas Peters, Dominik Janzing, and Bernhard Scholkopf. ¨ Elements of causal inference: foundations and learning algorithms. MIT press, 2017.
230
+
231
+ Ben Poole, Sherjil Ozair, Aaron Van Den Oord, Alex Alemi, and George Tucker. On variational bounds of mutual information. In International Conference on Machine Learning, pp. 5171–5180, 2019.
232
+
233
+ Olga Russakovsky, J. Deng, H. Su, J. Krause, S. Satheesh, S. Ma, Zhiheng Huang, A. Karpathy, A. Khosla, M. Bernstein, A. Berg, and Li Fei-Fei. Imagenet large scale visual recognition challenge. International Journal of Computer Vision, 115:211–252, 2015.
234
+
235
+ Mehdi Sajjadi, Mehran Javanmardi, and Tolga Tasdizen. Regularization with stochastic transformations and perturbations for deep semi-supervised learning. Advances in neural information processing systems, 29:1163–1171, 2016.
236
+
237
+ Nikunj Saunshi, Orestis Plevrakis, Sanjeev Arora, Mikhail Khodak, and Hrishikesh Khandeparkar. A theoretical analysis of contrastive unsupervised representation learning. In International Conference on Machine Learning, pp. 5628–5637, 2019.
238
+
239
+ Bernhard Scholkopf, Dominik Janzing, Jonas Peters, Eleni Sgouritsa, Kun Zhang, and Joris Mooij. ¨ On causal and anticausal learning. arXiv preprint arXiv:1206.6471, 2012.
240
+
241
+ Kihyuk Sohn, David Berthelot, Chun-Liang Li, Zizhao Zhang, Nicholas Carlini, Ekin D Cubuk, Alex Kurakin, Han Zhang, and Colin Raffel. Fixmatch: Simplifying semi-supervised learning with consistency and confidence. arXiv preprint arXiv:2001.07685, 2020.
242
+
243
+ Karthik Sridharan and Sham M Kakade. An information theoretic framework for multi-view learning. 2008.
244
+
245
+ Aravind Srinivas, Michael Laskin, and Pieter Abbeel. Curl: Contrastive unsupervised representations for reinforcement learning. arXiv preprint arXiv:2004.04136, 2020.
246
+
247
+ Yonglong Tian, C. Sun, Ben Poole, Dilip Krishnan, C. Schmid, and Phillip Isola. What makes for good views for contrastive learning. ArXiv, abs/2005.10243, 2020.
248
+
249
+ Michael Tschannen, Josip Djolonga, Paul K Rubenstein, Sylvain Gelly, and Mario Lucic. On mutual information maximization for representation learning. arXiv preprint arXiv:1907.13625, 2019.
250
+
251
+ Haohan Wang, Songwei Ge, E. Xing, and Zachary Chase Lipton. Learning robust global representations by penalizing local predictive power. ArXiv, abs/1905.13549, 2019.
252
+
253
+ Qizhe Xie, Zihang Dai, Eduard Hovy, Minh-Thang Luong, and Quoc V Le. Unsupervised data augmentation. arXiv preprint arXiv:1904.12848, 2019.
254
+
255
+ Yang You, Igor Gitman, and Boris Ginsburg. Large batch training of convolutional networks. arXiv preprint arXiv:1708.03888, 2017.
md/train/B18WgG-CZ/B18WgG-CZ.md ADDED
@@ -0,0 +1,361 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LEARNING GENERAL PURPOSE DISTRIBUTED SENTENCE REPRESENTATIONS VIA LARGE SCALE MULTITASK LEARNING
2
+
3
+ Sandeep Subramanian1,2,3∗, Adam Trischler3, Yoshua Bengio1,2,4 & Christopher J Pal1,5
4
+
5
+ 1 Montreal Institute for Learning Algorithms (MILA) ´
6
+ 2 Universite de Montr ´ eal ´
7
+ 3 Microsoft Research Montreal
8
+ 4 CIFAR Senior Fellow
9
+ 5 Ecole Polytechnique de Montr ´ eal ´
10
+
11
+ # ABSTRACT
12
+
13
+ A lot of the recent success in natural language processing (NLP) has been driven by distributed vector representations of words trained on large amounts of text in an unsupervised manner. These representations are typically used as general purpose features for words across a range of NLP problems. However, extending this success to learning representations of sequences of words, such as sentences, remains an open problem. Recent work has explored unsupervised as well as supervised learning techniques with different training objectives to learn general purpose fixed-length sentence representations. In this work, we present a simple, effective multi-task learning framework for sentence representations that combines the inductive biases of diverse training objectives in a single model. We train this model on several data sources with multiple training objectives on over 100 million sentences. Extensive experiments demonstrate that sharing a single recurrent sentence encoder across weakly related tasks leads to consistent improvements over previous methods. We present substantial improvements in the context of transfer learning and low-resource settings using our learned general-purpose representations.
14
+
15
+ # 1 INTRODUCTION
16
+
17
+ Transfer learning has driven a number of recent successes in computer vision and NLP. Computer vision tasks like image captioning (Xu et al., 2015) and visual question answering typically use CNNs pretrained on ImageNet (Krizhevsky et al., 2012; Simonyan & Zisserman, 2014) to extract representations of the image, while several natural language tasks such as reading comprehension and sequence labeling (Lample et al., 2016) have benefited from pretrained word embeddings (Mikolov et al., 2013; Pennington et al., 2014) that are either fine-tuned for a specific task or held fixed.
18
+
19
+ Many neural NLP systems are initialized with pretrained word embeddings but learn their representations of words in context from scratch, in a task-specific manner from supervised learning signals. However, learning these representations reliably from scratch is not always feasible, especially in low-resource settings, where we believe that using general purpose sentence representations will be beneficial.
20
+
21
+ Some recent work has addressed this by learning general-purpose sentence representations (Kiros et al., 2015; Wieting et al., 2015; Hill et al., 2016; Conneau et al., 2017; McCann et al., 2017; Jernite et al., 2017; Nie et al., 2017; Pagliardini et al., 2017). However, there exists no clear consensus yet on what training objective or methodology is best suited to this goal.
22
+
23
+ Understanding the inductive biases of distinct neural models is important for guiding progress in representation learning. Shi et al. (2016) and Belinkov et al. (2017) demonstrate that neural machine translation (NMT) systems appear to capture morphology and some syntactic properties. Shi et al. (2016) also present evidence that sequence-to-sequence parsers (Vinyals et al., 2015) more strongly encode source language syntax. Similarly, Adi et al. (2016) probe representations extracted by sequence autoencoders, word embedding averages, and skip-thought vectors with a multi-layer perceptron (MLP) classifier to study whether sentence characteristics such as length, word content and word order are encoded.
24
+
25
+ To generalize across a diverse set of tasks, it is important to build representations that encode several aspects of a sentence. Neural approaches to tasks such as skip-thoughts, machine translation, natural language inference, and constituency parsing likely have different inductive biases. Our work exploits this in the context of a simple one-to-many multi-task learning (MTL) framework, wherein a single recurrent sentence encoder is shared across multiple tasks. We hypothesize that sentence representations learned by training on a reasonably large number of weakly related tasks will generalize better to novel tasks unseen during training, since this process encodes the inductive biases of multiple models. This hypothesis is based on the theoretical work of Baxter et al. (2000). While our work aims at learning fixed-length distributed sentence representations, it is not always practical to assume that the entire “meaning” of a sentence can be encoded into a fixed-length vector. We merely hope to capture some of its characteristics that could be of use in a variety of tasks.
26
+
27
+ The primary contribution of our work is to combine the benefits of diverse sentence-representation learning objectives into a single multi-task framework. To the best of our knowledge, this is the first large-scale reusable sentence representation model obtained by combining a set of training objectives with the level of diversity explored here, i.e. multi-lingual NMT, natural language inference, constituency parsing and skip-thought vectors. We demonstrate through extensive experimentation that representations learned in this way lead to improved performance across a diverse set of novel tasks not used in the learning of our representations. Such representations facilitate low-resource learning as exhibited by significant improvements to model performance for new tasks in the low labelled data regime - achieving comparable performance to a few models trained from scratch using only $6 \%$ of the available training set on the Quora duplicate question dataset.
28
+
29
+ # 2 RELATED WORK
30
+
31
+ The problem of learning distributed representations of phrases and sentences dates back over a decade. For example, Mitchell & Lapata (2008) present an additive and multiplicative linear composition function of the distributed representations of individual words. Clark & Pulman (2007) combine symbolic and distributed representations of words using tensor products. Advances in learning better distributed representations of words (Mikolov et al., 2013; Pennington et al., 2014) combined with deep learning have made it possible to learn complex non-linear composition functions of an arbitrary number of word embeddings using convolutional or recurrent neural networks (RNNs). A network’s representation of the last element in a sequence, which is a non-linear composition of all inputs, is typically assumed to contain a squashed “summary” of the sentence. Most work in supervised learning for NLP builds task-specific representations of sentences rather than general-purpose ones.
32
+
33
+ Notably, skip-thought vectors (Kiros et al., 2015), an extension of the skip-gram model for word embeddings (Mikolov et al., 2013) to sentences, learn re-usable sentence representations from weakly labeled data. Unfortunately, these models take weeks or often months to train. Hill et al. (2016) address this by considering faster alternatives such as sequential denoising autoencoders and shallow log-linear models. Arora et al. (2016), however, demonstrate that simple word embedding averages are comparable to more complicated models like skip-thoughts. More recently, Conneau et al. (2017) show that a completely supervised approach to learning sentence representations from natural language inference data outperforms all previous approaches on transfer learning benchmarks. Here we use the terms “transfer learning performance” on “transfer tasks” to mean the performance of sentence representations evaluated on tasks unseen during training. McCann et al. (2017) demonstrated that representations learned by state-of-the-art large-scale NMT systems also generalize well to other tasks. However, their use of an attention mechanism prevents the learning of a single fixedlength vector representation of a sentence. As a result, they present a bi-attentive classification network that composes information present in all of the model’s hidden states to achieve improvements over a corresponding model trained from scratch. Jernite et al. (2017) and Nie et al. (2017)
34
+
35
+ demonstrate that discourse-based objectives can also be leveraged to learn good sentence representations.
36
+
37
+ Our work is most similar to that of Luong et al. (2015), who train a many-to-many sequenceto-sequence model on a diverse set of weakly related tasks that includes machine translation, constituency parsing, image captioning, sequence autoencoding, and intra-sentence skip-thoughts. There are two key differences between that work and our own. First, like McCann et al. (2017), their use of an attention mechanism prevents learning a fixed-length vector representation for a sentence. Second, their work aims for improvements on the same tasks on which the model is trained, as opposed to learning re-usable sentence representations that transfer elsewhere.
38
+
39
+ We further present a fine-grained analysis of how different tasks contribute to the encoding of different information signals in our representations following work by Shi et al. (2016) and Adi et al. (2016).
40
+
41
+ Hashimoto et al. (2016) similarly present a multi-task framework for textual entailment with task supervision at different levels of learning. “Universal” multi-task models have also been successfully explored in the context of computer vision problems (Kokkinos, 2016; Eigen & Fergus, 2015).
42
+
43
+ # 3 SEQUENCE-TO-SEQUENCE LEARNING
44
+
45
+ Five out of the six tasks that we consider for multi-task learning are formulated as sequence-tosequence problems (Cho et al., 2014; Sutskever et al., 2014). Briefly, sequence-to-sequence models are a specific case of encoder-decoder models where the inputs and outputs are sequential. They directly model the conditional distribution of outputs given inputs $P ( \mathbf { y } | \mathbf { x } )$ . The input $\mathbf { x }$ and output y are sequences $x _ { 1 } , x _ { 2 } , \ldots , x _ { m }$ and $y _ { 1 } , y _ { 2 } \ldots , y _ { n }$ . The encoder produces a fixed length vector representation $\mathbf { h } _ { \mathbf { x } }$ of the input, which the decoder then conditions on to generate an output. The decoder is auto-regressive and breaks down the joint probability of outputs into a product of conditional probabilities via the chain rule:
46
+
47
+ $$
48
+ P ( \mathbf { y } | \mathbf { x } ) = \prod _ { i = 1 } ^ { n } P ( y _ { i } | y _ { < i } , \mathbf { h } _ { \mathbf { x } } )
49
+ $$
50
+
51
+ Cho et al. (2014) and Sutskever et al. (2014) use encoders and decoders parameterized as RNN variants such as Long Short-term Memory (LSTMs) (Hochreiter & Schmidhuber, 1997) or Gated Recurrent Units (GRUs) (Chung et al., 2014). The hidden representation $\mathbf { h } _ { \mathbf { x } }$ is typically the last hidden state of the encoder RNN.
52
+
53
+ Bahdanau et al. (2014) alleviate the gradient bottleneck between the encoder and the decoder by introducing an attention mechanism that allows the decoder to condition on every hidden state of the encoder RNN instead of only the last one. In this work, as in Kiros et al. (2015); Hill et al. (2016), we do not employ an attention mechanism. This enables us to obtain a single, fixed-length, distributed sentence representation. To diminish the effects of vanishing gradient, we condition every decoding step on the encoder hidden representation $\mathbf { h } _ { \mathbf { x } }$ . We use a GRU for the encoder and decoder in the interest of computational speed. The encoder is a bidirectional GRU while the decoder is a unidirectional conditional GRU whose parameterization is as follows:
54
+
55
+ $$
56
+ \begin{array} { r l } & { \mathbf { r _ { t } } = \sigma ( \mathbf { W _ { r } } x _ { t } + \mathbf { U _ { r } } \mathbf { h _ { t - 1 } } + \mathbf { C _ { r } } \mathbf { h _ { x } } ) } \\ & { \mathbf { z _ { t } } = \sigma ( \mathbf { W _ { z } } x _ { t } + \mathbf { U _ { z } } \mathbf { h _ { t - 1 } } + \mathbf { C _ { z } } \mathbf { h _ { x } } ) } \\ & { \tilde { \mathbf { h _ { t } } } = \operatorname { t a n h } ( \mathbf { W _ { d } } x _ { t } + \mathbf { U _ { d } } ( \mathbf { r _ { t } } \odot \mathbf { h _ { t - 1 } } ) + \mathbf { C _ { d } } \mathbf { h _ { x } } ) } \\ & { \mathbf { h _ { t + 1 } } = ( 1 - \mathbf { z _ { t } } ) \odot \mathbf { h _ { t - 1 } } + \mathbf { z _ { t } } \odot \tilde { \mathbf { h _ { t } } } } \end{array}
57
+ $$
58
+
59
+ The encoder representation $\mathbf { h } _ { \mathbf { x } }$ is provided as conditioning information to the reset gate, update gate and hidden state computation in the GRU via the parameters $\mathbf { C _ { r } }$ , $\mathbf { C _ { z } }$ and $\mathbf { C _ { d } }$ to avoid attenuation of information from the encoder.
60
+
61
+ # 3.1 MULTI-TASK SEQUENCE-TO-SEQUENCE LEARNING
62
+
63
+ Dong et al. (2015) present a simple one-to-many multi-task sequence-to-sequence learning model for NMT that uses a shared encoder for English and task-specific decoders for multiple target languages.
64
+
65
+ Luong et al. (2015) extend this by also considering many-to-one (many encoders, one decoder) and many-to-many architectures. In this work, we consider a one-to-many model since it lends itself naturally to the idea of combining inductive biases from different training objectives. The same bidirectional GRU encodes the input sentences from different tasks into a compressed summary $\mathbf { h } _ { \mathbf { x } }$ which is then used to condition a task-specific GRU to produce the output sentence.
66
+
67
+ # 4 TRAINING OBJECTIVES & EVALUATION
68
+
69
+ Our motivation for multi-task training stems from theoretical insights presented in Baxter et al. (2000). We refer readers to that work for a detailed discussion of results, but the conclusions most relevant to this discussion are (i) that learning multiple related tasks jointly results in good generalization as measured by the number of training examples required per task; and (ii) that inductive biases learned on sufficiently many training tasks are likely to be good for learning novel tasks drawn from the same environment.
70
+
71
+ We select the following training objectives to learn general-purpose sentence embeddings. Our desiderata for the task collection were: sufficient diversity, existence of fairly large datasets for training, and success as standalone training objectives for sentence representations.
72
+
73
+ Skip-thought vectors Skip-thought vectors (Kiros et al., 2015) are an extension of skip-gram word embedding models to sentences. The task typically requires a corpus of contiguous sentences, for which we use the BookCorpus (Zhu et al., 2015). The learning objective is to simultaneously predict the next and previous sentences from the current sentence. The encoder for the current sentence and the decoders for the previous (STP) and next sentence (STN) are typically parameterized as separate RNNs. We also consider training skip-thoughts by predicting only the next sentence given the current, motivated by results in Tang et al. (2017) where it is demonstrated that predicting the next sentence alone leads to comparable performance.
74
+
75
+ Neural Machine Translation Sutskever et al. (2014) and Cho et al. (2014) demonstrated that NMT can be formulated as a sequence-to-sequence learning problem where the input is a sentence in the source language and the output is its corresponding translation in the target language. We use a parallel corpus of around 4.5 million English-German (De) sentence pairs from WMT15 and 40 million English-French $( \mathrm { F r } )$ sentence pairs from WMT14. We train our representations using multiple target languages motivated by improvements demonstrated by Dong et al. (2015).
76
+
77
+ Constituency Parsing (linearized parse tree construction) Vinyals et al. (2015) demonstrated that a sequence-to-sequence approach to constituency parsing is viable. The input to the encoder is the sentence itself and the decoder produces its linearized parse tree. We train on 3 million weakly labeled parses obtained by parsing a random subset of the 1-billion word corpus with the Puck GPU parser1 along with gold parses from sections 0-21 of the WSJ section of Penn Treebank. Gold parses are duplicated 5 times and shuffled in with the weakly labeled parses to have a roughly 1:5 ratio of gold to noisy parses.
78
+
79
+ Natural Language Inference Natural language inference (NLI) is a 3-way classification problem. Given a premise and a hypothesis sentence, the objective is to classify their relationship as either entailment, contradiction, or neutral. In contrast to the previous tasks, we do not formulate this as sequence-to-sequence learning. We use the shared recurrent sentence encoder to encode both the premise and hypothesis into fixed length vectors $u$ and $v$ , respectively. We then feed the vector $\left[ u ; v ; | u - v | ; u * v \right]$ , which is a concatenation of the premise and hypothesis vectors and their respective absolute difference and hadamard product, to an MLP that performs the 3-way classification. This is the same classification strategy adopted by Conneau et al. (2017). We train on a collection of about 1 million sentence pairs from the SNLI (Bowman et al., 2015) and MultiNLI (Williams et al., 2017) corpora.
80
+
81
+ Table 1 presents a summary of the number of sentence pairs used for each task.
82
+
83
+ Table 1: An approximate number of sentence pairs for each task.
84
+
85
+ <table><tr><td>Task</td><td>Sentence Pairs</td></tr><tr><td>En-Fr (WMT14)</td><td>40M</td></tr><tr><td>En-De (WMT15)</td><td>5M</td></tr><tr><td>Skipthought (BookCorpus) AlINLI (SNLI + MultiNLI)</td><td>74M</td></tr><tr><td>Parsing (PTB + 1-billion word)</td><td>1M</td></tr><tr><td>Total</td><td>4M</td></tr><tr><td></td><td>124M</td></tr></table>
86
+
87
+ # 4.1 MULTI-TASK TRAINING SETUP
88
+
89
+ Multi-task training with different data sources for each task stills poses open questions. For example: When does one switch to training on a different task? Should the switching be periodic? Do we weight each task equally? If not, what training ratios do we use?
90
+
91
+ Dong et al. (2015) use periodic task alternations with equal training ratios for every task. In contrast, Luong et al. (2015) alter the training ratios for each task based on the size of their respective training sets. Specifically, the training ratio for a particular task, $\alpha _ { i }$ , is the fraction of the number of training examples in that task to the total number of training samples across all tasks. The authors then perform $\alpha _ { i } * N$ parameter updates on task $i$ before selecting a new task at random proportional to the training ratios, where $\mathbf { N }$ is a predetermined constant.
92
+
93
+ We take a simpler approach and pick a new sequence-to-sequence task to train on after every parameter update sampled uniformly. An NLI minibatch is interspersed after every ten parameter updates on sequence-to-sequence tasks (this was chosen so as to complete roughly 6 epochs of the dataset after 7 days of training). Our approach is described formally in the Algorithm below.
94
+
95
+ Model details can be found in section 7 in the Appendix.
96
+
97
+ Require: A set of $k$ tasks with a common source language, a shared encoder $\mathbf { E }$ across all tasks and a set of $k$ task specific decoders $\mathbf { D _ { 1 } } \ldots . . \mathbf { D _ { k } }$ . Let $\theta$ denote each model’s parameters, $\alpha$ a probability vector $( p _ { 1 } \ldots p _ { k } )$ denoting the probability of sampling a task such that $\dot { \Sigma } _ { i } ^ { k } p _ { i } = 1$ , datasets for each task $\mathbb { P } _ { 1 } \ldots \mathbb { P } _ { \mathrm { k } }$ and a loss function $L$ .
98
+
99
+ while $\theta$ has not converged do
100
+
101
+ 1: Sample task $i \sim \mathbf { C a t } ( k , \alpha )$ .
102
+ 2: Sample input, output pairs x, $\mathbf { y } \sim \mathbb { P } \mathrm { i }$
103
+ 3: Input representation $\mathbf { h } _ { x } \gets \mathbf { E } _ { \theta } ( \mathbf { x } )$ .
104
+ 4: Prediction $\tilde { \mathbf { y } } \gets \mathbf { D } _ { i _ { \theta } } ( \mathbf { h } _ { x } )$
105
+ 5: $\theta \gets \mathrm { A d a m } ( \nabla _ { \theta } L ( \mathbf { y } , \tilde { \mathbf { y } } ) )$ .
106
+
107
+ # end
108
+
109
+ ![](images/1a516c0d079b309b925901c590fc11ca798c0ae6f1df754376864861468a1305.jpg)
110
+ Figure 1: T-SNE visualizations of our sentence representations on 3 different datasets. SUBJ (left), TREC (middle), DBpedia (right). Dataset details are presented in the Appendix.
111
+
112
+ # 5 EVALUATION STRATEGIES, EXPERIMENTAL RESULTS & DISCUSSION
113
+
114
+ In this section, we describe our approach to evaluate the quality of our learned representations, present the results of our evaluation and discuss our findings.
115
+
116
+ # 5.1 EVALUATION STRATEGY
117
+
118
+ We follow a similar evaluation protocol to those presented in Kiros et al. (2015); Hill et al. (2016); Conneau et al. (2017) which is to use our learned representations as features for a low complexity classifier (typically linear) on a novel supervised task/domain unseen during training without updating the parameters of our sentence representation model. We also consider such a transfer learning evaluation in an artificially constructed low-resource setting. In addition, we also evaluate the quality of our learned individual word representations using standard benchmarks (Faruqui & Dyer, 2014; Tsvetkov et al., 2015).
119
+
120
+ The choice of transfer tasks and evaluation framework2 are borrowed largely from Conneau et al. (2017). We provide a condensed summary of the tasks in section 10 in the Appendix but refer readers to their paper for a more detailed description.
121
+
122
+ # 5.2 EXPERIMENTAL RESULTS & DISCUSSION
123
+
124
+ Table 2 presents the results of training logistic regression on 10 different supervised transfer tasks using different fixed-length sentence representation. Supervised approaches trained from scratch on some of these tasks are also presented for comparison. We present performance ablations when adding more tasks and increasing the number of hidden units in our GRU $\left( + \mathbf { L } \right)$ . Ablation specifics are presented in section 9 of the Appendix.
125
+
126
+ It is evident from Table 2 that adding more tasks improves the transfer performance of our model. Increasing the capacity our sentence encoder with more hidden units $\left( + \mathbf { L } \right)$ as well as an additional layer $( + 2 \mathrm { L } )$ also lead to improved transfer performance. We observe gains of $1 . 1 { - } 2 . 3 \%$ on the sentiment classification tasks (MR, CR, SUBJ & MPQA) over Infersent and smaller improvement of $0 . 5 \%$ on SST. We demonstrate substantial gains on TREC $6 \%$ over Infersent and roughly $2 \%$ over the CNN-LSTM), outperforming even a competitive supervised baseline. We see similar gains $( 2 . 3 \% )$ on paraphrase identification (MPRC), closing the gap on supervised approaches trained from scratch. The addition of constituency parsing improves performance on sentence relatedness (SICKR) and entailment (SICK-E) consistent with observations made by Bowman et al. (2016).
127
+
128
+ In Table 4, we show that simply training an MLP on top of our fixed sentence representations outperforms several strong $\&$ complex supervised approaches that use attention mechanisms, even on this fairly large dataset. For example, we observe a $0 . 2 \substack { - 0 . 5 \% }$ improvement over the decomposable attention model (Parikh et al., 2016). When using only a small fraction of the training data, indicated by the columns $1 \mathrm { k } { - } 2 5 \mathrm { k }$ , we are able to outperform the Siamese and Multi-Perspective CNN using roughly $6 \%$ of the available training set. We also outperform the Deconv LVM model proposed by Shen et al. (2017) in this low-resource setting.
129
+
130
+ Unlike Conneau et al. (2017), who use pretrained GloVe word embeddings, we learn our word embeddings from scratch. Somewhat surprisingly, in Table 3 we observe that the learned word embeddings are competitive with popular methods such as GloVe, word2vec, and fasttext (Bojanowski et al., 2016) on the benchmarks presented by Faruqui & Dyer (2014) and Tsvetkov et al. (2015).
131
+
132
+ In Table 5, we probe our sentence representations to determine if certain sentence characteristics and syntactic properties can be inferred following work by Adi et al. (2016) and Shi et al. (2016). We observe that syntactic properties are better encoded with the addition of multi-lingual NMT and parsing. Representations learned solely from NLI do appear to encode syntax but incorporation into our multi-task framework does not amplify this signal. Similarly, we observe that sentence characteristics such as length and word order are better encoded with the addition of parsing.
133
+
134
+ In Appendix Table 6, we note that our sentence representations outperform skip-thoughts and are on par with Infersent for image-caption retrieval. We also observe that comparing sentences using
135
+
136
+ <table><tr><td>Model</td><td>MR</td><td>CR</td><td>SUBJ</td><td>MPQA</td><td>SST</td><td>TREC</td><td>MRPC</td><td>SICK-R</td><td>SICK-E</td><td>STSB</td><td>△</td></tr><tr><td colspan="10">Transfer approaches</td></tr><tr><td>FastSent</td><td>70.8</td><td>78.4</td><td>88.7</td><td>80.6</td><td></td><td>76.8</td><td>72.2/80.3</td><td></td><td></td><td></td><td></td></tr><tr><td>FastSent+AE</td><td>71.8</td><td>76.7</td><td>88.8</td><td>81.5</td><td>=</td><td>80.4</td><td>71.2/79.1</td><td>-</td><td></td><td>= =</td><td>=</td></tr><tr><td>NMTEn-Fr</td><td>64.7</td><td>70.1</td><td>84.9</td><td>81.5</td><td>=</td><td>82.8</td><td></td><td></td><td></td><td>=</td><td>1</td></tr><tr><td>CNN-LSTM</td><td>77.8</td><td>82.1</td><td>93.6</td><td>89.4</td><td></td><td>92.6</td><td>76.5/83.8</td><td>0.862</td><td>-</td><td>-</td><td>1</td></tr><tr><td>Skipthought</td><td>76.5</td><td>80.1</td><td>93.6</td><td>87.1</td><td>1 82.0</td><td>92.2</td><td>73.0/82.0</td><td>0.858</td><td>82.3</td><td></td><td>-</td></tr><tr><td>Skipthought + LN</td><td>79.4</td><td>83.1</td><td>93.7</td><td>89.3</td><td>82.9</td><td>88.4</td><td>=</td><td>0.858</td><td>79.5</td><td>72.1/70.2</td><td>-</td></tr><tr><td>Word Embedding Average</td><td></td><td>1</td><td>1</td><td>-</td><td>82.2</td><td>1</td><td>-</td><td>0.860</td><td>84.6</td><td>-</td><td>-</td></tr><tr><td>DiscSent +BiGRU</td><td>1</td><td></td><td>88.6</td><td>=</td><td></td><td>81.0</td><td>71.6/-</td><td></td><td>-</td><td>=</td><td>-</td></tr><tr><td>DiscSent +unigram</td><td>- =</td><td>=</td><td>92.7</td><td></td><td>1 =</td><td>87.9</td><td>72.5/-</td><td>1</td><td>1</td><td>=</td><td>-</td></tr><tr><td>DiscSent +embed</td><td></td><td></td><td>93.0</td><td></td><td>-</td><td>87.2</td><td>75.0/-</td><td>1</td><td></td><td>1</td><td>-</td></tr><tr><td>Byte mLSTM</td><td>86.9</td><td>91.4</td><td>94.6</td><td>88.5</td><td>-</td><td>1</td><td>75.0/82.8</td><td>0.792</td><td>-</td><td></td><td>-</td></tr><tr><td>Infersent (SST)</td><td>()</td><td>83.7</td><td>90.2</td><td>89.5</td><td>(*)</td><td>86.0</td><td>72.7/80.9</td><td>0.863</td><td>83.1</td><td>=</td><td>1</td></tr><tr><td>Infersent (SNLI)</td><td>79.9</td><td>84.6</td><td>92.1</td><td>89.8</td><td>83.3</td><td>88.</td><td>75.1/82.3</td><td>0.885</td><td>86.3</td><td></td><td>-</td></tr><tr><td>Infersent (AlINLI)</td><td>81.1</td><td>86.3</td><td>92.4</td><td>90.2</td><td>84.6</td><td>88.2</td><td>76.2/83.1</td><td>0.884</td><td>86.3</td><td>75.8/75.5</td><td>0.0</td></tr><tr><td colspan="10">Our Models</td><td></td></tr><tr><td>+STN</td><td>78.9</td><td>85.8</td><td>93.7</td><td>87.2</td><td>80.4</td><td>84.2</td><td>72.4/81.6</td><td>0.840</td><td>82.1</td><td>72.9/72.4</td><td>-2.56</td></tr><tr><td>+STN +Fr +De</td><td>80.3</td><td>85.1</td><td>93.5</td><td>90.1</td><td>83.3</td><td>92.6</td><td>77.1/83.3</td><td>0.864</td><td>84.8</td><td>77.1/77.1</td><td>0.01</td></tr><tr><td>+STN +Fr +De +NLI</td><td>81.2</td><td>86.4</td><td>93.4</td><td>90.8</td><td>84.0</td><td>93.2</td><td>76.6/82.7</td><td>0.884</td><td>87.0</td><td>79.2/79.1</td><td>0.99</td></tr><tr><td>+STN +Fr +De +NLI +L</td><td>81.7</td><td>87.3</td><td>94.2</td><td>90.8</td><td>84.0</td><td>94.2</td><td>77.1/83.0</td><td>0.887</td><td>87.1</td><td>78.7/78.2</td><td>1.33</td></tr><tr><td>+STN +Fr +De +NLI+L +STP</td><td>82.7</td><td>88.0</td><td>94.1</td><td>91.2</td><td>84.5</td><td>92.4</td><td>77.8/83.9</td><td>0.885</td><td>86.8</td><td>78.7/78.4</td><td>1.44</td></tr><tr><td>+STN +Fr +De +NLI+2L +STP</td><td>82.8</td><td>88.3</td><td>94.0</td><td>91.3</td><td>83.6</td><td>92.6</td><td>77.4/83.3</td><td>0.884</td><td>87.6</td><td>79.2/79.1</td><td>1.47</td></tr><tr><td>+STN +Fr +De +NLI +L +STP +Par</td><td>82.5</td><td>87.7</td><td>94.0</td><td>90.9</td><td>83.2</td><td>93.0</td><td>78.6/84.4</td><td>0.888</td><td>87.8</td><td>78.9/78.6</td><td>1.48</td></tr><tr><td colspan="10">Approaches trained from scratch on these tasks</td><td></td></tr><tr><td>Naive Bayes SVM</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>AdaSent</td><td>79.4</td><td>81.8</td><td>93.2</td><td>86.3</td><td>83.1</td><td>-</td><td></td><td>=</td><td>=</td><td></td><td></td></tr><tr><td>TF-KLD</td><td>83.1</td><td>86.3</td><td>95.5</td><td>93.3</td><td>-</td><td>92.4</td><td></td><td></td><td>=</td><td></td><td></td></tr><tr><td>Illinois LH</td><td></td><td>=</td><td>-</td><td>-</td><td></td><td>-</td><td>80.4/85.9</td><td></td><td>1 84.5</td><td></td><td></td></tr><tr><td>Dependency tree LSTM</td><td></td><td></td><td></td><td></td><td>=</td><td>1</td><td>1</td><td>= 0.868</td><td></td><td></td><td></td></tr><tr><td>Neural Semantic Encoder</td><td></td><td></td><td></td><td></td><td></td><td>=</td><td></td><td></td><td>1</td><td></td><td></td></tr><tr><td>BLSTM-2DCNN</td><td>82.3</td><td></td><td>= 94.0</td><td></td><td>89.7 89.5</td><td>= 96.1</td><td></td><td>- -</td><td>1 -</td><td></td><td></td></tr></table>
137
+
138
+ Table 2: Evaluation of sentence representations on a set of 10 tasks using a linear model trained using each model’s representations. The FastSent and NMT En-Fr models are described in Hill et al. (2016), CNN-LSTM in Gan et al. (2016), Skipthought in Kiros et al. (2015), Word embedding average in Arora et al. (2016), DiscSent from Jernite et al. (2017), Byte mLSTM from Radford et al. (2017), Infersent in Conneau et al. (2017), Neural Semantic Encoder from Munkhdalai & Yu (2017), BLSTM-2DCNN from Zhou et al. (2016). STN, Fr, De, NLI, L, 2L, STP & Par stand for skip-thought next, French translation, German translation, natural language inference, large model, 2-layer large model, skip-thought previous and parsing respectively. $\Delta$ indicates the average improvement over Infersent (AllNLI) across all 10 tasks. For MRPC and STSB we consider only the F1 score and Spearman correlations respectively and we also multiply the SICK-R scores by 100 to have all differences in the same scale. Bold numbers indicate the best performing transfer model on a given task. Underlines are used for each task to indicate both our best performing model as well as the best performing transfer model that isn’t ours.
139
+
140
+ cosine similarities correlates reasonably well with their relatedness on semantic textual similarity benchmarks (Appendix Table 7).
141
+
142
+ We also present qualitative analysis of our learned representations by visualizations using dimensionality reduction techniques (Figure 1) and nearest neighbor exploration (Appendix Table 8). Figure 1 shows t-sne plots of our sentence representations on three different datasets - SUBJ, TREC and DBpedia. DBpedia is a large corpus of sentences from Wikipedia labeled by category and used by Zhang et al. (2015). Sentences appear to cluster reasonably well according to their labels. The clustering also appears better than that demonstrated in Figure 2 of Kiros et al. (2015) on TREC and SUBJ. Appendix Table 8 contains sentences from the BookCorpus and their nearest neighbors. Sentences with some lexical overlap and similar discourse structure appear to be clustered together.
143
+
144
+ Table 3: Evaluation of word embeddings. All results were computed using Faruqui & Dyer (2014) with the exception of the Skipgram, NMT, Charagram and Attract-Repel embeddings. Skipgram and NMT results were obtained from Jastrzebski et al. $( 2 0 1 7 ) ^ { 4 }$ . Charagram and Attract-Repel results were taken from Wieting et al. (2016) and Mrksiˇ c et al. (2017) respectively. We also report QVEC benchmarks (Tsvetkov et al., 2015) ´
145
+
146
+ <table><tr><td>Embedding</td><td>Dim</td><td>V143</td><td>SIMLEX</td><td>WS353</td><td>YP130</td><td>MTurk771</td><td>RG65</td><td>MEN</td><td>QVEC</td></tr><tr><td>SENNA</td><td>50</td><td>0.36</td><td>0.27</td><td>0.49</td><td>0.16</td><td>0.50</td><td>0.50</td><td>0.57</td><td>1</td></tr><tr><td>NMTEn-Fr</td><td>620</td><td>1</td><td>0.46</td><td>0.49</td><td>-</td><td>0.46</td><td>0.59</td><td>0.49</td><td>-</td></tr><tr><td>GloVe6B</td><td>300</td><td>0.31</td><td>0.37</td><td>0.61</td><td>0.56</td><td>0.65</td><td>0.77</td><td>0.74</td><td>0.47</td></tr><tr><td>GloVe840B</td><td>300</td><td>0.34</td><td>0.41</td><td>0.71</td><td>0.57</td><td>0.71</td><td>0.76</td><td>0.80</td><td>1</td></tr><tr><td>Skipgram GoogleNews</td><td>300</td><td>1</td><td>0.44</td><td>0.70</td><td>1</td><td>0.67</td><td>0.76</td><td>0.74</td><td>-</td></tr><tr><td>FastText</td><td>300</td><td>0.40</td><td>0.38</td><td>0.74</td><td>0.53</td><td>0.67</td><td>0.80</td><td>0.76</td><td>0.50</td></tr><tr><td>Multilingual</td><td>512</td><td>0.26</td><td>0.40</td><td>0.68</td><td>0.42</td><td>0.60</td><td>0.65</td><td>0.76</td><td>1</td></tr><tr><td>Charagram</td><td>300</td><td>1</td><td>0.71</td><td>1</td><td>1</td><td>-</td><td>1</td><td>1</td><td>1</td></tr><tr><td>Attract-Repel</td><td>300</td><td>-</td><td>0.75</td><td>1</td><td>1</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>Our Model</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>+STN +Fr +De +NLI +L</td><td>512</td><td>0.56</td><td>0.59</td><td>0.66</td><td>0.62</td><td>0.70</td><td>0.65</td><td>0.67</td><td>0.54</td></tr></table>
147
+
148
+ Table 4: Supervised & low-resource classification accuracies on the Quora duplicate question dataset. Accuracies are reported corresponding to the number of training examples used. The first 6 rows are taken from Wang et al. (2017), the next 4 are from Tomar et al. (2017), the next 5 from Shen et al. (2017) and The last 4 rows are our experiments using Infersent (Conneau et al., 2017) and our models.
149
+
150
+ <table><tr><td rowspan="2">Model</td><td colspan="3">Accuracy 5k</td><td rowspan="2">All (400k)</td></tr><tr><td>1k</td><td>10k</td><td>25k</td></tr><tr><td>Siamese-CNN</td><td>=</td><td></td><td>=</td><td>79.60</td></tr><tr><td>Multi-Perspective-CNN</td><td></td><td></td><td></td><td>81.38</td></tr><tr><td>Siamese-LSTM</td><td></td><td></td><td></td><td>82.58</td></tr><tr><td>Multi-Perspective-LSTM</td><td></td><td></td><td></td><td>83.21</td></tr><tr><td>L.D.C</td><td></td><td></td><td></td><td>85.55</td></tr><tr><td>BiMPM</td><td></td><td></td><td></td><td>88.17</td></tr><tr><td>DecAtt (GloVe)</td><td>=</td><td></td><td>=</td><td>86.52</td></tr><tr><td>DecAtt (Char)</td><td></td><td></td><td></td><td>86.84</td></tr><tr><td>pt-DecAtt (Word)</td><td></td><td></td><td></td><td>87.54</td></tr><tr><td>pt-DecAtt (Char)</td><td>=</td><td></td><td>-</td><td>88.40</td></tr><tr><td>CNN (Random)</td><td>56.3</td><td>59.2 63.8</td><td>68.9</td><td>-</td></tr><tr><td>CNN (GloVe)</td><td>58.5</td><td>62.4 66.1</td><td>70.2</td><td>=</td></tr><tr><td>LSTM-AE</td><td>59.3</td><td>63.8 67.2</td><td>70.9</td><td></td></tr><tr><td>Deconv-AE</td><td>60.2</td><td>65.1 67.7</td><td>71.6</td><td></td></tr><tr><td>Deconv LVM</td><td>62.9</td><td>67.6 69.0</td><td>72.4</td><td>=</td></tr><tr><td>Infersent (LogReg)</td><td>68.8</td><td>73.8</td><td>76.4</td><td>=</td></tr><tr><td>Infersent (MLP)</td><td>71.8</td><td>75.7</td><td>75.7 77.2 78.9</td><td>84.79</td></tr><tr><td colspan="5">OurModels</td></tr><tr><td>+STN +Fr +De +NLI +L +STP (LogReg)</td><td>70.4</td><td>74.8</td><td>75.9</td><td></td><td></td></tr><tr><td>+STN +Fr +De +NLI +L +STP (MLP)</td><td>74.7</td><td>77.7</td><td>78.3</td><td>77.2 81.4</td><td>87.01</td></tr></table>
151
+
152
+ # 6 CONCLUSION & FUTURE WORK
153
+
154
+ We present a multi-task framework for learning general-purpose fixed-length sentence representations. Our primary motivation is to encapsulate the inductive biases of several diverse training signals used to learn sentence representations into a single model. Our multi-task framework includes a combination of sequence-to-sequence tasks such as multi-lingual NMT, constituency parsing and skip-thought vectors as well as a classification task - natural language inference. We demonstrate that the learned representations yield competitive or superior results to previous general-purpose sentence representation methods. We also observe that this approach produces good word embeddings.
155
+
156
+ Table 5: Evaluation of sentence representations by probing for certain sentence characteristics and syntactic properties. Sentence length, word content & word order from Adi et al. (2016) and sentence active/passive, tense and top level syntactic sequence (TSS) from Shi et al. (2016). Numbers reported are the accuracy with which the models were able to predict certain characteristics.
157
+
158
+ <table><tr><td>Model</td><td>Length</td><td>Content</td><td>Order</td><td>Passive</td><td>Tense</td><td>TSS</td></tr><tr><td></td><td colspan="3">Sentence characteristics</td><td colspan="3">Syntatic properties</td></tr><tr><td>Majority Baseline</td><td>22.0</td><td>50.0</td><td>50.0</td><td>81.3</td><td>77.1</td><td>56.0</td></tr><tr><td>Infersent (AlINLI)</td><td>75.8</td><td>75.8</td><td>75.1</td><td>92.1</td><td>93.3</td><td>70.4</td></tr><tr><td>Skipthought</td><td>-</td><td>1</td><td>-</td><td>94.0</td><td>96.5</td><td>74.7</td></tr><tr><td colspan="7">OurModels</td></tr><tr><td>Skipthought +Fr+De</td><td>86.8</td><td>75.7</td><td>81.1</td><td>97.0</td><td>97.0</td><td>77.1</td></tr><tr><td>Skipthought +Fr +De+NLI</td><td>88.1</td><td>75.7</td><td>81.5</td><td>96.7</td><td>96.8</td><td>77.1</td></tr><tr><td>Skipthought +Fr +De +NLI +Par</td><td>93.7</td><td>75.5</td><td>83.1</td><td>98.0</td><td>97.6</td><td>80.7</td></tr></table>
159
+
160
+ In future work, we would like understand and interpret the inductive biases that our model learns and observe how it changes with the addition of different tasks beyond just our simple analysis of sentence characteristics and syntax. Having a rich, continuous sentence representation space could allow the application of state-of-the-art generative models of images such as that of Nguyen et al. (2016) to language. One could also consider controllable text generation by directly manipulating the sentence representations and realizing it by decoding with a conditional language model.
161
+
162
+ # ACKNOWLEDGEMENTS
163
+
164
+ The authors would like to thank Chinnadhurai Sankar, Sebastian Ruder, Eric Yuan, Tong Wang, Alessandro Sordoni, Guillaume Lample and Varsha Embar for useful discussions. We are also grateful to the PyTorch development team (Paszke et al., 2017). We thank NVIDIA for donating a DGX-1 computer used in this work and Fonds de recherche du Quebec - Nature et technologies for ´ funding.
165
+
166
+ # REFERENCES
167
+
168
+ Yossi Adi, Einat Kermany, Yonatan Belinkov, Ofer Lavi, and Yoav Goldberg. Fine-grained analysis of sentence embeddings using auxiliary prediction tasks. arXiv preprint arXiv:1608.04207, 2016.
169
+
170
+ Sanjeev Arora, Yingyu Liang, and Tengyu Ma. A simple but tough-to-beat baseline for sentence embeddings. 2016.
171
+
172
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. arXiv preprint arXiv:1409.0473, 2014.
173
+
174
+ Jonathan Baxter et al. A model of inductive bias learning. J. Artif. Intell. Res.(JAIR), 12(149-198): 3, 2000.
175
+
176
+ Yonatan Belinkov, Nadir Durrani, Fahim Dalvi, Hassan Sajjad, and James Glass. What do neural machine translation models learn about morphology? arXiv preprint arXiv:1704.03471, 2017.
177
+
178
+ Piotr Bojanowski, Edouard Grave, Armand Joulin, and Tomas Mikolov. Enriching word vectors with subword information. arXiv preprint arXiv:1607.04606, 2016.
179
+
180
+ Samuel R Bowman, Gabor Angeli, Christopher Potts, and Christopher D Manning. A large annotated corpus for learning natural language inference. arXiv preprint arXiv:1508.05326, 2015.
181
+
182
+ Samuel R Bowman, Jon Gauthier, Abhinav Rastogi, Raghav Gupta, Christopher D Manning, and Christopher Potts. A fast unified model for parsing and sentence understanding. arXiv preprint arXiv:1603.06021, 2016.
183
+
184
+ Kyunghyun Cho, Bart Van Merrienboer, Caglar Gulcehre, Dzmitry Bahdanau, Fethi Bougares, Hol- ¨ ger Schwenk, and Yoshua Bengio. Learning phrase representations using rnn encoder-decoder for statistical machine translation. arXiv preprint arXiv:1406.1078, 2014.
185
+
186
+ Junyoung Chung, Caglar Gulcehre, KyungHyun Cho, and Yoshua Bengio. Empirical evaluation of gated recurrent neural networks on sequence modeling. arXiv preprint arXiv:1412.3555, 2014.
187
+
188
+ Stephen Clark and Stephen Pulman. Combining symbolic and distributional models of meaning. In Proceedings of the AAAI Spring Symposium on Quantum Interaction Stanford CA 2007, 2007.
189
+
190
+ Alexis Conneau, Douwe Kiela, Holger Schwenk, Loic Barrault, and Antoine Bordes. Supervised learning of universal sentence representations from natural language inference data. arXiv preprint arXiv:1705.02364, 2017.
191
+
192
+ Daxiang Dong, Hua Wu, Wei He, Dianhai Yu, and Haifeng Wang. Multi-task learning for multiple language translation. In ACL (1), pp. 1723–1732, 2015.
193
+
194
+ David Eigen and Rob Fergus. Predicting depth, surface normals and semantic labels with a common multi-scale convolutional architecture. In Proceedings of the IEEE International Conference on Computer Vision, pp. 2650–2658, 2015.
195
+
196
+ Manaal Faruqui and Chris Dyer. Community evaluation and exchange of word vectors at wordvectors. org. 2014.
197
+
198
+ Zhe Gan, Yunchen Pu, Ricardo Henao, Chunyuan Li, Xiaodong He, and Lawrence Carin. Unsupervised learning of sentence representations using convolutional neural networks. arXiv preprint arXiv:1611.07897, 2016.
199
+
200
+ Kazuma Hashimoto, Caiming Xiong, Yoshimasa Tsuruoka, and Richard Socher. A joint many-task model: Growing a neural network for multiple nlp tasks. arXiv preprint arXiv:1611.01587, 2016.
201
+
202
+ Felix Hill, Kyunghyun Cho, and Anna Korhonen. Learning distributed representations of sentences from unlabelled data. arXiv preprint arXiv:1602.03483, 2016.
203
+
204
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997.
205
+
206
+ Stanisław Jastrzebski, Damian Lesniak, and Wojciech Marian Czarnecki. How to evaluate word ´ embeddings? on importance of data efficiency and simple supervised tasks. arXiv preprint arXiv:1702.02170, 2017.
207
+
208
+ Yacine Jernite, Samuel R Bowman, and David Sontag. Discourse-based objectives for fast unsupervised sentence representation learning. arXiv preprint arXiv:1705.00557, 2017.
209
+
210
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
211
+
212
+ Ryan Kiros, Yukun Zhu, Ruslan R Salakhutdinov, Richard Zemel, Raquel Urtasun, Antonio Torralba, and Sanja Fidler. Skip-thought vectors. In Advances in neural information processing systems, pp. 3294–3302, 2015.
213
+
214
+ Iasonas Kokkinos. Ubernet: Training auniversal’convolutional neural network for low-, mid-, and high-level vision using diverse datasets and limited memory. arXiv preprint arXiv:1609.02132, 2016.
215
+
216
+ 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.
217
+
218
+ Guillaume Lample, Miguel Ballesteros, Sandeep Subramanian, Kazuya Kawakami, and Chris Dyer. Neural architectures for named entity recognition. arXiv preprint arXiv:1603.01360, 2016.
219
+
220
+ Minh-Thang Luong, Quoc V Le, Ilya Sutskever, Oriol Vinyals, and Lukasz Kaiser. Multi-task sequence to sequence learning. arXiv preprint arXiv:1511.06114, 2015.
221
+
222
+ Bryan McCann, James Bradbury, Caiming Xiong, and Richard Socher. Learned in translation: Contextualized word vectors. arXiv preprint arXiv:1708.00107, 2017.
223
+
224
+ 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.
225
+
226
+ Jeff Mitchell and Mirella Lapata. Vector-based models of semantic composition. In ACL, pp. 236– 244, 2008.
227
+
228
+ Nikola Mrksiˇ c, Ivan Vuli ´ c, Diarmuid ´ O S ´ eaghdha, Ira Leviant, Roi Reichart, Milica Ga ´ siˇ c, Anna ´ Korhonen, and Steve Young. Semantic specialisation of distributional word vector spaces using monolingual and cross-lingual constraints. arXiv preprint arXiv:1706.00374, 2017.
229
+
230
+ Tsendsuren Munkhdalai and Hong Yu. Neural semantic encoders. In Proceedings of the conference. Association for Computational Linguistics. Meeting, volume 1, pp. 397. NIH Public Access, 2017.
231
+
232
+ 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.
233
+
234
+ Allen Nie, Erin D Bennett, and Noah D Goodman. Dissent: Sentence representation learning from explicit discourse relations. arXiv preprint arXiv:1710.04334, 2017.
235
+
236
+ Matteo Pagliardini, Prakhar Gupta, and Martin Jaggi. Unsupervised learning of sentence embeddings using compositional n-gram features. arXiv preprint arXiv:1703.02507, 2017.
237
+
238
+ Ankur P Parikh, Oscar Tackstr ¨ om, Dipanjan Das, and Jakob Uszkoreit. A decomposable attention ¨ model for natural language inference. arXiv preprint arXiv:1606.01933, 2016.
239
+
240
+ Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan, Edward Yang, Zachary DeVito, Zeming Lin, Alban Desmaison, Luca Antiga, and Adam Lerer. Automatic differentiation in pytorch. 2017.
241
+
242
+ Jeffrey Pennington, Richard Socher, and Christopher D Manning. Glove: Global vectors for word representation. In EMNLP, volume 14, pp. 1532–1543, 2014.
243
+
244
+ Alec Radford, Rafal Jozefowicz, and Ilya Sutskever. Learning to generate reviews and discovering sentiment. arXiv preprint arXiv:1704.01444, 2017.
245
+
246
+ Dinghan Shen, Yizhe Zhang, Ricardo Henao, Qinliang Su, and Lawrence Carin. Deconvolutional latent-variable model for text sequence matching. arXiv preprint arXiv:1709.07109, 2017.
247
+
248
+ Xing Shi, Inkit Padhi, and Kevin Knight. Does string-based neural mt learn source syntax? In EMNLP, pp. 1526–1534, 2016.
249
+
250
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
251
+
252
+ Nitish Srivastava, Geoffrey E Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. Journal of machine learning research, 15(1):1929–1958, 2014.
253
+
254
+ Ilya Sutskever, Oriol Vinyals, and Quoc V Le. Sequence to sequence learning with neural networks. In Advances in neural information processing systems, pp. 3104–3112, 2014.
255
+
256
+ Shuai Tang, Hailin Jin, Chen Fang, Zhaowen Wang, and Virginia R de Sa. Rethinking skip-thought: A neighborhood based approach. arXiv preprint arXiv:1706.03146, 2017.
257
+
258
+ Gaurav Singh Tomar, Thyago Duque, Oscar Tackstr ¨ om, Jakob Uszkoreit, and Dipanjan Das. Neural ¨ paraphrase identification of questions with noisy pretraining. arXiv preprint arXiv:1704.04565, 2017.
259
+
260
+ Yulia Tsvetkov, Manaal Faruqui, Wang Ling, Guillaume Lample, and Chris Dyer. Evaluation of word vector representations by subspace alignment. 2015.
261
+
262
+ Oriol Vinyals, Łukasz Kaiser, Terry Koo, Slav Petrov, Ilya Sutskever, and Geoffrey Hinton. Grammar as a foreign language. In Advances in Neural Information Processing Systems, pp. 2773– 2781, 2015.
263
+
264
+ Zhiguo Wang, Wael Hamza, and Radu Florian. Bilateral multi-perspective matching for natural language sentences. arXiv preprint arXiv:1702.03814, 2017.
265
+
266
+ John Wieting, Mohit Bansal, Kevin Gimpel, and Karen Livescu. Towards universal paraphrastic sentence embeddings. arXiv preprint arXiv:1511.08198, 2015.
267
+
268
+ John Wieting, Mohit Bansal, Kevin Gimpel, and Karen Livescu. Charagram: Embedding words and sentences via character n-grams. arXiv preprint arXiv:1607.02789, 2016.
269
+
270
+ Adina Williams, Nikita Nangia, and Samuel R Bowman. A broad-coverage challenge corpus for sentence understanding through inference. arXiv preprint arXiv:1704.05426, 2017.
271
+
272
+ Kelvin Xu, Jimmy Ba, Ryan Kiros, Kyunghyun Cho, Aaron Courville, Ruslan Salakhudinov, Rich Zemel, and Yoshua Bengio. Show, attend and tell: Neural image caption generation with visual attention. In International Conference on Machine Learning, pp. 2048–2057, 2015.
273
+
274
+ 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.
275
+
276
+ Peng Zhou, Zhenyu Qi, Suncong Zheng, Jiaming Xu, Hongyun Bao, and Bo Xu. Text classification improved by integrating bidirectional lstm with two-dimensional max pooling. arXiv preprint arXiv:1611.06639, 2016.
277
+
278
+ Yukun Zhu, Ryan Kiros, Rich Zemel, Ruslan Salakhutdinov, Raquel Urtasun, Antonio Torralba, and Sanja Fidler. Aligning books and movies: Towards story-like visual explanations by watching movies and reading books. In Proceedings of the IEEE international conference on computer vision, pp. 19–27, 2015.
279
+
280
+ # APPENDIX
281
+
282
+ # 7 MODEL TRAINING
283
+
284
+ We present some architectural specifics and training details of our multi-task framework. Our shared encoder uses a common word embedding lookup table and GRU. We experiment with unidirectional, bidirectional and 2 layer bidirectional GRUs (details in Appendix section 9). For each task, every decoder has its separate word embedding lookups, conditional GRUs and fully connected layers that project the GRU hidden states to the target vocabularies. The last hidden state of the encoder is used as the initial hidden state of the decoder and is also presented as input to all the gates of the GRU at every time step. For natural language inference, the same encoder is used to encode both the premise and hypothesis and a concatenation of their representations along with the absolute difference and hadamard product (as described in Conneau et al. (2017)) are given to a single layer MLP with a dropout (Srivastava et al., 2014) rate of 0.3. All models use word embeddings of 512 dimensions and GRUs with either 1500 or 2048 hidden units. We used minibatches of 48 examples and the Adam Kingma & Ba (2014) optimizer with a learning rate of 0.002. Models were trained for 7 days on an Nvidia Tesla P100-SXM2-16GB GPU. While Kiros et al. (2015) report close to a month of training, we only train for 7 days, made possible by advancements in GPU hardware and software (cuDNN RNNs).
285
+
286
+ We did not tune any of the architectural details and hyperparameters owing to the fact that we were unable to identify any clear criterion on which to tune them. Gains in performance on a specific task do not often translate to better transfer performance.
287
+
288
+ # 8 VOCABULARY EXPANSION & REPRESENTATION POOLING
289
+
290
+ In addition to performing 10-fold cross-validation to determine the L2 regularization penalty on the logistic regression models, we also tune the way in which our sentence representations are generated from the hidden states corresponding to words in a sentence. For example, Kiros et al. (2015) use the last hidden state while Conneau et al. (2017) perform max-pooling across all of the hidden states. We consider both of these approaches and pick the one with better performance on the validation set. We note that max-pooling works best on sentiment tasks such as MR, CR, SUBJ and MPQA, while the last hidden state works better on all other tasks.
291
+
292
+ We also employ vocabulary expansion on all tasks as in Kiros et al. (2015) by training a linear regression to map from the space of pre-trained word embeddings (GloVe) to our model’s word embeddings.
293
+
294
+ # 9 MULTI-TASK MODEL DETAILS
295
+
296
+ This section describes the specifics our multi-task ablations in the experiments section. These definitions hold for all tables except for 3 and 5. We refer to skip-thought next as STN, French and German NMT as Fr and De, natural language inference as NLI, skip-thought previous as STP and parsing as Par.
297
+
298
+ $+ \mathbf { S } \mathbf { T } \mathbf { N } + \mathbf { F } \mathbf { r } + \mathbf { D } \mathbf { e } { \mathrm { : } }$ The sentence representation $h _ { x }$ is the concatenation of the final hidden vectors from a forward GRU with 1500-dimensional hidden vectors and a bidirectional GRU, also with 1500-dimensional hidden vectors.
299
+
300
+ $\mathbf { + S T N + F r + D e + N L I : }$ The sentence representation $h _ { x }$ is the concatenation of the final hidden vectors from a bidirectional GRU with 1500-dimensional hidden vectors and another bidirectional GRU with 1500-dimensional hidden vectors trained without NLI.
301
+
302
+ $\mathbf { + S T N + F r + D e + N L I + L }$ : The sentence representation $h _ { x }$ is the concatenation of the final hidden vectors from a bidirectional GRU with 2048-dimensional hidden vectors and another bidirectional GRU with 2048-dimensional hidden vectors trained without NLI.
303
+
304
+ $\mathbf { + S T N + F r + D e + N L I + L _ { \tau } + S T P } :$ The sentence representation $h _ { x }$ is the concatenation of the final hidden vectors from a bidirectional GRU with 2048-dimensional hidden vectors and another bidirectional GRU with 2048-dimensional hidden vectors trained without STP.
305
+
306
+ $\mathbf { \Gamma } + \mathbf { S } \mathbf { T } \mathbf { N }$ $+ \mathbf { F r }$ +De ${ \bf + N L I }$ $\mathbf { + 2 L }$ $\mathbf { + S T P }$ : The sentence representation $h _ { x }$ is the concatenation of the final hidden vectors from a 2-layer bidirectional GRU with 2048-dimensional hidden vectors and a 1-layer bidirectional GRU with 2048-dimensional hidden vectors trained without STP.
307
+
308
+ $\mathbf { + S T N + F r + D e + N L I + L + S T P + P a r : }$ The sentence representation $h _ { x }$ is the concatenation of the final hidden vectors from a bidirectional GRU with 2048-dimensional hidden vectors and another bidirectional GRU with 2048-dimensional hidden vectors trained without Par.
309
+
310
+ In tables 3 and 5 we do not concatenate the representations of multiple models.
311
+
312
+ # 10 DESCRIPTION OF EVALUATION TASKS
313
+
314
+ Kiros et al. (2015) and Conneau et al. (2017) provide a detailed description of tasks that are typically used to evaluate sentence representations. We provide a condensed summary and refer readers to their work for a more thorough description.
315
+
316
+ # 10.1 TEXT CLASSIFICATION
317
+
318
+ We evaluate on text classification benchmarks - sentiment classification on movie reviews (MR), product reviews (CR) and Stanford sentiment (SST), question type classification (TREC), subjectivity/objectivity classification (SUBJ) and opinion polarity (MPQA). Representations are used to train a logistic regression classifier with 10-fold cross validation to tune the L2 weight penalty. The evaluation metric for all these tasks is classification accuracy.
319
+
320
+ # 10.2 PARAPHRASE IDENTIFICATION
321
+
322
+ We also evaluate on pairwise text classification tasks such as paraphrase identification on the Microsoft Research Paraphrase Corpus (MRPC) corpus. This is a binary classification problem to
323
+
324
+ identify if two sentences are paraphrases of each other. The evaluation metric is classification accuracy and F1.
325
+
326
+ # 10.3 ENTAILMENT AND SEMANTIC RELATEDNESS
327
+
328
+ To test if similar sentences share similar representations, we evaluate on the SICK relatedness (SICK-R) task where a linear model is trained to output a score from 1 to 5 indicating the relatedness of two sentences. We also evaluate using the entailment labels in the same dataset (SICK-E) which is a binary classification problem. The evaluation metric for SICK-R is Pearson correlation and classification accuracy for SICK-E.
329
+
330
+ # 10.4 SEMANTIC TEXTUAL SIMILARITY
331
+
332
+ In this evaluation, we measure the relatedness of two sentences using only the cosine similarity between their representations. We use the similarity textual similarity (STS) benchmark tasks from 2012-2016 (STS12, STS13, STS14, STS15, STS16, STSB). The STS dataset contains sentences from a diverse set of data sources. The evaluation criteria is Pearson correlation.
333
+
334
+ # 10.5 IMAGE-CAPTION RETRIEVAL
335
+
336
+ Image-caption retrieval is typically formulated as a ranking task wherein images are retrieved and ranked based on a textual description and vice-versa. We use $1 1 3 \mathrm { k }$ training images from MSCOCO with 5k images for validation and 5k for testing. Image features are extracted using a pre-trained 110 layer ResNet. The evaluation criterion is Recall $@ \mathrm { K }$ and the median K across 5 different splits of the data.
337
+
338
+ # 10.6 QUORA DUPLICATE QUESTION CLASSIFICATION
339
+
340
+ In addition to the above tasks which were considered by Conneau et al. (2017), we also evaluate on the recently published Quora duplicate question dataset5 since it is an order of magnitude larger than the others (approximately 400,000 question pairs). The task is to correctly identify question pairs that are duplicates of one another, which we formulate as a binary classification problem. We use the same data splits as in Wang et al. (2017). Given the size of this data, we consider a more expressive classifier on top of the representations of both questions. Specifically, we train a 4 layer MLP with 1024 hidden units, with a dropout rate of 0.5 after every hidden layer. The evaluation criterion is classification accuracy. We also artificially create a low-resource setting by reducing the number of training examples between 1,000 and 25,000 using the same splits as Shen et al. (2017).
341
+
342
+ # 10.7 SENTENCE CHARACTERISTICS & SYNTAX
343
+
344
+ In an attempt to understand what information is encoded in by sentence representations, we consider six different classification tasks where the objective is to predict sentence characteristics such as length, word content and word order (Adi et al., 2016) or syntactic properties such as active/passive, tense and the top syntactic sequence (TSS) from the parse tree of a sentence (Shi et al., 2016).
345
+
346
+ The sentence characteristic tasks are setup in the same way as described in Adi et al. (2016). The length task is an 8-way classification problem where sentence lengths are binned into 8 ranges. The content task is formulated as a binary classification problem that takes a concatenation of a sentence representation $u \in \mathbb { R } ^ { k }$ and a word representation $w \in \mathbb { R } ^ { d }$ to determine if the word is contained in the sentence. The order task is an extension of the content task where a concatenation of the sentence representation and word representations of two words in sentence is used to determine if the first word occurs before or after the second. We use a random subset of the 1-billion-word dataset for these experiments that were not used to train our multi-task representations.
347
+
348
+ The syntactic properties tasks are setup in the same way as described in Shi et al. (2016).The passive and tense tasks are characterized as binary classification problems given a sentence’s representation. The former’s objective is to determine if a sentence is written in active/passive voice while the latter’s objective is to determine if the sentence is in the past tense or not. The top syntactic sequence
349
+
350
+ (TSS) is a 20-way classification problem with 19 most frequent top syntactic sequences and 1 miscellaneous class. We use the same dataset as the authors but different training, validation and test splits.
351
+ Table 6: COCO Retrieval with ResNet-101 features
352
+
353
+ <table><tr><td></td><td colspan="4">Caption Retrieval</td><td colspan="4">Image Retrieval</td></tr><tr><td>Model</td><td>R@1</td><td>R@5</td><td>R@10</td><td>Med r</td><td>R@1</td><td>R@5</td><td>R@10</td><td>Med r</td></tr><tr><td colspan="9">Sentence Representations trained from scratch</td></tr><tr><td>m-CNN</td><td>38.3</td><td>-</td><td>81.0</td><td>2</td><td>27.4</td><td></td><td>79.5</td><td>3</td></tr><tr><td>m-CNN Ensemble</td><td>42.8</td><td></td><td>84.1</td><td>2</td><td>32.6</td><td></td><td>82.8</td><td>3</td></tr><tr><td>Oreder-embeddings</td><td>46.7</td><td>1</td><td>88.9</td><td>2</td><td>37.9</td><td>=</td><td>85.9</td><td>2</td></tr><tr><td colspan="9">Transfer learning approaches</td></tr><tr><td>Skipthought</td><td>37.9</td><td>72.2</td><td>84.3</td><td>2</td><td>30.6</td><td>66.2</td><td>81.0</td><td>3</td></tr><tr><td>Infersent (SNLI)</td><td>42.4</td><td>76.1</td><td>87.0</td><td>2</td><td>33.2</td><td>69.7</td><td>83.6</td><td>3</td></tr><tr><td>Infersent (AlINLI)</td><td>42.6</td><td>75.3</td><td>87.3</td><td>2</td><td>33.9</td><td>69.7</td><td>83.8</td><td>3</td></tr><tr><td>+STN +Fr +De+NLI +L +STP</td><td>43.0</td><td>76.0</td><td>87.0</td><td>2</td><td>33.8</td><td>70.1</td><td>83.6</td><td>2.8</td></tr></table>
354
+
355
+ Table 7: Evaluation of sentence representations on the semantic textual similarity benchmarks. Numbers reported are Pearson Correlations $\mathbf { x } 1 0 0$ . Skipthought, GloVe average, GloVe TF-IDF, GloVe $^ +$ WR (U) and all supervised numbers were taken from Arora et al. (2016) and Wieting et al. (2015) and Charagram-phrase numbers were taken from Wieting et al. (2016). Other numbers were obtained from the evaluation suite provided by Conneau et al. (2017)
356
+
357
+ <table><tr><td>Model</td><td>STS12</td><td>STS13</td><td>STS14</td><td>STS15</td><td>STS16</td></tr><tr><td colspan="6">Unsupervised/Transfer Approaches</td></tr><tr><td>Skipthought+LN</td><td>30.8</td><td>24.8</td><td>31.4</td><td>31.0</td><td></td></tr><tr><td>GloVe average GloVe TF-IDF</td><td>52.5 58.7</td><td>42.3 52.1</td><td>54.2 63.8</td><td>52.7 60.6</td><td>- -</td></tr><tr><td>GloVe + WR (U) Charagram-phrase</td><td>56.2</td><td>56.6</td><td>68.5</td><td>71.1</td><td>-</td></tr><tr><td>Infersent</td><td>66.1 59.2</td><td>57.2 58.9</td><td>74.7 69.6</td><td>76.1</td><td>1 71.4</td></tr><tr><td>+STN +Fr+De+NLI+L +STP</td><td>60.6</td><td>54.7</td><td>65.8</td><td>71.3 74.2</td><td>66.4</td></tr><tr><td colspan="6">Supervised Approaches</td></tr><tr><td>LSTM w/o output gates</td><td>51.0</td><td>45.2</td><td>59.8</td><td>63.9</td><td></td></tr><tr><td>PP-Proj</td><td>60.0</td><td>56.8</td><td>71.3</td><td>74.8</td><td>1</td></tr></table>
358
+
359
+ Table 8: A query sentence and its nearest neighbors sorted by decreasing cosine similarity using our model. Sentences and nearest neighbors were chosen from a random subset of 500,000 sentences from the BookCorpus
360
+
361
+ <table><tr><td rowspan=1 colspan=1>Query and nearest sentence</td></tr><tr><td rowspan=1 colspan=1> i... i want .. ” she could n&#x27;t finish the sentence and she did n&#x27;t have to .</td></tr><tr><td rowspan=1 colspan=1>i... ” she had no idea what she had intended to say .and ... ” she could n&#x27;t finish. i... ” he winced as if he could n&#x27;t bear whatever flashed through his mind . you were going to sleep with her just to .. ” i could n&#x27;t even finish my sentence .</td></tr><tr><td rowspan=1 colspan=1>tyler was kind enough to wait two weeks before talking about their relationship again .</td></tr><tr><td rowspan=1 colspan=1>he &#x27;d been more than honest in setting forth his feelings about their relationship . she did n&#x27;t wait for him to ask what she was talking about .damn, just thinking about it made him want to talk to her again .i did n&#x27;t wait for my bestie to try and talk me out of it .</td></tr><tr><td rowspan=1 colspan=1>“ you can, my lady .”</td></tr><tr><td rowspan=1 colspan=1>“ of course , my lady .”“ what can ido for you,my lady ? ”“ watch yourself , my lady .”“ where to , my lady ?”</td></tr><tr><td rowspan=1 colspan=1> they &#x27;d kept silent about it ,a terrifying secret between them that was n’t going away .</td></tr><tr><td rowspan=1 colspan=1>he &#x27;d known they had secrets between them , things they were n&#x27;t ready to share . she &#x27;d kept his secret ,even from her two closest confidantes .he &#x27;d made her a promise and he was n&#x27;t about to break it . she &#x27;d brushed them off as shock-induced ramblings , but now riley was n&#x27;t so sure .</td></tr><tr><td rowspan=1 colspan=1>“ you deserve good things ,” marshal said , but he was still wearing that damn pitying smile .</td></tr><tr><td rowspan=1 colspan=1>“i &#x27;m really happy to see you ,ladybug ,” he said softly ,the smile never leaving his eyes .“ you&#x27;re a bad liar,”he said ,still smiling .“ it &#x27;s okay,”i said, but he shook his head and sighed .“ i&#x27;ll answer that,” he said,his eyes still lit with humor .</td></tr><tr><td rowspan=1 colspan=1>belatedly i turned to look up at max and exclaimed ,“ hey !”</td></tr><tr><td rowspan=1 colspan=1> i started,hollering at his retreating form ,“ thank you !”he slowly turned and looked at me as he barely said ,“ fine .” my head came up and i asked ,“ sorry ? ” i shook my head and mouthed,“ ica n&#x27;t believe you !”</td></tr><tr><td rowspan=1 colspan=1>“ can you make a- ” marty , raegan &#x27;s regular , began .</td></tr><tr><td rowspan=1 colspan=1>“ it &#x27;s not really a- ”ibegan , but lesley interrupted me .“ can i set you up with someone-”“ no,” he barked .“ i&#x27;ll raise it,”schuld said .“ you ’re a mensch ,” he said.</td></tr></table>
md/train/B1Gi6LeRZ/B1Gi6LeRZ.md ADDED
@@ -0,0 +1,247 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LEARNING FROM BETWEEN-CLASS EXAMPLES FOR DEEP SOUND RECOGNITION
2
+
3
+ Yuji Tokozume1, Yoshitaka Ushiku1, Tatsuya Harada1,2 1The University of Tokyo, 2RIKEN {tokozume,ushiku,harada}@mi.t.u-tokyo.ac.jp
4
+
5
+ # ABSTRACT
6
+
7
+ Deep learning methods have achieved high performance in sound recognition tasks. Deciding how to feed the training data is important for further performance improvement. We propose a novel learning method for deep sound recognition: Between-Class learning (BC learning). Our strategy is to learn a discriminative feature space by recognizing the between-class sounds as between-class sounds. We generate between-class sounds by mixing two sounds belonging to different classes with a random ratio. We then input the mixed sound to the model and train the model to output the mixing ratio. The advantages of BC learning are not limited only to the increase in variation of the training data; BC learning leads to an enlargement of Fisher’s criterion in the feature space and a regularization of the positional relationship among the feature distributions of the classes. The experimental results show that BC learning improves the performance on various sound recognition networks, datasets, and data augmentation schemes, in which BC learning proves to be always beneficial. Furthermore, we construct a new deep sound recognition network (EnvNet-v2) and train it with BC learning. As a result, we achieved a performance surpasses the human level1.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Sound recognition has been conventionally conducted by applying classifiers such as SVM to local features such as MFCC or log-mel features (Logan et al., 2000; Vacher et al., 2007; Łopatka et al., 2010). Convolutional neural networks (CNNs) (LeCun et al., 1998), which have achieved success in image recognition tasks (Krizhevsky et al., 2012; Simonyan & Zisserman, 2015; He et al., 2016), have recently proven to be effective in tasks related to series data, such as speech recognition (Abdel-Hamid et al., 2014; Sainath et al., 2015a;b) and natural language processing (Kim, 2014; Zhang et al., 2015). Some researchers applied CNNs to sound recognition tasks and achieved high performance (Aytar et al., 2016; Dai et al., 2017; Tokozume & Harada, 2017).
12
+
13
+ The amount and quality of training data and how to feed it are important for machine learning, particularly for deep learning. Various approaches have been proposed to improve the sound recognition performance. The first approach is to efficiently use limited training data with data augmentation. Researchers proposed increasing the training data variation by altering the shape or property of sounds or adding a background noise (Tokozume & Harada, 2017; Salamon & Bello, 2017). Researchers also proposed using additional training data created by mixing multiple training examples (Parascandolo et al., 2016; Takahashi et al., 2016). The second approach is to use external data or knowledge. Aytar et al. (2016) proposed learning rich sound representations using a large amount of unlabeled video datasets and pre-trained image recognition networks. The sound dataset expansion was also conducted (Salamon et al., 2014; Piczak, 2015b; Gemmeke et al., 2017).
14
+
15
+ In this paper, as a novel third approach we propose a learning method for deep sound recognition: Between-Class learning (BC learning). Our strategy is to learn a discriminative feature space by recognizing the between-class sounds as between-class sounds. We generate between-class sounds by mixing two sounds belonging to different classes with a random ratio. We then input the mixed sound to the model and train the network to output the mixing ratio. Our method focuses on the characteristic of the sound, from which we can generate a new sound simply by adding the waveform data of two sounds. The advantages of BC learning are not limited only to the increase in variation of the training data; BC learning leads to an enlargement of Fisher’s criterion (Fisher, 1936) (i.e., the ratio of the between-class distance to the within-class variance) in the feature space, and a regularization of the positional relationship among the feature distributions of the classes.
16
+
17
+ The experimental results show that BC learning improves the performance on various sound recognition networks, datasets, and data augmentation schemes, in which BC learning proves to be always beneficial. Furthermore, we constructed a new deep sound recognition network (EnvNet- $\nu 2$ ) and trained it with BC learning. As a result, we achieved a $1 5 . 1 \%$ error rate on a benchmark dataset ESC-50 (Piczak, 2015b), which surpasses the human level.
18
+
19
+ We argue that our BC learning is different from the so-called data augmentation methods we introduced above. Although BC learning can be regarded as a data augmentation method from the viewpoint of using augmented data, the novelty or key point of our method is not mixing multiple sounds, but rather learning method of training the model to output the mixing ratio. This is a fundamentally different idea from previous data augmentation methods. In general, data augmentation methods aim to improve the generalization ability by generating additional training data which is likely to appear in testing phase. Thus, the problem to be solved is the same in both training and testing phase. On the other hand, BC learning uses only mixed data and labels for training, while mixed data does not appear in testing phase. BC learning is a method to improve the classification performance by solving a problem of predicting the mixing ratio between two different classes. To the best of our knowledge, this is the first time a learning method that employs a mixing ratio between different classes has been proposed. We intuitively describe why such a learning method is effective and demonstrate the effectiveness of BC learning through wide-ranging experiments.
20
+
21
+ # 2 RELATED WORK
22
+
23
+ # 2.1 SOUND RECOGNITION NETWORKS
24
+
25
+ We introduce recent deep learning methods for sound recognition. Piczak (2015a) proposed to apply CNNs to the log-mel features extracted from raw waveforms. The log-mel feature is calculated for each frame of sound and represents the magnitude of each frequency area, considering human auditory perception (Davis & Mermelstein, 1980). Piczak created a 2-D feature-map by arranging the log-mel features of each frame along the time axis and calculated the delta log-mel feature, which was the first temporal derivative of the static log-mel feature. Piczak then classified these static and delta feature-maps with 2-D CNN, treating them as a two-channel input in a manner quite similar to the RGB inputs of the image. The log-mel feature-map exhibits locality in both time and frequency domains (Abdel-Hamid et al., 2014). Therefore, we can accurately classify this feature-map with CNN. We refer to this method as Logmel-CNN.
26
+
27
+ Some researchers also proposed methods to learn the sounds directly from 1-D raw waveforms, including feature extraction. Aytar et al. (2016) proposed a sound recognition network using 1- D convolutional and pooling layers named SoundNet and learned the sound feature using a large amount of unlabeled videos (we describe the details of it in the next section). Dai et al. (2017) also proposed a network using 1-D convolutional and pooling layers, but they stacked more layers. They reported that the network with 18 layers performed the best. Tokozume & Harada (2017) proposed a network using both 1-D and 2-D convolutional and pooling layers named EnvNet. First, EnvNet extracts a frequency feature of each short duration of section with 1-D convolutional and pooling layers and obtain a 2-D feature-map. Next, it classifies this feature-map with 2-D convolutional and pooling layers in a similar manner to Logmel-CNN. Learning from the raw waveform is still a challenging problem because it is difficult to learn raw waveform features from limited training data. However, the performance of these systems is close to that of Logmel-CNN.
28
+
29
+ # 2.2 APPROACHES TO ACHIEVE HIGH PERFORMANCE
30
+
31
+ We describe the approaches to achieve high sound recognition performance from two views: approaches involving efficient use of limited training data and those involving external data/knowledge. First, we describe data augmentation as an approach of efficiently using limited training data. One of the most standard and important data augmentation methods is cropping (Piczak, 2015a; Aytar et al., 2016; Tokozume & Harada, 2017). The training data variation increases, and we are able to more efficiently train the network when the short section (approximately 1–2 s) of the training sound cropped from the original data, and not the whole section, is input to the network. A similar method is generally used in the test phase. Multiple sections of test data are input with a stride, and the average of the output predictions is used to classify the test sound. Salamon & Bello (2017) proposed the usage of additional training data created by time stretching, pitch shifting, dynamic range compression, and adding background noise chosen from an external dataset. Researchers also proposed using additional training data created by mixing multiple training examples. Parascandolo et al. (2016) applied this method to polyphonic sound event detection. Takahashi et al. (2016) applied this method to single-label sound event classification, but only the sounds belonging to the same class were mixed. Our method is different from both of them in that we employ a mixing ratio between different classes for training.
32
+
33
+ ![](images/aa35ee94c13656f5de4997ad50607826c43538e9c0cc5b68ad9ab419bbaf960a.jpg)
34
+ Figure 1: Pipeline of BC learning. We create each training example by mixing two sounds belonging to different classes with a random ratio. We input the mixed sound to the model and train the model to output the mixing ratio using the KL loss.
35
+
36
+ Next, we describe the approaches of utilizing external data/knowledge. Aytar et al. (2016) proposed to learn rich sound representations using pairs of image and sound included in a large amount of unlabeled video dataset. They transferred the knowledge of pre-trained large-scale image recognition networks into sound recognition network by minimizing the KL-divergence between the output predictions of the image recognition networks and that of the sound network. They used the output of the hidden layer of the sound recognition network as the feature when applying to the target sound classification problem. They then classified it with linear SVM. They could train a deep sound recognition network (SoundNet8) and achieve a $7 4 . 2 \%$ accuracy on a benchmark dataset, ESC-50 (Piczak, 2015b), with this method.
37
+
38
+ # 3 BETWEEN-CLASS LEARNING FOR SOUND RECOGNITION
39
+
40
+ # 3.1 OVERVIEW
41
+
42
+ In this section, we propose a novel learning method for deep sound recognition BC learning. Fig. 1 shows the pipeline of BC learning. In standard learning, we select a single training example from the dataset and input it to the model. We then train the model to output 0 or 1. By contrast, in BC learning, we select two training examples from different classes and mix these two examples using a random ratio. We then input the mixed data to the model and train the model to output the mixing ratio. BC learning uses only mixed data and labels, and thus never uses pure data and labels for training. Note that we do not mix any examples in testing phase. First, we provide the details of BC learning in Section 3.2. We mainly explain the method of mixing two sounds, which should be carefully designed to achieve a good performance. Then, in Section 3.3, we explain why BC learning leads to a discriminative feature space.
43
+
44
+ # 3.2 METHOD DETAILS
45
+
46
+ # 3.2.1 MIXING METHOD
47
+
48
+ BC learning optimizes a model using mini-batch stochastic gradient descent the same way the standard learning does. Each data and label of a mini-batch is generated by mixing two training examples belonging to different classes. Here, we describe how to mix two training examples.
49
+
50
+ Let $\mathbf { x } _ { 1 }$ and $\mathbf { x } _ { 2 }$ be two sounds belonging to different classes randomly selected from the training dataset, and $\mathbf { t } _ { 1 }$ and $\mathbf { t } _ { 2 }$ be their one-hot labels. Note that $\mathbf { x } _ { 1 }$ and $\mathbf { x } _ { 2 }$ may have already been preprocessed or applied data augmentation, and they have the same length as that of the input of the network. We generate a random ratio $r$ from $\textstyle { \dot { U } } ( 0 , \ 1 )$ , and mix two sets of data and labels with this ratio. We mix two labels simply by $r \mathbf { t } _ { 1 } + ( 1 - r ) \mathbf { t } _ { 2 }$ , because we aim to train the model to output the mixing ratio. We then explain how to mix $\mathbf { x } _ { 1 }$ and $\mathbf { x } _ { 2 }$ . The simplest method is $r { \bf x } _ { 1 } + \left( 1 - r \right) { \bf x } _ { 2 }$ . However, the following mixing formula is slightly better, considering that sound energy is proportional to the square of the amplitude:
51
+
52
+ $$
53
+ m i x _ { r } ( { \bf x } _ { 1 } , { \bf x } _ { 2 } ) = \frac { r { \bf x } _ { 1 } + ( 1 - r ) { \bf x } _ { 2 } } { \sqrt { r ^ { 2 } + ( 1 - r ) ^ { 2 } } } .
54
+ $$
55
+
56
+ However, auditory perception of a sound mixed with Eqn. (1) would not be $\mathbf { x } _ { 1 } : \mathbf { x } _ { 2 } = r : ( 1 - r )$ if the difference of the sound pressure level of $\mathbf { x } _ { 1 }$ and $\mathbf { x } _ { 2 }$ is large. For example, if the amplitude of $\mathbf { x } _ { 1 }$ is 10 times as large as that of $\mathbf { x } _ { 2 }$ and we mix them with $0 . 2 : 0 . 8$ , the sound of $\mathbf { x } _ { 1 }$ would still be dominant in the mixed sound. In this case, training the model with a label of $\lbrace 0 . 2 , 0 . 8 \rbrace$ is inappropriate. We then consider using a new coefficient $p ( r , G _ { 1 } , G _ { 2 } )$ instead of $r$ , and mix two sounds by p√x1 + (1 − p) x2 , where $G _ { 1 }$ and $G _ { 2 }$ is the sound pressure level of $\mathbf { x } _ { 1 }$ and $\mathbf { x } _ { 2 }$ [dB], respectively. We define $p$ so that the auditory perception of the mixed sound becomes $r : ( 1 - r )$ . We hypothesize that the ratio of auditory perception for the network is the same as that of amplitude because the main component functions of CNNs, such as conv/fc, relu, max pooling, and average pooling, satisfy homogeneity (i.e., $f ( \alpha \mathbf { x } ) \ : = \ : \alpha f ( \mathbf { x } ) )$ if we ignore the bias. We then set up an equation about the ratio of amplitude $p \cdot 1 0 ^ { \frac { G _ { 1 } } { 2 0 } } : ( 1 - p ) \cdot 1 0 ^ { \frac { G _ { 2 } } { 2 0 } } = r : ( 1 - r )$ using unit conversion from decibels to amplitudes and solve it for $p$ . Finally, we obtain the proposed mixing method:
57
+
58
+ $$
59
+ m i x _ { r } ( { \bf x } _ { 1 } , { \bf x } _ { 2 } ) = \frac { p { \bf x } _ { 1 } + \left( 1 - p \right) { \bf x } _ { 2 } } { \sqrt { p ^ { 2 } + \left( 1 - p \right) ^ { 2 } } } \mathrm { \quad \ w h e r e \ } p = \frac { 1 } { 1 + 1 0 ^ { \frac { G _ { 1 } - G _ { 2 } } { 2 0 } } \cdot \frac { 1 - r } { r } } .
60
+ $$
61
+
62
+ We show this mixing method performs better than Eqn. (1) in the experiments.
63
+
64
+ We calculate the sound pressure level $G _ { 1 }$ and $G _ { 2 }$ using A-weighting, considering that human auditory perception is not sensitive to low and high frequency areas. We can also use simpler sound pressure metrics such as root mean square (RMS) energy instead of an A-weighting sound pressure level. However, the performance worsens, as we show in the experiments. We create short windows $( \sim 0 . 1$ s) on the sound and calculate a time series of A-weighted sound pressure levels $\{ g _ { 1 } , g _ { 2 } , . . . , g _ { t } \}$ . Then, we define $G$ as the maximum of those time series ( $G = m a x \{ g _ { 1 } , g _ { 2 } , . . . , g _ { t } \}$ ).
65
+
66
+ # 3.2.2 OPTIMIZATION
67
+
68
+ We define the $f$ and $\theta$ as the model function and the model parameters, respectively. We input the generated mini-batch data $\{ \mathbf { x } ^ { ( i ) } \} _ { i = 1 } ^ { n }$ to the model and obtain the output $\{ f _ { \theta } ( \mathbf { x } ^ { ( i ) } ) \} _ { i = 1 } ^ { n }$ . We expect that our mini-batch ratio labels $\{ \mathbf { t } ^ { ( i ) } \} _ { i = 1 } ^ { n }$ represent the expected class probability distribution. Therefore, we use the KL-divergence between the labels and the model outputs as the loss function, instead of the usual cross-entropy loss. We optimize KL-divergence with back-propagation and stochastic gradient descent because it is differentiable:
69
+
70
+ $$
71
+ \begin{array} { c } { \displaystyle { L = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } D _ { \mathrm { K L } } ( { \bf t } ^ { ( i ) } \| f _ { \boldsymbol { \theta } } ( { \bf x } ^ { ( i ) } ) ) = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \sum _ { j = 1 } ^ { m } t _ { j } ^ { ( i ) } \log \frac { t _ { j } ^ { ( i ) } } { \{ f _ { \boldsymbol { \theta } } ( { \bf x } ^ { ( i ) } ) \} _ { j } } , } } , \\ { \displaystyle { \boldsymbol { \theta } \gets \boldsymbol { \theta } - \eta \frac { \partial L } { \partial \boldsymbol { \theta } } , } } \end{array}
72
+ $$
73
+
74
+ where $m$ is the number of classes, and $\eta$ is the learning rate.
75
+
76
+ # 3.3 HOW BC LEARNING WORKS
77
+
78
+ # 3.3.1 ENLARGEMENT OF FISHER’S CRITERION
79
+
80
+ BC leaning leads to an enlargement of Fisher’s criterion (i.e., the ratio of the between-class distance to the within-class variance). We explain the reason in Fig. 2. In deep neural networks, linearly-separable features are learned in a hidden layer close to the output layer (An et al., 2015).
81
+
82
+ ![](images/725de8d7720e5e33132dbec1f02090d82b21c67a264e57a75da1eae81cc45836.jpg)
83
+ Figure 2: BC learning enlarges Fisher’s criterion in the feature space, by training the model to output the mixing ratio between two classes. We hypothesize that a mixed sound $m i x _ { r } ( { \bf x } _ { 1 } , { \bf x } _ { 2 } )$ is projected into the point near the internally dividing point of $\bar { f } ( \mathbf { x } _ { 1 } )$ and $f ( \mathbf { x } _ { 2 } )$ , considering the characteristic of sounds. Middle: When Fisher’s criterion is small, some mixed examples are projected into one of the classes, and BC learning gives a large penalty. Right: When Fisher’s criterion is large, most of the mixed examples are projected into betweenclass points, and BC learning gives a small penalty. Therefore, BC learning leads to such a feature space.
84
+
85
+ Besides, we can generate a new sound simply by adding the waveform data of two sounds, and humans can recognize both of two sounds and perceive which of two sounds is louder or softer from the mixed sound. Therefore, it is expected that an internally dividing point of the input space almost corresponds to that of the semantic feature space, at least for sounds. Then, the feature distribution of the mixed sounds of class A and class B with a certain ratio would be located near the internally dividing point of the original feature distribution of class A and B, and the variance of the feature distribution of the mixed sounds is proportional to the original feature distribution of class A and B. To investigate whether this hypothesis is correct or not, we visualized the feature distributions of the standard-learned model using PCA. We used the activations of fc6 of EnvNet (Tokozume & Harada, 2017) against training data of ESC10 (Piczak, 2015b). The results are shown in Fig. 3. The magenta circles represent the feature distribution of the mixed sounds of dog bark and rain with a ratio of $0 . 8 : 0 . 2$ , and the black dotted line represents the trajectory of the feature when we input a mixture of two particular sounds to the model changing the mixing ratio from 0 to 1. This figure shows that the mixture of two sounds is projected into the point near the internally dividing point of two features, and the features of the mixed sounds are distributed between two classes, as we expected.
86
+
87
+ ![](images/c1c866459208b9abe8e4c92ee27d418e42414edbb6626e6874c4c6b2e13cc374.jpg)
88
+ Figure 3: Visualization of the feature space using PCA. The features of the mixed sounds are distributed between two classes.
89
+
90
+ If Fisher’s criterion is small, the feature distribution of the mixed sounds becomes large, and would have a large overlap with one or both of the feature distribution of class A and B (Fig. 2(middle)). In this case, some mixed sounds are projected into one of the classes as shown in this figure, and the model cannot output the mixing ratio. BC learning gives a penalty to this situation because BC learning trains a model to output the mixing ratio. If Fisher’s criterion is large, on the other hand, the overlap becomes small (Fig. 2(right)). The model becomes able to output the mixing ratio, and BC learning gives a small penalty. Therefore, BC learning enlarges Fisher’s criterion between any two classes in the feature space.
91
+
92
+ # 3.3.2 REGULARIZATION OF POSITIONAL RELATIONSHIP AMONG FEATURE DISTRIBUTIONS
93
+
94
+ We expect that BC learning also has the effect of regularizing the positional relationship among the class feature distributions. In standard learning, there is no constraint on the positional relationship among the classes, as long as the features of each two classes are linearly separable. We found that a standard-learned model sometimes misclassifies a mixed sound of class A and class B as a class other than A or B. Fig. 4(lower left) shows an example of transition of output probability of standard-learned model when we input a mixture of two particular training sounds (dog bark and rain) to the model changing the mixing ratio from 0 to 1. The output probability of dog bark monotonically increases and that of rain monotonically decreases as we expected, but the model classifies the mixed sound as baby cry when the mixing ratio is within the range of $0 . 4 5 - 0 . 8 $ . This is an undesirable state because there is little possibility that a mixed sound of two classes becomes a sound of other classes. In this case, we assume that the features of each class are distributed as in Fig. 4(upper left). The decision boundary of class C appears between class A and class B, and the trajectory of the features of the mixed sounds crosses the decision boundary of class C.
95
+
96
+ BC learning can avoid the situation in which the decision boundary of other class appears between two classes, because BC learning trains a model to output the mixing ratio instead of misclassifying the mixed sound as different classes. We show the transition of the output probability in Fig. 4(lower right), when using the same two examples as that used in Fig. 4(lower left). We assume that the features of each class are distributed as in Fig. 4(upper right). The feature distributions of the three classes make an acute-angled triangle, and the decision boundary of class C does not appear between class A and class B. Note that it is assumed that the dimension of the feature space is greater than or equal to the number of classes minus 1. However, because the network is generally designed as such, it is not a problem. In this way, BC learning enlarges Fisher’s criterion, and at the same time, regularizes the positional relationship among the classes in the feature space. Hence, BC learning improves the generalization ability.
97
+
98
+ ![](images/d3718cca85648443b471a1eb3e639ff04cfaf0dcfc4e802ad41dc3a545c4d005.jpg)
99
+ Figure 4: BC learning regularizes the positional relationship of the classes in the feature space, by training the model not to misclassify the mixed sound as different classes. BC learning avoids the situation in which the decision boundary of other class appears between any two classes.
100
+
101
+ # 4 EXPERIMENTS
102
+
103
+ # 4.1 COMPARISON BETWEEN STANDARD LEARNING AND BC LEARNING
104
+
105
+ In this section, we train various types of sound recognition networks with both standard and BC learning, and demonstrate the effectiveness of BC learning.
106
+
107
+ Datasets. We used ESC-50, ESC-10 (Piczak, 2015b), and UrbanSound8K (Salamon et al., 2014) to train and evaluate the models. ESC-50, ESC-10, and UrbanSound8K contain a total of 2,000, 400, and 8,732 examples consisting of 50, 10, and 10 classes, respectively. We removed completely silent sections in which the value was equal to 0 at the beginning or end of examples in the ESC-50 and ESC-10 datasets. We converted all sound files to monaural 16-bit WAV files. We evaluated the performance of the methods using a $K$ -fold cross-validation $K = 5$ for ESC-50 and ESC-10, and $K = 1 0$ for UrbanSound8K), using the original fold settings. We performed cross-validation 5 times for ESC-50 and ESC-10, and showed the standard error.
108
+
109
+ Preprocessing and data augmentation. We used a simple preprocessing and data augmentation scheme. Let $T$ be the input length of a network [s]. In the training phase, we padded $T / 2$ s of zeros on each side of a training sound and randomly cropped a $T$ -s section from the padded sound. We mixed two cropped sounds with a random ratio when using BC learning. In the testing phase, we also padded $T / 2$ s of zeros on each side of a test sound and cropped $1 0 T$ -s sections from the padded sound at regular intervals. We then input these 10 crops to the network and averaged all softmax outputs. Each input data was regularized into a range of from $- 1$ to $+ 1$ by dividing it by 32,768, that is, the full range of 16-bit recordings.
110
+
111
+ Learning settings. All models were trained with Nesterov’s accelerated gradient using a momentum of 0.9, weight decay of 0.0005, and mini-batch size of 64. The only difference in the learning settings between standard and BC learning is the number of training epochs. BC learning tends to require more training epochs than does standard learning, while standard learning tends to overfit with many training epochs. To validate the comparison, we first identified an appropriate standard learning setting for each network and dataset (details are provided in the appendix), and we doubled the number of training epochs when using BC learning. Later in this section, we examine the relationship between the number of training epochs and the performance.
112
+
113
+ Table 1: Comparison between standard learning and our BC learning. We performed $K$ -fold cross validation using the original fold settings. We performed cross-validation 5 times for the ESC-50 and ESC-10 datasets, and show the standard error. BC learning improves the performance of all models on all datasets, even when we use a strong data augmentation scheme. Our EnvNet-v2 trained with BC learning performs the best and surpasses the human performance on ESC-50.
114
+
115
+ <table><tr><td rowspan="2">Model</td><td rowspan="2">Learning</td><td colspan="3">Error rate (%)on</td></tr><tr><td>ESC-50</td><td>ESC-10</td><td>UrbanSound8K</td></tr><tr><td rowspan="2">EnvNet (Tokozume &amp; Harada, 2017)</td><td>Standard</td><td>29.2 ± 0.1</td><td>12.8±0.4</td><td>33.7</td></tr><tr><td>BC (ours)</td><td>24.1± 0.2</td><td>11.3 ± 0.6</td><td>28.9</td></tr><tr><td rowspan="2">SoundNet5 (Aytar et al., 2016)</td><td>Standard</td><td>33.8 ± 0.2</td><td>16.4± 0.8</td><td>33.3</td></tr><tr><td>BC (ours)</td><td>27.4± 0.3</td><td>13.9 ± 0.4</td><td>30.2</td></tr><tr><td rowspan="2">M18 (Dai et al., 2017)</td><td>Standard</td><td>31.5 ± 0.5</td><td>18.2± 0.5</td><td>28.8</td></tr><tr><td>BC (ours)</td><td>26.7 ± 0.1</td><td>14.2 ± 0.9</td><td>26.5</td></tr><tr><td rowspan="2">Logmel-CNN (Piczak,2015a) + BN</td><td>Standard</td><td>27.6 ± 0.2</td><td>13.2 ± 0.4</td><td>25.3</td></tr><tr><td>BC (ours)</td><td>23.1 ± 0.3</td><td>9.4± 0.4</td><td>23.5</td></tr><tr><td rowspan="2">EnvNet-v2 (ours)</td><td>Standard</td><td>25.6 ± 0.3</td><td>14.2 ± 0.8</td><td>30.9</td></tr><tr><td>BC (ours)</td><td>18.2 ±0.2</td><td>10.6 ± 0.6</td><td>23.4</td></tr><tr><td rowspan="2">EnvNet-v2 (ours) + strong augment</td><td>Standard</td><td>21.2 ± 0.3</td><td>10.9 ± 0.6</td><td>24.9</td></tr><tr><td>BC (ours)</td><td>15.1 ± 0.2</td><td>8.6± 0.1</td><td>21.7</td></tr><tr><td colspan="2">SoundNet8 + Linear SVM (Aytar et al., 2016)</td><td>25.8</td><td>7.8</td><td>1</td></tr><tr><td colspan="2">Human (Piczak,2015b)</td><td>18.7</td><td>4.3</td><td>-</td></tr></table>
116
+
117
+ ![](images/e1894b4dd73269c8e4d26d10c8795c2791a68a35978e11c0b5766b033cceea12.jpg)
118
+ Figure 5: Training curves of EnvNet and EnvNet-v2 on ESC-50 (average of all trials).
119
+
120
+ # 4.1.1 EXPERIMENT ON EXISTING NETWORKS
121
+
122
+ First, we trained various types of existing networks. We selected EnvNet (Tokozume & Harada, 2017) as a network using both 1-D and 2-D convolutions, SoundNet5 (Aytar et al., 2016) and M18 (Dai et al., 2017) as networks using only 1-D convolution, and Logmel-CNN (Piczak, 2015a) $^ +$ BN as a network using log-mel features. Logmel- ${ \bf \nabla } . { \bf C N N } + { \bf B N }$ is an improved version of Logmel-CNN that we designed in which, to convolutional layers, we apply batch normalization (Ioffe & Szegedy, 2015) to the output and remove the dropout (Srivastava et al., 2014). Note that all networks and training codes are our implementation using Chainer v1.24 (Tokui et al., 2015).
123
+
124
+ The results are summarized in the upper half of Table 1. Our BC learning improved the performance of all networks on all datasets. The performance on ESC-50, ESC-10, and UrbanSound8K was improved by $4 . 5 { - } 6 . 4 \%$ , $1 . 5 { - } 4 . 0 \%$ , and $1 . 8 { - } 4 . 8 \%$ , respectively. We show the training curves of EnvNet on ESC-50 in Fig. 5(left). Note that the curves show the average of all trials.
125
+
126
+ # 4.1.2 EXPERIMENT ON A DEEPER NETWORK
127
+
128
+ To investigate the effectiveness of BC learning on deeper networks, we constructed a deep sound recognition network based on EnvNet, which we refer to as EnvNet- $\cdot \nu 2$ , and trained it with both standard and BC learning. The main differences between EnvNet and EnvNet-v2 are as follows: 1) EnvNet uses a sampling rate of $1 6 \ \mathrm { k H z }$ for the input waveforms, whereas EnvNet-v2 uses 44.1 kHz; and 2) EnvNet consists of 7 layers, whereas EnvNet-v2 consists of 13 layers. A detailed configuration is provided in the appendix.
129
+
130
+ The results are also shown in the upper half of Table 1, and the training curves on ESC-50 are given in Fig. 5(right). The performance was also improved with BC learning, and the degree of the improvement was greater than other networks $( 7 . 4 \%$ , $3 . 6 \%$ , and $7 . 5 \%$ on ESC-50, ESC-10, and UrbanSound8K, respectively). The error rate of EnvNet-v2 trained with BC learning was the lowest on ESC-50 and UrbanSound8K among all the models including Logmel- $\mathrm { \mathbf { C N N } } + \mathbf { B N }$ , which uses powerful hand-crafted features. Moreover, the error rate on ESC-50 $( 1 8 . 2 \% )$ is comparable to human performance reported by Piczak (2015b) $( 1 8 . 7 \% )$ . The point is not that our EnvNet-v2 is well designed, but that our BC learning successfully elicits the true value of a deep network.
131
+
132
+ # 4.1.3 EXPERIMENT WITH STRONG DATA AUGMENTATION
133
+
134
+ We compared the performances of standard and BC learning when using a stronger data augmentation scheme. In addition to zero padding and random cropping, we used scale augmentation with a factor randomly selected from [0.8, 1.25] and gain augmentation with a factor randomly selected from $[ - 6 \mathrm { d B } , + 6 \mathrm { d B } ]$ . Scale augmentation was performed before zero padding (thus, before mixing when employing BC learning) using linear interpolation, and gain augmentation was performed just before inputting to the network (thus, after mixing when using BC learning).
135
+
136
+ The results for EnvNet-v2 are shown in the lower half of Table 1, and the training curves on ESC-50 are given in Fig. 5(right). With BC learning, the performance was significantly improved even when we used a strong data augmentation scheme. Furthermore, the performance on ESC-50 $( 1 5 . 1 \% )$ surpasses the human performance $( 1 8 . 7 \% )$ . BC learning performs well on various networks, datasets, and data augmentation schemes, and using BC learning is always beneficial.
137
+
138
+ # 4.1.4 RELATIONSHIP WITH # OF TRAINING EPOCHS
139
+
140
+ We investigated the relationship between the performance and the number of training epochs, because the previously described experiments were conducted using different numbers of training epochs (we used $2 \times$ training epochs for BC learning). Fig. 6 shows the error rate of EnvNet on ESC-10 and ESC-50 with various numbers of training epochs. This figure shows that for standard learning, approximately 600 training epochs are sufficient for both ESC
141
+
142
+ ![](images/b05ba736b433a3689fae8e91fd07c16c95cfbfc73e7c562faf55d95988898d49.jpg)
143
+ Figure 6: Error rate vs. # of training epochs.
144
+
145
+ 10 and ESC-50. However, this number is insufficient for BC learning. Although BC learning performed better than standard learning with 600 epochs, improved performance was achieved when using more training epochs (900 and 1,200 epochs for ESC-10 and ESC-50, respectively). However, if the number of training epochs was small, the performance of BC learning was lower than that of standard learning. We can say that BC learning always improves the performance as long as we use a sufficiently large number of training epochs. Additionally, the number of training epochs needed would become large when there are many classes.
146
+
147
+ # 4.2 ABLATION ANALYSIS
148
+
149
+ To understand the part that is important for BC learning, we conducted an ablation analysis. We trained EnvNet on ESC-50 using various settings. All results are shown in Table 2. We also performed 5-fold cross-validation five times and show the standard error.
150
+
151
+ Mixing method. We compared the mixing formula (Eqn. 1 vs. Eqn. 2, which consider the sound pressure levels of two sounds) and the calculation method for sound pressure levels (RMS vs. Aweighting). As shown in Table 2, the proposed mixing method using Eqn. 2 and A-weighting performed the best. Considering the difference in the sound pressure levels is important for BC learning, and the method used to define the sound pressure levels also has an effect on the performance.
152
+
153
+ Label. We compared the different labels that we applied to the mixed sound. As shown in Table 2, the proposed ratio label of $\mathbf { t } = r \mathbf { t } _ { 1 } + \left( 1 - r \right) \mathbf { t } _ { 2 }$ performed the best. When we applied a single label of the dominant sound (i.e., $\textbf { t } = \ \mathbf { t } _ { 1 }$ if $r \ > \ 0 . 5$ , otherwise $\mathbf { t } = \mathbf { t } _ { 2 }$ ) and trained the model using softmax cross entropy loss, the performance was improved compared to that of standard learning. When we applied a multi-label (i.e., $\mathbf { t } = \mathbf { t } _ { 1 } + \mathbf { t } _ { 2 } )$ ) and trained the model using sigmoid cross entropy loss, the performance was better than when using a single label. However, the performance was worse than when using our ratio label in both cases. The model can learn the between-class examples more efficiently when using our ratio label.
154
+
155
+ Table 2: Ablation analysis. We trained EnvNet on ESC-50 using various settings. The results show that the training data variation is not the only matter.
156
+
157
+ <table><tr><td>Comparison of</td><td>Setting</td><td>Err. rate (%)</td></tr><tr><td rowspan="4">Mixing method</td><td>Eqn. (1)</td><td>26.8± 0.1</td></tr><tr><td>(2)+RMS</td><td>26.5 ± 0.2</td></tr><tr><td>(2)+ A-weighting</td><td>24.1± 0.2</td></tr><tr><td>(proposed)</td><td></td></tr><tr><td rowspan="3">Label</td><td>Single</td><td>26.5±0.2</td></tr><tr><td>Multi</td><td>25.0± 0.3</td></tr><tr><td>Ratio (proposed)</td><td>24.1± 0.2</td></tr><tr><td rowspan="5"># mixed classes</td><td>N=1</td><td>27.3± 0.2</td></tr><tr><td>N=1or2</td><td>24.8 ± 0.3</td></tr><tr><td>N = 2 (proposed)</td><td>24.1±0.2</td></tr><tr><td>N=2or3</td><td>24.1±0.2</td></tr><tr><td>N=3</td><td>25.3± 0.2</td></tr><tr><td rowspan="6">Where to mix</td><td>Input (proposed)</td><td>24.1± 0.2</td></tr><tr><td>pool2</td><td>27.1± 0.3</td></tr><tr><td>pool3</td><td>28.7± 0.3</td></tr><tr><td>pool4</td><td>28.8±0.2</td></tr><tr><td>fc5</td><td>28.5±0.1</td></tr><tr><td>fc6</td><td>28.6 ± 0.2</td></tr><tr><td colspan="2">Standard learning</td><td>29.2 ± 0.1</td></tr></table>
158
+
159
+ Number of mixed classes. We investigated the relationship between the performance and the number of sound classes that we mixed. $N = 1$ in Table 2 means that we mixed two sounds belonging to the same class, which is similar to Takahashi et al. (2016). $N = 1$ or 2 means that we completely randomly selected
160
+
161
+ two sounds to be mixed; sometimes these two sounds were the same class. $N = 2$ or 3 means that we mixed two and three sounds belonging to different classes with probabilities of 0.5 and 0.5, respectively. When we mixed three sounds, we generated a mixing ratio from Dir(1,1,1) and mixed three sounds using a method that is an extended version of Eqn. 2 to three classes. As shown in Table 2, the proposed $N = 2$ performed the best. $N = 2$ or 3 also achieved a good performance. It is interesting to note that the performance of $N = 3$ is worse than that of $N = 2$ despite the larger variation in training data. We believe that the most important factor is not the training data variation but rather the enlargement of Fisher’s criterion and the regularization of the positional relationship among the feature distributions. Mixing more than two sounds leads to increased training data variation, but we expect that cannot efficiently achieve them.
162
+
163
+ Where to mix. Finally, we investigated what occurs when we mix two examples within the network. We input two sounds to be mixed into the model and performed the forward calculation to the mixing point. We then mixed the activations of two sounds at the mixing point and performed the rest of the forward calculation. We mixed two activations $\mathbf { h } _ { 1 }$ and $\mathbf { h } _ { 2 }$ simply by $r \mathbf { h } _ { 1 } + \left( 1 - r \right) \mathbf { h } _ { 2 }$ . As shown in Table 2, the performance tended to improve when we mixed two examples at the layer near the input layer. The performance was the best when we mixed in the input space. Mixing in the input space is the best choice, not only because it performs the best, but also because it does not require additional forward/backward computation and is easy to implement.
164
+
165
+ # 5 CONCLUSION
166
+
167
+ We proposed a novel learning method for deep sound recognition, called BC learning. Our method improved the performance on various networks, datasets, and data augmentation schemes. Moreover, we achieved a performance surpasses the human level by constructing a deeper network named EnvNet-v2 and training it with BC learning. BC learning is a simple and powerful method that improves various sound recognition methods and elicits the true value of large-scale networks. Furthermore, BC learning is innovative in that a discriminative feature space can be learned from betweenclass examples, without inputting pure examples. We assume that the core idea of BC learning is generic and could contribute to the improvement of the performance of tasks of other modalities.
168
+
169
+ # ACKNOWLEDGEMENT
170
+
171
+ This work was supported by JST CREST Grant Number JPMJCR1403, Japan.
172
+
173
+ # REFERENCES
174
+
175
+ Ossama Abdel-Hamid, Abdel-rahman Mohamed, Hui Jiang, Li Deng, Gerald Penn, and Dong Yu. Convolutional neural networks for speech recognition. IEEE/ACM TASLP, 22(10):1533–1545, 2014.
176
+
177
+ Senjian An, Farid Boussaid, and Mohammed Bennamoun. How can deep rectifier networks achieve linear separability and preserve distances? In ICML, 2015.
178
+
179
+ Yusuf Aytar, Carl Vondrick, and Antonio Torralba. Soundnet: Learning sound representations from unlabeled video. In NIPS, 2016.
180
+
181
+ Wei Dai, Chia Dai, Shuhui Qu, Juncheng Li, and Samarjit Das. Very deep convolutional neural networks for raw waveforms. In ICASSP, 2017.
182
+
183
+ Steven B Davis and Paul Mermelstein. Comparison of parametric representations for monosyllabic word recognition in continuously spoken sentences. IEEE TASSP, 28(4):357–366, 1980.
184
+
185
+ Ronald A Fisher. The use of multiple measurements in taxonomic problems. Annals of eugenics, 7(2):179–188, 1936.
186
+
187
+ 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, 2017.
188
+
189
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing humanlevel performance on imagenet classification. In ICCV, 2015.
190
+
191
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016.
192
+
193
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In ICML, 2015.
194
+
195
+ Yoon Kim. Convolutional neural networks for sentence classification. In EMNLP, 2014.
196
+
197
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In NIPS, 2012.
198
+
199
+ Yann LeCun, Leon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document ´ recognition. In IEEE, 1998.
200
+
201
+ Beth Logan et al. Mel frequency cepstral coefficients for music modeling. In ISMIR, 2000.
202
+
203
+ Kuba Łopatka, Paweł Zwan, and Andrzej Czyzewski. Dangerous sound event recognition using support vector ˙ machine classifiers. In Advances in Multimedia and Network Information System Technologies, pp. 49–57. 2010.
204
+
205
+ Giambattista Parascandolo, Heikki Huttunen, and Tuomas Virtanen. Recurrent neural networks for polyphonic sound event detection in real life recordings. In ICASSP, 2016.
206
+
207
+ Karol J Piczak. Environmental sound classification with convolutional neural networks. In MLSP, 2015a.
208
+
209
+ Karol J Piczak. Esc: Dataset for environmental sound classification. In ACM Multimedia, 2015b.
210
+
211
+ Tara N Sainath, Oriol Vinyals, Andrew Senior, and Hasim Sak. Convolutional, long short-term memory, fully connected deep neural networks. In ICASSP, 2015a.
212
+
213
+ Tara N Sainath, Ron J Weiss, Andrew Senior, Kevin W Wilson, and Oriol Vinyals. Learning the speech frontend with raw waveform cldnns. In Interspeech, 2015b.
214
+
215
+ Justin Salamon and Juan Pablo Bello. Deep convolutional neural networks and data augmentation for environmental sound classification. IEEE SPL, 24(3):279–283, 2017.
216
+
217
+ Justin Salamon, Christopher Jacoby, and Juan Pablo Bello. A dataset and taxonomy for urban sound research. In ACMMM, 2014.
218
+
219
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In ICLR, 2015.
220
+
221
+ Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: A simple way to prevent neural networks from overfitting. JMLR, 15(Jun):1929–1958, 2014.
222
+
223
+ Naoya Takahashi, Michael Gygli, Beat Pfister, and Luc Van Gool. Deep convolutional neural networks and data augmentation for acoustic event detection. In Interspeech, 2016.
224
+
225
+ Yuji Tokozume and Tatsuya Harada. Learning environmental sounds with end-to-end convolutional neural network. In ICASSP, 2017.
226
+
227
+ Seiya Tokui, Kenta Oono, and Shohei Hido. Chainer: a next-generation open source framework for deep learning. In NIPS Workshop on Machine Learning Systems, 2015.
228
+
229
+ Michel Vacher, Jean-Franc¸ois Serignat, and Stephane Chaillol. Sound classification in a smart room environment: an approach using gmm and hmm methods. In SPED, 2007.
230
+
231
+ Xiang Zhang, Junbo Zhao, and Yann LeCun. Character-level convolutional networks for text classification. In NIPS, 2015.
232
+
233
+ # A LEARNING SETTINGS
234
+
235
+ Table 3 shows the detailed learning settings of standard learning. We trained the model by beginning with a learning rate of Initial $L R$ , and then divided the learning rate by 10 at the epoch listed in $L R$ schedule. To improve convergence, we used a $0 . 1 \times$ smaller learning rate for the first Warmup epochs. We then terminated training after $\#$ of epochs epochs. We doubled # of epochs and $L R$ schedule when using BC learning, as we mentioned in the paper.
236
+
237
+ Table 3: Details of learning settings.
238
+
239
+ <table><tr><td>Dataset</td><td>Model</td><td># of epochs</td><td>Initial LR</td><td>LR schedule</td><td>Warmup</td></tr><tr><td rowspan="5">ESC-50</td><td>EnvNet</td><td>600</td><td>0.01</td><td>{300,450}</td><td>0</td></tr><tr><td>SoundNet5</td><td>300</td><td>0.1</td><td>{150,225}</td><td>0</td></tr><tr><td>M18</td><td>400</td><td>0.1</td><td>{200,300}</td><td>0</td></tr><tr><td>Logmel-CNN</td><td>300</td><td>0.01</td><td>{150,225}</td><td>0</td></tr><tr><td>EnvNet-v2</td><td>1,000</td><td>0.1</td><td>{300,600,900}</td><td>10</td></tr><tr><td rowspan="5">ESC-10</td><td>EnvNet</td><td>600</td><td>0.01</td><td>{300,450}</td><td>0</td></tr><tr><td>SoundNet5</td><td>300</td><td>0.1</td><td>{150,225}</td><td>0</td></tr><tr><td>M18</td><td>400</td><td>0.1</td><td>{200,300}</td><td>0</td></tr><tr><td>Logmel-CNN</td><td>300</td><td>0.01</td><td>{150,225}</td><td>0</td></tr><tr><td>EnvNet-v2</td><td>600</td><td>0.01</td><td>{300,450}</td><td>0</td></tr><tr><td rowspan="5">UrbanSound8K</td><td>EnvNet</td><td>400</td><td>0.01</td><td>{200,300}</td><td>0</td></tr><tr><td>SoundNet5</td><td>200</td><td>0.1</td><td>{100,150}</td><td>0</td></tr><tr><td>M18</td><td>300</td><td>0.1</td><td>{150,225}</td><td>0</td></tr><tr><td>Logmel-CNN</td><td>200</td><td>0.01</td><td>{100,150}</td><td>0</td></tr><tr><td>EnvNet-v2</td><td>600</td><td>0.1</td><td>{180,360, 540}</td><td>10</td></tr></table>
240
+
241
+ # B CONFIGURATION OF ENVNET-V2
242
+
243
+ Table 4 shows the configuration of our EnvNet-v2 used in the experiments. EnvNet-v2 consists of 10 convolutional layers, 3 fully connected layers, and 5 max-pooling layers. We use a sampling rate of $4 4 . 1 ~ \mathrm { k H z }$ , which is the standard recording setting, and a higher resolution than existing networks (Piczak, 2015a; Aytar et al., 2016; Dai et al., 2017; Tokozume & Harada, 2017), in order to use rich high-frequency information. The basic idea is motivated by EnvNet (Tokozume & Harada, 2017), but the advantages of other successful networks are incorporated. First, we extract short-time frequency features with the first two temporal convolutional layers and a pooling layer (conv1– pool2). Second, we swap the axes and convolve in time and frequency domains with the later layers (conv3–pool10). In this part, we hierarchically extract the temporal features by stacking the convolutional and pooling layers with decreasing their kernel size in a similar manner to SoundNet (Aytar et al., 2016). Furthermore, we stack multiple convolutional layers with a small kernel size in a similar manner to M18 (Dai et al., 2017) and VGG (Simonyan & Zisserman, 2015), to extract more rich features. Finally, we produce output predictions with fc11–fc13 and the following softmax activation. Single output prediction is calculated from 66,650 input samples (approximately 1.5 s at $4 4 . 1 \mathrm { k H z }$ ). We do not use padding in convolutional layers. We apply ReLU activation for all the hidden layers and batch normalization (Ioffe & Szegedy, 2015) to the output of conv1–conv10. We also apply 0.5 of dropout (Srivastava et al., 2014) to the output of fc11 and fc12. We use a weight initialization of He et al. (2015) for all convolutional layers. We initialize the weights of each fully connected layer using Gaussian distribution with a standard deviation of $\sqrt { 1 / n }$ , where $n$ is the input dimension of the layer.
244
+
245
+ Table 4: Configuration of EnvNet-v2. Data shape represents the dimension in (channel, frequency, time).
246
+
247
+ <table><tr><td>Layer</td><td>ksize</td><td>stride</td><td># of filters</td><td>Data shape</td></tr><tr><td>Input</td><td></td><td></td><td></td><td>(1, 1, 66,650)</td></tr><tr><td>conv1</td><td>(1,64)</td><td>(1,2)</td><td>32</td><td></td></tr><tr><td>conv2</td><td>(1,16)</td><td>((1,2)</td><td>64</td><td></td></tr><tr><td>pool2</td><td>(1,64)</td><td>(1,64)</td><td></td><td>(64,1, 260)</td></tr><tr><td>swapaxes</td><td></td><td></td><td></td><td>(1, 64,260)</td></tr><tr><td>conv3,4</td><td>(8,8)</td><td>(1,1)</td><td>32</td><td></td></tr><tr><td>pool4</td><td>(5,3)</td><td>(5,3)</td><td></td><td>(32,10, 82)</td></tr><tr><td>conv5,6 pool6</td><td>(1,4)</td><td>(1,1)</td><td>64</td><td></td></tr><tr><td></td><td>(1,2)</td><td>(1,2)</td><td></td><td>(64,10,38)</td></tr><tr><td>conv7, 8 pool8</td><td>(1,2)</td><td>(1,1)</td><td>128</td><td></td></tr><tr><td></td><td>(1,2)</td><td>(1,2)</td><td></td><td>(128,10, 18)</td></tr><tr><td>conv9,10</td><td>(1,2)</td><td>(1,1)</td><td>256</td><td></td></tr><tr><td>pool10</td><td>(1,2)</td><td>(1,2)</td><td></td><td>(256,10, 8)</td></tr><tr><td>fc11</td><td></td><td>-</td><td>4096</td><td>(4,096,)</td></tr><tr><td>fc12</td><td></td><td></td><td>4096</td><td>(4,096,)</td></tr><tr><td>fc13</td><td>■</td><td>-</td><td># of classes</td><td>(# of classes,)</td></tr></table>
md/train/BJ6anzb0Z/BJ6anzb0Z.md ADDED
@@ -0,0 +1,293 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MULTIMODAL SENTIMENT ANALYSIS TO EXPLORE THE STRUCTURE OF EMOTIONS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ We propose a novel approach to multimodal sentiment analysis using deep neural networks combining visual recognition and natural language processing. Our goal is different than the standard sentiment analysis goal of predicting whether a sentence expresses positive or negative sentiment; instead, we aim to infer the latent emotional state of the user. Thus, we focus on predicting the emotion word tags attached by users to their Tumblr posts, treating these as “self-reported emotions.” We demonstrate that our multimodal model combining both text and image features outperforms separate models based solely on either images or text. Our model’s results are interpretable, automatically yielding sensible word lists associated with emotions. We explore the structure of emotions implied by our model and compare it to what has been posited in the psychology literature, and validate our model on a set of images that have been used in psychology studies. Finally, our work also provides a useful tool for the growing academic study of images— both photographs and memes—on social networks.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Sentiment analysis has been an active area of research in the past decade, especially on textual data from Twitter, e.g. early work by Pak & Paroubek (2010) showed that emoticons could be used to collect a labeled dataset for sentiment analysis, Golder & Macy (2011) investigated temporal patterns in emotion using tweets, and Bollen et al. (2011) investigated the impact of collective mood states on the stock market. The SemEval series of “Sentiment Analysis in Twitter” challenges has used Twitter data as a benchmark to spur the development of new sentiment analysis algorithms (Rosenthal et al., 2017).
12
+
13
+ Unlike Twitter, Tumblr posts are not limited to 140 characters, allowing more expressiveness, and they often focus on visual content: most Tumblr posts contain an image with some accompanying text. As pictures—both photographs and memes—have become prevalent on social media, researchers have begun to study them, and make novel claims about the role that they play in social media. Shifman (2014) makes an argument for taking memes seriously, and Miller & Sinanan (2017) use memes throughout their cross-country anthropological study of Facebook, characterizing who posts what sorts of memes and what sort of communicative function memes play. Inspired by this research, we take images seriously as a source of data worth analyzing. Further, we aim to enable a research agenda focused on images by giving social scientists tools to address fundamental questions about the use of images on social media.
14
+
15
+ In psychology, the gold standard for measuring emotions is self-report, i.e. if an individual says that they are happy then that is taken to be the truth (Gilbert, 2006). On Tumblr, users often attach tags to their posts which we consider to be emotional self-reports, as these tags take the simple form of, e.g. “#happy”. By collecting a large dataset and using these emotion word tags as labels, we argue that our sentiment analysis approach, which combines images and text, leads to a more psychologically plausible model, as the dataset combines two rich sources of information and has labels we believe are a good proxy for self-reported emotion.
16
+
17
+ Concretely, the Deep Sentiment model associates the features learned by the two modalities as follows:
18
+
19
+ • For images, we fine-tune Inception (Szegedy et al., 2015), a pre-trained deep convolutional neural network, to our specific task of emotion inferring.
20
+ • The text is mapped into a rich high-dimensional space using a word representation learned by GloVe (Pennington et al., 2014). The embedded vectors are then fed to a recurrent network which preserves the word order and captures some of the semantics of human language.
21
+ • A dense layer combines the information in the two modalities and a final softmax output layer gives the probability distribution over the possible emotion word tags.
22
+
23
+ # 2 RELATED WORK
24
+
25
+ Visual sentiment analysis has received much less attention compared to text-based sentiment analysis. Yet, images are a valuable source of information for accurately inferring emotional states as they have become ubiquitous on social media as a means for users to express themselves (Miller & Sinanan, 2017). Although huge progress has been made on standard image classification tasks thanks to the ImageNet challenge (Russakovsky et al., 2015), visual sentiment analysis may be fundamentally different from classifying images as it requires a higher level of abstraction to understand the message conveyed by an image (Joshi et al., 2011). Implicit knowledge linked to culture and intrinsic human subjectivity – that can make two people use the same image to express different emotions – makes visual sentiment analysis a difficult task.
26
+
27
+ Borth et al. (2013) pioneered sentiment analysis on visual content with SentiBank, a system extracting mid-level semantic attributes from images. These semantic features are outputs of classifiers that can predict the relevance of an image with regard to one of the emotions in the Plutchik’s wheel of emotions (Plutchik, 2001). Motivated by the progress of deep learning methods, You et al. (2015) used convolutional neural networks on Flickr with domain transfer from Twitter for binary sentiment classification. However, studies about image annotation showed that combining text features with images can greatly improve performance as shown by Guillaumin et al. (2010) and Gong et al. (2014).
28
+
29
+ Successful results in multimodal sentiment analysis have been achieved using non-negative matrix factorisation (Wang et al., 2015) and latent correlations (Katsurai & Satoh, 2016). Chen et al. (2015) investigated the image posting behaviour of social media users and found in his study that two thirds of the participants added an image to their tweets to enhance the emotion of the text. In order to uncover the link between image tweets and the latent emotion, he used Latent Dirichlet Allocation to model image tweets with three modalities: textual, visual and emotional.
30
+
31
+ One weakness shared by the papers above is the lack of large training datasets due to the inherent complexity of finding labeled images/text on social media. In this work, we aim to mitigate this problem using a large noisy labeled dataset of Tumblr posts. Further, sentiment analysis on text is a well-developed research area in both computer science and psychology, and sentiment analysis has been used to answer psychological questions. However, researchers have cautioned that sentiment analysis focuses on the positive or negative sentiment expressed by a piece of text, rather than on the underlying emotional state of the person who wrote the text (Flaxman & Kassam, 2016) and thus is not necessarily a reliable measure of latent emotion. We address this problem by trying to predict emotional state of the user instead of the sentiment polarity.
32
+
33
+ # 3 TUMBLR DATASET
34
+
35
+ Tumblr is a microblogging service where users post multimedia content that often contains the following attributes: an image, text, and tags. The critical piece of our approach, which distinguishes it from sentiment analysis methods focused on purely distinguishing positive from negative, is that we use the emotion word tags as the labels we wish to predict. As we consider these emotion word tags to be (noisy) labels indicating the user’s state of mind when writing a post, we can use them as a proxy for self-reported emotion, and thus a proxy for the underlying emotional state of the user.
36
+
37
+ To build our dataset, queries were made through the Tumblr API searching for an emotion appearing in the tags. The 15 emotions retained were those with high relative frequencies on Tumblr among the PANAS-X scale (Watson & Clark, 1999) or the Plutchik’s wheel of emotions (Plutchik, 2001).
38
+
39
+ In some posts, the tag containing the emotion of the post also appeared in the text itself. We removed these words from the text in order not to give our classifier an unfair advantage. We extracted every tagged posts from Tumblr by going backward from 2017 until 2011. Due to the API limitations, posts from high density emotions, such as ‘happy’ or ‘angry’, did not go as far back in the past, but otherwise we believe that our dataset is a complete sample.
40
+
41
+ As Tumblr is used worldwide, we had to filter out non-English posts: posts with less than $50 \%$ of English words were removed from the dataset. The vocabulary of English words was obtained from GloVe (although GloVe’s vocabulary contains some non-English words this approach filtered out non-English posts reasonably well). Also, not every extracted post contained an image and we likewise excluded these. Figure 1 shows two posts with their associated emotions (more examples in Appendix A) and Table 1 summarises the statistics of the data1.
42
+
43
+ ![](images/c754f85a96b5e02096e85f7171ae5ad6b26626a9c7fc8f947317498943d3f473.jpg)
44
+
45
+ (a) Optimistic: “The most beautiful thing we can experience is the mysterious. It is the source of all true art and science – Albert Einstein.”
46
+
47
+ ![](images/7c16a8beb1e3bd4b8315511d19263c96d010dd431526b1e9063c7a79fa9477ca.jpg)
48
+ Figure 1: Examples of Tumblr posts
49
+
50
+ (b) Sad: “It’s okay to be upset. It’s okay to not always be happy. It’s okay to cry. Never hide your emotions in fear of upsetting others or of being a bother.”
51
+
52
+ Table 1: Summary statistics for the Tumblr dataset, with posts from January 2011 to September 2017.
53
+
54
+ Tumblr data
55
+
56
+ <table><tr><td colspan="2">Posts</td><td colspan="2">English text</td><td>English text and image</td></tr><tr><td colspan="2">1,009,534</td><td colspan="2">578,699</td><td>256,897</td></tr><tr><td colspan="2"></td><td colspan="2"></td></tr><tr><td>Emotion</td><td>Posts</td><td>English text</td><td>English text and image</td></tr><tr><td>Happy</td><td>189,841</td><td>62%</td><td>29%</td></tr><tr><td>Calm</td><td>139,911</td><td>37%</td><td>29%</td></tr><tr><td>Sad</td><td>124,900</td><td>53%</td><td>15%</td></tr><tr><td>Scared</td><td>104,161</td><td>65%</td><td>20%</td></tr><tr><td>Bored</td><td>101,856</td><td>54%</td><td>29%</td></tr><tr><td>Angry</td><td>100,033</td><td>60%</td><td>21%</td></tr><tr><td>Annoyed</td><td>72,993</td><td>78%</td><td>10%</td></tr><tr><td>Love</td><td>66,146</td><td>61%</td><td>39%</td></tr><tr><td>Excited</td><td>37,240</td><td>58%</td><td>41%</td></tr><tr><td>Surprised</td><td>18,322</td><td>47%</td><td>32%</td></tr><tr><td>Optimistic</td><td>16,111</td><td>64%</td><td>36%</td></tr><tr><td>Amazed</td><td>10,367</td><td>61%</td><td>35%</td></tr><tr><td>Ashamed</td><td>10,066</td><td>63%</td><td>22%</td></tr><tr><td>Disgusted</td><td>9,178</td><td>69%</td><td>17%</td></tr><tr><td>Pensive</td><td>8,409</td><td>57%</td><td>34%</td></tr></table>
57
+
58
+ # 4 METHODOLOGY
59
+
60
+ # 4.1 VISUAL ANALYSIS
61
+
62
+ Training a convolutional network from scratch can be challenging as a large amount of data is needed and many different architectures have to be tried before achieving satisfying performances. To circumvent this issue, we can take advantage of a pre-trained network named Inception (Szegedy et al., 2015) that learned to recognise images through the ImageNet dataset with a deep architecture of 22 layers.
63
+
64
+ Inception learned representations capturing the colors and arrangement of shapes of an image, which turn out to be relevant when dealing with images even for a different task. We could also say that the pre-trained network grasped the underlying structure of images. This statement rests on the hypothesis that all images lie in a low-dimensional manifold, and recent advances in realistic photos generation through generative adversarial networks bolsters this idea (Radford et al., 2016).
65
+
66
+ # 4.2 NATURAL LANGUAGE PROCESSING
67
+
68
+ Even as a human being, it can be difficult to guess the expressed emotion only by looking at a Tumblr image without reading its caption as shown by Figure 2.
69
+
70
+ ![](images/168cd0e1d2a7780da3aedcab9aadf7521e6f7fd9feca8bb9bfdc75e1d65cbad9.jpg)
71
+ Figure 2: Which emotion is it?
72
+
73
+ It is unclear whether the user wants to convey happiness or surprise. Only after reading the accompanying text, “To whoever left this on my windshield outside of last night’s art opening, I love you. You made my night,” can we finally conclude that the person was surprised (and possibly also feeling other emotions like amazed). The text is extremely informative and is usually crucial to accurately infer the emotional state.
74
+
75
+ # 4.2.1 WORD EMBEDDING
76
+
77
+ Most learning algorithms rely on the local smoothness hypothesis, that is, similar training instances are spatially close. This hypothesis clearly doesn’t hold with words one-hot encoded as for instance ‘dog’ is as close to ‘tree’ as it is to ‘cat’. Ideally, we would like to transform the word ‘dog’ into a space in which it is closer to ‘cat’ than it is to ‘tree’. Word embeddings produce a mapping in which words are projected into a high-dimensional space that preserves semantic relationships. We use the GloVe (Pennington et al., 2014) word embedding that was trained on Twitter data, because the writing styles on Twitter and Tumblr are similar.
78
+
79
+ Each post in the dataset does not necessarily contain the same number of words. Even after embedding each word, the input will be of variable size and most learning algorithm expect a fixed-sized input. We could simply average across the high-dimensional representations of the words and take a distribution regression approach (Muandet et al., 2017). However note that averaging would mean that the word order would be completely lost. Human language relies heavily on word order to communicate as for example the word change can be both a noun and a verb, and negation such as ‘not entertained’ can only be understood if ‘not’ directly precedes the verb. We will preserve word order by using recurrent neural networks.
80
+
81
+ # 4.2.2 SEQUENCE INPUT
82
+
83
+ Models of natural language using neural networks have proved to outperform the more traditional statistical models that were limited by the Markov assumption (Bengio et al., 2003; Goodman, 2001). One explanation could be that the compact representation of words through word embeddings is robust (Mikolov et al., 2011) and do not need any smoothing over probabilities. Among the neural models, the recurrent-based models allows for short-term memory inspired by how humans read sentences: past context is essential to understand the meaning of written language. Contrary to shallow feedforward networks, that can only cluster similar words, recurrent networks (which can be viewed as a deep architecture (Bengio & LeCun, 2007)) can cluster similar histories. Recurrent neural networks have a temporal awareness represented by the hidden state that can be seen as an embedding of the past words. For example in Sutskever et al. (2014) a quality translation of a sentence was made possible with the last output of a recurrent neural network.
84
+
85
+ In our setting, for a given Tumblr post, the text is broken down into a sequence of words that are embedded into a high-dimensional space (unknown words are mapped to the zero vector) and then fed into an LSTM (Hochreiter & Schmidhuber, 1997). To account for shorter posts, we zero-pad the vector with a special word token. For longer posts, we only keep the 50 first words which is a reasonable choice as $76 \%$ posts in the dataset contain less than 50 words.
86
+
87
+ # 4.3 DEEP SENTIMENT: A MULTIMODAL NEURAL NETWORK
88
+
89
+ Information often comes in several modalities, and humans are able to seamlessly combine them. For instance, in speech recognition, humans integrate audio and visual information to understand speech, as was demonstrated by the McGurk effect (McGurk & MacDonald, 1976). Separating what we see from what we hear seems like an easy task, but in an experiment conducted by McGurk, the subjects who were listening to a /ba/ sound with a visual /ga/ actually reported they were hearing a /da/. This is uncanny as even if we know the actual sound is a /ba/, we cannot stop our brain from interpreting it as a /da/.
90
+
91
+ In Figure 2 we gave an example of text being necessary to fully understand the emotion expressed by an image. Sometimes alternative text would lead to entirely different interpretations, as shown in Figure 3:
92
+
93
+ ![](images/c808eb7e74da63c374d25a1e9fb8d3e407bed32da7ddd033dd104b0218349fc6.jpg)
94
+ (b) Angry: “I hate it when people are taking too much space on planes.”
95
+
96
+ (a) Scared: “Planes might just be the most frightening thing ever.”
97
+
98
+ ![](images/2883935d1c4a45e0ab6f07c351abdc70bb1a1f6a3615201000b0c109e88df7d6.jpg)
99
+ Figure 3: Different meanings with different captions.
100
+
101
+ Exploiting both visual and textual information is therefore key to understanding a user’s underlying emotional state. We call our proposed network architecture, combining visual recognition and text analysis, “Deep Sentiment”.
102
+
103
+ # 4.3.1 ARCHITECTURE
104
+
105
+ Deep Sentiment’s architecture is shown in Figure 4:
106
+
107
+ ![](images/746371da56165b060b1870fbd69a0eb99eff70669923b25a338ce80d5cad1671.jpg)
108
+ Figure 4: The Deep Sentiment structure. On the one hand, the input image, resized to (224,224,3) is fed into the Inception network and outputs a vector of size 256. On the other hand, the text is projected into a high-dimensional space that subsequently goes through an LSTM layer with 1024 units. The two modalities are then concatenated and fed into a dense layer. The final softmax output layer give the probability distribution over the emotional state of the user.
109
+
110
+ # 5 EVALUATION
111
+
112
+ In Table 2, we compare Deep Sentiment with the image model (Inception model fine-tuned through the last Inception module), the text model, and a baseline: random guessing that includes the prior probabilities of the classes. Figure 5 shows a comparison of the accuracy curves of the different models.
113
+
114
+ Table 2: Comparison of image model, text model and Deep Sentiment.
115
+
116
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Loss</td><td rowspan=1 colspan=1>Trainaccuracy</td><td rowspan=1 colspan=1>Testaccuracy</td></tr><tr><td rowspan=1 colspan=1>Random guessing</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>11%</td><td rowspan=1 colspan=1>11%</td></tr><tr><td rowspan=1 colspan=1>Image model</td><td rowspan=1 colspan=1>1.80</td><td rowspan=1 colspan=1>43%</td><td rowspan=1 colspan=1>36%</td></tr><tr><td rowspan=1 colspan=1>Text model</td><td rowspan=1 colspan=1>0.81</td><td rowspan=1 colspan=1>72%</td><td rowspan=1 colspan=1>69%</td></tr><tr><td rowspan=1 colspan=1>Deep Sentiment</td><td rowspan=1 colspan=1>0.75</td><td rowspan=1 colspan=1>80%</td><td rowspan=1 colspan=1>72%</td></tr></table>
117
+
118
+ ![](images/5609ae3b910aab3e30daac14bdd3385ebafe55e2ef734bc5bd287f9cd140ac97.jpg)
119
+ Figure 5: Accuracy comparison of the three models
120
+
121
+ Using text alone, the test accuracy is $69 \%$ , almost double the accuracy of the image model, this suggests that on Tumblr, text is a better predictor of emotion than images, as we illustrated in Figure 2. By combining text and images Deep Sentiment achieves $80 \%$ train accuracy and $72 \%$ test accuracy, significantly outperforming the images-only model and slightly outperforming the text-only model (note that no validation set was used to tune hyperparameters, even though various architectures were tried before yielding Deep Sentiment).
122
+
123
+ # 6 RESULTS
124
+
125
+ In this section, we carefully investigate what psychologically meaningful results we can draw from our model, and whether they match previous results in the psychology literature.
126
+
127
+ # 6.1 TOP WORDS FOR EACH EMOTION
128
+
129
+ We investigated which words were the most relevant for each emotion as follows: we created artificial posts whose text consisted of a single word (each of the most frequent 1,000 words in the whole dataset were tested) accompanied by an image that was the mean image (per channel mean). For each emotion, we report the 10 highest scoring words from these 1,000 artificial posts in Table 3 (words 11-20 for each emotion are in Appendix B).
130
+
131
+ Table 3: Top 10 words for each emotion, ordered by the relative frequency of the emotion being used as a tag on Tumblr
132
+
133
+ <table><tr><td>Emotion Happy</td><td>Top words</td></tr><tr><td>Calm Sad Scared Bored Angry Annoyed Love Excited Surprised Optimistic Amazed Ashamed Disgusted Pensive</td><td>healthy, loving,enjoy, wonderful, warm, happiness,smile, lovely, cute,proud quiet, situation, peace, mood, towards, warm, slowly, stay, sleep, rain horrible,sorry,crying,hurts, tears,cried,lonely,memories,worst, pain terrified, scary, panic, nervous,fear,afraid,horrible,woke,happening,worried asleep, tired,kinda,busy, stuck,constantly, lonely, sat, listening,depression anger, fear, panic,annoying,hate,mad, upset, anxiety, scares,stupid pissed, ashamed, angry, nervous,speak, surprised, tired, worried, ignore, phone soul,dreams,happiness,kiss,sex,beauty,women, feelings,god,relationships tonight, hopefully, watching, nervous, surprised, expect, tomorrow, amazing, hoping, happen birthday, cried, thank, yesterday, told, sorry,amazing, sweet, friend, message positive, expect, surprised, healthy, grow, realize, clearly, hopefully, calm, peace surprised, excited,amazing,woke,realized,awesome, happening,ashamed, yeah, happened totally, honestly, sorry,absolutely, freaking, honest,completely,stupid, seriously,am ashamed, totally,angry,hate,stupid,annoyed,horrible,scares,freaking,absolutely mood,wrote,quiet, view, sadness, thoughts,calm,words,sad,kissed</td></tr></table>
134
+
135
+ An inspection of each of the words suggests that none are out of place, with the possible exception of “ashamed” in the list of Amazed words. (This may be due to the fact that the tag Amazed is sometimes used ironically.) Further, our data-driven approach suggests that our methods could be used as an alternative to the word list-based approaches to sentiment analysis common in psychology. The most widely used tool, Linguistic Inquiry Word Count (LIWC), (Pennebaker et al., 2007), consists of dozens of English words which were compiled by hand into psychologically meaningful categories such as “Health/illness” or “Anxiety” and used in a large number of psychology studies (Tausczik & Pennebaker, 2010). Not only does our approach automatically give sensible word lists, it contains modern words, common in social media usage, like “woke” (first attested in its modern meaning in 1962 according to the Oxford English Dictionary which defines it as “alert to racial or social discrimination and injustice”) and “phone.” Woke appears in the top 10 of “Scared” and “Amazed” and in the top 20 of “Calm” (Appendix B), an interesting finding in its own right. By contrast, both woke and phone appear in LIWC, but not in any of LIWC’s emotion word categories, only in a list of verbs and a list of social words, respectively.
136
+
137
+ # 6.2 CLUSTERING EMOTIONS
138
+
139
+ Psychologists have long studied the structure of emotion, and debated whether there are a small number of “core” emotions (Ekman, 1992), two dominant factors (see Tellegen et al. (1999) for a discussion of various theories), or more complex models (e.g. Lindquist et al. (2013) critiques previous models and argues that emotions do not belong in natural categories or along multiple dimensions, because they are the “constructions” of the human mind, and the result of complex perceptions). Classical attempts by psychologists to answer this question have relied on survey data in which respondents can self-report more than one emotion, followed by clustering or factor analysis approaches. More recently, psychologists have turned to neuroscience to address these questions.
140
+
141
+ While we collected a dataset in which each Tumblr post was labeled with a single emotion tag, we can nevertheless directly address this question using our trained model. Given an image $\mathcal { T }$ and text $\tau$ from our dataset, we can compute the conditional probabilities of the emotion classes: ${ \hat { y } } | \mathcal { T } , \mathcal { T }$ where $\hat { y }$ is a probability vector in the 15-dimensional simplex. To calculate our model’s predicted empirical distribution over $\hat { y }$ we predict $\hat { y }$ for all posts in our dataset: $( \hat { y } _ { i } | \mathcal { T } _ { i } , \mathcal { T } _ { i } ) _ { i = 1 } ^ { n }$ . Finally, we calculate the empirical correlation matrix of ${ \hat { y } } _ { 1 } , \dots , { \hat { y } } _ { n }$ , which we include in the Appendix in Figure 9. For ease of visualization, we convert the correlation matrix to a distance matrix and perform hierarchical clustering as shown in Figure 6.
142
+
143
+ ![](images/924e65d4b83c2df35442ad641abba4834abf1fe3a876de70cdee8cef5b19f97c.jpg)
144
+ Figure 6: Hierarchical clustering of the emotion correlation matrix.
145
+
146
+ Similar to almost all previous psychology studies, there is a clear distinction between emotions that are positive in nature, such as excited, happy, and love and emotions that are negative such as angry, ashamed, annoyed, and disgusted. Another finding consistent with much previous literature, which we investigate more below, is that within both positive and negative emotions, there is a distinction between low arousal emotions and high arousal emotions. Bored and sad (low arousal) are in one cluster, while high arousal emotions—angry, ashamed, annoyed, disgusted—are in another.
147
+
148
+ # 6.3 THE CIRCUMPLEX MODEL OF EMOTION
149
+
150
+ The circumplex model (Posner et al., 2005) posits two dimensions which explain emotions, usually valence (positive vs. negative) and arousal (low vs. high), though other dimensions have been suggested. We investigated whether two factors explained most of the variance in our results using principal component analysis (PCA). As shown in the scree plot in the Appendix in Figure 12, while the first component explains $2 8 . 8 \%$ of the variance, dimensions 2 and 3 explain $1 6 . 4 \%$ and $1 4 . 6 \%$ respectively, evidence against a simple two factor model.
151
+
152
+ ![](images/d731da54e9bae88f2cb211b43257117f278a8340323013b78fca6e4b896532bd.jpg)
153
+
154
+ (a) PCA with a random subset of posts, 150 for each emotion.
155
+
156
+ ![](images/18242f21bc0ce11bf77b4044cc681343fc4ce23a52e4cdc351a2d18fac8e0e1f.jpg)
157
+ Figure 7: Affect/valence
158
+
159
+ We visualize the results of PCA in Figure 7. At left, a random subset of posts, where for visualization purpose we sampled equally from each emotion class, are shown along the first two principal components, and each is colored by the most probable predicted emotion. This shows that within any particular emotion category there is much variation along these two dimensions, i.e. they do not cluster very tightly. Related emotions like happy and love are close together, as they were in the dendrogram.
160
+
161
+ At right, we visualise the projection of the emotion variables onto the first two principal components. Using this figure, we conclude that the first principal component corresponds well to valence, as it neatly separates happy/love from disgusted/ashamed/annoyed. However, the second principal component is not clearly arousal. In the Appendix, we consider the third principal component as well, but the picture is no clearer. Once again, this provides evidence against a simple two factor model of emotion. Below, we further investigate the valence/arousal model.
162
+
163
+ 6.4 VALIDATION ON THE OPEN AFFECTIVE STANDARDIZED IMAGE SET (OASIS)
164
+
165
+ The Open Affective Standardized Image Set (OASIS) dataset (Kurdi et al., 2017) was developed as an alternative to the International Affective Picture System ((Lang, 2005)), a set of emotional stimuli which has been used in many psychology studies. OASIS consists of 900 color images which were rated by human judges on MTurk along the valence and arousal scales discussed above. OASIS images come in classes with labels such as “Alcohol”, “Flowers”, or “Pigeon.” We applied our Deep Sentiment model to these images, treating the single-word label as the input text. After making predictions, we projected them onto the principal components discussed above.
166
+
167
+ In Table 4 we calculated the correlations between the first three principal components from our model and the mean valence and arousal variables from OASIS. The high correlation between the first principal component (PC1) and the valence variable provides evidence, as in the previous section, that PC1 is capturing a dimension of emotion separating positive from negative. It is also interesting to note the low correlation between PC1 and arousal. By contrast, while PC2 and PC3 are correlated with arousal, the correlations are not very high, and they are also correlated with valence. On the one hand, this is more evidence against there being two factors explaining emotions. On the other hand, asking judges to rate a set of images based on arousal and valence is more similar to the standard sentiment analysis task of predicting whether a sentence expresses positive or negative emotion. By contrast, our dataset comes from a set of images which were chosen by users who also decided to select emotion word tags to accompany them. We consider this to thus be a dataset of richer emotional content, and by design it represents a richer set of emotions.
168
+
169
+ Table 4: Correlation between OASIS arousal/valence and principal components
170
+
171
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>OASISvalence</td><td rowspan=1 colspan=1>OASISarousal</td></tr><tr><td rowspan=1 colspan=1>PC1</td><td rowspan=1 colspan=1>58%</td><td rowspan=1 colspan=1>3%</td></tr><tr><td rowspan=1 colspan=1>PC2</td><td rowspan=1 colspan=1>17%</td><td rowspan=1 colspan=1>22%</td></tr><tr><td rowspan=1 colspan=1>PC3</td><td rowspan=1 colspan=1>30%</td><td rowspan=1 colspan=1>11%</td></tr></table>
172
+
173
+ # 7 CONCLUSION
174
+
175
+ We developed a novel multimodal sentiment analysis method using deep learning methods. Our goal was to investigate a core area of psychology, the study of emotion, using a large and novel social media dataset. Our approach provides new tools for the joint study of images and text on social media. This is important as social science researchers have begun to uncover the important role that images play on social media. As our dataset consisted of text, images, and emotion word tags, we considered it to be a form of “self-reported” data, which is the gold standard in emotion. However, it could also be considered to be an unobtrusive behavioral measure, and thus not subject to the biases inherent in laboratory studies. But because the data comes from public social media posts, we cannot rule out various sources of bias. What people choose to post—and not to post—on social media is influenced by how they want to present themselves (Wojnicki & Godes, 2008), so our study is limited insofar as it covers emotion not necessarily as it is truly experienced but rather as it is expressed or performed online.
176
+
177
+ In the future, we will evaluate our model on other image / text stimuli datasets that have been developed for psychological studies and investigate whether human judges are more or less accurate than our model. Finally, we will investigate other psychological components of the structure of emotion, for example daily and day of week trends in emotion.
178
+
179
+ # REFERENCES
180
+
181
+ Yoshua Bengio and Yann LeCun. Scaling learning algorithms towards AI. In Large Scale Kernel Machines. MIT Press, 2007.
182
+ Yoshua Bengio, Rejean Ducharme, and Pascal Vincent. A neural probabilistic language model. Journal of Machine Learning Research, 3:1137–1155, 2003.
183
+ Johan Bollen, Huina Mao, and Xiao-Jun Zeng. Twitter mood predicts the stock market. Journal of Computational Science, 2:1–8, 2011.
184
+ Damian Borth, Tao Chen, Rong-Rong Ji, and Shih-Fu Chang. Sentibank: Large-scale ontology and classifiers for detecting sentiment and emotions in visual content. In ACM, 2013.
185
+ Tao Chen, Hany Salaheldeen, Xiangnan He, Min-Yen Kan, and Dongyuan Lu. Relating an image tweet’s text and images. In AAAI, 2015.
186
+ Paul Ekman. An argument for basic emotions. Cognition & emotion, 6(3-4):169–200, 1992.
187
+ Seth Flaxman and Karim Kassam. On #agony and #ecstasy: Potential and pitfalls of linguistic sentiment analysis. In preparation, 2016.
188
+ Daniel Todd Gilbert. Stumbling On Happiness. A.A. Knopf, New York, 2006.
189
+ Scott A Golder and Michael W Macy. Diurnal and seasonal mood vary with work, sleep, and daylength across diverse cultures. Science, 333(6051):1878–1881, 2011.
190
+ Yunchao Gong, Qifa Ke, Michael Isard, and Svetlana Lazebnik. A multi-view embedding space for modeling internet images, tags, and their semantics. International Journal of Computer Vision, 2014.
191
+ Joshua Goodman. A bit of progress in language modeling. Computer Speech and Language, 15: 403–434, 2001.
192
+
193
+ Matthieu Guillaumin, Jakob Verbeek, and Cordelia Schmid. Multimodal semi-supervised learning for image classification. In CVPR, 2010.
194
+
195
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. In Neural Computation, 1997.
196
+
197
+ Dhiraj Joshi, Ritendra Datta, Elena Fedorovskaya, Quang-Tuan Luong, J.Z. Wang, Jia Li, and Jiebo Luo. Aesthetics and emotions in images. 28:94–115, 2011.
198
+
199
+ Marie Katsurai and Shin’ichi Satoh. Image sentiment analysis using latent correlations among visual, textual, and sentiment views. In ICASSP, 2016.
200
+
201
+ Benedek Kurdi, Shayn Lozano, and Mahzarin R Banaji. Introducing the open affective standardized image set (oasis). Behavior research methods, 49(2):457–470, 2017.
202
+
203
+ Peter J Lang. International affective picture system (iaps): Affective ratings of pictures and instruction manual. Technical report, 2005.
204
+
205
+ Kristen A Lindquist, Erika H Siegel, Karen S Quigley, and Lisa Feldman Barrett. The hundredyear emotion war: are emotions natural kinds or psychological constructions? comment on lench, flores, and bench (2011). 2013.
206
+
207
+ Harry McGurk and John MacDonald. Hearing lips and seeing voices. In Nature, 1976.
208
+
209
+ Tomas Mikolov, Stefan Kombrink, Lukas Burget, Jan Cernocky, and Sanjeev Khudanpur. Extensions of recurrent neural network language model. In International Conference on Acoustics, Speech and Signal Processing (ICASSP), 2011.
210
+
211
+ Daniel Miller and Jolynna Sinanan. Visualising facebook. 2017.
212
+
213
+ Krikamol Muandet, Kenji Fukumizu, Bharath Sriperumbudur, Bernhard Scholkopf, et al. Kernel ¨ mean embedding of distributions: A review and beyond. Foundations and Trends $\textsuperscript { \textregistered }$ in Machine Learning, 10(1-2):1–141, 2017.
214
+
215
+ Alexander Pak and Patrick Paroubek. Twitter as a corpus for sentiment analysis and opinion mining. In LREc, volume 10, 2010.
216
+
217
+ James W. Pennebaker, Roger J. Booth, and Martha E. Francis. Linguistic inquiry and word count: Liwc2007. In Operators manual, 2007.
218
+
219
+ Jeffrey Pennington, Richard Socher, and Christopher D. Manning. Glove: Global vectors for word representation. In Empirical Methods in Natural Language Processing (EMNLP), 2014.
220
+
221
+ Robert Plutchik. The nature of emotions. 89:344, 2001.
222
+
223
+ Jonathan Posner, James A Russell, and Bradley S Peterson. The circumplex model of affect: An integrative approach to affective neuroscience, cognitive development, and psychopathology. Development and psychopathology, 17(3):715–734, 2005.
224
+
225
+ Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. In ICLR, 2016.
226
+
227
+ Sara Rosenthal, Noura Farra, and Preslav Nakov. Semeval-2017 task 4: Sentiment analysis in twitter. In Proceedings of the 11th International Workshop on Semantic Evaluation (SemEval-2017), pp. 502–518, 2017.
228
+
229
+ 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 FeiFei. Imagenet large scale visual recognition challenge. International Journal of Computer Vision (IJCV), 115:211–252, 2015.
230
+
231
+ Limor Shifman. Memes in digital culture. Mit Press, 2014.
232
+
233
+ Ilya Sutskever, Oriol Vinyals, and Quoc V. Le. Sequence to sequence learning with neural networks. In NIPS, 2014.
234
+
235
+ Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. In CVPR, 2015.
236
+
237
+ Yla R Tausczik and James W Pennebaker. The psychological meaning of words: Liwc and computerized text analysis methods. Journal of Language and Social Psychology, 29(1):24–54, 2010.
238
+
239
+ Auke Tellegen, David Watson, and Lee Anna Clark. On the dimensional and hierarchical structure of affect. Psychological Science, 10(4):297–303, 1999.
240
+
241
+ Yilin Wang, Suhang Wang, Jiliang Tang, Huan Liu, and Baoxin Li. Unsupervised sentiment analysis for social media images. In IJCAI, 2015.
242
+
243
+ David Watson and Lee Anna Clark. The panas-x: Manual for the positive and negative affect schedule - expanded form. 1999.
244
+
245
+ Andrea C Wojnicki and David Godes. Word-of-mouth as self-enhancement. 2008.
246
+
247
+ Quanzeng You, Jiebo Luo, Hailin Jin, and Jianchao Yang. Robust image sentiment analysis using progressively trained and domain transferred deep networks. In AAAI, 2015.
248
+
249
+ # A MORE EXAMPLES OF TUMBLR POSTS
250
+
251
+ ![](images/3be71e9c13a9b938b3f17c9fbacdacdba14c20f782673c48cba82826a61b4206.jpg)
252
+
253
+ ![](images/7b2ebb6c643fa85093983473161ca421c97afec4b309fb25e96ccd5485af9ff1.jpg)
254
+ (b) Disgusted: “Me when I see a couple expressing their affection in physical ways in public”
255
+
256
+ ![](images/cb64c199db9e486f75b47e9835ea9310876399db9255dcb06d72ab4a70800ff5.jpg)
257
+ (a) Happy: “Just relax with this amazing view #bigsur #california #roadtrip #usa #life #fitness (at McWay Falls)”
258
+
259
+ ![](images/ae2e9a868b2b2ca7f281006e507b76d1ba612a38c22246ab06c6e480a414f0f8.jpg)
260
+
261
+ (c) Angry: “Tensions were high this Caturday...”
262
+
263
+ (d) Surprised: “Which Tea? Peppermint tea: What is your favorite gif right now?”
264
+
265
+ Figure 8: Tumblr posts
266
+
267
+ B FURTHER RESULTS
268
+
269
+ Table 5: Top 11-20 words for each emotion
270
+
271
+ <table><tr><td>Emotion Happy</td><td>Top words</td></tr><tr><td>Calm Sad Scared Bored Angry Annoyed Love Excited Surprised Optimistic Amazed</td><td>beautiful, beauty, fun, nice, dinner, sweet, good,loves,amazing, comfortable view, sound, cool, continue, visit, push, woke, morning, safe, step cry, sick, hurt, dead,feeling,worse,death,upset, falling, panic kill, happened, cause,asleep,anxiety, worry, hurt, happen, worst, seriously sitting, suddenly, freaking, slowly,annoying, sometimes, gotten, completely, older, cold hurt, face,against, cause,hurts, fucking, fight, pain, strong,worst depressed,lately,conversation,constantly, scared,stupid, scares, bored,heard, extremely sweet, mother, forget, hate, her, song,enjoy, sister, wonderful, dear 2017, positive,am, definitely,awesome,happens, listening, happy, grow, wanna annoyed, negative,apparently,u, minute,asked, sadness, happened, moments, laugh view,yet, believe, tomorrow,trending,said,situation,mood,forward, future im,quite,appreciate, honestly, knew,learned, yang, felt, liked, asleep</td></tr></table>
272
+
273
+ ![](images/b4e43cfc0aa3792084ff8fdb829f547d0b5096d5fce32c8a9626e804caa93b74.jpg)
274
+ Figure 9: Heatmap of the emotion correlation matrix
275
+
276
+ ![](images/6fec305ae9bfa3f884a5285c5cec49e05dc05d79f11d2c23e4b3099491d393b5.jpg)
277
+
278
+ (a) PCA with a random subset of posts, 150 for each emotion
279
+
280
+ ![](images/b3331d098cb894d6a4491e16a8bd123de5d177c57d63f175aeae6cd97f9883f6.jpg)
281
+ Figure 10: PCA on dimension 1 and 3
282
+
283
+ ![](images/efebb27b83fa3fa88e57d8a12063cccd4deda41813e936f8a631975a5f0cc9ce.jpg)
284
+ (a) PCA with a random subset of posts, 150 for each emotion
285
+
286
+ ![](images/1787dde5931c290de4981e76b11550820cf253baeb336c24c0abd12d610e7c0f.jpg)
287
+ Figure 11: PCA for dimension 2 and 3
288
+
289
+ ![](images/f2ec9015543b24b2f86d84da602ed8983a2420a55fdacf6fee80ffb20e03531f.jpg)
290
+ Figure 12: Explained variance of the PCA
291
+
292
+ ![](images/1810a9ce40ea46405cefed677028077e9d1d78004746ef75d5630c2e822496a0.jpg)
293
+ Figure 13: Factor loadings
md/train/Bkepl7cee/Bkepl7cee.md ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PARAMETRIC EXPONENTIAL LINEAR UNIT FOR DEEP CONVOLUTIONAL NEURAL NETWORKS
2
+
3
+ Ludovic Trottier, Philippe Giguere & Brahim Chaib-draa \`
4
+
5
+ Department of Computer Science and Software Engineering
6
+ Laval University, Quebec, Canada
7
+ ludovic.trottier.1@ulaval.ca
8
+ philippe.giguere, brahim.chaib-draa@ift.ulaval.ca
9
+
10
+ # ABSTRACT
11
+
12
+ The activation function is an important component in Convolutional Neural Networks (CNNs). For instance, recent breakthroughs in Deep Learning can be attributed to the Rectified Linear Unit (ReLU). Another recently proposed activation function, the Exponential Linear Unit (ELU), has the supplementary property of reducing bias shift without explicitly centering the values at zero. In this paper, we show that learning a parameterization of ELU improves its performance. We analyzed our proposed Parametric ELU (PELU) in the context of vanishing gradients and provide a gradient-based optimization framework. We conducted several experiments on CIFAR-10/100 and ImageNet with different network architectures, such as NiN, Overfeat, All-CNN and ResNet. Our results show that our PELU has relative error improvements over ELU of $4 . 4 5 \%$ and $5 . 6 8 \%$ on CIFAR-10 and 100, and as much as $7 . 2 8 \%$ with only $0 . 0 0 0 3 \%$ parameter increase on ImageNet. We also observed that $\mathrm { V g g }$ using PELU tended to prefer activations saturating closer to zero, as in ReLU, except at the last layer, which saturated near -2. Finally, other presented results suggest that varying the shape of the activations during training along with the other parameters helps controlling vanishing gradients and bias shift, thus facilitating learning.
13
+
14
+ # 1 INTRODUCTION
15
+
16
+ Over the past few years, Convolutional Neural Networks (CNNs) have become the leading approach in computer vision (Krizhevsky et al., 2012; LeCun et al., 2015; Vinyals et al., 2015; Jaderberg et al., 2015; Ren et al., 2015; Hosang et al., 2016). Through a series of non-linear transformations, CNNs can process high-dimensional input observations into simple low-dimensional concepts. The key principle of CNNs is that features at each layer are composed of features from the layer below. This creates a hierarchical organization of increasingly abstract concepts. Since levels of organization are often seen in complex biological structures, such a hierarchical organization makes CNNs particularly well-adapted for capturing high-level abstractions from real-world observations.
17
+
18
+ The activation function plays a crucial role in learning representative features. Defined as $\operatorname* { m a x } \{ h , 0 \}$ the Rectified Linear Unit (ReLU) is one of the most popular activation function (Nair & Hinton, 2010). It has interesting properties, such as low computational complexity, non-contracting first-order derivative and induces sparse activations, which have been shown to improve performance Krizhevsky et al. (2012). The main drawback of ReLU is its zero derivative for negative arguments. This blocks the back-propagated error signal from the layer above, which may prevent the network from reactivating dead neurons. To overcome this limitation, Leaky ReLU (LReLU) adds a positive slope $a$ to the negative part of ReLU (Maas et al., 2013). Defined as $\operatorname* { m a x } \{ h , 0 \} + a \operatorname* { m i n } \{ h , 0 \}$ , where $a > 0$ LReLU has a non-zero derivative for negative arguments. Unlike ReLU, its parameter $a$ allows a small portion of the back-propagated error signal to pass to the layer below. By using a small enough value $a$ , the network can still output sparse activations while preserving its ability to reactivate dead neurons. In order to avoid specifying by hand the slope parameter $a$ , Parametric ReLU (PReLU) directly learns its value during back-propagation (He et al., 2015b). As the training phase progresses, the network can adjust its weights and biases in conjunction with the slopes $a$ of all its PReLU for potentially learning better features. Indeed, He et al. (2015b) have empirically shown that learning the slope parameter $a$ gives better performance than manually setting it to a pre-defined value.
19
+
20
+ A recently proposed important activation function is the Exponential Linear Unit (ELU). Is is defined as identity for positive arguments and $a ( \exp ( h ) - 1 )$ for negative ones (Clevert et al., 2015). The parameter $a$ can be any positive value, but is usually set to 1. ELU has the interesting property of reducing bias shift, which is defined as the change of a neuron’s mean value due to weight update. If not taken into account, bias shift leads to oscillations and impeded learning (Clevert et al., 2015). Clevert et al. (2015) have shown that either centering the neuron values at zero or using activation functions with negative values can reduce bias shift. Centering the neuron values can be done with the Batch Normalization (BN) method (Ioffe & Szegedy, 2015), while adding negative values can be done with parameterizations such as LReLU or PReLU.
21
+
22
+ Based on the observation that learning a parameterization of ReLU improves performance (He et al., 2015b), we propose the Parametric ELU (PELU) that learns a parameterization of ELU. We define parameters controlling different aspects of the function and propose learning them during back-propagation. Our parameterization preserves differentiability by acting on both the positive and negative parts of the function. Differentiable activation functions usually give better parameter updates during back-propagation (LeCun et al., 2015). PELU also has the same computational complexity as ELU. Since parameters are defined layer-wise instead of per-neurons, the number of added parameters is only $2 L$ , where $L$ is the number of layers. Our experiments on the CIFAR-10/100 and ImageNet datasets have shown that ResNet (Shah et al., 2016), Network in Network (Lin et al., 2013), All-CNN (Springenberg et al., 2015) and Overfeat (Sermanet et al., 2013) with PELU all had better performances than with ELU. We finally show that our PELUs in the CNNs adopt different non-linear behaviors during training, which we believe helps the CNNs learning better features.
23
+
24
+ The rest of the paper is organized as follows. We present related works in section 2 and described our proposed approach in section 3. We detail our experimentations in section 4 and discuss the results in section 5. We conclude the paper in section 6.
25
+
26
+ # 2 RELATED WORK
27
+
28
+ Our proposed PELU activation function is related to other parametric approaches in the literature. The Adaptive Piecewise Linear (APL) unit learns a weighted sum of $S$ parametrized Hinge functions (Agostinelli et al., 2014). One drawback of APL is that the number of points at which the function is non-differentiable increase linearly with $S$ . Moreover, though APL can be either a convex or non-convex function, the rightmost linear function is forced to have unit slope and zero bias. This may be an inappropriate constraint which could affect the representation ability of the CNNs.
29
+
30
+ Another activation function is Maxout, which outputs the maximum over $K$ affine functions for each input neuron (Goodfellow et al., 2013). The main drawback of Maxout is that it multiplies by $K$ the amount of weights to be learned in each layer. For instance, in the context of CNNs, we would apply a max operator over the feature maps of each $K$ convolutional layers. This could become too computationally demanding in cases where the CNNs are very deep. Unlike Maxout, our PELU adds only $2 L$ parameters, where $L$ is the number of layers.
31
+
32
+ Finally, the S-Shaped ReLU (SReLU) imitates the Webner-Fechner law and the Stevens law by learning a combination of three linear functions (Jin et al., 2015). Although this parametric function can be either convex or non-convex, SReLU has two points at which it is non-differentiable. Unlike SReLU, our PELU is fully differentiable, since our parameterization acts on both the positive and negative sides of the function. This in turn improves the back-propagation weight and bias updates.
33
+
34
+ # 3 PARAMETRIC EXPONENTIAL LINEAR UNIT (PELU)
35
+
36
+ In this section, we present our proposed PELU function and analyze it in the context of vanishing gradients. We also elaborate on the gradient descent rules for learning the parameterization.
37
+
38
+ ![](images/a14115a81da84f5d5f9b19b6de167d4ef740e2b936ac8004979f530bd3e4f0b2.jpg)
39
+ Figure 1: Effects of parameters $a , b$ and $c$ : The saturation point decreases when $a$ increases, it saturates faster when $b$ decreases, and the slope of the linear part increases when $c$ increases.
40
+
41
+ # 3.1 DEFINITION
42
+
43
+ The standard Exponential Linear Unit (ELU) is defined as identity for positive arguments and $a ( \exp ( h ) - 1 )$ for negative arguments (Clevert et al., 2015). Although the parameter $a$ can be any positive value, Clevert et al. (2015) proposed using $a = 1$ to have a fully differentiable function. For other values $a \neq 1$ , the function is non-differentiable at $h = 0$ . For this reason, we do not directly learn parameter $a$ during back-propagation. Updating $a$ with the gradient would break differentiability at $h = 0$ , which could imped back-propagation.
44
+
45
+ We start by adding two additional parameters to ELU as follows:
46
+
47
+ $$
48
+ f ( h ) = \left\{ { { c h } \atop { a ( \exp ( { \frac { h } { b } } ) - 1 ) } } \right. \mathrm { ~ i f ~ } h \geq 0 , \quad a , b , c > 0 ,
49
+ $$
50
+
51
+ for which the original ELU can be recovered when $a = b = c = 1$ . As shown in Figure 1, each parameter in (1) controls different aspects of the activation. Parameter $c$ changes the slope of the linear function in the positive quadrant (the larger $c$ , the steeper the slope), parameter $b$ affects the scale of the exponential decay (the larger $b$ , the smaller the decay), while $a$ acts on the saturation point in the negative quadrant (the larger $a$ , the lower the saturation point). We also constrain the parameters to be positive to have a monotonic function. Consequently, reducing the weight magnitude during training always lowers the neuron contribution.
52
+
53
+ Using this parameterization, the network can control its non-linear behavior throughout the course of the training phase. It may increase the slope with $c$ or the decay with $b$ to counter vanishing gradients, and push the mean activation towards zero by lowering the saturation point with $a$ for better managing bias shift. We now look into gradient descent and define update rules for each parameter, so that the network can adjust its behavior as it seems fit. However, a standard gradient update on parameters $a , b , c$ would make the function non-differentiable at $h = 0$ and impair back-propagation. Instead of relying on a projection operator to restore differentiability after each update, we constrain our parameterization by forcing $f$ to stay differentiable at $h = 0$ . We equal the derivatives on both sides of zero, and solve for $c$ :
54
+
55
+ $$
56
+ \left. \frac { \partial c h } { \partial h } \right| _ { h = 0 } = \left. \frac { \partial a ( \exp ( \frac { h } { b } ) - 1 ) } { \partial h } \right| _ { h = 0 }
57
+ $$
58
+
59
+ which gives $\begin{array} { r } { c = \frac { a } { b } } \end{array}$ as solution. Incorporating (2) gives the proposed Parametric ELU (PELU):
60
+
61
+ PELU:
62
+
63
+ $$
64
+ f ( h ) = { \left\{ \begin{array} { l l } { { \frac { a } { b } } h } & { { \mathrm { i f ~ } } h \geq 0 } \\ { a ( \exp ( { \frac { h } { b } } ) - 1 ) } & { { \mathrm { i f ~ } } h < 0 } \end{array} \right. } , \quad a , b > 0
65
+ $$
66
+
67
+ With this parameterization, in addition to changing the saturation point and exponential decay respectively, both $a$ and $b$ adjust the slope of the linear function in the positive part to ensure differentiability at $h = 0$ .
68
+
69
+ # 3.2 ANALYSIS
70
+
71
+ To understand the effect of the proposed parameterization, we now investigate the vanishing gradient for the following simple network, containing one neuron in each of its $L$ layers:
72
+
73
+ $$
74
+ x = h _ { 0 } , \qquad h _ { l } = w _ { l } h _ { l - 1 } , \qquad z _ { l } = f ( h _ { l } ) , \qquad E = \ell ( z _ { L } , y ) \qquad ( 1 \leq l \leq L )
75
+ $$
76
+
77
+ where we have omitted, without loss of generality, the biases for simplicity. In (4), $\ell$ is the loss function between the network prediction $z _ { L }$ and label $y$ , which takes value $E$ at $x$ . In this case, it can be shown using the chain rule of derivation that the derivative of $E$ with respect to any weight $k$ is:
78
+
79
+ $$
80
+ \frac { \partial E } { \partial w _ { k } } = h _ { k - 1 } f ^ { \prime } ( h _ { k } ) \left[ \prod _ { j = k + 1 } ^ { L } f ^ { \prime } ( h _ { j } ) w _ { j } \right] \frac { \partial E } { \partial z _ { L } } ,
81
+ $$
82
+
83
+ where $f ^ { \prime } ( h _ { k } )$ is a shortcut for $\frac { \partial z _ { k } } { \partial h _ { k } }$ . Vanishing gradient happens when the product term inside the bracket has a very small magnitude, which makes $\begin{array} { r } { \frac { \partial E } { \partial w _ { k } } \approx 0 } \end{array}$ . Since the updates are proportional to the gradients, the weights at lower layers converge more slowly than those at higher layers, due to the exponential decrease as $k$ gets smaller (the product has $L - k$ terms). One way the network can fight vanishing gradients is with $f ^ { \prime } ( h _ { j } ) w _ { j } \equiv f ^ { \prime } ( w _ { j } h _ { j - 1 } ) w _ { j } \geq 1$ , so that the magnitude of the product does not tend to zero. Therefore, a natural way to investigate vanishing gradient is by analyzing the interaction between weight $w$ and activation $h$ , after dropping layer index $j$ . Specifically, our goal is to find the range of values $h$ for which $f ^ { \prime } ( w h ) w \geq 1$ . This will indicate how precise the activations $h$ must be to manage vanishing gradients.
84
+
85
+ f , $\begin{array} { r } { w \geq \frac { b } { a } } \end{array}$ and engt $h < 0 ,$ , then valu $\begin{array} { r } { w ^ { * } = \exp ( 1 ) \frac { b } { a } } \end{array}$ aximizes the interval length of h for which. $f ^ { \prime } ( w h ) w \geq 1$ $l ^ { * } = a \exp ( - 1 )$
86
+
87
+ Proof. With our proposed PELU, we have:
88
+
89
+ $$
90
+ f ^ { \prime } ( w h ) w = \left\{ { \begin{array} { l l } { w { \frac { a } { b } } } & { { \mathrm { i f ~ } } h \geq 0 } \\ { w { \frac { a } { b } } \exp ( w h / b ) } & { { \mathrm { i f ~ } } h < 0 } \end{array} } , \quad a , b > 0 \right.
91
+ $$
92
+
93
+ Assuming $\begin{array} { r } { w \geq \frac { b } { a } } \end{array}$ and $h < 0$ , and using the fact that $\begin{array} { r } { w _ { b } ^ { a } \exp ( w h / b ) } \end{array}$ is monotonically increasing, the interval length $l ( w )$ of values $h$ for which $\begin{array} { r } { w { \frac { a } { b } } \exp ( w \bar { h } / b ) \geq 1 } \end{array}$ is given by the magnitude of the zero of $\begin{array} { r } { w { \frac { a } { b } } \exp ( w h / b ) - 1 } \end{array}$ . Solving the derivative equals zero for $h$ gives $\begin{array} { r } { l ( w ) = | \log ( \frac { b } { a } \frac { 1 } { w } ) | ( \frac { b } { w } ) } \end{array}$ . Using the fact that $\begin{array} { r } { w \geq \frac { b } { a } } \end{array}$ , it can be shown that $l ( w )$ is pseudo-concave, so it has a unique optimum. Maximizing $l ( w )$ with respect to $w$ is thus the solution of solving the derivative equals zero, which gives $l ^ { * } = a \exp ( - 1 )$ , at $\begin{array} { r } { w ^ { * } = \exp ( 1 ) \frac { b } { a } } \end{array}$ . □
94
+
95
+ This result shows that in the optimal scenario where $\begin{array} { r } { w = \exp ( 1 ) \frac { b } { a } } \end{array}$ , the length of negative values $h$ for which $f ^ { \prime } ( w h ) w \geq 1$ is no more than $a \exp ( - 1 )$ . Without our proposed parameterization $( a , b = 1 )$ ), dealing with vanishing gradient is mostly possible with positive arguments, which makes the negative ones (useful for bias shift) hurtful for back-propagation. With the proposed parameterization, $a$ can be adjusted to increase the length $a \exp ( - 1 )$ and allow more negative activations $h$ to counter vanishing gradients. The ratio $\textstyle { \frac { b } { a } }$ can also be modified to ensure $\begin{array} { r } { w \geq \frac { b } { a } } \end{array}$ so that $f ^ { \prime } ( w h ) w \ge 1$ for $h > 0$ . Based on this analysis, the proposed parameterization gives more flexibility to the network, and the experiments in Section 4 have shown that the networks do indeed take advantage of it.
96
+
97
+ # 3.3 OPTIMIZATION
98
+
99
+ PELU is trained simultaneously with all the network parameters during back-propagation. Using the chain rule of derivation, the derivative of objective $E$ with respect to $a$ and $b$ for one layer is:
100
+
101
+ $$
102
+ \frac { \partial E } { \partial a } = \sum _ { i } \frac { \partial E } { \partial f ( h _ { i } ) } \frac { \partial f ( h _ { i } ) } { \partial a } , \qquad \frac { \partial E } { \partial b } = \sum _ { i } \frac { \partial E } { \partial f ( h _ { i } ) } \frac { \partial f ( h _ { i } ) } { \partial b } ,
103
+ $$
104
+
105
+ where $i$ sums over all elements of the tensor on which $f$ is applied. The terms $\frac { \partial E } { \partial f ( h _ { i } ) }$ are the gradients propagated from the above layers, while $\frac { \partial f ( h ) } { \partial a }$ and $\frac { \partial f ( h ) } { \partial b }$ are the gradients of $f$ with respect to $a , b$ :
106
+
107
+ $$
108
+ \frac { \partial f ( h ) } { \partial a } = \left\{ \begin{array} { l l } { \frac { h } { b } } & { \mathrm { i f ~ } h \geq 0 } \\ { \exp ( h / b ) - 1 } & { \mathrm { i f ~ } h < 0 } \end{array} , \right. \qquad \frac { \partial f ( h ) } { \partial b } = \left\{ \begin{array} { l l } { - \frac { a h } { b ^ { 2 } } } & { \mathrm { i f ~ } h \geq 0 } \\ { - \frac { a } { b ^ { 2 } } \exp ( h / b ) } & { \mathrm { i f ~ } h < 0 } \end{array} \right. .
109
+ $$
110
+
111
+ To preserve the parameter positivity after the updates, we force them to always be greater than 0.1. The update rules are the following:
112
+
113
+ $$
114
+ \begin{array} { c c } { { \Delta a \mu \Delta a - \alpha \displaystyle \frac { \partial E } { \partial a } } } & { { \quad \quad \quad \Delta b \mu \Delta b - \alpha \displaystyle \frac { \partial E } { \partial b } } } \\ { { a \operatorname* { m a x } \{ a + \Delta a , 0 . 1 \} } } & { { \quad \quad \quad b \operatorname* { m a x } \{ b + \Delta b , 0 . 1 \} } } \end{array}
115
+ $$
116
+
117
+ Table 1: Comparing PELU, ELU and ReLU with SmallNet and ResNet110 on the CIFAR-10 and CIFAR-100 tasks. The results are test error rates (in $\%$ ) averaged over five tries.
118
+
119
+ <table><tr><td rowspan="2"></td><td colspan="2">SmallNet</td><td rowspan="2"></td><td colspan="2">ResNet110</td></tr><tr><td>CIFAR-10</td><td>CIFAR-100</td><td>CIFAR-10</td><td>CIFAR-100</td></tr><tr><td>ReLU</td><td>13.96</td><td>40.51</td><td>ReLU (He et al., 2015a)</td><td>6.42</td><td>27.23</td></tr><tr><td>ELU</td><td>14.81</td><td>39.76</td><td>ELU (Shah et al., 2016)</td><td>5.62</td><td>26.55</td></tr><tr><td>PELU</td><td>13.54</td><td>38.93</td><td>PELU (ours)</td><td>5.37</td><td>25.04</td></tr></table>
120
+
121
+ In (8), $\mu$ is the momentum and $\alpha$ is the learning rate. When specified by the training regimes, we also use a $\ell _ { 2 }$ weight decay regularization on both the weight matrices $W$ and PELU parameters. This is different than PReLU, which did not use weight decay to avoid a shape bias towards ReLU. In our case, weight decay is necessary for $a$ and $b$ , otherwise the network could circumvent it for the W s by adjusting $a$ or $b$ , a behavior that would be hurtful for training.
122
+
123
+ # 4 EXPERIMENTATIONS
124
+
125
+ In this section, we present our experiments in supervised learning on the CIFAR-10/100 and ImageNet tasks. Our goal is to show that, with the same network architecture, parameterizing ELU improves the performance. We also provide results with the ReLU activation function for reference.
126
+
127
+ # 4.1 CIFAR-10/100
128
+
129
+ As first experiment, we performed object classification on the CIFAR-10 and CIFAR-100 datasets $( 6 0 , 0 0 0 3 2 \mathrm { x } 3 2$ colored images, 10 and 100 classes respectively) (Krizhevsky et al., 2012). We trained a residual network (ResNet) with the identity function for the skip connexion and bottleneck residual mappings with shape $( \mathrm { C o n v + A C T } ) \mathrm { x } 2 + \mathrm { C o n v + B N }$ (He et al., 2015a; Shah et al., 2016). The ACT module is either PELU, ELU or $_ { \mathrm { B N + R e L U } }$ . We follow Facebook’s Torch implementation fb.resnet.torch1 for data augmentation and learning rate schedule, so that training is not biased towards PELU to the detriment of the other activations.
130
+
131
+ We also evaluated our proposed PELU on a smaller convolutional network. We refer to this network as SmallNet. It contains three convolutional layers followed by two fully connected layers. The convolutional layers were respectively composed of 32, 64 and $1 2 8 3 \mathrm { x } 3 $ filters with 1x1 stride and 1x1 zero padding, each followed by ACT, $2 \mathbf { x } 2$ max pooling with a stride of $2 \mathbf { x } 2$ and dropout with probability 0.2. The fully connected layers were defined as $2 0 4 8 5 1 2$ , followed by ACT, dropout with probability 0.5, and a final linear layer $5 1 2 1 0$ for CIFAR-10 and $5 1 2 1 0 0$ for CIFAR-100. We performed global pixel-wise mean subtraction, and used horizontal flip as data augmentation.
132
+
133
+ Table 1 presents the test error results $( \mathrm { i n } \% )$ ) of SmallNet and ResNet110 on both tasks, with ELU, ReLU and PELU. For SmallNet, PELU reduced the error of ELU from $1 4 . 8 1 \%$ to $1 3 . 5 4 \%$ on CIFAR10, and from $3 9 . 7 6 \%$ to $3 8 . 9 3 \%$ on CIFAR-100, which corresponds to a relative improvement of $8 . 5 8 \%$ and $2 . 0 9 \%$ respectively. As for ResNet110, PELU reduced the error of ELU from $5 . 6 2 \%$ to $5 . 3 7 \%$ on CIFAR-10, and from $2 6 . 5 5 \%$ to $2 5 . 0 4 \%$ on CIFAR-100, which corresponds to a relative improvement of $4 . 4 5 \%$ and $5 . 6 8 \%$ respectively. These results suggest that parameterizing the ELU activation improves its performance.
134
+
135
+ It is worth noting for ResNet110 that weight decay played an important role in obtaining these performances. Preliminary experiments conducted with a weight decay of 0.0001 showed no significant improvements of PELU over ELU. We observed larger differences between the train and test set error percentages, which indicated possible over-fitting. By increasing the weight decay to 0.001, we obtained the performance improvements shown in Table 1. Importantly, we did not have to increase the weight decay for SmallNet. The PELU, ELU and BN+ReLU SmallNets used the same decay. Although these results suggest that residual networks with PELU activations may be more prone to over-fitting, weight decay can still be used to correctly regularize the ResNets.
136
+
137
+ ![](images/341f5320b118dfaba0ce41ed9adfdf23aa059fa3da81107b317a2f04d66ac8bf.jpg)
138
+ Figure 2: TOP-1 error rate progression $( \mathrm { i n } \% )$ ) of ResNet18, NiN, Overfeat and All-CNN on ImageNet 2012 validation set. NiN and ResNet18 (top row) used training regime #1, while All-CNN and Overfeat (bottom row) used training regime $\# 2$ (see Table 2). PELU has the lowest error rates for all networks. Regime #1 shows a greater performance gap between ELU and PELU than regime #2.
139
+
140
+ # 4.2 IMAGENET
141
+
142
+ We finally tested the proposed PELU on ImageNet 2012 task (ILSVRC2012) using four different network architectures: ResNet18 (Shah et al., 2016), Network in Network (NiN) (Lin et al., 2013), All-CNN (Springenberg et al., 2015) and Overfeat (Sermanet et al., 2013). We used either PELU, ELU or BN+ReLU for the activation module. Due to NiN’s relatively complex architecture, we added BN after each max pooling layer (every three layers) for further reducing vanishing gradients. Each network was trained following Chintala’s Torch implementation imagenet-multiGPU.torch 2 with the training regimes shown in Table 2. Regime #1 starts at a higher learning rate (1e-1) than regime #2 (1e-2), and has a larger learning rate decay of 10 compared to 2 and 5.
143
+
144
+ Figure 2 presents the TOP-1 error rate $( \mathrm { i n } \ \% )$ ) of all four networks on ImageNet 2012 validation dataset. We see from these figures that PELU consistently obtained the lowest error rates for all networks. The best result was obtained with NiN. In this case, PELU improved the error rate from $4 0 . 4 0 \%$ (ELU) to $3 6 . 0 6 \%$ , which corresponds to a relative improvement of $7 . 2 9 \%$ . Importantly, NiN obtained these improvements at little computational cost. It only added 24 additional parameters, i.e. $0 . 0 0 0 3 \%$ increase in the number of parameters. This suggests that PELU acts on the network in a different manner than the weights and biases. Such a low number of parameters cannot significantly increase the expressive power of the network. We would not have seen such a large improvement by adding 24 additional weights to a convolutional layer with the ELU activation.
145
+
146
+ Table 2: ImageNet training regimes.
147
+
148
+ <table><tr><td rowspan="2"></td><td colspan="4">Regime #1 (ResNet18, NiN)</td><td colspan="5">Regime #2 (Overfeat, AlICNN)</td></tr><tr><td>1</td><td>10</td><td>20</td><td>25</td><td>1</td><td>19</td><td>30</td><td>44</td><td>53</td></tr><tr><td>Epoch Learning Rate</td><td>1e-1</td><td>1e-2</td><td>1e-3</td><td>1e-4</td><td>1e-2</td><td>5e-3</td><td>1e-3</td><td>5e-4</td><td>1e-4</td></tr><tr><td>Weight Decay</td><td>5e-4</td><td>5e-4</td><td>0</td><td>0</td><td>5e-4</td><td>5e-4</td><td>0</td><td>0</td><td>0</td></tr></table>
149
+
150
+ Table 3: Effect of parameter configuration using ResNets on CIFAR-10 and CIFAR-100 datasets. These results show that parameter type $( a , \textstyle { \frac { 1 } { b } } )$ achieves the lowest error rate (in $\%$ ) in general.
151
+
152
+ <table><tr><td colspan="3">CIFAR-10</td></tr><tr><td rowspan="2">Depth</td><td colspan="2">Parameter Type</td></tr><tr><td>(a,b) (a,) (,6)</td><td>()</td></tr><tr><td>20</td><td>7.71 7.47</td><td>7.64 7.61</td></tr><tr><td>32</td><td>6.71 6.41</td><td>6.69 6.53</td></tr><tr><td>44</td><td>6.52 5.92</td><td>6.51 6.19</td></tr><tr><td>56</td><td>6.28 5.65</td><td>6.30 5.75</td></tr><tr><td>110</td><td>6.22 5.37</td><td>6.09 5.42</td></tr></table>
153
+
154
+ <table><tr><td colspan="3">CIFAR-100</td></tr><tr><td rowspan="2">Depth</td><td colspan="3">Parameter Type</td></tr><tr><td>(a,b) (a,)</td><td>(1,6) ()</td></tr><tr><td>20</td><td>30.17</td><td>30.16 30.26</td><td>30.55</td></tr><tr><td>32</td><td>28.47</td><td>28.01 28.23</td><td>28.56</td></tr><tr><td>44</td><td>27.70</td><td>27.18 27.24</td><td>27.63</td></tr><tr><td>56</td><td>26.89</td><td>26.33 26.72</td><td>26.40</td></tr><tr><td>110</td><td>25.69</td><td>25.04 25.59</td><td>25.17</td></tr></table>
155
+
156
+ We see from the curves in Figure 2 that the training regime has an interesting effect on the convergence of the networks. The performance of PELU is closer to the performance of ELU for regime #2, while it is significantly better than ELU for regime #2. Although we do not have a clear explanation to why this is the case, we believe that the small initial learning rate of regime #2 affects PELU optimization due to smaller gradient steps. We also see that the error rates of All-CNN and Overfeat with PELU increase by a small amount starting at epoch 44. Since ELU and ReLU do not have this error rate increase, this shows possible over-fitting for PELU. For regime #2, the error rates decrease more steadily and monotonically. Although performing more experiments would improve our understanding, these results suggest that PELU could and should be trained with larger learning rates and decays for obtaining better performance improvements.
157
+
158
+ # 5 DISCUSSION
159
+
160
+ In this section, we elaborate on other parameter configurations and perform a visual evaluation of the parameter progression throughout the training phase.
161
+
162
+ # 5.1 PARAMETER CONFIGURATION
163
+
164
+ The proposed PELU activation function (3) has two parameters $a$ and $b$ , where $a$ is used with a multiplication and $b$ with a division. A priori, any of the four configurations $( a , b ) , ( a , \textstyle { \frac { 1 } { b } } ) , ( \textstyle { \frac { 1 } { a } } , b )$ or $\textstyle { \left( { \frac { 1 } { a } } , { \frac { 1 } { b } } \right) }$ could be used as parameterization. In this section, we show experimentally that PELU with the proposed $( a , \textstyle { \frac { 1 } { b } } )$ configuration is the preferred choice, as it achieves the best overall results.
165
+
166
+ For evaluating the effect of parameter configuration, we trained several CNNs on the CIFAR-10 and CIFAR-100 datasets (Krizhevsky et al., 2012). We used ResNets with a depth varying from 20, 32, 44, 56 to 110. The ResNets had the identity function for the skip connexion and two different residual mappings (He et al., 2015a; Shah et al., 2016). We used a basic block $\mathrm { C o n v + P E L U + C o n v + B N }$ block for depth 20, 32 and 44, and bottleneck block $\mathrm { ( C o n v + P E L U ) } \mathrm { x } 2 + \mathrm { C o n v + B N }$ for depth 56 and 110. We report the averaged error rate achieved over five tries.
167
+
168
+ First, we can see from the results presented in Figure 3 that the error rate reduces as the network gets deeper. This is in conformity with our intuition that deeper networks have more representative capability. Also, we can see that the proposed configuration $( a , \textstyle { \frac { 1 } { b } } )$ obtained the best performance overall. Configuration $( a , \textstyle { \frac { 1 } { b } } )$ obtained $5 . 3 7 \%$ error rate on CIFAR-10 and $2 5 . 0 4 \%$ error rate on CIFAR-100. We believe this improvement is due to weight decay. When using configuration $( a , \textstyle { \frac { 1 } { b } } )$ along with weight decay, pushing parameters $a$ and $b$ towards zero encourages PELU to be similar to ReLU. In this case, the CNN is less penalized for using ReLU and more penalized for using other parametric forms. This may help the CNN to use as much PELUs that look like ReLUs as it needs without incurring a large penalty. The experiments in section 5.2 partly supports our claim. Although the performance improvement of $( a , \textstyle { \frac { 1 } { b } } )$ is relatively small in comparison to the other three configurations, configuration $( a , \textstyle { \frac { 1 } { b } } )$ should be preferred for subsequent experiments.
169
+
170
+ ![](images/76b5821bc57ffe045d22b800f5d58e395a3da157cdd7f77b58096bb6922f6044.jpg)
171
+ Figure 3: PELU parameter progression at layers 2, 7, 10 and 14 of $\mathrm { v g g }$ trained on CIFAR-10. Interestingly, the network adopted different non-linear behaviors throughout the training phase.
172
+
173
+ # 5.2 PARAMETER PROGRESSION
174
+
175
+ We perform a visual evaluation of the non-linear behaviors adopted by a $\mathrm { v g g }$ network during training (Simonyan & Zisserman, 2014). To this effect, we trained a $\mathrm { v g g }$ network with PELU activations on the CIFAR-10 dataset. We performed global pixel-wise mean subtraction, and used horizontal flip as data augmentation. The trained network obtained $6 . 9 5 \%$ and $2 9 . 2 9 \%$ error rate on CIFAR-10 and CIFAR-100 respectively.
176
+
177
+ Figure 3 shows the progression of the slope $\textstyle { \left( { \frac { a } { b } } \right) }$ and the negative of the saturation point (parameter $a$ ) for PELU at layers 2, 7, 10 and 14. We can see different behaviors. In layer 2, the slope quickly increases to a large value (around 6) and slowly decreases to its convergence value. We observe a similar behavior for layer 7, except that the slope increases at a later iteration. Layer 2 increases at about iteration 650 while layer 7 at about iteration 1300. Moreover, in contrast to layer 2 and 7, the slope in layer 10 increases to a smaller value (around 2) and does not decrease after reaching it. Layer 14 also displays a similar behavior, but reaches a much higher value (around 15). We believe that adopting these behaviors helps early during training to disentangle redundant neurons. Since peak activations scatter the inputs more than flat ones, spreading neurons at the lower layers may allow the network to unclutter neurons activating similarly. This may help the higher layers to more easily find relevant features in the data.
178
+
179
+ The saturation point in layer 2, 7 and 10 converges in the same way to a value near zero, while in layer 14 it reaches a value near -2. This is an interesting behavior as using a negative saturation reduces bias shift. In another experiment with $\mathrm { V g g }$ , we tried adding BN at different locations in the network. We saw similar convergence behaviors for the saturation point. It seems that, it this specific case, the network could counter bias shift with only the last layer, and favored sparse activations in the other layers. These results suggest that the network takes advantage of the parameterization by using different non-linear behaviors at different layers.
180
+
181
+ # 6 CONCLUSION
182
+
183
+ The activation function is a key element in Convolutional Neural Networks (CNNs). In this paper, we proposed learning a parameterization of the Exponential Linear Unit (ELU) function. Our analysis of our proposed Parametric ELU (PELU) suggests that CNNs with PELU may have more control over bias shift and vanishing gradients. We performed several supervised learning experiments and showed that networks trained with PELU consistently improved their performance over ELU. Our results suggest that the CNNs take advantage of the added flexibility provided by learning the proper activation shape. As training progresses, we have observed that the CNNs change the parametric form of their PELU both across the layers and across the epochs. In terms of possible implications of our results, parameterizing other activation functions could be worth investigating. Functions like Softplus, Sigmoid or Tanh may prove to be successful in some cases with proper parameterizations. Other interesting avenues for future work include applying PELU to other network architectures, such as recurrent neural networks, and to other tasks, such as object detection
184
+
185
+ # ACKNOWLEDGEMENTS
186
+
187
+ We thankfully acknowledge the support of NVIDIA Corporation for providing the Tesla K80 and K20 GPUs for our experiments.
188
+
189
+ # REFERENCES
190
+
191
+ Forest Agostinelli, Matthew Hoffman, Peter Sadowski, and Pierre Baldi. Learning activation functions to improve deep neural networks. arXiv preprint arXiv:1412.6830, 2014.
192
+ Djork-Arne Clevert, Thomas Unterthiner, and Sepp Hochreiter. Fast and accurate deep network learning by ´ exponential linear units (elus). arXiv preprint arXiv:1511.07289, 2015.
193
+ Ian Goodfellow, David Warde-Farley, Mehdi Mirza, Aaron Courville, and Yoshua Bengio. Maxout networks. In ICML, pp. 1319–1327, 2013.
194
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. arXiv preprint arXiv:1512.03385, 2015a.
195
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In ICCV, pp. 1026–1034, 2015b.
196
+ Jan Hosang, Rodrigo Benenson, Piotr Dollar, and Bernt Schiele. What makes for effective detection proposals? ´ PAMI, 38(4):814–830, 2016.
197
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In ICML, pp. 448–456, 2015.
198
+ Max Jaderberg, Karen Simonyan, Andrew Zisserman, et al. Spatial transformer networks. In NIPS, pp. 2017–2025, 2015.
199
+ Xiaojie Jin, Chunyan Xu, Jiashi Feng, Yunchao Wei, Junjun Xiong, and Shuicheng Yan. Deep learning with s-shaped rectified linear activation units. arXiv preprint arXiv:1512.07030, 2015.
200
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey Hinton. Imagenet classification with deep convolutional neural networks. In NIPS, pp. 1097–1105, 2012.
201
+ Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep learning. Nature, 521(7553):436–444, 2015.
202
+ Min Lin, Qiang Chen, and Shuicheng Yan. Network in network. arXiv preprint arXiv:1312.4400, 2013.
203
+ Andrew L Maas, Awni Y Hannun, and Andrew Y Ng. Rectifier nonlinearities improve neural network acoustic models. In ICML Workshop on Deep Learning for Audio, Speech and Language Processing. Citeseer, 2013.
204
+ Vinod Nair and Geoffrey Hinton. Rectified linear units improve restricted boltzmann machines. In ICML, pp. 807–814, 2010.
205
+ Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster r-cnn: Towards real-time object detection with region proposal networks. In NIPS, pp. 91–99, 2015.
206
+ Pierre Sermanet, David Eigen, Xiang Zhang, Michael Mathieu, Rob Fergus, and Yann LeCun. Overfeat: Inte- ¨ grated recognition, localization and detection using convolutional networks. arXiv preprint arXiv:1312.6229, 2013.
207
+ Anish Shah, Eashan Kadam, Hena Shah, and Sameer Shinde. Deep residual networks with exponential linear unit. arXiv preprint arXiv:1604.04112, 2016.
208
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
209
+ J Springenberg, Alexey Dosovitskiy, Thomas Brox, and M Riedmiller. Striving for simplicity: The all convolutional net. In ICLR (workshop track), 2015.
210
+ Oriol Vinyals, Alexander Toshev, Samy Bengio, and Dumitru Erhan. Show and tell: A neural image caption generator. In CVPR, pp. 3156–3164, 2015.
md/train/BkgStySKPB/BkgStySKPB.md ADDED
@@ -0,0 +1,480 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CONTRASTIVE MULTIVIEW CODING
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Humans view the world through many sensory channels, e.g., the long-wavelength light channel, viewed by the left eye, or the high-frequency vibrations channel, heard by the right ear. Each view is noisy and incomplete, but important factors, such as physics, geometry, and semantics, tend to be shared between all views (e.g., a “dog” can be seen, heard, and felt). We hypothesize that a powerful representation is one that models view-invariant factors. Based on this hypothesis, we investigate a contrastive coding scheme, in which a representation is learned that aims to maximize mutual information between different views but is otherwise compact. Our approach scales to any number of views, and is view-agnostic. The resulting learned representations perform above the state of the art for downstream tasks such as object classification, compared to formulations based on predictive learning or single view reconstruction, and improve as more views are added. On the Imagenet linear readoff benchmark, we achieve $6 8 . 4 \%$ top-1 accuracy.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ A foundational idea in coding theory is to learn compressed representations that nonetheless can be used to reconstruct the raw data. This idea shows up in contemporary representation learning in the form of autoencoders (Salakhutdinov & Hinton, 2009) and generative models (Kingma & Welling, 2013; Goodfellow et al., 2014), which try to represent a data point or distribution as losslessly as possible. Yet lossless representation might not be what we really want, and indeed it is trivial to achieve – the raw data itself is a lossless representation. What we might instead prefer is to keep the “good” information (signal) and throw away the rest (noise). How can we identify what information is signal and what is noise?
12
+
13
+ To an autoencoder, or a max likelihood generative model, a bit is a bit. No one bit is better than any other. Our conjecture in this paper is that some bits are in fact better than others. Some bits code important properties like semantics, physics, and geometry, while others code attributes that we might consider less important, like incidental lighting conditions or thermal noise in a camera’s sensor.
14
+
15
+ We hypothesize that the good bits are the ones that are shared between multiple views of the world, for example between multiple sensory modalities like vision, sound, and touch. Under this perspective “presence of dog” is good information, since dogs can be seen, heard, and felt, but “camera pose” is bad information, since a camera’s pose has little or no effect on the acoustic and tactile properties of the imaged scene. There is significant evidence in the cognitive science and neuroscience literature that such cross-view representations are encoded by the brain (e.g., Smith & Gasser (2005); Den Ouden et al. (2012); Hohwy (2013)).
16
+
17
+ Our goal is therefore to learn representations that capture information shared between multiple sensory views but that are otherwise compact (i.e. throw away the bad information). To do so, we employ contrastive learning, where we learn a feature embedding such that views of the same scene map to nearby points while views of different scenes map to far apart points. In particular, we adapt the recently proposed method of Contrastive Predictive Coding (CPC) (Oord et al., 2018), except we simplify it – removing the recurrent network – and generalize it – showing how to apply it to arbitrary collections of views, rather than just to temporal predictions. In reference to CPC, we term our method Contrastive Multiview Coding (CMC). The contrastive objective in our formulation, as in CPC, can be understood as attempting to maximize the mutual information between the representations of each view.
18
+
19
+ We intentionally leave “good bits” only loosely defined and treat its definition as an empirical question. Ultimately, the proof is in the pudding: we consider a representation to be good if it makes subsequent problem solving easy, on tasks of human interest. For example, a useful representation of images might be a feature space in which it is easy to learn to recognize objects. We therefore evaluate our method by testing if the learned representations transfer well to standard semantic recognition tasks. On several benchmark tasks, our method achieves state of the art results, compared to other methods for self-supervised representation learning. We additionally find that the quality of the representation improves as a function of the number of views used for training. Finally, we compare the contrastive formulation of multiview learning to the recently popular approach of cross-view prediction, and find that in head-to-head comparisons, the contrastive approach learns stronger representations.
20
+
21
+ ![](images/c430fa54720a0c32bf2c04806ac9ce4c491210a4bc635d3e46b2ed3e0c8a09af.jpg)
22
+ Figure 1: (a) Given a pair of sensory views, a deep representation is learnt by bringing views of the same scene together in embedding space, while pushing views of different scenes apart. Here we show an example of learning from the luminance channel (L) of an image and the ab-color channel. The strawberry’s L and ab channels embed to nearby points whereas the ab channel of a different image (a photo of blueberries) embeds to a far away point. (b) Example of a 4-view dataset (NYU RGBD (Nathan Silberman & Fergus, 2012)) and its learned representation. Dotted lines represent the contrastive objective. The encodings for each view may be concatenated to form the full representation of a scene.
23
+
24
+ The core ideas that we build on: contrastive learning, mutual information maximization, and deep representation learning, are not new and have been explored in the literature on representation and multiview learning (Li et al., 2018; Xu et al., 2013; Arora et al., 2019). Our main contribution is to set up a framework to extend these ideas to any number of views, and to empirically study the factors that lead to success in this framework. A review of the related literature is given at the end of the paper, in Section 4. Fig. 1 gives a pictorial overview of our framework for the different learning tasks we consider in this paper, to learn representations across datasets with different sets of views. Our main contributions are:
25
+
26
+ • We apply contrastive learning to the multiview setting, attemping to maximize mutual information between representations of different views of the same scene (e.g., between different image channels, or different modalities). Our approach yields representations that outperform the state-of-the-art in self-supervised learning in head-to-head comparisons. For example, in the ImageNet linear readoff evaluation, we achieve $6 8 . 4 \%$ top-1 accuracy, which is slightly above the state of the art concurrent work Bachman et al. (2019). We show that the contrastive objective is superior to cross-view prediction.
27
+ We extend the framework to learn from more than two views, and show that the quality of the learned representation improves as number of views increase.
28
+ We conduct controlled experiments to measure the effect of mutual information on representation quality.
29
+
30
+ # 2 METHOD
31
+
32
+ Our goal is to learn representations that capture information shared between multiple sensory views without human supervision. We start by reviewing previous predictive learning (or reconstructionbased learning) methods, and then elaborate on contrastive learning within two views. We show connections to mutual information maximization and extend it to scenarios including more than two views. We consider a collection of $M$ views of the data, denoted as $V _ { 1 } , \dots , V _ { M }$ . For each view $V _ { i }$ , we denote $v _ { i }$ as a random variable representing samples following $v _ { i } \sim \mathcal { P } ( V _ { i } )$ .
33
+
34
+ ![](images/1d71ecefe136cc8c5d7f183a04b4b7c426f446671d4ab5f674cf5f0b00898d49.jpg)
35
+ Figure 2: Predictive Learning vs Contrastive Learning. Cross-view prediction (Top) learns latent representations that predict one view from another, with loss measured in the output space. Common prediction losses, such as the $\mathcal { L } _ { 1 }$ and $\mathcal { L } _ { 2 }$ norms, are unstructured, in the sense that they penalize each output dimension independently, perhaps leading to representations that do not capture all the shared information between the views. In contrastive learning (Bottom), representations are learnt by contrasting congruent and incongruent views, with loss measured in representation space. The red dotted outlines show where the loss function is applied.
36
+
37
+ # 2.1 PREDICTIVE LEARNING
38
+
39
+ Let $V _ { 1 }$ and $V _ { 2 }$ represent two views of a dataset. For instance, $V _ { 1 }$ might be the luminance of a particular image and $V _ { 2 }$ the chrominance. We define the predictive learning setup as a deep nonlinear transformation from $v _ { 1 }$ to $v _ { 2 }$ through latent variables $z$ , as shown in Fig. 2. Formally, $z = f ( v _ { 1 } )$ and $\hat { v _ { 2 } } = g ( z )$ , where $f$ and $g$ represent the encoder and decoder respectively and $\hat { v _ { 2 } }$ is the prediction of $v _ { 2 }$ given $v _ { 1 }$ . The parameters of the encoder and decoder models are then trained using an objective function that tries to bring $\hat { v _ { 2 } }$ “close to” $v _ { 2 }$ . Simple examples of such an objective include the $\mathcal { L } _ { 1 }$ or $\mathcal { L } _ { 2 }$ loss functions. Note that these objectives assume independence between each pixel or element of $v _ { 2 }$ given $v _ { 1 }$ , i.e., $p ( v _ { 2 } | v _ { 1 } ) = \Pi _ { i } p ( \bar { v } _ { 2 i } | v _ { 1 } )$ , thereby reducing their ability to model correlations or complex structure. The predictive approach has been extensively used in representation learning, for example, colorization (Zhang et al., 2016; 2017) and predicting sound from vision (Owens et al., 2016).
40
+
41
+ # 2.2 CONTRASTIVE LEARNING WITH TWO VIEWS
42
+
43
+ The idea behind contrastive learning is to learn an embedding that separates (contrasts) samples from two different distributions. Given a dataset of $V _ { 1 }$ and $V _ { 2 }$ that consists of a collection of samples $\{ v _ { 1 } ^ { i } , v _ { 2 } ^ { i } \} _ { i = 1 } ^ { N }$ , we consider contrasting congruent and incongruent pairs, i.e. samples from the joint distribution $x \sim p ( v _ { 1 } , v _ { 2 } )$ or $x = \{ v _ { 1 } ^ { \overline { { i } } } , v _ { 2 } ^ { i } \}$ , which we call positives, versus samples from the product of marginals, $y \sim p ( v _ { 1 } ) p ( v _ { 2 } )$ or $y = \{ v _ { 1 } ^ { i } , v _ { 2 } ^ { j } \}$ , which we call negatives.
44
+
45
+ We learn a “critic” $h _ { \theta } ( \cdot )$ that is high for positives and low for negatives. Similar to recent setups for contrastive learning (Oord et al., 2018; Gutmann & Hyvarinen ¨ , 2010; Mnih & Kavukcuoglu, 2013), we train this function to correctly select a single positive sample $x$ out of a set $S = \{ x , y _ { 1 } , y _ { 2 } , . . . , y _ { k } \}$ that contains $k$ negative samples:
46
+
47
+ $$
48
+ \mathcal { L } _ { c o n t r a s t } = - \mathop { \mathbb { E } } _ { S } \left[ \log \frac { h _ { \theta } ( x ) } { h _ { \theta } ( x ) + \sum _ { i = 1 } ^ { k } h _ { \theta } ( y _ { i } ) } \right]
49
+ $$
50
+
51
+ To construct $S$ , we simply fix one view and enumerate positives and negatives from the other view, allowing us to rewrite the objective as:
52
+
53
+ $$
54
+ \mathcal { L } _ { c o n t r a s t } ^ { V _ { 1 } , V _ { 2 } } = - \underset { \{ v _ { 1 } ^ { 1 } , v _ { 2 } ^ { 1 } , . . . , v _ { 2 } ^ { k + 1 } \} } { \mathbb { E } } \left[ \log \frac { h _ { \theta } ( \{ v _ { 1 } ^ { 1 } , v _ { 2 } ^ { 1 } \} ) } { \sum _ { j = 1 } ^ { k + 1 } h _ { \theta } ( \{ v _ { 1 } ^ { 1 } , v _ { 2 } ^ { j } \} ) } \right]
55
+ $$
56
+
57
+ where $k$ is the number of negative samples $v _ { 2 } ^ { j }$ for a given sample $v _ { 1 } ^ { 1 }$ . In practice, $k$ can be extremely large, and so directly minimizing Eq. 2 is infeasible. In Section 2.4, we show an approximation based on Noise Contrastive Estimation (Gutmann $\&$ Hyvarinen ¨ , 2010) that allows for tractable computation.
58
+
59
+ ![](images/bb153de172cd03660c2788678dfe4f08b2717f8a9dae4f42e7e119b8bded5655.jpg)
60
+ Figure 3: Graphical models and information diagrams (inf) associated with the core view and full graph paradigms, for the case of 4 views, which gives a total of 6 learning objectives. The numbers within the regions show how much “weight” the total loss places on each partition of information (i.e. how many of the 6 objectives that partition contributes to). A region with no number corresponds to 0 weight. For example, in the full graph case, the mutual information between all 4 views is considered in all 6 objectives, and hence is marked with the number 6.
61
+
62
+ Implementing the critic We implement the critic $h _ { \theta } ( \cdot )$ as a neural network. To extract compact latent representations of $v _ { 1 }$ and $v _ { 2 }$ , we employ two encoders $f _ { \theta _ { 1 } } ( \cdot )$ and $f _ { \theta _ { 2 } } ( \cdot )$ with parameters $\theta _ { 1 }$ and $\theta _ { 2 }$ respectively. The latent representions are extracted as $z _ { 1 } = f _ { \theta _ { 1 } } ( v _ { 1 } )$ , $z _ { 2 } = f _ { \theta _ { 2 } } ( v _ { 2 } )$ . On top of these features, the score is computed as the exponential of a bivariate function of $z _ { 1 }$ and $z _ { 2 }$ , e.g., a bilinear function parameterized by $W _ { 1 2 }$ :
63
+
64
+ $$
65
+ h _ { \boldsymbol { \theta } } \big ( \{ v _ { 1 } , v _ { 2 } \} \big ) = e ^ { f _ { \boldsymbol { \theta } _ { 1 } } ( v _ { 1 } ) ^ { T } W _ { 1 2 } f _ { \boldsymbol { \theta } _ { 2 } } ( v _ { 2 } ) }
66
+ $$
67
+
68
+ Loss LV1,V2contra in Eq. 2 trenchoring at view . We $V _ { 1 }$ as anchor and enumerates over them up as our two-view loss: $V _ { 2 }$ . Symmetrically, we can get $\mathcal { L } _ { c o n t r a s t } ^ { V _ { 2 } , V _ { 1 } }$ $V _ { 2 }$
69
+
70
+ $$
71
+ \mathcal { L } ( V _ { 1 } , V _ { 2 } ) = \mathcal { L } _ { c o n t r a s t } ^ { V _ { 1 } , V _ { 2 } } + \mathcal { L } _ { c o n t r a s t } ^ { V _ { 2 } , V _ { 1 } }
72
+ $$
73
+
74
+ After the contrastive learning phase, we use the representation $z _ { 1 } , z _ { 2 }$ , or the concatenation of both, $[ z _ { 1 } , z _ { 2 } ]$ , depending on our paradigm. This process is visualized in Fig. 1.
75
+
76
+ Connecting to mutual information The optimal critic $h _ { \theta } ^ { * }$ is proportional to the density ratio between the joint distribution $p ( z _ { 1 } , z _ { 2 } )$ and the product of marginals $p ( z _ { 1 } ) p ( z _ { 2 } )$ (proof provided in Sec. C.1):
77
+
78
+ $$
79
+ h _ { \theta } ^ { \ast } ( \{ v _ { 1 } , v _ { 2 } \} ) ~ \propto ~ \frac { p ( z _ { 1 } , z _ { 2 } ) } { p ( z _ { 1 } ) p ( z _ { 2 } ) } \propto \frac { p ( z _ { 1 } | z _ { 2 } ) } { p ( z _ { 1 } ) }
80
+ $$
81
+
82
+ This quantity is the pointwise mutual information, and its expectation, in Eq. 2, yields an estimator related to mutual information. A formal proof is given by Oord et al. (2018); Poole et al. (2019), which we recapitulate in Section C, showing that:
83
+
84
+ $$
85
+ I ( z _ { i } ; z _ { j } ) \geq \log ( k ) - \mathcal { L } _ { c o n t r a s t }
86
+ $$
87
+
88
+ where, as above, $k$ is the number of negative pairs in sample set $S$ . Hence minimizing the objective $\mathcal { L }$ maximizes the lower bound on the mutual information $I ( z _ { i } ; z _ { j } )$ , which is bounded above by $I ( v _ { i } ; v _ { j } )$ by the data processing inequality. The dependency on $k$ also suggests that using more negative samples can lead to an improved representation; we show that this is indeed the case in Section A.1.2. We note that recent work (McAllester & Statos, 2018) shows that the bound in Eq. 6 can be very weak; and finding better estimators of mutual information is an important open problem.
89
+
90
+ # 2.3 CONTRASTIVE LEARNING WITH MORE THAN TWO VIEWS
91
+
92
+ We present more general formulations of Eq. 2 that can handle any number of views. We call them the “core view” and “full graph” paradigms, which offer different tradeoffs between efficiency and effectiveness. These formulations are visualized in Fig. 3.
93
+
94
+ Suppose we have a collection of $M$ views $V _ { 1 } , \dots , V _ { M }$ . The “core view” formulation sets apart one view that we want to optimize over, say $V _ { 1 }$ , and builds pair-wise representations between $V _ { 1 }$ and each
95
+
96
+ other view $V _ { j } , j > 1$ , by optimizing the sum of a set of pair-wise objectives:
97
+
98
+ $$
99
+ \mathcal { L } _ { C } = \sum _ { j = 2 } ^ { M } \mathcal { L } ( V _ { 1 } , V _ { j } )
100
+ $$
101
+
102
+ A second, more general formulation is the “full graph” where we consider all pairs $( i , j ) , i \neq j$ , and build $\binom { n } { 2 }$ relationships in all. By involving all pairs, the objective function that we optimize is:
103
+
104
+ $$
105
+ \mathcal { L } _ { F } = \sum _ { 1 \leq i < j \leq M } \mathcal { L } ( V _ { i } , V _ { j } )
106
+ $$
107
+
108
+ Both these formulations have the effect that information is prioritized in proportion to the number of views that share that information. This can be seen in the information diagrams visualized in Fig. 3. The number in each partition of the diagram indicates how many of the pairwise objectives, ${ \bar { \mathcal { L } } } ( V _ { i } , V _ { j } )$ , that partition contributes to. Under both the core view and full graph objectives, a factor, like “presence of $\mathrm { d o g } ^ { \mathrm { , , } }$ , that is common to all views will be preferred over a factor that affects fewer views, such as “depth sensor noise”.
109
+
110
+ The computational cost of the bivariate score function in the full graph formulation is combinatorial in the number of views. However, it is clear from Fig. 3 that this enables the full graph formulation to capture more information between different views, which may prove useful for downstream tasks. For example, the mutual information between $V _ { 2 }$ and $V _ { 3 }$ or $V _ { 2 }$ and $V _ { 4 }$ is completely ignored in the core view paradigm (as shown by a 0 count in the information diagram).
111
+
112
+ # 2.4 APPROXIMATING THE SOFTMAX DISTRIBUTION WITH NOISE-CONTRASTIVE ESTIMATION
113
+
114
+ Better representations using computing the full softmax $\mathcal { L } _ { c o n t r a s t } ^ { V _ { 1 } , V _ { 2 } }$ in Eq. 2 are learnt by using mhibitively expensive for large y negative samples. However,. We alleviate computational $N$ load by using Noise-Contrastive Estimation (NCE) (Gutmann & Hyvarinen ¨ , 2010) to approximate the full softmax in Eqn. 2, as has also been used in Mnih & Kavukcuoglu (2013)1.
115
+
116
+ Given an anchor $v _ { 1 } ^ { i }$ from $V _ { 1 }$ , the probablity that an atom $v _ { 2 } \in \{ v _ { 2 } ^ { j } | j = 1 , 2 , . . . , N \}$ from $V _ { 2 }$ is the best match of $v _ { 1 } ^ { i }$ , using the score $h _ { \theta }$ is given by:
117
+
118
+ $$
119
+ p ( v _ { 2 } | v _ { 1 } ^ { i } ) = \frac { h _ { \theta } ( \{ v _ { 1 } ^ { i } , v _ { 2 } \} ) } { \sum _ { j = 1 } ^ { N } h _ { \theta } ( \{ v _ { 1 } ^ { i } , v _ { 2 } ^ { j } \} ) }
120
+ $$
121
+
122
+ where the normalization factor $\begin{array} { r } { Z = \sum _ { j = 1 } ^ { N } h _ { \theta } ( \{ v _ { 1 } ^ { i } , v _ { 2 } ^ { j } \} ) } \end{array}$ is expensive to compute for large $N$ . Here we use $h _ { \theta } ( \{ v _ { 1 } , v _ { 2 } \} ) = \exp ( f _ { \theta _ { 1 } } ( v _ { 1 } ) ^ { T } \dot { W } _ { 1 2 } f _ { \theta _ { 2 } } ( v _ { 2 } ) / \tau )$ , where $\tau$ modulates the distribution.
123
+
124
+ Noise-Contrastive Estimation (Gutmann & Hyvarinen ¨ , 2010) (NCE) is an effective way to estimate unnormalized statistical models. NCE fits a density model $p$ to data distributed as (unknown) distribution $p _ { d }$ , by using a binary classifier to distinguish it from noise samples distributed as $p _ { n }$ . To learn $p ( v _ { 2 } | v _ { 1 } ^ { i } )$ , we use a binary classifier, which treats $v _ { 2 }$ as the data sample when given $v _ { 1 } ^ { i }$ . The noise distribution $p _ { n } ( \cdot | v _ { 1 } ^ { i } )$ we choose here is a uniform distribution over all atoms from $V _ { 2 }$ , i.e., $p _ { n } ( \cdot | v _ { 1 } ^ { i } ) = 1 / N$ . If we sample $m$ noise samples to pair with each data sample, the posterior probability that a given atom $v _ { 2 }$ comes from the data distribution is:
125
+
126
+ $$
127
+ P ( D = 1 | v _ { 2 } ; v _ { 1 } ^ { i } ) = \frac { p _ { d } ( v _ { 2 } | v _ { 1 } ^ { i } ) } { p _ { d } ( v _ { 2 } | v _ { 1 } ^ { i } ) + m p _ { n } ( v _ { 2 } | v _ { 1 } ^ { i } ) }
128
+ $$
129
+
130
+ and we estimate this probability by replacing $p _ { d } ( v _ { 2 } | v _ { 1 } ^ { i } )$ with our unnormalized model distribution $h _ { \theta } ( v _ { 1 } ^ { i } , v _ { 2 } )$ . Minimizing the negative log-posterior probability of correct labels $D$ over data and noise samples yields our final objective, which is the NCE-based approximation of Eq. 2 $\hat { p }$ is the empirical data distribution):
131
+
132
+ $$
133
+ L _ { N C E } = - \underset { v _ { 1 } ^ { + } \sim \hat { p } ( v _ { 1 } ) } { \mathbb { E } } \{ \underset { v _ { 2 } \sim \hat { p } ( \cdot \vert v _ { 1 } ^ { i } ) } { \mathbb { E } } \left[ \log ( P ( D = 1 \vert v _ { 2 } ; v _ { 1 } ^ { i } ) ) \right] + m \underset { v _ { 2 } \sim p _ { n } ( \cdot \vert v _ { 1 } ^ { i } ) } { \mathbb { E } } \left[ \log ( P ( D = 0 \vert v _ { 2 } ; v _ { 1 } ^ { i } ) ) \right] \}
134
+ $$
135
+
136
+ Memory bank. Following Wu et al. (2018), we maintain a memory bank to store latent features for each training sample. Therefore, we can efficiently retrieve $m$ noise samples from the memory bank to pair with each positive sample without recomputing their features. The memory bank is dynamically updated with features computed on the fly.
137
+
138
+ An alternative to the NCE based approximation above, is to simply do $m { + 1 }$ way softmax classification with $m$ noise samples retrieved from the memory bank. We note that CPC (Oord et al., 2018) and Deep InfoMax (Hjelm et al., 2019) use this $m + 1$ way softmax classification as their ultimate contrastive loss rather than the NCE-based contrastive loss in Eq. 11 (but note that CPC refers to the $m + 1$ approximation as also “based on NCE”). Empirically we have found that the $m + 1 \AA$ -way softmax classification approach performed worse than our NCE-based approximation, given the same number of noise samples.
139
+
140
+ # 3 EXPERIMENTS
141
+
142
+ We extensively evaluate Contrastive Multiview Coding (CMC) on a number of datasets and tasks. We evaluate on two established image representation learning benchmarks: Imagenet and STL-10 (See A.1.1). We further validate our framework on video representation learning tasks (See A.2), where we use image and optical flow modalities, as the two views that are jointly learned. The last set of experiments extends our CMC framework to more than two views and provides empirical evidence of it’s effectiveness.
143
+
144
+ # 3.1 BENCHMARKING CMC ON IMAGENET
145
+
146
+ Following Zhang et al. (2016), we evaluate task generalization of the learned representation by training 1000-way linear classifiers on top of different layers.
147
+
148
+ Setup. Given a dataset of RGB images, we convert them to the Lab image color space, and split each image into $L$ and ab channels, as originally proposed in SplitBrain autoencoders (Zhang et al., 2017). During contrastive learning, L and ab from the same image are treated as the positive pair, and ab channels from other randomly selected images are treated as a negative pair (for a given L). Each split represents a view of the orginal image and is passed through a separate encoder. As in SplitBrain, we design these two encoders by evenly splitting a given deep network, such as AlexNet (Krizhevsky et al., 2012), into sub-networks across the channel dimension. By concatenating representations layer-wise from these two encoders, we achieve the final representation of an input image. As proposed by previous literature (Oord et al., 2018; Hjelm et al., 2019; Arora et al., 2019), the quality of such a representation is evaluated by freezing the weights of encoder and training linear or non-linear classifiers on top of each layer.
149
+
150
+ To compare with other methods, we adopt standard AlexNet and split it into two encoders. Because of splitting, each layer only connects to half of the neurons in the previous layer, and therefore the number of parameters in our model halves. We remove local response layer and add batch normalization to each layer. For the memory-based CMC model, we adopt ideas from Wu et al. (2018) for computing and storing a memory. We retrieve 4096 negative pairs from the memory bank to contrast each positive pair. The training details are present in Sec. D.2.
151
+
152
+ Table 1 shows the results of comparing the CMC against other models, both predictive and contrastive. Our CMC is the best among all these methods; futhermore CMC tends to perform better at higher convolutional layers, similar to another contrasting-based model Inst-Dis (Wu et al., 2018).
153
+
154
+ CMC with ResNets. We verify the scalability of CMC with larger networks such as ResNets He et al. (2016). Here we do not split ResNets, rather we use ResNet-50, ResNet-101 or ResNet-50 x2 to encoder each of the two views $L$ and $a b$ ). The results are shown in Table 2, where ResNet-50, ResNet-101, and ResNet- $5 0 ~ \mathrm { x } 2$ achieve $6 4 . 1 \%$ , $6 5 . 0 \%$ , and $6 8 . 4 \%$ top-1 accuracies, respectively. To our best knowledge, $6 8 . 4 \%$ on ImageNet is the highest published accuracy ever achieved by self-supervsied/unsupervised methods (We note that a concurrent work AMDIM Bachman et al. (2019) achieves similar results).
155
+
156
+ Table 1: Top-1 classification accuracy on 1000 classes of ImageNet Deng et al. (2009) with single crop. We compare our CMC method with other unsupervised representation learning approaches by training 1000-way logistic regression classifiers on top of the feature maps of each layer, as proposed by Zhang et al. (2016). Methods marked with † only have half the number of parameters compared to others, because of splitting.
157
+
158
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>ImageNet Classification Accuracy</td></tr><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>conv1 conv2 conv3 conv4 conv5</td></tr><tr><td rowspan=1 colspan=1>ImageNet-Labels</td><td rowspan=1 colspan=1>19.3 36.3 44.2 48.3 50.5</td></tr><tr><td rowspan=2 colspan=1>RandomData-Init (Krahenbuhl et al., 2015)</td><td rowspan=1 colspan=1>11.6 17.1 16.9 16.3 14.1</td></tr><tr><td rowspan=1 colspan=1>17.5 23.0 24.5 23.2 20.6</td></tr><tr><td rowspan=10 colspan=1>Context (Doersch et al., 2015)Colorization (Zhang et al., 2016)Jigsaw (Noroozi &amp; Favaro,2016)BiGAN (Donahue et al., 2017)SplitBraint (Zhang et al., 2017)Counting (Noroozi et al., 2017)Inst-Dis (Wu et al., 2018)RotNet (Gidaris et al., 2018)DeepCluster (Caron et al.,2018)AET (Zhang et al., 2019)</td><td rowspan=1 colspan=1>16.2 23.3 30.2 31.7 29.6</td></tr><tr><td rowspan=1 colspan=1>13.1 24.8 31.0 32.6 31.8</td></tr><tr><td rowspan=1 colspan=1>19.2 30.1 34.7 33.9 28.3</td></tr><tr><td rowspan=1 colspan=1>17.7 24.5 31.0 29.9 28.0</td></tr><tr><td rowspan=1 colspan=1>17.7 29.3 35.4 35.2 32.8</td></tr><tr><td rowspan=1 colspan=1>18.0 30.6 34.3 32.5 25.7</td></tr><tr><td rowspan=1 colspan=1>16.8 26.5 31.8 34.1 35.6</td></tr><tr><td rowspan=1 colspan=1>18.8 31.7 38.7 38.2 36.5</td></tr><tr><td rowspan=1 colspan=1>12.9 29.2 38.2 39.8 36.1</td></tr><tr><td rowspan=1 colspan=1>19.3 32.8 40.6 39.7 37.7</td></tr><tr><td rowspan=1 colspan=1>CMC</td><td rowspan=1 colspan=1>18.4 33.5 38.1 40.4 42.6</td></tr></table>
159
+
160
+ Table 2: Single crop top-1 classification accuracy on ImageNet. We evaluate CMC with ResNet-50, ResNet-101, or ResNet- ${ 5 0 } \mathrm { x } 2 { }$ as encoder for each of the two views $L$ and $a b$ ).
161
+
162
+ <table><tr><td>Accuracy (%)</td><td>ResNet-50</td><td>ResNet-101</td><td>ResNet-50 x2</td></tr><tr><td>Top-1</td><td>64.1</td><td>65.0</td><td>68.4</td></tr></table>
163
+
164
+ # 3.2 DOES REPRESENTATION QUALITY IMPROVE AS NUMBER OF VIEWS INCREASES?
165
+
166
+ We further extend our CMC learning framework to multiview scenarios. We experiment on the NYU-Depth-V2 (Nathan Silberman & Fergus, 2012) dataset which consists of 1449 labeled images. We focus more on understanding the behavior and effectiveness of CMC rather than competing with the current state-of-the-arts. The views we consider are: luminance (L channel), chrominance (ab channel), depth, surface normal (Eigen & Fergus, 2015), and semantic labels.
167
+
168
+ Setup. To extract features from each view, we use a neural network with 5 convolutional layers, and 1 fully connected layer. As the size of the dataset is relatively small, we adopt the sub-patch based contrastive objective (see B) to increase the number of negative pairs. Patches with a size of $1 2 8 \times 1 2 8$ are randomly cropped from the original images for contrastive learning (from images of size $4 8 0 \times 6 4 0 ^ { \cdot }$ ). For downstream tasks, we discard the fully connected layers and evaluate using the convolutional layers as a representation.
169
+
170
+ To measure the quality of the learned representation, we consider the task of predicting semantic labels from the representation of $L$ . We follow the core view paradigm and use $L$ are the core view, thus learning a set of representations on $L$ by contrasting different views with $L$ . A UNet style architecture (Ronneberger et al., 2015) is utilized to perform the segmentation task. Contrastive training is performed on the above architecture that is equivalent of the UNet’s encoder. After contrastive training is completed, we initialize the encoder weights of the UNet from the $L$ encoder (which are equivalent architectures) and keep them frozen. Only the decoder is trained during this finetuning stage.
171
+
172
+ Since we use the patch-based contrastive loss, in the 1 view setting case, CMC coincides with DIM (Hjelm et al., 2019). The 2-4 view cases contrast L with ab, and then sequentially add depth and surface normals. The semantic labeling results are measured by mean IoU over all classes and pixel accuracy, shown in Fig. 4. We see that the performance steadily improves as new views are added. We have tested different orders of adding the views, and they all follow a similar pattern.
173
+
174
+ We also compare CMC with two baselines. First, we randomly initialize and freeze the encoder, and we call this the Random baseline; it serves as a lower bound on the quality since the representation is just a random projection. Rather than freezing the randomly initialized encoder, we could train it jointly with the decoder. This end-to-end Supervised baseline serves as an upper bound. The results are presented in Table 3, which shows our CMC produces high quality feature maps even though it’s unaware of the downstream task.
175
+
176
+ <table><tr><td></td><td>Pixel Accuracy (%)</td><td>mIoU (%)</td></tr><tr><td>Random</td><td>45.5</td><td>21.4</td></tr><tr><td>CMC (core-view)</td><td>57.1</td><td>34.1</td></tr><tr><td>CMC (full-graph)</td><td>57.0</td><td>34.4</td></tr><tr><td>Supervised</td><td>57.8</td><td>35.9</td></tr></table>
177
+
178
+ ![](images/f0a8c78a5d8dcbb4886abf3a078be33de389fcfcff7c219288cb6370db479b53.jpg)
179
+ Figure 4: We show the Intersection over Union (IoU) (left) and Pixel Accuracy (right) for the NYU-Depth-V2 dataset, as CMC is trained with increasingly more views from 1 to 4. As more views are added, both these metrics steadily increase. The views are (in order of inclusion): L, ab, depth and surface normals.
180
+ Table 3: Results on the task of predicting semantic labels from L channel representation which is learnt using the patch-based contrastive loss and all 4 views. We compare CMC with Random and Supervised baselines, which serve as lower and upper bounds respectively. Th core-view paradigm refers to Fig. 3(a), and full-view Fig. 3(b).
181
+ Table 4: We compare predictive learning with contrastive learning by evaluating the learned encoder on unseen dataset and task. The contrastive learning framework consistently outperforms predictive learning.
182
+
183
+ # 3.3 PREDICTIVE LEARNING VS. CONTRASTIVE LEARNING
184
+
185
+ While experiments in section 3.1 show that contrastive learning outperforms predictive learning (Zhang et al., 2017) in the context of Lab color space, it’s unclear whether such an advantage is due to the natural inductive bias of the task itself. To further understand this, we go beyond chrominance (ab), and try to answer this question when geometry or semantic labels are present.
186
+
187
+ We consider three view pairs on the NYU-Depth dataset: (1) L and depth, (2) L and surface normals, and (3) L and segmentation map. For each of them, we train two identical encoders for L, one using contrastive learning and the other with predictive learning. We then evaluate the representation quality by training a linear classifier on top of these encoders on the STL-10 dataset.
188
+
189
+ <table><tr><td></td><td colspan="2">Accuracy on STL-10 (%)</td></tr><tr><td>Views</td><td>Predictive</td><td>Contrastive</td></tr><tr><td>L, Depth L, Normal L, Seg. Map</td><td>55.5 58.4 57.7</td><td>58.3 60.1 59.2</td></tr><tr><td>Random Supervised</td><td colspan="2">25.2 65.1</td></tr></table>
190
+
191
+ The comparison results are shown in Table 4, which shows that contrastive learning consistently outperforms predictive learning in this scenario where both the task and the dataset are unknown. We also include “random” and “supervised” baselines similar to that in previous sections. Though in the unsupervised stage we only use 1.3K images from a dataset much different from the target dataset STL-10, the object recognition accuracy is close to the supervised method, which uses an end-to-end deep network directly trained on STL-10.
192
+
193
+ Given two views $V _ { 1 }$ and $V _ { 2 }$ of the data, the predictive learning approach approximately models $p ( v _ { 2 } | v _ { 1 } )$ . Furthermore, losses used typically for predictive learning, such as pixel-wise reconstruction losses usually impose an independence assumption on the modeling: $p ( \bar { v _ { 2 } } | v _ { 1 } ) \approx \Pi _ { i } p ( v _ { 2 i } | v _ { 1 } )$ . On the other hand, the contrastive learning approach by construction does not assume conditional independence across dimensions of $v _ { 2 }$ . In addition, the use of random jittering and cropping between views allows the contrastive learning approach to benefit from spatial co-occurrence (contrasting in space) in addition to contrasting across views. We conjecture that these are two reasons for the superior performance of contrastive learning approaches over predictive learning.
194
+
195
+ ![](images/24df0326ebab21d46e12729bcbb3d6d65ffcc61db5fb8a35954d3e682e32ed3b.jpg)
196
+ Figure 5: How does mutual information between views relate to representation quality? (Left) Classification accuracy against estimated MI between channels of different color spaces; (Right) Classification accuracy vs estimated MI between patches at different distances (distance in pixels is denoted next to each data point). MI estimated using MINE (Belghazi et al., 2018).
197
+
198
+ # 3.4 HOW DOES MUTUAL INFORMATION AFFECT REPRESENTATION QUALITY?
199
+
200
+ Given a fixed set of views, CMC aims to maximize the mutual information between representations of these views. We have found that maximizing information in this way indeed results in strong representations, but it would be incorrect to infer that information maximization (infomax) is the key to good representation learning. In fact, this paper argues for precisely the opposite idea: that cross-view representation learning is effective because it results in a kind of information minimization, discarding nuisance factors that are not shared between the views.
201
+
202
+ The resolution to this apparent dilemma is that we want to maximize the “good” information – the signal – in our representations, while minimizing the “bad” information – the noise. The idea behind CMC is that this can be achieved by doing infomax learning on two views that share signal but have independent noise. This suggests a “Goldilocks principle”: a good collection of views is one that shares some information but not too much. Here we test this hypothesis on two domains: learning representations on images with different colorspaces forming the two views; and learning representations on pairs of patches extracted from an image, separated by varying spatial distance.
203
+
204
+ In patch experiments we randomly crop two RGB patches of size $6 4 \mathrm { x } 6 4$ from the same image as two views. Their relative position is fixed. Namely, the two patches always starts at position $( x , y )$ and $( x + d , y + d )$ with $( x , y )$ being randomly sampled. While varying the distance $d$ , we start from 64 to avoid overlapping. There is a possible bias that with an image of relatively small size (e.g., $5 1 2 \mathrm { x } 5 1 2 ,$ ), a large $d$ (e.g., 384) will always push these two patches around boundary. To minimize this bias, we use high resolution images (e.g. $2 k$ ) from DIV2K (Agustsson & Timofte, 2017) dataset.
205
+
206
+ Fig. 5 shows the results of these experiments. The left plot shows the result of learning representations on different colorspaces (splitting each colorspace into two views, such as (L, ab), (R, GB) etc). We then use the MINE estimator Belghazi et al. (2018) to estimate the mutual information between the views. We measure representation quality by training a linear classifier on the learned representations on the STL-10 dataset Coates et al. (2011). The plots clearly show that using colorspaces with minimal mutual information give the best downstream accuracy (For the outlier HSV in this plot, we conjecture the representation quality is harmed by the periodicity of H. Note that the H in HED is not periodic.). On the other hand, the story is more nuanced for representations learned between patches at different offsets from each other (Fig. 5, right). Here we see that views with too little or too much MI perform worse; a sweet spot in the middle exists which gives the best representation. That there exists such a sweet spot should be expected. If two views share no information, then, in principle, there is no incentive for CMC to learn anything. If two views share all their information, no nuisances are discarded and we arrive back at something akin to an autoencoder or generative model, that simply tries to represent all the bits in the multiview data.
207
+
208
+ These experiments demonstrate that the relationship between mutual information and representation quality is meaningful but not direct. Selecting optimal views, which just share relevant signal, may be a fruitful direction for future research.
209
+
210
+ # 4 RELATED WORK
211
+
212
+ Unsupervised representation learning is about learning transformations of the data that make subsequent problem solving easier (Bengio et al., 2013). This field has a long history, starting with classical methods with well established algorithms, such as principal components analysis (PCA (Jolliffe, 2011)) and independent components analysis (ICA (Hyvarinen et al. ¨ , 2004)). These methods tend to learn representations that focus on low-level variations in the data, which are not very useful from the perspective of downstream tasks such as object recognition.
213
+
214
+ Representations better suited to such tasks have been learnt using deep neural networks, starting with seminal techniques such as Boltzmann machines (Smolensky, 1986; Salakhutdinov & Hinton, 2009), autoencoders (Hinton & Salakhutdinov, 2006), variational autoencoders (Kingma & Welling, 2013), generative adversarial networks (Goodfellow et al., 2014) and autoregressive models (Oord et al., 2016). Numerous other works exist, for a review see (Bengio et al., 2013). A powerful family of models for unsupervised representations are collected under the umbrella of “self-supervised” learning (Sa, 2004; Zhang et al., 2017; 2016; Isola et al., 2015; Wang & Gupta, 2015; Pathak et al., 2016; Zhang et al., 2019). In these models, an input $X$ to the model is transformed into an output $\hat { X }$ , which is supposed to be close to another signal $Y$ , which itself is related to $X$ in some meaningful way. Examples of such $X / Y$ pairs are: luminance and chrominance color channels of an image (Zhang et al., 2017), patches from a single image (Oord et al., 2018), modalities such as vision and sound (Owens et al., 2016) or the frames of a video (Wang & Gupta, 2015). Clearly, such examples are numerous in the world, and provides us with nearly infinite amounts of training data: this is one of the appeals of this paradigm. Time contrastive networks (Sermanet et al., 2017) use a triplet loss framework to learn representations from aligned video sequences of the same scene, taken by different video cameras. Closely related to self-supervised learning is the idea of multi-view learning, which is a general term involving many different approaches such as co-training (Blum & Mitchell, 1998), multi-kernel learning (Cortes et al., 2009) and metric learning (Bellet et al., 2012; Zhuang et al., 2019); for comprehensive surveys please see (Xu et al., 2013; Li et al., 2018). Nearly all existing works have dealt with one or two views such as video or image/sound. However, in many situations, many more views are available to provide training signals for any representation.
215
+
216
+ The objective functions used to train deep learning based representations in many of the above methods are either reconstruction-based loss functions such as Euclidean losses in different norms e.g. (Isola et al., 2017), adversarial loss functions (Goodfellow et al., 2014) that learn the loss in addition to the representation, or contrastive losses e.g. (Gutmann & Hyvarinen ¨ , 2010; Hjelm et al., 2019; Oord et al., 2018; Arora et al., 2019; Henaff et al. ´ , 2019) that take advantage of the co-occurence of multiple views. Another recently introduced novel objective function is instance discrimination (Wu et al., 2018). In this work, we compare the two most commonly used objectives: predictive and contrastive. The prior works most similar to our own (and inspirational to us) are Contrastive Predictive Coding (CPC) (Oord et al., 2018) and Deep InfoMax (Henaff et al. ´ , 2019). These two methods, like ours, learn representations by contrasting between congruent and incongruent representations of a scene, and are motivated as forms of infomax learning. CPC learns from two views – the past and future – and is applicable to sequential data. Deep Infomax (Hjelm et al., 2019) considers the two views to be the input to a neural network and its output. These two methods share the same mathematical objective, but differ in the definition of the views. Our technical method is also highly related, but differs in the following ways: we extend the objective to the case of more than two views; and we use a loss function which more closely follows the original method of noise contrastive estimation (Gutmann & Hyvarinen ¨ , 2010) (See details in Section 2.4). Although CPC, Deep InfoMax, and the present paper are all very similar at the mathematical level, they each explore a different set of view definitions, architectures, and application settings, and each contributes its own unique empirical investigation of this paradigm of representation learning.
217
+
218
+ # REFERENCES
219
+
220
+ Information Diagram - Wikipedia. https://en.wikipedia.org/wiki/Information_ diagram. 4
221
+
222
+ Eirikur Agustsson and Radu Timofte. Ntire 2017 challenge on single image super-resolution: Dataset and study. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition Workshops, pp. 126–135, 2017. 9
223
+
224
+ Sanjeev Arora, Hrishikesh Khandeparkar, Mikhail Khodak, Orestis Plevrakis, and Nikunj Saunshi. A theoretical analysis of contrastive unsupervised representation learning. arXiv preprint arXiv:1902.09229, 2019. 2, 6, 10, 14
225
+
226
+ Philip Bachman, R Devon Hjelm, and William Buchwalter. Learning representations by maximizing mutual information across views. arXiv preprint arXiv:1906.00910, 2019. 2, 6
227
+
228
+ Mohamed Ishmael Belghazi, Aristide Baratin, Sai Rajeswar, Sherjil Ozair, Yoshua Bengio, Aaron Courville, and R Devon Hjelm. Mine: mutual information neural estimation. arXiv preprint arXiv:1801.04062, 2018. 9
229
+
230
+ Aurelien Bellet, Amaury Habrard, and Marc Sebban. Similarity learning for provably accurate sparse ´ linear classification. arXiv preprint arXiv:1206.6476, 2012. 10
231
+
232
+ Yoshua Bengio, Aaron Courville, and Pascal Vincent. Representation learning: A review and new perspectives. IEEE transactions on pattern analysis and machine intelligence, 35(8):1798–1828, 2013. 10
233
+
234
+ Avrim Blum and Tom Mitchell. Combining labeled and unlabeled data with co-training. In Proceedings of the eleventh annual conference on Computational learning theory, pp. 92–100. ACM, 1998. 10
235
+
236
+ Piotr Bojanowski and Armand Joulin. Unsupervised learning by predicting noise. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 517–526. JMLR. org, 2017. 16
237
+
238
+ Uta Buchler, Biagio Brattoli, and Bjorn Ommer. Improving spatiotemporal self-supervision by deep reinforcement learning. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 770–786, 2018. 17, 21
239
+
240
+ Mathilde Caron, Piotr Bojanowski, Armand Joulin, and Matthijs Douze. Deep clustering for unsupervised learning of visual features. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 132–149, 2018. 7
241
+
242
+ Adam Coates, Andrew Ng, and Honglak Lee. An analysis of single-layer networks in unsupervised feature learning. In Proceedings of the fourteenth international conference on artificial intelligence and statistics, pp. 215–223, 2011. 9, 15
243
+
244
+ Corinna Cortes, Mehryar Mohri, and Afshin Rostamizadeh. Learning non-linear combinations of kernels. In Advances in neural information processing systems, pp. 396–404, 2009. 10
245
+
246
+ Hanneke EM Den Ouden, Peter Kok, and Floris P De Lange. How prediction errors shape perception, attention, and motivation. Frontiers in psychology, 3:548, 2012. 1
247
+
248
+ Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. 2009. 7, 15
249
+
250
+ Carl Doersch, Abhinav Gupta, and Alexei A Efros. Unsupervised visual representation learning by context prediction. In Proceedings of the IEEE International Conference on Computer Vision, pp. 1422–1430, 2015. 7
251
+
252
+ Jeff Donahue, Philipp Krahenb ¨ uhl, and Trevor Darrell. Adversarial feature learning. In ¨ International Conference on Learning Representations, 2017. 7, 16
253
+
254
+ David Eigen and Rob Fergus. Predicting depth, surface normals and semantic labels with a common multi-scale convolutional architecture. In Proceedings of the IEEE international conference on computer vision, 2015. 7
255
+
256
+ Chuang Gan, Boqing Gong, Kun Liu, Hao Su, and Leonidas J Guibas. Geometry guided convolutional neural networks for self-supervised video representation learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5589–5597, 2018. 17
257
+
258
+ Spyros Gidaris, Praveer Singh, and Nikos Komodakis. Unsupervised representation learning by predicting image rotations. arXiv preprint arXiv:1803.07728, 2018. 7
259
+
260
+ Melvyn A Goodale and A David Milner. Separate visual pathways for perception and action. Trends in neurosciences, 1992. 16
261
+
262
+ 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. 1, 10
263
+
264
+ Michael Gutmann and Aapo Hyvarinen. Noise-contrastive estimation: A new estimation principle ¨ for unnormalized statistical models. In Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, pp. 297–304, 2010. 3, 5, 10
265
+
266
+ 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. 6
267
+
268
+ 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. 10
269
+
270
+ Geoffrey E Hinton and Ruslan R Salakhutdinov. Reducing the dimensionality of data with neural networks. science, 313(5786):504–507, 2006. 10
271
+
272
+ R Devon Hjelm, Alex Fedorov, Samuel Lavoie-Marchildon, Karan Grewal, Adam Trischler, and Yoshua Bengio. Learning deep representations by mutual information estimation and maximization. In International Conference on Learning Representations, 2019. 6, 7, 10, 14, 15, 16, 17, 18, 19
273
+
274
+ Jakob Hohwy. The predictive mind. Oxford University Press, 2013. 1
275
+
276
+ Aapo Hyvarinen, Juha Karhunen, and Erkki Oja. ¨ Independent component analysis, volume 46. John Wiley & Sons, 2004. 10
277
+
278
+ Phillip Isola, Daniel Zoran, Dilip Krishnan, and Edward H Adelson. Learning visual groups from co-occurrences in space and time. arXiv preprint arXiv:1511.06811, 2015. 10
279
+
280
+ Phillip Isola, Jun-Yan Zhu, Tinghui Zhou, and Alexei A Efros. Image-to-image translation with conditional adversarial networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1125–1134, 2017. 10
281
+
282
+ Ian Jolliffe. Principal component analysis. Springer, 2011. 10
283
+
284
+ Diederik P Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013. 1, 10
285
+
286
+ Philipp Krahenb ¨ uhl, Carl Doersch, Jeff Donahue, and Trevor Darrell. Data-dependent initializations ¨ of convolutional neural networks. arXiv preprint arXiv:1511.06856, 2015. 7
287
+
288
+ 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. 6, 14, 16, 20
289
+
290
+ Hsin-Ying Lee, Jia-Bin Huang, Maneesh Singh, and Ming-Hsuan Yang. Unsupervised representation learning by sorting sequences. In Proceedings of the IEEE International Conference on Computer Vision, pp. 667–676, 2017. 17, 21
291
+
292
+ Yingming Li, Ming Yang, and Zhongfei Mark Zhang. A survey of multi-view representation learning. IEEE Transactions on Knowledge and Data Engineering, 2018. 2, 10
293
+
294
+ Sungbin Lim, Ildoo Kim, Taesup Kim, Chiheon Kim, and Sungwoong Kim. Fast autoaugment. arXiv preprint arXiv:1905.00397, 2019. 20
295
+
296
+ Zelun Luo, Boya Peng, De-An Huang, Alexandre Alahi, and Li Fei-Fei. Unsupervised learning of long-term motion dynamics for videos. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2203–2212, 2017. 17
297
+
298
+ David McAllester and Karl Statos. Formal limitations on the measurement of mutual information. arXiv preprint arXiv:1811.04251, 2018. 4
299
+
300
+ Ishan Misra, C Lawrence Zitnick, and Martial Hebert. Shuffle and learn: unsupervised learning using temporal order verification. In European Conference on Computer Vision, pp. 527–544. Springer, 2016. 17, 21
301
+
302
+ Andriy Mnih and Koray Kavukcuoglu. Learning word embeddings efficiently with noise-contrastive estimation. In Advances in neural information processing systems, pp. 2265–2273, 2013. 3, 5
303
+
304
+ Hossein Mobahi, Ronan Collobert, and Jason Weston. Deep learning from temporal coherence in video. In Proceedings of the 26th Annual International Conference on Machine Learning, pp. 737–744. ACM, 2009. 17
305
+
306
+ Pushmeet Kohli Nathan Silberman, Derek Hoiem and Rob Fergus. Indoor segmentation and support inference from rgbd images. In ECCV, 2012. 2, 7
307
+
308
+ Mehdi Noroozi and Paolo Favaro. Unsupervised learning of visual representations by solving jigsaw puzzles. In European Conference on Computer Vision, pp. 69–84. Springer, 2016. 7
309
+
310
+ Mehdi Noroozi, Hamed Pirsiavash, and Paolo Favaro. Representation learning by learning to count. In Proceedings of the IEEE International Conference on Computer Vision, pp. 5898–5906, 2017. 7
311
+
312
+ Aaron van den Oord, Nal Kalchbrenner, and Koray Kavukcuoglu. Pixel recurrent neural networks. arXiv preprint arXiv:1601.06759, 2016. 10
313
+
314
+ Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018. 1, 3, 4, 5, 6, 10, 14, 15, 16, 18, 19
315
+
316
+ Andrew Owens, Phillip Isola, Josh McDermott, Antonio Torralba, Edward H Adelson, and William T Freeman. Visually indicated sounds. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2405–2413, 2016. 3, 10
317
+
318
+ Deepak Pathak, Philipp Krahenbuhl, Jeff Donahue, Trevor Darrell, and Alexei A Efros. Context encoders: Feature learning by inpainting. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2536–2544, 2016. 10
319
+
320
+ Ben Poole, Sherjil Ozair, Aaron van den Oord, Alexander A Alemi, and George Tucker. On variational bounds of mutual information. arXiv preprint arXiv:1905.06922, 2019. 4
321
+
322
+ Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computerassisted intervention, pp. 234–241. Springer, 2015. 7
323
+
324
+ Virginia Sa. Sensory modality segregation. In Advances in neural information processing systems, pp. 913–920, 2004. 10
325
+
326
+ Ruslan Salakhutdinov and Geoffrey Hinton. Deep boltzmann machines. In Artificial intelligence and statistics, pp. 448–455, 2009. 1, 10
327
+
328
+ Nawid Sayed, Biagio Brattoli, and Bjorn Ommer. Cross and learn: Cross-modal self-supervision.¨ arXiv preprint arXiv:1811.03879, 2018. 17, 21
329
+
330
+ Gerald E Schneider. Two visual systems. Science, 1969. 16
331
+
332
+ Pierre Sermanet, Corey Lynch, Yevgen Chebotar, Jasmine Hsu, Eric Jang, Stefan Schaal, and Sergey Levine. Time-contrastive networks: Self-supervised learning from pixels. 2017. 10
333
+
334
+ Karen Simonyan and Andrew Zisserman. Two-stream convolutional networks for action recognition in videos. In Advances in neural information processing systems, pp. 568–576, 2014. 16
335
+
336
+ Linda Smith and Michael Gasser. The development of embodied cognition: Six lessons from babies. Artificial life, 11(1-2):13–29, 2005. 1
337
+
338
+ Paul Smolensky. Information processing in dynamical systems: Foundations of harmony theory. Technical report, Colorado Univ at Boulder Dept of Computer Science, 1986. 10
339
+
340
+ Khurram Soomro, Amir Roshan Zamir, and Mubarak Shah. Ucf101: A dataset of 101 human actions classes from videos in the wild. arXiv preprint arXiv:1212.0402, 2012. 16
341
+
342
+ Carl Vondrick, Hamed Pirsiavash, and Antonio Torralba. Generating videos with scene dynamics. In Advances In Neural Information Processing Systems, pp. 613–621, 2016. 17
343
+
344
+ Xiaolong Wang and Abhinav Gupta. Unsupervised learning of visual representations using videos. In Proceedings of the IEEE International Conference on Computer Vision, pp. 2794–2802, 2015. 10
345
+
346
+ 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, pp. 3733–3742, 2018. 6, 7, 10, 19
347
+
348
+ Chang Xu, Dacheng Tao, and Chao Xu. A survey on multi-view learning. arXiv preprint arXiv:1304.5634, 2013. 2, 10
349
+
350
+ Christopher Zach, Thomas Pock, and Horst Bischof. A duality based approach for realtime tv-l 1 optical flow. In Joint pattern recognition symposium, pp. 214–223. Springer, 2007. 16
351
+
352
+ Liheng Zhang, Guo-Jun Qi, Liqiang Wang, and Jiebo Luo. Aet vs. aed: Unsupervised representation learning by auto-encoding transformations rather than data. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2547–2555, 2019. 7, 10
353
+
354
+ Richard Zhang, Phillip Isola, and Alexei A Efros. Colorful image colorization. In European conference on computer vision, pp. 649–666. Springer, 2016. 3, 6, 7, 10
355
+
356
+ Richard Zhang, Phillip Isola, and Alexei A Efros. Split-brain autoencoders: Unsupervised learning by cross-channel prediction. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1058–1067, 2017. 3, 6, 7, 8, 10, 14, 15, 16
357
+
358
+ Chengxu Zhuang, Alex Lin Zhai, and Daniel Yamins. Local aggregation for unsupervised learning of visual embeddings. arXiv preprint arXiv:1903.12355, 2019. 10
359
+
360
+ # A ADDITIONAL EXPERIMENTS
361
+
362
+ # A.1 CMC ON IMAGES
363
+
364
+ Given a dataset of RGB images, we convert them to the Lab image color space, and split each image into $L$ and $a b$ channels, as originally proposed in SplitBrain autoencoders (Zhang et al., 2017). During contrastive learning, L and ab from the same image are treated as the positive pair, and ab channels from other randomly selected images are treated as a negative pair (for a given L). Each split represents a view of the orginal image and is passed through a seprate encoder. This corresponds to the “full graph” model of Eq. 8 with L and ab channels as the two views. As in SplitBrain, we design these two encoders by evenly splitting a given deep network, such as AlexNet (Krizhevsky et al., 2012), into sub-networks across the channel dimension. By concatenating representations layer-wise from these two encoders, we achieve the final representation of an input image. As proposed by previous literature (Oord et al., 2018; Hjelm et al., 2019; Arora et al., 2019), the quality of such a representation is evaluated by freezing the weights of encoder and training linear or non-linear classifiers on top of each layer.
365
+
366
+ # A.1.1 STL-10
367
+
368
+ STL-10 (Coates et al., 2011) is an image recognition dataset designed for developing unsupervised or self-supervised learning algorithms. It consists of 100000 unlabeled training $9 6 \times 9 6$ RGB image samples and 500 labeled samples for each of the 10 classes.
369
+
370
+ Setup. We adopt the same data augmentation strategy and network architecture as those in DIM (Hjelm et al., 2019). A variant of AlexNet takes as input $6 4 \times 6 4$ images, which are randomly cropped and horizontally flipped from the original $9 6 \times 9 6$ size images. For a fair comparison with DIM, we also train our model in a patch-based contrastive fashion during unsupervised pretraining. With the weights of the pre-trained encoder frozen, a two-layer fully connected network with 200 hidden units is trained on top of different layers for 100 epochs to perform 10-way classification. We also investigated the strided crop strategy of CPC (Oord et al., 2018). Fixed sized overlapping patches of size $1 6 \times 1 6$ with an overlap of 8 pixels are cropped and fed into the network separately. This ensures that features of one patch contain minimal information from neighbouring patches; and increases the available number of negative pairs for the contrastive loss. Additionally, we include NCE-based contrastive training and linear classifier evaluation.
371
+
372
+ Comparison. We compare CMC with the state of the art unsupervised methods in Table 5. Three columns are shown: the conv5 and fc7 columns use respectively these layers of AlexNet as the encoder (again remembering that we split across channels for L and ab views). For these two columns we can compare against the all methods except CPC, since CPC does not report these numbers in their paper (Hjelm et al., 2019). In the Strided Crop setup, we only compare against the approaches that use contrastive learning, DIM and CPC, since this method was only used by those works. We note that in Table 5 for all the methods except SplitBrain, we report numbers are shown in the original paper. For SplitBrain, we reimplemented their model faithfully and report numbers based on our reimplementation (we verified the accuracy of our SplitBrain code by the fact that we get very similar results with our reimpementation as in the original paper (Zhang et al., 2017) for ImageNet experiments, see below).
373
+
374
+ The family of contrastive learning methods, such as DIM, CPC, and CMC, achieve higher classification accuracy than other methods such as SplitBrain that use predictive learning; or BiGAN that use adversarial learning. CMC significantly outperforms DIM and CPC in all cases. We hypothesize that this outperformance results from the modeling of cross-view mutual information, where view-specific noisy details are discarded. Another head-to-head comparison happens between CMC and SplitBrain, both of which modeling images as seprated $\mathrm { L }$ and ab streams; we achieve a nearly $8 \%$ absolute improvement for conv5 and $1 \bar { 7 } \%$ improvement for fc5. Finally, we notice that the predictive learning methods suffer from a big drop in performance when the encoding layer is switched from conv5 to fc7. On the other hand, the contrastive learning approaches are much more stable across layers, suggesting that the mutual information maximization paradigm learns more semantically meaningful representations shared by the different views. From a practical perspective, this is a significant advantage as the selection of specific layers should ideally not change downstream performance by too much.
375
+
376
+ In this experiments we used AlexNet as backbone. Switching to more powerful networks such as ResNets is likely to further improve the representation quality.
377
+
378
+ # A.1.2 IMAGENET
379
+
380
+ ImageNet (Deng et al., 2009) consists of 1000 image classes and is frequently considered as a testbed for unsupervised representation learning algorithms.
381
+
382
+ Effect of the number of negative samples. We investigate the relationship between the number of negative pairs $m$ in NCE-based loss and the downstream classification accuracy on a randomly chosen subset of 100 classes of Imagenet (the same set of classes is used for any number of negative pairs). We train a 100-way linear classifier using CMC pre-trained features with varying number of negative pairs, starting from 64 pairs upto 8192 (in multiples of 2). Fig. 6 shows that the accuracy of the resulting classifier steadily increases but saturates at around $6 0 . { \bar { 3 } } \%$ with $m = 4 0 9 6$ samples. AlexNet is used in this study.
383
+
384
+ <table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>classifier</td><td rowspan=1 colspan=1>conv5 fc7</td><td rowspan=1 colspan=1>Strided Crop</td></tr><tr><td rowspan=1 colspan=1>AENAT (Bojanowski &amp; Joulin, 2017)BiGAN (Donahue et al., 2017)SplitBraint (Zhang et al., 2017)</td><td rowspan=1 colspan=1>MLP</td><td rowspan=1 colspan=1>62.19 55.7864.32 61.4371.53 67.1872.35 63.15</td><td rowspan=1 colspan=1>--</td></tr><tr><td rowspan=1 colspan=1>DIM (Hjelm et al., 2019)CPC (Oord et al., 2018)</td><td rowspan=1 colspan=1>MLP</td><td rowspan=1 colspan=1>72.57 70.00- -</td><td rowspan=1 colspan=1>78.2177.81</td></tr><tr><td rowspan=1 colspan=1>CMC+(Patch)CMC+ (Patch)CMC+(NCE)CMC+(NCE)</td><td rowspan=1 colspan=1>LinearMLPLinearMLP</td><td rowspan=1 colspan=1>76.65 79.2580.14 80.1183.28 86.6684.64 86.88</td><td rowspan=1 colspan=1>82.5883.43--</td></tr><tr><td rowspan=1 colspan=1>Supervised</td><td rowspan=1 colspan=3>68.70</td></tr></table>
385
+
386
+ ![](images/b07c045585ce5a17a33bf165d12d05a57188c07fe931c18816160f8d8f8a1442.jpg)
387
+ Table 5: Classification accuracies on STL-10 by using a two layer MLP as classifier for evaluating the representations learned by a small AlexNet. For all methods we compare against, we include the numbers that are reported in the DIM (Hjelm et al., 2019) paper, except for SplitBrain, which is our reimplementation. Methods marked with † have half the number of parameters because of splitting.
388
+ Figure 6: We plot the number of negative examples $m$ in NCE-based contrastive loss against the accuracy for 100 randomly chosen classes of Imagenet 100. It is seen that the accuracy steadily increases with $m$ .
389
+
390
+ # A.2 CMC ON VIDEOS
391
+
392
+ We apply CMC on videos by drawing insight from the two-streams hypothesis (Schneider, 1969; Goodale & Milner, 1992), which posits that human visual cortex consists of two distinct processing streams: the ventral stream, which performs object recognition, and the dorsal stream, which processes motion. In our formulation, given an image $i _ { t }$ that is a frame centered at time $t$ , the ventral stream associates it with a neighbouring frame $i _ { t + k }$ , while the dorsal stream connects it to optical flow $f _ { t }$ centered at $t$ . Therefore, we extract $i _ { t }$ , $i _ { t + k }$ and $f _ { t }$ from two modalities as three views of a video; for optical flow we use the TV-L1 algorithm (Zach et al., 2007). Two separate contrastive learning objectives are built within the ventral stream $( i _ { t } , i _ { t + k } )$ and within the dorsal stream $( i _ { t } , f _ { t } )$ . For the ventral stream, the negative sample for $i _ { t }$ is chosen as a random frame from another randomly chosen video; for the dorsal stream, the negative sample for $i _ { t }$ is chosen as the flow corresponding to a random frame in another randomly chosen video.
393
+
394
+ Pre-training. We train CMC on UCF101 (Soomro et al., 2012) and use two CaffeNets (Krizhevsky et al., 2012) for extracting features from images and optical flows, respectively. In our implementation, $f _ { t }$ represents 10 continuous flow frames centered at $t$ . We use batch size of 128 and contrast each positive pair with 127 negative pairs. CMC is trained with Adam for 300 epochs, with an initial learning rate of 0.001 which is decayed by a factor of 5 after 200 and 250 epochs.
395
+
396
+ Action recognition. We apply the learn representation to the task of action recognition. The spatial network from (Simonyan & Zisserman, 2014) is a well-established paradigm for evaluating pre-trained RGB network on action recognition task. We follow the same spirit and evaluate the transferability of our RGB CaffeNet on UCF101 and HMDB51 datasets. We initialize the action recognition CaffeNet up to conv5 using the weights from the pre-trained RGB CaffeNet. The averaged accuracy over three splits is present in Table 6. Unifying both ventral and dorsal streams during pre-training produces higher accuracy for downstream recognition than using only single stream. Increasing the number of views of the data from 2 to 3 (using both streams instead of one) provides a boost for UCF-101. Furthermore, on UCF-101, we outperform all other methods; and on HMDB-51, CMC is second-best in performance.
397
+
398
+ Table 6: Test accuracy $( \% )$ on UCF-101 which evaluates task transferability and on HMDB-51 which evaluates task and dataset transferability. Most methods either use single RGB view or additional optical flow view, while VGAN explores sound as the second view. \* indicates different network architecture.
399
+
400
+ <table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>#ofViews UCF-101 HMDB-51</td></tr><tr><td rowspan=1 colspan=1>RandomImageNet</td><td rowspan=1 colspan=1>1 48.2 19.51 67.7 28.0</td></tr><tr><td rowspan=1 colspan=1>VGAN* (Vondrick et al.,2016)LT-Motion* (Luo et al., 2017)</td><td rowspan=1 colspan=1>2 52.1 -2 53.0 -</td></tr><tr><td rowspan=6 colspan=1>TempCoh (Mobahi et al., 2009)Shuffle and Learn (Misra et al., 2016)Geometry (Gan et al., 2018)OPN (Lee et al., 2017)ST Order (Buchler et al., 2018)Cross and Learn (Sayed et al., 2018)</td><td rowspan=1 colspan=1>1 45.4 15.9</td></tr><tr><td rowspan=1 colspan=1>1 50.2 18.1</td></tr><tr><td rowspan=1 colspan=1>2 55.1 23.3</td></tr><tr><td rowspan=1 colspan=1>1 56.3 22.1</td></tr><tr><td rowspan=1 colspan=1>1 58.6 25.0</td></tr><tr><td rowspan=1 colspan=1>2 58.7 27.2</td></tr><tr><td rowspan=3 colspan=1>CMC (V)CMC (D)CMC (V+D)</td><td rowspan=1 colspan=1>2 55.3 -</td></tr><tr><td rowspan=1 colspan=1>2 57.1 1</td></tr><tr><td rowspan=1 colspan=1>3 59.1 26.7</td></tr></table>
401
+
402
+ Table 7: Performance on the task of using single view $v$ to predict the semantic labels, where $v$ can be L, ab, depth or surface normal. Our CMC framework improves the quality of unsupervised representations towards that of supervised ones, for all of views investigated. This uses the full-graph paradigm Fig. ??(b).
403
+
404
+ <table><tr><td></td><td>Metric (%)</td><td>L ab</td><td>Depth</td><td>Normal</td></tr><tr><td>Random</td><td>mIoU pix. acc.</td><td>21.4 15.6 45.5 37.7</td><td>30.1 51.1</td><td>29.5 50.5</td></tr><tr><td>CMC</td><td>mIoU pix. acc.</td><td>34.4 26.1 57.0 49.6</td><td>39.2 59.4</td><td>37.8 57.8</td></tr><tr><td>Supervised</td><td>mIoU pix. acc.</td><td>35.9 29.6 57.8 52.6</td><td>41.0 59.1</td><td>41.5 59.6</td></tr></table>
405
+
406
+ # A.3 IS CMC IMPROVING ALL VIEWS?
407
+
408
+ A desirable unsupervised representation learning algorithm operating on multiple views or modalities should improve the quality of representations for all views. We therefore investigate our CMC framwork beyond L channel. To treat all views fairly, we train these encoders following the full graph paradigm, where each view is contrasted with all other views.
409
+
410
+ We evaluate the representation of each view $v$ by predicting the semantic labels from only the representation of $v$ , where $v$ is $\mathrm { L }$ , ab, depth or surface normals. This uses the full-graph paradigm. As in the previous section, we compare CMC with Random and Supervised baselines. As shown in Table 7, the performance of the representations learned by CMC using full-graph significantly outperforms that of randomly projected representations, and approaches the performance of the fully supervised representations. Furthermore, the full-graph representation provides a good representation learnt for all views, showing the importance of capturing different types of mutual information across views.
411
+
412
+ # B CONTRASTING SUB-PATCHES
413
+
414
+ Instead of contrasting features from the last layer, patch-based method (Hjelm et al., 2019) contrasts feature from the last layer with features from previous layers, hence increasing the number of negative pairs. For instance, we use features from the last layer of $f _ { \theta _ { 1 } }$ to contrast with feature points from feature maps produced by the first several conv layers of $f _ { \boldsymbol { \theta _ { 2 } } }$ . This is equivalent to contrast between global patch from one view with local patches from the other view. In this fashion, we directly perform $m + 1$ way softmax classification, the same as (Oord et al., 2018; Hjelm et al., 2019) for a fair comparison in Sec. A.1.1.
415
+
416
+ Such patch-based contrastive loss is computed within each mini-batch and does not require a memory bank. Therefore, deploying it in parallel training schemes is easy and flexible. However, patch-based contrastive loss usually yields suboptimal results compared to NCE-based contrastive loss, according to our experiments.
417
+
418
+ # C PROOFS
419
+
420
+ We prove that: (a) the optimal score function $h _ { \theta } ^ { \ast } ( \{ v _ { 1 } , v _ { 2 } \} )$ is proportional to density ratio between the joint distribution $p ( v _ { 1 } , v _ { 2 } )$ and product of marginals $p ( v _ { 1 } ) p ( v _ { 2 } )$ , as shown in Eq. 5; (b) Minimizing the contrastive loss $\mathcal { L } _ { c o n t r a s t }$ maxmizes a lower bound on the mutual information between two views, as shown in Eq. 6
421
+
422
+ We will use the most generBut we note that replacing of cowith loss is s $\mathcal { L } _ { c o n t r a s t }$ shown in Eq. 1 for our derivation.ward. The overall proof follows a $\mathcal { L } _ { c o n t r a s t }$ $\mathcal { L } _ { c o n t r a s t } ^ { V _ { 1 } , V _ { 2 } }$
423
+ similar derivation introduced in (Oord et al., 2018).
424
+
425
+ # C.1 SCORE FUNCTION AS DENSITY RATIO ESTIMATOR
426
+
427
+ We first show that the optimal score function $h _ { \theta } ^ { \ast } ( \{ v _ { 1 } , v _ { 2 } \} )$ that minimizes Eq. 1 is proportional to the density ratio between joint distribution and product of marginals, shown as Eq. 5. For notation convenience, we denote $p ( v _ { 1 } , v _ { 2 } )$ as data distribution $p _ { d } ( \cdot )$ and $p ( v _ { 1 } ) p ( v _ { 2 } )$ as noise distribution $p _ { n } ( \cdot )$ . The loss in Eq. 1 is indeed a cross-entropy loss of classifying the correct positive pair out from the given set $S$ . Without loss of generality, we assume the first pair $( v _ { 1 } ^ { 0 } , v _ { 2 } ^ { 0 } )$ in $S$ is positive or congruent and all others $( v _ { 1 } ^ { i } , v _ { 2 } ^ { i } ) , i = \bar { 1 } , 2 , . . . , k$ are negative or incongruent. The optimal probability for the loss, $p ( p o s = \dot { 0 } | \bar { S } )$ , should depict the fact that $( v _ { 1 } ^ { 0 } , v _ { 2 } ^ { 0 } )$ comes from the data distribution $p _ { d } ( \cdot )$ while all other pairs come from the noise distribution $p _ { n } ( \cdot )$ . Therefore,
428
+
429
+ $$
430
+ \begin{array} { r c l } { p ( p o s = 0 | S ) } & { = } & { \frac { p _ { d } ( v _ { 1 } ^ { 0 } , v _ { 2 } ^ { 0 } ) \prod _ { i = 1 } ^ { k } p _ { n } ( v _ { 1 } ^ { i } , v _ { 2 } ^ { i } ) } { \sum _ { j = 0 } ^ { k } p _ { d } ( v _ { 1 } ^ { j } , v _ { 2 } ^ { j } ) \prod _ { i \neq j } p _ { n } ( v _ { 1 } ^ { i } , v _ { 2 } ^ { i } ) } } \\ & { = } & { \frac { p ( v _ { 1 } ^ { 0 } , v _ { 2 } ^ { 0 } ) \prod _ { i = 1 } ^ { k } p ( v _ { 1 } ^ { i } ) p ( v _ { 2 } ^ { i } ) } { \sum _ { j = 0 } ^ { k } p ( v _ { 1 } ^ { j } , v _ { 2 } ^ { j } ) \prod _ { i \neq j } p ( v _ { 1 } ^ { i } ) p ( v _ { 2 } ^ { i } ) } } \\ & { = } & { \frac { p ( v _ { 1 } ^ { 0 } , v _ { 2 } ^ { 0 } ) } { \sum _ { j = 0 } ^ { k } \frac { p ( v _ { 1 } ^ { 0 } ) p ( v _ { 2 } ^ { 0 } ) } { p ( v _ { 1 } ^ { 0 } ) p ( v _ { 2 } ^ { k } ) } } } \end{array}
431
+ $$
432
+
433
+ where we plug in the definition of $p _ { d } ( \cdot )$ and $p _ { n } ( \cdot )$ , and divide $\textstyle \prod _ { i = 0 } ^ { k } p ( v _ { 1 } ^ { i } ) p ( v _ { 2 } ^ { 2 } )$ for both the numerator and denominator. By comparing above equation with the loss function in Eq. 1, we can see that the optimal score function $h _ { \theta } ^ { \ast } ( \{ v _ { 1 } , v _ { 2 } \} )$ is proportional to the density ratio $\displaystyle \frac { p ( \boldsymbol { v } _ { 1 } , \boldsymbol { v } _ { 2 } ) } { p ( \boldsymbol { v } _ { 1 } ) p ( \boldsymbol { v } _ { 2 } ) }$ . The above derivation is agnostic to which layer the score function starts from, e.g., $h$ can be defined on either the raw input $( v _ { 1 } , v _ { 2 } )$ or the latent representation $( z _ { 1 } , z _ { 2 } )$ . As we care more about the property of the latent representation, for the following derivation we will use $h _ { W _ { 1 2 } } ^ { * } ( \{ z _ { 1 } , z _ { 2 } \} )$ , which is proportional to $\frac { p ( z _ { 1 } , z _ { 2 } ) } { p ( z _ { 1 } ) p ( z _ { 2 } ) }$
434
+ .
435
+
436
+ # C.2 MAXIMIZING LOWER BOUND ON MI
437
+
438
+ Now we substitute the score function in Eq. 1 with the above density ratio, and the optimal loss objective $\mathcal { L } _ { c o n t r a s t } ^ { o p t }$ becomes:
439
+
440
+ $$
441
+ \begin{array} { r l } { C _ { \mathrm { e x c a n s e s , \alpha } } ^ { ( * ) } } & { = - \frac { \alpha _ { 0 } ^ { 2 } \log [ \alpha _ { 1 } ^ { 2 } ( \frac { \alpha _ { 1 } ^ { 2 } \alpha _ { 2 } ^ { 2 } \sigma _ { 2 } ^ { 2 } } { \sigma _ { 1 } ^ { 2 } \sigma _ { 2 } ^ { 2 } } ) ] } { \sigma _ { 1 } ^ { 2 } } } \\ & { = - \frac { \alpha _ { 0 } ^ { 2 } \log [ \alpha _ { 1 } ^ { 2 } ( \frac { \gamma _ { 1 } ^ { 2 } \sigma _ { 2 } ^ { 2 } \sigma _ { 1 } ^ { 2 } } { \sigma _ { 1 } ^ { 2 } \sigma _ { 2 } ^ { 2 } } ) ] } { \sigma _ { 1 } ^ { 2 } } } \\ & { = \ \frac { \gamma _ { 1 } ^ { 2 } \log [ \alpha _ { 1 } ^ { 2 } - \frac { \gamma _ { 1 } ^ { 2 } \sigma _ { 1 } ^ { 2 } \sigma _ { 1 } ^ { 2 } } { \sigma _ { 1 } ^ { 2 } \sigma _ { 2 } ^ { 2 } } ] } { \sigma _ { 1 } ^ { 2 } \sigma _ { 2 } ^ { 2 } } } \\ & { = \ \frac { \gamma _ { 2 } ^ { 2 } \log [ 1 + \frac { \gamma _ { 1 } ^ { 2 } \sigma _ { 1 } ^ { 2 } \sigma _ { 1 } ^ { 2 } \sigma _ { 1 } ^ { 2 } } { \sigma _ { 1 } ^ { 2 } \sigma _ { 2 } ^ { 2 } } ] } { \sigma _ { 1 } ^ { 2 } \sigma _ { 1 } ^ { 2 } } \frac { \gamma _ { 1 } ^ { 2 } ( \frac { \alpha _ { 1 } ^ { 2 } \sigma _ { 2 } ^ { 2 } \sigma _ { 1 } ^ { 2 } } { \sigma _ { 1 } ^ { 2 } \sigma _ { 2 } ^ { 2 } } ) } { \sigma _ { 1 } ^ { 2 } \sigma _ { 2 } ^ { 2 } } } \\ & \stackrel { ( * ) } { = } \ \frac { \gamma _ { 2 } ^ { 2 } \operatorname { m a x } [ 1 + \frac { \gamma _ { 1 } ^ { 2 } \sigma _ { 1 } ^ { 2 } \sigma _ { 1 } ^ { 2 } } { \sigma _ { 1 } ^ { 2 } \sigma _ { 1 } ^ { 2 } \sigma _ { 1 } ^ { 2 } } ] } \\ & = \ \frac \gamma _ { 1 } ^ { 2 } \operatorname { m a x } [ \alpha _ { 1 } ^ \end{array}
442
+ $$
443
+
444
+ herefore, for any two views increases, the approximatio $V _ { i }$ and tep b $V _ { j }$ , we have omes mor $I ( z _ { i } ; z _ { j } ) \geq \log ( k ) - \mathcal { L } _ { c o n t r a s t } ^ { o p t } ( V _ { i } , V _ { j } )$ $k$ $k$ $\overset { \cdot } { \mathcal { L } } _ { k } ( V _ { i } , V _ { j } )$ maximizes the lower bound on the mutual information $I ( z _ { i } ; z _ { j } )$ . We should note that increasing $k$ to infinity does not always lead to a higher lower bound. While $\log ( k )$ increases with a larger $k$ , the optimization problem becomes harder and $\mathcal { L } _ { k } ( V _ { i } , V _ { j } )$ also increases.
445
+
446
+ # D IMPLEMENTATION DETAILS
447
+
448
+ # D.1 STL-10
449
+
450
+ For a fair comparison with DIM (Hjelm et al., 2019) and CPC (Oord et al., 2018), we adopt the same architecture as that used in DIM and split it into two encoders, each shown as in Table 8. For the implementation of the score function, we adopt similar “encoder-and-dot-product” strategy, which is tantamount to a bilinear model.
451
+
452
+ In the patch-based contrastive learning stage, we use Adam optimizer with an initial learning rate of 0.001, $\beta _ { 1 } = 0 . 5$ , $\beta _ { 2 } = 0 . 9 9 9$ . We train for a total of 200 epochs with learning rate decayed by 0.2 after 120 and 160 epochs. In the non-linear classifier evaluation stage, we use the same optimizer setting. For the NCE-based contrastive learning stage, we train for 320 epochs with the learning rate initialized as 0.03 and further decayed by 10 for every 40 epochs after the first 200 epochs. The temperature $\tau$ is set as 0.1. In general, $\dot { \tau } \in [ \dot { 0 } . 0 5 , 0 . 2 ]$ works reasonably well.
453
+
454
+ # D.2 IMAGENET
455
+
456
+ For patch-based contrastive loss, we use the same optimizer setting as in Sec. D.1 except that the learning rate is initialized as 0.01.
457
+
458
+ For NCE-basd contrastive loss in both full ImageNet and ImageNet100 experiments present in Sec. A.1.2, the encoder architecture used for either $\mathrm { L }$ or ab channels is shown in Table 9. In the unsupervised learning stage of AlexNet, we use SGD to train the network for a total of 400 epochs. The temperature $\tau$ is set as 0.07 by following previous work (Wu et al., 2018). The learning rate is initialized as 0.03 with a decay of 10 for every 50 epochs after the first 250 epochs. Weight decay is
459
+
460
+ Table 8: The variant of AlexNet architecture used in our CMC for STL-10 (only half is present here due to splitting). $\mathbf { X }$ spatial resolution of layer, C number of channels in layer; K conv or pool kernel size; S computation stride; $\mathbf { P }$ padding; \* channel size is dependent on the input source, e.g. 1 for L channel and 2 for ab channel.
461
+
462
+ <table><tr><td colspan="6">Half of AlexNet(Krizhevsky et al., 2012) for STL-10</td></tr><tr><td>Layer</td><td>X</td><td>C</td><td>K</td><td>S</td><td>P</td></tr><tr><td>data</td><td>64</td><td>*</td><td>1</td><td>1</td><td>1</td></tr><tr><td>conv1</td><td>64</td><td>48</td><td>3</td><td>1</td><td>1</td></tr><tr><td>pool1</td><td>31</td><td>48</td><td>3</td><td>2</td><td>0</td></tr><tr><td>conv2</td><td>31</td><td>96</td><td>3</td><td>1</td><td>1</td></tr><tr><td>pool2</td><td>15</td><td>96</td><td>3</td><td>2</td><td>0</td></tr><tr><td>conv3</td><td>15</td><td>192</td><td>3</td><td>1</td><td>1</td></tr><tr><td>conv4</td><td>15</td><td>192</td><td>3</td><td>1</td><td>1</td></tr><tr><td>conv5</td><td>15</td><td>96</td><td>3</td><td>1</td><td>1</td></tr><tr><td>pool5</td><td>7</td><td>96</td><td>3</td><td>2</td><td>0</td></tr><tr><td>fc6</td><td>1</td><td>2048</td><td>7</td><td>1</td><td>0</td></tr><tr><td>fc7</td><td>1</td><td>2048</td><td>1</td><td>1</td><td>0</td></tr><tr><td>fc8</td><td>1</td><td>64</td><td>1</td><td>1</td><td>0</td></tr></table>
463
+
464
+ set as $1 0 ^ { - 4 }$ and momentum is kept as 0.9. For the linear classification stage, we train for 160 epochs.
465
+ The learning rate is initialized as 0.1 and decayed by 0.2 every 20 epochs after the first 100 epochs.
466
+ We set weight decay as 0 and momentum as 0.9.
467
+
468
+ For ResNets in CMC stage, there are three differences. First, we use larger learning rate, that is, we set a base learning rate of 0.03 for every 128 images and then roughly scale it up with the batch size. Specifically, we train: (1) ResNet-50 with $b s z = 2 8 0$ and $l r = 0 . 0 8$ ; (2) ResNet-101 with $b s z = 2 0 0$ and $l r = 0 . 0 5$ ; (3) ResNet- $5 0 ~ \mathrm { x } 2 $ with $b s z = 1 5 6$ and $l r = 0 . 0 4$ . Second, we only train for 280 epochs with learning rate decayed at 160, 200, and 240 epochs. Third, we used Fast Autoaugment (Lim et al., 2019) as data augmentation. In the linear evaluation stage, we train for 100 epochs. The learning rate is initialized as 30 for ResNet-50 and ResNet-101, and 50 for ResNet-50 $_ { \mathbf { X } 2 }$ . It is decayed by 0.2 every 15 epochs after the first 60 epochs. We set weight decay as 0 and momentum as 0.9.
469
+
470
+ <table><tr><td colspan="6">Half of AlexNet(Krizhevsky et al., 2012) for ImageNet</td></tr><tr><td>Layer</td><td>X</td><td>C</td><td>K</td><td>S</td><td>P</td></tr><tr><td>data</td><td>224</td><td>*</td><td>1</td><td>1</td><td>1</td></tr><tr><td>conv1</td><td>55</td><td>48</td><td>11</td><td>4</td><td>2</td></tr><tr><td>pool1</td><td>27</td><td>48</td><td>3</td><td>2</td><td>0</td></tr><tr><td>conv2</td><td>27</td><td>128</td><td>5</td><td>1</td><td>2</td></tr><tr><td>pool2</td><td>13</td><td>128</td><td>3</td><td>2</td><td>0</td></tr><tr><td>conv3</td><td>13</td><td>192</td><td>3</td><td>1</td><td>1</td></tr><tr><td>conv4</td><td>13</td><td>192</td><td>3</td><td>1</td><td>1</td></tr><tr><td>conv5</td><td>13</td><td>128</td><td>3</td><td>1</td><td>1</td></tr><tr><td>pool5</td><td>6</td><td>128</td><td>3</td><td>2</td><td>0</td></tr><tr><td>fc6</td><td>1</td><td>2048</td><td>6</td><td>1</td><td>0</td></tr><tr><td>fc7</td><td>1</td><td>2048</td><td>1</td><td>1</td><td>0</td></tr><tr><td>fc8</td><td>1</td><td>128</td><td>1</td><td>1</td><td>0</td></tr></table>
471
+
472
+ # D.3 UCF101 AND HMDB51
473
+
474
+ Following previous work (Misra et al., 2016; Lee et al., 2017; Sayed et al., 2018; Buchler et al., 2018), we use CaffeNet for the video experiments. We tailor the network and use features from the fc6 layer for contrastive learning. Dropout of 0.5 is used to alleviate overfitting.
475
+
476
+ # D.4 NYU DEPTH-V2
477
+
478
+ While experimenting with different views on NYU Depth-V2 dataset, we encode the features from patches with a size of $1 2 8 \times 1 2 8$ . The detailed architecture is shown in Table 10. In the unsupervised training stage, we use Adam optimizer with an initial learning rate of 0.001, $\beta _ { 1 } = 0 . 5$ , $\beta _ { 2 } = 0 . 9 9 9$ . We train for a total of 3000 epochs with learning rate decayed by 0.2 after 2000, 2400, and 2800 epochs. For the downstream semantic segmentation task, we use the same optimizer setting but train for fewer epochs. We only train 200 epochs for CMC pre-trained models, and train 1000 epochs for the Random and Supervised baselines until convergence. For the classification task evaluated on STL-10, we use the same optimizer setting as in Sec. D.1 to report numbers in Table 2.
479
+
480
+ <table><tr><td colspan="5">Encoder Architecture on NYU</td></tr><tr><td>Layer</td><td>X</td><td>C</td><td>K</td><td>S P</td></tr><tr><td>data</td><td>128</td><td>*</td><td>1</td><td></td></tr><tr><td>conv1</td><td>64</td><td>64</td><td>8 2</td><td>3</td></tr><tr><td>pool1</td><td>32</td><td>64</td><td>2 2</td><td>0</td></tr><tr><td>conv2</td><td>16</td><td>128</td><td>4 2</td><td>1</td></tr><tr><td>conv3</td><td>8</td><td>256</td><td>4 2</td><td>1</td></tr><tr><td>conv4</td><td>8</td><td>256</td><td>3 1</td><td>1</td></tr><tr><td>conv5</td><td>4</td><td>512</td><td>4 2</td><td></td></tr><tr><td>fc6</td><td>1</td><td>512</td><td>4</td><td>0</td></tr><tr><td>fc7</td><td>1</td><td>256</td><td>1 1</td><td>0</td></tr></table>
md/train/H1tSsb-AW/H1tSsb-AW.md ADDED
@@ -0,0 +1,481 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # VARIANCE REDUCTION FOR POLICY GRADIENT WITH ACTION-DEPENDENT FACTORIZED BASELINES
2
+
3
+ Cathy $\mathbf { W } \mathbf { u } ^ { 1 }$ , Aravind Rajeswaran2, Yan Duan13, Vikash Kumar2, Alexandre M Bayen14, Sham Kakade2, Igor Mordatch3, Pieter Abbeel13 cathywu@eecs.berkeley.edu, aravraj@cs.washington.edu, rockyduan@eecs.berkeley.edu, vikash@cs.washington.edu, bayen@berkeley.edu, sham@cs.washington.edu, igor.mordatch@gmail.com, pabbeel@cs.berkeley.edu
4
+
5
+ 1 Department of EECS, UC Berkeley
6
+ 2 Department of CSE, University of Washington
7
+ 3 OpenAI
8
+ 4 Institute for Transportation Studies, UC Berkeley
9
+
10
+ # ABSTRACT
11
+
12
+ Policy gradient methods have enjoyed great success in deep reinforcement learning but suffer from high variance of gradient estimates. The high variance problem is particularly exasperated in problems with long horizons or high-dimensional action spaces. To mitigate this issue, we derive a bias-free action-dependent baseline for variance reduction which fully exploits the structural form of the stochastic policy itself and does not make any additional assumptions about the MDP. We demonstrate and quantify the benefit of the action-dependent baseline through both theoretical analysis as well as numerical results, including an analysis of the suboptimality of the optimal state-dependent baseline. The result is a computationally efficient policy gradient algorithm, which scales to high-dimensional control problems, as demonstrated by a synthetic 2000-dimensional target matching task. Our experimental results indicate that action-dependent baselines allow for faster learning on standard reinforcement learning benchmarks and highdimensional hand manipulation and synthetic tasks. Finally, we show that the general idea of including additional information in baselines for improved variance reduction can be extended to partially observed and multi-agent tasks.
13
+
14
+ # 1 INTRODUCTION
15
+
16
+ Deep reinforcement learning has achieved impressive results in recent years in domains such as video games from raw visual inputs (Mnih et al., 2015), board games (Silver et al., 2016), simulated control tasks (Schulman et al., 2016; Lillicrap et al., 2016; Rajeswaran et al., 2017a), and robotics (Levine et al., 2016). An important class of methods behind many of these success stories are policy gradient methods (Williams, 1992; Sutton et al., 2000; Kakade, 2002; Schulman et al., 2015; Mnih et al., 2016), which directly optimize parameters of a stochastic policy through local gradient information obtained by interacting with the environment using the current policy. Policy gradient methods operate by increasing the log probability of actions proportional to the future rewards influenced by these actions. On average, actions which perform better will acquire higher probability, and the policy’s expected performance improves.
17
+
18
+ A critical challenge of policy gradient methods is the high variance of the gradient estimator. This high variance is caused in part due to difficulty in credit assignment to the actions which affected the future rewards. Such issues are further exacerbated in long horizon problems, where assigning credits properly becomes even more challenging. To reduce variance, a “baseline” is often employed, which allows us to increase or decrease the log probability of actions based on whether they perform better or worse than the average performance when starting from the same state. This is particularly useful in long horizon problems, since the baseline helps with temporal credit assignment by removing the influence of future actions from the total reward. A better baseline, which predicts the average performance more accurately, will lead to lower variance of the gradient estimator.
19
+
20
+ The key insight of this paper is that when the individual actions produced by the policy can be decomposed into multiple factors, we can incorporate this additional information into the baseline to further reduce variance. In particular, when these factors are conditionally independent given the current state, we can compute a separate baseline for each factor, whose value can depend on all quantities of interest except that factor. This serves to further help credit assignment by removing the influence of other factors on the rewards, thereby reducing variance. In other words, information about the other factors can provide a better evaluation of how well a specific factor performs. Such factorized policies are very common, with some examples listed below.
21
+
22
+ • In continuous control and robotics tasks, multivariate Gaussian policies with a diagonal covariance matrix are often used. In such cases, each action coordinate can be considered a factor. Similarly, factorized categorical policies are used in game domains like board games and Atari. • In multi-agent and distributed systems, each agent deploys its own policy, and thus the actions of each agent can be considered a factor of the union of all actions (by all agents). This is particularly useful in the recent emerging paradigm of centralized learning and decentralized execution (Foerster et al., 2017; Lowe et al., 2017). In contrast to the previous example, where factorized policies are a common design choice, in these problems they are dictated by the problem setting.
23
+
24
+ We demonstrate that action-dependent baselines consistently improve the performance compared to baselines that use only state information. The relative performance gain is task-specific, but in certain tasks, we observe significant speed-up in the learning process. We evaluate our proposed method on standard benchmark continuous control tasks, as well as on a high-dimensional door opening task with a five-fingered hand, a synthetic high-dimensional target matching task, on a blind peg insertion POMDP task, and a multi-agent communication task. We believe that our method will facilitate further applications of reinforcement learning methods in domains with extremely highdimensional actions, including multi-agent systems. Videos and additional results of the paper are available at https://sites.google.com/view/ad-baselines.
25
+
26
+ # 2 RELATED WORKS
27
+
28
+ Three main classes of methods for reinforcement learning include value-based methods (Watkins & Dayan, 1992), policy-based methods (Williams, 1992; Kakade, 2002; Schulman et al., 2015), and actor-critic methods (Konda & Tsitsiklis, 2000; Peters & Schaal, 2008; Mnih et al., 2016). Valuebased and actor-critic methods usually compute a gradient of the objective through the use of critics, which are often biased, unless strict compatibility conditions are met (Sutton et al., 2000; Konda & Tsitsiklis, 2000). Such conditions are rarely satisfied in practice due to the use of stochastic gradient methods and powerful function approximators. In comparison, policy gradient methods are able to compute an unbiased gradient, but suffer from high variance. Policy gradient methods are therefore usually less sample efficient, but can be more stable than critic-based methods (Duan et al., 2016).
29
+
30
+ A large body of work has investigated variance reduction techniques for policy gradient methods. One effective method to reduce variance without introducing bias is through using a baseline, which has been widely studied (Sutton & Barto, 1998; Weaver & Tao, 2001; Greensmith et al., 2004; Schulman et al., 2016). However, fully exploiting the factorizability of the policy probability distribution to further reduce variance has not been studied. Recently, methods like Q-Prop (Gu et al., 2017) make use of an action-dependent control variate, a technique commonly used in Monte Carlo methods and recently adopted for RL. Since Q-Prop utilizes off-policy data, it has the potential to be more sample efficient than pure on-policy methods. However, Q-prop is significantly more computationally expensive, since it needs to perform a large number of gradient updates on the critic using the off-policy data, thus not suitable with fast simulators. In contrast, our formulation of action-dependent baselines has little computational overhead, and improves the sample efficiency compared to on-policy methods with state-only baseline.
31
+
32
+ The idea of using additional information in the baseline or critic has also been studied in other contexts. Methods such as Guided Policy Search (Levine et al., 2016; Mordatch et al., 2015) and variants train policies that act on high-dimensional observations like images, but use a low dimensional encoding of the problem like joint positions during the training process. Recent efforts in multi-agent systems (Foerster et al., 2017; Lowe et al., 2017) also use additional information in the centralized training phase to speed-up learning. However, using the structure in the policy parameterization itself to enhance the learning speed, as we do in this work, has not been explored.
33
+
34
+ # 3 PRELIMINARIES
35
+
36
+ In this section, we establish the notations used throughout this paper, as well as basic results for policy gradient methods, and variance reduction via baselines.
37
+
38
+ # 3.1 NOTATION
39
+
40
+ This paper assumes a discrete-time Markov decision process (MDP), defined by $( S , \mathcal { A } , \mathcal { P } , r , \rho _ { 0 } , \gamma )$ , in which $S \subseteq \mathbb { R } ^ { n }$ is an $n$ -dimensional state space, $\mathcal { A } \subseteq \mathbb { R } ^ { m }$ an $m$ -dimensional action space, $\mathcal { P } : \mathcal { S } \times \mathcal { A } \times \mathcal { S } \mathbb { R } _ { + }$ a transition probability function, $r : S \times \mathcal { A } \mathbb { R }$ a bounded reward function, $\rho _ { 0 } : { \mathcal { S } } \mathbb { R } _ { + }$ an initial state distribution, and $\gamma \in ( 0 , 1 ]$ a discount factor. The presented models are based on the optimization of a stochastic policy $\pi _ { \theta } : \mathcal { S } \times \mathcal { A } \to \mathbb { R } _ { + }$ parameterized by $\theta$ . Let $\eta ( \pi _ { \theta } )$ denote its expected return: $\begin{array} { r } { \eta ( \pi _ { \theta } ) = \mathbb { E } _ { \tau } [ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } r ( s _ { t } , a _ { t } ) ] } \end{array}$ , where ${ \boldsymbol \tau } = ( s _ { 0 } , a _ { 0 } , \ldots )$ denotes the whole trajectory, $s _ { 0 } \sim \rho _ { 0 } ( s _ { 0 } )$ , $a _ { t } \sim \pi _ { \theta } ( a _ { t } | s _ { t } )$ , and $s _ { t + 1 } \sim \mathcal { P } ( s _ { t + 1 } | s _ { t } , a _ { t } )$ for all $t$ . Our goal is to find the optimal policy arg $\operatorname* { m a x } _ { \theta } \eta ( \pi _ { \theta } )$ . We will use $\hat { Q } ( s _ { t } , a _ { t } )$ to describe samples of cumulative discounted return, and $Q ( a _ { t } , s _ { t } )$ to describe a function approximation of $\hat { Q } ( s _ { t } , a _ { t } )$ . We will use ”Q-function” when describing an abstract action-value function.
41
+
42
+ For a partially observable Markov decision process (POMDP), two more components are required, namely $\Omega$ , a set of observations, and $\mathcal { O } : \mathcal { S } \times \Omega \mathbb { R } _ { \ge 0 }$ , the observation probability distribution. In the fully observable case, $\Omega \equiv s$ . Though the analysis in this article is written for policies over states, the same analysis can be done for policies over observations.
43
+
44
+ # 3.2 THE SCORE FUNCTION (SF) ESTIMATOR
45
+
46
+ An important technique used in the derivation of the policy gradient is known as the score function (SF) estimator (Williams, 1992), which also comes up in the justification of baselines. Suppose that we want to estimate $\nabla _ { \theta } \mathbb { E } _ { x } [ f ( x ) ]$ where $x \sim p _ { \theta } ( x )$ , and the family of distributions $\{ p _ { \theta } ( x ) : \theta \in \Theta \}$ has common support. Further suppose that $\log p _ { \theta } ( x )$ is continuous in $\theta$ . In this case we have
47
+
48
+ $$
49
+ \begin{array} { l } { \nabla _ { \theta } \mathbb { E } _ { x } [ f ( x ) ] = \nabla _ { \theta } \displaystyle \int p _ { \theta } ( x ) f ( x ) d x = \int p _ { \theta } ( x ) \frac { \nabla _ { \theta } p _ { \theta } ( x ) } { p _ { \theta } ( x ) } f ( x ) d x } \\ { \displaystyle = \int p _ { \theta } ( x ) \nabla _ { \theta } \log p _ { \theta } ( x ) f ( x ) d x = \mathbb { E } _ { x } \left[ \nabla _ { \theta } \log p _ { \theta } ( x ) f ( x ) \right] . } \end{array}
50
+ $$
51
+
52
+ # 3.3 POLICY GRADIENT
53
+
54
+ The Policy Gradient Theorem (Sutton et al., 2000) states that
55
+
56
+ $$
57
+ \nabla _ { \theta } \eta ( \pi _ { \theta } ) = \mathbb { E } _ { \tau } \left[ \sum _ { t = 0 } ^ { \infty } \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } | s _ { t } ) \sum _ { t ^ { \prime } = t } ^ { \infty } \gamma ^ { t ^ { \prime } - t } r _ { t ^ { \prime } } \right] .
58
+ $$
59
+
60
+ For convenience, define $\begin{array} { r } { \rho _ { \pi } ( s ) = \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } p ( s _ { t } = s ) } \end{array}$ as the state visitation frequency, and $\begin{array} { r } { \hat { Q } ( s _ { t } , a _ { t } ) = \sum _ { t ^ { \prime } = t } ^ { \infty } \gamma ^ { t ^ { \prime } - t } r _ { t ^ { \prime } } } \end{array}$ . We can rewrite the above equation (with abuse of notation) as
61
+
62
+ $$
63
+ \begin{array} { r } { \nabla _ { \theta } \eta ( \pi _ { \theta } ) = \mathbb { E } _ { \rho _ { \pi } , \pi } \left[ \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } | s _ { t } ) \hat { Q } ( s _ { t } , a _ { t } ) \right] . } \end{array}
64
+ $$
65
+
66
+ It is further shown that we can reduce the variance of this gradient estimator without introducing bias by subtracting off a quantity dependent on $s _ { t }$ from $\hat { Q } ( s _ { t } , a _ { t } )$ (Williams, 1992; Greensmith et al., 2004). See Appendix A for a derivation of the optimal state-dependent baseline.
67
+
68
+ $$
69
+ \nabla _ { \theta } \eta ( \pi _ { \theta } ) = \mathbb { E } _ { \rho _ { \pi } , \pi } \left[ \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } | s _ { t } ) \left( \hat { Q } ( s _ { t } , a _ { t } ) - b ( s _ { t } ) \right) \right]
70
+ $$
71
+
72
+ This is valid because, applying the SF estimator in the opposite direction, we have
73
+
74
+ $$
75
+ \mathbb { E } _ { a _ { t } } \left[ \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } | s _ { t } ) b ( s _ { t } ) \right] = \nabla _ { \theta } \mathbb { E } _ { a _ { t } } \left[ b ( s _ { t } ) \right] = 0
76
+ $$
77
+
78
+ In practice there can be rich internal structure in the policy parameterization. For example, for continuous control tasks, a very common parameterization is to make $\pi _ { \boldsymbol { \theta } } \big ( \boldsymbol { a } _ { t } | \boldsymbol { s } _ { t } \big )$ a multivariate Gaussian with diagonal variance, in which case each dimension $a _ { t } ^ { i }$ of the action $a _ { t }$ is conditionally independent of other dimensions, given the current state $s _ { t }$ . Another example is when the policy outputs a tuple of discrete actions with factorized categorical distributions. In the following subsections, we show that such structure can be exploited to further reduce the variance of the gradient estimator without introducing bias by changing the form of the baseline. Then, we derive the optimal action-dependent baseline for a class of problems and analyze the suboptimality of non-optimal baselines in terms of variance reduction. We then propose several practical baselines for implementation purposes. We conclude the section with the overall policy gradient algorithm with action-dependent baselines for factorized policies. We provide an exposition for situations when the conditional independence assumption does not hold, such as for stochastic policies with general covariance structures, in Appendix E, and for compatibility with other variance reduction techniques in Appendix F.
79
+
80
+ # 4.1 BASELINES FOR POLICIES WITH CONDITIONALLY INDEPENDENT FACTORS
81
+
82
+ In the following, we analyze action-dependent baselines for policies with conditionally independent factors. For example, multivariate Gaussian policies with a diagonal covariance structure are commonly used in continuous control tasks. Assuming an $m$ -dimensional action space, we have $\begin{array} { r } { \pi _ { \theta } ( a _ { t } | s _ { t } ) ^ { \bullet } = \prod _ { i = 1 } ^ { m } \pi _ { \theta } ( a _ { t } ^ { i } | s _ { t } ) } \end{array}$ . Hence
83
+
84
+ $$
85
+ \nabla _ { \theta } \eta ( \pi _ { \theta } ) = \mathbb { E } _ { \rho _ { \pi } , \pi } \left[ \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } | s _ { t } ) \hat { Q } ( s _ { t } , a _ { t } ) \right] = \mathbb { E } _ { \rho _ { \pi } , \pi } \left[ \sum _ { i = 1 } ^ { m } \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } ^ { i } | s _ { t } ) \hat { Q } ( s _ { t } , a _ { t } ) \right]
86
+ $$
87
+
88
+ In this case, we can set $b _ { i }$ , the baseline for the $i$ th factor, to depend on all other actions in addition to the state. Let $a _ { t } ^ { - i }$ denote all dimensions other than $i$ in $a _ { t }$ and denote the $i$ th baseline by $b _ { i } ( s _ { t } , a _ { t } ^ { - i } )$ . Due to conditional independence and the score function estimator, we have
89
+
90
+ $$
91
+ \begin{array} { r l } & { \mathbb { E } _ { a _ { t } } \left[ \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } ^ { i } | s _ { t } ) b _ { i } ( s _ { t } , a _ { t } ^ { - i } ) \right] = \mathbb { E } _ { a _ { t } ^ { - i } } \left[ \nabla _ { \theta } \mathbb { E } _ { a _ { t } ^ { i } } \left[ b _ { i } ( s _ { t } , a _ { t } ^ { - i } ) \right] \right] = 0 } \end{array}
92
+ $$
93
+
94
+ Hence we can use the following gradient estimator
95
+
96
+ $$
97
+ \nabla _ { \theta } \eta ( \pi _ { \theta } ) = \mathbb { E } _ { \rho _ { \pi } , \pi } \left[ \sum _ { i = 1 } ^ { m } \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } ^ { i } | s _ { t } ) \left( \hat { Q } ( s _ { t } , a _ { t } ) - b _ { i } ( s _ { t } , a _ { t } ^ { - i } ) \right) \right]
98
+ $$
99
+
100
+ This is compatible with advantage function form of the policy gradient (Schulman et al., 2016):
101
+
102
+ $$
103
+ \nabla _ { \theta } \eta ( \pi _ { \theta } ) = \mathbb { E } _ { \rho _ { \pi } , \pi } \left[ \sum _ { i = 1 } ^ { m } \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } ^ { i } | s _ { t } ) \hat { A } _ { i } ( s _ { t } , a _ { t } ) \right]
104
+ $$
105
+
106
+ where ${ \hat { A } } _ { i } ( s _ { t } , a _ { t } ) = Q ( s _ { t } , a _ { t } ) - b _ { i } \big ( s _ { t } , a _ { t } ^ { - i } \big )$ . Note that the policy gradient now comprises of $m$ component policy gradient terms, each with a different advantage term.
107
+
108
+ In Appendix E, we show that the methodology also applies to general policy structures (for example, a Gaussian policy with a general covariance structure), where the conditional independence assumption does not hold. The result is bias-free albeit different baselines.
109
+
110
+ # 4.2 OPTIMAL ACTION-DEPENDENT BASELINE
111
+
112
+ In this section, we derive the optimal action-dependent baseline and show that it is better than the state-only baseline. We seek the optimal baseline to minimize the variance of the policy gradient estimate. First, we write out the variance of the policy gradient under any action-dependent baseline. Let us define $z _ { i } : = \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } ^ { i } | s _ { t } )$ and the component policy gradient:
113
+
114
+ $$
115
+ \begin{array} { r } { \nabla \eta _ { i } ( \pi _ { \theta } ) : = \mathbb { E } _ { \rho _ { \pi } , \pi } \left[ \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } ^ { i } | s _ { t } ) \left( \hat { Q } ( s _ { t } , a _ { t } ) - b _ { i } ( s _ { t } , a _ { t } ^ { - i } ) \right) \right] . } \end{array}
116
+ $$
117
+
118
+ For simplicity of exposition, we make the following assumption:
119
+
120
+ $$
121
+ \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } ^ { i } | s _ { t } ) ^ { T } \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } ^ { j } | s _ { t } ) \equiv z _ { i } ^ { T } z _ { j } = 0 , \quad \forall i \neq j
122
+ $$
123
+
124
+ which translates to meaning that different subsets of parameters strongly influence different action dimensions or factors. We note that this assumption is primarily for the theoretical analysis to be clean, and is not required to run the algorithm in practice. In particular, even without this assumption, the proposed baseline is bias-free. When the assumption holds, the optimal actiondependent baseline can be analyzed thoroughly. Some examples where these assumptions do hold include multi-agent settings where the policies are conditionally independent by construction, cases where the policy acts based on independent components (Cao et al., 2007) of the observation space, and cases where different function approximators are used to control different actions or synergies (Todorov & Ghahramani, 2004; Todorov et al., 2005) without weight sharing.
125
+
126
+ The optimal action-dependent baseline is then derived to be:
127
+
128
+ $$
129
+ b _ { i } ^ { * } ( s _ { t } , a _ { t } ^ { - i } ) = \frac { \mathbb { E } _ { a _ { t } ^ { i } } \left[ \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } ^ { i } | s _ { t } ) ^ { T } \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } ^ { i } | s _ { t } ) \hat { Q } ( s _ { t } , a _ { t } ) \right] } { \mathbb { E } _ { a _ { t } ^ { i } } \left[ \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } ^ { i } | s _ { t } ) ^ { T } \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } ^ { i } | s _ { t } ) \right] } .
130
+ $$
131
+
132
+ See Appendix B for the full derivation. Since the optimal action-dependent baseline is different for different action coordinates, it is outside the family of state-dependent baselines barring pathological cases.
133
+
134
+ # 4.3 SUBOPTIMALITY OF THE OPTIMAL STATE-DEPENDENT BASELINE
135
+
136
+ How much do we reduce variance over a traditional baseline that only depends on state? We use the following notation:
137
+
138
+ $$
139
+ \begin{array} { r l } & { Z _ { i } : = Z _ { i } \bigl ( s _ { t } , a _ { t } ^ { - i } \bigr ) = \mathbb { E } _ { a _ { t } ^ { i } } \left[ \nabla _ { \theta } \log \pi _ { \theta } \bigl ( a _ { t } ^ { i } \big | s _ { t } \bigr ) ^ { T } \nabla _ { \theta } \log \pi _ { \theta } \bigl ( a _ { t } ^ { i } \big | s _ { t } \bigr ) \right] } \\ & { Y _ { i } : = Y _ { i } \bigl ( s _ { t } , a _ { t } ^ { - i } \bigr ) = \mathbb { E } _ { a _ { t } ^ { i } } \left[ \nabla _ { \theta } \log \pi _ { \theta } \bigl ( a _ { t } ^ { i } \big | s _ { t } \bigr ) ^ { T } \nabla _ { \theta } \log \pi _ { \theta } \bigl ( a _ { t } ^ { i } \big | s _ { t } \bigr ) \hat { Q } \bigl ( s _ { t } , a _ { t } \bigr ) \right] } \end{array}
140
+ $$
141
+
142
+ Then, using Equation (51) (Appendix C), we show the following improvement with the optimal action-dependent baseline:
143
+
144
+ $$
145
+ I _ { b = b ^ { * } ( s ) } = \sum _ { i } \mathbb { E } _ { \rho _ { \pi } , a _ { t } ^ { - i } } \left[ \frac { 1 } { Z _ { i } } \left( \frac { Z _ { i } } { \sum _ { j } Z _ { j } } \sum _ { j } Y _ { j } - Y _ { i } \right) ^ { 2 } \right]
146
+ $$
147
+
148
+ See Appendices $\textrm { C }$ and $\mathbf { D }$ for the full derivation. We conclude that the optimal action-dependent baseline does not degenerate into the optimal state-dependent baseline. Equation (15) states that the variance difference is a weighted sum of the deviation of the per-component score-weighted marginalized Q (denoted $Y _ { i }$ ) from the component weight (based on score only, not Q) of the overall aggregated marginalized Q values (denoted $\textstyle \sum _ { j } Y _ { j } )$ . This suggests that the difference is particularly large when the Q function is highly sensitive to the actions, especially along those directions that influence the gradient the most. Our empirical results in Section 5 additionally demonstrate the benefit of action-dependent over state-only baselines.
149
+
150
+ # 4.4 MARGINALIZATION OF THE GLOBAL ACTION-VALUE FUNCTION
151
+
152
+ Using the previous theory, we now consider various baselines that could be used in practice and their associated computational cost.
153
+
154
+ Marginalized Q baseline Even though the optimal state-only baseline is known, it is rarely used in practice (Duan et al., 2016). Rather, for both computational and conceptual benefit, the choice of $b ( s _ { t } ) = \mathbb { E } _ { a _ { t } } [ \hat { Q } ( s _ { t } , a _ { t } ) ] = V ( s _ { t } )$ is often used. Similarly, we propose to use $b _ { i } ( s _ { t } , a _ { t } ^ { - i } ) ~ =$ $\mathbb { E } _ { a _ { t } ^ { i } } \left[ \hat { Q } ( s _ { t } , a _ { t } ) \right]$ which is the action-dependent analogue. In particular, when log probability of each policy factor is loosely correlated with the action-value function, then the proposed baseline is close to the optimal baseline.
155
+
156
+ $$
157
+ I _ { b = \mathbb { E } _ { a _ { t } ^ { i } } [ \hat { Q } ( a _ { t } , s _ { t } ) ] } = \sum _ { i } \mathbb { E } _ { \rho _ { \tau , a _ { t } ^ { - i } } } \left[ Z _ { i } \left( \mathbb { E } _ { a ^ { i } } \left[ \hat { Q } ( a _ { t } , s _ { t } ) \right] - \frac { \mathbb { E } _ { a _ { t } ^ { i } } \left[ z _ { i } ^ { T } z _ { i } \hat { Q } ( s _ { t } , a _ { t } ) \right] } { \mathbb { E } _ { a _ { t } ^ { i } } \left[ z _ { i } ^ { T } z _ { i } \right] } \right) ^ { 2 } \right] \approx 0
158
+ $$
159
+
160
+ This has the added benefit of requiring learning only one function approximator, for estimating $Q ( s _ { t } , a _ { t } )$ , and implicitly using it to obtain the baselines for each action coordinate. That is, $Q ( s _ { t } , a _ { t } )$ is a function approximating samples $\hat { Q } ( s _ { t } , a _ { t } )$ .
161
+
162
+ Monte Carlo marginalized Q baseline After fitting $Q _ { \pi _ { \theta } } ( s _ { t } , a _ { t } )$ we can obtain the baselines through Monte Carlo estimates:
163
+
164
+ $$
165
+ b _ { i } ( s _ { t } , a _ { t } ^ { - i } ) = \frac { 1 } { M } \sum _ { j = 0 } ^ { M } Q _ { \pi _ { \theta } } ( s _ { t } , ( a _ { t } ^ { - i } , \alpha _ { j } ) )
166
+ $$
167
+
168
+ where $\alpha _ { j } \sim \pi _ { \theta } ( a _ { t } ^ { i } | s _ { t } )$ are samples of the action coordinate $i$ . In general, any function may be used to aggregate the samples, so long as it does not depend on the sample value $a _ { t } ^ { i }$ . For instance, for discrete action dimensions, the sample max can be computed instead of the mean.
169
+
170
+ Mean marginalized Q baseline Though we reduced the computational burden from learning $m$ functions to one function, the use of Monte Carlo samples can still be computationally expensive. In particular, when using deep neural networks to approximate the Q-function, forward propagation through the network can be even more computationally expensive than stepping through a fast simulator (e.g. MuJoCo). In such settings, we further propose the following more computationally practical baseline:
171
+
172
+ $$
173
+ b _ { i } ( s _ { t } , a _ { t } ^ { - i } ) = Q _ { \pi _ { \theta } } ( s _ { t } , ( a _ { t } ^ { - i } , \bar { a } _ { t } ^ { i } ) )
174
+ $$
175
+
176
+ where ${ \bar { a } } _ { t } ^ { i } = \mathbb { E } _ { \pi _ { \theta } } \left[ a _ { t } ^ { i } \right]$ is the average action for coordinate $i$ .
177
+
178
+ # 4.5 FINAL ALGORITHM
179
+
180
+ The final practical algorithm for fully factorized policies is as follows.
181
+
182
+ Require: number of iterations $N$ , batch size $B$ , initial policy parameters $\theta$ Initialize action-value function estimate $Q _ { \pi _ { \theta } } ( s _ { t } , a _ { t } ) \equiv 0$ and policy $\pi _ { \theta }$ for $j$ in $\{ 1 , \ldots , N \}$ do Collect samples: (st, at)t∈{1,...,B} Compute baseline: $b _ { i } \big ( s _ { t } , a _ { t } ^ { - i } \big ) = \mathbb { E } _ { a _ { t } ^ { i } } \left[ \hat { Q } \big ( s _ { t } , a _ { t } \big ) \right]$ for $i \in \{ 1 , \ldots , m \}$ [e.g. Equations (17- 18)] Compute advantages: $\hat { A } _ { i } \big ( s _ { t } , a _ { t } \big ) : = \hat { Q } \big ( s _ { t } , a _ { t } \big ) - b _ { i } \big ( s _ { t } , a _ { t } ^ { - i } \big ) , \forall t$ Perform a policy update step on $\theta$ using $\hat { A } _ { i } ( s _ { t } , a _ { t } )$ [Equation (9)] Update action-value function approximation with current batch: $Q _ { \pi _ { \theta } } ( s _ { t } , a _ { t } )$ end for
183
+
184
+ Computing the baseline can be done with either proposed technique in Section 4.4. A similar algorithm can be written for general policies (Appendix E), which makes no assumptions on the conditional independence across action dimensions.
185
+
186
+ # 5 EXPERIMENTS AND RESULTS
187
+
188
+ Continuous control benchmarks Firstly, we present the results of the proposed action-dependent baselines on popular benchmark tasks. These tasks have been widely studied in the deep reinforcement learning community (Duan et al., 2016; Gu et al., 2017; Lillicrap et al., 2016; Rajeswaran et al., 2017b). The studied tasks include the hopper, half-cheetah, and ant locomotion tasks simulated in MuJoCo (Todorov et al., 2012).1 In addition to these tasks, we also consider a door opening task with a high-dimensional multi-fingered hand, introduced in Rajeswaran et al. (2017a) to study the effectiveness of the proposed approach in high-dimensional tasks. Figure 1 presents the learning curves on these tasks. We compare the action-dependent baseline with a baseline that uses only information about the states, which is the most common approach in the literature. We observe that the action-dependent baselines perform consistently better.
189
+
190
+ A popular baseline parameterization choice is a linear function on a small number of non-linear features of the state (Duan et al., 2016), especially for policy gradient methods. In this work, to enable a fair comparison, we use a Random Fourier Feature representation for the baseline (Rahimi & Recht, 2007; Rajeswaran et al., 2017b). The features are constructed as: $\begin{array} { r } { y ( x ) = \sin ( \frac { 1 } { \nu } \dot { P } x + \phi ) } \end{array}$ where $P$ is a matrix with each element independently drawn from the standard normal distribution, $\phi$ is a random phase shift in $[ - \pi , \pi )$ and, and $\nu$ is a bandwidth parameter. These features approximate the RKHS features under an RBF kernel. Using these features, the baseline is parameterized as $b = w ^ { T } y ( x )$ where $x$ are the appropriate inputs to the baseline, and $w$ are trainable parameters. $P$ and $\phi$ are not trained in this parameterization. Such a representation was chosen for two reasons: (a) we wish to have the same number of trainable parameters for all the baseline architectures, and not have more parameters in the action-dependent case (which has a larger number of inputs to the baseline); (b) since the final representation is linear, it is possible to accurately estimate the optimal parameters with a Newton step, thereby alleviating the results from confounding optimization issues. For policy optimization, we use a variant of the natural policy gradient method as described in Rajeswaran et al. (2017b). See Appendix G for further experimental details.
191
+
192
+ ![](images/4f6f9b0677d452543e58624d6addaac67db78c90cb61bdab751046a80ca1c0e0.jpg)
193
+ Figure 1: Comparison between value function baseline and action-conditioned baseline on various continuous control tasks. Action-dependent baseline performs consistently better across all the tasks.
194
+
195
+ Choice of action-dependent baseline form Next, we study the influence of computing the baseline by using empirical averages sampled from the Q-function versus using the mean-action of the action-coordinate for computing the baseline (both described in 4.4). In our experiments, as shown in Figure 2 we find that the two variants perform comparably, with the latter performing slightly better towards the end of the learning process. This suggests that though sampling from the Q-function might provide a better estimate of the conditional expectation in theory, function approximation from finite samples injects errors that may degrade the quality of estimates. In particular, sub-sampling from the Q-function is likely to produce better results if the learned Q-function is accurate for a large fraction of the action space, but getting such high quality approximations might be hard in practice.
196
+
197
+ High-dimensional action spaces Intuitively, the benefit of the action-dependent baseline can be greater for higher dimensional problems. We show this effect on a simple synthetic example called $m$ -DimTargetMatching. The example is a one-step MDP comprising of a single state, ${ \mathcal { S } } = \{ 0 \}$ , an $m$ -dimensional action space, $\mathcal { A } = \mathbb { R } ^ { m }$ , and a fixed vector $c \in \mathbb { R } ^ { m }$ . The reward is given as the negative squared $\ell _ { 2 }$ loss of the action vector, $r ( s , a ) = - \| a - c \| _ { 2 } ^ { 2 }$ . The optimal action is thus to match the given vector by selecting $a = c$ . The results for the demonstrative example are shown in Table 1, which shows that the action-dependent baseline successfully improves convergence more for higher dimensional problems than lower dimensional problems. Due to the lack of state information, the linear baseline reduces to whitening the returns. The action-dependent baseline, on the other hand, allows the learning algorithm to assess the advantage of each individual action dimension by utilizing information from all other action dimensions. Additionally, this experiment demonstrates that our algorithm scales well computationally to high-dimensional problems.
198
+
199
+ ![](images/a486d1bf8132b5168e69a386db3b3697361a6947520c20b92cb8338ea5029422.jpg)
200
+ Figure 2: Variants of the action-dependent baseline that use: (i) sampling from the Q-function to estimate the conditional expectation; (ii) Using the mean action to form a linear approximation to the conditional expectation. We find that both variants perform comparably, with the latter being more computationally efficient.
201
+
202
+ <table><tr><td rowspan="2">Action dimensions</td><td colspan="4">Solve time (iterations)</td><td rowspan="2">Solution threshold</td></tr><tr><td>Action-dependent</td><td>State-dependent</td><td>Delta</td><td>% speed improvement</td></tr><tr><td>12</td><td>45.6</td><td>45.6</td><td>0</td><td>0.0%</td><td>-0.01</td></tr><tr><td>100</td><td>136</td><td>150</td><td>14</td><td>9.3%</td><td>-0.25</td></tr><tr><td>400</td><td>268.2</td><td>304</td><td>35.8</td><td>11.8%</td><td>-0.99</td></tr><tr><td>2000</td><td>595.5</td><td>671.5</td><td>76</td><td>11.3%</td><td>-4.96</td></tr></table>
203
+
204
+ Table 1: Shown are the results for the synthetic high-dimensional target matching task (5 seeds), for 12 to 2000 dimensional action spaces. At high dimensions, the linear feature action-dependent baseline provides notable and consistent variance reduction, as compared to a linear feature baseline, resulting in around $10 \%$ faster convergence. For the corresponding learning curves, see Appendix G.
205
+
206
+ Partially observable and multi-agent tasks Finally, we also consider the extension of the core idea of using global information, by studying a POMDP task and a multi-agent task. We use the blind peg-insertion task which is widely studied in the robot learning literature (Montgomery & Levine, 2016). The task requires the robot to insert the peg into the hole (slot), but the robot is blind to the location of the hole. Thus, we expect a searching behavior to emerge from the robot, where it learns that the hole is present on the table and performs appropriate sweeping motions till it is able to find the hole. In this case, we consider a baseline that is given access to the location of the hole. We observe that a baseline with this additional information enables faster learning. For the multi-agent setting, we analyze a two-agent particle environment task in which the goal is for each agent to reach their goal, where their goal is known by the other agent and they have a continuous communication channel. Similar training procedures have been employed in recent related works Lowe et al. (2017); Levine et al. (2016). Figure 3 shows that including the inclusion of information from other agents into the action-dependent baseline improves the training performance, indicating that variance reduction may be key for multi-agent reinforcement learning.
207
+
208
+ # 6 CONCLUSION
209
+
210
+ An action-dependent baseline enables using additional signals beyond the state to achieve bias-free variance reduction. In this work, we consider both conditionally independent policies and general policies, and derive an optimal action-dependent baseline. We provide analysis of the variance
211
+
212
+ ![](images/17c0b9d38054dff9df4e8e1e7ae4e4ebb46bab73f446a6b1d14fd602586dadcc.jpg)
213
+
214
+ ![](images/83c05cab4874ca65a212c2f239094c9ca56de45cfeb0ab8f22b2ab21aeb5c119.jpg)
215
+
216
+ (a) Success percentage on the blind peg insertion task. The policy still acts on the observations and does not know the hole location. However, the baseline has access to this goal information, in addition to the observations and action, and helps to speed up the learning. By comparison, in blue, the baseline has access only to the observations and actions.
217
+
218
+ (b) Training curve for multi-agent communication task with two agents. Two policies are simultaneously trained, one for each agent. Each policy acts on the observations of its respective agent only. However, the shared baseline has access to the other agent’s state and action, in addition to its own state and action, and results in considerably faster training. By comparison, in blue, the independent learners baseline has access to only a single agent’s state and action.
219
+
220
+ Figure 3: Experiments with additional information in the baseline.
221
+
222
+ reduction improvement over non-optimal baselines, including the traditional optimal baseline that only depends on state. We additionally propose several practical action-dependent baselines which perform well on a variety of continuous control tasks and synthetic high-dimensional action problems. The use of additional signals beyond the local state generalizes to other problem settings, for instance in POMDP and multi-agent tasks. In future work, we propose to investigate related methods in such settings on large-scale problems.
223
+
224
+ # REFERENCES
225
+
226
+ Yong Cao, Ari Shapiro, Petros Faloutsos, and Fred´ eric Pighin. Motion editing with independent ´ component analysis. Visual Computer, 2, 2007.
227
+
228
+ Yan Duan, Xi Chen, Rein Houthooft, John Schulman, and Pieter Abbeel. Benchmarking deep reinforcement learning for continuous control. In Proceedings of the 33rd International Conference on Machine Learning (ICML), 2016.
229
+
230
+ Jakob Foerster, Gregory Farquhar, Triantafyllos Afouras, Nantas Nardelli, and Shimon Whiteson. Counterfactual multi-agent policy gradients. arXiv preprint arXiv:1705.08926, 2017.
231
+
232
+ Evan Greensmith, Peter L Bartlett, and Jonathan Baxter. Variance reduction techniques for gradient estimates in reinforcement learning. Journal of Machine Learning Research, 5(Nov):1471–1530, 2004.
233
+
234
+ Shixiang Gu, Timothy Lillicrap, Zoubin Ghahramani, Richard E Turner, and Sergey Levine. Qprop: Sample-efficient policy gradient with an off-policy critic. In International Conference on Learning Representations (ICLR2017), 2017.
235
+
236
+ Sham M Kakade. A natural policy gradient. In Advances in neural information processing systems, pp. 1531–1538, 2002.
237
+
238
+ Vijay R Konda and John N Tsitsiklis. Actor-critic algorithms. In Advances in neural information processing systems, pp. 1008–1014, 2000.
239
+
240
+ Sergey Levine, Chelsea Finn, Trevor Darrell, and Pieter Abbeel. End-to-end training of deep visuomotor policies. Journal of Machine Learning Research, 17(39):1–40, 2016.
241
+
242
+ Timothy P Lillicrap, Jonathan J Hunt, Alexander Pritzel, Nicolas Heess, Tom Erez, Yuval Tassa, David Silver, and Daan Wierstra. Continuous control with deep reinforcement learning. In International Conference on Learning Representations (ICLR2016), 2016.
243
+
244
+ Ryan Lowe, Yi Wu, Aviv Tamar, Jean Harb, Pieter Abbeel, and Igor Mordatch. Multi-agent actorcritic for mixed cooperative-competitive environments. arXiv preprint arXiv:1706.02275, 2017.
245
+
246
+ Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 518(7540):529–533, 2015.
247
+
248
+ Volodymyr Mnih, Adria Puigdomenech Badia, Mehdi Mirza, Alex Graves, Timothy Lillicrap, Tim Harley, David Silver, and Koray Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In International Conference on Machine Learning, pp. 1928–1937, 2016.
249
+
250
+ William Montgomery and Sergey Levine. Guided policy search as approximate mirror descent. In NIPS, 2016.
251
+
252
+ Igor Mordatch, Kendall Lowrey, Galen Andrew, Zoran Popovic, and Emanuel Todorov. Interactive Control of Diverse Complex Characters with Neural Networks. In NIPS, 2015.
253
+
254
+ Jan Peters and Stefan Schaal. Natural actor-critic. Neurocomputing, 71(7):1180–1190, 2008.
255
+
256
+ Ali Rahimi and Benjamin Recht. Random Features for Large-Scale Kernel Machines. In NIPS, 2007.
257
+
258
+ Aravind Rajeswaran, Vikash Kumar, Abhishek Gupta, John Schulman, Emanuel Todorov, and Sergey Levine. Learning complex dexterous manipulation with deep reinforcement learning and demonstrations. CoRR, abs/1709.10087, 2017a.
259
+
260
+ Aravind Rajeswaran, Kendall Lowrey, Emanuel Todorov, and Sham Kakade. Towards Generalization and Simplicity in Continuous Control. In NIPS, 2017b.
261
+
262
+ John Schulman, Sergey Levine, Pieter Abbeel, Michael Jordan, and Philipp Moritz. Trust region policy optimization. In Proceedings of the 32nd International Conference on Machine Learning (ICML-15), pp. 1889–1897, 2015.
263
+
264
+ John Schulman, Philipp Moritz, Sergey Levine, Michael Jordan, and Pieter Abbeel. Highdimensional continuous control using generalized advantage estimation. In International Conference on Learning Representations (ICLR2016), 2016.
265
+
266
+ David Silver, Aja Huang, Chris J Maddison, Arthur Guez, Laurent Sifre, George Van Den Driessche, Julian Schrittwieser, Ioannis Antonoglou, Veda Panneershelvam, Marc Lanctot, et al. Mastering the game of go with deep neural networks and tree search. Nature, 529(7587):484–489, 2016.
267
+
268
+ Richard S Sutton and Andrew G Barto. Reinforcement learning: An introduction, volume 1. MIT press Cambridge, 1998.
269
+
270
+ Richard S Sutton, David A McAllester, Satinder P Singh, and Yishay Mansour. Policy gradient methods for reinforcement learning with function approximation. In Advances in neural information processing systems, pp. 1057–1063, 2000.
271
+
272
+ Emanuel Todorov and Zoubin Ghahramani. Analysis of the synergies underlying complex hand manipulation. In Engineering in Medicine and Biology Society, 2004. IEMBS’04. 26th Annual International Conference of the IEEE, volume 2, pp. 4637–4640. IEEE, 2004.
273
+
274
+ Emanuel Todorov, Weiwei Li, and Xiuchuan Pan. From task parameters to motor synergies: A hierarchical framework for approximately optimal control of redundant manipulators. Journal of Field Robotics, 22(11):691–710, 2005.
275
+
276
+ Emanuel Todorov, Tom Erez, and Yuval Tassa. MuJoCo: A physics engine for model-based control. In International Conference on Intelligent Robots and Systems, 2012.
277
+
278
+ Christopher JCH Watkins and Peter Dayan. Q-learning. Machine learning, 8(3-4):279–292, 1992.
279
+
280
+ Lex Weaver and Nigel Tao. The optimal reward baseline for gradient-based reinforcement learning. In Proceedings of the Seventeenth conference on Uncertainty in artificial intelligence, pp. 538– 545. Morgan Kaufmann Publishers Inc., 2001.
281
+
282
+ Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3-4):229–256, 1992.
283
+
284
+ We provide a derivation of the optimal state-dependent baseline, which minimizes the variance of the policy gradient estimate, and is based in (Greensmith et al., 2004, Theorem 8). More precisely, we minimize the trace of the covariance of the policy gradient; that is, the sum of the variance of the components of the vectors. Recall the policy gradient expression with a state-dependent baseline:
285
+
286
+ $$
287
+ \nabla _ { \theta } \eta ( \pi _ { \theta } ) : = \mathbb { E } _ { \rho _ { \pi } , \pi } \left[ \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } | s _ { t } ) \left( \hat { Q } ( s _ { t } , a _ { t } ) - b ( s _ { t } ) \right) \right]
288
+ $$
289
+
290
+ Denote $g$ to be the associated random variable, that is, $\nabla _ { \theta } \eta ( \pi _ { \theta } ) = \mathbb { E } _ { \rho _ { \pi } , \pi } [ g ]$ :
291
+
292
+ $$
293
+ \begin{array} { r } { g : = \nabla _ { \boldsymbol { \theta } } \log \pi _ { \boldsymbol { \theta } } ( a _ { t } | s _ { t } ) \left( \hat { Q } ( s _ { t } , a _ { t } ) - b ( s _ { t } ) \right) , \quad a _ { t } \sim \pi _ { \boldsymbol { \theta } } ( a _ { t } | s _ { t } ) , s _ { t } \sim \rho _ { \pi } ( s _ { t } ) } \end{array}
294
+ $$
295
+
296
+ The variance of the policy gradient is:
297
+
298
+ $$
299
+ \begin{array} { r l } & { \mathrm { V a r } ( g ) = \mathbb { E } _ { \rho _ { \pi } , \pi } \left[ ( g - \mathbb { E } _ { \rho _ { \pi } , \pi } \left[ g \right] ) ^ { T } ( g - \mathbb { E } _ { \rho _ { \pi } , \pi } \left[ g \right] ) \right] } \\ & { \quad \quad \quad = \mathbb { E } _ { \rho _ { \pi } , \pi } \left[ \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } | s _ { t } ) ^ { T } \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } | s _ { t } ) \right] b ( s _ { t } ) ^ { 2 } } \\ & { \quad \quad \quad - 2 \mathbb { E } _ { \rho _ { \pi } , \pi } \left[ \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } | s _ { t } ) ^ { T } \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } | s _ { t } ) \hat { Q } ( s _ { t } , a _ { t } ) \right] b ( s _ { t } ) } \end{array}
300
+ $$
301
+
302
+ Note that $\mathbb { E } \left[ \eta ( \pi _ { \theta } ) \right] )$ contains a bias-free term, by the score function argument, which then does not affect the minimizer. Terms which do not depend on $b ( s _ { t } )$ also do not affect the minimizer.
303
+
304
+ $$
305
+ \begin{array} { r l } & { \frac { \partial } { \partial b } \left[ \mathrm { V a r } ( g ) \right] = 0 } \\ & { \quad \quad \quad = 2 \mathbb { E } _ { \rho _ { \pi } , \pi } \left[ \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } | s _ { t } ) ^ { T } \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } | s _ { t } ) \right] b ( s _ { t } ) } \\ & { \quad \quad \quad \quad - 2 \mathbb { E } _ { \rho _ { \pi } , \pi } \left[ \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } | s _ { t } ) ^ { T } \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } | s _ { t } ) \hat { Q } ( s _ { t } , a _ { t } ) \right] } \end{array}
306
+ $$
307
+
308
+ $$
309
+ \implies b ^ { * } ( s _ { t } ) = \frac { \mathbb { E } _ { \rho _ { \pi } , \pi } \left[ \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } | s _ { t } ) ^ { T } \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } | s _ { t } ) \hat { Q } ( s _ { t } , a _ { t } ) \right] } { \mathbb { E } _ { \rho _ { \pi } , \pi } \left[ \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } | s _ { t } ) ^ { T } \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } | s _ { t } ) \right] }
310
+ $$
311
+
312
+ # B DERIVATION OF THE OPTIMAL ACTION-DEPENDENT BASELINE
313
+
314
+ We derive the optimal action-dependent baseline, which minimizes the variance of the policy gradient estimate. First, we write out the variance of the policy gradient under any action-dependent baseline. Recall the following notations: we define $\bar { z } _ { i } : = \bar { \nabla } _ { \boldsymbol { \theta } } \log \pi _ { \boldsymbol { \theta } } ( a _ { t } ^ { i } | s _ { t } )$ and the component policy gradient:
315
+
316
+ $$
317
+ \begin{array} { r } { \nabla \eta _ { i } ( \pi _ { \theta } ) : = \mathbb { E } _ { \rho _ { \pi } , \pi } \left[ \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } ^ { i } | s _ { t } ) \left( \hat { Q } ( s _ { t } , a _ { t } ) - b _ { i } ( s _ { t } , a _ { t } ^ { - i } ) \right) \right] . } \end{array}
318
+ $$
319
+
320
+ Denote $g _ { i }$ to be the associated random variables:
321
+
322
+ $$
323
+ \begin{array} { r } { g _ { i } : = \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } ^ { i } | s _ { t } ) \left( \hat { Q } ( s _ { t } , a _ { t } ) - b _ { i } ( s _ { t } , a _ { t } ^ { - i } ) \right) , \quad a _ { t } \sim \pi _ { \theta } ( a _ { t } | s _ { t } ) , s _ { t } \sim \rho _ { \pi } ( s _ { t } ) , } \end{array}
324
+ $$
325
+
326
+ such that
327
+
328
+ $$
329
+ \nabla _ { \boldsymbol { \theta } } \eta ( \pi _ { \boldsymbol { \theta } } ) = \nabla _ { \boldsymbol { \theta } } \left[ \sum _ { i = 1 } ^ { m } \eta _ { i } ( \pi _ { \boldsymbol { \theta } } ) \right] = \mathbb { E } _ { \boldsymbol { \rho } _ { \pi } , \pi } \left[ \sum _ { i = 1 } ^ { m } g _ { i } \right] .
330
+ $$
331
+
332
+ Recall the following assumption:
333
+
334
+ $$
335
+ \begin{array} { r } { \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } ^ { i } | s _ { t } ) ^ { T } \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } ^ { j } | s _ { t } ) \equiv z _ { i } ^ { T } z _ { j } \approx 0 , \quad \forall i \ne j , } \end{array}
336
+ $$
337
+
338
+ which translates to meaning that different subsets of parameters strongly influence different action dimensions or factors. This is true in case of distributed systems by construction, and also true
339
+
340
+ in a single agent system if different action coordinates are strongly influenced by different policy network channels. Under this assumption, we have:
341
+
342
+ $$
343
+ \begin{array} { r l } & { \displaystyle \mathrm { V a r } ( \sum _ { i = 1 } ^ { m } g _ { i } ) = \sum _ { i } \mathrm { V a r } ( g _ { i } ) + \sum _ { i } \sum _ { j \ne i } \mathrm { C o v } ( g _ { i } , g _ { j } ) } \\ & { \displaystyle \quad = \sum _ { i } \mathrm { V a r } ( g _ { i } ) + \sum _ { i } \sum _ { j \ne i } \mathbb { E } _ { \rho _ { \pi } , \pi } \left[ g _ { i } ^ { T } g _ { j } \right] - \mathbb { E } _ { \rho _ { \pi } , \pi } \left[ g _ { i } \right] ^ { T } \mathbb { E } _ { \rho _ { \pi } , \pi } \left[ g _ { j } \right] } \\ & { \displaystyle \quad = \sum _ { i } \mathrm { V a r } ( g _ { i } ) + 0 - \sum _ { i } \sum _ { j \ne i } \mathbb { E } _ { \rho _ { \pi } , \pi } \left[ g _ { i } \right] ^ { T } \mathbb { E } _ { \rho _ { \pi } , \pi } \left[ g _ { j } \right] \quad \mathrm { ( b y ~ E q u a t i o n ~ ( 3 1 ) ) } } \\ & { \displaystyle \quad = \sum _ { i } \mathrm { V a r } ( g _ { i } ) - \sum _ { i } \sum _ { j \ne i } M _ { i j } \quad \mathrm { ( b y ~ s c o r e ~ f u n c t i o n ~ e s t i m a t o r ) } } \end{array}
344
+ $$
345
+
346
+ where we denote the mean correction term $M _ { i j } : = \mathbb { E } _ { \rho _ { \pi } , \pi } \left[ z _ { i } \hat { Q } ( s _ { t } , a _ { t } ) \right] ^ { T } \mathbb { E } _ { \rho _ { \pi } , \pi } \left[ z _ { j } \hat { Q } ( s _ { t } , a _ { t } ) \right]$ . Also let $\begin{array} { r } { M = \sum _ { i } \sum _ { j } M _ { i j } } \end{array}$ . Note that $M$ does not depend on $\bar { b _ { i } } ( \cdot )$ , and thus does not affect the optimal value.
347
+
348
+ The overall variance is minimized when each component variance is minimized. We now derive the optimal baselines $b _ { i } ^ { * } ( s _ { t } , a _ { t } ^ { - i } )$ which minimize each respective component.
349
+
350
+ $$
351
+ \begin{array} { r l } { \mathrm { V a r } ( g _ { \mathrm { t } } ) = \mathbb { E } _ { \rho _ { x } , \pi } [ z _ { i } ^ { T } z _ { i } ( \hat { Q } ( s _ { t } , a _ { t } ) - b _ { i } ( s _ { t } , a _ { t } ^ { - i } ) ) ^ { 2 } ] } & { { } } \\ { - \mathbb { E } _ { \rho _ { x } , \pi } [ z _ { i } ( \hat { Q } ( s _ { t } , a _ { t } ) - b _ { i } ( s _ { t } , a _ { t } ^ { - i } ) ) ] ^ { T } \mathbb { E } _ { \rho _ { x } , \pi } [ z _ { i } ( \hat { Q } ( s _ { t } , a _ { t } ) - b _ { i } ( s _ { t } , a _ { t } ^ { - i } ) ) ] } & { { } } \\ { = \mathbb { E } _ { \rho _ { x } , \pi } [ z _ { i } ^ { T } z _ { i } ( \hat { Q } ( s _ { t } , a _ { t } ) ^ { 2 } - 2 b _ { i } ( s _ { t } , a _ { t } ^ { - i } ) \hat { Q } ( s _ { t } , a _ { t } ) + b _ { i } ( s _ { t } , a _ { t } ^ { - i } ) ) ^ { 2 } ] } & { { } } \\ { - \mathbb { E } _ { \rho _ { x } , \pi } [ z _ { i } ( \hat { Q } ( s _ { t } , a _ { t } ) ) ] ^ { T } \mathbb { E } _ { \rho _ { x } , \pi } [ z _ { i } ( \hat { Q } ( s _ { t } , a _ { t } ) ) ] } & { { } } \\ { = \mathbb { E } _ { \rho _ { x } , \pi } [ z _ { i } ^ { T } z _ { i } \hat { Q } ( s _ { t } , a _ { t } ) ^ { 2 } ] } & { { } } \\ + \mathbb { E } _ { \rho _ { x } , \pi } [ z _ { i } ^ { T } z _ { i } \hat { Q } ( s _ { t } , a _ { t } ^ { - i } ) \mathbb { E } _ { \sigma _ { i } } [ z _ { i } ^ { T } z _ { i } \hat { Q } ( s _ { t } , a _ { t } ) ] + b _ { i } ( s _ { t } , a _ { t } ^ { - i } ) ^ { 2 } \mathbb { E } _ \rho \end{array}
352
+ $$
353
+
354
+ Having written down the expression for variance under any action-dependent baseline, we seek the optimal baseline that would minimize this variance.
355
+
356
+ $$
357
+ { \frac { \partial } { \partial b _ { i } } } \left[ \operatorname { v a r } ( \sum _ { i } g _ { i } ) \right] = { \frac { \partial } { \partial b _ { i } } } \left[ \operatorname { V a r } ( g _ { i } ) \right] = 0
358
+ $$
359
+
360
+ $$
361
+ \implies b _ { i } ^ { * } ( s _ { t } , a _ { t } ^ { - i } ) = \frac { \mathbb { E } _ { a _ { t } ^ { i } } \left[ z _ { i } ^ { T } z _ { i } \hat { Q } ( s _ { t } , a _ { t } ) \right] } { \mathbb { E } _ { a _ { t } ^ { i } } \left[ z _ { i } ^ { T } z _ { i } \right] }
362
+ $$
363
+
364
+ The optimal action-dependent baseline is:
365
+
366
+ $$
367
+ b _ { i } ^ { * } ( s _ { t } , a _ { t } ^ { - i } ) = \frac { \mathbb { E } _ { a _ { t } ^ { i } } \left[ \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } ^ { i } | s _ { t } ) ^ { T } \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } ^ { i } | s _ { t } ) \hat { Q } ( s _ { t } , a _ { t } ) \right] } { \mathbb { E } _ { a _ { t } ^ { i } } \left[ \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } ^ { i } | s _ { t } ) ^ { T } \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } ^ { i } | s _ { t } ) \right] }
368
+ $$
369
+
370
+ # C DERIVATION OF VARIANCE REDUCTION IMPROVEMENT
371
+
372
+ We now turn to quantifying the reduction in variance of the policy gradient estimate under the optimal baseline derived above. Let $\textstyle \operatorname { V a r } ^ { * } ( \sum _ { i } g _ { i } )$ denote the variance resulting from the optimal action-dependent baseline, and let $\textstyle \operatorname { V a r } ( \sum _ { i } g _ { i } )$ denote the variance resulting from another baseline
373
+
374
+ $\boldsymbol { b } = ( b _ { i } ( s _ { t } , a _ { t } ^ { - i } ) ) _ { i \in [ m ] }$ , which may be suboptimal or action-independent. Recall the notation:
375
+
376
+ $$
377
+ \begin{array} { r l } & { Z _ { i } : = Z _ { i } ( s _ { t } , a _ { t } ^ { - i } ) = \mathbb { E } _ { a _ { t } ^ { i } } \left[ \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } ^ { i } | s _ { t } ) ^ { T } \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } ^ { i } | s _ { t } ) \right] } \\ & { Y _ { i } : = Y _ { i } ( s _ { t } , a _ { t } ^ { - i } ) = \mathbb { E } _ { a _ { t } ^ { i } } \left[ \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } ^ { i } | s _ { t } ) ^ { T } \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } ^ { i } | s _ { t } ) \hat { Q } ( s _ { t } , a _ { t } ) \right] } \\ & { X _ { i } : = X _ { i } ( s _ { t } , a _ { t } ^ { - i } ) = \mathbb { E } _ { a _ { t } ^ { i } } \left[ \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } ^ { i } | s _ { t } ) ^ { T } \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } ^ { i } | s _ { t } ) \hat { Q } ( s _ { t } , a _ { t } ) ^ { 2 } \right] } \end{array}
378
+ $$
379
+
380
+ Finally, define the variance improvement $I _ { b } : = \mathrm { V a r } ( \textstyle \sum _ { i } g _ { i } ) - \mathrm { V a r } ^ { * } ( \textstyle \sum _ { i } g _ { i } )$ . Using these definitions, the variance can be re-written as:
381
+
382
+ $$
383
+ \mathrm { V a r } ( \sum _ { i } g _ { i } ) = \sum _ { i } \mathbb { E } _ { \rho _ { \pi } , a _ { t } ^ { - i } } \left[ X _ { i } - 2 b _ { i } ( s _ { t } , a _ { t } ^ { - i } ) Y _ { i } + b _ { i } ( s _ { t } , a _ { t } ^ { - i } ) ^ { 2 } Z _ { i } \right] - M
384
+ $$
385
+
386
+ Furthermore, the variance of the gradient with the optimal baseline can be written as
387
+
388
+ $$
389
+ \operatorname { V a r } ^ { * } ( \sum _ { i } g _ { i } ) = \sum _ { i } \mathbb { E } _ { \rho _ { \pi } , a _ { t } ^ { - i } } \left[ X _ { i } - { \frac { Y _ { i } ^ { 2 } } { Z _ { i } } } \right] - M
390
+ $$
391
+
392
+ The difference in variance can be calculated as:
393
+
394
+ $$
395
+ \begin{array} { r l } & { d _ { b } : = \displaystyle \sum _ { i } \bigg ( \mathbb { E } _ { \rho _ { s - \sigma _ { i } ^ { - 1 } } } \left[ X _ { i } - 2 b _ { i } ( s _ { k } , \sigma _ { i } ^ { - 1 } ) Y _ { i } + b _ { i } ( s _ { k } , \sigma _ { i } ^ { - 1 } ) ^ { 2 } Z _ { i } \right] - \big ( \mathbb { E } _ { \rho _ { s - \sigma _ { i } ^ { - 1 } } } \left[ X _ { i } - \frac { Y _ { i } ^ { 2 } } { Z _ { i } } \right] \big ) \bigg ) } \\ & { \quad = \displaystyle \sum _ { i } \mathbb { E } _ { \rho _ { s - \sigma _ { i } ^ { - 1 } } } \left[ - 2 b _ { i } ( s _ { k } , \sigma _ { i } ^ { - 1 } ) Y _ { i } + b _ { i } ( s _ { k } , \sigma _ { i } ^ { - 1 } ) ^ { 2 } Z _ { i } + \frac { Y _ { i } ^ { 2 } } { Z _ { i } } \right] } \\ & { \quad = \displaystyle \sum _ { i } \mathbb { E } _ { \rho _ { s - \sigma _ { i } ^ { - 1 } } } \left[ \left( b _ { i } ( s _ { k } , \sigma _ { i } ^ { - 1 } ) \sqrt { Z _ { i } } - \frac { Y _ { i } } { \sqrt { Z _ { i } } } \right) ^ { 2 } \right] } \\ & { \quad = \displaystyle \sum _ { i } \mathbb { E } _ { \rho _ { s - \sigma _ { i } ^ { - 1 } } } \left[ Z _ { \rho _ { s } } \left( b _ { i } ( s _ { k } , \sigma _ { i } ^ { - 1 } ) - \frac { Y _ { i } } { Z _ { i } } \right) ^ { 2 } \right] } \\ & { \quad = \displaystyle \sum _ { i } \mathbb { E } _ { \rho _ { s - \sigma _ { i } ^ { - 1 } } } \left[ Z _ { \rho _ { s } } \left( b _ { i } ( s _ { k } , \sigma _ { i } ^ { - 1 } ) - \frac { Y _ { i } } { Z _ { i } } \right) ^ { 2 } \right] } \\ & { \quad = \displaystyle \sum _ { i } \mathbb { E } _ { \rho _ { s - \sigma _ { i } ^ { - 1 } } } \left[ Z _ { \rho _ { s } } \left( b _ { i } ( s _ { k } , \sigma _ { i } ^ { - 1 } ) - b _ { i } ^ { * } ( s _ { k } , \sigma _ { i } ^ { - 1 } ) \right) ^ { 2 } \right] } \\ & \quad \end{array}
396
+ $$
397
+
398
+ # D DERIVATION OF SUBOPTIMALITY OF THE OPTIMAL STATE-DEPENDENT BASELINE
399
+
400
+ Using the notation from Appendix $\textrm { C }$ and working off of Equation (51), we have:
401
+
402
+ $$
403
+ \begin{array} { r l } & { I _ { b = b ^ { \star } ( s ) } : = \displaystyle \sum _ { i } \mathbb { E } _ { \rho _ { \tau } , a _ { t } ^ { - i } } \left[ Z _ { i } \left( b ^ { \star } ( s _ { t } ) - b _ { i } ^ { \star } ( s _ { t } , a _ { t } ^ { - i } ) \right) ^ { 2 } \right] } \\ & { \quad \quad \quad \quad = \displaystyle \sum _ { i } \mathbb { E } _ { \rho _ { \tau } , a _ { t } ^ { - i } } \left[ Z _ { i } \left( \frac { \sum _ { j } Y _ { j } } { \sum _ { j } Z _ { j } } - \frac { Y _ { i } } { Z _ { i } } \right) ^ { 2 } \right] } \\ & { \quad \quad \quad \quad = \displaystyle \sum _ { i } \mathbb { E } _ { \rho _ { \tau } , a _ { t } ^ { - i } } \left[ \frac { 1 } { Z _ { i } } \left( \frac { Z _ { i } } { \sum _ { j } Z _ { j } } \sum _ { j } Y _ { j } - Y _ { i } \right) ^ { 2 } \right] ^ { - 1 } } \end{array}
404
+ $$
405
+
406
+ # E BASELINES FOR GENERAL ACTIONS
407
+
408
+ In the preceding derivations, we have assumed policy actions are conditionally independent across dimensions. In the more general case, we only assume that there are $m$ factors $\bar { a } _ { t } ^ { 1 }$ through $a _ { t } ^ { m }$
409
+
410
+ which altogether forms the action $a _ { t }$ . Conditioned on $s _ { t }$ , the different factors form a certain directed acyclic graphical model (including the fully dependent case). Without loss of generality, we assume that the following factorization holds:
411
+
412
+ $$
413
+ \pi _ { \boldsymbol { \theta } } \big ( a _ { t } | s _ { t } \big ) = \prod _ { i = 1 } ^ { m } \pi _ { \boldsymbol { \theta } } \big ( a _ { t } ^ { i } | s _ { t } , a _ { t } ^ { f ( i ) } \big )
414
+ $$
415
+
416
+ where $f ( i )$ denotes the indices of the parents of the $i$ th factor. Let $D ( i )$ denote the indices of descendants of $i$ in the graphical model (including $i$ itself). In this case, we can set the $i$ th baseline to be $b _ { i } ( s _ { t } , a _ { t } ^ { [ m ] \setminus D ( i ) } )$ , where $[ m ] = \{ 1 , 2 , \dots , m \}$ . In other words, the ith baseline can depend on all other factors which the ith factor does not influence. The overall gradient estimator is given by
417
+
418
+ $$
419
+ \nabla _ { \theta } \eta ( \pi _ { \theta } ) = \mathbb { E } _ { \rho _ { \pi } , \pi } \left[ \sum _ { i = 1 } ^ { m } \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } ^ { i } | s _ { t } , a _ { t } ^ { f ( i ) } ) \left( \hat { Q } ( s _ { t } , a _ { t } ) - b _ { i } ( s _ { t } , a _ { t } ^ { [ m ] \setminus D ( i ) } ) \right) \right]
420
+ $$
421
+
422
+ In the most general case without any conditional independence assumptions, we have $f ( i ) =$ $\{ 1 , 2 , \ldots , i - 1 \}$ , and $D ( i ) = \{ i , i + 1 , . . . , m \}$ . The above equation reduces to
423
+
424
+ $$
425
+ \nabla _ { \theta } \eta ( \pi _ { \theta } ) = \mathbb { E } _ { \rho _ { \pi } , \pi } \left[ \sum _ { i = 1 } ^ { m } \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } ^ { i } | s _ { t } , a _ { t } ^ { 1 } , \dots , a _ { t } ^ { i - 1 } ) \left( \hat { Q } ( s _ { t } , a _ { t } ) - b _ { i } ( s _ { t } , a _ { t } ^ { 1 } , \dots , a _ { t } ^ { i - 1 } ) \right) \right]
426
+ $$
427
+
428
+ The above analysis for optimal baselines and variance suboptimality transfers also to the case of general actions.
429
+
430
+ The applicability of our techniques to general action spaces may be of crucial importance for many application domains where the conditional independence assumption does not hold up, such as language tasks and other compositional domains. Even in continuous control tasks, such as hand manipulation, and many other tasks where it is common practice to use conditionally independent factorized policies, it is reasonable to expect training improvement from policies without a full conditionally independence structure.
431
+
432
+ Computing action-dependent baselines for general actions The marginalization presented in Section 4.4 does not apply for the general action setting. Instead, $m$ individual baselines can be trained according to the factorization, and each of them can be fitted from data collected from the previous iteration. In the general case, this means fitting $m$ functions $b _ { i } ( s _ { t } , a _ { t } ^ { 1 } , \dots , a _ { t } ^ { i - 1 } )$ , for $i \in$ $\{ 1 , \ldots , m \}$ . The resulting method is described in Algorithm 2.
433
+
434
+ There may also exist special cases like conditional independent actions, for which more efficient baseline constructions exist. A closely related example to the conditionally independent case is the case of block diagonal covariance structures (e.g. in multi-agent settings), where we may wish to instead learn an overall Q function and marginalize over block factors. Another interesting example to explore is sparse covariance structures.
435
+
436
+ <table><tr><td>Algorithm 2 Policy gradient for general factorization policies using action-dependent baselines</td></tr><tr><td>Require: number of iterations N, batch size B,initial policy parameters θ</td></tr><tr><td>Initialize baselines bi(St, al a[m\D(i)) =0,for i ∈ {1,...,m} and policy π</td></tr><tr><td>for j in {1,...,N} do Collect samples: (St, at)teε{.,..,B}</td></tr><tr><td>Compute advantages: Ai(St,at):= Q(st,at)-bi(Sst,a[m\D(i),t</td></tr><tr><td>Perform a policy update step on θ using Ai(st, at) [Equation (57)]</td></tr><tr><td></td></tr><tr><td>Update baseline functions with current batch: bi(st,a[m\D(i) end for</td></tr></table>
437
+
438
+ # F COMPATIBILITY WITH GAE
439
+
440
+ Temporal Difference (TD) learning methods such as GAE (Schulman et al., 2016) allow us to smoothly interpolate between high-bias, low-variance estimates and low-bias, high-variance estimates of the policy gradient. These methods are based on the idea of being able to predict future returns, thereby bootstrapping the learning procedure. In particular, when using the value function as a baseline, we have $\bar { A } ( \bar { s } _ { t } , \bar { a } _ { t } ) = \mathbb { E } \left[ r _ { t } + \gamma V ( s _ { t + 1 } ) - \bar { V } ( s _ { t } ) \right] = [ r _ { t } + \gamma b ( \bar { s _ { t + 1 } } ) - b ( s _ { t } ) ] ]$ if $b ( s )$ is an unbiased estimator for $V ( s )$ . GAE uses an exponential averaging of such temporal difference terms over a trajectory to significantly reduce the variance of the advantage at the cost of a small bias (it allows us to pick where we want to be on the bias-variance curve). Similarly, if we use $b _ { i } ( s _ { t } , a _ { t } ^ { - i } )$ as an unbiased estimator for $\mathbb { E } _ { a _ { t } ^ { i } } [ \hat { Q } ( s _ { t } , a _ { t } ) ]$ , we have:
441
+
442
+ $$
443
+ \mathbb { E } _ { \pi , \boldsymbol { M } } \left[ r _ { t } + \gamma b _ { i } ( s _ { t + 1 } , a _ { t + 1 } ^ { - i } ) - b _ { i } ( s _ { t } , a _ { t } ^ { - i } ) \right] = \boldsymbol { Q } ( s _ { t } , a _ { t } ) - \mathbb { E } _ { a _ { t } ^ { i } } [ \hat { \boldsymbol { Q } } ( s _ { t } , a _ { t } ) ] = A _ { i } ( s _ { t } , a _ { t } )
444
+ $$
445
+
446
+ Thus, the temporal difference error with the action dependent baselines is an unbiased estimator for the advantage function as well. This allows us to use the GAE procedure to further reduce variance at the cost of some bias.
447
+
448
+ The following study shows that action-dependent baselines are consistent with TD procedures with their temporal differences being estimates of the advantage function. Our results summarized in Figure 4 suggests that slightly biasing the gradient to reduce variance produces the best results, while high-bias estimates perform poorly. Prior work with baselines that utilize global information (Foerster et al., 2017) employ the high-bias variant. The results here suggest that there is potential to further improve upon those results by carefully studying the bias-variance trade-off.
449
+
450
+ ![](images/88235c570f63b7588c651b56f8672074ee73db1202b3409032193d6a8fcfdd0a.jpg)
451
+ Figure 4: We study the influence of $\lambda$ in GAE which allows us to trade off bias and variance as desired. High bias gradient corresponding to smaller values of $\lambda$ do not make progress after a while. High variance gradient $\lambda = 1$ ) has trouble learning initially. Allowing for a small bias to reduce the variance, corresponding to the intermediate $\lambda = 0 . 9 7$ produces the best overall result, consistent with the findings in Schulman et al. (2016).
452
+
453
+ # G HIGH-DIMENSIONAL ACTION SPACES: TRAINING CURVES
454
+
455
+ Figure 5 shows the resulting training curves for a synthetic high-dimensional target matching task, as described in Section 5. For higher dimensional action spaces (100 dimensions or greater), the action-dependent baseline consistently converges to the optimal solution $10 \%$ faster than the stateonly baseline.
456
+
457
+ For reference, Figure 6 shows the result of the original high-dimensional action space experiment. Due to a discovered issue in the TensorFlow version of rllab, which results in training instability, both methods (action-dependent and state-dependent baselines) under-performed relative to the revised experiment (Figure 5), which uses a clean implementation based on the implementation referenced inRajeswaran et al. (2017b). The regression in training is most evident by the number of iterations required to solve the task; for instance, the old experiment could take as long as five times more iterations to solve the same task, even for a 12-dimensional task.
458
+
459
+ # H EXPERIMENT DETAILS
460
+
461
+ Parameters: Unless otherwise stated, the following parameters are used in the experiments in this work: $\gamma = 0 . 9 9 5 , \lambda _ { \mathrm { G A E } } = 0 . 9 7 , k l _ { \mathrm { d e s } }$ $k l _ { \mathrm { d e s i r e d } } = 0 . 0 2 5$ .
462
+
463
+ ![](images/0220e9d4e0a6a6436552f8cae7053882313b8a8de12f1fa8bff11671ebcc414d.jpg)
464
+ Figure 5: Shown is the learning curve for a synthetic high-dimensional target matching task (5 seeds), for 12 to 2000 dimensional action spaces. At high dimensions, the linear feature actiondependent baseline provides notable and consistent variance reduction, as compared to a linear feature state baseline. For 100, 400, and 2000 dimensions, our method converges $10 \%$ faster to the optimal solution.
465
+
466
+ ![](images/21ef4add1f2f546a8b53e9fdf47a24d710b6555634013548a3014966156b7a83.jpg)
467
+ Figure 6: Reference training curves for an early and invalidated version of the synthetic highdimensional target matching task (3 seeds).
468
+
469
+ Policies: The policies used are 2-layer fully connected networks with hidden sizes $=$ (32, 32).
470
+
471
+ Initialization: the policy is initialized with Xavier initialization except final layer weights are scaled down (by a factor of 100x). Note that since the baseline is linear (with RBF features) and estimated with a Newton step, the initialization is inconsequential.
472
+
473
+ Per-experiment configuration: The following parameters in Table 2 are for both state-only and action-dependent versions of the experiments. The $m$ -DimTargetMatching experiments use a linear feature baseline. Table 3 details the dimensionality of the action space for each task.
474
+
475
+ Table 2: Experiment details
476
+
477
+ <table><tr><td>Task</td><td>Benchmarks</td><td>Hand task</td><td>Peg Insertion</td><td>CommunicateTarget</td><td>m-DimTargetMatching</td></tr><tr><td>Trajectories</td><td>10</td><td>100</td><td>200</td><td>300</td><td>150</td></tr><tr><td>Horizon</td><td>1000</td><td>200</td><td>250</td><td>100</td><td>1</td></tr><tr><td>RBFfeatures</td><td>100</td><td>250</td><td>250</td><td>250</td><td>N/A</td></tr></table>
478
+
479
+ Table 3: Action dimensionality of tasks
480
+
481
+ <table><tr><td>Task</td><td>Action dimensions</td></tr><tr><td>Hopper</td><td>3</td></tr><tr><td>HalfCheetah</td><td>6</td></tr><tr><td>Ant</td><td>8</td></tr><tr><td>Hand</td><td>30</td></tr><tr><td>Peg</td><td>7</td></tr><tr><td>CommunicateTarget m-DimTargetMatching</td><td>8 (4 per agent) m</td></tr></table>
md/train/H1z-PsR5KX/H1z-PsR5KX.md ADDED
@@ -0,0 +1,344 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # IDENTIFYING AND CONTROLLING IMPORTANT NEURONS IN NEURAL MACHINE TRANSLATION
2
+
3
+ Anthony Bau1∗ Nadir Durrani2
4
+
5
+ Yonatan Belinkov1∗ Fahim Dalvi2
6
+
7
+ Hassan Sajjad2
8
+ James Glass1
9
+
10
+ 1MIT Computer Science and Artificial Intelligence Laboratory, Cambridge, MA 02139, USA
11
+ 2Qatar Computing Research Institute, HBKU Research Complex, Doha 5825, Qatar
12
+ {abau,belinkov,glass}@mit.edu
13
+ {hsajjad,ndurrani,faimaduddin}@qf.org.qa
14
+
15
+ # ABSTRACT
16
+
17
+ Neural machine translation (NMT) models learn representations containing substantial linguistic information. However, it is not clear if such information is fully distributed or if some of it can be attributed to individual neurons. We develop unsupervised methods for discovering important neurons in NMT models. Our methods rely on the intuition that different models learn similar properties, and do not require any costly external supervision. We show experimentally that translation quality depends on the discovered neurons, and find that many of them capture common linguistic phenomena. Finally, we show how to control NMT translations in predictable ways, by modifying activations of individual neurons.
18
+
19
+ # 1 INTRODUCTION
20
+
21
+ Neural machine translation (NMT) systems achieve state-of-the-art results by learning from large amounts of example translations, typically without additional linguistic information. Recent studies have shown that representations learned by NMT models contain a non-trivial amount of linguistic information on multiple levels: morphological (Belinkov et al., 2017a; Dalvi et al., 2017), syntactic (Shi et al., 2016b), and semantic (Hill et al., 2017). These studies use trained NMT models to generate feature representations for words, and use these representations to predict certain linguistic properties. This approach has two main limitations. First, it targets the whole vector representation and fails to analyze individual dimensions in the vector space. In contrast, previous work found meaningful individual neurons in computer vision (Zeiler & Fergus, 2014; Zhou et al., 2016; Bau et al., 2017, among others) and in a few NLP tasks (Karpathy et al., 2015; Radford et al., 2017; Qian et al., 2016a). Second, these methods require external supervision in the form of linguistic annotations. They are therefore limited by available annotated data and tools.
22
+
23
+ In this work, we make initial progress towards addressing these limitations by developing unsupervised methods for analyzing the contribution of individual neurons to NMT models. We aim to answer the following questions:
24
+
25
+ • How important are individual neurons for obtaining high-quality translations? • Do individual neurons in NMT models contain interpretable linguistic information? • Can we control MT output by intervening in the representation at the individual neuron level?
26
+
27
+ To answer these questions, we develop several unsupervised methods for ranking neurons according to their importance to an NMT model. Inspired by work in machine vision (Li et al., 2016b), we hypothesize that different NMT models learn similar properties, and therefore similar important neurons should emerge in different models. To test this hypothesis, we map neurons between pairs of trained NMT models using several methods: correlation analysis, regression analysis, and SVCCA, a recent method combining singular vectors and canonical correlation analysis (Raghu et al., 2017). Our mappings yield lists of candidate neurons containing shared information across models. We then evaluate whether these neurons carry important information to the NMT model by masking their activations during testing. We find that highly-shared neurons impact translation quality much more than unshared neurons, affirming our hypothesis that shared information matters.
28
+
29
+ Given the list of important neurons, we then investigate what linguistic properties they capture, both qualitatively by visualizing neuron activations and quantitatively by performing supervised classification experiments. We were able to identify neurons corresponding to several linguistic phenomena, including morphological and syntactic properties.
30
+
31
+ Finally, we test whether intervening in the representation at the individual neuron level can help control the translation. We demonstrate the ability to control NMT translations on three linguistic properties—tense, number, and gender—to varying degrees of success. This sets the ground for controlling NMT in desirable ways, potentially reducing system bias to properties like gender.
32
+
33
+ Our work indicates that not all information is distributed in NMT models, and that many humaninterpretable grammatical and structural properties are captured by individual neurons. Moreover, modifying the activations of individual neurons allows controlling the translation output according to specified linguistic properties. The methods we develop here are task-independent and can be used for analyzing neural networks in other tasks. More broadly, our work contributes to the localist/distributed debate in artificial intelligence and cognitive science (Gayler & Levy, 2011) by investigating the important case of neural machine translation.
34
+
35
+ # 2 RELATED WORK
36
+
37
+ Much recent work has been concerned with analyzing neural representations of linguistic units, such as word embeddings (Kohn, 2015; Qian et al., 2016b), sentence embeddings (Adi et al., 2016; ¨ Ganesh et al., 2017; Brunner et al., 2018), and NMT representations at different linguistic levels: morphological (Belinkov et al., 2017a), syntactic (Shi et al., 2016b), and semantic (Hill et al., 2017; Belinkov et al., 2017b). These studies follow a common methodology of evaluating learned representations on external supervision by training classifiers or measuring other kinds of correlations (Belinkov & Glass, 2019). Thus they are limited to the available supervised annotation. In addition, these studies do not typically consider individual dimensions. In contrast, we propose intrinsic unsupervised methods for detecting important neurons based on correlations between independently trained models. A similar approach was used to analyze vision models (Li et al., 2016b), but to the best of our knowledge these ideas were not applied to NMT or other NLP models before.
38
+
39
+ In computer vision, individual neurons were shown to capture meaningful information (Zeiler & Fergus, 2014; Zhou et al., 2016; Bau et al., 2017). Even though some doubts were cast on the importance of individual units (Morcos et al., 2018), recent work stressed their contribution to predicting specific object classes via masking experiments similar to ours (Zhou et al., 2018). A few studies analyzed individual neurons in NLP. For instance, neural language models learn specific neurons that activate on brackets (Karpathy et al., 2015), sentiment (Radford et al., 2017), and length (Qian et al., 2016a). Length-specific neurons were also found in NMT (Shi et al., 2016a), but generally not much work has been devoted to analyzing individual neurons in NMT. We aim to address this gap.
40
+
41
+ # 3 METHODOLOGY
42
+
43
+ Much recent work on analyzing NMT relies on supervised learning, where NMT representations are used as features for predicting linguistic annotations (see Section 2). However, such annotations may not be available, or may constrain the analysis to a particular scheme.
44
+
45
+ Instead, we propose to use different kinds of correlations between neurons from different models as a measure of their importance. Suppose we have $M$ such models and let $\mathbf { h } _ { t } ^ { m } [ i ]$ denote the activation of the $i$ -th neuron in the encoder of the $m$ -th model for the $t$ -th word.1 These may be models from different training epochs, trained with different random initializations or datasets, or even different architectures—all realistic scenarios that researchers often experiment with. Let $\mathbf { X } _ { i } ^ { m }$ denote a random variable corresponding to the $i$ -th neuron in the $m$ -th model. ${ \bf x } _ { i } ^ { m }$ maps words to their neuron activations: $\mathbf { x } _ { i } ^ { m } : t \mapsto \mathbf { h } _ { t } ^ { m } [ i ]$ . Similarly, let $\mathbf { x } ^ { m }$ denote a random vector corresponding to the activations of all neurons in the $m$ -th model: $\mathbf { x } ^ { m } : t \mapsto h _ { t } ^ { m }$ .
46
+
47
+ ![](images/2349fcc9fbd9d788d5adc0d43d99ede36422bab7c8e3b898768ae34b83e5f493.jpg)
48
+ Figure 1: An illustration of the correlation methods, showing how to compute the score for one neuron using each of the methods. Here the number of models is $M = 3$ , each having four neurons.
49
+
50
+ We consider four methods for ranking neurons, based on correlations between pairs of models. Our hypothesis is that different NMT models learn similar properties, and therefore similar important neurons emerge in different models, akin to neural vision models (Li et al., 2016b). Our methods capture different levels of localization/distributivity, as described next. See Figure 1 for illustration.
51
+
52
+ # 3.1 UNSUPERVISED CORRELATION METHODS
53
+
54
+ Maximum correlation The maximum correlation (MaxCorr) of neuron $\mathbf { X } _ { i } ^ { m }$ looks for the highest correlation with any neuron in all other models:
55
+
56
+ $$
57
+ \mathtt { M a x C o r r } ( \mathbf { x } _ { i } ^ { m } ) = \operatorname* { m a x } _ { \substack { j , m ^ { \prime } \neq m } } | \rho ( \mathbf { x } _ { i } ^ { m } , \mathbf { x } _ { j } ^ { m ^ { \prime } } ) |
58
+ $$
59
+
60
+ where $\rho ( \mathbf { x } , \mathbf { y } )$ is the Pearson correlation coefficient between $\mathbf { X }$ and y. We then rank the neurons in model $m$ according to their MaxCorr score. We repeat this procedure for every model $m$ . This score looks for neurons that capture properties that emerge strongly in two separate models.
61
+
62
+ Minimum correlation The minimum correlation (MinCorr) of neuron ${ \bf x } _ { i } ^ { m }$ looks for the neurons most correlated with $X _ { i } ^ { m }$ in each of the other models, but selects the one with the lowest correlation:
63
+
64
+ $$
65
+ \underset { \ b { m } ^ { \prime } \ b { \mathscr { A } } \ b { \mathscr { n } } } { \mathrm { M i n C o r r } } \bigl ( \mathbf { x } _ { i } ^ { m } \bigr ) = \underset { \ b { m } ^ { \prime } \neq \ b { m } } { \mathrm { m i n } } \underset { \ b { j } } { \mathrm { m a x } } \big | \rho \big ( \mathbf { x } _ { i } ^ { m } , \mathbf { x } _ { j } ^ { m ^ { \prime } } \big ) \big |
66
+ $$
67
+
68
+ Neurons in model $m$ are ranked according to their MinCorr score. This tries to find neurons that are well correlated with many other models, even if they are not the overall most correlated ones.
69
+
70
+ Regression ranking We perform linear regression $\scriptstyle \left( \mathrm { I } \ i \mathrm { n R e g } \right)$ ) from the full representation of another model $\mathbf { x } ^ { m ^ { \prime } }$ to the neuron $\mathbf { X } _ { i } ^ { m }$ . Then we rank neurons by the regression mean squared error. This attempts to find neurons whose information might be distributed in other models.
71
+
72
+ SVCCA Singular vector canonical correlation analysis (SVCCA) is a recent method for analyzing neural networks (Raghu et al., 2017). In our implementation, we perform PCA on each model’s representations $\mathbf { x } ^ { m }$ and take enough dimensions to account for $9 9 \%$ of the variance. For each pair of models, we obtain the canonically correlated basis, and rank the basis directions by their CCA coefficients. This attempts to capture information that may be distributed in less dimensions than the whole representation. In this case we get a ranking of directions, rather than individual neurons.
73
+
74
+ # 3.2 VERIFYING DETECTED NEURONS
75
+
76
+ We want to verify that neurons ranked highly by the unsupervised methods are indeed important for the NMT models. We consider quantitative and qualitative techniques for verifying their importance.
77
+
78
+ Erasing Neurons We test importance of neurons by erasing some of them during translation. Erasure is a useful technique for analyzing neural networks (Li et al., 2016a). Given a ranked list of neurons $\pi$ , where $\pi ( i )$ is the rank of neuron $\mathbf { X } _ { i }$ , we zero-out increasingly more neurons according to the ranking $\pi$ , starting from either the top or the bottom of the list. Our hypothesis is that erasing neurons from the top would hurt translation performance more than erasing from the bottom.
79
+
80
+ Concretely, we first run the entire encoder as usual, then zero out specific neurons from all source hidden states $\left\{ \mathbf { h } _ { 1 } , \ldots , \mathbf { h } _ { n } \right\}$ before running the decoder. For MaxCorr, MinCorr, and LinReg, we zero out individual neurons. To erase $k$ directions found by SVCCA, we instead project the embedding $\pmb { { \cal E } }$ (corresponding to all activations of a given model over a dataset) onto the space spanned by the non-erased directions: $E ^ { \prime } = E ( C ( C ^ { \tilde { T } } C ) ^ { - 1 } C ^ { T } )$ , where $C$ is the CCA projection matrix with the first or last $k$ columns removed. This corresponds to erasing from the top or bottom.
81
+
82
+ ![](images/86b8773cd2f4e099f00f21ac088538d43ace25355d979c16a16667c61da97a02.jpg)
83
+ Figure 2: Erasing neurons (or SVCCA directions) from the top and bottom of the list of most important neurons (directions) ranked by different unsupervised methods, in an English-Spanish model.
84
+
85
+ Supervised Verification While our focus is on unsupervised methods for finding important neurons, we also utilize supervision to verify our results. Importantly, these experiments are done post-hoc, after having a candidate neuron to examine. Since training a supervised classifier on every neuron is costly, we instead report simple metrics that can be easily computed. Specifically, we sometimes report the expected conditional variance of neuron activations conditioned on some property. In other cases we found it useful to estimate a Gaussian mixture model (GMM) for predicting a label and measure its prediction quality. The number of mixtures in the GMM is set according to the number of classes in the predicted property (e.g. 2 mixtures when predicting tokens inside or outside of parentheses), and its parameters are estimated using the mean and variance of the neuron activation conditioned on each class. We obtain linguistic annotations with Spacy: spacy.io.
86
+
87
+ Visualization Interpretability of machine learning models remains elusive (Lipton, 2016), but visualizing can be an instructive technique. Similar to previous work analyzing neural networks in NLP (Elman, 1991; Karpathy et al., 2015; Kad´ ar et al., 2016), we visualize activations of neurons ´ and observe interpretable behavior. We will illustrate this with example heatmaps below.
88
+
89
+ # 4 EXPERIMENTAL SETUP
90
+
91
+ Data We use the United Nations (UN) parallel corpus (Ziemski et al., 2016) for all experiments. We train models from English to 5 languages: Arabic, Chinese, French, Russian, and Spanish, as well as an English-English auto-encoder. For each target language, we train 3 models on different parts of the training set, each with 500K sentences. In total, we have 18 models. This setting allows us to compare models trained on the same language pairs but different training data, as well as models trained on different language pairs. We evaluate on the official test set.2
92
+
93
+ MT training We train 500 dimensional 2-layer LSTM encoder-decoder models with attention (Bahdanau et al., 2014). In order to study both word and sub-word properties, we use a word representation based on a character convolutional neural network (charCNN) as input to both encoder and decoder, which was shown to learn morphology in language modeling and NMT (Kim et al., 2015; Belinkov et al., 2017a).3 While we focus here on recurrent NMT, our approach can be applied to other models like the Transformer (Vaswani et al., 2017), which we leave for future work.
94
+
95
+ # 5 RESULTS
96
+
97
+ # 5.1 ERASURE EXPERIMENTS
98
+
99
+ Figure 2 shows erasure results using the methods from Section 3.1, on an English-Spanish model. For all four methods, erasing from the top hurts performance much more than erasing from the bottom. This confirms our hypothesis that neurons ranked higher by our methods have a larger impact on translation quality. Comparing erasure with different rankings, we find similar patterns with MaxCorr, MinCorr, and LinReg: erasing the top ranked $10 \%$ (50 neurons) degrades BLEU by 15-20 points, while erasing the bottom $10 \%$ neurons only hurts by 2-3 points. In contrast, erasing SVCCA directions results in rapid degradation: 15 BLEU point drop when erasing $1 \%$ (5) of the top directions, and poor performance when erasing $10 \%$ (50). This indicates that top SVCCA directions capture very important information in the model. We analyze these top neurons and directions in the next section, finding that top SVCCA directions focus mostly on identifying specific words.
100
+
101
+ ![](images/5cb52a75c52a4d32210c0a576fec8efeee669639933499d658b7f06bd27c62d8.jpg)
102
+ Figure 3: Erasing neurons from the top or bottom of the MaxCorr ranking in three language pairs.
103
+
104
+ Table 1: Top 10 neurons (or SVCCA directions) in an English-Spanish model according to the four methods, and the percentage of explained variance by conditioning on position or token identity.
105
+
106
+ <table><tr><td rowspan=1 colspan=11>MaxCorr MinCorr LinReg SVCCA</td></tr><tr><td rowspan=1 colspan=1>ID</td><td rowspan=1 colspan=1>Pos</td><td rowspan=1 colspan=2>Tok ID</td><td rowspan=1 colspan=1>Pos</td><td rowspan=1 colspan=1>Tok Ⅱ</td><td rowspan=1 colspan=1>ID</td><td rowspan=1 colspan=3>Pos Tok Pos</td><td rowspan=1 colspan=1>Tok</td></tr><tr><td rowspan=1 colspan=1>464</td><td rowspan=1 colspan=1>92%</td><td rowspan=1 colspan=1>10%</td><td rowspan=1 colspan=1>342</td><td rowspan=1 colspan=1>88%</td><td rowspan=1 colspan=1>7.9%</td><td rowspan=1 colspan=1>464</td><td rowspan=1 colspan=1>92%</td><td rowspan=1 colspan=1>10%</td><td rowspan=1 colspan=1>86%</td><td rowspan=1 colspan=1>26%</td></tr><tr><td rowspan=1 colspan=1>342</td><td rowspan=1 colspan=1>88%</td><td rowspan=1 colspan=1>7.9%</td><td rowspan=1 colspan=1>464</td><td rowspan=1 colspan=1>92%</td><td rowspan=1 colspan=1>10%</td><td rowspan=1 colspan=1>260</td><td rowspan=1 colspan=1>0.71%</td><td rowspan=1 colspan=1>94%</td><td rowspan=1 colspan=1>1.6%</td><td rowspan=1 colspan=1>90%</td></tr><tr><td rowspan=1 colspan=1>260</td><td rowspan=1 colspan=1>0.71%</td><td rowspan=1 colspan=1>94%</td><td rowspan=1 colspan=1>260</td><td rowspan=1 colspan=1>0.71%</td><td rowspan=1 colspan=1>94%</td><td rowspan=1 colspan=1>139</td><td rowspan=1 colspan=1>0.86%</td><td rowspan=1 colspan=1>93%</td><td rowspan=1 colspan=1>7.5%</td><td rowspan=1 colspan=1>85%</td></tr><tr><td rowspan=1 colspan=1>49</td><td rowspan=1 colspan=1>11%</td><td rowspan=1 colspan=1>6.1%</td><td rowspan=1 colspan=1>383</td><td rowspan=1 colspan=1>67%</td><td rowspan=1 colspan=1>6.5%</td><td rowspan=1 colspan=1>494</td><td rowspan=1 colspan=1>3.5%</td><td rowspan=1 colspan=1>96%</td><td rowspan=1 colspan=1>20%</td><td rowspan=1 colspan=1>79%</td></tr><tr><td rowspan=1 colspan=1>124</td><td rowspan=1 colspan=1>77%</td><td rowspan=1 colspan=1>48%</td><td rowspan=1 colspan=1>250</td><td rowspan=1 colspan=1>63%</td><td rowspan=1 colspan=1>6.8%</td><td rowspan=1 colspan=1>342</td><td rowspan=1 colspan=1>88%</td><td rowspan=1 colspan=1>7.9%</td><td rowspan=1 colspan=1>1.1%</td><td rowspan=1 colspan=1>89%</td></tr><tr><td rowspan=1 colspan=1>394</td><td rowspan=1 colspan=1>0.38%</td><td rowspan=1 colspan=1>22%</td><td rowspan=1 colspan=1>124</td><td rowspan=1 colspan=1>77%</td><td rowspan=1 colspan=1>47%</td><td rowspan=1 colspan=1>228</td><td rowspan=1 colspan=1>0.38%</td><td rowspan=1 colspan=1>96%</td><td rowspan=1 colspan=1>10%</td><td rowspan=1 colspan=1>76%</td></tr><tr><td rowspan=1 colspan=1>228</td><td rowspan=1 colspan=1>0.38%</td><td rowspan=1 colspan=1>96%</td><td rowspan=1 colspan=1>485</td><td rowspan=1 colspan=1>64%</td><td rowspan=1 colspan=1>10%</td><td rowspan=1 colspan=1>317</td><td rowspan=1 colspan=1>1.5%</td><td rowspan=1 colspan=1>83%</td><td rowspan=1 colspan=1>30%</td><td rowspan=1 colspan=1>57%</td></tr><tr><td rowspan=1 colspan=1>133</td><td rowspan=1 colspan=1>0.14%</td><td rowspan=1 colspan=1>87%</td><td rowspan=1 colspan=1>480</td><td rowspan=1 colspan=1>70%</td><td rowspan=1 colspan=1>12%</td><td rowspan=1 colspan=1>367</td><td rowspan=1 colspan=1>0.44%</td><td rowspan=1 colspan=1>89%</td><td rowspan=1 colspan=1>24%</td><td rowspan=1 colspan=1>55%</td></tr><tr><td rowspan=2 colspan=1>22190</td><td rowspan=1 colspan=1>1%</td><td rowspan=1 colspan=1>30%</td><td rowspan=1 colspan=1>154</td><td rowspan=1 colspan=1>63%</td><td rowspan=1 colspan=1>15%</td><td rowspan=1 colspan=1>106</td><td rowspan=1 colspan=1>0.25%</td><td rowspan=1 colspan=1>92%</td><td rowspan=1 colspan=1>23%</td><td rowspan=1 colspan=1>60%</td></tr><tr><td rowspan=1 colspan=1>0.49%</td><td rowspan=1 colspan=1>28%</td><td rowspan=1 colspan=1>139</td><td rowspan=1 colspan=1>0.86%</td><td rowspan=1 colspan=1>93%</td><td rowspan=1 colspan=1>383</td><td rowspan=1 colspan=1>67%</td><td rowspan=1 colspan=1>6.5%</td><td rowspan=1 colspan=1>18%</td><td rowspan=1 colspan=1>63%</td></tr></table>
107
+
108
+ Figure 3 shows the results of MaxCorr when erasing neurons from top and bottom, using models trained on three language pairs. In all cases, erasing from the top hurts performance more than erasing from the bottom. We found similar trends with other language pairs and ranking methods.
109
+
110
+ # 5.2 EVALUATING TOP NEURONS
111
+
112
+ What kind of information is captured by the neurons ranked highly by each of our ranking methods? Previous work found specific neurons in NMT that capture position of words in the sentence (Shi et al., 2016a). Do our methods capture similar properties? Indeed, we found that many top neurons capture position. For instance, Table 1 shows the top 10 ranked neurons from an English-Spanish model according to each of the methods. The table shows the percent of variance in neuron activation that is eliminated by conditioning on position in the sentence, calculated over the test set. Similarly, it shows the percent of explained variance by conditioning on the current token identity.
113
+
114
+ We observe an interesting difference between the ranking methods. LinReg and especially SVCCA, which are both computed by using multiple neurons, tend to find information determined by the identity of the current token. MinCorr and to a lesser extent MaxCorr tend to find position information. This suggests that information about the current token is often distributed in multiple neurons, which can be explained by the fact that tokens carry multiple kinds of linguistic information. In contrast, position is a fairly simple property that the NMT encoder can represent in a small number of neurons. That fact that many top MinCorr neurons capture position suggests that this kind of information is captured in multiple models in a similar way.
115
+
116
+ Table 2: $\mathrm { F _ { 1 } }$ scores of the top two neurons from each network for detecting tokens inside parentheses, and the ranks of the top neuron according to our intrinsic unsupervised methods.
117
+
118
+ <table><tr><td>Neuron</td><td>1st</td><td>2nd</td><td>Max</td><td>Min</td><td>Reg</td><td>Neuron</td><td>1st</td><td>2nd</td><td>Max</td><td>Min</td><td>Reg</td></tr><tr><td>en-es-1:232</td><td>0.66</td><td>0.23</td><td>15</td><td>45</td><td>27</td><td>en-ar-3:331</td><td>0.76</td><td>0.29</td><td>18</td><td>93</td><td>50</td></tr><tr><td>en-es-2:208</td><td>0.69</td><td>0.21</td><td>9</td><td>44</td><td>22</td><td>en-ru-1:259</td><td>0.74</td><td>0.23</td><td>11</td><td>48</td><td>45</td></tr><tr><td>en-es-3:47</td><td>0.56</td><td>0.22</td><td>12</td><td>35</td><td>24</td><td>en-ru-2:23</td><td>0.81</td><td>0.15</td><td>11</td><td>72</td><td>32</td></tr><tr><td>en-fr-1:449</td><td>0.51</td><td>0.24</td><td>38</td><td>43</td><td>15</td><td>en-ru-3:214</td><td>0.74</td><td>0.35</td><td>25</td><td>67</td><td>116</td></tr><tr><td>en-fr-2:361</td><td>0.58</td><td>0.25</td><td>29</td><td>45</td><td>61</td><td>en-zh-1:49</td><td>0.68</td><td>0.53</td><td>6</td><td>84</td><td>64</td></tr><tr><td>en-fr-3:205</td><td>0.35</td><td>0.33</td><td>228</td><td>236</td><td>206</td><td>en-zh-2:159</td><td>0.75</td><td>0.49</td><td>6</td><td>48</td><td>38</td></tr><tr><td>en-ar-1:212</td><td>0.45</td><td>0.41</td><td>85</td><td>79</td><td>41</td><td>en-zh-3:467</td><td>0.53</td><td>0.31</td><td>6</td><td>60</td><td>48</td></tr><tr><td>en-ar-2:166</td><td>0.75</td><td>0.26</td><td>6</td><td>119</td><td>67</td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
119
+
120
+ # 5.3 LINGUISTICALLY INTERPRETABLE NEURONS
121
+
122
+ Neurons that activate on specific tokens or capture position in the sentence are important in some of the methods, as shown in the previous section. But they are not highly ranked in all methods and are also less interesting from the perspective of capturing language information. In this section, we investigate several linguistic properties by measuring predictive capacity and visualizing neuron activations. The supplementary material discusses more properties. Further analysis of linguistically interpretable neurons is available in Dalvi et al. (2019a).
123
+
124
+ Parentheses Table 2 shows top neurons from each model for predicting that tokens are inside/outside of parentheses, quotes, or brackets, estimated by a GMM model. Often, the parentheses neuron is unique (low scores for the 2nd best neuron), suggesting that this property tends to be relatively localized. Generally, neurons that detect parentheses were ranked highly in most models by the MaxCorr method, indicating that they capture important patterns in multiple networks.
125
+
126
+ Figure 4 visualizes the most predictive neuron in an English-Spanish model. It activates positively (red) inside parentheses and negatively (blue) outside. Similar neurons were found in RNN language models (Karpathy et al., 2015). Next we consider more complicated linguistic properties.
127
+
128
+ ![](images/d4fb4650b31784fd79e2b1638d18b4829e92769965ebeab61b70547d693e88c7.jpg)
129
+ Figure 4: Visualization of a parentheses neuron from an English-Spanish model.
130
+
131
+ Tense We annotated the test data for verb tense (with Spacy) and trained a GMM model to predict tense from neuron activations. Figure 5 shows activations of a top-scoring neuron $( 0 . 6 6 ~ \mathrm { F _ { 1 } } )$ ) from the English-Arabic model on the first 5 test sentences. It tends to activate positively (red color) on present tense (“recognizes”, “recalls”, “commemorate”) and negatively (blue color) on past tense (“published”, “disbursed”, “held”). These results are obtained with a charCNN representation, which is sensitive to common suffixes like “-ed”, “-es”. However, this neuron also detects irregular past tense verbs like “held”, suggesting that it captures context in addition to sub-word information. The neuron also makes some mistakes by activating weakly positively on nouns ending with “s” (“videos”, “punishments”), presumably because it gets confused with the 3rd person present tense. Similarly, it activates positively on “Spreads”, even though it functions as a noun in this context.
132
+
133
+ <table><tr><td rowspan=1 colspan=7>7439th meeting held on 11 May 2015</td></tr><tr><td rowspan=1 colspan=6>ISIL itself haspublishedpushed-off buildings,decapitation and crucifixion</td><td rowspan=1 colspan=1>videos depicting people being subjected to a range of abhorrent punishments, including stoning,being</td></tr><tr><td rowspan=1 colspan=3>UNICEF</td><td rowspan=1 colspan=4>UNICEFdisbursed emergency cash assistance to tens of thousands of displaced families in camps and UNHcR distributed cashassistance to vulnerable families which had been internally displaced</td></tr><tr><td rowspan=1 colspan=7>31.Recognizes theimportant contributionof the African Peer Reviev Mechanism since itsinceptioninimproving governanceandsupporting socioeconomic development in African countries_,and recallsin this regard the high-level panel discussion held on 21October2013 on Africa&amp;apos;sinovationin governance through10 years oftheAfrican Peer Review Mechanism,organized duringthe sixty-eighth session of the General Assembly to commemorate the tenth anniversary of the Mechanism;</td></tr><tr><td rowspan=1 colspan=7>Spreads_betwen sovereignbonds in Germany and thoseinothercountries were relatively unaffectedbypoliticaland marketuncertainties concerning Greece in late 2ol4 and early 2015</td></tr></table>
134
+
135
+ Figure 5: Visualization of a neuron from an English-Arabic model that activates on verb tense: negative/positive for past/present. Examples shown are the first 5 sentences in the test set.
136
+
137
+ Table 3: Correlations $( \rho )$ and tense predictiveness $\mathrm { F _ { 1 } }$ score and Rank) of the most correlated neurons in all models relative to a tense neuron in an English-Arabic model.
138
+
139
+ <table><tr><td>Neuron</td><td>p</td><td>F1</td><td>R</td><td>Neuron</td><td>p</td><td>F1</td><td>R</td><td>Neuron</td><td>p</td><td>F1</td><td>R</td></tr><tr><td>en-ar-1:8</td><td>1</td><td>0.67</td><td>1</td><td>en-fr-1:314</td><td>0.48</td><td>0.46</td><td>1</td><td>en-zh-1:383</td><td>-0.51</td><td>0.54</td><td>1</td></tr><tr><td>en-ar-2:303</td><td>0.57</td><td>0.43</td><td>3</td><td>en-fr-2:333</td><td>-0.58</td><td>0.61</td><td>2</td><td>en-zh-2:451</td><td>-0.18</td><td>0.29</td><td>2</td></tr><tr><td>en-ar-3:108</td><td>0.66</td><td>0.62</td><td>1</td><td>en-fr-3:399</td><td>-0.69</td><td>0.6</td><td>1</td><td>en-zh-3:165</td><td>-0.30</td><td>0.28</td><td>6</td></tr><tr><td>en-es-1:114</td><td>0.56</td><td>0.59</td><td>1</td><td>en-ru-1:330</td><td>-0.39</td><td>0.54</td><td>1</td><td>en-en-1:180</td><td>-0.03</td><td>0</td><td>471</td></tr><tr><td>en-es-2:282</td><td>-0.36</td><td>0.46</td><td>3</td><td>en-ru-2:489</td><td>0.29</td><td>0.08</td><td>27</td><td>en-en-2:24</td><td>-0.19</td><td>0</td><td>319</td></tr><tr><td>en-es-3:255</td><td>-0.22</td><td>0.26</td><td>8</td><td>en-ru-3:397</td><td>-0.50</td><td>0.52</td><td>1</td><td>en-en-3:486</td><td>-0.33</td><td>0.51</td><td>1</td></tr></table>
140
+
141
+ Table 3 shows correlations of neurons most correlated with this tense neuron, according to MaxCorr. All these neurons are highly predictive of tense: all but 3 are in the top 10 and 8 out of 15 (non-auto-encoder) neurons have the highest $\mathrm { F _ { 1 } }$ score for predicting tense. The auto-encoder English models are an exception, exhibiting much lower correlations with the English-Arabic tense neuron. This suggests that tense emerges in a “real” NMT model, but not in an auto-encoder that only learns to copy. Interestingly, English-Chinese models have somewhat lower correlated neurons with the tense neuron, possibly due to the lack of explicit tense marking in Chinese. The encoder does not need to pay as much attention to tense when generating representations for the decoder.
142
+
143
+ Other Properties We found many more linguistic properties by visualizing top neurons ranked by our methods, especially with MaxCorr. We briefly mention some of these here and provide more details and quantitative results in the appendix. We found neurons that activate on numbers, dates, adjectives, plural nouns, auxiliary verbs, and more. We also investigated noun phrase segmentation, a compositional property above the word level, and found high-scoring neurons $( 6 0 \%$ accuracy) in every network. Many of these neurons were ranked highly by the MaxCorr method. In contrast, other methods did not rank such neurons very highly. See Table 5 in the appendix for the full results.
144
+
145
+ Some neurons have quite complicated behavior. For example, when visualizing neurons highly ranked by MaxCorr we found a neuron that activates on numbers in the beginning of a sentence, but not elsewhere (see Figure 9 in the appendix). It would be difficult to conceive of a supervised prediction task which would capture this behavior a-priori, without knowing what to look for. Our unsupervised methods are flexible enough to find any neurons deemed important by the NMT model, without constraining the analysis to properties for which we have supervised annotations.
146
+
147
+ # 6 CONTROLLING TRANSLATIONS
148
+
149
+ In this section, we explore a potential benefit of finding important neurons with linguistically meaningful properties: controlling the translation output. This may be important for mitigating biases in neural networks. For instance, gender stereotypes are often reflected in automatic translations, as the following motivating examples from Google Translate demonstrate.4
150
+
151
+ (1) a. o bir doctor (2) a. o bir hems¸ire b. he is a doctor b. she is a nurse
152
+
153
+ The Turkish sentences (1a, 2a) have no gender information—they can refer to either male or female. But the MT system is biased to think that doctors are usually men and nurses are usually women, so its generated translations (1b, 2b) represent these biases. If we know the correct gender from another source such as metadata, we may want to encourage the system to output a translation with the correct gender. We make here a modest step towards this goal by intervening in neuron activations to induce a desired translation.5
154
+
155
+ ![](images/cdd86b9f1adc163e830ae5d9b53faa9b252546a777e9f484b99cab332629abf0.jpg)
156
+ Figure 6: Success rates and BLEU scores for controlling NMT by modifying neuron activations.
157
+
158
+ We conjecture that if a given neuron matters to the model, then we can control the translation in predictable ways by modifying its activations. To do this, we first encode the source sentence as usual. Before decoding, we set the activation of a particular neuron in the encoder state to a value $\alpha$ , which is a function of the mean activations over a particular property (defined below). To evaluate our ability to control the translation, we design the following protocol:
159
+
160
+ 1. Tag the source and target sentences in the development set with a desired property, such as gender (masculine/feminine). We use Spacy for these tags.
161
+ 2. Obtain word alignments for the development set using an alignment model trained on 2 million sentences of the UN data. We use fast align (Dyer et al., 2013) with default settings.
162
+ 3. For every neuron in the encoder, predict the target property on the word aligned to its source word activations using a supervised GMM model.6
163
+ 4. For every word having a desired property, modify the source activations of the top $k$ neurons found in step 3 and generate a modified translation. The modification value is defined as $\alpha = \mu _ { 1 } + \beta \bar { ( } \mu _ { 1 } - \mu _ { 2 } \bar { ) }$ , where $\mu _ { 1 }$ and $\mu _ { 2 }$ are mean activations of the property we modify from and to, respectively (e.g. modifying gender from masculine to feminine), and $\beta$ is a hyperparameter.
164
+ 5. Tag the output translation and word-align it to the source. Declare success if the source word was aligned to a target word with the desired property value (e.g. feminine).
165
+
166
+ # 6.1 RESULTS
167
+
168
+ Figure 6 shows translation control results in an English-Spanish model. We report success rate—the percentage of cases where the word was aligned to a target word with the desired property—and the effect on BLEU scores, when varying $\alpha$ . Our tense control results are the most successful, with up to $67 \%$ success rate for changing past-to-present. Modifications generally degrade BLEU, but the loss at the best success rate is not large (2 BLEU points). Appendix A.2 provides more tense results.
169
+
170
+ Controlling other properties seems more difficult, with the best success rate for controlling number at $37 \%$ , using the top 5 number neurons. Gender is the most difficult to control, with a $21 \%$ success rate using the top 5 neurons. Modifying even more neurons did not help. We conjecture that these properties are more distributed than tense, which makes controlling them more difficult. Future work can explore more sophisticated methods for controlling multiple neurons simultaneously.
171
+
172
+ # 6.2 EXAMPLE TRANSLATIONS
173
+
174
+ We provide examples of controlling translation of number, gender, and tense. While these are cherrypicked examples, they illustrate that the controlling procedure can work in multiple properties and languages. We discuss language-specific patterns below.
175
+
176
+ Table 4: Examples for controlling translation by modifying activations of different neurons on the italicized source words. $\alpha =$ modification value $\underline { { \underline { { \mathbf { \Pi } } } } }$ , no modification).
177
+ (a) Controlling number when translating “The interested parties” to Spanish.
178
+ (b) Controlling gender when translating “The interested parties” (left) and “Questions relating to information” (right) to Spanish.
179
+
180
+ <table><tr><td>α</td><td>Translation</td><td>Num</td><td>α</td><td>Translation</td><td>Num</td></tr><tr><td>-1</td><td>abiertas particulares</td><td>pl.</td><td>0.125</td><td>La parte interesada</td><td>sing.</td></tr><tr><td>-0.5</td><td>Observaciones interesadas</td><td>pl.</td><td>0.25</td><td>Cuestion interesada</td><td>sing.</td></tr><tr><td>-0.25,-0.125, 0</td><td>Las partes interesadas</td><td>pl.</td><td>0.5,1</td><td>Gran util</td><td>sing.</td></tr></table>
181
+
182
+ (c) Controlling tense when translating “The committee supported the efforts of the authorities”.
183
+
184
+ <table><tr><td>α</td><td>Translation</td><td>Gen</td><td>α</td><td>Translation</td><td>Gen</td></tr><tr><td>-0.5,-0.25</td><td>Los partidos interados</td><td>ms.</td><td>-1</td><td>Temas relativos a la informacion</td><td>ms.</td></tr><tr><td>0, 0.25</td><td>Las partes interesadas</td><td>fm.</td><td>-0.5,0, 0.5</td><td>Cuestiones relativas a la informaci6n</td><td>fm.</td></tr></table>
185
+
186
+ <table><tr><td></td><td>a</td><td>Translation</td><td>Tense</td></tr><tr><td>Arabic</td><td>-/+10</td><td>{Fpl={i -vglL/ly}²y-lε/li—past/present</td><td></td></tr><tr><td>French</td><td>-1-20</td><td>Le Comité a appuyé/appuie les efforts des autorités</td><td>past/present</td></tr><tr><td>Spanish</td><td>-1-3/0</td><td>El Comité apoy6/apoyaba/apoya los esfuerzos de las autoridades</td><td>|past/impf./present</td></tr><tr><td>Russian</td><td>-/-1</td><td>KOMNTeT IIOJJIepKaJI/IIOJIep&gt;KNBaeT yCMJINЯ BJIaCTe</td><td>past/present</td></tr><tr><td>Chinese</td><td>-1-50</td><td>委员会支持当局的努力/委员会正在支持当局的努力</td><td>丨untensed/present</td></tr></table>
187
+
188
+ Number Table 4a shows translation control results for a number neuron from an English-Spanish model, which activates negatively/positively on plural/singular nouns. The translation changes from plural to singular as we increase the modification $\alpha$ . We notice that using too high $\alpha$ values yields nonsense translations, but with correct number: transitioning from the plural adjective particulares (“particular”) to the singular adjective util ´ (“useful”). In between, we see a nice transition between plural and singular translations. Interestingly, the translations exhibit correct agreement between the modified noun and its adjectives and determines, e.g., Las partes interesadas vs. La parte interesada. This is probably due to the strong language model in the decoder.
189
+
190
+ Gender Table 4b shows examples of controlling gender translation for a gender neuron from the same model, which activates negatively/positively on masculine/feminine nouns. The translations of “parties” and “questions” change from masculine to feminine synonyms as we increase the modification $\alpha$ . Generally, we found it difficult to control gender, as also suggested by the relatively low success rate.
191
+
192
+ Tense Table 4c shows examples of controlling tense when translating from English to five target languages. In all language pairs, we are able to change the translation from past to present by modifying the activation of the tense neurons from the previous section (Table 3). Occasionally, modifying the activation on a single word leads to a change in phrasing; in Arabic the translation changes to “the efforts that the authorities invest”. In Spanish, we find a transition from past (apoyo´) to imperfect (apoyaba) to present (apoya). Interestingly, in Chinese, we had to use a fairly large $\alpha$ value (in absolute terms), consistent with the fact that tense is not usually marked in Chinese. In fact, our modification generates a Chinese expression ( 在) that is used to express an action in progress, 正similar to English “-ing”, resulting in the meaning “is supporting”.
193
+
194
+ # 7 CONCLUSION
195
+
196
+ Neural machine translation models learn vector representations that contain linguistic information while being trained solely on example translations. In this work, we developed unsupervised methods for finding important neurons in NMT, and evaluated how these neurons impact translation quality. We analyzed several linguistic properties that are captured by individual neurons using quantitative prediction tasks and qualitative visualizations. We also designed a protocol for controlling translations by modifying neurons that capture desired properties.
197
+
198
+ Our analysis can be extended to other NMT components (e.g. the decoder) and architectures (Gehring et al., 2017; Vaswani et al., 2017), as well as other tasks. We believe that more work should be done to analyze the spectrum of localized vs. distributed information in neural language representations. We would also like to expand the translation control experiments to other architectures and components (e.g. the decoder), and to develop more sophisticated ways to control translation output, for example by modifying representations in variational NMT architectures (Zhang et al., 2016; Su et al., 2018). Our code is publicly available as part of the NeuroX toolkit (Dalvi et al., 2019b).7
199
+
200
+ # ACKNOWLEDGEMENTS
201
+
202
+ This research was carried out in collaboration between the HBKU Qatar Computing Research Institute (QCRI) and the MIT Computer Science and Artificial Intelligence Laboratory (CSAIL). Y.B. is also supported by the Harvard Mind, Brain, and Behavior Initiative (MBB).
203
+
204
+ # REFERENCES
205
+
206
+ Yossi Adi, Einat Kermany, Yonatan Belinkov, Ofer Lavi, and Yoav Goldberg. Fine-grained Analysis of Sentence Embeddings Using Auxiliary Prediction Tasks. arXiv preprint arXiv:1608.04207, 2016.
207
+
208
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. arXiv preprint arXiv:1409.0473, 2014.
209
+
210
+ David Bau, Bolei Zhou, Aditya Khosla, Aude Oliva, and Antonio Torralba. Network dissection: Quantifying interpretability of deep visual representations. In Computer Vision and Pattern Recognition, 2017.
211
+
212
+ Yonatan Belinkov and James Glass. Analysis Methods in Neural Language Processing: A Survey. Transactions of the Association for Computational Linguistics (TACL), 2019.
213
+
214
+ Yonatan Belinkov, Nadir Durrani, Fahim Dalvi, Hassan Sajjad, and James Glass. What do Neural Machine Translation Models Learn about Morphology? In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 861–872. Association for Computational Linguistics, 2017a. doi: 10.18653/v1/P17-1080. URL http://www.aclweb.org/anthology/P17-1080.
215
+
216
+ Yonatan Belinkov, Llu´ıs Marquez, Hassan Sajjad, Nadir Durrani, Fahim Dalvi, and James Glass. \` Evaluating layers of representation in neural machine translation on part-of-speech and semantic tagging tasks. In Proceedings of the Eighth International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pp. 1–10, Taipei, Taiwan, November 2017b. Asian Federation of Natural Language Processing. URL http://www.aclweb.org/anthology/I17- 1001.
217
+
218
+ Gino Brunner, Yuyi Wang, Roger Wattenhofer, and Michael Weigelt. Natural Language Multitasking: Analyzing and Improving Syntactic Saliency of Hidden Representations. arXiv preprint arXiv:1801.06024, 2018.
219
+
220
+ Fahim Dalvi, Nadir Durrani, Hassan Sajjad, Yonatan Belinkov, and Stephan Vogel. Understanding and improving morphological learning in the neural machine translation decoder. In Proceedings of the Eighth International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pp. 142–151, Taipei, Taiwan, November 2017. Asian Federation of Natural Language Processing. URL http://www.aclweb.org/anthology/I17-1015.
221
+
222
+ Fahim Dalvi, Nadir Durrani, Hassan Sajjad, Yonatan Belinkov, D. Anthony Bau, and James Glass. What is one Grain of Sand in the Desert? Analyzing Individual Neurons in Deep NLP Models. In Proceedings of the AAAI Conference on Artificial Intelligence (AAAI), January 2019a.
223
+
224
+ Fahim Dalvi, Avery Nortonsmith, D. Anthony Bau, Yonatan Belinkov, Hassan Sajjad, Nadir Durrani, and James Glass. NeuroX: A Toolkit for Analyzing Individual Neurons in Neural Networks. In Proceedings of the AAAI Conference on Artificial Intelligence (AAAI), Honolulu, USA, January 2019b.
225
+
226
+ Chris Dyer, Victor Chahuneau, and Noah A. Smith. A Simple, Fast, and Effective Reparameterization of IBM Model 2. In Proceedings of the 2013 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 644–648. Association for Computational Linguistics, 2013. URL http://www.aclweb.org/ anthology/N13-1073.
227
+
228
+ Jeffrey L. Elman. Distributed representations, simple recurrent networks, and grammatical structure. Machine learning, 7(2-3):195–225, 1991.
229
+
230
+ J. Ganesh, Manish Gupta, and Vasudeva Varma. Interpretation of Semantic Tweet Representations. In Proceedings of the 2017 IEEE/ACM International Conference on Advances in Social Networks Analysis and Mining 2017, ASONAM ’17, pp. 95–102, New York, NY, USA, 2017. ACM. ISBN 978-1-4503-4993-2. doi: 10.1145/3110025.3110083. URL http://doi.acm.org/ 10.1145/3110025.3110083.
231
+
232
+ Ross W. Gayler and Simon D. Levy. Compositional connectionism in cognitive science ii: the localist/distributed dimension. Connection Science, 23(2):85–89, 2011. doi: 10.1080/ 09540091.2011.587505. URL https://doi.org/10.1080/09540091.2011.587505.
233
+
234
+ Jonas Gehring, Michael Auli, David Grangier, Denis Yarats, and Yann N. Dauphin. Convolutional Sequence to Sequence Learning. In Doina Precup and Yee Whye Teh (eds.), Proceedings of the 34th International Conference on Machine Learning, volume 70 of Proceedings of Machine Learning Research, pp. 1243–1252, International Convention Centre, Sydney, Australia, 06–11 Aug 2017. PMLR. URL http://proceedings.mlr.press/v70/gehring17a.html.
235
+
236
+ Mario Giulianelli, Jack Harding, Florian Mohnert, Dieuwke Hupkes, and Willem Zuidema. Under the Hood: Using Diagnostic Classifiers to Investigate and Improve how Language Models Track Agreement Information. In Proceedings of the 2018 EMNLP Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, pp. 240–248. Association for Computational Linguistics, 2018. URL http://aclweb.org/anthology/W18-5426.
237
+
238
+ Felix Hill, Kyunghyun Cho, Sebastien Jean, and Yoshua Bengio. The representational geometry of ´ word meanings acquired by neural machine translation models. Machine Translation, 31(1):3– 18, Jun 2017. ISSN 1573-0573. doi: 10.1007/s10590-017-9194-2. URL https://doi.org/ 10.1007/s10590-017-9194-2.
239
+
240
+ Akos K ´ ad´ ar, Grzegorz Chrupała, and Afra Alishahi. Representation of linguistic form and function ´ in recurrent neural networks. arXiv preprint arXiv:1602.08952, 2016.
241
+
242
+ Andrej Karpathy, Justin Johnson, and Li Fei-Fei. Visualizing and understanding recurrent networks. arXiv preprint arXiv:1506.02078, 2015.
243
+
244
+ Yoon Kim, Yacine Jernite, David Sontag, and Alexander M Rush. Character-aware Neural Language Models. arXiv preprint arXiv:1508.06615, 2015.
245
+
246
+ Arne Kohn. What’s in an Embedding? Analyzing Word Embeddings through Multilingual Eval- ¨ uation. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pp. 2067–2073, Lisbon, Portugal, September 2015. Association for Computational Linguistics. URL http://aclweb.org/anthology/D15-1246.
247
+
248
+ Jiwei Li, Will Monroe, and Dan Jurafsky. Understanding Neural Networks through Representation Erasure. arXiv preprint arXiv:1612.08220, 2016a.
249
+
250
+ Yixuan Li, Jason Yosinski, Jeff Clune, Hod Lipson, and John Hopcroft. Convergent Learning: Do different neural networks learn the same representations? In International Conference for Learning Representations (ICLR), 2016b.
251
+
252
+ Zachary C Lipton. The Mythos of Model Interpretability. In ICML Workshop on Human Interpretability in Machine Learning (WHI), 2016.
253
+
254
+ Ari S. Morcos, David G.T. Barrett, Neil C. Rabinowitz, and Matthew Botvinick. On the importance of single directions for generalization. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } }$ r1iuQjxCZ.
255
+
256
+ Peng Qian, Xipeng Qiu, and Xuanjing Huang. Analyzing Linguistic Knowledge in Sequential Model of Sentence. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pp. 826–835, Austin, Texas, November 2016a. Association for Computational Linguistics. URL https://aclweb.org/anthology/D16-1079.
257
+
258
+ Peng Qian, Xipeng Qiu, and Xuanjing Huang. Investigating Language Universal and Specific Properties in Word Embeddings. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1478–1488, Berlin, Germany, August 2016b. Association for Computational Linguistics. URL http://www.aclweb.org/ anthology/P16-1140.
259
+
260
+ Alec Radford, Rafal Jozefowicz, and Ilya Sutskever. Learning to generate reviews and discovering sentiment. arXiv preprint arXiv:1704.01444, 2017.
261
+
262
+ Maithra Raghu, Justin Gilmer, Jason Yosinski, and Jascha Sohl-Dickstein. SVCCA: Singular Vector Canonical Correlation Analysis for Deep Learning Dynamics and Interpretability. 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. 6078–6087. Curran Associates, Inc., 2017. URL http://papers.nips.cc/paper/7188-svcca-singular-vectorcanonical-correlation-analysis-for-deep-learning-dynamics-andinterpretability.pdf.
263
+
264
+ Rico Sennrich, Barry Haddow, and Alexandra Birch. Neural machine translation of rare words with subword units. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1715–1725. Association for Computational Linguistics, 2016. doi: 10.18653/v1/P16-1162. URL http://www.aclweb.org/anthology/P16- 1162.
265
+
266
+ Xing Shi, Kevin Knight, and Deniz Yuret. Why Neural Translations are the Right Length. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pp. 2278–2282. Association for Computational Linguistics, 2016a. doi: 10.18653/v1/D16-1248. URL http://www.aclweb.org/anthology/D16-1248.
267
+
268
+ Xing Shi, Inkit Padhi, and Kevin Knight. Does String-Based Neural MT Learn Source Syntax? In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pp. 1526–1534, Austin, Texas, November 2016b. Association for Computational Linguistics. URL https://aclweb.org/anthology/D16-1159.
269
+
270
+ Jinsong Su, Shan Wu, Deyi Xiong, Yaojie Lu, Xianpei Han, and Biao Zhang. Variational Recurrent Neural Machine Translation. In Proceedings of the Thirty-Second AAAI Conference on Artificial Intelligence (AAAI-18), 2018.
271
+
272
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Ł ukasz Kaiser, and Illia Polosukhin. Attention is All you Need. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett (eds.), Advances in Neural Information Processing Systems 30, pp. 5998–6008. Curran Associates, Inc., 2017. URL http://papers.nips.cc/paper/7181-attention-is-all-you-need.pdf.
273
+
274
+ Matthew D Zeiler and Rob Fergus. Visualizing and understanding convolutional networks. In European conference on computer vision, pp. 818–833. Springer, 2014.
275
+
276
+ Biao Zhang, Deyi Xiong, jinsong su, Hong Duan, and Min Zhang. Variational Neural Machine Translation. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pp. 521–530. Association for Computational Linguistics, 2016. doi: 10.18653/v1/ D16-1050. URL http://www.aclweb.org/anthology/D16-1050.
277
+
278
+ B. Zhou, A. Khosla, Lapedriza. A., A. Oliva, and A. Torralba. Learning Deep Features for Discriminative Localization. CVPR, 2016.
279
+
280
+ Bolei Zhou, Yiyou Sun, David Bau, and Antonio Torralba. Revisiting the Importance of Individual Units in CNNs via Ablation. arXiv preprint arXiv:1806.02891, 2018.
281
+
282
+ Michał Ziemski, Marcin Junczys-Dowmunt, and Bruno Pouliquen. The United Nations Parallel Corpus v1.0. In Nicoletta Calzolari (Conference Chair), Khalid Choukri, Thierry Declerck, Sara Goggi, Marko Grobelnik, Bente Maegaard, Joseph Mariani, Helene Mazo, Asuncion Moreno, Jan Odijk, and Stelios Piperidis (eds.), Proceedings of the Tenth International Conference on Language Resources and Evaluation (LREC 2016), Paris, France, may 2016. European Language Resources Association (ELRA). ISBN 978-2-9517408-9-1.
283
+
284
+ # A ADDITIONAL RESULTS AND VISUALIZATIONS
285
+
286
+ # A.1 NOUN PHRASE SEGMENTATION
287
+
288
+ Table 5 shows the top neurons from each network by accuracy when classifying interior, exterior, or beginning of a noun phrase. The annotations were obtained with Spacy. We found high-scoring neurons $6 0 \%$ accuracy) in every network. Many of these neurons were ranked highly by the MaxCorr ranking methods. In contrast, other correlation methods did not rank such neurons very highly. Thus there is correspondence between a high rank by our intrinsic unsupervised measure MaxCorr and the neuron’s capacity to predict external annotation.
289
+
290
+ Table 5: Top neuron from each network by accuracy for classifying interior, exterior, or beginning of a noun phrase, as well as ranking of these neurons by our intrinsic unsupervised measures.
291
+
292
+ <table><tr><td></td><td rowspan=2 colspan=1>Neuron</td><td rowspan=2 colspan=1>Accuracy</td><td rowspan=2 colspan=3>RankMaxCorr MinCorr LinReg</td></tr><tr><td></td><td rowspan=1 colspan=1>MinCorr</td><td rowspan=1 colspan=1>LinReg</td></tr><tr><td></td><td rowspan=1 colspan=1>en-es-1:221</td><td rowspan=1 colspan=1>0.78</td><td rowspan=1 colspan=1>9</td><td rowspan=1 colspan=1>53</td><td rowspan=1 colspan=1>58</td></tr><tr><td></td><td rowspan=1 colspan=1>en-es-2:158</td><td rowspan=1 colspan=1>0.76</td><td rowspan=1 colspan=1>12</td><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>65</td></tr><tr><td></td><td rowspan=1 colspan=1>en-es-3:281</td><td rowspan=1 colspan=1>0.72</td><td rowspan=1 colspan=1>25</td><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>111</td></tr><tr><td></td><td rowspan=1 colspan=1>en-fr-1:111</td><td rowspan=1 colspan=1>0.76</td><td rowspan=1 colspan=1>13</td><td rowspan=1 colspan=1>63</td><td rowspan=1 colspan=1>123</td></tr><tr><td></td><td rowspan=1 colspan=1>en-fr-2:85</td><td rowspan=1 colspan=1>0.74</td><td rowspan=1 colspan=1>33</td><td rowspan=1 colspan=1>46</td><td rowspan=1 colspan=1>88</td></tr><tr><td></td><td rowspan=1 colspan=1>en-fr-3:481</td><td rowspan=1 colspan=1>0.75</td><td rowspan=1 colspan=1>14</td><td rowspan=1 colspan=1>66</td><td rowspan=1 colspan=1>135</td></tr><tr><td></td><td rowspan=1 colspan=1>en-ar-1:168</td><td rowspan=1 colspan=1>0.71</td><td rowspan=1 colspan=1>17</td><td rowspan=1 colspan=1>59</td><td rowspan=1 colspan=1>49</td></tr><tr><td rowspan=3 colspan=2>en-ar-2:190en-ar-3:383en-ru-1:38</td><td rowspan=1 colspan=1>en-ar-2:190</td><td rowspan=1 colspan=1>0.76</td><td rowspan=1 colspan=1>48</td><td rowspan=1 colspan=1>81</td></tr><tr><td rowspan=1 colspan=1>0.70</td><td rowspan=1 colspan=1>16</td><td rowspan=1 colspan=1>80</td><td rowspan=1 colspan=1>77</td></tr><tr><td rowspan=1 colspan=1>0.66</td><td rowspan=1 colspan=1>36</td><td rowspan=1 colspan=1>55</td><td rowspan=1 colspan=1>159</td></tr><tr><td rowspan=5 colspan=2>en-ru-2:130en-ru-3:78en-zh-1:427en-zh-2:199en-zh-3:28</td><td rowspan=1 colspan=1>0.67</td><td rowspan=1 colspan=1>35</td><td rowspan=1 colspan=1>65</td><td rowspan=5 colspan=1>13612424023344</td></tr><tr><td rowspan=1 colspan=1>0.66</td><td rowspan=1 colspan=1>160</td><td rowspan=1 colspan=1>108</td></tr><tr><td rowspan=1 colspan=1>0.64</td><td rowspan=1 colspan=1>23</td><td rowspan=1 colspan=1>76</td></tr><tr><td rowspan=1 colspan=1>0.65</td><td rowspan=1 colspan=1>187</td><td rowspan=1 colspan=1>218</td></tr><tr><td rowspan=1 colspan=1>0.67</td><td rowspan=1 colspan=1>65</td><td rowspan=1 colspan=1>33</td></tr></table>
293
+
294
+ # A.2 CONTROLLING TRANSLATIONS
295
+
296
+ We provide additional translation control results. Table 6 shows the tense results using the best modification value from Figure 6a. We report the number of times the source word was aligned to a target word which is past or present, or to multiple words that include both or neither of these tenses. The success rate is the percentage of cases where the word was aligned to a target word with the desired tense. By modifying the activation of only one neuron (the most predictive one), we were able to change the translation from past to present in $67 \%$ of the times and vice-versa in $49 \%$ of the times. In many other cases, the tense was erased, that is, the modified source word was not aligned to any tensed word, which is a partial success.
297
+
298
+ Table 6: Results for controlling tense.
299
+
300
+ <table><tr><td></td><td rowspan="3">To Past</td><td rowspan="3">Present</td><td rowspan="3">Both</td><td rowspan="3">Neither</td><td rowspan="3"> Success Rate</td></tr><tr><td>From</td><td></td></tr><tr><td></td><td>820</td></tr><tr><td>Past Present</td><td></td><td>85 1586</td><td>256</td><td>9 30</td><td>311 1363</td><td>67% 49%</td></tr></table>
301
+
302
+ # A.3 VISUALIZATIONS
303
+
304
+ Here we provide additional visualizations of neurons capturing different linguistic properties.
305
+
306
+ Noun phrases We visualize the top scoring neuron $( 7 9 \% )$ from an English-Spanish model in Figure 7. Notice how the neuron activates positively (red color) on the first word in the noun phrases, but negatively (blue color) on the rest of the noun phrase (e.g. “Regional” in “Regional Service Centre”).
307
+
308
+ ![](images/f246b5c26d0d91ff06492380fa529bf3ede9f8856273b92e22759a39e78b57d2.jpg)
309
+
310
+ Figure 7: Visualization of a neuron from an English-Spanish model that activates positively (red color) on the first word in the noun phrase and negatively (blue) on the following words.
311
+
312
+ Dates and Numbers Figure 8 shows activations of neurons capturing dates and numbers. These neurons were ranked highly (top 30) by MaxCorr when ranking an English-Arabic model trained with charCNN representations. We note that access to character information leads to many neurons capturing sub-word information such as years (4-digit numbers). The first neuron is especially sensitive to month names (“May”, “April”). The second neuron is an approximate year-detector: it is sensitive to years (“2015”) as well as other tokens with four digits (“7439th”, “10.15”).
313
+
314
+ ![](images/29f0f2dbfb18b6da294aa868e2c5aea16b91e9f0ff0fed7fcded046e99ef7d66.jpg)
315
+ Figure 8: Neurons capturing dates and numbers.
316
+
317
+ List items Figure 9 shows an interesting case of a neuron that is sensitive to the appearance of two properties simultaneously: position in the beginning of the sentence and number format. Notice that it activates strongly (negatively) on numbers when they open a sentence but not in the middle of the sentence. Conversely, it does not activate strongly on non-number words that open a sentence. This neuron aims to capture patterns of opening list items.
318
+
319
+ # A.4 RESULTS ON MODELS FROM DIFFERENT EPOCHS
320
+
321
+ In the main experiments in the paper, we have used models trained on different parts of the training data, as well as on different language pairs. However, our methodology can be applied to any collection of models that we think should exhibit correlations in their neurons. We have verified that this approach works with model checkpoints from different epochs of the same training run. Concretely, we computed MaxCorr scores for the last checkpoint in two models—English-Spanish and English-Arabic—when comparing to other checkpoints. In both cases, we found highly correlated neurons across checkpoints, especially in the last few checkpoints. We also observed that erasing the top neurons hurt translation performance more than erasing the bottom neurons, similar to the findings in Section 5.1. Moreover, we noticed a significant overlap between the top ranked neurons in this case and the ones found by correlating with other models, as in the rest of the paper. In particular, for the English-Spanish model, we found that 8 out of 10 and 34 out of 50 top ranked neurons are the same in these two rankings. For the English-Arabic model, we found a similar behavior (7 out of 10 and 33 out of 50 top ranked neurons are the same). This indicates that our method may be applied to different checkpoints as well.
322
+
323
+ ![](images/4c59b1bdf3a847031025ffb6d8dec800b46514fb0c354985aa5c71c85bdbcbcd.jpg)
324
+ Figure 9: A neuron that activates on numbers in the beginning of sentences. The first 10 sentences in the test set are shown.
325
+
326
+ # B A CATALOG OF TOP RANKED NEURONS
327
+
328
+ In order to illustrate the range of linguistic phenomena captures by individual neurons, we provide here a list of the top 20 neurons (or projected directions, in the case of SVCCA) found by each of our methods, for an example English-Spanish model. For each neuron, we give the percentage of variance that is eliminated by conditioning on position in the sentence or identity of the current token. We also comment on what properties each neuron appears to capture, based on visualizations of neuron activation. Where possible, we give $\mathrm { F _ { 1 } }$ scores of a GMM model predicting certain properties such as detecting noun phrase segmentation, parenthetical phrases, adjectives, and plural nouns. Annotations are obtained with Spacy: https://spacy.io.
329
+
330
+ Table 7: Top 20 ranked neurons by MaxCorr.
331
+
332
+ <table><tr><td>Neuron</td><td>Position</td><td>Token</td><td>Comments</td></tr><tr><td>464</td><td>92%</td><td>10%</td><td>Position.</td></tr><tr><td>342</td><td>88%</td><td>7.9%</td><td>Position.</td></tr><tr><td>260</td><td>0.71%</td><td>94%</td><td>Conjunctions: &quot;and&quot;,&quot;or”,&quot;wel’,&quot;addition&quot;.</td></tr><tr><td>49</td><td>11%</td><td>6.1%</td><td>Activates for several words after &quot;and”or &quot;or&quot;.</td></tr><tr><td>124</td><td>77%</td><td>48%</td><td>Position.</td></tr><tr><td>394</td><td>0.38%</td><td>22%</td><td>Noun phrase segmentation. 13th-best F1-score (0.41) for finding interiors of noun phrases.15th-best IOB accuracy (0.62).</td></tr><tr><td>228</td><td>0.38%</td><td>96%</td><td>Unknown:&quot;&#x27;s”,&quot;the”,&quot;this&quot;,&quot;on”,&quot;that&quot;.</td></tr><tr><td>133</td><td>0.14%</td><td>87%</td><td>Adjective detector.Best F1-score (O.56) for finding adjectives.</td></tr><tr><td>221</td><td>1%</td><td>30%</td><td>Noun phrase segmentation. Best F1-score for finding interiors (0.72) and for finding beginnings (0.63). Best IOB accuracy</td></tr><tr><td>90</td><td>0.49%</td><td>28%</td><td>(0.78). Noun phrase segmentation. Second-best F1-score (O.56) for find- ing_beginnings of noun phrases. Second-best IOB accuracy</td></tr><tr><td>383</td><td></td><td></td><td>(0.72). Position.</td></tr><tr><td>494</td><td>67% 3.5%</td><td>6.5% 96%</td><td>Punctuation/conjunctions:&quot;””,”;”,&quot;Also”,&quot;also”,”well”</td></tr><tr><td>120</td><td>0.094%</td><td>84%</td><td>Plural noun detector. Best F1-score (O.85) for retrieving plural</td></tr><tr><td>269</td><td>0.1%</td><td>80%</td><td>nouns. Spanish noun gender detector. Very positive for &quot;islands”,&quot;activ- ities”,&quot;measures”- feminine.Very negative for&quot;states”,&quot;princi-</td></tr><tr><td>232</td><td>0.63%</td><td>31%</td><td>ples”,&quot;aspects”- masculine. Parentheses. Best F1-score (O.66) for retrieving tokens inside</td></tr><tr><td>332</td><td>0.13%</td><td></td><td>parentheses/quotes/brackets.</td></tr><tr><td>324</td><td>0.18%</td><td>83% 81%</td><td>Unknown. Unknown.</td></tr><tr><td>210</td><td>0.61%</td><td>45%</td><td>Date detector. Third-best F1-score (O.36) for retrieving tokens</td></tr><tr><td>339</td><td>0.48%</td><td>39%</td><td>inside dates. Activatesfora verband alsosurroundinginflection</td></tr><tr><td>139</td><td>0.86%</td><td>93%</td><td>words/auxiliary verbs. Punctuation/conjunctions: ” ; ,, ·</td></tr></table>
333
+
334
+ Table 8: Top 20 ranked neurons by MinCorr.
335
+
336
+ <table><tr><td>Neuron</td><td>Position</td><td>Token</td><td>Comments</td></tr><tr><td>342</td><td>88%</td><td>7.9%</td><td>Position.</td></tr><tr><td>464</td><td>92%</td><td>10%</td><td>Position.</td></tr><tr><td>260</td><td>0.71%</td><td>94%</td><td>Conjunctions: &quot;and&quot;,&quot;or&quot;,&quot;well&quot;,&quot;addition”.</td></tr><tr><td>383</td><td>67%</td><td>6.5%</td><td>Position.</td></tr><tr><td>250</td><td>63%</td><td>6.8%</td><td>Position.</td></tr><tr><td>124</td><td>77%</td><td>48%</td><td>Position.</td></tr><tr><td>485</td><td>64%</td><td>10%</td><td>Position.</td></tr><tr><td>480</td><td>70%</td><td>12%</td><td>Position.</td></tr><tr><td>154</td><td>63%</td><td>15%</td><td>Position.</td></tr><tr><td>139</td><td>0.86%</td><td>93%</td><td>Punctuation/conjunctions: ” ” ” ,&quot;alia” ,, ·, ,</td></tr><tr><td>20</td><td>60%</td><td>9.2%</td><td>Position.</td></tr><tr><td>494</td><td>3.5%</td><td>96%</td><td> Punctuation/conjunctions: ”,”,&quot;”;”,&quot;also”,&quot;well&quot;.</td></tr><tr><td>199</td><td>67%</td><td>6%</td><td>Position.</td></tr><tr><td>126</td><td>42%</td><td>9.4%</td><td>Unknown.</td></tr><tr><td>348</td><td>50%</td><td>13%</td><td>Position.</td></tr><tr><td>46</td><td>48%</td><td>8.6%</td><td>Unknown.</td></tr><tr><td>196</td><td>60%</td><td>8.5%</td><td>Position.</td></tr><tr><td>367</td><td>0.44%</td><td>89%</td><td>Prepositions:&quot;of&#x27;,&quot;or&quot;,&quot;United&quot;,&quot;de&quot;.</td></tr><tr><td>186</td><td>1.6%</td><td>69%</td><td>Conjunctions: &quot;also”,&quot;therefore”,&quot;thus”,&quot;alia&quot;.</td></tr><tr><td>244</td><td>54%</td><td>15%</td><td>Position.</td></tr></table>
337
+
338
+ Table 9: Top 20 ranked neurons by LinReg.
339
+
340
+ <table><tr><td>Neuron</td><td>Position</td><td>Token</td><td>Comments</td></tr><tr><td>464</td><td>92%</td><td>10%</td><td>Position.</td></tr><tr><td>260</td><td>0.71%</td><td>94%</td><td>Conjunctions: &quot;and&quot;,&quot;or&quot;,&quot;well&quot;,&quot;addition”.</td></tr><tr><td>139</td><td>0.86%</td><td>93%</td><td>&#x27;&quot;”&quot;”,&quot;_”,&quot;alia”. Punctuation/conjunctions: ,, :, ,</td></tr><tr><td>494</td><td>3.5%</td><td>96%</td><td>Punctuation/conjunctions: ,,</td></tr><tr><td>342</td><td>88%</td><td>7.9%</td><td>Position.</td></tr><tr><td>228</td><td>0.38%</td><td>96%</td><td>Possibly determiners: &quot;&quot;s”,&quot;the”,&quot;this”,&quot;on”,&quot;that”.</td></tr><tr><td>317</td><td>1.5%</td><td>83%</td><td>Indefinite determiners: &quot;(&quot;,&quot;one&quot;,&quot;a&quot;,&quot;an&quot;.</td></tr><tr><td>367</td><td>0.44%</td><td>89%</td><td>Prepositions.&quot;of&#x27;,&quot;for”,&quot;United”,&quot;de”,&quot;from”,&quot;by”,&quot;about&quot;.</td></tr><tr><td>106</td><td>0.25%</td><td>92%</td><td>Possibly determiners:&quot;that&quot;,&quot;this&quot;,&quot;which&quot;,&quot;the&quot;.</td></tr><tr><td>383</td><td>67%</td><td>6.5%</td><td>Position.</td></tr><tr><td>485</td><td>64%</td><td>10%</td><td>Position.</td></tr><tr><td>186 272</td><td>1.6% 2%</td><td>69% 73%</td><td>Conjunctions.&quot;also”,&quot;therefore”,&quot;thus”,&quot;alia”.</td></tr><tr><td></td><td></td><td></td><td>Tokens that mean &quot;in other words&quot;:&quot;(&quot;,&quot;namely”,&quot;i.e.”,&quot;see”, &quot;or”.</td></tr><tr><td>124</td><td>77%</td><td>48%</td><td>Position.</td></tr><tr><td>480 187</td><td>70% 1.1%</td><td>12% 87%</td><td>Position.</td></tr><tr><td>201</td><td>0.14%</td><td>73%</td><td>Unknown: &quot;them”,&quot;well&quot;,&quot;be&quot;,&quot;would&quot;,&quot;remain&quot;. Tokens that mean &quot;regarding&quot;: &quot;on”, &quot;in”,&quot;throughout”,&quot;con-</td></tr><tr><td></td><td></td><td></td><td>cerning”,&quot;regarding&quot;.</td></tr><tr><td>67 154</td><td>0.27%</td><td>71%</td><td>Unknown: &quot;united&quot;,&quot;&#x27;s”,&quot;by&quot;,&quot;made”,&quot;from”.</td></tr><tr><td>72</td><td>63%</td><td>17%</td><td>Position.</td></tr><tr><td></td><td>0.32%</td><td>89%</td><td>Verbs suggesting equivalence: &quot;is”, &quot;was”,&quot;are”, &quot;become”, &quot;constitute”,&quot;represent”.</td></tr></table>
341
+
342
+ Table 10: Top 20 ranked directions by SVCCA.
343
+
344
+ <table><tr><td>Position</td><td>Token</td><td>Comments</td></tr><tr><td>86%</td><td>26%</td><td>Position</td></tr><tr><td>1.6%</td><td>90%</td><td>Detects &quot;the&quot;.</td></tr><tr><td>7.5%</td><td>85%</td><td>Conjunctions:&quot;and&quot;,&quot;well&quot;,&quot;or&quot;.</td></tr><tr><td>20%</td><td>79%</td><td>Determiners:&quot;the”,&quot;this&quot;,&quot;these&quot;,&quot;those”.</td></tr><tr><td>1.1%</td><td>89%</td><td>Possibly conjunctions: negative for &quot;and&quot;,&quot;or”,&quot;nor”, positive for &quot;been”, &quot;into&quot;,&quot;will&quot;.</td></tr><tr><td>10%</td><td>76%</td><td></td></tr><tr><td>30%</td><td>57%</td><td>Possibly verbs: &quot;been”,&quot;will&quot;,&quot;be&quot;,&quot;shall&quot;.</td></tr><tr><td>24%</td><td>55%</td><td>Possibly date detector.</td></tr><tr><td>23%</td><td>60%</td><td>Possibly adjective detector.</td></tr><tr><td>18%</td><td>63%</td><td>Unknown.</td></tr><tr><td>4.5%</td><td>88%</td><td> Punctuation: &quot;&#x27;,&quot;,”,&quot;;”</td></tr><tr><td>9.8%</td><td>69%</td><td>Forms of&quot;to be&quot;: &quot;is&quot;,&quot;will&quot;,&quot;shal&quot;,&quot;would&quot;,&quot;are&quot;.</td></tr><tr><td>1.7%</td><td>77%</td><td>Combined dates/prepositions/parentheses: negative for &quot;in”,&quot;at”,&quot;&quot;, posi- tive for dates and in quotes/parentheses/brackets. Noisy.</td></tr><tr><td>16%</td><td>25%</td><td>Activates fora few words after&quot;and&quot;.</td></tr><tr><td>14%</td><td>63%</td><td>Possibly plural noun detector.</td></tr><tr><td>0.8%</td><td>73%</td><td>Spanish noun gender detector.</td></tr><tr><td>11%</td><td>61%</td><td>Possibly singular noun detector.</td></tr><tr><td>13%</td><td>58%</td><td>Possibly possessives: &quot;its”,&quot;his”,&quot;their&quot;.</td></tr><tr><td>1.4%</td><td>73%</td><td>Spanish noun gender detector.</td></tr><tr><td>5.6%</td><td>53%</td><td>Unknown.</td></tr></table>
md/train/HJCXZQbAZ/HJCXZQbAZ.md ADDED
@@ -0,0 +1,350 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # HIERARCHICAL DENSITY ORDER EMBEDDINGS
2
+
3
+ Ben Athiwaratkun, Andrew Gordon Wilson
4
+ Cornell University
5
+ Ithaca, NY 14850, USA
6
+
7
+ # ABSTRACT
8
+
9
+ By representing words with probability densities rather than point vectors, probabilistic word embeddings can capture rich and interpretable semantic information and uncertainty (Vilnis & McCallum, 2014; Athiwaratkun & Wilson, 2017). The uncertainty information can be particularly meaningful in capturing entailment relationships – whereby general words such as “entity” correspond to broad distributions that encompass more specific words such as “animal” or “instrument”. We introduce density order embeddings, which learn hierarchical representations through encapsulation of probability distributions. In particular, we propose simple yet effective loss functions and distance metrics, as well as graph-based schemes to select negative samples to better learn hierarchical probabilistic representations. Our approach provides state-of-the-art performance on the WORDNET hypernym relationship prediction task and the challenging HYPERLEX lexical entailment dataset – while retaining a rich and interpretable probabilistic representation.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Learning feature representations of natural data such as text and images has become increasingly important for understanding real-world concepts. These representations are useful for many tasks, ranging from semantic understanding of words and sentences (Mikolov et al., 2013; Kiros et al., 2015), image caption generation (Vinyals et al., 2015), textual entailment prediction (Rocktäschel et al., 2015), to language communication with robots (Bisk et al., 2016).
14
+
15
+ Meaningful representations of text and images capture visual-semantic information, such as hierarchical structure where certain entities are abstractions of others. For instance, an image caption “A dog and a frisbee” is an abstraction of many images with possible lower-level details such as a dog jumping to catch a frisbee or a dog sitting with a frisbee (Figure 1a). A general word such as “object” is also an abstraction of more specific words such as “house” or “pool”. Recent work by Vendrov et al. (2015) proposes learning such asymmetric relationships with order embeddings – vector representations of non-negative coordinates with partial order structure. These embeddings are shown to be effective for word hypernym classification, image-caption ranking and textual entailment (Vendrov et al., 2015).
16
+
17
+ Another recent line of work uses probability distributions as rich feature representations that can capture the semantics and uncertainties of concepts, such as Gaussian word embeddings (Vilnis & McCallum, 2014), or extract multiple meanings via multimodal densities (Athiwaratkun & Wilson, 2017). Probability distributions are also natural at capturing orders and are suitable for tasks that involve hierarchical structures. An abstract entity such as “animal” that can represent specific entities such as “insect”, “dog”, “bird” corresponds to a broad distribution, encapsulating the distributions for these specific entities. For example, in Figure 1c, the distribution for “insect” is more concentrated than for “animal”, with a high density occupying a small volume in space.
18
+
19
+ Such entailment patterns can be observed from density word embeddings through unsupervised training based on word contexts (Vilnis & McCallum, 2014; Athiwaratkun & Wilson, 2017). In the unsupervised settings, density embeddings are learned via maximizing the similarity scores between nearby words. The density encapsulation behavior arises due to the word occurrence pattern that a general word can often substitute more specific words; for instance, the word “tea” in a sentence “I like iced tea” can be substituted by “beverages”, yielding another natural sentence “I like iced beverages”. Therefore, the probability density of a general concept such as “beverages” tends to have a larger variance than specific ones such as “tea”, reflecting higher uncertainty in meanings since a general word can be used in many contexts. However, the information from word occurrences alone is not sufficient to train meaningful embeddings of some concepts. For instance, it is fairly common to observe sentences “Look at the cat”, or “Look at the dog”, but not “Look at the mammal”. Therefore, due to the way we typically express natural language, it is unlikely that the word “mammal” would be learned as a distribution that encompasses both “cat” and “dog”, since “mammal” rarely occurs in similar contexts.
20
+
21
+ Rather than relying on the information from word occurrences, one can do supervised training of density embeddings on hierarchical data. In this paper, we propose new training methodology to enable effective supervised probabilistic embeddings. Despite providing rich and intuitive word representations, with a natural ability to represent order relationships, probabilistic embeddings have only been considered in a small number of pioneering works such as Vilnis & McCallum (2014), and these works are almost exclusively focused on unsupervised embeddings. Probabilistic Gaussian embeddings trained directly on labeled data have been briefly considered but perform surprisingly poorly compared to other competing models (Vendrov et al., 2015; Vulic et al., 2016). ´
22
+
23
+ Our work reaches a very different conclusion: probabilistic Gaussian embeddings can be highly effective at capturing ordering and are suitable for modeling hierarchical structures, and can even achieve state-of-the-art results on hypernym prediction and graded lexical entailment tasks, so long as one uses the right training procedures.
24
+
25
+ In particular, we make the following contributions.
26
+
27
+ (a) We adopt a new form of loss function for training hierarchical probabilistic order embeddings.
28
+ (b) We introduce the notion of soft probabilistic encapsulation orders and a thresholded divergencebased penalty function, which do not over-penalize words with a sufficient encapsulation.
29
+ (c) We introduce a new graph-based scheme to select negative samples to contrast the true relationship pairs during training. This approach incorporates hierarchy information to the negative samples that help facilitate training and has added benefits over the hierarchy-agnostic sampling schemes previously used in literature.
30
+ (d) We also demonstrate that initializing the right variance scale is highly important for modeling hierarchical data via distributions, allowing the model to exhibit meaningful encapsulation orders.
31
+
32
+ The outline of our paper is as follows. In Section 2, we introduce the background for Gaussian embeddings (Vilnis & McCallum, 2014) and vector order embeddings (Vendrov et al., 2015). We describe our training methodology in Section 3, where we introduce the notion of soft encapsulation orders (Section 3.2) and explore different divergence measures such as the expected likelihood kernel, KL divergence, and a family of Rényi alpha divergences (Section 3.3). We describe the experiment details in Section 4 and offer a qualitative evaluation of the model in Section 4.3, where we show the visualization of the density encapsulation behavior. We show quantitative results on the WORDNET Hypernym prediction task in Section 4.2 and a graded entailment dataset HYPERLEX in Section 4.4.
33
+
34
+ In addition, we conduct experiments to show that our proposed changes to learn Gaussian embeddings contribute to the increased performance. We demonstrate (a) the effects of our loss function in Section A.2.3, (b) soft encapsulation in Section A.2.1, (c) negative sample selection in Section 4.4], and (d) initial variance scale in Section A.2.2.
35
+
36
+ We make our code publicly available.1
37
+
38
+ # 2 BACKGROUND AND RELATED WORK
39
+
40
+ # 2.1 GAUSSIAN EMBEDDINGS
41
+
42
+ Vilnis & McCallum (2014) was the first to propose using probability densities as word embeddings. In particular, each word is modeled as a Gaussian distribution, where the mean vector represents the semantics and the covariance describes the uncertainty or nuances in the meanings. These embeddings are trained on a natural text corpus by maximizing the similarity between words that are in the same local context of sentences. Given a word $w$ with a true context word $c _ { p }$ and a randomly sampled word $c _ { n }$ (negative context), Gaussian embeddings are learned by minimizing the rank objective in Equation 1, which pushes the similarity of the true context pair $E ( w , c _ { p } )$ above that of the negative context pair $E ( w , c _ { n } )$ by a margin $m$ .
43
+
44
+ ![](images/01e127184e17294f66986a963024ecb07691a8cc8786b2ced6563a5e3d726392.jpg)
45
+ Figure 1: (a) Captions and images in the visual-semantic hierarchy. (b) Vector order embedding (Vendrov et al., 2015) where specific entities have higher coordinate values. (c) Density order embedding where specific entities correspond to concentrated distributions encapsulated in broader distributions of general entities.
46
+
47
+ $$
48
+ L _ { m } ( w , c _ { p } , c _ { n } ) = \operatorname* { m a x } ( 0 , m - E ( w , c _ { p } ) + E ( w , c _ { n } ) )
49
+ $$
50
+
51
+ The similarity score $E ( u , v )$ for words $u , v$ can be either $E ( u , v ) = - \mathrm { K L } ( f _ { u } , f _ { v } )$ or $E ( u , v ) =$ $\log \langle f _ { u } , f _ { u } \rangle _ { L _ { 2 } }$ where $f _ { u } , f _ { v }$ are the distributions of words $u$ and $v$ , respectively. The Gaussian word embeddings contain rich semantic information and performs competitively in many word similarity benchmarks.
52
+
53
+ The true context word pairs $( w , c _ { p } )$ are obtained from natural sentences in a text corpus such as Wikipedia. In some cases, specific words can be replaced by a general word in a similar context. For instance, “I love cats” or $^ { 6 6 } \mathrm { I }$ love dogs” can be replaced with “I love animals”. Therefore, the trained word embeddings exhibit lexical entailment patterns where specific words such as “dog” and “cat” are concentrated distributions that are encompassed by a more dispersed distribution of “animal”, a word that “cat” and “dog” entail. The broad distribution of a general word agrees with the distributional informativeness hypothesis proposed by Santus et al. (2014), which says that a generic word can occur in more general contexts in place of the specific ones that entail it.
54
+
55
+ However, some word entailment pairs have weak density encapsulation patterns due to the nature of word diction. For instance, even though “dog” and “cat” both entail “mammal”, it is rarely the case that we observe a sentence “I have a mammal” as opposed to “I have a cat” in a natural corpus; therefore, after training density word embeddings on word occurrences, encapsulation of some true entailment instances do not occur.
56
+
57
+ # 2.2 PARTIAL ORDERS AND VECTOR ORDER EMBEDDINGS
58
+
59
+ We describe partial order and the concept of order embeddings proposed by Vendrov et al. (2015), which is highly related to our model.
60
+
61
+ A partial order over a set of points $X$ is a binary relation $\preceq$ such that for $a , b , c \in X$ , the following properties hold: (1) $a \preceq a$ (reflexivity); (2) if $a \preceq b$ and $b \preceq a$ then $a = b$ (antisymmetry); and (3) if $a \preceq b$ and $b \preceq c$ then $a \preceq c$ (transitivity). An example of a partially ordered set is a set of nodes in a tree where $a \preceq b$ means $a$ is a child node of $b$ . This concept has applications in natural data such as lexical entailment. For words $a$ and $b$ , $a \preceq b$ means that every instance of $a$ is an instance of $b$ , or we can say that $a$ entails $b$ . We also say that $( a , b )$ has a hypernym relationship where $a$ is a hyponym of $b$ and $b$ is a hypernym of $a$ . This relationship is asymmetric since $a \preceq b$ does not necessarily imply $( b \preceq a )$ . For instance, aircraft $\preceq$ vehicle but it is not true that vehicle $\preceq$ aircraft.
62
+
63
+ An order-embedding is a function $f : ( X , \preceq _ { X } ) \to ( Y , \preceq _ { Y } )$ where $a \preceq _ { X } b$ if and only if $f ( a ) \preceq _ { Y }$ $f ( b )$ . Vendrov et al. (2015) proposes to learn the embedding $f$ on $Y = \mathbb { R } _ { + } ^ { N }$ where all coordinates are non-negative. Under $\mathbb { R } _ { + } ^ { N }$ , there exists a partial order relation called the reversed product order on $\mathbb { R } _ { + } ^ { N }$ : $x \preceq y$ if and only if $\forall i , x _ { i } \geq y _ { i }$ . That is, a point $x$ entails $y$ if and only if all the coordinate values of $x$ is higher than $y$ ’s. The origin represents the most general entity at the top of the order hierarchy and the points further away from the origin become more specific. Figure 1b demonstrates the vector order embeddings on $\mathbb { R } _ { + } ^ { N }$ . We can see that since insect  animal and animal  organism, we can infer directly from the embedding that insect $\preceq$ organism (orange line, diagonal line). To learn the embeddings, Vendrov et al. (2015) proposes a penalty function $\bar { E ( x , y ) } = | | \bar { \operatorname* { m a x } ( 0 , y - x ) } | | ^ { 2 }$ for a pair $x \preceq y$ which has the property that it is positive if and only if the order is violated.
64
+
65
+ # 2.3 OTHER RELATED WORK
66
+
67
+ Li et al. (2017) extends Vendrov et al. (2015) for knowledge representation on data such as ConceptNet (Speer et al., 2016). Another related work by Hockenmaier & Lai (2017) embeds words and phrases in a vector space and uses denotational probabilities for textual entailment tasks. Our models offer an improvement on order embeddings and can be applicable to such tasks, which we aim to explore in future work.
68
+
69
+ # 3 METHODOLOGY
70
+
71
+ In Section 3.1, we describe the partial orders that can be induced by density encapsulation. Section 3.2 describes our training approach that softens the notion of strict encapsulation with a viable penalty function.
72
+
73
+ # 3.1 STRICT ENCAPSULATION PARTIAL ORDERS
74
+
75
+ A partial order on probability densities can be obtained by the notion of encapsulation. That is, a density $f$ is more specific than a density $g$ if $f$ is encompassed in $g$ . The degree of encapsulation can vary, which gives rise to multiple order relations. We define an order relation $\preceq _ { \eta }$ for $\eta \geq 0$ where $\eta$ indicates the degree of encapsulation required for one distribution to entail another. More precisely, for distributions $f$ and $g$ ,
76
+
77
+ $$
78
+ f \preceq _ { \eta } g \Leftrightarrow \{ x : f ( x ) > \eta \} \subseteq \{ x : g ( x ) > \eta \} .
79
+ $$
80
+
81
+ Note that $\{ x : f ( x ) > \eta \}$ is a set where the density $f$ is greater than the threshold $\eta$ . The relation in Equation 2 says that $f$ entails $g$ if and only if the set of $g$ contains that of $f$ . In Figure 2, we depict two Gaussian distributions with different mean vectors and covariance matrices. Figure 2 (left) shows the density values of distributions $f$ (narrow, blue) and $g$ (broad, orange) and different threshold levels. Figure 2 (right) shows that different $\eta$ ’s give rise to different partial orders. For instance, we observe that neither $f \preceq _ { \eta _ { 1 } }$ g nor $g \preceq _ { \eta _ { 1 } }$ $f$ but $f \preceq _ { \eta _ { 3 } } g$ .
82
+
83
+ ![](images/4852ff13b630b65e4087807f661393104c959dfa9aae7ac7637db21f75da69e0.jpg)
84
+ Figure 2: Strict encapsulation orders induced by different $\eta$ values.
85
+
86
+ # 3.2 SOFT ENCAPSULATION ORDERS
87
+
88
+ A plausible penalty function for the order relation $f \preceq _ { \eta } g$ is a set measure on $\{ x : f ( x ) > \eta \} - \{ x :$ $g ( \bar { x } ) > \eta \}$ . However, this is difficult to calculate for most distributions, including Gaussians. Instead, we use simple penalty functions based on asymmetric divergence measures between probability densities. Divergence measures $D ( \cdot | | \cdot )$ have a property that $D ( f | | g ) = 0$ if and only if $f = g$ . Using $D ( \cdot | | \cdot )$ to represent order violation is undesirable since the penalty should be 0 if $f \neq g$ but $f \preceq g$ . Therefore, we propose using a thresholded divergence
89
+
90
+ $$
91
+ d _ { \gamma } ( f , g ) = \operatorname* { m a x } ( 0 , D ( f | | g ) - \gamma ) ,
92
+ $$
93
+
94
+ which can be zero if $f$ is properly encapsulated in $g$ . We discuss the effectiveness of using divergence thresholds in Section A.2.1.
95
+
96
+ We note that by using $d _ { \gamma } ( \cdot , \cdot )$ as a violation penalty, we no longer have the strict partial order. In particular, the notion of transitivity in a partial order is not guaranteed. For instance, if $f \preceq g$ and $g \preceq h$ , our density order embeddings would yield $d _ { \gamma } ( f , g ) = { 0 }$ and $d _ { \gamma } ( g , h ) = 0$ . However, it is not necessarily the case that $d _ { \gamma } ( f , h ) = 0$ since $D ( f | | \dot { h } )$ can be greater than $\gamma$ . This is not a drawback since a high value of $D ( f | | h )$ reflects that the hypernym relationship is not direct, requiring many edges from $f$ to $h$ in the hierarchy. The extent of encapsulation contains useful entailment information, as demonstrated in Section 4.4 where our model scores highly correlate with the annotated scores of a challenging lexical entailment dataset and achieves state-of-the-art result.
97
+
98
+ Another property, antisymmetry, does not strictly hold since if $d _ { \gamma } ( f , g ) = 0$ and $d _ { \gamma } ( g , f ) = 0$ does not imply $f = g$ . However, in this situation, it is necessary that $f$ and $g$ overlap significantly if $\gamma$ is small. Due to the fact that the $d _ { \gamma } ( \cdot , \cdot )$ does not strictly induce a partial order, we refer to this model as soft density order embeddings or simply density order embeddings.
99
+
100
+ # 3.3 DIVERGENCE MEASURES
101
+
102
+ # 3.3.1 ASYMMETRIC DIVERGENCE
103
+
104
+ Kullback-Leibler (KL) Divergence The KL divergence is an asymmetric measure of the difference between probability distributions. For distributions $f$ and $g$ $\begin{array} { r } { , \mathrm { K L } ( g | | f ) \equiv \int g ( x ) \log \frac { g ( x ) } { f ( x ) } \ d x } \end{array}$ imposes a high penalty when there is a region of points $x$ such that the density $f ( x )$ is low but $g ( x )$ is high. An example of such a region is the area on the left of $f$ in Figure 2. This measure penalizes the situation where $f$ is a concentrated distribution relative to $g$ ; that is, if the distribution $f$ is encompassed by $g$ , then the KL yields high penalty. For $d$ -dimensional Gaussians $f = \mathcal { N } _ { d } ( \mu _ { f } , \Sigma _ { f } )$ and $g = \mathcal { N } _ { d } ( \mu _ { g } , \Sigma _ { g } )$
105
+
106
+ $$
107
+ 2 D _ { K L } ( f | | g ) = \log ( \operatorname* { d e t } ( \Sigma _ { g } ) / \operatorname* { d e t } ( \Sigma _ { f } ) ) - d + \operatorname { t r } ( \Sigma _ { g } ^ { - 1 } \Sigma _ { f } ) + ( \mu _ { f } - \mu _ { g } ) ^ { T } \Sigma _ { g } ^ { - 1 } ( \mu _ { f } - \mu _ { g } )
108
+ $$
109
+
110
+ Rényi $\alpha$ -Divergence is a general family of divergence with varying scale of zero-forcing penalty (Renyi, 1961). Equation 4 describes the general form of the $\alpha$ -divergence for $\alpha \neq 0 , 1$ (Liese & Vajda, 1987). We note that for $\alpha 0$ or 1, we recover the $\mathrm { K L }$ divergence and the reverse KL divergence; that is, $\begin{array} { r } { \operatorname* { l i m } _ { \alpha \to 1 } D _ { \alpha } ( f | | g ) = \mathrm { K L } ( f | | g ) } \end{array}$ and $\begin{array} { r } { \operatorname* { l i m } _ { \alpha \to 0 } D _ { \alpha } ( f | | g ) = \mathrm { K L } ( g | | f ) } \end{array}$ (Pardo, 2006). The $\alpha$ -divergences are asymmetric for all $\alpha$ ’s, except for $\alpha = 1 / 2$ .
111
+
112
+ $$
113
+ D _ { \alpha } ( f | | g ) = { \frac { 1 } { \alpha ( \alpha - 1 ) } } \log \left( \int { \frac { f ( x ) ^ { \alpha } } { g ( x ) ^ { \alpha - 1 } } } d x \right)
114
+ $$
115
+
116
+ For two multivariate Gaussians $f$ and $g$ , we can write the Rényi divergence as (Pardo, 2006):
117
+
118
+ $$
119
+ : D _ { \alpha } ( f | | g ) = - \frac { 1 } { \alpha ( \alpha - 1 ) } \log \frac { \operatorname * { d e t } ( \alpha \Sigma _ { g } + ( 1 - \alpha ) \Sigma _ { f } ) } { \left( \operatorname * { d e t } ( \Sigma _ { f } ) ^ { 1 - \alpha } \cdot \operatorname * { d e t } ( \Sigma _ { g } ) ^ { \alpha } \right) } + ( \mu _ { f } - \mu _ { g } ) ^ { T } ( \alpha \Sigma _ { g } + ( 1 - \alpha ) \Sigma _ { f } ) ^ { - 1 } ( \mu _ { f } - \mu _ { g } ) .
120
+ $$
121
+
122
+ The parameter $\alpha$ controls the degree of zero forcing where minimizing $D _ { \alpha } ( f | | g )$ for high $\alpha$ results in $f$ being more concentrated to the region of $g$ with high density. For low $\alpha$ , $f$ tends to be masscovering, encompassing regions of $g$ including the low density regions. Recent work by Li & Turner (2016) demonstrates that different applications can require different degrees of zero-forcing penalty.
123
+
124
+ # 3.3.2 SYMMETRIC DIVERGENCE
125
+
126
+ Expected Likelihood Kernel The expected likelihood kernel (ELK) (Jebara et al., 2004) is a symmetric measure of affinity, define as $K ( f , g ) = \langle f , g \rangle _ { \mathcal { H } }$ . For two Gaussians $f$ and $g$ ,
127
+
128
+ $$
129
+ 2 \log \langle f , g \rangle _ { \mathcal { H } } = - \log \operatorname* { d e t } ( \Sigma _ { f } + \Sigma _ { g } ) - d \log ( 2 \pi ) - ( \mu _ { f } - \mu _ { g } ) ^ { T } ( \Sigma _ { f } + \Sigma _ { g } ) ^ { - 1 } ( \mu _ { f } - \mu _ { g } )
130
+ $$
131
+
132
+ Since this kernel is a similarity score, we use its negative as our penalty. That is, $D _ { \mathrm { E L K } } ( f | | g ) =$ $- 2 \log \langle f , g \rangle _ { \mathcal { H } }$ . Intuitively, the asymmetric measures should be more successful at training density order embeddings. However, a symmetric measure can result in the encapsulation order as well since a general entity often has to minimize the penalty with many specific elements and consequently ends up having a broad distribution to lower the average loss. The expected likelihood kernel is used to train Gaussian and Gaussian Mixture word embeddings on a large text corpus (Vilnis & McCallum, 2014; Athiwaratkun & Wilson, 2017) where the model performs well on the word entailment dataset (Baroni et al., 2012).
133
+
134
+ # 3.4 LOSS FUNCTION
135
+
136
+ To learn our density embeddings, we use a loss function similar to that of Vendrov et al. (2015). Minimizing this function (Equation 7) is equivalent to minimizing the penalty between a true relationship pair $( u , v )$ where $u \preceq v$ , but pushing the penalty to be above a margin $m$ for the negative example $( u ^ { \prime } , v ^ { \prime } )$ where $u ^ { \prime } \not \simeq v ^ { \prime }$ :
137
+
138
+ $$
139
+ \sum _ { ( u , v ) \in \mathcal { D } } d ( u , v ) + \operatorname* { m a x } \{ 0 , m - d ( u ^ { \prime } , v ^ { \prime } ) \}
140
+ $$
141
+
142
+ We note that this loss function is different than the rank-margin loss introduced in the original Gaussian embeddings (Equation 1). Equation 7 aims to reduce the dissimilarity of a true relationship pair $d ( u , v )$ with no constraint, unlike in Equation 1, which becomes zero if $d ( u , v )$ is above $d ( u ^ { \prime } , v ^ { \prime } )$ by margin $m$ .
143
+
144
+ # 3.5 SELECTING NEGATIVE SAMPLES
145
+
146
+ In many embedding models such as WORD2VEC (Mikolov et al., 2013) or Gaussian embeddings (Vilnis & McCallum, 2014), negative samples are often used in the training procedure to contrast with true samples from the dataset. For flat data such as words in a text corpus, negative samples are selected randomly from a unigram distribution. We propose new graph-based methods to select negative samples that are suitable for hierarchical data, as demonstrated by the improved performance of our density embeddings. In our experiments, we use various combinations of the following methods.
147
+
148
+ Method S1: A simple negative sampling procedure used by Vendrov et al. (2015) is to replace a true hypernym pair $( u , v )$ with either $( u , v ^ { \prime } )$ or $( u ^ { \prime } , v )$ where $u ^ { \prime } , v ^ { \prime }$ are randomly sampled from a uniform distribution of vertices. Method S2: We use a negative sample $( v , u )$ if $( u , v )$ is a true relationship pair. The motivation is due to the fact that it is important to make $D ( v | | u )$ higher than $D ( u | | \bar { v } )$ in order to distinguish the directionality of density encapsulation. Method S3: It is important to increase the divergence between neighbor entities that do not entail each other. Let $A ( w )$ denote all descendants of $w$ in the training set $\mathcal { D }$ , including $w$ itself. We first randomly sample an entity $w \in \mathcal { D }$ that has at least 2 descendants and randomly select a descendant $u \in A ( w ) - \{ w \}$ . Then, we randomly select an entity $v \in A ( w ) - A ( u )$ and use the random neighbor pair $( v , u )$ as a negative sample. Note that we can have $u \preceq v$ , in which case the pair $( v , u )$ is a reverse relationship. Method S4: Same as S3 except that we sample $v \in A ( w ) - A ( u ) - \{ w \}$ , which excludes the possibility of drawing $( w , u )$ .
149
+
150
+ # 4 EXPERIMENTS
151
+
152
+ We have introduced density order embeddings to model hierarchical data via encapsulation of probability densities. We propose using a new loss function, graph-based negative sample selections, and a penalty relaxation to induce soft partial orders. In this section, we show the effectiveness of our model on WORDNET hypernym prediction and a challenging graded lexical entailment task, where we achieve state-of-the-art performance.
153
+
154
+ First, we provide the training details in Section 4.1 and describe the hypernym prediction experiment in 4.2. We offers insights into our model with the qualitative analysis and visualization in Section 4.3. We evaluate our model on HYPERLEX, a lexical entailment dataset in Section 4.4.
155
+
156
+ # 4.1 TRAINING DETAILS
157
+
158
+ We have a similar data setup to the experiment by Vendrov et al. (2015) where we use the transitive closure of WORDNET noun hypernym relationships which contains 82, 115 synsets and 837, 888 hypernym pairs from 84, 427 direct hypernym edges. We obtain the data using the WORDNET API of NLTK version 3.2.1 (Loper & Bird, 2002).
159
+
160
+ The validation set contains 4000 true hypernym relationships as well as 4000 false hypernym relationships where the false hypernym relationships are constructed from the S1 negative sampling described in Section 3.5. The same process applies for the test set with another set of 4000 true hypernym relationships and 4000 false hypernym relationships.
161
+
162
+ We use $d$ -dimensional Gaussian distributions with diagonal covariance matrices. We use $d = 5 0$ as the default dimension and analyze the results using different $d$ ’s in Section A.2.4. We initialize the mean vectors to have a unit norm and normalize the mean vectors in the training graph. We initialize the diagonal variance components to be all equal to $\beta$ and optimize on the unconstrained space of $\log ( \Sigma )$ . We discuss the important effects of the initial variance scale in Section A.2.2.
163
+
164
+ We use a minibatch size of 500 true hypernym pairs and use varying number of negative hypernym pairs, depending on the negative sample combination proposed in Section 3.5. We discuss the results for many selection strategies in Section 4.4. We also experiment with multiple divergence measures $D ( \cdot | | \cdot )$ described in Section 3.3. We use $D ( \cdot | | \cdot ) = D _ { K L } ( \cdot | | \cdot )$ unless stated otherwise. Section A.2.5 discuss the results using the $\alpha$ -divergence family with varying degrees of zero-forcing parameter $\alpha$ ’s. We use the Adam optimizer (Kingma & Ba, 2014) and train our model for at most 20 epochs. For each energy function, we tune the hyperparameters on grids. The hyperparameters are the loss margin $m$ , the initial variance scale $\beta$ , and the energy threshold $\gamma$ . We evaluate the results by computing the penalty on the validation set to find the best threshold for binary classification, and use this threshold to perform prediction on the test set. Section A.1 describes the hyperparameters for all our models.
165
+
166
+ # 4.2 HYPERNYM PREDICTION
167
+
168
+ We show the prediction accuracy results on the test set of WORDNET hypernyms in Table 1. We compare our results with vector order-embeddings (VOE) by Vendrov et al. (2015) where the model details are explained in Section 2.2. Another important baseline is the transitive closure, which requires no learning and classifies if a held-out edge is a hypernym relationship by determining if it is in the union of the training edges. word2gauss and word2gauss† are the Gaussian embeddings trained using the loss function in Vilnis & McCallum (2014) (Equation 1) where word2gauss is the result reported by Vendrov et al. (2015) and word2gauss† is the best performance of our replication (see Section A.2.3 for more details). Our density order embedding (DOE) outperforms the implementation by Vilnis & McCallum (2014) significantly; this highlights the fact that a different approach to train Gaussian representations might be required for a different task.
169
+
170
+ We observe that the symmetric model (ELK) performs quite well for this task despite the fact that the symmetric metric cannot capture directionality. In particular, ELK can detect pairs of concepts with no relationships well when they’re far away in the density space. In addition, for pairs that are related, ELK can detect pairs that overlap significantly in density space. The lack of directionality has more pronounced effects in the graded lexical entailment task (Section 4.4) where we observe a high degradation in performance if ELK is used instead of KL.
171
+
172
+ Our method also outperforms the vector order embeddings (VOE). We also include the results for a 2- dimensional Gaussian embedding trained for the purpose of visualization (Section 4.3). Surprisingly, the performance is very strong, beating the transitive closure and other baselines except VOE while only having 4 parameters: 2 from 2-dimensional $\mu$ and another 2 from the diagonal $\Sigma$ . The results using a symmetric measure also outperforms the baselines but has a slightly lower accuracy than the asymmetric model.
173
+
174
+ Figure 3 offers an explanation as to why our density order embeddings might be easier to learn, compared to the vector counterpart. In certain cases such as fitting a general concept entity to the embedding space, we simply need to adjust the distribution of entity to be broad enough to encompass all other concepts. In the vector counterpart, it might be required to shift many points further from the origin to accommodate entity to reduce cascading order violations.physical_entityentityphysical_entity
175
+
176
+ ![](images/9127c86e7ad4a0a5c34de2b22ec5a172d81e4dc3c926957fdbfdc99ad5b13e22.jpg)
177
+ Figure 3: (Left) Adding a concept entity to vector order embedding (Right) Adding a concept physical_ephysical_entityentity to density order embedding
178
+
179
+ Table 1: Classification accuracy on hypernym relationship test set from WordNet.
180
+
181
+ <table><tr><td>Method</td><td>Test Accuracy (%)</td></tr><tr><td>transitive closure</td><td>88.2</td></tr><tr><td>word2gauss</td><td>86.6</td></tr><tr><td>word2gausst</td><td>88.6</td></tr><tr><td>VOE (symmetric)</td><td>84.2</td></tr><tr><td>VOE</td><td>90.6</td></tr><tr><td>DOE (ELK)</td><td>92.1</td></tr><tr><td>DOE (KL, reversed)</td><td>83.2</td></tr><tr><td>DOE (KL)</td><td>92.3</td></tr><tr><td>DOE (KL,d = 2)</td><td>89.2</td></tr></table>
182
+
183
+ # 4.3 QUALITATIVE ANALYSIS
184
+
185
+ For qualitative analysis, we additionally train a 2-dimensional Gaussian model for visualization. Our qualitative analysis shows that the encapsulation behavior can be observed in the trained model. Figure 4 demonstrates the ordering of synsets in the density space. Each ellipse represents a Gaussian distribution where the center is given by the mean vector √ $\mu$ and the major/minor axes are given by the diagonal standard deviations $\sqrt { \Sigma }$ , scaled by 300 and 30 for $x$ and $y$ axis for visibility.
186
+
187
+ Most hypernym relationships exhibit the encapsulation behavior where the hypernym encompasses the synset that entails it. For instance, the distribution of whole.n.02 is subsumed in the distribution of physical_entity.n.01. Note that location.n.01 is not entirely encapsulated by physical_entity.n.01 under this visualization. However, we can still predict which entity should be the hypernym among the two since the KL divergence of one given another would be drastically different. This is because a large part of physical_entity.n.01 has considerable density at the locations where location.n.01 has very low density. This causes KL(physical_entity.n.01 $| |$ location.n.01) to be very high (5103) relative to KL(location.n.01 $| |$ physical_entity.n.01) (206). Table 2 shows the KL values for all pairs where we note that the numbers are from the full model $Q = 5 0$ ).
188
+
189
+ Another interesting pair is city.n.01  location.n.01 where we see the two distributions have very similar contours and the encapsulation is not as distinct. In our full model $d = 5 0$ , the distribution of location.n.01 encompasses city.n.01’s, indicated by low KL(city.n.01||location.n.01) but high KL(location.n.01||city.n.01).
190
+
191
+ Figure 4 (Right) demonstrates the idea that synsets on the top of the hypernym hierarchy usually have higher “volume”. A convenient metric that reflects this quantity is log det $( \Sigma )$ for a Gaussian distribution with covariance $\Sigma$ . We can see that the synset, physical_entity.n.01, being the hypernym of all the synsets shown, has the highest $\log \mathrm { d e t } ( \Sigma )$ whereas entities that are more specific such as object.n.01, whole.n.02 and living_thing have decreasingly lower volume.
192
+
193
+ ![](images/44086b7d736d8891863d4d909146b7621cdc78f270808239fd55ac675d9f1d6c.jpg)
194
+ Figure 4: [best viewed electronically] (Left) Synsets and their hypernym relationships from WordNet. (Middle) Visualization of our 2-dimensional Gaussian order embedding. (Right) The Gaussian “volume” (log detΣ) of the 50-dimensional Gaussian model.
195
+
196
+ Table 2: $\mathrm { K L } ( \mathrm { c o l u m n } | | \mathrm { r o w } )$ . Cells in boldface indicate true WORDNET hypernym relationships (column $\preceq \mathrm { r o w } )$ . Our model predicts a synset pair as a hypernym if the KL less than 1900, where this value is tuned based on the validation set. Most relationship pairs are correctly predicted except for the underlined cells.
197
+
198
+ <table><tr><td></td><td>city</td><td>location</td><td>living_ _thing</td><td>whole</td><td>object</td><td>physical_entity</td></tr><tr><td>city</td><td>0</td><td>1025</td><td>4999</td><td>4673</td><td>23673</td><td>4639</td></tr><tr><td>location</td><td>159</td><td>0</td><td>4324</td><td>4122</td><td>26121</td><td>5103</td></tr><tr><td>living_thing</td><td>3623</td><td>6798</td><td>0</td><td>1452</td><td>2953</td><td>5936</td></tr><tr><td>whole</td><td>3033</td><td>6367</td><td>66</td><td>0</td><td>6439</td><td>6682</td></tr><tr><td>object</td><td>138</td><td>80</td><td>125</td><td>77</td><td>0</td><td>6618</td></tr><tr><td>physical_entity</td><td>232</td><td>206</td><td>193</td><td>166</td><td>152</td><td>0</td></tr></table>
199
+
200
+ # 4.4 GRADED LEXICAL ENTAILMENT
201
+
202
+ HYPERLEX is a lexical entailment dataset which has fine-grained human annotated scores between concept pairs, capturing varying degrees of entailment (Vulic et al., 2016). Concept pairs in ´ HYPERLEX reflect many variants of hypernym relationships, such as $\scriptstyle \mathtt { n o - r e l }$ (no lexical relationship), ant (antonyms), syn (synonyms), cohyp (sharing a hypernym but not a hypernym of each other), hyp (hypernym), rhyp (reverse hypernym). We use the noun dataset of HYPERLEX for evaluation, which contains 2,163 pairs.
203
+
204
+ We evaluate our model by comparing our model scores against the annotated scores. Obtaining a high correlation on a fine-grained annotated dataset is a much harder task compared to a binary prediction since performing well requires meaningful model scores in order to reflect nuances in hypernymy. We use negative divergence as our score for hypernymy scale where large values indicate high degrees of entailment.
205
+
206
+ We note that the concepts in our trained models are WORDNET synsets, where each synset corresponds to a specific meaning of a word. For instance, pop.n.03 has a definition $\mathbf { \ddot { a } }$ sharp explosive sound as from a gunshot or drawing a cork” whereas pop.n.04 corresponds to “music of general appeal to teenagers; ...”. For a given pair of words $( u , v )$ , we use the score of the synset pair $( s _ { u } ^ { \prime } , s _ { v } ^ { \prime } )$ that has the lowest KL divergence among all the pairs $S _ { n } \times S _ { v }$ where $S _ { u } , S _ { v }$ are sets of synsets for words $u$ and $v$ , respectively. More precisely, $\begin{array} { r } { s ( u , v ) = - \operatorname* { m i n } _ { s _ { u } \in S _ { u } , s _ { v } \in S _ { v } } D ( s _ { u } , s _ { v } ) } \end{array}$ . This pair selection corresponds to choosing the synset pair that has the highest degree of entailment. This approach has been used in word embeddings literature to select most related word pairs (Athiwaratkun $\&$ Wilson, 2017). For word pairs that are not in the model, we assign the score equal to the median of all scores. We evaluate our model scores against the human annotated scores using Spearman’s rank correlation.
207
+
208
+ Table 3 shows HYPERLEX results of our models DOE-A (asymmetric) and DOE-S (symmetric) as well as other competing models. The model DOE-A which uses KL divergence and negative sampling approach S1, S2 and S4 outperforms all other existing models, achieving state-of-the-art performance for the HYPERLEX noun dataset. (See Section A.1 for hyperparameter details) The model DOE-S which uses expected likelihood kernel attains a lower score of 0.455 compared to the asymmetric counterpart (DOE-A). This result underscores the importance of asymmetric measures which can capture relationship directionality.
209
+
210
+ We provide a brief summary of competing models: FR scores are based on concept word frequency ratio (Weeds et al., 2004). SLQS uses entropy-based measure to quantify entailment (Santus et al., 2014). Vis-ID calculates scores based on visual generality measures (Kiela et al., 2015). WN-B calculates the scores based on the shortest path between concepts in WN taxonomy (Miller, 1995). w2g Guassian embeddings trained using the methodology in Vilnis & McCallum (2014). VOE Vector order embeddings (Vendrov et al., 2015). Euc and Poin calculate scores based on the Euclidean distance and Poincaré distance of the trained Poincaré embeddings (Nickel & Kiela, 2017). The models FR and SLQS are based on word occurrences in text corpus, where FR is trained on the British National Corpus and SLQS is trained on UKWAC, WACKYPEDIA (Bailey & Thompson, 2006; Baroni et al., 2009) and annotated BLESS dataset (Baroni & Lenci, 2011). Other models Vis-ID, w2g, VOE, Euc, Poin and ours are trained on WordNet, with the exception that Vis-ID also uses
211
+
212
+ Table 3: Spearman’s correlation for HYPERLEX nouns.
213
+
214
+ <table><tr><td>FR</td><td></td><td>SLQS</td><td>Vis-ID</td><td>WN-B</td><td>w2g</td><td>VOE</td><td>Poin</td><td>HypV</td><td>DOE-S</td><td>DOE-A</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>p</td><td>0.283</td><td>0.229</td><td>0.253</td><td>0.240</td><td>0.192</td><td>0.195</td><td>0.512</td><td>0.540</td><td>0.455</td><td>0.590</td></tr></table>
215
+
216
+ Table 4: Spearman’s correlation for HYPERLEX nouns for different negative sample schemes.
217
+
218
+ <table><tr><td>Negative Samples</td><td>p</td><td>Negative Samples</td><td>p</td></tr><tr><td>1×S1</td><td>0.527</td><td>1×S1 + S2 + S4</td><td>0.590</td></tr><tr><td>2×S1</td><td>0.529</td><td>2×S1 + S2 + S4</td><td>0.580</td></tr><tr><td>5×S1</td><td>0.518</td><td>5×S1 + S2 + S4</td><td>0.582</td></tr><tr><td>10×S1</td><td>0.517</td><td>1×S1 + S2 + S3</td><td>0.570</td></tr><tr><td>1×S1+ S2</td><td>0.567</td><td>2×S1 + S2 + S3</td><td>0.581</td></tr><tr><td>2×S1 + S2</td><td>0.567</td><td>S1 + 0.1×S2 +0.9×S3</td><td>0.564</td></tr><tr><td>3×S1 + S2</td><td>0.584</td><td>S1 + 0.3×S2 +0.7×S3</td><td>0.574</td></tr><tr><td>5×S1+ S2</td><td>0.561</td><td>S1+ 0.7×S2 +0.3×S3</td><td>0.555</td></tr><tr><td>10×S1+ S2</td><td>0.550</td><td>S1 + 0.9×S2 +0.1×S3</td><td>0.533</td></tr></table>
219
+
220
+ Google image search results for visual data. The reported results of FR, SLQS, Vis-ID, WN-B, w2g and VOE are from Vulic et al. (2016).´
221
+
222
+ We note that an implementation of Gaussian embeddings model (w2g) reported by Vulic et al. (2016) ´ does not perform well compared to previous benchmarks such as Vis-ID, FR, SLQS. Our training approach yields the opposite results and outperforms other highly competitive methods such as Poincaré embeddings and Hypervec. This underscores the fact that training approach matters a great deal, even if the concept representation of our work and Vilnis & McCallum (2014)’s are both Gaussian distributions. In addition, we also observe that the vector order embeddings (VOE) do not perform well compared to our model. We hypothesize that it is due to the “soft” orders induced by the divergence penalty that allows our model scores to reflect more closely with hypernymy degrees.
223
+
224
+ We note another interesting observation that a model trained on a symmetric divergence (ELK) from Section 4.2 can also achieve a high HYPERLEX correlation of 0.532 if KL is used to calculate the model scores. This is because the encapsulation behavior can arise even though the training penalty is symmetric (more explanation in Section 4.2). However, using the symmetric divergence based on ELK results in poor performance on HYPERLEX (0.455), which is expected since it cannot capture the directionality of hypernymy.
225
+
226
+ We note that another model LEAR obtains an impressive score of 0.686 (Vulic & Mrkši ´ c, 2014). ´ However, LEAR use pre-trained word embeddings such as WORD2VEC or GLOVE as a pre-processing step, leveraging a large vocabulary with rich semantic information. To the best of our knowledge, our model achieves the highest HYPERLEX Spearman’s correlation among models without using large-scale pre-trained embeddings.
227
+
228
+ Table 4 shows the effects of negative sample selection described in Section 3.5. We note again that S1 is the technique used in literature Socher et al. (2013); Vendrov et al. (2015) and S2, S3, S4 are the new techniques we proposed. The notation, for instance, $k \times \mathbf { S 1 } + \mathbf { S 2 }$ corresponds to using $k$ samples from S1 and 1 sample from S2 per each positive sample. We observe that our new selection methods offer strong improvement from the range of $0 . 5 1 - 0 . 5 2$ (using S1 alone) to 0.55 or above for most combinations with our new selection schemes.
229
+
230
+ # 5 FUTURE WORK
231
+
232
+ Analogous to recent work by Vulic & Mrkši ´ c (2014) which post-processed word embeddings such as ´ GLOVE or WORD2VEC, our future work includes using the WordNet hierarchy to impose encapsulation orders when training probabilistic embeddings.
233
+
234
+ In the future, the distribution approach could also be developed for encoder-decoder based models for tasks such as caption generation where the encoder represents the data as a distribution, containing semantic and visual features with uncertainty, and passes this distribution to the decoder which maps to text or images. Such approaches would be reminiscent of variational autoencoders (Kingma & Welling, 2013), which take samples from the encoder’s distribution.
235
+
236
+ # ACKNOWLEDGEMENTS
237
+
238
+ We thank NSF IIS-1563887 for support.
239
+
240
+ # REFERENCES
241
+
242
+ Ben Athiwaratkun and Andrew Gordon Wilson. Multimodal word distributions. In ACL, 2017.
243
+
244
+ Steve Bailey and Dave Thompson. UKWAC: building the uk’s first public web archive. D-Lib Magazine, 12(1), 2006.
245
+
246
+ Marco Baroni and Alessandro Lenci. How we blessed distributional semantic evaluation. In Proceedings of the GEMS 2011 Workshop on GEometrical Models of Natural Language Semantics, 2011.
247
+
248
+ Marco Baroni, Silvia Bernardini, Adriano Ferraresi, and Eros Zanchetta. The wacky wide web: a collection of very large linguistically processed web-crawled corpora. Language Resources and Evaluation, 43(3), 2009.
249
+
250
+ Marco Baroni, Raffaella Bernardi, Ngoc-Quynh Do, and Chung-chieh Shan. Entailment above the word level in distributional semantics. In EACL, pp. 23–32, 2012.
251
+
252
+ Yonatan Bisk, Deniz Yuret, and Daniel Marcu. Natural language communication with robots. In NAACL, 2016.
253
+
254
+ Julia Hockenmaier and Alice Lai. Learning to predict denotational probabilities for modeling entailment. In EACL, 2017.
255
+
256
+ Tony Jebara, Risi Kondor, and Andrew Howard. Probability product kernels. JMLR, 2004.
257
+
258
+ Douwe Kiela, Laura Rimell, Ivan Vulic, and Stephen Clark. Exploiting image generality for lexical entailment ´ detection. In ACL, 2015.
259
+
260
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. CoRR, abs/1412.6980, 2014.
261
+
262
+ Diederik P. Kingma and Max Welling. Auto-encoding variational bayes. CoRR, abs/1312.6114, 2013.
263
+
264
+ Ryan Kiros, Yukun Zhu, Ruslan Salakhutdinov, Richard S. Zemel, Raquel Urtasun, Antonio Torralba, and Sanja Fidler. Skip-thought vectors. In NIPS, 2015.
265
+
266
+ Xiang Li, Luke Vilnis, and Andrew McCallum. Improved representation learning for predicting commonsense ontologies. CoRR, abs/1708.00549, 2017. URL http://arxiv.org/abs/1708.00549.
267
+
268
+ Yingzhen Li and Richard E. Turner. Rényi divergence variational inference. In NIPS, 2016.
269
+
270
+ Friedrich Liese and Igor Vajda. Convex Statistical Distances. Leipzig $:$ Teubner, 1987.
271
+
272
+ Edward Loper and Steven Bird. Nltk: The natural language toolkit. In ACL workshop, 2002.
273
+
274
+ Tomas Mikolov, Kai Chen, Greg Corrado, and Jeffrey Dean. Efficient estimation of word representations in vector space. CoRR, abs/1301.3781, 2013.
275
+
276
+ George A. Miller. Wordnet: A lexical database for english. Commun. ACM, 38(11), November 1995.
277
+
278
+ Maximilian Nickel and Douwe Kiela. Poincaré embeddings for learning hierarchical representations. NIPS, 2017.
279
+
280
+ Leandro Pardo. Statistical Inference Based on Divergence Measures, chapter 1, pp. 1–54. Chapman & Hall/CRC, 2006.
281
+
282
+ Alfred Renyi. On measures of entropy and information. In Proceedings of the Fourth Berkeley Symposium on Mathematical Statistics and Probability, Volume 1: Contributions to the Theory of Statistics, Berkeley, Calif., 1961.
283
+
284
+ Tim Rocktäschel, Edward Grefenstette, Karl Moritz Hermann, Tomás Kociský, and Phil Blunsom. Reasoning about entailment with neural attention. CoRR, abs/1509.06664, 2015.
285
+ Enrico Santus, Alessandro Lenci, Qin Lu, and Sabine Schulte im Walde. Chasing hypernyms in vector spaces with entropy. In EACL, 2014.
286
+ Richard Socher, Danqi Chen, Christopher D. Manning, and Andrew Y. Ng. Reasoning with neural tensor networks for knowledge base completion. In NIPS, 2013.
287
+ Robert Speer, Joshua Chin, and Catherine Havasi. Conceptnet 5.5: An open multilingual graph of general knowledge. CoRR, abs/1612.03975, 2016. URL http://arxiv.org/abs/1612.03975.
288
+ Ivan Vendrov, Ryan Kiros, Sanja Fidler, and Raquel Urtasun. Order-embeddings of images and language. CoRR, abs/1511.06361, 2015.
289
+ Luke Vilnis and Andrew McCallum. Word representations via gaussian embedding. CoRR, abs/1412.6623, 2014.
290
+ Oriol Vinyals, Alexander Toshev, Samy Bengio, and Dumitru Erhan. Show and tell: A neural image caption generator. In CVPR, 2015.
291
+ Ivan Vulic and Nikola Mrkši ´ c. Specialising word vectors for lexical entailment. ´ CoRR, abs/1710.06371, 2014.
292
+ Ivan Vulic, Daniela Gerz, Douwe Kiela, Felix Hill, and Anna Korhonen. Hyperlex: A large-scale evaluation of ´ graded lexical entailment. CoRR, 2016.
293
+ Julie Weeds, David J. Weir, and Diana McCarthy. Characterising measures of lexical distributional similarity. In COLING, 2004.
294
+
295
+ # A SUPPLEMENTARY MATERIALS
296
+
297
+ # A.1 MODEL HYPERPARAMETERS
298
+
299
+ In Section 4.3, the $2 -$ dimensional Gaussian model is trained with S-1 method where the number of negative samples is equal to the number of positive samples. The best hyperparameters for $d = 2$ model is $( m , \beta , \gamma ) =$ $( 1 0 \dot { 0 } . 0 , 2 \times \dot { 1 } 0 ^ { - 4 } , 3 . 0 )$ .
300
+
301
+ In Section 4.2, the best hyperparameters $( m , \beta , \gamma )$ for each of our model are as follows: For Gaussian with KL penalty: $( 2 0 0 0 . 0 , 5 \times \mathrm { \hat { 1 0 } ^ { - 5 } }$ , 500.0), , Gaussian with reversed KL penalty: $( 1 0 0 0 . 0 , 1 \times 1 0 ^ { - 4 } , 1 0 0 0 . 0 )$ Gaussian with ELK penalty $( 1 0 0 0 , 1 \times 1 0 ^ { - 5 } , 1 0 )$ .
302
+
303
+ In Section 4.4, we use the same hyperparameters as in 4.2 with KL penalty, but a different negative sample combination in order to increase the distinguishability of divergence scores. For each positive sample in the training set, we use one sample from each of the methods S1, S2, S3. We note that the model from Section 4.2, using S1 with the KL penalty obtains a Spearman’s correlation of 0.527.
304
+
305
+ # A.2 ANALYSIS OF TRAINING METHODOLOGY
306
+
307
+ We emphasize that Gaussian embeddings have been used in the literature, both in the unsupervised settings where word embeddings are trained with local contexts from text corpus, and in supervised settings where concept embeddings are trained to model annotated data such as WORDNET . The results in supervised settings such as modeling WORDNET have been reported to compare with competing models but often have inferior performance (Vendrov et al., 2015; Vulic et al., 2016). Our paper reaches the opposite conclusion, showing that ´ a different training approach using Gaussian representations can achieve state-of-the-art results.
308
+
309
+ # A.2.1 DIVERGENCE THRESHOLD
310
+
311
+ Consider a relationship $f \preceq g$ where $f$ is a hyponym of $g$ or $g$ is a hypernym of $f$ . Even though the divergence $D ( f | | g )$ can capture the extent of encapsulation, a density $f$ will have the lowest divergence with respect with $g$ only if $f = g$ . In addition, if $f$ is a more concentrated distribution that is encompassed by $g$ , ${ \bar { D ( f | | g ) } }$ is minimized when $f$ is at the center of $g$ . However, if there any many hyponyms $f _ { 1 } , f _ { 2 }$ of $g$ , the hyponyms can compete to be close to the center, resulting in too much overlapping between $f _ { 1 }$ and $f _ { 2 }$ if the random sampling to penalize negative pairs is not sufficiently strong. The divergence threshold $\gamma$ is used such that there is no longer a penalty once the divergence is below a certain level.
312
+
313
+ We demonstrate empirically that the threshold $\gamma$ is important for learning meaningful Gaussian distributions. We fix the hyperparameters $m = 2 0 0 0$ and $\beta = 5 \times 1 0 ^ { - 5 }$ , with S1 negative sampling. Figure 5 shows that there is an optimal non-zero threshold and yields the best performance for both WORDNET Hypernym prediction and HYPERLEX Spearman’s correlation. We observe that using $\gamma = 0$ is detrimental to the performance, especially on HYPERLEX results.
314
+
315
+ ![](images/34ce4671b6c82da62e00f12c9863402a479708277a989767001214cf63e87b40.jpg)
316
+ Figure 5: (a) Spearman’s correlation on HYPERLEX versus $\gamma$ (b) Test Prediction Accuracy versus $\gamma$
317
+
318
+ # A.2.2 INITIAL VARIANCE SCALE
319
+
320
+ As opposed to the mean vectors that are randomly initialized, we initialize all diagonal covariance elements to be the same. Even though the variance can adapt during training, we find that different initial scales of variance result in drastically different performance. To demonstrate, in Figure 6, we show the best test accuracy and HYPERLEX Spearman’s correlation for each initial variance scale, with other hyperparameters (margin $m$ and threshold $\gamma$ ) tuned for each variance. We use $\mathbf { S 1 } + \mathbf { S 2 } + \mathbf { S 4 }$ as a negative sampling method. In general, a low variance scale $\beta$ increases the scale of the loss and requires higher margin $m$ and threshold $\gamma$ . We observe that the best prediction accuracy is obtained when $\log ( \beta ) \stackrel { \circ } { \approx } - 1 0$ or $\beta = 5 \times 1 0 ^ { - 5 }$ . The best HYPERLEX results are obtained when the scales of $\beta$ are sufficiently low. The intuition is that low $\beta$ increases the scale of divergence $D ( \cdot | | \cdot )$ , which increases the ability to capture relationship nuances.
321
+
322
+ ![](images/a6ddbe4924da9c7d9235b3ca05bb911e0c2d2eff0376b20b504a4a0aefb00d41.jpg)
323
+ Figure 6: (a) Spearman’s correlation on HYPERLEX versus $\log ( \beta )$ (b) Test Prediction Accuracy versus $\log ( \beta )$ .
324
+
325
+ # A.2.3 LOSS FUNCTION
326
+
327
+ We verify that for this task, our loss function in Equation 7 in superior to Equation 1 originally proposed by Vilnis & McCallum (2014). We use the exact same setup with new negative sample selections and KL divergence thresholding and compare the two loss functions. Table 5 verifies our claim.
328
+
329
+ Table 5: Best results for each loss function for two negative sampling setups: S1 (Left) and $\mathbf { S 1 } + \mathbf { S 2 }$ + S4 (Right)
330
+
331
+ <table><tr><td></td><td>Test Accuracy</td><td>HYPERLEX</td></tr><tr><td>Eq.7</td><td>0.923</td><td>0.527</td></tr><tr><td>Eq.1</td><td>0.886</td><td>0.524</td></tr></table>
332
+
333
+ <table><tr><td>Test Accuracy</td><td>HYPERLEX</td></tr><tr><td>Eq.7 0.911</td><td>0.590</td></tr><tr><td>Eq.1 0.796</td><td>0.489</td></tr></table>
334
+
335
+ # A.2.4 DIMENSIONALITY
336
+
337
+ Table 6 shows the results for many dimensionalities for two negative sample strategies: S1 and $\mathbf { S 1 } + \mathbf { S 2 } + \mathbf { S 4 }$ .
338
+
339
+ Table 6: Best results for each dimension with negative samples S1 (Left) and $\mathbf { S 1 } + \mathbf { S 2 } + \mathbf { S 4 }$ (Right)
340
+
341
+ <table><tr><td>d</td><td>Test Accuracy</td><td>HYPERLEX</td></tr><tr><td>5</td><td>0.909</td><td>0.437</td></tr><tr><td>10</td><td>0.919</td><td>0.462</td></tr><tr><td>20</td><td>0.922</td><td>0.487</td></tr><tr><td>50</td><td>0.923</td><td>0.527</td></tr><tr><td>100</td><td>0.924</td><td>0.526</td></tr><tr><td>200</td><td>0.918</td><td>0.526</td></tr></table>
342
+
343
+ <table><tr><td>d</td><td>Test Accuracy</td><td>HYPERLEX</td></tr><tr><td>5</td><td>0.901</td><td>0.483</td></tr><tr><td>10</td><td>0.909</td><td>0.526</td></tr><tr><td>20</td><td>0.914</td><td>0.545</td></tr><tr><td>50</td><td>0.911</td><td>0.590</td></tr><tr><td>100</td><td>0.913</td><td>0.573</td></tr><tr><td>200</td><td>0.910</td><td>0.568</td></tr></table>
344
+
345
+ # A.2.5 $\alpha$ -DIVERGENCES
346
+
347
+ Table 7 show the results using models trained and evaluated with $D ( \cdot | | \cdot ) = D _ { \alpha } ( \cdot | | \cdot )$ with negative sampling approach S1. Interestingly, we found that $\alpha 1$ (KL) offers the best result for both prediction accuracy and HYPERLEX . It is possible that $\alpha = 1$ is sufficiently asymmetric enough to distinguish hypernym directionality, but does not have as sharp penalty as in $\alpha > 1$ , which can help learning.
348
+
349
+ ![](images/f1653c69de11fabe9ab7ab19636aa2f77f689fa3fbea1213b03a2e7592d67d58.jpg)
350
+ Figure 7: (a) Spearman’s correlation on HYPERLEX versus $\alpha$ (b) Test Prediction Accuracy versus $\alpha$ .
md/train/HJe6uANtwH/HJe6uANtwH.md ADDED
@@ -0,0 +1,255 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CAPSULES WITH INVERTED DOT-PRODUCT ATTENTION ROUTING
2
+
3
+ Yao-Hung Hubert Tsai1,2, Nitish Srivastava1, Hanlin $\mathbf { G o h } ^ { 1 }$ , Ruslan Salakhutdinov1,2 1Apple Inc., 2Carnegie Mellon University yaohungt@cs.cmu.edu,{nitish srivastava,hanlin,rsalakhutdinov}@apple.com
4
+
5
+ # ABSTRACT
6
+
7
+ We introduce a new routing algorithm for capsule networks, in which a child capsule is routed to a parent based only on agreement between the parent’s state and the child’s vote. The new mechanism 1) designs routing via inverted dot-product attention; 2) imposes Layer Normalization as normalization; and 3) replaces sequential iterative routing with concurrent iterative routing. When compared to previously proposed routing algorithms, our method improves performance on benchmark datasets such as CIFAR-10 and CIFAR-100, and it performs at-par with a powerful CNN (ResNet-18) with $4 \times$ fewer parameters. On a different task of recognizing digits from overlayed digit images, the proposed capsule model performs favorably against CNNs given the same number of layers and neurons per layer. We believe that our work raises the possibility of applying capsule networks to complex real-world tasks. Our code is publicly available at: https://github. com/apple/ml-capsules-inverted-attention-routing. An alternative implementation is available at: https://github.com/ yaohungt/Capsules-Inverted-Attention-Routing/blob/ master/README.md.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Capsule Networks (CapsNets) represent visual features using groups of neurons. Each group (called a “capsule”) encodes a feature and represents one visual entity. Grouping all the information about one entity into one computational unit makes it easy to incorporate priors such as “a part can belong to only one whole” by routing the entire part capsule to its parent whole capsule. Routing is mutually exclusive among parents, which ensures that one part cannot belong to multiple parents. Therefore, capsule routing has the potential to produce an interpretable hierarchical parsing of a visual scene. Such a structure is hard to impose in a typical convolutional neural network (CNN). This hierarchical relationship modeling has spurred a lot of interest in designing capsules and their routing algorithms (Sabour et al., 2017; Hinton et al., 2018; Wang & Liu, 2018; Zhang et al., 2018; Li et al., 2018; Rajasegaran et al., 2019; Kosiorek et al., 2019).
12
+
13
+ In order to do routing, each lower-level capsule votes for the state of each higher-level capsule. The higher-level (parent) capsule aggregates the votes, updates its state, and uses the updated state to explain each lower-level capsule. The ones that are well-explained end up routing more towards that parent. This process is repeated, with the vote aggregation step taking into account the extent to which a part is routed to that parent. Therefore, the states of the hidden units and the routing probabilities are inferred in an iterative way, analogous to the M-step and E-step, respectively, of an Expectation-Maximization (EM) algorithm. Dynamic Routing (Sabour et al., 2017) and EMrouting (Hinton et al., 2018) can both be seen as variants of this scheme that share the basic iterative structure but differ in terms of details, such as their capsule design, how the votes are aggregated, and whether a non-linearity is used.
14
+
15
+ We introduce a novel routing algorithm, which we called Inverted Dot-Product Attention Routing. In our method, the routing procedure resembles an inverted attention mechanism, where dot products are used to measure agreement. Specifically, the higher-level (parent) units compete for the attention of the lower-level (child) units, instead of the other way around, which is commonly used in attention models. Hence, the routing probability directly depends on the agreement between the parent’s pose (from the previous iteration step) and the child’s vote for the parent’s pose (in the current iteration step). We also propose two modifications for our routing procedure – (1) using Layer Normalization (Ba et al., 2016) as normalization, and (2) doing inference of the latent capsule states and routing probabilities jointly across multiple capsule layers (instead of doing it layer-wise). These modifications help scale up the model to more challenging datasets.
16
+
17
+ ![](images/1f1c316374f09e44e13a3eafdaf5df9546930e68f6c7ab56cfb0e742f40960d5.jpg)
18
+ Figure 1: Illustration of a Capsule network with a backbone block, 3 convolutional capsule layers, 2 fullyconnected capsule layers, and a classifier. The first convolutional capsule layer is called the primary capsule layer. The last fully-connected capsule layer is called the class capsule layer.
19
+
20
+ Our model achieves comparable performance as the state-of-the-art convolutional neural networks (CNNs), but with much fewer parameters, on CIFAR-10 $9 5 . 1 4 \%$ test accuracy) and CIFAR-100 $7 8 . 0 2 \%$ test accuracy). We also introduce a challenging task to recognize single and multiple overlapping objects simultaneously. To be more precise, we construct the DiverseMultiMNIST dataset that contains both single-digit and overlapping-digits images. With the same number of layers and the same number of neurons per layer, the proposed CapsNet has better convergence than a baseline CNN. Overall, we argue that with the proposed routing mechanism, it is no longer impractical to apply CapsNets on real-world tasks. We will release the source code to reproduce the experiments.
21
+
22
+ # 2 CAPSULE NETWORK ARCHITECTURE
23
+
24
+ An example of our proposed architecture is shown in Figure 1. The backbone is a standard feedforward convolutional neural network. The features extracted from this network are fed through another convolutional layer. At each spatial location, groups of 16 channels are made to create capsules (we assume a 16-dimensional pose in a capsule). LayerNorm is then applied across the 16 channels to obtain the primary capsules. This is followed by two convolutional capsule layers, and then by two fully-connected capsule layers. In the last capsule layer, each capsule corresponds to a class. These capsules are then used to compute logits that feed into a softmax to computed the classification probabilities. Inference in this network requires a feed-forward pass up to the primary capsules. After this, our proposed routing mechanism (discussed in the next section) takes over.
25
+
26
+ In prior work, each capsule has a pose and some way of representing an activation probability. In Dynamic Routing CapsNets (Sabour et al., 2017), the pose is represented by a vector and the activation probability is implicitly represented by the norm of the pose. In EM Routing CapsNets (Hinton et al., 2018), the pose is represented by a matrix and the activation probability is determined by the EM algorithm. In our work, we consider a matrix-structured pose in a capsule. We denote the capsules in layer $L$ as $\mathbf { P } ^ { L }$ and the $i$ -th capsule in layer $L$ as $\mathbf { p } _ { i } ^ { L }$ . The pose $\mathbf { p } _ { i } ^ { L } \in \mathbb { R } ^ { d _ { L } }$ in a vector form and will be reshaped to $\mathbb { R } ^ { \sqrt { d _ { L } } \times \sqrt { d _ { L } } }$ when representing it as a matrix, where $d _ { L }$ is the number of hidden units grouped together to make capsules in layer $L$ . The activation probability is not explicitly represented. By doing this, we are essentially asking the network to represent the absence of a capsule by some special value of its pose.
27
+
28
+ # 3 INVERTED DOT-PRODUCT ATTENTION ROUTING
29
+
30
+ The proposed routing process consists of two steps. The first step computes the agreement between lower-level capsules and higher-level capsules. The second step updates the pose of the higher-level capsules.
31
+
32
+ Step 1: Computing Agreement: To determine how capsule $j$ in layer ${ \cal L } + 1 ( { \bf p } _ { j } ^ { L + 1 } )$ agrees with capsule $i$ in layer $L$ $( \mathbf { p } _ { i } ^ { L } )$ , we first transform the pose $\mathbf { p } _ { i } ^ { L }$ to the vote $\mathbf { v } _ { i j } ^ { L }$ for the pose $\mathbf { p } _ { j } ^ { L + 1 }$ . This
33
+
34
+ ![](images/0a1727a578356e09e9d56271c2e546f9eca7f7f992ef3bbead9a061f62d4f4dc.jpg)
35
+ Figure 2: Illustration of the Inverted Dot-Product Attention Routing with the pose admitting matrix structure.
36
+
37
+ <table><tr><td>Procedure 1 Inverted Dot-product Attention Routing algorithm returns updated poses of the cap- sules in layer L +1 given poses in layer L and L +1 and weights between layer L and L +1.</td></tr><tr><td>1: prOCedure INVERTED DOT-PRODUCT ATTENTION ROUTING(PL,PL+1,WL)</td></tr><tr><td>2: for all capsule i in layer L and capsule j in layer (L +1): vj ←WL p vote ij</td></tr><tr><td>: vij &gt; agreement 3:</td></tr><tr><td>for allcapsule i in layer L: rl ← exp(a)/∑, exp(a&#x27;) 4: &gt; routing coefficient</td></tr><tr><td>for all capsule j in layer (L +1): P L+1 ←∑iv 5:</td></tr><tr><td>6: &gt;normalization 7: return PL+1</td></tr></table>
38
+
39
+ transformation is done using a learned transformation matrix $\mathbf { W } _ { i j } ^ { L }$
40
+
41
+ $$
42
+ \mathbf { v } _ { i j } ^ { L } = \mathbf { W } _ { i j } ^ { L } \cdot \mathbf { p } _ { i } ^ { L } ,
43
+ $$
44
+
45
+ where the matrix $\mathbf { W } _ { i j } ^ { L } \in \mathbb { R } ^ { d _ { L + 1 } \times d _ { L } }$ if the pose has a vector structure and $\mathbf { W } _ { i j } ^ { L } \in \mathbb { R } ^ { \sqrt { d _ { L + 1 } } \times \sqrt { d _ { L } } }$ (requires $d _ { L + 1 } = d _ { L } )$ if the pose has a matrix structure. Next, the agreement $( a _ { i j } ^ { L } )$ is computed by the dot-product similarity between a pose $\mathbf { p } _ { j } ^ { L + 1 }$ and a vote $\mathbf { v } _ { i j } ^ { L }$ :
46
+
47
+ $$
48
+ a _ { i j } ^ { L } = { \bf p } _ { j } ^ { L + 1 ^ { \top } } \cdot { \bf v } _ { i j } ^ { L } .
49
+ $$
50
+
51
+ The pose $\mathbf { p } _ { j } ^ { L + 1 }$ is obtained from the previous iteration of this procedure, and will be set to 0 initially.
52
+
53
+ Step 2: Computing Poses: The agreement scores $a _ { i j } ^ { L }$ are passed through a softmax function to determine the routing probabilities $r _ { i j } ^ { L }$ :
54
+
55
+ $$
56
+ r _ { i j } ^ { L } = \frac { \exp ( a _ { i j } ^ { L } ) } { \sum _ { j ^ { \prime } } \exp ( a _ { i j ^ { \prime } } ^ { L } ) } ,
57
+ $$
58
+
59
+ where $r _ { i j } ^ { L }$ is an inverted attention score representing how higher-level capsules compete for attention of lower-level capsules. Using the routing probabilities, we update the pose pLj $\mathbf { p } _ { j } ^ { L + 1 }$ for capsule $j$ in layer $L + 1$ from all capsules in layer $L$ :
60
+
61
+ $$
62
+ \mathbf { p } _ { j } ^ { L + 1 } = \mathrm { L a y e r N o r m } \left( \sum _ { i } r _ { i j } ^ { L } \mathbf { v } _ { i j } ^ { L } \right) .
63
+ $$
64
+
65
+ We adopt Layer Normalization (Ba et al., 2016) as the normalization, which we empirically find it to be able to improve the convergence for routing. The routing algorithm is summarized in Procedure 1 and Figure 2.
66
+
67
+ # 4 INFERENCE AND LEARNING
68
+
69
+ To explain how inference and learning are performed, we use Figure 1 as an example. Note that the choice of the backbone, the number of capsules layers, the number of capsules per layer, the design of the classifier may vary for different sets of experiments. We leave the discussions of configurations in Sections 5 and 6, and in the Appendix.
70
+
71
+ Procedure 2 Inference. Inference returns class logits given input images and parameters for the model. Capsule layer 1 denotes the primary capsules layer and layer $N$ denotes the class capsules layer.
72
+
73
+ <table><tr><td colspan="2">1: procedure INFERENCE(I; 0, W1:N-1) /* Pre-Capsules Layers: backbone features extraction */</td></tr><tr><td colspan="2">F ← backbone(I;0)</td></tr><tr><td colspan="2">2:</td></tr><tr><td colspan="2">/* Capsules Layers: initialization */</td></tr><tr><td colspan="2">3: P1 ← LayerNorm(convolution(F; 0))</td></tr><tr><td colspan="2">4: for L in layers 2 to N: PL ←Os</td></tr><tr><td colspan="2">/*Capsules Layers (lst Iteration): sequential routing */</td></tr><tr><td colspan="2">5: for L in layers 1 to (N-1) do 6: PL+1 ← Routing (PL,pL+1; WL)</td></tr><tr><td colspan="2">/* Capsules Layers (2nd to th Iteration): concurrent routing */</td></tr><tr><td colspan="2">7: for (t -1) iterations do for L in layers 1 to (N -1): PL+1 ← Routing (PL,PL+1; WL)</td></tr><tr><td colspan="2">8: 9:</td></tr><tr><td colspan="2">for L in layers 2 to N: PL←PL</td></tr><tr><td colspan="2">/* Post-Capsules Layers: classification */</td></tr><tr><td colspan="2">10: for all capsule i in layer N: yi ← classifier(pN ; 0)</td></tr></table>
74
+
75
+ # 4.1 INFERENCE
76
+
77
+ For ease of exposition, we decompose a CapsNet into pre-capsule, capsule and post-capsule layers.
78
+
79
+ Pre-Capsule Layers: The goal is to obtain a backbone feature $\mathbf { F }$ from the input image I. The backbone model can be either a single convolutional layer or ResNet computational blocks (He et al., 2016).
80
+
81
+ Capsule Layers: The primary capsules $\mathbf { P } ^ { 1 }$ are computed by applying a convolution layer and Layer Normalization to the backbone feature F. The non-primary capsules layers $\mathbf { P } ^ { 2 : N }$ are initialized to be zeros 1. For the first iteration, we perform one step of routing sequentially in each capsule layer. In other words, the primary capsules are used to update their parent convolutional capsules, which are then used to update the next higher-level capsule layer, and so on. After doing this first pass, the rest of the routing iterations are performed concurrently. Specifically, all capsule layers look at their preceding lower-level capsule layer and perform one step of routing simultaneously. This procedure is an example of a parallel-in-time inference method. We call it “concurrent routing” as it concurrently performs routing between capsules layers per iteration, leading to better parallelism. Figure 3 illustrates this procedure from routing iteration 2 to $t$ . It is worth noting that, our proposed variant of CapsNet is a weight-tied concurrent routing architecture with Layer Normalization, which Bai et al. (2019) empirically showed could converge to fixed points.
82
+
83
+ Previous CapsNets (Sabour et al., 2017; Hinton et al., 2018) used sequential layer-wise iterative routing between the capsules layers. For example, the model first performs routing between layer $L - 1$ and layer $L$ for a few iterations. Next, the model performs routing between layer $L$ and $L + 1$ for a few iterations. When unrolled, this sequential iterative routing defines a very deep computational graph with a single path going from the inputs to the outputs. This deep graph could lead to a vanishing gradients problem and limit the depth of a CapsNet that can be trained well, especially if any squashing non-linearities are present. With concurrent routing, the training can be made more stable, since each iteration has a more cumulative effect.
84
+
85
+ Post-Capsule Layers: The goal is to obtain the predicted class logits $\hat { \mathbf { y } }$ from the last capsule layer (the class capsules) $\mathbf { P } ^ { N }$ . In our CapsNet, we use a linear classifier for class $i$ in class capsules: $\hat { y } _ { i } = \mathrm { c l a s s i f i e r } ( \mathbf { p } _ { i } ^ { N } )$ . This classifier is shared across all the class capsules.
86
+
87
+ ![](images/f340174d655b0b86f1b3a3abed17d2e3f1b8b6e036a9d4f29adf23a0b341371d.jpg)
88
+ Figure 3: Illustration of the proposed concurrent routing from iteration 2 to $t$ with the example in Figure 1. The concurrent routing is a parallel-in-time routing procedure for all capsules layers.
89
+
90
+ Table 1: Classification results on CIFAR-10/CIFAR-100 without ensembling models. We report the best performance for CapsNets when considering 1 to 5 routing iterations. We report the performance from the best test model for baseline routing methods, our routing method, and ResNet (He et al., 2016).
91
+
92
+ <table><tr><td rowspan="2">Method</td><td rowspan="2">Backbone</td><td colspan="2">Test Accuracy (# of parameters)</td></tr><tr><td>CIFAR-10</td><td>CIFAR-100</td></tr><tr><td>Dynamic Routing (Sabour et al.,2017)</td><td>simple</td><td>84.08% (7.99M)</td><td>56.96% (31.59M)</td></tr><tr><td>EMRouting (Hinton et al., 2018)</td><td>simple</td><td>82.19 (0.45M)</td><td>37.73% (0.50M)</td></tr><tr><td>Inverted Dot-Product Attention Routing (ours)</td><td>simple</td><td>85.17 (0.56M)</td><td>57.32% (1.46M)</td></tr><tr><td>Dynamic Routing (Sabour et al.,2017)</td><td>ResNet</td><td>92.65% (12.45M)</td><td>71.70% (36.04M)</td></tr><tr><td>EMRouting (Hinton et al., 2018)</td><td>ResNet</td><td>92.15% (1.71M)</td><td>58.08% (1.76M)</td></tr><tr><td>Inverted Dot-Product Attention Routing (ours)</td><td>ResNet</td><td>95.14% (1.83M)</td><td>78.02% (2.80M)</td></tr><tr><td>Baseline CNN (simple)</td><td></td><td>87.10% (18.92M)</td><td>62.30% (19.01M)</td></tr><tr><td>ResNet-18 (He et al.,2016)</td><td></td><td>95.11% (11.17M)</td><td>77.92% (11.22M)</td></tr></table>
93
+
94
+ # 4.2 LEARNING
95
+
96
+ We update the parameters $\theta , \mathbf { W } ^ { 1 : N - 1 }$ by stochastic gradient descent. For multiclass classification, we use multiclass cross-entropy loss. For multilabel classification, we use binary cross-entropy loss. We also tried Margin loss and Spread loss which are introduced by prior work (Sabour et al., 2017; Hinton et al., 2018). However, these losses do not give us better performance against cross-entropy and binary cross-entropy losses.
97
+
98
+ # 4.3 COMPARISONS WITH EXISTING CAPSNET MODELS
99
+
100
+ Having described our model in detail, we can now place the model in the context of previous work. In the following table, we list the major differences among different variants of CapsNets.
101
+
102
+ <table><tr><td></td><td>Dynamic Routing (Sabour et al., 2017)</td><td>EMRouting (Hinton et al., 2018)</td><td>Inverted Dot-Product Attention Routing (ours)</td></tr><tr><td>Routing</td><td>sequential iterative routing</td><td>sequential iterative routing</td><td>concurrent iterative routing</td></tr><tr><td>Poses Activations</td><td>vector n/a (norm of poses)</td><td>matrix determined by EM</td><td>matrix n/a</td></tr><tr><td>Non-linearity Normalization</td><td>Squash function n/a</td><td>n/a n/a</td><td>n/a Layer Normalization</td></tr><tr><td>Loss Function</td><td>Margin loss</td><td>Spread loss</td><td>Cross Entropy/Binary Cross Entropy</td></tr></table>
103
+
104
+ # 5 EXPERIMENTS ON CIFAR-10 AND CIFAR-100
105
+
106
+ CIFAR-10 and CIFAR-100 datasets (Krizhevsky et al., 2009) consist of small $3 2 \times 3 2$ real-world color images with 50, 000 for training and 10, 000 for evaluation. CIFAR-10 has 10 classes, and CIFAR-100 has 100 classes. We choose these natural image datasets to demonstrate our method since they correspond to a more complex data distribution than digit images.
107
+
108
+ ![](images/366b05cbb699c99aa3606d327554535b33b52d31fde1bc4ff9135090fda0c3f3.jpg)
109
+
110
+ ![](images/7b1477b09c70f2727e5b8c53209fcf27824e65fb1e5637f4acca6997ffaab7d5.jpg)
111
+
112
+ ![](images/11d168bee68560354c009f49fbf6e6535d6ad8d8b0dd1ee55d22261d0a7b05a9.jpg)
113
+ Inverted Dot-Product Attention Routing
114
+
115
+ Figure 4: Convergence analysis for CapsNets on CIFAR-10 with simple backbone model. Top: convergence plots for different routing mechanisms. Bottom left: classification results with respect to different routing iterations. Inverted Dot-Product Attention-A denotes our routing approach without Layer Normalization. Inverted Dot-Product Attention-B denotes our routing approach with sequential routing. Inverted Dot-Product Attention-C denotes our routing approach with activations in capsules. ∗ indicates a uniform prediction. Bottom right: memory usage and inference time for the proposed Inverted Dot-Product Attention Routing. For fairness, the numbers are benchmarked using the same 8-GPU machine with batch size 128. Note that for future comparisons, we refer the readers to an alternative implementation for our model: https://github. com/yaohungt/Capsules-Inverted-Attention-Routing/blob/master/README.md. It uses much less memory, has a significantly faster inference speed, and retains the same performance.
116
+
117
+ Comparisons with other CapsNets and CNNs: In Table 1, we report the test accuracy obtained by our model, along with other CapsNets and CNNs. Two prior CapsNets are chosen: Dynamic Routing CapsNets (Sabour et al., 2017) and EM Routing CapsNets (Hinton et al., 2018). For each CapsNet, we apply two backbone feature models: simple convolution followed by ReLU nonlinear activation and a ResNet (He et al., 2016) backbone. For CNNs, we consider a baseline CNN with 3 convolutional layers followed by 1 fully-connected classifier layer. ResNet-18 is selected as a representative of SOTA CNNs. See Appendix A.1 for detailed configurations.
118
+
119
+ First, we compare previous routing approaches against ours. In a general trend, the proposed CapsNets perform better than the Dynamic Routing CapsNets, and the Dynamic Routing CapsNets perform better than EM Routing CapsNets. The performance differs more on CIFAR-100 than on CIFAR-10. For example, with simple convolutional backbone, EM Routing CapsNet can only achieve $3 7 . 7 3 \%$ test accuracy while ours can achieve $5 7 . 3 2 \%$ . Additionally, for all CapsNets, we see improved performance when replacing a single convolutional backbone with ResNet backbone. This result is not surprising since ResNet structure has better generalizability than a single convolutional layer. For the number of parameters, ours and EM Routing CapsNets have much fewer as compared to Dynamic Routing CapsNets. The reason is due to different structures of capsule’s pose. Ours and EM Routing CapsNets have matrix-structure poses, and Dynamic Routing CapsNets have vector-structure poses. With matrix structure, weights between capsules are only $\bar { O ( d ) }$ with $d$ being pose’s dimension; with vector structure, weights are $O ( d ^ { 2 } )$ . To conclude, combining the proposed Inverted Dot-Product Attention Routing with ResNet backbone gives us both the advantages of a low number of parameters and high performance.
120
+
121
+ Second, we discuss the performance difference between CNNs and CapsNets. We see that, with a simple backbone (a single convolutional layer), it is hard for CapsNets to reach the same performance as CNNs. For instance, our routing approach can only achieve $5 7 . 3 2 \%$ test accuracy on CIFAR-100 while the baseline CNN achieves $6 2 . 3 0 \%$ . However, with a SOTA backbone structure (ResNet backbone), the proposed routing approach can reach competitive performance $( 9 5 . 1 4 \%$ on CIFAR-10) as compared to the SOTA CNN model (ResNet-18 with $9 5 . 1 1 \%$ on CIFAR-10).
122
+
123
+ Convergence Analysis: In Figure 4, top row, we analyze the convergence for CapsNets with respect to the number of routing iterations. The optimization hyperparameters are chosen optimally for each routing mechanism. For Dynamic Routing CapsNets (Sabour et al., 2017), we observe a mild performance drop when the number of iterations increases. For EM Routing CapsNets (Hinton et al., 2018), the best-performed number of iterations is 2. Increasing or decreasing this number severely hurts the performance. For our proposed routing mechanism, we find a positive correlation between performance and number of routing iterations. The performance variance is also the smallest among the three routing mechanisms. This result suggests our approach has better optimization and stable inference. However, selecting a larger iteration number may not be ideal since memory usage and inference time will also increase (shown in the bottom right in Figure 4). Note that, we observe sharp performance jitters during training when the model has not converged (especially when the number of iterations is high). This phenomenon is due to applying LayerNorm on a low-dimensional vector. The jittering is reduced when we increase the pose dimension in capsules.
124
+
125
+ <table><tr><td>Method</td><td>Pose Structure</td><td>Test Acc.</td><td># params.</td></tr><tr><td>CapsNet*</td><td>vector</td><td>83.39%</td><td>42.48M</td></tr><tr><td>CapsNet</td><td>matrix</td><td>80.59%</td><td>9.96M</td></tr><tr><td>CapsNet</td><td>vector</td><td>85.74%</td><td>42.48M</td></tr><tr><td colspan="2">Baseline CNN</td><td>79.81%</td><td>19.55M</td></tr></table>
126
+
127
+ ![](images/25bb12a5d47d05d6ed02fb39f15afb123a9d781a5b46e4a967d64cfe9a0edf25.jpg)
128
+ Figure 5: Table and convergence plot for baseline CNN and CapsNets with different pose structures. We consider the same optimizer, the same number of layers, and the same number of neurons per layer for the models. For fairness, memory usage/ inference time are benchmarked using the same 8-GPU machine with batch size 128. CapsNet∗ denotes the Dynamic routing method and CapsNet denotes our proposed Inverted Dot-Product Attention Routing method. Note that for future comparisons, we refer the readers to an alternative implementation for our model: https://github.com/yaohungt/ Capsules-Inverted-Attention-Routing/blob/master/README.md. It uses much less memory, has a significantly faster inference speed, and retains the same performance. The memory usage and inference time in this implementation now are only marginally higher than the baseline CNN.
129
+
130
+ Ablation Study: Furthermore, we inspect our routing approach with the following ablations: 1) Inverted Dot-Product Attention-A: without Layer Normalization; 2) Inverted Dot-Product AttentionB: replacing concurrent to sequential iterative routing; and 3) Inverted Dot-Product Attention-C: adding activations in capsules 2. The results are presented in Figure 4 bottom row. When removing Layer Normalization, performance dramatically drops from our routing mechanism. Notably, the prediction becomes uniform when the iteration number increases to 5. This result implies that the normalization step is crucial to the stability of our method. When replacing concurrent with sequential iterative routing, the positive correlation between performance and iteration number no longer exists. This fact happens in the Dynamic Routing CapsNet as well, which also uses sequential iterative routing. When adding activations to our capsule design, we obtain a performance deterioration. Typically, squashing activations such as sigmoids make it harder for gradients to flow, which might explain this. Discovering the best strategy to incorporate activations in capsule networks is an interesting direction for future work.
131
+
132
+ # 6 EXPERIMENTS ON DIVERSEMULTIMNIST
133
+
134
+ The goal in this section is to compare CapsNets and CNNs when they have the same number of layers and the same number of neurons per layer. Specifically, we would like to examine the difference of the representation power between the routing mechanism (in CapsNets) and the pooling operation (in CNNs). A challenging setting is considered in which objects may be overlapping with each other, and there may be a diverse number of objects in the image. To this end, we construct the DiverseMultiMNIST dataset which is extended from MNIST (LeCun et al., 1998), and it contains both single-digit and two overlapping digit images. The task will be multilabel classification, where the prediction is said to be correct if and only if the recognized digits match all the digits in the image. We plot the convergence curve when the model is trained on $2 1 M$ images from DiverseMultiMNIST. Please see Appendix B.2 for more details on the dataset and Appendix B.1 for detailed model configurations. The results are reported in Figure 5.
135
+
136
+ First, we compare our routing method against the Dynamic routing one. We observe an improved performance from the CapsNet∗ to the CapsNet $( 8 3 . 3 9 \%$ to $8 5 . 7 4 \%$ with vector-structured poses). The result suggests a better viewpoint generalization for our routing mechanism.
137
+
138
+ Second, we compare baseline CNN against our CapsNet. From the table, we see that CapsNet has better test accuracy compared to CNN. For example, the CapsNet with vector-structured poses reaches $8 5 . 7 4 \%$ test accuracy, and the baseline CNN reaches ${ \bar { 7 9 } } . 8 1 \%$ test accuracy. In our CNN implementation, we use average pooling from the last convolutional layer to its next fully-connected layer. We can see that having a routing mechanism works better than pooling. However, one may argue that the pooling operations requires no extra parameter but routing mechanism does, and hence it may not be fair to compare their performance. To address this issue, in the baseline CNN, we replace the pooling operation with a fully-connected operation. To be more precise, instead of using average pooling, we learn the entire transformation matrix from the last convolutional layer to its next fully-connected layer. This procedure can be regarded as considering pooling with learnable parameters. After doing this, the number of parameters in CNN increases to $4 2 . 4 9 M$ , and the corresponding test accuracy is $8 4 . 8 4 \%$ , which is still lower than $8 5 . 7 4 \%$ from the CapsNet. We conclude that, when recognizing overlapping and diverse number of objects, the routing mechanism has better representation power against the pooling operation.
139
+
140
+ Last, we compare CapsNet with different pose structures. The CapsNet with vector-structured poses works better than the CapsNet with matrix-structured poses $( 8 0 . 5 9 \%$ vs $8 5 . 7 4 \%$ ). However, the former requires more parameters, more memory usage, and more inference time. If we increase the number of parameters in the matrix-pose CapsNet to $4 2 M$ , its test accuracy rises to $9 1 . 1 7 \%$ . Nevertheless, the model now requires more memory usage and inference time as compared to using vector-structured poses. We conclude that more performance can be extracted from vector-structured poses but at the cost of high memory usage and inference time.
141
+
142
+ # 7 RELATED WORK
143
+
144
+ The idea of grouping a set of neurons into a capsule was first proposed in Transforming AutoEncoders (Hinton et al., 2011). The capsule represented the multi-scale recognized fragments of the input images. Given the transformation matrix, Transforming Auto-Encoders learned to discover capsules’ instantiation parameters from an affine-transformed image pair. Sabour et al. (2017) extended this idea to learn part-whole relationships in images systematically. Hinton et al. (2018) cast the routing mechanism as fitting a mixture of Gaussians. The model demonstrated an impressive ability for recognizing objects from novel viewpoints. Recently, Stacked Capsule AutoEncoders (Kosiorek et al., 2019) proposed to segment and compose the image fragments without any supervision. The work achieved SOTA results on unsupervised classification. However, despite showing promising applications by leveraging inherent structures in images, the current literature on capsule networks has only been applied on datasets of limited complexity. Our proposed new routing mechanism instead attempts to apply capsule networks to more complex data.
145
+
146
+ Our model also relates to Transformers (Vaswani et al., 2017) and Set Transformers (Lee et al., 2019), where dot-product attention is also used. In the language of capsules, a Set Transformer can be seen as a model in which a higher-level unit can choose to pay attention to $K$ lower-level units (using $K$ attention heads). Our model inverts the attention direction (lower-level units “attend” to parents), enforces exclusivity among routing to parents and does not impose any limits on how many lower-level units can be routed to any parent. Therefore, it combines the ease and parallelism of dot-product routing derived from a Transformer, with the interpretability of building a hierarchical parsing of a scene derived from capsule networks.
147
+
148
+ There are other works presenting different routing mechanisms for capsules. Wang & Liu (2018) formulated the Dynamic routing (Sabour et al., 2017) as an optimization problem consisting of a clustering loss and a KL regularization term. Zhang et al. (2018) generalized the routing method within the framework of weighted kernel density estimation. Li et al. (2018) approximated the routing process with two branches and minimized the distributions between capsules layers by an optimal transport divergence constraint. Phaye et al. (2018) replaced standard convolutional structures before capsules layers by densely connected convolutions. It is worth noting that this work was the first to combine SOTA CNN backbones with capsules layers. Rajasegaran et al. (2019) proposed DeepCaps by stacking $1 0 +$ capsules layers. It achieved $9 2 . 7 4 \%$ test accuracy on CIFAR-10, which was the previous best for capsule networks. Instead of looking for agreement between capsules layers, Choi et al. (2019) proposed to learn deterministic attention scores only from lower-level capsules. Nevertheless, without agreement, their best-performed model achieved only $8 8 . 6 1 \%$ test accuracy on CIFAR-10. In contrast to these prior work, we present a combination of inverted dotproduct attention routing, layer normalization, and concurrent routing. To the best of our knowledge, we are the first to show that capsule networks can achieve comparable performance against SOTA CNNs. In particular, we achieve $9 5 . 1 4 \%$ test accuracy for CIFAR-10 and $7 8 . 0 2 \%$ for CIFAR-100.
149
+
150
+ # 8 CONCLUSION AND FUTURE WORK
151
+
152
+ In this work, we propose a novel Inverted Dot-Product Attention Routing algorithm for Capsule networks. Our method directly determines the routing probability by the agreements between parent and child capsules. Routing algorithms from prior work require child capsules to be explained by parent capsules. By removing this constraint, we are able to achieve competitive performance against SOTA CNN architectures on CIFAR-10 and CIFAR-100 with the use of a low number of parameters. We believe that it is no longer impractical to apply capsule networks to datasets with complex data distribution. Two future directions can be extended from this paper:
153
+
154
+ • In the experiments, we show how capsules layers can be combined with SOTA CNN backbones. The optimal combinations between SOTA CNN structures and capsules layers may be the key to scale up to a much larger dataset such as ImageNet.
155
+ The proposed concurrent routing is as a parallel-in-time and weight-tied inference process. The strong connection with Deep Equilibrium Models (Bai et al., 2019) can potentially lead us to infinite-iteration routing.
156
+
157
+ # REFERENCES
158
+
159
+ Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016.
160
+ Shaojie Bai, J. Zico Kolter, and Vladlen Koltun. Deep equilibrium models. In Neural Information Processing Systems (NeurIPS), 2019.
161
+ Jaewoong Choi, Hyun Seo, Suee Im, and Myungju Kang. Attention routing between capsules. arXiv preprint arXiv:1907.01750, 2019.
162
+ 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.
163
+ Geoffrey E Hinton, Alex Krizhevsky, and Sida D Wang. Transforming auto-encoders. In International Conference on Artificial Neural Networks, pp. 44–51. Springer, 2011.
164
+ Geoffrey E Hinton, Sara Sabour, and Nicholas Frosst. Matrix capsules with em routing. 2018.
165
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
166
+ Adam R Kosiorek, Sara Sabour, Yee Whye Teh, and Geoffrey E Hinton. Stacked capsule autoencoders. arXiv preprint arXiv:1906.06818, 2019.
167
+ Alex Krizhevsky et al. Learning multiple layers of features from tiny images. Technical report, Citeseer, 2009.
168
+ Yann LeCun, Leon Bottou, Yoshua Bengio, Patrick Haffner, et al. Gradient-based learning applied ´ to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
169
+ Juho Lee, Yoonho Lee, Jungtaek Kim, Adam Kosiorek, Seungjin Choi, and Yee Whye Teh. Set transformer: A framework for attention-based permutation-invariant neural networks. In Proceedings of the 36th International Conference on Machine Learning, volume 97 of Proceedings of Machine Learning Research, pp. 3744–3753, 2019.
170
+ Hongyang Li, Xiaoyang Guo, Bo DaiWanli Ouyang, and Xiaogang Wang. Neural network encapsulation. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 252–267, 2018.
171
+ Sai Samarth R Phaye, Apoorva Sikka, Abhinav Dhall, and Deepti Bathula. Dense and diverse capsule networks: Making the capsules learn better. arXiv preprint arXiv:1805.04001, 2018.
172
+
173
+ Jathushan Rajasegaran, Vinoj Jayasundara, Sandaru Jayasekara, Hirunima Jayasekara, Suranga Seneviratne, and Ranga Rodrigo. Deepcaps: Going deeper with capsule networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 10725–10733, 2019.
174
+
175
+ Sara Sabour, Nicholas Frosst, and Geoffrey E Hinton. Dynamic routing between capsules. In Advances in neural information processing systems, pp. 3856–3866, 2017.
176
+
177
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in neural information processing systems, pp. 5998–6008, 2017.
178
+
179
+ Dilin Wang and Qiang Liu. An optimization view on dynamic routing between capsules. 2018.
180
+
181
+ Suofei Zhang, Quan Zhou, and Xiaofu Wu. Fast dynamic routing based on weighted kernel density estimation. In International Symposium on Artificial Intelligence and Robotics, pp. 301–309. Springer, 2018.
182
+
183
+ # A MODEL CONFIGURATIONS FOR CIFAR-10/CIFAR-100
184
+
185
+ # A.1 MODEL SPECIFICATIONS
186
+
187
+ The configuration choices of Dynamic Routing CapsNets and EM Routing CapsNets are followed by prior work (Sabour et al., 2017; Hinton et al., 2018). We empirically find their configurations perform the best for their routing mechanisms (instead of applying our network configurations to their routing mechanisms). The optimizers are chosen to reach the best performance for all models. We list the model specifications in Table 2, 3, 4, 5, 6, 7, 8, and 9.
188
+
189
+ We only show the specifications for CapsNets with a simple convolutional backbone. When considering a ResNet backbone, two modifications are performed. First, we replace the simple feature backbone with ResNet feature backbone. Then, the input dimension of the weights after the backbone is set as 128. A ResNet backbone contains a $3 \times 3$ convolutional layer (output 64-dim.), three 64-dim. residual building block (He et al., 2016) with stride 1, and four 128-dim. residual building block with stride 2. The ResNet backbone returns a $1 6 \times 1 6 \times 1 2 8$ tensor.
190
+
191
+ For the optimizers, we use stochastic gradient descent with learning rate 0.1 for our proposed method, baseline CNN, and ResNet-18 (He et al., 2016). We use Adam (Kingma & Ba, 2014) with learning rate 0.001 for Dynamic Routing CapsNets and Adam with learning rate 0.01 for EM Routing CapsNets. We decrease the learning rate by 10 times when the model trained on 150 epochs and 250 epochs, and there are 350 epochs in total.
192
+
193
+ # A.2 DATA AUGMENTATIONS
194
+
195
+ We consider the same data augmentation for all networks. During training, we first pad four zerovalue pixels to each image and randomly crop the image to the size $3 2 \times 3 2$ . Then, we horizontally flip the image with probability 0.5. During evaluation, we do not perform data augmentation. All the model is trained on a 8-GPU machine with batch size 128.
196
+
197
+ # B MODEL CONFIGURATIONS FOR DIVERSE MULTIMNIST
198
+
199
+ # B.1 MODEL SPECIFICATIONS
200
+
201
+ To fairly compare CNNs and CapsNets, we fix the number of layers and the number of neurons per layer in the models. These models consider the design: 36x36 image $ 1 8 \mathrm { x } 1 8 \mathrm { x } 1 0 2 4$ neurons $\to 8 \mathrm { x } 8 \mathrm { x } 1 0 2 4$ neurons $ 6 \mathrm { x } 6 \mathrm { x } 1 0 2 4$ neurons $ 6 4 0$ neurons $ 1 0$ class logits. The configurations are presented in Table 10, 11, and 12. We also fix the optimizers across all the models. We use stochastic gradient descent with learning rate 0.1 and decay the learning rate by 10 times when the models trained on 150 steps and 250 steps. One step corresponds to $6 0 , 0 0 0$ training samples, and we train the models with a total of 350 steps.
202
+
203
+ # B.2 DATASET CONSTRUCTION
204
+
205
+ Diverse MultiMNIST contains both single-digit and overlapping-digit images. We generate images on the fly and plot the test accuracy for training models over $2 1 M$ $( 2 1 M = 3 5 0 ( \mathrm { s t e p s } ) \ \times$ 60, 000(images)) generated images. We also generate the test images, and for each evaluation step, there are $1 0 , 0 0 0$ test images. Note that we make sure the training and the test images are from the disjoint set. In the following, we shall present how we generate the images. We set the probability of generating a single-digit image as $\frac { 1 } { 6 }$ and the probability of generating an overlapping-digit image as $\frac { 5 } { 6 }$ .
206
+
207
+ The single-digit image in DiverseMultiMNIST training/ test set is generated by shifting digits in MNIST (LeCun et al., 1998) training/ test set. Each digit is shifted up to 4 pixels in each direction and results in $3 6 \times 3 6$ image.
208
+
209
+ Following Sabour et al. (2017), we generate overlapping-digit images in DiverseMultiMNIST training/ test set by overlaying two digits from the same training/ test set of MNIST. Two digits are selected from different classes. Before overlaying the digits, we shift the digits in the same way which we shift for the digit in a single-digit image. After overlapping, the generated image has size $3 6 \times 3 6$ .
210
+
211
+ We consider no data augmentation for both training and evaluation. All the model is trained on a 8-GPU machine with batch size 128.
212
+
213
+ Table 2: Baseline CNN for CIFAR-10.
214
+
215
+ <table><tr><td>Operation</td><td>Output Size</td></tr><tr><td>input_dim=3,output_dim=1024, 3x3 conv, stride=2, padding=1 ReLU</td><td>16x16x1024</td></tr><tr><td>input_dim=1024,output_dim=1024,3x3 conv, stride=2, padding=1 ReLU+Batch Norm</td><td>8x8x1024</td></tr><tr><td>2x2 average pooling, padding=0</td><td>4x4x1024</td></tr><tr><td>input_dim=1024,output_dim=1024,3x3 conv,stride=2, padding=1 ReLU +Batch Norm</td><td>2x2x1024</td></tr><tr><td>2x2 average pooling, padding=0</td><td>1x1x1024</td></tr><tr><td>Flatten</td><td>1024</td></tr><tr><td>input_dim=1024,output_dim=10, linear</td><td>10</td></tr></table>
216
+
217
+ Table 3: Baseline CNN for CIFAR-100.
218
+
219
+ <table><tr><td>Operation</td><td>Output Size</td></tr><tr><td>input_dim=3,output_dim=1024, 3x3 conv, stride=2, padding=1 ReLU</td><td>16x16x1024</td></tr><tr><td>input_dim=1024,output_dim=1024,3x3 conv, stride=2, padding=1 ReLU +Batch Norm</td><td>8x8x1024</td></tr><tr><td>2x2 average pooling, padding=0</td><td>4x4x1024</td></tr><tr><td>input_dim=1024,output_dim=1024, 3x3 conv,stride=2, padding=1 ReLU+Batch Norm</td><td>2x2x1024</td></tr><tr><td>2x2 average pooling, padding=0</td><td>1x1x1024</td></tr><tr><td>Flatten</td><td>1024</td></tr><tr><td>input_dim=1024,output_dim=100,linear</td><td>100</td></tr></table>
220
+
221
+ Table 4: Dynamic Routing with Simple Backbone for CIFAR-10.
222
+
223
+ <table><tr><td>Operation</td><td>Output Size</td></tr><tr><td>input_dim=3,output_dim=256, 9x9 conv, stride=1, padding=0 ReLU</td><td>24x24x256</td></tr><tr><td>input_dim=256, output_dim=256, 9x9 conv, stride=2, padding=0</td><td>8x8x256</td></tr><tr><td>Capsules reshape Squash</td><td>8x8x32x8</td></tr><tr><td>Capsules flatten</td><td>2048x8</td></tr><tr><td>Linear Dynamic Routing to 10 16-dim. capsules Squash</td><td>10x16</td></tr></table>
224
+
225
+ Table 5: Dynamic Routing with Simple Backbone for CIFAR-100.
226
+
227
+ <table><tr><td>Operation</td><td>Output Size</td></tr><tr><td>input_dim=3,output_dim=256, 9x9 conv, stride=1, padding=0 ReLU</td><td>24x24x256</td></tr><tr><td>input_dim=256,output_dim=256, 9x9 conv, stride=2, padding=0</td><td>8x8x256</td></tr><tr><td>Capsules reshape Squash</td><td>8x8x32x8</td></tr><tr><td>Capsules flatten</td><td>2048x8</td></tr><tr><td>Linear Dynamic Routing to 100 16-dim. capsules Squash</td><td>100x16</td></tr></table>
228
+
229
+ Table 6: EM Routing with Simple Backbone for CIFAR-10.
230
+
231
+ <table><tr><td>Operation</td><td>Output Size</td></tr><tr><td>input_dim=3,output_dim=256, 4x4 conv, stride=2, padding=1 Batch Norm +ReLU input_dim=256,output_dim=512,1x1 conv, stride=1, padding=0</td><td>16x16x256</td></tr><tr><td>&amp; input_dim=256,output_dim=32,1x1 conv, stride=1,padding=0 Sigmoid</td><td>16x16x512 &amp; 16x16x32</td></tr><tr><td>Capsules reshape (only for poses)</td><td>16x16x32x4x4 &amp; 16x16x32</td></tr><tr><td>Conv EM Routing to 32 4x4-dim. capsules, 3x3 conv, stride=2</td><td>7x7x32x4x4 &amp; 7x7x32</td></tr><tr><td>Conv EM Routing to 32 4x4-dim. capsules, 3x3 conv,stride=1</td><td>5x5x32x4x4 &amp; 5x5x32</td></tr><tr><td>Capsules flatten</td><td>800x4x4 &amp; 800</td></tr><tr><td>Linear EM Routing to 10 4x4-dim. capsules</td><td>10x4x4 &amp; 10</td></tr></table>
232
+
233
+ Table 7: EM Routing with Simple Backbone for CIFAR-100.
234
+
235
+ <table><tr><td>Operation</td><td>Output Size</td></tr><tr><td>input_dim=3, output_dim=256, 4x4 conv, stride=2, padding=1 Batch Norm+ReLU</td><td>16x16x256</td></tr><tr><td>input_dim=256,output_dim=512,1x1 conv, stride=1, padding=0 &amp; input_dim=256,output_dim=32,1x1 conv, stride=1,padding=0 Sigmoid</td><td>16x16x512 &amp; 16x16x32</td></tr><tr><td>Capsules reshape (only for poses)</td><td>16x16x32x4x4 &amp; 16x16x32</td></tr><tr><td>Conv EM Routing to 32 4x4-dim. capsules,3x3 conv, stride=2</td><td>7x7x32x4x4 &amp; 7x7x32</td></tr><tr><td>Conv EM Routing to 32 4x4-dim. capsules, 3x3 conv, stride=1</td><td>5x5x32x4x4 &amp; 5x5x32</td></tr><tr><td>Capsules flatten</td><td>800x4x4 &amp; 800</td></tr><tr><td>Linear EM Routing to 100 4x4-dim. capsules</td><td>100x4x4 &amp; 100</td></tr></table>
236
+
237
+ Table 8: Proposed Inverted Dot-Product Attention Routing with Simple Backbone for CIFAR-10.
238
+
239
+ <table><tr><td>Operation</td><td>Output Size</td></tr><tr><td>input_dim=3, output_dim=256,3x3 conv, stride=2, padding=1 ReLU</td><td>16x16x256</td></tr><tr><td>input_dim=256,output_dim=512,1x1 conv, stride=1, padding=0 Layer Norm</td><td>16x16x512</td></tr><tr><td>Capsules reshape</td><td>16x16x32x4x4</td></tr><tr><td>Conv Inverted Dot-Product Attention Routing to 32 4x4-dim. capsules,3x3 conv, stride=2 Layer Norm</td><td>7x7x32x4x4</td></tr><tr><td>Conv Inverted Dot-Product Attention Routing to 32 4x4-dim. capsules, 3x3 conv, stride=1 Layer Norm</td><td>5x5x32x4x4</td></tr><tr><td>Capsules flatten</td><td>800x4x4</td></tr><tr><td>Linear Inverted Dot-Product Attention Routing to 10 4x4-dim. capsules Layer Norm</td><td>10x4x4</td></tr><tr><td>Reshape</td><td>10x16</td></tr><tr><td>input_dim=16,output_dim=1, linear</td><td>10x1</td></tr><tr><td>Reshape</td><td>10</td></tr></table>
240
+
241
+ Table 9: Proposed Inverted Dot-Product Attention Routing with Simple Backbone for CIFAR-100.
242
+
243
+ <table><tr><td>Operation</td><td>Output Size</td></tr><tr><td>input_dim=3,output_dim=128, 3x3 conv, stride=2, padding=1 ReLU</td><td>16x16x128</td></tr><tr><td>input_dim=128,output_dim=1152,1x1 conv,stride=1, padding=0 Layer Norm</td><td>16x16x1152</td></tr><tr><td>Capsules reshape</td><td>16x16x32x6x6</td></tr><tr><td>Conv Inverted Dot-Product Attention Routing to 32 6x6-dim. capsules,3x3 conv, stride=2 Layer Norm</td><td>7x7x32x6x6</td></tr><tr><td>Conv Inverted Dot-Product Attention Routing to 32 6x6-dim. capsules, 3x3 conv, stride=1 Layer Norm</td><td>5x5x32x6x6</td></tr><tr><td>Capsules flatten Linear Inverted Dot-Product Attention Routing to 20 6x6-dim. capsules</td><td>800x6x6</td></tr><tr><td>Layer Norm</td><td>20x6x6</td></tr><tr><td>Linear Inverted Dot-Product Attention Routing to 100 6x6-dim. capsules Layer Norm</td><td>100x6x6</td></tr><tr><td>Reshape</td><td>100x36</td></tr><tr><td>input_dim=36, output_dim=1,linear</td><td>100x1</td></tr><tr><td>Reshape</td><td>100</td></tr></table>
244
+
245
+ Table 10: CapsNet with matrix-structured poses for DiverseMultiMNIST.
246
+
247
+ <table><tr><td>Operation</td><td>Output Size</td></tr><tr><td>input_dim=3,output_dim=1024,3x3 conv, stride=2, padding=1 ReLU</td><td>18x18x1024</td></tr><tr><td>input_dim=1024,output_dim=1024,3x3 conv, stride=2, padding=0 Layer Norm</td><td>8x8x1024</td></tr><tr><td>Capsules reshape</td><td>8x8x16x8x8</td></tr><tr><td>Conv Inverted Dot-Product Attention Routing to 16 8x8-dim. capsules,3x3 conv, stride=1 Layer Norm</td><td>6x6x16x8x8</td></tr><tr><td>Capsules flatten</td><td>576x8x8</td></tr><tr><td>Linear Inverted Dot-Product Attention Routing to 10 8x8-dim. capsules Layer Norm</td><td>10x8x8</td></tr><tr><td>Reshape</td><td>10x64</td></tr><tr><td>input_dim=64,output_dim=1, linear Sigmoid</td><td>10x1</td></tr><tr><td>Reshape</td><td>10</td></tr></table>
248
+
249
+ Table 11: CapsNet with vector-structured poses for DiverseMultiMNIST.
250
+
251
+ <table><tr><td>Operation</td><td>Output Size</td></tr><tr><td>input_dim=3,output_dim=1024, 3x3 conv, stride=2, padding=1 ReLU</td><td>18x18x1024</td></tr><tr><td>input_dim=1024,output_dim=1024,3x3 conv, stride=2, padding=0 Layer Norm</td><td>8x8x1024</td></tr><tr><td>Capsules reshape</td><td>8x8x16x64</td></tr><tr><td>Conv Inverted Dot-Product Attention Routing to 16 64-dim. capsules,3x3 conv, stride=1 Layer Norm</td><td>6x6x16x64</td></tr><tr><td>Capsules flatten</td><td>576x64</td></tr><tr><td>Linear Inverted Dot-Product Attention Routing to 10 8x8-dim. capsules Layer Norm</td><td>10x64</td></tr><tr><td>input_dim=64,output_dim=1, linear Sigmoid</td><td>10x1</td></tr><tr><td>Reshape</td><td>10</td></tr></table>
252
+
253
+ Table 12: Baseline CNN for DiverseMultiMNIST.
254
+
255
+ <table><tr><td>Operation</td><td>Output Size</td></tr><tr><td>input_dim=3,output_dim=1024, 3x3 conv, stride=2, padding=1 ReLU</td><td>18x18x1024</td></tr><tr><td>input_dim=1024,output_dim=1024,3x3 conv, stride=2,padding=0 ReLU+Batch Norm</td><td>8x8x1024</td></tr><tr><td>input_dim=1024,output_dim=1024, 3x3 conv, stride=1, padding=0 ReLU+Batch Norm</td><td>6x6x1024</td></tr><tr><td>input_dim=1024,output_dim=640, linear</td><td>6x6x640</td></tr><tr><td>6x6 average pooling, padding=0</td><td>1x1x640</td></tr><tr><td>Flatten</td><td>640</td></tr><tr><td>input_dim=640,output_dim=10,linear Sigmoid</td><td>10</td></tr></table>
md/train/HkGSniC9FQ/HkGSniC9FQ.md ADDED
@@ -0,0 +1,432 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AN ANALYSIS OF COMPOSITE NEURAL NETWORK PERFORMANCE FROM FUNCTION COMPOSITION PERSPECTIVE
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ This work investigates the performance of a composite neural network, which is composed of pre-trained neural network models and non-instantiated neural network models, connected to form a rooted directed graph. A pre-trained neural network model is generally a well trained neural network model targeted for a specific function. The advantages of adopting such a pre-trained model in a composite neural network are two folds. One is to benefit from other’s intelligence and diligence, and the other is saving the efforts in data preparation and resources and time in training. However, the overall performance of composite neural network is still not clear. In this work, we prove that a composite neural network, with high probability, performs better than any of its pre-trained components under certain assumptions. In addition, if an extra pre-trained component is added to a composite network, with high probability the overall performance will be improved. In the empirical evaluations, distinctively different applications support the above findings.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Deep learning has been a great success in dealing with natural signals, e.g., images and voices, as well as artifact signals, e.g., nature language, while it is still in the early stage in handling sophisticated social and natural applications shaped by very diverse factors (e.g., stock market prediction), or resulted from complicated processes (e.g., pollution level prediction). One of distinctive features of the complicated applications is their applicable data sources are boundless. Consequently, their solutions need frequent revisions. Although neural networks can approximate arbitrary functions as close as possible (Hornik, 1991), the major reason for not existing such competent neural networks for those complicated applications is their problems are hardly fully understood and their applicable data sources cannot be identified all at once. By far the best practice is the developers pick a seemly neural network with available data to hope for the best. The apparent drawbacks, besides the performance, are the lack of flexibility in new data source emergence, better problem decomposition, and the opportunity of employing proven efforts from others. On the other hand, some adopts a composition of several neural network models, based on function composition using domain knowledge.
12
+
13
+ An emerging trend of deep learning solution development is to employ well crafted pre-trained neural networks (i.e., neural network models with instantiated weights), especially used as a component in a composited neural network model. Most popular pre-trained neural network models are well fine tuned with adequate training data, and made available to the public, either free or as a commercial product. During the training phase of composite neural network, the weights of pre-trained models are frozen to maintain its good quality and save the training time, while the weights of their outgoing edges are trainable. In some cases as in the transfer learning, the weights of pre-trained neural network are used as initial values in the training phase of composite neural network. It is intuitive that a composite neural network should perform better than any of its components. The ensemble learning (Freund & Schapire, 1997; Zhou, 2012) and the transfer learning (Galanti et al., 2016) have great success and are popular when pre-trained models are considered. However, the following example shows some aspects missed by these two methods, and requests for more complicated composite function.
14
+
15
+ Example 1. Assume there is a set of locations indexed as $X \ = \ \{ ( 0 , 0 ) , ( 0 , 1 ) , ( 1 , 0 ) , ( 1 , 0 ) \}$ with the corresponding values ${ Y } = ( 0 , 1 , 1 , 0 )$ . Obviously, the observed function is the XOR (Goodfellow et al., 2016). Now consider three models: $f _ { 1 } ( x _ { 1 } , x _ { 2 } ) : = x _ { 1 }$ , $f _ { 2 } ( x _ { 1 } , x _ { 2 } ) : = x _ { 2 }$ , and $f _ { 3 } ( x _ { 1 } , x _ { 2 } ) : = x _ { 1 } x _ { 2 }$ . Their corresponding output vectors are $( 0 , 0 , 1 , 1 ) , ( 0 , 1 , 0 , 1 ) , ( 0 , 0 , 0 , 1 )$ with bit-wise accuracy $5 0 \%$ , $5 0 \%$ , $2 5 \%$ , respectively. This means that the AdaBoosting algorithm will exclude the tran $f _ { 1 }$ and r lear $f _ { 2 }$ inng, e ensemble since their coefficients are is fine-tuned by applying the gradient $\begin{array} { r } \frac { 1 } { 2 } \ln { \frac { 1 - 5 0 \% } { 5 0 \% } } = 0 \end{array}$ . On the other hand, in with respect to L2 loss $f _ { 3 }$
16
+ on $w f _ { 3 } = w x _ { 1 } x _ { 2 }$ to transfer the source task distribution to that of the target task. The result comes to $w = 0$ , and d wi $f _ { 3 }$ is excluded. Now consider respect to the L2 loss. Th $g _ { 1 } ( x _ { 1 } , x _ { 2 } ) = \alpha _ { 1 } f _ { 1 } + \alpha _ { 2 } f _ { 2 }$ and apply t, with loss back-propagation. If further define $\alpha _ { 1 } = \alpha _ { 2 } = \textstyle { \frac { 1 } { 3 } }$ $\textstyle { \frac { 4 } { 3 } }$
17
+ $g _ { 2 } ( x _ { 1 } , x _ { 2 } ) = w _ { 1 } g _ { 1 } + w _ { 2 } f _ { 3 }$ , the back-propagation yields $g _ { 2 } = 3 g _ { 1 } - 2 f _ { 3 } = x _ { 1 } + \bar { x } _ { 2 } - 2 x _ { 1 } x _ { 2 }$ output $( 0 , 1 , 1 , 0 )$ . The final $g _ { 2 }$ computes $Y$ with loss 0. This example shows the power of composite function.
18
+
19
+ Composite Neural Network. In the transfer learning, how to overcome the negative transfer (a phenomenon of a pre-trained model has negative impact on the target task) is an important issue (Seah et al., 2013). In the ensemble learning, it is well known that the adding more pre-trained models, it is not always true to have the better accuracy of the ensemble (Zhou et al., 2002). Furthermore, Opitz & Maclin (1999) pointed that the ensemble by boosting having less accuracy than a single pre-trained model often happens for neural networks. In the unsupervised learning context, some experimental research concludes that although layer-wise pre-training can be significantly helpful, on average it is slightly harmful (Goodfellow et al., 2016). These empirical evidences suggest that in spite of the success of the ensemble learning and the transfer learning, the conditions that composite neural network can perform better is unclear, especially in the deep neural networks training process. The topology of a composite neural network can be represented as a rooted directed graph. For instance, an ensemble learning can be represented as 1-level graph, while a composite neural network with several pre-trained models that each is designed to solve a certain problem corresponds to a more complicated graph. It is desired to discover a mathematical theory, in addition to employing domain knowledge, to construct a composite neural network with guaranteed overall performance. In this work, we investigate the mathematical theory to ensure the overall performance of a composite neural network is better than any a pre-trained component, regardless the way of composition, to allow deep learning application developer great freedom in constructing a high performance composite neural network.
20
+
21
+ Contributions. In this work, we proved that a composite neural network with high probability performs better than any of its pre-trained components under certain assumptions. In addition, if extra pre-trained component is added into a composite network, with high probability the overall performance will be improved. In the empirical evaluations, distinctively different applications support the above findings.
22
+
23
+ # 2 PRELIMINARIES
24
+
25
+ In this Section, we introduce some notations and definitions about composite neural network. Parameters $N , K , d , d _ { j } ,$ $d _ { j _ { 1 } }$ , and $d _ { j _ { 2 } }$ are positive integers. Denote $\{ 1 , . . . , K \}$ as $[ K ]$ and $[ K ] \cup \{ 0 \}$ as $[ K ] ^ { + }$ . Let $\sigma : \mathbb { R } \mathbb { R }$ be a differentiable activation function, such as the Logistic function $\sigma ( \acute { z } ) \dot { = } 1 / ( 1 + e ^ { - z } )$ and the hyperbolic tangent $\sigma ( z ) = ( e ^ { z } - e ^ { - z } ) / ( e ^ { z } + e ^ { - z } )$ . For simplicity of notation, we sometimes abuse $\sigma$ as a vector value function. A typical one hidden layer neural network can be formally presented as $\begin{array} { r } { w _ { 1 , 1 } \sigma \left( \sum _ { i = 1 } ^ { d } w _ { 0 , i } \mathbf { x } _ { i } + w _ { 0 , 0 } \right) + w _ { 1 , 0 } } \end{array}$ .We abbreviate it as $f _ { \sigma , { \bf W } } ( { \bf x } )$ , where $\mathbf { W }$ is the matrix defined $) \mathsf { y w } _ { 1 , 1 } , w _ { 1 , 0 } , . . . , w _ { 0 , 1 } , w _ { 0 , 0 }$ . Recursively applying this representation can obtain the neural network with more hidden layers. If there is no ambiguity on the activation function, then it can be skipped as $f _ { \mathbf { W } } ( \mathbf { x } )$ . Now assume a set of neural networks $\{ f _ { \mathbf { W } _ { j } } ( \mathbf { x } _ { j } ) \} _ { j = 1 } ^ { K }$ is given, where $\mathbf { W } _ { j }$ is the real number matrix defining the neural network $f _ { \mathbf { W } _ { j } } : \mathbb { R } ^ { d _ { j _ { 1 } } \times d _ { j _ { 2 } } } \mathbb { R } ^ { \bar { d _ { j } } }$ , and $\mathbf { x } _ { j } \in \mathbb { R } ^ { d _ { j _ { 1 } } \times d _ { j _ { 2 } } }$ $d _ { j } , d _ { j _ { 1 } }$ and $d _ { j _ { 2 } }$ is the input matrix of the can be different. For each th neural network. For different $j \in [ K ]$ , let $D _ { j } = \{ ( \mathbf { x } _ { j } ^ { ( i ) } , \mathbf { y } _ { j } ^ { ( i ) } ) \in \mathbb { R } ^ { ( d _ { j _ { 1 } } \times d _ { j _ { 2 } } ) \times d _ { j } } \} _ { i = 1 } ^ { N }$ $f _ { \mathbf { W } _ { j } }$ , the corresponding be a set of labeled data (for the $j$ th neural network). For each $i \in [ N ]$ , let $\mathbf { x } ^ { ( i ) } = ( \mathbf { x } _ { 1 } ^ { ( i ) } , \ldots , \mathbf { x } _ { K } ^ { ( i ) } )$ $\mathbf { y } ^ { ( i ) } = ( \mathbf { y } _ { 1 } ^ { ( i ) } , \ldots , \mathbf { y } _ { K } ^ { ( i ) } )$ , and $D = \{ ( \mathbf { x } ^ { ( i ) } , \mathbf { y } ^ { ( i ) } ) \} _ { i = 1 } ^ { N }$ .
26
+
27
+ For a pre-trained model (component), we mean $\mathbf { W } _ { j }$ is fixed after its training process, and then we denote $f _ { \mathbf { W } _ { j } }$ as $f _ { j }$ for simplicity. On the other hand, a component $f _ { \mathbf { W } _ { j } }$ is non-instantiated means $\mathbf { W } _ { j }$ is still free. A deep feedforward neural network is a hierarchical acyclic graph, i.e. a directed tree. In this viewpoint, a feedforward neural network can be presented as a series of function compositions. For given $\{ f _ { \mathbf { W } _ { j } } ( \mathbf { x } _ { j } ) \} _ { j = 1 } ^ { K }$ , we assume $\theta _ { j } \in \mathbb { R } ^ { d _ { j } }$ , $j \in [ K ]$ , which make the product $\theta _ { j } f _ { \mathbf { W } _ { j } } ( \mathbf { x } _ { j } )$ is well-defined. Denote $f _ { 0 }$ as the constant function 1, then the liner combination with a bias is defined as as $\begin{array} { r } { \Theta ( f _ { 1 } , . . . , f _ { K } ) = \sum _ { j \in [ K ] ^ { + } } \theta _ { j } f _ { j } ( { \bf x } _ { j } ) } \end{array}$ . Hence, an $L$ layers of neural network can be denoted as $\Theta _ { ( L ) } \circ \sigma \circ \cdot \cdot \cdot \circ \Theta _ { ( 0 ) } \left( \mathbf { x } \right)$ . A composite neural network defined by components $f _ { \mathbf { W } _ { i } } ( \mathbf { x } _ { j } )$ can be designed as an directed tree. For instance, a composite neural network $\sigma _ { 2 } ( \bar { \theta } _ { 1 , 0 } + \theta _ { 1 , 1 } f _ { 4 } ^ { ' } ( \mathbf { x } _ { 4 } ^ { * } ) + \theta _ { 1 , 2 } \sigma _ { 1 } ( \bar { \theta _ { 0 , 0 } } + \theta _ { 0 , 1 } f _ { 1 } ( \mathbf { x } _ { 1 } ) + \theta _ { 0 , 2 } f _ { \mathbf { W } _ { 2 } } ( \mathbf { x } _ { 2 } ) + \theta _ { 0 , 3 } f _ { 3 } ( \mathbf { x } _ { 3 } ^ { - } ) )$ ) can be denoted as $\sigma _ { 2 } \circ \Theta _ { 1 } \left( f _ { 4 } , \sigma _ { 1 } \circ \Theta _ { 0 } ( f _ { 1 } , f _ { \mathbf { W } _ { 2 } } , f _ { 3 } ) \right)$ , where $f _ { 1 }$ and $f _ { 3 }$ are pre-trained and $f _ { \mathbf { W } _ { 2 } }$ is non-instantiated. Note that in this work $D _ { j }$ is the default training data of component $f _ { j }$ of composite neural network, but $D _ { j }$ can be different from the training data deciding the frozen weights in the pre-trained $f _ { j }$ .
28
+
29
+ Let $\langle \vec { a } , \vec { b } \rangle$ be the standard inner product of $\vec { a }$ and $\vec { b }$ , and $| | \cdot | |$ be the corresponding norm. For a composite neural network, the training algorithm is the gradient descent back-propagation algorithm and the loss function is the $L _ { 2 }$ -norm of the difference vector. In particular, for a composite neural network $g _ { \vec { \theta } }$ the total loss on the data set $D$ is
30
+
31
+ $$
32
+ L _ { \vec { \theta } } \left( \mathbf { x } ; g _ { \vec { \theta } } \right) = \langle \vec { g } _ { \vec { \theta } } \left( \mathbf { x } \right) - \vec { y } , \vec { g } _ { \vec { \theta } } \left( \mathbf { x } \right) - \vec { y } \rangle = | | \vec { g } _ { \vec { \theta } } \left( \mathbf { x } \right) - \vec { y } | | ^ { 2 }
33
+ $$
34
+
35
+ This in fact is $\begin{array} { r } { \sum _ { i = 1 } ^ { N } \left( g ( \mathbf { x } ^ { ( i ) } ) - \mathbf { y } ^ { ( i ) } \right) ^ { 2 } } \end{array}$ . By the definition of $g _ { \vec { \theta } } ( \cdot )$ , this total loss in fact depends on the given data $\mathbf { x }$ , the components defined by $\{ \Theta _ { j } \} _ { j = 1 } ^ { K }$ , the output activation $\sigma$ , and the weight vector $\vec { w }$ . Similarly, let $L ( f _ { j } ( \mathbf { x } _ { j } ) )$ be the loss function of a single component $f _ { i }$ . Our goal is to find a feasible $\vec { \theta }$ s.t. $L _ { \vec { \theta } } ( \mathbf { x } ; g ) < \mathrm { m i n } _ { j \in [ K ] } L ( f _ { j } ( \mathbf { x } _ { j } ) )$ .
36
+
37
+ # 3 PROBLEM SETTINGS AND RESULTS OVERVIEW
38
+
39
+ The problems considered in this work are as follows:
40
+
41
+ P1. What are the conditions that the pre-trained components must satisfy so that them can strictly improve the accuracy of the whole composition? P2. Will more pre-trained components improve the accuracy of the whole composition?
42
+
43
+ Let $\vec { f } _ { j }$ be the output vector of the $j$ th pre-trained component, and $\boldsymbol { B } _ { K }$ be the set of unit vectors in $\mathbb { R } ^ { K }$
44
+
45
+ A1. Linearly Independent components (LIC) Assumption: $\forall t \in [ K ] , \nexists \{ \beta _ { j } \} \subset \mathbb { R }$ , s.t. $\begin{array} { r } { \vec { f } _ { t } = \sum _ { j \in [ K ] \backslash \{ t \} } \beta _ { j } \vec { f } _ { j } } \end{array}$ .
46
+ A2. No Perfect component (NPC) Assumption: $\begin{array} { r } { \operatorname* { m i n } _ { j \in [ K ] } \left\{ \sum _ { i \in [ N ] } f _ { j } ( \mathbf { x } _ { j } ^ { ( i ) } ) - \mathbf { y } ^ { ( i ) } \right\} > \epsilon ^ { * } } \end{array}$ , where $\epsilon ^ { * } > 0$ is constant.
47
+
48
+ Our results are as follows:
49
+
50
+ Theorem 1. Assume the set of components $\{ f _ { j } ( \mathbf { x } _ { j } ) \} _ { j = 1 } ^ { K }$ satisfies LIC. Let g be $\Theta ( f _ { 1 } , . . . , f _ { K } )$ . With probability at least $1 - { \frac { K } { \pi e ^ { N } } }$ , there is a vector $\vec { \theta } \in \mathbb { R } ^ { K } \setminus B _ { K }$ s.t. $\begin{array} { r } { L _ { \vec { \theta } } ( \mathbf { x } ; g ) < \operatorname* { m i n } _ { j \in [ K ] } \{ L ( f _ { j } ( \mathbf { x } _ { j } ) ) \} } \end{array}$
51
+
52
+ Theorem 2. Assume the set of pre-trained components $\{ f _ { j } ( \mathbf { x } _ { j } ) \} _ { j = 1 } ^ { K }$ satisfies both NPC and LIC, and g be $\sigma \circ \Theta ( f _ { 1 } , . . . , f _ { K } )$ . Then with probability at least $1 - { \frac { K } { \pi e ^ { N } } }$ there exists w\~ s.t. $L _ { \vec { \mathbf { w } } } \left( \mathbf { x } ; g \right) <$ $\begin{array} { r } { \operatorname* { m i n } _ { j \in [ K ] } L \big ( f _ { j } ( \mathbf { x } _ { j } ) \big ) } \end{array}$ .
53
+
54
+ Theorem 3. Assume the set of components $\{ f _ { j } ( \mathbf { x } _ { j } ) \} _ { j = 1 } ^ { K }$ satisfies LIC. Let $g _ { K - 1 } = \Theta ( f _ { 1 } , . . . f _ { K - 1 } )$ and $g _ { K } = \Theta ( f _ { 1 } , . . . f _ { K } )$ . With probability at least $1 - { \frac { K } { \pi e ^ { N } } }$ KπeN , there is a vector w\~ ∈ RK \ BRK s.t. $L _ { \vec { \mathbf { w } } } \left( \mathbf { x } ; g _ { K } \right) < L _ { \vec { \mathbf { w } } } \left( \mathbf { x } ; g _ { K - 1 } \right)$ .
55
+
56
+ Theorem 1, and 2 together answer Problem P1, and Theorem 3 answers Problem P2.
57
+
58
+ # 4 RELATED WORK
59
+
60
+ Our framework is related but not the same with the models such as transfer learning. (Erhan et al., 2010; Kandaswamy et al., 2014; Yao & Doretto, 2010) and ensemble leaning (Zhou, 2012).
61
+
62
+ Transfer Learning. Typically transfer learning deals with two data sets with different distributions, source and target domains. A neural network, such as an auto-encoder, is trained with source domain data and corresponding task, and then part of its weights are taken out and plugged into other neural network, which will be trained with target domain data and task. The transplanted weights can be kept fixed during the consequent steps or trainable for the fine-tune purpose (Erhan et al., 2010). For multi-source transfer, algorithms of boosting based are studied in the paper (Yao & Doretto, 2010). Kandaswamy et al. (Kandaswamy et al., 2014) proposed a method of cascading several pre-trained layers to improve the performance. Transfer learning is considered as a special case of composite neural network that the transfered knowledge can be viewed as a pre-trained component.
63
+
64
+ Ensemble (Bagging and Boosting). Since the Bagging needs to group data by sampling and the Boosting needs to tune the probability of data (Zhou et al., 2002), these frameworks are different from composite neural network. However, there are fine research results revealing many properties for accuracy improvement (Dzeroski & ˇ Zenko, 2004; Gashler et al., 2008; Zhou et al., 2002). For ˇ example, it is known that in the ensemble framework, low diversity between members can be harmful to the accuracy of their ensemble (Dzeroski & ˇ Zenko, 2004; Gashler et al., 2008). In this work, we ˇ consider neural network training, but not data processing.
65
+
66
+ Ensemble (Stacking). Among the ensemble methods, the stacking is closely related to our framework. The idea of stacked generalization (Wolpert, 1992), in Wolpert’s terminology, is to combine two levels of generalizers. The original data are taken by several level 0 generalizers, then their outputs are concatenated as an input vector to the level 1 generalizer. According to the empirical study of Ting and Witten (Ting & Witten, 1999), the probability of the outputs of level 0, instead of their values, is critical to accuracy. Besides, multi-linear regression is the best level 1 generalizer, and non-negative weights restriction is necessary for regression problem while not for classification problem. In (Breiman, 1996), it restricts non-negative combination weights to prevent from poor generalization error and concludes the restriction of the sum of weights equals to 1 is not necessary (Breiman, 1996). In (Hashem, 1997), Hashem showed that linear dependence of components could be, but not always, harmful to ensemble accuracy, while in our work, it allows a mix of pre-defined and undefined components as well as negative weights to provide flexibility in solution design.
67
+
68
+ Recently Proposed Frameworks. In You et al. (2017), Shan You et al. proposed a student-teacher framework where the outputs of pre-trained teachers are averaged as the knowledge for the student network. A test time combination of multiple trained predictors was proposed by Kim, Tompkin, and Richardt In Kim et al. (2017), that the combination weights are decided during test time. In above frameworks, the usage of pre-trained neural networks generally improves the accuracy of their combination.
69
+
70
+ # 5 THEORETICAL ANALYSIS
71
+
72
+ This section provides analyses of the loss function of composite neural network with the introduction of pre-trained components. For the complete proofs, please refer to Supplementary Material. Observe that for given pre-trained components $\{ \stackrel { . } { f } _ { j } \} _ { j = 1 } ^ { K }$ , a composite neural network can be defined recursively by postorder subtrees search. For instance, $\sigma _ { 2 } \circ \Theta _ { 1 } \left( f _ { 4 } , \sigma _ { 1 } \circ \Theta _ { 0 } ( f _ { 1 } , f _ { 2 } , f _ { 3 } ) \right)$ can be presented as $\sigma _ { 2 } \circ \varTheta _ { 1 } ( f _ { 4 } , g _ { 1 } )$ , and $g _ { 1 } = \sigma _ { 1 } \circ \Theta _ { 0 } ( f _ { 1 } , f _ { 2 } , f _ { 3 } )$ . Without loss of generality, we assume $d _ { j } = d = 1$ for all $j \in [ K ]$ in the following proofs. We denote ${ \vec { f } } _ { j }$ the vector $( f _ { j } ( { \bf x } ^ { ( 1 ) } ) , \cdot \cdot \cdot , f _ { j } ( { \bf x } ^ { ( N ) } ) )$ , as the sequence of $f _ { j }$ during the training phase. Similarly, $\bar { y } : = ( y ^ { ( 1 ) } , \cdot \cdot \cdot \bar { , } y ^ { ( N ) } )$ . Let $\vec { e } _ { j }$ be an unit vector in the standard basis of $\mathbb { R } ^ { K }$ for each $j \in [ K ]$ , i.e. $\vec { e } _ { 1 } = ( 1 , 0 , \cdots , 0 )$ and $\vec { e } _ { 2 } = ( 0 , 1 , 0 , \cdots , 0 )$ , etc. Let $\boldsymbol { B } _ { K }$ be the set containing all these standard unit-length basis of $\check { \mathbb { R } } ^ { K }$ .
73
+
74
+ Theorem 1. Assume the set of components $\{ f _ { j } ( \mathbf { x } _ { j } ) \} _ { j = 1 } ^ { K }$ satisfies LIC. Let g be $\Theta ( f _ { 1 } , . . . , f _ { K } )$ . With probability at least $1 - { \frac { K } { \pi e ^ { N } } }$ , there is a vector $\vec { \theta } \in \mathbb { R } ^ { K } \setminus B _ { K }$ s.t. $L _ { \vec { \theta } } \left( \mathbf { x } ; g \right) < \operatorname* { m i n } _ { j \in [ K ] } \{ L ( f _ { j } ( \mathbf { x } _ { j } ) ) \}$
75
+
76
+ Proof. (Proof Sketch) The whole proof is split to Lemma 5.1,5.2,5.3. Note that $g ( \cdot )$ is the linear combination of $\vec { \theta }$ and $\{ f _ { j } ( \mathbf { x } _ { j } ) \} _ { j = 1 } ^ { K }$ . It is well known (Friedman et al., 2001) that to search the minimizer $\vec { \theta }$ for $L _ { \vec { \theta } }$ , i.e. to solve a least square error problem, is equivalent to find an inverse matrix defined by $\{ f _ { j } ( \mathbf { x } _ { j } ) \} _ { j = 1 } ^ { K }$ . Since $\{ f _ { j } ( \mathbf { x } _ { j } ) \} _ { j = 1 } ^ { K }$ satisfy LIC, the inverse matrix can be written down concretely, which proves the existence. Furthermore, if this solved minimizer $\vec { \theta ^ { * } }$ is not $\vec { e } _ { s }$ for some $s \in [ K ]$ then the $g _ { \vec { \theta } ^ { * } }$ has lower loss than $f _ { s }$ . Lemma 5.3 argues that the probability of $\vec { \theta ^ { * } } = \vec { e } _ { s }$ is at most the probability of the event $\langle { \vec { f } } - { \vec { y } } , { \vec { f } } \rangle = 0$ , where $\vec { f }$ is uniformly taken from the vector set of the same length of ${ \vec { f } } - { \vec { y } }$ . □
77
+
78
+ The statements of Lemmas needed by previous Theorem are as follows.
79
+
80
+ Lemma 5.1. There exists $\vec { \theta } \in \mathbb { R } ^ { K + 1 }$ $\begin{array} { r } { \mathrm { \Large { ? } } ^ { K + 1 } s . t . { \cal L } _ { \vec { \theta } } \left( { \bf x } ; \Theta _ { ( 0 ) } ( f _ { 1 } , . . . f _ { K } ) \right) \leq \operatorname* { m i n } _ { j \in [ K ] ^ { + } } \{ { \cal L } ( f _ { j } ( { \bf x } _ { j } ) ) \} . } \end{array}$
81
+
82
+ This Lemma deals with the existence of the solution of the inequality. But our goal is to find a solution such that the loss is strictly less than any pre-trained component.
83
+
84
+ Lemma 5.2. Denote $\mathbb { I } _ { L _ { \Vec { \theta } } }$ the indicator variable for the event that at least one of $\vec { e } _ { j } \in \boldsymbol { B } _ { \mathbb { R } ^ { K } }$ is the θminimizer of Lθ\~. Then Pr ILθ\~ = 1 < KπeN , i.e. Pr ILθ\~ = 0 ≥ 1 − π eN .
85
+
86
+ $$
87
+ \begin{array} { r l } & { \mathrm { L e m m a } 5 . 3 . \ D e f i n e \ \widetilde { \mathfrak { F } } ( \overrightarrow { y } , L ( f ) ) = \left\{ \overrightarrow { f } \in \mathbb { R } ^ { N } : \left\| \overrightarrow { f } - \overrightarrow { y } \right\| ^ { 2 } = L _ { f } \right\} f o r \ g i v e n \ \overrightarrow { y } a n d \ \overrightarrow { f } . \ T h e n \ w e \ h a v } \\ & { \mathrm { P r } _ { \overrightarrow { f } \in \widetilde { \mathcal { Y } } ( \overrightarrow { y } , L ( f ) ) } \left\{ \langle \overrightarrow { f } - \overrightarrow { y } , \overrightarrow { f } \rangle = 0 \right\} < \frac { 1 } { \pi e ^ { N } } . } \end{array}
88
+ $$
89
+
90
+ The above Lemmas prove Theorem 1. The following corollary is the closed from of the optimal weights.
91
+
92
+ Corollary 5.1. The closed form of the minimizer is:
93
+
94
+ $$
95
+ \left[ \theta _ { t } \right] _ { t \in [ K ] ^ { + } } = \left[ \langle \vec { f } _ { s } , \vec { f } _ { t } \rangle \right] _ { s , t \in [ K ] ^ { + } } ^ { - 1 } \times \left[ \langle \vec { f } _ { s } , \vec { y } \rangle \right] _ { s \in [ K ] ^ { + } } .
96
+ $$
97
+
98
+ In the following, we deal with $\sigma \circ \Theta ( f _ { 1 } , . . . , f _ { K } )$ and $\Theta _ { 1 } \circ \sigma \circ \Theta ( f _ { 1 } , . . . , f _ { K } )$ .
99
+
100
+ Theorem 2. Assume the set of pre-trained components $\{ f _ { j } ( \mathbf { x } _ { j } ) \} _ { j = 1 } ^ { K }$ satisfies both NPC and LIC, and $g$ be $\sigma \circ \Theta ( f _ { 1 } , . . . , f _ { K } )$ . Then with probability at least $1 - { \frac { K } { \pi e ^ { N } } }$ there exists $\vec { \theta }$ s.t. $L _ { \vec { \theta } } ( \mathbf { x } ; g ) <$ $\begin{array} { r } { \operatorname* { m i n } _ { j \in [ K ] } L \big ( f _ { j } ( \mathbf { x } _ { j } ) \big ) } \end{array}$ .
101
+
102
+ Proof. (Proof Sketch) The whole proof is split to Lemma 5.4,5.5, and 5.6. The idea is to find an interval in the domain of $\sigma$ such that the output can approximate linear function as well as possible. Then in this interval, the activation $\sigma$ can approximate any given pre-trained component. However, under the assumptions LIC and NPC the gradient of the loss $L$ is not zero with high probability. Since the training is based on the gradient descent algorithm, this none-zero gradient leads the direction of updating process to obtain a lower loss. □
103
+
104
+ Lemma 5.4. Let $N , K$ and $j \in [ K ]$ be fixed. For small enough , there exists $\vec { \theta } \in Z _ { F , 1 , \epsilon }$ and 0 < α ∈ R s.t. |σ ◦ Θ(0)(f1, ..., fK ) − fj (x)α | .
105
+
106
+ Lemma 5.5. Assume NPC holds with $\epsilon ^ { * } > 0$ . If $\vec { \theta } _ { \epsilon ^ { * } / 3 }$ satisfies $| \sigma \circ \Theta _ { ( 0 ) } ( f _ { 1 } , . . . , f _ { K } ) ( \mathbf { x } ) - f _ { j } ( \mathbf { x } ) | <$ $\frac { \epsilon ^ { * } } { 3 N }$ for any $j \in [ K ] ^ { + }$ , then $\nabla _ { \vec { \theta } } L ( \vec { \theta } _ { \epsilon ^ { * } / 3 } ) \neq \vec { 0 }$ .
107
+
108
+ Lemma 5.6. If $\vec { \theta } _ { \epsilon ^ { * } / 3 }$ makes $\nabla _ { \vec { \theta } } L ( \vec { \theta } _ { \epsilon ^ { * } / 3 } ) \quad \neq \quad \vec { 0 } _ { \epsilon }$ , then there exist $\vec { \theta }$ s.t. $L _ { \vec { \theta } } ( \mathbf { x } ; g ) \quad <$
109
+ $\begin{array} { r } { \operatorname* { m i n } _ { j \in [ K ] ^ { + } } L \bigl ( f _ { j } ( \mathbf { x } _ { j } ) \bigr ) } \end{array}$ .
110
+
111
+ Now we consider the difference of losses of $\sigma \circ \Theta ^ { \prime } ( f _ { 1 } , . . . , f _ { K } )$ and $\sigma \circ \Theta ( f _ { 1 } , . . . , f _ { K - 1 } )$ .
112
+
113
+ Theorem 3. Assume the set of components $\{ f _ { j } ( \mathbf { x } _ { j } ) \} _ { j = 1 } ^ { K }$ satisfies LIC. Let $g _ { K - 1 } = \Theta ( f _ { 1 } , . . . f _ { K - 1 } )$ and $g _ { K } = \Theta ( f _ { 1 } , . . . f _ { K } )$ . With probability at least $1 - \frac { K } { \pi e ^ { N } }$ KπeN , there is a vector \~θ ∈ RK \ BRK s.t. ${ \cal L } _ { \vec { \theta } } ( { \bf x } ; g _ { K } ) < { \cal L } _ { \vec { \theta } } ( { \bf x } ; g _ { K - 1 } )$ .
114
+
115
+ Table 1: Validation Error of Image Classification
116
+
117
+ <table><tr><td></td><td>ResNet50</td><td>SIFT</td><td>composite</td></tr><tr><td>number of parameter</td><td>25636712</td><td>2884200</td><td>3000</td></tr><tr><td>Validation Error (%)</td><td>70.1184</td><td>13.1252</td><td>71.5079</td></tr></table>
118
+
119
+ Proof. (Proof Sketch) The idea is directly solve the inequality for the case of $K = 2$ , and then generalize the result to larger $K$ . □
120
+
121
+ The following provides a generalized error bound for a composite neural network.
122
+
123
+ Theorem 4. Assume pre-trained components $\{ f _ { j } \} _ { j = 1 } ^ { K }$ satisfy LIC and NPC. Let $\{ G E ( f _ { j } ) \} _ { j = 1 } ^ { K } \ : k$ e corresponding generalization errors of $\{ f _ { j } \} _ { j = 1 } ^ { K }$ , and $\Theta _ { ( L ) } \circ \sigma _ { ( L ) } \circ \cdot \cdot \cdot \circ \sigma _ { ( 1 ) } \circ \Theta _ { ( 0 ) } ( f _ { 1 } , . . . , f _ { K } ) b e$ the composite neural network. Denote the generalization error, $\mathbf { E } \{ L ( \Theta _ { ( L ) } \circ \sigma _ { ( L ) } \circ \cdot \cdot \cdot \circ \sigma _ { ( 1 ) } \circ$ $\Theta _ { ( 0 ) } ( f _ { 1 } , . . . , f _ { K } ) ) \}$ , of the composite neural network as $\mathbf { E } \{ L _ { \Theta , f _ { 1 } , \dots , f _ { K } } \}$ . Then with high probability, there exist a setting of $\{ \Theta _ { ( L ) } ^ { * } , . . . , \Theta _ { ( 0 ) } ^ { * } \}$ such that $\mathbf { E } \{ L _ { \Theta , f _ { 1 } , . . . , f _ { K } } \} \le \Theta _ { ( L ) } ^ { * } ( G E ( f _ { 1 } ) , . . . G _ { E } ( f _ { K } ) )$ .
124
+
125
+ Proof. (Proof Sketch) We apply the idea similar to Kawaguchi (2016): the exception of non-liner activations is same with the exception of liner activations. Previous theorems provide that with high probability there exists the solution of $\Theta _ { ( i ) } , \forall i \in [ L ] ^ { + }$ s.t. each $\Theta _ { ( i ) + 1 } \sigma \Theta _ { ( i ) }$ approximates a degree one polynomial $A _ { \Theta _ { ( i ) + 1 } \sigma \Theta _ { ( i ) } , 1 }$ as well as possible. If the weights are obey the normal distribution, then $\mathbf { E } \{ L _ { \Theta , f _ { 1 } , . . . , f _ { K } } \} \le \Theta _ { ( L ) } ^ { * } ( G E ( f _ { 1 } ) , . . . G _ { E } ( f _ { K } ) ) .$ . □
126
+
127
+ # 6 EMPIRICAL STUDIES
128
+
129
+ This section is to numerically verify the performance of composite network for two distinctively different applications, image classification and PM2.5 prediction. For image classification, we examined two pre-trained components, the ResNet50 (He et al., 2016) from Keras and the SIFT algorithm(Lowe, 1999) from OpenCV, running on the benchmark of ImageNet competition(Russakovsky et al., 2015). For PM2.5 prediction, we implemented several models running on the open data of local weather bureau and environment protection agency to predict the PM2.5 level in the future hours.
130
+
131
+ # 6.1 IMAGENET CLASSIFICATION
132
+
133
+ We chose Resnet50 as the pre-trained baseline model and the SIFT model as an auxiliary model to form a composite neural network to validate the proposed theory. The experiments are conducted on the 1000-class single-label classification task of the ImageNet dataset, which has been a well received benchmark for image classification applications. A reason to choose the SIFT (Scale-Invariant Feature Transform) algorithm is that its function is very different from ResNet and it is interesting to see if the performance of ResNet50 can be improved as predicted from our theory.
134
+
135
+ We trained the SIFT model using the images of ImageNet, and directed the output to a CNN to extract useful features before merging with ResNet50 output. In the composite model, the softmax functions of both ResNet50 and SIFT model are removed that the outputs of length 1000 of both models are merged before the final softmax stage. During the training process of composite network, the weights of ResNet50 and SIFT model are fixed, and only the connecting weights and bias are trained.
136
+
137
+ The ResNet50 was from He et al. that its Top-1 accuracy in our context was lower than reported in (He et al., 2016) since we did not do any fine tuning and data preprocessing. In the Figure 1, it shows the composite network has higher accuracy than ResNet50 during almost the complete testing run. Table 1 shows the same result that the composite network performs better too. The experiment results support the claims of this work that a composite network performs better than any of its components, and more components work better than less components.
138
+
139
+ ![](images/37632db424ad320bc8b46df5ffbb0ffddc5aee0b6db76d09c203d266ebcef4a1.jpg)
140
+ Figure 1: Image Classification Validation Accuracy
141
+
142
+ # 6.2 PM2.5 PREDICTION
143
+
144
+ The PM2.5 prediction problem is to forecast the particle density of fine atmospheric matter with the diameter at most 2.5 µm (PM2.5) in the future hours, mainly, for the next 12, 24, 48, 72 hours. The datasets used are open data provided by two sources including Environmental Protection Administration (EPA)1 , and Center Weather Bureau (CWB)2. The EPA dataset contains 21 observed features, including the speed and direction of wind, temperature, relative humidity, PM2.5 and PM10 density, etc., from 18 monitoring stations, with one record per hour. The CWB has seventy monitoring stations, one record per 6 hours, containing 26 features, such as temperature, dew point, precipitation, wind speed and direction, etc. We partitioned the observed area into a grid of $1 1 4 0 \mathrm { k m ^ { 2 } }$ with $1 \mathrm { k m } \times 1$ km blocks and aligned the both dataset into one-hour period. We called the two datasets as air quality and weather condition dataset.
145
+
146
+ We selected ConvLSTM (Convolution LSTM) and FNN (fully connected neural network) as the components used in this experiment. The reason to select ConvLSTM is that the dispersion of PM2.5 is both spatially and temporally dependent and ConvLSTM is considered capable of catching the dependency, and FNN is a fundamental neural network that acts as the auxiliary component in the experiment.
147
+
148
+ The prediction models were trained with the data of 2014 and 2015 years, then the 2016 data was used for testing. We considered two function compositions, the linear combination $\Theta$ and the Logistic function $\sigma _ { 1 }$ (as Theorem 2), to combine the two components to examine the applicability of the proposed theorems.
149
+
150
+ We trained and tested both ConvLSTM and FNN using air quality dataset (Dataset A) and weather condition dataset (Dataset B) separately as the baselines (denoted as $f _ { 1 }$ , $f _ { 2 }$ , $f _ { 3 }$ and $f _ { 4 , }$ ) and their training error and testing error in MSE are list in the first part of Table 2. Then we composited FNNs using Dataset A and Dataset B, each FNN can be pre-trained (denoted as $\mathbf { X }$ ) or non-instantiated (denoted as o). In addition, we used both linear and Sigmoid activation functions. As a result, we had eight combinations, as list in the part two. We treated ConvLSTM in the same way and the outcomes were in the part 3. Finally, we composited using one FNN and one ConvLSTM that each was the best in their category, and the resulting composite network was a tree of depth 2. For instance, the candidate of ConvLSTM of part 4 for 12 hours prediction was the 4th row (i.e., $\Theta ( f _ { 3 } ^ { \circ } , f _ { 4 } ^ { \circ } ) )$ of part 3. Their training and testing errors in MSE were listed in the part 4.
151
+
152
+ From the empirical study results, it shows mostly the proposed theorems are followed. While the composite networks with all pre-trained components may not perform better than others in their category, (which is not a surprise), what we expect to see is after adding a new component, the composite network has improvement over the previous one. For example, the $\sigma \circ \Theta ( \bar { f } _ { 3 } ^ { \times } , f _ { 4 } ^ { \times } )$ has strictly better accuracy than both $f _ { 3 }$ and $f _ { 4 }$ for all future predictions. Another example is the NEXT $4 8 { \mathrm { ~ h r } }$ , $\sigma \circ \Theta ( \dot { C } ^ { \times } , F ^ { \times } )$ also has strictly better accuracy than both $C = \sigma \circ \Theta ( f _ { 3 } ^ { \circ } , f _ { 4 } ^ { \circ } )$ and $F = \sigma \circ \Theta ( f _ { 3 } ^ { \circ } , f _ { 4 } ^ { \circ } )$ .
153
+
154
+ Table 2: Training and Testing Errors of PM2.5 Prediction
155
+
156
+ <table><tr><td rowspan="2">Model (input)</td><td colspan="2">Next 12 hr</td><td colspan="2">Next 24 hr</td><td colspan="2">Next 48 hr</td><td colspan="2">Next 72 hr</td></tr><tr><td>TarinError</td><td>TestError</td><td>TarinError</td><td>TestError</td><td>TarinError</td><td>TestError</td><td>TarinError</td><td>TestError</td></tr><tr><td>f1:FNN-A</td><td>100.1812</td><td>92.8528</td><td>134.7095</td><td>118.6065</td><td>141.6287</td><td>136.8358</td><td>148.1807</td><td>143.9980</td></tr><tr><td>f2:FNN-B</td><td>134.1137</td><td>120.0019</td><td>139.8016</td><td>128.5960</td><td>136.7693</td><td>134.9001</td><td>142.7637</td><td>140.8650</td></tr><tr><td>f3: ConvLSTM-A</td><td>54.2775</td><td>88.8156</td><td>57.5677</td><td>111.9122</td><td>74.8937</td><td>129.7418</td><td>77.7394</td><td>132.8923</td></tr><tr><td>f4: ConvLSTM-B</td><td>67.8625</td><td>118.4351</td><td>73.1519</td><td>125.6062</td><td>68.7069</td><td>137.0789</td><td>84.9656</td><td>138.6642</td></tr><tr><td>(fx,f)</td><td>99.7005</td><td>F:90.0214</td><td>130.7800</td><td>115.9283</td><td>139.9744</td><td>F:132.4764</td><td>144.6826</td><td>F:137.8403</td></tr><tr><td>0(fx,f)</td><td>95.6804</td><td>93.0173</td><td>120.3185</td><td>117.9781</td><td>134.3893</td><td>134.0270</td><td>139.6226</td><td>140.5209</td></tr><tr><td>(fi,f)</td><td>95.8110</td><td>93.1131</td><td>121.9737</td><td>117.7771</td><td>134.0676</td><td>135.2255</td><td>136.2009</td><td>144.0116</td></tr><tr><td>0(fi,f)</td><td>101.1584</td><td>90.2671</td><td>126.6807</td><td>114.5264</td><td>132.6726</td><td>132.8069</td><td>139.2339</td><td>139.3322</td></tr><tr><td>go0(fi,f)</td><td>102.7556</td><td>90.6280</td><td>133.1453</td><td>117.7397</td><td>135.9256</td><td>133.2544</td><td>145.1052</td><td>139.2513</td></tr><tr><td>go0(fx,f)</td><td>98.1241</td><td>93.1098</td><td>127.4999</td><td>118.8107</td><td>135.1553</td><td>134.1469</td><td>137.7562</td><td>142.1778</td></tr><tr><td>go0(fi,f)</td><td>94.9931</td><td>91.4667</td><td>124.5461</td><td>117.7332</td><td>131.2684</td><td>135.1281</td><td>140.1604</td><td>144.5220</td></tr><tr><td>go0(fi,f)</td><td>98.2596</td><td>91.3646</td><td>124.4182</td><td>F:114.2274</td><td>134.5078</td><td>132.8316</td><td>138.0456</td><td>139.8351</td></tr><tr><td>0(f)</td><td>27.1760</td><td>85.8922</td><td>49.1624</td><td>108.3157</td><td>37.2116</td><td>123.2186</td><td>60.6415</td><td>131.0565</td></tr><tr><td>0(f,)</td><td>27.1519</td><td>81.7688</td><td>42.7932</td><td>104.2375</td><td>33.2831</td><td>C:110.4213</td><td>74.3055</td><td>C:110.9952</td></tr><tr><td>0(f)</td><td>27.4436</td><td>78.5360</td><td>44.3214</td><td>107.0898</td><td>31.4910</td><td>129.1829</td><td>68.4413</td><td>139.5661</td></tr><tr><td>0(f,f)</td><td>26.3063</td><td>C:70.8670</td><td>40.1879</td><td>100.8474</td><td>25.3312</td><td>119.1634</td><td>76.1782</td><td>120.6814</td></tr><tr><td>go0(ff)</td><td>28.3844</td><td>84.9029</td><td>43.2981</td><td>109.3709</td><td>31.2413</td><td>123.0041</td><td>63.7286</td><td>130.4122</td></tr><tr><td>go0(f)</td><td>27.5981</td><td>80.7848</td><td>44.4197</td><td>98.1051</td><td>29.7649</td><td>111.6793</td><td>69.3182</td><td>117.0719</td></tr><tr><td>go0(f,f)</td><td>26.4125</td><td>78.3990</td><td>42.3181</td><td>103.3361</td><td>30.4183</td><td>128.4138</td><td>64.4193</td><td>136.6043</td></tr><tr><td>go0(f8,f4)</td><td>26.5131</td><td>75.5778</td><td>42.3912</td><td>C:94.6242</td><td>27.5812</td><td>112.8075</td><td>70.5132</td><td>117.6480</td></tr><tr><td>0(C×,F×)</td><td>26.6556</td><td>70.1159</td><td>34.6885</td><td>92.2737</td><td>29.6484</td><td>107.6833</td><td>52.0060</td><td>H:110.1283</td></tr><tr><td>(C×,F°)</td><td>24.2349</td><td>67.4414</td><td>31.7202</td><td>90.7795</td><td>30.1328</td><td>H:105.1804</td><td>46.9994</td><td>111.2227</td></tr><tr><td>0(C,Fx)</td><td>22.7651</td><td>75.9468</td><td>24.2132</td><td>96.3126</td><td>24.4488</td><td>114.1803</td><td>49.0663</td><td>117.2747</td></tr><tr><td>(C°,F°)</td><td>21.9103</td><td>68.0660</td><td>20.9072</td><td>91.9323</td><td>23.2868</td><td>112.8605</td><td>30.6875</td><td>113.6968</td></tr><tr><td>goΘ(C×,Fx)</td><td>26.5950</td><td>69.1897</td><td>34.7400</td><td>92.4715</td><td>29.9215</td><td>108.7482</td><td>52.3708</td><td>111.5474</td></tr><tr><td>goΘ(C×,Fo)</td><td>24.0223</td><td>H:66.4733</td><td>28.8401</td><td>H:90.7257</td><td>28.5033</td><td>108.8896</td><td>46.2711</td><td>110.1613</td></tr><tr><td>goΘ(C°,Fx)</td><td>22.4443</td><td>83.5953</td><td>22.5040</td><td>96.4027</td><td>28.4714</td><td>112.0727</td><td>35.3947</td><td>114.5947</td></tr><tr><td>gΘ(C,F</td><td>38.4899</td><td>67.1819</td><td>17.6041</td><td>92.2343</td><td>33.9710</td><td>105.7977</td><td>40.2934</td><td>110.3585</td></tr><tr><td colspan="9">Let f5 be non-instantiated CNN with future rain fall input.</td></tr><tr><td>σoΘ(H×,f5)</td><td>24.1487</td><td>65.5776</td><td>30.6243</td><td>87.2777</td><td>55.9261</td><td>102.2878</td><td>50.5158</td><td>108.8087</td></tr><tr><td>σΘ(H°,f)</td><td>58.0852</td><td>68.8111</td><td>22.8776</td><td>90.2324</td><td>39.0996</td><td>112.1639</td><td>36.0659</td><td>109.8240</td></tr></table>
157
+
158
+ Part 1: pre-trained components $\overline { { f _ { i } } }$ , $\overline { { i \in [ 4 ] } }$ . Part 2: composite $\overline { { f _ { 1 } } }$ and $\overline { { f _ { 2 } } }$ by linear $\overline { { \Theta ( \cdot ) } }$ or logistic $\overline { { \sigma \circ \Theta ( \cdot ) } }$ ; similar for Part 3-5 ×: un-trainable component, i.e. pre-trained. ◦: trainable component (original weights was deleted). The best model of Part 2 (/Part 3) was assigned as composite model $F$ $( / C )$ which will be used in Part 4. The best model of Part 4 was assigned as composite model $H$ which will be used in Part 5.
159
+
160
+ # 7 CONCLUSION
161
+
162
+ In this work, we investigated the composite neural network with pre-trained components problem and showed that the overall performance of a composite neural network is better than any of its components, and more components perform better than less components. In addition, the developed theory consider all differentiable activation functions.
163
+
164
+ While the proposed theory ensures the overall performance improvement, it is still not clear how to decompose a complicated problem into components and how to construct them into a composite neural network in order to have an acceptable performance. Another problem worth some thinking is when the performance improvement will diminish (by power law or exponentially decay) even adding more components. However, in the real world applications, the amount of data, data distribution and data quality will highly affect the performance.
165
+
166
+ # REFERENCES
167
+
168
+ Leo Breiman. Stacked regressions. Machine learning, 24(1):49–64, 1996.
169
+
170
+ Saso Dzeroski and Bernard ˇ Zenko. Is combining classifiers with stacking better than selecting the ˇ best one? Machine learning, 54(3):255–273, 2004.
171
+
172
+ Dumitru Erhan, Yoshua Bengio, Aaron Courville, Pierre-Antoine Manzagol, Pascal Vincent, and Samy Bengio. Why does unsupervised pre-training help deep learning? Journal of Machine Learning Research, 11(Feb):625–660, 2010.
173
+
174
+ Yoav Freund and Robert E Schapire. A decision-theoretic generalization of on-line learning and an application to boosting. Journal of computer and system sciences, 55(1):119–139, 1997.
175
+
176
+ Jerome Friedman, Trevor Hastie, and Robert Tibshirani. The elements of statistical learning, volume 1. Springer series in statistics New York, 2001.
177
+
178
+ Tomer Galanti, Lior Wolf, and Tamir Hazan. A theoretical framework for deep transfer learning. Information and Inference: A Journal of the IMA, 5(2):159–209, 2016.
179
+
180
+ Mike Gashler, Christophe Giraud-Carrier, and Tony Martinez. Decision tree ensemble: Small heterogeneous is better than large homogeneous. In Machine Learning and Applications, 2008. ICMLA’08. Seventh International Conference on, pp. 900–905. IEEE, 2008.
181
+
182
+ Ian Goodfellow, Yoshua Bengio, Aaron Courville, and Yoshua Bengio. Deep learning, volume 1. MIT Press, 2016.
183
+
184
+ Sherif Hashem. Optimal linear combinations of neural networks. Neural networks, 10(4):599–614, 1997.
185
+
186
+ 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.
187
+
188
+ Roger A Horn and Charles R Johnson. Matrix analysis. Cambridge university press, second edition, 2012.
189
+
190
+ Kurt Hornik. Approximation capabilities of multilayer feedforward networks. Neural networks, 4(2): 251–257, 1991.
191
+
192
+ Kwang In Kim, James Tompkin, and Christian Richardt. Predictor combination at test time. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 3553–3561, 2017.
193
+
194
+ Chetak Kandaswamy, Lu´ıs M Silva, Lu´ıs A Alexandre, Ricardo Sousa, Jorge M Santos, and Joaquim Marques de Sa. Improving transfer learning accuracy by reusing stacked denoising ´ autoencoders. In Systems, Man and Cybernetics (SMC), 2014 IEEE International Conference on, pp. 1380–1387. IEEE, 2014.
195
+
196
+ Kenji Kawaguchi. Deep learning without poor local minima. In Advances in Neural Information Processing Systems, pp. 586–594, 2016.
197
+
198
+ Yann LeCun, D Touresky, G Hinton, and T Sejnowski. A theoretical framework for back-propagation. In Proceedings of the 1988 connectionist models summer school, pp. 21–28. CMU, Pittsburgh, Pa: Morgan Kaufmann, 1988.
199
+
200
+ David G Lowe. Object recognition from local scale-invariant features. In Computer vision, 1999. The proceedings of the seventh IEEE international conference on, volume 2, pp. 1150–1157. Ieee, 1999.
201
+
202
+ David Opitz and Richard Maclin. Popular ensemble methods: An empirical study. Journal of artificial intelligence research, 11:169–198, 1999.
203
+
204
+ Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, et al. Imagenet large scale visual recognition challenge. International Journal of Computer Vision, 115(3):211–252, 2015.
205
+
206
+ Chun-Wei Seah, Yew-Soon Ong, and Ivor W Tsang. Combating negative transfer from predictive distribution differences. IEEE transactions on cybernetics, 43(4):1153–1165, 2013.
207
+
208
+ Kai Ming Ting and Ian H Witten. Issues in stacked generalization. Journal of artificial intelligence research, 10:271–289, 1999.
209
+
210
+ David H Wolpert. Stacked generalization. Neural networks, 5(2):241–259, 1992.
211
+
212
+ Yi Yao and Gianfranco Doretto. Boosting for transfer learning with multiple sources. In Computer vision and pattern recognition (CVPR), 2010 IEEE conference on, pp. 1855–1862. IEEE, 2010.
213
+
214
+ Shan You, Chang Xu, Chao Xu, and Dacheng Tao. Learning from multiple teacher networks. In Proceedings of the 23rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pp. 1285–1294. ACM, 2017.
215
+
216
+ Zhi-Hua Zhou. Ensemble methods: foundations and algorithms. CRC press, 2012.
217
+
218
+ Zhi-Hua Zhou, Jianxin Wu, and Wei Tang. Ensembling neural networks: many could be better than all. Artificial intelligence, 137(1-2):239–263, 2002.
219
+
220
+ For self-contained, we list some common Taylor expansion in the following.
221
+
222
+ Logistic: S(z) := 11+e−z $\begin{array} { r } { S ( z ) : = \frac { 1 } { 1 + e ^ { - z } } = \frac { 1 } { 2 } + \frac { 1 } { 4 } z - \frac { 1 } { 4 8 } z ^ { 3 } \overset { } { + } \frac { 1 } { 4 8 0 } z ^ { 5 } - \frac { 1 7 } { 8 0 6 4 0 } z ^ { 7 } + O ( z ^ { 9 } ) , \breve { \forall } z \in \mathbb { R } , } \end{array}$ Hyperbolic Tan: $\begin{array} { r } { t a n H ( z ) = \frac { e ^ { z } - e ^ { - z } } { e ^ { z } + e ^ { - z } } = z - \frac { 1 } { 3 } z ^ { 3 } + \frac { 2 } { 1 5 } z ^ { 5 } + O ( z ^ { 7 } ) , \forall | z | \leq \frac { \pi } { 2 } } \end{array}$ arcTan: arctan $\begin{array} { r } { ( z ) = z - \frac { 1 } { 3 } z ^ { 3 } + \frac { 1 } { 5 } z ^ { 5 } + + O ( z ^ { 7 } ) , \forall | z | \leq 1 . } \end{array}$
223
+
224
+ Definition 1. Given an activation $\sigma ( z )$ and its Taylor expansion $T _ { \sigma } ( z )$ , let $A _ { { \boldsymbol { \sigma } } , D } ( z )$ be the truncated the monomials of degree at most $D$ from $T _ { \sigma } ( z )$ . We define $A _ { \sigma , D } ( z )$ as the $D$ -degree Taylor approximation polynomial, and $R _ { \sigma , D + 1 } ( z )$ as the remainder part such that $T _ { \sigma } ( z ) = \dot { A _ { \sigma , D } ( z ) } + R _ { \sigma , D + 1 } ( z )$
225
+
226
+ For instance, if weapproximation part $D = 3$ pansion of Logistic funand the remainder part $S ( z )$ $\begin{array} { r } { A _ { S ( z ) , 3 } ( z ) = \frac { 1 } { 2 } + \frac { 1 } { 4 } z ^ { \underline { { \cdot } } } - \frac { 1 } { 4 8 } z ^ { 3 } } \end{array}$ $\begin{array} { r } { R _ { S ( z ) , 4 } \dot { ( z ) } = \frac { 1 } { 4 8 0 } z ^ { 5 } + O ( z ^ { 7 } ) } \end{array}$
227
+
228
+ Proposition 8.1. (Error Bound of The Remainder)
229
+ Let $S ( z )$ be the Logistic function. Consider the approximation $A _ { S ( z ) , \leq D } ( z )$ and the remainder $R _ { S ( z ) , D + 1 } ( z )$ defined as above. For given $\epsilon \in ( 0 , \frac { 1 } { 1 0 0 0 } )$ and $D \in \mathbb { N }$ , if $| z | < \epsilon ^ { 1 / ( D + 2 ) }$ , then $| S ( z ) - A _ { S ( z ) , D } ( z ) | = | R _ { S ( z ) , D + 1 } ( z ) | < \epsilon .$ .
230
+
231
+ Proof. Note that if $\epsilon < 1$ then for all $D \in \mathbb { N }$ , $\epsilon ^ { 1 / ( D + 1 ) } < 1$ . If $| z | < \epsilon ^ { 1 / 3 }$ and $D = 1$ , then
232
+
233
+ $$
234
+ | R _ { S ( z ) , D + 1 } ( z ) | \leq \left| - \frac { 1 } { 4 8 } z ^ { 3 } + \frac { 1 } { 4 8 0 } z ^ { 5 } - \frac { 1 7 } { 8 0 6 4 0 } z ^ { 7 } + O ( z ^ { 9 } ) \right| < \frac { 1 } { 2 4 } \epsilon < \epsilon .
235
+ $$
236
+
237
+ The general case $( D \geq 2 )$ can be proven by the same argument as above.
238
+
239
+ This Proposition means that for a suitable range of $z$ , the Logistic function can be seen as a linear function with the error at most $\epsilon$ .
240
+
241
+ Definition 2. For the Logistic activation $\sigma ( z ) = S ( z )$ , $\epsilon > 0$ and given polynomial degree $D$ , we define $\mathcal { Z } _ { D , \epsilon } = \left\{ z \in \mathbb { R } : | \sigma ( z ) - A _ { \sigma , D } ( z ) | < \epsilon \right\}$ . Furthermore, for given components $\{ f _ { j } : j \in$ $[ K ] \} = F$ , we consider the variable $z = \Theta ( f _ { 1 } , . . . , f _ { K } )$ and define
242
+
243
+ $$
244
+ \mathcal { Z } _ { F , D , \epsilon } = \left\{ \vec { \theta } \in \mathbb { R } ^ { K + 1 } : z = \Theta ( f _ { 1 } , . . . , f _ { K } ) , | \sigma ( z ) - A _ { \sigma , D } ( z ) | < \epsilon \right\} .
245
+ $$
246
+
247
+ Observe that if the parameters $\epsilon$ , $F$ ,and $| F | = K$ are fixed, then $\mathcal { Z } _ { F , D , \epsilon } \subset \mathcal { Z } _ { F , D + 1 , \epsilon } \subset \mathbb { R } ^ { K + 1 }$ .
248
+
249
+ # 8.1 FUNCTION COMPOSITION BY LINEAR COMBINATION
250
+
251
+ Recall that for a set of pre-trained components $\{ f _ { j } ( \mathbf { x } _ { j } ) \ : \ j \ \in \ [ K ] \}$ , $\Theta _ { ( 0 ) } \left( f _ { 1 } , . . . f _ { K } \right) =$ $\textstyle \sum _ { j \in [ K ] ^ { + } } \theta _ { 0 , j } f _ { j }$ , where $f _ { 0 } ~ = ~ 1$ . For simplicity, we consider $\Theta _ { ( 1 ) } ( \mathbf { z } ) ~ = ~ \alpha \mathbf { z }$ . This means $\begin{array} { r } { \Theta _ { ( 1 ) } ^ { } \circ \sigma \circ \Theta _ { ( 0 ) } ( f _ { 1 } , . . . f _ { K } ) = \theta _ { 1 , 1 } \sigma ( \sum _ { j \in [ K ] ^ { + } } \theta _ { 0 , j } f _ { j } ) + \theta _ { 1 , 0 } . } \end{array}$ .
252
+
253
+ Theorem 1 is a consequence of the following lemmas:
254
+
255
+ Proof. (of Lemma 5.1)
256
+
257
+ For simplicity of notations, let $g ( \mathbf { x } ) = \Theta _ { ( 0 ) } ( f _ { 1 } , . . . f _ { K } )$ , hence $\begin{array} { r } { g ( \mathbf { x } ) = \sum _ { j \in [ K ] ^ { + } } \theta _ { j } f _ { j } ( \mathbf { x } _ { j } ) } \end{array}$ . Also recall that $\begin{array} { r } { L _ { \vec { \theta } } \left( \mathbf { x } ; g \right) = \sum _ { i = 1 } ^ { N } \left( g ( \mathbf { x } ^ { ( i ) } ) - \mathbf { y } ^ { ( i ) } \right) ^ { 2 } } \end{array}$ . To prove the existence of the minimizer, it is enough to solve the equations of critical points, in the case of a quadratic object function. That is, to solve the set of equations:
258
+
259
+ $$
260
+ \nabla _ { \vec { \theta } } L \left( \mathbf { x } ; g \right) = \left( \frac { \partial L } { \partial \theta _ { 0 } } , \ldots , \frac { \partial L } { \partial \theta _ { K } } \right) ^ { T } = \left( 0 , \ldots , 0 \right) ^ { T } ,
261
+ $$
262
+
263
+ where for each $s , t \in [ K ] ^ { + }$ ,
264
+
265
+ $$
266
+ \begin{array} { l } { \displaystyle \frac { \partial L } { \partial \theta _ { s } } = 2 \sum _ { i = 1 } ^ { N } \left( g ( \mathbf { x } ^ { ( i ) } ) - \mathbf { y } ^ { ( i ) } \right) \cdot f _ { s } ( \mathbf { x } ^ { ( i ) } ) = 2 \sum _ { i = 1 } ^ { N } \left( \sum _ { j \in [ K ] ^ { + } } \theta _ { j } f _ { j } ( \mathbf { x } _ { j } ^ { ( i ) } ) - \mathbf { y } ^ { ( i ) } \right) \cdot f _ { s } ( \mathbf { x } ^ { ( i ) } ) } \\ { \displaystyle \qquad = 2 \left( \sum _ { j \in [ K ] ^ { + } } \theta _ { j } \langle \vec { f } _ { s } , \vec { f } _ { j } \rangle - \langle \vec { f } _ { s } , \vec { y } \rangle \right) . } \end{array}
267
+ $$
268
+
269
+ Hence, to solve $\nabla _ { \vec { \theta } } L \left( \mathbf { x } ; g \right) \ = \ \vec { 0 }$ is equivalent to solve $\begin{array} { r l } { \left[ \langle \vec { f } _ { s } , \vec { f } _ { t } \rangle \right] _ { s , t \in [ K ] ^ { + } } \times \left[ \theta _ { t } \right] _ { t \in [ K ] ^ { + } } = } & { { } } \end{array}$ $\big [ \langle \vec { f } _ { s } , \vec { y } \rangle \big ] _ { s \in [ K ] ^ { + } }$ \~yiis∈[K]+ , where hh \~fs, \~ftiis, $\Big [ \langle \vec { f } _ { s } , \vec { f } _ { t } \rangle \Big ] _ { s , t \in [ K ] ^ { + } }$ is a $( K + 1 )$ by $( K + 1 )$ matrix, $[ \theta _ { t } ] _ { t \in [ K ] ^ { + } }$ and $\Big [ \langle \vec { f } _ { s } , \vec { y } \rangle \Big ] _ { s \in [ K ] ^ { + } }$ are both 1 by $( K + 1 )$ .
270
+
271
+ Note that linear independence of $\{ \vec { f } _ { j } \} _ { j \in [ K ] ^ { + } }$ makes $\Big [ \langle \vec { f } _ { s } , \vec { f } _ { t } \rangle \Big ] _ { s , t \in [ K ] ^ { + } }$ a positive-definite Gram matrix (Horn & Johnson, 2012) , which means the inversion $\begin{array} { r } { \left[ \langle \vec { f } _ { s } , \vec { f } _ { t } \rangle \right] _ { s , t \in [ K ] ^ { + } } ^ { - 1 } } \end{array}$ exists. Then $\vec { \theta }$ is solved:
272
+
273
+ $$
274
+ [ \theta _ { t } ] _ { t \in [ K ] ^ { + } } = \left[ \langle \vec { f } _ { s } , \vec { f } _ { t } \rangle \right] _ { s , t \in [ K ] ^ { + } } ^ { - 1 } \times \left[ \langle \vec { f } _ { s } , \vec { y } \rangle \right] _ { s \in [ K ] ^ { + } }
275
+ $$
276
+
277
+ The above shows the existence of the critical points. On the other hand, since $L _ { \vec { \theta } } ( \mathbf { x } ; g )$ is the summation of square terms, i.e. paraboloid, the the critical points can only be the minimum. $\boxed { \begin{array} { r l } \end{array} }$
278
+
279
+ The meaning of the gradient on a function surface is the direction that increases the function value most efficiently. Hence, if the gradient is not the zero vector then the corresponding point can not be the minimizer of the function surface. Recall for any $s \in [ k ]$ ,
280
+
281
+ $$
282
+ \begin{array} { r } { \left[ \frac { \partial L } { \partial \theta _ { t } } \right] _ { t \in [ K ] ^ { + } } \big | _ { \vec { \theta } = \vec { e } _ { s } } = 2 \left[ \langle \vec { f _ { s } } - \vec { \bf y } , \vec { f _ { t } } \rangle \right] _ { t \in [ K ] ^ { + } } . } \end{array}
283
+ $$
284
+
285
+ Before the proof of Lemma 5.2, we need the upper bound of the probability of some events. Note that $\vec { y }$ is defined according to the given training data, and for each $j \in [ K ] ^ { + }$ the length of $\vec { f } _ { j } - \vec { \bf y }$ , i.e. $\left\| { \vec { f } } - { \vec { y } } \right\|$ , is also given. The question is, for fixed $\vec { y }$ what is the probability of selected $\vec { f }$ is perpendicular to $\vec { f } - \vec { y } \smash { \mathrm { ? } }$ A folklore approach is considering that $\{ \vec { f } = ( f ( \mathbf { x } ^ { ( 1 ) } ) , . . . , f ( \mathbf { x } ^ { ( N ) } ) ) \}$ obeys the normal distribution, and setting the mean of $f ( \mathbf { x } ^ { ( i ) } )$ as $\mathbf { y } ^ { ( i ) }$ for each $i \in [ N ]$ . In the following we propose another simple probability argument to obtain a loose upper bound.
286
+
287
+ Proof. (of Lemma 5.3) Observe that $\langle \vec { f } - \vec { \bf y } , \vec { f } \rangle = 0 \Leftrightarrow ( \vec { f } - \vec { \bf y } ) \perp \bar { f } ,$ , which implies the angle between them, ${ \mathcal { L } } _ { ( { \vec { f } } - { \vec { \mathbf { y } } } ) , { \vec { f } } } ,$ is in the interval $\textstyle [ { \frac { \pi - \epsilon } { 2 } } , { \frac { \pi + \epsilon } { 2 } } ]$ for small $\epsilon \in \mathbb { R } ^ { + }$ , as shown in the left part of Figure 2. The red, orange, and blue vectors show three possibles of the pair of $\vec { f }$ and ${ \vec { f } } - { \vec { y } }$ . The length of $\vec { f } - \vec { y }$ is fixed since $\bar { f }$ and $\vec { y }$ are given, but the angle between $\vec { f } - \vec { y }$ and $\vec { y }$ can decide whether $( { \vec { f } } - { \vec { \mathbf { y } } } ) \perp { \bar { f } }$ . The gray circle collects all possible end-point of the vector ${ \vec { f } } - { \vec { y } }$ emission from the end-point of $\vec { y }$ . Although on the whole circle there are exactly two specific angles 3 can satisfy $( { \vec { f } } - { \vec { \mathbf { y } } } ) \bot { \vec { f } }$ , we give a loose small interval $\epsilon$ with respect to $\pi$ . In particularly, we set $0 < \epsilon < e ^ { - N }$ .
288
+
289
+ $$
290
+ \operatorname* { P r } _ { \vec { f } \in \mathfrak { F } ( \vec { y } , L _ { f } ) } \left\{ \mathcal { L } _ { ( \vec { f } - \vec { y } ) , \vec { f } } = \frac { \pi } { 2 } \right\} \le \operatorname* { P r } _ { \vec { f } \in \mathfrak { F } ( \vec { y } , L _ { f } ) } \left\{ \frac { \pi - \epsilon } { 2 } \le \mathcal { L } _ { ( \vec { f } - \vec { y } ) , \vec { f } } \le \frac { \pi + \epsilon } { 2 } \right\} & = \frac { \epsilon } { \pi } < \frac { 1 } { \pi e ^ { N } } .
291
+ $$
292
+
293
+ Now we are ready to proof Lemma 5.2.
294
+
295
+ ![](images/a5c1e0785c0351f5517470c0c51bc1f1cb1475e735aacc421e02a91b1c0d879d.jpg)
296
+ Figure 2: An illustration of Lemma 5.3 (the left) and Lemma 5.4 (the right)
297
+
298
+ Proof. (of Lemma 5.2)
299
+
300
+ We denote $\mathcal { A }$ the event that at least one of $\vec { e } _ { j } \in \boldsymbol { B } _ { \mathbb { R } ^ { K } }$ is the minimizer of $L ( \vec { \theta } )$ for convenience.
301
+
302
+ $$
303
+ \begin{array} { r l } { ^ { \mathrm { a } _ { L } } ( w ) - \dot { \bar { \mathbf { \xi } } } \overset { \mathrm { a v e ~ s v a m e ~ \overset { } { \mathrm { s o } } \mathrm { { \ u s } } } } { } } & { } \\ { } & { \Rightarrow [ \frac { \partial L } { \partial \theta _ { t } } ] _ { t \in [ K ] ^ { + } } | \check { \vec { \theta } } _ { \vec { \theta } \vec { e } _ { s } } = 2 [ \bigl \langle \vec { f } _ { s } - \vec { \mathbf { y } } , \vec { f } _ { t } \bigr \rangle ] _ { t \in [ K ] ^ { + } } = [ \boldsymbol { 0 } ] _ { K \times 1 } \mathrm { f o r ~ s o m e } s \in [ K ] ^ { + } } \\ { } & { \Rightarrow \bigl \langle \vec { f } _ { 1 } ^ { + } - \vec { \mathbf { y } } , \vec { f } _ { 1 } ^ { + } \bigr \rangle = 0 \wedge \bigl \langle \vec { f } _ { 1 } ^ { + } - \vec { \mathbf { y } } , \vec { f } _ { 2 } ^ { + } \bigr \rangle = 0 \wedge \dots \wedge \bigl \langle \vec { f } _ { 1 } ^ { + } - \vec { y } , \vec { f } _ { K } ^ { * } \bigr \rangle = 0 } \\ { } & { \qquad \mathrm { o r ~ } \cdot \cdot \cdot \mathrm { \ o r ~ } \bigl \langle \vec { f } _ { K } ^ { + } - \vec { \mathbf { y } } , \vec { f } _ { 1 } ^ { + } \bigr \rangle = 0 \wedge \bigl \langle \vec { f } _ { K } - \vec { \mathbf { y } } , \vec { f } _ { 2 } ^ { + } \bigr \rangle = 0 \wedge \cdot \cdot \cdot \wedge \bigl \langle \vec { f } _ { K } - \vec { \mathbf { y } } , \vec { f } _ { K } ^ { - } \bigr \rangle = 0 } \end{array}
304
+ $$
305
+
306
+ Hence, for given $\vec { \bf y }$ and $L ( f _ { j } ) = \Big \| \vec { f } _ { j } - \vec { y } \Big \| ^ { 2 } , \forall \in [ K ] ^ { + }$ , we have
307
+
308
+ $$
309
+ \begin{array} { r l } & { \operatorname* { P r } \left\{ \mathbb { I } _ { L ( \vec { w } ) } = 1 \right\} \underset { j \in [ K ] ^ { + } } { \le } \underset { f \in [ K ] ^ { + } } { \sum } \operatorname* { P r } \left\{ \langle \vec { f } _ { j } - \vec { \bf y } , \vec { f } _ { 1 } \rangle = 0 \land \langle \vec { f } _ { j } - \vec { \bf y } , \vec { f } _ { 2 } \rangle = 0 \land \cdots \land \langle \vec { f } _ { j } - \vec { \bf y } , \vec { f } _ { K } \rangle = 0 \right\} } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad < \frac { K } { \pi e ^ { N } } , } \end{array}
310
+ $$
311
+
312
+ where the second inequality is based on the symmetry between $\vec { f _ { s } }$ and $\vec { f } _ { t }$ for any $s , t \in [ K ] ^ { + }$ , and the last inequality is by Lemma 5.3. 厂
313
+
314
+ Proof. (of Theorem 3) We start from a simple case:
315
+
316
+ Claim: $\exists \beta \in \mathbb { R }$ s.t.
317
+
318
+ $$
319
+ \sum _ { i \in [ N ] } { ( f _ { 1 } ( x _ { i } ) - y _ { i } ) ^ { 2 } } - \sum _ { i \in [ N ] } { ( f _ { 1 } ( x _ { i } ) + \beta f _ { 2 } ( x _ { i } ) - y _ { i } ) ^ { 2 } } > 0 .
320
+ $$
321
+
322
+ Proof.
323
+
324
+ $$
325
+ \begin{array} { r l } { \displaystyle \sum _ { i \in [ N ] } \left( f _ { 1 } ( x _ { i } ) - y _ { i } \right) ^ { 2 } - \sum _ { i \in [ N ] } \left( f _ { 1 } ( x _ { i } ) + \beta f _ { 2 } ( x _ { i } ) - y _ { i } \right) ^ { 2 } } & { } \\ { = \displaystyle \sum _ { i \in [ N ] } \left[ \left( f _ { 1 } ( x _ { i } ) - y _ { i } \right) ^ { 2 } - \left( f _ { 1 } ( x _ { i } ) + \beta f _ { 2 } ( x _ { i } ) - y _ { i } \right) ^ { 2 } \right] } & { } \\ { = \left[ - \displaystyle \sum _ { i \in [ N ] } f _ { 1 } ( x _ { i } ) ^ { 2 } \right] \beta ^ { 2 } + \left[ 2 \displaystyle \sum _ { i \in [ N ] } \left( f _ { 2 } ( x _ { i } ) y _ { i } - f _ { 2 } ( x _ { i } ) f _ { 1 } ( x _ { i } ) \right) \right] \beta } \end{array}
326
+ $$
327
+
328
+ Observe that the above is a quadratic equation of $\beta$ with negative leading coefficient. Hence, to obtain the maximum of the difference, we can set
329
+
330
+ $$
331
+ \beta = \frac { \sum _ { i \in [ N ] } \big ( f _ { 2 } ( x _ { i } ) y _ { i } - f _ { 2 } ( x _ { i } ) f _ { 1 } ( x _ { i } ) \big ) } { \sum _ { i \in [ N ] } f _ { 1 } ( x _ { i } ) ^ { 2 } } = \frac { \langle \vec { y } - \vec { f _ { 1 } } , \vec { f _ { 2 } } \rangle } { \langle \vec { f _ { 2 } } , \vec { f _ { 2 } } \rangle }
332
+ $$
333
+
334
+ Note that if $\langle \vec { y } - \vec { f } _ { 1 } , \vec { f } _ { 2 } \rangle = 0$ then the last pre-trained component is no need to be added. We aim to calculate the probability of this case. Observe that $\langle \vec { y } - \vec { f _ { 1 } } , \vec { f _ { 2 } } \rangle = 0 \Leftrightarrow ( \vec { y } - \vec { f _ { 1 } } ) \perp \vec { f _ { 2 } }$ . This condition is different from previous Lemma. Here we have to find the upper bound of the probability of $( \vec { y } - \vec { f } _ { 1 } ) \perp \vec { f } _ { 2 }$ for given $\vec { f } _ { 1 }$ and ${ \vec { y } } .$ . As shown in the left part of Figure 2), the angle between $\vec { f } _ { 2 }$ and $\vec { y }$ must be in a specific interval, say $\textstyle [ { \frac { \pi - \epsilon } { 2 } } , { \frac { \pi + \epsilon } { 2 } } ]$ for small $\epsilon \in \mathbb { R } ^ { + }$ . In order to be concrete, we set $0 < \epsilon < e ^ { - N }$ .
335
+
336
+ $$
337
+ \operatorname* { P r } _ { \vec { f } \in \mathfrak { F } ( \vec { \mathfrak { y } } , 1 ) } \left\{ \big ( \vec { y } - \vec { f _ { 1 } } \big ) \perp \vec { f _ { 2 } } \right\} \leq \frac { \epsilon } { \pi } < \frac { 1 } { \pi e ^ { N } } .
338
+ $$
339
+
340
+ The general case can be reduced to the above claim by considering $g _ { K - 1 }$ as $f _ { 1 }$ and $\theta _ { k } f _ { K }$ as $\beta f _ { 2 }$ . Furthermore, since there there $K$ possibles the be selected as the least pre-trained component, the probability is upper bounded by $\frac { \star } { \pi e ^ { N } }$ . □
341
+
342
+ # 8.2 FUNCTION COMPOSITION BY NON-LINEAR ACTIVATION
343
+
344
+ Proof. (of Lemma 5.4) Although the lemma is an existence statement, we give a constructive proof here. By setting $D = 1$ in Proposition 8.1, we know that for Logistic $S ( z )$ and $0 < \epsilon < 1 / 1 0 0 0$ , the degree-one Taylor approximation $\begin{array} { r } { A _ { S ( z ) , 1 } = \frac { 1 } { 2 } + \frac { 1 } { 4 } z } \end{array}$ with the remainder $| R _ { S ( z ) , 2 } | < \epsilon$ . Define $M : =$ $1 0 \cdot \operatorname* { m a x } _ { j \in [ K ] ^ { + } , i \in [ N ] } \left\{ | f _ { j } ( x _ { i } ) | \right\}$ . Hence by setting $\begin{array} { r } { z = \frac { f _ { j } ( \mathbf { x } _ { j } ) } { M } } \end{array}$ , we have $\begin{array} { r } { \left| S \left( \frac { f _ { j } ( \mathbf { x } _ { j } ) } { M } \right) - \frac { 1 } { 2 } - \frac { f _ { j } ( \mathbf { x } _ { j } ) } { 4 M } \right| < } \end{array}$ $\epsilon$ . This means that for the given $j \in [ K ]$ , $\textstyle \theta _ { j } = { \frac { 1 } { M } }$ , $\theta _ { 0 } =$ and for all $j ^ { \prime } \ne j$ , $\theta _ { j ^ { \prime } } = 0$ . Furthermore, $\alpha = 4 M$ . □
345
+
346
+ This lemma implies that the $S ( z )$ can approximate linear function as possible in a non-zero length interval, hence if the scaling of $\vec { \theta }$ is allowed then Theorem 1 can be applied.
347
+
348
+ Corollary 8.1. If the activation function is the Logistic, $S ( z )$ , and $\{ f _ { j } ( \mathbf { x } _ { j } ) \} _ { j = 1 } ^ { K }$ satisfies LIC, then with high probability there is a vector $\vec { \theta }$ s.t. $\begin{array} { r } { L _ { \vec { \theta } } \left( \mathbf { x } ; \sigma \circ \Theta _ { ( 0 ) } ( f _ { 1 } , . . . , f _ { K } ) \right) < \operatorname* { m i n } _ { j \in [ K ] ^ { + } } L ( f _ { j } ( \mathbf { x } _ { j } ) ) } \end{array}$ .
349
+
350
+ Proof. Set $\epsilon$ of above Lemma as $\frac { \epsilon ^ { * } } { 3 N }$ , then previous Lemma shows that there exists $\theta$ which maps $\{ f _ { j } \}$ into $\mathcal { Z } _ { \sigma \circ \Theta _ { ( 0 ) } , 1 , \frac { \epsilon ^ { * } } { 3 N } }$ . Since the output of $\sigma \circ \Theta _ { ( 0 ) }$ is a linear function with error at most 3N , we have the same conclusion. □
351
+
352
+ Proof. Let $g ( \mathbf { x } ) = \sigma \circ \Theta _ { ( 0 ) } ( f _ { 1 } , . . . , f _ { K } ) ( \mathbf { x } )$ for short. First observe that $\begin{array} { r } { | g ( \mathbf { x } ) - f _ { j } ( \mathbf { x } ) | < \frac { \epsilon ^ { * } } { 3 N } \Rightarrow } \end{array}$ $\begin{array} { r } { \forall i \in [ N ] , g ( \mathbf { x } ^ { ( i ) } ) - f _ { j } ( \mathbf { x } ^ { ( i ) } ) > \frac { - \epsilon ^ { * } } { 3 N } } \end{array}$ . Then
353
+
354
+ $$
355
+ \sum _ { i \in [ N ] } \left( g ( \mathbf { x } ^ { ( i ) } ) - \mathbf { y } ^ { ( i ) } \right) = \sum _ { i \in [ N ] } \left\{ \left( g ( \mathbf { x } ^ { ( i ) } ) - f _ { j } ( \mathbf { x } ^ { ( i ) } ) \right) + \left( f _ { j } ( \mathbf { x } ^ { ( i ) } ) - \mathbf { y } ^ { ( i ) } \right) \right\} > N \cdot \frac { - \epsilon ^ { * } } { 3 N } + \epsilon ^ { * } = \frac { 2 \epsilon ^ { * } } { 3 } > 0 .
356
+ $$
357
+
358
+ On the other hand, it can be calculated that
359
+
360
+ $$
361
+ \nabla _ { \vec { \theta } } L \left( \mathbf { x } ; g \right) | _ { \vec { \theta } = \vec { \theta } _ { \epsilon ^ { * } / 3 } } = \left( \frac { \partial L } { \partial w _ { 0 } } , \frac { \partial L } { \partial \theta _ { 1 } } , . . . , \frac { \partial L } { \partial \theta _ { K } } , \frac { \partial L } { \partial b _ { 0 } } \right) ^ { T } | _ { \vec { \theta } = \vec { \theta } _ { \epsilon ^ { * } / 3 } } ,
362
+ $$
363
+
364
+ where $[ a ] ^ { T }$ is the transpose of the matrix $[ a ]$ . Also note that ∂L∂w0 |θ\~=θ\~∗/3 = 2 · $\begin{array} { r } { \sum _ { i \in [ N ] } \left( g ( \mathbf { x } ^ { ( i ) } ) - \mathbf { y } ^ { ( i ) } \right) \cdot S ( z ) } \end{array}$ , and $\begin{array} { r l r } { \frac { \partial L } { \partial b _ { 0 } } | _ { \vec { \theta } = \vec { \theta } _ { \epsilon ^ { * } / 3 } } } & { = } & { 2 \mathbf { \nabla } \cdot \sum _ { i \in [ N ] } \left( g ( \mathbf { x } ^ { ( i ) } ) - \mathbf { y } ^ { ( i ) } \right) \cdot 1 } \end{array}$ . Since $\begin{array} { r } { \sum _ { i \in [ N ] } \left( g ( \mathbf { x } ^ { ( i ) } ) - \mathbf { y } ^ { ( i ) } \right) > 0 } \end{array}$ , we can conclude $\nabla _ { \vec { \theta } } L \left( \mathbf { x } ; g \right) | _ { \vec { \theta } = \vec { \theta } _ { \epsilon ^ { * } / 3 } } \neq \vec { 0 }$ . □
365
+
366
+ Proof. (of Lemma 5.6 ) By previous Lemma, it is valid to consider the best performance component, $f _ { j ^ { * } }$ ; i.e. $\begin{array} { r } { L ( f _ { j ^ { * } } ) = \operatorname* { m i n } _ { j \in [ K ] ^ { + } } L ( f _ { j } ( \mathbf { x } _ { j } ) ) } \end{array}$ . Since $\nabla _ { \vec { \theta } } L ( \vec { \theta } _ { \epsilon ^ { * } / 3 } ) \neq \vec { 0 }$ , by definition of the gradient, moving along the direction of $- \nabla _ { \vec { \theta } } L ( \vec { \theta _ { \epsilon ^ { * } / 3 } } ) / \left. \nabla _ { \vec { \theta } } L ( \vec { \theta _ { \epsilon ^ { * } / 3 } } ) \right.$ with a step-size $\alpha > 0$ must strictly decrease the value of $L _ { \vec { \theta } } ( \mathbf { x } ; g )$ . W.L.O.G, we can assume this $\alpha$ is optimal; that is, if $\alpha > r > 0$ then $L ( \vec { \theta } _ { \epsilon ^ { * } / 3 } ) > L ( \vec { \theta } _ { \epsilon ^ { * } / 3 } ) - r \cdot \nabla _ { \vec { \theta } } L ( \vec { \theta _ { \epsilon ^ { * } / 3 } } ) / \left. \nabla _ { \vec { \theta } } L ( \vec { \theta } _ { \epsilon ^ { * } / 3 } ) \right.$ , while if $r = \alpha + \delta$ for some $\delta > 0$ then
367
+
368
+ $L ( \vec { \theta } _ { \epsilon ^ { * } / 3 } ) \leq L ( \vec { \theta } _ { \epsilon ^ { * } / 3 } ) - r \cdot \nabla _ { \vec { \theta } } L ( \vec { \theta } _ { \epsilon ^ { * } / 3 } ) / \left\| \nabla _ { \vec { \theta } } L ( \vec { \theta } _ { \epsilon ^ { * } / 3 } ) \right\| .$ . The issue is how to find a proper step-size $r > 0 ?$ We consider the line search approach such that:
369
+
370
+ $$
371
+ r ^ { * } = \arg \operatorname* { m i n } _ { r \in \mathbb { R } } \left\{ L \left( \vec { \theta _ { 0 } } - r \cdot \frac { \nabla _ { \vec { \theta } } L ( \vec { \theta _ { 0 } } ) } { \left\| \nabla _ { \vec { \theta } } L ( \vec { \theta _ { 0 } } ) \right\| } \right) \right\}
372
+ $$
373
+
374
+ This outputs $F ^ { * }$ then we can make sure that $L \left( \vec { \theta _ { 0 } } \right) > L \left( \vec { \theta _ { 0 } } \right) - r \cdot \nabla _ { \vec { \theta } } L ( \vec { \theta _ { 0 } } ) / \left. \nabla _ { \vec { \theta } } L ( \vec { \theta _ { 0 } } ) \right.$ . Since the underlining $\theta _ { 0 }$ is $\vec { \theta _ { \epsilon ^ { * } / 3 } }$ that makes the loss is the same with the best one. Hence, we have $( \vec { \theta _ { 0 } } - r ^ { * } \cdot \nabla _ { \vec { \theta } } L ( \vec { \theta _ { \epsilon ^ { * } / 3 } } ) / \left\| \nabla _ { \vec { \theta } } L ( \vec { \theta _ { \epsilon ^ { * } / 3 } } ) \right\| )$ to fit our goal (beating the best one). □
375
+
376
+ Combining these lemmas can obtain the conclusion of Theorem 2.
377
+
378
+ Corollary 8.2. The process of Lemma 5.5 converges.
379
+
380
+ Proof. (of 8.2) It is know that if a monotone decreasing sequence is bounded below, then this sequence convergences. ..... (revising) Repeating the process of Lemma 2, we can obtain a strictly decreasing sequence: $L ( \vec { \theta _ { 0 } } ) > L ( \vec { \theta _ { 1 } } ) > L ( \vec { \theta _ { 2 } } ) > . . . .$ . Note that $\forall i , ( \vec { \theta _ { i } } ) \geq 0$ . This means the sequence is monotone decreasing and bounded below, so theoretically it converges by monotone convergence theorem of mathematical analysis. Algorithmically, the gradient descent based sequence finding process stops at some term with $\nabla _ { \vec { \theta } } { \cal L } ( \vec { \theta ^ { \prime } } ) = 0$ , which is a (local) minimum or a saddle point. □
381
+
382
+ Corollary 8.3. If the assumptions in Theorem 2 are satisfied, then with height probability there exists $ { \vec { \theta ^ { \prime } } }$ s.t. $L _ { \vec { \theta ^ { \prime } } }$ is a (local) minimum or a saddle point, while $\begin{array} { r } { L _ { \vec { \theta ^ { \prime } } } \left( \mathbf { x } ; g \right) < \operatorname* { m i n } _ { j \in [ K ] ^ { + } } \left| L \bigl ( f _ { j } ( \mathbf { x } _ { j } ) \bigr ) \right| } \end{array}$ still holds.
383
+
384
+ Assume the pre-trained component set $\{ f _ { j } ( \mathbf { x } _ { j } ) \} _ { j = 1 } ^ { K }$ satisfies both NPC and LIC, then there exists $\vec { \theta }$ s.t. $\begin{array} { r } { L _ { \vec { \theta } } ( \mathbf { x } ; g ) < \operatorname* { m i n } _ { j \in [ K ] ^ { + } } L ( f _ { j } ( \mathbf { x } _ { j } ) ) } \end{array}$ .
385
+
386
+ In the previous proof, the critical properties of activations are local linearity and differentiability. Hence, it is not hard to check that if we replace $\sigma ( \cdot )$ in Eq. (1) with other common activations, the conclusion still holds. By local linearity we mean that on a non-zero length interval in its domain, the function can approximate the linear mapping as well as possible.
387
+
388
+ Corollary 8.4. Theorem 1 and 2 can apply on any activations with local linearity and differentiability.
389
+
390
+ Based on Corollary 5.1 and Lemma 5.6, it is natural to obtain the process of finding $\vec { \theta }$ : by gradient descent or the closed form of Corollary 5.1. We can compute the optimal weights for the bottom Sigmiod block. On the other hand, after random initializing, the parameters of un-trained components in the Relu or Tanh blocks are assigned. This implies they can be treated as the all pre-trained case in Theorem 1 or 2. In fact, given the outputs from bottom level block then Corollary 5.1 provides weights improving the accuracy. Then it goes to the next up level block until the top, which is the forwarding steps of Back-propagation LeCun et al. (1988). Hence with initialization for un-trained component, Corollary 5.1 is essentially the same as Back-propagation.
391
+
392
+ # 8.3 A MIX OF PRE-TRAINED AND UN-TRAINED COMPONENTS
393
+
394
+ Now we first consider some of $\{ f _ { \Theta _ { j } } ( \mathbf { x } _ { j } ) \} _ { j = 1 } ^ { K }$ are pre-trained and some are un-trained, and then investigate the hierarchical combination of both kinds of components. In particularly, Eq. (1) can be re-written as $g ( \mathbf { x } ) = w _ { 0 } \cdot \sigma \left( \theta _ { 1 } f _ { 1 } + \theta _ { 2 } f _ { \Theta _ { 2 } } \right) + b _ { 0 }$ , where $f _ { 1 }$ is a pre-trained component and $f _ { \Theta _ { 2 } }$ is un-trained. Since $\Theta _ { 2 }$ is not fixed, it can not be checked that LIC and NPC assumptions are satisfied. On the other hand, after initialization, $f _ { \Theta _ { 2 } }$ can be seen as a pre-trained component at any a snapshot during training phase.
395
+
396
+ Theorem 5. In the end of an weight updating iteration, if the components $f _ { 1 }$ and $f _ { \Theta _ { 2 } }$ satisfy LIC and NPC assumptions, then with high probability w\~ updated in the next iteration can improve the loss.
397
+
398
+ Proof. Recall the training algorithm is the backpropagation algorithm. Also note that according to Eq. (1), the order of updating is $\vec { \theta }$ first and then $\Theta _ { 2 }$ . We denote in the end of iteration $i$ the value of $\vec { \theta }$ and $\Theta _ { 2 }$ as $\scriptstyle { \vec { \theta ^ { ( { i t e r = i } ) } } }$ and $\Theta _ { 2 } ^ { ( i t e r = i ) }$ , respectively. With randomized initialization, $\Theta _ { 2 }$ is assigned as Θ(iter=0)2 before the execution of the iteration 1. Then in each iteration i ≥ 1, g(x) is a combination of fixed parameter components. Hence this can reduce to the all pre-trained cases, and can apply Theorem 1 and 2. □
399
+
400
+ Lemma 8.1. For a given data set $X$ , let $\vec { g } : = ( g _ { 1 } , . . . , g _ { N } )$ and $\vec { y } = ( y _ { 1 } , . . . , y _ { N } )$ . If $\langle \vec { g } , \vec { g } - \vec { y } \rangle \neq 0 ,$ then there exists $\alpha \in \mathbb { R }$ s.t.
401
+
402
+ $$
403
+ \sum _ { i \in [ N ] } \left( \alpha g ( x _ { i } ) - y _ { i } \right) ^ { 2 } < \sum _ { i \in [ N ] } \left( g ( x _ { i } ) - y _ { i } \right) ^ { 2 }
404
+ $$
405
+
406
+ Proof. It is equivalent to show the inequality
407
+
408
+ $$
409
+ \sum _ { i \in [ N ] } \left( \alpha g ( x _ { i } ) - y _ { i } \right) ^ { 2 } - \sum _ { i \in [ N ] } \left( g ( x _ { i } ) - y _ { i } \right) ^ { 2 } < 0
410
+ $$
411
+
412
+ has a real number solution.
413
+
414
+ $$
415
+ \begin{array} { l } { { \displaystyle \sum _ { i \in [ N ] } \left[ ( \alpha g ( x _ { i } ) - y _ { i } ) ^ { 2 } - ( g ( x _ { i } ) - y _ { i } ) ^ { 2 } \right] } } \\ { { \displaystyle \qquad = \left( \sum _ { i \in [ N ] } g ( x _ { i } ) ^ { 2 } \right) \alpha ^ { 2 } + \left( - 2 \sum _ { i \in [ N ] } g ( x _ { i } ) y _ { i } \right) \alpha + \left( - \sum _ { i \in [ N ] } g ( x _ { i } ) ^ { 2 } + 2 g ( x _ { i } ) y _ { i } \right) } } \\ { { \displaystyle \qquad = \langle \vec { g } , \vec { g } \rangle \alpha ^ { 2 } + ( - 2 \langle \vec { g } , \vec { y } \rangle ) \alpha + \left( - \langle \vec { g } , \vec { g } \rangle + 2 \langle \vec { g } , \vec { y } \rangle \right) . } } \end{array}
416
+ $$
417
+
418
+ This is a quadratic inequality of $\alpha$ , hence if
419
+
420
+ $$
421
+ \begin{array} { r } { \left( - 2 \langle \vec { g } , \vec { y } \rangle \right) ^ { 2 } - 4 \left( \langle \vec { g } , \vec { g } \rangle \right) \left( - \langle \vec { g } , \vec { g } \rangle + 2 \langle \vec { g } , \vec { y } \rangle \right) \geq 0 , } \end{array}
422
+ $$
423
+
424
+ then there exists at least one real solution.
425
+
426
+ Now we first consider some of $\{ f _ { \Theta _ { j } } ( \mathbf { x } _ { j } ) \} _ { j = 1 } ^ { K }$ are pre-trained and some are un-trained, and then investigate the hierarchical combination of both kinds of components. In particularly, Eq. (1) can be re-written as $g ( \mathbf { x } ) = w _ { 0 } \cdot \sigma \left( \theta _ { 1 } f _ { 1 } + \theta _ { 2 } f _ { \Theta _ { 2 } } \right) + b _ { 0 }$ , where $f _ { 1 }$ is a pre-trained component and $f _ { \Theta _ { 2 } }$ is un-trained. Since $\Theta _ { 2 }$ is not fixed, it can not be checked that LIC and NPC assumptions are satisfied. On the other hand, after initialization, $f _ { \Theta _ { 2 } }$ can be seen as a pre-trained component at any a snapshot during training phase.
427
+
428
+ # 8.4 GENERALIZATION ERROR ANALYSIS
429
+
430
+ Theorem 4. Assume pre-trained components $\{ f _ { j } \} _ { j = 1 } ^ { K }$ satisfy LIC and NPC. Let $\{ G E ( f _ { j } ) \} _ { j = 1 } ^ { K }$ be corresponding generalization errors of $\{ f _ { j } \} _ { j = 1 } ^ { K }$ , and $\Theta _ { ( L ) } \circ \sigma _ { ( L ) } \circ \cdot \cdot \cdot \circ \sigma _ { ( 1 ) } \circ \Theta _ { ( 0 ) } ( f _ { 1 } , . . . , f _ { K } ) b e$ the composite neural network. Denote the generalization error, $\mathbf { E } \{ L ( \Theta _ { ( L ) } \circ \sigma _ { ( L ) } \circ \cdot \cdot \cdot \circ \sigma _ { ( 1 ) } \circ$ $\Theta _ { ( 0 ) } ( f _ { 1 } , . . . , f _ { K } ) ) \}$ , of the composite neural network as $\mathbf { E } \{ L _ { \Theta , f _ { 1 } , \dots , f _ { K } } \}$ . Suppose the learned weights obey the normal distribution. Then with high probability, there exist a setting of $\{ \Theta _ { ( L ) } ^ { * } , . . . , \Theta _ { ( 0 ) } ^ { * } \}$ such that $\mathbf { E } \{ L _ { \Theta , f _ { 1 } , . . . , f _ { K } } \} \le \Theta _ { ( L ) } ^ { * } ( G E ( f _ { 1 } ) , . . . G _ { E } ( f _ { K } ) ) ,$ .
431
+
432
+ Proof. (of Theorem 4) (Proof Sketch) We apply the idea similar to Kawaguchi (2016): the exception of non-liner activations is same with the exception of liner activations. Previous theorems provide that with high probability there exists the solution of $\Theta _ { ( i ) } , \forall i \in [ L ] ^ { + }$ s.t. each $\Theta _ { ( i ) + 1 } \sigma \Theta _ { ( i ) }$ approximates a degree one polynomial $A _ { \Theta _ { ( i ) + 1 } \sigma \Theta _ { ( i ) } , 1 }$ as well as possible. If the weights are obey the normal distribution, then $\mathbf { E } \{ L _ { \Theta , f _ { 1 } , . . . , f _ { K } } \} \le \Theta _ { ( L ) } ^ { * } ( G E ( f _ { 1 } ) , . . . G _ { E } ( f _ { K } ) )$ . □
md/train/Hyl9ahVFwH/Hyl9ahVFwH.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/J8_GttYLFgr/J8_GttYLFgr.md ADDED
@@ -0,0 +1,511 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TRAJECTORY PREDICTION USING EQUIVARIANT CONTINUOUS CONVOLUTION
2
+
3
+ Robin Walters ∗
4
+ Northeastern University
5
+ r.walters@northeastern.edu
6
+ Jinxi Li∗
7
+ Northeastern University
8
+ li.jinxi1@northeastern.edu
9
+ Rose Yu
10
+ University of California, San Diego
11
+ roseyu@ucsd.edu
12
+
13
+ # ABSTRACT
14
+
15
+ Trajectory prediction is a critical part of many AI applications, for example, the safe operation of autonomous vehicles. However, current methods are prone to making inconsistent and physically unrealistic predictions. We leverage insights from fluid dynamics to overcome this limitation by considering internal symmetry in real-world trajectories. We propose a novel model, Equivariant Continous COnvolution (ECCO) for improved trajectory prediction. ECCO uses rotationallyequivariant continuous convolutions to embed the symmetries of the system. On both vehicle and pedestrian trajectory datasets, ECCO attains competitive accuracy with significantly fewer parameters. It is also more sample efficient, generalizing automatically from few data points in any orientation. Lastly, ECCO improves generalization with equivariance, resulting in more physically consistent predictions. Our method provides a fresh perspective towards increasing trust and transparency in deep learning models. Our code and data can be found at https://github.com/Rose-STL-Lab/ECCO.
16
+
17
+ # 1 INTRODUCTION
18
+
19
+ Trajectory prediction is one of the core tasks in AI, from the movement of basketball players to fluid particles to car traffic (Sanchez-Gonzalez et al., 2020; Gao et al., 2020; Shah & Romijnders, 2016). A common abstraction underlying these tasks is the movement of many interacting agents, analogous to a many-particle system. Therefore, understanding the states of these particles, their dynamics, and hidden interactions is critical to accurate and robust trajectory forecasting.
20
+
21
+ Even for purely physical systems such as in particle physics, the complex interactions among a large number of particles makes this a difficult problem. For vehicle or pedestrian trajectories, this challenge is further compounded with latent factors such as human psychology. Given these difficulties, current approaches require large amounts of training data and many model parameters. State-of-the-art methods in this domain such as Gao et al. (2020) are based on graph neural networks. They do not exploit the physical properties of system and often make predictions which are not self-consistent or physically meaningful. Furthermore, they predict a single agent trajectory at a time instead of multiple agents simultaneously.
22
+
23
+ ![](images/c194779fdbb7b5a7b45a478540e0efcf875ec81e36fa9a18c1b5d0fcfc7f680a.jpg)
24
+ Figure 1: Car trajectories in two scenes. Though the entire scenes are not related by a rotation, the circled areas are. ECCO exploits this symmetry to improve generalization and sample efficiency.
25
+
26
+ Our model is built upon a key insight of many-particle systems pertaining to intricate internal symmetry. Consider a model which predicts the trajectory of cars on a road. To be successful, such a model must understand the physical behavior of vehicles together with human psychology. It should distinguish left from right turns, and give consistent outputs for intersections rotated with different orientation. As shown in Figure 1, a driver’s velocity rotates with the entire scene, whereas vehicle interactions are invariant to such a rotation. Likewise, psychological factors such as reaction speed or attention may be considered vectors with prescribed transformation properties. Data augmentation is a common practice to deal with rotational invariance, but it cannot guarantee invariance and requires longer training. Since rotation is a continuous group, augmentation requires sampling from infinitely many possible angles.
27
+
28
+ In this paper, we propose an equivariant continuous convolutional model, ECCO, for trajectory forecasting. Continuous convolution generalizes discrete convolution and is adapted to data in manyparticle systems with complex local interactions. Ummenhofer et al. (2019) designed a model using continuous convolutions for particle-based fluid simulations. Meanwhile, equivariance to group symmetries has proven to be a powerful tool to integrate physical intuition in physical science applications (Wang et al., 2020; Brown & Lunter, 2019; Kanwar et al., 2020). Here, we test the hypothesis that an equivariant model can also capture internal symmetry in non-physical human behavior. Our model utilizes a novel weight sharing scheme, torus kernels, and is rotationally equivariant.
29
+
30
+ We evaluate our model on two real-world trajectory datasets: Argoverse autonomous vehicle dataset (Chang et al., 2019) and TrajNet+ $^ +$ pedestrian trajectory forecasting challenge (Kothari et al., 2020). We demonstrate on par or better prediction accuracy to baseline models and data augmentation with fewer parameters, better sample efficiency, and stronger generalization properties. Lastly, we demonstrate theoretically and experimentally that our polar coordinate-indexed filters have lower equivariance discretization error due to being better adapted to the symmetry group.
31
+
32
+ Our main contributions are as follows:
33
+
34
+ • We propose Equivariant Continous COnvolution (ECCO), a rotationally equivariant deep neural network that can capture internal symmetry in trajectories.
35
+ • We design ECCO using a novel weight sharing scheme based on orbit decomposition and polar coordinate-indexed filters. We implement equivariance for both the standard and regular representation $L ^ { 2 } ( \mathrm { S O } ( 2 ) )$ .
36
+ • On benchmark Argoverse and TrajNet++ datasets, ECCO demonstrates comparable accuracy while enjoying better generalization, fewer parameters, and better sample complexity.
37
+
38
+ # 2 RELATED WORK
39
+
40
+ Trajectory Forecasting For vehicle trajectories, classic models in transportation include the CarFollowing model (Pipes, 1966) and Intelligent Driver model (Kesting et al., 2010). Deep learning has also received considerable attention; for example, Liang et al. (2020) and Gao et al. (2020) use graph neural networks to predict vehicle trajectories. Djuric et al. (2018) use rasterizations of the scene with CNN. See the review paper by Veres & Moussa (2019) for deep learning in transportation. For human trajectory modeling, Alahi et al. (2016) propose Social LSTM to learn these humanhuman interactions. TrajNet (Sadeghian et al., 2018) and TrajNet+ $^ { \cdot + }$ (Kothari et al., 2020) introduce benchmarking for human trajectory forecasting. We refer readers to Rudenko et al. (2020) for a comprehensive survey. Nevertheless, many deep learning models are data-driven. They require large amounts of data, have many parameters, and can generate physically inconsistent predictions.
41
+
42
+ Continuous Convolution Continuous convolutions over point clouds (CtsConv) have been successfully applied to classification and segmentation tasks (Wang et al., 2018; Lei et al., 2019; Xu et al., 2018; Wu et al., 2019; Su et al., 2018; Li et al., 2018; Hermosilla et al., 2018; Atzmon et al., 2018; Hua et al., 2018). More recently, a few works have used continuous convolution for modeling trajectories or flows. For instance, Wang et al. (2018) uses CtsConv for inferring flow on LIDAR data. Schenck & Fox (2018) and Ummenhofer et al. (2019) model fluid simulation using CtsConv. Closely related to our work is Ummenhofer et al. (2019), who design a continuous convolution network for particle-based fluid simulations. However, they use a ball-to-sphere mapping which is not well-adapted for rotational equivariance and only encode 3 frames of input. Graph neural networks (GNNs) are a related strategy which have been used for modeling particle system dynamics (Sanchez-Gonzalez et al., 2020). GNNs are also permutation invariant, but they do not natively encode relative positions and local interaction as a CtsConv-based network does.
43
+
44
+ Equivariant and Invariant Deep Learning Developing neural nets that preserve symmetries has been a fundamental task in image recognition (Cohen et al., 2019b; Weiler & Cesa, 2019; Cohen & Welling, 2016a; Chidester et al., 2018; Lenc & Vedaldi, 2015; Kondor & Trivedi, 2018; Bao & Song, 2019; Worrall et al., 2017; Cohen & Welling, 2016b; Weiler et al., 2018; Dieleman et al., 2016; Maron et al., 2020). Equivariant networks have also been used to predict dynamics: for example, Wang et al. (2020) predicts fluid flow using Galilean equivariance but only for gridded data. Fuchs et al. (2020) use SE(3)-equivariant transformers to predict trajectories for a small number of particles as a regression task. As in this paper, both Bekkers (2020) and Finzi et al. (2020) address the challenge of parameterizing a kernel over continuous Lie groups. Finzi et al. (2020) apply their method to trajectory prediction on point clouds using a small number of points following strict physical laws. Worrall et al. (2017) also parameterizes convolutional kernels using polar coordinates, but maps these onto a rectilinear grid for application to image data. Weng et al. (2018) address rotational equivariance by inferring a global canonicalization of the input. Similar to our work, Esteves et al. (2018) use functions evenly sampled on the circle, however, their features are only at a single point whereas we assign feature vectors to each point in a point cloud. Thomas et al. (2018) introduce Tensor Field Networks which are SO(3)-equivariant continuous convolutions. Unlike our work, both Worrall et al. (2017) and Thomas et al. (2018) define their kernels using harmonic functions. Our weight sharing method using orbits and stabilizers is simpler as it does not require harmonic functions or Clebsch-Gordon coefficients. Unlike previous work, we implement a regular representation for the continuous rotation group SO(2) which is compatible with pointwise nonlinearities and enjoys an empirical advantage over irreducible representations.
45
+
46
+ # 3 BACKGROUND
47
+
48
+ We first review the necessary background of continuous convolution and rotational equivariance.
49
+
50
+ # 3.1 CONTINUOUS CONVOLUTION
51
+
52
+ Continuous convolution (CtsConv) generalizes the discrete convolution to point clouds. It provides an efficient and spatially aware way to model the interactions of nearby particles. Let $\mathbf { f } ^ { ( i ) } \in \mathbb { R } ^ { c _ { \mathrm { i n } } }$ denote the feature vector of particle $i$ . Thus $\mathbf { f }$ is a vector field which assigns to the points $\mathbf { x } ^ { ( i ) }$ a vector in $\mathbb { R } ^ { c _ { \mathrm { i n } } }$ . The kernel of the convolution $K \colon \mathbb { R } ^ { 2 } \mathbb { R } ^ { c _ { \mathrm { o u t } } \times c _ { \mathrm { i n } } }$ is a matrix field: for each point $\mathbf { x } \in \mathbb { R } ^ { 2 }$ , $K ( \mathbf { x } )$ is a $c _ { \mathrm { o u t } } \times c _ { \mathrm { i n } }$ matrix. Let $a$ be a radial local attention map with $a ( r ) = 0$ for $r > R$ . The output feature vector $\mathbf { g } ^ { ( i ) }$ of particle $i$ from the continous convolution is given by
53
+
54
+ $$
55
+ \mathbf { g } ^ { ( i ) } = \mathsf { C t s C o n v } _ { K , R } ( \mathbf { x } , \mathbf { f } ; \mathbf { x } ^ { ( i ) } ) = \sum _ { j } a ( \| \mathbf { x } ^ { ( j ) } - \mathbf { x } ^ { ( i ) } \| ) K ( \mathbf { x } ^ { ( j ) } - \mathbf { x } ^ { ( i ) } ) \cdot \mathbf { f } ^ { ( j ) } .
56
+ $$
57
+
58
+ CtsConv is naturally equivariant to permutation of labels and is translation invariant. Equation 1 is closely related to graph neural network (GNN) (Kipf & Welling, 2017; Battaglia et al., 2018), which is also permutation invariant. Here the graph is dynamic and implicit with nodes $\mathbf { x } ^ { ( i ) }$ and edges $e _ { i j }$ if $\| \mathbf { x } ^ { ( i ) } - \mathbf { x } ^ { ( j ) } \| < R$ . Unlike a GNN which applies the same weights to all neighbours, the kernel $K$ depends on the relative position vector $\mathbf { x } ^ { ( i ) } - \mathbf { x } ^ { ( j ) }$ .
59
+
60
+ # 3.2 ROTATIONAL EQUIVARIANCE
61
+
62
+ Continuous convolution is not naturally rotationally equivariant. Fortunately, we can translate the technique of rotational equivariance on CNNs to continuous convolutions. We use the language of Lie groups and their representations. For more background, see Hall (2015) and Knapp (2013).
63
+
64
+ More precisely, we denote the symmetry group of 2D rotations by $\operatorname { S O } ( 2 ) = \{ { \mathrm { R o t } } _ { \theta } : 0 \leq \theta <$ $2 \pi \}$ . As a Lie group, it has both a group structure $\mathrm { R o t } _ { \theta _ { 1 } } \circ \mathrm { R o t } _ { \theta _ { 2 } } = \mathrm { R o t } _ { ( \theta _ { 1 } + \theta _ { 2 } ) \mathrm { m o d } 2 \pi }$ which a continuous map with respect to the topological structure. As a manifold, SO(2) is homomeomorphic to the circle $\Dot { S ^ { 1 } } \cong \{ \mathbf { x } \ \overset { \cdot } { \in } \ \mathbb { R } ^ { 2 } \ : \ \lVert \mathbf { x } \rVert = \ 1 \}$ . The group $\mathrm { S O } ( 2 )$ can act on a vector space $\mathbb { R } ^ { c }$ by specifying a representation map $\rho \colon \mathsf { S O } ( 2 ) \ \mathsf { \Gamma } \to \mathsf { G L } ( \mathbb { R } ^ { c } )$ which assigns to each element of SO(2) an element of the set of invertible $c \times c$ matrices ${ \mathrm { G L } } ( \mathbb { R } ^ { c } )$ . The map $\rho$ must a be homomorphism $\rho ( \mathrm { R o t } _ { \theta _ { 1 } } ) \rho ( \mathrm { R o t } _ { \theta _ { 1 } } ) = \rho ( \mathrm { R o t } _ { \theta _ { 1 } } \circ \mathrm { R o t } _ { \theta _ { 2 } } )$ . For example, the standard representation $\rho _ { 1 }$ on $\mathbb { R } ^ { 2 }$ is by $2 \times 2$ rotation matrices. The regular representation $\rho _ { \mathrm { r e g } }$ on $L ^ { 2 } ( \operatorname { S O } ( { \bar { 2 } } ) ) = \{ \varphi : \operatorname { S O } ( 2 ) \to \mathbb { R } :$ $| \varphi | ^ { 2 }$ is integrable $\}$ is $\rho _ { \mathrm { r e g } } ( \mathrm { R o t } _ { \phi } ) ( \varphi ) = \varphi \circ \mathrm { R o t } _ { - \phi }$ . Given input f with representation $\rho _ { \mathrm { i n } }$ and output with representation $\rho _ { \mathrm { o u t } }$ , a map $F$ is SO(2)-equivariant if
65
+
66
+ $$
67
+ F ( \rho _ { \mathrm { i n } } ( \mathrm { R o t } _ { \theta } ) { \bf f } ) = \rho _ { \mathrm { o u t } } ( \mathrm { R o t } _ { \theta } ) F ( { \bf f } ) .
68
+ $$
69
+
70
+ Discrete CNNs are equivariant to a group $G$ if the input, output, and hidden layers carry a $G$ -action and the linear layers and activation functions are all equivariant (Kondor $\&$ Trivedi, 2018). One method for constructing equivariant discrete CNNs is steerable CNN (Cohen & Welling, 2016b). Cohen et al. (2019a) derive a general constraint for when a convolutional kernel $K \colon \mathbb { R } ^ { b } \mathbf { \bar { \mathbb { R } } } ^ { c _ { \mathrm { o u t } } \times c _ { \mathrm { i n } } }$ is $G$ -equivariant. Assume $G$ acts on $\mathbb { R } ^ { b }$ and that $\mathbb { R } ^ { c _ { \mathrm { o u t } } }$ and $\mathbb { R } ^ { c _ { \mathrm { i n } } }$ are $G$ -representations $\rho _ { \mathrm { o u t } }$ and $\rho _ { \mathrm { i n } }$ respectively, then $K$ is $G$ -equivariant if for all $g \in G , \mathbf { x } \in \mathbb { R } ^ { 2 }$ ,
71
+
72
+ $$
73
+ K ( g \mathbf x ) = \rho _ { \mathrm { o u t } } ( g ) K ( \mathbf x ) \rho _ { \mathrm { i n } } ( g ^ { - 1 } ) .
74
+ $$
75
+
76
+ For the group SO(2), Weiler & Cesa (2019) solve this constraint using circular harmonic functions to give a basis of discrete equivariant kernels. In contrast, our method is much simpler and uses orbits and stabilizers to create continuous convolution kernels.
77
+
78
+ # 4 ECCO: TRAJECTORY PREDICTION USING ROTATIONALLY EQUIVARIANTCONTINUOUS CONVOLUTION
79
+
80
+ In trajectory prediction, given historical position and velocity data of $n$ particles over $t _ { \mathrm { i n } }$ timesteps, we want to predict their positions over the next $t _ { \mathrm { o u t } }$ timesteps. Denote the ground truth dynamics as $\xi$ , which maps $\xi ( { \bf x } _ { t - t _ { \mathrm { i n } } : t } , { \bf v } _ { t - t _ { \mathrm { i n } } : t } ) = { \bf x } _ { t : t + t _ { \mathrm { o u t } } }$ . Motivated by the observation in Figure 1, we wish to learn a model $f$ that approximates the underlying dynamics while preserving the internal symmetry in the data, specifically rotational equivariance.
81
+
82
+ We introduce ECCO, a model for trajectory prediction based on rotationally equivariant continuous convolution. We implement rotationally equivariant continuous convolutions using a weight sharing scheme based on orbit decomposition. We also describe equivariant per-particle linear layers which are a special case of continuous convolution with radius $R = 0$ analogous to 1x1 convolutions in CNNs. Such layers are useful for passing information between layers from each particle to itself.
83
+
84
+ # 4.1 ECCO MODEL OVERVIEW
85
+
86
+ ![](images/58c03535ef661e27469f1151eec0dd51ed96acd37c7444475de73561b5e94f0f.jpg)
87
+ Figure 2: Overview of model architecture. Past velocities are aggregated by an encoder Enc. Together with map information this is then encoded by 3 CtsConvs into $\rho _ { \mathrm { r e g } }$ features. Then $l + 1$ CtsConv layers are used to predict $\Delta \tilde { x }$ . The predicted position $\hat { x } _ { t + 1 } = \Delta \tilde { x } + \tilde { x }$ where $\tilde { x }$ is a numerically extrapolated using velocity and accleration. Since $\Delta \tilde { x }$ is translation invariant, $\hat { x }$ is equivariant.
88
+
89
+ The high-level architecture of ECCO is illustrated in Figure 2. It is important to remember that the input, output, and hidden layers are all vector fields over the particles. Oftentimes, there is also environmental information available in the form of road lane markers. Denote marker positions by $\mathbf { x } _ { \mathrm { m a p } }$ and direction vectors by $\mathbf { v } _ { \mathrm { m a p } }$ . This data is thus also a particle field, but static.
90
+
91
+ To design an equivariant network, one must choose the group representation. This choice plays an important role in shaping the learned hidden states. We focus on two representations of SO(2): $\rho _ { 1 }$ and $\rho _ { \mathrm { r e g } }$ . The representation $\rho _ { 1 }$ is that of our input features, and $\rho _ { \mathrm { r e g } }$ is for the hidden layers. For $\rho _ { 1 }$ , we constrain the kernel in Equation 1. For $\rho _ { \mathrm { r e g } }$ , we further introduce a new operator, convolution with torus kernels.
92
+
93
+ In order to make continuous convolution rotationally equivariant, we translate the general condition for discrete CNNs developed in Weiler & Cesa (2019) to continuous convolution. We define the convolution kernel $K$ in polar coordinates $K ( \theta , r )$ . Let $\mathbb { R } ^ { c _ { \mathrm { o u t } } }$ and $\mathbb { R } ^ { c _ { \mathrm { i n } } }$ be SO(2)-representations $\rho _ { \mathrm { o u t } }$ and $\rho _ { \mathrm { i n } }$ respectively, then the equivariance condition requires the kernel to satisfy
94
+
95
+ $$
96
+ K ( \theta + \phi , r ) = \rho _ { \mathrm { o u t } } ( \mathrm { R o t } _ { \theta } ) K ( \phi , r ) \rho _ { \mathrm { i n } } ( \mathrm { R o t } _ { \theta } ^ { - 1 } ) .
97
+ $$
98
+
99
+ Imposing such a constraint for continuous convolution requires us to develop an efficient weight sharing scheme for the kernels, which solve Equation 3.
100
+
101
+ # 4.2 WEIGHT SHARING BY ORBITS AND STABILIZERS.
102
+
103
+ Given a point $\mathbf { x } \in \mathbb { R } ^ { 2 }$ and a group $G$ , the set $O _ { \mathbf { x } } = \{ g \mathbf { x } : g \in G \}$ is the orbit of the point $\mathbf { x }$ . The set of orbits gives a partition of $\mathbb { R } ^ { 2 }$ into the origin and circles of radius $r > 0$ . The set of group elements $G _ { \mathbf { x } } = \{ g : \mathbf { \bar { g x } } = x \}$ fixing $\mathbf { x }$ is called the stabilizer of the point $\mathbf { x }$ . We use the orbits and stabilizers to constrain the weights of $K$ . Simply put, we share weights across orbits and constrain weights according to stabilizers, as shown in Figure 3-Left.
104
+
105
+ The ray $D = \{ ( 0 , r ) : r \geq 0 \}$ is a fundamental domain for the action of $G = \mathrm { S O } ( 2 )$ on base space $\mathbb { R } ^ { 2 }$ . That is, $D$ contains exactly one point from each orbit. We first define $K ( 0 , r )$ for each $( { \bar { 0 } } , r ) \in D$ . Then we compute $K ( \theta , r )$ from $K ( 0 , r )$ by setting $\phi = 0$ in Equation 3 as such
106
+
107
+ $$
108
+ \begin{array} { r } { K ( \theta , r ) = \rho _ { \mathrm { o u t } } ( \mathrm { R o t } _ { \theta } ) K ( 0 , r ) \rho _ { \mathrm { i n } } ( \mathrm { R o t } _ { \theta } ^ { - 1 } ) . } \end{array}
109
+ $$
110
+
111
+ For $r > 0$ , the group acts freely on $( 0 , r )$ , i.e. the stabilizer contains only the identity. This means that Equation 3 imposes no additional constraints on $K ( 0 , r )$ . Thus $K ( 0 , r ) \in \mathbb { R } ^ { c _ { \mathrm { o u t } } \times c _ { \mathrm { i n } } }$ is a matrix of freely learnable weights.
112
+
113
+ For $r = 0$ , however, the orbit $O _ { ( 0 , 0 ) }$ is only one point. The stabilizer of $( 0 , 0 )$ is all of $G$ , which requires
114
+
115
+ $$
116
+ K ( 0 , 0 ) = \rho _ { \mathrm { o u t } } ( \mathrm { R o t } _ { \theta } ) K ( 0 , 0 ) \rho _ { \mathrm { i n } } ( \mathrm { R o t } _ { \theta } ^ { - 1 } ) \mathrm { f o r \ a l l } \theta .
117
+ $$
118
+
119
+ Thus $K ( 0 , 0 )$ is an equivariant per-particle linear map $\rho _ { \mathrm { i n } } \rho _ { \mathrm { o u t } }$
120
+
121
+ We can analytically solve Equation 5 for $\dot { K } ( 0 , 0 )$ using representation theory. Table 1 shows the unique solutions for different combinations of $\rho _ { 1 }$ and $\rho _ { \mathrm { r e g } }$ . For details see subsection A.3.
122
+
123
+ Table 1: Equivariant linear maps for $K ( 0 , 0 )$ . Trainable weights are $c \in \mathbb { R }$ and $\bar { \kappa \colon S ^ { 1 } \to \mathbb { R } }$ , where $\hat { S ^ { 1 } }$ is the manifold underlying SO(2).
124
+
125
+ <table><tr><td>Pin</td><td>Pout = p1</td><td>Pout =preg</td></tr><tr><td>P1 preg</td><td>(a,b) -→ (ca,cb) fc Ss1 f(0)cos(0)d0 Js1 f(0)sin(0)d0)</td><td>ca cos(0) + cb sin(0) Ss1 κ(0-)f(Φ)dΦ</td></tr></table>
126
+
127
+ Note that 2D and 3D rota
128
+
129
+ tion equivariant continuous convolutions are implemented in Worrall et al. (2017) and Thomas et al. (2018) respectively. They both use harmonic functions which require expensive evaluation of analytic functions at each point. Instead, we provide a simpler solution. We require only knowledge of the orbits, stabilizers, and input/output representations. Additionally, we bypass Clebsch-Gordon decomposition used in Thomas et al. (2018) by mapping directly between the representations in our network. Next, we describe an efficient implementation of equivariant continuous convolution.
130
+
131
+ # 4.3 POLAR COORDINATE KERNELS
132
+
133
+ Rotational equivariance informs our kernel discretization and implementation. We store the kernel $K$ of continuous convolution as a 4-dimensional tensor by discretizing the domain. Specifically, we discretize $\mathbb { R } ^ { 2 }$ using polar coordinates with $k _ { \theta }$ angular slices and $k _ { r }$ radial steps. We then evaluate $K$ at any $( \theta , r )$ using bilinear interpolation from four closest polar grid points. This method accelerates computation since we do not need to use Equation 4 to repeatedly compute $K ( \theta , r )$ from $K ( 0 , r )$ . The special case of $K ( 0 , 0 )$ results in a polar grid with a “bullseye” at the center (see Figure 3-Left).
134
+
135
+ ![](images/fa29faa81a8731d0f3cbdc944a32dce9ef8f9fee9f38462f04a82f2b4c60f54e.jpg)
136
+ Figure 3: Left: A torus kernel field $K$ from a $\rho _ { \mathrm { r e g } }$ -field to a $\rho _ { \mathrm { r e g } }$ -field. The kernel is itself a field: at each point $\mathbf { x }$ in space the kernel $K ( \mathbf { x } )$ yields a different matrix. We denote the $\left( \phi _ { 2 } , \phi _ { 1 } \right)$ entry of the matrix at $\mathbf { x } = ( \theta , r )$ by $K ( \theta , r ) ( \stackrel { \cdot } { \phi _ { 2 } } , \stackrel { \cdot } { \phi _ { 1 } } )$ . The matrices along the red sector are freely trainable. The matrices at all white sectors are determined by those in the red sector according to the circular shifting rule illustrated above. The matrix at the red bullseye is trainable but constrained to be circulant, i.e. preserved by the circular shifting rule. Right: The torus kernel acts on features which are functions on the circle. By cutting open the torus and features along the reg and orange lines we can identify the operation at each point with matrix multiplication.
137
+
138
+ We discretize angles finely and radii more coarsely. This choice is inspired by real-world observation that drivers tend to be more sensitive to the angle of an incoming car than its exact distance, Our equivariant kernels are computationally efficient and have very few parameters. Moreover, we will discuss later in Section 4.5 that despite discretization, the use of polar coordinates allows for very low equivariance error.
139
+
140
+ # 4.4 HIDDEN LAYERS AS REGULAR REPRESENTATIONS
141
+
142
+ Regular representation $\rho _ { \mathrm { r e g } }$ has shown better performance than $\rho _ { 1 }$ for finite groups (Cohen et al., $2 0 1 9 \mathrm { a }$ ; Weiler & Cesa, 2019). But the naive $\rho _ { \mathrm { r e g } } = \{ \varphi \colon G \mathbb { R } \}$ for an infinite group $G$ is too large to work with. We choose the space of square-integrable functions $L ^ { 2 } ( G )$ . It contains all irreducible representations of $G$ and is compatible with pointwise non-linearities.
143
+
144
+ Discretization. However, $L ^ { 2 } ( \mathrm { S O } ( 2 ) )$ is still infinite-dimensional. We resolve this by discretizing the manifold $S ^ { 1 }$ underlying SO(2) into $k _ { \mathrm { r e g } }$ even intervals. We represent functions $f \in L ^ { 2 } ( \mathrm { S O } ( 2 ) \bar { ) }$ by the vector of values $[ f ( \mathrm { R o t } _ { 2 \pi i / k _ { \mathrm { r e g } } } ) ] _ { 0 \leq i < k _ { \mathrm { r e g } } }$ . We then evaluate $f ( \mathrm { R o t } _ { \theta } )$ using interpolation.
145
+
146
+ We separate the number of angular slices $k _ { \theta }$ and the size of the kernel $k _ { \mathrm { r e g } }$ . If we tie them together and set $k _ { \theta } = k _ { \mathrm { r e g } }$ , this is equivalent to implementing cyclic group $C _ { k _ { \mathrm { r e g } } }$ symmetry with the regular representation. Then increasing $k _ { \theta }$ would also increases $k _ { \mathrm { r e g } }$ , which incurs more parameters.
147
+
148
+ Convolution with Torus Kernel. In addition to constraining the kernel $K$ of Equation 1 as in $\rho _ { 1 }$ , $\rho _ { \mathrm { r e g } }$ poses an additional challenge as it is a function on a circle. We introduce a new operator from functions on the circle to functions on the circle called a torus kernel.
149
+
150
+ First, we replace input feature vectors in $\mathbf { f } \in \mathbb { R } ^ { c }$ with elements of $L ^ { 2 } ( \mathrm { S O } ( 2 ) )$ . The input feature f becomes a $\rho _ { \mathrm { r e g } }$ -field, that is, for each $\mathbf { x } \in \mathbb { R } ^ { 2 }$ , $\mathbf { f } ^ { ( \mathbf { x } ) }$ is a real-value function on the circle $S ^ { 1 } \to \mathbb { R }$ . For the kernel $K$ , we replace the matrix field with a map $K \colon \mathbb { R } ^ { 2 } \rho _ { \mathrm { r e g } } \otimes \rho _ { \mathrm { r e g } }$ . Instead of a matrix, $K ( \mathbf { x } )$ is a map $S ^ { 1 } \times S ^ { 1 } \to \mathbb { R }$ . Here $( \phi _ { 1 } , \phi _ { 2 } ) \in S ^ { 1 } \times S ^ { 1 }$ plays the role of continuous matrix indices and we may consider $K ( \mathbf { x } ) ( \phi _ { 1 } , \phi _ { 2 } ) \in \mathbb { R }$ analogous to a matrix entry. Topologically, $S ^ { 1 } \times S ^ { 1 }$ is a torus and hence we call $K ( \mathbf { x } )$ a torus kernel. The matrix multiplication $K ( \mathbf { x } ) \cdot f ^ { ( \mathbf { x } ) }$ in Equation 1
151
+
152
+ must be replaced by the integral transform
153
+
154
+ $$
155
+ K ( \mathbf { x } ) \odot f ^ { ( \mathbf { x } ) } ( \phi _ { 2 } ) = \int _ { \phi _ { 1 } \in S ^ { 1 } } K ( \mathbf { x } ) ( \phi _ { 2 } , \phi _ { 1 } ) f ^ { ( \mathbf { x } ) } ( \phi _ { 1 } ) d \phi _ { 1 } ,
156
+ $$
157
+
158
+ which is a linear transformation $L ^ { 2 } ( \mathrm { S O ( 2 ) } ) L ^ { 2 } ( \mathrm { S O ( 2 ) } )$ . $K ( \theta , r ) ( \phi _ { 2 } , \phi _ { 1 } )$ denotes the $\left( \phi _ { 2 } , \phi _ { 1 } \right)$ entry of the matrix at point $\mathbf { x } = ( \theta , r )$ , see the illustration in Figure 3-Right. We compute Equation 3 for $\rho _ { \mathrm { r e g } } \rho _ { \mathrm { r e g } }$ as $\bar { K } ( \mathrm { R o t } _ { \theta } ( { \bf x } ) ) ( \phi _ { 2 } , \phi _ { 1 } ) = K ( { \bf x } ) ( \phi _ { 2 } - \theta , \bar { \phi _ { 1 } } - \theta )$ . We can use the same weight sharing scheme as in Section 4.2.
159
+
160
+ # 4.5 ANALYSIS: EQUIVARIANCE ERROR
161
+
162
+ The practical value of equivariant neural networks has been demonstrated in a variety of domains. However, theoretical analysis (Kondor $\&$ Trivedi, 2018; Cohen et al., 2019a; Maron et al., 2020) of continuous Lie group symmetries is usually performed assuming continuous functions and using the integral representation of the convolution operator. In practice, discretization can cause the model $f$ to be not exactly equivariant, with some equivariance error (EE)
163
+
164
+ $$
165
+ \mathrm { E E } = \| f ( T ( x ) ) - T ^ { \prime } ( f ( x ) ) \|
166
+ $$
167
+
168
+ with respect to group transformations $T$ and $T ^ { \prime }$ of input and output respectively (Wang et al., 2020, A6). Rectangular grids are well-suited to translations, but poorlysuited to rotations. The resulting equivariance error can be so large to practically undermine the advantages of a theoretically equivariant network.
169
+
170
+ ![](images/a733352c4069e6f84814b38be353cfa71edd7a38ff0c39e909ad679eafea34d5.jpg)
171
+ Figure 4: Experimentally, we find $k _ { \theta }$ and expected equivariance error are inversely proportional.
172
+
173
+ Our polar-coordinate indexed circular filters are designed specifically to adapt well to the rotational symmetry. In Figure 4, we demonstrate experimentally that expected EE is inversely proportional to the number of angular slices $k _ { \theta }$ . For example, choosing $k _ { \theta } \geq 1 6$ gives very low EE and does not increase the number of parameters. We also prove for $\rho _ { 1 }$ features that the equivariance error is low in expectation. See Appendix A.6 for the precise statement and proof.
174
+
175
+ Proposition. Let $\alpha = 2 \pi / k _ { \theta }$ , and $\bar { \theta }$ be $\theta$ rounded to nearest value in $\mathbb { Z } \alpha$ , and $\hat { \theta } = | \theta - \bar { \theta } |$ . Let $F = C t s C o n v _ { K , R }$ and $T = \rho _ { 1 } ( \mathrm { R o t } _ { \theta } )$ . For some constant $C$ , the expected EE is bounded
176
+
177
+ $$
178
+ \mathbb { E } _ { K , \mathbf { f } , \mathbf { x } } [ T ( F ( \mathbf { f } , \mathbf { x } ) ) - F ( T ( \mathbf { f } ) , T ( \mathbf { x } ) ) ] \leq | \sin ( \hat { \theta } ) | C \leq 2 \pi C / k _ { \theta } .
179
+ $$
180
+
181
+ # 5 EXPERIMENTS
182
+
183
+ In this section, we present experiments in two different domains, traffic and pedestrian trajectory prediction, where interactions among agents are frequent and influential. We first introduce the statistics of the datasets and the evaluation metrics. Secondly, we compare different feature encoders and hidden feature representation types. Lastly, we compare our model with baselines.
184
+
185
+ # 5.1 EXPERIMENTAL SET UP
186
+
187
+ Dataset We discuss the performances of our models on (1) Argoverse autonomous vehicle motion forecasting (Chang et al., 2019), a recently released vehicle trajectory prediction benchmark, and (2) TrajNet $^ { + + }$ pedestrian trajectory forecasting challenge (Kothari et al., 2020). For Argoverse, the task is to predict three-second trajectories based on all vehicles history in the past 2 seconds. We split 32K samples from the validation set as our test set.
188
+
189
+ Baselines We compare against several state-of-the-art baselines used in Argoverse and TrajNet++. We use three original baselines from (Chang et al., 2019): Constant velocity, Nearest Neighbour, and Long Short Term Memory (LSTM). We also compare with a non-equivariant continuous convolutional model, CtsConv (Ummenhofer et al., 2019) and a hierarchical GNN model VectorNet (Gao et al., 2020). Note that VectorNet only predicts a single agent at a time, which is not directly comparable with ours. We include VectorNet as a reference nevertheless.
190
+
191
+ Evaluation Metrics We use domain standard metrics to evaluate the trajectory prediction performance, including (1) Average Displacement Error (ADE): the average L2 displacement error for the whole 30 timestamps between prediction and ground truth, (2) Displacement Error at $t$ seconds $\mathrm { ( D E @ ~ }$ ts): the L2 displacement error at a given timestep $t$ . DE $@$ ts for the last timestamp is also called Final Displacement Error (FDE). For Argoverse, we report ADE and $\mathrm { D E } @$ ts for $t \in \{ 1 , 2 , 3 \}$ . For TrajNet++, we report ADE and FDE.
192
+
193
+ # 5.2 PREDICTION PERFORMANCE COMPARISON
194
+
195
+ We evaluate the performance of different models from multiple aspects: forecasting accuracy, parameter efficiency and the physical consistency of the predictions. The goal is to provide a comprehensive view of various characteristics of our model to guide practical deployment. See Appendix A.9 for an additional ablative study.
196
+
197
+ Forecasting Accuracy We compare the trajectory prediction accuracy across different models on Argoverse and TrajNet $^ { + + }$ . Table 2 displays the prediction ADE and FDE comparision. We can see that ECCO with the regular representation $\rho _ { \mathrm { r e g } }$ achieves on par or better forecasting accuracy on both datasets. Comparing ECCO and a non-equivariant counterpart of our model CtsConv, we observe a significant $1 4 . 8 \%$ improvement in forecasting accuracy. Compare with data augmentation, we also observe a $9 \%$ improvement over the non-equivariant CtsConv trained on random-rotationaugmented dataset. These results demonstrate the benefits of incorporating equivariance principles into deep learning models.
198
+
199
+ Table 2: Parameter efficiency and accuracy comparison. Number of parameters for each model and their detailed forecasting accuracy at DE $@$ ts. CtsConv(Aug.) is CtsConv trained with rotation augmented data.
200
+
201
+ <table><tr><td rowspan="2">Model</td><td colspan="4">Argoverse</td><td colspan="2">TrajNet++</td><td rowspan="2">#Param</td></tr><tr><td>ADE</td><td>DE@1s</td><td>DE@2s</td><td>DE@3s</td><td>ADE</td><td>FDE</td></tr><tr><td>Constant Velocity</td><td>3.86</td><td>2.43</td><td>5.10</td><td>7.91</td><td>1.39</td><td>2.86</td><td></td></tr><tr><td>Nearest Neighbor</td><td>3.49</td><td>2.02</td><td>4.98</td><td>7.84</td><td>1.38</td><td>2.79</td><td></td></tr><tr><td>LSTM</td><td>2.13</td><td>1.16</td><td>2.81</td><td>4.83</td><td>1.11</td><td>2.03</td><td>50.6K</td></tr><tr><td>CtsConv</td><td>1.85</td><td>0.99</td><td>2.42</td><td>4.32</td><td>0.86</td><td>1.79</td><td>1078.1K</td></tr><tr><td>CtsConv (Aug.)</td><td>1.77</td><td>0.96</td><td>2.31</td><td>4.05</td><td>1</td><td>-</td><td>1078.1K</td></tr><tr><td>P1-ECCO</td><td>1.70</td><td>0.93</td><td>2.22</td><td>3.89</td><td>0.88</td><td>1.83</td><td>51.4K</td></tr><tr><td>Preg-ECCO</td><td>1.62</td><td>0.89</td><td>2.12</td><td>3.68</td><td>0.84</td><td>1.76</td><td>129.8K</td></tr><tr><td>VectorNet</td><td>1.66</td><td>0.92</td><td>2.06</td><td>3.67</td><td>1</td><td>-</td><td>72K + Decoder</td></tr></table>
202
+
203
+ Parameter Efficiency Another important feature in deploying deep learning models to embedded systems such as autonomous vehicles is parameter efficiency. We report the number of parameters in each of the models in Table 2. Compare with LSTM, our forecasting performance is significantly better. CtsConv and VectorNet have competitive forecasting performance, but uses much more parameters than ECCO. By encoding equivariance into CtsConv, we drastically reduce the number of the parameters needed in our model. For VectorNet, Gao et al. (2020) only provided the number of parameters for their encoder; a fair decoder size can be estimated based on MLP using 59 polygraphs with each 64 dimensions as input, predicting 30 timestamps, that is 113K.
204
+
205
+ Runtime and Memory Efficiency We compare the runtime and memory usage with VectorNet Gao et al. (2020). Since VectorNet is not open-sourced, we compare with a version of VectorNet that we implement. Firstly, we compare floating point operations (FLOPs). VectorNet reported $n \times 0 . 0 4 1$ GFLOPs for the encoder part of their model alone, where $n$ is the number of predicted vehicles. We tested ECCO on a scene with 30 vehicles and approximately 180 lane marker nodes, which is similar to the test conditions used to compute FLOPs in Gao et al. (2020). Our full model used 1.03 GFLOPs versus 1.23 GFLOPs for VectorNet’s encoder. For runtimes on the same test machine, ECCO runs $6 8 4 \mathrm { m s }$ versus 1103ms for VectorNet. Another disadvantage of VectorNet is needing to reprocess the scene for each agent, whereas ECCO predicts all agents simultaneously. For memory usage in the same test ECCO uses 296 MB and VectorNet uses 171 MB.
206
+
207
+ ![](images/7ecfe61fa33825b17f485cf100b52c4fc427db6663009e0e9c1f0b152849d034.jpg)
208
+ Figure 6: The x,y-axes are the position (m). The dashed line represents the 2s past trajectory. The solid line represents the 3s prediction. Red represents the agent. Top row: The predictions are made on the original data. Bottom row: We rotate the whole scene by $1 6 0 ^ { \circ }$ and make predictions on rotated data. From left to right are visualizations of ground truth, CtsConv, $\rho _ { 1 }$ -ECCO, $\rho _ { \mathrm { r e g } }$ -ECCO.
209
+
210
+ Sample Efficiency A major benefit of incorporating the inductive bias of equivariance is to improve the sample efficiency of learning. For each sample which an equivariant model is trained on, it learns as if it were trained on all transformations of that sample by the symmetry group (Wang et al., 2020, Prop 3). Thus ECCO requires far fewer samples to learn from. In Figure 5, we plot a comparison of validation FDE over number of training samples and show the equivariant models converge faster.
211
+
212
+ Physical Consistency We also visualize the predictions from ECCO and non-equivariant
213
+
214
+ ![](images/12060c7909bfb15856758dec74d247630d7d472ba9225a4b4bb53877a9aa4479.jpg)
215
+ Figure 5: The learning curves on the validation set. Equivariant models converge faster using fewer samples than the non-equivariant models.
216
+
217
+ CtsConv, as shown in Figure 6. Top row visualizes the predictions on the original data. In the bottom row, we rotate the whole scene by $1 6 0 ^ { \circ }$ and make predictions on rotated data. This mimics the covariate shift in the real world. Note that CtsConv predicts inconsistently: a right turn in the top row but a left turn after the scene has been rotated. We see similar results for TrajNet+ $^ +$ (see Figure 8 in Appendix A.10).
218
+
219
+ # 6 CONCLUSION
220
+
221
+ We propose Equivariant Continuous Convolution (ECCO), a novel model for trajectory prediction by imposing symmetries as inductive biases. On two real-world vehicle and pedestrians trajectory datasets, ECCO attains competitive accuracy with significantly fewer parameters. It is also more sample efficient; generalizing automatically from few data points in any orientation. Lastly, equivariance gives ECCO improved generalization performance. Our method provides a fresh perspective towards increasing trust in deep learning models through guaranteed properties. Future directions include applying equivariance to probabilistic predictions with many possible trajectories, or developing a faster version of ECCO which does not require autoregressive computation. Moreover, our methods may be generalized from 2-dimensional space to $\mathbb { R } ^ { n }$ . The orbit-stabilizer weight sharing scheme and discretized regular representation may be generalized by replacing SO(2) with $\operatorname { S O } ( n )$ , and polar coordinate kernels may be generalized using spherical coordinates.
222
+
223
+ # ACKNOWLEDGEMENT
224
+
225
+ This work was supported in part by Google Faculty Research Award, NSF Grant #2037745, and the U. S. Army Research Office under Grant W911NF-20-1-0334. Walters is supported by a Postdoctoral Fellowship from the Institute for Experiential AI at the Roux Institute.
226
+
227
+ # REFERENCES
228
+
229
+ Alexandre Alahi, Kratarth Goel, Vignesh Ramanathan, Alexandre Robicquet, Li Fei-Fei, and Silvio Savarese. Social lstm: Human trajectory prediction in crowded spaces. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 961–971, 2016.
230
+
231
+ Matan Atzmon, Haggai Maron, and Yaron Lipman. Point convolutional neural networks by extension operators. ACM Transactions on Graphics (TOG), 37(4):71, 2018.
232
+
233
+ Erkao Bao and Linqi Song. Equivariant neural networks and equivarification. arXiv preprint arXiv:1906.07172, 2019.
234
+
235
+ 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.
236
+
237
+ Erik J Bekkers. B-spline CNNs on Lie groups. In International Conference on Learning Representations, 2020.
238
+
239
+ Richard C Brown and Gerton Lunter. An equivariant Bayesian convolutional network predicts recombination hotspots and accurately resolves binding motifs. Bioinformatics, 35(13):2177–2184, 2019.
240
+
241
+ Ming-Fang Chang, John Lambert, Patsorn Sangkloy, Jagjeet Singh, Slawomir Bak, Andrew Hartnett, De Wang, Peter Carr, Simon Lucey, Deva Ramanan, et al. Argoverse: 3d tracking and forecasting with rich maps. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 8748–8757, 2019.
242
+
243
+ Benjamin Chidester, Minh N. Do, and Jian Ma. Rotation equivariance and invariance in convolutional neural networks. arXiv preprint arXiv:1805.12301, 2018.
244
+
245
+ Taco S. Cohen and Max Welling. Group equivariant convolutional networks. In International conference on machine learning (ICML), pp. 2990–2999, 2016a.
246
+
247
+ Taco S. Cohen and Max Welling. Steerable CNNs. arXiv preprint arXiv:1612.08498, 2016b.
248
+
249
+ Taco S Cohen, Mario Geiger, and Maurice Weiler. A general theory of equivariant CNNs on homogeneous spaces. In Advances in Neural Information Processing Systems, pp. 9142–9153, 2019a.
250
+
251
+ Taco S. Cohen, Maurice Weiler, Berkay Kicanaoglu, and Max Welling. Gauge equivariant convolutional networks and the icosahedral CNN. In Proceedings of the 36th International Conference on Machine Learning (ICML), volume 97, pp. 1321–1330, 2019b.
252
+
253
+ Sander Dieleman, Jeffrey De Fauw, and Koray Kavukcuoglu. Exploiting cyclic symmetry in convolutional neural networks. In International Conference on Machine Learning (ICML), 2016.
254
+
255
+ Nemanja Djuric, Vladan Radosavljevic, Henggang Cui, Thi Nguyen, Fang-Chieh Chou, Tsung-Han Lin, and Jeff Schneider. Short-term motion prediction of traffic actors for autonomous driving using deep convolutional networks. arXiv preprint arXiv:1808.05819, 2018.
256
+
257
+ Carlos Esteves, Christine Allen-Blanchette, Xiaowei Zhou, and Kostas Daniilidis. Polar transformer networks. In International Conference on Learning Representations (ICLR), 2018.
258
+
259
+ Marc Finzi, Samuel Stanton, Pavel Izmailov, and Andrew Gordon Wilson. Generalizing convolutional neural networks for equivariance to Lie groups on arbitrary continuous data. arXiv preprint arXiv:2002.12880, 2020.
260
+
261
+ Fabian B Fuchs, Daniel E Worrall, Volker Fischer, and Max Welling. SE(3)-transformers: 3D roto-translation equivariant attention networks. arXiv preprint arXiv:2006.10503, 2020.
262
+
263
+ Jiyang Gao, Chen Sun, Hang Zhao, Yi Shen, Dragomir Anguelov, Congcong Li, and Cordelia Schmid. Vectornet: Encoding HD maps and agent dynamics from vectorized representation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 11525–11533, 2020.
264
+
265
+ Brian Hall. Lie groups, Lie algebras, and representations: an elementary introduction, volume 222. Springer, 2015.
266
+
267
+ Pedro Hermosilla, Tobias Ritschel, Pere-Pau Vazquez, ´ Alvar Vinacua, and Timo Ropinski. Monte \` carlo convolution for learning on non-uniformly sampled point clouds. ACM Transactions on Graphics (TOG), 37(6):1–12, 2018.
268
+
269
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997.
270
+
271
+ Binh-Son Hua, Minh-Khoi Tran, and Sai-Kit Yeung. Pointwise convolutional neural networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 984–993, 2018.
272
+
273
+ Gurtej Kanwar, Michael S Albergo, Denis Boyda, Kyle Cranmer, Daniel C Hackett, Sebastien ´ Racaniere, Danilo Jimenez Rezende, and Phiala E Shanahan. Equivariant flow-based sampling \` for lattice gauge theory. arXiv preprint arXiv:2003.06413, 2020.
274
+
275
+ Arne Kesting, Martin Treiber, and Dirk Helbing. Enhanced intelligent driver model to access the impact of driving strategies on traffic capacity. Philosophical Transactions of the Royal Society A: Mathematical, Physical and Engineering Sciences, 368(1928):4585–4605, 2010.
276
+
277
+ Thomas N. Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. In International Conference on Learning Representations (ICLR), 2017.
278
+
279
+ Anthony W Knapp. Lie groups beyond an introduction, volume 140. Springer Science & Business Media, 2013.
280
+
281
+ Risi Kondor and Shubhendu Trivedi. On the generalization of equivariance and convolution in neural networks to the action of compact groups. In Proceedings of the 35th International Conference on Machine Learning (ICML), volume 80, pp. 2747–2755, 2018.
282
+
283
+ Parth Kothari, Sven Kreiss, and Alexandre Alahi. Human trajectory forecasting in crowds: A deep learning perspective. arXiv preprint arXiv:2007.03639, 2020.
284
+
285
+ Huan Lei, Naveed Akhtar, and Ajmal Mian. Octree guided CNN with spherical kernels for 3D point clouds. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 9631–9640, 2019.
286
+
287
+ Karel Lenc and Andrea Vedaldi. Understanding image representations by measuring their equivariance and equivalence. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 991–999, 2015.
288
+
289
+ Yangyan Li, Rui Bu, Mingchao Sun, Wei Wu, Xinhan Di, and Baoquan Chen. Pointcnn: Convolution on x-transformed points. In Advances in neural information processing systems, pp. 820–830, 2018.
290
+
291
+ Ming Liang, Bin Yang, Rui Hu, Yun Chen, Renjie Liao, Song Feng, and Raquel Urtasun. Learning lane graph representations for motion forecasting. arXiv preprint arXiv:2007.13732, 2020.
292
+
293
+ Haggai Maron, Or Litany, Gal Chechik, and Ethan Fetaya. On learning sets of symmetric elements. In Proceedings of the 37th International Conference on Machine Learning (ICML), 2020.
294
+
295
+ Louis Albert Pipes. Car following models and the fundamental diagram of road traffic. Transportation Research/UK/, 1966.
296
+
297
+ Andrey Rudenko, Luigi Palmieri, Michael Herman, Kris M Kitani, Dariu M Gavrila, and Kai O Arras. Human motion trajectory prediction: A survey. The International Journal of Robotics Research, 39(8):895–935, 2020.
298
+
299
+ Amir Sadeghian, Vineet Kosaraju, Agrim Gupta, Silvio Savarese, and Alexandre Alahi. Trajnet: Towards a benchmark for human trajectory prediction. arXiv preprint, 2018.
300
+
301
+ Alvaro Sanchez-Gonzalez, Jonathan Godwin, Tobias Pfaff, Rex Ying, Jure Leskovec, and Peter W Battaglia. Learning to simulate complex physics with graph networks. arXiv preprint arXiv:2002.09405, 2020.
302
+
303
+ Connor Schenck and Dieter Fox. Spnets: Differentiable fluid dynamics for deep neural networks. In Conference on Robot Learning, pp. 317–335, 2018.
304
+
305
+ Rajiv Shah and Rob Romijnders. Applying deep learning to basketball trajectories. arXiv preprint arXiv:1608.03793, 2016.
306
+
307
+ Hang Su, Varun Jampani, Deqing Sun, Subhransu Maji, Evangelos Kalogerakis, Ming-Hsuan Yang, and Jan Kautz. Splatnet: Sparse lattice networks for point cloud processing. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2530–2539, 2018.
308
+
309
+ Nathaniel Thomas, Tess Smidt, Steven Kearnes, Lusann Yang, Li Li, Kai Kohlhoff, and Patrick Riley. Tensor field networks: Rotation-and translation-equivariant neural networks for 3d point clouds. arXiv preprint arXiv:1802.08219, 2018.
310
+
311
+ Benjamin Ummenhofer, Lukas Prantl, Nils Thuerey, and Vladlen Koltun. Lagrangian fluid simulation with continuous convolutions. In International Conference on Learning Representations, 2019.
312
+
313
+ Matthew Veres and Medhat Moussa. Deep learning for intelligent transportation systems: A survey of emerging trends. IEEE Transactions on Intelligent transportation systems, 2019.
314
+
315
+ Rui Wang, Robin Walters, and Rose Yu. Incorporating symmetry into deep dynamics models for improved generalization. arXiv preprint arXiv:2002.03061, 2020.
316
+
317
+ Shenlong Wang, Simon Suo, Wei-Chiu Ma, Andrei Pokrovsky, and Raquel Urtasun. Deep parametric continuous convolutional neural networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2589–2597, 2018.
318
+
319
+ Maurice Weiler and Gabriele Cesa. General E(2)-equivariant steerable CNNs. In Advances in Neural Information Processing Systems (NeurIPS), pp. 14334–14345, 2019.
320
+
321
+ Maurice Weiler, Fred A. Hamprecht, and Martin Storath. Learning steerable filters for rotation equivariant CNNs. Computer Vision and Pattern Recognition (CVPR), 2018.
322
+
323
+ Xinshuo Weng, Shangxuan Wu, Fares Beainy, and Kris M Kitani. Rotational rectification network: Enabling pedestrian detection for mobile vision. In 2018 IEEE Winter Conference on Applications of Computer Vision (WACV), pp. 1084–1092. IEEE, 2018.
324
+
325
+ Daniel E Worrall, Stephan J Garbin, Daniyar Turmukhambetov, and Gabriel J Brostow. Harmonic networks: Deep translation and rotation equivariance. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5028–5037, 2017.
326
+
327
+ Wenxuan Wu, Zhongang Qi, and Li Fuxin. Pointconv: Deep convolutional networks on 3d point clouds. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 9621–9630, 2019.
328
+
329
+ Shi Xingjian, Zhourong Chen, Hao Wang, Dit-Yan Yeung, Wai-Kin Wong, and Wang-chun Woo. Convolutional lstm network: A machine learning approach for precipitation nowcasting. In Advances in neural information processing systems, pp. 802–810, 2015.
330
+
331
+ Yifan Xu, Tianqi Fan, Mingye Xu, Long Zeng, and Yu Qiao. Spidercnn: Deep learning on point sets with parameterized convolutional filters. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 87–102, 2018.
332
+
333
+ # A APPENDIX
334
+
335
+ # A.1 CONTINUOUS CONVOLUTION INVOLVING $\rho _ { \mathrm { r e g } }$
336
+
337
+ This section is a more detailed version of Section 4.4.
338
+
339
+ Define the input $\mathbf { f }$ to be $\rho _ { \mathrm { r e g } }$ -field, that is, a distribution over $\mathbb { R } ^ { 2 }$ valued in $\rho _ { \mathrm { r e g } }$ . Define $K \colon { \mathbb { R } } ^ { 2 } \to$ $\rho _ { \mathrm { r e g } } \otimes \rho _ { \mathrm { r e g } }$ . After identifying SO(2) with its underlying manifold $S ^ { 1 }$ , we can identify $K ( \mathbf { x } )$ as a map $S ^ { 1 } \times S ^ { 1 } \to \mathbb { R }$ and $f ^ { ( \mathbf { x } ) } \colon S ^ { 1 } \to \mathbb { R }$ . Define the integral transform
340
+
341
+ $$
342
+ K ( \mathbf { x } ) \odot f ^ { ( \mathbf { x } ) } ( \phi _ { 2 } ) = \int _ { \phi _ { 1 } \in S ^ { 1 } } K ( \mathbf { x } ) ( \phi _ { 2 } , \phi _ { 1 } ) f ^ { ( \mathbf { x } ) } ( \phi _ { 1 } ) d \phi _ { 1 } .
343
+ $$
344
+
345
+ For $\mathbf { y } \in \mathbb { R } ^ { 2 }$ , define the convolution $\mathbf { g } = K \star \mathbf { f }$ by
346
+
347
+ $$
348
+ \mathbf { g } ( y ) = \int _ { x \in \mathbb { R } ^ { 2 } } K ( x ) \odot \mathbf { f } ( x + y ) d x .
349
+ $$
350
+
351
+ The $\circledcirc$ -operation parameterizes linear maps $\rho _ { \mathrm { r e g } } \rho _ { \mathrm { r e g } }$ and is thus analogous to matrix multiplication. If we chose to restrict our choice of $\kappa$ to $\kappa ( \phi _ { 2 } , \phi _ { 1 } ) = \widetilde { \kappa } ( \phi _ { 2 } - \phi _ { 1 } )$ for some function $\tilde { \kappa } \colon S ^ { 1 } \to { \mathbb { R } }$ then this becomes the circular convolution operation.
352
+
353
+ The $S O ( 2 )$ -action on $\rho _ { \mathrm { r e g } }$ by $\operatorname { R o t } _ { \theta } ( f ) ( \phi ) = f ( \phi - \theta )$ induces an action on $\kappa \colon S ^ { 1 } \times S ^ { 1 } \to \mathbb { R }$ by
354
+
355
+ $$
356
+ \mathrm { R o t } _ { \theta } ( \kappa ) ( \phi _ { 2 } , \phi _ { 1 } ) = \kappa ( \phi _ { 2 } - \theta , \phi _ { 1 } - \theta ) .
357
+ $$
358
+
359
+ This, in turn, gives an action on the torus-field $K$ by
360
+
361
+ $$
362
+ \operatorname { R o t } _ { \theta } ( K ) ( x ) ( \phi _ { 2 } , \phi _ { 1 } ) = K ( \operatorname { R o t } _ { - \theta } ( x ) ) ( \phi _ { 2 } - \theta , \phi _ { 1 } - \theta ) .
363
+ $$
364
+
365
+ Thus Equation 3, the convolutional kernel constraint, implies that $K$ is equivariant if and only if
366
+
367
+ $$
368
+ K ( \mathrm { R o t } _ { \theta } ( x ) ) ( \phi _ { 2 } , \phi _ { 1 } ) = K ( x ) ( \phi _ { 2 } - \theta , \phi _ { 1 } - \theta ) .
369
+ $$
370
+
371
+ We use this to define a weight sharing scheme as described in Section 3.2. The cases of continuous convolution $\rho _ { 1 } \rho _ { \mathrm { r e g } }$ and $\rho _ { \mathrm { r e g } } \rho _ { 1 }$ may be derived similarly.
372
+
373
+ # A.2 COMPLEXITY OF CONVOLUTION WITH TORUS KERNEL
374
+
375
+ The complexity class of the convolution with torus kernel is $O ( n \cdot k _ { r e g } ^ { 2 } \cdot c _ { o u t } \cdot c _ { i n } )$ , where $n$ is the number of particles, the regular representation is discretized into $k _ { r e g }$ pieces, and the input and output contain $c _ { i n }$ and $c _ { o u t }$ copies of the regular representation respectively. We are not counting the complexity of the interpolation operation for looking up $K ( \theta , r )$ .
376
+
377
+ # A.3 EQUIVARIANT PER-PARTICLE LINEAR LAYERS
378
+
379
+ Since this operation is pointwise, unlike positive radius continuous convolution, we cannot map between different irreducible representations of SO(2). Consider as input a $\rho _ { \mathrm { i n } }$ -field $I$ and output a $\rho _ { \mathrm { o u t } }$ -field $O$ where $\rho _ { \mathrm { i n } }$ and $\rho _ { \mathrm { o u t } }$ are finite-dimensional representations of SO(2). We define $O ^ { ( i ) } =$ $W I ^ { ( i ) }$ using the same $W$ , an equivariant linear map, for each particle $1 \leq i \leq N$ . Denote the decomposition of $\rho _ { \mathrm { i n } }$ and $\rho _ { \mathrm { o u t } }$ into irreducible representations of $S O ( 2 )$ as $\rho _ { \mathrm { i n } } \cong \rho _ { 1 } ^ { i _ { 1 } } \oplus . . . \oplus \rho _ { n } ^ { i _ { n } }$ and $\rho _ { \mathrm { o u t } } \cong \rho _ { 1 } ^ { j _ { 1 } } \oplus . . . \oplus \rho _ { n } ^ { j _ { n } }$ respectively. By Schur’s lemma, the equivariant linear map $W \colon \rho _ { \mathrm { i n } } \rho _ { \mathrm { o u t } }$ is defined by a block diagonal matrix with blocks $\{ W _ { k } \} _ { k = 1 } ^ { n }$ where $W _ { k }$ is an $i _ { k } \times j _ { k }$ matrix. That is, maps between different irreducible representations are zero and each map $\rho _ { k } \to \rho _ { k }$ is given by a single scalar.
380
+
381
+ Per-particle linear mapping $\rho _ { 1 } \rho _ { \mathrm { r e g } }$ and $\rho _ { 1 } \rho _ { \mathrm { r e g } }$ . Since the input and output features are $\rho _ { 1 }$ -fields, but the hidden features may be represented by $\rho _ { \mathrm { r e g } }$ , we need mappings between $\rho _ { 1 }$ and $\rho _ { \mathrm { r e g } }$ . In all cases we pair continuous convolutions with dense per-particle mappings, this we must describe per-particle mappings between $\rho _ { 1 }$ and $\rho _ { \mathrm { r e g } }$ .
382
+
383
+ By the Peter-Weyl theorem, $L ^ { 2 } ( \mathrm { S O ( 2 ) } ) \cong \bigoplus _ { i = 0 } ^ { \infty } \rho _ { i }$ . In the case of $\mathrm { S O } ( 2 )$ , this decomposition is also called the Fourier decomposition or decomposition into circular harmonics. Most importantly, there is one copy of $\rho _ { 1 }$ inside of $L ^ { 2 } ( \mathrm { S O } ( 2 ) )$ . Hence, up to scalar, there is a unique linear map $i _ { 1 } \colon \rho _ { 1 } L ^ { 2 } ( \mathrm { S } \overleftarrow { \mathrm { O } } ( 2 ) )$ given by $( a , b ) \mapsto a \cos ( \theta ) + b \sin ( \theta )$ .
384
+
385
+ The reverse mapping $\mathrm { p r } _ { 1 } \colon L ^ { 2 } ( \mathrm { S O } ( 2 ) ) \rho _ { 1 }$ is projection onto the $\rho _ { 1 }$ summand and is given by the Fourier transform $\begin{array} { r } { \mathrm { p r } _ { \mathrm { i } } ( f ) = ( \int _ { S ^ { 1 } } f ( \theta ) \cos ( \theta ) d \theta , \int _ { S ^ { 1 } } f ( \theta ) \sin ( \theta ) d \theta ) } \end{array}$ .
386
+
387
+ Per-particle linear mapping $\rho _ { \mathrm { r e g } } \rho _ { \mathrm { r e g } }$ . Though $\rho _ { \mathrm { r e g } }$ is not finite-dimensional, the fact that it decomposes into a direct sum of irreducible representations means that we may take $\rho _ { \mathrm { i n } } = \rho _ { \mathrm { o u t } } =$ $\rho _ { \mathrm { r e g } }$ above. Practically, however, it is easier to realize the linear equivariant map $\rho _ { \mathrm { r e g } } ^ { i } \rho _ { \mathrm { r e g } } ^ { j }$ as a convolution over $S ^ { 1 }$ ,
388
+
389
+ $$
390
+ O ( \theta ) = \int _ { \phi \in S ^ { 1 } } \kappa ( \theta - \phi ) I ( \phi )
391
+ $$
392
+
393
+ where $\kappa ( \theta )$ is an $i \times j$ matrix of trainable weights, independent for each $\theta$
394
+
395
+ # A.4 ENCODING INDIVIDUAL PARTICLE PAST BEHAVIOR
396
+
397
+ We can encode these individual attributes using a per vehicle LSTM (Hochreiter & Schmidhuber, 1997). Let $X _ { t } ^ { ( i ) }$ denote the position of car $i$ at time $t$ . Denote a fully connected LSTM cell by states $h _ { t } , c _ { t } = \mathtt { L S T M } ( X _ { t } ^ { ( i ) } , h _ { t - 1 } , c _ { t - 1 } )$ $[ h _ { t _ { \mathrm { i n } } } ^ { ( 1 ) } \ . . . \ h _ { t _ { \mathrm { i n } } } ^ { ( n ) } ]$ of all particles as . Define $Z \in \mathbb { R } ^ { N } \otimes \mathbb { R } ^ { k }$ $h _ { 0 } = c _ { 0 } = 0$ . We then use the concatenation of the hidden as the encoded per-vehicle latent features.
398
+
399
+ # A.5 ENCODING PAST INTERACTIONS
400
+
401
+ In addition, we also encode past interactions of particles by introducing a continuous convolution LSTM. Similar to convLSTM we replace the fully connected layers of the original LSTM above with another operation Xingjian et al. (2015). While convLSTM is well-suited for capturing spatially local interactions over time, it requires gridded information. Since the particle system we consider are distributed in continuous space, we replace the standard convolution with rotation-equivariant continuous convolutions.
402
+
403
+ We can now define $H _ { t } , C _ { t } = \mathtt { C t s C o n v L S T M } ( X _ { t } , H _ { t - 1 } , C _ { t - 1 } )$ which is an LSTM cell using equivariant continuous convolutions throughout. Note that in this case $X _ { t } , H _ { t - 1 } , C _ { t - 1 }$ are all particle feature fields, that is, functions $\{ 1 , \ldots , n \} \to \mathbb { R } ^ { k }$ .
404
+
405
+ Define CtsConvLSTM by
406
+
407
+ $$
408
+ \begin{array} { r l } & { i _ { t } = \sigma ( W _ { i x } \star _ { c t s } X _ { t } ^ { ( i ) } + W _ { i h } \star _ { c t s } h _ { t - 1 } + W _ { i c } \circ c _ { t - 1 } + b _ { i } ) } \\ & { f _ { t } = \sigma ( W _ { f x } \star _ { c t s } X _ { t } ^ { ( i ) } + W _ { f h } \star _ { c t s } h _ { t - 1 } + W _ { f c } \circ c _ { t - 1 } + b _ { i } ) } \\ & { c _ { t } = f _ { t } \circ c _ { t - 1 } + i _ { t } \circ \operatorname { t a n h } ( W _ { c x } \star _ { c t s } X _ { t } ^ { ( i ) } + W _ { c h } \star _ { c t s } h _ { t - 1 } + b _ { c } ) } \\ & { o _ { t } = \sigma ( W _ { o x } \star _ { c t s } X _ { t } ^ { ( i ) } + W _ { o h } \star _ { c t s } h _ { t - 1 } + W _ { o c } \circ c _ { t } + b _ { o } ) } \\ & { h _ { t } = o _ { t } \circ \operatorname { t a n h } ( c _ { t } ) , } \end{array}
409
+ $$
410
+
411
+ where $\star _ { c t s }$ denotes CtsConv. We then can use $H _ { t _ { \mathrm { i n } } }$ as input feature for the prediction network.
412
+
413
+ # A.6 EQUIVARIANCE ERROR
414
+
415
+ We prove the proposition in Section 4.5.
416
+
417
+ Proposition. Let $\alpha = 2 \pi / k _ { \theta }$ . Let $\bar { \theta }$ be $\theta$ rounded to nearest value in $\mathbb { Z } \alpha$ . Set $\hat { \theta } = | \theta - \bar { \theta } |$ . Assume $n$ particles samples uniformly in a ball of radius $R$ with features f $\in \rho _ { 1 } ^ { c }$ . Let f and $K$ have entries sampled uniformly in $[ - a , a ]$ . Let the bullseye have radius $0 < R _ { e } < R$ . Let $F = C t s C o n v _ { K , R }$ and $T _ { \theta } = \rho _ { 1 } ( \operatorname { R o t } _ { \theta } )$ . Then the expected EE is bounded
418
+
419
+ $$
420
+ \mathbb { E } _ { K , \mathbf { f } , \mathbf { x } } [ T ( F ( \mathbf { f } , \mathbf { x } ) ) - F ( T ( \mathbf { f } ) , T ( \mathbf { x } ) ) ] \le | \sin ( \hat { \theta } ) | C \le 2 \pi C / k _ { \theta }
421
+ $$
422
+
423
+ where $C = 4 c n a ^ { 2 } ( 1 - R _ { e } ^ { 2 } / R ^ { 2 } )$ .
424
+
425
+ Proof. We may compute for a single particle $\mathbf { x } = ( \psi , r )$ and multiply our result by $n$ by linearity. We separate two cases: $\mathbf { x }$ in bullseye with probability $R _ { e } ^ { 2 } / R ^ { 2 }$ and $\mathbf { x }$ in angular slice with probability $1 - R _ { e } ^ { \dot { 2 } } / R ^ { 2 }$ . If $\mathbf { x }$ is in the bullseye, then there is no equivariance error since $K ( \mathbf { x } )$ is a scalar matrix. Assume $\mathbf { x }$ is an angular sector.
426
+
427
+ For nearest interpolation, the equivariance error is then
428
+
429
+ $$
430
+ \| \rho _ { 1 } ( { \bar { \theta } } ) K ( \mathbf { x } ) \rho _ { 1 } ( - { \bar { \theta } } ) \rho _ { 1 } ( \theta ) \mathbf { f } - \rho _ { 1 } ( \theta ) K ( \mathbf { x } ) \mathbf { f } \| .
431
+ $$
432
+
433
+ Since $\rho _ { 1 } ( \theta )$ is length preserving, this is
434
+
435
+ $$
436
+ \begin{array} { r l } & { \quad \| \rho _ { 1 } ( - \theta ) \rho _ { 1 } ( \bar { \theta } ) K ( \mathbf { x } ) \rho _ { 1 } ( - \bar { \theta } ) \rho _ { 1 } ( \theta ) \mathbf { f } - K ( \mathbf { x } ) \mathbf { f } \| } \\ & { = \| \rho _ { 1 } ( \beta ) K ( \mathbf { x } ) \rho _ { 1 } ( - \beta ) \mathbf { f } - K ( \mathbf { x } ) \mathbf { f } \| } \end{array}
437
+ $$
438
+
439
+ where $\beta = \pm \hat { \theta }$ . We consider only a single factor of $\rho _ { 1 }$ in f . The result will then be multiplied by $c$ Let
440
+
441
+ $$
442
+ K ( \mathbf { x } ) = \left( \begin{array} { l l } { k _ { 1 1 } } & { k _ { 1 2 } } \\ { k _ { 2 1 } } & { k _ { 2 2 } } \end{array} \right) , \qquad \mathbf { f } = \left( \begin{array} { l } { f _ { 1 } } \\ { f _ { 2 } } \end{array} \right) .
443
+ $$
444
+
445
+ We can factor out an $a$ from $K ( \mathbf { x } )$ and an $a$ from f and assume $k _ { i j } , f _ { i }$ samples from Uniform $( [ - 1 , 1 ] )$ . One may then directly compute that Equation 7 equals
446
+
447
+ $$
448
+ \sqrt { ( ( k _ { 2 1 } + k _ { 1 2 } ) ^ { 2 } + ( k _ { 1 1 } - k _ { 2 2 } ) ^ { 2 } ) ( f _ { 1 } ^ { 2 } + f _ { 2 } ^ { 2 } ) \sin ^ { 2 } ( \beta ) }
449
+ $$
450
+
451
+ This is bounded above by $4 | \sin ( \beta ) | = 4 | \sin ( { \hat { \theta } } ) |$ . Collecting the above factors, this proves the bound $C | \sin ( \beta ) |$ .
452
+
453
+ The further bound follows by the first order bound,
454
+
455
+ $$
456
+ | \sin ( \hat { \theta } ) | \leq | \hat { \theta } | \leq 2 \pi / k _ { \theta } .
457
+ $$
458
+
459
+ The relationship $\mathrm { E E } \approx 2 \pi C / k _ { \theta }$ is visible in Figure 4. We can also see clearly the significance of the term $| \sin ( { \hat { \theta } } ) |$ by plotting equivariance error against $\theta$ as in Figure 7.
460
+
461
+ ![](images/c9ed80ce51059dbfb41589d0d1c008328bb255955142f18469dbe88023e02d05.jpg)
462
+ Figure 7: The above plot is generated from random input and kernels. We can clearly see the dependence of of EE on $| \sin ( { \hat { \theta } } ) |$
463
+
464
+ # A.7 DATA DETAILS
465
+
466
+ Argoverse dataset includes 324K samples, which are split into 206K training data, 39K validation and 78K test set. All the samples are real data extracted from Miami and Seattle, and the dataset provides HD maps of lanes in each city. Every sample contains data for 5 seconds long, and is sampled in $1 0 \mathrm { H z }$ frequency.
467
+
468
+ TrajNet+ $^ +$ Real dataset contains 200K samples. All the tracking in this dataset is captured in both indoor and outdoor locations, for example, university, hotel, Zara, and train stations. Every sample in this dataset contains 21 timestamps, and the goal is to predict the 2D spatial positions for each pedestrain in the future 12 timestamps.
469
+
470
+ # A.8 IMPLEMENTATION DETAILS
471
+
472
+ Argoverse dataset is not fully observed, so we only use cars with complete observation as our input. Since every sample doesn’t include the same number of cars, we only choose those scenes with less than or equal to 60 cars and insert dummy cars into them to achieve consistent car numbers. Tra${ \mathrm { j N e t } } + +$ Real dataset is also not fully observed. And here we keep our pedestrain number consistent to 160.
473
+
474
+ Moreover, for each car, we use the average velocity in the past 0.1 second as an approximate to the current instant velocity, i.e. $v _ { t } = ( p _ { t } - p _ { t - 1 } ) / 2$ . As for map information, we only include center lanes with lane directions as features. Also, we introduce dummy lane node into each scene to make lane numbers consistently equal to 650.
475
+
476
+ In TrajNet $^ { + + }$ task, no map information is included. And since pedestrians don’t have a speedometers to tell them exactly how fast they are moving as drivers, instead they depends more on the relative velocities and relative positions to other pedestrians, we tried different combination of features in ablative study besides only using history velocities.
477
+
478
+ Our models are all trained by Adam optimizer with base learning rate 0.001, and the gamma rate for linear rate scheduler is set to be 0.95. All our models without map information are trained for 15K iterations with batch size 16 and learning rate is updated every 300 iterations; for models with map information, we train them for 30K iterations with batch size 16 and learning rate is updated every 600 iterations.
479
+
480
+ For CtsConv, we set the layer sizes to be 32, 64, 64, 64, and kernel size $4 \times 4 \times 4$ ; for $\rho _ { 1 }$ -ECCO, the layer sizes are 16, 32, 32, 32, $k _ { \theta }$ is 16, $k _ { r }$ is 3; for $\rho _ { \mathrm { r e g } }$ -ECCO, we choose layer size 8, 16, 8, 8, $k _ { \theta }$ 16, $k _ { r }$ 3, and regular feature dimension is set to be 8. For Argoverse task, we set the CtsConv radius to be 40, and for TrajNet++ task we set it to be 6.
481
+
482
+ # A.9 ABLATIVE STUDY
483
+
484
+ We perform ablative study for ECCO to further diagnose different encoders, usage of HD maps and other model design choices.
485
+
486
+ Choice of encoders Unlike fluid simulations (Ummenhofer et al., 2019) where the dynamics are Markovian, human behavior exhibit long-term dependency. We experiment with three different encoders refered to as Enc to model such long-term dependency: (1) concatenating the velocities from the past $m$ frames as input feature, (2) passing the past velocities of each particle to the same LSTM to encode individual behavior of each particle, and (3) implementing continuous convolution LSTM to encode past particle interactions. Our continuous convolution LSTM is similar to convLSTM (Xingjian et al., 2015) but uses continuous convolutions instead of discrete gridded convolutions.
487
+
488
+ We use different encoders to time-aggregate features and compare their performances (Table 3).
489
+
490
+ Use of HD Maps In Table 4, we compare performance with and without map input features.
491
+
492
+ Choice of features for pedestrian Unlike vehicles, people do not have a velocity meter to tell him how fast they actually walk. We realize that people actually tend to adjust their velocities based on others’ relative velocity and relative position. We experiment different combination of features (Table 5), finding using relative velocities and relative positions as feature has the best performance.
493
+
494
+ # A.10 QUALITATIVE RESULTS FOR TRAJNET++
495
+
496
+ Figure 8 show qualitative results for TrajNet++. Note that the non-equivariant baseline (2nd column) depends highly on the global orientation whereas the ground truth and equivariant models do not.
497
+
498
+ Table 3: Ablation study on encoders for Argoverse and TrajNet++. Markovian: Use the velocity from the most recent time step as input feature. LSTM: Used LSTM to encode velocities of 20 timestamps. CtsConvLSTM: Instead of dense layer, the gate functions in LSTM are replaced by CtsConv. CtsConvDLSTM: Replaced gate functions by CtsConv $^ +$ Dense. D-Concat (20t feats): Stacked velocities of 20 time steps as input.
499
+
500
+ <table><tr><td rowspan="2">Encoder</td><td colspan="4">Argoverse</td><td colspan="2">TrajNet++</td></tr><tr><td>ADE</td><td>DE@1s</td><td>DE@2s</td><td>DE@3s</td><td>ADE</td><td>FDE</td></tr><tr><td>Markovian</td><td>4.67</td><td>=</td><td>=</td><td>9.84</td><td>0.969</td><td>1.952</td></tr><tr><td>LSTM</td><td>2.05</td><td>1.06</td><td>2.51</td><td>4.71</td><td>0.909</td><td>1.909</td></tr><tr><td>CtsConvLSTM</td><td>3.98</td><td>2.02</td><td>5.11</td><td>8.40</td><td>0.962</td><td>1.941</td></tr><tr><td>CtsConvDLSTM</td><td>2.02</td><td>1.03</td><td>2.46</td><td>4.58</td><td>0.910</td><td>1.916</td></tr><tr><td>D-Concat(20t feats)</td><td>1.87</td><td>1.01</td><td>2.43</td><td>4.22</td><td>0.895</td><td>1.872</td></tr></table>
501
+
502
+ Table 4: Ablative study on HD maps for Argoverse. Prediction accuracy comparison with and without HD Maps.
503
+
504
+ <table><tr><td rowspan="2">Model</td><td colspan="4">w/o Map</td><td colspan="4">w/Map</td></tr><tr><td>ADE</td><td>DE@1s</td><td>DE@2s</td><td>DE@3s</td><td>ADE</td><td>DE@1s</td><td>DE@2s</td><td>DE@3s</td></tr><tr><td>CtsConv</td><td>1.87</td><td>1.01</td><td>2.43</td><td>4.22</td><td>1.85</td><td>0.99</td><td>2.42</td><td>4.32</td></tr><tr><td>P1-ECCO</td><td>1.81</td><td>1.02</td><td>2.42</td><td>4.14</td><td>1.70</td><td>0.93</td><td>2.22</td><td>3.89</td></tr><tr><td>Preg-ECCO</td><td>1.81</td><td>1.00</td><td>2.38</td><td>4.12</td><td>1.62</td><td>0.89</td><td>2.12</td><td>3.68</td></tr></table>
505
+
506
+ Table 5: Ablative study on features for $\mathrm { T r a j } { + + }$ . Acceleration means whether we used acceleration to make numerically extrapolated position.
507
+
508
+ <table><tr><td>Velocity</td><td>Relative Position丨Acceleration</td><td></td><td>ADE</td><td>FDE</td></tr><tr><td>Absolute</td><td>×</td><td>×</td><td>0.92</td><td>1.95</td></tr><tr><td>Absolute</td><td>×</td><td></td><td>0.90</td><td>1.87</td></tr><tr><td>Relative</td><td>×</td><td>√</td><td>0.89</td><td>1.86</td></tr><tr><td>Relative</td><td>√</td><td>√</td><td>0.86</td><td>1.79</td></tr></table>
509
+
510
+ ![](images/3ba988374a3912363034e390a42b4c46f4efbf1d50c546c2279fc3c140815316.jpg)
511
+ Figure 8: The x,y-axes are the position $\mathrm { ( m ) }$ . The dashed line represents the 2s past trajectory. The solid line represents the 3s prediction. Red represents the agent. Top row: The predictions are made on the original data. Bottom row: We rotate the whole scene by $1 6 0 ^ { \circ }$ and make predictions on rotated data. From left to right are visualizations of ground truth, CtsConv, $\rho _ { 1 }$ -ECCO, $\rho _ { \mathrm { r e g } }$ -ECCO.
md/train/QDm4QXNOsuQVE/QDm4QXNOsuQVE.md ADDED
@@ -0,0 +1,299 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # $\pmb { k }$ -Sparse Autoencoders
2
+
3
+ # Alireza Makhzani Brendan Frey
4
+
5
+ University of Toronto, 10 King’s College Rd. Toronto, Ontario M5S 3G4, Canada
6
+
7
+ # Abstract
8
+
9
+ Recently, it has been observed that when representations are learnt in a way that encourages sparsity, improved performance is obtained on classification tasks. These methods involve combinations of activation functions, sampling steps and different kinds of penalties. To investigate the effectiveness of sparsity by itself, we propose the “ $k$ - sparse autoencoder”, which is an autoencoder with linear activation function, where in hidden layers only the $k$ highest activities are kept. When applied to the MNIST and NORB datasets, we find that this method achieves better classification results than denoising autoencoders, networks trained with dropout, and RBMs. $k$ -sparse autoencoders are simple to train and the encoding stage is very fast, making them well-suited to large problem sizes, where conventional sparse coding algorithms cannot be applied.
10
+
11
+ and updating the dictionary. Sparse codes are computed using the current dictionary $W$ and a pursuit algorithm to solve
12
+
13
+ $$
14
+ \hat { z } _ { i } = \underset { z } { \mathrm { a r g m i n } } \| \pmb { x } _ { i } - W z \| _ { 2 } ^ { 2 } s . t . \| z \| _ { 0 } < k
15
+ $$
16
+
17
+ where $z _ { i }$ , $i = 1 , . . , N$ are the columns of $Z$ . Convex relaxation methods such as $\ell _ { 1 }$ minimization or greedy methods such as OMP (Tropp $\&$ Gilbert, 2007) are used to solve the above optimization. While greedy algorithms are faster, they are still slow in practice. The current sparse codes are then used to update the dictionary, using techniques such as the method of optimal directions (MOD) (Engan et al., 1999) or K-SVD (Aharon et al., 2005). These methods are computationally expensive; MOD requires inverting the data matrix at each step and K-SVD needs to compute a SVD in order to update every column of the dictionary.
18
+
19
+ To achieve speedups, in (Gregor & LeCun, 2010; Kavukcuoglu et al., 2010), a parameterized non-linear encoder function is trained to explicitly predict sparse codes using a soft thresholding operator. However, they assume that the dictionary is already given and do not address the offline phase.
20
+
21
+ # 1. Introduction
22
+
23
+ Sparse feature learning algorithms range from sparse coding approaches (Olshausen & Field, 1997) to training neural networks with sparsity penalties (Nair & Hinton, 2009; Lee et al., 2007). These methods typically comprise two steps: a learning algorithm that produces a dictionary $W$ that sparsely represents the data $\{ { x } _ { i } \} _ { i = 1 } ^ { N }$ , and an encoding algorithm that, given the dictionary, defines a mapping from a new input vector $_ { x }$ to a feature vector.
24
+
25
+ A practical problem with sparse coding is that both the dictionary learning and the sparse encoding steps are computationally expensive. Dictionaries are usually learnt offline by iteratively recovering sparse codes
26
+
27
+ Another approach that has been taken recently is to train autoencoders in a way that encourages sparsity. However, these methods usually involve combinations of activation functions, sampling steps and different kinds of penalties, and are sometimes not guaranteed to produce sparse representations for each input. For example, in (Lee et al., 2007; Nair & Hinton, 2009), a “lifetime sparsity” penalty function proportional to the negative of the KL divergence between the hidden unit marginals and the target sparsity probability is added to the cost function. This results in sparse activation of hidden units across training points, but does not guarantee that each input has a sparse representation.
28
+
29
+ The contributions of this paper are as follows. (i) We describe “ $k$ -sparse autoencoders” and show that they can be efficiently learnt and used for sparse coding.
30
+
31
+ (ii) We explore how different sparsity levels ( $k$ ) impact representations and classification performance. (iii) We show that by solely relying on sparsity as the regularizer and as the only nonlinearity, we can achieve much better results than the other methods, including RBMs, denoising autoencoders (Vincent et al., 2008) and dropout (Hinton et al., 2012). (iv) We demonstrate that $k$ -sparse autoencoders are suitable for pretraining and achieve results comparable to state-ofthe-art on MNIST and NORB datasets.
32
+
33
+ In this paper, $\Gamma$ is an estimated support set and $\Gamma ^ { c }$ is its complement. $W ^ { \dagger }$ is the pseudo-inverse of $W$ and $\operatorname { s u p p } _ { k } ( \pmb { x } )$ is an operator that returns the indices of the $k$ largest coefficients of its input vector. $z _ { \Gamma }$ is the vector obtained by restricting the elements of $_ { z }$ to the indices of $\Gamma$ and $W _ { \Gamma }$ is the matrix obtained by restricting the columns of $W$ to the indices of $\Gamma$ .
34
+
35
+ # 2. Description of the Algorithm
36
+
37
+ # 2.1. The Basic Autoencoder
38
+
39
+ A shallow autoencoder maps an input vector $_ { x }$ to a hidden representation using the function ${ z } = f ( P { \mathbf { { x } } } { + } b )$ , parameterized by $\{ P , b \}$ . $f$ is the activation function, e.g., linear, sigmoidal or ReLU. The hidden representation is then mapped linearly to the output using $\hat { \pmb { x } } = { \cal W } \ z + { \pmb { b } } ^ { \prime }$ . The parameters are optimized to minimize the mean square error of $\| { \hat { \pmb x } } - { \pmb x } \| _ { 2 } ^ { 2 }$ over all training points. Often, tied weights are used, so that $P = W ^ { \prime }$ .
40
+
41
+ # 2.2. The $k$ -Sparse Autoencoder
42
+
43
+ The $k$ -sparse autoencoder is based on an autoencoder with linear activation functions and tied weights. In the feedforward phase, after computing the hidden code $\pmb { z } = \mathbf { { \cal W } } ^ { \prime } \mathbf { \pmb { x } } \mathbf { + } \pmb { b }$ , rather than reconstructing the input from all of the hidden units, we identify the $k$ largest hidden units and set the others to zero. This can be done by sorting the activities or by using ReLU hidden units with thresholds that are adaptively adjusted until the $k$ larges activities are identified. This results in a vector of activities with the support set of $\operatorname { s u p p } _ { k } ( W ^ { \prime } \mathbf { \mathcal { x } } + \boldsymbol { b } )$ . Note that once the $k$ largest activities are selected, the function computed by the network is linear. So the only non-linearity comes from the selection of the $k$ largest activities. This selection step acts as a regularizer that prevents the use of an overly large number of hidden units when reconstructing the input.
44
+
45
+ Once the weights are trained, the resulting sparse representations may be used for learning to perform downstream classification tasks. However, it has been observed that often, better results are obtained when the sparse encoding stage used for classification does not exactly match the encoding used for dictionary training (Coates & Ng, 2011). For example, while in $k$ - means, it is natural to have a hard-assignment of the points to the nearest cluster in the encoding stage, it has been shown in (Van Gemert et al., 2008) that soft assignments result in better classification performance. Similarly, for the $k$ -sparse autoencoder, instead of using the $k$ largest elements of $W ^ { \prime } x { + } b$ as the features, we have observed that slightly better performance is obtained by using the $\alpha k$ largest hidden units where $\alpha \geq 1$ is selected using validation data. So at the test time, we use the support set defined by $\operatorname { s u p p } _ { \alpha k } ( W ^ { \intercal } { \pmb x } + { \pmb b } )$ . The algorithm is summarized as follows.
46
+
47
+ <table><tr><td>k-Sparse Autoencoders: Training:</td></tr><tr><td>1) Perform the feedforward phase and compute z=Wx+b 2) Find the k largest activations of z and set the rest to zero. Z(r)c =O where Γ= supPk(z) 3) Compute the output and the error using the sparsified z. x=Wz+b&#x27; E=|x-x|² 3) Backpropagate the error through the k largest activations defined by Γ and iterate.</td></tr><tr><td>Sparse Encoding: Compute the features h=W&#x27;x +b. Find its αk largest activations and set the rest to zero. h(r)c =O where Γ= suppαk(h)</td></tr></table>
48
+
49
+ # 3. Analysis of the $\boldsymbol { k }$ -SparseAutoencoder
50
+
51
+ In this section, we explain how the $k$ -sparse autoencoder can be viewed in the context of sparse coding with incoherent matrices. This perspective sheds light on why the $k$ -sparse autoencoders work and why they achieve invariant features and consequently good classification results. We first explain a sparse recovery algorithm and then show that the $k$ -sparse autoencoder iterates between an approximation of this algorithm and a dictionary update stage.
52
+
53
+ # 3.1. Iterative Thresholding with Inversion (ITI)
54
+
55
+ Iterative hard thresholding (Blumensath & Davies, 2009) is a class of low complexity algorithms, which has recently been proposed for the reconstruction of sparse signals. In this work, we use a variant called “iterative thresholding with inversion” (Maleki, 2009). Given a fixed $_ { x }$ and $W$ , starting from $z ^ { 0 } = 0$ , ITI iteratively finds the sparsest solution of $\mathbf { \boldsymbol { x } } = W \mathbf { \boldsymbol { z } }$ using the
56
+
57
+ following steps.
58
+
59
+ 1. Support Estimation Step:
60
+
61
+ $$
62
+ \Gamma = \operatorname* { s u p p } _ { k } ( z ^ { n } + W ^ { \top } ( \pmb { x } - W z ^ { n } ) )
63
+ $$
64
+
65
+ 2. Inversion Step:
66
+
67
+ $$
68
+ \begin{array} { r l } & { z _ { \Gamma } ^ { n + 1 } = W _ { \Gamma } ^ { \dagger } \pmb { x } = \ ( W _ { \Gamma } ^ { \top } W _ { \Gamma } ) ^ { - 1 } W _ { \Gamma } ^ { \top } \pmb { x } } \\ & { z _ { ( \Gamma ) ^ { c } } ^ { n + 1 } = \ 0 } \end{array}
69
+ $$
70
+
71
+ Assume $H = W ^ { \prime } W - I$ and $z _ { \mathrm { 0 } }$ is the true sparse solution. The first step of ITI estimates the support set as $\Gamma = \mathrm { s u p p } _ { k } ( W ^ { \top } \pmb { x } ) = \mathrm { s u p p } _ { k } ( z _ { 0 } + H z _ { 0 } )$ . If $W$ was orthogonal, we would have $H z _ { 0 } = 0$ and the algorithm would succeed in the first iteration. But if $W$ is overcomplete, $H z _ { 0 }$ behaves as a noise vector whose variance decreases after each iteration. After estimating the support set of $_ { z }$ as $\Gamma$ , we restrict $W$ to the indices included in $\Gamma$ and form $W _ { \Gamma }$ . We then use the pseudo-inverse of $W _ { \Gamma }$ to estimate the non-zero values minimizing $\begin{array} { r l } { \| \pmb { x } - \ b { W } _ { \Gamma } \pmb { z } _ { \Gamma } \| _ { 2 } ^ { 2 } } \end{array}$ . Lastly, we refine the support estimation and repeat the whole process until convergence.
72
+
73
+ # 3.2. Sparse Coding with the $k$ -Sparse Autoencoder
74
+
75
+ Here, we show that we can derive the $k$ -sparse autoencoder tarining algorithm by approximating a sparse coding algorithm that uses the ITI algorithm jointly with a dictionary update stage.
76
+
77
+ The conventional approach of sparse coding is to fix the sparse code matrix $Z$ , while updating the dictionary. However, here, after estimating the support set in the first step of the ITI algorithm, we jointly perform the inversion step of ITI and the dictionary update step, while fixing just the support set of the sparse code $Z$ . In other words, we update the atoms of the dictionary and allow the corresponding non-zero values to change at the same time to minimize $\| X - W _ { \Gamma } Z _ { \Gamma } \| _ { 2 } ^ { 2 }$ over both $W _ { \Gamma }$ and $Z _ { \Gamma }$ .
78
+
79
+ When we are performing sparse recovery with the ITI algorithm using a fixed dictionary, we should perform a fixed number of iterations to get the perfect reconstruction of the signal. But, in sparse coding, since we learnt a dictionary that is adapted to the signals, as shown in Section 3.3, we can find the support set just with the first iteration of ITI:
80
+
81
+ $$
82
+ \Gamma _ { z } = \operatorname* { s u p p } _ { k } ( W ^ { \top } \pmb { x } )
83
+ $$
84
+
85
+ In the inversion step of the ITI algorithm, once we estimate the support set, we use the pseudo-inverse of
86
+
87
+ $W _ { \Gamma }$ to find the non-zero values of the support set. The pseudo-inverse of the matrix $W _ { \Gamma }$ is a matrix, such as $P _ { \Gamma }$ , that minimizes the following cost function.
88
+
89
+ $$
90
+ \begin{array} { r l r } { { W _ { \Gamma } ^ { \dagger } = \arg \operatorname* { m i n } \| \pmb { x } - W _ { \Gamma } \pmb { z } _ { \Gamma } \| _ { 2 } ^ { 2 } } } \\ & { } & { = \arg \operatorname* { m i n } \| \pmb { x } - W _ { \Gamma } P _ { \Gamma } \pmb { x } \| _ { 2 } ^ { 2 } } \\ & { } & { P _ { \Gamma } } \end{array}
91
+ $$
92
+
93
+ Finding the exact pseudo-inverse of $W _ { \Gamma }$ is computationally expensive, so instead, we perform a single step of gradient descent. The gradient with respect to $P _ { \Gamma }$ is found as follows:
94
+
95
+ $$
96
+ \frac { \partial \| \pmb { x } - \ b { W } _ { \Gamma } \pmb { z } _ { \Gamma } \| _ { 2 } ^ { 2 } } { \partial P _ { \Gamma } } = \frac { \partial \| \pmb { x } - \ b { W } _ { \Gamma } \pmb { z } _ { \Gamma } \| _ { 2 } ^ { 2 } } { \partial \ b { z } _ { \Gamma } } \pmb { x }
97
+ $$
98
+
99
+ The first term of the right hand side of the Equation (6) is the dictionary update stage, which is computed as follows:
100
+
101
+ $$
102
+ \frac { \partial \| \pmb { x } - \ b { W } _ { \Gamma } \pmb { z } _ { \Gamma } \| _ { 2 } ^ { 2 } } { \partial \pmb { z } _ { \Gamma } } = ( \ b { W } _ { \Gamma } \pmb { z } _ { \Gamma } - \pmb { x } ) \pmb { z } _ { \Gamma } ^ { \top }
103
+ $$
104
+
105
+ Therefore, in order to approximate the pseudo-inverse, we first find the dictionary derivative and then “backpropagate” it to find the update of the pseudo-inverse.
106
+
107
+ We can view these operations in the context of an autoencoder with linear activations where $P$ is the encoder weight matrix and $W$ is the decoder weight matrix. At each iteration, instead of back-propagating through all the hidden units, we just back-propagate through the units with the $k$ largest activities, defined by $ { \mathrm { s u p p } } _ { k } ( W ^ { \top } { \pmb x } )$ , which is the first iteration of ITI. Keeping the $k$ largest hidden activities and ignoring the others is the same as forming $W _ { \Gamma }$ by restricting $W$ to the estimated support set. Back-propagation on the decoder weights is the same as gradient descent on the dictionary and back-propagation on the encoder weights is the same as approximating the pseudoinverse of the corresponding $W _ { \Gamma }$ .
108
+
109
+ We can perform support estimation in the feedforward phase by assuming $P = W ^ { \prime }$ (i.e., the autoencoder has tied weights). In this case, support estimation can be done by computing $z = W ^ { \prime } x + b$ and picking the $k$ largest activations; the bias just accounts for the mean and subtracts its contribution. Then the “inversion” and “dictionary update” steps are done at the same time by back-propagation through just the units with the $k$ largest activities.
110
+
111
+ In summary, we can view $k$ -sparse autoencoders as the approximation of a sparse coding algorithm which uses ITI in the sparse recovery stage.
112
+
113
+ # 3.3. Importance of Incoherence
114
+
115
+ The coherence of a dictionary indicates the degree of similarity between different atoms or different collections of atoms. Since the dictionary is overcomplete, we can represent each column of the dictionary as a linear combination of other columns. But what incoherence implies is that we should not be able to represent a column as a sparse linear combination of other columns and the coefficients of the linear combination should be dense. For example, if two columns are exactly the same, then the dictionary is highly coherent since we can represent one of those columns as the sparse linear combination of the rest of the columns. A naive measure of coherence that has been proposed in the literature is the mutual coherence $\mu ( W )$ which is defined as the maximum absolute inner product across all the possible pairs of the atoms of the dictionary.
116
+
117
+ $$
118
+ \mu ( W ) = \operatorname* { m a x } _ { i \neq j } \left| \langle w _ { i } , { \pmb w } _ { j } \rangle \right|
119
+ $$
120
+
121
+ There is a close relationship between the coherency of the dictionary and the uniqueness of the sparse solution of $\mathbf { { x } } = \mathbf { { W z } }$ . In (Donoho & Elad, 2003), it has been proven that if $k \leq ( 1 + \mu ^ { - 1 } )$ , then the sparsest solution is unique.
122
+
123
+ We can show that if the dictionary is incoherent enough, there is going to be an attraction ball around the signal $_ { x }$ and there is only one unique sparse linear combination of the columns that can get into this attraction ball. So even if we perturb the input with a small amount of noise, translation, rotation, etc., we can still achieve perfect reconstruction of the original signal and the sparse features are always roughly conserved. Therefore, incoherency of the dictionary is a measure of invariance and stability of the features. This is related to the denoising autoencoder (Vincent et al., 2008) in which we achieve invariant features by trying to reconstruct the original signal from its noisy versions.
124
+
125
+ Here we show that if the dictionary is incoherent enough, the first step of the ITI algorithm is sufficient for perfect sparse recovery.
126
+
127
+ Theorem 3.1. Assume $\mathbf { \boldsymbol { x } } = \boldsymbol { W } \boldsymbol { z }$ and the columns of the dictionary have unit $\ell _ { 2 }$ -norm. Also without loss of generality, assume that the non-zero elements of $_ z$ are its first $k$ elements and are sorted as $z _ { 1 } \ge z _ { 2 } \ge \dots \ge z _ { k }$ . Then, if $\begin{array} { r } { k \mu \leq \frac { z _ { k } } { 2 z _ { 1 } } } \end{array}$ , we can recover the support set of $_ { z }$ using $ { \mathrm { s u p p } } _ { k } ( W ^ { \intercal } \mathbf { x } )$ .
128
+
129
+ Proof: Let us assume $0 \leq i \leq k$ and $\mathbf { \boldsymbol { y } } = W ^ { \prime } \mathbf { \boldsymbol { x } }$ . Then, we can write:
130
+
131
+ $$
132
+ y _ { i } = z _ { i } + \sum _ { j = 1 , j \neq i } ^ { k } \langle w _ { i } , w _ { j } \rangle z _ { j } \quad \ge z _ { i } - \mu \sum _ { j = 1 , j \neq i } ^ { k } z _ { j } \ge z _ { k } - k \mu z _ { 1 }
133
+ $$
134
+
135
+ On the other hand:
136
+
137
+ $$
138
+ \operatorname* { m a x } _ { i > k } \ \left\{ y _ { i } \right\} = \operatorname* { m a x } _ { i > k } \ \left\{ \sum _ { j = 1 } ^ { k } \langle { \pmb w } _ { i } , { \pmb w } _ { j } \rangle z _ { j } \right\} \ \le k \mu z _ { 1 }
139
+ $$
140
+
141
+ So if $\begin{array} { r } { k \mu \leq \frac { z _ { k } } { 2 z _ { 1 } } } \end{array}$ , all the first $k$ elements of $\mathbf { \Delta } _ { \mathbf { \mu } _ { 3 } }$ are guaranteed to be greater than the rest of its elements.
142
+
143
+ As we can see from Theorem 3.1, the chances of finding the true support set with the encoder part of the $k$ - sparse autoencoder depends on the incoherency of the learnt dictionary. As the $k$ -sparse autoencoder converges (i.e., the reconstruction error goes to zero), the algorithm learns a dictionary that satisfies $\mathbf { \boldsymbol { x } } \approx \boldsymbol { W } \boldsymbol { z }$ , so the support set of $_ z$ can be estimated using the first step of ITI. Since $ { \mathrm { s u p p } } _ { k } ( W ^ { \prime } { \pmb x } )$ succeeds in finding the support set when the algorithm converges, the learnt dictionary must be sufficiently incoherent.
144
+
145
+ # 4. Experiments
146
+
147
+ In this section, we evaluate the performance of $k$ - sparse autoencoders in both unsupervised learning and in shallow and deep discriminative learning tasks.
148
+
149
+ # 4.1. Datasets
150
+
151
+ We use the MNIST handwritten digit dataset, which consists of 60,000 training images and 10,000 test images. We randomly separate the training set into 50,000 training cases and 10,000 cases for validation.
152
+
153
+ We also use the small NORB normalized-uniform dataset (LeCun et al., 2004), which contains 24,300 training examples and 24,300 test examples. This database contains images of 50 toys from 5 generic categories: four-legged animals, human figures, airplanes, trucks, and cars. Each image consists of two channels, each of size $9 6 \times 9 6$ pixels. We take the inner $6 4 \times 6 4$ pixels of each channel and resize it using bicubic interpolation to the size of $3 2 \times 3 2$ pixels from which we form a vector with 2048 dimensions as the input. Data points are subtracted by the mean and divided by the standard deviation along each input dimension across the whole training set to normalize the contrast. The training set is separated into 20,000 for training and 4,300 for validation.
154
+
155
+ We also test our method on natural image patches extracted from CIFAR-10 dataset. We randomly extract 1000000 patches of size 8×8 from the 50000 32 $\times$ 32 images of CIFAR-10. Each patch is then locally contrastnormalized and ZCA whitened. This preprocessing pipeline is the same as the one used in (Coates et al., 2011) for feature extraction.
156
+
157
+ # 4.2. Training of $k$ -Sparse Autoencoders
158
+
159
+ # 4.2.1. Scheduling of the Sparsity Level
160
+
161
+ When we are enforcing low sparsity levels in $k$ -sparse autoencoders (e.g., $k { = } 1 5$ on MNIST), one issue that might arise is that in the first few epochs, the algorithm greedily assigns individual hidden units to groups of training cases, in a manner similar to $k$ - means clustering. In subsequent epochs, these hidden units will be picked and re-enforced and other hidden units will not be adjusted. That is, too much sparsity can prevent gradient back-propagation from adjusting the weights of these other ‘dead’ hidden units. We can address this problem by scheduling the sparsity level over epochs as follows.
162
+
163
+ Suppose we are aiming for a sparsity level of $k = 1 5$ . Then, we start off with a large sparsity level (e.g. $k = 1 0 0$ ) for which the $k$ -sparse autoencoder can train all the hidden units. We then linearly decrease the sparsity level from $k = 1 0 0$ to $k ~ = ~ 1 5$ over the first half of the epochs. This initializes the autoencoder in a good regime, for which all of the hidden units have a significant chance of being picked. Then, we keep $k = 1 5$ for the second half of the epochs. With this scheduling, we can train all of the filters, even for low sparsity levels.
164
+
165
+ # 4.2.2. Training Hyper-parameters
166
+
167
+ We optimized the model parameters using stochastic gradient descent with momentum as follows.
168
+
169
+ $$
170
+ \begin{array} { r l } & { { \pmb v } _ { k + 1 } = m _ { k } { \pmb v } _ { k } - \eta _ { k } \nabla f ( { \pmb x } _ { k } ) } \\ & { { \pmb x } _ { k + 1 } = { \pmb x } _ { k } + { \pmb v } _ { k } } \end{array}
171
+ $$
172
+
173
+ Here, ${ \pmb v } _ { k }$ is the velocity vector, $m _ { k }$ is the momentum and $\eta _ { k }$ is the learning rate at the $k$ -th iteration. We also use a Gaussian distribution with a standard deviation of $\sigma$ for initialization of the weights. We use different momentum values, learning rates and initializations based on the task and the dataset, and validation is used to select hyperparameters. In the unsupervised MNIST task, the values were $\sigma = 0 . 0 1$ , $m _ { k } = 0 . 9$ and $\eta _ { k } = 0 . 0 1$ , for 5000 epochs. In the supervised MNIST task, training started with $m _ { k } = 0 . 2 5$ and $\eta _ { k } = 1$ , and then the learning rate was linearly decreased to 0.001 over 200 epochs. In the unsupervised NORB task, the values were $\sigma = 0 . 0 1$ , $m _ { k } \ = \ 0 . 9$ and $\eta _ { k } ~ = ~ 0 . 0 0 0 1$ , for 5000 epochs. In the supervised NORB task, training started with $m _ { k } ~ = ~ 0 . 9$ and $\eta _ { k } ~ = ~ 0 . 0 1$ , and then the learning rate was linearly decreased to 0.001 over 200 epochs.
174
+
175
+ # 4.2.3. Implementations
176
+
177
+ While most of the conventional sparse coding algorithms require complex matrix operations such as matrix inversion or SVD decomposition, the $k$ -sparse autoencoders only need matrix multiplications and sorting operations in both dictionary learning stage and the sparse encoding stage. (For a parallel, distributed implementation, the sorting operation can be replaced by a method that recursively applies a threshold until $k$ values remain.) We used an efficient GPU implementation obtained using the publicly available gnumpy library (Tieleman, 2010) on a single Nvidia GTX 680 GPU.
178
+
179
+ # 4.3. Effect of Sparsity Level
180
+
181
+ In $k$ -sparse autoencoders, we are able to tune the value of $k$ to obtain the desirable sparsity level which makes the algorithm suitable for a wide variety of datasets. For example, one application could be pre-training a shallow or deep discriminative neural network. For large values of $k$ (e.g., $k = 1 0 0$ on MNIST), the algorithm tends to learn very local features as is shown in Figure 1a and 2a. These features are too primitive to be used for classification using a shallow architecture since a naive linear classifier does not have enough capacity to combine these features and achieve a good classification rate. However, these features could be used for pre-training deep neural nets.
182
+
183
+ As we decrease the the sparsity level (e.g., $k = 4 0$ on MNIST), the output is reconstructed using a smaller number of hidden units and thus the features tend to be more global, as can be seen in Figure 1b,1c and 2b. For example, in the MNIST dataset, the lengths of the strokes increase when the sparsity level is decreased. These less local features are suitable for classification using a shallow architecture. Nevertheless, forcing too much sparsity (e.g., $k = 1 0$ on MNIST), results in features that are too global and do not factor the input into parts, as depicted Figure 1d and 2c.
184
+
185
+ Fig. 3 shows the visualization of filters of the $k$ -sparse autoencoder with 1000 hidden units and sparsity level of $k = 5 0$ learnt from random image patches extracted from CIFAR-10 dataset. We can see that the $k$ -sparse autoencoder has learnt localized Gabor filters from natural image patches.
186
+
187
+ Fig. 4 plots histograms of the hidden unit activities for various unsupervised learning algorithms, includ
188
+
189
+ ![](images/332dc261befcf49349437cd00b53e2156d546ab00b83ea47ff57d3d8a5e5de87.jpg)
190
+
191
+ ![](images/7429904c08e0e83a1b16437236055c382f73bb120af58829f3d9fc466c0857ee.jpg)
192
+
193
+ ![](images/3c3066ced5fde44c5f3f613f4f7ec27bac925e40bd33aefeb60fa4c94d7de4f4.jpg)
194
+
195
+ ![](images/63a567dff79edbec4ced74bda7ea546009e05b55ac17722fe5e754394a36861f.jpg)
196
+
197
+ Figure 1. Filters of the $k$ -sparse autoencoder for different sparsity levels $k$ , learnt from MNIST with 1000 hidden units.
198
+
199
+ ![](images/369b6aa11664303f4d02df93b68bf637f73026685dec6034f651838360bf7183.jpg)
200
+
201
+ ![](images/ecc8d3e197490fc97491de46169e0ff5274c15abc19b5545a4c62c82f41aafd4.jpg)
202
+
203
+ ![](images/8f1599f23863f1051944789509aa4750379253b71e5c3a8837b56ba0b0b3f083.jpg)
204
+
205
+ Figure 2. Filters of the $k$ -sparse autoencoder for different sparsity levels $k$ , learnt from NORB with 4000 hidden units.
206
+
207
+ Table 1. Performance of unsupervised learning methods (without fine-tuning) with 1000 hidden units on MNIST.
208
+
209
+ <table><tr><td></td><td>ErrorRate</td></tr><tr><td>RawPixels</td><td>7.20%</td></tr><tr><td>RBM</td><td>1.81%</td></tr><tr><td>Dropout Autoencoder (50% hidden)</td><td>1.80%</td></tr><tr><td>Denoising Autoencoder</td><td>1.95%</td></tr><tr><td>(20% input dropout) Dropout + Denoising Autoencoder</td><td>1.60%</td></tr><tr><td>(20% input and 50% hidden)</td><td></td></tr><tr><td>k-Sparse Autoencoder, k = 40</td><td>1.54%</td></tr><tr><td>k-Sparse Autoencoder, k = 25</td><td>1.35%</td></tr><tr><td>k-Sparse Autoencoder,k = 10</td><td>2.10%</td></tr></table>
210
+
211
+ ing the $k$ -sparse autoencoder ( $k$ =70 and $k { = } 1 5$ ), applied to the MNIST data. This figure contrasts the sparsity achieved by the $k$ -sparse autoencoder with that of other algorithms.
212
+
213
+ ![](images/939c333eac51410b54c8d5cc7d3a5819f7f82f3684f483938e2174f69e09bebf.jpg)
214
+ Figure 3. Filters of $k$ -sparse autoencoder with 1000 hidden units and $k = 5 0$ , learnt from CIFAR-10 random patches.
215
+
216
+ # 4.4. Unsupervised Feature Learning Results
217
+
218
+ In order to compare the quality of the features learnt by our algorithm with those learnt by other unsupervised learning methods, we first extracted features using each unsupervised learning algorithm. Then we fixed the features and trained a logistic regression classifier using those features. The usefulness of the features is then evaluated by examining the error rate of the classifier.
219
+
220
+ We trained a number of architectures on the MNIST and NORB datasets, including RBM, dropout autoencoder and denoising autoencoder. In dropout, after finding the features using dropout regularization with a dropout rate of $5 0 \%$ , we used all of the hidden units as the features (this worked best). For the denoising autoencoder, after training the network by dropping the input pixels with a rate of $2 0 \%$ , we used all of the uncorrupted input pixels to find the features for classification (this worked best). In the $k$ - sparse autoencoder, after training the dictionary, we used $h = \operatorname { s u p p } _ { \alpha k } ( W ^ { \prime } \mathbf { \alpha } x + b )$ to find the features as explained in Section 2.2, where $\alpha$ was determined using validation data. Results for different architectures are compared in Tables 1, 2. We can see that the performance of our $k$ -sparse autoencoder is better than the rest of the algorithms. In our algorithm, the best result is achieved by $k = 2 5 , \alpha = 3$ with 1000 hidden units on MNIST dataset and by $k = 1 5 0 , \alpha = 2$ with 4000 hidden units on NORB dataset.
221
+
222
+ Table 2. Performance of unsupervised learning methods (without fine-tuning) with 4000 hidden units on NORB.
223
+
224
+ <table><tr><td></td><td>Error Rate</td></tr><tr><td>Raw Pixels RBM (weight decay)</td><td>23% 10.6%</td></tr><tr><td>Dropout Autoencoder</td><td>10.1%</td></tr><tr><td>Denoising Autoencoder</td><td>9.5%</td></tr><tr><td>(20% input dropout) k-Sparse Autoencoder, k = 200</td><td></td></tr><tr><td>k-Sparse Autoencoder, k = 150</td><td>10.4%</td></tr><tr><td>k-Sparse Autoencoder, k = 75</td><td>8.6% 9.5%</td></tr></table>
225
+
226
+ ![](images/4505b1a1f8216a0386e0a0cb90c16f2b401e4168287398647985091e7113193b.jpg)
227
+ Figure 4. Histogram of hidden unit activities for various unsupervised learning methods.
228
+
229
+ # 4.5. Shallow Supervised Learning Results
230
+
231
+ In supervised learning, it is a common practice to use the encoder weights learnt by an unsupervised learning method to initialize the early layers of a multilayer discriminative model (Erhan et al., 2010). The back-propagation algorithm is then used to adjust the weights of the last hidden layer and also to fine-tune the weights in the previous layers. This procedure is often referred to as discriminative fine-tuning. In this section, we report results using unsupervised learning algorithms such as RBMs, DBNs (Salakhutdinov $\&$ Larochelle, 2010), DBMs (Salakhutdinov & Larochelle, 2010), third-order RBM (Nair & Hinton, 2009), dropout autoencoders, denoising autoencoders and $k$ -sparse autoencoders to initialize a shallow discriminative neural network for the MNIST and NORB datasets. We used backpropagation to fine-tune the weights. The regularization method used in the fine-tuning stage of different algorithms is the same as the one used in the training of the corresponding unsupervised learning task. For instance, we fine-tuned the weights obtained from dropout autoencoder with dropout regularization or in denoising autoencoder, we fine-tuned the discriminative neural net by adding noise to the input. In a similar manner, in the fine-tuning stage of the $k$ -sparse autoencoder, we used the $\alpha k$ largest hidden units in the corresponding discriminative neural network, as explained in Section 2.2. Tables 3 and 4 reports the error rates obtained by different methods.
232
+
233
+ Table 3. Performance of supervised learning methods on MNIST. Pre-training was performed using the corresponding unsupervised learning algorithm with 1000 hidden units, and then the model was fine-tuned.
234
+
235
+ <table><tr><td></td><td>Error</td></tr><tr><td>Without Pre-Training RBM + F.T. Shallow Dropout AE + F.T.</td><td>1.60% 1.24% 1.05%</td></tr><tr><td>(%50 hidden) Denoising AE + F.T.</td><td>1.20%</td></tr><tr><td>(%20 input dropout) Deep Dropout AE + F.T. (Layer-wise pre-training,%50 hidden)</td><td>0.85%</td></tr><tr><td>k-Sparse AE + F.T. (k=25) Deep k-Sparse AE + F.T.</td><td>1.08% 0.97%</td></tr></table>
236
+
237
+ Table 4. Performance of supervised learning methods on NORB. Pre-training was performed using the corresponding unsupervised learning algorithm with 4000 hidden units, and then the model was fine-tuned.
238
+
239
+ <table><tr><td>Without Pre-Training</td><td>Error</td></tr><tr><td>DBN DBM third-order RBM Shallow Dropout AE + F.T. (%50 hidden)</td><td>12.7% 8.3% 7.2% 6.5% 8.2% 7.9%</td></tr></table>
240
+
241
+ # 4.6. Deep Supervised Learning Results
242
+
243
+ The $k$ -sparse autoencoder can be used as a building block of a deep neural network, using greedy layerwise pre-training (Bengio et al., 2007). We first train a shallow $k$ -sparse autoencoder and obtain the hidden codes. We then fix the features and train another $k$ - sparse autoencoder on top of them to obtain another set of hidden codes. Then we use the parameters of these autoencoders to initialize a discriminative neural network with two hidden layers.
244
+
245
+ In the fine-tuning stage of the deep neural net, we first fix the parameters of the first and second layers and train a softmax classifier on top of the second layer. We then hold the weights of the first layer fixed and train the second layer and softmax jointly using the initialization of the softmax that we found in the previous step. Finally, we jointly fine-tune all of the layers with the previous initialization. We have observed that this method of layer-wise fine-tuning can improve the classification performance compared to the case where we fine-tune all the layers at the same time.
246
+
247
+ In all of the fine-tuning steps, we keep the $\alpha k$ largest hidden codes, where $k = 2 5 , \alpha = 3$ in MNIST and $k =$ $1 5 0 , \alpha = 2$ in NORB in both hidden layers. Tables 3 and 4 report the classification results of different deep supervised learning methods.
248
+
249
+ # 5. Conclusion
250
+
251
+ In this work, we proposed a very fast sparse coding method called $k$ -sparse autoencoder, which achieves exact sparsity in the hidden representation. The main message of this paper is that we can use the resulting representations to achieve state-of-the-art classification results, solely by enforcing sparsity in the hidden units and without using any other nonlinearity or regularization. We also discussed how the $k$ -sparse autoencoder could be used for pre-training shallow and deep supervised architectures.
252
+
253
+ # 6. Acknowledgment
254
+
255
+ We would like to thank Andrew Delong, Babak Alipanahi and Lei Jimmy Ba for the valuable comments.
256
+
257
+ # References
258
+
259
+ Aharon, Michal, Elad, Michael, and Bruckstein, Alfred. K-svd: Design of dictionaries for sparse representation. Proceedings of SPARS, 5:9–12, 2005.
260
+
261
+ Bengio, Yoshua, Lamblin, Pascal, Popovici, Dan, and Larochelle, Hugo. Greedy layer-wise training of deep networks. Advances in neural information processing systems, 19:153, 2007.
262
+
263
+ Blumensath, Thomas and Davies, Mike E. Iterative hard thresholding for compressed sensing. Applied and Computational Harmonic Analysis, 27(3):265– 274, 2009.
264
+
265
+ Coates, Adam and Ng, Andrew. The importance of encoding versus training with sparse coding and vector quantization. In Proceedings of the 28th International Conference on Machine Learning (ICML-11), pp. 921–928, 2011.
266
+
267
+ Coates, Adam, Ng, Andrew Y, and Lee, Honglak. An analysis of single-layer networks in unsupervised feature learning. In International Conference on Artificial Intelligence and Statistics, pp. 215–223, 2011.
268
+
269
+ Donoho, David L and Elad, Michael. Optimally sparse representation in general (nonorthogonal) dictionaries via 1 minimization. Proceedings of the National Academy of Sciences, 100(5):2197–2202, 2003.
270
+
271
+ Engan, Kjersti, Aase, Sven Ole, and Hakon Husoy, J. Method of optimal directions for frame design. In Acoustics, Speech, and Signal Processing, 1999. Proceedings., 1999 IEEE International Conference on, volume 5, pp. 2443–2446. IEEE, 1999.
272
+
273
+ Erhan, Dumitru, Bengio, Yoshua, Courville, Aaron, Manzagol, Pierre-Antoine, Vincent, Pascal, and Bengio, Samy. Why does unsupervised pre-training help deep learning? The Journal of Machine Learning Research, 11:625–660, 2010.
274
+
275
+ Gregor, Karol and LeCun, Yann. Learning fast approximations of sparse coding. In Proceedings of the 27th International Conference on Machine Learning (ICML-10), pp. 399–406, 2010.
276
+
277
+ Hinton, Geoffrey E, Srivastava, Nitish, Krizhevsky, Alex, Sutskever, Ilya, and Salakhutdinov, Ruslan R. Improving neural networks by preventing co-adaptation of feature detectors. arXiv preprint arXiv:1207.0580, 2012.
278
+
279
+ Kavukcuoglu, Koray, Ranzato, Marc’Aurelio, and LeCun, Yann. Fast inference in sparse coding algorithms with applications to object recognition. arXiv preprint arXiv:1010.3467, 2010.
280
+
281
+ LeCun, Yann, Huang, Fu Jie, and Bottou, Leon. Learning methods for generic object recognition with invariance to pose and lighting. In Computer Vision and Pattern Recognition, CVPR, volume 2, pp. II–97. IEEE, 2004.
282
+
283
+ Lee, Honglak, Ekanadham, Chaitanya, and Ng, Andrew. Sparse deep belief net model for visual area v2. In Advances in neural information processing systems, pp. 873–880, 2007.
284
+
285
+ Maleki, Arian. Coherence analysis of iterative thresholding algorithms. In Communication, Control, and Computing, 2009. Allerton 2009. 47th Annual Allerton Conference on, pp. 236–243. IEEE, 2009.
286
+
287
+ Nair, Vinod and Hinton, Geoffrey E. 3d object recognition with deep belief nets. In Advances in Neural Information Processing Systems, pp. 1339–1347, 2009.
288
+
289
+ Olshausen, Bruno A and Field, David J. Sparse coding with an overcomplete basis set: A strategy employed by v1? Vision research, 37(23):3311–3325, 1997.
290
+
291
+ Salakhutdinov, Ruslan and Larochelle, Hugo. Efficient learning of deep boltzmann machines. In International Conference on Artificial Intelligence and Statistics, pp. 693–700, 2010.
292
+
293
+ Tieleman, Tijmen. Gnumpy: an easy way to use gpu boards in python. Department of Computer Science, University of Toronto, 2010.
294
+
295
+ Tropp, Joel A and Gilbert, Anna C. Signal recovery from random measurements via orthogonal matching pursuit. Information Theory, IEEE Transactions on, 53(12):4655–4666, 2007.
296
+
297
+ Van Gemert, Jan C, Geusebroek, Jan-Mark, Veenman, Cor J, and Smeulders, Arnold WM. Kernel codebooks for scene categorization. In Computer Vision– ECCV 2008, pp. 696–709. Springer, 2008.
298
+
299
+ Vincent, Pascal, Larochelle, Hugo, Bengio, Yoshua, and Manzagol, Pierre-Antoine. Extracting and composing robust features with denoising autoencoders. In Proceedings of the 25th international conference on Machine learning, pp. 1096–1103. ACM, 2008.
md/train/S1HEBe_Jl/S1HEBe_Jl.md ADDED
@@ -0,0 +1,291 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LEARNING TO PROTECT COMMUNICATIONS WITH ADVERSARIAL NEURAL CRYPTOGRAPHY
2
+
3
+ Mart´ın Abadi and David G. Andersen ∗ Google Brain
4
+
5
+ # ABSTRACT
6
+
7
+ We ask whether neural networks can learn to use secret keys to protect information from other neural networks. Specifically, we focus on ensuring confidentiality properties in a multiagent system, and we specify those properties in terms of an adversary. Thus, a system may consist of neural networks named Alice and Bob, and we aim to limit what a third neural network named Eve learns from eavesdropping on the communication between Alice and Bob. We do not prescribe specific cryptographic algorithms to these neural networks; instead, we train end-to-end, adversarially. We demonstrate that the neural networks can learn how to perform forms of encryption and decryption, and also how to apply these operations selectively in order to meet confidentiality goals.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ As neural networks are applied to increasingly complex tasks, they are often trained to meet endto-end objectives that go beyond simple functional specifications. These objectives include, for example, generating realistic images (e.g., (Goodfellow et al., 2014a)) and solving multiagent problems (e.g., (Foerster et al., 2016a;b; Sukhbaatar et al., 2016)). Advancing these lines of work, we show that neural networks can learn to protect their communications in order to satisfy a policy specified in terms of an adversary.
12
+
13
+ Cryptography is broadly concerned with algorithms and protocols that ensure the secrecy and integrity of information. Cryptographic mechanisms are typically described as programs or Turing machines. Attackers are also described in those terms, with bounds on their complexity (e.g., limited to polynomial time) and on their chances of success (e.g., limited to a negligible probability). A mechanism is deemed secure if it achieves its goal against all attackers. For instance, an encryption algorithm is said to be secure if no attacker can extract information about plaintexts from ciphertexts. Modern cryptography provides rigorous versions of such definitions (Goldwasser & Micali, 1984).
14
+
15
+ Adversaries also play important roles in the design and training of neural networks. They arise, in particular, in work on adversarial examples (Szegedy et al., 2013; Goodfellow et al., 2014b) and on generative adversarial networks (GANs) (Goodfellow et al., 2014a). In this latter context, the adversaries are neural networks (rather than Turing machines) that attempt to determine whether a sample value was generated by a model or drawn from a given data distribution. Furthermore, in contrast with definitions in cryptography, practical approaches to training GANs do not consider all possible adversaries in a class, but rather one or a small number of adversaries that are optimized by training. We build on these ideas in our work.
16
+
17
+ Neural networks are generally not meant to be great at cryptography. Famously, the simplest neural networks cannot even compute XOR, which is basic to many cryptographic algorithms. Nevertheless, as we demonstrate, neural networks can learn to protect the confidentiality of their data from other neural networks: they discover forms of encryption and decryption, without being taught specific algorithms for these purposes.
18
+
19
+ Knowing how to encrypt is seldom enough for security and privacy. Interestingly, neural networks can also learn what to encrypt in order to achieve a desired secrecy property while maximizing utility. Thus, when we wish to prevent an adversary from seeing a fragment of a plaintext, or from estimating a function of the plaintext, encryption can be selective, hiding the plaintext only partly.
20
+
21
+ The resulting cryptosystems are generated automatically. In this respect, our work resembles recent research on automatic synthesis of cryptosystems, with tools such as ZooCrypt (Barthe et al., 2013), and contrasts with most of the literature, where hand-crafted cryptosystems are the norm. ZooCrypt relies on symbolic theorem-proving, rather than neural networks.
22
+
23
+ Classical cryptography, and tools such as ZooCrypt, typically provide a higher level of transparency and assurance than we would expect by our methods. Our model of the adversary, which avoids quantification, results in much weaker guarantees. On the other hand, it is refreshingly simple, and it may sometimes be appropriate.
24
+
25
+ Consider, for example, a neural network with several components, and suppose that we wish to guarantee that one of the components does not rely on some aspect of the input data, perhaps because of concerns about privacy or discrimination. Neural networks are notoriously difficult to explain, so it may be hard to characterize how the component functions. A simple solution is to treat the component as an adversary, and to apply encryption so that it does not have access to the information that it should not use. In this respect, the present work follows the recent research on fair representations (Edwards & Storkey, 2015; Louizos et al., 2015), which can hide or remove sensitive information, but goes beyond that work by allowing for the possibility of decryption, which supports richer dataflow structures.
26
+
27
+ Classical cryptography may be able to support some applications along these lines. In particular, homomorphic encryption enables inference on encrypted data (Xie et al., 2014; Gilad-Bachrach et al., 2016). On the other hand, classical cryptographic functions are generally not differentiable, so they are at odds with training by stochastic gradient descent (SGD), the main optimization technique for deep neural networks. Therefore, we would have trouble learning what to encrypt, even if we know how to encrypt. Integrating classical cryptographic functions—and, more generally, integrating other known functions and relations (e.g., (Neelakantan et al., 2015))—into neural networks remains a fascinating problem.
28
+
29
+ Prior work at the intersection of machine learning and cryptography has focused on the generation and establishment of cryptographic keys (Ruttor, 2006; Kinzel & Kanter, 2002), and on corresponding attacks (Klimov et al., 2002). In contrast, our work takes these keys for granted, and focuses on their use; a crucial, new element in our work is the reliance on adversarial goals and training. More broadly, from the perspective of machine learning, our work relates to the application of neural networks to multiagent tasks, mentioned above, and to the vibrant research on generative models and on adversarial training (e.g., (Goodfellow et al., 2014a; Denton et al., 2015; Salimans et al., 2016; Nowozin et al., 2016; Chen et al., 2016; Ganin et al., 2015)). From the perspective of cryptography, it relates to big themes such as privacy and discrimination. While we embrace a playful, exploratory approach, we do so with the hope that it will provide insights useful for further work on these topics.
30
+
31
+ Section 2 presents our approach to learning symmetric encryption (that is, shared-key encryption, in which the same keys are used for encryption and for decryption) and our corresponding results. Appendix A explains how the same concepts apply to asymmetric encryption (that is, public-key encryption, in which different keys are used for encryption and for decryption). Section 3 considers selective protection. Section 4 concludes and suggests avenues for further research. Appendix B is a brief review of background on neural networks.
32
+
33
+ # 2 LEARNING SYMMETRIC ENCRYPTION
34
+
35
+ This section discusses how to protect the confidentiality of plaintexts using shared keys. It describes the organization of the system that we consider, and the objectives of the participants in this system. It also explains the training of these participants, defines their architecture, and presents experiments.
36
+
37
+ # 2.1 SYSTEM ORGANIZATION
38
+
39
+ A classic scenario in security involves three parties: Alice, Bob, and Eve. Typically, Alice and Bob wish to communicate securely, and Eve wishes to eavesdrop on their communications. Thus, the desired security property is secrecy (not integrity), and the adversary is a “passive attacker” that can intercept communications but that is otherwise quite limited: it cannot initiate sessions, inject messages, or modify messages in transit.
40
+
41
+ ![](images/a9ab23800cec3a710c3d5a1a9f20ac086445be9bf9db444a6228fd3deb1894d7.jpg)
42
+ Figure 1: Alice, Bob, and Eve, with a symmetric cryptosystem.
43
+
44
+ We start with a particularly simple instance of this scenario, depicted in Figure 1, in which Alice wishes to send a single confidential message $P$ to Bob. The message $P$ is an input to Alice. When Alice processes this input, it produces an output $C$ . (“ $\cdot { \cal { P } } ^ { \prime }$ ” stands for “plaintext” and “ $C ^ { \ast }$ stands for “ciphertext”.) Both Bob and Eve receive $C$ , process it, and attempt to recover $P$ . We represent what they compute by $P _ { \mathrm { B o b } }$ and $P _ { \mathrm { E v e } }$ , respectively. Alice and Bob have an advantage over Eve: they share a secret key $K$ . We treat $K$ as an additional input to Alice and Bob. We assume one fresh key $K$ per plaintext $P$ , but, at least at this abstract level, we do not impose that $K$ and $P$ have the same length.
45
+
46
+ For us, Alice, Bob, and Eve are all neural networks. We describe their structures in Sections 2.4 and 2.5. They each have parameters, which we write $\theta _ { A }$ , $\theta _ { B }$ , and $\theta _ { E }$ , respectively. Since $\theta _ { A }$ and $\theta _ { B }$ need not be equal, encryption and decryption need not be the same function even if Alice and Bob have the same structure. As is common for neural networks, Alice, Bob, and Eve work over tuples of floating-point numbers, rather than sequences of bits. In other words, $K , P , P _ { \mathrm { B o b } } , P _ { \mathrm { E v e } } ,$ and $C$ are all tuples of floating-point numbers. Note that, with this formulation, $C$ , $P _ { \mathrm { B o b } }$ , and $P _ { \mathrm { E v e } }$ may consist of arbitrary floating-point numbers even if $P$ and $K$ consist of 0s and 1s. In practice, our implementations constrain these values to the range $( - 1 , 1 )$ , but permit the intermediate values. We have explored alternatives (based on Williams’ REINFORCE algorithm (Williams, 1992) or on Foerster et al.’s discretization technique (Foerster et al., 2016b)), but omit them as they are not essential to our main points.
47
+
48
+ This set-up, although rudimentary, suffices for basic schemes, in particular allowing for the possibility that Alice and Bob decide to rely on $K$ as a one-time pad, performing encryption and decryption simply by XORing the key $K$ with the plaintext $P$ and the ciphertext $C$ , respectively. However, we do not require that Alice and Bob function in this way—and indeed, in our experiments in Section 2.5, they discover other schemes. For simplicity, we ignore the process of generating a key from a seed. We also omit the use of randomness for probabilistic encryption (Goldwasser & Micali, 1984). Such enhancements may be the subject of further work.
49
+
50
+ # 2.2 OBJECTIVES
51
+
52
+ Informally, the objectives of the participants are as follows. Eve’s goal is simple: to reconstruct $P$ accurately (in other words, to minimize the error between $P$ and $P _ { \mathrm { E v e . } }$ ). Alice and Bob want to communicate clearly (to minimize the error between $P$ and $P _ { \mathrm { B o b . } }$ ), but also to hide their communication from Eve. Note that, in line with modern cryptographic definitions (e.g., (Goldwasser & Micali, 1984)), we do not require that the ciphertext $C$ “look random” to Eve. A ciphertext may even contain obvious metadata that identifies it as such. Therefore, it is not a goal for Eve to distinguish $C$ from a random value drawn from some distribution. In this respect, Eve’s objectives contrast with common ones for the adversaries of GANs. On the other hand, one could try to reformulate Eve’s goal in terms of distinguishing the ciphertexts constructed from two different plaintexts.
53
+
54
+ Given these objectives, instead of training each of Alice and Bob separately to implement some known cryptosystem (Dourlens, 1996), we train Alice and Bob jointly to communicate successfully and to defeat Eve without a pre-specified notion of what cryptosystem they may discover for this purpose. Much as in the definitions of GANs, we would like Alice and Bob to defeat the best possible version of Eve, rather than a fixed Eve. Of course, Alice and Bob may not win for every plaintext and every key, since knowledge of some particular plaintexts and keys may be hardwired into Eve. (For instance, Eve could always output the same plaintext, and be right at least once.) Therefore, we assume a distribution on plaintexts and keys, and phrase our goals for Alice and Bob in terms of expected values.
55
+
56
+ We write $A ( \theta _ { A } , P , K )$ for Alice’s output on input $P , K$ , write $B ( \theta _ { B } , C , K )$ for Bob’s output on input $C , K$ , and write $E ( { \boldsymbol { \theta } } _ { E } , C )$ for Eve’s output on input $C$ . We introduce a distance function $d$ on plaintexts. Although the exact choice of this function is probably not crucial, for concreteness we take the L1 distance $d ( P , P ^ { \prime } ) = \Sigma _ { i = 1 , N } | P _ { i } - P _ { i } ^ { \prime } |$ where $N$ is the length of plaintexts. We define a per-example loss function for Eve:
57
+
58
+ $$
59
+ L _ { E } ( \theta _ { A } , \theta _ { E } , P , K ) = d ( P , E ( \theta _ { E } , A ( \theta _ { A } , P , K ) ) )
60
+ $$
61
+
62
+ Intuitively, $L _ { E } ( \theta _ { A } , \theta _ { E } , P , K )$ represents how much Eve is wrong when the plaintext is $P$ and the key is $K$ . We also define a loss function for Eve over the distribution on plaintexts and keys by taking an expected value:
63
+
64
+ $$
65
+ L _ { E } ( \theta _ { A } , \theta _ { E } ) = \mathbb { E } _ { P , K } ( d ( P , E ( \theta _ { E } , A ( \theta _ { A } , P , K ) ) ) )
66
+ $$
67
+
68
+ We obtain the “optimal Eve” by minimizing this loss:
69
+
70
+ $$
71
+ O _ { E } ( \theta _ { A } ) = \mathrm { a r g m i n } _ { \theta _ { E } } ( L _ { E } ( \theta _ { A } , \theta _ { E } ) )
72
+ $$
73
+
74
+ Similarly, we define a per-example reconstruction error for Bob, and extend it to the distribution on plaintexts and keys:
75
+
76
+ $$
77
+ \begin{array} { r l } & { L _ { B } ( \theta _ { A } , \theta _ { B } , P , K ) = d ( P , B ( \theta _ { B } , A ( \theta _ { A } , P , K ) , K ) ) } \\ & { L _ { B } ( \theta _ { A } , \theta _ { B } ) = \mathbb { E } _ { P , K } ( d ( P , B ( \theta _ { B } , A ( \theta _ { A } , P , K ) , K ) ) ) } \end{array}
78
+ $$
79
+
80
+ We define a loss function for Alice and Bob by combining $L _ { B }$ and the optimal value of $L _ { E }$
81
+
82
+ $$
83
+ L _ { A B } ( \theta _ { A } , \theta _ { B } ) = L _ { B } ( \theta _ { A } , \theta _ { B } ) - L _ { E } ( \theta _ { A } , O _ { E } ( \theta _ { A } ) )
84
+ $$
85
+
86
+ This combination reflects that Alice and Bob want to minimize Bob’s reconstruction error and to maximize the reconstruction error of the “optimal Eve”. The use of a simple subtraction is somewhat arbitrary; below we describe useful variants. We obtain the “optimal Alice and Bob” by minimizing $L _ { A B } ( \theta _ { A } , \theta _ { B } )$ :
87
+
88
+ $$
89
+ ( O _ { A } , O _ { B } ) = \mathrm { a r g m i n } _ { ( \theta _ { A } , \theta _ { B } ) } ( L _ { A B } ( \theta _ { A } , \theta _ { B } ) )
90
+ $$
91
+
92
+ We write “optimal” in quotes because there need be no single global minimum. In general, there are many equi-optimal solutions for Alice and Bob. As a simple example, assuming that the key is of the same size as the plaintext and the ciphertext, Alice and Bob may XOR the plaintext and the ciphertext, respectively, with any permutation of the key, and all permutations are equally good as long as Alice and Bob use the same one; moreover, with the way we architect our networks (see Section 2.4), all permutations are equally likely to arise.
93
+
94
+ Training begins with the Alice and Bob networks initialized randomly. The goal of training is to go from that state to $( O _ { A } , O _ { B } )$ , or close to $( O _ { A } , O _ { B } )$ . We explain the training process next.
95
+
96
+ # 2.3 TRAINING REFINEMENTS
97
+
98
+ Our training method is based upon SGD. In practice, much as in work on GANs, our training method cuts a few corners and incorporates a few improvements with respect to the high-level description of objectives of Section 2.2. We present these refinements next, and give further details in Section 2.5.
99
+
100
+ First, the training relies on estimated values calculated over “minibatches” of hundreds or thousands of examples, rather than on expected values over a distribution.
101
+
102
+ We do not compute the “optimal Eve” for a given value of $\theta _ { A }$ , but simply approximate it, alternating the training of Eve with that of Alice and Bob. Intuitively, the training may for example proceed roughly as follows. Alice may initially produce ciphertexts that neither Bob nor Eve understand at all. By training for a few steps, Alice and Bob may discover a way to communicate that allows Bob to decrypt Alice’s ciphertexts at least partly, but which is not understood by (the present version of) Eve. In particular, Alice and Bob may discover some trivial transformations, akin to rot13. After a bit of training, however, Eve may start to break this code. With some more training, Alice and Bob may discover refinements, in particular codes that exploit the key material better. Eve eventually finds it impossible to adjust to those codes. This kind of alternation is typical of games; the theory of continuous games includes results about convergence to equilibria (e.g., (Ratliff et al., 2013)) which it might be possible to apply in our setting.
103
+
104
+ Furthermore, in the training of Alice and Bob, we do not attempt to maximize Eve’s reconstruction error. If we did, and made Eve completely wrong, then Eve could be completely right in the next iteration by simply flipping all output bits! A more realistic and useful goal for Alice and Bob is, generally, to minimize the mutual information between Eve’s guess and the real plaintext. In the case of symmetric encryption, this goal equates to making Eve produce answers indistinguishable from a random guess. This approach is somewhat analogous to methods that aim to prevent overtraining GANs on the current adversary (Salimans et al., 2016, Section 3.1). Additionally, we can tweak the loss functions so that they do not give much importance to Eve being a little lucky or to Bob making small errors that standard error-correction could easily address.
105
+
106
+ Finally, once we stop training Alice and Bob, and they have picked their cryptosystem, we validate that they work as intended by training many instances of Eve that attempt to break the cryptosystem. Some of these instances may be derived from earlier phases in the training.
107
+
108
+ # 2.4 NEURAL NETWORK ARCHITECTURE
109
+
110
+ The Architecture of Alice, Bob, and Eve Because we wish to explore whether a general neural network can learn to communicate securely, rather than to engineer a particular method, we aimed to create a neural network architecture that was sufficient to learn mixing functions such as XOR, but that did not strongly encode the form of any particular algorithm.
111
+
112
+ To this end, we chose the following “mix & transform” architecture. It has a first fully-connected (FC) layer, where the number of outputs is equal to the number of inputs. The plaintext and key bits are fed into this FC layer. Because each output bit can be a linear combination of all of the input bits, this layer enables—but does not mandate—mixing between the key and the plaintext bits. In particular, this layer can permute the bits. The FC layer is followed by a sequence of convolutional layers, the last of which produces an output of a size suitable for a plaintext or ciphertext. These convolutional layers learn to apply some function to groups of the bits mixed by the previous layer, without an a priori specification of what that function should be. Notably, the opposite order (convolutional followed by FC) is much more common in image-processing applications. Neural networks developed for those applications frequently use convolutions to take advantage of spatial locality. For neural cryptography, we specifically wanted locality—i.e., which bits to combine—to be a learned property, instead of a pre-specified one. While it would certainly work to manually pair each input plaintext bit with a corresponding key bit, we felt that doing so would be uninteresting.
113
+
114
+ We refrain from imposing further constraints that would simplify the problem. For example, we do not tie the parameters $\theta _ { A }$ and $\theta _ { B }$ , as we would if we had in mind that Alice and Bob should both learn the same function, such as XOR.
115
+
116
+ # 2.5 EXPERIMENTS
117
+
118
+ As a proof-of-concept, we implemented Alice, Bob, and Eve networks that take $N$ -bit random plaintext and key values, and produce $N$ -entry floating-point ciphertexts, for $N = 1 6$ , 32, and 64. Both plaintext and key values are uniformly distributed. Keys are not deliberately reused, but may reoccur because of random selection. (The experiments in Section 3 consider more interesting distributions and also allow plaintext and key values to have different sizes.)
119
+
120
+ We implemented our experiments in TensorFlow (Abadi et al., 2016a;b). We ran them on a workstation with one GPU; the specific computation platform does not affect the outcome of the experiments. We plan to release the source code for the experiments.
121
+
122
+ Network Structure Our networks follow the “mix & transform” pattern described in Section 2.4. The Alice network concatenates two $N$ -bit inputs (the plaintext and the key) into a $2 N$ -entry vector, using $- 1$ and 1 to represent the bit values. This vector is processed through a $2 N \times 2 N$ FC layer, then sent through a succession of four 1-D convolutional layers. The convolutional layers are described in terms of their window size, input depth, and output depth. Each has a “stride”—the amount by which the window is shifted at each step. The concrete layers are [4, 1, 2], [2, 2, 4], [1, 4, 4], and [1, 4, 1], with strides of $1 , 2 , 1 , 1$ . Intuitively, the first layer slides a size-4 window across the $2 N$ output elements from the FC layer, outputting two numbers (output depth 2), with stride 1. We use a sigmoid nonlinear unit after each layer except the final one. After the final layer, where the output is reduced to $N$ elements, we use a tanh nonlinear unit. (Recall that tanh has an output domain between $[ - 1 , 1 ]$ , bringing the values back to a range that can map to binary values.) The Bob network is identical to the Alice network The Eve network takes only the ciphertext as input, and thus has a first $N \times 2 N$ FC layer.
123
+
124
+ Training To train the networks, we use a “minibatch” size ranging from 256 to 4096 entries. Unless otherwise specified, we present the results from the training runs with 4096 entries. We use TensorFlow’s Adam (Kingma & Ba, 2014) optimizer with a learning rate of 0.0008. We do not reduce the learning rate over time because we wish Alice, Bob, and Eve to be able to continue to respond strongly to changes in other components, until Alice and Bob—hopefully—achieve a solution that is robust to additional changes in Eve.
125
+
126
+ Training alternates between Alice/Bob and Eve, with Alice/Bob training for one minibatch, and then Eve training for two minibatches. We chose this ratio in order to give a slight computational edge to the adversary Eve without training it so much that it becomes excessively specific to the exact current parameters of Alice and Bob. Empirically, this value has worked well.
127
+
128
+ Loss Functions Eve’s loss function is exactly as described above: the L1 distance between Eve’s guess and the input plaintext. The loss function for Alice and Bob is more complex, as indicated in Sections 2.2 and 2.3. This function has two components, related to Bob’s reconstruction error and to the eavesdropper’s success. The first component is simply the L1 distance between Bob’s output and the input plaintext. The latter component, on the other hand, is $( N / 2 - \mathrm { E v e } \ L 1 \mathrm { e r r o r } ) ^ { 2 } / ( N / 2 ) ^ { 2 }$ . This definition expresses the goal, described in Section 2.3, that Eve should not do better than random guessing. Accordingly, this component is minimized when half of the message bits are wrong and half are right. We choose a quadratic formula in order to place more emphasis on making Eve have a large error, and to impose less of a penalty when Eve guesses a few bits correctly, as should happen occasionally even if Eve’s guesses are effectively random. Adopting this formulation allowed us to have a meaningful per-example loss function (instead of looking at larger batch statistics), and improved the robustness of training. Its cost is that our final, trained Alice and Bob typically allow Eve to reconstruct slightly more bits than purely random guessing would achieve. We have not obtained satisfactory results for loss functions that depend linearly (rather than quadratically) on Eve’s reconstruction error. The best formulation remains an open question.
129
+
130
+ Post-training Evaluation After successfully training the networks so that they cross an accuracy threshold (e.g., at most 0.05 bits of reconstruction error for Alice and Bob, with Eve achieving only 1-2 bits more than random guessing would predict), we reset the Eve network and train it from scratch 5 times, each for up to 250,000 steps, recording the best result achieved by any Eve. An Alice/Bob combination that fails to achieve the target thresholds within 150,000 steps is a training failure. If the retrained Eves obtain a substantial advantage, the solution is non-robust. Otherwise, we consider it a successful training outcome.
131
+
132
+ Results Figure 2 shows, for one successful run, the evolution of Bob’s reconstruction error and Eve’s reconstruction error vs. the number of training steps for $N = 1 6$ bit plaintext and key values, using a minibatch size of 4096. Each point in the graph is the mean error across 4096 examples. An ideal result would have Bob’s reconstruction error drop to zero and Eve’s reconstruction error reach 8 (half the bits wrong). In this example, both reconstruction errors start high. After a period of time, Alice and Bob start to communicate quite effectively, but in a way that allows Eve to improve its understanding as well, gradually. Then, around step 10,000, Alice and Bob counter Eve’s progress. By about step 15,000, the training goals are effectively achieved. The remaining steps merely increase Eve’s reconstruction error slightly.
133
+
134
+ ![](images/237079668eea8bc4408ed9388b7bc9f2b86593044078b3e6611c6ee4e1c7a816.jpg)
135
+ Figure 2: Evolution of Bob’s and Eve’s reconstruction errors during training. Lines represent the mean error across a minibatch size of 4096.
136
+
137
+ ![](images/a9a52de758fe08259490978291475b7dd128e71fa22e19d0683904b6c4dd6231.jpg)
138
+ Figure 3: Final reconstruction errors of Bob and of the most effective retrained Eve, for the fourteen initially successful runs, of twenty. An ideal result would be a dot in the upper-left corner, representing no Bob reconstruction error and 8 bits of Eve reconstruction error.
139
+
140
+ This training graph does not look like a typical result for neural networks, where monotonicity in the number of steps is generally expected. Instead, the dynamics of this adversarial training appear somewhat more reminiscent of evolutionary processes. These dynamics appear to depend on somewhat random-seeming change to cause the bits to mix slightly, but once there is some mixing, the gradient descent can rapidly drive it farther.
141
+
142
+ Supporting this interpretation is the observation that training is not always successful. With $N = 1 6$ , six of twenty initial runs were failures that never got Bob’s reconstruction error under the 0.05 threshold, or failed to drive Eve’s reconstruction error above 7.3 bits (of 16). In order to test the robustness of the other fourteen Alice/Bob combinations, we retrained Eve five times, and obtained reconstruction errors for Eve that ranged from 4.67 to 6.97 bits, with a mean of 6.1. Figure 3 shows the final reconstruction errors of Bob and of the most effective retrained Eve for those fourteen Alice/Bob combinations. If we somewhat arbitrarily define success as maintaining Bob’s reconstruction error at or under 0.05 bits, and requiring that Eve get at least 6 bits wrong, on average, then training succeeded half of the time (ten of twenty cases).
143
+
144
+ Although training with an adversary is often unstable (Salimans et al., 2016), we suspect that some additional engineering of the neural network and its training may be able to increase this overall success rate. With a minibatch size of only 512, for example, we achieved a success rate of only $1 / 3$ (vs. the $1 / 2$ that we achieved with a minibatch size of 4096). In the future, it may be worth studying the impact of minibatch sizes, and also that of other parameters such as the learning rate.
145
+
146
+ Analogous results hold in general for $N = 3 2$ and $N = 6 4$ -bit keys and plaintexts; training appears to be successful somewhat more often for $N = 6 4$ . Basically, the experiments for $N = 3 2$ and $N = 6 4$ indicate that there is nothing special about $N = 1 6$ which, to a cryptographer, may look suspiciously tiny. We focus our presentation on the case of $N = 1 6$ because, first, the experiments run more rapidly, and second, it is modestly easier to examine their behavior.
147
+
148
+ For one successful training run, we studied the changes in the ciphertext induced by various plaintext/key pairs. Although we did not perform an exhaustive analysis of the encryption method, we did make a few observations. First, it is key-dependent: changing the key and holding the plaintext constant results in different ciphertext output. It is also plaintext-dependent, as required for successful communication. However, it is not simply XOR. In particular, the output values are often floating-point values other than 0 and 1. Moreover, the effect of a change to either a key bit or a plaintext bit is spread across multiple elements in the ciphertext, not constrained to a single bit as it would be with XOR. A single-bit flip in the key typically induces significant changes in three to six of the 16 elements in the ciphertext, and smaller changes in other elements. Plaintext bits are similarly diffused across the ciphertext.
149
+
150
+ # 3 LEARNING WHAT TO PROTECT
151
+
152
+ Building on the results of Section 2, we study selective protection. In other words, we consider the question of whether neural networks can learn what information to protect, given confidentiality objectives described in terms of an adversary. In the simplest case, a plaintext may have several components; if we wish to keep the adversary from seeing one of the components, it may suffice to encrypt it. More generally, we may wish to publish some values correlated with the plaintext but prevent the adversary from calculating other values. In such scenarios, protecting information selectively while maximizing utility is both challenging and interesting.
153
+
154
+ # 3.1 THE PROBLEM
155
+
156
+ To test these ideas and to demonstrate the viability of selective protection, we focus on a concrete experiment. We construct an artificial dataset consisting of tuples of four values, $\langle \mathbf { A } , \mathbf { B } , \mathbf { C } , \mathbf { D } \rangle$ . We aim to build and train a system that outputs two predictions of D, given the first three values as inputs: a “true” prediction of D (that is, the most accurate possible estimate of D given $\langle \mathbf { A } , \mathbf { B } , \mathbf { C } \rangle ,$ ), and a “privacy-preserving” estimate of D, which we call D-public, defined as the best possible estimate of D that does not reveal any information about the value of C.
157
+
158
+ The system organization is essentially that of Figure 1, with Alice and Bob sharing a key, but here Alice receives $\langle \bar { \bf A } , \bf B , C \rangle$ and produces D-public in addition to a ciphertext; both Bob and Eve have access to Alice’s outputs; Bob uses them for producing an improved estimate of D, while Eve attempts to recover C. Thus, our goal is to demonstrate that the adversarial training permits approximating D without revealing C, and that this approximation can be combined with encrypted information and with a key in order to obtain a better approximation of D.
159
+
160
+ The distributions of A, B, C, and D are constructed so that there is substantial correlation between them. In particular, knowing D exactly would convey some information about the likely values of C. In our experiments, A, B, C, and $\mathbf { D }$ are normally distributed floating-point values with a correlation matrix imposed upon them. The specifics of how we generate A, B, C, and D are standard: we compute the Cholesky decomposition $L L ^ { * }$ of a $4 \times 4$ correlation matrix that specifies the pairwise correlations, we generate vectors of 4 normally distributed floating-point values, and then we multiply these vectors by $L$ in order to generate values of A, B, C, and D.
161
+
162
+ Although A, B, C, and D do not correspond to any real-world data, these experiments are loosely inspired by real-world tasks. For example, A, B, and C may represent attributes of a user, which may in general be correlated, and D may represent a decision about the user, a prediction of the user’s behavior, or a recommendation to the user.
163
+
164
+ # 3.2 NEURAL NETWORK ARCHITECTURE AND TRAINING GOALS
165
+
166
+ In the experiments that follow, we use an augmented version of the neural network architecture of Section 2.4. The inputs first go into a new FC layer (12 inputs—eight key bits and four values—and 12 outputs); the outputs of that first layer are fed into a network with the architecture of Section 2.4. Intuitively, we chose this augmented architecture because a single FC layer should be capable of predicting D from A, B, and C, as well as making a prediction decorrelated with C; and the architecture of Section 2.4 suffices to encrypt any of the output of the first layer under the key. We therefore believed this augmented architecture would be sufficient to accomplish its task, though it may be more than is necessary to do so.
167
+
168
+ We train Eve with the goal of minimizing the squared error of its estimate of C. We train Alice and Bob with the goal of minimizing a linear combination of three terms: the squared error of each of the two estimates of D, and the absolute value of the covariance of Eve’s estimate of C with respect to the actual value of C. We compute this covariance on a batch of training examples, and define the loss function for Alice and Bob batch-wise.
169
+
170
+ A human engineer would naturally try to design the system somewhat differently—likely first computing the desired quantities, and then encrypting the values to be hidden, relying on the encryption and decryption components developed in Section 2 as modules. We prefer instead an end-to-end approach, because our goal is to understand whether a neural network can learn to hide information selectively, given only a high-level specification (“do not leak information about C, but let people with the right key learn as much as possible about D”). In this end-to-end approach, the system does not have distinct, pre-assigned units for encryption and decryption, and all components are trained jointly. In particular, although we benefit from some of the insights from Section 2, we do not rely on the components developed there. End-to-end approaches are sometimes preferred in machine learning because they can more efficiently use resources and information. In our case, this feature may mean, in particular, that the cryptographic operations are optimized for the given distribution of inputs. Nevertheless, our choices have the primary goal of maximizing insight, not efficiency.
171
+
172
+ # 3.3 RESULTS
173
+
174
+ To understand whether the system is learning to hide information properly, we train a separate evaluator that we call “Blind Eve”, which is aware of the distribution of C. Blind Eve tries to guess C relying only upon this baseline information, whereas the real Eve also knows the intermediate output (D-public) and the ciphertext. If Eve’s reconstruction error becomes equal to that of Blind Eve, we know that Eve is not successfully extracting information from the public estimate and the ciphertext.
175
+
176
+ Figure 4 shows the results of adversarial training to learn to hide C. The red “public error” line shows the average error of D-public vs. D. The green “Bob error” line shows Bob’s average reconstruction error, which drops over time until Bob is making the best possible prediction of D given the input. The public error becomes low, but is slightly higher than Bob’s. The blue dots show Eve’s average error improvement over Blind Eve. After a few steps of training, Eve’s error is substantially lower than that of Blind Eve (by 0.1–0.2). As time proceeds, Eve’s relative advantage becomes zero. Eve is not able to reconstruct any more information about C than would be possible by simply knowing the distribution of values of C.
177
+
178
+ ![](images/6152a395a052eb8d183e6d0897408d86392381feb1495e99adca50a59d5208b9.jpg)
179
+ Figure 4: Training to estimate D while hiding C.
180
+
181
+ # 4 CONCLUSION
182
+
183
+ In this paper, we demonstrate that neural networks can learn to protect communications. The learning does not require prescribing a particular set of cryptographic algorithms, nor indicating ways of applying these algorithms: it is based only on a secrecy specification represented by the training objectives. In this setting, we model attackers by neural networks; alternative models may perhaps be enabled by reinforcement learning.
184
+
185
+ There is more to cryptography than encryption. In this spirit, further work may consider other tasks, for example steganography, pseudorandom-number generation, or integrity checks. Finally, neural networks may be useful not only for cryptographic protections but also for attacks. While it seems improbable that neural networks would become great at cryptanalysis, they may be quite effective in making sense of metadata and in traffic analysis.
186
+
187
+ # ACKNOWLEDGMENTS
188
+
189
+ We are grateful to Samy Bengio, Laura Downs, Ulfar Erlingsson, Jakob Foerster, Nando de Freitas, ´ Ian Goodfellow, Geoff Hinton, Chris Olah, Ananth Raghunathan, and Luke Vilnis for discussions on the matter of this paper.
190
+
191
+ # REFERENCES
192
+
193
+ Mart´ın Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, Zhifeng Chen, Craig Citro, Gregory S. Corrado, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Ian J. Goodfellow, Andrew Harp, Geoffrey Irving, Michael Isard, Yangqing Jia, Rafal Jozefowicz, Lukasz ´ Kaiser, Manjunath Kudlur, Josh Levenberg, Dan Mane, Rajat Monga, Sherry Moore, Derek Gordon Murray, Chris Olah, Mike Schuster, Jonathon Shlens, Benoit Steiner, Ilya Sutskever, Kunal Talwar, Paul A. Tucker, Vincent Vanhoucke, Vijay Vasudevan, Fernanda B. Viegas, Oriol Vinyals, ´ Pete Warden, Martin Wattenberg, Martin Wicke, Yuan Yu, and Xiaoqiang Zheng. TensorFlow: Large-scale machine learning on heterogeneous distributed systems. CoRR, abs/1603.04467, 2016a. URL http://arxiv.org/abs/1603.04467.
194
+
195
+ Mart´ın Abadi, Paul Barham, Jianmin Chen, Zhifeng Chen, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Geoffrey Irving, Michael Isard, Manjunath Kudlur, Josh Levenberg, Rajat Monga, Sherry Moore, Derek Gordon Murray, Benoit Steiner, Paul A. Tucker, Vijay Vasudevan, Pete Warden, Martin Wicke, Yuan Yu, and Xiaoqiang Zhang. TensorFlow: A system for large-scale machine learning. CoRR, abs/1605.08695, 2016b. URL http://arxiv.org/ abs/1605.08695.
196
+
197
+ Boaz Barak, Oded Goldreich, Russell Impagliazzo, Steven Rudich, Amit Sahai, Salil Vadhan, and Ke Yang. On the (im)possibility of obfuscating programs. J. ACM, 59(2):6:1–6:48, May 2012. ISSN 0004-5411. doi: 10.1145/2160158.2160159. URL http://doi.acm.org/10.1145/ 2160158.2160159.
198
+
199
+ Gilles Barthe, Juan Manuel Crespo, Benjamin Gregoire, C ´ esar Kunz, Yassine Lakhnech, Benedikt ´ Schmidt, and Santiago Zanella-Beguelin. Fully automated analysis of padding-based encryption ´ in the computational model. In Proceedings of the 2013 ACM SIGSAC conference on Computer &#38; communications security, CCS ’13, pp. 1247–1260, New York, NY, USA, 2013. ACM. ISBN 978-1-4503-2477-9. doi: 10.1145/2508859.2516663. URL http://doi.acm.org/ 10.1145/2508859.2516663.
200
+
201
+ Xi Chen, Yan Duan, Rein Houthooft, John Schulman, Ilya Sutskever, and Pieter Abbeel. InfoGAN: Interpretable representation learning by information maximizing generative adversarial nets. CoRR, abs/1606.03657, 2016. URL https://arxiv.org/abs/1606.03657.
202
+
203
+ Emily L. Denton, Soumith Chintala, Arthur Szlam, and Robert Fergus. Deep generative image models using a Laplacian pyramid of adversarial networks. CoRR, abs/1506.05751, 2015. URL http://arxiv.org/abs/1506.05751.
204
+
205
+ Sebastien Dourlens. Applied neuro-cryptography. 1996. M ´ emoire, Universit ´ e Paris 8, D ´ epartement ´ Micro-Informatique Micro-Electronique.
206
+
207
+ Harrison Edwards and Amos J. Storkey. Censoring representations with an adversary. CoRR, abs/1511.05897, 2015. URL http://arxiv.org/abs/1511.05897.
208
+
209
+ Jakob N. Foerster, Yannis M. Assael, Nando de Freitas, and Shimon Whiteson. Learning to communicate to solve riddles with deep distributed recurrent Q-networks. CoRR, abs/1602.02672, 2016a. URL http://arxiv.org/abs/1602.02672.
210
+
211
+ Jakob N. Foerster, Yannis M. Assael, Nando de Freitas, and Shimon Whiteson. Learning to communicate with deep multi-agent reinforcement learning. CoRR, abs/1605.06676, 2016b. URL http://arxiv.org/abs/1605.06676.
212
+
213
+ Yaroslav Ganin, Evgeniya Ustinova, Hana Ajakan, Pascal Germain, Hugo Larochelle, Franc¸ois Laviolette, Mario Marchand, and Victor S. Lempitsky. Domain-adversarial training of neural networks. CoRR, abs/1505.07818, 2015. URL http://arxiv.org/abs/1505.07818.
214
+
215
+ Ran Gilad-Bachrach, Nathan Dowlin, Kim Laine, Kristin E. Lauter, Michael Naehrig, and John Wernsing. Cryptonets: Applying neural networks to encrypted data with high throughput and accuracy. In Maria-Florina Balcan and Kilian Q. Weinberger (eds.), Proceedings of the 33nd International Conference on Machine Learning, ICML 2016, New York City, NY, USA, June 19-24, 2016, volume 48 of JMLR Workshop and Conference Proceedings, pp. 201–210. JMLR.org, 2016. URL http://jmlr.org/proceedings/papers/v48/gilad-bachrach16.html.
216
+
217
+ Shafi Goldwasser and Silvio Micali. Probabilistic encryption. J. Comput. Syst. Sci., 28(2):270– 299, 1984. doi: 10.1016/0022-0000(84)90070-9. URL http://dx.doi.org/10.1016/ 0022-0000(84)90070-9.
218
+
219
+ Ian J. Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron C. Courville, and Yoshua Bengio. Generative adversarial nets. In Zoubin Ghahramani, Max Welling, Corinna Cortes, Neil D. Lawrence, and Kilian Q. Weinberger (eds.), Advances in Neural Information Processing Systems 27: Annual Conference on Neural Information Processing Systems 2014, December 8-13 2014, Montreal, Quebec, Canada, pp. 2672–2680, 2014a. URL http://papers.nips.cc/paper/5423-generative-adversarial-nets.
220
+
221
+ Ian J. Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. CoRR, abs/1412.6572, 2014b. URL http://arxiv.org/abs/1412.6572.
222
+
223
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. CoRR, abs/1412.6980, 2014. URL http://arxiv.org/abs/1412.6980.
224
+
225
+ Wolfgang Kinzel and Ido Kanter. Neural cryptography. arXiv preprint cond-mat/0208453, 2002.
226
+
227
+ Alexander Klimov, Anton Mityagin, and Adi Shamir. Analysis of neural cryptography. In Yuliang Zheng (ed.), Advances in Cryptology - ASIACRYPT 2002, 8th International Conference on the Theory and Application of Cryptology and Information Security, Queenstown, New Zealand, December 1-5, 2002, Proceedings, volume 2501 of Lecture Notes in Computer Science, pp. 288–298. Springer, 2002. ISBN 3-540-00171-9. doi: 10.1007/3-540-36178-2 18. URL http://dx.doi.org/10.1007/3-540-36178-2_18.
228
+
229
+ Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep learning. Nature, 521:436–444, 2015.
230
+
231
+ Christos Louizos, Kevin Swersky, Yujia Li, Max Welling, and Richard S. Zemel. The variational fair autoencoder. CoRR, abs/1511.00830, 2015. URL http://arxiv.org/abs/1511.00830.
232
+
233
+ Arvind Neelakantan, Quoc V. Le, and Ilya Sutskever. Neural programmer: Inducing latent programs with gradient descent. CoRR, abs/1511.04834, 2015. URL http://arxiv.org/abs/ 1511.04834.
234
+
235
+ Sebastian Nowozin, Botond Cseke, and Ryota Tomioka. f-GAN: Training generative neural samplers using variational divergence minimization. CoRR, abs/1606.00709, 2016. URL https: //arxiv.org/abs/1606.00709.
236
+
237
+ Lillian J Ratliff, Samuel A Burden, and S Shankar Sastry. Characterization and computation of local nash equilibria in continuous games. In Communication, Control, and Computing (Allerton), 2013 51st Annual Allerton Conference on, pp. 917–924. IEEE, 2013.
238
+
239
+ Andreas Ruttor. Neural synchronization and cryptography. PhD thesis, Julius Maximilian University of Wurzburg, 2006. URL ¨ http://www.opus-bayern.de/uni-wuerzburg/ volltexte/2007/2361/.
240
+
241
+ Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training GANs. CoRR, abs/1606.03498, 2016. URL https://arxiv. org/abs/1606.03498.
242
+
243
+ Sainbayar Sukhbaatar, Arthur Szlam, and Rob Fergus. Learning multiagent communication with backpropagation. CoRR, abs/1605.07736, 2016. URL http://arxiv.org/abs/1605. 07736.
244
+
245
+ Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian J. Goodfellow, and Rob Fergus. Intriguing properties of neural networks. CoRR, abs/1312.6199, 2013. URL http://arxiv.org/abs/1312.6199.
246
+
247
+ Ronald J. Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. In Machine Learning, pp. 229–256, 1992.
248
+
249
+ Pengtao Xie, Misha Bilenko, Tom Finley, Ran Gilad-Bachrach, Kristin E. Lauter, and Michael Naehrig. Crypto-nets: Neural networks over encrypted data. CoRR, abs/1412.6181, 2014. URL http://arxiv.org/abs/1412.6181.
250
+
251
+ ![](images/b2016dd2dd4819fa56ec7428663d6ad65700e349b3fdc00a3b0d65d2052e0795.jpg)
252
+ Figure 5: Alice, Bob, and Eve, with an asymmetric cryptosystem.
253
+
254
+ # APPENDIX
255
+
256
+ # A LEARNING ASYMMETRIC ENCRYPTION
257
+
258
+ Paralleling Section 2, this section examines asymmetric encryption (also known as public-key encryption). It presents definitions and experimental results, but omits a detailed discussion of the objectives of asymmetric encryption, of the corresponding loss functions, and of the practical refinements that we develop for training, which are analogous to those for symmetric encryption.
259
+
260
+ # A.1 DEFINITIONS
261
+
262
+ In asymmetric encryption, a secret is associated with each principal. The secret may be seen as a seed for generating cryptographic keys, or directly as a secret key; we adopt the latter view. A public key can be derived from the secret, in such a way that messages encrypted under the public key can be decrypted only with knowledge of the secret.
263
+
264
+ We specify asymmetric encryption using a twist on our specification for symmetric encryption, shown in Figure 5. Instead of directly supplying the secret encryption key to Alice, we supply the secret key to a public-key generator, the output of which is available to every node. Only Bob has access to the underlying secret key. Much as in Section 2, several variants are possible, for instance to support probabilistic encryption.
265
+
266
+ The public-key generator is itself a neural network, with its own parameters. The loss functions treats these parameters much like those of Alice and Bob. In training, these parameters are adjusted at the same time as those of Alice and Bob.
267
+
268
+ # A.2 EXPERIMENTS
269
+
270
+ In our experiments on asymmetric encryption, we rely on the same approach as in Section 2.5. In particular, we adopt the same network structure and the same approach to training.
271
+
272
+ The results of these experiments are intriguing, but much harder to interpret than those for symmetric encryption. In most training runs, the networks failed to achieve a robust outcome. Often, although it appeared that Alice and Bob had learned to communicate secretly, upon resetting and retraining Eve, the retrained adversary was able to decrypt messages nearly as well as Bob was.
273
+
274
+ However, Figure 6 shows the results of one training run, in which even after five reset/retrain cycles, Eve was unable to decrypt messages between Alice and Bob.
275
+
276
+ ![](images/20872348759a81d1815639e59f4b25aa926c3b5f14cdf17c461ac34dc5c3b90d.jpg)
277
+ Figure 6: Bob’s and Eve’s reconstruction errors with an asymmetric formulation.
278
+
279
+ Our chosen network structure is not sufficient to learn general implementations of many of the mathematical concepts underlying modern asymmetric cryptography, such as integer modular arithmetic. We therefore believe that the most likely explanation for this successful training run was that Alice and Bob accidentally obtained some “security by obscurity” (cf. the derivation of asymmetric schemes from symmetric schemes by obfuscation (Barak et al., 2012)). This belief is somewhat reinforced by the fact that the training result was fragile: upon further training of Alice and Bob, Eve was able to decrypt the messages. However, we cannot rule out that the networks trained into some set of hard-to-invert matrix operations resulting in “public-key-like” behavior. Our results suggest that this issue deserves more exploration.
280
+
281
+ Further work might attempt to strengthen these results, perhaps relying on new designs of neural networks or new training procedures. A modest next step may consist in trying to learn particular asymmetric algorithms, such as lattice-based ciphers, in order to identify the required neural network structure and capacity.
282
+
283
+ # B BACKGROUND ON NEURAL NETWORKS
284
+
285
+ Most of this paper assumes only a few basic notions in machine learning and neural networks, as provided by general introductions (e.g., LeCun et al. (2015)). The following is a brief review.
286
+
287
+ Neural networks are specifications of parameterized functions. They are typically constructed out of a sequence of somewhat modular building blocks. For example, the input to Alice is a vector of bits that represents the concatenation of the key and the plaintext. This vector $( x )$ is input into a “fully-connected” layer, which consists of a matrix multiply (by $A$ ) and a vector addition (with b): $A x + b$ . The result of that operation is then passed into a nonlinear function, sometimes termed an “activation function”, such as the sigmoid function, or the hyperbolic tangent function, tanh. In classical neural networks, the activation function represents a threshold that determines whether a neuron would “fire” or not, based upon its inputs. This threshold, and matrices and vectors such as $A$ and $b$ , are typical neural network “parameters”. “Training” a neural network is the process that finds values of its parameters that minimize the specified loss function over the training inputs.
288
+
289
+ Fully-connected layers are powerful but require substantial amounts of memory for a large network. An alternative to fully-connected layers are “convolutional” layers. Convolutional layers operate much like their counterparts in computer graphics, by sliding a parameterized convolution window across their input. The number of parameters in this window is much smaller than in an equivalent fully-connected layer. Convolutional layers are useful for applying the same function(s) at every point in an input.
290
+
291
+ A neural network architecture consists of a graph of these building blocks (often, but not always, a DAG), specifying what the individual layers are (e.g., fully-connected or convolutional), how they are parameterized (number of inputs, number of outputs, etc.), and how they are wired.
md/train/S1XolQbRW/S1XolQbRW.md ADDED
@@ -0,0 +1,624 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MODEL COMPRESSION VIA DISTILLATION AND QUANTIZATION
2
+
3
+ Antonio Polino
4
+ ETH Zurich¨
5
+ antonio.polino1@gmail.com
6
+ Dan Alistarh
7
+ IST Austria
8
+ dan.alistarh@ist.ac.at
9
+
10
+ # ABSTRACT
11
+
12
+ Deep neural networks (DNNs) continue to make significant advances, solving tasks from image classification to translation or reinforcement learning. One aspect of the field receiving considerable attention is efficiently executing deep models in resource-constrained environments, such as mobile or embedded devices. This paper focuses on this problem, and proposes two new compression methods, which jointly leverage weight quantization and distillation of larger networks, called “teachers,” into compressed “student” networks. The first method we propose is called quantized distillation and leverages distillation during the training process, by incorporating distillation loss, expressed with respect to the teacher network, into the training of a smaller student network whose weights are quantized to a limited set of levels. The second method, differentiable quantization, optimizes the location of quantization points through stochastic gradient descent, to better fit the behavior of the teacher model. We validate both methods through experiments on convolutional and recurrent architectures. We show that quantized shallow students can reach similar accuracy levels to state-of-the-art full-precision teacher models, while providing up to order of magnitude compression, and inference speedup that is almost linear in the depth reduction. In sum, our results enable DNNs for resource-constrained environments to leverage architecture and accuracy advances developed on more powerful devices.
13
+
14
+ # 1 INTRODUCTION
15
+
16
+ Background. Neural networks are extremely effective for solving several real world problems, like image classification (Krizhevsky et al., 2012; He et al., 2016a), translation (Vaswani et al., 2017), voice synthesis (Oord et al., 2016) or reinforcement learning (Mnih et al., 2013; Silver et al., 2016). At the same time, modern neural network architectures are often compute, space and power hungry, typically requiring powerful GPUs to train and evaluate. The debate is still ongoing on whether large models are necessary for good accuracy. It is known that individual network weights can be redundant, and may not carry significant information, e.g. Han et al. (2015). At the same time, large models often have the ability to completely memorize datasets (Zhang et al., 2016), yet they do not, but instead appear to learn generic task solutions. A standing hypothesis for why overcomplete representations are necessary is that they make learning possible by transforming local minima into saddle points (Dauphin et al., 2014) or to discover robust solutions, which do not rely on precise weight values (Hochreiter & Schmidhuber, 1997; Keskar et al., 2016).
17
+
18
+ If large models are only needed for robustness during training, then significant compression of these models should be achievable, without impacting accuracy. This intuition is strengthened by two related, but slightly different research directions. The first direction is the work on training quantized neural networks, e.g. Courbariaux et al. (2015); Rastegari et al. (2016); Hubara et al. (2016); Wu et al. (2016a); Mellempudi et al. (2017); Ott et al. (2016); Zhu et al. (2016), which showed that neural networks can converge to good task solutions even when weights are constrained to having values from a set of integer levels. The second direction aims to compress already-trained models, while preserving their accuracy. To this end, various elegant compression techniques have been proposed, e.g. Han et al. (2015); Iandola et al. (2016); Wen et al. (2016); Gysel et al. (2016); Mishra et al. (2017), which combine quantization, weight sharing, and careful coding of network weights, to reduce the size of state-of-the-art deep models by orders of magnitude, while at the same time speeding up inference.
19
+
20
+ Both these research directions are extremely active, and have been shown to yield significant compression and accuracy improvements, which can be crucial when making such models available on embedded devices or phones. However, the literature on compressing deep networks focuses almost exclusively on finding good compression schemes for a given model, without significantly altering the structure of the model. On the other hand, recent parallel work (Ba & Caruana, 2013; Hinton et al., 2015) introduces the process of distillation, which can be used for transferring the behaviour of a given model to any other structure. This can be used for compression, e.g. to obtain compact representations of ensembles (Hinton et al., 2015). However the size of the student model needs to be large enough for allowing learning to succeed. A model that is too shallow, too narrow, or which misses necessary units, can result in considerable loss of accuracy (Urban et al., 2016).
21
+
22
+ In this work, we examine whether distillation and quantization can be jointly leveraged for better compression. We start from the intuition that 1) the existence of highly-accurate, full-precision teacher models should be leveraged to improve the performance of quantized models, while 2) quantizing a model can provide better compression than a distillation process attempting the same space gains by purely decreasing the number of layers or layer width. While our approach is very natural, interesting research questions arise when these two ideas are combined.
23
+
24
+ Contribution. We present two methods which allow the user to compound compression in terms of depth, by distilling a shallower student network with similar accuracy to a deeper teacher network, with compression in terms of width, by quantizing the weights of the student to a limited set of integer levels, and using less weights per layer. The basic idea is that quantized models can leverage distillation loss (Hinton et al., 2015), the weighted average between the correct targets (represented by the labels) and soft targets (represented by the teacher’s outputs).
25
+
26
+ We implement this intuition via two different methods. The first, called quantized distillation, aims to leverage distillation loss during the training process, by incorporating it into the training of a student network whose weights are constrained to a limited set of levels. The second method, which we call differentiable quantization, takes a different approach, by attempting to converge to the optimal location of quantization points through stochastic gradient descent. We validate both methods empirically through a range of experiments on convolutional and recurrent network architectures. We show that quantized shallow students can reach similar accuracy levels to full-precision and deeper teacher models on datasets such as CIFAR and ImageNet (for image classification) and OpenNMT and WMT (for machine translation), while providing up to order of magnitude compression, and inference speedup that is linear in the depth. 1
27
+
28
+ Related Work. Our work is a special case of knowledge distillation (Ba & Caruana, 2013; Hinton et al., 2015), in which we focus on techniques to obtain high-accuracy students that are both quantized and shallower. More generally, it can be seen as a special instance of learning with privileged information, e.g. Vapnik & Izmailov (2015); Xu et al. (2016), in which the student is provided additional information in the form of outputs from a larger, pre-trained model. The idea of optimizing the locations of quantization points during the learning process, which we use in differentiable quantization, has been used previously in Lan et al. (2014); Koren & Sill (2011); Zhang et al. (2017), although in the different context of matrix completion and recommender systems.
29
+
30
+ Using distillation for size reduction is mentioned in Hinton et al. (2015), for distilling ensembles. To our knowledge, the only other work using distillation in the context of quantization is $\mathbf { W } \mathbf { u }$ et al. (2016b), which uses it to improve the accuracy of binary neural networks on ImageNet. We significantly refine this idea, as we match or even improve the accuracy of the original full-precision model: for example, our 4-bit quantized version of ResNet18 has higher accuracy than full-precision ResNet18 (matching the accuracy of the ResNet34 teacher): it has higher top-1 accuracy (by $> 1 5 \%$ ) and top-5 accuracy (by $> 7 \%$ ) compared to the most accurate model in Wu et al. (2016b).
31
+
32
+ # 2 PRELIMINARIES
33
+
34
+ # 2.1 THE QUANTIZATION PROCESS
35
+
36
+ We start by defining a scaling function $s c : \mathcal { R } ^ { n } \to [ 0 , 1 ] .$ , which normalizes vectors whose values come from an arbitrary range, to vectors whose values are in $[ 0 , 1 ]$ . Given such a function, the general structure of the quantization functions is as follows:
37
+
38
+ $$
39
+ Q ( v ) = s c ^ { - 1 } \left( \hat { Q } \left( s c ( v ) \right) \right) ,
40
+ $$
41
+
42
+ where $s c ^ { - 1 }$ is the inverse of the scaling function, and $\hat { Q }$ is the actual quantization function that only accepts values in $[ 0 , 1 ]$ . We always assume $v$ to be a vector; in practice, of course, the weight vectors can be multi-dimensional, but we can reshape them to one dimensional vectors and restore the original dimensions after the quantization.
43
+
44
+ Scaling. There are various specifications for the scaling function; in this paper, we will use linear scaling, e.g. He et al. (2016b), that is $\begin{array} { r } { s c ( v ) = \frac { v - \beta } { \alpha } } \end{array}$ , with $\alpha = \operatorname* { m a x } _ { i } v _ { i } - \operatorname* { m i n } _ { i } v _ { i }$ and $\beta = \operatorname* { m i n } _ { i } v _ { i }$ which results in the target values being in $[ 0 , 1 ]$ , and the quantization function
45
+
46
+ $$
47
+ Q ( v ) = \alpha \hat { Q } \left( \frac { v - \beta } { \alpha } \right) + \beta .
48
+ $$
49
+
50
+ Bucketing. One problem with this formulation is that an identical scaling factor is used for the whole vector, whose dimension might be huge. Magnitude imbalance can result in a significant loss of precision, where most of the elements of the scaled vector are pushed to zero. To avoid this, we will use bucketing, e.g. Alistarh et al. (2016), that is, we will apply the scaling function separately to buckets of consecutive values of a certain fixed size. The trade-off here is that we obtain better quantization accuracy for each bucket, but will have to store two floating-point scaling factors for each bucket. We characterize the compression comparison in Section 5. The function $\hat { Q }$ can also be defined in several ways. We will consider both uniform and non-uniform placement of quantization points.
51
+
52
+ Uniform Quantization. We fix a parameter $s \geq 1$ , describing the number of quantization levels employed. Intuitively, uniform quantization considers $s + 1$ equally spaced points between 0 and 1 (including these endpoints). The deterministic version will assign each (scaled) vector coordinate $v _ { i }$ to the closest quantization point, while in the stochastic version we perform rounding probabilistically, such that the resulting value is an unbiased estimator of $v _ { i }$ , of minimal variance.
53
+
54
+ Formally, the uniform quantization function with $s + 1$ levels is defined as
55
+
56
+ $$
57
+ \hat { Q } ( v , s ) _ { i } = \frac { \lfloor v _ { i } s \rfloor } { s } + \frac { \xi _ { i } } { s } ,
58
+ $$
59
+
60
+ where $\xi _ { i }$ is the rounding function. For the deterministic version, we define $k _ { i } = s v _ { i } - \lfloor v _ { i } s \rfloor$ and set
61
+
62
+ $$
63
+ \xi _ { i } = \left\{ { \begin{array} { l l } { 1 , } & { { \mathrm { i f ~ } } k _ { i } > { \frac { 1 } { 2 } } } \\ { 0 , } & { { \mathrm { o t h e r w i s e } } , } \end{array} } \right.
64
+ $$
65
+
66
+ while for the stochastic version we will set $\xi _ { i } \sim B e r n o u l l i ( k _ { i } )$ . Note that $k _ { i }$ is the normalized distance between the original point $v _ { i }$ and the closest quantization point that is smaller than $v _ { i }$ and that the vector components are quantized independently.
67
+
68
+ Non-Uniform Quantization. Non-uniform quantization takes as input a set of $s$ quantization points $\{ p _ { 1 } , \ldots , p _ { s } \}$ and quantizes each element $v _ { i }$ to the closest of these points. For simplicity, we only define the deterministic version of this function.
69
+
70
+ # 2.2 STOCHASTIC QUANTIZATION IS EQUIVALENT TO ADDING GAUSSIAN NOISE
71
+
72
+ In this section we list some interesting mathematical properties of the uniform quantization function.
73
+ Clearly, stochastic uniform quantization is an unbiased estimator of its input, i.e. $E [ Q ( v ) ] = v$ .
74
+
75
+ What interests us is applying this function to neural networks; as the scalar product is the most common operation performed by neural networks, we would like to study the properties of $Q ( v ) ^ { T } x$ where $v$ is the weight vector of a certain layer in the network and $x$ are the inputs. We are able to show that
76
+
77
+ $$
78
+ Q ( v ) ^ { T } x = v ^ { T } x + \varepsilon
79
+ $$
80
+
81
+ where $\varepsilon$ is a random variable that is asymptotically normally distributed, i.e. $\begin{array} { r } { { \frac { 1 } { \sigma _ { n } } } \varepsilon \ { \overset { \mathcal { D } } { \longrightarrow } } \ N ( 0 , 1 ) } \end{array}$ . Convergence occurs with the dimension $n$ . For a formal statement and proof, see Section B.1 in the Appendix.
82
+
83
+ This means that quantizing the weights is equivalent to adding to the output of each layer (before the activation function) a zero-mean error term that is asymptotically normally distributed. The variance of this error term depends on $s$ . This connects quantization to work advocating adding noise to intermediary activations of neural networks as a regularizer (Gulcehre et al., 2016) and to Arora et al. (2018), which investigates the connection between adding noise to a network weights and the network generalization properties. We plan to investigate this connection in more detail in future work.
84
+
85
+ # 3 QUANTIZED DISTILLATION
86
+
87
+ The context is the following: given a task, we consider a trained state-of-the-art deep model solving it–the teacher, and a compressed student model. The student is compressed in the sense that 1) it is shallower than the teacher; and 2) it is quantized, in the sense that its weights are expressed at limited bit width. The strategy, as for standard distillation (Ba & Caruana, 2013; Hinton et al., 2015) is for the student to leverage the converged teacher model to reach similar accuracy. We note that distillation has been used previously to obtain compact high-accuracy encodings of ensembles (Hinton et al., 2015); however, we believe this is the first time it is used for model compression via quantization.
88
+
89
+ Given this setup, there are two questions we need to address. The first is how to transfer knowledge from the teacher to the student. For this, the student will use the distillation loss, as defined by Hinton et al. (2015), as the weighted average between two objective functions: cross entropy with soft targets, controlled by the temperature parameter $T$ , and the cross entropy with the correct labels. We refer the reader to Hinton et al. (2015) for the precise definition of distillation loss.
90
+
91
+ The second question is how to employ distillation loss in the context of a quantized neural network. An intuitive approach is to rely on projected gradient descent, where a gradient step is taken as in full-precision training, and then the new parameters are projected to the set of valid solutions. Critically, we accumulate the error at each projection step into the gradient for the next step. One can think of this process as if collecting evidence for whether each weight needs to move to the next quantization point or not. Crucially, the error accumulation prevents the algorithm from getting stuck in the current solution if gradients are small, which would occur in a naive projected gradient approach. This is similar to the approach taken by BinaryConnect technique, with some differences. Li et al. (2017) also examines these dynamics in detail. Compared to BinnaryConnect, we use distillation rather than learning from scratch, hence learning more efficiently. We also do not restrict ourselves to binary representation, but rather use variable bit-width quantization functions and bucketing, as defined in Section 2.
92
+
93
+ An alternative view of this process, illustrated in Figure 1, is that we perform the SGD step on the full-precision model, but computing the gradient on the quantized model, expressed with respect to the distillation loss. See Algorithm 1 for details.
94
+
95
+ # 4 DIFFERENTIABLE QUANTIZATION
96
+
97
+ # 4.1 GENERAL DESCRIPTION
98
+
99
+ We introduce differentiable quantization as a general method of improving the accuracy of a quantized neural network, by exploiting non-uniform quantization point placement. In particular, we are going to use the non-uniform quantization function defined in Section 2.1. Experimentally, we have
100
+
101
+ # Algorithm 1 Quantized Distillation
102
+
103
+ 1: procedure QUANTIZED DISTILLATION
104
+ 2: Let w be the network weights
105
+ 3: loop
106
+ 4: $w ^ { q } \gets$ quant function $( w , s )$
107
+ 5: Run forward pass and compute distillation loss $l ( w ^ { q } )$
108
+ 6: Run backward pass and compute $\frac { \partial l ( w ^ { q } ) } { \partial w ^ { q } }$
109
+ 7: Update original weights using SGD in full precision w = w − ν · ∂l(wq)∂wq
110
+ 8: Finally quantize the weights before returning: $w ^ { q } \gets$ quant function $( w , s )$
111
+ 9: return $w ^ { q }$
112
+
113
+ ![](images/06939a77d76d96f184ea8f4606de8a98e4dada1c06b8b103e7bdc5807c9c57c6.jpg)
114
+ Figure 1: Depiction of the steps of quantized distillation. Note the accumulation over multiple steps of gradients in the unquantized model leads to a switch in quantization (e.g. top layer left most square).
115
+
116
+ found little difference between stochastic and deterministic quantization in this case, and therefore will focus on the simpler deterministic quantization function here.
117
+
118
+ Let $p = ( p _ { 1 } , \ldots , p _ { s } )$ be the vector of quantization points, and let $Q ( v , p )$ be our quantization function, as defined previously. Ideally, we would like to find a set of quantization points $p$ which minimizes the accuracy loss when quantizing the model using $Q ( v , p )$ . The key observation is that to find this set $p$ , we can just use stochastic gradient descent, because we are able to compute the gradient of $Q$ with respect to $p$ .
119
+
120
+ A major problem in quantizing neural networks is the fact that the decision of which $p _ { i }$ should replace a given weight is discrete, hence the gradient is zero: ∂Q(v, p) = 0, almost everywhere. This implies that we cannot backpropagate the gradients through the quantization function. To solve this problem, typically a variant of the straight-through estimator is used, see e.g. Bengio et al. (2013); Hubara et al. (2016). On the other hand, the model as a function of the chosen $p _ { i }$ is continuous and can be differentiated; the gradient of $Q ( v , p ) _ { i }$ with respect to $p _ { j }$ is well defined almost everywhere, and it is simply
121
+
122
+ $$
123
+ \frac { \partial Q ( v , p ) _ { i } } { \partial p _ { j } } = \left\{ { \begin{array} { l l } { \alpha _ { i } , } & { \mathrm { i f ~ } v _ { i } \mathrm { ~ h a s ~ b e e n ~ q u a n t i z e d ~ t o ~ } p _ { j } } \\ { 0 , } & { \mathrm { o t h e r w i s e } , } \end{array} } \right.
124
+ $$
125
+
126
+ where $\alpha _ { i }$ is $i$ -th element of the scaling factor, assuming we are using a bucketing scheme. If no bucketing is used, then $\alpha _ { i } = \alpha$ for every $i$ . Otherwise it changes depending on which bucket the weight $v _ { i }$ belongs to.
127
+
128
+ Therefore, we can use the same loss function we used when training the original model, and with Equation (6) and the usual backpropagation algorithm we are able to compute its gradient with respect to the quantization points $p$ . Then we can minimize the loss function with respect to $p$ with the standard SGD algorithm. See Algorithm 2 for details.
129
+
130
+ Note on Efficiency. Optimizing the points $p$ can be slower than training the original network, since we have to perform the normal forward and backward pass, and in addition we need to quantize the weights of the model and perform the backward pass to get to the gradients w.r.t. $p$ . However, in our experience differential quantization requires an order of magnitude less iterations to converge to a good solution, and can be implemented efficiently.
131
+
132
+ # Algorithm 2 Differentiable Quantization
133
+
134
+ 1: procedure DIFFERENTIABLE QUANTIZATION
135
+ 2: Let w be the networks weights and $p$ the initial quantization points
136
+ 3: loop
137
+ 4: $w ^ { q } \gets$ quant function $( w , p )$
138
+ 5: Run forward pass and compute loss $l ( w ^ { q } )$
139
+ 6: Run backward pass and compute $\frac { \partial l ( w ^ { q } ) } { \partial w ^ { q } }$
140
+ 7: Use equation 6 to compute $\frac { \partial l ( w ^ { q } ) } { \partial p }$
141
+ 8: Update quantization points using SGD or similar: $\begin{array} { r } { p = p - \nu \cdot \frac { \partial l ( w ^ { q } ) } { \partial p } } \end{array}$
142
+ 9: return p
143
+
144
+ Weight Sharing. Upon close inspection, this method can be related to weight sharing Han et al. (2015). Weight sharing uses a $k$ -mean clustering algorithm to find good clusters for the weights, adopting the centroids as quantization points for a cluster. The network is trained modifying the values of the centroids, aggregating the gradient in a similar fashion. The difference is in the initial assignment of points to centroids, but also, more importantly, in the fact that the assignment of weights to centroids never changes. By contrast, at every iteration we re-assign weights to the closest quantization point, and use a different initialization.
145
+
146
+ # 4.2 DISCUSSION AND ADDITIONAL HEURISTICS
147
+
148
+ While the loss is continuous w.r.t. $p$ , there are indirect effects when changing the way each weight gets quantized. This can have drastic effect on the learning process. As an extreme example, we could have degeneracies, where all weights get represented by the same quantization point, making learning impossible. Or diversity of $p _ { i }$ gets reduced, resulting in very few weights being represented at a really high precision while the rest are forced to be represented in a much lower resolution.
149
+
150
+ To avoid such issues, we rely on the following set of heuristics. Future work will look at adding a reinforcement learning loss for how the $p _ { i }$ are assigned to weights.
151
+
152
+ Choose good starting points. One way to initialize the starting quantization points is to make them uniformly spaced, which would correspond to use as a starting point the uniform quantization function. The differentiable quantization algorithm needs to be able to use a quantization point in order to update it; therefore, to make sure every quantization point is used we initialize the points to be the quantiles of the weight values. This ensures that every quantization point is associated with the same number of values and we are able to update it.
153
+
154
+ Redistribute bits where it matters. Not all layers in the network need the same accuracy. A measure of how important each weight is to the final prediction is the norm of the gradient of each weight vector. So in an initial phase we run the forward and backward pass a certain number of times to estimate the gradient of the weight vectors in each layer, we compute the average gradient across multiple minibatches and compute the norm; we then allocate the number of points associated with each weight according to a simple linear proportion. In short we estimate
155
+
156
+ $$
157
+ \left. \mathbb { E } \left[ { \frac { \partial l } { \partial v } } \right] \right. _ { 2 }
158
+ $$
159
+
160
+ where $l$ is the loss function, $v$ is the vector of weights in a particular layer and $\begin{array} { r } { \left( \frac { \partial l } { \partial v } \right) _ { i } = \frac { \partial l } { \partial v _ { i } } } \end{array}$ and we use this value to determine which layers are most sensitive to quantization.
161
+
162
+ When using this process, we will use more than the indicated number of bits in some layers, and less in others. We can reduce the impact of this effect with the use of Huffman encoding, see Section 5; in any case, note that while the total number of points stays constant, allocating more points to a layer will increase bit complexity overall if the layer has a larger proportion of the weights.
163
+
164
+ Use the distillation loss. In the algorithm delineated above, the loss refers to the loss we used to train the original model with. Another possible specification is to treat the unquantized model as the teacher model, the quantized model as the student, and to use as loss the distillation loss between the outputs of the unquantized and quantized model. In this case, then, we are optimizing our quantized model not to perform best with respect to the original loss, but to mimic the results of the unquantized model, which should be easier to learn for the model and provide better results.
165
+
166
+ Hyperparameter optimization. The algorithm above is an optimization problem very similar to the original one. As usual, to obtain the best results one should experiment with hyperparameters optimization, and different variants of gradient descent.
167
+
168
+ # 5 COMPRESSION
169
+
170
+ We now analyze the space savings when using $b$ bits and bucket size of $k$ . Let $f$ be the size of full precision weights (32 bit) and let $N$ be the size of the “vector” we are quantizing. Full precision requires $f N$ bits, while the quantized vector requires $b { N } + \frac { 2 f N } { k }$ . (We use $b$ bits per weight, plus the scaling factors $\alpha$ and $\beta$ for every bucket). The size gain is therefore $\begin{array} { r } { g ( b , k ; f ) = \frac { k f } { k b + 2 f } } \end{array}$ .
171
+
172
+ For differentiable quantization, we also have to store the values of the quantization points. Since this number does not depend on $N$ , the amount of space required is negligible and we ignore it for simplicity. As an example, at 256 bucket size, using 2 bits per component yields $1 4 . 2 \times$ space savings w.r.t. full precision, while 4 bits yields $7 . 5 2 \times$ space savings. At 512 bucket size, the 2 bit savings are $1 5 . 0 5 \times$ , while 4 bits yields $7 . 7 5 \times$ compression.
173
+
174
+ Huffman encoding. To save additional space, we can use Huffman encoding to represent the quantized values. In fact, each quantized value can be thought as the pointer to a full precision value; in the case of non uniform quantization is $p _ { k }$ , in the case of uniform quantization is $k / s$ . We can then compute the frequency for every index across all the weights of the model and compute the optimal Huffman encoding. The mean bit length of the optimal encoding is the amount of bits we actually use to encode the values. This explains the presence of fractional bits in some of our size gain tables from the Appendix.
175
+
176
+ We emphasize that we only use these compression numbers as a ballpark figure, since additional implementation costs might mean that these savings are not always easy to translate to practice (Han et al., 2015).
177
+
178
+ # 6 EXPERIMENTAL RESULTS
179
+
180
+ # 6.1 SMALL DATASETS
181
+
182
+ Methods. We will begin with a set of experiments on smaller datasets, which allow us to more carefully cover the parameter space. We compare the performance of the methods described in the following way: we consider as baseline the teacher model, the distilled model and a smaller model: the distilled and smaller models have the same architecture, but the distilled model is trained using distillation loss on the teacher, while the smaller model is trained directly on targets. Further, we compare the performance of Quantized Distillation and Differentiable Quantization. In addition, we will also use PM (“post-mortem”) quantization, which uniformly quantizes the weights after training without any additional operation, with and without bucketing. All the results are obtained with a bucket size of 256, which we found to empirically provide a good compression-accuracy trade-off. We refer the reader to Appendix A for details of the datasets and models.
183
+
184
+ CIFAR-10 Experiments. For image classification on CIFAR-10, we tested the impact of different training techniques on the accuracy of the distilled model, while varying the parameters of a CNN architecture, such as quantization levels and model size. Table 1 contains the results for full-precision training, PM quantization with and without bucketing, as well as our methods. The percentages on the left below the student models definition are the accuracy of the normal and the distilled model respectively (trained with full precision). More details are reported in table 11 in the appendix. We also tried an additional model where the student is deeper than the teacher, where we obtained that the student quantized to 4 bits is able to achieve significantly better accuracy than the teacher, with a compression factor of more than $7 \times$ .
185
+
186
+ We performed additional experiments for differentiable quantization using a wide residual network (Zagoruyko & Komodakis, 2016) that gets to higher accuracies; see table 3.
187
+
188
+ Overall, quantized distillation appears to be the method with best accuracy across the whole range of bit widths and architectures. It outperforms PM significantly for 2bit and 4bit quantization, achieves accuracy within $0 . 2 \%$ of the teacher at 8 bits on the larger student model, and relatively minor accuracy loss at 4bit quantization. Differentiable quantization is a close second on all experiments,
189
+
190
+ Table 1: CIFAR10 accuracy. Teacher model: $5 . 3 \mathbf { M }$ param, $2 1 \ \mathrm { M B }$ , accuracy $8 9 . 7 1 \ \%$ .Details about the resulting size of the models are reported in table 11 in the appendix.
191
+
192
+ <table><tr><td>Student model 1 1M param - 4 MB 84.5% - 88.8%</td><td>PM Quant.(No bucket) PM Quant. (with bucket) Quantized Distill. Differentiable Quant.</td><td>2 bits 9.30 % 10.53 % 82.4 % 80.43%</td><td>4bits 67.99 % 87.18 % 88.00 % 88.31 %</td><td>8 bits 88.91 % 88.80 % 88.82 %</td></tr><tr><td>Student model 2 0.3M param - 1.27 MB 80.3% - 84.3%</td><td>PM Quant. (No bucket) PM Quant. (with bucket) Quantized Distill. Differentiable Quant.</td><td>10.15 % 11.89 % 74.22 % 72.79 %</td><td>68.05 % 81.96 % 83.92 % 83.49 %</td><td>84.38 % 84.38 % 84.22 %</td></tr><tr><td>Student model 3 0.1M param - 0.45 MB 71.6% - 78.2%</td><td>PM Quant. (No bucket) PM Quant. (with bucket) Quantized Distill. Differentiable Quant.</td><td>10.15 % 10.38 % 67.02 % 57.84 %</td><td>61.30 % 72.44 % 77.75 % 77.36 %</td><td>78.04 % 78.10 % 77.92 %</td></tr></table>
193
+
194
+ Table 2: CIFAR10 accuracy. Teacher model: $5 . 3 \mathbf { M }$ param, 21 MB, accuracy $8 9 . 7 1 \%$ . Details about the resulting size of the models are reported in table 14 in the appendix.
195
+
196
+ <table><tr><td>Deeper student</td><td>PM Quant.(No bucket)</td><td>2 bits 4 bits 12.60 %</td></tr><tr><td>5.8M param - 23.2 MB</td><td></td><td>91.11 %</td></tr><tr><td></td><td>PM(with bucketing)</td><td>45.82 % 92.30 %</td></tr><tr><td>93.22% -92.6%</td><td>Quantized Distilled</td><td>89.33 % 92.17 %</td></tr></table>
197
+
198
+ Table 3: CIFAR10 accuracy (Wide Residual Network). Teacher model: 145M param, ${ 5 8 0 } ~ \mathrm { M B }$ , accuracy $9 5 . 7 ~ \%$ . Details about the resulting size of the models are reported in table 17 in the appendix.
199
+
200
+ Student model 2 bits 4 bits 82.7M param - 330 MB PM Quant. (with bucket) $1 5 . 3 5 \%$ $8 1 . 1 \%$ $9 5 . \bar { 3 } \% - 9 4 . 1 9 \%$ Quantized Distill. $9 4 . 2 3 \%$ $9 4 . 7 3 \%$ but it has much faster convergence. Further, we highlight the good accuracy of the much simpler PM quantization method with bucketing at higher bit width (4 and 8 bits).
201
+
202
+ CIFAR-100 Experiments. Next, we perform image classification with the full 100 classes. Here, we focus on 2bit and 4bit quantization, and on a single student architecture. The baseline architecture is a wide residual network with 28 layers, and $3 6 . 5 \mathrm { M }$ parameters, which is state-of-the-art for its depth on this dataset. The student has depth and width reduced by $2 0 \%$ , and half the parameters. It is chosen so that reaches the same accuracy as the teacher model when distilled at full precision. Accuracy results are given in Table 4. More details are reported in Table 20, in the appendix.
203
+
204
+ Table 4: CIFAR100 accuracy and model size. Teacher: 36.5M param, 146 MB, acc. $7 7 . 2 1 \ \%$ .
205
+
206
+ <table><tr><td></td><td></td><td>2 bits</td><td>4 bits</td></tr><tr><td>Student model</td><td>PM Quant. (No bucket)</td><td>1.38% - 3.18 MB</td><td>1.29 % - 5.77 MB</td></tr><tr><td>17.2M param - 68.8 MB</td><td>PM Quant. (with bucket)</td><td>1.00% -3.9 MB</td><td>73.5%-8.2MB</td></tr><tr><td>77.08% - 77.24%</td><td>Quantized Distill.</td><td>27.84 %-4.3MB</td><td>76.31% -8.2 MB</td></tr><tr><td></td><td>Differentiable Quant.</td><td>49.32 % - 7.9 MB</td><td>77.07 % - 12.4 MB</td></tr></table>
207
+
208
+ The results confirm the trend from the previous dataset, with distilled and differential quantization preserving accuracy within less than $1 \%$ at 4bit precision. However, we note that accuracy loss is catastrophic at 2bit precision, probably because of reduced model capacity. We note that differentiable quantization is able to best recover accuracy for this harder task.
209
+
210
+ OpenNMT Experiments. The OpenNMT integration test dataset (Ope) consists of 200K train sentences and 10K test sentences for a German-English translation task. To train and test models we use the OpenNMT PyTorch codebase (Klein et al., 2017). We modified the code, in particular by adding the quantization algorithms and the distillation loss. As measure of fit we will use perplexity and the BLEU score, the latter computed using the multi-bleu.perl code from the moses project (mos).
211
+
212
+ Our target models consist of an embedding layer, an encoder consisting of $n$ layers of LSTM, a decoder consisting of $n$ layers of LSTM, and a linear layer. The decoder also uses the global attention mechanism described in Luong et al. (2015). For the teacher network we set $n = 2$ , for a total of 4 LSTM layers with LSTM size 500. For the student networks we choose $n = 1$ , for a total of 2 LSTM layers. We vary the LSTM size of the student networks and for each one, we compute the distilled model and the quantized versions for varying bit width. Results are summarized in Table 5. The BLEU scores below the student model refer to the BLEU scores of the normal and distilled model respectively (trained with full precision). Details about the resulting size of the models are reported in table 23 in the appendix.
213
+
214
+ Table 5: OpenNMT dataset BLEU score and perplexity (ppl). Teacher model: 84.8M param, 340 MB, 26.1 ppl, 15.88 BLEU. Details about the resulting size of the models are reported in table 23 in the appendix.
215
+
216
+ <table><tr><td>Student model 1 81.6M param - 326 MB 14.97 - 16.13BLEU</td><td>PM Quant.(No bucket) PM Quant. (with bucket) Quantized Distill. Differentiable Quant.</td><td>2 bits 0.00 - 2 :1017 ppl 4.12 - 125.1 ppl 0.00 - 6645 ppl 0.7 - 249 ppl</td><td>4 bits 0.24 - 2 · 10 ppl 16.29 - 26.2 ppl 15.73 - 25.43 ppl</td></tr><tr><td>Student model 2 64.8M param - 249 MB 14.22 - 15.48 BLEU</td><td>PM Quant. (No bucket) PM Quant. (with bucket) Quantized Distill. Differentiable Quant.</td><td>0.00 -5·10ppl 1.72 - 286.98 ppl 0.00 - 4035 ppl 0.28 - 306 ppl</td><td>15.01 - 28.8 ppl 6.65 - 71.78 ppl 15.19 - 28.95 ppl 15.26 - 29.1 ppl 13.86 - 31.33 ppl</td></tr><tr><td>Student model 3 57.2M param - 228 MB 12.45-13.8 BLEU</td><td>PM Quant. (No bucket) PM Quant. (with bucket) Quantized Distill. Differentiable Quant.</td><td>0.00 -3·10ppl 0.24 - 1984 ppl 0.14 - 731 ppl 0.26 - 306 ppl</td><td>5.47 - 106.5 ppl 12.64 - 36.56 ppl 12 - 37 ppl 12.06 - 38.44 ppl</td></tr></table>
217
+
218
+ A reasonable intuition would be that recurrent neural networks should be harder to quantize than convolutional neural networks, as quantization errors do not average out when executing repeatedly through the same cell, but accumulate. Results contradict this intuition. In particular, medium and large-sized students are able to essentially recover the same scores as the teacher model on this dataset. Perhaps surprisingly, bucketing PM and quantized distillation perform equally well for 4bit quantization. As expected, cell size is an important indicator for accuracy, although halving both cell size and the number of layers can be done without significant loss.
219
+
220
+ # 6.2 LARGER DATASETS
221
+
222
+ WMT13 Experiments. We run a similar LSTM architecture as above for the WMT13 dataset (Koehn, 2005) (1.7M sentences train, 190K sentences test) and we provide additional experiments for quantized distillation technique, see Table 6. We note that, on this large dataset, PM quantization does not perform well, even with bucketing. On the other hand, quantized distillation with 4bits of precision has higher BLEU score than the teacher, and similar perplexity.
223
+
224
+ Table 6: WMT13 dataset BLEU score and perplexity (ppl). Teacher model: 84.8M param, 340 MB, 5.8 ppl, 34.7 BLEU. Details about model size are reported in Table 26.
225
+
226
+ <table><tr><td>StudentModel</td><td>PM Quant. (No bucket)</td><td>4 bits</td></tr><tr><td>81.6M param - 326 MB</td><td>PM Quant. (with bucket)</td><td>21.38 BLEU - 12.61 ppl</td></tr><tr><td>30.22-30.21BLEU</td><td>Quantized Distill.</td><td>27.73 BLEU - 7.4 ppl</td></tr><tr><td></td><td></td><td>35.32 BLEU - 6.48 ppl</td></tr></table>
227
+
228
+ The ImageNet Dataset. We also experiment with ImageNet using the ResNet architecture (He et al., 2016a). In the first experiment, we use a ResNet34 teacher, and a student ResNet18 student model. Experiments quantizing the standard version of this student resulted in an accuracy loss of around
229
+
230
+ $4 \%$ , and hence we experiment with a wider model, which doubles the number of filters for each convolutional layer. We call this 2xResNet18. This is in line with previous work on wide ResNet architectures (Zagoruyko & Komodakis, 2016), wide students for distillation (Ba & Caruana, 2013), and wider quantized networks (Mishra et al., 2017). We also note that, in line with previous work on this dataset (Zhu et al., 2016; Mishra et al., 2017), we do not quantize the first and last layers of the models, as this can hurt accuracy.
231
+
232
+ After 62 epochs of training, the quantized distilled 2xResNet18 with 4 bits reaches a validation accuracy of $7 3 . 3 1 \%$ . Surprisingly, this is higher than the unquantized ResNet18 model $( 6 9 . 7 5 \% )$ , and has virtually the same accuracy as the ResNet34 teacher. In terms of size, this model is more than $2 \times$ smaller than ResNet18 (but has higher accuracy), and is $4 \times$ smaller than ResNet34, and about $1 . 5 \times$ faster on inference, as it has fewer layers. This is state-of-the-art for 4bit models with 18 layers; to our knowledge, no such model has been able to surpass the accuracy of ResNet18.
233
+
234
+ We re-iterated this experiment using a 4-bit quantized 2xResNet34 student transferring from a ResNet50 full-precision teacher. We obtain a 4-bit quantized student of almost the same accuracy, which is $5 0 \%$ shallower and has a $2 . 5 \times$ smaller size.
235
+
236
+ Table 7: Imagenet accuracy and model size. Bucket size $= 2 5 6$ .
237
+
238
+ <table><tr><td>Model name</td><td>Top-1 Accuracy</td><td>Top-5 Accuracy</td><td># of parameters</td><td>Size (MB)</td></tr><tr><td>Teachermodel:ResNet34</td><td>73.31 %</td><td>91.42 %</td><td>21.79 millions</td><td>87.16 MB</td></tr><tr><td>ResNet18 normal 2xResNet18 QD 4 bits</td><td>69.75 %</td><td>89.07 %</td><td>11.69 millions</td><td>46.76MB</td></tr><tr><td></td><td>73.10 %</td><td>91.17 %</td><td>45.69 millions</td><td>21.98 MB</td></tr><tr><td>Teachermodel:ResNet50</td><td>76.13 %</td><td>92.86 %</td><td>25.55 millions</td><td>102.2MB</td></tr><tr><td>2xResNet34 QD 4 bits</td><td>76.07 %</td><td>92.71 %</td><td>86.11 millions</td><td>41.53MB</td></tr></table>
239
+
240
+ # 6.3 ADDITIONAL EXPERIMENTS
241
+
242
+ Distillation Loss versus Normal Loss. One key question we are interested in is whether distillation loss is a consistently better metric when quantizing, compared to standard loss. We tested this for CIFAR-10, comparing the performance of quantized training with respect to each loss. At 2bit precision, the student converges to $6 7 . 2 2 \%$ accuracy with normal loss, and to $8 2 . 4 0 \%$ with distillation loss. At 4bit precision, the student converges to $8 6 . 0 1 \%$ accuracy with normal loss, and to $8 8 . 0 0 \%$ with distillation loss. On OpenNMT, we observe a similar gap: the 4bit quantized student converges to 32.67 perplexity and 15.03 BLEU when trained with normal loss, and to 25.43 perplexity (better than the teacher) and 15.73 BLEU when trained with distillation loss. This strongly suggests that distillation loss is superior when quantizing. For details, see Section A.4.1 in the Appendix.
243
+
244
+ Impact of Heuristics on Differentiable Quantization. We also performed an in-depth study of how the various heuristics impact accuracy. We found that, for differentiable quantization, redistributing bits according to the gradient norm of the layers is absolutely essential for good accuracy; quantiles and distillation loss also seem to provide an improvement, albeit smaller. Due to space constraints, we defer the results and their discussion to Section A.4.2 of the Appendix.
245
+
246
+ Inference Speed. In general, shallower students lead to an almost-linear decrease in inference cost, w.r.t. the depth reduction. For instance, in the CIFAR-10 experiments with the wide ResNet models, the teacher forward pass takes 67.4 seconds, while the student takes 43.7 seconds; roughly a $1 . 5 \mathrm { x }$ speedup, for $1 . 7 5 \mathrm { x }$ reduction in depth. On the ImageNet test set using 4 GPUs (data-parallel), a forward pass takes 263 seconds for ResNet34, 169 seconds for ResNet18, and 169 seconds for our 2xResNet18. (So, while having more parameters than ResNet18, it has the same speed because it has the same number of layers, and is not wide enough to saturate the GPU. We note that we did not exploit 4bit weights, due to the lack of hardware support.) Inference on our model is 1.5 times faster, while being 1.8 times shallower, so here the speedup is again almost linear.
247
+
248
+ # 7 DISCUSSION
249
+
250
+ We have examined the impact of combining distillation and quantization when compressing deep neural networks. Our main finding is that, when quantizing, one can (and should) leverage large, accurate models via distillation loss, if such models are available. We have given two methods to do just that, namely quantized distillation, and differentiable quantization. The former acts directly on the training process of the student model, while the latter provides a way of optimizing the quantization of the student so as to best fit the teacher model.
251
+
252
+ Our experimental results suggest that these methods can compress existing models by up to an order of magnitude in terms of size, on small image classification and NMT tasks, while preserving accuracy. At the same time, we note that distillation also provides an automatic improvement in inference speed, since it generates shallower models. One of our more surprising findings is that naive uniform quantization with bucketing appears to perform well in a wide range of scenarios. Our analysis in Section 2.2 suggests that this may be because bucketing provides a way to parametrize the Gaussian-like noise induced by quantization. Given its simplicity, it could be used consistently as a baseline method.
253
+
254
+ In our experimental results, we performed manual architecture search for the depth and bit width of the student model, which is time-consuming and error-prone. In future work, we plan to examine the potential of reinforcement learning or evolution strategies to discover the structure of the student for best performance given a set of space and latency constraints. The second, and more immediate direction, is to examine the practical speedup potential of these methods, and use them together and in conjunction with existing compression methods such as weight sharing Han et al. (2015) and with existing low-precision computation frameworks, such as NVIDIA TensorRT, or FPGA platforms.
255
+
256
+ # ACKNOWLEDGEMENTS
257
+
258
+ We would like to thank Ce Zhang (ETH Zurich), Hantian Zhang (ETH Z ´ urich) and Martin Jaggi ´ (EPFL) for their support with experiments and valuable feedback.
259
+
260
+ # REFERENCES
261
+
262
+ Opennmt integration testing. https://github.com/OpenNMT/OpenNMT-py. Accessed: 2017-10-25.
263
+
264
+ Moses baseline. http://www.statmt.org/moses/?n ${ } = { }$ moses.baseline. Accessed: 2017-10-25.
265
+
266
+ Dan Alistarh, Jerry Li, Ryota Tomioka, and Milan Vojnovic. Qsgd: Randomized quantization for communication-optimal stochastic gradient descent. arXiv preprint arXiv:1610.02132, 2016.
267
+
268
+ S. Arora, R. Ge, B. Neyshabur, and Y. Zhang. Stronger generalization bounds for deep nets via a compression approach. ArXiv e-prints, February 2018.
269
+
270
+ Lei Jimmy Ba and Rich Caruana. Do deep nets really need to be deep? CoRR, abs/1312.6184, 2013. URL http://arxiv.org/abs/1312.6184.
271
+
272
+ Yoshua Bengio, Nicholas Leonard, and Aaron C. Courville. Estimating or propagating gradients ´ through stochastic neurons for conditional computation. CoRR, abs/1308.3432, 2013. URL http://arxiv.org/abs/1308.3432.
273
+
274
+ Matthieu Courbariaux, Yoshua Bengio, and Jean-Pierre David. Binaryconnect: Training deep neural networks with binary weights during propagations. CoRR, abs/1511.00363, 2015. URL http: //arxiv.org/abs/1511.00363.
275
+
276
+ Yann Dauphin, Razvan Pascanu, C¸ aglar Gulc¸ehre, Kyunghyun Cho, Surya Ganguli, and Yoshua ¨ Bengio. Identifying and attacking the saddle point problem in high-dimensional non-convex optimization. CoRR, abs/1406.2572, 2014. URL http://arxiv.org/abs/1406.2572.
277
+
278
+ Caglar Gulcehre, Marcin Moczulski, Misha Denil, and Yoshua Bengio. Noisy activation functions. In International Conference on Machine Learning, pp. 3059–3068, 2016.
279
+
280
+ Philipp Gysel, Mohammad Motamedi, and Soheil Ghiasi. Hardware-oriented approximation of convolutional neural networks. arXiv preprint arXiv:1604.03168, 2016.
281
+
282
+ Song Han, Huizi Mao, and William J. Dally. Deep compression: Compressing deep neural network with pruning, trained quantization and huffman coding. CoRR, abs/1510.00149, 2015. URL http://arxiv.org/abs/1510.00149.
283
+
284
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016a.
285
+
286
+ Qinyao He, He Wen, Shuchang Zhou, Yuxin Wu, Cong Yao, Xinyu Zhou, and Yuheng Zou. Effective quantization methods for recurrent neural networks. CoRR, abs/1611.10176, 2016b. URL http: //arxiv.org/abs/1611.10176.
287
+
288
+ G. Hinton, O. Vinyals, and J. Dean. Distilling the Knowledge in a Neural Network. ArXiv e-prints, March 2015.
289
+
290
+ Sepp Hochreiter and Jurgen Schmidhuber. Flat minima. ¨ Neural Computation, 9(1):1–42, 1997.
291
+
292
+ Itay Hubara, Matthieu Courbariaux, Daniel Soudry, Ran El-Yaniv, and Yoshua Bengio. Quantized neural networks: Training neural networks with low precision weights and activations. CoRR, abs/1609.07061, 2016. URL http://arxiv.org/abs/1609.07061.
293
+
294
+ Forrest N Iandola, Song Han, Matthew W Moskewicz, Khalid Ashraf, William J Dally, and Kurt Keutzer. Squeezenet: Alexnet-level accuracy with 50x fewer parameters and¡ $0 . 5 \mathrm { m b }$ model size. arXiv preprint arXiv:1602.07360, 2016.
295
+
296
+ Nitish Shirish Keskar, Dheevatsa Mudigere, Jorge Nocedal, Mikhail Smelyanskiy, and Ping Tak Peter Tang. On large-batch training for deep learning: Generalization gap and sharp minima. arXiv preprint arXiv:1609.04836, 2016.
297
+
298
+ G. Klein, Y. Kim, Y. Deng, J. Senellart, and A. M. Rush. OpenNMT: Open-Source Toolkit for Neural Machine Translation. ArXiv e-prints, 2017.
299
+
300
+ Philipp Koehn. Europarl: A Parallel Corpus for Statistical Machine Translation. In Conference Proceedings: the tenth Machine Translation Summit, pp. 79–86, Phuket, Thailand, 2005. AAMT, AAMT. URL http://www.statmt.org/europarl/.
301
+
302
+ Yehuda Koren and Joe Sill. Ordrec: an ordinal model for predicting personalized item rating distributions. In Proceedings of the fifth ACM conference on Recommender systems, pp. 117–124. ACM, 2011.
303
+
304
+ 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.
305
+
306
+ Andrew S Lan, Christoph Studer, and Richard G Baraniuk. Matrix recovery from quantized and corrupted measurements. In Acoustics, Speech and Signal Processing (ICASSP), 2014 IEEE International Conference on, pp. 4973–4977. IEEE, 2014.
307
+
308
+ Hao Li, Soham De, Zheng Xu, Christoph Studer, Hanan Samet, and Tom Goldstein. Training quantized nets: A deeper understanding. CoRR, abs/1706.02379, 2017. URL http://arxiv. org/abs/1706.02379.
309
+
310
+ Minh-Thang Luong, Hieu Pham, and Christopher D. Manning. Effective approaches to attentionbased neural machine translation. CoRR, abs/1508.04025, 2015. URL http://arxiv.org/ abs/1508.04025.
311
+
312
+ Naveen Mellempudi, Abhisek Kundu, Dheevatsa Mudigere, Dipankar Das, Bharat Kaul, and Pradeep Dubey. Ternary neural networks with fine-grained quantization. arXiv preprint arXiv:1705.01462, 2017.
313
+
314
+ Asit K. Mishra, Eriko Nurvitadhi, Jeffrey J. Cook, and Debbie Marr. WRPN: wide reduced-precision networks. CoRR, abs/1709.01134, 2017. URL http://arxiv.org/abs/1709.01134.
315
+
316
+ Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Alex Graves, Ioannis Antonoglou, Daan Wierstra, and Martin Riedmiller. Playing atari with deep reinforcement learning. arXiv preprint arXiv:1312.5602, 2013.
317
+
318
+ Aaron van den Oord, Sander Dieleman, Heiga Zen, Karen Simonyan, Oriol Vinyals, Alex Graves, Nal Kalchbrenner, Andrew Senior, and Koray Kavukcuoglu. Wavenet: A generative model for raw audio. arXiv preprint arXiv:1609.03499, 2016.
319
+
320
+ Joachim Ott, Zhouhan Lin, Ying Zhang, Shih-Chii Liu, and Yoshua Bengio. Recurrent neural networks with limited numerical precision. arXiv preprint arXiv:1608.06902, 2016.
321
+
322
+ Mohammad Rastegari, Vicente Ordonez, Joseph Redmon, and Ali Farhadi. Xnor-net: Imagenet classification using binary convolutional neural networks. CoRR, abs/1603.05279, 2016. URL http://arxiv.org/abs/1603.05279.
323
+
324
+ David Silver, Aja Huang, Chris J Maddison, Arthur Guez, Laurent Sifre, George Van Den Driessche, Julian Schrittwieser, Ioannis Antonoglou, Veda Panneershelvam, Marc Lanctot, et al. Mastering the game of go with deep neural networks and tree search. Nature, 529(7587):484–489, 2016.
325
+
326
+ G. Urban, K. J. Geras, S. Ebrahimi Kahou, O. Aslan, S. Wang, R. Caruana, A. Mohamed, M. Philipose, and M. Richardson. Do Deep Convolutional Nets Really Need to be Deep and Convolutional? ArXiv e-prints, March 2016.
327
+
328
+ Vladimir Vapnik and Rauf Izmailov. Learning using privileged information: similarity control and knowledge transfer. Journal of machine learning research, 16(20232049):55, 2015.
329
+
330
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. arXiv preprint arXiv:1706.03762, 2017.
331
+
332
+ Wei Wen, Chunpeng Wu, Yandan Wang, Yiran Chen, and Hai Li. Learning structured sparsity in deep neural networks. In Advances in Neural Information Processing Systems, pp. 2074–2082, 2016.
333
+
334
+ Jiaxiang Wu, Cong Leng, Yuhang Wang, Qinghao Hu, and Jian Cheng. Quantized convolutional neural networks for mobile devices. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4820–4828, 2016a.
335
+
336
+ Xundong Wu, Yong Wu, and Yong Zhao. High performance binarized neural networks trained on the imagenet classification task. CoRR, abs/1604.03058, 2016b. URL http://arxiv.org/ abs/1604.03058.
337
+
338
+ Xinxing Xu, Joey Tianyi Zhou, IvorW Tsang, Zheng Qin, Rick Siow Mong Goh, and Yong Liu. Simple and efficient learning using privileged information. arXiv preprint arXiv:1604.01518, 2016.
339
+
340
+ S. Zagoruyko and N. Komodakis. Wide Residual Networks. ArXiv e-prints, May 2016.
341
+
342
+ Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. arXiv preprint arXiv:1611.03530, 2016.
343
+
344
+ Hantian Zhang, Jerry Li, Kaan Kara, Dan Alistarh, Ji Liu, and Ce Zhang. Zipml: Training linear models with end-to-end low precision, and a little bit of deep learning. In International Conference on Machine Learning, pp. 4035–4043, 2017.
345
+
346
+ Chenzhuo Zhu, Song Han, Huizi Mao, and William J. Dally. Trained ternary quantization. CoRR, abs/1612.01064, 2016. URL http://arxiv.org/abs/1612.01064.
347
+
348
+ # A FULL EXPERIMENTAL RESULTS
349
+
350
+ # A.1 CIFAR10
351
+
352
+ The model used to train CIFAR10 is the one described in Urban et al. (2016) with some minor modifications. We use standard data augmentation techniques, including random cropping and random flipping. The learning rate schedule follows the one detailed in the paper. The structure of the models we experiment with consists of some convolutional layers, mixed with dropout layers and max pooling layers, followed by one or more linear layers.
353
+
354
+ The model used are defined in Table 8. The $c$ indicates a convolutional layer, mp a max pooling layer, dp a dropout layer, fc a linear (fully connected) layer. The exponent indicates how many consecutive layers of the same type are there, while the number in front of the letter determines the size of the layer. In the case of convolutional layers is the number of filters. All convolutional layers of the teacher are 3x3, while the convolutional layers in the smaller models are 5x5.
355
+
356
+ Teacher model Smaller model 1 Smaller model 2 Smaller model 3
357
+
358
+ $7 6 c ^ { 2 }$ -mp-dp- $\cdot 1 2 6 c ^ { 2 }$ -mp-dp- $\cdot 1 4 8 c ^ { 4 }$ -mp-dp-1200fc-dp-1200fc$7 5 c$ -mp-dp- $5 0 c ^ { 2 }$ -mp-dp- $2 5 c$ -mp-dp-500fc-dp$\mathrm { 5 0 c { - } m p { - } d p { - } 2 5 c ^ { 2 } }$ -mp-dp- $. 1 0 c$ -mp-dp-400fc-dp$2 5 c$ -mp-dp- $1 0 c ^ { 2 }$ -mp-dp- $. 5 c$ -mp-dp-300fc-dp
359
+
360
+ Following the authors of the paper, we don’t use dropout layers when training the models using distillation loss. Distillation loss is computed with a temperature of $T = 5$ .
361
+
362
+ Table 9 reports the accuracy of the models trained (in full precision) and their size. Table 10 reports the accuracy achieved with each method, and table 11 reports the optimal mean bit length using Huffman encoding and resulting model size.
363
+
364
+ Table 8: CIFAR10: model specifications
365
+ Table 9: CIFAR10: Teacher and distilled model accuracy, full precision
366
+
367
+ <table><tr><td>Model name Teacher model</td><td>Test accuracy 89.7 %</td><td># of parameters 5.3 millions</td><td>Size (MB) 21.3 MB</td></tr><tr><td>Smaller model 1</td><td>84.5 %</td><td>1.0 millions</td><td>4.00 MB</td></tr><tr><td>Distilled model 1</td><td>88.8 %</td><td>1.0 millions</td><td>4.00 MB</td></tr><tr><td>Smaller model 2</td><td>80.3 %</td><td>0.3 millions</td><td>1.27MB</td></tr><tr><td>Distilled model 2</td><td>84.3 %</td><td>0.3 millions</td><td>1.27 MB</td></tr><tr><td>Smaller model 3</td><td>71.6 %</td><td>0.1 millions</td><td>0.45MB</td></tr><tr><td>Distilled model 3</td><td>78.2 %</td><td>0.1 millions</td><td>0.45MB</td></tr></table>
368
+
369
+ Table 10: CIFAR10: Test accuracy for quantized models. Results computed with bucket size $= 2 5 6$
370
+
371
+ <table><tr><td>PM Quant. 1 (No bucket) PM Quant.1 (with bucket) Quantized Distill. 1 Differentiable Quant.1 PM Quant. 2 (No bucket)</td><td>2 bits 9.30 % 10.53 % 82.4 % 80.43% 10.15 %</td><td>4 bits 67.99 % 87.18 % 88.00 % 88.31 %</td><td>8 bits 88.91 % 88.80 % 88.82 %</td></tr><tr><td>PM Quant.2 (with bucket) Quantized Distill. 2 Differentiable Quant. 2 PM Quant. 3 (No bucket)</td><td>11.89 % 74.22 % 72.79 % 10.15 %</td><td>68.05 % 81.96 % 83.92 % 83.49 % 61.30 %</td><td>84.38 % 84.38 % 84.22 % 78.04 %</td></tr><tr><td>PM Quant. 3 (with bucket) Quantized Distill. 3 Differentiable Quant. 3</td><td>10.38 % 67.02 % 57.84 %</td><td>72.44 % 77.75 % 77.36 %</td><td>78.10 % 77.92 %</td></tr></table>
372
+
373
+ We also performed an experiment with a deeper student model. The architecture is $7 6 c ^ { 3 }$ -mp-dp$1 2 6 c ^ { 3 }$ -mp-dp- $\boldsymbol { 1 4 8 c ^ { 5 } }$ -mp-dp-1000fc-dp-1000fc-dp-1000fc (following the same notation as in table 8). We use the same teacher as in the previous experiments. Results are in table 13.
374
+
375
+ # A.1.1 CIFAR10 - WIDERESNET ARCHITECTURE
376
+
377
+ For our second set of experiments on CIFAR10 with the WideResNet architecture, see table 15. Note that we increase the number of filters but reduce the depth of the model. The implementation of WideResNet used can be found on GitHub 2. Results of quantized methods are in table 16 while the size of the resulting models is detailed in table 17.
378
+
379
+ Table 11: CIFAR10: Optimal length Huffman encoding and resulting model size. Bucket size $= 2 5 6$
380
+
381
+ <table><tr><td>PM Quant.1 (No bucket)</td><td>2 bits 1.34 bits - 0.17 MB</td><td>4 bits 2.43 bits - 0.3 MB 3.52 - 0.47 MB</td><td>8 bits 6.48 bits - 0.81 MB</td></tr><tr><td>PM Quant. 1 (with bucket) Quantized Distill. 1 Differentiable Quant.1</td><td>1.58 bits - 0.22 MB 1.7 bits - 0.24 MB 3.18 bits - 0.43 MB</td><td>3.64 bits - 0.48 MB 5.34 bits - 0.7 MB</td><td>7.58 bits - 0.98 MB 7.70 bits - 1 MB</td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td>PM Quant. 2 (No bucket)</td><td>1.43 bits - 0.05 MB</td><td>2.6 bits - 0.1 MB</td><td>6.65 bits - 0.26 MB</td></tr><tr><td>PM Quant.2 (with bucket)</td><td>1.6 bits - 0.07 MB</td><td>3.58 bits - 0.15 MB</td><td>7.64 bits - 0.31 MB</td></tr><tr><td>Quantized Distill. 2</td><td>1.7 bits - 0.08 MB</td><td>3.55 bits - 0.15 MB</td><td>7.64 bits - 0.31 MB</td></tr><tr><td>Differentiable Quant. 2</td><td>3.16 bits - 0.13 MB</td><td>5.34 bits - 0.22 MB</td><td></td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td>PM Quant. 3 (No bucket)</td><td>1.46 bits - 0.02 MB</td><td>2.62 bits - 0.03 MB</td><td>6.66 bits - 0.09 MB</td></tr><tr><td>PM Quant.3 (with bucket)</td><td>1.58 bits - 0.026 MB</td><td>3.51 bits - 0.053 MB</td><td>7.56 bits - 0.1 MB</td></tr><tr><td>Quantized Distill. 3</td><td>1.64 bits - 0.027 MB</td><td>3.53 bits - 0.053 MB</td><td>7.59 bits - 0.11 MB</td></tr><tr><td>Differentiable Quant. 3</td><td>3.12 bits - 0.04 MB</td><td>5.41 bits - 0.08 MB</td><td></td></tr></table>
382
+
383
+ Table 12: CIFAR10: Teacher and distilled model accuracy, full precision
384
+
385
+ <table><tr><td>Model name Teacher model</td><td>Test accuracy 89.7 %</td><td># of parameters 5.3 millions</td><td>Size (MB) 21.3 MB</td></tr><tr><td>Deeper normal model 1</td><td>93.22 %</td><td>5.8 millions</td><td>23.40MB</td></tr><tr><td>Deeper distilled model 1</td><td>92.60 %</td><td>5.8 millions</td><td>23.40 MB</td></tr></table>
386
+
387
+ Table 13: CIFAR10: Test accuracy for quantized deeper student model. Results computed with bucket size $= 2 5 6$
388
+ Table 14: CIFAR10: Optimal length Huffman encoding and resulting model size for deeper student model. Bucket size $= 2 5 6$
389
+
390
+ <table><tr><td>PM Quant. (No bucket) PM Quant. (with bucket) Quantized Distill.</td><td>2 bits 12.60 % 45.82 % 89.33 %</td><td>4bits 91.11 % 92.30 %</td></tr></table>
391
+
392
+ 2 bits 4 bits PM Quant. (No bucket) 1.50 bits - 1.13 MB 3.21 bits - 2.38 MB PM Quant. (with bucket) 1.82 bits - 1.55 MB 3.92 bits - 3.07 MB Quantized Distill. 1.84 bits - 1.56 MB 3.92 bits - 3.08 MB
393
+
394
+ Table 15: CIFAR10: Teacher and distilled model accuracy, full precision, wide resnet
395
+
396
+ <table><tr><td>Model name</td><td>Structure</td><td>Test accuracy</td><td># of parameters</td><td>Size (MB)</td></tr><tr><td>Teacher model</td><td>depth = 28,wide_factor= 20</td><td>95.74 %</td><td>145 millions</td><td>580MB</td></tr><tr><td>Smaller model</td><td>depth = 22, wide_factor = 16</td><td>95.19 %</td><td>82.7 millions</td><td>330 MB</td></tr><tr><td>Distilled model</td><td>depth =22,wide_factor = 16</td><td>94.19 %</td><td>82.7 millions</td><td>330 MB</td></tr></table>
397
+
398
+ # A.2 CIFAR100
399
+
400
+ For our CIFAR100 experiments, we use the same implementation of wide residual networks as in our CIFAR10 experiments. The wide factor is a multiplicative factor controlling the amount of filters in each layer; for more details please refer to the original paper Zagoruyko & Komodakis (2016). We train for 200 epochs with an initial learning rate of 0.1.
401
+
402
+ Table 16: CIFAR10: Test accuracy for quantized models. Results computed with bucket size $= 2 5 6$
403
+
404
+ 2 bits 4 bits PM Quant. (with bucket) $1 5 . 3 5 \%$ $8 1 . 0 9 \%$ Quantized Distill. $9 4 . 2 3 \%$ $9 4 . 7 3 \%$
405
+
406
+ Table 17: CIFAR10: Optimal length Huffman encoding and resulting model size. Bucket size $= 2 5 6$
407
+
408
+ 2 bits 4 bits PM Quant. (with bucket) 1.44 bits - 17.56 MB 2.62 bits - 29.75 MB Quantized Distill. 1.54 bits - 17.81 MB 3.48 bits - 38.65 MB
409
+
410
+ For the CIFAR100 experiments we focused on one student model. Distillation loss is computed with a temperature of $T = 5$ .
411
+
412
+ Model name Structure Test accuracy # of parameters Size (MB) Teacher model depth $= 2 8$ , wide factor $= 1 0$ $7 7 . 2 1 \%$ 36.5 millions 146 MB Smaller model depth $= 2 2$ , wide factor $= 8$ $7 7 . 0 8 \%$ 17.2 millions 68.8 MB Distilled model depth $= 2 2$ , wide factor $= 8$ $7 7 . 2 4 \%$ 17.2 millions 68.8 MB
413
+
414
+ Table 19: CIFAR100: Test accuracy for quantized models. Results computed with bucket size $= 2 5 6$
415
+
416
+ 2 bits 4 bits PM Quant. (No bucket) $1 . 3 8 \%$ $1 . 2 9 \%$ PM Quant. (with bucket) $1 . 0 0 \%$ $7 3 . 4 7 \%$ Quantized Distill. $2 7 . 8 4 \%$ 76.31% Differentiable Quant. $4 9 . 3 2 \%$ $7 7 . 0 7 \%$
417
+
418
+ Table 20: CIFAR100: Optimal length Huffman encoding and resulting model size. Bucket size $=$ 256
419
+
420
+ 2 bits 4 bits
421
+ PM Quant. (No bucket) 1.47 bits - 3.18 MB 2.68 bits - 5.77 MB
422
+ PM Quant. (with bucket) 1.56 bits - 3.90 MB 3.55 bits - 8.18 MB Quantized Distill. 1.73 bits - 4.27 MB 3.54 bits - 8.16 MB Differentiable Quant. 3.23 bits - 7.84 MB 5.53 bits - 12.44 MB
423
+
424
+ # A.3 OPENTNMT INTEGRATION TEST DATASET
425
+
426
+ As mentioned in the main text, we use the openNMT-py codebase. We slightly modify it to add distillation loss and the quantization methods proposed. We mostly use standard options to train the model; in particular, the learning rate starts at 1 and is halved every epoch starting from the first epoch where perplexity doesn’t drop on the test set. We train every model for 15 epochs. Distillation loss is computed with a temperature of $T = 1$ .
427
+
428
+ # A.4 WMT13 DATASET
429
+
430
+ For the WMT13 datasets, we run a similar architecture. We ran all models for 15 epochs; the smaller model overfit with 15 epochs, so we ran it for 5 epochs instead.
431
+
432
+ Table 21: openNMT integ: Teacher and distilled models perplexity and BLEU, full precision
433
+
434
+ <table><tr><td>Model name Teacher model</td><td>Structure 4 LSTM layer, 500 cell size</td><td>Perplexity 26.21</td><td>BLEU 15.88</td><td># of parameters 84.8 millions</td><td>Size (MB) 339.28MB</td></tr><tr><td>Smaller model 1</td><td>2 LSTM layer, 512 cell size 2 LSTMlayer, 512 cell size</td><td>33.03 25.55</td><td>14.97 16.13</td><td>81.6 millions 81.6 millions</td><td>326.57 MB 326.57 MB</td></tr><tr><td>Distilled model1 Smaller model 2</td><td></td><td>34.5</td><td>14.22</td><td>64.8 millions</td><td></td></tr><tr><td>Distilled model 2</td><td>2 LSTM layer,256 cell size 2 LSTM layer,256 cell size</td><td>27.7</td><td>15.48</td><td>64.8 millions</td><td>249.56 MB 249.56 MB</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Smaller model 3</td><td>2LSTMlayer,128 cell size</td><td>39.5</td><td>12.45</td><td>57.2 millions</td><td>228.85 MB</td></tr><tr><td>Distilled model 3</td><td>2 LSTMlayer,128 cell size</td><td>33.78</td><td>13.8</td><td>57.2 millions</td><td>228.85MB</td></tr></table>
435
+
436
+ Table 22: openNMT integ: Test accuracy for quantized models. Results computed with bucket size $= 2 5 6$
437
+
438
+ <table><tr><td>PM Quant. 1 (No bucket) PM Quant.1 (with bucket) Quantized Distill. 1 Differentiable Quant.1</td><td>2 bits 2 ·1017 ppl - 0.00 BLEU 125.1 ppl - 4.12 BLEU 6645 ppl - 0.00 BLEU</td><td>4 bits 2.7 · 10 ppl - 0.24 BLEU 26.21 ppl - 16.29 BLEU</td></tr><tr><td>PM Quant. 2 (No bucket)</td><td>249 ppl - 0.7 BLEU 5·108 ppl - 0.00 BLEU</td><td>25.43 ppl - 15.73 BLEU 28.8 ppl - 15.01 BLEU 71.78 ppl - 6.65 BLEU</td></tr><tr><td>PM Quant.2 (with bucket) Quantized Distill. 2 Differentiable Quant.2</td><td>286.98 ppl - 1.72 BLEU 4035 ppl - 0.00 BLEU</td><td>28.95 ppl - 15.19 BLEU 29.1 ppl - 15.26 BLEU</td></tr><tr><td></td><td>306 ppl - 0.28 BLEU</td><td>31.33 ppl - 13.86 BLEU</td></tr><tr><td>PM Quant. 3 (No bucket)</td><td></td><td></td></tr><tr><td></td><td>3 ·108 ppl - 0.00 BLEU</td><td></td></tr><tr><td>PM Quant. 3 (with bucket)</td><td>1984 ppl - 0.24 BLEU</td><td>106.5 ppl - 5.47 BLEU</td></tr><tr><td></td><td></td><td>36.56 ppl - 12.64 BLEU</td></tr><tr><td>Quantized Distill. 3</td><td>731 ppl - 0.14 BLEU</td><td>37 ppl- 12 BLEU</td></tr><tr><td>Differentiable Quant. 3</td><td>306 ppl- 0.26 BLEU</td><td></td></tr><tr><td></td><td></td><td>38.4 ppl - 12.06 BLEU</td></tr></table>
439
+
440
+ Table 23: openNMT integ: Optimal length Huffman encoding and resulting model size. Bucket size $= 2 5 6$
441
+
442
+ <table><tr><td>PM Quant.1 (No bucket) PM Quant.1 (with bucket)</td><td>2 bits 1.36 bits - 13.93 MB 1.65 bits - 19.47 MB</td><td>4 bits 1.77 bits -18.10 MB 3.69 bits - 40.26 MB</td></tr><tr><td>Quantized Distill. 1 Differentiable Quant.1 PM Quant. 2 (No bucket)</td><td>1.75bits- 20.4 MB 1.72 bits - 20.1 MB 1.34 bits-10.89 MB</td><td>3.66 bits - 39.97 MB 4.38 bits - 47.32 MB 1.86 bits -15.09 MB</td></tr><tr><td>PM Quant. 2 (with bucket) Quantized Distill. 2 Differentiable Quant. 2</td><td>1.65 bits - 15.4 MB 1.85 bits - 17.05 MB 1.93bits-17.67MB</td><td>3.68bits-31.91MB 3.68 bits - 31.91 MB 4.17 bits -35.83 MB</td></tr><tr><td>PM Quant. 3 (No bucket)</td><td>1.47 bits - 10.54 MB</td><td></td></tr><tr><td>PM Quant.3 (with bucket)</td><td></td><td>2.13 bits -15.24 MB</td></tr><tr><td></td><td>1.65 bits -13.6 MB</td><td></td></tr><tr><td></td><td></td><td>3.68 bits - 28.14 MB</td></tr><tr><td>Quantized Distill. 3</td><td>1.86 bits -15.13 MB</td><td></td></tr><tr><td>Differentiable Quant. 3</td><td></td><td>3.68 bits -28.18 MB</td></tr><tr><td></td><td>1.99 bits - 16.04 MB</td><td>4.25bits -31.18 MB</td></tr></table>
443
+
444
+ # A.4.1 DISTILLATION VERSUS STANDARD LOSS FOR QUANTIZATION
445
+
446
+ In this section we highlight the positive effects of using distillation loss during quantization. We take models with the same architecture and we train them with the same number of bits; one of the models is trained with normal loss, the other with the distillation loss with equal weighting between soft cross entropy and normal cross entropy (that is, it is the quantized distilled model).
447
+
448
+ Table 24: WMT13: Teacher and distilled models perplexity and BLEU, full precision
449
+
450
+ <table><tr><td>Model name</td><td>Structure</td><td>Perplexity</td><td>BLEU</td><td># of parameters</td><td>Size (MB)</td></tr><tr><td>Teacher model</td><td>4 LSTMlayer, 50O cell size</td><td>5.83</td><td>34.77</td><td>84.8 millions</td><td>339.28 MB</td></tr><tr><td>Smaller model 1</td><td>2 LSTMlayer, 500 size</td><td>7.98</td><td>30.22</td><td>80.8 millions</td><td>323.25 MB</td></tr><tr><td>Distilled model 1</td><td>2 LSTMlayer, 550 cell size</td><td>7.18</td><td>30.21</td><td>84.3 millions</td><td>337.21 MB</td></tr></table>
451
+
452
+ Table 25: WMT13: Test accuracy for quantized models. Results computed with bucket size $= 2 5 6$
453
+
454
+ <table><tr><td>PM Quant. (No bucket) PM Quant. (with bucket) Quantized Distill.</td><td>4 bits 12.17 ppl - 22.79 BLEU 7.34 ppl - 26.18 BLEU 6.48 ppl - 35.32 BLEU</td></tr></table>
455
+
456
+ Table 26: WMT13: Optimal length Huffman encoding and resulting model size. Bucket size $= 2 5 6$
457
+
458
+ 4 bits
459
+ PM Quant. 1 (No bucket) 1.98 bits - 20.92 MB
460
+ PM Quant. 1 (with bucket) 3.63 bits - 41.02 MB Quantized Distill. 1 3.65 bits - 41.16 MB
461
+
462
+ Table 27 shows the results on the CIFAR10 dataset; the models we train have the same structure as the Smaller model 1, see Section A.1.
463
+
464
+ Table 28 shows the results on the openNMT integration test dataset; the models trained have the same structure of Smaller model 1, see Section A.3. Notice that distillation loss can significantly improve the accuracy of the quantized models.
465
+
466
+ Table 27: CIFAR10: Distillation loss vs normal loss when quantizing
467
+
468
+ <table><tr><td></td><td>2 bits</td><td>4 bits</td></tr><tr><td>Normal loss</td><td>67.22 %</td><td>86.01 %</td></tr><tr><td>Distillation loss</td><td>82.40 %</td><td>88.00 %</td></tr></table>
469
+
470
+ Table 28: openNMT integ: Distillation loss vs normal loss when quantizing
471
+
472
+ <table><tr><td></td><td colspan="2">4bits</td></tr><tr><td>Normal loss</td><td>32.67 ppl</td><td>15.03BLEU</td></tr><tr><td>Distillation loss</td><td>25.43 ppl</td><td>15.73BLEU</td></tr></table>
473
+
474
+ These results suggest that quantization works better when combined with distillation, and that we should try to take advantage of this whenever we are quantizing a neural network.
475
+
476
+ # A.4.2 DIFFERENT HEURISTICS FOR DIFFERENTIABLE QUANTIZATION
477
+
478
+ To test the different heuristics presented in Section 4.2, we train with differentiable quantization the Smaller model 1 architecture specified in Section A.1 on the cifar10 dataset. The same model is trained with different heuristics to provide a sense of how important they are; the experiments is performed with 2 and 4 bits.
479
+
480
+ Results suggests that when using 4 bits, the method is robust and works regardless. When using 2 bits, redistributing bits according to the gradient norm of the layers is absolutely essential for this method to work ; quantiles starting point also seem to provide an small improvement, while using distillation loss in this case does not seem to be crucial.
481
+
482
+ Table 29: Results with automatically redistributed bits
483
+
484
+ <table><tr><td>2 bits</td><td>Distillation loss Normal loss</td><td>Quantiles 82.94 % 83.67 %</td><td>Uniform 78.76 % 76.60 %</td></tr><tr><td>4 bits</td><td>Distillation loss Normal loss</td><td>88.93 % 88.80 %</td><td>88.50 % 88.74 %</td></tr></table>
485
+
486
+ Table 30: Results without automatically redistributed bits
487
+
488
+ <table><tr><td>2 bits</td><td>Distillation loss Normal loss</td><td>Quantiles 19.69 % 25.28 %</td><td>Uniform 22.81 % 22.11 %</td></tr><tr><td>4 bits</td><td>Distillation loss Normal loss</td><td>88.39 % 88.43 %</td><td>88.67 % 88.44 %</td></tr></table>
489
+
490
+ # B QUANTIZATION IS EQUIVALENT TO ASYMPTOTICALLY NORMALLY DISTRIBUTED NOISE
491
+
492
+ In this section we will prove some results about the uniform quantization function, including the fact that is asymptotically normally distributed, see subsection B.1 below. Clearly, we refer to the stochastic version, see Section 2.1.
493
+
494
+ # Unbiasedness
495
+
496
+ We first start proving the unbiasedness of $\hat { Q }$ ;
497
+
498
+ $$
499
+ E [ \hat { Q } ( \hat { v } ) _ { i } ] = \frac { \left\lfloor \hat { v } _ { i } s \right\rfloor } { s } + \frac { 1 } { s } E [ \xi _ { i } ] = \frac { \left\lfloor \hat { v } _ { i } s \right\rfloor } { s } + \frac { 1 } { s } ( s \hat { v } _ { i } - \lfloor \hat { v } _ { i } s \rfloor ) = \hat { v } _ { i }
500
+ $$
501
+
502
+ Then it is immediate that
503
+
504
+ $$
505
+ E [ Q ( v ) ] = \alpha E \left[ \hat { Q } \left( \frac { v - \beta } { \alpha } \right) \right] + \beta = \alpha \frac { v - \beta } { \alpha } + \beta = v
506
+ $$
507
+
508
+ # Bounds on second and third moment
509
+
510
+ We will write out bounds on $\hat { Q }$ ; the analogous bounds on $Q$ are then straightforward. For convenience, let us call $\hat { l } _ { i } = \lfloor \hat { v } _ { i } s \rfloor$
511
+
512
+ $$
513
+ \begin{array} { l } { { \displaystyle E [ \hat { Q } ( \hat { v } ) _ { i } ^ { 2 } ] = \frac { \hat { l } _ { i } ^ { 2 } } { s ^ { 2 } } + \frac { 1 } { s ^ { 2 } } E [ \xi _ { i } ^ { 2 } ] + 2 \frac { \hat { l } _ { i } } { s ^ { 2 } } E [ \xi _ { i } ] = } } \\ { { \displaystyle ~ = \frac { \hat { l } _ { i } ^ { 2 } } { s ^ { 2 } } + \frac { 1 } { s ^ { 2 } } ( s \hat { v } _ { i } - \hat { l } _ { i } ) + 2 \frac { \hat { l } _ { i } } { s ^ { 2 } } ( s \hat { v } _ { i } - \hat { l } _ { i } ) = } } \\ { { \displaystyle ~ = \frac { 1 } { s ^ { 2 } } \left[ \hat { v } _ { i } s ( 1 + 2 \hat { l } _ { i } ) - \hat { l } _ { i } ( \hat { l } _ { i } + 1 ) \right] } } \end{array}
514
+ $$
515
+
516
+ And given that $\hat { l } _ { i } \le \hat { v } _ { i } s \le \hat { l } _ { i } + 1$ , we readily find
517
+
518
+ $$
519
+ \frac { \hat { l } _ { i } ^ { 2 } } { s ^ { 2 } } \leq E [ \hat { Q } ( \hat { v } ) _ { i } ^ { 2 } ] \leq \frac { ( \hat { l } _ { i } + 1 ) ^ { 2 } } { s ^ { 2 } }
520
+ $$
521
+
522
+ For the third moment, we have
523
+
524
+ $$
525
+ \begin{array} { c } { { E [ \hat { Q } ( \hat { v } ) _ { i } ^ { 3 } ] = \displaystyle \frac { \hat { l } _ { i } ^ { 3 } } { s ^ { 3 } } + \frac { 1 } { s ^ { 3 } } E [ \xi _ { i } ^ { 3 } ] + 3 \frac { \hat { l } _ { i } } { s ^ { 3 } } E [ \xi _ { i } ^ { 2 } ] + 3 \frac { \hat { l } _ { i } ^ { 2 } } { s ^ { 3 } } E [ \xi _ { i } ] = } } \\ { { = \displaystyle \frac { \hat { l } _ { i } ^ { 3 } } { s ^ { 3 } } + \frac { 1 } { s ^ { 3 } } ( s \hat { v } _ { i } - \hat { l } _ { i } ) + 3 \frac { \hat { l } _ { i } } { s ^ { 3 } } ( s \hat { v } _ { i } - \hat { l } _ { i } ) + 3 \frac { \hat { l } _ { i } ^ { 2 } } { s ^ { 3 } } ( s \hat { v } _ { i } - \hat { l } _ { i } ) = } } \\ { { = \displaystyle \frac { 1 } { s ^ { 3 } } \left[ \hat { v } _ { i } s ( 3 \hat { l } _ { i } ^ { 2 } + 3 \hat { l } _ { i } + 1 ) - \hat { l } _ { i } ( 2 \hat { l } _ { i } ^ { 2 } + 3 \hat { l } _ { i } + 1 ) \right] } } \end{array}
526
+ $$
527
+
528
+ And as before, the bounds are
529
+
530
+ $$
531
+ \frac { \hat { l } _ { i } ^ { 3 } } { s ^ { 3 } } \leq E [ \hat { Q } ( \hat { v } ) _ { i } ^ { 3 } ] \leq \frac { ( \hat { l } _ { i } + 1 ) ^ { 3 } } { s ^ { 3 } }
532
+ $$
533
+
534
+ # B.1 ASYMPTOTIC NORMALITY
535
+
536
+ Most of neural networks operations are scalar product computation. Therefore, the scalar product of the quantized weights and the inputs is an important quantity:
537
+
538
+ $$
539
+ Q ( v ) ^ { T } x = \sum _ { i = 1 } ^ { n } Q ( v _ { i } ) x _ { i }
540
+ $$
541
+
542
+ We already know from section B that the quantization function is unbiased; hence we know that
543
+
544
+ $$
545
+ \sum _ { i = 1 } ^ { n } Q ( v _ { i } ) x _ { i } = \sum _ { i = 1 } ^ { n } v _ { i } x _ { i } + \varepsilon _ { n }
546
+ $$
547
+
548
+ with $\varepsilon _ { n }$ is a zero-mean random variable. We will show that $\varepsilon _ { n }$ tends in distribution to a normal random variable. To prove asymptotic normality, we will use a generalized version of the central limit theorem due to Lyapunov:
549
+
550
+ Theorem B.1 (Lyapunov Central Limit Theorem). Let $\{ X _ { 1 } , X _ { 2 } , \ldots \}$ be a sequence of independent random variables, each with finite expected value $\mu _ { i }$ and variance $\sigma _ { i } ^ { 2 }$ . Define $\begin{array} { r } { s _ { n } ^ { 2 } = \sum _ { i = 1 } ^ { n } \sigma _ { i } ^ { 2 } } \end{array}$ . If, for some $\delta > 0$ , the Lyapunov condition
551
+
552
+ $$
553
+ \operatorname* { l i m } _ { n \to \infty } { \frac { 1 } { s _ { n } ^ { 2 + \delta } } } \sum _ { i = 1 } ^ { n } \operatorname { E } \left[ | X _ { i } - \mu _ { i } | ^ { 2 + \delta } \right] = 0
554
+ $$
555
+
556
+ is satisfied, then
557
+
558
+ $$
559
+ { \frac { 1 } { s _ { n } } } \sum _ { i = 1 } ^ { n } \left( X _ { i } - \mu _ { i } \right) { \overset { D } { \longrightarrow } } \ N ( 0 , 1 )
560
+ $$
561
+
562
+ We can now state the theorem:
563
+
564
+ Theorem B.2. Let $v , x$ be two vectors with n elements. Let $Q$ be the uniform quantization function with s levels defined in 2.1 and define $\begin{array} { r } { s _ { n } ^ { 2 } = \sum _ { i = 1 } ^ { n } V a r [ \dot { Q } ( v _ { i } ) x _ { i } ] } \end{array}$ . If the elements of $v , x$ are uniformly bounded by $M ^ { 3 }$ and $\quad \operatorname* { l i m } _ { n \to \infty } s _ { n } = \infty$ , then
565
+
566
+ $$
567
+ \sum _ { i = 1 } ^ { n } Q ( v _ { i } ) x _ { i } = \sum _ { i = 1 } ^ { n } v _ { i } x _ { i } + \varepsilon _ { n }
568
+ $$
569
+
570
+ with $E [ \varepsilon _ { n } ] = 0$ and
571
+
572
+ $$
573
+ \operatorname* { l i m } _ { n \to \infty } \frac { 1 } { s _ { n } } \varepsilon _ { n } \xrightarrow { D } { \cal N } ( 0 , 1 )
574
+ $$
575
+
576
+ 3i.e. there exists a constant $M$ such that for all $n$ , $| v _ { i } | \leq M$ , $| x _ { i } | \le M$ for all $i \in \{ 1 , \ldots , n \}$
577
+
578
+ Proof. Using the same notation as theorem B.1, let $X _ { i } = Q ( v _ { i } ) x _ { i }$ , $\mu _ { i } = E [ X _ { i } ] = v _ { i } x _ { i }$ . We already mentioned in 2.1 that these are independent random variables. We will show that the Lyapunov condition holds with $\delta = 1$ .
579
+
580
+ We know that
581
+
582
+ $$
583
+ \operatorname { E } \left[ | X _ { i } - \mu _ { i } | ^ { 3 } \right] = \operatorname { E } \left[ ( X _ { i } - \mu _ { i } ) ^ { 2 } | X _ { i } - \mu _ { i } | \right] \leq { \frac { M ^ { 2 } } { s } } \operatorname { E } \left[ ( X _ { i } - \mu _ { i } ) ^ { 2 } \right]
584
+ $$
585
+
586
+ In fact,
587
+
588
+ $$
589
+ \begin{array} { l } { \displaystyle | X _ { i } - \mu _ { i } | = | x _ { i } | | Q ( v _ { i } ) - v _ { i } | = | x _ { i } | \left| \alpha _ { i } \hat { Q } \left( \frac { v _ { i } - \beta _ { i } } { \alpha _ { i } } \right) + \beta _ { i } - v _ { i } \right| \leq } \\ { \leq | x _ { i } | \left| \alpha _ { i } \left( \frac { v _ { i } - \beta _ { i } } { \alpha _ { i } } + \frac { 1 } { s } \right) + \beta _ { i } - v _ { i } \right| \leq } \\ { \leq | x _ { i } | \frac { M } { s } \leq \frac { M ^ { 2 } } { s } } \end{array}
590
+ $$
591
+
592
+ since during quantization we have bins of size $\textstyle { \frac { 1 } { s } }$ , so that is the largest error we can make. Also, by hypothesis $\bar { M } \geq \alpha _ { i } , x _ { i }$ for every $i$ .
593
+
594
+ Hence
595
+
596
+ $$
597
+ 0 \leq { \frac { 1 } { s _ { n } ^ { 3 } } } \sum _ { i = 1 } ^ { n } \operatorname { E } \left[ | X _ { i } - \mu _ { i } | ^ { 3 } \right] \leq { \frac { 1 } { s _ { n } ^ { 3 } } } { \frac { M ^ { 2 } } { s } } \sum _ { i = 1 } ^ { n } \operatorname { E } \left[ ( X _ { i } - \mu _ { i } ) ^ { 2 } ) \right] = { \frac { M ^ { 2 } } { s } } \cdot { \frac { 1 } { s _ { n } } }
598
+ $$
599
+
600
+ and since $\quad \operatorname* { l i m } _ { n \to \infty } s _ { n } = \infty$ , we have that the Lyapunov condition is satisfied. Hence
601
+
602
+ $$
603
+ { \frac { 1 } { s _ { n } } } \sum _ { i = 1 } ^ { n } \left( X _ { i } - \mu _ { i } \right) = { \frac { 1 } { s _ { n } } } \sum _ { i = 1 } ^ { n } \left( Q ( v _ { i } ) x _ { i } - v _ { i } x _ { i } \right) = { \frac { 1 } { s _ { n } } } \varepsilon _ { n } \ { \stackrel { D } { \longrightarrow } } \ N ( 0 , 1 )
604
+ $$
605
+
606
+ Note about the hypothesis The two hypothesis that were used to prove the theorem are reasonable
607
+ and should be satisfied by any practical dataset. Typically we know or we can estimate the range
608
+ of the values of inpuis satisfied. The assu and weights, so the assumption that they don’tption on the variance is also reasonable; in fact, $n$ $\begin{array} { r } { \mathbf { \bar { \Sigma } } ^ { 2 } = \sum _ { i = 1 } ^ { n } \mathbf { \bar { V } } a r [ Q ( v _ { i } ) x _ { i } ] } \end{array}$ $n$ $v _ { i }$
609
+ form $k / s$ , for example, then $s _ { n } ^ { 2 } \ = \ 0 .$ ) it is unlikely that a real world dataset would present this
610
+ characteristic. In fact, it suffices that there exist $\gamma > 0$ and $0 < \delta \leq 1$ such that at least $\bar { \delta }$ -percent of $\sigma _ { i } ^ { 2 } \geq \gamma$ . This implies $s _ { n } ^ { 2 } \geq \delta \gamma n \to \infty$ .
611
+
612
+ Asymptitc normality when quantizing inputs Theorem B.2 can be easily extended to the case when also $x _ { i }$ are quantized. The proof is almost identical; we simply have to set $X _ { i } = Q ( v _ { i } ) Q ( x _ { i } )$ , use the independence of $Q ( x _ { i } )$ and the fact that $Q ( v _ { i } )$ and $| Q ( v _ { i } ) Q ( x _ { i } ) - x _ { i } v _ { i } | \leq M ^ { 2 }$ . For completeness, we report the statement of the theorem :
613
+
614
+ Theorem B.3. Let with s levels define $v , x$ e two vectors .1 and define $Q$ niform quantization. If the elements of tionare $\begin{array} { r } { s _ { n } ^ { 2 } = \sum _ { i = 1 } ^ { n } V a r [ Q ( \dot { v } _ { i } ) Q ( x _ { i } ) ] } \end{array}$ $v , x$ uniformly bounded by $M$ $\quad \operatorname* { l i m } _ { n \to \infty } s _ { n } = \infty$ , then
615
+
616
+ $$
617
+ \sum _ { i = 1 } ^ { n } Q ( v _ { i } ) Q ( x _ { i } ) = \sum _ { i = 1 } ^ { n } v _ { i } x _ { i } + \varepsilon _ { n }
618
+ $$
619
+
620
+ with $E [ \varepsilon _ { n } ] = 0$ and
621
+
622
+ $$
623
+ \operatorname* { l i m } _ { n \to \infty } \frac { 1 } { s _ { n } } \varepsilon _ { n } \xrightarrow { D } { \cal N } ( 0 , 1 )
624
+ $$
md/train/S1g6xeSKDS/S1g6xeSKDS.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/S1gTA5VggE/S1gTA5VggE.md ADDED
@@ -0,0 +1,187 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Boundary loss for highly unbalanced segmentation
2
+
3
+ Hoel Kervadec∗1
4
+ Jihene Bouchtiba∗ 1
5
+ Christian Desrosiers1
6
+ Eric Granger1
7
+ Jose Dolz1
8
+ Ismail Ben Ayed1
9
+ 1 ETS Montreal ´
10
+
11
+ HOEL.KERVADEC.1 $@$ ESTMTL.NET JIHENE.BOUCHTIBA.1 $@$ ENS.ETSMTL.CA CHRISTIAN.DESROSIERS $@$ ETSMTL.CA ERIC.GRANGER $@$ ETSMTL.CA JOSE.DOLZ $@$ ETSMTL.CA ISMAIL.BENAYED $@$ ETSMTL.CA
12
+
13
+ # Abstract
14
+
15
+ Widely used loss functions for convolutional neural network (CNN) segmentation, e.g., Dice or cross-entropy, are based on integrals (summations) over the segmentation regions. Unfortunately, for highly unbalanced segmentations, such regional losses have values that differ considerably – typically of several orders of magnitude – across segmentation classes, which may affect training performance and stability. We propose a boundary loss, which takes the form of a distance metric on the space of contours (or shapes), not regions. This can mitigate the difficulties of regional losses in the context of highly unbalanced segmentation problems because it uses integrals over the boundary (interface) between regions instead of unbalanced integrals over regions. Furthermore, a boundary loss provides information that is complimentary to regional losses. Unfortunately, it is not straightforward to represent the boundary points corresponding to the regional softmax outputs of a CNN. Our boundary loss is inspired by discrete (graph-based) optimization techniques for computing gradient flows of curve evolution. Following an integral approach for computing boundary variations, we express a non-symmetric $L _ { 2 }$ distance on the space of shapes as a regional integral, which avoids completely local differential computations involving contour points. This yields a boundary loss expressed with the regional softmax probability outputs of the network, which can be easily combined with standard regional losses and implemented with any existing deep network architecture for N-D segmentation. We report comprehensive evaluations on two benchmark datasets corresponding to difficult, highly unbalanced problems: the ischemic stroke lesion (ISLES) and white matter hyperintensities (WMH). Used in conjunction with the region-based generalized Dice loss (GDL), our boundary loss improves performance significantly compared to GDL alone, reaching up to $8 \%$ improvement in Dice score and $10 \%$ improvement in Hausdorff score. It also yielded a more stable learning process. Our code is publicly available1.
16
+
17
+ Keywords: Boundary loss, unbalanced data, semantic segmentation, deep learning, CNN
18
+
19
+ # 1. Introduction
20
+
21
+ Recent years have witnessed a substantial growth in the number of deep learning methods for medical image segmentation (Litjens et al., 2017; Shen et al., 2017; Dolz et al., 2018; Ker et al., 2018). Widely used loss functions for segmentation, e.g., Dice or cross-entropy, are based on regional integrals, which are convenient for training deep neural networks. In practice, these regional integrals are summations over the segmentation regions of differentiable functions, each invoking directly the softmax probability outputs of the network. Therefore, standard stochastic optimizers such SGD are directly applicable. Unfortunately, difficulty occurs for highly unbalanced segmentations, for instance, when the size of target foreground region is several orders of magnitude less than the background size. For example, in the characterization of white matter hyperintensities (WMH) of presumed vascular origin, the foreground composed of WMH regions may be 500 times smaller than the background (see the typical example in Fig. 1). In such cases, quite common in medical image analysis, standard regional losses contain foreground and background terms that have substantial differences in their values, typically of several orders of magnitude, which might affect performance and training stability (Milletari et al., 2016; Sudre et al., 2017).
22
+
23
+ ![](images/2a48fa51dcea95008fd4dc8bad4d49863c6b68b7f2a5d1511121865aa15cf990.jpg)
24
+ Figure 1: A visual comparison that shows the positive effect of our boundary loss on a validation data from the WMH dataset. Our boundary loss helped recovering small regions that were otherwise missed by the generalized Dice loss (GDL). Best viewed in colors.
25
+
26
+ Segmentation approaches based on convolutional neural networks (CNN) are typically trained by minimizing the cross-entropy (CE), which measures an affinity between the regions defined by probability softmax outputs of the network and the corresponding ground-truth regions. The standard regional CE has well-known drawbacks in the context of highly unbalanced problems. It assumes identical importance distribution of all the samples and classes. To achieve good generalization, it requires a large training set with balanced classes. For unbalanced data, CE typically results in unstable training and leads to decision boundaries biased towards the majority classes. Class-imbalanced learning aims at mitigating learning bias by promoting the importance of infrequent labels. In medical image segmentation, a common strategy is to re-balance class prior distributions by down-sampling frequent labels (Havaei et al., 2017; Valverde et al., 2017). Nevertheless, this strategy limits the information of the images used for training. Another common practice is to assign weights to the different classes, inversely proportional to the frequency of the corresponding labels (Brosch et al., 2015; Ronneberger et al., 2015; Kamnitsas et al., 2017; Long et al., 2015; Yu et al., 2017). In this scenario, the standard cross-entropy (CE) loss is modified so as to assign more importance to the rare labels. Although effective for some unbalanced problems, such weighting methods may undergo serious difficulties when dealing with highly unbalanced datasets, as seen with WMH segmentation. The CE gradient computed over the few pixels of infrequent labels is typically noisy, and amplifying this noise with a high class weight may lead to instability.
27
+
28
+ The well-known Dice overlap coefficient was also adopted as a regional loss function, typically outperforming CE in unbalanced medical image segmentation problems (Milletari et al., 2016, 2017; Wong et al., 2018). Sudre et al. (Sudre et al., 2017) generalized the Dice loss (Milletari et al., 2016) by weighting according to the inverse of class-label frequency. Despite these improvements over CE (Milletari et al., 2016; Sudre et al., 2017), regional Dice losses may undergo difficulties when dealing with very small structures. In such highly unbalanced scenarios, mis-classified pixels may lead to large decreases of the loss, resulting in unstable optimization. Furthermore, Dice corresponds to the harmonic mean between precision and recall, implicitly using the arithmetic mean of false positives and false negatives. False positives and false negatives are, therefore, equally important when the true positives remain the same, making this loss mainly appropriate when both types of errors are equally bad. The recent research in (Salehi et al., 2017; Abraham and Khan, 2018) investigated losses based on the Tversky similarity index in order to provide a better trade-off between precision and recall. It introduced two parameters that control the importance of false positives and false negatives. Other recent advances in class-imbalanced learning for computer vision problems have been adopted in medical image segmentation. For example, inspired by the concept of focal loss (Lin et al., 2018), Dice and Tvserky losses have been extended to integrate a focal term, which is parameterized by a value that controls the importance between easy and hard training samples (Abraham and Khan, 2018; Wong et al., 2018). The main objective of these losses is to balance the classes not only by their relative class sizes, but also by the level of segmentation difficulty.
29
+
30
+ # Contributions
31
+
32
+ All the above-mentioned losses are region-based. In this paper, we propose a boundary loss that takes the form of a distance metric on the space of contours (or shapes), not regions. We argue that a boundary loss can mitigate the issues related to regional losses in highly unbalanced segmentation problems. Rather than using unbalanced integrals over the regions, a boundary loss uses integrals over the boundary (interface) between the regions. Furthermore, it provides information that is complimentary to regional losses. It is, however, challenging to represent the boundary points corresponding to the regional softmax outputs of a CNN. This difficulty may explain why boundary losses have been avoided in the context of deep segmentation networks. Our boundary loss is inspired by techniques in discrete (graph-based) optimization for computing gradient flows of curve evolution (Boykov et al., 2006). Following an integral approach for computing boundary variations, we express a non-symmetric $L _ { 2 }$ distance on the space of shapes (or contours) as a regional integral, which avoids completely local differential computations involving contour points. This yields a boundary loss expressed as the sum of linear functions of the regional softmax probability outputs of the network. Therefore, it can be easily combined with standard regional losses and implemented with any existing deep network architecture for N-D segmentation.
33
+
34
+ We evaluated our boundary loss in conjunction with the region-based generalized Dice loss (GDL) (Sudre et al., 2017) on two challenging and highly unbalanced segmentation problems – the Ischemic Stroke Lesion (ISLES) and the White Matter Hyperintensities (WMH) benchmark datasets. The results indicate that the proposed boundary loss provides a more stable learning process, and significantly outperforms GDL alone, yielding up to $8 \%$ improvement in Dice score and $10 \%$ improvement in Hausdorff score.
35
+
36
+ # 2. Formulation
37
+
38
+ Let $I : \Omega \subset \mathbb { R } ^ { 2 , 3 } \mathbb { R }$ denotes a training image with spatial domain $\Omega$ , and $g : \Omega \{ 0 , 1 \}$ a binary ground-truth segmentation of the image: $g ( p ) = 1$ if pixel/voxel $p$ belongs to the target region $G \subset \Omega$ (foreground region) and 0 otherwise, i.e., $p \in \Omega \backslash G$ (background region)2. Let $s _ { \theta } : \Omega \to [ 0 , 1 ]$ denotes the softmax probability output of a deep segmentation network, and $S _ { \theta } \subset \Omega$ the corresponding segmentation region: $S _ { \theta } = \{ p \in \Omega | s _ { \theta } ( p ) \geq \delta \}$ for some threshold $\delta$ . Widely used segmentation loss functions involve a regional integral for each segmentation region in $\Omega$ , which measures some similarity (or overlap) between the region defined by the probability outputs of the network and the corresponding ground-truth. In the two-region case, we have an integral of the general form $\textstyle \int _ { \Omega } g ( p ) f ( s _ { \theta } ( p ) ) d p$ for the foreground, and of the form $\begin{array} { r } { \int _ { \Omega } ( 1 - g ( p ) ) f ( 1 - s _ { \theta } ( p ) ) d p } \end{array}$ for the background. For instance, the standard two-region cross-entropy loss corresponds to a summation of these two terms for $f = - \log ( \cdot )$ . Similarly, the generalized Dice loss (GDL) (Sudre et al., 2017) involves regional integrals with $f = 1$ , subject to some normalization, and is given as follows for the two-region case:
39
+
40
+ $$
41
+ \mathcal { L } _ { G D } ( \theta ) = 1 - 2 \frac { w _ { G } \int _ { p \in \Omega } g ( p ) s _ { \theta } ( p ) d p + w _ { B } \int _ { p \in \Omega } ( 1 - g ( p ) ) ( 1 - s _ { \theta } ( p ) ) d p } { w _ { G } \int _ { \Omega } [ s _ { \theta } ( p ) + g ( p ) ] d p + w _ { B } \int _ { \Omega } [ 2 - s _ { \theta } ( p ) - g ( p ) ] d p }
42
+ $$
43
+
44
+ where coefficients $\begin{array} { r } { w _ { G } = 1 / \left( \int _ { p \in \Omega } g ( p ) d p \right) ^ { 2 } } \end{array}$ and $\begin{array} { r } { w _ { B } = 1 / \left( \int _ { \Omega } ( 1 - g ( p ) ) d p \right) ^ { 2 } } \end{array}$ are introduced to reduce the well-known correlation between the Dice overlap and region size.
45
+
46
+ Regional integrals are widely used because they are convenient for training deep segmentation networks. In practice, these regional integrals are summations of differentiable functions, each invoking directly the softmax probability outputs of the network, $s _ { \theta } ( p )$ . Therefore, standard stochastic optimizers such SGD are directly applicable. Unfortunately, extremely unbalanced segmentations are quite common in medical image analysis, where, e.g., the size of the target foreground region is several orders of magnitude smaller than the background size. This represents challenging cases because the foreground and background terms have substantial differences in their values, which affects segmentation performance and training stability (Milletari et al., 2016; Sudre et al., 2017).
47
+
48
+ Our purpose is to build a boundary loss $\mathrm { D i s t } ( \partial G , \partial S _ { \theta } )$ , which takes the form of a distance metric on the space of contours (or region boundaries) in $\Omega$ , with $\partial G$ denoting a representation of the boundary of ground-truth region $G$ (e.g., the set of points of $G$ , which have a spatial neighbor in background $\Omega \setminus G )$ and $\partial S _ { \theta }$ denoting the boundary of the segmentation region defined by the network output. On the one hand, a boundary loss should be able to mitigate the above-mentioned difficulties for unbalanced segmentations: rather than using unbalanced integrals within the regions, it uses integrals over the boundary (interface) between the regions. Furthermore, a boundary loss provides information that is different from and, therefore, complimentary to regional losses. On the other hand, it is not clear how to represent boundary points on $\partial S _ { \theta }$ as a differentiable function of regional network outputs $s _ { \theta }$ . This difficulty might explain why boundary losses have been, to the best of our knowledge, completely avoided in the context of deep segmentation networks.
49
+
50
+ Our boundary loss is inspired from discrete (graph-based) optimization techniques for computing gradient flows of curve evolution (Boykov et al., 2006). Similarly to our problem, curve evolution methods require a measure for evaluating boundary changes (or variations). Consider the following non-symmetric $L _ { 2 }$ distance on the space of shapes, which evaluates the change between two nearby boundaries $\partial S$ and $\partial G$ (Boykov et al., 2006):
51
+
52
+ ![](images/ec0d6d456a507d0cfe419a344315fd31eb4c79903b9c494b438f15dc1b992dfd.jpg)
53
+ Figure 2: The relationship between differential and integral approaches for evaluating boundary change (variation).
54
+
55
+ $$
56
+ \operatorname { D i s t } ( \partial G , \partial S ) = \int _ { \partial G } \| y _ { \partial S } ( p ) - p \| ^ { 2 } d p
57
+ $$
58
+
59
+ where $p \in \Omega$ is a point on boundary $\partial G$ and $y _ { \partial S } ( p )$ denotes the corresponding point on boundary $\partial S$ , along the direction normal to $\partial G$ , i.e., $y _ { \partial S } ( p )$ is the intersection of $\partial S$ and the line that is normal to $\partial G$ at $p$ (See Fig. 2.a for an illustration). $\left. . \right.$ denotes the $L _ { 2 }$ norm. In fact, this differential framework for evaluating boundary change is in line with standard variational curve evolution methods (Mitiche and Ben Ayed, 2011), which compute the motion of each point $p$ on the evolving curve as a velocity along the normal to the curve at point $p$ . Similarly to any contour distance invoking directly points on contour $\partial S$ , expression (2) cannot be used directly as a loss for $\partial S = \partial S _ { \theta }$ . However, it is easy to show that the differential boundary variation in (2) can be expressed using an integral approach (Boykov et al., 2006), which avoids completely local differential computations involving contour points and represents boundary change as a regional integral:
60
+
61
+ $$
62
+ \mathrm { D i s t } ( \partial G , \partial S ) = 2 \int _ { \Delta S } D _ { G } ( q ) d q
63
+ $$
64
+
65
+ where $\Delta S$ denotes the region between the two contours and $D _ { G } : \Omega \to \mathbb { R } ^ { + }$ is a distance map with respect to boundary $\partial G$ , i.e., $D _ { G } ( q )$ evaluates the distance between point $q \in \Omega$ and the nearest point $z _ { \partial G } ( q )$ on contour $\partial G$ : $D _ { G } ( q ) = \lVert q - z _ { \partial G } ( q ) \rVert$ . Fig. 2.b illustrates this integral framework for evaluating the boundary distance in Eq. (2). To show that Eq. (3) holds, it suffices to notice that integrating the distance map $2 D _ { G } ( q )$ over the normal segment connecting a point $p$ on $\partial G$ and $y _ { \partial S } ( \boldsymbol { p } )$ yields $\| y _ { \partial S } ( p ) - p \| ^ { 2 }$ . This follows directly from a variable change:
66
+
67
+ $$
68
+ \int _ { p } ^ { y _ { \partial S } ( p ) } 2 D _ { G } ( q ) d q = \int _ { 0 } ^ { \| y _ { \partial S } ( p ) - p \| } 2 D _ { G } d D _ { G } = \| y _ { \partial S } ( p ) - p \| ^ { 2 }
69
+ $$
70
+
71
+ Thus, from Eq. (3), the non-symmetric $L _ { 2 }$ distance between contours in Eq. (2) can be expressed as a sum of regional integrals based on a level set representation of boundary $\partial G$ :
72
+
73
+ $$
74
+ \frac 1 2 \mathrm { D i s t } ( \partial G , \partial S ) = \int _ { S } \phi _ { G } ( q ) d q - \int _ { G } \phi _ { G } ( q ) d q = \int _ { \Omega } \phi _ { G } ( q ) s ( q ) d q - \int _ { \Omega } \phi _ { G } ( q ) g ( q ) d q
75
+ $$
76
+
77
+ where $s : \Omega \to \{ 0 , 1 \}$ is binary indicator function of region S: $s ( q ) = 1$ if $q \in S$ belongs to the target and 0 otherwise. $\phi _ { G } : \Omega \to \mathbb { R }$ denotes the level set representation of boundary $\partial G$ : $\phi _ { G } ( q ) = - D _ { G } ( q )$ if $q \in G$ and $\phi _ { G } ( q ) = D _ { G } ( q )$ otherwise. Now, for $S = S _ { \theta }$ , i.e., replacing binary variables $s ( q )$ in Eq. (4) by the softmax probability outputs of the network $s _ { \theta } ( q )$ , we obtain the following boundary loss which, up to a constant independent of $\theta$ , approximates boundary distance $\mathrm { D i s t } ( \partial G , \partial S _ { \theta } )$ :
78
+
79
+ $$
80
+ \mathcal { L } _ { B } ( \theta ) = \int _ { \Omega } \phi _ { G } ( q ) s _ { \theta } ( q ) d q
81
+ $$
82
+
83
+ Notice that we omitted the last term in Eq. (4) as it is independent of network parameters. The level set function $\phi _ { G }$ is pre-computed directly from the ground-truth region $G$ . In practice, our boundary loss in Eq. (5) is the sum of linear functions of the regional softmax probability outputs of the network. Therefore, it can be easily combined with standard regional losses and implemented with any existing deep network architecture for N-D segmentation. In the experiments, we will use our boundary loss in conjunction with the regional generalized Dice loss:
84
+
85
+ $$
86
+ \alpha \mathcal { L } _ { G D } ( \pmb { \theta } ) + ( 1 - \alpha ) \mathcal { L } _ { B } ( \pmb { \theta } )
87
+ $$
88
+
89
+ Finally, it is worth noting that our boundary loss uses ground-truth boundary information via precomputed level-set function $\phi _ { G } ( q )$ , which encodes the distance between each point $q$ and $\partial G$ . In Eq. (5), the softmax for each point $q$ is weighted by the distance function. Such distance-to-boundary information is omitted in widely used regional losses, where all the points within a given region are treated equally, independently of their distances from the boundary.
90
+
91
+ # 3. Experiments
92
+
93
+ # 3.1. Datasets
94
+
95
+ To evaluate the proposed boundary loss, we selected two challenging brain lesion segmentation tasks, each corresponding to highly unbalanced classes.
96
+
97
+ ISLES: The training dataset provided by the ISLES organizers is composed of 94 ischemic stroke lesion multi-modal scans. In our experiments, we split this dataset into training and validation sets containing 74 and 20 examples, respectively. Each scan contains Diffusion maps (DWI) and Perfusion maps (CBF, MTT, CBV, Tmax and CTP source data), as well as the manual ground-truth segmentation. More details can be found in the ISLES website3.
98
+
99
+ WMH: The public dataset of the White Matter Hyperintensities $\mathrm { ( W M H ) ^ { 4 } }$ MICCAI 2017 challenge contains 60 3D T1-weighted scans and 2D multi-slice FLAIR acquired from multiple vendors and scanners in three different hospitals. In addition, the ground truth for the 60 scans is provided. From the whole set, 50 scans were used for training, and the remaining 10 for validation.
100
+
101
+ # 3.2. Implementation details
102
+
103
+ Data pre-processing. While the scans are provided as 3D images, we process them as a stack of independent 2D images, which are fed into the network. In fact, the scans in some datasets, such as ISLES, contain between 2 and 16 slices, making them ill-suited for 3D convolutions in those cases. The scans were normalized between 0 and 1 before being saved as a set of 2D matrices, and re-scaled to $2 5 6 \times 2 5 6$ pixels if needed. When several modalities were available, all of them were concatenated before being used as input to the network. We did not use any data augmentation in our experiments.
104
+
105
+ Architecture and training. We employed UNet (Ronneberger et al., 2015) as deep learning architecture in our experiments. To train our model, we employed Adam optimizer, with a learning rate of 0.001 and a batch size equal to 8. The learning rate is halved if the validation performances do not improve during 20 epochs. We did not use early stopping.
106
+
107
+ To compute the level set function $\phi _ { G }$ in Eq. (5), we used standard SciPy functions5. Note that, for slices containing only the background region, we used a zero-distance map, assuming that the GDL is sufficient in those cases. Furthermore, during training, the value of $\alpha$ in Eq. (6) was initially set to 1, and decreased by 0.01 after each epoch, following a simple scheduling strategy, until it reached the value of 0.01. In this way, we give more importance to the regional loss term at the beginning while gradually increasing the impact of the boundary loss term. We empirically found that this simple scheduling strategy was less sensitive to the choice of $\alpha$ while giving consistently similar or better results than a constant value. In addition, we evaluated the performance when the boundary loss is the only objective, i.e., $\alpha = 0$ .
108
+
109
+ For our implementation, we used PyTorch (Paszke et al., 2017), and ran the experiments on a machine equipped with an NVIDIA GTX 1080 Ti GPU with 11GBs of memory. Our code (data pre-processing, training and testing scripts) is publicly available6.
110
+
111
+ Evaluation. For evaluation purposes, we employ the common Dice Similarity Coefficient (DSC) and Hausdorff Distance (HD) metrics.
112
+
113
+ # 3.3. Results
114
+
115
+ Quantative evaluation. Table 1 reports the DSC and HD performance for our experiments using GDL alone and the loss we proposed in Eq. (6) on the ISLES and WMH datasets. Adding our boundary loss term to the GDL consistently improves segmentation performance, which is reflected in significantly higher DSC and HD values. While this boundary loss term brings a DSC improvement of around $2 \%$ on the WMH dataset, it achieves $8 \%$ better DSC on the ISLES segmentation task. The same trend is observed with the HD metric, where the gain is larger on the ISLES dataset than on WMH.
116
+
117
+ Using the boundary loss alone does not yield the same competitive results as a joint loss (i.e., boundary and region), making the network collapse quickly into empty foreground regions, i.e., softmax predictions close to zero7. We believe that this is due to the following technical facts. In theory, the global optimum of the boundary loss corresponds to a negative value, as a perfect overlap sums only over the negative values of the distance map. In this case, the softmax probabilities correspond to a non-empty foreground. However, an empty foreground (null values of the softmax probabilities almost everywhere) corresponds to low gradients. Therefore, this trivial solution is close a local minimum or a saddle point. This is not the case when we use our boundary loss in conjunction with a regional loss, which guides the training during the first epochs and avoids getting stuck in such a trivial solution. The scheduling method then increases the weight of the boundary loss, with the latter becoming very dominant towards the end of the training process. This behaviour of boundary terms is conceptually similar to the behaviour of classical and popular contour-based energies for level set segmentation, e.g., geodesic active contours (Caselles et al., 1997), which also require additional regional terms to avoid trivial solutions (i.e., empty foreground regions).
118
+
119
+ Table 1: DSC and HD values achieved on the validation subset. The values represent the mean performance (and standard deviation) of 2 runs for each setting.
120
+
121
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=2>ISLES</td><td rowspan=1 colspan=2>WMH</td></tr><tr><td rowspan=1 colspan=1>Loss</td><td rowspan=1 colspan=1>DSC</td><td rowspan=1 colspan=1>HD (mm)</td><td rowspan=1 colspan=1>DSC</td><td rowspan=1 colspan=1>HD (mm)</td></tr><tr><td rowspan=1 colspan=1>LBLGDLGD+LB</td><td rowspan=1 colspan=1>0.321 (0.000)0.575 (0.028)0.656 (0.023)</td><td rowspan=1 colspan=1>NA4.009 (0.016)3.562 (0.009)</td><td rowspan=1 colspan=1>0.569 (0.000)0.727 (0.006)0.748 (0.005)</td><td rowspan=1 colspan=1>NA1.045 (0.014)0.987 (0.010)</td></tr></table>
122
+
123
+ ![](images/df65998fc01872601173f996a54b0cadddc2f4bcfe0c457dd8060b49d32c5d9a.jpg)
124
+ Figure 3: Evolution of DSC and HD values on the validation subset when training on ISLES and WMH dataset. The blue curve shows the performance of the network trained using the GDL loss, while the red curve represents the optimization process with the GDL $^ +$ our proposed boundary loss term.
125
+
126
+ The learning curves depicted in Figure 3 show the gap in performance between the GDL alone and the GDL augmented with our boundary loss, with the difference becoming significant at convergence. In addition to outperforming GDL, we can also observe that the boundary loss term helps stabilizing the training process, yielding a much smoother curve as the network training converges. This behaviour is consistent for both metrics and both dataset, which clearly shows the benefits of employing the proposed boundary loss term.
127
+
128
+ Qualitative evaluation. Qualitative results are depicted in Fig. 4. Inspecting these results visually, we can observe that there are two major types of improvements when employing the proposed boundary loss. First, as the methods based on DSC losses, such as GDL, do not use spatial information, prediction errors are treated equally. This means that the errors for pixels/voxels in an already detected object have the same importance as the errors produced in completely missed objects. On the contrary, as our boundary loss is based on the distance map from the ground-truth boundary $\partial G$ , it will penalize much more such cases, helping to recover small and far regions. This effect is best illustrated in Fig. 1 and Fig. 4 (third row). False positives (first row in Fig. 4) will be far away from the closest foreground, getting a much higher penalty than with the GDL alone. This helps in reducing the number of false positives.
129
+
130
+ Computational complexity. It is worth mentioning that, as the proposed boundary loss term involves an element-wise product between two matrices – i.e., the pre-computed level-set function $\phi _ { G }$ and the softmax output $s _ { \theta } ( p )$ – the complexity that it adds is negligible.
131
+
132
+ # 4. Conclusion
133
+
134
+ We proposed a boundary loss term that can be easily combined with standard regional losses to tackle the segmentation task in highly unbalanced scenarios. Furthermore, the proposed term can be implemented in any existing deep network architecture and for any N-D segmentation problem. Our experiments on two challenging and highly unbalanced datasets demonstrated the effectiveness of including the proposed boundary loss term during training. It consistently improved the performance, with a large margin on one data set, and enhanced training stability. Even though we limited the experiments to 2-D segmentation problems, the proposed framework can be trivially extended to 3-D, which could further improve the performance of deep networks, as more context is analyzed.
135
+
136
+ # Acknowledgments
137
+
138
+ This work is supported by the National Science and Engineering Research Council of Canada (NSERC), discovery grant program, and by the ETS Research Chair on Artificial Intelligence in Medical Imaging.
139
+
140
+ # References
141
+
142
+ Nabila Abraham and Naimul Mefraz Khan. A novel focal tversky loss function with improved attention U-Net for lesion segmentation. arXiv preprint arXiv:1810.07842, 2018.
143
+
144
+ Yuri Boykov, Vladimir Kolmogorov, Daniel Cremers, and Andrew Delong. An integral solution to surface evolution PDEs via geo-cuts. In European Conference on Computer Vision, pages 409–422. Springer, 2006.
145
+
146
+ ![](images/7f06939b1f0e9ac7dd54f77969bc4e17e000e3ae97af8a2c69c73511e0dc99ee.jpg)
147
+ Figure 4: Visual comparison on two different datasets from the validation set.
148
+
149
+ Tom Brosch, Youngjin Yoo, Lisa YW Tang, David KB Li, Anthony Traboulsee, and Roger Tam. Deep convolutional encoder networks for multiple sclerosis lesion segmentation. In International Conference on Medical Image Computing and Computer-Assisted Intervention, pages $3 -$ 11. Springer, 2015.
150
+
151
+ V. Caselles, R. Kimmel, and G. Sapiro. Geodesic active contours. International Journal of Computer Vision, 22:61–79, 1997.
152
+
153
+ Jose Dolz, Christian Desrosiers, and Ismail Ben Ayed. 3D fully convolutional networks for subcortical segmentation in MRI: A large-scale study. NeuroImage, 170:456–470, 2018.
154
+
155
+ Mohammad Havaei, Axel Davy, David Warde-Farley, Antoine Biard, Aaron Courville, Yoshua Bengio, Chris Pal, Pierre-Marc Jodoin, and Hugo Larochelle. Brain tumor segmentation with deep neural networks. Medical image analysis, 35:18–31, 2017.
156
+
157
+ Konstantinos Kamnitsas, Christian Ledig, Virginia FJ Newcombe, Joanna P Simpson, Andrew D Kane, David K Menon, Daniel Rueckert, and Ben Glocker. Efficient multi-scale 3D CNN with fully connected CRF for accurate brain lesion segmentation. Medical image analysis, 36:61–78, 2017.
158
+
159
+ Justin Ker, Lipo Wang, Jai Rao, and Tchoyoson Lim. Deep learning applications in medical image analysis. IEEE Access, 6:9375–9389, 2018.
160
+
161
+ Tsung-Yi Lin, Priyal Goyal, Ross Girshick, Kaiming He, and Piotr Dollar. Focal loss for dense ´ object detection. IEEE transactions on pattern analysis and machine intelligence, 2018.
162
+
163
+ Geert Litjens, Thijs Kooi, Babak Ehteshami Bejnordi, Arnaud Arindra Adiyoso Setio, Francesco Ciompi, Mohsen Ghafoorian, Jeroen Awm Van Der Laak, Bram Van Ginneken, and Clara I Sanchez. A survey on deep learning in medical image analysis. ´ Medical image analysis, 42: 60–88, 2017.
164
+
165
+ Jonathan Long, Evan Shelhamer, and Trevor Darrell. Fully convolutional networks for semantic segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 3431–3440, 2015.
166
+
167
+ Fausto Milletari, Nassir Navab, and Seyed-Ahmad Ahmadi. V-Net: Fully convolutional neural networks for volumetric medical image segmentation. In 3D Vision (3DV), 2016 Fourth International Conference on, pages 565–571. IEEE, 2016.
168
+
169
+ Fausto Milletari, Seyed-Ahmad Ahmadi, Christine Kroll, Annika Plate, Verena Rozanski, Juliana Maiostre, Johannes Levin, Olaf Dietrich, Birgit Ertl-Wagner, Kai Botzel, et al. Hough-CNN: ¨ deep learning for segmentation of deep brain regions in MRI and ultrasound. Computer Vision and Image Understanding, 164:92–102, 2017.
170
+
171
+ Amar Mitiche and Ismail Ben Ayed. Variational and level set methods in image segmentation. Springer, 2011.
172
+
173
+ Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan, Edward Yang, Zachary DeVito, Zeming Lin, Alban Desmaison, Luca Antiga, and Adam Lerer. Automatic differentiation in pytorch. In NIPS 2017 Workshop Autodiff Submission, 2017.
174
+
175
+ Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-Net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computerassisted intervention, pages 234–241. Springer, 2015.
176
+
177
+ Seyed Sadegh Mohseni Salehi, Deniz Erdogmus, and Ali Gholipour. Tversky loss function for image segmentation using 3D fully convolutional deep networks. In International Workshop on Machine Learning in Medical Imaging, pages 379–387. Springer, 2017.
178
+
179
+ Dinggang Shen, Guorong Wu, and Heung-Il Suk. Deep learning in medical image analysis. Annual review of biomedical engineering, 19:221–248, 2017.
180
+
181
+ Carole H Sudre, Wenqi Li, Tom Vercauteren, Sebastien Ourselin, and M Jorge Cardoso. Generalised dice overlap as a deep learning loss function for highly unbalanced segmentations. In Deep Learning in Medical Image Analysis and Multimodal Learning for Clinical Decision Support, pages 240–248. Springer, 2017.
182
+
183
+ Sergi Valverde, Mariano Cabezas, Eloy Roura, Sandra Gonzalez-Vill ´ a, Deborah Pareto, Joan C \` Vilanova, Lluis Ramio-Torrenta, Alex Rovira, Arnau Oliver, and Xavier Llad \` o. Improving auto- ´ mated multiple sclerosis lesion segmentation with a cascaded 3D convolutional neural network approach. NeuroImage, 155:159–168, 2017.
184
+
185
+ Ken CL Wong, Mehdi Moradi, Hui Tang, and Tanveer Syeda-Mahmood. 3D segmentation with exponential logarithmic loss for highly unbalanced object sizes. In International Conference on Medical Image Computing and Computer-Assisted Intervention, pages 612–619. Springer, 2018.
186
+
187
+ Lequan Yu, Xin Yang, Hao Chen, Jing Qin, and Pheng-Ann Heng. Volumetric convnets with mixed residual connections for automated prostate segmentation from 3D MR images. In AAAI, pages 66–72, 2017.
md/train/S1nQvfgA-/S1nQvfgA-.md ADDED
@@ -0,0 +1,361 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SEMANTICALLY DECOMPOSING THE LATENT SPACES OF GENERATIVE ADVERSARIAL NETWORKS
2
+
3
+ Chris Donahue
4
+ Department of Music
5
+ University of California, San Diego
6
+ cdonahue@ucsd.edu
7
+
8
+ Zachary C. Lipton Carnegie Mellon University Amazon AI zlipton@cmu.edu
9
+
10
+ Akshay Balsubramani Department of Genetics Stanford University abalsubr@stanford.edu
11
+
12
+ Julian McAuley Department of Computer Science University of California, San Diego jmcauley@eng.ucsd.edu
13
+
14
+ # ABSTRACT
15
+
16
+ We propose a new algorithm for training generative adversarial networks that jointly learns latent codes for both identities (e.g. individual humans) and observations (e.g. specific photographs). By fixing the identity portion of the latent codes, we can generate diverse images of the same subject, and by fixing the observation portion, we can traverse the manifold of subjects while maintaining contingent aspects such as lighting and pose. Our algorithm features a pairwise training scheme in which each sample from the generator consists of two images with a common identity code. Corresponding samples from the real dataset consist of two distinct photographs of the same subject. In order to fool the discriminator, the generator must produce pairs that are photorealistic, distinct, and appear to depict the same individual. We augment both the DCGAN and BEGAN approaches with Siamese discriminators to facilitate pairwise training. Experiments with human judges and an off-the-shelf face verification system demonstrate our algorithm’s ability to generate convincing, identity-matched photographs.
17
+
18
+ # 1 INTRODUCTION
19
+
20
+ In many domains, a suitable generative process might consist of several stages. To generate a photograph of a product, we might wish to first sample from the space of products, and then from the space of photographs of that product. Given such disentangled representations in a multistage generative process, an online retailer might diversify its catalog, depicting products in a wider variety of settings. A retailer could also flip the process, imagining new products in a fixed setting. Datasets for such domains often contain many labeled identities with fewer observations of each (e.g. a collection of face portraits with thousands of people and ten photos of each). While we may know the identity of the subject in each photograph, we may not know the contingent aspects of the observation (such as lighting, pose and background). This kind of data is ubiquitous; given a set of commonalities, we might want to incorporate this structure into our latent representations.
21
+
22
+ Generative adversarial networks (GANs) learn mappings from latent codes $\mathbf { z }$ in some low-dimensional space $\mathcal { Z }$ to points in the space of natural data $\mathcal { X }$ (Goodfellow et al., 2014). They achieve this power through an adversarial training scheme pitting a generative model $G : { \mathcal { Z } } \mapsto { \mathcal { X } }$ against a discriminative model $D : \mathcal { X } \mapsto [ 0 , 1 ]$ in a minimax game. While GANs are popular, owing to their ability to generate high-fidelity images, they do not, in their original form, explicitly disentangle the latent factors according to known commonalities.
23
+
24
+ In this paper, we propose Semantically Decomposed GANs (SD-GANs), which encourage a specified portion of the latent space to correspond to a known source of variation.1,2 The technique decomposes the latent code $\mathcal { Z }$ into one portion $\mathcal { Z } _ { I }$ corresponding to identity, and the remaining portion $\mathcal { Z } _ { O }$ corresponding to the other contingent aspects of observations. SD-GANs learn through a pairwise training scheme in which each sample from the real dataset consists of two distinct images with a common identity. Each sample from the generator consists of a pair of images with common ${ \mathbf z } _ { I } \in { \mathcal { Z } } _ { I }$ but differing $\mathbf { z } _ { O } \in \mathcal { Z } _ { O }$ . In order to fool the discriminator, the generator must not only produce diverse and photorealistic images, but also images that depict the same identity when $\mathbf { z } _ { I }$ is fixed. For SD-GANs, we modify the discriminator so that it can determine whether a pair of samples constitutes a match.
25
+
26
+ ![](images/2dd6fcadaf93908c076e7f18fd79904f206d08f1e79c670981bb38945ead5358.jpg)
27
+ Figure 1: Generated samples from SD-BEGAN. Each of the four rows has the same identity code $\mathbf { z } _ { I }$ and each of the fourteen columns has the same observation code $\mathbf { z } _ { O }$ .
28
+
29
+ As a case study, we experiment with a dataset of face photographs, demonstrating that SD-GANs can generate contrasting images of the same subject (Figure 1; interactive web demo in footnote on previous page). The generator learns that certain properties are free to vary across observations but not identity. For example, SD-GANs learn that pose, facial expression, hirsuteness, grayscale vs. color, and lighting can all vary across different photographs of the same individual. On the other hand, the aspects that are more salient for facial verification remain consistent as we vary the observation code $\mathbf { z } _ { O }$ . We also train SD-GANs on a dataset of product images, containing multiple photographs of each product from various perspectives (Figure 4).
30
+
31
+ We demonstrate that SD-GANs trained on faces generate stylistically-contrasting, identity-matched image pairs that human annotators and a state-of-the-art face verification algorithm recognize as depicting the same subject. On measures of identity coherence and image diversity, SD-GANs perform comparably to a recent conditional GAN method (Odena et al., 2017); SD-GANs can also imagine new identities, while conditional GANs are limited to generating existing identities from the training data.
32
+
33
+ # 2 SEMANTICALLY DECOMPOSED GENERATIVE ADVERSARIAL NETWORKS
34
+
35
+ Before introducing our algorithm, we briefly review the prerequisite concepts.
36
+
37
+ # 2.1 GAN PRELIMINARIES
38
+
39
+ GANs leverage the discriminative power of neural networks to learn generative models. The generative model $G$ ingests latent codes $\mathbf { z }$ , sampled from some known prior $P z$ , and produces $G ( \mathbf { z } )$ , a sample of an implicit distribution $P _ { G }$ . The learning process consists of a minimax game between $G$ , parameterized by $\theta _ { G }$ , and a discriminative model $D$ , parameterized by $\theta _ { D }$ . In the original formulation, the discriminative model tries to maximize log likelihood, yielding
40
+
41
+ $$
42
+ \displaystyle \operatorname* { m i n } _ { G } \operatorname* { m a x } _ { D } V ( G , D ) = \mathbb { E } _ { \mathbf { x } \sim P _ { R } } [ \log D ( \mathbf { x } ) ] + \mathbb { E } _ { \mathbf { z } \sim P _ { \mathcal { Z } } } [ \log ( 1 - D ( G ( \mathbf { z } ) ) ) ] .
43
+ $$
44
+
45
+ Training proceeds as follows: For $k$ iterations, sample one minibatch from the real distribution $P _ { R }$ and one from the distribution of generated images $P _ { G }$ , updating discriminator weights $\theta _ { D }$ to increase $V ( G , D )$ by stochastic gradient ascent. Then sample a minibatch from $P z$ , updating $\theta _ { G }$ to decrease $V ( G , D )$ by stochastic gradient descent.
46
+
47
+ Algorithm 1 Semantically Decomposed GAN Training
48
+
49
+ <table><tr><td>1: forn in 1:NumberOfIterations do</td><td></td></tr><tr><td>2:</td><td>for m in 1:MinibatchSize do</td></tr><tr><td>3:</td><td>Sample one identity vector z1 ~ Uniform([-1,1]d1).</td></tr><tr><td>4:</td><td>Sample two observation vectors z1,z² ~ Uniform([-1,1]do).</td></tr><tr><td>5:</td><td>z1 ←[z1;z],z² ←[z1;z²].</td></tr><tr><td>6:</td><td>Generate pair of images G(z1), G(z2),adding them to the minibatch with label O (fake).</td></tr><tr><td>7:</td><td>formin1:MinibatchSize do</td></tr><tr><td>8:</td><td>Sample one identity i E I uniformly at random from the real data set.</td></tr><tr><td>9:</td><td>Sample two images of i without replacement X1,X2 ~ PR(x|I = i).</td></tr><tr><td>10:</td><td>Add the pair to the minibatch,assigning label 1 (real).</td></tr><tr><td>11:</td><td>Update discriminator weights by 0D ← 0D + VθD V(G,D) using its stochastic gradient.</td></tr><tr><td>12:</td><td>Sample another minibatch of identity-matched latent vectors z1, z².</td></tr><tr><td>13:</td><td>Update generator weights by stochastic gradient descent 0G ← 0g - VθgV(G,D).</td></tr></table>
50
+
51
+ Zhao et al. (2017b) propose energy-based GANs (EBGANs), in which the discriminator can be viewed as an energy function. Specifically, they devise a discriminator consisting of an autoencoder: $D ( \mathbf { x } ) = D _ { d } ( D _ { e } ( \mathbf { \bar { x } } ) )$ . In the minimax game, the discriminator’s weights are updated to minimize the reconstruction error $\mathcal { L } ( \mathbf { x } ) = | | \mathbf { x } - \mathbf { \bar { \Lambda } } D ( \mathbf { x } ) | |$ for real data, while maximizing the error ${ \mathcal { L } } ( G ( \mathbf { z } ) )$ for the generator. More recently, Berthelot et al. (2017) extend this work, introducing Boundary Equilibrium GANs (BEGANs), which optimize the Wasserstein distance (reminiscent of Wasserstein GANs (Arjovsky et al., 2017)) between autoencoder loss distributions, yielding the formulation:
52
+
53
+ $$
54
+ V _ { B E G A N } ( G , D ) = \mathcal { L } ( \mathbf { x } ) - \mathcal { L } ( G ( \mathbf { z } ) ) .
55
+ $$
56
+
57
+ Additionally, they introduce a method for stabilizing training. Positing that training becomes unstable when the discriminator cannot distinguish between real and generated images, they introduce a new hyperparameter $\gamma$ , updating the value function on each iteration to maintain a desired ratio between the two reconstruction errors: $\mathbb { E } [ \mathcal { L } ( G ( \mathbf { z } ) ) ] = \gamma \mathbb { E } [ \mathcal { L } ( \mathbf { x } ) ]$ . The BEGAN model produces what appear to us, subjectively, to be the sharpest images of faces yet generated by a GAN. In this work, we adapt both the DCGAN (Radford et al., 2016) and BEGAN algorithms to the SD-GAN training scheme.
58
+
59
+ # 2.2 SD-GAN FORMULATION
60
+
61
+ Consider the data’s identity as a random variable $I$ in a discrete index set $\mathcal { T }$ . We seek to learn a latent representation that conveniently decomposes the variation in the real data into two parts: 1) due to $I$ , and 2) due to the other factors of variation in the data, packaged as a random variable $O$ . Ideally, the decomposition of the variation in the data into $I$ and $O$ should correspond exactly to a decomposition of the latent space $\mathcal { Z } = \mathcal { Z } _ { I } \times \mathcal { Z } _ { O }$ . This would permit convenient interpolation and other operations on the inferred subspaces $\mathcal { Z } _ { I }$ and ${ \mathcal { Z } } _ { O }$ .
62
+
63
+ A conventional GAN samples $I , O$ from their joint distribution. Such a GAN’s generative model samples directly from an unstructured prior over the latent space. It does not disentangle the variation in $O$ and $I$ , for instance by modeling conditional distributions $P _ { G } ( O \mid I = i )$ , but only models their average with respect to the prior on $I$ .
64
+
65
+ Our SD-GAN method learns such a latent space decomposition, partitioning the coordinates of $\mathcal { Z }$ into two parts representing the subspaces, so that any $\mathbf { z } \in { \mathcal { Z } }$ can be written as the concatenation $[ { \bf z } _ { I } ; { \bf z } _ { O } ]$ of its identity representation ${ \bf z } _ { I } \in \mathbb { R } ^ { d _ { I } } = { \bf \dot { \mathcal { Z } } } _ { I }$ and its contingent aspect representation $\mathbf { z } _ { O } \in \mathbb { R } ^ { d _ { O } } = \mathcal { Z } _ { O }$ . SD-GANs achieve this through a pairwise training scheme in which each sample from the real data consists of $\mathbf { x } _ { 1 } , \mathbf { x } _ { 2 } \sim P _ { R } ( \mathbf { x } \mid I = i )$ , a pair of images with a common identity $i \in \mathcal { T }$ Each sample from the generator consists of $G ( \mathbf { z } _ { 1 } ) , G ( \mathbf { z } _ { 2 } ) \sim P _ { G } ( \mathbf { z } \mid \mathcal { Z } _ { I } = \mathbf { z } _ { I } )$ , a pair of images generated from a common identity vector $\mathbf { z } _ { I } \in \mathcal { Z } _ { I }$ but i.i.d. observation vectors $\mathbf { z } _ { O } ^ { 1 } , \mathbf { \hat { z } } _ { O } ^ { 2 } \in \mathcal { Z } _ { O }$ . We assign identity-matched pairs from $P _ { R }$ the label 1 and $\mathbf { z } _ { I }$ -matched pairs from $P _ { G }$ the label 0. The discriminator can thus learn to reject pairs for either of two primary reasons: 1) not photorealistic or 2) not plausibly depicting the same subject. See Algorithm 1 for SD-GAN training pseudocode.
66
+
67
+ ![](images/e7aeb91737550933ffc53c52c789b5005f60a6a6f6e191c7d633a4dcf1d51bf5.jpg)
68
+ Figure 2: SD-GAN architectures and vanilla counterparts. Our SD-GAN models incorporate a decomposed latent space and Siamese discriminators. Dashed lines indicate shared weights. Discriminators also observe real samples in addition to those from the generator (not pictured for simplicity).
69
+
70
+ # 2.3 SD-GAN DISCRIMINATOR ARCHITECTURE
71
+
72
+ With SD-GANs, there is no need to alter the architecture of the generator. However, the discriminator must now act upon two images, producing a single output. Moreover, the effects of the two input images $\mathbf { x } _ { 1 } , \mathbf { x } _ { 2 }$ on the output score are not independent. Two images might be otherwise photorealistic but deserve rejection because they clearly depict different identities. To this end, we devise two novel discriminator architectures to adapt DCGAN and BEGAN respectively. In both cases, we first separately encode each image using the same convolutional neural network $D _ { e }$ (Figure 2). We choose this Siamese setup (Bromley, 1994; Chopra et al., 2005) as our problem is symmetrical in the images, and thus it’s sensible to share weights between the encoders.
73
+
74
+ To adapt DCGAN, we stack the feature maps $D _ { e } ( \mathbf { x } _ { 1 } )$ and $D _ { e } ( { \bf x } _ { 2 } )$ along the channel axis, applying one additional strided convolution. This allows the network to further aggregate information from the two images before flattening and fully connecting to a sigmoid output. For BEGAN, because the discriminator is an autoencoder, our architecture is more complicated. After encoding each image, we concatenate the representations $[ D _ { e } ( \mathbf { x } _ { 1 } ) ; D _ { e } ( \mathbf { x } _ { 2 } ) ] \in \mathbb { R } ^ { 2 ( d _ { I } + d _ { O } ) }$ and apply one fully connected bottleneck layer $\mathbb { R } ^ { 2 ( d _ { I } + d _ { O } ) } \Rightarrow \mathbb { R } ^ { d _ { I } + 2 d _ { O } }$ with linear activation. In alignment with BEGAN, the SD-BEGAN bottleneck has the same dimensionality as the tuple of latent codes $( \mathbf { z } _ { I } , \mathbf { z } _ { O } ^ { 1 } , \mathbf { z } _ { O } ^ { 2 } )$ that generated the pair of images. Following the bottleneck, we apply a second FC layer $\bar { \mathbb { R } ^ { d _ { I } + 2 d _ { O } } } \Rightarrow$ $\bar { \mathbb { R } } ^ { 2 ( d _ { I } + d _ { O } ) }$ , taking the first $d _ { I } + d _ { O }$ components of its output to be the input to the first decoder and the second $d _ { I } + d _ { O }$ components to be the input to the second decoder. The shared intermediate layer gives SD-BEGAN a mechanism to push apart matched and unmatched pairs. We specify our exact architectures in full detail in Appendix E.
75
+
76
+ # 3 EXPERIMENTS
77
+
78
+ We experimentally validate SD-GANs using two datasets: 1) the MS-Celeb-1M dataset of celebrity face images (Guo et al., 2016) and 2) a dataset of shoe images collected from Amazon (McAuley et al., 2015). Both datasets contain a large number of identities (people and shoes, respectively) with multiple observations of each. The “in-the-wild” nature of the celebrity face images offers a richer test bed for our method as both identities and contingent factors are significant sources of variation. In contrast, Amazon’s shoe images tend to vary only with camera perspective for a given product, making this data useful for sanity-checking our approach.
79
+
80
+ Faces From the aligned face images in the MS-Celeb-1M dataset, we select 12,500 celebrities at random and 8 associated images of each, resizing them to 64x64 pixels. We split the celebrities into subsets of 10,000 (training), 1,250 (validation) and 1,250 (test). The dataset has a small number of duplicate images and some label noise (images matched to the wrong celebrity). We detect and remove duplicates by hashing the images, but we do not rid the data of label noise. We scale the pixel values to $[ - 1 , 1 ]$ , performing no additional preprocessing or data augmentation.
81
+
82
+ ![](images/4914d1abf21b41bb2852e82f6cf6ae7fa534b9d437c85750abefbc79d4d14ee9.jpg)
83
+ Figure 3: Generated samples from SD-DCGAN model trained on faces.
84
+
85
+ ![](images/9c5eb0e0c4a59ac596f47c60e88481f496ac960155252d7d79fa2bd78bdd2b7c.jpg)
86
+ Figure 4: Generated samples from SD-DCGAN model trained on shoes.
87
+
88
+ Shoes Synthesizing novel product images is another promising domain for our method. In our shoes dataset, product photographs are captured against white backgrounds and primarily differ in orientation and distance. Accordingly, we expect that SD-GAN training will allocate the observation latent space to capture these aspects. We choose to study shoes as a prototypical example of a category of product images. The Amazon dataset contains around 3,000 unique products with the category “Shoe” and multiple product images. We use the same $8 0 \%$ , $1 0 \%$ , $1 0 \%$ split and again hash the images to ensure that the splits are disjoint. There are 6.2 photos of each product on average.
89
+
90
+ # 3.1 TRAINING DETAILS
91
+
92
+ We train SD-DCGANs on both of our datasets for 500,000 iterations using batches of 16 identitymatched pairs. To optimize SD-DCGAN, we use the Adam optimizer (Kingma & Ba, 2015) with hyperparameters $\alpha = 2 \mathrm { e } { - } 4 , \beta _ { 1 } = 0 . 5 , \beta _ { 2 } = 0 . 9 9 9$ as recommended by Radford et al. (2016). We also consider a non-Siamese discriminator that simply stacks the channels of the pair of real or fake images before encoding (SD-DCGAN-SC).
93
+
94
+ As in (Radford et al., 2016), we sample latent vectors $\mathbf { z } \sim \mathrm { U n i f o r m } ( [ - 1 , 1 ] ^ { 1 0 0 } )$ . For SD-GANs, we partition the latent codes according to $\mathbf { z } _ { I } \in \mathbb { R } ^ { d _ { I } } , \mathbf { z } _ { O } \in \mathbb { R } ^ { 1 0 0 - d _ { I } }$ using values of $d _ { I } = [ 2 5 , 5 0 ] _ { \mathrm { \Omega } }$ , 75]. Our algorithm can be trivially applied with $k$ -wise training (vs. pairwise). To explore the effects of using $k > 2$ , we also experiment with an SD-DCGAN where we sample $k = 4$ instances each from $P _ { G } ( \mathbf { z } \mid \mathcal { Z } _ { I } = \mathbf { z } _ { I } )$ for some ${ \mathbf z } _ { I } \in { \mathcal { Z } } _ { I }$ and from $P _ { R } ( \mathbf { x } \mid I = i )$ for some $i \in \mathcal { Z }$ . For all experiments, unless otherwise stated, we use $d _ { I } = 5 0$ and $k = 2$ .
95
+
96
+ We also train an SD-BEGAN on both of our datasets. The increased complexity of the SD-BEGAN model significantly increases training time, limiting our ability to perform more-exhaustive hyperparameter validation (as we do for SD-DCGAN). We use the Adam optimizer with the default hyperparameters from (Kingma & Ba, 2015) for our SD-BEGAN experiments. While results from our SD-DCGAN $k = 4$ model are compelling, an experiment with a $k = 4$ variant of SD-BEGAN resulted in early mode collapse (Appendix F); hence, we excluded SD-BEGAN $k = 4$ from our evaluation.
97
+
98
+ We also compare to a DCGAN architecture trained using the auxiliary classifier GAN (AC-GAN) method (Odena et al., 2017). AC-GAN differs from SD-GAN in two key ways: 1) random identity codes $\mathbf { z } _ { I }$ are replaced by a one-hot embedding over all the identities in the training set (matrix of size 10000x50); 2) the AC-GAN method encourages that generated photos depict the proper identity by tasking its discriminator with predicting the identity of the generated or real image. Unlike SD-GANs, the AC-DCGAN model cannot imagine new identities; when generating from AC-DCGAN (for our quantitative comparisons to SD-GANs), we must sample a random identity from those existing in the training data.
99
+
100
+ Table 1: Evaluation of 10k pairs from MS-Celeb-1M (real data) and generative models; half have matched identities, half do not. The identity verification metrics demonstrate that FaceNet (FN) and human annotators on Mechanical Turk (MT) verify generated data similarly to real data. The sample diversity metrics ensure that generated samples are statistically distinct in pixel space. Data generated by our best model (SD-BEGAN) performs comparably to real data. $\ast _ { \mathrm { ~ 1 k ~ } }$ pairs, $\dagger 2 0 0$ pairs.
101
+
102
+ <table><tr><td colspan="6">Identity Verification</td><td colspan="2">Sample Diversity</td></tr><tr><td>Dataset</td><td>Mem</td><td>Judge</td><td>AUC</td><td>Acc.</td><td>FAR</td><td>ID-Div</td><td>All-Div</td></tr><tr><td>MS-Celeb-1M</td><td>=</td><td>FN</td><td>.913</td><td>.867</td><td>.045</td><td>.621</td><td>.699</td></tr><tr><td>AC-DCGAN</td><td>131MB</td><td>FN</td><td>.927</td><td>.851</td><td>.083</td><td>.497</td><td>.666</td></tr><tr><td>SD-DCGAN</td><td>57MB</td><td>FN</td><td>.823</td><td>.749</td><td>.201</td><td>.521</td><td>.609</td></tr><tr><td>SD-DCGAN-SC</td><td>47MB</td><td>FN</td><td>.831</td><td>.757</td><td>.180</td><td>.560</td><td>.637</td></tr><tr><td>SD-DCGAN k=4</td><td>75 MB</td><td>FN</td><td>.852</td><td>.776</td><td>.227</td><td>.523</td><td>.614</td></tr><tr><td>SD-DCGAN d1=25</td><td>57 MB</td><td>FN</td><td>.835</td><td>.764</td><td>.222</td><td>.526</td><td>.615</td></tr><tr><td>SD-DCGAN d1=75</td><td>57MB</td><td>FN</td><td>.816</td><td>.743</td><td>.268</td><td>.517</td><td>.601</td></tr><tr><td>SD-BEGAN</td><td>68MB</td><td>FN</td><td>.928</td><td>.857</td><td>.110</td><td>.588</td><td>.673</td></tr><tr><td>+MS-Celeb-1M</td><td></td><td>Us</td><td>=</td><td>.850</td><td>.110</td><td>.621</td><td>.699</td></tr><tr><td>*MS-Celeb-1M</td><td></td><td>MT</td><td></td><td>.759</td><td>.035</td><td>.621</td><td>.699</td></tr><tr><td>*AC-DCGAN</td><td>131MB</td><td>MT</td><td>=</td><td>.765</td><td>.090</td><td>.497</td><td>.666</td></tr><tr><td>*SD-DCGAN k=4</td><td>75 MB</td><td>MT</td><td></td><td>.688</td><td>.147</td><td>.523</td><td>.614</td></tr><tr><td>*SD-BEGAN</td><td>68MB</td><td>MT</td><td></td><td>.723</td><td>.096</td><td>.588</td><td>.673</td></tr></table>
103
+
104
+ # 3.2 EVALUATION
105
+
106
+ The evaluation of generative models is a fraught topic. Quantitative measures of sample quality can be poorly correlated with each other (Theis et al., 2016). Accordingly, we design an evaluation to match conceivable uses of our algorithm. Because we hope to produce diverse samples that humans deem to depict the same person, we evaluate the identity coherence of SD-GANs and baselines using both a pretrained face verification model and crowd-sourced human judgments obtained through Amazon’s Mechanical Turk platform.
107
+
108
+ # 3.2.1 QUANTITATIVE
109
+
110
+ Recent advancements in face verification using deep convolutional neural networks (Schroff et al., 2015; Parkhi et al., 2015; Wen et al., 2016) have yielded accuracy rivaling humans. For our evaluation, we procure FaceNet, a publicly-available face verifier based on the Inception-ResNet architecture (Szegedy et al., 2017). The FaceNet model was pretrained on the CASIA-WebFace dataset (Yi et al., 2014) and achieves $9 8 . 6 \%$ accuracy on the LFW benchmark (Huang et al., 2012).3
111
+
112
+ FaceNet ingests normalized, 160x160 color images and produces an embedding $f ( \mathbf { x } ) \ \in \ \mathbb { R } ^ { 1 2 8 }$ The training objective for FaceNet is to learn embeddings that minimize the $L _ { 2 }$ distance between matched pairs of faces and maximize the distance for mismatched pairs. Accordingly, the embedding space yields a function for measuring the similarity between two faces $\mathbf { x } _ { 1 }$ and $\mathbf { x } _ { 2 }$ : $D ( \mathbf { x } _ { 1 } , \mathbf { x } _ { 2 } ) =$ $| | { \bar { f } } ( \mathbf x _ { 1 } ) - f ( \mathbf x _ { 2 } ) | | _ { 2 } ^ { 2 }$ . Given two images, $\mathbf { x } _ { 1 }$ and $\mathbf { x } _ { 2 }$ , we label them as a match if $D ( \mathbf { x } _ { 1 } , \mathbf { x } _ { 2 } ) \le \tau _ { v }$ where $\tau _ { v }$ is the accuracy-maximizing threshold on a class-balanced set of pairs from MS-Celeb-1M validation data. We use the same threshold for evaluating both real and synthetic data with FaceNet.
113
+
114
+ We compare the performance of FaceNet on pairs of images from the MS-Celeb-1M test set against generated samples from our trained SD-GAN models and AC-DCGAN baseline. To match FaceNet’s training data, we preprocess all images by resizing from 64x64 to 160x160, normalizing each image individually. We prepare 10,000 pairs from MS-Celeb-1M, half identity-matched and half unmatched. From each generative model, we generate 5,000 pairs each with ${ \bf z } _ { I } ^ { 1 } = { \bf z } _ { I } ^ { 2 }$ and 5,000 pairs with ${ \bf z } _ { I } ^ { 1 } \neq { \bf z } _ { I } ^ { 2 }$ . For each sample, we draw observation vectors $\mathbf { z } _ { O }$ randomly.
115
+
116
+ We also want to ensure that identity-matched images produced by the generative models are diverse. To this end, we propose an intra-identity sample diversity (ID-Div) metric. The multi-scale structural similarity (MS-SSIM) (Wang et al., 2004) metric reports the similarity of two images on a scale from 0 (no resemblance) to 1 (identical images). We report 1 minus the mean MS-SSIM for all pairs of identity-matched images as ID-Div. To measure the overall sample diversity (All-Div), we also compute 1 minus the mean similarity of 10k pairs with random identities.
117
+
118
+ In Table 1, we report the area under the receiver operating characteristic curve (AUC), accuracy, and false accept rate (FAR) of FaceNet (at threshold $\tau _ { v }$ ) on the real and generated data. We also report our proposed diversity statistics. FaceNet verifies pairs from the real data with $8 7 \%$ accuracy compared to $8 6 \%$ on pairs from our SD-BEGAN model. Though this is comparable to the accuracy achieved on pairs from the AC-DCGAN baseline, our model produces samples that are more diverse in pixel space (as measured by ID-Div and All-Div). FaceNet has a higher but comparable FAR for pairs from SD-GANs than those from AC-DCGAN; this indicates that SD-GANs may produce images that are less semantically diverse on average than AC-DCGAN.
119
+
120
+ We also report the combined memory footprint of $G$ and $D$ for all methods in Table 1. For conditional GAN approaches, the number of parameters grows linearly with the number of identities in the training data. Especially in the case of the AC-GAN, where the discriminator computes a softmax over all identities, linear scaling may be prohibitive. While our $1 0 \mathrm { k }$ -identity subset of MS-Celeb-1M requires a 131MB AC-DCGAN model, an AC-DCGAN for all 1M identities would be over 8GB, with more than $9 7 \%$ of the parameters devoted to the weights in the discriminator’s softmax layer. In contrast, the complexity of SD-GAN is constant in the number of identities.
121
+
122
+ # 3.2.2 QUALITATIVE
123
+
124
+ In addition to validating that identity-matched SD-GAN samples are verified by FaceNet, we also demonstrate that humans are similarly convinced through experiments using Mechanical Turk. For these experiments, we use balanced subsets of 1,000 pairs from MS-Celeb-1M and the most promising generative methods from our FaceNet evaluation. We ask human annotators to determine if each pair depicts the “same person” or “different people”. Annotators are presented with batches of ten pairs at a time. Each pair is presented to three distinct annotators and predictions are determined by majority vote. Additionally, to provide a benchmark for assessing the quality of the Mechanical Turk ensembles, we (the authors) manually judged 200 pairs from MS-Celeb-1M. Results are in Table 1.
125
+
126
+ For all datasets, human annotators on Mechanical Turk answered “same person” less frequently than FaceNet when the latter uses the accuracy-maximizing threshold $\tau _ { v }$ . Even on real data, balanced so that $5 0 \%$ of pairs are identity-matched, annotators report “same person” only $2 8 \%$ of the time (compared to the $4 1 \%$ of FaceNet). While annotators achieve higher accuracy on pairs from ACDCGAN than pairs from SD-BEGAN, they also answer “same person” $1 6 \%$ more often for ACDCGAN pairs than real data. In contrast, annotators answer “same person” at the same rate for SD-BEGAN pairs as real data. This may be attributable to the lower sample diversity produced by AC-DCGAN. Samples from SD-DCGAN and SD-BEGAN are shown in Figures 3 and 1 respectively.
127
+
128
+ # 4 RELATED WORK
129
+
130
+ Style transfer and novel view synthesis are active research areas. Early attempts to disentangle style and content manifolds used factored tensor representations (Tenenbaum & Freeman, 1997; Vasilescu & Terzopoulos, 2002; Elgammal & Lee, 2004; Tang et al., 2013), applying their results to face image synthesis. More recent work focuses on learning hierarchical feature representations using deep convolutional neural networks to separate identity and pose manifolds for faces (Zhu et al., 2013; Reed et al., 2014; Zhu et al., 2014; Yang et al., 2015; Kulkarni et al., 2015; Oord et al., 2016; Yan et al., 2016) and products (Dosovitskiy et al., 2015). Gatys et al. (2016) use features of a convolutional network, pretrained for image recognition, as a means for discovering content and style vectors.
131
+
132
+ Since their introduction (Goodfellow et al., 2014), GANs have been used to generate increasingly highquality images (Radford et al., 2016; Zhao et al., 2017b; Berthelot et al., 2017). Conditional GANs (cGANs), introduced by Mirza & Osindero (2014), extend GANs to generate class-conditional data. Odena et al. (2017) propose auxiliary classifier GANs, combining cGANs with a semi-supervised discriminator (Springenberg, 2015). Recently, cGANs have been used to ingest text (Reed et al., 2016) and full-resolution images (Isola et al., 2017; Liu et al., 2017; Zhu et al., 2017) as conditioning information, addressing a variety of image-to-image translation and style transfer tasks. Chen et al. (2016) devise an information-theoretic extension to GANs in which they maximize the mutual information between a subset of latent variables and the generated data. Their unsupervised method appears to disentangle some intuitive factors of variation, but these factors may not correspond to those explicitly disentangled by SD-GANs.
133
+
134
+ ![](images/69ecf5b7b6026c25314a50c01a8bdcdb4f0135497f352acc13eb446910939e2d.jpg)
135
+ Figure 5: Linear interpolation of $\mathbf { z } _ { I }$ (identity) and $\mathbf { z } _ { O }$ (observation) for three pairs using SD-BEGAN generator. In each matrix, rows share $\mathbf { z } _ { I }$ and columns share $\mathbf { z } _ { O }$ .
136
+
137
+ Several related papers use GANs for novel view synthesis of faces. Tran et al. (2017); Huang et al. (2017); Yin et al. (2017a;b); Zhao et al. (2017a) all address synthesis of different body/facial poses conditioned on an input image (representing identity) and a fixed number of pose labels. Antipov et al. (2017) propose conditional GANs for synthesizing artificially-aged faces conditioned on both a face image and an age vector. These approaches all require explicit conditioning on the relevant factor (such as rotation, lighting and age) in addition to an identity image. In contrast, SD-GANs can model these contingent factors implicitly (without supervision).
138
+
139
+ Mathieu et al. (2016) combine GANs with a traditional reconstruction loss to disentangle identity. While their approach trains with an encoder-decoder generator, they enforce a variational bound on the encoder embedding, enabling them to sample from the decoder without an input image. Experiments with their method only address small (28x28) grayscale face images, and their training procedure is complex to reproduce. In contrast, our work offers a simpler approach and can synthesize higher-resolution, color photographs.
140
+
141
+ One might think of our work as offering the generative view of the Siamese networks often favored for learning similarity metrics (Bromley, 1994; Chopra et al., 2005). Such approaches are used for discriminative tasks like face or signature verification that share the many classes with few examples structure that we study here. In our work, we adopt a Siamese architecture in order to enable the discriminator to differentiate between matched and unmatched pairs. Recent work by Liu & Tuzel (2016) propose a GAN architecture with weight sharing across multiple generators and discriminators, but with a different problem formulation and objective from ours.
142
+
143
+ # 5 DISCUSSION
144
+
145
+ Our evaluation demonstrates that SD-GANs can disentangle those factors of variation corresponding to identity from the rest. Moreover, with SD-GANs we can sample never-before-seen identities, a benefit not shared by conditional GANs. In Figure 3, we demonstrate that by varying the observation vector $\mathbf { z } _ { O }$ , SD-GANs can change the color of clothing, add or remove sunnies, or change facial pose. They can also perturb the lighting, color saturation, and contrast of an image, all while keeping the apparent identity fixed. We note, subjectively, that samples from SD-DCGAN tend to appear less photorealistic than those from SD-BEGAN. Given a generator trained with SD-GAN, we can independently interpolate along the identity and observation manifolds (Figure 5).
146
+
147
+ On the shoe dataset, we find that the SD-DCGAN model produces convincing results. As desired, manipulating $\mathbf { z } _ { I }$ while keeping $\mathbf { z } _ { O }$ fixed yields distinct shoes in consistent poses (Figure 4). The identity code $\mathbf { z } _ { I }$ appears to capture the broad categories of shoes (sneakers, flip-flops, boots, etc.). Surprisingly, neither original BEGAN nor SD-BEGAN can produce diverse shoe images (Appendix G).
148
+
149
+ In this paper, we presented SD-GANs, a new algorithm capable of disentangling factors of variation according to known commonalities. We see several promising directions for future work. One logical extension is to disentangle latent factors corresponding to more than one known commonality. We also plan to apply our approach in other domains such as identity-conditioned speech synthesis.
150
+
151
+ # ACKNOWLEDGEMENTS
152
+
153
+ The authors would like to thank Anima Anandkumar, John Berkowitz and Miller Puckette for their helpful feedback on this work. This work used the Extreme Science and Engineering Discovery Environment (XSEDE), which is supported by National Science Foundation grant number ACI1053575 (Towns et al., 2014). GPUs used in this research were donated by the NVIDIA Corporation.
154
+
155
+ # REFERENCES
156
+
157
+ Grigory Antipov, Moez Baccouche, and Jean-Luc Dugelay. Face aging with conditional generative adversarial networks. In ICIP, 2017.
158
+
159
+ Martin Arjovsky, Soumith Chintala, and Léon Bottou. Wasserstein GAN. In ICML, 2017.
160
+
161
+ David Berthelot, Tom Schumm, and Luke Metz. BEGAN: Boundary equilibrium generative adversarial networks. arXiv:1703.10717, 2017.
162
+
163
+ Jane Bromley. Signature verification using a "Siamese" time delay neural network. In NIPS, 1994.
164
+
165
+ Xi Chen, Yan Duan, Rein Houthooft, John Schulman, Ilya Sutskever, and Pieter Abbeel. InfoGAN: Interpretable representation learning by information maximizing generative adversarial nets. In NIPS, 2016.
166
+
167
+ Sumit Chopra, Raia Hadsell, and Yann LeCun. Learning a similarity metric discriminatively, with application to face verification. In CVPR, 2005.
168
+
169
+ Alexey Dosovitskiy, Jost Tobias Springenberg, and Thomas Brox. Learning to generate chairs with convolutional neural networks. In CVPR, 2015.
170
+
171
+ Ahmed Elgammal and Chan-Su Lee. Separating style and content on a nonlinear manifold. In CVPR, 2004.
172
+
173
+ Leon A Gatys, Alexander S Ecker, and Matthias Bethge. Image style transfer using convolutional neural networks. In CVPR, 2016.
174
+
175
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial networks. In NIPS, 2014.
176
+
177
+ Yandong Guo, Lei Zhang, Yuxiao Hu, Xiaodong He, and Jianfeng Gao. MS-Celeb-1M: A dataset and benchmark for large scale face recognition. In ECCV, 2016.
178
+
179
+ Geoffrey Hinton, Nitish Srivastava, and Kevin Swersky. Neural networks for machine learning lecture 6a: Overview of mini–batch gradient descent.
180
+
181
+ Gary B. Huang, Marwan Mattar, Honglak Lee, and Erik Learned-Miller. Learning to align from scratch. In NIPS, 2012.
182
+
183
+ Rui Huang, Shu Zhang, Tianyu Li, and Ran He. Beyond face rotation: Global and local perception gan for photorealistic and identity preserving frontal view synthesis. In ICCV, 2017.
184
+
185
+ Phillip Isola, Jun-Yan Zhu, Tinghui Zhou, and Alexei A Efros. Image-to-image translation with conditional adversarial networks. In CVPR, 2017.
186
+
187
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR, 2015.
188
+
189
+ Tejas D Kulkarni, William F Whitney, Pushmeet Kohli, and Josh Tenenbaum. Deep convolutional inverse graphics network. In NIPS, 2015.
190
+
191
+ Zachary C Lipton and Subarna Tripathi. Precise recovery of latent vectors from generative adversarial networks. ICLR Workshop Track, 2017.
192
+
193
+ Ming-Yu Liu and Oncel Tuzel. Coupled generative adversarial networks. In NIPS, 2016.
194
+
195
+ Ming-Yu Liu, Thomas Breuel, and Jan Kautz. Unsupervised image-to-image translation networks. In ICML, 2017.
196
+
197
+ Michael F Mathieu, Junbo Jake Zhao, Junbo Zhao, Aditya Ramesh, Pablo Sprechmann, and Yann LeCun. Disentangling factors of variation in deep representation using adversarial training. In NIPS, 2016.
198
+
199
+ Julian McAuley, Christopher Targett, Qinfeng Shi, and Anton Van Den Hengel. Image-based recommendations on styles and substitutes. In SIGIR, 2015.
200
+
201
+ Mehdi Mirza and Simon Osindero. Conditional generative adversarial nets. arXiv:1411.1784, 2014.
202
+
203
+ Augustus Odena, Christopher Olah, and Jonathon Shlens. Conditional image synthesis with auxiliary classifier GANs. In ICML, 2017.
204
+
205
+ Aaron van den Oord, Nal Kalchbrenner, Oriol Vinyals, Lasse Espeholt, Alex Graves, and Koray Kavukcuoglu. Conditional image generation with pixelcnn decoders. In NIPS, 2016.
206
+
207
+ Omkar M Parkhi, Andrea Vedaldi, and Andrew Zisserman. Deep face recognition. In BMVC, 2015.
208
+
209
+ Deepak Pathak, Philipp Krahenbuhl, Jeff Donahue, Trevor Darrell, and Alexei A Efros. Context encoders: Feature learning by inpainting. In CVPR, 2016.
210
+
211
+ Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. In ICLR, 2016.
212
+
213
+ Scott Reed, Kihyuk Sohn, Yuting Zhang, and Honglak Lee. Learning to disentangle factors of variation with manifold interaction. In ICML, 2014.
214
+
215
+ Scott Reed, Zeynep Akata, Xinchen Yan, Lajanugen Logeswaran, Bernt Schiele, and Honglak Lee. Generative adversarial text to image synthesis. In ICML, 2016.
216
+
217
+ Florian Schroff, Dmitry Kalenichenko, and James Philbin. FaceNet: A unified embedding for face recognition and clustering. In CVPR, 2015.
218
+
219
+ Jost Tobias Springenberg. Unsupervised and semi-supervised learning with categorical generative adversarial networks. In ICLR, 2015.
220
+
221
+ Christian Szegedy, Sergey Ioffe, Vincent Vanhoucke, and Alex Alemi. Inception-v4, Inception-ResNet and the impact of residual connections on learning. In AAAI, 2017.
222
+
223
+ Yichuan Tang, Ruslan Salakhutdinov, and Geoffrey Hinton. Tensor analyzers. In ICML, 2013.
224
+
225
+ Joshua B Tenenbaum and William T Freeman. Separating style and content. In NIPS, 1997.
226
+
227
+ Lucas Theis, Aäron van den Oord, and Matthias Bethge. A note on the evaluation of generative models. In ICLR, 2016.
228
+
229
+ John Towns, Timothy Cockerill, Maytal Dahan, Ian Foster, Kelly Gaither, Andrew Grimshaw, Victor Hazlewood, Scott Lathrop, Dave Lifka, Gregory D Peterson, et al. XSEDE: Accelerating scientific discovery. Computing in Science & Engineering, 2014.
230
+
231
+ Luan Tran, Xi Yin, and Xiaoming Liu. Disentangled representation learning GAN for pose-invariant face recognition. In CVPR, 2017.
232
+
233
+ M Vasilescu and Demetri Terzopoulos. Multilinear analysis of image ensembles: Tensorfaces. In ECCV, 2002.
234
+
235
+ Zhou Wang, Eero P Simoncelli, and Alan C Bovik. Multiscale structural similarity for image quality assessment. In Asilomar Conference on Signals, Systems and Computers, 2004.
236
+
237
+ Yandong Wen, Kaipeng Zhang, Zhifeng Li, and Yu Qiao. A discriminative feature learning approach for deep face recognition. In ECCV, 2016.
238
+
239
+ Xinchen Yan, Jimei Yang, Kihyuk Sohn, and Honglak Lee. Attribute2Image: Conditional image generation from visual attributes. In ECCV, 2016.
240
+
241
+ Jimei Yang, Scott E Reed, Ming-Hsuan Yang, and Honglak Lee. Weakly-supervised disentangling with recurrent transformations for 3D view synthesis. In NIPS, 2015.
242
+
243
+ Dong Yi, Zhen Lei, Shengcai Liao, and Stan Z Li. Learning face representation from scratch. arXiv:1411.7923, 2014.
244
+ Weidong Yin, Yanwei Fu, Leonid Sigal, and Xiangyang Xue. Semi-latent GAN: Learning to generate and modify facial images from attributes. arXiv:1704.02166, 2017a.
245
+ Xi Yin, Xiang Yu, Kihyuk Sohn, Xiaoming Liu, and Manmohan Chandraker. Towards large-pose face frontalization in the wild. In ICCV, 2017b.
246
+ Bo Zhao, Xiao Wu, Zhi-Qi Cheng, Hao Liu, and Jiashi Feng. Multi-view image generation from a single-view. arXiv:1704.04886, 2017a.
247
+ Junbo Zhao, Michael Mathieu, and Yann LeCun. Energy-based generative adversarial network. In ICLR, 2017b.
248
+ Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A Efros. Unpaired image-to-image translation using cycle-consistent adversarial networks. In ICCV, 2017.
249
+ Zhenyao Zhu, Ping Luo, Xiaogang Wang, and Xiaoou Tang. Deep learning identity-preserving face space. In ICCV, 2013.
250
+ Zhenyao Zhu, Ping Luo, Xiaogang Wang, and Xiaoou Tang. Multi-view perceptron: a deep model for learning face identity and view representations. In NIPS, 2014.
251
+
252
+ # A ESTIMATING LATENT CODES
253
+
254
+ ![](images/e28a29b85aacc0e153ba6800f695b61efea0e6238a4a20dcd607511e2d41519d.jpg)
255
+ Figure 6: Linear interpolation of both identity (vertical) and observation (horizontal) on latent codes recovered for unseen images. All rows have the same identity vector $( { \bf z } _ { I } )$ and all columns have the same observation vector $\mathbf { \Pi } ( \mathbf { z } _ { O } )$ .
256
+
257
+ We estimate latent vectors for unseen images and demonstrate that the disentangled representations of SD-GANs can be used to depict the estimated identity with different contingent factors. In order to find a latent vector $\hat { \mathbf { z } }$ such that $G ( \hat { \mathbf { z } } )$ (pretrained $G$ ) is similar to an unseen image $\mathbf { x }$ , we can minimize the distance between $\mathbf { x }$ and $G ( \hat { \mathbf { z } } ) \colon \operatorname* { m i n } _ { \hat { \mathbf { z } } } | | G ( \hat { \mathbf { z } } ) - \mathbf { x } | | _ { 2 } ^ { 2 }$ (Lipton & Tripathi, 2017).
258
+
259
+ In Figure 6, we depict estimation and linear interpolation across both subspaces for two pairs of images using SD-BEGAN. We also display the corresponding source images being estimated. For both pairs, $\hat { \mathbf { z } } _ { I }$ (identity) is consistent in each row and $\hat { \mathbf { z } } _ { O }$ (observation) is consistent in each column.
260
+
261
+ # B PAIRWISE DISCRIMINATION OF EMBEDDINGS AND ENCODINGS
262
+
263
+ In Section 3.1, we describe an AC-GAN (Odena et al., 2017) baseline which uses an embedding matrix over real identities as latent identity codes $( G : i , \mathbf { z } _ { O } \mapsto \hat { \mathbf { x } } ,$ ). In place of random identity vectors, we tried combining this identity representation with pairwise discrimination (in the style of SD-GAN). In this experiment, the discriminator receives either either two real images with the same identity $( \mathbf { x } _ { i } ^ { 1 } , \mathbf { x } _ { i } ^ { 2 } )$ , or a real image with label $i$ and synthetic image with label $i$ $( \bar { \bf x } _ { i } ^ { 1 } , G ( i , { \bf z } _ { O } ) )$ . All other hyperparameters are the same as in our SD-DCGAN experiment (Section 3.1). We show results in Figure 7.
264
+
265
+ ![](images/2399c32097f736d442495e541ceb8969c1c2ec58acf1c6d9b8578cbb3faff757.jpg)
266
+ Figure 7: Generator with a one-hot identity embedding trained against a pairwise discriminator. Each row shares an identity vector and each column shares an observation vector. Random sample of 4 real images of the corresponding identity on the right.
267
+
268
+ In Appendix C, we detail a modification of the DR-GAN (Tran et al., 2017) method which uses an encoding network $G _ { e }$ to transform images to identity representations $( G _ { d } : G _ { e } ( \mathbf { x } ) , \mathbf { z _ { O } } \mapsto \hat { \mathbf { x } } )$ . We also tried combining this encoder-decoder approach with pairwise discrimination. The discriminator receives either two real images with the same identity $( \mathbf { x } _ { i } ^ { 1 } , \mathbf { x } _ { i } ^ { 2 } )$ , or $( \mathbf { x } _ { i } ^ { 1 } , G _ { d } ( G _ { e } ( \mathbf { x } _ { i } ^ { 1 } ) , \mathbf { z } _ { O } )$ . We show results in Figure 8.
269
+
270
+ ![](images/2256d6404672113e19f260981bb5bfa4dd0ad38f28481675b9997c8942e9b918.jpg)
271
+ Figure 8: Generator with an encoder-decoder architecture trained against a pairwise discriminator. Each row shares an identity vector and each column shares an observation vector. Input image on the right.
272
+
273
+ While these experiments are exploratory and not part of our principle investigation, we find the results to be qualitatively promising. We are not the first to propose pairwise discrimination with pairs of (real, real) or (real, fake) images in GANs (Pathak et al., 2016; Isola et al., 2017).
274
+
275
+ # C EXPLORATORY EXPERIMENT WITH DR-GANS
276
+
277
+ Tran et al. (2017) propose Disentangled Representation learning-GAN (DR-GAN), an approach to face frontalization with similar setup to our SD-GAN algorithm. The (single-image) DR-GAN generator $G$ (composition of $G _ { e }$ and $G _ { d }$ ) accepts an input image $\mathbf { x }$ , a pose code c, and a noise vector $\mathbf { z }$ The DR-GAN discriminator receives either $\mathbf { x }$ or $\hat { \mathbf { x } } = G _ { d } ( G _ { e } ( \mathbf { x } ) , \mathbf { c } , \mathbf { z } )$ . In the style of (Springenberg, 2015), the discriminator is tasked with determining not only if the image is real or fake, but also classifying the pose c, suggesting a disentangled representation to the generator. Through their experiments, they demonstrate that DR-GAN can explicitly disentangle pose and illumination (c) from the rest of the latent space $( G _ { e } ( \mathbf { x } ) ; \mathbf { z } )$ .
278
+
279
+ ![](images/b3bc53de8c6cc452564013bf491f653a5ca12b17e7a1ec4fdd947ae548e7c659.jpg)
280
+ Figure 9: Generated samples from cGAN trained only to disentangle identity. Each row shares an identity vector and each column shares an observation vector; input image on the right.
281
+
282
+ In addition to our AC-DCGAN baseline (Odena et al., 2017), we tried modifying DR-GAN to only disentangle identity (rather than both identity and pose in the original paper). We used the DCGAN (Radford et al., 2016) discriminator architecture (Table 4) as $G _ { e }$ , linearly projecting the final convolutional layer to $G _ { e } ( \mathbf { x } ) \in \mathbb { R } ^ { 5 0 }$ (in alignment with our SD-GAN experiments). We altered the discriminator to predict the identity of $\mathbf { x }$ or $\hat { \bf x }$ , rather than pose information (which is unknown in our experimental setup). With these modifications, $G _ { e } ( \mathbf { x } )$ is analogous to $\mathbf { z _ { I } }$ in the SD-GAN generator, and $\mathbf { z }$ is analogous to $\mathbf { z } _ { \mathbf { O } }$ . Furthermore, this setup is identical to the AC-DCGAN baseline except that the embedding matrix is replaced by an encoding network $G _ { e }$ . Unfortunately, we found that the generator quickly learned to produce a single output image $\hat { \bf x }$ for each input $\mathbf { x }$ regardless of observation code z (Figure 9). Accordingly, we excluded this experiment from our evaluation (Section 3.2).
283
+
284
+ # D IMAGINING IDENTITIES WITH AC-GAN
285
+
286
+ ![](images/3848138746ae5e84c677cf8589dc177fd78c54ae131a9f0b18eaaac9a7373378.jpg)
287
+ Figure 10: AC-DCGAN generation with random identity vectors that sum to one. Each row shares an identity vector and each column shares an observation vector.
288
+
289
+ ![](images/ad73c8ca8a60a141b3fc5e25ed6d198ae3b3266701b0df4932b274d79e00c5de.jpg)
290
+ Figure 11: AC-DCGAN generation with one-hot identity vectors. Each row shares an identity vector and each column shares an observation vector.
291
+
292
+ As stated in Section 3.1, AC-GANs Odena et al. (2017) provide no obvious way to imagine new identities. For our evaluation (Section 3.2), the AC-GAN generator receives identity input $\mathbf { z } _ { \mathbf { I } } ^ { \mathrm { ~ \tiny ~ ~ } } \in ~ [ 0 , 1 ] ^ { 1 0 0 0 0 }$ : a one-hot over all identities. One possible approactrained AC-GAN generator with a random vector $\mathbf { z _ { I } }$ imagininsuch that $\begin{array} { r } { \sum _ { i = 1 } ^ { 1 0 0 0 0 } \mathbf { z _ { I } [ i ] } ~ = ~ 1 } \end{array}$ ld be to query a. We found that this strategy produced little identity variety (Figure 10) compared to the normal one-hot strategy (Figure 11) and excluded it from our evaluation.
293
+
294
+ # E ARCHITECTURE DESCRIPTIONS
295
+
296
+ We list here the full architectural details for our SD-DCGAN and SD-BEGAN models. In these descriptions, $k$ is the number of images that the generator produces and discriminator observes per identity (usually 2 for pairwise training), and $d _ { I }$ is the number of dimensions in the latent space $\mathcal { Z } _ { I }$ (identity). In our experiments, dimensionality of $\mathcal { Z } _ { O }$ is always $1 0 0 - d _ { I }$ . As a concrete example, the bottleneck layer of the SD-BEGAN discriminator autoencoder (“fc2” in Table 6) with $k = 2 , d _ { I } = 5 0$ has output dimensionality 150.
297
+
298
+ We emphasize that generators are parameterized by $k$ in the tables only for clarity and symmetry with the discriminators. Implementations need not modify the generator; instead, $k$ can be collapsed into the batch size.
299
+
300
+ For the stacked-channels versions of these discriminators, we simply change the number of input image channels from 3 to $3 k$ and set $k = 1$ wherever $k$ appears in the table.
301
+
302
+ Table 2: Input abstraction for both SD-DCGAN and SD-BEGAN generators during training (where $\mathbf { z } _ { O }$ is always different for every pair or set of $k$ )
303
+
304
+ <table><tr><td rowspan=1 colspan=1>Operation</td><td rowspan=1 colspan=1>Input Shape</td><td rowspan=1 colspan=1>Kernel Size</td><td rowspan=1 colspan=1>Output Shape</td></tr><tr><td rowspan=1 colspan=1>[zi;zo]dup ziconcat</td><td rowspan=1 colspan=1>[(d1,);(k,100-d1)][(d1,);(k,100-d1)][(k,d1);:(k,100-d1)]</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>[(d1,);(k,100-d1)][(k,d1);(k,100-d1)](k,100)</td></tr></table>
305
+
306
+ Table 3: SD-DCGAN generator architecture
307
+
308
+ <table><tr><td rowspan=1 colspan=1>Operation</td><td rowspan=1 colspan=1>Input Shape</td><td rowspan=1 colspan=1>Kernel Size</td><td rowspan=1 colspan=1>Output Shape</td></tr><tr><td rowspan=1 colspan=1>z</td><td rowspan=1 colspan=1>(k,100)</td><td rowspan=4 colspan=1>(100,8192)</td><td rowspan=16 colspan=1>(k,100)(k,8192)(k,4,4,512)(k,4,4,512)(k,4,4,512)(k,8,8,256)(k,8,8,256)(k,8,8,256)(k,16,16,128)(k,16,16,128)(k,16,16,128)(k,32,32,64)(k,32,32,64)(k,32,32,64)(k,64,64,3)(k,64,64,3)</td></tr><tr><td rowspan=1 colspan=1>fc1</td><td rowspan=2 colspan=1>(k,8192)(k,8192)</td></tr><tr><td rowspan=1 colspan=1>reshape</td></tr><tr><td rowspan=1 colspan=1>bnorm</td><td rowspan=1 colspan=1>(k,4,4,512)</td></tr><tr><td rowspan=1 colspan=1>relu</td><td rowspan=2 colspan=1>(k,4,4,512)(k,4,4,512)</td><td rowspan=2 colspan=1>(5,5,512,256)</td></tr><tr><td rowspan=1 colspan=1>upconv1</td></tr><tr><td rowspan=1 colspan=1>bnorm</td><td rowspan=1 colspan=1>(k,8,8,256)</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>relu</td><td rowspan=1 colspan=1>(k,8,8,256)</td><td rowspan=2 colspan=1>(5,5,256,128)</td></tr><tr><td rowspan=1 colspan=1>upconv2</td><td rowspan=1 colspan=1>(k,8,8,256)</td></tr><tr><td rowspan=1 colspan=1>bnorm</td><td rowspan=1 colspan=1>(k,16,16,128)</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>relu</td><td rowspan=1 colspan=1>(k,16,16,128)</td><td rowspan=2 colspan=1>(5,5,128,64)</td></tr><tr><td rowspan=1 colspan=1>upconv3</td><td rowspan=1 colspan=1>(k,16,16,128)</td></tr><tr><td rowspan=1 colspan=1>bnorm</td><td rowspan=1 colspan=1>(k,32,32,64)</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>relu</td><td rowspan=1 colspan=1>(k,32,32,64)</td><td rowspan=3 colspan=1>(5,5,64,3)</td></tr><tr><td rowspan=1 colspan=1>upconv4</td><td rowspan=1 colspan=1>(k,32,32,64)</td></tr><tr><td rowspan=1 colspan=1>tanh</td><td rowspan=1 colspan=1>(k,64,64,3)</td></tr></table>
309
+
310
+ Table 4: SD-DCGAN discriminator architecture
311
+
312
+ <table><tr><td rowspan=1 colspan=3>Operation</td><td rowspan=1 colspan=1>Input Shape</td><td rowspan=1 colspan=1>Kernel Size</td><td rowspan=1 colspan=1>Output Shape</td></tr><tr><td rowspan=1 colspan=3>x or G(z)</td><td rowspan=1 colspan=1>(k,64,64,3)</td><td rowspan=1 colspan=1></td><td rowspan=9 colspan=1>(k,64,64,3)(k,32,32,64)(k,32,32,64)(k,16,16,128)(k,16,16,128)(k,16,16,128)(k,8,8,256)(k,8,8,256)(k,8,8,256)(k,4,4,512)(4,4,512k)(2,2,512)(2048,)(1,)(1,)</td></tr><tr><td rowspan=1 colspan=3>downconv1</td><td rowspan=1 colspan=1>(k,64,64,3)</td><td rowspan=5 colspan=1>(5,5,3,64)(5,5,64,128)(5,5,128,256)</td></tr><tr><td rowspan=2 colspan=3>lrelu(a=0.2)downconv2bnorm</td><td rowspan=2 colspan=1>(k,32,32,64)(k,32,32,64)(k,16,16,128)</td></tr><tr><td rowspan=1 colspan=1>downconv2bnorm</td></tr><tr><td rowspan=1 colspan=2>lrelu(a=0.2)</td><td rowspan=1 colspan=1>0.2)</td><td rowspan=2 colspan=1>(k,16,16,128)(k,16,16,128)(k,8,8,256)</td></tr><tr><td rowspan=2 colspan=3>downconv3bnormlrelu(a=0.2)</td></tr><tr><td rowspan=3 colspan=1>(k,8,8,256)(k,8,8,256)(k,4,4,512)(4,4,512k)(2,2,512)(2048,)(1,)</td><td rowspan=3 colspan=1>(5,5,256,512)(3,3,512k,512)(2048,1)</td></tr><tr><td rowspan=1 colspan=3>downconv4stackchannelsdownconv5</td></tr><tr><td rowspan=1 colspan=3>flattenfc1sigmoid</td></tr></table>
313
+
314
+ Table 5: SD-BEGAN generator architecture
315
+
316
+ <table><tr><td rowspan=1 colspan=1>Operation</td><td rowspan=1 colspan=1>Input Shape</td><td rowspan=1 colspan=3>Kernel Size</td><td rowspan=1 colspan=1>Output Shape</td></tr><tr><td rowspan=1 colspan=1>之</td><td rowspan=2 colspan=1>(k,100)(k,100,)</td><td rowspan=3 colspan=3>(100,8192)(3,3,128,128)(3,3,128,128)</td><td rowspan=13 colspan=1>(k,100)(k,100,8192)(k,8,8,128)(k,8,8,128)(k,8,8,128)(k,8,8,128)(k,8,8,128)(k,16,16,128)(k,16,16,128)(k,16,16,128)(k,16,16,128)(k,16,16,128)(k,32,32,128)(k,32,32,128)(k,32,32,128)(k,32,32,128)(k,32,32,128)(k,64,64,128)(k,64,64,128)(k,64,64,128)(k,64,64,128)(k,64,64,128)(k,64,64,3)</td></tr><tr><td rowspan=2 colspan=1>fc1reshapeconv2deluconv2d</td></tr><tr><td rowspan=1 colspan=1>(k,100,8192)(k,8,8,128)(k,8,8,128)(k,8,8,128)</td></tr><tr><td rowspan=1 colspan=1>elu</td><td rowspan=1 colspan=1>(k,8,8,128)</td><td rowspan=1 colspan=2></td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>upsample2conv2d</td><td rowspan=1 colspan=1>(k,8,8,128)(k,16,16,128)</td><td rowspan=1 colspan=3>(3,3,128,128)</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>eluconv2d</td><td rowspan=1 colspan=1>(k,16,16,128)(k,16,16,128)</td><td rowspan=1 colspan=3>(3,3,128,128)</td></tr><tr><td rowspan=1 colspan=1>elu</td><td rowspan=1 colspan=1>(k,16,16,128)</td><td rowspan=1 colspan=3></td></tr><tr><td rowspan=1 colspan=1>upsample2conv2d</td><td rowspan=1 colspan=1>(k,16,16,128)(k,32,32,128)</td><td rowspan=1 colspan=3>(3,3,128,128)</td></tr><tr><td rowspan=1 colspan=1>eluconv2d</td><td rowspan=1 colspan=1>(k,32,32,128)(k,32,32,128)</td><td rowspan=1 colspan=3>(3,3,128,128)</td></tr><tr><td rowspan=1 colspan=1>elu</td><td rowspan=1 colspan=1>(k,32,32,128)</td><td rowspan=1 colspan=3></td></tr><tr><td rowspan=2 colspan=1>upsample2conv2deluconv2d</td><td rowspan=2 colspan=1>(k,32,32,128)(k,64,64,128)(k,64,64,128)(k,64,64,128)</td><td rowspan=1 colspan=3>(3,3,128,128)</td></tr><tr><td rowspan=1 colspan=1>(k,64,64,128)(k,64,64,128)</td><td rowspan=2 colspan=3>(3,3,128,128)(3,3,128,3)</td></tr><tr><td rowspan=1 colspan=1>eluconv2d</td><td rowspan=1 colspan=1>(k,64,64,128)(k,64,64,128)</td></tr></table>
317
+
318
+ Table 6: SD-BEGAN discriminator autoencoder architecture. The decoder portion is equivalent to, but does not share weights with, the SD-BEGAN generator architecture (Table 5).
319
+
320
+ <table><tr><td>Operation</td><td>Input Shape</td><td>Kernel Size</td><td>Output Shape</td></tr><tr><td>x or G(z)</td><td>(k,64,64,3)</td><td></td><td>(k,64,64,3)</td></tr><tr><td>conv2d</td><td>(k,64,64,3)</td><td>(3,3,3,128)</td><td>(k,64,64,128)</td></tr><tr><td>elu</td><td>(k,64,64,128)</td><td></td><td>(k,64,64,128)</td></tr><tr><td>conv2d</td><td>(k,64,64,128)</td><td>(3,3,128,128)</td><td>(k,64,64,128)</td></tr><tr><td>elu</td><td>(k,64,64,128)</td><td></td><td>(k,64,64,128)</td></tr><tr><td>conv2d</td><td>(k,64,64,128)</td><td>(3,3,128,128)</td><td>(k,64,64,128)</td></tr><tr><td>elu</td><td>(k,64,64,128)</td><td></td><td>(k,64,64,128)</td></tr><tr><td>downconv2d</td><td>(k,64,64,128)</td><td>(3,3,128,256)</td><td>(k,32,32,256)</td></tr><tr><td>elu</td><td>(k,32,32,256)</td><td></td><td>(k,32,32,256)</td></tr><tr><td>conv2d</td><td>(k,32,32,256)</td><td>(3,3,256,256)</td><td>(k,32,32,256)</td></tr><tr><td>elu</td><td>(k,32,32,256)</td><td></td><td>(k,32,32,256)</td></tr><tr><td>conv2d</td><td>(k,32,32,256)</td><td>(3,3,256,256)</td><td>(k,32,32,256)</td></tr><tr><td>elu</td><td>(k,32,32,256)</td><td></td><td>(k,32,32,256)</td></tr><tr><td>downconv2d</td><td>(k,32,32,256)</td><td>(3,3,256,384)</td><td>(k,16,16,384)</td></tr><tr><td>elu</td><td>(k,16,16,384)</td><td></td><td>(k,16,16,384)</td></tr><tr><td>conv2d</td><td>(k,16,16,384)</td><td>(3,3,384,384)</td><td>(k,16,16,384)</td></tr><tr><td>elu</td><td>(k,16,16,384)</td><td></td><td>(k,16,16,384)</td></tr><tr><td>conv2d</td><td>(k,16,16,384)</td><td>(3,3,384,384)</td><td>(k,16,16,384)</td></tr><tr><td>elu</td><td>(k,16,16,384)</td><td></td><td>(k,16,16,384)</td></tr><tr><td>downconv2d</td><td>(k,16,16,384)</td><td>(3,3,384,512)</td><td>(k,8,8,512)</td></tr><tr><td>elu</td><td>(k,8,8,512)</td><td></td><td>(k,8,8,512)</td></tr><tr><td>conv2d</td><td>(k,8,8,512)</td><td>(3,3,512,512)</td><td>(k,8,8,512)</td></tr><tr><td>elu</td><td>(k,8,8,512)</td><td></td><td>(k,8,8,512)</td></tr><tr><td>conv2d</td><td>(k,8,8,512)</td><td>(3,3,512,512)</td><td>(k,8,8,512)</td></tr><tr><td>elu</td><td>(k,8,8,512)</td><td></td><td>(k,8,8,512)</td></tr><tr><td>flatten</td><td>(k,8,8,512)</td><td></td><td>(k,32768)</td></tr><tr><td>fc1</td><td>(k,32768)</td><td>(32768,100)</td><td>(k,100)</td></tr><tr><td>concat</td><td>(k,100)</td><td></td><td>(100k,)</td></tr><tr><td>fc2</td><td>(100k,)</td><td>(100k,d1+(100-d1)k,)</td><td>(d1+(100-d1)k,)</td></tr><tr><td>fc3</td><td>(d1+(100-d1)k,)</td><td>(d1+(100-d1)k,100k,)</td><td>(100k,)</td></tr><tr><td>split</td><td>(100k,)</td><td></td><td>(k,100)</td></tr><tr><td>G (Table 5)</td><td>(k,100)</td><td></td><td>(k,64,64,3)</td></tr></table>
321
+
322
+ # F FACE SAMPLES
323
+
324
+ We present samples from each model reported in Table 1 for qualitative comparison. In each matrix, $\mathbf { z } _ { I }$ is the same across all images in a row and $\mathbf { z } _ { O }$ is the same across all images in a column. We draw identity and observation vectors randomly for these samples.
325
+
326
+ ![](images/761b722364348a79e9c640e902930bcd0942ad565d6a63604c1196d9804a05ba.jpg)
327
+ Figure 12: Generated samples from AC-DCGAN (four sample of real photos of ID on right)
328
+
329
+ ![](images/de8829aafbf0731cf64c57b66557cbf49f000889088c3bc37353b4c155bfa02d.jpg)
330
+ Figure 13: Generated samples from SD-DCGAN
331
+
332
+ ![](images/45b1eaa642432b125893dbe27a7149218a1bbe71c99f7f8769a343c5e65ed821.jpg)
333
+ Figure 14: Generated samples from SD-DCGAN with stacked-channel discriminator
334
+
335
+ ![](images/300af6fd5df922dca53d0ea8955c8541a91fdd661bcc3f2f9327881839e54fb6.jpg)
336
+ Figure 15: Generated samples from SD-DCGAN with $k = 4$
337
+
338
+ ![](images/e8a840c441f02cc53807c9964226ceae57d5afc86221e33084a5d7cdc29c2eaf.jpg)
339
+ Figure 16: Generated samples from SD-DCGAN with $d _ { I } = 2 5$
340
+
341
+ ![](images/2d04090981d2bd3673c5eb35e0dfac5dbfff0b070501eee7985b39b1e44271cb.jpg)
342
+ Figure 17: Generated samples from SD-DCGAN with $d _ { I } = 7 5$
343
+
344
+ ![](images/7c98411cb3e996de5ac612d83313c917eb8b023b760dde02b78a831c7bca88a9.jpg)
345
+ Figure 18: Generated samples from SD-DCGAN trained with the Wasserstein GAN loss (Arjovsky et al., 2017). This model was optimized using RMS-prop (Hinton et al.) with $\alpha = 5 \mathrm { { e } - 5 }$ . In our evaluation (Section 3.2), FaceNet had an AUC of .770 and an accuracy of $6 8 . 5 \%$ (at $\tau _ { v }$ ) on data generated by this model. We excluded it from Table 1 for brevity.
346
+
347
+ ![](images/6982b2a952acc5984cd04d945e0a34eca5314ad545040bd2f41a605c913c4379.jpg)
348
+ Figure 19: Generated samples from SD-BEGAN
349
+
350
+ ![](images/b94da5cb6ddeec0bec137a6be3cbf9df60cd815568c43d10dc2847e5628d704a.jpg)
351
+ Figure 20: Generated samples from SD-BEGAN with $k = 4$ , demonstrating mode collapse
352
+
353
+ # G SHOE SAMPLES
354
+
355
+ We present samples from an SD-DCGAN and SD-BEGAN trained on our shoes dataset.
356
+
357
+ ![](images/82412df8bcda85556ba1de0ccfd0e74de91648475420a1f103456f1183ca6af7.jpg)
358
+ Figure 21: Generated samples from SD-DCGAN
359
+
360
+ ![](images/65936ef7fcc9bde0c156b7e9cda71340f4a732b4bd17670ab25ede0465e86530.jpg)
361
+ Figure 22: Generated samples from SD-BEGAN
md/train/SJgNkpVFPr/SJgNkpVFPr.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/SkgGCkrKvH/SkgGCkrKvH.md ADDED
@@ -0,0 +1,631 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DECENTRALIZED DEEP LEARNING WITH ARBITRARY COMMUNICATION COMPRESSION
2
+
3
+ Anastasia Koloskova∗ anastasia.koloskova@epfl.ch
4
+
5
+ Tao Lin∗ tao.lin@epfl.ch
6
+
7
+ Sebastian U. Stich sebastian.stich@epfl.ch
8
+
9
+ Martin Jaggi martin.jaggi@epfl.ch
10
+
11
+ EPFL Lausanne, Switzerland
12
+
13
+ # ABSTRACT
14
+
15
+ Decentralized training of deep learning models is a key element for enabling data privacy and on-device learning over networks, as well as for efficient scaling to large compute clusters. As current approaches are limited by network bandwidth, we propose the use of communication compression in the decentralized training context. We show that CHOCO-SGD achieves linear speedup in the number of workers for arbitrary high compression ratios on general non-convex functions, and non-IID training data. We demonstrate the practical performance of the algorithm in two key scenarios: the training of deep learning models (i) over decentralized user devices, connected by a peer-to-peer network and (ii) in a datacenter.
16
+
17
+ # 1 INTRODUCTION
18
+
19
+ Distributed machine learning—i.e. the training of machine learning models using distributed optimization algorithms—has recently enabled many successful applications in research and industry. Such methods offer two of the key success factors: 1) computational scalability by leveraging the simultaneous computational power of many devices, and 2) data-locality, the ability to perform joint training while keeping each part of the training data local to each participating device. Recent theoretical results indicate that decentralized schemes can be as efficient as the centralized approaches, at least when considering convergence of training loss vs. iterations (Scaman et al., 2017; 2018; Lian et al., 2017; Tang et al., 2018; Koloskova et al., 2019; Assran et al., 2019).
20
+
21
+ Gradient compression techniques have been proposed for the standard distributed training case (Alistarh et al., 2017; Wen et al., 2017; Lin et al., 2018; Wangni et al., 2018; Stich et al., 2018), to reduce the amount of data that has to be sent over each communication link in the network. For decentralized training of deep neural networks, Tang et al. (2018) introduce two algorithms (DCD, ECD) which allow for communication compression. However, both these algorithms are restrictive with respect to the used compression operators, only allowing for unbiased compressors and—more significantly— so far not supporting arbitrarily high compression ratios. We here study CHOCO-SGD—recently introduced for convex problems only (Koloskova et al., 2019)—which overcomes these constraints.
22
+
23
+ For the evaluation of our algorithm we in particular focus on the generalization performance (on the test-set) on standard machine learning benchmarks, hereby departing from previous work such as e.g. (Tang et al., 2018; Wang et al., 2019; Tang et al., 2019; Reisizadeh et al., 2019) that mostly considered training performance (on the train-set). We study two different scenarios: firstly, (i) training on a challenging peer-to-peer setting, where the training data is distributed over the training devices (and not allowed to move), similar to the federated learning setting (McMahan et al., 2017). We are again able to show speed-ups for CHOCO-SGD over the decentralized baseline (Lian et al., 2017) with much less communication overhead. Secondly, (ii) training in a datacenter setting, where decentralized communication patterns allow better scalability than centralized approaches. For this setting we show that communication efficient CHOCO-SGD can improve time-to-accuracy on large tasks, such as e.g. ImageNet training. However, when investigating the scaling of decentralized algorithms to larger number of nodes we observe that (all) decentralized schemes encounter difficulties and often do not reach the same (test and train) performance as centralized schemes. As these findings point out some deficiencies of current decentralized training schemes (and are not particular to our scheme) we think that reporting these results is a helpful contribution to the community to spur further research on decentralized training schemes that scale to large number of peers.
24
+
25
+ Contributions. Our contributions can be summarized as:
26
+
27
+ • On the theory side, we are the first to show that CHOCO-SGD converges at rate $\mathcal { O } \big ( { 1 } / { \sqrt { n T } } + { 1 } / ( { \bar { \rho } ^ { 2 } } \delta T ) ^ { 2 / 3 } \big )$ on non-convex smooth functions, where $n$ denotes the number of nodes, $T$ the number of iterations, $\rho$ the spectral gap of the mixing matrix and $\delta$ the compression ratio. The main term, $\mathcal { O } \big ( \sqrt [ 1 ] { \sqrt { n T } } \big )$ , matches with the centralized baselines with exact communication and shows a linear speedup in the number of workers $n$ . Both $\rho$ and $\delta$ only affect the asymptotically smaller second term.
28
+ On the practical side, we present a version of CHOCO-SGD with momentum and analyze its practical performance on two relevant scenarios: $\circ$ for on-device training over a realistic peer-to-peer social network, where lowering the bandwidth requirements of joint training is especially impactful $\circ$ in a datacenter setting for computational scalability of training deep learning models for resource efficiency and improved time-to-accuracy
29
+ • Lastly, we systematically investigate performance of the decentralized schemes when scaling to larger number of nodes and we point out some (shared) difficulties encountered by current decentralized learning approaches.
30
+
31
+ # 2 RELATED WORK
32
+
33
+ For the training in communication restricted settings a variety of methods have been proposed. For instance, decentralized schemes (Lian et al., 2017; Nedic et al., 2018; Koloskova et al., 2019), ´ gradient compression (Seide et al., 2014; Strom, 2015; Alistarh et al., 2017; Wen et al., 2017; Lin et al., 2018; Wangni et al., 2018; Bernstein et al., 2018; Lin et al., 2018; Alistarh et al., 2018; Stich et al., 2018; Karimireddy et al., 2019), asynchronous methods (Recht et al., 2011; Assran et al., 2019) or performing multiple local SGD steps before averaging (Zhang et al., 2016; McMahan et al., 2017; Lin et al., 2020). This especially covers learning over decentralized data, as extensively studied in the federated learning literature for the centralized algorithms (McMahan et al., 2016). In this paper we advocate for combining decentralized SGD schemes with gradient compression.
34
+
35
+ Decentralized SGD. We in particular focus on approaches based on gossip averaging (Kempe et al., 2003; Xiao & Boyd, 2004; Boyd et al., 2006) whose convergence rate typically depends on the spectral gap $\rho \ge 0$ of the mixing matrix (Xiao & Boyd, 2004). Lian et al. (2017) combine SGD with gossip averaging and show that the leading term in the convergence rate $\mathcal { O } \big ( \sqrt [ 1 ] { \sqrt { n T } } \big )$ is consistent with the convergence of the centralized mini-batch SGD (Dekel et al., 2012) and the spectral gap only affects the asymptotically smaller terms. Similar results have been observed very recently for related schemes (Scaman et al., 2017; 2018; Koloskova et al., 2019; Yu et al., 2019).
36
+
37
+ Quantization. Communication compression with quantization has been popularized in the deep learning community by the reported successes in (Seide et al., 2014; Strom, 2015). Theoretical guarantees were first established for schemes with unbiased compression (Alistarh et al., 2017; Wen et al., 2017; Wangni et al., 2018) but soon extended to biased compression (Bernstein et al., 2018) as well. Schemes with error correction work often best in practice and give the best theoretical gurantees (Lin et al., 2018; Alistarh et al., 2018; Stich et al., 2018; Karimireddy et al., 2019). Recently, also proximal updates and variance reduction have been studied in combination with quantized updates (Mishchenko et al., 2019; Horváth et al., 2019).
38
+
39
+ Decentralized Optimization with Quantization. It has been observed that gossip averaging can diverge (or not converge to the correct solution) in the presence of quantization noise (Xiao et al., 2005; Carli et al., 2007; Nedic et al., 2008; Dimakis et al., 2010; Carli et al., 2010b; Yuan et al., 2012). ´ Reisizadeh et al. (2018) propose an algorithm that can still converge, though at a slower rate than the exact scheme. Another line of work proposed adaptive schemes (with increasing compression accuracy) that converge at the expense of higher communication cost (Carli et al., 2010a; Doan et al.,
40
+
41
+ 2018; Berahas et al., 2019). For deep learning applications, Tang et al. (2018) proposed the DCD and ECD algorithms that converge at the same rate as the centralized baseline though only for constant compression ratio. The CHOCO-SGD algorithm that we consider in this work can deal with arbitrary high compression, and has been introduced in (Koloskova et al., 2019) but only been analyzed for convex functions. For non-convex functions we show a rate of $\mathcal { O } \big ( { } ^ { 1 / \sqrt { n T } } + { } ^ { 1 / \vert } ( \rho ^ { 2 } \delta T ) ^ { \frac { 2 } { 3 } } \big )$ , where $\delta > 0$ measures the compression quality. Simultaneous work of Tang et al. (2019) introduced DeepSqueeze, an alternative method which also converges with arbitrary compression ratio. In our experiments, under the same amount of tuning, CHOCO-SGD achieves higher test accuracy.
42
+
43
+ # 3 CHOCO-SGD
44
+
45
+ In this section we formally introduce the decentralized optimization problem, compression operators, and the gossip-based stochastic optimization algorithm CHOCO-SGD from (Koloskova et al., 2019).
46
+
47
+ Distributed Setup. We consider optimization problems distributed across $n$ nodes of the form
48
+
49
+ $$
50
+ f ^ { \star } : = \operatorname* { m i n } _ { { \bf x } \in \mathbb { R } ^ { d } } \left[ f ( { \bf x } ) : = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } f _ { i } ( { \bf x } ) \right] , \qquad f _ { i } ( { \bf x } ) : = \mathbb { E } _ { \xi _ { i } \sim D _ { i } } F _ { i } ( { \bf x } , \xi _ { i } ) , \qquad \forall i \in [ n ] ,
51
+ $$
52
+
53
+ where $D _ { 1 } , \ldots D _ { n }$ are local distributions for sampling data which can be different on every node, $F _ { i } \colon \mathbb { R } ^ { d } \times \Omega \mathbb { R }$ are possibly non-convex (and non-identical) loss functions. This setting covers the important case of empirical risk minimization in distributed machine learning and deep learning applications.
54
+
55
+ Communication. Every device is only allowed to communicate with its local neighbours defined by the network topology, given as a weighted graph $G = ( [ n ] , E )$ , with edges $E$ representing the communication links along which messages (e.g. model updates) can be exchanged. We assign a positive weight $w _ { i j }$ to every edge $\mathbf { \nabla } _ { w _ { i j } } = 0$ for disconnected nodes $\{ i , j \} \not \in E )$ .
56
+
57
+ Assumption 1 (Mixing matrix). We assume that $W \in [ 0 , 1 ] ^ { n \times n }$ , $( W ) _ { i j } = w _ { i j }$ is a symmetric $( W = W ^ { \top }$ ) doubly stochastic $( W \mathbf { 1 } = \mathbf { 1 } , \mathbf { 1 } ^ { \top } W = \mathbf { 1 } ^ { \top }$ ) matrix with eigenvalues $1 = | \lambda _ { 1 } ( W ) | >$ $| \lambda _ { 2 } ( W ) | \ge \cdots \ge | \dot { \lambda } _ { n } ( W ) |$ and spectral gap $\rho : = 1 - | \lambda _ { 2 } ( W ) | \in ( 0 , 1 ]$ .
58
+
59
+ In our experiments we set the weights based on the local node degrees: $\begin{array} { r l } { w _ { i j } } & { { } = } \end{array}$ $\operatorname* { m a x } \{ \deg ( i ) , \deg ( j ) \} ^ { - 1 }$ for $\{ i , j \} \in E$ . This will not only guarantee $\rho > 0$ but these weights can easily be computed in a local fashion on each node (Xiao & Boyd, 2004).
60
+
61
+ Compression. We aim to only transmit compressed (e.g. quantized or sparsified) messages. We formalized this through the notion of compression operators that was e.g. also used in (Tang et al., 2018; Stich et al., 2018).
62
+
63
+ Definition 3.1 (Compression operator). $Q \colon { \mathbb { R } ^ { d } } \to { \mathbb { R } ^ { d } }$ is a compression operator if it satisfies
64
+
65
+ $$
66
+ \begin{array} { r } { \mathbb { E } _ { Q } \left\| Q ( \mathbf { x } ) - \mathbf { x } \right\| ^ { 2 } \leq \left( 1 - \delta \right) \left\| \mathbf { x } \right\| ^ { 2 } , } \end{array}
67
+ $$
68
+
69
+ $$
70
+ \forall \mathbf { x } \in \mathbb { R } ^ { d } ,
71
+ $$
72
+
73
+ for a parameter $\delta > 0$ . Here $\mathbb { E } _ { Q }$ denotes the expectation over the internal randomness of operator $Q$
74
+
75
+ In contrast to the quantization operators used in e.g. (Alistarh et al., 2017; Horváth et al., 2019), compression operators defined as in (2) are not required to be unbiased and therefore supports a larger class of compression operators. Some examples can be found in (Koloskova et al., 2019) and we further discuss specific compression schemes in Section 5.
76
+
77
+ Algorithm. CHOCO-SGD is summarized in Algorithm 1. Every worker $i$ stores its own private variable $\mathbf { x } _ { i } \in \mathbb { R } ^ { d }$ that is updated by a stochastic gradient step in part $\textcircled{2}$ and a modified gossip averaging step on line 2. This step is a key element of the algorithm as it preserves the averages of the iterates even in presence of quantization noise (the compression errors are not discarded, but aggregated in the local variables $\mathbf { x } _ { i }$ , see also (Koloskova et al., 2019)). The nodes communicate with their neighbors in part $\textcircled{1}$ and update the variables $\hat { \mathbf { x } } _ { j } \in \mathbb { R } ^ { d }$ for all their neighbors $\{ i , j \} \in E$ only using compressed updates. These $\hat { \mathbf { x } } _ { i }$ are available to all the neighbours of the node $i$ and represent the ‘publicly available’ copies of the private $\mathbf { x } _ { i }$ , in general $\mathbf { x } _ { i } \neq \hat { \mathbf { x } } _ { i }$ , due to the communication restrictions.
78
+
79
+ From an implementation aspect, it is worth highlighting that the communication part $\textcircled{1}$ and the gradient computation part $\textcircled{2}$ can both be executed in parallel because they are independent. Moreover,
80
+
81
+ # Algorithm 1 CHOCO-SGD (Koloskova et al., 2019)
82
+
83
+ input: Initial value $\overline { { \mathbf { x } } } ^ { ( - \frac { 1 } { 2 } ) } \in \mathbb { R } ^ { d } , \mathbf { x } _ { i } ^ { ( - \frac { 1 } { 2 } ) } = \overline { { \mathbf { x } } } ^ { ( - \frac { 1 } { 2 } ) }$ on each node $i \in [ n ]$ , consensus stepsize $\gamma$ , SGD stepsize $\eta$ communication graph $G = ( [ n ] , E )$ and mixing matrix $W$ , initialize $\hat { \mathbf { x } } _ { i } ^ { ( 0 ) } : = \mathbf { 0 } \forall i \in [ n ]$ 1: for $t$ in $0 \dots T - 1$ do {in parallel for all workers $i \in [ n ]$ } 2: $\begin{array} { r } { \mathbf { x } _ { i } ^ { ( t ) } : = \mathbf { x } _ { i } ^ { ( t - \frac { 1 } { 2 } ) } + \gamma \sum _ { j : \{ i , j \} \in E } w _ { i j } \big ( \hat { \mathbf { x } } _ { j } ^ { ( t ) } - \hat { \mathbf { x } } _ { i } ^ { ( t ) } \big ) } \end{array}$ / modified gossip averaging 3: $\mathbf { q } _ { i } ^ { ( t ) } : = { Q } ( \mathbf { x } _ { i } ^ { ( t ) } - \hat { \mathbf { x } } _ { i } ^ { ( t ) } )$ / compression 4: for neighbors $j \colon \{ i , j \} \in E$ (including $\{ i \} \in E )$ ) do
84
+ $\textcircled{1}$ 5: Send $\mathbf { q } _ { i } ^ { ( t ) }$ and receive $\mathbf { q } _ { j } ^ { ( t ) }$ / communication 6: $\hat { \mathbf { x } } _ { j } ^ { ( t + 1 ) } : = \mathbf { q } _ { j } ^ { ( t ) } + \hat { \mathbf { x } } _ { j } ^ { ( t ) }$ / local update 7: end for 8: Sample $\xi _ { i } ^ { ( t ) }$ , compute gradient $\mathbf { g } _ { i } ^ { ( t ) } : = \nabla F _ { i } ( \mathbf { x } _ { i } ^ { ( t ) } , \xi _ { i } ^ { ( t ) } )$
85
+ 2 9: i x(t+ 12 ) : = x (t) − ηg(t)i / stochastic gradient update 10: end for
86
+
87
+ each node only needs to store 3 vectors at most, independent of the number of neighbors (this might not be obvious from the notation used here for additinal clarity, for further details c.f. (Koloskova et al., 2019)). We further propose a momentum-version of CHOCO-SGD in Algorithm 2 (see also Section D for further details).
88
+
89
+ # 4 CONVERGENCE OF CHOCO-SGD ON SMOOTH NON-CONVEX PROBLEMS
90
+
91
+ As the first main contribution, we here extend the analysis of CHOCO-SGD to non-convex problems. For this we make the following technical assumptions:
92
+
93
+ Assumption 2. Each function $f _ { i } \colon { \mathbb { R } ^ { d } } \to { \mathbb { R } }$ for $i \in [ n ]$ is $L$ -smooth, that is
94
+
95
+ $$
96
+ \begin{array} { r } { \| \nabla f _ { i } ( \mathbf { y } ) - \nabla f _ { i } ( \mathbf { x } ) \| \leq L \left\| \mathbf { y } - \mathbf { x } \right\| , \qquad \forall \mathbf { x } , \mathbf { y } \in \mathbb { R } ^ { d } , i \in [ n ] , } \end{array}
97
+ $$
98
+
99
+ and the variance of the stochastic gradients is bounded on each worker:
100
+
101
+ $\begin{array} { r } { \mathbb { E } _ { \xi _ { i } } \left\| \nabla F _ { i } ( \mathbf { x } , \xi _ { i } ) - \nabla f _ { i } ( \mathbf { x } ) \right\| ^ { 2 } \leq \sigma _ { i } ^ { 2 } , \quad \mathbb { E } _ { \xi _ { i } } \left\| \nabla F _ { i } ( \mathbf { x } , \xi _ { i } ) \right\| ^ { 2 } \leq G ^ { 2 } , \quad \forall \mathbf { x } \in \mathbb { R } ^ { d } , i \in [ n ] , } \end{array}$ (3) where $\mathbb { E } _ { \xi _ { i } } [ \cdot ]$ denotes the expectation over $\xi _ { i } \sim \mathcal { D } _ { i }$ . We also denote $\textstyle { \overline { { \sigma } } } ^ { 2 } : = { \frac { 1 } { n } } \sum _ { i = 1 } ^ { n } \sigma _ { i } ^ { 2 }$ for convenience. Theorem 4.1. Under Assumptions $_ { I - 2 }$ there exists a constant stepsize $\eta$ and the consensus stepsize from (Koloskova et al., 2019), $\begin{array} { r } { \gamma : = \frac { \rho ^ { 2 } \delta } { 1 6 \rho + \rho ^ { 2 } + 4 \beta ^ { 2 } + 2 \rho \beta ^ { 2 } - 8 \rho \delta } } \end{array}$ with $\beta = \| I - W \| _ { 2 } \in [ 0 , 2 ]$ , such that the averaged iterates $\begin{array} { r } { \overline { { \mathbf { x } } } ^ { ( t ) } : = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \mathbf { x } _ { i } ^ { ( t ) } } \end{array}$ of Algorithm $I$ satisfy:
102
+
103
+ $$
104
+ \frac { 1 } { T + 1 } \sum _ { t = 0 } ^ { T } \left. \nabla f \left( \overline { { \mathbf { x } } } ^ { ( t ) } \right) \right. _ { 2 } ^ { 2 } = \mathcal { O } \left( \left( \frac { L F _ { 0 } \overline { { \sigma } } ^ { 2 } } { n ( T + 1 ) } \right) ^ { 1 / 2 } + \left( \frac { G L F _ { 0 } } { c ( T + 1 ) } \right) ^ { 2 / 3 } + \frac { L F _ { 0 } } { T + 1 } \right)
105
+ $$
106
+
107
+ where $c : = \frac { \rho ^ { 2 } \delta } { 8 2 }$ denotes the convergence rate of the underlying consensus averaging scheme of (Koloskova et al., 2019), $F _ { 0 } : = f ( \overline { { \mathbf { x } } } ^ { ( 0 ) } ) - f ^ { \star }$ .
108
+
109
+ This result shows that CHOCO-SGD converges as $\mathcal { O } \big ( { 1 } / { \sqrt { n T } } + { 1 } / ( { \rho ^ { 2 } } \delta T ) ^ { 2 / 3 } \big )$ . The first term shows a linear speed-up compared to SGD on a single node, while compression and graph topology affect only the higher order second term. By differently choosing the stepsize $\eta : = \sqrt { n } / \sqrt { T + 1 }$ we can recover asymptotic convergence rate of $\mathcal { O } \big ( 1 / \sqrt { n T } + n / ( \rho ^ { 4 } \delta ^ { 2 } T ) \big )$ . For the proofs and convergence of the individual iterates $\mathbf { x } _ { i }$ we refer to Appendix A.
110
+
111
+ # 5 COMPARISON TO BASELINES FOR VARIOUS COMPRESSION SCHEMES
112
+
113
+ In this section we experimentally compare CHOCO-SGD to the relevant baselines for a selection of commonly used compression operators. For the experiments we further leverage momentum in all implemented algorithms. The newly developed momentum version of CHOCO-SGD is given as Algorithm 2.
114
+
115
+ <table><tr><td>Algorithm2 CHoCO-SGD with Momentum</td></tr><tr><td>input: Same as for Algorithm 1,additionally: weight decay factor 入,momentum factor β, ():=0∀i ∈[n] local momentum memory</td></tr><tr><td>Lines1-8 in Algorithm1are leftunmodified</td></tr><tr><td>Line 9 in Algorithm 1 is replaced with the following two lines</td></tr><tr><td>(t+1) (t)</td></tr><tr><td>(gi &lt; local momentum with weight decay</td></tr><tr><td>10:Xi (t+) (t) (t+1) 一 &lt; stochastic gradient update</td></tr></table>
116
+
117
+ Setup. In order to match the setting in (Tang et al., 2018) for our first set of experiments, we use a ring topology with $n = 8$ nodes and train the ResNet20 architecture (He et al., 2016) on the Cifar10 dataset (50K/10K training/test samples) (Krizhevsky, 2012). We randomly split the training data between workers and shuffle it after every epoch, following standard procedure as e.g. in (Goyal et al., 2017). We implement DCD and ECD with momentum (Tang et al., 2018), DeepSqueeze with momentum (Tang et al., 2019), CHOCO-SGD with momentum (Algorithm 2) and standard (all-reduce) mini-batch SGD with momentum and without compression (Dekel et al., 2012). Our implementations are open-source and available at https://github.com/epfml/ ChocoSGD. The momentum factor is set to 0.9 without dampening. For all algorithms we fine-tune the initial learning rate and gradually warm it up from a relative small value (0.1) (Goyal et al., 2017) for the first 5 epochs. The learning rate is decayed by 10 twice, at 150 and 225 epochs, and stop training at 300 epochs. For CHOCO-SGD and DeepSqueeze the consensus learning rate $\gamma$ is also tuned. The detailed hyper-parameter tuning procedure refers to Appendix F. Every compression scheme is applied to every layer of $\mathtt { R e s N e t 2 0 }$ separately. We evaluate the top-1 test accuracy on every node separately over the whole dataset and report the average performance over all nodes.
118
+
119
+ Compression Schemes. We implement two unbiased compression schemes: (i) ${ \mathrm { g s g d } } _ { b }$ quantization that randomly rounds the weights to $b$ -bit representations (Alistarh et al., 2017), and (ii) random $^ { - a }$ sparsification, which preserves a randomly chosen $a$ fraction of the weights and sets the other ones to zero (Wangni et al., 2018). Further two biased compression schemes: (iii) $\mathrm { t o p } _ { a }$ , which selects the $a$ fraction of weights with the largest magnitude and sets the other ones to zero (Alistarh et al., 2018; Stich et al., 2018), and (iv) sign compression, which compresses each weight to its sign scaled by the norm of the full vector (Bernstein et al., 2018; Karimireddy et al., 2019). We refer to Appendix C for exact definitions of the schemes.
120
+
121
+ DCD and ECD have been analyzed only for unbiased quantization schemes, thus the combination with the two biased schemes is not supported by theory. In converse, CHOCO-SGD and DeepSqueeze has been studied only for biased schemes according to Definition 2. However, both unbiased compression schemes can be scaled down in order to meet the specification (cf. discussions in (Stich et al., 2018; Koloskova et al., 2019)) and we adopt this for the experiments.
122
+
123
+ Results. The results are summarized in Tab. 1. For unbiased compression schemes, ECD and DCD only achieve good performance when the compression ratio is small, and sometimes even diverge when the compression ratio is high. This is consistent1 with the theoretical and experimental results in (Tang et al., 2018). We further observe that the performance of DCD with the biased $\mathrm { t o p } _ { a }$ sparsification is much better than with the unbiased random $^ a$ counterpart, though this operator is not yet supported by theory.
124
+
125
+ CHOCO-SGD can generalize reasonably well in all scenarios (at most $1 . 6 5 \%$ accuracy drop) for fixed training budget. The sign compression achieves state-of-the-art accuracy and requires approximately $3 2 \times$ less bits per weight than the full precision baseline.
126
+
127
+ Table 1: Top-1 test accuracy for decentralized DCD, ECD, DeepSqueeze and CHOCO-SGD with different compression schemes. Reported top-1 test accuracies are averaged over three runs with fine-tuned hyperparameters (learning rate, weight decay, consensus stepsize). The fine-tuned all-reduce baseline reaches accuracy 92.64, with 1.04 MB gradient transmission per iteration. ( $\star$ indicates that 2 out of 3 runs diverged).
128
+
129
+ <table><tr><td rowspan="2">Algorithm</td><td rowspan="2">Error- feedback</td><td colspan="4">Quantization (QSGD)</td><td colspan="3">Sparsification (random-%)</td></tr><tr><td>16 bits</td><td>8 bits</td><td>4 bits</td><td>2 bits</td><td>50%</td><td>10%</td><td>1%</td></tr><tr><td colspan="2">transmitted data/iteration</td><td>0.52MB</td><td>0.26MB</td><td>0.13MB</td><td>0.065MB</td><td>1.04 MB</td><td>0.21MB</td><td>0.031MB</td></tr><tr><td>DCD-PSGD</td><td></td><td>92.51 ± 0.05</td><td>92.36 ±0.28</td><td>23.56 ± 2.97</td><td>diverges</td><td>92.05 ± 0.25</td><td>diverges</td><td>diverges</td></tr><tr><td>ECD-PSGD</td><td></td><td>92.02 ± 0.14</td><td>59.11 ± 1.57</td><td>diverges</td><td>diverges</td><td>diverges</td><td>diverges</td><td>diverges</td></tr><tr><td>DeepSqueeze CHOCO-SGD</td><td>xx&lt;/</td><td>92.27 ± 0.21</td><td>91.83 ± 0.35</td><td>91.47 ± 0.21</td><td>90.96 ± 0.19</td><td>91.46 ± 0.09</td><td>90.96±0.16</td><td>88.55 ± 0.11</td></tr><tr><td></td><td></td><td>92.34± 0.19</td><td>92.30±0.08</td><td>91.92 ± 0.27</td><td>91.41 ± 0.11</td><td>92.54± 0.26</td><td>91.87 ± 0.21</td><td>91.32 ± 0.17</td></tr><tr><td rowspan="2">Algorithm</td><td>Error-</td><td colspan="3">Sparsification (top-%)</td><td>Sign+Norm</td><td colspan="3"></td></tr><tr><td>feedback</td><td>50%</td><td>10%</td><td>1%</td><td>=</td><td></td><td></td><td></td></tr><tr><td colspan="2">transmitted data/iteration</td><td>1.04 MB</td><td>0.21MB</td><td>0.031MB</td><td>0.032MB</td><td></td><td></td><td></td></tr><tr><td colspan="2">DCD-PSGD</td><td>92.40 ± 0.11</td><td>91.97 ± 0.14</td><td>89.79 ± 0.40</td><td>92.40 ± 0.14</td><td></td><td></td><td></td></tr><tr><td colspan="2">ECD-PSGD</td><td>17.03*</td><td>16.78*</td><td>18.03*</td><td>diverges</td><td></td><td></td><td></td></tr><tr><td colspan="2">DeepSqueeze</td><td></td><td>91.31 ± 0.25</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td colspan="2">CHOCO-SGD</td><td>公</td><td>91.55 ± 0.28 92.54 ± 0.26</td><td>92.29 ± 0.05</td><td>90.47 ± 0.17 91.73 ± 0.11</td><td>91.38 ± 0.19 92.46 ± 0.10</td><td></td><td></td></tr></table>
130
+
131
+ # 6 USE CASE I: ON-DEVICE PEER-TO-PEER LEARNING
132
+
133
+ We now shift our focus to challenging real-world scenarios which are intrinsically decentralized, i.e. each part of the training data remains local to each device, and thus centralized methods either fail or are inefficient to implement. Typical scenarios comprise e.g. sensor networks, or mobile devices or hospitals which jointly train a machine learning model. Common to these applications is that i) each device has only access to locally stored or acquired data, ii) communication bandwidth is limited (either physically, or artificially for e.g. metered connections), iii) the global network topology is typically unknown to a single device, and iv) the number of connected devices is typically large. Additionally, this fully decentralized setting is also strongly motivated by privacy aspects, enabling to keep the training data private on each device at all times.
134
+
135
+ Modeling. To simulate this scenario, we permanently split the training data between the nodes, i.e. the data is never shuffled between workers during training, and every node has distinct part of the dataset. To the best of our knowledge, no prior works studied this scenario for decentralized deep learning. For the centralized approach, gathering methods such as all-reduce are not efficiently implementable in this setting, hence we compare to the centralized baseline where all nodes route their updates to a central coordinator for aggregation. For the comparison we consider CHOCO-SGD with sign compression (this combination achieved the compromise between accuracy and compression level in Tab. 1)), decentralized SGD without compression (Lian et al., 2017), and centralized SGD without compression.
136
+
137
+ Scaling to Large Number of Nodes. To study the scaling properties of CHOCOSGD, we train on 4, 16, 36 and 64 number of nodes. We compare decentralized algorithms on two different topologies: ring as the worst possible topology, and on the torus with much larger spectral gap. Their parameters are listed in the table 2.
138
+
139
+ We train ResNet8 (He et al., 2016) (78K parameters), on Cifar10 dataset (50K/10K training/test samples) (Krizhevsky, 2012). For the simplicity, we keep the learning rate constant and separately tune it for all methods. We tune consensus learning rate for CHOCO-SGD.
140
+
141
+ Table 2: Summary of communication topologies.
142
+
143
+ <table><tr><td>Topology</td><td></td><td colspan="4">spectral gapp</td></tr><tr><td></td><td>max. node degree</td><td>n=4</td><td>n=16</td><td>n=36</td><td>n=64</td></tr><tr><td>ring</td><td>2</td><td>0.67</td><td>0.05</td><td>0.01</td><td>0.003</td></tr><tr><td>torus</td><td>4</td><td>0.67</td><td>0.4</td><td>0.2</td><td>0.12</td></tr><tr><td>fully-connected</td><td>d</td><td>1</td><td>1</td><td>1</td><td>1</td></tr></table>
144
+
145
+ The results are summarized in Fig. 1 (and Fig. 6, Tabs. 7–8 in Appendix G). First we compare the testing accuracy reached after 300 epochs (Fig. 1, Left). CentralizedSGD has a good performance for all the considered number of nodes. CHOCO-SGD slows down due to the influence of graph topology (Decentralized curve), which is consistent with the spectral gaps order (see Tab. 2), and also influenced by the communication compression (CHOCO curve), which slows down training uniformly for both topologies. We observed that the train performance is similar to the test on Fig. 1, therefore the performance degradation is explained by the slower convergence (Theorem 4.1) and is not a generalization issue. Increasing the number of epochs improves the performance of the decentralized schemes. However, even using 10 times more epochs, we were not able to perfectly close the gap between centralized and decentralized algorithms for both train and test performance.
146
+
147
+ ![](images/345b6a0f121c3a279e076e0ed91edd56e9d8d570dc99a893fe5ea599cf1d452c.jpg)
148
+ Figure 1: Scaling of CHOCO-SGD with sign compression to large number of devices on Cifar10 dataset. Left: best testing accuracy of the algorithms reached after 300 epochs. Right: best testing accuracy reached after communicating $1 0 0 0 \mathbf { M B }$ .
149
+
150
+ In the real decentralized scenario, the interest is not to minimize the epochs number, but the amount of communication to reduce the cost of the user’s mobile data. We therefore fix the number of transmitted bits to $1 0 0 0 { \mathrm { M B } }$ and compare the best testing accuracy reached (Fig. 1, Right). CHOCOSGD performs the best while having slight degradation due to increasing number of nodes. It is beneficial to use torus topology when the number of nodes is large because it has good mixing properties, for small networks there is not much difference between these two topologies—the benefit of large spectral gap is canceled by the increased communication due larger node degree for torus topology. Both Decentralized and Centralized SGD requires significantly larger number of bits to reach reasonable accuracy.
151
+
152
+ Experiments on a Real Social Network Graph. We simulate training models on user devices (e.g. mobile phones), connected by a real social network. We chosen Davis Southern women social network (Davis et al., 1941) with 32 nodes. We train ResNet20 (0.27 million parameters) model on the Cifar10 dataset (50K/10K training/test samples) (Krizhevsky, 2012) for image classification and a three-layer LSTM architecture (Hochreiter & Schmidhuber, 1997) (28.95 million parameters) for a language modeling task on WikiText-2 (600 training and 60 validation articles with a total of $2 ^ { \prime } 0 8 8 ^ { \prime } 6 2 8$ and $2 1 7 ^ { \prime } 6 \hat { 4 } 6$ tokens respectively) (Merity et al., 2016). The depicted curves of the training loss are the averaged local loss over all workers (local model with fixed local data); the test performance uses the mean of the evaluations for local models on whole test dataset. For more detailed experimental setup we refer to Appendix F.
153
+
154
+ The results are summarized in Figs. 2–3 and in Tab. 3. For the image classification task, when comparing the training accuracy reached after the same number of epochs, we observe that the decentralized algorithm performs best, follows by the centralized and lastly the quantized decentralized. However, the test accuracy is highest for the centralized scheme. When comparing the test accuracy reached for the same transmitted data2, CHOCO-SGD significantly outperforms the exact decentralized scheme, with the centralized performing worst. We note a slight accuracy drop, i.e. after the same number of epochs (but much less transmitted data), CHOCO-SGD does not reach the same level of test accuracy than the baselines.
155
+
156
+ For the language modeling task, both decentralized schemes suffer a drop in the training loss when the evaluation reaching the epoch budget; while our CHOCO-SGD outperforms the centralized SGD in test perplexity. When considering perplexity for a fixed data volume (middle and right subfigure of Fig. 3), CHOCO-SGD performs best, followed by the exact decentralized and centralized algorithms.
157
+
158
+ On Figure 4 we additionally depict the test accuracy of the averaged model $\begin{array} { r } { \overline { { \mathbf { x } } } ^ { ( t ) } = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \mathbf { x } _ { i } ^ { ( t ) } } \end{array}$ (left) and averaged distance of the local models from the averaged model (right), for CHOCO-SGD on image classification task. Towards the end of the optimization the local models reach consensus (Figure 4, right), and their individual test performances are the same as performance of averaged model. Interestingly, before decreasing the stepsize at the epoch 225, the local models are in general diverging from the averaged model, while decreasing only when the stepsize decreases. The same behavior was also reported in Assran et al. (2019).
159
+
160
+ ![](images/b42f450209e3634b091031515777263141ce939df94cd920f2b516bdb38bea6e.jpg)
161
+ Figure 2: Image classification: ResNet-20 on CIFAR-10 on social network topology.
162
+
163
+ ![](images/69fb0c5de0d6ca416f328814602fc6e44a04f7931ddbf5f433437e994f80800a.jpg)
164
+ Figure 3: Language modeling: LSTM on WikiText-2 on social network topology.
165
+
166
+ ![](images/71f89a79e2ee2e901ca995efa02d18fe1e48f1960defbdc38c92f07250062b6e.jpg)
167
+ Figure 4: Parameter deviations for Resnet20 trained on Cifar10 (using CHOCO-SGD) on social network topology (32 workers). (Left) performance of the averaged model compared to the average of performances of local models. (Right) parameters divergence: averaged $L _ { 2 }$ consensus distance between local models $\mathbf { x } _ { i }$ and the averaged model $\begin{array} { r } { \overline { { \mathbf { x } } } = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \mathbf { x } _ { i } } \end{array}$ , i.e., $\begin{array} { r } { \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \| \mathbf { x } _ { i } - \bar { \mathbf { x } } \| _ { 2 } ^ { 2 } } \end{array}$ .
168
+
169
+ # 7 USE CASE II: EFFICIENT LARGE-SCALE TRAINING IN A DATACENTER
170
+
171
+ Decentralized optimization methods offer a way to address scaling issues even for well connected devices, such as e.g. in datacenter with fast InfiniBand (100Gbps) or Ethernet (10Gbps) connections. Lian et al. (2017) describe scenarios when decentralized schemes can outperform centralized ones, and recently, Assran et al. (2019) presented impressive speedups for training on 256 GPUs, for the setting when all nodes can access all training data. The main differences of their algorithm to CHOCO-SGD are the asynchronous gossip updates, time-varying communication topology and most importantly exact communication, making their setup not directly comparable to ours. We note that these properties of asynchronous communication and changing topology for faster mixing are orthogonal to our contribution, and offer promise to be combined.
172
+
173
+ Setup. We train ImageNet $- 1 \mathrm { k }$ (1.28M/50K training/validation) (Deng et al., 2009) with Resnet-50 (He et al., 2016). We perform our experiments on 8 machines (n1-standard-32 from Google Cloud with Intel Ivy Bridge CPU platform), where each of machines has 4 Tesla P100
174
+
175
+ ![](images/7fdaa3434c9668988857381c622ccca300d544547af8de646a4b2f76acf8117e.jpg)
176
+ Figure 5: Large-scale training: Resnet-50 on ImageNet $- 1 \mathrm { k }$ in the datacenter setting. The topology has 8 nodes (each accesses 4 GPUs). We use sign as the compression scheme, for CHOCOSGD and Centralized SGD. For centralized SGD baseline without compression, we use all-reduce to aggregate the gradients; we use all-gather for centralized SGD with sign gradients quantization. The benefits of CHOCO-SGD can be further pronounced when scaling to more nodes.
177
+
178
+ GPUs and each machine interconnected via 10Gbps Ethernet. Within one machine communication is fast and we rely on the local data parallelism to aggregate the gradients for the later gradients communication (over the machines). Between different machines we consider centralized (fully connected topology) and decentralized (ring topology) communication, with and without compressed communication (sign compression). Several methods categorized by communication schemes are evaluated: (i) centralized SGD (full-precision communication), (ii) error-feedback centralized SGD with compressed communications Karimireddy et al. (2019) through sign compression, (iii) decentralized SGD (Lian et al., 2017) with parallelized forward pass and gradients communication (full-precision communication), and (iv) CHOCO-SGD with sign compressed communications. The mini-batch size on each GPU is 128, and we follow the general SGD training scheme in (Goyal et al., 2017) and directly use all their hyperparameters for all evaluated methods. Due to the limitation of the computational resource, we did not heavily tune the consensus stepsize for CHOCO-SGD3.
179
+
180
+ Results. We depict the training loss and top-1 test accuracy in terms of epochs and time in Fig. 5. CHOCO-SGD benefits from its decentralized and parallel structure and takes less time than all-reduce to perform the same number of epochs, while having only a slight $1 . 5 \%$ accuracy loss4. In terms of time per epoch, our speedup does not match that of (Assran et al., 2019), as the used hardware and the communication pattern5 are very different. Their scheme is orthogonal to our approach and could be integrated for better training efficiency. Nevertheless, we still demonstrate a time-wise $20 \%$ gain over the common all-reduce baseline, on our used commodity hardware cluster.
181
+
182
+ # 8 CONCLUSION
183
+
184
+ We propose the use of CHOCO-SGD (and its momentum version) for enabling decentralized deep learning training in bandwidth-constrained environments. We provide theoretical convergence guarantees for the non-convex setting and show that the algorithm enjoys linear speedup in the number of nodes. We empirically study the performance of the algorithm in a variety of settings on the image classification (ImageNet-1k, Cifar10) and on the language modeling task (WikiText-2). Whilst previous work successfully demonstrated that decentralized methods can be a competitive alternative to centralized training schemes when no communication constraints are present (Lian et al., 2017; Assran et al., 2019), our main contribution is to enable training in strongly communicationrestricted environments, and while respecting the challenging constraint of locality of the training data. We theoretically and practically demonstrate the performance of decentralized schemes for arbitrary high communication compression, and under data-locality, and thus significantly expand the reach of potential applications of fully decentralized deep learning.
185
+
186
+ # ACKNOWLEDGEMENTS
187
+
188
+ We acknowledge funding from SNSF grant 200021_175796, as well as a Google Focused Research Award.
189
+
190
+ # REFERENCES
191
+
192
+ Dan Alistarh, Demjan Grubic, Jerry Li, Ryota Tomioka, and Milan Vojnovic. QSGD: Communication-efficient SGD via gradient quantization and encoding. In NIPS - Advances in Neural Information Processing Systems 30, pp. 1709–1720. Curran Associates, Inc., 2017.
193
+
194
+ Dan Alistarh, Torsten Hoefler, Mikael Johansson, Nikola Konstantinov, Sarit Khirirat, and Cedric Renggli. The convergence of sparsified gradient methods. In NeurIPS - Advances in Neural Information Processing Systems 31, pp. 5977–5987. Curran Associates, Inc., 2018.
195
+
196
+ Mahmoud Assran, Nicolas Loizou, Nicolas Ballas, and Mike Rabbat. Stochastic gradient push for distributed deep learning. In ICML - Proceedings of the 36th International Conference on Machine Learning, volume 97, pp. 344–353. PMLR, 09–15 Jun 2019.
197
+
198
+ Albert S. Berahas, Charikleia Iakovidou, and Ermin Wei. Nested distributed gradient methods with adaptive quantized communication. arXiv preprint, pp. arXiv:1903.08149, 2019.
199
+
200
+ Jeremy Bernstein, Yu-Xiang Wang, Kamyar Azizzadenesheli, and Animashree Anandkumar. signSGD: Compressed optimisation for non-convex problems. In Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pp. 560–569, Stockholmsmässan, Stockholm Sweden, 10–15 Jul 2018. PMLR.
201
+
202
+ Stephen Boyd, Arpita Ghosh, Balaji Prabhakar, and Devavrat Shah. Randomized gossip algorithms. IEEE/ACM Trans. Netw., 14(SI):2508–2530, June 2006.
203
+
204
+ R. Carli, F. Fagnani, P. Frasca, T. Taylor, and S. Zampieri. Average consensus on networks with transmission noise or quantization. In 2007 European Control Conference (ECC), pp. 1852–1857, July 2007.
205
+
206
+ R. Carli, F. Bullo, and S. Zampieri. Quantized average consensus via dynamic coding/decoding schemes. International Journal of Robust and Nonlinear Control, 20:156–175, 2010a.
207
+
208
+ R. Carli, P. Frasca, F. Fagnani, and S. Zampieri. Gossip consensus algorithms via quantized communication. Automatica, 46:70–80, 2010b.
209
+
210
+ A. Davis, B. B. Gardner, and M. R. Gardner. Deep South. University of Chicago Press, Chicago, IL., May 1941.
211
+
212
+ Ofer Dekel, Ran Gilad-Bachrach, Ohad Shamir, and Lin Xiao. Optimal distributed online prediction using mini-batches. J. Mach. Learn. Res., 13(1):165–202, January 2012.
213
+
214
+ 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.
215
+
216
+ A. G. Dimakis, S. Kar, J. M. F. Moura, M. G. Rabbat, and A. Scaglione. Gossip algorithms for distributed signal processing. Proceedings of the IEEE, 98(11):1847–1864, Nov 2010.
217
+
218
+ Thinh T. Doan, Siva Theja Maguluri, and Justin Romberg. Accelerating the Convergence Rates of Distributed Subgradient Methods with Adaptive Quantization. arXiv e-prints, art. arXiv:1810.13245, Oct 2018.
219
+
220
+ Priya Goyal, Piotr Dollár, Ross Girshick, Pieter Noordhuis, Lukasz Wesolowski, Aapo Kyrola, Andrew Tulloch, Yangqing Jia, and Kaiming He. Accurate, large minibatch SGD: Training ImageNet in 1 hour. arXiv preprint arXiv:1706.02677, 2017.
221
+
222
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 770–778, 2016.
223
+
224
+ Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural computation, 9:1735–80, 12 1997.
225
+
226
+ Samuel Horváth, Dmitry Kovalev, Konstantin Mishchenko, Peter Richtárik, and Sebastian Urban Stich. Stochastic distributed learning with gradient quantization and variance reduction. arXiv preprint, pp. arXiv:1904.05115, 2019.
227
+
228
+ Sai Praneeth Karimireddy, Quentin Rebjock, Sebastian Stich, and Martin Jaggi. Error feedback fixes SignSGD and other gradient compression schemes. In ICML - Proceedings of the 36th International Conference on Machine Learning, volume 97, pp. 3252–3261. PMLR, 09–15 Jun 2019.
229
+
230
+ David Kempe, Alin Dobra, and Johannes Gehrke. Gossip-based computation of aggregate information. In Proceedings of the 44th Annual IEEE Symposium on Foundations of Computer Science, FOCS ’03, pp. 482–, Washington, DC, USA, 2003. IEEE Computer Society.
231
+
232
+ Anastasia Koloskova, Sebastian Stich, and Martin Jaggi. Decentralized stochastic optimization and gossip algorithms with compressed communication. In ICML - Proceedings of the 36th International Conference on Machine Learning, volume 97, pp. 3478–3487. PMLR, 2019.
233
+
234
+ Alex Krizhevsky. Learning multiple layers of features from tiny images. University of Toronto, 05 2012.
235
+
236
+ Xiangru Lian, Ce Zhang, Huan Zhang, Cho-Jui Hsieh, Wei Zhang, and Ji Liu. Can decentralized algorithms outperform centralized algorithms? a case study for decentralized parallel stochastic gradient descent. In NIPS - Advances in Neural Information Processing Systems 30, pp. 5330–5340. Curran Associates, Inc., 2017.
237
+
238
+ Tao Lin, Sebastian U. Stich, Kumar Kshitij Patel, and Martin Jaggi. Don’t use large mini-batches, use local SGD. In ICLR - International Conference on Learning Representations, 2020.
239
+
240
+ Yujun Lin, Song Han, Huizi Mao, Yu Wang, and Bill Dally. Deep gradient compression: Reducing the communication bandwidth for distributed training. In ICLR 2018 - International Conference on Learning Representations, 2018.
241
+
242
+ Brendan McMahan, Eider Moore, Daniel Ramage, Seth Hampson, and Blaise Aguera y Arcas. CommunicationEfficient Learning of Deep Networks from Decentralized Data. In AISTATS 2017 - Proceedings of the 20th International Conference on Artificial Intelligence and Statistics, pp. 1273–1282, 2017.
243
+
244
+ H. Brendan McMahan, Eider Moore, Daniel Ramage, and Blaise Agüera y Arcas. Federated learning of deep networks using model averaging. CoRR, abs/1602.05629, 2016.
245
+
246
+ Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer sentinel mixture models. arXiv preprint arXiv:1609.07843, 2016.
247
+
248
+ Stephen Merity, Nitish Shirish Keskar, and Richard Socher. Regularizing and optimizing LSTM language models. arXiv preprint, pp. arXiv:1708.02182, 2017.
249
+
250
+ Konstantin Mishchenko, Eduard Gorbunov, Martin Takác, and Peter Richtárik. Distributed learning with ˇ compressed gradient differences. arXiv e-prints, pp. arXiv:1901.09269, 2019.
251
+
252
+ A. Nedic, A. Olshevsky, and M. G. Rabbat. Network topology and communication-computation tradeoffs in ´ decentralized optimization. Proceedings of the IEEE, 106(5):953–976, May 2018.
253
+
254
+ Angelia Nedic, Alex Olshevsky, Asuman Ozdaglar, and John N. Tsitsiklis. Distributed subgradient methods and ´ quantization effects. In Proceedings of the 47th IEEE Conference on Decision and Control, CDC 2008, pp. 4177–4184, 2008.
255
+
256
+ Benjamin Recht, Christopher Re, Stephen Wright, and Feng Niu. Hogwild: A lock-free approach to parallelizing stochastic gradient descent. In NIPS - Advances in Neural Information Processing Systems 24, pp. 693–701. Curran Associates, Inc., 2011.
257
+
258
+ Amirhossein Reisizadeh, Aryan Mokhtari, Hamed Hassani, and Ramtin Pedarsani. An exact quantized decentralized gradient descent algorithm. arXiv e-prints, pp. arXiv:1806.11536, 2018.
259
+
260
+ Amirhossein Reisizadeh, Hossein Taheri, Aryan Mokhtari, Hamed Hassani, and Ramtin Pedarsani. Robust and communication-efficient collaborative learning. arXiv e-prints, pp. arXiv:1907.10595, 2019.
261
+
262
+ Kevin Scaman, Francis Bach, Sébastien Bubeck, Yin Tat Lee, and Laurent Massoulié. Optimal algorithms for smooth and strongly convex distributed optimization in networks. In Proceedings of the 34th International Conference on Machine Learning, volume 70 of Proceedings of Machine Learning Research, pp. 3027–3036, International Convention Centre, Sydney, Australia, 06–11 Aug 2017. PMLR.
263
+
264
+ Kevin Scaman, Francis Bach, Sebastien Bubeck, Laurent Massoulié, and Yin Tat Lee. Optimal algorithms for non-smooth distributed optimization in networks. In NeurIPS - Advances in Neural Information Processing Systems 31, pp. 2745–2754. Curran Associates, Inc., 2018.
265
+
266
+ Frank Seide, Hao Fu, Jasha Droppo, Gang Li, and Dong Yu. 1-bit stochastic gradient descent and its application to data-parallel distributed training of speech DNNs. In INTERSPEECH, pp. 1058–1062. ISCA, 2014.
267
+
268
+ Sebastian U Stich and Sai Praneeth Karimireddy. The error-feedback framework: Better rates for SGD with delayed gradients and compressed communication. arXiv preprint, pp. arXiv:1909.05350, 2019.
269
+
270
+ Sebastian U Stich, Jean-Baptiste Cordonnier, and Martin Jaggi. Sparsified SGD with memory. In NeurIPS - Advances in Neural Information Processing Systems 31, pp. 4452–4463. 2018.
271
+ Nikko Strom. Scalable distributed DNN training using commodity GPU cloud computing. In INTERSPEECH, pp. 1488–1492. ISCA, 2015.
272
+ Hanlin Tang, Shaoduo Gan, Ce Zhang, Tong Zhang, and Ji Liu. Communication compression for decentralized training. In NeurIPS - Advances in Neural Information Processing Systems 31, pp. 7663–7673. Curran Associates, Inc., 2018.
273
+ Hanlin Tang, Xiangru Lian, Shuang Qiu, Lei Yuan, Ce Zhang, Tong Zhang, and Ji Liu. Deepsqueeze: Decentralization meets error-compensated compression. arXiv preprint, pp. arXiv:1907.07346, 2019.
274
+ Jianyu Wang, Anit Kumar Sahu, Zhouyi Yang, Gauri Joshi, and Soummya Kar. An exact quantized decentralized gradient descent algorithm. arXiv e-prints, pp. arXiv:1905.09435, 2019.
275
+ Jianqiao Wangni, Jialei Wang, Ji Liu, and Tong Zhang. Gradient sparsification for communication-efficient distributed optimization. In NeurIPS - Advances in Neural Information Processing Systems 31, pp. 1306–1316. Curran Associates, Inc., 2018.
276
+ Wei Wen, Cong Xu, Feng Yan, Chunpeng Wu, Yandan Wang, Yiran Chen, and Hai Li. Terngrad: Ternary gradients to reduce communication in distributed deep learning. In NIPS - Advances in Neural Information Processing Systems 30, pp. 1509–1519. Curran Associates, Inc., 2017.
277
+ L. Xiao, S. Boyd, and S. Lall. A scheme for robust distributed sensor fusion based on average consensus. In IPSN 2005. Fourth International Symposium on Information Processing in Sensor Networks, 2005., pp. 63–70, April 2005.
278
+ Lin Xiao and Stephen Boyd. Fast linear iterations for distributed averaging. Systems & Control Letters, 53(1): 65–78, 2004.
279
+ Hao Yu, Rong Jin, and Sen Yang. On the linear speedup analysis of communication efficient momentum SGD for distributed non-convex optimization. In ICML - Proceedings of the 36th International Conference on Machine Learning, volume 97, pp. 7184–7193. PMLR, 09–15 Jun 2019.
280
+ Deming Yuan, Shengyuan Xu, Huanyu Zhao, and Lina Rong. Distributed dual averaging method for multi-agent optimization with quantized communication. Systems & Control Letters, 61(11):1053 – 1061, 2012.
281
+ Jian Zhang, Christopher De Sa, Ioannis Mitliagkas, and Christopher Ré. Parallel SGD: When does averaging help? arxiv preprint, 2016.
282
+
283
+ # A CONVERGENCE OF CHOCO-SGD
284
+
285
+ In this section we present the proof of Theorem 4.1. For this, we will first derive a slightly more general statement: in Theorem A.3 we analyze CHOCO-SGD for arbitrary stepsizes $\eta$ , and then derive Theorem 4.1 as a special case.
286
+
287
+ The structure of the proof follows Koloskova et al. (2019). That is, we first show that Algorithm 1 is a special case of a more general class of algorithms (given in Algorithm 3): Observe that Algorithm 1 consists of two main components: $\textcircled{2}$ the stochastic gradient update, performed locally on each node, and $\textcircled{1}$ the (quantized) averaging among the nodes. We can show convergence of all algorithms of this type—i.e. stochastic gradient updates $\textcircled{2}$ followed by an arbitrary averaging step $\textcircled{1}$ —as long as the averaging scheme exhibits linear convergence. For the specific averaging used in CHOCO-SGD, linear convergence has been shown in (Koloskova et al., 2019) and we will use their estimate of the convergence rate of the averaging scheme.
288
+
289
+ A.1 A GENERAL FRAMEWORK FOR DECENTRALIZED SGD WITH ARBITRARY AVERAGING
290
+
291
+ For convenience, we use the following matrix notation in this subsection.
292
+
293
+ $$
294
+ \begin{array} { r } { X ^ { ( t ) } : = \left[ \mathbf { x } _ { 1 } ^ { ( t ) } , \ldots , \mathbf { x } _ { n } ^ { ( t ) } \right] \in \mathbb { R } ^ { d \times n } , \qquad \overline { { X } } ^ { ( t ) } : = \left[ \overline { { \mathbf { x } } } ^ { ( t ) } , \ldots , \overline { { \mathbf { x } } } ^ { ( t ) } \right] \in \mathbb { R } ^ { d \times n } , } \\ { \partial F ( X ^ { ( t ) } , \xi ^ { ( t ) } ) : = \left[ \nabla F _ { 1 } ( \mathbf { x } _ { 1 } ^ { ( t ) } , \xi _ { 1 } ^ { ( t ) } ) , \ldots , \nabla F _ { n } ( \mathbf { x } _ { n } ^ { ( t ) } , \xi _ { n } ^ { ( t ) } ) \right] \in \mathbb { R } ^ { d \times n } . } \end{array}
295
+ $$
296
+
297
+ Decentralized SGD with arbitrary averaging is given in Algorithm 3.
298
+
299
+ # Algorithm 3 DECENTRALIZED SGD WITH ARBITRARY AVERAGING SCHEME
300
+
301
+ input: $X ^ { ( 0 ) } = \left[ \mathbf { x } ^ { ( 0 ) } , \ldots , \mathbf { x } ^ { ( 0 ) } \right]$ , stepsize $\eta$ , averaging function $h : \mathbb { R } ^ { d \times n } \times \mathbb { R } ^ { d \times n } \mathbb { R } ^ { d \times n } \times \mathbb { R } ^ { d \times n }$ initialize $Y ^ { ( 0 ) } = 0$ 1: for $t$ in $0 \dots T - 1$ do {in parallel for all workers $i \in [ n ]$ }
302
+ $\textcircled{2}$ 2: { $X ^ { ( t + \frac { 1 } { 2 } ) } = X ^ { ( t ) } - \eta \partial F _ { i } ( X ^ { ( t ) } , \xi ^ { ( t ) } )$ / stochastic gradient updates
303
+ $\textcircled{1}$ 3: { $( X ^ { ( t + 1 ) } , Y ^ { ( t + 1 ) } ) = h ( X ^ { ( t + \frac { 1 } { 2 } ) } , Y ^ { ( t ) } )$ / blackbox averaging/gossip 4: end for
304
+
305
+ Assumption 3. For an averaging scheme $h \colon \mathbb R ^ { d \times n } \times \mathbb R ^ { d \times n } \to \mathbb R ^ { d \times n } \times \mathbb R ^ { d \times n }$ let $( X ^ { + } , Y ^ { + } ) : =$ $h ( X , Y )$ for $X , Y \in \mathbb { R } ^ { d \times n }$ . Assume that $h$ preserves the average of iterates:
306
+
307
+ $$
308
+ X ^ { + } { \frac { \mathbf { 1 1 } ^ { \top } } { n } } = X { \frac { \mathbf { 1 1 } ^ { \top } } { n } } ,
309
+ $$
310
+
311
+ $$
312
+ \forall X , Y \in \mathbb { R } ^ { d \times n } ,
313
+ $$
314
+
315
+ and that it converges with linear rate for a parameter $0 < c \leq 1$
316
+
317
+ $$
318
+ \begin{array} { r } { \mathbb { E } _ { h } \Psi ( X ^ { + } , Y ^ { + } ) \leq ( 1 - c ) \Psi ( X , Y ) , } \end{array}
319
+ $$
320
+
321
+ $$
322
+ \forall X , Y \in \mathbb { R } ^ { d \times n } ,
323
+ $$
324
+
325
+ and Laypunov function $\Psi ( X , Y ) : = \| X - \overline { { X } } \| _ { F } ^ { 2 } + \| X - Y \| _ { F } ^ { 2 }$ with $\begin{array} { r } { \overline { { X } } : = \frac { 1 } { n } X \mathbf { 1 1 } ^ { \top } } \end{array}$ , where $\mathbb { E } _ { h }$ denotes the expectation over internal randomness of averaging scheme $h$ .
326
+
327
+ Example: Exact Averaging. Setting $X ^ { + } ~ = ~ X W$ and $Y ^ { + } = X ^ { + }$ gives an exact consensus averaging algorithm with mixing matrix $W$ (Xiao & Boyd, 2004). It converges at the rate $c = \rho$ where $\rho$ is an eigengap of mixing matrix $W$ , defined in Assumption 1. Substituting it into the Algorithm 3 we recover D-PSGD algorithm, analyzed in Lian et al. (2017).
328
+
329
+ Example: CHOCO-SGD. To recover CHOCO-SGD, we need to choose CHOCOGOSSIP (Koloskova et al., 2019) as consensus averaging scheme, which is defined as $X ^ { + } ~ = ~ X + \gamma Y ( W - I )$ and $Y ^ { + } ~ = ~ Y + Q ( X ^ { + } - Y )$ (in the main text we write $\hat { X }$ instead of $Y$ ). This scheme converges with $\begin{array} { r } { c = \frac { \rho ^ { 2 } \delta } { 8 2 } } \end{array}$ . The results from the main part can be recovered by substituting this $\begin{array} { r } { c = \frac { \rho ^ { 2 } \delta } { 8 2 } } \end{array}$ in the more general results below. It is important to note that for Algorithm 1 given in the main text, the order of the communication part $\textcircled{1}$ and the gradient computation part $\textcircled{2}$ is exchanged. We did this to better illustrate that both these parts are independent and that they can be executed in parallel. The effect of this change can be captured by changing the initial values but does not affect the convergence rate.
330
+
331
+ # A.2 PROOFS
332
+
333
+ Remark A.1 (Mini-batch variance). If for functions $f _ { i } , F _ { i }$ defined in (1) Assumption 2 holds, i.e. $\mathbb { E } _ { \xi } \left\| \nabla F _ { i } ( \mathbf { x } , \xi ) - \nabla f _ { i } ( \mathbf { x } ) \right\| ^ { 2 } \leq \sigma _ { i } ^ { 2 } , i \in [ n ]$ , then
334
+
335
+ $$
336
+ \mathbb { E } _ { \boldsymbol { \xi } _ { 1 } ^ { ( t ) } , \dots , \boldsymbol { \xi } _ { n } ^ { ( t ) } } \left\| \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \left( \nabla f _ { i } ( \mathbf { x } _ { i } ^ { ( t ) } ) - \nabla F _ { i } ( \mathbf { x } _ { i } ^ { ( t ) } , \boldsymbol { \xi } _ { i } ^ { ( t ) } ) \right) \right\| ^ { 2 } \leq \frac { \overline { { \sigma } } ^ { 2 } } { n } ,
337
+ $$
338
+
339
+ where σ2 = Pni=1
340
+
341
+ Proof. This follows from
342
+
343
+ $$
344
+ \mathbb { E } \Bigg \Vert \frac { 1 } { n } \sum _ { i = 1 } ^ { n } Y _ { i } \Bigg \Vert ^ { 2 } = \frac { 1 } { n ^ { 2 } } \left( \sum _ { i = 1 } ^ { n } \mathbb { E } \Vert Y _ { i } \Vert ^ { 2 } + \sum _ { i \neq j } \mathbb { E } \langle Y _ { i } , Y _ { j } \rangle \right) = \frac { 1 } { n ^ { 2 } } \sum _ { i = 1 } ^ { n } \mathbb { E } \Vert Y _ { i } \Vert ^ { 2 } \leq \frac { 1 } { n ^ { 2 } } \sum _ { i = 1 } ^ { n } \sigma _ { i } ^ { 2 } = \frac { \overline { { \sigma } } ^ { 2 } } { n }
345
+ $$
346
+
347
+ for $Y _ { i } = f _ { i } ( \mathbf { x } _ { i } ^ { ( t ) } ) - \nabla F _ { i } ( \mathbf { x } _ { i } ^ { ( t ) } , \boldsymbol { \xi } _ { i } ^ { ( t ) } )$ . Expectation of scalar product is equal to zero because $\xi _ { i }$ is independent of $\xi _ { j }$ since $i \neq j$ . □
348
+
349
+ Lemma A.2. Under Assumptions $_ { I - 3 }$ the iterates of the Algorithm 3 with constant stepsize $\eta$ satisfy
350
+
351
+ $$
352
+ \sum _ { i = 1 } ^ { n } \left\| { \overline { { \mathbf { x } } } } ^ { ( t ) } - \mathbf { x } _ { i } ^ { ( t ) } \right\| _ { 2 } ^ { 2 } \leq \eta ^ { 2 } { \frac { 1 2 n G ^ { 2 } } { c ^ { 2 } } } .
353
+ $$
354
+
355
+ Proof of Lemma A.2. We start by following the proof of Lemma 21 from Koloskova et al. (2019).
356
+
357
+ Define $r _ { t } = \mathbb { E } \Big \lVert X ^ { ( t ) } - \overline { { X } } ^ { ( t ) } \Big \rVert ^ { 2 } + \mathbb { E } \Big \lVert X ^ { ( t ) } - Y ^ { ( t ) } \Big \rVert ^ { 2 }$
358
+
359
+ $$
360
+ \begin{array} { r l } & { \quad \gamma _ { \tau + 1 } \overset { \phi ^ { * } } { \leq } ( 1 - \epsilon ) \mathbb { E } \bigg \| X ^ { ( k + \frac { 1 } { 2 } ) } - X ^ { ( k + \frac { 1 } { 2 } ) } \bigg \| _ { F } ^ { 2 } + ( 1 - \epsilon ) \mathbb { E } \bigg \| Y ^ { ( k ) } - X ^ { ( k + \frac { 1 } { 2 } ) } \bigg \| _ { F } ^ { 2 } } \\ & { \qquad = ( 1 - \epsilon ) \mathbb { E } \bigg \| \widetilde X ^ { ( k ) } - X ^ { ( k ) } + \eta \delta \mathcal { H } X ( X ^ { ( k ) } , \epsilon \delta ) \bigg ( \frac { 1 1 } { N } - I \bigg ) \bigg \| _ { F } ^ { 2 } } \\ & { \qquad + ( 1 - \epsilon ) \mathbb { E } \bigg \| Y ^ { ( k ) } - X ^ { ( k ) } + \eta \delta \mathcal { H } ( X ^ { ( k ) } , \epsilon \delta ^ { ( k ) } ) \bigg \| _ { F } ^ { 2 } } \\ & { \qquad \overset { \phi ^ { * } } { \leq } ( 1 - \epsilon ) ( 1 + \alpha ^ { - 1 } ) \mathbb { E } \bigg ( \bigg \| X ^ { ( k ) } - X ^ { ( k ) } \bigg \| _ { F } ^ { 2 } + \bigg \| Y ^ { ( k ) } - X ^ { ( k ) } \bigg \| _ { F } ^ { 2 } \bigg ) \bigg \| _ { F } ^ { 2 } } \\ & { \qquad + ( 1 - \epsilon ) ( 1 + \alpha ) \beta ^ { 2 } \mathbb { E } \bigg ( \bigg \| \mathcal { D } Y ( X ^ { ( k ) } , \epsilon \delta ^ { ( k ) } ) \bigg ( \frac { 1 1 } { N } - I \bigg ) \bigg \| _ { F } ^ { 2 } + \bigg \| \partial F ( X ^ { ( k ) } , \epsilon ^ { ( k ) } ) \bigg \| _ { F } ^ { 2 } \bigg ) } \\ & { \qquad \leq ( 1 - \epsilon ) \bigg ( ( 1 + \alpha ^ { - 1 } ) \mathbb { E } \bigg ( \bigg \| X ^ { ( k ) } - X ^ { ( k ) } \bigg \| _ { F } ^ { 2 } + \bigg \| Y ^ { ( k ) } - X ^ { ( k ) } \bigg \| _ { F } ^ { 2 } \bigg ) + 2 n ( 1 + \alpha ) \eta ^ { 2 } \mathcal { E } ^ { 2 } \bigg ) \bigg \| _ { F } ^ { 2 } } \\ & \qquad \leq \bigg ( 1 + \alpha ^ { - 1 } \bigg ) \mathbb { E } \bigg ( \bigg \| X ^ { ( k ) } - X ^ { ( k ) } \bigg \| _ { F } ^ { 2 } + \end{array}
361
+ $$
362
+
363
+ Define $A = 3 n G ^ { 2 }$ , we got a recursion
364
+
365
+ $$
366
+ r _ { t + 1 } \leq \left( 1 - \frac { c } { 2 } \right) r _ { t } + \frac { 2 } { c } \eta ^ { 2 } A ,
367
+ $$
368
+
369
+ Verifying that $\begin{array} { r } { r _ { t } \le \eta ^ { 2 } \frac { 4 A } { c ^ { 2 } } } \end{array}$ satisfy recursion completes the proof as $\mathbb { E } \Big \| X ^ { ( t ) } - \overline { { X } } ^ { ( t ) } \Big \| ^ { 2 } \leq r _ { t }$
370
+
371
+ Indeed, r0 = 0 ≤ η2 4Ac2 as X(0) = X(0) and $Y ^ { ( 0 ) } = 0$
372
+
373
+ $$
374
+ r _ { t + 1 } \leq \left( 1 - { \frac { c } { 2 } } \right) r _ { t } + \eta ^ { 2 } { \frac { 2 A } { c } } \leq \left( 1 - { \frac { c } { 2 } } \right) \eta ^ { 2 } { \frac { 4 A } { c ^ { 2 } } } + \eta ^ { 2 } { \frac { 2 A } { c } } = \eta ^ { 2 } { \frac { 4 A } { c ^ { 2 } } } .
375
+ $$
376
+
377
+ Theorem A.3. Under Assumptions $_ { I - 3 }$ with constant stepsize $\eta \ : < \ : \frac { 1 } { 4 L }$ , the averaged iterates $\begin{array} { r } { \overline { { \mathbf { x } } } ^ { ( t ) } = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \mathbf { x } _ { i } ^ { ( t ) } } \end{array}$ of Algorithm 3 satisfy:
378
+
379
+ $$
380
+ \displaystyle \frac { 1 } { T + 1 } \sum _ { t = 0 } ^ { T } \left\| \nabla f ( \overline { { \mathbf { x } } } ^ { ( t ) } ) \right\| _ { 2 } ^ { 2 } \leq \frac { 4 } { \eta ( T + 1 ) } \left( f ( \overline { { \mathbf { x } } } ^ { ( 0 ) } ) - f ^ { \star } \right) + \eta \frac { 2 { \overline { { \sigma } } } ^ { 2 } L } { n } + \eta ^ { 2 } \frac { 3 6 G ^ { 2 } L ^ { 2 } } { c ^ { 2 } }
381
+ $$
382
+
383
+ where c denotes convergence rate of underlying averaging scheme.
384
+
385
+ Proof of Theorem A.3. By $L$ -smoothness
386
+
387
+ $$
388
+ \begin{array} { r l } & { \bar { \boldsymbol { \mathfrak { z } } } _ { t + 1 } ~ f ( \overline { { \mathbf { x } } } ^ { ( t + 1 ) } ) = \mathbb { E } _ { t + 1 } ~ f \left( \overline { { \mathbf { x } } } ^ { ( t ) } - \frac { \eta } { n } \displaystyle \sum _ { i = 1 } ^ { n } \nabla F _ { i } ( { \mathbf x } _ { i } ^ { ( t ) } , \xi _ { i } ^ { ( t ) } ) \right) } \\ & { \leq f ( \overline { { \mathbf { x } } } ^ { ( t ) } ) \underbrace { - \mathbb { E } _ { t + 1 } ~ \left. \nabla f ( \overline { { \mathbf { x } } } ^ { ( t ) } ) , \displaystyle \frac { \eta } { n } \sum _ { i = 1 } ^ { n } \nabla F _ { i } ( { \mathbf x } _ { i } ^ { ( t ) } , \xi _ { i } ^ { ( t ) } ) \right. } _ { = : T _ { 1 } } + \mathbb { E } _ { t + 1 } ~ \frac { L } { 2 } \eta ^ { 2 } \underbrace { \left. \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \nabla F _ { i } ( { \mathbf x } _ { i } ^ { ( t ) } , \xi _ { i } ^ { ( t ) } ) \right. } _ { = : T _ { 2 } } , } \end{array}
389
+ $$
390
+
391
+ To estimate the second term, we add and subtract $\nabla f ( \overline { { \mathbf { x } } } ^ { ( t ) } )$
392
+
393
+ $$
394
+ \begin{array} { c } { { \displaystyle T _ { 1 } = - \eta \left\| \nabla f ( \overline { { \mathbf { x } } } ^ { ( t ) } ) \right\| ^ { 2 } + \eta \left. \nabla f ( \overline { { \mathbf { x } } } ^ { ( t ) } ) , \nabla f ( \overline { { \mathbf { x } } } ^ { ( t ) } ) - \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \nabla f _ { i } ( \mathbf { x } _ { i } ^ { ( t ) } ) \right. } } \\ { { \displaystyle \quad \stackrel { ( 8 ) , \gamma = 1 } { \leq } - \frac { \eta } { 2 } \left\| \nabla f ( \overline { { \mathbf { x } } } ^ { ( t ) } ) \right\| ^ { 2 } + \frac { \eta } { 2 n } \sum _ { i = 1 } ^ { n } \left\| \nabla f ( \overline { { \mathbf { x } } } ^ { ( t ) } ) - \nabla f _ { i } ( \mathbf { x } _ { i } ^ { ( t ) } ) \right\| ^ { 2 } } } \end{array}
395
+ $$
396
+
397
+ For the last term, we add and subtract $\nabla f ( \overline { { \mathbf { x } } } ^ { ( t ) } )$ and the sum of $\nabla f _ { i } ( \mathbf { x } _ { i } ^ { ( t ) } )$
398
+
399
+ $$
400
+ \begin{array} { r l } & { T _ { 2 } = \mathbb { E } _ { t + 1 } \left\| \displaystyle \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \left( \nabla F _ { i } ( { \mathbf x } _ { i } ^ { ( t ) } , \xi _ { i } ^ { ( t ) } ) - \nabla f _ { i } ( { \mathbf x } _ { i } ^ { ( t ) } ) \right) \right\| _ { 2 } ^ { 2 } + \left\| \displaystyle \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \nabla f _ { i } ( { \mathbf x } _ { i } ^ { ( t ) } ) \pm \nabla f ( \overline { { \mathbf x } } ^ { ( t ) } ) \right\| _ { 2 } ^ { 2 } } \\ & { \quad \stackrel { ( 6 ) , ( 9 ) , ( 7 ) } { \le } \displaystyle \frac { \overline { { \sigma } } ^ { 2 } } { n } + \displaystyle \frac { 2 } { n } \sum _ { i = 1 } ^ { n } \left\| f ( \overline { { \mathbf x } } ^ { ( t ) } ) - \nabla f _ { i } ( { \mathbf x } _ { i } ^ { ( t ) } ) \right\| _ { 2 } ^ { 2 } + 2 \left\| \nabla f ( \overline { { \mathbf x } } ^ { ( t ) } ) \right\| _ { 2 } ^ { 2 } } \end{array}
401
+ $$
402
+
403
+ Combining this together and using $L$ -smoothness to estimate $\Big \| f ( \overline { { \mathbf { x } } } ^ { ( t ) } ) - \nabla f _ { i } ( \mathbf { x } _ { i } ^ { ( t ) } ) \Big \| _ { 2 } ^ { 2 } ;$
404
+
405
+ $$
406
+ \mathfrak { c } _ { t + 1 } ~ f ( \overline { { \mathbf { x } } } ^ { ( t + 1 ) } ) \leq f ( \overline { { \mathbf { x } } } ^ { ( t ) } ) - \eta \left( \frac { 1 } { 2 } - L \eta \right) \left. \nabla f ( \overline { { \mathbf { x } } } ^ { ( t ) } ) \right. _ { 2 } ^ { 2 } + \left( \frac { 1 } { 2 } \eta L ^ { 2 } + \eta ^ { 2 } L ^ { 3 } \right) \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \left. \overline { { \mathbf { x } } } ^ { ( t ) } - { \mathbf { x } } _ { i } ^ { ( t ) } \right. _ { 2 } ^ { 2 } +
407
+ $$
408
+
409
+ Using Lemma A.2 to bound the third term and using that $\begin{array} { r } { \eta \le \frac { 1 } { 4 L } } \end{array}$ in the second and in the third terms
410
+
411
+ $$
412
+ \mathbb { E } _ { t + 1 } ~ f ( \overline { { \mathbf { x } } } ^ { ( t + 1 ) } ) \leq f ( \overline { { \mathbf { x } } } ^ { ( t ) } ) - \frac { \eta } { 4 } \left. \nabla f ( \overline { { \mathbf { x } } } ^ { ( t ) } ) \right. _ { 2 } ^ { 2 } + \eta ^ { 3 } \frac { 9 L ^ { 2 } G ^ { 2 } } { c ^ { 2 } } + \eta ^ { 2 } \frac { L \overline { { \sigma } } ^ { 2 } } { 2 n } ,
413
+ $$
414
+
415
+ Rearranging terms and averaging over $t$
416
+
417
+ $$
418
+ \begin{array} { r l } & { \displaystyle \frac { 1 } { T + 1 } \sum _ { t = 0 } ^ { T } \left\| \nabla f ( \overline { { \mathbf { x } } } ^ { ( t ) } ) \right\| _ { 2 } ^ { 2 } \leq \frac { 4 } { \eta } \displaystyle \frac { 1 } { T + 1 } \sum _ { t = 0 } ^ { T } \left( \mathbb { E } f ( \overline { { \mathbf { x } } } ^ { ( t ) } ) - \mathbb { E } f ( \overline { { \mathbf { x } } } ^ { ( t + 1 ) } ) \right) + \eta ^ { 2 } \displaystyle \frac { 3 6 G ^ { 2 } L ^ { 2 } } { c ^ { 2 } } + \eta \frac { 2 L \overline { { \sigma } } ^ { 2 } } { n } } \\ & { \qquad \leq \displaystyle \frac { 4 } { \eta ( T + 1 ) } \left( f ( \overline { { \mathbf { x } } } ^ { ( 0 ) } ) - f ^ { \star } \right) + \eta \frac { 2 \overline { { \sigma } } ^ { 2 } L } { n } + \eta ^ { 2 } \displaystyle \frac { 3 6 G ^ { 2 } L ^ { 2 } } { c ^ { 2 } } } \end{array}
419
+ $$
420
+
421
+ Corollary A.4. Under Assumptions $_ { I - 3 }$ with constant stepsize $\begin{array} { r } { \eta = \sqrt { \frac { n } { T + 1 } } } \end{array}$ for $T \geq 1 6 n L ^ { 2 }$ , the averaged iterates $\begin{array} { r } { \overline { { \mathbf { x } } } ^ { ( t ) } = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \mathbf { x } _ { i } ^ { ( t ) } } \end{array}$ of Algorithm 3 satisfy:
422
+
423
+ $$
424
+ \frac { 1 } { T + 1 } \sum _ { t = 0 } ^ { T } \left. \nabla f ( \overline { { \mathbf { x } } } ^ { ( t ) } ) \right. _ { 2 } ^ { 2 } \leq \frac { 4 \left( f ( \overline { { { \bf x } } } ^ { ( 0 ) } ) - f ^ { \star } \right) + 2 \overline { { \sigma } } ^ { 2 } L } { \sqrt { n ( T + 1 ) } } + \frac { 3 6 G ^ { 2 } n L ^ { 2 } } { ( T + 1 ) c ^ { 2 } }
425
+ $$
426
+
427
+ where c denotes convergence rate of underlying averaging scheme.
428
+
429
+ The first term shows a linear speed up compared to SGD on one node, whereas the underlying averaging scheme affects only the second-order term. Substituting the convergence rate for exact averaging with $W$ gives the rate $\mathcal { O } ( 1 / \sqrt { n T } + n / ( T \rho ^ { 2 } ) )$ .
430
+
431
+ CHOCO-SGD with the underlying CHOCO-GOSSIP averaging scheme converges at the rate $\mathcal { O } ( 1 / \sqrt { n T } + n / ( T \rho ^ { 4 } \delta ^ { 2 } ) )$ . The dependence on $\rho$ (eigengap of the mixing matrix $W$ ) is worse than in the exact case. This might either just be an artifact of our proof technique or a consequence of supporting arbitrary high compression.
432
+
433
+ # A.3 CONVERGENCE FOR ARBITRARY $T$
434
+
435
+ The previous result holds only for $T$ larger than $1 6 n L ^ { 2 }$ . This is not necessary and can be relaxed by carefully tuning the stepsize.
436
+
437
+ Lemma A.5. For any parameters $r _ { 0 } \ge 0 , b \ge 0 , e \ge 0 , d \ge 0$ there exists constant stepsize $\begin{array} { r } { \eta \le \frac { 1 } { d } } \end{array}$ such that
438
+
439
+ $$
440
+ \Psi _ { T } : = \frac { r _ { 0 } } { \eta ( T + 1 ) } + b \eta + e \eta ^ { 2 } \leq 2 \left( \frac { b r _ { 0 } } { T + 1 } \right) ^ { \frac { 1 } { 2 } } + 2 e ^ { 1 / 3 } \left( \frac { r _ { 0 } } { T + 1 } \right) ^ { \frac { 2 } { 3 } } + \frac { d r _ { 0 } } { T + 1 }
441
+ $$
442
+
443
+ Proof. Choosing $\begin{array} { r } { \eta = \operatorname* { m i n } \left\{ \left( \frac { r _ { 0 } } { b ( T + 1 ) } \right) ^ { \frac { 1 } { 2 } } , \left( \frac { r _ { 0 } } { e ( T + 1 ) } \right) ^ { \frac { 1 } { 3 } } , \frac { 1 } { d } \right\} \le \frac { 1 } { d } } \end{array}$ we have three cases
444
+
445
+ • $\begin{array} { r } { \eta = \frac { 1 } { d } } \end{array}$ and is smaller than both $\begin{array} { r } { \left( \frac { r _ { 0 } } { b ( T + 1 ) } \right) ^ { \frac { 1 } { 2 } } } \end{array}$ and $\scriptstyle \left( { \frac { r _ { 0 } } { e ( T + 1 ) } } \right) ^ { \frac { 1 } { 3 } }$ , then
446
+
447
+ $$
448
+ \Psi _ { T } \leq \frac { d r _ { 0 } } { T + 1 } + \frac { b } { d } + \frac { e } { d ^ { 2 } } \leq \left( \frac { b r _ { 0 } } { T + 1 } \right) ^ { \frac { 1 } { 2 } } + \frac { d r _ { 0 } } { T + 1 } + e ^ { 1 / 3 } \left( \frac { r _ { 0 } } { T + 1 } \right) ^ { \frac { 2 } { 3 } }
449
+ $$
450
+
451
+ $\begin{array} { r } { \eta = \left( \frac { r _ { 0 } } { b ( T + 1 ) } \right) ^ { \frac { 1 } { 2 } } < \left( \frac { r _ { 0 } } { e ( T + 1 ) } \right) ^ { \frac { 1 } { 3 } } } \end{array}$
452
+
453
+ $$
454
+ \Psi _ { T } \leq 2 \left( \frac { r _ { 0 } b } { T + 1 } \right) ^ { \frac { 1 } { 2 } } + e \left( \frac { r _ { 0 } } { b ( T + 1 ) } \right) \leq 2 \left( \frac { r _ { 0 } b } { T + 1 } \right) ^ { \frac { 1 } { 2 } } + e ^ { \frac { 1 } { 3 } } \left( \frac { r _ { 0 } } { ( T + 1 ) } \right) ^ { \frac { 2 } { 3 } } ,
455
+ $$
456
+
457
+ • The last case, $\begin{array} { r } { \eta = \left( \frac { r _ { 0 } } { e ( T + 1 ) } \right) ^ { \frac { 1 } { 3 } } < \left( \frac { r _ { 0 } } { b ( T + 1 ) } \right) ^ { \frac { 1 } { 2 } } } \end{array}$
458
+
459
+ $$
460
+ \Psi _ { T } \leq 2 e ^ { \frac { 1 } { 3 } } \left( \frac { r _ { 0 } } { ( T + 1 ) } \right) ^ { \frac { 2 } { 3 } } + b \left( \frac { r _ { 0 } } { e ( T + 1 ) } \right) ^ { \frac { 1 } { 3 } } \leq 2 e ^ { \frac { 1 } { 3 } } \left( \frac { r _ { 0 } } { ( T + 1 ) } \right) ^ { \frac { 2 } { 3 } } + \left( \frac { b r _ { 0 } } { T + 1 } \right) ^ { \frac { 1 } { 2 } }
461
+ $$
462
+
463
+ Corollary A.6 (Generalized Theorem 4.1). Under Assumptions $_ { I - 3 }$ with constant stepsize η tuned as in Lemma A.5, the averaged iterates x(t) = 1n Pni=1 x(t)i of Algorithm 3 satisfy:
464
+
465
+ $$
466
+ \frac { 1 } { T + 1 } \sum _ { t = 0 } ^ { T } \left. \nabla f ( \overline { { \mathbf { x } } } ^ { ( t ) } ) \right. _ { 2 } ^ { 2 } \leq 4 \sqrt { \frac { 2 L \overline { { \sigma } } ^ { 2 } } { n ( T + 1 ) } } + 1 7 \left( \frac { G L F _ { 0 } } { c ( T + 1 ) } \right) ^ { \frac { 2 } { 3 } } + \frac { 1 6 L F _ { 0 } } { T + 1 }
467
+ $$
468
+
469
+ where c denotes convergence rate of underlying averaging scheme, $F _ { 0 } = f ( \overline { { \mathbf { x } } } ^ { ( 0 ) } ) - f ^ { \star }$ .
470
+
471
+ Proof. The result follows from Theorem A.3 and Lemma A.5 with $r _ { 0 } = 4 \Big ( f ( \overline { { \mathbf { x } } } ^ { ( 0 ) } ) - f ^ { \star } \Big ) , b =$ $\frac { 2 { \overline { { \sigma } } } ^ { 2 } L } { n }$ , $\begin{array} { r } { e = \frac { 3 6 G ^ { 2 } L ^ { 2 } } { c ^ { 2 } } } \end{array}$ and $d = 4 L$ .
472
+
473
+ The corollary gives guarantees for the averaged vector of parameters $\overline { { \mathbf { x } } }$ , however in a decentralized setting it is very expensive and sometimes impossible to average all the parameters distributed across several machines, especially when the number of machines and the model size is large. We can get similar guarantees on the individual iterates $\mathbf { x } _ { i }$ as e.g. in (Assran et al., 2019). We summarize these briefly below.
474
+
475
+ Corollary A.7 (Convergence of local weights). Under the same setting as in Corollary A.6,
476
+
477
+ $$
478
+ \frac { 1 } { T + 1 } \sum _ { t = 0 } ^ { T } \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \left. \nabla f \bigl ( \mathbf { x } _ { i } ^ { ( t ) } \bigr ) \right. _ { 2 } ^ { 2 } \leq 8 \sqrt { \frac { 2 L \overline { { \sigma } } ^ { 2 } } { n ( T + 1 ) } } + 3 7 \left( \frac { G L F _ { 0 } } { c ( T + 1 ) } \right) ^ { \frac { 2 } { 3 } } + \frac { 3 2 L F _ { 0 } } { T + 1 }
479
+ $$
480
+
481
+ Proof of Corollary A.7.
482
+
483
+ $$
484
+ \begin{array} { r l } & { \displaystyle \frac { 1 } { { \cal T } + 1 } \sum _ { t = 0 } ^ { T } \displaystyle \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \left\| \nabla f ( { \mathbf x } _ { i } ^ { ( t ) } ) \right\| _ { 2 } ^ { 2 } \leq \displaystyle \frac { 1 } { { \cal T } + 1 } \sum _ { t = 0 } ^ { T } \displaystyle \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \left( 2 \left\| \nabla f ( { \mathbf x } _ { i } ^ { ( t ) } ) - \nabla f ( \overline { { { \mathbf x } } } ^ { ( t ) } ) \right\| _ { 2 } ^ { 2 } + 2 \left\| \nabla f ( \overline { { { \mathbf x } } } ^ { ( t ) } ) \right\| _ { 2 } ^ { 2 } \right) } \\ & { \qquad \leq \displaystyle \frac { 1 } { { \cal T } + 1 } \sum _ { t = 0 } ^ { T } \displaystyle \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \left( 2 L ^ { 2 } \left\| { \mathbf x } _ { i } ^ { ( t ) } - \overline { { { \mathbf x } } } ^ { ( t ) } \right\| _ { 2 } ^ { 2 } + 2 \left\| \nabla f ( \overline { { { \mathbf x } } } ^ { ( t ) } ) \right\| _ { 2 } ^ { 2 } \right) } \end{array}
485
+ $$
486
+
487
+ where we used $L$ -smoothness of $f$ . Using Theorem A.3 and tuning the stepsize as in Lemma A.5 we get the statement of the corollary. □
488
+
489
+ # B USEFUL INEQUALITIES
490
+
491
+ Lemma B.1. For arbitrary set of $n$ vectors $\{ \mathbf { a } _ { i } \} _ { i = 1 } ^ { n } , \mathbf { a } _ { i } \in \mathbb { R } ^ { d }$
492
+
493
+ $$
494
+ \left\| \sum _ { i = 1 } ^ { n } \mathbf { a } _ { i } \right\| ^ { 2 } \leq n \sum _ { i = 1 } ^ { n } \left\| \mathbf { a } _ { i } \right\| ^ { 2 } .
495
+ $$
496
+
497
+ Lemma B.2. For given two vectors a, $\mathbf { b } \in \mathbb { R } ^ { d }$
498
+
499
+ $$
500
+ \begin{array} { r } { 2 \left. \mathbf { a } , \mathbf { b } \right. \leq \gamma \left\| \mathbf { a } \right\| ^ { 2 } + \gamma ^ { - 1 } \left\| \mathbf { b } \right\| ^ { 2 } , \ } \end{array} \quad \quad \quad \forall \gamma > 0 .
501
+ $$
502
+
503
+ Lemma B.3. For given two vectors a, $\mathbf { b } \in \mathbb { R } ^ { d }$
504
+
505
+ $$
506
+ \left\| \mathbf { a } + \mathbf { b } \right\| ^ { 2 } \leq \left( 1 + \alpha \right) \left\| \mathbf { a } \right\| ^ { 2 } + \left( 1 + \alpha ^ { - 1 } \right) \left\| \mathbf { b } \right\| ^ { 2 } , \qquad \forall \alpha > 0 .
507
+ $$
508
+
509
+ This inequality also holds for the sum of two matrices $A , B \in \mathbb { R } ^ { n \times d }$ in Frobenius norm.
510
+
511
+ # C COMPRESSION SCHEMES
512
+
513
+ We implement the compression schemes detailed below.
514
+
515
+ • ${ \mathrm { g s g d } } _ { b }$ (Alistarh et al., 2017). The unbiased $\mathrm { g s g d } _ { b } \colon \mathbb { R } ^ { d } \to \mathbb { R } ^ { d }$ compression operator (for $b > 1$ ) is given as
516
+
517
+ $$
518
+ \mathrm { g s g d } _ { b } ( \mathbf { x } ) : = \left\| \mathbf { x } \right\| _ { 2 } \cdot \mathrm { s i g } ( \mathbf { x } ) \cdot 2 ^ { - ( b - 1 ) } \cdot \left\lfloor { \frac { 2 ^ { ( b - 1 ) } \left| \mathbf { x } \right| } { \left\| \mathbf { x } \right\| _ { 2 } } } + \mathbf { u } \right\rfloor
519
+ $$
520
+
521
+ where $\mathbf { 1 } \sim _ { u . a . r . } ~ [ 0 , 1 ] ^ { d }$ is a random dithering vector and $\mathrm { s i g } ( \mathbf { x } )$ assigns the element-wise sign: $( \mathrm { s i g } ( \mathbf { x } ) ) _ { i } = 1$ if $( { \bf x } ) _ { i } \geq 0$ and $( \mathrm { s i g } ( \mathbf { x } ) ) _ { i } = - 1$ if $( { \bf x } ) _ { i } < 0$ . As the value in the right bracket will be rounded to an integer in $\{ 0 , \ldots , 2 ^ { ( b - 1 ) } - 1 \}$ , each coordinate can be encoded with at most $( b - 1 ) + 1$ bits (1 for the sign). For more efficent encoding schemes cf. Alistarh et al. (2017).
522
+
523
+ A biased version is given as
524
+
525
+ $$
526
+ \operatorname { g s g d } _ { b } ( \mathbf { x } ) : = { \frac { \left\| \mathbf { x } \right\| _ { 2 } } { \tau } } \cdot \operatorname { s i g } ( \mathbf { x } ) \cdot 2 ^ { - ( b - 1 ) } \cdot \left\lfloor { \frac { 2 ^ { ( b - 1 ) } \left| \mathbf { x } \right| } { \left\| \mathbf { x } \right\| _ { 2 } } } + \mathbf { u } \right\rfloor
527
+ $$
528
+
529
+ for $\begin{array} { r } { \tau = 1 + \operatorname* { m i n } \left\{ \frac { d } { 2 ^ { 2 ( b - 1 ) } } , \frac { \sqrt { d } } { 2 ^ { ( b - 1 ) } } \right\} } \end{array}$ and is a $\begin{array} { r } { \delta = \frac { 1 } { \tau } } \end{array}$ compression operator (Koloskova et al., 2019).
530
+
531
+ • $\operatorname { r a n d o m } _ { a }$ (Wangni et al., 2018). Let $\mathbf { u } \in \{ 0 , 1 \} ^ { d }$ be a masking vector, sampled uniformly at random from the set $\{ \mathbf { u } \in \{ 0 , 1 \} ^ { d } : \| \mathbf { u } \| _ { 1 } = \left\lfloor a d \right\rfloor \}$ . Then the unbiased $\dot { \mathrm { r a n d o m } } _ { a } \colon { \mathbb { R } } ^ { \bar { d } } $ $\mathbb { R } ^ { d }$ operator is defined as
532
+
533
+ $$
534
+ \operatorname { r a n d o m } _ { a } ( \mathbf { x } ) : = { \frac { d } { \lfloor a d \rfloor } } \cdot \mathbf { x } \odot \mathbf { u } .
535
+ $$
536
+
537
+ The biased version is given as
538
+
539
+ $$
540
+ \operatorname { r a n d o m } _ { a } ( \mathbf { x } ) : = \mathbf { x } \odot \mathbf { u } ,
541
+ $$
542
+
543
+ and is a $\delta = a$ compression operator (Stich et al., 2018).
544
+
545
+ Only $3 2 \lfloor a d \rfloor$ bits are required to send $\operatorname { r a n d o m } _ { a } ( \mathbf { x } )$ to another node—all the values of non-zero entries (we assume that entries are represented as float32 numbers). Receiver can recover positions of these entries if it knows the random seed of uniform sampling operator used to select these entries. This random seed could be communicated once on preprocessing stage (before starting the algorithm).
546
+
547
+ • $\mathrm { t o p } _ { a }$ (Alistarh et al., 2018; Stich et al., 2018). The biased $\mathrm { t o p } _ { a } \colon { \mathbb { R } ^ { d } } \to { \mathbb { R } ^ { d } }$ operator is defined as
548
+
549
+ $$
550
+ \mathrm { t o p } _ { a } ( { \bf x } ) : = { \bf x } \odot { \bf u } ( { \bf x } ) ,
551
+ $$
552
+
553
+ where ${ \mathbf u } ( { \mathbf x } ) \in \{ 0 , 1 \} ^ { d }$ , $\left\| \mathbf { u } \right\| _ { 1 } = \lfloor a d \rfloor$ is a masking vector with $( { \bf u } ) _ { i } = 1$ for indices $i \in \pi ^ { - 1 } ( \{ 1 , \ldots , \lfloor a d \rfloor \} )$ where the permutation $\pi$ is such that $\left| ( \mathbf { x } ) _ { \pi ( 1 ) } \right| \geq \left| ( \mathbf { x } ) _ { \pi ( 2 ) } \right| \geq$ $\cdots \geq \left| ( \mathbf { x } ) _ { \pi ( d ) } \right|$ . The $\mathrm { t o p } _ { a }$ operator is a $\delta = a$ compression operator (Stich et al., 2018). In the case of $\mathrm { t o p } _ { a }$ compression $2 \cdot 3 2 \lfloor a d \rfloor$ bits are required because along with the values we need to send positions of these values.
554
+
555
+ • sign (Bernstein et al., 2018; Karimireddy et al., 2019). The biased (scaled) sign : $\mathbb { R } ^ { d } \to \mathbb { R }$ compression operator is defined as
556
+
557
+ $$
558
+ \operatorname { s i g n } ( \mathbf { x } ) : = { \frac { \| \mathbf { x } \| _ { 1 } } { d } } \cdot \operatorname { s g n } ( \mathbf { x } ) .
559
+ $$
560
+
561
+ The sign operator is a δ = kxk21k k2 compression operator (Karimireddy et al., 2019).
562
+
563
+ In total for the sign compression we need to send only $d + 3 2$ bits—one bit for every entry in $\mathbf { x }$ and 32 bits for $\left\| \mathbf { x } \right\| _ { 1 }$ .
564
+
565
+ # D CHOCO-SGD WITH MOMENTUM
566
+
567
+ Algorithm 2 demonstrates how to combine CHOCO-SGD with weight decay and momentum. Nesterov momentum can be analogously adapted for our decentralized setting.
568
+
569
+ # E ERROR FEEDBACK INTERPRETATION OF CHOCO-SGD
570
+
571
+ To better understand how does CHOCO-SGD work, we can interpret it as an error feedback algorithm (Stich et al., 2018; Karimireddy et al., 2019; Stich & Karimireddy, 2019). We can equivalently rewrite CHOCO-SGD (Algorithm 1) as Algorithm 4. The common feature of error feedback algorithms is that quantization errors are saved into the internal memory, which is added to the compressed value at the next iteration. In CHOCO-SGD the value we want to transmit is the difference $\bar { \mathbf { x } } _ { i } ^ { ( t ) } - \mathbf { x } _ { i } ^ { ( t - 1 ) }$ , which represents the evolution of local variable $\mathbf { x } _ { i }$ at step $t$ . Before compressing this value on line 4, the internal memory is added on line 3 to correct for the errors. Then, on line 5 internal memory is updated. Note that $\mathbf { \dot { m } } _ { i } ^ { ( t ) } = \mathbf { x } _ { i } ^ { ( t - 1 ) } - \hat { \mathbf { x } } _ { i } ^ { ( t ) }$ in the old notation.
572
+
573
+ input: Initial values $\mathbf { x } _ { i } ^ { ( 0 ) } \in \mathbb { R } ^ { d }$ on each node $i \in [ n ]$ , consensus stepsize $\gamma$ , SGD stepsize $\eta$ , communication graph G = ([n], E) and mixing matrix W , initialize xˆ(0)i $\hat { \mathbf { x } } _ { i } ^ { ( 0 ) } = \mathbf { x } _ { i } ^ { ( - 1 ) } : = \mathbf { 0 }$ , $\forall i \in [ n ]$ 1: for $t$ in $0 \dots T - 1$ do {in parallel for all workers $i \in [ n ]$ } 2: $\begin{array} { r } { \mathbf { x } _ { i } ^ { ( t ) } : = \mathbf { x } _ { i } ^ { ( t - \frac { 1 } { 2 } ) } + \gamma \sum _ { j : \{ i , j \} \in E } w _ { i j } \big ( \hat { \mathbf { x } } _ { j } ^ { ( t ) } - \hat { \mathbf { x } } _ { i } ^ { ( t ) } \big ) } \end{array}$ / modified gossip averaging 3: $\mathbf { v } _ { i } ^ { ( t ) } = \mathbf { x } _ { i } ^ { ( t ) } - \mathbf { x } _ { i } ^ { ( t - 1 ) } + \mathbf { \bar { m } } _ { i } ^ { ( { t } ) }$ − x(t−1)i + 4: $\mathbf { q } _ { i } ^ { ( t ) } : = Q ( \mathbf { v } _ { i } ^ { ( t ) } )$ / compression 5: $\mathbf { m } _ { i } ^ { ( t + 1 ) } = \mathbf { v } _ { i } ^ { ( t ) } - \mathbf { q } _ { i } ^ { ( t ) }$ / memory update 6: for neighbors $j \colon \{ i , j \} \in E$ (including $\{ i \} \in E$ ) do 7: Send q(t)i and receive $\mathbf { q } _ { j } ^ { ( t ) }$ / communication 8: $\hat { \mathbf { x } } _ { j } ^ { ( t + 1 ) } : = \mathbf { q } _ { j } ^ { ( t ) } + \hat { \mathbf { x } } _ { j } ^ { ( t ) }$ / local update 9: end for 10: Samp le ξ(t) , compute gradient $\mathbf { g } _ { i } ^ { ( t ) } : = \nabla F _ { i } ( \mathbf { x } _ { i } ^ { ( t ) } , \xi _ { i } ^ { ( t ) } )$ 11: $\mathbf { x } _ { i } ^ { ( t + \frac { 1 } { 2 } ) } : = \mathbf { x } _ { i } ^ { ( t ) } - \eta \mathbf { g } _ { i } ^ { ( t ) }$ / stochastic gradient update 12: end for
574
+
575
+ # F DETAILED EXPERIMENTAL SETUP AND TUNED HYPERPARAMETERS
576
+
577
+ We precise the procedure of model training as well as the hyper-parameter tuning in this section.
578
+
579
+ Social Network Setup. For the comparison we consider CHOCO-SGD with sign compression (this combination achieved the compromise between accuracy and compression level in Table 1)), decentralized SGD without compression, and centralized SGD without compression. We train two models, firstly ResNet20 (He et al., 2016) (0.27 million parameters) for image classification on the Cifar10 dataset (50K/10K training/test samples) (Krizhevsky, 2012) and secondly, a three-layer LSTM architecture (Hochreiter & Schmidhuber, 1997) (28.95 million parameters) for a language modeling task on WikiText-2 (600 training and 60 validation articles with a total of $2 ^ { \prime } 0 8 8 ^ { \prime } 6 2 8$ and $2 1 7 ^ { \prime } 6 4 6$ tokens respectively) (Merity et al., 2016). For the language modeling task, we borrowed and adapted the general experimental setup of Merity et al. (2017), where we use a three-layer LSTM with hidden dimension of size 650. The loss is averaged over all examples and timesteps. The BPTT length is set to 30. We fine-tune the value of gradient clipping (0.4), and the dropout (0.4) is only applied on the output of LSTM.
580
+
581
+ We train both of ResNet20 and LSTM for 300 epochs, unless mentioned specifically. The per node mini-batch size is 32 for both datasets. The momentum (with factor 0.9) is only applied on the ResNet20 training.
582
+
583
+ Social Network and a Datacenter details. For all algorithms, we gradually warmup (Goyal et al., 2017) the learning rate from a relative small value (0.1) to the fine-tuned initial learning rate for the first 5 training epochs. During the training procedure, the tuned initial learning rate is decayed by the factor of 10 when accessing $5 0 \%$ and $7 5 \%$ of the total training epochs. The learning rate is tuned by finding the optimal initial learning rate (after the scaling).
584
+
585
+ The optimal $\hat { \eta }$ is searched in a pre-defined grid and we ensure that the best performance was contained in the middle of the grids. For example, if the best performance was ever at one of the extremes of the grid, we would try new grid points. Same searching logic applies to the consensus stepsize.
586
+
587
+ Table 4 demonstrates the fine-tuned hpyerparameters of CHOCO-SGD for training ResNet-20 on Cifar10, while Table 6 reports our fine-tuned hpyerparameters of our baselines. Table 5 demonstrates the fine-tuned hpyerparameters of CHOCO-SGD for training ResNet-20/LSTM on a social network topology.
588
+
589
+ We estimate the runtime information (depicted in Figure 5) of different methods from three trials of the evaluation on Google Cloud (Kubernetes Engine). More precisely, we create the cluster on
590
+
591
+ Google Cloud for three times and each time we estimate the time per mini-batch of different methods (through the first two training epochs).
592
+
593
+ Table 4: Tuned hyper-parameters of CHOCO-SGD for training ResNet-20 on Cifar10, corresponding to the ring topology with 8 nodes in Table 1. We randomly split the training data between nodes and shuffle it after every epoch. The per node mini-batch size is 128 and the degree of each node is 3.
594
+
595
+ <table><tr><td>Compression schemes</td><td>Learning rate</td><td>Consensus stepsize</td></tr><tr><td>QSGD (16-bit)</td><td>1.60</td><td>0.2</td></tr><tr><td>QSGD (8-bit)</td><td>0.96</td><td>0.2</td></tr><tr><td>QSGD (4-bit)</td><td>1.60</td><td>0.075</td></tr><tr><td>QSGD D (2-bit)</td><td>0.96</td><td>0.025</td></tr><tr><td>Sparsification ( (random-50%)</td><td>2.40</td><td>0.45</td></tr><tr><td>Sparsification (random-10%)</td><td>1.20</td><td>0.075</td></tr><tr><td>Sparsification (random-1%)</td><td>0.48</td><td>0.00625</td></tr><tr><td>Sparsification (top-50%)</td><td>1.60</td><td>0.45</td></tr><tr><td>Sparsification (top-10%)</td><td>1.60</td><td>0.15</td></tr><tr><td>Sparsification (top-1%)</td><td>1.20</td><td>0.0375</td></tr><tr><td>Sign+Norm</td><td>1.60</td><td>0.45</td></tr></table>
596
+
597
+ Table 5: Tuned hyper-parameters of CHOCO-SGD, corresponding to the social network topology with 32 nodes in Table 3. We randomly split the training data between the nodes and keep this partition fixed during the entire training (no shuffling). The per node mini-batch size is 32 and the maximum degree of the node is 14.
598
+
599
+ <table><tr><td>Configuration</td><td>Learning rate</td><td>Consensus stepsize</td></tr><tr><td>ResNet-20, Cifar10, Sign+Norm</td><td>1.0</td><td>0.5</td></tr><tr><td>LSTM,WikiText-2, Sign+Norm</td><td>25</td><td>0.6</td></tr></table>
600
+
601
+ Table 6: Tuned hyper-parameters of DCD, ECD, and DeepSqueeze for training ResNet $^ { - 2 0 }$ on Cifar10, corresponding to the ring topology with 8 nodes in Table 1. We randomly split the training data between nodes and shuffle it after every epoch. The per node mini-batch size is 128 and the degree of each node is 3. We only report the hpyerparameters corresponding to results that can reach to reasonable performance in our experiments.
602
+
603
+ <table><tr><td>Compression schemes</td><td>Learning rate</td><td>Consensus stepsize</td></tr><tr><td>DCD, QSGD (16-bit)</td><td>2.40</td><td></td></tr><tr><td>DCD, QSGD (8-bit)</td><td>1.20</td><td></td></tr><tr><td>DCD, Sparsification (random-50%)</td><td>0.80</td><td></td></tr><tr><td>DCD, Sparsification (top-50%)</td><td>1.20</td><td></td></tr><tr><td>DCD, Sparsification (top-10%)</td><td>1.60</td><td></td></tr><tr><td>DCD, Sparsification (top-1%)</td><td>2.40</td><td></td></tr><tr><td>ECD, QSGD (16-bit)</td><td>0.96</td><td></td></tr><tr><td>ECD, QSGD (8-bit)</td><td>1.20</td><td></td></tr><tr><td>DeepSqueeze, QSGD (4-bit)</td><td>0.60</td><td>0.01</td></tr><tr><td>DeepSqueeze, QSGD (2-bit)</td><td>0.80</td><td>0.005</td></tr><tr><td>DeepSqueeze, Sparsification (top-50%)</td><td>0.80</td><td>0.05</td></tr><tr><td>DeepSqueeze, Sparsification (top-10%)</td><td>0.60</td><td>0.01</td></tr><tr><td>DeepSqueeze, Sparsification (top-1%)</td><td>0.40</td><td>0.005</td></tr><tr><td>DeepSqueeze, Sparsification (random-1%)</td><td>0.80</td><td>0.0005</td></tr><tr><td>DeepSqueeze, Sign+Norm</td><td>0.48</td><td>0.01</td></tr></table>
604
+
605
+ # G ADDITIONAL PLOTS
606
+
607
+ To complement our results for scaling to a large number of nodes, we here additionally depict the learning curves (e.g. test accuracy) for the training on 64 nodes. We also mark the levels used for Fig. 1.
608
+
609
+ ![](images/291f242d0c09c7f2a4a9aa3cdb27b9dcf6ebb7dfea490cae823a3e88beabfeb7.jpg)
610
+ Figure 6: Scaling of CHOCO-SGD with sign compression to large number of devices on Cifar10 dataset. Convergence curves for 64 nodes. Vertical lines corresponds to the epoch/bits budget used in Fig. 1.
611
+
612
+ Table 7: The exact epoch for the same bits budget in Fig. 1.
613
+
614
+ <table><tr><td></td><td>n=4</td><td>n =16</td><td>n=36</td><td>n=64</td></tr><tr><td>Centralized</td><td>5</td><td>6</td><td>6</td><td>6</td></tr><tr><td>Decentralized (Ring)</td><td>7</td><td>17</td><td>32</td><td>54</td></tr><tr><td>Decentralized (Torus)</td><td>6</td><td>10</td><td>18</td><td>29</td></tr><tr><td>CHOCO (Ring)</td><td>105</td><td>408</td><td>904</td><td>1588</td></tr><tr><td>CHOCO (Torus)</td><td>55</td><td>206</td><td>454</td><td>796</td></tr></table>
615
+
616
+ able 8: The exact transmitted bits (in MB) for the same epoch budget in Fig. 1.
617
+
618
+ <table><tr><td></td><td>n=4</td><td>n=16</td><td>n=36</td><td>n=64</td></tr><tr><td>Centralized</td><td>139683</td><td>140041</td><td>144299</td><td>142899</td></tr><tr><td>Decentralized (Ring)</td><td>69841</td><td>17505</td><td>8016</td><td>4554</td></tr><tr><td>Decentralized (Torus)</td><td>139683</td><td>35010</td><td>16033</td><td>9109</td></tr><tr><td>CHOCO (Ring)</td><td>2208</td><td>564</td><td>253</td><td>144</td></tr><tr><td>CHOCO (Torus)</td><td>4417</td><td>1129</td><td>506</td><td>288</td></tr></table>
619
+
620
+ We additionally visualize the learning curves for the social network topology in Fig. 7 and Fig. 8.
621
+
622
+ ![](images/5fedcc5e5b143bc4d80bdbef98522e9808e6e4469abc50cf5bac0d7bd20576d9.jpg)
623
+ Figure 7: Training ResNet $^ { - 2 0 }$ on CIFAR-10 with decentralized algorithm on a real world social network topology. The topology has 32 nodes and we assume each node can only access a disjoint subset of the whole dataset. The local mini-batch size is 32.
624
+
625
+ We additionally provide the learning curves of training top-1, top-5 accuracy and test top-5 accuracy for the datacenter experiment in Fig. 9.
626
+
627
+ ![](images/b9b241bf2e6979e7e3f2871463e8fd1aafc51bd57dbd665ac2c610a20dbd5c41.jpg)
628
+ Figure 8: Training LSTM on WikiText2 with decentralized algorithm on a real world social network topology. The topology has 32 nodes and we assume each node can only access a disjoint subset of the whole dataset. The local mini-batch size is 32.
629
+
630
+ ![](images/ed0703c5379c390e60972af78e676435a6e3d97225d619b1572f2ac2f2267f9d.jpg)
631
+ Figure 9: Large-scale training: ResNet-50 on ImageNet in the datacenter.
md/train/SkgsACVKPH/SkgsACVKPH.md ADDED
@@ -0,0 +1,277 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PICKING WINNING TICKETS BEFORE TRAINING BY PRESERVING GRADIENT FLOW
2
+
3
+ Chaoqi Wang, Guodong Zhang, Roger Grosse University of Toronto, Vector Institute {cqwang, gdzhang, rgrosse}@cs.toronto.edu
4
+
5
+ # ABSTRACT
6
+
7
+ Overparameterization has been shown to benefit both the optimization and generalization of neural networks, but large networks are resource hungry at both training and test time. Network pruning can reduce test-time resource requirements, but is typically applied to trained networks and therefore cannot avoid the expensive training process. We aim to prune networks at initialization, thereby saving resources at training time as well. Specifically, we argue that efficient training requires preserving the gradient flow through the network. This leads to a simple but effective pruning criterion we term Gradient Signal Preservation (GraSP). We empirically investigate the effectiveness of the proposed method with extensive experiments on CIFAR-10, CIFAR-100, Tiny-ImageNet and ImageNet, using VGGNet and ResNet architectures. Our method can prune $80 \%$ of the weights of a VGG-16 network on ImageNet at initialization, with only a $1 . 6 \%$ drop in top-1 accuracy. Moreover, our method achieves significantly better performance than the baseline at extreme sparsity levels. Our code is made public at: https://github.com/alecwangcq/GraSP.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Deep neural networks exhibit good optimization and generalization performance in the overparameterized regime (Zhang et al., 2016; Neyshabur et al., 2019; Arora et al., 2019; Zhang et al., 2019b), but both training and inference for large networks are computationally expensive. Network pruning (LeCun et al., 1990; Hassibi et al., 1993; Han et al., 2015b; Dong et al., 2017; Zeng & Urtasun, 2019; Wang et al., 2019) has been shown to reduce the test-time resource requirements with minimal performance degradation. However, as the pruning is typically done to a trained network, these methods don’t save resources at training time. Moreover, it has been argued that it is hard to train sparse architectures from scratch while maintaining comparable performance to their dense counterparts (Han et al., 2015a; Li et al., 2016). Therefore, we ask: can we prune a network prior to training, so that we can improve computational efficiency at training time?
12
+
13
+ Recently, Frankle & Carbin (2019) shed light on this problem by proposing the Lottery Ticket Hypothesis (LTH), namely that there exist sparse, trainable sub-networks (called “winning tickets”) within the larger network. They identify the winning tickets by taking a pre-trained network and removing connections with weights smaller than a pre-specificed threshold. They then reset the remaining weights to their initial values, and retrain the sub-network from scratch. Hence, they showed that the pre-trained weights are not necessary, only the pruned architecture and the corresponding initial weight values. Nevertheless, like traditional pruning methods, the LTH approach still requires training the full-sized network in order to identify the sparse sub-networks.
14
+
15
+ Can we identify sparse, trainable sub-networks at initialization? This would allow us to exploit sparse computation with specified hardware for saving computation cost. (For instance, Dey et al. (2019) demonstrated ${ 5 } \mathbf { x }$ efficiency gains for training networks with pre-specified sparsity.) At first glance, a randomly initialized network seems to provide little information that we can use to judge the importance of individual connections, since the choice would seem to depend on complicated training dynamics. However, recent work suggests this goal is attainable. Lee et al. (2018) proposed the first algorithm for pruning at initialization time: Single-shot Network Pruning (SNIP), which uses a connection sensitivity criterion to prune weights with both small magnitude and small gradients.
16
+
17
+ Their empirical results are promising in the sense that they can find sparse, trainable sub-networks at initialization. However, connection sensitivity is sub-optimal as a criterion because the gradient of each weight might change dramatically after pruning due to complicated interactions between weights. Since SNIP only considers the gradient for one weight in isolation, it could remove connections that are important to the flow of information through the network. Practically, we find that this blocking of information flow manifests as a reduction in the norm of the gradient.
18
+
19
+ Therefore, we aim to prune connections in a way that accounts for their role in the network’s gradient flow. Specifically, we take the gradient norm after pruning as our criterion, and prune those weights whose removal will result in least decrease in the gradient norm after pruning. Because we rely on preserving the gradient flow to prune the network, we name our method Gradient Signal Preservation (GraSP). Our approach is easy to implement and conceptually simple. Moreover, the recently introduced Neural Tangent Kernel (NTK) (Jacot et al., 2018) provides tools for studying the learning dynamics in the output space. Building on the analysis of Arora et al. (2019), we show that our pruning criterion tends to keep those weights which will be beneficial for optimization. We evaluate GraSP on CIFAR-10, CIFAR-100 (Krizhevsky, 2009), Tiny-ImageNet and ImageNet (Deng et al., 2009) with modern neural networks, such as VGGNet (Simonyan & Zisserman, 2014) and ResNet (He et al., 2016). GraSP significantly outperforms SNIP in the extreme sparsity regime.
20
+
21
+ # 2 RELATED WORK AND BACKGROUND
22
+
23
+ In this section, we review the literature on neural network pruning including pruning after training, pruning during training, dynamic sparse training and pruning before training. We then discuss propagation of signals in deep neural networks and recent works in dynamical isometry and meanfield theory. Lastly, we also review the Neural Tangent Kernel (NTK) (Jacot et al., 2018), which builds up the foundation for justifying our method in Section 4.
24
+
25
+ # 2.1 NETWORK PRUNING
26
+
27
+ After training. Most pruning algorithms (LeCun et al., 1990; Hassibi et al., 1993; Dong et al., 2017; Han et al., 2015b; Li et al., 2016; Molchanov et al., 2016) operate on a pre-trained network. The main idea is to identify those weights which are most redundant, and whose removal will therefore least degrade the performance. Magnitude based pruning algorithms (Han et al., 2015b;a) remove those weights which are smaller than a threshold, which may incorrectly measure the importance of each weight. In contrast, Hessian-based pruning algorithms (LeCun et al., 1990; Hassibi et al., 1993) compute the importance of each weight by measuring how its removal will affect the loss. More recently, Wang et al. (2019) proposed a network reparameterization based on the Kroneckerfactored Eigenbasis for further boosting the performance of Hessian-based methods. However, all the aforementioned methods require pre-training, and therefore aren’t applicable at initialization.
28
+
29
+ During training. There are also some works which attempt to incorporate pruning into the training procedure itself. Srinivas & Babu (2016) proposed generalized dropout, allowing for tuning the individual dropout rates during training, which can result in a sparse network after training. Louizos et al. (2018) proposed a method for dealing with discontinuity in training $L _ { 0 }$ norm regularized networks in order to obtain sparse networks. Both methods require roughly the same computational cost as training the full network.
30
+
31
+ Dynamic Sparse Training Another branch of pruning algorithms is Dynamic Sparse Training methods, which will dynamically change the weight sparsity during training. Representative works, such as Bellec et al. (2018); Mocanu et al. (2018); Mostafa & Wang (2019); Dettmers & Zettlemoyer (2019), follow a prune-redistribute-regrowth cycle for pruning. Among them, Dettmers & Zettlemoyer (2019), proposed the sparse momentum algorithm, which dynamically determines the sparse mask based on the mean momentum magnitude during training. However, their method requires maintaining the momentum of all the weights during training, and thus does not save memory. These techniques generally achieve higher accuracy compared with fixed sparse connectivity, but change the standard training procedure and therefore do not enjoy the potential hardware acceleration.
32
+
33
+ Before training. Pruning at initialization is more challenging because we need to account for the effect on the training dynamics when removing each weight. There have been several attempts to conduct pruning before training. Frankle & Carbin (2019); Frankle et al. (2019) proposed and validated the Lottery Ticket Hypothesis (LTH), namely that the network structure found by traditional pruning algorithms and the corresponding initialization are together sufficient for training the subnetwork from scratch. Lee et al. (2018) proposed the SNIP algorithm, which was the first attempt to directly identify trainable and sparse sub-networks at initialization time. Their method was based on connection sensitivity, which aims to preserve the loss after pruning, and achieved impressive results. Concurrently to our work, Lee et al. (2019b) studied the pruning problem from a signal propagation perspective, and proposed to use an orthogonal initialization to ensure faithful signal propagation. Though their work shares the same spirit as our GraSP algorithm, they focused on the weight initialization scheme, while we focus on the pruning criterion.
34
+
35
+ # 2.2 SIGNAL PROPAGATION AT INITIALIZATION
36
+
37
+ Our pruning criteria shares the same spirit as recent works in dynamical isometry and mean-field theory (Saxe et al., 2013; Xiao et al., 2018; Yang & Schoenholz, 2017; Poole et al., 2016) where they derived initialization scheme theoretically by developing a mean field theory for signal propagation and by characterizing singular values of the input-output Jacobian matrix. Particularly, Xiao et al. (2018) successfully train 10,000-layers vanilla ConvNets with specific initialization scheme. Essentially, this line of work shows that the trainability of a neural network at initialization is crucial for final performance and convergence. While they focus on address the trainability issue of very deep networks, we aim to solve the issue of sparse neural networks. Besides, they measure the trainability by examining the input-output Jacobian while we do that by checking the gradient norm. Though different, gradient norm is closely related to the input-output Jacobian.
38
+
39
+ # 2.3 NEURAL TANGENT KERNEL AND CONVERGENCE ANALYSIS
40
+
41
+ Jacot et al. (2018) analyzed the dynamics of neural net training by directly analyzing the evolution of the network’s predictions in output space. Let $\mathcal { L }$ denote the cost function, $\mathcal { X }$ the set of all training samples, $\mathcal { Z } = \mathbf { \bar { \Phi } } _ { f ( \mathcal { X } ; \pmb { \theta } ) } \in \mathbb { R } ^ { n k \times \bar { 1 } }$ the outputs of the neural network, and $k$ and $n$ the output space dimension and the number of training examples. For a step of gradient descent, the change to the network’s predictions can be approximated with a first-order Taylor approximation:
42
+
43
+ $$
44
+ f ( \mathcal { X } ; \pmb { \theta } _ { t + 1 } ) = f ( \mathcal { X } ; \pmb { \theta } _ { t } ) - \eta \pmb { \Theta } _ { t } ( \mathcal { X } , \mathcal { X } ) \nabla _ { \mathcal { Z } } \mathcal { L } ,
45
+ $$
46
+
47
+ where the matrix $\Theta _ { t } ( \mathcal { X } , \mathcal { X } )$ is the Neural Tangent Kernel (NTK) at time step $t$ :
48
+
49
+ $$
50
+ \begin{array} { r } { \Theta _ { t } ( \mathcal { X } , \mathcal { X } ) = \nabla _ { \theta } f ( \mathcal { X } ; \pmb { \theta } _ { t } ) \nabla _ { \theta } f ( \mathcal { X } ; \pmb { \theta } _ { t } ) ^ { \top } \in \mathbb { R } ^ { n k \times n k } , } \end{array}
51
+ $$
52
+
53
+ where $\nabla _ { \pmb { \theta } } f ( \mathcal { X } ; \pmb { \theta } )$ denotes the network Jacobian over the whole training set. Jacot et al. (2018) showed that for infinitely wide networks, with proper initialization, the NTK exactly captures the output space dynamics throughout training. In particular, $\Theta _ { t } ( \mathcal { X } , \mathcal { X } )$ remains constant throughout training. Arora et al. (2019) used the NTK to analyze optimization and generalization phenomena, showing that under the assumptions of constant NTK and squared error loss, the training dynamics can be analyzed in closed form:
54
+
55
+ $$
56
+ \| \mathcal { V } - f ( \mathcal { X } ; \pmb { \theta } _ { t } ) \| _ { 2 } = \sqrt { \sum _ { i = 1 } ^ { n } ( 1 - \eta \lambda _ { i } ) ^ { 2 t } ( \mathbf { u } _ { i } ^ { \top } \mathcal { Y } ) ^ { 2 } } \pm \epsilon
57
+ $$
58
+
59
+ where $\mathcal { V } \in \mathbb { R } ^ { n k \times 1 }$ is all the targets, $\begin{array} { r } { \Theta = \mathbf { U } \pmb { \Lambda } \mathbf { U } ^ { \top } = \sum _ { i = 1 } ^ { n } \lambda _ { i } \mathbf { u } _ { i } \mathbf { u } _ { i } ^ { \top } } \end{array}$ is the eigendecomposition, and $\epsilon$ is a bounded error term. Although the constant NTK assumption holds only in the infinite width limit, Lee et al. (2019a) found close empirical agreement between the NTK dynamics and the true dynamics for wide but practical networks, such as wide ResNet architectures (Zagoruyko & Komodakis, 2016).
60
+
61
+ # 3 REVISITING SINGLE-SHOT NETWORK PRUNING (SNIP)
62
+
63
+ Single-shot network pruning was introduced by Lee et al. (2018), who used the term to refer both to the general problem setting and to their specific algorithm. To avoid ambiguity, we refer to the general problem of pruning before training as foresight pruning. For completeness, we first revisit the formulation of foresight pruning, and then point out issues of SNIP for motivating our method.
64
+
65
+ Require: Pruning ratio $p$ , training data $\mathcal { D }$ , network $f$ with initial parameters $\pmb { \theta } _ { 0 }$
66
+ 1: $\mathcal { D } _ { b } = \{ ( \mathbf { x } _ { i } , \mathbf { \bar { y } } _ { i } ) \} _ { i = 1 } ^ { b } \sim \mathcal { D }$ $\triangleright$ Sample a collection of training examples
67
+ 2: Compute the Hessian-gradient product $\mathbf { H } \mathbf { g }$ (see Eqn. (8)) $\triangleright$ See Algorithm 2
68
+ 3: $\mathbf { S } ( - \bar { \pmb { \theta } } _ { 0 } ) = - \pmb { \theta } _ { 0 } \odot \mathbf { H } \mathbf { g }$ $\triangleright$ Compute the importance of each weight
69
+ 4: Compute $p _ { \mathrm { t h } }$ percentile of $\mathbf { S } ( - \pmb \theta _ { 0 } )$ as $\tau$
70
+ 5: $\mathbf { m } = \mathbf { S } ( - \pmb { \theta } _ { 0 } ) < \tau$ $\triangleright$ Remove the weights with smallest importance
71
+ 6: Train the network $f _ { \mathrm { m } \odot \theta }$ on $\mathcal { D }$ until convergence.
72
+
73
+ Problem Formulation. Suppose we have a neural network $f$ parameterized by $\pmb \theta \in \mathbb R ^ { d }$ , and our objective is to minimize the empirical risk $\begin{array} { r } { \mathcal { L } ( \pmb { \theta } ) = \frac { 1 } { N } \sum _ { i } \big [ \bar { \ell } ( \hat { f } ( \mathbf { x } _ { i } ; \pmb { \theta } ) , y _ { i } ) \big ] } \end{array}$ given a training set $\mathcal { D } = \{ ( \mathbf { x } _ { i } , y _ { i } ) \} _ { i = 1 } ^ { N }$ . Then, the foresight pruning problem can be formulated as:
74
+
75
+ $$
76
+ \operatorname* { m i n } _ { \mathbf { m } \in \{ 0 , 1 \} ^ { d } } \mathbb { E } _ { ( \mathbf { x } , y ) \sim \mathcal { D } } \left[ \ell \left( f \left( \mathbf { x } ; \mathcal { A } ( \mathbf { m } , \pmb { \theta } _ { 0 } ) \right) , y \right) \right] \quad \mathrm { s . t . } \ \| \mathbf { m } \| _ { 0 } / d = 1 - p
77
+ $$
78
+
79
+ where $\left\lceil p \cdot d \right\rceil$ is the number of weights to be removed, and $\mathcal { A }$ is a known training algorithm (e.g. SGD), which takes the mask $\mathbf { m }$ (here we marginalize out the initial weights $\pmb { \theta } _ { 0 }$ for simplicity), and returns the trained weights. Since globally minimizing Eqn. 4 is intractable, we are instead interested in heuristics that result in good practical performance.
80
+
81
+ Revisiting SNIP. SNIP (Lee et al., 2018) was the first algorithm proposed for foresight pruning, and it leverages the notion of connection sensitivity to remove unimportant connections. They define this in terms of how removing a single weight $\theta _ { q }$ in isolation will affect the loss:
82
+
83
+ $$
84
+ S ( \theta _ { q } ) = \operatorname* { l i m } _ { \epsilon \to 0 } \left| { \frac { { \mathcal { L } } ( \theta _ { 0 } ) - { \mathcal { L } } ( \theta _ { 0 } + \epsilon \delta _ { q } ) } { \epsilon } } \right| = \left| \theta _ { q } { \frac { \partial { \mathcal { L } } } { \partial \theta _ { q } } } \right|
85
+ $$
86
+
87
+ where $\theta _ { q }$ is the $q _ { t h }$ element of $\pmb { \theta } _ { 0 }$ , and $\delta _ { q }$ is a one-hot vector whose $q _ { t h }$ element equals $\theta _ { q }$ . Essentially, SNIP aims to preserve the loss of the original randomly initialized network.
88
+
89
+ Preserving the loss value motivated several classic methods for pruning a trained network, such as optimal brain damage (LeCun et al., 1990) and optimal brain surgery (Hassibi et al., 1993). While the motivation for loss preservation of a trained network is clear, it is less clear why this is a good criterion for foresight pruning. After all, at initialization, the loss is no better than chance. We argue that at the beginning of training, it is more important to preserve the training dynamics than the loss itself. SNIP does not do this automatically, because even if removing a particular connection doesn’t affect the loss, it could still block the flow of information through the network. For instance, we noticed in our experiments that SNIP with a high pruning ratio (e.g. $9 9 \%$ ) tends to eliminate nearly all the weights in a particular layer, creating a bottleneck in the network. Therefore, we would prefer a pruning criterion which accounts for how the presence or absence of one connection influences the training of the rest of the network.
90
+
91
+ # 4 GRADIENT SIGNAL PRESERVATION
92
+
93
+ We now introduce and motivate our foresight pruning criterion, Gradient Signal Preservation (GraSP). To understand the problem we are trying to address, observe that the network after pruning will have fewer parameters and sparse connectivity, hindering the flow of gradients through the network and potentially slowing the optimization. This is reflected in Figure 2, which shows the reduction in gradient norm for random pruning with various pruning ratios. Moreover, the performance of the pruned networks is correspondingly worse (see Table 1).
94
+
95
+ Mathematically, a larger gradient norm indicates that, to the first order, each gradient update achieves a greater loss reduction, as characterized by the following directional derivative:
96
+
97
+ $$
98
+ \Delta \mathcal { L } ( \pmb \theta ) = \operatorname* { l i m } _ { \epsilon 0 } \frac { \mathcal { L } ( \pmb \theta + \epsilon \nabla \mathcal { L } ( \pmb \theta ) ) - \mathcal { L } ( \pmb \theta ) } { \epsilon } = \nabla \mathcal { L } ( \pmb \theta ) ^ { \top } \nabla \mathcal { L } ( \pmb \theta )
99
+ $$
100
+
101
+ We would like to preserve or even increase (if possible) the gradient flow after pruning (i.e., the gradient flow of the pruned network). Following LeCun et al. (1990), we cast the pruning operation
102
+
103
+ # Algorithm 2 Hessian-gradient Product.
104
+
105
+ <table><tr><td rowspan="2">Require: A batch of training data Db,network f with initial parameters 0o,loss function L 1: L(0o)=E(x,y)~Db[e(f(x;00),y)]</td><td colspan="3"></td></tr><tr><td>&gt; Compute the loss and build the computation graph</td><td></td><td></td></tr><tr><td>2: g= grad(L(00),00)</td><td></td><td>&gt; Compute the gradient of loss function with respect to 0o</td><td></td></tr><tr><td>3: Hg = grad(gTstop_grad(g),00) 4: Return Hg</td><td></td><td> Compute the Hessian vector product of Hg</td><td></td></tr></table>
106
+
107
+ as adding a perturbation $\pmb { \delta }$ to the initial weights. We then use a Taylor approximation to characterize how removing one weight will affect the gradient flow after pruning:
108
+
109
+ $$
110
+ \begin{array} { r l } & { \mathbf { S } \left( \delta \right) = \Delta \mathcal { L } ( \pmb { \theta } _ { 0 } + \delta ) - \underbrace { \Delta \mathcal { L } ( \pmb { \theta } _ { 0 } ) } _ { \mathrm { C o n s t } } = 2 \delta ^ { \top } \nabla ^ { 2 } \mathcal { L } ( \pmb { \theta } _ { 0 } ) \nabla \mathcal { L } ( \pmb { \theta } _ { 0 } ) + \mathcal { O } ( \Vert \delta \Vert _ { 2 } ^ { 2 } ) } \\ & { \quad \quad = 2 \delta ^ { \top } \mathbf { H } \mathbf { g } + \mathcal { O } ( \Vert \delta \Vert _ { 2 } ^ { 2 } ) , } \end{array}
111
+ $$
112
+
113
+ where $\mathbf { S } ( \delta )$ approximately measures the change to (6). The Hessian matrix $\mathbf { H }$ captures the dependencies between different weights, and thus helps predict the effect of removing multiple weights. When $\mathbf { H }$ is approximated as the identity matrix, the above criterion recovers SNIP up to the absolute value (recall the SNIP criterion is $| \delta ^ { \top } \mathbf { g } | )$ ). However, it has been observed that different weights are highly coupled (Hassibi et al., 1993), indicating that $\mathbf { H }$ is in fact far from the identity.
114
+
115
+ GraSP uses eqn. (7) as the measure of the importance of each weight. Specifically, if $S ( \delta )$ is negative, then removing the corresponding weights will reduce the gradient flow, while if it is positive, it will increase the gradient flow. We prefer to first remove those weights whose removal will not reduce the gradient flow. For each weight, the importance can be computed in the following way (by an abuse of notation, we use bold S to denote vectorized importance):
116
+
117
+ $$
118
+ \mathbf { S } ( - \pmb { \theta } ) = - \pmb { \theta } \odot \mathbf { H } \mathbf { g }
119
+ $$
120
+
121
+ For a given pruning ratio $p$ , we obtain the resulting pruning mask by computing the importance score of every weight, and removing the bottom $p$ fraction of the weights (see Algorithm 1). Hence, GraSP takes the gradient flow into account for pruning. GraSP is efficient and easy to implement; the Hessian-gradient product can be computed without explicitly constructing the Hessian using higher-order automatic differentiation (Pearlmutter, 1994; Schraudolph, 2002).
122
+
123
+ # 4.1 UNDERSTANDING GRASP THROUGH LINEARIZED TRAINING DYNAMICS
124
+
125
+ The above discussion concerns only the training dynamics at initialization time. To understand the longer-term dynamics, we leverage the recently proposed Neural Tangent Kernel (NTK), which has been shown to be able to capture the training dynamics throughout training for practical networks (Lee et al., 2019a). Specifically, as we introduced in section 2.3, eqn. (3) characterizes how the training error changes throughout the training process, which only depends on time step $t$ , training targets $\mathcal { V }$ and the NTK $\Theta$ . Since the NTK stays almost constant for wide but practical networks (Lee et al., 2019a), e.g., wide ResNet (Zagoruyko & Komodakis, 2016), eqn. 3 is fairly accurate in those settings. This shows that NTK captures the training dynamics throughout the training process. Now we decompose eqn. (6) in the following form:
126
+
127
+ $$
128
+ \nabla \mathcal { L } ( \pmb { \theta } ) ^ { \top } \nabla \mathcal { L } ( \pmb { \theta } ) = \nabla _ { \mathcal { Z } } \mathcal { L } ^ { \top } \Theta ( \mathcal { X } , \mathcal { X } ) \nabla _ { \mathcal { Z } } \mathcal { L } = ( \mathbf { U } ^ { \top } \nabla _ { \mathcal { Z } } \mathcal { L } ) ^ { \top } \mathbf { A } ( \mathbf { U } ^ { \top } \nabla _ { \mathcal { Z } } \mathcal { L } ) = \sum _ { i = 1 } ^ { n } \lambda _ { i } ( \mathbf { u } _ { i } ^ { \top } \mathcal { Y } ) ^ { 2 }
129
+ $$
130
+
131
+ By relating it to eqn. (3), we can see that GraSP implicitly encourages $\Theta$ to be large in the directions corresponding to output space gradients. Since larger eigenvalue directions of $\Theta$ train faster according to eqn. (3), this suggests that GraSP should result in efficient training. In practice, the increasing of gradient norm might be achieved by increasing the loss. Therefore, we incorporate a temperature term on the logits to smooth the prediction, and so as to reduce the effect introduced by the loss.
132
+
133
+ # 5 EXPERIMENTS
134
+
135
+ In this section, we conduct various experiments to validate the effectiveness of our proposed singleshot pruning algorithm in terms of the test accuracy vs. pruning ratios by comparing against
136
+
137
+ Table 1: Comparisons with Random Pruning with VGG19 and ResNet32 on CIFAR-10/100.
138
+
139
+ <table><tr><td>Dataset</td><td colspan="4">CIFAR-10</td><td colspan="4">CIFAR-100</td></tr><tr><td>Pruning ratio</td><td>95%</td><td>98%</td><td>99%</td><td>99.5%</td><td>95%</td><td>98%</td><td>99%</td><td>99.5%</td></tr><tr><td>Random Pruning (VGG19) GraSP (VGG19)</td><td>89.47(0.5) 93.04(0.2)</td><td>86.71(0.7) 92.19(0.1)</td><td>82.21(0.5) 91.33(0.1)</td><td>72.89(1.6) 88.61(0.7)</td><td>66.36(0.3) 71.23(0.1)</td><td>61.33(0.1) 68.90(0.5)</td><td>55.18(0.6) 66.15(0.2)</td><td>36.88(6.8) 60.21(0.1)</td></tr><tr><td>Random Pruning (ResNet32) GraSP (ResNet32)</td><td>89.75(0.1) 91.39(0.3)</td><td>85.90(0.4) 88.81(0.1)</td><td>71.78(9.9) 85.43(0.5)</td><td>50.08(7.0) 80.50(0.3)</td><td>64.72(0.2) 66.50(0.1)</td><td>50.92(0.9) 58.43(0.4)</td><td>34.62(2.8) 48.73(0.3)</td><td>18.51(0.43) 35.55(2.4)</td></tr></table>
140
+
141
+ Table 2: Test accuracy of pruned VGG19 and ResNet32 on CIFAR-10 and CIFAR-100 datasets. The bold number is the higher one between the accuracy of GraSP and that of SNIP.
142
+
143
+ <table><tr><td>Dataset</td><td colspan="3">CIFAR-10</td><td colspan="3">CIFAR-100</td></tr><tr><td>Pruning ratio</td><td>90%</td><td>95%</td><td>98%</td><td>90%</td><td>95%</td><td>98%</td></tr><tr><td>VGG19 (Baseline)</td><td>94.23</td><td>-</td><td>-</td><td>74.16</td><td>=</td><td>-</td></tr><tr><td>OBD (LeCun et al., 1990)</td><td>93.74</td><td>93.58</td><td>93.49</td><td>73.83</td><td>71.98</td><td>67.79</td></tr><tr><td>MLPrune (Zeng &amp; Urtasun,2019)</td><td>93.83</td><td>93.69</td><td>93.49</td><td>73.79</td><td>73.07</td><td>71.69</td></tr><tr><td>LT(original initialization)</td><td>93.51</td><td>92.92</td><td>92.34</td><td>72.78</td><td>71.44</td><td>68.95</td></tr><tr><td>LT (reset to epoch 5)</td><td>93.82</td><td>93.61</td><td>93.09</td><td>74.06</td><td>72.87</td><td>70.55</td></tr><tr><td>DSR (Mostafa &amp; Wang,2019)</td><td>93.75</td><td>93.86</td><td>93.13</td><td>72.31</td><td>71.98</td><td>70.70</td></tr><tr><td>SET Mocanu et al. (2018)</td><td>92.46</td><td>91.73</td><td>89.18</td><td>72.36</td><td>69.81</td><td>65.94</td></tr><tr><td>Deep-R (Bellec et al., 2018)</td><td>90.81</td><td>89.59</td><td>86.77</td><td>66.83</td><td>63.46</td><td>59.58</td></tr><tr><td>SNIP (Lee et al., 2018)</td><td>93.63±0.06</td><td>93.43±0.20</td><td>92.05±0.28</td><td>72.84±0.22</td><td>71.83±0.23</td><td>58.46±1.10</td></tr><tr><td>GraSP</td><td>93.30±0.14</td><td>93.04±0.18</td><td>92.19±0.12</td><td>71.95±0.18</td><td>71.23±0.12</td><td>68.90±0.47</td></tr><tr><td>ResNet32 (Baseline)</td><td>94.80</td><td></td><td>=</td><td>74.64</td><td>=</td><td></td></tr><tr><td>OBD (LeCun et al., 1990)</td><td>94.17</td><td>93.29</td><td>90.31</td><td>71.96</td><td>68.73</td><td>60.65</td></tr><tr><td>MLPrune (Zeng &amp; Urtasun,2019)</td><td>94.21</td><td>93.02</td><td>89.65</td><td>72.34</td><td>67.58</td><td>59.02</td></tr><tr><td>LT(original initialization)</td><td>92.31</td><td>91.06</td><td>88.78</td><td>68.99</td><td>65.02</td><td>57.37</td></tr><tr><td>LT (reset to epoch 5)</td><td>93.97</td><td>92.46</td><td>89.18</td><td>71.43</td><td>67.28</td><td>58.95</td></tr><tr><td>DSR (Mostafa &amp; Wang,2019)</td><td>92.97</td><td>91.61</td><td>88.46</td><td>69.63</td><td>68.20</td><td>61.24</td></tr><tr><td>SET Mocanu et al. (2018)</td><td>92.30</td><td>90.76</td><td>88.29</td><td>69.66</td><td>67.41</td><td>62.25</td></tr><tr><td>Deep-R (Bellec et al.,2018)</td><td>91.62</td><td>89.84</td><td>86.45</td><td>66.78</td><td>63.90</td><td>58.47</td></tr><tr><td>SNIP (Lee et al., 2018)</td><td>92.59±0.10</td><td>91.01±0.21</td><td>87.51±0.31</td><td>68.89±0.45</td><td>65.22±0.69</td><td></td></tr><tr><td>GraSP</td><td>92.38±0.21</td><td>91.39±0.25</td><td>88.81±0.14</td><td>69.24±0.24</td><td>66.50±0.11</td><td>54.81±1.43 58.43±0.43</td></tr></table>
144
+
145
+ SNIP. We also include three Dynamic Sparse Training methods, DSR (Mostafa & Wang, 2019), SET (Mocanu et al., 2018) and Deep-R (Bellec et al., 2018). We further include two traditional pruning algorithms (LeCun et al., 1990; Zeng & Urtasun, 2019), which operate on the pre-trained networks, for serving as an upper bound for foresight pruning. Besides, we study the convergence performance of the sub-networks obtained by different pruning methods for investigating the relationship between gradient norm and final performance. Lastly, we study the role of initialization and batch sizes in terms of the performance of GraSP for ablation study.
146
+
147
+ # 5.1 PRUNING RESULTS ON MODERN CONVNETS
148
+
149
+ To evaluate the effectiveness of GraSP on real world tasks, we test GraSP on four image classification datasets, CIFAR-10/100, Tiny-ImageNet and ImageNet, with two modern network architectures, VGGNet and ResNet1. For the experiments on CIFAR-10/100 and Tiny-ImageNet, we use a minibatch with ten times of the number of classes for both GraSP and $\mathrm { S N I P } ^ { 2 }$ according to Lee et al. (2018). The pruned network is trained with Kaiming initialization (He et al., 2015) using SGD for 160 epochs for CIFAR-10/100, and 300 epochs for Tiny-ImageNet, with an initial learning rate of 0.1 and batch size 128. The learning rate is decayed by a factor of 0.1 at $1 / 2$ and $3 / 4$ of the total number of epochs. Moreover, we run each experiment for 3 trials for obtaining more stable results. For ImageNet, we adopt the Pytorch (Paszke et al., 2017) official implementation, but we used more epochs for training according to Liu et al. (2019). Specifically, we train the pruned networks with SGD for 150 epochs, and decay the learning rate by a factor of 0.1 every 50 epochs.
150
+
151
+ We first compre GraSP against random pruning, which generates the mask randomly for a given pruning ratio. The test accuracy is reported in Table 1. We can observe GraSP clearly outperforms random pruning, and the performance gap can be up to more than $3 0 \%$ in terms of test accuracy. We further compare GraSP with more competitive baselines on CIFAR-10/100 and Tiny-ImageNet for pruning ratios $\{ 8 5 \% , 9 0 \% , 9 5 \% , 9 8 \% \}$ , and the results can be referred in Table 2 and 4. When the pruning ratio is low, i.e. $8 5 \%$ , $9 0 \%$ , both SNIP and GraSP can achieve very close results to the baselines, though still do not outperform pruning algorithms that operate on trained networks, as expected. However, GraSP achieves significant better results for higher pruning ratios with more complicated networks (e.g. ResNet) and datasets (e.g. CIFAR-100 and Tiny-ImageNet), showing the advantages of directly relating the pruning criteria with the gradient flow after pruning. Moreover, in most cases, we notice that either SNIP or GraSP can match or even slightly outperform LT with original initialization, which indicates that both methods can identify meaningful structures. We further experiment with the late resetting as suggested in Frankle et al. (2019) by resetting the weights of the winning tickets to their values at 5 epoch. By doing so, we observe a boost in the performance of the LT across all the settings, which is consistent with (Frankle et al., 2019). As for the comparisons with Dynamic Sparse Training (DST) methods, DSR is the best performing one, and also we can observe that GraSP is still quite competitive to them even though without the flexibility to change the sparsity during training. In particular, GraSP can outperform Deep-R in almost all the settings, and surpasses SET in more than half of the settings.
152
+
153
+ Table 4: Test accuracy of pruned VGG19 and ResNet32 on Tiny-ImageNet dataset. The bold number is the higher one between the accuracy of GraSP and that of SNIP.
154
+
155
+ <table><tr><td>Network</td><td colspan="3">VGG19</td><td colspan="3">ResNet32</td></tr><tr><td>Pruning ratio</td><td>90%</td><td>95%</td><td>98%</td><td>85%</td><td>90%</td><td>95%</td></tr><tr><td>VGG19/ResNet32 (Baseline)</td><td>61.38</td><td>■</td><td>=</td><td>62.89</td><td>1</td><td>-</td></tr><tr><td>OBD (LeCun et al., 1990)</td><td>61.21</td><td>60.49</td><td>54.98</td><td>58.55</td><td>56.80</td><td>51.00</td></tr><tr><td>MLPrune (Zeng &amp; Urtasun, 2019)</td><td>60.23</td><td>59.23</td><td>55.55</td><td>58.86</td><td>57.62</td><td>51.70</td></tr><tr><td>LT(original initialization)</td><td>60.32</td><td>59.48</td><td>55.12</td><td>56.52</td><td>54.27</td><td>49.47</td></tr><tr><td>LT (reset to epoch 5)</td><td>61.19</td><td>60.57</td><td>56.18</td><td>60.31</td><td>57.77</td><td>51.21</td></tr><tr><td>DSR (Mostafa&amp; Wang,2019)</td><td>62.43</td><td>59.81</td><td>58.36</td><td>57.08</td><td>57.19</td><td>56.08</td></tr><tr><td>SET Mocanu et al. (2018)</td><td>62.49</td><td>59.42</td><td>56.22</td><td>57.02</td><td>56.92</td><td>56.18</td></tr><tr><td>Deep-R (Bellec et al., 2018)</td><td>55.64</td><td>52.93</td><td>49.32</td><td>53.29</td><td>52.62</td><td>52.00</td></tr><tr><td>SNIP (Lee et al., 2018)</td><td>61.02±0.41</td><td>59.27±0.39</td><td>48.95±1.73</td><td>56.33±0.24</td><td>55.43±0.14</td><td>49.57±0.44</td></tr><tr><td>GraSP</td><td>60.76±0.23</td><td>59.50±0.33</td><td>57.28±0.34</td><td>57.25±0.11</td><td>55.53±0.11</td><td>51.34±0.29</td></tr></table>
156
+
157
+ Table 3: Test accuracy of ResNet-50 and VGG16 on ImageNet with pruning ratios $60 \%$ , $80 \%$ and $90 \%$ .
158
+
159
+ <table><tr><td>Pruning ratios</td><td colspan="2">60%</td><td colspan="2">80%</td><td colspan="2">90%</td></tr><tr><td>Accuracy</td><td>top-1</td><td>top-5</td><td>top-1</td><td>top5</td><td>top-1</td><td>top5</td></tr><tr><td>ResNet-50 (Baseline)</td><td>75.70</td><td>92.81</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>SNIP (Lee et al., 2018)</td><td>73.95</td><td>91.97</td><td>69.67</td><td>89.24</td><td>61.97</td><td>82.90</td></tr><tr><td>GraSP</td><td>74.02</td><td>91.86</td><td>72.06</td><td>90.82</td><td>68.14</td><td>88.67</td></tr><tr><td>VGG16 (Baseline)</td><td>73.37</td><td>91.47</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>SNIP (Lee et al., 2018)</td><td>72.95</td><td>91.39</td><td>69.96</td><td>89.71</td><td>65.27</td><td>86.14</td></tr><tr><td>GraSP</td><td>72.91</td><td>91.18</td><td>71.65</td><td>90.58</td><td>69.94</td><td>89.48</td></tr></table>
160
+
161
+ However, the above three datasets are overly simple and small-scale to draw robust conclusions, and thus we conduct further experiments on ImageNet using ResNet-50 and VGG16 with pruning ratios $\{ 6 0 \% , 8 0 \% , 9 0 \% \}$ to validate the effectiveness of GraSP. The results are shown in Table 3, we can see that when the pruning ratio is $6 0 \%$ , both SNIP and GraSP can achieve very close performance to the original one, and these two methods perform
162
+
163
+ almost the same. However, as we increase the pruning ratio, we observe that GraSP surpasses SNIP more and more. When the pruning ratio is $9 0 \%$ , GraSP can beat SNIP by $6 . 2 \%$ for ResNet-50 and $4 . 7 \%$ for VGG16 in top-1 accuracy, showing the advantages of GraSP at larger pruning ratios. We seek to investigate the reasons behind in Section 5.2 for obtaining a better understanding on GraSP.
164
+
165
+ # 5.2 ANALYSIS ON CONVERGENCE PERFORMANCE AND GRADIENT NORM
166
+
167
+ Based on our analysis in Section 4.1 and the observations in the previous subsection, we conduct further experiments on CIFAR-100 with ResNet32 to investigate where the performance gains come from in the high sparsity regions. We present the training statistics in terms of the training and test loss in Figure 1. We observe that the main bottleneck of pruned neural networks is underfitting, and thus support our optimization considerations when deriving the pruning criteria. As a result, the network pruned with GraSP can achieve much lower loss for both training and testing and the decrease in training loss is also much faster than SNIP.
168
+
169
+ ![](images/b7542313403f9708c12c64d27ce2e96a4be8323c3f63ce09dac0d333d16614d0.jpg)
170
+ Figure 1: The training and testing loss on CIFAR-100 of SNIP and GraSP with ResNet32 and a pruning ratio of $9 8 \%$ .
171
+ Bengio, 2010), as well as different mini-batch sizes. We present the mean and standard variance
172
+
173
+ ![](images/ef89a263c3550772962c5d52a621f11826fd9abf219e05253199ccc470652f43.jpg)
174
+ Figure 2: The gradient norm of ResNet32 after pruning on CIFAR-100 of various pruning ratios. Shaded area is the $9 5 \%$ confidence interval calculated with 10 trials.
175
+
176
+ ![](images/4d380df33762432a87531311a5f63dbd58fb19496d10387a98bfbbcefcc1173c.jpg)
177
+ Figure 3: The portion of remaining weights at each layer after pruning with a pruning ratio of $9 5 \%$ .
178
+
179
+ Besides, we also plot the gradient norm of pruned networks at initialization for a ResNet32 on CIFAR-100. The gradient norm is computed as the average of the gradients over the entire dataset, and we normalize the gradient of the original network to be 1. We run each experiment for 10 trials in order to obtain more stable results. We observe that both SNIP and GraSP result in a lower gradient norm at high sparsity (e.g. $9 8 \%$ ), but GraSP can better preserve the gradient norm after pruning, and also yield better results than SNIP at the high sparsity regions. Moreover, in these high sparsity regions, the pruned network usually underfits the training data, and thus the optimization will be a problem. The randomly pruned network has a much lower gradient norm and performs the worst. In contrast, the network pruned by GraSP can start with a higher gradient norm and thus hopefully more training progress can be made as evidenced by our results in Figure 1.
180
+
181
+ # 5.3 VISUALIZING THE NETWORK AFTER PRUNING
182
+
183
+ In order to probe the difference of the network pruned by SNIP and GraSP, we present the portion of the remaining weights at each layer of the sparse network obtained by SNIP and GraSP in Figure. 3. We observe that these two pruning methods result in different pruning strategies. Specifically, GraSP aims for preserving the gradient flow after pruning, and thus will not prune too aggressively for each layer. Moreover, it has been known that those convolutional layers at the top usually learn highly sparse features and thus more weights can be pruned (Zhang et al., 2019a). As a result, both methods prune most of the weights at the top layers, but GraSP will preserve more weights than SNIP due to the consideration of preserving the gradient flow. In contrast, SNIP is more likely to prune nearly all the weights in top layers, and thus those layers will be the bottleneck of blocking the information flow from the output layer to the input layer.
184
+
185
+ # 5.4 EFFECT OF BATCH SIZE AND INITIALIZATION
186
+
187
+ We also study how the batch size and initialization will affect GraSP on CIFAR-10 and CIFAR100 with ResNet32 for showing the robustness to different hyperparameters. Specifically, we test GraSP with three different initialization methods: Kaiming normal (He et al., 2015), Normal $\mathcal { N } ( 0 , 0 . 1 \bar { ) }$ , and Xavier normal (Glorot &
188
+
189
+ Table 5: Mean and standard variance of the test accuracy on CIFAR-10 and CIFAR-100 with ResNet32.
190
+
191
+ <table><tr><td rowspan="2">Dataset</td><td colspan="2">CIFAR-10</td><td colspan="2">CIFAR-100</td></tr><tr><td>60%</td><td>90%</td><td>60%</td><td>90%</td></tr><tr><td>Kaiming</td><td>93.42 ± 0.39</td><td>92.12 ± 0.39</td><td>71.60 ± 0.65</td><td>68.93 ± 0.36</td></tr><tr><td>Normal</td><td>93.31± 0.36</td><td>92.13 ± 0.36</td><td>71.48 ± 0.60</td><td>67.98 ± 0.83</td></tr><tr><td>Xavier</td><td>93.32 ± 0.25</td><td>92.22 ± 0.50</td><td>71.10 ± 1.27</td><td>68.11 ± 0.93</td></tr></table>
192
+
193
+ of the test accuracy obtained with different initialization methods and by varying the batch sizes in Table 5. For CIFAR-10 and CIFAR-100, we use batch sizes $\{ 1 0 0 , 4 0 0 , \cdot \cdot \cdot , 2 5 6 0 0 , 5 0 0 0 0 \}$ and $\{ 1 0 0 0 , 4 0 0 0 , 1 6 0 0 0 , 3 2 0 0 0 , 5 0 0 0 0 \}$ respectively. We observe that GraSP can achieve reasonable performance with different initialization methods, and also the effect of batch size is minimal for networks pruned with Kaiming initialization, which is one of the most commonly adopted initialization techniques in training neural networks.
194
+
195
+ # 6 DISCUSSION AND CONCLUSION
196
+
197
+ We propose Gradient Signal Preservation (GraSP), a pruning criterion motivated by preserving the gradient flow through the network after pruning. It can also be interpreted as aligning the large eigenvalues of the Neural Tangent Kernel with the targets. Empirically, GraSP is able to prune the weights of a network at initialization, while still performing competitively to traditional pruning algorithms, which requires first training the network. More broadly, foresight pruning can be a way for enabling training super large models that no existing GPUs can fit in, and also reduce the training cost by adopting sparse matrices operations. Readers may notice that there is still a performance gap between GraSP and traditional pruning algorithms, and also the LT with late resetting performs better than LT with original initialization. However, this does not negate the possibility that foresight pruning can match the performance of traditional pruning algorithms while still enjoying cheaper training cost. As evidence, Evci et al. (2019) show that there exists a linear and monotonically decreasing path from the sparse initialization to the solution found by pruning the fully-trained dense network, but current optimizers fail to achieve this. Therefore, designing better gradient-based optimizers that can exploit such paths will also be a good direction to explore.
198
+
199
+ # REFERENCES
200
+
201
+ Sanjeev Arora, Simon S Du, Wei Hu, Zhiyuan Li, and Ruosong Wang. Fine-grained analysis of optimization and generalization for overparameterized two-layer neural networks. In Proceedings of the 36th International Conference on Machine Learning, pp. 322–332, 2019.
202
+ Guillaume Bellec, David Kappel, Wolfgang Maass, and Robert Legenstein. Deep rewiring: Training very sparse deep networks. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id ${ \underline { { \underline { { \mathbf { \Pi } } } } } } =$ BJ_wN01C-.
203
+ 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, 2009.
204
+ Tim Dettmers and Luke Zettlemoyer. Sparse networks from scratch: Faster training without losing performance. arXiv preprint arXiv:1907.04840, 2019.
205
+ Sourya Dey, Kuan-Wen Huang, Peter A Beerel, and Keith M Chugg. Pre-defined sparse neural networks with hardware acceleration. IEEE Journal on Emerging and Selected Topics in Circuits and Systems, 2019.
206
+ Xin Dong, Shangyu Chen, and Sinno Pan. Learning to prune deep neural networks via layer-wise optimal brain surgeon. In Advances in Neural Information Processing Systems, pp. 4857–4867, 2017.
207
+ Utku Evci, Fabian Pedregosa, Aidan Gomez, and Erich Elsen. The difficulty of training sparse neural networks. arXiv preprint arXiv:1906.10732, 2019.
208
+ Jonathan Frankle and Michael Carbin. The lottery ticket hypothesis: Finding sparse, trainable neural networks. In International Conference on Learning Representations, 2019. URL https: //openreview.net/forum?id=rJl-b3RcF7.
209
+ Jonathan Frankle, Gintare Karolina Dziugaite, Daniel M Roy, and Michael Carbin. The lottery ticket hypothesis at scale. arXiv preprint arXiv:1903.01611, 2019.
210
+
211
+ 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.
212
+
213
+ Song Han, Huizi Mao, and William J Dally. Deep compression: Compressing deep neural networks with pruning, trained quantization and huffman coding. International Conference on Learning Representations, 2015a.
214
+
215
+ 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.
216
+
217
+ Babak Hassibi, David G Stork, and Gregory J Wolff. Optimal brain surgeon and general network pruning. In IEEE international conference on neural networks, pp. 293–299. IEEE, 1993.
218
+
219
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In Proceedings of the IEEE international conference on computer vision, pp. 1026–1034, 2015.
220
+
221
+ 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.
222
+
223
+ Arthur Jacot, Franck Gabriel, and Clément Hongler. Neural tangent kernel: Convergence and generalization in neural networks. In Advances in neural information processing systems, pp. 8571–8580, 2018.
224
+
225
+ Alex Krizhevsky. Learning multiple layers of features from tiny images. Technical report, Citeseer, 2009.
226
+
227
+ Yann LeCun, John S Denker, and Sara A Solla. Optimal brain damage. In Advances in neural information processing systems, pp. 598–605, 1990.
228
+
229
+ Jaehoon Lee, Lechao Xiao, Samuel S Schoenholz, Yasaman Bahri, Jascha Sohl-Dickstein, and Jeffrey Pennington. Wide neural networks of any depth evolve as linear models under gradient descent. arXiv preprint arXiv:1902.06720, 2019a.
230
+
231
+ Namhoon Lee, Thalaiyasingam Ajanthan, and Philip HS Torr. Snip: Single-shot network pruning based on connection sensitivity. International Conference on Learning Representations, 2018.
232
+
233
+ Namhoon Lee, Thalaiyasingam Ajanthan, Stephen Gould, and Philip HS Torr. A signal propagation perspective for pruning neural networks at initialization. arXiv preprint arXiv:1906.06307, 2019b.
234
+
235
+ Hao Li, Asim Kadav, Igor Durdanovic, Hanan Samet, and Hans Peter Graf. Pruning filters for efficient convnets. International Conference on Learning Representations, 2016.
236
+
237
+ Zhuang Liu, Mingjie Sun, Tinghui Zhou, Gao Huang, and Trevor Darrell. Rethinking the value of network pruning. International Conference on Learning Representations, 2019.
238
+
239
+ Christos Louizos, Max Welling, and Diederik P Kingma. Learning sparse neural networks through l_0 regularization. International Conference on Learning Representations, 2018.
240
+
241
+ Decebal Constantin Mocanu, Elena Mocanu, Peter Stone, Phuong H Nguyen, Madeleine Gibescu, and Antonio Liotta. Scalable training of artificial neural networks with adaptive sparse connectivity inspired by network science. Nature communications, 9(1):2383, 2018.
242
+
243
+ Pavlo Molchanov, Stephen Tyree, Tero Karras, Timo Aila, and Jan Kautz. Pruning convolutional neural networks for resource efficient inference. International Conference on Learning Representations, 2016.
244
+
245
+ Hesham Mostafa and Xin Wang. Parameter efficient training of deep convolutional neural networks by dynamic sparse reparameterization. International Conference on Machine Learning, 2019.
246
+
247
+ Behnam Neyshabur, Zhiyuan Li, Srinadh Bhojanapalli, Yann LeCun, and Nathan Srebro. The role of over-parametrization in generalization of neural networks. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id $\equiv$ BygfghAcYX.
248
+
249
+ Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan, Edward Yang, Zachary DeVito, Zeming Lin, Alban Desmaison, Luca Antiga, and Adam Lerer. Automatic differentiation in pytorch. 2017.
250
+
251
+ Barak A Pearlmutter. Fast exact multiplication by the Hessian. Neural computation, 6(1):147–160, 1994.
252
+
253
+ Ben Poole, Subhaneil Lahiri, Maithra Raghu, Jascha Sohl-Dickstein, and Surya Ganguli. Exponential expressivity in deep neural networks through transient chaos. In Advances in neural information processing systems, pp. 3360–3368, 2016.
254
+
255
+ Andrew M Saxe, James L McClelland, and Surya Ganguli. Exact solutions to the nonlinear dynamics of learning in deep linear neural networks. arXiv preprint arXiv:1312.6120, 2013.
256
+
257
+ Nicol N Schraudolph. Fast curvature matrix-vector products for second-order gradient descent. Neural computation, 14(7):1723–1738, 2002.
258
+
259
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. International Conference on Learning Representations, 2014.
260
+
261
+ Suraj Srinivas and R Venkatesh Babu. Generalized dropout. arXiv preprint arXiv:1611.06791, 2016.
262
+
263
+ Chaoqi Wang, Roger Grosse, Sanja Fidler, and Guodong Zhang. EigenDamage: Structured pruning in the Kronecker-factored eigenbasis. In Proceedings of the 36th International Conference on Machine Learning, volume 97, pp. 6566–6575. PMLR, 2019. URL http://proceedings. mlr.press/v97/wang19g.html.
264
+
265
+ Lechao Xiao, Yasaman Bahri, Jascha Sohl-Dickstein, Samuel Schoenholz, and Jeffrey Pennington. Dynamical isometry and a mean field theory of cnns: How to train 10,000-layer vanilla convolutional neural networks. In International Conference on Machine Learning, pp. 5393–5402, 2018.
266
+
267
+ Ge Yang and Samuel Schoenholz. Mean field residual networks: On the edge of chaos. In Advances in neural information processing systems, pp. 7103–7114, 2017.
268
+
269
+ Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. In BMVC, 2016.
270
+
271
+ Wenyuan Zeng and Raquel Urtasun. MLPrune: Multi-layer pruning for automated neural network compression, 2019. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ r1g5b2RcKm.
272
+
273
+ Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. International Conference on Learning Representations, 2016.
274
+
275
+ Chiyuan Zhang, Samy Bengio, and Yoram Singer. Are all layers created equal? arXiv preprint arXiv:1902.01996, 2019a.
276
+
277
+ Guodong Zhang, James Martens, and Roger Grosse. Fast convergence of natural gradient descent for overparameterized neural networks. arXiv preprint arXiv:1905.10961, 2019b.
md/train/Syx5V2CcFm/Syx5V2CcFm.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/TtYSU29zgR/TtYSU29zgR.md ADDED
@@ -0,0 +1,428 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PRIMAL WASSERSTEIN IMITATION LEARNING
2
+
3
+ Robert Dadashi∗1, Léonard Hussenot1,2, Matthieu Geist1, Olivier Pietquin1
4
+ 1Google Research, Brain Team
5
+ 2Univ. de Lille, CNRS, Inria Scool, UMR 9189 CRIStAL
6
+
7
+ # ABSTRACT
8
+
9
+ Imitation Learning (IL) methods seek to match the behavior of an agent with that of an expert. In the present work, we propose a new IL method based on a conceptually simple algorithm: Primal Wasserstein Imitation Learning (PWIL), which ties to the primal form of the Wasserstein distance between the expert and the agent state-action distributions. We present a reward function which is derived offline, as opposed to recent adversarial $\mathrm { I L }$ algorithms that learn a reward function through interactions with the environment, and which requires little fine-tuning. We show that we can recover expert behavior on a variety of continuous control tasks of the MuJoCo domain in a sample efficient manner in terms of agent interactions and of expert interactions with the environment. Finally, we show that the behavior of the agent we train matches the behavior of the expert with the Wasserstein distance, rather than the commonly used proxy of performance.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Reinforcement Learning (RL) has solved a number of difficult tasks whether in games (Tesauro, 1995; Mnih et al., 2015; Silver et al., 2016) or robotics (Abbeel & Ng, 2004; Andrychowicz et al., 2020). However, RL relies on the existence of a reward function, that can be either hard to specify or too sparse to be used in practice. Imitation Learning (IL) is a paradigm that applies to these environments with hard to specify rewards: we seek to solve a task by learning a policy from a fixed number of demonstrations generated by an expert.
14
+
15
+ IL methods can typically be folded into two paradigms: Behavioral Cloning, or BC (Pomerleau, 1991; Bagnell et al., 2007; Ross & Bagnell, 2010) and Inverse Reinforcement Learning, or IRL (Russell, 1998; Ng et al., 2000). In BC, we seek to recover the expert’s behavior by directly learning a policy that matches the expert behavior in some sense. In IRL, we assume that the demonstrations come from an agent that acts optimally with respect to an unknown reward function that we seek to recover, to subsequently train an agent on it. Although IRL methods introduce an intermediary problem (i.e. recovering the environment’s reward) they are less sensitive to distributional shift (Pomerleau, 1991), they generalize to environments with different dynamics (Piot et al., 2013), and they can recover a near-optimal agent from suboptimal demonstrations (Brown et al., 2019; Jacq et al., 2019).
16
+
17
+ However, IRL methods are usually based on an iterative process alternating between reward estimation and RL, which might result in poor sample-efficiency. Earlier IRL methods $\mathrm { N g }$ et al., 2000; Abbeel & Ng, 2004; Ziebart et al., 2008) require multiple calls to a Markov decision process solver (Puterman, 2014), whereas recent adversarial IL approaches (Finn et al., 2016; Ho & Ermon, 2016; Fu et al., 2018) interleave the learning of the reward function with the learning process of the agent. Adversarial IL methods are based on an adversarial training paradigm similar to Generative Adversarial Networks (GANs) (Goodfellow et al., 2014), where the learned reward function can be thought of as the confusion of a discriminator that learns to differentiate expert transitions from non expert ones. These methods are well suited to the IL problem since they implicitly minimize an $f$ -divergence between the state-action distribution of an expert and the state-action distribution of the learning agent (Ghasemipour et al., 2019; Ke et al., 2019). However the interaction between a generator (the policy) and the discriminator (the reward function) makes it a minmax optimization problem, and therefore comes with practical challenges that might include training instability, sensitivity to hyperparameters and poor sample efficiency.
18
+
19
+ In this work, we use the Wasserstein distance as a measure between the state-action distributions of the expert and of the agent. Contrary to $f$ -divergences, the Wasserstein distance is a true distance, it is smooth and it is based on the geometry of the metric space it operates on. The Wasserstein distance has gained popularity in GAN approaches (Arjovsky et al., 2017) through its dual formulation which comes with challenges (see Section 5). Our approach is novel in the fact that we consider the problem of minimizing the Wasserstein distance through its primal formulation. Crucially, the primal formulation prevents the minmax optimization problem, and requires little fine tuning.
20
+
21
+ We introduce a reward function computed offline based on an upper bound of the primal form of the Wasserstein distance. As the Wasserstein distance requires a distance between state-action pairs, we show that it can be hand-defined for locomotion tasks, and that it can be learned from pixels for a hand manipulation task. The inferred reward function is non-stationary, like adversarial IL methods, but it is not re-evaluated as the agent interacts with the environment, therefore the reward function we define is computed offline. We present a true distance to compare the behavior of the expert and the behavior of the agent, rather than using the common proxy of performance with respect to the true return of the task we consider (as it is unknown in general). Our method recovers expert behaviour comparably to existing state-of-the-art methods while being based on significantly fewer hyperparameters; it operates even in the extreme low data regime of demonstrations, and is the first method that makes Humanoid run with a single (subsampled) demonstration.
22
+
23
+ # 2 BACKGROUND AND NOTATIONS
24
+
25
+ Markov decision processes. We describe environments as episodic Markov Decision Processes (MDP) with finite time horizon (Sutton & Barto, 2018) $( \mathcal { S } , \mathcal { A } , \mathcal { P } , r , \gamma , \rho _ { 0 } , T )$ , where $s$ is the state space, $\mathcal { A }$ is the action space, $\mathcal { P }$ is the transition kernel, $r$ is the reward function, $\gamma$ is the discount factor, $\rho _ { 0 }$ is the initial state distribution and $T$ is the time horizon. We will denote the dimensionality of $s$ and $\mathcal { A }$ as $| S |$ and $| { \cal A } |$ respectively. A policy $\pi$ is a mapping from states to distributions over actions; we denote the space of all policies by $\Pi$ . In RL, the goal is to learn a policy $\pi ^ { * }$ that maximizes the expected sum of discounted rewards it encounters, that is, the expected return. Depending on the context, we might use the concept of a cost $c$ rather than a reward $r$ (Puterman, 2014), which essentially moves the goal of the policy from maximizing its return to minimizing its cumlative cost.
26
+
27
+ State action distributions. Suppose a policy $\pi$ visits the successive states and actions $s _ { 1 } , a _ { 1 } , \ldots , s _ { T } , a _ { T }$ during an episode, we define the empirical state-action distribution $\hat { \rho } _ { \pi }$ as: $\begin{array} { r } { \hat { \rho } _ { \pi } = \frac { 1 } { T } \sum _ { t = 1 } ^ { T } \delta _ { s _ { t } , a _ { t } } } \end{array}$ , where $\delta _ { s _ { t } , a _ { t } }$ is a Dirac distribution centered on $( s _ { t } , a _ { t } )$ . Similarly, suppose we have a set of expert demonstrations $\mathcal { D } = \{ s ^ { e } , a ^ { e } \}$ of size $D$ , then the associated empirical expert state-action distribution $\hat { \rho } _ { e }$ is defined as: $\begin{array} { r } { \hat { \rho } _ { e } = \frac { 1 } { D } \sum _ { ( s , a ) \in \mathcal { D } } \delta _ { s , a } } \end{array}$ .
28
+
29
+ Wasserstein distance. Suppose we have the metric space $( M , d )$ where $M$ is a set and $d$ is a metric on $M$ . Suppose we have $\mu$ and $\nu$ two distributions on $M$ with finite moments, the $p$ -th order Wasserstein distance (Villani, 2008) is defined as $\begin{array} { r } { \mathcal { W } _ { p } ^ { p } ( \mu , \nu ) = \operatorname* { i n f } _ { \theta \in \Theta ( \mu , \nu ) } \int _ { M \times M } d ( x , y ) ^ { p } d \theta ( x , y ) , } \end{array}$ where $\Theta ( \mu , \nu )$ is the set of all couplings between $\mu$ and $\nu$ . In the remainder, we only consider distributions with finite support. A coupling between two distributions of support cardinal $T$ and $D$ is a doubly stochastic matrix of size $T \times D$ . We note $\Theta$ the set of all doubly stochastic matrices of size $T \times D$ :
30
+
31
+ $$
32
+ \Theta = \Big \{ \theta \in \mathbb { R } _ { + } ^ { T \times D } \ | \ \forall j \in [ 1 : D ] , \sum _ { i ^ { \prime } = 1 } ^ { T } \theta [ i ^ { \prime } , j ] = \frac { 1 } { D } , \forall i \in [ 1 : T ] , \sum _ { j ^ { \prime } = 1 } ^ { D } \theta [ i , j ^ { \prime } ] = \frac { 1 } { T } \Big \} .
33
+ $$
34
+
35
+ The Wasserstein distance between distributions of state-action pairs requires the definition of a metric $d$ in the space $( \cal { S } , \cal { A } )$ . Defining a metric in an MDP is non trivial (Ferns et al., 2004; Mahadevan & Maggioni, 2007); we show an example where the metric is learned from demonstrations in Section 4.4. For now, we assume the existence of a metric $d : ( S , \mathcal { A } ) \times ( S , \mathcal { A } ) \mapsto \mathbb { R } ^ { + }$ .
36
+
37
+ # 3 METHOD
38
+
39
+ We present the theoretical motivation of our approach: the minimization of the Wasserstein distance between the state-action distributions of the agent and the expert. We introduce a reward based on an upper-bound of the primal form of the Wasserstein distance inferred from a relaxation of
40
+
41
+ the optimal coupling condition, and present the resulting algorithm: Primal Wasserstein Imitation Learning (PWIL).
42
+
43
+ # 3.1 WASSERSTEIN DISTANCE MINIMIZATION
44
+
45
+ Central to our approach is the minimization of the Wasserstein distance between the state-action distribution of the policy we seek to train $\hat { \rho } _ { \pi }$ and the state-action distribution of the expert $\hat { \rho } _ { e }$ . In other words, we aim at optimizing the following problem:
46
+
47
+ $$
48
+ \operatorname* { i n f } _ { \pi \in \Pi } \mathcal { W } _ { p } ^ { p } ( \hat { \rho } _ { \pi } , \hat { \rho } _ { e } ) = \operatorname* { i n f } _ { \pi \in \Pi } \operatorname* { i n f } _ { \theta \in \Theta } \sum _ { i = 1 } ^ { T } \sum _ { j = 1 } ^ { D } d ( ( s _ { i } ^ { \pi } , a _ { i } ^ { \pi } ) , ( s _ { j } ^ { e } , a _ { j } ^ { e } ) ) ^ { p } \theta [ i , j ] .
49
+ $$
50
+
51
+ In the rest of the paper, we only consider the 1-Wasserstein $p = 1$ in Equation 1) and leave the extensive study of the influence of the order $p$ for future work. We can interpret the Wasserstein distance using the earth’s movers analogy (Villani, 2008). Consider that the state-action pairs of the expert are $D$ holes of mass $D ^ { - 1 }$ and that the state-action pairs of the policy are piles of dirt of mass $T ^ { \dot { - } 1 }$ . A coupling $\theta$ is a transport strategy between the piles of dirt and the holes, where $\theta [ i , j ]$ stands for how much of the pile of dirt $i$ should be moved towards the hole $j$ . The optimal coupling is the one that minimizes the distance that the earth mover travels to put all piles of dirt to holes. Note that to compute the optimal coupling, we need knowledge of the locations of all piles of dirt. In the context of RL, this means having access to the full trajectory generated by $\pi$ . From now on, we write $\theta _ { \pi } ^ { * }$ as the optimal coupling for the policy $\pi$ , that we inject in Equation (1):
52
+
53
+ $$
54
+ \begin{array} { c } { { \displaystyle \theta _ { \pi } ^ { * } = \arg \operatorname* { m i n } _ { \theta \in \Theta } \sum _ { i = 1 } ^ { T } \sum _ { j = 1 } ^ { D } d ( ( s _ { i } ^ { \pi } , a _ { i } ^ { \pi } ) , ( s _ { j } ^ { e } , a _ { j } ^ { e } ) ) \theta [ i , j ] } } \\ { { \displaystyle \operatorname* { i n f } _ { \pi \in \Pi } \mathcal { W } _ { 1 } ( \hat { \rho } _ { \pi } , \hat { \rho } _ { e } ) = \operatorname* { i n f } _ { \pi \in \Pi } \sum _ { i = 1 } ^ { T } c _ { i , \pi } ^ { * } \ w \mathrm { i t h } \ c _ { i , \pi } ^ { * } = \sum _ { j = 1 } ^ { D } d ( ( s _ { i } ^ { \pi } , a _ { i } ^ { \pi } ) , ( s _ { j } ^ { e } , a _ { j } ^ { e } ) ) \theta _ { \pi } ^ { * } [ i , j ] . } } \end{array}
55
+ $$
56
+
57
+ In Equation (2), we have introduced $c _ { i , \pi } ^ { * }$ , which we interpret as a cost to minimize using RL. As $c _ { i , \pi } ^ { * }$ depends on the optimal coupling $\theta _ { \pi } ^ { * }$ , we can only define $c _ { i , \pi } ^ { * }$ at the very end of an episode. This can be problematic if an agent learns in an online manner or in large time-horizon tasks. Thus, we introduce an upper bound to the Wasserstein distance that yields a cost we can compute online, based on a suboptimal coupling strategy.
58
+
59
+ # 3.2 GREEDY COUPLING
60
+
61
+ In this section we introduce the greedy coupling $\theta _ { \pi } ^ { g } \in \Theta$ , defined recursively for $1 \leq i \leq T$ as:
62
+
63
+ $$
64
+ \begin{array} { r l } & { \theta _ { \pi } ^ { g } [ i , : ] = \underset { \theta [ i , : ] \in \Theta _ { i } } { \arg \operatorname* { m i n } } \displaystyle \sum _ { j = 1 } ^ { D } d ( ( s _ { i } ^ { \pi } , a _ { i } ^ { \pi } ) , ( s _ { j } ^ { e } , a _ { j } ^ { e } ) ) \theta [ i , j ] } \\ & { \mathrm { w i t h ~ } \Theta _ { i } = \Big \{ \theta [ i , : ] \in \mathbb { R } _ { + } ^ { D } \Big | \displaystyle \sum _ { j ^ { \prime } = 1 } ^ { D } \theta [ i , j ^ { \prime } ] = \displaystyle \frac { 1 } { T } , \underbrace { \forall k \in [ 1 : D ] , \displaystyle \sum _ { i ^ { \prime } = 1 } ^ { i - 1 } \theta _ { g } [ i ^ { \prime } , k ] + \theta [ i , k ] \le \displaystyle \frac { 1 } { D } } _ { \mathrm { c o n s t r a i n t } ( a ) } \Big \} . } \end{array}
65
+ $$
66
+
67
+ Similarly to Equation (1), Equation (3) can be interpreted using the earth mover’s analogy. Contrary to Equation (1) where we assume knowledge of the positions of the $T$ piles of dirts, we now consider that they appear sequentially, and that the earth’s mover needs to transport the new pile of dirt to holes right when it appears. To do so, we derive the distances to all holes and move the new pile of dirt to the closest remaining available holes, hence the greedy nature of it. In Equation (3), the constraint $( a )$ means that all the dirt that appears at the $i$ -th timestep needs to be moved, and the constraint (b) means that we cannot fill the holes more than their capacity $\textstyle { \frac { 1 } { D } }$ . We show the difference between the greedy coupling and the optimal coupling in Figure 1, and provide the pseudo-code to derive it in Algorithm 1.
68
+
69
+ ![](images/1b66e066ac72cab4774db99ec25a61cfd0941742537cf0801ec8a1d0292031bb.jpg)
70
+ Figure 1: Illustration of the difference between the a) greedy coupling and the b) optimal coupling. We present an MDP where we drop the dependency on the action. The state space is $\mathbb { R }$ and the metric associated is the Euclidean distance. We note the states visited by the policy: $s _ { 1 } ^ { \pi } , s _ { 2 } ^ { \pi } , s _ { 3 } ^ { \pi }$ and the states visited by the expert: $s _ { 1 } ^ { e } , s _ { 2 } ^ { e } , s _ { 3 } ^ { e }$ . When the policy encounters the state $s _ { 2 } ^ { \pi }$ , and because we do not know $s _ { 3 } ^ { \pi }$ yet, the greedy coupling strategy consists in coupling it with $s _ { 2 } ^ { e }$ although the optimal coupling strategy would be to couple it with $s _ { 3 } ^ { e }$ . Note that the total cost (omitting the constant coupling multiplication factor) with the greedy coupling is 7 whereas the total cost with the optimal coupling is 5 . This highlights that the optimal coupling needs knowledge about the whole policy’s trajectory to be derived.
71
+
72
+ We can now define an upper bound of the Wasserstein distance using the greedy coupling (since by definition it is suboptimal):
73
+
74
+ $$
75
+ \begin{array} { r l r } & { } & { \underset { \pi \in \Pi } { \operatorname* { i n f } } \ \mathcal { W } _ { 1 } ( \hat { \rho } _ { \pi } , \hat { \rho } _ { e } ) = \underset { \pi \in \Pi } { \operatorname* { i n f } } \sum _ { i = 1 } ^ { T } \sum _ { j = 1 } ^ { D } d ( ( s _ { i } ^ { \pi } , a _ { i } ^ { \pi } ) , ( s _ { j } ^ { e } , a _ { j } ^ { e } ) ) \theta _ { \pi } ^ { * } [ i , j ] } \\ & { } & { \leq \underset { \pi \in \Pi } { \operatorname* { i n f } } \sum _ { i = 1 } ^ { T } \sum _ { j = 1 } ^ { D } d ( ( s _ { i } ^ { \pi } , a _ { i } ^ { \pi } ) , ( s _ { j } ^ { e } , a _ { j } ^ { e } ) ) \theta _ { \pi } ^ { g } [ i , j ] . } \end{array}
76
+ $$
77
+
78
+ In Section 4, we empirically validate this bound. We infer a cost from Equation (1) at each timestep $i$
79
+
80
+ $$
81
+ c _ { i , \pi } ^ { g } = \sum _ { j = 1 } ^ { D } d ( ( s _ { i } ^ { \pi } , a _ { i } ^ { \pi } ) , ( s _ { j } ^ { e } , a _ { j } ^ { e } ) ) \theta _ { \pi } ^ { g } [ i , j ] .
82
+ $$
83
+
84
+ Note that the greedy coupling $\theta _ { \pi } ^ { g } [ t , . ]$ defined in Equation (3) depends on all the previous state-actions visited by the policy $\pi$ , which makes the cost $c _ { i , \pi } ^ { g }$ non-stationary, similarly to adversarial $\mathrm { I L }$ methods. We can infer a reward from the cost, $r _ { i , \pi } = f ( c _ { i , \pi } ^ { g } )$ where $f$ is a monotonically decreasing function. This reward function is an episodic history dependent reward function $r ( s _ { 0 } , a _ { 0 } , \ldots , s _ { t } , a _ { t } )$ where $r$ is uniquely defined from expert demonstrations (hence is said to be derived offline). Crucially, we have defined a reward function that we seek to maximize, without introducing an inner minimization problem (which is the case with adversarial $\mathrm { I L }$ approaches).
85
+
86
+ We can now derive an algorithm building on this reward function (Algorithm 1). The algorithm presented is written using pseudo-code for a generic agent $A$ which implements a policy $\pi _ { A }$ , it observes tuples $( s , a , r , s ^ { \prime } )$ and possibly updates its components. The runtime of the algorithm for a single reward step computation has complexity $\begin{array} { r } { \mathcal { O } ( ( | S | + | A | ) D + \frac { D ^ { 2 } } { T } ) } \end{array}$ (see Appendix E.2 for details), and therefore has complexity $\mathcal { O } ( ( | S | + | A | ) D T + D ^ { 2 } )$ for computing rewards across the entire episode. Note that in the case where $T = D$ , computing the greedy coupling is simply a lookup of the expert state-action pair that minimizes the distance with the agent state-action pair, followed by a pop-out of this minimizing expert state-action pair from the set of expert demonstrations.
87
+
88
+ Algorithm 1 introduces an agent with the capability to observe and update itself, which is directly inspired from ACME’s formalism of agents (Hoffman et al., 2020), and is general enough to characterize a wide range of agents. We give an example rundown of the algorithm in Section E.1.
89
+
90
+ # 4 EXPERIMENTS
91
+
92
+ In this section, we present the implementation of PWIL and perform an empirical evaluation, based on the ACME framework (Hoffman et al., 2020). We test PWIL on MuJoCo locomotion tasks and compare it to the state-of-the-art GAIL-like algorithm DAC (Kostrikov et al., 2019) and against the common BC baseline. As DAC is based on TD3 (Fujimoto et al., 2018) which is a variant of DDPG (Lillicrap et al., 2016), we use a DDPG-based agent for fair comparison: D4PG (BarthMaron et al., 2018). We also provide a proof-of-concept experiment on a door opening task where the demonstrations do not include actions and are pixel-based and therefore the metric of the
93
+
94
+ Algorithm 1 PWIL: Primal Wasserstein Imitation Learning
95
+
96
+ <table><tr><td>Input: Expert demonstrations D = {s,aj}j∈[1:D],Agent A, number of episodes N for k=1 to N do</td><td>Copy expert demonstrations with weight: D&#x27; := {s,a, w}j∈[1:D], with w = D</td></tr><tr><td>Reset environment, initial state s fori=1toTdo</td><td></td></tr><tr><td>Take action a := TA(s), observe next state s&#x27; Initialize weight w&quot; := 1, cost c := 0</td><td></td></tr><tr><td>while w&quot; &gt;O do</td><td>Compute se,ae,we := arg min(se,ae,we)∈D&#x27; d((s,a),(se,ae))</td></tr><tr><td>if w≥we then</td><td></td></tr><tr><td>C:=c+wed((s,a),(se,ae)) w := wπ- we</td><td></td></tr><tr><td>D&#x27;.pop(se,ae,we)</td><td></td></tr><tr><td>else</td><td></td></tr><tr><td>c :=c+wd((s,a),(se,ae))</td><td></td></tr><tr><td>we := we -wπ</td><td></td></tr><tr><td></td><td></td></tr><tr><td>w := 0</td><td></td></tr><tr><td>r := f(c)</td><td></td></tr><tr><td>A observes (s, a,r,s&#x27;), updates itself</td><td></td></tr></table>
97
+
98
+ MDP has to be learned. In this setup, we use SAC as the direct RL method. We answer the following questions: 1) Does PWIL recover expert behavior? 2) How sample efficient is PWIL? 3) Does PWIL actually minimize the Wasserstein distance between the distributions of the agent and the expert? 4) Does PWIL extend to visual based observations where the definition of an MDP metric is not straightforward? We also show the dependence of PWIL on multiple of its components through an ablation study. The complete description of the experiments is given in Appendix A. We provide experimental code and videos of the trained agents here: https: //sites.google.com/view/wasserstein-imitation.
99
+
100
+ # 4.1 IMPLEMENTATION
101
+
102
+ We test PWIL following the same evaluation protocol as GAIL and DAC, on six environments from the OpenAI Gym MuJoCo suite (Todorov et al., 2012; Brockman et al., 2016): Reacher-v2, Ant-v2, Humanoid-v2, Walker2d-v2, HalfCheetah-v2 and Hopper-v2. For each environment, multiple demonstrations are gathered using a D4PG agent trained on the actual reward of these environments (which was chosen as it is a base agent in the ACME framework). We subsample demonstrations by a factor of 20: we select one out of every 20 transitions with a random offset at the beginning of the episode (expect for Reacher for which we do not subsample since the episode length is 50). The point of subsampling is to simulate a low data regime, so that a pure behavioral cloning approach suffers the behavioral drift and hence does not perform to the level of the expert. We run experiments with multiple number of demonstrations: $\{ 1 , 4 , 1 1 \}$ (consistently with the evaluation protocol of DAC).
103
+
104
+ Central to our method is a metric between state-action pairs. We use the standardized Euclidean distance which is the L2 distance on the concatenation of the observation and the action, weighted along each dimension by the inverse standard deviation of the expert demonstrations. From the cost $c _ { i }$ defined in Equation (5), we define the following reward:
105
+
106
+ $$
107
+ r _ { i } = \alpha \exp ( - \frac { \beta T } { \sqrt { | \cal S | + | \cal A | } } c _ { i } ) .
108
+ $$
109
+
110
+ For all environments, we use $\alpha = 5$ and $\beta = 5$ . The scaling factor $\frac { T } { \sqrt { | { \cal S } | + | { \cal A } | } }$ acts as a normalizer on the dimensionality of the state and action spaces and on the time horizon of the task. We pick $f : x \mapsto \exp ( - x )$ as the monotonically decreasing function.
111
+
112
+ We test our method against a state-of-the-art imitation learning algorithm: DAC and BC. DAC is based on GAIL: it discriminates between expert and non-expert states and it uses an off-policy algorithm TD3 which is a variant of DDPG instead of the on-policy algorithm TRPO (Schulman et al., 2015). We used the open-source code provided by the authors. The Humanoid environment is not studied in the original DAC paper. The hyperparameters the authors provided having poor performance, we led an exhaustive search detailed in Section A.2, and present results for the best hyperparameters found.
113
+
114
+ For our method, we use a D4PG agent (see details in Appendix A) and provide additional experiments with different direct RL agents in Appendix C. We initialize the replay buffer by filling it with expert state-action pairs with maximum reward $\alpha$ (however, note that we used subsampled trajectories which makes it an approximation to replaying the actual trajectories). We train PWIL and DAC in the limit of 1M environment interactions (2.5M for Humanoid) on 10 seeds. Every 10k environment steps, we perform 10-episode rollouts per seed of the policy without exploration noise and report performance with respect to the environment’s original reward in Figure 2.
115
+
116
+ # 4.2 RESULTS
117
+
118
+ In Figure 2, PWIL shows improvement on final performance for Hopper, Ant, HalfCheetah and Humanoid over DAC, similar performance for Walker2d, and is worse on Reacher. On Humanoid, although we ran an exhaustive hyperparameter search (see Section A.2) DAC has poor performance, thus exemplifying the brittleness of GAIL-like approaches. On the contrary, PWIL has near-optimal performance, even with a single demonstration.
119
+
120
+ In terms of sample efficiency, DAC outperforms PWIL on HalfCheetah, Ant and Reacher and has similar performance for Hopper and Walker2d. Note that ablated versions of PWIL are more sampleefficient than DAC on HalfCheetah and Ant (Section B). This seems rather contradictory with the claim that GAIL-like methods have poor sample efficiency. However the reward function defined in DAC requires careful tuning (e.g. architecture, optimizer, regularizers, learning rate schedule) which demands experimental cycles and therefore comes with a large number of environment interactions.
121
+
122
+ Remarkably, PWIL is the first method able to consistently learn policies on Humanoid with an average score over 7000 even with a single demonstration, which means that the agent can actually run, (other works consider Humanoid is "solved" for a score of 5000 wich corresponds to standing).
123
+
124
+ ![](images/e40832eff7388e28e7493984d455ecdceb0ec2f257b16625d6bfb2b539c79eb9.jpg)
125
+ Figure 2: Mean and standard deviation return of the evaluation policy over 10 rollouts and 10 seeds, reported every 10k environment steps. The return is in term of the environment’s original reward. Top row: 1 demonstration, bottom row: 11 demonstrations.
126
+
127
+ Wasserstein distance. In Figure 3, we show the Wasserstein distance to expert demonstrations throughout the learning procedure for PWIL and DAC. The Wasserstein distance is evaluated at the end of an episode using a transportation simplex (Bonneel et al., 2011); we used the implementation from Flamary & Courty (2017). For both methods, we notice that the distance decreases while learning. PWIL leads to a smaller Wasserstein distance than DAC on all environments but HalfCheetah where it is similar and Reacher where it is larger. This should not come as a surprise since PWIL’s objective is to minimize the Wasserstein distance. PWIL defines a reward from an upper bound to the Wasserstein distance between the state-action distributions of the expert and the agent, that we include as well in Figure 3. Notice that our upper bound is “empirically tight”, which validates the choice of the greedy coupling as an approximation to the optimal coupling. We emphasize that this distance is useful in real settings of IL, regardless of the method used, where we cannot have access to the actual reward of the task.
128
+
129
+ ![](images/1f51ee76559a986b51bd3ba554546b2c557593b15e60d3d2569c776ee7e2ed4b.jpg)
130
+ Figure 3: Mean of the Wasserstein distance between the state-action distribution of the evaluation policy and the state-action distribution of the expert over 10 rollouts and 10 seeds. Agents were trained with 11 demonstrations. For PWIL, we include the upper bound on the Wasserstein distance based on the greedy coupling defined in Equation (4).
131
+
132
+ # 4.3 ABLATION STUDY
133
+
134
+ In this section, we present the evaluation performance of PWIL in the presence of ablations and report final performances in Figure 4. The learning curves for all ablations can be found in Appendix B. We keep the hyperparameters of the original PWIL agent fixed.
135
+
136
+ ![](images/adb48cc75f79e4ff29215610c1e97f680ff2130f986b6a3e0f4fa3cab1d87373.jpg)
137
+ Figure 4: Mean and standard deviation of the evaluation performance of PWIL and variants at the 1M environment interactions mark (2.5M for Humanoid). Results are computed over 10 seeds and 10 episodes for each seed.
138
+
139
+ PWIL-state. In this version of PWIL, we do not assume that we have access to the actions taken by the expert. Therefore, we try to match the state distribution of the agent with the state distribution of the expert (instead of the state-action distribution). The setup is referred to as Learning from Observation (LfO) (Torabi et al., 2018; Edwards et al., 2019). The reward is defined similarly to PWIL, using a state distance rather than a state-action distance. Note that in this version, we cannot pre-fill the replay buffer with expert state-action pairs since we do not have access to actions. Remarkably, PWIL-state recovers non-trivial behaviors on all environments.
140
+
141
+ PWIL-L2. In this version of PWIL, we use the Euclidean distance between state-action pairs, rather than the standardized Euclidean distance. In other words, we do not weight the state-action distance by the inverse standard deviation of the expert demonstrations along each dimension. There is a significant drop in performance for all environments but Hopper-v2. This shows that the performance of PWIL is sensitive to the quality of the MDP metric.
142
+
143
+ PWIL-nofill. In this version, we do not prefill the replay buffer with expert transitions. This leads to a drop in performance which is significant for Walker and Ant. This should not come as a surprise since a number of $\mathrm { I L }$ methods leverage the idea of expert transitions in the replay buffer (Reddy et al., 2020; Hester et al., 2018).
144
+
145
+ PWIL-support. In this version of PWIL, we define the reward as a function of the following cost:
146
+
147
+ $$
148
+ \forall i \in [ 1 : T ] , c _ { i , \pi } = \operatorname* { i n f } _ { \tiny \begin{array} { c } { \theta _ { 1 } , \ldots , \theta _ { D } \in \mathbb { R } } \\ { \sum _ { j = 1 } ^ { D } \theta _ { j } \leq \frac { 1 } { T } } \end{array} } \sum _ { j = 1 } ^ { D } d ( ( s _ { i } ^ { \pi } , a _ { i } ^ { \pi } ) , ( s _ { j } ^ { e } , a _ { j } ^ { e } ) ) \theta _ { j } .
149
+ $$
150
+
151
+ We can interpret this cost in the context of Section 3 as the problem of moving piles of dirt of mass $\textstyle { \frac { 1 } { T } }$ into holes of infinite capacity. It is thus reminiscent of methods that consider $\mathrm { I L }$ as a support estimation problem (Wang et al., 2019; Brantley et al., 2020). This leads to a significant drop in performance for Ant, Walker and HalfCheetah.
152
+
153
+ 4.4 DOOR OPENING TASK: REWARD FROM PIXEL-BASED OBSERVATIONS
154
+
155
+ In this section, we show that PWIL extends to visual-based setups, where the MDP metric has to be learned. We use the door opening task from Rajeswaran et al. (2018), with human demonstrations generated with Haptix (Kumar & Todorov, 2015). The goal of the task is for the controlled hand to open the door (Figure 5) whose location changes at each episode. We add an early termination constraint when the door is opened (hence suppressing the incentive for survival). We assume that we can only access the high-dimensional visual rendering of the demonstrations rather than the internal state (and hence have no access to actions, that is LfO setting).
156
+
157
+ The PWIL reward is therefore defined using a distance between the visual rendering of the current state and the visual rendering of the demonstrations. This distance is learned offline through selfsupervised learning: we construct an embedding of the frames using Temporal Cycle-Consistency Learning (TCC) (Dwibedi et al., 2019); TCC builds an embedding by aligning frames of videos of a task coming from multiple examples (in this case the demonstrations). The distance learned is thus the L2 distance between embeddings. The distance is learned on the 25 human demonstrations provided by Rajeswaran et al. (2018) which are then re-used to define the PWIL reward. From the cost $c _ { i }$ defined in Equation (5), we define the following reward: $r _ { i } = \alpha \exp ( - \beta T c _ { i } )$ , with $\alpha = 5 , \beta = 1$ . We used SAC (Haarnoja et al., 2018a) as the forward RL algorithm, which was more robust than D4PG on the task. We train the agent on 1.5M environment steps and show that we indeed recover expert behaviour and consistently solve the task in Figure 6.
158
+
159
+ ![](images/0fc960760fec29961a678ed9e81db245f1d0ae3b8f30bd26309f46a649672d91.jpg)
160
+ Figure 5: Visual rendering of the door opening task.
161
+
162
+ ![](images/d134c8bded467d0a27427e19b71ab5d7dba8af8962cd29e48896dd398dafea7e.jpg)
163
+ Figure 6: We present the average and standard deviation of evaluation performance of PWIL on the door environment. Metrics are computed every $1 0 \mathrm { k }$ environment steps and aggregated over 10 seeds and 10 rollouts. Left: the imitation returns of the agent. Center: Wasserstein distance in the embedding space to expert demonstrations. Right: Success rate of the agent, i.e. ratio of episodes where the agent manages to open the door.
164
+
165
+ # 5 RELATED WORK
166
+
167
+ Adversarial IL. Similarly to our method, adversarial IL methods aim at matching the state-action distribution of the agent with the distribution of the expert, using different measures of similarity. For instance, GAIL (Ho & Ermon, 2016) considers the Shannon-Jensen divergence while AIRL (Fu et al., 2018) considers the Kullback-Leibler divergence. In the context of GANs, Arjovsky et al. (2017) show that replacing the $f$ -divergence by the Wasserstein distance through the Kantorovich-Rubinstein duality (Villani, 2008) leads to better training stability, which a number of methods in IL have leveraged (Li et al., 2017; Lacotte et al., 2019; Kostrikov et al., 2019; Xiao et al., 2019; Liu et al., 2020; Pacchiano et al., 2020). However, the Kantorovich-Rubinstein duality only holds for the $\mathcal { W } _ { 1 }$ distance (Peyré et al., 2019), its implementation comes with a number of practical approximations (e.g., weight clipping to ensure Lipchitz continuity). Although these methods are based on the Wasserstein distance through its dual formulation, they drastically differ from ours as they rely on a minmax optimization problem. DAC (Kostrikov et al., 2019) demonstrates that adversarial $\mathrm { I L }$ approaches, while based on GAIL, can be sample efficient. However, they rely on a carefully tuned discriminator (e.g. network architecture, regularization strategy, scheduled learning rates) which requires to interact with the environment. In contrast, the reward function we present relies on only two hyperparameters.
168
+
169
+ Expert support estimation. Another line of research in IL consists in estimating the state-action support of the expert and define a reward that encourages the agent to stay on the support of the expert (Piot et al., 2014; Schroecker & Isbell, 2017; Wang et al., 2019; Brantley et al., 2020; Reddy et al., 2020). Note that the agent might stay on the support of the expert without recovering its state-action distribution. Soft Q Imitation Learning (Reddy et al., 2020) assigns a reward of 1 to all expert transitions and 0 to all transitions the expert encounters; the method learns to recover expert behavior by balancing out the expert transitions with the agent transitions in the replay buffer of a value-based agent. Random Expert Distillation (Wang et al., 2019) estimates the support by using a neural network trained on expert transitions whose target is a fixed random neural network. Disagreement Regularized Imitation Learning (Brantley et al., 2020) estimates the expert support through the variance of an ensemble of BC agents, and use a reward based on the distance to the expert support and the KL divergence with the BC policies. PWIL differs from these methods since it is based on the distance to the support of the expert, with a support that shrinks through “pop-outs” to enforce the agent to visit the whole support. We showed in the ablation study that “pop-outs” are sine qua non for recovering expert behaviour (see PWIL-support).
170
+
171
+ Trajectory-Based IL. Similarly to the door opening experiment, Aytar et al. (2018) learn an embedding offline and reinforces a reward based on the distance in the embedding space to a single demonstration. However, it is well suited for deterministic environments since they use a single trajectory that the agent aims at reproducing while the door experiment shows that PWIL is able to generalize as the door and handle locations are picked at random. Peng et al. (2018) reinforces a temporal reward function (the reward at time $t$ is based on the distance of the state of the agent to the state of the expert at time $t$ ). Contrary to PWIL, the imitation reward function is added to a task-dependent reward function; the distance to expert demonstrations is defined along handpicked dimensions of the observation space; the temporal constraint makes it hard to generalize to environment with stochastic initial states.
172
+
173
+ Offline reward estimation. Existing approaches derive a reward function without interaction with the environment (Boularias et al., 2011; Klein et al., 2013; 2012; Piot et al., 2016). They typically require strong assumptions on the structure of the reward (e.g. linearity in some predefined features). PWIL also derives a reward offline, without structural assumptions, however it is non-stationary since it depends on the state-action visited in the episode.
174
+
175
+ MMD-IL. Generative Moment Matching Imitation Learning (Kim & Park, 2018) assumes a metric on the MDP and aims at minimizing the Maximum Mean Discrepancy (MMD) between the agent and the expert. However, the MMD (like the Wasserstein distance) requires complete rollouts of the agent, and does not present a natural relaxation like the greedy coupling. GMMIL is based on an on-policy agent which makes it significantly less sample-efficient than PWIL. We were not able to implement a version of MMD based on an off-policy agent.
176
+
177
+ # 6 CONCLUSION
178
+
179
+ In this work, we present Imitation Learning as a distribution matching problem and introduce a reward function which is based on an upper bound of the Wasserstein distance between the state-action distributions of the agent and the expert. A number of IL methods are developed on synthetic tasks, where the evaluation of the IL method can be done with the actual return of the task. We emphasize that in our work, we present a direct measure of similarity between the expert and the agent, that we can thus use in real $\mathrm { I L }$ settings, that is in settings where the reward of the task cannot be specified.
180
+
181
+ The reward function we introduce is learned offline, in the sense that it does not need to be updated with interactions with the environment. It requires little tuning (2 hyperparameters) and it can recover near expert performance with as little as 1 demonstration on all considered environments, even the challenging Humanoid. Finally our method extends to the harder visual-based setting, based on a metric learned offline from expert demonstrations using self-supervised learning.
182
+
183
+ # ACKNOWLEDGMENTS
184
+
185
+ We thank Zafarali Ahmed, Adrien Ali Taiga, Gabriel Dulac-Arnold, Johan Ferret, Alexis Jacq and Saurabh Kumar for their feedback on an earlier version of the manuscript. We thank Debidatta Dwibedi and Ilya Kostrikov for helpful discussions.
186
+
187
+ # REFERENCES
188
+
189
+ Pieter Abbeel and Andrew $\mathrm { ~ Y ~ N ~ g ~ }$ . Apprenticeship learning via inverse reinforcement learning. In International Conference on Machine Learning, 2004.
190
+
191
+ OpenAI: Marcin Andrychowicz, Bowen Baker, Maciek Chociej, Rafal Jozefowicz, Bob McGrew, Jakub Pachocki, Arthur Petron, Matthias Plappert, Glenn Powell, Alex Ray, et al. Learning dexterous in-hand manipulation. The International Journal of Robotics Research, 2020.
192
+
193
+ Martin Arjovsky, Soumith Chintala, and Léon Bottou. Wasserstein generative adversarial networks. In International Conference on Machine Learning, 2017.
194
+
195
+ Yusuf Aytar, Tobias Pfaff, David Budden, Thomas Paine, Ziyu Wang, and Nando de Freitas. Playing hard exploration games by watching youtube. In Advances in Neural Information Processing Systems, 2018.
196
+
197
+ Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016.
198
+
199
+ JA Bagnell, Joel Chestnutt, David M Bradley, and Nathan D Ratliff. Boosting structured prediction for imitation learning. In Advances in Neural Information Processing Systems, 2007.
200
+
201
+ Gabriel Barth-Maron, Matthew W Hoffman, David Budden, Will Dabney, Dan Horgan, Dhruva Tb, Alistair Muldal, Nicolas Heess, and Timothy Lillicrap. Distributed distributional deterministic policy gradients. International Conference on Learning Representations, 2018.
202
+
203
+ Marc G Bellemare, Will Dabney, and Rémi Munos. A distributional perspective on reinforcement learning. In International Conference on Machine Learning, 2017.
204
+
205
+ Nicolas Bonneel, Michiel Van De Panne, Sylvain Paris, and Wolfgang Heidrich. Displacement interpolation using lagrangian mass transport. In Proceedings of the 2011 SIGGRAPH Asia Conference, 2011.
206
+
207
+ Abdeslam Boularias, Jens Kober, and Jan Peters. Relative entropy inverse reinforcement learning. In International Conference on Artificial Intelligence and Statistics, 2011.
208
+
209
+ Kianté Brantley, Wen Sun, and Mikael Henaff. Disagreement-regularized imitation learning. In International Conference on Learning Representations, 2020.
210
+
211
+ Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym, 2016.
212
+
213
+ Daniel Brown, Wonjoon Goo, Prabhat Nagarajan, and Scott Niekum. Extrapolating beyond suboptimal demonstrations via inverse reinforcement learning from observations. In International Conference on Machine Learning, 2019.
214
+
215
+ Djork-Arné Clevert, Thomas Unterthiner, and Sepp Hochreiter. Fast and accurate deep network learning by exponential linear units (elus). International Conference on Learning Representations, 2016.
216
+
217
+ Debidatta Dwibedi, Yusuf Aytar, Jonathan Tompson, Pierre Sermanet, and Andrew Zisserman. Temporal cycle-consistency learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2019.
218
+
219
+ Ashley Edwards, Himanshu Sahni, Yannick Schroecker, and Charles Isbell. Imitating latent policies from observation. In International Conference on Machine Learning, 2019.
220
+
221
+ Norm Ferns, Prakash Panangaden, and Doina Precup. Metrics for finite markov decision processes. In Conference on Uncertainty in Artificial Intelligence, 2004.
222
+
223
+ Chelsea Finn, Sergey Levine, and Pieter Abbeel. Guided cost learning: Deep inverse optimal control via policy optimization. In International Conference on Machine Learning, 2016.
224
+
225
+ Rémi Flamary and Nicolas Courty. Pot python optimal transport library. GitHub: https://github. com/rflamary/POT, 2017.
226
+
227
+ Justin Fu, Katie Luo, and Sergey Levine. Learning robust rewards with adversarial inverse reinforcement learning. International Conference on Learning Representations, 2018.
228
+
229
+ Scott Fujimoto, Herke Hoof, and David Meger. Addressing function approximation error in actorcritic methods. In International Conference on Machine Learning, 2018.
230
+
231
+ Seyed Kamyar Seyed Ghasemipour, Richard Zemel, and Shixiang Gu. A divergence minimization perspective on imitation learning methods. Conference on Robot Learning, 2019.
232
+
233
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In Advances in Neural Information Processing Systems, 2014.
234
+
235
+ Tuomas Haarnoja, Aurick Zhou, Pieter Abbeel, and Sergey Levine. Soft actor-critic: Off-policy maximum entropy deep reinforcement learning with a stochastic actor. In International Conference on Machine Learning, 2018a.
236
+
237
+ Tuomas Haarnoja, Aurick Zhou, Kristian Hartikainen, George Tucker, Sehoon Ha, Jie Tan, Vikash Kumar, Henry Zhu, Abhishek Gupta, Pieter Abbeel, et al. Soft actor-critic algorithms and applications. arXiv preprint arXiv:1812.05905, 2018b.
238
+
239
+ Todd Hester, Matej Vecerik, Olivier Pietquin, Marc Lanctot, Tom Schaul, Bilal Piot, Dan Horgan, John Quan, Andrew Sendonaris, Ian Osband, et al. Deep q-learning from demonstrations. In AAAI Conference on Artificial Intelligence, 2018.
240
+
241
+ Jonathan Ho and Stefano Ermon. Generative adversarial imitation learning. In Advances in Neural Information Processing Systems, 2016.
242
+
243
+ Matt Hoffman, Bobak Shahriari, John Aslanides, Gabriel Barth-Maron, Feryal Behbahani, Tamara Norman, Abbas Abdolmaleki, Albin Cassirer, Fan Yang, Kate Baumli, et al. Acme: A research framework for distributed reinforcement learning. arXiv preprint arXiv:2006.00979, 2020.
244
+
245
+ Alexis Jacq, Matthieu Geist, Ana Paiva, and Olivier Pietquin. Learning from a learner. In International Conference on Machine Learning, 2019.
246
+
247
+ Liyiming Ke, Matt Barnes, Wen Sun, Gilwoo Lee, Sanjiban Choudhury, and Siddhartha Srinivasa. Imitation learning as $f$ -divergence minimization. arXiv preprint arXiv:1905.12888, 2019.
248
+
249
+ Kee-Eung Kim and Hyun Soo Park. Imitation learning via kernel mean embedding. In AAAI Conference on Artificial Intelligence, 2018.
250
+
251
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. International Conference on Learning Representations, 2015.
252
+
253
+ Edouard Klein, Matthieu Geist, Bilal Piot, and Olivier Pietquin. Inverse reinforcement learning through structured classification. In Advances in Neural Information Processing Systems, 2012.
254
+
255
+ Edouard Klein, Bilal Piot, Matthieu Geist, and Olivier Pietquin. A cascaded supervised learning approach to inverse reinforcement learning. In Joint European conference on machine learning and knowledge discovery in databases, 2013.
256
+
257
+ Ilya Kostrikov, Kumar Krishna Agrawal, Debidatta Dwibedi, Sergey Levine, and Jonathan Tompson. Discriminator-actor-critic: Addressing sample inefficiency and reward bias in adversarial imitation learning. International Conference on Learning Representations, 2019.
258
+
259
+ V. Kumar and E. Todorov. Mujoco haptix: A virtual reality system for hand manipulation. In 2015 IEEE-RAS 15th International Conference on Humanoid Robots (Humanoids), 2015.
260
+
261
+ Jonathan Lacotte, Mohammad Ghavamzadeh, Yinlam Chow, and Marco Pavone. Risk-sensitive generative adversarial imitation learning. In International Conference on Artificial Intelligence and Statistics, 2019.
262
+
263
+ Yunzhu Li, Jiaming Song, and Stefano Ermon. Infogail: Interpretable imitation learning from visual demonstrations. In Advances in Neural Information Processing Systems, 2017.
264
+
265
+ Timothy P Lillicrap, Jonathan J Hunt, Alexander Pritzel, Nicolas Heess, Tom Erez, Yuval Tassa, David Silver, and Daan Wierstra. Continuous control with deep reinforcement learning. International Conference on Learning Representations, 2016.
266
+
267
+ Fangchen Liu, Zhan Ling, Tongzhou Mu, and Hao Su. State alignment-based imitation learning. International Conference on Learning Representations, 2020.
268
+
269
+ Sridhar Mahadevan and Mauro Maggioni. Proto-value functions: A laplacian framework for learning representation and control in markov decision processes. Journal of Machine Learning Research, 2007.
270
+
271
+ Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 2015.
272
+
273
+ Andrew Y Ng, Stuart J Russell, et al. Algorithms for inverse reinforcement learning. In International Conference on Machine Learning, 2000.
274
+
275
+ Aldo Pacchiano, Jack Parker-Holder, Yunhao Tang, Krzysztof Choromanski, Anna Choromanska, and Michael Jordan. Learning to score behaviors for guided policy optimization. In International Conference on Machine Learning, 2020.
276
+
277
+ Xue Bin Peng, Pieter Abbeel, Sergey Levine, and Michiel van de Panne. Deepmimic: Example-guided deep reinforcement learning of physics-based character skills. ACM Transactions on Graphics (TOG), 2018.
278
+
279
+ Gabriel Peyré, Marco Cuturi, et al. Computational optimal transport. Foundations and Trends in Machine Learning, 2019.
280
+
281
+ Bilal Piot, Matthieu Geist, and Olivier Pietquin. Learning from demonstrations: Is it worth estimating a reward function? In Joint European Conference on Machine Learning and Knowledge Discovery in Databases, 2013.
282
+
283
+ Bilal Piot, Matthieu Geist, and Olivier Pietquin. Boosted and reward-regularized classification for apprenticeship learning. In International conference on autonomous agents and multi-agent systems, 2014.
284
+
285
+ Bilal Piot, Matthieu Geist, and Olivier Pietquin. Bridging the gap between imitation learning and inverse reinforcement learning. IEEE transactions on neural networks and learning systems, 2016.
286
+
287
+ Dean A Pomerleau. Efficient training of artificial neural networks for autonomous navigation. Neural computation, 1991.
288
+
289
+ Martin L Puterman. Markov decision processes: discrete stochastic dynamic programming. John Wiley & Sons, 2014.
290
+
291
+ Aravind Rajeswaran, Vikash Kumar, Abhishek Gupta, Giulia Vezzani, John Schulman, Emanuel Todorov, and Sergey Levine. Learning complex dexterous manipulation with deep reinforcement learning and demonstrations. In Proceedings of Robotics: Science and Systems (RSS), 2018.
292
+
293
+ Siddharth Reddy, Anca D Dragan, and Sergey Levine. Sqil: imitation learning via regularized behavioral cloning. International Conference on Learning Representations, 2020.
294
+
295
+ Stéphane Ross and Drew Bagnell. Efficient reductions for imitation learning. In International Conference on Artificial Intelligence and Statistics, 2010.
296
+
297
+ Stuart Russell. Learning agents for uncertain environments. In Conference on Computational learning theory, 1998.
298
+
299
+ Yannick Schroecker and Charles L Isbell. State aware imitation learning. In Advances in Neural Information Processing Systems, 2017.
300
+
301
+ John Schulman, Sergey Levine, Pieter Abbeel, Michael Jordan, and Philipp Moritz. Trust region policy optimization. In International Conference on Machine Learning, 2015.
302
+
303
+ David Silver, Aja Huang, Chris J Maddison, Arthur Guez, Laurent Sifre, George Van Den Driessche, Julian Schrittwieser, Ioannis Antonoglou, Veda Panneershelvam, Marc Lanctot, et al. Mastering the game of go with deep neural networks and tree search. Nature, 2016.
304
+
305
+ Richard S Sutton and Andrew G Barto. Reinforcement learning: An introduction. 2018.
306
+
307
+ Gerald Tesauro. Temporal difference learning and td-gammon. Communications of the ACM, 1995.
308
+
309
+ Emanuel Todorov, Tom Erez, and Yuval Tassa. Mujoco: A physics engine for model-based control. In International Conference on Intelligent Robots and Systems, 2012.
310
+
311
+ Faraz Torabi, Garrett Warnell, and Peter Stone. Behavioral cloning from observation. In International Joint Conference on Artificial Intelligence, 2018.
312
+
313
+ Cédric Villani. Optimal transport: old and new. 2008.
314
+
315
+ Ruohan Wang, Carlo Ciliberto, Pierluigi Vito Amadori, and Yiannis Demiris. Random expert distillation: Imitation learning via expert policy support estimation. In International Conference on Machine Learning, 2019.
316
+
317
+ Huang Xiao, Michael Herman, Joerg Wagner, Sebastian Ziesche, Jalal Etesami, and Thai Hong Linh. Wasserstein adversarial imitation learning. arXiv preprint arXiv:1906.08113, 2019.
318
+
319
+ Brian D Ziebart, Andrew L Maas, J Andrew Bagnell, and Anind K Dey. Maximum entropy inverse reinforcement learning. In AAAI Conference on Artificial Intelligence, 2008.
320
+
321
+ # A LOCOMOTION EXPERIMENTS
322
+
323
+ # A.1 PWIL IMPLEMENTATION
324
+
325
+ The agent we use is D4PG (Barth-Maron et al., 2018). We use the default architecture from the ACME framework (Hoffman et al., 2020).
326
+
327
+ The actor architecture is a 4-layer neural network: the first layer has size 256 with tanh activation and layer normalization (Ba et al., 2016), the second layer and third layer have size 256 with elu activation (Clevert et al., 2016), the last layer is of size the dimension of the action space, with a tanh activation scaled to the action range of the environment. To enable sufficient exploration with use a Gaussian noise layer on top of the last layer with standard deviation $\sigma = 0 . 2$ , that we clip to the action range of the environment. We evaluate the agent without exploration noise.
328
+
329
+ For the critic network we use a 4-layer neural network: the first layer has size 512 with tanh activation and layer normalization, the second layer is of size 512 with elu activation, the third layer is of size 256 with elu activation, the last layer is of dimension 201 with a softmax activation. The 201 neurons stand for the weights of the distribution supported within equal distance in the range $[ - 1 5 0 , 1 5 0 ]$ , as a categorical distribution (Bellemare et al., 2017).
330
+
331
+ We use the Adam optimizer (Kingma & Ba, 2015) with $\lambda _ { a } = 5 { \times } 1 0 ^ { - 5 }$ for the actor and $\lambda _ { c } = 7 \times 1 0 ^ { - 5 }$ for the critic. We use a batch size of 256. We clip both gradients from the critic and the actor to limit their L2 norm to 40.
332
+
333
+ We use a replay buffer of size $1 0 ^ { 6 }$ , a discount factor $\theta = 0 . 9 9$ and $n$ step returns with $n = 5$ . We prefill the replay buffer with 50000 state-action pairs from the set of demonstrations (which means that we put multiple times the same expert transitions in the buffer). We perform updates on the actor and the critic every $k = 4$ interactions with the environment. The hyperparameters search is detailed in Table 1.
334
+
335
+ Table 1: DDPG hyperparameters search.
336
+
337
+ <table><tr><td rowspan=1 colspan=1>Parameters</td><td rowspan=1 colspan=1>Values</td></tr><tr><td rowspan=1 colspan=1>入a</td><td rowspan=1 colspan=1>10-5,5×10-5,7× 10-5,10-4</td></tr><tr><td rowspan=1 colspan=1>入c</td><td rowspan=1 colspan=1>10-5,5× 10-5,7× 10-5,10-4</td></tr><tr><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>0.1,0.2,0.3</td></tr><tr><td rowspan=1 colspan=1>k</td><td rowspan=1 colspan=1>2,4,8,16</td></tr></table>
338
+
339
+ For the reward function, we did run a hyperparameter search on $\alpha$ and $\beta$ with the following values for $\alpha$ and $\beta$ in $\{ 1 , 5 , 1 0 \}$ .
340
+
341
+ # A.2 DAC IMPLEMENTATION
342
+
343
+ We used the open-source implementation of DAC provided by Kostrikov et al. (2019). For Humanoid (which was not reported in the paper), we did run a large hyperparameter search described in Table 2. Out of the 729 experiments, 7 led to an average performance above 1000 at the $2 . 5 \mathbf { M }$ training environment steps mark.
344
+
345
+ Table 2: Hyperparameter search on Humanoid for 11 demonstrations. (tested/best)
346
+
347
+ <table><tr><td rowspan=1 colspan=1>Actor learning rate (lr)</td><td rowspan=1 colspan=1>Critic lr</td><td rowspan=1 colspan=1>Discriminator lr</td><td rowspan=1 colspan=1>WGAN regularizer</td><td rowspan=1 colspan=1>Exploration noise</td><td rowspan=1 colspan=1>Decay lr</td></tr><tr><td rowspan=1 colspan=1>0.001,0.0005,0.0001</td><td rowspan=1 colspan=1>0.001,0.0005,0.0001</td><td rowspan=1 colspan=1>0.001,0.0005,0.0001</td><td rowspan=1 colspan=1>5,10,20</td><td rowspan=1 colspan=1>0.1,0.2,0.3</td><td rowspan=1 colspan=1>0.3,0.5,0.8</td></tr></table>
348
+
349
+ # A.3 BC IMPLEMENTATION
350
+
351
+ We used a 3-layer neural network, the first layer has size 128 with relu activation, the second layer has size 64 and the last layer has size of the action space with a tanh activation scaled to the action range of the environment. We found out that normalizing the observations with the average and standard deviation of the expert demonstrations’ observations helped performance. We trained the network using the mean squared error as a loss, with an Adam optimizer. We ran an hyperpameter search on the learning rate in $\{ 1 0 ^ { - 5 } , 1 0 ^ { - 4 } , 1 0 ^ { - 3 } \}$ and on the batch size $\{ 1 2 8 , 2 5 6 \}$ .
352
+
353
+ We present the learning curves of PWIL, in terms of the reward defined in Equation 6 as well as the original reward of the task.
354
+
355
+ ![](images/4537548d23d868054ce3111228880c63aff3dec9d0e4685bcbbc7b39655c6c03.jpg)
356
+ Figure 7: Mean and standard deviation of the imitation return of the agent. We perform 10 rollouts over 10 seeds every 10k environment steps over 1M steps. The return here is in term of the reward defined with Equation (6). Top row: 1 demonstration, middle row: 4 demonstrations, bottom row 11 demonstrations.
357
+
358
+ ![](images/d3baa66434501a324c1a0a02c07ddebaff4ddd20b869894068c779504c31bc97.jpg)
359
+ Figure 8: Mean and standard deviation of the original environment returns of the evaluation policy over 10 rollouts and 10 seeds, reported every 10k environment steps over 1M steps. Top row: 1 demonstation, middle row: 4 demonstrations, bottom row: 11 demonstrations.
360
+
361
+ ![](images/e26c1a245aae8d40cbdf6b7f771ef06c26cfecbc55d6b850c1a383bb1da276d0.jpg)
362
+ Figure 9: Mean and standard deviation of the Wasserstein distance between the state-action distribution of the evaluation policy and the state-action distribution of the expert over 10 rollouts and 10 seeds, reported every 10k environment steps. We include the upper bound on the Wasserstein distance based on the greedy coupling defined in Equation (4). Top row: 1 demos, middle row: 4 demos, bottom row: 11 demos.
363
+
364
+ # B ABLATION STUDY
365
+
366
+ We present the learning curves of PWIL in the presence of ablations.
367
+
368
+ ![](images/525f4729ae669358c71ea42a341d40c0eee97b61f9e2fef1dec90269a61108f4.jpg)
369
+ Figure 10: Evaluation performance of different variants of PWIL over 10 rollouts and 10 seeds, reported every 10k environment steps over 1M steps. The return is in term of the environment’s original reward. Top row: 1 demonstration, middle row: 4 demonstrations, bottom row: 11 demonstrations.
370
+
371
+ # C INFLUENCE OF THE DIRECT RL ALGORITHM
372
+
373
+ In this section, we study the influence of the direct RL method on the performance on PWIL on locomotion tasks. We compare the performance of PWIL with D4PG with the performance of PWIL with TD3 and SAC. We use a custom implementation of both SAC and TD3 which is a reproduction of the authors’ implementation. For SAC we used the same default hyperparameters; for TD3 we removed the delayed policy update which led to better performance. We evaluate both methods on the same reward function as D4PG. We remove the pre-warming of the replay buffer for SAC. For TD3, we found out that we need different pre-warming for each environment to get good performance (contrary to D4PG): we used 1000 state-action pairs for Reacher, Hopper and Walker2d and no pre-warming for Humanoid, Ant and HalfCheetah.
374
+
375
+ ![](images/19f9c30f768d5309cc4bb93b92a5bc65b18f58a69c7c9c0c8705782a369624a5.jpg)
376
+ Figure 11: Mean and standard deviation of the evaluation performance of PWIL-D4PG, PWIL-SAC and PWIL-TD3 at the 1M environment interactions mark (2.5M for Humanoid). Results are computed over 10 seeds and 10 episodes for each seed.
377
+
378
+ We show in Figure 11 that both PWIL-SAC and PWIL-TD3 recover expert-like performance on Hopper, Ant and HalfCheetah and Reacher. For Walker2d, there is a large standard deviation in performance, since some seeds lead to near-optimal expert performance, and some seeds lead to poor performance. Remark that we led minimal hyperparameter tuning on the default versions of SAC and TD3, which might explain the differences in performance.
379
+
380
+ # D DOOR OPENING EXPERIMENTS
381
+
382
+ In this section we present the details of the experiment presented in Section 4.4.
383
+
384
+ # D.1 ENVIRONMENT
385
+
386
+ The default door opening environment has a fixed horizon of 200 timesteps. We add an early termination condition to the environment when the door is opened to demonstrate that PWIL extends to tasks where there is no incentive for survival. Note that similarly to AIRL (Fu et al., 2018), early termination states are considered to be absorbing. Therefore if the expert reaches an early termination state early, its state distribution as a large weight on these states, which leads the PWIL agent to similarly reach the early termination state. 25 demonstrations were collected from humans using a virtual reality system (Kumar & Todorov (2015)).
387
+
388
+ # D.2 EMBEDDING
389
+
390
+ As we assume that we only have access to the visual rendering of the demonstrations (with resolution $8 4 \times 8 4 ,$ , we build a lower dimensional latent space. We use a self-supervised learning method: TCC, to learn the latent space. We used the classification version of the algorithm detailed in Dwibedi et al. (2019) (Section 3.2).
391
+
392
+ The encoding network is the following: a convolutional layer with 128 filters of size 8 and stride 4, a relu activation, a convolutional layer with 64 filters of size 4 and stride 2, a relu activation, a convolutional layer with 64 filters of size 3 and stride 1, a relu activation, a linear layer of size 128, a relu activation and an output layer of size 32.
393
+
394
+ We separated the demonstrations into a train set of 20 demonstrations and a validation set of 5 demonstrations. Similarly to Dwibedi et al. (2019), we select the encoding network by taking the one that maximizes the alignment according to Kendall’s tau score on the validation set.
395
+
396
+ We ran an hyperparameter search over the batch size $\{ 1 , 4 , 1 6 , 3 2 \}$ , the subsampling ratio $\{ 1 , 4 , 8 \}$ and the learning rate $\{ 1 0 ^ { - 2 } , 1 0 ^ { - 3 } , 1 0 ^ { - 4 } \}$ (using the Adam optimizer). The best performing encoder had an average Kendall’s tau score of 0.98 on the training set and 0.91 on the validation set.
397
+
398
+ # D.3 AGENT
399
+
400
+ ![](images/e6a42cd9de48fe57d68313cc81229b9cf11b6f3771f063e7c6d7f183b6267b73.jpg)
401
+ Figure 12: Kendall’s tau score of the encoding network on the train and validation sets. An iteration corresponds to 1000 gradient updates.
402
+
403
+ In this setup, we found that SAC leads to better results than D4PG. We detail the implementation of SAC below.
404
+
405
+ The actor is a 3-layer network that outputs the parameters of a normal distribution with diagonal covariance matrix. We enforce the terms of the covariance matrix to be greater than $1 0 ^ { - 3 }$ . The first layer has size 256 with relu activation, the second layer has size 256 with relu activation and the last layer has size 48 (the action space has size 24).
406
+
407
+ The critic is a 3-layer network. We pass the concatenation of the state and the action of the environment as an input. There are two hidden layers of size 256 with relu activation. We do use a twin critic.
408
+
409
+ We use an adaptive temperature $\alpha$ as described by Haarnoja et al. (2018b).
410
+
411
+ For the three losses we use the Adam optimizer, and we use Polyak averaging for the critic networks with a rate $\tau$ . We ran an hyperparameter search over the learning rates $\lambda _ { a } , \lambda _ { c } , \lambda _ { \alpha }$ in $\{ 1 0 ^ { - 4 } , 3 \times 1 0 ^ { - 4 } \}$ , over $\tau$ $\lbrace 0 . 0 1 , 0 . 0 0 5 \rbrace$ , over the batch size $\{ 6 4 , 1 2 8 , 2 5 6 \}$ and over the number of interactions with the environment between each actor, critic and temperature update $\{ 1 , 4 , 8 \}$ .
412
+
413
+ # E ALGORITHM DETAILS
414
+
415
+ # E.1 RUNDOWN
416
+
417
+ We present an example rundown of PWIL in Figure 13.
418
+
419
+ # Sta! episode.
420
+
421
+ ![](images/4f44e70ef44250bdd8d3698ffc390e2ee87e7410a8013b0ba3fbfd4516c40ea6.jpg)
422
+ Figure 13: PWIL example rundown. We drop the dependency on the action. The example task has an horizon $T = 2$ , and the demonstration set has $D = 4$ elements. We take $f : c \mapsto \exp \left( - c \right)$ .
423
+
424
+ # End episode.
425
+
426
+ # E.2 RUNTIME
427
+
428
+ We detail the runtime of PWIL in this section. A single step reward computation consists in computing the distance from the current observation (a vector with dimension $| { \bar { S } } | + | { \cal A } |$ with $D$ vectors (the expert observations), which has complexity $\mathcal { O } ( ( | S | + | A | ) D )$ . The next step is to get the minimum of these distances (complexity $\mathcal { O } ( D ) ,$ ), for $\textstyle \left\lceil { \frac { D } { T } } \right\rceil$ times (the number of times the algorithm executes the while loop). Therefore the complexity of a single step reward computation is $\begin{array} { r } { \mathcal { O } ( ( | S | + | A | ) D + \frac { D ^ { 2 } } { T } ) } \end{array}$ and the complexity of the reward computation of an episode is $\mathcal { O } ( ( | S | + | A | ) D T + D ^ { 2 } )$ .
md/train/UlSjqPEkI1V/UlSjqPEkI1V.md ADDED
@@ -0,0 +1,352 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # What Makes Multi-modal Learning Better than Single (Provably)
2
+
3
+ Yu Huang1,∗, Chenzhuang $\mathbf { D } \mathbf { u } ^ { 1 , * }$ , Zihui $\mathbf { X u e ^ { 2 } }$ , Xuanyao Chen3,4,
4
+
5
+ Hang Zhao1,4, Longbo Huang1,†
6
+
7
+ 1 Institute for Interdisciplinary Information Sciences, Tsinghua University 2 The University of Texas at Austin 3 Fudan University Shanghai Qi Zhi Institute
8
+
9
+ # Abstract
10
+
11
+ The world provides us with data of multiple modalities. Intuitively, models fusing data from different modalities outperform their uni-modal counterparts, since more information is aggregated. Recently, joining the success of deep learning, there is an influential line of work on deep multi-modal learning, which has remarkable empirical results on various applications. However, theoretical justifications in this field are notably lacking.
12
+
13
+ Can multi-modal learning provably perform better than uni-modal?
14
+
15
+ In this paper, we answer this question under a most popular multi-modal fusion framework, which firstly encodes features from different modalities into a common latent space and seamlessly maps the latent representations into the task space. We prove that learning with multiple modalities achieves a smaller population risk than only using its subset of modalities. The main intuition is that the former has a more accurate estimate of the latent space representation. To the best of our knowledge, this is the first theoretical treatment to capture important qualitative phenomena observed in real multi-modal applications from the generalization perspective. Combining with experiment results, we show that multi-modal learning does possess an appealing formal guarantee.
16
+
17
+ # 1 Introduction
18
+
19
+ Our perception of the world is based on different modalities, e.g. sight, sound, movement, touch, and even smell [36]. Inspired from the success of deep learning [26, 21], deep multi-modal research is also activated, which covers fields like audio-visual learning [8, 43], RGB-D semantic segmentation [35, 20] and Visual Question Answering [17, 2].
20
+
21
+ While deep multi-modal learning shows excellent power in practice, theoretical understanding of deep multi-modal learning is limited. Some recent works have been done towards this direction [39, 48]. However, these works made strict assumptions on the probability distributions across different modalities, which may not hold in real-life applications [30]. Notably, they do not take generalization performance of multi-modal learning into consideration. Toward this end, the following fundamental problem remains largely open:
22
+
23
+ ![](images/374bbc667cad0f4aecb0119dff334cecbd3b5a713f377e3a6ce49be6c24b3564.jpg)
24
+ Figure 1: $\mathcal { M }$ vs $\mathcal { N }$ modalities latent space representation, where the latter is a subset of the former. $z _ { \mathcal { M } } , z _ { \mathcal { N } }$ and $z ^ { \star }$ are images on the latent space $\mathcal { Z }$ corresponding to the representation mappings $\hat { g } _ { \mathcal { M } }$ , $\hat { g } _ { \mathcal N }$ and $g ^ { \star }$ . $M _ { i }$ denotes modality $i$ .
25
+
26
+ Can multi-modal learning provably performs better than uni-modal?
27
+
28
+ In this paper, we provably answer this question from two perspectives:
29
+
30
+ • (When) Under what conditions multi-modal performs better than uni-modal?
31
+
32
+ The framework we study is abstracted from the multi-modal fusion approaches, which is one of the most researched topics of multi-modal learning [3]. Specifically, we first encode the complex data from heterogeneous sources into a common latent space $\mathcal { Z }$ . The true latent representation is $g ^ { \star }$ in a function class $\mathcal { G }$ , and the task mapping $h ^ { \star }$ is contained in a function class $\mathcal { H }$ defined on the latent space. Our model corresponds to the recent progress of deep multi-modal learning on various applications, such as scene classification [9] and action recognition [24, 43].
33
+
34
+ Under this composite framework, we provide the first theoretical analysis to shed light on what makes multi-modal outperform uni-modal from the generalization perspective. We identify the relationship between the population risk and the distance between a learned latent representation $\hat { g }$ and the $g ^ { \star }$ , under the metric we will define later. Informally, closer to the true representation leads to less population loss, which indicates that a better latent representation guarantees the end-to-end multimodal learning performance. Instead of simply considering the comparison of multi vs uni modalities, we consider a general case, $\mathcal { M }$ vs $\mathcal { N }$ modalities, which are distinct subsets of all modalities. We focus on the condition that the latter is a subset of the former. Our second result is a bound for the closeness between $\hat { g }$ and the $g ^ { \star }$ , from which we provably show that the latent representation $\hat { g } _ { \mathcal { M } }$ learning from the $\mathcal { M }$ modalities is closer to the true $g ^ { \star }$ than $\hat { g } _ { \mathcal N }$ learning from $\mathcal { N }$ modalities. As shown in Figure 1, $\hat { g } _ { \mathcal { M } }$ has a more sufficient latent space exploration than $\hat { g } _ { \mathcal N }$ . Moreover, in a specific linear regression model, we directly verify that using multiple modalities rather than its subset learns a better latent representation.
35
+
36
+ The main contributions of this paper are summarized as follows:
37
+
38
+ • We formalize the multi-modal learning problem into a theoretical framework. Firstly, we show that the performance of multi-modal learning in terms of population risk can be bounded by the latent representation quality, a novel metric we propose to measure the distance from a learned latent representation to the true representation, which reveals that the ability of learning the whole task coincides with the ability of learning the latent representation when we have sufficient training samples.
39
+ • We derive an upper bound for the latent representation quality of training over a subset of modalities. This directly implies a principle to guide us in modality selection, i.e., when the number of sample size is large and multiple modalities can efficiently optimize the empirical risk, using multi-modal to build a recognition or detection system can have a better performance.
40
+ • Restricted to linear latent and task mapping, we provide rigorous theoretical analysis that latent representation quality degrades when the subset of multiple modalities is applied.
41
+
42
+ Experiments are also carried out to empirically validate the theoretical observation that $\hat { g } _ { \mathcal N }$ is inferior to $\hat { g } _ { \mathcal { M } }$ .
43
+
44
+ The rest of the paper is organized as follows. In the next section, we review the related literature. The formulation of multi-modal learning problem is described in Section 3. Main results are presented in Section 4. In Section 5, we show simulation results to support our theoretical claims. Additional discussions about the inefficiency of multi-modal learning are presented in Section 6. Finally, conclusions are drawn in Section 7.
45
+
46
+ # 2 Related Work
47
+
48
+ Multi-modal Learning Applications Deep learning makes fusing different signals easier, which enables us to develop many multi-modal frameworks. For example, [35, 23, 22, 31, 20] combine RGB and depth images to improve semantic segmentation; [8, 16] fuse audio with video to do scene understanding; researchers also explore audio-visual source separation and localization [49, 11].
49
+
50
+ Theory of Multi-modal Learning On the theory side, in semi-supervised setting, [39] proposed a novel method, Total Correlation Gain Maximization (TCGM), and theoretically proved that TCGM can find the groundtruth Bayesian classifier given each modality. Moreover, CPM-Nets [48] showed multi-view representation can recover the same performance as only using the single-view observation by constructing the versatility. However, they made strict assumptions on the relationship across different modalities, while our analysis does not require such additional assumptions. Besides, previous multi-view analysis [37, 1, 45, 13] typically assumes that each view alone is sufficient to predict the target accurately, which may not hold in our multi-modal setting. For instance, it is difficult to build a classifier just using a weak modality with limited labeled data, e.g., depth modality in RGB-D images for object detection task [18].
51
+
52
+ Transfer Learning A line of work closely related to our composite learning framework is transfer learning via representation learning, which firstly learns a shared representation on various tasks and then transfers the learned representation to a new task. [40, 7, 32, 10] have provided the sample complexity bounds in the special case of the linear feature and linear task mapping. [41] introduces a new notion of task diversity and provides a generalization bound with general tasks, features, and losses. Unfortunately, the function class which contains feature mappings is the same across all different tasks while our focus is that the function classes generated by different subsets modalities are usually inconsistent.
53
+
54
+ Notation: Throughout the paper, we use $\| \cdot \|$ to denote the $\ell _ { 2 }$ norm. We also denote the set of positive integer numbers less or equal than $n$ by $[ n ]$ , i.e. $[ n ] \triangleq \{ 1 , 2 , \cdots , n \}$ .
55
+
56
+ # 3 The Multi-modal Learning Formulation
57
+
58
+ In this section, we present the Multi-modal Learning problem formulation. Specifically, we assume that a given data $\mathbf { x } : = \left( x ^ { ( 1 ) } , \cdot \cdot \cdot , x ^ { ( K ) } \right)$ consists of $K$ modalities, where $x ^ { ( \bar { k } ) } \in \mathcal { X } ^ { ( \bar { k } ) }$ the domain set of the $k$ -th modality. Denote $\mathcal { X } = \stackrel { \cdot \cdot } { \mathcal { X } } ^ { ( 1 ) } \times \cdots \times \mathcal { X } ^ { ( K ) }$ . We use $\mathcal { V }$ to denote the target domain and use $\mathcal { Z }$ to denote a latent space. Then, we denote $g ^ { \star } : \mathcal { X } \mapsto \mathcal { Z }$ the true mapping from the input space (using all of $K$ modalities) to the latent space, and $h ^ { \star } : \mathcal { Z } \mapsto \mathcal { V }$ is the true task mapping. For instance, in aggregation-based multi-modal fusion, $g ^ { \star }$ is an aggregation function compounding on $K$ seperate sub-networks and $h ^ { \star }$ is a multi-layer neural network [44].
59
+
60
+ In the learning task, a data pair $( \mathbf { x } , y ) \in \mathcal { X } \times \mathcal { Y }$ is generated from an unknown distribution $\mathcal { D }$ , such that
61
+
62
+ $$
63
+ \mathbb { P } _ { \mathcal { D } } ( \mathbf { x } , y ) \triangleq \mathbb { P } _ { y | \mathbf { x } } \left( y \mid h ^ { \star } \circ g ^ { \star } ( \mathbf { x } ) \right) \mathbb { P } _ { \mathbf { x } } ( \mathbf { x } )
64
+ $$
65
+
66
+ Here $h ^ { \star } \circ g ^ { \star } ( { \bf x } ) = h ^ { \star } ( g ^ { \star } ( { \bf x } ) )$ represents the composite function of $h ^ { \star }$ and $g ^ { \star }$ .
67
+
68
+ In real-world settings, we often face incomplete multi-modal data, i.e., some modalities are not observed. To take into account this situation, we let $\mathcal { M }$ be a subset of $[ K ]$ , and without loss of generality, focus on the learning problem only using the modalities in $\mathcal { M }$ . Specifically, define
69
+
70
+ $\mathcal { X } ^ { \prime } : = \left( \mathcal { X } ^ { ( 1 ) } \cup \{ \bot \} \right) \times \ldots \times \left( \mathcal { X } ^ { ( K ) } \cup \{ \bot \} \right)$ as the extension of $\mathcal { X }$ , where $\mathbf { x } ^ { \prime } \in \mathcal { X } ^ { \prime }$ , $\mathbf { x } _ { k } ^ { \prime } = \perp$ means that the $k$ -th modality is not used (collected). Then we define a mapping $p _ { { \mathcal { M } } }$ from $\mathcal { X }$ to $\mathcal { X } ^ { \prime }$ induced by $\mathcal { M }$ :
71
+
72
+ $$
73
+ p _ { \mathcal { M } } ( \mathbf { x } ) ^ { ( k ) } = \left\{ \begin{array} { l l } { \mathbf { x } ^ { ( k ) } } & { \mathrm { i f } \ k \in \mathcal { M } } \\ { \perp } & { \mathrm { e l s e } } \end{array} \right.
74
+ $$
75
+
76
+ Also define $p _ { \mathcal { M } } ^ { \prime } : \mathcal { X } ^ { \prime } \mapsto \mathcal { X } ^ { \prime }$ as the extension of $p _ { { \mathcal { M } } }$ . Let $\mathcal { G } ^ { \prime }$ denote a function class, which contains the mapping from $\mathcal { X } ^ { \prime }$ to the latent space $\mathcal { Z }$ , and define a function class $\mathcal { G } _ { \mathcal { M } }$ as follows:
77
+
78
+ $$
79
+ { \mathcal { G } } _ { \mathcal { M } } \triangleq \{ g _ { \mathcal { M } } : \chi \mapsto { \mathcal { Z } } \mid g _ { \mathcal { M } } ( \mathbf { x } ) : = g ^ { \prime } ( p _ { \mathcal { M } } ( \mathbf { x } ) ) , g ^ { \prime } \in { \mathcal { G } } ^ { \prime } \}
80
+ $$
81
+
82
+ Given a data set $\boldsymbol { S } = \left( \left( \mathbf { x } _ { i } , y _ { i } \right) \right) _ { i = 1 } ^ { m }$ , where $\left( \mathbf { x } _ { i } , y _ { i } \right)$ is drawn i.i.d. from $\mathcal { D }$ , the learning objective is, following the Empirical Risk Minimization (ERM) principle [27], to find $h \in \mathcal H$ and $g _ { \mathcal { M } } \in \mathcal { G } _ { \mathcal { M } }$ to jointly minimize the empirical risk, i.e.,
83
+
84
+ $$
85
+ \begin{array} { r l } { \operatorname* { m i n } \quad } & { \hat { r } \left( h \circ g _ { \mathcal { M } } \right) \triangleq \displaystyle \frac { 1 } { m } \sum _ { i = 1 } ^ { m } \ell \left( h \circ g _ { \mathcal { M } } ( \mathbf { x } _ { i } ) , y _ { i } \right) } \\ { \mathrm { s . t . } \quad } & { h \in \mathcal { H } , g _ { \mathcal { M } } \in \mathcal { G } _ { \mathcal { M } } . } \end{array}
86
+ $$
87
+
88
+ where $\ell ( \cdot , \cdot )$ is the loss function. Given $\hat { r } \left( h \circ g _ { \mathcal { M } } \right)$ , we similarly define its corresponding population risk as
89
+
90
+ $$
91
+ r \left( h \circ g _ { \mathcal { M } } \right) = \mathbb { E } _ { ( \mathbf { x } _ { i } , y _ { i } ) \sim \mathcal { D } } \left[ \hat { r } \left( h \circ g _ { \mathcal { M } } \right) \right]
92
+ $$
93
+
94
+ Similar to [1, 41], we use the population risk to measure the performance of learning.
95
+
96
+ Example. As a concrete example of our model, consider the video classification problem under the late-fusion model in [43]. In this case, each modality $k$ , e.g. RGB frames, audio or optical flows, is encoded by a deep network $\varphi _ { k }$ , and their features are fused and passed to a classifier $\mathcal { C }$ . If we train on the first $M$ modalities, we can let $\mathcal M = [ M ]$ . Then $g _ { \mathcal { M } }$ has the form: $\varphi _ { 1 } \oplus \varphi _ { 2 } \oplus \cdots \oplus \varphi _ { M }$ , where $\oplus$ denotes a fusion operation, e.g. self-attention ( $\mathcal { Z }$ is the output of $g _ { \mathcal { M } }$ ), and $h$ is the classifier $\mathcal { C }$ . More examples are provided in Appendix B.
97
+
98
+ Why Composite Framework ? Note that the composite multi-modal framework is often observed in applications. In fact, in recent years, a large number of papers, e.g., [3, 12, 14, 44, 43, 24], appear to have utilized this framework in one way or another, even though the contributors did not clearly summarize the relationship between their methods and this common underlying structure. However, despite the popularity of the framework, existing works lack a very formal definition in theory.
99
+
100
+ What is Special about Multi-modal Learning? For the multi-modal representation $\begin{array} { r l } { \mathbf { x } } & { { } : = } \end{array}$ $( x ^ { ( 1 ) } , \cdot \cdot \cdot , \bar { x } ^ { ( K ) } )$ consists of $K$ modalities, we allow the dimension of the domain set of each modality $\chi ^ { ( k ) }$ to be different, which well models the source of heterogeneity of each modality. The relationships across different modalities are usually of varying levels due to the heterogeneous sources. Therefore, compared to previous works [45, 48], we make no assumptions on the relationship across every single modality in our analysis, which makes it general to allow different correlations. Moreover, the main assumption behind previous analysis [37, 39, 42] is that each view/modality contains sufficient information for target tasks, which does not shed light on our analysis. It may not hold in multi-modal applications [47], e.g., in object detecting task, it is known that depth images are with lower accuracy than RGB images [18].
101
+
102
+ # 4 Main Results
103
+
104
+ In this section, we provide main theoretical results to rigorously establish various aspects of the folklore claim that multi-modal is better than single. We first detail several assumptions throughout this section.
105
+
106
+ Assumption 1. The loss function $\ell ( \cdot , \cdot )$ is $L$ -smooth with respect to the first coordinate, and is bounded by a constant $C$ .
107
+
108
+ Assumption 2. The true latent representation $g ^ { \star }$ is contained in $\mathcal { G }$ , and the task mapping $h ^ { \star }$ is contained in $\mathcal { H }$ .
109
+
110
+ Assumption 1 is a classical regularity condition for loss function in theoretical analysis [27, 41, 40]. Assumption 2 is also be known as realizability condition in representation learning [41, 10, 40], which ensures that the function class that we optimize over contains the true latent representation and the task mapping.
111
+
112
+ Assumption 3. For any $g ^ { \prime } \in \mathcal { G } ^ { \prime }$ and $\mathcal { M } \subset [ K ] , g ^ { \prime } \circ p _ { \mathcal { M } } ^ { \prime } \in \mathcal { G } ^ { \prime } .$
113
+
114
+ To understand Assumption 3, note that for any $\mathcal { N } \subset \mathcal { M } \subset [ K ]$ , by definition, for any $g _ { \mathcal { N } } \in \mathcal { G } _ { \mathcal { N } }$ , there exists $g ^ { \prime } \in \mathcal { G } ^ { \prime }$ , s.t.
115
+
116
+ $$
117
+ g _ { \mathcal { N } } ( \mathbf { x } ) = g ^ { \prime } ( p _ { \mathcal { N } } ( \mathbf { x } ) ) = g ^ { \prime } ( p _ { \mathcal { N } } ^ { \prime } ( p _ { \mathcal { M } } ( \mathbf { x } ) ) )
118
+ $$
119
+
120
+ Therefore, Assumption 3 directly implies $g _ { \mathcal { N } } \in \mathcal { G } _ { \mathcal { M } }$ . Moreover, we have $\mathcal { G } _ { \mathcal { N } } \subset \mathcal { G } _ { \mathcal { M } } \subset \mathcal { G }$ , which means that the inclusion relationship of modality subsets remains unchanged on the latent function class induced by them. As an example, if $\mathcal { G } ^ { \prime }$ is linear, represented as matrix $\mathbf { G } \in \mathbb { R } ^ { Q \times K }$ . Also $p _ { \mathcal { M } } ^ { \prime }$ can be represented as a diagonal matrix $\mathbf { P } \in \mathbb { R } ^ { K \times K }$ with the $i$ -th diagonal entry being 1 for $i \in \mathcal { M }$ and 0 otherwise. In this case, Assumption 3 holds, i.e. $\mathbf { G } \times \mathbf { P } \in \mathcal { G } ^ { \prime }$ . Moreover, $\mathbf { G } \times \mathbf { P }$ is a matrix with $i \cdot$ -th column all be zero for $i \notin \mathcal { M }$ , which is commonly used in the underfitting analysis in linear regression [34].
121
+
122
+ # 4.1 Connection to Latent Representation Quality
123
+
124
+ Latent space is employed to better exploit the correlation among different modalities. Therefore, we will naturally conjecture that the performance of training with different modalities is related to its ability to learn latent space representation. In this section, we will formally characterize this relationship.
125
+
126
+ In order to measure the goodness of a learned latent representation $g$ , we introduce the following definition of latent representation quality.
127
+
128
+ Definition 1. Given a data distribution with the form in (1), for any learned latent representation mapping $g \in { \mathcal { G } }$ , the latent representation quality is defined as
129
+
130
+ $$
131
+ \eta ( g ) = \operatorname* { i n f } _ { h \in \mathcal { H } } \left[ r \left( h \circ g \right) - r ( h ^ { \ast } \circ g ^ { \ast } ) \right]
132
+ $$
133
+
134
+ Here $\operatorname* { i n f } _ { h \in \mathcal { H } } r \left( h \circ g \right)$ is the best achievable population risk with the fixed latent representation $g$ Thus, to a certain extent, $\eta ( g )$ measures the loss incurred by the distance between $g$ and $g ^ { \star }$ .
135
+
136
+ Next, we recap the Rademacher complexity measure for model complexity. It will be used in quantifying the population risk performance based on different modalities. Specifically, let $\mathcal { F }$ be a class of vector-valued function $\mathbb { R } ^ { d } \mapsto \mathbb { R } ^ { n }$ . Let $Z _ { 1 } , \ldots , Z _ { m }$ be i.i.d. random variables on $\mathbb { R } ^ { d }$ following some distribution $P .$ Denote the sample $S = ( Z _ { 1 } , \ldots , Z _ { m } )$ . The empirical Rademacher complexity of $\mathcal { F }$ with respect to the sample $S$ is given by [5]
137
+
138
+ $$
139
+ { \widehat { \mathfrak { R } } } _ { S } ( { \mathcal { F } } ) : = \mathbb { E } _ { \sigma } \left[ \operatorname* { s u p } _ { f \in { \mathcal { F } } } { \frac { 1 } { m } } \sum _ { i = 1 } ^ { m } \sigma _ { i } f \left( Z _ { i } \right) \right]
140
+ $$
141
+
142
+ where $\boldsymbol { \sigma } = \left( \sigma _ { 1 } , \ldots , \sigma _ { n } \right) ^ { \top }$ with $\sigma _ { i } \stackrel { i i d } { \sim }$ unif $\{ - 1 , 1 \}$ . The Rademacher complexity of $\mathcal { F }$
143
+
144
+ $$
145
+ \Re _ { m } ( \mathcal { F } ) = \mathbb { E } _ { S } \left[ \widehat { \Re } _ { S } ( \mathcal { F } ) \right]
146
+ $$
147
+
148
+ Now we present our first main result regarding multi-modal learning.
149
+
150
+ Theorem 1. Let $\mathbf { \mathcal { S } } = ( ( \mathbf { x } _ { i } , y _ { i } ) ) _ { i = 1 } ^ { m }$ be a dataset of $m$ examples drawn i.i.d. according to $\mathcal { D }$ . Let $\mathcal { M } , \mathcal { N }$ be two distinct subsets of $[ K ]$ . Assuming we have produced the empirical risk minimizers $( \hat { h } _ { \mathcal { M } } , \hat { g } _ { \mathcal { M } } )$ and $( \hat { h } _ { \mathcal { N } } , \hat { g } _ { \mathcal { N } } )$ , training with the $\mathcal { M }$ and $\mathcal { N }$ modalities separately. Then, for all $1 > \delta > 0$ , with probability at least $\begin{array} { r } { 1 - \frac { \delta } { 2 } } \end{array}$ :
151
+
152
+ $$
153
+ \begin{array} { r l } & { r \left( \hat { h } _ { \mathcal { M } } \circ \hat { g } _ { \mathcal { M } } \right) - r \left( \hat { h } _ { \mathcal { N } } \circ \hat { g } _ { \mathcal { N } } \right) } \\ & { \leq \gamma _ { S } ( \mathcal { M } , \mathcal { N } ) + 8 L \mathfrak { R } _ { m } ( \mathcal { H } \circ \mathcal { G } _ { \mathcal { M } } ) + \displaystyle \frac { 4 C } { \sqrt { m } } + 2 C \sqrt { \frac { 2 \ln ( 2 / \delta ) } { m } } } \end{array}
154
+ $$
155
+
156
+ where
157
+
158
+ $$
159
+ \gamma _ { \mathcal { S } } ( \mathcal { M } , \mathcal { N } ) \triangleq \eta ( \hat { g } _ { \mathcal { M } } ) - \eta ( \hat { g } _ { \mathcal { N } } ) \qquad \big \sqcup
160
+ $$
161
+
162
+ Remark. A few remarks are in place. First of all, $\gamma _ { S } ( \mathcal { M } , \mathcal { N } )$ defined in (8) compares the quality between latent representations learning from $\mathcal { M }$ and $\mathcal { N }$ modalities with respect to the given dataset $s$ . Theorem 1 bounds the difference of population risk training with two different subsets of modalities by $\gamma _ { S } ( \mathcal { M } , \mathcal { N } )$ , which validates our conjecture that including more modalities is advantageous in learning. Second, for the commonly used function classes in the field of machine learning, Radamacher complexity for a sample of size $m$ , $\Re _ { m } ( \mathcal { F } )$ is usually bounded by $\sqrt { C ( \mathcal { F } ) / m }$ , where $C ( \mathcal { F } )$ represents the intrinsic property of function class $\mathcal { F }$ . Third, (7) can be written as $\gamma _ { S } ( \mathcal { M } , \mathcal { N } ) +$ $\mathcal { O } ( \sqrt { \frac { 1 } { m } } )$ in order terms. This shows that as the number of sample size grows, the performance of using different modalities mainly depends on its latent representation quality.
163
+
164
+ # 4.2 Upper Bound for Latent Space Exploration
165
+
166
+ Having establish the connection between the population risk difference with latent representation quality, our next goal is to estimate how close the learned latent representation $\hat { g } _ { \mathcal { M } }$ is to the true latent representation $g ^ { \star }$ . The following theorem shows how the latent representation quality can be controlled in the training process.
167
+
168
+ Theorem 2. Let $\boldsymbol { S } = \{ ( \mathbf { x } _ { i } , y _ { i } ) \} _ { i = 1 } ^ { m }$ be a dataset of m examples drawn i.i.d. according to $\mathcal { D }$ . Let $\mathcal { M }$ be a subset of $[ K ]$ . Assuming we have produced the empirical risk minimizers $( \hat { h } _ { \mathcal { M } } , \hat { g } _ { \mathcal { M } } )$ training with the $\mathcal { M }$ modalities. Then, for all $1 > \delta > 0$ , with probability at least $1 - \delta$ :
169
+
170
+ $$
171
+ \eta ( \boldsymbol { \hat { g } } _ { \mathcal { M } } ) \leq 4 L \Re _ { m } ( \mathcal { H } \circ \mathcal { G } _ { \mathcal { M } } ) + 4 L \Re _ { m } ( \mathcal { H } \circ \mathcal { G } ) + 6 C \sqrt { \frac { 2 \ln ( 2 / \delta ) } { m } } + \hat { L } ( \hat { h } _ { \mathcal { M } } \circ \hat { g } _ { \mathcal { M } } , \mathcal { S } )
172
+ $$
173
+
174
+ where $\hat { L } ( \hat { h } _ { \mathcal { M } } \circ \hat { g } _ { \mathcal { M } } , S ) \triangleq \hat { r } \left( \hat { h } _ { \mathcal { M } } \circ \hat { g } _ { \mathcal { M } } \right) - \hat { r } \left( h ^ { \star } \circ g ^ { \star } \right)$ is the centered empirical loss. □
175
+
176
+ Remark. Consider sets $\mathcal { N } \subset \mathcal { M } \subset [ K ]$ . Under Assumption 3, $\mathcal { G } _ { \mathcal { N } } \subset \mathcal { G } _ { \mathcal { M } } \subset \mathcal { G }$ , optimizing over a larger function class results in a smaller empirical risk. Therefore
177
+
178
+ $$
179
+ \hat { L } ( \hat { h } _ { \mathcal { M } } \circ \hat { g } _ { \mathcal { M } } , S ) \leq \hat { L } ( \hat { h } _ { \mathcal { N } } \circ \hat { g } _ { \mathcal { N } } , S )
180
+ $$
181
+
182
+ Similar to the analysis in Theorem 1, the first term on the Right-hand Side (RHS), $\Re _ { m } ( \mathcal { H } \circ \mathcal { G } _ { \mathcal { M } } ) \sim$ $\sqrt { C ( \mathcal { H } \circ \mathcal { G } _ { \mathcal { M } } ) / m }$ and $\Re _ { m } ( \mathcal { H } \circ \mathcal { G } _ { N } ) \sim \sqrt { C ( \mathcal { H } \circ \mathcal { G } _ { N } ) / m }$ . Following the basic structural property of Radamacher complexity [5], we have $C ( \mathcal { H } \circ \mathcal { G } _ { N } ) \leq C ( \mathcal { H } \circ \mathcal { G } _ { M } )$ . Therefore, Theorem 2 offers the following principle for choosing modalities to improve the latent representation quality.
183
+
184
+ Principle: choose to learn with more modalities if:
185
+
186
+ $$
187
+ \hat { L } ( \hat { h } _ { \mathcal { N } } \circ \hat { g } _ { \mathcal { N } } , \mathcal { S } ) - \hat { L } ( \hat { h } _ { \mathcal { M } } \circ \hat { g } _ { \mathcal { M } } , \mathcal { S } ) \geq \sqrt { \frac { C ( \mathcal { H } \circ \mathcal { G } _ { \mathcal { M } } ) } { m } } - \sqrt { \frac { C ( \mathcal { H } \circ \mathcal { G } _ { \mathcal { N } } ) } { m } }
188
+ $$
189
+
190
+ What this principle implies are twofold. (i) When the number of sample size $m$ is large, the impact of intrinsic complexity of function classes will be reduced. (ii) Using more modalities can efficiently optimize the empirical risk, hence improve the latent representation quality.
191
+
192
+ Through the trade-off illustrated in the above principle, we provide theoretical evidence that when $\mathcal { N } \subset \mathcal { M }$ and training samples are sufficient, $\eta ( \hat { g } _ { \mathcal { M } } )$ may be less than $\eta ( \hat { g } _ { \mathcal { N } } )$ , i.e. $\gamma _ { S } ( \mathcal { M } , \mathcal { N } ) \leq 0$ . Moreover, combining with the conclusion from Theorem 1, if the sample size $m$ is large enough, $\gamma _ { S } ( \mathcal { M } , \mathcal { N } ) \leq 0$ guarantees $r \left( \hat { h } _ { \mathcal { M } } \circ \hat { g } _ { \mathcal { M } } \right) \leq r \left( \hat { h } _ { \mathcal { N } } \circ \hat { g } _ { \mathcal { N } } \right)$ , which indicates learning with the $\mathcal { M }$ modalities outperforms only using its subset $\mathcal { N }$ modalities.
193
+
194
+ Role of the intrinsic property $\mathcal { C } ( \cdot )$ Hypothesis function classes are typically overparametrized in deep learning, and will be extremely large for some typical measures, e.g., VC dimension, absolute dimension. Some recent efforts aim to offer an explanation about why neural networks generalize better with over-parametrization [28, 29, 4]. [28] suggest a novel complexity measure based on unit-wise capacities, which implies if both in overparametrized settings, the complexity will not change much or even decrease when we have more modalities (using more parameters). Thus, the inequality in the principle is trivially satisfied, and we will choose to learn with more modalities.
195
+
196
+ # 4.3 Non-Positivity Guarantee
197
+
198
+ In this section, we focus on a composite linear data generating model to theoretically verify that the $\gamma _ { S } ( \mathcal { M } , \mathcal { N } )$ is indeed non-positive in this special case.3Specifically, we consider the case where the mapping to the latent space and the task mapping are both linear. Formally, let the function class $\mathcal { G }$ and $\mathcal { H }$ be:
199
+
200
+ $$
201
+ \begin{array} { r l } & { \mathcal { G } = \left\{ g \mid g ( \mathbf { x } ) = \mathbf { A } ^ { \top } \mathbf { x } , \mathbf { A } \in \mathbb { R } ^ { d \times n } , \mathbf { A } \right\} } \\ & { \mathcal { H } = \left\{ h \mid h ( \mathbf { z } ) = { \boldsymbol { \beta } } ^ { \top } \mathbf { z } , { \boldsymbol { \beta } } \in \mathbb { R } ^ { n } , \| { \boldsymbol { \beta } } \| \leq C _ { b } \right\} } \end{array}
202
+ $$
203
+
204
+ where $\mathbf { x } = \left( \mathbf { x } ^ { ( 1 ) } , \cdots , \mathbf { x } ^ { ( K ) } \right)$ is a $d$ -dimensional vector, $\mathbf { x } ^ { ( k ) } \in \mathbb { R } ^ { d _ { k } }$ denotes the feature vector for the $k$ -th modality and $\textstyle \sum _ { k = 1 } ^ { K } d _ { k } = d$ . Here, the distribution $\mathbb { P } _ { \mathbf { x } } ( \cdot )$ satisfies that its covariance matrix is positive definite. The data is generated by:
205
+
206
+ $$
207
+ y = { ( \beta ^ { \star } ) } ^ { \top } { \mathbf { A ^ { \star } } } ^ { \top } { \mathbf { x } } + \epsilon
208
+ $$
209
+
210
+ where r.v. $\epsilon$ is independent of $\mathbf { x }$ and has zero-mean and bounded second moment. Note that in practical multi-modal learning, usually only one layer is linear and the other is a neural network. For instance, [50] employs the linear matrix to project the feature matrix from different modalities into a common latent space for early dementia diagnosis, i.e., $\mathcal { G }$ is linear. Another example is in pedestrian detection [46], where a linear task mapping is adopted, i.e., $\mathcal { H }$ is linear. Thus, our composite linear model can be viewed as an approximation to such popular models, and our results can offer insights into the performance of these models.
211
+
212
+ We consider a special case that $\mathcal { M } = [ K ]$ and $\mathcal { N } = [ K - 1 ]$ . Thus ${ \mathcal { G } } _ { { \mathcal { M } } } = { \mathcal { G } }$ and we have the following result.
213
+
214
+ $$
215
+ \mathcal { G } _ { \mathcal { N } } = \left\{ g \mid g ( \mathbf { x } ) = \left[ \begin{array} { c } { \mathbf { A } _ { 1 : \sum _ { k = 1 } ^ { K - 1 } d _ { k } } } \\ { \mathbf { 0 } } \end{array} \right] ^ { \top } \mathbf { x } , \mathbf { A } \in \mathbb { R } ^ { d \times n } \mathrm { ~ w i t h ~ o r t h o n o r m a l ~ c o l u m n s } \right\}
216
+ $$
217
+
218
+ Proposition 1. Consider the dataset $\boldsymbol { S } = \{ ( \mathbf { x } _ { i } , y _ { i } ) \} _ { i = 1 } ^ { m }$ generating from the linear model defined in (12) with $\ell _ { 2 }$ loss. Let $\mathcal { M } = [ K ]$ and $\mathcal { N } = [ K - 1 ]$ . Let $\hat { \mathbf { A } } _ { \mathcal { M } }$ , $\hat { \mathbf { A } } _ { \mathcal { N } }$ denote the projection matrix estimated by $\mathcal { M } , \mathcal { N }$ modalities. Assume that $\hat { \mathbf { A } } _ { \mathcal { M } }$ , $\mathbf { A } ^ { \star }$ has orthonormal columns. If $n = d ,$ , for sufficiently large constant $C _ { b }$ , we have:
219
+
220
+ $$
221
+ \gamma _ { S } ( \mathcal { M } , \mathcal { N } ) \leq 0
222
+ $$
223
+
224
+ In this special case, Proposition 1 directly guarantees that training with incomplete modalities weakens the ability to learn a optimal latent representation. As a result, it also degrades the learning performance.
225
+
226
+ # 5 Experiment
227
+
228
+ We conduct experiments to validate our theoretical results. The source of the data we consider is two-fold, multi-modal real-world dataset and well-designed generated dataset.
229
+
230
+ # 5.1 Real-world dataset
231
+
232
+ Dataset. The natural dataset we use is the Interactive Emotional Dyadic Motion Capture (IEMOCAP) database, which is an acted multi-modal and multi-speaker database [6]. It contains three modalities, Text, Video and Audio. We follow the data preprocessing method of [33] and obtain 100 dimensions data for audio, 100 dimensions for text, and 500 dimensions for video. There are six labels here, namely, happy, sad, neutral, angry, excited and frustrated. We use 13200 data for training and 3410 for testing.
233
+
234
+ Training Setting. For all experiments on IEMOCAP, we use one linear neural network layer to extract the latent feature, and we set the hidden dimension to be 128. In multi-modal network, different modalities do not share encoders and we concatenate the features first, and then map the feature to the task space. We use Adam [25] as the optimizer and set the learning rate to be 0.01, with other hyper-parameters default. The batch size is 2048 for the data. For this classification task, the top-1 accuracy is used for performance measurement. We use naively multi-modal late-fusion training as our framework [43, 9]. In Appendix C, we provide more discussions on stable multi-modal training.
235
+
236
+ Connection to the Latent Representation Quality. The classification accuracy on IEMOCAP, using different combinations of modalities are summarized in Table 1. All learning strategies using multiple modalities outperform the single modal baseline. To validate Theorem 1, we calculate the test accuracy difference between different subsets of modalities using the result in Table 1 and show them in the third column of Table 3.
237
+
238
+ Moreover, we empirically evaluate the $\eta ( \hat { g } _ { \mathcal { M } } )$ in the following way: freeze the encoder ${ \hat { g } } _ { M }$ obtained through pretraining and then finetune to obtain a better classifier $h$ . Having $\eta ( \hat { g } _ { \mathcal { M } } )$ and $\eta ( \hat { g } _ { \mathcal { N } } )$ , the values of $\gamma _ { S } ( \mathcal { M } , \mathcal { N } )$ between different subsets of modalities are also presented in Table 3. Previous discussions on Theorem 1 implies that the population risk difference between $\mathcal { M }$ and $\mathcal { N }$ modalities has the same sign as $\gamma _ { S } ( \mathcal { M } , \mathcal { N } )$ when the sample size is large enough, and negativity implies performance gains. Since we use accuracy as the measure, on the contrary, positivity indicates a better performance in our settings. As shown in Table 3, when more modalities are added for learning, the test accuracy difference and $\gamma _ { S } ( \mathcal { M } , \mathcal { N } )$ are both positive, which confirms the important role of latent representation quality characterized in Theorem 1.
239
+
240
+ Table 1: Test classification accuracy on IEMOCAP, using different combinations of modalities, only Text, Text $^ +$ Video, Text $^ +$ Audio and Text $^ +$ Video $^ +$ Audio.
241
+
242
+ <table><tr><td>Modalities</td><td>Test Acc</td></tr><tr><td>Text(T)</td><td>49.93±0.57</td></tr><tr><td>Text + Video(TV)</td><td>51.08±0.66</td></tr><tr><td>Text + Audio(TA)</td><td>53.03±0.21</td></tr><tr><td>Text + Video + Audio(TVA)</td><td>53.89 ± 0.47</td></tr></table>
243
+
244
+ Table 2: Latent representation quality vs. The number of the sample size on IEMOCAP. Noting that in this table, we show the results from naively end-to-end late-fusion training and in Appendix C, we discuss on more stable multi-modal training methods.
245
+
246
+ <table><tr><td rowspan="2">Modalities</td><td colspan="5">Test Acc (Ratio of Sample Size)</td></tr><tr><td>10-4</td><td>10-3</td><td>10-2</td><td>10-1</td><td>1</td></tr><tr><td>T</td><td>23.66±1.28</td><td>29.08±3.34</td><td>45.63±0.29</td><td>48.30±1.31</td><td>49.93±0.57</td></tr><tr><td>TA</td><td>25.06±1.05</td><td>34.28±4.54</td><td>47.28±1.24</td><td>50.46±0.61</td><td>51.08±0.66</td></tr><tr><td>TV</td><td>24.71±0.87</td><td>38.37±3.12</td><td>46.54±1.62</td><td>49.50±1.04</td><td>53.03±0.21</td></tr><tr><td>TVA</td><td>24.71±0.76</td><td>32.24±1.17</td><td>46.39±3.82</td><td>50.75±1.45</td><td>53.89±0.47</td></tr></table>
247
+
248
+ Table 3: Comparison of test accuracy and latent representation quality among different combinations of modalities.
249
+
250
+ <table><tr><td>MModalities</td><td>NModalities</td><td>Test Acc Difference</td><td>γs(M,N)</td></tr><tr><td>TA</td><td>T</td><td>1.15</td><td>1.36</td></tr><tr><td>TV</td><td>T</td><td>3.10</td><td>3.57</td></tr><tr><td>TVA</td><td>TV</td><td>0.86</td><td>0.19</td></tr><tr><td>TVA</td><td>TA</td><td>2.81</td><td>2.4</td></tr></table>
251
+
252
+ Upper Bound for Latent Space Exploration. Table 3 also confirms our theoretical analysis in Theorem 2. In all cases, the $\mathcal { N }$ modalities is a subset of $\mathcal { M }$ modalities, and correspondingly, a positive $\gamma _ { S } ( \mathcal { M } , \mathcal { N } )$ is observed. This indicates that $\mathcal { M }$ modalities has a more sufficient latent space exploration than its subset $\mathcal { N }$ modalities.
253
+
254
+ We also attempt to understand the use of sample size for exploring the latent space. Table 2 presents the latent representation quality $\eta$ obtained by using different numbers of sample size, which is measured by the test accuracy of the pretrain+finetuned modal. Here, the ratio of sample size is set to the total number of training samples. The corresponding curve is also ploted in Figure 2(a). As the number of sample size grows, the increase in performance of $\eta$ is observed, which is in keeping with the $\mathcal { O } ( \sqrt { 1 / m } )$ term in our upper bound for $\eta$ . The phenomenon that the combination of Text, Video and Audio (TVA) modalities underperforms the uni-modal when the number of sample size is relatively small, can also be interpreted by the trade-off we discussed in Theorem 2. When there are insufficient training examples, the intrinsic complexity of the function class induced by multiple modalities dominates, thus weakening its latent representation quality.
255
+
256
+ ![](images/e8907212ff3e5fc88974247870ef5492608e2965c7da32bbdc2d3bc769f720ee.jpg)
257
+
258
+ (a) Latent representation quality vs.The ratio of the sample size on IEMOCAP
259
+
260
+ ![](images/9c6a516c42de11fbdaf50ac1d461b95958f35f554ac6c365c843a8e2e4a5a966.jpg)
261
+ (b) Latent representation quality vs. The number of modalities on simulated data
262
+ Figure 2: Evaluation of the latent representation quality on different data sets
263
+
264
+ # 5.2 Synthetic Data
265
+
266
+ In this subsection, we investigate the effect of modality correlation on latent representation quality. Typically, there are three situations for the correlation across each modality [39]. (i) Each modality does not share information at all, that is, each modality only contains modal-specific information. (ii) The other is that, all modalities only maintain the share information without unique information on their own. (iii) The last is a moderate condition, i.e., each modal not only shares information, but also owns modal-specific information. The reason to utilize simulated data in this section is due to the fact that it is hard in practice to have natural datasets that possess the required degree of modality correlation.
267
+
268
+ Data Generation. For the synthetic data, we have four modalities, denoted by $m _ { 1 } , m _ { 2 } , m _ { 3 } , m _ { 4 }$ respectively, and the generation process is summarized as follows:
269
+
270
+ Step 1: Generate $m _ { i } \sim \mathcal { N } ( \mathbf { 0 } , \mathbf { I } )$ , $i = { 1 , 2 , 3 , 4 }$ , where $m _ { i }$ is i.i.d. 100-dimensional random vector;
271
+ Step 2: Generate $m _ { i } \gets ( 1 - w ) \cdot m _ { i } + w \cdot m _ { 1 } \mathrm { f o r } i = 2 , 3 , 4$
272
+ Step 3: Generate the labels as follows. First, add the four modality vectors and calculate the sum of coordinates. Then, obatin the 1-dimensional label, i.e. $y = ( m _ { 1 } + m _ { 2 } + m _ { 3 } +$ $m _ { 4 } ) . s u m ( d i m = 1 )$
273
+
274
+ We can see that information from $m _ { 1 }$ is shared across different modalities, and $w$ controls how much is shared, which one can use to measure the degree of overlaps. We tune it in $\{ 0 . 0 , 0 . 2 , 0 . 5 , 0 . 8 , 1 . 0 \}$ . A high weight $w$ (close to 1) indicates a high degree of overlaps, while $w = 0$ means each modality is totally independent and is non-overlapping.
275
+
276
+ Training Setting. We use the multi-layer perceptron neural network as our model. To be more specific, we first use a linear layer to encode the input to a 10-dimension latent space and then we map the latent feature to the output space. The first layer’s input dimension depends on the number of modality. For example, if we use two modalities, the input dimension is 200. We use SGD as our
277
+
278
+ optimizer, and set a learning rate 0.01, momentum 0.9, batch size 10000, training for 10000 steps.
279
+ The Mean Square Error (MSE) loss is considered for evaluation in this regression problem.
280
+
281
+ $\eta$ vs Modality Correlation Our aim is to discover the influence of modality correlation on the latent representation quality $\eta$ . To this end, Table 4 shows the $\eta$ with the varying number of modalities under different correlation conditions, which is measured by the MSE loss of the pretrain $^ +$ finetuned modal. The trend that the loss decreases as the number of modalities increases is described in Figure 2(b), which also validates our analysis of Theorem 2. Moreover, Figure 2(b) shows that higher correlation among modalities achieves a lower loss for $\eta$ , which means a better latent representation. This emphasizes the role of latent space to exploit the intrinsic correlations among different modalities.
282
+
283
+ Table 4: Latent representation quality among different correlation situations on synthetic data
284
+
285
+ <table><tr><td rowspan="2">Modalities</td><td colspan="5">MSE Loss (Degree of Overlap )</td></tr><tr><td>1</td><td>0.8</td><td>0.5</td><td>0.2</td><td>0.0</td></tr><tr><td>m1</td><td>0</td><td>12.04±0.39</td><td>75.89±1.28</td><td>193.28±1.08</td><td>301.92±7.85</td></tr><tr><td>m1,m2</td><td>0</td><td>8.16±0.17</td><td>51.25±1.06</td><td>129.81±4.36</td><td>207.45±4.68</td></tr><tr><td>m1,m2,m3</td><td>0</td><td>4.18±0.05</td><td>26.06±0.69</td><td>65.17±1.52</td><td>103.23±0.61</td></tr><tr><td>m1,m2,m3,m4</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td></tr></table>
286
+
287
+ # 6 Discussion
288
+
289
+ It has been discovered that the use of multi-modal data in practice will degrade the performance of the model in some cases[43, 19, 38, 15]. These works identify the causes of performance drops of multimodal as interactions between modalities in the training stage and try to improve the performance by proposing new optimization strategies. Therefore, to theoretically understand them, we need to analyze the training process from the optimization perspective. Our results, on the other hand, mainly focus on the generalization side, which is separated from optimization and assumes that we get the best performance possible in training. Moreover, our theory is general and does not require additional assumptions on the relationship across every single modality, which may be crucial for theoretically analyzing the observations in a multi-modal performance drop. Understanding why multi-modal fails in practice is a very interesting direction and worth further investigation in future research.
290
+
291
+ # 7 Conclusion
292
+
293
+ In this work, we formulate a multi-modal learning framework that has been extensively studied in the empirical literature towards rigorously understanding why multi-modality outperforms single since the former has access to a better latent space representation. The results answer the two questions: when and why multi-modal outperforms uni-modal jointly. To the best of our knowledge, this is the first theoretical treatment to explain the superiority of multi-modal from the generalization standpoint.
294
+
295
+ The key takeaway message is that the success of multi-modal learning relies essentially on the better quality of latent space representation, which points to an exciting direction that is worth further investigation: to find which encoder is the bottleneck and focus on improving it. More importantly, our work provides new insights for multi-modal theoretical research, and we hope this can encourage more related research.
296
+
297
+ # Acknowledgments and Disclosure of Funding
298
+
299
+ The work of Yu Huang and Longbo Huang is supported in part by the Technology and Innovation Major Project of the Ministry of Science and Technology of China under Grant 2020AAA0108400 and 2020AAA0108403.
300
+
301
+ # References
302
+
303
+ [1] Massih-Reza Amini, Nicolas Usunier, Cyril Goutte, et al. Learning from multiple partially observed views-an application to multilingual text categorization. In NIPS, volume 22, pages 28–36, 2009.
304
+ [2] Peter Anderson, Qi Wu, Damien Teney, Jake Bruce, Mark Johnson, Niko Sünderhauf, Ian Reid, Stephen Gould, and Anton Van Den Hengel. Vision-and-language navigation: Interpreting visually-grounded navigation instructions in real environments. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 3674–3683, 2018.
305
+ [3] Tadas Baltrušaitis, Chaitanya Ahuja, and Louis-Philippe Morency. Multimodal machine learning: A survey and taxonomy. IEEE transactions on pattern analysis and machine intelligence, 41(2):423–443, 2018.
306
+ [4] Peter Bartlett, Dylan J Foster, and Matus Telgarsky. Spectrally-normalized margin bounds for neural networks. arXiv preprint arXiv:1706.08498, 2017.
307
+ [5] Peter L Bartlett and Shahar Mendelson. Rademacher and gaussian complexities: Risk bounds and structural results. Journal of Machine Learning Research, 3(Nov):463–482, 2002.
308
+ [6] Carlos Busso, Murtaza Bulut, Chi-Chun Lee, Abe Kazemzadeh, Emily Mower, Samuel Kim, Jeannette N Chang, Sungbok Lee, and Shrikanth S Narayanan. Iemocap: Interactive emotional dyadic motion capture database. Language resources and evaluation, 42(4):335–359, 2008.
309
+ [7] Giovanni Cavallanti, Nicolo Cesa-Bianchi, and Claudio Gentile. Linear algorithms for online multitask classification. The Journal of Machine Learning Research, 11:2901–2934, 2010.
310
+ [8] Honglie Chen, Weidi Xie, Andrea Vedaldi, and Andrew Zisserman. Vggsound: A large-scale audio-visual dataset. In ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 721–725. IEEE, 2020.
311
+ [9] Chenzhuang Du, Tingle Li, Yichen Liu, Zixin Wen, Tianyu Hua, Yue Wang, and Hang Zhao. Improving multi-modal learning with uni-modal teachers. arXiv preprint arXiv:2106.11059, 2021.
312
+ [10] Simon S Du, Wei Hu, Sham M Kakade, Jason D Lee, and Qi Lei. Few-shot learning via learning the representation, provably. arXiv preprint arXiv:2002.09434, 2020.
313
+ [11] Ariel Ephrat, Inbar Mosseri, Oran Lang, Tali Dekel, Kevin Wilson, Avinatan Hassidim, William T Freeman, and Michael Rubinstein. Looking to listen at the cocktail party: A speakerindependent audio-visual model for speech separation. arXiv preprint arXiv:1804.03619, 2018.
314
+ [12] Haytham M Fayek and Anurag Kumar. Large scale audiovisual learning of sounds with weakly labeled data. arXiv preprint arXiv:2006.01595, 2020.
315
+ [13] Marco Federici, Anjan Dutta, Patrick Forré, Nate Kushman, and Zeynep Akata. Learning robust representations via multi-view information bottleneck. arXiv preprint arXiv:2002.07017, 2020.
316
+ [14] Christoph Feichtenhofer, Axel Pinz, and Andrew Zisserman. Convolutional two-stream network fusion for video action recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 1933–1941, 2016.
317
+ [15] Itai Gat, Idan Schwartz, Alexander Schwing, and Tamir Hazan. Removing bias in multimodal classifiers: Regularization by maximizing functional entropies. arXiv preprint arXiv:2010.10802, 2020.
318
+ [16] Jort F Gemmeke, Daniel PW 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 2017 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 776–780. IEEE, 2017.
319
+ [17] 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 Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 6904–6913, 2017.
320
+ [18] Saurabh Gupta, Judy Hoffman, and Jitendra Malik. Cross modal distillation for supervision transfer. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 2827–2836, 2016.
321
+ [19] Zongbo Han, Changqing Zhang, Huazhu Fu, and Joey Tianyi Zhou. Trusted multi-view classification. arXiv preprint arXiv:2102.02051, 2021.
322
+ [20] Caner Hazirbas, Lingni Ma, Csaba Domokos, and Daniel Cremers. Fusenet: Incorporating depth into semantic segmentation via fusion-based cnn architecture. In Asian conference on computer vision, pages 213–228. Springer, 2016.
323
+ [21] 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.
324
+ [22] Xinxin Hu, Kailun Yang, Lei Fei, and Kaiwei Wang. Acnet: Attention based network to exploit complementary features for rgbd semantic segmentation. In 2019 IEEE International Conference on Image Processing (ICIP), pages 1440–1444. IEEE, 2019.
325
+ [23] Jindong Jiang, Lunan Zheng, Fei Luo, and Zhijun Zhang. Rednet: Residual encoder-decoder network for indoor rgb-d semantic segmentation. arXiv preprint arXiv:1806.01054, 2018.
326
+ [24] M Esat Kalfaoglu, Sinan Kalkan, and A Aydin Alatan. Late temporal modeling in 3d cnn architectures with bert for action recognition. In European Conference on Computer Vision, pages 731–747. Springer, 2020.
327
+ [25] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
328
+ [26] Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. Advances in neural information processing systems, 25:1097– 1105, 2012.
329
+ [27] Mehryar Mohri, Afshin Rostamizadeh, and Ameet Talwalkar. Foundations of machine learning. MIT press, 2018.
330
+ [28] Behnam Neyshabur, Zhiyuan Li, Srinadh Bhojanapalli, Yann LeCun, and Nathan Srebro. Towards understanding the role of over-parametrization in generalization of neural networks. arXiv preprint arXiv:1805.12076, 2018.
331
+ [29] Behnam Neyshabur, Ryota Tomioka, and Nathan Srebro. Norm-based capacity control in neural networks. In Conference on Learning Theory, pages 1376–1401. PMLR, 2015.
332
+ [30] Jiquan Ngiam, Aditya Khosla, Mingyu Kim, Juhan Nam, Honglak Lee, and Andrew $\mathrm { ~ Y ~ N ~ g ~ }$ . Multimodal deep learning. In ICML, 2011.
333
+ [31] Seong-Jin Park, Ki-Sang Hong, and Seungyong Lee. Rdfnet: Rgb-d multi-level residual feature fusion for indoor semantic segmentation. In Proceedings of the IEEE international conference on computer vision, pages 4980–4989, 2017.
334
+ [32] Massimiliano Pontil and Andreas Maurer. Excess risk bounds for multitask learning with trace norm regularization. In Conference on Learning Theory, pages 55–76. PMLR, 2013.
335
+ [33] Soujanya Poria, Erik Cambria, Devamanyu Hazarika, Navonil Majumder, Amir Zadeh, and Louis-Philippe Morency. Context-dependent sentiment analysis in user-generated videos. In Proceedings of the 55th annual meeting of the association for computational linguistics (volume 1: Long papers), pages 873–883, 2017.
336
+ [34] George AF Seber and Alan J Lee. Linear regression analysis, volume 329. John Wiley & Sons, 2012.
337
+ [35] Daniel Seichter, Mona Köhler, Benjamin Lewandowski, Tim Wengefeld, and Horst-Michael Gross. Efficient rgb-d semantic segmentation for indoor scene analysis. arXiv preprint arXiv:2011.06961, 2020.
338
+ [36] Linda Smith and Michael Gasser. The development of embodied cognition: Six lessons from babies. Artificial life, 11(1-2):13–29, 2005.
339
+ [37] Karthik Sridharan and Sham M Kakade. An information theoretic framework for multi-view learning. 2008.
340
+ [38] Mahesh Subedar, Ranganath Krishnan, Paulo Lopez Meyer, Omesh Tickoo, and Jonathan Huang. Uncertainty-aware audiovisual activity recognition using deep bayesian variational inference. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 6301–6310, 2019.
341
+ [39] Xinwei Sun, Yilun Xu, Peng Cao, Yuqing Kong, Lingjing Hu, Shanghang Zhang, and Yizhou Wang. Tcgm: An information-theoretic framework for semi-supervised multi-modality learning. In European Conference on Computer Vision, pages 171–188. Springer, 2020.
342
+ [40] Nilesh Tripuraneni, Chi Jin, and Michael I Jordan. Provable meta-learning of linear representations. arXiv preprint arXiv:2002.11684, 2020.
343
+ [41] Nilesh Tripuraneni, Michael Jordan, and Chi Jin. On the theory of transfer learning: The importance of task diversity. Advances in Neural Information Processing Systems, 33, 2020.
344
+ [42] Yao-Hung Hubert Tsai, Yue Wu, Ruslan Salakhutdinov, and Louis-Philippe Morency. Selfsupervised learning from a multi-view perspective. arXiv preprint arXiv:2006.05576, 2020.
345
+ [43] Weiyao Wang, Du Tran, and Matt Feiszli. What makes training multi-modal classification networks hard? In 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 12692–12702. IEEE, 2020.
346
+ [44] Yikai Wang, Wenbing Huang, Fuchun Sun, Tingyang Xu, Yu Rong, and Junzhou Huang. Deep multimodal fusion by channel exchanging. Advances in Neural Information Processing Systems, 33, 2020.
347
+ [45] Chang Xu, Dacheng Tao, and Chao Xu. A survey on multi-view learning. arXiv preprint arXiv:1304.5634, 2013.
348
+ [46] Dan Xu, Wanli Ouyang, Elisa Ricci, Xiaogang Wang, and Nicu Sebe. Learning cross-modal deep representations for robust pedestrian detection. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 5363–5371, 2017.
349
+ [47] Yang Yang, Han-Jia Ye, De-Chuan Zhan, and Yuan Jiang. Auxiliary information regularized machine for multiple modality feature learning. In Twenty-Fourth International Joint Conference on Artificial Intelligence, 2015.
350
+ [48] Changqing Zhang, Huazhu Fu, Joey Tianyi Zhou, Qinghua Hu, et al. Cpm-nets: Cross partial multi-view networks. 2019.
351
+ [49] Hang Zhao, Chuang Gan, Andrew Rouditchenko, Carl Vondrick, Josh McDermott, and Antonio Torralba. The sound of pixels. In Proceedings of the European conference on computer vision (ECCV), pages 570–586, 2018.
352
+ [50] Tao Zhou, Kim-Han Thung, Mingxia Liu, Feng Shi, Changqing Zhang, and Dinggang Shen. Multi-modal latent space inducing ensemble svm classifier for early dementia diagnosis with neuroimaging data. Medical image analysis, 60:101630, 2020.
md/train/Z3yd722b5X5/Z3yd722b5X5.md ADDED
@@ -0,0 +1,536 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Identifying and Estimating Causal Effects under Weak Overlap by Generative Prognostic Model
2
+
3
+ Anonymous Author(s)
4
+ Affiliation
5
+ Address
6
+ email
7
+
8
+ # Abstract
9
+
10
+ 1 As an important problem of causal inference, we discuss the identification and
11
+ 2 estimation of treatment effects (TEs) under weak overlap, i.e., subjects with certain
12
+ 3 features all belong to a single treatment group. We use a latent variable to model
13
+ 4 a prognostic score (PGS), which is widely used in biostatistics and sufficient for
14
+ 5 TEs, i.e., we build a generative prognostic model. We prove that the latent variable
15
+ 6 recovers a PGS, and the model identifies individualized treatment effects. The
16
+ 7 model is then learned as the Intact-VAE, a new type of variational autoencoder
17
+ 8 (VAE). We derive counterfactual generalization bounds which motivate represen
18
+ 9 tation balanced for treatment groups conditioned on individualized features. The
19
+ 10 proposed method is compared with recent methods using (semi-)synthetic datasets.
20
+
21
+ # 11 1 Introduction
22
+
23
+ 12 Causal inference [21, 34], i.e, inferring causal effects of interventions, is a fundamental problem. In
24
+ 13 this work, we focus on treatment effects (TEs), such as effects of public policies or a new drug, based
25
+ 14 on a set of observations consisting of binary labels for treatment / control (non-treated), outcome, and
26
+ 15 other covariates (e.g, patients’ personal records). The fundamental difficulty of causal inference is
27
+ 16 that we never observe counterfactual outcomes, which would have been if we had made the other
28
+ 17 decision (treatment or control). While the ideal protocol for causal inference is randomized controlled
29
+ 18 trials (RCTs), they often have ethical and practical issues, or suffer from prohibitive costs. Thus,
30
+ 19 causal inference from observational data is indispensable. It introduces other challenges, however.
31
+ 20 The most crucial one is confounding: there may be variables (called confounders) that causally affect
32
+ 21 both the treatment and the outcome, and spurious correlation follows.
33
+ 22 A large majority of works, including this work, rely on the unconfoundedness, which means that
34
+ 23 appropriate covariates are collected so that the confounding can be controlled by conditioning on
35
+ 24 covariates. That is, all the confounders are in essence observed. This is still challenging, due to
36
+ 25 systematic imbalance (difference) of the distributions of the covariates between the treatment and
37
+ 26 control groups, introducing bias in estimation. Among classical ways of dealing with imbalance
38
+ 27 are matching and re-weighting [44, 35]. Machine learning methods are also exploited; there are
39
+ 28 semi-parametric methods, e.g, [48, TMLE], which have better finite sample performance, and also
40
+ 29 non-parametric, tree-based methods, e.g., [49, Causal Forests (CF)]. Notably, starting from [23], there
41
+ 30 is a recent rise of interest in learning representation of covariates, which is independent of treatment
42
+ 31 groups, i.e., balanced representation learning (BRL) .
43
+ 32 The most serious form of imbalance is that sample points with certain values of covariate are all
44
+ 33 belong to a single treatment group, which is called weak overlap of the covariate. Causal effects are
45
+ 34 not directly estimable at non-overlapped covariate values. There are lines of work that give robustness
46
+ 35 to weak overlap [3], trim non-overlapped sample points [52], or study convergence rate depending
47
+ 36 on overlap [19]. Weak overlap is particularly relevant to machine learning methods exploiting rich
48
+ 37 covariates, because, with higher-dimensional covariates, overlap is harder to satisfy and verify [10].
49
+ 38 Our approach to the weak overlap issue is based on the prognostic score (PGS) [14], which is among
50
+ 39 the important concepts of sufficient scores. While the most well-known score is the propensity score
51
+ 40 (PPS) [36], PGSs have also long been known to improve methods using PPS [37, 5], and interests last
52
+ 41 in biostatistics [45, 2]. Prognostic modeling can benefit more from predictive systems and exploit
53
+ 42 richer literature than propensity modeling, particularly in Medicine and Health. A comparative study
54
+ 43 in [13] shows PGS-based methods perform better, or as well as, PPS methods. Thus, it is promising
55
+ 44 to combine the predictive powers of prognostic modeling and machine learning.
56
+ 45 To solve the inverse problem of recovering PGSs, our method exploits also the recent advance
57
+ 46 of identifiable representation, particularly of VAE [26, iVAE]. Identification means parameters of
58
+ 47 interest (for us, representation function and causal effects) are uniquely determined and given by
59
+ 48 true observational distribution. Identification logically precedes estimation and inference. Without
60
+ 49 identification there is no hope of a consistent estimator, and a model would fail silently; it may fit
61
+ 50 perfectly but return an estimator that converges to the wrong one or does not converge [29, particularly
62
+ 51 Sec. 8]. Identification is even more important for causal inference, because, unlike usual (non-causal)
63
+ 52 model misspecification, causal assumptions are often unverifiable through observables [50]. Thus, it
64
+ 53 is critical to specify theoretical conditions for identification, and then the applicability of methods
65
+ 54 can be judged by knowledge of an application domain.
66
+ 55 In this work, we study identification (Sec. 3) and estimation (Sec. 4) of TEs under weak overlap. We
67
+ 56 particularly discuss individualized treatment effects, conditioned on the covariates. Code and proofs
68
+ 57 are in Supplementary Materials. The main contributions of this paper are:
69
+ 58 1) theory of TE identification under weak overlap of covariates, using PGS and identifiable model;
70
+ 59 2) counterfactual generalization bounds on TE error, which motivates our conditional BRL;
71
+ 60 3) a new regularized VAE to estimate TEs, with connections to identification and balancing;
72
+ 61 4) experimental comparison to state-of-the-art methods on (semi-)synthetic datasets.
73
+
74
+ # 62 2 Setup and motivation
75
+
76
+ # 2.1 Counterfactuals, treatment effects, and identification
77
+
78
+ Following [21], we introduce potential outcomes (POs, or counterfactual outcomes) $\mathbf { y } ( t ) \in \mathbb { R } ^ { d } , t \in$ $\{ 0 , 1 \}$ . ${ \bf y } ( t )$ is the outcome that would have been observed, if treatment value $\mathbf { t } = t$ had been applied. Formally, this is the consistency of counterfactuals: $\mathbf { y } = \mathbf { y } ( t )$ if $\mathrm { \Delta t } = t$ , or simply $\mathbf { y } = \mathbf { y } ( \mathbf { t } )$ . We see ${ \bf y } ( t )$ as the hidden variables that give factual y under factual assignment $\mathbf { t } = t$ . The fundamental problem of causal inference is that, for a unit under research, we could observe only one of $\pmb { y } ( 0 )$ or $\pmb { y } ( 1 )$ , corresponding the treatment value applied. That is, “factual” refers to $\mathbf { y }$ or t that is in principle observable in data, or statistical entities (e.g, estimators) built on them. We also observe relevant covariate(s) $\mathbf { x } \in \mathcal { X } \subseteq \mathbb { R } ^ { m }$ , which is associated with individuals, with distribution $\mathcal { D } \sim p ( \mathbf { x } , \mathbf { y } , \mathbf { t } )$ . Note, we use Roman fonts for random variables (e.g., t) and italic for realization (e.g., $t _ { , }$ ).
79
+
80
+ 3 The expected PO is denoted by $\mu _ { t } ( \pmb { x } ) = \mathbb { E } ( \mathbf { y } ( t ) | \mathbf { x } = \pmb { x } )$ , conditioned on ${ \bf x } = { \bf x }$ . The estimands in
81
+ 74 this work are the Conditional Average TE (CATE) and Average TE (ATE), defined respectively by
82
+
83
+ $$
84
+ \tau ( \pmb { x } ) = \mu _ { 1 } ( \pmb { x } ) - \mu _ { 0 } ( \pmb { x } ) , \quad \nu = \mathbb { E } ( \tau ( \mathbf { x } ) ) .
85
+ $$
86
+
87
+ 75 CATE is an individual-level, personalized, treatment effect, given highly discriminative covariate.
88
+
89
+ 76 Standard results [38][16, Ch. 3] give sufficient conditions for identification under general setting.
90
+ 77 They are Exchangeability: $\mathbf { y } ( t ) \bot \bot \mathbf { t } | \mathbf { x }$ , and $o$ verlap: $p ( t | { \pmb x } ) > 0$ for any $\mathbf { \boldsymbol { x } } \in \mathcal { X }$ . Both are required for
91
+ 78 $t \in \{ 0 , 1 \}$ . When $t$ appears in a statement without quantification, we always mean “for both $t ^ { \ast }$ . Often,
92
+ 79 Consistency is also listed, but, as above, it is better known as well-definedness of counterfactuals.
93
+ 80 Exchangeability means, just as in RCTs but additionally given $\mathbf { x }$ , that there is no correlation between
94
+ 81 factual treatment t and counterfactual outcomes ${ \bf y } ( t )$ . Overlap means that the supports of $p ( \mathbf { x } | \mathbf { t } = 0 )$
95
+ 82 and $p ( \mathbf { x } | \mathbf { t } = 1 )$ should be the same, and this ensures it is valid to condition on any $( { \pmb x } , t )$ .
96
+ 83 We relax overlapped covariate in Sec. 3.2, to allow some non-overlapped values $_ { \textbf { \em x } }$ , i.e., covariate $\mathbf { x }$ is
97
+ 84 weakly overlapped. In Sec. 2.2, we introduce a condition which gives exchangeability (and PGSs). In
98
+ 85 this paper, we also discuss overlap of variables other than $\mathbf { x }$ (e.g. PGSs), and we give a definition for
99
+ 86 any random variable $\mathbf { v }$ with support $\nu$ as following.
100
+ 87 Definition 1. Overlap of $\mathbf { v }$ means $p ( t | \pmb { v } ) > 0$ for all $t \in \{ 0 , 1 \} , v \in \mathcal { V }$ . We also say $\mathbf { v }$ is overlapped.
101
+ 88 If the condition is violated at some value $\pmb { v }$ , then $\pmb { v }$ is non-overlapped and $\mathbf { v }$ is weakly overlapped.
102
+
103
+ Our method is motivated by PGSs [14], adapted as $\mathrm { P t }$ -score and P-score in Definition 2 in this paper, related to balancing scores ${ \pmb b } ( { \bf x } )$ , which is defined by $\mathbf { t } \perp \mathbf { \| } \mathbf { x } | \pmb { { b } } ( \mathbf { x } )$ [36]. The PPS $p ( \mathbf { t } = 1 | \mathbf { x } )$ is a special case of this. Both are sufficient scores for identification; PGSs are sufficient statistics of outcome predictors and ${ \pmb b } ( { \bf x } )$ is for the treatment (see Appendix for details).
104
+
105
+ Definition 2. A $P t$ -score (PtS) is two functions $\mathbb { P } _ { t } ( \mathbf { x } )$ $\mathit { t } = 0 , 1$ ) such that $\mathbf { y } ( t ) \bot \bot \mathbf { x } | \mathbb { P } _ { t } ( \mathbf { x } )$ . A PtS is called a $P$ -score (PS) if $\mathbb { P } _ { 0 } = \mathbb { P } _ { 1 }$ .
106
+
107
+ Note that, a PtS is by definition two functions, thus overlapped $\mathbb { P } _ { t } ( \mathbf { x } )$ means both $\mathbb { P } _ { 0 } ( \mathbf { x } )$ and $\mathbb { P } _ { 1 } ( \mathbf { x } )$ are overlapped. Why PtS (PGS)? PtS is more applicable than balancing score ${ \pmb b } ( { \bf x } )$ under weak overlap. Overlapped ${ \pmb b } ( { \bf x } )$ implies overlapped $\mathbf { x }$ , which in turn implies overlapped PGS [10]. Lowerdimensional than x, PtS is likely more overlapped than $\mathbf { x }$ , and, moreover, there is evidence that PtS maximizes overlap among all sufficient scores for ATE [9].
108
+
109
+ Below is a direct corollary of Proposition 5 in [14]. Both of PtS and PS give CATE, but, as we will see, PS is better as a conditionally balanced representation, since $\mathbb { P } _ { \mathrm { t } } ( \mathbf { x } ) \bot \bot \mathrm { t } | \mathbf { x }$ only when $\mathbb { P } _ { 0 } = \mathbb { P } _ { 1 }$ .
110
+
111
+ 103 Proposition 1 (CATE by PtS). If $\mathbb { P } _ { t }$ is a $P t S$ , then CATE can be given by
112
+
113
+ $$
114
+ \begin{array} { r } { \mu _ { t } ( \pmb { x } ) = \mathbb { E } ( \mathbb { E } ( \pmb { \mathrm { y } } ( t ) | \mathbb { P } _ { t } , \pmb { x } ) ) = \mathbb { E } ( \mathbb { E } ( \pmb { \mathrm { y } } | \mathbb { P } _ { t } ( \pmb { x } ) , \pmb { \mathrm { t } } = t ) ) = \int p ( y | \mathbb { P } _ { t } = \mathbb { P } _ { t } ( \pmb { x } ) , t ) y d y } \end{array}
115
+ $$
116
+
117
+ 04 With the knowledge of $\mathbb { P } _ { t }$ , we choose one of $\mathbb { P } _ { 0 } , \mathbb { P } _ { 1 }$ corresponding to the counterfactual outcome of
118
+ 105 interest. This ability of counterfactual assignment resolves the problem of non-overlap at $_ { \textbf { \em x } }$ .
119
+
120
+ PtSs exist under general settings when $\mathbf { y } ( t )$ follows an additive noise model (ANM).
121
+
122
+ (G1) (ANM) the data generating process (DGP) for $\mathbf { y }$ is $\mathbf { y } = f ^ { * } ( \mathbb { M } ( \mathbf { x } ) , \mathbf { t } ) + \mathbf { e }$ where $f ^ { * } , \mathbb { M }$ are functions and $\mathbf { e }$ is a zero-mean exogenous (external) noise.
123
+
124
+ 109 The DGP defines ${ \bf y } ( t )$ by setting $\mathrm { \Delta t } = t$ in the equation. And it also specifies how other variables
125
+ 110 causally affect y. For example, $\mathbf { x }$ affects $\mathbf { y }$ through $\mathbb { M }$ , so $\mathbb { M } ( \mathbf { x } )$ is the effect modifier [14], which is
126
+ 111 often components of $\mathbf { x }$ affecting $\mathbf { y }$ directly. Note (G1) also implies exchangeability given x, through
127
+ 112 $\mathbf { y } ( t ) \bot \bot \mathrm { t } | \bar { \mathbb { M } } ( \mathbf { x } )$ . ANMs are also commonly used in nonparametric regression methods for TEs [6].
128
+
129
+ Under (G1), 1)113 $\mathbb { P } _ { t } : = \pmb { f } _ { t } ^ { * } ( \mathbb { M } ( \mathbf { x } ) ) = \mu _ { t } ( \mathbf { x } ) ^ { 1 }$ is a $\mathrm { P t } \mathbf { S } ^ { 2 }$ but not PS, 2) $\mathbb { M }$ is a PS ( $\mathbf { x }$ is a trivial PS), and 114 3) $\mathbb { P } : = ( \mu _ { 0 } ( \mathbf { x } ) , \mu _ { 1 } ( \mathbf { x } ) )$ is a PS. We use the same symbol to denote a $\mathrm { P t } \mathbf { S }$ and the random variable 115 defined by it, when appropriate.
130
+
131
+ # 116 3 Identification under generative prognostic model
132
+
133
+ 117 In Sec. 3.1, we introduce our generative prognostic model and VAE based
134
+ 118 on $p ( \mathbf { y } , \mathbf { z } | \mathbf { x } , \mathbf { t } )$ and prove identifiability of our model. In Sec. 3.2, we prove
135
+ 119 identification of CATEs, one of our main contributions. The theoretical
136
+ 120 analysis involves only our generative model (i.e., prior and decoder), but
137
+ 121 not encoder, because model identifiability is a property of model, and
138
+ 122 causal identification is about $D G P$ and model. The encoder is involved
139
+ 123 in estimation which is studied in Sec. 4.
140
+
141
+ # 3.1 Intact-VAE: model, architecture, and identifiability
142
+
143
+ Generative models are useful to solve the inverse problem of recovering Pt-score. Our goal is to build a model that can be learned by VAE from observational data to obtain a $\mathrm { P t } \mathbf { S }$ , or more ideally PS, via the latent variable $\mathbf { z }$ . That is, a generative prognostic model.
144
+
145
+ ![](images/d5b30ffe9bbe2667edb788ebbee6ad4287fd666ac539f640e4b695d7b7f5a5e4.jpg)
146
+ Figure 1: Graphical models of the decoders. From top: CVAE, iVAE, and IntactVAE. The encoders are similar, taking all observables and build approximate posteriors, and thus are omitted.
147
+
148
+ 129 With the above goal, the generative model of our VAE is built as
149
+
150
+ $$
151
+ \begin{array} { r } { p ( { \mathbf { y } } , { \mathbf { z } } | { \mathbf { x } } , { \mathrm { t } } ) = p ( { \mathbf { y } } | { \mathbf { z } } , { \mathrm { t } } ) p ( { \mathbf { z } } | { \mathbf { x } } , { \mathrm { t } } ) . } \end{array}
152
+ $$
153
+
154
+ 130 The first factor is our decoder which models $p ( \mathbf { y } \vert \mathbb { P } _ { t } , \mathbf { t } )$ in (2), and the
155
+ 131 second factor is our conditional prior which models $\mathbb { P } _ { t } ( \mathbf { x } )$ . Conditioning on $\mathbf { x }$ in the joint model
156
+ 132 $p ( \mathbf { y } , \mathbf { z } | \mathbf { x } , \mathbf { t } )$ reflects that our estimand is CATE given x. Modeling the score by a conditional distri
157
+ 133 bution rather than a deterministic function is more flexible. We parameterize our model by ANM
158
+ 134 outcome and factorized Gaussian prior as
159
+
160
+ $$
161
+ p _ { f } ( \mathbf { y } | \mathbf { z } , \mathbf { t } ) = p _ { \epsilon } ( \mathbf { y } - f _ { \mathrm { t } } ( \mathbf { z } ) ) ; p _ { \lambda } ( \mathbf { z } | \mathbf { x } , \mathbf { t } ) \sim \mathcal { N } ( \mathbf { z } ; h _ { \mathrm { t } } ( \mathbf { x } ) , \mathrm { d i a g } ( k _ { \mathrm { t } } ( \mathbf { x } ) ) )
162
+ $$
163
+
164
+ where 135 $\theta = ( f , h , k )$ are functional parameters and $\epsilon$ is a noise. $\begin{array} { r } { \pmb { \lambda } ( \mathbf { x } ) : = \mathrm { d i a g } ( \pmb { k } _ { \mathrm { t } } ^ { - 1 } ( \mathbf { x } ) ) ( \pmb { h } ( \mathbf { x } ) , - \frac { 1 } { 2 } ) ^ { T } } \end{array}$
165
+ 136 is the natural parameter of the Gaussian prior, and we also use it as a shorthand for both $^ { h , k }$ .
166
+
167
+ 137 The ELBO of our model can be derived from standard variational lower bound
168
+
169
+ $$
170
+ \begin{array} { r l } & { \log p ( \mathbf { y } \vert \mathbf { x } , \mathbf { t } ) \geq \log p ( \mathbf { y } \vert \mathbf { x } , \mathbf { t } ) - D _ { \mathrm { K L } } \big ( q ( \mathbf { z } \vert \mathbf { x } , \mathbf { y } , \mathbf { t } ) \| p ( \mathbf { z } \vert \mathbf { x } , \mathbf { y } , \mathbf { t } ) \big ) } \\ & { \qquad = \mathbb { E } _ { z \sim q } \log p ( \mathbf { y } \vert z , \mathbf { t } ) - D _ { \mathrm { K L } } \big ( q ( \mathbf { z } \vert \mathbf { x } , \mathbf { y } , \mathbf { t } ) \| p ( \mathbf { z } \vert \mathbf { x } , \mathbf { t } ) \big ) . } \end{array}
171
+ $$
172
+
173
+ 138 Our encoder $q$ , which conditions on all the observables, is standard, and we will see its importance
174
+ 139 later. We name this architecture Intact- $V A E$ (Identifiable treatment-conditional VAE).
175
+ 140 We naturally have an identifiable conditional VAE (CVAE), as the name suggests. Note that (3) has a
176
+ 141 similar factorization with the generative model of iVAE [26], that is $p ( \mathbf { y } , \mathbf { \bar { z } } | \mathbf { x } ) = p ( \mathbf { y } | \mathbf { z } ) p ( \mathbf { z } | \mathbf { x } )$ ; the
177
+ 142 first factor does not depend on $\mathbf { x }$ . Further, since we have the conditioning on t in both the factors of
178
+ 143 (3), our VAE architecture is a combination of iVAE and CVAE [42, 28], with t as the conditioning
179
+ 144 variable. See Figure 1 for the comparison in terms of graphical models. The core idea of iVAE is
180
+ 145 reflected in our model identifiability (Lemma 1 below). See Appendix for the basics of VAEs.
181
+
182
+ The following conditions on the model are used in theoretical analysis.
183
+
184
+ (M1) i) $\pmb { f } _ { t }$ is injective, ii) $\pmb { f } _ { t }$ is differentiable, and iii) $n : = \dim ( \mathbf { z } ) = d ( = \dim ( \mathbf { y } ) )$ .
185
+
186
+ Lemma 1 (Model identifiability). Given model (3) and (4) under $( M I ) \ : i )$ and $i i$ ), for $\mathbf { t } = t$ , as (D1) (Linear independence of $\lambda$ ) there exist $2 n { + 1 }$ points $\pmb { x } _ { 0 } , . . . , \pmb { x } _ { 2 n } \in \mathcal { X }$ such that the $2 n$ -square matrix $\pmb { L } _ { t } : = [ \gamma _ { t , 1 } , . . . , \gamma _ { t , 2 n } ]$ is invertible, where $\gamma _ { t , k } : = \lambda _ { t } ( \pmb { x } _ { k } ) - \lambda _ { t } ( \pmb { x } _ { 0 } )$ .
187
+
188
+ 151 Then, given ${ \mathfrak { t } } = t _ { : }$ , the family is identifiable up to an equivalence class. That is, $\mathbf { \dot { \boldsymbol { f } } } \boldsymbol { p } _ { \pmb { \theta } } ( \mathbf { \boldsymbol { y } } | \mathbf { \boldsymbol { x } } , \mathbf { \boldsymbol { t } } = \boldsymbol { t } ) =$
189
+ 152 $p _ { \pmb { \theta } ^ { \prime } } ( \mathbf { y } | \mathbf { x } , \mathbf { t } = t )$ , we have the relation between parameters: for any ${ \mathbf { } } _ { \mathbf { } } \mathbf { \mathbf { } } _ { \mathbf { } } \mathbf { \mathbf { } } _ { \mathbf { } } \mathbf { \mathbf { } } _ { \mathbf { } } \mathbf { \mathbf { } } _ { \mathbf { } } \mathbf { \mathbf { } } _ { \mathbf { } } \mathbf { \mathbf { } } _ { \mathbf { } } \mathbf { \mathbf { } } _ { \mathbf { } } \mathbf { \Xi } _ { \mathbf { } } \mathbf { \Lambda } _ { \mathbf { } } \mathbf { \Lambda } _ { \mathbf { } } \textbf { } _ { \mathbf { } } \textbf { } \textbf { } _ { \mathrm { } }$ in the image of $f _ { t }$ ,
190
+
191
+ $$
192
+ \pmb { f } _ { t } ^ { - 1 } ( \pmb { y } _ { t } ) = \mathrm { d i a g } ( \pmb { a } ) \pmb { f } _ { t } ^ { \prime } { } ^ { - 1 } ( \pmb { y } _ { t } ) + \pmb { b } = : \pmb { \mathcal { A } } ( \pmb { f } _ { t } ^ { \prime } { } ^ { - 1 } ( \pmb { y } _ { t } ) )
193
+ $$
194
+
195
+ where $\mathrm { d i a g } ( a )$ is an invertible $n$ -diagonal matrix and $^ { b }$ is a $n$ -vector, both depend on $\lambda _ { t }$
196
+
197
+ The conditions are inherited from iVAE. (D1) holds easily in practice, if the components of $\lambda _ { t } ( \mathbf { x } )$ are linearly independent; if $\mathbf { ( D 1 ) }$ fails, then the support of $\lambda _ { t } ( \mathbf { x } )$ is in a $( 2 n - 1 )$ -dimensional space.
198
+
199
+ 156 The essence of the result is $\pmb { f } _ { t } ^ { \prime } = \pmb { f } _ { t } \circ \pmb { \mathcal { A } } _ { t }$ , that is, $\pmb { f } _ { t }$ can be identified (learned) up to an affine
200
+ 157 transformation defined by $\lambda _ { t }$ . This is achieved by combining the techniques from [26] and [43], and
201
+ 158 essentially the same results can be proved for other exponential family priors [43]. In this paper,
202
+ 159 symbol 0 (prime) always indicates another parameter (variable, etc.).
203
+
204
+ # 3.2 Nonparametric identifications under weakly-overlapped covariate
205
+
206
+ In this subsection, we give two identification results based on (partial) recovery of PS or PtS, respectively. Since PtSs are functions of $\mathbf { x }$ , the recovery is achieved by a noiseless prior, that is, $k ( \bar { \bf x } ) = 0$ ; the prior $\mathbf { z } _ { \lambda , t } \sim p _ { \lambda } ( \mathbf { z } | \mathbf { x } , \mathbf { t } = t )$ degenerates to deterministic function $h _ { t } ( \mathbf { x } )$ .
207
+
208
+ 164 PtSs with dimensionality lower than or equal to y are essential to work for weak overlap of $\mathbf { x }$ , to the
209
+ 165 extent that, from now on, we simply say PSs / PtSs when referring to this kind of low-dimensional
210
+ 166 $P S s / P t S s$ , unless particularly indicated. (M1) iii), i.e. $n = d$ , is not restrictive because $\mu _ { t }$ is a $\mathrm { P t } \mathbf { S }$ of
211
+ 167 the same dimension as y under (G1). Also, in practice, $n = d$ means that we seek a low-dimensional
212
+ 168 representation of $\mathbf { x }$ . In fact, to make the dimensionality explicit in (G1), we introduce an alternative
213
+ 169 (G1’) which includes (G1) with $\mathbb { P } _ { t } = \mu _ { t }$ and $j _ { t }$ is identity.
214
+
215
+ (G1’) (Low-dimensional PtS) Under (G1), $\mu _ { t } ( \mathbf { x } ) = j _ { t } ( \mathbb { P } _ { t } ( \mathbf { x } ) )$ for some $\mathbb { P } _ { t }$ and injective $j _ { t }$ .
216
+
217
+ 171 We use (G1’) afterwards. Clearly, $\mathbb { P } _ { t }$ in (G1’) is a PtS, and injectivity and $n = d$ ensure $n =$
218
+ 172 $\dim ( \mathbf { y } ) \geq \dim ( \mathbb { P } _ { t } )$ . Similarly, the next (G2) reduces unverifiable $n \geq \dim ( \mathbb { P } )$ to $n = d$ , for PS.
219
+
220
+ (G2) (Low-dimensional PS) Under (G1), $\mu _ { t } ( \mathbf { x } ) = j _ { t } ( \mathbb { P } ( \mathbf { x } ) )$ for some $\mathbb { P }$ and injective $j _ { t }$
221
+
222
+ 174 (G2) means that CATEs are given by $\mu _ { 0 }$ and an invertible function $i : = j _ { 1 } \circ j _ { 0 } ^ { - 1 }$ . See Appendix for
223
+ 175 more discussion and a (closely related) real world example. In Sec. 4.1, we argue that there often
224
+ 176 exist equivalent PSs under $( G I ^ { \prime } )$ , at least approximately.
225
+
226
+ 77 With (G1’) or (G2), overlapped $\mathbf { x }$ can be relaxed to overlapped P(t)S plus the following.
227
+
228
+ 78 (M2) (Score partition preserving) For any $\pmb { x } , \pmb { x } ^ { \prime } \in \mathcal { X }$ , $\mathbb { P } _ { t } ( { \pmb x } ) = \mathbb { P } _ { t } ( { \pmb x } ^ { \prime } ) \implies h _ { t } ( { \pmb x } ) = h _ { t } ( { \pmb x } ^ { \prime } ) .$
229
+
230
+ Note that (M2) is in fact required for optimal $^ { h }$ , in the sense specified in Proposition 1 and Theorem 1 below. The intuition is that, $\mathbb { P } _ { t }$ maps non-overlapped $_ { \textbf { \em x } }$ to an overlapped value, and $h _ { t }$ preserves this property, through learning. In fact, (M2) is trivially satisfied if $\mathbb { P } _ { t }$ and $h _ { t }$ are linear, and this is still challenging and considered by many works [32, 9], or some with linear outcome models [11, 39].
231
+
232
+ 183 Our first identification, Proposition 2, relies on (G2) and our generative model, without model
233
+ 184 identifiability (so differentiable $\pmb { f } _ { t }$ is not needed). This is a nonparametric3 identification under shape
234
+ 185 restriction [7], because ${ f , h }$ are functional parameters, and injectivity is monotonicity if $j _ { t }$ is on $\mathbb { R }$ .
235
+
236
+ 6 Proposition 2 (Identification with PS). Given $( G 2 )$ and model (3) and (4) under $( M I ) \ i )$ and iii), and (M3) (PS matching) $h _ { 0 } ( \mathbf { x } ) = h _ { 1 } ( \mathbf { x } )$ and $\pmb { k } ( \mathbf { x } ) = \mathbf { 0 }$ . Then, $i f { \mathbb E } _ { p _ { \theta } } ( { \bf y } | { \bf x } , \mathrm { t } ) = { \mathbb E } ( { \bf y } | { \bf x } , \mathrm { t } )$ , we have4
237
+
238
+ 1) (Recovery of $P S$ ) $z _ { \lambda , t } = h _ { t } ( \pmb { x } ) = \pmb { v } ( \mathbb { P } ( \pmb { x } ) )$ on overlapped $_ { \textbf { \em x } }$ , where $v : \mathcal P \to \mathbb { R } ^ { n }$ is an injective function and $\mathcal { P } : = \{ \mathbb { P } ( \pmb { x } ) | o \nu e r l a p p e d \pmb { x } \}$ 2) (Identification) if P in $( G 2 )$ is overlapped, and $( M 2 )$ is satisfied, then $\mu _ { t } ( \pmb { x } ) = \hat { \mu } _ { t } ( \pmb { x } )$ for any $t \in \{ 0 , 1 \} , \pmb { x } \in \mathcal { X }$ , where $\begin{array} { r } { \hat { \mu } _ { t } ( \pmb { x } ) : = \mathbb { E } _ { p _ { \lambda } ( \mathbf { z } | \pmb { x } , t ) } \mathbb { E } _ { p _ { f } } ( \mathbf { y } | \mathbf { z } , t ) = \pmb { f } _ { t } ( \pmb { h } _ { t } ( \pmb { x } ) ) . } \end{array}$ .
239
+
240
+ The essence is, i) the true DGP is identified up to an invertible mapping 92 $\pmb { v }$ , so that $\pmb { f } _ { t } = j _ { t } \circ \pmb { v } ^ { - 1 }$ and 93 $h _ { t } = v \circ \mathbb { P } _ { t }$ , and ii) $\mathbb { P } _ { t }$ is recovered up to $\textbf { { v } }$ and $\mathbf { y } ( t ) \bot \bot \mathbf { x } | \mathbb { P } _ { t }$ is preserved, with same $\textbf { { v } }$ for both $t$ .
241
+
242
+ PS is preferred since it satisfies overlap more easily and (M2) than $\mathrm { P t } \mathbf { S }$ which refers to two functions. However, the existence of low-dimensional PS is uncertain in practice when our knowledge of the DGP is limited. Thus, we need Theorem 1 to work under $\mathrm { P t } \mathbf { S }$ which generally exists.
243
+
244
+ Theorem 1 (Identification with PtS). Given the DGP $( G I ^ { \prime } )$ and model $( 3 ) \& ( 4 )$ under $( M I )$ and (M3’) (Noise matching) $p _ { \epsilon } = p _ { \mathbf { e } }$ and $k ( { \bf x } ) = k k ^ { \prime } ( { \bf x } ) , k 0$ , assume $( D I )$ and
245
+
246
+ (D2) (Spontaneous balance) There exist $2 n + 1$ points $\pmb { x } _ { 0 } , . . . , \pmb { x } _ { 2 n } \in \mathcal { X }$ , $2 n$ -square matrix $C$ and $2 n$ -vector $^ d$ , such that $\pmb { L } _ { 0 } ^ { - 1 } \pmb { L } _ { 1 } = \pmb { C }$ and $\beta _ { 0 } - C ^ { - T } \beta _ { 1 } = d / k$ for optimal $\lambda _ { t }$ (see below), where $\scriptstyle { \mathbf { L } } _ { t }$ is defined in (D1), $\beta _ { t } : = ( \alpha _ { t } ( \pmb { x } _ { 1 } ) - \alpha _ { t } ( \pmb { x } _ { 0 } ) , . . . , \alpha _ { t } ( \pmb { x } _ { 2 n } ) - \alpha _ { t } ( \pmb { x } _ { 0 } ) ) ^ { T }$ , and $\alpha _ { t } ( \mathbf { x } ; \lambda _ { t } )$ is the log-partition function of the prior in (4).
247
+
248
+ Then, if $p _ { \pmb { \theta } } ( \mathbf { y } | \mathbf { x } , \mathbf { t } ) = p ( \mathbf { y } | \mathbf { x } , \mathbf { t } )$ , conclusions $^ { l }$ ) and 2) in Proposition 2 hold with $\mathbb { P }$ replaced with $\mathbb { P } _ { t }$ in $( G I ^ { \prime } )$ , and the domain of $\textbf { { v } }$ becomes $\mathcal { P } : = \mathcal { P } _ { 0 } \cup \mathcal { P } _ { 1 } , \mathcal { P } _ { t } : = \{ \mathbb { P } _ { t } ( \pmb { x } ) | o \nu e r l a p p e d \pmb { x } \}$ .
249
+
250
+ 05 Theorem 1 also achieves the two essential points, but in different and complementary ways. Proposi
251
+ 06 tion 2 starts from the prior by $\mathbb { P } _ { 0 } = \mathbb { P } _ { 1 }$ and setting $\pmb { h } _ { 0 } = \pmb { h } _ { 1 }$ . Conversely, Theorem 1 starts from the
252
+ 07 decoder with $p _ { \epsilon } = p _ { \mathbf { e } }$ and strengthens model identifiability (6) by $\mathbf { ( D 2 ) }$ . (D2) restricts the discrepancy
253
+ 08 between $\lambda _ { 0 } , \lambda _ { 1 }$ on $2 n + 1$ points of $\mathbf { x }$ , thus is relatively easy to satisfy with high-dimensional $\mathbf { x }$ .
254
+
255
+ We see more reasons to prefer PS. In general, to identify the mean function $\mu _ { t } ( \mathbf { x } )$ , a regression is enough, and $p _ { \epsilon } = p _ { \mathbf { e } }$ is unnecessary as in Proposition 2. Also, (D2) is trivial if we have PS and set $\lambda _ { 0 } = \lambda _ { 1 }$ . See Appendix for more on the complementarity between the two identifications.
256
+
257
+ # 4 Estimation by $\beta$ -Intact-VAE
258
+
259
+ # 4.1 Prior as PS, posterior as PtS, and $\beta$ as regularization strength
260
+
261
+ In this subsection, we discuss our focus on balanced PtSs and give an estimation method to realize it.
262
+
263
+ In learning the Intact VAE with data, we assume that there is a PtS and the decomposition of (G1’) holds. Such a decomposition is not unique in general, however. Among possible PtSs, we wish to learn a balanced PtS, which is close to PS. This is based on the observations in Sec. 3.2: we saw that existence of PS is preferable in identifying the true DGP up to equivalent expression. Here, we introduce the notion of balanced PtS in a non-rigorous way: a PtS $\mathbb { P } _ { t }$ is called balanced if the value of some measure for the conditional independence $\mathbb { P } _ { \mathrm { t } } ( \mathbf { x } ) \bot \bot \mathrm { t } | \mathbf { x }$ is small. The idea is common in practice. For example, in a real-world nutrition study, [20] reduces 11 covariates to a 1-dimensional linear PS.
264
+
265
+ 222 Assuming that there is a balanced PtS, we consider two ways for estimating it with Intact VAE. One
266
+ 223 is to exploit a prior that does not depend on t. Namely, we set $\lambda _ { 0 } = \lambda _ { 1 } = : \lambda$ in (4). The other is
267
+ 224 to introduce a hyperparameter $\beta$ in the ELBO as in $\beta$ -VAE [17]. More specifically, with the prior
268
+ 225 $p _ { \lambda } ( \mathbf { z } | \mathbf { x } )$ , we use factorized Gaussian for the decoder and encoder:
269
+
270
+ $$
271
+ p _ { f , g } ( \mathbf { y } | \mathbf { z } , \mathbf { t } ) \sim { \mathcal { N } } ( \mathbf { y } ; f _ { \mathbf { t } } ( \mathbf { z } ) , \mathrm { d i a g } ( g _ { \mathbf { t } } ( \mathbf { z } ) ) ) ; \quad q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { y } , \mathbf { t } ) \sim { \mathcal { N } } ( \mathbf { z } ; r _ { \mathbf { t } } ( \mathbf { x } , \mathbf { y } ) , \mathrm { d i a g } ( s _ { \mathbf { t } } ( \mathbf { x } , \mathbf { y } ) ) ) .
272
+ $$
273
+
274
+ 226 The modified ELBO with $\beta$ , up to additive constant, is derived as
275
+
276
+ $$
277
+ \begin{array} { r } { \mathbb { E } _ { \mathcal { D } } \{ - \beta D _ { \mathrm { K L } } ( q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { y } , \mathbf { t } ) \| p _ { \lambda } ( \mathbf { z } | \mathbf { x } ) ) - \mathbb { E } _ { \mathbf { z } \sim q } [ ( \mathbf { y } - f _ { \mathrm { t } } ( z ) ) ^ { 2 } / 2 g _ { \mathrm { t } } ^ { 2 } ( z ) ] - \mathbb { E } _ { \mathbf { z } \sim q } \log | g _ { \mathrm { t } } ( z ) | \} . } \end{array}
278
+ $$
279
+
280
+ 227 Here, for convenience, we omit the summation (also in $\mathcal { L } _ { f }$ in Sec. 4.2), as if $\mathbf { y }$ was univariate. The
281
+ 228 approximate posterior (or encoder) $q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { y } , \mathbf { t } )$ depends on t, which can realize a $\mathrm { P t } \mathbf { S }$ . With $\beta$ , we
282
+ 229 control the trade-off between the first and second term: the former is the divergence of the posterior
283
+ 230 from the balanced prior, and the latter is the reconstruction of the outcome. By choosing $\beta$ in an
284
+ 231 appropriate way, such as by validation, the ELBO can find a solution that explains the outcome while
285
+ 232 keeping the balancedness of the posterior. Also note that, the parameters $\textbf { { g } }$ and $\boldsymbol { k }$ , which models the
286
+ 233 outcome noise and expresses uncertainty of the prior, respectively, are both learned by the ELBO.
287
+ 234 This deviates from the theoretical conditions in Sec. 3.2, but is more practical and gives better results
288
+ 235 in experiments. See Appendix for much more on ideas and connections behind the ELBO.
289
+
290
+ Once the encoder 236 $q _ { \phi }$ is learned5, the estimate of the expected POs is given by
291
+
292
+ $$
293
+ \begin{array} { r } { \hat { \mu } _ { \hat { t } } ( \pmb { x } ) = \mathbb { E } _ { q ( \mathbf { z } | \mathbf { x } = \pmb { x } ) } { f } _ { \hat { t } } ( \mathbf { z } ) = \mathbb { E } _ { \mathcal { D } | \mathbf { x } \sim p ( \mathbf { y } , \mathbf { t } | \pmb { x } ) } \mathbb { E } _ { \mathbf { z } } { f } _ { \hat { t } } ( \mathbf { z } ) q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { y } , \mathbf { t } ) , \hat { t } \in \{ 0 , 1 \} , } \end{array}
294
+ $$
295
+
296
+ 237 where $q ( \mathbf { z } | \mathbf { x } ) : = \mathbb { E } _ { p ( \mathbf { y } , \mathbf { t } | \mathbf { x } ) } q _ { \phi } ( \mathbf { z } | x , \mathbf { y } , \mathbf { t } )$ is the aggregated posterior and $\mathcal { D } \sim p ( \mathbf { x } , \mathbf { y } , \mathbf { t } )$ . In estimation,
297
+ 238 we consider the case where $_ { \textbf { \em x } }$ is observed in the data, and the sample of $\mathbf { \rho } ( \mathbf { y } , \mathbf { t } )$ are taken from the
298
+ 239 data given ${ \bf x } = { \pmb x }$ (when $_ { \textbf { \em x } }$ is not in the data, we replace $q _ { \phi }$ with $p _ { \mathsf { A } }$ in (9), see Appendix for details
299
+ 240 and results). Note that $\hat { t }$ in (9) indicates counterfactual assignment which may not be the same as
300
+ 241 factual $\mathrm { \Delta t } = t$ in the data. That is, we set $\mathbf { t } = \hat { t }$ in the decoder. The assignment is not applied to the
301
+ 242 encoder, but it is learned from factual $\mathbf { x }$ , y (see also Sec. 4.2, the explanation for $\epsilon _ { C F , t . }$ ). The overall
302
+ 243 algorithm steps are i) we train VAE by (8), ii) infer CATE $\hat { \tau } ( \pmb { x } ) = \hat { \mu } _ { 1 } ( \pmb { x } ) - \hat { \mu } _ { 0 } ( \pmb { x } )$ by (9).
303
+
304
+ # 4.2 Conditional balanced representation learning
305
+
306
+ We formally justify our ELBO (8) from the viewpoint of BRL. Usually, particularly in ATE estimation, balance means covariate balance, i.e., x |= t [44]. Influenced by this, most BRL methods learn balanced covariate representation $\mathbf { z }$ such that $\mathbf { z }$ |= t [40, 31] and usually $\mathbf { z }$ is a function of $\mathbf { x }$ . From Sec. 4.1, we understand that larger $\beta$ in ELBO (8) encourages $\mathbf { z } \bot \bot \mathbf { t } | \mathbf { x }$ which is given by the prior, corresponding to $\mathbb { P } _ { \mathrm { t } } ( \mathbf { x } ) \bot \bot \mathrm { t } | \mathbf { x }$ for a balanced $\mathrm { P t } \mathbf { S }$ . Here, we show that, this conditional balance of representation $\mathbf { z }$ is natural for CATE estimation, and CATE error due to bad recovery of $j _ { t }$ in (G1’) is controlled by ELBO (8). In Appendix, we detail novel implications of our bounds, compared to those in [40, 31].
307
+
308
+ 252 Using (9) to estimate CATE, ${ \hat { \tau } } _ { f } ( z ) = f _ { 1 } ( z ) - f _ { 0 } ( z )$ is marginalized on $q ( \mathbf { z } | \mathbf { x } )$ . The bounds below
309
+ 253 motivate both prior and posterior balancing. Let us first consider errors defined by the aggregated
310
+ 254 prior $p ( \mathbf { z } | \mathbf { x } ) : = \sum _ { t } p ( t | \mathbf { \bar { x } } ) p _ { t } ( \mathbf { z } | \mathbf { x } )$ (denote ${ \bf \bar { \it p } } _ { t } ( { \bf z } | { \bf x } ) : = { \cal p } _ { \lambda } ( { \bf z } | { \bf x } , { \bf t } = t ) )$ , and $q ( \mathbf { z } | \mathbf { x } )$ afterwards. We
311
+ 255 introduce the objective we bound. The true $C A T E$ , given covariate ${ \bf x } = { \pmb x }$ or score $_ z$ , is
312
+
313
+ $$
314
+ \tau ( \pmb { x } ) = m _ { 1 } ( \mathbb { P } _ { 1 } ( \pmb { x } ) ) - m _ { 0 } ( \mathbb { P } _ { 0 } ( \pmb { x } ) ) ; \quad \tau _ { m } ( z ) = m _ { 1 } ( z ) - m _ { 0 } ( z )
315
+ $$
316
+
317
+ 56 where $m _ { t } ( z ) : = \mathbb { E } ( \mathbf { y } ( t ) | \mathbb { P } _ { t } = z )$ and $\mathbb { P } _ { t }$ is a balanced PtS in (G1’). Accordingly, given $_ { \textbf { \em x } }$ , the error
318
+ 57 of prior CATE, with or without knowing $\mathbb { P } _ { t }$ , is naturally defined as
319
+
320
+ $$
321
+ \epsilon _ { f } ^ { \ast , p } ( \pmb { x } ) : = \mathbb { E } _ { p ( \mathbf { z } | \pmb { x } ) } ( \hat { \tau } _ { f } ( \mathbf { z } ) - \tau ( \pmb { x } ) ) ^ { 2 } ; \quad \epsilon _ { f } ^ { p } ( \pmb { x } ) : = \mathbb { E } _ { p ( \mathbf { z } | \pmb { x } ) } ( \hat { \tau } _ { f } ( \mathbf { z } ) - \tau _ { m } ( \mathbf { z } ) ) ^ { 2 } .
322
+ $$
323
+
324
+ 258 We bound $\epsilon _ { f } ^ { p }$ instead of $\epsilon _ { f } ^ { * , p }$ because the error between $\tau ( \mathbf { x } )$ and $\tau _ { m } ( \mathbf { z } )$ is small if balanced $\mathbb { P } _ { t }$ is
325
+ 259 recovered (then $z \approx \mathbb { P } _ { 0 } ( \pmb { x } ) \approx \mathbb { P } _ { 1 } ( \pmb { x } )$ in (10), see Appendix for details). Instead, we consider the error
326
+ 260 between $\hat { \tau } _ { f }$ and $\tau _ { m }$ below. We define the risks of outcome regression, into which $\epsilon ^ { p }$ is decomposed.
327
+
328
+ 261 Definition 3 (PO Risks). The expected loss of $P O$ at $( z , t )$ , factual risk, and counterfactual $r i s k$ are
329
+
330
+ $$
331
+ \begin{array} { r l } & { \mathcal { L } _ { f } ( z , t ) : = g _ { t } ^ { - 2 } \mathbb { E } _ { p ( \mathbf { y } ( t ) \mid \mathbb { P } _ { t } = z ) } ( \mathbf { y } ( t ) - f _ { t } ( z ) ) ^ { 2 } = g _ { t } ( z ) ^ { - 2 } \int ( y - f _ { t } ( z ) ) ^ { 2 } p ( \mathbf { y } ( t ) = y | \mathbb { P } _ { t } = z ) d y ; } \\ & { \quad \epsilon _ { P , t } ^ { p } ( x ) : = \mathbb { E } _ { p _ { t } ( z \mid x ) } \mathcal { L } _ { f } ( \mathbf { z } , t ) ; \quad \epsilon _ { C F , t } ^ { p } ( x ) : = \mathbb { E } _ { p _ { 1 - t } ( \mathbf { z } \mid x ) } \mathcal { L } _ { f } ( \mathbf { z } , t ) = \int \mathcal { L } _ { f } ( z , t ) p _ { 1 - t } ( z \mid x ) d z . } \end{array}
332
+ $$
333
+
334
+ 5As usual, we expect variational inference and optimization procedure are (near) optimal, i.e., Consistency of VAE (see Appendix for formal statement). Consistent estimation using the prior is a direct corollary of consistent VAE. Under Gaussian models, it is possible to prove consistency of posterior estimation, as shown in [4].
335
+
336
+ With $\mathbf { y } ( t )$ involved, $\mathcal { L } _ { f }$ is a PO error of $f$ weighted by $\textbf { { g } }$ . Factual and counterfactual counterparts are defined accordingly, w.r.t factual $p _ { t }$ learned from data. Note, in $\epsilon _ { F , t }$ , unit $\pmb { u } = ( \pmb { x } , \pmb { y } , t )$ involves in the learning of $p _ { t } ( \mathbf { z } | \mathbf { \boldsymbol { x } } )$ (and $q _ { t } ( \mathbf { z } | \mathbf { x } )$ afterwards), and also in $\begin{array} { r } { \mathcal { L } _ { f } ( z , t ) } \end{array}$ since $\mathbf { y } ( t ) = \mathbf { \boldsymbol { y } }$ for the unit. In $\epsilon _ { C F , t }$ , however, $\mathbf { y } ( t ) \neq \mathbf { y } ^ { \prime } = \mathbf { y } ( 1 - t )$ for $\pmb { u } ^ { \prime } = ( \pmb { x } , \pmb { y } ^ { \prime } , 1 - t )$ (particularly relevant for the posterior).
337
+
338
+ Thus, the regression error (second) term in ELBO (8) controls 66 $\epsilon _ { F , t } ^ { p }$ via factual data. On the other hand, 67 $\epsilon _ { C F , t } ^ { p }$ is not estimable due to unobservable $\mathbf { y } ( 1 - \operatorname { t } )$ , but is bounded as below.
339
+
340
+ 68 Lemma 2 (Counterfactual risk bound). Assume $| { \mathcal { L } } _ { f } ( z , t ) | \leq M$ , we have
341
+
342
+ $$
343
+ \begin{array} { r l } { \epsilon _ { C F } ^ { p } ( \pmb { x } ) \le \sum _ { t } p ( 1 - t | \pmb { x } ) \epsilon _ { F , t } ^ { p } ( \pmb { x } ) + M \mathbb { D } ^ { p } ( \pmb { x } ) } & { { } } \\ { \epsilon _ { C F } ^ { p } ( \pmb { x } ) : = \sum _ { t } p ( 1 - t | \pmb { x } ) \epsilon _ { C F , t } ^ { p } ( \pmb { x } ) , a n d \mathbb { D } ^ { p } ( \pmb { x } ) : = \sum _ { t } \sqrt { D _ { \mathrm { K L } } ( p _ { t } \| p _ { 1 - t } ) / 2 } . } & { { } } \end{array}
344
+ $$
345
+
346
+ $\epsilon _ { C F } ^ { p } ( { \pmb x } )$ is bounded by $\epsilon _ { F , t } ^ { p }$ plus $M \mathbb { D } ^ { p } ( { \pmb x } )$ , which measures the imbalance between $p _ { t } ( \mathbf { z } | \mathbf { \boldsymbol { x } } )$ and is symmetric for $t$ . We can implicitly control $\epsilon _ { C F } ^ { p }$ by making $\mathbb { D } ^ { p }$ small. Again, this means PS is preferred as a conditional balanced representation, and justifies our balanced prior $p _ { \lambda } ( \mathbf { z } | \mathbf { x } )$ . Moreover, the results (including Theorem 2 below) also hold for posterior estimation, that is, replace $p _ { t } ( \mathbf { z } | \mathbf { x } )$ with $q _ { t } ( \mathbf { z } | \mathbf { x } ) : = q ( \mathbf { z } | \mathbf { x } , { \mathbf { t } } = t ) = \mathbb { E } _ { p ( \mathbf { y } | \mathbf { x } , t ) } q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { y } , t )$ , the results and proofs hold as it was. This implies that the imbalance between $q _ { t }$ should also be controlled. Correspondingly, the symmetric $K L$ term in ELBO (8) balances $q _ { t } ( { \bf z } | { \bf x } )$ by encouraging $\mathbf { z } \bot \bot \mathbf { t } | \mathbf { x }$ for the posterior.
347
+
348
+ Theorem 2 in turn bounds $\epsilon _ { f } ^ { p }$ , by decomposing it to $\epsilon _ { F , t } ^ { p } , \epsilon _ { C F , t } ^ { p }$ , and $\mathbb { V } _ { \mathbf { y } } ^ { p }$
349
+
350
+ Theorem 2 (Generalization bound). Assume $| { \mathcal { L } } _ { f } ( z , t ) | \leq M$ and $| g _ { t } ( z ) | \leq G$ , then,
351
+
352
+ $$
353
+ \epsilon _ { f } ( \pmb { x } ) \leq 2 ( G ^ { 2 } ( \epsilon _ { F , 0 } ( \pmb { x } ) + \epsilon _ { F , 1 } ( \pmb { x } ) ) + M \mathbb { D } ( \pmb { x } ) - \mathbb { V } _ { \mathbf { y } } ( \pmb { x } ) | p
354
+ $$
355
+
356
+ where $\begin{array} { r } { \mathbb { V } _ { \mathbf { y } } ^ { p } ( \pmb { x } ) : = \mathbb { E } _ { p ( \mathbf { z } | \pmb { x } ) } \sum _ { t } \mathbb { E } _ { p ( \mathbf { y } ( t ) | \mathbb { P } _ { t } = \mathbf { z } ) } ( \mathbf { y } ( t ) - m _ { t } ( \mathbf { z } ) ) ^ { 2 } } \end{array}$ , and “ $\big | ^ { p }$ ” collects all superscripts
357
+
358
+ The new term $\mathbb { V } _ { \mathbf { y } } ^ { p } ( \pmb { x } )$ reflects the intrinsic variance in the DGP and can not be controlled, and it is negative because $\epsilon _ { f } ^ { p }$ is defined by mean functions $\pmb { f } _ { t }$ and $m _ { t }$ , not $\mathbf { y } ( t )$ . The other two terms, as we indicated, is estimated by our ELBO.
359
+
360
+ Estimating $G , M$ is nontrivial. Instead, similarly to [40], we rely on $\beta$ in the ELBO to weight the two terms in (13). We do not need two hyperparameters since $G$ is implicitly controlled by the third term in ELBO (8), which is a norm constraint. As in matching methods, $\beta$ is a trade-off between conditional balance of learned PtS (affected by $\mathbf { \widehat { f } } _ { t }$ ) and precision / effective sample size of outcome regression, and can be seen as the probabilistic counterpart of [47, 25].
361
+
362
+ Finally, we note the bounds do not directly address non-overlap; in Lemma 2, when $\epsilon _ { F , 1 - t } ^ { p }$ in the r.h.s is unbounded since $p _ { 1 - t } ( \mathbf { z } | \mathbf { \boldsymbol { x } } )$ can not be learned from data. However, as we argued $p ( 1 - t | { \pmb x } ) = 0$ , in Sec. 3.2, with more balanced $\mathbb { P } _ { t }$ recovered as representation, overlap is more easily satisfied.
363
+
364
+ # 5 Related work
365
+
366
+ Weak overlap. Under (respective versions of) weak overlap, [32] estimates ATE by reducing covariates to a linear PGS, [11] estimates homogeneous (constant) TE under partial linear outcome model, and [9] studies identification of ATE by a general class of scores, given (linear) PPS and PGS. In machine learning, current focus is on finding overlap regions [33, 8], or indicating possible failure under weak overlap [22], but not remedies. An exception is [24] which provides bounds without overlap. [40, 31] are in line of [24] and have similar bounds to ours, without relating to overlap. Our method is the first in machine learning that gives identification without overlap.
367
+
368
+ Prognostic scores are recently combined with machine learning, mainly in biostatistics. For example, [39] trains a flexible PGS and fits a linear regression on the PGS among others, for constant TEs, and [12] models PGS in its Bayesian regression tree for CATE. More related, [20] estimates CATE by reducing covariates to a linear score that is a joint PPS and PGS, and [47] uses SVM to minimize the worst-case bias due to PGS imbalance. However, in machine learning, few methods consider PGSs; [55, 15] learn outcome predictors, without connection to PGS, while [24] conceptually, but not formally, connects BRL to PGS. Our work follows the recent boom in biostatistics and is the first to formally connect generative learning, PGS, and BRL (see below on BRL) for TE estimation.
369
+
370
+ Identifiable representation. Recently, independent component analysis (ICA) and representation 308 learning, both ill-posed inverse problems, meet together to give nonlinear ICA and identifiable representation, e.g., using VAEs [26], and energy models [27]. The results are exploited in causal discovery [51] and out-of-distribution generalization [46]. This work is the first to explore identifiable representations in TE identification.
371
+
372
+ BRL and related methods amount to a major direction. Early BRL methods are BLR/BNN [23] and TARnet/CFR [40]. Adding to this, [53] also exploits the local similarity of between data points. [41] uses similar architecture to TARnet, considering the importance of treatment probability. There are also methods using GAN [54, GANITE] and Gaussian process [1]. Our method shares the idea of BRL, and further extends to conditional balancing more suitable for CATE.
373
+
374
+ Our work hopefully lays conceptual and theoretical foundations of VAE methods for TEs (e.g., [30, 31]), under unconfoundedness. Also, monotonicity, which is injectivity on $\mathbb { R }$ , is important in causal inference, and some works consider it together with overlap [24, 56]. See Appendix for details.
375
+
376
+ # 6 Experiments
377
+
378
+ We compare the proposed method with existing methods on three types of datasets. Here we present two experiments, and the rest one, on the Pokec social network dataset, can be found in Appendix. As in previous works [40, 30], we report the absolute error of ATE $\epsilon _ { A T E } : = | \mathbb { E } _ { \mathcal { D } } ( y ( 1 ) - y ( 0 ) ) ^ { \circ } - \mathbb { E } _ { \mathcal { D } } \hat { \tau } ( \pmb { x } ) |$ , and, as a surrogate of CATE, the empirical PEHE [18] $\epsilon _ { P E H E } : = \mathbb { E } _ { \mathcal { D } } ( ( y ( 1 ) - y ( 0 ) ) - \hat { \tau } ( \pmb { x } ) ) ^ { 2 }$ .
379
+
380
+ Unless otherwise indicated, for each function $f , h , k , r , s$ in (4)(7), we use a multilayer perceptron (MLP) that has $3 ^ { * } 2 0 0$ hidden units with ReLU activation, and $\lambda = ( h , k )$ depends only on $\mathbf { x }$ . We fix $\pmb { g } ( \mathbf { x } ) = 1$ because the datasets have fixed noise scale, and results with learned $\textbf { { g } }$ on synthetic dataset with dependent noise is in Appendix. The Adam optimizer with initial learning rate $\mathrm { \dot { 1 } 0 ^ { - 4 } }$ and batch size 100 is employed. All experiments use early-stopping of training by evaluating the ELBO on a validation set, and results are reported on a testing set. Each set of running on synthetic dataset (a line in the figure) is within 1 hour on an 8-CPU machine, and it is within a day for IHDP. More details on hyper-parameters and settings are given in each experiment and Appendix.
381
+
382
+ # 6.1 Synthetic dataset
383
+
384
+ We generate synthetic datasets following (14). Both $\mathbf { x }$ , w are factorized Gaussians. $\mu , \sigma$ are randomly sampled. The functions $\mathbf { \omega } _ { h , k , l }$ are linear. Outcome models $f _ { 0 } , f _ { 1 }$ are built by NNs with invertible activations. y is univariate, $\mathrm { d i m } ( \mathbf { x } ) = 3 0$ , and $\dim ( \mathbf { w } )$ ranges from 1 to 5. w is a PS, but is not low-dimensional when $\dim ( \mathbf { w } ) > 1$ . We control overlap by $\omega$ which multiplies the logit value, and have 5 different overlap levels from strong overlap to very weak overlap. See Appendix for details.
385
+
386
+ $$
387
+ \mathbf { x } \sim { \mathcal { N } } ( \mu , \sigma ) ; \mathbf { w } | \mathbf { x } \sim { \mathcal { N } } ( h ( \mathbf { x } ) , k ( \mathbf { x } ) ) ; { \mathfrak { t } } | \mathbf { x } \sim { \mathrm { B e r n } } ( { \mathrm { L o g i } } ( \omega l ( \mathbf { x } ) ) ) ; { \mathfrak { y } } | \mathbf { w } , { \mathfrak { t } } \sim { \mathcal { N } } ( f _ { \mathfrak { t } } ( \mathbf { w } ) , 1 ) .
388
+ $$
389
+
390
+ 339 With the same $( \mathrm { d i m } ( { \bf w } ) , \omega )$ , we evaluate our method and
391
+ 340 CFR on 10 random DGPs, with different sets of functions
392
+ 341 $f , h , k , l$ in (14). For each DGP, we sample 1500 data
393
+ 342 points, and split them into 3 equal sets for training, val
394
+ 343 idation, and testing. We show our results for different
395
+ 344 hyperparameter $\beta$ . For CFR, we try different balancing
396
+ 345 parameters and present the best results (see Appendix for
397
+ 346 details). We report $\epsilon _ { P E H E }$ , see Appendix for ATE results.
398
+
399
+ ![](images/0f1955cbef97b50535d26f99bd069aaaa1937913470bd577180a75683e89f89b.jpg)
400
+ Figure 2: $\sqrt { \epsilon _ { P E H E } }$ on synthetic dataset. Error bar on 10 random DGPs.
401
+
402
+ In each panel of Figure 2, we adjust one of $\omega , \dim ( \mathbf { w } )$ respectively, with the other fixed to the lowest. In the left panel, both our method and CFR are quite robust to overlap level, supporting respective theories ([24] gives bounds for CFR under weak overlap). Too large $\beta$ seems to worsen the results, possibly because we already have an apparent PS (w with $\dim ( \mathbf { w } ) = 1$ ) and large $\beta$
403
+
404
+ incurs sub-optimal ELBO with no gain.
405
+
406
+ 354 In the right panel, when $\dim ( \mathbf { w } ) > 1$ , $f _ { t }$ in (14) is non-injecitve and learning of PtS is necessary.
407
+ 355 Thus, larger $\beta$ has a negative effect, and particularly, $\beta = 1$ is significantly better than $\beta = 3$ . The
408
+ 356 drop of error for $\mathrm { d i m } ( \mathbf { w } ) > 3$ is due to the randomness of $f$ in (14). In Sec. 2.2, we saw that the
409
+ 357 2-dimsensional PS $\mathbb { P } : = \left( \mu _ { 0 } ( \mathbf { x } ) , \mu _ { 1 } ( \mathbf { x } ) \right)$ always exists under ANMs. Thus, when $\mathrm { d i m } ( \mathbf { w } ) > 2$ , our
410
+ 358 method tries to recover that $\mathbb { P }$ , and generally performs not worse than under $\mathrm { d i m } ( \mathbf { w } ) = 2$ , but still
411
+ 359 not better than under $\dim ( \mathbf { w } ) = 1$ .
412
+ 360 Our method is much robuster against different DGPs than
413
+ 361 CFR (see error bars), though it is worse than CFR when
414
+ 362 $\mathrm { d i m } ( \mathbf { w } ) \mathrm { ~ > ~ } 1$ . This is unsurprising because our model
415
+ 363 has $I$ -dimensional $\mathbf { z }$ , while CFR uses 200-dimensional
416
+ 364 representation. Thus, the results already show the power of
417
+ 365 identification and recovery of scores (see Figure 3 also). In
418
+ 366 fact, we observed that our method outperforms or matches
419
+ 367 CFR with higher-dimensional $\mathbf { z }$ (see Appendix). Thus, we
420
+
421
+ ![](images/01799725a49fbf1e71385cad12fe04f608c719f72b601c254b1b955aaa56af5d.jpg)
422
+ Figure 3: Plots of recovered - true latent. Blue: $t = 0$ , Orange: $t = 1$ .
423
+
424
+ believe the performance gap with $\dim ( \mathbf { z } ) = 1$ is due to the capacity of NNs in Intact-VAE.
425
+
426
+ 369 When $\dim ( \mathbf { w } ) = 1$ , there are no better PSs than w, because $f _ { t }$ is invertible and no information
427
+ 370 can be dropped from w. Thus, as shown in Figure 3, our method learns $\mathbf { z }$ as an approximate affine
428
+ 371 transformation of the true w, showing identification. For comparison, we run [30, CEVAE] which
429
+ 372 is also based on VAE but without identification, and it shows much lower quality of recovery. As
430
+ 373 expected, both recovery and estimation are better with balanced prior $p _ { \lambda } ( \mathbf { z } | \mathbf { x } )$ , and we can see an
431
+ 374 example of bad recovery using $p _ { \lambda } ( \mathbf { z } | \mathbf { x } , \mathbf { t } )$ in Appendix. More latent plots can also be found there.
432
+
433
+ # 6.2 IHDP benchmark dataset
434
+
435
+ This experiment shows our conditional balancing matches state-of-the-art BRL methods, and does not overfit to PEHE. The IHDP dataset [18] is widely used to evaluate machine learning based methods, e.g. [40, 41]. It is also used in [24] which considers weak overlap, because the covariates are weakly overlapped due to their correlation to the artificial treatment assignment. Finally, there is a linear PS (linear combination of the covariates). See Appendix for details.
436
+
437
+ Note, most of covariates are binary, so the support of the PS is often on small and separated intervals and is possibly discrete. Thus, Gaussian latent $\mathbf { z }$ is misspecified. We use multivariate $\mathbf { z }$ in model to address this, similarly to [30]. We set $\beta = 1$ since it works well on synthetic dataset with weak overlap. To see our balancing property clearly, we modify our method and add two components for unconditional balancing from [40] (see Appendix), and compare this modified version to the original.
438
+
439
+ Table 1: Errors on IHDP over 1000 random DGPs. We report results with $\mathrm { d i m } ( \mathbf { z } ) = 1 0$ . Bold indicates method(s) that are significantly better. The results are taken from [40], except GANITE [54] and CEVAE [30].
440
+
441
+ <table><tr><td>Method</td><td>TMLE</td><td>BNN</td><td>CFR CF</td><td>CEVAE</td><td></td><td>GANITE Ours</td><td></td><td>Ours Mod.</td></tr><tr><td>EATE</td><td>.30±.01</td><td>1.37±.03.</td><td>.25±.01·</td><td>1.18±.01.34±.01</td><td></td><td>.43±.05</td><td>.178±.006</td><td>.167±.005</td></tr><tr><td>VEPEHE</td><td>5.0±.2</td><td>2.2±.1</td><td>.71±.02 3.8±.2 2.7±.1</td><td></td><td></td><td>1.9±.4</td><td>.859±.033</td><td>.777±.026</td></tr></table>
442
+
443
+ 386 As shown in Table 1, Intact-VAE outperforms or matches the state-of-the-art methods. Particularly,
444
+ 387 our method has the best ATE estimation, and is slightly worse than CFR for PEHE. This is possibly
445
+ 388 due to the fitting capacity (recall Sec. 6.1), and also we do not tune $\beta$ . Notably, our method
446
+ 389 outperforms other generative models (CEVAE and GANITE) by large margins. The modified
447
+ 390 version is slightly improved, but we should note that the improvement for $\epsilon _ { A T E }$ is barely significant.
448
+ 391 This indicates overfitting to PEHE. In fact, PEHE estimates the marginalized error $\mathbb { E } \boldsymbol { \epsilon } ( \mathbf { x } )$ where
449
+ 392 $\epsilon ( { \bf x } ) = ( \tau ( { \bf x } ) - \hat { \tau } ( { \bf x } ) ) ^ { 2 }$ , and, compared with $\epsilon _ { A T E }$ , it focuses on values $_ { \textbf { \em x } }$ with high probability and
450
+ 393 / or large $\epsilon ( { \pmb x } )$ . The balancing in [40] is based on bounding $\mathbb { E } \boldsymbol { \epsilon } ( \mathbf { x } )$ , and thus tends to overly focus on
451
+ 394 the above values of $\mathbf { x }$ , resulting in sub-optimal estimation of CATE and even of ATE. This tendency
452
+ 395 is more apparent with sub-optimal hyperparameter for the unconditional balancing (see Appendix).
453
+
454
+ # 396 7 Conclusion
455
+
456
+ In this work, we proposed a method for CATE estimation, under weak overlap. Our method exploits identifiable VAE, a recent advance in generative models, and is fully motivated and theoretically justified by causal considerations: identification, PGS, and balancing. We show that VAEs are suitable for principled causal inference thanks to its probabilistic nature, if not compromised by ad hoc heuristics. We believe it is possible to extend the bounds in Sec. 4.2 to weak overlap, just as [24] extends [40] to weak overlap, and leave this for future. Experiments show evidence that the injectivity of $f$ in our model is possibly unnecessary because $\mathrm { d i \bar { m } ( z ) } > \mathrm { d i m ( \mathbf { y } ) }$ often gives better results. Theoretical study of this is an interesting future direction. To avoid potential negative societal impact (e.g, bad prescriptions), practitioners should judge the conditions of the proposed method by their domain expertise, and careful trials are always recommended.
457
+
458
+ References
459
+ [1] Ahmed M Alaa and Mihaela van der Schaar. Bayesian inference of individualized treatment effects using multi-task gaussian processes. In Advances in Neural Information Processing Systems, pages 3424–3432, 2017.
460
+ [2] Joseph Antonelli, Matthew Cefalu, Nathan Palmer, and Denis Agniel. Doubly robust matching estimators for high dimensional confounding adjustment. Biometrics, 74(4):1171–1179, 2018.
461
+ [3] Timothy B. Armstrong and Michal Kolesár. Finite-sample optimal estimation and inference on average treatment effects under unconfoundedness. arXiv preprint arXiv:1712.04594v5, 2021.
462
+ [4] Stéphane Bonhomme and Martin Weidner. Posterior average effects. arXiv preprint arXiv:1906.06360v5, 2021.
463
+ [5] M Alan Brookhart, Sebastian Schneeweiss, Kenneth J Rothman, Robert J Glynn, Jerry Avorn, and Til Stürmer. Variable selection for propensity score models. American journal of epidemiology, 163(12):1149–1156, 2006. [6] Alberto Caron, Ioanna Manolopoulou, and Gianluca Baio. Estimating individual treatment effects using non-parametric regression models: a review. arXiv preprint arXiv:2009.06472, 2020.
464
+ [7] Denis Chetverikov, Andres Santos, and Azeem M Shaikh. The econometrics of shape restrictions. Annual Review of Economics, 10:31–63, 2018.
465
+ [8] Wangzhi Dai and Collin M Stultz. Quantifying common support between multiple treatment groups using a contrastive-vae. In Machine Learning for Health, pages 41–52. PMLR, 2020. [9] Alexander D’Amour and Alexander Franks. Deconfounding scores: Feature representations for causal effect estimation with weak overlap. arXiv preprint arXiv:2104.05762, 2021.
466
+ [10] Alexander D’Amour, Peng Ding, Avi Feller, Lihua Lei, and Jasjeet Sekhon. Overlap in observational studies with high-dimensional covariates. Journal of Econometrics, 2020.
467
+ [11] Max H Farrell. Robust inference on average treatment effects with possibly more covariates than observations. Journal of Econometrics, 189(1):1–23, 2015.
468
+ [12] P Richard Hahn, Jared S Murray, Carlos M Carvalho, et al. Bayesian regression tree models for causal inference: Regularization, confounding, and heterogeneous effects (with discussion). Bayesian Analysis, 15(3):965–1056, 2020.
469
+ [13] David Hajage, Yann De Rycke, Guillaume Chauvet, and Florence Tubach. Estimation of conditional and marginal odds ratios using the prognostic score. Statistics in medicine, 36(4):687– 716, 2017.
470
+ [14] Ben B Hansen. The prognostic analogue of the propensity score. Biometrika, 95(2):481–488, 2008.
471
+ [15] Negar Hassanpour and Russell Greiner. Learning disentangled representations for counterfactual regression. In International Conference on Learning Representations, 2019.
472
+ [16] Miguel A. Hernan and James M. Robins. Causal Inference: What If. CRC Press, 1st edition, 2020.
473
+ [17] Irina Higgins, Loïc Matthey, Arka Pal, Christopher Burgess, Xavier Glorot, Matthew Botvinick, Shakir Mohamed, and Alexander Lerchner. beta-vae: Learning basic visual concepts with a constrained variational framework. In 5th International Conference on Learning Representations, 2017.
474
+ [18] Jennifer L Hill. Bayesian nonparametric modeling for causal inference. Journal of Computational and Graphical Statistics, 20(1):217–240, 2011.
475
+ [19] Han Hong, Michael P Leung, and Jessie Li. Inference on finite-population treatment effects under limited overlap. The Econometrics Journal, 23(1):32–47, 2020.
476
+ [20] Ming-Yueh Huang and Kwun Chuen Gary Chan. Joint sufficient dimension reduction and estimation of conditional and average treatment effects. Biometrika, 104(3):583–596, 2017.
477
+ [21] Guido W Imbens and Donald B Rubin. Causal inference in statistics, social, and biomedical sciences. Cambridge University Press, 2015.
478
+ [22] Andrew Jesson, Sören Mindermann, Uri Shalit, and Yarin Gal. Identifying causal-effect inference failure with uncertainty-aware models. Advances in Neural Information Processing Systems, 33, 2020.
479
+ [23] Fredrik Johansson, Uri Shalit, and David Sontag. Learning representations for counterfactual inference. In International conference on machine learning, pages 3020–3029, 2016.
480
+ [24] Fredrik D Johansson, Uri Shalit, Nathan Kallus, and David Sontag. Generalization bounds and representation learning for estimation of potential outcomes and causal effects. arXiv preprint arXiv:2001.07426, 2020.
481
+ [25] Nathan Kallus, Brenton Pennicooke, and Michele Santacatterina. More robust estimation of sample average treatment effects using kernel optimal matching in an observational study of spine surgical interventions. arXiv preprint arXiv:1811.04274, 2018.
482
+ [26] Ilyes Khemakhem, Diederik Kingma, Ricardo Monti, and Aapo Hyvarinen. Variational autoencoders and nonlinear ica: A unifying framework. In International Conference on Artificial Intelligence and Statistics, pages 2207–2217, 2020.
483
+ [27] Ilyes Khemakhem, Ricardo Monti, Diederik Kingma, and Aapo Hyvarinen. Ice-beem: Identifiable conditional energy-based deep models based on nonlinear ica. Advances in Neural Information Processing Systems, 33, 2020.
484
+ [28] 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, pages 3581–3589, 2014.
485
+ [29] Arthur Lewbel. The identification zoo: Meanings of identification in econometrics. Journal of Economic Literature, 57(4):835–903, 2019.
486
+ [30] Christos Louizos, Uri Shalit, Joris M Mooij, David Sontag, Richard Zemel, and Max Welling. Causal effect inference with deep latent-variable models. In Advances in Neural Information Processing Systems, pages 6446–6456, 2017.
487
+ [31] Danni Lu, Chenyang Tao, Junya Chen, Fan Li, Feng Guo, and Lawrence Carin. Reconsidering generative objectives for counterfactual reasoning. Advances in Neural Information Processing Systems, 33, 2020.
488
+ [32] Wei Luo, Yeying Zhu, and Debashis Ghosh. On estimating regression-based causal effects using sufficient dimension reduction. Biometrika, 104(1):51–65, 2017.
489
+ [33] Michael Oberst, Fredrik Johansson, Dennis Wei, Tian Gao, Gabriel Brat, David Sontag, and Kush Varshney. Characterization of overlap in observational studies. In International Conference on Artificial Intelligence and Statistics, pages 788–798. PMLR, 2020.
490
+ [34] Judea Pearl. Causality: models, reasoning and inference. Cambridge University Press, 2009.
491
+ [35] Paul R Rosenbaum. Modern algorithms for matching in observational studies. Annual Review of Statistics and Its Application, 7:143–176, 2020.
492
+ [36] Paul R Rosenbaum and Donald B Rubin. The central role of the propensity score in observational studies for causal effects. Biometrika, 70(1):41–55, 1983.
493
+ [37] Donald B Rubin. Estimating causal effects from large data sets using propensity scores. Annals of internal medicine, 127(8_Part_2):757–763, 1997.
494
+ [38] Donald B Rubin. Causal inference using potential outcomes: Design, modeling, decisions. Journal of the American Statistical Association, 100(469):322–331, 2005. [39] Alejandro Schuler, David Walsh, Diana Hall, Jon Walsh, and Charles Fisher. Increasing the efficiency of randomized trial estimates via linear adjustment for a prognostic score. arXiv preprint arXiv:2012.09935, 2020.
495
+ 502 [40] Uri Shalit, Fredrik D Johansson, and David Sontag. Estimating individual treatment effect: generalization bounds and algorithms. In International Conference on Machine Learning, pages 3076–3085. PMLR, 2017.
496
+ 05 [41] Claudia Shi, David Blei, and Victor Veitch. Adapting neural networks for the estimation of treatment effects. In Advances in Neural Information Processing Systems, pages 2507–2517, 2019.
497
+ 508 [42] Kihyuk Sohn, Honglak Lee, and Xinchen Yan. Learning structured output representation using deep conditional generative models. In Advances in neural information processing systems, pages 3483–3491, 2015. [43] Peter Sorrenson, Carsten Rother, and Ullrich Köthe. Disentanglement by nonlinear ica with general incompressible-flow networks (gin). In International Conference on Learning Representations, 2019.
498
+ 514 [44] Elizabeth A. Stuart. Matching Methods for Causal Inference: A Review and a Look Forward. Statistical Science, 25(1):1 – 21, 2010.
499
+ 516 [45] Elizabeth A Stuart, Brian K Lee, and Finbarr P Leacy. Prognostic score–based balance measures can be a useful diagnostic for propensity score methods in comparative effectiveness research. Journal of clinical epidemiology, 66(8):S84–S90, 2013.
500
+ 519 [46] Xinwei Sun, Botong Wu, Chang Liu, Xiangyu Zheng, Wei Chen, Tao Qin, and Tie-yan Liu. Latent causal invariant model. arXiv preprint arXiv:2011.02203, 2020. [47] Alexander Tarr and Kosuke Imai. Estimating average treatment effects with support vector machines. arXiv preprint arXiv:2102.11926, 2021. [48] Mark J Van der Laan and Sherri Rose. Targeted learning: causal inference for observational and experimental data. Springer Science & Business Media, 2011. [49] Stefan Wager and Susan Athey. Estimation and inference of heterogeneous treatment effects using random forests. Journal of the American Statistical Association, 113(523):1228–1242, 2018. [50] Halbert White and Karim Chalak. Identification and identification failure for treatment effects using structural systems. Econometric Reviews, 32(3):273–317, 2013.
501
+ 530 [51] Pengzhou Wu and Kenji Fukumizu. Causal mosaic: Cause-effect inference via nonlinear ica and ensemble method. In International Conference on Artificial Intelligence and Statistics, pages 1157–1167. PMLR, 2020. [52] S Yang and P Ding. Asymptotic inference of causal effects with observational studies trimmed by the estimated propensity scores. Biometrika, 105(2):487–493, 03 2018.
502
+ 535 [53] Liuyi Yao, Sheng Li, Yaliang Li, Mengdi Huai, Jing Gao, and Aidong Zhang. Representation learning for treatment effect estimation from observational data. In Advances in Neural Information Processing Systems, pages 2633–2643, 2018.
503
+ 538 [54] Jinsung Yoon, James Jordon, and Mihaela van der Schaar. GANITE: Estimation of individualized treatment effects using generative adversarial nets. In International Conference on Learning Representations, 2018. [55] Weijia Zhang, Lin Liu, and Jiuyong Li. Treatment effect estimation with disentangled latent factors. arXiv preprint arXiv:2001.10652, 2020.
504
+ 543 [56] Yao Zhang, Alexis Bellot, and Mihaela Schaar. Learning overlapping representations for the estimation of individualized treatment effects. In International Conference on Artificial Intelligence and Statistics, pages 1005–1014. PMLR, 2020.
505
+
506
+ 1. For all authors...
507
+
508
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
509
+ (b) Did you describe the limitations of your work? [Yes] Particularly in Conclusion.
510
+ (c) Did you discuss any potential negative societal impacts of your work? [Yes] We mentioned possible misuse of our method and suggestions for practitioners in Introduction and Conclusion.
511
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
512
+
513
+ 2. If you are including theoretical results...
514
+
515
+ (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] In Appendix.
516
+
517
+ 3. If you ran experiments...
518
+
519
+ (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] In supplemental material.
520
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] Possibly in Appendix.
521
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes]
522
+ (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]
523
+
524
+ If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
525
+
526
+ (a) If your work uses existing assets, did you cite the creators? [Yes]
527
+ (b) Did you mention the license of the assets? [Yes] In code project.
528
+ (c) Did you include any new assets either in the supplemental material or as a URL? [Yes] In supplemental material.
529
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [Yes] In Appendix. And we refer to the original paper where this is discussed in details.
530
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [Yes] Refer to the original paper. And we believe there are no privacy issues.
531
+
532
+ ou used crowdsourcing or conducted research with human subjects...
533
+
534
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
535
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
536
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
md/train/aM7UsuOAzB3/aM7UsuOAzB3.md ADDED
@@ -0,0 +1,283 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Editing a Classifier by Rewriting Its Prediction Rules
2
+
3
+ Shibani Santurkar∗ MIT shibani@mit.edu
4
+
5
+ Dimitris Tsipras∗ MIT tsipras@mit.edu
6
+
7
+ Mahalaxmi Elango MIT melango@mit.edu
8
+
9
+ David Bau MIT davidbau@mit.edu
10
+
11
+ Antonio Torralba MIT torralba@mit.edu
12
+
13
+ Aleksander M ˛adry MIT madry@mit.edu
14
+
15
+ # Abstract
16
+
17
+ We present a methodology for modifying the behavior of a classifier by directly rewriting its prediction rules.1 Our approach requires virtually no additional data collection and can be applied to a variety of settings, including adapting a model to new environments, and modifying it to ignore spurious features.
18
+
19
+ # 1 Introduction
20
+
21
+ At the core of machine learning is the ability to automatically discover prediction rules from raw data. However, there is mounting evidence that not all of these rules are reliable [Torralba and Efros, 2011, Beery et al., 2018, Shetty et al., 2019, Agarwal et al., 2020, Xiao et al., 2020, Bissoto et al., 2020, Geirhos et al., 2020]. In particular, some rules could be based on biases in the training data: e.g., learning to associate cows with grass since they are typically depicted on pastures [Beery et al., 2018]. While such prediction rules may be useful in some scenarios, they will be irrelevant or misleading in others. This raises the question:
22
+
23
+ How can we most effectively modify the way in which a given model makes its predictions?
24
+
25
+ The canonical approach for performing such post hoc modifications is to intervene at the data level. For example, by gathering additional data that better reflects the real world (e.g., images of cows on the beach) and then using it to further train the model. Unfortunately, collecting such data can be challenging: how do we get cows to pose for us in a variety of environments? Furthermore, data collection is ultimately a very indirect way of specifying the intended model behavior. After all, even when data has been carefully curated to reflect a given real-world task, models still end up learning unintended prediction rules from it [Ponce et al., 2006, Torralba and Efros, 2011, Tsipras et al., 2020, Beyer et al., 2020].
26
+
27
+ # Our contributions
28
+
29
+ The goal of our work is to develop a toolkit that enables users to directly modify the prediction rules learned by an (image) classifier, as opposed to doing so implicitly via the data. Concretely:
30
+
31
+ Editing prediction rules. We build on the recent work of Bau et al. [2020a] to develop a method for modifying a classifier’s prediction rules with essentially no additional data collection (Section 2). At a high level, our method enables the user to modify the weight of a layer so that the latent representations of a specific concept (e.g., snow) map to the representations of another (e.g., road). Crucially, this allows us to change the behavior of the classifier on all occurrences of that concept, beyond the specific examples (and the corresponding classes) used in the editing process.
32
+
33
+ ![](images/40a9b7c01376c758599bce5b69b31b05f386e5aa395df2fdce7fd4a688ea5ce8.jpg)
34
+ Figure 1: Editing prediction rules in pre-trained classifiers using a single exemplar. (a) We edit a VGG16 ImageNet classifier to map the representation of the concept “snow” to that of “asphalt road”. (b) This edit corrects classification errors on snowy scenes corresponding to various classes. (c) We edit a CLIP [Radford et al., 2021] model such that the text “iPod” maps to a blank area. (d) This change makes the model robust to the typographic attacks from Goh et al. [2021].
35
+
36
+ Real-world scenarios. We demonstrate our approach in two scenarios motivated by real-world applications (Section 3). First, we focus on adapting an ImageNet classifier to a new environment: recognizing vehicles on snowy roads. Second, we consider the recent “typographic attack” of Goh et al. [2021] on a zero-shot CLIP [Radford et al., 2021] classifier: attaching a piece of paper with “iPod” written on it to various household items causes them to be incorrectly classified as “iPod.” In both settings, we find that our approach enables us to significantly improve model performance, using only a single, synthetic example to perform the edit—cf. Figure 1.
37
+
38
+ Large-scale synthetic evaluation. To evaluate our method at scale, we develop an automated pipeline to generate a suite of varied test cases (Section 4). Our pipeline revolves around identifying specific concepts (e.g., “road" or “pasture”) in an existing dataset using pre-trained instance segmentation models and then modifying them using style transfer [Gatys et al., 2016] (e.g., to create “snowy road”). We find that our editing methodology is able to consistently correct a significant fraction of model failures induced by these transformations. In contrast, standard fine-tuning approaches are unable to do so given the same data, often causing more errors than they are fixing.
39
+
40
+ Probing model behavior with counterfactuals. Beyond model editing, our concepttransformation pipeline can also be viewed as a scalable way of generating image counterfactuals. In Section 5, we demonstrate how such counterfactuals can be useful to gain insights into how a given model makes its predictions and pinpoint certain spurious correlations that it has picked up.
41
+
42
+ # 2 A toolkit for editing prediction rules
43
+
44
+ It has been widely observed that models pick up various context-specific correlations in the data— e.g., using the presence of “road” or a “wheel” to predict “car” (cf. Section 5). Such unreliable prediction rules (dependencies of predictions on specific input concepts) could hinder models when they encounter novel environments (e.g., snow-covered roads), and confusing or adversarial test conditions (e.g., cars with wooden wheels). Thus, a model designer might want to modify these rules before deploying their model.
45
+
46
+ The canonical approach to modify a classifier post hoc is to collect additional data that captures the desired deployment scenario, and use it to retrain the model. However, even setting aside the challenges of data collection, it is not obvious a priori how much of an effect such retraining (e.g., via fine-tuning) will have. For instance, if we fine-tune our model on “cars” with wooden wheels, will it now recognize “scooters” or “trucks” with such wheels?
47
+
48
+ The goal of this work is to instead develop a more direct way to modify a model’s behavior: rewriting its prediction rules in a targeted manner. For instance, in our previous example, we would ideally be able to modify the classifier to correctly recognize all vehicles with wooden wheels by simply teaching it to treat any wooden wheel as it would a standard one. Our approach is able to do exactly this. However, before describing this approach (Section 2.2), we first provide a brief overview of recent work by Bau et al. [2020a] which forms its basis.
49
+
50
+ # 2.1 Background: Rewriting generative models
51
+
52
+ Bau et al. [2020a] developed an approach for rewriting a deep generative model: specifically, enabling a user to replace all occurrences of one selected object (say, “dome”) in the generated images with another (say, “tree”), without changing the model’s behavior in other contexts. Their approach is motivated by the observation that, using a handful of example images, we can identify a vector in the model’s representation space that encodes a specific high-level concept [Kim et al., 2018, Bau et al., 2020a]. Building on this, Bau et al. [2020a] treat each layer of the model as an associative memory, which maps such a concept vector at each spatial location in its input (which we will refer to as the $k e y$ ) to another concept vector in its output (which we will call the value).
53
+
54
+ In the simplest case, one can think of a linear layer with weights $W \in \mathbb { R } ^ { m x n }$ transforming the key $k \in \mathbb { R } ^ { n }$ to the value $v \in \mathbb { R } ^ { m }$ . In this setting, Bau et al. [2020a] formulate the rewrite operation as modifying the layer weights from $W$ to $W ^ { \prime }$ so that $v ^ { * } = W ^ { \prime } k ^ { * }$ , where $k ^ { * }$ corresponds to the old concept that we want to replace, and $v ^ { * }$ to the new concept. For instance, to replace “domes” with “trees” in the generated images, we would modify the layer so that the key $k ^ { * }$ for “dome” maps to the value $v ^ { * }$ for “tree”. Consequently, when this value is fed into the downstream layers of the network it would result in a tree in the final image. Crucially, this update should change the model’s behavior for every instance of the concept encoded in $k ^ { * }$ —i.e., all “domes” in the images should now be “trees”.
55
+
56
+ To extend this approach to typical deep generative models, two challenges remain: (1) handling non-linear layers, and (2) ensuring that the edit doesn’t significantly hurt model behavior on other concepts. With these considerations in mind, Bau et al. [2020a] propose making the following rankone updates to the parameters $W$ of an arbitrary non-linear layer $f$ :
57
+
58
+ $$
59
+ \operatorname* { m i n } _ { \Lambda } \quad \sum _ { ( i , j ) \in { \cal S } } \big \| v _ { i j } ^ { * } - f ( k _ { i j } ^ { * } ; W ^ { \prime } ) \big \| \qquad \mathrm { s . t . } \quad W ^ { \prime } = W + \Lambda ( C ^ { - 1 } d ) ^ { \top } .
60
+ $$
61
+
62
+ Here, $S$ denotes the set of spatial locations in representation space for a single image corresponding to the concept of interest, $d$ is the top eigenvector of the keys $k _ { i j } ^ { * }$ at locations $( i , j ) \in S$ and $C =$ $\Sigma _ { d } k _ { d } k _ { d } ^ { \top }$ captures the second-order statistics for other keys $k _ { d }$ . Intuitively, the goal of this update is to modify the layer parameters to rewrite the desired key-value mapping in the most minimal way. We refer the reader to Bau et al. [2020a] for further details.
63
+
64
+ # 2.2 Editing classifiers
65
+
66
+ We now shift our attention to the focus of this work: editing classifiers. To describe our approach, we use the task of enabling classifiers to detect vehicles with “wooden wheels” as a running example. At a high level, we would like to apply the approach described in Section 2.1 to modify a chosen (potentially non-linear) layer $L$ of the network to rewrite the relevant key-value association. But, we need to first determine what these relevant keys and values are.
67
+
68
+ Let us start with a single image $x$ , say, from class “car”, that contains the concept “wheel”. Let the location of the “wheel” in the image be denoted by a binary mask $m$ .2 Then, say we have access to a transformed version of $x$ —namely, $x ^ { \prime }$ —where the “car” has a “wooden wheel” (cf. Figure 2). This $x ^ { \prime }$ could be created by manually replacing the wheel, or by applying an automated procedure such as that in Section 4. In the rest of our study, we refer to a single $( x , x ^ { \prime } )$ pair as an exemplar.
69
+
70
+ ![](images/859c4c5ebcb8ee4c4952b8ac6842c0961b883f19fb9810e7ddc40c1bb4abc2a9.jpg)
71
+ Figure 2: Overview of our pipeline for directly editing the prediction-rules of a classifier. The edit in (a) seeks to modify the network to perceive wooden wheels as standard ones, using a small set of exemplar images (say from class “car”). To achieve this, we first obtain the keys $k _ { i j } ^ { * }$ corresponding to the new concept (here, “wooden wheel”), and the values $v _ { i j } ^ { * }$ corresponding to the original concept (here, “standard wheel”) in the input and output representation space of a layer $L$ respectively. We then update the weights $W$ of the layer to enforce this new key-value association (1). (b) To test our method, we measure the improvement in model performance on test instances containing the new concept—here, images of other vehicles with “wooden wheels”.
72
+
73
+ Intuitively, we want the classifier to perceive the “wooden wheel” in the transformed image $x ^ { \prime }$ as it does the standard wheel in the original image $x$ . To achieve this, we must map the keys for wooden wheels to the value corresponding to their standard counterparts. In other words, the relevant keys $( k ^ { * } )$ correspond to the network’s representation of the concept in the transformed image $( x ^ { \prime } )$ directly before layer $L$ . Similarly, the relevant values $( v ^ { * } )$ that we want to map these keys to correspond to the network’s representation of the concept in the original images $( x )$ directly after layer $L$ . (The pertinent spatial regions in the representation space are simply determined by downsampling the mask to the appropriate dimensions.) Finally, the model edit is performed by feeding the resulting key-value pairs into the optimization problem (1) to determine the updated layer weights $W ^ { \prime }$ —cf. Figure 2 for an illustration of the overall process. Note that this approach can be easily extended to use multiple exemplars $( x _ { k } , x _ { k } ^ { \prime } )$ by simply expanding $S$ to include the union of relevant spatial locations (corresponding the concept of interest) across these exemplars.
74
+
75
+ # 3 Does editing work in practice?
76
+
77
+ To evaluate of our approach, we start by considering two scenarios motivated by real-world concerns: (i) adapting classifiers to handle novel weather conditions, and (ii) making models robust to typographic attacks Goh et al. [2021]. In both cases, we edit the model using a single exemplar, i.e., a single image that we manually annotate and modify. For comparison, we also consider two variants of fine-tuning using the same exemplar: (i) local fine-tuning, where we only train the weights of a single layer $L$ (similar to our editing approach); and (ii) global fine-tuning, where we also train all other layers between layer $L$ and the output of the model. It is worth noting that unlike fine-tuning, editing does not utilize class labels in any way. See Appendix A for experimental details.
78
+
79
+ # 3.1 Tackling new environments: Vehicles on snow
80
+
81
+ Our first use-case is adapting pre-trained classifiers to image subpopulations that are underrepresented in the training data. Specifically, we focus on the task of recognizing vehicles under heavy snow conditions—a setting that could be pertinent to self-driving cars—using a VGG16 classifier trained on ImageNet-1k. To study this problem, we collect a set of real photographs from road-related ImageNet classes using Flickr (details in Appendix A.5). We then rewrite the model’s prediction rules to map “snowy roads” to “road”. To do so, we create an exemplar by manually annotating the concept “road” in an ImageNet image from a different class (here, “police van”), and the manually replace it with snow texture obtained from Flickr. We then apply our editing methodology (cf. Section 2), using this single synthetic snow-to-road exemplar—see Figure 1.
82
+
83
+ ![](images/84f573b8d73f7e737b5dd5b6caace454b14d577f328e6d69b17308090244b78d.jpg)
84
+ Figure 3: (a) Adapting a pre-trained ImageNet VGG16 classifier to images of vehicles on snowy roads with a single exemplar. Fine-tuning (both local and global) does not improve accuracy, while editing to map “snowy road” “road” leads to a consistent improvement across multiple classes. (b) Improving the robustness of CLIP-ResNet-50 [Radford et al., 2021] models to typographic attacks [Goh et al., 2021]. Editing the model to map the text “iPod” $ ^ { \prime }$ “blank” using a single exemplar— either based on hand-written text on a physical teapot or from pasting typed text on an image of a “can opener”—completely corrects this vulnerability. While global fine-tuning can also improve model performance in this setting, it requires more careful hyperparameter tuning and typically hurts model performance in other contexts (Appendix Figure 9). Here, hyperparameters (cf. Appendix Table 2) are chosen based on the large-scale synthetic study in Section 4.1.
85
+
86
+ In Figure 3a, we measure the error rate of the model on the new test set (vehicles in snow) before and after performing the rewrite. We find that our edits significantly improve the model’s error rate on these images, despite the fact that we only use a single synthetic exemplar (i.e., not a real “snowy road” photograph). Moreover, Figure 3a demonstrates that our method indeed changes the way that the model processes a concept (here “snow”) in a way that generalizes beyond the specific class used during editing (here, the exemplar was a “police van”) . In contrast, fine-tuning the model under the same setup does not improve its performance on these inputs.
87
+
88
+ One potential concern is the impact of this process on the model’s accuracy on other ImageNet classes that contain snow (e.g., “ski”). On the 246 (of 50k) ImageNet test images that contain snow (identified using an MS-COCO-trained instance segmentation model [Chen et al., 2017]), the model’s accuracy pre-edit is $9 2 . 2 7 \%$ and post-edit is $9 1 . 0 5 \%$ —i.e., only 3/246 images are rendered incorrect by the edit. This indicates that the classifier is not disproportionately affected by the edit.
89
+
90
+ # 3.2 Ignoring a spurious feature: Typographic attacks
91
+
92
+ Our second use-case is modifying a model to ignore a spurious feature. We focus on the recentlydiscovered typographic attacks from Goh et al. [2021]: simply attaching a piece of paper with the text “iPod” on it is enough to make a zero-shot CLIP [Radford et al., 2021] classifier incorrectly classify an assortment of objects to be iPods. We reproduce these attacks on the ResNet-50 variant of the model—see Appendix Figure 7 for an illustration.
93
+
94
+ To correct this behavior, we rewrite the model’s prediction rules to map the text “iPod” to “blank”. For the choice of our transformed input $x ^ { \prime }$ , we consider two variants: either a real photograph of a “teapot” with the typographic attack (Appendix Figure 7); or an ImageNet image of a “can opener” (randomly-chosen) with the typed text “iPod” pasted on it (Figure 1). The original image $x$ for our approach is obtained by replacing the handwritten/typed text with a white mask—cf. Figure 1. We then use this single training exemplar to perform the model edit.
95
+
96
+ In both cases, we find that editing is able to fix all the errors caused by the typographic attacks, see Figure 3b. Interestingly, global fine-tuning also helps to correct many of these errors (potentially by adjusting class biases), albeit less reliably (for specific hyperparameters). However, unlike editing, fine-tuning also ends up damaging the model behavior in other scenarios—e.g., the model now spuriously associates the text “iPod” with the target class used for fine-tuning and/or has lower accuracy on normal “iPod” images from the test set (Appendix Figure 9).
97
+
98
+ ![](images/f8bd97b2557b2a74e1e52d0062bd969ee11c81341da24f89522fca48549f12e4.jpg)
99
+ Figure 4: Creating large-scale test sets for model rewriting. Given a standard dataset, we first identify salient concepts within the corresponding images using instance segmentation, and then apply a realistic transformation to each of these concepts using style transfer [Gatys et al., 2016]. We can then evaluate the effectiveness of a model rewriting technique based on the extent to which it can alleviate the model’s sensitivity (i.e., drop in accuracy) to such concept-level transformations.
100
+
101
+ # 4 Large-scale synthetic evaluation
102
+
103
+ The analysis of the previous section demonstrates that editing can improve model performance in realistic settings. However, due to the practical constraints of real-world data collection, this analysis was restricted to a relatively small test set. To corroborate the generality of our approach, we now develop a pipeline to automatically construct diverse rule-editing test cases. We then perform a large-scale evaluation and ablation of our editing method on this testbed.
104
+
105
+ # 4.1 Synthesizing concept-level transformations
106
+
107
+ At a high level, our goal is to automatically create a test set(s) in which a specific concept— possibly relevant to the detection of multiple dataset classes—undergoes a realistic transformation. To achieve this without additional data collection, we transform all instances of the concept of interest within existing datasets. For example, the “vehicles-on-snow” scenario of Section 3.1 can be synthetically reproduced by identifying the images within a standard dataset (say ImageNet [Deng et al., 2009, Russakovsky et al., 2015]) that contain segments of road and transforming these to make them resemble snow. Concretely, our pipeline (see Figure 4 for an illustration and Appendix A.6.1 for details), which takes as input an existing dataset, consists of the following two steps:
108
+
109
+ 1. Concept identification: In order to identify concepts within the dataset images in a scalable manner, we leverage pre-trained instance segmentation models. In particular, using state-of-the-art segmentation models—trained on MS-COCO [Lin et al., 2014] and LVIS [Gupta et al., 2019]—we are able to automatically generate concept segmentations for a range of high-level concepts (e.g., “grass”, “sea”, “tree”). 2. Concept transformation: We then transform the detected concept (within dataset images) in a consistent manner using existing methods for style transfer [Gatys et al., 2016, Ghiasi et al., 2017]. This allows us to preserve fine-grained image features and realism, while still exploring a range of potential transformations for a single concept. For our analysis, we manually curate a set of realistic transformations (e.g., “snow” and “graffiti”).
110
+
111
+ Note that this concept-transformation pipeline does not require any additional training or data annotation. Thus it can be directly applied to new datasets, as long as we have access to a pre-trained segmentation model for the concepts of interest.
112
+
113
+ # 4.2 Creating a suite of editing tasks
114
+
115
+ We now utilize the concept transformations described above to create a benchmark for evaluating model rewriting methods. Intuitively, these transformations can capture invariances that the model should ideally have—e.g., recognizing vehicles correctly even when they have wooden wheels. In practice however, model accuracy on one or more classes (e.g., “car”, “scooter”) may degrade under these transformations. The goal of rewriting the model would thus be to fix these failure modes in a data-efficient manner. In this section, we evaluate our editing methodology—as well as the fine-tuning approaches discussed in Section 3—along this axis.
116
+
117
+ Concretely, we focus on vision classifiers—specifically, VGG [Simonyan and Zisserman, 2015] and ResNet [He et al., 2015] models trained on the ImageNet [Deng et al., 2009, Russakovsky et al., 2015] and Places-365 [Zhou et al., 2017] datasets (cf. Appendix A.2). Each test set is constructed using the concept-transformation pipeline discussed above, based on a chosen concept-style pair (say “wheel”-“wooden”) 3. It consists of $N$ exemplars (pairs of original and transformed images, $( x , x ^ { \prime } ) )$ ) that belong to a single (randomly-chosen) target class in the dataset. All other transformed images containing the concept, including those from classes other than the target one, are used for validation and testing (30-70 split). We create two variants of the test set: one using the same style image as the exemplars (i.e., same wooden texture) for the transformation; and another using held-out style images (i.e., other wooden textures).
118
+
119
+ To evaluate the impact of a method, we measure the change in model accuracy on the transformed examples (e.g., vehicles with “wooden wheel”s in Figure 2b). If the method is effective, then it should recover some of the incorrect predictions caused by the transformations. We only focus on the subset of examples $D$ that were correctly classified before the transformation, since we cannot expect to correct mistakes that do not stem from the transformation itself. Concretely, we measure the change in the number of mistakes made by the model on the transformed examples:
120
+
121
+ $$
122
+ \% \mathrm { e r r o r s ~ c o r r e c t e d } : = \frac { N _ { p r e } ( D ) - N _ { p o s t } ( D ) } { N _ { p r e } ( D ) }
123
+ $$
124
+
125
+ where $N _ { p r e / p o s t } ( D )$ denotes the number of transformed examples misclassified by the model before and after the rewrite, respectively. Note that this metric can range from $100 \%$ when rewriting leads to perfect classification on the transformed examples, to even a negative value when the rewriting process causes more mistakes that it fixes.
126
+
127
+ In each case, we select the best hyperparameters—including the choice of the layer to modify— based on the validation set performance (cf. Appendix A.6.3). To quantify the effect of the modification on overall model behavior, we also measure the change in its (standard) test set performance. Since we are interested in rewrites that do not significantly hurt the overall model performance, we only consider hyperparameters that do not cause a large accuracy drop $( \leq 0 . 2 5 \% )$ . We found that the exact accuracy threshold did not have significant impact on the results—see Appendix Figures 15-18 for a demonstration of the full accuracy-effectiveness trade-off.
128
+
129
+ # 4.3 The effectiveness of editing
130
+
131
+ Recall that a key desideratum of our prediction-rule edits is that they should generalize. That is, if we modify the way that our model treats a specific concept, we want this modification to apply to every occurrence of that concept. For instance, if we edit a model to enforce that “wooden wheels” should be treated the same as regular “wheels” in the context of “car” images, we want the model to do the same when encountering other vehicles with “wooden wheels”. Thus, when analyzing performance in Figure 5, we consider inputs belonging to the class used to perform the edit separately.
132
+
133
+ Editing. We find that editing is able to consistently correct mistakes in a manner that generalizes across classes. That is, editing is able to reduce errors in non-target classes, often by more than 20 percentage points, even when performed using only three exemplars from the target class. Moreover, this improvement extends to transformations using different variants of the style (e.g., textures of “wood”), other than those present in exemplars used to perform the modification.
134
+
135
+ In Appendix B.1.3, we conduct ablation studies to get a better sense of the key algorithmic factors driving performance. Notably, we find that imposing the editing constraints (1) on the entirety of the image—as opposed to only focusing on key-value pairs that correspond to the concept of interest as proposed in Bau et al. [2020a]—leads to even better performance (cf. ‘-mask’ in Figure 5). We hypothesize that this has a regularizing effect as it constrains the weights to preserve the original mapping between keys and values in regions that do not contain the concept.
136
+
137
+ ![](images/954830d25274787fb89751f2439e475514c93ed0dd828113f0e3599c6ce2ece8.jpg)
138
+ (a) ImageNet-trained VGG16 (concepts from COCO)
139
+
140
+ ![](images/b4f310725c708c8ee76c97a86df04c821bc9ed04ef81945ca0c5c12f8ed6f004.jpg)
141
+ (b) Places-trained ResNet-18 (concepts from LVIS)
142
+ Figure 5: Editing vs. fine-tuning, averaged over concept-style pairs. We find that both methods (and their variants) are fairly successful at correcting errors on the target class (examples of which are used to perform the rewrite). This holds even when the transformation applied during testing is different from the one present in the train exemplars (e.g., a different texture of “wood”). However, crucially, only the improvements induced by editing generalize to other classes where the transformed concept is present. Fine-tuning fails in this setting—typically, causing more errors than it fixes. See Appendix Figures 10-13 for other experimental settings.
143
+
144
+ Fine-tuning. Our baseline is the canonical fine-tuning approach, i.e., directly minimizing the model loss on the new data (here the transformed images) with respect to their label. Similar to Section 3, we consider both the local and global variants of fine-tuning. We find that while these approaches are able to correct model errors on transformed inputs from the class used to perform the modification, they typically decrease performance on other classes—i.e., they cause more errors than they fix. Moreover, even when we allow a larger drop in the model’s accuracy, or use more training exemplars, their performance often becomes worse such inputs (Appendix Figures 15-18).
145
+
146
+ We present examples of errors corrected (or not) by editing and fine-tuning in Appendix Figure 14, and provide a per-concept/style break down in Appendix Figures 19 and 20.
147
+
148
+ # 5 Beyond editing: Probing model behavior via counterfactuals
149
+
150
+ In the previous section, we developed a scalable pipeline for creating concept-level transformations which we used to evaluate model rewriting methods. Here, we put forth another related use-case of that pipeline: debugging models to identify their (learned) prediction rules.
151
+
152
+ In particular, observe that the resulting transformed inputs (cf. Figure 4) can be viewed as counterfactuals—a primitive commonly used in causal inference [Pearl, 2010] and interpretability [Goyal et al., 2019a,b, Bau et al., 2020b]. Counterfactuals can be used to identify the features that a model uses to make its prediction on a given input. For example, to understand whether the model relies on the presence of a “wheel” to recognize a “car” image, we can evaluate how the its prediction changes when just the wheel in the image is transformed. Based on this view, we now repurpose our concept transformations from Section 4 to discover a given classifier’s prediction rules.
153
+
154
+ The effect of specific concepts. As a point of start, we study how sensitive the model’s prediction is to a given concept in terms of the accuracy drop caused by transformation of said concept. For instance, in Figure 6a, we find that the accuracy of a VGG16 ImageNet classifier drops by $2 5 \%$ on images of “croquet ball” when “grass” is transformed, whereas its accuracy on “collie” does not change. In line with previous studies [Zhang et al., 2007, Ribeiro et al., 2016, Rosenfeld et al., 2018, Barbu et al., 2019, Xiao et al., 2020], we also find that background concepts, such as “grass”, ���sea” and “sand”, have a large effect on model performance. We contrast this measure of influence across concepts for a single model (Appendix Figure 27), and across architectures for a single concept (Appendix B.2). Finally, we examine the effect of each concept stylization in Figure 6b.
155
+
156
+ Per-class prediction rules. If instead we restrict our attention to a single class, we can pinpoint the set of concepts that the model relies on to detect this class. It turns out that aside from the main image object, ImageNet classifiers also heavily depend on co-occurring objects [Stock and Cisse,
157
+
158
+ ![](images/69b34d793490d5efbe31f255080c02c9e48df62634e74bbcd699266cfedb82b4.jpg)
159
+ (b) Style impact on accuracy
160
+ Figure 6: Model sensitivities diagnosed using our pipeline in a VGG16 ImageNet classifier. (a) Classes for which the model relies on “grass”: e.g., a “croquet ball” is not accurately recognized if “grass” is transformed, while “collie”s are not affected. (b) Applying different transformations to visual concepts reduces accuracy by varying amounts. (c) Transformations that hamper accuracy can highlight prediction rules: e.g., the class “groom” is sensitive to the presence of “dress.”
161
+
162
+ 2018, Tsipras et al., 2020, Beyer et al., 2020] in the image—e.g., “dress” for the class “groom”, “person” for the class “tench” (sic), and “road” for the class “race car” (cf. Figure 6c and Appendix Figure 29). We can also examine which styles hurt performance the most—e.g., we find that making “plants” “floral” hurts accuracy on the class “damselfly” $15 \%$ more than making them “snowy”.
163
+
164
+ Overall, this pipeline provides a scalable path for model designers to analyze the invariances (and sensitivities) of their models with respect to various natural transformations of interest. We thus believe that this primitive holds promise for future interpretability and robustness studies.
165
+
166
+ # 6 Related work
167
+
168
+ High-level concepts in latent representations. There has been increasing interest in explaining the inner workings of deep classifiers through high-level concepts: e.g., by identifying individual neurons [Erhan et al., 2009, Zeiler and Fergus, 2014, Olah et al., 2017, Bau et al., 2017, Engstrom et al., 2019a] or activation vectors [Kim et al., 2018, Zhou et al., 2018, Chen et al., 2020] that correspond to human-understandable features. The effect of these features on model predictions can be analyzed by either inspecting the downstream weights of the model [Olah et al., 2018, Wong et al., 2021] or through counterfactual tests: e.g., via synthetic data [Goyal et al., 2019a]; by swapping features between individual images [Goyal et al., 2019b]; or by silencing sets of neurons [Bau et al., 2020b]. A parallel line of work aims to learn models that operate on data representations that explicitly encode high-level concepts: either by learning to predict a set of attributes [Lampert et al., 2009, Koh et al., 2020a] or by learning to segment inputs [Losch et al., 2019]. In our work, we identify concepts by manually selecting the relevant pixels in a handful of images and measure the impact of manipulating these features on model performance on a new test set.
169
+
170
+ Model interventions. Direct manipulations of latent representations inside generative models have been used to create human-understandable changes in synthesized images [Bau et al., 2019, Jahanian et al., 2019, Goetschalckx et al., 2019, Shen et al., 2020, Härkönen et al., 2020, Wu et al., 2020]. Our work is inspired by that line of work as well as a recent finding that parameters of a generative model can be directly changed to alter generalized behavior [Bau et al., 2020a]. Unlike previous work, we edit classification models, changing rules that govern predictions rather than image synthesis. Concurrently with our work, there has been a series of methods proposed for editing factual knowledge in language models [Mitchell et al., 2021, De Cao et al., 2021, Dai et al., 2021].
171
+
172
+ Ignoring spurious features. Prior work on preventing models from relying on spurious correlations is based on constraining model predictions to satisfy certain invariances. Examples include: training on counterfactuals (either by adding or removing objects from scenes [Shetty et al., 2018, 2019, Agarwal et al., 2020] or having human annotators edit text input [Kaushik et al., 2019]), learning representations that are simultaneously optimal across domains [Arjovsky et al., 2019], ensuring comparable performance across subpopulations [Sagawa et al., 2020], or enforcing consistency across inputs that depict the same entity [Heinze-Deml and Meinshausen, 2017]. In this work, we focus on a setting where the model designer is aware of undesirable correlations learned by the model and we provide the tools to rewrite them directly.
173
+
174
+ Model robustness. A long line of work has been devoted to discovering and correcting failure modes of models. These studies focus on simulating variations in testing conditions that can arise during deployment, including: adversarial or natural input corruptions [Szegedy et al., 2014, Fawzi and Frossard, 2015, Fawzi et al., 2016, Engstrom et al., 2019b, Ford et al., 2019, Hendrycks and Dietterich, 2019, Kang et al., 2019], changes in the data collection process [Saenko et al., 2010, Torralba and Efros, 2011, Khosla et al., 2012, Tommasi and Tuytelaars, 2014, Recht et al., 2019], or variations in the data subpopulations present [Beery et al., 2018, Oren et al., 2019, Sagawa et al., 2020, Santurkar et al., 2021, Koh et al., 2020b]. Typical approaches for improving robustness in these contexts include robust optimization [Madry et al., 2018, Yin et al., 2019, Sagawa et al., 2020] and data augmentation schemes [Lopes et al., 2019, Hendrycks et al., 2019, Zhang et al., 2021]. Our rule-discovery and editing pipelines can be viewed as complementary to this work as they allows us to preemptively adjust the model’s prediction rules in anticipation of deployment conditions.
175
+
176
+ Domain adaptation. The goal of domain adaptation is to adapt a model to a specific deployment environment using (potentially unlabeled) samples from it. This is typically achieved by either fine-tuning the model on the new domain [Donahue et al., 2014, Sharif Razavian et al., 2014, Kumar et al., 2020], learning the correspondence between the source and target domain, often in a latent representation space [Ben-David et al., 2007, Saenko et al., 2010, Ganin and Lempitsky, 2015, Courty et al., 2016, Gong et al., 2016], or updating the model’s batch normalization statistics [Li et al., 2016, Burns and Steinhardt, 2021]. These approaches all require a non-trivial amount of data from the target domain. The question of adaptation from a handful of samples has been explored [Motiian et al., 2017], but in a setting that requires samples across all target classes. In contrast, our method allows for generalization to new (potentially unknown) classes with even a single example.
177
+
178
+ # 7 Conclusion
179
+
180
+ We developed a general toolkit for performing targeted post hoc modifications to vision classifiers. Crucially, instead of specifying the desired behavior implicitly via the training data, our method allows users to directly edit the model’s prediction rules. By doing so, our approach makes it easier for users to encode their prior knowledge and preferences during the model debugging process. Additionally, a key benefit of this technique is that it fundamentally changes how the model processes a given concept—thus making it possible to edit its behavior beyond the specific class(es) used for editing. Finally, our edits do not require any additional data collection: they can be guided by as few as a single (synthetically-created) exemplar. We believe that this primitive opens up new avenues to interact with and correct our models before or during deployment.
181
+
182
+ # Limitations and broader impact.
183
+
184
+ Even though our methodology provides a general tool for model editing, performing such edits does require manual intervention and domain expertise. After all, the choice of what concept to edit— and its implications on the robustness of the model—lies with the model designer. For instance, in the vehicles-on-snow example, our objective was to have the model recognize any vehicle on snow the same way it would on a regular road—e.g., to adapt a system to different weather conditions. However, if our dataset contains classes for which the presence snow is absolutely essential for recognition, this might not be an appropriate edit to perform.
185
+
186
+ Moreover, direct model editing is a departure from the standard way in which models are trained, and may have broader implications. While we have shown how it can be used to cause beneficial changes in pre-trained models, direct control of prediction rules could also make it easier for adversaries to introduce vulnerabilities into the model (e.g., by manipulating model behavior on a specific population demographic). Overall, direct model editing makes it clearer than ever that our models are a reflection of the goals and biases of we who create them—not only through the training tasks we choose, but now also through the rules that we rewrite.
187
+
188
+ # Acknowledgments and Disclosure of Funding
189
+
190
+ We thank the anonymous reviewers for their helpful comments and feedback.
191
+
192
+ Work supported in part by the NSF grants CCF-1553428 and CNS-1815221, the DARPA SAILON HR0011-20-C-0022 grant, Open Philanthropy, a Google PhD fellowship, and a Facebook PhD fellowship. This material is based upon work supported by the Defense Advanced Research Projects Agency (DARPA) under Contract No. HR001120C0015.
193
+
194
+ Research was sponsored by the United States Air Force Research Laboratory and the United States Air Force Artificial Intelligence Accelerator and was accomplished under Cooperative Agreement Number FA8750-19-2-1000. The views and conclusions contained in this document are those of the authors and should not be interpreted as representing the official policies, either expressed or implied, of the United States Air Force or the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints for Government purposes notwithstanding any copyright notation herein.
195
+
196
+ # References
197
+
198
+ V. Agarwal, R. Shetty, and M. Fritz. Towards causal vqa: Revealing and reducing spurious correlations by invariant and covariant semantic editing. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 9690–9698, 2020.
199
+ M. Arjovsky, L. Bottou, I. Gulrajani, and D. Lopez-Paz. Invariant risk minimization. arXiv preprint arXiv:1907.02893, 2019.
200
+ A. Barbu, D. Mayo, J. Alverio, W. Luo, C. Wang, D. Gutfreund, J. Tenenbaum, and B. Katz. Objectnet: A large-scale bias-controlled dataset for pushing the limits of object recognition models. In Neural Information Processing Systems (NeurIPS), 2019.
201
+ D. Bau, B. Zhou, A. Khosla, A. Oliva, and A. Torralba. Network dissection: Quantifying interpretability of deep visual representations. In Computer Vision and Pattern Recognition (CVPR), 2017.
202
+ D. Bau, J.-Y. Zhu, H. Strobelt, B. Zhou, J. B. Tenenbaum, W. T. Freeman, and A. Torralba. Gan dissection: Visualizing and understanding generative adversarial networks. In International Conference on Learning Representations (ICLR), 2019.
203
+ D. Bau, S. Liu, T. Wang, J.-Y. Zhu, and A. Torralba. Rewriting a deep generative model. In European Conference on Computer Vision (ECCV), 2020a.
204
+ D. Bau, J.-Y. Zhu, H. Strobelt, A. Lapedriza, B. Zhou, and A. Torralba. Understanding the role of individual units in a deep neural network. Proceedings of the National Academy of Sciences (PNAS), 2020b.
205
+ S. Beery, G. Van Horn, and P. Perona. Recognition in terra incognita. In European Conference on Computer Vision (ECCV), 2018.
206
+ S. Ben-David, J. Blitzer, K. Crammer, and F. Pereira. Analysis of representations for domain adaptation. In Neural Information Processing Systems (NeurIPS), 2007.
207
+ L. Beyer, O. J. Hénaff, A. Kolesnikov, X. Zhai, and A. v. d. Oord. Are we done with imagenet? arXiv preprint arXiv:2006.07159, 2020.
208
+ A. Bissoto, E. Valle, and S. Avila. Debiasing skin lesion datasets and models? not so fast. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops, pages 740–741, 2020.
209
+ C. Burns and J. Steinhardt. Limitations of post-hoc feature alignment for robustness. 2021.
210
+ L.-C. Chen, G. Papandreou, I. Kokkinos, K. Murphy, and A. L. Yuille. Deeplab: Semantic image segmentation with deep convolutional nets, atrous convolution, and fully connected crfs. IEEE transactions on pattern analysis and machine intelligence, 2017.
211
+ Z. Chen, Y. Bei, and C. Rudin. Concept whitening for interpretable image recognition. Nature Machine Intelligence, 2020.
212
+ N. Courty, R. Flamary, D. Tuia, and A. Rakotomamonjy. Optimal transport for domain adaptation. In Transactions on Pattern Analysis and Machine Intelligence, 2016.
213
+ D. Dai, L. Dong, Y. Hao, Z. Sui, and F. Wei. Knowledge neurons in pretrained transformers. arXiv preprint arXiv:2104.08696, 2021.
214
+ N. De Cao, W. Aziz, and I. Titov. Editing factual knowledge in language models. arXiv preprint arXiv:2104.08164, 2021.
215
+ J. Deng, W. Dong, R. Socher, L.-J. Li, K. Li, and L. Fei-Fei. Imagenet: A large-scale hierarchical image database. In Computer Vision and Pattern Recognition (CVPR), 2009.
216
+ J. Donahue, Y. Jia, O. Vinyals, J. Hoffman, N. Zhang, E. Tzeng, and T. Darrell. Decaf: A deep convolutional activation feature for generic visual recognition. In International conference on machine learning (ICML), 2014.
217
+ L. Engstrom, A. Ilyas, S. Santurkar, D. Tsipras, B. Tran, and A. Madry. Adversarial robustness as a prior for learned representations. In ArXiv preprint arXiv:1906.00945, 2019a.
218
+ L. Engstrom, B. Tran, D. Tsipras, L. Schmidt, and A. Madry. Exploring the landscape of spatial robustness. In International Conference on Machine Learning (ICML), 2019b.
219
+ D. Erhan, Y. Bengio, A. Courville, and P. Vincent. Visualizing higher-layer features of a deep network. 2009.
220
+ A. Fawzi and P. Frossard. Manitest: Are classifiers really invariant? In British Machine Vision Conference (BMVC), 2015.
221
+ A. Fawzi, S.-M. Moosavi-Dezfooli, and P. Frossard. Robustness of classifiers: from adversarial to random noise. In Advances in Neural Information Processing Systems (NeurIPS), 2016.
222
+ N. Ford, J. Gilmer, N. Carlini, and D. Cubuk. Adversarial examples are a natural consequence of test error in noise. In arXiv preprint arXiv:1901.10513, 2019.
223
+ Y. Ganin and V. Lempitsky. Unsupervised domain adaptation by backpropagation. 2015.
224
+ L. A. Gatys, A. S. Ecker, and M. Bethge. Image style transfer using convolutional neural networks. In computer vision and pattern recognition (CVPR), 2016.
225
+ R. Geirhos, J.-H. Jacobsen, C. Michaelis, R. Zemel, W. Brendel, M. Bethge, and F. A. Wichmann. Shortcut learning in deep neural networks. In Nature Machine Intelligence, 2020.
226
+ G. Ghiasi, H. Lee, M. Kudlur, V. Dumoulin, and J. Shlens. Exploring the structure of a real-time, arbitrary neural artistic stylization network. arXiv preprint arXiv:1705.06830, 2017.
227
+ R. Girshick, I. Radosavovic, G. Gkioxari, P. Dollár, and K. He. Detectron. https://github.com/ facebookresearch/detectron, 2018.
228
+ L. Goetschalckx, A. Andonian, A. Oliva, and P. Isola. Ganalyze: Toward visual definitions of cognitive image properties. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 5744– 5753, 2019.
229
+ G. Goh, N. Cammarata, C. Voss, S. Carter, M. Petrov, L. Schubert, A. Radford, and C. Olah. Multimodal neurons in artificial neural networks. Distill, 2021.
230
+ 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 (ICML), 2016.
231
+ Y. Goyal, A. Feder, U. Shalit, and B. Kim. Explaining classifiers with causal concept effect (cace). arXiv preprint arXiv:1907.07165, 2019a.
232
+ Y. Goyal, Z. Wu, J. Ernst, D. Batra, D. Parikh, and S. Lee. Counterfactual visual explanations. arXiv preprint arXiv:1904.07451, 2019b.
233
+ A. Gupta, P. Dollar, and R. Girshick. LVIS: A dataset for large vocabulary instance segmentation. In Conference on Computer Vision and Pattern Recognition (CVPR), 2019.
234
+ E. Härkönen, A. Hertzmann, J. Lehtinen, and S. Paris. Ganspace: Discovering interpretable gan controls. Advances in Neural Information Processing Systems, 33, 2020.
235
+ K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition, 2015.
236
+ K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In Conference on Computer Vision and Pattern Recognition (CVPR), 2016.
237
+ C. Heinze-Deml and N. Meinshausen. Conditional variance penalties and domain shift robustness. arXiv preprint arXiv:1710.11469, 2017.
238
+ D. Hendrycks and T. G. Dietterich. Benchmarking neural network robustness to common corruptions and surface variations. In International Conference on Learning Representations (ICLR), 2019.
239
+ D. Hendrycks, N. Mu, E. D. Cubuk, B. Zoph, J. Gilmer, and B. Lakshminarayanan. Augmix: A simple data processing method to improve robustness and uncertainty. arXiv preprint arXiv:1912.02781, 2019.
240
+ A. Jahanian, L. Chai, and P. Isola. On the" steerability" of generative adversarial networks. In International Conference on Learning Representations, 2019.
241
+ D. Kang, Y. Sun, D. Hendrycks, T. Brown, and J. Steinhardt. Testing robustness against unforeseen adversaries. In ArXiv preprint arxiv:1908.08016, 2019.
242
+ D. Kaushik, E. Hovy, and Z. Lipton. Learning the difference that makes a difference with counterfactuallyaugmented data. In International Conference on Learning Representations (ICLR), 2019.
243
+ A. Khosla, T. Zhou, T. Malisiewicz, A. A. Efros, and A. Torralba. Undoing the damage of dataset bias. In European Conference on Computer Vision (ECCV), 2012.
244
+ B. Kim, M. Wattenberg, J. Gilmer, C. Cai, J. Wexler, F. Viegas, et al. Interpretability beyond feature attribution: Quantitative testing with concept activation vectors (tcav). In International conference on machine learning (ICML), 2018.
245
+ P. W. Koh, T. Nguyen, Y. S. Tang, S. Mussmann, E. Pierson, B. Kim, and P. Liang. Concept bottleneck models. In International Conference on Machine Learning (ICML), 2020a.
246
+ P. W. Koh, S. Sagawa, H. Marklund, S. M. Xie, M. Zhang, A. Balsubramani, W. Hu, M. Yasunaga, R. L. Phillips, S. Beery, et al. Wilds: A benchmark of in-the-wild distribution shifts. arXiv preprint arXiv:2012.07421, 2020b.
247
+ A. Kumar, T. Ma, and P. Liang. Understanding self-training for gradual domain adaptation. In International Conference on Machine Learning (ICML), 2020.
248
+ C. H. Lampert, H. Nickisch, and S. Harmeling. Learning to detect unseen object classes by between-class attribute transfer. In Computer Vision and Pattern Recognition (CVPR), 2009.
249
+ Y. Li, N. Wang, J. Shi, J. Liu, and X. Hou. Revisiting batch normalization for practical domain adaptation. arXiv preprint arXiv:1603.04779, 2016.
250
+ T.-Y. Lin, M. Maire, S. Belongie, J. Hays, P. Perona, D. Ramanan, P. Dollár, and C. L. Zitnick. Microsoft coco: Common objects in context. In European conference on computer vision (ECCV), 2014.
251
+ R. G. Lopes, D. Yin, B. Poole, J. Gilmer, and E. D. Cubuk. Improving robustness without sacrificing accuracy with patch gaussian augmentation. arXiv preprint arXiv:1906.02611, 2019.
252
+ M. Losch, M. Fritz, and B. Schiele. Interpretability beyond classification output: Semantic bottleneck networks. arXiv preprint arXiv:1907.10882, 2019.
253
+ A. Madry, A. Makelov, L. Schmidt, D. Tsipras, and A. Vladu. Towards deep learning models resistant to adversarial attacks. In International Conference on Learning Representations (ICLR), 2018.
254
+ E. Mitchell, C. Lin, A. Bosselut, C. Finn, and C. D. Manning. Fast model editing at scale. arXiv preprint arXiv:2110.11309, 2021.
255
+ S. Motiian, Q. Jones, S. M. Iranmanesh, and G. Doretto. Few-shot adversarial domain adaptation. In NIPS, 2017.
256
+ C. Olah, A. Mordvintsev, and L. Schubert. Feature visualization. In Distill, 2017.
257
+ C. Olah, A. Satyanarayan, I. Johnson, S. Carter, L. Schubert, K. Ye, and A. Mordvintsev. The building blocks of interpretability. In Distill, 2018.
258
+ Y. Oren, S. Sagawa, T. Hashimoto, and P. Liang. Distributionally robust language modeling. In Empirical Methods in Natural Language Processing (EMNLP), 2019.
259
+ J. Pearl. Causal inference. Causality: Objectives and Assessment, 2010.
260
+ J. Ponce, T. L. Berg, M. Everingham, D. A. Forsyth, M. Hebert, S. Lazebnik, M. Marszalek, C. Schmid, B. C. Russell, A. Torralba, et al. Dataset issues in object recognition. In Toward category-level object recognition, 2006.
261
+ A. Radford, J. W. Kim, C. Hallacy, A. Ramesh, G. Goh, S. Agarwal, G. Sastry, A. Askell, P. Mishkin, J. Clark, et al. Learning transferable visual models from natural language supervision. arXiv preprint arXiv:2103.00020, 2021.
262
+ B. Recht, R. Roelofs, L. Schmidt, and V. Shankar. Do imagenet classifiers generalize to imagenet? In International Conference on Machine Learning (ICML), 2019.
263
+ M. T. Ribeiro, S. Singh, and C. Guestrin. “why should i trust you?”: Explaining the predictions of any classifier. In International Conference on Knowledge Discovery and Data Mining (KDD), 2016.
264
+ A. Rosenfeld, R. Zemel, and J. K. Tsotsos. The elephant in the room. In arXiv preprint arXiv:1808.03305, 2018.
265
+ O. Russakovsky, J. Deng, H. Su, J. Krause, S. Satheesh, S. Ma, Z. Huang, A. Karpathy, A. Khosla, M. Bernstein, A. C. Berg, and L. Fei-Fei. ImageNet Large Scale Visual Recognition Challenge. In International Journal of Computer Vision (IJCV), 2015.
266
+ K. Saenko, B. Kulis, M. Fritz, and T. Darrell. Adapting visual category models to new domains. In European conference on computer vision (ECCV), 2010.
267
+ S. Sagawa, P. W. Koh, T. B. Hashimoto, and P. Liang. Distributionally robust neural networks for group shifts: On the importance of regularization for worst-case generalization. In International Conference on Learning Representations, 2020.
268
+ S. Santurkar, D. Tsipras, and A. Madry. Breeds: Benchmarks for subpopulation shift. In International Conference on Learning Representations (ICLR), 2021.
269
+ A. Sharif Razavian, H. Azizpour, J. Sullivan, and S. Carlsson. Cnn features off-the-shelf: an astounding baseline for recognition. In conference on computer vision and pattern recognition (CVPR) workshops, 2014.
270
+ Y. Shen, J. Gu, X. Tang, and B. Zhou. Interpreting the latent space of gans for semantic face editing. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 9243–9252, 2020.
271
+ R. Shetty, M. Fritz, and B. Schiele. Adversarial scene editing: Automatic object removal from weak supervision. In NeurIPS, 2018.
272
+ R. Shetty, B. Schiele, and M. Fritz. Not using the car to see the sidewalk–quantifying and controlling the effects of context in classification and segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 8218–8226, 2019.
273
+ K. Simonyan and A. Zisserman. Very deep convolutional networks for large-scale image recognition. In International Conference on Learning Representations (ICLR), 2015.
274
+ P. Stock and M. Cisse. Convnets and imagenet beyond accuracy: Understanding mistakes and uncovering biases. In European Conference on Computer Vision (ECCV), 2018.
275
+ C. Szegedy, W. Zaremba, I. Sutskever, J. Bruna, D. Erhan, I. Goodfellow, and R. Fergus. Intriguing properties of neural networks. In International Conference on Learning Representations (ICLR), 2014.
276
+ T. Tommasi and T. Tuytelaars. A testbed for cross-dataset analysis. In European Conference on Computer Vision (ECCV), 2014.
277
+ A. Torralba and A. A. Efros. Unbiased look at dataset bias. In CVPR 2011, 2011.
278
+ D. Tsipras, S. Santurkar, L. Engstrom, A. Ilyas, and A. Madry. From imagenet to image classification: Contextualizing progress on benchmarks. In International Conference on Machine Learning (ICML), 2020.
279
+ E. Wong, S. Santurkar, and A. Madry. Leveraging sparse linear layers for debuggable deep networks. In International Conference on Machine Learning (ICML), 2021.
280
+ Z. Wu, D. Lischinski, and E. Shechtman. Stylespace analysis: Disentangled controls for stylegan image generation. In Computer Vision and Pattern Recognition (CVPR), 2020.
281
+ K. Xiao, L. Engstrom, A. Ilyas, and A. Madry. Noise or signal: The role of image backgrounds in object recognition. arXiv preprint arXiv:2006.09994, 2020.
282
+
283
+ D. Yin, R. G. Lopes, J. Shlens, E. D. Cubuk, and J. Gilmer. A fourier perspective on model robustness in computer vision. In Neural Information Processing Systems (NeurIPS), 2019. M. D. Zeiler and R. Fergus. Visualizing and understanding convolutional networks. 2014. J. Zhang, M. Marszałek, S. Lazebnik, and C. Schmid. Local features and kernels for classification of texture and object categories: A comprehensive study. In International journal of computer vision, 2007. L. Zhang, Z. Deng, K. Kawaguchi, A. Ghorbani, and J. Zou. How does mixup help with robustness and generalization? In International Conference on Learning Representations (ICLR), 2021. B. Zhou, A. Lapedriza, A. Khosla, A. Oliva, and A. Torralba. Places: A 10 million image database for scene recognition. IEEE transactions on pattern analysis and machine intelligence, 2017. B. Zhou, Y. Sun, D. Bau, and A. Torralba. Interpretable basis decomposition for visual explanation. In Proceedings of the European Conference on Computer Vision (ECCV), pages 119–134, 2018.
md/train/bDP7I2fYwLj/bDP7I2fYwLj.md ADDED
@@ -0,0 +1,471 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # WeaveNet for Approximating Assignment Problems
2
+
3
+ Anonymous Author(s)
4
+ Affiliation
5
+ Address
6
+ email
7
+
8
+ # Abstract
9
+
10
+ 1 Assignment, a task to match a limited number of elements, is a fundamental
11
+ 2 problem in informatics. Many assignment problems have no exact solvers due
12
+ 3 to their NP-hardness or incomplete input, and their approximation algorithms
13
+ 4 have been studied for a long time. However, individual practical applications
14
+ 5 have various objective functions and prior assumptions, which usually differ from
15
+ 6 academic studies. This gap hinders applying the algorithms to real problems
16
+ 7 despite their theoretically ensured performance. In contrast, a learning-based
17
+ 8 method can be a promising solution to fill the gap. To open a new vista for
18
+ 9 real-world assignment problems, we propose a novel neural network architecture,
19
+ 10 WeaveNet. Its core module, feature weaving layer, is stacked to model frequent
20
+ 11 communication between elements in a parameter-efficient way for solving the
21
+ 12 combinatorial problem of assignment. To evaluate the model, we approximated
22
+ 13 one of the most popular non-linear assignment problems, stable matching with two
23
+ 14 different strongly NP-hard settings. The experimental results showed its impressive
24
+ 15 performance among the learning-based baselines. Furthermore, we achieved better
25
+ 16 or comparative performance to the state-of-the-art algorithmic method, depending
26
+ 17 on the size of problem instances.
27
+
28
+ # 18 1 Introduction
29
+
30
+ 19 From multiple object tracking to job matching, assignment problems can represent a wide variety of
31
+ 20 applications. An assignment problem is typically defined on a bipartite graph, a graph with two sets
32
+ 21 of nodes $A$ and $B$ with edges $E = A \times B$ $\mathbf { \nabla } \cdot N = | A |$ , $M = | B |$ , $N \geq M$ ). On the graph, the task
33
+ 22 is to find a matching $m \in \mathsf { \bar { \{ 0 , 1 \} } } ^ { A \times B }$ (a set of edges represented as a binary matrix) that satisfies
34
+ 23 constraints and/or maximizes objectives. Depending on real-world scenes, there must be various
35
+ 24 objectives and constraints for $m$ . A typical constraint is a one-to-one correspondence (i.e., every node
36
+ 25 has at most one matched partner in $m$ ) and, for simplicity, we always assume it in this paper.
37
+ 26 Matching stability is another example of such constraints. It is a non-linear constraint first introduced
38
+ 7 for a hospital-student assignment problem (Gale and Shapley, $\textcircled { 1 9 6 2 }$ based on the preferences of
39
+ 28 hospitals among students and vice versa. We say a matching $m$ is unstable when there exist $a \in A$
40
+ 29 and $b \in B$ which are unmatched in $m$ ${ m } _ { a b } = 0$ ) but both prefer each other more than their partner
41
+ 30 in $m$ . We can obtain a stable matching $m$ in $O ( N ^ { 2 } )$ by the Gale-Shapley (GS) algorithm $\underline { { ( \overline { { \mathbf { G a l e } } } ) } }$
42
+ and Shapley, 1962). However, when $m$ is expected to have the minimum difference in the total
43
+ 32 satisfactions between sides $A$ and $B$ (known as sex-equal stable matching), the problem becomes
44
+ 33 strongly NP-hard1 (Kato, 1993; McDermid and Irving, 2014)
45
+ 34 In addition to the NP-hardness, we also face difficulties to obtain the best assignment when assignment
46
+ 35 candidates may randomly disappear (e.g., multiple object tracking with occlusions (Emami et al.,
47
+ 36 $\textcircled { 2 0 2 0 }$ or joint matching in multi-person pose estimation $\textcircled { 1 } \textcircled { < } \textcircled { < } \textcircled { a l . } \textcircled { 2 0 1 7 } )$ . In such cases, we need
48
+ 37 to compensate for the inputs of incomplete information by its stochastic properties. The traditional
49
+ 38 methods often use sub-optimal approximations to avoid solving complex assignment problems.
50
+ 39 A differential assignment model can be a future option that enables end-to-end training for such
51
+ 40 applications.
52
+ 41 Toward such future applications, this paper aims to propose an effective and promising differential
53
+ 42 solver for assignment problems. The contribution of this paper is four-fold:
54
+
55
+ 1. We proposed WeaveNet, a novel neural network architecture for assignment problems and set-encoder, a novel local structure.
56
+ 2. We proposed a novel technique, split batch normalization, to deal with a strong asymmetry in input distributions for sides $A$ and $B$ .
57
+ 3. We focused on stable matching, a classical non-linear assignment problem actively studied even in recent years, and proposed a novel evaluation protoco $\sharp$ with pseudo costs, which enables us to compare learning-based solvers and algorithmic solvers directly.
58
+ 4. We achieved a better performance with the state-of-the-art algorithmic baseline when $N = 2 0$ , and a comparative performance when $N = 3 0$ . We also outperformed any learning-based baselines with a large margin.
59
+
60
+ # 53 2 Related work
61
+
62
+ 54 Despite the recent research interest in deep learning technology, we hardly have a fully differential
63
+ 55 assignment solver. As long as authors know, there are two past attempts to solve assignment problems
64
+ 56 by a fully differential model. $\mathbb { L } 1 \mathbb { \underline { { ( 2 0 1 9 ) } } }$ has tried to solve stable matching by multiple layer perceptrons
65
+ 57 (MLP). Their contribution is in the proposed relaxation of the non-linear stability constraint to a
66
+ 58 differential loss function. However, the MLP is too redundant to learn the assignment strategy without
67
+ 59 overfitting. In addition, the proposed auxiliary loss to maintain the output to be one-to-one matching
68
+ 60 (symmetric doubly stochastic function) overly constrains the solution search space. In this study, we
69
+ 61 propose a parameter-efficient differential model and a weaker but sufficient constraint to output a
70
+ 62 one-to-one matching.
71
+ 63 The second attempt is made by $\boxed { \mathrm { G i b b o n s } ~ e t ~ a l . } \textcircled { 2 0 1 9 } $ , where Deep Bipartite Matching (DBM) is
72
+ 64 proposed. They tested their model with the weapon-target assignment (WTA) problem. WTA is a
73
+ 65 classical NP-hard problem whose state-of-the-art algorithm $( \overline { { \Delta \mathrm { h u j a } ~ e t ~ a l . } } ) \overline { { 2 0 0 7 } } )$ could find optimal
74
+ 66 solution when $N \leq 2 0$ in the experiment although there is no theoretical guarantee. In this sense,
75
+ 67 we can consider WTA is empirically easier than sex-equal stable matching, for which we have no
76
+ 68 such efficient solvers even for $N = 5$ . In addition, DBM is trained in a supervised manner or with
77
+ 69 reinforcement learning, which is hard to apply to a larger $N$ . Furthermore, the implementation details
78
+ 70 are not completely explained, and their dataset and source codes are not publicly available. Finally,
79
+ 71 the architecture of DBM is still parameter-redundant, and their local structure is sub-optimal. In this
80
+ 72 study, we propose a more parameter-efficient two-stream architecture, WeaveNet, with a novel local
81
+ 73 structure, set-encoder, both of which have significant impacts on the performance.
82
+ 74 In addition to the above methods, it is natural to consider using graph convolutional networks (GCNs).
83
+ 75 However, there are no GCN methods for assignment problems due to the over-smoothing problem (Li
84
+ 76 et al., 2018; Oono and Suzuki, 2020). Because any graph-convolutional layer summarizes the output
85
+ 77 with neighboring nodes, its smoothing effect eliminates expressive power for node classification. To
86
+ 78 avoid such elimination, GIN $\textcircled | \textcircled { \times } { } \textcircled { e t } { } a l . \textcircled { 2 0 1 9 } )$ , the state-of-the-art GCN method, stacks only two
87
+ 79 layers for a node classification task. Such elimination is critical for an assignment-problem solver
88
+ 80 because it needs to identify any slight difference through frequent communication among nodes.
89
+ 81 Unlike GIN, our model retains edge-wise features rather than node-wise summaries, which does not
90
+ 82 cause the smoothing problem. Therefore, we can make the model very deep, which any traditional
91
+ 83 graph convolutional networks cannot.
92
+
93
+ # 84 3 Stable matching problem as a benchmark task
94
+
95
+ To evaluate learning-based assignment solvers, we adopt two strongly NP-hard variants of stable matching. They have been actively studied for a long time (Kato, 1993; Iwama et al., 2010; Dworczak,
96
+
97
+ 87 2016; Gupta et al., 2019) and their state-of-the-art algorithm by $\boxed { \mathrm { T z i a v e l i s ~ } e t ~ a l . } ( \boxed { 2 0 1 9 } )$ must be a
98
+ 88 strong baseline against learning-based methods. Hence, we set these two variants as the benchmark
99
+ 89 task for learning-based assignment problems.
100
+ 90 An instance $I$ of a stable matching problem consists of two sets of agents $A$ and $B$ on a bipartite
101
+ 91 graph. Fig. 1 illustrates an example of $I$ . Each agent $a _ { i }$ in $A$ $( 0 < i \leq N )$ has a preference list $p _ { i } ^ { A }$ ,
102
+ 92 which is an ordered set of elements in $B$ and $p _ { i j } ^ { A } = r a n k ( b _ { j } ; p _ { i } ^ { A } )$ is the index of $b _ { j }$ in the list $p _ { i } ^ { A }$ . $a _ { i }$
103
+ 93 prefers $b _ { j }$ to $b _ { j ^ { \prime } }$ if $p _ { i j } ^ { A } < p _ { i j ^ { \prime } } ^ { A }$ . Similarly, each agent $b _ { j }$ in $B ( 0 < j \leq M )$ has a preference list $p _ { j } ^ { B }$ .
104
+
105
+ $$
106
+ \begin{array} { c c l } { { p _ { i } ^ { A } } } & { { \mathrm { a g e n t s } } } & { { \stackrel { \mathrm { m a t c h i n g ~ } m } { \longrightarrow } } } & { { \stackrel { \mathrm { ( b _ { j } ^ { A } ~ . ~ t h i n g ~ } m } { \longrightarrow } } } & { { p _ { j } ^ { B } } } \\ { { \stackrel { } { \cong } } } & { { \{ b _ { 2 } , b _ { 1 } , b _ { 3 } \} } } & { { \stackrel { ( a _ { 1 } ) } { \Longleftrightarrow } } } & { { \stackrel { ( b _ { 1 } ) } { \longleftrightarrow } } } & { ( b _ { 3 } , a _ { 2 } , a _ { 1 } \} } \\ { { \stackrel { \circleddash } { \geq } } } & { { \{ b _ { 3 } , b _ { 2 } , b _ { 1 } \} } } & { { \stackrel { \circleddash } { \Longleftrightarrow } } } & { { \stackrel { \circleddash } { \sum } } } & { { \{ a _ { 1 } , a _ { 2 } , a _ { 3 } \} } } \\ { { \stackrel { \circleddash } { \subseteq } } } & { { \{ b _ { 2 } , b _ { 3 } , b _ { 1 } \} } } & { { \stackrel { \circleddash } { \binom { a _ { 3 } } { 3 } } } } & { { \stackrel { \mathrm { m e t h i n g ~ p a r i n g ~ } m } { \uparrow \mathrm { t h e ~ b l o c k i n g ~ p a i r ~ } m } \stackrel { ( b _ { 3 } ) } { \{ a _ { 1 } , a _ { 3 } , a _ { 2 } \} } } } & { { \stackrel { \circleddash } { \sum } } } \end{array}
107
+ $$
108
+
109
+ Figure 1: An example of assignment, where $m$ (black edges) is not stable due to the blocking pair (the orange edge), while $m ^ { \prime }$ (green edges) is stable.
110
+
111
+ 94 For a matching $m$ , we say that an unmatched pair $\{ a _ { v } , b _ { w } \} ( m _ { v w } = 0 )$ blocks $m$ if $a _ { v }$ ’s partner
112
+ 95 $b _ { j }$ $m _ { v j } = 1 )$ ) and $b _ { w }$ ’s partner $a _ { i }$ ( $m _ { i w } = 1 $ ) satisfy the conditions $p _ { v w } ^ { A } < p _ { v j } ^ { A }$ and $p _ { w v } ^ { B } < p _ { w i } ^ { B ^ { \ast } }$ . Here,
113
+ 96 $\{ a _ { v } , b _ { w } \}$ is called a blocking pair (the orange edge blocks a matching of black edges in the figure).
114
+ 97 A matching is stable if (and only if) it includes no blocking pair (the green edges in the figure). Note
115
+ 98 that $I$ always has at least one stable matching, and the Gale-Shapley (GS) algorithm can find it in
116
+ 99 $O ( N ^ { 2 } )$ . However, the GS algorithm has a biased nature, where one side is prioritized and the other
117
+ 100 side only gets the least preferable result among all the possibilities of stable matching.
118
+ 101 To compensate for the unfairness, we can introduce diverse objectives to maintain a stable matching
119
+ 102 fair. Among them, the following two objectives make the stable matching problem strongly NP-hard.
120
+ 103 The first one is Sex equality cost $( S E q )$ (Gusfield and Irving, 1989). It focuses on the unfairness
121
+ 104 brought by the gap between the two sides’ satisfaction and defined by
122
+
123
+ $$
124
+ S E q ( m ; I ) = | P ( m ; A ) - P ( m ; B ) | , \quad P ( m ; A ) = \sum _ { \{ a _ { i } , b _ { j } \} \in m } p _ { i j } ^ { A } , \quad P ( m ; B ) = \sum _ { \{ a _ { i } , b _ { j } \} \in m } p _ { j i } ^ { B } .
125
+ $$
126
+
127
+ 105 The other is Balance cost $( B a l ) \ : \big ( \mathrm { \mathbb { F } \mathrm { e d e r } } \big \vert \big \vert 1 9 9 5 ; \big \vert \mathrm { G u p t a \it e t \ : a l . } \big \vert 2 0 1 9 \big ) .$ , which is a compromise between
128
+ 106 side-equality and overall satisfaction. It is defined by
129
+
130
+ $$
131
+ B a l ( m ; I ) { = } \operatorname* { m a x } ( P ( m ; A ) , P ( m ; B ) ) .
132
+ $$
133
+
134
+ 107 In the proposed evaluation protocol, we minimize either cost while maintaining stable one-to-one
135
+ 108 matching.
136
+ 109 Input and output data format for stable matching Learning-based approximation is realized by
137
+ 110 a trainable function $F$ that outputs a matching $\hat { m } \in [ 0 , 1 ] ^ { N \times \widetilde { M } }$ , which is an $N \times M$ matrix. As
138
+ 111 for the input, the value range of the preference rank depends on the problem size, which causes a
139
+ 112 range shift of the input distribution. To avoid such shift, we linearly re-scal $ { \mathrm { e } } ^ { 3 }$ the rank of preference
140
+ 113 $p _ { i j } ^ { * }$ $\mathbf { \Psi } ^ { \prime } * \in \{ A , B \} )$ from $[ 1 , N ]$ to a normalized score $s _ { i j } ^ { * }$ ranged in $( 0 , 1 ]$ to make it invariant to $N$ ,
141
+ 114 where 1 for the highest rank. Then, we obtain the input as matrices $S ^ { A }$ and $S ^ { B }$ , where $s _ { i j } ^ { A }$ is the
142
+ 115 $i j$ -element of $S ^ { A }$ .
143
+
144
+ # 116 4 Deep-learning-based fair stable matching with WeaveNet
145
+
146
+ # 4.1 WeaveNet
147
+
148
+ 18 One of the required properties of $F : ( S ^ { A } , \ S ^ { B } ) \to { \hat { m } }$ is to take all the agents’ preference into 19 account when determining the presence of each edge in the output $\hat { m }$ . Li (2019) implemented this by 3 The details of this linear re-scaling are based on Li $\textcircled { 2 0 1 9 }$ and described in A.1. Note that sections numbered with capital letters appear in the supplementary material.
149
+
150
+ ![](images/52beb3ce9d8cda69fe2150a714213608ef978ab0c72dceb0d8d4156dca5b9b6b.jpg)
151
+ Figure 2: WeaveNet architecture. $L$ feature weaving layers are stacked with shortcut paths to be a deep network. The encoded features are fed into Conv $( 1 \times 1 )$ layer to obtain logits $( { \hat { m } } ^ { \prime } { } ^ { \hat { A } } , { \hat { m } } ^ { \prime B } )$ . The output $\hat { m }$ will be binarized in prediction phase to represent a matching.
152
+
153
+ 120 MLPs, where $S ^ { A }$ and $S ^ { B }$ are destructured and concatenated into a single flat vector (with the length
154
+ 121 of $2 N M )$ and fed to the MLP. Its output (a flat vector with the length of $N M$ ) is restructured into a
155
+ 122 matrix $\hat { m }$ . The MLP model, however, would face difficulties due to the following four problems.
156
+ 123 (a) Preference lists of multiple agents are encoded by independent parameters, though they share a
157
+ 124 format so that we could efficiently process them in the same manner.
158
+ 125 (b) MLP only supports a fixed-size input, so training different models for different cases of $N$
159
+ 126 becomes mandatory.
160
+ 127 (c) $F$ should be permutation invariant, which means the matching result should be unchanged even if
161
+ 128 we shuffle the order of agents in $S ^ { A }$ and $S ^ { B }$ , but MLP does not satisfy.
162
+ 129 (d) A shallow MLP model may be insufficient to approximate an exact solver for the NP-hard problem
163
+ 130 when $N$ is large.
164
+ 131 To address the above weaknesses of MLP, we propose the feature weaving network (WeaveNet) which
165
+ 132 has the properties of (a) shared encoder, (b) variable-size input, (c) permutation invariance, and
166
+ 133 (d) residual structure. The WeaveNet, as shown in Fig. $2 ,$ consists of $L$ feature weaving (FW)
167
+ 134 layers. It has two streams of $A$ and $B$ . In a symmetric manner, each stream models the agent’s act of
168
+ 135 selecting the one on the opposite side while sharing weights to enhance the parameter efficiency. The
169
+ 136 shortcut paths at every two FW layers make them residual blocks, which allows the model to be as
170
+ 137 deep as possible. We explain its details as follows.
171
+ 138 Fig. $3$ illustrates the detail of a single FW layer, which is the core architecture of the proposed network.
172
+ 139 FW layer is a two-stream layer whose inputs consist of a weftwise component $Z _ { \ell } ^ { \dot { A } }$ and a warpwise
173
+ 140 component $Z _ { \ell } ^ { B }$ , which are the output of $( l - 1 )$ -th layer and $Z _ { 0 } ^ { A } = { \cal S } ^ { A }$ and $Z _ { 0 } ^ { B } = { \cal S } ^ { B }$ for the first
174
+ 141 layer. The two components are symmetrically concatenated in each stream (cross-concatenation).
175
+ 142 Then these concatenations are separated into agent-wise features, each of which is a set of outgoing
176
+ 143 edge features of an agent (indicating the preference from that agent to every matching candidate).
177
+ 144 These features are processed by the encoder $E _ { \ell }$ shared by every agent in both $A$ and $B$ . As for
178
+ 145 an encoder that can embed variable-size input in a permutation invariant manner, we adopted the
179
+ 146 structure inspired by DeepSet (Zaheer et al., 2017) and PointNet (Qi et al., 2017) (Fig. 4), which
180
+ 47 consists of two convolutional layers with kernel size 1 and a set-wise max-pooling layer, followed by
181
+ 48 batch-normalization and PReLU activation. We refer to this structure as set encoder.
182
+ 149 Mathematical formulations $Z _ { \ell } ^ { A }$ in Fig. $\bigstar$ is a third-order tensor whose dimensions, in sequence,
183
+ 150 corresponding to the agent, candidate, and feature dimension, with a size of $( N , M , D )$ . Similarly,
184
+ 151 $Z _ { \ell } ^ { B }$ has a size of $( M , N , D )$ . The cross-concatenation is defined as
185
+
186
+ ![](images/9417b65197616b5b5286bdb81e8ecf41b452ea48e56713da6b584a9e3a5bf150.jpg)
187
+ Figure 3: Feature weaving layer orthogonally Figure 4: Illustration of the process in set enconcatenates the weftwise and warpwize com- coder $E _ { \ell }$ , where $z _ { \ell } ^ { a _ { i } }$ (colored in white) is once ponents $( Z _ { \ell } ^ { A }$ and $Z _ { \ell } ^ { B }$ ) in a symmetric way encoded to $D ^ { \prime }$ \` channel features (colored in pale (cross-concatenation). Then, the concatenated blue), then max-pooled to obtain statistics in the tensors are separated into $z _ { \ell } ^ { a _ { i } }$ (or $z _ { \ell } ^ { b _ { j } }$ ), which feature set (colored in blue). The statistics inrepresents a set of outgoing edges from agent formation is concatenated to each input feature $a _ { i }$ (or $b _ { j }$ ), and independently fed to $E _ { \ell }$ . and further encoded (color in a gradation).
188
+
189
+ $$
190
+ Z _ { \ell } ^ { \prime A } = c a t ( Z _ { \ell } ^ { A } , P _ { A B } ( Z _ { \ell } ^ { B } ) ) ,
191
+ $$
192
+
193
+ 152 where $P _ { A B }$ swaps the first and second dimensions of the tensor, and $c a t ( \{ Z _ { 1 } , Z _ { 2 } , . . . \} )$ concatenates
194
+ 153 the features of two tensors $Z _ { 1 }$ , $Z _ { 2 }$ . $Z _ { \ell } ^ { \prime A }$ is then sliced into agent-wise features $z _ { \ell } ^ { a _ { i } }$ and we obtain
195
+ 154 $Z _ { \ell + 1 } ^ { A } = ( E _ { \ell } ( z _ { \ell } ^ { a _ { i } } ) | 0 < i \leq N )$ , which is also a third-order tensor (and fed to the next layer). We can
196
+ 155 calculate $Z _ { \ell + 1 } ^ { B }$ in a symmetric manner (with the same encoder $E _ { \ell }$ ).
197
+ 156 After the process of $L$ FW layers, $Z _ { L } ^ { A }$ and $Z _ { L } ^ { B }$ are further cross-concatenated and fed to the matching
198
+ 157 estimator (in Fig. 2). It outputs a non-deterministic edge assignment $\hat { m }$ . In the training phase, $\hat { m }$
199
+ 158 is input to an objective function, and the loss is minimized. In the prediction phase, the matching
200
+ 159 is obtained by binarizing $\hat { m }$ . In this sense, matching estimation through a neural network can be
201
+ 160 considered as an approximation by relaxing the binary assignment space $\{ \breve { 0 } , 1 \} ^ { N \times M }$ into a continuous
202
+ 161 assignment space [0, 1] N⇥M .
203
+ 162 Asymmetric variant with split batch normalization WeaveNet is designed to be fully symmetric
204
+ 163 for $S ^ { A }$ and $S ^ { B }$ . Hence, it satisfies the equation $F ( S ^ { A } , S ^ { B } ) = F ( S ^ { B } , S ^ { A } ) ^ { \top }$ . This condition ensures
205
+ 164 that the model architecture cannot distinguish the two sides $A$ and $B$ innately. This property is
206
+ 165 beneficial when mathematically fair treatment between $A$ and $B$ is desirable. However, when inputs
207
+ 166 from $A$ and $B$ are differently biased (e.g., the two sides have different trends of preference or the
208
+ 167 objective is asymmetric for $A$ and $B$ ), this symmetric treatment degrades the performance. To
209
+ 168 eliminate the bias difference without losing the parameter-efficiency, we further propose to a) apply
210
+ 169 batch normalization independently for each stream (split batch normalization), and $\mathbf { b }$ ) adding a
211
+ 170 side-identifiable code (e.g., 1 for $A$ and 0 for $B$ ) to $Z _ { 0 } ^ { A }$ and $Z _ { 0 } ^ { B }$ as a $( D { + } 1 )$ -th element of the feature.
212
+ 171 We call this variant “asymmetric”.
213
+
214
+ # 4.2 Relaxed continuous optimization for fair stable matching
215
+
216
+ Generally, a combinatorial optimization problem has discrete objective functions and conditions, which are not differentiable. To optimize the model in an end-to-end manner without inaccessible ground truth, we optimize the model by relaxing such discrete loss functions into continuous ones.
217
+
218
+ 76 Assume we target to obtain a fair stable matching that has the minimum $S E q$ , for example. Then, we
219
+ 77 have the following three loss functions.
220
+ 178 ${ \mathcal { L } } _ { m }$ conditions the binarization of $\hat { m }$ to represent a matching.
221
+ 179 $\mathcal { L } _ { s }$ conditions the matching to be stable.
222
+ 180 $\mathcal { L } _ { f }$ minimizing the fairness cost $S E q$ of the matching
223
+
224
+ 181 The overall loss function is defined as
225
+
226
+ $$
227
+ \mathcal { L } _ { \mathrm { f s m } } ( \hat { m } ) = \lambda _ { m } \mathcal { L } _ { m } + \frac { 1 } { 2 } \sum _ { m \in \{ \hat { m } ^ { A } , \hat { m } ^ { B } \} } \big ( \lambda _ { s } \mathcal { L } _ { s } ( m ) + \lambda _ { f } \mathcal { L } _ { f } ( m ) \big ) ,
228
+ $$
229
+
230
+ where 182 $\hat { m } ^ { A } = \mathrm { s o f t m a x } ( \hat { m } )$ and $\hat { m } ^ { B } = \mathrm { s o f t m a x } ( \hat { m } ^ { \top } )$
231
+
232
+ 183 An important advantage of learning-based approximation is its flexibility. We can modify the above
233
+ 184 loss functions to easily obtain other variants. For example, removing $\mathcal { L } _ { f }$ in Eq. $( 4 )$ leads to standard
234
+ 185 stable matching, and replacing $\mathcal { L } _ { f }$ with $\mathcal { L } _ { b }$ (which minimizes $B a l$ ) leads to balanced stable matching,
235
+ 186 as follows:
236
+
237
+ $$
238
+ \begin{array} { r l } & { \mathcal { L } _ { \mathrm { s m } } ( \hat { m } ) = \lambda _ { m } \mathcal { L } _ { m } + \displaystyle \frac { 1 } { 2 } \sum _ { m \in \{ \hat { m } ^ { A } , \hat { m } ^ { B } \} } \lambda _ { s } \mathcal { L } _ { s } ( m ) , } \\ & { \mathcal { L } _ { \mathrm { b s m } } ( \hat { m } ) = \lambda _ { m } \mathcal { L } _ { m } + \displaystyle \frac { 1 } { 2 } \sum _ { m \in \{ \hat { m } ^ { A } , \hat { m } ^ { B } \} } \big ( \lambda _ { s } \mathcal { L } _ { s } ( m ) + \lambda _ { b } \mathcal { L } _ { b } ( m ) \big ) . } \end{array}
239
+ $$
240
+
241
+ 187 One-to-one matching constraint $\hat { m }$ can be safely converted into a binarized matching by column
242
+ 188 wise or row-wise argmax operation when it is a symmetric doubly stochastic matrix $\check { ( \mathbb { L 1 } , \lfloor 2 0 1 9 \rangle ) }$ . To
243
+ 189 satisfy this condition, we defined ${ \mathcal { L } } _ { m }$ with an average of the cosine distance as
244
+
245
+ $$
246
+ \begin{array} { r l } & { \mathcal { L } _ { m } ( \hat { m } ^ { A } , \hat { m } ^ { B } ) = 1 - \displaystyle \frac { 1 } { 2 } ( \mathbf { C } ( \hat { m } ^ { A } , \hat { m } ^ { B } ) + \mathbf { C } ( \hat { m } ^ { B } , \hat { m } ^ { A } ) ) , } \\ & { \mathbf { C } ( \hat { m } ^ { A } , \hat { m } ^ { B } ) = \displaystyle \frac { 1 } { N } \sum _ { i = 0 } ^ { N } \frac { \hat { m } _ { i * } ^ { A } \cdot \hat { m } _ { * i } ^ { B } } { \| \hat { m } _ { i * } ^ { A } \| _ { 2 } \| \hat { m } _ { * i } ^ { B } \| _ { 2 } } , } \end{array}
247
+ $$
248
+
249
+ 190 where $\hat { m } _ { i * } ^ { A }$ means the $i$ -th row of $\hat { m } ^ { A }$ . This formulation binds $\hat { m }$ to be a symmetric4 doubly stochastic
250
+ 191 ⇤ matrix when $\mathcal { L } _ { m } ( \hat { m } ^ { A } , \hat { m } ^ { B } ) = 0$ . The advantage of this implementation against the original one in Li
251
+ 192 $\textcircled { 2 0 1 9 }$ is described in $\boxed { \mathbf { B . l } }$ with additional experimental results.
252
+
253
+ 193 Blocking pair suppression As for $L _ { s }$ , we used the function proposed in Li $\textcircled { 2 0 1 9 }$ , which is
254
+
255
+ $$
256
+ \begin{array} { c } { { \mathcal { L } _ { s } ( \hat { m } ; I ) = \displaystyle \sum _ { ( v , w ) \in A \times B } g ( a _ { v } ; b _ { w } , \hat { m } ) g ( b _ { w } ; a _ { v } , \hat { m } ) } } \\ { { g ( a _ { i } ; b _ { w } , \hat { m } ) = \displaystyle \sum _ { b _ { j } \ne b _ { w } } \hat { m } _ { i j } \cdot \operatorname * { m a x } ( S _ { i w } ^ { A } - S _ { i j } ^ { A } , 0 ) } } \\ { { g ( b _ { j } ; a _ { v } , \hat { m } ) = \displaystyle \sum _ { a _ { i } \ne a _ { v } } \hat { m } _ { j i } ^ { \top } \cdot \operatorname * { m a x } ( S _ { j v } ^ { B } - S _ { j i } ^ { B } , 0 ) , } } \end{array}
257
+ $$
258
+
259
+ 194 where $g ( a _ { i } ; b _ { w } , \hat { m } )$ is a criterion known as ex-ante justified envy, which has a positive value when
260
+ 195 $a _ { i }$ prefers $b _ { w }$ more than any $b _ { j }$ in $\{ b _ { j } | j \neq w , \hat { m } _ { i j } \stackrel { . } { > } 0 \}$ . This is the same for $g ( b _ { j } ; a _ { v } , \hat { m } )$ . Hence,
261
+ 196 $\{ a _ { v } , b _ { w } \}$ becomes a (soft) blocking pair when both $g ( a _ { v } ; b _ { w } , \hat { m } )$ and $g ( b _ { w } ; a _ { v } , \hat { m } )$ are positive.
262
+
263
+ 197 Fairness measurements $\mathcal { L } _ { f } , \mathcal { L } _ { b }$ minimize $S E q ( m ; I ) , B a l ( m ; I )$ , respectively, and are defined as
264
+
265
+ $$
266
+ \mathcal { L } _ { f } ( \hat { m } ; I ) = \frac { 1 } { N } | S ( \hat { m } ; A ) - S ( \hat { m } ; B ) | \quad \mathcal { L } _ { b } ( \hat { m } ; I ) = - \frac { 1 } { N } \mathrm { m i n } ( S ( \hat { m } ; A ) , S ( \hat { m } ; B ) ) ,
267
+ $$
268
+
269
+ 198 where
270
+
271
+ $$
272
+ S ( \hat { m } ; A ) = \sum _ { i = 1 } ^ { N } \sum _ { i = j } ^ { M } \hat { m } _ { i j } \cdot S _ { i j } ^ { A } , ~ S ( \hat { m } ; B ) = \sum _ { j = 1 } ^ { M } \sum _ { i = 1 } ^ { N } \hat { m } _ { i j } \cdot S _ { j i } ^ { B } .
273
+ $$
274
+
275
+ # 199 5 Experiments
276
+
277
+ 200 We evaluated WeaveNet with different sizes of $N$ . First, with test samples of $N < 1 0$ , we compared
278
+ 201 its performance with learning-based baselines and optimal solutions obtained by a brute-force search.
279
+ 202 Second, we compared WeaveNet with algorithmic baselines at $N = 2 0$ , 30, where neither existing
280
+ 203 learning-based methods nor brute-force search work. We also demonstrated the generalization ability
281
+ 204 of WeaveNet under the mismatched training/test dataset distributions. Third, we demonstrated the
282
+ 205 performance of WeaveNet at $N = 1 0 0$ . Note that we always assume $M = N$ hereafter.
283
+
284
+ Sample generation protocol In the experiments, we used the same method as Tziavelis et al.
285
+ $\bar { ( 2 0 1 9 ) }$ to generate synthetic datasets that draw preference lists from the following distributions.
286
+
287
+ Uniform (U) Each agent’s preference towards any matching candidate is totally random, defined by a uniform distribution $\mathcal { U } ( 0 , 1 )$ (larger value means prior in the preference list).
288
+
289
+ Discrete $\mathbf { \eta } ^ { ( \mathbf { D } ) }$ Each agent has a preference of $\mathcal { U } ( 0 . 5 , 1 )$ towards a certain group of $\lfloor 0 . 4 N \rfloor$ popular candidates, while $\mathcal { U } ( 0 , 0 . 5 )$ towards the rest.
290
+
291
+ Gauss (G) Each agent’s preference towards $i$ -th candidate is defined by a Gaussian distribution $\mathcal { N } ( i / N , 0 . 4 )$ .
292
+
293
+ LibimSeTi (Lib) Simulate real rating activity on the online dating service LibimSeTi (Brozovsky and Petricek, 2007) based on the 2D distribution of frequency of each rating pair $( p _ { i j } ^ { A } , ~ p _ { j i } ^ { B } )$ .
294
+
295
+ 4 Here a (possibly non-square) matrix $\hat { m }$ $N \geq M )$ is symmetric if and only if $\hat { m } _ { i * } = \hat { m } _ { * i } , ( 0 < i \leq M )$
296
+
297
+ 216 Choosing the above preference distributions for group $A$ and $B$ respectively, we obtained five different
298
+ 217 dataset settings, namely UU, DD, GG, UD, and Lib. We randomly generated 1,000 test samples and
299
+ 218 1,000 validation samples for each of the five distribution settings.
300
+ 219 Training protocol We trained any learning-based models $2 0 0 \mathrm { k }$ total iterations at $N \leq 3 0$ and $3 0 0 \mathrm { k }$
301
+ 220 at $N = 1 0 0$ , with a batch size of 8. We randomly generated training samples at each iteration based
302
+ 221 on the distribution of each dataset and used the Adam optimizer (Kingma and Ba, 2015). We set
303
+ 222 learning rate 0.0001 and loss weights $\lambda _ { s } = 0 . 7$ , $\lambda _ { m } = 1 . 0$ , $\lambda _ { f } = \lambda _ { b } ^ { - } = 0 . 0 1$ based on a preliminary
304
+ 223 experiment (see $\underline { { \overline { { | \mathbf { A . } 4 } } \mathbf { ) } } }$ .
305
+ 224 Pseudo fairness costs for comparing learning-based results with algorithmic results Note that
306
+ 225 for learning-based methods, there is a trade-off between fairness scores and stable matching rate.
307
+ 226 Hence they may violate the constraints of stable one-to-one matching and yield an $S E q$ or $B a l$ even
308
+ 227 lower than the ideal value. To compare the methods fairly with traditional algorithmic methods, we
309
+ 228 evaluate our methods using pseudo $S E q \ ( p S E q )$ and pseudo Bal $( p B a l )$ cost, in which the cost of
310
+ 229 violation cases is replaced by the worst result of the GS algorithm (prioritizing each side once and
311
+ 230 adopting the worse one).
312
+
313
+ # 5.1 Comparison with learning-based methods $( N = 3 , 5 , 7 , 9 )$
314
+
315
+ Baselines and ablations In this experiment, we show results obtained by following baselines and WeaveNet variants. MLP is the model proposed in Li (2019). GIN is the state-of-the-art GCN model proposed in $\left| \mathrm { X u } \ e t \ a l . \right| \left( \mathbb { 2 0 } 1 9 \right)$ . We use each (normalized) preference list as a node feature and bipartite edges as the graph structure. After two graph-convolution calculations, as MLP, we destructed the node-wise embeddings and concatenated them into a single vector, which is fed to one Linear layer to output $\hat { m }$ . DBM is the model in Gibbons et al. (2019). SSWN is the single-stream WeaveNet, which is equivalent to a DBM adopting the set-encoder of WeaveNet. WN is the standard WeaveNet.
316
+
317
+ ![](images/1b2593afc1b1b2178d6e13c5b44d30776c7951a7ed534fe8969eaed4c4d4204b.jpg)
318
+ Figure 5: Change of the success rates of stable matching $( \uparrow )$ according to $N$
319
+
320
+ ![](images/3efed6a27f3e0ea5f76aedeec8ce97d7e56ffe986c8c73d26d110994f22f0fa9.jpg)
321
+ Figure 6: Change of $p S E q -$ ideal scores $( \downarrow )$ according to $N$ .
322
+
323
+ ![](images/23cb3aa0f4e1b9312c130ed61b539657cba37a7cc30dda2800a6d347c6961716.jpg)
324
+ Figure 7: Change of $p B a l -$ ideal scores $( \downarrow )$ according to $N$ .
325
+
326
+ 239 Fig. $5$ shows the success rates of finding a stable matching, where we trained models to minimize
327
+ 240 Eq. $\textcircled{5}$ , considering only the stable matching constraints. Since MLP and GIN have size-dependency,
328
+ 241 we trained the models independently for $N = 3$ , 5, 7, 9. The other models were trained with
329
+ 242 $N = 1 0$ and tested on $N = 3$ , 5, 7, 9. We maintained models with $L = 6$ layers (the model names
330
+ 243 are noted as XXX-6) to have a similar number of parameters with MLP for $N = 5$ (see $\underline { { \vert \bar { \mathbf { A . } } \bar { \mathbf { \xi } } ) } }$ , while
331
+ 244 WN-18 is prepared to demonstrate the full performance (with the residual blocks).
332
+ 245 MLP and GIN can hardly find stable matchings when $N \geq 5$ . Note that the number of total cases for
333
+ 246 size $N$ instances is estimated by $N ! ^ { 2 ( N - 1 ) }$ . Hence, when $N = 3$ , there are only 1,296 cases at most,
334
+ 247 and the test set will fully overlap with the training set. In contrast, when $N = 5$ , we have $4 . 3 \times 1 0 ^ { 1 6 }$
335
+ 248 cases, and the overlap is negligible. Therefore, we can say that methods working only with $N = 3$
336
+ 249 such as MLP and GIN, have little generalization ability.
337
+ 250 DBM performs better than MLP but obviously worse than SSWN and WN. The performance gain of
338
+ 251 SSWN-6 over DBM-6 represents the advantage of the set-encoder. Similarly, the improvement of
339
+ 252 WN-6 over SSWN-6 shows the benefit of the two-stream architecture. Finally, that of WN-18 over
340
+ 253 WN-6 demonstrates the impact of stacked layers on the performance. Fig. 15 of the appendix shows
341
+ 54 some additional baselines, including a performance of our $L _ { m }$ against the original one proposed in Li
342
+ 55 $( \overline { { 2 0 1 9 } } )$ .
343
+
344
+ Figs. 6 and $\textcircled { 7 }$ show ${ p S E q }$ and $p B a l$ (their difference from the ideal values5 ), respectively. XXX-18f/b are trained to minimize Eqs. $\bar { ( 4 ) }$ and $\textcircled{6}$ , respectivel ${ \boldsymbol { \imath } } ^ { 6 } .$ We omitted MLP and GIN due to their poor performance in Fig. 5. In the results, both SSWN and WN largely outperformed DBM, which again proved the advantage of the set-encoder. WN performed better than SSWN for larger $N$ , owing to the parameter efficiency of the two-stream architecture. Note that the performance gain of XXX-18f/b from XXX-18 proved the flexibility of general learning-based methods for customized objective functions.
345
+
346
+ # 5.2 Comparison with algorithmic methods $N = 2 0$ , 30)
347
+
348
+ As the algorithmic methods, we prepared four baselines. GS is the better result of applying the GS algorithm to prioritize each side once, which runs in $O ( N ^ { 2 } )$ . PolyMin minimizes some alternative fairness costs (the regret and egalitarian costs, which can be solved in $O ( N ^ { 2 } )$ and $\underline { { O } } ( N ^ { 3 } )$ , respectively (Gusfield, 1987; Irving et al., 1987; Feder, 1992)). DACC by $\boxed { \mathrm { D w o r c z a k } } ( \boxed { 2 0 1 6 } )$ is an approximate algorithm that runs in $\overline { { O ( N ^ { 4 } ) } }$ . PowerBalance is the state-of-the-art method that runs in $\mathcal { \hat { O } } ( N ^ { 2 } )$ .
349
+
350
+ WN-60f/b(20/30) is WeaveNet with $L = 6 0$ layers trained with samples of $N = 2 0$ and $N = 3 0$ . Note that we used the asymmetric variant for UD and Lib. Moreover, we do not involve any traditional learning-based methods in this part since they scored clear performance drops with increasing $N$ (see Fig. $5 )$ and the problem size of $N = 2 0$ , 30 is clearly beyond their capabilities, but an ablation with WeaveNet variants is reported in B.2.
351
+
352
+ Table 1: Average $S E q$ (#) and success rate of stable matching ("). Bold and underlined scores shows the best and second best ones, respectively.
353
+
354
+ <table><tr><td rowspan="2">Agents (N × M) Datasets (Dist. Type)</td><td colspan="4">20 × 20</td><td rowspan="2"></td><td colspan="5">30 × 30</td></tr><tr><td>UU</td><td>DD</td><td>GG</td><td>UD</td><td>Lib UU</td><td>DD</td><td>GG</td><td>UD</td><td>Lib</td></tr><tr><td>GS</td><td>41.89</td><td>18.81</td><td>19.52</td><td>70.97</td><td>19.66</td><td>94.03</td><td>43.46</td><td>36.56</td><td>163.77</td><td>39.78</td></tr><tr><td>PolyMin</td><td>19.93</td><td>11.83</td><td>20.57</td><td>87.08</td><td>18.47</td><td>35.52</td><td>21.21</td><td>37.37</td><td>209.62</td><td>31.85</td></tr><tr><td>DACC</td><td>24.34</td><td>20.13</td><td>23.07</td><td>101.75</td><td>20.40</td><td>40.87</td><td>34.35</td><td>40.59</td><td>240.48</td><td>33.88</td></tr><tr><td>Power Balance</td><td>16.28</td><td>8.93</td><td>17.07</td><td>71.09</td><td>15.40</td><td>18.45</td><td>11.05</td><td>27.22</td><td>163.90</td><td>21.57</td></tr><tr><td>WN-60f(20) (pSEq)</td><td>12.23</td><td>6.37</td><td>15.50</td><td>71.31</td><td>14.59</td><td>25.21</td><td>11.38</td><td>29.36</td><td>172.63</td><td>23.53</td></tr><tr><td>Stably Matched (%)</td><td>98.90</td><td>99.50</td><td>99.40</td><td>99.60</td><td>99.30</td><td>94.60</td><td>97.30</td><td>95.70</td><td>91.30</td><td>97.70</td></tr><tr><td>WN-60f(30) (p SEq)</td><td>12.16</td><td>6.53</td><td>15.56</td><td>71.34</td><td>14.53</td><td>18.30</td><td>10.52</td><td>27.39</td><td>170.35</td><td>22.17</td></tr><tr><td>Stably Matched (%)</td><td>99.10</td><td>99.40</td><td>99.40</td><td>99.50</td><td>99.80</td><td>98.10</td><td>99.00</td><td>98.00</td><td>93.90</td><td>98.60</td></tr></table>
355
+
356
+ Table 2: Average Bal (#) and success rate of stable matching (").
357
+
358
+ <table><tr><td rowspan="2">Agents (N × M) Datasets (Dist. Type)</td><td colspan="4">20×20</td><td colspan="6"></td></tr><tr><td>UU</td><td>DD</td><td>GG</td><td>UD</td><td>Lib</td><td>UU</td><td>DD</td><td>30×30 GG</td><td>UD</td><td>Lib</td></tr><tr><td>GS</td><td>89.14</td><td>146.16</td><td>108.36</td><td>140.53</td><td>68.62</td><td>184.05</td><td>322.05</td><td>225.49</td><td>312.12</td><td>137.59</td></tr><tr><td>PolyMin</td><td>74.19</td><td>140.99</td><td>108.04</td><td>145.28</td><td>66.94</td><td>144.48</td><td>306.28</td><td>224.13</td><td>324.54</td><td>130.79</td></tr><tr><td>DACC</td><td>78.49</td><td>146.71</td><td>110.06</td><td>151.34</td><td>68.75</td><td>150.71</td><td>316.18</td><td>227.52</td><td>337.43</td><td>133.59</td></tr><tr><td>Power Balance</td><td>73.28</td><td>140.12</td><td>106.92</td><td>140.55</td><td>65.89</td><td>138.04</td><td>302.30</td><td>220.26</td><td>312.12</td><td>126.96</td></tr><tr><td>WN-60b(20) (pBal)</td><td>71.89</td><td>138.79</td><td>106.20</td><td>140.84</td><td>65.85</td><td>141.49</td><td>302.73</td><td>221.92</td><td>317.60</td><td>130.58</td></tr><tr><td>Stably Matched (%)</td><td>98.50</td><td>98.80</td><td>99.50</td><td>99.70</td><td>98.80</td><td>96.10</td><td>96.70</td><td>95.00</td><td>88.90</td><td>93.80</td></tr><tr><td>WN-60b(30) (pBal)</td><td>72.33</td><td>138.75</td><td>106.65</td><td>140.79</td><td>65.84</td><td>140.40</td><td>301.59</td><td>223.02</td><td>313.59</td><td>127.93</td></tr><tr><td>Stably Matched (%)</td><td>98.00</td><td>99.10</td><td>98.60</td><td>99.80</td><td>99.10</td><td>97.00</td><td>98.60</td><td>93.70</td><td>98.80</td><td>98.00</td></tr></table>
359
+
360
+ 274 We show the results in Tables 1 and 2. When $N = 2 0$ , except for UD, the proposed method constantly
361
+ 275 performed better than any algorithmic methods for both $S E q$ and $B a l$ . When $N = 3 0$ , they are
362
+ 276 comparative. For UD, GS performed even better than PowerBalance. That means that the ideal
363
+ 277 solution constantly prioritizes one side (a kind of the strongest bias). Since we designed the WeaveNet
364
+ 278 architecture to treat the sides evenly, this is the most challenging situation for WeaveNet. Nonetheless,
365
+ 279 the proposed split batch normalization (with the side-identifiable code) achieved similar performance
366
+ 280 to GS and PowerBalance. We show the performance drop with the fully symmetric version in ${ \bf B } . 2$
367
+ 281 of the appendix, which is also interesting from the ethical viewpoint. It is noteworthy that the
368
+ 282 model trained with $N = 2 0$ performs well even with $N = 3 0$ , which indicates that the method has
369
+ 283 generalizability for size difference.
370
+ 284 Generalization ability for different distributions A learning-based method should have a certain
371
+ 285 generalizability for input distribution shifts. To test the ability, we evaluated the performance of
372
+ 286 models trained with UU, DD, and GG on test sets of different distributions.
373
+
374
+ Table 3: The generalizability of WeaveNet (trained/tested with $N = 3 0$ ).
375
+
376
+ <table><tr><td>train</td><td>WN-60f</td><td>UU</td><td>test DD</td><td>GG</td><td>Avg.</td></tr><tr><td>UU</td><td>pSEq Stably Matched (%)</td><td>18.30 98.10</td><td>25.81 94.90</td><td>29.09 93.60</td><td>21.10 95.53</td></tr><tr><td>DD</td><td>pSEq Stably Matched (%)</td><td>171.27 2.80</td><td>10.52 99.00</td><td>77.36 0.10</td><td>86.38 33.97</td></tr><tr><td>GG</td><td>pSEq Stably Matched (%)</td><td>21.38 97.30</td><td>12.85 98.10</td><td>27.39 98.00</td><td>20.54 97.80</td></tr></table>
377
+
378
+ Table 4: Average SEq ( ) and Bal ( ) at $N = 1 0 0$ .
379
+
380
+ <table><tr><td>100 × 100,UU</td><td>SEq</td><td>Bal</td></tr><tr><td>GS</td><td>1259.39</td><td>1709.53</td></tr><tr><td>PolyMin</td><td>153.35</td><td>952.85</td></tr><tr><td>DACC</td><td>194.65</td><td>988.02</td></tr><tr><td>Power Balance</td><td>49.41</td><td>909.73</td></tr><tr><td>WN-80f/b+Hungarian</td><td></td><td></td></tr><tr><td>pSEqlpBal</td><td>257.99</td><td>1145.36</td></tr><tr><td>SEqiBal</td><td>68.36</td><td>919.75</td></tr><tr><td>Stably Matched (%)</td><td>89.4</td><td>80.8</td></tr></table>
381
+
382
+ Table $\triangledown$ shows the results. Remarkably, there is a contrast between the model trained with DD and the others. The model with DD could hardly satisfy the one-to-one stable matching constraint when tested on UU/GG, and resulted in poor ${ p S E q }$ scores. In contrast, the model with GG achieved satisfying ${ p S E q }$ scores on UU/DD. Since GG generates preference lists based on a common preference score $( i / N$ for $i$ -th agent) with noise, agents in GG tend to have similar preference lists (i.e., hard to assign optimally). A model trained with such hard samples works well even for the test samples drawn from other distribution. UU has also performed well owing to its non-biased sampling strategy. On the other hand, DD worst performed due to its highly biased generation strategy. From these results, we confirmed that WeaveNet has certain robustness in the distribution shift as long as training samples are competitive enough.
383
+
384
+ # 5.3 Demonstration with $N = 1 0 0$
385
+
386
+ We further demonstrate the capability of WeaveNet under a larger size of problem instances, $N = 1 0 0$ In this case, we found that WN-80f and WN-80b failed to yield one-to-one matchings for $1 3 . 4 \%$ and $1 9 . 8 \%$ , respectively (see the Table 9 in B.2 for details). To compensate for this problem, we applied the Hungarian algorithm (Kuhn, 1955) to surely binarize $\hat { m }$ into a one-to-one matching. Table $^ 4$ shows WeaveNet’s relatively good $\overline { { S E q } }$ and $B a l$ scores. Even with the help of the Hungarian algorithm, they were strongly penalized in ${ p S E q }$ and $p B a l$ due to the poor stable matching rate. In other words, we can potentially fill the large gap by better constraining the output.
387
+
388
+ Since this work is just a pilot study toward a practical differential assignment solver, there is still a lot of space for improvement. The proposed test protocol with stable matching will facilitate it since we can freely adjust the difficulty of the problem to develop and enhance the methods continuously.
389
+
390
+ # 6 Conclusion
391
+
392
+ This paper proposed a novel differential assignment solver, WeaveNet, and an evaluation protocol on two strongly NP-hard variants of stable matching. In the experiments, we demonstrated the advantage of set encoder and the two-stream architecture of Weavenet against the other learning-based methods. These techniques also achieved a better performance than the state-of-the-art algorithmic method when $N = 2 0$ and a comparative performance when $N = 3 0$ . Furthermore, the asymmetric variants, split batch normalization with the side-identifiable code, enabled the method to work even with the strongly biased dataset of UD. We also confirmed that the proposed method does not work at $N = 1 0 0$ , which will be an immediate task for this new field of differential assignment solver. We hope that this work becomes a starting point to open a new vista for real-world assignment problems.
393
+
394
+ 18 References
395
+ 19 Ravindra K Ahuja, Arvind Kumar, Krishna C Jha, and James B Orlin. Exact and heuristic algorithms for the weapon-target assignment problem. Operations research, 55(6):1136–1146, 2007.
396
+ 21 Lukas Brozovsky and Vaclav Petricek. Recommender system for online dating service. In Proceedings of Conference Znalosti 2007, Ostrava, 2007.
397
+ 23 Zhe Cao, Tomas Simon, Shih-En Wei, and Yaser Sheikh. Realtime multi-person 2d pose estimation using part affinity fields. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), July 2017.
398
+ 6 Piotr Dworczak. Deferred acceptance with compensation chains. In Proceedings of the 2016 ACM Conference on Economics and Computation, pages 65–66, 2016.
399
+ 28 Patrick Emami, Panos M. Pardalos, Lily Elefteriadou, and Sanjay Ranka. Machine learning methods for data association in multi-object tracking. ACM Computing Surveys, 53(4), 2020.
400
+ 0 Tomás Feder. A new fixed point approach for stable networks and stable marriages. Journal of Computer and System Sciences, 45(2):233–284, 1992.
401
+ 32 Tomás Feder. Stable networks and product graphs. American Mathematical Society, 1995.
402
+ 33 David Gale and Lloyd S Shapley. College admissions and the stability of marriage. The American Mathematical Monthly, 69(1):9–15, 1962.
403
+ 5 Daniel Gibbons, Cheng-Chew Lim, and Peng Shi. Deep learning for bipartite assignment problems. In Proceedings of IEEE International Conference on Systems, Man and Cybernetics, pages 2318–
404
+ 2325, 2019.
405
+ 38 Sushmita Gupta, Sanjukta Roy, Saket Saurabh, and Meirav Zehavi. Balanced stable marriage: How close is close enough? In Workshop on Algorithms and Data Structures, pages 423–437, 2019. Dan Gusfield and Robert W Irving. The stable marriage problem: structure and algorithms. MIT press, 1989.
406
+ 42 Dan Gusfield. Three fast algorithms for four problems in stable marriage. SIAM Journal on Computing, 16(1):111–128, 1987.
407
+ 4 Robert W Irving, Paul Leather, and Dan Gusfield. An efficient algorithm for the “optimal” stable marriage. Journal of the ACM, 34(3):532–543, 1987.
408
+ 46 Kazuo Iwama, Shuichi Miyazaki, and Hiroki Yanagisawa. Approximation algorithms for the sexequal stable marriage problem. ACM Transaction on Algorithms, 7(1), 2010.
409
+ 48 Akiko Kato. Complexity of the sex-equal stable marriage problem. Japan Journal of Industrial and Applied Mathematics, 10(1):1, 1993.
410
+ 0 Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In Proceedings of International Conference on Learning Representations, 2015.
411
+ 52 Harold W Kuhn. The hungarian method for the assignment problem. Naval research logistics quarterly, 2(1-2):83–97, 1955.
412
+ 54 Qimai Li, Zhichao Han, and Xiao-Ming Wu. Deeper insights into graph convolutional networks for semi-supervised learning. In Proceedings of AAAI Conference on Artificial Intelligence, pages
413
+ 3538–3545, 2018. Shira Li. Deep Learning for Two-Sided Matching Markets. Bachelor’s thesis, Harvard University,
414
+ 2019.
415
+ 59 Eric McDermid and Robert W Irving. Sex-equal stable matchings: Complexity and exact algorithms. Algorithmica, 68(3):545–570, 2014.
416
+ 61 Kenta Oono and Taiji Suzuki. Graph neural networks exponentially lose expressive power for node classification. In Proceedings of International Conference on Learning Representations, 2020.
417
+ 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 IEEE Conference on Computer Vision and Pattern Recognition, July 2017.
418
+ Nikolaos Tziavelis, Ioannis Giannakopoulos, Katerina Doka, Nectarios Koziris, and Panagiotis Karras. Equitable stable matchings in quadratic time. In Proceedings of Advances in Neural Information Processing Systems, pages 457–467, 2019.
419
+ Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? In Proceedings of International Conference on Learning Representations, 2019.
420
+ Manzil Zaheer, Satwik Kottur, Siamak Ravanbakhsh, Barnabas Poczos, Russ R Salakhutdinov, and Alexander J Smola. Deep sets. In Proceedings of Advances in Neural Information Processing Systems, volume 30, pages 3391–3401, 2017.
421
+
422
+ # 374 Checklist
423
+
424
+ 3751. For all authors...
425
+
426
+ 376 (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contri
427
+ 377 butions and scope? [Yes] The experimental results in Section 5 correspond to the main claims,
428
+ 378 which are summarized as the contribution list in Section 1
429
+ 379 (b) Did you describe the limitations of your work? [Yes] Our method works best among any
430
+ 380 baselines when $N \leq 2 0$ , comparative to the state-of-the-art algorithmic baseline when $N = 3 0$ ,
431
+ 381 but poorly when $N = 1 0 0$ . See Section $5 . 3 .$
432
+ 382 (c) Did you discuss any potential negative societal impacts of your work? [Yes] We briefly
433
+ 383 discussed the fairness/unfairness achieved by our method in the paragraph “Asymmetric variant
434
+ 384 with split batch normalization” in Section $4 . 1 .$ Namely, the asymmetric variant can better
435
+ 385 optimize the objective than the symmetric one (which ensures mathematically equal treatment
436
+ 386 for sides $A$ and $B$ ) but harms the equal treatment of the two sides.
437
+ 387 (d) Have you read the ethics review guidelines and ensured that your paper conforms to them?
438
+ 388 [Yes]
439
+
440
+ 3892. If you are including theoretical results...
441
+
442
+ (a) Did you state the full set of assumptions of all theoretical results? [N/A] We have no main theoretical results. The only theoretical discussion is for the computational cost of WeaveNet in A.2, whose assumption is the network shape explained in the paper.
443
+ (b) Did you include complete proofs of all theoretical results? [N/A] We have no main theoretical results. The only theoretical discussion is for the computational cost of WeaveNet in $\pm \boxed { \mathbf { A . 2 } }$ where we provided enough detailed explanation as a proof.
444
+
445
+ 3963. If you ran experiments...
446
+
447
+ (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 have included it in the supplemental material.
448
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] We described the training details in Section 5 “Training protocol” and Section A.5.
449
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] We presented figures with the error bars in Section $\underline { { \vert \mathrm { A . 4 } \vert } }$ of the appendix, which demonstrated the stable behavior of the proposed method against the random seed. For the other part, we have multiple settings, and we observed a stable trend in the results.
450
+ (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] We described it in the appendix, Section C.
451
+
452
+ 4094. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
453
+
454
+ 410 (a) If your work uses existing assets, did you cite the creators? [Yes] See Section C in the appendix.
455
+ 411 (b) Did you mention the license of the assets? [Yes] See Section C.
456
+ 412 (c) Did you include any new assets either in the supplemental material or as a URL? [Yes] We
457
+ 413 provides a code to random-generate the problem instances, which contains no personal or any
458
+ 414 other sensitive information, but only the distribution parameters of the LibimSeti dataset.
459
+ 415 (d) Did you discuss whether and how consent was obtained from people whose data you’re
460
+ 416 using/curating? [Yes] See Section C.
461
+ 417 (e) Did you discuss whether the data you are using/curating contains personally identifiable
462
+ 418 information or offensive content? [Yes] See Section C.
463
+
464
+ 4195. If you used crowdsourcing or conducted research with human subjects...
465
+
466
+ 420 (a) Did you include the full text of instructions given to participants and screenshots, if applicable?
467
+ 421 [N/A] We used neither crowd-sourcing nor human subjects.
468
+ 422 (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB)
469
+ 423 approvals, if applicable? [N/A]
470
+ 424 (c) Did you include the estimated hourly wage paid to participants and the total amount spent on
471
+ 425 participant compensation? [N/A]
md/train/bJxgv5C3sYc/bJxgv5C3sYc.md ADDED
@@ -0,0 +1,315 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # FEW-SHOT BAYESIAN OPTIMIZATION WITH DEEPKERNEL SURROGATES
2
+
3
+ Martin Wistuba
4
+ IBM Research
5
+ Dublin, Ireland
6
+ martin.wistuba@ibm.com
7
+ Josif Grabocka
8
+ University of Freiburg
9
+ Freiburg, Germany
10
+ grabocka@cs.uni-freiburg.de
11
+
12
+ # ABSTRACT
13
+
14
+ Hyperparameter optimization (HPO) is a central pillar in the automation of machine learning solutions and is mainly performed via Bayesian optimization, where a parametric surrogate is learned to approximate the black box response function (e.g. validation error). Unfortunately, evaluating the response function is computationally intensive. As a remedy, earlier work emphasizes the need for transfer learning surrogates which learn to optimize hyperparameters for an algorithm from other tasks. In contrast to previous work, we propose to rethink HPO as a few-shot learning problem in which we train a shared deep surrogate model to quickly adapt (with few response evaluations) to the response function of a new task. We propose the use of a deep kernel network for a Gaussian process surrogate that is meta-learned in an end-to-end fashion in order to jointly approximate the response functions of a collection of training data sets. As a result, the novel few-shot optimization of our deep kernel surrogate leads to new state-of-the-art results at HPO compared to several recent methods on diverse metadata sets.
15
+
16
+ # 1 INTRODUCTION
17
+
18
+ Many machine learning models have very sensitive hyperparameters that must be carefully tuned for efficient use. Unfortunately, finding the right setting is a tedious trial and error process that requires expert knowledge. AutoML methods address this problem by providing tools to automate hyperparameter optimization, where Bayesian optimization has become the standard for this task (Snoek et al., 2012). It treats the problem of hyperparameter optimization as a black box optimization problem. Here the black box function is the hyperparameter response function, which maps a hyperparameter setting to the validation loss. Bayesian optimization consists of two parts. First, a surrogate model, often a Gaussian process, is used to approximate the response function. Second, an acquisition function is used that balances the trade-off between exploration and exploitation. In a sequential process, hyperparameter settings are selected and evaluated, followed by an update of the surrogate model.
19
+
20
+ Recently, several attempts have been made to extend Bayesian optimization to account for a transfer learning setup. It is assumed here that historical information on machine learning algorithms is available with different hyperparameters. This can either be because this information is publicly available (e.g. OpenML) or because the algorithm is repeatedly optimized for different data sets. To this end, several transfer learning surrogates have been proposed that use this additional information to reduce the convergence time of Bayesian optimization.
21
+
22
+ We propose a new paradigm for accomplishing the knowledge transfer by reconceptualizing the process as a few-shot learning task. Inspiration is drawn from the fact that there are a limited number of black box function evaluations for a new hyperparameter optimization task (i.e. few shots) but there are ample evaluations of related black box objectives (i.e. evaluated hyperparameters on other data sets). This approach has several advantages. First, a single model is learned that is trained to quickly adapt to a new task when few examples are available. This is exactly the challenge we face when optimizing hyperparameters. Second, this method can be scaled very well for any number of considered tasks. This not only enables the learning from large metadata sets but also enables the problem of label normalization to be dealt with in a new way. Finally, we present an evolutionary algorithm that can use surrogate models to get a warm start initialization for Bayesian optimization. All of our contributions are empirically compared with several competitive methods in three different problems. Two ablation studies provide information about the influence of the individual components. Concluding, our contributions in this work are:
23
+
24
+ • This is the first work that, in the context of hyperparameter optimization (HPO), trains the initialization of the parameters of a probabilistic surrogate model from a collection of meta-tasks by few-shot learning and then transfers it by fine-tuning the initialized kernel parameters to a target task.
25
+ We are the first to consider transfer learning in HPO as a few-shot learning task.
26
+ We set the new state of the art in transfer learning for the HPO and provide ample evidence that we outperform strong baselines published at ICLR and NeurIPS with a statistically significant margin.
27
+ • We present an evolutionary algorithm that can use surrogate models to get a warm start initialization for Bayesian optimization.
28
+
29
+ # 2 RELATED WORK
30
+
31
+ The idea of using transfer learning to improve Bayesian optimization is being investigated in several papers. The early work suggests learning a single Gaussian process for the entire data (Bardenet et al., 2013; Swersky et al., 2013; Yogatama & Mann, 2014). Since the training of a Gaussian process is cubic in the number of training points, this idea does not scale well. This problem has recently been addressed by several proposals to use ensembles of Gaussian processes where a Gaussian process is learned for each task (Wistuba et al., 2018; Feurer et al., 2018). This idea scales linearly in the number of tasks but still cubically in the number of training points per task. Thus, the problem persists in scenarios where there is a lot of data available for each task.
32
+
33
+ Bayesian neural networks are a possible more scalable way of learning with large amounts of data. For example, Schilling et al. (2015) propose to use a neural network with task embedding and variable interactions. To obtain mean and variance predictions, the authors propose using an ensemble of models. In contrast, Springenberg et al. (2016) use a Bayesian multi-task neural network. However, since training Bayesian neural networks is computationally intensive, Perrone et al. (2018) propose a more scalable approach. They suggest using a neural network that is shared by all tasks and using Bayesian linear regression for each task. The parameters are trained jointly on the entire data. While our work shares some similarities with the previous work, our algorithm has unique properties. First of all, a meta-learning algorithm is used, which is motivated by recent work on model-agnostic meta-learning for few-shot learning (Finn et al., 2017). This will allow us to integrate all task-specific parameters out such that the model does not grow with the number of tasks. As a result, our algorithm scales very well with the number of tasks. Second, while we are also using a neural network, we combine it with a Gaussian process with a nonlinear kernel in order to obtain uncertainty predictions.
34
+
35
+ A simpler solution for using the transfer learning idea in Bayesian optimization is initialization (Feurer et al., 2015; Wistuba et al., 2015a). The standard Bayesian optimization routine with a simple Gaussian process is used in this case but it is warm-started by a number of hyperparameter settings that work well for related tasks. We also explore this idea in the context of this paper by proposing a simple evolutionary algorithm that can use a surrogate model to estimate a data-driven warm start initialization sequence. The use of an evolutionary algorithm is motivated by its ease of implementation and natural capability to deal with continuous and discrete hyperparameters.
36
+
37
+ # 3 PRELIMINARIES
38
+
39
+ # 3.1 BAYESIAN OPTIMIZATION
40
+
41
+ Bayesian optimization is an optimization method for computationally intensive black box functions that consists of two main components, the surrogate model and the acquisition function. The surrogate model is a probabilistic model with mean $\mu$ and variance $\sigma ^ { 2 }$ , which tries to approximate the unknown black box function $f$ , in the following also response function. The acquisition function can provide a score for each feasible solution based on the prediction of the surrogate model. This score balances between exploration and exploitation. The following steps are carried out sequentially. First, the feasible solution that maximizes the acquisition function is evaluated. In this way a new observation $\left( \mathbf { x } , f ( \mathbf { x } ) \right)$ is obtained. Then, the surrogate model is updated based on the entirety of all observations $\mathcal { D }$ . This sequence of steps is carried out until a previously defined convergence criterion occurs (e.g. exhaustion of the time budget). In Figure 1 we provide an example how Bayesian optimization is used to maximize a sine wave.
42
+
43
+ Expected Improvement (Jones et al., 1998) is one of the most commonly used acquisition functions and will also be used in all our experiments. It is defined as
44
+
45
+ $$
46
+ a ( \mathbf { x } | \mathcal { D } ) = \mathbb { E } \left[ \operatorname* { m a x } \left\{ f ( \mathbf { x } ) - y _ { \operatorname* { m a x } } , 0 \right\} \right] ,
47
+ $$
48
+
49
+ where $y _ { \mathrm { m a x } }$ is the largest observed value of $f$
50
+
51
+ # 3.2 GAUSSIAN PROCESSES
52
+
53
+ We have a training set $\mathcal { D }$ of $n$ observations, $\mathcal { D } = \{ ( \mathbf { x } _ { i } , y _ { i } ) | i = 1 , \dots , n \}$ , where $y _ { i }$ are noisy observations of the function values $y _ { i } = f ( \mathbf { x } _ { i } ) + \varepsilon$ . We assume that the noise $\varepsilon$ is additive independent identically distributed Gaussian with variance $\sigma _ { n } ^ { 2 }$ . For Gaussian processes (Rasmussen & Williams, 2006) we consider $y _ { i }$ to be a random variable and the joint distribution of all $y _ { i }$ is assumed to be multivariate Gaussian distributed:
54
+
55
+ $$
56
+ \mathbf { y } \sim { \mathcal { N } } \left( m \left( \mathbf { X } \right) , k \left( \mathbf { X } , \mathbf { X } \right) \right) \ .
57
+ $$
58
+
59
+ A Gaussian process is completely specified by its mean function $m$ , its covariance function $k$ , and may depend on parameters $\pmb { \theta }$ . A common choice is to set $m ( { \bf x } _ { i } ) = 0$ . At inference time for instances $\mathbf { x } _ { * }$ , the assumption is that their ground truth $\mathbf { f } _ { * }$ is jointly Gaussian with $\mathbf { y }$
60
+
61
+ $$
62
+ \begin{array}{c} \left[ \begin{array} { c } { \mathbf { y } } \\ { \mathbf { f _ { * } } } \end{array} \right] \sim \mathcal { N } \left( \mathbf { 0 } , \left( \begin{array} { c c } { \mathbf { K } _ { n } } & { \mathbf { K } _ { * } } \\ { \mathbf { K } _ { * } ^ { T } } & { \mathbf { K } _ { * * } } \end{array} \right) \right) \end{array} ,
63
+ $$
64
+
65
+ where
66
+
67
+ $$
68
+ \mathbf { K } _ { n } = k \left( \mathbf { X } , \mathbf { X } | \pmb { \theta } \right) + \sigma _ { n } ^ { 2 } \mathbf { I } , \ \mathbf { K } _ { * } = k \left( \mathbf { X } , \mathbf { X } _ { * } | \pmb { \theta } \right) , \ \mathbf { K } _ { * * } = k \left( \mathbf { X } _ { * } , \mathbf { X } _ { * } | \pmb { \theta } \right)
69
+ $$
70
+
71
+ for brevity. Then, the posterior predictive distribution has mean and covariance
72
+
73
+ $$
74
+ \mathbb { E } \left[ \mathbf { f } _ { * } | \mathbf { X } , \mathbf { y } , \mathbf { X } _ { * } \right] = \mathbf { K } _ { * } ^ { T } \mathbf { K } _ { n } ^ { - 1 } \mathbf { y } , \thinspace \thinspace \mathrm { c o v } \left[ \mathbf { f } _ { * } | \mathbf { X } , \mathbf { X } _ { * } \right] = \mathbf { K } _ { * * } - \mathbf { K } _ { * } ^ { T } \mathbf { K } _ { n } ^ { - 1 } \mathbf { K } _ { * }
75
+ $$
76
+
77
+ Examples for covariance functions are the linear or squared exponential kernel. However, these kernel functions are designed by hand. The idea of deep kernel learning (Wilson et al., 2016) is to learn the kernel function. They propose to use a neural network $\varphi$ to transform the input $\mathbf { x }$ to a latent representation which serves as input for the kernel function.
78
+
79
+ $$
80
+ k _ { \mathrm { d e e p } } ( \mathbf { x } , \mathbf { x } ^ { \prime } | \boldsymbol { \theta } , \mathbf { w } ) = k ( \varphi ( \mathbf { x } , \mathbf { w } ) , \varphi ( \mathbf { x } ^ { \prime } , \mathbf { w } ) | \boldsymbol { \theta } )
81
+ $$
82
+
83
+ # 4 FEW-SHOT BAYESIAN OPTIMIZATION
84
+
85
+ Hyperparameter optimization is traditionally either tackled as an optimization problem without prior knowledge about the response function or alternatively as a multi-task or transfer learning problem. In the former, every search basically starts from scratch. In the latter, one or multiple models are trained that attempt to reuse knowledge of the source tasks for the target task.
86
+
87
+ In this work we will address the problem as a few-shot problem. Given $T$ related source tasks and very few examples of the target task, we want to make reliable predictions. For each of the source tasks we have observations $\bar { \mathcal { D } } ^ { ( t ) } = \{ ( \mathbf { x } _ { i } ^ { ( t ) } , y _ { i } ^ { ( t ) } ) \} _ { i = 1 \ldots n ^ { ( t ) } }$ , where $\mathbf { x } _ { i } ^ { ( t ) }$ is a hyperparameter setting and $y _ { i } ^ { ( t ) }$ is the noisy observations of $f ^ { ( t ) } ( \mathbf { x } _ { i } ^ { ( t ) } )$ , i.e. a validation score of a machine learning model on data set $t$ . In the following we will denote the set of all data points by $\textstyle { \mathcal { D } } : = \bigcup _ { t = 1 } ^ { T } { \mathcal { D } } ^ { ( t ) }$ . Modelagnostic meta-learning (Finn et al., 2017) has become a popular choice for few-shot learning and we propose to use an adaptation for Gaussian processes (Patacchiola et al., 2020) as a surrogate model within the Bayesian optimization framework. The idea is simple. A deep kernel $\varphi$ is used to learn parameters across tasks such that all its parameters $\pmb \theta$ and w are task-independent. All task-dependent parameters are kept separate which allows to marginalize its corresponding variable out when solely optimizing for the task-independent parameters. If we assume that the posteriors over $\pmb \theta$ and w are dominated by their respective maximum likelihood estimates $\hat { \pmb { \theta } }$ and $\hat { \mathbf { w } }$ , we can approximate the posterior predictive distribution by
88
+
89
+ $$
90
+ p \left( f _ { * } | \mathbf { x } _ { * } , \mathcal { D } \right) = \int p \left( f _ { * } | \mathbf { x } _ { * } , \pmb { \theta } , \mathbf { w } \right) p \left( \pmb { \theta } , \mathbf { w } | \mathcal { D } \right) \mathrm { d } \pmb { \theta } , \mathbf { w } \approx p \left( f _ { * } | \mathbf { x } _ { * } , \mathcal { D } , \pmb { \hat { \theta } } , \hat { \mathbf { w } } \right)
91
+ $$
92
+
93
+ We estimate $\hat { \pmb { \theta } }$ and $\hat { \mathbf { w } }$ by maximizing the log marginal likelihood for all tasks.
94
+
95
+ $$
96
+ \begin{array} { l } { \log p \left( \mathbf { y } ^ { ( 1 ) } , \dots , \mathbf { y } ^ { ( T ) } | \mathbf { X } ^ { ( 1 ) } , \dots , \mathbf { X } ^ { ( T ) } , \pmb { \theta } , \mathbf { w } \right) = \displaystyle \sum _ { t = 1 } ^ { T } \log p \left( \mathbf { y } ^ { ( t ) } | \mathbf { X } ^ { ( t ) } , \pmb { \theta } , \mathbf { w } \right) } \\ { \propto - \displaystyle \sum _ { t = 1 } ^ { T } \left( \mathbf { y } ^ { ( t ) ^ { \mathrm { T } } } \mathbf { K } _ { n } ^ { ( t ) ^ { - 1 } } \mathbf { y } ^ { ( t ) } + \log \left| \mathbf { K } _ { n } ^ { ( t ) } \right| \right) } \end{array}
97
+ $$
98
+
99
+ We maximize the marginal likelihood with stochastic gradient ascent (SGA). Each batch contains data for one task. It is important to note that this batch data does not correspond to the data in $\mathcal { D } ^ { ( t ) }$ , but rather a subset of it. With small batch sizes, this is an efficient way to train the Gaussian process, regardless of how many tasks knowledge is transferred from or how large $\mathcal { D } ^ { ( t ) }$ is. It is important to note that there is a correlation between all data per task and not just one batch. Hence the stochastic gradient is a biased estimator of the full gradient. For a long time we lacked the theoretical understanding of how SGA would behave in this situation. Fortunately, recent work (Chen et al., 2020) proved that SGA still successfully converges and restores model parameters in these cases. The results by Chen et al. (2020) guarantee a $\mathcal { O } ( 1 / K )$ optimization margin of error, where $K$ is the number of iterations.
100
+
101
+ The training works as follows. In each iteration, a task $t$ is sampled uniformly at random from all $T$ tasks. Then we sample a batch of training instances uniformly at random from $\mathcal { D } ^ { ( t ) }$ . Finally, we calculate the log marginal likelihood for this batch (Equation 8) and update the kernel parameters with one step in the direction of the gradient.
102
+
103
+ In hyperparameter optimization, we are only interested in the hyperparameter setting that works best according to a predefined metric of interest. Therefore, only the ranking of the hyperparameter settings is important, not the actual value of the metric. Therefore, we are interested in a surrogate model whose prediction strongly correlate with the response function and the squared error is of little to no interest for us. In practice, however, the minimum / maximum score and the range of values differ significantly between the tasks which makes it challenging to obtain a strongly correlating surrogate model. The most common way to address this problem is to normalize the labels, e.g. by $\mathbf { Z }$ -normalizing or scaling the labels to $[ 0 , 1 ]$ per data set. However, this does not fully solve the problem. The main problem is that this label normalization must also be applied to the target task. This is not possible with a satisfactory degree of accuracy, especially when only a few examples are available, since the approximate values for minimum / maximum or mean / standard deviation are insufficiently accurate.
104
+
105
+ Since our proposed method scales easily to any number of tasks, we can afford to consider another option. We propose a task augmentation strategy that addresses the label normalization issue by randomly scaling the labels for each batch. Since $y _ { \mathrm { { m i n } } }$ and $y _ { \mathrm { m a x } }$ are the minimum and maximum values for all $T$ tasks, we can generate augmented tasks for each batch $B = \{ \mathbf { x } _ { i } , y _ { i } \} _ { i = 1 , \ldots , b } \sim \mathcal { D } ^ { ( t ) }$ where $b$ is the batch size, as follows. A lower and upper limit is sampled for each sample batch,
106
+
107
+ $$
108
+ l \sim \mathcal { U } ( y _ { \mathrm { m i n } } , y _ { \mathrm { m a x } } ) , u \sim \mathcal { U } ( y _ { \mathrm { m i n } } , y _ { \mathrm { m a x } } ) ~ ,
109
+ $$
110
+
111
+ such that $l < u$ holds. Then the labels for that batch are scaled to this range,
112
+
113
+ $$
114
+ \mathbf { y } \gets \frac { \mathbf { y } - l } { u - l } .
115
+ $$
116
+
117
+ No further changes are required. We summarize this procedure in Algorithm 1. The idea here is to learn a representation that is invariant with respect to various offsets and ranges so that the target task does not require normalization. This strategy is not possible for other hyperparameter optimization methods, since this either increases the training data set size even further and thus becomes
118
+
119
+ # Algorithm 1: Few-Shot GP Surrogate
120
+
121
+ Input: Learning rates $\alpha$ and $\beta$ , training data $\mathcal { D }$ , kernel $k$ , and neural network $\varphi$ .
122
+ while not done do Sample task $t \sim \mathcal { U } ( \{ 1 , \dots , T \} )$ ; Estimate $l$ and $u$ (Equation 10); for $b _ { n }$ times do Sample batch $B = \{ ( \mathbf { x } _ { i } , y _ { i } ) \} _ { i = 1 , \ldots , b } \sim \mathcal { D } ^ { ( t ) }$ and scale labels $\mathbf { y }$ using $l$ and $u$ ; Compute marginal likelihood $\mathcal { L }$ on $\boldsymbol { B }$ . (Equation 8); $\pmb { \theta } \pmb { \theta } + \alpha \nabla _ { \pmb { \theta } } \mathcal { L }$ ; $\mathbf { w } \gets \mathbf { w } + \beta \nabla _ { \mathbf { w } } \mathcal { L } ;$ ; end
123
+ end
124
+
125
+ ![](images/eedb4f8e35c73478805b6df22db0fab343c2f801f56fc02053d1e6efa0660124.jpg)
126
+ Figure 1: Demonstration of five steps of Bayesian Optimization with FSBO for maximizing a sine wave (blue). One maximum is discovered within only three steps. Expected Improvement has been scaled to improve readability. In black the predictions of the surrogate model. Bottom right are examples of the source tasks. The deep kernel consists of a spectral kernel (Wilson & Adams, 2013) combined with a two-layer neural network $\mathrm { 1 6 4 6 4 }$ ).
127
+
128
+ computationally impossible (Bardenet et al., 2013; Swersky et al., 2013; Yogatama & Mann, 2014) or thousands of new tasks would have to be generated, which is also is not practical (Springenberg et al., 2016; Perrone et al., 2018; Wistuba et al., 2018; Feurer et al., 2018).
129
+
130
+ At test time, the posterior predictive distribution or the target task $T + 1$ is computed according to Equation 5. In practice, the target data set can be very different to the learned prior. For this reason, the deep kernel parameters are fine-tuned on the target task’s data for few epochs. Our task augmentation strategy described earlier has resulted in a model that has become invariant for different scales of y. For this reason we do not apply this strategy to the target task $T + 1$ and only use it for all source tasks 1 to $T$ . We discuss the usefulness of this step in more detail when we discuss the empirical results.
131
+
132
+ # 5 A MOTIVATING EXAMPLE
133
+
134
+ We would like to first motivate our method, FSBO, with an example, similar to the one described in Nichol et al. (2018). The aim is to find the argument $x$ that maximizes a one-dimensional sine wave of the form $f ^ { ( t ) } ( x ) = a ^ { ( t ) } \sin ( x + b ^ { ( t ) } )$ . It is not known that the function is a sine wave and that one only has to determine the amplitude $a$ and phase $b$ . However, information about other sine waves is available to the optimizer which are considered to be related. These source tasks $t = 1 , \dots , T$ are generated randomly with $a \sim \mathcal { U } ( 0 . 1 , 5 )$ and $b \sim \mathcal { U } ( 0 , 2 \pi )$ . 50 examples $( x _ { i } ^ { ( t ) } , f ^ { ( t ) } ( x _ { i } ^ { ( t ) } ) )$ are available for each task $t$ , whereby the points $x _ { i } ^ { ( t ) } \in [ - 5 , 5 ]$ are evenly spaced.
135
+
136
+ ![](images/937e452ee66004a79a138ec13aa35ab753d35161c5d4481d3dc1bed46fae866f.jpg)
137
+ Figure 2: Examples for the mutation and crossover operation with $I = 3$
138
+
139
+ It should be noted at this point that the expected value for each $x _ { i }$ is 0. Thus, training on the data described above leads to a model predicting 0 for every $x _ { i }$ . However, the used meta-learning procedure allows for accurately reconstructing the underlying sine wave after only a few examples (see Figure 1). Provided that the response function of the original task is similar to the target task, this is a very promising technique for accelerating the search for good hyperparameter settings.
140
+
141
+ # 6 A DATA-DRIVEN INITIALIZATION
142
+
143
+ The proposed few-shot surrogate model requires only a few examples before reliable predictions can be made for the target data set. How do you choose the initial hyper parameter settings? The simplest idea would be to pick them at random or use Latin Hypercube Sampling (LHS) (McKay et al., 1979). Since we already have data from various tasks and a surrogate model that can impute missing values, we propose a data-driven warm start approach. If we evaluate the performance of a hyperparameter optimization algorithm with a loss function $\mathcal { L }$ , we use an evolutionary algorithm to find a set with $I$ hyperparameter settings which minimizes this loss on the source tasks.
144
+
145
+ $$
146
+ \mathbf { X } ^ { ( \mathrm { i n i t } ) } = \underset { \mathbf { X } \in \mathcal { X } ^ { I } } { \arg \operatorname* { m i n } } \sum _ { t = 1 } ^ { T } \mathcal { L } \left( f ^ { ( t ) } , \mathbf { X } \right) = \underset { \mathbf { X } \in \mathcal { X } ^ { I } } { \arg \operatorname* { m i n } } \sum _ { t = 1 } ^ { T } \underset { \mathbf { x } \in \mathbf { X } } { \operatorname* { m i n } } \tilde { f } ^ { ( t ) } ( \mathbf { x } )
147
+ $$
148
+
149
+ The loss of a set of hyperparameters depends on the response function values for each of the elements. Since these are not available for every $\mathbf { x }$ , we approximate $f ^ { ( t ) } ( \mathbf { x } )$ with the prediction of the surrogate model described in the last section whenever this is necessary.
150
+
151
+ Arbitrary loss function can be considered. The specific loss function used in our experiments is the normalized regret and is defined on the right side of Equation 12, where $\tilde { f } ^ { ( t ) }$ is derived from $f ^ { ( t ) }$ by scaling it to $[ 0 , 1 ]$ range:
152
+
153
+ $$
154
+ \tilde { f } ^ { ( t ) } ( \mathbf { x } ) = \frac { f ^ { ( t ) } ( \mathbf { x } ) - f _ { \operatorname* { m i n } } ^ { ( t ) } } { f _ { \operatorname* { m a x } } ^ { ( t ) } - f _ { \operatorname* { m i n } } ^ { ( t ) } } ,
155
+ $$
156
+
157
+ where $f _ { \mathrm { m a x } } ^ { ( t ) }$ and $f _ { \operatorname* { m i n } } ^ { ( t ) }$ are the maximum and minimum of $f ^ { ( t ) }$ , respectively.
158
+
159
+ The evolutionary algorithm works as follows. We initialize the population with sets containing $I$ random settings, the settings being sampled in proportion to their performance according to the predictions. Precisely, a setting $\mathbf { x }$ is sampled proportional to
160
+
161
+ $$
162
+ \exp \left( - \operatorname* { m i n } _ { t \in \{ 1 , . . . , T \} } \tilde { f } ^ { ( t ) } ( { \bf x } ) \right) .
163
+ $$
164
+
165
+ The best sets are then selected to be refined using an evolutionary algorithm. The algorithm randomly chooses either to mutate a set or to perform a crossover operation between two sets. When mutating a set, a setting is removed uniformly at random and a new setting is added proportional to its predicted performance (Figure 2, left). The crossover operation creates a new set and adds elements from the union of the parent sets until the new set has $I$ settings (Figure 2, right). The new set is added to the population. After 100,000 steps, the algorithm is stopped and the best set is used as the set of initial hyperparameter settings. In Figure 4 we compare this warm start initialization with the simple random or LHS initialization.
166
+
167
+ # 7 EXPERIMENTS
168
+
169
+ We used three different optimization problems to compare the different hyperparameter optimization methods: AdaBoost, GLMNet, and SVM. We created the GLMNet and SVM metadata set by downloading the 30 data sets with the most reported hyperparameter settings from OpenML for each problem. The AdaBoost data set is publicly available (Wistuba et al., 2018). The number of settings per data set varies, the number of settings across all tasks for the GLMNet problem is approximately 800,000. See the appendix for more details about the metadata sets. We compare the following list of hyperparameter optimization methods.
170
+
171
+ Random Search This is a simple but strong baseline for hyperparameter optimization (Bergstra & Bengio, 2012). Hyperparameters settings are selected uniformly at random from the search space.
172
+
173
+ Gaussian Process (GP) Bayesian optimization with a Gaussian process as a surrogate model is a standard and strong baseline (Snoek et al., 2012). We use a Matern 5/2 kernel with ARD and rely ´ on the scikit-optimize implementation. We compare with two variations. The first is the vanilla method, which uses Latin Hypercube Sampling (LHS) with design size of 10 to initialize. The second method uses the warm start (WS) method described in Section 6 to find an initial set of 5 settings to use the knowledge from other data sets.
174
+
175
+ RGPE RGPE (Feurer et al., 2018) is one of the latest examples of methods that use GP ensembles to transfer knowledge across task (Wistuba et al., 2016; Schilling et al., 2016; Wistuba et al., 2018). In this case a GP is trained for each individual task and in a final step the predictions of the GPs are aggregated. These ensembles scale linearly in the number of tasks, but the computation time is still cubic and the space requirement is still quadratic in the number of data points per task. For this reason we can only present results for AdaBoost and not for the other optimization problems, which have significantly more data points.
176
+
177
+ MetaBO Using the acquisition function instead of the surrogate model for transfer learning is another option. MetaBO is the state-of-the-art transfer acquisition function and was presented last year at ICLR (Volpp et al., 2020). We use the implementation provided by the authors.
178
+
179
+ ABLR The state-of-the-art surrogate model for scalable hyperparameter transfer learning (Perrone et al., 2018). This method uses a multi-task GP which combines a linear kernel with a neural network and scales to very large data sets. Transfer learning is achieved by sharing the neural network parameters across different tasks. By ABLR (WS) we are referring to a version of ABLR that uses the same warm start as FSBO.
180
+
181
+ Multi-Head GPs This closely resembles ABLR but uses the same deep kernel as our proposed method. The main difference from our proposed method is that it is using a GP for every task, only shares the neural network across tasks, and uses standard stochastic gradient ascent.
182
+
183
+ Few-Shot Bayesian Optimization (FSBO) Our proposed method described in Section 4. The deep kernel is composed of a two-layer neural network $\mathrm { 1 2 8 } \mathrm { 1 2 8 } \mathrm { , }$ ) with ReLU activations and a squared-exponential kernel. We use the Adam optimizer with learning rate $1 0 ^ { - 3 }$ and a batch size of fifty. The warm start length is five.
184
+
185
+ The experiments are repeated ten times and evaluated in a leave-one-task-out cross-validation. This means that all transfer learning methods use one task as the target task and all other tasks as source tasks. For AdaBoost we use the same train/test split as used by Volpp et al. (2020) instead. We report the aggregated results for all tasks within one problem class with respect to the mean of normalized regrets. The normalized regret for a task is obtained by first scaling the response function values between 0 and 1 before calculating the regret (Wistuba et al., 2018), i.e.
186
+
187
+ $$
188
+ \tilde { r } ^ { ( t ) } = \tilde { f } ^ { ( t ) } ( \mathbf x _ { \mathrm { m i n } } ) - \tilde { f } _ { \mathrm { m i n } } ^ { ( t ) } ,
189
+ $$
190
+
191
+ <table><tr><td rowspan="2">Method</td><td colspan="3">AdaBoost</td><td colspan="3">GLMNet</td><td colspan="3">SVM</td></tr><tr><td>15</td><td>33</td><td>50</td><td>33</td><td>67</td><td>100</td><td>33</td><td>67</td><td>100</td></tr><tr><td>RANDOM</td><td>4.87</td><td>3.02</td><td>2.16</td><td>0.85</td><td>0.40</td><td>0.29</td><td>2.01</td><td>1.12</td><td>0.83</td></tr><tr><td>GP (LHS)</td><td>3.87</td><td>2.49</td><td>2.23</td><td>1.32</td><td>1.01</td><td>0.73</td><td>1.94</td><td>1.40</td><td>1.14</td></tr><tr><td>GP (WS)</td><td>3.25</td><td>1.66</td><td>1.02</td><td>0.86</td><td>0.36</td><td>0.24</td><td>1.10</td><td>0.81</td><td>0.65</td></tr><tr><td>RGPE</td><td>5.29</td><td>3.26</td><td>2.83</td><td>_1</td><td>_1</td><td>_1</td><td>_1</td><td>1</td><td>_1</td></tr><tr><td>METABO</td><td>5.27</td><td>3.52</td><td>1.96</td><td>11.02</td><td>10.97</td><td>10.96</td><td>12.39</td><td>12.39</td><td>11.93</td></tr><tr><td>ABLR</td><td>4.56</td><td>1.44</td><td>1.24</td><td>1.77</td><td>0.50</td><td>0.40</td><td>1.81</td><td>1.23</td><td>0.84</td></tr><tr><td>ABLR(WS)</td><td>3.17</td><td>1.72</td><td>1.17</td><td>0.54</td><td>0.36</td><td>0.29</td><td>1.47</td><td>1.08</td><td>0.87</td></tr><tr><td>MULTI-HEAD GPs(WS)</td><td>6.78</td><td>3.45</td><td>1.80</td><td>2.83</td><td>2.80</td><td>2.68</td><td>11.20</td><td>9.82</td><td>8.72</td></tr><tr><td>FSBO</td><td>3.10</td><td>1.13</td><td>0.80</td><td>0.42</td><td>0.22</td><td>0.16</td><td>0.79</td><td>0.51</td><td>0.36</td></tr></table>
192
+
193
+ Table 1: FSBO obtains better results for all hyperparameter optimization problems. The best results are in bold. Results that are not significantly worse than the best are in italics. Used initialization in parentheses, (LHS) - Latin Hypercube Sampling, (WS) - Warm Start.
194
+
195
+ here $\tilde { f } ^ { ( t ) }$ is the normalized response function (Equation 13), $\tilde { f } _ { \mathrm { m i n } } ^ { ( t ) }$ is the global minimum for task $t$ $\mathbf { x } _ { \mathrm { m i n } }$ is the best discovered hyperparameter setting by the optimizer.
196
+
197
+ # 7.1 HYPERPARAMETER OPTIMIZATION
198
+
199
+ We conduct experiments on three different metadata sets and report the aggregated mean of normalized regrets in Table 1. The best results are in bold. Results that are not significantly worse than the best are in italics. We determined the significance using the Wilcoxon signed rank test with a confidence level of $9 5 \%$ . Results are reported after every 33 trials of Bayesian optimization for GLMNet and SVM. Since AdaBoost has fewer test examples, we report its results in shorter intervals.
200
+
201
+ Our proposed FSBO method outperforms all other transfer methods in all three tasks. Results are significantly better but in the case of AdaBoost where GP (WS) achieves similar but on average worse results. The results obtained for MetaBO are the worst. We contacted Volpp et al. (2020) and they confirmed that our results are obtained correctly. The problem is apparently that the Reinforcement Learning method does not work well for larger number of trials. We provide a longer discussion in the appendix. Also ABLR and the very related Multi-Head GP are not performing very well. As we show in the next section, one possible reason for this might be because the neural network parameters are fixed which will prohibit a possibly required adaptation to the target task. The vanilla GP and its transfer variant that uses a warm start turn out to be among the strongest baselines. This is in particular true for the warm start version which is the second best method. This simple baseline of knowledge transfer is often not taken into account when comparing transfer surrogates, although it is easy to implement. Due to the very competitive results, we recommend using it as a standard baseline to assess the usefulness of new transfer surrogates.
202
+
203
+ # 7.2 COMPONENT CONTRIBUTIONS
204
+
205
+ In this section we highlight the various components that make a significant difference to ABLR. The results for each setup are reported in Figure 3. The Multi-Head GP is a surrogate model that shares the neural network between tasks but uses a separate Gaussian process for each task. It closely resembles the idea of ABLR but is closer to our proposed implementation of FSBO. Starting from this configuration, we add various components that will eventually lead to our proposed model FSBO. We consider Multi-Head GP (WS), a version that additionally uses the warm start method described in Section 6 instead of a random initialization. Multi-Head GP (fine-tune) not only updates the kernel parameters when a new observation is received but also fine-tunes the parameters of the neural network. Finally, FSBO is our proposed method, which uses only one Gaussian process for all tasks. We see that all Multi-Head GP versions have a problem adapting to the target tasks efficiently. Fine-tuning the deep kernel is an important part of learning FSBO. Although FSBO outperforms all Multi-Head GP versions without fine-tuning, the additional use of it makes for a significant improvement. We analyzed the reason for this in more detail. We observed that the learned neural network provides a strong prior that leads to strong exploitation behavior. Fine-tuning prevents this and thus ensures that the method does not get stuck in local optima.
206
+
207
+ ![](images/eb4e6e3741711d97d4722a59d7acbb1aa450ff05dcd8da6c5ab71455aa0c9e48.jpg)
208
+ Figure 3: Comparison of the contribution of the various FSBO components to the final solution. Each component makes its own orthogonal contribution.
209
+
210
+ ![](images/198844a05885f005ffafff1b96f57361c178cfeae541a69459e23fdb9aec3908.jpg)
211
+ Figure 4: The warm start initialization yields the best results on GLMNet and SVM for all initialization lengths. For AdaBoost it is comparable to LHS.
212
+
213
+ # 7.3 DATA-DRIVEN WARM START
214
+
215
+ The use of a warm start is not the main contribution of this paper but it is interesting to explore further nonetheless. First of all, for some methods this is the only differentiating factor. We compare our suggested warm start initialization with a random and a Latin hypercube sampling (LHS) initialization in Figure 4. Considering that GP (WS) always performed better than GP (LHS) in Table 1, one would expect that the warm start itself also performs better than LHS. While this is the case for GLMNet and SVM, there are no significant differences for the AdaBoost problem. Our assumption is that in this case the warm start might not have always found good settings as part of the initialization, it still explored areas in the search space close to the optimum. This would facilitate finding a better solution in one of the subsequent steps of Bayesian optimization.
216
+
217
+ # 8 CONCLUSIONS
218
+
219
+ In this work, we propose to rethink hyperparameter optimization as a few-shot learning problem in which we train a shared deep surrogate model to quickly adapt (with few response evaluations) to the response function of a new task. We propose the use of a deep kernel network for a Gaussian process surrogate that is meta-learned in an end-to-end fashion in order to jointly approximate the response functions of a collection of training data sets. This few-shot surrogate model is used for two different purposes. First, we use it in combination with an evolutionary algorithm in order to estimate a data-driven warm start initialization for Bayesian optimization. Second, we use it directly for Bayesian optimization. In our empirical evaluation on three hyperparameter optimization problems, we observe significantly better results than with state-of-the-art methods that use transfer learning.
220
+
221
+ # ACKNOWLEDGMENTS
222
+
223
+ This work has been supported by European Union’s Horizon 2020 research and innovation programme under grant number 951911 - AI4Media. Prof. Grabocka is thankful to the Eva Mayr-Stihl Foundation for their generous research grant.
224
+
225
+ # REFERENCES
226
+
227
+ Remi Bardenet, M ´ aty ´ as Brendel, Bal ´ azs K ´ egl, and Mich ´ ele Sebag. Collaborative hyperparameter \` tuning. In Proceedings of the 30th International Conference on Machine Learning, ICML 2013, Atlanta, GA, USA, 16-21 June 2013, pp. 199–207, 2013. URL http://proceedings.mlr. press/v28/bardenet13.html.
228
+
229
+ James Bergstra and Yoshua Bengio. Random search for hyper-parameter optimization. J. Mach. Learn. Res., 13:281–305, 2012. URL http://dl.acm.org/citation.cfm?id $=$ 2188395.
230
+
231
+ Hao Chen, Lili Zheng, Raed AL Kontar, and Garvesh Raskutti. Stochastic gradient descent in correlated settings: A study on gaussian processes. In Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, 2020. URL https://papers.nips.cc/paper/2020/hash/ 1cb524b5a3f3f82be4a7d954063c07e2-Abstract.html.
232
+
233
+ Matthias Feurer, Jost Tobias Springenberg, and Frank Hutter. Initializing bayesian hyperparameter optimization via meta-learning. In Proceedings of the Twenty-Ninth AAAI Conference on Artificial Intelligence, January 25-30, 2015, Austin, Texas, USA, pp. 1128–1135, 2015. URL http:// www.aaai.org/ocs/index.php/AAAI/AAAI15/paper/view/10029.
234
+
235
+ Matthias Feurer, Benjamin Letham, and Eytan Bakshy. Scalable meta-learning for bayesian optimization. CoRR, abs/1802.02219, 2018. URL http://arxiv.org/abs/1802.02219.
236
+
237
+ Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In Proceedings of the 34th International Conference on Machine Learning, ICML 2017, Sydney, NSW, Australia, 6-11 August 2017, pp. 1126–1135, 2017. URL http: //proceedings.mlr.press/v70/finn17a.html.
238
+
239
+ Donald R. Jones, Matthias Schonlau, and William J. Welch. Efficient global optimization of expensive black-box functions. J. Global Optimization, 13(4):455–492, 1998. doi: 10.1023/A: 1008306431147. URL https://doi.org/10.1023/A:1008306431147.
240
+
241
+ Balazs K ´ egl and R ´ obert Busa-Fekete. Boosting products of base classifiers. In ´ Proceedings of the 26th Annual International Conference on Machine Learning, ICML 2009, Montreal, Quebec, Canada, June 14-18, 2009, pp. 497–504, 2009. doi: 10.1145/1553374.1553439. URL https: //doi.org/10.1145/1553374.1553439.
242
+
243
+ M. D. McKay, R. J. Beckman, and W. J. Conover. A comparison of three methods for selecting values of input variables in the analysis of output from a computer code. Technometrics, 21(2): 239–245, 1979. ISSN 00401706. URL http://www.jstor.org/stable/1268522.
244
+
245
+ Alex Nichol, Joshua Achiam, and John Schulman. On first-order meta-learning algorithms, 2018.
246
+
247
+ Massimiliano Patacchiola, Jack Turner, Elliot J. Crowley, and Amos Storkey. Bayesian meta-learning for the few-shot setting via deep kernels. In Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, 2020. URL https://papers.nips.cc/paper/2020/hash/ b9cfe8b6042cf759dc4c0cccb27a6737-Abstract.html.
248
+
249
+ Valerio Perrone, Rodolphe Jenatton, Matthias W. Seeger, and Cedric Archambeau. Scalable hy- ´ perparameter transfer learning. In Advances in Neural Information Processing Systems 31: Annual Conference on Neural Information Processing Systems 2018, NeurIPS 2018, 3-8 December 2018, Montreal, Canada ´ , pp. 6846–6856, 2018. URL http://papers.nips.cc/paper/ 7917-scalable-hyperparameter-transfer-learning.
250
+
251
+ Carl Edward Rasmussen and Christopher K. I. Williams. Gaussian processes for machine learning. Adaptive computation and machine learning. MIT Press, 2006. ISBN 026218253X.
252
+
253
+ Nicolas Schilling, Martin Wistuba, Lucas Drumond, and Lars Schmidt-Thieme. Hyperparameter optimization with factorized multilayer perceptrons. In Machine Learning and Knowledge Discovery in Databases - European Conference, ECML PKDD 2015, Porto, Portugal, September 7-11, 2015, Proceedings, Part II, pp. 87–103, 2015. doi: 10.1007/978-3-319-23525-7\ 6. URL https://doi.org/10.1007/978-3-319-23525-7_6.
254
+
255
+ Nicolas Schilling, Martin Wistuba, and Lars Schmidt-Thieme. Scalable hyperparameter optimization with products of gaussian process experts. In Machine Learning and Knowledge Discovery in Databases - European Conference, ECML PKDD 2016, Riva del Garda, Italy, September 19- 23, 2016, Proceedings, Part I, pp. 33–48, 2016. doi: 10.1007/978-3-319-46128-1\ 3. URL https://doi.org/10.1007/978-3-319-46128-1_3.
256
+
257
+ Jasper Snoek, Hugo Larochelle, and Ryan P. Adams. Practical bayesian optimization of machine learning algorithms. In Advances in Neural Information Processing Systems 25: 26th Annual Conference on Neural Information Processing Systems 2012. Proceedings of a meeting held December 3-6, 2012, Lake Tahoe, Nevada, United States, pp. 2960–2968, 2012. URL http://papers.nips.cc/paper/ 4522-practical-bayesian-optimization-of-machine-learning-algorithms.
258
+
259
+ Jost Tobias Springenberg, Aaron Klein, Stefan Falkner, and Frank Hutter. Bayesian optimization with robust bayesian neural networks. In Advances in Neural Information Processing Systems 29: Annual Conference on Neural Information Processing Systems 2016, December 5-10, 2016, Barcelona, Spain, pp. 4134–4142, 2016. URL http://papers.nips.cc/paper/ 6117-bayesian-optimization-with-robust-bayesian-neural-networks.
260
+
261
+ Kevin Swersky, Jasper Snoek, and Ryan Prescott Adams. Multi-task bayesian optimization. In Advances in Neural Information Processing Systems 26: 27th Annual Conference on Neural Information Processing Systems 2013. Proceedings of a meeting held December 5-8, 2013, Lake Tahoe, Nevada, United States, pp. 2004–2012, 2013. URL http://papers.nips.cc/paper/ 5086-multi-task-bayesian-optimization.
262
+
263
+ Michael Volpp, Lukas P. Frohlich, Kirsten Fischer, Andreas Doerr, Stefan Falkner, Frank Hutter, ¨ and Christian Daniel. Meta-learning acquisition functions for transfer learning in bayesian optimization. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020, 2020. URL https://openreview.net/forum?id $=$ ryeYpJSKwr.
264
+
265
+ Andrew Gordon Wilson and Ryan Prescott Adams. Gaussian process kernels for pattern discovery and extrapolation. In Proceedings of the 30th International Conference on Machine Learning, ICML 2013, Atlanta, GA, USA, 16-21 June 2013, pp. 1067–1075, 2013. URL http://proceedings.mlr.press/v28/wilson13.html.
266
+
267
+ Andrew Gordon Wilson, Zhiting Hu, Ruslan Salakhutdinov, and Eric P. Xing. Deep kernel learning. In Proceedings of the 19th International Conference on Artificial Intelligence and Statistics, AISTATS 2016, Cadiz, Spain, May 9-11, 2016, pp. 370–378, 2016. URL http: //proceedings.mlr.press/v51/wilson16.html.
268
+
269
+ Martin Wistuba, Nicolas Schilling, and Lars Schmidt-Thieme. Learning hyperparameter optimization initializations. In 2015 IEEE International Conference on Data Science and Advanced Analytics, DSAA 2015, Campus des Cordeliers, Paris, France, October 19-21, 2015, pp. 1–10, 2015a. doi: 10.1109/DSAA.2015.7344817. URL https://doi.org/10.1109/DSAA. 2015.7344817.
270
+
271
+ Martin Wistuba, Nicolas Schilling, and Lars Schmidt-Thieme. Sequential model-free hyperparameter tuning. In 2015 IEEE International Conference on Data Mining, ICDM 2015, Atlantic City, NJ, USA, November 14-17, 2015, pp. 1033–1038, 2015b. doi: 10.1109/ICDM.2015.20. URL https://doi.org/10.1109/ICDM.2015.20.
272
+
273
+ Martin Wistuba, Nicolas Schilling, and Lars Schmidt-Thieme. Two-stage transfer surrogate model for automatic hyperparameter optimization. In Machine Learning and Knowledge Discovery in Databases - European Conference, ECML PKDD 2016, Riva del Garda, Italy, September 19- 23, 2016, Proceedings, Part I, pp. 199–214, 2016. doi: 10.1007/978-3-319-46128-1\ 13. URL https://doi.org/10.1007/978-3-319-46128-1_13.
274
+
275
+ Martin Wistuba, Nicolas Schilling, and Lars Schmidt-Thieme. Scalable gaussian process-based transfer surrogates for hyperparameter optimization. Mach. Learn., 107(1):43–78, 2018. doi: 10. 1007/s10994-017-5684-y. URL https://doi.org/10.1007/s10994-017-5684-y.
276
+
277
+ Dani Yogatama and Gideon Mann. Efficient transfer learning method for automatic hyperparameter tuning. In Proceedings of the Seventeenth International Conference on Artificial Intelligence and Statistics, AISTATS 2014, Reykjavik, Iceland, April 22-25, 2014, pp. 1077–1085, 2014. URL http://proceedings.mlr.press/v33/yogatama14.html.
278
+
279
+ ![](images/52bd45ca2cd10392be7bcf35ae3e85883edee009bb9a2fedb85da9ccb2823033.jpg)
280
+ Figure 5: FSBO is the best of all considered methods.
281
+
282
+ # A HYPERPARAMETER OPTIMIZATION
283
+
284
+ In the main paper we report the normalized regret after every 33 trials of Bayesian optimization in a table. This allows us to also report statistical significance. In Figure 5 we show results for all 100 trials. The conclusions remain unchanged. FSBO provides consistently the best results.
285
+
286
+ # B CHALLENGES WITH METABO
287
+
288
+ The results reported in the main paper for MetaBO seem not to align with the numbers reported by Volpp et al. (2020), in particular for AdaBoost. In order to understand this behavior, we conducted a deeper analysis for the AdaBoost metadata set which was used in the evaluation of Volpp et al. (2020) as well. Using the authors’ code2, we executed the same scripts used by the authors to report their results for $T = 1 5$ trials. Furthermore, we changed two lines in the scripts to train MetaBO for $T = 5 0$ , the number of trials considered for AdaBoost in our experiment. We report the outcome of these two experiments in Figure 6. In the two left plots we show how the learned policies for $T = 1 5$ and $T = 5 0$ perform on validation and test during training. The authors’ default setting for the total number of iterations is 2000. However, we noticed a sudden drop in regret for the setting $T = 5 0$ around 2000 iterations. For that reason we assumed that further training might help to further improve MetaBO and increased it to 5000 iterations. As can be seen in the middle plot, that was not the case. We observe that the policy learned for $T = 1 5$ has a lower regret than the one for $T = 5 0$ even though it is only trying 15 compared to 50 trials. In the right plot we show the results compared to a simple random search baseline. The results for $T = 1 5$ are in line with those reported by Volpp et al. (2020). We contacted the authors and they confirmed that we use their code correctly. Their explanation is that the increase of episode length makes this a harder problem for Reinforcement Learning. This results in worse results for $T = 5 0$ and even worse for $T = 1 0 0$ in case of the GLMNet and SVM problem. They proposed to randomly vary $T$ between 5 and 50 during the training phase. We also considered this training protocol and report the results in Figure 6. This improves over training only with $T = 5 0$ but does not improve over a simple random search.
289
+
290
+ # C METADATA
291
+
292
+ We created the GLMNet and SVM metadata using OpenML. We chose the 30 OpenML flows with the most observations. We also limited ourselves to the uploaded results from user with ID 2702 (OpenML Bot R), who uploaded the majority of all runs, to ensure that the metadata was generated under similar circumstances. In some cases the choice of a single hyperparameter is not indicated. In such a case, we assume that the default value was used. The GLMNet metadata has two continous hyperparameters: the elastic-net mixing parameter $\alpha \in [ 0 , 1 ]$ and the regularization parameter $\lambda \in \mathsf { [ \bar { 2 } ^ { - 1 0 } , 2 ^ { 1 0 } ] }$ . The SVM metadata has two mandatory hyperparameters and two conditional
293
+
294
+ ![](images/efd123033581afd4b192793e0edc0650c43c8423b0076c5eea25fd6bb98bdfd5.jpg)
295
+ Figure 6: Left two plots: Training MetaBO for different number of trials $T$ . Right plot: comparing the final policy against a random search. Results for $T = 1 5$ match the results reported by Volpp et al. (2020).
296
+
297
+ <table><tr><td>Method</td><td colspan="3">AdaBoost</td><td colspan="3">GLMNet</td><td colspan="3">SVM</td></tr><tr><td></td><td>15</td><td>33</td><td>50</td><td>33</td><td>67</td><td>100</td><td>33</td><td>67</td><td>100</td></tr><tr><td>FSBO</td><td>3.10</td><td>1.13</td><td>0.80</td><td>0.42</td><td>0.22</td><td>0.16</td><td>0.79</td><td>0.51</td><td>0.36</td></tr><tr><td>FSBO (REPTILE)</td><td>3.80</td><td>2.13</td><td>1.21</td><td>0.36</td><td>0.19</td><td>0.14</td><td>1.48</td><td>0.89</td><td>0.72</td></tr></table>
298
+
299
+ Table 2: Comparing different model-agnostic meta-learning approaches. Again, the best results are in bold and results that are not significantly worse than the best are in italics.
300
+
301
+ hyperparameters. The kernel (linear, polynomial or RBF) and the continuous trade-off parameter $\dot { C } \in \mathsf { [ 2 ^ { - 1 0 } , 2 ^ { 1 0 } ] }$ must always be selected. The degree $d \in \{ 2 , 3 , 4 , 5 \}$ is only considered for the polynomial kernel and the bandwidth $\gamma \in [ 2 ^ { - 1 0 } , 2 ^ { 1 \overline { { 0 } } } ]$ is only considered for the RBF kernel.
302
+
303
+ We further use the AdaBoost metadata which has been used to evaluate MetaBO (Volpp et al., 2020). According to Wistuba et al. (2015b), this metadata was created using AdaBoost (Kegl & ´ Busa-Fekete, 2009) with decision products as weak learners. The authors designed a grid over the two continuous hyperparameters: the number of iterations and the number of product terms. The number of iterations was chosen from $\{ 2 , 5 , 1 0 , 2 0 , 5 0 , 1 0 0 , 2 0 0 , 5 0 0 , 1 0 ^ { 3 } , 2 \cdot 1 0 ^ { 3 } , 5 \cdot 1 0 ^ { 3 } , 1 0 ^ { 4 } \}$ , the number of product term was chosen from $\{ 2 , 3 , 4 , 5 , 7 , 1 0 , 1 5 , 2 0 , 3 0 \}$ .
304
+
305
+ The metadata was created by running a grid search on 50 different classification data sets, using classification accuracy as an objective. Compared to the other two metadata sets, this one is significantly smaller. Its use is mainly motivated by comparing to MetaBO under the same circumstances as used to evaluate MetaBO. For that reason, we do not use the leave-one-data-set-out cross-validation protocol but instead use the same fixed split created by Volpp et al. (2020).
306
+
307
+ Statistics about these metadata sets are provided in Table 3.
308
+
309
+ # D META-LEARNING WITH REPTILE
310
+
311
+ In principle our few-shot surrogate can be combined with any model-agnostic meta-learning approach. In this section we compare our proposed meta-learning approach against Reptile (Nichol et al., 2018), a first-order approximation of MAML. We use the same hyperparameters and data augmentation as described in Algorithm 1. Reptile introduces a new hyperparameter, an outer learning rate. We set it to 0.1 and decay it linearly to 0. As summarized in Table 2, FSBO with the meta-learning approach described in Algorithm 1 is either better or not significantly worse than its variation with Reptile.
312
+
313
+ Table 3: Metadata set statistics. OpenML ID refers to a task on openml.org.
314
+
315
+ <table><tr><td rowspan="2">AdaBoost</td><td colspan="2">GLMNet</td><td colspan="3">SVM</td></tr><tr><td>RUNS</td><td>OPENML ID</td><td>RUNS</td><td>OPENML ID</td><td>RUNS</td></tr><tr><td>DATA SET</td><td></td><td></td><td></td><td></td><td>2429</td></tr><tr><td>A9A W8A</td><td>108 108</td><td>3 31</td><td>12796 60721</td><td>37 3485</td><td>1000</td></tr><tr><td></td><td>108</td><td>37</td><td>17950</td><td>3492</td><td>3217</td></tr><tr><td>ABALONE</td><td></td><td>219</td><td>13963</td><td>3493</td><td>1828</td></tr><tr><td>APPENDICITIS</td><td>108 108</td><td></td><td>16968</td><td>3494</td><td>1854</td></tr><tr><td>AUSTRALIAN AUTOMOBILE</td><td>108</td><td>3492 3493</td><td>19931</td><td>3889</td><td>1951</td></tr><tr><td>BANANA</td><td>108</td><td>3889</td><td>13942</td><td>3891</td><td>3083</td></tr><tr><td>BANDS</td><td>108</td><td>3891</td><td>13917</td><td>3899</td><td>2487</td></tr><tr><td>BREAST-CANCER</td><td>108</td><td>3899</td><td>15954</td><td>3902</td><td>1105</td></tr><tr><td>BUPA</td><td>108</td><td>3903</td><td>39155</td><td>3903</td><td>1018</td></tr><tr><td>CAR</td><td>108</td><td>3913</td><td>22949</td><td>3913</td><td>1448</td></tr><tr><td>CHESS</td><td>108</td><td>3917</td><td>16960</td><td>3918</td><td>1459</td></tr><tr><td>COD-RNA</td><td>108</td><td>3918</td><td>20984</td><td>3950</td><td>1998</td></tr><tr><td>COIL2000</td><td>108</td><td>9914</td><td>37635</td><td>6566</td><td>2702</td></tr><tr><td>COLON-CANCER</td><td>108</td><td>9946</td><td>25532</td><td>9889</td><td>2485</td></tr><tr><td>CRX</td><td>108</td><td>9952</td><td>25854</td><td>9914</td><td>1498</td></tr><tr><td>DIABETES</td><td>108</td><td>9967</td><td>21994</td><td>9946</td><td>1291</td></tr><tr><td>ECOLI</td><td>108</td><td>9978</td><td>19956</td><td>9952</td><td>2483</td></tr><tr><td>GERMAN-NUMER</td><td>108</td><td>9980</td><td>31961</td><td>9967</td><td>1492</td></tr><tr><td>HABERMAN</td><td>108</td><td>9983</td><td>37134</td><td>9971</td><td>1381</td></tr><tr><td>HOUSEVOTES</td><td>108</td><td>10101</td><td>66277</td><td>9976</td><td>1473</td></tr><tr><td>IJCNN1</td><td>108</td><td>125923</td><td>35555</td><td>9978</td><td>1503</td></tr><tr><td>KR-VS-K</td><td>108</td><td>145847</td><td>29927</td><td>9980</td><td>2943</td></tr><tr><td>LED7DIGIT</td><td>108</td><td>145857</td><td>31180</td><td>9983</td><td>987</td></tr><tr><td>LETTER</td><td>108</td><td>145862</td><td>12954</td><td>10101</td><td>1871</td></tr><tr><td>LYMPHOGRAPHY</td><td>108</td><td>145872</td><td>17835</td><td>14951</td><td>1765</td></tr><tr><td>MAGIC</td><td>108</td><td>145953</td><td>47439</td><td>34536</td><td>1499</td></tr><tr><td>MONK-2</td><td>108</td><td>145972</td><td>19972</td><td>34537</td><td>1489</td></tr><tr><td>PENDIGITS</td><td>108</td><td>145979</td><td>12979</td><td>145878</td><td>1244</td></tr><tr><td>PHONEME</td><td>108</td><td>146064</td><td>43785</td><td>146064</td><td>1435</td></tr><tr><td>PIMA</td><td>108</td><td></td><td></td><td></td><td></td></tr><tr><td>RING</td><td>108</td><td></td><td></td><td></td><td></td></tr><tr><td>SAHEART</td><td>108</td><td></td><td></td><td></td><td></td></tr><tr><td>SEGMENT</td><td>108</td><td></td><td></td><td></td><td></td></tr><tr><td>SEISMIC</td><td>108</td><td></td><td></td><td></td><td></td></tr><tr><td>SHUTTLE</td><td>108</td><td></td><td></td><td></td><td></td></tr><tr><td>SONAR-SCALE</td><td>108</td><td></td><td></td><td></td><td></td></tr><tr><td>SPAMBASE</td><td>108</td><td></td><td></td><td></td><td></td></tr><tr><td>SPECTFHEART</td><td>108</td><td></td><td></td><td></td><td></td></tr><tr><td>SPLICE</td><td>108</td><td></td><td></td><td></td><td></td></tr><tr><td>TIC-TAC-TOE</td><td>108</td><td></td><td></td><td></td><td></td></tr><tr><td>TITANIC</td><td>108</td><td></td><td></td><td></td><td></td></tr><tr><td>TWONORM</td><td>108</td><td></td><td></td><td></td><td></td></tr><tr><td>USPS</td><td>108</td><td></td><td></td><td></td><td></td></tr><tr><td>VEHICLE</td><td>108</td><td></td><td></td><td></td><td></td></tr><tr><td>WDBC</td><td>108</td><td></td><td></td><td></td><td></td></tr><tr><td>WINE</td><td>108</td><td></td><td></td><td></td><td></td></tr><tr><td>WINEQUALITY-RED</td><td>108</td><td></td><td></td><td></td><td></td></tr><tr><td>WISCONSIN</td><td>108</td><td></td><td></td><td></td><td></td></tr><tr><td>YEAST</td><td>108 5400</td><td>TOTAL</td><td>804159</td><td>TOTAL</td><td></td></tr><tr><td>TOTAL</td><td></td><td></td><td></td><td></td><td>54418</td></tr></table>
md/train/jB0Nlbwlybm/jB0Nlbwlybm.md ADDED
@@ -0,0 +1,319 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DynamicViT: Efficient Vision Transformers with Dynamic Token Sparsification
2
+
3
+ Yongming Rao1 Wenliang Zhao1 Benlin Liu2,3 Jiwen $\mathbf { L u } ^ { 1 * }$ Jie Zhou1 Cho-Jui Hsieh2
4
+
5
+ 1 Tsinghua University 2 UCLA 3 University of Washington
6
+
7
+ # Abstract
8
+
9
+ Attention is sparse in vision transformers. We observe the final prediction in vision transformers is only based on a subset of most informative tokens, which is sufficient for accurate image recognition. Based on this observation, we propose a dynamic token sparsification framework to prune redundant tokens progressively and dynamically based on the input. Specifically, we devise a lightweight prediction module to estimate the importance score of each token given the current features. The module is added to different layers to prune redundant tokens hierarchically. To optimize the prediction module in an end-to-end manner, we propose an attention masking strategy to differentiably prune a token by blocking its interactions with other tokens. Benefiting from the nature of self-attention, the unstructured sparse tokens are still hardware friendly, which makes our framework easy to achieve actual speed-up. By hierarchically pruning $66 \%$ of the input tokens, our method greatly reduces $3 1 \% \sim 3 7 \%$ FLOPs and improves the throughput by over $40 \%$ while the drop of accuracy is within $0 . 5 \%$ for various vision transformers. Equipped with the dynamic token sparsification framework, DynamicViT models can achieve very competitive complexity/accuracy trade-offs compared to state-of-the-art CNNs and vision transformers on ImageNet. Code is available at https://github.com/ raoyongming/DynamicViT.
10
+
11
+ # 1 Introduction
12
+
13
+ These years have witnessed the great progress in computer vision brought by the evolution of CNNtype architectures [12, 18]. Some recent works start to replace CNN by using transformer for many vision tasks, like object detection [36, 20] and classification [25]. Just like what has been done to the CNN-type architectures in the past few years, it is also desirable to accelerate the transformer-like models to make them more suitable for real-time applications.
14
+
15
+ One common practice for the acceleration of CNN-type networks is to prune the filters that are of less importance. The way input is processed by the vision transformer and its variants, i.e. splitting the input image into multiple independent patches, provides us another orthogonal way to introduce the sparsity for the acceleration. That is, we can prune the tokens of less importance in the input instance, given the fact that many tokens contribute very little to the final prediction. This is only possible for the transformer-like models where the self-attention module can take the token sequence of variable length as input, and the unstructured pruned input will not affect the self-attention module, while dropping a certain part of the pixels can not really accelerate the convolution operation since the unstructured neighborhood used by convolution would make it difficult to accelerate through parallel computing. Since the hierarchical architecture of CNNs with structural downsampling has improved model efficiency in various vision tasks, we hope to explore the unstructured and data-dependent downsampling strategy for vision transformers to further leverage the advantages of self-attention (our experiments also show unstructured sparsification can lead to better performance for vision transformers compared to structural downsampling). The basic idea of our method is illustrated in Figure 1.
16
+
17
+ ![](images/d4271a07b0ae3b36791a37a66e78570f014f99e6cd4733f82c9e1ff2750057fc.jpg)
18
+ (c) Attention Visualization
19
+ Figure 1: Illustration of our main idea. CNN models usually leverage the structural downsampling strategy to build hierarchical architectures as shown in (a). unstructured and data-dependent downsampling method in (b) can better exploit the sparsity in the input data. Thanks to the nature of the self-attention operation, the unstructured token set is also easy to accelerate through parallel computing. (c) visualizes the impact of each spatial location on the final prediction in the DeiT-S model [25] using the visualization method proposed in [3]. These results demonstrate the final prediction in vision transformers is only based on a subset of most informative tokens, which suggests a large proportion of tokens can be removed without hurting the performance.
20
+
21
+ In this work, we propose to employ a lightweight prediction module to determine which tokens to be pruned in a dynamic way, dubbed as DynamicViT. In particular, for each input instance, the prediction module produces a customized binary decision mask to decide which tokens are uninformative and need to be abandoned. This module is added to multiple layers of the vision transformer, such that the sparsification can be performed in a hierarchical way as we gradually increase the amount of pruned tokens after each prediction module. Once a token is pruned after a certain layer, it will not be ever used in the feed-forward procedure. The additional computational overhead introduced by this lightweight module is quite small, especially considering the computational overhead saved by eliminating the uninformative tokens.
22
+
23
+ This prediction module can be optimized jointly in an end-to-end manner together with the vision transformer backbone. To this end, two specialized strategies are adopted. The first one is to adopt Gumbel-Softmax [15] to overcome the non-differentiable problem of sampling from a distribution so that it is possible to perform the end-to-end training. The second one is about how to apply this learned binary decision mask to prune the unnecessary tokens. Considering the number of zero elements in the binary decision mask is different for each instance, directly eliminating the uninformative tokens for each input instance during training will make parallel computing impossible. Moreover, this would also hinder the back-propagation for the prediction module, which needs to calculate the probability distribution of whether to keep the token even if it is finally eliminated. Besides, directly setting the abandoned tokens as zero vectors is also not a wise idea since zero vectors will still affect the calculation of the attention matrix. Therefore, we propose a strategy called attention masking where we drop the connection from abandoned tokens to all other tokens in the attention matrix based on the binary decision mask. By doing so, we can overcome the difficulties described above. We also modify the original training objective of the vision transformer by adding a term to constrain the proportion of pruned tokens after a certain layer. During the inference phase, we can directly abandon a fixed amount of tokens after certain layers for each input instance as we no longer need to consider whether the operation is differentiable, and this will greatly accelerate the inference.
24
+
25
+ We illustrate the effectiveness of our method on ImageNet using DeiT [25] and LV-ViT [16] as backbone. The experimental results demonstrate the competitive trade-off between speed and accuracy. In particular, by hierarchically pruning $66 \%$ of the input tokens, we can greatly reduce $31 \%$ $\sim 3 7 \%$ GFLOPs and improve the throughput by over $40 \%$ while the drop of accuracy is within $0 . 5 \%$ for all different vision transformers. Our DynamicViT demonstrates the possibility of exploiting the sparsity in space for the acceleration of transformer-like model. We expect our attempt to open a new path for future work on the acceleration of transformer-like models.
26
+
27
+ # 2 Related Work
28
+
29
+ Vision transformers. Transformer model is first widely studied in NLP community [26]. It proves the possibility to use self-attention to replace the recurrent neural networks and their variants. Recent progress has demonstrated the variants of transformers can also be a competitive alternative to CNNs and achieve promising results on different vision tasks including image classification [8, 25, 20, 35, 23], object detection [2], semantic segmentation [34, 5] and 3D analysis [31, 33]. DETR [2] is the first work to apply the transformer model to vision tasks. It formulates the object detection task as a set prediction problem and follows the encoder-decoder design in the transformer to generate a sequence of bounding boxes. ViT [8] is the first work to directly apply transformer architecture on non-overlapping image patches for the image classification task, and the whole framework contains no convolution operation. Compared to CNN-type models, ViT can achieve better performance with large-scale pre-training. It is really preferred if the architecture can achieve the state-of-the-art without any pre-training. DeiT [25] proposes many training techniques so that we can train the convolutionfree transformer only on ImageNet1K [7] and achieve better performance than ViT. LV-ViT [16] further improves the performance by introducing a new training objective called token labeling. Both ViT and its follow-ups split the input image into multiple independent image patches and transform these image patches into tokens for further process. This makes it feasible to incorporate the sparsity in space dimension for these transformer-like models.
30
+
31
+ Model acceleration. Model acceleration techniques are important for the deployment of deep models on edge devices. There are many techniques can be used to accelerate the inference speed of deep model, including quantization [9, 27], pruning [13, 22], low-rank factorization [30], knowledge distillation [14, 19] and so on. There are also many works aims at accelerating the inference speed of transformer models. For example, TinyBERT [17] proposes a distillation method to accelerate the inference of transformer. Star-Transformer [10] reduces quadratic space and time complexity to linear by replacing the fully connected structure with a star-shaped topology. However, all these works focus on NLP tasks, and few works explore the possibility of making use of the characteristic of vision tasks to accelerate vision transformer. Furthermore, the difference between the characteristics of Transformer and CNN also makes it possible to adopt another way for acceleration rather than the methods used for CNN acceleration like filter pruning [13], which removes non-critical or redundant neurons from a deep model. Our method aims at pruning the tokens of less importance instead of the neurons by exploiting the sparsity of informative image patches.
32
+
33
+ # 3 Dynamic Vision Transformers
34
+
35
+ # 3.1 Overview
36
+
37
+ The overall framework of our DynamicViT is illustrated in Figure 2. Our DynamicViT consists of a normal vision transformer as the backbone and several prediction modules. The backbone network can be implemented as a wide range of vision transformer (e.g., ViT [8], DeiT [25], LV-ViT [16]). The prediction modules are responsible for generating the probabilities of dropping/keeping the tokens. The token sparsification is performed hierarchically through the whole network at certain locations. For example, given a 12-layer transformer, we can conduct token sparsification before the 4th, 7th, and 10th blocks. During training, the prediction modules and the backbone network can be optimized in an end-to-end manner thanks to our newly devised attention masking strategy. During inference, we only need to select the most informative tokens according to a predefined pruning ratio and the scores computed by the prediction modules.
38
+
39
+ ![](images/60c84b61353b60447abb0291fa5feca07f0a78e5f57fdd197aacba080f24b0c4.jpg)
40
+ Figure 2: The overall framework of the proposed approach. The proposed prediction module is inserted between the transformer blocks to selectively prune less informative token conditioned on features produced by the previous layer. By doing so, less tokens are processed in the followed layers.
41
+
42
+ # 3.2 Hierarchical Token Sparsification with Prediction Modules
43
+
44
+ An important characteristic of our DynamicViT is that the token sparsification is performed hierarchically, i.e., we gradually drop the uninformative tokens as the computation proceeds. To achieve this, we maintain a binary decision mask $\hat { \bf D } \in \{ 0 , 1 \} ^ { N }$ to indicate whether to drop or keep each token, where $N = H W$ is the number of patch embeddings2. We initialize all elements in the decision mask to 1 and update the mask progressively. The prediction modules take the current decision $\hat { \bf D }$ and the tokens $\mathbf { x } \in \mathbb { R } ^ { N \times C }$ as input. We first project the tokens using an MLP:
45
+
46
+ $$
47
+ \begin{array} { r } { \mathbf { z } ^ { \mathrm { l o c a l } } = \mathrm { M L P } ( \mathbf { x } ) \in \mathbb { R } ^ { N \times C ^ { \prime } } , } \end{array}
48
+ $$
49
+
50
+ where $C ^ { \prime }$ can be a smaller dimension and we use $C ^ { \prime } = C / 2$ in our implementation. Similarly, we can compute a global feature by:
51
+
52
+ $$
53
+ \begin{array} { r } { \mathbf { z } ^ { \mathrm { g l o b a l } } = \mathrm { A g g } ( \mathrm { M L P } ( \mathbf { x } ) , \hat { \mathbf { D } } ) \in \mathbb { R } ^ { C ^ { \prime } } , } \end{array}
54
+ $$
55
+
56
+ where Agg is the function which aggregate the information all the existing tokens and can be simply implemented as an average pooling:
57
+
58
+ $$
59
+ \operatorname { A g g } ( \mathbf { u } , \hat { \mathbf { D } } ) = \frac { \sum _ { i = 1 } ^ { N } \hat { \mathbf { D } } _ { i } \mathbf { u } _ { i } } { \sum _ { i = 1 } ^ { N } \hat { \mathbf { D } } _ { i } } , \quad \mathbf { u } \in \mathbb { R } ^ { N \times C ^ { \prime } } .
60
+ $$
61
+
62
+ The local feature encodes the information of a certain token while the global feature contains the context of the whole image, thus both of them are informative. Therefore, we combine both the local and global features to obtain local-global embeddings and feed them to another MLP to predict the probabilities to drop/keep the tokens:
63
+
64
+ $$
65
+ \begin{array} { r } { \mathbf { z } _ { i } = [ \mathbf { z } _ { i } ^ { \mathrm { l o c a l } } , \mathbf { z } _ { i } ^ { \mathrm { g l o b a l } } ] , \quad 1 \leq i \leq N , } \\ { \pi = \mathrm { S o f t m a x } ( \mathrm { M L P } ( \mathbf { z } ) ) \in \mathbb { R } ^ { N \times 2 } , } \end{array}
66
+ $$
67
+
68
+ where $\pi _ { i , 0 }$ denotes the probability of dropping the $i$ -th token and $\pi _ { i , 1 }$ is the probability of keeping it. We can then generate current decision $\mathbf { D }$ by sampling from $\pi$ and update $\hat { \bf D }$ by
69
+
70
+ $$
71
+ \hat { \mathbf { D } } \hat { \mathbf { D } } \odot \mathbf { D } ,
72
+ $$
73
+
74
+ where $\odot$ is the Hadamard product, indicating that once a token is dropped, it will never be used.
75
+
76
+ # 3.3 End-to-end Optimization with Attention Masking
77
+
78
+ Although our target is to perform token sparsification, we find it non-trivial to implement in practice during training. First, the sampling from $\pi$ to get binary decision mask $\mathbf { D }$ is is non-differentiable, which impedes the end-to-end training. To overcome this, we apply the Gumbel-Softmax technique [15] to sample from the probabilities $\pi$ :
79
+
80
+ $$
81
+ \mathbf { D } = \mathrm { G u m b e l - S o f t m a x } ( \pi ) _ { * , 1 } \in \{ 0 , 1 \} ^ { N } ,
82
+ $$
83
+
84
+ where we use the index “1” because $\mathbf { D }$ represents the mask of the kept tokens. The output of GumbelSoftmax is a one-hot tensor, of which the expectation equals $\pi$ exactly. Meanwhile, Gumbel-Softmax is differentiable thus makes it possible for end-to-end training.
85
+
86
+ The second obstacle comes when we try to prune the tokens during training. The decision mask $\hat { \bf D }$ is usually unstructured and the masks for different samples contain various numbers of 1’s. Therefore, simply discarding the tokens where $\hat { \bf D } _ { i } = 0$ would result in a non-uniform number of tokens for samples within a batch, which makes it hard to parallelize the computation. Thus, we must keep the number of tokens unchanged, while cut down the interactions between the pruned tokens and other tokens. We also find that merely zero-out the tokens to be dropped using the binary mask $\hat { \bf D }$ is not feasible, because in the calculation of self-attention matrix [26]
87
+
88
+ $$
89
+ \mathbf { A } = \mathrm { S o f t m a x } \left( { \frac { \mathbf { Q } \mathbf { K } ^ { T } } { \sqrt { C } } } \right)
90
+ $$
91
+
92
+ the zeroed tokens will still influence other tokens through the Softmax operation. To this end, we devise a strategy called attention masking which can totally eliminate the effects of the dropped tokens. Specifically, we compute the attention matrix by:
93
+
94
+ $$
95
+ \begin{array} { r l } & { \mathbf { P } = \mathbf { Q } \mathbf { K } ^ { T } / \sqrt { C } \in \mathbb { R } ^ { N \times N } , } \\ & { \mathbf { G } _ { i j } = \{ 1 , \quad \quad i = j , } \\ & { \hat { \mathbf { D } } _ { j } , \quad i \neq j . } \\ & { \quad \tilde { \mathbf { A } } _ { i j } = \frac { \exp ( \mathbf { P } _ { i j } ) \mathbf { G } _ { i j } } { \sum _ { k = 1 } ^ { N } \exp ( \mathbf { P } _ { i k } ) \mathbf { G } _ { i k } } , } \end{array}
96
+ $$
97
+
98
+ $$
99
+ \begin{array} { l } { 1 \leq i , j \leq N , } \\ { ~ } \\ { 1 \leq i , j \leq N . } \end{array}
100
+ $$
101
+
102
+ By Equation (10) we construct a graph where $\mathbf { G } _ { i j } = 1$ means the $j$ -th token will contribute to the update of the $i$ -th token. Note that we explicitly add a self-loop to each token to improve numerically stability. It is also easy to show the self-loop does not influence the results: if $\bar { \mathbf { D } } _ { j } = 0$ , the $j$ -th token will not contribute to any tokens other than itself. Equation (11) computes the masked attention matrix $\tilde { \mathbf { A } }$ , which is equivalent to the attention matrix calculated by considering only the kept tokens but has a constant shape $N \times N$ during training.
103
+
104
+ # 3.4 Training and Inference
105
+
106
+ We now describe the training objectives of our DynamicViT. The training of DynamicViT includes training the prediction modules such that they can produce favorable decisions and fine-tuning the backbone to make it adapt to token sparsification. Assuming we are dealing with a minibatch of $B$ samples, we adopt the standard cross-entropy loss:
107
+
108
+ $$
109
+ \mathcal { L } _ { \mathrm { c l s } } = \mathrm { C r o s s E n t r o p y } ( \mathbf { y } , \bar { \mathbf { y } } ) ,
110
+ $$
111
+
112
+ where $\mathbf { y }$ is the prediction of the DynamicViT (after softmax) and $\bar { \mathbf { y } }$ is the ground truth.
113
+
114
+ To minimize the influence on performance caused by our token sparsification, we use the original backbone network as a teacher model and hope the behavior of our DynamicViT as close to the teacher model as possible. Specifically, we consider this constraint from two aspects. First, we make the finally remaining tokens of the DynamicViT close to the ones of the teacher model, which can be viewed as a kind of self-distillation:
115
+
116
+ $$
117
+ \mathcal { L } _ { \mathrm { d i s t i l l } } = \frac { 1 } { \sum _ { b = 1 } ^ { B } \sum _ { i = 1 } ^ { N } \hat { \mathbf { D } } _ { i } ^ { b , S } } \sum _ { b = 1 } ^ { B } \sum _ { i = 1 } ^ { N } \hat { \mathbf { D } } _ { i } ^ { b , S } ( \mathbf { t } _ { i } - \mathbf { t } _ { i } ^ { \prime } ) ^ { 2 } ,
118
+ $$
119
+
120
+ Table 1: Main results on ImageNet. We apply our method on three representative vision transformers: DeiT-S, LV-ViT-S and LV-ViT-M. DeiT-S [25] is a widely used vision transformer with the simple architecture. LV-ViT-S and LV-ViT-M [16] are the state-of-the-art vision transformers. We report the top-1 classification accuracy, theoretical complexity in FLOPs and throughput for different ratio $\rho$ . The throughput is measured on a single NVIDIA RTX 3090 GPU with batch size fixed to 32.
121
+
122
+ <table><tr><td rowspan="2">Base Model</td><td rowspan="2">Metrics</td><td colspan="4">Keeping Ratio ρ at each stage</td></tr><tr><td>1.0</td><td>0.9</td><td>0.8</td><td>0.7</td></tr><tr><td rowspan="3">DeiT-S [25]</td><td>ImageNet Acc. (%)</td><td>79.8</td><td>79.8 (-0.0)</td><td>79.6 (-0.2)</td><td>79.3 (-0.5)</td></tr><tr><td>GFLOPs</td><td>4.6</td><td>4.0 (-14%)</td><td>3.4 (-27%)</td><td>2.9 (-37%)</td></tr><tr><td>Throughput (im/s)</td><td>1337.7</td><td>1524.8 (+14%)</td><td>1774.6 (+33%)</td><td>2062.1 (+54%)</td></tr><tr><td rowspan="3">LV-ViT-S [16]</td><td>ImageNet Acc. (%)</td><td>83.3</td><td>83.3 (-0.0)</td><td>83.2 (-0.1)</td><td>83.0 (-0.3)</td></tr><tr><td>GFLOPs</td><td>6.6</td><td>5.8 (-12%)</td><td>5.1 (-22%)</td><td>4.6 (-31%)</td></tr><tr><td>Throughput (im/s)</td><td>993.3</td><td>1108.3 (+12%)</td><td>1255.6 (+26%)</td><td>1417.6 (+43%)</td></tr><tr><td rowspan="3">LV-ViT-M[16]</td><td>ImageNet Acc. (%)</td><td>84.0</td><td>83.9 (-0.1)</td><td>83.9 (-0.1)</td><td>83.8 (-0.2)</td></tr><tr><td>GFLOPs</td><td>12.7</td><td>11.1 (-13%)</td><td>9.6 (-24%)</td><td>8.5 (-33%)</td></tr><tr><td>Throughput (im/s)</td><td>589.5</td><td>688.5 (+17%)</td><td>791.2 (+34%)</td><td>888.2 (+50%)</td></tr></table>
123
+
124
+ where $\mathbf { t } _ { i }$ and $\mathbf { t } _ { i } ^ { \prime }$ denotes the $i$ -th token after the last block of the DynamicViT and the teacher model, respectively. $\hat { \bf D } ^ { b , s }$ is the decision mask for the $b$ -th sample at the $s$ -th sparsification stage. Second, we minimize the difference of the predictions between our DynamicViT and its teacher via the KL divergence:
125
+
126
+ $$
127
+ \begin{array} { r } { \mathcal { L } _ { \mathrm { K L } } = \mathrm { K L } \left( \mathbf { y } \| \mathbf { y } ^ { \prime } \right) , } \end{array}
128
+ $$
129
+
130
+ where $\mathbf { y } ^ { \prime }$ is the prediction of the teacher model.
131
+
132
+ Finally, we want to constrain the ratio of the kept tokens to a predefined value. Given a set of target ratios for $S$ stages $\pmb { \rho } = [ \rho ^ { ( 1 ) } , \dots , \rho ^ { ( S ) } ]$ , we utilize an MSE loss to supervise the prediction module:
133
+
134
+ $$
135
+ \mathcal { L } _ { \mathrm { r a t i o } } = \frac { 1 } { B S } \sum _ { b = 1 } ^ { B } \sum _ { s = 1 } ^ { S } \left( \rho ^ { ( s ) } - \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \hat { \mathbf { D } } _ { i } ^ { b , s } \right) ^ { 2 } .
136
+ $$
137
+
138
+ The full training objective is a combination of the above objectives:
139
+
140
+ $$
141
+ \mathcal { L } = \mathcal { L } _ { \mathrm { c l s } } + \lambda _ { \mathrm { K L } } \mathcal { L } _ { \mathrm { K L } } + \lambda _ { \mathrm { d i s t i l l } } \mathcal { L } _ { \mathrm { d i s t i l l } } + \lambda _ { \mathrm { r a t i o } } \mathcal { L } _ { \mathrm { r a t i o } } ,
142
+ $$
143
+
144
+ where we set $\lambda _ { \mathrm { K L } } = 0 . 5 , \lambda _ { \mathrm { d i s t i l l } } = 0 . 5 , \lambda _ { \mathrm { r a t i o } } = 2$ in all our experiments.
145
+
146
+ During inference, given the target ratio $\rho$ , we can directly discard the less informative tokens via the probabilities produced by the prediction modules such that only exact $m ^ { s } = \lfloor \rho ^ { s } N \rfloor$ tokens are kept at the $s$ -th stage. Formally, for the $s$ -th stage, let
147
+
148
+ $$
149
+ \begin{array} { r } { \mathcal { T } ^ { s } = \mathop { \mathrm { a r g s o r t } } ( \pi _ { * , 1 } ) } \end{array}
150
+ $$
151
+
152
+ be the indices sorted by the keeping probabilities $\pi _ { * , 1 }$ , we can then keep the tokens of which the indices lie in $\mathcal { T } _ { 1 : m ^ { s } } ^ { s }$ while discarding the others. In this way, our DynamicViT prunes less informative tokens dynamically at runtime, thus can reduce the computational costs during inference.
153
+
154
+ # 4 Experimental Results
155
+
156
+ In this section, we will demonstrate the superiority of the proposed DynamicViT through extensive experiments. In all of our experiments, we fix the number of sparsification stages $S = 3$ and apply the target keeping ratio $\rho$ as a geometric sequence $[ \rho , \rho ^ { 2 } , \rho ^ { 3 } ]$ where $\rho$ ranges from $( 0 , 1 )$ . During training DynamicViT models, we follow most of the training techniques used in DeiT [25]. We use the pre-trained vision transformer models to initialize the backbone models and jointly train the whole model for 30 epochs. We set the learning rate of the prediction module to batch size × 0.001 and use $0 . 0 1 \times$ learning rate for the backbone model. We fix the weights of the backbone models in the first 5 epochs. All of our models are trained on a single machine with 8 GPUs. Other training setups and details can be found in the supplementary material.
157
+
158
+ ![](images/3c4ee26faf688f1b0a579c8588783656070e3c3e9b22df42205e8677fd7b8ae5.jpg)
159
+ Figure 3: Model complexity (FLOPs) and top-1 accuracy trade-offs on ImageNet. We compare DynamicViT with the state-of-the-art image classification models. Our models achieve better trade-offs compared to the various vision transformers as well as carefully designed CNN models.
160
+
161
+ ![](images/4ea76cd205a92c4a57c3350183bb6731151d04057f2d04017a636bd911c7d0cb.jpg)
162
+ Figure 4: Comparison of our dynamic token sparsification method with model width scaling. We train our DynamicViT based on DeiT models with embedding dimension varying from 192 to 384 and fix ratio $\rho = 0 . 7$ . We see dynamic token sparsification is more efficient than commonly used model width scaling.
163
+
164
+ # 4.1 Main results
165
+
166
+ One of the most advantages of the DynamicViT is that it can be applied to a wide range of vision transformer architectures to reduce the computational complexity with minor loss of performance. In Table 1, we summarize the main results on ImageNet [7] where we evaluate our DynamicViT used three base models (DeiT-S [25], LV-ViT-S [16] and LV-ViT-M [16]). We report the top-1 accuracy, FLOPs, and the throughput under different keeping ratios $\rho$ . Note that our token sparsification is performed hierarchically in three stages, there are only $\lfloor N \rho ^ { 3 } \rfloor$ tokens left after the last stage. The throughput is measured on a single NVIDIA RTX 3090 GPU with batch size fixed to 32. We demonstrate that our DynamicViT can reduce the computational costs by $3 1 \% \sim 3 7 \%$ and accelerate the inference at runtime by $4 3 \% \sim 5 4 \%$ , with the neglectable influence of performance $( - 0 . 2 \% \sim - 0 . 5 \% )$ .
167
+
168
+ # 4.2 Comparisons with the-state-of-the-arts
169
+
170
+ In Table 2, we compare the DynamicViT with the state-of-the-art models in image classification, including convolutional networks and transformer-like architectures. We use the DynamicViT with LV-ViT [16] as the base model and use the $^ { 6 6 } / \rho ^ { 9 }$ to indicate the keeping ratio. We observe that our DynamicViT exhibits favorable complexity/accuracy trade-offs at all three complexity levels. Notably, we find our DynamicViT-LV-M/0.7 beats the EfficientNet-B5 [24] and NFNet-F0 [1], which are two of the current state-of-the-arts CNN architectures. This can also be shown clearer in Figure 3, where we plot the FLOPS-accuracy curve of DynamicViT series (where we use DyViT for short), along with other state-of-the-art models. We can also observe that DynamicViT can achieve better trade-offs than LV-ViT series, which strongly demonstrates the effectiveness of our method.
171
+
172
+ # 4.3 Analysis
173
+
174
+ DynamicViT for model scaling. The success of EfficientNet [24] shows that we can obtain a model with better complexity/accuracy tradeoffs by scaling the model along different dimensions. While in vision transformers, the most commonly used method to scale the model is to change the number of channels, our DynamicViT provides another powerful tool to perform token sparsification. We analysis this nice property of DynamicViT in Figure 4. First, we train several DeiT [25] models with the embedding dimension varying from 192 (DeiT-Ti) to 384 (DeiT-S). Second, we train our DynamicViT based on those models with the keeping ratio $\rho = 0 . 7$ . We find that after performing token sparsification, the complexity of the model is reduced to be similar to its variant with a smaller embedding dimension. Specifically, we observe that by applying our DynamicViT to DeiT-256, we obtain a model that has a comparable computational complexity to DeiT-Ti, but enjoys around $4 . 3 \%$ higher ImageNet top-1 accuracy.
175
+
176
+ Table 2: Comparisons with the state-of-the-arts on ImageNet. We compare our DynamicViT models with state-of-the-art image classifciation models with comparable FLOPs and number of parameters. We use the DynamicViT with LV-ViT [16] as the base model and use the $" / \rho "$ to indicate the keeping ratio. We also include the results of LV-ViT models as references.
177
+
178
+ <table><tr><td>Model</td><td>Params (M)</td><td>GFLOPs</td><td>Resolution</td><td>Top-1 Acc (%)</td></tr><tr><td>DeiT-S [25]</td><td>22.1</td><td>4.6</td><td>224</td><td>79.8</td></tr><tr><td>PVT-Small [28]</td><td>24.5</td><td>3.8</td><td>224</td><td>79.8</td></tr><tr><td>CoaTMini [29]</td><td>10.0</td><td>6.8</td><td>224</td><td>80.8</td></tr><tr><td>CrossViT-S [4]</td><td>26.7</td><td>5.6</td><td>224</td><td>81.0</td></tr><tr><td>PVT-Medium [28]</td><td>44.2</td><td>6.7</td><td>224</td><td>81.2</td></tr><tr><td>Swin-T [20]</td><td>29.0</td><td>4.5</td><td>766</td><td>81.3</td></tr><tr><td>T2T-ViT-14 [32]</td><td>22.0</td><td>5.2</td><td>224</td><td>81.5</td></tr><tr><td>CPVT-Small-GAP [6]</td><td>23.0</td><td>4.6</td><td>817</td><td>81.5</td></tr><tr><td>CoaT-Lite Small [29]</td><td>20.0</td><td>4.0</td><td>224</td><td>81.9</td></tr><tr><td>LV-ViT-S [16]</td><td>26.2</td><td>6.6</td><td>224</td><td>83.3</td></tr><tr><td>DynamicViT-LV-S/0.5</td><td>26.9</td><td>3.7</td><td>224</td><td>82.0</td></tr><tr><td>DynamicViT-LV-S/0.7</td><td>26.9</td><td>4.6</td><td>224</td><td>83.0</td></tr><tr><td>RegNetY-8G [21]</td><td>39.0</td><td>8.0</td><td>224</td><td>81.7</td></tr><tr><td>T2T-ViT-19 [32]</td><td>39.2</td><td>8.9</td><td>224</td><td>81.9</td></tr><tr><td>Swin-S [20]</td><td>50.0</td><td>8.7</td><td>224</td><td>83.0</td></tr><tr><td>EfficientNet-B5 [24]</td><td>30.0</td><td>9.9</td><td>456</td><td>83.6</td></tr><tr><td>NFNet-F0 [1]</td><td>72.0</td><td>12.4</td><td>256</td><td>83.6</td></tr><tr><td>DynamicViT-LV-M/0.7</td><td>57.1</td><td>8.5</td><td>224</td><td>83.8</td></tr><tr><td>ViT-Base/16 [8]</td><td>86.6</td><td>17.6</td><td>224</td><td>77.9</td></tr><tr><td>DeiT-Base/16 [25]</td><td>86.6</td><td>17.6</td><td>224</td><td>81.8</td></tr><tr><td>CrossViT-B 3[4]</td><td>104.7</td><td>21.2</td><td>224</td><td>82.2</td></tr><tr><td>T2T-ViT-24 [32]</td><td>64.1</td><td>14.1</td><td>224</td><td>82.3</td></tr><tr><td>TNT-B [11]</td><td>66.0</td><td>14.1</td><td>224</td><td>82.8</td></tr><tr><td>RegNetY-16G [21]</td><td>84.0</td><td>16.0</td><td>224</td><td>82.9</td></tr><tr><td>Swin-B [20]</td><td>88.0</td><td>15.4</td><td>224</td><td>83.3</td></tr><tr><td>LV-ViT-M [16]</td><td>55.8</td><td>12.7</td><td>224</td><td>84.0</td></tr><tr><td>Dynamic ViT-LV-M/0.8</td><td>57.1</td><td>9.6</td><td>224</td><td>83.9</td></tr></table>
179
+
180
+ Visualizations. To further investigate the behavior of DynamicViT, we visualize the sparsification procedure in Figure 5. We show the original input image and the sparsification results after the three stages, where the masks represent the corresponding tokens are discarded. We find that through the hierarchically token sparsification, our DynamicViT can gradually drop the uninformative tokens and finally focus on the objects in the images. This phenomenon also suggests that the DynamicViT leads to better interpretability, i.e., it can locate the important parts in the image which contribute most to the classification step-by-step.
181
+
182
+ Besides the sample-wise visualization we have shown above, we are also interested in the statistical characteristics of the sparsification decisions, i.e., what kind of general patterns does the DynamicViT learn from the dataset? We then use the DynamicViT to generate the decisions for all the images in the ImageNet validation set and compute the keep probability of each token in all three stages, as shown in Figure 6. We average pool the probability maps into $7 \times 7$ such that they can be visualized more easily. Unsurprisingly, we find the tokens in the middle of the image tend to be kept, which is reasonable because in most images the objects are located in the center. We can also find that the later stage generally has lower probabilities to be kept, mainly because that the keeping ratio at the $s$ stage is $\rho ^ { s }$ , which decreases exponentially as $s$ increases.
183
+
184
+ ![](images/55b80e501904076240ede75eeecf0aef021e7ba2d7c6f06c24f7b7b13b800a40.jpg)
185
+ Figure 5: Visualization of the progressively sparsified tokens. We show the original input image and the sparsification results after the three stages, where the masks represent the corresponding tokens are discarded. We see our method can gradually focus on the most representative regions in the image. This phenomenon suggests that the DynamicViT has better interpretability.
186
+
187
+ Table 3: Effects of different losses. We provide the results after removing the distillation loss and the KL loss.
188
+
189
+ <table><tr><td>Base Model</td><td>DeiT-S</td><td>LVViT-S</td></tr><tr><td>DynamicViT</td><td>79.3(-0.5)</td><td>83.0(-0.3)</td></tr><tr><td>w/o distill (Eq.13)</td><td>79.3(-0.5)</td><td>82.7(-0.6)</td></tr><tr><td>w/o KL (Eq.14)</td><td>79.2(-0.6)</td><td>82.9(-0.4)</td></tr><tr><td>w/o distill&amp; KL</td><td>79.2(-0.6)</td><td>82.5(-0.8)</td></tr></table>
190
+
191
+ ![](images/d74529d91dbe960e8424f69c73c1efe7a7dcc985e463fd2fa07bb979b059cb31.jpg)
192
+ Figure 6: The keep probabilities of the tokens at each stage.
193
+
194
+ Effects of different losses. We show the effects of different losses in Table 3. We see the improvement brought by the distillation loss and the KL loss is not very significant, but it can consistently further boost the performance of various models.
195
+
196
+ Comparisons of different sparsification strategies. As illustrated in Figure 2, the dynamic token sparsification is unstructured. To discuss whether the dynamic sparsification is better than other strategies, we perform ablation experiments and the results are shown in Table 4. For the structural downsampling, we perform an average pooling with kernel size $2 \times 2$ after the sixth block of the baseline DeiT-S [25] model, which has similar FLOPs to our DynamicViT. The static token sparsification means that the sparsification decisions are not conditioned on the input tokens. We also compare our method with other token removal methods like randomly removing tokens or removing
197
+
198
+ (a) Dynamic sparsification static/structural downsampling.
199
+
200
+ Table 4: Comparisons of different sparsification strategies. We investigate different methods to select redundant tokens based on the DeiT-S model. We report the top-1 accuracy on ImageNet for different methods. We fix the complexity of the accelerated models to 2.9G FLOPs for fair comparisons.
201
+
202
+ <table><tr><td>Model</td><td>Acc. (%)</td></tr><tr><td>Random</td><td>77.5 (-2.3)</td></tr><tr><td>Attention</td><td>78.1 (-1.7)</td></tr><tr><td>Prediction</td><td>79.3 (-0.5)</td></tr></table>
203
+
204
+ (b) Different redundant token removal methods.
205
+
206
+ <table><tr><td>Model</td><td>Acc. (%)</td></tr><tr><td>Structural</td><td>78.2 (-1.6)</td></tr><tr><td>Static</td><td>73.4 (-6.4)</td></tr><tr><td>Dynamic</td><td>79.3 (-0.5)</td></tr></table>
207
+
208
+ (c) Effects of number of sparsification stages.
209
+ Table 5: Results on larger models. We apply our method to the model with larger width (i.e., DeiT-B) and the model with larger input size (i.e., DeiT-S with $3 8 4 \times 3 8 4$ input).
210
+
211
+ <table><tr><td>Model</td><td>Acc. (%)</td></tr><tr><td>Single-stage</td><td>77.4 (-2.4)</td></tr><tr><td>Two-stage</td><td>79.2 (-0.6)</td></tr><tr><td>Three-stage</td><td>79.3 (-0.5)</td></tr></table>
212
+
213
+ (a) Results on DeiT-B.
214
+
215
+ (b) Results on the $3 8 4 \times 3 8 4$ input.
216
+
217
+ <table><tr><td>Model</td><td>GFLOPs</td><td>Acc. (%)</td></tr><tr><td>DeiT-S</td><td>15.5</td><td>81.6</td></tr><tr><td>Dynamic ViT-S/0.7</td><td>9.5 (-39%)</td><td>81.4 (-0.2)</td></tr><tr><td>DynamicViT-S/0.5</td><td>7.0 (-55%)</td><td>80.3 (-1.3)</td></tr></table>
218
+
219
+ <table><tr><td>Model</td><td>GFLOPs</td><td>Acc. (%)</td></tr><tr><td>DeiT-B</td><td>17.5</td><td>81.8</td></tr><tr><td>Dynamic ViT-B/0.7</td><td>11.2 (-36%)</td><td>81.3 (-0.5)</td></tr></table>
220
+
221
+ tokens based the attention score of the class token. We find through the experiments that although other strategies have similar computational complexities, the proposed dynamic token sparsification method achieves the best accuracy. We also show that the progressive sparsification method is significantly better than one-stage sparsification.
222
+
223
+ Accelerating larger models. To show the effectiveness of our method on larger models, we apply our method to the model with larger width (i.e., DeiT-B) and models with larger input size (i.e., DeiT-S with $3 8 4 \times 3 8 4$ input). The results are presented in Table 5. We see our method also works well on the larger DeiT model. The accuracy drop become less significant when we apply our method to the model with larger feature maps. Notably, we can reduce the complexity of the DeiT-S model with $3 8 4 \times 3 8 4$ input by over $50 \%$ with only $1 . 3 \%$ accuracy drop.
224
+
225
+ # 5 Conclusion
226
+
227
+ In this work, we open a new path to accelerate vision transformer by exploiting the sparsity of informative patches in the input image. For each input instance, our DynamicViT model prunes the tokens of less importance in a dynamic way according to the customized binary decision mask output from the lightweight prediction module, which fuses the local and global information containing in the tokens. The prediction module is added to multiple layers such that the token pruning is performed in a hierarchical way. Gumbel-Softmax and attention masking techniques are also incorporated for the end-to-end training of the transformer model together with the prediction module. During the inference phase, our approach can greatly improves the efficiency by gradually pruning $66 \%$ of the input tokens, while the drop of accuracy is less than $0 . 5 \%$ for different transformer backbone. In this paper, we focus on the image classification task. Extending our method to other scenarios like video classification and dense prediction tasks can be interesting directions.
228
+
229
+ # Acknowledgment
230
+
231
+ This work was supported in part by the National Key Research and Development Program of China under Grant 2017YFA0700802, in part by the National Natural Science Foundation of China under Grant 62125603, Grant 61822603, Grant U1813218, Grant U1713214, in part by Beijing Academy of Artificial Intelligence (BAAI), in part by National Science Foundation under grant IIS-1901527, IIS-2008173, IIS-2048280, and in part by a grant from the Institute for Guo Qiang, Tsinghua University.
232
+
233
+ # References
234
+
235
+ [1] Andrew Brock, Soham De, Samuel L Smith, and Karen Simonyan. High-performance largescale image recognition without normalization. arXiv preprint arXiv:2102.06171, 2021. 7, 8
236
+ [2] Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In ECCV, pages 213–229, 2020. 3
237
+ [3] Hila Chefer, Shir Gur, and Lior Wolf. Transformer interpretability beyond attention visualization. arXiv preprint arXiv:2012.09838, 2020. 2
238
+ [4] Chun-Fu Chen, Quanfu Fan, and Rameswar Panda. Crossvit: Cross-attention multi-scale vision transformer for image classification. arXiv preprint arXiv:2103.14899, 2021. 8
239
+ [5] Bowen Cheng, Alexander G. Schwing, and Alexander Kirillov. Per-pixel classification is not all you need for semantic segmentation. NeurIPS, 2021. 3
240
+ [6] Xiangxiang Chu, Zhi Tian, Bo Zhang, Xinlong Wang, Xiaolin Wei, Huaxia Xia, and Chunhua Shen. Conditional positional encodings for vision transformers. arXiv preprint arXiv:2102.10882, 2021. 8
241
+ [7] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In CVPR, pages 248–255, 2009. 3, 7
242
+ [8] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929, 2020. 3, 8
243
+ [9] Yunchao Gong, Liu Liu, Ming Yang, and Lubomir Bourdev. Compressing deep convolutional networks using vector quantization. arXiv preprint arXiv:1412.6115, 2014. 3
244
+ [10] Qipeng Guo, Xipeng Qiu, Pengfei Liu, Yunfan Shao, Xiangyang Xue, and Zheng Zhang. Star-transformer. arXiv preprint arXiv:1902.09113, 2019. 3
245
+ [11] Kai Han, An Xiao, Enhua Wu, Jianyuan Guo, Chunjing Xu, and Yunhe Wang. Transformer in transformer. arXiv preprint arXiv:2103.00112, 2021. 8
246
+ [12] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, pages 770–778, 2016. 1
247
+ [13] Yihui He, Xiangyu Zhang, and Jian Sun. Channel pruning for accelerating very deep neural networks. In ICCV, pages 1389–1397, 2017. 3
248
+ [14] Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015. 3
249
+ [15] Eric Jang, Shixiang Gu, and Ben Poole. Categorical reparameterization with gumbel-softmax. In ICLR, 2017. 2, 5
250
+ [16] Zihang Jiang, Qibin Hou, Li Yuan, Daquan Zhou, Xiaojie Jin, Anran Wang, and Jiashi Feng. Token labeling: Training a $8 5 . 5 \%$ top-1 accuracy vision transformer with 56m parameters on imagenet. arXiv preprint arXiv:2104.10858, 2021. 3, 6, 7, 8
251
+ [17] Xiaoqi Jiao, Yichun Yin, Lifeng Shang, Xin Jiang, Xiao Chen, Linlin Li, Fang Wang, and Qun Liu. Tinybert: Distilling bert for natural language understanding. arXiv preprint arXiv:1909.10351, 2019. 3
252
+ [18] Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. NeurIPS, 25:1097–1105, 2012. 1
253
+ [19] Benlin Liu, Yongming Rao, Jiwen Lu, Jie Zhou, and Cho-Jui Hsieh. Metadistiller: Network self-boosting via meta-learned top-down distillation. In European Conference on Computer Vision, pages 694–709. Springer, 2020. 3
254
+
255
+ [20] Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows. arXiv preprint arXiv:2103.14030, 2021. 1, 3, 8
256
+
257
+ [21] Ilija Radosavovic, Raj Prateek Kosaraju, Ross Girshick, Kaiming He, and Piotr Dollár. Designing network design spaces. In CVPR, pages 10428–10436, 2020. 8
258
+
259
+ [22] Yongming Rao, Jiwen Lu, Ji Lin, and Jie Zhou. Runtime network routing for efficient image classification. IEEE transactions on pattern analysis and machine intelligence, 41(10):2291– 2304, 2018. 3
260
+
261
+ [23] Yongming Rao, Wenliang Zhao, Zheng Zhu, Jiwen Lu, and Jie Zhou. Global filter networks for image classification. In NeurIPS, 2021. 3
262
+
263
+ [24] Mingxing Tan and Quoc Le. Efficientnet: Rethinking model scaling for convolutional neural networks. In ICML, pages 6105–6114. PMLR, 2019. 7, 8
264
+
265
+ [25] Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Hervé Jégou. Training data-efficient image transformers & distillation through attention. arXiv preprint arXiv:2012.12877, 2020. 1, 2, 3, 6, 7, 8, 9
266
+
267
+ [26] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. arXiv preprint arXiv:1706.03762, 2017. 3, 5
268
+
269
+ [27] Kuan Wang, Zhijian Liu, Yujun Lin, Ji Lin, and Song Han. Haq: Hardware-aware automated quantization with mixed precision. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 8612–8620, 2019. 3
270
+
271
+ [28] Wenhai Wang, Enze Xie, Xiang Li, Deng-Ping Fan, Kaitao Song, Ding Liang, Tong Lu, Ping Luo, and Ling Shao. Pyramid vision transformer: A versatile backbone for dense prediction without convolutions. arXiv preprint arXiv:2102.12122, 2021. 8
272
+
273
+ [29] Weijian Xu, Yifan Xu, Tyler Chang, and Zhuowen Tu. Co-scale conv-attentional image transformers. arXiv preprint arXiv:2104.06399, 2021. 8
274
+
275
+ [30] Xiyu Yu, Tongliang Liu, Xinchao Wang, and Dacheng Tao. On compressing deep models by low rank and sparse decomposition. In CVPR, pages 7370–7379, 2017. 3
276
+
277
+ [31] Xumin Yu, Yongming Rao, Ziyi Wang, Zuyan Liu, Jiwen Lu, and Jie Zhou. Pointr: Diverse point cloud completion with geometry-aware transformers. In ICCV, 2021. 3
278
+
279
+ [32] Li Yuan, Yunpeng Chen, Tao Wang, Weihao Yu, Yujun Shi, Zihang Jiang, Francis EH Tay, Jiashi Feng, and Shuicheng Yan. Tokens-to-token vit: Training vision transformers from scratch on imagenet. arXiv preprint arXiv:2101.11986, 2021. 8
280
+
281
+ [33] Hengshuang Zhao, Li Jiang, Jiaya Jia, Philip Torr, and Vladlen Koltun. Point transformer. In ICCV, 2021. 3
282
+
283
+ [34] Sixiao Zheng, Jiachen Lu, Hengshuang Zhao, Xiatian Zhu, Zekun Luo, Yabiao Wang, Yanwei Fu, Jianfeng Feng, Tao Xiang, Philip H.S. Torr, and Li Zhang. Rethinking semantic segmentation from a sequence-to-sequence perspective with transformers. In CVPR, 2021. 3
284
+
285
+ [35] Daquan Zhou, Bingyi Kang, Xiaojie Jin, Linjie Yang, Xiaochen Lian, Qibin Hou, and Jiashi Feng. Deepvit: Towards deeper vision transformer. arXiv preprint arXiv:2103.11886, 2021. 3 [36] Xizhou Zhu, Weijie Su, Lewei Lu, Bin Li, Xiaogang Wang, and Jifeng Dai. Deformable detr: Deformable transformers for end-to-end object detection. arXiv preprint arXiv:2010.04159, 2020. 1
286
+
287
+ # Checklist
288
+
289
+ 1. For all authors...
290
+
291
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
292
+ (b) Did you describe the limitations of your work? [Yes] See Section 5. In this paper, we only study the dynamic token sparsification problem on the image classification task. Extending our method to a wider range of scenarios like video classification and dense prediction tasks can be interesting future directions.
293
+ (c) Did you discuss any potential negative societal impacts of your work? [N/A] We study a general framework for deep model acceleration. Our method is not for specific applications, which does not directly involve societal issues.
294
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
295
+
296
+ 2. If you are including theoretical results...
297
+
298
+ (a) Did you state the full set of assumptions of all theoretical results? [N/A] (b) Did you include complete proofs of all theoretical results? [N/A]
299
+
300
+ 3. If you ran experiments...
301
+
302
+ (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes]
303
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
304
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] We follow the common practice in previous works, where they didn’t report the error bars.
305
+ (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See our implementation details in the experiment part.
306
+
307
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
308
+
309
+ (a) If your work uses existing assets, did you cite the creators? [Yes]
310
+ (b) Did you mention the license of the assets? [N/A]
311
+ (c) Did you include any new assets either in the supplemental material or as a URL? [No]
312
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
313
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
314
+
315
+ 5. If you used crowdsourcing or conducted research with human subjects...
316
+
317
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
318
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
319
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
md/train/nHRGW_wETLQ/nHRGW_wETLQ.md ADDED
@@ -0,0 +1,276 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Fairness via Representation Neutralization
2
+
3
+ Mengnan $\mathbf { D } \mathbf { u } ^ { 1 }$ ∗, Subhabrata Mukherjee2, Guanchu Wang3, Ruixiang Tang3, Ahmed Hassan Awadallah2, Xia $\mathbf { H } \mathbf { u } ^ { 3 }$
4
+
5
+ 1Texas A&M University 2Microsoft Research 3Rice University dumengnan@tamu.edu, {submukhe,hassanam}@microsoft.com {guanchu.wang,rt39,xia.hu}@rice.edu
6
+
7
+ # Abstract
8
+
9
+ Existing bias mitigation methods for DNN models primarily work on learning debiased encoders. This process not only requires a lot of instance-level annotations for sensitive attributes, it also does not guarantee that all fairness sensitive information has been removed from the encoder. To address these limitations, we explore the following research question: Can we reduce the discrimination of DNN models by only debiasing the classification head, even with biased representations as inputs? To this end, we propose a new mitigation technique, namely, Representation Neutralization for Fairness (RNF) that achieves fairness by debiasing only the task-specific classification head of DNN models. To this end, we leverage samples with the same ground-truth label but different sensitive attributes, and use their neutralized representations to train the classification head of the DNN model. The key idea of RNF is to discourage the classification head from capturing undesirable correlation between fairness sensitive information in encoder representations with specific class labels. To address low-resource settings with no access to sensitive attribute annotations, we leverage a bias-amplified model to generate proxy annotations for sensitive attributes. Experimental results over several benchmark datasets demonstrate our RNF framework to effectively reduce discrimination of DNN models with minimal degradation in task-specific performance.
10
+
11
+ # 1 Introduction
12
+
13
+ Deep neural networks (DNNs) have made significant advances in recent times [1, 2, 3], and have been deployed in many real-world applications. However, DNNs often suffer from biases and show discrimination towards certain demographics, especially in high-stake applications, such as criminal justice, employment, loan approval, credit scoring, etc [4, 5, 6]. For example, COMPAS, an algorithmic recidivism predictor, is likely to associate African-American offenders with higher risk scores compared to Caucasians while having a similar profile [7]. This brings significant harm to both society and individuals, thus leading to recent focus on mitigation techniques to alleviate the adverse effects of DNN biases.
14
+
15
+ Existing debiasing methods usually work on learning debiased representations at the encoderlevel. One representative family of methods perform mitigation by explicitly learning debiased representations, either through adversarial learning [8, 9, 10] or invariant risk minimization [11, 12]. Another family of methods [13, 14, 15] implicitly learn debiased representations by incorporating explanation during model training to suppress it from paying high attention to biased features in the original input. Essentially, the above methods aim to remove the bias from deep representations.
16
+
17
+ Learning debiased representations is a technically challenging problem. Firstly, it is hard to remove all fairness sensitive information in the encoder. The suppression of fairness sensitive information might also remove useful information that is task relevant. Secondly, most existing debiasing methods assume access to additional meta-data such as fairness sensitive attributes and a lot of annotations corresponding to the protected groups to guide the learning of debiased representations. However, such resources are expensive to obtain, if not unavailable, for most real world applications.
18
+
19
+ To address these limitations, we explore the following research question: Can we reduce the discrimination of DNN models by only debiasing the task-specific classification head, even with a biased representation encoder? Our work is motivated by the empirical observation that standard training can result in the classification head capturing undesirable correlation between fairness sensitive information and specific class labels. Some recent works [16, 17, 18] have explored such spurious or shortcut learning behavior of DNNs in various applications. To this end, we propose the RNF (Representation Neutralization for Fairness) framework for mitigation, motivated by the Mixup work [19, 20]. We first train a biased teacher network via standard cross entropy loss. In the second stage, we freeze the representation encoder of the biased teacher, and only update the classification head via representation neutralization. This discourages the model from associating biased features with specific class labels, and enforces the model to focus more on task relevant information. To address low-resource settings, our RNF framework does not require any access to the protected attributes during training. To this end, we train a bias-amplified model using generalized cross entropy loss that is used to generate proxy annotations for sensitive attributes. Experimental results over several benchmark tabular and image datasets demonstrate our RNF framework to significantly reduce discrimination of DNN models with minimal degradation of the task performance. The major contributions of our work can be summarized as follows:
20
+
21
+ • We analyze bias propagation from the encoder representations to the final task-specific layer demonstrating that DNN models heavily rely on undesirable correlations for prediction.
22
+ • We introduce RNF, a bias mitigation framework for DNN models via representation neutralization. Our RNF framework achieves mitigation without any access to instance-level sensitive attribute annotations, and instead relies on self-generated proxy annotations.
23
+ • Experimental results on several benchmark datasets demonstrate the effectiveness of our RNF framework via debiasing only the classification head while using biased representations as input. Additionally, we show RNF to be complementary to existing methods that learn debiased encoders and can be further improved within our framework.
24
+
25
+ # 2 Related Work
26
+
27
+ We briefly review bias mitigation and broader robustness literature which are most relevant to ours.
28
+
29
+ Bias Mitigation. Recent studies have indicated that DNN models exhibit social bias towards certain demographic groups. This has led to increased attention to bias mitigation techniques in recent times [21, 22, 23]. Existing mitigation methods can be generally grouped into three broad categories. The first one is based on adversarial training [8, 9, 10]. It leads to a fair classifier as the predictions cannot carry any group discrimination information that the adversary can exploit. However, this method assumes that the sensitive attribute annotations are known, and uses those annotations to learn debiased representations. The second representative family of mitigation methods is based on explainability [13, 14, 15, 24]. These methods require fine-grained feature-level annotations to specify which subset of features are fairness sensitive. The third category falls under the umbrella of causal fairness [25, 11, 12]. The main idea is to enforce the model to concentrate more on task relevant causal features, and getting rid of superficial correlations [26]. This results in the model capturing debiased representations. For instance, [27] minimizes the correlation between sentence representations and bias words using a contrastive learning framework. We can typically decouple the classification problem into representation learning and classification as the two major parts [28]. Different from the above-mentioned methods that mainly aim to train the debiased representations, our work focuses on the classification head and aims to suppress it from capturing undesirable correlation between fairness sensitive attributes and class labels.
30
+
31
+ Shortcut Learning in DNNs. Our work is motivated by the observation that DNNs with standard training are prone to exploit undesirable correlations (or shortcuts in the dataset) for prediction [16, 29]. Beyond algorithmic discrimination, recent studies show that shortcut learning [17] can result in other undesirable consequences like poor generalization and adversarial vulnerability. Specifically, this leads to a high performance degradation for previously unseen inputs, especially for those data beyond held-out test set. Representative tasks depicting such behavior include reading comprehension [30], natural language inference [18], visual question answering[31] and deepfake detection [32].
32
+
33
+ ![](images/4f87e639c46a2629a698cb9f47b7bef8705729e59c21d9b8e4d05a01c94db98d.jpg)
34
+ Figure 1: Representation analysis of $z$ using Kernel PCA. (a) Protected attribute $a$ (i.e., gender) is a discriminative feature. In this plot, the male group primarily lies in the lower left interval, whereas the female group is located primarily on the upper right interval. (b) Predicted positive label and negative task-label distribution. (c) Representation neutralization (please refer to Sec. 3.3) to reduce the discriminative power of $a$ for dimensions relevant to the sensitive information, comparing to the distribution in (a). (d) Neutralization still preserves the useful task relevant information.
35
+
36
+ The most similar work to ours also regularizes the model training using interpolated samples between groups [33]. Similar to the aforementioned solutions, this work also heavily relies on sensitive attribute annotations in the training set. This limits the application scenarios of the mitigation algorithms, especially for many real-world applications without readily available annotations dealing with sensitive attributes. Our representation neutralization framework achieves comparable or better performance to such techniques without relying on such sensitive annotations by leveraging proxy annotations obtained from a bias-intensified version of our framework, thereby, making it broadly applicable to arbitrary real-world applications.
37
+
38
+ # 3 Representation Neutralization for Fairness
39
+
40
+ In this section, we first analyze the task-specific classification head of a DNN to examine how bias is propagated from the encoder representation layer to the task-specific output layer (Section 3.2). We empirically demonstrate the undesirable correlation between fairness sensitive information in representations with specific class labels. Based on the observation, we introduce the Representation Neutralization for Fairness (RNF) framework to debias DNN models (Section 3.3). Finally, we propose an approach to generate proxy annotations for sensitive attributes, enabling the RNF framework to be applicable to low-resource settings with no access to sensitive attribute annotations (Section 3.4).
41
+
42
+ # 3.1 Notations
43
+
44
+ We first introduce the notations used in this work. Let $\mathcal { X } = \{ x _ { i } , y _ { i } , a _ { i } \} , i \in { 1 , . . . , N }$ be the training set, where $x _ { i }$ is the input feature, $y _ { i }$ denotes the ground truth label, and $a _ { i }$ represents the sensitive attribute (e.g., gender, race, age). For ease of notation, in the following sections, we consider binary sensitive attributes2. Nevertheless, our proposed mitigation framework can also be applied to non-binary sensitive attributes (e.g., age).
45
+
46
+ Consider the classification model $f ( x , \theta ) = c ( g ( x ) )$ , parameterized with $\theta$ as the model parameters. Here $g ( x ) : \mathcal { X } \mathcal { Z }$ represents the feature encoder, and $g ( x ) = z$ is the representation for $x$ obtained from a DNN model. The predictor $c ( z ) : { \mathcal { Z } } \to { \mathcal { Y } }$ is the multi-layer classification head. It is depicted by the top layer(s) of the DNN, which takes the encoded representation $z$ as input and maps it to softmax probability. The final class prediction is denoted by $\tilde { y } = \arg \operatorname* { m a x } c ( z )$ . In this work, we aim to reduce the discrimination of DNN models by only debiasing the classification head $c ( z )$ , with the biased representation encoder $g ( x )$ as input.
47
+
48
+ # 3.2 Analysis of the Classification Head
49
+
50
+ In this section, we examine how bias manifests in the representation space $\mathcal { Z }$ as well as how the classification head $c ( z )$ obtained with standard training scheme propagates bias from the representation layer to the model output layer. To this end, we train a biased network $f _ { T } ( x )$ via standard cross entropy loss, where the following experiment is performed using the Adult dataset [34].
51
+
52
+ Representation Probing Analysis. For the Adult training set, we generate representation vectors for 500 training samples using the biased network $f _ { T } ( x )$ and project them in 2D for visualization. To this end, we utilize the Kernel Principal Component Analysis (KPCA) [35] with a sigmoid kernel, which is a tool to visualize high-dimensional data. Since the classification head $c ( z )$ contains multiple non-linear layers, we choose kernel PCA instead of a linear dimensionality reduction method such as linear PCA. The visualization is shown in Figure 1 (a). The plot depicts that the low dimensional projection separates the two protected groups in two areas, where the male group is primarily located in the lower left area, whereas the female group primarily occupies the upper right area. Comparing the task-label $y$ distribution in Figure 1 (b) with the protected group distribution in Figure 1 (a), we observe that the protected attribute information is a discriminative feature that could be exploited by the task classification head for prediction.
53
+
54
+ Role of the Biased Classification Head. The above demonstrative analysis indicates that the model representation captures both useful task relevant classification information as well as bias information from protected attributes. Specifically, the model captures strong correlation between the fairness sensitive information and the class labels. On analyzing the data distribution, we observe this to be an artifact of the conditional label distribution with respect to the sensitive attributes being skewed. The model relies on this shortcut for prediction, resulting in bias amplification. We observe the male neurons to positively correlate to the desirable label (also refer to the experimental analysis in Sec. 4.3), whereas the female neurons positively correlate to undesirable label. This depicts an undesirable correlation between sensitive information with certain class labels in the model.
55
+
56
+ Our Motivation. Based on the above empirical observations, we propose to neutralize the training samples (Fig 1 (c)) so as to reduce the discriminative power of the fairness sensitive information, while at the same time preserving task relevant information (Fig 1 (d)). With the neutralized training data, we propose to re-train the classification head. Our goal is to adjust the decision boundary to implicitly de-correlate the fairness sensitive information in the representation space with class labels.
57
+
58
+ # 3.3 Representation Neutralization for Debiasing Classification Head
59
+
60
+ Based on the aforementioned empirical observations, in this section we propose a simple yet effective bias mitigation framework via Representation Neutralization for Fairness (RNF). RNF does not require any prior knowledge about existing bias in the representation space; nor does it require any knowledge about specific dimension(s) encoding the sensitive attributes – making it widely useful for arbitrary applications. Our goal is to encourage the model to ignore the sensitive attributes and instead focus more on task relevant information.
61
+
62
+ RNF is implemented in two steps (see Figure 2). In the first step, we train the model using cross entropy loss, and obtain a biased teacher network $f _ { T } ( x )$ . During the second step, we freeze the encoder $g ( x )$ for $f _ { T } ( x )$ , and use it as our backbone encoder for learning representations. We then re-train only the classification head $c ( z )$ using feature neutralization (see Figure 2 (b)).
63
+
64
+ Representation Neutralization. To this end, while training the classification head, for an input sample $\{ x _ { 1 } , y , a _ { 1 } \}$ , we randomly select another sample $\{ x _ { 2 } , y , a _ { 2 } \}$ , with the same class label $y$ but a different sensitive attribute $a _ { 2 }$ compared to $a _ { 1 }$ in the input sample. Now we compute the corresponding representations $z _ { 1 } = g ( x _ { 1 } )$ and $z _ { 2 } = g ( x _ { 2 } )$ and re-train the classification head using the neutralized representation the neutralized $\begin{array} { r } { z = \frac { z _ { 1 } + z _ { 2 } } { 2 } } \end{array}$ as inbility supervision label after temperature $y$ for the classification head, we utilizecaling obtained as follows. Given the $\begin{array} { r } { y = \frac { p _ { 1 } + p _ { 2 } } { 2 } } \end{array}$
65
+ logit vector $z _ { 1 }$ for input $x _ { 1 }$ , the probability for class $i$ is computed as $\begin{array} { r } { p _ { 1 , i } = \frac { \exp ( z _ { 1 , i } / T ) } { \sum _ { j } \exp ( z _ { 1 , j } / T ) } } \end{array}$ , where $T \geq 1$ . This can be regarded as a form of knowledge distillation [36], where $T > 1$ softens the softmax score. A larger temperature prevents the model from assigning over-confident prediction probabilities. A special case for RNF is when $T = 1$ , where $p _ { 1 }$ and $p _ { 2 }$ are the standard softmax probabilities obtained from the biased teacher network $f _ { T } ( x )$ .
66
+
67
+ ![](images/0c76773c333ac8c9a63aa9c9b54f33638412319e47f79c29080bb14557cd9cbf.jpg)
68
+ Figure 2: Debiasing with representation neutralization. (a) We first train a biased teacher network using only cross entropy loss. For two inputs $x _ { 1 }$ and $x _ { 2 }$ that with the same class label $y$ and different sensitive attribute $a$ , we obtain the representations $z _ { 1 }$ and $z _ { 2 }$ , and softened probabilities $p _ { 1 }$ and $p _ { 2 }$ . (b) We freeze parameters of the biased encoder and only re-train the classification head using the neutralized representation $\frac { z _ { 1 } + z _ { 2 } } { 2 }$ as input, and softened probability $\frac { p _ { 1 } + p _ { 2 } } { 2 }$ as supervision signal.
69
+
70
+ We use the knowledge distillation loss. In particular, the mean squared error (MSE) loss is used as a distance-based metric to measure the similarity between model prediction and the supervision signal.
71
+
72
+ $$
73
+ \mathcal { L } _ { \mathrm { M S E } } = ( \hat { y } _ { i } - y ) ^ { 2 } = \{ c ( \frac { 1 } { 2 } z _ { 1 } + \frac { 1 } { 2 } z _ { 2 } ) - ( \frac { 1 } { 2 } p _ { 1 } + \frac { 1 } { 2 } p _ { 2 } ) \} ^ { 2 } .
74
+ $$
75
+
76
+ where, $c$ is the classification head to project representations to softmax prediction probability.
77
+
78
+ There are two main benefits of the aforementioned training scheme. From the input perspective, the neutralization of representations suppresses the model from capturing the undesirable correlation between fairness sensitive information in the representation with the class labels. From the output perspective, the softened label encourages the model to assign similar predictions to different sensitive groups. Optimizing Eq. (1) can lead to reduced generalization gap between the two groups.
79
+
80
+ Theorem 1 Given a well-trained representation encoder $g ( x ) \ = \ z$ satisfying $| | z _ { 1 } - z _ { 2 } | | _ { 2 } \leq$ $\lambda _ { z } | p _ { 1 } - p _ { 2 } |$ for $x _ { 1 } , x _ { 2 } \ \in \ { \mathcal { X } }$ and a bounded loss function $L ( c ( z _ { i } ) , p _ { i } ) = ( 1 - p _ { i } ) l ( c ( z _ { i } ) , y =$ $0 ) + p _ { i } l ( c ( z _ { i } ) , y = 1 )$ , where $l ( c ( z _ { i } ) , y ~ = ~ j ) ~ \le ~ \epsilon _ { L }$ for $x _ { i } ~ \in ~ { \mathcal { X } }$ and $j ~ = ~ 0 , 1$ ; if the classification head c minimizes the loss between neutralized representation and soft probabilities, i.e. $\left| \Big | \nabla _ { z } L ( c ( z ) , p ) \big | _ { z = \frac { z _ { 1 } + z _ { 2 } } 2 , p = \frac { p _ { 1 } + p _ { 2 } } 2 } \Big | \right| _ { 2 } \ \le \ \epsilon _ { c } ,$ , where $z ~ = ~ g ( x )$ , $x _ { 1 } ~ \sim ~ P ( x _ { 1 } ~ \mid ~ a _ { i } ~ = ~ 0 )$ , $x _ { 2 } \sim P ( x _ { 2 } \mid a _ { i } = 1 )$ , $| p _ { 1 } - p _ { 2 } | \le \epsilon _ { p }$ , the gap of generalization loss between groups $a = 0$ and $a = 1$ is bounded by:
81
+
82
+ $$
83
+ \begin{array} { r } { \left| \mathbb { E } _ { x _ { i } \sim P ( x _ { i } \mid a _ { i } = 0 ) } L ( c ( z _ { i } ) , p _ { i } ) - \mathbb { E } _ { x _ { j } \sim P ( x _ { j } \mid a _ { j } = 1 ) } L ( c ( z _ { j } ) , p _ { j } ) \right| \le \epsilon _ { p } ( \lambda _ { z } \epsilon _ { c } + \epsilon _ { L } ) } \end{array}
84
+ $$
85
+
86
+ Here “well-trained” means that the model has learned reasonably good representations to encode sufficient task relevant information. Essentially, after training for a sufficient number of epochs until the validation loss has converged, we have access to a reasonably good representation space (although it might encode a lot of fairness sensitive information). If we use the RNF loss function to further train the classification head, the generalization gap between the different protected groups would be small. For more detailed proof, please refer to Section A in the Appendix.
87
+
88
+ Smoothing Neutralization. To further enforce the model to ignore sensitive attributes, we construct augmented training samples using a hyper-parameter $\lambda$ to control the degree of neutralization of the samples $\{ z _ { 1 } , p _ { 1 } , \bar { y } \}$ and $\left\{ z _ { 2 } , p _ { 2 } , \bar { y } \right\}$ . The augmented neutralized sample is given by $z =$ $\lambda z _ { 1 } + ( 1 - \lambda ) z _ { 2 }$ , $\lambda \in [ \frac { 1 } { 2 } , 1 )$ . We encourage the classification head to give similar prediction scores for the augmented and the neutralized sample (with $\begin{array} { r } { \lambda = \frac { 1 } { 2 } . } \end{array}$ ). The regularization loss is given by:
89
+
90
+ $$
91
+ \mathcal { L } _ { \mathrm { S m o o t h } } = \sum _ { \lambda \in [ \frac { 1 } { 2 } , 1 ) } | c ( \lambda z _ { 1 } + ( 1 - \lambda ) z _ { 2 } ) - c ( \frac { 1 } { 2 } z _ { 1 } + \frac { 1 } { 2 } z _ { 2 } ) | _ { 1 } .
92
+ $$
93
+
94
+ By varying $\lambda$ we control the degree of sensitive information for the augmented samples. It is utilized to penalize the large changes in softmax probability when we move along the interpolation between two samples. We linearly combine the MSE loss in Eq. (1) with the regularization term as follows:
95
+
96
+ $$
97
+ \begin{array} { r } { \mathcal { L } = \mathcal { L } _ { \mathrm { M S E } } + \alpha \mathcal { L } _ { \mathrm { S m o o t h } } . } \end{array}
98
+ $$
99
+
100
+ We train the classification head using the loss function in Eq. (4). Eventually we combine the original encoder of $f _ { T } ( x )$ and re-trained classification head as the debiased student network $f _ { S } ( x )$ . The teacher $f _ { T } ( x )$ is later discarded and the debiased student network $f _ { S } ( x )$ is used for prediction.
101
+
102
+ # 3.4 Generating Proxy Annotations for Sensitive Attributes
103
+
104
+ The aforementioned feature neutralization is limited in that it requires instance-level sensitive attribute annotations $\{ a _ { i } \} _ { i = 1 } ^ { N }$ for all training samples. Such resource-extensive annotations are difficult to obtain for many practical applications particularly due to the nature of the sensitive attributes. To address this limitation, we propose a method to generate proxy annotations $\{ \hat { a } _ { i } \} _ { i = 1 } ^ { N }$ for the sensitive attributes based on the model uncertainty. The key idea is that a biased model generates over-confident predictions for one demographic group, while giving much lower scores for the alternative group. Particularly, the bias-amplified model tends to assign the privileged group more desired outcome, while assigning the under-privileged group less-desired outcome. For instance in the Adult dataset, the average prediction probability of the desired label (higher income) for the male group is much higher than that of the female group. In contrast, the average probability of the less-desired label for the female group is much higher than that of the male group.
105
+
106
+ To better facilitate the model to generate uncertainty scores, we train another biased model by intentionally amplifying the bias via generalized cross entropy loss (GCE) [37]. The bias-amplified model is denoted as $f _ { B } ( x )$ and the loss function is given as follows:
107
+
108
+ $$
109
+ \operatorname { G C E } ( f ( x ; \theta ) , y ) = { \frac { 1 - f _ { y } ( x ; \theta ) ^ { q } } { q } } ,
110
+ $$
111
+
112
+ where $f _ { y } ( x ; \theta )$ denotes the output probability for ground truth label $y$ . The hyper-parameter $q \in ( 0 , 1 ]$ controls the degree of bias amplification. When $\mathrm { l i m } _ { q \to 0 }$ , the GCE loss in Equation (2) approaches $- \mathrm { l o g } p$ which is equivalent to standard cross entropy loss. The core idea is that for more biased samples, i.e., samples with larger $f _ { y } ( x ; \theta )$ value, the model assigns higher weights $f _ { y } ^ { q }$ while updating the gradient.
113
+
114
+ $$
115
+ \frac { \partial \mathrm { G C E } ( p , y ) } { \partial \theta } = f _ { y } ^ { q } \frac { \partial \mathrm { C E } ( p , y ) } { \partial \theta } .
116
+ $$
117
+
118
+ In this setup, the model $f _ { B } ( x )$ learns more from bias-amplified samples compared to the model $f _ { T } ( x )$ trained with standard cross entropy loss.
119
+
120
+ The confidence score of $f _ { B } ( x )$ is used to indicate whether a sample belongs to a privileged or unprivileged group. Specifically, for a desired ground truth label, samples with over-confident scores are grouped into the privileged group, whereas subsets of samples with low prediction scores are grouped into the unprivileged group. In contrast, for the undesired ground truth label, samples with over-confident scores are grouped into the unprivileged group, and vice versa. Based on this criterion, we generate proxy sensitive attribute annotation $\hat { a }$ for each training sample $x$ to split samples into two groups, which are subsequently used for feature neutralization.
121
+
122
+ The overall process of our RNF mitigation framework is given in Algorithm 1, which contains two stages. In the first stage, we train the biased teacher network $f _ { T } ( x )$ 1 and the biasamplified network $f _ { B } ( x )$ 2 . In the second stage, we first use $f _ { B } ( x )$ 3 to generate proxy sensitive attribute annotations for all training samples. We use the ratio $\gamma$ 4 to partition the training set to gen5 erate proxy annotations for protected attributes 6 that are subsequently used for feature neutralization. Note that the ratio $\gamma$ is determined by the 7 fairness-accuracy trade-off on the validation set. Then we use representation neutralization and the loss function in Eq. (4) to re-train the classification head of $f _ { T } ( x )$ . Eventually, we combine the original encoder $\overset { \cdot } { \boldsymbol { g } } ( \boldsymbol { x } )$ of $f _ { T } ( x )$ and the re
123
+
124
+ # Algorithm 1: RNF mitigation framework.
125
+
126
+ Input: Training data $D = \{ ( x _ { i } , y _ { i } ) \} _ { i = 1 } ^ { N }$ .
127
+ Set hyperparameter $q , \alpha$ .
128
+ while first stage do Train teacher network $f _ { T } ( x )$ and bias-amplified network $f _ { B } ( x )$ .
129
+
130
+ while second stage do
131
+
132
+ Determine the splitting threshold $\gamma$ for $f _ { B } ( { \boldsymbol { x } } )$ ; Calculate proxy annotation $\hat { a } _ { i }$ for each training sample $\{ ( x _ { i } ) \} _ { i = 1 } ^ { N }$ based on $\gamma$ and $f _ { B } ( x )$ ; Use loss function in Eq. (4) to re-train classification head $c ( z )$ of $f _ { T } ( x )$ .
133
+
134
+ Output: The debiased student network $f _ { S } ( x )$
135
+
136
+ fined classification head $c ( z )$ to give us the debiased student network $f _ { S } ( x )$ . It is worth noting that the neutralization is merely performed during the training stage for only debiasing the classification head. At inference time, the features just come in as encoded, and the classification head has learned to not exploit any of the information correlated with the sensitive attribute for prediction.
137
+
138
+ # 4 Experiments
139
+
140
+ In this section, we conduct experiments to evaluate the effectiveness of our RNF framework.
141
+
142
+ # 4.1 Experimental Setup
143
+
144
+ # 4.1.1 Fairness Metrics, Benchmark Datasets and Baselines
145
+
146
+ We use two group fairness metrics: Demographic Parity [38] and Equalized Odds [39]. Demographic Parity (DP) measures the ratio of the probability of favorable outcomes between unprivileged and privileged groups: $\begin{array} { r } { \mathrm { D P } = \frac { p ( \hat { y } = 1 | a = 0 ) } { p ( \hat { y } = 1 | a = 1 ) } } \end{array}$ . Equalized Odds $( \Delta \mathrm { E O } )$ require favorable outcomes to be independent of the protected class attribute $a$ , conditioned on the ground truth label $y$ . Specifically, it calculates the summation of the True Positive Rate difference and False Positive Rate difference:
147
+
148
+ $$
149
+ y = 1 ) \} + \{ P ( \hat { y } = 1 \mid a = 0 , y = 0 ) - P ( \hat { y } = 1 \mid a = 1 , y = 0 ) \}
150
+ $$
151
+
152
+ Under the above metrics, it is desirable to have a DP value closer to 1 and $\Delta \mathrm { E O }$ value closer to 0.
153
+
154
+ Table 1: Dataset statistics.
155
+
156
+ <table><tr><td></td><td>Adult</td><td>MEPS</td><td>CelebA</td></tr><tr><td>#Training</td><td>33120</td><td>11362</td><td>194599</td></tr><tr><td>#Validation</td><td>3000</td><td>1200</td><td>4000</td></tr><tr><td>#Test</td><td>9102</td><td>3168</td><td>8000</td></tr></table>
157
+
158
+ We use two benchmark tabular datasets and one image dataset to evaluate the effectiveness of RNF. For the Adult income dataset (Adult), the goal is to predict whether a person’s income exceeds $\$ 50 K/\mathrm { y r }$ [34]. We consider gender as the protected attribute where vanilla trained models show discrimination towards the female group by predicting females to earn less. For the Medical
159
+
160
+ Expenditure dataset (MEPS), we consider two groups white and non-white [40]. Here the task is to predict whether a person would have a ‘high’ utilization, where vanilla DNN shows discrimination towards the non-white group. The CelebFaces Attributes (CelebA) dataset is used to predict whether the hair in an image is wavy or not [41]. We consider two groups male and female, where vanilla trained models show discrimination towards the male group. We split all datasets into three subsets with statistics reported in Table 1. More details of the datasets are included in Sec. C in the Appendix.
161
+
162
+ We compare two variants of our framework RNF (using proxy sensitive attribute annotations) and $\mathbf { R N F } _ { \mathbf { G T } }$ (using ground truth sensitive attribute annotations) against baselines such as DNNs trained using only cross entropy loss (referred as Vanilla) and two regularization based mitigation methods, namely, adversarial training (Adversarial) [42] and Equalized Odds Regularization (EOR) [43]. Among them, the Adversarial method achieves fairness via learning debiased representations, whereas EOR directly optimizes the EO metric in Eq. (7). All three baselines control the fairness-accuracy trade-off via hyper-parameters. More details on the baselines are included in Sec. D in the Appendix.
163
+
164
+ # 4.1.2 Implementation Details
165
+
166
+ For the image classification task, we use ResNet-18 [1] (we add one more fully connected layer). We set the representation encoder $g ( x )$ as the convolutional layers and use the remaining two fully connected layers as the classification head $c ( z )$ . For tabular datasets, we use a three-layer MLP (multilayer perceptron) as the classification model, where the first layer is set as the encoder and the remaining two layers are used as the classification head. Dropout is used for the first two layers with the dropout probability fixed at 0.2. We use the same batch size of 64 for tabular datasets and 390 for the image dataset. For selecting another random sample $\{ x _ { 2 } , y , a _ { 2 } \}$ to be neutralized with current sample $\mathbf { \bar { \{ } } x _ { 1 } , y , a _ { 1 } \}$ , we perform the selection within the current batch of training data. The hyperparameters (e.g., learning rate and training epoches) are determined based on the model performance on the validation set, and early-stopping based on validation performance is used to avoid overfitting. The optimal temperature $T$ used to calculate the probability is set as 2.0, 5.0, 2.0 for Adult, MEPS and CelebA datasets respectively. For Eq. (3), we sample $\lambda$ from the list [0.6, 0.7, 0.8, 0.9]. The hyper-parameter $q$ in Eq. (5) is set as $0 . 2 , 0 . 6 , 0 . 3$ for Adult, MEPS and CelebA datasets respectively.
167
+
168
+ ![](images/4686305c6c8dc1e570d982dcc14a980a30ee225bd363abdc370790e7844b8160.jpg)
169
+ Figure 3: The fairness-accuracy curve comparison of RNF and other baselines. The first and second row depict the DP accuracy and $\Delta \mathrm { E O }$ accuracy trade-off curves, respectively. Note that there is a certain level of variance for each baseline method, and we report the average over 10 runs.
170
+
171
+ # 4.2 Mitigation Performance Analysis
172
+
173
+ We compare the mitigation performance of RNF (with proxy attribute annotations) and ${ \mathrm { R N F } } _ { \mathrm { G T } }$ (with ground-truth attribute annotations) with other competing methods and illustrate their fairness-accuracy curves for the three datasets in Figure 3. The hyper-parameter $\alpha$ in Eq. (4) controls the trade-off between accuracy and fairness for RNF. For Adversarial and EOR, we vary their regularization weights to obtain the corresponding performance curves. As the random seeds lead to variance in the accuracy and fairness metrics (please refer to Section E.4 in the Appendix for detailed analysis of the variability effect), we train the model for 10 times with different seeds and report the average result. Overall, we make the following key observations.
174
+
175
+ • Even though RNF does not rely on annotations for the sensitive attributes, it performs similar to baseline methods with access to such information, e.g, Adversarial training, or better than them in some cases. This makes RNF readily usable for real-world applications where protected attributes are not available in the training set.
176
+ • ${ \sf R N F } _ { \mathrm { G T } }$ improves mitigation performance over RNF by $1 0 \%$ on an average across all datasets and metrics, thereby, demonstrating the benefit of using ground truth sensitive attribute annotations.
177
+ • The soft labels of RNF and ${ \mathsf { R N F } } _ { \mathrm { G T } }$ (obtained using a higher temperature $T$ ) discourage the model to assign overconfident predictions, thereby, suppressing it from capturing undesirable correlation between fairness sensitive information and class labels. Penalizing the large changes of probability as we move along the interpolation between two samples further suppresses the model from capturing the undesirable correlation.
178
+ • Direct optimization of the equality of odds metric (i.e., EOR) achieves comparable performance to ${ \mathrm { R N F } } _ { \mathrm { G T } }$ for all the datasets. However, it has limited improvement in terms of the demographic parity metric. Note that EOR requires instance-level annotations for the protected attributes.
179
+ • We observe that Adversarial training also performs effective mitigation by learning debiased representations. However, this happens at the expense of a higher accuracy drop for the task performance. This likely results from the loss of task relevant information while suppressing sensitive information from the representations. Additionally, we observe adversarial training to be unstable, especially for relatively complex task like image classification.
180
+
181
+ # 4.3 Classification Head Analysis
182
+
183
+ In this section, we use explainability and an auxiliary prediction task to analyze the classification head $c ( z )$ for the Adult dataset. Particularly, we leverage explainability as a debugging tool to analyze the attention difference between Vanilla and RNF model with respect to the representations.
184
+
185
+ Auxiliary Sensitive Attribute Prediction Task. We perform a representation analysis using an auxiliary prediction task. To this end, we train another linear classifier to predict sensitive attributes using the biased representation $g ( x ) = z$ as input and the sensitive attribute annotations $\{ a _ { i } \} _ { i = 1 } ^ { N }$ as the supervision signal. The linear classifier is denoted by $L _ { \mathrm { S E N S } } ( z ) = W z + b$ , where $W$ and $b$ represent the weight matrix and bias for the linear classifier respectively. The weight matrix $W$ can be used to measure the degree of bias in each dimension of the representation $z$ .
186
+
187
+ Explanation Analysis. We use post-hoc explainability [44] to analyze the contribution of the classification head $c ( z )$ . Our goal is to figure out the contribution of each dimension within the biased representation $g ( x ) = z$ towards the model prediction $f ( x , \theta ) = c ( g ( x ) )$ . We train a linear classifier $L _ { \mathrm { e x p l a n } } ( z ) = \bar { W } \dot { z } + b$ to mimic the decision boundary of the multi-layer classification head $c ( z )$ .
188
+
189
+ We compare the weight matrix of the two linear classifiers $L _ { \mathrm { S E N S } } ( z )$ and $L _ { \mathrm { e x p l a n } } ( z )$ using cosine similarity. For models trained using Adult dataset, we extract the weight matrix corresponding to the protected attribute Male and task label Positive, and then we calculate the cosine similarity between the Male vector and the Positive vector. This follows from our observation in Figure 1 that the vanilla model makes use of male relevant information to make positive predictions. For the Vanilla model and RNF models listed in Figure 3 (a), we calculate the cosine similarity and report the DP-Similarity performance in Figure 4. We observe that RNF dramatically reduces the cosine similarity between positive predictions and male relevant information compared to Vanilla (from 0.272 to 0.075), by adjusting the decision boundary.
190
+
191
+ This eventually helps the head $c ( z )$ to shift its attention from fairness sensitive information to task relevant information.
192
+
193
+ ![](images/b9c3f6b8be378b0a238498a25921809e5af3fe75a2594128a6d1e9ef8279a652.jpg)
194
+ Figure 4: Analysis for the classification head.
195
+
196
+ # 4.4 Effectiveness of GCE Loss
197
+
198
+ We use MEPS dataset to examine the GCE loss in terms of generating proxy annotations for the protected attributes. The results are shown in Table 2. Firstly, we compare the fairness performance of GCE loss with standard CE loss (Vanilla). As expected, we observe that GCE is more biased than Vanilla in terms of the fairness metrics with $0 . 2 \%$ accuracy difference. Secondly, we compare RNF with several of its variants: 1) replacing GCE loss with cross entropy (CE) loss to generate proxy labels, and 2) using random annotations for the protected attributes. For a fair comparison, except for the protected attribute annotations, we use the same set of hyper-parameters for different variants. Even though the same level of regularization is performed for the three RNF variants, RNF-GCE has a higher mitigation performance than RNF-CE with $3 . 0 \%$ DP improvement and only $0 . 3 \%$ accuracy difference, thereby, demonstrating the effectiveness of GCE in terms of separating protected groups. Another observation is that even using random annotations, our RNF framework could achieve certain level of mitigation. This is because partial samples contain different sensitive attributes, which still could serve neutralization purpose.
199
+
200
+ Table 2: Ablation analysis.
201
+
202
+ <table><tr><td></td><td colspan="2">MEPS</td></tr><tr><td>Models</td><td>Accuracy</td><td>DP △EO</td></tr><tr><td>Vanilla</td><td>0.862</td><td>0.866 -0.210</td></tr><tr><td>GCE</td><td>0.860</td><td>0.839 -0.249</td></tr><tr><td>RNF-GCE</td><td>0.839</td><td>0.964 -0.099</td></tr><tr><td>RNF-CE</td><td>0.842</td><td>0.936 -0.128</td></tr><tr><td>RNF-Random</td><td>0.856</td><td>0.902 -0.163</td></tr></table>
203
+
204
+ # 4.5 Varying Layers for the Classification Head
205
+
206
+ We use MEPS and CelebA two datasets to study the effect of an important hyper-parameter of our framework in terms of which layers to use for the encoder. Our classification model $f ( x )$ contains the encoder $g ( x )$ and task predictor $c ( z )$ . In this experiment, we vary the depth of the representation layer to examine the effect of
207
+
208
+ Table 3: Varying the layers for classification head.
209
+
210
+ <table><tr><td rowspan="3">Models</td><td colspan="2">MEPS</td><td colspan="3">CelebA</td></tr><tr><td>Accuracy</td><td>DP △EO</td><td>Accuracy</td><td>DP</td><td>△EO</td></tr><tr><td>RNF</td><td>0.839</td><td>0.964 -0.099</td><td>0.668</td><td>0.836</td><td>-0.290</td></tr><tr><td>RNF-Last</td><td>0.837</td><td>0.971 -0.076</td><td>0.641</td><td>0.966</td><td>-0.052</td></tr></table>
211
+
212
+ layer selection. In particular, we investigate the question: can we debias only the very last layer, with the remaining layers as the biased encoder? We report the results for MEPS and CelebA datasets in Table 3, where the second row depicts the result of debiasing only the last layer. On MEPS dataset, RNF-Last has better performance in terms of the two fairness metrics with only $0 . 2 \%$ accuracy difference. Similarly, for CelebA dataset, with $2 . 7 \%$ accuracy difference, RNF-Last has better fairness performance (with $13 \%$ DP improvement). This demonstrates that debiasing only the last layer can achieve similar performance compared to debiasing the last several layers.
213
+
214
+ # 4.6 Representation Neutralization with Debiased Encoder
215
+
216
+ In the discussions so far, we reported the performance of RNF while debiasing only the classification head. In this section, we analyze the impact of RNF built on top of a debiased encoder. We first use Adversarial or EOR training to learn a debiased encoder – which is subsequently used as the backbone encoder for updating the classification head using RNF. This experiment is performed on the MEPS dataset where both Adversarial and EOR methods achieve competitive performance. We use the same hyper-parameters for different RNF variants and report a single point in the fairness-accuracy curve. The results are shown in Table 4. We observe RNF_EOR to achieve better fairness performance over RNF, with DP metric improvement of $1 . 6 \%$ and $\Delta \mathrm { E O }$ metric moves closer to 0. However, such improvement in the fairness metrics incur some loss in the task performance – where the accuracy reduces by $0 . 5 \%$ . We observe a similar trend with the combination of RNF and Adversarial training, where the joint combination improves the fairness metrics DP and $\Delta \mathrm { E O }$ . Similar to the previous case, this fairness improvement is achieved at the expense of some task performance degradation, where the accuracy drops by $1 . 3 \%$ . This indicates that our RNF is complementary to using a debiased encoder where the joint combination performs better than either of them in terms of the fairness metrics with some loss in task performance.
217
+
218
+ Table 4: RNF with debiased encoder.
219
+
220
+ <table><tr><td rowspan="2">Models</td><td colspan="3">MEPS</td></tr><tr><td>Accuracy</td><td>DP</td><td>△EO</td></tr><tr><td>Vanilla</td><td>0.862</td><td>0.866</td><td>-0.210</td></tr><tr><td>RNF</td><td>0.839</td><td>0.964</td><td>-0.099</td></tr><tr><td>RNF_EOR</td><td>0.834</td><td>0.980</td><td>-0.049</td></tr><tr><td>RNF_Adversarial</td><td>0.826</td><td>0.971</td><td>-0.085</td></tr></table>
221
+
222
+ # 5 Conclusions and Future Work
223
+
224
+ In this work, we demonstrate that even when input representations are biased, we can still improve fairness by debiasing only the classification head of the DNN models. We introduce the RNF framework for debiasing the classification head by neutralizing training samples that have the same ground truth label but with different sensitive attribute annotations. To reduce the reliance on sensitive attribute annotations (as used in existing works), we generate proxy annotations by training a biasintensified model and then annotating samples based on its confidence level. Experimental results indicate our RNF framework to dramatically reduce the discrimination of DNN models, without requiring access to annotations for the sensitive attributes for all the training samples. Experimental analysis further demonstrates our RNF framework to further improve in conjunction with other debiasing methods. Specifically, our RNF framework built on top of a debiased backbone encoder leads to better mitigation performance with negligible accuracy drop in the task performance. It is worth noting that our RNF framework could help alleviate the discrimination rather than eliminate it.
225
+
226
+ On the other hand, the experimental analysis indicates a mitigation gap between RNF and ${ \mathrm { R N F } } _ { \mathrm { G T } }$ This is because we assume zero access to the protected attribute annotations when using GCE framework. It is desirable to further boost the quality of the generated proxy annotations. In realworld applications, domain experts could be involved to annotate a small ratio of the samples for the training set. Equipped with this small ratio of high quality protected attribute annotations, we could generate proxy annotations for other training samples with a higher accuracy compared to the proxy annotations generated by GCE framework. As such, we can further boost the mitigation performance of RNF. This is a challenging topic and would be explored in our future research.
227
+
228
+ # 6 Funding Transparency Statement
229
+
230
+ The work is in part supported by NSF grants CNS-1816497, IIS-1900990, and IIS-1939716. The views and conclusions contained in this paper are those of the authors and should not be interpreted as representing any funding agencies.
231
+
232
+ References
233
+ [1] 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 (CVPR), 2016.
234
+ [2] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. 2019 Annual Conference of the North American Chapter of the Association for Computational Linguistics (NAACL), 2019.
235
+ [3] Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems (NeurIPS), 2012.
236
+ [4] Ninareh Mehrabi, Fred Morstatter, Nripsuta Saxena, Kristina Lerman, and Aram Galstyan. A survey on bias and fairness in machine learning. ACM Computing Surveys, 2021.
237
+ [5] Mengnan Du, Fan Yang, Na Zou, and Xia Hu. Fairness in deep learning: A computational perspective. IEEE Intelligent Systems, 2020.
238
+ [6] Rachel KE Bellamy, Kuntal Dey, Michael Hind, Samuel C Hoffman, Stephanie Houde, Kalapriya Kannan, Pranay Lohia, Jacquelyn Martino, Sameep Mehta, Aleksandra Mojsilovic, et al. Ai fairness 360: An extensible toolkit for detecting, understanding, and mitigating unwanted algorithmic bias. arXiv preprint arXiv:1810.01943, 2018.
239
+ [7] Julia Angwin, Jeff Larson, Surya Mattu, and Lauren Kirchner. Machine bias. https://www.propublica.org/article/machine-bias-risk-assessments-in-criminal-sentencing, 2016.
240
+ [8] Byungju Kim, Hyunwoo Kim, Kyungsu Kim, Sungjin Kim, and Junmo Kim. Learning not to learn: Training deep neural networks with biased data. In Proceedings of the IEEE conference on computer vision and pattern recognition (CVPR), 2019.
241
+ [9] Tianlu Wang, Jieyu Zhao, Mark Yatskar, Kai-Wei Chang, and Vicente Ordonez. Balanced datasets are not enough: Estimating and mitigating gender bias in deep image representations. International Conference on Computer Vision (ICCV), 2019.
242
+ [10] Yanai Elazar and Yoav Goldberg. Adversarial removal of demographic attributes from text data. 2018 Conference on Empirical Methods in Natural Language Processing (EMNLP), 2018.
243
+ [11] Martin Arjovsky, Léon Bottou, Ishaan Gulrajani, and David Lopez-Paz. Invariant risk minimization. arXiv preprint arXiv:1907.02893, 2019.
244
+ [12] Kartik Ahuja, Karthikeyan Shanmugam, Kush Varshney, and Amit Dhurandhar. Invariant risk minimization games. In International Conference on Machine Learning (ICML), 2020.
245
+ [13] Krishna Kumar Singh, Dhruv Mahajan, Kristen Grauman, Yong Jae Lee, Matt Feiszli, and Deepti Ghadiyaram. Don’t judge an object by its context: Learning to overcome contextual bias. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2020.
246
+ [14] Andrea Zunino, Sarah Adel Bargal, Riccardo Volpi, Mehrnoosh Sameki, Jianming Zhang, Stan Sclaroff, Vittorio Murino, and Kate Saenko. Explainable deep classification models for domain generalization. arXiv preprint arXiv:2003.06498, 2020.
247
+ [15] Laura Rieger, Chandan Singh, W James Murdoch, and Bin Yu. Interpretations are useful: penalizing explanations to align neural networks with prior knowledge. International Conference on Machine Learning (ICML), 2020.
248
+ [16] Mohammad Pezeshki, Sékou-Oumar Kaba, Yoshua Bengio, Aaron Courville, Doina Precup, and Guillaume Lajoie. Gradient starvation: A learning proclivity in neural networks. arXiv preprint arXiv:2011.09468, 2020.
249
+ [17] Robert Geirhos, Jörn-Henrik Jacobsen, Claudio Michaelis, Richard Zemel, Wieland Brendel, Matthias Bethge, and Felix A Wichmann. Shortcut learning in deep neural networks. Nature Machine Intelligence, 2(11):665–673, 2020.
250
+ [18] Timothy Niven and Hung-Yu Kao. Probing neural network comprehension of natural language arguments. 57th Annual Meeting of the Association for Computational Linguistics (ACL), 2019.
251
+ [19] Hongyi Zhang, Moustapha Cisse, Yann N Dauphin, and David Lopez-Paz. mixup: Beyond empirical risk minimization. International Conference on Learning Representations (ICLR), 2018.
252
+ [20] Vikas Verma, Alex Lamb, Christopher Beckham, Amir Najafi, Ioannis Mitliagkas, David LopezPaz, and Yoshua Bengio. Manifold mixup: Better representations by interpolating hidden states. In International Conference on Machine Learning (ICML), 2019.
253
+ [21] Hao Wang, Berk Ustun, and Flavio Calmon. Repairing without retraining: Avoiding disparate impact with counterfactual distributions. In International Conference on Machine Learning (ICML), 2019.
254
+ [22] Christina Wadsworth, Francesca Vera, and Chris Piech. Achieving fairness through adversarial learning: an application to recidivism prediction. Fairness, Accountability, and Transparency in Machine Learning (FAT/ML), 2018.
255
+ [23] Harrison Edwards and Amos Storkey. Censoring representations with an adversary. International Conference on Learning Representations (ICLR), 2016.
256
+ [24] Frederick Liu and Besim Avci. Incorporating priors with feature attribution on text classification. 57th Annual Meeting of the Association for Computational Linguistics (ACL), 2019.
257
+ [25] Matt J Kusner, Joshua Loftus, Chris Russell, and Ricardo Silva. Counterfactual fairness. In Advances in neural information processing systems (NeurIPS), 2017.
258
+ [26] Niki Kilbertus, Mateo Rojas Carulla, Giambattista Parascandolo, Moritz Hardt, Dominik Janzing, and Bernhard Schölkopf. Avoiding discrimination through causal reasoning. In Advances in Neural Information Processing Systems (NeurIPS), 2017.
259
+ [27] Pengyu Cheng, Weituo Hao, Siyang Yuan, Shijing Si, and Lawrence Carin. Fairfil: Contrastive neural debiasing method for pretrained text encoders. International Conference on Learning Representations (ICLR), 2021.
260
+ [28] Bingyi Kang, Saining Xie, Marcus Rohrbach, Zhicheng Yan, Albert Gordo, Jiashi Feng, and Yannis Kalantidis. Decoupling representation and classifier for long-tailed recognition. International Conference on Learning Representations (ICLR), 2020.
261
+ [29] Junhyun Nam, Hyuntak Cha, Sungsoo Ahn, Jaeho Lee, and Jinwoo Shin. Learning from failure: Training debiased classifier from biased classifier. Advances in Neural Information Processing Systems (NeurIPS), 2020.
262
+ [30] Robin Jia and Percy Liang. Adversarial examples for evaluating reading comprehension systems. 2017 Conference on Empirical Methods in Natural Language Processing (EMNLP), 2017.
263
+ [31] Aishwarya Agrawal, Dhruv Batra, Devi Parikh, and Aniruddha Kembhavi. Don’t just assume; look and answer: Overcoming priors for visual question answering. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2018.
264
+ [32] Ali Khodabakhsh, Raghavendra Ramachandra, Kiran Raja, Pankaj Wasnik, and Christoph Busch. Fake face detection methods: Can they be generalized? In 2018 International Conference of the Biometrics Special Interest Group (BIOSIG), 2018.
265
+ [33] Ching-Yao Chuang and Youssef Mroueh. Fair mixup: Fairness via interpolation. International Conference on Learning Representations (ICLR), 2021.
266
+ [34] Ron Kohavi. Scaling up the accuracy of naive-bayes classifiers: A decision-tree hybrid. In Proceedings of the Second International Conference on Knowledge Discovery and Data Mining (KDD), 1996.
267
+ [35] Gökhan H Bakır, Jason Weston, and Bernhard Schölkopf. Learning to find pre-images. Advances in neural information processing systems (NeurIPS), 2004.
268
+ [36] Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. NeurIPS 2014 Deep Learning Workshop, 2015.
269
+ [37] Zhilu Zhang and Mert R Sabuncu. Generalized cross entropy loss for training deep neural networks with noisy labels. Advances in Neural Information Processing Systems (NeurIPS), 2018.
270
+ [38] Michael Feldman, Sorelle A Friedler, John Moeller, Carlos Scheidegger, and Suresh Venkatasubramanian. Certifying and removing disparate impact. In ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (KDD), 2015.
271
+ [39] Moritz Hardt, Eric Price, Nati Srebro, et al. Equality of opportunity in supervised learning. In Advances in neural information processing systems (NeurIPS), 2016.
272
+ [40] Steven B Cohen. Design strategies and innovations in the medical expenditure panel survey. Medical care, pages III5–III12, 2003.
273
+ [41] Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaoou Tang. Deep learning face attributes in the wild. In Proceedings of International Conference on Computer Vision (ICCV), 2015.
274
+ [42] Brian Hu Zhang, Blake Lemoine, and Margaret Mitchell. Mitigating unwanted biases with adversarial learning. In AAAI/ACM Conference on Artificial Intelligence, Ethics, and Society (AIES), 2018.
275
+ [43] Yahav Bechavod and Katrina Ligett. Penalizing unfairness in binary classification. Fairness, Accountability and Transparency in Machine Learning (FAT/ML), 2017.
276
+ [44] Mengnan Du, Ninghao Liu, and Xia Hu. Techniques for interpretable machine learning. Communications of the ACM, 2019.
md/train/nIAxjsniDzg/nIAxjsniDzg.md ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # WHAT MATTERS FOR ON-POLICY DEEP ACTORCRITIC METHODS? A LARGE-SCALE STUDY
2
+
3
+ Marcin Andrychowicz, Anton Raichuk, Piotr Stanczyk, Manu Orsini, ´ Sertan Girgin, Raphaël Marinier, Léonard Hussenot, Matthieu Geist, Olivier Pietquin, Marcin Michalski, Sylvain Gelly, Olivier Bachem
4
+
5
+ Google Research, Brain Team
6
+
7
+ # ABSTRACT
8
+
9
+ In recent years, reinforcement learning (RL) has been successfully applied to many different continuous control tasks. While RL algorithms are often conceptually simple, their state-of-the-art implementations take numerous low- and high-level design decisions that strongly affect the performance of the resulting agents. Those choices are usually not extensively discussed in the literature, leading to discrepancy between published descriptions of algorithms and their implementations. This makes it hard to attribute progress in RL and slows down overall progress [27]. As a step towards filling that gap, we implement ${ > } 5 0$ such “choices” in a unified on-policy deep actor-critic framework, allowing us to investigate their impact in a large-scale empirical study. We train over $2 5 0 ^ { \circ } 0 0 0$ agents in five continuous control environments of different complexity and provide insights and practical recommendations for the training of on-policy deep actor-critic RL agents.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Deep reinforcement learning (RL) has seen increased interest in recent years due to its ability to have neural-network-based agents learn to act in environments through interactions. For continuous control tasks, on-policy algorithms such as REINFORCE [2], TRPO [10], A3C [14], PPO [17] and off-policy algorithms such as DDPG [13] and SAC [21] have enabled successful applications such as quadrupedal locomotion [20], self-driving [30] or dexterous in-hand manipulation [20, 25, 32].
14
+
15
+ Many of these papers investigate in depth different algorithmic ideas, for example different loss functions and learning paradigms. Yet, it is less visible that behind successful experiments in deep RL there are complicated code bases that contain a large number of low- and high-level design decisions that are usually not discussed in research papers. While one may assume that such “choices” do not matter, there is evidence that they are in fact crucial for or even driving good performance [27].
16
+
17
+ While there are open-source implementations available that can be used by practitioners, this is still unsatisfactory: Research publications often contain one-to-one comparisons of different algorithmic ideas based on implementations in different code bases. This makes it impossible to assess whether improvements are due to the underlying algorithmic idea or due to the implementation. In fact, it is hard to assess the performance of high-level algorithmic ideas without an understanding of lower-level choices as performance may strongly depend on the tuning of hyperparameters and implementationlevel details. Overall, this makes it hard to attribute progress in reinforcement learning and slows down further research [15, 22, 27].
18
+
19
+ Our contributions. Our key goal in this paper is to investigate such lower level choices in depth and to understand their impact on final agent performance. Hence, as our key contributions, we (1) implement ${ > } 5 0$ choices in a unified on-policy deep actor-critic implementation1, (2) conducted a large-scale (more than $2 5 0 ^ { \circ } 0 0 0$ agents trained) experimental study that covers different aspects of the training process, and (3) analyze the experimental results to provide practical insights and recommendations for the training of on-policy deep actor-critic RL agents.
20
+
21
+ Most surprising finding. While many of our experimental findings confirm common RL practices, some of them are quite surprising, e.g. the policy initialization scheme significantly influences the performance while it is rarely even mentioned in RL publications. In particular, we have found that initializing the network so that the initial action distribution has zero mean, a rather low standard deviation and is independent of the observation significantly improves the training speed (Sec. 3.2).
22
+
23
+ Paper outline. The rest of of this paper is structured as follows: We describe our experimental setup and performance metrics used in Sec. 2. Then, in Sec. 3 we present and analyse the experimental results and finish with related work in Sec. 4 and conclusions in Sec. 5. The appendices contain the detailed description of all design choices we experiment with (App. B), default hyperparameters (App. C) and the raw experimental results (App. D - K).
24
+
25
+ # 2 STUDY DESIGN
26
+
27
+ Considered setting. In this paper, we consider the setting of on-policy deep actor-critic reinforcement learning for continuous control. We define on-policy learning in the following loose sense: We consider policy iteration algorithms that iterate between generating experience using the current policy and using that experience to improve the policy. This is the standard modus operandi of algorithms usually considered on-policy such as PPO [17]. However, we note that algorithms often perform several model updates and thus may operate technically on off-policy data within a single policy improvement iteration. As benchmark environments, we consider five widely used continuous control environments from OpenAI Gym [12] of varying complexity: Hopper-v1, Walker2d-v1, HalfCheetah-v1, Ant-v1, and Humanoid-v1 2.
28
+
29
+ Unified on-policy deep actor-critic gradient algorithm. We took the following approach to create a highly configurable unified on-policy deep actor-critic gradient algorithm with as many choices as possible:
30
+
31
+ 1. We researched prior work and popular code bases to make a list of commonly used choices, i.e., different loss functions (both for value functions and policies), architectural choices such as initialization methods, heuristic tricks such as gradient clipping and all their corresponding hyperparameters.
32
+ 2. Based on this, we implemented a single, unified on-policy deep actor-critic agent and corresponding training protocol starting from the SEED RL code base [28]. Whenever we were faced with implementation decisions that required us to take decisions that could not be clearly motivated or had alternative solutions, we further added such decisions as additional choices.
33
+ 3. We verified that when all choices are selected as in the PPO implementation from OpenAI baselines, we obtain similar performance as reported in the PPO paper [17]. We chose PPO because it is probably the most commonly used on-policy deep actor-critic RL algorithm at the moment.
34
+
35
+ The resulting agent implementation is detailed in Appendix B. The key property is that the implementation exposes all choices as configuration options in an unified manner. For convenience, we mark each of the choice in this paper with a number (e.g., C1) and a fixed name (e.g. num_envs (C1)) that can be easily used to find a description of the choice in Appendix B.
36
+
37
+ Difficulty of investigating choices. The primary goal of this paper is to understand how the different choices affect the final performance of an agent and to derive recommendations for these choices. There are two key reasons why this is challenging:
38
+
39
+ First, we are mainly interested in insights on choices for good hyperparameter configurations. Yet, if all choices are sampled randomly, the performance is very bad and little (if any) training progress is made. This may be explained by the presence of sub-optimal settings (e.g., hyperparameters of the wrong scale) that prohibit learning at all. If there are many choices, the probability of such failure increases exponentially.
40
+
41
+ Second, many choices may have strong interactions with other related choices, for example the learning rate and the minibatch size. This means that such choices need to be tuned together and experiments where only a single choice is varied but interacting choices are kept fixed may lead to misleading conclusions.
42
+
43
+ Basic experimental design. To address these issues, we design a series of experiments as follows: We create groups of choices around thematic groups where we suspect interactions between different choices, for example we group together all choices related to neural network architecture. We also include Adam learning rate (C24) in all of the groups as we suspect that it may interact with many other choices.
44
+
45
+ Then, in each experiment, we train a large number of models where we randomly sample the choices within the corresponding group 3. All other settings (for choices not in the group) are set to settings of a competitive base configuration (detailed in Appendix C) that is close to the default PPOv2 configuration4 scaled up to 256 parallel environments. This has two effects: First, it ensures that our set of trained models contains good models (as verified by performance statistics in the corresponding results). Second, it guarantees that we have models that have different combinations of potentially interacting choices.
46
+
47
+ We consider two different analyses for each choice (e.g, for advantage_estimator (C6)):
48
+
49
+ Conditional 95th percentile: For each potential value of that choice (e.g., advantage_estimator $( \mathsf { C } 6 ) = \mathsf { N } { - } \mathsf { S } \mathsf { t } \mathsf { e p }$ ), we look at the performance distribution of sampled configurations with that value. We report the 95th percentile of the performance as well as a confidence interval based on a binomial approximation 5. Intuitively, this corresponds to a robust estimate of the performance one can expect if all other choices in the group were tuned with random search and a limited budget of roughly 20 hyperparameter configurations.
50
+
51
+ Distribution of choice within top $5 \%$ configurations. We further consider for each choice the distribution of values among the top $5 \%$ configurations trained in that experiment. The reasoning is as follows: By design of the experiment, values for each choice are distributed uniformly at random. Thus, if certain values are over-represented in the top models, this indicates that the specific choice is important in guaranteeing good performance.
52
+
53
+ Performance measures. We employ the following way to compute performance: For each choice configuration, we train 3 models with independent random seeds where each model is trained for one million (Hopper, HalfCheetah, Walker2d) or two million environment steps (Ant, Humanoid). We evaluate trained policies every hundred thousand steps by freezing the policy and computing the average undiscounted episode return of 100 episodes (with the stochastic policy). We then average these score to obtain a single performance score of the seed which is proportional to the area under the learning curve. This ensures we assign higher scores to agents that learn quickly. The performance score of a hyperparameter configuration is finally set to the median performance score across the 3 seeds. This reduces the impact of training noise, i.e., that certain seeds of the same configuration may train much better than others.
54
+
55
+ Robustness of results. While we take 3 random seeds to compute the performance measure for a single choice configuration, it is important to note that all the experimental results reported in this paper are based on more than 3 random seeds: The reported conditional 95th percentile and distribution of choice within top $5 \%$ configurations are computed based upon the performance of hundreds of choice configurations. Furthermore, we also report confidence intervals for the conditional 95th percentile.
56
+
57
+ # 3 EXPERIMENTS
58
+
59
+ We run experiments for eight thematic groups: Policy Losses (Sec. 3.1), Networks architecture (Sec. 3.2), Normalization and clipping (Sec. 3.3), Advantage Estimation (Sec. 3.4), Training setup (Sec. 3.5), Timesteps handling (Sec. 3.6), Optimizers (Sec. 3.7), and Regularization (Sec. 3.8). For each group, we provide a full experimental design and full experimental plots in Appendices D - K so that the reader can draw their own conclusions from the experimental results. Moreover, the raw data from all training runs and a script used to generate all plots for this paper can be found online6. In the following sections, we provide short descriptions of the experiments, our interpretation of the results, as well as practical recommendations for agent training for continuous control.
60
+
61
+ # 3.1 POLICY LOSSES (BASED ON THE RESULTS IN APPENDIX D)
62
+
63
+ Study description. We investigate different policy losses (C14): vanilla policy gradient (PG), Vtrace [19], PPO [17], AWR [33], V-MPO7 [34] and the limiting case of AWR $\beta \to 0 ,$ ) and V-MPO $\epsilon _ { n } 0 $ ) which we call Repeat Positive Advantages (RPA) as it is equivalent to the negative logprobability of actions with positive advantages. See App. B.3 for a detailed description of the different losses. We further sweep the hyperparameters of each of the losses (C15, C16, C18, C17, C19), the learning rate (C24) and the number of passes over the data (C3).
64
+
65
+ The goal of this study is to better understand the importance of the policy loss function in the on-policy deep actor-critic setting considered in this paper. The goal is not to provide a general statement that one of the losses is better than the others as some of them were specifically designed for other settings (e.g., the V-trace loss is targeted at near-on-policy data in a distributed setting).
66
+
67
+ ![](images/7ce15df0cde2d124e392ddd70830a5ca756573468ade27372f55b9fdb4767fe6.jpg)
68
+ Figure 1: Comparison of different policy losses (C14).
69
+
70
+ Interpretation. Fig. 1 shows the 95-th percentile of the average policy score during training for different policy losses (C14). We observe that PPO performs better than the other losses on 4 out of 5 environments and is one of the top performing losses on HalfCheetah. As we randomly sample the loss specific hyperparameters in this analysis, one might argue that our approach favours choices that are not too sensitive to hyperparameters. At the same time, there might be losses that are sensitive to their hyperparameters but for which good settings may be easily found. Fig. 5 shows that even if we condition on choosing the optimal loss hyperparameters for each $\mathrm { l o s s } ^ { 8 }$ , PPO still outperforms the other losses on the two hardest tasks — Humanoid and $\mathrm { { A n t } ^ { 9 } }$ and is one of the top performing losses on the other 3 tasks. Moreover, we show the empirical cumulative density functions of agent performance conditioned on the policy loss used in Fig. 4.
71
+
72
+ Perhaps unsurprisingly, PG and V-trace perform worse on all tasks. This is likely caused by their inability to handle data that becomes off-policy in one iteration, either due to multiple passes (C3)
73
+
74
+ over experience (which can be seen in Fig. 14) or a large experience buffer (C2) in relation to the batch size (C4). While V-Trace contains an off-policy correction, it was designed for ”slightly” off-policy experience arising in ansynchronous, distributed setups and becomes more and more biased as experience becomes more off-policy. Overall, these results show that trust-region optimization (preventing the current policy from diverging too much from the behavioral one) which is present in all the other policy losses is crucial for good sample complexity.
75
+
76
+ For PPO and its clipping threshold $\epsilon$ (C16), we further observe that $\epsilon = 0 . 2$ and $\epsilon = 0 . 3$ perform reasonably well in all environments but that lower $\mathit { \check { \Psi } } _ { \epsilon } = 0 . 1$ ) or higher $\epsilon = 0 . 5$ ) values give better performance on some of the environments (See Fig. 10 and Fig. 32).
77
+
78
+ Recommendation. Use the PPO policy loss. Start with the clipping threshold set to 0.25 but also try lower and higher values if possible.
79
+
80
+ # 3.2 NETWORKS ARCHITECTURE (BASED ON THE RESULTS IN APPENDIX E)
81
+
82
+ Study description. We investigate the impact of differences in the policy and value function neural network architectures. We consider choices related to the network structure and size (C47, C48, C49, C50, C51, C52, C52), activation functions (C55), and initialization of network weights (C56, C57, C58). We further include choices related to the standard deviation of actions (C59, C60, C61, C62) and transformations of sampled actions (C63).
83
+
84
+ Interpretation. Separate value and policy networks (C47) appear to lead to better performance on four out of five environments (Fig. 15). To avoid analyzing the other choices based on bad models, we thus focus for the rest of this experiment only on agents with separate value and policy networks. Regarding network sizes, the optimal width of the policy MLP depends on the complexity of the environment (Fig. 18) and too low or too high values can cause significant drop in performance while for the value function there seems to be no downside in using wider networks (Fig. 21). Moreover, on some environments it is beneficial to make the value network wider than the policy one, e.g. on HalfCheetah the best results are achieved with $1 6 - 3 2$ units per layer in the policy network and 256 in the value network. Two hidden layers appear to work well for policy (Fig. 22) and value networks (Fig. 20) in all tested environments. As for activation functions, we observe that tanh activations perform best and relu worst. (Fig. 30).
85
+
86
+ Interestingly, the initial policy appears to have a surprisingly high impact on the training performance. The key recipe is to initialize the policy at the beginning of training so that the action distribution is centered around $0 ^ { 1 0 }$ regardless of the observation and has a rather small standard deviation. This can be achieved by initializing the policy MLP with smaller weights in the last layer (C57, Fig. 24, this alone boosts the performance on Humanoid by $6 6 \%$ ) so that the initial action distribution is almost independent of the observation and by introducing an offset in the standard deviation of actions (C61). Fig. 2 shows that the performance is very sensitive to the initial action standard deviation with 0.5 performing best on all environments except Hopper where higher values perform better.
87
+
88
+ ![](images/1c3d573f0ca4b142f6e5e90a687cb9a8dd3cd32d39d904e31e66a3db330fda2c.jpg)
89
+ Figure 2: Comparison of different initial standard deviations of actions (C61).
90
+
91
+ Fig. 17 compares two approaches to transform unbounded sampled actions into the bounded $[ - 1 , 1 ]$ domain expected by the environment (C63): clipping and applying a tanh function. tanh performs slightly better overall (in particular it improves the performance on HalfCheetah by $3 0 \%$ ). Comparing
92
+
93
+ Fig. 17 and Fig. 2 suggests that the difference might be mostly caused by the decreased magnitude of initial actions1
94
+
95
+ Other choices appear to be less important: The scale of the last layer initialization matters much less for the value MLP (C58) than for the policy MLP (Fig. 19). Apart from the last layer scaling, the network initialization scheme (C56) does not matter too much (Fig. 27). Only he_normal and he_uniform [7] appear to be suboptimal choices with the other options performing very similarly. There also appears to be no clear benefits if the standard deviation of the policy is learned for each state (i.e. outputted by the policy network) or once globally for all states (C59, Fig. 23). For the transformation of policy output into action standard deviation (C60), softplus and exponentiation perform very similarly12 (Fig. 25). Finally, the minimum action standard deviation (C62) seems to matter little, if it is not set too large (Fig. 30).
96
+
97
+ Recommendation. Initialize the last policy layer with $1 0 0 \times$ smaller weights. Use softplus to transform network output into action standard deviation and add a (negative) offset to its input to decrease the initial standard deviation of actions. Tune this offset if possible. Use tanh both as the activation function (if the networks are not too deep) and to transform the samples from the normal distribution to the bounded action space. Use a wide value MLP (no layers shared with the policy) but tune the policy width (it might need to be narrower than the value MLP).
98
+
99
+ # 3.3 NORMALIZATION AND CLIPPING (BASED ON THE RESULTS IN APPENDIX F)
100
+
101
+ Study description. We investigate the impact of different normalization techniques: observation normalization (C64), value function normalization (C66), per-minibatch advantage normalization (C67), as well as gradient (C68) and observation (C65) clipping.
102
+
103
+ Interpretation. Input normalization (C64) is crucial for good performance on all environments apart from Hopper (Fig. 33). Quite surprisingly, value function normalization (C66) also influences the performance very strongly — it is crucial for good performance on HalfCheetah and Humanoid, helps slightly on Hopper and Ant and significantly hurts the performance on Walker2d (Fig. 37). We are not sure why the value function scale matters that much but suspect that it affects the performance by changing the speed of the value function fitting.13 In contrast to observation and value function normalization, per-minibatch advantage normalization (C67) seems not to affect the performance too much (Fig. 35). Similarly, we have found little evidence that clipping normalized14 observations (C65) helps (Fig. 38) but it might be worth using if there is a risk of extremely high observations due to simulator divergence. Finally, gradient clipping (C68) provides a small performance boost with the exact clipping threshold making little difference (Fig. 34).
104
+
105
+ Recommendation. Always use observation normalization and check if value function normalization improves performance. Gradient clipping might slightly help but is of secondary importance.
106
+
107
+ # 3.4 ADVANTAGE ESTIMATION (BASED ON THE RESULTS IN APPENDIX G)
108
+
109
+ Study description. We compare the most commonly used advantage estimators (C6): N-step [3], GAE [9] and V-trace [19] and their hyperparameters (C7, C8, C9, C10). We also experiment with applying PPO-style pessimistic clipping (C13) to the value loss (present in the original PPO implementation but not mentioned in the PPO paper [17]) and using Huber loss [1] instead of MSE for value learning (C11, C12). Moreover, we varied the number of parallel environments used (C1) as it changes the length of the experience fragments collected in each step.
110
+
111
+ Interpretation. GAE and V-trace appear to perform better than N-step returns (Fig. 44 and 40) which indicates that it is beneficial to combine the value estimators from multiple timesteps. We have not found a significant performance difference between GAE and V-trace in our experiments. $\lambda = 0 . 9$ (C8, C9) performed well regardless of whether GAE (Fig. 45) or V-trace (Fig. 49) was used on all tasks but tuning this value per environment may lead to modest performance gains. We have found that PPO-style value loss clipping (C13) hurts the performance regardless of the clipping threshold15 (Fig. 43). Similarly, the Huber loss (C11) performed worse than MSE in all environments (Fig. 42) regardless of the value of the threshold (C12) used (Fig. 48).
112
+
113
+ Recommendation. Use GAE with $\lambda = 0 . 9$ but neither Huber loss nor PPO-style value loss clipping.
114
+
115
+ 3.5 TRAINING SETUP (BASED ON THE RESULTS IN APPENDIX H)
116
+
117
+ Study description. We investigate choices related to the data collection and minibatch handling: the number of parallel environments used (C1), the number of transitions gathered in each iteration (C2), the number of passes over the data (C3), minibatch size (C4) and how the data is split into minibatches (C5).
118
+
119
+ For the last choice, in addition to standard choices, we also consider a new small modification of the original PPO approach: The original PPO implementation splits the data in each policy iteration step into individual transitions and then randomly assigns them to minibatches (C5). This makes it impossible to compute advantages as the temporal structure is broken. Therefore, the advantages are computed once at the beginning of each policy iteration step and then used in minibatch policy and value function optimization. This results in higher diversity of data in each minibatch at the cost of using slightly stale advantage estimations. As a remedy to this problem, we propose to recompute the advantages at the beginning of each pass over the data instead of just once per iteration.
120
+
121
+ Results. Unsurprisingly, going over the experience multiple times appears to be crucial for good sample complexity (Fig. 54). Often, this is computationally cheap due to the simple models considered, in particular on machines with accelerators such as GPUs and TPUs. As we increase the number of parallel environments (C1), performance decreases sharply on some of the environments (Fig. 55). This is likely caused by shortened experience chunks (See Sec. B.1 for the detailed description of the data collection process) and earlier value bootstrapping. Despite that, training with more environments usually leads to faster training in wall-clock time if enough CPU cores are available. Increasing the batch size (C4) does not appear to hurt the sample complexity in the range we tested (Fig. 57) which suggests that it should be increased for faster iteration speed. On the other hand, the number of transitions gathered in each iteration (C2) influences the performance quite significantly (Fig. 52). Finally, we compare different ways to handle minibatches (See App. B.1 for the detailed description of different variants) in Fig. 53 and 58. The plots suggest that stale advantages can in fact hurt performance and that recomputing them at the beginning of each pass at least partially mitigates the problem and performs best among all variants.
122
+
123
+ Recommendation. Go over experience multiple times. Shuffle individual transitions before assigning them to minibatches and recompute advantages once per data pass (See App. B.1 for the details). For faster wall-clock time training use many parallel environments and increase the batch size (both might hurt the sample complexity). Tune the number of transitions in each iteration (C2) if possible.
124
+
125
+ # 3.6 TIMESTEPS HANDLING (BASED ON THE RESULTS IN APPENDIX I)
126
+
127
+ Study description. We investigate choices related to the handling of timesteps: discount fac$\mathrm { t o r } ^ { 1 6 }$ (C20), frame skip (C21), and how episode termination due to timestep limits are handled (C22). The latter relates to a technical difficulty explained in App. B.4 where one assumes for the algorithm an infinite time horizon but then trains using a finite time horizon [16].
128
+
129
+ Interpretation. Fig. 60 shows that the performance depends heavily on the discount factor $\gamma$ (C20) with $\gamma = 0 . 9 9$ performing reasonably well in all environments. Skipping every other frame (C21) improves the performance on 2 out of 5 environments (Fig. 61). Proper handling of episodes abandoned due to the timestep limit seems not to affect the performance (C22, Fig. 62) which is probably caused by the fact that the timestep limit is quite high (1000 transitions) in all the environments we considered.
130
+
131
+ Recommendation. Discount factor $\gamma$ is one of the most important hyperparameters and should be tuned per environment (start with $\gamma = 0 . 9 9 ,$ ). Try frame skip if possible. There is no need to handle environments step limits in a special way for large step limits.
132
+
133
+ # 3.7 OPTIMIZERS (BASED ON THE RESULTS IN APPENDIX J)
134
+
135
+ Study description. We investigate two gradient-based optimizers commonly used in RL: (C23) – Adam [8] and RMSprop – as well as their hyperparameters (C24, C25, C26, C27, C28, C29, C30) and a linear learning rate decay schedule (C31).
136
+
137
+ Interpretation. The differences in performance between the optimizers (C23) appear to be rather small with no optimizer consistently outperforming the other across environments (Fig. 66). Unsurprisingly, the learning rate influences the performance very strongly (Fig. 69) with the default value of 0.0003 for Adam (C24) performing well on all tasks. Fig. 67 shows that Adam works better with momentum (C26). For RMSprop, momentum (C27) makes less difference (Fig. 71) but our results suggest that it might slightly improve performance17. Whether the centered or uncentered version of RMSprop is used (C30) makes no difference (Fig. 70) and similarly we did not find any difference between different values of the $\epsilon$ coefficients (C28, C29, Fig. 68 and 72). Linearly decaying the learning rate to 0 increases the performance on 4 out of 5 tasks but the gains are very small apart from Ant, where it leads to $1 5 \%$ higher scores (Fig. 65).
138
+
139
+ Recommendation. Use Adam [8] optimizer with momentum $\beta _ { 1 } = 0 . 9$ and a tuned learning rate (0.0003 is a safe default). Linearly decaying the learning rate may slightly improve performance but is of secondary importance.
140
+
141
+ # 3.8 REGULARIZATION (BASED ON THE RESULTS IN APPENDIX K)
142
+
143
+ Study description. We investigate different policy regularizers (C32), which can have either the form of a penalty (C33, e.g. bonus for higher entropy) or a soft constraint (C34, e.g. entropy should not be lower than some threshold) which is enforced with a Lagrange multiplier. In particular, we consider the following regularization terms: entropy (C40, C46), the Kullback–Leibler divergence (KL) between a reference $\mathcal { N } ( 0 , 1 )$ action distribution and the current policy (C37, C43) and the KL divergence and reverse KL divergence between the current policy and the behavioral one (C35, C41, C36, C42), as well as the “decoupled” KL divergence from [18, 34] (C38, C39, C44, C45).
144
+
145
+ Interpretation. We do not find evidence that regularization helps significantly on our environments with the exception of HalfCheetah on which all constraints (especially the entropy constraint) help (Fig. 76 and 77). However, the performance boost is largely independent on the constraint threshold (Fig. 83, 84, 87, 89, 90 and 91) which suggests that the effect is caused by the initial high strength of the penalty (before it gets adjusted) and not by the desired constraint. While it is surprising that regularization does not help at all (apart from HalfCheetah), we conjecture that regularization might be less important in our experiments because: (1) the PPO policy loss already enforces the trust region which makes KL penalties or constraints redundant; and (2) the careful policy initialization (See Sec. 3.2) is enough to guarantee good exploration making the entropy bonus or constraint redundant.
146
+
147
+ # 4 RELATED WORK
148
+
149
+ Islam et al. [15] and Henderson et al. [22] point out reproducibility issues in RL including the performance differences between different code bases, the importance of hyperparameter tuning and the high level of stochasticity due to random seeds. Tucker et al. [26] showed that the gains, which had been attributed to one of the recently proposed policy gradients improvements, were, in fact, caused by the implementation details. The most closely related work to ours is probably Engstrom et al. [27] where the authors investigate code-level improvements in the PPO [17] code base and conclude that they are responsible for the most of the performance difference between PPO and TRPO [10]. Our work is also similar to other large-scale studies done in other fields of Deep Learning, e.g. model-based RL [31], GANs [24], NLP [35], disentangled representations [23] and convolution network architectures [36].
150
+
151
+ # 5 CONCLUSIONS
152
+
153
+ In this paper, we investigated the importance of a broad set of high- and low-level choices that need to be made when designing and implementing on-policy deep actor-critic RL algorithms. Based on more than $2 5 0 ^ { \circ } 0 0 0$ experiments in five continuous control environments, we evaluate the impact of different choices and provide practical recommendations. One of the surprising insights is that the initial action distribution plays an important role in agent performance. We expect this to be a fruitful avenue for future research.
154
+
155
+ # REFERENCES
156
+
157
+ [1] Peter J Huber. “Robust estimation of a location parameter”. In: Breakthroughs in statistics. Springer, 1992, pp. 492–518.
158
+ [2] Ronald J Williams. “Simple statistical gradient-following algorithms for connectionist reinforcement learning”. In: Machine learning 8.3-4 (1992), pp. 229–256.
159
+ [3] Richard S Sutton, Andrew G Barto, et al. Introduction to reinforcement learning. Vol. 135. MIT press Cambridge, 1998.
160
+ [4] Brian D Ziebart. “Modeling purposeful adaptive behavior with the principle of maximum causal entropy”. In: (2010).
161
+ [5] Emanuel Todorov, Tom Erez, and Yuval Tassa. “Mujoco: A physics engine for model-based control”. In: 2012 IEEE/RSJ International Conference on Intelligent Robots and Systems. IEEE. 2012, pp. 5026–5033.
162
+ [6] Volodymyr Mnih et al. “Playing atari with deep reinforcement learning”. In: arXiv preprint arXiv:1312.5602 (2013).
163
+ [7] Kaiming He et al. “Delving deep into rectifiers: Surpassing human-level performance on imagenet classification”. In: Proceedings of the IEEE international conference on computer vision. 2015, pp. 1026– 1034.
164
+ [8] Diederik P. Kingma and Jimmy Ba. “Adam: A Method for Stochastic Optimization”. In: 3rd International Conference on Learning Representations, ICLR 2015, San Diego, CA, USA, May 7-9, 2015, Conference Track Proceedings. 2015. URL: http://arxiv.org/abs/1412.6980.
165
+ [9] John Schulman et al. “High-dimensional continuous control using generalized advantage estimation”. In: arXiv preprint arXiv:1506.02438 (2015).
166
+ [10] John Schulman et al. “Trust region policy optimization”. In: International conference on machine learning. 2015, pp. 1889–1897.
167
+ [11] Martın Abadi et al. “Tensorflow: A system for large-scale machine learning”. In: 12th {USENIX} Symposium on Operating Systems Design and Implementation ({OSDI} 16). 2016, pp. 265–283.
168
+ [12] Greg Brockman et al. “Openai gym”. In: arXiv preprint arXiv:1606.01540 (2016).
169
+ [13] Timothy P Lillicrap et al. “Continuous control with deep reinforcement learning”. In: International Conference on Learning Representations. 2016.
170
+ [14] Volodymyr Mnih et al. “Asynchronous methods for deep reinforcement learning”. In: International conference on machine learning. 2016, pp. 1928–1937.
171
+ [15] Riashat Islam et al. “Reproducibility of benchmarked deep reinforcement learning tasks for continuous control”. In: arXiv preprint arXiv:1708.04133 (2017).
172
+ [16] Fabio Pardo et al. “Time limits in reinforcement learning”. In: arXiv preprint arXiv:1712.00378 (2017).
173
+ [17] John Schulman et al. “Proximal policy optimization algorithms”. In: arXiv preprint arXiv:1707.06347 (2017).
174
+ [18] Abbas Abdolmaleki et al. “Maximum a posteriori policy optimisation”. In: arXiv preprint arXiv:1806.06920 (2018).
175
+ [19] Lasse Espeholt et al. “IMPALA: Scalable Distributed Deep-RL with Importance Weighted Actor-Learner Architectures”. In: International Conference on Machine Learning. 2018, pp. 1406–1415.
176
+ [20] Tuomas Haarnoja et al. “Soft actor-critic algorithms and applications”. In: arXiv preprint arXiv:1812.05905 (2018).
177
+ [21] Tuomas Haarnoja et al. “Soft Actor-Critic: Off-Policy Maximum Entropy Deep Reinforcement Learning with a Stochastic Actor”. In: International Conference on Machine Learning. 2018, pp. 1861–1870.
178
+ [22] Peter Henderson et al. “Deep reinforcement learning that matters”. In: Thirty-Second AAAI Conference on Artificial Intelligence. 2018.
179
+ [23] Francesco Locatello et al. “Challenging common assumptions in the unsupervised learning of disentangled representations”. In: arXiv preprint arXiv:1811.12359 (2018).
180
+ [24] Mario Lucic et al. “Are gans created equal? a large-scale study”. In: Advances in neural information processing systems. 2018, pp. 700–709.
181
+ [25] M Andrychowicz OpenAI et al. “Learning dexterous in-hand manipulation”. In: arXiv preprint arXiv:1808.00177 (2018).
182
+ [26] George Tucker et al. “The mirage of action-dependent baselines in reinforcement learning”. In: arXiv preprint arXiv:1802.10031 (2018).
183
+ [27] Logan Engstrom et al. “Implementation Matters in Deep RL: A Case Study on PPO and TRPO”. In: International Conference on Learning Representations. 2019.
184
+ [28] Lasse Espeholt et al. “SEED RL: Scalable and Efficient Deep-RL with Accelerated Central Inference”. In: arXiv preprint arXiv:1910.06591 (2019).
185
+ [29] Michael Janner et al. “When to trust your model: Model-based policy optimization”. In: Advances in Neural Information Processing Systems. 2019, pp. 12498–12509.
186
+ [30] Alex Kendall et al. “Learning to drive in a day”. In: 2019 International Conference on Robotics and Automation (ICRA). IEEE. 2019, pp. 8248–8254.
187
+ [31] Eric Langlois et al. “Benchmarking model-based reinforcement learning”. In: arXiv preprint arXiv:1907.02057 (2019).
188
+ [32] Ilge OpenAI et al. “Solving Rubik’s Cube with a Robot Hand”. In: arXiv preprint arXiv:1910.07113 (2019).
189
+ [33] Xue Bin Peng et al. “Advantage-Weighted Regression: Simple and Scalable Off-Policy Reinforcement Learning”. In: arXiv preprint arXiv:1910.00177 (2019).
190
+ [34] H Francis Song et al. “V-MPO: On-Policy Maximum a Posteriori Policy Optimization for Discrete and Continuous Control”. In: arXiv preprint arXiv:1909.12238 (2019).
191
+ [35] Jared Kaplan et al. “Scaling laws for neural language models”. In: arXiv preprint arXiv:2001.08361 (2020).
192
+ [36] Ilija Radosavovic et al. “Designing Network Design Spaces”. In: arXiv preprint arXiv:2003.13678 (2020).
md/train/oRMRIR4qPC1/oRMRIR4qPC1.md ADDED
@@ -0,0 +1,531 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Faster Perturbed Stochastic Gradient Methods for Finding Local Minima
2
+
3
+ Anonymous Author(s)
4
+ Affiliation
5
+ Address
6
+ email
7
+
8
+ # Abstract
9
+
10
+ 1 Escaping from saddle points and finding local minimum is a central problem in
11
+ 2 nonconvex optimization. Perturbed gradient methods are perhaps the simplest√
12
+ 3 approach for this problem. However, to find $( \epsilon , \sqrt { \epsilon } )$ -approximate local minima, the
13
+ 4 existing best stochastic gradient complexity for this type of algorithms is $\widetilde O ( \epsilon ^ { - 3 . 5 } )$ ,
14
+ 5 which is not optimal. In this paper, we propose Pullback, a faster perturbed
15
+ 6 stochastic gradient framework for finding local minima. We show that Pullback
16
+ 7 with stochastic gradient estimators such as SARAH/SPIDER and STORM can
17
+ 8 find $( \epsilon , \epsilon _ { H } )$ -approximate local minima within $\widetilde { \cal O } ( \epsilon ^ { - 3 } + \epsilon _ { H } ^ { - 6 } )$ stochastic gradient
18
+ 9 evaluations (or $\widetilde O ( \epsilon ^ { - 3 } )$ when $\epsilon _ { H } = \sqrt { \epsilon } )$ . The core idea of our framework is a
19
+ 10 step-size “pullback” scheme to control the average movement of the iterates, which
20
+ 11 leads to faster convergence to the local minima.
21
+
22
+ # 12 1 Introduction
23
+
24
+ 13 In this paper, we focus on the following optimization problem
25
+
26
+ $$
27
+ \underset { \mathbf { x } \in \mathbb { R } ^ { d } } { \operatorname* { m i n } } F ( \mathbf { x } ) : = \mathbb { E } _ { \pmb { \xi } } [ f ( \mathbf { x } ; \pmb { \xi } ) ] ,
28
+ $$
29
+
30
+ 14 where $f ( \mathbf { x } ; \pmb { \xi } ) : \mathbb { R } ^ { d } \mathbb { R }$ is a stochastic function indexed by some random vector $\boldsymbol { \xi }$ , and it is
31
+ 15 differentiable and possibly nonconvex. We consider the case where only the stochastic gradients
32
+ 16 $\nabla f ( \mathbf { x } ; \pmb { \xi } )$ are accessible. (1.1) can unify a variety of stochastic optimization problems, such as finite
33
+ 17 sum optimization and online optimization. Since in general, finding global minima of a nonconvex
34
+ 18 function could be an NP-hard problem [12], one often seeks to finding an $( \epsilon , \epsilon _ { H } )$ -approximate local
35
+ 19 minimum x, i.e., $\| \nabla F ( \mathbf { x } ) \| _ { 2 } \leq \epsilon$ and $\lambda _ { \operatorname* { m i n } } \bigl ( \nabla ^ { 2 } F ( \mathbf { x } ) \bigr ) \geq - \epsilon _ { H }$ , where $\nabla F ( \mathbf { x } )$ is the gradient of $F$
36
+ 20 and $\lambda _ { \mathrm { m i n } } \big ( \nabla ^ { 2 } F ( \mathbf { x } ) \big )$ is the smallest eigenvalue of the Hessian of $F$ at $\mathbf { x }$ . In many machine learning
37
+ 21 applications such as matrix sensing and completion [5, 11], it suffices to find local minima due to the
38
+ 22 fact that all local minima are global minima.
39
+ 23 For the case where $f$ is a deterministic function, it has been shown that vanilla gradient descent fails
40
+ 24 to find local minima efficiently since the iterates will get stuck at saddle points for exponential time
41
+ 25 [8]. To address this issue, the simplest idea is to add random noises as a perturbation to the stuck
42
+ 26 iterates. Jin et al. [13] showed that the simple perturbation step is enough for gradient descent to
43
+ 27 escape saddle points and find $( \epsilon , \sqrt { \epsilon } )$ -approximate local minima within $\tilde { O } ( \bar { 1 } / \epsilon ^ { 2 } )$ gradient evaluations,
44
+ 28 which matches the number of gradient evaluations for gradient descent to find $\epsilon$ -stationary points
45
+ 29 [19]. Such matching results suggest that perturbed gradient methods can find local minima efficiently,
46
+ 30 at least for deterministic optimization. When it comes to stochastic optimization, a natural question
47
+ 31 arises:
48
+
49
+ Can perturbed stochastic gradient methods find local minima efficiently?
50
+
51
+ 33 To answer this question, we first look into existing results of perturbed stochastic gradient methods
52
+ 34 for finding local minima. Ge et al. [10] showed that perturbed Stochastic gradient descent can find
53
+ 35 $( \epsilon , \sqrt { \epsilon } )$ -approximate local minima within $\widetilde { \cal O } ( \mathrm { p o l y } ( \epsilon ^ { - 1 } ) )$ stochastic gradient evaluations. Daneshmand
54
+ 36 et al. [7] showed that under a specific CNC condition, stochastic gradient descent is able to find
55
+ 37 $( \epsilon , \sqrt { \epsilon } )$ -approximate local minima within $\widetilde { \cal O } ( 1 / \epsilon ^ { 5 } )$ stochastic gradient evaluations. Later on, Li [17]√
56
+ 38 showed that simple stochastic recursive gradient descent (SSRGD) can find $( \epsilon , \sqrt { \epsilon } )$ -approximate
57
+ 39 local minima within $\widetilde O ( \epsilon ^ { - 3 . 5 } )$ stochastic gradient evaluations, which is the state-of-the-arts to date.
58
+ 40 However, none of these results by perturbed stochastic gradient methods matches the optimal result
59
+ 41 $\widetilde O ( \epsilon ^ { - 3 } )$ for finding $\epsilon$ -stationary points, achieved by SPIDER [9], SNVRG [30] and STORM [6] (See
60
+ 42 also Arjevani et al. [4] for the lower bound results). Therefore, whether perturbed stochastic gradient
61
+ 43 methods can find local minima as efficiently as finding stationary points still remains unknown.
62
+ 44 In this work, we give an affirmative answer to the above question. We propose a general framework
63
+ 45 named Pullback, which works together with existing popular stochastic gradient estimators such
64
+ 46 as SARAH/SPIDER and STORM to find approximate local minima efficiently. We summarize our
65
+ 47 contributions as follows:
66
+ • We prove that Pullback finds 48 $( \epsilon , \epsilon _ { H } )$ -approximate local minima within √ $\widetilde { \cal O } ( \epsilon ^ { - 3 } + \epsilon _ { H } ^ { - 6 } )$ stochastic
67
+ 49 gradient evaluations. Specifically, in the classic setting where $\epsilon _ { H } = \sqrt { \epsilon }$ , our Pullback together
68
+ 50 with the SARAH/SPIDER estimator enjoys an $\widetilde O ( \epsilon ^ { - 3 } )$ stochastic gradient complexity, which
69
+ 51 outperforms previous best known complexity result $\widetilde { O } ( \epsilon ^ { - 3 . 5 } )$ achieved by Li [17]. Our result
70
+ 52 also matches the best possible complexity result $\widetilde O ( \epsilon ^ { - 3 } )$ achieved by negative curvature search
71
+ 53 based algorithms [9, 31], which suggests that simple methods such as perturbed stochastic gradient
72
+ 54 methods can find local minima as efficiently as the more complicated ones.
73
+
74
+ • Besides, we also show that Pullback with a recent proposed STORM estimator is also able to find $( \epsilon , \epsilon _ { H } )$ -approximate local minima within $\widetilde { \cal O } ( \epsilon ^ { - 3 } + \epsilon _ { H } ^ { - 6 } )$ stochastic gradient evaluations.
75
+
76
+ • At the core of our Pullback is a novel step-size "pullback" scheme to control the average movement of the iterates, which may be of independent interest to other related nonconvex optimization algorithm design.
77
+
78
+ 60 To compare with, we summarized related results of stochastic first-order methods for finding local
79
+ 61 minima in Table 1.
80
+ 62 Notations We use lower case letters to denote scalars, lower and upper case bold letters to denote
81
+ 63 vectors and matrices. We use $\| \cdot \|$ to indicate Euclidean norm. We use $\mathbb { B } _ { \mathbf { x } } ( r )$ to denote a Euclidean
82
+ 64 ball center at $\mathbf { x }$ with radius $r$ .We also use the standard $O$ and $\Omega$ notations. We use $\lambda _ { \operatorname* { m i n } } ( \mathbf { M } )$ to denote
83
+ 65 the minimum eigenvalue of matrix M. We say $a _ { n } = O ( b _ { n } )$ if and only if $\exists C > 0 , N > 0 , \forall n >$
84
+ 66 $N , a _ { n } \leq C b _ { n }$ ; $a _ { n } = \Omega ( b _ { n } )$ if $a _ { n } \geq C b _ { n }$ . The notation $\widetilde O$ is used to hide logarithmic factors.
85
+
86
+ Table 1: Comparison of of different optimization algorithm for find approximate local minima of non convex online problems.
87
+
88
+ <table><tr><td>Algorithm</td><td>Gradient complexity</td><td>Classic Setting</td><td>Neon2</td></tr><tr><td>Neon2+Natasha2 [1]</td><td>-1 +</td><td>(€-3.5)</td><td>needed</td></tr><tr><td>Neon2+SCSG[3]</td><td>(e-10/3+e -3 EH -5) +</td><td>(e-3.5)</td><td>needed</td></tr><tr><td>SNVRG++Neon2 [31]</td><td>+H) -5)</td><td>((-3.5)</td><td>needed</td></tr><tr><td>SPIDER-SFO+(+Neon2)[9]</td><td>+)</td><td>(c-3)</td><td>needed</td></tr><tr><td>Perturbed SGD [10]</td><td>Poly(d,c-1,1)</td><td>(Poly(e-1))</td><td>No</td></tr><tr><td>CNC-SGD[7]</td><td>(c-+1 -10)</td><td>(e-5)</td><td>No</td></tr><tr><td>SSRGD [17]</td><td>O(e +∈ -3 +e 1H4)</td><td>(e-3.5)</td><td>No</td></tr><tr><td> Pullback (This paper)</td><td>O(e-³+∈H6)</td><td>O(e-3)</td><td>No</td></tr></table>
89
+
90
+ # 2 Related Work
91
+
92
+ 68 In this section, we review some important related works.
93
+
94
+ 69 Variance reduction methods for finding stationary points. Our algorithm takes stochastic gradient
95
+ 70 estimators as its subroutine. In specific, Johnson and Zhang [14], Xiao and Zhang [28] proposed
96
+ 71 Stochastic Variance Reduced Gradient (SVRG) for convex optimization in the finite-sum setting.
97
+ 72 Reddi et al. [25], Allen-Zhu and Hazan [2] analyzed SVRG for nonconvex optimization. Lei et al. [16]
98
+ 73 proposed a new variance reduction algorithm, dubbed stochastically controlled stochastic gradient
99
+ 74 (SCSG) algorithm, which finds a $\epsilon$ -stationary point within $O ( \epsilon ^ { - 1 0 / 3 } )$ stochastic gradient evaluations.
100
+ 75 Nguyen et al. [21] proposed a SARAH algorithm which uses a recursive gradient estimator for convex
101
+ 76 optimization, and it was extended to nonconvex optimization in [22]. Fang et al. [9] proposed a
102
+ 77 SPIDER algorithm with a recursive gradient estimator and proved an $O ( \epsilon ^ { - 3 } )$ stochastic gradient
103
+ 78 evaluations to find a $\epsilon$ -stationary point, which matches a corresponding lower bound. Concurrently,
104
+ 79 Zhou et al. [30] proposed an SNVRG algorithm with a nested gradient estimator and proved an $\tilde { O } ( \epsilon ^ { - 3 } )$
105
+ 80 stochastic gradient evaluations to find a $\epsilon$ -stationary point. Wang et al. [27] proposed a Spiderboost
106
+ 81 algorithm with a constant step size, achieves the same $O ( \epsilon ^ { - 3 } )$ gradient complexity. Pham et al.
107
+ 82 [23] extended SARAH [22] to proximal optimization and proved $O ( \epsilon ^ { - 3 } )$ gradient complexity for
108
+ 83 finding stationary points. Recently, Cutkosky and Orabona [6] proposed a recursive momentum-based
109
+ 84 algorithm called STORM and proved an $\widetilde O ( \epsilon ^ { - 3 } )$ gradient complexity to find $\epsilon$ -stationary points.
110
+ 85 Tran-Dinh et al. [26] proposed a SARAH-SGD algorithm which hybrids both SGD and SARAH
111
+ 86 algorithm with an $\widetilde O ( \epsilon ^ { - 3 } )$ gradient complexity when $\epsilon$ is small. Li et al. [18] proposed a PAGE
112
+ 87 algorithm with probabilistic gradient estimator which also attains an $\widetilde O ( \epsilon ^ { - 3 } )$ gradient complexity.
113
+ 88 In our work, we employ SARAH/SPIDER and STORM as the gradient estimator in our Pullback
114
+ 89 framework since they are most representative and simple to use.
115
+ 90 Utilizing negative curvature descent to escape from saddle points. To escape saddle points, a
116
+ 91 widely used approach is to first compute the direction of the negative curvature of the saddle point and
117
+ 92 move away along that direction. In stochastic optimization, to find $( \epsilon , \epsilon _ { H } )$ -approximate local minima,
118
+ 93 [1] proposed a Natasha algorithm using Hdirection with the total computation cost of ompute. Later, negative curvature et al. [29] proposed
119
+ 94 $\widetilde O ( \epsilon ^ { - 3 . 2 5 } + \epsilon ^ { - 3 } \epsilon _ { H } ^ { - 1 } + \epsilon _ { H } ^ { - 5 } )$ $\mathrm { X u }$
120
+ 95 96 a Neon method which computes thewhose total computational cost is $\widetilde O ( \epsilon ^ { - 1 0 / 3 } + \epsilon ^ { - 2 } \epsilon _ { H } ^ { - 3 } + \epsilon _ { H } ^ { - 6 } )$ with perturbed stochastic gradients,. [3] proposed a Neon2 negative
121
+ 97 curvature computation subroutine with $\widetilde O ( \epsilon ^ { - 1 0 / 3 } + \epsilon ^ { - 2 } \epsilon _ { H } ^ { - 3 } + \epsilon _ { H } ^ { - 5 } )$ stochastic gradient evaluations.
122
+ 98 Fang et al. [9] then showed that SPIDER equipped with Neon2 can find $( \epsilon , \epsilon _ { H } )$ -approximate local
123
+ 99 minima within $\widetilde { \mathcal { O } } ( \epsilon ^ { - 3 } + \epsilon ^ { - 2 } \epsilon _ { H } ^ { - 2 } + \epsilon _ { H } ^ { - 5 } )$ stochastic gradient evaluations, while independently Zhou
124
+ 100 et al. [31] proved that SNVRG equipped with Neon2 can find $( \epsilon , \epsilon _ { H } )$ -approximate local minima
125
+ 101 within $\widetilde { \mathcal { O } } ( \epsilon ^ { - 3 } + \epsilon ^ { - 2 } \epsilon _ { H } ^ { - 3 } + \epsilon _ { H } ^ { - 5 } )$ stochastic gradient evaluations. In contrast to this line of works, our
126
+ 102 algorithm is simpler since it does not need to use the negative curvature search routine.
127
+
128
+ # 3 Preliminaries
129
+
130
+ In this section, we present assumptions and definitions that will be used throughout our analysis.
131
+
132
+ 05 We first introduce the standard smoothness and Hessian Lipschitz assumptions.
133
+
134
+ 106 Assumption 3.1. For all $\boldsymbol { \xi }$ , $f ( \cdot ; \pmb { \xi } )$ is $L$ -smooth and its Hessian is $\rho$ -Lipschitz continuous w.r.t. $\mathbf { x }$
135
+ 107 i.e., for any $\mathbf { x } _ { 1 } , \mathbf { x } _ { 2 }$ , we have that
136
+
137
+ $$
138
+ \begin{array} { r } { \| \nabla f ( \mathbf { x } _ { 1 } ; \pmb { \xi } ) - \nabla f ( \mathbf { x } _ { 2 } ; \pmb { \xi } ) \| _ { 2 } \leq L \| \mathbf { x } _ { 1 } - \mathbf { x } _ { 2 } \| _ { 2 } , \ \| \nabla ^ { 2 } f ( \mathbf { x } _ { 1 } ; \pmb { \xi } ) - \nabla ^ { 2 } f ( \mathbf { x } _ { 2 } ; \pmb { \xi } ) \| _ { 2 } \leq \rho \| \mathbf { x } _ { 1 } - \mathbf { x } _ { 2 } \| _ { 2 } } \end{array}
139
+ $$
140
+
141
+ 108 This assumption directly implies that the expected objective function $F ( \mathbf { x } )$ is also $L$ -smooth and its
142
+ 109 Hessian is $\rho$ -Lipschitz continuous. This assumption is standard for finding approximate local minima
143
+ 110 in all the results presented in Table 1.
144
+
145
+ 111 Assumption 3.2. The squared difference between the stochastic gradient and full gradient is bounded by 112 $\sigma ^ { 2 } < \infty$ , i.e., for any $\mathbf { x } , \pmb { \xi } \in \mathbb { R } ^ { d }$ , $\| \nabla f ( \mathbf { x } ; \pmb { \xi } ) - \nabla F ( \mathbf { x } ) \| _ { 2 } ^ { 2 } \leq \bar { \sigma } ^ { 2 }$ .
146
+
147
+ 113 Assumption 3.2 is standard in online/stochastic optimization for finding second-order stationary
148
+ 114 points [9, 17], and immediately implies that the variance of the stochastic gradient is bounded by $\sigma ^ { \bar { 2 } }$ .
149
+ 115 It can be relaxed to be $\| \nabla f ( \mathbf { x } ; \pmb { \xi } ) - \nabla F ( \mathbf { x } ) \| _ { 2 }$ has a $\sigma$ -Sub-Gaussian tail.
150
+
151
+ Let 116 $\mathbf { x } _ { 0 } \in \mathbb { R } ^ { d }$ be the starting point of the algorithm. We assume the gap between the initial function 117 value and the optimal value is bounded.
152
+
153
+ 118 Assumption 3.3. We have $\begin{array} { r } { \Delta = F ( \mathbf { x } _ { 0 } ) - \operatorname* { i n f } _ { \mathbf { x } } F ( \mathbf { x } ) < + \infty . } \end{array}$ .
154
+
155
+ 119 Next, we give the formal definition of approximate local minima (a.k.a., second-order stationary
156
+ 120 points).
157
+
158
+ Definition 3.4. We call 121 $\mathbf { x } \in \mathbb { R } ^ { d }$ an $( \epsilon , \epsilon _ { H } )$ -approximate local minimum, if
159
+
160
+ $$
161
+ \begin{array} { r } { \| \nabla F ( \mathbf { x } ) \| _ { 2 } \le \epsilon , \lambda _ { \operatorname* { m i n } } \bigl ( \nabla ^ { 2 } F ( \mathbf { x } ) \bigr ) \ge - \epsilon _ { H } . } \end{array}
162
+ $$
163
+
164
+ 22 The definition of $( \epsilon , \epsilon _ { H } )$ -approximate local minima is a generalization of the classical $( \epsilon , \sqrt { \epsilon } )$ -
165
+ 123 approximate local minima studied by Nesterov and Polyak [20], Jin et al. [13].
166
+
167
+ # 24 4 The Pullback Framework
168
+
169
+ 125 In this section, we present our main algorithm Pullback. We begin with reviewing the mechanism
170
+ 126 of perturbed gradient descent in deterministic optimization, and then we discuss the main difficulty of
171
+ 127 extending it to the stochastic optimization case. Finally, we show how we overcome such a difficulty
172
+ 128 by presenting our Pullback framework.
173
+
174
+ How does perturbed gradient descent escape from saddle points? We review the perturbed√ gradient descent [13] (PGD for short) with its proof roadmap, which shows how PGD finds $( \epsilon , \sqrt { \epsilon } )$ - approximate local minima efficiently. In general, the whole process of perturbed gradient descent can be decomposed into several epochs, and each epoch consists of two non-overlapping phases: the gradient descent phase (GD phase for short) and the Escape from saddle point phase (Escape phase for short). In each epoch, PGD starts with the GD phase by default. In the GD phase, PGD performs vanilla gradient descent to update its iterate, until at some iterate $\widetilde { \mathbf { x } }$ , the norm of the gradient $| | \nabla F ( \widetilde { \mathbf { x } } ) | | _ { 2 }$ is less than the target accuracy ${ \widetilde O } ( \epsilon )$ . Then PGD switches to the Escape phase. In the eEscape phase, PGD first adds a uniform random noise (or Gaussian noise) to the current iterate $\widetilde { \mathbf { x } }$ , then it runs $\ell _ { \mathrm { t h r e s } } = \widetilde { O } ( \epsilon ^ { - 1 / 2 } )$ e steps of vanilla gradient descent. PGD then compares the function value gap between the current iterate and the beginning iterate of Escape phase $\widetilde { \mathbf { x } }$ . If the gap is less than a threshold $\mathcal { F } = \widetilde O ( \epsilon ^ { 1 . 5 } )$ , then PGD outputs $\widetilde { \mathbf { x } }$ as the targeted local minimum. Otherwise, PGD estarts a new epoch and performs gradient descent again.
175
+
176
+ 142 To see why PGD can find $( \epsilon , \sqrt { \epsilon } )$ -approximate local minima within $\widetilde O ( \epsilon ^ { - 2 } )$ gradient evaluations, we
177
+ 143 do the following calculation. First, when PGD is in the GD phase, the function value decreases $\widetilde { \cal O } ( \epsilon ^ { 2 } )$
178
+ 144 per step (following the standard gradient descent analysis). When PGD is in the Escape phase, the
179
+ 145 function value decreases $\mathcal { F } / \ell _ { \mathrm { t h r e s } } \overset { \cdot } { = } \widetilde { O } ( \epsilon ^ { 2 } )$ per step on average. Therefore, the total number of steps
180
+ 146 will be bounded by $\widetilde O ( \epsilon ^ { - 2 } )$ , which is in the same order as GD for finding $\epsilon$ -stationary points.
181
+ 147 Limitation of existing methods. However, extending the two-phase PGD algorithm from determinis
182
+ 148 tic optimization to stochastic optimization with a competative gradient complexity is very challenging.
183
+ 149 We take the SSRGD algorithm proposed by Li [17] as an example, which uses SARAH/SPIDER [9] as
184
+ 150 its gradient estimator. Unlike deterministic optimization where we can access the exact function value
185
+ 151 $F ( \mathbf { x } )$ and gradient $\nabla F ( \mathbf { x } )$ defined in (1.1), in the stochastic optimization case we can only access
186
+ 152 the stochastic function $f ( \mathbf { x } ; \pmb { \xi } )$ and the stochastic gradient $\nabla f ( \mathbf { x } ; \pmb { \xi } )$ . Therefore, in order to estimate
187
+ 153 the gradient norm $\| \nabla F ( \mathbf { x } ) \| _ { 2 }$ (which is required at the beginning of Escape phase), a naive approach
188
+ 154 (adapted by Li [17]) is to sample a big batch of stochastic gradient $\nabla f ( \mathbf { x } ; \pmb { \xi } _ { 1 } ) , \dotsc , \nabla f ( \mathbf { x } ; \pmb { \xi } _ { B } )$ and
189
+ 155 uses their mean to approximate $\nabla F ( \mathbf { x } )$ . Standard concentration analysis suggests that in order to
190
+ 156 achieve an $\epsilon$ -accuracy, the batch size $B$ should be in the order $\widetilde O ( \epsilon ^ { - 2 } )$ . Thus, each Escape phase
191
+ 157 leads to a $\mathcal { F } = \widetilde { O } ( \epsilon ^ { 1 . 5 } )$ function value decrease with at least $\widetilde { O } ( \epsilon ^ { - 2 } )$ number of stochastic gradient
192
+ 158 evaluations, which contributes $\widetilde { \cal O } ( 1 / \epsilon ^ { 1 . 5 } \cdot \epsilon ^ { - 2 } ) = \widetilde { \cal O } ( \epsilon ^ { - 3 . 5 } )$ gradient complexity in the end. This is
193
+ 159 already worse than the $O ( \epsilon ^ { - 3 } )$ gradient complexity of SPIDER for finding $\epsilon$ -stationary points.
194
+ 160 Our approach. Here we propose our Pullback framework in Algorithm 1, which overcomes the
195
+ 161 aforementioned limitation. In detail, Pullback inherits the two-phase structure of PGD and SSRGD,
196
+ 162 and it takes either SARAH/SPIDER or STORM [6] as its gradient estimator. The two gradient
197
+ 163 estimators are summarized as subroutines GradEst-SPIDER and GradEst-STORM in Algorithms 2
198
+ 164 and 3 respectively, and we use $\mathbf { d } _ { t }$ to denote their estimated gradient at iterate $\mathbf { x } _ { t }$ . The key improvement
199
+ 165 of Pullback is that, it directly takes the output of the gradient estimator GradEst to estimate the
200
+ 166 true gradient $\nabla F ( \mathbf { x } )$ , which avoids sampling a big batch of stochastic gradients as in Li [17] and
201
+ 167 thus saves the total gradient complexity. A similar strategy has also been adapted in [9], but for the
202
+ 168 negative curvature search subroutine. However, such a strategy leads to a new problem to be solved.
203
+ 169 Since we use $\mathbf { d } _ { t }$ to directly estimate $\nabla F ( \mathbf { x } _ { t } )$ , in order to make such an estimation valid, we need to
204
+ 170 guarantee that the error between $\mathbf { d } _ { t }$ and $\nabla F ( \mathbf { x } _ { t } )$ is small enough, e.g., up to $O ( \epsilon )$ accuracy. Notice
205
+
206
+ # Algorithm 1 Pullback
207
+
208
+ Input: Initial point $\mathbf { x } _ { 1 }$ , step size $\eta$ and $\eta _ { H }$ , perturbation radius $r$ , threshold parameter $\ell _ { \mathrm { t h r e s } }$ , average
209
+ movement $\overline { { D } }$ .
210
+ 1: $\mathbf { d } _ { 1 } \gets \mathtt { G r a d E s t } ( 0 , \mathbf { 0 } , \mathbf { 0 } , \mathbf { x } _ { 1 } )$ , $s \gets 0$ , $t \gets 1$ , FIND $\gets$ false
211
+ 2: while $\mathrm { F I N D } =$ false do
212
+ 3: $s \gets s + 1$ , $t _ { s } \gets t$ , $\mathrm { F I N D }$ true
213
+ 4: while $\| \mathbf { d } _ { t } \| _ { 2 } > \epsilon$ do
214
+ 5: $\eta _ { t } \eta / \| \mathbf { d } _ { t } \| _ { 2 }$ , {"PullBack"}
215
+ 6: $\mathbf { x } _ { t + 1 } \mathbf { x } _ { t } - \eta _ { t } \mathbf { d } _ { t } , \mathbf { d } _ { t + 1 } { \mathrm { G r a d E s t } } ( t , \mathbf { d } _ { t } , \mathbf { x } _ { t } , \mathbf { x } _ { t + 1 } ) , t t + 1$
216
+ 7: end while
217
+ 8: $m _ { s } \gets t$ , ξ $\mathbf { \nabla } \sim \operatorname { U n i f o r m } B _ { 0 } ( r ) , \mathbf { x } _ { t + 1 } \mathbf { x } _ { t } + \xi , \mathbf { d } _ { t + 1 } \operatorname { G r a d E s t } ( t , \mathbf { d } _ { t } , \mathbf { x } _ { t } , \mathbf { x } _ { t + 1 } ) , t \gets t + 1$
218
+ 9: for $k = 0 , \ldots , \ell _ { \mathrm { t h r e s } } - 1$ do
219
+ 10: $\begin{array} { r } { \eta _ { t } \eta _ { H } , D \sum _ { i = m _ { s } } ^ { t } \eta _ { i } ^ { 2 } \| \mathbf { d } _ { i } \| _ { 2 } ^ { 2 } } \end{array}$
220
+ 11: if $D > ( t - m _ { s } + 1 ) \overline { { D } }$ then
221
+ 12: Set $\eta _ { t }$ such that $\begin{array} { r } { \sum _ { i = m _ { s } } ^ { t } \eta _ { i } ^ { 2 } \lVert \mathbf { d } _ { i } \rVert _ { 2 } ^ { 2 } = ( t - m _ { s } + 1 ) \overline { { D } } } \end{array}$ {"PullBack"}
222
+ 13: $\mathbf { x } _ { t + 1 } \mathbf { x } _ { t } - \eta _ { t } \mathbf { d } _ { t }$ , $\mathbf { d } _ { t + 1 } \mathrm { G r a d E s t } ( t , \mathbf { d } _ { t } , \mathbf { x } _ { t } , \mathbf { x } _ { t + 1 } )$ , $t \gets t + 1$ , $\mathrm { F I N D }$ false, break
223
+ 14: end if
224
+ 15: $\mathbf { x } _ { t + 1 } \mathbf { x } _ { t } - \eta _ { t } \mathbf { d } _ { t } , \mathbf { d } _ { t + 1 } { \mathrm { G r a d E s t } } ( t , \mathbf { d } _ { t } , \mathbf { x } _ { t } , \mathbf { x } _ { t + 1 } ) , t t + 1$
225
+ 16: end for
226
+ 17: end while
227
+
228
+ # $\mathbf { A l g o r i t h m 2 \ G r a d E s t - S P I D E R } ( t , \mathbf { d } _ { t } , \mathbf { x } _ { t } , \mathbf { x } _ { t + 1 } , b , q , B )$
229
+
230
+ Input: Big batch size $B$ , mini-batch size $b$ , loop length $q$
231
+ 1: if $t$ mod $q = 0$ then
232
+ 2: Generate $\pmb { \xi } _ { t + 1 } ^ { 1 } , \dots , \pmb { \xi } _ { t + 1 } ^ { B }$ . Set $\begin{array} { r } { \mathbf { d } _ { t + 1 } \sum _ { i = 1 } ^ { B } \nabla f ( \mathbf { x } _ { t + 1 } ; \pmb { \xi } _ { t + 1 } ^ { i } ) / B } \end{array}$
233
+ 3: else
234
+ 4: Generate $\pmb { \xi } _ { t + 1 } ^ { 1 } , \dots , \pmb { \xi } _ { t + 1 } ^ { b }$ . Set $\begin{array} { r } { \mathbf { d } _ { t + 1 } \mathbf { d } _ { t } + \sum _ { i = 1 } ^ { b } [ \nabla f ( \mathbf { x } _ { t + 1 } ; \pmb { \xi } _ { t + 1 } ^ { i } ) - \nabla f ( \mathbf { x } _ { t } ; \pmb { \xi } _ { t + 1 } ^ { i } ) ] / b } \end{array}$
235
+ 5: end if
236
+ Output: $\mathbf { d } _ { t + 1 }$
237
+
238
+ 171 that the recursive structure of SARAH/SPIDER and STORM suggests the following error bound:
239
+
240
+ $$
241
+ \forall t , \ \| \mathbf { d } _ { t } - \nabla F ( \mathbf { x } _ { t } ) \| _ { 2 } ^ { 2 } = \widetilde { O } \bigg ( \sum _ { i = s _ { t } } ^ { t - 1 } \| \mathbf { x } _ { i + 1 } - \mathbf { x } _ { i } \| _ { 2 } ^ { 2 } \bigg ) ,
242
+ $$
243
+
244
+ 172 where $s _ { t }$ is some reference index only related to $t$ . Therefore, in order to make the error
245
+ 173 $\| \mathbf { d } _ { t } - \nabla F ( \mathbf { x } _ { t } ) \| _ { 2 }$ small, it suffices to make the movement of the iterates $\lVert \mathbf { x } _ { i + 1 } - \mathbf { x } _ { i } \rVert _ { 2 }$ small either
246
+ 174 individually or on average. We achieve this goal by our proposed step-size “Pullback” scheme. In de
247
+ 175 tail, in the GD phase, when the norm of the estimated gradient $\| \mathbf { d } _ { t } \| _ { 2 }$ is large, we pull the step-size $\eta _ { t }$
248
+ 176 back to a smaller value via normalization, which forces the movement $\lVert \mathbf { x } _ { i + 1 } - \mathbf { x } _ { i } \rVert _ { 2 } = \eta _ { t } \lVert \bar { \mathbf { d } } _ { t } \rVert _ { 2 } = \dot { \eta }$
249
+ 177 to be small. Such an approach is also adapted by Fang et al. [9] as a normalized gradient de
250
+ 178 scent for finding first-order stationary points. In the Escape phase, which starts at $m _ { s }$ -th step, we
251
+ 179 record the accumulative squared movement starting from $\mathbf { x } _ { m _ { s } + 1 }$ (after the perturbation step) as
252
+ 180 $\begin{array} { r } { D : = \sum _ { i = m _ { s } + 1 } ^ { t } \| \mathbf { x } _ { i + 1 } - \mathbf { x } _ { i } \| _ { 2 } ^ { 2 } = \sum _ { i = m _ { s } + 1 } ^ { t } \eta _ { i } ^ { 2 } \| \mathbf { d } _ { i } \| _ { 2 } ^ { 2 } } \end{array}$ . When the average movement $D / ( t - m _ { s } + 1 )$
253
+ 181 is large, we pull the last step size $\eta _ { t }$ back to a smaller value, which forces the average movement
254
+ 182 $D / ( t - m _ { s } + 1 )$ to be small. Fortunately, such a simple step-size calibration scheme allows us to
255
+ 183 well-control the error between $\mathbf { d } _ { t }$ and $\nabla F ( \mathbf { x } _ { t } )$ , and to reduce the gradient complexity.
256
+
257
+ # 5 Main Results
258
+
259
+ 5 In this section, we present the main theoretical results. We first present the convergence guarantee of
260
+ 6 Pullback-SPIDER, which uses GradEst-SPIDER to estimate the gradient $\mathbf { d } _ { t }$ in Algorithm 1.
261
+
262
+ Theorem 5.1. Under Assumptions 3.1, 3.2 and 3.3, choose batch size $B = \widetilde O \big ( \sigma ^ { 2 } \epsilon ^ { - 2 } + { }$ $\sigma ^ { 2 } \rho ^ { 2 } \epsilon _ { H } ^ { - 4 } )$ , $b ~ = ~ q ~ = ~ \sqrt { B }$ , set step size $\eta ~ = ~ \sigma / ( 2 \sqrt { B } L )$ , $\eta _ { H } ~ = ~ { \widetilde O } ( L ^ { - 1 } )$ , perturbation radius $r \leq \operatorname* { m i n } \big \{ \sigma / ( 2 \sqrt { B } L ) , \log ( 4 / \delta ) \eta _ { H } \sigma ^ { 2 } / ( 2 B \epsilon ) .$ , $\sqrt { 2 \log ( 4 / \delta ) \eta _ { H } \sigma ^ { 2 } / ( B L ) } \} ,$ , threshold $\ell _ { \mathrm { t h r e s } } =$
263
+
264
+ Input: Initial batch size $B$ , mini batch size $b$ and weight parameter $a$ .
265
+ 1: if $t = 0$ then
266
+ 2: Generate $\pmb { \xi } _ { t + 1 } ^ { 1 } , \dots , \pmb { \xi } _ { t + 1 } ^ { B }$ . Set $\begin{array} { r } { \mathbf { d } _ { t + 1 } \sum _ { i = 1 } ^ { B } \nabla f ( \mathbf { x } _ { t + 1 } ; \pmb { \xi } _ { t + 1 } ^ { i } ) / B } \end{array}$
267
+ 3: else4: Generate $\pmb { \xi } _ { t + 1 } ^ { 1 } , \dots , \pmb { \xi } _ { t + 1 } ^ { b }$
268
+ 5: Se $\begin{array} { r } { \mathbf { d } _ { t + 1 } \longleftarrow ( 1 - a ) \big [ \dot { \mathbf { d } } _ { t } - \sum _ { i = 1 } ^ { b } \nabla f ( \mathbf { x } _ { t } ; \pmb { \xi } _ { t + 1 } ^ { i } ) / b \big ] + \sum _ { i = 1 } ^ { b } \nabla f ( \mathbf { x } _ { t + 1 } ; \pmb { \xi } _ { t + 1 } ^ { i } ) / b } \end{array}$
269
+ 6: end if
270
+
271
+ $\widetilde { \cal O } ( 1 / ( \eta _ { H } \epsilon _ { H } ) )$ and $\overline { { D } } ~ = ~ \sigma ^ { 2 } / ( 4 B L ^ { 2 } )$ . Then with high probability, Pullback-SPIDER can find $( \epsilon , \epsilon _ { H } )$ -approximate local minima within $\widetilde { \cal O } ( \sigma L \Delta \epsilon ^ { - 3 } + \sigma \rho ^ { 3 } L \Delta \epsilon _ { H } ^ { - 6 } )$ stochastic gradient evaluations.
272
+
273
+ Remark 5.2. In the classical setting $\epsilon = \sqrt { \epsilon _ { H } }$ , our result gives $\widetilde O ( \epsilon ^ { - 3 } )$ gradient complexity, which outperforms the best existing result $\widetilde { O } ( \epsilon ^ { - 3 . 5 } )$ for perturbed stochastic gradient methods achieved by SSRGD [17]. For sufficiently small $\epsilon$ , Arjevani et al. [4] proved the lower bound of gradient complexity $\Omega ( \epsilon ^ { - 3 } + \epsilon _ { H } ^ { - 5 } )$ for any first-order stochastic methods to find $( \epsilon , \epsilon _ { H } )$ -approximate local minima. Our results matches the lower bound $\widetilde O ( \epsilon ^ { - 3 } )$ when $\epsilon _ { H } \leq \epsilon ^ { 3 / 5 }$ . For the general case, there is still a gap in the dependency of $\epsilon _ { H }$ between our result and the lower bound, and we leave to close it as future work.
274
+
275
+ Next, we present the convergence guarantee of Pullback-STORM, which uses GradEst-STORM to estimate the gradient $\mathbf { d } _ { t }$ in Algorithm 1.
276
+
277
+ Theorem 5.3. Under Assumptions 3.1, 3.2 and 3.3, choose the mini batch size $b = \widetilde { O } ( \sigma \epsilon ^ { - 1 } +$ $\sigma \rho \epsilon _ { H } ^ { - 2 } )$ , and initial batch size $\begin{array} { l l l } { { B } } & { { = } } & { { b ^ { 2 } } } \end{array}$ , set step size $\eta ~ = ~ \sigma / ( 2 b L )$ , $\eta _ { H } = \widetilde { \cal O } ( L ^ { - 1 } ) ,$ weight $\begin{array} { c c l } { a } & { = } & { 5 6 ^ { 2 } \log ( 4 / \delta ) / b } \end{array}$ , threshold $\ell _ { \mathrm { t h r e s } } ~ = ~ { \cal \widetilde O } ( 1 / ( \eta _ { H } \epsilon _ { H } ) )$ , perturbation radius $r \_ { \Sigma }$ $\operatorname* { m i n } \left\{ \sigma / ( 2 b L ) , \log ( 4 / \delta ) ^ { 2 } \eta _ { H } \sigma ^ { 2 } / ( \epsilon b ^ { 2 } ) \right.$ , $\sqrt { 2 \log ( 4 / \delta ) ^ { 2 } \eta _ { H } \sigma ^ { 2 } / ( b ^ { 2 } L ) } \} ,$ and $\overline { { D } } = \sigma ^ { 2 } / ( 4 b ^ { 2 } L ^ { 2 } )$ . Then with high probability, Pullback-STORM can find $( \epsilon , \epsilon _ { H } )$ -approximate local minima within $\widetilde { \cal O } \bigl ( \sigma L \Delta \epsilon ^ { - 3 } + \sigma \rho ^ { 3 } L \Delta \epsilon _ { H } ^ { - 6 } \bigr )$ stochastic gradient evaluations.
278
+
279
+ Remark 5.4. Different from Pullback-SPIDER, the estimation error $\| \mathbf { d } _ { t } \mathrm { ~ - ~ } \nabla F ( \mathbf { x } _ { t } ) \| _ { 2 }$ of Pullback-STORM is controlled by the weight parameter $a$ . This allows us to come up with a simpler single-loop algorithm instead of a double-loop algorithm.
280
+
281
+ # 6 Proof Outline of the Main Results
282
+
283
+ Due to the page limit, we only outline the proof of Theorem 5.1 and leave the proof of Theorem 5.3 to the appendix.
284
+
285
+ Let $\epsilon _ { t }$ denote the difference between true gradient $\nabla F ( \mathbf { x } _ { t } )$ and the estimated gradient $\mathbf { d } _ { t }$ , which is $\epsilon _ { t } : = \mathbf { d } _ { t } - \nabla F ( \mathbf { x } _ { t } )$ . The following lemma suggests that the estimation error $\| \epsilon _ { t } \| _ { 2 }$ can be bounded.
286
+
287
+ Lemma 6.1. Under Assumptions 3.1 and 3.2, set 15 $b = q = \sqrt { B } , \eta \leq \sigma / ( 2 \sqrt { B } L ) , r \leq \sigma / ( 2 \sqrt { B } L )$ and 16 $\overline { { D } } \le \sigma ^ { 2 } / ( 4 B L ^ { 2 } )$ , then with probability at least $1 - \delta$ , for all $t$ we have
288
+
289
+ $$
290
+ \| \epsilon _ { t } \| _ { 2 } \leq \sqrt { 8 \log ( 4 / \delta ) } \sigma / \sqrt { B } .
291
+ $$
292
+
293
+ 217 Specifically, by the choice of $B$ in Theorem 5.1 we have that $\| \epsilon _ { t } \| _ { 2 } \le \epsilon / 2$ .
294
+
295
+ 218 Proof of Lemma 6.1. By GradEst-SPIDER presented in Algorithm 2 we have
296
+
297
+ $$
298
+ \begin{array} { l l } { \displaystyle \epsilon _ { t + 1 } = \frac { 1 } { B } \sum _ { i = 1 } ^ { B } \big [ \nabla f ( \mathbf { x } _ { t + 1 } ; \boldsymbol { \xi } _ { t + 1 } ^ { i } ) - \nabla F ( \mathbf { x } _ { t + 1 } ) \big ] , } & { t \mathrm { m o d } \ q = 0 , } \\ { \displaystyle \epsilon _ { t + 1 } = \epsilon _ { t } + \frac { 1 } { b } \sum _ { i = 1 } ^ { b } \big [ \nabla f ( \mathbf { x } _ { t + 1 } ; \boldsymbol { \xi } _ { t + 1 } ^ { i } ) - \nabla f ( \mathbf { x } _ { t } ; \boldsymbol { \xi } _ { t + 1 } ^ { i } ) - \nabla F ( \mathbf { x } _ { t + 1 } ) + \nabla F ( \mathbf { x } _ { t } ) \big ] , } & { t \mathrm { m o d } \ q \neq 0 . } \end{array}
299
+ $$
300
+
301
+ 219 By the $L$ -smoothness in Assumption 3.1 we have
302
+
303
+ $$
304
+ \begin{array} { r } { \left\| \nabla f ( \mathbf { x } _ { t + 1 } ; \pmb { \xi } _ { t + 1 } ^ { i } ) - \nabla f ( \mathbf { x } _ { t } ; \pmb { \xi } _ { t + 1 } ^ { i } ) - \nabla F ( \mathbf { x } _ { t + 1 } ) + \nabla F ( \mathbf { x } _ { t } ) \right\| _ { 2 } \leq 2 L \| \mathbf { x } _ { t + 1 } - \mathbf { x } _ { t } \| _ { 2 } . } \end{array}
305
+ $$
306
+
307
+ 220 Then by Assumption 3.2 and Azuma–Hoeffding inequality (See Lemma D.1 for details), with
308
+ 221 probability at least $1 - \delta$ , we have
309
+
310
+ $$
311
+ \forall t > 0 , \ \| \epsilon _ { t + 1 } \| _ { 2 } ^ { 2 } \leq 4 \log ( 4 / \delta ) \bigg ( \frac { \sigma ^ { 2 } } { B } + \frac { 4 L ^ { 2 } } { b } \sum _ { i = \lfloor t / q \rfloor q } ^ { t } \| \mathbf { x } _ { i + 1 } - \mathbf { x } _ { i } \| _ { 2 } ^ { 2 } \bigg ) .
312
+ $$
313
+
314
+ 222 Notice that GradEst-SPIDER is parallel with Pullback. Thus we need to further bound (6.1) by
315
+ 223 considering iterates in three different cases: (1) for step $i$ in the GD phase, we have $\| \mathbf { x } _ { i + 1 } - \mathbf { x } _ { i } \| _ { 2 } ^ { 2 } \leq \eta ^ { 2 }$
316
+ 224 due to the "Pullback" scheme; (2) for $i = m _ { s }$ for some $s$ in the Escape phase, we have $\| { \bf x } _ { i + 1 } - { \bf x } _ { i } \| _ { 2 } ^ { 2 } \leq$
317
+ 225 $r ^ { 2 }$ ; and (3) for the other steps in Escape phase, we have on average, $\| \mathbf { x } _ { i + 1 } - \mathbf { x } _ { i } \| _ { 2 } ^ { 2 } \leq \overline { { D } }$ . Therefore
318
+ 226 we have
319
+
320
+ $$
321
+ \| \epsilon _ { t + 1 } \| _ { 2 } ^ { 2 } \leq 4 \log ( 4 / \delta ) \biggl ( \frac { \sigma ^ { 2 } } { B } + \frac { 4 L ^ { 2 } } { b } \cdot q \cdot \operatorname* { m a x } \{ \eta ^ { 2 } , r ^ { 2 } , \overline { { D } } \} \biggr ) \leq \frac { 8 \log ( 4 / \delta ) \sigma ^ { 2 } } { B } .
322
+ $$
323
+
324
+ 227
325
+
326
+ 228 Lemma 6.1 guarantees that with high probability $\| \nabla F ( { \mathbf { x } } _ { t } ) \| _ { 2 } ~ \leq ~ \| { \mathbf { d } } _ { t } \| _ { 2 } + \epsilon$ , which ensures
327
+ 229 $\| \nabla F ( \mathbf { x } _ { m _ { s } } ) \| _ { 2 } \ \leq \ 2 \epsilon$ when the algorithm terminates. Next lemma bounds the function value de
328
+ 230 crease in the GD phase, which is also valid for Pullback-STORM.
329
+
330
+ 1 Lemma 6.2. Suppose the event in Lemma 6.1 holds, $\eta \le \epsilon / ( 2 L )$ , then for any $s$ , we have
331
+
332
+ $$
333
+ F ( \mathbf { x } _ { t _ { s } } ) - F ( \mathbf { x } _ { m _ { s } } ) \geq \frac { ( m _ { s } - t _ { s } ) \eta \epsilon } { 8 } .
334
+ $$
335
+
336
+ The choice of 232 $\eta$ in Theorem 5.1 further implies that the loss decreases by at least $\sigma \epsilon / ( 1 6 \sqrt { B } L )$ per 33 step on average.
337
+
338
+ 234 Proof of Lemma 6.2. For any $t _ { s } \le t < m _ { s }$ , we can show the following property (See Lemma D.2),
339
+
340
+ $$
341
+ F ( \mathbf { x } _ { t + 1 } ) \leq F ( \mathbf { x } _ { t } ) - \frac { \eta _ { t } } { 2 } \| \mathbf { d } _ { t } \| _ { 2 } ^ { 2 } + \frac { \eta _ { t } } { 2 } \| \pmb { \epsilon } _ { t } \| _ { 2 } ^ { 2 } + \frac { L } { 2 } \| \mathbf { x } _ { t + 1 } - \mathbf { x } _ { t } \| _ { 2 } ^ { 2 } .
342
+ $$
343
+
344
+ 235 Plugging the update rule $\mathbf x _ { t + 1 } = \mathbf x _ { t } - \eta _ { t } \mathbf d _ { t }$ into (6.2) gives,
345
+
346
+ $$
347
+ \begin{array} { r l } & { F ( \mathbf { x } _ { t + 1 } ) = F ( \mathbf { x } _ { t } ) - \| \mathbf { x } _ { t + 1 } - \mathbf { x } _ { t } \| _ { 2 } ^ { 2 } \bigg ( \displaystyle \frac { 1 } { 2 \eta _ { t } } - \frac { L } { 2 } \bigg ) + \displaystyle \frac { \eta _ { t } \| \epsilon _ { t } \| _ { 2 } ^ { 2 } } { 2 } } \\ & { \qquad \leq F ( \mathbf { x } _ { t } ) - \eta ^ { 2 } \bigg ( \displaystyle \frac { 1 } { 2 \eta _ { t } } - \frac { L } { 2 } \bigg ) + \displaystyle \frac { \eta _ { t } \epsilon ^ { 2 } } { 8 } , } \\ & { \qquad \leq F ( \mathbf { x } _ { t } ) - \displaystyle \frac { \eta \epsilon } { 8 } } \end{array}
348
+ $$
349
+
350
+ 236 where the first inequality holds due to the fact that $\eta _ { t } = \eta / \lVert \mathbf { d } _ { t } \rVert _ { 2 }$ and $\| \epsilon _ { t } \| _ { 2 } \le \epsilon / 2$ , and the second
351
+ 237 inequality is by $\eta _ { t } = \eta / \lVert \mathbf { d } _ { t } \rVert _ { 2 } \leq \eta / \epsilon \leq 1 / ( 2 L )$ . □
352
+ 238 Following Lemma shows that if $\mathbf { x } _ { m _ { s } }$ is a saddle point, then with high probability, the algorithm will
353
+ 239 break during the Escape phase and set $\mathrm { F I N D }$ false. Thus, whenever $\mathbf { x } _ { m _ { s } }$ is not a local minima, the
354
+ 240 algorithm cannot terminate.
355
+
356
+ Lemma 6.3. Under Assumptions 3.1 and 3.2, set perturbation radius √ $r ~ \le ~ L \eta _ { H } \epsilon _ { H } / ( C \rho )$ ,step siz2 $\begin{array} { r } { \colon \eta _ { H } \le \operatorname* { m i n } \{ 1 / ( 1 6 L \log ( \eta _ { H } \epsilon _ { H } \sqrt { d } L C ^ { - 1 } \rho ^ { - 1 } \delta ^ { - 1 } r ^ { - 1 } ) ) , 1 / ( 8 C L \log \ell _ { \mathrm { t h r e s } } ) \} = \widetilde { O } ( L ^ { - 1 } ) } \end{array}$ , $\ell _ { \mathrm { t h r e s } } =$ 43 $2 \log ( \eta _ { H } \epsilon _ { H } \sqrt { d } L C ^ { - 1 } \rho ^ { - 1 } \delta ^ { - 1 } r ^ { - 1 } ) / ( \eta _ { H } \epsilon _ { H } ) = \widetilde { O } ( \eta _ { H } ^ { - 1 } \epsilon _ { H } ^ { - 1 } ) ,$ and √ $\overline { { D } } < C ^ { 2 } L ^ { 2 } \eta _ { H } ^ { 2 } \epsilon _ { H } ^ { 2 } / ( \rho ^ { 2 } \ell _ { \mathrm { t h r e s } } ^ { 2 } )$ , where $C = O ( \log ( d \ell _ { \mathrm { t h r e s } } / \delta ) = \widetilde O ( 1 )$ . We also set $b = q = \sqrt { B } \geq 1 6 \log ( 4 / \delta ) / ( \eta _ { H } ^ { 2 } \epsilon _ { H } ^ { 2 } )$ . Then for any $s$ , when $\lambda _ { \operatorname* { m i n } } ( \nabla ^ { 2 } F ( \mathbf { x } _ { m _ { s } } ) ) \leq - \epsilon _ { H }$ , with probability at least $1 - 2 \delta$ algorithm breaks in the 46 Escape phase.
357
+
358
+ Proof of Lemma 6.3. Let 247 $\big \{ \mathbf { x } _ { t } \big \} , \big \{ \mathbf { x } _ { t } ^ { \prime } \big \}$ be two coupled sequences by running Pullback-SPIDER from√ 248 $\mathbf { x } _ { m _ { s } + 1 } , \mathbf { x } _ { m _ { s } + 1 } ^ { \prime }$ with $\mathbf { x } _ { m _ { s } + 1 } - \mathbf { x } _ { m _ { s } + 1 } ^ { \prime } = r _ { 0 } \mathbf { e } _ { 1 }$ , where $\mathbf { x } _ { m _ { s } + 1 } , \mathbf { x } _ { m _ { s } + 1 } ^ { \prime } \in \mathbb { B } _ { \mathbf { x } _ { m _ { s } } } ( r )$ . Here $r _ { 0 } = \delta r / \sqrt { d }$ and 249 $\mathbf { e } _ { 1 }$ denotes the smallest eigenvector direction of Hessian $\nabla ^ { 2 } F ( \mathbf { x } _ { m _ { s } } )$ .
359
+
360
+ 250 When $\lambda _ { \operatorname* { m i n } } ( \nabla ^ { 2 } F ( \mathbf { x } _ { m _ { s } } ) ) \leq - \epsilon _ { H }$ , under the parameter choice in Lemma 6.3, we can show that
361
+ 251 at least one of two sequence will escape the saddle point (See Lemma D.3). To be specific, with
362
+ 252 probability at least $1 - \delta$ ,
363
+
364
+ $$
365
+ \operatorname* { m a x } _ { m _ { s } < t < m _ { s } + \ell _ { \mathrm { t h r e s } } } \{ \| \mathbf { x } _ { t } - \mathbf { x } _ { m _ { s } + 1 } \| _ { 2 } , \| \mathbf { x } _ { t } ^ { \prime } - \mathbf { x } _ { m _ { s } + 1 } ^ { \prime } \| _ { 2 } \} \geq \frac { L \eta _ { H } \epsilon _ { H } } { C \rho } .
366
+ $$
367
+
368
+ 253 (6.3) suggests that for any two points $\mathbf { x } _ { m _ { s } + 1 } , \mathbf { x } _ { m _ { s } + 1 } ^ { \prime }$ satisfying $\mathbf { x } _ { m _ { s } + 1 } - \mathbf { x } _ { m _ { s } + 1 } ^ { \prime } = r _ { 0 } \mathbf { e } _ { 1 }$ , at least one
369
+ 254 of them will generate a sequence of iterates which finally move more than $\bar { L } \eta _ { H } \epsilon _ { H } / ( C \rho )$ . Thus, let
370
+ 255 $S \subseteq \mathbb { B } _ { m _ { s } } ( r )$ be the set of $\mathbf { x } _ { m _ { s } + 1 }$ which will not generate a sequence of iterates moving more than
371
+ 256 $\frac { L \eta _ { H } \epsilon _ { H } } { C \rho }$ , then in the direction $\mathbf { e } _ { 1 }$ , the "thickness" of $s$ is smaller than $r _ { 0 }$ . Simple integration shows that
372
+ 257 the ratio between the volume of $s$ and $\mathbb { B } _ { m _ { s } } ( r )$ is bounded by $\delta$ . Therefore, since $\mathbf { x } _ { m _ { s } + 1 }$ is generated
373
+ 258 from $\mathbf { x } _ { m _ { s } }$ by adding a uniform random noise in ball $\mathbb { B } _ { m _ { s } } ( r )$ , we conclude that the probability for
374
+ 259 $\mathbf { x } _ { m _ { s } + 1 }$ locating in $s$ is less than $\delta$ . Applying union bound, we get with probability at least $1 - 2 \delta$ ,
375
+
376
+ $$
377
+ \exists m _ { s } < t < m _ { s } + \ell _ { \mathrm { t h r e s } } , \Vert \mathbf { x } _ { t } - \mathbf { x } _ { m _ { s } + 1 } \Vert _ { 2 } \geq \frac { L \eta _ { H } \epsilon _ { H } } { C \rho } .
378
+ $$
379
+
380
+ 260 Denote $\mathcal { E }$ as the event that the algorithm does not break in the Escape phase. Then under $\mathcal { E }$ , for any
381
+ 261 $m _ { s } < t < m _ { s } + \ell _ { \mathrm { t h r e s } }$ , we have
382
+
383
+ $$
384
+ \| \mathbf { x } _ { t } - \mathbf { x } _ { m _ { s } + 1 } \| _ { 2 } \leq \sum _ { i = m _ { s } + 1 } ^ { t - 1 } \| \mathbf { x } _ { i + 1 } - \mathbf { x } _ { i } \| _ { 2 } \leq \sqrt { ( t - m _ { s } ) \sum _ { i = m _ { s } } ^ { t - 1 } \| \mathbf { x } _ { i + 1 } - \mathbf { x } _ { i } \| _ { 2 } ^ { 2 } } \leq ( t - m _ { s } ) \sqrt { \overline { { D } } } ,
385
+ $$
386
+
387
+ 262 where the first inequality is due to the triangle inequality and the second inequality is due to Cauchy
388
+ 263 Schwarz inequality. Thus, by the choice of $\ell _ { \mathrm { t h r e s } }$ and $\overline { { D } }$ , we have
389
+
390
+ $$
391
+ \| \mathbf { x } _ { t } - \mathbf { x } _ { m _ { s } + 1 } \| _ { 2 } \leq ( t - m _ { s } ) \sqrt { \overline { { D } } } \leq \ell _ { \mathrm { t h r e s } } \sqrt { \overline { { D } } } < C \cdot \frac { L \eta _ { H } \epsilon _ { H } } { \rho } .
392
+ $$
393
+
394
+ Then by (6.4), we know that 264 $\mathbb { P } ( \mathcal { E } ) \leq 2 \delta$ . Therefore when $\lambda _ { \operatorname* { m i n } } ( \nabla ^ { 2 } F ( \mathbf x _ { m _ { s } } ) ) \leq - \epsilon _ { H }$ , with probability 265 at least $1 - 2 \delta$ , Pullback breaks in the Escape phase. □
395
+
396
+ 266 Next lemma bounds the decreasing value of the function during the Escape phase if the algorithm
397
+ 267 breaks in the Escape phase(i.e. FIND is false).
398
+
399
+ 268 Lemma 6.4 (localization). Suppose the result of Lemma 6.1 holds, and set the step size ηH ≤ 269 $1 / \big ( L \sqrt { 1 2 8 \log ( 4 / \delta ) } \big )$ , perturbation radius $r \_ { \Sigma }$ 270 $\operatorname* { m i n } \left\{ \log ( 4 / \delta ) \eta _ { H } \sigma ^ { 2 } / ( 2 B \epsilon ) , \sqrt { 2 \log ( 4 / \delta ) \eta _ { H } \sigma ^ { 2 } / ( B L ) } \right\}$ , and $\overline { { D } } ~ = ~ \sigma ^ { 2 } / ( 4 B L ^ { 2 } )$ . Suppose the algorithm breaks in the Escape phase starting at 271 $\mathbf { x } _ { m _ { s } }$ , then we have
400
+
401
+ $$
402
+ F ( \mathbf { x } _ { m _ { s } } ) - F ( \mathbf { x } _ { t _ { s + 1 } } ) \geq ( t _ { s + 1 } - m _ { s } ) \frac { \log ( 4 / \delta ) \eta _ { H } \sigma ^ { 2 } } { B } .
403
+ $$
404
+
405
+ 272 Proof of Lemma 6.4. For any $m _ { s } < i < t _ { s + 1 }$ , we can show the following property (See Lemma D.2),
406
+
407
+ $$
408
+ F ( \mathbf { x } _ { i + 1 } ) \leq F ( \mathbf { x } _ { i } ) - \frac { \eta _ { i } } { 2 } \| \mathbf { d } _ { i } \| _ { 2 } ^ { 2 } + \frac { \eta _ { i } } { 2 } \| \pmb { \epsilon } _ { i } \| _ { 2 } ^ { 2 } + \frac { L } { 2 } \| \mathbf { x } _ { i + 1 } - \mathbf { x } _ { i } \| _ { 2 } ^ { 2 } .
409
+ $$
410
+
411
+ Plugging the update rule 273 $\mathbf { x } _ { i + 1 } = \mathbf { x } _ { i } - \boldsymbol { \eta } _ { i } \mathbf { d } _ { i }$ into (6.5) gives,
412
+
413
+ $$
414
+ \begin{array} { r l r } & { } & { F ( \mathbf { x } _ { i + 1 } ) \le F ( \mathbf { x } _ { i } ) + \displaystyle \frac { \eta _ { i } } { 2 } \| \boldsymbol { \epsilon } _ { i } \| _ { 2 } ^ { 2 } - \left( \displaystyle \frac { 1 } { 2 \eta _ { i } } - \displaystyle \frac { L } { 2 } \right) \| \mathbf { x } _ { i + 1 } - \mathbf { x } _ { i } \| _ { 2 } ^ { 2 } } \\ & { } & { \qquad \le F ( \mathbf { x } _ { i } ) + \displaystyle \frac { \eta _ { H } } { 2 } \displaystyle \frac { 8 \log ( 4 / \delta ) \sigma ^ { 2 } } { B } - \displaystyle \frac { 1 } { 4 \eta _ { H } } \| \mathbf { x } _ { i + 1 } - \mathbf { x } _ { i } \| _ { 2 } ^ { 2 } } \end{array}
415
+ $$
416
+
417
+ 274 where the the second inequality holds due to Lemma 6.1 and $\eta _ { i } \leq \eta _ { H } \leq 1 / ( 2 L )$ for any $m _ { s } < i <$
418
+ 275 $t _ { s + 1 }$ . Telescoping (6.6) from $i = m _ { s } + 1$ to $t _ { s + 1 } - 1$ , we have
419
+
420
+ $$
421
+ F ( \mathbf { x } _ { t _ { s + 1 } } ) \leq F ( \mathbf { x } _ { m _ { s } + 1 } ) + 4 \eta _ { H } \log ( 4 / \delta ) ( t _ { s + 1 } - m _ { s } - 1 ) \frac { \sigma ^ { 2 } } { B } - \frac { 1 } { 4 \eta _ { H } } \sum _ { i = m _ { s } + 1 } ^ { t _ { s + 1 } - 1 } \| \mathbf { x } _ { i + 1 } - \mathbf { x } _ { i } \| _ { 2 } ^ { 2 } .
422
+ $$
423
+
424
+ 276 Finally, we have
425
+
426
+ $$
427
+ \begin{array} { r l } & { \displaystyle { F ( \mathbf { x } _ { m _ { s } + 1 } ) - F ( \mathbf { x } _ { t _ { s + 1 } } ) \geq \sum _ { i = m _ { s } + 1 } ^ { t _ { s + 1 } - 1 } \frac { \| \mathbf { x } _ { i + 1 } - \mathbf { x } _ { i } \| _ { 2 } ^ { 2 } } { 4 \eta _ { H } } - 4 \log ( 4 / \delta ) ( t _ { s + 1 } - m _ { s } - 1 ) \eta _ { H } \frac { \sigma ^ { 2 } } { B } } } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad = ( t _ { s + 1 } - m _ { s } - 1 ) \bigg ( \frac { \overline { { D } } } { 4 \eta _ { H } } - \frac { 4 \log ( 4 / \delta ) \eta _ { H } \sigma ^ { 2 } } { B } \bigg ) } \\ & { \quad \quad \quad \quad \quad = ( t _ { s + 1 } - m _ { s } - 1 ) \bigg ( \frac { \sigma ^ { 2 } } { 1 6 \eta _ { H } B L ^ { 2 } } - \frac { 4 \log ( 4 / \delta ) \eta _ { H } \sigma ^ { 2 } } { B } \bigg ) } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \geq ( t _ { s + 1 } - m _ { s } - 1 ) \frac { 4 \log ( 4 / \delta ) \eta _ { H } \sigma ^ { 2 } } { B } , } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \end{array}
428
+ $$
429
+
430
+ where the last inequality is by the choice of 277 $\eta _ { H } \leq 1 / \big ( L \sqrt { 1 2 8 \log ( 4 / \delta ) } \big )$ . For $i = m _ { s }$ , we have (See 278 Lemma D.2)
431
+
432
+ $$
433
+ F ( \mathbf { x } _ { m _ { s } + 1 } ) \leq F ( \mathbf { x } _ { m _ { s } } ) + ( \| \mathbf { d } _ { m _ { s } } \| _ { 2 } + \| \epsilon _ { m _ { s } } \| _ { 2 } + L r / 2 ) r .
434
+ $$
435
+
436
+ Plugging 279 $\| \mathbf { d } _ { m _ { s } } \| _ { 2 } \leq \epsilon$ and $\| \epsilon _ { m _ { s } } \| _ { 2 } \le \epsilon / 2$ into (6.8) gives,
437
+
438
+ $$
439
+ F ( \mathbf { x } _ { m _ { s } + 1 } ) \leq F ( \mathbf { x } _ { m _ { s } } ) + ( 4 \epsilon + L r / 2 ) r \leq F ( \mathbf { x } _ { m _ { s } } ) + \frac { 2 \log ( 4 / \delta ) \eta _ { H } \sigma ^ { 2 } } { B } ,
440
+ $$
441
+
442
+ where the last inequality is by the choice 280 $r \leq \operatorname* { m i n } \big \{ \log ( 4 / \delta ) \eta _ { H } \sigma ^ { 2 } / ( 2 B \epsilon ) , \sqrt { 2 \log ( 4 / \delta ) \eta _ { H } \sigma ^ { 2 } / ( B L ) } \big \} .$ 281 Combining (6.7) and (6.9) and applying $t _ { s + 1 } - m _ { s } \geq 2$ gives,
443
+
444
+ $$
445
+ F ( \mathbf { x } _ { m _ { s } } ) - F ( \mathbf { x } _ { t _ { s + 1 } } ) \geq [ 4 ( t _ { s + 1 } - m _ { s } - 1 ) - 2 ] \frac { \log ( 4 / \delta ) \eta _ { H } \sigma ^ { 2 } } { B } \geq ( t _ { s + 1 } - m _ { s } ) \frac { \log ( 4 / \delta ) \eta _ { H } \sigma ^ { 2 } } { B } .
446
+ $$
447
+
448
+ Now, we can provide the proof of Theorem 5.1 .
449
+
450
+ Proof of Theorem 5.1. The analysis can be divided into two phases, i.e., GD phase and Escape phase.
451
+ The function value will decrease at different rates in different phases.
452
+
453
+ GD phase: In this phase, $\| \mathbf { d } _ { t } \| _ { 2 } \geq \epsilon$ and $\| \epsilon \| _ { 2 } \le \epsilon / 2$ due to Lemma 6.1. Thus the gradients of the function are large $\| \nabla F ( \mathbf { x } ) \| _ { 2 } \ge \epsilon / 2$ . Lemma 6.2 further shows that the loss decreases by at least $\sigma \epsilon / ( 1 6 \sqrt { B } L )$ on average.
454
+
455
+ Escape phase: In this phase, the starting point $\mathbf { x } _ { m _ { s } }$ satisfies $\| \nabla F ( { \mathbf { x } } _ { m _ { s } } ) \| _ { 2 } \leq \| { \mathbf { d } } _ { m _ { s } } \| _ { 2 } + \| \epsilon _ { t } \| _ { 2 } \leq 2 \epsilon$ If $\mathbf { x } _ { m _ { s } }$ is a saddle point with $\lambda _ { \operatorname* { m i n } } ( \nabla ^ { 2 } \bar { F } ( \mathbf x _ { m _ { s } } ) ) \leq - \epsilon _ { H }$ , then by Lemma 6.3, with high probability Pullback-SPIDER will break Escape phase, set $\mathrm { F I N D }$ False and begin a new GD phase. Further by Lemma 6.4, the loss will decrease by at least $\log ( 4 / \delta ) \eta _ { H } \sigma ^ { 2 } / B$ per step on average.
456
+
457
+ Sample Complexity: Note that the total amount for function value can decrease is at most $\Delta =$ $F ( \mathbf { x } _ { 0 } ^ { - } ) - \mathrm { i n f } _ { \mathbf { x } } ^ { - } F ( \mathbf { x } ) < + \infty$ . So the algorithm must end and find an $( \epsilon , \epsilon _ { H } )$ -approximate local minimum within $\widetilde O ( \sqrt { B } L \Delta \sigma ^ { - 1 } \epsilon ^ { - 1 } + B L \Delta \sigma ^ { - 2 } )$ iterations. Notice that on average we sample $\operatorname* { m a x } \{ b , B / q \} = \sqrt { B }$ examples per iteration, so the total sample complexity is $\widetilde { \cal O } ( B L \Delta \sigma ^ { - 1 } \epsilon ^ { - 1 } +$ $B ^ { 3 / 2 } L \Delta \sigma ^ { - 2 } )$ . Plugging in the choice of $B = \widetilde O ( \sigma ^ { 2 } \epsilon ^ { - 2 } + \sigma ^ { 2 } \rho ^ { 2 } \epsilon _ { H } ^ { - 4 } )$ in Theorem 5.1, we have the total gradient complexity
458
+
459
+ $$
460
+ \widetilde { \cal O } \biggl ( { \frac { \sigma L \Delta } { \epsilon ^ { 3 } } } + { \frac { \sigma \rho ^ { 2 } L \Delta } { \epsilon \epsilon _ { H } ^ { 4 } } } + { \frac { \sigma \rho ^ { 3 } L \Delta } { \epsilon _ { H } ^ { 6 } } } \biggr ) = \widetilde { \cal O } \biggl ( { \frac { \sigma L \Delta } { \epsilon ^ { 3 } } } + { \frac { \sigma \rho ^ { 3 } L \Delta } { \epsilon _ { H } ^ { 6 } } } \biggr ) ,
461
+ $$
462
+
463
+ where the equation is due to the Young’s inequality.
464
+
465
+ # 7 Conclusions
466
+
467
+ In this paper, we propose a perturbed stochastic gradient framework named Pullback for finding local minima. Pullback can find $( \epsilon , \epsilon _ { H } )$ -approximate local minima within $\widetilde { \cal O } ( \epsilon ^ { - 3 } + \epsilon _ { H } ^ { - 6 } )$ stochastic√ gradient evaluations, which matches the best possible complexity results in the classical $\epsilon _ { H } = \sqrt { \epsilon }$ setting. Our results show that simple perturbed gradient methods can be as efficient as more sophisticated algorithms for finding local minima.
468
+
469
+ 07 References
470
+ 08 [1] Allen-Zhu, Z. (2018). Natasha 2: Faster non-convex optimization than sgd. In Advances in neural information processing systems, pages 2675–2686.
471
+ 310 [2] Allen-Zhu, Z. and Hazan, E. (2016). Variance reduction for faster non-convex optimization. In International Conference on Machine Learning, pages 699–707.
472
+ 12 [3] Allen-Zhu, Z. and Li, Y. (2018). Neon2: Finding local minima via first-order oracles. In Advances in Neural Information Processing Systems, pages 3716–3726.
473
+ 14 [4] Arjevani, Y., Carmon, Y., Duchi, J. C., Foster, D. J., Sekhari, A., and Sridharan, K. (2020). Second-order information in non-convex stochastic optimization: Power and limitations. In Conference on Learning Theory, pages 242–299. PMLR.
474
+ 17 [5] Bhojanapalli, S., Neyshabur, B., and Srebro, N. (2016). Global optimality of local search for low rank matrix recovery. arXiv preprint arXiv:1605.07221.
475
+ 319 [6] Cutkosky, A. and Orabona, F. (2019). Momentum-based variance reduction in non-convex sgd. In Advances in Neural Information Processing Systems, pages 15210–15219. [7] Daneshmand, H., Kohler, J., Lucchi, A., and Hofmann, T. (2018). Escaping saddles with stochastic gradients. arXiv preprint arXiv:1803.05999.
476
+ 23 [8] Du, S. S., Jin, C., Lee, J. D., Jordan, M. I., Poczos, B., and Singh, A. (2017). Gradient descent can take exponential time to escape saddle points. arXiv preprint arXiv:1705.10412.
477
+ 25 [9] Fang, C., Li, C. J., Lin, Z., and Zhang, T. (2018). Spider: Near-optimal non-convex optimization via stochastic path-integrated differential estimator. In Advances in Neural Information Processing Systems, pages 689–699.
478
+ 28 [10] Ge, R., Huang, F., Jin, C., and Yuan, Y. (2015). Escaping from saddle points—online stochastic gradient for tensor decomposition. In Conference on Learning Theory, pages 797–842.
479
+ 30 [11] Ge, R., Jin, C., and Zheng, Y. (2017). No spurious local minima in nonconvex low rank problems: A unified geometric analysis. In International Conference on Machine Learning, pages 1233–1242. PMLR.
480
+ 33 [12] Hillar, C. J. and Lim, L.-H. (2013). Most tensor problems are np-hard. Journal of the ACM (JACM), 60(6):1–39.
481
+ 35 [13] Jin, C., Ge, R., Netrapalli, P., Kakade, S. M., and Jordan, M. I. (2017). How to escape saddle points efficiently. In International Conference on Machine Learning, pages 1724–1732. PMLR.
482
+ 37 [14] Johnson, R. and Zhang, T. (2013). Accelerating stochastic gradient descent using predictive variance reduction. In Advances in Neural Information Processing Systems, pages 315–323.
483
+ 39 [15] Kallenberg, O. and Sztencel, R. (1991). Some dimension-free features of vector-valued martingales. Probability Theory and Related Fields, 88(2):215–247.
484
+ 341 [16] Lei, L., Ju, C., Chen, J., and Jordan, M. I. (2017). Non-convex finite-sum optimization via scsg methods. In Advances in Neural Information Processing Systems, pages 2348–2358.
485
+ 43 [17] Li, Z. (2019). Ssrgd: Simple stochastic recursive gradient descent for escaping saddle points. In Advances in Neural Information Processing Systems, pages 1521–1531.
486
+ 45 [18] Li, Z., Bao, H., Zhang, X., and Richtárik, P. (2020). Page: A simple and optimal probabilistic gradient estimator for nonconvex optimization. arXiv preprint arXiv:2008.10898.
487
+ 47 [19] Nesterov, Y. (1998). Introductory lectures on convex programming volume i: Basic course. Lecture notes, 3(4):5.
488
+ 49 [20] Nesterov, Y. and Polyak, B. T. (2006). Cubic regularization of newton method and its global performance. Mathematical Programming, 108(1):177–205.
489
+ [21] Nguyen, L. M., Liu, J., Scheinberg, K., and Takác, M. (2017a). Sarah: A novel method for ˇ machine learning problems using stochastic recursive gradient. In International Conference on Machine Learning, pages 2613–2621. PMLR.
490
+ [22] Nguyen, L. M., Liu, J., Scheinberg, K., and Takác, M. (2017b). Stochastic recursive gradient ˇ algorithm for nonconvex optimization. arXiv preprint arXiv:1705.07261.
491
+ [23] Pham, N. H., Nguyen, L. M., Phan, D. T., and Tran-Dinh, Q. (2020). Proxsarah: An efficient algorithmic framework for stochastic composite nonconvex optimization. Journal of Machine Learning Research, 21(110):1–48.
492
+ [24] Pinelis, I. (1994). Optimum bounds for the distributions of martingales in banach spaces. The Annals of Probability, pages 1679–1706.
493
+ [25] Reddi, S. J., Hefny, A., Sra, S., Poczos, B., and Smola, A. (2016). Stochastic variance reduction for nonconvex optimization. In International Conference on Machine Learning, pages 314–323.
494
+ [26] Tran-Dinh, Q., Pham, N. H., Phan, D. T., and Nguyen, L. M. (2019). Hybrid stochastic gradient descent algorithms for stochastic nonconvex optimization. arXiv preprint arXiv:1905.05920.
495
+ [27] Wang, Z., Ji, K., Zhou, Y., Liang, Y., and Tarokh, V. (2019). Spiderboost and momentum: Faster variance reduction algorithms. Advances in Neural Information Processing Systems, 32:2406– 2416.
496
+ [28] Xiao, L. and Zhang, T. (2014). A proximal stochastic gradient method with progressive variance reduction. SIAM Journal on Optimization, 24(4):2057–2075.
497
+ [29] Xu, Y., Jin, R., and Yang, T. (2017). First-order stochastic algorithms for escaping from saddle points in almost linear time. arXiv preprint arXiv:1711.01944.
498
+ [30] Zhou, D., Xu, P., and Gu, Q. (2018). Stochastic nested variance reduction for nonconvex optimization. Advances in Neural Information Processing Systems, 31:3921–3932.
499
+ [31] Zhou, D., Xu, P., and Gu, Q. (2020). Stochastic nested variance reduction for nonconvex optimization. Journal of machine learning research.
500
+
501
+ 1. For all authors...
502
+
503
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
504
+ (b) Did you describe the limitations of your work? [Yes] We note in Remark 5.2 that there is a gap in the dependency of $\epsilon _ { H }$ between our result and the lower bound. We will explore this in future work.
505
+ (c) Did you discuss any potential negative societal impacts of your work? [N/A] Our work studies the theoretical aspect of optimization algorithms, thus it does not have any negative social impact.
506
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
507
+
508
+ 2. If you are including theoretical results...
509
+
510
+ (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]
511
+
512
+ 3. If you ran experiments...
513
+
514
+ (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [N/A]
515
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [N/A]
516
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [N/A]
517
+ (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [N/A]
518
+
519
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
520
+
521
+ (a) If your work uses existing assets, did you cite the creators? [N/A]
522
+ (b) Did you mention the license of the assets? [N/A]
523
+ (c) Did you include any new assets either in the supplemental material or as a URL? [N/A]
524
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
525
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
526
+
527
+ 5. If you used crowdsourcing or conducted research with human subjects...
528
+
529
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
530
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
531
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
md/train/pBKOx_dxYAN/pBKOx_dxYAN.md ADDED
@@ -0,0 +1,288 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SNIPS: Solving Noisy Inverse Problems Stochastically
2
+
3
+ Bahjat Kawar, Gregory Vaksman, Michael Elad Computer Science Department, Technion, Haifa, Israel {bahjat.kawar, grishav, elad}@cs.technion.ac.il
4
+
5
+ # Abstract
6
+
7
+ In this work we introduce a novel stochastic algorithm dubbed SNIPS, which draws samples from the posterior distribution of any linear inverse problem, where the observation is assumed to be contaminated by additive white Gaussian noise. Our solution incorporates ideas from Langevin dynamics and Newton’s method, and exploits a pre-trained minimum mean squared error (MMSE) Gaussian denoiser. The proposed approach relies on an intricate derivation of the posterior score function that includes a singular value decomposition (SVD) of the degradation operator, in order to obtain a tractable iterative algorithm for the desired sampling. Due to its stochasticity, the algorithm can produce multiple high perceptual quality samples for the same noisy observation. We demonstrate the abilities of the proposed paradigm for image deblurring, super-resolution, and compressive sensing. We show that the samples produced are sharp, detailed and consistent with the given measurements, and their diversity exposes the inherent uncertainty in the inverse problem being solved.
8
+
9
+ # 1 Introduction
10
+
11
+ Many problems in the field of image processing can be cast as noisy linear inverse problems. This family of tasks includes denoising, inpainting, deblurring, super resolution, compressive sensing, and many other image recovery problems. A general linear inverse problem is posed as
12
+
13
+ $$
14
+ \mathbf { y } = \mathbf { H } \mathbf { x } + \mathbf { z } ,
15
+ $$
16
+
17
+ where we aim to recover a signal $\mathbf { x }$ from its measurement $\mathbf { y }$ , given through a linear degradation operator $\mathbf { H }$ and a contaminating noise, being additive, white and Gaussian, $\mathbf { \overline { { z } } } \sim \mathcal { N } \left( 0 , \sigma _ { 0 } ^ { 2 } \mathbf { \check { I } } \right)$ . In this work we assume that both $\mathbf { H }$ and $\sigma _ { 0 }$ are known.
18
+
19
+ Over the years, many strategies, algorithms and underlying statistical models were developed for handling image restoration problems. A key ingredient in many of the classic attempts is the prior that aims to regularize the inversion process and lead to visually pleasing results. Among the various options explored, we mention sparsity-inspired techniques [13, 55, 11], local Gaussian-mixture modeling [57, 63], and methods relying on non-local self-similarity [6, 9, 36, 51]. More recently, and with the emergence of deep learning techniques, a direct design of the recovery path from y to an estimate of $\mathbf { x }$ took the lead, yielding state-of-the-art results in various linear inverse problems, such as denoising [25, 59, 61, 52], deblurring [22, 48], super resolution [10, 17, 54] and other tasks [29, 28, 19, 16, 37, 58].
20
+
21
+ Despite the evident success of the above techniques, many image restoration algorithms still have a critical shortcoming: In cases of severe degradation, most recovery algorithms tend to produce washed out reconstructions that lack details. Indeed, most image restoration techniques seek a reconstruction that minimizes the mean squared error between the restored image, ˆx, and the unknown original one, x. When the degradation is acute and information is irreversibly lost, image reconstruction becomes a highly ill-posed problem, implying that many possible clean images could explain the given measurements. The MMSE solution averages all these candidate solutions, being the conditional mean of the posterior of $\mathbf { x }$ given y, leading to an image with loss of fine details in the majority of practical cases. A recent work reported in [5] has shown that reconstruction algorithms necessarily suffer from a perception-distortion tradeoff, i.e., targeting a minimization of the error between $\hat { \bf x }$ and $\mathbf { x }$ (in any metric) is necessarily accompanied by a compromised perceptual quality. As a consequence, as long as we stick to the tendency to design recovery algorithms that aim for minimum MSE (or other distances), only a limited perceptual improvement can be expected.
22
+
23
+ When perceptual quality becomes our prime objective, the strategy for solving inverse problems must necessarily change. More specifically, the solution should concentrate on producing a sample (or many of them) from the posterior distribution $p \left( \mathbf { x } | \mathbf { y } \right)$ instead of its conditional mean. Recently, two such approaches have been suggested – GAN-based and Langevin sampling. Generative Adversarial Networks (GANs) have shown impressive results in generating realistically looking images (e.g., [14, 35]). GANs can be utilized for solving inverse problems while producing high-quality images (see e.g. [2, 31, 34]). These solvers aim to produce a diverse set of output images that are consistent with the measurements, while also being aligned with the distribution of clean examples. A major disadvantage of GAN-based algorithms for inverse problems is their tendency (as practiced in [2, 31, 34]) to assume noiseless measurements, a condition seldom met in practice. An exception to this is the work reported in [33], which adapts a conditional GAN to become a stochastic denoiser.
24
+
25
+ The second approach for sampling from the posterior, and the one we shall be focusing on in this paper, is based on Langevin dynamics. This core iterative technique enables sampling from a given distribution by leveraging the availability of the score function – the gradient of the log of the probability density function [38, 3]. The work reported in [44, 20, 46] utilizes the annealed Langevin dynamics method, both for image synthesis and for solving noiseless inverse problems.1 Their synthesis algorithm relies on an MMSE Gaussian denoiser (given as a neural network) for approximating a gradually blurred score function. In their treatment of inverse problems, the conditional score remains tractable and manageable due to the noiseless measurements assumption.
26
+
27
+ The question addressed in this paper is the following: How can the above line of Langevin-based work be generalized for handling linear inverse problems, as in Equation 1, in which the measurements are noisy? A partial and limited answer to this question has already been given in [21] for the tasks of image denoising and inpainting. The present work generalizes these ([44, 20, 46, 21]) results, and introduces a systematic way for sampling from the posterior distribution of any given noisy linear inverse problem. As we carefully show, this extension is far from being trivial, due to two prime reasons: (i) The involvement of the degradation operator H, which poses a difficulty for establishing a relationship between the reconstructed image and the noisy observation; and (ii) The intricate connection between the measurements’ and the synthetic annealed Langevin noise. Our proposed remedy is a decorrelation of the measurements equation via a singular value decomposition (SVD) of the operator H, which decouples the dependencies between the measurements, enabling each to be addressed by an adapted iterative process. In addition, we define the annealing noise to be built as portions of the measurement noise itself, in a manner that facilitates a constructive derivation of the conditional score function.
28
+
29
+ Following earlier work [44, 20, 46, 21], our algorithm is initialized with a random noise image, gradually converging to the reconstructed result, while following the direction of the log-posterior gradient, estimated using an MMSE denoiser. Via a careful construction of the gradual annealing noise sequence, from very high values to low ones, the entries in the derived score switch mode. Those referring to non-zero singular values start by being purely dependent on the measurements, and then transition to incorporate prior information based on the denoiser. As for entries referring to zero singular values, their corresponding entries undergo a pure synthesis process based on the prior-only score function. Note that the denoiser blends values in the evolving sample, thus intermixing the influence of the gradient entries. Our derivations include an analytical expression for a positiondependent step size vector, drawing inspiration from Newton’s method in optimization. This stabilizes the algorithm and is shown to be essential for its success.
30
+
31
+ We refer hereafter to our algorithm as SNIPS (Solution of Noisy Inverse Problems Stochastically). Observe that as we target to sample from the posterior distribution $p \left( \mathbf { x } | \mathbf { y } \right)$ , different runs of SNIPS on the same input necessarily yield different results, all of which valid solutions to the given inverse problem. This should not come as a surprise, as ill-posedness implies that there are multiple viable solutions for the same data, as has already been suggested in the context of super resolution [31, 2, 34]. We demonstrate SNIPS on image deblurring, single image super resolution, and compressive sensing, all of which contain non-negligible noise, and emphasize the high perceptual quality of the results, their diversity, and their relation to the MMSE estimate.
32
+
33
+ ![](images/c82146786b5adb3c31fe1fe0e0cc72d1662774fbb84d513189a447eec3bd7cf3.jpg)
34
+ Figure 1: Deblurring results on CelebA [27] images (uniform $5 \times 5$ blur and an additive noise with $\sigma _ { 0 } = 0 . 1$ ). Here and in all other shown figures, the standard deviation image is scaled by 4 for better visual inspection.
35
+
36
+ To summarize, this paper’s contributions are threefold:
37
+
38
+ • We present an intricate derivation of the blurred posterior score function for general noisy inverse problems, where both the measurement and the target image contain delicately inter-connected additive white Gaussian noise. • We introduce a novel stochastic algorithm – SNIPS – that can sample from the posterior distribution of these problems. The algorithm relies on the availability of an MMSE denoiser. • We demonstrate impressive results of SNIPS on image deblurring, single image super resolution, and compressive sensing, all of which are highly noisy and ill-posed.
39
+
40
+ Before diving into the details of this work, we should mention that using Gaussian denoisers iteratively for handling general linear inverse problems has been already proposed in the context of the Plugand-Play-Prior $( \mathrm { P n P } )$ method [53] and RED [39], and their many followup papers (e.g., [60, 30, 1, 49, 7, 50, 40, 4]). However, both PnP and RED are quite different from our work, as they do not target sampling from the posterior, but rather focus on MAP or MMSE estimation.
41
+
42
+ # 2 Background
43
+
44
+ The Langevin dynamics algorithm [3, 38] suggests sampling from a probability distribution $p \left( \mathbf { x } \right)$ using the iterative transition rule
45
+
46
+ $$
47
+ { \bf x } _ { t + 1 } = { { \bf x } _ { t } } + \alpha \nabla _ { { \bf x } _ { t } } \log p \left( { { \bf x } _ { t } } \right) + \sqrt { 2 \alpha } { \bf z } _ { t } \mathrm { ~ , ~ }
48
+ $$
49
+
50
+ where $\mathbf { z } _ { t } \sim \mathcal { N } ( 0 , \mathbf { I } )$ and $\alpha$ is an appropriately chosen small constant. The added $\mathbf { z } _ { t }$ allows for stochastic sampling, avoiding a collapse to a maximum of the distribution. Initialized randomly, after a sufficiently large number of iterations, and under some mild conditions, this process converges to a sample from the desired distribution $p \left( \mathbf { x } \right)$ [38].
51
+
52
+ The work reported in [44] extends the aforementioned algorithm into annealed Langevin dynamics. The annealing proposed replaces the score function in Equation 2 with a blurred version of it, $\nabla _ { \tilde { \mathbf { x } } _ { t } } \log { p \left( \tilde { \mathbf { x } } _ { t } \right) }$ , where $\tilde { \mathbf { x } } _ { \mathbf { t } } = \mathbf { x } _ { t } + \mathbf { n }$ and $\mathbf { n } \sim { \mathcal { N } } \left( 0 , \sigma ^ { 2 } \mathbf { I } \right)$ is a synthetically injected noise. The core idea is to start with a very high noise level $\sigma$ and gradually drop it to near-zero, all while using a step size $\alpha$ dependent on the noise level. These changes allow the algorithm to converge much faster and perform better, because it widens the basin of attraction of the sampling process. The work in [20] further develops this line of work by leveraging a brilliant relation attributed to Miyasawa [32] (also known as Stein’s integration by parts trick [47] or Tweedie’s identity [12]). It is given as
53
+
54
+ $$
55
+ { \nabla } _ { \tilde { \mathbf { x } } _ { t } } \log p \left( \tilde { \mathbf { x } } _ { t } \right) = \frac { \mathbf { D } \left( \tilde { \mathbf { x } } _ { t } , \sigma \right) - \tilde { \mathbf { x } } _ { t } } { { \sigma } ^ { 2 } } ,
56
+ $$
57
+
58
+ where $\mathbf { D } \left( \tilde { \mathbf { x } } _ { t } , \sigma \right) = \mathbb { E } \left[ \mathbf { x } | \tilde { \mathbf { x } } _ { t } \right]$ is the minimizer of the MSE measure $\mathbb { E } \left[ \lVert \mathbf { x } - \mathbf { D } \left( \tilde { \mathbf { x } } _ { t } , \sigma \right) \rVert _ { 2 } ^ { 2 } \right]$ , which can be approximated using a denoising neural network. This facilitates the use of denoisers in Langevin dynamics as a replacement for the evasive score function.
59
+
60
+ When turning to solve inverse problems, previous work suggests sampling from the posterior distribution $p \left( \mathbf { x } | \mathbf { y } \right)$ using annealed Langevin dynamics [20, 46, 21] or similar methods [15, 18, 42, 26], by replacing the score function used in the generation algorithm with a conditional one. As it turns out, if limiting assumptions can be posed on the measurements formation, the conditional score is tractable, and thus generalization of the annealed Langevin process to these problems is within reach. Indeed, in [44, 20, 46, 42, 26] the core assumption is $\mathbf { y } = \mathbf { H } \mathbf { x }$ for specific and simplified choices of $\mathbf { H }$ and with no noise in the measurements. The works in [15, 23] avoid these difficulties altogether by returning to the original (non-annealed) Langevin method, with the unavoidable cost of becoming extremely slow. In addition, their algorithms are demonstrated on inverse problems in which the additive noise is restricted to be very weak. The work in [21] is broader, allowing for an arbitrary additive white Gaussian noise, but limits $\mathbf { H }$ to the problems of denoising or inpainting. While all these works demonstrate high quality results, there is currently no clear way for deriving the blurred score function of a general linear inverse problem as posed in Equation 1. In the following, we present such a derivation.
61
+
62
+ # 3 The Proposed Approach: Deriving the Conditional Score Function
63
+
64
+ # 3.1 Problem Setting
65
+
66
+ We consider the problem of recovering a signal $\mathbf { x } \in \mathbb { R } ^ { N }$ (where $\mathbf { x } \sim p \left( \mathbf { x } \right)$ and $p \left( \mathbf { x } \right)$ is unknown) from the observation $\mathbf { y } = \mathbf { H } \mathbf { x } + \mathbf { z }$ , where $\mathbf { y } \in \mathbb { R } ^ { M } , \mathbf { H } \in \mathbb { R } ^ { M \times N } , M \leq N , \mathbf { z } \sim \mathcal { N } \left( 0 , \sigma _ { 0 } ^ { 2 } \mathbf { I } \right)$ , and $\mathbf { H }$ and $\sigma _ { 0 }$ are known.2 Our ultimate goal is to sample from the posterior $p \left( \mathbf { x } | \mathbf { y } \right)$ . However, since access to the score function $\nabla _ { \mathbf { x } } \log p ( \mathbf { x } | \mathbf { y } )$ is not available, we retarget our goal, as explained above, to sampling from blurred posterior distributions, $p \left( \tilde { \mathbf { x } } | \mathbf { y } \right)$ , where $\tilde { \mathbf { x } } = \mathbf { x } + \mathbf { n }$ and $\mathbf { n } \sim { \mathcal { N } } \left( 0 , \sigma ^ { 2 } \mathbf { I } \right)$ , with noise levels $\sigma$ starting very high, and decreasing towards near-zero.
67
+
68
+ As explained in the supplemental material, the sampling should be performed in the SVD domain in order to get a tractable derivation of the blurred score function. Thus, we consider the singular value decomposition (SVD) of $\mathbf { H }$ , given as $\mathbf { H } = \mathbf { U } \pmb { \Sigma } \mathbf { V } ^ { T }$ , where $\mathbf { U } \in \mathbb { R } ^ { M \times M }$ and $\mathbf { V } \in \mathbb { R } ^ { N \times N }$ are orthogonal matrices, and $\pmb { \Sigma } \in \mathbb { R } ^ { M \times N }$ is a rectangular diagonal matrix containing the singular values of H, denoted as {sj}Mj=1 i n descending order $\quad : s _ { 1 } > s _ { 2 } > \dots > s _ { M - 1 } > s _ { M } \geq 0 \quad$ ). For convenience of notations, we also define $s _ { j } = 0$ for $j = M + 1 , \dotsc , N$ . To that end, we notice that
69
+
70
+ $$
71
+ p \left( \tilde { \mathbf { x } } | \mathbf { y } \right) = p \left( \tilde { \mathbf { x } } | \mathbf { U } ^ { T } \mathbf { y } \right) = p \left( \mathbf { V } ^ { T } \tilde { \mathbf { x } } | \mathbf { U } ^ { T } \mathbf { y } \right) .
72
+ $$
73
+
74
+ The first equality holds because the multiplication of $\mathbf { y }$ by the orthogonal matrix $\mathbf { U } ^ { T }$ does not add or remove information, and the second equality holds because the multiplication of $\tilde { \bf x }$ by $\mathbf { V } ^ { T }$ does not change its probability [24]. Therefore, sampling from $p \left( \mathbf { V } ^ { T } \tilde { \mathbf { x } } | \mathbf { U } ^ { T } \mathbf { y } \right)$ and then multiplying the result by $\mathbf { V }$ will produce the desired sample from $p \left( \mathbf { \tilde { x } } | \mathbf { y } \right)$ . As we are using Langevin dynamics, we need to calculate the conditional score function $\nabla _ { \mathbf { V } ^ { T } \widetilde { \mathbf { x } } } \log p \left( \mathbf { V } ^ { T } \widetilde { \mathbf { x } } | \mathbf { U } ^ { T } \mathbf { y } \right)$ . For simplicity, we denote hereafter ${ \bf y } _ { T } = { \bf U } ^ { T } { \bf y } , { \bf z } _ { T } = { \bf U } ^ { T } { \bf z } , { \bf x } _ { T } = { \bf V } ^ { T } { \bf x } , { \bf n } _ { T } = \Sigma { \bf V } ^ { T } { \bf n }$ , and $\tilde { \mathbf { x } } _ { T } = \mathbf { V } ^ { T } \tilde { \mathbf { x } }$ . Observe that with these notations, the measurements equation becomes
75
+
76
+ $$
77
+ \mathbf { y } = \mathbf { H } \mathbf { x } + \mathbf { z } = \mathbf { U } \pmb { \Sigma } \mathbf { V } ^ { T } \mathbf { x } + \mathbf { z } ,
78
+ $$
79
+
80
+ and thus
81
+
82
+ $$
83
+ \mathbf { U } ^ { T } \mathbf { y } = \Sigma \mathbf { V } ^ { T } \mathbf { x } + \mathbf { U } ^ { T } \mathbf { z } = \Sigma \mathbf { V } ^ { T } ( \tilde { \mathbf { x } } - \mathbf { n } ) + \mathbf { U } ^ { T } \mathbf { z } = \Sigma \mathbf { V } ^ { T } \tilde { \mathbf { x } } - \Sigma \mathbf { V } ^ { T } \mathbf { n } + \mathbf { U } ^ { T } \mathbf { z } ,
84
+ $$
85
+
86
+ where we have relied on the relation $\tilde { \mathbf { x } } = \mathbf { x } + \mathbf { n }$ . This leads to
87
+
88
+ $$
89
+ { \bf y } _ { T } = \pmb { \Sigma } \tilde { \bf x } _ { T } - { \bf n } _ { T } + { \bf z } _ { T } .
90
+ $$
91
+
92
+ In this formulation, which will aid in deriving the conditional score, our aim is to make design choices on ${ \bf n } _ { T }$ such that ${ \bf z } _ { T } - { \bf n } _ { T }$ has uncorrelated entries and is independent of $\tilde { \bf x } _ { T }$ . This brings us to the formation of the synthetic annealed noise, which is an intricate ingredient in our derivations.
93
+
94
+ We base this formation on the definition of a sequence of noise levels $\{ \sigma _ { i } \} _ { i = 1 } ^ { L + 1 }$ such that $\sigma _ { 1 } > \sigma _ { 2 } > \cdot \cdot \cdot > \sigma _ { L } > \sigma _ { L + 1 } = 0$ , where $\sigma _ { 1 }$ is high (possibly $\sigma _ { 1 } > \| \mathbf { x } \| _ { \infty } )$ and $\sigma _ { L }$ is close to zero. We require that for every $j$ such that $s _ { j } \neq 0$ , there exists $i _ { j }$ such that $\sigma _ { i _ { j } } s _ { j } < \sigma _ { 0 }$ and $\sigma _ { i _ { j } - 1 } s _ { j } > \sigma _ { 0 }$ . This implies $\forall i : \sigma _ { i } s _ { j } \neq \sigma _ { 0 }$ , which helps ease notations. SNIPS works just as well for $\sigma _ { i } s _ { j } = \sigma _ { 0 }$ .
95
+
96
+ Using $\{ \sigma _ { i } \} _ { i = 1 } ^ { L + 1 }$ , we would like to define $\left\{ \tilde { \mathbf { x } } _ { i } \right\} _ { i = 1 } ^ { L + 1 }$ , a sequence of noisy versions of $\mathbf { x }$ , where the noise level in $\tilde { \mathbf { x } } _ { i }$ is $\sigma _ { i }$ . One might be tempted to define these noise additions as independent of the measurement noise $\mathbf { z }$ . However, this option leads to a conditional score term that cannot be calculated analytically, as explained in the supplemental material. Therefore, we define these noise additions differently, as carved from $\mathbf { z }$ in a gradual fashion. To that end, we define $\tilde { \mathbf { x } } _ { L + 1 } = \mathbf { x }$ , and for every $i = L , L - 1 , \ldots , 1 \colon \tilde { \mathbf { x } } _ { i } = \tilde { \mathbf { x } } _ { i + 1 } + \pmb { \eta } _ { i }$ , where $\pmb { \eta } _ { i } \sim \mathcal { N } \left( 0 , \left( \sigma _ { i } ^ { 2 } - \sigma _ { i + 1 } ^ { 2 } \right) \mathbf { I } \right)$ . This results in $\tilde { \mathbf { x } } _ { i } = \mathbf { x } + \mathbf { n } _ { i }$ , where $\begin{array} { r } { \mathbf { n } _ { i } = \sum _ { k = i } ^ { L } \pmb { \eta } _ { k } \sim \mathcal { N } \left( 0 , \sigma _ { i } ^ { 2 } \mathbf { I } \right) } \end{array}$ .
97
+
98
+ And now we turn to define the statistical dependencies between the measurements’ noise $\mathbf { z }$ and the artificial noise vectors $\eta _ { i }$ . Since $\eta _ { i }$ and $\mathbf { z }$ are each Gaussian with uncorrelated entries, so are the components of the vectors $\pmb { \Sigma } \mathbf { V } ^ { T } \pmb { \eta } _ { i }$ , $\pmb { \Sigma } \mathbf { V } ^ { T } \mathbf { n } _ { i }$ , and $\mathbf { z } _ { T }$ . In order to proceed while easing notations, let us focus on a single entry $j$ in these three vectors, for which $s _ { j } > 0$ , and omit this index. We denote these entries as $\eta _ { T , i } , n _ { T , i }$ and $z _ { T }$ , respectively. We construct $\eta _ { T , i }$ such that
99
+
100
+ $$
101
+ \mathbb { E } \left[ \eta _ { T , i } \cdot z _ { T } \right] = \left\{ \begin{array} { l l } { \mathbb { E } \left[ \eta _ { T , i } ^ { 2 } \right] } & { \mathrm { f o r } i \geq i _ { j } } \\ { \mathbb { E } \left[ \left( z _ { T } - n _ { T , i _ { j } } \right) ^ { 2 } \right] } & { \mathrm { f o r } i = i _ { j } - 1 } \\ { 0 } & { \mathrm { o t h e r w i s e } . } \end{array} \right.
102
+ $$
103
+
104
+ This implies that the layers of noise $\eta _ { T , L + 1 } , \dots , \eta _ { T , i _ { j } }$ are all portions of $z _ { T }$ itself, with an additional portion being contained in $\eta _ { T , i _ { j } - 1 }$ . Afterwards, $\eta _ { T , i }$ become independent of $z _ { T }$ . In the case of $s _ { j } ~ = ~ 0$ , the above relations simplify to be $E [ \eta _ { T , i } \cdot z _ { T } ] = 0$ for all $i$ , implying no statistical dependency between the given and the synthetic noises. Consequently, it can be shown that the overall noise in Equation 5 satisfies
105
+
106
+ $$
107
+ \left( \Sigma \mathbf { V } ^ { T } \mathbf { n } _ { i } - \mathbf { z } _ { \mathbf { T } } \right) _ { j } = n _ { T , i } - z _ { T } \sim \left\{ \begin{array} { l l } { \mathcal { N } \left( 0 , s _ { j } ^ { 2 } \sigma _ { i } ^ { 2 } - \sigma _ { 0 } ^ { 2 } \right) } & { \mathrm { i f ~ } \sigma _ { i } s _ { j } > \sigma _ { 0 } } \\ { \mathcal { N } \left( 0 , \sigma _ { 0 } ^ { 2 } - s _ { j } ^ { 2 } \sigma _ { i } ^ { 2 } \right) } & { \mathrm { o t h e r w i s e . } } \end{array} \right.
108
+ $$
109
+
110
+ The top option refers to high values of the annealed Langevin noise, in which, despite the possible decay caused by the singular value $s _ { j }$ , this noise is stronger than $z _ { T }$ . In this case, $n _ { T , i }$ contains all $z _ { T }$ and an additional independent portion of noise. The bottom part assumes that the annealed noise (with the influence of $s _ { j }$ ) is weaker than the measurements’ noise, and then it is fully immersed within $z _ { T }$ , with the difference being Gaussian and independent.
111
+
112
+ # 3.2 Derivation of the Conditional Score Function
113
+
114
+ The above derivations show that the noise in Equation 5 is zero-mean, Gaussian with uncorrelated entries and of known variance, and this noise is independent of $\widetilde { \mathbf { x } } _ { i }$ . Thus Equation 5 can be used conveniently for deriving the measurements part of the conditional score function. We denote $\tilde { \mathbf { x } } _ { T } = \mathbf { V } ^ { T } \tilde { \mathbf { x } } _ { i }$ , $\widetilde { \mathbf { x } } = \widetilde { \mathbf { x } } _ { i }$ , $\mathbf { n } = \mathbf { n } _ { i }$ for simplicity, and turn to calculate $\nabla _ { \tilde { \mathbf { x } } _ { T } } \log p \left( \tilde { \mathbf { x } } _ { T } | \mathbf { y } _ { T } \right)$ . We split $\tilde { \mathbf { x } } _ { T }$ into three parts: (i) $\tilde { \mathbf { x } } _ { T , 0 }$ refers to the entries $j$ for which $s _ { j } = 0$ ; (ii) $\tilde { \mathbf { x } } _ { T , < }$ corresponds to the entries $j$ for which $0 < \sigma _ { i } s _ { j } < \sigma _ { 0 }$ ; and (iii) $\tilde { \mathbf { x } } _ { T , > }$ includes the entries $j$ for which $\sigma _ { i } s _ { j } ~ > ~ \sigma _ { 0 }$ . Observe that this partition of the entries of $\tilde { \bf x } _ { T }$ is non-overlapping and fully covering. Similarly, we partition every vector $\mathbf { v } \in \mathbb { R } ^ { N }$ into $\mathbf { v } _ { 0 } , \mathbf { v } _ { < } , \mathbf { v } _ { > }$ , which are the entries of $\mathbf { v }$ corresponding to $\tilde { \bf x } _ { T , 0 } , \tilde { \bf x } _ { T , < } , \tilde { \bf x } _ { T , > }$ , respectively. Furthermore, we define $\mathbf { v } _ { \boldsymbol { \phi } } , \mathbf { v } _ { \mathcal { A } } , \mathbf { v } _ { \mathcal { P } }$ as all the entries of $\mathbf { v }$ except $\mathbf { v } _ { 0 } , \mathbf { v } _ { < } , \mathbf { v } _ { > }$ , respectively. With these definitions in place, the complete derivation of the score function is detailed in the supplemental material, and here we bring the final outcome. For $\tilde { \mathbf { x } } _ { T , 0 }$ , the score is independent of the measurements and given by
115
+
116
+ $$
117
+ \nabla _ { \tilde { \mathbf { x } } _ { T , 0 } } \log p \left( \tilde { \mathbf { x } } _ { T } | \mathbf { y } _ { T } \right) = \left( \mathbf { V } ^ { T } \nabla _ { \tilde { \mathbf { x } } } \log p \left( \tilde { \mathbf { x } } \right) \right) _ { 0 } .
118
+ $$
119
+
120
+ For the case of $\tilde { \mathbf { x } } _ { T , > }$ , the expression obtained is only measurements-dependent,
121
+
122
+ $$
123
+ \nabla _ { \tilde { \mathbf { x } } _ { T , > } } \log p \left( \tilde { \mathbf { x } } _ { T } | \mathbf { y } _ { T } \right) = \left( \Sigma ^ { T } \left( \sigma _ { i } ^ { 2 } \Sigma \Sigma ^ { T } - \sigma _ { 0 } ^ { 2 } \mathbf { I } \right) ^ { \dagger } \left( \mathbf { y } _ { T } - \Sigma \tilde { \mathbf { x } } _ { T } \right) \right) _ { > } .
124
+ $$
125
+
126
+ ![](images/1bf7bf0fdb7b5ddbb342e405094746e2ae58288ea8fabffd3390f4076c6e4553.jpg)
127
+ Figure 2: Super resolution results on LSUN bedroom [56] images (downscaling $4 : 1$ by plain averaging and adding noise with $\sigma _ { 0 } = 0 . 0 4 \mathrm { , }$ ).
128
+
129
+ Lastly, for the case of $\tilde { \mathbf { x } } _ { T , < }$ , the conditional score includes two terms – one referring to the plain (blurred) score, and the other depending on the measurements,
130
+
131
+ $$
132
+ \nabla _ { \mathbf { \tilde { x } } _ { T , < } } \log p \left( \mathbf { \tilde { x } } _ { T } | \mathbf { y } _ { T } \right) = \left( \Sigma ^ { T } \left( \sigma _ { 0 } ^ { 2 } \mathbf { I } - \sigma _ { i } ^ { 2 } \Sigma \Sigma ^ { T } \right) ^ { \dagger } \left( \mathbf { y } _ { T } - \Sigma \mathbf { \tilde { x } } _ { T } \right) \right) _ { < } + \left( \mathbf { V } ^ { T } \nabla _ { \mathbf { \tilde { x } } } \log p \left( \mathbf { \tilde { x } } \right) \right) _ { < } .
133
+ $$
134
+
135
+ As already mentioned, the full derivations of equations 7, 8, and 9 are detailed in the supplemental material. Aggregating all these results together, we obtain the following conditional score function:
136
+
137
+ $$
138
+ \begin{array} { r } { \nabla _ { \tilde { \mathbf { x } } _ { T } } \log p \left( \tilde { \mathbf { x } } _ { T } | \mathbf { y } _ { T } \right) = \Sigma ^ { T } \left| \sigma _ { 0 } ^ { 2 } \mathbf { I } - \sigma _ { i } ^ { 2 } \Sigma \Sigma ^ { T } \right| ^ { \frac { 1 } { \rho } } \left( \mathbf { y } _ { T } - \Sigma \tilde { \mathbf { x } } _ { T } \right) + \left. \left( \mathbf { V } ^ { T } \nabla _ { \tilde { \mathbf { x } } } \log p \left( \tilde { \mathbf { x } } \right) \right) \right| _ { \mathcal { X } } , } \end{array}
139
+ $$
140
+
141
+ where $( \mathbf { v } ) | _ { \ngtr }$ is the vector $\mathbf { v }$ , but with zeros in its entries that correspond to $\mathbf { v } _ { > }$ . Observe that the first term in Equation 10 contains zeros in the entries corresponding to $\tilde { \mathbf { x } } _ { T , 0 }$ , matching the above calculations. The vector $\nabla _ { \tilde { \mathbf { x } } } \log p \left( \tilde { \mathbf { x } } \right)$ can be estimated using a neural network as in [44], or using a pre-trained MMSE denoiser as in [20, 21]. All the other elements of this vector are given or can be easily obtained from $\mathbf { H }$ by calculating its SVD decomposition once at the beginning.
142
+
143
+ # 4 The Proposed Algorithm
144
+
145
+ Armed with the conditional score function in Equation 10, the Langevin dynamics algorithm can be run with a constant step size or an annealed step size as in [44], and this should converge to a sample from $p \left( \tilde { \mathbf { x } } _ { T } | \mathbf { y } _ { T } \right)$ . However, for this to perform well, one should use a very small step size, implying a devastatingly slow convergence behavior. This is mainly due to the fact that different entries of $\tilde { \bf x } _ { T }$ advance at different speeds, in accord with their corresponding singular values. As the added noise in each step has the same variance in every entry, this leads to an unbalanced signal-to-noise ratio, which considerably slows down the algorithm.
146
+
147
+ In order to mitigate this problem, we suggest using a step size vector ${ \pmb { \alpha } } _ { i } \in \mathbb { R } ^ { N }$ . We denote $\mathbf { A } _ { i } = d i a g \left( \pmb { \alpha } _ { i } \right)$ , and obtain the following update formula for a Langevin dynamics algorithm:
148
+
149
+ $$
150
+ \mathbf { V } ^ { T } \tilde { \mathbf { x } } _ { i } = \mathbf { V } ^ { T } \tilde { \mathbf { x } } _ { i - 1 } + c \cdot \mathbf { A } _ { i } \cdot \nabla \mathbf { v } ^ { T } \tilde { \mathbf { x } } _ { i } \log p \left( \mathbf { V } ^ { T } \tilde { \mathbf { x } } _ { i } | \mathbf { y } _ { T } \right) + \sqrt { 2 \cdot c } \mathbf { A } _ { i } ^ { \frac { 1 } { 2 } } \cdot \mathbf { z } _ { i } ,
151
+ $$
152
+
153
+ where the conditional score function is estimated as described in subsection 3.2, and $c$ is some constant. For the choice of the step sizes in the diagonal of $\mathbf { A } _ { i }$ , we draw inspiration from Newton’s method in optimization, which is designed to speed up convergence to local maximum points. The update formula in Newton’s method is the same as Equation 11, but without the additional noise $\mathbf { z } _ { i }$ , and with $\mathbf { A } _ { i }$ being the negative inverse Hessian of $\log p \left( \mathbf { V } ^ { T } \tilde { \mathbf { x } } _ { i } | \mathbf { y } _ { T } \right)$ . We calculate a diagonal approximation of the Hessian, and set $\mathbf { A } _ { i }$ to be its negative inverse. We also estimate the conditional score function using Equation 10 and a neural network. Note that this mixture of Langevin dynamics and Newton’s method has been suggested in a slightly different context in [43], where the Hessian was approximated using a Quasi-Newton method. In our case, we analytically calculate a diagonal approximation of the negative inverse Hessian and obtain the following:
154
+
155
+ $$
156
+ \left( \alpha _ { i } \right) _ { j } = \left\{ \begin{array} { l l } { \sigma _ { i } ^ { 2 } , } & { s _ { j } = 0 } \\ { \sigma _ { i } ^ { 2 } - \frac { \sigma _ { 0 } ^ { 2 } } { s _ { j } ^ { 2 } } , } & { \sigma _ { i } s _ { j } > \sigma _ { 0 } } \\ { \sigma _ { i } ^ { 2 } \cdot \left( 1 - s _ { j } ^ { 2 } \frac { \sigma _ { i } ^ { 2 } } { \sigma _ { 0 } ^ { 2 } } \right) , } & { 0 < \sigma _ { i } s _ { j } < \sigma _ { 0 } . } \end{array} \right.
157
+ $$
158
+
159
+ ![](images/f76bb7d49bb33b3a68815799a29373ea7f403eba8070bce309f48629298e43e9.jpg)
160
+ Figure 3: Compressive sensing results on a CelebA [27] image with an additive noise of $\sigma _ { 0 } = 0 . 1$
161
+
162
+ The full derivations for each of the three cases are detailed in the supplemental material. Using these step sizes, the update formula in Equation 11, the conditional score function in Equation 10, and a neural network s $( \tilde { \mathbf { x } } , \sigma )$ that estimates the score function $\nabla _ { \tilde { \mathbf { x } } } \log p \left( \tilde { \mathbf { x } } \right)$ ,3 we obtain a tractable iterative algorithm for sampling from $p \left( \tilde { \mathbf { x } } _ { L } \mid \mathbf { y } \right)$ , where the noise in $ { \widetilde { \mathbf { x } } } _ { L }$ is sufficiently negligible to be considered as a sampling from the ideal image manifold.
163
+
164
+ # Algorithm 1: SNIPS
165
+
166
+ Input: $\left\{ \sigma _ { i } \right\} _ { i = 1 } ^ { L } , c , \tau , \mathbf { y } , \mathbf { H } , \sigma _ { 0 }$
167
+ $\mathbf { 1 } \ \mathbf { U } , \Sigma , \mathbf { V } s { \bar { v } } d ( \mathbf { H } )$
168
+ 2 Initialize $\mathbf { x _ { 0 } }$ with random noise $U \left[ 0 , 1 \right]$
169
+ 3 for $i \gets 1$ to $L$ do
170
+ 4 $( \mathbf { A } _ { i } ) _ { 0 } \sigma _ { i } ^ { 2 } \mathbf { I }$
171
+ 5 ( A i ) < ← σ 2i ·  I − σ 2iσ 2 Σ < Σ < T 
172
+ 6 $( \mathbf { A } _ { i } ) _ { > } \sigma _ { i } ^ { 2 } \mathbf { I } - \sigma _ { 0 } ^ { 2 } \mathbf { \Sigma } \mathbf { \Sigma } _ { > } ^ { \dagger } \mathbf { \Sigma } \mathbf { \Sigma } \mathbf { \Sigma } _ { > } ^ { \dagger ^ { T } }$
173
+ 7 for t ← 1 to τ do
174
+ 8 Draw $\mathbf { z } _ { t } \sim \mathcal { N } \left( 0 , \mathbf { I } \right)$
175
+ 9 $\begin{array} { r l } & { \mathbf { d } _ { t } \xleftarrow \Sigma ^ { T } \cdot \left| \sigma _ { 0 } ^ { 2 } \mathbf { I } - \sigma _ { i } ^ { 2 } \Sigma \Sigma ^ { T } \right| ^ { \dagger } \cdot \left( \mathbf { U } ^ { T } \mathbf { y } - \Sigma \mathbf { V } ^ { T } \mathbf { x } _ { t - 1 } \right) + \left( \mathbf { V } ^ { T } \cdot \mathbf { s } \left( \mathbf { x } _ { t - 1 } , \sigma _ { i } \right) \right) \big | _ { \ng } } \\ & { \mathbf { x } _ { t } \xleftarrow \mathbf { V } \cdot \left( \mathbf { V } ^ { T } \mathbf { x } _ { t - 1 } + c \mathbf { A } _ { i } \mathbf { d } _ { t } + \sqrt { 2 c } \mathbf { A } _ { i } ^ { \frac { 1 } { 2 } } \mathbf { z } _ { t } \right) } \end{array}$
176
+ 10
177
+ 11 end
178
+ 12 $\mathbf { x } _ { 0 } \mathbf { x } _ { \tau }$
179
+ 13 end
180
+
181
+ Note that when we set $\mathbf { H } = \mathbf { \Omega } 0$ and $\sigma _ { 0 } = 0$ , implying no measurements, the above algorithm degenerates to an image synthesis, exactly as in [44]. Two other special cases of this algorithm are obtained for $\mathbf { H } = \mathbf { I }$ or $\mathbf { H } = \mathbf { I }$ with some rows removed, the first referring to denoising and the second to noisy inpainting, both cases shown in [21]. Lastly, for the choices of $\mathbf { H }$ as in [20] or [44, 46] and with $\sigma _ { 0 } = 0$ , the above algorithm collapses to a close variant of their proposed iterative methods.
182
+
183
+ # 5 Experimental Results
184
+
185
+ In our experiments we use the NCSNv2 [45] network in order to estimate the score function of the prior distribution. Three different NCSNv2 models are used, each trained separately on the training sets of: (i) images of size $6 4 \times 6 4$ pixels from the CelebA dataset [27]; (ii) images of size $1 2 8 \times 1 2 8$ pixels from LSUN [56] bedrooms dataset; and (iii) LSUN $1 2 8 \times 1 2 8$ images of towers. We demonstrate SNIPS’ capabilities on the respective test sets for image deblurring, super resolution, and compressive sensing. In each of the experiments, we run our algorithm 8 times, producing 8 samples for each input. We examine both the samples themselves and their mean, which serves as an approximation of the MMSE solution, $\mathbb { E } \left[ \mathbf { x } | \mathbf { y } \right]$ .
186
+
187
+ ![](images/0fe681d53940c46fc3dcbf035756174ac25fbeaf06344ec3bce31a956ddec79b.jpg)
188
+ Figure 4: Super resolution results on CelebA [27] images (downscaling $4 : 1$ by plain averaging and adding noise with $\sigma _ { 0 } = 0 . 1$ ).
189
+
190
+ ![](images/6f296f6b2a2fc1162ce50cccb9a0e568e4e043a1cf1bb3e7155c6118f8d3aa75.jpg)
191
+ Figure 5: Super resolution results on CelebA [27] images (downscaling $2 : 1$ by plain averaging and adding noise with $\sigma _ { 0 } = 0 . 1$ ).
192
+
193
+ For image deblurring, we use a uniform $5 \times 5$ blur kernel, and an additive white Gaussian noise with $\sigma _ { 0 } = 0 . 1$ (referring to pixel values in the range $[ 0 , 1 ] \rangle$ ). Figure 1 demonstrates the obtained results for several images taken from the CelebA dataset. As can be seen, SNIPS produces visually pleasing, diverse samples.
194
+
195
+ For super resolution, the images are downscaled using a block averaging filter, i.e., each nonoverlapping block of pixels in the original image is averaged into one pixel in the low-resolution image. We use blocks of size $2 \times 2$ or $4 \times 4$ pixels, and assume the low-resolution image to include an additive white Gaussian noise. We showcase results on LSUN and CelebA in Figures 2, 4, and 5.
196
+
197
+ For compressive sensing, we use three random projection matrices with singular values of 1, that compress the image by $2 5 \%$ , $1 2 . 5 \%$ , and $6 . 2 5 \%$ . As can be seen in Figure 3 and as expected, the more aggressive the compression, the more significant are the variations in reconstruction.
198
+
199
+ We calculate the average PSNR (peak signal-to-noise ratio) of each of the 8 samples in our experiments, as well as the PSNR of their mean, as shown in Table 1. In all the experiments, the empirical conditional mean presents an improvement of around $2 . 4 \ : \mathrm { d B }$ in PSNR, even though it is less visually appealing compared to the samples. This is consistent with the theory in [5], which states that the difference in PSNR between posterior samples and the conditional mean (the MMSE estimator) should be $3 \mathrm { d B }$ , with the MMSE estimator having poorer perceptual quality but better PSNR.
200
+
201
+ A comparison of our deblurring results to those obtained by RED [39] is detailed in the supplemental material. We show that SNIPS exhibits superior performance over RED, achieving more than $1 1 \%$ improvement in PSNR and more than $5 8 \%$ improvement in LPIPS [62], a perceptual quality metric.
202
+
203
+ # 5.1 Assessing Faithfulness to the Measurements
204
+
205
+ A valid solution to an inverse problem should satisfy two conditions: (i) It should be visually pleasing, consistent with the underlying prior distribution of images, and (ii) It should be faithful to the given measurement, maintaining the relationship as given in the problem setting. Since the prior distribution is unknown, we assess the first condition by visually observing the obtained solutions and their tendency to look realistic. As for the second condition, we perform the following computation: We degrade the obtained reconstruction $\hat { \bf x }$ by $\mathbf { H }$ , and calculate its difference from the given measurement $\mathbf { y }$ , obtaining $\mathbf { y } - \mathbf { H } \hat { \mathbf { x } }$ . According to the problem setting, this difference should be an additive white Gaussian noise vector with a standard deviation of $\sigma _ { 0 }$ . We examine this difference by calculating its empirical standard deviation, and performing the Pearson-D’Agostino [8] test of normality on it, accepting it as a Gaussian vector if the obtained p-value is greater than 0.05. We also calculate the Pearson correlation coefficient (denoted as $\rho$ ) among neighboring entries, accepting them as uncorrelated for coefficients smaller than 0.1 in absolute value. In all of our tests, the standard deviation matches $\sigma _ { 0 }$ almost exactly, the Pearson correlation coefficient satisfies $| \rho | < 0 . 1$ , and we obtain p-values greater than 0.05 in around $9 5 \%$ of the samples (across all experiments). These results empirically show that our algorithm produces valid solutions to the given inverse problems.
206
+
207
+ Table 1: PSNR results for different inverse problems on 8 images from CelebA [27]. We ran SNIPS 8 times, and obtained 8 samples. The average PSNR for each of the samples is in the first column, while the average PSNR for the mean of the 8 samples for each image is in the second one.
208
+
209
+ <table><tr><td>Problem</td><td>Sample PSNR</td><td>Mean PSNR</td></tr><tr><td>Uniform deblurring</td><td>25.54</td><td>28.01</td></tr><tr><td>Super resolution (by 2)</td><td>25.58</td><td>28.03</td></tr><tr><td>Super resolution (by 4)</td><td>21.90</td><td>24.31</td></tr><tr><td>Compressive sensing (by 25%)</td><td>25.68</td><td>28.06</td></tr><tr><td>Compressive sensing (by 12.5%)</td><td>22.34</td><td>24.67</td></tr></table>
210
+
211
+ ![](images/31b80bec3255fef5b0e8eb8f928b222f9c9b72045dbebf8254989ebe23acad3b.jpg)
212
+ Figure 6: Compressive sensing results on LSUN [56] tower images (compression by $2 5 \%$ and adding noise with $\sigma _ { 0 } = 0 . 0 4 )$ .
213
+
214
+ # 6 Conclusion and Future Work
215
+
216
+ SNIPS, presented in this paper, is a novel stochastic algorithm for solving general noisy linear inverse problems. This method is based on annealed Langevin dynamics and Newton’s method, and relies on the availability of a pre-trained Gaussian MMSE denoiser. SNIPS produces a random variety of high quality samples from the posterior distribution of the unknown given the measurements, while guaranteeing their validity with respect to the given data. This algorithm’s derivation includes an intricate choice of the injected annealed noise in the Langevin update equations, and an SVD decomposition of the degradation operator for decoupling the measurements’ dependencies. We demonstrate SNIPS’ success on image deblurring, super resolution, and compressive sensing.
217
+
218
+ Extensions of this work should focus on SNIPS’ limitations: (i) The need to deploy SVD decomposition of the degradation matrix requires a considerable amount of memory and computations, and hinders the algorithm’s scalability; (ii) The current version of SNIPS does not handle general content images, a fact that is related to the properties of the denoiser being used [41]; and (iii) SNIPS, as any other Langevin based method, requires (too) many iterations (e.g., in our super-resolution tests on CelebA, 2 minutes are required for producing 8 sample images), and means for its acceleration should be explored.
219
+
220
+ # 7 Funding Transparency Statement
221
+
222
+ This research was partially supported by the Israel Science Foundation (ISF) under Grant 335/18 and the Technion Hiroshi Fujiwara Cyber Security Research Center and the Israel Cyber Bureau. Bahjat Kawar’s scholarship was partially provided by Li Ka Shing Fellowships and the Planning and Budgeting Committee of the Israel Council for Higher Education.
223
+
224
+ # References
225
+
226
+ [1] S. Arridge, P. Maass, O. Öktem, and C.-B. Schönlieb. Solving inverse problems using datadriven models. Acta Numerica, 28:1–174, 2019.
227
+ [2] Y. Bahat and T. Michaeli. Explorable super resolution. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 2716–2725, 2020.
228
+ [3] J. Besag. Markov Chain Monte Carlo for statistical inference. Center for Statistics and the Social Sciences, 9:24–25, 2001.
229
+ [4] S. A. Bigdeli, M. Jin, P. Favaro, and M. Zwicker. Deep mean-shift priors for image restoration. In Proceedings of the 31st International Conference on Neural Information Processing Systems, pages 763–772, 2017.
230
+ [5] Y. Blau and T. Michaeli. The perception-distortion tradeoff. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 6228–6237, 2018.
231
+ [6] A. Buades, B. Coll, and J.-M. Morel. A non-local algorithm for image denoising. In 2005 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR’05), volume 2, pages 60–65. IEEE, 2005.
232
+ [7] G. T. Buzzard, S. H. Chan, S. Sreehari, and C. A. Bouman. Plug-and-play unplugged: Optimization-free reconstruction using consensus equilibrium. SIAM Journal on Imaging Sciences, 11(3):2001–2020, 2018.
233
+ [8] R. D’Agostino and E. S. Pearson. Tests for departure from normality. Empirical results for the√ distributions of $b ^ { 2 }$ and $\sqrt { b }$ . Biometrika, 60(3):613–622, 1973.
234
+ [9] A. Danielyan, V. Katkovnik, and K. Egiazarian. BM3D frames and variational image deblurring. IEEE Transactions on Image Processing, 21(4):1715–1728, 2011.
235
+ [10] C. Dong, C. C. Loy, and X. Tang. Accelerating the super-resolution convolutional neural network. In European Conference on Computer Vision, pages 391–407. Springer, 2016.
236
+ [11] W. Dong, L. Zhang, G. Shi, and X. Li. Nonlocally centralized sparse representation for image restoration. IEEE Transactions on Image Processing, 22(4):1620–1630, 2012.
237
+ [12] B. Efron. Tweedie’s formula and selection bias. Journal of the American Statistical Association, 106(496):1602–1614, 2011.
238
+ [13] M. Elad and M. Aharon. Image denoising via sparse and redundant representations over learned dictionaries. IEEE Transactions on Image Processing, 15(12):3736–3745, 2006.
239
+ [14] 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, volume 27. Curran Associates, Inc., 2014.
240
+ [15] B. Guo, Y. Han, and J. Wen. AGEM: solving linear inverse problems via deep priors and sampling. Advances in Neural Information Processing Systems, 32:547–558, 2019.
241
+ [16] H. Gupta, K. H. Jin, H. Q. Nguyen, M. T. McCann, and M. Unser. CNN-based projected gradient descent for consistent CT image reconstruction. IEEE Transactions on Medical Imaging, 37(6): 1440–1453, 2018.
242
+ [17] M. Haris, G. Shakhnarovich, and N. Ukita. Deep back-projection networks for super-resolution. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 1664–1673, 2018.
243
+ [18] J. Ho, A. Jain, and P. Abbeel. Denoising diffusion probabilistic models. In Advances in Neural Information Processing Systems, volume 33, pages 6840–6851. Curran Associates, Inc., 2020.
244
+ [19] C. M. Hyun, H. P. Kim, S. M. Lee, S. Lee, and J. K. Seo. Deep learning for undersampled MRI reconstruction. Physics in Medicine & Biology, 63(13):135007, 2018.
245
+ [20] Z. Kadkhodaie and E. P. Simoncelli. Solving linear inverse problems using the prior implicit in a denoiser. arXiv preprint arXiv:2007.13640, 2020.
246
+ [21] B. Kawar, G. Vaksman, and M. Elad. Stochastic image denoising by sampling from the posterior distribution. arXiv preprint arXiv:2101.09552, 2021.
247
+ [22] O. Kupyn, T. Martyniuk, J. Wu, and Z. Wang. DeblurGAN-v2: deblurring (orders-of-magnitude) faster and better. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 8878–8887, 2019.
248
+ [23] R. Laumont, V. De Bortoli, A. Almansa, J. Delon, A. Durmus, and M. Pereyra. Bayesian imaging using plug & play priors: When Langevin meets Tweedie. arXiv preprint arXiv:2103.04715, 2021.
249
+ [24] G. Lebanon. Probability: The Analysis of Data, volume 1, pages 104–107. CreateSpace Independent Publishing Platform, 2012.
250
+ [25] S. Lefkimmiatis. Non-local color image denoising with convolutional neural networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 3587–3596, 2017.
251
+ [26] H. Li, Y. Yang, M. Chang, H. Feng, Z. Xu, Q. Li, and Y. Chen. SRDiff: single image superresolution with diffusion probabilistic models. arXiv e-prints, pages arXiv–2104, 2021.
252
+ [27] Z. Liu, P. Luo, X. Wang, and X. Tang. Deep learning face attributes in the wild. In Proceedings of the IEEE International Conference on Computer Vision, pages 3730–3738, 2015.
253
+ [28] A. Lucas, M. Iliadis, R. Molina, and A. K. Katsaggelos. Using deep neural networks for inverse problems in imaging: beyond analytical methods. IEEE Signal Processing Magazine, 35(1): 20–36, 2018.
254
+ [29] M. T. McCann, K. H. Jin, and M. Unser. Convolutional neural networks for inverse problems in imaging: A review. IEEE Signal Processing Magazine, 34(6):85–95, 2017.
255
+ [30] T. Meinhardt, M. Moller, C. Hazirbas, and D. Cremers. Learning proximal operators: Using denoising networks for regularizing inverse imaging problems. In Proceedings of the IEEE International Conference on Computer Vision, pages 1781–1790, 2017.
256
+ [31] S. Menon, A. Damian, S. Hu, N. Ravi, and C. Rudin. PULSE: Self-supervised photo upsampling via latent space exploration of generative models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 2437–2445, 2020.
257
+ [32] K. Miyasawa. An empirical Bayes estimator of the mean of a normal population. Bull. Inst. Internat. Statist., 38:181–188, 1961.
258
+ [33] G. Ohayon, T. Adrai, G. Vaksman, M. Elad, and P. Milanfar. High perceptual quality image denoising with a posterior sampling CGAN. arXiv preprint arXiv:2103.04192, 2021.
259
+ [34] S. Peng and K. Li. Generating unobserved alternatives: A case study through super-resolution and decompression. arXiv preprint arXiv:2011.01926, 2020.
260
+ [35] A. Radford, L. Metz, and S. Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. In 4th International Conference on Learning Representations, 2016.
261
+ [36] I. Ram, M. Elad, and I. Cohen. Image processing using smooth ordering of its patches. IEEE Transactions on Image Processing, 22(7):2764–2774, 2013.
262
+ [37] S. Ravishankar, J. C. Ye, and J. A. Fessler. Image reconstruction: From sparsity to data-adaptive methods and machine learning. Proceedings of the IEEE, 108(1):86–109, 2019.
263
+ [38] G. O. Roberts, R. L. Tweedie, et al. Exponential convergence of Langevin distributions and their discrete approximations. Bernoulli, 2(4):341–363, 1996.
264
+ [39] Y. Romano, M. Elad, and P. Milanfar. The little engine that could: Regularization by denoising (RED). SIAM Journal on Imaging Sciences, 10(4):1804–1844, 2017.
265
+ [40] A. Rond, R. Giryes, and M. Elad. Poisson inverse problems by the plug-and-play scheme. Journal of Visual Communication and Image Representation, 41:96–108, 2016.
266
+ [41] E. Ryu, J. Liu, S. Wang, X. Chen, Z. Wang, and W. Yin. Plug-and-play methods provably converge with properly trained denoisers. In International Conference on Machine Learning, pages 5546–5557. PMLR, 2019.
267
+ [42] C. Saharia, J. Ho, W. Chan, T. Salimans, D. J. Fleet, and M. Norouzi. Image super-resolution via iterative refinement. arXiv preprint arXiv:2104.07636, 2021.
268
+ [43] U. Simsekli, R. Badeau, T. Cemgil, and G. Richard. Stochastic Quasi-Newton Langevin Monte Carlo. In International Conference on Machine Learning, pages 642–651. PMLR, 2016.
269
+ [44] Y. Song and S. Ermon. Generative modeling by estimating gradients of the data distribution. In Advances in Neural Information Processing Systems, pages 11918–11930, 2019.
270
+ [45] Y. Song and S. Ermon. Improved techniques for training score-based generative models. In Advances in Neural Information Processing Systems, 33, 2020.
271
+ [46] Y. Song, J. Sohl-Dickstein, D. P. Kingma, A. Kumar, S. Ermon, and B. Poole. Score-based generative modeling through stochastic differential equations. In International Conference on Learning Representations, 2021.
272
+ [47] C. M. Stein. Estimation of the mean of a multivariate normal distribution. The annals of Statistics, pages 1135–1151, 1981.
273
+ [48] M. Suin, K. Purohit, and A. Rajagopalan. Spatially-attentive patch-hierarchical network for adaptive motion deblurring. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 3606–3615, 2020.
274
+ [49] Y. Sun, B. Wohlberg, and U. S. Kamilov. An online plug-and-play algorithm for regularized image reconstruction. IEEE Transactions on Computational Imaging, 5(3):395–408, 2019.
275
+ [50] T. Tirer and R. Giryes. Image restoration by iterative denoising and backward projections. IEEE Transactions on Image Processing, 28(3):1220–1234, 2018.
276
+ [51] G. Vaksman, M. Zibulevsky, and M. Elad. Patch ordering as a regularization for inverse problems in image processing. SIAM Journal on Imaging Sciences, 9(1):287–319, 2016.
277
+ [52] G. Vaksman, M. Elad, and P. Milanfar. LIDIA: Lightweight learned image denoising with instance adaptation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops, pages 524–525, 2020.
278
+ [53] S. V. Venkatakrishnan, C. A. Bouman, and B. Wohlberg. Plug-and-play priors for model based reconstruction. In 2013 IEEE Global Conference on Signal and Information Processing, pages 945–948. IEEE, 2013.
279
+ [54] X. Wang, K. Yu, S. Wu, J. Gu, Y. Liu, C. Dong, Y. Qiao, and C. Change Loy. ESRGAN: enhanced super-resolution generative adversarial networks. In Proceedings of the European Conference on Computer Vision (ECCV) Workshops, 2018.
280
+ [55] J. Yang, J. Wright, T. S. Huang, and Y. Ma. Image super-resolution via sparse representation. IEEE transactions on image processing, 19(11):2861–2873, 2010.
281
+ [56] F. Yu, A. Seff, Y. Zhang, S. Song, T. Funkhouser, and J. Xiao. LSUN: construction of a large-scale image dataset using deep learning with humans in the loop. arXiv preprint arXiv:1506.03365, 2015.
282
+ [57] G. Yu, G. Sapiro, and S. Mallat. Solving inverse problems with piecewise linear estimators: From Gaussian mixture models to structured sparsity. IEEE Transactions on Image Processing, 21(5):2481–2499, 2011.
283
+ [58] J. Zhang and B. Ghanem. ISTA-Net: interpretable optimization-inspired deep network for image compressive sensing. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 1828–1837, 2018.
284
+ [59] K. Zhang, W. Zuo, Y. Chen, D. Meng, and L. Zhang. Beyond a Gaussian denoiser: Residual learning of deep CNN for image denoising. IEEE Transactions on Image Processing, 26(7): 3142–3155, 2017.
285
+ [60] K. Zhang, W. Zuo, S. Gu, and L. Zhang. Learning deep CNN denoiser prior for image restoration. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 3929–3938, 2017.
286
+ [61] K. Zhang, W. Zuo, and L. Zhang. FFDNet: toward a fast and flexible solution for CNN-based image denoising. IEEE Transactions on Image Processing, 27(9):4608–4622, 2018.
287
+ [62] R. Zhang, P. Isola, A. A. Efros, E. Shechtman, and O. Wang. The unreasonable effectiveness of deep features as a perceptual metric. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 586–595, 2018.
288
+ [63] D. Zoran and Y. Weiss. From learning models of natural image patches to whole image restoration. In 2011 International Conference on Computer Vision, pages 479–486. IEEE, 2011.
md/train/px0-N3_KjA/px0-N3_KjA.md ADDED
@@ -0,0 +1,315 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # D4RL: DATASETS FOR DEEP DATA-DRIVEN REINFORCEMENT LEARNING
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ The offline reinforcement learning (RL) setting (also known as full batch RL), where a policy is learned from a static dataset, is compelling as progress enables RL methods to take advantage of large, previously-collected datasets, much like how the rise of large datasets has fueled results in supervised learning. However, existing online RL benchmarks are not tailored towards the offline setting and existing offline RL benchmarks are restricted to data generated by partially-trained agents, making progress in offline RL difficult to measure. In this work, we introduce benchmarks specifically designed for the offline setting, guided by key properties of datasets relevant to real-world applications of offline RL. With a focus on dataset collection, examples of such properties include: datasets generated via hand-designed controllers and human demonstrators, multitask datasets where an agent performs different tasks in the same environment, and datasets collected with mixtures of policies. By moving beyond simple benchmark tasks and data collected by partially-trained RL agents, we reveal important and unappreciated deficiencies of existing algorithms. To facilitate research, we have released our benchmark tasks and datasets with a comprehensive evaluation of existing algorithms, an evaluation protocol, and open-source examples. This serves as a common starting point for the community to identify shortcomings in existing offline RL methods and a collaborative route for progress in this emerging area.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Impressive progress across a range of machine learning applications has been driven by high-capacity neural network models with large, diverse training datasets (Goodfellow et al., 2016). While reinforcement learning (RL) algorithms have also benefited from deep learning (Mnih et al., 2015), active data collection is typically required for these algorithms to succeed, limiting the extent to which large, previously-collected datasets can be leveraged. Offline RL (Lange et al., 2012) (also known as full batch RL), where agents learn from previously-collected datasets, provides a bridge between RL and supervised learning. The promise of offline RL is leveraging large, previously-collected datasets in the context of sequential decision making, where reward-driven learning can produce policies that reason over temporally extended horizons. This could have profound implications for a range of application domains, such as robotics, autonomous driving, and healthcare.
12
+
13
+ ![](images/204843bf80394ab135b0e6b1d64748bede36c69ff7c32c8a435917f975ddbe5a.jpg)
14
+ Figure 1: A selection of proposed benchmark tasks.
15
+
16
+ Current offline RL methods have not fulfilled this promise yet. While recent work has investigated technical reasons for this (Fujimoto et al., 2018a; Kumar et al., 2019; Wu et al., 2019), a major challenge in addressing these issues has been the lack of standard evaluation benchmarks. Ideally, such a benchmark should: a) be composed of tasks that reflect challenges in real-world applications of data-driven RL, b) be widely accessible for researchers and define clear evaluation protocols for reproducibility, and c) contain a range of difficulty to differentiate between algorithms, especially challenges particular to the offline RL setting.
17
+
18
+ Most recent works (Fujimoto et al., 2018b; Wu et al., 2019; Kumar et al., 2019; Peng et al., 2019; Agarwal et al., 2019b) use existing online RL benchmark domains and data collected from training runs of online RL methods. However, these benchmarks were not designed with offline RL in mind and such datasets do not reflect the heterogenous nature of data collected in practice. Wu et al. (2019) find that existing benchmark datasets are not sufficient to differentiate between simple baseline approaches and recently proposed algorithms. Furthermore, the aforementioned works do not propose a standard evaluation protocol, which makes comparing methods challenging.
19
+
20
+ Why simulated environments? While relying on (existing) real-world datasets is appealing, evaluating a candidate policy is challenging because it weights actions differently than the data collection and may take actions that were not collected. Thus, evaluating a candidate policy requires either collecting additional data from the real-world system, which is hard to standardize and make broadly available, or employing off-policy evaluation, which is not yet reliable enough (e.g., the NeurIPS 2017 Criteo Ad Placement Challenge used off-policy evaluation, however, in spite of an unprecedentedly large dataset because of the variance in the estimator, top entries were not statistically distinguishable from the baseline). Both options are at odds with a widely-accessible and reproducible benchmark. As a compromise, we use high-quality simulations that have been battle-tested in prior domain-specific work, such as in robotics and autonomous driving. These simulators allow researchers to evaluate candidate policies accurately.
21
+
22
+ Our primary contribution is the introduction of Datasets for Deep Data-Driven Reinforcement Learning (D4RL): a suite of tasks and datasets for benchmarking progress in offline RL. We focus our design around tasks and data collection strategies that exercise dimensions of the offline RL problem likely to occur in practical applications, such as partial observability, passively logged data, or human demonstrations. To serve as a reference, we benchmark state-of-theart offline RL algorithms (Haarnoja et al., 2018b; Kumar et al., 2019; Wu et al., 2019; Agarwal et al., 2019b; Fujimoto et al., 2018a; Nachum et al., 2019; Peng et al., 2019; Kumar et al., 2020) and provide reference implementations as a starting point for future work. While previous studies (e.g., (Wu et al., 2019)) found that all methods including simple baselines performed well on the limited set of tasks used in prior work, we find that most algorithms struggle to perform well on tasks with properties crucial to real-world applications such as passively logged data, narrow data distributions, and limited human demonstrations. By moving beyond simple benchmark tasks and data collected by partially-trained RL agents, we reveal important and unappreciated deficiencies of existing algorithms. To facilitate adoption, we provide an easy-to-use API for tasks, datasets, and a collection of benchmark implementations of existing algorithms (https://sites.google.com/view/d4rl-anonymous/). This is a common starting point for the community to identify shortcomings in existing offline RL methods, and provides a meaningful metric for progress in this emerging area.
23
+
24
+ # 2 RELATED WORK
25
+
26
+ Recent work in offline RL has primarily used datasets generated by a previously trained behavior policy, ranging from a random initial policy to a near-expert online-trained policy. This approach has been used for continuous control for robotics (Fujimoto et al., 2018a; Kumar et al., 2019; Wu et al., 2019; Gulcehre et al., 2020), navigation (Laroche et al., 2019), industrial control (Hein et al., 2017), and Atari video games (Agarwal et al., 2019b). To standardize the community around common datasets, several recent works have proposed benchmarks for offline RL algorithms. Agarwal et al. (2019b); Fujimoto et al. (2019) propose benchmarking based on the discrete Atari domain. Concurrently to our work, Gulcehre et al. (2020) proposed a benchmark1 based on locomotion and manipulation tasks with perceptually challenging input and partial observability. While these are important contributions, both benchmarks suffer from the same shortcomings as prior evaluation protocols: they rely on data collected from online RL training runs. In contrast, with D4RL, in addition to collecting data from online RL training runs, we focus on a range of dataset collection procedures inspired by real-world applications, such as human demonstrations, exploratory agents, and hand-coded controllers. As alluded to by Wu et al. (2019) and as we show in our experiments, the performance of current methods depends strongly on the data collection procedure, demonstrating the importance of modeling realistic data collection procedures in a benchmark.
27
+
28
+ Offline RL using large, previously-collect datasets has been successfully applied to real-world systems such as in robotics (Cabi et al., 2019), recommender systems (Li et al., 2010; Strehl et al., 2010; Thomas et al., 2017), and dialogue systems (Henderson et al., 2008; Pietquin et al., 2011; Jaques et al., 2019). These successes point to the promise of offline RL, however, they rely on private real-world systems or expensive human labeling for evaluation which is not scalable or accessible for a benchmark. Moreover, significant efforts have been made to incorporate large-scale datasets into off-policy RL (Kalashnikov et al., 2018; Mo et al., 2018; Gu et al., 2017), but these works use large numbers of robots to collect online interaction during training. Pure online systems for realworld learning have included model-based approaches (Hester et al., 2011), or approaches which collect large amounts of data in parallel (Gu et al., 2017). While we believe these are promising directions for future research, the focus of this work is to provide a varied and accessible platform for developing algorithms.
29
+
30
+ # 3 BACKGROUND
31
+
32
+ The offline reinforcement learning problem statement is formalized within a Markov decision process (MDP), defined by a tuple $\bar { ( \boldsymbol { S } , A , P , R , \rho _ { 0 } , \gamma ) }$ , where $s$ denotes the state space, $\mathcal { A }$ denotes the action space, $P ( s ^ { \prime } | s , a )$ denotes the transition distribution, $\rho _ { 0 } ( s )$ denotes the initial state distribution, $R ( s , a )$ denotes the reward function, and $\gamma \in \mathsf { \Gamma } ( 0 , 1 )$ denotes the discount factor. The $\pi ( a | s )$ that maximizes the expected cumulative discounted rewardslso known as the discounted returns. $\begin{array} { r } { \bar { \boldsymbol { J } } ( \pi ) = E _ { \pi , P , \rho _ { 0 } } [ \sum _ { t = 0 } ^ { \infty } \bar { \boldsymbol { \gamma } } ^ { t } R ( \bar { s } _ { t } , \dot { a _ { t } } ) ] } \end{array}$
33
+
34
+ In episodic RL, the algorithm is given access to the MDP via trajectory samples for arbitrary $\pi$ of the algorithm’s choosing. Off-policy methods may use experience replay (Lin, 1992) to store these trajectories in a replay buffer $\mathcal { D }$ of transitions $( s _ { t } , a _ { t } , s _ { t + 1 } , r _ { t } )$ , and use an off-policy algorithm such as Q-learning (Watkins $\&$ Dayan, 1992) to optimize $\pi$ . However, these methods still iteratively collect additional data, and omitting this collection step can produce poor results. For example, running state-of-the-art off-policy RL algorithms on trajectories collected from an expert policy can result in diverging Q-values (Kumar et al., 2019).
35
+
36
+ In offline $R L$ , the algorithm no longer has access to the MDP, and is instead presented with a fixed dataset of transitions $\mathcal { D }$ . The (unknown) policy that generated this data is referred to as a behavior policy $\pi _ { B }$ . Effective offline RL algorithms must handle distribution shift, as well as data collected via processes that may not be representable by the chosen policy class. Levine et al. (2020) provide a comprehensive discussion of the problems affecting offline RL.
37
+
38
+ # 4 TASK DESIGN FACTORS
39
+
40
+ In order to design a benchmark that provides a meaningful measure of progress towards realistic applications of offline RL, we choose datasets and tasks to cover a range of properties designed to challenge existing RL algorithms. We discuss these properties as follows:
41
+
42
+ Narrow and biased data distributions, such as those from deterministic policies, are problematic for offline RL algorithms and may cause divergence both empirically (Fujimoto et al., 2018a; Kumar et al., 2019) and theoretically (Munos, 2003; Farahmand et al., 2010; Kumar et al., 2019; Agarwal et al., 2019a; Du et al., 2020). Narrow datasets may arise in human demonstrations, or when using hand-crafted policies. An important challenge in offline RL is to be able to gracefully handle diverse data distributions without algorithms diverging or producing performance worse than the provided behavior. A common approach for dealing with such data distributions is to adopt a conservative approach which tries to keep the behavior close to the data distribution (Fujimoto et al., 2018a; Kumar et al., 2019; Wu et al., 2019).
43
+
44
+ Undirected and multitask data naturally arises when data is passively logged, such as recording user interactions on the internet or recording videos of a car for autonomous driving. This data may not necessarily be directed towards the specific task one is trying to accomplish. However, pieces of trajectories can still provide useful information to learn from. For example, one may be able to combine sub-trajectories to accomplish a task. In the figure to the upper-right, if an agent is given trajectories from A-B and B-C in a dataset (left image), it can form a trajectory from AC by combining the corresponding halves of the original trajectories. We refer to this property as stitching, since the agent can use portions of existing trajectories in order to solve a task, rather than relying on generalization outside of the dataset.
45
+
46
+ Sparse rewards. Sparse reward problems pose challenges to traditional RL methods due to the difficulty of credit assignment and exploration. Because offline RL considers fixed datasets without exploration, sparse reward problems provide an unique opportunity to isolate the ability of algorithms to perform credit assignment decoupled from exploration.
47
+
48
+ ![](images/ba07cf2a7c183e919566af637c298c608191dcf1a691ca8953ddb04ee6effd43.jpg)
49
+ Figure 2: An example of stitching together subtrajectories to solve a task.
50
+
51
+ Suboptimal data. For tasks with a clear objective, the datasets may not contain behaviors from optimal agents. This represents a challenge for approaches such as imitation learning, which generally require expert demonstrations. We note prior work (e.g., (Fujimoto et al., 2018a; Kumar et al., 2019; Wu et al., 2019)) predominantly uses data with this property.
52
+
53
+ Non-representable behavior policies, non-Markovian behavior policies, and partial observability. When the dataset is generated from a partially-trained agent, we ensure that the behavior policy can be realized within our model class. However, real-life behavior may not originate from a policy within our model class, which can introduce additional representational errors. For example, data generated from human demonstrations or hand-crafted controllers may fall outside of the model class. More generally, non-Markovian policies and tasks with partial observability can introduce additional modeling errors when we estimate action probabilities under the assumption that the data was generated from a Markovian policy. These errors can cause additional bias for offline RL algorithms, especially in methods that assume access to action probabilities from a Markovian policy such as importance weighting (Precup et al., 2000).
54
+
55
+ Realistic domains. As we discussed previously, real-world evaluation is the ideal setting for benchmarking offline RL, however, it is at odds with a widely-accessible and reproducible benchmark. To strike a balance, we opted for simulated environments which have been previously studied and are broadly accepted by the research community. These simulation packages (such as MuJoCo, Flow, and CARLA) have been widely used to benchmark online RL methods and are known to fit well into that role. Moreover, on several domains we utilize human demonstrations or mathematical models of human behavior in order to provide datasets generated from realistic processes. However, this did have the effect of restricting our choice of tasks. While recent progress has been made on simulators for recommender systems (e.g., (Ie et al., 2019)), they use “stylized” user models and they have not been thoroughly evaluated by the community yet. In the future as simulators mature, we hope to include additional tasks.
56
+
57
+ In addition, we include a variety of qualitatively different tasks to provide broad coverage of the types of domains where offline RL could be used. We include locomotion, traffic management, autonomous driving, and robotics tasks. We also provide tasks with a wide range in difficulty, from tasks current algorithms can already solve to harder problems that are currently out of reach. Finally, for consistency with prior works, we also include the OpenAI Gym robotic locomotion tasks and similar datasets used by Fujimoto et al. (2018a); Kumar et al. (2019); Wu et al. (2019).
58
+
59
+ # 5 TASKS AND DATASETS
60
+
61
+ Given the properties outlined in Section 4, we assembled the following tasks and datasets. All tasks consist of an offline dataset (typically $1 0 ^ { 6 }$ steps) of trajectory samples for training, and a simulator for evaluation. The mapping is not one-to-one – several tasks use the same simulator with different datasets. Appendix C lists domains and dataset types along with their sources and Appendix A contains a more comprehensive table of statistics such as size. Our code and datasets have been released open-source and are on our website at https://sites.google.com/view/ d4rl-anonymous/.
62
+
63
+ Maze2D. (Non-markovian policies, undirected and multitask data) The Maze2D domain is a navigation task requiring a 2D agent to reach a fixed goal location. The tasks are designed to provide a simple test of the ability of offline RL algorithms to stitch together previously collected subtrajectories to find the shortest path to the evaluation goal. Three maze layouts are provided. The “umaze” and “medium” mazes are shown to the right, and the “large” maze is shown below.
64
+
65
+ ![](images/f8e9bd9413c8c6f357e6e9a95162ecee34027e4ab5d6a373adb2eb29e88bae96.jpg)
66
+
67
+ ![](images/7faa87c5a2b6188e0ec11cd42fe8cbbcf0dbcca32fb7dd618ae45308831489fb.jpg)
68
+
69
+ The data is generated by selecting goal locations at random and then using a planner that generates sequences of waypoints that are followed using a PD controller. In the figure on the left, the waypoints, represented by circles, are planned from the starting location (1) along the path to a goal (2). Upon reaching a threshold distance to a waypoint, the controller updates its internal state to track the next waypoint along the path to the goal. Once a goal is reached, a new goal is selected (3) and the process continues. The trajectories in the dataset are visualized in Appendix G. Because the controllers memorize the reached waypoints, the data collection policy is non-Markovian.
70
+
71
+ AntMaze. (Non-markovian policies, sparse rewards, undirected and multitask data) The AntMaze domain is a navigation domain that replaces the 2D ball from Maze2D with the more complex 8-DoF “Ant” quadraped robot. We introduce this domain to test the stitching challenge using a morphologically complex robot that could mimic real-world robotic navigation tasks. Additionally, for this task we use a sparse 0-1 reward which is activated upon reaching the goal.
72
+
73
+ The data is generated by training a goal reaching policy and using it in conjunction with the same high-level waypoint generator from Maze2D to provide subgoals that guide the agent to the goal. The same 3 maze layouts are used: “umaze”, “medium”, and “large”. We introduce three flavors of datasets: 1) the ant is commanded to reach a specific goal from a fixed start location (antmaze-umaze-v0), 2) in the “diverse” datasets, the ant is commanded to a random goal from a random start location, 3) in the “play” datasets, the ant is commanded to specific hand-picked locations in the maze (which are not necessarily the goal at evaluation), starting from a different set of hand-picked start locations. As in Maze2D, the controllers for this task are non-Markovian as they rely on tracking visited waypoints. Trajectories in the dataset are visualized in Appendix G.
74
+
75
+ ![](images/4c8de5d5c8898f3bb103a09b8c7662cd8958e6eb32d64de5bd189b46bc4dcb14.jpg)
76
+
77
+ Gym-MuJoCo. (Suboptimal agents, narrow data distributions) The Gym-MuJoCo tasks (Hopper, HalfCheetah, Walker2d) are popular benchmarks used in prior work in offline deep RL (Fujimoto et al., 2018a; Kumar et al., 2019; Wu et al., 2019). For consistency, we provide standardized datasets similar to previous work, and additionally propose mixing datasets to test the impact of heterogenous policy mixtures. We expect that methods that rely on regularizing to the behavior policy may fail when the data contains poorly performing trajectories.
78
+
79
+ The “medium” dataset is generated by first training a policy online using Soft Actor-Critic (Haarnoja et al., 2018a), early-stopping the training, and collecting 1M samples from this partially-trained policy. The “random” datasets are generated by unrolling a randomly initialized policy on these three domains. The “medium-replay” dataset consists of recording all samples in the replay buffer observed during training until the policy reaches the “medium” level of performance. Datasets similar to these three have been used in prior work, but in order to evaluate algorithms on mixtures of policies, we further introduce a “medium-expert” dataset by mixing equal amounts of expert demonstrations and suboptimal data, generated via a partially trained policy or by unrolling a uniform-at-random policy.
80
+
81
+ ![](images/574bc49332c7e072a31e492d630457b390d7b9149e94ac99433cf9e6f1173d89.jpg)
82
+
83
+ Adroit. (Non-representable policies, narrow data distributions, sparse rewards, realistic) The Adroit domain (Rajeswaran et al., 2018) (pictured left) involves controlling a 24-DoF simulated Shadow Hand robot tasked with hammering a nail, opening a door, twirling a pen, or picking up and moving a ball. This domain was selected to measure the effect of a narrow expert data distributions and human demonstrations on a sparse reward, high-dimensional robotic manipulation task.
84
+
85
+ ![](images/08047324d92867d1b3ad3ee01c388889cbafd40758edfe135a2178ffdc4d5e9b.jpg)
86
+
87
+ While Rajeswaran et al. (2018) propose utilizing human demonstrations, in conjunction with online RL fine-tuning, our benchmark adapts these tasks for evaluating the fully offline RL setting. We include three types of datasets for each task, two of which are included from the original paper: a small amount of demonstration data from a human (“human”) (25 trajectories per task) and a large amount of expert data from a fine-tuned RL policy (“expert”). To mimic the use-case where a practitioner collects a small amount of additional data from a policy trained on the demonstrations, we introduce a third dataset generated by training an imitation policy on the demonstrations, running the policy, and mixing data at a 50-50 ratio with the demonstrations, referred to as “cloned.” The Adroit domain has several unique properties that make it qualitatively different from the Gym MuJoCo tasks. First, the data is collected in from human demonstrators. Second, each task is difficult to solve with online RL, due to sparse rewards and exploration challenges, which make cloning and online RL alone insufficient. Lastly, the tasks are high dimensional, presenting a representation learning challenge.
88
+
89
+ FrankaKitchen. (Undirected and multitask data, realistic) The Franka Kitchen domain, first proposed by Gupta et al. (2019), involves controlling a 9-DoF Franka robot in a kitchen environment containing several common household items: a microwave, a kettle, an overhead light, cabinets, and an oven. The goal of each task is to interact with the items in order to reach a desired goal configuration. For example, one such state is to have the microwave and sliding cabinet door open with the kettle on the top burner and the overhead light on. This domain benchmarks the effect of multitask behavior on a realistic, non-navigation environment in which the “stitching” challenge is non-trivial because the collected trajectories are complex paths through the state space. As a result, algorithms must rely on generalization to unseen states in order to solve the task, rather than relying purely on trajectories seen during training.
90
+
91
+ ![](images/07148367f2a9ad735faa92f0fe7f537a3ef310d4d4d2e67d9df1669fc7fb6227.jpg)
92
+
93
+ In order to study the effect of “stitching” and generalization, we use 3 datasets of human demonstrations, originally proposed by Gupta et al. (2019). The “complete” dataset consists of the robot performing all of the desired tasks in order. This provides data that is easy for an imitation learning method to solve. The “partial” and “mixed” datasets consist of undirected data, where the robot performs subtasks that are not necessarily related to the goal configuration. In the “partial” dataset, a subset of the dataset is guaranteed to solve the task, meaning an imitation learning agent may learn by selectively choosing the right subsets of the data. The “mixed” dataset contains no trajectories which solve the task completely, and the RL agent must learn to assemble the relevant sub-trajectories. This dataset requires the highest degree of generalization in order to succeed.
94
+
95
+ ![](images/80c8476f51390edf1c5d4ce8bd37d1a3d34fe8184dca45bc2c567d361179971c.jpg)
96
+
97
+ Flow. (Non-representable policies, realistic) The Flow benchmark (Vinitsky et al., 2018) is a framework for studying traffic control using deep reinforcement learning. We use two tasks in the Flow benchmark which involve controlling autonomous vehicles to maximize the flow of traffic through a ring or merge road configuration (left).
98
+
99
+ We use the Flow domain in order to provide a task that simulates real-world traffic dynamics. A large challenge in autonomous driving is to be able to directly learn from human behavior. Thus, we include “human” data from agents controlled by the intelligent driver model (IDM) (Treiber et al., 2000), a hand-designed model of human driving behavior. In order to provide data with a wider distribution as a reference, we also include “random” data generated from an agent that commands random vehicle accelerations.
100
+
101
+ Offline CARLA. (Partial observability, non-representable policies, undirected and multitask data, realistic) CARLA (Dosovitskiy et al., 2017) is a high-fidelity autonomous driving simulator that has previously been used with imitation learning approaches (Rhinehart et al., 2018; Codevilla et al., 2018) from large, static datasets. The agent controls the throttle (gas pedal), the steering, and the break pedal for the car, and receives $4 8 \mathbf { x } 4 8$ RGB images from the driver’s perspective as observations. We propose two tasks for offline RL: lane following within a figure eight path (shown to the right, top picture), and navigation within a small town (bottom picture). The principle challenge of the CARLA domain is partial observability and visual complexity, as all observations are provided as first-person RGB images.
102
+
103
+ The datasets in both tasks are generated via hand-designed controllers meant to emulate human driving - the lane-following task uses simple heuristics to avoid cars and keep the car within lane boundaries, whereas the navigation task layers an additional high-level controller on top that takes turns randomly at intersections. Similarly to the Maze2D and AntMaze domains, this dataset consists of undirected navigation data in order to test the “stitching” property, however, it is in a more perceptually challenging domain.
104
+
105
+ ![](images/48da1059e526a5bfb3f938a24e44bdf4910cfae66d6e0c521b1f236183fc63bd.jpg)
106
+
107
+ Evaluation protocol. Previous work tunes hyperparameters with online evaluation inside the simulator, and as Wu et al. (2019) show, the hyperparameters have a large impact on performance. Unfortunately, extensive online evaluation is not practical in real-world applications and this leads to over optimistic performance expectations when the system is deployed in a truly offline setting. To rectify this problem, we designate a subset of tasks in each domain as “training” tasks, where hyperparameter tuning is allowed, and another subset as “evaluation” tasks on which final performance is measured (See Appendix D Table 5).
108
+
109
+ To facilitate comparison across tasks, we normalize scores for each environment roughly to the range between 0 and 100, by computing normalized $\mathtt { s c o r e } = 1 0 0 * \frac { \mathtt { s c o r e } - \mathtt { r a n d o m } \mathtt { s c o r e } } { \mathtt { e x p e r t } \mathtt { s c o r e } - \mathtt { r a n d o m } \mathtt { s c o r e } }$ . A normalized score of 0 corresponds to the average returns (over 100 episodes) of an agent taking actions uniformly at random across the action space. A score of 100 corresponds to the average returns of a domain-specific expert. For Maze2D, and Flow domains, this corresponds to the performance of the hand-designed controller used to collect data. For CARLA, AntMaze, and FrankaKitchen, we used an estimate of the maximum score possible. For Adroit, this corresponds to a policy trained with behavioral cloning on human-demonstrations and fine-tuned with RL. For Gym-MuJoCo, this corresponds to a soft-actor critic (Haarnoja et al., 2018b) agent.
110
+
111
+ # 6 BENCHMARKING PRIOR METHODS
112
+
113
+ We evaluated recently proposed offline RL algorithms and several baselines on our offline RL benchmarks. This evaluation (1) provides baselines as a reference for future work, and (2) identifies shortcomings in existing offline RL algorithms in order to guide future research. The average normalized performance for all tasks is plotted in the figure to the right. It is clear that as we move beyond simple tasks and data collection strategies, differences between algorithms are exacerbated and deficiencies in all algorithms are revealed. See Appendix Table 2 for
114
+
115
+ ![](images/f310841db94c8abe0aecfe7036a7249e96268f59a53ed79bfd687654da9c79d3.jpg)
116
+
117
+ normalized results for all tasks, Appendix Table 3 for unnormalized scores, and Appendix E for experimental details.
118
+
119
+ We evaluated behavioral cloning (BC), online and offline soft actor-critic (SAC) (Haarnoja et al., 2018b), bootstrapping error reduction (BEAR) (Kumar et al., 2019), and behavior-regularized actorcritic (BRAC) (Wu et al., 2019), advantage-weighted regression (AWR) (Peng et al., 2019), batchconstrained Q-learning (BCQ) (Fujimoto et al., 2018a), continuous action random ensemble mixtures (cREM) (Agarwal et al., 2019b), and AlgaeDICE (Nachum et al., 2019). We note that REM was originally designed for discrete action spaces, and the continuous action version has not been developed extensively. In most domains, we expect online SAC to outperform offline algorithms when given the same amount of data because this baseline is able to collect on-policy data. There are a few exceptions, such as for environments where exploration challenges make it difficult to find high-reward states, such as the Adroit and maze domains.
120
+
121
+ Overall, the benchmarked algorithms obtained the most success on datasets generated from an RLtrained policy, such as in the Adroit and Gym-MuJoCo domains. In these domains, offline RL algorithms are able to match the behavior policy when given expert data, and outperform when given suboptimal data. This positive result is expected, as it is the predominant setting in which these prior algorithms have been benchmarked in past work.
122
+
123
+ Another positive result comes in the form of sparse reward tasks. In particular, many methods were able to outperform the baseline online SAC method on the Adroit and AntMaze domains. This indicates that offline RL is a promising paradigm for overcoming exploration challenges, which has also been confirmed in recent work (Nair et al., 2020). We also find that conservative methods that constrain the policy to the dataset, such as BEAR, AWR, CQL, and BCQ, are able to handle biased and narrow data distributions well on domains such as Flow and Gym-MuJoCo.
124
+
125
+ Tasks with undirected data, such as the Maze2D, FrankaKitchen, CARLA and AntMaze domains, are challenging for existing methods. Even in the simpler Maze2D domain, the large maze provides a surprising challenge for most methods. However, the smaller instances of Maze2D and AntMaze are very much within reach of current algorithms. Mixture distributions (a form of non-representable policies) were also challenging for all algorithms we evaluated. For MuJoCo, even though the medium-expert data contains expert data, the algorithms performed roughly on-par with medium datasets, except for hopper. The same pattern was found in the cloned datasets for Adroit, where the algorithms mostly performed on-par with the limited demonstration dataset, even though they had access to additional data.
126
+
127
+ We find that many algorithms were able to succeed to some extent on tasks with controller-generated data, such as Flow and carla-lane. We also note that tasks with limited data, such as human demonstrations in Adroit and FrankaKitchen, remain challenging. This potentially points to the need for more sample-efficient methods, as big datasets may not be always be available.
128
+
129
+ # 7 DISCUSSION
130
+
131
+ We have proposed an open-source benchmark for offline RL. The choice of tasks and datasets were motivated by properties reflected in real-world applications, such as narrow data distributions and undirected, logged behavior. Existing benchmarks have largely concentrated on robotic control using data produced by policies trained with RL (Fujimoto et al., 2018a; Kumar et al., 2019; Wu et al., 2019; Gulcehre et al., 2020; Dulac-Arnold et al., 2020). This can give a misleading sense of progress, as we have shown in our experiments that many of the more challenging properties that we expect real-world datasets to have appear to result in a substantial challenge for existing methods.
132
+
133
+ We believe that offline RL holds great promise as a potential paradigm to leverage vast amounts of existing sequential data within the flexible decision making framework of reinforcement learning. We hope that providing a benchmark that is representative of potential problems in offline RL, but that still can be accessibly evaluated in simulation, will greatly accelerate progress in this field and create new opportunities to apply RL in many real-world application areas.
134
+
135
+ There are several important properties exhibited in some real-world applications of RL that are not explored in-depth in our benchmark. One is stochasticity of the environment, which can occur in systems such as financial markets, healthcare, or advertisement. And while we explore domains with large observation spaces, some domains such recommender systems can exhibit large action spaces. Finally, our tasks are predominantly in the robotics, autonomous driving, and traffic control. There are several other areas (e.g. in finance, industrial, or operations research) which could provide simulated, yet still challenging, benchmarks.
136
+
137
+ Ultimately, we would like to see offline RL applications move from simulated domains to real-world domains, using real-world datasets. This includes exciting areas such as recommender systems, where user behavior can be easily logged, and medicine, where doctors must keep complete medical records for each patient. A key challenge in these domains is that reliable evaluation must be done in a real system or using off-policy evaluation (OPE) methods. We believe that both reliable OPE methods and real-world benchmarks which are standardized across different research groups, will be important to establish for future benchmarks in offline RL.
138
+
139
+ # REFERENCES
140
+
141
+ Alekh Agarwal, Sham M Kakade, Jason D Lee, and Gaurav Mahajan. Optimality and approximation with policy gradient methods in markov decision processes. arXiv preprint arXiv:1908.00261, 2019a.
142
+
143
+ Rishabh Agarwal, Dale Schuurmans, and Mohammad Norouzi. Striving for simplicity in off-policy deep reinforcement learning. CoRR, abs/1907.04543, 2019b. URL http://arxiv.org/ abs/1907.04543.
144
+
145
+ Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym. arXiv preprint arXiv:1606.01540, 2016.
146
+
147
+ Serkan Cabi, Sergio Gomez Colmenarejo, Alexander Novikov, Ksenia Konyushkova, Scott Reed, ´ Rae Jeong, Konrad Zołna, Yusuf Aytar, David Budden, Mel Vecerik, et al. A framework for ˙ data-driven robotics. arXiv preprint arXiv:1909.12200, 2019.
148
+
149
+ Felipe Codevilla, Matthias Miiller, Antonio Lopez, Vladlen Koltun, and Alexey Dosovitskiy. End- ´ to-end driving via conditional imitation learning. In 2018 IEEE International Conference on Robotics and Automation (ICRA), pp. 1–9. IEEE, 2018.
150
+
151
+ Alexey Dosovitskiy, German Ros, Felipe Codevilla, Antonio Lopez, and Vladlen Koltun. CARLA: An open urban driving simulator. In Proceedings of the 1st Annual Conference on Robot Learning, pp. 1–16, 2017.
152
+
153
+ Simon S. Du, Sham M. Kakade, Ruosong Wang, and Lin F. Yang. Is a good representation sufficient for sample efficient reinforcement learning? In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id ${ . } =$ r1genAVKPB.
154
+
155
+ Gabriel Dulac-Arnold, Daniel Mankowitz, and Todd Hester. Challenges of real-world reinforcement learning. arXiv preprint arXiv:1904.12901, 2019.
156
+
157
+ Gabriel Dulac-Arnold, Nir Levine, Daniel J Mankowitz, Jerry Li, Cosmin Paduraru, Sven Gowal, and Todd Hester. An empirical investigation of the challenges of real-world reinforcement learning. arXiv preprint arXiv:2003.11881, 2020.
158
+
159
+ Amir-massoud Farahmand, Csaba Szepesvari, and R ´ emi Munos. Error propagation for approximate ´ policy and value iteration. In Advances in Neural Information Processing Systems, pp. 568–576, 2010.
160
+
161
+ Scott Fujimoto, David Meger, and Doina Precup. Off-policy deep reinforcement learning without exploration. arXiv preprint arXiv:1812.02900, 2018a.
162
+
163
+ Scott Fujimoto, Herke van Hoof, and David Meger. Addressing function approximation error in actor-critic methods. In Jennifer Dy and Andreas Krause (eds.), Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pp. 1587–1596. PMLR, 2018b.
164
+
165
+ Scott Fujimoto, Edoardo Conti, Mohammad Ghavamzadeh, and Joelle Pineau. Benchmarking batch deep reinforcement learning algorithms. arXiv preprint arXiv:1910.01708, 2019.
166
+
167
+ Ian Goodfellow, Yoshua Bengio, and Aaron Courville. Deep learning. MIT press, 2016.
168
+
169
+ Shixiang Gu, Ethan Holly, Timothy Lillicrap, and Sergey Levine. Deep reinforcement learning for robotic manipulation with asynchronous off-policy updates. In 2017 IEEE international conference on robotics and automation (ICRA), pp. 3389–3396. IEEE, 2017.
170
+
171
+ Caglar Gulcehre, Ziyu Wang, Alexander Novikov, Tom Le Paine, Sergio Gomez Colmenarejo, Kon- ´ rad Zolna, Rishabh Agarwal, Josh Merel, Daniel Mankowitz, Cosmin Paduraru, Gabriel DulacArnold, Jerry Li, Mohammad Norouzi, Matt Hoffman, Ofir Nachum, George Tucker, Nicolas Heess, and Nando de Freitas. Rl unplugged: Benchmarks for offline reinforcement learning, 2020.
172
+
173
+ Abhishek Gupta, Vikash Kumar, Corey Lynch, Sergey Levine, and Karol Hausman. Relay policy learning: Solving long-horizon tasks via imitation and reinforcement learning. arXiv preprint arXiv:1910.11956, 2019.
174
+
175
+ Tuomas Haarnoja, Aurick Zhou, Pieter Abbeel, and Sergey Levine. Soft actor-critic: Off-policy maximum entropy deep reinforcement learning with a stochastic actor. CoRR, abs/1801.01290, 2018a. URL http://arxiv.org/abs/1801.01290.
176
+
177
+ Tuomas Haarnoja, Aurick Zhou, Pieter Abbeel, and Sergey Levine. Soft actor-critic: Offpolicy maximum entropy deep reinforcement learning with a stochastic actor. arXiv preprint arXiv:1801.01290, 2018b.
178
+
179
+ Daniel Hein, Steffen Udluft, Michel Tokic, Alexander Hentschel, Thomas A Runkler, and Volkmar Sterzing. Batch reinforcement learning on the industrial benchmark: First experiences. In 2017 International Joint Conference on Neural Networks (IJCNN), pp. 4214–4221. IEEE, 2017.
180
+
181
+ James Henderson, Oliver Lemon, and Kallirroi Georgila. Hybrid reinforcement/supervised learning of dialogue policies from fixed data sets. Computational Linguistics, 34(4):487–511, 2008.
182
+
183
+ Todd Hester, Michael Quinlan, and Peter Stone. A real-time model-based reinforcement learning architecture for robot control. arXiv preprint arXiv:1105.1749, 2011.
184
+
185
+ Eugene Ie, Chih-wei Hsu, Martin Mladenov, Vihan Jain, Sanmit Narvekar, Jing Wang, Rui Wu, and Craig Boutilier. Recsim: A configurable simulation platform for recommender systems. arXiv preprint arXiv:1909.04847, 2019.
186
+
187
+ Natasha Jaques, Asma Ghandeharioun, Judy Hanwen Shen, Craig Ferguson, Agata Lapedriza, Noah \` Jones, Shixiang Gu, and Rosalind W. Picard. Way off-policy batch deep reinforcement learning of implicit human preferences in dialog. CoRR, abs/1907.00456, 2019. URL http://arxiv. org/abs/1907.00456.
188
+
189
+ Dmitry Kalashnikov, Alex Irpan, Peter Pastor, Julian Ibarz, Alexander Herzog, Eric Jang, Deirdre Quillen, Ethan Holly, Mrinal Kalakrishnan, Vincent Vanhoucke, et al. Scalable deep reinforcement learning for vision-based robotic manipulation. In Conference on Robot Learning, pp. 651– 673, 2018.
190
+
191
+ Aviral Kumar, Justin Fu, George Tucker, and Sergey Levine. Stabilizing off-policy q-learning via bootstrapping error reduction. In Advances in Neural Information Processing Systems, 2019. URL http://arxiv.org/abs/1906.00949.
192
+
193
+ Aviral Kumar, Aurick Zhou, George Tucker, and Sergey Levine. Conservative q-learning for offline reinforcement learning. arXiv preprint arXiv:2006.04779, 2020.
194
+
195
+ Sascha Lange, Thomas Gabel, and Martin Riedmiller. Batch reinforcement learning. In Reinforcement learning, pp. 45–73. Springer, 2012.
196
+
197
+ Romain Laroche, Paul Trichelair, and Remi Tachet Des Combes. Safe policy improvement with baseline bootstrapping. In International Conference on Machine Learning (ICML), 2019.
198
+
199
+ Sergey Levine, Aviral Kumar, George Tucker, and Justin Fu. Offline reinforcement learning: Tutorial, review, and perspectives on open problems. arXiv preprint arXiv:2005.01643, 2020.
200
+
201
+ Lihong Li, Wei Chu, John Langford, and Robert E Schapire. A contextual-bandit approach to personalized news article recommendation. In Proceedings of the 19th international conference on World wide web, pp. 661–670, 2010.
202
+
203
+ Long-Ji Lin. Self-improving reactive agents based on reinforcement learning, planning and teaching. Machine learning, 8(3-4):293–321, 1992.
204
+
205
+ Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A. Rusu, Joel Veness, Marc G. Bellemare, Alex Graves, Martin Riedmiller, Andreas K. Fidjeland, Georg Ostrovski, Stig Petersen, Charles Beattie, Amir Sadik, Ioannis Antonoglou, Helen King, Dharshan Kumaran, Daan Wierstra, Shane Legg, and Demis Hassabis. Human-level control through deep reinforcement learning. Nature, 518(7540):529–533, February 2015. ISSN 00280836.
206
+
207
+ Kaichun Mo, Haoxiang Li, Zhe Lin, and Joon-Young Lee. The adobeindoornav dataset: Towards deep reinforcement learning based real-world indoor robot visual navigation. 2018.
208
+
209
+ Remi Munos. Error bounds for approximate policy iteration. In ´ Proceedings of the Twentieth International Conference on International Conference on Machine Learning, pp. 560–567. AAAI Press, 2003.
210
+
211
+ Ofir Nachum, Bo Dai, Ilya Kostrikov, Yinlam Chow, Lihong Li, and Dale Schuurmans. Algaedice: Policy gradient from arbitrary experience. arXiv preprint arXiv:1912.02074, 2019.
212
+
213
+ Ashvin Nair, Murtaza Dalal, Abhishek Gupta, and Sergey Levine. Accelerating online reinforcement learning with offline datasets. arXiv preprint arXiv:2006.09359, 2020.
214
+
215
+ Xue Bin Peng, Aviral Kumar, Grace Zhang, and Sergey Levine. Advantage-weighted regression: Simple and scalable off-policy reinforcement learning. arXiv preprint arXiv:1910.00177, 2019.
216
+
217
+ Olivier Pietquin, Matthieu Geist, Senthilkumar Chandramohan, and Herve Frezza-Buet. Sample- ´ efficient batch reinforcement learning for dialogue management optimization. ACM Transactions on Speech and Language Processing (TSLP), 7(3):1–21, 2011.
218
+
219
+ Doina Precup, Richard S Sutton, and Satinder Singh. Eligibility traces for off-policy policy evaluation. In ICML’00 Proceedings of the Seventeenth International Conference on Machine Learning, 2000.
220
+
221
+ Aravind Rajeswaran, Vikash Kumar, Abhishek Gupta, Giulia Vezzani, John Schulman, Emanuel Todorov, and Sergey Levine. Learning complex dexterous manipulation with deep reinforcement learning and demonstrations. In Robotics: Science and Systems, 2018.
222
+
223
+ Nicholas Rhinehart, Rowan McAllister, and Sergey Levine. Deep imitative models for flexible inference, planning, and control. arXiv preprint arXiv:1810.06544, 2018.
224
+
225
+ Alex Strehl, John Langford, Lihong Li, and Sham M Kakade. Learning from logged implicit exploration data. In Advances in neural information processing systems, pp. 2217–2225, 2010.
226
+
227
+ Philip S Thomas, Georgios Theocharous, Mohammad Ghavamzadeh, Ishan Durugkar, and Emma Brunskill. Predictive off-policy policy evaluation for nonstationary decision problems, with applications to digital marketing. In AAAI, pp. 4740–4745, 2017.
228
+
229
+ Emanuel Todorov, Tom Erez, and Yuval Tassa. Mujoco: A physics engine for model-based control. In 2012 IEEE/RSJ International Conference on Intelligent Robots and Systems, pp. 5026–5033. IEEE, 2012.
230
+
231
+ Martin Treiber, Ansgar Hennecke, and Dirk Helbing. Congested traffic states in empirical observations and microscopic simulations. Physical review E, 62(2):1805, 2000.
232
+
233
+ Eugene Vinitsky, Aboudy Kreidieh, Luc Le Flem, Nishant Kheterpal, Kathy Jang, Cathy Wu, Fangyu Wu, Richard Liaw, Eric Liang, and Alexandre M Bayen. Benchmarks for reinforcement learning in mixed-autonomy traffic. In Conference on Robot Learning, pp. 399–409, 2018.
234
+
235
+ Christopher J.C.H. Watkins and Peter Dayan. Q-learning. Machine Learning, 8:279–292, 1992.
236
+
237
+ Cathy Wu, Aboudy Kreidieh, Kanaad Parvate, Eugene Vinitsky, and Alexandre M Bayen. Flow: Architecture and benchmarking for reinforcement learning in traffic control. arXiv preprint arXiv:1710.05465, pp. 10, 2017.
238
+
239
+ Yifan Wu, George Tucker, and Ofir Nachum. Behavior regularized offline reinforcement learning. arXiv preprint arXiv:1911.11361, 2019.
240
+
241
+ # Appendices
242
+
243
+ A TASK PROPERTIES
244
+
245
+ The following is a full list of task properties and dataset statistics for all tasks in the benchmark. Note that the full dataset for “carla-town” requires over 30GB of memory to store, so we also provide a subsampled version of the dataset which we used in our experiments.
246
+
247
+ Table 1: Statistics for each task in the benchmark. For the controller type, “planner” refers to a hand-designed navigation planner, “human” refers to human demonstrations, and “policy” refers to random or neural network policies. The number of samples refers to the number of environment transitions recorded in the dataset.
248
+
249
+ <table><tr><td>Domain</td><td>Task Name</td><td>Controller Type</td><td># Samples</td></tr><tr><td rowspan="3">Maze2D</td><td>maze2d-umaze</td><td>Planner</td><td>106</td></tr><tr><td>maze2d-medium</td><td>Planner</td><td>2*106</td></tr><tr><td>maze2d-large</td><td>Planner</td><td>4*106</td></tr><tr><td rowspan="6">AntMaze</td><td>antmaze-umaze</td><td>Planner</td><td>106</td></tr><tr><td>antmaze-umaze-diverse</td><td>Planner</td><td>106</td></tr><tr><td>antmaze-medium-play</td><td>Planner</td><td>106</td></tr><tr><td>antmaze-medium-diverse</td><td>Planner</td><td>106</td></tr><tr><td>antmaze-large-play</td><td>Planner</td><td>106</td></tr><tr><td>antmaze-large-diverse</td><td>Planner</td><td>106</td></tr><tr><td rowspan="11">Gym-MuJoCo</td><td>hopper-random</td><td>Policy</td><td>106</td></tr><tr><td>hopper-medium</td><td>Policy</td><td>106</td></tr><tr><td>hopper-medium-replay</td><td>Policy</td><td>200920</td></tr><tr><td>hopper-medium-expert</td><td>Policy</td><td>2×106</td></tr><tr><td>halfcheetah-random</td><td>Policy</td><td>106</td></tr><tr><td>halfcheetah-medium</td><td>Policy</td><td>106</td></tr><tr><td>halfcheetah-medium-replay</td><td>Policy</td><td>101000</td></tr><tr><td>halfcheetah-medium-expert</td><td>Policy</td><td>2×106</td></tr><tr><td>walker2d-random</td><td>Policy</td><td>106</td></tr><tr><td>walker2d-medium</td><td>Policy</td><td>106</td></tr><tr><td>walker2d-medium-replay</td><td>Policy</td><td>100930</td></tr><tr><td rowspan="11">Adroit</td><td>walker2d-medium-expert</td><td>Policy</td><td>2×106</td></tr><tr><td>pen-human</td><td>Human</td><td>5000</td></tr><tr><td>pen-cloned</td><td>Policy</td><td>5*105</td></tr><tr><td>pen-expert</td><td>Policy</td><td>5*105</td></tr><tr><td>hammer-human</td><td>Human</td><td>11310</td></tr><tr><td>hammer-cloned</td><td>Policy</td><td>106</td></tr><tr><td>hammer-expert</td><td>Policy</td><td>106</td></tr><tr><td>door-human</td><td>Human</td><td>6729</td></tr><tr><td>door-cloned</td><td>Policy</td><td>106</td></tr><tr><td>door-expert</td><td>Policy</td><td>106</td></tr><tr><td>relocate-human</td><td>Human</td><td>9942</td></tr><tr><td rowspan="4"></td><td>relocate-cloned</td><td>Policy</td><td>106</td></tr><tr><td>relocate-expert</td><td>Policy</td><td>106</td></tr><tr><td>flow-ring-random</td><td>Policy</td><td>106</td></tr><tr><td>flow-ring-controller</td><td>Policy</td><td>106</td></tr><tr><td rowspan="3">FrankaKitchen</td><td>flow-merge-random flow-merge-controller</td><td>Policy</td><td>106 106</td></tr><tr><td>kitchen-complete</td><td>Policy</td><td>3680</td></tr><tr><td>kitchen-partial</td><td>Policy Policy</td><td>136950</td></tr><tr><td rowspan="3">CARLA</td><td>kitchen-mixed</td><td>Policy</td><td>136950</td></tr><tr><td>carla-lane</td><td>Planner</td><td>105</td></tr><tr><td>carla-town</td><td>Planner</td><td>2 * 10 full 105 subsampled</td></tr></table>
250
+
251
+ # B RESULTS BY DOMAIN
252
+
253
+ The following tables summarize performance for each domain (excluding CARLA, due to all algorithms performing poorly), sorted by the best performing algorithm to the worst.
254
+
255
+ ![](images/a188c83f14b358449ed2a7d6182663793ff921476cbc1e55a71c68191b2fcd0e.jpg)
256
+
257
+ ![](images/79e7c0c5987e12927f614c047953fd5a0d7881d52d3e61d12633f64a3f0a64ce.jpg)
258
+
259
+ ![](images/ba71f57a34cabc77456baefdd1c4550b46509f99b85b79c2d2a24828bf9b586a.jpg)
260
+
261
+ ![](images/4c4269414b1df33c5af6693ef985a02631c6ff244541a7bc0c7e7afa08c124cf.jpg)
262
+
263
+ ![](images/7dd8df093183e61ba273de91a0dcef30c666500cdd4a0f259a6e7411d3a4bda0.jpg)
264
+
265
+ ![](images/a3c068b2889babbae3bf9a4399f50b0a22df8043e13e31de84356c1ffbe22767.jpg)
266
+
267
+ <table><tr><td rowspan=2 colspan=1>TO5</td><td rowspan=2 colspan=1>5501</td><td rowspan=2 colspan=1>0325584</td><td rowspan=2 colspan=1>317188436208641</td><td rowspan=2 colspan=1>34231400813</td><td></td><td></td><td></td></tr><tr><td rowspan=1 colspan=2>5850388850</td><td rowspan=1 colspan=1>226</td></tr><tr><td rowspan=1 colspan=1>PICTE</td><td rowspan=1 colspan=1>L&#x27;SI-1000</td><td rowspan=1 colspan=1>000000</td><td rowspan=1 colspan=1>328业101841</td><td rowspan=1 colspan=1>3800028033800</td><td rowspan=1 colspan=1>523047</td><td rowspan=1 colspan=1>002</td><td rowspan=1 colspan=1>T1</td></tr><tr><td rowspan=1 colspan=1>BCO</td><td rowspan=1 colspan=1>28386</td><td rowspan=1 colspan=1>500672</td><td rowspan=1 colspan=1>2491040333503450</td><td rowspan=1 colspan=1>5004040802040</td><td rowspan=1 colspan=1>6082</td><td rowspan=1 colspan=1>88</td><td rowspan=1 colspan=1>09</td></tr><tr><td rowspan=1 colspan=1>RRER</td><td rowspan=1 colspan=1>81-02</td><td rowspan=1 colspan=1>000000</td><td rowspan=1 colspan=1>2302000030082620</td><td rowspan=1 colspan=1>3200342008200</td><td rowspan=1 colspan=1>821</td><td rowspan=1 colspan=1>000</td><td rowspan=1 colspan=1>000</td></tr><tr><td rowspan=1 colspan=1>AAR</td><td rowspan=1 colspan=1>12</td><td rowspan=1 colspan=1>5030000</td><td rowspan=1 colspan=1>212N33B24531</td><td rowspan=1 colspan=1>3240304021306.7043</td><td rowspan=1 colspan=1>53500</td><td rowspan=1 colspan=1>0410</td><td rowspan=1 colspan=1>1049</td></tr><tr><td rowspan=1 colspan=1>PAAAAY</td><td rowspan=1 colspan=1>0&#x27;91-30</td><td rowspan=1 colspan=1>00300000</td><td rowspan=1 colspan=1>31m33314004308</td><td rowspan=1 colspan=1>02882503308304</td><td rowspan=1 colspan=1>716-36.1443</td><td rowspan=1 colspan=1>000</td><td rowspan=1 colspan=1>626</td></tr><tr><td rowspan=1 colspan=1>FRPAAC</td><td rowspan=1 colspan=1>4344</td><td rowspan=1 colspan=1>5000000</td><td rowspan=1 colspan=1>2018龙34300419</td><td rowspan=1 colspan=1>81833168033838</td><td rowspan=1 colspan=1>S588</td><td rowspan=1 colspan=1>000</td><td rowspan=1 colspan=1>40</td></tr><tr><td rowspan=1 colspan=1>FAAA</td><td rowspan=1 colspan=1>343046</td><td rowspan=1 colspan=1>500800</td><td rowspan=1 colspan=1>513445A3233403</td><td rowspan=1 colspan=1>1883380359315548</td><td rowspan=1 colspan=1>E330</td><td rowspan=1 colspan=1>032</td><td rowspan=1 colspan=1>1</td></tr><tr><td rowspan=1 colspan=1>JJA-ACS</td><td rowspan=1 colspan=1>21</td><td rowspan=1 colspan=1>000000</td><td rowspan=1 colspan=1>34B40824D358016</td><td rowspan=1 colspan=1>639002652158</td><td rowspan=1 colspan=1>2010</td><td rowspan=1 colspan=1>50025</td><td rowspan=1 colspan=1>08</td></tr><tr><td rowspan=1 colspan=1>B</td><td rowspan=1 colspan=1>38350</td><td rowspan=1 colspan=1>50500000</td><td rowspan=1 colspan=1>2168363034B838646</td><td rowspan=1 colspan=1>41505800519.55531101</td><td rowspan=1 colspan=1>O&#x27;LS-411</td><td rowspan=1 colspan=1>334</td><td rowspan=1 colspan=1>38</td></tr><tr><td rowspan=1 colspan=1>SAC</td><td rowspan=1 colspan=1>T317</td><td rowspan=1 colspan=1>000000</td><td rowspan=1 colspan=1>0&#x27;0010&#x27;0010&#x27;0011001001000&#x27;0010&#x27;0010&#x27;0010&#x27;0010&#x27;0010&#x27;001</td><td rowspan=1 colspan=1>T22010202222</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>000</td><td rowspan=1 colspan=1>84</td></tr><tr><td rowspan=1 colspan=1>Tae saeg</td><td rowspan=1 colspan=1>wzzn-preeaaampraeearpraeeee</td><td rowspan=1 colspan=1>aaernrssef-niprrereinaarir-inirlicerenre ipereeeenaefrerereegarn-neeeane</td><td rowspan=1 colspan=1>frrrreriewrpataat retreereetwartraetrprrnprrarstrrmaeuiniprgesdtrlereeeeertenreeeetttaetwarrrriaranwarprrararanioprrr-nredoninprr-nrrdon</td><td rowspan=1 colspan=1>raanarian Trerneaeeean prrrrrretrr Prrrrereeeerer greeertrruounn-.iorn rreeceeeegernannn-nndpenore-eedpouora-iorepgrdee-eeeJuadxe-rort</td><td rowspan=1 colspan=1>ronnrnBn-rng reneeererrtioprr-nmonnirrrerern</td><td rowspan=1 colspan=1>ahareteseeraetrreetrtrrretregr</td><td rowspan=1 colspan=1>GaraaaeCelaeaaenn</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>M zze</td><td rowspan=1 colspan=1>Araaee</td><td rowspan=1 colspan=1>U</td><td rowspan=1 colspan=1>Aiipt</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>rrrtra</td><td rowspan=1 colspan=1>CCAAA</td></tr></table>
268
+
269
+ <table><tr><td rowspan=1 colspan=1>T05</td><td rowspan=1 colspan=1>面340</td><td rowspan=1 colspan=1>0802i</td><td rowspan=1 colspan=1>544142333333217499453555555512711121236&#x27;9944£16053.5550</td><td rowspan=1 colspan=1>144143m320749449/:4-99&#x27;01-598521194448976766104</td><td rowspan=1 colspan=1>&#x27;99-5160559447</td><td rowspan=1 colspan=2>81207312710085-</td></tr><tr><td rowspan=1 colspan=1>AeeE</td><td rowspan=1 colspan=1>2306</td><td rowspan=1 colspan=1>000000</td><td rowspan=1 colspan=1>08103100915515518:045-301.449&#x27;LL$-05</td><td rowspan=1 colspan=1>08235-588558695235558</td><td rowspan=1 colspan=1>3935-8633587</td><td rowspan=1 colspan=1>000</td><td rowspan=1 colspan=1>411-1004-</td></tr><tr><td rowspan=1 colspan=1>PCC</td><td rowspan=1 colspan=1>43022</td><td rowspan=1 colspan=1>8800000</td><td rowspan=1 colspan=1>B285033236&#x27;L9L4244441754462944L&#x27;8898&#x27;15518&#x27;0SLL2445558355</td><td rowspan=1 colspan=1>2.64401015-588:11444444355-S&#x27;L1-33523131315225579&#x27;6551</td><td rowspan=1 colspan=1>L07-453513</td><td rowspan=1 colspan=1>888</td><td rowspan=1 colspan=1>46</td></tr><tr><td rowspan=1 colspan=1>REER</td><td rowspan=1 colspan=1>1588</td><td rowspan=1 colspan=1>000000</td><td rowspan=1 colspan=1>9&#x27;L65-1400&#x27;009-381&#x27;55958588&#x27;009-831</td><td rowspan=1 colspan=1>L&#x27;6617544-54682450&#x27;85-691-0&#x27;4001247-6&#x27;09-L&#x27;I[-</td><td rowspan=1 colspan=1>055533308.5555</td><td rowspan=1 colspan=1>0000</td><td rowspan=1 colspan=1>1004211-</td></tr><tr><td rowspan=1 colspan=1>AAR</td><td rowspan=1 colspan=1>531</td><td rowspan=1 colspan=1>000000</td><td rowspan=1 colspan=1>31423139955L&#x27;008614444417120&#x27;4062979269470&#x27;798</td><td rowspan=1 colspan=1>43554115-44441333569571&#x27;95-9&#x27;91-3.9540677842495555533</td><td rowspan=1 colspan=1>9.714443353</td><td rowspan=1 colspan=1>004</td><td rowspan=1 colspan=1>48&#x27;59-</td></tr><tr><td rowspan=1 colspan=1>PAPAAY</td><td rowspan=1 colspan=1>14104111</td><td rowspan=1 colspan=1>0000000</td><td rowspan=1 colspan=1>335513439538.31458255540669.059448995665344551</td><td rowspan=1 colspan=1>854-6L&#x27;6[-m69570&#x27;65-3641141-9&#x27;99-444</td><td rowspan=1 colspan=1>53335-G22</td><td rowspan=1 colspan=1>000</td><td rowspan=1 colspan=1>9&#x27;6611181-</td></tr><tr><td rowspan=1 colspan=1>BPARS</td><td rowspan=1 colspan=1>83</td><td rowspan=1 colspan=1>540000</td><td rowspan=1 colspan=1>92137238855535655314441335551383713335120</td><td rowspan=1 colspan=1>3.3305337-6041441357-58844444499-907-</td><td rowspan=1 colspan=1>&#x27;881-665567</td><td rowspan=1 colspan=1>000</td><td rowspan=1 colspan=1>7331</td></tr><tr><td rowspan=1 colspan=1>FAAR</td><td rowspan=1 colspan=1>5800</td><td rowspan=1 colspan=1>07000000</td><td rowspan=1 colspan=1>2333439336.6504.16842.211714956141483888&#x27;9L01965591148153133</td><td rowspan=1 colspan=1>£&#x27;992444&#x27;99-6&#x27;81-5588441-6&#x27;09-9&#x27;L1-354551165951086781115</td><td rowspan=1 colspan=1>£94-302355</td><td rowspan=1 colspan=1>01</td><td rowspan=1 colspan=1>0017855</td></tr><tr><td rowspan=1 colspan=1>JA-ACS</td><td rowspan=1 colspan=1>9144315</td><td rowspan=1 colspan=1>000000</td><td rowspan=1 colspan=1>3.555001409&#x27;808-4571185-88357539</td><td rowspan=1 colspan=1>8587744145149&#x27;L6L14134LL4535358.3957&#x27;81-</td><td rowspan=1 colspan=1>L141-3433</td><td rowspan=1 colspan=1>000</td><td rowspan=1 colspan=1>36.655-</td></tr><tr><td rowspan=1 colspan=1>B</td><td rowspan=1 colspan=1>0320</td><td rowspan=1 colspan=1>0000000000</td><td rowspan=1 colspan=1>3046644964448.5405354464498115554469444016753571</td><td rowspan=1 colspan=1>11711484458&#x27;16L1L&#x27;09-10233578&#x27;14191469616855</td><td rowspan=1 colspan=1>112547865508</td><td rowspan=1 colspan=1>441</td><td rowspan=1 colspan=1>5423191-</td></tr><tr><td rowspan=1 colspan=1>SAS</td><td rowspan=1 colspan=1>401134</td><td rowspan=1 colspan=1>1000000</td><td rowspan=1 colspan=1>1.23350155553235312315035555323231.2115535555323231.211551555433333</td><td rowspan=1 colspan=1>31847-8113331847-8&#x27;19-313331847-8&#x27;19-1&#x27;31-</td><td rowspan=1 colspan=1>8854</td><td rowspan=1 colspan=1>000</td><td rowspan=1 colspan=1>8L&#x27;6L-</td></tr><tr><td rowspan=1 colspan=1>Tae nsee</td><td rowspan=1 colspan=1>wzen-prezeanipr-preeawrpraete</td><td rowspan=1 colspan=1>aarap-nrrencnrreste hap-iripliinrrseerrr-aaipraaeagrdnrereeennetrpeereerrrn-neeezee</td><td rowspan=1 colspan=1>frrrplreeaalrtaelwrrirtraat pareeerrltrrelretaerwripepeaaepprrairprrraiitirhaeinilrardtrarrrereeetttaetirereeieettanwarrsrraraemwwiprrpraraen&quot;nioprrr-giddoningper-grsdon</td><td rowspan=1 colspan=1>rarrn-ariian rrernceeerran prrire-rreirr Prlreceeeeeger warea-aerr reeereeeeretrpgnn-annueunn-oonpruoge-uedpouora-iorppgedeeceeewuadxe-.iorr</td><td rowspan=1 colspan=1>reneenereeernrainiiringiiniiprrrnrnmnmirrrerreeeon</td><td rowspan=1 colspan=1>aeeeoeseereeed-etrtrrrrerrrer</td><td rowspan=1 colspan=1>errreateEelrcaaiin</td></tr><tr><td rowspan=1 colspan=1>Donaig</td><td rowspan=1 colspan=1>Mzzea</td><td rowspan=1 colspan=1>AAaae</td><td rowspan=1 colspan=1>N</td><td rowspan=1 colspan=1>1iipr</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Trrrertein</td><td rowspan=1 colspan=1>OOTACCATHA</td></tr></table>
270
+
271
+ # C TASK AND DATASETS
272
+
273
+ The following table lists the tasks and dataset types included in the benchmark, including sources for each.
274
+
275
+ Table 4: Domains and dataset types contained within our benchmark. Maze2D and AntMaze are new domains we propose. For each dataset, we also include references to the source if originally proposed in another work. Datasets borrowed from prior work include MuJoCo (Expert, Random, Medium), Adroit (Human, Expert), and FrankaKitchen (Complete, Partial, Mixed). All other datasets are datasets proposed by this work.
276
+
277
+ <table><tr><td rowspan=1 colspan=1>Domain</td><td rowspan=1 colspan=1> Source</td><td rowspan=1 colspan=1>Dataset Types</td></tr><tr><td rowspan=1 colspan=1>Maze2D</td><td rowspan=1 colspan=1>N/A</td><td rowspan=1 colspan=1>UMaze, Medium,Large</td></tr><tr><td rowspan=1 colspan=1>AntMaze</td><td rowspan=1 colspan=1>N/A</td><td rowspan=1 colspan=1>UMaze,Diverse, Play</td></tr><tr><td rowspan=1 colspan=1>Gym-MuJoCo</td><td rowspan=1 colspan=1>Brockman et al. (2016)Todorov et al. (2012)</td><td rowspan=1 colspan=1>Expert,Random,Medium(Various)Medium-Expert,Medium-Replay</td></tr><tr><td rowspan=1 colspan=1>Adroit</td><td rowspan=1 colspan=1>Rajeswaran et al. (2018)</td><td rowspan=1 colspan=1>Human, Expert (Rajeswaran et al., 2018)Cloned</td></tr><tr><td rowspan=1 colspan=1>Flow</td><td rowspan=1 colspan=1>Wu et al. (2017)</td><td rowspan=1 colspan=1>Random, Controller</td></tr><tr><td rowspan=1 colspan=1>Franka Kitchen</td><td rowspan=1 colspan=1>Gupta et al. (2019)</td><td rowspan=1 colspan=1>Complete, Partial, Mixed (Gupta et al., 2019)</td></tr><tr><td rowspan=1 colspan=1>CARLA</td><td rowspan=1 colspan=1>Dosovitskiy et al. (2017)</td><td rowspan=1 colspan=1>Controller</td></tr></table>
278
+
279
+ # D TRAINING AND EVALUATION TASK SPLIT
280
+
281
+ The following table lists our recommended protocol for hyperparameter tuning. Hyperparameters should be tuned on the tasks listed on the left in the “Training” column, and algorithms should be evaluated without tuning on the tasks in the right column labeled “Evaluation”.
282
+
283
+ Table 5: Our recommended partition of tasks into “training” tasks where hyperparameter tuning is allowed, and “evaluation” tasks where final algorithm performance should be reported.
284
+
285
+ <table><tr><td rowspan=1 colspan=1>Domain</td><td rowspan=1 colspan=2>Training</td><td rowspan=1 colspan=1>Evaluation</td></tr><tr><td rowspan=1 colspan=1>Maze2D</td><td rowspan=1 colspan=2>maze2d-umazemaze2d-mediummaze2d-large</td><td rowspan=1 colspan=1>maze2d-eval-umazemaze2d-eval-mediummaze2d-eval-large</td></tr><tr><td rowspan=1 colspan=1>AntMaze</td><td rowspan=1 colspan=2>ant-umazeant-umaze-diverseant-medium-playant-medium-diverseant-large-playant-large-diverse</td><td rowspan=1 colspan=1>ant-eval-umazeant-eval-umaze-diverseant-eval-medium-playant-eval-medium-diverseant-eval-large-playant-eval-large-diverse</td></tr><tr><td rowspan=1 colspan=1>Adroit</td><td rowspan=1 colspan=2>pen-humanpen-clonedpen-expertdoor-humandoor-cloneddoor-expert</td><td rowspan=1 colspan=1>hammer-humanhammer-clonedhammer-expertrelocate-humanrelocate-clonedrelocate-expert</td></tr><tr><td rowspan=2 colspan=1>Gym</td><td rowspan=2 colspan=2>halfcheetah-randomhalfcheetah-mediumhalfcheetah-mixedhalfcheetah-medium-expertwalker2d-randomwalker2d-mediumwalker2d-mixedwalker2d-medium-expert</td><td rowspan=2 colspan=1>hopper-randomhopper-mediumhopper-mixedhopper-medium-expertant-randomant-mediumant-mixedand-medium-expert</td></tr><tr><td rowspan=1 colspan=1></td></tr></table>
286
+
287
+ # E EXPERIMENT DETAILS
288
+
289
+ For all experiments, we used default hyperparameter settings and minimal modifications to public implementations wherever possible, using 500K training iterations or gradient steps. The code bases we used for evaluation are listed below. The most significant deviation from original published algorithms was that we used an unofficial continuous-action implementation of REM (Agarwal et al., 2019b), which was originally implemented for discrete action spaces. We ran our experiments using Google cloud platform (GCP) on n1-standard-4 machines.
290
+
291
+ • BRAC and AlgaeDICE: https://github.com/google-research/ google-research
292
+ • AWR: https://github.com/xbpeng/awr
293
+ • SAC: https://github.com/vitchyr/rlkit
294
+ • BEAR: https://github.com/aviralkumar2907/BEAR
295
+ • Continuous-action REM: https://github.com/theSparta/off_policy_ mujoco
296
+ • BCQ: https://github.com/sfujim/BCQ
297
+ • CQL: https://github.com/aviralkumar2907/CQL
298
+
299
+ # F ASSESSING THE FEASIBILITY OF HARD TASKS
300
+
301
+ Few prior methods were able to successfully solve carlatown or the larger AntMaze tasks. While including tasks that present a challenge for current methods is important to ensure that our benchmark has room for improvement, it is also important to provide some confidence that the tasks are actually solvable. We verified this in two ways. First, we ensured that the trajectories observed in these tasks have adequate coverage of the state space. An illustration of the trajectories in the CARLA and AntMaze tasks are shown below, where trajectories are shown as different colored lines and the goal state is marked with a star. We see that in carla-town and AntMaze, each lane or corridor is traversed multiple times by the agent.
302
+
303
+ Second, the data in AntMaze was generated by having the ant follow the same high-level planner in the maze as in Maze2D. Because Maze2D is solvable by most methods, we would expect this to mean that AntMaze is potentially solvable as well. This While the dynamics of the ant itself are much more complex, its walking gait is a relatively regular periodic motion, and since the high-level waypoints are similar, we would expect the AntMaze data to provide similar coverage as in the 2D mazes, as shown in the figures on the right. While the Ant has more erratic motion, both datasets cover the the majority of the maze thoroughly. A comparison of the state coverage between Maze2D and AntMaze on all tasks is shown in the following Appendix section G.
304
+
305
+ ![](images/e3b4c6ad762aad0af8c978e1a3c95390259a9ccf66efeecca66c5aae5e18c678.jpg)
306
+
307
+ # G MAZE DOMAIN TRAJECTORIES
308
+
309
+ In this section, we visualized trajectories for the datasets in the Maze2D and AntMaze domains. Each image plots the states visited along each trajectory as a different colored line, overlaid on top of the maze. The goal state is marked as a white star.
310
+
311
+ ![](images/439b1bf2b702e91267e4eb58af53dbd6c98540b3e0c8b95a03fcba981d816c65.jpg)
312
+ Figure 4: Trajectories visited in the Maze2D domain. From left-to-right: maze2d-umaze, maze2dmedium, and maze2d-large.
313
+
314
+ ![](images/ec0d50d66a590cb4b8b8b6d1f56c22be27240eeee0fbc7edace9e19a3ffb4233.jpg)
315
+ Figure 5: Trajectories visited in the AntMaze domain. Top row, from left-to-right: antmaze-umaze, antmaze-medium-play, and antmaze-large-play. Bottom row, from left-to-right: antmaze-umazediverse, antmaze-medium-diverse, and antmaze-large-diverse.
md/train/r1Oen--RW/r1Oen--RW.md ADDED
@@ -0,0 +1,305 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # THE (UN)RELIABILITY OF SALIENCY METHODS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Saliency methods aim to explain the predictions of deep neural networks. These methods lack reliability when the explanation is sensitive to factors that do not contribute to the model prediction. We use a simple and common pre-processing step —adding a mean shift to the input data— to show that a transformation with no effect on the model can cause numerous methods to incorrectly attribute. We define input invariance as the requirement that a saliency method mirror the sensitivity of the model with respect to transformations of the input. We show, through several examples, that saliency methods that do not satisfy a input invariance property are unreliable and can lead to misleading and inaccurate attribution.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ While considerable research has focused on discerning the decision process of neural networks (Baehrens et al., 2010; Simonyan & Zisserman, 2015; Haufe et al., 2014; Zeiler & Fergus, 2014; Springenberg et al., 2015; Bach et al., 2015; Yosinski et al., 2015; Nguyen et al., 2016; Montavon et al., 2017; Zintgraf et al., 2017; Sundararajan et al., 2017; Smilkov et al., 2017; Kindermans et al., 2017), there remains a trade-off between model complexity and interpretability. Research to address this tension is urgently needed; reliable explanations build trust with users, helps identify points of model failure, and removes barriers to entry for the deployment of deep neural networks in domains high stakes like health care and others.
12
+
13
+ In deep models, data representation is delegated to the model. We cannot generally say in an informative way what led to a model prediction. Instead, saliency methods aim to infer insights about the $f ( x )$ learnt by the model by ranking the explanatory power of constituent inputs. While unified in purpose, these methods are surprisingly divergent and non-overlapping in outcome. Evaluating the reliability of these methods is complicated by a lack of ground truth, as ground truth would depend upon full transparency into how a model arrives at a decision — the very problem we are trying to solve for in the first place (Sundararajan et al., 2017; Kindermans et al., 2017).
14
+
15
+ Given the need for a quantitative method of comparison, several properties such as completeness (Bach et al., 2015; Sundararajan et al., 2017), implementation invariance and sensitivity (Sundararajan et al., 2017) have been articulated as desirable to ensure that saliency methods are reliable. Implementation invariance, proposed as an axiom for attribution methods by Sundararajan et al. (2017), is the requirement that functionally equivalent networks (models with different architectures but equal outputs all inputs), always attribute in an identical way.
16
+
17
+ This work posits that a second invariance axiom, which we term input invariance, needs to be satisfied to ensure reliable interpretation of input contribution to the model prediction. Input invariance requires that the saliency method mirror the sensitivity of the model with respect to transformations of the input. We demonstrate that numerous methods do not satisfy input invariance using a simple transformation –mean shifts of the input– that does not affect model prediction or weights. We limit our treatment of input invariance to showing that there exist cases where this property is not satisfied and welcome future research on a broader treatment of this topic.
18
+
19
+ In this work we:
20
+
21
+ • introduce the axiom input invariance and demonstrate that certain saliency methods do not satisfy this property when considering a simple mean shift in the input. (See Fig. 3). • show that when input invariance is missing, the saliency method becomes unreliable and misleading.
22
+
23
+ ![](images/c0471910eddbb621978d5fd7eee150a2f0397786593cfa0cd7e8aadb72f5bebe.jpg)
24
+ Figure 1: Integrated gradients and Deep Taylor Decomposition determine input attribution relative to a chosen reference point. This choice determines the vantage point for all subsequent attribution. Using two example reference points for each method we demonstrate that changing the reference causes the attribution to diverge. The attributions are visualized by multiplying them with the input image as is done in the IG paper1 (Sundararajan et al., 2017). Visualisations were made on ImageNet (Russakovsky et al., 2015) and the VGG16 architecture (Simonyan & Zisserman, 2015).
25
+
26
+ • demonstrate that "reference point" methods—Integrated gradients and the Deep Taylor Decomposition—have diverging attribution and input invariance breaking points that depends upon the choice of reference (Fig. 1).
27
+
28
+ In Section 2, we detail our experiment framework. In Section 3, we determine that while the model is invariant to the input transformation considered, several saliency methods attribute to the mean shift. In Section 4 we discuss "reference point" methods and illustrate the importance of choosing an appropriate reference before discussing some directions of future research in Section 5.
29
+
30
+ # 2 THE MODEL IS INVARIANT TO A CONSTANT SHIFT IN INPUT
31
+
32
+ We show that, by construction, the bias of a neural network compensates for the mean shift resulting in two networks with identical weights and predictions. We first demonstrate this point and then describe the details of our experiment setup to evaluate the input invariance of a set of saliency methods.
33
+
34
+ We compare the attribution across two networks, $f _ { 1 } ( x )$ and $f _ { 2 } ( x )$ . $f _ { 1 } ( x )$ is a network trained on input $\pmb { x } _ { 1 } ^ { i }$ that denotes sample $i$ from training set $X _ { 1 }$ . The classification task of network 1 is:
35
+
36
+ $$
37
+ f _ { 1 } ( { \pmb x } _ { 1 } ^ { i } ) = { \pmb y } ^ { i } ,
38
+ $$
39
+
40
+ $f _ { 2 } ( x )$ is a network that predicts the classification of a transformed input $\pmb { x } _ { 2 } ^ { i }$ . The relationship between $\pmb { x } _ { 1 } ^ { i }$ and $\pmb { x } _ { 2 } ^ { i }$ is the addition of constant vector $\mathbf { \nabla } m _ { 2 }$ :
41
+
42
+ $$
43
+ \forall i , { \pmb x } _ { 2 } ^ { i } = { \pmb x } _ { 1 } ^ { i } + m _ { 2 } .
44
+ $$
45
+
46
+ Network 1 and 2 differ only by construction. Consider the first layer neuron before non-linearity in $f _ { 1 } ( x )$ :
47
+
48
+ $$
49
+ z = { \pmb w } ^ { T } { \pmb x } _ { 1 } + b _ { 1 } .
50
+ $$
51
+
52
+ We alter the biases in the first layer neuron by adding the mean shift $\mathbf { m } _ { 2 }$ . This now becomes Network 2:
53
+
54
+ $$
55
+ b _ { 2 } = b _ { 1 } - { \pmb w } ^ { T } m _ { 2 } .
56
+ $$
57
+
58
+ As a result the first layer activations are the same for $f _ { 1 } ( x )$ and $f _ { 2 } ( x )$ :
59
+
60
+ $$
61
+ \begin{array} { r } { \boldsymbol { z } = \boldsymbol { w } ^ { T } \mathbf { x } _ { 2 } + b _ { 2 } = \boldsymbol { w } ^ { T } \mathbf { x } _ { 1 } + \boldsymbol { w } ^ { T } \mathbf { m } _ { 2 } + b _ { 1 } - \boldsymbol { w } ^ { T } \mathbf { m } _ { 2 } . } \end{array}
62
+ $$
63
+
64
+ Note that the gradient with respect to the input remains unchanged as well:
65
+
66
+ $$
67
+ \frac { \partial f _ { 1 } ( \pmb { x } _ { 1 } ^ { i } ) } { \partial \pmb { x } _ { 1 } ^ { i } } = \frac { \partial f _ { 2 } ( \pmb { x } _ { 2 } ^ { i } ) } { \partial \pmb { x } _ { 2 } ^ { i } } .
68
+ $$
69
+
70
+ We have shown that Network 2 cancels out the mean shift transformation. This means that $f _ { 1 } ( x )$ and $f _ { 2 } ( x )$ have identical weights and produce the same output for the corresponding samples, $x _ { 1 } ^ { i } \in X _ { 1 }$ , $x _ { 2 } ^ { i } \in X _ { 2 }$ :
71
+
72
+ $$
73
+ \forall i , f _ { 1 } ( \pmb { x } _ { 1 } ^ { i } ) = f _ { 2 } ( \pmb { x } _ { 2 } ^ { i } ) .
74
+ $$
75
+
76
+ # 2.1 EXPERIMENTAL SETUP
77
+
78
+ In the implementation of this experimental framework, Network 1 is a 3 layer multi-layer perceptron with 1024 ReLu-activated neurons each. Network 1 classifies MNIST image inputs in a [0,1] encoding. Network 2 classifies MNIST image inputs in a [-1,0] MNIST encoding. The first network is trained for 10 epochs using mini-batch stochastic gradient descent (SGD). The second network is created using the approach above. The final accuracy is $9 8 . 3 \%$ for both3.
79
+
80
+ # 3 THE (IN)SENSITIVITY OF SALIENCY METHODS TO MEAN SHIFTS
81
+
82
+ In 3.1 we introduce key approaches to the classification of inputs as salient and the saliency methods we evaluate. In 3.2 we find that gradient and signal methods are input invariant. In 3.3 we find that most attribution methods considered have points where they start to break down.
83
+
84
+ # 3.1 SALIENCY METHODS CONSIDERED
85
+
86
+ Most saliency research to date has centered on convolutional neural networks. These saliency methods broadly fall into three different categories:
87
+
88
+ 1. Gradients (Sensitivity) (Baehrens et al., 2010; Simonyan et al., 2014)) shows how a small change to the input affects the classification score for the output of interest.
89
+ 2. Signal methods such as DeConvNet (Zeiler & Fergus, 2014), Guided BackProp (Springenberg et al., 2015) and PatternNet (Kindermans et al., 2017) aim to isolate input patterns that stimulate neuron activation in higher layers.
90
+ 3. Attribution methods such as Deep-Taylor Decomposition (Montavon et al., 2017) and Integrated Gradients (Sundararajan et al., 2017) assign importance to input dimensions by decomposing the value $y _ { j }$ at an output neuron $j$ into contributions from the individual input dimensions:
91
+
92
+ $$
93
+ \begin{array} { r } { { \pmb s } _ { j } = { \pmb A } ( { \pmb x } ) _ { j } . } \end{array}
94
+ $$
95
+
96
+ $s _ { j }$ is the decomposition into input contributions and has the same number of dimensions as $_ { \textbf { \em x } }$ , $A ( { \pmb x } ) _ { j }$ signifies the attribution method applied to output $j$ for sample $_ { \textbf { \em x } }$ . Attribution methods are distinguished from gradients by the insistence on completeness: the sum of all attributions should be approximately equal to the original output $y _ { i }$ .
97
+
98
+ ![](images/cd3f3a6712d9808a1921480af2b47bcbc8ace45a5d3ea88899d2241e39d2c8d0.jpg)
99
+ Figure 2: Evaluation of gradient and signal method sensitivity using MNIST with a [0,1] encoding for network $f _ { 1 }$ and a [-1,0] encoding for network $f _ { 2 }$ . Both gradients and signal methods produce identical saliency heatmaps for both networks.
100
+
101
+ We consider the input invariance of each category separately (by evaluating raw gradients, GuidedBackprop, Integrated Gradients and Deep Taylor Decomposition) and also benchmark the input invariance of SmoothGrad ((Smilkov et al., 2017)), a method that wraps around an underlying saliency approach and uses the addition of noise to produce a sharper visualization of the saliency heatmap.
102
+
103
+ The experiment setup and methodology is as described in Section 2. Each method is evaluated by comparing the saliency heatmaps for the predictions of network 1 and 2, where $\pmb { x } _ { 2 } ^ { i }$ is simply the mean shifted input $( \pmb { x } _ { 1 } ^ { i } + \pmb { m } _ { 2 } )$ . A saliency method that is not input invariant will not produce identical saliency heatmap for Network 1 and 2 despite the mean shift of the input.
104
+
105
+ # 3.2 THE SENSITIVITY AND SIGNAL METHODS SATISFY INPUT INVARIANT
106
+
107
+ Sensitivity and signal methods are not sensitive to the mean shift in inputs. In Fig. 2 raw gradients, PatternNet (PN, Kindermans et al. (2017)) and Guided Backprop (GB, Springenberg et al. (2015)) produce identical saliency heatmaps for both networks. Intuitively, gradient, PN and GB are input invariant given that we are comparing two networks with an identical $f ( x )$ . Both methods determine attribution entirely as a function of the network/pattern weights and thus will be input invariant as long as we are comparing networks with identical weights.
108
+
109
+ In the same manner, we can say that these methods will not be input invariant when comparing networks with different weights (even if we consider models with different architectures but identical predictions for every input).
110
+
111
+ # 3.3 THE ATTRIBUTION METHODS CONSIDERED
112
+
113
+ We evaluate the following attribution methods: gradient times input (GI), integrated gradients (IG, Sundararajan et al. (2017)) and the deep-taylor decomposition (DTD, Montavon et al. (2017)).
114
+
115
+ In 3.3.1 we find GI to be sensitive to meaningless input shifts. In 3.3.2 we group discussion of IG and DTD under "reference point" methods because both require that attribution is done in reference to a defined point. We find that the choice of reference point can cause input invariance to become arbitrary.
116
+
117
+ # 3.3.1 GRADIENT TIMES INPUT IS SENSITIVE TO MEAN SHIFT OF INPUTS
118
+
119
+ We find that the multiplication of raw gradients by the image breaks attribution reliability. In Fig. 3 GI produces different saliency heatmaps for both networks.
120
+
121
+ ![](images/812e7da6cdc3da17eec7161519f9c66bccbbbb8a808c814a2af5e36672025cab.jpg)
122
+ Figure 3: Evaluation of attribution method sensitivity using MNIST with a [0,1] encoding for network $f _ { 1 }$ and a [-1,0] encoding for network $f _ { 2 }$ . Gradient x Input, IG and DTD with a zero reference point, which is equivalent to LRP (Bach et al., 2015; Montavon et al., 2017), are not reliable and produce different attribution for each network. IG with a black image reference point and DTD with a PA reference point are not sensitive to the transformation of the input.
123
+
124
+ In 3.2 we determined that a heatmap of gradients alone is not sensitive to the input transformation.
125
+ GI multiplies the gradient w.r.t. the input with the input image.
126
+
127
+ $$
128
+ \mathbf { \boldsymbol { s } } _ { j } = \frac { \partial f ( \mathbf { \boldsymbol { x } } ) _ { j } } { \partial \mathbf { \boldsymbol { x } } } \odot \mathbf { \boldsymbol { x } } .
129
+ $$
130
+
131
+ Multiplying by the input means attribution is no longer reliable because the input shift is carried through to final attribution. Naive multiplication by the input, as noted by Smilkov et al. (2017), also constrains attribution without justification to inputs that are not 0.
132
+
133
+ # 3.3.2 RELIABILITY OF REFERENCE POINT METHODS DEPENDS ON THE CHOICE OF REFERENCE
134
+
135
+ Both Integrated Gradients (IG, Sundararajan et al. (2017)) and Deep Taylor Decomposition (DTD, Montavon et al. (2017)) determine the importance of inputs relative to a reference point. DTD refers to this as the root point and IG terms the reference point a baseline. The choice of reference point is not determined a priori by the method and instead left to end user.
136
+
137
+ The choice of reference point determines all subsequent attribution. In Fig. 1 IG and DTD show different attribution depending on the choice of reference point. We show that the certain reference point also cause IG and DTD to are not input invariant.
138
+
139
+ Integrated gradients (IG) Integrated Gradients (IG, (Sundararajan et al., 2017)) attribute the predicted score to each input with respect to a baseline $\scriptstyle { \mathbf { { \mathit { x } } } } _ { 0 }$ . This is achieved by constructing a set of inputs interpolating between the baseline and the input.
140
+
141
+ $$
142
+ s _ { j } = ( { \pmb x } - { \pmb x } _ { 0 } ) \odot \int _ { \alpha = 0 } ^ { 1 } \frac { \partial f ( { \pmb x } _ { 0 } + \alpha ( { \pmb x } - { \pmb x } _ { 0 } ) ) _ { i } } { \partial { \pmb x } } d \alpha
143
+ $$
144
+
145
+ Since this integral cannot be computed analytically, it is approximated by a finite sum ranging over $\alpha \in [ 0 , 1 ]$ .
146
+
147
+ $$
148
+ s _ { j } = ( \pmb { x } - \pmb { x } _ { 0 } ) \odot \sum _ { \alpha } \frac { \partial f ( \pmb { x } _ { 0 } + \alpha ( \pmb { x } - \pmb { x } _ { 0 } ) ) } { \partial \pmb { x } } .
149
+ $$
150
+
151
+ We evaluate whether two possible IG reference points satisfy input invariance. Firstly, we consider an image populated uniformly with the minimum pixel from the dataset $( { \pmb x } _ { 0 } = m i n ( { \pmb x } ) )$ (black image) and a zero vector image. We find that IG attribution under certain reference points is not input invariant. In Fig. 3, IG with black reference point produces identical attribution heatmaps whereas IG with a zero vector reference point is not input invariant.
152
+
153
+ IG using a black reference point is not sensitive to the mean input shift because ${ \pmb x } _ { 0 } = m i n ( { \pmb x } )$ is determined after the mean shift of the input so the difference between $_ { \textbf { \em x } }$ and $\scriptstyle { \mathbf { { \mathit { x } } } } _ { 0 }$ remains the same for both networks. In network 1 this is $( { \pmb x } _ { 1 } ) - m i n ( { \pmb x } _ { 1 } )$ and in network 2 this is $( x _ { 2 } + m _ { 2 } ) \textrm { -- }$ $m i n ( { \pmb x } _ { 2 } + m _ { 2 } )$ .
154
+
155
+ IG with a zero vector reference point is not input invariant because while the difference in network 1 is $( { \pmb x } _ { 1 } - { \pmb x } _ { 0 } )$ , the difference in network 2 becomes $( x _ { 2 } + m _ { 2 } ) - x _ { 0 }$ .
156
+
157
+ Deep Taylor Decomposition (DTD) determines attribution relative to a reference point neuron. DTD can satisfy input invariant if the right reference point is chosen. In the general formulation, the attribution of an input neuron $j$ is initialized to be equal to the output of that neuron. The attribution of other output neurons is set to zero. This attribution is backpropagated to its input neurons using the following distribution rule where $s _ { j } ^ { l }$ is the attribution assigned to neuron $j$ in layer $l$ :
158
+
159
+ $$
160
+ s _ { j } ^ { o u t p u t } = y , \qquad s _ { k \neq j } ^ { o u t p u t } = 0 , \qquad s ^ { l - 1 , j } = \frac { w \odot ( x - x _ { 0 } ) } { w ^ { T } x } s _ { j } ^ { l } .
161
+ $$
162
+
163
+ We evaluate the input invariance of DTD using a reference point determined by Layer-wise Relevance Propagation (LRP) and PatternAttribution (PA). In Fig. 3, DTD satisfies input invariance when using a reference point defined by PA however it loses reliability when using a reference point defined by LRP.
164
+
165
+ Layer-wise Relevance Propagation (LRP, Bach et al. (2015)) is sensitive to the input shift because it is a case of DTD where a zero vector is chosen as the root point.2. The back-propagation rule becomes:
166
+
167
+ $$
168
+ s _ { j } ^ { o u t p u t } = y , \qquad s _ { k \neq i } ^ { o u t p u t } = 0 , \qquad s ^ { l - 1 , j } = \frac { w \odot x } { w ^ { T } x } s _ { j } ^ { l } .
169
+ $$
170
+
171
+ $s ^ { l - 1 , j }$ depends only upon the input and so attribution will change between network 1 and 2 because $\scriptstyle { \mathbf { \mathscr { x } } } _ { 1 }$ andx2 differ by a constant vector.
172
+
173
+ PatternAttribution (PA) satisfies input invariance because the reference point $\scriptstyle { \mathbf { { \mathit { x } } } } _ { 0 }$ is defined as the natural direction of variation in the data (Kindermans et al., 2017). The natural direction of the data is determined based upon covariances and thus compensates explicitly for the mean in the data. Therefore it is by construction input invariant.
174
+
175
+ The PA root point is:
176
+
177
+ $$
178
+ \pmb { x } _ { 0 } = \pmb { x } - \pmb { a } \pmb { w } ^ { T } \pmb { x }
179
+ $$
180
+
181
+ where ${ \mathbf { } } a ^ { T } w = 1$
182
+
183
+ In a linear model:
184
+
185
+ $$
186
+ \mathbf { \delta } \mathbf { a } = \frac { \mathrm { c o v } [ \mathbf { \boldsymbol { x } } , \boldsymbol { y } ] } { \mathbf { w } ^ { T } \mathrm { c o v } [ \mathbf { \boldsymbol { x } } , \boldsymbol { y } ] } .
187
+ $$
188
+
189
+ For neurons followed by a ReLu non-linearity the vector $\textbf { \em a }$ accounts for the non-linearity and is computed as:
190
+
191
+ $$
192
+ \pmb { a } = \frac { E _ { + } [ \pmb { x } , y ] - E _ { + } [ \pmb { x } ] E [ y ] } { \pmb { w } ^ { T } ( E _ { + } [ \pmb { x } , y ] - E _ { + } [ \pmb { x } ] E [ y ] ) } .
193
+ $$
194
+
195
+ Here $E _ { + }$ denotes the expectation taken over values where $y$ is positive.
196
+
197
+ ![](images/f4f3391bb8513b8e3dd3a4f69689fe1eab99bff1e3d1aedeff70bf9a4f71fb19.jpg)
198
+ Figure 4: Smoothgrad inherits the invariance properties of the underlying attribution method. SG is not sensitive to the input transformation for gradient and signal methods (SG-PA and and SGGB). SG lacks input invariance for integrated gradients and deep taylor decomposition when a zero vector refernce point is used, but is not sensitive when PatternAttribution (SG-PA) or a black image (SG-Black) are used. SG is not input invariant for gradient $\mathbf { X }$ input.
199
+
200
+ PA reduces to the following step:
201
+
202
+ $$
203
+ s _ { i } ^ { o u t p u t } = y , \qquad s _ { j \neq i } ^ { o u t p u t } = 0 , \qquad s ^ { l - 1 , i } = w \odot a s _ { i } ^ { l } .
204
+ $$
205
+
206
+ The vector $\textbf { \em a }$ depends upon covariances and thus removes the mean shift of the input. The attribution for both networks is identical.
207
+
208
+ # 3.4 SMOOTHGRAD INHERITS THE SENSITIVITY PROPERTIES OF UNDERLYING METHODS
209
+
210
+ SmoothGrad (SG, Smilkov et al. (2017)) replaces the input with $_ \mathrm { N }$ identical versions of the input with added random noise. These noisy inputs are injected into the underlying attribution method and final attribution is the average attribution across N. For example, if the underlying methods are gradients w.r.t. the input. $\begin{array} { r } { g ( \pmb { x } ) _ { j } = \frac { \partial f ( \pmb { x } ) _ { j } } { \partial \pmb { x } } } \end{array}$ ∂f(x)j SG becomes:
211
+
212
+ $$
213
+ \frac { 1 } { N } \sum _ { i = 1 } ^ { N } g ( \pmb { x } + N ( 0 , \sigma ^ { 2 } ) ) _ { j }
214
+ $$
215
+
216
+ SG often results in aesthetically sharper visualizations when applied to multi-layer neural networks with non-linearities. SG does not alter the attribution method itself so will always inherit the input invariance of the underlying method. In Fig. 4 applying SG on top of gradients and signal methods (PA and GB) produces identical saliency maps. SG is not input invariant when applied to gradient x input, LRP and zero vector reference points which compares SG heatmaps generated for all methods discussed so far. SG is not sensitive to the input transformation when applied to PA and a black image.
217
+
218
+ ![](images/86968b037e39968a64f7a02e0d9d580447a581ad35a188d46c88cb3ea938a3be.jpg)
219
+
220
+ Figure 5: Evaluation of attribution method sensitivity using MNIST. Gradient x Input, IG with both a black and zero reference point and DTD with a LRP reference point, do not satisfy input invariance and produce different attribution for each network. DTD with a PA reference point are not sensitive to the transformation of the input.
221
+
222
+ # 4 THE IMPORTANCE OF CHOOSING AN APPROPRIATE REFERENCE POINT
223
+
224
+ IG and DTD do not satisfy input invariance under certain reference points. The reference point determines subsequent attribution. In fig.1 attribution visually diverges for the same method if multiple reference points are considered.
225
+
226
+ A reasonable reference point for IG and DTD will naturally depend upon domain and task. Unintentional misrepresentation of the model is very possible when the choice of vantage point can lead to very different results. Thus far, we have discussed attribution for image recognition tasks with the assumption that preprocessing steps are known and visual inspection of the points determined to be salient is possible. For Audio and Language based models where input interaction is more intricate, attribution becomes even more challenging.
227
+
228
+ If we cannot determine the implications of reference point choice, we are limited in our ability to say anything about the reliability of the method. To demonstrate this point, we construct a constant shift of the input that takes advantage of attribution points of failure discussed thus far. Almost all methods are sensitive to this input transformation which results in a misleading explanation of the model prediction.
229
+
230
+ Network 1 is the same as introduced in Section 2. We consider a transformation $\pmb { x } _ { 2 } ^ { i }$ of the input $\pmb { x } _ { 1 } ^ { i }$ which is a MNIST image.
231
+
232
+ In this experiment $\mathbf { m } _ { 2 }$ is the vector of an image of a checkered box. Consistent with Section 2 the relationship between $\pmb { x } _ { 1 } ^ { i }$ and the transformed input $\pmb { x } _ { 2 } ^ { i }$ is the addition of a constant vectors $\mathbf { m } _ { 2 }$ .
233
+
234
+ $$
235
+ \forall i , { \pmb x } _ { 2 } ^ { i } = { \pmb x } _ { 1 } ^ { i } + m _ { 2 } .
236
+ $$
237
+
238
+ Network 2 is identical to network 1 by construction (see Section 2). Note that $\pmb { x } _ { 2 } ^ { i }$ and ${ \pmb x } _ { 3 } ^ { i }$ are scored by Network 2 separately.
239
+
240
+ # "Cat"astrophic Attribution Failure
241
+
242
+ MNIST $^ +$ Constant Shift
243
+
244
+ ![](images/bea14f55db50d1b5b820cebd84c50a4bea9a7a8a9da159e7d4c721b7b88b1706.jpg)
245
+ Attribution Methods
246
+
247
+ ![](images/4b8b888b0766ee8f973f429129d38f9422d515cfad6ac847920feb746883fa69.jpg)
248
+ Figure 6: Evaluation of attribution method sensitivity using MNIST. Gradient x Input, IG with both a black and zero reference point and DTD with a LRP reference point, do not satisfy input invariance and produce different attribution for each network. DTD with a PA reference point are not sensitive to the transformation of the input.
249
+
250
+ In Fig. 5 all attribution methods except for PA are sensitive to this constant shift. The result is that we are able to manipulate the attribution heatmap of an MNIST prediction so that the chosen sample $\hat { \pmb x }$ appears. Using a black image as a reference point for IG no longer satisfies input invariance (as it did in the experiments in Section 3).
251
+
252
+ The sample $\hat { \pmb x }$ can be any abitrary vector. We conduct the same experiment with a hand drawn kitten image. We construct $\mathbf { \nabla } m _ { 2 }$ by choosing a desired attribution $\hat { \boldsymbol { s } }$ that should be assigned to a specific sample $\hat { \pmb x }$ when the gradient is multiplied with the input.
253
+
254
+ We compute a $\mathbf { m } _ { 2 }$ that will ensure the specific $\pmb { x } _ { 2 } ^ { i }$ receives the desired attribution as follows:
255
+
256
+ $$
257
+ \begin{array} { r } { m _ { 2 } = \frac { \hat { \pmb { s } } } { \frac { \partial f _ { 1 } ( \pmb { x } ) } { \partial \pmb { x } } } - \pmb { x } . } \end{array}
258
+ $$
259
+
260
+ To make sure that the original image is still recognizable as belonging to its class, we clip the shift to be within [-.3,.3]. Of course, the attributions of the other samples in the dataset is impacted too.
261
+
262
+ In Fig. 6 we see that we are again able to purposefully misrepresent the explanation of the model prediction.
263
+
264
+ It is important to note that that some of these methods would have satisfied input invariance if the data had been normalized prior to attribution. For example, IG with a black baseline will satisfy input invariance if the data is always normalized. However, this is far from a systematic treatment of the reference point selection and there are cases outside of our experiment scope where this would not be sufficient. We believe an open research question is furthering the understanding of reference point choice that guarantee reliability without relying on case-by-case solutions.
265
+
266
+ # 5 CONCLUSION
267
+
268
+ Saliency methods are powerful tools to gain intuition about our model. We consider some examples that can cause a break in the reliability of these methods. We show that we are able to purposefully create a deceptive explanation of the network using a hand drawn kitten image.
269
+
270
+ We introduce input invariance as a prerequisite for reliable attribution. Our treatment of input invariance is restricted to demonstrating there is at least one input transformation that causes attribution to fail. We hope this work drives further discussion on this subject. We also acknowledge that saliency methods may still provide intuition for image recognition tasks even if they are not input invariant. Our work is motivated in part because while we can visually inspect for catasthropic attribution failure in images, other modalities (like audio or word vectors) are more opaque and prone to unintentional misrepresentation.
271
+
272
+ # ACKNOWLEDGEMENTS
273
+
274
+ We will thank everyone in the final version. But it goes without saying that we are grateful to our parents.
275
+
276
+ # REFERENCES
277
+
278
+ Sebastian Bach, Alexander Binder, Grégoire Montavon, Frederick Klauschen, Klaus-Robert Müller, and Wojciech Samek. On pixel-wise explanations for non-linear classifier decisions by layer-wise relevance propagation. PloS one, 10(7):e0130140, 2015.
279
+
280
+ David Baehrens, Timon Schroeter, Stefan Harmeling, Motoaki Kawanabe, Katja Hansen, and KlausRobert Müller. How to explain individual classification decisions. Journal of Machine Learning Research, 11(Jun):1803–1831, 2010.
281
+
282
+ Stefan Haufe, Frank Meinecke, Kai Görgen, Sven Dähne, John-Dylan Haynes, Benjamin Blankertz, and Felix Bießmann. On the interpretation of weight vectors of linear models in multivariate neuroimaging. Neuroimage, 87:96–110, 2014.
283
+
284
+ Pieter-Jan Kindermans, Kristof Schütt, Klaus-Robert Müller, and Sven Dähne. Investigating the influence of noise and distractors on the interpretation of neural networks. arXiv preprint arXiv:1611.07270, 2016.
285
+
286
+ Pieter-Jan Kindermans, Kristof T Schütt, Maximilian Alber, Klaus-Robert Müller, Dumitru Erhan, Been Kim, and Sven Dähne. Learning how to explain neural networks: Patternnet and patternattribution. arXiv preprint arXiv:1705.05598v2, 2017.
287
+
288
+ Grégoire Montavon, Sebastian Lapuschkin, Alexander Binder, Wojciech Samek, and Klaus-Robert Müller. Explaining nonlinear classification decisions with deep taylor decomposition. Pattern Recognition, 65:211–222, 2017.
289
+
290
+ Anh Nguyen, Alexey Dosovitskiy, Jason Yosinski, Thomas Brox, and Jeff Clune. Synthesizing the preferred inputs for neurons in neural networks via deep generator networks. In Advances in Neural Information Processing Systems, pp. 3387–3395, 2016.
291
+
292
+ Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, et al. Imagenet large scale visual recognition challenge. International Journal of Computer Vision, 115(3):211–252, 2015.
293
+
294
+ Avanti Shrikumar, Peyton Greenside, Anna Shcherbina, and Anshul Kundaje. Not just a black box: Learning important features through propagating activation differences. CoRR, abs/1605.01713, 2016. URL http://arxiv.org/abs/1605.01713.
295
+
296
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In ICLR, 2015.
297
+
298
+ Karen Simonyan, Andrea Vedaldi, and Andrew Zisserman. Deep inside convolutional networks: Visualising image classification models and saliency maps. In ICLR, 2014.
299
+
300
+ Daniel Smilkov, Nikhil Thorat, Been Kim, Fernanda Viégas, and Martin Wattenberg. Smoothgrad: removing noise by adding noise. arXiv preprint arXiv:1706.03825, 2017.
301
+ Jost Tobias Springenberg, Alexey Dosovitskiy, Thomas Brox, and Martin Riedmiller. Striving for simplicity: The all convolutional net. In ICLR, 2015.
302
+ Mukund Sundararajan, Ankur Taly, and Qiqi Yan. Axiomatic attribution for deep networks. arXiv preprint arXiv:1703.01365, 2017.
303
+ Jason Yosinski, Jeff Clune, Thomas Fuchs, and Hod Lipson. Understanding neural networks through deep visualization. In ICML Workshop on Deep Learning, 2015.
304
+ Matthew D Zeiler and Rob Fergus. Visualizing and understanding convolutional networks. In European Conference on Computer Vision, pp. 818–833. Springer, 2014.
305
+ Luisa M Zintgraf, Taco S Cohen, Tameem Adel, and Max Welling. Visualizing deep neural network decisions: Prediction difference analysis. In ICLR, 2017.
md/train/r1lYRjC9F7/r1lYRjC9F7.md ADDED
@@ -0,0 +1,275 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ENABLING FACTORIZED PIANO MUSIC MODELING AND GENERATION WITH THE MAESTRO DATASET
2
+
3
+ Curtis Hawthorne?, Andriy Stasyuk?, Adam Roberts?, Ian Simon?, Cheng-Zhi Anna Huang?, Sander Dieleman†, Erich Elsen?, Jesse Engel? & Douglas Eck? ?Google Brain, †DeepMind
4
+
5
+ {fjord,astas,adarob,iansimon,annahuang,sedielem,eriche,jesseengel,deck}@google.com
6
+
7
+ # ABSTRACT
8
+
9
+ Generating musical audio directly with neural networks is notoriously difficult because it requires coherently modeling structure at many different timescales. Fortunately, most music is also highly structured and can be represented as discrete note events played on musical instruments. Herein, we show that by using notes as an intermediate representation, we can train a suite of models capable of transcribing, composing, and synthesizing audio waveforms with coherent musical structure on timescales spanning six orders of magnitude ${ \sim } 0 . 1 ~ \mathrm { m s }$ to ${ \sim } 1 0 0$ s), a process we call Wave2Midi2Wave. This large advance in the state of the art is enabled by our release of the new MAESTRO (MIDI and Audio Edited for Synchronous TRacks and Organization) dataset, composed of over 172 hours of virtuosic piano performances captured with fine alignment $( \approx 3 { \mathrm { ~ m s } } )$ between note labels and audio waveforms. The networks and the dataset together present a promising approach toward creating new expressive and interpretable neural models of music.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Since the beginning of the recent wave of deep learning research, there have been many attempts to create generative models of expressive musical audio de novo. These models would ideally generate audio that is both musically and sonically realistic to the point of being indistinguishable to a listener from music composed and performed by humans.
14
+
15
+ However, modeling music has proven extremely difficult due to dependencies across the wide range of timescales that give rise to the characteristics of pitch and timbre (short-term) as well as those of rhythm (medium-term) and song structure (long-term). On the other hand, much of music has a large hierarchy of discrete structure embedded in its generative process: a composer creates songs, sections, and notes, and a performer realizes those notes with discrete events on their instrument, creating sound. The division between notes and sound is in many ways analogous to the division between symbolic language and utterances in speech.
16
+
17
+ The WaveNet model by van den Oord et al. (2016) may be the first breakthrough in generating musical audio directly with a neural network. Using an autoregressive architecture, the authors trained a model on audio from piano performances that could then generate new piano audio sample-bysample. However, as opposed to their highly convincing speech examples, which were conditioned on linguistic features, the authors lacked a conditioning signal for their piano model. The result was audio that sounded very realistic at very short time scales (1 or 2 seconds), but that veered off into chaos beyond that.
18
+
19
+ Dieleman et al. (2018) made great strides towards providing longer term structure to WaveNet synthesis by implicitly modeling the discrete musical structure described above. This was achieved by training a hierarchy of VQ-VAE models at multiple time-scales, ending with a WaveNet decoder to generate piano audio as waveforms. While the results are impressive in their ability to capture long-term structure directly from audio waveforms, the resulting sound suffers from various artifacts at the fine-scale not present in the unconditional WaveNet, clearly distinguishing it from real musical audio. Also, while the model learns a version of discrete structure from the audio, it is not directly reflective of the underlying generative process and thus not interpretable or manipulable by a musician or user.
20
+
21
+ ![](images/41090d5a14a7564e35104023d0c7d0f04538a62b22b9b6242dc23121681e6279.jpg)
22
+ Figure 1: Wave2Midi2Wave system architecture for our suite of piano music models, consisting of (a) a conditional WaveNet model that generates audio from MIDI, (b) a Music Transformer language model that generates piano performance MIDI autoregressively, and (c) a piano transcription model that “encodes” piano performance audio as MIDI.
23
+
24
+ Manzelli et al. (2018) propose a model that uses a WaveNet to generate solo cello music conditioned on MIDI notation. This overcomes the inability to manipulate the generated sequence. However, their model requires a large training corpus of labeled audio because they do not train a transcription model, and it is limited to monophonic sequences.
25
+
26
+ In this work, we seek to explicitly factorize the problem informed by our prior understanding of the generative process of performer and instrument:
27
+
28
+ $$
29
+ P ( a u d i o ) = \mathbb { E } _ { n o t e s } \left[ P ( a u d i o | n o t e s ) \right]
30
+ $$
31
+
32
+ which can be thought of as a generative model with a discrete latent code of musical notes. Since the latent representation is discrete, and the scale of the problem is too large to jointly train, we split the model into three separately trained modules that are each state-of-the-art in their respective domains:
33
+
34
+ 1. Encoder, $P ( n o t e s | a u d i o )$ : An Onsets and Frames (Hawthorne et al., 2018) transcription model to produce a symbolic representation (MIDI) from raw audio. 2. Prior, $P ( n o t e s )$ : A self-attention-based music language model (Huang et al., 2018) to generate new performances in MIDI format based on those transcribed in (1). 3. Decoder, $P ( a u d i o | n o t e s )$ : A WaveNet (van den Oord et al., 2016) synthesis model to generate audio of the performances conditioned on MIDI generated in (2).
35
+
36
+ We call this process Wave2Midi2Wave.
37
+
38
+ One hindrance to training such a stack of models is the lack of large-scale annotated datasets like those that exist for images. We overcome this barrier by curating and publicly releasing alongside this work a piano performance dataset containing well-aligned audio and symbolic performances an order of magnitude larger than the previous benchmarks.
39
+
40
+ In addition to the high quality of the samples our method produces (see https://goo.gl/ magenta/maestro-examples), training a suite of models according to the natural musician/instrument division has a number of other advantages. First, the intermediate representation used is more suitable for human interpretation and manipulation. Similarly, factorizing the model in this way provides better modularity: it is easy to independently swap out different performance and instrument models. Using an explicit performance representation with modern language models also allows us to model structure at much larger time scales, up to a minute or so of music. Finally, we can take advantage of the large amount of prior work in the areas of symbolic music generation and conditional audio generation. And by using a state-of-the-art music transcription model, we can make use of the same wealth of unlabeled audio recordings previously only usable for training end-to-end models by transcribing unlabeled audio recordings and feeding them into the rest of our model.
41
+
42
+ # 2 CONTRIBUTIONS OF THIS PAPER
43
+
44
+ Our contributions are as follows:
45
+
46
+ 1. We combine a transcription model, a language model, and a MIDI-conditioned WaveNet model to produce a factorized approach to musical audio modeling capable of generating about one minute of coherent piano music.
47
+ 2. We provide a new dataset of piano performance recordings and aligned MIDI, an order of magnitude larger than previous datasets.
48
+ 3. Using an existing transcription model architecture trained on our new dataset, we achieve state-of-the-art results on a piano transcription benchmark.
49
+
50
+ # 3 DATASET
51
+
52
+ We partnered with organizers of the International Piano-e-Competition1 for the raw data used in this dataset. During each installment of the competition, virtuoso pianists perform on Yamaha Disklaviers which, in addition to being concert-quality acoustic grand pianos, utilize an integrated high-precision MIDI capture and playback system. Recorded MIDI data is of sufficient fidelity to allow the audition stage of the competition to be judged remotely by listening to contestant performances reproduced over the wire on another Disklavier instrument.
53
+
54
+ The dataset introduced in this paper, which we name MAESTRO (“MIDI and Audio Edited for Synchronous TRacks and Organization”), contains over a week of paired audio and MIDI recordings from nine years of International Piano-e-Competition events.2 The MIDI data includes key strike velocities and sustain pedal positions. Audio and MIDI files are aligned with ${ \approx } 3$ ms accuracy and sliced to individual musical pieces, which are annotated with composer, title, and year of performance. Uncompressed audio is of CD quality or higher $\mathrm { 4 4 . 1 - 4 8 \ k H z \ 1 6 }$ -bit PCM stereo). A train/validation/test split configuration is also proposed, so that the same composition, even if performed by multiple contestants, does not appear in multiple subsets. Repertoire is mostly classical, including composers from the $1 7 ^ { \mathrm { t h } }$ to early $\bar { 2 } 0 ^ { \mathrm { t h } }$ century. Table 1 contains aggregate statistics of the MAESTRO dataset.
55
+
56
+ Table 1: Statistics of the MAESTRO dataset.
57
+
58
+ <table><tr><td>Split</td><td>Performances</td><td>Compositions (approx.)</td><td>Duration, hours</td><td>Size, GB</td><td>Notes, millions</td></tr><tr><td>Train</td><td>954</td><td>295</td><td>140.1</td><td>83.6</td><td>5.06</td></tr><tr><td rowspan="3">Validation Test</td><td>105</td><td>60</td><td>15.3</td><td>9.1</td><td>0.54</td></tr><tr><td>125</td><td>75</td><td>16.9</td><td>10.1</td><td>0.57</td></tr><tr><td>1184</td><td>430</td><td>172.3</td><td>102.8</td><td>6.18</td></tr></table>
59
+
60
+ We make the new dataset (MIDI, audio, metadata, and train/validation/test split configuration) available at https://g.co/magenta/maestro-datasetunder a Creative Commons Attribution Non-Commercial Share-Alike 4.0 license.
61
+
62
+ Several datasets of paired piano audio and MIDI have been published previously and have enabled significant advances in automatic piano transcription and related topics. We are making MAESTRO available because we believe it provides several advantages over existing datasets. Most significantly, as evident from table 2, MAESTRO is around an order of magnitude larger. Existing datasets also have different properties than MAESTRO that affect model training:
63
+
64
+ MusicNet (Thickstun et al., 2017) contains recordings of human performances, but separatelysourced scores. As discussed in Hawthorne et al. (2018), the alignment between audio and score is not fully accurate. One advantage of MusicNet is that it contains instruments other than piano (not counted in table 2) and a wider variety of recording environments.
65
+
66
+ MAPS (Emiya et al., 2010) contains Disklavier recordings and synthesized audio created from MIDI files that were originally entered via sequencer. As such, the “performances” are not as natural as the MAESTRO performances captured from live performances. In addition, synthesized audio makes up a large fraction of the MAPS dataset. MAPS also contains syntheses and recordings of individual notes and chords, not counted in table 2.
67
+
68
+ Saarland Music Data (SMD) (Muller et al., 2011) is similar to MAESTRO in that it contains¨ recordings and aligned MIDI of human performances on a Disklavier, but is 30 times smaller.
69
+
70
+ Table 2: Comparison with other datasets.
71
+
72
+ <table><tr><td>Dataset</td><td>Performances</td><td>Compositions</td><td>Duration, hours</td><td>Notes, millions</td></tr><tr><td>SMD</td><td>50</td><td>50</td><td>4.7</td><td>0.15</td></tr><tr><td>MusicNet</td><td>156</td><td>60</td><td>15.3</td><td>0.58</td></tr><tr><td>MAPS</td><td>270</td><td>208</td><td>17.9</td><td>0.62</td></tr><tr><td>MAESTRO</td><td>1184</td><td>~430</td><td>172.3</td><td>6.18</td></tr></table>
73
+
74
+ # 3.1 ALIGNMENT
75
+
76
+ Our goal in processing the data from International Piano-e-Competition was to produce pairs of audio and MIDI files time-aligned to represent the same musical events. The data we received from the organizers was a combination of MIDI files recorded by Disklaviers themselves and WAV audio captured with conventional recording equipment. However, because the recording streams were independent, they differed widely in start times and durations, and they were also subject to jitter. Due to the large volume of content, we developed an automated process for aligning, slicing, and time-warping provided audio and MIDI to ensure a precise match between the two.
77
+
78
+ Our approach is based on globally minimizing the distance between CQT frames from the real audio and synthesized MIDI (using FluidSynth3). Obtaining a highly accurate alignment is non-trivial, and we provide full details in the appendix.
79
+
80
+ # 3.2 DATASET SPLITTING
81
+
82
+ For all experiments in this paper, we use a single train/validation/test split designed to satisfy the following criteria:
83
+
84
+ • No composition should appear in more than one split.
85
+ • Train/validation/test should make up roughly 80/10/10 percent of the dataset (in time), respectively. These proportions should be true globally and also within each composer. Maintaining these proportions is not always possible because some composers have too few compositions in the dataset.
86
+ • The validation and test splits should contain a variety of compositions. Extremely popular compositions performed by many performers should be placed in the training split.
87
+
88
+ For comparison with our results, we recommend using the splits which we have provided. We do not necessarily expect these splits to be suitable for all purposes; future researchers are free to use alternate experimental methodologies.
89
+
90
+ # 4 PIANO TRANSCRIPTION
91
+
92
+ The large MAESTRO dataset enables training an automatic piano music transcription model that achieves a new state of the art. We base our model on Onsets and Frames, with several modifications informed by a coarse hyperparameter search using the validation split. For full details of the base model architecture and training procedure, refer to Hawthorne et al. (2018).
93
+
94
+ One important modification was adding an offset detection head, inspired by Kelz et al. (2018). The offset head feeds into the frame detector but is not directly used during decoding. The offset labels are defined to be the $3 2 \mathrm { m s }$ following the end of each note.
95
+
96
+ We also increased the size of the bidirectional LSTM layers from 128 to 256 units, changed the number of filters in the convolutional layers from 32/32/64 to 48/48/96, and increased the units in the fully connected layer from 512 to 768. We also stopped gradient propagation into the onset subnetwork from the frame network, disabled weighted frame loss, and switched to HTK frequency spacing (Young et al., 2006) for the mel-frequency spectrogram input. In general, we found that the best ways to get higher performance with the larger dataset were to make the model larger and simpler.
97
+
98
+ The final important change we made was to start using audio augmentation during training using an approach similar to the one described in McFee et al. (2017). During training, every input sample was modified using random parameters for the $S o X ^ { 4 }$ audio tool using pysox (Bittner et al., 2016). The parameters, ranges, and random sampling methods are described in table 3. We found that this was particularly important when evaluating on the MAPS dataset, likely because the audio augmentation made the model more robust to differences in recording environment and piano qualities. The differences in training results are summarized in table 6. When evaluating against the MAESTRO dataset, we found that audio augmentation made results slightly worse, so results in table 5 are presented without audio augmentation.
99
+
100
+ Table 3: Audio augmentation parameters.
101
+
102
+ <table><tr><td rowspan=1 colspan=2>Description</td><td rowspan=1 colspan=1>Scale</td><td rowspan=1 colspan=1>Range</td><td rowspan=1 colspan=1>Sampling</td></tr><tr><td rowspan=6 colspan=2>pitch shiftcontrast (compression)equalizer 1equalizer 2reverbpinknoise</td><td rowspan=1 colspan=1>semitones</td><td rowspan=1 colspan=1>-0.1-0.1</td><td rowspan=1 colspan=1>linear</td></tr><tr><td rowspan=1 colspan=1>amount</td><td rowspan=1 colspan=1>0.0-100.0</td><td rowspan=1 colspan=1>linear</td></tr><tr><td rowspan=1 colspan=1>frequency</td><td rowspan=1 colspan=1>32.0-4096.0</td><td rowspan=2 colspan=1>loglog</td></tr><tr><td rowspan=2 colspan=1></td><td rowspan=1 colspan=1>frequency</td><td rowspan=1 colspan=1>32.0-4096.0</td></tr><tr><td rowspan=1 colspan=1>reverberance</td><td rowspan=1 colspan=1>0.0-70.0</td><td rowspan=1 colspan=1>log</td></tr><tr><td rowspan=1 colspan=1>volume</td><td rowspan=1 colspan=1>0.0-0.04</td><td rowspan=1 colspan=1>linear</td></tr></table>
103
+
104
+ After training on the MAESTRO training split for $6 7 0 \mathrm { k }$ steps, we achieved state of the art results described in table 4 for the MAPS dataset. We also present our results on the train, validation, and test splits of the MAESTRO dataset as a new baseline score in table 5. Note that for calculating the scores of the train split, we use the full duration of the files without splitting them into 20-second chunks as is done during training.
105
+
106
+ <table><tr><td rowspan="2"></td><td colspan="3">Frame</td><td colspan="3">Note</td><td colspan="3">Note w/ offset</td><td colspan="3">Note w/offset &amp; velocity</td></tr><tr><td>P</td><td>R</td><td>F1</td><td>P</td><td>R</td><td>F1</td><td>P</td><td>R</td><td>F1</td><td>P</td><td>R</td><td>F1</td></tr><tr><td>Hawthorne et al. (2018)</td><td>88.53</td><td>70.89</td><td>78.30</td><td>84.24</td><td>80.67</td><td>82.29</td><td>51.32</td><td>49.31</td><td>50.22</td><td>35.52</td><td>30.80</td><td>35.39</td></tr><tr><td>Kelz et al. (2018)</td><td>90.73</td><td>67.85</td><td>77.16</td><td>90.15</td><td>74.78</td><td>81.38</td><td>61.93</td><td>51.66</td><td>56.08</td><td></td><td></td><td></td></tr><tr><td>Onsets&amp; Frames (MAESTRO)</td><td>92.86</td><td>78.46</td><td>84.91</td><td>87.46</td><td>85.58</td><td>86.44</td><td>68.22</td><td>66.75</td><td>67.43</td><td>52.41</td><td>51.22</td><td>51.77</td></tr></table>
107
+
108
+ Table 4: Transcription Precision, Recall, and F1 Results on MAPS configuration 2 test dataset (ENSTDkCl and ENSTDkAm full-length .wav files). Training was done on the MAESTRO trianing set with audio augmentation. Scores are calculated using the same method as in Hawthorne et al. (2018). Note-based scores calculated by the mir eval library, frame-based scores as defined in Bay et al. (2009). Final metric is the mean of scores calculated per piece.
109
+
110
+ In sections 5 and 6, we demonstrate how using this transcription model enables training language and synthesis models on a large set of unlabeled piano data. To do this, we transcribe the audio in the MAESTRO training set, although in theory any large set of unlabeled piano music would work. We
111
+
112
+ <table><tr><td rowspan="2"></td><td colspan="3">Frame</td><td colspan="3">Note</td><td colspan="3">Note w/offset</td><td colspan="3">Note W/offset &amp; velocity</td></tr><tr><td>P</td><td>R</td><td>F1</td><td>P</td><td>R</td><td>F1</td><td>P</td><td>R</td><td>F1</td><td>P</td><td>R</td><td>F1</td></tr><tr><td>Train</td><td>94.23</td><td>92.58</td><td>93.35</td><td>98.88</td><td>94.41</td><td>96.56</td><td>88.13</td><td>84.19</td><td>86.09</td><td>84.98</td><td>81.20</td><td>83.02</td></tr><tr><td>Validation</td><td>91.69</td><td>87.80</td><td>89.58</td><td>98.42</td><td>92.61</td><td>95.38</td><td>82.93</td><td>78.17</td><td>80.44</td><td>80.36</td><td>75.75</td><td>77.95</td></tr><tr><td>Test</td><td>92.11</td><td>88.41</td><td>90.15</td><td>98.27</td><td>92.61</td><td>95.32</td><td>82.95</td><td>78.24</td><td>80.50</td><td>79.89</td><td>75.37</td><td>77.54</td></tr></table>
113
+
114
+ Table 5: Results from training the modified Onsets and Frames model on the MAESTRO train split without audio augmentation. Precision, Recall, and F1 Results on the splits of the MAESTRO dataset. Calculations done in the same manner as table 4.
115
+
116
+ <table><tr><td></td><td>Frame F1</td><td>Note F1</td><td>Note w/ offset F1</td><td>Note w/ offset &amp; velocity F1</td></tr><tr><td>WithAudio Augmentation (MAPS)</td><td>84.91</td><td>86.44</td><td>67.43</td><td>51.77</td></tr><tr><td>Without Audio Augmentation (MAPS)</td><td>82.02</td><td>83.04</td><td>61.84</td><td>48.07</td></tr><tr><td>WithAudio Augmentation (MAESTRO)</td><td>89.19</td><td>94.80</td><td>79.67</td><td>76.04</td></tr><tr><td>Without Audio Augmentation (MAESTRO)</td><td>90.15</td><td>95.32</td><td>80.50</td><td>77.54</td></tr></table>
117
+
118
+ Table 6: Comparisons between results of training the same model with the same number of steps (670k) with and without audio augmentation. Training was done on the MAESTRO training set and evaluation was on either the MAPS configuration 2 test set as in table 4 or the MAESTRO test set as in table 5.
119
+
120
+ call this new, transcribed version of the training set MAESTRO-T. While it is true that the audio transcribed for MAESTRO-T was also used to train the transcription model, table 5 shows that the model performance is not significantly different between the training split and the validation or test splits, and we needed the larger split to enable training the other models.
121
+
122
+ # 5 MUSIC TRANSFORMER TRAINING
123
+
124
+ For our generative language model, we use the decoder portion of a Transformer (Vaswani et al., 2017) with relative self-attention, which has previously shown compelling results in generating music with longer-term coherence (Huang et al., 2018). We trained two models, one on MIDI data from the MAESTRO dataset and another on MIDI transcriptions inferred by Onsets and Frames from audio in MAESTRO, referred to as MAESTRO-T in section 4. For full details of the model architecture and training procedure, refer to Huang et al. (2018).
125
+
126
+ We used the same training procedure for both datasets. We trained on random crops of 2048 events and employed transposition and time compression/stretching data augmentation. The transpositions were uniformly sampled in the range of a minor third below and above the original piece. The time stretches were at discrete amounts and uniformly sampled from the set $\{ 0 . 9 \mathrm { { 5 } , 0 . 9 7 5 , 1 . 0 , 1 . 0 2 5 , 1 . 0 5 } \}$ .
127
+
128
+ We evaluated both of the models on their respective validation splits.
129
+
130
+ Table 7: Validation Negative Log-Likelihood, with event-based representation.
131
+
132
+ <table><tr><td>Model variation</td><td>NLL on their respective validation splits</td></tr><tr><td>Music TransformertrainedonMAESTRO</td><td>1.84</td></tr><tr><td>Music Transformer trained on MAESTRO-T</td><td>1.72</td></tr></table>
133
+
134
+ Samples outputs from the Music Transformer model can be heard in the Online Supplement (https://goo.gl/magenta/maestro-examples).
135
+
136
+ # 6 PIANO SYNTHESIS
137
+
138
+ Most commercially available systems that are able to synthesize a MIDI sequence into a piano audio signal are concatenative: they stitch together snippets of audio from a large library of recordings of individual notes. While this stitching process can be quite ingenious, it does not optimally capture the various interactions between notes, whether they are played simultaneously or in sequence. An alternative but less popular strategy is to simulate a physical model of the instrument. Constructing an accurate model constitutes a considerable engineering effort and is a field of research by itself (Bank et al., 2010; Valimaki et al., 2012).
139
+
140
+ WaveNet (van den Oord et al., 2016) is able to synthesize realistic instrument sounds directly in the waveform domain, but it is not as adept at capturing musical structure at timescales of seconds or longer. However, if we provide a MIDI sequence to a WaveNet model as conditioning information, we eliminate the need for capturing large scale structure, and the model can focus on local structure instead, i.e., instrument timbre and local interactions between notes. Conditional WaveNets are also used for text-to-speech (TTS), and have been shown to excel at generating realistic speech signals conditioned on linguistic features extracted from textual data. This indicates that the same setup could work well for music audio synthesis from MIDI sequences.
141
+
142
+ Our WaveNet model uses a similar autoregressive architecture to van den Oord et al. (2016), but with a larger receptive field: 6 (instead of 3) sequential stacks with 10 residual block layers each. We found that a deeper context stack, namely 2 stacks with 6 layers each arranged in a series, worked better for this task. We also updated the model to produce 16-bit output using a mixture of logistics as described in van den Oord et al. (2018).
143
+
144
+ The input to the context stack is an onset “piano roll” representation, a size-88 vector signaling the onset of any keys on the keyboard, with 4ms bins $( 2 5 0 \mathrm { H z } )$ . Each element of the vector is a float that represents the strike velocity of a piano key in the $4 \mathrm { m s }$ frame, scaled to the range [0, 1]. When there is no onset for a key at a given time, the value is 0.
145
+
146
+ We initially trained three models:
147
+
148
+ Unconditioned Trained only with the audio from the combined MAESTRO training/validation splits with no conditioning signal.
149
+
150
+ Ground Trained with the ground truth audio/MIDI pairs from the combined MAESTRO training/validation splits.
151
+
152
+ Transcribed Trained with ground truth audio and MIDI inferred from the audio using the Onsets and Frames method, referred to as MAESTRO-T in section 4.
153
+
154
+ The resulting losses after 1M training steps were 3.72, 3.70 and 3.84, respectively. Due to teacher forcing, these numbers do not reflect the quality of conditioning, so we rely on human judgment for evaluation, which we address in the following section.
155
+
156
+ It is interesting to note that the WaveNet model recreates non-piano subtleties of the recording, including the response of the room, breathing of the player, and shuffling of listeners in their seats. These results are encouraging and indicate that such methods could also capture the sound of more dynamic instruments (such as string and wind instruments) for which convincing synthesis/sampling methods lag behind piano.
157
+
158
+ Due to the heterogeneity of the ground truth audio quality in terms of microphone placement, ambient noise, etc., we sometime notice “timbral shifts” during longer outputs from these models. We therefore additionally trained a model conditioned on a one-hot year vector at each timestep (similar to speaker conditioning in TTS), which succeeds in producing consistent timbres and ambient qualities during long outputs (see Online Supplement).
159
+
160
+ A side effect of arbitrary windowing of the training data across note boundaries is a sonic crash that often occurs at the beginning of generated outputs. To sidestep this issue, we simply trim the first 2 seconds of all model outputs reported in this paper, and in the Online Supplement (https: //goo.gl/magenta/maestro-examples).
161
+
162
+ # 7 LISTENING TESTS
163
+
164
+ Since our ultimate goal is to create realistic musical audio, we carried out a listening study to determine the perceived quality of our method. To separately assess the effects of transcription, language modeling, and synthesis on the listeners’ responses, we presented users with two 20-second clips5 drawn from the following sets, each relying on an additional model from our factorization:
165
+
166
+ Ground Truth Recordings Clips randomly selected from the MAESTRO validation audio split.
167
+
168
+ WaveNet Unconditioned Clips generated by the Unconditioned WaveNet model described in section 6.
169
+
170
+ WaveNet Ground/Test Clips generated by the Ground WaveNet model described in section 6, conditioned on random 20-second MIDI subsequences from the MAESTRO test split.
171
+
172
+ WaveNet Transcribed/Test Clips generated by the Transcribed WaveNet model described in section 6, conditioned on random 20-second subsequences from the MAESTRO test split.
173
+
174
+ WaveNet Transcribed/Transformer Clips generated by the Transcribed WaveNet model described in section 6, conditioned on random 20-second subsequences from the Music Transformer model described in section 5 that was trained on MAESTRO-T.
175
+
176
+ The final set of samples demonstrates the full end-to-end ability of taking unlabeled piano performances, inferring MIDI labels via transcription, generating new performances with a language model trained on the inferred MIDI, and rendering new audio as though it were played on a similar piano—all without any information other than raw audio recordings of piano performances.
177
+
178
+ Participants were asked which clip they thought sounded more like a recording of somebody playing a musical piece on a real piano, on a Likert scale. 640 ratings were collected, with each source involved in 128 pair-wise comparisons. Figure 2 shows the number of comparisons in which performances from each source were selected as more realistic.
179
+
180
+ ![](images/9a79aaaa18e43122bd304f43d676e5c34e5ce20a15183d37a0cb440eccc640c6.jpg)
181
+ Figure 2: Results of our listening tests, showing the number of times each source won in a pairwise comparison. Black error bars indicate estimated standard deviation of means.
182
+
183
+ A Kruskal-Wallis H test of the ratings showed that there is at least one statistically significant difference between the models: $\chi ^ { 2 } ( 2 ) \stackrel { - } { = } 6 7 . 6 3 , p < 0 . 0 0 1$ . A post-hoc analysis using the Wilcoxon signed-rank test with Bonferroni correction showed that there was not a statistically significant difference in participant ratings between real recordings and samples from the WaveNet Ground/Test and WaveNet Transcribed/Test models with $p > 0 . 0 1 / 1 0$ .
184
+
185
+ Audio of some of the examples used in the listening tests is available in the Online Supplement (https://goo.gl/magenta/maestro-examples).
186
+
187
+ # 8 CONCLUSION
188
+
189
+ We have demonstrated the Wave2Midi2Wave system of models for factorized piano music modeling, all enabled by the new MAESTRO dataset. In this paper we have demonstrated all capabilities on the same dataset, but thanks to the new state-of-the-art piano transcription capabilities, any large set of piano recordings could be used,6 which we plan to do in future work. After transcribing the recordings, the transcriptions could be used to train a WaveNet and a Music Transformer model, and then new compositions could be generated with the Transformer and rendered with the WaveNet. These new compositions would have similar musical characteristics to the music in the original dataset, and the audio renderings would have similar acoustical characteristics to the source piano.
190
+
191
+ The most promising future work would be to extend this approach to other instruments or even multiple simultaneous instruments. Finding a suitable training dataset and achieving sufficient transcription performance will likely be the limiting factors.
192
+
193
+ The new dataset (MIDI, audio, metadata, and train/validation/test split configurations) is available at https://g.co/magenta/maestro-datasetunder a Creative Commons Attribution NonCommercial Share-Alike 4.0 license. The Online Supplement, including audio examples, is available at https://goo.gl/magenta/maestro-examples.
194
+
195
+ # ACKNOWLEDGMENTS
196
+
197
+ We would like to thank Michael E. Jones and Stella Sick for their help in coordinating the release of the source data and Colin Raffel for his careful review and comments on this paper.
198
+
199
+ # REFERENCES
200
+
201
+ B. Bank, S. Zambon, and F. Fontana. A modal-based real-time piano synthesizer. IEEE Transactions on Audio, Speech, and Language Processing, 18(4):809–821, May 2010. ISSN 1558-7916. doi: 10.1109/TASL.2010.2040524.
202
+
203
+ Mert Bay, Andreas F Ehmann, and J Stephen Downie. Evaluation of multiple-f0 estimation and tracking systems. In ISMIR, pp. 315–320, 2009.
204
+
205
+ Rachel Bittner, Eric Humphrey, and Juan Bello. Pysox: Leveraging the audio signal processing power of sox in python. In Proceedings of the International Society for Music Information Retrieval Conference Late Breaking and Demo Papers, 2016.
206
+
207
+ Judith C. Brown. Calculation of a constant q spectral transform. The Journal of the Acoustical Society of America, 89(1):425–434, 1991. doi: 10.1121/1.400476.
208
+
209
+ Sander Dieleman, Aaron van den Oord, and Karen Simonyan. The challenge of realistic music ¨ generation: modelling raw audio at scale. arXiv preprint arXiv:1806.10474, 2018.
210
+
211
+ Valentin Emiya, Nancy Bertin, Bertrand David, and Roland Badeau. MAPS - A piano database for multipitch estimation and automatic transcription of music. Research report, July 2010. URL https://hal.inria.fr/inria-00544155.
212
+
213
+ Curtis Hawthorne, Erich Elsen, Jialin Song, Adam Roberts, Ian Simon, Colin Raffel, Jesse Engel, Sageev Oore, and Douglas Eck. Onsets and frames: Dual-objective piano transcription. In Proceedings of the 19th International Society for Music Information Retrieval Conference, 2018.
214
+
215
+ Cheng-Zhi Anna Huang, Ashish Vaswani, Jakob Uszkoreit, Noam Shazeer, Curtis Hawthorne, Andrew M Dai, Matthew D Hoffman, and Douglas Eck. An improved relative self-attention mechanism for transformer with application to music generation. arXiv preprint arXiv:1809.04281, 2018.
216
+
217
+ Rainer Kelz, Sebastian Bock, and Gerhard Widmer. Deep polyphonic adsr piano note transcription. In Late Breaking/Demos, Proceedings of the 19th International Society for Music Information Retrieval Conference, 2018.
218
+
219
+ Thakkar Vijay Manzelli, Rachel and, Ali Siahkamari, and Brian Kulis. Combining deep generative raw audio models for structured automatic music. In 19th International Society for Music Information Retrieval Conference, ISMIR, 2018.
220
+
221
+ Brian McFee, Matt McVicar, Oriol Nieto, Stefan Balke, Carl Thome, Dawen Liang, Eric Battenberg, Josh Moore, Rachel Bittner, Ryuichi Yamamoto, Dan Ellis, Fabian-Robert Stoter, Douglas Repetto, Simon Waloschek, CJ Carr, Seth Kranzler, Keunwoo Choi, Petr Viktorin, Joao Felipe Santos, Adrian Holovaty, Waldir Pimenta, Hojin Lee, and Paul Brossier. librosa 0.5.1, May 2017. URL https://doi.org/10.5281/zenodo.1022770.
222
+
223
+ Meinard Muller. ¨ Fundamentals of music processing: Audio, analysis, algorithms, applications. Springer, 2015.
224
+
225
+ Meinard Muller, Verena Konz, Wolfgang Bogler, and Vlora Arifi-M ¨ uller. Saarland music data ¨ (SMD). 2011.
226
+
227
+ Colin Raffel and Daniel P W Ellis. Intuitive analysis, creation and manipulation of midi data with pretty midi. 2014.
228
+
229
+ Hiroaki Sakoe and Seibi Chiba. Dynamic programming algorithm optimization for spoken word recognition. IEEE transactions on acoustics, speech, and signal processing, 26(1):43–49, 1978.
230
+
231
+ Christian Schorkhuber and Anssi Klapuri. Constant-q transform toolbox for music processing. In ¨ Proceedings of the 7th Sound and Music Computing Conference, Barcelona, Spain, July 2010.
232
+
233
+ John Thickstun, Zaid Harchaoui, and Sham Kakade. Learning features of music from scratch. In International Conference on Learning Representations (ICLR), 2017.
234
+
235
+ Vesa Valimaki, Julian D Parker, Lauri Savioja, Julius O Smith, and Jonathan S Abel. Fifty years of artificial reverberation. IEEE Transactions on Audio, Speech, and Language Processing, 20(5): 1421–1448, 2012.
236
+
237
+ Aaron van den Oord, Sander Dieleman, Heiga Zen, Karen Simonyan, Oriol Vinyals, Alex Graves, ¨ Nal Kalchbrenner, Andrew W Senior, and Koray Kavukcuoglu. WaveNet: A generative model for raw audio. In SSW, pp. 125, 2016.
238
+
239
+ Aaron van den Oord, Yazhe Li, Igor Babuschkin, Karen Simonyan, Oriol Vinyals, Koray ¨ Kavukcuoglu, George van den Driessche, Edward Lockhart, Luis Cobo, Florian Stimberg, Norman Casagrande, Dominik Grewe, Seb Noury, Sander Dieleman, Erich Elsen, Nal Kalchbrenner, Heiga Zen, Alex Graves, Helen King, Tom Walters, Dan Belov, and Demis Hassabis. Parallel WaveNet: Fast high-fidelity speech synthesis. In Proceedings of the 35th International Conference on Machine Learning, 2018.
240
+
241
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in Neural Information Processing Systems, pp. 5998–6008, 2017.
242
+
243
+ S Young, G Evermann, M Gales, T Hain, D Kershaw, X Liu, G Moore, J Odell, D Ollason, D Povey, et al. The htk book (v3. 4). Cambridge University, 2006.
244
+
245
+ # APPENDIX
246
+
247
+ In this appendix, we describe in detail how the MAESTRO dataset from section 3 was aligned and segmented.
248
+
249
+ # COARSE ALIGNMENT
250
+
251
+ The key idea for the alignment process was that even an untrained human can recognize whether two performances are of the same score based on raw audio, disregarding differences in the instrument or recording equipment used. Hence, we synthesized the provided MIDI (using FluidSynth with a SoundFont sampled from recordings of a Disklavier7) and sought to define an audio-based difference metric that could be minimized to find the best-alignment shift for every audio/MIDI pair.
252
+
253
+ We wanted the metric to take harmonic features into account, so as a first step we used librosa (McFee et al., 2017) to compute the Constant-Q Transform (Brown, 1991; Schorkhuber & Klapuri, ¨ 2010) of both original and synthesized audio. For the initial alignment stage we picked a hop length of 4096 samples $( \sim 9 0 ~ \mathrm { m s } )$ as a trade-off between speed and accuracy, which proved reasonable for most of the repertoire.8 Microphone setup varied between competition years and stages, resulting in varying frequency response and overall amplitude levels in recordings, especially in the lower and higher ends of the piano range. To account for that, we limited the CQT to 48 buckets aligned with MIDI notes C2–B5, and also converted amplitude levels to dB scale with maximum absolute amplitude as a reference point and a hard cut-off at -80 dB. Original and synthesized audio also differed in sound decay rate, so we normalized the resulting CQT arrays time-wise by dividing each hop column by its minimum value (averaged over a 5-hop window).
254
+
255
+ A single MIDI file from a Disklavier typically covered several hours of material corresponding to a sequence of shorter audio files from several seconds up to an hour long. We slid the normalized CQT of each such original audio file against a window of synthesized MIDI CQT of the same length and used mean squared error (MSE) between the two as the difference metric.9 Minimum error determined best alignment, after which we attempted to align the next audio file in sequence with the remaining length of the corresponding MIDI file. Due to the length of MIDI files, it was impractical to calculate MSE at each possible shift, so instead we trimmed silence at the beginning of audio, and attempted to align it with the first “note on” event of the MIDI file, within $\pm 1 2$ minutes tolerance. If the minimum error was still high, we attempted alignment at the next “note on” event after a 30-second silence.
256
+
257
+ This approach allowed us to skip over unusable sections of MIDI recordings that did not correspond to audio, e.g., instrument tuning and warm-ups, and also non-musical segments of audio such as applause and announcements. Non-piano sounds also considerably increased the MSE metric for very short audio files, so we had to either concatenate those with their longer neighbors if they had any musical material or exclude them completely. Events that were present at the beginning of audio files beyond the chosen shift tolerance which did not correspond to MIDI had to be cut off manually. In order to recover all musically useful data we also had to manually repair several MIDI files where the clock had erroneously jumped, causing the remainder of the file to be out of sync with corresponding audio.
258
+
259
+ After tuning process parameters and addressing the misaligned audio/MIDI pairs detected by unusually high CQT MSE, we have reached the state where each competition year (i.e., different audio recording setup) has final metric values for all pairs within a close range. Spot-checking the pairs with the highest MSE values for each year confirmed proper alignment, which allowed us to proceed to the segmentation stage.
260
+
261
+ # SEGMENTATION
262
+
263
+ Since certain compositions were performed by multiple contestants,10 we needed to segment the aligned audio/MIDI pairs further into individual musical pieces, so as to enable splitting the data into train, validation, and test sets disjoint on compositions. While the organizers provided the list of composition metadata for each audio file, for some competition years timing information was missing. In such cases we greedily sliced audio/MIDI pairs at the longest silences between MIDI notes up to the expected number of musical pieces.
264
+
265
+ Where expected piece duration data was available, we applied search with backtracking roughly as follows. As an invariant, the segmentation algorithm maintained a list of intervals as start–end time offsets along with a list of expected piece durations, so that the total length of the piece durations corresponding to each interval was less than the interval duration (within a certain tolerance). At each step we picked the next longest MIDI silence and determined which interval it belonged to. Then we split that interval in two at the silence and attempted to split the corresponding sequence of durations as well, satisfying the invariant. For each suitable split the algorithm continued to the next longest silence. If multiple splits were possible, the algorithm preferred the ones that divided the piece durations more evenly according to a heuristic. If no such split was possible, the algorithm either skipped current silence if it was short11 and attempted to split at the next one, or backtracked otherwise. It also backtracked if no more silences longer than 3 seconds were available. The algorithm succeeded as soon as each interval corresponded to exactly one expected piece duration.
266
+
267
+ Once a suitable segmentation was found, we sliced each audio/MIDI pair at resulting intervals, additionally trimming short clusters of notes at the beginning or end of each segment that appeared next to long MIDI silences in order to cut off additional non-music events (e.g., tuning or contestants testing the instrument during applause), and adding an extra 1 second of padding at both ends before making the final cut.
268
+
269
+ # FINE ALIGNMENT
270
+
271
+ After the initial alignment and segmentation, we applied Dynamic Time Warping (DTW) to account for any jitter in either the audio or MIDI recordings. DTW has seen wide use in audio-to-MIDI alignment; for an overview see Muller (2015). We follow the ¨ align midi example from pretty midi (Raffel & Ellis, 2014), except that we use a custom $\mathrm { C } { + + }$ DTW implementation for improved speed and memory efficiency to allow for aligning long sequences.
272
+
273
+ First, in Python, we use librosa to load the audio and resample it to a $2 2 { , } 0 5 0 \mathrm { H z }$ mono signal. Next, we load the MIDI and synthesize it at the same sample rate, using the same FluidSynth process as above. Then, we pad the end of the shorter of the two sample arrays so they are the same length. We use the same procedure as align midi to extract CQTs from both sample arrays, except that we use a hop length of 64 to achieve a resolution of ${ \sim } 3 \mathrm { m s }$ . We then pass these CQTs to our $\mathrm { C } { + } { + }$ DTW implementation. To avoid calculating the full distance matrix and taking its mean to get a penalty value, we instead sample $1 0 0 \mathrm { k }$ random pairs and use the mean of their cosine distances.
274
+
275
+ We use the same DTW algorithm as implemented in librosa except that we calculate cosine distances only within a Sakoe-Chiba band radius (Sakoe & Chiba, 1978) of 2.5 seconds instead of calculating distances for all pairs. Staying within this small band limits the number of calculations we need to make and the number of distances we have to store in memory. This is possible because we know from the previous alignment pass that the sequences are already mostly aligned and we just need to account for small constant offsets due to the lower resolution of the previous process and apply small sequence warps to recover from any occasional jitter.
md/train/rJNwDjAqYX/rJNwDjAqYX.md ADDED
@@ -0,0 +1,278 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LARGE-SCALE STUDY OF CURIOSITY-DRIVEN LEARNING
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Reinforcement learning algorithms rely on carefully engineered rewards from the environment that are extrinsic to the agent. However, annotating each environment with hand-designed, dense rewards is difficult and not scalable, motivating the need for developing reward functions that are intrinsic to the agent. Curiosity is such intrinsic reward function which uses prediction error as a reward signal. In this paper: (a) We perform the first large-scale study of purely curiosity-driven learning, i.e. without any extrinsic rewards, across 54 standard benchmark environments, including the Atari game suite. Our results show surprisingly good performance as well as a high degree of alignment between the intrinsic curiosity objective and the hand-designed extrinsic rewards of many games. (b) We investigate the effect of using different feature spaces for computing prediction error and show that random features are sufficient for many popular RL game benchmarks, but learned features appear to generalize better (e.g. to novel game levels in Super Mario Bros.). (c) We demonstrate limitations of the predictionbased rewards in stochastic setups. Game-play videos and code are at https: //doubleblindsupplementary.github.io/large-curiosity/.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Reinforcement learning (RL) has emerged as a popular method for training agents to perform complex tasks. In RL, the agent’s policy is trained by maximizing a reward function that is designed to align with the task. The rewards are extrinsic to the agent and specific to the environment they are defined for. Most of the success in RL has been achieved when this reward function is dense and well-shaped, e.g., a running “score” in a video game (Mnih et al., 2015). However, designing a wellshaped reward function is a notoriously challenging engineering problem. An alternative to “shaping” an extrinsic reward is to supplement it with dense intrinsic rewards (Oudeyer & Kaplan, 2009), that is, rewards that are generated by the agent itself. Examples of intrinsic reward include “curiosity” (Mohamed & Rezende, 2015; Schmidhuber, 1991b; Singh et al., 2005; Houthooft et al., 2016; Pathak et al., 2017) which uses prediction error as reward signal, and “visitation counts” (Bellemare et al., 2016; Ostrovski et al., 2017; Poupart et al., 2006; Lopes et al., 2012) which discourages the agent from revisiting the same states. The idea is that these intrinsic rewards will bridge the gaps between sparse extrinsic rewards by guiding the agent to efficiently explore the environment to find the next extrinsic reward.
12
+
13
+ But what about scenarios with no extrinsic reward at all? This is not as strange as it sounds. Developmental psychologists talk about intrinsic motivation (i.e., curiosity) as the primary driver in the early stages of development (Smith & Gasser, 2005; Ryan, 2000): babies appear to employ goal-less exploration to learn skills that will be useful later on in life. There are plenty of other examples, from playing Minecraft to visiting your local zoo, where no extrinsic rewards are required. Indeed, there is evidence that pre-training an agent on a given environment using only intrinsic rewards allows it to learn much faster when fine-tuned to a novel task in a novel environment (Pathak et al., 2017; 2018). Yet, so far, there has been no systematic study of learning with only intrinsic rewards.
14
+
15
+ In this paper, we perform a large-scale empirical study of agents driven purely by intrinsic rewards across a range of diverse simulated environments. In particular, we choose the dynamics-based curiosity model of intrinsic reward presented in Pathak et al. (2017) because it is scalable and trivially parallelizable, making it ideal for large-scale experimentation. The central idea is to represent intrinsic reward as the error in predicting the consequence of the agent’s action given its current state, i.e., the prediction error of learned forward-dynamics of the agent. We thoroughly investigate the dynamics-based curiosity across 54 environments: video games, physics engine simulations, and virtual 3D navigation tasks, shown in Figure 1.
16
+
17
+ ![](images/11c31c3f15d047622a34cc071b9044a1f147cee9aec05bd9c95b4216f8dd3c79.jpg)
18
+ Figure 1: A snapshot of the 54 environments investigated in the paper. We show that agents are able to make progress using no extrinsic reward, or end-of-episode signal, and only using curiosity. Video results, code and models at https://doubleblindsupplementary.github.io/large-curiosity/.
19
+
20
+ To develop a better understanding of curiosity-driven learning, we further study the crucial factors that determine its performance. In particular, predicting the future state in the high dimensional raw observation space (e.g., images) is a challenging problem and, as shown by recent works (Pathak et al., 2017; Stadie et al., 2015), learning dynamics in an auxiliary feature space leads to improved results. However, how one chooses such an embedding space is a critical, yet open research problem. To ensure stable online training of dynamics, we argue that the desired embedding space should: 1) be compact in terms of dimensionality, 2) preserve sufficient information about the observation, and 3) be a stationary function of the observations.
21
+
22
+ Through systematic ablation, we examine the role of different ways to encode agent’s observation such that an agent can perform well, driven purely by its own curiosity. Here “performing well” means acting purposefully and skillfully in the environment. This can be assessed quantitatively, in some cases, by measuring extrinsic rewards or environment-specific measures of exploration, or qualitatively, by observing videos of the agent interacting. We show that encoding observations via a random network turn out to be a simple, yet surprisingly effective technique for modeling curiosity across many popular RL benchmarks. This might suggest that many popular RL video game testbeds are not as visually sophisticated as commonly thought. Interestingly, we discover that although random features are sufficient for good performance in environments that were used for training, the learned features appear to generalize better (e.g., to novel game levels in Super Mario Bros.).
23
+
24
+ The main contributions of this paper are: (a) Large-scale study of curiosity-driven exploration across a variety of environments including: the set of Atari games (Bellemare et al., 2013), Super Mario Bros., virtual 3D navigation in Unity (Juliani et al., 2018), multi-player Pong, and Roboschool (Schulman et al., 2017) environments. (b) Extensive investigation of different feature spaces for learning the dynamics-based curiosity: random features, pixels, inverse-dynamics (Pathak et al., 2017) and variational auto-encoders (Kingma & Welling, 2013) and evaluate generalization to unseen environments. (c) Analysis of some limitations of a direct prediction-error based curiosity formulation. We observe that if the agent itself is the source of stochasticity in the environment, it can reward itself without making any actual progress. We empirically demonstrate this limitation in a 3D navigation task where the agent controls different parts of the environment.
25
+
26
+ # 2 DYNAMICS-BASED CURIOSITY-DRIVEN LEARNING
27
+
28
+ Consider an agent that sees an observation $x _ { t }$ , takes an action $a _ { t }$ and transitions to the next state with observation $x _ { t + 1 }$ . We want to incentivize this agent with a reward $r _ { t }$ relating to how informative the transition was. To provide this reward, we use an exploration bonus involving the following elements: (a) a network to embed observations into representations $\phi ( x )$ , (b) a forward dynamics network to predict the representation of the next state conditioned on the previous observation and action $p ( \phi ( x _ { t + 1 } ) | x _ { t } , a _ { t } )$ . Given a transition tuple $\{ x _ { t } , x _ { t + 1 } , a _ { t } \}$ , the exploration reward is then defined as $r _ { t } = - \log p ( \phi ( x _ { t + 1 } ) | x _ { t } , a _ { t } )$ , also called the surprisal (Achiam & Sastry, 2017).
29
+
30
+ An agent trained to maximize this reward will favor transitions with high prediction error, which will be higher in areas where the agent has spent less time, or in areas with complex dynamics. Such a dynamics-based curiosity has been shown to perform quite in some cases (Pathak et al., 2017), especially when the dynamics are learned in an embedding space rather than raw observations. In this paper, we explore dynamics-based curiosity further. We use mean-squared error corresponding to a fixed-variance Gaussian density as surprisal, i.e., $\lVert f ( x _ { t } , a _ { t } ) - \phi ( x _ { t + 1 } ) \rVert _ { 2 } ^ { 2 }$ where f is the learned dynamics model. However, any other density model could be used.
31
+
32
+ # 2.1 FEATURE SPACES FOR FORWARD DYNAMICS
33
+
34
+ Consider the representation $\phi$ in the curiosity formulation above. If $\phi ( x ) = x$ , the forward dynamics model makes predictions in the observation space. A good choice of feature space can make the prediction task more tractable and filter out irrelevant aspects of the observation space. But what makes a good feature space for dynamics driven curiosity? We propose the qualities that a good feature space must have:
35
+
36
+ • Compactness: The features should be easy to model by being low(er)-dimensional and filtering out irrelevant parts of the observation space. Sufficiency: The features should contain all the important information. Otherwise, the agent may fail to be rewarded for exploring some relevant aspect of the environment.
37
+ • Stability: Non-stationary rewards make it difficult for reinforcement agents to learn. Exploration bonuses by necessity introduce non-stationarity since what is new and novel becomes old and boring with time. In a dynamics-based curiosity formulation, there are two sources of non-stationarity: the forward dynamics model is evolving over time as it is trained and the features are changing as they learn. The former is intrinsic to the method, and the latter should be minimized where possible
38
+
39
+ In this work, we systematically investigate the efficacy of a number of feature-learning methods, summarized briefly as follows:
40
+
41
+ Pixels The simplest case is where $\phi ( x ) = x$ and we fit our forward dynamics model in the observation space. Pixels are sufficient, since no information has been thrown away, and stable since there is no feature learning component. However, learning from pixels is tricky because the observation space may be high-dimensional and complex.
42
+
43
+ Random Features (RF) The next simplest case is where we take our embedding network, a convolutional network, and fix it after random initialization. Because the network is fixed, the features are stable. The features can be made compact in dimensionality, but they are not constrained to be. However, random features may fail to be sufficient.
44
+
45
+ Variational Autoencoders (VAE) VAEs were introduced in (Kingma & Welling, 2013; Rezende et al., 2014) to fit latent variable generative models $p ( x , z )$ for observed data $x$ and latent variable $z$ with prior $p ( z )$ using variational inference. The method calls for an inference network $q ( z | x )$ that approximates the posterior $p ( z | x )$ . This is a feedforward network that takes an observation as input and
46
+
47
+ Table 1: Table summarizing the categorization of different kinds of feature spaces considered.
48
+
49
+ <table><tr><td></td><td>VAE</td><td>IDF</td><td>RF</td><td>Pixels</td></tr><tr><td>Stable</td><td>No</td><td>No</td><td>Yes</td><td>Yes</td></tr><tr><td>Compact</td><td>Yes</td><td>Yes</td><td>Maybe</td><td>No</td></tr><tr><td>Sufficient</td><td>Yes</td><td>Maybe</td><td>Maybe</td><td>Yes</td></tr></table>
50
+
51
+ outputs a mean and variance vector describing a Gaussian distribution with diagonal covariance. We can then use the mapping to the mean as our embedding network $\phi$ . These features will be a low-dimensional approximately sufficient summary of the observation, but they may still contain some irrelevant details such as noise, and the features will change over time as the VAE trains.
52
+
53
+ Inverse Dynamics Features (IDF) Given a transition $( s _ { t } , s _ { t + 1 } , a _ { t } )$ the inverse dynamics task is to predict the action $a _ { t }$ given the previous and next states $s _ { t }$ and $s _ { t + 1 }$ . Features are learned using a common neural network $\phi$ to first embed $s _ { t }$ and $s _ { t + 1 }$ . The intuition is that the features learned should correspond to aspects of the environment that are under the agent’s immediate control. This feature learning method is easy to implement and in principle should be invariant to certain kinds of noise (see (Pathak et al., 2017) for a discussion). A potential downside could be that the features learned may not be sufficient, that is they do not represent important aspects of the environment that the agent cannot immediately affect.
54
+
55
+ A summary of these characteristics is provided in Table 1. Note that the learned features are not stable because their distribution changes as learning progresses. One way to achieve stability could be to pre-train VAE or IDF networks. However, unless one has access to the internal state of the game, it is not possible to get a representative data of the game scenes to train the features. One way is to act randomly to collect data, but then it will be biased to where the agent started, and won’t generalize further. Since all the features involve some trade-off of desirable properties, it becomes an empirical question as to how effective each of them is across environments.
56
+
57
+ # 2.2 PRACTICAL CONSIDERATIONS IN TRAINING AN AGENT DRIVEN PURELY BY CURIOSITY
58
+
59
+ Deciding upon a feature space is only first part of the puzzle in implementing a practical system. Here, we detail the critical choices we made in the learning algorithm. Our goal was to reduce nonstationarity in order to make learning more stable and consistent across environments. Through the following considerations outlined below, we are able to get exploration to work reliably for different feature learning methods and environments with minimal changes to the hyper-parameters.
60
+
61
+ • PPO. In general, we have found the PPO algorithm (Schulman et al., 2017) to be a robust learning algorithm that requires little hyper-parameter tuning and so we stick to it for our experiments.
62
+ • Reward normalization. Since the reward function is non-stationary, it is useful to normalize the scale of the rewards so that the value function can learn quickly. We did this by dividing the rewards by a running estimate of the standard deviation of the sum of discounted rewards.
63
+ • Advantage normalization. While training with PPO, we normalize the advantages (Sutton & Barto, 1998) in a batch to have a mean of 0 and a standard deviation of 1.
64
+ • Observation normalization. We run a random agent on our target environment for 10000 steps, then calculate the mean and standard deviation of the observation and use these to normalize the observations when training. This is useful to ensure that the features do not have very small variance at initialization, and also ensure features have less variation across different environments.
65
+ • More actors. The stability of the method is greatly increased by increasing the number of parallel actors (which affects the batch-size) used. We typically use 128 parallel runs of the same environment for data collection while training an agent.
66
+ • Normalizing the features. In combining intrinsic and extrinsic rewards, we found it useful to ensure that the scale of the intrinsic reward was consistent across state space. We achieved this by using batch-normalization (Ioffe & Szegedy, 2015) in the feature embedding network.
67
+
68
+ # 2.3 ‘DEATH IS NOT THE END’: DISCOUNTED CURIOSITY WITH INFINITE HORIZON
69
+
70
+ One important point is that the use of an end-of-episode signal, sometimes called ‘done’, can often leak information about the true reward function (assuming, as is common, that we have access to an extrinsic reward signal that we hide from the agent to measure pure exploration). If we don’t remove the ‘done’ signal, many of the Atari games become too simple. For example, a simple strategy of giving $+ 1$ artificial reward at every time-step when the agent is alive and 0 upon death is sufficient to obtain a high score in some games, e.g. the Atari game ‘Breakout’ where it will seek to maximize the episode length and hence its score. In the case of negative rewards, the agent will try to end the episode as quickly as possible.
71
+
72
+ ![](images/8bbc8a0a32f0f3152306909cf7cb8cc5788a159a3cd91d680b1f1f8b9ecfd8b8.jpg)
73
+ Figure 2: A comparison of feature learning methods on 8 selected Atari games and the Super Mario Bros. These evaluation curves show the mean reward (with standard error) of agents trained purely by curiosity, without reward or an end-of-episode signal. We see that our purely curiosity-driven agent is able to gather rewards in these environments without using any extrinsic reward at training. Results on all of the Atari games are in the appendix in Figure 8. We find curiosity model trained on pixels does not work well across any environment and VAE features perform either same or worse than random and inverse dynamics features. Further, inverse dynamics-trained features perform better than random features in $5 5 \%$ of the Atari games. An interesting outcome of this analysis is that random features for modeling curiosity are a simple, yet surprisingly strong baseline and likely to work well in half of the Atari games.
74
+
75
+ In light of this, if we want to study the behavior of a pure exploration agent, we should not bias it. In the infinite horizon setting (i.e., the discounted returns are not truncated at the end of the episode and always bootstrapped using the value function), death is just another transition to the agent, to be avoided only if it is “boring”. Therefore, we removed ‘done’ to separate the gains of an agent’s exploration from merely that of the death signal. In practice, we do find that the agent avoids dying in the games since that brings it back to the beginning of the game – an area it has already seen many times and where it can predict the dynamics well. This subtlety has been neglected by previous works showing experiments without extrinsic rewards.
76
+
77
+ # 3 EXPERIMENTS
78
+
79
+ In all of our experiments, both the policy and the embedding network work directly from pixels. For our implementation details including hyper-parameters and architectures, please refer to the Appendix A. Unless stated otherwise, all curves are the average of three runs with different seeds, and the shaded areas are standard errors of the mean. We have released the code and videos of a purely curious agent playing across all environments on our website.
80
+
81
+ # 3.1 CURIOSITY-DRIVEN LEARNING WITHOUT EXTRINSIC REWARDS
82
+
83
+ We begin by scaling up a pure curiosity-driven learning to a large number of environments without using any extrinsic rewards. We pick a total of 54 diverse simulated environments, as shown in Figure 1, including 48 Atari games, Super Mario Bros., 2 Roboschool scenarios (learning Ant controller and Juggling), Two-player Pong, 2 Unity mazes (with and without a TV controlled by the agent). The goal of this large-scale analysis is to investigate the following questions: (a) What happens when you run a pure curiosity-driven agent on a variety of games without any extrinsic rewards? (b) What kinds of behaviors can you expect from these agents? (c) What is the effect of the different feature-learning variants in dynamics-based curiosity on these behaviors?
84
+
85
+ Atari Games To answer these questions, we began with a collection of well-known Atari games and ran a suite of experiments with different feature-learning methods. One way to measure how well a purely curious agent performs is to measure the extrinsic reward it is able to achieve, i.e. how good is the agent at playing the game. We show the evaluation curves of mean extrinsic reward in on
86
+
87
+ 8 common Atari games in Figure 2 and all 48 Atari suite in Figure 8 in the appendix. It is important to note that the extrinsic reward is only used for evaluation, not for training. However, this is just a proxy for pure exploration because the game rewards could be arbitrary and might not align at all with how the agent explores out of curiosity.
88
+
89
+ The first thing to notice from the curves is: most of them are going up. This shows that a pure curiosity-driven agent can often learn to obtain external rewards without seeing any extrinsic rewards during training! To understand why this is happening, consider the game ‘Breakout’. The main control action of the game is to keep hitting the bouncing ball with the paddle, but this does not earn any points. The game score increases only when the ball hits a brick (which then disappears). But the more bricks are struck by the ball, the more complicated the pattern of remaining bricks becomes, making the agent more curious to explore further, hence, collecting points as a bi-product. Furthermore, when the agent runs out of lives, the bricks are reset to the initial configuration, which has been seen by the agent many times before and is hence very predictable, so the agent tries to increase curiosity by staying alive and avoiding the death reset.
90
+
91
+ The fact that the curiosity reward is often sufficient is an unexpected result and might suggest that many popular RL test-beds do not need an external reward at all. It is likely that game designers (similar to architects, urban planners, gardeners, etc.) are purposefully setting up curricula to guide agents through the task by curiosity alone. This could explain why curiosity-like objective aligns reasonably well with the extrinsic reward in many human-designed environments (Lazzaro, 2004; Costikyan, 2013; Hunicke et al., 2004; Wouters et al., 2011). However, this is not always the case, and sometimes a curious agent can even do worse than a random agent. This happens when the extrinsic reward has little correlation with the agent’s exploration, or when the agent fails to explore efficiently (e.g. see games ‘Atlantis’ and ‘IceHockey’ in Figure 8). We encourage the reader to refer to the game-play videos of the agent available on the website for a better understanding of the learned skills.
92
+
93
+ Comparison of feature learning methods: We compare four feature learning methods in Figure 2: raw pixels, random features, inverse dynamics features and VAE features. Training dynamics on raw pixels performs poorly across all the environments, while encoding pixels into features does better. This is likely because it is hard to learn a good dynamics model in pixel space, and prediction errors may be dominated by small irrelevant details.
94
+
95
+ Surprisingly, random features (RF) perform quite well across tasks and sometimes better than using learned features. One reason for good performance is that the random features are kept frozen (stable), the dynamics model learned on top of them has an easier time because of the stationarity of the target. In general, random features should work well in the domains where visual observations are simple enough, and random features can preserve enough information about the raw signal, for instance, Atari games. One scenario where IDF features consistently outperform random features is for generalization, e.g. training on one level of Mario Bros and testing on another (see Section 3.2 for details).
96
+
97
+ The VAE method also performed well but was somewhat unstable, so we decided to use RF and IDF for further experiments. The detailed result in appendix Figure 8 compares IDF vs. RF across the full Atari suite. To quantify the learned behaviors, we compared our curious agents to a randomly acting agent. We found that an IDF-curious agent collects more game reward than a random agent in $7 5 \%$ of the Atari games, an RF-curious agent does better in $7 0 \%$ . Further, IDF does better than RF in $5 5 \%$ of the games. Overall, random features and inverse dynamics features worked well in general. Further details in the appendix.
98
+
99
+ Super Mario Bros. We compare different feature-learning methods in Mario Bros in Figure 2. Super Mario Bros has already been studied in the context of extrinsic reward free learning (Pathak et al., 2017) in small-scale experiments, and so we were keen to see how far curiosity alone can push the agent. We used a more efficient version of the Mario simulator, allowing for longer training, while keeping observation space, actions, and dynamics of the game the same. Due to $1 0 0 \mathrm { x }$ longer training and using PPO for optimization, our agent was able to pass several levels of the game, significantly improving over prior exploration results on Mario Bros.
100
+
101
+ Could we further push the performance of a purely curious agent by making the underlying optimization more stable? One way is to scale up the batch-size. We do so by increasing the number of parallel threads for running environments from 128 to 1024. We show the comparison between training using 128 and 1024 parallel environment threads in Figure 3(a). As apparent from the graph, training with large batch-size using 1024 parallel environment threads performs much better. In fact, the agent is able to explore much more of the game: discovering 11 different levels of the game, finding secret rooms and defeating bosses. Note that the x-axis in the figure is the number of gradient steps, not the number of frames, since the point of this large-scale experiment is not a claim about sample-efficiency, but performance with respect to training the agent. This result suggests that the performance of a purely curiosity-driven agent would improve as the training of base RL algorithm (PPO in our case) gets better. The video is on the website.
102
+
103
+ ![](images/7fe1cb827f84a79ccb9ce6a2837ba51504f95a5fe52db7cb1ed431d47ee8d55e.jpg)
104
+ Figure 3: (a) Left: A comparison of the RF method on Mario with different batch sizes. Results are without using extrinsic reward. (b) Center: Number of ball bounces in the Juggling (Roboschool) environment. (c) Right: Mean episode length in the multiplayer Pong environment. The discontinuous jump on the graph corresponds to the agent reaching a limit of the environment - after a certain number of steps in the environment the Atari Pong emulator starts randomly cycling through background colors and becomes unresponsive to agent’s actions
105
+
106
+ Roboschool Juggling We modified the Pong environment from the Roboschool framework to only have one paddle and to have two balls. The action space is continuous with two-dimensions, and we discretized the action space into 5 bins per dimension giving a total of 25 actions. Both the policy and embedding network are trained on pixel observation space (note: not state space). This environment is more difficult to control than the toy physics used in games, but the agent learns to intercept and strike the balls when it comes into its area. We monitored the number of bounces of the balls as a proxy for interaction with the environment, as shown in Figure 3(b). See the video on the project website.
107
+
108
+ Roboschool Ant Robot We also explored using the Ant environment which consists of an Ant with 8 controllable joints on a track. We again discretized the action space and trained policy and embedding network on raw pixels (not state space). However, in this case, it was less easy to measure exploration because the extrinsic distance reward measures progress along the racetrack, but a purely curious agent is free to move in any direction. We find that a walking like behavior emerges purely out of a curiosity-driven training. We refer the reader to the result video showing that the agent is meaningfully interacting with the environment.
109
+
110
+ Multi-agent curiosity in Two-player Pong We have already seen that a purely curiosity-driven agent learns to play several Atari games without reward, but we wonder how much of that behavior is caused by the fact that the opposing player is a computer agent with a hard-coded strategy. What would happen if we were to make both the players curious-driven? To find out, we set up a twoplayer Pong game where both the sides (paddles) of the game are controlled by two curiosity-driven agents. We shared the initial layers of both the agents but have different action heads, i.e., total action space is now the cross product of the actions of player 1 by the actions of player 2.
111
+
112
+ Note that the extrinsic reward is meaningless in this context since the agent is playing both sides, so instead, we show the length of the episode. The results are shown in Figure 3(c). We see from the episode length that the agent learns to have longer rallies over time, learning to play pong without any teacher – purely by curiosity on both sides. In fact, the game rallies eventually get so long that they break our Atari emulator causing the colors to change radically, which crashes the policy as shown in the plot.
113
+
114
+ # 3.2 GENERALIZATION ACROSS NOVEL LEVELS IN SUPER MARIO BROS.
115
+
116
+ In the previous section, we showed that our purely curious agent can learn to explore efficiently and learn useful skills, e.g., game playing behaviour in games, walking behaviour in Ant etc. So far, these skills were shown in the environment where the agent was trained on. However, one advantage of developing reward-free learning is that one should then be able to utilize abundant “unlabeled” environments without reward functions by showing generalization to novel environments.
117
+
118
+ To test this, we first pre-train our agent using curiosity only in the Level 1-1 of Mario Bros. We investigate how well RF and IDF-based curiosity agents generalize to novel levels of Mario. In Figure 4, we show two examples of training on one level of Mario and fine-tuning on another testing level, and compare to learning on the testing level from scratch. The training signal in all the cases is curiosity-only reward. In the first case, from Level 1-1 to Level 1-2, the global statistics of the environments match (both are ‘day-time’ environments, i.e., blue sky) but levels have different enemies, different geometry, and different difficulty. We see that there is strong transfer from for both methods in this scenario. However, the transfer performance is weaker in the second scenario from Level 1-1 to Level 1-3. This is so because the problem is considerably harder for the latter level pairing as there is a color pallette shift from day to night, as shown in Figure 4.
119
+
120
+ We further note that IDF-learned features transfer in both the cases and random features transfer in the first case, but do not transfer in the second scenario from day to night. These results might suggest that while random features perform well on training environments, learned features appear to generalize better to novel levels. However, this needs more analysis in the future across a large variety of environments. Overall, we find some promising evidence showing that skills learned by curiosity help our agent explore efficiently in novel environments.
121
+
122
+ ![](images/e6fcef6010423bb6b3934e2fb874d4ddb1f64a237e69f244a95faa64d734c312.jpg)
123
+ Figure 4: Mario generalization experiments. On the left we show transfer results from Level 1-1 to Level 1- 2, and on the right we show transfer results from Level 1-1 to Level 1-3. Underneath each plot is a map of the source and target environments. All agents are trained without extrinsic reward.
124
+
125
+ ![](images/ec87fda7865a049beae1c02b7ef72aff2c218bb919819d4a45366c6aa0e1826e.jpg)
126
+ Figure 5: Mean extrinsic reward in the Unity environment while training with terminal extrinsic $^ +$ curiosity reward. Note that the curve for extrinsic reward only training is constantly zero.
127
+
128
+ # 3.3 CURIOSITY WITH SPARSE EXTERNAL REWARD
129
+
130
+ In all our experiments so far, we have shown that our agents can learn useful skills without any extrinsic rewards, driven purely by curiosity. However, in many scenarios, we might want the agent to perform some particular task of interest. This is usually conveyed to the agent by defining extrinsic rewards. When rewards are dense (e.g. game score at every frame), classic RL works well and intrinsic rewards generally should not help performance. However, designing dense rewards is a challenging engineering problem (see introduction for details). In this section, we evaluate how well curiosity can help an agent perform a task in presence of sparse, or just terminal, rewards.
131
+
132
+ Terminal reward setting: For many real problems, only terminal reward is available, e.g. in navigation, you only get rewards once you find what you were looking for. This is a setting where classic RL typically performs poorly. Hence, we consider the 3D navigation in a maze designed in the Unity ML-agent framework with 9 rooms and a sparse terminal reward. The action space is discrete, consisting of: move forward, look left 15 degrees, look right 15 degrees and no-op. The agent starts in room-1, which is furthest away from room-9 which contains the goal. We compare an agent trained with extrinsic reward $^ { + 1 }$ when the goal is reached, 0 otherwise) to an agent trained with extrinsic $^ +$ intrinsic reward. Extrinsic only (classic RL) never finds the goal in all our trials, which means it is impossible to get any meaningful gradients. Whereas extrinsic+intrinsic typically converges to getting the reward every time. Results in Figure 5 show results for vanilla PPO, $\mathrm { P P O + }$ IDF-curiosity and $\mathrm { P P O } + \mathrm { R F }$ -curiosity.
133
+
134
+ Sparse reward setting: In preliminary experiments, we picked 5 Atari games which have sparse rewards (as categorized by (Bellemare et al., 2016)), and compared extrinsic (classic RL) vs. extrinsic+intrinsic (ours) reward performance. In 4 games out of 5, curiosity bonus improves performance (see Table 2 in the appendix, the higher score is better). We would like to emphasize that this is not the focus of the paper, and these experiments are provided just for completeness. We just combined extrinsic (coefficient 1.0) and intrinsic reward (coefficient 0.01) directly without any tuning. We leave the question on how to optimally combine extrinsic and intrinsic rewards as a future direction.
135
+
136
+ # 4 RELATED WORK
137
+
138
+ Intrinsic Motivation: A family of approaches to intrinsic motivation reward an agent based on prediction error (Schmidhuber, 1991c; Stadie et al., 2015; Pathak et al., 2017; Achiam & Sastry, 2017), prediction uncertainty (Still & Precup, 2012; Houthooft et al., 2016), or improvement (Schmidhuber, 1991a; Lopes et al., 2012) of a forward dynamics model of the environment that gets trained along with the agent’s policy. As a result the agent is driven to reach regions of the environment that are difficult to predict for the forward dynamics model, while the model improves its predictions in these regions. This adversarial and non-stationary dynamics can give rise to complex behaviors. Relatively little work has been done in this area on the pure exploration setting where there is no external reward. Of these mostly closely related are those that use a forward dynamics model of a feature space such as Stadie et al. (2015) where they use autoencoder features, and Pathak et al. (2017) where they use features trained with an inverse dynamics task. These correspond roughly to the VAE and IDF methods detailed in Section 2.1.
139
+
140
+ Smoothed versions of state visitation counts can be used for intrinsic rewards (Bellemare et al., 2016; Fu et al., 2017; Ostrovski et al., 2017; Tang et al., 2017). Count-based methods have already shown very strong results when combining with extrinsic rewards such as setting the state of the art in the Atari game Montezuma’s Revenge (Bellemare et al., 2016), and also showing significant exploration of the game without using the extrinsic reward. It is not yet clear in which situations count-based approaches should be preferred over dynamics-based approaches; we chose to focus on dynamics-based bonuses in this paper since we found them straightforward to scale and parallelize. In our preliminary experiments, we did not have sufficient success with already existing count-based implementations in scaling up for a large-scale study.
141
+
142
+ Learning without extrinsic rewards or fitness functions has also been studied extensively in the evolutionary computing where it is referred to as ‘novelty search’ (Lehman & Stanley, 2008; 2011; Stanley & Lehman, 2015). There the novelty of an event is often defined as the distance of the event to the nearest neighbor amongst previous events, using some statistics of the event to compute distances. One interesting finding from this literature is that often much more interesting solutions can be found by not solely optimizing for fitness.
143
+
144
+ Other methods of exploration are designed to work in combination with maximizing a reward function, such as those utilizing uncertainty about value function estimates (Osband et al., 2016; Chen et al., 2017), or those using perturbations of the policy for exploration (Fortunato et al., 2017; Plappert et al., 2017). Schmidhuber (2010) and Oudeyer & Kaplan (2009); Oudeyer (2018) provide a great review of some of the earlier work on approaches to intrinsic motivation. Alternative methods of exploration include Sukhbaatar et al. (2018) where they utilize an adversarial game between two agents for exploration. In Gregor et al. (2017), they optimize a quantity called empowerment which is a measurement of the control an agent has over the state. In a concurrent work, diversity is used as a measure to learn skills without reward functions Eysenbach et al. (2018).
145
+
146
+ Random Features: One of the findings in this paper is the surprising effectiveness of random features, and there is a substantial literature on random projections and more generally randomly initialized neural networks. Much of the literature has focused on using random features for classification (Saxe et al., 2011; Jarrett et al., 2009; Yang et al., 2015) where the typical finding is that whilst random features can work well for simpler problems, feature learning performs much better once the problem becomes sufficiently complex. Whilst we expect this pattern to also hold true for dynamics-based exploration, we have some preliminary evidence showing that learned features appear to generalize better to novel levels in Mario Bros.
147
+
148
+ # 5 DISCUSSION
149
+
150
+ We have shown that our agents trained purely with a curiosity reward are able to learn useful behaviours: (a) Agent being able to play many Atari games without using any rewards. (b) Mario being able to cross over 11 levels without any extrinsic reward. (c) Walking-like behavior emerged in the Ant environment. (d) Juggling-like behavior in Robo-school environment (e) Rally-making behavior in Two-player Pong with curiosity-driven agent on both sides. But this is not always true as there are some Atari games where exploring the environment does not correspond to extrinsic reward.
151
+
152
+ More generally, our results suggest that, in many game environments designed by humans, the extrinsic reward is often aligned with the objective of seeking novelty.
153
+
154
+ Limitation of prediction error based curiosity: A more serious potential limitation is the handling of stochastic dynamics. If the transitions in the environment are random, then even with a perfect dynamics model, the expected reward will be the entropy of the transition, and the agent will seek out transitions with the highest entropy. Even if the environment is not truly random, unpredictability caused by a poor learning algorithm, an impoverished model class or partial observability can lead to exactly the same problem. We did not observe this effect in our experiments on games so we designed an environment to illustrate the point.
155
+
156
+ We return to the maze of Section 3.3 to empirically validate a common thought experiment called the noisy-TV problem. The idea is that local sources of entropy in an environment like a TV that randomly changes channels when an action is taken should prove to be an irresistible attraction to our agent. We take this thought experiment literally and add a TV to the maze along with an action to change the channel. In Figure 6 we show how adding the noisy-TV affects the performance of IDF and RF. As expected the presence of the TV drastically slows down learning, but we note that if you run the experiment for long enough the agents do sometimes converge to getting the extrinsic reward consistently. We have shown empirically that stochasticity can be a problem, and so it is important for future work to address this issue in an efficient manner.
157
+
158
+ ![](images/0909305e004c1d7fdad34045a4a281249019f995e0428eae25a07f7001932a5e.jpg)
159
+ Figure 6: We add a noisy TV to the unity environment in Section 3.3. We compare IDF and RF with and without the TV.
160
+
161
+ Future Work: We have presented a simple and scalable approach that can learn nontrivial behaviors across a diverse range of environments without any reward function or end-of-episode signal. One surprising finding of this paper is that random features perform quite well, but learned features appear to generalize better. While we believe that learning features will become more important once the environment is complex enough, we leave that for future work to explore.
162
+
163
+ Our wider goal, however, is to show that we can take advantage of many unlabeled (i.e., not having an engineered reward function) environments to improve performance on a task of interest. Given this goal, showing performance in environments with a generic reward function is just the first step, and future work will hopefully investigate transfer from unlabeled to labeled environments.
164
+
165
+ # REFERENCES
166
+
167
+ Joshua Achiam and Shankar Sastry. Surprise-based intrinsic motivation for deep reinforcement learning. arXiv:1703.01732, 2017. 3, 9
168
+
169
+ M. G. Bellemare, Y. Naddaf, J. Veness, and M. Bowling. The arcade learning environment: An evaluation platform for general agents. Journal of Artificial Intelligence Research, 47:253–279, jun 2013. 2
170
+
171
+ Marc Bellemare, Sriram Srinivasan, Georg Ostrovski, Tom Schaul, David Saxton, and Remi Munos. Unifying count-based exploration and intrinsic motivation. In NIPS, 2016. 1, 9
172
+
173
+ Richard Y Chen, John Schulman, Pieter Abbeel, and Szymon Sidor. UCB and infogain exploration via $q$ ensembles. arXiv:1706.01502, 2017. 9
174
+
175
+ Greg Costikyan. Uncertainty in games. Mit Press, 2013. 6
176
+
177
+ Benjamin Eysenbach, Abhishek Gupta, Julian Ibarz, and Sergey Levine. Diversity is all you need: Learning skills without a reward function. arXiv preprint, 2018. 9
178
+
179
+ Meire Fortunato, Mohammad Gheshlaghi Azar, Bilal Piot, Jacob Menick, Ian Osband, Alex Graves, Vlad Mnih, Remi Munos, Demis Hassabis, Olivier Pietquin, Charles Blundell, and Shane Legg. Noisy networks for exploration. arXiv:1706.10295, 2017. 9
180
+
181
+ Justin Fu, John D Co-Reyes, and Sergey Levine. EX2: Exploration with exemplar models for deep reinforcement learning. NIPS, 2017. 9
182
+
183
+ Karol Gregor, Danilo Jimenez Rezende, and Daan Wierstra. Variational intrinsic control. ICLR Workshop, 2017. 9
184
+
185
+ Rein Houthooft, Xi Chen, Yan Duan, John Schulman, Filip De Turck, and Pieter Abbeel. Vime: Variational information maximizing exploration. In NIPS, 2016. 1, 9
186
+
187
+ Robin Hunicke, Marc LeBlanc, and Robert Zubek. Mda: A formal approach to game design and game research. In AAAI Workshop on Challenges in Game AI, 2004. 6
188
+
189
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. arXiv preprint arXiv:1502.03167, 2015. 4
190
+
191
+ 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. 10
192
+
193
+ Arthur Juliani, Vincent-Pierre Berges, Esh Vckay, Yuan Gao, Hunter Henry, Marwan Mattar, and Danny Lange. Unity: A general platform for intelligent agents. arXiv:1809.02627, 2018. 2
194
+
195
+ Diederik P Kingma and Max Welling. Auto-encoding variational Bayes. arXiv preprint arXiv:1312.6114, 2013. 2, 3
196
+
197
+ Nicole Lazzaro. Why we play games: Four keys to more emotion in player experiences. In Proceedings of GDC, 2004. 6
198
+
199
+ Joel Lehman and Kenneth O Stanley. Exploiting open-endedness to solve problems through the search for novelty. In ALIFE, 2008. 9
200
+
201
+ Joel Lehman and Kenneth O Stanley. Abandoning objectives: Evolution through the search for novelty alone. Evolutionary computation, 2011. 9
202
+
203
+ Manuel Lopes, Tobias Lang, Marc Toussaint, and Pierre-Yves Oudeyer. Exploration in model-based reinforcement learning by empirically estimating learning progress. In NIPS, 2012. 1, 9
204
+
205
+ Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K. Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 2015. 1
206
+
207
+ Shakir Mohamed and Danilo Jimenez Rezende. Variational information maximisation for intrinsically motivated reinforcement learning. In NIPS, 2015. 1
208
+
209
+ Ian Osband, Charles Blundell, Alexander Pritzel, and Benjamin Van Roy. Deep exploration via bootstrapped dqn. In NIPS, 2016. 9
210
+
211
+ Georg Ostrovski, Marc G Bellemare, Aaron van den Oord, and Remi Munos. Count-based exploration with ´ neural density models. arXiv:1703.01310, 2017. 1, 9 Pierre-Yves Oudeyer. Computational theories of curiosity-driven learning. arXiv preprint arXiv:1802.10546,
212
+ 2018. 9 Pierre-Yves Oudeyer and Frederic Kaplan. What is intrinsic motivation? a typology of computational approaches. Frontiers in neurorobotics, 2009. 1, 9 Deepak Pathak, Pulkit Agrawal, Alexei A. Efros, and Trevor Darrell. Curiosity-driven exploration by selfsupervised prediction. In ICML, 2017. 1, 2, 3, 4, 6, 9 Deepak Pathak, Parsa Mahmoudieh, Guanghao Luo, Pulkit Agrawal, Dian Chen, Yide Shentu, Evan Shelhamer, Jitendra Malik, Alexei A. Efros, and Trevor Darrell. Zero-shot visual imitation. In ICLR, 2018. 1 Matthias Plappert, Rein Houthooft, Prafulla Dhariwal, Szymon Sidor, Richard Y Chen, Xi Chen, Tamim Asfour, Pieter Abbeel, and Marcin Andrychowicz. Parameter space noise for exploration. arXiv:1706.01905,
213
+ 2017. 9 Pascal Poupart, Nikos Vlassis, Jesse Hoey, and Kevin Regan. An analytic solution to discrete bayesian reinforcement learning. In ICML, 2006. 1 Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. arXiv preprint arXiv:1401.4082, 2014. 3 Edward L. Ryan, Richard; Deci. Intrinsic and extrinsic motivations: Classic definitions and new directions. Contemporary Educational Psychology, 2000. 1 Andrew M Saxe, Pang Wei Koh, Zhenghao Chen, Maneesh Bhand, Bipin Suresh, and Andrew Y Ng. On random weights and unsupervised feature learning. In ICML, pp. 1089–1096, 2011. 10 Jurgen Schmidhuber. Curious model-building control systems. In ¨ Neural Networks, 1991. 1991 IEEE International Joint Conference on, pp. 1458–1463. IEEE, 1991a. 9 Jurgen Schmidhuber. A possibility for implementing curiosity and boredom in model-building neural controllers. In From animals to animats: Proceedings of the first international conference on simulation of adaptive behavior, 1991b. 1 Jurgen Schmidhuber. A possibility for implementing curiosity and boredom in model-building neural con- ¨ trollers, 1991c. 9 Jurgen Schmidhuber. Formal theory of creativity, fun, and intrinsic motivation (1990–2010). ¨ IEEE Transactions on Autonomous Mental Development, 2010. 9 John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017. 2, 4 Satinder P Singh, Andrew G Barto, and Nuttapong Chentanez. Intrinsically motivated reinforcement learning. In NIPS, 2005. 1 Linda Smith and Michael Gasser. The development of embodied cognition: Six lessons from babies. Artificial life, 2005. 1 Bradly C Stadie, Sergey Levine, and Pieter Abbeel. Incentivizing exploration in reinforcement learning with deep predictive models. NIPS Workshop, 2015. 2, 9 Kenneth O Stanley and Joel Lehman. Why greatness cannot be planned: The myth of the objective. Springer,
214
+ 2015. 9 Susanne Still and Doina Precup. An information-theoretic approach to curiosity-driven reinforcement learning. Theory in Biosciences, 2012. 9 Sainbayar Sukhbaatar, Ilya Kostrikov, Arthur Szlam, and Rob Fergus. Intrinsic motivation and automatic curricula via asymmetric self-play. In ICLR, 2018. 9 Richard S Sutton and Andrew G Barto. Reinforcement learning: An introduction. MIT press Cambridge, 1998.
215
+ 4
216
+
217
+ Haoran Tang, Rein Houthooft, Davis Foote, Adam Stooke, Xi Chen, Yan Duan, John Schulman, Filip De Turck, and Pieter Abbeel. #Exploration: A study of count-based exploration for deep reinforcement learning. Advances in Neural Information Processing Systems, 2017. 9
218
+
219
+ Pieter Wouters, Herre Van Oostendorp, Rudy Boonekamp, and Erik Van der Spek. The role of game discourse analysis and curiosity in creating engaging and effective serious games by implementing a back story and foreshadowing. Interacting with Computers, 2011. 6
220
+
221
+ Zichao Yang, Marcin Moczulski, Misha Denil, Nando de Freitas, Alex Smola, Le Song, and Ziyu Wang. Deep fried convnets. In Proceedings of the IEEE International Conference on Computer Vision, pp. 1476–1483, 2015. 10
222
+
223
+ # A IMPLEMENTATION DETAILS
224
+
225
+ We have released the training code and environments on our website 1. For full details, we refer the reader to our code and video results in the website.
226
+
227
+ Pre-processing: All experiments were done with pixels. We converted all images to grayscale and resized to size 84x84. We learn the agent’s policy and forward dynamics function both on a stack of historical observations $[ x _ { t - 3 } , x _ { t - 2 } , x _ { t - 1 } , x _ { t } ]$ instead of only using the current observation. This is to capture partial observability in these games. In the case of Super Mario Bros and Atari experiments, we also used a standard frameskip wrapper that repeats each action 4 times.
228
+
229
+ Architectures: Our embedding network and policy networks had identical architectures and were based on the standard convolutional networks used in Atari experiments. The layer we take as features in the embedding network had dimension 512 in all experiments and no nonlinearity. To keep the scale of the prediction error consistent relative to extrinsic reward, in the Unity experiments we applied batchnorm to the embedding network. We also did this for the Mario generalization experiments to reduce covariate shift from level to level. For the VAE auxiliary task and pixel method, we used a similar deconvolutional architecture the exact details of which can be found in our code submission. The IDF and forward dynamics networks were heads on top of the embedding network with several extra fully-connected layers of dimensionality 512.
230
+
231
+ Hyper-parameters: We used a learning rate of 0.0001 for all networks. In most experiments, we used 128 parallel environments with the exceptions of the Unity and Roboschool experiments where we could only run 32 parallel environments, and the large scale Mario experiment where we used 1024. We used rollouts of length 128 in all experiments except for the Unity experiments where we used 512 length rollouts so that the network could quickly latch onto the sparse reward. In the initial 9 experiments on Mario and Atari, we used 3 optimization epochs per rollout in the interest of speed. In the Mario scaling, generalization experiments, as well as the Roboschool experiments, we used 6 epochs. In the Unity experiments, we used 8 epochs, again to more quickly take advantage of sparse rewards.
232
+
233
+ # B ADDITIONAL RESULTS
234
+
235
+ # B.1 ATARI
236
+
237
+ To better measure the amount of exploration, we provide the best return of curiosity-driven agents in figure 7(a) and the episode lengths in figure 7(b). Notably on Pong the increasing episode length combined with a plateau in returns shows that the agent maximizes the number of ball bounces, rather than the reward.
238
+
239
+ Figure 8 shows the performance of curiosity-driven agents based on Inverse Dynamics and Random features on 48 Atari games.
240
+
241
+ Although not the focus of this paper, for completeness we include some results on combining intrinsic and extrinsic reward on several sparse reward Atari games. When combining with extrinsic rewards, we use the end of the episode signal. The reward used is the extrinsic reward plus 0.01 times the intrinsic reward. The results are shown in Table 2. We don’t observe a large difference between the settings, likely because the combination of intrinsic and extrinsic reward needs to be tuned. We did observe that one of the intrinsic+extrinsic runs on Montezuma’s Revenge explored 10 rooms.
242
+
243
+ ![](images/3cf627208d2a6d9f50c1079e93287331b332094055997daca5845d91ec064fdd.jpg)
244
+ Figure 7: (a) Left: Best extrinsic returns on eight Atari games and Mario. (c) Right: Mean episode lengths on eight Atari games and Mario.
245
+
246
+ ![](images/c239c71ab5e948299e7ae9d26ac27c2015b9a2ed51aa284ac68e9d9f6b2db361.jpg)
247
+ Figure 8: Pure curiosity-driven exploration (no extrinsic reward, or end-of-episode signal) on 48 Atari games. We observe that the extrinsic returns of curiosity-driven agents often increases despite the agents having no access to the extrinsic return or end of episode signal. In multiple environments, the performance of the curiositydriven agents is significantly better than that of a random agent, although there are environments where the behavior of the agent is close to random, or in fact seems to minimize the return, rather than maximize it. For the majority of the training process RF perform better than a random agent in about $67 \%$ of the environments, while IDF perform better than a random agent in about $71 \%$ of the environments.
248
+
249
+ <table><tr><td>Reward</td><td>Gravitar</td><td>Freeway</td><td>Venture</td><td>PrivateEye</td><td>MontezumaRevenge</td></tr><tr><td>Ext Only</td><td>999.3± 220.7</td><td>33.3± 0.6</td><td>0±0</td><td>5020.3 ± 395</td><td>1783 ± 691.7</td></tr><tr><td>Ext + Int</td><td>1165.1 ± 53.6</td><td>32.8± 0.3</td><td>416 ± 416</td><td>3036.5 ± 952.1</td><td>2504.6 ± 4.6</td></tr></table>
250
+
251
+ Table 2: These results compare the mean reward ( $\pm$ std-error) after 100 million frames across 3 seeds for an agent trained with intrinsic plus extrinsic reward versus extrinsic reward only. The extrinsic (coefficient 1.0) and intrinsic reward (coefficient 0.01) were directly combined without any hyper-parameter tuning. We leave the question on how to optimally combine extrinsic and intrinsic rewards up to future work. This is to emphasize that combining extrinsic with intrinsic rewards is not the focus of the paper, and these experiments are provided just for completeness.
252
+
253
+ # B.2 MARIO
254
+
255
+ We show the analogue of the plot shown in Figure 3(a) showing max extrinsic returns. See Figure 9.
256
+
257
+ ![](images/332d8b11f113d5e56625b39250c7912d95ca77d9075373863f4f07711fcef3a8.jpg)
258
+ Figure 9: Best extrinsic returns on the Mario scaling experiments. We observe that larger batches allow the agent to explore more effectively, reaching the same performance in less parameter updates, and also achieving better ultimate scores.
259
+
260
+ 1 Initialize the networks $f ( x _ { t } , a _ { t } ; \theta _ { f } )$ , $\pi ( x _ { t } ; \theta _ { \pi } )$ and $\phi ( x ; \theta _ { \phi } )$
261
+ 2 $D = \{ \}$
262
+ 3 for iteration $i = I$ to . . . do
263
+ 4 for envs in parallel $t = I$ to $^ { l 2 8 }$ do
264
+ 5 for iteration $t = I$ to 128 do
265
+ 6 Sample $a \sim \pi ( x _ { t } ; \theta _ { \pi } )$ and act using $a$ in the environment
266
+ 7 $D \Leftarrow D + ( x _ { t } , a _ { t } , x _ { t + 1 } , r _ { t } )$ where $r _ { t } = \| f ( x _ { t } , a _ { t } ; \theta _ { f } ) - \phi ( x _ { t + 1 } ; \theta _ { \phi } ) \| _ { 2 } ^ { 2 }$
267
+ 8 end
268
+ 9 end
269
+ 10 for steps $k = I$ to $6 4$ do
270
+ 11 Sample batch size of 2048 from $D$ and update using ADAM as follows:
271
+ 12 $\theta _ { f } ^ { ' } : = \theta _ { f } - \eta _ { 1 } \nabla _ { \theta _ { f } } \mathbb { E } \big [ \| f ( x _ { t } , a _ { t } ; \theta _ { f } ) - \phi ( x _ { t + 1 } ; \theta _ { \phi } ) \| _ { 2 } ^ { 2 } \big ]$
272
+ 13 $\boldsymbol { \theta } _ { \phi } ^ { ' } : = \boldsymbol { \theta } _ { \phi } - \eta _ { 2 } \nabla _ { \theta _ { \phi } } \mathbb { E } \big [ \| \dots \| _ { 2 } ^ { 2 } \big ]$ : some auxiliary task
273
+ 14 $\begin{array} { r } { \boldsymbol { \theta } _ { \pi } ^ { \prime } : = \boldsymbol { \theta } _ { \pi } + \eta _ { 3 } \nabla _ { \boldsymbol { \theta } _ { \pi } } \mathbb { E } _ { \pi ( \boldsymbol { x } _ { t } ; \boldsymbol { \theta } _ { \pi } ) } \big [ \sum _ { t } \boldsymbol { r } _ { t } \big ] } \end{array}$ : use PPO with discounted returns
274
+ 15 $\theta _ { f } \Leftarrow \theta _ { f } ^ { ' }$
275
+ 16 θ φ ⇐ θ 0φ
276
+ 17 $\theta _ { \pi } \Leftarrow \theta _ { \pi } ^ { ' }$
277
+ 18 end
278
+ 19 end
md/train/rJe2syrtvS/rJe2syrtvS.md ADDED
@@ -0,0 +1,342 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # THE INGREDIENTS OF REAL-WORLD ROBOTIC REINFORCEMENT LEARNING
2
+
3
+ Henry $\mathbf { L h u ^ { * 1 } }$ , Justin $\mathbf { V } \mathbf { u } ^ { * 1 }$ , Abhishek Gupta∗1, Dhruv Shah1, Kristian Hartikainen2, Avi Singh1, Vikash Kumar3, Sergey Levine1 1 University of California, Berkeley 2 University of Oxford 3 University of Washington
4
+
5
+ # ABSTRACT
6
+
7
+ The success of reinforcement learning for real world robotics has been, in many cases limited to instrumented laboratory scenarios, often requiring arduous human effort and oversight to enable continuous learning. In this work, we discuss the elements that are needed for a robotic learning system that can continually and autonomously improve with data collected in the real world. We propose a particular instantiation of such a system, using dexterous manipulation as our case study. Subsequently, we investigate a number of challenges that come up when learning without instrumentation. In such settings, learning must be feasible without manually designed resets, using only on-board perception, and without hand-engineered reward functions. We propose simple and scalable solutions to these challenges, and then demonstrate the efficacy of our proposed system on a set of dexterous robotic manipulation tasks, providing an in-depth analysis of the challenges associated with this learning paradigm. We demonstrate that our complete system can learn without any human intervention, acquiring a variety of vision-based skills with a real-world three-fingered hand. Results and videos can be found at https://sites.google.com/view/realworld-rl/.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Reinforcement learning (RL) can in principle enable autonomous systems, such as robots, to acquire a large repertoire of skills automatically. Perhaps even more importantly, reinforcement learning can enable such systems to continuously improve the proficiency of their skills from experience. However, realizing this in reality has proven challenging: even with reinforcement learning methods that can acquire complex behaviors from high-dimensional low-level observations, such as images, the assumptions of the reinforcement learning problem setting do not fit cleanly into the constraints of the real world. For this reason, most successful robotic learning experiments have employed various kinds of environmental instrumentation in order to define reward functions, reset between trials, and obtain ground truth state (Levine et al., 2016; Haarnoja et al., 2018a; Kumar et al., 2016; Andrychowicz et al., 2018; Zhu et al., 2019; Chebotar et al., 2016; Nagabandi et al., 2019; Gupta et al., 2016). In order to practically and scalably deploy autonomous learning systems that improve continuously through real-world operation, we must lift these limitations and design algorithms that can learn under the constraints of real-world environments, as illustrated in Figure 2.
12
+
13
+ We propose that overcoming these challenges in a scalable way requires designing robotic systems that possess three capabilities: they are able to (1) learn from their own raw sensory inputs, (2) assign rewards to their own trials without hand-designed perception systems or instrumentation, and (3) learn continuously in non-episodic settings without requiring human intervention to manually reset the environment. A system with these capabilities can autonomously collect large amounts of real world data – typically crucial for effective generalization – without significant instrumentation in each training environment, an example of which is shown in Figure 1. If successful, this would lift a major constraint that stands between current reinforcement learning algorithms and the ability to learn scalable, generalizable, and robust real-world behaviors. Such a system would also bring us significantly closer to the goal of embodied learning-based systems that improve continuously through their own real-world experience.
14
+
15
+ ![](images/83c7b9a06c076f3cf373c41b31868ce93909c4644428dbe54f3993fd7de2ca93.jpg)
16
+ Figure 1: Illustration of our proposed instrumentation-free system requiring minimal human engineering. Human intervention is only required in the goal collection phase (1). The robot is left to train unattended (2) during the learning phase and can be evaluated from arbitrary initial states at the end of training (3). We show sample goal and intermediate images from the training process of a real hardware system
17
+
18
+ Having laid out these requirements, we propose a practical instantiation of such a learning system. While prior works have studied many of these issues in isolation, combining them into a complete real-world learning system presents a number of challenges, as we discuss in Section 3. We provide an empirical analysis of these issues, both in simulation and on a real-world robotic system, and propose a number of simple but effective solutions that together produce a complete robotic learning system. This system can autonomously learn from raw sensory inputs, learn reward functions from easily available supervision, and learn without manually designed reset mechanisms. We show that this system can learn dexterous robotic manipulation tasks in the real world, substantially outperforming ablations and prior work.
19
+
20
+ # 2 THE STRUCTURE OF A REAL-WORLD RL SYSTEM
21
+
22
+ The standard reinforcement learning paradigm assumes that the controlled system is represented as a Markov decision process with a state space $s$ , action space $\mathcal { A }$ , unknown transition dynamics $\tau$ , unknown reward function $\mathcal { R }$ , and a (typically) episodic initial state distribution $\rho$ . The goal is to learn a policy that maximizes the expected sum of rewards via interactions with the environment.
23
+
24
+ Although this formalism is simple and concise, it does not capture all of the complexities of realworld robotic learning problems. If a robotic system is to learn continuously and autonomously in the real world, we must ensure that it can learn under the actual conditions that are imposed by the real world. To move from the idealized MDP formulation to the real world, we require a system that has the following properties. First, all of the information necessary for learning must be obtained from the robot’s own sensors. This includes information about the state and necessitates that the policy must be learned from high-dimensional and low-level sensory observations, such as camera images. Second, the robot must also obtain the reward signal itself from its own sensor readings. This is exceptionally difficult for all but the simplest tasks (e.g., reward functions that depend on interactions with specific objects require perceiving those objects explicitly). Third, we must be able to learn without access to episodic resets. A setup with explicit resets quickly becomes impractical in open-world settings, due to the requirement for significant human engineering of the environment, or direct human intervention during learning. While this list may not exhaustively enumerate all the components necessary for an effective real-world learning system, we posit that the properties listed here are fundamental to building such systems.
25
+
26
+ While some of the components discussed above can be tackled in isolation by current algorithms, there are considerable challenges inherent to assembling all these components into a complete learning system for real world robotic learning. In the rest of this section, we outline the challenges associated with each component, then discuss the challenges associated with combining these components in Section 3, and then proceed to address these challenges in Section 4.
27
+
28
+ ![](images/c22c53be5af8d2715578d714c982847f8d4f9d12900678fdfd0e7bd3b1d9f31e.jpg)
29
+ Figure 2: We draw a comparison between current real world learning systems which rely on instrumentation versus a system that learns in an environment more representative of the real world, free of instrumentation. While all three prior works utilize instrumentation for resets, state estimation, and reward, the motion capture system of Gupta et al. (2016), sensor attached to the door in Zhu et al. (2019), and auxiliary robot which picks up fallen balls in Nagabandi et al. (2019) are good examples of engineered state estimation, reward estimation, and reset mechanisms respectively.
30
+
31
+ # 2.1 LEARNING FROM RAW SENSORY INPUT
32
+
33
+ To enable learning without complex state estimation systems or environment instrumentation, we require our robotic systems to be able to learn from their own raw sensory observations. Typically, these sensory observations are raw camera images from a camera mounted on the robot, as well as proprioceptive sensory inputs such as the joint angles. These observations do not directly provide the poses of the objects in the scene, which is the typical assumption in simulated robotic environments – any such information must be extracted by the learning system.
34
+
35
+ While in principle many RL frameworks can support learning from raw sensory inputs (Levine et al., 2016; Mnih et al., 2015; Schulman et al., 2015; Lillicrap et al., 2015), it is important to consider the practicalities of this approach. For instance, we can instantiate vision-based RL with policy gradient algorithms such as TRPO (Schulman et al., 2015) and PPO (Schulman et al., 2017), but these have high sample complexities which make them unsuited for real world robotic learning (Haarnoja et al., 2018a). In our work, we consider adopting the general framework of off-policy actor-critic reinforcement learning, using a version of the soft actor critic (SAC) algorithm described by (Haarnoja et al., 2018b). This algorithm effectively uses off-policy data and has been shown to learn some tasks directly from visual inputs. However, while SAC can learn directly from images, we find in our experiments that, as the task complexity increases, the efficiency of direct end-to-end learning (particularly without resets and with learned rewards) still degrades substantially. However, as we will discuss in Section 3, augmenting end-to-end learning with unsupervised representation learning substantially alleviates such challenges.
36
+
37
+ # 2.2 REWARD FUNCTIONS WITHOUT REWARD ENGINEERING
38
+
39
+ Vision-based RL algorithms, such as SAC, rely on a reward function being provided to the system, which is typically manually programmed by a user. While this can be simple to do in simulation by using ground truth state information, it is significantly harder to implement in uninstrumented real world environments. In the real world, the robot must obtain the reward signal itself from its own sensor readings. A few options for tackling this challenge have been discussed in prior work: design complete computer vision systems to detect objects and extract the reward signals (Devin et al., 2018; Nagabandi et al., 2019), engineer reward functions that use various task-specific heuristics to obtain rewards from pixels (Schenck & Fox, 2017; Kalashnikov et al., 2018), or instrument every environment (Chebotar et al., 2017). Many of these solutions are manual and tedious, and a more general approach is needed to scale real-world robotic learning gracefully.
40
+
41
+ # 2.3 LEARNING WITHOUT RESETS
42
+
43
+ While the components described in Section 2.1 and 2.2 are essential to building continuously learning RL systems in the real world, they have often been implemented with the assumption of episodic learning Fu et al. (2018); Haarnoja et al. (2018b). However, natural open-world settings do not provide any such reset mechanism, and in order to enable scalable and autonomous real-world learning we need systems that do not require an episodic formulation of the learning problem.
44
+
45
+ To devise a system that requires minimal human engineering for providing rewards, we must use algorithms that are able to assign themselves rewards, using learned models that operate on the same raw sensory inputs as the policy. One candidate is for a user to specify intended behavior beforehand through examples of desired outcomes (i.e., images). The algorithm can then assign itself rewards based on a measure of how well it is accomplishing the specified goals, with no additional human supervision. This approach can scale well in principle, since it requires minimal human engineering, and goal images are easy to provide.
46
+
47
+ In principle, algorithms such as SAC do not actually require episodic learning; however, in practice, most instantiations use explicit resets, even in simulation, and removing resets has resulted in failure to solve challenging tasks. In our experiments in Section 3 as well, we see that actor-critic methods applied na¨ıvely to the reset free setting do not learn the intended behaviors. Introducing visual observations and classifier based rewards exacerbates these challenges.
48
+
49
+ We propose that these three components – vision-based RL with actor-critic algorithms, visionbased goal classifier for rewards, and reset-free learning – are the fundamental pieces that we need to build a real world robotic learning system. However, when we actually combine the individual components in Sections 3 and 6, we find that learning effective policies is quite challenging. We provide insight into these challenges in Section 3. Based on these insights, we propose simple but important changes in Section 4 to build a system, R3L , that can learn effectively and autonomously in the real world without human intervention.
50
+
51
+ # 3 THE CHALLENGES OF REAL WORLD RL
52
+
53
+ The system design outlined in Section 2 in principle gives us a complete system to perform real world reinforcement learning without instrumentation. However, when utilized for robotic learning problems, we find this basic design to be largely ineffective. To study this, we present results for a simulated robotic manipulation task that requires repositioning a free-floating objects with a threefingered robotic hand, shown in Fig 3. We use this task for our investigative analysis and show that the same insights extend to several other tasks, including real world tasks, in Section 6. The goal in this task is to reposition the object to a target pose from any initial pose in the arena. When the system is instantiated with visionbased soft actor-critic, rewards from goal images using VICE, and run without episodic resets, we see that the algorithm fails to make progress (Fig 4). Although it might appear that this setup fits within the assumptions of all of the components that are used, the complete system is ineffective. Which particular components of this problem make it so difficult?
54
+
55
+ ![](images/ce6143e57e0a18c5d2bd1944c725d2a94340cd83fa8b365692f4d164208de312.jpg)
56
+ Figure 3: Our object repositioning task. The goal is to move the object from any starting configuration to a particular goal position and orientation.
57
+
58
+ To investigate this issue, we perform experiments investigating the combination of the three main ingredients: varying observation type (visual vs. low-dimensional state), reward structure (VICE vs. hand-defined rewards that utilize ground-truth object state), and the ability to reset (episodic resets vs. reset-free, non-episodic learning). We start by considering the training time reward under each combination of factors as shown in Fig 4, which reveals several trends. First, the results in Fig 4 show that learning with resets achieves high training time reward from both vision and state, while reset-free only achieves high training time reward with low-dimensional state. Second, we find that the policy is able to pass the threshold for training time reward in a non-episodic setting when learning from low-dimensional state, but it is not able to do the same using image observations. This suggests that combining the reset-free learning problem with visual observations makes it significantly more challenging.
59
+
60
+ ![](images/36fdd05da19a4d308ad35dd47c28e7b98a0467afadb84769d255d7f4310ee98f.jpg)
61
+ Figure 4: We report the approximate number of samples needed for a policy learned with a prior offpolicy RL algorithm $( S A C )$ to achieve average training performance of less than 0.15 in pose distance (defined in Appendix C.1.3) across 3 seeds on the repositioning task. We compare training performance after varying three axes: ground truth rewards vs. learned rewards, with vs. without episodic resets, low-level state vs. images as inputs. We observe learning without resets is harder than with resets and is much harder when combined with visual inputs.
62
+
63
+ ![](images/6d70464a38d5696118c55e6558ef0502b8ccea62ff9b88e773c2039834d86d3f.jpg)
64
+ Figure 5: We observe that when training reset free to reach a single goal, while the pose distance at training time is quite low, the pose errors obtained at test-time with the learned policy are very high. This indicates that while the object is getting close to the goal at training time, the policies being learned are still not effective.
65
+
66
+ However, the table in Fig 4 paints an incomplete picture. These numbers are related to the performance of the policies at training time, not how effective the learned policies are when being evaluated. When we consider the test-time performance (Fig 5) of the policies that are learned under reset free conditions, we obtain a different set of conclusions. While learning from low-dimensional state in the reset free setting achieves high reward at training time, the test-time performance of the corresponding learned policies is very poor. This can likely be attributed to the fact that when the agent spends all its time stuck at the goal, and sees very little diversity of data in other parts of the state space, which significantly reduces the efficacy of the actual policies being learned. In a sense, the reset encodes some prior information about the task: it tells the policy about what types of states it might be required to succeed from at test time. Without this knowledge, performance is substantially worse. This makes it very challenging to learn policies with completely reset-free schemes, which has prompted prior work to consider schemes such as learning reset controllers (Eysenbach et al., 2018). As we discuss in the following section and in our experiments, these schemes are often insufficient for learning effective policies in the real world without any resets.
67
+
68
+ # 4 A REAL-WORLD ROBOTIC REINFORCEMENT LEARNING SYSTEM
69
+
70
+ To address the challenges identified in Section 3, we present two improvements, which we found to be essential for uninstrumented real-world training: randomized perturbation controllers and unsupervised representation learning. Incorporating these components into the system in Section 2 results in a system that can learn successfully in uninstrumented environments, as we will show in Section 6, and attains good performance both at training time and at test time.
71
+
72
+ # 4.1 RANDOMIZED PERTURBATION CONTROLLER
73
+
74
+ Prior works in addressing the reset free setting problem have considered converting the problem into a more standard episodic problem, by learning a “reset controller,” which is trained to reset the system to a particular initial state (Eysenbach et al., 2018; Han et al., 2015). This scheme has been thought to make the learning problem easier by reducing the variance of the resulting initial state distribution. However, as we will show in our experiments in Section 6, this still results in policies whose success depends heavily on a narrow range of initial states. Indeed, prior reset controller methods all reset to a single initial state (Eysenbach et al., 2018; Han et al., 2015).
75
+
76
+ We take a different approach to learning in a reset-free setting. Rather than attributing the problem to the variance of the initial state distribution, we hypothesize that a major problem with reset-free learning is that the support of the distribution of states visited by the policy is too narrow, which makes the learning problem challenging and doesn’t allow the agent to learn how to perform the desired task from any state it might find itself in. In this view, the goal should not be to reduce the variance of the initial state distribution, but instead to increase it.
77
+
78
+ To this end, we utilize what we call random perturbation controllers: controllers that introduce perturbations intermittently into the system through a policy that is trained to explore the environment. The standard actor $\pi ( a | s )$ is executed for $H$ time-steps, following which we executed the perturbation controller $\pi _ { p } ( a | s )$ for $H$ steps, and repeat. The policy $\pi$ is trained with the VICE-based rewards for reaching the desired goals, while the perturbation controller $\pi _ { p }$ is trained only with an intrinsic motivation objective that encourages visiting under-explored states. In our implementation, we use the random network distillation (RND) objective for training the perturbation controller (Burda et al., 2018), but any effective exploration method can be used for the same. This procedure is described in detail in Appendix A, and is evaluated on the tasks we consider in Fig 6. The perturbation controller ensures that the support of the training distribution grows and as a result the policies can learn the desired behavior much more effectively, as shown in Fig 7.
79
+
80
+ # 4.2 GOAL CLASSIFIER
81
+
82
+ To design a system that requires minimal human engineering for providing reward, we use a datadriven reward specification framework called variational inverse control with events (VICE) introduced by Fu et al. (2018). VICE learns rewards in a task-agnostic way: we provide the algorithm with success examples in the form of images where the task is accomplished, and learn a discriminator that is capable of distinguishing successes from failures. This discriminator can then be used to provide a learning signal to nudge the reinforcement learning agent towards success. This algorithm has been previously considered in the context of learning tasks from raw sensory observations in the real world by (Singh et al., 2019) but we show that it presents unique challenges when used in conjunction with learning without episodic resets. Details and specifics of the algorithms being considered are described in Appendix A and also discussed by Singh et al. (2019).
83
+
84
+ # 4.3 UNSUPERVISED REPRESENTATION LEARNING
85
+
86
+ The perturbation controller discussed above allows us to learn policies that can succeed at the task from a variety of starting states. However, learning from visual observations still present a challenge. Our experiments in Fig 4 show that learning without resets from low-dimensional states is comparatively easier. We therefore aim to convert the vision-based learning problem into one that more closely resembles state-based learning, by training a variational autoencoder (VAE, Kingma & Welling (2013)) and sharing the latent-variable representation across the actor and critic networks (refer to Appendix B for more details). Note that we use a VAE as an instantiation of representation learning techniques that works well in the domains we considered, but other more sophisticated density models proposed in prior work may also be substituted in place of the VAE (Lee et al., 2019; Hjelm et al., 2019; Anand et al., 2019).
87
+
88
+ While several works have also sought to incorporate unsupervised learning into reinforcement learning to make learning from images easier (Nair et al., 2018; Lee et al., 2019), we note that this becomes especially critical in the vision-based, reset-free setting, as motivated by the experiments in Section 3, which indicate that it is precisely this combination of factors – vision and no resets – that presents the most difficult learning problem. Therefore, although the particular solution we use in our system has been studied in prior work, it is brought to bare to address a challenge that arises in real-world learning that we believe has not been explored in prior studies.
89
+
90
+ These two improvements – the perturbation controller and unsupervised learning – combined with the general system described above, give us a complete practical system for real world reinforcement learning. The overall method uses soft-actor critic for learning with visual observations and classifier based rewards with VICE, introduces auxiliary reconstruction objectives or pretrains encoders for unsupervised representation learning, and uses a perturbation controller during training to ensure that the support of visited states grows sufficiently. We term this full system for real-world robotic reinforcement learning R3L. Further implementation details can be found in Appendix A.
91
+
92
+ # 5 RELATED WORK
93
+
94
+ The primary contribution of this work is to propose a paradigm for continual instrumentation-free real world robotic learning and a practical instantiation of such a system. A number of prior works have studied reinforcement learning in the real world for acquiring robotic skills (Levine et al., 2016; Kumar et al., 2016; Gu et al., 2017; Kalashnikov et al., 2018; Haarnoja et al., 2018b; Finn & Levine, 2016; Zhu et al., 2019; Nagabandi et al., 2019). Much of the focus in prior work has been on improving the efficiency and generalization of RL algorithms to make real-world training feasible, or else on utilizing simulation and transferring policies into the real world (Tzeng et al., 2015; Tobin et al., 2017; Peng et al., 2017; Clavera et al., 2018; Kang et al., 2019). The simulation-based methods typically require considerable effort in terms of both simulator design and overcoming the distributional shift between simulated and real-experience, while prior real-world training methods typically require additional instrumentation for either reward function evaluation (Levine & Koltun, 2013) or resetting between trials (Gu et al., 2017; Chebotar et al., 2017; Zhu et al., 2019), or both. In contrast, our work is primarily focused on lifting these requirements, rather than devising more efficient RL methods. We show that removing the need for instrumentation (i.e., for reward evaluation and resets) introduces additional challenges, which in turn require a careful set of design choices. Our complete R3L method is able to learn completely autonomously, without manual resets or reward design.
95
+
96
+ A key component of our system involves learning from raw visual inputs. This has proven to be difficult for policy gradient style algorithms (Pinto et al., 2017a) due to challenging representation learning problems. This has been made easier in simulated domains by using modified objectives, such as auxiliary losses (Jaderberg et al., 2016), or by using more efficient algorithms (Haarnoja et al., 2018a). We show that reinforcement learning on raw visual input, while possible in standard RL settings, becomes significantly more challenging when considered in conjunction with nonepisodic, reset-free scenarios.
97
+
98
+ Reward function design is crucial for any RL system, and is non-trivial to provide in the real world. Prior works have considered instrumenting the environment with additional sensors to evaluate rewards (Gu et al., 2017; Chebotar et al., 2017; Zhu et al., 2019), which is a highly manual process, using demonstrations, which require manual effort to collect (Vecerik et al., 2017; Ng & Russell, 2000; Liu et al., 2018), or using interactive supervision from the user (Christiano et al., 2017). In this work, we leverage the algorithm introduced by Fu et al. (2018) to assign rewards based on the likelihood of a goal classifier. While prior work also applied this method to robotic tasks (Singh et al., 2019), this was done in a setting where manual resets were provided by hand, while we demonstrate that we can use learned rewards in a fully uninstrumented, reset-free setup.
99
+
100
+ Learning without resets has been considered in prior works (Eysenbach et al., 2018; Han et al., 2015), although in different contexts – safe learning and learning compound controllers, respectively. Eysenbach et al. (2018) provide an algorithm to learn a reset controller with the goal of ensuring safe operation, but makes several assumptions that make it difficult to use in the real world: it assumes access to a ground truth reward function, it assumes access to an oracle function that can detect if an attempted reset by the reset policy was successful or not, and it assumes the ability to perform manual resets if the reset policy fails a certain number of times. In contrast, we propose an algorithm that allows for fully automated reinforcement learning in the real world. We compare to an ablation of our method that uses a reset controller similar to Eysenbach et al. (2018), and show that our method performs substantially better. Our perturbation controller also resembles the adversarial RL setup Pinto et al. (2017b); Sukhbaatar et al. (2018). However, while these prior methods explicitly aim to train policies that are robust to perturbations Pinto et al. (2017b) or explore effectively Sukhbaatar et al. (2018), we are concerned with learning without access to resets.
101
+
102
+ While this line of work has connections to developmental robotics (Lungarella et al., 2003; Asada et al., 2009) and its subfields, such as continual (Lesort et al., 2019) and lifelong (Thrun & Mitchell, 1995) learning, the goal of our work is to handle the practicalities of enabling reinforcement learning systems to learn in the real world without instrumentation or interruption, even for a single task setting. Though our work does not directly study continual lifelong learning, nor all facets of developmental robotics, it relates to continual learning (Lesort et al., 2019), intrinsic motivation (Schmidhuber, 2006) and sensory-motor development involving proprioceptive manipulation (Stoica, 2001).
103
+
104
+ # 6 EXPERIMENTS
105
+
106
+ In our experimental evaluation, we study how well the R3L system, described in Sections 2 and 4, can learn under realistic settings – visual observations, no hand-specified rewards, and no resets. We consider the following hypotheses:
107
+
108
+ 1. Can we use R3L to learn complex robotic manipulation tasks without instrumentation? Does this system learn skills in both simulation and the real world?
109
+ 2. Do the solutions proposed in Section 4 actually enable R3L to perform tasks without instrumentation that would not have been otherwise possible?
110
+
111
+ # 6.1 EXPERIMENTAL SETUP
112
+
113
+ We consider the task of dexterous manipulation with a three fingered robotic hand, the D’Claw (Zhu et al., 2019; Ahn et al., 2019), on a number of simulated and real world tasks. These tasks involve complex coordination of three fingers with 3 DoF each in order to manipulate objects. Prior works that used this robot utilized explicit resets and low-dimensional true state observations, while we consider settings with visual observations, no hand-specified rewards, and no resets.
114
+
115
+ ![](images/824a594d6c5e30f9a580b874265c711fa246312d33dda84adff8239823f14ea9.jpg)
116
+ Figure 6: Visualizations of the goal configurations of the simulated and real world tasks being considered. From left to right we depict valve rotation, bead manipulation and free object repositioning in simulation, as well as valve rotation and bead manipulation manipulation in the real world.
117
+
118
+ The tasks in our experiments are shown in Fig 6: manipulating beads on an abacus row, valve rotation, and free object repositioning. These tasks represent a wide class of problems that robots might encounter in the real world. For each task, we consider the problem of reaching the depicted goal configuration: moving the abacus beads to a particular position, rotating the valve to a particular angle, and repositioning the free object to a particular goal position. For each task, policies are evaluated from a wide selection of initial configurations. Additional details about the tasks and evaluation procedures are provided in Appendix C. Videos and additional details can be found at https://sites.google.com/view/realworld-rl/
119
+
120
+ # 6.2 LEARNING IN SIMULATION WITHOUT INSTRUMENTATION
121
+
122
+ We compare our entire proposed system implementation (Section 4) with a number of baselines and ablations. Importantly, all methods must operate under the same assumptions: none of the algorithms have access to system instrumentation for state estimation, reward specification, or episodic resets. Firstly, we compare the performance of R3L to a system which uses SAC for vision-based RL from raw pixels, VICE for providing rewards and running reset-free (denoted as “VICE”). This corresponds to the vanilla version of R3L (Section 2), with none of the proposed insights and changes. We then compare with prior reset-free RL algorithms (Eysenbach et al., 2018) that explicitly learn a reset controller to alternate goals in the state space (“Reset Controller $^ +$ VAE”). Lastly, we compare algorithm performance with two ablations: running R3L without the perturbation controller (“VICE $+ \ \mathrm { V A E } ^ { \prime \prime } )$ ) and without the unsupervised learning (“R3L w/o VAE”). This highlights the significance of each of the components of R3L .
123
+
124
+ From the experimental results in Fig 7, it is clear that R3L is able to reach the best performance across tasks, while none of the other methods are able to solve all of the tasks. Different prior methods and ablations fail for different reasons: (1) methods without the reconstruction objective struggle at parsing the high-dimensional input and are unable to solve the harder task; (2) methods without the perturbation controller are ineffective at learning how to reach the goal from novel initialization positions for the more challenging object repositioning tasks, as discussed in Section 4.
125
+
126
+ ![](images/16689f39419185c7ebec5a0ee2e8964bd3a1d3329c8a98a6d5098b217637ce35.jpg)
127
+ Figure 7: Quantitative evaluation of performance in simulation for bead manipulation, valve rotation and free object repositioning (left to right) run with 10 random seeds. The error bars show $9 5 \%$ bootstrap confidence intervals for average performance. While other variants are sufficient to get good evaluation performance on easier tasks, harder tasks like free object repositioning require random perturbations and unsupervised representation learning to learn skills reset-free. See Appendix C.1 for details of evaluation procedures.
128
+
129
+ We note that an explicit reset controller, which can be viewed as a softer version of our perturbation controller with goal-directedness, learns to solve the easier tasks due to the reset controller encouraging exploration of the state space. In our experiments for free object repositioning, performance was reported across 3 choices of reset states. The high variance in evaluation performance indicates that the performance of such a controller (or a goal conditioned variant of it) is highly sensitive to the choice of reset states. A poor choice of reset states, such as two that are very close together, may yield poor exploration leading to performance similar to the single goal VICE baseline. Furthermore, the choice of reset states is highly task dependent and it is often not clear what choice of goals will yield the best performance. On the contrary, our method does not require such task-specific knowledge and uses random perturbations to reset while training without any explicit reset states: this allows for a robust, instrumentation-free controller while also ensuring fast convergence.
130
+
131
+ # 6.3 LEARNING IN THE REAL WORLD WITHOUT INSTRUMENTATION
132
+
133
+ Since the aim of R3L is to enable uninstrumented training in the real world, we next evaluate our method on a real-world robotic system, providing evidence that our insights generalize to the real world without any instrumentation. After providing the initial outcome examples for learning the reward function with VICE, we leave the robot unattended, and the algorithm learns the desired behavior through interaction. The experiments are performed on the D’Claw robotic hand with an RGB camera as the only sensory input. Intermediate policies are saved at regular intervals, and evaluations of all policies is performed after training has completed. For valve rotation, we declare an evaluation rollout a success if the final orientation is within within $1 5 ^ { \circ }$ of the goal. For bead manipulation, we declare success if all the beads are within $2 \mathrm { c m }$ of the goal state. Fig 8 compares the performance of our method without supervised learning (“R3L w/o VAE”) in the real world against a baseline that uses SAC for vision-based RL from raw pixels, VICE for providing rewards, and running reset-free (denoted as “VICE”). We see that our method learns policies that succeed from nearly all the initial configurations, whereas VICE alone fails from most initial configurations. Fig 9 depicts sample evaluation rollouts of the policies learned using our method. For further details about real world experiments see Appendix C.2.
134
+
135
+ # 7 DISCUSSION
136
+
137
+ We presented the design and instantiation of a system for real world reinforcement learning. We identify and investigate the various ingredients required for such a system to scale gracefully with minimal human engineering and supervision. We show that this system must be able to learn from raw sensory observations, learn from very easily specified reward functions without reward engineering, and learn without any episodic resets. We describe the basic elements that are required to construct such a system, and identify unexpected learning challenges that arise from interplay of these elements. We propose simple and scalable fixes to these challenges through introducing unsupervised representation learning and a randomized perturbation controller.
138
+
139
+ ![](images/dad274348320cb8430ec089aa0a9ec78b973c42a0a84d8f326005b3a2f61f71a.jpg)
140
+ Figure 8: Quantitative evaluation of performance in real-world for valve rotation and bead manipulation. Policies trained with perturbation controllers have effectively learned behaviors after 17 and 5 hours of training, respectively. For more fine-grained reporting of results see Figs 13-16.
141
+
142
+ ![](images/aa753edabd7a309dd77434d6d462b21f9d280973740211557ec78a0770a770db.jpg)
143
+ Figure 9: Evaluation rollouts of R3L on the real world tasks for policies trained without instrumentation. Successful evaluation rollouts for bead manipulation (top) and valve rotation (bottom) are shown here.
144
+
145
+ The ability to train robots directly in the real world with minimal instrumentation opens a number of exciting avenues for future research. Robots that can learn unattended, without resets or handdesigned reward functions, can in principle collect very large amounts of experience autonomously, which may enable very broad generalization in the future. However, there are also a number of additional challenges, including sample complexity, optimization and exploration difficulties on more complex tasks, safe operation, communication latency, sensing and actuation noise, and so forth, all of which would need to be addressed in future work in order to enable truly scalable real-world robotic learning.
146
+
147
+ # ACKNOWLEDGMENTS
148
+
149
+ This research is supported by the Office of Naval Research, the National Science Foundation under IIS-1651843 and IIS-1700696, Google, NVIDIA, and Amazon. The authors would like to thank Ignasi Clavera, Gregory Kahn, Coline Devin, Benjamin Eysenbach, Aviral Kumar, Anusha Nagabandi, Marvin Zhang, Ashvin Nair and several others in the RAIL Lab for helpful discussions and feedback.
150
+
151
+ # REFERENCES
152
+
153
+ Michael Ahn, Henry Zhu, Kristian Hartikainen, Hugo Ponte, Abhishek Gupta, Sergey Levine, and Vikash Kumar. ROBEL: RObotics BEnchmarks for Learning with low-cost robots. In Conference on Robot Learning (CoRL), 2019.
154
+
155
+ Ankesh Anand, Evan Racah, Sherjil Ozair, Yoshua Bengio, Marc-Alexandre Cotˆ e, and R. Devon ´ Hjelm. Unsupervised state representation learning in atari. arXiv, 2019.
156
+
157
+ Marcin Andrychowicz, Bowen Baker, Maciek Chociej, Rafal Jozefowicz, Bob McGrew, Jakub Pachocki, Arthur Petron, Matthias Plappert, Glenn Powell, Alex Ray, et al. Learning dexterous in-hand manipulation. arXiv preprint arXiv:1808.00177, 2018.
158
+
159
+ Minoru Asada, Koh Hosoda, Yasuo Kuniyoshi, Hiroshi Ishiguro, Toshio Inui, Yuichiro Yoshikawa, Masaki Ogino, and Chisato Yoshida. Cognitive developmental robotics: A survey. IEEE Trans. Autonomous Mental Development, 1(1):12–34, 2009. doi: 10.1109/TAMD.2009.2021702. URL https://doi.org/10.1109/TAMD.2009.2021702.
160
+
161
+ Yuri Burda, Harrison Edwards, Amos Storkey, and Oleg Klimov. Exploration by random network distillation. arXiv preprint arXiv:1810.12894, 2018.
162
+
163
+ Yevgen Chebotar, Mrinal Kalakrishnan, Ali Yahya, Adrian Li, Stefan Schaal, and Sergey Levine. Path integral guided policy search. CoRR, abs/1610.00529, 2016.
164
+
165
+ Yevgen Chebotar, Karol Hausman, Marvin Zhang, Gaurav Sukhatme, Stefan Schaal, and Sergey Levine. Combining model-based and model-free updates for trajectory-centric reinforcement learning. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 703–711. JMLR. org, 2017.
166
+
167
+ Paul F Christiano, Jan Leike, Tom Brown, Miljan Martic, Shane Legg, and Dario Amodei. Deep reinforcement learning from human preferences. In Advances in Neural Information Processing Systems, pp. 4299–4307, 2017.
168
+
169
+ Ignasi Clavera, Jonas Rothfuss, John Schulman, Yasuhiro Fujita, Tamim Asfour, and Pieter Abbeel. Model-Based Reinforcement Learning via Meta-Policy Optimization. arXiv e-prints, art. arXiv:1809.05214, Sep 2018.
170
+
171
+ Coline Devin, Pieter Abbeel, Trevor Darrell, and Sergey Levine. Deep object-centric representations for generalizable robot learning. In 2018 IEEE International Conference on Robotics and Automation (ICRA), pp. 7111–7118. IEEE, 2018.
172
+
173
+ Benjamin Eysenbach, Shixiang Gu, Julian Ibarz, and Sergey Levine. Leave no trace: Learning to reset for safe and autonomous reinforcement learning. In International Conference on Learning Representations (ICLR), 2018.
174
+
175
+ Chelsea Finn and Sergey Levine. Deep visual foresight for planning robot motion. CoRR, abs/1610.00696, 2016. URL http://arxiv.org/abs/1610.00696.
176
+
177
+ Justin Fu, Avi Singh, Dibya Ghosh, Larry Yang, and Sergey Levine. Variational inverse control with events: A general framework for data-driven reward definition. In Advances in Neural Information Processing Systems, 2018.
178
+
179
+ Shixiang Gu, Ethan Holly, Timothy Lillicrap, and Sergey Levine. Deep reinforcement learning for robotic manipulation with asynchronous off-policy updates. In 2017 IEEE international conference on robotics and automation (ICRA), pp. 3389–3396. IEEE, 2017.
180
+
181
+ Abhishek Gupta, Clemens Eppner, Sergey Levine, and Pieter Abbeel. Learning dexterous manipulation for a soft robotic hand from human demonstrations. 2016 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pp. 3786–3793, 2016.
182
+
183
+ Tuomas Haarnoja, Aurick Zhou, Pieter Abbeel, and Sergey Levine. Soft actor-critic: Off-policy maximum entropy deep reinforcement learning with a stochastic actor. In Proceedings of the 35th International Conference on Machine Learning, 2018a.
184
+
185
+ Tuomas Haarnoja, Aurick Zhou, Kristian Hartikainen, George Tucker, Sehoon Ha, Jie Tan, Vikash Kumar, Henry Zhu, Abhishek Gupta, Pieter Abbeel, and Sergey Levine. Soft actor-critic algorithms and applications. arXiv preprint arXiv:1812.05905, 2018b.
186
+
187
+ Weiqiao Han, Sergey Levine, and Pieter Abbeel. Learning compound multi-step controllers under unknown dynamics. In 2015 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pp. 6435–6442. IEEE, 2015.
188
+
189
+ R Devon Hjelm, Alex Fedorov, Samuel Lavoie-Marchildon, Karan Grewal, Phil Bachman, Adam Trischler, and Yoshua Bengio. Learning deep representations by mutual information estimation and maximization. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ Bklr3j0cKX.
190
+
191
+ Max Jaderberg, Volodymyr Mnih, Wojciech Marian Czarnecki, Tom Schaul, Joel Z Leibo, David Silver, and Koray Kavukcuoglu. Reinforcement learning with unsupervised auxiliary tasks. arXiv preprint arXiv:1611.05397, 2016.
192
+
193
+ Dmitry Kalashnikov, Alex Irpan, Peter Pastor, Julian Ibarz, Alexander Herzog, Eric Jang, Deirdre Quillen, Ethan Holly, Mrinal Kalakrishnan, Vincent Vanhoucke, et al. Qt-opt: Scalable deep reinforcement learning for vision-based robotic manipulation. arXiv preprint arXiv:1806.10293, 2018.
194
+
195
+ Katie Kang, Suneel Belkhale, Gregory Kahn, Pieter Abbeel, and Sergey Levine. Generalization through Simulation: Integrating Simulated and Real Data into Deep Reinforcement Learning for Vision-Based Autonomous Flight. arXiv e-prints, art. arXiv:1902.03701, Feb 2019.
196
+
197
+ Diederik P. Kingma and Max Welling. Auto-encoding variational bayes. CoRR, abs/1312.6114, 2013.
198
+
199
+ Vikash Kumar, Emanuel Todorov, and Sergey Levine. Optimal control with learned local models: Application to dexterous manipulation. In 2016 IEEE International Conference on Robotics and Automation (ICRA), pp. 378–383. IEEE, 2016.
200
+
201
+ Alex X. Lee, Anusha Nagabandi, Pieter Abbeel, and Sergey Levine. Stochastic latent actor-critic: Deep reinforcement learning with a latent variable model. CoRR, abs/1907.00953, 2019.
202
+
203
+ Timothee Lesort, Vincenzo Lomonaco, Andrei Stoian, Davide Maltoni, David Filliat, and Na-´ talia D´ıaz Rodr´ıguez. Continual learning for robotics. CoRR, abs/1907.00182, 2019. URL http://arxiv.org/abs/1907.00182.
204
+
205
+ Sergey Levine and Vladlen Koltun. Guided policy search. In Proceedings of The 30th International Conference on Machine Learning, 2013.
206
+
207
+ Sergey Levine, Chelsea Finn, Trevor Darrell, and Pieter Abbeel. End-to-end training of deep visuomotor policies. J. Mach. Learn. Res., 17(1), 2016. ISSN 1532-4435.
208
+
209
+ Timothy P. Lillicrap, Jonathan J. Hunt, Alexander Pritzel, Nicolas Heess, Tom Erez, Yuval Tassa, David Silver, and Daan Wierstra. Continuous control with deep reinforcement learning. arXiv preprint arXiv:1509.02971, 2015.
210
+
211
+ YuXuan Liu, Abhishek Gupta, Pieter Abbeel, and Sergey Levine. Imitation from observation: Learning to imitate behaviors from raw video via context translation. In 2018 IEEE International Conference on Robotics and Automation (ICRA), pp. 1118–1125. IEEE, 2018.
212
+
213
+ Max Lungarella, Giorgio Metta, Rolf Pfeifer, and Giulio Sandini. Developmental robotics: a survey. Connection Science, 15(4):151–190, 2003. doi: 10.1080/09540090310001655110.
214
+
215
+ Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A. Rusu, Joel Veness, Marc G. Bellemare, Alex Graves, Martin Riedmiller, Andreas K. Fidjeland, Georg Ostrovski, Stig Petersen, Charles Beattie, Amir Sadik, Ioannis Antonoglou, Helen King, Dharshan Kumaran, Daan Wierstra, Shane Legg, and Demis Hassabis. Human-level control through deep reinforcement learning. Nature, 518(7540), 2015.
216
+
217
+ Anusha Nagabandi, Kurt Konoglie, Sergey Levine, and Vikash Kumar. Deep Dynamics Models for Learning Dexterous Manipulation. In Conference on Robot Learning (CoRL), 2019.
218
+
219
+ Ashvin Nair, Vitchyr Pong, Murtaza Dalal, Shikhar Bahl, Steven Lin, and Sergey Levine. Visual reinforcement learning with imagined goals. CoRR, abs/1807.04742, 2018.
220
+
221
+ Andrew Y. Ng and Stuart J. Russell. Algorithms for inverse reinforcement learning. In Proceedings of the Seventeenth International Conference on Machine Learning, ICML ’00, 2000. ISBN 1- 55860-707-2.
222
+
223
+ Xue Bin Peng, Marcin Andrychowicz, Wojciech Zaremba, and Pieter Abbeel. Sim-to-Real Transfer of Robotic Control with Dynamics Randomization. arXiv e-prints, art. arXiv:1710.06537, Oct 2017.
224
+
225
+ Lerrel Pinto, Marcin Andrychowicz, Peter Welinder, Wojciech Zaremba, and Pieter Abbeel. Asymmetric actor critic for image-based robot learning. arXiv preprint arXiv:1710.06542, 2017a.
226
+
227
+ Lerrel Pinto, James Davidson, Rahul Sukthankar, and Abhinav Gupta. Robust adversarial reinforcement learning. In Doina Precup and Yee Whye Teh (eds.), Proceedings of the 34th International Conference on Machine Learning, volume 70 of Proceedings of Machine Learning Research, pp. 2817–2826, International Convention Centre, Sydney, Australia, 06–11 Aug 2017b. PMLR. URL http://proceedings.mlr.press/v70/pinto17a.html.
228
+
229
+ Connor Schenck and Dieter Fox. Visual closed-loop control for pouring liquids. In 2017 IEEE International Conference on Robotics and Automation (ICRA), pp. 2629–2636. IEEE, 2017.
230
+
231
+ Jurgen Schmidhuber. Developmental robotics, optimal artificial curiosity, creativity, music, and ¨ the fine arts. Connect. Sci., 18(2):173–187, 2006. doi: 10.1080/09540090600768658. URL https://doi.org/10.1080/09540090600768658.
232
+
233
+ John Schulman, Sergey Levine, Pieter Abbeel, Michael Jordan, and Philipp Moritz. Trust region policy optimization. In International conference on machine learning, pp. 1889–1897, 2015.
234
+
235
+ John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
236
+
237
+ Avi Singh, Larry Yang, Kristian Hartikainen, Chelsea Finn, and Sergey Levine. End-to-end robotic reinforcement learning without reward engineering. In Robotics: Science and Systems (RSS), 2019.
238
+
239
+ Adrian Stoica. Robot fostering techniques for sensory-motor development of humanoid robots. Robotics and Autonomous Systems, 37(2-3):127–143, 2001. doi: 10.1016/S0921-8890(01) 00154-3. URL https://doi.org/10.1016/S0921-8890(01)00154-3.
240
+
241
+ Sainbayar Sukhbaatar, Zeming Lin, Ilya Kostrikov, Gabriel Synnaeve, Arthur Szlam, and Rob Fergus. Intrinsic motivation and automatic curricula via asymmetric self-play. In 6th International Conference on Learning Representations, ICLR 2018, 2018.
242
+
243
+ Sebastian Thrun and Tom M. Mitchell. Lifelong robot learning. Robotics and Autonomous Systems, 15(1-2):25–46, 1995. doi: 10.1016/0921-8890(95)00004-Y. URL https://doi.org/10. 1016/0921-8890(95)00004-Y.
244
+
245
+ Josh Tobin, Rachel Fong, Alex Ray, Jonas Schneider, Wojciech Zaremba, and Pieter Abbeel. Domain Randomization for Transferring Deep Neural Networks from Simulation to the Real World. arXiv e-prints, art. arXiv:1703.06907, Mar 2017.
246
+
247
+ Eric Tzeng, Coline Devin, Judy Hoffman, Chelsea Finn, Pieter Abbeel, Sergey Levine, Kate Saenko, and Trevor Darrell. Adapting Deep Visuomotor Representations with Weak Pairwise Constraints. arXiv e-prints, art. arXiv:1511.07111, Nov 2015.
248
+
249
+ Matej Vecerik, Todd Hester, Jonathan Scholz, Fumin Wang, Olivier Pietquin, Bilal Piot, Nicolas Heess, Thomas Rothorl, Thomas Lampe, and Martin A. Riedmiller. Leveraging demon- ¨ strations for deep reinforcement learning on robotics problems with sparse rewards. CoRR, abs/1707.08817, 2017. URL http://arxiv.org/abs/1707.08817.
250
+
251
+ Hongyi Zhang, Moustapha Cisse, Yann N. Dauphin, and David Lopez-Paz. mixup: Beyond empiri- ´ cal risk minimization. In International Conference on Learning Representations, 2018.
252
+
253
+ Henry Zhu, Abhishek Gupta, Aravind Rajeswaran, Sergey Levine, and Vikash Kumar. Dexterous manipulation with deep reinforcement learning: Efficient, general, and low-cost. In 2019 International Conference on Robotics and Automation (ICRA), pp. 3651–3657. IEEE, 2019.
254
+
255
+ A ALGORITHM DETAILS
256
+
257
+ # Algorithm 1 Real-World Robotic Reinforcement Learning (R3L)
258
+
259
+ <table><tr><td colspan="2">procedure R3L</td></tr><tr><td>1: 2:</td><td>N ← number of training epochs</td></tr><tr><td>3:</td><td>H ← trajectory length (horizon)</td></tr><tr><td>4:</td><td>nvICE ← number of VICE classifier training iterations per epoch</td></tr><tr><td>5:</td><td>Initialize forward and perturbing policies To,π1</td></tr><tr><td>6:</td><td>Obtain goal states sE and initialize as a goal pool G</td></tr><tr><td>7:</td><td>Initialize RND target and predictor networks f(s), f(s)</td></tr><tr><td>8:</td><td>Initialize VICE reward classifier rvICE(s)</td></tr><tr><td>9:</td><td>Initialize replay buffer D</td></tr><tr><td>10:</td><td>Collect initial exploration data and add to D</td></tr><tr><td>11:</td><td>for i= 1 to 2N do</td></tr><tr><td>12:</td><td>k←i%2</td></tr><tr><td>13:</td><td>for t = 1 to H do</td></tr><tr><td>14:</td><td>Sample at ~ Tk(St)</td></tr><tr><td>15:</td><td>Sample St+1 ~ p(St+1|St,at)</td></tr><tr><td>16:</td><td>if k== O then</td></tr><tr><td>17:</td><td>rt(St)= CVICE * rVICE(St)+ CRND * rRND(St)</td></tr><tr><td>18:</td><td>else if k==1 then</td></tr><tr><td>19:</td><td>rt(St)= rRND(St)</td></tr><tr><td>20:</td><td>end if</td></tr><tr><td>21:</td><td>Sample batch from D</td></tr><tr><td>22:</td><td>Update πk with batch according to SAC</td></tr><tr><td>23:</td><td>Update RND predictor network with batch</td></tr><tr><td>24:</td><td>Update running estimate of standard deviations of classifier and RND reward</td></tr><tr><td>25:</td><td>end for</td></tr><tr><td>26:</td><td>Add experience to the replay buffer with D ← DU Ti</td></tr><tr><td>27:</td><td>Sample an equal number of goal examples from G and negative examples from D</td></tr><tr><td>28:</td><td>for t= 1 to nvice do</td></tr><tr><td>29:</td><td>Train the VICE classifier on this batch with binary labels</td></tr><tr><td>30:</td><td>end for</td></tr><tr><td>31:</td><td>end for</td></tr><tr><td>32: end procedure</td><td></td></tr></table>
260
+
261
+ # B TRAINING DETAILS
262
+
263
+ B.0.1 HYPERPARAMETERS
264
+
265
+ <table><tr><td rowspan=1 colspan=1>General</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>Standard deviation up-date coefficientImage Sizes</td><td rowspan=1 colspan=1>0.99[(16, 16,3), (32,32,3), (64, 64, 3)]</td></tr><tr><td rowspan=1 colspan=1>SAC</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>Learning RateyBatch SizeConvnet FiltersStrideKernel SizesPoolingActor/Critic FC Lay-ers</td><td rowspan=1 colspan=1>3e-40.99256[(64, 64,64), (16,32, 64)](2,2)(3,3)[MaxPool2D,None][(512,512), (256, 256, 256)]</td></tr><tr><td rowspan=1 colspan=1>VICE</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>nvICEBatch SizeLearning RateMixup αConvnet FiltersStrideKernel SizesPoolingFC Layers</td><td rowspan=1 colspan=1>[1,5,10]1281e-4Uniform(0, 1)[(64, 64,64), (16, 32, 64)](2,2)(3,3)[MaxPool2D,None][(512,512), (256,256,256)]</td></tr><tr><td rowspan=1 colspan=1>RND</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>Learning RateBatch SizeConvnet FiltersStrideKernel SizesPoolingFC Layers</td><td rowspan=1 colspan=1>3e-4256(16, 32, 64)(2,2)(3,3)[MaxPool2D, None][(512,512), (256,256,256)]</td></tr><tr><td rowspan=1 colspan=1>VAE</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>Learning RateBatch SizeEncoder (Convnet)FiltersLatent DimensionβStrideKernel SizesPooling</td><td rowspan=1 colspan=1>1e-4256(64, 64, 32)[8, 16,32, 64][1e-3, 0.1, 0.5, 1, 10](2,2)(3,3)[MaxPool2D, None]</td></tr></table>
266
+
267
+ The ranges of values listed above represent the hyperparameters we searched over, and the bolded values are what we use in the Section 6 experiments.
268
+
269
+ # B.0.2 VICE
270
+
271
+ We use a variant of VICE which defines the reward as the logits of the classifier, notably omitting the $- l o g ( \pi ( a | s ) )$ term. We also regularize our classifier with mixup (Zhang et al., 2018). We train all of our experiments using 200 goal images, which takes under an hour to collect in the real world for each task.
272
+
273
+ # B.0.3 RANDOM NETWORK DISTILLATION (RND)
274
+
275
+ We found it important to normalize the predictor errors, just as (Burda et al., 2018) did.
276
+
277
+ # B.0.4 VAE
278
+
279
+ We train a standard beta-VAE to maximize the evidence lower bound, given by:
280
+
281
+ $$
282
+ \mathbb { E } _ { z \sim q _ { \phi } ( z | x ) } [ p _ { \theta } ( x | z ) ] - \beta D _ { \mathrm { K L } } ( q _ { \phi } ( z | x ) | | p _ { \theta } ( z ) )
283
+ $$
284
+
285
+ To collect training data, we sampled random states in the observation space. In the real world, this sampling can be replaced with training an exploratory policy (i.e. using the RND reward as the policy’s only objective). The learned weights of the encoder of the VAE are frozen, and the latent input is used to train the policy for reset-free RL.
286
+
287
+ # C TASK DETAILS
288
+
289
+ # C.1 SIMULATED TASKS
290
+
291
+ We evaluated our system across three tasks in simulation: bead manipulation, valve rotation, free object repositioning.
292
+
293
+ # C.1.1 BEAD MANIPULATION
294
+
295
+ The bead manipulation task involves an abacus rod with four beads that can slide freely. The goal is to position two beads on each end from any initial configuration of beads. This can take the form of sliding one bead over (if three beads start on one side), two beads over (if all four beads start on one side), splitting beads apart (all four beads start in the middle), or some intermediate combination of those. The true reward is defined as the mean goal distance of all four beads. Policies are evaluated starting from the 8 initial configurations depicted in Fig 10. Evaluation performance reported in Section 6 for this task is defined as the final reward averaged across the 8 evaluation rollouts.
296
+
297
+ ![](images/080c6495f909ccd2083348ee2a02e0be2c3e68b87486d16c7fe5e20650758e62.jpg)
298
+ Figure 10: These are the 8 initial positions used for evaluating the performance of the bead manipulation policy. The goal configuration (which is also an initial evaluation position) is highlighted in yellow.
299
+
300
+ # C.1.2 VALVE ROTATION
301
+
302
+ The claw is positioned above a three pronged valve ( $1 5 \mathrm { c m }$ in diameter). The objective is to turn the valve to a given orientation from any initial orientation. The ”true reward” is $\dot { r } = - \log ( | \theta _ { s t a t e } -$ $\theta _ { g o a l } | .$ ). Policies are evaluated starting from the 8 initial configurations depicted in Fig 11. Evaluation performance reported in Section 6 for this task is defined as the final orientation distance averaged across the 8 evaluation rollouts.
303
+
304
+ # C.1.3 FREE OBJECT REPOSITIONING
305
+
306
+ The claw is positioned atop a free $6 ~ \mathrm { D o F } )$ three pronged object ( $1 5 \mathrm { c m }$ in diameter), which can translate and rotate within a $3 0 \mathrm { c m } x 3 0 \mathrm { c m }$ box. The goal is specified by a xy-position as well as a $\mathbf { Z }$ -angle, where the xy-plane is the plane of the arena. The true reward is defined as the weighted sum of the angular and translational distances, $r = - 2 \log ( | | [ x _ { s t a t e } , y _ { s t a t e } ] - [ x _ { g o a l } , y _ { g o a l } ] | | _ { 2 } ) -$ $\log ( | \theta _ { s t a t e } - \theta _ { g o a l } | )$ . In our experiments, $( x , y , \theta ) _ { g o a l } = ( 0 , 0 , - \frac { \pi } { 2 } )$ , where the origin is centered in the arena. Policies are evaluated starting from the 15 initial configurations depicted in Figure 12. Evaluation performance reported in Section 6 for this task is defined as the final pose distance ( ||[xf inal,yf inal]−[xgoal,ygoal]||2 + |θf inal−θgoal| ) averaged across the 15 evaluation rollouts.
307
+
308
+ ![](images/2fc0e811e81e0386a99cca981233798437bab0e05c9f8cf66ad0402316a68fe0.jpg)
309
+ Figure 11: These are the 8 initial positions used for evaluating the performance of the valve rotation policy. The goal configuration (which is also an initial evaluation position) is highlighted in yellow.
310
+
311
+ In our reset controller experiments, we averaged evaluation performance over three different choices of reset states, where the first reset state is always the goal:
312
+
313
+ 1. $( x , y , \theta ) _ { r e s e t , 1 } = ( x , y , \theta ) _ { g o a l } , ( x , y , \theta ) _ { r e s e t , 2 } = ( 0 . 0 5 , 0 . 0 5 , \frac { \pi } { 2 } )$
314
+ 2. $\begin{array} { r } { ( x , y , \theta ) _ { r e s e t , 1 } = ( x , y , \theta ) _ { g o a l } , ( x , y , \theta ) _ { r e s e t , 2 } = ( 0 , 0 , - \frac { \pi } { 6 } ) } \end{array}$
315
+ 3. $( x , y , \theta ) _ { r e s e t , 1 } = ( x , y , \theta ) _ { g o a l } , ( x , y , \theta ) _ { r e s e t , 2 } = ( - 0 . 0 4 , - 0 . 0 4 , - \frac { \pi } { 2 } )$
316
+
317
+ ![](images/1b1a729609dbfdd4bff369f64e48f133a4dc620e897c2ab6a14904cca1c9dbe4.jpg)
318
+ Figure 12: These are the 15 initial positions used for evaluating the performance of the free object repositioning policy. The goal configuration $( x , y , \theta ) _ { g o a l }$ which is also an initial evaluation position is highlighted in yellow.
319
+
320
+ # C.2 REAL WORLD TASKS
321
+
322
+ For each setup we use an RGB camera to get images. We execute actions on the DClaw at $1 0 \mathrm { H z }$ . In order to operate at such a high frequency while also training from images we sample and train asynchronously, but limit training to not exceed two gradient steps per transition sampled in the real world. Since direct performance metrics cannot be measured during training due to the lack of object instrumentation, evaluations of performance are done post-training.
323
+
324
+ # C.2.1 VALVE ROTATION
325
+
326
+ The task is identical to the one in simulation. Evaluations were done post-training. An evaluation trajectory was defined as a success if at the last step, the valve was within 15 degrees of the goal. Each policy was evaluated over 8 rollouts, with initial configurations evenly spaced out between at increments of 45 degrees. Results are reported in Figures 13, 14.
327
+
328
+ # C.2.2 BEAD MANIPULATION
329
+
330
+ The rod is $2 2 \mathrm { c m }$ in length, and each bead measures $3 . 5 \mathrm { c m }$ in diameter. Evaluations were done post-training, using the following procedure: the environment was manually reset to each of the 8 specified configurations shown in Figures 15 and 16 (which cover a full range of the state space) at the start of each evaluation rollout. An evaluation trajectory was defined as a success if at the last time step, all beads were within $2 \mathrm { c m }$ of their goal positions. Performance was evaluated at around 20 hours, at which point the policy achieved greater than $80 \%$ success on the 10 evaluation rollouts (a random policy achieved a success rate of $10 \%$ ). Results are reported in Figs 15, 16.
331
+
332
+ ![](images/7a90b025f1eac655661ca465e4c18b4e9bb25b2a296dbae63b4b880663793aff.jpg)
333
+ Figure 13: These are the results of the evaluation rollouts on the valve rotation task in the real world using our method (without the VAE). Trained policies were saved at regular intervals and evaluated post-training. Each row is a different policy, and each column an evaluation rollout from a different initial configuration. The goal is highlighted in yellow. Our method is able to achieve high success rates after 5 hours of training.
334
+
335
+ ![](images/124c852ede375572bcb431d4c7898f2ef36299c9da3133ec70dbeee81eee744d.jpg)
336
+ Figure 14: These are the results of evaluation rollouts on the valve rotation task in the real world using the VICE single goal baseline. The policies fail to evaluate well, especially from initial positions far from the goal position.
337
+
338
+ ![](images/30f66949f6e9e5f3f38c8a70eb2082962ea087319babcbeafcf552e09b61101e.jpg)
339
+ Figure 15: These are the results of the evaluation rollouts on the valve rotation task in the real world using our method (without the VAE). Trained policies were saved at regular intervals and evaluated post-training. Each row is a different policy, and each column an evaluation rollout from a different initial configuration. The goal is highlighted in yellow. Our method is able to achieve high success rates after 17 hours of training.
340
+
341
+ ![](images/3f8949a077ed83c173449febf904e9b7fa2f6c6fc40c84db953357f2ba8c7515.jpg)
342
+ Figure 16: These are the results of evaluation rollouts on the valve rotation task in the real world using the VICE single goal baseline. The policies fail to evaluate consistently, except when the initial configuration matches the goal configuration.
md/train/rcQdycl0zyk/rcQdycl0zyk.md ADDED
@@ -0,0 +1,344 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # BEYOND FULLY-CONNECTED LAYERS WITH QUATERNIONS: PARAMETERIZATION OF HYPERCOMPLEX MULTIPLICATIONS WITH $1 / n$ PARAMETERS
2
+
3
+ Aston Zhang†, Yi Tay‡∗, Shuai Zhang, Alvin Chan/
4
+ Anh Tuan Luu/,◦, Siu Cheung $\mathbf { H u i } ^ { \mathrm { q } }$ , Jie $\mathbf { F u } ^ { \bullet }$
5
+ †Amazon Web Services AI
6
+ ‡Google Research
7
+ ETH Zurich¨
8
+ /NTU, Singapore
9
+ ◦VinAI
10
+ •Mila, Universite de Montr ´ eal ´
11
+ az@astonzhang.com
12
+
13
+ # ABSTRACT
14
+
15
+ Recent works have demonstrated reasonable success of representation learning in hypercomplex space. Specifically, “fully-connected layers with quaternions” (quaternions are 4D hypercomplex numbers), which replace real-valued matrix multiplications in fully-connected layers with Hamilton products of quaternions, both enjoy parameter savings with only $1 / 4$ learnable parameters and achieve comparable performance in various applications. However, one key caveat is that hypercomplex space only exists at very few predefined dimensions (4D, 8D, and 16D). This restricts the flexibility of models that leverage hypercomplex multiplications. To this end, we propose parameterizing hypercomplex multiplications, allowing models to learn multiplication rules from data regardless of whether such rules are predefined. As a result, our method not only subsumes the Hamilton product, but also learns to operate on any arbitrary $n \mathbf { D }$ hypercomplex space, providing more architectural flexibility using arbitrarily $1 / n$ learnable parameters compared with the fully-connected layer counterpart. Experiments of applications to the LSTM and transformer models on natural language inference, machine translation, text style transfer, and subject verb agreement demonstrate architectural flexibility and effectiveness of the proposed approach.
16
+
17
+ # 1 INTRODUCTION
18
+
19
+ A quaternion is a 4D hypercomplex number with one real component and three imaginary components. The Hamilton product is the hypercomplex multiplication of two quaternions. Recent works in quaternion space and Hamilton products have demonstrated reasonable success (Parcollet et al., 2018b; 2019; Tay et al., 2019). Notably, the Hamilton product enjoys a parameter saving with $1 / 4$ learnable parameters as compared with the real-valued matrix multiplication. It also enables effective representation learning by modeling interactions between real and imaginary components.
20
+
21
+ One of the attractive properties of quaternion models is its high applicability and universal usefulness to one of the most ubiquitous layers in deep learning, i.e., the fully-connected (or feedforward) layer. Specifically, “fully-connected layers with quaternions” replace real-valued matrix multiplications in fully-connected layers with Hamilton products of quaternions, enjoying parameter savings with only $1 / 4$ learnable parameters and achieving comparable performance with their fully-connected layer counterparts (Parcollet et al., 2018b; 2019; Tay et al., 2019).
22
+
23
+ The fully-connected layer is one of the most dominant components in existing deep learning literature (Goodfellow et al., 2016; Zhang et al., 2020). Its pervasiveness cannot be understated, given its centrality to many core building blocks in neural network research. Given widespread adoptions of fully-connected layers, e.g., within LSTM networks (Hochreiter & Schmidhuber, 1997) and transformer models (Vaswani et al., 2017), having flexibility to balance between parameter savings and effectiveness could be extremely useful to many real-world applications.
24
+
25
+ Unfortunately, hypercomplex space only exists at 4D (quaternions), 8D (octonions), and 16D (sedenions), which generalizes the 2D complex space (Rishiyur, 2006). Moreover, custom operators are required at each hypercomplex dimensionality. For instance, the Hamilton product is the hypercomplex multiplication in 4D hypercomplex space. Thus, no operator in such predefined hypercomplex space is suitable for applications that prefer reducing parameters to $1 / n$ , where $n \neq 4 , 8 , 1 6$ .
26
+
27
+ In view of the architectural limitation due to the very few choices of those existing hypercomplex space, we propose parameterization of hypercomplex multiplications, i.e., learning the real and imaginary component interactions from data in a differentiable fashion. Essentially, our method can operate on an arbitrary $n \mathbf { D }$ hypercomplex space, aside from subsuming those predefined hypercomplex multiplication rules, facilitating using up to arbitrarily $1 / n$ learnable parameters while maintaining expressiveness. In practice, the hyperparameter $n$ can be flexibly specified or tuned by users based on applications.
28
+
29
+ Concretely, our prime contribution is a new module that parameterizes and generalizes the hypercomplex multiplication by learning the real and imaginary component interactions, i.e., multiplication rules, from data. Our method, which we call the parameterized hypercomplex multiplication layer, is characterized by a sum of Kronecker products that generalize the vector outer products to higher dimensions in real space. To demonstrate applicability, we equip two well-established models (the LSTM and transformer) with our proposed method. We conduct extensive experiments on different tasks, i.e., natural language inference for LSTM networks and machine translation for transformer models. Additionally, we perform further experiments on text style transfer and subject verb agreement tasks. All in all, our method has demonstrated architectural flexibility through different experimental settings, where it generally can use a fraction of the learnable parameters with minimal degradation or slight improvement in performance.
30
+
31
+ The overall contributions of this work are summarized as follows:
32
+
33
+ We propose a new parameterization of hypercomplex multiplications: the parameterized hypercomplex multiplication (PHM) layer. This layer has $1 / n$ learnable parameters compared with the fully-connected layer counterpart, where $n$ can be flexibly specified by users. The key idea behind PHM layers is to learn the interactions between real and imaginary components, i.e., multiplication rules, from data using a sum of Kronecker products. We demonstrate the applicability of the PHM layers by leveraging them in two dominant neural architectures: the LSTM and transformer models. We empirically show architectural flexibility and effectiveness of PHM layers by conducting extensive experiments on five natural language inference tasks, seven machine translation datasets, together with text style transfer and subject verb agreement tasks.
34
+
35
+ # 2 BACKGROUND ON QUATERNIONS AND HAMILTON PRODUCTS
36
+
37
+ We begin by introducing the background for the rest of the paper. Concretely, we describe quaternion algebra along with Hamilton products, which is at the heart of our proposed approach.
38
+
39
+ Quaternion A quaternion $Q \in \mathbb { H }$ is a hypercomplex number with one real component and three imaginary components as follows:
40
+
41
+ $$
42
+ Q = Q _ { r } + Q _ { x } { \bf i } + Q _ { y } { \bf j } + Q _ { z } { \bf k } ,
43
+ $$
44
+
45
+ whereby $\mathbf { i j k } = \mathbf { i } ^ { 2 } = \mathbf { j } ^ { 2 } = \mathbf { k } ^ { 2 } = { \mathbf { - } } 1$ . In (2.1), noncommutative multiplication rules hold: $\mathbf { i } \mathbf { j } =$ $\mathbf { k } , \mathbf { j } \mathbf { k } = \mathbf { i } , \mathbf { k } \mathbf { i } = \mathbf { j } , \mathbf { j } \mathbf { i } = - \mathbf { k } , \mathbf { k } \mathbf { j } = - \mathbf { i } , \mathbf { i } \mathbf { k } = - \mathbf { j } .$ Here, $Q _ { r }$ is the real component, $Q _ { x } , Q _ { y } , Q _ { z }$ are real numbers that represent the imaginary components of the quaternion $Q$ .
46
+
47
+ Addition The addition of two quaternions is defined as
48
+
49
+ $$
50
+ Q + P = Q _ { r } + P _ { r } + ( Q _ { x } + P _ { x } ) \mathbf { i } + ( Q _ { y } + P _ { y } ) \mathbf { j } + ( Q _ { z } + P _ { z } ) \mathbf { k } ,
51
+ $$
52
+
53
+ here $Q$ and $P$ with subscripts denote the real and imaginary components of quaternions $Q$ and
54
+
55
+ Scalar Multiplication Any scalar $\alpha$ multiplies across all the components:
56
+
57
+ $$
58
+ \alpha Q = \alpha Q _ { r } + \alpha Q _ { x } { \bf i } + \alpha Q _ { y } { \bf j } + \alpha Q _ { z } { \bf k } .
59
+ $$
60
+
61
+ Hamilton Product The Hamilton product, which represents the multiplication of two quaternions $Q$ and $P$ , is defined as
62
+
63
+ $$
64
+ \begin{array} { r l } & { Q \otimes P = ( Q _ { r } P _ { r } - Q _ { x } P _ { x } - Q _ { y } P _ { y } - Q _ { z } P _ { z } ) + ( Q _ { x } P _ { r } + Q _ { r } P _ { x } - Q _ { z } P _ { y } + Q _ { y } P _ { z } ) \mathbf { i } } \\ & { \qquad + ( Q _ { y } P _ { r } + Q _ { z } P _ { x } + Q _ { r } P _ { y } - Q _ { x } P _ { z } ) \mathbf { j } + ( Q _ { z } P _ { r } - Q _ { y } P _ { x } + Q _ { x } P _ { y } + Q _ { r } P _ { z } ) \mathbf { k } . } \end{array}
65
+ $$
66
+
67
+ The multiplication rule in (2.2) forges interactions between real and imaginary components of $Q$ and $P$ . The benefits of Hamilton products have been demonstrated in recent works where the matrix multiplication in fully-connected layers is replaced with the Hamilton product: this reduces $7 5 \%$ parameters with comparable performance (Parcollet et al., 2018b; 2019; Tay et al., 2019).
68
+
69
+ # 3 PARAMETERIZATION OF HYPERCOMPLEX MULTIPLICATIONS
70
+
71
+ The following introduces our proposed parameterized hypercomplex multiplication layer and elaborates on how it parameterizes and generalizes multiplications in hypercomplex space, such as subsuming the multiplication rules of Hamilton products in (2.2).
72
+
73
+ # 3.1 FULLY-CONNECTED (FC) LAYERS
74
+
75
+ Before we delve into our proposed method, recall the fully-connected (FC) layer that transforms an input $\mathbf { x } \in \mathbb { R } ^ { d }$ into an output $\mathbf { \hat { y } } \in \mathbb { R } ^ { k }$ by
76
+
77
+ $$
78
+ \begin{array} { r } { \mathbf { y } = \operatorname { F C } ( \mathbf { x } ) = \mathbf { W } \mathbf { x } + b , } \end{array}
79
+ $$
80
+
81
+ where the weight matrix of parameters $\mathbf { W } \in \mathbb { R } ^ { k \times d }$ and the bias vector of parameters $\mathbf { b } \in \mathbb { R } ^ { k }$ . The FC layer in (3.1) is fundamental to many modern and traditional neural network architectures. Note that the degree of freedom for the weight parameters $\mathbf { W }$ in (3.1) is $k d$ . Since W dominates parameterization, the parameter size of the FC layer in (3.1) is $\mathcal { O } ( k d )$ .
82
+
83
+ # 3.2 PARAMETERIZED HYPERCOMPLEX MULTIPLICATION (PHM) LAYERS
84
+
85
+ We propose the parameterized hypercomplex multiplication (PHM) layer that transforms an input $\mathbf { x }$ into an output y by
86
+
87
+ $$
88
+ \mathbf { y } = \mathbf { P H M } ( \mathbf { x } ) = \mathbf { H x } + b ,
89
+ $$
90
+
91
+ where the same notation from (3.1) is used but the replaced parameter $\mathbf { H } \in \mathbb { R } ^ { k \times d }$ is constructed by a sum of Kronecker products. For context, the Kronecker product is a generalization of the vector outer product to higher dimensions in real space. For any matrix $\mathbf { X } \in \mathbb { R } ^ { m \times n }$ and $\mathbf { Y } \in \mathbb { R } ^ { p \times q }$ , the Kronecker product $\mathbf { X } \otimes \mathbf { Y }$ is a block matrix:
92
+
93
+ $$
94
+ \mathbf { X } \otimes \mathbf { Y } = \left[ \overset { x _ { 1 1 } \mathbf { Y } } { \mathop { : } } \quad \cdots \quad \overset { x _ { 1 n } \mathbf { Y } } { \mathop { : } } \right] \in \mathbb { R } ^ { m p \times n q } ,
95
+ $$
96
+
97
+ where $x _ { i j }$ is the element of $\mathbf { X }$ at its $i ^ { \mathrm { { t h } } }$ row and $j ^ { \mathrm { t h } }$ column. Note that the symbol $\otimes$ between two matrices is the Kronecker product while the same symbol between two quaternions means the Hamilton product.
98
+
99
+ Now let us revisit (3.2) to explain $\mathbf { H }$ . Suppose that both $k$ and $d$ are divisible by a user-defined hyperparameter $n \in \mathbb { Z } _ { > 0 }$ . For $i = 1 , \ldots , n$ , denote by each parameter matrix $\mathbf { A } _ { i } \in \mathbb { R } ^ { n \times n }$ and $\mathbf { S } _ { i } \in \mathbb { R } ^ { \frac { k } { n } \times \frac { d } { n } }$ . The parameter $\mathbf { H }$ in (3.2) is a sum of $n$ Kronecker products:
100
+
101
+ $$
102
+ \mathbf { H } = \sum _ { i = 1 } ^ { n } \mathbf { A } _ { i } \otimes \mathbf { S } _ { i } .
103
+ $$
104
+
105
+ ![](images/a5af67ef1df76834bac2a02f3677cc912b718cb785bf7eb2e984263306dccc29.jpg)
106
+ Figure 1: Illustration of the PHM layer. It uses a sum of Kronecker products of matrices $\mathbf { A } _ { i }$ and $\mathbf { S } _ { i }$ $( i = 1 , 2 )$ ) to construct $\mathbf { H }$ in (3.2) (here $n = 2 , k = 6 , d = 8 )$ . Best viewed in color.
107
+
108
+ ![](images/0cf6d07791b83779291cc92ceab9d1e53d99f794e94735a40264f6dc05a8f939.jpg)
109
+ Figure 2: PHM layers can learn to perform rotations in 3D real space and Hamilton products in quaternion space on artificial datasets.
110
+
111
+ As illustrated in Figure 1, it is the parameter matrices $\mathbf { A } _ { i }$ and $\mathbf { S } _ { i }$ $( i = 1 , \ldots , n )$ that determine the degree of freedom for $\mathbf { H }$ , which is $\bar { k } d / n + n ^ { 3 }$ . Since H dominates parameterization, the parameter size of the PHM in (3.2) is $\mathcal { O } ( k d / n )$ , where $k d \gtrapprox n ^ { 4 }$ is assumed: this condition is mild for realworld problems, such as in our experiments (e.g., $d = 5 1 2$ , $k = 2 0 4 8$ , $n = 2 , 4 , 8 , 1 6 )$ ). Thus, for the same input and output sizes, the parameter size of a PHM layer is approximately $1 / n$ of that of an FC layer under mild assumptions.
112
+
113
+ The benefit of parameterization reduction of PHM layers is due to reusing elements of both parameter matrices $\mathbf { A } _ { i }$ and $\mathbf { S } _ { i }$ in the Kronecker product. As an alternative perspective, we can equivalently reconstruct $\mathbf { H }$ in (3.3) by reusing parameter matrices in real-valued matrix multiplications, followed by more operations. Due to limited space, this more complicated perspective is offered in Appendix A. Though simply setting $\mathbf { H } = \mathbf { A } _ { 1 } \otimes \mathbf { S } _ { 1 }$ can further save parameters, it does not generalize hypercomplex multiplications hence is out of scope.
114
+
115
+ To show that PHM layers can learn to perform pre-defined multiplication-related operations in practice, we perform experiments to learn rotations in 3D real space using the PHM layer. Using a rotation matrix $\mathbf { W } \in \mathbb { R } ^ { 3 \times 3 }$ we create an artificial dataset $\{ ( \mathbf { x } _ { i } \mathbf { \bar { \epsilon } } ) \mathbf { R } ^ { 3 } , \mathbf { y } _ { i } \mathbf { \bar { \epsilon } } \mathbb { R } ^ { 3 } ) \}$ , where $\mathbf { y } _ { i }$ is generated via the 3D rotation of the input: $\mathbf { y } _ { i } = \mathbf { W } \mathbf { x } _ { i }$ . Figure 2(a) shows that the loss converges to zero: the PHM layer can learn a single rotation of an object in 3D real space.
116
+
117
+ In the following, we show how the proposed PHM layer subsumes and generalizes both hypercomplex multiplications and real-valued matrix multiplications.
118
+
119
+ # 3.3 SUBSUMING HYPERCOMPLEX MULTIPLICATIONS
120
+
121
+ First, we explore how the PHM layer connects to the hypercomplex multiplication. For the sake of illustration, let us take the Hamilton product of two quaternions $Q$ and $P$ in (2.2) as an example,
122
+
123
+ which can be rewritten as
124
+
125
+ $$
126
+ \left[ { \begin{array} { c c c c } { Q _ { r } } & { - Q _ { x } } & { - Q _ { y } } & { - Q _ { z } } \\ { Q _ { x } } & { Q _ { r } } & { - Q _ { z } } & { Q _ { y } } \\ { Q _ { y } } & { Q _ { z } } & { Q _ { r } } & { - Q _ { x } } \\ { Q _ { z } } & { - Q _ { y } } & { Q _ { x } } & { Q _ { r } } \end{array} } \right] \left[ { \begin{array} { c } { P _ { r } } \\ { P _ { x } } \\ { P _ { y } } \\ { P _ { z } } \end{array} } \right] ,
127
+ $$
128
+
129
+ where the 4 output elements are the real values for the quaternion unit basis $[ 1 , \mathbf { i } , \mathbf { j } , \mathbf { k } ] ^ { \top }$ . Note that for models leveraging Hamilton products of quaternions (Parcollet et al., 2018b; 2019; Tay et al., 2019), the components $Q _ { r } , Q _ { x } , Q _ { y } , Q _ { z }$ of (3.4) are learnable parameters while the components $P _ { r } , P _ { x } , P _ { y } , P _ { z }$ are the layer inputs. In practice, such a layer usually has more than 4 inputs $( d > 4 )$ . To apply the Hamilton product, all the inputs are evenly split into 4 segments $( P _ { r } , P _ { x } , P _ { y } , P _ { z } )$ of the right input vector of (3.4). Then each component in the left matrix of (3.4) can be a block matrix (i) where all the elements take the same value; (ii) whose shape is aligned with the input length $d$ and the output length $k$ of the layer. It is noteworthy that the left $4 \times 4$ matrix of (3.4) can be rewritten as a sum of 4 Kronecker products:
130
+
131
+ ![](images/ea53bd24a3f8b26822497e6dd178d6de9bc9a4a7983d64fa938b28c9bf6ce775.jpg)
132
+
133
+ According to (3.5), when $n = 4$ , the PHM layer can be learned to express the Hamilton product of quaternions. Specifically, matrices $\mathbf { A } _ { 1 } , \dotsc , \mathbf { A } _ { 4 }$ in (3.3) parameterize the four matrices composed of $- 1 , 0 , 1$ in (3.5) that reflect interactions between real and imaginary components of quaternions, which are the rule of Hamilton products. The single-element “matrices” $\mathbf { S } _ { 1 } , \ldots , \mathbf { S } _ { 4 }$ in (3.3) are equal to the learnable components $Q _ { r } , Q _ { x } , Q _ { y } , Q _ { z }$ in (3.4). Figure 2(b) shows that PHM layers can learn the rule of Hamilton products on artificial data. Likewise, hypercomplex multiplications of octonions or sedenions can also be learned by the PHM layer when $n$ is set to 8 or 16.
134
+
135
+ # 3.4 SUBSUMING REAL-VALUED MATRIX MULTIPLICATIONS
136
+
137
+ Next, we show how the PHM layer subsumes the matrix multiplication in real space. In other words, the PHM layer is a generalization of the FC layer via the hyperparameter $n$ . To explain, referring to (3.2), when $n = 1$ , $\mathbf { \bar { H } } = \mathbf { A _ { 1 } } \otimes \mathbf { S } _ { 1 } = a \mathbf { S } _ { 1 }$ , where the scalar $a$ is the single element of the $1 \times 1$ matrix ${ \bf A } _ { 1 }$ and $\mathbf { S } _ { 1 } \in \mathbb { R } ^ { k \times d }$ . Since learning $a$ and $\mathbf { S } _ { 1 }$ separately is equivalent to learning their multiplication jointly, scalar $a$ can be dropped, which is learning the single weight matrix in an FC layer. Therefore, a PHM layer is degenerated to an FC layer when $n = 1$ .
138
+
139
+ # 3.5 GENERALIZING HYPERCOMPLEX MULTIPLICATIONS
140
+
141
+ Though parameter reusing by component-wise partitioning in quaternion space has demonstrated success (Parcollet et al., 2018b; Zhu et al., 2018; Parcollet et al., 2019; Tay et al., 2019), one key problem is that hypercomplex space only exists at very few predefined dimensionalities, such as 4D (quaternions), 8D (octonions), and 16D (sedenions). Within the context of hypercomplex space, specialized multiplication rules, such as the Hamilton product, have to be devised and encoded in the network as a fixed inductive bias. As described in Section 1, the very few choices over existing hypercomplex space restricts the flexibility of networks that leverage hypercomplex multiplication.
142
+
143
+ In sharp contrast to relying on predefined mathematical rules over limited dimensionality choices, the PHM layer treats the dimensionality $n$ (number of Kronecker products) as a tunable hyperparameter and learns such specialized multiplication rules from data, as manifested in the parameterized matrices $\mathbf { A } _ { i }$ $( i = 1 , \ldots , n )$ in (3.3). On one hand, the PHM layer can express hypercomplex multiplications when $\mathbf { A } _ { i }$ are set to reflect those predefined multiplication rules in hypercomplex space. On the other hand, the PHM layer can be seen as a trainable and parameterized form of $n \mathbf { D }$ hypercomplex multiplications, where $n$ can be values other than 4, 8, or 16. Thus, the PHM layer generalizes multiplications in hypercomplex space. Since $n$ can be 1, the PHM layer also offers a neat way to bridging multiplication between both real space and hypercomplex space.
144
+
145
+ # 4 NEURAL MODELS WITH PHM LAYERS
146
+
147
+ To demonstrate the applicability of the PHM layers, we develop the PHM-LSTM and PHMtransformer by equipping two popular neural network models, LSTMs and transformers, with PHM layers.
148
+
149
+ # 4.1 PHM-LSTM
150
+
151
+ Recurrent neural networks such as LSTMs (Hochreiter & Schmidhuber, 1997) are gated recurrent networks where the gating functions are parameterized by linear transformations. We introduce the PHM-LSTM, which replaces such linear transformations in LSTMs with PHM layers:
152
+
153
+ $$
154
+ \begin{array} { r } { \mathbf { y } _ { t } = \mathrm { P H M } \left( \mathbf { x } _ { t } \right) + \mathrm { P H M } \left( \mathbf { h } _ { t - 1 } \right) + b } \\ { \mathbf { f } _ { t } , \mathbf { i } _ { t } , \mathbf { o } _ { t } , \mathbf { x } _ { t } ^ { \prime } = \phi ( \mathbf { y } _ { t } ) \qquad } \\ { \mathbf { c } _ { t } = \sigma _ { s } ( \mathbf { f } _ { t } ) \mathbf { c } _ { t - 1 } + \sigma _ { s } ( \mathbf { i } _ { t } ) \sigma _ { t } ( \mathbf { x } _ { t } ^ { \prime } ) \qquad } \\ { \mathbf { h } _ { t } = \mathbf { o } _ { t } \odot \mathbf { c } _ { t } , \qquad } \end{array}
155
+ $$
156
+
157
+ where $\sigma _ { s }$ is the sigmoid activation function, $\sigma _ { t }$ is the tanh activation function, $\phi : \mathbb { R } ^ { 1 \times d } \mathbb { R } ^ { 4 \times \frac { d } { 4 } }$ is a four-way split on the last dimension, and $\mathbf { c } _ { t } , \mathbf { h } _ { t }$ are the cell state and the hidden state of the PHM-LSTM unit at any time step $t$ .
158
+
159
+ # 4.2 PHM-TRANSFORMER
160
+
161
+ The transformer is a stacked neural network architecture that aggressively exploits linear transformations (Vaswani et al., 2017). Each self-attention layer comprises of $\mathbf { Q }$ (query), K (key), V (value) linear transformations, along with multiple heads. Each transformer block also has a position-wise feed-forward network composed of two FC layers. Since a large majority of the transformer parameters stem from linear transformations or FC layers, we introduce the PHM-transformer to replace all the linear transformations or FC layers with PHM layers. The single-head self-attention module is rewritten as:
162
+
163
+ $$
164
+ \begin{array} { r l } { { \mathbf { Q } , \mathbf { K } , \mathbf { V } = \Phi ( \mathrm { P H M } ( \mathbf { X } ) ) } } \\ & { \quad \quad \quad \mathbf { A } = \mathrm { s o f t m a x } ( \frac { \mathbf { Q } \mathbf { K } ^ { \top } } { \sqrt { d _ { k } } } ) \mathbf { V } , } \end{array}
165
+ $$
166
+
167
+ where $d _ { k }$ is the key dimension, $\Phi : \mathbb { R } ^ { 1 \times d } \mathbb { R } ^ { 3 \times \frac { d } { 3 } }$ is a three-way split on the last dimension, $\mathbf { X }$ is the input sequence, and $\mathbf { A }$ is the self-attentive representation. For multi-head attention, using PHM layers also enables weight sharing not only among the linear transformations of $\mathbf { Q } , \mathbf { K } , \mathbf { V }$ but also among the linear transformation of multiple heads:
168
+
169
+ $$
170
+ \mathbf { X } = \mathrm { P H M } ( [ \mathbf { H } _ { 1 } ; \ldots ; \mathbf { H } _ { N _ { h } } ] ) ,
171
+ $$
172
+
173
+ where $N _ { h }$ is the number of heads and $( ; )$ is the column-wise concatenation. Finally, the position-wise feed-forward network is now defined as
174
+
175
+ $$
176
+ \mathbf { Y } = \operatorname { P H M } ( \operatorname { R e L U } ( \operatorname { P H M } ( \mathbf { X } ) ) ) ,
177
+ $$
178
+
179
+ which transforms $\mathbf { X }$ with two PHM layers.
180
+
181
+ # 5 EXPERIMENTS
182
+
183
+ For context, in the field of representation learning using hypercomplex multiplications, quaternion convolutional neural networks (Zhu et al., 2018), quaternion recurrent neural networks (Parcollet et al., 2018a), and quaternion transformers (Tay et al., 2019) have all compared themselves with only real-valued counterparts. Therefore, to be consistent with the rest of the literature, we evaluate PHM-LSTMs and PHM-transformers that are equipped with PHM layers, and compare them with quaternion LSTMs, quaternion transformers, real-valued LSTMs, or real-valued transformers. Both quaternion LSTMs and quaternion transformers replace linear transformations with Hamilton products of quaternions.
184
+
185
+ Table 1: Experimental results of natural language inference (accuracy) on five different datasets. The PHM-LSTM reduces the parameters of the standard LSTM model and improves or partially matches performance on four out of five datasets.
186
+
187
+ <table><tr><td>Model</td><td>#Params</td><td>MNLI</td><td>QNLI</td><td>SNLI</td><td>DNLI</td><td>SciTail</td></tr><tr><td>LSTM</td><td>721K 180K (-75.0%)</td><td>71.82 /71.89</td><td>84.44</td><td>84.18</td><td>85.16</td><td>74.36</td></tr><tr><td>Quaternion LSTM</td><td></td><td>71.57 / 72.19</td><td>84.73</td><td>84.21</td><td>86.45</td><td>75.58</td></tr><tr><td>PHM-LSTM (n = 2)</td><td>361K (-49.9%)</td><td>71.82 / 72.08</td><td>84.39</td><td>84.38</td><td>85.77</td><td>77.47</td></tr><tr><td>PHM-LSTM(n = 5)</td><td>146K (-79.7%)</td><td>71.80 /71.77</td><td>83.87</td><td>84.58</td><td>86.47</td><td>74.64</td></tr><tr><td>PHM-LSTM (n = 10)</td><td>81K (-88.7%)</td><td>71.59 / 71.59</td><td>84.25</td><td>84.40</td><td>86.21</td><td>77.84</td></tr></table>
188
+
189
+ To demonstrate the architectural flexibility and effectiveness, we evaluate different settings of PHMLSTMs and PHM-transformers to show that allowing for flexible choices of the hyperparameter $n$ in the PHM layer may lead to more effective performance. Details of the setup for the experiments are provided in Appendix B.
190
+
191
+ # 5.1 NATURAL LANGUAGE INFERENCE
192
+
193
+ The task of natural language inference is to determine the logical relationship between two text sequences (MacCartney, 2009). It is a fundamental task pertaining to language understanding. To this end, they serve as a suitable benchmark for evaluating recurrent models.
194
+
195
+ We run experiments on five datasets: (i) MultiNLI (Williams et al., 2017), (ii) QNLI (Quora) (Wang et al., 2017), (iii) SNLI (Bowman et al., 2015), (iv) Dialogue NLI (Welleck et al., 2018), and (v) SciTail (Science Entailment) (Khot et al., 2018). Table 1 reports the results on all these datasets. All in all, such results show that the PHM layer can not only reduce the parameters but also improve performance with flexible choices of $n$ (four out of five datasets show reasonable improvement or partially match). The only exception is on the QNLI dataset, where the performance drop is marginal $( < 1 \% )$ ). This is still decent considering the parameter saving: the parameterization cost of the PHM-LSTM is in the order of $\mathcal { O } ( 1 / n )$ of that of the standard LSTM, where settings of $n = 5$ and $n = 1 0$ do not take values of power of 2. As detailed in Appendix B, since we use the 300D GloVe (Pennington et al., 2014) embeddings to represent input tokens, we choose multiples of 5 instead of 4 for ease of divisibility. It is also noteworthy that on the SNLI, Dialogue NLI, and SciTail datasets, all the PHM-LSTM variants outperform the standard LSTM model. We think that the element reusing properties of the Kronecker product operation, in addition to learning to share such reused components amongst recurrent gating functions, may contribute to both effective and efficient representations.
196
+
197
+ # 5.2 MACHINE TRANSLATION
198
+
199
+ Machine translation is concerned with translating between source-target language pairs. To this end, sequence transduction models are central to this problem domain. In this experiment, the key goal is to compare PHM-transformers against the standard and quaternion transformer models.
200
+
201
+ We run experiments on seven datasets: (i) IWSLT’15 English-Vietnamese (En-Vi), (ii) IWSLT’17 English-Indonesian (En-Id), (iii) IWSLT’14 German-English (De-En), (iv) IWSLT’14 RomanianEnglish (Ro-En), (v) WMT’18 English-Estonian (En-Et), (vi) Setimes English-Macedonian (EnMk), and (vii) WMT’18 English-Romanian (En-Ro).
202
+
203
+ Table 2 reports our results of the machine translation tasks. Overall, these empirical results with different settings demonstrate architectural flexibility and effectiveness of the hypercomplex multiplication parameterization. First and foremost, across six out of seven benchmarks, the PHMtransformer at $n = 4$ makes reasonable gains over the quaternion transformer, signifying that parameterization of hypercomplex multiplications by learning from data can be more effective than predefining Hamilton product rules mathematically. Second, though increasing $n$ leads to more parameter savings, we observe that increasing $n$ all the way to 16 does not cause significant degradation in performance on datasets such as En-Vi. Third, for most datasets, even with significant parameter savings, we find that the decrease in the BLEU score is mostly manageable $\approx 1 - 3$ BLEU points). However, we also note a rare occurrence where $n = 1 6$ results in a significant decrease in the BLEU score, such as on the En-Id dataset. Fourth, on several datasets, the PHM-transformer model improves the performance of the standard transformer model. For example, on datasets such as $\mathrm { E n - V i }$ and En-Et, the PHM-transformer model enjoys a performance boost of about 0.8 BLEU point with $n = 2$ . Finally, by re-scaling with a factor of 2 (doubling the hidden size), we are able to improve the performance on three datasets: En-Vi, En-Id, and En-Mk.
204
+
205
+ Table 2: Experimental results of machine translation (BLEU) on seven different datasets. Symbol $\dagger$ represents re-scaling the parameters with a factor of 2 by doubling the hidden size. The PHMtransformer does not lose much performance despite enjoying parameter savings. Re-scaling can lead to improvement in performance.
206
+
207
+ <table><tr><td>Model</td><td>#Params</td><td>En-Vi</td><td>En-Id</td><td>De-En</td><td>Ro-En</td><td>En-Et</td><td>En-Mk</td><td>En-Ro</td></tr><tr><td>Transformer (Tm)</td><td>44M</td><td>28.43</td><td>47.40</td><td>36.68</td><td>34.60</td><td>14.17</td><td>13.96</td><td>22.79</td></tr><tr><td>Quaternion Tm</td><td>11M (-75.0%)</td><td>28.00</td><td>42.22</td><td>32.83</td><td>30.53</td><td>13.10</td><td>13.67</td><td>18.50</td></tr><tr><td>PHM-Tm n = 2</td><td>22M (-50.0%)</td><td>29.25</td><td>46.32</td><td>35.52</td><td>33.40</td><td>14.98</td><td>13.60</td><td>21.73</td></tr><tr><td>PHM-Tm n = 4</td><td>11M (-75.0%)</td><td>29.13</td><td>44.13</td><td>35.53</td><td>32.74</td><td>14.11</td><td>13.01</td><td>21.19</td></tr><tr><td>PHM-Tm n =8</td><td>5.5M (-87.5%)</td><td>29.34</td><td>40.81</td><td>34.16</td><td>31.88</td><td>13.08</td><td>12.95</td><td>21.66</td></tr><tr><td>PHM-Tm n = 16</td><td>2.9M (-93.4%)</td><td>29.04</td><td>33.48</td><td>33.89</td><td>31.53</td><td>12.15</td><td>11.97</td><td>19.63</td></tr><tr><td>PHM-Tm+ n =2</td><td>44M</td><td>29.54</td><td>49.05</td><td>34.32</td><td>33.88</td><td>14.05</td><td>14.41</td><td>22.18</td></tr><tr><td>PHM-Tm+ n=4</td><td>22M (-50.0%)</td><td>29.17</td><td>46.24</td><td>34.86</td><td>33.80</td><td>14.43</td><td>13.78</td><td>21.91</td></tr><tr><td>PHM-Tm+ n=8</td><td>11M (-75.0%)</td><td>29.47</td><td>43.49</td><td>34.71</td><td>32.59</td><td>13.75</td><td>13.78</td><td>21.43</td></tr></table>
208
+
209
+ Table 3: Training time (seconds per 100 steps) and inference time (seconds to decode test sets) with beam size of 4 and length penalty of 0.6 on the IWSLT’14 German-English dataset.
210
+
211
+ <table><tr><td>Model</td><td>Transformer (Tm)</td><td>Quaternion Tm</td><td>PHM-Tm (n = 4)</td><td>PHM-Tm (n = 8)</td></tr><tr><td>Training time</td><td>7.61</td><td>8.11</td><td>7.92</td><td>7.70</td></tr><tr><td>Inference time</td><td>336</td><td>293</td><td>299</td><td>282</td></tr></table>
212
+
213
+ Table 3 reports the training and inference time for transformer variants. We observe that the PHMtransformer with $n = 8$ has the fastest inference speed amongst all the variants, primarily due to a significant reduction of parameters. All in all, the training speed is also approximately comparable. This ascertains that the PHM layer does not increase much computational cost in practice.
214
+
215
+ # 5.3 TEXT STYLE TRANSFER
216
+
217
+ We continue to experiment with sequence transduction for text style transfer. The goal of this task is to convert text of a certain style to another style. We use the Modern Shakespeare corpus1 in the experiments. Table 4 reports the results on this text style transfer task. We observe that the best performance is achieved with the PHM-transformer $( n = 4$ ). Notably, all except the $n = 1 6$ variant increases or matches the performance of the standard transformer model. This ascertains architectural flexibility and effectiveness of the proposed PHM layer. This not only enables parameter savings but also improves the performance of the transformer.
218
+
219
+ # 5.4 SUBJECT VERB AGREEMENT
220
+
221
+ We conduct additional experiments on the subject-verb agreement task (Linzen et al., 2016). The task predicts if the sentence, e.g., ‘The keys to the cabinet is followed by a plural or a singular. The used dataset can be found online (Linzen et al., 2016). Table 5 reports the results on the subject-verb agreement task. Results are promising, demonstrating that all variants with PHM layers outperform the standard and quaternion transformer models. The best performance peaks at $n = 8$ , despite a parameter saving to up to $1 / 8$ .
222
+
223
+ Table 4: Experimental results of text style transfer. The PHM-transformer may reduce the parameters of the standard transformer model and improve performance.
224
+
225
+ <table><tr><td>Model</td><td>#Params</td><td>BLEU</td></tr><tr><td>Transformer (Tm)</td><td>44M</td><td>11.65</td></tr><tr><td>PHM-Tm (n = 2) PHM-Tm (n = 4) PHM-Tm (n = 8)</td><td>22M (-50.0%) 11M (-75.0%) 5.5M (-87.5%) 2.9M (-93.4%)</td><td>12.20 12.42 11.66</td></tr></table>
226
+
227
+ Table 5: Experimental results of subject verb agreement. The PHM-transformer may reduce the parameters of the standard transformer model and improve performance.
228
+
229
+ <table><tr><td>Model</td><td>#Params</td><td>Acc</td></tr><tr><td>Transformer (Tm) Quaternion Tm</td><td>400K 100K</td><td>94.80 94.70</td></tr><tr><td>PHM-Tm (n = 2) PHM-Tm (n = 4) PHM-Tm (n = 8)</td><td>200K (-50.0%) 101K (-74.8%) 56K (-86.0%)</td><td>95.14 95.05 95.62</td></tr></table>
230
+
231
+ # 6 RELATED WORK
232
+
233
+ While neural networks have been a well-established line of research, progress on hypercomplex representations for deep learning is still in its infancy and most works on this topic are new (Gaudet & Maida, 2017; Parcollet et al., 2018a;b; Zhu et al., 2018; Tay et al., 2019). The hypercomplex Hamilton product provides a greater extent of expressiveness, similar to the complex multiplication, albeit with a 4-fold increase in interactions between real and imaginary components. In the case of quaternion representations, due to parameter savings in the Hamilton product, models also enjoy a $7 5 \%$ reduction in the parameter size (Parcollet et al., 2018a; Tay et al., 2019). A striking caveat is that all quaternions are fundamentally limited to 4D hypercomplex space, which restricts architectural flexibility. The other options would be to scale to octonion (8D) or sedenion (16D) space, given the predefined multiplication rules in such space. To the best of our knowledge, there is no work that attempts to generalize arbitrary $n \mathbf { D }$ hypercomplex multiplications to allow for architectural flexibility, where $n$ can be specified or tuned by users.
234
+
235
+ Our work can also be interpreted as a form of soft parameter sharing, albeit learned from data. Quaternion networks (Zhu et al., 2018; Parcollet et al., 2018b; 2019) are known to possess weight sharing properties via the Hamilton product operation and have demonstrated reasonable success despite having fewer parameters. To the best of our knowledge, there has been no work that attempts to parameterize the hypercomplex Hamilton product for neural networks, i.e., enabling end-to-end learning of real and imaginary component interactions from data.
236
+
237
+ # 7 CONCLUSION
238
+
239
+ We proposed parameterized hypercomplex multiplication (PHM) layers that learn and generalize hypercomplex multiplications. In practice, the PHM layer has $1 / n$ learnable parameters compared with the fully-connected layer counterpart, where $n$ can be flexibly specified by users. PHM layers are applicable to dominant models such as LSTMs and transformers. We evaluated these models equipped by PHM layers on comprehensive tasks to show architectural flexibility and effectiveness of the hypercomplex multiplication parameterization.
240
+
241
+ Acknowledgements. We thank the anonymous reviewers for the insightful comments on this paper. This work was partially supported by the Ministry of Education (MoE) of Singapore under the Academic Research Fund (AcRF) Tier 1 Grant RG135/18.
242
+
243
+ # REFERENCES
244
+
245
+ Samuel R Bowman, Gabor Angeli, Christopher Potts, and Christopher D Manning. A large annotated corpus for learning natural language inference. arXiv preprint arXiv:1508.05326, 2015.
246
+
247
+ Chase Gaudet and Anthony Maida. Deep quaternion networks. arXiv preprint arXiv:1712.04604, 2017.
248
+
249
+ Ian Goodfellow, Yoshua Bengio, and Aaron Courville. Deep Learning. MIT Press, 2016. http: //www.deeplearningbook.org.
250
+
251
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997.
252
+
253
+ Tushar Khot, Ashish Sabharwal, and Peter Clark. Scitail: A textual entailment dataset from science question answering. In Thirty-Second AAAI Conference on Artificial Intelligence, 2018.
254
+
255
+ Tal Linzen, Emmanuel Dupoux, and Yoav Goldberg. Assessing the ability of lstms to learn syntaxsensitive dependencies. Transactions of the Association for Computational Linguistics, 4:521– 535, 2016.
256
+
257
+ Bill MacCartney. Natural language inference. Citeseer, 2009.
258
+
259
+ Titouan Parcollet, Mirco Ravanelli, Mohamed Morchid, Georges Linares, Chiheb Trabelsi, Renato \` De Mori, and Yoshua Bengio. Quaternion recurrent neural networks. In International Conference on Learning Representations, 2018a.
260
+
261
+ Titouan Parcollet, Ying Zhang, Mohamed Morchid, Chiheb Trabelsi, Georges Linares, Renato \` De Mori, and Yoshua Bengio. Quaternion convolutional neural networks for end-to-end automatic speech recognition. arXiv preprint arXiv:1806.07789, 2018b.
262
+
263
+ Titouan Parcollet, Mohamed Morchid, and Georges Linares. Quaternion convolutional neural net- \` works for heterogeneous image processing. In ICASSP 2019-2019 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 8514–8518. IEEE, 2019.
264
+
265
+ Ankur P Parikh, Oscar Tackstr ¨ om, Dipanjan Das, and Jakob Uszkoreit. A decomposable attention ¨ model for natural language inference. arXiv preprint arXiv:1606.01933, 2016.
266
+
267
+ Jeffrey Pennington, Richard Socher, and Christopher Manning. Glove: Global vectors for word representation. In Proceedings of the 2014 conference on empirical methods in natural language processing (EMNLP), pp. 1532–1543, 2014.
268
+
269
+ Adityan Rishiyur. Neural networks with complex and quaternion inputs. arXiv preprint cs/0607090, 2006.
270
+
271
+ Yi Tay, Aston Zhang, Luu Anh Tuan, Jinfeng Rao, Shuai Zhang, Shuohang Wang, Jie Fu, and Siu Cheung Hui. Lightweight and efficient neural natural language processing with quaternion networks. arXiv preprint arXiv:1906.04393, 2019.
272
+
273
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in neural information processing systems, pp. 5998–6008, 2017.
274
+
275
+ Zhiguo Wang, Wael Hamza, and Radu Florian. Bilateral multi-perspective matching for natural language sentences. arXiv preprint arXiv:1702.03814, 2017.
276
+
277
+ Sean Welleck, Jason Weston, Arthur Szlam, and Kyunghyun Cho. Dialogue natural language inference. arXiv preprint arXiv:1811.00671, 2018.
278
+
279
+ Adina Williams, Nikita Nangia, and Samuel R Bowman. A broad-coverage challenge corpus for sentence understanding through inference. arXiv preprint arXiv:1704.05426, 2017.
280
+
281
+ Aston Zhang, Zachary C. Lipton, Mu Li, and Alexander J. Smola. Dive into Deep Learning. 2020. https://d2l.ai.
282
+
283
+ Xuanyu Zhu, Yi Xu, Hongteng Xu, and Changjian Chen. Quaternion convolutional neural networks. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 631–647, 2018.
284
+
285
+ ![](images/6ade5d9a3d9c5de27b23ad2e90a7ddb3b09776044cf4192d21816b9892ed398c.jpg)
286
+ Figure 3: Illustration of reconstructing $\mathbf { H }$ in (3.2) by reusing parameter matrices $\mathbf { B } _ { i }$ $( i \ = \ 1 , 2 )$ ) and $\mathbf { T } _ { j } ~ ( j ~ = ~ 1 , \ldots , 4 )$ in real-valued matrix multiplications, followed by more operations (here $n = 2 , k = 6 , d = 8 )$ . Best viewed in color.
287
+
288
+ # A RECONSTRUCTING THE PARAMETER MATRIX
289
+
290
+ In the paper, the parameter matrix $\mathbf { H }$ in (3.2) is constructed by a sum of $n$ Kronecker products. In the following, we will provide an alternative perspective and show how to equivalently reconstruct $\mathbf { H }$ by reusing parameter matrices in real-valued matrix multiplications, followed by more operations.
291
+
292
+ # A.1 METHOD
293
+
294
+ The key idea is to operate on partitioned weight blocks and learn a dynamic diffusion of weights. There are two key parameter blocks $\mathbf { B }$ and $\mathbf { T }$ that are central to our approach. Intuitively, $\textbf { B } \in$ $\mathbb { R } ^ { n \times n \times n }$ controls the weight diffusion process and learns the soft interactions between $\mathbf { T }$ partitions. Here, $n$ is a user defined hyperparameter.
295
+
296
+ Suppose that both $d$ and $k$ are divisible by $n \in \mathbb { Z } _ { > 0 }$ . For $i = 1 , \ldots , n$ and $j = 1 , \dotsc , \frac { d } { n }$ , denote by each partitioned parameter block $\mathbf { T } _ { j } \in \mathbb { R } ^ { n \times \frac { k } { n } }$ , and $\mathbf { B } _ { i } \in \mathbb { R } ^ { n \times n }$ is the weight diffusion matrix assigned to each partitioned parameter block via real-valued matrix multiplication $\mathbf { B } _ { i } \mathbf { T } _ { j }$ . The parameter $\mathbf { H }$ in (3.2) is now constructed by column-wise concatenation (;):
297
+
298
+ $$
299
+ { \bf H } = [ s ( { \bf B } _ { 1 } ) ; s ( { \bf B } _ { 2 } ) ; \ldots ; s ( { \bf B } _ { n } ) ] ,
300
+ $$
301
+
302
+ where each segment $s ( \mathbf { B } _ { i } )$ is also formed by column-wise concatenation:
303
+
304
+ $$
305
+ s ( \mathbf { B } _ { i } ) = [ \psi ( \mathbf { B } _ { i } \mathbf { T } _ { 1 } ) ; \psi ( \mathbf { B } _ { i } \mathbf { T } _ { 2 } ) ; \ldots ; \psi ( \mathbf { B } _ { i } \mathbf { T } _ { \frac { d } { n } } ) ] .
306
+ $$
307
+
308
+ In (A.2), function $\psi : \mathbb { R } ^ { p \times q } \mathbb { R } ^ { p q }$ , where $\psi ( \mathbf { X } )$ flattens the matrix $\mathbf { X } \in \mathbb { R } ^ { p \times q }$ by concatenating each row of $\mathbf { X }$ then transposes the concatenated row vector into a column vector of dimension $p q$ It is easy to see that, $\psi ( \mathbf { B } _ { i } \mathbf { T } _ { j } ) \in \mathbb { R } ^ { k }$ , $s ( \mathbf { B } _ { i } ) \in \mathbb { R } ^ { k \times { \frac { d } { n } } }$ , thus $\mathbf { H } \in \mathbb { R } ^ { k \times d }$ .
309
+
310
+ It is the partitioned parameter blocks $\mathbf { B } _ { i }$ $( i = 1 , \ldots , n )$ and $\begin{array} { r } { \mathbf { T } _ { j } \left( j = 1 , \ldots , \frac { d } { n } \right) } \end{array}$ that determine the degree of freedom for $\mathbf { H }$ , which is $k d / n + n ^ { 3 }$ . As illustrated in Figure 3, the reuse of parameter matrices $\mathbf { B } _ { 1 } , \ldots , \mathbf { B } _ { n }$ and $\mathbf { T } _ { 1 } , \ldots , \mathbf { T } _ { \frac { d } { n } }$ in real-valued matrix multiplications in (A.2) may reduce the degree of freedom for $\mathbf { H }$ .
311
+
312
+ # A.2 SUBSUMING HYPERCOMPLEX MULTIPLICATIONS
313
+
314
+ Similarly, we show how the PHM layer with the reconstructed $\mathbf { H }$ in (A.1) also subsumes the hypercomplex multiplication. Taking the Hamilton product of two quaternions $Q$ and $P$ as an example, it can be rewritten as
315
+
316
+ $$
317
+ ( \begin{array} { l l l l l } & & & { } & & { } & { 0 } \\ { 1 } & { 0 } & { 0 } & { 0 } \\ { 0 } & { 1 } & { 0 } & { 0 } \\ { 0 } & { 0 } & { 1 } & { 0 } \\ { 0 } & { 0 } & { 0 } & { 1 } \end{array} ) \underbrace { [ \begin{array} { l l l l l } { Q _ { x } } \\ { Q _ { x } } \\ { \vdots } \\ { Q _ { y } } \\ { 1 } \\ { 0 } \end{array} ] } _ { \mathbf { B } _ { 2 } } \underbrace { [ \begin{array} { l l l l l } { 0 } & { - 1 } & & { 0 } & { 0 } \\ { 1 } & { 0 } & { 0 } & { 0 } \\ { 0 } & { 0 } & { 0 } & { 1 } \\ { 0 } & { 0 } & { - 1 } & { 0 } \end{array} ] } _ { \mathbf { B } _ { 2 } } \underbrace { [ \begin{array} { l l l l l } { Q _ { x } } \\ { Q _ { x } } \\ { \vdots } \\ { Q _ { y } } \\ { 1 } \end{array} ] } _ { \mathbf { B } _ { 3 } } \underbrace { [ \begin{array} { l l l l l } { 0 } & { 0 } & { - 1 } & { 0 } \\ { 0 } & { 0 } & { 0 } & { - 1 } \\ { Q _ { x } } \\ { 1 } & { 0 } & { 0 } & { 0 } \end{array} ] } _ { \mathbf { B } _ { 3 } } \underbrace { [ \begin{array} { l } { Q _ { x } } \\ { Q _ { x } } \\ { Q _ { y } } \\ { \vdots } \\ { Q _ { z } } \end{array} ] } _ { \mathbf { B } _ { 4 } } \underbrace { [ \begin{array} { l l l l l } { 0 } & { 0 } & { 0 } & { - 1 } \\ { 0 } & { 0 } & { 1 } & { 0 } \\ { 0 } & { - 1 } & { 0 } & { 0 } \\ { 0 } & { 0 } & { 0 } & { 0 } \end{array} ] } _ { \mathbf { B } _ { 4 } } \underbrace { [ \begin{array} { l } { Q _ { x } } \\ { Q _ { x } } \\ { Q _ { y } } \\ { \vdots } \\ { Q _ { z } } \end{array} ] } _ { \mathbf { B } _ { 2 } } \underbrace { [ \begin{array} { l } { Q _ { y } } \\ { P _ { x } } \\ { P _ { y } } \\ { \vdots } \\ { P _ { z } } \end{array} ] } _ { \mathbf { B } _ { 2 } } \underbrace [ \begin{array} { l l l l } \end{array}
318
+ $$
319
+
320
+ where the 4 output elements are the real values for the quaternion unit basis $[ 1 , \mathbf { i } , \mathbf { j } , \mathbf { k } ] ^ { \top }$ . According to (A.3), when $n = 4$ , the PHM layer with the reconstructed parameter matrix can also be learned to exactly express the Hamilton product of quaternions. Likewise, hypercomplex multiplications of octonions or sedenions can also be learned by the PHM layer when $n$ is set to 8 or 16.
321
+
322
+ # A.3 SUBSUMING REAL-VALUED MATRIX MULTIPLICATIONS
323
+
324
+ Now we show how the PHM layer with the reconstructed $\mathbf { H }$ in (A.1) also subsumes the matrix multiplication in real space. Referring to (3.2), when $n = 1$ , $\mathbf { H } = b \mathbf { W }$ , where the scalar $b$ is the single element of the $1 \times 1$ matrix $\mathbf { B } _ { 1 }$ and elements of $\mathbf { W } \in \mathbb { R } ^ { k \times d }$ come from the concatenation of $\mathbf { T } _ { 1 } , \ldots , \mathbf { T } _ { d } \in \mathbb { R } ^ { 1 \times k }$ . Since learning $b$ and W separately is equivalent to learning their multiplication jointly, the scalar $b$ can be dropped, which is learning the single weight matrix in an FC layer. Therefore, a PHM layer is degenerated to an FC layer when $n = 1$ .
325
+
326
+ # B SETUP FOR EXPERIMENTS
327
+
328
+ We describe the setup for the experiments as follows.
329
+
330
+ # B.1 NATURAL LANGUAGE INFERENCE
331
+
332
+ We implement 300D unidirectional encoders with shared parameters for both premises and hypotheses. We take the concatenation of max and mean pooled representations as the input to a two-layer 300D multilayer perceptron for prediction. Our model is trained with the the Adam optimizer with a learning rate of 0.0004 and a batch size of 256. Word embeddings are initialized with GloVe (Pennington et al., 2014) and are fixed. No cross sentence attention (Parikh et al., 2016) is used, mainly to observe the effectiveness of standalone encoders. For PHM-LSTM, we use $n = \{ 2 , 5 , 1 0 \}$ . Note that in this task, since word embeddings are 300D, we select multiples of 5 instead of 4 for ease of divisibility.
333
+
334
+ # B.2 MACHINE TRANSLATION
335
+
336
+ For the IWSLT’15 English-Vietnamese (En-Vi), IWSLT’17 English-Indonesian (En-Id), IWSLT’14 German-English (De-En), and IWSLT’14 Romanian-English (Ro-En) datasets, we run with 50K steps; while for WMT’18 English-Estonian (En-Et), Setimes English-Macedonian (En-Mk), and WMT’18 English-Romanian (En-Ro) datasets, models are trained for 100K steps. For the En-Vi, En-Id, En-Et, En-Mk, and En-Ro datasets, we specify that transformers have 4 layers, 8 heads, and a hidden size 512. For the De-En and Ro-En datasets, we specify that transformers have 2 layers, 4 heads, and a hidden size 256. We use beam size of 5 and $\alpha = 0 . 6$ (length penalty) for decoding. For all PHM models, we benchmark several settings for the hyperparameter $\bar { n } = \{ 2 , 4 , 8 , 1 6 \}$ .
337
+
338
+ # B.3 TEXT STYLE TRANSFER
339
+
340
+ For the used Modern Shakespeare corpus2 in the experiments, the key goal here is to convert modern writing into Shakespeare writing. This dataset comprises of 18, 395 parallel sentences for training, 1, 218 parallel sentences for evaluation (development set), and 1, 462 parallel sentences for testing. We still specify that transformers have 4 layers, 8 heads, and a hidden size 512. Similar to machine translation, we experiment with $n = \{ 2 , 4 , 8 , 1 6 \}$ . We train all the models for 10K steps.
341
+
342
+ # B.4 SUBJECT VERB AGREEMENT
343
+
344
+ In contrast to the previous experimental settings, we use a smaller transformer architecture with 10K training steps. Specifically, transformers here have 2 layers, 4 heads, and a hidden size 128. Since the hidden size is smaller than those in the previous experimental settings, we experiment with $n = \{ 2 , 4 , 8 \}$ .
md/train/rkHVZWZAZ/rkHVZWZAZ.md ADDED
@@ -0,0 +1,450 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # THE REACTOR:
2
+
3
+ # A FAST AND SAMPLE-EFFICIENT ACTOR-CRITIC AGENT FOR REINFORCEMENT LEARNING
4
+
5
+ Audrunas Gruslys, ¯ DeepMind audrunas@google.com
6
+
7
+ Will Dabney,
8
+ DeepMind
9
+ wdabney@google.com
10
+
11
+ Mohammad Gheshlaghi Azar, DeepMind mazar@google.com
12
+
13
+ Bilal Piot,
14
+ DeepMind
15
+ piot@google.com
16
+
17
+ Marc G. Bellemare, Google Brain bellemare@google.com
18
+
19
+ Rémi Munos,
20
+ DeepMind
21
+ munos@google.com
22
+
23
+ # ABSTRACT
24
+
25
+ In this work, we present a new agent architecture, called Reactor, which combines multiple algorithmic and architectural contributions to produce an agent with higher sample-efficiency than Prioritized Dueling DQN (Wang et al., 2017) and Categorical DQN (Bellemare et al., 2017), while giving better run-time performance than A3C (Mnih et al., 2016). Our first contribution is a new policy evaluation algorithm called Distributional Retrace, which brings multi-step off-policy updates to the distributional reinforcement learning setting. The same approach can be used to convert several classes of multi-step policy evaluation algorithms, designed for expected value evaluation, into distributional algorithms. Next, we introduce the $\beta$ -leave-one-out policy gradient algorithm, which improves the trade-off between variance and bias by using action values as a baseline. Our final algorithmic contribution is a new prioritized replay algorithm for sequences, which exploits the temporal locality of neighboring observations for more efficient replay prioritization. Using the Atari 2600 benchmarks, we show that each of these innovations contribute to both sample efficiency and final agent performance. Finally, we demonstrate that Reactor reaches state-of-the-art performance after 200 million frames and less than a day of training.
26
+
27
+ # 1 INTRODUCTION
28
+
29
+ Model-free deep reinforcement learning has achieved several remarkable successes in domains ranging from super-human-level control in video games (Mnih et al., 2015) and the game of Go (Silver et al., 2016; 2017), to continuous motor control tasks (Lillicrap et al., 2015; Schulman et al., 2015).
30
+
31
+ Much of the recent work can be divided into two categories. First, those of which that, often building on the DQN framework, act $\epsilon$ -greedily according to an action-value function and train using minibatches of transitions sampled from an experience replay buffer (Van Hasselt et al., 2016; Wang et al., 2015; He et al., 2017; Anschel et al., 2017). These value-function agents benefit from improved sample complexity, but tend to suffer from long runtimes (e.g. DQN requires approximately a week to train on Atari). The second category are the actor-critic agents, which includes the asynchronous advantage actor-critic (A3C) algorithm, introduced by Mnih et al. (2016). These agents train on transitions collected by multiple actors running, and often training, in parallel (Schulman et al., 2017; Vezhnevets et al., 2017). The deep actor-critic agents train on each trajectory only once, and thus tend to have worse sample complexity. However, their distributed nature allows significantly faster training in terms of wall-clock time. Still, not all existing algorithms can be put in the above two categories and various hybrid approaches do exist (Zhao et al., 2016; O’Donoghue et al., 2017; Gu et al., 2017; Wang et al., 2017).
32
+
33
+ Data-efficiency and off-policy learning are essential for many real-world domains where interactions with the environment are expensive. Similarly, wall-clock time (time-efficiency) directly impacts an algorithm’s applicability through resource costs. The focus of this work is to produce an agent that is sample- and time-efficient. To this end, we introduce a new reinforcement learning agent, called Reactor (Retrace-Actor), which takes a principled approach to combining the sample-efficiency of off-policy experience replay with the time-efficiency of asynchronous algorithms. We combine recent advances in both categories of agents with novel contributions to produce an agent that inherits the benefits of both and reaches state-of-the-art performance over 57 Atari 2600 games.
34
+
35
+ Our primary contributions are (1) a novel policy gradient algorithm, $\beta$ -LOO, which makes better use of action-value estimates to improve the policy gradient; (2) the first multi-step off-policy distributional reinforcement learning algorithm, distributional Retrace $( \lambda )$ ; (3) a novel prioritized replay for off-policy sequences of transitions; and (4) an optimized network and parallel training architecture.
36
+
37
+ We begin by reviewing background material, including relevant improvements to both value-function agents and actor-critic agents. In Section 3 we introduce each of our primary contributions and present the Reactor agent. Finally, in Section 4, we present experimental results on the 57 Atari 2600 games from the Arcade Learning Environment (ALE) (Bellemare et al., 2013), as well as a series of ablation studies for the various components of Reactor.
38
+
39
+ # 2 BACKGROUND
40
+
41
+ We consider a Markov decision process (MDP) with state space $X$ and finite action space $\mathcal { A }$ . A (stochastic) policy $\pi ( \cdot | x )$ is a mapping from states $x \in X$ to a probability distribution over actions. We consider a $\gamma$ -discounted infinite-horizon criterion, with $\gamma \in [ 0 , 1 )$ the discount factor, and define for policy $\pi$ the action-value of a state-action pair $( x , a )$ as
42
+
43
+ $$
44
+ \begin{array} { r } { Q ^ { \pi } ( x , a ) \stackrel { \mathrm { d e f } } { = } \mathbb { E } \Bigl [ \sum _ { t \geq 0 } \gamma ^ { t } r _ { t } | x _ { 0 } = x , a _ { 0 } = a , \pi \Bigr ] , } \end{array}
45
+ $$
46
+
47
+ where $( \{ x _ { t } \} _ { t \ge 0 } )$ is a trajectory generated by choosing $a$ in $x$ and following $\pi$ thereafter, i.e., $a _ { t } \sim$ $\pi ( \cdot | x _ { t } )$ (for $t \geq 1$ ), and $r _ { t }$ is the reward signal. The objective in reinforcement learning is to find an optimal policy $\pi ^ { * }$ , which maximises $Q ^ { \pi } ( x , a )$ . The optimal action-values are given by $Q ^ { * } ( x , a ) = \operatorname* { m a x } _ { \pi } Q ^ { \pi } ( x , a )$ .
48
+
49
+ # 2.1 VALUE-BASED ALGORITHMS
50
+
51
+ The Deep Q-Network (DQN) framework, introduced by Mnih et al. (2015), popularised the current line of research into deep reinforcement learning by reaching human-level, and beyond, performance across 57 Atari 2600 games in the ALE. While DQN includes many specific components, the essence of the framework, much of which is shared by Neural Fitted Q-Learning (Riedmiller, 2005), is to use of a deep convolutional neural network to approximate an action-value function, training this approximate action-value function using the Q-Learning algorithm (Watkins & Dayan, 1992) and mini-batches of one-step transitions $( x _ { t } , a _ { t } , r _ { t } , x _ { t + 1 } , \gamma _ { t } )$ drawn randomly from an experience replay buffer (Lin, 1992). Additionally, the next-state action-values are taken from a target network, which is updated to match the current network periodically. Thus, the temporal difference (TD) error for transition $t$ used by these algorithms is given by
52
+
53
+ $$
54
+ \delta _ { t } = r _ { t } + \gamma _ { t } \operatorname* { m a x } _ { a ^ { \prime } \in \mathcal { A } } Q ( x _ { t + 1 } , a ^ { \prime } ; \bar { \theta } ) - Q ( x _ { t } , a _ { t } ; \theta ) ,
55
+ $$
56
+
57
+ where $\theta$ denotes the parameters of the network and $\bar { \theta }$ are the parameters of the target network.
58
+
59
+ Since this seminal work, we have seen numerous extensions and improvements that all share the same underlying framework. Double DQN (Van Hasselt et al., 2016), attempts to correct for the over-estimation bias inherent in Q-Learning by changing the second term of (1) to $\begin{array} { r } { Q ( x _ { t + 1 } , \arg \operatorname* { m a x } _ { a ^ { \prime } \in \mathcal { A } } Q ( x _ { t + 1 } , a ^ { \prime } ; \theta ) ; \bar { \theta } ) } \end{array}$ . The dueling architecture (Wang et al., 2015), changes the network to estimate action-values using separate network heads $V ( x ; \theta )$ and $A ( x , a ; \theta )$ with
60
+
61
+ $$
62
+ Q ( x , a ; \theta ) = V ( x ; \theta ) + A ( x , a ; \theta ) - \frac { 1 } { | A | } \sum _ { a ^ { \prime } } A ( x , a ^ { \prime } ; \theta ) .
63
+ $$
64
+
65
+ Recently, Hessel et al. (2017) introduced Rainbow, a value-based reinforcement learning agent combining many of these improvements into a single agent and demonstrating that they are largely complementary. Rainbow significantly out performs previous methods, but also inherits the poorer time-efficiency of the DQN framework. We include a detailed comparison between Reactor and Rainbow in the Appendix. In the remainder of the section we will describe in more depth other recent improvements to DQN.
66
+
67
+ # 2.1.1 PRIORITIZED EXPERIENCE REPLAY
68
+
69
+ The experience replay buffer was first introduced by Lin (1992) and later used in DQN (Mnih et al., 2015). Typically, the replay buffer is essentially a first-in-first-out queue with new transitions gradually replacing older transitions. The agent would then sample a mini-batch uniformly at random from the replay buffer. Drawing inspiration from prioritized sweeping (Moore & Atkeson, 1993), prioritized experience replay replaces the uniform sampling with prioritized sampling proportional to the absolute TD error (Schaul et al., 2016).
70
+
71
+ Specifically, for a replay buffer of size $N$ , prioritized experience replay samples transition $t$ with probability $P ( t )$ , and applies weighted importance-sampling with $w _ { t }$ to correct for the prioritization bias, where
72
+
73
+ $$
74
+ P ( t ) = \frac { p _ { t } ^ { \alpha } } { \sum _ { k } p _ { k } ^ { \alpha } } , \quad w _ { t } = \left( \frac { 1 } { N } \cdot \frac { 1 } { P ( t ) } \right) ^ { \beta } , \quad p _ { t } = | \delta _ { t } | + \epsilon , \quad \alpha , \beta , \epsilon > 0 .
75
+ $$
76
+
77
+ Prioritized DQN significantly increases both the sample-efficiency and final performance over DQN on the Atari 2600 benchmarks (Schaul et al., 2015).
78
+
79
+ # 2.1.2 RETRACE(λ)
80
+
81
+ Retrace $( \lambda )$ is a convergent off-policy multi-step algorithm extending the DQN agent (Munos et al., 2016). Assume that some trajectory $\left\{ x _ { 0 } , a _ { 0 } , r _ { 0 } , x _ { 1 } , a _ { 1 } , r _ { 1 } , \dots , x _ { t } , a _ { t } , r _ { t } , \dots , \right\}$ has been generated according to behaviour policy $\mu$ , i.e., $a _ { t } \sim \mu ( \cdot | x _ { t } )$ . Now, we aim to evaluate the value of a different target policy $\pi$ , i.e. we want to estimate $Q ^ { \pi }$ . The Retrace algorithm will update our current estimate $Q$ of $Q ^ { \pi }$ in the direction of
82
+
83
+ $$
84
+ \begin{array} { r } { \Delta Q ( x _ { t } , a _ { t } ) \stackrel { \mathrm { d e f } } { = } \sum _ { s \geq t } \gamma ^ { s - t } ( c _ { t + 1 } \ldots c _ { s } ) \delta _ { s } ^ { \pi } Q , } \end{array}
85
+ $$
86
+
87
+ where $\delta _ { s } ^ { \pi } Q \stackrel { \mathrm { d e f } } { = } r _ { s } + \gamma \mathbb { E } _ { \pi } [ Q ( x _ { s + 1 } , \cdot ) ] - Q ( x _ { s } , a _ { s } )$ is the temporal difference at time $s$ under $\pi$ , and
88
+
89
+ $$
90
+ c _ { s } = \lambda \operatorname* { m i n } \big ( 1 , \rho _ { s } \big ) , \quad \rho _ { s } = \frac { \pi ( a _ { s } | x _ { s } ) } { \mu ( a _ { s } | x _ { s } ) } .
91
+ $$
92
+
93
+ The Retrace algorithm comes with the theoretical guarantee that in finite state and action spaces, repeatedly updating our current estimate $Q$ according to (3) produces a sequence of $\mathrm { Q }$ functions which converges to $Q ^ { \pi }$ for a fixed $\pi$ or to $Q ^ { * }$ if we consider a sequence of policies $\pi$ which become increasingly greedy w.r.t. the $Q$ estimates (Munos et al., 2016).
94
+
95
+ # 2.1.3 DISTRIBUTIONAL RL
96
+
97
+ Distributional reinforcement learning refers to a class of algorithms that directly estimate the distribution over returns, whose expectation gives the traditional value function (Bellemare et al., 2017). Such approaches can be made tractable with a distributional Bellman equation, and the recently proposed algorithm $C 5 1$ showed state-of-the-art performance in the Atari 2600 benchmarks. $C 5 1$ parameterizes the distribution over returns with a mixture over Diracs centered on a uniform grid,
98
+
99
+ $$
100
+ Q ( x , a ; \theta ) = \sum _ { i = 0 } ^ { N - 1 } q _ { i } ( x , a ; \theta ) z _ { i } , q _ { i } = \frac { e ^ { \theta _ { i } ( x , a ) } } { \sum _ { j = 0 } ^ { N - 1 } e ^ { \theta _ { j } ( x , a ) } } , z _ { i } = v _ { \mathrm { m i n } } + i \frac { v _ { \mathrm { m a x } } - v _ { \mathrm { m i n } } } { N - 1 } ,
101
+ $$
102
+
103
+ with hyperparameters $v _ { \operatorname* { m i n } } , v _ { \operatorname* { m a x } }$ that bound the distribution support of size $N$ .
104
+
105
+ # 2.2 ACTOR-CRITIC ALGORITHMS
106
+
107
+ In this section we review the actor-critic framework for reinforcement learning algorithms and then discuss recent advances in actor-critic algorithms along with their various trade-offs. The asynchronous advantage actor-critic (A3C) algorithm (Mnih et al., 2016), maintains a parameterized policy $\pi ( a | x ; \theta )$ and value function $V ( x ; \theta _ { v } )$ , which are updated with
108
+
109
+ $$
110
+ \begin{array} { r } { \triangle \theta = \nabla _ { \theta } \log \pi ( a _ { t } | x _ { t } ; \theta ) A ( x _ { t } , a _ { t } ; \theta _ { v } ) , \quad \triangle \theta _ { v } = A ( x _ { t } , a _ { t } ; \theta _ { v } ) \nabla _ { \theta _ { v } } V ( x _ { t } ) , } \\ { \mathrm { w h e r e , } \quad A ( x _ { t } , a _ { t } ; \theta _ { v } ) = \displaystyle \sum _ { k } ^ { n - 1 } \gamma ^ { k } r _ { t + k } + \gamma ^ { n } V ( x _ { t + n } ) - V ( x _ { t } ) . } \end{array}
111
+ $$
112
+
113
+ A3C uses $M = 1 6$ parallel CPU workers, each acting independently in the environment and applying the above updates asynchronously to a shared set of parameters. In contrast to the previously discussed value-based methods, A3C is an on-policy algorithm, and does not use a GPU nor a replay buffer.
114
+
115
+ Proximal Policy Optimization (PPO) is a closely related actor-critic algorithm (Schulman et al., 2017), which replaces the advantage (7) with,
116
+
117
+ $$
118
+ \mathrm { m i n } ( \rho _ { t } A ( x _ { t } , a _ { t } ; \theta _ { v } ) , c l i p ( \rho _ { t } , 1 - \epsilon , 1 + \epsilon ) A ( x _ { t } , a _ { t } ; \theta _ { v } ) ) , \epsilon > 0 ,
119
+ $$
120
+
121
+ where $\rho _ { t }$ is as defined in Section 2.1.2. Although both PPO and A3C run $M$ parallel workers collecting trajectories independently in the environment, PPO collects these experiences to perform a single, synchronous, update in contrast with the asynchronous updates of A3C.
122
+
123
+ Actor-Critic Experience Replay (ACER) extends the A3C framework with an experience replay buffer, Retrace algorithm for off-policy corrections, and the Truncated Importance Sampling Likelihood Ratio (TISLR) algorithm used for off-policy policy optimization (Wang et al., 2017).
124
+
125
+ # 3 THE REACTOR
126
+
127
+ The Reactor is a combination of four novel contributions on top of recent improvements to both deep value-based RL and policy-gradient algorithms. Each contribution moves Reactor towards our goal of achieving both sample and time efficiency.
128
+
129
+ # 3.1 $\beta$ -LOO
130
+
131
+ The Reactor architecture represents both a policy $\pi ( a | x )$ and action-value function $Q ( x , a )$ . We use a policy gradient algorithm to train the actor $\pi$ which makes use of our current estimate $Q ( x , a )$ of $Q ^ { \pi } ( x , a )$ . Let $V ^ { \pi } ( x _ { 0 } )$ be the value function at some initial state $x _ { 0 }$ , the policy gradient theorem says that $\begin{array} { r } { \nabla V ^ { \pi } ( { x } _ { 0 } ) = \mathbb { E } \big [ \sum _ { t } \gamma ^ { t } \sum _ { a } Q ^ { \pi } ( { x } _ { t } , a ) \nabla \pi ( a | { x } _ { t } ) \big ] } \end{array}$ , where $\nabla$ refers to the gradient w.r.t. policy parameters (Sutton et al., 2000). We now consider several possible ways to estimate this gradient.
132
+
133
+ To simplify notation, we drop the dependence on the state $x$ for now and consider the problem of estimating the quantity
134
+
135
+ $$
136
+ \begin{array} { r } { G = \sum _ { a } Q ^ { \pi } ( a ) \nabla \pi ( a ) . } \end{array}
137
+ $$
138
+
139
+ In the off-policy case, we consider estimating $G$ using a single action $\hat { a }$ drawn from a (possibly different from $\pi$ ) behaviour distribution $\hat { a } \sim \mu$ . Let us assume that for the chosen action $\hat { a }$ we have access to an unbiased estimate $R ( { \hat { a } } )$ of $Q ^ { \pi } ( \hat { a } )$ . Then, we can use likelihood ratio (LR) method combined with an importance sampling (IS) ratio (which we call ISLR) to build an unbiased estimate of $G$ :
140
+
141
+ $$
142
+ \hat { G } _ { \mathrm { I S L R } } = \frac { \pi ( \hat { a } ) } { \mu ( \hat { a } ) } ( R ( \hat { a } ) - V ) \nabla \log \pi ( \hat { a } ) ,
143
+ $$
144
+
145
+ where $V$ is a baseline that depends on the state but not on the chosen action. However this estimate suffers from high variance. A possible way for reducing variance is to estimate $G$ directly from (8) by using the return $R ( { \hat { a } } )$ for the chosen action $\hat { a }$ and our current estimate $Q$ of $Q ^ { \pi }$ for the other actions, which leads to the so-called leave-one-out (LOO) policy-gradient estimate:
146
+
147
+ $$
148
+ \begin{array} { r } { \hat { G } _ { \mathrm { L O O } } = R ( \hat { a } ) \nabla \pi ( \hat { a } ) + \sum _ { a \ne \hat { a } } Q ( a ) \nabla \pi ( a ) . } \end{array}
149
+ $$
150
+
151
+ ![](images/4dc78c2bfa460c9a12d8f0e88f781cfc056c7465107a2397f307095e351e9346.jpg)
152
+ Figure 1: Single-step (left) and multi-step (right) distribution bootstrapping.
153
+
154
+ This estimate has low variance but may be biased if the estimated $Q$ values differ from $Q ^ { \pi }$ . A better bias-variance tradeoff may be obtained by the more general $\beta$ -LOO policy-gradient estimate:
155
+
156
+ $$
157
+ \begin{array} { r } { \hat { G } _ { \beta \mathrm { - } \mathrm { L O O } } = \beta ( R ( \hat { a } ) - Q ( \hat { a } ) ) \nabla \pi ( \hat { a } ) + \sum _ { a } Q ( a ) \nabla \pi ( a ) , } \end{array}
158
+ $$
159
+
160
+ where $\beta = \beta ( \mu , \pi , \hat { a } )$ can be a function of both policies, $\pi$ and $\mu$ , and the selected action $\hat { a }$ . Notice that when $\beta = 1$ , (10) reduces to (9), and when $\beta = 1 / \mu ( \hat { a } )$ , then (10) is
161
+
162
+ $$
163
+ \hat { G } _ { \frac { 1 } { \mu } \cdot \mathrm { L O O } } = \frac { \pi ( \hat { a } ) } { \mu ( \hat { a } ) } ( R ( \hat { a } ) - Q ( \hat { a } ) ) \nabla \log \pi ( \hat { a } ) + \textstyle \sum _ { a } Q ( a ) \nabla \pi ( a ) .
164
+ $$
165
+
166
+ This estimate is unbiased and can be seen as a generalization of $\hat { G } _ { \mathrm { I S L R } }$ where instead of using a state-only dependent baseline, we use a state-and-action-dependent baseline (our current estimate $Q$ ) and add the correction term $\begin{array} { r } { \sum _ { a } { \nabla \pi ( a ) Q ( a ) } } \end{array}$ to cancel the bias. Proposition 1 gives our analysis of the bias of $G _ { \beta - \mathrm { L O O } }$ , with a proof left to the Appendix.
167
+
168
+ Proposition 1. Assume $\hat { a } \sim \mu$ and that $\mathbb { E } [ R ( { \hat { a } } ) ] = Q ^ { \pi } ( { \hat { a } } )$ . Then, the bias of $G _ { \beta - L O O } ~ i s \mid \sum _ { a } ( 1 -$ $\mu ( a ) \beta ( a ) ) \nabla \pi ( a ) [ Q ( a ) - Q ^ { \pi } ( a ) ] \big |$ .
169
+
170
+ Thus the bias is small when $\beta ( a )$ is close to $1 / \mu ( a )$ , or when the $Q$ -estimates are close to the true $Q ^ { \pi }$ values, and unbiased regardless of the estimates if $\beta ( a ) = 1 / \mu ( a )$ . The variance is low when $\beta$ is small, therefore, in order to improve the bias-variance tradeoff we recommend using the $\beta$ -LOO estimate with $\beta$ defined as: $\begin{array} { r } { \beta ( \hat { a } ) ^ { \ast } = \operatorname* { m i n } \left( c , \frac { 1 } { \mu ( \hat { a } ) } \right) } \end{array}$ , for some constant $c \geq 1$ . This truncated $1 / \mu$ coefficient shares similarities with the truncated IS gradient estimate introduced in (Wang et al., 2017) (which we call TISLR for truncated-ISLR):
171
+
172
+ $$
173
+ \hat { G } _ { \mathrm { T S L R } } = \operatorname* { m i n } \Big ( c , \frac { \pi ( \hat { a } ) } { \mu ( \hat { a } ) } \Big ) ( R ( \hat { a } ) - V ) \nabla \log \pi ( \hat { a } ) + \sum _ { a } \Big ( \frac { \pi ( a ) } { \mu ( a ) } - c \Big ) _ { + } \mu ( a ) ( Q ^ { \pi } ( a ) - V ) \nabla \log \pi ( a ) .
174
+ $$
175
+
176
+ The differences are: (i) we truncate $1 / \mu ( \hat { a } ) = \pi ( \hat { a } ) / \mu ( \hat { a } ) \times 1 / \pi ( \hat { a } )$ instead of truncating $\pi ( \hat { a } ) / \mu ( \hat { a } )$ , which provides an additional variance reduction due to the variance of the LR $\begin{array} { r } { \nabla \log \pi ( \hat { a } ) = \frac { \nabla \pi ( \hat { a } ) } { \pi ( \hat { a } ) } } \end{array}$ (since this LR may be large when a low probability action is chosen), and (ii) we use our $Q$ -baseline instead of a $V$ baseline, reducing further the variance of the LR estimate.
177
+
178
+ # 3.2 DISTRIBUTIONAL RETRACE
179
+
180
+ In off-policy learning it is very difficult to produce an unbiased sample $R ( \hat { a } )$ of $Q ^ { \pi } ( \hat { a } )$ when following another policy $\mu$ . This would require using full importance sampling correction along the trajectory. Instead, we use the off-policy corrected return computed by the Retrace algorithm, which produces a (biased) estimate of $Q ^ { \pi } ( \hat { a } )$ but whose bias vanishes asymptotically (Munos et al., 2016).
181
+
182
+ In Reactor, we consider predicting an approximation of the return distribution function from any state-action pair $( x , a )$ in a similar way as in Bellemare et al. (2017). The original algorithm C51 described in that paper considered single-step Bellman updates only. Here we need to extend this idea to multi-step updates and handle the off-policy correction performed by the Retrace algorithm, as defined in (3). Next, we describe these two extensions.
183
+
184
+ Multi-step distributional Bellman operator: First, we extend C51 to multi-step Bellman backups. We consider return-distributions from $( x , a )$ of the form $\textstyle \sum _ { i } q _ { i } ( x , a ) \delta _ { z _ { i } }$ (where $\delta _ { z }$ denotes a Dirac in $z$ )
185
+
186
+ which are supported on a finite uniform grid $\{ z _ { i } \} \in [ v _ { \operatorname* { m i n } } , v _ { \operatorname* { m a x } } ]$ , $z _ { i } < z _ { i + 1 }$ , $z _ { 1 } = v _ { \mathrm { m i n } }$ , $z _ { m } = v _ { \operatorname* { m a x } }$ . The coefficients $q _ { i } ( x , a )$ (discrete distribution) corresponds to the probabilities assigned to each atom $z _ { i }$ of the grid. From an observed $n$ -step sequence $\left\{ x _ { t } , a _ { t } , r _ { t } , x _ { t + 1 } , \ldots , x _ { t + n } \right\}$ , generated by behavior policy $\mu$ (i.e, $a _ { s } \sim \mu ( \cdot | x _ { s } )$ for $t \leq s < t + n )$ ), we build the $n$ -step backed-up $\left( { { x } _ { t } } , { { a } _ { t } } \right)$ The , is gi $n$ -step distributional Bellman target, whose expectation isn by: $\textstyle \sum _ { s = t } ^ { t + n - 1 } \gamma ^ { s - t } r _ { s } + \gamma ^ { n } Q ( x _ { t + n } , a )$
187
+
188
+ $$
189
+ \sum _ { i } q _ { i } ( x _ { t + n } , a ) \delta _ { z _ { i } ^ { n } } , \mathrm { w i t h } z _ { i } ^ { n } = \sum _ { s = t } ^ { t + n - 1 } \gamma ^ { s - t } r _ { s } + \gamma ^ { n } z _ { i } .
190
+ $$
191
+
192
+ Since this distribution is supported on the set of atoms $\left\{ z _ { i } ^ { n } \right\}$ , which is not necessarily aligned with the grid $\left\{ z _ { i } \right\}$ , we do a projection step and minimize the KL-loss between the projected target and the current estimate, just as with C51 except with a different target distribution (Bellemare et al., 2017).
193
+
194
+ Distributional Retrace: Now, the Retrace algorithm defined in (3) involves an off-policy correction which is not handled by the previous $n$ -step distributional Bellman backup. The key to extending this distributional back-up to off-policy learning is to rewrite the Retrace algorithm as a linear combination of $n$ -step Bellman backups, weighted by some coefficients $\alpha _ { n , a }$ . Indeed, notice that (3) rewrites as
195
+
196
+ $$
197
+ \Delta Q ( x _ { t } , a _ { t } ) = \sum _ { n \geq 1 } \sum _ { a \in \cal { A } } \alpha _ { n , a } \Big [ \underbrace { \sum _ { s = t } ^ { t + n - 1 } \gamma ^ { s - t } r _ { s } + \gamma ^ { n } Q ( x _ { t + n } , a ) } _ { n \cdot \mathrm { s t e p B e l l m a r k u p } } \Big ] - Q ( x _ { t } , a _ { t } ) ,
198
+ $$
199
+
200
+ where $\alpha _ { n , a } = \left( c _ { t + 1 } \ldots c _ { t + n - 1 } \right) \left( \pi ( a | x _ { t + n } ) - \mathbb { I } \{ a = a _ { t + n } \} c _ { t + n } \right)$ . These coefficients depend on the degree of off-policy-ness (between $\mu$ and $\pi$ ) along the trajectory. We have that $\begin{array} { r } { \sum _ { n \geq 1 } \sum _ { a } \alpha _ { n , a } = } \end{array}$ $\begin{array} { r } { \sum _ { n \geq 1 } \big ( c _ { t + 1 } \dots c _ { t + n - 1 } \big ) ( 1 - c _ { t + n } ) = 1 } \end{array}$ , but notice some coefficients may be negative. However, in expectation (over the behavior policy) they are non-negative. Indeed,
201
+
202
+ $$
203
+ \begin{array} { r c l } { \mathbb { E } _ { \mu } [ \alpha _ { n , a } ] } & { = } & { \mathbb { E } \Big [ \big ( c _ { t + 1 } \cdot . . c _ { t + n - 1 } \big ) \mathbb { E } _ { a _ { t + n } \sim \mu ( \cdot \vert x _ { t + n } ) } \big [ \pi ( a \vert x _ { t + n } ) - \mathbb { I } \{ a = a _ { t + n } \} c _ { t + n } \big \vert x _ { t + n } \big ] \Big ] } \\ & { = } & { \mathbb { E } \Big [ \big ( c _ { t + 1 } . . . c _ { t + n - 1 } \big ) \Big ( \pi ( a \vert x _ { t + n } ) - \mu ( a \vert x _ { t + n } ) \lambda \operatorname* { m i n } \big ( 1 , \frac { \pi ( a \vert x _ { t + n } ) } { \mu ( a \vert x _ { t + n } ) } \big ) \Big ) \Big ] \geq 0 , } \end{array}
204
+ $$
205
+
206
+ by definition of the $c _ { s }$ coefficients (4). Thus in expectation (over the behavior policy), the Retrace update can be seen as a convex combination of $n$ -step Bellman updates.
207
+
208
+ Then, the distributional Retrace algorithm can be defined as backing up a mixture of $n$ -step distributions. More precisely, we define the Retrace target distribution as:
209
+
210
+ $$
211
+ \sum _ { i = 1 } q _ { i } ^ { * } ( x _ { t } , a _ { t } ) \delta _ { z _ { i } } , \mathrm { ~ w i t h ~ } q _ { i } ^ { * } ( x _ { t } , a _ { t } ) = \sum _ { n \geq 1 } \sum _ { a } \alpha _ { n , a } \sum _ { j } q _ { j } ( x _ { t + n } , a _ { t + n } ) h _ { z _ { i } } ( z _ { j } ^ { n } ) ,
212
+ $$
213
+
214
+ where $h _ { z _ { i } } ( x )$ is a linear interpolation kernel, projecting onto the support $\left\{ z _ { i } \right\}$ :
215
+
216
+ $$
217
+ \iota _ { z _ { i } } ( x ) = \left\{ \begin{array} { l l } { ( x - z _ { i - 1 } ) / ( z _ { i } - z _ { i - 1 } ) , } & { \mathrm { ~ i f ~ } z _ { i - 1 } \leq x \leq z _ { i } \ \backslash } \\ { ( z _ { i + 1 } - x ) / ( z _ { i + 1 } - z _ { i } ) , } & { \mathrm { ~ i f ~ } z _ { i } \leq x \leq z _ { i + 1 } } \\ { 0 , } & { \mathrm { ~ i f ~ } x \leq z _ { i - 1 } \mathrm { ~ o r ~ } x \geq z _ { i + 1 } } \\ { 1 , } & { \mathrm { ~ i f ~ } ( x \leq v _ { \operatorname* { m i n } } \mathrm { ~ a n d ~ } z _ { i } = v _ { \operatorname* { m i n } } ) \mathrm { ~ o r ~ } ( x \geq v _ { \operatorname* { m a x } } \mathrm { ~ a n d ~ } z _ { i } = v _ { \operatorname* { m a x } } ) \enspace . } \end{array} \right.
218
+ $$
219
+
220
+ We update the current probabilities $q ( x _ { t } , a _ { t } )$ by performing a gradient step on the KL-loss
221
+
222
+ $$
223
+ \nabla \mathrm { K L } ( q ^ { * } ( x _ { t } , a _ { t } ) , q ( x _ { t } , a _ { t } ) ) = - \sum _ { i = 1 } q _ { i } ^ { * } ( x _ { t } , a _ { t } ) \nabla \log q _ { i } ( x _ { t } , a _ { t } ) .
224
+ $$
225
+
226
+ Again, notice that some target “probabilities” $q _ { i } ^ { * } ( x _ { t } , a _ { t } )$ may be negative for some sample trajectory, but in expectation they will be non-negative. Since the gradient of a KL-loss is linear w.r.t. its first argument, our update rule (12) provides an unbiased estimate of the gradient of the KL between the expected (over the behavior policy) Retrace target distribution and the current predicted distribution.1
227
+
228
+ Remark: The same method can be applied to other algorithms (such as $\mathrm { T B } ( \lambda )$ (Precup et al., 2000) and importance sampling (Precup et al., 2001)) in order to derive distributional versions of other off-policy multi-step RL algorithms.
229
+
230
+ # 3.3 PRIORITIZED SEQUENCE REPLAY
231
+
232
+ Prioritized experience replay has been shown to boost both statistical efficiency and final performance of deep RL agents (Schaul et al., 2016). However, as originally defined prioritized replay does not handle sequences of transitions and weights all unsampled transitions identically. In this section we present an alternative initialization strategy, called lazy initialization, and argue that it better encodes prior information about temporal difference errors. We then briefly describe our computationally efficient prioritized sequence sampling algorithm, with full details left to the appendix.
233
+
234
+ It is widely recognized that TD errors tend to be temporally correlated, indeed the need to break this temporal correlation has been one of the primary justifications for the use of experience replay (Mnih et al., 2015). Our proposed algorithm begins with this fundamental assumption.
235
+
236
+ Assumption 1. Temporal differences are temporally correlated, with correlation decaying on average with the time-difference between two transitions.
237
+
238
+ Prioritized experience replay adds new transitions to the replay buffer with a constant priority, but given the above assumption we can devise a better method. Specifically, we propose to add experience to the buffer with no priority, inserting a priority only after the transition has been sampled and used for training. Also, instead of sampling transitions, we assign priorities to all (overlapping) sequences of length $n$ . When sampling, sequences with an assigned priority are sampled proportionally to that priority. Sequences with no assigned priority are sampled proportionally to the average priority of assigned priority sequences within some local neighbourhood. Averages are weighted to compensate for sampling biases (i.e. more samples are made in areas of high estimated priorities, and in the absence of weighting this would lead to overestimation of unassigned priorities).
239
+
240
+ The lazy initialization scheme starts with priorities $p _ { t }$ corresponding to the sequences $\{ x _ { t } , a _ { t } , \ldots , x _ { t + n } \}$ for which a priority was already assigned. Then it extrapolates a priority of all other sequences in the following way. Let us define a partition $( I _ { i } ) _ { i }$ of the states ordered by increasing time such that each cell $I _ { i }$ contains exactly one state $s _ { i }$ with already assigned priority. We define the estimated priority $\hat { p } _ { t }$ to all other sequences as $\begin{array} { r } { \hat { p } _ { t } = \sum _ { s _ { i } \in J ( t ) } \frac { w _ { i } } { \sum _ { i ^ { \prime } \in J ( t ) } w _ { i ^ { \prime } } } p \big ( s _ { i } \big ) } \end{array}$ , where $J ( t )$ is a collection of contiguous cells $( I _ { i } )$ containing time $t$ , and $w _ { i } = | I _ { i } |$ is the length of the cell $I _ { i }$ containing $s _ { i }$ . For already defined priorities denote $\hat { p } _ { t } = p _ { t }$ . Cell sizes work as estimates of inverse local density and are used as importance weights for priority estimation. 2 For the algorithm to be unbiased, partition $( I _ { i } ) _ { i }$ must not be a function of the assigned priorities. So far we have defined a class of algorithms all free to choose the partition $( I _ { i } )$ and the collection of cells $I ( t )$ , as long that they satisfy the above constraints. Figure 4 in the Appendix illustrates the above description.
241
+
242
+ Now, with probability $\epsilon$ we sample uniformly at random, and with probability $1 - \epsilon$ we sample proportionally to $\hat { p } _ { t }$ . We implemented an algorithm satisfying the above constraints and called it Contextual Priority Tree (CPT). It is based on AVL trees (Velskii & Landis, 1976) and can execute sampling, insertion, deletion and density evaluation in $O ( \ln ( n ) )$ time. We describe CPT in detail in the Appendix in Section 6.3.
243
+
244
+ We treated prioritization as purely a variance reduction technique. Importance-sampling weights were evaluated as in prioritized experience replay, with fixed $\beta = 1$ in (2). We used simple gradient magnitude estimates as priorities, corresponding to a mean absolute TD error along a sequence for Retrace, as defined in (3) for the classical RL case, and total variation in the distributional Retrace case.3
245
+
246
+ # 3.4 AGENT ARCHITECTURE
247
+
248
+ In order to improve CPU utilization we decoupled acting from learning. This is an important aspect of our architecture: an acting thread receives observations, submits actions to the environment, and stores transitions in memory, while a learning thread re-samples sequences of experiences from memory and trains on them (Figure 2, left). We typically execute 4-6 acting steps per each learning step. We sample sequences of length $n = 3 3$ in batches of 4. A moving network is unrolled over frames 1-32 while the target network is unrolled over frames 2-33.
249
+
250
+ ![](images/0ce520556c54ebb022fbaedde6bd31f7b0e36ebca5afaf8af6063d5062720b85.jpg)
251
+ Figure 2: (Left) The model of parallelism of DQN, A3C and Reactor architectures. Each row represents a separate thread. In Reactor’s case, each worker, consiting of a learner and an actor is run on a separate worker machine. (Right) Comparison of training times and resources for various algorithms. $5 0 0 \mathrm { m }$ denotes 500 million training frames; otherwise $2 0 0 \mathrm { m }$ training frames were used.
252
+
253
+ We allow the agent to be distributed over multiple machines each containing action-learner pairs. Each worker downloads the newest network parameters before each learning step and sends delta-updates at the end of it. Both the network and target network are stored on a shared parameter server while each machine contains its own local replay memory. Training is done by downloading a shared network, evaluating local gradients and sending them to be applied on the shared network. While the agent can also be trained on a single machine, in this work we present results of training obtained with either 10 or 20 actor-learner workers and one parameter server. In Figure 2 (right) we compare resources and runtimes of Reactor with related algorithms.4
254
+
255
+ # 3.4.1 NETWORK ARCHITECTURE
256
+
257
+ In some domains, such as Atari, it is useful to base decisions on a short history of past observations. The two techniques generally used to achieve this are frame stacking and recurrent network architectures. We chose the latter over the former for reasons of implementation simplicity and computational efficiency. As the Retrace algorithm requires evaluating action-values over contiguous sequences of trajectories, using a recurrent architecture allowed each frame to be processed by the convolutional network only once, as opposed to $n$ times times if $n$ frame concatenations were used.
258
+
259
+ The Reactor architecture uses a recurrent neural network which takes an observation $x _ { t }$ as input and produces two outputs: categorical action-value distributions $q _ { i } ( x _ { t } , a )$ ( $i$ here is a bin identifier), and policy probabilities $\pi ( \boldsymbol { a } | \boldsymbol { x } _ { t } )$ . We use an architecture inspired by the duelling network architecture (Wang et al., 2015). We split action-value -distribution logits into state-value logits and advantage logits, which in turn are connected to the same LSTM network (Hochreiter & Schmidhuber, 1997). Final action-value logits are produced by summing state- and action-specific logits, as in Wang et al. (2015). Finally, a softmax layer on top for each action produces the distributions over discounted future returns.
260
+
261
+ The policy head uses a softmax layer mixed with a fixed uniform distribution over actions, where this mixing ratio is a hyperparameter (Wiering, 1999, Section 5.1.3). Policy and Q-networks have separate LSTMs. Both LSTMs are connected to a shared linear layer which is connected to a shared convolutional neural network (Krizhevsky et al., 2012). The precise network specification is given in Table 3 in the Appendix.
262
+
263
+ Gradients coming from the policy LSTM are blocked and only gradients originating from the Qnetwork LSTM are allowed to back-propagate into the convolutional neural network. We block gradients from the policy head for increased stability, as this avoids positive feedback loops between $\pi$ and $q _ { i }$ caused by shared representations. We used the Adam optimiser (Kingma & Ba, 2014), with a learning rate of $5 \times 1 0 ^ { - 5 }$ and zero momentum because asynchronous updates induce implicit momentum (Mitliagkas et al., 2016). Further discussion of hyperparameters and their optimization can be found in Appendix 6.1.
264
+
265
+ ![](images/2dda7550f95f87e0de6110502915b8ab6cb71151a77387ed141c9c215232ad50.jpg)
266
+ Figure 3: (Left) Reactor performance as various components are removed. (Right) Performance comparison as a function of training time in hours. Rainbow learning curve provided by Hessel et al. (2017).
267
+
268
+ # 4 EXPERIMENTAL RESULTS
269
+
270
+ We trained and evaluated Reactor on 57 Atari games (Bellemare et al., 2013). Figure 3 compares the performance of Reactor with different versions of Reactor each time leaving one of the algorithmic improvements out. We can see that each of the algorithmic improvements (Distributional retrace, betaLOO and prioritized replay) contributed to the final results. While prioritization was arguably the most important component, Beta-LOO clearly outperformed TISLR algorithm. Although distributional and non-distributional versions performed similarly in terms of median human normalized scores, distributional version of the algorithm generalized better when tested with random human starts (Table 1).
271
+
272
+ Table 1: Random human starts
273
+
274
+ <table><tr><td rowspan=1 colspan=1>ALGORITHM</td><td rowspan=1 colspan=1>NORMALIZEDSCORES</td><td rowspan=1 colspan=1>MEANRANK</td><td rowspan=1 colspan=1>ELO</td></tr><tr><td rowspan=12 colspan=1>RANDOMHUMANDQNDDQNDUELPRIORPRIOR.DUEL.A3CLSTMRAINBOWREACTOR ND 5REACTORREACTOR500M</td><td rowspan=1 colspan=1>0.00</td><td rowspan=1 colspan=1>11.65</td><td rowspan=1 colspan=1>-563</td></tr><tr><td rowspan=1 colspan=1>1.00</td><td rowspan=1 colspan=1>6.82</td><td rowspan=1 colspan=1>0</td></tr><tr><td rowspan=1 colspan=1>0.69</td><td rowspan=1 colspan=1>9.05</td><td rowspan=2 colspan=1>-172-58</td></tr><tr><td rowspan=1 colspan=1>1.11</td><td rowspan=1 colspan=1>7.63</td></tr><tr><td rowspan=1 colspan=1>1.17</td><td rowspan=1 colspan=1>6.35</td><td rowspan=1 colspan=1>32</td></tr><tr><td rowspan=1 colspan=1>1.13</td><td rowspan=1 colspan=1>6.63</td><td rowspan=1 colspan=1>13</td></tr><tr><td rowspan=1 colspan=1>1.15</td><td rowspan=1 colspan=1>6.25</td><td rowspan=1 colspan=1>40</td></tr><tr><td rowspan=1 colspan=1>1.13</td><td rowspan=1 colspan=1>6.30</td><td rowspan=1 colspan=1>37</td></tr><tr><td rowspan=1 colspan=1>1.53</td><td rowspan=1 colspan=1>4.18</td><td rowspan=1 colspan=1>186</td></tr><tr><td rowspan=1 colspan=1>1.51</td><td rowspan=1 colspan=1>4.98</td><td rowspan=1 colspan=1>126</td></tr><tr><td rowspan=1 colspan=1>1.65</td><td rowspan=1 colspan=1>4.58</td><td rowspan=1 colspan=1>156</td></tr><tr><td rowspan=1 colspan=1>1.82</td><td rowspan=1 colspan=1>3.65</td><td rowspan=1 colspan=1>227</td></tr></table>
275
+
276
+ Table 2: 30 random no-op starts.
277
+
278
+ <table><tr><td rowspan=1 colspan=1>ALGORITHM</td><td rowspan=1 colspan=1>NORMALIZEDSCORES</td><td rowspan=1 colspan=1>MEANRANK</td><td rowspan=1 colspan=1>ELO</td></tr><tr><td rowspan=12 colspan=1>RANDOMHUMANDQNDDQNDUELPRIORPRIOR.DUEL.ACER500MRAINBOWREACTOR ND 5REACTORREACTOR500M</td><td rowspan=1 colspan=1>0.00</td><td rowspan=1 colspan=1>10.93</td><td rowspan=4 colspan=1>-6730-167-27</td></tr><tr><td rowspan=1 colspan=1>1.00</td><td rowspan=1 colspan=1>6.89</td></tr><tr><td rowspan=1 colspan=1>0.79</td><td rowspan=1 colspan=1>8.65</td></tr><tr><td rowspan=1 colspan=1>1.18</td><td rowspan=1 colspan=1>7.28</td></tr><tr><td rowspan=1 colspan=1>1.51</td><td rowspan=1 colspan=1>5.19</td><td rowspan=1 colspan=1>143</td></tr><tr><td rowspan=1 colspan=1>1.24</td><td rowspan=1 colspan=1>6.11</td><td rowspan=1 colspan=1>70</td></tr><tr><td rowspan=1 colspan=1>1.72</td><td rowspan=1 colspan=1>5.44</td><td rowspan=1 colspan=1>126</td></tr><tr><td rowspan=1 colspan=1>1.9</td><td rowspan=1 colspan=1>、</td><td rowspan=1 colspan=1>=</td></tr><tr><td rowspan=1 colspan=1>2.31</td><td rowspan=1 colspan=1>3.63</td><td rowspan=1 colspan=1>270</td></tr><tr><td rowspan=1 colspan=1>1.80</td><td rowspan=1 colspan=1>4.53</td><td rowspan=1 colspan=1>195</td></tr><tr><td rowspan=1 colspan=1>1.87</td><td rowspan=1 colspan=1>4.46</td><td rowspan=1 colspan=1>196</td></tr><tr><td rowspan=1 colspan=1>2.30</td><td rowspan=1 colspan=1>3.47</td><td rowspan=1 colspan=1>280</td></tr></table>
279
+
280
+ # 4.1 COMPARING TO PRIOR WORK
281
+
282
+ We evaluated Reactor with target update frequency $T _ { u p d a t e } = 1 0 0 0$ , $\lambda = 1 . 0$ and $\beta$ -LOO with $\beta = 1$ on 57 Atari games trained on 10 machines in parallel. We averaged scores over 200 episodes using 30 random human starts and noop starts (Tables 4 and 5 in the Appendix). We calculated mean and median human normalised scores across all games. We also ranked all algorithms (including random and human scores) for each game and evaluated mean rank of each algorithm across all 57 Atari games. We also evaluated mean Rank and Elo scores for each algorithm for both human and noop start settings. Please refer to Section 6.2 in the Appendix for more details.
283
+
284
+ Tables 1 & 2 compare versions of our algorithm,5 with several other state-of-art algorithms across 57 Atari games for a fixed random seed across all games (Bellemare et al., 2013). We compare Reactor against are: DQN (Mnih et al., 2015), Double DQN (Van Hasselt et al., 2016), DQN with prioritised experience replay (Schaul et al., 2015), dueling architecture and prioritised dueling (Wang et al., 2015), ACER (Wang et al., 2017), A3C (Mnih et al., 2016), and Rainbow (Hessel et al., 2017). Each algorithm was exposed to 200 million frames of experience, or 500 million frames when followed by 500M, and the same pre-processing pipeline including 4 action repeats was used as in the original DQN paper (Mnih et al., 2015).
285
+
286
+ In Table 1, we see that Reactor exceeds the performance of all algorithms across all metrics, despite requiring under two days of training. With 500 million frames and four days training we see Reactor’s performance continue to improve significantly. The difference in time-efficiency is especially apparent when comparing Reactor and Rainbow (see Figure 3, right). Additionally, unlike Rainbow, Reactor does not use Noisy Networks (Fortunato et al., 2017), which was reported to have contributed to the performance gains. When evaluating under the no-op starts regime (Table 2), Reactor out performs all methods except for Rainbow. This suggests that Rainbow is more sample-efficient when training and evaluation regimes match exactly, but may be overfitting to particular trajectories due to the significant drop in performance when evaluated on the random human starts.
287
+
288
+ Regarding ACER, another Retrace-based actor-critic architecture, both classical and distributional versions of Reactor (Figure 3) exceeded the best reported median human normalized score of 1.9 with noop starts achieved in 500 million steps.6
289
+
290
+ # 5 CONCLUSION
291
+
292
+ In this work we presented a new off-policy agent based on Retrace actor-critic architecture and show that it achieves similar performance as the current state-of-the-art while giving significant real-time performance gains. We demonstrate the benefits of each of the suggested algorithmic improvements, including Distributional Retrace, beta-LOO policy gradient and contextual priority tree.
293
+
294
+ # REFERENCES
295
+
296
+ Oron Anschel, Nir Baram, and Nahum Shimkin. Averaged-dqn: Variance reduction and stabilization for deep reinforcement learning. In International Conference on Machine Learning, pp. 176–185, 2017.
297
+
298
+ Marc G Bellemare, Yavar Naddaf, Joel Veness, and Michael Bowling. The arcade learning environment: An evaluation platform for general agents. J. Artif. Intell. Res.(JAIR), 47:253–279, 2013.
299
+
300
+ Marc G Bellemare, Will Dabney, and Rémi Munos. A distributional perspective on reinforcement learning. arXiv preprint arXiv:1707.06887, 2017.
301
+
302
+ Meire Fortunato, Mohammad Gheshlaghi Azar, Bilal Piot, Jacob Menick, Ian Osband, Alex Graves, Vlad Mnih, Remi Munos, Demis Hassabis, Olivier Pietquin, et al. Noisy networks for exploration. arXiv preprint arXiv:1706.10295, 2017.
303
+
304
+ Shixiang Gu, Timothy Lillicrap, Zoubin Ghahramani, Richard E Turner, and Sergey Levine. Q-prop: Sample-efficient policy gradient with an off-policy critic. International Conference on Learning Representations, 2017.
305
+
306
+ Frank S He, Yang Liu, Alexander G Schwing, and Jian Peng. Learning to play in a day: Faster deep reinforcement learning by optimality tightening. In International Conference on Learning Representations, 2017.
307
+
308
+ Matteo Hessel, Joseph Modayil, Hado Van Hasselt, Tom Schaul, Georg Ostrovski, Will Dabney, Dan Horgan, Bilal Piot, Mohammad Azar, and David Silver. Rainbow: Combining improvements in deep reinforcement learning. arXiv preprint arXiv:1710.02298, 2017.
309
+
310
+ Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural computation, 9(8): 1735–1780, 1997.
311
+
312
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
313
+
314
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems, pp. 1097–1105, 2012.
315
+
316
+ Timothy P Lillicrap, Jonathan J Hunt, Alexander Pritzel, Nicolas Heess, Tom Erez, Yuval Tassa, David Silver, and Daan Wierstra. Continuous control with deep reinforcement learning. arXiv preprint arXiv:1509.02971, 2015.
317
+
318
+ Long-H Lin. Self-improving reactive agents based on reinforcement learning, planning and teaching. Machine learning, 8(3/4):69–97, 1992.
319
+
320
+ Ioannis Mitliagkas, Ce Zhang, Stefan Hadjis, and Christopher Ré. Asynchrony begets momentum, with an application to deep learning. In Communication, Control, and Computing (Allerton), 2016 54th Annual Allerton Conference on, pp. 997–1004. IEEE, 2016.
321
+
322
+ Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 518(7540):529–533, 2015.
323
+
324
+ Volodymyr Mnih, Adria Puigdomenech Badia, Mehdi Mirza, Alex Graves, Timothy P Lillicrap, Tim Harley, David Silver, and Koray Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In International Conference on Machine Learning, 2016.
325
+
326
+ Andrew W Moore and Christopher G Atkeson. Prioritized sweeping: Reinforcement learning with less data and less time. Machine learning, 13(1):103–130, 1993.
327
+
328
+ Rémi Munos, Tom Stepleton, Anna Harutyunyan, and Marc Bellemare. Safe and efficient off-policy reinforcement learning. In Advances in Neural Information Processing Systems, pp. 1046–1054, 2016.
329
+
330
+ Brendan O’Donoghue, Remi Munos, Koray Kavukcuoglu, and Volodymyr Mnih. Combining policy gradient and q-learning. International Conference on Learning Representations, 2017.
331
+
332
+ Doina Precup, Richard S Sutton, and Satinder Singh. Eligibility traces for off-policy policy evaluation. In Proceedings of the Seventeenth International Conference on Machine Learning, 2000.
333
+
334
+ Doina Precup, Richard S Sutton, and Sanjoy Dasgupta. Off-policy temporal-difference learning with function approximation. In Proceedings of the 18th International Conference on Machine Laerning, pp. 417–424, 2001.
335
+
336
+ Martin Riedmiller. Neural fitted q iteration-first experiences with a data efficient neural reinforcement learning method. In ECML, volume 3720, pp. 317–328. Springer, 2005.
337
+
338
+ Tom Schaul, John Quan, Ioannis Antonoglou, and David Silver. Prioritized experience replay. arXiv preprint arXiv:1511.05952, 2015.
339
+
340
+ Tom Schaul, John Quan, Ioannis Antonoglou, and David Silver. Prioritized experience replay. In International Conference on Learning Representations, 2016.
341
+
342
+ John Schulman, Sergey Levine, Pieter Abbeel, Michael Jordan, and Philipp Moritz. Trust region policy optimization. In Proceedings of the 32nd International Conference on Machine Learning (ICML-15), pp. 1889–1897, 2015.
343
+
344
+ John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
345
+
346
+ David Silver, Aja Huang, Chris J Maddison, Arthur Guez, Laurent Sifre, George Van Den Driessche, Julian Schrittwieser, Ioannis Antonoglou, Veda Panneershelvam, Marc Lanctot, et al. Mastering the game of go with deep neural networks and tree search. Nature, 529(7587):484–489, 2016.
347
+
348
+ David Silver, Julian Schrittwieser, Karen Simonyan, Ioannis Antonoglou, Aja Huang, Arthur Guez, Thomas Hubert, Lucas Baker, Matthew Lai, Adrian Bolton, Yutian Chen, Timothy Lillicrap, Fan Hui, Laurent Sifre, George van den Driessche, Thore Graepel, and Demis Hassabis. Mastering the game of go without human knowledge. Nature, 550(7676):354–359, 10 2017. URL http: //dx.doi.org/10.1038/nature24270.
349
+
350
+ Richard S. Sutton, David Mcallester, Satinder Singh, and Yishay Mansour. Policy gradient methods for reinforcement learning with function approximation. In In Advances in Neural Information Processing Systems 12, pp. 1057–1063. MIT Press, 2000.
351
+
352
+ Hado Van Hasselt, Arthur Guez, and David Silver. Deep reinforcement learning with double qlearning. In AAAI, pp. 2094–2100, 2016.
353
+
354
+ Adel’son G Velskii and E Landis. An algorithm for the organisation of information. Dokl. Akad. Nauk SSSR, 146:263–266, 1976.
355
+
356
+ Alexander Sasha Vezhnevets, Simon Osindero, Tom Schaul, Nicolas Heess, Max Jaderberg, David Silver, and Koray Kavukcuoglu. Feudal networks for hierarchical reinforcement learning. arXiv preprint arXiv:1703.01161, 2017.
357
+
358
+ Ziyu Wang, Tom Schaul, Matteo Hessel, Hado van Hasselt, Marc Lanctot, and Nando de Freitas. Dueling network architectures for deep reinforcement learning. International Conference on Machine Learning, pp. 1995–2003, 2015.
359
+
360
+ Ziyu Wang, Victor Bapst, Nicolas Heess, Volodymyr Mnih, Remi Munos, Koray Kavukcuoglu, and Nando de Freitas. Sample efficient actor-critic with experience replay. In International Conference on Learning Representations, 2017.
361
+
362
+ C. J. C. H. Watkins and P. Dayan. Q-learning. Machine Learning, 8(3):272–292, 1992.
363
+
364
+ Marco A Wiering. Explorations in efficient reinforcement learning. PhD thesis, University of Amsterdam, 1999.
365
+
366
+ Dongbin Zhao, Haitao Wang, Kun Shao, and Yuanheng Zhu. Deep reinforcement learning with experience replay based on sarsa. In Computational Intelligence (SSCI), 2016 IEEE Symposium Series on, pp. 1–6. IEEE, 2016.
367
+
368
+ # 6 APPENDIX
369
+
370
+ Proposition 1. Assume $\hat { a } \sim \mu$ and that $\mathbb { E } [ R ( { \hat { a } } ) ] = Q ^ { \pi } ( { \hat { a } } )$ . Then, the bias of $G _ { \beta - L O O }$ is $| \sum a ^ { ( 1 - }$ $\mu ( a ) \beta ( a ) ) \nabla \pi ( a ) [ Q ( a ) - Q ^ { \pi } ( a ) ] \big |$ .
371
+
372
+ Proof. The bias of $\hat { G } _ { \beta - \mathrm { L O O } }$ is
373
+
374
+ $$
375
+ \begin{array} { r c l } { \mathbb { E } [ \hat { G } _ { \beta \cdot \mathrm { L o o } } ] - G } & { = } & { \displaystyle \sum _ { a } \mu ( a ) [ \beta ( a ) ( \mathbb { E } [ R ( a ) ] - Q ( a ) ) ] \nabla \pi ( a ) + \sum _ { a } Q ( a ) \nabla \pi ( a ) - G } \\ & { = } & { \displaystyle \sum _ { a } ( 1 - \mu ( a ) \beta ( a ) ) [ Q ( a ) - Q ^ { \pi } ( a ) ] \nabla \pi ( a ) } \end{array}
376
+ $$
377
+
378
+ # 6.1 HYPERPARAMETER OPTIMIZATION
379
+
380
+ As we believe that algorithms should be robust with respect to the choice of hyperparameters, we spent little effort on parameter optimization. In total, we explored three distinct values of learning rates and two values of ADAM momentum (the default and zero) and two values of $T _ { u p d a t e }$ on a subset of 7 Atari games without prioritization using non-distributional version of Reactor. We later used those values for all experiments. We did not optimize for batch sizes and sequence length or any prioritization hyperparamters.
381
+
382
+ # 6.2 RANK AND ELO EVALUATION
383
+
384
+ Commonly used mean and median human normalized scores have several disadvantages. A mean human normalized score implicitly puts more weight on games that computers are good and humans are bad at. Comparing algorithm by a mean human normalized score across 57 Atari games is almost equivalent to comparing algorithms on a small subset of games close to the median and thus dominating the signal. Typically a set of ten most score-generous games, namely Assault, Asterix, Breakout, Demon Attack, Double Dunk, Gopher, Pheonix, Stargunner, Up’n Down and Video Pinball can explain more than half of inter-algorithm variance. A median human normalized score has the opposite disadvantage by effectively discarding very easy and very hard games from the comparison. As typical median human normalized scores are within the range of 1-2.5, an algorithm which scores zero points on Montezuma’s Revenge is evaluated equal to the one which scores 2500 points, as both performance levels are still below human performance making incremental improvements on hard games not being reflected in the overall evaluation. In order to address both problem, we also evaluated mean rank and Elo metrics for inter-algorithm comparison. Those metrics implicitly assign the same weight to each game, and as a result is more sensitive of relative performance on very hard and easy games: swapping scores of two algorithms on any game would result in the change of both mean rank and Elo metrics.
385
+
386
+ We calculated separate mean rank and Elo scores for each algorithm using results of test evaluations with 30 random noop-starts and 30 random human starts (Tables 5 and 4). All algorithms were ranked across each game separately, and a mean rank was evaluated across 57 Atari games. For Elo score evaluation algorithm, $A$ was considered to win over algorithm $B$ if it obtained more scores on a given Atari. We produced an empirical win-probability matrix by summing wins across all games and used this matrix to evaluate Elo scores. A ranking difference of 400 corresponds to the odds of winning of 10:1 under the Gaussian assumption.
387
+
388
+ # 6.3 CONTEXTUAL PRIORITY TREE
389
+
390
+ Contextual priority tree is one possible implementation of lazy prioritization (Figure 4). All sequence keys are put into a balanced binary search tree which maintains a temporal order. An AVL tree (Velskii & Landis (1976)) was chosen due to the ease of implementation and because it is on average more evenly balanced than a Red-Black Tree.
391
+
392
+ Each tree node has up to two children (left and right) and contains currently stored key and a priority of the key which is either set or is unknown. Some trees may only have a single child subtree while some may have none. In addition to this information, we were tracking other summary statistics at each node which was re-evaluated after each tree rotation. The summary statistics was evaluated by consuming previously evaluated summary statistics of both children and a priority of the key stored within the current node. In particular, we were tracking a total number of nodes within each subtree and mean-priority estimates updated according to rules shown in Figure 5. The total number of nodes within each subtree was always known $\dot { c }$ in Figure 5), while mean priority estimates per key ( $m$ in Figure 5) could either be known or unknown.
393
+
394
+ ![](images/e3a848f079b9cef52db12df5c956af3c4295e7c24e2ac14c15e4261e8c9e189a.jpg)
395
+ Figure 4: Illustration of Lazy prioritization, where sequences with no explicitly assigned priorities get priorities estimated by a linear combination of nearby assigned priorities. Exact boundaries of blue and red intervals are arbitrary (as long as all conditions described in Section 3.3 are satisfied) thus leading to many possible algorithms. Each square represents an individual sequence of size 32 (sequences overlap). Inverse sizes of blue regions work as local density estimates allowing to produce unbiased priority estimates.
396
+
397
+ ![](images/1643bc419674d679a0e4553f04f352ea27ace576103fbcdec49448295c4749c5.jpg)
398
+ Figure 5: Rules used to evaluate summary statistics on each node of a binary search tree where all sequence keys are kept sorted by temporal order. $c _ { l }$ and $c _ { r }$ are total number of nodes within left and right subtrees. $m _ { l }$ and $m _ { l }$ are estimated mean priorities per node within the subtree. A central square node corresponds to a single key stored within the parent node with its corresponding priority of $p$ (if set) or ? if not set. Red subtrees do not have any singe child with a set priority, and a result do not have priority estimates. A red square shows that priority of the key stored within the parent node is not known. Unknown mean priorities is marked by a question mark. Empty child nodes simply behave as if $c = 0$ with $p = \mathrm { ? }$ . Rules a-f illustrate how mean values are propagated down from children to parents when priorities are only partially known (rules d and e also apply symmetrically). Sampling is done by going from the root node up the tree by selecting one of the children (or the current key) stochastically proportional to orange proportions. Sampling terminates once the current (square) key is chosen.
399
+
400
+ ![](images/a46875030b481043e2819ab223cda649f83962aceea9ea0f0ddca60f1b58da04.jpg)
401
+ Figure 6: Example of a balanced priority tree. Dark blue nodes contain keys with known priorities, light blue nodes have at least one child with at least a single known priority, while ping nodes do not have any priority estimates. Nodes 1, 2 and 3 will obtain priority estimates equal to $\mathrm { { \dot { 2 } / 3 } }$ of the priority of key 5 and $1 / 3$ of the priority of node 4. This implies that estimated priorities of keys 1, 2 and 3 are implicitly defined by keys 4 and 6. Nodes 8, 9 and 11 are estimated to have the same priority as node 10.
402
+
403
+ If a mean priority of either one child subtree or a key stored within the current node is unknown then it can be estimated to by exploiting information coming from another sibling subtree or a priority stored within the parent node.
404
+
405
+ Sampling was done by traversing the tree from the root node up while sampling either one of the children subtrees or the currently held key proportionally to the total estimated priority masses contained within. The rules used to evaluate proportions are shown in orange in Figure 5. Similarly, probabilities of arbitrary keys can be queried by traversing the tree from the root node towards the child node of an interest while maintaining a product of probabilities at each branching point. Insertion, deletion, sampling and probability query operations can be done in $\mathrm { O } ( \mathrm { l n ( n ) } )$ time.
406
+
407
+ The suggested algorithm has the desired property that it becomes a simple proportional sampling algorithm once all the priorities are known. While some key priorities are unknown, they are estimated by using nearby known key priorities (Figure 6).
408
+
409
+ Each time when a new sequence key is added to the tree, it was set to have an unknown priority. Any priority was assigned only after the key got first sampled and the corresponding sequence got passed through the learner. When a priority of a key is set or updated, the key node is deliberately removed from and placed back to the tree in order to become a leaf-node. This helped to set priorities of nodes in the immediate vicinity more accurately by using the freshest information available.
410
+
411
+ # 6.4 NETWORK ARCHITECTURE
412
+
413
+ The value of $\epsilon = 0 . 0 1$ is the minimum probability of choosing a random action and it is hard-coded into the policy network. Figure 7 shows the overall network topology while Table 3 specifies network layer sizes.
414
+
415
+ ![](images/36031433bfe784d7e5ee0597ac8ed58728967791ff3d626a7db4865e5d04afcc.jpg)
416
+ Figure 7: Network architecture.
417
+
418
+ Table 3: Specification of the neural network used (illustrated in Figure 7)
419
+
420
+ <table><tr><td rowspan=1 colspan=1>LAYER</td><td rowspan=1 colspan=1>INPUTSIZE</td><td rowspan=1 colspan=3>PARAMETERS</td></tr><tr><td rowspan=1 colspan=1>CONVOLUTIONAL</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>KERNELWIDTH</td><td rowspan=1 colspan=1>OUTPUTCHANNELS</td><td rowspan=1 colspan=1>STRIDES</td></tr><tr><td rowspan=1 colspan=1>CoNV1CONCATRELUCONV 2CONCATRELUCONV 3CONCATRELU</td><td rowspan=1 colspan=1>[84,84,1][20,20,16][20,20,32][9,9,32][9,9, 64][7, 7, 32]</td><td rowspan=1 colspan=1>[8,8][4,4][3,3]</td><td rowspan=1 colspan=1>163232</td><td rowspan=1 colspan=1>421</td></tr><tr><td rowspan=1 colspan=1>FULLYCONNECTED</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=3>OUTPUT SIZE</td></tr><tr><td rowspan=1 colspan=1>LINEARCONCATRELU</td><td rowspan=1 colspan=1>[7, 7, 64][128]</td><td rowspan=1 colspan=3>128</td></tr><tr><td rowspan=1 colspan=1>RECURRENTT</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=3>OUTPUT SIZE</td></tr><tr><td rowspan=1 colspan=1>LSTMLINEARCONCATRELULINEARSOFTMAXX(1-e)+E/#ACTIONS</td><td rowspan=1 colspan=1>[256][128][32][64][#ACTIONS][#ACTIONS]</td><td rowspan=1 colspan=3>12832#ACTIONS#ACTIONS#ACTIONS</td></tr><tr><td rowspan=1 colspan=1>RECURRENTQ</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=3>OUTPUT SIZE</td></tr><tr><td rowspan=1 colspan=1>LSTM</td><td rowspan=1 colspan=1>[256]</td><td rowspan=1 colspan=3>128</td></tr><tr><td rowspan=1 colspan=1>VALUELOGITHEAD</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=3>OUTPUT SIZE</td></tr><tr><td rowspan=1 colspan=1>LINEARCONCATRELULINEAR</td><td rowspan=1 colspan=1>[128][32][64]</td><td rowspan=1 colspan=3>32#BINS</td></tr><tr><td rowspan=1 colspan=1>ADVANTAGELOGIT HEAD</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=3>#ACTIONS× #BINS</td></tr><tr><td rowspan=1 colspan=1>LINEARCONCATRELU</td><td rowspan=1 colspan=1>[128][32]</td><td rowspan=1 colspan=3>32</td></tr></table>
421
+
422
+ # 6.5 COMPARISONS WITH RAINBOW
423
+
424
+ In this section we compare Reactor with the recently published Rainbow agent (Hessel et al., 2017). While ACER is the most closely related algorithmically, Rainbow is most closely related in terms of performance and thus a deeper understanding of the trade-offs between Rainbow and Reactor may benefit interested readers. There are many architectural and algorithmic differences between Rainbow and Reactor. We will therefore begin by highlighting where they agree. Both use a categorical action-value distribution critic (Bellemare et al., 2017), factored into state and state-action logits (Wang et al., 2015),
425
+
426
+ $$
427
+ q _ { i } ( x , a ) = \frac { l _ { i } ( x , a ) } { \sum _ { j } l _ { j } ( x , a ) } , \quad l _ { i } ( x , a ) = l _ { i } ( x ) + l _ { i } ( x , a ) - \frac { 1 } { | \mathcal { A } | } \sum _ { b \in \mathcal { A } } l _ { i } ( x , b ) .
428
+ $$
429
+
430
+ Both use prioritized replay, and finally, both perform $n$ -step Bellman updates.
431
+
432
+ Despite these similarities, Reactor and Rainbow are fundamentally different algorithms and are based upon different lines of research. While Rainbow uses Q-Learning and is based upon DQN (Mnih et al., 2015), Reactor is an actor-critic algorithm most closely based upon A3C (Mnih et al., 2016). Each inherits some design choices from their predecessors, and we have not performed an extensive ablation comparing these various differences. Instead, we will discuss four of the differences we believe are important but less obvious.
433
+
434
+ First, the network structures are substantially different. Rainbow uses noisy linear layers and ReLU activations throughout the network, whereas Reactor uses standard linear layers and concatenated ReLU activations throughout. To overcome partial observability, Rainbow, inheriting this choice from DQN, uses frame stacking. On the other hand, Reactor, inheriting its choice from A3C, uses LSTMs after the convolutional layers of the network. It is also difficult to directly compare the number of parameters in each network because the use of noisy linear layers doubles the number of parameters, although half of these are used to control noise, while the LSTM units in Reactor require more parameters than a corresponding linear layer would.
435
+
436
+ Second, both algorithms perform $n$ -step updates, however, the Rainbow $n$ -step update does not use any form of off-policy correction. Because of this, Rainbow is restricted to using only small values of $n$ (e.g. $n = 3$ ) because larger values would make sequences more off-policy and hurt performance. By comparison, Reactor uses our proposed distributional Retrace algorithm for off-policy correction of $n$ -step updates. This allows the use of larger values of $n$ (e.g. $n = 3 3$ ) without loss of performance.
437
+
438
+ Third, while both agents use prioritized replay buffers (Schaul et al., 2016), they each store different informaction and prio, sum of ize using different algdiscounted rewards a tuple contai, product of ng the state discount fa $x _ { t - 1 }$ $a _ { t - 1 }$ $n$ $\begin{array} { r } { \sum _ { k = 0 } ^ { n - 1 } r _ { t + k } \prod _ { m = 0 } ^ { k - 1 } \gamma _ { t + m } } \end{array}$ $n$ $\textstyle \prod _ { k = 0 } ^ { n - 1 } \gamma _ { t + k }$ , and next-state $x _ { t + n - 1 }$ . Tuples are prioritized based upon the last observed TD error, and inserted into replay with a maximum priority. Reactor stores length $n$ sequences of tuples $( x _ { t - 1 } , a _ { t - 1 } , r _ { t } , \gamma _ { t } )$ and also prioritizes based upon the observed TD error. However, when inserted into the buffer the priority is instead inferred based upon the known priorities of neighboring sequences. This priority inference was made efficient using the previously introduced contextual priority tree, and anecdotally we have seen it improve performance over a simple maximum priority approach.
439
+
440
+ Finally, the two algorithms have different approaches to exploration. Rainbow, unlike DQN, does not use $\epsilon$ -greedy exploration, but instead replaces all linear layers with noisy linear layers which induce randomness throughout the network. This method, called Noisy Networks (Fortunato et al., 2017), creates an adaptive exploration integrated into the agent’s network. Reactor does not use noisy networks, but instead uses the same entropy cost method used by A3C and many others (Mnih et al., 2016), which penalizes deterministic policies thus encouraging indifference between similarly valued actions. Because Rainbow can essentially learn not to explore, it may learn to become entirely greedy in the early parts of the episode, while still exploring in states not as frequently seen. In some sense, this is precisely what we want from an exploration technique, but it may also lead to highly deterministic trajectories in the early part of the episode and an increase in overfitting to those trajectories. We hypothesize that this may be the explanation for the significant difference in Rainbow’s performance between evaluation under no-op and random human starts, and why Reactor does not show such a large difference.
441
+
442
+ # 6.6 ATARI RESULTS
443
+
444
+ Table 4: Scores for each game evaluated with 30 random human starts. Reactor was evaluated by averaging scores over 200 episodes. All scores (except for Reactor) were taken from Wang et al. (2015), Mnih et al. (2016) and Hessel et al. (2017).
445
+
446
+ <table><tr><td>GAME AGENT</td><td>RANDOM</td><td>HUMAN</td><td>DQN</td><td>DDQN</td><td>DUEL</td><td>PRIOR</td><td>PRIOR. DUEL.</td><td>A3C LSTM</td><td>RAINBOW</td><td>REACTOR ND5</td><td>REACTOR</td><td>REACTOR 500M</td></tr><tr><td>ALIEN</td><td>128.3</td><td>6371.3</td><td>634.0</td><td>1033.4</td><td>1486.5</td><td>1334.7</td><td>823.7</td><td>945.3</td><td>6022.9</td><td>924.1</td><td>2763.9</td><td>4958.6</td></tr><tr><td>AMIDAR</td><td>11.8</td><td>1540.4</td><td>178.4</td><td>169.1</td><td>172.7</td><td>129.1</td><td>238.4</td><td>173.0</td><td>202.8</td><td>174.8</td><td>423.0</td><td>503.2</td></tr><tr><td>ASSAULT</td><td>166.9</td><td>628.9</td><td>3489.3</td><td>6060.8</td><td>3994.8</td><td>6548.9</td><td>10950.6</td><td>14497.9</td><td>14491.7</td><td>15041.2</td><td>9994.2</td><td>6713.8</td></tr><tr><td>ASTERIX</td><td>164.5</td><td>7536.0</td><td>3170.5</td><td>16837.0</td><td>15840.0</td><td>22484.5</td><td>364200.0</td><td>17244.5</td><td>280114.0</td><td>7269.8</td><td>26240.8</td><td>191948.0</td></tr><tr><td>ASTEROIDS</td><td>871.3</td><td>36517.3</td><td>1458.7</td><td>1193.2</td><td>2035.4</td><td>1745.1</td><td>1021.9</td><td>5093.1</td><td>2249.4</td><td>3764.4</td><td>2771.3</td><td>4215.0</td></tr><tr><td>ATLANTIS</td><td>13463.0</td><td>26575.0</td><td>292491.0</td><td>319688.0</td><td>445360.0</td><td>330647.0</td><td>423252.0</td><td>875822.0</td><td>814684.0</td><td>897803.5</td><td>280809.5</td><td>274196.0</td></tr><tr><td>BANK HEIST</td><td>21.7</td><td>644.5</td><td>312.7</td><td>886.0</td><td>1129.3</td><td>876.6</td><td>1004.6</td><td>932.8</td><td>826.0</td><td>852.8</td><td>710.1</td><td>876.0</td></tr><tr><td>BATTLEZONE</td><td>3560.0</td><td>33030.0</td><td>23750.0</td><td>24740.0</td><td>31320.0</td><td>25520.0</td><td>30650.0</td><td>20760.0</td><td>52040.0</td><td>84985.0</td><td>52300.0</td><td>57075.0</td></tr><tr><td>BEAM RIDER</td><td>254.6</td><td>14961.0</td><td>9743.2</td><td>17417.2</td><td>14591.3</td><td>31181.3</td><td>37412.2</td><td>24622.2</td><td>21768.5</td><td>9298.9</td><td>9941.6</td><td>12877.0</td></tr><tr><td>BERZERK</td><td>196.1</td><td>2237.5</td><td>493.4</td><td>1011.1</td><td>910.6</td><td>865.9</td><td>2178.6</td><td>862.2</td><td>1793.4</td><td>1221.3</td><td>1186.0</td><td>1643.4</td></tr><tr><td>BOWLING</td><td>35.2</td><td>146.5</td><td>56.5</td><td>69.6</td><td>65.7</td><td>52.0</td><td>50.4</td><td>41.8</td><td>39.4</td><td>63.7</td><td>72.4</td><td>76.0</td></tr><tr><td>BOXING</td><td>-1.5</td><td>9.6</td><td>70.3</td><td>73.5</td><td>77.3</td><td>72.3</td><td>79.2</td><td>37.3</td><td>54.9</td><td>60.2</td><td>75.1</td><td>55.6</td></tr><tr><td>BREAKOUT</td><td>1.6</td><td>27.9</td><td>354.5</td><td>368.9</td><td>411.6</td><td>343.0</td><td>354.6</td><td>766.8</td><td>379.5</td><td>459.0</td><td>465.5</td><td>478.4</td></tr><tr><td>CENTIPEDE</td><td>1925.5</td><td>10321.9</td><td>3973.9</td><td>3853.5</td><td>4881.0</td><td>3489.1</td><td>5570.2</td><td>1997.0</td><td>7160.9</td><td>3974.5</td><td>2584.0</td><td>2674.3</td></tr><tr><td>CHOPPER COMMAND</td><td>644.0</td><td>8930.0</td><td>5017.0</td><td>3495.0</td><td>3784.0</td><td>4635.0</td><td>8058.0</td><td>10150.0</td><td>10916.0</td><td>17312.0</td><td>33150.0</td><td>71442.5</td></tr><tr><td>CRAZY CLIMBER</td><td>9337.0</td><td>32667.0</td><td>98128.0</td><td>113782.0</td><td>124566.0</td><td>127512.0</td><td>127853.0</td><td>138518.0</td><td>143962.0</td><td>151295.0</td><td>182399.0</td><td>209784.0</td></tr><tr><td>DEFENDER</td><td>1965.5</td><td>14296.0</td><td>15917.5</td><td>27510.0</td><td>33996.0</td><td>23666.5</td><td>34415.0</td><td>233021.5</td><td>47671.3</td><td>162327.5</td><td>110446.3</td><td>221671.0</td></tr><tr><td>DEMON ATTACK</td><td>208.3</td><td>3442.8</td><td>12550.7</td><td>69803.4</td><td>56322.8</td><td>61277.5</td><td>73371.3</td><td>115201.9</td><td>109670.7</td><td>120682.2</td><td>101435.4</td><td>113853.0</td></tr><tr><td>DOUBLE DUNK</td><td>-16.0</td><td>-14.4</td><td>-6.0</td><td>-0.3</td><td>-0.8</td><td>16.0</td><td>-10.7</td><td>0.1</td><td>-0.6</td><td>22.2</td><td>11.0</td><td>22.0</td></tr><tr><td>ENDURO</td><td>-81.8</td><td>740.2</td><td>626.7</td><td>1216.6</td><td>2077.4</td><td>1831.0</td><td>2223.9</td><td>-82.5</td><td>2061.1</td><td>2054.3</td><td>2127.0</td><td>2138.3</td></tr><tr><td>FISHING DERBY</td><td>-77.1</td><td>5.1</td><td>-1.6</td><td>3.2</td><td>-4.1</td><td>9.8</td><td>17.0</td><td>22.6</td><td>22.6</td><td>23.2</td><td>17.7</td><td>21.7</td></tr><tr><td>FREEWAY</td><td>0.1</td><td>25.6</td><td>26.9</td><td>28.8</td><td>0.2</td><td>28.9</td><td>28.2</td><td>0.1</td><td>29.1</td><td>19.4</td><td>26.9</td><td>26.9</td></tr><tr><td>FROSTBITE</td><td>66.4</td><td>4202.8</td><td>496.1</td><td>1448.1</td><td>2332.4</td><td>3510.0</td><td>4038.4</td><td>197.6</td><td>4141.1</td><td>3497.8</td><td>4358.7</td><td>4743.5</td></tr><tr><td>GOPHER</td><td>250.0</td><td>2311.0</td><td>8190.4</td><td>15253.0</td><td>20051.4</td><td>34858.8</td><td>105148.4</td><td>17106.8</td><td>72595.7</td><td>36286.2</td><td>60743.2</td><td>89306.8</td></tr><tr><td>GRAVITAR</td><td>245.5</td><td>3116.0</td><td>298.0</td><td>200.5</td><td>297.0</td><td>269.5</td><td>167.0</td><td>320.0</td><td>567.5</td><td>544.0</td><td>583.0</td><td>779.8</td></tr><tr><td>H.E.R.O.</td><td>1580.3</td><td>25839.4</td><td>14992.9</td><td>14892.5</td><td>15207.9</td><td>20889.9</td><td>15459.2</td><td>28889.5</td><td>50496.8</td><td>22673.3</td><td>30253.7</td><td>37833.4</td></tr><tr><td>ICE HOCKEY</td><td>-9.7</td><td>0.5</td><td>-1.6</td><td>-2.5</td><td>-1.3</td><td>-0.2</td><td>0.5</td><td>-1.7</td><td>-0.7</td><td>11.1</td><td>0.9</td><td>4.9</td></tr><tr><td>JAMES BOND 007</td><td>33.5</td><td>368.5</td><td>697.5</td><td>573.0</td><td>835.5</td><td>3961.0</td><td>585.0</td><td>613.0</td><td>18142.3</td><td>12655.3</td><td>6741.0</td><td>13987.5</td></tr><tr><td>KANGAROO</td><td>100.0</td><td>2739.0</td><td>4496.0</td><td>11204.0</td><td>10334.0</td><td>12185.0</td><td>861.0</td><td>125.0</td><td>10841.0</td><td>9111.0</td><td>5143.5</td><td>5587.5</td></tr><tr><td>KRULL</td><td>1151.9</td><td>2109.1</td><td>6206.0</td><td>6796.1</td><td>8051.6</td><td>6872.8</td><td>7658.6</td><td>5911.4</td><td>6715.5</td><td>7450.1</td><td>7815.9</td><td>7621.8</td></tr><tr><td>KUNG-FU MASTER</td><td>304.0</td><td>20786.8</td><td>20882.0</td><td>30207.0</td><td>24288.0</td><td>31676.0</td><td>37484.0</td><td>40835.0</td><td>28999.8</td><td>48781.5</td><td>49767.9</td><td>55357.7</td></tr><tr><td>MONTEZUMA&#x27;S REVENGE</td><td>25.0</td><td>4182.0 15375.0</td><td>47.0 1092.3</td><td>42.0 1241.3</td><td>22.0 2250.6</td><td>51.0 1865.9</td><td>24.0 1007.8</td><td>41.0 850.7</td><td>154.0 2570.2</td><td>45.0 1102.4</td><td>984.0 1714.6</td><td>1045.5 2540.1</td></tr><tr><td>Ms. PAC-MAN NAME THIS GAME</td><td>197.8 1747.8</td></table>
447
+
448
+ Table 5: Scores for each game evaluated with 30 random noop starts. Reactor was evaluated by averaging scores over 200 episodes. All scores (except for Reactor) were taken from Wang et al. (2015) and Hessel et al. (2017).
449
+
450
+ <table><tr><td>GAME AGENT</td><td>RANDOM</td><td>HUMAN</td><td>DQN</td><td>DDQN</td><td>DUEL</td><td>PRIOR</td><td>PRIOR. DUEL.</td><td>RAINBOW</td><td>REACTOR ND5</td><td>REACTOR</td><td>REACTOR 500M</td></tr><tr><td>ALIEN</td><td>227.8</td><td>7127.7</td><td>1620.0</td><td>3747.7</td><td>4461.4</td><td>4203.8</td><td>3941.0</td><td>9491.7</td><td>4199.4</td><td>6482.1</td><td>12689.1</td></tr><tr><td>AMIDAR</td><td>5.8</td><td>1719.5</td><td>978.0</td><td>1793.3</td><td>2354.5</td><td>1838.9</td><td>2296.8</td><td>5131.2</td><td>1546.8</td><td>833.0</td><td>1015.8</td></tr><tr><td>ASSAULT</td><td>222.4</td><td>742.0</td><td>4280.4</td><td>5393.2</td><td>4621.0</td><td>7672.1</td><td>11477.0</td><td>14198.5</td><td>17543.8</td><td>11013.5</td><td>8323.3</td></tr><tr><td>ASTERIX</td><td>210.0</td><td>8503.3</td><td>4359.0</td><td>17356.5</td><td>28188.0</td><td>31527.0</td><td>375080.0</td><td>428200.3</td><td>16121.0</td><td>36238.5</td><td>205914.0</td></tr><tr><td>ASTEROIDS</td><td>719.1</td><td>47388.7</td><td>1364.5</td><td>734.7</td><td>2837.7</td><td>2654.3</td><td>1192.7</td><td>2712.8</td><td>4467.4</td><td>2780.4</td><td>3726.1</td></tr><tr><td>ATLANTIS</td><td>12850.0</td><td>29028.1</td><td>279987.0</td><td>106056.0</td><td>382572.0</td><td>357324.0</td><td>395762.0</td><td>826659.5</td><td>968179.5</td><td>308258.0</td><td>302831.0</td></tr><tr><td>BANK HEIST</td><td>14.2</td><td>753.1</td><td>455.0</td><td>1030.6</td><td>1611.9</td><td>1054.6</td><td>1503.1</td><td>1358.0</td><td>1236.8</td><td>988.7</td><td>1259.7</td></tr><tr><td>BATTLEZONE</td><td>2360.0</td><td>37187.5</td><td>29900.0</td><td>31700.0</td><td>37150.0</td><td>31530.0</td><td>35520.0</td><td>62010.0</td><td>98235.0</td><td>61220.0</td><td></td></tr><tr><td>BEAM RIDER</td><td>363.9</td><td>16926.5</td><td>8627.5</td><td>13772.8</td><td>12164.0</td><td>23384.2</td><td>30276.5</td><td>16850.2</td><td>8811.8</td><td></td><td>64070.0</td></tr><tr><td>BERZERK</td><td>123.7</td><td>2630.4</td><td>585.6</td><td>1225.4</td><td>1472.6</td><td>1305.6</td><td>3409.0</td><td>2545.6</td><td></td><td>8566.5</td><td>11033.4</td></tr><tr><td>BOWLING</td><td>23.1</td><td>160.7</td><td>50.4</td><td>68.1</td><td>65.5</td><td>47.9</td><td>46.7</td><td>30.0</td><td>1515.7 59.3</td><td>1641.4</td><td>2303.1</td></tr><tr><td>BOXING</td><td></td><td>12.1</td><td>88.0</td><td>91.6</td><td>99.4</td><td>95.6</td><td>98.9</td><td></td><td></td><td>75.4</td><td>81.0</td></tr><tr><td>BREAKOUT</td><td>0.1</td><td>30.5</td><td>385.5</td><td>418.5</td><td>345.3</td><td>373.9</td><td>366.0</td><td>99.6</td><td>99.7</td><td>99.4</td><td>99.4</td></tr><tr><td>CENTIPEDE</td><td>1.7 2090.9</td><td>12017.0</td><td>4657.7</td><td>5409.4</td><td>7561.4</td><td>4463.2</td><td>7687.5</td><td>417.5 8167.3</td><td>509.5 7267.2</td><td>518.4</td><td>514.8</td></tr><tr><td>CHOPPER COMMAND</td><td></td><td>7387.8</td><td>6126.0</td><td>5809.0</td><td>11215.0</td><td>8600.0</td><td>13185.0</td><td>16654.0</td><td>19901.5</td><td>3402.8</td><td>3422.0</td></tr><tr><td>CRAZY CLIMBER</td><td>811.0</td><td>35829.4</td><td>110763.0</td><td>117282.0</td><td>143570.0</td><td></td><td>162224.0</td><td>168788.5</td><td>173274.0</td><td>37568.0</td><td>107779.0 236422.0</td></tr><tr><td>DEFENDER</td><td>10780.5 2874.5</td><td>18688.9</td><td>23633.0</td><td>35338.5</td><td>42214.0</td><td>141161.0 31286.5</td><td>41324.5</td><td>55105.0</td><td>181074.3</td><td>194347.0</td><td></td></tr><tr><td>DEMON ATTACK</td><td></td><td>1971.0</td><td>12149.4</td><td>58044.2</td><td>60813.3</td><td>71846.4</td><td></td><td>111185.2</td><td>122782.5</td><td>113128.0</td><td>223025.0</td></tr><tr><td>DOUBLE DUNK</td><td>152.1</td><td>-16.4</td><td>-6.6</td><td>-5.5</td><td>0.1</td><td>18.5</td><td>72878.6 -12.5</td><td>-0.3</td><td>23.0</td><td>100189.0</td><td>115154.0</td></tr><tr><td>ENDURO</td><td>-18.6</td><td>860.5</td><td>729.0</td><td>1211.8</td><td>2258.2</td><td></td><td>2306.4</td><td>2125.9</td><td></td><td>11.4</td><td>23.0</td></tr><tr><td>FISHING DERBY</td><td>0.0</td><td>-38.7</td><td>-4.9</td><td>15.5</td><td></td><td>2093.0</td><td></td><td></td><td>2211.3</td><td>2230.1</td><td>2224.2</td></tr><tr><td>FREEWAY</td><td>-91.7</td><td>29.6</td><td>30.8</td><td>33.3</td><td>46.4</td><td>39.5</td><td>41.3</td><td>31.3</td><td>33.1</td><td>23.2</td><td>30.4</td></tr><tr><td>FROSTBITE</td><td>0.0</td><td></td><td>797.4</td><td>1683.3</td><td>0.0</td><td>33.7</td><td>33.0</td><td>34.0</td><td>22.3</td><td>31.4</td><td>31.5</td></tr><tr><td>GOPHER</td><td>65.2</td><td>4334.7 2412.5</td><td>8777.4</td><td>14840.8</td><td>4672.8</td><td>4380.1</td><td>7413.0</td><td>9590.5</td><td>7136.7</td><td>8042.1</td><td>7932.2</td></tr><tr><td>GRAVITAR</td><td>257.6</td><td>3351.4</td><td>473.0</td><td>412.0</td><td>15718.4</td><td>32487.2</td><td>104368.2</td><td>70354.6</td><td>36279.1</td><td>69135.1</td><td>89851.0</td></tr><tr><td>H.E.R.O.</td><td>173.0</td><td>30826.4</td><td>20437.8</td><td>20130.2</td><td>588.0</td><td>548.5</td><td>238.0</td><td>1419.3</td><td>1804.8</td><td>1073.8</td><td>2041.8</td></tr><tr><td>ICE HOCKEY</td><td>1027.0</td><td>0.9</td><td>-1.9</td><td>-2.7</td><td>20818.2</td><td>23037.7</td><td>21036.5</td><td>55887.4</td><td>27833.0</td><td>35542.2</td><td>43360.4</td></tr><tr><td>JAMES BOND 007</td><td>-11.2</td><td>302.8</td><td>768.5</td><td>1358.0</td><td>0.5 1312.5</td><td>1.3</td><td>-0.4</td><td>1.1</td><td>15.7</td><td>3.4</td><td>10.7</td></tr><tr><td>KANGAROO</td><td>29.0 52.0</td><td>3035.0</td><td>7259.0</td><td>12992.0</td><td>14854.0</td><td>5148.0</td><td>812.0</td><td>19809.0</td><td>14524.0</td><td>7869.2</td><td>16056.2</td></tr><tr><td>KRULL</td><td>1598.0</td><td>2665.5</td><td>8422.3</td><td>7920.5</td><td>11451.9</td><td>16200.0 9728.0</td><td>1792.0 10374.4</td><td>14637.5 8741.5</td><td>13349.0</td><td>10484.5</td><td>11266.5</td></tr><tr><td>KUNG-FU MASTER</td><td>258.5</td><td>22736.3</td><td>26059.0</td><td>29710.0</td><td>34294.0</td><td>39581.0</td><td>48375.0</td><td></td><td>10237.8</td><td>9930.8</td><td>9896.0</td></tr><tr><td>MONTEZUMA&#x27;S REVENGE</td><td>0.0</td><td>4753.3</td><td>0.0</td><td>0.0</td><td>0.0</td><td></td><td></td><td>52181.0</td><td>61621.5</td><td>59799.5</td><td>65836.5</td></tr><tr><td>MS.PAC-MAN</td><td>307.3</td><td>6951.6</td><td>3085.6</td><td>2711.4</td><td>6283.5</td><td>0.0 6518.7</td><td>0.0 3327.3</td><td>384.0</td><td>0.0</td><td>2643.5</td><td>2643.5</td></tr><tr><td>NAME THIS GAME</td><td></td><td>8049.0</td><td>8207.8</td><td>10616.0</td><td>11971.1</td><td></td><td>15572.5</td><td>5380.4 13136.0</td><td>4416.9 12636.5</td><td>2724.3 9907.2</td><td>3749.2 9543.8</td></tr><tr><td>PHOENIX</td><td>2292.3 761.4</td><td>7242.6</td><td>8485.2</td><td>12252.5</td><td>23092.2</td><td>12270.5 18992.7</td></table>
md/train/rkTS8lZAb/rkTS8lZAb.md ADDED
@@ -0,0 +1,406 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # BOUNDARY-SEEKING GENERATIVE ADVERSARIAL NETWORKS
2
+
3
+ R Devon Hjelm∗ MILA, University of Montreal, IVADO ´ erroneus@gmail.com
4
+
5
+ Athul Paul Jacob∗MILA, MSR, University of Waterlooapjacob@edu.uwaterloo.ca
6
+
7
+ Tong Che MILA, University of Montreal ´ tong.che@umontreal.ca
8
+
9
+ Adam Trischler
10
+ MSR
11
+ adam.trischler@microsoft.com
12
+
13
+ Kyunghyun Cho New York University, CIFAR Azrieli Global Scholar kyunghyun.cho@nyu.edu
14
+
15
+ # Yoshua Bengio
16
+
17
+ MILA, University of Montreal, CIFAR, IVADO ´ yoshua.bengio@umontreal.ca
18
+
19
+ # ABSTRACT
20
+
21
+ Generative adversarial networks (GANs, Goodfellow et al., 2014) are a learning framework that rely on training a discriminator to estimate a measure of difference between a target and generated distributions. GANs, as normally formulated, rely on the generated samples being completely differentiable w.r.t. the generative parameters, and thus do not work for discrete data. We introduce a method for training GANs with discrete data that uses the estimated difference measure from the discriminator to compute importance weights for generated samples, thus providing a policy gradient for training the generator. The importance weights have a strong connection to the decision boundary of the discriminator, and we call our method boundary-seeking GANs (BGANs). We demonstrate the effectiveness of the proposed algorithm with discrete image and character-based natural language generation. In addition, the boundary-seeking objective extends to continuous data, which can be used to improve stability of training, and we demonstrate this on Celeba, Large-scale Scene Understanding (LSUN) bedrooms, and Imagenet without conditioning.
22
+
23
+ # 1 INTRODUCTION
24
+
25
+ Generative adversarial networks (GAN, Goodfellow et al., 2014) involve a unique generative learning framework that uses two separate models, a generator and discriminator, with opposing or adversarial objectives. Training a GAN only requires back-propagating a learning signal that originates from a learned objective function, which corresponds to the loss of the discriminator trained in an adversarial manner. This framework is powerful because it trains a generator without relying on an explicit formulation of the probability density, using only samples from the generator to train.
26
+
27
+ GANs have been shown to generate often-diverse and realistic samples even when trained on highdimensional large-scale continuous data (Radford et al., 2015). GANs however have a serious limitation on the type of variables they can model, because they require the composition of the generator and discriminator to be fully differentiable.
28
+
29
+ With discrete variables, this is not true. For instance, consider using a step function at the end of a generator in order to generate a discrete value. In this case, back-propagation alone cannot provide the training signal, because the derivative of a step function is 0 almost everywhere. This is problematic, as many important real-world datasets are discrete, such as character- or word-based representations of language. The general issue of credit assignment for computational graphs with discrete operations (e.g. discrete stochastic neurons) is difficult and open problem, and only approximate solutions have been proposed in the past (Bengio et al., 2013; Gu et al., 2015; Gumbel & Lieblein, 1954; Jang et al., 2016; Maddison et al., 2016; Tucker et al., 2017). However, none of these have yet been shown to work with GANs. In this work, we make the following contributions:
30
+
31
+ • We provide a theoretical foundation for boundary-seeking GANs (BGAN), a principled method for training a generator of discrete data using a discriminator optimized to estimate an $f$ -divergence (Nguyen et al., 2010; Nowozin et al., 2016). The discriminator can then be used to formulate importance weights which provide policy gradients for the generator. We verify this approach quantitatively works across a set of $f$ -divergences on a simple classification task and on a variety of image and natural language benchmarks. • We demonstrate that BGAN performs quantitatively better than WGAN-GP (Gulrajani et al., 2017) in the simple discrete setting. • We show that the boundary-seeking objective extends theoretically to the continuous case and verify it works well with some common and difficult image benchmarks. Finally, we show that this objective has some improved stability properties within training and without.
32
+
33
+ # 2 BOUNDARY-SEEKING GANS
34
+
35
+ In this section, we will introduce boundary-seeking GANs (BGAN), an approach for training a generative model adversarially with discrete data, as well as provide its theoretical foundation. For BGAN, we assume the normal generative adversarial learning setting commonly found in work on GANs (Goodfellow et al., 2014), but these ideas should extend elsewhere.
36
+
37
+ # 2.1 GENERATIVE ADVERSARIAL LEARNING AND PROBLEM STATEMENT
38
+
39
+ Assume that we are given empirical samples from a target distribution, $\{ \boldsymbol { x } ^ { ( i ) } \in \mathcal { X } \} _ { i = 1 } ^ { M }$ , where $\mathcal { X }$ is the domain (such as the space of images, word- or character- based representations of natural language, etc.). Given a random variable $Z$ over a space $\mathcal { Z }$ (such as $[ 0 , 1 ] ^ { m } )$ , we wish to find the optimal parameters, $\hat { \theta } \in \mathbb { R } ^ { d }$ , of a function, $G _ { \theta } : \mathcal { Z } \to \mathcal { X }$ (such as a deep neural network), whose induced probability distribution, $\mathbb { Q } _ { \theta }$ , describes well the empirical samples.
40
+
41
+ In order to put this more succinctly, it is beneficial to talk about a probability distribution of the empirical samples, $\mathbb { P }$ , that is defined on the same space as $\mathbb { Q } _ { \theta }$ . We can now consider the difference measure between $\mathbb { P }$ and $\mathbb { Q } _ { \theta }$ $\phantom { } _ { \theta } , D ( \mathbb { P } , \mathbb { Q } _ { \theta } )$ , so the problem can be formulated as finding the parameters:
42
+
43
+ $$
44
+ \begin{array} { r } { \hat { \theta } = \underset { \theta } { \arg \operatorname* { m i n } } D ( \mathbb { P } , \mathbb { Q } _ { \theta } ) . } \end{array}
45
+ $$
46
+
47
+ Defining an appropriate difference measure is a long-running problem in machine learning and statistics, and choosing the best one depends on the specific setting. Here, we wish to avoid making strong assumptions on the exact forms of $\mathbb { P }$ or $\mathbb { Q } _ { \theta }$ , and we desire a solution that is scalable and works with very high dimensional data. Generative adversarial networks (GANs, Goodfellow et al., 2014) fulfill these criteria by introducing a discriminator function, $D _ { \phi } : \mathcal { X } \mathbb { R }$ , with parameters, $\phi$ , then defining a value function,
48
+
49
+ $$
50
+ \mathcal { V } ( \mathbb { P } , \mathbb { Q } _ { \theta } , D _ { \phi } ) = \mathbb { E } _ { \mathbb { P } } \left[ \log D _ { \phi } ( x ) \right] + \mathbb { E } _ { h ( z ) } \left[ \log ( 1 - D _ { \phi } ( G ( z ) ) \right] ,
51
+ $$
52
+
53
+ where samples $z$ are drawn from a simple prior, $h ( z )$ (such as $U ( 0 , 1 )$ or $\mathcal { N } ( 0 , 1 ) )$ . Here, $D _ { \phi }$ is a neural network with a sigmoid output activation, and as such can be interpreted as a simple binary classifier, and the value function can be interpreted as the negative of the Bayes risk. GANs train the discriminator to maximize this value function (minimize the mis-classification rate of samples coming from $\mathbb { P }$ or $\mathbb { Q } _ { \theta }$ ), while the generator is trained to minimize it. In other words, GANs solve an optimization problem:
54
+
55
+ $$
56
+ ( \hat { \theta } , \hat { \phi } ) = \underset { \theta } { \arg \operatorname* { m i n } } \underset { \phi } { \arg \operatorname* { m a x } } \mathcal { V } ( \mathbb { P } , \mathbb { Q } _ { \theta } , D _ { \phi } ) .
57
+ $$
58
+
59
+ Optimization using only back-propogation and stochastic gradient descent is possible when the generated samples are completely differentiable w.r.t. the parameters of the generator, $\theta$ .
60
+
61
+ In the non-parametric limit of an optimal discriminator, the value function is equal to a scaled and shifted version of the Jensen-Shannon divergence, $2 * \mathcal { D } _ { J S D } ( \mathbb { P } | | \mathbb { Q } _ { \theta } ) - \log 4 , ^ { 1 }$ which implies the generator is minimizing this divergence in this limit. $f$ -GAN (Nowozin et al., 2016) generalized this idea over all $f$ -divergences, which includes the Jensen-Shannon (and hence also GANs) but also the Kullback–Leibler, Pearson $\chi ^ { 2 }$ , and squared-Hellinger. Their work provides a nice formalism for talking about GANs that use $f$ -divergences, which we rely on here.
62
+
63
+ Definition 2.1 ( $f$ -divergence and its dual formulation). Let $f : \mathbb { R } _ { + } \to \mathbb { R }$ be a convex lower semicontinuous function and $f ^ { \star } : \mathcal { C } \subseteq \mathbb { R } \to \mathbb { R }$ be the convex conjugate with domain $\mathcal { C }$ . Next, let $\tau$ be an arbitrary family of functions, $\mathcal { T } = \{ T : \mathcal { X } \mathcal { C } \}$ . Finally, let $\mathbb { P }$ and $\mathbb { Q }$ be distributions that are completely differentiable w.r.t. the same Lebesgue measure, $\mu$ .2 The $f$ -divergence, $\mathcal { D } _ { f } ( \mathbb { P } | | \mathbb { Q } _ { \theta } )$ , generated by $f$ , is bounded from below by its dual representation (Nguyen et al., 2010),
64
+
65
+ $$
66
+ \mathcal { D } _ { f } \big ( \mathbb { P } | | \mathbb { Q } \big ) = \mathbb { E } _ { \mathbb { Q } } \left[ f \left( \frac { d \mathbb { P } / d \mu } { d \mathbb { Q } / d \mu } \right) \right] \geq \operatorname* { s u p } _ { T \in \mathcal { T } } \big ( \mathbb { E } _ { \mathbb { P } } [ T ( x ) ] - \mathbb { E } _ { \mathbb { Q } } [ f ^ { \star } ( T ( x ) ) ] \big ) .
67
+ $$
68
+
69
+ The inequality becomes tight when $\tau$ is the family of all possible functions. The dual form allows us to change a problem involving likelihood ratios (which may be intractable) to an maximization problem over $\tau$ . This sort of optimization is well-studied if $\tau$ is a family of neural networks with parameters $\phi$ (a.k.a., deep learning), so the supremum can be found with gradient ascent (Nowozin et al., 2016).
70
+
71
+ Definition 2.2 (Variational lower-bound for the $f$ -divergence). Let $T _ { \phi } = \nu \circ F _ { \phi }$ be a function, which is the composition of an activation function, $\nu : \mathbb { R } \to \mathcal { C }$ and a neural network, $F _ { \phi } : \mathcal { X } \mathbb { R }$ . We can write the variational lower-bound of the supremum in Equation 4 as 3:
72
+
73
+ $$
74
+ \begin{array} { r } { \mathcal { D } _ { f } ( \mathbb { P } | | \mathbb { Q } _ { \theta } ) \geq \mathbb { E } _ { \mathbb { P } } [ \nu \circ F _ { \phi } ( x ) ] - \mathbb { E } _ { \mathbb { Q } _ { \theta } } [ f ^ { \star } ( \nu \circ F _ { \phi } ( x ) ) ] = \mathcal { V } ( \mathbb { P } , \mathbb { Q } _ { \theta } , T _ { \phi } ) . } \end{array}
75
+ $$
76
+
77
+ Maximizing Equation 5 provides a neural estimator of $f$ -divergence, or neural divergence (Huang et al., 2018). Given the family of neural networks, $\mathcal { T } _ { \Phi } \stackrel { \cdot } { = } \{ T _ { \phi } \} _ { \phi \in \Phi }$ , is sufficiently expressive, this bound can become arbitrarily tight, and the neural divergence becomes arbitrarily close to the true divergence. As such, GANs are extremely powerful for training a generator of continuous data, leveraging a dual representation along with a neural network with theoretically unlimited capacity to estimate a difference measure.
78
+
79
+ For the remainder of this work, we will refer to $T _ { \phi } = \nu \circ F _ { \phi }$ as the discriminator and $F _ { \phi }$ as the statistic network (which is a slight deviation from other works). We use the general term $G A N$ to refer to all models that simultaneously minimize and maximize a variational lower-bound, $\nu ( \mathbb { P } , \mathbb { Q } _ { \theta } , T _ { \phi } )$ , of a difference measure (such as a divergence or distance). In principle, this extends to variants of GANs which are based on integral probability metrics (IPMs, Sriperumbudur et al., 2009) that leverage a dual representation, such as those that rely on restricting $\tau$ through parameteric regularization (Arjovsky et al., 2017) or by constraining its output distribution (Mroueh & Sercu, 2017; Mroueh et al., 2017; Sutherland et al., 2016).
80
+
81
+ # 2.2 ESTIMATION OF THE TARGET DISTRIBUTION
82
+
83
+ Here we will show that, with the variational lower-bound of an $f$ -divergence along with a family of positive activation functions, $\nu : \mathbb { R } \to \mathbb { R } _ { + }$ , we can estimate the target distribution, $\mathbb { P }$ , using the generated distribution, $\mathbb { Q } _ { \theta }$ , and the discriminator, $T _ { \phi }$ .
84
+
85
+ Theorem 1. Let $f$ be a convex function and $T ^ { \star } \in \mathcal { T }$ a function that satisfies the supremum in Equation 4 in the non-parametric limit. Let us assume that $\mathbb { P }$ and $\mathbb { Q } _ { \theta } ( x )$ are absolutely continuous w.r.t. a measure $\mu$ and hence admit densities, $p ( x )$ and $q _ { \theta } ( x )$ . Then the target density function, $p ( x )$ , is equal to $( \partial f ^ { \star } / \partial T ) ( T ^ { \star } ( x ) ) q _ { \theta } ( x )$ .
86
+
87
+ Table 1: Important weights and nonlinearities that ensure
88
+
89
+ <table><tr><td rowspan=1 colspan=3>Importance weights for f-divergences</td></tr><tr><td rowspan=1 colspan=1>f-divergence</td><td rowspan=1 colspan=1>v(y)</td><td rowspan=1 colspan=1>w(x)= (0f*/0T)(T(x))</td></tr><tr><td rowspan=1 colspan=1>GAN</td><td rowspan=1 colspan=1>-log(1+e-𝑦)</td><td rowspan=1 colspan=1>=eF(x)1-e-T</td></tr><tr><td rowspan=1 colspan=1>Jensen-Shannon</td><td rowspan=1 colspan=1>log2-log(1+e-y)</td><td rowspan=1 colspan=1>12-e-T=eF()</td></tr><tr><td rowspan=1 colspan=1>KL</td><td rowspan=1 colspan=1>y+1</td><td rowspan=1 colspan=1>e(T(x)-1)=eF(x)</td></tr><tr><td rowspan=1 colspan=1>Reverse KL</td><td rowspan=1 colspan=1>-e-y</td><td rowspan=1 colspan=1>1 =eF(x)T(x)</td></tr><tr><td rowspan=1 colspan=1>Squared-Hellinger</td><td rowspan=1 colspan=1>1-e-u/2</td><td rowspan=1 colspan=1>(1-T(x))² = eF(𝑥)</td></tr></table>
90
+
91
+ Proof. Following the definition of the $f$ -divergence and the convex conjugate, we have:
92
+
93
+ $$
94
+ \mathcal { D } _ { f } \big ( \mathbb { P } | | \mathbb { Q } _ { \theta } \big ) = \mathbb { E } _ { \mathbb { Q } _ { \theta } } \left[ f \left( \frac { p ( x ) } { q ( x ) } \right) \right] = \mathbb { E } _ { \mathbb { Q } _ { \theta } } \left[ \operatorname* { s u p } _ { t } \left\{ t \frac { p ( x ) } { q ( x ) } - f ^ { \star } ( t ) \right\} \right] .
95
+ $$
96
+
97
+ As $f ^ { \star }$ is convex, there is an absolute maximum when $\begin{array} { r } { \frac { \partial f ^ { \star } } { \partial t } ( t ) = \frac { p ( x ) } { q _ { \theta } ( x ) } } \end{array}$ . Rephrasing $t$ as a function, $T ( x )$ , and by the definition of $T ^ { \star } ( x )$ , we arrive at the desired result. □
98
+
99
+ Theorem 1 indicates that the target density function can be re-written in terms of a generated density function and a scaling factor. We refer to this scaling factor, $w ^ { \star } ( x ) = ( \partial f ^ { \star } / \partial T ) ( T ^ { \star } ( x ) )$ , as the optimal importance weight to make the connection to importance sampling 4. In general, an optimal discriminator is hard to guarantee in the saddle-point optimization process, so in practice, $T _ { \phi }$ will define a lower-bound that is not exactly tight w.r.t. the $f$ -divergence. Nonetheless, we can define an estimator for the target density function using a sub-optimal $T _ { \phi }$ .
100
+
101
+ Definition 2.3 $f$ -divergence importance weight estimator). Let $f$ and $f ^ { \star }$ , and $T _ { \phi } ( x )$ be defined as in Definitions 2.1 and 2.2 but where $\nu : \mathbb { R } \to \mathbb { R } _ { + } \subseteq \mathcal { C }$ is a positive activation function. Let $w ( x ) =$ $( \partial f ^ { \star } / \partial T ) ( T ( x ) )$ and $\beta = \mathbb { E } _ { \mathbb { Q } _ { \phi } } [ w ( x ) ]$ be a partition function. The $f$ -divergence importance weight estimator, $\tilde { p } ( x )$ is
102
+
103
+ $$
104
+ \tilde { p } ( x ) = \frac { w ( x ) } { \beta } q _ { \theta } ( x ) .
105
+ $$
106
+
107
+ The non-negativity of $\nu$ is important as the densities are positive. Table 1 provides a set of $f$ - divergences (following suggestions of Nowozin et al. (2016) with only slight modifications) which are suitable candidates and yield positive importance weights. Surprisingly, each of these yield the same function over the neural network before the activation function: $\bar { w ( x ) } = e ^ { F _ { \phi } ( x ) }$ .5 It should be noted that $\tilde { p } ( x )$ is a potentially biased estimator for the true density; however, the bias only depends on the tightness of the variational lower-bound: the tighter the bound, the lower the bias. This problem reiterates the problem with all GANs, where proofs of convergence are only provided in the optimal or near-optimal limit (Goodfellow et al., 2014; Nowozin et al., 2016; Mao et al., 2016).
108
+
109
+ # 2.3 BOUNDARY-SEEKING GANS
110
+
111
+ As mentioned above and repeated here, GANs only work when the value function is completely differentiable w.r.t. the parameters of the generator, $\theta$ . The gradients that would otherwise be used to train the generator of discrete variables are zero almost everywhere, so it is impossible to train the generator directly using the value function. Approximations for the back-propagated signal exist (Bengio et al., 2013; Gu et al., 2015; Gumbel & Lieblein, 1954; Jang et al., 2016; Maddison et al., 2016; Tucker et al., 2017), but as of this writing, none has been shown to work satisfactorily in training GANs with discrete data.
112
+
113
+ Here, we introduce the boundary-seeking GAN as a method for training GANs with discrete data. We first introduce a policy gradient based on the KL-divergence which uses the importance weights as a reward signal. We then introduce a lower-variance gradient which defines a unique reward signal for each $z$ and prove this can be used to solve our original problem.
114
+
115
+ Algorithm 1 . Discrete Boundary Seeking GANs
116
+
117
+ <table><tr><td colspan="2">(0,)← initialize the parameters of the generator and statistic network</td></tr><tr><td>repeat x(n)~P</td><td>&gt;Draw N samples from the empirical distribution</td></tr><tr><td>z(n)~h(2) x(m|n) ~ ge(x| z(n))</td><td>&gt;Draw N samples from the prior distribution &gt;Draw M samples from each conditional ge(x|z(m)) (drawn</td></tr><tr><td>independently if P and Q are multi-variate)</td><td></td></tr><tr><td>w(x(mln))←(df*/aT)o(voF(x(mln)))</td><td>ω(x(mln)) ← w(x(m|n))/∑m&#x27; w(x(m&#x27;|n)DCompute the un-normalized and normalized</td></tr><tr><td>importance weights (applied uniformly if P and Qe are multi-variate)</td><td>&gt;Estimate the variational</td></tr><tr><td>V(P,Qθ,To)←N∑nF(x(n))-1∑nM∑mw(x(mln) lower-bound</td><td>←Φ+γaVΦV(P,Qθ,TΦ) Optimize the discriminator parameters 0 ←θ+ γgN∑n,mω(x(mln))Vθ log ge(x(mln)| z) DOptimize the generator parameters</td></tr></table>
118
+
119
+ Policy gradient based on importance sampling Equation 7 offers an option for training a generator in an adversarial way. If we know the explicit density function, $q _ { \theta }$ , (such as a multivariate Bernoulli distribution), then we can, using $\tilde { p } ( x )$ as a target (keeping it fixed w.r.t. optimization of $\theta$ ), train the generator using the gradient of the KL-divergence:
120
+
121
+ $$
122
+ \nabla _ { \boldsymbol { \theta } } \mathcal { D } _ { K L } \big ( \tilde { p } ( \boldsymbol { x } ) | | \boldsymbol { q } _ { \boldsymbol { \theta } } \big ) = - \mathbb { E } _ { \mathbb { Q } _ { \boldsymbol { \theta } } } \left[ \frac { w ( \boldsymbol { x } ) } { \beta } \nabla _ { \boldsymbol { \theta } } \log q _ { \boldsymbol { \theta } } ( \boldsymbol { x } ) \right] .
123
+ $$
124
+
125
+ Here, the connection to importance sampling is even clearer, and this gradient resembles other importance sampling methods for training generative models in the discrete setting (Bornschein & Bengio, 2014; Rubinstein $\&$ Kroese, 2016). However, we expect the variance of this estimator will be high, as it requires estimating the partition function, $\beta$ (for instance, using Monte-Carlo sampling). We address reducing the variance from estimating the normalized importance weights next.
126
+
127
+ Lower-variance policy gradient Let $\begin{array} { r } { q _ { \theta } ( x ) = \int _ { \mathcal { Z } } g _ { \theta } ( x \mid z ) h ( z ) d z } \end{array}$ be a probability density function with a conditional density, $g _ { \theta } ( x \mid z ) : \mathcal { Z } [ 0 , 1 ] ^ { d }$ (e.g., a multivariate Bernoulli distribution), and prior over $z$ , $h ( z )$ . Let $\begin{array} { r } { \alpha ( z ) = \mathbb { E } _ { g _ { \theta } ( x \mid z ) } [ w ( \bar { x } ) ] = \int _ { \mathcal { X } } g _ { \theta } ( x \mid z ) w ( x ) d x } \end{array}$ be a partition function over the conditional distribution. Let us define $\begin{array} { r } { \tilde { p } ( x \mid z ) = \frac { w ( x ) } { \alpha ( z ) } g _ { \theta } ( x \mid z ) } \end{array}$ w(x)α(z) gθ(x | z) as the (normalized) conditional distribution weighted by $\frac { w ( x ) } { \alpha ( z ) }$ . The expected conditional KL-divergence over $h ( z )$ is:
128
+
129
+ $$
130
+ \mathbb { E } _ { h ( z ) } [ { \cal D } _ { K L } \left( \tilde { p } ( x \mid z ) \| g _ { \theta } ( x \mid z ) \right) ] = \int _ { z } h ( z ) { \cal D } _ { K L } \left( \tilde { p } ( x \mid z ) \| g _ { \theta } ( x \mid z ) \right) d z
131
+ $$
132
+
133
+ Let $x ^ { ( m ) } \sim g _ { \theta } ( x \mid z )$ be samples from the prior and $\begin{array} { r } { \tilde { w } ( x ^ { ( m ) } ) = \frac { w ( x ^ { ( m ) } ) } { \sum _ { m ^ { \prime } } w ( x ^ { ( m ^ { \prime } ) } ) } } \end{array}$ be a Monte-Carlo estimate of the normalized importance weights. The gradient of the expected conditional KL-divergence w.r.t. the generator parameters, $\theta$ , becomes:
134
+
135
+ $$
136
+ \nabla _ { \theta } \mathbb { E } _ { h ( z ) } [ \mathcal { D } _ { K L } \left( \tilde { p } ( x \mid z ) \| g _ { \theta } ( x \mid z ) \right) ] = - \mathbb { E } _ { h ( z ) } \left[ \sum _ { m } \tilde { w } ( x ^ { ( m ) } ) \nabla _ { \theta } \log g _ { \theta } ( x ^ { ( m ) } \mid z ) \right] ,
137
+ $$
138
+
139
+ where we have approximated the expectation using the Monte-Carlo estimate.
140
+
141
+ Minimizing the expected conditional KL-divergences is stricter than minimizing the KL-divergence in Equation 7, as it requires all of the conditional distributions to match independently. We show that the KL-divergence of the marginal probabilities is zero when the expectation of the conditional KL-divergence is zero as well as show this estimator works better in practice in the Appendix.
142
+
143
+ Algorithm 1 describes the training procedure for discrete BGAN. This algorithm requires an additional $M$ times more computation to compute the normalized importance weights, though these can be computed in parallel exchanging space for time. When the $\mathbb { P }$ and $\mathbb { Q } _ { \theta }$ are multi-variate (such as with discrete image data), we make the assumption that the observed variables are independent conditioned on $Z$ . The importance weights, $w$ , are then applied uniformly across each of the observed variables.
144
+
145
+ Connection to policy gradients REINFORCE is a common technique for dealing with discrete data in GANs (Che et al., 2017; Li et al., 2017). Equation 9 is a policy gradient in the special case that the reward is the normalized importance weights. This reward approaches the likelihood ratio in the non-parametric limit of an optimal discriminator. Here, we make another connection to REINFORCE as it is commonly used, with baselines, by deriving the gradient of the reversed KL-divergence.
146
+
147
+ Definition 2.4 (REINFORCE-based BGAN). Let $T _ { \phi } ( x )$ be defined as above where $\partial f ^ { \star } / \partial T ( T _ { \phi } ( x ) ) = e ^ { F _ { \phi } ( x ) }$ . Consider the gradient of the reversed KL-divergence:
148
+
149
+ $$
150
+ \begin{array} { l } { \nabla _ { \theta } \mathcal { D } _ { K L } \left( q \theta \| \tilde { p } \right) = - \mathbb { E } _ { h ( z ) } \left[ \displaystyle \sum _ { m } ( \log w ( x ^ { ( m ) } ) - \log \beta + 1 ) \nabla _ { \theta } \log g _ { \theta } ( x ^ { ( m ) } \mid z ) \right] } \\ { = - \mathbb { E } _ { h ( z ) } \left[ \displaystyle \sum _ { m } ( F _ { \phi } ( x ) - b ) \nabla _ { \theta } \log g _ { \theta } ( x ^ { ( m ) } \mid z ) \right] } \end{array}
151
+ $$
152
+
153
+ From this, it is clear that we can consider the output of the statistic network, $F _ { \phi } ( x )$ , to be a reward and $b = \log \beta = \mathbb { E } _ { \mathbb { Q } _ { \theta } } [ w ( x ) ]$ to be the analog of a baseline.6 This gradient is similar to those used in previous works on discrete GANs, which we discuss in more detail in Section 3.
154
+
155
+ # 2.4 CONTINUOUS VARIABLES AND THE STABILITY OF GANS
156
+
157
+ For continuous variables, minimizing the variational lower-bound suffices as an optimization technique as we have the full benefit of back-propagation to train the generator parameters, $\theta$ . However, while the convergence of the discriminator is straightforward, to our knowledge there is no general proof of convergence for the generator except in the non-parametric limit or near-optimal case. What’s worse is the value function can be arbitrarily large and negative. Let us assume that max $T = M < \infty$ is unique. As $f ^ { \star }$ is convex, the minimum of the lower-bound over $\theta$ is:
158
+
159
+ $$
160
+ \begin{array} { r l } & { \underset { \theta } { \operatorname* { i n f } } \ V ( \mathbb { P } , \mathbb { Q } _ { \theta } , D _ { \phi } ) = \underset { \theta } { \operatorname* { i n f } } \ \mathbb { E } _ { \mathbb { P } } [ T _ { \phi } ( x ) ] - \mathbb { E } _ { \mathbb { Q } _ { \theta } } [ f ^ { \star } ( T _ { \phi } ( x ) ) ] } \\ & { = \mathbb { E } _ { \mathbb { P } } [ T _ { \phi } ( x ) ] - \underset { \theta } { \operatorname* { s u p } } \mathbb { E } _ { \mathbb { Q } _ { \theta } } [ f ^ { \star } ( T _ { \phi } ( x ) ) ] = \mathbb { E } _ { \mathbb { P } } [ T _ { \phi } ( x ) ] - f ^ { \star } ( M ) . } \end{array}
161
+ $$
162
+
163
+ In other words, the generator objective is optimal when the generated distribution, $\mathbb { Q } _ { \theta }$ , is nonzero only for the set $\{ x \mid T ( x ) = M \}$ . Even outside this worst-case scenario, the additional consequence of this minimization is that this variational lower-bound can become looser w.r.t. the $f$ -divergence, with no guarantee that the generator would actually improve. Generally, this is avoided by training the discriminator in conjunction with the generator, possibly for many steps for every generator update. However, this clearly remains one source of potential instability in GANs.
164
+
165
+ Equation 7 reveals an alternate objective for the generator that should improve stability. Notably, we observe that for a given estimator, $\tilde { p } ( x )$ , $q _ { \theta } ( x )$ matches when $w ( x ) = ( \partial f ^ { \star } / \partial T ) ( T ( x ) ) = 1$ .
166
+
167
+ Definition 2.5 (Continuous BGAN objective for the generator). Let $G _ { \theta } : \mathcal { Z } \to \mathcal { X }$ be a generator function that takes as input a latent variable drawn from a simple prior, $z \sim h ( z )$ . Let $T _ { \phi }$ and $w ( x )$ be defined as above. We define the continuous BGAN objective as: $\hat { \theta } = \arg \operatorname* { m i n } _ { \theta } ( \log w ( G _ { \theta } ( z ) ) ) ^ { 2 }$ . We chose the log, as with our treatments of $f$ -divergences in Table 1, the objective is just the square of the statistic network output:
168
+
169
+ $$
170
+ \widehat { \theta } = \underset { \theta } { \arg \operatorname* { m i n } } F _ { \phi } ( G _ { \theta } ( z ) ) ^ { 2 } .
171
+ $$
172
+
173
+ This objective can be seen as changing a concave optimization problem (which is poor convergence properties) to a convex one.
174
+
175
+ # 3 RELATED WORK AND DISCUSSION
176
+
177
+ On estimating likelihood ratios from the discriminator Our work relies on estimating the likelihood ratio from the discriminator, the theoretical foundation of which we draw from $f$ - GAN (Nowozin et al., 2016). The connection between the likelihood ratios and the policy gradient is known in previous literature (Jie & Abbeel, 2010), and the connection between the discriminator output and the likelihood ratio was also made in the context of continuous GANs (Mohamed & Lakshminarayanan, 2016; Tran et al., 2017). However, our work is the first to successfully formulate and apply this approach to the discrete setting.
178
+
179
+ Importance sampling Our method is very similar to re-weighted wake-sleep (RWS, Bornschein & Bengio, 2014), which is a method for training Helmholtz machines with discrete variables. RWS also relies on minimizing the KL divergence, the gradients of which also involve a policy gradient over the likelihood ratio. Neural variational inference and learning (NVIL, Mnih & Gregor, 2014), on the other hand, relies on the reverse KL. These two methods are analogous to our importance sampling and REINFORCE-based BGAN formulations above.
180
+
181
+ GAN for discrete variables Training GANs with discrete data is an active and unsolved area of research, particularly with language model data involving recurrent neural network (RNN) generators (Yu et al., 2016; Li et al., 2017). Many REINFORCE-based methods have been proposed for language modeling (Yu et al., 2016; Li et al., 2017; Dai et al., 2017) which are similar to our REINFORCE-based BGAN formulation and effectively use the sigmoid of the estimated loglikelihood ratio. The primary focus of these works however is on improving credit assignment, and their approaches are compatible with the policy gradients provided in our work.
182
+
183
+ There have also been some improvements recently on training GANs on language data by rephrasing the problem into a GAN over some continuous space (Lamb et al., 2016; Kim et al., 2017; Gulrajani et al., 2017). However, each of these works bypass the difficulty of training GANs with discrete data by rephrasing the deterministic game in terms of continuous latent variables or simply ignoring the discrete sampling process altogether, and do not directly solve the problem of optimizing the generator from a difference measure estimated from the discriminator.
184
+
185
+ Remarks on stabilizing adversarial learning, IPMs, and regularization A number of variants of GANs have been introduced recently to address stability issues with GANs. Specifically, generated samples tend to collapse to a set of singular values that resemble the data on neither a persample or distribution basis. Several early attempts in modifying the train procedure (Berthelot et al., 2017; Salimans et al., 2016) as well as the identifying of a taxonomy of working architectures (Radford et al., 2015) addressed stability in some limited setting, but it wasn’t until Wassertstein GANs (WGAN, Arjovsky et al., 2017) were introduced that there was any significant progress on reliable training of GANs.
186
+
187
+ WGANs rely on an integral probability metric (IPM, Sriperumbudur et al., 2009) that is the dual to the Wasserstein distance. Other GANs based on IPMs, such as Fisher GAN (Mroueh & Sercu, 2017) tout improved stability in training. In contrast to GANs based on $f$ -divergences, besides being based on metrics that are “weak”, IPMs rely on restricting $\tau$ to a subset of all possible functions. For instance in WGANs, $\mathcal { T } = \{ T \ | \ \| T \| _ { L } \leq K \}$ , is the set of K-Lipschitz functions. Ensuring a statistic network, $T _ { \phi }$ , with a large number of parameters is Lipschitz-continuous is hard, and these methods rely on some sort of regularization to satisfy the necessary constraints. This includes the original formulation of WGANs, which relied on weight-clipping, and a later work (Gulrajani et al., 2017) which used a gradient penalty over interpolations between real and generated data.
188
+
189
+ Unfortunately, the above works provide little details on whether $T _ { \phi }$ is actually in the constrained set in practice, as this is probably very hard to evaluate in the high-dimensional setting. Recently, Roth et al. (2017) introduced a gradient norm penalty similar to that in Gulrajani et al. (2017) without interpolations and which is formulated in terms of $f$ -divergences. In our work, we’ve found that this approach greatly improves stability, and we use it in nearly all of our results. That said, it is still unclear empirically how the discriminator objective plays a strong role in stabilizing adversarial learning, but at this time it appears that correctly regularizing the discriminator is sufficient.
190
+
191
+ # 4 DISCRETE VARIABLES: EXPERIMENTS AND RESULTS
192
+
193
+ # 4.1 ADVERSARIAL CLASSIFICATION
194
+
195
+ We first verify the gradient estimator provided by BGAN works quantitatively in the discrete setting by evaluating its ability to train a classifier with the CIFAR-10 dataset (Krizhevsky & Hinton, 2009). The “generator” in this setting is a multinomial distribution, $g _ { \boldsymbol { \theta } } ( \boldsymbol { y } \mid \boldsymbol { x } )$ modeled by the softmax output of a neural network. The discriminator, $T _ { \phi } ( x , y )$ , takes as input an image $/$ label pair so that the variational lower-bound is:
196
+
197
+ $$
198
+ \mathcal { V } ( \mathbb { P } _ { X Y } , \mathbb { Q } _ { Y | X } \mathbb { P } _ { X } , T _ { \phi } ) = \mathbb { E } _ { p ( x , y ) } [ T _ { \phi } ( x , y ) ] - \mathbb { E } _ { g _ { \theta } ( y | x ) p ( x ) } [ f ^ { \star } ( T _ { \phi } ( x , y ) ) ] \quad
199
+ $$
200
+
201
+ For these experiments, we used a simple 4-layer convolutional neural network with an additional 3 fully-connected layers. We trained the importance sampling BGAN on the set of $f$ -divergences given in Table 1 as well as the REINFORCE counterpart for 200 epochs and report the accuracy on the test set. In addition, we ran a simple classification baseline trained on cross-entropy as well as a continuous approximation to the problem as used in WGAN-based approaches (Gulrajani et al., 2017). No regularization other than batch normalization (BN, Ioffe & Szegedy, 2015) was used with the generator, while gradient norm penalty (Roth et al., 2017) was used on the statistic networks. For WGAN, we used clipping, and chose the clipping parameter, the number of discriminator updates, and the learning rate separately based on training set performance. The baseline for the REINFORCE method was learned using a moving average of the reward.
202
+
203
+ Table 2: Adversarial classification on CIFAR-10. All methods are BGAN with importance sampling (left) or REINFORCE (right) except for the baseline (cross-entropy) and Wasserstein GAN (WGAN)
204
+
205
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Measure</td><td rowspan=1 colspan=2>Error(%)</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Baseline</td><td rowspan=1 colspan=2>26.6</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>WGAN (clipping)</td><td rowspan=1 colspan=2>72.3</td></tr><tr><td rowspan=1 colspan=1>BAAN</td><td rowspan=1 colspan=1>GANJensen-ShannonKLReverse KLSquared-Hellinger</td><td rowspan=1 colspan=1>IS26.226.028.127.827.0</td><td rowspan=1 colspan=1>REINFORCE27.127.728.028.228.0</td></tr></table>
206
+
207
+ Our results are summarized in Table 2. Overall, BGAN performed similarly to the baseline on the test set, with the REINFORCE method performing only slightly worse. For WGAN, despite our best efforts, we could only achieve an error rate of $7 2 . 3 \%$ on the test set, and this was after a total of 600 epochs to train. Our efforts to train WGAN using gradient penalty failed completely, despite it working with higher-dimension discrete data (see Appendix).
208
+
209
+ # 4.2 DISCRETE IMAGE AND NATURAL LANGUAGE GENERATION
210
+
211
+ Image data: binary MNIST and quantized CelebA We tested BGAN using two imaging benchmarks: the common discretized MNIST dataset (Salakhutdinov & Murray, 2008) and a new quantized version of the CelebA dataset (see Liu et al., 2015, for the original CelebA dataset).
212
+
213
+ For CelebA quantization, we first downsampled the images from $6 4 \times 6 4$ to $3 2 \times 3 2$ . We then generated a 16-color palette using Pillow, a fork of the Python Imaging Project (https://pythonpillow.org). This palette was then used to quantize the RGB values of the CelebA samples to a one-hot representation of 16 colors. Our models used deep convolutional GANs (DCGAN, Radford et al., 2015). The generator is fed a vector of 64 i.i.d. random variables drawn from a uniform distribution, $[ 0 , 1 ]$ . The output nonlinearity was sigmoid for MNIST to model the Bernoulli centers for each pixel, while the output was softmax for quantized CelebA.
214
+
215
+ Our results show that training the importance-weighted BGAN on discrete MNIST data is stable and produces realistic and highly variable generated handwritten digits (Figure 1). Further quantitative experiments comparing BGAN against WGAN with the gradient penalty (WGAN-GP Gulrajani et al., 2017) showed that when training a new discriminator on the samples directly (keeping the
216
+
217
+ ![](images/20a6abbf774cb953f65db51834b3fb647f8ba26b627aad89c944e65b709ee04d.jpg)
218
+ Figure 1: Left: Random samples from the generator trained as a boundary-seeking GAN (BGAN) with discrete MNIST data. Shown are the Bernoulli centers of the generator conditional distribution.
219
+
220
+ ![](images/dee3b7d13c734aa0eb279677f582775c076f7f1c467acc418ff54e94d08b56b9.jpg)
221
+ Figure 2: Left: Groundtruth 16-color (4-bit) quantized CelebA images downsampled to $3 2 ~ \times ~ 3 2$ . Right: Samples produced from the generator trained as a boundaryseeking GAN on the quantized CelebA for 50 epochs.
222
+
223
+ Table 3: Random samples drawn from a generator trained with the discrete BGAN objective. The model is able to successfully learn many important character-level English language patterns.
224
+
225
+ And it ’s miant a quert could he ” We pait of condels of money wi Lankard Avaloma was Mr. Palin , Thene says the sounded Sunday in About dose and warthestrinds fro
226
+
227
+ He weirst placed produces hopesi Sance Jory Chorotic , Sen doesin What was like one of the July 2 The BBC nothing overton and slea College is out in contesting rev
228
+
229
+ What ’s word your changerg bette In Lep Edger ’s begins of a find”, ” I stroke like we all call on a With there was a passes ipposing And tear he jumped by even a roy
230
+
231
+ generator fixed), the final estimated distance measures were higher (i.e., worse) for WGAN-GP than BGAN, even when comparing using the Wasserstein distance. The complete experiment and results are provided in the Appendix. For quantized CelebA, the generator trained as a BGAN produced reasonably realistic images which resemble the original dataset well and with good diversity.
232
+
233
+ 1-billion word Next, we test BGAN in a natural language setting with the 1-billion word dataset (Chelba et al., 2013), modeling at the character-level and limiting the dataset to sentences of at least 32 and truncating to 32 characters. For character-level language generation, we follow the architecture of recent work (Gulrajani et al., 2017), and use deep convolutional neural networks for both the generator and discriminator.
234
+
235
+ Training with BGAN yielded stable, reliably good character-level generation (Table 3), though generation is poor compared to recurrent neural network-based methods (Sutskever et al., 2011; Mikolov, 2012). However, we are not aware of any previous work in which a discrete GAN, without any continuous relaxation (Gulrajani et al., 2017), was successfully trained from scratch without pretraining and without an auxiliary supervised loss to generate any sensible text. Despite the low quality of the text relative to supervised recurrent language models, the result demonstrates the stability and capability of the proposed boundary-seeking criterion for training discrete GANs.
236
+
237
+ # 5 CONTINUOUS VARIABLES: EXPERIMENTS AND RESULTS
238
+
239
+ Here we present results for training the generator on the boundary-seeking objective function. In these experiments, we use the original GAN variational lower-bound from Goodfellow et al. (2014), only modifying the generator function. All results use gradient norm regularization (Roth et al., 2017) to ensure stability.
240
+
241
+ # 5.1 GENERATION BENCHMARKS
242
+
243
+ We test here the ability of continuous BGAN to train on high-dimensional data. In these experiments, we train on the CelebA, LSUN (Yu et al., 2015) datasets, and the 2012 ImageNet dataset with all 1000 labels (Krizhevsky et al., 2012). The discriminator and generator were both modeled as 4-layer Resnets (He et al., 2016) without conditioning on labels or attributes.
244
+
245
+ Figure 3 shows examples from BGAN trained on these datasets. Overall, the sample quality is very good. Notably, our Imagenet model produces samples that are high quality, despite not being trained conditioned on the label and on the full dataset. However, the story here may not be that BGAN necessarily generates better images than using the variational lower-bound to train the generator, since we found that images of similar quality on CelebA could be attained without the boundaryseeking loss as long as gradient norm regularization was used, rather we confirm that BGAN works well in the high-dimensional setting.
246
+
247
+ ![](images/ae72bee945dce4ef0964f3136b8a9a9f84cc5979449752dd873e8cfe5f4a76a7.jpg)
248
+
249
+ ![](images/05dffb4ee3c71937521a045074aa36c1d11eb81f23974c9e3698794a367637d7.jpg)
250
+ Figure 3: Highly realistic samples from a generator trained with BGAN on the CelebA and LSUN datasets. These models were trained using a deep ResNet architecture with gradient norm regularization (Roth et al., 2017). The Imagenet model was trained on the full 1000 label dataset without conditioning.
251
+ LSUN
252
+
253
+ # 5.2 STABILITY OF CONTINUOUS BGAN
254
+
255
+ As mentioned above, gradient norm regularization greatly improves stability and allows for training with very large architectures. However, training still relies on a delicate balance between the generator and discriminator: over-training the generator may destabilize learning and lead to worse results. We find that the BGAN objective is resilient to such over-training.
256
+
257
+ Stability in training with an overoptimized generator To test this, we train on the CIFAR-10 dataset using a simple DCGAN architecture. We use the original GAN objective for the discriminator, but vary the generator loss as the variational lower-bound, the proxy loss (i.e., the generator loss function used in Goodfellow et al., 2014), and the boundary-seeking loss (BGAN). To better study the effect of these losses, we update the generator for 5 steps for every discriminator step.
258
+
259
+ Our results (Figure 4) show that over-optimizing the generator significantly degrades sample quality. However, in this difficult setting, BGAN learns to generate reasonable samples in fewer epochs than other objective functions, demonstrating improved stability.
260
+
261
+ Following the generator gradient We further test the different objectives by looking at the effect of gradient descent on the pixels. In this setting, we train a DCGAN (Radford et al., 2015) using the proxy loss. We then optimize the discriminator by training it for another 1000 updates. Next, we perform gradient descent directly on the pixels, the original variational lower-bound, the proxy, and the boundary seeking losses separately.
262
+
263
+ ![](images/4a1b06bc606ffaf529946759ba0728bfff11ca239f3c312edc62d4c7dcbf34c9.jpg)
264
+ Figure 4: Training a GAN with different generator loss functions and 5 updates for the generator for every update of the discriminator. Over-optimizing the generator can lead to instability and poorer results depending on the generator objective function. Samples for GAN and GAN with the proxy loss are quite poor at 50 discriminator epochs (250 generator epochs), while BGAN is noticeably better. At 100 epochs, these models have improved, though are still considerably behind BGAN.
265
+
266
+ Our results show that following the BGAN objective at the pixel-level causes the least degradation of image quality. This indicates that, in training, the BGAN objective is the least likely to disrupt adversarial learning.
267
+
268
+ # 6 CONCLUSION
269
+
270
+ Reinterpreting the generator objective to match the proposal target distribution reveals a novel learning algorithm for training a generative adversarial network (GANs, Goodfellow et al., 2014). This proposed approach of boundary-seeking provides us with a unified framework under which learning algorithms for both discrete and continuous variables are derived. Empirically, we verified our approach quantitatively and showed the effectiveness of training a GAN with the proposed learning algorithm, which we call a boundary-seeking GAN (BGAN), on both discrete and continuous variables, as well as demonstrated some properties of stability.
271
+
272
+ # ACKNOWLEDGEMENTS
273
+
274
+ RDH thanks IVADO, MILA, UdeM, NIH grants R01EB006841 and P20GM103472, and NSF grant 1539067 for support. APJ thanks UWaterloo, Waterloo AI lab and MILA for their support and Michael Noukhovitch, Pascal Poupart for constructive discussions. KC thanks AdeptMind, TenCent, eBay, Google (Faculty Awards 2015, 2016), NVIDIA Corporation (NVAIL) and Facebook for their support. YB thanks CIFAR, NSERC, IBM, Google, Facebook and Microsoft for their support. We would like to thank Simon Sebbagh for his input and help with Theorem 2. Finally, we wish to thank the developers of Theano (Al-Rfou et al., 2016), Lasagne http://lasagne.readthedocs. io, and Fuel (Van Merrienboer et al., 2015) for their valuable code-base. ¨
275
+
276
+ # REFERENCES
277
+
278
+ Al-Rfou, Rami, Alain, Guillaume, Almahairi, Amjad, Angermueller, Christof, Bahdanau, Dzmitry, Ballas, Nicolas, Bastien, Fred´ eric, Bayer, Justin, Belikov, Anatoly, et al. Theano: A python ´ framework for fast computation of mathematical expressions. arXiv preprint arXiv:1605.02688, 2016.
279
+
280
+ Arjovsky, Martin, Chintala, Soumith, and Bottou, Leon. Wasserstein gan. ´ arXiv preprint arXiv:1701.07875, 2017.
281
+
282
+ Bengio, Yoshua, Leonard, Nicholas, and Courville, Aaron. Estimating or propagating gradients ´ through stochastic neurons for conditional computation. arXiv preprint arXiv:1308.3432, 2013.
283
+
284
+ ![](images/e9c044ad6578dda32171b6f87391c238401303c03f9310abda678a515a799bcd.jpg)
285
+ Figure 5: Following the generator objective using gradient descent on the pixels. BGAN and the proxy have sharp initial gradients that decay to zero quickly, while the variational lower-bound objective gradient slowly increases. The variational lower-bound objective leads to very poor images, while the proxy and BGAN objectives are noticeably better. Overall, BGAN performs the best in this task, indicating that its objective will not overly disrupt adversarial learning.
286
+
287
+ Berthelot, David, Schumm, Tom, and Metz, Luke. Began: Boundary equilibrium generative adversarial networks. arXiv preprint arXiv:1703.10717, 2017.
288
+
289
+ Bornschein, Jorg and Bengio, Yoshua. Reweighted wake-sleep. ¨ arXiv preprint arXiv:1406.2751, 2014.
290
+
291
+ Che, Tong, Li, Yanran, Zhang, Ruixiang, Hjelm, R Devon, Li, Weijie, Song, Yangqiu, and Bengio, Yoshua. Maximum-likelihood augmented discrete generative adversarial networks. arXiv preprint, 2017.
292
+
293
+ Chelba, Ciprian, Mikolov, Tomas, Schuster, Mike, Ge, Qi, Brants, Thorsten, Koehn, Phillipp, and Robinson, Tony. One billion word benchmark for measuring progress in statistical language modeling. arXiv preprint arXiv:1312.3005, 2013.
294
+
295
+ Dai, Bo, Lin, Dahua, Urtasun, Raquel, and Fidler, Sanja. Towards diverse and natural image descriptions via a conditional gan. arXiv preprint arXiv:1703.06029, 2017.
296
+
297
+ Goodfellow, Ian, Pouget-Abadie, Jean, Mirza, Mehdi, Xu, Bing, Warde-Farley, David, Ozair, Sherjil, Courville, Aaron, and Bengio, Yoshua. Generative adversarial nets. In Advances in Neural Information Processing Systems, pp. 2672–2680, 2014.
298
+
299
+ Gu, Shixiang, Levine, Sergey, Sutskever, Ilya, and Mnih, Andriy. Muprop: Unbiased backpropagation for stochastic neural networks. arXiv preprint arXiv:1511.05176, 2015.
300
+
301
+ Gulrajani, Ishaan, Ahmed, Faruk, Arjovsky, Martin, Dumoulin, Vincent, and Courville, Aaron. Improved training of wasserstein gans. arXiv preprint arXiv:1704.00028, 2017.
302
+
303
+ Gumbel, Emil Julius and Lieblein, Julius. Statistical theory of extreme values and some practical applications: a series of lectures. US Govt. Print. Office, 1954.
304
+
305
+ He, Kaiming, Zhang, Xiangyu, Ren, Shaoqing, and Sun, Jian. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016.
306
+
307
+ Huang, Gabriel, Berard, Hugo, Touati, Ahmed, Gidel, Gauthier, Vincent, Pascal, and Lacoste-Julien, Simon. Parametric adversarial divergences are good task losses for generative modeling. arXiv preprint arXiv:1708.02511, 2018.
308
+
309
+ Ioffe, Sergey and Szegedy, Christian. Batch normalization: Accelerating deep network training by reducing internal covariate shift. arXiv preprint arXiv:1502.03167, 2015.
310
+
311
+ Jang, Eric, Gu, Shixiang, and Poole, Ben. Categorical reparameterization with gumbel-softmax. arXiv preprint arXiv:1611.01144, 2016.
312
+
313
+ Jie, Tang and Abbeel, Pieter. On a connection between importance sampling and the likelihood ratio policy gradient. In Advances in Neural Information Processing Systems, pp. 1000–1008, 2010.
314
+
315
+ Kim, Yoon, Zhang, Kelly, Rush, Alexander M, LeCun, Yann, et al. Adversarially regularized autoencoders for generating discrete structures. arXiv preprint arXiv:1706.04223, 2017.
316
+
317
+ Krizhevsky, Alex and Hinton, Geoffrey. Learning multiple layers of features from tiny images. Citeseer, 2009.
318
+
319
+ Krizhevsky, Alex, Sutskever, Ilya, and Hinton, Geoffrey E. Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems, pp. 1097–1105, 2012.
320
+
321
+ Lamb, Alex M, GOYAL, Anirudh Goyal ALIAS PARTH, Zhang, Ying, Zhang, Saizheng, Courville, Aaron C, and Bengio, Yoshua. Professor forcing: A new algorithm for training recurrent networks. In Advances In Neural Information Processing Systems, pp. 4601–4609, 2016.
322
+
323
+ Li, Jiwei, Monroe, Will, Shi, Tianlin, Ritter, Alan, and Jurafsky, Dan. Adversarial learning for neural dialogue generation. arXiv preprint arXiv:1701.06547, 2017.
324
+
325
+ Liu, Ziwei, Luo, Ping, Wang, Xiaogang, and Tang, Xiaoou. Deep learning face attributes in the wild. In Proceedings of the IEEE International Conference on Computer Vision, pp. 3730–3738, 2015.
326
+
327
+ Maddison, Chris J, Mnih, Andriy, and Teh, Yee Whye. The concrete distribution: A continuous relaxation of discrete random variables. arXiv preprint arXiv:1611.00712, 2016.
328
+
329
+ Mao, Xudong, Li, Qing, Xie, Haoran, Lau, Raymond YK, Wang, Zhen, and Smolley, Stephen Paul. Least squares generative adversarial networks. arXiv preprint ArXiv:1611.04076, 2016.
330
+
331
+ Mikolov, Toma´s.ˇ Statistical Language Models Based on Neural Networks. PhD thesis, Ph. D. thesis, Brno University of Technology, 2012.
332
+
333
+ Mnih, Andriy and Gregor, Karol. Neural variational inference and learning in belief networks. In Proceedings of the 31st International Conference on Machine Learning (ICML-14), pp. 1791– 1799, 2014.
334
+
335
+ Mohamed, Shakir and Lakshminarayanan, Balaji. Learning in implicit generative models. arXiv preprint arXiv:1610.03483, 2016.
336
+
337
+ Mroueh, Youssef and Sercu, Tom. Fisher gan. arXiv preprint arXiv:1705.09675, 2017.
338
+
339
+ Mroueh, Youssef, Sercu, Tom, and Goel, Vaibhava. Mcgan: Mean and covariance feature matching gan. arXiv preprint arXiv:1702.08398, 2017.
340
+
341
+ Nguyen, XuanLong, Wainwright, Martin J, and Jordan, Michael I. Estimating divergence functionals and the likelihood ratio by convex risk minimization. IEEE Transactions on Information Theory, 56(11):5847–5861, 2010.
342
+
343
+ Nowozin, Sebastian, Cseke, Botond, and Tomioka, Ryota. f-gan: Training generative neural samplers using variational divergence minimization. In Advances in Neural Information Processing Systems, pp. 271–279, 2016.
344
+
345
+ Radford, Alec, Metz, Luke, and Chintala, Soumith. Unsupervised representation learning with deep convolutional generative adversarial networks. arXiv preprint arXiv:1511.06434, 2015.
346
+
347
+ Roth, Kevin, Lucchi, Aurelien, Nowozin, Sebastian, and Hofmann, Thomas. Stabilizing training of generative adversarial networks through regularization. arXiv preprint arXiv:1705.09367, 2017.
348
+
349
+ Rubinstein, Reuven Y and Kroese, Dirk P. Simulation and the Monte Carlo method, volume 10. John Wiley & Sons, 2016.
350
+
351
+ Salakhutdinov, Ruslan and Murray, Iain. On the quantitative analysis of deep belief networks. In Proceedings of the 25th international conference on Machine learning, pp. 872–879. ACM, 2008.
352
+
353
+ Salimans, Tim, Goodfellow, Ian, Zaremba, Wojciech, Cheung, Vicki, Radford, Alec, and Chen, Xi. Improved techniques for training gans. In Advances in Neural Information Processing Systems, pp. 2234–2242, 2016.
354
+
355
+ Sriperumbudur, Bharath K, Fukumizu, Kenji, Gretton, Arthur, Scholkopf, Bernhard, and Lanck- ¨ riet, Gert RG. On integral probability metrics,\phi-divergences and binary classification. arXiv preprint arXiv:0901.2698, 2009.
356
+
357
+ Sutherland, Dougal J, Tung, Hsiao-Yu, Strathmann, Heiko, De, Soumyajit, Ramdas, Aaditya, Smola, Alex, and Gretton, Arthur. Generative models and model criticism via optimized maximum mean discrepancy. arXiv preprint arXiv:1611.04488, 2016.
358
+
359
+ Sutskever, Ilya, Martens, James, and Hinton, Geoffrey E. Generating text with recurrent neural networks. In Proceedings of the 28th International Conference on Machine Learning (ICML-11), pp. 1017–1024, 2011.
360
+
361
+ Tran, Dustin, Ranganath, Rajesh, and Blei, David M. Deep and hierarchical implicit models. arXiv preprint arXiv:1702.08896, 2017.
362
+
363
+ Tucker, George, Mnih, Andriy, Maddison, Chris J, and Sohl-Dickstein, Jascha. Rebar: Lowvariance, unbiased gradient estimates for discrete latent variable models. arXiv preprint arXiv:1703.07370, 2017.
364
+
365
+ Van Merrienboer, Bart, Bahdanau, Dzmitry, Dumoulin, Vincent, Serdyuk, Dmitriy, Warde-Farley, ¨ David, Chorowski, Jan, and Bengio, Yoshua. Blocks and fuel: Frameworks for deep learning. arXiv preprint arXiv:1506.00619, 2015.
366
+
367
+ Yu, Fisher, Zhang, Yinda, Song, Shuran, Seff, Ari, and Xiao, Jianxiong. Lsun: Construction of a large-scale image dataset using deep learning with humans in the loop. arXiv preprint arXiv:1506.03365, 2015.
368
+
369
+ Yu, Lantao, Zhang, Weinan, Wang, Jun, and Yu, Yong. Seqgan: sequence generative adversarial nets with policy gradient. arXiv preprint arXiv:1609.05473, 2016.
370
+
371
+ # 7 APPENDIX
372
+
373
+ # 7.1 COMPARISON OF DISCRETE METHODS
374
+
375
+ In these experiments, we produce some quantitative measures for BGAN against WGAN with the gradient penalty (WGAN-GP, Gulrajani et al., 2017) on the discrete MNIST dataset. In order to use back-propagation to train the generator, WGAN-GP uses the softmax probabilities directly, bypassing the sampling process at pixel-level and problems associated with estimating gradients through discrete processes. Despite this, WGAN-GP is been able to produce samples that visually resemble the target dataset.
376
+
377
+ Here, we train 3 models on the discrete MNIST dataset using identical architectures with the BGAN with the JS and reverse KL $f$ -divergences and WGAN-GP objectives. Each model was trained for 300 generator epochs, with the discriminator being updated 5 times per generator update for WGAN-GP and 1 time per generator update for the BGAN models (in other words, the generators were trained for the same number of updates). This model selection procedure was chosen as the difference measure (i.e., JSD, reverse KL divergence, and Wasserstein distance) as estimated during training converged for each model. WGAN-GP was trained with a gradient penalty hyper-parameter of 5.0, which did not differ from the suggested 10.0 in our experiments with discrete MNIST. The BGAN models were trained with the gradient norm penalty of 5.0 (Roth et al., 2017).
378
+
379
+ Next, for each model, we trained 3 new discriminators with double capacity (twice as many hidden units on each layer) to maximize the the JS and reverse KL divergences and Wasserstein distance, keeping the generators fixed. These discriminators were trained for 200 epochs (chosen from convergence) with the same gradient-based regularizations as above. For all of these models, the discriminators were trained using the samples, as they would be used in practical applications. For comparison, we also trained an additional discriminator, evaluating the WGAN-GP model above on the Wasserstein distance using the softmax probabilities.
380
+
381
+ Table 4: Estimated Jensen-Shannon and KL-divergences and Wasserstein distance by a discriminator trained to maximize the respective lowerbound (lower is better). Numbers are estimates averaged ovwe 12 batches of 5000 samples with standard devations provided in parentheses. All discriminators were trained using samples drawn from the softmax probabilities, with exception to an additional discriminator used to evaluate WGAN-GP where the softmax probabilities were used directly. In general, BGAN out-performs WGAN-GP even when comparing the Wasserstein distances.
382
+
383
+ <table><tr><td rowspan=1 colspan=1>Train Measure</td><td rowspan=1 colspan=3>Eval Measure (lower is better)</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>JS</td><td rowspan=1 colspan=1>reverse KL</td><td rowspan=1 colspan=1>Wasserstein</td></tr><tr><td rowspan=1 colspan=1>BGAN - JSBGAN - reverse KLWGAN-GP (samples)WGAN-GP (softmax)</td><td rowspan=1 colspan=1>0.37 (±0.02)0.44 (±0.02)0.45 (±0.03)1</td><td rowspan=1 colspan=1>0.16 (±0.01)0.44 (±0.03)1.32 (±0.06)1</td><td rowspan=1 colspan=1>0.40(±0.03)0.45 (±0.04)0.87 (±0.18)0.54 (±0.12)</td></tr></table>
384
+
385
+ Final evaluation was done by estimating difference measures using 60000 MNIST training examples againt 60000 samples from each generator, averaged over 12 batches of 5000. We used the training set as this is the distribution over which the discriminators were trained. Test set estimates in general were close and did not diverge from training set distances, indicating the discriminators were not overfitting, but training set estimates were slightly higher on average.
386
+
387
+ Our results show that the estimates from the sampling distribution from BGAN is consistently lower than that from WGAN-GP, even when evaluating using the Wasserstein distance. However, when training the discriminator on the softmax probabilities, WGAN-GP has a much lower Wasserstein distance. Despite quantitative differences, samples from these different models were indistinguishable as far as quality by visual inspection. This indicates that, though playing the adversarial game using the softmax outputs can generate realistic-looking samples, this procedure ultimately hurts the generator’s ability to model a truly discrete distribution.
388
+
389
+ Here we validate the policy gradient provided in Equation 10 theoretically and empirically. Theorem 2. Let the expectation of the conditional $K L$ -divergence be defined as in Equation 9. Then $\mathbb { E } _ { h ( z ) } [ \mathcal { D } _ { K L } \left( \tilde { p } ( x \mid z ) \lVert \dot { g } _ { \theta } ( x \mid z ) \right) ] \stackrel { \cdot } { = } 0 \implies \mathcal { D } _ { K L } ( \tilde { p } ( x ) | | q _ { \theta } ) \stackrel { \cdot } { = } 0 .$ .
390
+
391
+ Proof. As the conditional KL-divergence is has an absolute minimum at zero, the expectation can only be zero when the all of the conditional KL-divergences are zero. In other words:
392
+
393
+ $$
394
+ \mathbb { E } _ { h ( z ) } [ \mathcal { D } _ { K L } \left( \tilde { p } ( x \mid z ) \lVert g _ { \theta } ( x \mid z ) \right) ] = 0 \implies \tilde { p } ( x \mid z ) = g _ { \theta } ( x \mid z ) .
395
+ $$
396
+
397
+ As per the definition of $\tilde { p } ( x \mid z )$ , this implies that $\alpha ( z ) = w ( x ) = C$ is a constant. If $w ( x )$ is a constant, then the partition function $\beta = C \mathbb { E } _ { \mathbb { Q } _ { \theta } } [ 1 ] = C$ is a constant. Finally, when $\begin{array} { r } { { \frac { w ( x ) } { \beta } } = 1 } \end{array}$ , $\tilde { p } ( x ) = q _ { \theta } \implies \mathcal { D } _ { K L } \big ( \tilde { p } ( x ) | | q _ { \theta } \big ) = 0 .$ □
398
+
399
+ In order to empirically evaluate the effect of using an Monte-Carlo estimate of $\beta$ from Equation 8 versus the variance-reducing method in Equation 10, we trained several models using various sample sizes from the prior, $h ( z )$ , and the conditional, $g _ { \boldsymbol { \theta } } ( x \mid z )$ .
400
+
401
+ We compare both methods with 64 samples from the prior and 5, 10, and 100 samples from the conditional. In addition, we compare to a model that estimates $\beta$ using 640 samples from the prior and a single sample from the conditional. These models were all run on discrete MNIST for 50 epochs with the same architecture as those from Section 4.2 with a gradient penalty of 1.0, which was the minimum needed to ensure stability in nearly all the models.
402
+
403
+ Our results (Figure 6) show a clear improvement using the variance-reducing method from Equation 10 over estimating $\beta$ . Wall-clock times were nearly identical for methods using the same number of total samples (blue, green, and red dashed and solid line pairs). Both methods improve as the number of conditional samples is increased.
404
+
405
+ ![](images/8b1e6748e8ec11c8ef8fb4d2e6189162cd0e71eb7ed648a306c5b78ee3a9963a.jpg)
406
+ Figure 6: Comparison of the variance-reducing method from Equation 10 and estimating $\beta$ using Monte-Carlo in Equation 8. $\alpha$ indicates the variance-reducing method, and $\beta$ is estimating $\beta$ using Monte-Carlo. $z =$ indicates the number of samples from the prior, $h ( z )$ , and $x =$ indicates the number of samples from the conditional, $g _ { \boldsymbol { \theta } } ( \boldsymbol { x } \mid z )$ used in estimation. Plotted are the estimated GAN distances $\left( 2 * \mathrm { J S D - \log 4 } \right)$ from the discriminator. The minimum GAN distance, $- \log 4$ , is included for reference. Using the variance-reducing method gives a generator with consistently lower estimated distances than estimating $\beta$ directly.
md/train/rkg98yBFDr/rkg98yBFDr.md ADDED
@@ -0,0 +1,333 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # REJECT ILLEGAL INPUTS: SCALING GENERATIVE CLASSIFIERS WITH SUPERVISED DEEP INFOMAX
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Deep Infomax (DIM) is an unsupervised representation learning framework by maximizing the mutual information between the inputs and the outputs of an encoder, while probabilistic constraints are imposed on the outputs. In this paper, we propose Supervised Deep InfoMax (SDIM), which introduces supervised probabilistic constraints to the encoder outputs. The supervised probabilistic constraints are equivalent to a generative classifier on high-level data representations, where class conditional log-likelihoods of samples can be evaluated. Unlike other works building generative classifiers with conditional generative models, SDIMs scale on complex datasets, and can achieve comparable performance with discriminative counterparts. With SDIM, we could perform classification with rejection. Instead of always reporting a class label, SDIM only makes predictions when test samples’ largest logits surpass some pre-chosen thresholds, otherwise they will be deemed as out of the data distributions, and be rejected. Our experiments show that SDIM with rejection policy can effectively reject illegal inputs including outof-distribution samples and adversarial examples.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Non-robustness of neural network models emerges as a pressing concern since they are observed to be vulnerable to adversarial examples (Szegedy et al., 2013; Goodfellow et al., 2014). Many attack methods have been developed to find imperceptible perturbations to fool the target classifiers (Moosavi-Dezfooli et al., 2016; Carlini & Wagner, 2017; Brendel et al., 2017). Meanwhile, many defense schemes have also been proposed to improve the robustnesses of the target models (Goodfellow et al., 2014; Tramer et al., 2017; Madry et al., 2017; Samangouei et al., 2018). \`
12
+
13
+ An important fact about these works is that they focus on discriminative classifiers, which directly model the conditional probabilities of labels given samples. Another promising direction, which is almost neglected so far, is to explore robustness of generative classifiers (Ng & Jordan, 2002). A generative classifier explicitly model conditional distributions of inputs given the class labels. During inference, it evaluates all the class conditional likelihoods of the test input, and outputs the class label corresponding to the maximum. Conditional generative models are powerful and natural choices to model the class conditional distributions, but they suffer from two big problems: (1) it is hard to scale generative classifiers on high-dimensional tasks, like natural images classification, with comparable performance to the discriminative counterparts. Though generative classifiers have shown promising results of adversarial robustness, they hardly achieve acceptable classification performance even on CIFAR10 (Li et al., 2018; Schott et al., 2018; Fetaya et al., 2019). (2) The behaviors of likelihood-based generative models can be counter-intuitive and brittle. They may assign surprisingly higher likelihoods to out-of-distribution (OoD) samples (Nalisnick et al., 2018; Choi & Jang, 2018). Fetaya et al. (2019) discuss the issues of likelihood as a metric for density modeling, which may be the reason of non-robust classification, e.g. OoD samples detection.
14
+
15
+ In this paper, we propose supervised deep infomax (SDIM) by introducing supervised statistical constraints into deep infomax (DIM, Hjelm et al. (2018)), an unsupervised learning framework by maximizing the mutual information between representations and data. SDIM is trained by optimizing two objectives: (1) maximizing the mutual information (MI) between the inputs and the high-level data representations from encoder; (2) ensuring that the representations satisfy the supervised statistical constraints. The supervised statistical constraints can be interpreted as a generative classifier on high-level data representations giving up the full generative process. Unlike full generative models making implicit manifold assumptions, the supervised statistical constraints of SDIM serve as explicit enforcement of manifold assumption: data representations (low-dimensional) are trained to form clusters corresponding to their class labels. With SDIM, we could perform classification with rejection (Nalisnick et al., 2019; Geifman & El-Yaniv, 2017). SDIMs reject illegal inputs based on off-manifold conjecture (Samangouei et al., 2018; Gu & Rigazio, 2014), where illegal inputs, e.g. adversarial examples, lie far away from the data manifold. Samples whose class conditionals are smaller than the pre-chosen thresholds will be deemed as off-manifold, and prediction requests on them will be rejected. The contributions of this paper are :
16
+
17
+ • We propose Supervised Deep Infomax (SDIM), an end-to-end framework whose probabilistic constraints are equivalent to a generative classifier. SDIMs can achieve comparable classification performance with similar discrinimative counterparts at the cost of small over-parameterization. We propose a simple but novel rejection policy based on off-manifold conjecture: SDIM outputs a class label only if the test sample’s largest class conditional surpasses the prechosen class threshold, otherwise outputs rejection. The choice of thresholds relies only on training set, and takes no additional computations. Experiments show that SDIM with rejection policy can effectively reject illegal inputs, including OoD samples and adversarial examples generated by a comprehensive group of adversarial attacks.
18
+
19
+ # 2 BACKGROUND: DEEP INFOMAX
20
+
21
+ Deep InfoMax (DIM, Hjelm et al. (2018)) is an unsupervised representation learning framework by maximizing the mutual information (MI) of the inputs and outputs of an encoder. The computation of MI takes only input-output pairs with the deep neural networks based esimator MINE (Belghazi et al., 2018).
22
+
23
+ Let $E _ { \phi }$ be an encoder parameterized by $\phi$ , working on the training set $\mathcal { X } = \{ x _ { i } \} _ { i = 1 } ^ { N }$ , and generating output set $\mathcal { V } = \{ E ( x _ { i } ) \} _ { i = 1 } ^ { N }$ . DIM is trained to find the set of parameters $\phi$ such that: (1) the mutual information ${ \mathcal { T } } ( X , Y )$ is maximized over sample sets $\mathcal { X }$ and $\mathcal { V }$ . (2) the representations, depending on the potential downstream tasks, match some prior distribution. Denote $\mathbb { J }$ and $\mathbb { M }$ the joint and product of marginals of random variables $X$ , $Y$ respectively. MINE estimates a lower-bound of MI with Donsker-Varadhan (Donsker & Varadhan, 1983) representation of KL-divergence:
24
+
25
+ $$
26
+ \mathcal { Z } ( X , Y ) = D _ { K L } ( \mathbb { J } | | \mathbb { M } ) \geq \mathbb { E } _ { \mathbb { J } } [ T _ { \omega } ( x , y ) ] - \log \mathbb { E } _ { \mathbb { M } } [ e ^ { T _ { \omega } ( x , y ) } ]
27
+ $$
28
+
29
+ where $T _ { \omega } ( x , y ) \in \mathbb { R }$ is a family of functions with parameters $\omega$ represented by a neural network. Since in representation learning we are more interested in maximizing MI, than its exact value, nonKL divergences are also favorable candidates. We can get a family of variational lower-bounds using $f$ -divergence representations (Nguyen et al., 2010):
30
+
31
+ $$
32
+ \mathbb { Z } _ { f } ( X , Y ) \ge \mathbb { E } _ { \mathbb { J } } [ T _ { \omega } ( x , y ) ] - \mathbb { E } _ { \mathbb { M } } [ f ^ { * } \left( T _ { \omega } ( x , y ) \right) ]
33
+ $$
34
+
35
+ where $f ^ { * }$ is the Fenchel conjugate of a specific divergence $f$ . For KL-divergence, $f ^ { * } ( t ) = e ^ { ( t - 1 ) }$ . A full $f ^ { * }$ list is provided in Tab. 6 of Nowozin et al. (2016). Noise-Contrastive Estimation (Gutmann & Hyvarinen, 2010) can also be used as lower-bound of MI in “infoNCE” (Oord et al., 2018) . ¨
36
+
37
+ # 3 SUPERVISED DEEP INFOMAX
38
+
39
+ All the components of SDIM framework are summurized in Fig. 1. The focus of Supervised Deep InfoMax (SDIM) is on introducing supervision to probabilistic constraints of DIM for (generative) classification. We choose to maximize the local MI, which has shown to be more effective in classification tasks than maximizing global MI (Hjelm et al., 2018). Equivalently, we minimize $\mathcal { I } _ { \mathrm { M I } }$ :
40
+
41
+ $$
42
+ \mathcal { T } _ { \mathrm { M I } } = - \frac { 1 } { M ^ { 2 } } \sum _ { i = 1 } ^ { M ^ { 2 } } \tilde { \mathcal { T } } ( L _ { \phi } ^ { ( i ) } ( \pmb { x } ) , E _ { \phi } ( \pmb { x } ) )
43
+ $$
44
+
45
+ where $L _ { \phi } ( { \pmb x } )$ is a local $M \times M$ feature map of $_ { x }$ extracted from some intermediate layer of encoder $E$ , and $\tilde { \mathcal { T } }$ can be any possible MI lower-bounds.
46
+
47
+ ![](images/4057617de4c52d01f42003f6e7da7d01924abf89f79d7ff02acce1cb109853f9.jpg)
48
+ Figure 1: Components of SDIM framework. (1)The encoder $E _ { \phi }$ takes input $_ { \textbf { \em x } }$ , and produces pairs of local feature maps $L _ { \phi } ( \pmb { x } )$ and global representations $E _ { \phi } ( \pmb { x } )$ . (2) The MI evaluation network $T _ { \omega }$ maps every possible positive pairs and negative pairs to MI scores specified by corresponding MI lower-bound. Negative pairs are simply obtained by combine all unpaired local feature maps and global representations within the same mini-batch. (3) Supervised constraints are imposed on the global representations $\tilde { \pmb { x } } = E _ { \phi } ( \pmb { x } )$ with loss $\mathcal { T } _ { \mathrm { N L L } } + \mathcal { T } _ { \mathrm { L M } }$ for generative classification. The true class conditionals are maximized, while false class conditionals are minimized. See following parts of this section for details.
49
+
50
+ # 3.1 EXPLICIT ENFORCEMENT OF MANIFOLD ASSUMPTION
51
+
52
+ By adopting a generative approach $p ( \pmb { x } , y ) = p ( y ) p ( \pmb { x } | y )$ , we assume that the data follows the manifold assumption: the (high-dimensional) data lies on low-dimensional manifolds corresponding to their class labels. Denote $\tilde { \pmb x }$ the compact representation generated with encoder $E _ { \phi } ( \pmb { x } )$ . In order to explicitly enforce the manifold assumption , we admit the existence of data manifold in the representation space. Assume that $y$ is a discrete random variable representing class labels, and $p ( \tilde { \mathbfit { x } } | \boldsymbol { y } )$ is the real class conditional distribution of the data manifold given $y$ . Let $p _ { \theta } ( \tilde { \pmb x } | y )$ be the class conditionals we model parameterized with $\theta$ . We approximate $p ( \tilde { \mathbfit { x } } | \boldsymbol { y } )$ by minimizing the KL-divergence between $p ( \tilde { \mathbfit { x } } | \boldsymbol { y } )$ and our model $p _ { \theta } ( \tilde { \pmb x } | y )$ , which is given by:
53
+
54
+ $$
55
+ \begin{array} { r l } & { D _ { K L } \big ( p ( \tilde { x } | y ) | | p _ { \theta } ( \tilde { x } | y ) \big ) = \mathbb { E } _ { \tilde { x } , y \sim p ( \tilde { x } , y ) } [ \log p ( \tilde { x } | y ) - \log p _ { \theta } ( \tilde { x } | y ) ] } \\ & { \qquad = \mathbb { E } _ { \tilde { x } , y \sim p ( \tilde { x } , y ) } [ \log p ( \tilde { x } | y ) ] - \mathbb { E } _ { \tilde { x } , y \sim p ( \tilde { x } , y ) } [ \log p _ { \theta } ( \tilde { x } | y ) ] } \end{array}
56
+ $$
57
+
58
+ where the first item on RHS is a constant independent of the model parameters $\theta$ . Eq. 4 equals to maximize the expectation $\mathbb { E } _ { \tilde { \mathbf { x } } , y \sim p ( \tilde { \mathbf { x } } , y ) } [ \log p _ { \theta } ( \tilde { \mathbf { x } } | y ) ]$ .
59
+
60
+ In practice, we minimize the following loss $\mathcal { T } _ { \mathrm { N L L } }$ , equivalent to empicically maximize the above expectation over $\{ \tilde { \pmb { x } } _ { i } = E _ { \phi } ( \pmb { x } _ { i } ) , y _ { i } \} _ { i = 1 } ^ { N }$ :
61
+
62
+ $$
63
+ \mathcal { T } _ { \mathrm { N L L } } = - \mathbb { E } _ { \tilde { \mathbf { x } } , y \sim p ( \tilde { \mathbf { x } } , y ) } [ \log p _ { \theta } ( \tilde { \mathbf { x } } | y ) ] \approx - \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \log p _ { \theta } ( \tilde { \mathbf { x } } _ { i } | y _ { i } )
64
+ $$
65
+
66
+ Besides the introduction of supervision, SDIM differs from DIM in its way of enforcing the statistical constraints: DIM use adversarial learning (Makhzani et al., 2015) to push the representations to the desired priors, while SDIM directly maximizes the parameterized class conditional probability.
67
+
68
+ Maximize Likelihood Margins Since a generative classifier, at inference, decides which class a test input $_ { \textbf { \em x } }$ belongs to according to its class conditional probability. On one hand, we maximize samples’ true class conditional probabilities (classes they belong to) using $\mathcal { T } _ { \mathrm { N L L } }$ ; On the other hand, we also hope that samples’ false class conditional probabilities (classes they do not belong to) can be minimized. This is assured by the following likelihood margin loss $\mathcal { I } _ { \mathrm { L M } }$ :
69
+
70
+ $$
71
+ \mathcal { I } _ { \mathrm { L M } } = \frac { 1 } { N } \cdot \frac { 1 } { C - 1 } \sum _ { i = 1 } ^ { N } \sum _ { c = 1 , c \neq y _ { i } } ^ { C } \operatorname* { m a x } ( \log p ( \tilde { \mathbf { x } } _ { i } | y = c ) + K - \log p ( \tilde { \mathbf { x } } _ { i } | y = y _ { i } ) , 0 ) ^ { 2 }
72
+ $$
73
+
74
+ where $K$ is a positive constant to control the margin. For each encoder output $\tilde { \mathbf { x } } _ { i }$ , the $C - 1$ truefalse class conditional gaps are squared1, which quadratically increases the penalties when the gap becomes large, then are averaged.
75
+
76
+ Putting all these together, the complete loss function we minimize is:
77
+
78
+ $$
79
+ \mathcal { T } _ { \mathrm { S D I M } } = \alpha \cdot \mathcal { T } _ { \mathrm { M I } } + \beta \cdot \mathcal { T } _ { \mathrm { N L L } } + \gamma \cdot \mathcal { T } _ { \mathrm { L M } }
80
+ $$
81
+
82
+ Parameterization of Class Conditional Probability Each of the class conditional distribution is represented as an isotropic Gaussian. So the generative classifier is simply a embedding layer with $C$ entries, and each entry contains the trainable mean and variance of a Gaussian. This minimized parameterization encourages the encoder to learn simple and stable low-dimensional representations that can be easily explained by even unimodal distributions. Considering that we maximize the true class conditional probability, and minimize the false class conditional probability at the same time, we do not choose conditional normalizing flows, since the parameters are shared across class labels, and the training can be very difficult. In Schott et al. (2018), each class conditional probability is represented with a VAE, thus scaling to complex datasets with huge number of classes, e.g. ImageNet, is almost impossible.
83
+
84
+ # 3.2 DECISION FUNCTION WITH REJECTION
85
+
86
+ A generative approach models the class-conditional distributions $p ( { \pmb x } | { \pmb y } )$ , as well as the class priors $p ( y )$ . For classification, we compute the posterior probabilities $p ( y | \mathbf { \boldsymbol { x } } )$ through Bayes’ rule:
87
+
88
+ $$
89
+ p ( y | \pmb { x } ) = \frac { p ( \pmb { x } | y ) p ( y ) } { p ( \pmb { x } ) } \propto p ( \pmb { x } | y ) p ( y )
90
+ $$
91
+
92
+ The prior $p ( y )$ can be computed from the training set, or we simply use uniform class prior for all class labels by default. Then the prediction of test sample $\mathbf { \boldsymbol { x } } ^ { * }$ from posteriors is:
93
+
94
+ $$
95
+ y ^ { * } = \underset { c = [ 1 \ldots C ] } { \arg \operatorname* { m a x } } \log p ( \pmb { x } ^ { * } | y = c ) .
96
+ $$
97
+
98
+ The drawback of the above decision function is that it always gives a prediction even for illegal inputs. Instead of simply outputting the class label that maximizes class conditional probability of $\pmb { x } ^ { * }$ , we set a threshold for each class conditional probability, and define our decision function with rejection to be:
99
+
100
+ $$
101
+ \left\{ \begin{array} { l l } { y ^ { * } , } & { \mathrm { i f } \log p ( \pmb { x } ^ { * } | y ^ { * } ) \geq \delta _ { y ^ { * } } } \\ { R e j e c t i o n , } & { \mathrm { o t h e r w i s e } } \end{array} \right.
102
+ $$
103
+
104
+ The model gives a rejection when $\log p ( \boldsymbol { x } ^ { * } | \boldsymbol { y } ^ { * } )$ is smaller than the threshold $\delta _ { y ^ { * } }$ . Note that here we can use $p ( x ^ { * } | y ^ { * } )$ and $p ( \tilde { \boldsymbol { x } } ^ { * } | \boldsymbol { y } ^ { * } )$ interchangeably. This is also known as selective classification (Geifman & El-Yaniv, 2017) or classification with reject option (Nalisnick et al., 2019)(See Supp. A)
105
+
106
+ # 4 RELATED WORKS
107
+
108
+ Robustness of Likelihood-based Generative Models Though likelihood-based generative models have achieved great success in samples synthesis, the behaviors of their likelihoods can be counter-intuitive. Flow-based models (Kingma & Dhariwal, 2018) and as well as VAEs (Kingma & Welling, 2013), surprisingly assign even higher likelihoods to out-of-distribution samples than the samples in the training set (Nalisnick et al., 2018; Choi & Jang, 2018). Pixel-level statistical analyses in Nalisnick et al. (2018) show that OoD dataset may “sit inside of” the in-distribution dataset (i.e. with roughly the same mean but smaller variance).
109
+
110
+ Off-Manifold Conjecture Grosse et al. (2017) observe that adversarial examples are outside the training distribution via statistical testing.
111
+
112
+ DefenseGAN (Samangouei et al., 2018) models real data distribution with the generator $G$ of GAN. At inference, instead of feeding the test input $_ { \textbf { \em x } }$ to the target classifier directly, it searches for the “closest” sample $G ( z ^ { \ast } )$ from generator distribution to $_ { \textbf { \em x } }$ as the final input to the classifier. It ensures that the classifier only make predictions on the data manifold represented by the generator, ruling out the potential adversarial perturbations in $_ { \textbf { \em x } }$ . PixelDefend (Song et al., 2017) takes a similar approach which uses likelihood-based generative model - PixelCNN to model the data distribution.
113
+
114
+ Both DefenseGAN and PixelDefend are additionally trained as peripheral defense schemes agnostic to the target classifiers. Training generative models on complex datasets notoriously takes huge amount of computational resources (Brock et al., 2018). In contrast, the training of SDIM is computationally similar to its discriminative counterpart. The verification of whether inputs are offmanifold is a built-in property of the SDIM generative classifier. The class conditionals of SDIM are modeled on low-dimensional data representations with simple Gaussians, which is much easier, and incurs very small computations.
115
+
116
+ # 5 EXPERIMENTS
117
+
118
+ Datasets We evaluate the effectiveness of the rejection policy of SDIM on four image datasets: MNIST, FashionMNIST (both resized to $3 2 \times 3 2$ from $2 8 \times 2 8$ ); and CIFAR10, SVHN. See App. B.1 for details of data processing. For out-of-distribution samples detection, we use the dataset pairs on which likelihood-based generative models fail (Nalisnick et al., 2018; Choi & Jang, 2018): FashionMNIST (in)-MNIST (out) and CIFAR10 (in)-SVHN (out). Adversarial examples detection are evaluated on MNIST and CIFAR10.
119
+
120
+ Choice of thresholds It is natural that choosing thresholds based on what the model knows, i.e. training set, and can reject what the model does not know, i.e. possible illegal inputs. We set one threshold for each class conditional. For each class conditional probability, we choose to evaluate on two different thresholds: 1st and $2 n d$ percentiles of class conditional log-likelihoods of the correctly classified training samples. Compared to the detection methods proposed in Li et al. (2018), our choice of thresholds is much simpler, and takes no additional computations.
121
+
122
+ Models A typical SDIM instance consists of three networks: an encoder, parameterized by $\phi$ , which outputs a $d$ -dimensional representation; mutual information evaluation networks, i.e. $T _ { \omega }$ in Eqn. (1) and Eqn. (2); and $C$ -way class conditional embedding layer, parameterized by $\theta$ , with each entry a $2 d$ -dimensional vector. We set $d = 6 4$ in all our experiments.
123
+
124
+ For encoder of SDIM, we use ResNet (He et al., 2016) on $3 2 \times 3 2$ with a stack of $8 n + 2$ layers, and 4 filter sizes $\{ 3 2 , 6 4 , 1 2 8 , 2 5 6 \}$ . The architecture is summarized as:
125
+
126
+ <table><tr><td> output map size</td><td>32×32</td><td>16 ×16</td><td>8×8</td><td>4×4</td></tr><tr><td>#layers</td><td>1+2n</td><td>2n</td><td>2n</td><td>2n</td></tr><tr><td># filters</td><td>32</td><td>64</td><td>128</td><td>256</td></tr></table>
127
+
128
+ The last layer of encoder is a $d$ -way fully-connected layer. To construct a discriminative counterpart, we simply set the output size of the encoder’s last layer to $C$ for classification. We use ResNet10 $\overset { \cdot } { n } = 1$ ) on MNIST, FashionMNIST, and ResNet26 $\ R = 3$ ) on CIFAR10, SVHN.
129
+
130
+ # 5.1 EVALUATION ON CLEAN DATA
131
+
132
+ We report the classification accuracies (see Tab. 1) of SDIMs and the discriminative counterparts on clean test sets . Results show that SDIMs achieve the same level of accuracy as the discriminative counterparts with slightly increased number of parameters ( $1 7 \%$ increase for ResNet10, and $5 \%$ increase for ResNet26). We are aware of the existence of better results reported on these datasets using more complex models (Huang et al., 2017; Han et al., 2017) or automatically designed architectures (Cai et al., 2018), but pushing the state-of-the-art is not the focus of this paper.
133
+
134
+ Table 1: Clean test accuracies of SDIMs and the discriminative counterparts.
135
+
136
+ <table><tr><td>Model</td><td># Parameters</td><td>MNIST</td><td>FashionMNIST</td><td>CIFAR10</td><td>SVHN</td></tr><tr><td>Disc. (ResNet10,n = 1)</td><td>1.25M</td><td>99.42%</td><td>94.25%</td><td>-</td><td>-</td></tr><tr><td>SDIM (ResNet10, n = 1)</td><td>1.46M (17% 个)</td><td>99.55%</td><td>94.58%</td><td>-</td><td>-</td></tr><tr><td>Disc. (ResNet26,(n = 3))</td><td>4.39M</td><td>-</td><td>1</td><td>92.35%</td><td>95.96%</td></tr><tr><td>SDIM (ResNet26,n = 3)</td><td>4.60M (5% ↑)</td><td>1</td><td>1</td><td>92.53%</td><td>95.74%</td></tr></table>
137
+
138
+ Is Fully Generative Model Necessary for Generative Classification? In the evaluations of Li et al. (2018) and Schott et al. (2018), both model class conditional probability with VAE (Kingma & Welling, 2013; Rezende et al., 2014), and achieve acceptable accuracies $\mathrm { \dot { ( > ~ 9 8 \% ) } }$ on MNIST. However, it is hard for fully conditional generative models to achieve satisfactory classification accuracies even on CIFAR10. On CIFAR10, methods in Li et al. (2018) achieve only $< 5 0 \%$ accuracy. They also point out that the classification accuracy of a conditional $\mathrm { P i x e l C N N + + }$ (Salimans et al., 2017) is only $7 2 . 4 \%$ . The test accuracy of ABS in (Schott et al., 2018) is only $5 4 \%$ . In contrast, SDIM could achieve almost the same performance with similar discriminative classifier by giving up the full generative process, and building generative classifier on high-level representations. Li et al. (2018) improves the accuracy to $9 2 \%$ by feeding the features learned by powerful discriminative classifier-VGG16 (Simonyan & Zisserman, 2014) to their generative classifiers, which also suggests that modeling likelihood on high-level representation (features) is more favorable for generative classification than pixel-level likelihood of fully generative classifiers. For classification tasks, discovering discriminative features is much more important than reconstructing the all the image pixels. Thus performing generative classification with full generative models may not be the right choice.
139
+
140
+ Decision with Rejection We also investigate the implications of the proposed decision function with rejection under different thresholds. The results in Tab. 2 show that choosing a higher percentile as threshold will reject more prediction requests. At the same time, the classification accuracies of SDIM on the left test sets become increasingly better. This demonstrate that out rejection policy tend to reject the ones on which SDIMs make wrong predictions.
141
+
142
+ <table><tr><td rowspan="2">Dataset</td><td rowspan="2">Original Acc.</td><td colspan="2">1st percentile</td><td colspan="2">2nd percentile</td></tr><tr><td>Acc.Left</td><td>Rej. Rate</td><td>Acc.Left</td><td>Rej. Rate</td></tr><tr><td>MNIST</td><td>99.55%</td><td>99.95%</td><td>3.02%</td><td>99.97%</td><td>4.00%</td></tr><tr><td>FashionMNIST</td><td>94.58%</td><td>96.45%</td><td>4.63%</td><td>96.94%</td><td>6.60%</td></tr><tr><td>CIFAR10</td><td>92.53%</td><td>96.18%</td><td>8.90%</td><td>96.60%</td><td>10.86%</td></tr><tr><td>SVHN</td><td>95.74%</td><td>97.43%</td><td>3.99%</td><td>98.00%</td><td>6.36%</td></tr></table>
143
+
144
+ Table 2: Classification performances of SDIMs using the proposed decision function with rejection.
145
+ We report the rejection rates of the test sets and the accuracies on the left test sets for each threshold.
146
+
147
+ # 5.2 OUT-OF-DISTRIBUTION SAMPLES DETECTION
148
+
149
+ Class-wise OoD detections are performed, and mean detection rates over all in-distribution classes are reported in Tab. 3. For each in-distribution class $c$ , we evaluate the log-likelihoods of the whole OoD dataset. Samples whose log-likelihoods are lower the class threshold $\delta _ { c }$ will be detected as OoD samples. Same evaluations are applied on conditional Glows with 10th percentile thresholds, but the results are not good. The results are clear and confirm that SDIMs, generative classifiers on high-level representations, are more effective on classification tasks than fully conditional generative models on raw pixels. Note that fully generative models including VAE used in Li et al. (2018); Schott et al. (2018) fail on OoD detection. The stark difference between SDIM and full generative models (flows or VAEs) is that SDIM models samples’ likelihoods in the high-level representation spaces, while generative models evaluate directly on the raw pixels. See Supp. C for more results about the histograms of the class conditionals of in-out distributions.
150
+
151
+ Table 3: Mean detection rates of SDIMs and Glows with different thresholds on OoD detection.
152
+
153
+ <table><tr><td>Model</td><td>FashionMNIST(in)-MNIST(out)</td><td>CIFAR10(in)-SVHN(out)</td></tr><tr><td>SDIM(1st Per.)</td><td>99.36%</td><td>94.24 %</td></tr><tr><td>SDIM(2nd Per.)</td><td>99.64%</td><td>95.81%</td></tr><tr><td>Glow(10th Per.)</td><td>3.53%</td><td>0.02%</td></tr></table>
154
+
155
+ 5.3 ROBUSTNESS AGAINST ADVERSARIAL EXAMPLES AND DETECTION
156
+
157
+ We comprehensively evaluate the robustness of SDIMs against various attacks:
158
+
159
+ gradient-based attacks: one-step gradient attack FGSM (Goodfellow et al., 2014), its iterative variant projected gradient descent (PGD, Kurakin et al. (2016); Madry et al. (2017)), CW- $L _ { 2 }$ attack (Carlini & Wagner, 2017), deepfool (Moosavi-Dezfooli et al., 2016). • score-based attacks: local search attack (Narodytska & Kasiviswanathan, 2016). • decision-based attack: boundary attack (Brendel et al., 2017).
160
+
161
+ Attacks Using Cross-Entropy We find that SDIMs are much more robust to gradient-based attacks using cross-entropy, e.g. FGSM and PGD, since the gradients numerically vanish as a side effect of the likelihood margin loss $\mathcal { I } _ { \mathrm { L M } }$ of SDIM. This phenomenon is similar to some defences that try to hinder generations of adversarial examples by masking the gradients on inputs. While full generative classifiers in Li et al. (2018) still suffer from these attacks. See Supp. D.1 for detailed results.
162
+
163
+ Conservative Adversarial Examples Adversarial attacks aim to find the minimal perturbations that sufficiently change the classification labels, i.e. flip other logits to be the largest one. We show case examples on MNIST generated by untargeted attacks and their logits in Tab. 4 (See Supp. D.2 for examples of CIFAR10). Though these attacks successfully flip the logits, they are designed to be conservative to avoid more distortions to the original images. As a result, the largest logits of adversarial examples are still much lower than the thresholds, so they can be detected by our rejection policy. We find that our rejection policy performs perfectly on MNIST, but fails to detect all adversarial examples on CIFAR10 except for Boundary attack (See Tab. 5). It seems to be a well-known observation that models trained on CIFAR10 are more vulnerable than one trained on MNIST. Gilmer et al. (2018) connects this observation to the generalization of models. They found that many test samples, though correctly classified, are close to the misclassfied samples, which implies the existence of adversarial examples. If a model has higher error rate, it would take smaller perturbations to move correctly classified samples to misclassified areas.
164
+
165
+ <table><tr><td rowspan="2">Samples</td><td colspan="2">6</td><td colspan="2">回</td><td colspan="2">6</td><td colspan="2">6</td><td colspan="2"></td></tr><tr><td colspan="2">Original</td><td colspan="2">DeepFool</td><td colspan="2">CW-L2</td><td colspan="2">Boundary</td><td colspan="2">LocalSearch</td></tr><tr><td>1st Per. Original</td><td>477.6 482.5</td><td>465.2 -644.5</td><td>481.1 -440.8</td><td>477.7 -378.8</td><td>465.4 -1082.5</td><td>407.2 -409.8</td><td>474.5 -473.8</td><td>470.4 -850.0</td><td>472.3 -415.0</td><td>463.5 -699.2</td></tr><tr><td>DeepFool</td><td>243.4</td><td>-306.4</td><td>-172.4</td><td>-394.1</td><td>-538.3</td><td>-181.0</td><td>243.5</td><td>-944.2</td><td>-107.7</td><td>-524.1</td></tr><tr><td>CW-L2</td><td>175.9</td><td>-244.9</td><td>-486.4</td><td>-287.5</td><td>-500.8</td><td>-257.6</td><td>-409.5</td><td>-233.5</td><td>-174.3</td><td>176.5</td></tr><tr><td>Boundary</td><td>-58.5</td><td>11.5</td><td>205.7</td><td>-149.7</td><td>-415.1</td><td>-308.0</td><td>-356.3</td><td>205.8</td><td>-223.3</td><td>-250.3</td></tr><tr><td>LocalSearch</td><td>180.4</td><td>-225.3</td><td>-481.9</td><td>-281.3</td><td>-498.9</td><td>-223.2</td><td>-378.8</td><td>-257.9</td><td>-143.1</td><td>189.9</td></tr></table>
166
+
167
+ Table 4: Full logits of the adversarial examples generated with different attacks. The original image is the first sample of class 0 of MNIST test set. The first row gives the 1st percentile thresholds, and the second row shows the logits of the original image. The largest logits are marked in bold.
168
+
169
+ Adversarial examples with more confidence Based on the observations above, a natural question we should ask is: can we generate adversarial examples with not only successfully flipped logits,
170
+
171
+ <table><tr><td rowspan="2">Attacks</td><td colspan="2">MNIST</td><td colspan="2">CIFAR10</td></tr><tr><td>1st Per.</td><td>2nd Per.</td><td>1st Per.</td><td>2nd Per.</td></tr><tr><td>DeepFool</td><td>98.00%</td><td>98.60%</td><td>61.10%</td><td>64.30%</td></tr><tr><td>Boundary</td><td>100%</td><td>100%</td><td>100%</td><td>100%</td></tr><tr><td>LocalSearch</td><td>99.90%</td><td>100%</td><td>88.80%</td><td>93.10%</td></tr></table>
172
+
173
+ Table 5: Detection rates of our rejection policies. We perform untargeted adversarial evaluation on the first 1000 images of test sets. CW- $. L _ { 2 }$ is not involved here, but carefully investigated below.
174
+
175
+ but also the largest logit larger than some threshold value? Unlike the conservativeness on paying more distortions of other attacks, CW attack allows us to control the gap between largest and second largest logits with some confidence value $\kappa$ .
176
+
177
+ We perform targeted CW attacks with confidences $\kappa = \{ 0 , 5 0 0 , 1 0 0 0 \}$ (Tab. 6). We find that increasing the confidences help increasing the largest logits of adversarial examples to some extent, but may lead to failures of generation. The sensitivity to confidence values is also different given different targets. The success rates of generating adversarial examples monotonically decreases with the confidences increasing (Tab. 7). Note that on discriminative counterparts, $\mathrm { C W } { \cdot } L _ { 2 }$ with the same settings easily achieves $1 0 0 \%$ success rates. This means that explicitly forcing data representations to form clusters with maximum margins between them help increase average distances between normal samples and the nearest misclassified areas, thus increase the hardness of finding minimal adversarial perturbations . In this case, it takes a large enough adversarial perturbation to move a sample from its cluster to the other. Meanwhile, detection rates remain satisfactory on MNIST, but obviously decline on CIFAR10. For victim generative classifiers in (Li et al., 2018) under CW- $L _ { 2 }$ attack, the detection rates of adversarial examples using the proposed detection methods can be $> 9 5 \%$ on MNIST, but fall $< 5 0 \%$ on even CIFAR10-binary (their models don’t scale on CIFAR10, and CW- $L _ { 2 }$ with non-zero confidences are also not evaluated).
178
+
179
+ ![](images/3de047c92cb082ce505375e1c84b0bae71c627780c0550b81aa5d06f6b17785e.jpg)
180
+
181
+ Table 6: Adversarial examples generated with targeted CW with different confidences. The original image is the fist sample of class 0. The first row gives the 1st percentile thresholds. Below the images are the logits corresponding to the given targets. “-” denotes failure of generation.
182
+
183
+ <table><tr><td rowspan="2">Attacks</td><td colspan="3">MNIST</td><td colspan="3">CIFAR10</td></tr><tr><td>1st Per.</td><td>2nd Per.</td><td>success rate</td><td>1st Per.</td><td>2nd Per.</td><td>success rate</td></tr><tr><td>CW-L2(K = 0)</td><td>100%</td><td>100%</td><td>84.65%</td><td>93.93%</td><td>94.80%</td><td>70.84%</td></tr><tr><td>CW-L2(K = 500)</td><td>99.78%</td><td>99.78%</td><td>76.61%</td><td>76.55%</td><td>84.07%</td><td>61.26%</td></tr><tr><td>CW-L2(κ = 1000)</td><td>90.24%</td><td>95.98%</td><td>45.56%</td><td>47.86%</td><td>75.13%</td><td>48.86%</td></tr></table>
184
+
185
+ Table 7: Targeted adversarial evaluations results of our rejection policies on the first 1000 test samples. We report the detection rates with different thresholds and success rates of generating adversarial examples.
186
+
187
+ Discussions on off-manifold conjecture Gilmer et al. (2018) challenges whether the off-manifold conjecture holds in general. They experiment on synthetic dataset-two high-dimensional concentric spheres with theoretical analyses, showing that even for a trained classifier with close to zero test error, there may be a constant fraction of the data manifold misclassified, which indicates the existence of adversarial examples within the manifold. But there are still several concerns to be addressed: First, as also pointed out by the authors, the manifolds in natural datasets can be quite complex than that of simple synthesized dataset. Fetaya et al. (2019) draws similar conclusion from analyses on synthesized data with particular geometry. So the big concern is whether the conclusions in Gilmer et al. (2018); Fetaya et al. (2019) still hold for the manifolds in natural datasets. A practical obstacle to verify this conclusion is that works modeling the full generative processes are based on manifold assumption, but provide no explicit manifolds for analytical analyses like Gilmer et al. (2018); Fetaya et al. (2019). While SDIM enables explicit and customized manifolds on high-level data representations via probabilistic constraints, thus enables analytical analyses. In this paper, samples of different classes are trained to form isotropic Gaussians corresponding to their classes in representation space (other choices are possible). The relation between the adversarial robustness and the forms and dimensionalities of data manifolds is to be explored. Second, in their experiments, all models evaluated are discriminative classifiers. Considering the recent promising results of generative classifiers against adversarial examples, would using generative classifiers lead to different results? One thing making us feel optimistic is that even though the existence of adversarial examples is inevitable, Gilmer et al. (2018) suggest that adversarial robustness can be improved by minimizing the test errors, which is also supported by our experimental differences on MNIST and CIFAR10.
188
+
189
+ # 6 CONCLUSIONS
190
+
191
+ We introduce supervised probabilistic constraints to DIM. Giving up the full generative process, SDIMs are equivalent to generative classifiers on high-level data representations. Unlike full conditional generative models which achieve poor classification performance even on CIFAR10, SDIMs attain comparable performance as the discriminative counterparts on complex datasets. The training of SDIM is also computationally similar to discriminative classifiers, and does not require prohibitive computational resources. Our proposed rejection policy based on off-manifold conjecture, a built-in property of SDIM, can effectively reject illegal inputs including OoD samples and adversarial examples. We demonstrate that likelihoods modeled on high-level data representations, rather than raw pixel intensities, are more robust on downstream tasks without the requirement of generating real samples.
192
+
193
+ # REFERENCES
194
+
195
+ Mohamed Ishmael Belghazi, Aristide Baratin, Sai Rajeswar, Sherjil Ozair, Yoshua Bengio, Aaron Courville, and R Devon Hjelm. Mine: mutual information neural estimation. arXiv preprint arXiv:1801.04062, 2018.
196
+
197
+ Wieland Brendel, Jonas Rauber, and Matthias Bethge. Decision-based adversarial attacks: Reliable attacks against black-box machine learning models. arXiv preprint arXiv:1712.04248, 2017.
198
+
199
+ Andrew Brock, Jeff Donahue, and Karen Simonyan. Large scale gan training for high fidelity natural image synthesis. arXiv preprint arXiv:1809.11096, 2018.
200
+
201
+ Han Cai, Ligeng Zhu, and Song Han. Proxylessnas: Direct neural architecture search on target task and hardware. arXiv preprint arXiv:1812.00332, 2018.
202
+
203
+ Nicholas Carlini and David Wagner. Defensive distillation is not robust to adversarial examples. arXiv preprint arXiv:1607.04311, 2016.
204
+
205
+ Nicholas Carlini and David Wagner. Towards evaluating the robustness of neural networks. In 2017 IEEE Symposium on Security and Privacy (SP), pp. 39–57. IEEE, 2017.
206
+
207
+ Hyunsun Choi and Eric Jang. Generative ensembles for robust anomaly detection. arXiv preprint arXiv:1810.01392, 2018.
208
+
209
+ Monroe D Donsker and SR Srinivasa Varadhan. Asymptotic evaluation of certain markov process expectations for large time. iv. Communications on Pure and Applied Mathematics, 36(2):183– 212, 1983.
210
+
211
+ Ethan Fetaya, Jacobsen, and Richard Zemel. Conditional generative models are not robust. arXiv preprint arXiv:1906.01171, 2019.
212
+
213
+ Yonatan Geifman and Ran El-Yaniv. Selective classification for deep neural networks. In Advances in neural information processing systems, pp. 4878–4887, 2017.
214
+
215
+ Justin Gilmer, Luke Metz, Fartash Faghri, Samuel S Schoenholz, Maithra Raghu, Martin Wattenberg, and Ian Goodfellow. Adversarial spheres. arXiv preprint arXiv:1801.02774, 2018.
216
+
217
+ Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572, 2014.
218
+
219
+ Kathrin Grosse, Praveen Manoharan, Nicolas Papernot, Michael Backes, and Patrick McDaniel. On the (statistical) detection of adversarial examples. arXiv preprint arXiv:1702.06280, 2017.
220
+
221
+ Shixiang Gu and Luca Rigazio. Towards deep neural network architectures robust to adversarial examples. arXiv preprint arXiv:1412.5068, 2014.
222
+
223
+ Michael Gutmann and Aapo Hyvarinen. Noise-contrastive estimation: A new estimation principle ¨ for unnormalized statistical models. In Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, pp. 297–304, 2010.
224
+
225
+ Dongyoon Han, Jiwhan Kim, and Junmo Kim. Deep pyramidal residual networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5927–5935, 2017.
226
+
227
+ 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.
228
+
229
+ R Devon Hjelm, Alex Fedorov, Samuel Lavoie-Marchildon, Karan Grewal, Phil Bachman, Adam Trischler, and Yoshua Bengio. Learning deep representations by mutual information estimation and maximization. arXiv preprint arXiv:1808.06670, 2018.
230
+
231
+ Gao Huang, Zhuang Liu, Laurens Van Der Maaten, and Kilian Q Weinberger. Densely connected convolutional networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 4700���4708, 2017.
232
+
233
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
234
+
235
+ Diederik P Kingma and Max Welling. Auto-encoding variational Bayes. In International Conference on Learning Representations, 2013.
236
+
237
+ Durk P Kingma and Prafulla Dhariwal. Glow: Generative flow with invertible 1x1 convolutions. In Advances in Neural Information Processing Systems, pp. 10215–10224, 2018.
238
+
239
+ Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial examples in the physical world. arXiv preprint arXiv:1607.02533, 2016.
240
+
241
+ Yingzhen Li, John Bradshaw, and Yash Sharma. Are generative classifiers more robust to adversarial attacks? arXiv preprint arXiv:1802.06552, 2018.
242
+
243
+ 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.
244
+
245
+ Alireza Makhzani, Jonathon Shlens, Navdeep Jaitly, Ian Goodfellow, and Brendan Frey. Adversarial autoencoders. arXiv preprint arXiv:1511.05644, 2015.
246
+
247
+ Seyed-Mohsen Moosavi-Dezfooli, Alhussein Fawzi, and Pascal Frossard. Deepfool: a simple and accurate method to fool deep neural networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2574–2582, 2016.
248
+
249
+ Eric Nalisnick, Akihiro Matsukawa, Yee Whye Teh, Dilan Gorur, and Balaji Lakshminarayanan. Do deep generative models know what they don’t know? arXiv preprint arXiv:1810.09136, 2018.
250
+
251
+ Eric Nalisnick, Akihiro Matsukawa, Yee Whye Teh, Dilan Gorur, and Balaji Lakshminarayanan. Hybrid models with deep and invertible features. arXiv preprint arXiv:1902.02767, 2019.
252
+
253
+ Nina Narodytska and Shiva Prasad Kasiviswanathan. Simple black-box adversarial perturbations for deep networks. arXiv preprint arXiv:1612.06299, 2016.
254
+
255
+ Andrew $\mathrm { ~ Y ~ N ~ g ~ }$ and Michael I Jordan. On discriminative vs. generative classifiers: A comparison of logistic regression and naive bayes. In Advances in neural information processing systems, pp. 841–848, 2002.
256
+
257
+ XuanLong Nguyen, Martin J Wainwright, and Michael I Jordan. Estimating divergence functionals and the likelihood ratio by convex risk minimization. IEEE Transactions on Information Theory, 56(11):5847–5861, 2010.
258
+
259
+ Sebastian Nowozin, Botond Cseke, and Ryota Tomioka. f-gan: Training generative neural samplers using variational divergence minimization. In Advances in neural information processing systems, pp. 271–279, 2016.
260
+
261
+ Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018.
262
+
263
+ Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. In International Conference on Machine Learning, pp. 1278–1286, 2014.
264
+
265
+ Tim Salimans, Andrej Karpathy, Xi Chen, and Diederik P Kingma. Pixelcnn $^ { + + }$ : Improving the pixelcnn with discretized logistic mixture likelihood and other modifications. arXiv preprint arXiv:1701.05517, 2017.
266
+
267
+ Pouya Samangouei, Maya Kabkab, and Rama Chellappa. Defense-gan: Protecting classifiers against adversarial attacks using generative models. arXiv preprint arXiv:1805.06605, 2018.
268
+
269
+ Lukas Schott, Jonas Rauber, Matthias Bethge, and Wieland Brendel. Towards the first adversarially robust neural network model on mnist. arXiv preprint arXiv:1805.09190, 2018.
270
+
271
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
272
+
273
+ Yang Song, Taesup Kim, Sebastian Nowozin, Stefano Ermon, and Nate Kushman. Pixeldefend: Leveraging generative models to understand and defend against adversarial examples. arXiv preprint arXiv:1710.10766, 2017.
274
+
275
+ Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. arXiv preprint arXiv:1312.6199, 2013.
276
+
277
+ Florian Tramer, Alexey Kurakin, Nicolas Papernot, Ian Goodfellow, Dan Boneh, and Patrick Mc-\` Daniel. Ensemble adversarial training: Attacks and defenses. arXiv preprint arXiv:1705.07204, 2017.
278
+
279
+ # A CLASSIFICATION WITH REJECTION
280
+
281
+ A very related work to our paper is (Nalisnick et al., 2019), which propose a hybrid model modeling distribution of features $p$ (features) and predictive distribution $p$ (targets|features) at the same time. Normalizing flow is used to learn invertible features as inputs of discriminative model, i.e. predictive distribution, and provides evaluation of features $\pmb { x } ^ { * }$ . Inputs out of the training data distribution are rejected by setting a threshold for $\ b { p } ( \ b { x } ^ { * } )$ . For SDIM, illagel inputs are rejected by setting thresholds for each of the class conditional. The class conditionals are modeled on the data representations from encoder regularized by MI loss $\mathcal { I } _ { \mathrm { M I } }$ . The hybrid model in Nalisnick et al. (2019) can successfully distinguish in-distribution dataset and OoD dataset. While SDIM reject illegal inputs including OoD dataset samples and adversarial examples with more fine-grained class conditionals.
282
+
283
+ Geifman & El-Yaniv (2017) propose a selection method to perform selective classification with desired risk level given a trained model, but they focus on discriminative models.
284
+
285
+ # B EVALUATION DETAILS
286
+
287
+ # B.1 DATA PROCESSING
288
+
289
+ • MNIST, FashionMNIST: All images are resized to $3 2 \times 3 2$ from $2 8 \times 2 8$ . We scale the images pixels to $[ 0 , 1 ]$ , and normalization is not used for fair comparisons with the baselines in (Li et al., 2018). CIFAR10, SVHN: We follow the simple data augmentation in (He et al., 2016) for training: 4 pixels are padded on each side, and a $3 2 \times 3 2$ crop is randomly sampled from the padded image or its horizontal flip. For testing, we only evaluate the single view of the original $3 2 \times 3 2$ image. All image pixels are also scaled to $[ 0 , 1 ]$ .
290
+
291
+ No other data augmentations or processings are used except for the explicitly listed above.
292
+
293
+ # B.2 MODELS AND TRAINING SETTINGS
294
+
295
+ MI computation The local MI $\mathcal { I } _ { \mathrm { M I } }$ is computed between the $4 \times 4$ feature maps and the encoder outputs. We use lower-bound of Jensen-Shannon divergence to estimate the MI $\mathcal { I } _ { J S D } ( \boldsymbol { X } , \boldsymbol { Y } )$ , and leave other lower-bounds unexplored. In practice, we find using other bounds would take more computational resources. However, we think better results can be expected if using these bounds according to the experimental results reported in Hjelm et al. (2018).
296
+
297
+ MI evaluation network Following Hjelm et al. (2018), we parameterize the MI evaluation network $T _ { \omega }$ as a $1 \times 1$ convolutional neural network with architecture:
298
+
299
+ Table 8: Local MI evaluation concat-and-convolve network architecture.
300
+
301
+ <table><tr><td>Operation</td><td>Size</td><td>Activation</td></tr><tr><td>Input -→1 × 1 conv</td><td>256</td><td>ReLU</td></tr><tr><td>1 ×1conv</td><td>256</td><td>ReLU</td></tr><tr><td>1×1</td><td>1</td><td></td></tr></table>
302
+
303
+ The input of $T _ { \omega }$ is positive or negative pair of local feature map $L _ { \phi } ( \pmb { x } )$ and encoder output $E _ { \phi } ( \pmb { x } )$ . The positive pairs, samples from the joint distribution, are constructed by concat the encoder output $E _ { \phi } ( \pmb { x } )$ and the corresponding feature map $L _ { \phi } ( \pmb { x } )$ of the given batch. The negative pairs, samples from product of marginals, can be constructed by $E _ { \phi } ( \pmb { x } )$ and shuffled $L _ { \phi } ( { \pmb x } )$ along the batch-axis.
304
+
305
+ Optimization We set $\alpha = \beta = \gamma = 1$ in our experiments. The constant $K$ in the likelihood margin loss $\mathcal { I } _ { \mathrm { L M } }$ is 10. All models are trained 500 epochs, and we always save the checkpoints reporting the minimum ongoing training losses for evaluation. We use optimizer Adam (Kingma & Ba, 2014) with default learning rate 0.001.
306
+
307
+ ![](images/bb04944933ee3f018ea1c8af1820eeb37c8beb8db9fcb24e8ff9bb94a6ddc00b.jpg)
308
+ Figure 2: Class-wise distributions of the class conditionals of both in-distribution samples and outof-distribution samples. The in-out distribution pair is FashionMNIST-MNIST.
309
+
310
+ ![](images/5a5169fced8d34a83f04758c5dc342d75e8518d6f0a2cf3bb720c909c1ba68ca.jpg)
311
+ Figure 3: Class-wise distributions of the class conditionals of both in-distribution samples and outof-distribution samples. The in-out distribution pair is CIFAR10-SVHN.
312
+
313
+ # D ADDITIONAL RESULTS OF ADVERSARIAL EVALUATIONS
314
+
315
+ D.1 ROBUSTNESS AGAINST ATTACKS USING CROSS-ENTROPY
316
+
317
+ We make comparisons between SDIM and GBZ (Li et al., 2018), which consistently performs best in Deep Bayes.
318
+
319
+ FGSM and PGD- $L _ { \infty }$ The results in Fig 4 and Fig 5 show that SDIM performs consistently better than the baseline. We find that increasing the distortion factor $\epsilon$ of FGSM has no influences of SDIM’s accuracy, and the adversarial examples keep the same. Recall that the class conditionals are optimized to keep a considerable margin. Before evaluating the cross entropy loss, softmax is applied on the class conditionals $\log p ( { \pmb x } | c )$ to generate a even sharper distribution. So for the samples that are correctly classified, their losses are numerically zeros, and the gradient on inputs $\nabla J _ { x } ( { \pmb x } , y )$ are also numerically zeros. The PGD- $L _ { \infty }$ we use here is the randomized version (Madry et al., $2 0 1 7 ) ^ { 2 }$ , which adds a small random perturbation before the iterative loop. The randomness is originally introduced to generate different adversarial examples for adversarial training, but here it breaks the zero loss so that the gradient on inputs $\nabla J _ { x } ( { \pmb x } , { \bar { y } } )$ will not be zeros in the loop. FGSM can also be randomized (Tramer et al., 2017), which can be seen as a one-step variant of randomized \` PGD.
320
+
321
+ This phenomena is similar to what some defenses using gradient obfuscation want to achieve. Defensive distillation (Carlini & Wagner, 2016) masks the gradients of cross-entropy by increasing the temperature of softmax. But for CW attacks, which do not use cross-entropy, and operate on logits directly, this could be ineffective.
322
+
323
+ ![](images/ee0e3001d7635d2990911b057f4190f0e443ff2925667f782d7c2638e661ac57.jpg)
324
+ Figure 4: The adversarial classification accuracies of SDIM and GBZ on MNIST under FGSM- $. L _ { \infty }$ and PGD- $L _ { \infty }$ attacks. On the right are the generated adversarial examples with $\epsilon$ from 0 to 0.5.
325
+
326
+ ![](images/eb67a848cdd3382d1f6b17fdaca62a32856ae217d485d1aebae8b59fa7d91735.jpg)
327
+ Figure 5: The adversarial classification accuracies of SDIM and GBZ on CIFAR10 under FGSM$L _ { \infty }$ and PGD- $L _ { \infty }$ attacks. On the right are the generated adversarial examples with $\epsilon$ from 0 to 0.5.
328
+
329
+ # D.2 ADVERSARIAL EXAMPLES OF CIFAR10
330
+
331
+ <table><tr><td rowspan="2">Samples</td><td colspan="2">国</td><td colspan="2"></td><td colspan="2">国</td><td colspan="2">日</td><td colspan="2">1</td></tr><tr><td colspan="2">original</td><td colspan="2">deepfool</td><td colspan="2">cw-L2</td><td colspan="2">boundary</td><td colspan="2">JSMA</td></tr><tr><td>1st Per. original</td><td>408.6 424.2</td><td>396.6 -386.1</td><td>375.9 -379.2</td><td>378.4 -319.8</td><td>363.3 -370.2</td><td>376.7 -357.2</td><td>409.4 -356.9</td><td>383.0 -259.3</td><td>397.1 -291.9</td><td>412.2 -239.0</td></tr><tr><td>DeepFool</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td>153.4</td><td>-391.6</td><td>-344.1</td><td>-262.6</td><td>-376.1</td><td>-345.9</td><td>215.1</td><td>-306.5</td><td>-244.3</td><td>-326.4</td></tr><tr><td>CW-L2</td><td>129.9</td><td>-555.3</td><td>235.4</td><td>-353.1</td><td>-471.6</td><td>-400.3</td><td>-342.7</td><td>-367.2</td><td>-486.4</td><td>-326.4</td></tr><tr><td>Boundary</td><td>213.9</td><td>-417.4</td><td>-458.3</td><td>-548.0</td><td>-587.4</td><td>-236.3</td><td>214.0</td><td>-1246.1</td><td>-171.2</td><td>-555.6</td></tr><tr><td>LocalSearch</td><td>165.2</td><td>-485.7</td><td>190.9</td><td>-325.6</td><td>-439.0</td><td>-379.0</td><td>-318.8</td><td>-327.5</td><td>-357.9</td><td>-272.3</td></tr></table>
332
+
333
+ Table 9: Full logits of adversarial examples generated with different attacks. The original image is the fist sample of class 0 of CIFAR10 test set. The first row gives the 1st percentile thresholds, and the second row shows the logits of the original image. The largest logits are marked in bold.
md/train/rkxn7nR5KX/rkxn7nR5KX.md ADDED
@@ -0,0 +1,341 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # INCREMENTAL FEW-SHOT LEARNING WITH ATTENTION ATTRACTOR NETWORKS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Machine learning classifiers are often trained to recognize a set of pre-defined classes. However, in many real applications, it is often desirable to have the flexibility of learning additional concepts, without re-training on the full training set. This paper addresses this problem, incremental few-shot learning, where a regular classification network has already been trained to recognize a set of base classes; and several extra novel classes are being considered, each with only a few labeled examples. After learning the novel classes, the model is then evaluated on the overall performance of both base and novel classes. To this end, we propose a meta-learning model, the Attention Attractor Network, which regularizes the learning of novel classes. In each episode, we train a set of new weights to recognize novel classes until they converge, and we show that the technique of recurrent back-propagation can back-propagate through the optimization process and facilitate the learning of the attractor network regularizer. We demonstrate that the learned attractor network can recognize novel classes while remembering old classes without the need to review the original training set, outperforming baselines that do not rely on an iterative optimization process.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ The success of deep learning stems from the availability of large scale datasets with detailed annotation, such as ImageNet (Russakovsky et al., 2015). The need for such a large dataset is however a limitation, since its collection requires intensive human labor. This is also strikingly different from human learning, where new concepts can be learned from very few examples. One line of work that attempts to bridge this gap is few-shot learning (Koch et al., 2015; Vinyals et al., 2016; Snell et al., 2017), where a model learns to output a classifier given only a few labeled examples of the unseen classes. While this is a very promising line of work, its usability in practice can be a concern, because few-shot models only focus on learning novel classes, ignoring the fact that many common classes are readily available in large datasets.
12
+
13
+ An approach that aims to enjoy the best of both worlds, the ability to learn from large datasets for common classes with the flexibility of few-shot learning for others, is incremental few-shot learning (Gidaris & Komodakis, 2018). This combines incremental learning where we want to add new classes without catastrophic forgetting (McCloskey & Cohen, 1989), with few-shot learning when the new classes, unlike the base classes, only have a small amount of examples. One use case to illustrate the problem is a visual aid system. Most objects of interest are common to all users, e.g., cars, pedestrian signals; however, users would also like to augment the system with additional personalized items or important landmarks in their area. Such a system needs to be able to learn new classes from few examples, without harming the performance of the original classes and without access to the original dataset used to train these classes.
14
+
15
+ In this work we present a novel method for incremental few-shot learning where during metalearning we optimize a regularizer that reduces catastrophic forgetting from the incremental few-shot learning. Our proposed “attention attractor network” regularizer is inspired by attractor networks (Zemel & Mozer, 2001) and can be thought of as a learned memory of the base classes. We also show how this regularizer can be optimized, using recurrent back-propagation (Liao et al., 2018; Almeida, 1987; Pineda, 1987) to back-propagate through the few-shot optimization stage. Finally, we show empirically that our proposed method can produce state-of-the-art results in incremental few-shot learning on the challenging mini-ImageNet (Vinyals et al., 2016) and tiered-ImageNet (Ren et al., 2018) tasks.
16
+
17
+ ![](images/fb9c804e592658a6d91fdaaecf978b12cb065e9eecc052455e12f34869e7ffbd.jpg)
18
+ Figure 1: Our proposed attention attractor network for incremental few-shot learning. A: In stage 1, we learn $W _ { a }$ and the feature extractor CNN backbone through supervised pretraining. B: In stage 2 we learn $W _ { b }$ on a few-shot episode through an iterative solver, to minimize cross entropy plus an additional energy term predicted by attending to the base class representation $W _ { a }$ . C: The attention attractor network is learned end-to-end to minimize the expected query loss.
19
+
20
+ # 2 RELATED WORK
21
+
22
+ Recently, there has been a surge in interest in few-shot learning (Koch et al., 2015; Vinyals et al., 2016; Snell et al., 2017; Lake et al., 2011), where a model for novel classes is learned with only a few labeled examples. One family of approaches for few-shot learning, including Deep Siamese Networks (Koch et al., 2015), Matching Networks (Vinyals et al., 2016) and Prototypical Networks (Snell et al., 2017), follows the line of metric learning. In particular, these approaches use deep neural networks to learn a function that maps the input space to the embedding space where examples belonging to the same category are close and those belonging to different categories are far apart. Recently, Garcia & Bruna (2018) propose a graph neural networks based method which captures the information propagation from the labeled support set to the query set. Ren et al. (2018) extends Prototypical Networks to leverage unlabeled examples while doing few-shot learning. Despite the simplicity, these methods are very effective and often competitive with the state-of-the-art.
23
+
24
+ Another class of approaches try to learn models which can, unlike metric methods, adapt to the episodic tasks. In particular, Ravi & Larochelle (2017) treat the long short-term memory (LSTM) as a meta learner such that it can learn to predict the parameter update of a base learner, e.g., a convolutional neural network (CNN). MAML (Finn et al., 2017) instead learns the hyperparameters or the initial parameters of the base learner by back-propagating through the gradient descent steps. Santoro et al. (2016) use a read/write augmented memory, and Mishra et al. (2018) combine soft attention with temporal convolutions which enables retrieval of information from past episodes.
25
+
26
+ Methods described above belong to the general class of meta-learning models. First proposed in Schmidhuber (1987); Naik & Mammone (1992); Thrun (1998), meta-learning is a machine learning paradigm where the meta-learner tries to improve the base learner using the learning experiences from multiple tasks. Meta-learning methods typically learn the update policy yet lack an overall learning objective in the few-shot episodes. Furthermore, they could potentially suffer from shorthorizon bias (Wu et al., 2018), if at test time the computation graph is unrolled for longer steps. To address this problem, Bertinetto et al. (2018) propose to use fast convergent models like logistic regression (LR), which can be back-propagated via a closed form update rule. Compared to Bertinetto et al. (2018), our proposed method using recurrent back-propagation (Liao et al., 2018; Almeida, 1987; Pineda, 1987) is more general as it does not require a closed-form update rule, and the inner loop solver can employ any existing continuous optimizers.
27
+
28
+ Our work is also related to incremental learning or continual learning, a setting where information is arriving continuously while prior knowledge needs to be transferred. A key challenge here is catastrophic forgetting (McCloskey & Cohen, 1989; McClelland et al., 1995), i.e., the model forgets the learned knowledge. Various forms of memory-based models have since been proposed, which either store training examples explicitly (Rebuffi et al., 2017; Sprechmann et al., 2018; Castro et al., 2018), regularize the parameter updates (Kirkpatrick et al., 2017), or learn a generative model (Kemker & Kanan, 2018). However, in these studies, incremental learning typically starts from scratch, and usually perform worse than a regular model that is trained with all available classes together since the network has not learned a good representation yet while dealing with catastophic forgetting.
29
+
30
+ To make incremental learning more useful, Hariharan & Girshick (2017); Wang et al. (2018); Gidaris & Komodakis (2018) combine few-shot learning and incremental learning, where they start off with a pre-trained network on a set of base classes, and try to augment the classifier with a batch of new classes that has not been seen during training. This is also the setting we adopt in this paper. Hariharan & Girshick (2017) propose the squared gradient magnitude loss, which makes the learned classifier from the few-shot examples have a smaller gradient value when learning on all examples. Wang et al. (2018) propose the prototypical matching networks, a combination of prototypical network and matching network. The paper also adds hallucination, which generates new examples. Both papers assume that the few-shot learning stage has access to the base classes data, which can be inflexible and inefficient due to the large size of the original training set. Gidaris & Komodakis (2018) remove this assumption and propose an attention based model which generates weights for novel categories. They also promote the use of cosine similarity between feature representations and weight vectors to classify images.
31
+
32
+ In contrast, during each few-shot episode, we directly learn a linear classifier that is solved till convergence, unlike Gidaris & Komodakis (2018) which directly output the prediction. Since in our settings the model cannot see base class data in each few-shot learning episode, different from Hariharan & Girshick (2017); Wang et al. (2018), it is challenging to jointly classify both base and novel categories using a vanilla logistic regression. Towards this end, we propose to add a learned regularizer, which is learned by differentiating through few-shot learning iterations. We found that, despite the simplicity, using an iterative solver with the learned regularizer significantly improves the linear classifier model on the task of incremental few-shot learning.
33
+
34
+ # 3 ATTENTION ATTRACTOR NETWORK FOR INCREMENTAL FEW-SHOT LEARNING
35
+
36
+ In this section, we first define the setup of incremental few-shot learning, and then we introduce our new model, the Attention Attractor Network, which attends to the set of base classes according to the few-shot training data, and learns the attractor energy function as an additional regularizing term for the few-shot episode. Figure 1 illustrates the high-level model diagram of our method.
37
+
38
+ # 3.1 INCREMENTAL FEW-SHOT LEARNING
39
+
40
+ We first define the task of incremental few-shot learning in this section. In this paper, we consider the two stage learning model proposed by Gidaris & Komodakis (2018).
41
+
42
+ Stage 1: We learn a base model for the regular supervised classification task on dataset $\mathcal { D } _ { a } =$ $\{ ( x _ { a , i } , y _ { a , i } ) \} _ { i = 1 } ^ { N _ { a } }$ where The pur $x _ { a , i }$ is the of this $i$ -th example from dataset stage is to learn both a g $a$ and its labeled class od base classifier and $y _ { a , i } \in$ $\{ 1 , 2 , . . . , K \}$
43
+ representation. We denote parameters of the top fully connected layer as $W _ { a } ~ \in ~ \mathbb { R } ^ { D \times K }$ where $D$ is the dimension of our learned representation.
44
+
45
+ Stage 2: A few-shot dataset $\mathcal { D } _ { b }$ is presented, from which we can sample few-shot learning episodes $\mathcal { E }$ . For each $N$ -shot $K ^ { \prime }$ -way episode, there are $K ^ { \prime }$ novel classes disjoint from the base classes. Each novel class haTherefore, we have $N$ $M$ $S _ { b }$ $Q _ { b }$ respewhere $\mathbf { \mathcal { E } } ~ = ~ ( S _ { b } , Q _ { b } ) , S _ { b } ~ = ~ ( x _ { b , i } ^ { S } , y _ { b , i } ^ { S } ) _ { i = 1 } ^ { N \times K ^ { \prime } } , Q _ { b } ~ = ~ ( x _ { b , i } ^ { Q } , y _ { b , i } ^ { Q } ) _ { i = 1 } ^ { M \times K ^ { \prime } }$ yQb,i)M ×K0i=1 yb,i ∈ $\{ K + 1 , . . . , K + K ^ { \prime } \}$ . $S _ { b }$ and $Q _ { b }$ can be regarded as the training set and the validation set in a regular supervised learning setting. To evaluate the performance on a joint prediction of both base and novel classes, i.e., a $( K + K ^ { \prime } )$ -way classification, a mini-batch $Q _ { a } = \{ ( x _ { a , i } , y _ { a , i } ) \} _ { i = 1 } ^ { M \times K }$ from $\mathcal { D } _ { a }$ is also added to $Q _ { b }$ to form $Q _ { a + b } = Q _ { a } \cup Q _ { b }$ . During this stage, the learning algorithm has only access to samples from $S _ { b }$ , i.e., few-shot examples from the new classes. But its performance is evaluated on the joint query set $Q _ { a + b }$ . For simplicity, the base model including $W _ { a }$ is fixed so that only $W _ { b } \in \mathbb { R } ^ { D \times K ^ { \prime } }$ is learned.
46
+
47
+ In meta-training, we iteratively sample few-shot episodes $\mathcal { E }$ and try to optimize the few-shot learning algorithm, i.e., stage 2, in order to produce good results on $Q _ { a + b }$ . In this work, we learn a regularizer $R ( \cdot ; \theta _ { E } )$ such that $\begin{array} { r } { W _ { b } ^ { * } = \arg \operatorname* { m i n } _ { W _ { b } } \mathrm { L o s s } ( W _ { b } , S _ { b } ) + R ( W _ { b } ; \theta _ { E } ) } \end{array}$ , and the meta-learner tries to learn $\theta _ { E }$ such that the resulting $W _ { b } ^ { * }$ performs well on $Q _ { a + b }$ .
48
+
49
+ # 3.1.1 JOINT PREDICTION ON OLD AND NEW CLASSES
50
+
51
+ When solving a few-shot episode, we consider learning a linear classifier on the novel classes in the support set $S _ { b }$ . For notational convenience, we augment the hidden representation $h$ as below such that the 0-th dimension of the weights is the original bias.
52
+
53
+ $$
54
+ \boldsymbol { h } = [ 1 , \tilde { h } ] , \quad \boldsymbol { W } ^ { \top } \boldsymbol { h } = \boldsymbol { W } _ { 1 : } ^ { \top } \tilde { \boldsymbol { h } } + \boldsymbol { W } _ { 0 } .
55
+ $$
56
+
57
+ We use the concatenation of $W _ { a }$ and $W _ { b }$ as the fully-connected layer for classification,
58
+
59
+ $$
60
+ \hat { y } _ { b , i } = \mathrm { s o f t m a x } ( [ W _ { a } , W _ { b } ] ^ { \top } h ( x _ { b , i } ) ) .
61
+ $$
62
+
63
+ Here we emphasize that learnable parameters of $\hat { y } _ { b , i }$ is $W _ { b }$ . During the learning stage of each fewshot episode, we treat it as a classification problem and aim to minimize the following regularized cross-entropy objective on the support set $S$ ,
64
+
65
+ $$
66
+ \boldsymbol { W } _ { b } ^ { * } = \operatorname * { a r g m i n } \boldsymbol { L } ^ { S } ( \boldsymbol { W } _ { b } ) = \frac { 1 } { N K ^ { \prime } } \sum _ { i = 1 } ^ { N K ^ { \prime } } \sum _ { c = 1 } ^ { K + K ^ { \prime } } \boldsymbol { y } _ { b , i , c } ^ { S } \log \hat { \boldsymbol { y } } _ { b , i , c } ^ { S } ( \boldsymbol { W } _ { b } ) + R ( \boldsymbol { W } _ { b } ; \boldsymbol { \theta } _ { E } )
67
+ $$
68
+
69
+ # 3.2 ATTENTION ATTRACTOR NETWORKS
70
+
71
+ Directly learning the few-shot episode, e.g., by setting $R ( W _ { b } ; \theta _ { E } )$ to be zero or simple weight decay, can cause catastrophic forgetting on the old classes. This is because $W _ { b }$ is trying to minimize the probability of all the old classes, as it is trained only on new classes. In this section, we introduce Attention Attractor Networks to address this problem.
72
+
73
+ The attractor network adds an energy term $E$ to the few-shot learning objective, $R ( W _ { b } ; \theta _ { E } ) =$ $\frac { 1 } { 2 } \lambda \| W _ { b } \| _ { 2 } ^ { 2 } + E ( W _ { b } ; \theta _ { E } )$ .
74
+
75
+ $$
76
+ \begin{array} { l } { { W _ { b } ^ { * } ( \theta _ { E } , S _ { b } ) = \displaystyle \mathrm { a r g } \operatorname* { m i n } L ^ { S } ( W _ { b } ; \theta _ { E } ) } } \\ { { \displaystyle \quad = \arg \operatorname* { m i n } \frac { 1 } { N K ^ { \prime } } \sum _ { i = 1 } ^ { N K ^ { \prime } K + K ^ { \prime } } \sum _ { c = 1 } \mathcal { Y } _ { b , i , c } \log \hat { y } _ { b , i , c } + \frac { 1 } { 2 } \lambda \| W _ { b } \| _ { 2 } ^ { 2 } + E ( W _ { b } ; \theta _ { E } ) } , } \end{array}
77
+ $$
78
+
79
+ where the optimized parameters $W _ { b } ^ { * }$ are functions of energy function parameters $\theta _ { E }$ and few-shot samples $S _ { b }$ . During meta-learning, $\theta _ { E }$ are updated to minimize an expected loss of the query set $Q _ { a + b }$ which contains both old and new classes, averaging over all few-shot learning episodes.
80
+
81
+ $$
82
+ \begin{array} { r } { \hat { y } _ { j } ( \theta _ { E } , S _ { b } ) = \mathrm { s o f t m a x } \left( [ W _ { a } , W _ { b } ^ { * } ( \theta _ { E } , S _ { b } ) ] ^ { \top } h ( x _ { j } ) \right) , } \end{array}
83
+ $$
84
+
85
+ $$
86
+ \theta _ { E } ^ { * } = \underset { \theta _ { E } } { \arg \operatorname* { m i n } } \underset { \varepsilon } { \mathbb { E } } [ L ^ { Q } ( \theta _ { E } , S _ { b } ) ] = \underset { \theta _ { E } } { \arg \operatorname* { m i n } } \underset { \varepsilon } { \mathbb { E } } \left[ \sum _ { j = 1 } ^ { M ( K + K ^ { \prime } ) } \sum _ { c = 1 } ^ { K + K ^ { \prime } } y _ { j , c } \log \hat { y } _ { j , c } ( \theta _ { E } , S _ { b } ) \right] .
87
+ $$
88
+
89
+ Conceptually, the energy function regularizes the learning of $W _ { b }$ so that it is compatible with $W _ { a }$ during the joint prediction. In our proposed model each base class in $W _ { a }$ has a learned attractor $U _ { k }$ stored in the knowledge base matrix $\hat { U } = [ U _ { 1 } , . . . , U _ { K } ]$ . When a novel class $k ^ { \prime }$ is seen, its classifier is regularized towards its attractor $u _ { k ^ { \prime } }$ which is a weighted sum of $U _ { k }$ . The weighting can be seen as an attention mechanism where each new class attends to the old classes according to the level of interference. Specifically, the attention mechanism is implemented by the cosine similarity function:
90
+
91
+ $$
92
+ A ( x , y ) = { \frac { x ^ { \top } y } { \| x \| _ { 2 } \| y \| _ { 2 } } } .
93
+ $$
94
+
95
+ For each image in the support set, we compare it with the set of base weights $W _ { a }$ , average over each support class and apply a softmax function,
96
+
97
+ $$
98
+ a _ { k ^ { \prime } , k } = \frac { \exp { \left( \frac { 1 } { N } \sum _ { j } \tau A ( h _ { j } , W _ { a , k } ) \mathbb { 1 } [ y _ { b , j } = k ^ { \prime } ] \right) } } { \sum _ { k } \exp { \left( \frac { 1 } { N } \sum _ { j } \tau A ( h _ { j } , W _ { a , k } ) \mathbb { 1 } [ y _ { b , j } = k ^ { \prime } ] \right) } } ,
99
+ $$
100
+
101
+ where $h _ { j }$ are the representations of the inputs in the support set $S _ { b }$ and $\tau$ is a learnable temperature scalar. $\boldsymbol { a } _ { \boldsymbol { k } ^ { \prime } , \boldsymbol { k } }$ encodes a normalized pairwise attention matrix between the novel classes and the base classes. The attention vector is then used to compute a linear weighted sum of entries in the knowledge base matrix $U$ ,
102
+
103
+ $$
104
+ u _ { k ^ { \prime } } = \sum _ { k } a _ { k ^ { \prime } , k } U _ { k } + U _ { 0 } .
105
+ $$
106
+
107
+ The final energy function is defined as a sum of squared $L _ { 2 }$ distance from the attractors,
108
+
109
+ $$
110
+ E ( W _ { b } ; \theta _ { E } ) = \frac { 1 } { 2 } \sum _ { k ^ { \prime } } ( W _ { b , k ^ { \prime } } - { u _ { k ^ { \prime } } } ) ^ { \top } \mathrm { d i a g } ( \mathrm { \bar { e x p } } ( \gamma ) ) ( W _ { b , k ^ { \prime } } - { u _ { k ^ { \prime } } } ) ,
111
+ $$
112
+
113
+ where $\gamma$ is a learnable vector, which defines a diagonal distance metric over the hidden dimensions. Our proposed attention attractor network takes inspiration from attractor networks (Mozer, 2009; Zemel $\&$ Mozer, 2001), where for each base class we learn an “attractor” that stores the relevant memory regrading that class.
114
+
115
+ In summary, $\theta _ { E }$ is a tuple of $( U , U _ { 0 } , \gamma , \tau )$ . The number of parameters is on the same order as a fully connected layer $W _ { a }$ . It is important to note that $E ( W _ { b } ; \mathsf { \bar { \theta } } _ { E } )$ is convex in $W _ { b }$ , so the optimum $W _ { b } ^ { * } ( \theta _ { E } , S _ { b } )$ is guaranteed to be unique and achievable.
116
+
117
+ # 3.3 LEARNING AN ENERGY FUNCTION USING RECURRENT BACKPROPAGATION
118
+
119
+ As there is no closed-form solution to the regularized linear classification problem shown above, in each training step, we need to solve for $L ^ { \mathbf { \lambda } _ { S } }$ to obtain $W _ { b } ^ { * }$ through an iterative optimizer. The question is how to efficiently comput e ∂W ∗b∂θE , back-propagating through the optimization. For simple energy functions, we can unroll the iterative optimization process in the computation graph and use the backpropagation through time (BPTT) algorithm (Werbos, 1990). However, the number of iterations for a gradient-based optimizer to converge can be on the order of thousands, and BPTT can be computationally prohibitive. Another way is to use the truncated BPTT (Williams & Peng, 1990) (T-BPTT) algorithm that optimizes for the initial $T$ steps of gradient-based optimization, and is commonly used in meta-learning problems. However, when $T$ is small the training objective is biased compared to the objective that considers the optimal $W _ { b }$ .
120
+
121
+ Alternatively, the recurrent backpropagation algorithm (Almeida, 1987; Pineda, 1987; Liao et al., 2018) allows us to backpropagate through fixed-point iterations efficiently without unrolling the computation graph and storing intermediate activations. Consider a vanilla gradient descent process on Wb with step size α. The difference between two steps Φ can be written as Φ(W (t)b ) = W (t)b $F ( W _ { b } ^ { ( t ) } )$ , where $F ( W _ { b } ^ { ( t ) } ) = W _ { b } ^ { ( t + 1 ) } = W _ { b } ^ { ( t ) } - \alpha \nabla L ^ { S } ( W _ { b } ^ { ( t ) } )$ . Since $\Phi ( W _ { b } ^ { * } ( { \boldsymbol { \theta } } _ { E } ) )$ is identically zero as a function of $\theta _ { E }$ , we have
122
+
123
+ $$
124
+ \frac { \partial W _ { b } ^ { \ast } } { \partial \theta _ { E } } = ( I - J _ { F , W _ { b } ^ { \ast } } ^ { \top } ) ^ { - 1 } \frac { \partial F } { \partial \theta _ { E } } ,
125
+ $$
126
+
127
+ where $J _ { F , W _ { b } ^ { * } }$ denotes the Jacobian matrix of the mapping $F$ evaluated at $W _ { b } ^ { * }$ .
128
+
129
+ Damped Neumann RBP To compute the matrix-inverse vector product $( I - J ^ { \top } ) ^ { - 1 } v$ in Equation 12, Liao et al. (2018) propose to use the Neumann series:
130
+
131
+ $$
132
+ ( I - J ^ { \top } ) ^ { - 1 } v = \sum _ { n = 0 } ^ { \infty } ( J ^ { \top } ) ^ { n } v \equiv \sum _ { n = 0 } ^ { \infty } v ^ { ( n ) } .
133
+ $$
134
+
135
+ # Algorithm 1 Learning an Energy Function for Incremental Few-Shot Learning
136
+
137
+ Require: $\theta _ { 0 } , \mathcal { D } _ { a } , \mathcal { D } _ { b } , N , K ^ { \prime } , h$
138
+ Ensure: $\theta _ { E }$
139
+ 1: $\theta _ { E } \theta _ { 0 }$ ;
140
+ 2: for $t = 1$ ... $T$ do
141
+ 3: 0 $\{ ( x _ { b } ^ { S } , y _ { b } ^ { S } ) \} , \{ ( x _ { b } ^ { Q } , y _ { b } ^ { Q } ) \} \mathrm { S a m p l e E p i s o d e } ( \mathcal { D } _ { b } , N , K ^ { \prime } ) ;$
142
+ 4: $\{ x _ { a + b } ^ { Q } , y _ { a + b } ^ { Q } \} \mathrm { S a m p l e M i n i B a t c h } ( { \mathcal { D } } _ { a } , N K ^ { \prime } ) \cup \{ ( x _ { b } ^ { Q } , y _ { b } ^ { Q } ) \} ;$
143
+ 5: 6: re $\hat { y } _ { b , j } ^ { S } \gets \mathrm { s o f t m a x } ( [ W _ { a } , W _ { b } ] ^ { \top } h ( x _ { b , j } ^ { S } ) ) \mathrm { . }$ ;
144
+ 7: $\begin{array} { r } { { \cal L } ^ { S } \gets \frac { 1 } { N K ^ { \prime } } \sum _ { i } y _ { b , i } ^ { S } \log \hat { y } _ { b , i } ^ { S } + \lambda \| { \cal W } _ { b } \| _ { 2 } ^ { 2 } + { \cal E } ( { \cal W } _ { b } ; \theta _ { E } ) ; } \end{array}$ ;
145
+ 8: $W _ { b } \gets \mathrm { O p t i m i z e r S t e p } ( W _ { b } , \nabla _ { W _ { b } } L ^ { S } ) ;$
146
+ 9: until $W _ { b }$ converges
147
+ 10: $\begin{array} { r } { \hat { y } _ { a + b , j } ^ { Q } \mathrm { s o f t m a x } ( [ W _ { a } , W _ { b } ] ^ { \top } h ( x _ { a + b , j } ^ { Q } ) ) , \forall j ; } \end{array}$
148
+ 11: $\begin{array} { r } L ^ { Q } \\gets \frac { 1 } { 2 N K ^ { \prime } } \sum _ { j } y _ { a + b , j } ^ { Q } \log \hat { y } _ { a + b , j } ^ { Q } \ \end{array}$ a+;
149
+ // Backprop through the above converging process
150
+ // A dummy gradient descent step
151
+ 12: $W _ { b } ^ { \prime } \gets W _ { b } - \alpha \nabla _ { W _ { b } } L ^ { S }$ ;
152
+ 13: $\begin{array} { r } { J \gets \frac { \partial W _ { b } ^ { \prime } } { \partial W _ { b } } } \end{array}$ ; v ← ∂LQ∂Wb ; g ← v ;
153
+ 14: repeat
154
+ 15: $\begin{array} { r } { \mathbf { \dot { \mathbf { \phi } } } { v } J ^ { \top } v - \epsilon v ; g g + v ; } \end{array}$
155
+ 16: until g converges
156
+ 17: θE ← OptimizerStep(θE, g > ∂Wb ∂θE
157
+ 18: end for
158
+
159
+ Note that the matrix vector product $J ^ { \top } { \boldsymbol { v } }$ can be computed by standard backpropagation. Nonetheless, we empirically observe that directly applying the Neumann RBP algorithm leads to numerical instability. Therefore, we propose “damped Neumann RBP”, which adds a damping term $0 < \epsilon < 1$ to $I - J ^ { \dagger }$ . It results in the following update: $\tilde { v } ^ { ( n ) } = ( J ^ { \top } - \epsilon I ) ^ { n } v .$ . The damping constant $\epsilon$ can also be interpreted as an additional weight decay term of the energy function during the backpropagation steps $\begin{array} { r } { \dot { E ^ { B } } ( W _ { b } ) = E ( W _ { b } ) + \frac { \epsilon } { 2 \alpha } \| \tilde { W _ { b } } \| _ { 2 } ^ { 2 } } \end{array}$ . In practice, we found the damping term with $\epsilon = 0 . 1$ helps alleviate the issue significantly.
160
+
161
+ Algorithm 1 outlines the key steps for learning an energy function using RBP in the incremental few-shot learning setting.
162
+
163
+ # 4 EXPERIMENTS
164
+
165
+ # 4.1 DATASETS
166
+
167
+ We used few-shot image classification benchmarks, mini-ImageNet Vinyals et al. (2016) and tieredImageNet Ren et al. (2018), and made modifications of the datasets to accommodate the incremental few-shot learning settings. For meta-learning we need to split between training base classes, and training classes from which we sample few-shot episodes. In tiered-ImageNet we split the 351 training classes to 200 base classes and 151 novel classes used to train the meta-learner. In miniImageNet this is problematic as there are only 64 training classes, therefore at each meta-learning episode we randomly erase 5 classes, considering the 59 left as our base classes and sampling a few-shot episode from the removed 5 classes. For validation/test we sample from the validation/test set of the base classes and sample episodes from separate validation and test classes. Further details about these datasets and the class splits are in the supplementary material.
168
+
169
+ # 4.2 EXPERIMENTAL SETUP
170
+
171
+ In the first stage, we use a standard ResNet backbone (He et al., 2016) to learn the feature representation through supervised training. For mini-ImageNet experiments, we follow Mishra et al. (2018) and use a modified version of ResNet. For tiered-ImageNet, we use the standard ResNet-18 (He et al., 2016), but replace all batch normalization (Ioffe & Szegedy, 2015) layers with group normalization (Wu & He, 2018), as there is a large distributional shift from training to testing in tiered-ImageNet due to categorical splits. We used standard data augmentation, with random crops and random horizonal flips. All of our models in our implementations use the same pretrained model as the starting point for the second stage.
172
+
173
+ Table 1: mini-ImageNet $6 4 + 5$ -way few-shot classification results
174
+
175
+ <table><tr><td rowspan="2">Model</td><td rowspan="2">Backbone</td><td rowspan="2">Base</td><td colspan="3">1-shot</td><td colspan="3">5-shot</td></tr><tr><td>Novel</td><td>Both</td><td>A</td><td>Novel</td><td>Both</td><td>△</td></tr><tr><td>MatchingNets (Vinyals etal.,2016)</td><td>C64</td><td>-</td><td>43.60</td><td>=</td><td>=</td><td>55.30</td><td>=</td><td></td></tr><tr><td>Meta-LSTM(Ravi&amp; Larochelle,2017)</td><td>C32</td><td>=</td><td>43.40 ± 0.77</td><td>=</td><td></td><td>60.20 ± 0.71</td><td></td><td></td></tr><tr><td>MAML (Finn et al.,2017)</td><td>C64</td><td>=</td><td>48.70 ± 1.84</td><td></td><td></td><td>63.10 ± 0.92</td><td></td><td></td></tr><tr><td>RelationNet (Sung et al.,2018)</td><td>C64</td><td></td><td>50.44 ± 0.82</td><td></td><td></td><td>65.32 ± 0.70</td><td></td><td></td></tr><tr><td>R2-D2 (Bertinetto et al.,2018)</td><td>C256</td><td></td><td>51.20 ±0.60</td><td></td><td></td><td>68.20±0.60</td><td></td><td></td></tr><tr><td>SNAIL (Mishra et al.,2018)</td><td>ResNet</td><td>=</td><td>55.71 ± 0.99</td><td></td><td></td><td>68.88 ±0.92</td><td></td><td></td></tr><tr><td>ProtoNet (Snell et al.,2017)</td><td>C64</td><td>=</td><td>49.42 ± 0.78</td><td></td><td></td><td>68.20 ± 0.66</td><td></td><td></td></tr><tr><td>ProtoNet (our implementation)</td><td>ResNet</td><td>75.79</td><td>50.09 ± 0.41</td><td>42.73</td><td>-20.21</td><td>70.76 ±0.19</td><td>57.05</td><td>-31.72</td></tr><tr><td>LwoF(Gidaris &amp; Komodakis,2018)</td><td>ResNet</td><td>80.24</td><td>55.45 ± 0.89</td><td>51.23</td><td></td><td>70.92 ± 0.35</td><td>56.04</td><td></td></tr><tr><td>LwoF (our implementation)</td><td>ResNet</td><td>74.58</td><td>56.97 ± 0.24</td><td>52.37</td><td>-13.65</td><td>70.50 ± 0.36</td><td>59.90</td><td>-14.18</td></tr><tr><td>Ours (lst stage)</td><td>ResNet</td><td>77.17</td><td>54.78 ± 0.43</td><td>52.74</td><td>-13.95</td><td>70.57 ± 0.36</td><td>60.34</td><td>-13.60</td></tr><tr><td>Ours (full model)</td><td>ResNet</td><td>76.84</td><td>55.72 ± 0.41</td><td>54.89</td><td>-11.39</td><td>70.50 ±0.36</td><td>62.37</td><td>-11.48</td></tr></table>
176
+
177
+ Table 2: tiered-ImageNet $2 0 0 + 5$ -way few-shot classification results
178
+
179
+ <table><tr><td rowspan="2">Model</td><td rowspan="2">Backbone</td><td rowspan="2">Base</td><td colspan="3">1-shot</td><td colspan="3">5-shot</td></tr><tr><td>Novel</td><td>Both</td><td>A</td><td>Novel</td><td>Both</td><td>4</td></tr><tr><td>ProtoNet (Snell et al., 2017)</td><td>ResNet</td><td>59.70</td><td>48.19 ± 0.43</td><td>34.49</td><td>-19.45</td><td>65.90 ± 0.19</td><td>50.27</td><td>-12.54</td></tr><tr><td>LwoF(Gidaris&amp; Komodakis,2018)</td><td>ResNet</td><td>61.84</td><td>50.90± 0.46</td><td>54.05</td><td>-2.35</td><td>66.69 ± 0.36</td><td>62.32</td><td>-1.90</td></tr><tr><td>Ours (1st stage)</td><td>ResNet</td><td>62.01</td><td>47.09 ± 0.42</td><td>48.58</td><td>-5.95</td><td>64.90 ± 0.41</td><td>59.73</td><td>-3.72</td></tr><tr><td>Ours (full model)</td><td>ResNet</td><td>61.59</td><td>51.12 ± 0.45</td><td>55.56</td><td>-0.80</td><td>66.40 ± 0.36</td><td>63.27</td><td>-0.83</td></tr></table>
180
+
181
+ In the second stage of learning as well as the final evaluation, we sample a few-shot episode from the $\mathcal { D } _ { b }$ , together with a regular mini-batch from the $\mathcal { D } _ { a }$ . The base class images are added to the query set of the few-shot episode. The base and novel classes are maintained in equal proportion in our experiments. For all the experiments, we consider 5-way classification with 1 or 5 support examples (i.e. shots); the total number of query images per episode is $7 5 \times 2 = 1 5 0$ .
182
+
183
+ We use an L-BFGS (Zhu et al., 1997) to solve the inner loop of our models to make sure $W _ { b }$ converges. For BPTT baselines, we unroll the computation graph using vanilla gradient descent with a fixed learning rate 1e-2. We use the ADAM (Kingma & Ba, 2015) optimizer for metalearning with a learning rate of 1e-3, which decays by a factor of 10 after 4,000 steps, for a total of 8,000 steps. We fix the RBP to 20 iterations and $\epsilon = 0 . 1$ .
184
+
185
+ # 4.3 EVALUATION METRICS
186
+
187
+ We consider the following evaluation metrics: 1) overall accuracy on individual query sets and the joint query set (“Base”, “Novel”, and “Both”); and 2) decrease in performance during joint prediction within the base and novel classes, considered separately $( ^ { 6 6 } \Delta _ { a } ^ { , 9 }$ and “ $\cdot { \Delta _ { b } } ^ { \prime }$ ). Finally we take the average $\overline { { \Delta } } = \frac { 1 } { 2 } ( \Delta _ { a } + \Delta _ { b } )$ as a key measure of the overall decrease in accuracy.
188
+
189
+ # 4.4 RESULTS
190
+
191
+ We present the few-shot benchmark in Table 1 and2. On mini-ImageNet, we compare our models to other incremental few-shot learning methods as well as pure few-shot learning methods. Note that our model uses the same backbone architecture as Mishra et al. (2018) and Gidaris & Komodakis (2018), and is directly comparable with their results. The “1st stage” baseline is a CNN trained on the base classes, where we train the new classes using logistic regression with weight decay.
192
+
193
+ In the incremental few-shot learning setting, we implemented and compared to two methods. First, we adapted ProtoNet (Snell et al., 2017) to incremental few-shot settings. For each base class we store a base representation, which is the average representation over all images belonging to the base class. During the few-shot learning stage, we again average the representation of the fewshot classes and add them to the bank of base representations. Finally, we retrieve the nearest neighbor by comparing the representation of a test image with entries in the representation store. In summary, both $W _ { a }$ and $W _ { b }$ are stored as the average representation of all images seen so far that belong to a certain class. We also compare to Dynamic Few-Shot Learning without Forgetting (LwoF) (Gidaris & Komodakis, 2018). Here the base weights $W _ { a }$ are learned regularly through supervised pre-training, and $W _ { b }$ are computed using prototypical averaging. We implemented the most advanced variants proposed in the paper, which involves a class-wise attention mechanism. The main difference to this work is that we use an iterative optimization to compute $W _ { b }$ .
194
+
195
+ Table 3: Learning an attention attractor network using damped Neumann RBP vs. truncated BPTT. Models are on evaluated on the validation set of tiered-ImageNet. During evaluation, “\*” models are solved till convergence using a second-order optimizer.
196
+
197
+ <table><tr><td>1-shot</td><td>Base</td><td>Base+</td><td>△a</td><td>Novel</td><td>Novel+</td><td>△b</td><td>Both</td><td>A</td></tr><tr><td>BPTT 20 Steps</td><td>61.41</td><td>61.16</td><td>-0.25</td><td>42.09 ±0.40</td><td>37.80± 0.37</td><td>-4.28</td><td>49.44</td><td>-2.27</td></tr><tr><td>BPTT 100 Steps</td><td>61.41</td><td>61.08</td><td>-0.33</td><td>44.49 ± 0.42</td><td>40.43 ± 0.38</td><td>-4.06</td><td>50.75</td><td>-2.20</td></tr><tr><td>BPTT 200 Steps</td><td>61.43</td><td>60.86</td><td>-0.57</td><td>45.49 ± 0.42</td><td>42.40 ± 0.40</td><td>-3.09</td><td>51.63</td><td>-1.83</td></tr><tr><td>BPTT 20 Steps *</td><td>61.65</td><td>6.02</td><td>-55.63</td><td>27.08 ±0.26</td><td>21.99 ± 0.24</td><td>-5.08</td><td>14.01</td><td>-30.36</td></tr><tr><td>BPTT 100 Steps *</td><td>61.46</td><td>5.23</td><td>-56.22</td><td>27.70 ± 0.29</td><td>19.59 ± 0.26</td><td>-8.11</td><td>12.41</td><td>-32.17</td></tr><tr><td>BPTT 200 Steps *</td><td>61.52</td><td>5.62</td><td>-55.89</td><td>29.31 ± 0.32</td><td>21.09 ±0.30</td><td>-8.22</td><td>13.36</td><td>-32.06</td></tr><tr><td>Ours (RBP 20 Steps)</td><td>61.52</td><td>61.11</td><td>-0.41</td><td>48.72 ± 0.45</td><td>47.04 ± 0.45</td><td>-1.68</td><td>54.08</td><td>-1.05</td></tr></table>
198
+
199
+ Table 4: Ablation studies on tiered-ImageNet. “Base+” and “Novel+” are the prediction accuracies on Base and Novel classes within a joint query set.
200
+
201
+ <table><tr><td>1-shot</td><td>Base</td><td>Base+</td><td>△a</td><td>Novel</td><td>Novel+</td><td>△b</td><td>Both</td><td>A</td></tr><tr><td>None</td><td>61.63</td><td>59.61</td><td>-2.02</td><td>43.68±0.40</td><td>34.59± 0.34</td><td>-9.10</td><td>47.10</td><td>-5.56</td></tr><tr><td>Best WD (入=0)</td><td>61.63</td><td>59.61</td><td>-2.02</td><td>43.68 ± 0.40</td><td>34.59 ± 0.34</td><td>-9.10</td><td>47.10</td><td>-5.56</td></tr><tr><td>Gamma Random</td><td>61.84</td><td>61.28</td><td>-0.56</td><td>44.29 ± 0.40</td><td>18.66 ± 0.29</td><td>-25.63</td><td>39.97</td><td>-13.09</td></tr><tr><td>Gamma w/o Wa</td><td>61.97</td><td>61.57</td><td>-0.40</td><td>48.05± 0.43</td><td>32.16± 0.38</td><td>-15.89</td><td>46.86</td><td>-8.14</td></tr><tr><td>Gamma</td><td>61.68</td><td>60.43</td><td>-1.25</td><td>46.17 ± 0.42</td><td>43.39 ± 0.41</td><td>-2.77</td><td>51.91</td><td>-2.01</td></tr><tr><td>Fixed Attractor</td><td>61.74</td><td>61.06</td><td>-0.67</td><td>45.96 ± 0.42</td><td>44.30 ± 0.42</td><td>-1.66</td><td>52.68</td><td>-1.17</td></tr><tr><td>Full Model</td><td>61.52</td><td>61.11</td><td>-0.41</td><td>48.72 ± 0.45</td><td>47.04± 0.45</td><td>-1.68</td><td>54.08</td><td>-1.05</td></tr><tr><td>5-shot</td><td>Base</td><td>Base+</td><td>△a</td><td>Novel</td><td>Novel+</td><td>△b</td><td>Both</td><td>A</td></tr><tr><td>None</td><td>61.75</td><td>52.74</td><td>-9.01</td><td>61.00 ± 0.39</td><td>59.82 ± 0.38</td><td>-1.18</td><td>56.28</td><td>-5.09</td></tr><tr><td>Best WD (入=5e-4)</td><td>61.62</td><td>58.48</td><td>-3.14</td><td>61.59 ± 0.39</td><td>57.93 ± 0.37</td><td>-3.65</td><td>58.21</td><td>-3.39</td></tr><tr><td>Gamma Random</td><td>61.78</td><td>59.42</td><td>-2.36</td><td>61.20 ± 0.38</td><td>55.66 ± 0.36</td><td>-5.54</td><td>57.54</td><td>-3.95</td></tr><tr><td>Gamma w/o Wa</td><td>62.00</td><td>57.99</td><td>-4.01</td><td>61.18 ± 0.40</td><td>59.00 ± 0.39</td><td>-2.18</td><td>58.49</td><td>-3.09</td></tr><tr><td>Gamma</td><td>61.46</td><td>59.87</td><td>-1.59</td><td>61.72 ± 0.39</td><td>59.80 ± 0.39</td><td>-1.92</td><td>59.83</td><td>-1.76</td></tr><tr><td>Fixed Attractor</td><td>61.78</td><td>60.82</td><td>-0.97</td><td>61.33 ± 0.39</td><td>60.06 ± 0.39</td><td>-1.28</td><td>60.44</td><td>-1.12</td></tr><tr><td>Full Model</td><td>61.80</td><td>61.28</td><td>-0.53</td><td>63.40±0.39</td><td>62.09±0.39</td><td>-1.31</td><td>61.68</td><td>-0.92</td></tr></table>
202
+
203
+ Shown in Table 1 and2, our proposed method consistently outperform the two approaches described above, particularly in “ $\overline { { \Delta } } ^ { , }$ . Our method is significantly improved during the second stage training, compared to a baseline that has only been pre-trained on base classes in the first stage.
204
+
205
+ # 4.5 COMPARISON TO TRUNCATED BPTT
206
+
207
+ An alternative way to learn the energy function is to unroll the inner optimization for a fixed number of steps in a differentiable computation graph, and then we can back-propagate through time. In fact, truncated BPTT is a popular learning algorithm in recent meta-learning approaches (Andrychowicz et al., 2016; Ravi & Larochelle, 2017; Finn et al., 2017; Sprechmann et al., 2018).
208
+
209
+ In Table 6, we report the performance of the truncated BPTT versions of our attention attractor model on 1-shot learning. Results on 5-shot are in the supplementary material. We unrolled the computation graph by 20 or 100 steps. In comparison, the RBP version also runs for only 20 truncation Neumann steps. At test time, we also test the BPTT learned model by solving the learned energy function until convergence, just like the RBP model. We can see that truncated BPTT versions have worse performance than RBP, since solving the fully connected layer weights requires more iterations than the number of unrolling steps. When we tried to solve the optimization to convergence at test time, we found that the BPTT model performance greatly decayed (colored in red), as they are only guaranteed to work well for a certain number of steps, and failed to learn a good energy function. In contrast, learning the energy function with RBP finds a good solution upon convergence, regardless of the optimizer being used.
210
+
211
+ # 4.6 ABLATION STUDIES
212
+
213
+ To understand the effectiveness of each part of the proposed model, we consider the following baselines as control experiments:
214
+
215
+ • Plain logistic regression (“None”) solves a logistic regression problem at each few-shot episode, without any form of weight decay other regularizers.
216
+ • Scalar weight decay $( ^ { 6 6 } \mathbf { W } \mathbf { D } ^ { \prime } )$ has a constant $\lambda$ for weight decay as the regularizer. The $\lambda$ is chosen according to validation performance.
217
+ • Learnable $\gamma$ (“Gamma”) learns $\gamma$ , which affects the size of the attractor basin, while keeping the
218
+ center of the attractor $u$ at zero. “w/o $W _ { a } { } ^ { , }$ variant does not fine-tune $W _ { a }$ in the second stage.
219
+ • Fixed attractor learns a fixed attractor center, in addition to learning $\gamma$ . No attention mechanism is employed here.
220
+
221
+ Experimental results are reported in Table 4. While models have similar performance on individually predicting base and novel classes, since they are using the same pre-trained backbone, there are significant differences in terms of joint prediction. Adding $\gamma$ , fine-tuning $W _ { a }$ , adding attractors, and using our attention mechanism all contribute towards the final performance. In particular, on $\overline { { \Delta } }$ , the full attention attractor model is $80 \%$ better compared to no regularization, and $10 \%$ relative to to the fixed attractor.
222
+
223
+ # 5 CONCLUSION AND FUTURE WORK
224
+
225
+ Incremental few-shot learning, the ability to jointly predict based on a set of pre-defined concepts as well as additional novel concepts, is an important step towards making machine learning models more flexible and usable in everyday life. In this work, we propose an attention attractor model, which outputs an additional energy function by attending to the set of base classes. We show that recurrent back-propagation is an effective and modular tool for learning energy functions in a general meta-learning setting, whereas truncated back-propagation through time fails to learn functions that converge well. Our attention attractor network is an iterative model that learns to remember the base classes without needing to review examples from the original training set, outperforming baselines that only do one-step inference. Future directions of this work include sequential iterative learning of few-shot novel concepts, and hierarchical memory organization.
226
+
227
+ # REFERENCES
228
+
229
+ Luis B Almeida. A learning rule for asynchronous perceptrons with feedback in a combinatorial environment. In Proceedings of the 1st International Conference on Neural Networks, volume 2, pp. 609–618. IEEE, 1987.
230
+ Marcin Andrychowicz, Misha Denil, Sergio Gomez, Matthew W Hoffman, David Pfau, Tom Schaul, and Nando de Freitas. Learning to learn by gradient descent by gradient descent. In Advances in Neural Information Processing Systems 29 (NIPS), 2016.
231
+ Luca Bertinetto, Joao F. Henriques, Philip H. S. Torr, and Andrea Vedaldi. Meta-learning with ˜ differentiable closed-form solvers. CoRR, abs/1805.08136, 2018.
232
+ Francisco M Castro, Manuel Mar´ın-Jimenez, Nicol ´ as Guil, Cordelia Schmid, and Karteek Alahari. ´ End-to-end incremental learning. In European Conference on Computer Vision (ECCV), 2018.
233
+ Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In Proceedings of the 34th International Conference on Machine Learning (ICML), 2017.
234
+ Victor Garcia and Joan Bruna. Few-shot learning with graph neural networks. In Proceedings of the 6th International Conference on Learning Representations (ICLR), 2018.
235
+ Spyros Gidaris and Nikos Komodakis. Dynamic few-shot visual learning without forgetting. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2018.
236
+
237
+ Bharath Hariharan and Ross B. Girshick. Low-shot visual recognition by shrinking and hallucinating features. In Proceedings of the IEEE International Conference on Computer Vision (ICCV), 2017.
238
+
239
+ 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 (CVPR), pp. 770–778, 2016.
240
+
241
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In Proceedings of the 32nd International Conference on Machine Learning (ICML), 2015.
242
+
243
+ Ronald Kemker and Christopher Kanan. Fearnet: Brain-inspired model for incremental learning. In Proceedings of 6th International Conference on Learning Representations (ICLR), 2018.
244
+
245
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In Proceedings of the 3rd International Conference on Learning Representations (ICLR), 2015.
246
+
247
+ James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska, et al. Overcoming catastrophic forgetting in neural networks. Proceedings of the national academy of sciences (PNAS), pp. 201611835, 2017.
248
+
249
+ Gregory Koch, Richard Zemel, and Ruslan Salakhutdinov. Siamese neural networks for one-shot image recognition. In ICML Deep Learning Workshop, volume 2, 2015.
250
+
251
+ Brenden M. Lake, Ruslan Salakhutdinov, Jason Gross, and Joshua B. Tenenbaum. One shot learning of simple visual concepts. In Proceedings of the 33th Annual Meeting of the Cognitive Science Society (CogSci), 2011.
252
+
253
+ Renjie Liao, Yuwen Xiong, Ethan Fetaya, Lisa Zhang, KiJung Yoon, Xaq Pitkow, Raquel Urtasun, and Richard S. Zemel. Reviving and improving recurrent back-propagation. In Proceedings of the 35th International Conference on Machine Learning (ICML), 2018.
254
+
255
+ 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.
256
+
257
+ Michael McCloskey and Neal J Cohen. Catastrophic interference in connectionist networks: The sequential learning problem. In Psychology of learning and motivation, volume 24, pp. 109–165. Elsevier, 1989.
258
+
259
+ Nikhil Mishra, Mostafa Rohaninejad, Xi Chen, and Pieter Abbeel. A simple neural attentive metalearner. In Proceedings of the 6th International Conference on Learning Representations (ICLR), 2018.
260
+
261
+ Michael C Mozer. Attractor networks. The Oxford companion to consciousness, pp. 86–89, 2009.
262
+
263
+ Devang K Naik and RJ Mammone. Meta-neural networks that learn by learning. In Proceedings of the IEEE International Joint Conference on Neural Networks (IJCNN), 1992.
264
+
265
+ Fernando J Pineda. Generalization of back-propagation to recurrent neural networks. Physical review letters, 59(19):2229, 1987.
266
+
267
+ Sachin Ravi and Hugo Larochelle. Optimization as a model for few-shot learning. In Proceedings of the 5th International Conference on Learning Representations (ICLR), 2017.
268
+
269
+ Sylvestre-Alvise Rebuffi, Alexander Kolesnikov, Georg Sperl, and Christoph H. Lampert. icarl: Incremental classifier and representation learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2017.
270
+
271
+ Mengye Ren, Eleni Triantafillou, Sachin Ravi, Jake Snell, Kevin Swersky, Joshua B. Tenenbaum, Hugo Larochelle, and Richard S. Zemel. Meta-learning for semi-supervised few-shot classification. In Proceedings of 6th International Conference on Learning Representations (ICLR), 2018.
272
+
273
+ Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, et al. Imagenet large scale visual recognition challenge. International Journal of Computer Vision, 115(3):211–252, 2015.
274
+
275
+ Adam Santoro, Sergey Bartunov, Matthew Botvinick, Daan Wierstra, and Timothy Lillicrap. Oneshot learning with memory-augmented neural networks. In Proceedings of the 33rd International Conference on Machine Learning (ICML), 2016.
276
+
277
+ Jurgen Schmidhuber. ¨ Evolutionary principles in self-referential learning, or on learning how to learn: The meta-meta-... hook. Diplomarbeit, Technische Universitat M¨ unchen, M ¨ unchen, 1987. ¨
278
+
279
+ Jake Snell, Kevin Swersky, and Richard S. Zemel. Prototypical networks for few-shot learning. In Advances in Neural Information Processing Systems 30 (NIPS), 2017.
280
+
281
+ Pablo Sprechmann, Siddhant M. Jayakumar, Jack W. Rae, Alexander Pritzel, Adria Puigdom \` enech \` Badia, Benigno Uria, Oriol Vinyals, Demis Hassabis, Razvan Pascanu, and Charles Blundell. Memory-based parameter adaptation. In Proceedings of 6th International Conference on Learning Representations (ICLR), 2018.
282
+
283
+ Flood Sung, Yongxin Yang, Li Zhang, Tao Xiang, Philip H. S. Torr, and Timothy M. Hospedales. Learning to compare: Relation network for few-shot learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2018.
284
+
285
+ Sebastian Thrun. Lifelong learning algorithms. In Learning to learn, pp. 181–209. Springer, 1998.
286
+
287
+ Oriol Vinyals, Charles Blundell, Tim Lillicrap, Koray Kavukcuoglu, and Daan Wierstra. Matching networks for one shot learning. In Advances in Neural Information Processing Systems 29 (NIPS), 2016.
288
+
289
+ Yu-Xiong Wang, Ross B. Girshick, Martial Hebert, and Bharath Hariharan. Low-shot learning from imaginary data. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition CVPR), 2018.
290
+
291
+ Paul J Werbos. Backpropagation through time: what it does and how to do it. Proceedings of the IEEE, 78(10):1550–1560, 1990.
292
+
293
+ Ronald J Williams and Jing Peng. An efficient gradient-based algorithm for on-line training of recurrent network trajectories. Neural computation, 2(4):490–501, 1990.
294
+
295
+ Yuhuai Wu, Mengye Ren, Renjie Liao, and Roger B. Grosse. Understanding short-horizon bias in stochastic meta-optimization. In Proceedings of the 6th International Conference on Learning Representations (ICLR), 2018.
296
+
297
+ Yuxin Wu and Kaiming He. Group normalization. In European Conference on Computer Vision (ECCV), 2018.
298
+
299
+ Richard S Zemel and Michael C Mozer. Localist attractor networks. Neural Computation, 13(5): 1045–1064, 2001.
300
+
301
+ Ciyou Zhu, Richard H Byrd, Peihuang Lu, and Jorge Nocedal. Algorithm 778: L-bfgs-b: Fortran subroutines for large-scale bound-constrained optimization. ACM Transactions on Mathematical Software (TOMS), 23(4):550–560, 1997.
302
+
303
+ # A DATASETS
304
+
305
+ We experiment on two datasets, mini-ImageNet and tiered-ImageNet. Both are sub-sets of imagenet (Russakovsky et al., 2015), with images size reduced to size of $8 4 \times 8 4$ pixels
306
+
307
+ • mini-ImageNet Proposed by Vinyals et al. (2016), mini-ImageNet which contains 100 object classes and 60,000 images. We used the splits proposed by Ravi & Larochelle (2017), where training, validation, and testing have 64, 16, and 20 classes respectively.
308
+
309
+ • tiered-ImageNet Proposed by Ren et al. (2018), tiered-ImageNet is a larger subset of ILSVRC-12. It features a categorical split among training, validation, and testing subsets. The categorical split means that classes that belong to the same high-level category, e.g. “working dog”, are not split between training, validation and test. This is harder task, but one that more truthfully evaluates generalization to new classes. It is also an order of magnitude larger than mini-ImageNet.
310
+
311
+ Details about number of samples are presented in Table 5.
312
+
313
+ Table 5: mini-ImageNet and tiered-ImageNet split statistics
314
+
315
+ <table><tr><td rowspan="2">Classes</td><td rowspan="2">Purpose</td><td colspan="3">mini-ImageNet</td><td colspan="3">tiered-ImageNet</td></tr><tr><td>Split</td><td>N. Cls</td><td>N. Img</td><td>Split</td><td>N. Cls</td><td>N.Img</td></tr><tr><td rowspan="3">Base</td><td>Train</td><td>Train-Train</td><td>64</td><td>38,400</td><td>Train-A-Train</td><td>200</td><td>203,751</td></tr><tr><td>Val</td><td>Train-Val</td><td>64</td><td>18,748</td><td>Train-A-Val</td><td>200</td><td>25,460</td></tr><tr><td>Test</td><td>Train-Test</td><td>64</td><td>19,200</td><td>Train-A-Test</td><td>200</td><td>25,488</td></tr><tr><td rowspan="3">Novel</td><td>Train</td><td>Train-Train</td><td>64</td><td>38,400</td><td>Train-B</td><td>151</td><td>193,996</td></tr><tr><td>Val</td><td>Val</td><td>16</td><td>9,600</td><td>Val</td><td>97</td><td>124,261</td></tr><tr><td>Test</td><td>Test</td><td>20</td><td>12,000</td><td>Test</td><td>160</td><td>206,209</td></tr></table>
316
+
317
+ # A.1 VALIDATION AND TESTING SPLITS FOR BASE CLASSES
318
+
319
+ In standard few-shot learning, meta-training, validation, and test set have disjoint sets of object classes. However, in our incremental few-shot learning setting, to evaluate the model performance on the base class predictions, additional splits of validation and test splits of the meta-training set are required. Splits and dataset statistics are listed in Table 5. For mini-ImageNet, Gidaris & Komodakis (2018) released additional images for evaluating training set, namely “Train-Val” and “Train-Test”. For tiered-ImageNet, we split out $\approx 2 0 \%$ of the images for validation and testing of the base classes.
320
+
321
+ # A.2 NOVEL CLASSES
322
+
323
+ In mini-ImageNet experiments, the same training set is used for both $\mathcal { D } _ { a }$ and $\mathcal { D } _ { b }$ . In order to pretend that the classes in the few-shot episode are novel, following Gidaris & Komodakis (2018), we masked the base classes in $W _ { a }$ , which contains 64 base classes. In other words, we essentially train for a $5 9 + 5$ classification task. We found that under this setting, the progress of meta-learning in the second stage is not very significant, since all classes have already been seen before.
324
+
325
+ In tiered-ImageNet experiments, to emulate the process of learning novel classes during the second stage, we split the training classes into base classes (“Train-A”) with 200 classes and novel classes (“Train-B”) with 151 classes, just for meta-learning purpose. During the first stage the classifier is trained using Train-A-Train data. In each meta-learning episode we sample few-shot examples from the novel classes (Train-B) and a query base set from Train-A-Val.
326
+
327
+ # 200 Base Classes (“Train-A”):
328
+
329
+ n02128757, n02950826, n01694178, n01582220, n03075370, n01531178, n03947888, n03884397, n02883205, n03788195, n04141975, n02992529, n03954731, n03661043, n04606251, n03344393, n01847000, n03032252, n02128385, n04443257, n03394916, n01592084, n02398521, n01748264, n04355338, n02481823, n03146219, n02963159, n02123597, n01675722, n03637318, n04136333, n02002556, n02408429, n02415577, n02787622, n04008634, n02091831, n02488702, n04515003, n04370456, n02093256, n01693334, n02088466, n03495258, n02865351, n01688243, n02093428, n02410509, n02487347, n03249569, n03866082, n04479046, n02093754, n01687978, n04350905, n02488291, n02804610, n02094433, n03481172, n01689811, n04423845, n03476684, n04536866, n01751748, n02028035, n03770439, n04417672, n02988304, n03673027, n02492660, n03840681, n02011460, n03272010, n02089078, n03109150, n03424325, n02002724, n03857828, n02007558, n02096051, n01601694, n04273569, n02018207, n01756291, n04208210, n03447447, n02091467, n02089867, n02089973, n03777754, n04392985, n02125311, n02676566, n02092002, n02051845, n04153751, n02097209, n04376876, n02097298, n04371430, n03461385, n04540053, n04552348, n02097047, n02494079, n03457902, n02403003, n03781244, n02895154, n02422699, n04254680, n02672831, n02483362, n02690373, n02092339, n02879718, n02776631, n04141076, n03710721, n03658185, n01728920, n02009229, n03929855, n03721384, n03773504, n03649909, n04523525, n02088632, n04347754, n02058221, n02091635, n02094258, n01695060, n02486410, n03017168, n02910353, n03594734, n02095570, n03706229, n02791270, n02127052, n02009912, n03467068, n02094114, n03782006, n01558993, n03841143, n02825657, n03110669, n03877845, n02128925, n02091032, n03595614, n01735189, n04081281, n04328186, n03494278, n02841315, n03854065, n03498962, n04141327, n02951585, n02397096, n02123045, n02095889, n01532829, n02981792, n02097130, n04317175, n04311174, n03372029, n04229816, n02802426, n03980874, n02486261, n02006656, n02025239, n03967562, n03089624, n02129165, n01753488, n02124075, n02500267, n03544143, n02687172, n02391049, n02412080, n04118776, n03838899, n01580077, n04589890, n03188531, n03874599, n02843684, n02489166, n01855672, n04483307, n02096177, n02088364.
330
+
331
+ # 151 Novel Classes (“Train-B”):
332
+
333
+ n03720891, n02090379, n03134739, n03584254, n02859443, n03617480, n01677366, n02490219, n02749479, n04044716, n03942813, n02692877, n01534433, n02708093, n03804744, n04162706, n04590129, n04356056, n01729322, n02091134, n03788365, n01739381, n02727426, n02396427, n03527444, n01682714, n03630383, n04591157, n02871525, n02096585, n02093991, n02013706, n04200800, n04090263, n02493793, n03529860, n02088238, n02992211, n03657121, n02492035, n03662601, n04127249, n03197337, n02056570, n04005630, n01537544, n02422106, n02130308, n03187595, n03028079, n02098413, n02098105, n02480855, n02437616, n02123159, n03803284, n02090622, n02012849, n01744401, n06785654, n04192698, n02027492, n02129604, n02090721, n02395406, n02794156, n01860187, n01740131, n02097658, n03220513, n04462240, n01737021, n04346328, n04487394, n03627232, n04023962, n03598930, n03000247, n04009552, n02123394, n01729977, n02037110, n01734418, n02417914, n02979186, n01530575, n03534580, n03447721, n04118538, n02951358, n01749939, n02033041, n04548280, n01755581, n03208938, n04154565, n02927161, n02484975, n03445777, n02840245, n02837789, n02437312, n04266014, n03347037, n04612504, n02497673, n03085013, n02098286, n03692522, n04147183, n01728572, n02483708, n04435653, n02480495, n01742172, n03452741, n03956157, n02667093, n04409515, n02096437, n01685808, n02799071, n02095314, n04325704, n02793495, n03891332, n02782093, n02018795, n03041632, n02097474, n03404251, n01560419, n02093647, n03196217, n03325584, n02493509, n04507155, n03970156, n02088094, n01692333, n01855032, n02017213, n02423022, n03095699, n04086273, n02096294, n03902125, n02892767, n02091244, n02093859, n02389026.
334
+
335
+ # B 5-SHOT RESULTS
336
+
337
+ We show here additional results on 5-shot learning. In table ?? we compare RBP to BPTT optimization.
338
+
339
+ Table 6: Learning an attention attractor network using damped Neumann RBP vs. truncated BPTT. Models are on evaluated on the validation set of tiered-ImageNet. During evaluation, “\*” models are solved till convergence using a second-order optimizer.
340
+
341
+ <table><tr><td>5-shot</td><td>Base</td><td>Base+</td><td>△a</td><td>Novel</td><td>Novel+</td><td>△b</td><td>Both</td><td>A</td></tr><tr><td>BPTT20 Steps</td><td>61.48</td><td>61.05</td><td>-0.43</td><td>47.72 ± 0.37</td><td>41.72 ± 0.37</td><td>-6.00</td><td>51.39</td><td>-3.21</td></tr><tr><td>BPTT 100 Steps</td><td>61.75</td><td>61.28</td><td>-0.47</td><td>59.51 ± 0.37</td><td>55.79 ± 0.36</td><td>-3.72</td><td>58.53</td><td>-2.10</td></tr><tr><td>BPTT 200 Steps</td><td>61.59</td><td>60.79</td><td>-0.79</td><td>62.50 ± 0.39</td><td>60.40 ± 0.38</td><td>-2.10</td><td>60.60</td><td>-1.44</td></tr><tr><td>BPTT 20 Steps *</td><td>61.49</td><td>7.29</td><td>-54.20</td><td>37.16± 0.33</td><td>37.11 ± 0.33</td><td>-0.05</td><td>22.20</td><td>-27.12</td></tr><tr><td>BPTT 100 Steps *</td><td>61.46</td><td>4.00</td><td>-57.45</td><td>41.68± 0.36</td><td>41.67 ± 0.36</td><td>0.00</td><td>22.84</td><td>-28.73</td></tr><tr><td>BPTT 200 Steps *</td><td>61.37</td><td>5.63</td><td>-55.74</td><td>43.74± 0.37</td><td>43.73 ± 0.36</td><td>0.00</td><td>24.68</td><td>-27.87</td></tr><tr><td>Ours (RBP 20 Steps)</td><td>61.80</td><td>61.28</td><td>-0.53</td><td>63.40±0.39</td><td>62.09± 0.39</td><td>-1.31</td><td>61.68</td><td>-0.92</td></tr></table>
md/train/rydeCEhs-/rydeCEhs-.md ADDED
@@ -0,0 +1,311 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SMASH: ONE-SHOT MODEL ARCHITECTURESEARCH THROUGH HYPERNETWORKS
2
+
3
+ Andrew Brock, Theodore Lim, & J.M. Ritchie
4
+
5
+ # Nick Weston
6
+
7
+ School of Engineering and Physical Sciences
8
+ Heriot-Watt University
9
+ Edinburgh, UK
10
+ {ajb5, t.lim, j.m.ritchie}@hw.ac.uk
11
+ Renishaw plc
12
+ Research Ave, North
13
+ Edinburgh, UK
14
+ Nick.Weston@renishaw.com
15
+
16
+ # ABSTRACT
17
+
18
+ Designing architectures for deep neural networks requires expert knowledge and substantial computation time. We propose a technique to accelerate architecture selection by learning an auxiliary HyperNet that generates the weights of a main model conditioned on that model’s architecture. By comparing the relative validation performance of networks with HyperNet-generated weights, we can effectively search over a wide range of architectures at the cost of a single training run. To facilitate this search, we develop a flexible mechanism based on memory read-writes that allows us to define a wide range of network connectivity patterns, with ResNet, DenseNet, and FractalNet blocks as special cases. We validate our method (SMASH) on CIFAR-10 and CIFAR-100, STL-10, ModelNet10, and Imagene $3 2 \mathbf { x } 3 2$ , achieving competitive performance with similarly-sized handdesigned networks.
19
+
20
+ # 1 INTRODUCTION
21
+
22
+ The high performance of deep neural nets is tempered by the cost of extensive engineering and validation to find the best architecture for a given problem. High-level design decisions such as depth, units per layer, and layer connectivity are not always obvious, and the success of models such as Inception (Szegedy et al., 2016), ResNets (He et al., 2016), FractalNets (Larsson et al., 2017) and DenseNets (Huang et al., 2017) demonstrates the benefits of intricate design patterns. Even with expert knowledge, determining which design elements to weave together requires ample experimentation.
23
+
24
+ In this work, we propose to bypass the expensive procedure of fully training candidate models by instead training an auxiliary model, a HyperNet (Ha et al., 2017), to dynamically generate the weights of a main model with variable architecture. Though these generated weights are worse than freely learned weights for a fixed architecture, we leverage the observation (Li et al., 2017) that the relative performance of different networks early in training (i.e. some distance from the eventual optimum) often provides a meaningful indication of performance at optimality. By comparing validation performance for a set of architectures using generated weights, we can approximately rank numerous architectures at the cost of a single training run.
25
+
26
+ To facilitate this search, we develop a flexible scheme based on memory read-writes that allows us to define a diverse range of architectures, with ResNets, DenseNets, and FractalNets as special cases. We validate our one-Shot Model Architecture Search through HyperNetworks (SMASH) for Convolutional Neural Networks (CNN) on CIFAR-10 and CIFAR-100 (Krizhevsky and Hinton, 2009), Imagene $3 2 \mathrm { x } 3 2$ (Chrabaszcz et al., 2017), ModelNet10 (Wu et al., 2015), and STL-10 (Coates et al., 2011), achieving competitive performance with similarly-sized hand-designed networks.
27
+
28
+ # 2 RELATED WORK
29
+
30
+ Modern practical methods for optimizing hyperparameters rely on random search (Bergstra and Bengio, 2012) or Bayesian Optimization (BO) (Snoek et al., 2012; 2015), treating the model performance as a black box. While successful, these methods require multiple training runs for evaluation (even when starting with a good initial model) and, in the case of BO, are not typically used to specify variable-length settings such as the connectivity and structure of the model under consideration. Relatedly, bandit-based methods (Li et al., 2017) provide a framework for efficiently exploring the hyperparameter space by employing an adaptive early-stopping strategy, allocating more resources to models which show promise early in training.
31
+
32
+ Evolutionary techniques (Floreano et al.; Stanley et al.; Suganuma et al., 2017; Wierstra et al., 2005) offer a flexible approach for discovering variegated models from trivial initial conditions, but often struggle to scale to deep neural nets where the search space is vast, even with enormous compute (Real et al., 2017).
33
+
34
+ Reinforcement learning methods (Baker et al., 2017; Zoph and Le, 2017) have been used to train an agent to generate network definitions using policy gradients. These methods start from trivial architectures and discover models that achieve very high performance, but can require twelve to fifteen thousand full training runs to arrive at a solution.
35
+
36
+ The method that most resembles our own is that of Saxe et al. (Saxe et al., 2011), who propose to efficiently explore various architectures by training only the output layer of convolutional networks with random convolutional weights. While more efficient than fully training an entire network end-toend, this method does not appear to scale to deeper networks (Yosinski et al., 2014). Our method is conceptually similar, but replaces random weights with weights generated through HyperNets (Ha et al., 2017), which are one of a class of techniques for dynamically adapting weights through use of an auxiliary model (Denil et al., 2013; Jia et al., 2016; Rebuffi et al., 2017; Schmidhuber, 1992). In our case we learn a transform from a binary encoding of an architecture to the weight space, rather than learning to adapt weights based on the model input.
37
+
38
+ Our method is explicitly designed to evaluate a wide range of model configurations (in terms of connectivity patterns, depth, and width) but does not address other hyperparameters such as regularization, learning rate schedule, weight initialization, or data augmentation. Unlike the aforementioned evolutionary or RL methods, we explore a somewhat pre-defined design space, rather than starting with a trivial model and designating a set of available network elements. While we still consider a rich set of architectures, our method cannot discover wholly new structures on its own and is constrained in that it only dynamically generates a specific subset of the model parameters. Additionally, although our method is not evolutionary, our encoding scheme is reminiscent of CGP (Miller and Thomson, 2000).
39
+
40
+ Stochastic regularization techniques such as Dropout (Srivastava et al., 2012), Swapout (Singh et al., 2016), DropPath (Larsson et al., 2017) or stochastic depth (Huang et al., 2016) superficially resemble our method, in that they obtain variable configurations by randomly dropping connectivity paths in a fixed network architecture. Convolutional neural fabrics (Saxena and Verbeek, 2016), for example, leverage this idea to attempt to train one large network as an implicit ensemble of all subnetworks produced through dropping paths. A key element that sets our method apart is that the weights for each node in our network are dynamically generated, rather than fixed; if a Dropout ensemble were to visit a unit that had not previously been trained, the unit’s weights would be completely untuned. Our method generalizes even to previously unseen architectures, and the network we train under stochastic conditions is merely a proxy we use to evaluate network configurations, rather than the final model.
41
+
42
+ # 3 ONE-SHOT MODEL ARCHITECTURE SEARCH THROUGH HYPERNETWORKS
43
+
44
+ In SMASH (Algorithm 1), our goal is to rank a set of neural network configurations relative to one another based on each configuration’s validation performance, which we accomplish using weights generated by an auxiliary network. At each training step, we randomly sample a network architecture, generate the weights for that architecture using a HyperNet, and train the entire system end-to-end through backpropagation. When the model is finished training, we sample a number of random architectures and evaluate their performance on a validation set, using weights generated by the HyperNet. We then select the architecture with the best estimated validation performance and train its weights normally.
45
+
46
+ <table><tr><td>Algorithm1SMASH</td></tr><tr><td></td></tr></table>
47
+
48
+ <table><tr><td>input Space of all candidate architectures, Rc Initialize HyperNet weights H loop</td><td></td></tr><tr><td>Sample input minibatch xi,random architecture c and architecture weights W = H(c) Get training error Et = fc(W,xi)= fc(H(c),xi),backprop and update H</td><td rowspan="3"></td></tr><tr><td>end loop</td></tr><tr><td>loop Sample random c and evaluate error on validation set Ev = fc(H(c),xv)</td></tr><tr><td>end loop</td><td rowspan="3"></td></tr><tr><td>Fix architecture and train normally with freely-varying weights W</td></tr><tr><td></td></tr></table>
49
+
50
+ SMASH comprises two core components: the method by which we sample architectures, and the method by which we sample weights for a given architecture. For the former, we develop a novel "memory-bank" view of feed-forward networks that permits sampling complex, branching topologies, and encoding said topologies as binary vectors. For the latter, we employ a HyperNet (Ha et al., 2017) that learns to map directly from the binary architecture encoding to the weight space.
51
+
52
+ We hypothesize that so long as the HyperNet learns to generate reasonable weights, the validation error of networks with generated weights will correlate with the performance when using normally trained weights, with the difference in architecture being the primary factor of variation. Throughout the paper, we refer to the entire apparatus during the first part of training (the HyperNet, the variable architecture main network, and any freely learned main network weights) as the SMASH network, and we refer to networks trained with freely learned weights in the second stage as resulting networks.
53
+
54
+ # 3.1 DEFINING VARIABLE NETWORK CONFIGURATIONS
55
+
56
+ ![](images/05a14337291e284a70855dd35fb712c5b232f11f6ddcb43246c9185b9e925552.jpg)
57
+ Figure 1: Memory-Bank representations of ResNet, DenseNet, and FractalNet blocks.
58
+
59
+ In order to explore a broad range of architectures with variable depth, connectivity patterns, layer sizes and beyond, we require a flexible mechanism for defining such architectures, which we can also easily encode into a conditioning vector for the HyperNet. To this end, we introduce a "memory-bank" view of feed-forward networks.
60
+
61
+ Rather than viewing a network as a series of operations applied to a forward-propagating signal, we view a network as having a set of memory banks (initially tensors filled with zeros) which it can read and write. Each layer is thus an operation that reads data from a subset of memory, modifies the data, and writes the result to another subset of memory. For a single-branch architecture, the network has one large memory bank it reads and overwrites (or, for a ResNet, adds to) at each op. A branching architecture such as a DenseNet reads from all previously written banks and writes to an empty bank, and a FractalNet follows a more complex read-write pattern, as shown in Figure 1.
62
+
63
+ Our base network structure consists of multiple blocks (Figure 2(b)), where each block has a set number of memory banks at a given spatial resolution, with successively halved spatial resolutions as in most CNN architectures. Downsampling is accomplished via a 1x1 convolution followed by average pooling (Huang et al., 2017), with the weights of the 1x1 convolution and the fully-connected output layer being freely learned, rather than generated.
64
+
65
+ ![](images/c7a2ac2222c18e7a0855ff9b2100627098d981f68cc17e638b413d86f1f3d840.jpg)
66
+ Figure 2: (a) Structure of one op: A 1x1 conv operating on the memory banks, followed by up to 2 stem block 1 trans block 2 trans block 3parallel paths of 2 convolutions each. (b) Basic network skeleton.
67
+
68
+ Block 1 Block 2 Block 3When sampling an architecture, the number of banks and the number of channels per bank are randomly sampled at each block. When defining each layer within a block, we randomly select the Block 1 Block 2 Block 3read-write pattern and the definition of the op to be performed on the read data. When reading from multiple banks we concatenate the read tensors along the channel axis, and when writing to banks we add to the tensors currently in each bank. For all reported experiments, we only read and write from banks at one block (i.e. one spatial resolution), although one could employ resizing to allow reading and writing from any block, similar to (Saxena and Verbeek, 2016).
69
+
70
+ Each op comprises a 1x1 convolution (reducing the number of incoming channels), followed by a variable number of convolutions interleaved with nonlinearities, as shown in Figure 2(a). We randomly select which of the four convs are active, along with their filter size, dilation factor, number of groups, and the number of output units (i.e. the layer width). The number of output channels of the 1x1 conv is some factor of the width of the op, chosen as the "bottleneck ratio" hyperparameter.
71
+
72
+ The weights for the 1x1 convolution are generated by the HyperNet as described in Section 3.2, while the other convolutions are normally learned parameters. To ensure variable depth, we learn a single set of 4 convolutions for each block, and share it across all ops within a block. We limit the max filter size and number of output units, and when a sampled op uses less than the maximum of either, we simply slice the weight tensor to the required size. The fixed transition convolutions and output layer employ this same slicing based on the number of incoming non-empty memory banks. Exact details regarding this scheme are available in the appendix.
73
+
74
+ In designing our scheme, we strive to minimize the number of static learned parameters, placing the majority of the network’s capacity in the HyperNet. A notable consequence of this goal is that we only employ BatchNorm (Ioffe and Szegedy, 2015) at downsample layers and before the output layer, as the layer-specific running statistics are difficult to dynamically generate. We experimented with several different normalization schemes including WeightNorm (Salimans and Kingma, 2016), LayerNorm (Ba et al., 2016) and NormProp (Arpit et al., 2016) but found them to be unstable in training.
75
+
76
+ Instead, we employ a simplified version of WeightNorm where we divide the entirety of each generated 1x1 filter by its Euclidean norm (rather than normalizing each channel separately), which we find to work well for SMASH and to only result in a minor drop in accuracy when employed in fixed-architecture networks. No other convolution within an op is normalized.
77
+
78
+ # 3.2 LEARNING TO MAP ARCHITECTURES TO WEIGHTS
79
+
80
+ A HyperNet (Ha et al., 2017) is a neural net used to parameterize the weights of another network, the main network. For a Static HyperNet with parameters $H$ , the main network weights $W$ are some function (e.g. a multilayer perceptron) of a learned embedding $z$ , such that the number of learned weights is typically smaller than the full number of weights for the main network. For a Dynamic HyperNet, the weights $W$ are generated conditioned on the network input $x$ , or, for recurrent networks, on the current input $x _ { t }$ and the previous hidden state $h _ { t - 1 }$ .
81
+
82
+ We propose a variant of a Dynamic HyperNet which generates the weights $W$ based on a tensor encoding of the main network architecture $c$ . Our goal is to learn a mapping $W = H ( c )$ that is reasonably close to the optimal $W$ for any given $c$ , such that we can rank each $c$ based on the validation error using HyperNet-generated weights. We thus adopt a scheme for the layout of $c$ to enable sampling of architectures with wildly variable topologies, compatibility with the toolbox available in standard libraries, and to make $c$ ’s dimensions as interpretable as possible.
83
+
84
+ ![](images/8ee81e6737ffba29e0141a22b3f8e4da30d5b4f02cda109985cb668ab2803d2e.jpg)
85
+ Figure 3: An unrolled graph, its equivalent memory-bank representation, and its encoded embedding.
86
+
87
+ Our HyperNet is fully convolutional, such that the dimensionality of the output tensor $W$ varies with the dimensionality of the input $c$ , which we make a 4D tensor of the standard format Batch x Channel x Height $\mathbf { X }$ Width; the batch size is set to 1 so that no output elements are wholly independent. This allows us to vary the depth and width of the main network by increasing the height or width of $c$ Under this scheme, every slice of the spatial dimensions of $W$ corresponds to a specific subset of $c$ Information describing the op that uses that $W$ subset is embedded in the channel dimension of the corresponding $c$ slice.
88
+
89
+ For example, if an op reads from memory banks 1, 2, and 4, then writes to 2 and 4, then the first, second, and fourth channels of the corresponding slice of $c$ will be filled with 1s (indicating the read pattern) and the sixth and eighth channels of that slice will be filled with 1s (indicating the write pattern). The rest of the op description is encoded in the remaining channels in a similar 1-hot fashion. We only encode into the width-wise extent of $c$ based on the number of output units of the op, so elements of $c$ which do not correspond to any elements of $W$ are empty.
90
+
91
+ A naïve implementation of this scheme might require the size of $c$ to be equal to the size of $W$ , or have the HyperNet employ spatial upsampling to produce more elements. We found these choices poor, and instead employ a channel-based weight-compression scheme that reduces the size of $c$ and keeps the representational power of the HyperNet proportional to that of the main networks. We make the spatial extent of $c$ some fraction $k$ of the size of $W$ , and place $k$ units at the output of the HyperNet. We then reshape the resulting $1 \times k \times h e i g h t \times w i d t h$ tensor to the required size of W . $k$ is chosen to be $D N ^ { 2 }$ , where $N$ is the minimum memory bank size, and $D$ is a "depth compression" hyperparameter that represents how many slices of $W$ correspond to a single slice of $c$ . Complete details regarding this scheme (and the rest of the encoding strategy) are available in Appendix B.
92
+
93
+ # 4 EXPERIMENTS
94
+
95
+ We apply SMASH to several datasets, both for the purposes of benchmarking against other techniques, and to investigate the behavior of SMASH networks. Principally, we are interested in determining whether the validation error of a network using SMASH-generated weights (the "SMASH score") correlates with the validation of a normally trained network, and if so, the conditions under which the correlation holds. We are also interested in the transferability of the learned architectures to new datasets and domains, and how this relates to normal (weight-wise) transfer learning.
96
+
97
+ Our publicly available code1 is written in PyTorch (Paszke et al., 2017) to leverage dynamic graphs, and explicitly defines each sampled network in line with the memory-bank view to avoid obfuscating its inner workings behind (potentially more efficient) abstractions. We omit many hyperparameter details for brevity; full details are available in the appendices, along with visualizations of our best-found architectures.
98
+
99
+ ![](images/595b72d55146cf93b083899f2b6334bcbbccb572a57559de8ec2d5ccfa7d1e5c.jpg)
100
+ Figure 4: True error and SMASH validation error for 50 different random architectures on CIFAR-100. Red line is a least-squares best fit.
101
+
102
+ # 4.1 TESTING THE SMASH CORRELATION
103
+
104
+ First, we train a SMASH network for 300 epochs on CIFAR-100, using a standard annealing schedule (Huang et al., 2017), then sample 250 random architectures and evaluate their SMASH score on a held-out validation set formed of 5,000 random examples from the original training set. We then sort the architectures by their SMASH score and select every 5th architecture for full training and evaluation, using an accelerated training schedule of 30 epochs. For these networks, which we deem SMASHv1, the architecture uses a fixed memory bank size (though a variable number of banks in each block), a single fixed 3x3 conv in the main body of the op (rather than the variable $2 \mathbf { x } 2$ array of convs), a single group, and a fixed bottleneck ratio of 4. The variable elements comprise the read-write pattern, the number of output units, and the dilation factor of the $3 \mathrm { x } 3$ filter. When sampling architectures, we allocate a random, upper-bounded compute budget to each block.
105
+
106
+ Under these conditions, we observe a correlation (Figure 4) between the SMASH score and the true validation performance, suggesting that SMASH-generated weights can be used to rapidly compare architectures. It is critical not to overstate this claim; this test is arguably a single datapoint indicating that the correlation holds in this scenario, but neither guarantees the correlation’s generality nor implies the range of conditions for which it will hold. We thus conduct a more thorough investigation of this correlation.
107
+
108
+ We expect, based on preliminary experiments detailed in Appendix C, that the two key variables determining the strength of the correlation are the capacity of the HyperNet, and the ratio of HyperNetgenerated weights to freely learned weights. For the former, we reason that if the HyperNet lacks representational capacity, then it will be unable to learn an acceptable mapping between architectures and weights, and the generated weights will be too far from optimal to permit ranking. For the latter, we reason that if the main network has too many freely-learned weights relative to the number of dynamically generated weights, too much of its capacity will be "static" and ill-adapted to the wide range of architectures considered.
109
+
110
+ Following these hypotheses, we repeat the first experiment multiple times, varying the architecture of the HyperNet as well as the $g$ hyperparameter, which controls the maximum layer width and consequentially the ratio of freely-learned vs dynamic weights. A higher value of $g$ corresponds to relatively fewer dynamically generated weights. We consider three different ratios and five different HyperNet configurations. For each setting of $g$ we begin by training five different SMASH networks, each employing one of the candidate configurations. After training, we sample 500 random architectures as before, and then evaluate all five SMASH scores, rank them according to their average, and then train every 10th resulting network normally. We train the resulting networks for a full 100 epochs (as opposed to the previous shortened schedule) and repeat training runs with a total of 5 different random seeds. Finally, we evaluate the strength and significance of the correlation between SMASH score and resulting validation performance (averaged for each architecture across runs) using Pearson’s R.
111
+
112
+ Table 1: Pearson’s R $( \rho )$ and p-values (p) for various settings of $g$ .
113
+
114
+ <table><tr><td>Architecture</td><td>Params</td><td>p,g=4</td><td>p,g=4</td><td>p,g=8</td><td>p,g=8</td><td>p,g=16</td><td>p,g=16</td></tr><tr><td>G=[10,10,10],D=[12,15,8]</td><td>4M</td><td>-0.07</td><td>0.62</td><td>0.25</td><td>0.09</td><td>0.02</td><td>0.9</td></tr><tr><td>G=[20,20,20],D=[8,10,4]</td><td>5M</td><td>0.15</td><td>0.30</td><td>0.20</td><td>0.17</td><td>-0.09</td><td>0.53</td></tr><tr><td>G=[20,20,20],D=[12,15,8]</td><td>7M</td><td>0.31</td><td>0.02</td><td>0.24</td><td>0.09</td><td>0.05</td><td>0.76</td></tr><tr><td>G=[25,25,25],D=[16,16,16]</td><td>12M</td><td>0.38</td><td>0.06</td><td>0.24</td><td>0.09</td><td>0.04</td><td>0.77</td></tr><tr><td>G=[25,25,25],D=[25,25,25]</td><td>24M</td><td>0.04</td><td>0.77</td><td>0.20</td><td>0.17</td><td>0.11</td><td>0.45</td></tr></table>
115
+
116
+ The results of this study are reported in Table 1. The first column details the choices of growth rate and depth for each of the three blocks of the HyperNet, and the second column the number of parameters for each architecture. The values of $g { = } 4$ , $g { = } 8$ , and $g { = } 1 6$ roughly correspond to average freely-learned vs dynamic weight ratios of 1:4, 1:2, and 2:1, though these vary somewhat with individual sampled architectures.
117
+
118
+ Several trends are visible in this table. First, for $g { = } 4$ , we note that the strength of correlation increases with increased HyperNet capacity up to the fourth architecture with 12M parameters, but the correlation breaks down for the largest architecture. This suggests that the strength of correlation can indeed depend on the capacity of the HyperNet, but also that the HyperNet is either potentially susceptible to overfitting or that too large a HyperNet becomes too difficult to train and produces poor weights. Second, for $g { = } 8$ , we note that the correlation varies little with changes in architecture, but is weaker than the best correlations from $g = 4$ . This suggests that for a middling ratio, the capacity of the HyperNet has less effect on the correlation as there are fewer weights for it to adapt, but the strength of the correlation is weaker as each set of sampled weights is consequentially less optimal than for $g = 4$ . Third, we note a complete breakdown of the correlation for $g { = } 1 6$ , which is in line with our expectation that placing too much capacity in a single set of statically learned weights will prevent the SMASH network from properly adapting to individual architectures.
119
+
120
+ # 4.2 ARCHITECTURAL GRADIENT DESCENT BY PROXY
121
+
122
+ As an additional test of our method, we examine whether or not the HyperNet has learned to take into account the architecture definition in $c$ , or whether it ignores $c$ and naively generates an unconditional subspace of weights that happen to work well. We "trick" the HyperNet by sampling one architecture, but asking it to generate the weights for a different architecture by corrupting the encoding tensor $c$ (e.g. by shuffling the dilation values). For a given architecture, we find that SMASH validation performance is consistently highest when using the correct encoding tensor, suggesting that the HyperNet has indeed learned a passable mapping from architecture to weights.
123
+
124
+ Following this, we posit that if the HyperNet learns a meaningful mapping $W = H ( c )$ , then the classification error approximate meas $E = f ( W , x ) = f ( H ( c ) , x )$ can be backpropagated to find to the architecture itself. If thi $\textstyle { \frac { d E } { d c } }$ , providing anolds true, then perturbing the architecture according to the $\frac { \dot { d } E } { d c }$ vector (within the constraints of our scheme) should allow us to guide the architecture search through a gradient descent-like procedure. Our preliminary tests with this idea did not yield better SMASH scores than randomly perturbing the architectural definition, though we suspect that this was in part due to our lack of an intuitively satisfying update rule for the discrete architecture space.
125
+
126
+ # 4.3 TRANSFER LEARNING
127
+
128
+ Models with weights initially learned on one large dataset frequently outperform models trained from scratch on a smaller dataset; it follows that architectures might display the same behavior. We test on STL-10 (Coates et al., 2011), a small dataset of $9 6 \mathbf { x } 9 6$ images similar to the CIFAR datasets. We compare the performance of the best-found architecture from CIFAR-100 (with weights trained from scratch on STL-10) to the best-found architecture from running SMASH on STL-10, and a
129
+
130
+ WRN baseline. For these experiments, we make use of the full 5,000 images in the training set; in the following section we also include comparisons against a WRN baseline using the recommended 10-fold training split.
131
+
132
+ In this case, we find that the best-found architecture from CIFAR-100 outperforms the best-found architecture from STL-10, achieving $1 7 . 5 4 \%$ and $2 0 . 2 7 5 \%$ error, respectively. For reference, a baseline WRN28-10 and WRN40-4 achieve respective $1 5 . 4 3 \%$ and $1 6 . 0 6 \%$ errors. This presents an interesting phenomenon: one the one hand, one might expect the architecture discovered on STL-10 to be better-tuned to STL-10 because it was specifically learned on that dataset. On the other hand, CIFAR-100 has significantly more training examples, potentially making it a better dataset for distinguishing between good architectures, i.e. accuracy on CIFAR-100 is more indicative of generality. The better performance of the architecture found on CIFAR-100 would seem to favor the latter hypothesis, suggesting that architecture search benefits from larger training sets more so than domain specificity.
133
+
134
+ We next investigate how well our best-found CIFAR-100 architecture performs on ModelNet10 (Wu et al., 2015), a 3D object classification benchmark. We train on the voxelated instances of the ModelNet10 training set using the settings of (Brock et al., 2016), and report accuracy on the ModelNet10 test set. Our 8M parameter model achieves an accuracy of $9 3 . 2 8 \%$ , compared to a $9 3 . 6 1 \%$ accuracy from a hand-designed Inception-ResNet (Brock et al., 2016) with 18M parameters trained on the larger ModelNet40 dataset.
135
+
136
+ # 4.4 BENCHMARKING
137
+
138
+ We run SMASH on CIFAR-10 and 100, augmenting our search space from the initial correlation experiment to include variable filter sizes, variable groups, and the full variable op structure shown in Figure 2, and denote the resulting networks SMASHv2. We report the final test performance of the two resulting networks with the highest SMASH scores on CIFAR-10 and 100 in Table 2.
139
+
140
+ Next, we take our best-found SMASHv2 architecture from CIFAR-100 and train it on STL-10 (Coates et al., 2011) using the recommended 10-fold training splits, and ImageNet32x32 (Chrabaszcz et al., 2017). We compare against Wide ResNet baselines from our own experiments in Tables 3 and those reported by (Chrabaszcz et al., 2017) in 4. Noting the better performance of WRN40-4 on STL-10, we also train a variant of our best architecture with only a single main convolution and 3x3 filters, to comparably reduce the number of parameters.
141
+
142
+ Table 2: Error rates $( \% )$ on CIFAR-10 and CIFAR-100 with standard data augmentation $( + )$
143
+
144
+ <table><tr><td>Method</td><td>Resources</td><td>Depth</td><td>Params</td><td>C10+</td><td>C100+</td></tr><tr><td>FractalNet (Larsson et al.,2017)</td><td></td><td>21</td><td>38.6M</td><td>5.22</td><td>23.30</td></tr><tr><td>with Dropout/Drop-path</td><td></td><td>21</td><td>38.6M</td><td>4.60</td><td>23.73</td></tr><tr><td rowspan="2">Stochastic Depth (Huang et al.,2016)</td><td rowspan="2"></td><td>110</td><td>1.7M</td><td>5.23</td><td>24.58</td></tr><tr><td>1202</td><td>10.2M</td><td>4.91</td><td>-</td></tr><tr><td colspan="2">WideResNet (Zagoruyko and Komodakis.,2016)</td><td>16</td><td>11.0M</td><td>4.81</td><td>22.07</td></tr><tr><td colspan="2">DenseNet-BC (k = 24) (Huang et al.,2017)</td><td>28</td><td>36.5M</td><td>4.17</td><td>20.50</td></tr><tr><td colspan="2">DenseNet-BC (k = 40)</td><td>250</td><td>15.3M</td><td>3.62</td><td>17.60</td></tr><tr><td colspan="2">Shake-Shake (Gastaldi,2017)</td><td>190</td><td>25.6M</td><td>3.46</td><td>17.18</td></tr><tr><td colspan="2">NASwRL(Zoph and Le,2017) 800 GPUs,? days</td><td>26</td><td>26.2M</td><td>2.86</td><td>15.85</td></tr><tr><td colspan="2">NASNet-A(Zoph et al.,2017)</td><td>39</td><td>32.0M</td><td>3.84</td><td>--</td></tr><tr><td colspan="2">MetaQNN (Baker et al., 2017) 10 GPUs,8-10 days</td><td>20</td><td>3.3M</td><td>3.41</td><td></td></tr><tr><td colspan="2">Large-Scale Evolution (Real et al., 2017) 250 GPUs,10 days</td><td>9</td><td>11.18M</td><td>6.92</td><td>27.14</td></tr><tr><td colspan="2"></td><td>-</td><td>5.4M</td><td>5.40</td><td>-</td></tr><tr><td colspan="2">CGP-CNN (Suganuma et al.,2017)</td><td>-</td><td>40.4 M</td><td>-</td><td>23.7</td></tr><tr><td colspan="2">SMASHv1 (ours) 1 GPU,3 days</td><td>-</td><td>1.68M</td><td>5.98</td><td>-</td></tr><tr><td colspan="2">SMASHv2 (ours)</td><td>116 211</td><td>4.6M 16M</td><td>5.53 4.03</td><td>22.07</td></tr></table>
145
+
146
+ Our SMASHv2 nets with 16M parameters achieve final test errors of $2 0 . 6 0 \%$ on CIFAR-100 and $4 . 0 3 \%$ on CIFAR-10. This performance is not quite on par with state-of-the-art hand-designed networks, but compares favorably to other automatic design methods that employ RL (Baker et al., 2017; Zoph and Le, 2017) or evolutionary methods (Real et al., 2017; Suganuma et al., 2017). Our networks outperform Large-Scale Evolution (Real et al., 2017) despite requiring significantly less time to discover (though not starting from trivial models) and 10 orders of magnitude less compute. Our method outperforms MetaQNN (Baker et al., 2017) but lags behind Neural Architecture Search (Zoph and Le, 2017), though both methods require vastly more computation time, and unlike Neural Architecture Search, we do not postprocess our discovered architectures through grid search.
147
+
148
+ Table 3: Error rates $( \% )$ on STL-10.
149
+
150
+ <table><tr><td>Model</td><td>Params</td><td>Error</td></tr><tr><td>WRN-40-4</td><td>8.95M</td><td>35.02 ± 1.14</td></tr><tr><td>WRN-28-10</td><td>36.5M</td><td>36.69 ± 2.06</td></tr><tr><td>SMASHv2</td><td>16.2M</td><td>41.52 ± 2.10</td></tr><tr><td>SMASHv2 (3x3)</td><td>4.38M</td><td>37.76 ± 0.58</td></tr></table>
151
+
152
+ Table 4: Error rates $( \% )$ on Imagenet32x32.
153
+
154
+ <table><tr><td>Model</td><td>Params</td><td>Top-1</td><td>Top-5</td></tr><tr><td>WRN-28-2</td><td>1.6M</td><td>56.92</td><td>30.92</td></tr><tr><td>WRN-28-5</td><td>9.5M</td><td>45.36</td><td>21.36</td></tr><tr><td>WRN-28-10</td><td>37.1M</td><td>40.96</td><td>18.87</td></tr><tr><td>SMASHv2</td><td>16.2M</td><td>38.62</td><td>16.33</td></tr></table>
155
+
156
+ # 5 FUTURE WORK
157
+
158
+ We believe this work opens a number of future research paths. The SMASH method itself has several simplistic elements that might easily be improved upon. During training, we sample each element of the configuration one-by-one, independently, and uniformly among all possible choices. A more intelligent method might employ Bayesian Optimization (Snoek et al., 2015) or HyperBand (Li et al., 2017) to guide the sampling with a principled tradeoff between exploring less-frequently sampled architectures against those which are performing well. One might employ a second parallel worker constantly evaluating validation performance throughout training to provide signal to an external optimizer, and change the optimization objective to simultaneously maximize performance while minimizing computational costs. One could also combine this technique with RL methods (Zoph and Le, 2017) and use a policy gradient to guide the sampling. Another simple technique (which our code nominally supports) is using the HyperNet-generated weights to initialize the resulting network and accelerate training, similar to Net2Net (Chen et al., 2016).
159
+
160
+ Our architecture exploration is fairly limited, and for the most part involves variable layer sizes and skip connections. One could envision a multiscale SMASH that also explores low-level design, varying things such as the activation at each layer, the order of operations, the number of convolutions in a given layer, or whether to use convolution, pooling, or more exotic blocks. One might also search over network-wide design patterns rather than randomly selecting the read-write pattern at each layer. Alternatively, one could consider varying which elements of the network are generated by the HyperNet, which are fixed learned parameters, and one might even make use of fixed unlearned parameters such as Gabor Filters or wavelets.
161
+
162
+ Our memory-bank view also opens up new possibilities for network design. Each layer’s read and write operations could be designed to use a learned softmax attention mechanism, such that the read and write locations are determined dynamically at inference time. We also do not make use of memory in the traditional "memory-augmented" sense, but we could easily add in this capacity by allowing information in the memory banks to persist, rather than zeroing them at every training step. We also only explore one definition of reading and writing, and one might for example change the "write" operation to either add to, overwrite, or perhaps even multiply (a la gated networks (Srivastava et al., 2015)) the existing tensor in a given bank.
163
+
164
+ # 6 CONCLUSION
165
+
166
+ In this work, we explore a technique for accelerating architecture selection by learning a model over network parameters, conditioned on the network’s parametric form. We introduce a flexible scheme for defining network connectivity patterns and generating network weights for highly variable architectures. Our results demonstrate a correlation between performance using suboptimal weights generated by the auxiliary model and performance using fully-trained weights, indicating that we can efficiently explore the architectural design space through this proxy model. Our method achieves competitive, though not state-of-the-art performance on several datasets.
167
+
168
+ # ACKNOWLEDGMENTS
169
+
170
+ We would like to thank Harri Edwards, David Ha, Daniel Angelov, Emmanuel Kahembwe, and Iain Murray for their insight. This research was made possible by grants and support from Renishaw plc and the Edinburgh Centre For Robotics. The work presented herein is also partially funded under the European H2020 Programme BEACONING project, Grant Agreement nr. 687676.
171
+
172
+ # REFERENCES
173
+
174
+ D. Arpit, Y. Zhou, B.U. Kota, and V. Govindaraju. Normalization propagation: A parametric technique for removing internal covariate shift in deep networks. In ICML, 2016.
175
+
176
+ J.L. Ba, J.R. Kiros, and G.E. Hinton. Layer normalization. In NIPS, 2016.
177
+
178
+ B. Baker, O. Gupta, N. Naik, and R. Raskar. Designing neural network architectures using reinforcement learning. In ICLR, 2017.
179
+
180
+ J. Bergstra and Y. Bengio. Random search for hyperparameter optimization. In JMLR, 2012.
181
+
182
+ A. Brock, T. Lim, J.M. Ritchie, and N. Weston. Generative and discriminative voxel modeling with convolutiona neural networks. 3D Deep Learning Workshop at NIPS 2016, 2016.
183
+
184
+ T. Chen, I. Goodfellow, and J. Shiens. Net2net: Accelerating learning via knowledge transfer. In ICLR, 2016.
185
+
186
+ P. Chrabaszcz, I. Loshchilov, and F. Hutter. A downsampled variant of imagennet as an altetrnative to the cifar datasets. arXiv Preprint arXiv: 1707.08819, 2017.
187
+
188
+ A. Coates, H. Lee, and A.Y. Ng. n analysis of single layer networks in unsupervised feature learning. In AISTATS, 2011.
189
+
190
+ M. Denil, B. Shakibi, L. Dinh, M. A. Ranzato, and N. de Freitas. Predicting parameters in deep learning. In NIPS, 2013.
191
+
192
+ D. Floreano, P. Durr, and C. Mattiussi. Neuroevolution: from architectures to learning. In Evolutionary Intelligence, 2008.
193
+
194
+ X. Gastaldi. Shake-shake regularization of 3-branch residual networks. ICLR 2017 Workshop, 2017.
195
+
196
+ D. Ha, A. Dai, and Q. Le. Hypernetworks. In ICLR, 2017.
197
+
198
+ K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In CVPR, 2016.
199
+
200
+ G. Huang, Y. Sun, Z. Liu, D. Sedra, and K. Q. Weinberger. Deep networks with stochastic depth. In ECCV, 2016.
201
+
202
+ G. Huang, Z. Liu, K.Q. Weinberger, and L. van der Maaten. Densely connected convolutional networks. In CVPR, 2017.
203
+
204
+ S. Ioffe and C. Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In ICML, 2015.
205
+
206
+ X. Jia, B. De Brabandere, T. Tuytelaars, and L. V. Gool. Dynamic filter networks. In NIPS, 2016.
207
+
208
+ D.P. Kingma and J. Ba. Adam: A method for stochastic optimization. arXiv Preprint arXiv: 1412.6980, 2014.
209
+
210
+ A. Krizhevsky and G. Hinton. Learning multiple layers of features from tiny images, 2009.
211
+
212
+ G. Larsson, M. Maire, and G. Shakhnarovich. Fractalnet: Ultra-deep neural networks without residuals. In ICLR, 2017.
213
+
214
+ L. Li, K. Jamieson, G. DeSalvo, A. Rostamizadeh, and A. Talwalkar. Hyperband: Bandit-based configuration evaluation for hyperparameter optimization. In ICLR, 2017.
215
+
216
+ I. Loshchilov and F. Hutter. Sgdr: Stochastic gradient descent with warm restarts. In ICLR, 2017.
217
+
218
+ J.F. Miller and P. Thomson. Cartesian genetic programming. In EuroGP, 2000.
219
+
220
+ A. Paszke, S. Gross, and S. Chintala. Pytorch. github.com/pytorch/pytorch, 2017.
221
+
222
+ A. Radford, L. Metz, and S. Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. arXiv preprint arXiv:1511.06434, 2015.
223
+ E. Real, S. Moore, A. Selle, S. Saxena, Y.L. Suematsu, Q. Le, and A. Kurakin. Large-scale evolution of image classifiers. arXiv Preprint arXiv: 1703.01041, 2017.
224
+ S.-A. Rebuffi, H. Bilen, and A. Vedaldi. Learning multiple visual domains with residual adapters. arXiv Preprint arXiv: 1705.08045, 2017.
225
+ T. Salimans and D.P. Kingma. Weight normalization: A simple reparameterization to accelerate training of deep neural networks. In NIPS, 2016.
226
+ A.M. Saxe, P.W. Koh, Z. Chen, M. Bhand, B. Suresh, and A.Y. Ng. On random weights and unsupervised feature learning. In ICML, 2011.
227
+ S. Saxena and J. Verbeek. Convolutional neural fabrics. In NIPS, 2016.
228
+ J. Schmidhuber. Learning to control fast-weight memories: An alternative to dynamic recurrent networks. In Neural Computation, volume 4, pages 131–139, 1992.
229
+ S. Singh, D. Hoiem, and D. Forsyth. Swapout: Learning an ensemble of deep architectures. In NIPS, 2016.
230
+ J. Snoek, H. Larochelle, and R.P. Adams. Practical bayesian optimization of machinelearning algorithms. In NIPS, 2012.
231
+ J. Snoek, O. Rippel, K. Swersky, R. Kiros, N. Satish, N. Sundaram, M.M.A. Patwary, Prabhat, and R. P. Adams. Practical bayesian optimization of machine learning algorithms. In ICML, 2015.
232
+ N. Srivastava, G.E. Hinton, A. Krizhevsky, I. Sutskever, and R. Salakhutdinov. Improving neural networks by preventing co-adaptation of feature detectors. arXiv Preprint arXiv: 1207.0580, 2012.
233
+ R. K. Srivastava, K. Greff, and J. Schmidhuber. Training very deep networks. In NIPS, 2015.
234
+ K.O. Stanley, D.B. D’Ambrosio, and J Gauci. A hypercube-based encoding for evolving large-scale neural networks. In Artificial Life, 15(2):185-212, 2009.
235
+ M. Suganuma, S. Shirakawa, and T. Nagao. A genetic programming approach to designing convolutional neural network architectures. In GECCO, 2017.
236
+ C. Szegedy, S. Ioffe, and V. Vanhoucke. Inception-v4, inception-resnet and the impact of residual connections on learning. arXiv Preprint arXiv: 1602.07261, 2016.
237
+ D. Wierstra, F.J. Gomez, and J. Schmidhuber. Modeling systems with internal state using evolino. In GECCO, 2005.
238
+ Z. Wu, S. Song, A. Khosla, F. Yu, L. Zhang, X. Tang, and J. Xiao. 3d shapenets: A deep representation for volumetric shapes. In CVPR, 2015.
239
+ J. Yosinski, J. Clune, Y. Bengio, and H. Lipson. How transferable are features in deep neural networks? In NIPS, 2014.
240
+ S. Zagoruyko and N. Komodakis. Wide residual networks. arXiv Preprint arXiv: 1605.07146, 2016.
241
+ B. Zoph and Q. Le. Neural architecture search with reinforcement learning. In ICLR, 2017.
242
+ B. Zoph, V. Vasudevan, J. Shlens, and Q. Le. Learning transferable architectures for scalable image recognition. arXiv Preprint arXiv: 1707.07012, 2017.
243
+
244
+ # APPENDIX A: HYPERPARAMETERS
245
+
246
+ We briefly describe they hyperparameters used for the SMASH network in our experiments. The SMASHv1 network has memory banks with $N = 6$ channels each, a maximum of 240 memory banks per block (though on average less than half that number), and a depth compression ratio of $D = 3$ . Each layer’s number of units is uniformly sampled between 6 and 42 (along even multiples of 6), and its dilation factor is uniformly sampled between 1 and 3 (with 1 representing no dilation and 3 representing 2 zeros inserted between each filter). We employ a constant bottlneck ratio of 4 as in (Huang et al., 2017), so the output of the HyperNet-generated 1x1 convolution is always 4 times the number of output units. We constrain the main network to have a maximum budget of 16M parameters, though due to our sampling procedure we rarely sample networks with more than 5M parameters.
247
+
248
+ Our SMASHv2 networks have variable memory bank sizes at each blocks, which we constrain to be multiples of $N = 8$ up to $N _ { m a x } = 6 4$ . We sample filter sizes from [3,5,7], and sample dilation values such that the max spatial extent of a filter in any direction is 9. We sample convolutional groups as factors of the base $N$ value (so [1,2,4,8] for these networks). We put some hand-designed priors on the choice of op configuration (i.e. which convolutions are active), giving slight preference to having all four convolutions active. For SMASHv2 nets we employ a slightly more complex bottleneck ratio: the output of the 1x1 conv is equal to the number of incoming channels while that number is less than twice the number of output units, at which point it is capped (so, a maximum bottleneck ratio of 2).
249
+
250
+ Our HyperNet is a DenseNet, designed ad-hoc to resemble the DenseNets in the original paper (Huang et al., 2017) within the confines of our encoding scheme, and to have round numbers of channels. It consists of a standard (non-bottleneck) Dense Block with $8 \ : 3 \mathrm { x } 3 $ convolutional layers and a growth rate of 10, followed by a 1x1 convolution that divides the number of channels in two, a Dense Block with 10 layers and a growth rate of 10, another compressing 1x1 convolution, a Dense Block with 4 layers and a growth rate of 10, and finally a 1x1 convolution with the designated number of output channels. We use Leaky ReLU with a negative slope of 0.02 as a defense against NaNs, as standard ReLU would obfuscate their presence when we had bugs in our early code revisions; we have not experimented with other activations.
251
+
252
+ # APPENDIX B: ENCODING SCHEME DETAILS
253
+
254
+ We adopt a scheme for the layout of the embedding tensor to facilitate flexibility, compatibility with the convolutional toolbox available in standard libraries, and to make each dimension interpretable. First, we place some constraints on the hyperparameters of the main network: each layer’s number of output units must be divisible by the memory bank size $N$ and be less than $N _ { m a x }$ , and the number of input units must be divisible by $D$ , where $N$ is the number of channels in each memory bank, and $N _ { m a x }$ and $D$ are chosen by the user. Applying these constraints allows us to reduce the size of the embedding vector by $D N ^ { 2 }$ , as we will see shortly.
255
+
256
+ The input to a standard 2D CNN is $x \in \mathbb { R } ^ { B \times C \times H \times L }$ , where $B , C , H$ , and $L$ respectively represent the Batch, Channel, Height, and Length dimensions. Our embedding tensor is $c \in \mathbb { R } ^ { 1 \times ( 2 \bar { M } + d _ { m a x } ) \times ( \bar { N } _ { m a x } / N ) ^ { 2 } \times n _ { c h } / { D } }$ where $M$ is the maximum number of memory banks in a block, $d _ { m a x }$ is the maximum kernel dilation, and $n _ { c h }$ is the sum total of input channels to the 1x1 convs of the main network.
257
+
258
+ The conditional embedding $c$ is a one-hot encoding of the memory banks we read and write at each layer. It has $2 M + d _ { m a x }$ channels, where the first $M$ channels represent which banks are being read from, the next $M$ channels represent which banks are being written to, and the final $d _ { m a x }$ channels are a one-hot encoding of the dilation factor applied to the following 3x3 convolution. The height dimension corresponds to the number of units at each layer, and the length dimension corresponds to the network depth in terms of the total number of input channels. We keep the Batch dimension at 1 so that no signals propagate wholly independently through the HyperNet. Figure 3 shows an example of a small randomly sampled network, its equivalent memory bank representation, and how the read-write pattern is encoded in $c$ . The dilation encoding is omitted in Figure 3 for compactness.
259
+
260
+ Our HyperNet has $4 D N ^ { 2 }$ output channels, such that the output of the HyperNet is $W ~ = ~ H ( c ) ~ \in ~$ $\mathbb { R } ^ { 1 \times 4 D \bar { N } ^ { 2 } \times ( N _ { m a x } / N ) ^ { 2 } \times n _ { c h } / D }$ , which we reshape to $W \in \mathbb { R } ^ { N _ { m a x } \times 4 N _ { m a x } n _ { c h } \times 1 \times 1 }$ . We generate the weights for the entire main network in a single pass, allowing the HyperNet to predict weights at a given layer based on weights at nearby layers. The HyperNet’s receptive field represents how far up or down the network it can look to predict parameters at a given layer. As we traverse the main network, we slice $W$ along its second axis according to the number of incoming channels, and slice along the first axis according to the width of the given layer.
261
+
262
+ # APPENDIX C: EXPERIMENT DETAILS
263
+
264
+ At each training step, we sample a network architecture block-by-block, with a random (but upper bounded) computational budget allocated to each block. For SMASHv1, We use memory banks with $N = 6$ channels each, constrain the number of incoming memory banks to be a multiple of 3 $D = 3$ ), and constrain the number of output units at each layer to be a multiple of 6 (with $N _ { m a x } = 4 2$ ) for compatibility with the memory layout.
265
+
266
+ Our HyperNet is a 26 layer DenseNet, each layer of which comprises a Leaky ReLU activation followed by a 3x3 convolution with simplified WeightNorm and no biases. We do not use bottleneck blocks, dropout, or other normalizers in the HyperNet.
267
+
268
+ When sampling our SMASHv2 networks for evaluation, we first sample 500 random architectures, then select the architecture with the highest score for further evaluation. We begin by perturbing this architecture, with a $5 \%$ chance of any individual element being randomly resampled, and evaluate 100 random perturbations from this base. We then proceed with 100 perturbations in a simple Markov Chain, where we only accept an update if it has a better SMASH score on the validation set.
269
+
270
+ When training a resulting network we make all parameters freely learnable and replace simple WeightNorm with standard BatchNorm. We tentatively experimented with using SMASH generated weights to initialize a resulting net, but found standard initialization strategies to work better, either because of a yet-undiscovered bug in our code, or because of the disparity between the dynamics of the SMASH network using WeightNorm and the resulting network using BatchNorm.
271
+
272
+ In line with our claim of "one-shot" model search, we keep our exploration of the SMASH design space to a minimum. We briefly experimented with three different settings for N and D, and use a simple, ad-hoc DenseNet architecture for the HyperNet, which we do not tune. We investigated the choice of architecture while examining the SMASH correlation, but stick to the original ad-hoc design for all benchmark experiments.
273
+
274
+ When training SMASH, we use Adam (Kingma and Ba, 2014) with the initial parameters proposed by (Radford et al., 2015) When training a resulting network, we use Nesterov Momentum with an initial step size of 0.1 and a momentum value of 0.9. For all tests other than the initial SMASHv1 experiments, we employ a cosine annealing schedule (Loshchilov and Hutter, 2017) without restarts (Gastaldi, 2017).
275
+
276
+ For the CIFAR experiments, we train the SMASH network for 100 epochs and the resulting networks for 300 epochs, using a batch size of 50 on a single GPU. On ModelNet10, we train for 100 epochs. On ImageNet32x32, we train for 55 epochs. On STL-10, we train for 300 epochs when using the full training set, and 500 epochs when using the 10-fold training splits.
277
+
278
+ For ModelNet-10 tests, we employ 3x3x3 filters (rather than fully variable filter size) to enable our network to fit into memory and keep compute costs manageable, hence why our model only has 8M parameters compared to the base 16M parameters.
279
+
280
+ All of our networks are pre-activation, following the order BN-ReLU-Conv if BatchNorm is used, or ReLU-Conv if WeightNorm is used. Our code supports both pre- and post-activation, along with a variety of other options such as which hyperparameters to vary and which to keep constant.
281
+
282
+ ![](images/5d1f4af74825eb0d9681a53078e49a9ac915aabbcec6dfb348f30d0ced1a15be.jpg)
283
+ Figure 5: (a) SMASH correlation with a crippled HyperNet. Error bars represent 1 standard deviation. (b) SMASH scores vs. rank using average scores from three HyperNets with different seeds.
284
+
285
+ While investigating the SMASH correlation, we initially conducted two brief experiments to guide the choice of experiments in the remainder of the investigation. First, experiment, we train a low-budget SMASH network (to permit more rapid testing) with a much smaller HyperNet relative to the main network (though still the standard ratio of generated to freely learned weights). We expect the decreased capacity HyperNet to be less able to learn to generate good weights for the full range of architectures, and for the correlation between SMASH score and true performance to therefore be weak or nonexistent. The results of this study are shown in Figure 5(a), where we arguably observe a breakdown of the correlation. In addition to repeat trials for each resulting net, we also train two additional SMASH networks with different random seeds and compare their predicted performance against the initial SMASH net in figure 5(b), to get a brief sense for how these values can vary across training runs.
286
+
287
+ Next, we train a high-budget SMASH network and drastically increase the ratio of normally learned parameters to HyperNet-generated parameters, such that the majority of the net’s model capacity is in non-generated weights. Under these conditions, the validation errors achieved with SMASH-generated weights are much lower than validation errors achieved with an equivalent SMASH network with the typical ratio, but the resulting top models are not as performant and we found that (in the very limited number of correlation tests we performed) the SMASH score did not correlate with true performance. This highlights two potential pitfalls: first, if the HyperNet is not responsible for enough of the network capacity, then the aggregate generated and learned weights may not be sufficiently well-adapted to each sampled architecture, and therefore too far from optimal to be used in comparing architectures. Second, comparing SMASH scores for two separate SMASH networks can be misleading, as the SMASH score is a function of both the normally learned and generated weights, and a network with more fixed weights may achieve better SMASH scores even if the resulting nets are no better.
288
+
289
+ ![](images/4c39c5c235f4e196f97a2a70850037361ebf4e4b23dd3d04b9ef0f9272e5c0ab.jpg)
290
+ Figure 6: A simplified version of our best-found SMASHv2 architecture from CIFAR-100 with the highest SMASH score. N represents number of output units, op which convolutions are active, groups convolution groups, ks kernel size, and d dilation.
291
+
292
+ ![](images/e29c5f7e3dcd5405f7ea080919cb5b2d57a5eb8e0e9f8774afd3ad793b0e0a32.jpg)
293
+ Figure 7: A simplified version of our best-found SMASHv1 architecture. N represents number of output units, and d represents the dilation factor for the $3 { \bf x } 3$ filter.
294
+
295
+ ![](images/ecba6fe5f90ae0dea19b7e5ba59e6d15b128a76b06d4aa748772a93916e3e399.jpg)
296
+ Figure 8: An expanded (though still partially simplified) view of the first block of our best SMASHv2 net.
297
+
298
+ ![](images/1b29b8eb8c837726eaddbe1177025ed2f35b3991f796273f0f4ce6e1559cbf51.jpg)
299
+ Figure 9: An expanded (though still partially simplified) view of the second block of our best SMASHv1 net.
300
+
301
+ ![](images/061e3d60259fbc08cd0d5a6176f696efb5846284ebb8c329a8f086ddddc8b713.jpg)
302
+ Figure 10: An expanded (though still partially simplified) view of the final block of our best SMASHv2 net. Floating paths are an artifact of the graph generation process, and are actually attached to the nearest rectangular node.
303
+
304
+ ![](images/6b01783b7554e636c2fa6b1ad27e45da7d663a27bc89ee73bbcc2dcf29ad01f3.jpg)
305
+ Figure 11: An expanded (though still partially simplified) view of the first block of our best SMASHv1 net. Floating paths are an artifact of the graph generation process, and are actually attached to the nearest rectangular node.
306
+
307
+ ![](images/74c4198a27b0d4ec70f9fda9e2d31a99c7274e82cc79298193583fa44b382a13.jpg)
308
+ Figure 12: An expanded (though still partially simplified) view of the second block of our best SMASHv1 net. Floating paths are an artifact of the graph generation process, and are actually attached to the nearest rectangular node.
309
+
310
+ ![](images/30b0be4dbb9b08d87419fd96f6f5b4023d21709d48ada9645ab80ec2e56c0e8b.jpg)
311
+ Figure 13: An expanded (though still partially simplified) view of the final block of our best SMASHv1 net. Floating paths are an artifact of the graph generation process, and are actually attached to the nearest rectangular node.
md/train/tFbuFKWX3MFC8/tFbuFKWX3MFC8.md ADDED
@@ -0,0 +1,259 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Training Neural Networks with Stochastic Hessian-Free Optimization
2
+
3
+ Ryan Kiros Department of Computing Science University of Alberta Edmonton, AB, Canada rkiros@ualberta.ca
4
+
5
+ # Abstract
6
+
7
+ Hessian-free (HF) optimization has been successfully used for training deep autoencoders and recurrent networks. HF uses the conjugate gradient algorithm to construct update directions through curvature-vector products that can be computed on the same order of time as gradients. In this paper we exploit this property and study stochastic HF with gradient and curvature mini-batches independent of the dataset size. We modify Martens’ HF for these settings and integrate dropout, a method for preventing co-adaptation of feature detectors, to guard against overfitting. Stochastic Hessian-free optimization gives an intermediary between SGD and HF that achieves competitive performance on both classification and deep autoencoder experiments.
8
+
9
+ # 1 Introduction
10
+
11
+ Stochastic gradient descent (SGD) has become the most popular algorithm for training neural networks. Not only is SGD simple to implement but its noisy updates often leads to solutions that are well-adapt to generalization on held-out data [1]. Furthermore, SGD operates on small mini-batches potentially allowing for scalable training on large datasets. For training deep networks, SGD can be used for fine-tuning after layerwise pre-training [2] which overcomes many of the difficulties of training deep networks. Additionally, SGD can be augmented with dropout [3] as a means of preventing overfitting.
12
+
13
+ There has been recent interest in second-order methods for training deep networks, partially due to the successful adaptation of Hessian-free (HF) by [4], an instance of the more general family of truncated Newton methods. Second-order methods operate in batch settings with less but more substantial weight updates. Furthermore, computing gradients and curvature information on large batches can easily be distributed across several machines. Martens’ HF was able to successfully train deep autoencoders without the use of pre-training and was later used for solving several pathological tasks in recurrent networks [5].
14
+
15
+ HF iteratively proposes update directions using the conjugate gradient algorithm, requiring only curvature-vector products and not an explicit computation of the curvature matrix. Curvature-vector products can be computed on the same order of time as it takes to compute gradients with an additional forward and backward pass through the function’s computational graph [6, 7]. In this paper we exploit this property and introduce stochastic Hessian-free optimization (SHF), a variation of HF that operates on gradient and curvature mini-batches independent of the dataset size. Our goal in developing SHF is to combine the generalization advantages of SGD with second-order information from HF. SHF can adapt its behaviour through the choice of batch size and number of conjugate gradient iterations, for which its behaviour either becomes more characteristic of SGD or HF. Additionally we integrate dropout, as a means of preventing co-adaptation of feature detectors. We perform experimental evaluation on both classification and deep autoencoder tasks. For classification, dropout SHF is competitive with dropout SGD on all tasks considered while for autoencoders SHF performs comparably to HF and momentum-based methods. Moreover, no tuning of learning rates needs to be done.
16
+
17
+ # 2 Related work
18
+
19
+ Much research has been investigated into developing adaptive learning rates or incorporating secondorder information into SGD. [8] proposed augmenting SGD with a diagonal approximation of the Hessian while Adagrad [9] uses a global learning rate while dividing by the norm of previous gradients in its update. SGD with Adagrad was shown to be beneficial in training deep distributed networks for speech and object recognition [10]. To completely avoid tuning learning rates, [11] considered computing rates as to minimize estimates of the expectation of the loss at any one time. [12] proposed SGD-QN for incorporating a quasi-Newton approximation to the Hessian into SGD and used this to win one of the 2008 PASCAL large scale learning challenge tracks. Recently, [13] provided a relationship between HF, Krylov subspace descent and natural gradient due to their use of the Gauss-Newton curvature matrix. Furthermore, [13] argue that natural gradient is robust to overfitting as well as the order of the training samples. Other methods incorporating the natural gradient such as TONGA [14] have also showed promise on speeding up neural network training.
20
+
21
+ Analyzing the difficulty of training deep networks was done by [15], proposing a weight initialization that demonstrates faster convergence. More recently, [16] argue that large neural networks waste capacity in the sense that adding additional units fail to reduce underfitting on large datasets. The authors hypothesize the SGD is the culprit and suggest exploration with stochastic natural gradient or stochastic second-order methods. Such results further motivate our development of SHF. [17] show that with careful attention to the parameter initialization and momentum schedule, firstorder methods can be competitive with HF for training deep autoencoders and recurrent networks. We compare against these methods in our autoencoder evaluation.
22
+
23
+ Related to our work is that of [18], who proposes a dynamic adjustment of gradient and curvature mini-batches for HF with convex losses based on variance estimations. Unlike our work, the batch sizes used are dynamic with a fixed ratio and are initialized as a function of the dataset size. Other work on using second-order methods for neural networks include [19] who proposed using the Jacobi pre-conditioner for HF, [20] using HF to generate text in recurrent networks and [21] who explored training with Krylov subspace descent (KSD). Unlike HF, KSD could be used with Hessian-vector products but requires additional memory to store a basis for the Krylov subspace. L-BFGS has also been successfully used in fine-tuning pre-trained deep autoencoders, convolutional networks [22] and training deep distributed networks [10]. Other developments and detailed discussion of gradient-based methods for neural networks is described in [23].
24
+
25
+ # 3 Hessian-free optimization
26
+
27
+ In this section we review Hessian-free optimization, largely following the implementation of Martens [4]. We refer the reader to [24] for detailed development and tips for using HF.
28
+
29
+ We consider unconstrained minimization of a function $f : \mathbb { R } ^ { n } \mathbb { R }$ with respect to parameters $\theta$ . More specifically, we assume $f$ can be written as a composition $f ( \theta ) \ : = \ : L ( F ( \theta ) )$ where $L$ is a convex loss function and $F ( \theta )$ is the output of a neural network with $\ell$ non-input layers. We will mostly focus on the case when $f$ is non-convex. Typically $L$ is chosen to be a matching loss to a corresponding transfer function $p ( z ) = p ( F ( \theta ) )$ . For a single input, the $( i + 1 )$ -th layer of the network is expressed as
30
+
31
+ $$
32
+ y _ { i + 1 } = s _ { i } ( W _ { i } \ y _ { i } + b _ { i } )
33
+ $$
34
+
35
+ where $s _ { i }$ is a transfer function, $W _ { i }$ is the weights connecting layers $i$ and $i + 1$ and $b _ { i }$ is a bias vector. Common transfer functions include the sigmoid $s _ { i } ( x ) = ( 1 + \exp ( - x ) ) ^ { - 1 }$ , the hyperbolic tangent $s _ { i } ( x ) = \operatorname { t a n h } ( x )$ and rectified linear units $s _ { i } ( x ) = \operatorname* { m a x } ( x , 0 )$ . In the case of classification tasks, the
36
+
37
+ loss function used is the generalized cross entropy and softmax transfer
38
+
39
+ $$
40
+ L ( p ( z ) , t ) = - \sum _ { j = 1 } ^ { k } t _ { j } \log ( p ( z _ { j } ) ) , \quad p ( z _ { j } ) = \exp ( z _ { j } ) / \sum _ { l = 1 } ^ { k } \exp ( z _ { l } )
41
+ $$
42
+
43
+ where $k$ is the number of classes, $t$ is a target vector and $z _ { j }$ the $j$ -th component of output vector $z$ . Consider a local quadratic approximation $M _ { \theta } ( \delta )$ of $f$ around $\theta$ :
44
+
45
+ $$
46
+ \boldsymbol { f } ( \boldsymbol { \theta } + \boldsymbol { \delta } ) \approx \boldsymbol { M } _ { \boldsymbol { \theta } } ( \boldsymbol { \delta } ) = \boldsymbol { f } ( \boldsymbol { \theta } ) + \nabla \boldsymbol { f } ( \boldsymbol { \theta } ) ^ { T } \boldsymbol { \delta } + \frac { 1 } { 2 } \boldsymbol { \delta } ^ { T } \boldsymbol { B } \boldsymbol { \delta }
47
+ $$
48
+
49
+ where $\nabla f ( \theta )$ is the gradient of $f$ and $B$ is the Hessian or an approximation to the Hessian. If $f$ was convex, then $B \succeq 0$ and equation 3 exhibits a minimum $\delta ^ { * }$ . In Newton’s method, $\theta _ { k + 1 }$ , the parameters at iteration $k + 1$ , are updated as $\theta _ { k + 1 } = \theta _ { k } + \alpha _ { k } \delta _ { k } ^ { * }$ where $\alpha _ { k } \in [ 0 , 1 ]$ is the rate and $\delta _ { k } ^ { * }$ is computed as
50
+
51
+ $$
52
+ \delta _ { k } ^ { * } = - B ^ { - 1 } \nabla f ( \theta _ { k - 1 } )
53
+ $$
54
+
55
+ for which calculation requires $O ( n ^ { 3 } )$ time and thus often prohibitive. Hessian-free optimization alleviates this by using the conjugate gradient (CG) algorithm to compute an approximate minimizer $\delta _ { k }$ . Specifically, CG minimizes the quadratic objective $q ( \delta )$ given by
56
+
57
+ $$
58
+ \boldsymbol { q } ( \delta ) = \frac { 1 } { 2 } \delta ^ { T } \boldsymbol { B } \delta + \nabla f ( \theta _ { k - 1 } ) ^ { T } \delta
59
+ $$
60
+
61
+ for which the corresponding minimizer of $q ( \delta )$ is $- B ^ { - 1 } \nabla f ( \theta _ { k - 1 } )$ . The motivation for using CG is as follows: while computing $B$ is expensive, compute the product $B v$ for some vector $v$ can be computed on the same order of time as it takes to compute $\nabla f ( \theta _ { k - 1 } )$ using the $\mathbf { R }$ -operator [6]. Thus CG can efficiently compute an iterative solution to the linear system $\bar { B ^ { } } \delta _ { k } = - \bar { \nabla } ( f ( \theta _ { k - 1 } ) )$ corresponding to a new update direction $\delta _ { k }$ .
62
+
63
+ When $f$ is non-convex, the Hessian may not be positive semi-definite and thus equation 3 no longer has a well defined minimum. Following Martens, we instead use the generalized Gauss-newton matrix defined as $B = J ^ { T } L ^ { ^ { \prime \prime } } J$ where $J$ is the Jacobian of $f$ and $L ^ { ' \prime }$ is the Hessian of $L ^ { 1 }$ . So long as $f ( \theta ) = L ( F ( \theta ) )$ for convex $L$ then $B \succeq 0$ . Given a vector $v$ , the product $B v = J ^ { T } L ^ { ^ { \prime \prime } } J v$ is computed successively by first computing $J v$ , then $\boldsymbol { L } ^ { ' \prime } ( J \boldsymbol { v } )$ and finally $J ^ { T } ( L ^ { ' \prime } J v )$ [7]. To compute $J v$ , we utilize the $\mathbf { R }$ -operator. The R-operator of $F ( \theta )$ with respect to $v$ is defined as
64
+
65
+ $$
66
+ \mathcal { R } _ { v } \{ F ( \theta ) \} = \operatorname* { l i m } _ { \epsilon \to 0 } \frac { F ( \theta + \epsilon v ) - F ( \theta ) } { \epsilon } = J v
67
+ $$
68
+
69
+ Computing ${ { \mathcal R } _ { v } } \{ F ( \theta ) \}$ in a neural network is easily done using a forward pass by computing $\mathcal { R } _ { v } \{ y _ { i } \}$ for each layer output $y _ { i }$ . More specifically,
70
+
71
+ $$
72
+ \mathcal { R } _ { v } \{ y _ { i + 1 } \} = \mathcal { R } _ { v } \{ W _ { i } \ y _ { i } + b _ { i } \} s _ { i } ^ { \prime } = ( v ( W _ { i } ) y _ { i } \ + v ( b _ { i } ) + W _ { i } \mathcal { R } \{ y _ { i } \} ) s _ { i } ^ { \prime }
73
+ $$
74
+
75
+ where $v ( W _ { i } )$ is the components of $v$ corresponding to parameters between layers $i$ and $i + 1$ and $\mathcal { R } \{ y _ { 1 } \} = 0$ (where $y _ { 1 }$ is the input data). In order to compute $J ^ { T } ( L ^ { ' \prime } J v )$ , we simply apply backpropagation but using the vector $L ^ { ' \prime } J v$ instead of $\nabla L$ as is usually done to compute $\nabla f$ . Thus, $B v$ may be computed through a forward and backward pass in the same sense that $L$ and $\begin{array} { r } { \nabla f = J ^ { T } \nabla L } \end{array}$ are.
76
+
77
+ As opposed to minimizing equation 3, Martens instead uses an additional damping parameter $\lambda$ with damped quadratic approximation
78
+
79
+ $$
80
+ \hat { M } _ { \boldsymbol { \theta } } ( \boldsymbol { \delta } ) = f ( \boldsymbol { \theta } ) + \nabla f ( \boldsymbol { \theta } ) ^ { T } \boldsymbol { \delta } + \frac { 1 } { 2 } \boldsymbol { \delta } ^ { T } \hat { \boldsymbol { B } } \boldsymbol { \delta } = f ( \boldsymbol { \theta } ) + \nabla f ( \boldsymbol { \theta } ) ^ { T } \boldsymbol { \delta } + \frac { 1 } { 2 } \boldsymbol { \delta } ^ { T } ( \boldsymbol { B } + \lambda I ) \boldsymbol { \delta }
81
+ $$
82
+
83
+ Damping the quadratic through $\lambda$ gives a measure of how conservative the quadratic approximation is. A large value of $\lambda$ is more conservative and as $\lambda \infty$ updates become similar to stochastic gradient descent. Alternatively, a small $\lambda$ allows for more substantial parameter updates especially
84
+
85
+ along low curvature directions. Martens dynamically adjusts $\lambda$ at each iteration using a LevenbergMarquardt style update based on computing the reduction ratio
86
+
87
+ $$
88
+ \rho = ( f ( \theta + \delta ) - f ( \theta ) ) / ( M _ { \theta } ( \delta ) - M _ { \theta } ( 0 ) )
89
+ $$
90
+
91
+ If $\rho$ is sufficiently small or negative, $\lambda$ is increased while if $\rho$ is large then $\lambda$ is decreased. The number of CG iterations used to compute $\delta$ has a dramatic effect on $\rho$ which is further discussed in section 4.1.
92
+
93
+ To accelerate CG, Martens makes use of the diagonal pre-conditioner
94
+
95
+ $$
96
+ P = \left[ \operatorname { d i a g } \bigg ( \sum _ { j = 1 } ^ { m } \nabla f ^ { ( j ) } ( \theta ) \odot \nabla f ^ { ( j ) } ( \theta ) \bigg ) + \lambda I \right] ^ { \xi }
97
+ $$
98
+
99
+ where $f ^ { ( j ) } ( \theta )$ is the value of $f$ for datapoint $j$ and $\odot$ denotes component-wise multiplication. $P$ can be easily computed on the same backward pass as computing $\nabla f$ .
100
+
101
+ Finally, two backtracking methods are used: one after optimizing CG to select $\delta$ and the other a backtracking linesearch to compute the rate $\alpha$ . Both these methods operate in the standard way, backtracking through proposals until the objective no longer decreases.
102
+
103
+ # 4 Stochastic Hessian-free optimization
104
+
105
+ Martens’ implementation utilizes the full dataset for computing objective values and gradients, and mini-batches for computing curvature-vector products. Naively setting both batch sizes to be small causes several problems. In this section we describe these problems and our contributions in modifying Martens’ original algorithm to this setting.
106
+
107
+ # 4.1 Short CG runs, $\delta$ -momentum and use of mini-batches
108
+
109
+ The CG termination criteria used by Martens is based on a measure of relative progress in optimizing $\hat { M } _ { \theta }$ . Specifically, if $x _ { j }$ is the solution at CG iteration $j$ , then training is terminated when
110
+
111
+ $$
112
+ \frac { \hat { M } _ { \theta } ( x _ { j } ) - \hat { M } _ { \theta } ( x _ { j - k } ) } { \hat { M } _ { \theta } ( x _ { j } ) } < \epsilon
113
+ $$
114
+
115
+ where $k = \mathrm { m a x } ( 1 0 , j / 1 0 )$ and $\epsilon$ is a small positive constant. The effect of this stopping criteria has a dependency on the strength of the damping parameter $\lambda$ , among other attributes such as the current parameter settings. For sufficiently large $\lambda$ , CG only requires 10-20 iterations when a preconditioner is used. As $\lambda$ decreases, more iterations are required to account for pathological curvature that can occur in optimizing $f$ and thus leads to more expensive CG iterations. Such behavior would be undesirable in a stochastic setting where preference would be put towards having equal length CG iterations throughout training. To account for this, we fix the number of CG iterations to be only 3-5 across training for classification and 25-50 for training deep autoencoders. Let $\zeta$ denote this cut-off. Setting a limit on the number of CG iterations is used by [4] and [20] and also has a damping effect, since the objective function and quadratic approximation will tend to diverge as CG iterations increase [24]. We note that due to the shorter number of CG runs, the iterates from each solution are used during the CG backtracking step.
116
+
117
+ A contributor to the success of Martens’ HF is the use of information sharing across iterations. At iteration $k$ , CG is initialized to be the previous solution of CG from iteration $k - 1$ , with a small decay. For the rest of this work, we denote this as $\delta$ -momentum. $\delta$ -momentum helps correct proposed update directions when the quadratic approximation varies across iterations, in the same sense that momentum is used to share gradients. This momentum interpretation was first suggested by [24] in the context of adapting HF to a setting with short CG runs. Unfortunately, the use of $\delta$ - momentum becomes challenging when short CG runs are used. Given a non-zero CG initialization, $\hat { M } _ { \theta }$ may be more likely to remain positive after terminating CG and assuming $f ( \theta + \delta ) - f ( \theta ) < 0$ , means that the reduction ratio will be negative and thus $\lambda$ will be increased to compensate. While this is not necessarily unwanted behavior, having this occur too frequently will push SHF to be too conservative and possibly result in the backtracking linesearch to reject proposed updates. Our solution is to utilize a schedule on the amount of decay used on the CG starting solution. This is motivated by [24] suggesting more attention on the CG decay in the setting of using short CG runs. Specifically, if $\delta _ { k } ^ { 0 }$ is the initial solution to CG at iteration $k$ , then
118
+
119
+ $$
120
+ \delta _ { k } ^ { 0 } = \gamma _ { e } \delta _ { k - 1 } ^ { \zeta } , \gamma _ { e } = \operatorname* { m i n } ( 1 . 0 1 \gamma _ { e - 1 } , . 9 9 )
121
+ $$
122
+
123
+ where $\gamma _ { e }$ is the decay at epoch $e$ , $\delta _ { 1 } ^ { 0 } = 0$ and $\gamma _ { 1 } = 0 . 5$ . While in batch training a fixed $\gamma$ is suitable, in a stochastic setting it is unlikely that a global decay parameter is sufficient. Our schedule has an annealing effect in the sense that $\gamma$ values near 1 are feasible late in training even with only $3 { - } 5 \mathrm { C G }$ iterations, a property that is otherwise hard to achieve. This allows us to benefit from sharing more information across iterations late in training, similar to that of a typical momentum method.
124
+
125
+ A remaining question to consider is how to set the sizes of the gradient and curvature mini-batches. [24] discuss theoretical advantages to utilizing the same mini-batches for computing the gradient and curvature vector products. In our setting, this may lead to some difficulties. Using same-sized batches allows $\lambda 0$ during training [24]. Unfortunately, this can become incompatible with our short hard-limit on the number of CG iterations, since CG requires more work to optimize $\hat { M } _ { \theta }$ when $\lambda$ approaches zero. To account for this, on classification tasks where $3 { - } 5 \ \mathrm { C G }$ iterations are used, we opt to use gradient mini-batches that are 5-10 times larger than curvature mini-batches. For deep autoencoder tasks where more CG iterations are used, we instead set both gradient and curvature batches to be the same size. The behavior of $\lambda$ is dependent on whether or not dropout is used during training. Figure 1 demonstrates the behavior of $\lambda$ during classification training with and without the use of dropout. With dropout, $\lambda$ no longer converges to 0 but instead plummets, rises and flattens out. In both settings, $\lambda$ does not decrease substantially as to negatively effect the proposed CG solution and consequently the reduction ratio. Thus, the amount of work required by CG remains consistent late in training. The other benefit to using larger gradient batches is to account for the additional computation in computing curvature-vector products which would make training longer if both mini-batches were small and of the same size. In [4], the gradients and objectives are computed using the full training set throughout the algorithm, including during CG backtracking and the backtracking linesearch. We utilize the gradient mini-batch for the current iteration in order to compute all necessary gradient and objectives throughout the algorithm.
126
+
127
+ # 4.2 Levenberg-Marquardt damping
128
+
129
+ Martens makes use of the following Levenberg-Marquardt style damping criteria for updating $\lambda$ :
130
+
131
+ $$
132
+ \mathbf { i f } \rho > \frac { 3 } { 4 } , \lambda \frac { 2 } { 3 } \lambda \mathbf { e l s e i f } \rho < \frac { 1 } { 4 } , \lambda \frac { 3 } { 2 } \lambda
133
+ $$
134
+
135
+ which given a suitable initial value will converge to zero as training progresses. We observed that the above damping criteria is too harsh in the stochastic setting in the sense that $\lambda$ will frequently oscillate, which is sensible given the size of the curvature mini-batches. We instead opt for a much softer criterion, for which lambda is updated as
136
+
137
+ $$
138
+ \mathbf { i f } \rho > \frac { 3 } { 4 } , \lambda \frac { 9 9 } { 1 0 0 } \lambda \mathbf { e l s e i f } \rho < \frac { 1 } { 4 } , \lambda \frac { 1 0 0 } { 9 9 } \lambda
139
+ $$
140
+
141
+ This choice, although somewhat arbitrary, is consistently effective. Thus reduction ratio values computed from curvature mini-batches will have less overall influence on the damping strength.
142
+
143
+ # 4.3 Integrating dropout
144
+
145
+ Dropout is a recently proposed method for improving the training of neural networks. During training, each hidden unit is omitted with a probability of 0.5 along with optionally omitting input features similar to that of a denoising autoencoder [25]. Dropout can be viewed in two ways. By randomly omitting feature detectors, dropout prevents co-adaptation among detectors which can improve generalization accuracy on held-out data. Secondly, dropout can be seen as a type of model averaging. At test time, outgoing weights are halved. If we consider a network with a single hidden layer and $k$ feature detectors, using the mean network at test time corresponds to taking the geometric average of $2 ^ { k }$ networks with shared weights. Dropout is integrated in stochastic HF by randomly omitting feature detectors on both gradient and curvature mini-batches from the last hidden layer during each iteration. Since we assume that the curvature mini-batches are a subset of the gradient mini-batches, the same feature detectors are omitted in both cases.
146
+
147
+ ![](images/5ec95ac96cce7e4cd7db65de08e66ef1d6c759427c042bb0590944dd20428e5a.jpg)
148
+ Figure 1: Values of the damping strength $\lambda$ during training of MNIST (left) and USPS (right) with and without dropout using $\lambda = 1$ for classification. When dropout is included, the damping strength initially decreases followed by a steady increase over time.
149
+
150
+ Since the curvature estimates are noisy, it is important to consider the stability of updates when different stochastic networks are used in each computation. The weight updates in dropout SGD are augmented with momentum not only for stability but also to speed up learning. Specifically, at iteration $k$ the parameter update is given by
151
+
152
+ $$
153
+ \Delta \theta _ { k } = p _ { k } \Delta \theta _ { k - 1 } - ( 1 - p _ { k } ) \alpha _ { k } \langle \nabla f \rangle , \quad \theta _ { k } = \theta _ { k - 1 } + \Delta \theta _ { k }
154
+ $$
155
+
156
+ where $p _ { k }$ and $a _ { k }$ are the momentum and learning rate, respectively. We incorporate an additional exponential decay term $\beta _ { e }$ when performing parameter updates. Specifically, each parameter update is computed as
157
+
158
+ $$
159
+ \theta _ { k } = \theta _ { k - 1 } + \beta _ { e } \alpha _ { k } \delta _ { k } , \beta _ { e } = c \beta _ { e - 1 }
160
+ $$
161
+
162
+ where $c \in ( 0 , 1 ]$ is a fixed parameter chosen by the user. Incorporating $\beta _ { e }$ into the updates, along with the use of $\delta$ -momentum, leads to more stable updates and fine convergence particularly when dropout is integrated during training.
163
+
164
+ # 4.4 Algorithm
165
+
166
+ Pseudo-code for one iteration of our implementation of stochastic Hessian-free is presented. Given a gradient minibatch $X _ { k } ^ { g }$ and curvature minibatch $X _ { k } ^ { c }$ , we first sample dropout units (if applicable) for the inputs and last hidden layer of the network. These take the form of a binary vector, which are multiplied component-wise by the activations $y _ { i }$ . In our pseudo-code, $\mathrm { C G } ( \delta _ { k } ^ { 0 } , \dot { \nabla } f , P , \zeta )$ is used to denote applying CG with initial solution $\delta _ { k } ^ { 0 }$ , gradient $\nabla f$ , pre-conditioner $P$ and $\zeta$ iterations. Note that, when computing $\delta$ -momentum, the $\zeta$ -th solution in iteration $k - 1$ is used as opposed to the solution chosen via backtracking. Given the objectives $f _ { k - 1 }$ computed with $\theta$ and $f _ { k }$ computed with $\theta + \delta _ { k }$ , the reduction ratio $\rho$ is calculated utilizing the un-damped quadratic approximation $M _ { \theta } ( \delta _ { k } )$ . This allows updating $\lambda$ using the Levenberg-Marquardt style damping. Finally, a backtracking linesearch with at most $\omega$ steps is performed to compute the rate and serves as a last defense against potentially poor update directions.
167
+
168
+ Since curvature mini-batches are sampled from a subset of the gradient mini-batch, it is then sensible to utilize different curvature mini-batches on different epochs. Along with cycling through gradient mini-batches during each epoch, we also cycle through curvature subsets every $h$ epochs, where $h$ is the size of the gradient mini-batches divided by the size of the curvature mini-batches. For example, if the gradient batch size is 1000 and the curvature batch size is 100, then curvature mini-batch sampling completes a full cycle every $1 0 0 0 / 1 0 0 = 1 0$ epochs.
169
+
170
+ Finally, one simple way to speed up training as indicated in [24], is to cache the activations when initially computing the objective $f _ { k }$ . While each iteration of CG requires computing a curvaturevector product, the network parameters are fixed during CG and is thus wasteful to re-compute the network activations on each iteration.
171
+
172
+ <table><tr><td colspan="2">Algorithm1 Stochastic Hessian-Free Optimization</td></tr><tr><td colspan="2">Sample dropout units for inputs and last hidden layer</td></tr><tr><td>if start of new epoch then Ye ← min(1.01γe-1,.99)</td><td>{δ-momentum}</td></tr><tr><td>end if 8←Ye8-1</td><td rowspan="6">{Using Xε to compute Bδk} {CG backtracking}</td></tr><tr><td>fk-1 ← f(Xg;0),Vf ← Vf(Xg;0),P ←Precon(X;0) Solve (B+ XI)δk = -Vf using CG(δg,Vf,P,S)</td></tr><tr><td>fk←f(Xg;0+δk)</td></tr><tr><td>for j= ζ -1 to 1 do</td></tr><tr><td>f(0+δx)←f(Xg;0+δ)</td></tr><tr><td>if f(0+δ)&lt;fk then</td></tr><tr><td>fk←f(0+δx),δk←δ end if</td></tr><tr><td>end for ρ←(fk-fk-1)/(¹δTBδk+∀fTδk)</td></tr><tr><td>{Using Xf to compute Bδk} ifp&lt;.25,入←1.01入elseifρ&gt;.75,入←.99入end if</td></tr><tr><td>ακ↑1,j←0 {Backtracking linesearch}</td></tr><tr><td>if fk &gt; fk-1 +.O1αkVfTδk then αk ← .8αk,j ← j+1 else break end if end while</td></tr><tr><td>while j&lt;ωdo</td></tr></table>
173
+
174
+ # 5 Experiments
175
+
176
+ We perform experimental evaluation on both classification and deep autoencoder tasks. The goal of classification experiments is to determine the effectiveness of SHF on test error generalization. For autoencoder tasks, we instead focus just on measuring the effectiveness of the optimizer on the training data. The datasets and experiments are summarized as follows:
177
+
178
+ • MNIST: Handwritten digits of size $2 8 \times 2 8$ with 60K training samples and 10K testing samples. For classification, we train networks of size 784-1200-1200-10 with rectifier activations. For deep autoencoders, the encoder architecture of 784-1000-500-250-30 with a symmetric decoding architecture is used. Logistic activations are used with a binary cross entropy error. For classification experiments, the data is scaled to have zero mean and unit variance. CURVES: Artificial dataset of curves of size $2 8 \times 2 8$ with 20K training samples and 10K testing samples. We train a deep autoencoder using an encoding architecture of 784-400-200-100-50-25- 6 with symmetric decoding. Similar to MNIST, logistic activations and binary cross entropy error are used.
179
+ • USPS: Handwritten digits of size $1 6 \times 1 6$ with 11K examples. We perform classification using 5 randomly sampled batches of 8K training examples and 3K testing examples as in [26] Each batch has an equal number of each digit. Classification networks of size 256-500-500-10 are trained with rectifier activations. The data is scaled to have zero mean and unit variance.
180
+ • Reuters: A collection of 8293 text documents from 65 categories. Each document is represented as a 18900-dimensional bag-of-words vector. Word counts $C$ are transformed to $\log ( 1 + C )$ as is done by [3]. The publically available train/test split of is used. We train networks of size 18900-65 for classification due to the high dimensionality of the inputs, which reduces to softmaxregression.
181
+
182
+ For classification experiments, we perform comparison of SHF with and without dropout against dropout SGD [3]. All classification experiments utilize the sparse initialization of Martens [4] with initial biases set to 0.1. The sparse initialization in combination with ReLUs make our networks similar to the deep sparse rectifier networks of [28]. All algorithms are trained for 500 epochs on MNIST and 1000 epochs on USPS and Reuters. We use weight decay of $5 \times 1 0 ^ { - 4 }$ for SHF and $2 \times 1 0 ^ { - 5 }$ for dropout SHF. A held-out validation set was used for determining the amount of input dropout for all algorithms. Both SHF and dropout SHF use initial damping of $\lambda = 1$ , gradient batch size of 1000, curvature batch size of 100 and 3 CG iterations per batch.
183
+
184
+ ![](images/748173be2b1be2a30287a2ada9d7e06a9e063f14330354f4c840072226220abf.jpg)
185
+ Figure 2: Training and testing curves for classification. dSHF: dropout SHF, dSGD: dropout SGD, dSGD-a: dropout on all layers, dSGD-l: dropout on last hidden layer only (as well as the inputs).
186
+
187
+ Dropout SGD training uses an exponential decreasing learning rate schedule initialized at 10, in combination with max-norm weight clipping [3]. This allows SGD to use larger learning rates for greater exploration early in training. A linearly increasing momentum schedule is used with initial momentum of 0.5 and final momentum of 0.99. No weight decay is used. For additional comparison we also train dropout SGD when dropout is only used in the last hidden layer, as is the case with dropout SHF.
188
+
189
+ For deep autoencoder experiments, we use the same experimental setup as in Chapter 7 of [17]. In particular, we focus solely on training error without any L2 penalty in order to determine the effectiveness of the optimizer on modeling the training data. Comparison is made against SGD, SGD with momentum, HF and Nesterov’s accelerated gradient (NAG). On CURVES, SHF uses an initial damping of $\lambda = 1 0$ , gradient and curvature batch sizes of 2000 and $2 5 ~ \mathrm { C G }$ iterations per batch. On MNIST, we use initial $\lambda = 1$ , gradient and curvature batch sizes of 3000 and $5 0 ~ \mathrm { C G }$ iterations per batch. Autoencoder training is ran until no sufficient progress is made, which occurs at around 250 epochs on CURVES and 100 epochs on MNIST.
190
+
191
+ # 5.1 Classification results
192
+
193
+ Figure 2 summarizes our classification results. At epoch 500, dropout SHF achieves 107 errors on MNIST. This result is similar to [3] which achieve 100-115 errors with various network sizes when training for a few thousand epochs. Without dropout or input corruption, SHF achieves 159 errors on MNIST, on par with existing methods that do not incorporate prior knowledge, pre-training, image distortions or dropout. As with [4], we hypothesize that further improvements can be made by fine-tuning with SHF after unsupervised layerwise pre-training.
194
+
195
+ After 1000 epochs of training on five random splits of USPS, we obtain final classification errors of $1 \%$ , $1 . 1 \%$ , $0 . 8 \%$ , $0 . 9 \%$ and $0 . 9 7 \%$ with a mean test error of $0 . 9 5 \%$ . Both algorithms use $5 0 \%$ input corruption. For additional comparison, [29] obtains a mean classification error of $1 . 1 4 \%$ using a pre-trained deep network for large-margin nearest neighbor classification with the same size splits. Without dropout, SHF overfits the training data.
196
+
197
+ On the Reuters dataset, SHF with and without dropout both demonstrate accelerated training. We hypothesize that further speedup may also be obtained by starting training with a much smaller $\lambda$ initialization, which we suspect is conservative given that the problem is convex.
198
+
199
+ Table 1: Training errors on the deep autoencoder tasks. All results are obtained from [17]. M(0.99) refers to momentum capped at 0.99 and similarily for M(0.9). SGD-VI refers to SGD using the variance normalized initialization of [15].
200
+
201
+ <table><tr><td>problem</td><td>NAG</td><td>M(0.99)</td><td>M(0.9)</td><td>SGD</td><td>SGD-VI[19]</td><td>HF</td><td>SHF</td></tr><tr><td>CURVES</td><td>0.078</td><td>0.110</td><td>0.220</td><td>0.250</td><td>0.160</td><td>0.110</td><td>0.089</td></tr><tr><td>MNIST</td><td>0.730</td><td>0.770</td><td>0.990</td><td>1.100</td><td>0.900</td><td>0.780</td><td>0.877</td></tr></table>
202
+
203
+ ![](images/b61fc0767657008b4573dece1e1bfaab47acdb4141c118106748495eda9033fe.jpg)
204
+ Figure 3: Learning curves for the deep autoencoder tasks. The CG decay parameter $\gamma$ is shut off at epoch 160 on CURVES and epoch 60 on MNIST.
205
+
206
+ # 5.2 Deep autoencoder results
207
+
208
+ Figure 3 and table 1 summarize our results. Inspired by [17] we make one additional modification to our algorithms. As soon as training begins to diverge, we turn off the CG decay parameter $\gamma$ in a similar fashion as the the momentum parameter $\mu$ is decreased in [17]. When $\gamma = 0$ , CG is no longer initialized from the previous solution and is instead initialized to zero. As with [17], this has a dramatic effect on the training error but to a lesser extent as momentum and Nesterov’s accelerated gradient. [17] describes the behaviour of this effect as follows: with a large momentum, the optimizer is able to make steady progress along slow changing directions of low curvature. By decreasing the momentum late in training, the optimizer is then able to quickly reach a local minimum from finer optimization along high curvature directions, which would otherwise be too difficult to obtain with an aggressive momentum schedule. This observation further motivates the relationship between momentum and information sharing through CG.
209
+
210
+ Our experimental results demonstrate that SHF does not perform significantly better or worse on these datasets compared to existing approaches. It is able to outperform HF on CURVES but not on MNIST. An attractive property that is shared with both HF and SHF is not requiring the careful schedule tuning that is necessary for momentum and NAG. We also attempted experiments with SHF using the same setup for classification with smaller batches and $5 \ : \mathrm { C G }$ iterations. The results were worse: on CURVES the lowest training error obtained was 0.19. This shows that while such a setup is useful from the viewpoint of noisy updates and test generalization, they hamper the effectiveness of making progress on hard to optimize regions.
211
+
212
+ # 6 Conclusion
213
+
214
+ In this paper we proposed a stochastic variation of Martens’ Hessian-free optimization incorporating dropout for training neural networks on classification and deep autoencoder tasks. By adapting the batch sizes and number of CG iterations, SHF can be constructed to perform well for classification against dropout SGD or optimizing deep autoencoders comparing HF, NAG and momentum methods. While our initial results are promising, of interest would be adapting stochastic Hessian-free optimization to other network architectures:
215
+
216
+ • Convolutional networks. The most common approach to training convolutional networks has been SGD incorporating a diagonal Hessian approximation [8]. Dropout SGD was recently used for training a deep convolutional network on ImageNet [30].
217
+ • Recurrent Networks. It was largely believed that RNNs were too difficult to train with SGD due to the exploding/vanishing gradient problem. In recent years, recurrent networks have become popular again due to several advancements made in their training [31].
218
+ • Recursive Networks. Recursive networks have been successfully used for tasks such as sentiment classification and compositional modeling of natural language from word embeddings [32]. These architectures are usually trained using L-BFGS.
219
+
220
+ It is not clear yet whether this setup is easily generalizable to the above architectures or whether improvements need to be considered. Furthermore, additional experimental comparison would involve dropout SGD with the adaptive methods of Adagrad [9] or [11], as well as the importance of pre-conditioning CG. None the less, we hope that this work initiates future research in developing stochastic Hessian-free algorithms.
221
+
222
+ # Acknowledgments
223
+
224
+ The author would like to thank Csaba Szepesvári for helpful discussion as well as David Sussillo for his guidance when first learning about and implementing HF. The author would also like to thank the anonymous ICLR reviewers for their comments and suggestions.
225
+
226
+ # References
227
+
228
+ [1] L. Bottou and O. Bousquet. The tradeoffs of large-scale learning. Optimization for Machine Learning, page 351, 2011.
229
+ [2] Y. Bengio, P. Lamblin, D. Popovici, and H. Larochelle. Greedy layer-wise training of deep networks. NIPS, 19:153, 2007.
230
+ [3] G.E. Hinton, N. Srivastava, A. Krizhevsky, I. Sutskever, and R.R. Salakhutdinov. Improving neural networks by preventing co-adaptation of feature detectors. arXiv:1207.0580, 2012.
231
+ [4] J. Martens. Deep learning via hessian-free optimization. In ICML, volume 951, 2010.
232
+ [5] J. Martens and I. Sutskever. Learning recurrent neural networks with hessian-free optimization. In ICML, 2011.
233
+ [6] B.A. Pearlmutter. Fast exact multiplication by the hessian. Neural Computation, 6(1):147–160, 1994.
234
+ [7] N.N. Schraudolph. Fast curvature matrix-vector products for second-order gradient descent. Neural computation, 14(7):1723–1738, 2002.
235
+ [8] Y. LeCun, L. Bottou, G. Orr, and K. Müller. Efficient backprop. Neural networks: Tricks of the trade, pages 546–546, 1998.
236
+ [9] J. Duchi, E. Hazan, and Y. Singer. Adaptive subgradient methods for online learning and stochastic optimization. JMLR, 12:2121–2159, 2010.
237
+ [10] J. Dean, G. Corrado, R. Monga, K. Chen, M. Devin, Q. Le, M. Mao, A. Senior, P. Tucker, K. Yang, et al. Large scale distributed deep networks. In NIPS, pages 1232–1240, 2012.
238
+ [11] T. Schaul, S. Zhang, and Y. LeCun. No more pesky learning rates. arXiv:1206.1106, 2012.
239
+ [12] A. Bordes, L. Bottou, and P. Gallinari. Sgd-qn: Careful quasi-newton stochastic gradient descent. JMLR, 10:1737–1754.
240
+ [13] Razvan Pascanu and Yoshua Bengio. Natural gradient revisited. arXiv preprint arXiv:1301.3584, 2013.
241
+ [14] N. Le Roux, P.A. Manzagol, and Y. Bengio. Topmoumoute online natural gradient algorithm. In NIPS, 2007.
242
+ [15] Xavier Glorot and Yoshua Bengio. Understanding the difficulty of training deep feedforward neural networks. In AISTATS, 2010.
243
+ [16] Yann N Dauphin and Yoshua Bengio. Big neural networks waste capacity. arXiv preprint arXiv:1301.3583, 2013.
244
+ [17] I. Sutskever. Training Recurrent Neural Networks. PhD thesis, University of Toronto, 2013.
245
+ [18] R.H. Byrd, G.M. Chin, J. Nocedal, and Y. Wu. Sample size selection in optimization methods for machine learning. Mathematical Programming, pages 1–29, 2012.
246
+ [19] O. Chapelle and D. Erhan. Improved preconditioner for hessian free optimization. In NIPS Workshop on Deep Learning and Unsupervised Feature Learning, 2011.
247
+ [20] I. Sutskever, J. Martens, and G. Hinton. Generating text with recurrent neural networks. In ICML, 2011.
248
+ [21] O. Vinyals and D. Povey. Krylov subspace descent for deep learning. arXiv:1111.4259, 2011.
249
+ [22] Q.V. Le, J. Ngiam, A. Coates, A. Lahiri, B. Prochnow, and A.Y. Ng. On optimization methods for deep learning. In ICML, 2011.
250
+ [23] Y. Bengio. Practical recommendations for gradient-based training of deep architectures. arXiv:1206.5533, 2012.
251
+ [24] J. Martens and I. Sutskever. Training deep and recurrent networks with hessian-free optimization. Neural Networks: Tricks of the Trade, pages 479–535, 2012.
252
+ [25] P. Vincent, H. Larochelle, Y. Bengio, and P.A. Manzagol. Extracting and composing robust features with denoising autoencoders. In ICML, pages 1096–1103, 2008.
253
+ [26] R. Min, D.A. Stanley, Z. Yuan, A. Bonner, and Z. Zhang. A deep non-linear feature mapping for large-margin knn classification. In Ninth IEEE International Conference on Data Mining, pages 357–366. IEEE, 2009.
254
+ [27] Deng Cai, Xuanhui Wang, and Xiaofei He. Probabilistic dyadic data analysis with local and global consistency. In ICML, pages 105–112, 2009.
255
+ [28] X. Glorot, A. Bordes, and Y. Bengio. Deep sparse rectifier neural networks. In AISTATS, 2011.
256
+ [29] R. Min, D.A. Stanley, Z. Yuan, A. Bonner, and Z. Zhang. A deep non-linear feature mapping for large-margin knn classification. In ICDM, pages 357–366, 2009.
257
+ [30] A. Krizhevsky, I. Sutskever, and G. Hinton. Imagenet classification with deep convolutional neural networks. NIPS, 25, 2012.
258
+ [31] Y. Bengio, N. Boulanger-Lewandowski, and R. Pascanu. Advances in optimizing recurrent networks. arXiv:1212.0901, 2012.
259
+ [32] R. Socher, B. Huval, C.D. Manning, and A.Y. Ng. Semantic compositionality through recursive matrix-vector spaces. In EMNLP, pages 1201–1211, 2012.
md/train/ttnAE7vaATtaK/ttnAE7vaATtaK.md ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Indoor Semantic Segmentation using depth information
2
+
3
+ # Camille Couprie1∗
4
+
5
+ Clement Farabet ´ 2,3
6
+
7
+ Laurent Najman3
8
+
9
+ Yann LeCun2
10
+
11
+ 1 IFP Energies Nouvelles Technology, Computer Science and Applied Mathematics Division Rueil Malmaison, France
12
+
13
+ 2 Courant Institute of Mathematical Sciences New York University New York, NY 10003, USA
14
+
15
+ 3 Universite Paris-Est ´ Laboratoire d’Informatique Gaspard-Monge Equipe A3SI - ESIEE Paris, France ´
16
+
17
+ # Abstract
18
+
19
+ This work addresses multi-class segmentation of indoor scenes with RGB-D inputs. While this area of research has gained much attention recently, most works still rely on hand-crafted features. In contrast, we apply a multiscale convolutional network to learn features directly from the images and the depth information. We obtain state-of-the-art on the NYU-v2 depth dataset with an accuracy of $6 4 . 5 \%$ We illustrate the labeling of indoor scenes in videos sequences that could be processed in real-time using appropriate hardware such as an FPGA.
20
+
21
+ # 1 Introduction
22
+
23
+ The recent release of the Kinect allowed many progress in indoor computer vision. Most approaches have focused on object recognition [1, 14] or point cloud semantic labeling [2], finding their applications in robotics or games [6]. The pioneering work of Silberman et al. [22] was the first to deal with the task of semantic full image labeling using depth information. The NYU depth v1 dataset [22] guathers 2347 triplets of images, depth maps, and ground truth labeled images covering twelve object categories. Most datasets employed for semantic image segmentation [11, 17] present the objects centered into the images, under nice lightening conditions. The NYU depth dataset aims to develop joint segmentation and classification solutions to an environment that we are likely to encounter in the everyday life. This indoor dataset contains scenes of offices, stores, rooms of houses containing many occluded objects unevenly lightened. The first results [22] on this dataset were obtained using the extraction of sift features on the depth maps in addition to the RGB images. The depth is then used in the gradient information to refine the predictions using graph cuts. Alternative CRF-like approaches have also been explored to improve the computation time performances [4]. The results on NYU dataset v1 have been improved by [19] using elaborate kernel descriptors and a post-processing step that employs gPb superpixels MRFs, involving large computation times.
24
+
25
+ A second version of the NYU depth dataset was released more recently [23], and improves the labels categorization into 894 different object classes. Furthermore, the size of the dataset did also increase, it now contains hundreds of video sequences (407024 frames) acquired with depth maps.
26
+
27
+ Feature learning, or deep learning approaches are particularly adapted to the addition of new image modalities such as depth information. Its recent success for dealing with various types of data is manifest in speech recognition [13], molecular activity prediction, object recognition [12] and many more applications. In computer vision, the approach of Farabet et al. [8, 9] has been specifically designed for full scene labeling and has proven its efficiency for outdoor scenes. The key idea is to learn hierarchical features by the mean of a multiscale convolutional network. Training networks using multiscales representation appeared also the same year in [3, 21].
28
+
29
+ When the depth information was not yet available, there have been attempts to use stereo image pairs to improve the feature learning of convolutional networks [16]. Now that depth maps are easy to acquire, deep learning approachs started to be considered for improving object recognition [20]. In this work, we suggest to adapt Farabet et al.’s network to learn more effective features for indoor scene labeling. Our work is, to the best of our knowledge, the first exploitation of depth information in a feature learning approach for full scene labeling.
30
+
31
+ # 2 Full scene labeling
32
+
33
+ # 2.1 Multi-scale feature extraction
34
+
35
+ Good internal representations are hierarchical. In vision, pixels are assembled into edglets, edglets into motifs, motifs into parts, parts into objects, and objects into scenes. This suggests that recognition architectures for vision (and for other modalities such as audio and natural language) should have multiple trainable stages stacked on top of each other, one for each level in the feature hierarchy. Convolutional Networks [15] (ConvNets) provide a simple framework to learn such hierarchies of features.
36
+
37
+ Convolutional Networks are trainable architectures composed of multiple stages. The input and output of each stage are sets of arrays called feature maps. In our case, the input is a color (RGB) image plus a depth (D) image and each feature map is a 2D array containing a color or depth channel of the input RGBD image. At the output, each feature map represents a particular feature extracted at all locations on the input. Each stage is composed of three layers: a filter bank layer, a non-linearity layer, and a feature pooling layer. A typical ConvNet is composed of one, two or three such 3-layer stages, followed by a classification module. Because they are trainable, arbitrary input modalities can be modeled, such as the depth modality that is added to the input channel in this work.
38
+
39
+ ![](images/ee6c0e4ec3b20fb08212454e266cba2d13547740b5b2087ab6e58a09b0c8d906.jpg)
40
+ Figure 1: Scene parsing (frame by frame) using a multiscale network and superpixels. The RGB channels of the image and the depth image are transformed through a Laplacian pyramid. Each scale is fed to a 3-stage convolutional network, which produces a set of feature maps. The feature maps of all scales are concatenated, the coarser-scale maps being upsampled to match the size of the finest-scale map. Each feature vector thus represents a large contextual window around each pixel. In parallel, a single segmentation of the image into superpixels is computed to exploit the natural contours of the image. The final labeling is obtained by the aggregation of the classifier predictions into the superpixels.
41
+
42
+ A great gain has been achieved with the introduction of the multiscale convolutional network described in [9]. The multi-scale, dense feature extractor produces a series of feature vectors for regions of multiple sizes centered around every pixel in the image, covering a large context. The multi-scale convolutional net contains multiple copies of a single network that are applied to different scales of a Laplacian pyramid version of the RGBD input image.
43
+
44
+ The RGBD image is first pre-processed, so that local neighborhoods have zero mean and unit standard deviation. The depth image, given in meters, is treated as an additional channel similarly to any color channel. The overview scheme of our model appears in Figure 1.
45
+
46
+ Beside the input image which is now including a depth channel, the parameters of the multi-scale network (number of scales, sizes of feature maps, pooling type, etc.) are identical to [9]. The feature maps sizes are 16,64,256, multiplied by the three scales. The size of convolutions kernels are set to 7 by 7 at each layer, and sizes of subsampling kernels (max pooling) are 2 by 2. In our tests we rescaled the images to the size $2 4 0 \times 3 2 0$ .
47
+
48
+ As in [9], the feature extractor followed by a classifier was trained to minimize the negative loglikelihood loss function. The classifier that follows feature extraction is a 2-layer multi-perceptron, with a hidden layer of size 1024. We use superpixels [10] to smooth the convnet predictions as a post-processing step, by agregating the classifiers predictions in each superpixel.
49
+
50
+ # 2.2 Movie processing
51
+
52
+ While the training is performed on single images, we are able to perform scene labeling of video sequences. In order to improve the performances of our frame-by-frame predictions, a temporal smoothing may be applied. In this work, instead of using the frame by frame superpixels as in the previous section, we employ the temporal consistent superpixels of [5]. This approach works in quasi-linear time and reduces the flickering of objects that may appear in the video sequences.
53
+
54
+ # 3 Results
55
+
56
+ We used for our experiments the NYU depth dataset – version 2 – of Silberman and Fergus [23], composed of 407024 couples of RGB images and depth images. Among these images, 1449 frames have been labeled. The object labels cover 894 categories. The dataset is provided with the original raw depth data that contain missing values, with code using [7] to inpaint the depth images.
57
+
58
+ # 3.1 Validation on images
59
+
60
+ The training has been performed using the 894 categories directly as output classes. The frequencies of object appearences have not been changed in the training process. However, we established 14 clusters of classes categories to evaluate our results more easily. The distributions of number of pixels per class categories are given in Table 1. We used the train/test splits as provided by the NYU depth v2 dataset, that is to say 795 training images and 654 test images. Please note that no jitter (rotation, translations or any other transformation) was added to the dataset to gain extra performances. However, this strategy could be employed in future work. The code consists of Lua scripts using the Torch machine learning software [18] available online at http://www.torch.ch/ .
61
+
62
+ To evaluate the influence of the addition of depth information, we trained a multiscale convnet only on the RGB channels, and another network using the additional depth information. Both networks were trained until the achievement of their best performances, that is to say for 105 epochs and 98 epochs respectively, taking less than 2 days on a regular server.
63
+
64
+ We report in Table 1 two different performance measures:
65
+
66
+ • the “classwise accuracy”, counting the number of correctly classified pixels divided by the number of false positive, averaged for each class. This number corresponds to the mean of the confusion matrix diagonal.
67
+ • the “pixelwise accuracy”, counting the number of correctly classified pixels divided by the total number of pixels of the test data.
68
+
69
+ We observe that considerable gains ( $1 5 \%$ or more) are achieved for the classes ’floor’, ’ceiling’, and ’furniture’. This result makes a lot of sense since these classes are characterized by a somehow constant appearance of their depth map. Objects such as TV, table, books can either be located in the foreground as well as in the background of images. On the contrary, the floor and ceiling will almost always lead to a depth gradient always oriented in the same direction: Since the dataset has been collected by a person holding a kinect device at a his chest, floors and ceiling are located at a distance that does not vary to much through the dataset. Figure 2 provides examples of depth maps that illustrate these observations. Overall, improvements induced by the depth information exploitation are present. In the next section, these improvements are more apparent.
70
+
71
+ ![](images/42327ef718a9cf73a2491ce24ee163a45f696fe5488f9b6632f4ff7276534bb7.jpg)
72
+ Figure 2: Some scene labelings using our Multiscale Convolutional Network trained on RGB and RGBD images. We observe in Table 1 that adding depth information helps to recognize objects that have low intra-class variance of depth appearance.
73
+
74
+ Table 1: Class occurrences in the test set – Performances per class and per pixel.
75
+
76
+ <table><tr><td rowspan=1 colspan=3></td><td rowspan=1 colspan=1>ClassOccurrences</td><td rowspan=1 colspan=1>MultiscaleConvnet Acc.[9]</td><td rowspan=1 colspan=1>MultiScl. Cnet+depth Acc.</td></tr><tr><td rowspan=1 colspan=3>bed</td><td rowspan=1 colspan=1>4.4%</td><td rowspan=1 colspan=1>30.3</td><td rowspan=1 colspan=1>38.1</td></tr><tr><td rowspan=1 colspan=3>objects</td><td rowspan=1 colspan=1>7.1 %</td><td rowspan=1 colspan=1>10.9</td><td rowspan=1 colspan=1>8.7</td></tr><tr><td rowspan=1 colspan=3>chair</td><td rowspan=1 colspan=1>3.4%</td><td rowspan=1 colspan=1>44.4</td><td rowspan=1 colspan=1>34.1</td></tr><tr><td rowspan=1 colspan=3>furnit.</td><td rowspan=1 colspan=1>12.3%</td><td rowspan=1 colspan=1>28.5</td><td rowspan=1 colspan=1>42.4</td></tr><tr><td rowspan=1 colspan=3>ceiling</td><td rowspan=1 colspan=1>1.4%</td><td rowspan=1 colspan=1>33.2</td><td rowspan=1 colspan=1>62.6</td></tr><tr><td rowspan=1 colspan=3>floor</td><td rowspan=1 colspan=1>9.9%</td><td rowspan=1 colspan=1>68.0</td><td rowspan=1 colspan=1>87.3</td></tr><tr><td rowspan=1 colspan=2>deco.</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>3.4%</td><td rowspan=1 colspan=1>38.5</td><td rowspan=1 colspan=1>40.4</td></tr><tr><td rowspan=1 colspan=2>sofa</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>3.2%</td><td rowspan=1 colspan=1>25.8</td><td rowspan=1 colspan=1>24.6</td></tr><tr><td rowspan=1 colspan=3>table</td><td rowspan=1 colspan=1>3.7%</td><td rowspan=1 colspan=1>18.0</td><td rowspan=1 colspan=1>10.2</td></tr><tr><td rowspan=1 colspan=3>wall</td><td rowspan=1 colspan=1>24.5%</td><td rowspan=1 colspan=1>89.4</td><td rowspan=1 colspan=1>86.1</td></tr><tr><td rowspan=1 colspan=2>window</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>5.1%</td><td rowspan=1 colspan=1>37.8</td><td rowspan=1 colspan=1>15.9</td></tr><tr><td rowspan=2 colspan=3>booksTVunkn.</td><td rowspan=1 colspan=1>2.9%</td><td rowspan=1 colspan=1>31.7</td><td rowspan=1 colspan=1>13.7</td></tr><tr><td rowspan=1 colspan=1>1.0%17.8%</td><td rowspan=1 colspan=1>18.81</td><td rowspan=1 colspan=1>6.01</td></tr><tr><td rowspan=1 colspan=3>Avg. Class Acc.</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>35.8</td><td rowspan=1 colspan=1>36.2</td></tr><tr><td rowspan=1 colspan=3>Pixel Accuracy (mean)</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>51.0</td><td rowspan=1 colspan=1>52.4</td></tr><tr><td rowspan=1 colspan=3>Pixel Accuracy (median)</td><td rowspan=1 colspan=1>=</td><td rowspan=1 colspan=1>51.7</td><td rowspan=1 colspan=1>52.9</td></tr><tr><td rowspan=1 colspan=3>Pixel Accuracy (std. dev.)</td><td rowspan=1 colspan=1>=</td><td rowspan=1 colspan=1>15.2</td><td rowspan=1 colspan=1>15.2</td></tr></table>
77
+
78
+ # 3.2 Comparison with Silberman et al.
79
+
80
+ In order to compare our results to the state-of-the-art on the NYU depth v2 dataset, we adopted a different selection of outputs instead of the 14 classes employed in the previous section. The work of Silberman et al. [23] defines the four semantic classes Ground, Furniture, Props and Structure. This class selection is adopted in [23] to use semantic labelings of scenes to infer support relations between objects. We recall that the recognition of the semantic categories is performed in [23] by the definition of diverse features including SIFT features, histograms of surface normals, 2D and 3D bounding box dimensions, color histograms, and relative depth.
81
+
82
+ Table 2: Accuracy of the multiscale convnet compared with the state-of-the-art approach of [23].
83
+
84
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Ground</td><td rowspan=1 colspan=1>Furniture</td><td rowspan=1 colspan=1>Props</td><td rowspan=1 colspan=1>Structure</td><td rowspan=1 colspan=1>Class Acc.</td><td rowspan=1 colspan=1>Pixel Acc.</td></tr><tr><td rowspan=1 colspan=1>Silberman et al.[23]</td><td rowspan=1 colspan=1>68</td><td rowspan=1 colspan=1>70</td><td rowspan=1 colspan=1>42</td><td rowspan=1 colspan=1>59</td><td rowspan=1 colspan=1>59.6</td><td rowspan=1 colspan=1>58.6</td></tr><tr><td rowspan=1 colspan=1>Multiscale convnet [9]</td><td rowspan=1 colspan=1>68.1</td><td rowspan=1 colspan=1>51.1</td><td rowspan=1 colspan=1>29.9</td><td rowspan=1 colspan=1>87.8</td><td rowspan=1 colspan=1>59.2</td><td rowspan=1 colspan=1>63.0</td></tr><tr><td rowspan=1 colspan=1>Multiscale+depth convnet</td><td rowspan=1 colspan=1>87.3</td><td rowspan=1 colspan=1>45.3</td><td rowspan=1 colspan=1>35.5</td><td rowspan=1 colspan=1>86.1</td><td rowspan=1 colspan=1>63.5</td><td rowspan=1 colspan=1>64.5</td></tr></table>
85
+
86
+ As reported in Table 2, the results achieved using the Multiscale convnet are improving the structure class predictions, resulting in a $4 \%$ gain in pixelwise accuracy over Silberman et al. approach. Adding the depth information results in a considerable improvement of the ground prediction, and performs also better over the other classes, achieving a $4 \%$ gain in classwise accuracy over previous works and improves by almost $6 \%$ the pixelwise accuracy compared to Silberman et al.’s results.
87
+
88
+ We note that the class ’furniture’ in the 4-classes evaluation is different than the ’furniture’ class of the 14-classes evaluation. The furniture-4 class encompasses chairs and beds but not desks, and cabinets for example, explaining a drop of performances here using the depth information.
89
+
90
+ # 3.3 Test on videos
91
+
92
+ The NYU v2 depth dataset contains several hundreds of video sequences encompassing 26 different classes of indoor scenes, going from bedrooms to basements, and dining rooms to book stores. Unfortunately, no ground truth is yet available to evaluate our performances on this video. Therefore, we only present here some illustrations of the capacity of our model to label these scenes.
93
+
94
+ The predictions are computed frame by frame on the videos and are refined using temporally smoothed superpixels using [5]. Two examples of results on sequences are shown at Figure 3.
95
+
96
+ A great advantage of our approach is its nearly real time capabilities. Processing a $3 2 0 \mathrm { x } 2 4 0$ frame takes 0.7 seconds on a laptop [9]. The temporal smoothing only requires an additional 0.1s per frame.
97
+
98
+ ![](images/3ea51440382a518ebbd5ecb0e8cf982a65aee75a4c2ecd9be7cfbca3c7d3a094.jpg)
99
+ Figure 3: Some results on video sequences of the NYU v2 depth dataset. Note that results (c,d) could be improved by using more training examples. Indeed, only a very small number in the labeled training examples exhibit a wall in the foreground.
100
+
101
+ # 4 Conclusion
102
+
103
+ Feature learning is a particularly satisfying strategy to adopt when approaching a dataset that contains new image (or other kind of data) modalities. Our model, while being faster and more efficient than previous approaches, is easier to implement without the need to design specific features adapted to depth information. Different clusterings of object classes as the ones used in this work may be chosen, reflecting this work’s flexibility of applications. For example, using the 4-classes clustering, the accurate results achieved with the multi-scale convolutional network could be applied to perform inference on support relations between objects. Improvements for specific object recognition could further be achieved by filtering the frequency of the training objects. We observe that the recognition of object classes having similar depth appearance and location is improved when using the depth information. On the contrary, it is better to use only RGB information to recognize objects with classes containing high variability of their depth maps. This observation could be used to combine the best results in function of the application. Finally, a number of techniques (unsupervised feature learning, MRF smoothing of the convnet predictions, extension of the training set) would probably help to improve the present system.
104
+
105
+ # 5 Acknowledgments
106
+
107
+ We would like to thank Nathan Silberman for his useful input for handling the NYU depth v2 dataset, and fruitful discussions.
108
+
109
+ # References
110
+
111
+ [1] B3do: Berkeley 3-d object dataset. http://kinectdata.com/. 1
112
+ [2] Cornell-rgbd-dataset. http://pr.cs.cornell.edu/sceneunderstanding/data/data.php. 1
113
+ [3] Dan Claudiu Ciresan, Alessandro Giusti, Luca Maria Gambardella, and Jurgen Schmidhuber. ¨ Deep neural networks segment neuronal membranes in electron microscopy images. In NIPS, pages 2852–2860, 2012. 1
114
+ [4] Camille Couprie. Multi-label energy minimization for object class segmentation. In 20th European Signal Processing Conference 2012 (EUSIPCO 2012), Bucharest, Romania, August 2012. 1
115
+ [5] Camille Couprie, Clement Farabet, and Yann LeCun. Causal graph-based video segmentation, ´ 2013. arXiv:1301.1671. 2.2, 3.3
116
+ [6] L. Cruz, D. Lucio, and L. Velho. Kinect and rgbd images: Challenges and applications. SIBGRAPI Tutorial, 2012. 1
117
+ [7] Anat Levin Dani, Dani Lischinski, and Yair Weiss. Colorization using optimization. ACM Transactions on Graphics, 23:689–694, 2004. 3
118
+ [8] Clement Farabet, Camille Couprie, Laurent Najman, and Yann LeCun. Scene Parsing with Multiscale Feature Learning, Purity Trees, and Optimal Covers. In Proc. of the 2012 International Conference on Machine Learning, Edinburgh, Scotland, June 2012. 1 [9] Clement Farabet, Camille Couprie, Laurent Najman, and Yann LeCun. Learning hierarchical features for scene labeling. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2013. In press. 1, 2.1, 3.1, 3.2, 3.3
119
+ [10] Pedro F. Felzenszwalb and Daniel P. Huttenlocher. Efficient graph-based image segmentation. International Journal of Computer Vision, 59:2004, 2004. 2.1
120
+ [11] Stephen Gould, Richard Fulton, and Daphne Koller. Decomposing a Scene into Geometric and Semantically Consistent Regions. In IEEE International Conference on Computer Vision, 2009. 1
121
+ [12] Geoffrey E. Hinton, Nitish Srivastava, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Improving neural networks by preventing co-adaptation of feature detectors. CoRR, abs/1207.0580, 2012. 1
122
+ [13] Navdeep Jaitly, Patrick Nguyen, Andrew Senior, and Vincent Vanhoucke. Application of pretrained deep neural networks to large vocabulary speech recognition. In Proceedings of Interspeech 2012, 2012. 1
123
+ [14] Allison Janoch, Sergey Karayev, Yangqing Jia, Jonathan T. Barron, Mario Fritz, Kate Saenko, and Trevor Darrell. A category-level 3-d object dataset: Putting the kinect to work. In ICCV Workshops, pages 1168–1174. IEEE, 2011. 1
124
+ [15] Y. LeCun, L. Bottou, Y. Bengio, and P. Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278 –2324, nov 1998. 2.1
125
+ [16] Yann LeCun, Fu-Jie Huang, and Leon Bottou. Learning Methods for generic object recognition with invariance to pose and lighting. In Proceedings of CVPR’04. IEEE, 2004. 1
126
+ [17] Ce Liu, Jenny Yuen, and Antonio Torralba. SIFT Flow: Dense Correspondence across Scenes and its Applications. IEEE transactions on pattern analysis and machine intelligence, pages 1–17, August 2010. 1
127
+ [18] C. Farabet R. Collobert, K. Kavukcuoglu. Torch7: A matlab-like environment for machines learning. In Big Learning Workshop ( $@$ NIPS’11), Sierra Nevada, Spain, 2011. 3.1
128
+ [19] Xiaofeng Ren, Liefeng Bo, and D. Fox. Rgb-(d) scene labeling: Features and algorithms. In Computer Vision and Pattern Recognition (CVPR), 2012 IEEE Conference on, pages 2759 –2766, june 2012. 1
129
+ [20] Richard Socher and Brody Huval and Bharath Bhat and Christopher D. Manning and Andrew Y. Ng. Convolutional-Recursive Deep Learning for 3D Object Classification. In Advances in Neural Information Processing Systems 25. 2012. 1
130
+ [21] Hannes Schulz and Sven Behnke. Learning object-class segmentation with convolutional neural networks. In 11th European Symposium on Artificial Neural Networks (ESANN), 2012. 1
131
+ [22] Nathan Silberman and Rob Fergus. Indoor scene segmentation using a structured light sensor. In 3DRR Workshop, ICCV’11, 2011. 1
132
+ [23] Nathan Silberman, Derek Hoiem, Pushmeet Kohli, and Rob Fergus. Indoor segmentation and support inference from rgbd images. In ECCV, 2012. 1, 3, 3.2, 2
md/train/vVjIW3sEc1s/vVjIW3sEc1s.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/zoQJBVrhnn3/zoQJBVrhnn3.md ADDED
@@ -0,0 +1,498 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Learning to Safely Exploit a Non-Stationary Opponent
2
+
3
+ Anonymous Author(s)
4
+ Affiliation
5
+ Address
6
+ email
7
+
8
+ # Abstract
9
+
10
+ 1 In dynamic multi-player games, an effective way to exploit an opponent’s weak
11
+ 2 nesses is to build a perfectly accurate opponent model. This renders the learning
12
+ 3 problem a single-agent optimization which can be solved by typical reinforcement
13
+ 4 learning. However, naive behavior cloning may not suffice to train an exploiting
14
+ 5 policy because opponents’ behaviors are often non-stationary due to their adapta
15
+ 6 tions in response to other agents’ strategies. On the other hand, overfitting to an
16
+ 7 opponent (i.e., exploiting only one specific type of opponent) makes the learning
17
+ 8 player easily exploitable by others. To address the above problems, we propose
18
+ 9 a method named Exploit Policy-Space Opponent Model (EPSOM). In EPSOM,
19
+ 10 we model an opponent’s non-stationarity as a series of transitions among different
20
+ 11 policies, and formulate such a transition process through Bayesian non-parametric
21
+ 12 methods. To account for the trade-off between exploitation and exploitability, we
22
+ 13 train a player to learn a robust best response to the opponent’s predicted strategy
23
+ 14 by solving a modified meta-game in policy space. In this work, we consider a
24
+ 15 two-player zero-sum game setting and evaluate EPSOM on Kuhn poker; results
25
+ 16 suggest that our method is capable of exploiting its adaptive opponent, whilst
26
+ 17 maintaining low exploitability (i.e., achieving safe opponent exploitation). Further
27
+ 18 more, we show that our EPSOM agent has strong performance against unknown
28
+ 19 non-stationary opponents without further training.
29
+
30
+ # 20 1 Introduction
31
+
32
+ 21 In single agent reinforcement learning (SARL), an agent learns to act by iteratively interacting with
33
+ 22 an environment. In such a setting, an agent’s learning objective and its performance evaluation
34
+ 23 are normally clear and straightforward, e.g., its long-term cumulative rewards gained from the
35
+ 24 environment. However, in multi-agent reinforcement learning (MARL), one agent’s performance
36
+ 25 greatly depends on the behavior of other agents. Hence, finding a reliable learning objective and
37
+ 26 evaluation method become non-trivial [3, 9, 31, 48]. Naive solutions of the problem using SARL
38
+ 27 generalize badly [21] and optimizing the joint policy of all agents does not scale. Recent approaches
39
+ 28 combining game theoretical analysis with deep RL have seen some success in large zero-sum
40
+ 29 games [4, 44].
41
+ 30 Game theory offers a mathematical framework to model strategic interactions among players [28].
42
+ 31 Under perfect rationality [12], a central solution concept is Nash equilibrium (NE) where no player
43
+ 32 benefits from deviating from their equilibrium strategy. In a two-player zero-sum game without
44
+ 33 any inherent advantage for either player (e.g. as a first mover), a NE is a safe strategy to play (i.e.,
45
+ 34 playing not to lose) – NE guarantees a tie in the worst case in expectation. However, NE is not the
46
+ 35 most profitable strategy in many cases. In complex competitive games, such as poker, it is common
47
+ 36 that agents encounter opponents with bounded rationality, in the sense that they may at best play an
48
+ 37 approximate Nash equilibrium strategy and often play dominated actions [5, 33]. Therefore, playing
49
+ 38 a NE can potentially forego significant rewards against sub-optimal opponents. This incentivizes
50
+ 39 players to deviate from the NE and exploit their opponents’ weakness (i.e., playing to win). However,
51
+ 40 the resulting strategy could render itself exploitable should it overfit to the current opponent. Playing
52
+ 41 to win can therefore lead to exploitation by other opponent strategies. In the case of deceptive
53
+ 42 opponents such exploitation is known as the “get taught and exploited” problem [35].
54
+ 43 To better balance the trade-off between playing to win against the current opponents (exploitation) and
55
+ 44 not losing to unknown opponents (exploitability), Johanson et al. [19] proposed a solution concept,
56
+ 45 named Restricted Nash Response (RNR). RNR and its variants [18, 19, 33] assume stationary
57
+ 46 opponents, i.e., the strategies they learn to exploit are unknown but fixed. However, in many real
58
+ 47 world applications, opponents may adapt and change their strategies on an ongoing basis. For example,
59
+ 48 in Rock-Paper-Scissors when a player learns to best respond by playing Rock to an opponent’s strategy
60
+ 49 which always plays Scissors, the opponent may then learn to best respond to your best response by
61
+ 50 playing Paper. Furthermore, prior RNR approaches only provide one-off solutions in the sense that
62
+ 51 whenever we need to re-adjust the trade-off between exploitation and exploitability or the opponent
63
+ 52 uses a new fixed policy, we need to re-solve the updated game from scratch.
64
+ 53 In this work, we focus on problems with non-stationary opponents. An opponent’s learning process
65
+ 54 can be generally modeled as transitions among a mixture of unknown number of policies. This
66
+ 55 motivates the usage of a Dirichlet process mixture model. As we can only collect trajectories produced
67
+ 56 by the adaptive opponents online, we propose to learn our model in a streaming fashion. Given the
68
+ 57 predicted opponent policy from our model, we provide a general framework for training an agent
69
+ 58 to safely exploit the non-stationary opponent where safe exploitation means exploiting the current
70
+ 59 opponent with a low probability of being exploited by other opponents in future. We empirically
71
+ 60 demonstrate the ability of our approach to safely exploit a non-stationary opponent in Kuhn Poker, a
72
+ 61 simplified Poker game. Furthermore, once trained, our model can produce strong counter strategies
73
+ 62 to unseen opponents without any further training in new tournaments.
74
+
75
+ # 63 2 Related Works
76
+
77
+ 64 A fundamental ability of an effective AI agent is the capacity to interact with other intelligent
78
+ 65 agents. Therefore, the capability of reasoning about other agents’ goals [34], private information [27],
79
+ 66 behavior [13] and other characteristics is crucial. The issue of non-stationarity in multi-agent systems
80
+ 67 resulting from coexisting agents is well-known and well documented [14, 32]. Classical solutions to
81
+ 68 resolve the issue of non-stationarity include centralized training [24], self-play [44], meta-learning [1]
82
+ 69 and opponent modeling [2]. When specifically applied to the issue of non-stationarity, most previous
83
+ 70 works focusing on opponent modeling which switches between different opponent models when a
84
+ 71 change in opponent(s) is detected. A switch of model may be triggered by a drop in opponent model
85
+ 72 prediction accuracy [10] or when performance in terms of reward received for a fixed policy drops
86
+ 73 [15]. Deep ${ \mathrm { B P R } } +$ [49] combines a measure of opponent model accuracy and reward tracking to decide
87
+ 74 when to learn a new policy. Significantly, most of these works limit the opponents’ non-stationarity
88
+ 75 to periodically changing their policies within a finite pre-defined set of stationary policies.
89
+ 76 In this work, we consider non-stationarity during the training stage arising from the opponents’
90
+ 77 concurrent learning dynamics, rather than drawing stationary opponents from a pre-defined set. The
91
+ 78 entire lifetime of an opponent can generally be modeled as a mixture of an unknown (possibly infinite)
92
+ 79 number of policies. This motivates the usage of a Dirichlet Process (DP) mixture model [6, 42] which
93
+ 80 can infer the number of mixture components from data and provide incremental model capacity
94
+ 81 on demand. Various approximate inference methods are reported for DP mixture models, such as
95
+ 82 Markov chain Monte Carlo [17] and variational inference [6, 16, 45]. However, these inference
96
+ 83 methods either do not adapt to an online setting or truncate the number of clusters to a finite value.
97
+ 84 Recently proposed streaming inference algorithms [23, 41] enable the DP mixture model to solve
98
+ 85 online non-stationary problems in a truly non-parametric way. Applications have been reported in
99
+ 86 task-free continual learning [22] and model-based reinforcement learning [47]. In this paper, we
100
+ 87 adopt this approach to model and simulate a non-stationary opponent for MARL.
101
+ 88 It is well known that finding a NE is PPAD-hard even in two-player games [8]. An exception is two
102
+ 89 player zero-sum games where the NE can be tractably solved by a linear program (LP) in polynomial
103
+ 90 time [43]. However, in games with extremely large action spaces, approximate NE solutions, such
104
+ 91 as fictitious play (FP) [7] and counterfactual regret minimisation (CFR) [50], have to be used. An
105
+ 92 important design principle that underpins NE approximation is the iterative best-response dynamics.
106
+ 93 Two representative methods are Double Oracle (DO) [26] and Policy Space Response Oracle (PSRO)
107
+ 94 [21]. In the dynamics of DO [26], players are initialized with restricted strategy sets; then at each
108
+ 95 iteration, a NE will be computed over the current restricted sets. These sets will be expanded by
109
+ 96 adding the best-response strategy to the NE computed over the full strategy sets. The iterative
110
+ 97 process continues until the best response is in the restricted strategy pool. PSRO approximates DO by
111
+ 98 interleaving empirical game-theoretic analysis (EGTA) with deep RL. In contrast with DO, the game
112
+ 99 with restricted strategy sets has to be estimated through simulation. Furthermore, the exact analytical
113
+ 100 best-response oracle is replaced in PSRO by a deep RL oracle which calculates an approximate best
114
+ 101 response. PSRO is a general self-play framework for MARL and many approaches built upon it have
115
+ 102 been proposed to improve its performance [25, 29, 30, 39]. Our approach, EPSOM, is not limited to
116
+ 103 the self-play setting. In addition, although we favor solutions with low exploitability (i.e. solutions
117
+ 104 close to NE) as PSRO does, our ultimate goal is to find a robust best response to a non-stationary
118
+ 105 opponent rather than solving the game for an (approximate) NE.
119
+
120
+ # 106 3 Preliminaries
121
+
122
+ 107 We consider the decentralized training and decentralized execution (DTDE) setting in zero-sum
123
+ 108 games where we have access to interaction trajectories $\tau$ between our agent and the opponenti .
124
+ 109 Whilst our approach can be extended to games with multiple opponents, in this work we focus on
125
+ 110 2-player zero-sum games. Before introducing our algorithm, we present some necessary preliminary
126
+ 111 concepts and notation in the remainder of this section.
127
+
128
+ # 112 3.1 Meta Normal-Form Game
129
+
130
+ 113 We consider opponent modeling in policy space and learn to respond to the predicted distribution
131
+ 114 of the opponents’ policies. We formulate this problem as solving a two-player normal-form game
132
+ 115 (NFG) between our agent and its opponents as a whole with notation adapted to our presentation. We
133
+ 116 denote a 2-player NFG by a tuple $( \Pi , U , { \mathcal { N } } )$ where $\Pi ^ { i }$ is player $i$ ’s set of policies and $i \in \mathcal N$ where
134
+ 117 $\mathcal { N } = \{ 1 , 2 \}$ . For ease of notation, we take player 1 as the training agent and player 2 as its opponent.
135
+ 118 We use $\begin{array} { r } { \Pi = \prod _ { i \in \mathcal { N } } \Pi ^ { i } } \end{array}$ to denote the set of joint policies (strategy profiles). $\dot { U } ( \pi ) : \Pi \mathbf { \bar { \mathfrak { R } } } ^ { n }$ is a
136
+ 119 payoff table of utilities for each joint policy $\pi$ played by all players. $u ^ { i } ( \pi )$ denotes the utility value
137
+ 120 for player $i$ and joint policy $\pi$ . A player can choose a policy $\pi ^ { i }$ from $\Pi ^ { i }$ or sample from a mixture
138
+ 121 (meta-strategy) over them $\bar { \sigma ^ { i } } \in \Delta \bar { ( \Pi ^ { i } ) }$ where $\Delta$ is a probability simplex. In the terminology of game
139
+ 122 theory, $\sigma ^ { i }$ is a mixed strategy and each policy $\pi ^ { i }$ is a pure strategy.
140
+ 123 Each player in the game is assumed to maximize their utility. The most well-known steady-state
141
+ 124 concept of a game is the Nash equilibrium (NE). NE is a strategy profile $\pi$ such that no player has an
142
+ 125 incentive to deviate from its current strategy given the strategies of the other players. Namely, each
143
+ 126 player’s strategy is a best response to others’ $\begin{array} { r } { \bar { B } \mathcal { R } ( { \pi } ^ { - i } ) = \bar { \mathrm { a r g m a x } } _ { \pi ^ { i } } u ^ { i } ( { \pi } ^ { i } , { \pi } ^ { \div i } ) ^ { * } \forall i \in \mathcal { N } . } \end{array}$ We call a
144
+ 127 set of policies $\epsilon$ -best responses to a joint opponents’ policy $\pi ^ { - i }$ , when there exists an $\epsilon > 0$ , such
145
+ 128 that $\bar { B ^ { } \mathcal { R } } _ { \epsilon } ( \pi ^ { - i } ) = \{ \pi ^ { i } : \bar { u } ^ { i } ( \pi ^ { i } , \pi ^ { - i } ) \overset { \cdot } { \geq } u ^ { i } ( \bar { B } \bar { \mathcal { R } } ( \pi ^ { - i } ) , \bar { \pi } ^ { - i } ) - \epsilon \}$ . An $\epsilon$ -Nash equilibrium is a strategy
146
+ 129 profile that satisfies: $u ^ { i } ( \pi ) \geq \operatorname* { m a x } _ { \pi ^ { i \prime } } u ^ { i } ( \pi ^ { i \prime } , \pi ^ { - i } ) - \epsilon \forall i \in \dot { N }$ .
147
+
148
+ # 3.2 Exploitability and Exploitation
149
+
150
+ To evaluate our learned policy 31 $\pi ^ { 1 }$ , we use two metrics. An agent’s policy’s $\pi ^ { 1 }$ exploitation of an opponent’s policy 32 $\pi ^ { 2 }$ is the extra gain obtained by the agent compared to its NE value $v ^ { 1 }$ :
151
+
152
+ $$
153
+ \omega ( \pi ^ { 1 } , \pi ^ { 2 } ) = u ^ { 1 } ( \pi ^ { 1 } , \pi ^ { 2 } ) - v ^ { 1 } .
154
+ $$
155
+
156
+ 133 This measures how much the policy $\pi ^ { 1 }$ exploits the weakness of the opponent’s policy $\pi ^ { 2 }$ . However,
157
+ 134 in general, there is no guarantee that the learned policy $\pi ^ { 1 }$ has no weakness. Therefore, we also
158
+ 135 define the exploitability of a policy $\pi ^ { 1 }$ which measures the loss incurred when the agent faces the
159
+
160
+ best opponent policy 136 $\pi ^ { 2 } = B \mathcal { R } ( \pi ^ { 1 } )$ compared to the agent’s Nash equilibrium value $v ^ { 1 }$ :
161
+
162
+ $$
163
+ \begin{array} { r l } & { \epsilon ( \pi ^ { 1 } ) = v ^ { 1 } - u ^ { 1 } \bigl ( \pi ^ { 1 } , \mathcal { B } \mathcal { R } ( \pi ^ { 1 } ) \bigr ) } \\ & { \qquad = \underset { \pi ^ { 1 / } } { \operatorname* { m a x } } \underset { \pi ^ { 2 } } { \operatorname* { m i n } } u ^ { 1 } ( \pi ^ { 1 \prime } , \pi ^ { 2 } ) - \underset { \pi ^ { 2 } } { \operatorname* { m i n } } u ^ { 1 } ( \pi ^ { 1 } , \pi ^ { 2 } ) . } \end{array}
164
+ $$
165
+
166
+ 37 From Equation 1 we can see that the exploitability of a policy is non-negative and represents the distance of policy 138 $\pi ^ { 1 }$ to an equilibrium.
167
+
168
+ # 3.3 Restricted Nash Response (RNR)
169
+
170
+ 140 Johanson et al. [19] consider a modified zero-sum game where an opponent has a restricted strategy
171
+ 141 space $\Pi _ { p , \pi _ { \mathrm { f i x } } } ^ { 2 }$ such that it plays a fixed policy $\pi _ { \mathrm { f i x } }$ with probability $p$ and plays any possible policy
172
+ 142 from the original strategy space $\Pi ^ { 2 }$ with probability $1 - p$ . Given $( p , \pi _ { \mathrm { f i x } } )$ , they define a restricted
173
+ 143 Nash equilibrium as a strategy profile $( \pi ^ { 1 * } , \pi ^ { 2 * } )$ such that $\pi ^ { 1 * } \in B \mathcal { R } ( \pi ^ { 2 * } )$ and $\dot { \pi } ^ { 2 * } \in B \mathcal { R } _ { p , \pi _ { \mathrm { f i x } } } \big ( \pi ^ { 1 * } \big )$ ,
174
+ 144 where: $\begin{array} { r } { \mathcal { B } \mathcal { R } _ { p , \pi _ { \mathrm { f i x } } } ( \pi ^ { 1 * } ) = \arg \operatorname* { m a x } _ { \pi ^ { 2 } \in \Pi _ { p , \pi _ { \mathrm { f i x } } } ^ { 2 } } u ^ { 2 } ( \pi ^ { 1 } , \pi ^ { 2 } ) } \end{array}$ . It is shown that $\pi ^ { 1 * }$ is the best response to
175
+ 145 $\pi _ { \mathrm { f i x } }$ among strategies which have equal or lower exploitabilities than $\pi ^ { 1 * }$ , i.e.: $\pi ^ { 1 * } = B \mathcal { R } _ { \epsilon } ( \pi _ { \mathrm { f i x } } )$ ,
176
+ 146 where $\epsilon = \bar { \epsilon } ( \pi ^ { 1 * } )$ . Therefore, $\pi ^ { 1 * }$ is called a $\boldsymbol { \mathrm { p } }$ -restricted Nash response (RNR) to $\pi _ { \mathrm { f i x } }$ . An RNR can
177
+ 147 be computed by solving the modified game, we present a linear programming solver implementation
178
+ 148 for NFGs in Appendix A.2.
179
+
180
+ # 149 4 Dirichlet Process Mixture Opponent Modeling
181
+
182
+ 150 This section presents our non-parametric Bayesian method for modeling a non-stationary opponent.
183
+ 151 We consider an opponent’s learning process as consecutive transitions from one policy to another
184
+ 152 such that one opponent can theoretically adopt infinitely many policies during its life-time. Therefore,
185
+ 153 we propose to use a Dirichlet process (DP) mixture to model the learning process as it has the ability
186
+ 154 to model an infinite number of clusters (policies in this case) while inferring the current number of
187
+ 155 policies from the data collected thus far. As our agent interacts with the opponent online, we learn a
188
+ 156 model with a sequential maximum-a-posteriori approach.
189
+ 157 We model an opponent policy as a parameterized function $\pi _ { \phi } ^ { 2 }$ and denote the parameter space as
190
+ 158 $\Phi$ . To avoid cluttered notation in this section, we use $\phi$ to represent the modeled opponent’s policy.
191
+ 159 $\mathbf { D P } ( \alpha H )$ is a stochastic process with a concentration parameter $\alpha$ and a base distribution $H$ over $\Phi$ .
192
+ 160 A random draw $G \sim \mathbf { D P } ( \alpha H )$ is itself a distribution over $\Phi$ , satisfying:
193
+
194
+ $$
195
+ ( G ( A _ { 1 } ) , . . . , G ( A _ { r } ) ) \sim \mathrm { { \bf D i r i c h l e t } } ( \alpha H ( A _ { 1 } ) , . . . , \alpha H ( A _ { r } ) )
196
+ $$
197
+
198
+ 161 for every finite measurable partition $A _ { 1 } , . . . , A _ { r }$ of $\Phi$ . The full graphical model for opponent modeling 162 is shown in Figure 1a. It illustrates a generative process where at step $m$ , the opponent first samples a policy 163 $\hat { \phi } _ { m } \sim \bar { G }$ and then rolls-out this policy to collect a trajectory $\tau _ { m }$ .
199
+
200
+ 164 To facilitate Bayesian inference, two representations of DP are considered. The stick-breaking
201
+ 165 166 reas $\begin{array} { r } { G = \sum _ { k = 1 } ^ { \infty } \beta _ { k } \delta _ { \phi _ { k } } } \end{array}$ ure 1b where $\beta \sim \mathbf { G E M } ( \alpha )$ ete nature of is an infinite $G$ . i $G \sim \mathbf { D P } ( \alpha H )$ can be constructedm variable sampled
202
+ 167 from the Griffiths-Engen-McCloskey (GEM) distribution and $\{ \phi _ { k } \} _ { k = 1 } ^ { \infty }$ are i.i.d. sampled policies
203
+ 168 from $H$ . At step $m$ , the opponent samples a policy index $z _ { m } \sim \mathbf { C a t e g o r i c a l } ( \beta )$ and rolls-out the
204
+ 169 policy $\phi _ { z _ { m } }$ . Inference with the stick-breaking representation is required in order to handle the infinite
205
+ 170 dimensional $\beta$ . Therefore, the truncation method [6] is commonly used to limit the model capacity
206
+ 171 to a $K$ mixture and infer the actual number of policies by collapsing redundant ones. This requires
207
+ 172 tracking all $K$ policies simultaneously and does not adapt well to online settings.
208
+ 173 The Chinese restaurant process (CRP) representation in Figure 1c can be obtained by integrating
209
+ 174 out $\beta$ . This introduces temporal dependencies between the policies, which can be expressed by the
210
+ 175 conditional distribution:
211
+
212
+ $$
213
+ p \big ( z _ { m + 1 } = k | z _ { 1 : m } \big ) = \left\{ \begin{array} { l l } { \frac { \alpha } { m + \alpha } , } & { k = K _ { m } + 1 } \\ { \qquad } \\ { \frac { | k | _ { m } } { m + \alpha } , } & { 1 \leq k \leq K _ { m } } \end{array} \right.
214
+ $$
215
+
216
+ 176 where $\begin{array} { r } { | k | _ { m } = \sum _ { i = 1 } ^ { m } \mathcal { I } ( z _ { i } = k ) } \end{array}$ is the total number of trajectories from the $k$ -th policy and $K _ { m }$ is
217
+ 177 the number of realized policies up until step $m$ . Inference with the CRP representation does not
218
+ 178 need to handle the infinite dimensional $\beta$ . Furthermore, at step $m$ , we only need to track at most $m$
219
+ 179 policies $( K _ { m } \le m )$ while all policies beyond $K _ { m }$ are independent from the collected trajectories
220
+ 180 $\tau _ { 1 : m }$ , and thus can be discarded from the model. In addition, the temporal dependencies between
221
+ 181 policies introduced by CRP can be used to develop an online learning algorithm.
222
+ 182 Given sampled trajectories $\tau _ { 1 : m }$ , the target
223
+ 183 of our opponent model is to assign each
224
+ 184 trajectory to a policy and update existing
225
+ 185 policies with assigned trajectories. This
226
+ 186 can be achieved by seeking maximum-a
227
+ 187 posteriori (MAP) estimations of $z _ { 1 : m }$ and
228
+ 188 $\phi _ { 1 : K _ { m } }$ . To deal with streaming trajectories,
229
+ 189 the MAP algorithm should operate in an
230
+ 190 online fashion. Therefore, given the CRP
231
+ 191 representation, we decompose the posterior
232
+ 192 into the product of the posterior from the
233
+ 193 last step, the current priors and the likeli
234
+ 194 hood, which leads to a recursive form:
235
+
236
+ ![](images/0c76e8e4632eee403c48a66abc380c1dd6963ff59617901c61e95eabc1be4ba5.jpg)
237
+ Figure 1: Dirichlet process mixture model
238
+
239
+ $$
240
+ \begin{array} { r } { p ( z _ { 1 : m } , \phi _ { 1 : K _ { m } } | \tau _ { 1 : m } ) \propto \biggr ( \displaystyle \prod _ { k = 1 } ^ { K _ { m - 1 } + 1 } p ( \phi _ { k } ) \biggr ) p ( z _ { 1 } ) p ( \tau _ { 1 } | \phi _ { z _ { 1 } } ) \biggr ( \displaystyle \prod _ { i = 2 } ^ { m } p ( z _ { i } | z _ { 1 : i - 1 } ) p ( \tau _ { i } | \phi _ { z _ { i } } ) \biggr ) , } \\ { \propto p ( z _ { 1 : m - 1 } , \phi _ { 1 : K _ { m - 1 } } | \tau _ { 1 : m - 1 } ) p ( \phi _ { K _ { m } } ) p ( z _ { m } | z _ { 1 : m - 1 } ) p ( \tau _ { m } | \phi _ { z _ { m } } ) , } \end{array}
241
+ $$
242
+
243
+ 195 where $p ( \phi _ { k } ) = H$ is the base distribution of the DP.
244
+
245
+ 196 The opponent model either assigns the current trajectory $\tau _ { m }$ to a previous policy $\phi _ { k }$ or creates a
246
+ 197 new policy $\phi _ { K _ { m - 1 } + 1 }$ to model $\tau _ { m }$ . The choice is made according to the MAP trajectory assignment
247
+ 198 $\begin{array} { r } { z _ { m } ^ { * } = \arg \operatorname* { m a x } _ { z _ { m } } p ( z _ { m } , z _ { 1 : m - 1 } ^ { * } | \tau _ { 1 : m } ) } \end{array}$ :
248
+
249
+ $$
250
+ \begin{array} { r } { p ( z _ { m } = k , z _ { 1 : m - 1 } ^ { * } | \tau _ { 1 : m } ) \propto \left\{ \int _ { \phi _ { k } } \alpha p ( \phi _ { k } ) p ( \tau _ { m } | \phi _ { k } ) d \phi _ { k } , k = K _ { m - 1 } + 1 \right. \qquad } \\ { p ( z _ { m } = k | z _ { 1 : m - 1 } ^ { * } ) p ( \tau _ { m } | \phi _ { k } ^ { m - 1 } ) = | k | _ { m - 1 } ^ { * } p ( \tau _ { m } | \phi _ { k } ^ { m - 1 } ) , \phi _ { k } = K _ { m - 1 } ( 1 - \phi _ { m } ) } \end{array}
251
+ $$
252
+
253
+ 199 where $\begin{array} { r } { | k | _ { m - 1 } ^ { * } = \sum _ { i = 1 } ^ { m - 1 } \mathcal { T } ( z _ { i } ^ { * } = k ) } \end{array}$ . Here, the hard assignment $z _ { m } ^ { * }$ for $\tau _ { m }$ is based on previous
254
+ 200 assignments $z _ { 1 : m - 1 } ^ { * }$ and policies $\phi _ { k } ^ { m - 1 }$ , which is equivalent to applying assumed density filtering
255
+ 201 (ADF) [41] to approximate the true posterior in Eq. (3) with a Delta distribution $\delta \big ( z _ { 1 : m } ^ { * } \big )$ . The hard
256
+ 202 assignment prevents creating a new policy at each step if $\tau _ { m }$ is assigned to an existing policy, which
257
+ 203 significantly reduces the memory usage. Furthermore, the MAP estimations for all existing policies,
258
+ 204 except $\phi _ { z _ { m } ^ { * } }$ , remain unchanged, which dramatically accelerates the algorithm. We then optimize the
259
+ 205 policy $\phi _ { z _ { m } ^ { * } }$ by maximizing the likelihood of all trajectories assigned to it:
260
+
261
+ $$
262
+ \phi _ { z _ { m } ^ { * } } ^ { m } = \arg \operatorname* { m a x } _ { \phi _ { z _ { m } ^ { * } } } \log p ( \phi _ { z _ { m } ^ { * } } ) \prod _ { z _ { i } ^ { * } = z _ { m } ^ { * } } p ( \tau _ { i } | \phi _ { z _ { m } ^ { * } } ) .
263
+ $$
264
+
265
+ 206 Where finding the global optimum is not tractable in non-conjugate cases, we take gradient steps to update 207 $\phi _ { z _ { m } ^ { * } } ^ { n }$ as
266
+
267
+ $$
268
+ \phi _ { z _ { m } ^ { * } } ^ { n } = \phi _ { z _ { m } ^ { * } } ^ { m - 1 } + \lambda \nabla _ { \phi _ { z _ { m } ^ { * } } } \log p ( \phi _ { z _ { m } ^ { * } } ) \prod _ { z _ { i } ^ { * } = z _ { m } ^ { * } } p ( \tau _ { i } | \phi _ { z _ { m } ^ { * } } ) .
269
+ $$
270
+
271
+ 208 The entire algorithm fits into the general expectation-maximization (EM) framework. See Appendix
272
+ 209 A.4 for a detailed derivation.
273
+ 210 The original CRP in Eq. (2) encapsulates a prior that the distribution of the next policy mimics the
274
+ 211 empirical policy distribution from the history. This prior is not consistent with our knowledge of the
275
+ 212 policy evolution process since a new opponent policy is commonly updated from the previous one.
276
+ 213 Therefore, we adopt a sticky variant in Eq. (6) to incorporate the belief that the opponent tends to
277
+
278
+ $$
279
+ p \big ( z _ { m } = k \big | z _ { 1 : m - 1 } \big ) = \left\{ \begin{array} { l l } { \frac { \alpha } { m - 1 + \alpha + \kappa } , } & { k = K _ { m - 1 } + 1 } \\ { } & { } \\ { \frac { \big | k \big | _ { m - 1 } + \kappa \hat { \delta } ( K _ { m - 1 } , k ) } { m - 1 + \alpha + \kappa } , } & { 1 \leq k \leq K _ { m - 1 } } \end{array} \right.
280
+ $$
281
+
282
+ where 215 $\kappa \geq 0$ is a ‘stickiness’ parameter and $\hat { \delta }$ is the Kronecker delta function.
283
+
284
+ 216 Following Eq. (4), the probability of creating a new policy for $\tau _ { n }$ is given by:
285
+
286
+ $$
287
+ p ( z _ { m } ^ { * } = k ) \propto \int _ { \phi _ { k } } \alpha p ( \phi _ { k } ) p ( \tau _ { m } | \phi _ { k } ) d \phi _ { k } ,
288
+ $$
289
+
290
+ 217 where $k = K _ { m - 1 } + 1$ . We use a Monte Carlo method to estimate Eq. (7) by sampling new policies
291
+ 218 from $p ( \phi _ { k } )$ . However, sampling new policies from a data-independent prior $p ( \phi _ { k } )$ is likely to yield a
292
+ 219 low trajectory likelihood $p ( \tau _ { m } | \phi _ { k } )$ , which prevents the new policy creation. Therefore, we update the
293
+ 220 sampled policies to increase the likelihood $\bar { p } ( \tau _ { m } | \phi _ { k } )$ by taking a few gradient steps before estimating
294
+ 221 the integration in Eq. (7).
295
+ 222 According to Eq. (6), the CRP prior encourages the opponent model to create redundant policies at the
296
+ 223 early stage when the number of trajectories $n$ is small and $\alpha$ dominates. Redundant policies could hurt
297
+ 224 the algorithm’s performance as it incurs extra cost in terms of computation and memory. Trajectories
298
+ 225 from the same ground truth policy could be assigned to different $\phi _ { k } \mathrm { s }$ and these assignments never
299
+ 226 revisited. Therefore, an error correction mechanism has to be introduced. Here, we adopt a symmetric
300
+ 227 distance metric between two policies and develop a policy merge procedure based on the metric.
301
+ 228 Given a set of states $s$ , we define $d ( \phi _ { k } , \phi _ { j } ) = \mathbb { E } _ { s \sim \mathbf { U n i f o r m } ( S ) } \left[ \mathcal { T } S \Big ( \phi _ { k } \big ( \cdot | s \big ) \Big | \Big | \phi _ { j } \big ( \cdot | s \big ) \Big ) \right]$ , where
302
+ 229 $\mathcal { I } \boldsymbol { S } ( \cdot | | \cdot )$ is the Jensen–Shannon divergence and $\phi _ { k } ( \cdot | s )$ is the action distribution given state $s$ under
303
+ 230 the policy $\phi _ { k }$ . When the distance between two policies is below a pre-defined threshold $\eta$ , the merge
304
+ 231 procedure simply re-assigns all trajectories of $\phi _ { k }$ to $\phi _ { j }$ .
305
+
306
+ With the opponent model developed in this section, at step $m$ , we can construct an opponent policy set $\tilde { \Pi } ^ { 2 } = \{ \phi _ { k } ^ { m } \} _ { k = 1 } ^ { K _ { m } }$ and a distribution $\tilde { \sigma } ^ { 2 }$ over $\tilde { \Pi } ^ { 2 }$ . The distribution $\tilde { \sigma } ^ { 2 } ( \phi = \phi _ { k } ) \propto | k | _ { m } + \kappa \hat { \delta } ( K _ { m } , k )$ is essentially the empirical distribution of $z _ { 1 : m } ^ { * }$ altered by the stickiness factor $\kappa$ .
307
+
308
+ # 235 5 Exploit Policy-Space Opponent Model
309
+
310
+ In this section, we present how to learn a safe best response to this meta strategy, given a predicted distribution $\tilde { \sigma } _ { \phi } ^ { \mathrm { 2 i i } }$ over opponent’s policies. The advantages of our approach of focusing on policy space are two-fold: first, we do not need to assume the access to the opponent’s learning characteristics such as its training algorithm, its neural network’s architecture or its update frequency; we only require past trajectories. Additionally, the distribution of the types of opponent policy $\scriptstyle { \tilde { \sigma } } ^ { 2 }$ gives us an approximate stable overview of the current opponent’s playing behavior compared to the opponent’s current policy whose updates greatly depend on the opponent’s learning characteristics and randomness from playing (e.g. exploration behavior) and training (e.g. stochastic gradient descent). Therefore, learning a response to this meta-strategy $\tilde { \sigma } ^ { 2 }$ will rely on less prior knowledge about the opponent’s learning characteristics and is more robust to noise.
311
+
312
+ However, there is no guarantee that our learned meta strategy $\sigma ^ { 1 }$ has no (or at least low) exploitability. It has been shown that overfitting to an opponent strategy $\tilde { \sigma } ^ { 2 }$ often renders the resulting learned strategy brittle [19, 21, 46]. Such a brittle strategy performs badly when playing against different opponent strategies ${ \tilde { \sigma } } ^ { 2 \prime }$ . Therefore, a more desirable goal is to learn a safe best response to an opponent meta-strategy $\tilde { \sigma } ^ { 2 }$ . RNR solutions consider cases where the game to solve is fixed and known and the opponent’s policy is stationary. However, when we consider non-stationary opponent exploitation on policy space, the size of the meta-game to solve increases with the number of interactions between the training agent and the adaptive opponent. Furthermore, each player is free to learn and update its policy at any time point during the process.
313
+
314
+ # Algorithm 1: Exploit Policy-Space Opponent Model (EPSOM)
315
+
316
+ input :Hyper-parameter $p , H , E$ , an adaptive opponent $- i$
317
+ output :Policy $\bar { \pi } _ { 1 , \ldots , E } ^ { i }$ and meta-policy $\sigma ^ { i }$
318
+ Initialize learning agent $i$ ’s policy $\pi _ { 0 } ^ { i }$
319
+ Initialize a memory buffer $\mathbf { B }$
320
+ Initialize opponent meta-policy $\sigma ^ { - i } ( \cdot ) = 1$
321
+ for epoch e in $\{ 1 , 2 , \ldots , E \}$ do for episode $h \in \{ 1 , 2 , \dots , H \}$ do Play an episode against the opponent with strategy $\sigma _ { R N R } ^ { 1 }$ Collect the trajectory $\tau _ { e , h }$ and save them into $\mathbf { B }$ end $\begin{array} { r l } & { \tilde { \sigma } ^ { 2 } , \tilde { \Pi } ^ { 2 } = \mathrm { o p p o n e n t } \underline { { \mathrm { { m o d e l i n g } } } } ( \mathbf { B } ) } \\ & { \bar { p } = \frac { 1 } { | \tilde { \Pi } ^ { 2 } | } \sum _ { j } p ^ { j } \tilde { \sigma } ^ { 2 } ( j ) } \end{array}$ Compute missing entries in $U ^ { \tilde { \Pi } }$ from $\tilde { \Pi } = \Pi ^ { 1 } \times \tilde { \Pi } ^ { 2 }$ by simulations ${ \bf \underline { { \ } } } , \sigma _ { R N R } ^ { 2 } = \mathrm { R N R } _ { - } \mathrm { s o l v e r } ( U ^ { \tilde { \Pi } } , \bar { p } , \tilde { \sigma } ^ { 2 } )$ $h \in \{ 1 , 2 , \dots , H \}$ Sample ⇡˜2 from 2RNR Train oracle $\pi ^ { 1 }$ over $\rho \sim \left( \pi ^ { 1 } , \tilde { \pi } ^ { 2 } \right)$ end $\Pi ^ { 1 } = \Pi ^ { 1 } \cup \left\{ \pi ^ { 1 } \right\}$ Compute missing entries in $U ^ { \tilde { \Pi } }$ from $\tilde { \Pi } = \Pi ^ { 1 } \times \tilde { \Pi } ^ { 2 }$ by simulations $\sigma _ { R N R } ^ { 1 } , \ l _ { - } = \mathrm { R N R \_ s o l v e r } ( U ^ { \tilde { \Pi } } , \bar { p } , \tilde { \sigma } ^ { 2 } )$
322
+ end
323
+
324
+ 255 To address the above issues, we combine DO with RNR to solve a meta-game built from EGTA where
325
+ 256 the opponent’s policies are predicted by the opponent model from Section 4. Pseudo-code explaining
326
+ 257 our approach is presented in Algorithm 1. We maintain a utility table $U ^ { \tilde { \Pi } }$ wherein rows represent
327
+ 258 learned policies for the training agent and columns represent a modeled policy of the opponent
328
+ 259 respectively. An epoch is defined as a fixed amount of episodes of games where we play against the
329
+ 260 opponent holding our strategy $\sigma ^ { 1 }$ fixed. At each epoch, we run our opponent model to predict the
330
+ 261 current distribution $\tilde { \sigma } ^ { 2 }$ of the opponent’s policies. If a new policy is detected, we will add it into $\tilde { \Pi } ^ { 2 }$
331
+ 262 Given $\tilde { \sigma } ^ { 2 }$ , we run a $\mathfrak { p }$ -RNR solver to obtain the opponent’s RNR meta-strategies $\sigma _ { R N R } ^ { 2 }$ which is a
332
+ 263 restricted Nash solution to the current meta-game assuming that the opponent is playing according to
333
+ 264 $\tilde { \sigma } ^ { 2 }$ with probability at least $p$ . Then we train an (approximate) best-response policy to $\bar { \sigma } _ { R N R } ^ { 2 }$ and add
334
+ 265 the new policy into $\Pi ^ { 1 }$ . We re-run a $\mathfrak { p }$ -RNR solver to obtain our RNR meta-strategies $\sigma _ { R N R } ^ { 1 }$ which
335
+ 266 we use to mix the policies in population $\Pi ^ { 1 }$ for the next epoch’s playing policy.
336
+ 267 When a new type $j$ of modeled policy $\pi ^ { 2 , j }$ is added by our opponent model, we initialize a p-value
337
+ 268 $p ^ { j } = p _ { i n i t }$ to this type. Its $\mathsf { p }$ -value is incremented proportionally to the probability that the opponent
338
+ 269 plays this policy in the following epochs, $\tilde { \sigma } ^ { 2 } ( j )$ , and clipped at 1. At each epoch, we calculate the
339
+ 270 average p-value $\begin{array} { r } { \bar { p } = \frac { 1 } { | \tilde { \Pi } ^ { 2 } | } \sum _ { j } p ^ { j } \tilde { \tilde { \sigma } } ^ { 2 } \dot { ( j ) } } \end{array}$ for solving current RNR strategies. In the extreme case where
340
+ 271 $\bar { p } = 0$ , ${ \sigma _ { R N R } ^ { i } }$ is the same as the Nash strategy in the current meta game. At another extreme where
341
+ 272 $\bar { p } = 1$ , $\sigma _ { R N R } ^ { 2 ^ { * } } = \tilde { \sigma } ^ { 2 }$ and $\sigma _ { R N R } ^ { 1 } = B \mathcal { R } ( \tilde { \sigma } ^ { 2 } ) $ . Therefore, when we have low confidence in $\bar { p }$ is
342
+ 273 low), we learn an approximate best response to opponent’s current Nash mixture which will enlarge
343
+ 274 our current empirical gamescape [3] and thus help to find strategies with lower exploitability. At the
344
+ 275 same time, the training agent becomes risk-adverse and the next epoch strategy $\mathbf { \sigma } _ { R N R } ^ { 1 }$ becomes a
345
+ 276 strategy closer to the Nash strategy of the current meta game.
346
+ 277 When $\bar { p }$ is high, it means that our opponent model has high confidence that the opponent is playing $\tilde { \sigma } ^ { 2 }$
347
+ 278 and an approximate best counter strategy to $\tilde { \sigma } ^ { 2 }$ will be added into our policy population. The training
348
+ 279 agent becomes profit-driven and $\sigma _ { R N R } ^ { 1 }$ becomes a strategy closer to $\scriptstyle B \mathcal { R } ( \tilde { \sigma } ^ { 2 } )$ in the next epoch.
349
+ 280 Therefore, mixing the playing policy by $\overset { \vartriangle } { \boldsymbol { \sigma } _ { R N R } ^ { 1 } }$ flexibly switches the agent between risk-adverse and
350
+ 281 profit-driven depending on the confidence of the opponent model. In contrast with previous RNR
351
+ 282 solution, EPSOM can always recover a strategy with approximately the lowest exploitability it has
352
+ 283 seen so far as we maintain a population of policies.
353
+
354
+ ![](images/a9ec8df49a6be97b4cfbb546e1ea6d1785211655bcdc87f8bd10f3b46af0c0af.jpg)
355
+ Figure 2: Exploitability and exploitation of different algorithms against a non-stationary opponent implemented by PPO in Kuhn Poker.
356
+
357
+ # 284 6 Experiments
358
+
359
+ In this section, we empirically investigate whether the proposed method can (1) exploit an unknown non-stationary opponent while still maintaining a strategy with low exploitability, (2) improve its performance by continued training against different opponents and (3) exploit previously unseen opponents without further training. We verify EPSOM’s performance in Kuhn Poker [20], a simplified version of poker which importantly retains strategic elements useful for game-theoretic analysis. We use an agent learning to play using the PPO [37] algorithm as our opponent, which suffices to provide a non-stationary setting. More details about the game and our experiment implementation can be found in Appendix A.3.
360
+
361
+ Table 1: Zero-shot learning exploitation results. Trained agents (row players) play against adaptive opponents (column players) without further training. Adaptive opponents are allowed to update 100 times and a trained agent’s average exploitation are taken over these 100 updates and 5 random seeds. Values in square brackets are each trained agent’s exploitability and values in parentheses are stds taken over 5 random seeds.
362
+
363
+ <table><tr><td colspan="4">Kuhn Poker</td></tr><tr><td></td><td colspan="2">PPO</td><td colspan="2">TRPO</td></tr><tr><td>EPSOM [0.109]</td><td>0.023</td><td>(0.189)</td><td>0.09</td><td>(0.180)</td></tr><tr><td>CEPSOM [0.080]</td><td>0.113</td><td>(0.142)</td><td>0.140</td><td>(0.117)</td></tr><tr><td>BC [1.333]</td><td>-0.559</td><td>(0.232)</td><td>-0.223</td><td>(0.134)</td></tr><tr><td>PSRO [0.000]</td><td>0.052</td><td>(0.072)</td><td>0.032</td><td>(0.058)</td></tr><tr><td>PPO [0.477]</td><td>-0.407</td><td>(0.133)</td><td>-0.372</td><td>(0.119)</td></tr></table>
364
+
365
+ ![](images/a0d0ffb00afa3d4930c66e3a94a02852747fc4142cab136491943d7fc6644976.jpg)
366
+ Figure 3: Opponent’s learning process modeled by trained CEPSOM: (left) CEPSOM adjusts playing strategy online; (right) CEPSOM plays an approximate Nash strategy. Each point is 2-D embedding of a modeled policy to which a trajectory produced by the opponent is assigned by our opponent model. Color bar indicates time sequence.
367
+
368
+ 294 We select 3 representative algorithms as baselines. PSRO is a popular algorithm which guarantees the
369
+ 295 convergence to an approximate NE. As PSRO is a self-play algorithm, its is trained before playing
370
+ 296 against any adaptive opponents. Behavior cloning (BC) models the opponent’s policy by taking
371
+ 297 maximum likelihood estimation of history trajectories stored in a sliding-window buffer and learns
372
+ 298 an (approximate) best-response policy to it. PPO represents a canonical choice among many SARL
373
+ 299 algorithms. In our work, as agents and their opponents update asynchronously, we always evaluate
374
+ 300 each algorithm’s performance right after the opponent’s update for a more robust evaluation. The
375
+ 301 following results reported with mean and standard deviation (std) are all obtained by repeating the
376
+ 302 corresponding experiment over 5 random seeds.
377
+ 303 As shown in Figure 2, EPSOM can achieve a safe strategy with relatively low exploitability while still
378
+ 304 being able to exploit its opponent. Though PSRO plays a strategy with the lowest exploitability $( \approx 0 )$ )
379
+ 305 it also has very low exploitation against its opponent. In contrast, BC can exploit its opponent to a
380
+ 306 similar extent as EPSOM but it comes with the cost of high exploitability. The PPO algorithm has
381
+ 307 large variance and performs badly on average in this non-stationary setting. We also test a continual
382
+ 308 learning version of EPSOM which we name CEPSOM. It is implemented by training an EPSOM agent
383
+ 309 against 5 different opponents without re-initialization thereby building up a richer set of modeled
384
+ 310 opponent policies and a more robust best-response policy population. Its average performance over
385
+ 311 these opponents is also reported in Figure 2. In our experiments, we use an analytical method to
386
+ 312 calculate a best response to a given policy. We obtain similar results for approximate best response
387
+ 313 learned by RL which are reported in Appendix A.5.
388
+ 314 Next, we test these agent’s performance against two adaptive opponents implemented by PPO and
389
+ 315 TRPO [36] without further training and results are presented in Table 1. Relying on an opponent model
390
+ 316 to predict the current opponent’s policy type and flexibly adjusting its playing strategy accordingly,
391
+ 317 CEPSOM achieves the highest average exploitation against adaptive opponents. EPSOM also obtains
392
+ 318 positive average exploitation but with a much lower value, since EPSOM has only ever been trained
393
+ 319 with one opponent. PSRO plays a safe strategy and performs slightly better than EPSOM in terms of
394
+ 320 opponent exploitation. BC and PPO perform badly as they overfit to one opponent, and thus they are
395
+ 321 exploited by other adaptive opponents. Note that, in this zero-shot learning tournament, although we
396
+ 322 do not train EPSOM and CEPSOM, they still need to predict the opponent’s policy and solve the
397
+ 323 meta-game for a RNR solution given the prediction.
398
+ 324 Facing an adaptive opponent, a trained CEPSOM’s opponent model can assign trajectories collected
399
+ 325 during learning into modeled policies it has built. Therefore, we can visualize an opponent’s learning
400
+ 326 process by presenting a sequence of those modeled policies on a 2-dimensional plot. In Figure 3,
401
+ 327 we present two opponent’s visualized learning process when it faces (a) a trained CEPSOM agent
402
+ 328 which adjusts its playing strategy online based on its opponent model prediction, and (b) a trained
403
+ 329 CEPSOM agent which always plays an approximate Nash equilibrium strategy. We can see that in a
404
+ 330 non-stationary environment (left), the opponent’s learning exhibits a cyclic pattern. In contrast, the
405
+ 331 opponent’s learning is much more transitive (i.e., monotonically moving in one direction in the 2D
406
+ 332 space) in a stationary environment (right).
407
+
408
+ # 333 7 Conclusion
409
+
410
+ 334 In this work, we propose a framework for training an agent to safely exploit its opponent. Compared
411
+ 335 to RNR and its variants, our work focuses on non-stationary opponents. We consider the opponent’s
412
+ 336 learning as a series of policy transitions and model such a process by a Dirichlet Process. Safe
413
+ 337 exploitation means that an agent can exploit an opponent’s weakness to maximize our utility while
414
+ 338 simultaneously maintaining a strategy which has low exploitability. This property is desirable as
415
+ 339 naively overfitting to one type of opponent could easily lead to exploitation by other opponents. We
416
+ 340 empirically verify our algorithm’s performance on Kuhn Poker, a simplified version of Poker.
417
+ 341 Opponent modeling based MARL algorithms typically require extra computation for learning a
418
+ 342 good opponent model. This cost often scales dramatically with the number of opponents, action
419
+ 343 space dimensionality and the complexity of the problem. It can be a heavy burden on an agent if
420
+ 344 it learns an opponent model from scratch online. Therefore, a more realistic way for utilizing the
421
+ 345 power of an opponent model is offline training and online prediction. We build CEPSOM based on
422
+ 346 this idea where we train one EPSOM agent across different opponents and aggregate knowledge by
423
+ 347 maintaining a never-reinitialized opponent model and policy population. Our experiment results show
424
+ 348 that CEPSOM can achieve high exploitation against a new adaptive opponent without further training,
425
+ 349 outperforming other representative baselines from SARL and MARL. In complex competitive games,
426
+ 350 a strong player can often encounter sub-optimal opponents and playing a Nash strategy can potentially
427
+ 351 forego significant profit. EPSOM, alongside many prior works, shows the potential of an opponent
428
+ 352 modeling based approach for solving this problem, and our preliminary results from CEPSOM
429
+ 353 demonstrate the possibility of a trained agent beating an as yet unseen adaptive opponent.
430
+ 354 EPSOM is limited by its computation and memory complexity. Naively applying EPSOM to more
431
+ 355 complex problems requires a great amount of resources. To alleviate this problem, we introduce
432
+ 356 policy merge to remove redundant policies in our opponent model. This approach could be improved
433
+ 357 by applying game theoretic analysis to our policy populations (agent’s self policies and modeled
434
+ 358 opponent policies). We leave the study of improving EPSOM’s scalability to future work.
435
+
436
+ References [1] M. Al-Shedivat, T. Bansal, Y. Burda, I. Sutskever, I. Mordatch, and P. Abbeel. Continuous adaptation via meta-learning in nonstationary and competitive environments. arXiv preprint arXiv:1710.03641, 2017. [2] Stefano V. Albrecht and Peter Stone. Autonomous agents modelling other agents: A comprehensive survey and open problems. Artificial Intelligence, 258:66–95, 2018. ISSN 0004-3702. doi: https://doi.org/10.1016/j.artint.2018.01.002. URL https://www.sciencedirect.com/ science/article/pii/S0004370218300249. [3] David Balduzzi, Marta Garnelo, Yoram Bachrach, Wojciech Czarnecki, Julien Perolat, Max Jaderberg, and Thore Graepel. Open-ended learning in symmetric zero-sum games. In International Conference on Machine Learning, pages 434–443. PMLR, 2019. [4] Christopher Berner, Greg Brockman, Brooke Chan, Vicki Cheung, Przemyslaw Debiak, Christy Dennison, David Farhi, Quirin Fischer, Shariq Hashme, Christopher Hesse, Rafal Józefowicz, Scott Gray, Catherine Olsson, Jakub Pachocki, Michael Petrov, Henrique Pondé de Oliveira Pinto, Jonathan Raiman, Tim Salimans, Jeremy Schlatter, Jonas Schneider, Szymon Sidor, Ilya Sutskever, Jie Tang, Filip Wolski, and Susan Zhang. Dota 2 with large scale deep reinforcement learning. CoRR, abs/1912.06680, 2019. URL http://arxiv.org/abs/1912. 06680. [5] Darse Billings, Neil Burch, Aaron Davidson, Robert Holte, Jonathan Schaeffer, Terence Schauenberg, and Duane Szafron. Approximating game-theoretic optimal strategies for fullscale poker. pages 661–668, 01 2003. [6] David M Blei, Michael I Jordan, et al. Variational inference for Dirichlet Process mixtures. Bayesian analysis, 1(1):121–143, 2006. [7] GW Brown. Iterative solution of games by fictitious play. Activity Analysis of Production and Allocation (TC Koopmans, Ed.), pages 374–376, 1951. [8] Xi Chen and Xiaotie Deng. Settling the complexity of two-player Nash equilibrium. In 2006 47th Annual IEEE Symposium on Foundations of Computer Science (FOCS’06), pages 261–272. IEEE, 2006. [9] Wojciech Marian Czarnecki, Gauthier Gidel, Brendan Tracey, Karl Tuyls, Shayegan Omidshafiei, David Balduzzi, and Max Jaderberg. Real world games look like spinning tops. arXiv preprint arXiv:2004.09468, 2020. [10] R. Everett and S. Roberts. Learning against non-stationary agents with opponent modelling and deep reinforcement learning. In 2018 AAAI Spring Symposium Series, 2018.
437
+ 92 [11] Emily B Fox, Erik B Sudderth, Michael I Jordan, and Alan S Willsky. An HDP-HMM for systems with state persistence. In Proceedings of the 25th international conference on Machine learning, pages 312–319, 2008.
438
+ [12] Drew Fudenberg and Jean Tirole. Game Theory. MIT Press, Cambridge, MA, 1991.
439
+ 96 [13] H. He, J. Boyd-Graber, K. Kwok, and H. Daumé III. Opponent modeling in deep reinforcement learning. In ICML ’16, volume 48, pages 1804–1813, 2016. [14] P. Hernandez-Leal, M. Kaisers, T Baarslag, and E.M. de Cote. A survey of learning in multiagent environments: Dealing with non-stationarity. arXiv preprint arXiv:1707.09183, 2017. [15] Pablo Hernandez-Leal and Michael Kaisers. Learning against sequential opponents in repeated stochastic games. In The 3rd Multi-disciplinary Conference on Reinforcement Learning and Decision Making, 2017. [16] Michael C Hughes and Erik B Sudderth. Memoized online variational inference for dirichlet Process mixture models. Technical report, BROWN UNIV PROVIDENCE RI DEPT OF COMPUTER SCIENCE, 2014.
440
+
441
+ 06 [17] Hemant Ishwaran and Lancelot F James. Gibbs sampling methods for stick-breaking priors. Journal of the American Statistical Association, 96(453):161–173, 2001. [18] Michael Johanson and Michael Bowling. Data biased robust counter strategies. In David van Dyk and Max Welling, editors, Proceedings of the Twelth International Conference on Artificial Intelligence and Statistics, pages 264–271. PMLR, 2009. URL http://proceedings.mlr. press/v5/johanson09a.html. [19] Michael Johanson, Martin Zinkevich, and Michael Bowling. Computing robust counter-strategies. In J. Platt, D. Koller, Y. Singer, and S. Roweis, editors, Advances in Neural Information Processing Systems, volume 20. Curran Associates, Inc., 2008. URL https://proceedings.neurips.cc/paper/2007/file/ 6e7b33fdea3adc80ebd648fffb665bb8-Paper.pdf. [20] Harold W Kuhn. A simplified two-person poker. Contributions to the Theory of Games, 1: 97–103, 1950. [21] Marc Lanctot, Vinícius Flores Zambaldi, Audrunas Gruslys, Angeliki Lazaridou, Karl Tuyls, Julien Pérolat, David Silver, and Thore Graepel. A unified game-theoretic approach to multiagent reinforcement learning. CoRR, abs/1711.00832, 2017. URL http://arxiv.org/abs/1711. 00832. [22] Soochan Lee, Junsoo Ha, Dongsu Zhang, and Gunhee Kim. A neural Dirichlet Process mixture model for task-free continual learning. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net, 2020. [23] Dahua Lin. Online learning of nonparametric mixture models via sequential variational approximation. Advances in Neural Information Processing Systems, 26:395–403, 2013. [24] R. Lowe, Y. Wu, A. Tamar, J. Harb, P. Abbeel, and I. Mordatch. Multi-agent actor-critic for mixed cooperative-competitive environments. In Advances in Neural Information Processing Systems, pages 6379–6390, 2017. [25] Stephen McAleer, John B. Lanier, Roy Fox, and Pierre Baldi. Pipeline PSRO: A scalable approach for finding approximate Nash equilibria in large games. CoRR, abs/2006.08555, 2020. URL https://arxiv.org/abs/2006.08555. [26] H Brendan McMahan, Geoffrey J Gordon, and Avrim Blum. Planning in the presence of cost functions controlled by an adversary. In Proceedings of the 20th International Conference on Machine Learning (ICML-03), pages 536–543, 2003. [27] R. Mealing and J. L. Shapiro. Opponent modeling by expectation–maximization and sequence prediction in simplified poker. IEEE Transactions on Computational Intelligence and AI in Games, 9(1):11–24, 2017. doi: 10.1109/TCIAIG.2015.2491611. [28] Oskar Morgenstern and John Von Neumann. Theory of games and economic behavior. Princeton university press, 1953. [29] Paul Muller, Shayegan Omidshafiei, Mark Rowland, Karl Tuyls, Julien Pérolat, Siqi Liu, Daniel Hennes, Luke Marris, Marc Lanctot, Edward Hughes, Zhe Wang, Guy Lever, Nicolas Heess, Thore Graepel, and Rémi Munos. A generalized training approach for multiagent learning. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net, 2020. URL https://openreview.net/forum?id= Bkl5kxrKDr. [30] Nicolas Perez Nieves, Yaodong Yang, Oliver Slumbers, David Henry Mguni, and Jun Wang. Modelling behavioural diversity for learning in open-ended games. CoRR, abs/2103.07927, 2021. URL https://arxiv.org/abs/2103.07927. [31] Shayegan Omidshafiei, Christos H. Papadimitriou, Georgios Piliouras, Karl Tuyls, Mark Rowland, Jean-Baptiste Lespiau, Wojciech M. Czarnecki, Marc Lanctot, Julien Pérolat, and Rémi Munos. $\alpha$ -rank: Multi-agent evaluation by evolution. CoRR, abs/1903.01373, 2019. URL http://arxiv.org/abs/1903.01373.
442
+
443
+ [32] G. Papoudakis, F. Christianos, A. Rahman, and S. Albrecht. Dealing with non-stationarity in multi-agent deep reinforcement learning. arXiv preprint arXiv:1906.04737, 2019.
444
+ [33] Marc J. V. Ponsen, Steven de Jong, and Marc Lanctot. Computing approximate Nash equilibria and robust best-responses using sampling. CoRR, abs/1401.4591, 2014. URL http://arxiv. org/abs/1401.4591.
445
+ [34] Roberta Raileanu, Emily Denton, Arthur Szlam, and Rob Fergus. Modeling others using oneself in multi-agent reinforcement learning. In International conference on machine learning, pages 4257–4266. PMLR, 2018.
446
+ [35] Tuomas Sandholm. Perspectives on multiagent learning. Artificial Intelligence, 171(7):382– 391, 2007. ISSN 0004-3702. doi: https://doi.org/10.1016/j.artint.2007.02.004. URL https: //www.sciencedirect.com/science/article/pii/S0004370207000525. Foundations of Multi-Agent Learning.
447
+ [36] John Schulman, Sergey Levine, Philipp Moritz, Michael I. Jordan, and Pieter Abbeel. Trust region policy optimization. CoRR, abs/1502.05477, 2015. URL http://arxiv.org/abs/ 1502.05477.
448
+ [37] John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. CoRR, abs/1707.06347, 2017. URL http://arxiv.org/ abs/1707.06347.
449
+ [38] L. Shapley. Stochastic games. Proceedings of the national academy of sciences, 39(10): 1095–1100, 1953.
450
+ [39] Max Smith, Thomas Anthony, and Michael Wellman. Iterative empirical game solving via single policy best response. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id=R4aWTjmrEKM.
451
+ [40] Finnegan Southey, Michael P Bowling, Bryce Larson, Carmelo Piccione, Neil Burch, Darse Billings, and Chris Rayner. Bayes’ bluff: Opponent modelling in poker. arXiv preprint arXiv:1207.1411, 2012.
452
+ [41] Alex Tank, Nicholas Foti, and Emily Fox. Streaming variational inference for Bayesian nonparametric mixture models. In Artificial Intelligence and Statistics, pages 968–976. PMLR, 2015.
453
+ [42] Yee Whye Teh. Dirichlet Process, pages 280–287. Springer US, Boston, MA, 2010. ISBN 978-0-387-30164-8. doi: 10.1007/978-0-387-30164-8_219. URL https://doi.org/10. 1007/978-0-387-30164-8_219.
454
+ [43] Jan van den Brand. A deterministic linear program solver in current matrix multiplication time. In Proceedings of the Fourteenth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 259–278. SIAM, 2020.
455
+ [44] Oriol Vinyals, Igor Babuschkin, Wojciech M Czarnecki, Michaël Mathieu, Andrew Dudzik, Junyoung Chung, David H Choi, Richard Powell, Timo Ewalds, Petko Georgiev, et al. Grandmaster level in StarCraft II using multi-agent reinforcement learning. Nature, 575(7782):350–354, 2019.
456
+ [45] Chong Wang and David Blei. Truncation-free stochastic variational inference for Bayesian nonparametric models. Advances in neural information processing systems, 25:422–430, 2012.
457
+ [46] Zhe Wu, Kai Li, Enmin Zhao, Hang Xu, Meng Zhang, Haobo Fu, Bo An, and Junliang Xing. L2E: Learning to exploit your opponent, 2021.
458
+ [47] Mengdi Xu, Wenhao Ding, Jiacheng Zhu, Zuxin Liu, Baiming Chen, and Ding Zhao. Taskagnostic online reinforcement learning with an infinite mixture of Gaussian Processes. In Hugo Larochelle, Marc’Aurelio Ranzato, Raia Hadsell, Maria-Florina Balcan, and Hsuan-Tien Lin, editors, Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020.
459
+
460
+ [48] Yaodong Yang, Rasul Tutunov, Phu Sakulwongtana, and Haitham Bou Ammar. $\alpha ^ { 2 }$ -rank: Practically scaling $\alpha$ -rank through stochastic optimisation. In Proceedings of the 19th International Conference on Autonomous Agents and MultiAgent Systems, AAMAS $^ { , } 2 0$ , page 1575–1583, Richland, SC, 2020. International Foundation for Autonomous Agents and Multiagent Systems. ISBN 9781450375184.
461
+
462
+ [49] Y. Zheng, Z. Meng, J. Hao, Z. Zhang, T. Yang, and C. Fan. A deep Bayesian policy reuse approach against non-stationary agents. In Advances in Neural Information Processing Systems, 2018.
463
+
464
+ [50] Martin Zinkevich, Michael Johanson, Michael Bowling, and Carmelo Piccione. Regret minimization in games with incomplete information. Advances in neural information processing systems, 20:1729–1736, 2007.
465
+
466
+ # Checklist
467
+
468
+ 1. For all authors...
469
+
470
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
471
+ (b) Did you describe the limitations of your work? [Yes] See the first paragraph of Section 3 and the last paragraph of Section 7.
472
+ (c) Did you discuss any potential negative societal impacts of your work? [No] We do not see potential negative societal impacts of our work.
473
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
474
+
475
+ 2. If you are including theoretical results...
476
+
477
+ (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]
478
+
479
+ 3. If you ran experiments...
480
+
481
+ (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] See Appendix A.3
482
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Appendix A.3
483
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes]
484
+ (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)? [No]
485
+
486
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
487
+
488
+ (a) If your work uses existing assets, did you cite the creators? [N/A]
489
+ (b) Did you mention the license of the assets? [N/A]
490
+ (c) Did you include any new assets either in the supplemental material or as a URL? [N/A]
491
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
492
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
493
+
494
+ 5. If you used crowdsourcing or conducted research with human subjects...
495
+
496
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
497
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
498
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]