kelseye commited on
Commit
20d5778
·
verified ·
1 Parent(s): 631bfae

Upload folder using huggingface_hub (part 7)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. md/train/H1xSNiRcF7/H1xSNiRcF7.md +385 -0
  2. md/train/H1xaJn05FQ/H1xaJn05FQ.md +469 -0
  3. md/train/H1xipsA5K7/H1xipsA5K7.md +0 -0
  4. md/train/H1xk8jAqKQ/H1xk8jAqKQ.md +398 -0
  5. md/train/H1xsSjC9Ym/H1xsSjC9Ym.md +390 -0
  6. md/train/H1xscnEKDr/H1xscnEKDr.md +507 -0
  7. md/train/H1xwNhCcYm/H1xwNhCcYm.md +382 -0
  8. md/train/H1z-PsR5KX/H1z-PsR5KX.md +344 -0
  9. md/train/H1zriGeCZ/H1zriGeCZ.md +461 -0
  10. md/train/H1zxjsCqKQ/H1zxjsCqKQ.md +531 -0
  11. md/train/H38f_9b90BO/H38f_9b90BO.md +604 -0
  12. md/train/H4e7mBnC9f0/H4e7mBnC9f0.md +310 -0
  13. md/train/H6ATjJ0TKdf/H6ATjJ0TKdf.md +390 -0
  14. md/train/H8VDvtm1ij8/H8VDvtm1ij8.md +341 -0
  15. md/train/HCSgyPUfeDj/HCSgyPUfeDj.md +0 -0
  16. md/train/HHiiQKWsOcV/HHiiQKWsOcV.md +0 -0
  17. md/train/HJ0NvFzxl/HJ0NvFzxl.md +422 -0
  18. md/train/HJ0UKP9ge/HJ0UKP9ge.md +285 -0
  19. md/train/HJ1HFlZAb/HJ1HFlZAb.md +174 -0
  20. md/train/HJ1JBJ5gl/HJ1JBJ5gl.md +306 -0
  21. md/train/HJ1kmv9xx/HJ1kmv9xx.md +333 -0
  22. md/train/HJ94fqApW/HJ94fqApW.md +288 -0
  23. md/train/HJBhEMbRb/HJBhEMbRb.md +557 -0
  24. md/train/HJC2SzZCW/HJC2SzZCW.md +533 -0
  25. md/train/HJCXZQbAZ/HJCXZQbAZ.md +350 -0
  26. md/train/HJDBUF5le/HJDBUF5le.md +312 -0
  27. md/train/HJGXzmspb/HJGXzmspb.md +327 -0
  28. md/train/HJGkisCcKm/HJGkisCcKm.md +260 -0
  29. md/train/HJGv1Z-AW/HJGv1Z-AW.md +263 -0
  30. md/train/HJGven05Y7/HJGven05Y7.md +204 -0
  31. md/train/HJGwcKclx/HJGwcKclx.md +334 -0
  32. md/train/HJIoJWZCZ/HJIoJWZCZ.md +342 -0
  33. md/train/HJKkY35le/HJKkY35le.md +321 -0
  34. md/train/HJMC_iA5tm/HJMC_iA5tm.md +201 -0
  35. md/train/HJMHpjC9Ym/HJMHpjC9Ym.md +402 -0
  36. md/train/HJMN-xWC-/HJMN-xWC-.md +237 -0
  37. md/train/HJNJws0cF7/HJNJws0cF7.md +283 -0
  38. md/train/HJOQ7MgAW/HJOQ7MgAW.md +226 -0
  39. md/train/HJPmdP9le/HJPmdP9le.md +299 -0
  40. md/train/HJSA_e1AW/HJSA_e1AW.md +378 -0
  41. md/train/HJTzHtqee/HJTzHtqee.md +281 -0
  42. md/train/HJUOHGWRb/HJUOHGWRb.md +0 -0
  43. md/train/HJV1zP5xg/HJV1zP5xg.md +385 -0
  44. md/train/HJWGdbbCW/HJWGdbbCW.md +299 -0
  45. md/train/HJWHIKqgl/HJWHIKqgl.md +214 -0
  46. md/train/HJWLfGWRb/HJWLfGWRb.md +264 -0
  47. md/train/HJYoqzbC-/HJYoqzbC-.md +233 -0
  48. md/train/HJ_aoCyRZ/HJ_aoCyRZ.md +542 -0
  49. md/train/HJaDJZ-0W/HJaDJZ-0W.md +294 -0
  50. md/train/HJcSzz-CZ/HJcSzz-CZ.md +319 -0
md/train/H1xSNiRcF7/H1xSNiRcF7.md ADDED
@@ -0,0 +1,385 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SMOOTHING THE GEOMETRY OF PROBABILISTIC BOX EMBEDDINGS
2
+
3
+ Xiang $\mathbf { L i } ^ { * }$ , Luke Vilnis∗, Dongxu Zhang, Michael Boratko & Andrew McCallum
4
+ College of Information and Computer Sciences
5
+ University of Massachusetts Amherst
6
+
7
+ # ABSTRACT
8
+
9
+ There is growing interest in geometrically-inspired embeddings for learning hierarchies, partial orders, and lattice structures, with natural applications to transitive relational data such as entailment graphs. Recent work has extended these ideas beyond deterministic hierarchies to probabilistically calibrated models, which enable learning from uncertain supervision and inferring soft-inclusions among concepts, while maintaining the geometric inductive bias of hierarchical embedding models. We build on the Box Lattice model of Vilnis et al. (2018), which showed promising results in modeling soft-inclusions through an overlapping hierarchy of sets, parameterized as high-dimensional hyperrectangles (boxes). However, the hard edges of the boxes present difficulties for standard gradient based optimization; that work employed a special surrogate function for the disjoint case, but we find this method to be fragile. In this work, we present a novel hierarchical embedding model, inspired by a relaxation of box embeddings into parameterized density functions using Gaussian convolutions over the boxes. Our approach provides an alternative surrogate to the original lattice measure that improves the robustness of optimization in the disjoint case, while also preserving the desirable properties with respect to the original lattice. We demonstrate increased or matching performance on WordNet hypernymy prediction, Flickr caption entailment and a MovieLens-based market basket dataset. We show especially marked improvements in the case of sparse data, where many conditional probabilities should be low, and thus boxes should be nearly disjoint.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Embedding methods have long been a key technique in machine learning, providing a natural way to convert semantic problems into geometric problems. Early examples include the vector space (Salton et al., 1975) and latent semantic indexing (Deerwester et al., 1990) models for information retrieval. Embeddings experienced a renaissance after the publication of Word2Vec (Mikolov et al., 2013), a neural word embedding method (Bengio et al., 2003; Mnih & Hinton, 2009) that could run at massive scale.
14
+
15
+ Recent years have seen an interest in structured or geometric representations. Instead of representing e.g. images, words, sentences, or knowledge base concepts with points, these methods instead associate them with more complex geometric structures. These objects can be density functions, as in Gaussian embeddings (Vilnis & McCallum, 2015; Athiwaratkun & Wilson, 2017; 2018), convex cones, as in order embeddings (Vendrov et al., 2016; Lai & Hockenmaier, 2017), or axis-aligned hyperrectangles, as in box embeddings (Vilnis et al., 2018; Subramanian & Chakrabarti, 2018). These geometric objects more naturally express ideas of asymmetry, entailment, ordering, and transitive relations than simple points in a vector space, and provide a strong inductive bias for these tasks.
16
+
17
+ In this work, we focus on the probabilistic Box Lattice model of Vilnis et al. (2018), because of its strong empirical performance in modeling transitive relations, probabilistic interpretation (edges in a relational DAG are replaced with conditional probabilities), and ability to model complex joint probability distributions including negative correlations. Box embeddings (BE) are a generalization of order embeddings (OE) (Vendrov et al., 2016) and probabilistic order embeddings (POE) (Lai & Hockenmaier, 2017) that replace the vector lattice ordering (notions of overlapping and enclosing convex cones) in OE and POE with a more general notion of overlapping boxes (products of intervals).
18
+
19
+ While intuitively appealing, the “hard edges” of boxes and their ability to become easily disjoint, present difficulties for gradient-based optimization: when two boxes are disjoint in the model, but have overlap in the ground truth, no gradient can flow to the model to correct the problem. This is of special concern for (pseudo-)sparse data, where many boxes should have nearly zero overlap, while others should have very high overlap. This is especially pronounced in the case of e.g. market basket models for recommendation, where most items should not be recommended, and entailment tasks, most of which are currently artificially resampled into a 1:1 ratio of positive to negative examples. To address the disjoint case, Vilnis et al. (2018) introduce an ad-hoc surrogate function. In contrast, we look at this problem as inspiration for a new model, based on the intuition of relaxing the hard edges of the boxes into smoothed density functions, using a Gaussian convolution with the original boxes.
20
+
21
+ We demonstrate the superiority of our approach to modeling transitive relations on WordNet, Flickr caption entailment, and a MovieLens-based market basket dataset. We match or beat existing state of the art results, while showing substantial improvements in the pseudosparse regime.
22
+
23
+ # 2 RELATED WORK
24
+
25
+ As mentioned in the introduction, there is much related work on structured or geometric embeddings. Most relevant to this work are the order embeddings of Vendrov et al. (2016), which embed a nonprobabilistic DAG or lattice in a vector space with order given by inclusion of embeddings’ forward cones, the probabilistic extension of that model due to Lai & Hockenmaier (2017), and the box lattice or box embedding model of Vilnis et al. (2018), which we extend. Concurrently to Vilnis et al. (2018), another hyperrectangle-based generalization of order embeddings was proposed by Subramanian & Chakrabarti (2018), also called box embeddings. The difference between the two models lies in the interpretation: the former is a probabilistic model that assigns edges conditional probabilities according to degrees of overlap, while the latter is a deterministic model in the style of order embeddings — an edge is considered present only if one box entirely encloses another.
26
+
27
+ Methods based on embedding points in hyperbolic space (Nickel & Kiela, 2017; Ganea et al., 2018) have also recently been proposed for learning hierarchical embeddings. These models, similar to order embeddings and the box embeddings of Subramanian & Chakrabarti (2018), are nonprobabilistic and optimize an energy function. Additionally, while the negative curvature of hyperbolic space is attractively biased towards learning tree structures (since distances between points increase the farther they are from the origin), this constant curvature makes the models not as suitable for learning non-treelike DAGs.
28
+
29
+ Our approach to smoothing the energy landscape of the model using Gaussian convolution is common in mollified optimization and continuation methods, and is increasingly making its way into machine learning models such as Mollifying Networks (Gulcehre et al., 2016b), diffusion-trained networks (Mobahi, 2016), and noisy activation functions (Gulcehre et al., 2016a).
30
+
31
+ Our focus on embedding orderings and transitive relations is a subset of knowledge graph embedding. While this field is very large, the main difference of our probabilistic approach is that we seek to learn an embedding model which maps concepts to subsets of event space, giving our model an inductive bias especially suited for transitive relations as well as fuzzy concepts of inclusion and entailment.
32
+
33
+ # 3 BACKGROUND
34
+
35
+ We begin with a brief overview of two methods for representing ontologies as geometric objects. First, we review some definitions from order theory, a useful formalism for describing ontologies, then we introduce the vector and box lattices. Figure 1 shows a simple two-dimensional example of these representations.
36
+
37
+ ![](images/e33c5ed448bf97a33daa06440935051df615504b85b184de3319c90014042b76.jpg)
38
+ Figure 1: Comparison between the Order Embedding (vector lattice) and Box Embedding representations for a simple ontology. Regions represent concepts and overlaps represent their entailment. Shading represents density in the probabilistic case.
39
+
40
+ # 3.1 PARTIAL ORDERS AND LATTICES
41
+
42
+ A non-strict partially ordered set (poset) is a pair $P , \preceq$ , where $P$ is a set, and $\preceq$ is a binary relation. For all $a , b , c \in P$ ,
43
+
44
+ Reflexivity: $a \preceq a$ Antisymmetry: $a \preceq b \preceq a$ implies $a = b$ Transitivity: $a \preceq b \preceq c$ implies $a \preceq c$
45
+
46
+ This generalizes the standard concept of a totally ordered set to allow some elements to be incomparable. Posets provide a good formalism for the kind of acyclic directed graph data found in many knowledge bases with transitive relations.
47
+
48
+ A lattice is a poset where any subset of elements has a single unique least upper bound, and greatest lower bound. In a bounded lattice, the set $P$ contains two additional elements, ${ \mathsf { T } } \left( t o p \right)$ , and $\perp$ (bottom), which denote the least upper bound and greatest lower bound of the entire set.
49
+
50
+ A lattice is equipped with two binary operations, $\vee$ (join), and $\wedge$ (meet). $a \lor b$ denotes the least upper bound of $a , b \in P$ , and $a \wedge b$ denotes their greatest lower bound. A bounded lattice must satisfy these properties:
51
+
52
+ Idempotency: $a \wedge a = a \vee a = a$
53
+ Commutativity: $a \wedge b = b \wedge a$ and $a \vee b = b \vee a$
54
+ Associativity: $a \wedge b \wedge c = a \wedge ( b \wedge c )$ and $( a \lor b \lor c ) = a \lor ( b \lor c )$
55
+ Absorption: $a \vee ( a \wedge b ) = a$ and $a \wedge ( a \vee b ) = a$
56
+ Bounded: $\perp \preceq a \preceq \top$
57
+
58
+ Note that the extended real numbers, $\mathbb { R } \cup \{ - \infty , \infty \}$ , form a bounded lattice (and in fact, a totally ordered set) under the min and max operations as the meet $( \wedge )$ and join $( \vee )$ operations. So do sets partially ordered by inclusion, with $\cap$ and $\cup$ as $\wedge$ and $\vee$ . Thinking of these special cases gives the intuition for the fourth property, absorption.
59
+
60
+ The $\wedge$ and $\vee$ operations can be swapped, along with reversing the poset relation $\preceq$ , to give a valid lattice, called the dual lattice. In the real numbers this just corresponds to a sign change. A semilattice has only a meet or join, but not both.
61
+
62
+ Note. In the rest of the paper, when the context is clear, we will also use $\wedge$ and $\vee$ to denote min and max of real numbers, in order to clarify the intuition behind our model.
63
+
64
+ # 3.2 VECTOR LATTICE
65
+
66
+ A vector lattice, also known as a Riesz space (Zaanen, 1997), or Hilbert lattice when the accompanying vector space has an inner product, is a vector space endowed with a lattice structure.
67
+
68
+ A standard choice of partial order for the vector lattice $\mathbb { R } ^ { n }$ is to use the product order from the underlying real numbers, which specifies for all $\mathbf { x } , \mathbf { y } \in \mathbb { R } ^ { n }$
69
+
70
+ $$
71
+ \mathbf { x } \preceq \mathbf { y } \iff \forall i \in \{ 1 . . n \} , \ x _ { i } \leq y _ { i }
72
+ $$
73
+
74
+ Under this order, meet and join operations are pointwise min and max, which gives a lattice structure. In this formalism, the Order Embeddings of Vendrov et al. (2016) embed partial orders as vectors using the reverse product order, corresponding to the dual lattice, and restrict the vectors to be positive. The vector of all zeroes represents $\top$ , and embedded objects become “more specific” as they get farther away from the origin.
75
+
76
+ Figure 1b demonstrates a toy, two-dimensional example of the Order Embedding vector lattice representation of a simple ontology. Shading represents the probability measure assigned to this lattice in the probabilistic extension of Lai & Hockenmaier (2017).
77
+
78
+ # 3.3 BOX LATTICE
79
+
80
+ Vilnis et al. (2018) introduced a box lattice, wherein each concept in a knowledge graph is associated with two vectors, the minimum and maximum coordinates of an axis-aligned hyperrectangle, or box (product of intervals).
81
+
82
+ Using the notion of set inclusion between boxes, there is a natural partial order and lattice structure. To represent a box $\mathbf { x }$ , let the pairs $( x _ { m , i } , x _ { M , i } )$ be the maximum and minimum of the interval at each coordinate $i$ . Then the box lattice structure (least upper bounds and greatest lower bounds), with $\vee$ and $\wedge$ denoting max and min when applied to the scalar coordinates, is
83
+
84
+ $$
85
+ \begin{array} { l } { { \displaystyle { \bf x } \wedge { \bf y } = \prod _ { i } [ x _ { m , i } \vee y _ { m , i } , x _ { M , i } \wedge y _ { M , i } ] } } \\ { { \displaystyle { \bf x } \vee { \bf y } = \prod _ { i } [ x _ { m , i } \wedge y _ { m , i } , x _ { M , i } \vee y _ { M , i } ] } } \end{array}
86
+ $$
87
+
88
+ Here, $\prod$ denotes a set (cartesian) product — the lattice meet is the largest box contained entirely within both $\mathbf { x }$ and $\mathbf { y }$ , or bottom (the empty set) where no intersection exists, and the lattice join is the smallest box containing both $\mathbf { x }$ and $\mathbf { y }$ .
89
+
90
+ To associate a measure, marginal probabilities of (collections of) events are given by the volume of boxes, their complements, and intersections under a suitable probability measure. Under the uniform measure, if event $\mathbf { x }$ has an associated box with interval boundaries $( x _ { m } , x _ { M } )$ , the probability $p ( \mathbf { x } )$ is given by $\textstyle \prod _ { i } ^ { n } ( x _ { M , i } - x _ { m , i } )$ . Use of the uniform measure requires the boxes to be constrained to the unit hypercube, so that $p ( \mathbf { x } ) \leq 1$ . $p ( \bot )$ is taken to be zero, since $\perp$ is an empty set. As boxes are simply special cases of sets, it is intuitive that this is a valid probability measure, but it can also be shown to be compatible with the meet semilattice structure in a precise sense (Leader, 1971).
91
+
92
+ Figure 1c demonstrates a toy, two-dimensional example of the Box Embedding lattice representation of a simple ontology.
93
+
94
+ # 4 METHOD
95
+
96
+ # 4.1 MOTIVATION: OPTIMIZATION AND SPARSE DATA
97
+
98
+ When using gradient-based optimization to learn box embeddings, an immediate problem identified in the original work is that when two concepts are incorrectly given as disjoint by the model, no gradient signal can flow since the meet (intersection) is exactly zero, with zero derivative. To see this, note that for a pair of 1-dimensional boxes (intervals), the volume of the meet under the uniform measure $p$ as given in Section 3.3 is
99
+
100
+ $$
101
+ p ( \mathbf { x } \wedge \mathbf { y } ) = m _ { h } ( \operatorname* { m i n } ( x _ { M } , y _ { M } ) - \operatorname* { m a x } ( x _ { m } , y _ { m } ) )
102
+ $$
103
+
104
+ where $m _ { h }$ is the standard hinge function, $m _ { h } ( x ) = 0 \lor x = \operatorname* { m a x } ( 0 , x )$ .
105
+
106
+ The hinge function has a large flat plateau at 0 when intervals are disjoint. This issue is especially problematic when the lattice to be embedded is (pseudo-)sparse, that is, most boxes should have very little or no intersection, since if training accidentally makes two boxes disjoint there is no way to recover with the naive measure. The authors propose a surrogate function to optimize in this case, but we will use a more principled framework to develop alternate measures that avoid this pathology, improving both optimization and final model quality.
107
+
108
+ # 4.2 RELAXED GEOMETRY
109
+
110
+ ![](images/52e273973b88b2eeb82ffad0414a0376e7873c9a60e503fb0bddeea225d759b0.jpg)
111
+ Figure 2: One-dimensional example demonstrating two disjoint indicators of intervals before and after the application of a smoothing kernel. The area under the purple product curve is proportional to the degree of overlap.
112
+
113
+ The intuition behind our approach is that the “hard edges” of the standard box embeddings lead to unwanted gradient sparsity, and we seek a relaxation of this assumption that maintains the desirable properties of the base lattice model while enabling better optimization and preserving a geometric intuition. For ease of exposition, we will refer to 1-dimensional intervals in this section, but the results carry through from the representation of boxes as products of intervals and their volumes under the associated product measures.
114
+
115
+ The first observation is that, considering boxes as indicator functions of intervals, we can rewrite the measure of the joint probability $p ( \mathbf { x } \wedge \mathbf { y } )$ between intervals $\mathbf { x } = [ a , b ]$ and $\mathbf { y } = [ c , d ]$ as an integral of the product of those indicators:
116
+
117
+ $$
118
+ p ( \mathbf { x } \wedge \mathbf { y } ) = \int _ { \mathbb { R } } \mathbb { 1 } _ { [ a , b ] } ( x ) \mathbb { 1 } _ { [ c , d ] } ( x ) d x
119
+ $$
120
+
121
+ since the product has support (and is equal to 1) only in the areas where the two intervals overlap.
122
+
123
+ A solution suggests itself in replacing these indicator functions with functions of infinite support. We elect for kernel smoothing, specifically convolution with a normalized Gaussian kernel, equivalent to an application of the diffusion equation to the original functional form of the embeddings (indicator functions) and a common approach to mollified optimization and energy smoothing (Neelakantan et al., 2015; Gulcehre et al., 2016b; Mobahi, 2016). This approach is demonstrated in one dimension in Figure 2.
124
+
125
+ Specifically, given $\mathbf { x } = [ a , b ]$ , we associate the smoothed indicator function
126
+
127
+ $$
128
+ f ( x ; a , b , \sigma ^ { 2 } ) = \mathbb { 1 } _ { [ a , b ] } ( x ) * \phi ( x ; \sigma ^ { 2 } ) = \int _ { \mathbb { R } } \mathbb { 1 } _ { [ a , b ] } ( z ) \phi ( x - z ; \sigma ^ { 2 } ) d z = \int _ { a } ^ { b } \phi ( x - z ; \sigma ^ { 2 } ) d z
129
+ $$
130
+
131
+ We then wish to evaluate, for two lattice elements $\mathbf { x }$ and $\mathbf { y }$ with associated smoothed indicators $f$ and $g$ ,
132
+
133
+ $$
134
+ p _ { \phi } ( \mathbf { x } \wedge \mathbf { y } ) = \int _ { \mathbb { R } } f ( x ; a , b , \sigma _ { 1 } ^ { 2 } ) g ( x ; c , d , \sigma _ { 2 } ^ { 2 } ) d x
135
+ $$
136
+
137
+ This integral admits a closed form solution.
138
+
139
+ Proposition 1. Let $\begin{array} { r } { m _ { \Phi } ( x ) = \int \Phi ( x ) d x } \end{array}$ be an antiderivative of the standard normal CDF. Then the solution to equation 2 is given by,
140
+
141
+ $$
142
+ \begin{array} { r l } & { p _ { \phi } ( \mathbf { x } \wedge \mathbf { y } ) = \sigma \left( m _ { \Phi } ( \frac { b - c } { \sigma } ) + m _ { \Phi } ( \frac { a - d } { \sigma } ) - m _ { \Phi } ( \frac { b - d } { \sigma } ) - m _ { \Phi } ( \frac { a - c } { \sigma } ) \right) } \\ & { \qquad \approx \left( \rho \operatorname { s o f t } ( \frac { b - c } { \rho } ) + \rho \operatorname { s o f t } ( \frac { a - d } { \rho } ) \right) - \left( \rho \operatorname { s o f t } ( \frac { b - d } { \rho } ) + \rho \operatorname { s o f t } ( \frac { a - c } { \rho } ) \right) } \end{array}
143
+ $$
144
+
145
+ where $\sigma = \sqrt { \sigma _ { 1 } ^ { 2 } + \sigma _ { 2 } ^ { 2 } }$ , $\operatorname { s o f t } ( x ) = \log ( 1 + \exp ( x ) )$ is the softplus function, the antiderivative of the logistic sigmoid, and ρ = σ1.702 .
146
+
147
+ Proof. The first line is proved in Appendix A, the second approximation follows from the approximation of $\Phi$ by a logistic sigmoid given in Bowling et al. (2009). □
148
+
149
+ Note that, in the zero-temperature limit, as $\rho$ goes to zero, we recover the formula
150
+
151
+ $$
152
+ { \begin{array} { l } { p _ { \phi } ( \mathbf { x } \wedge \mathbf { y } ) = \operatorname* { l i m } _ { \rho \to 0 } \left( \rho { \mathrm { s o f t } } ( { \frac { b - c } { \rho } } ) + \rho { \mathrm { s o f t } } ( { \frac { a - d } { \rho } } ) \right) - \left( \rho { \mathrm { s o f t } } ( { \frac { b - d } { \rho } } ) + \rho { \mathrm { s o f t } } ( { \frac { a - c } { \rho } } ) \right) } \\ { \qquad = \left( m _ { h } ( b - c ) + m _ { h } ( a - d ) \right) - \left( m _ { h } ( b - d ) + m _ { h } ( a - c ) \right) } \\ { \qquad = m _ { h } ( b \wedge d - a \vee c ) } \end{array} }
153
+ $$
154
+
155
+ with equality in the last line because $( a , b )$ and $( c , d )$ are intervals. This last line is exactly our original equation equation 1, which is expected from convolution with a zero-bandwidth kernel (a Dirac delta function, the identity element under convolution). This is true for both the exact formula using $\textstyle \int \Phi ( x ) d x$ , and the softplus approximation.
156
+
157
+ Unfortunately, for any $\rho > 0$ , multiplication of Gaussian-smoothed indicators does not give a valid meet operation on a function lattice, for the simple reason that $f ^ { 2 } \neq f$ , except in the case of indicator functions, violating the idempotency requirement of Section 3.1.
158
+
159
+ More importantly, for practical considerations, if we are to treat the outputs of $p _ { \phi }$ as probabilities, the consequence is
160
+
161
+ $$
162
+ p _ { \phi } ( \mathbf { x } | \mathbf { x } ) = \frac { p _ { \phi } ( \mathbf { x } , \mathbf { x } ) } { p _ { \phi } ( \mathbf { x } ) } = \frac { p _ { \phi } ( \mathbf { x } \wedge \mathbf { x } ) } { p _ { \phi } ( \mathbf { x } ) } \neq 1
163
+ $$
164
+
165
+ which complicates our applications that train on conditional probabilities. However, by a modification of equation 3, we can obtain a function $p$ such that $p ( \mathbf { x } \wedge \mathbf { \bar { x } } ) = p ( \mathbf { x } )$ , while retaining the smooth optimization properties of the Gaussian model.
166
+
167
+ Recall that for the hinge function $m _ { h }$ and two intervals $( a , b )$ and $( c , d )$ , we have
168
+
169
+ $$
170
+ \bigl ( m _ { h } ( b - c ) + m _ { h } ( a - d ) \bigr ) - \bigl ( m _ { h } ( b - d ) + m _ { h } ( a - c ) \bigr ) = m _ { h } ( b \wedge d - a \vee c )
171
+ $$
172
+
173
+ where the left hand side is the zero-temperature limit of the Gaussian model from equation 3. This identity is true of the hinge function $m _ { h }$ , but not the softplus function.
174
+
175
+ However, an equation with a similar functional form as equation 6 (on both the left- and right-hand sides) is true not only of the hinge function from the unsmoothed model, but also true of the softplus. For two intervals $\mathbf { x } = ( a , b )$ an $\mathbf { y } = ( c , d )$ , by the commutativity of min and max with monotonic functions, we have
176
+
177
+ $$
178
+ { \bigl ( } \operatorname { s o f t } ( b - c ) \lor \operatorname { s o f t } ( a - d ) { \bigr ) } \land { \bigl ( } \operatorname { s o f t } ( b - d ) \lor \operatorname { s o f t } ( a - c ) { \bigr ) } = \operatorname { s o f t } ( b \land d - a \lor c )
179
+ $$
180
+
181
+ In the zero-temperature limit, all terms in equations 3 and 7 are equivalent. However, outside of this, equation 7 is idempotent for $\mathbf { x } = \mathbf { y } = ( { a } , { \bar { b } } ) = ( { c } , { d } )$ (when considered as a measure of overlap, made precise in the next paragraph), while equation 3 is not.
182
+
183
+ This inspires us to define the probabilities $p ( \mathbf { x } )$ and $p ( \mathbf { x } , \mathbf { y } )$ using a normalized version of equation 7 in place of equation 3. For the interval (one-dimensional box) case, we define
184
+
185
+ $$
186
+ \begin{array} { c } { p ( \mathbf { x } ) \propto \mathrm { s o f t } ( b - a ) } \\ { p ( \mathbf { x } , \mathbf { y } ) \propto \mathrm { s o f t } ( b \wedge d - a \vee c ) } \end{array}
187
+ $$
188
+
189
+ which satisfies the idempotency requirement, $p ( \mathbf { x } ) = p ( \mathbf { x } , \mathbf { x } )$
190
+
191
+ Because softplus upper-bounds the hinge function, it is capable of outputting values that are greater than 1, and therefore must be normalized. In our experiments, we use two different approaches to
192
+
193
+ normalization. For experiments with a relatively small number of entities (all besides Flickr), we allow the boxes to learn unconstrained, and divide each dimension by the measured size of the global minimum and maximum $( G _ { m } ^ { ( i ) } , G _ { M } ^ { ( i ) } )$ at that dimension
194
+
195
+ $$
196
+ m _ { \mathrm { s o f t } } ^ { ( i ) } ( x ) = \frac { \mathrm { s o f t } ( \frac { x } { \rho } ) } { \mathrm { s o f t } ( \frac { G _ { m } - G _ { m } } { \rho } ) }
197
+ $$
198
+
199
+ For data where computing these values repeatedly is infeasible, we project onto the unit hypercube and normalize by $m _ { \mathrm { { s o f t } } } ( 1 )$ . The final probability $p ( \mathbf { x } )$ is given by the product over dimensions
200
+
201
+ $$
202
+ \begin{array} { c } { { p ( { \bf x } ) = \displaystyle \prod _ { i } m _ { \mathrm { s o f t } } ^ { ( i ) } ( x _ { M , i } - x _ { m , i } ) } } \\ { { p ( { \bf x } , { \bf y } ) = \displaystyle \prod _ { i } m _ { \mathrm { s o f t } } ^ { ( i ) } ( x _ { M , i } \wedge y _ { M , i } - x _ { m , i } \vee y _ { m , i } ) } } \end{array}
203
+ $$
204
+
205
+ Note that, while equivalent in the zero temperature limit to the standard uniform probability measure of the box model, this function, like the Gaussian model, is not a valid probability measure on the entire joint space of events (the lattice). However, neither is factorization of a conditional probability table using a logistic sigmoid link function, which is commonly used for the similar tasks. Our approach retains the inductive bias of the original box model, is equivalent in the limit, and satisfies the necessary condition that $p ( \mathbf { x } , \mathbf { x } ) = p ( \mathbf { x } )$ . A comparison of the 3 different functions is given in Figure 3, with the softplus overlap showing much better behavior for highly disjoint boxes than the Gaussian model, while also preserving the meet property.
206
+
207
+ ![](images/9cc21fb6cb8ac7eae24bc49999bdb4ae1bfab3ab3d06a128598a726986167a50.jpg)
208
+ Figure 3: Comparison of different overlap functions for two boxes of width 0.3 as a function of their centers. Note that in order to achieve high overlap, the Gaussian model must drastically lower its temperature, causing vanishing gradients in the tails.
209
+
210
+ # 5 EXPERIMENTS
211
+
212
+ # 5.1 WORDNET
213
+
214
+ Table 4: Classification accuracy on WordNet test set.
215
+
216
+ <table><tr><td>Method</td><td>Test Accuracy %</td></tr><tr><td>transitive</td><td>88.2</td></tr><tr><td>word2gauss</td><td>86.6</td></tr><tr><td>OE</td><td>90.6</td></tr><tr><td>Li et al. (2017)</td><td>91.3</td></tr><tr><td>POE</td><td>91.6</td></tr><tr><td>Box</td><td>92.2</td></tr><tr><td>Smoothed Box</td><td>92.0</td></tr></table>
217
+
218
+ We perform experiments on the WordNet hypernym prediction task in order to evaluate the performance of these improvements in practice. The WordNet hypernym hierarchy contains 837,888- edges after performing the transitive closure on the direct edges in WordNet. We used the same train/dev/test split as in Vendrov et al. (2016). Positive examples are randomly chosen from the ${ } ^ { 8 3 7 \mathrm { k } }$ edges, while negative examples are generated by swapping one of the terms to a random word in the dictionary. Experimental details are given in Appendix D.1.
219
+
220
+ The smoothed box model performs nearly as well as the original box lattice in terms of test accuracy1. While our model requires less hyper-parameter tuning than the original, we suspect that our performance would be increased on a task with a higher degree of sparsity than the 50/50 positive/negative split of the standard WordNet data, which we explore in the next section.
221
+
222
+ # 5.2 IMBALANCED WORDNET
223
+
224
+ In order to confirm our intuition that the smoothed box model performs better in the sparse regime, we perform further experiments using different numbers of positive and negative examples from the WordNet mammal subset, comparing the box lattice, our smoothed approach, and order embeddings (OE) as a baseline. The training data is the transitive reduction of this subset of the mammal WordNet, while the dev/test is the transitive closure of the training data. The training data contains 1,176 positive examples, and the dev and test sets contain 209 positive examples. Negative examples are generated randomly using the ratio stated in the table.
225
+
226
+ As we can see from the table, with balanced data, all models include OE baseline, Box, Smoothed Box models nearly match the full transitive closure. As the number of negative examples increases, the performance drops for the original box model, but Smoothed Box still outperforms OE and Box in all setting. This superior performance on imbalanced data is important for e.g. real-world entailment graph learning, where the number of negatives greatly outweigh the positives.
227
+
228
+ <table><tr><td rowspan=1 colspan=1>Positive:Negative</td><td rowspan=1 colspan=1>Box</td><td rowspan=1 colspan=1>OE</td><td rowspan=1 colspan=1>Smoothed Box</td></tr><tr><td rowspan=1 colspan=1>1:1</td><td rowspan=1 colspan=1>0.9905</td><td rowspan=1 colspan=1>0.9976</td><td rowspan=1 colspan=1>1.0</td></tr><tr><td rowspan=1 colspan=1>1:2</td><td rowspan=1 colspan=1>0.8982</td><td rowspan=1 colspan=1>0.9139</td><td rowspan=1 colspan=1>1.0</td></tr><tr><td rowspan=1 colspan=1>1:6</td><td rowspan=1 colspan=1>0.6680</td><td rowspan=1 colspan=1>0.6640</td><td rowspan=1 colspan=1>0.9561</td></tr><tr><td rowspan=1 colspan=1>1:10</td><td rowspan=1 colspan=1>0.5495</td><td rowspan=1 colspan=1>0.5897</td><td rowspan=1 colspan=1>0.8800</td></tr></table>
229
+
230
+ Table 5: F1 scores of the box lattice, order embeddings, and our smoothed model, for different levels of label imbalance on the WordNet mammal subset.
231
+
232
+ # 5.3 FLICKR
233
+
234
+ We conduct experiments on the Flickr entailment dataset. Flickr is a large-scale caption entailment dataset containing of 45 million image caption pairs. In order to perform an apples-to-apples comparison with existing results we use the exact same dataset from Vilnis et al. (2018). In this case, we do constrain the boxes to the unit cube, using the same experimental setup as Vilnis et al. (2018), except we apply the softplus function before calculating the volume of the boxes. Experimental details are given in Appendix D.3.
235
+
236
+ We report KL divergence and Pearson correlation on the full test data, unseen pairs (caption pairs which are never occur in training data) and unseen captions (captions which are never occur in training data). As shown in Table 6, we see a slight performance gain compared to the original model, with improvements most concentrated on unseen captions.
237
+
238
+ # 5.4 MOVIELENS
239
+
240
+ We apply our method to a market-basket task constructed using the MovieLens dataset. Here, the task is to predict users’ preference for movie A given that they liked movie B. We first collect all pairs of user-movie ratings higher than 4 points (strong preference) from the MovieLens-20M dataset. From this we further prune to just a subset of movies which have more than 100 user ratings to make sure that counting statistics are significant enough. This leads to 8545 movies in our dataset. We calculate the conditional probability $\begin{array} { r } { \overline { { P } } ( A | B ) = \frac { \overline { { P ( A , B ) } } } { \overline { { P ( B ) } } } = \frac { \# r a t i n g ( A , B ) _ { > 4 } / \# u s e r s } { \# r a t i n g ( B ) _ { > 4 } / \# u s e r s } } \end{array}$ We randomly pick 100K conditional probabilities for training data and 10k probabilities for dev and test data 2.
241
+
242
+ Table 6: KL and Pearson correlation between model and gold probability.
243
+
244
+ <table><tr><td></td><td colspan="2">P(xly)</td></tr><tr><td>Full test data POE</td><td>KL 0.031</td><td>Pearson R 0.949</td></tr><tr><td>POE* Box</td><td>0.031 0.020</td><td>0.949 0.967</td></tr><tr><td>Smoothed Box</td><td>0.018</td><td>0.969</td></tr><tr><td>Unseen pairs POE</td><td>0.048</td><td>0.920 0.925</td></tr><tr><td>POE* Box Smoothed Box</td><td>0.046 0.025 0.024</td><td>0.957 0.957</td></tr><tr><td>Unseen captions</td><td></td><td></td></tr><tr><td>POE</td><td>0.127</td><td>0.696</td></tr><tr><td>POE*</td><td>0.084</td><td>0.854</td></tr><tr><td></td><td></td><td></td></tr><tr><td>Box Smoothed Box</td><td>0.050 0.036</td><td>0.900 0.917</td></tr></table>
245
+
246
+ We compare with several baselines: low-rank matrix factorization, complex bilinear factorization (Trouillon et al., 2016), and two hierarchical embedding methods, POE (Lai & Hockenmaier, 2017) and the Box Lattice (Vilnis et al., 2018). Since the training matrix is asymmetric, we used separate embeddings for target and conditioned movies. For the complex bilinear model, we added one additional vector of parameters to capture the “imply” relation. We evaluate on the test set using KL divergence, Pearson correlation, and Spearman correlation with the ground truth probabilities. Experimental details are given in Appendix D.4.
247
+
248
+ From the results in Table 7, we can see that our smoothed box embedding method outperforms the original box lattice as well as all other baselines’ performances, especially in Spearman correlation, the most relevant metric for recommendation, a ranking task. We perform an additional study on the robustness of the smoothed model to initialization conditions in Appendix C.
249
+
250
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>KL</td><td rowspan=1 colspan=1>Pearson R</td><td rowspan=1 colspan=1>Spearman R</td></tr><tr><td rowspan=1 colspan=1>Matrix Factorization</td><td rowspan=1 colspan=1>0.0173</td><td rowspan=1 colspan=1>0.8549</td><td rowspan=1 colspan=1>0.8374</td></tr><tr><td rowspan=1 colspan=1>Complex Bilinear Factorization</td><td rowspan=1 colspan=1>0.0141</td><td rowspan=1 colspan=1>0.8771</td><td rowspan=1 colspan=1>0.8636</td></tr><tr><td rowspan=1 colspan=1>POE</td><td rowspan=1 colspan=1>0.0170</td><td rowspan=1 colspan=1>0.8548</td><td rowspan=1 colspan=1>0.8511</td></tr><tr><td rowspan=1 colspan=1>Box</td><td rowspan=1 colspan=1>0.0147</td><td rowspan=1 colspan=1>0.8775</td><td rowspan=1 colspan=1>0.8768</td></tr><tr><td rowspan=1 colspan=1>Smoothed Box</td><td rowspan=1 colspan=1>0.0138</td><td rowspan=1 colspan=1>0.8985</td><td rowspan=1 colspan=1>0.8977</td></tr></table>
251
+
252
+ Table 7: Performance of the smoothed model, the original box model, and several baselines on MovieLens.
253
+
254
+ # 6 CONCLUSION AND FUTURE WORK
255
+
256
+ We presented an approach to smoothing the energy and optimization landscape of probabilistic box embeddings and provided a theoretical justification for the smoothing. Due to a decreased number of hyper-parameters this model is easier to train, and, furthermore, met or surpassed current state-ofthe-art results on several interesting datasets. We further demonstrated that this model is particularly effective in the case of sparse data and more robust to poor initialization.
257
+
258
+ Tackling the learning problems presented by rich, geometrically-inspired embedding models is an open and challenging area of research, which this work is far from the last word on. This task will become even more pressing as the embedding structures become more complex, such as unions of boxes or other non-convex objects. To this end, we will continue to explore both function lattices, and constraint-based approaches to learning.
259
+
260
+ # 7 ACKNOWLEDGMENTS
261
+
262
+ We thank Travis Wolfe, Colin Evans, Rob Zinkov, Ben Poole, and Laurent Dinh for helpful discussions. We also thank the anonymous reviewers for their constructive feedback. This work was supported in part by the Center for Intelligent Information Retrieval and the Center for Data Science, in part by the Chan Zuckerberg Initiative under the project Scientific Knowledge Base Construction, and in part by the National Science Foundation under Grant No. IIS-1514053. Any opinions, findings and conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect those of the sponsor.
263
+
264
+ # REFERENCES
265
+
266
+ Ben Athiwaratkun and Andrew Gordon Wilson. Multimodal word distributions. In ACL, 2017.
267
+
268
+ Ben Athiwaratkun and Andrew Gordon Wilson. Hierarchical density order embeddings. In International Conference on Learning Representations, 2018. URL https://openreview.net/ forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ HJCXZQbAZ.
269
+
270
+ Yoshua Bengio, Rejean Ducharme, Pascal Vincent, and Christian Jauvin. A neural probabilistic ´ language model. Journal of machine learning research, 3(Feb):1137–1155, 2003.
271
+
272
+ Shannon R Bowling, Mohammad T Khasawneh, Sittichai Kaewkuekool, and Byung R Cho. A logistic approximation to the cumulative normal distribution. Journal of Industrial Engineering and Management, 2(1), 2009.
273
+
274
+ Scott Deerwester, Susan T Dumais, George W Furnas, Thomas K Landauer, and Richard Harshman. Indexing by latent semantic analysis. Journal of the American society for information science, 41 (6):391–407, 1990.
275
+
276
+ Octavian-Eugen Ganea, Gary Becigneul, and Thomas Hofmann. Hyperbolic entailment cones for ´ learning hierarchical embeddings. ICML, 2018.
277
+
278
+ Caglar Gulcehre, Marcin Moczulski, Misha Denil, and Yoshua Bengio. Noisy activation functions. In International Conference on Machine Learning, pp. 3059–3068, 2016a.
279
+
280
+ Caglar Gulcehre, Marcin Moczulski, Francesco Visin, and Yoshua Bengio. Mollifying networks. arXiv preprint arXiv:1608.04980, 2016b.
281
+
282
+ Tony Jebara, Risi Kondor, and Andrew Howard. Probability product kernels. Journal of Machine Learning Research, 5(Jul):819–844, 2004.
283
+
284
+ Alice Lai and Julia Hockenmaier. Learning to predict denotational probabilities for modeling entailment. In EACL, 2017.
285
+
286
+ Solomon Leader. Measures on semilattices. Pacific Journal of Mathematics, 39(2):407–423, 1971.
287
+
288
+ Xiang Li, Luke Vilnis, and Andrew McCallum. Improved representation learning for predicting commonsense ontologies. NIPS Workshop on Structured Prediction, 2017.
289
+
290
+ Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg S Corrado, and Jeff Dean. Distributed representations of words and phrases and their compositionality. In NIPS, 2013.
291
+
292
+ Andriy Mnih and Geoffrey E Hinton. A scalable hierarchical distributed language model. In Advances in neural information processing systems, pp. 1081–1088, 2009.
293
+
294
+ Hossein Mobahi. Training recurrent neural networks by diffusion. arXiv preprint arXiv:1601.04114, 2016.
295
+
296
+ Arvind Neelakantan, Luke Vilnis, Quoc V Le, Ilya Sutskever, Lukasz Kaiser, Karol Kurach, and James Martens. Adding gradient noise improves learning for very deep networks. arXiv preprint arXiv:1511.06807, 2015.
297
+
298
+ Maximillian Nickel and Douwe Kiela. Poincare embeddings for learning hierarchical rep- ´ resentations. 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. 6338–6347. Curran Associates, Inc., 2017. URL http://papers.nips.cc/paper/ 7213-poincare-embeddings-for-learning-hierarchical-representations. pdf.
299
+
300
+ Gerard Salton, Anita Wong, and Chung-Shu Yang. A vector space model for automatic indexing. Communications of the ACM, 18(11):613–620, 1975.
301
+
302
+ Sandeep Subramanian and Soumen Chakrabarti. New embedded representations and evaluation protocols for inferring transitive relations. SIGIR 2018, 2018.
303
+
304
+ Theo Trouillon, Johannes Welbl, Sebastian Riedel, ´ Eric Gaussier, and Guillaume Bouchard. Com- ´ plex embeddings for simple link prediction. In International Conference on Machine Learning, pp. 2071–2080, 2016.
305
+
306
+ Ivan Vendrov, Ryan Kiros, Sanja Fidler, and Raquel Urtasun. Order-embeddings of images and language. In ICLR, 2016.
307
+
308
+ Luke Vilnis and Andrew McCallum. Word representations via gaussian embedding. In ICLR, 2015.
309
+
310
+ Luke Vilnis, Xiang Li, Shikhar Murty, and Andrew McCallum. Probabilistic embedding of knowledge graphs with box lattice measures. In ACL. Association for Computational Linguistics, 2018.
311
+
312
+ Adriaan C. Zaanen. Introduction to Operator Theory in Riesz Spaces. Springer Berlin Heidelberg, 1997. ISBN 9783642644870.
313
+
314
+ # Supplementary Material
315
+
316
+ # A PROOF OF GAUSSIAN OVERLAP FORMULA
317
+
318
+ We wish to evaluate, for two lattice elements $\mathbf { x }$ and $\mathbf { y }$ , with associated smoothed indicators $f$ and $g$
319
+
320
+ $$
321
+ \begin{array} { l } { f ( x ; a , b , \sigma ^ { 2 } ) = \mathbb { 1 } _ { [ a , b ] } ( x ) * \phi ( x ; \sigma ^ { 2 } ) = \displaystyle \int _ { \mathbb { R } } \mathbb { 1 } _ { [ a , b ] } ( z ) \phi ( x - z ; \sigma ^ { 2 } ) d z = \displaystyle \int _ { a } ^ { b } \phi ( x - z ; \sigma ^ { 2 } ) d z } \\ { p _ { \phi } ( \mathbf x \wedge \mathbf y ) = \displaystyle \int _ { \mathbb { R } } f ( x ; a , b , \sigma _ { 1 } ^ { 2 } ) g ( x ; c , d , \sigma _ { 2 } ^ { 2 } ) d x } \end{array}
322
+ $$
323
+
324
+ Since the Gaussian kernel is normalized to have total integral equal to 1, so as not to change the overall areas of the boxes, the concrete formula is
325
+
326
+ $$
327
+ \phi ( z ; \sigma ^ { 2 } ) = { \frac { 1 } { \sigma { \sqrt { 2 \pi } } } } e ^ { { \frac { - z ^ { 2 } } { 2 \sigma ^ { 2 } } } }
328
+ $$
329
+
330
+ Since the antiderivative of $\phi$ is the normal CDF, this may be recognized as the difference $\Phi ( x ; a , \sigma ^ { 2 } ) - \Phi ( x ; b , \sigma ^ { 2 } )$ , but this does not allow us to easily evaluate the integral of interest, which is the integral of the product of two such functions.
331
+
332
+ To evaluate equation 8, recall the identity (Jebara et al., 2004; Vilnis & McCallum, 2015)
333
+
334
+ $$
335
+ \int _ { \mathbb { R } } \phi ( x - \mu _ { 1 } ; \sigma _ { 1 } ^ { 2 } ) \phi ( x - \mu _ { 2 } ; \sigma _ { 2 } ^ { 2 } ) d x = \phi ( \mu _ { 1 } - \mu _ { 2 } ; \sigma _ { 1 } ^ { 2 } + \sigma _ { 2 } ^ { 2 } )
336
+ $$
337
+
338
+ For convenience, let $\begin{array} { r } { \tau : = \frac { 1 } { \sqrt { \sigma _ { 1 } ^ { 2 } + \sigma _ { 2 } ^ { 2 } } } } \end{array}$ Applying Fubini’s theorem and using equation 9, we have
339
+
340
+ $$
341
+ \begin{array} { l } { \displaystyle p _ { \phi } ( \mathbf { x } \cdot \mathbf { y } ) = \int _ { \mathbb { R } } \int _ { a } ^ { b } \phi ( x - y ; \sigma _ { 1 } ^ { 2 } ) d y \int _ { c } ^ { d } \phi ( x - z ; \sigma _ { 2 } ^ { 2 } ) d z d x } \\ { \displaystyle = \int _ { c } ^ { d } \int _ { a } ^ { b } \phi ( y - z ; \tau ^ { - 2 } ) d y d z } \\ { \displaystyle = \int _ { c } ^ { d } \int _ { a } ^ { b } \Phi ^ { \prime } ( \tau ( y - z ) ) \tau d y d z } \\ { \displaystyle = \int _ { c } ^ { d } \Phi ( \tau ( b - z ) ) - \Phi ( \tau ( a - z ) ) d z } \\ { \displaystyle = \frac { - 1 } { \tau } ( m _ { \Phi } ( \tau ( b - d ) ) - m _ { \Phi } ( \tau ( a - d ) ) - m _ { \Phi } ( \tau ( b - c ) ) + m _ { \Phi } ( \tau ( a - c ) ) ) } \end{array}
342
+ $$
343
+
344
+ and therefore, with $\sigma = \tau ^ { - 1 }$
345
+
346
+ $$
347
+ \begin{array} { r } { p _ { \phi } ( \mathbf { x } \wedge \mathbf { y } ) = \sigma \left( m _ { \Phi } ( \frac { b - c } { \sigma } ) + m _ { \Phi } ( \frac { a - d } { \sigma } ) - m _ { \Phi } ( \frac { b - d } { \sigma } ) - m _ { \Phi } ( \frac { a - c } { \sigma } ) \right) } \end{array}
348
+ $$
349
+
350
+ as desired.
351
+
352
+ # B MOVIELENS PSEUDOSPARSITY
353
+
354
+ The MovieLens dataset, while not truly sparse, has a large proportion of small probabilities which make it especially suitable for optimization by the smoothed model. The rough distribution of probabilities, in buckets of width 0.1, is shown in Figure 1.
355
+
356
+ # C MOVIELENS INITIALIZATION SENSITIVITY
357
+
358
+ We perform an additional set of experiments to determine the robustness of the smoothed box model to initialization. While the model is normally initialized randomly so that each box is a product of intervals that almost always overlaps with the other boxes, we would like to determine the models robustness to disjoint boxes in a principled way. While we can control initialization, we cannot always control the intermediate results of optimization, which may drive boxes to be disjoint, a condition from which the original, hard-edged box model may have difficulty recovering. So, parametrizing the initial distribution of boxes with a minimum coordinate and a positive width, we adjust the width parameter so that approximately $0 \%$ , $20 \%$ , $50 \%$ , and $100 \%$ of boxes are disjoint at initialization before learning on the MovieLens dataset as usual. These results are presented in table 8. The smoothed model does not seem to suffer at all from disjoint initialization, while the performance of the original box model degrades significantly. From this we can speculate that part of the strength of the smoothed box model is its ability to smoothly optimize in the disjoint regime.
359
+
360
+ ![](images/262dd36934bbf5f0c1eafe924b8ad5d60a4fadb6282c801a3dd744a0a5c70830.jpg)
361
+ Figure 1: Distribution of probabilities in MovieLens Dataset.
362
+
363
+ <table><tr><td rowspan=1 colspan=1>Approx. % Disjoint</td><td rowspan=1 colspan=2>KL</td><td rowspan=1 colspan=2>Pearson</td><td rowspan=1 colspan=2>Spearman</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Box</td><td rowspan=1 colspan=1>Smooth</td><td rowspan=1 colspan=1>Box</td><td rowspan=1 colspan=1>Smooth</td><td rowspan=1 colspan=1>Box</td><td rowspan=1 colspan=1>Smooth</td></tr><tr><td rowspan=1 colspan=1>0%</td><td rowspan=1 colspan=1>0.0147</td><td rowspan=1 colspan=1>0.0138</td><td rowspan=1 colspan=1>0.8775</td><td rowspan=1 colspan=1>0.8985</td><td rowspan=1 colspan=1>0.8768</td><td rowspan=1 colspan=1>0.8977</td></tr><tr><td rowspan=1 colspan=1>20%</td><td rowspan=1 colspan=1>0.0172</td><td rowspan=1 colspan=1>0.0141</td><td rowspan=1 colspan=1>0.8668</td><td rowspan=1 colspan=1>0.8917</td><td rowspan=1 colspan=1>0.8608</td><td rowspan=1 colspan=1>0.8898</td></tr><tr><td rowspan=1 colspan=1>50%</td><td rowspan=1 colspan=1>0.0182</td><td rowspan=1 colspan=1>0.0141</td><td rowspan=1 colspan=1>0.8613</td><td rowspan=1 colspan=1>0.8908</td><td rowspan=1 colspan=1>0.8551</td><td rowspan=1 colspan=1>0.8910</td></tr><tr><td rowspan=1 colspan=1>100%</td><td rowspan=1 colspan=1>0.0346</td><td rowspan=1 colspan=1>0.0142</td><td rowspan=1 colspan=1>0.8401</td><td rowspan=1 colspan=1>0.8921</td><td rowspan=1 colspan=1>0.8167</td><td rowspan=1 colspan=1>0.8947</td></tr></table>
364
+
365
+ Table 8: Performance of the original box model and smoothed box model on MovieLens, as a function of different degrees of disjointness upon initialization.
366
+
367
+ # D MODEL PARAMETERS
368
+
369
+ We give a brief overview of our methodology and hyperparameter selection methods for each experiment. Detailed hyperparameter settings and code to reproduce experiments can be found at https://github.com/Lorraine333/smoothed_box_embedding.
370
+
371
+ # D.1 WORDNET PARAMETERS
372
+
373
+ For the WordNet experiments, the model is evaluated every epoch on the development set for a large fixed number of epochs, and the best development model is used to score the test set. Baseline models are trained using the parameters of Vilnis et al. (2018), with the smoothed model using hyperparameters determined on the development set.
374
+
375
+ # D.2 IMBALANCED WORDNET PARAMETERS
376
+
377
+ We follow the same routine as the WordNet experiments section to select best parameters. For the 12 experiments we conducted in this section, negative examples are generated randomly based on the ratio for each batch of positive examples. We do a parameter sweep for all models then choose the best result for each model as our final result.
378
+
379
+ # D.3 FLICKR PARAMETERS
380
+
381
+ The experimental setup uses the same architecture as Vilnis et al. (2018) and Lai & Hockenmaier (2017), a single-layer LSTM that reads captions and produces a box embedding parameterized by min and delta. Embeddings are produced by feedforward networks on the output of the LSTM. The model is trained for a large fixed number of epochs, and tested on the development data at each epoch. The best development model is used to report test set score. Hyperparameters were determined on the development set.
382
+
383
+ # D.4 MOVIELENS PARAMETERS
384
+
385
+ For all MovieLens experiments, the model is evaluated every 50 steps on the development set, and optimization is stopped if the best development set score fails to improve after 200 steps. The best development model is used to score the test set.
md/train/H1xaJn05FQ/H1xaJn05FQ.md ADDED
@@ -0,0 +1,469 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SLICED-WASSERSTEIN AUTO-ENCODERS
2
+
3
+ Soheil Kolouri, Phillip E. Pope, & Charles E. Martin,
4
+
5
+ Gustavo K. Rohde
6
+
7
+ Information and Systems Sciences Laboratory HRL Laboratories, LLC.
8
+ Malibu, CA, USA
9
+ {skolouri,pepope,cemartin}@hrl.com
10
+
11
+ Department of Electrical Engineering University of Virginia Charlottesville, VA, USA gustavo@virginia.edu
12
+
13
+ # ABSTRACT
14
+
15
+ In this paper we use the geometric properties of the optimal transport (OT) problem and the Wasserstein distances to define a prior distribution for the latent space of an auto-encoder. We introduce Sliced-Wasserstein Auto-Encoders (SWAE), that enable one to shape the distribution of the latent space into any samplable probability distribution without the need for training an adversarial network or having a likelihood function specified. In short, we regularize the auto-encoder loss with the sliced-Wasserstein distance between the distribution of the encoded training samples and a samplable prior distribution. We show that the proposed formulation has an efficient numerical solution that provides similar capabilities to Wasserstein Auto-Encoders (WAE) and Variational Auto-Encoders (VAE), while benefiting from an embarrassingly simple implementation. We provide extensive error analysis for our algorithm, and show its merits on three benchmark datasets.
16
+
17
+ Scalable generative models that capture the rich and often nonlinear distribution of high-dimensional data, (i.e., image, video, and audio), play a central role in various applications of machine learning, including transfer learning Isola et al. (2017); Murez et al. (2018), super-resolution Ledig et al. (2016); Kolouri & Rohde (2015), image inpainting and completion Yeh et al. (2017), and image retrieval Creswell & Bharath (2016), among many others. The recent parametric generative models, including Generative Adversarial Networks (GANs) Goodfellow et al. (2014); Radford et al. (2015); Arjovsky et al. (2017); Berthelot et al. (2017) and Variational auto-encoders (VAE) Kingma & Welling (2013); Mescheder et al. (2017); Bousquet et al. (2017) enable an unsupervised and end-to-end modeling of the high-dimensional distribution of the training data.
18
+
19
+ Learning such generative models boils down to minimizing a dissimilarity measure between the data distribution and the output distribution of the generative model. To this end, and following the work of Arjovsky et al. (2017) and Bousquet et al. (2017), we approach the problem of generative modeling from the optimal transport point of view. The optimal transport problem Villani (2008); Kolouri et al. (2017) provides a way to measure the distances between probability distributions by transporting (i.e., morphing) one distribution into another. Moreover, and as opposed to the common information theoretic dissimilarity measures (e.g., $f$ -divergences), the p-Wasserstein dissimilarity measures that arise from the optimal transport problem: 1) are true distances, and 2) metrize a weak convergence of probability measures (at least on compact spaces). Wasserstein distances have recently attracted a lot of interest in the learning community Frogner et al. (2015); Gulrajani et al. (2017); Bousquet et al. (2017); Arjovsky et al. (2017); Kolouri et al. (2017) due to their exquisite geometric characteristics Santambrogio (2015). See the supplementary material for an intuitive example showing the benefit of the Wasserstein distance over commonly used $f$ -divergences.
20
+
21
+ In this paper, we introduce a new type of auto-encoders for generative modeling (Algorithm 1), which we call Sliced-Wasserstein auto-encoders (SWAE), that minimize the sliced-Wasserstein distance between the distribution of the encoded samples and a samplable prior distribution. Our work is most closely related to the recent work by Bousquet et al. (2017) and more specifically the follow-up work by Tolstikhin et al. (2017). However, our approach avoids the need to perform adversarial training in the encoding space and is not restricted to closed-form distributions, while still benefiting from a Wasserstein-like distance measure in the latent space. Calculating the Wasserstein distance can be computationally expensive, but our approach permits a simple numerical solution to the problem. Finally, we note that there has been several concurrent papers, including the work by Deshpande et al. (2018) and ¸Sim¸sekli et al. (2018), that also looked into the application of sliced-Wasserstein distance in generative modeling. Regardless of the concurrent nature of these papers, our work remains novel and is distinguished from these methods. Deshpande et al. (2018) use the sliced-Wasserstein distance to match the distributions of high-dimensional reconstructed images, which require large number of slices, $\mathcal { O } ( 1 0 ^ { 4 } )$ , while in our method and due to the distribution matching in the latent space we only need $\mathcal { O } ( 1 0 )$ slices. We also note that Deshpande et al. (2018) proposed to learn discriminative slices to mitigate the need for a very large number of random projections that is in essence similar to the adversarial training used in GANs, which contradicts with our goal of not using adversarial training. ¸Sim¸sekli et al. (2018), on the other hand, take an interesting but different approach of parameter-free generative modeling via sliced-Wasserstein flows.
22
+
23
+ # 1 NOTATION AND PRELIMINARIES
24
+
25
+ Let $X$ denote the compact domain of a manifold in Euclidean space and let $x _ { n } \in X$ denote an individual input data point. Furthermore, let $\rho _ { X }$ be a Borel probability measure defined on $X$ . We define the probability density function $p _ { X } ( x )$ for input data $x$ to be:
26
+
27
+ $$
28
+ d \rho _ { X } ( x ) = p _ { X } ( x ) d x
29
+ $$
30
+
31
+ Let $\phi : X \to Z$ denote a deterministic parametric mapping from the input space to a latent space $Z$ (e.g., a neural network encoder). To obtain the density of the push forward of $\rho _ { X }$ with respect to $\phi$ , i.e., $\rho _ { Z } = \phi _ { * } ( \rho _ { X } )$ , we use Random Variable Transformation (RVT) Gillespie (1983)). In short, the probability density function of the encoded samples $z$ can be expressed in terms of $\phi$ and $p _ { X }$ by:
32
+
33
+ $$
34
+ p _ { Z } ( z ) = \int _ { X } p _ { X } ( x ) \delta ( z - \phi ( x ) ) d x ,
35
+ $$
36
+
37
+ where $\delta$ denotes the Dirac distribution function. Similar to variational Auto-Encoders (VAEs) Kingma $\&$ Welling (2013) and the Wasserstein Auto-Encoders (WAE) Tolstikhin et al. (2017), our main objective is to encode the input data points $x \in X$ into latent codes $z \in Z$ such that: 1) $x$ can be recovered/approximated from $z$ , and 2) the probability density function of the encoded samples, $p _ { Z }$ , follows a prior distribution $q _ { Z }$ . Let $\psi : Z \to X$ be the decoder that maps the latent codes back to the original space such that
38
+
39
+ $$
40
+ p _ { Y } ( y ) = \int _ { X } p _ { X } ( x ) \delta ( y - \psi ( \phi ( x ) ) ) d x ,
41
+ $$
42
+
43
+ where $y$ denotes the decoded samples. It is straightforward to see that when $\psi = \phi ^ { - 1 }$ (i.e. $\psi ( \phi ( \cdot ) ) =$ $i d ( \cdot ) )$ , the distribution of the decoder $p _ { Y }$ and the input distribution $p _ { X }$ are identical. Hence, in its most general form, the objective of such auto-encoders simplifies to learning $\phi$ and $\psi$ , so that they minimize a dissimilarity measure between $p _ { Y }$ and $p _ { X }$ , and between $p _ { Z }$ and $q _ { Z }$ . In what follows, we briefly review the existing dissimilarity measures for these distributions.
44
+
45
+ # 1.1 MINIMIZING DISSIMILARITY BETWEEN $p _ { X }$ AND $p _ { Y }$
46
+
47
+ We first emphasize that the VAE often assumes stochastic encoders and decoders Kingma & Welling (2013), while we consider the case of only deterministic mappings. Although, we note that, similar to WAE, SWAE can also be formulated with stochastic encoders. Different measures have been used previously to compute the dissimilarity between $p _ { X }$ and $p _ { Y }$ . Most notably, Nowozin et al. (2016) showed that for the general family of $f$ -divergences, $D _ { f } ( p _ { X } , p _ { Y } )$ , (including the KL-divergence, JensenShannon, etc.), using the Fenchel conjugate of the convex function $f$ and minimizing $D _ { f } ( p _ { X } , p _ { Y } )$ leads to a min-max problem that is equivalent to the adversarial training widely used in the generative modeling literature Goodfellow et al. (2014); Makhzani et al. (2015); Mescheder et al. (2017).
48
+
49
+ Others have utilized the rich mathematical foundation of the OT problem and Wasserstein distances Arjovsky et al. (2017); Gulrajani et al. (2017); Bousquet et al. (2017); Tolstikhin et al. (2017) to define a distance between $p _ { X }$ and $p _ { Y }$ . In Wasserstein-GAN, Arjovsky et al. (2017) utilized the Kantorovich-Rubinstein duality for the 1-Wasserstein distance, $W _ { 1 } ( p _ { X } , p _ { Y } )$ , and reformulated the problem as a min-max optimization that is solved through an adversarial training scheme.
50
+
51
+ Inspired by the work of Bousquet et al. (2017) and Tolstikhin et al. (2017), it can be shown that (see supplementary material for a proof):
52
+
53
+ $$
54
+ \begin{array} { r c l } { W _ { c } ( p _ { X } , p _ { Y } ) \leq W _ { c } ^ { \dagger } ( p _ { X } , p _ { Y } ) } & { : = } & { \mathbb { E } _ { p _ { X } } \left( c ( x , \psi ( \phi ( x ) ) ) \right) } \\ & { = } & { \displaystyle \int _ { X } c ( x , \psi ( \phi ( x ) ) ) p _ { X } ( x ) d x , } \end{array}
55
+ $$
56
+
57
+ Furthermore, the r.h.s. of equation 3 supports a simple implementation where for i.i.d samples of the input distribution, $\{ x _ { n } \} _ { n = 1 } ^ { N }$ , the upper bound can be approximated as:
58
+
59
+ $$
60
+ W _ { c } ^ { \ddagger } ( p _ { X } , p _ { Y } ) \approx \frac { 1 } { N } \sum _ { n = 1 } ^ { N } c ( x _ { n } , \psi ( \phi ( x _ { n } ) ) )
61
+ $$
62
+
63
+ The r.h.s of equation 3 and equation 4 take advantage of the existence of pairs $x _ { n }$ and $y _ { n } = \psi { \bigl ( } \phi ( x _ { n } ) { \bigr ) }$ , which make $f ( \cdot ) = \psi ( \phi ( \cdot ) )$ a transport map between $p _ { X }$ and $p _ { Y }$ (but not necessarily the optimal transport map). In this paper, we minimize $W _ { c } ^ { \ddagger } ( p _ { X } , p _ { Y } )$ following equation 4 to minimize the discrepancy between $p _ { X }$ and $p _ { Y }$ . Next, we focus on the discrepancy measures between $p _ { Z }$ and $q _ { Z }$ .
64
+
65
+ # 1.2 MINIMIZING DISSIMILARITY BETWEEN $p _ { Z }$ AND $q _ { Z }$
66
+
67
+ If $q _ { Z }$ is a known distribution with an explicit formulation (e.g. Normal distribution) the most straightforward approach for measuring the (dis)similarity between $p _ { Z }$ and $q _ { Z }$ is the log-likelihood of $z = \phi ( x )$ with respect to $q _ { Z }$ , formally:
68
+
69
+ $$
70
+ s u p _ { \phi } \int _ { X } p _ { X } ( x ) l o g ( q _ { Z } ( \phi ( x ) ) ) d x
71
+ $$
72
+
73
+ maximizing the log-likelihood is equivalent to minimizing the KL-divergence between $p _ { Z }$ and $q _ { Z }$ , $D _ { K L } ( p _ { Z } , q _ { Z } )$ (see supplementary material for more details and derivation of Equation equation 5). This approach has two major limitations: 1) The KL-Divergence and in general $f$ -divergences do not provide meaningful dissimilarity measures for distributions supported on non-overlapping lowdimensional manifolds Arjovsky et al. (2017); Kolouri et al. (2018) (see supplementary material), which is common in hidden layers of neural networks, and therefore they do not provide informative gradients for training $\phi$ , and 2) we are limited to distributions $q _ { Z }$ that have known explicit formulations, which is restrictive as it eliminates the ability to use the much broader class of samplable distributions.
74
+
75
+ Various alternatives exist in the literature to address the above-mentioned limitations. These methods often sample $\tilde { \mathcal { Z } } \ = \ \{ \tilde { z } _ { j } \} _ { j = 1 } ^ { N }$ from $q _ { Z }$ and $\mathcal Z \ = \ \{ z _ { n } \ = \ \phi ( x _ { n } ) \} _ { n = 1 } ^ { N }$ from $p _ { X }$ and measure the discrepancy between these sets (i.e. point clouds). Note that there are no one-to-one correspondences between $\tilde { z } _ { j } \mathrm { s }$ and $z _ { n } \mathbf { S }$ . In their influential WAE paper, Tolstikhin et al. (2017) proposed two different approaches for measuring the discrepancy between $\tilde { \mathcal { Z } }$ and $\mathcal { Z }$ , namely the GAN-based and the maximum mean discrepancy (MMD)-based approaches. The GAN-based approach proposed in Tolstikhin et al. (2017) defines a discriminator network, $D _ { Z } ( p _ { Z } , q _ { Z } )$ , to classify $\tilde { z } _ { j } \mathrm { s }$ and $z _ { n } s$ as coming from ‘true’ and ‘fake’ distributions correspondingly, and proposes a min-max adversarial optimization for learning $\phi$ and $D _ { Z }$ . The MMD-based approach, utilizes a positive-definite reproducing kernel $k : Z \times Z \to \mathbb { R }$ to measure the discrepancy between $\tilde { \mathcal { Z } }$ and $\mathcal { Z }$ . The choice of the kernel and its parameterization, however, remain a data-dependent design parameter.
76
+
77
+ An interesting alternative approach is to use the Wasserstein distance between $p _ { Z }$ and $q _ { Z }$ . Following the work of Arjovsky et al. (2017), this can be accomplished utilizing the Kantorovich-Rubinstein duality and through introducing a min-max problem, which leads to yet another adversarial training scheme similar to the GAN-based method in Tolstikhin et al. (2017). Note that, since elements of $\tilde { \mathcal { Z } }$ and $\mathcal { Z }$ are not paired, an approach similar to equation 4 could not be used to minimize the discrepancy. In this paper, we propose to use the sliced-Wasserstein metric, Rabin & Peyré (2011); Rabin et al. (2011); Bonneel et al. (2015); Kolouri et al. (2016b); Carriere et al. (2017); Kolouri et al. (2018), to measure the discrepancy between $p _ { Z }$ and $q _ { Z }$ . We show that using the sliced-Wasserstein distance ameliorates the need for training an adversary network or choosing a data-dependent kernel (as in WAE-MMD), and provides an efficient, stable, and simple numerical implementation.
78
+
79
+ Before explaining our proposed approach, it is worthwhile to point out the major difference between learning auto-encoders as generative models and GANs. In GANs, one needs to minimize a distance between {ψ(˜zj )|z˜j ∼ qZ}Mj=1 and $\{ x _ { n } \} _ { n = 1 } ^ { M }$ , which are high-dimensional point clouds for which there are no correspondences between $\psi ( \tilde { z } _ { j } ) \mathrm { s }$ and $x _ { n } s$ . For the auto-encoders, on the other hand, there exists correspondences between the high-dimensional point clouds $\{ x _ { n } \} _ { n = 1 } ^ { M }$ and $\{ y _ { n } = \psi ( \phi ( x _ { n } ) ) \} _ { n = 1 } ^ { M }$ and the problem simplifies to matching the lower-dimensional point clouds $\{ { \bar { \phi } } ( x _ { n } ) \} _ { n = 1 } ^ { M }$ and $\{ \tilde { z } _ { j } \sim$ $q _ { Z } \} _ { j = 1 } ^ { M }$ . In other words, the encoder performs a nonlinear dimensionality reduction, that enables us to solve a simpler problem compared to GANs. Next we introduce the details of our approach.
80
+
81
+ # 2 PROPOSED METHOD
82
+
83
+ In what follows we first provide a brief review of the necessary equations to understand the Wasserstein and sliced-Wasserstein distances and then present our Sliced Wasserstein auto-encoder (SWAE).
84
+
85
+ # 2.1 WASSERSTEIN DISTANCES
86
+
87
+ The Wasserstein distance between probability measures $\rho _ { X }$ and $\rho _ { Y }$ , with corresponding densities $d \rho _ { X } = p _ { X } ( x ) d x$ and $d \rho _ { Y } = p _ { Y } ( y ) d y$ is defined as:
88
+
89
+ $$
90
+ W _ { c } ( p _ { X } , p _ { Y } ) = i n f _ { \gamma \in \Gamma ( \rho _ { X } , \rho _ { Y } ) } \int _ { X \times Y } c ( x , y ) d \gamma ( x , y )
91
+ $$
92
+
93
+ where $\Gamma ( \rho _ { X } , \rho _ { Y } )$ is the set of all transportation plans (i.e. joint measures) with marginal densities $p _ { X }$ and $p _ { Y }$ , and $c : X \times Y \to \mathbb { R } ^ { + }$ is the transportation cost. equation 6 is known as the Kantorovich formulation of the optimal mass transportation problem, which seeks the optimal transportation plan between $p _ { X }$ and $p _ { Y }$ . If there exist diffeomorphic mappings, $f : X \to Y$ (i.e. transport maps) such that $y = f ( x )$ and consequently,
94
+
95
+ $$
96
+ p _ { Y } ( y ) = \int _ { X } p _ { X } ( x ) \delta ( y - f ( x ) ) d x { \xrightarrow [ { \mathrm { ~ u i f f e o m o r p h i s m } } ] { \mathrm { W h e n ~ f ~ i s } } } ~ p _ { Y } ( y ) = d e t ( D f ^ { - 1 } ( y ) ) p _ { X } ( f ^ { - 1 } ( y ) )
97
+ $$
98
+
99
+ where $d e t ( D \cdot )$ is the determinant of the Jacobian, then the Wasserstein distance could be defined based on the Monge formulation of the problem (see Villani (2008) and Kolouri et al. (2017)) as:
100
+
101
+ $$
102
+ W _ { c } ( p _ { X } , p _ { Y } ) = m i n _ { f \in M P } \int _ { X } c ( x , f ( x ) ) d \rho _ { X } ( x )
103
+ $$
104
+
105
+ where $M P$ is the set of all diffeomorphisms that satisfy equation 7. As can be seen from equation 6 and equation 8, obtaining the Wasserstein distance requires solving an optimization problem. We note that various efficient optimization techniques have been proposed in the past (e.g. Cuturi (2013); Solomon et al. (2015); Oberman $\&$ Ruan (2015)) to solve this optimization. For one-dimensional probability densities, $p _ { X }$ and $p _ { Y }$ , however, the Wasserstein distance has a closed-form solution. Let $P _ { X }$ and $P _ { Y }$ be the cumulative distributions of one-dimensional probability distributions $p _ { X }$ and $p _ { Y }$ , correspondingly. The Wassertein distance can then be calculated as below (see Kolouri et al. (2017) for more details):
106
+
107
+ $$
108
+ W _ { c } ( p _ { X } , p _ { Y } ) = \int _ { 0 } ^ { 1 } c ( P _ { X } ^ { - 1 } ( \tau ) , P _ { Y } ^ { - 1 } ( \tau ) ) d \tau ,
109
+ $$
110
+
111
+ This closed-form solution motivates the definition of sliced-Wasserstein distances.
112
+
113
+ # 2.2 SLICED-WASSERSTEIN DISTANCES
114
+
115
+ Sliced-Wasserstein distance has similar qualitative properties to the Wasserstein distance, but it is much easier to compute. The sliced-Wasserstein distance was used in Rabin & Peyré (2011); Rabin et al. (2011) to calculate barycenter of distributions and point clouds. Bonneel et al. (2015) provided a nice theoretical overview of barycenteric calculations using the sliced-Wasserstein distance. Kolouri et al. (2016b) used it to define positive definite kernels for distributions and Carriere et al. (2017) to define a kernel for persistence diagrams. Sliced-Wasserstein was recently used for learning Gaussian mixture models in Kolouri et al. (2018), and it was also used as a measure of goodness of fit for GANs in Karras et al. (2017).
116
+
117
+ The main idea behind the sliced-Wasserstein distance is to slice (i.e., project) higher-dimensional probability densities into sets of one-dimensional marginal distributions and compare these marginal distributions via the Wasserstein distance. The slicing/projection process is related to the field of Integral Geometry and specifically the Radon transform (see Helgason (2011)). The relevant result to our discussion is that a d-dimensional probability density $p _ { X }$ can be uniquely represented as the set of its one-dimensional marginal distributions following the Radon transform and the Fourier slice theorem Helgason (2011). These one dimensional marginal distributions of $p _ { X }$ are defined as:
118
+
119
+ $$
120
+ \mathcal { R } p _ { X } ( t ; \theta ) = \int _ { X } p _ { X } ( x ) \delta ( t - \theta \cdot x ) d x , \forall \theta \in \mathbb { S } ^ { d - 1 } , \forall t \in \mathbb { R }
121
+ $$
122
+
123
+ where $\mathbb { S } ^ { d - 1 }$ is the $\mathrm { d }$ -dimensional unit sphere. Note that for any fixed $\theta \in \mathbb { S } ^ { d - 1 }$ , $\mathcal { R } p _ { X } ( \cdot ; \theta )$ is a one-dimensional slice of distribution $p _ { X }$ . In other words, $\mathcal { R } p _ { X } ( \cdot ; \theta )$ is a marginal distribution of $p _ { X }$
124
+
125
+ that is obtained from integrating $p _ { X }$ over the hyperplane orthogonal to $\theta$ .Utilizing these marginal distributions in equation 10, the sliced Wasserstein distance could be defined as:
126
+
127
+ $$
128
+ S W _ { c } ( p _ { X } , p _ { Y } ) = \int _ { \mathbb { S } ^ { d - 1 } } W _ { c } ( \mathscr { R } p _ { X } ( \cdot ; \theta ) , \mathscr { R } p _ { Y } ( \cdot ; \theta ) ) d \theta
129
+ $$
130
+
131
+ Given that $\mathcal { R } p _ { X } ( \cdot ; \theta )$ and $\mathcal { R } p _ { Y } ( \cdot ; \theta )$ are one-dimensional, the Wasserstein distance in the integrand has a closed-form solution (see equation 9). Moreover, it can be shown that $S W _ { c }$ is a true metric (Bonnotte (2013) and Kolouri et al. (2016a)), and it induces the same topology as $W _ { c }$ , at least on compact sets Santambrogio (2015). A natural transportation cost that has extensively studied in the past is the $\ell _ { 2 } ^ { 2 }$ , $c ( x , y ) { \overset { \cdot } { = } } \| x - y \| _ { 2 } ^ { 2 }$ , for which there are theoretical guarantees on existence and uniqueness of transportation plans and maps (see Santambrogio (2015) and Villani (2008)). When $c ( \bar { x , y } ) = \| x - y \| _ { p } ^ { p }$ for $p \geq 2$ , the following upper bound hold for the SW distance:
132
+
133
+ $$
134
+ S W _ { p } ^ { p } ( p _ { X } , p _ { Y } ) \leq \alpha _ { d , p } W _ { p } ^ { p } ( p _ { X } , p _ { Y } )
135
+ $$
136
+
137
+ where, $\begin{array} { r } { \alpha _ { d , p } = \frac { 1 } { d } \int _ { \mathbb { S } ^ { d - 1 } } \| \theta \| _ { p } ^ { p } d \theta \leq 1 } \end{array}$ . Chapter 5 in Bonnotte (2013) proves this inequality. In our paper, we are interested in $p = 2$ , for which $\begin{array} { r } { \alpha _ { p , d } = \frac { 1 } { d } } \end{array}$ , and we have:
138
+
139
+ $$
140
+ S W _ { 2 } ( p _ { X } , p _ { Y } ) \leq \frac { 1 } { \sqrt { d } } W _ { 2 } ( p _ { X } , p _ { Y } )
141
+ $$
142
+
143
+ In the Numerical Implementation Section, we provide a numerical experiment to compare $W _ { 2 }$ and $S W _ { 2 }$ , that confirms the above equation.
144
+
145
+ # 2.3 SLICED-WASSERSTEIN AUTO-ENCODER (SWAE)
146
+
147
+ Our proposed formulation for the SWAE is as follows:
148
+
149
+ $$
150
+ \begin{array} { r } { \operatorname * { a r g m i n } _ { \phi , \psi } W _ { c } ^ { \ddagger } ( p _ { X } , p _ { Y } ) + \lambda S W _ { c } ( p _ { Z } , q _ { Z } ) } \end{array}
151
+ $$
152
+
153
+ where $\phi$ is the encoder, $\psi$ is the decoder, $p _ { X }$ is the data distribution, $p _ { Y }$ is the data distribution after encoding and decoding ( equation 2), $p _ { Z }$ is the distribution of the encoded data ( equation 1), $q _ { Z }$ is a predefined samplable distribution, and $\lambda$ indicates the relative importance of the loss functions. To further clarify why we use the sliced-Wasserstein distance to measure the difference between $p _ { Z }$ and $q _ { Z }$ , we reiterate that due to the lack of correspondences between $\tilde { z } _ { i } \mathbf { s }$ and $z _ { j } \mathbf { s }$ , one cannot minimize the upper-bound in equation 4, and calculation of the Wasserstein distance requires an additional optimization step to obtain the optimal coupling between $p _ { Z }$ and $q _ { Z }$ . To avoid this additional optimization, while maintaining the favorable characteristics of the Wasserstein distance, we use the sliced-Wasserstein distance to measure the discrepancy between $p _ { Z }$ and $q _ { Z }$ .
154
+
155
+ # 3 NUMERICAL IMPLEMENTATION
156
+
157
+ We now describe the numerical details of our approach.
158
+
159
+ # 3.1 NUMERICAL IMPLEMENTATION OF THE WASSERSTEIN DISTANCE IN 1D
160
+
161
+ The Wasserstein distance between two one-dimensional probability densities $p _ { X }$ and $p _ { Y }$ is obtained from equation 9. The integral in equation 9 can be numerically estimated using the midpoint Riemann sum, $\begin{array} { r } { \frac { 1 } { M } \sum _ { m = 1 } ^ { M } a _ { m } } \end{array}$ , where $a _ { m } = c ( P _ { X } ^ { - 1 } ( \tau _ { m } ) , P _ { Y } ^ { - 1 } ( \tau _ { m } ) )$ and $\begin{array} { r } { \tau _ { m } = \frac { 2 m - 1 } { 2 M } } \end{array}$ (see Fig. 1). In scenarios re only samples from s can be estimated as $x _ { m } \sim p _ { X }$ $y _ { m } \sim p _ { Y }$ cal den-, where $\begin{array} { r } { p _ { X } \approx p _ { X , M } = \frac { 1 } { M } \sum _ { m = 1 } ^ { M } \delta _ { x _ { m } } } \end{array}$ $\begin{array} { r } { p _ { Y } \approx p _ { Y , M } = \frac { 1 } { M } \sum _ { m = 1 } ^ { M } \delta _ { y _ { m } } } \end{array}$ $\delta _ { x _ { m } }$ is the Dirac delta function centered at $x _ { m }$ . Therefore the corresponding empirical distribution function of $p _ { X }$ is $\begin{array} { r } { P _ { X } ( t ) \approx P _ { X , M } ( t ) = \frac { 1 } { M } \sum _ { m = 1 } ^ { M } u ( t - x _ { m } ) } \end{array}$ where $u ( . )$ is the step function $( P _ { Y , M } ( t )$ is defined similarly). From Glivenko-Cantelli Theorem we have that $\operatorname* { s u p } _ { t } | P _ { X , M } ( t ) - P _ { X } ( t ) | \xrightarrow { a . s . } 0 ,$ where the convergence behavior is achieved via Dvoretzky–Kiefer–Wolfowitz inequality bound: $\begin{array} { r } { P r o b ( \operatorname* { s u p } _ { t } | P _ { X , M } ( t ) - P _ { X } ( t ) | > \epsilon ) \leq 2 \exp \left( - 2 M \epsilon ^ { 2 } \right) . } \end{array}$ . Calculating the Wasserstein distance with the empirical distribution function is computationally attractive. Sorting $x _ { m } s$ in an ascending order, such that $x _ { i [ m ] } ~ \leq ~ x _ { i [ m + 1 ] }$ and where $i [ m ]$ is the index of the sorted $x _ { m } s$ , it is straightforward to see that $P _ { X , M } ^ { - 1 } ( \tau _ { m } ) = x _ { i [ m ] }$ (see Fig. 1 for a visualization). The Wasserstein distance can be approximated by first sorting $x _ { m } s$ and $y _ { m } \mathbf { s }$ and then calculating:
162
+
163
+ $$
164
+ W _ { c } ( p _ { X } , p _ { Y } ) \approxeq W _ { c } ( p _ { X , M } , p _ { Y , M } ) = \frac { 1 } { M } \sum _ { m = 1 } ^ { M } c ( x _ { i [ m ] } , y _ { j [ m ] } )
165
+ $$
166
+
167
+ ![](images/5266c6d524f16b39a9aff45907490862c89a563c87a0039addba6b3f53e17de0.jpg)
168
+ Figure 1: The Wasserstein distance for one-dimensional probability distributions $p _ { X }$ and $p _ { Y }$ (top left) is calculated based on equation 9. For a numerical implementation, the integral in equation 9 is substituted with 1 PMm= M 1 am where, am = c(P −1X (τm), P −1Y (τm)) (top right). When only samples from the distributions are available $x _ { n } \sim p _ { X }$ and $y _ { n } \sim Y$ (bottom left), the Wasserstein distance is approximated by sorting $x _ { m } s$ and $y _ { m } \mathbf { s }$ and letting $a _ { m } = c ( x _ { i [ m ] } , y _ { j [ m ] } )$ , where $i [ m ]$ and $j [ m ]$ are the sorted indices (bottom right).
169
+
170
+ The problem of calculating the Wasserstein distance between samples from one-dimensional densities simplifies to solving two sorting problems (solved in $\mathcal { O } ( M ) / \mathcal { O } ( \bar { M } l o g ( M ) )$ best/worst case).
171
+
172
+ We need to address one final question here. How well does equation 15 approximate the Wasserstein distance, $W _ { c } ( p _ { X } , p _ { Y } ) ?$ We first note that the rates of convergence of empirical distributions, for the $\boldsymbol { \mathrm { p } }$ -Wasserstein metric (i.e., $c ( x , y ) = | x - y | ^ { p } )$ of order $p \geq 1$ , have been extensively studied in the mathematics and statistics communities (see for instance Bobkov & Ledoux (2014) and Dedecker et al. (2015)). A detailed description of these rates is, however, beyond the scope of this paper, especially since these rates are dependent on the choice of $p$ . In short, for $p = 1$ it can be shown that E(W1(pX,M , pX ) ≤ √CM where $C$ is an absolute constant. Similar results are achieved for $\mathbb { E } ( W _ { p } ( p _ { X , M } , p _ { X } ) )$ and $( \mathbb { E } ( W _ { p } ^ { p } ( p _ { X , M } , p _ { X } ) ) ) ^ { \frac { 1 } { p } }$ , although under more strict assumptions on $p _ { X }$ (i.e., slightly stronger assumptions than having a finite second moment). Using the triangle inequality together with the convergence rates of empirical distributions with respect to the p-Wasserstein distance, see Bobkov $\&$ Ledoux (2014), for $W _ { 1 } ( p _ { X , M } , p _ { X } )$ (or more generally $W _ { p } ( p _ { X , M } , p _ { X } ) )$ ) we can show that (see supplementary material):
173
+
174
+ $$
175
+ \mathbb { E } ( W _ { 1 } ( p _ { X } , p _ { Y } ) - W _ { 1 } ( p _ { X , M } , p _ { Y , M } ) ) \leq \frac { C } { \sqrt { M } }
176
+ $$
177
+
178
+ for some absolute constant, $C$ . We reiterate that similar bounds could be found for $W _ { p }$ although with slightly more strict assumptions on $p _ { X }$ and $p _ { Y }$ .
179
+
180
+ # 3.2 SLICING EMPIRICAL DISTRIBUTIONS
181
+
182
+ In scenarios where only samples from the $\mathrm { d }$ -dimensional distribution, $p _ { X }$ , are available, $x _ { m } \sim p _ { X }$ , the empirical density can be estimated as $\begin{array} { r } { p _ { X , M } = \frac { 1 } { M } \sum _ { m = 1 } ^ { M } \delta _ { x _ { m } } } \end{array}$ . Following equation 10 it is straightforward to show that the marginal densities (i.e. slices) are obtained from:
183
+
184
+ $$
185
+ \mathcal { R } p _ { X } ( t , { \boldsymbol { \theta } } ) \approx \mathcal { R } p _ { X , M } ( t , { \boldsymbol { \theta } } ) = \frac { 1 } { M } \sum _ { m = 1 } ^ { M } \delta ( t - { \boldsymbol { x } } _ { m } \cdot { \boldsymbol { \theta } } ) , \ \forall { \boldsymbol { \theta } } \in \mathbb { S } ^ { d - 1 } , \mathrm { a n d } \ \forall t \in \mathbb { R }
186
+ $$
187
+
188
+ see the supplementary material for a proof. The Dvoretzky–Kiefer–Wolfowitz upper bound holds for $\mathcal { R } p _ { X } ( t , { \theta } )$ and $\mathcal { R } p _ { X , M } ( t , \theta )$ .
189
+
190
+ # 3.3 MINIMIZING SLICED-WASSERSTEIN VIA RANDOM SLICING
191
+
192
+ Minimizing the sliced-Wasserstein distance (i.e., as in the second term of 14) requires an integration over the unit sphere in $\mathbb { R } ^ { d }$ , i.e., $\mathbb { S } ^ { d - 1 }$ . In practice, this integration is approximated by using a simple Monte Carlo scheme that draws uniform samples from $\bar { \mathbb { S } } ^ { d - 1 }$ and replaces the integral with a
193
+
194
+ finite-sample average,
195
+
196
+ $$
197
+ S W _ { c } ( p _ { Z } , q _ { Z } ) \approx \frac { 1 } { | \Theta | } \sum _ { \theta _ { l } \in \Theta } W _ { c } ( \mathcal { R } p _ { Z } ( \cdot ; \theta _ { l } ) , \mathcal { R } q _ { Z } ( \cdot ; \theta _ { l } ) )
198
+ $$
199
+
200
+ Such Monte Carlo estimation was used in Rabin & Peyré (2011), and later used in Bonneel et al. (2015); Kolouri et al. (2018); ¸Sim¸sekli et al. (2018); Deshpande et al. (2018). Moreover, the global minimum for $S W _ { c } ( p _ { Z } , q _ { Z } )$ is also a global minimum for each $W _ { c } ( \mathcal { \bar { R } } p _ { Z } ( \cdot ; \theta _ { l } ) , \mathcal { R } q _ { Z } ( \cdot ; \theta _ { l } ) )$ . Note that $\begin{array} { r l r l } { S W _ { c } ( p z , q z ) } & { { } } & { = } & { { } } \end{array}$ $\mathbb { E } _ { \mathbb { S } ^ { ( d - 1 ) } } ( W _ { c } ( \mathcal { R } p _ { Z } ( \cdot ; \theta ) , \mathcal { R } q _ { Z } ( \cdot ; \theta ) ) )$ .
201
+
202
+ A fine sampling of $\mathbb { S } ^ { d - 1 }$ , however, is required for a good approximation of $S W _ { c } ( p _ { Z } , q _ { Z } )$ . Intuitively, if $p _ { Z }$ and $q _ { Z }$ are similar, then their projections with respect to any finite subset of $\mathbb { S } ^ { d - 1 }$ would also be similar. This
203
+
204
+ ![](images/4791d23632db7a215c95998c6fec92868ca448820cc5b847a1a81ad2422cc4e9.jpg)
205
+ Figure 2: SW approximations (scaled by $1 . 2 2 { \sqrt { d } } )$ of the Wdistance in different dimensions, $d \in \{ 2 ^ { \bar { n } } \} _ { n = 1 } ^ { 1 0 }$ , and different number of random slices, $L$ .
206
+
207
+ leads to a stochastic gradient descent scheme where in addition to the random sampling of the input data, we also random sample the projection angles from $\mathbb { S } ^ { d - 1 }$ .
208
+
209
+ A natural question arises on the effect of the number of random slices, $L = | \Theta |$ , on the approximation of the SW distance. Here, we devised a simple experiment that demonstrates the effect of $L$ on aa $d$ proximating the SW distan-dimensional space, where $d \in \{ 2 ^ { \overline { { n } } } \} _ { n = 1 } ^ { 1 0 }$ ted two ran, to serve as $p _ { X } = \mathcal { N } ( \mu _ { X } , \Sigma _ { X } )$ aussand $p _ { X } = \mathcal { N } ( \mu _ { Y } , \Sigma _ { Y } )$
210
+
211
+ $$
212
+ W _ { 2 } ^ { 2 } ( p _ { X } , p _ { Y } ) = \| \mu _ { X } - \mu _ { Y } \| _ { 2 } ^ { 2 } + t r a c e ( \Sigma _ { X } + \Sigma _ { Y } - 2 ( \Sigma _ { X } ^ { \frac { 1 } { 2 } } \Sigma _ { Y } \Sigma _ { X } ^ { \frac { 1 } { 2 } } ) ^ { \frac { 1 } { 2 } } ) ,
213
+ $$
214
+
215
+ which served as the ground-truth distance between the distributions. We then measured the SW distance between $M = 1 0 0 0$ samples generated from the two Gaussian distributions using $L \in$ $\{ 1 , 1 0 , 5 0 , 1 0 0 , 5 0 0 , 1 0 0 0 \}$ random slices. We repeated the experiment for each $L$ and $d$ , a thousand times and report the means and standard deviations in Figure 2. Following equation 13 we scaled the SW distance by $\sqrt { d }$ . Moreover we found out empirically that $1 . 2 2 \sqrt { d } \mathbb { E } ( S W _ { 2 } ( p _ { X , M } , p _ { Y , M } ) ) \approx$ $W _ { 2 } ( p _ { X } , p _ { Y } )$ . It can be seen from Figure 2 that the expected value of the scaled $S W$ -distance closely follows the true Wasserstein distance. A more interesting observation is that the variance of estimation increases for higher dimensions $d$ and decreases as the number of random projections, $L$ , increases. Hence, calculating the SW distance in the image space, as in Deshpande et al. (2018), requires a very large number of projections $L$ to get a less variant approximation of the distance.
216
+
217
+ # 3.4 PUTTING IT ALL TOGETHER
218
+
219
+ To optimize the proposed SWAE objective function in equation 14 we use a stochastic gradient m Xrandom samples from the input data and the predefined distribution, $\{ x _ { m } \sim p _ { X } \} _ { m = 1 } ^ { M }$ $q _ { Z }$ 1 m Z m=, correspondingly. Let $\{ \theta _ { l } \} _ { l = 1 } ^ { L }$ be i.i.d be randomly sampled from a uniform distribution on $\mathbb { S } ^ { d - 1 }$ . Then using the numerical approximations described in this section, the loss function in equation 14 can be rewritten as:
220
+
221
+ $$
222
+ \mathcal { L } ( \phi , \psi ) = \frac { 1 } { M } \sum _ { m = 1 } ^ { M } c ( x _ { m } , \psi ( \phi ( x _ { m } ) ) ) + \frac { \lambda } { L M } \sum _ { l = 1 } ^ { L } \sum _ { m = 1 } ^ { M } c ( \theta _ { l } \cdot \tilde { z } _ { i [ m ] } , \theta _ { l } \cdot \phi ( x _ { j [ m ] } ) )
223
+ $$
224
+
225
+ where $i [ m ]$ and $j [ m ]$ are the indices of sorted $\theta _ { l } { \cdot } \tilde { z } _ { m } s$ and $\theta _ { l } { \cdot } \phi ( x _ { m } )$ with respect to $m$ , correspondingly. The steps of our proposed method are presented in Algorithm 1. It is worth pointing out that sorting is by itself an optimization problem (which can be solved very efficiently), and therefore the sorting followed by the gradient descent update on $\phi$ and $\psi$ is in essence a min-max problem, which is being solved in an alternating fashion. Finally, we point out that each iteration of SWAE costs $\mathcal { O } ( \bar { L M l o g } ( M ) )$ operations.
226
+
227
+ # Algorithm 1 Sliced-Wasserstein Auto-Encoder (SWAE)
228
+
229
+ <table><tr><td>Require:Regularization coefficient 入,and number of random projections,L.</td></tr><tr><td>Initialize the parameters of the encoder,Φ,and decoder,</td></tr><tr><td>whileand have not converged do</td></tr><tr><td>Sample{x1,..,xm} from training set(i.e. px)</td></tr><tr><td>Sample{≥1,..,zm} fromqz</td></tr><tr><td>Sample {01,.,} from Sk-1</td></tr><tr><td>Sort0t·zM such that0t· i[m]≤0t·Zi[m+1]</td></tr><tr><td>Sort0t·Φ(xm) such that0t:Φ(xj[m])≤0t·(xj[m+1])</td></tr><tr><td>M</td></tr><tr><td>end while</td></tr></table>
230
+
231
+ # 4 EXPERIMENTS
232
+
233
+ In our experiments we used three image datasets, namely the MNIST dataset by LeCun (1998), the CelebFaces Attributes Dataset (CelebA) by Liu et al. (2015), and the LSUN Bedroom Dataset by Yu et al. (2015). For the MNIST dataset we used a simple auto-encoder with mirrored classic deep convolutional neural networks with 2D average poolings, leaky rectified linear units (Leaky-ReLu) as the activation functions, and upsampling layers in the decoder. For the CelebA and LSUN datasets we used the DCGAN Radford et al. (2015) architecture similar to Tolstikhin et al. (2017).
234
+
235
+ To test the capability of our proposed algorithm in shaping the latent space of the encoder, we started with the MNIST dataset and trained SWAE to encode this dataset to a two-dimensional latent space (for the sake of visualization) while enforcing a match between $p _ { X }$ and $p _ { Y }$ and $p _ { Z }$ and $q _ { Z }$ . We chose four different samplable distributions as shown in Figure 3. It can bee seen that SWAE can successfully embed the dataset into the latent space while enforcing $p _ { Z }$ to closely follow $q _ { Z }$ . In addition, we sample the two-dimensional latent spaces on a $2 5 \times 2 5$ grid in $[ - 1 , 1 ] ^ { 2 }$ and decode these points to visualize their corresponding images in the digit/image space.
236
+
237
+ To get a sense of the convergence behavior of SWAE, and similar to the work of Karras et al. (2017), we calculate the Sliced Wasserstein distance between $p _ { Z }$ and $q _ { Z }$ as well as $p _ { X }$ and $p _ { Y }$ at each batch iteration where we used p-LDA Wang et al. (2011) to calculate projections (See supplementary material). We compared the convergence behavior of SWAE with the closest related work, WAE Tolstikhin et al. (2017) (specifically WAE-GAN) where an adversarial training is used to match $p _ { Z }$ to $q _ { Z }$ , while the loss function for $p _ { X }$ and $p _ { Y }$ remains exactly the same between the two methods. We repeated the experiments 100 times and report the summary of results in Figure 4. We mention that the exact same models and optimizers were used for both methods in this experiment. An interesting observation, here is that while WAE-GAN provides good or even slightly better generated random samples for MNIST (lower sliced-Wasserstein distance between $p _ { X }$ and $p _ { Y . }$ ), it fails to provide a good match between $p _ { Z }$ and $q _ { Z }$ for the choice of the prior distribution reported in Figure 4. This phenomenon seems to be related to the mode-collapse problem of GANs, where the adversary fails to sense that the distribution is not fully covered. Finally, in our experiments we did not notice a significant difference between the computational time for SWAE and WAE-GAN. For the MNIST experiment and on a single NVIDIA Tesla $P 1 0 0$ GPU, each batch iteration (batchsize $\mathord { \vert \kern - delimiterspace } = 5 0 0$ ) of WAEGAN took $0 . 2 5 7 1 \pm 0 . 0 4 3 5 ( \mathrm { s e c } )$ while SWAE (with $L = 5 0$ projections) took $0 . 2 4 3 7 \pm 0 . 0 3 9 1 ( \mathrm { s e c } )$ .
238
+
239
+ ![](images/5e6be26c96cabd0608fd6f39cef37b2fc4837e00b2cd17230bf952c95cf5db93.jpg)
240
+ Figure 5: Interpolation in the latent space, $\psi ( t \phi ( I _ { 0 } ) + ( 1 - t ) \phi ( I _ { 1 } ) )$ for $t \in [ 0 , 1 ]$ .
241
+
242
+ <table><tr><td rowspan=1 colspan=1>Dataset</td><td rowspan=1 colspan=1>Iteration ·10-4</td><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=1>logSW(pz,qz)</td><td rowspan=1 colspan=1>logSW(px,Py)</td><td rowspan=1 colspan=1>NLL(Z|qz)·10</td></tr><tr><td rowspan=12 colspan=1>CelebA</td><td rowspan=4 colspan=1>1</td><td rowspan=1 colspan=1>SWAE</td><td rowspan=1 colspan=1>-0.81±0.05</td><td rowspan=1 colspan=1>-2.19±0.04</td><td rowspan=1 colspan=1>3.14±0.05</td></tr><tr><td rowspan=1 colspan=1>WAE-GAN</td><td rowspan=1 colspan=1>-0.78 ± 0.05</td><td rowspan=1 colspan=1>-2.04±0.05</td><td rowspan=1 colspan=1>3.25 ± 0.15</td></tr><tr><td rowspan=1 colspan=1>WAE-MMD(IMQ)</td><td rowspan=1 colspan=1>-1.44± 0.19</td><td rowspan=1 colspan=1>-2.51 ± 0.05</td><td rowspan=1 colspan=1>3.66±0.12</td></tr><tr><td rowspan=1 colspan=1>WAE-MMD(RBF)</td><td rowspan=1 colspan=1>3.26±0.02</td><td rowspan=1 colspan=1>-2.60±0.02</td><td rowspan=1 colspan=1>2392±89</td></tr><tr><td rowspan=4 colspan=1>5</td><td rowspan=1 colspan=1>SWAE</td><td rowspan=1 colspan=1>-1.80 ±0.03</td><td rowspan=1 colspan=1>-2.63±0.03</td><td rowspan=1 colspan=1>3.22±0.02</td></tr><tr><td rowspan=1 colspan=1>WAE-GAN</td><td rowspan=1 colspan=1>-1.37±0.12</td><td rowspan=1 colspan=1>-2.42±0.05</td><td rowspan=1 colspan=1>3.47±0.13</td></tr><tr><td rowspan=1 colspan=1>WAE-MMD(IMQ)</td><td rowspan=1 colspan=1>-2.15 ±0.02</td><td rowspan=1 colspan=1>-2.86±0.01</td><td rowspan=1 colspan=1>3.51± 0.04</td></tr><tr><td rowspan=1 colspan=1>WAE-MMD(RBF)</td><td rowspan=1 colspan=1>3.28±0.02</td><td rowspan=1 colspan=1>-2.89±0.02</td><td rowspan=1 colspan=1>2469±79</td></tr><tr><td rowspan=4 colspan=1>10</td><td rowspan=1 colspan=1>SWAE</td><td rowspan=1 colspan=1>-2.01 ±0.04</td><td rowspan=1 colspan=1>-2.75 ±0.03</td><td rowspan=1 colspan=1>3.24 ±0.00</td></tr><tr><td rowspan=1 colspan=1>WAE-GAN</td><td rowspan=1 colspan=1>-2.33±0.14</td><td rowspan=1 colspan=1>-2.55 ± 0.06</td><td rowspan=1 colspan=1>3.42 ± 0.04</td></tr><tr><td rowspan=1 colspan=1>WAE-MMD(IMQ)</td><td rowspan=1 colspan=1>-2.23±0.00</td><td rowspan=1 colspan=1>-2.97±0.01</td><td rowspan=1 colspan=1>3.50± 0.01</td></tr><tr><td rowspan=1 colspan=1>WAE-MMD(RBF)</td><td rowspan=1 colspan=1>3.23±0.02</td><td rowspan=1 colspan=1>-2.99±0.02</td><td rowspan=1 colspan=1>2227±88</td></tr><tr><td rowspan=12 colspan=1>LSUNBedroom</td><td rowspan=4 colspan=1>1</td><td rowspan=1 colspan=1>SWAE</td><td rowspan=1 colspan=1>-0.98 ± 0.17</td><td rowspan=1 colspan=1>-1.88 ±0.06</td><td rowspan=1 colspan=1>3.12 ±0.07</td></tr><tr><td rowspan=1 colspan=1>WAE-GAN</td><td rowspan=1 colspan=1>-1.18 ± 0.16</td><td rowspan=1 colspan=1>-1.90±0.07</td><td rowspan=1 colspan=1>3.31±0.16</td></tr><tr><td rowspan=1 colspan=1>WAE-MMD(IMQ)</td><td rowspan=1 colspan=1>-1.72 ±0.07</td><td rowspan=1 colspan=1>-2.13±0.02</td><td rowspan=1 colspan=1>3.61 ±0.04</td></tr><tr><td rowspan=1 colspan=1>WAE-MMD(RBF)</td><td rowspan=1 colspan=1>3.45± 0.02</td><td rowspan=1 colspan=1>-2.16±0.04</td><td rowspan=1 colspan=1>3446±152</td></tr><tr><td rowspan=4 colspan=1>5</td><td rowspan=1 colspan=1>SWAE</td><td rowspan=1 colspan=1>-1.94 ± 0.12</td><td rowspan=1 colspan=1>-2.34 ±0.04</td><td rowspan=1 colspan=1>3.22 ±0.02</td></tr><tr><td rowspan=1 colspan=1>WAE-GAN</td><td rowspan=1 colspan=1>-2.34 ± 0.04</td><td rowspan=1 colspan=1>-2.30 ± 0.04</td><td rowspan=1 colspan=1>3.40±0.08</td></tr><tr><td rowspan=1 colspan=1>WAE-MMD(IMQ)</td><td rowspan=1 colspan=1>-2.21 ±0.02</td><td rowspan=1 colspan=1>-2.47±0.02</td><td rowspan=1 colspan=1>3.48±0.04</td></tr><tr><td rowspan=1 colspan=1>WAE-MMD(RBF)</td><td rowspan=1 colspan=1>3.53±0.03</td><td rowspan=1 colspan=1>-2.47±0.02</td><td rowspan=1 colspan=1>4009±258</td></tr><tr><td rowspan=4 colspan=1>10</td><td rowspan=1 colspan=1>SWAE</td><td rowspan=1 colspan=1>-2.08 ±0.11</td><td rowspan=1 colspan=1>-2.46±0.03</td><td rowspan=1 colspan=1>3.23±0.01</td></tr><tr><td rowspan=1 colspan=1>WAE-GAN</td><td rowspan=1 colspan=1>-2.49±0.02</td><td rowspan=1 colspan=1>-2.41±0.03</td><td rowspan=1 colspan=1>3.35± 0.05</td></tr><tr><td rowspan=1 colspan=1>WAE-MMD(IMQ)</td><td rowspan=1 colspan=1>-2.25±0.02</td><td rowspan=1 colspan=1>-2.59±0.02</td><td rowspan=1 colspan=1>3.50±0.01</td></tr><tr><td rowspan=1 colspan=1>WAE-MMD(RBF)</td><td rowspan=1 colspan=1>3.48± 0.04</td><td rowspan=1 colspan=1>-2.60±0.02</td><td rowspan=1 colspan=1>3624±282</td></tr></table>
243
+
244
+ Table 1: Quantitative comparison of the SWAE and WAE-GAN using the sliced-Wasserstein distance with discriminant slices in the latent space, $S W ( p _ { Z } , q _ { Z } )$ , and the output space, $S W ( p _ { X } , p _ { Y } )$ . The distribution in the 64-dimensional latent space, $q _ { Z }$ , was set to Normal. We also report the negative log-likelihood of $\{ z _ { i } = \phi ( x _ { i } ) \}$ with repect to $q _ { Z }$ for 1000 testing samples for both datasets. We did not use Nowizin’s trick for the GAN models.
245
+
246
+ Table 2: FID score statistics $N = 5$ ) at final iteration of training. Lower is better. Scores were computed with $1 0 ^ { 4 }$ random samples from the testing set against an equivalent amount of generated samples.
247
+
248
+ <table><tr><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=1>FID -CelebA</td><td rowspan=1 colspan=1>FID -LSUN Bedroom</td></tr><tr><td rowspan=1 colspan=1>SWAE</td><td rowspan=1 colspan=1>79±6</td><td rowspan=1 colspan=1>225±7</td></tr><tr><td rowspan=1 colspan=1>WAE-GAN</td><td rowspan=1 colspan=1>53±2</td><td rowspan=1 colspan=1>232±2</td></tr><tr><td rowspan=1 colspan=1>WAE-MMD(IMQ)</td><td rowspan=1 colspan=1>55±1</td><td rowspan=1 colspan=1>226±2</td></tr><tr><td rowspan=1 colspan=1>WAE-MMD(RBF)</td><td rowspan=1 colspan=1>363±17</td><td rowspan=1 colspan=1>378±12</td></tr><tr><td rowspan=1 colspan=1>True Data</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>3</td></tr></table>
249
+
250
+ The CelebA face and the LSUN bedroom datasets contain higher degrees of variations compared to the MNIST dataset and therefore a two-dimensional latent-space does not suffice to capture the variations in these datasets (See supplementary material for more details on the dimensionality of the latent space). We used a $K = 6 4$ dimensional latent spaces for both the CelebA and the LSUN Bedroom datasets, and also used a larger auto-encoder (i.e., DCGAN, following the work of Tolstikhin et al. (2017)). For these datasets SWAE was trained with $q _ { Z }$ being the Normal distribution to enable the calculation of the negative log likelihood (NLL). Table 1 shows the comparison between SWAE and WAE for these two datasets. We note that all experimental parameters were kept the same to enable an apples to apples comparison. Finally, Figure 5 demonstrates the interpolation between two sample points in the latent space, i.e. ${ \psi } ( t \dot { \phi } ( { I _ { 0 } } ) { ^ { - } } + ( 1 - t ) { \phi } ( { I _ { 1 } } ) )$ for $t \in [ 0 , 1 ]$ , for all three datasets.
251
+
252
+ # 5 CONCLUSIONS
253
+
254
+ We introduced Sliced Wasserstein auto-encoders (SWAE), which enable one to shape the distribution of the encoded samples to any samplable distribution without the need for adversarial training or having a likelihood function specified. In addition, we provided a simple and efficient numerical scheme for this problem, which only relies on few inner products and sorting operations in each SGD iteration. We further demonstrated the capability of our method on three image datasets, namely the MNIST, the CelebA face, and the LSUN Bedroom datasets, and showed competitive performance, in the sense of matching distributions $p _ { Z }$ and $q _ { Z }$ , to the techniques that rely on additional adversarial trainings. Finally, we envision SWAE could be effectively used in transfer learning and domain adaptation algorithms where $q _ { Z }$ comes from a source domain and the task is to encode the target domain $p _ { X }$ in a latent space such that the distribution follows the distribution of the target domain.
255
+
256
+ ![](images/83d849c7d4eb0f5c273451749259784eef2e09c60311c78f5f1f6fde8711cec3.jpg)
257
+ Figure 3: The results of SWAE on the MNIST dataset with a two-dimensional embedding space for four different distributions as , ${ \mathbf { } } q z$ , namely the ring distribution (top left), the uniform distribution (bottom left), the uniform polar distribution (top right), and a custom polar distribution (bottom right). Note that the far right visualization demonstrates the decoding of a $2 5 \times 2 5$ grid in $[ - 1 , 1 ] ^ { 2 }$ .
258
+
259
+ ![](images/7eab4cbd0a8c3976ee387c8ca0f96c8945d861e231d3c994e1935215bb160160.jpg)
260
+ Figure 4: Sample convergence behavior for our method compared to the WAE-GAN, where $q _ { Z }$ is set to a ring distribution (Figure 3, top left). The columns represent batch iterations (batchsize $= 5 0 0$ ). The top half of the table shows results of $\psi ( z )$ for $z \sim q _ { Z }$ , and the bottom half shows $z \sim q _ { Z }$ and $\phi ( x )$ for $x \sim p _ { X }$ . It can be seen that the adversarial loss in the latent space does not provide a full coverage of the distribution, which is a similar problem to the well-known ‘mode collapse’ problem in the GANs. It can be seen that SWAE provides a superior match between $p _ { Z }$ and $q _ { Z }$ while it does not require adversarial training.
261
+
262
+ # REFERENCES
263
+
264
+ Martin Arjovsky, Soumith Chintala, and Léon Bottou. Wasserstein GAN. arXiv preprint arXiv:1701.07875, 2017.
265
+
266
+ David Berthelot, Tom Schumm, and Luke Metz. Began: Boundary equilibrium generative adversarial networks. arXiv preprint arXiv:1703.10717, 2017.
267
+
268
+ Sergey Bobkov and Michel Ledoux. One-dimensional empirical measures, order statistics and kantorovich transport distances. preprint, 2014.
269
+
270
+ Nicolas Bonneel, Julien Rabin, Gabriel Peyré, and Hanspeter Pfister. Sliced and Radon Wasserstein barycenters of measures. Journal of Mathematical Imaging and Vision, 51(1):22–45, 2015.
271
+
272
+ Nicolas Bonnotte. Unidimensional and evolution methods for optimal transportation. PhD thesis, Paris 11, 2013.
273
+
274
+ Olivier Bousquet, Sylvain Gelly, Ilya Tolstikhin, Carl-Johann Simon-Gabriel, and Bernhard Schoelkopf. From optimal transport to generative modeling: the VEGAN cookbook. arXiv preprint arXiv:1705.07642, 2017.
275
+
276
+ Mathieu Carriere, Marco Cuturi, and Steve Oudot. Sliced wasserstein kernel for persistence diagrams. arXiv preprint arXiv:1706.03358, 2017.
277
+
278
+ Antonia Creswell and Anil Anthony Bharath. Adversarial training for sketch retrieval. In European Conference on Computer Vision, pp. 798–809. Springer, 2016.
279
+
280
+ Marco Cuturi. Sinkhorn distances: Lightspeed computation of optimal transport. In Advances in neural information processing systems, pp. 2292–2300, 2013.
281
+
282
+ Jérôme Dedecker, Aurélie Fischer, Bertrand Michel, et al. Improved rates for wasserstein deconvolution with ordinary smooth error in dimension one. Electronic journal of statistics, 9(1):234–265, 2015.
283
+
284
+ Ishan Deshpande, Ziyu Zhang, and Alexander Schwing. Generative modeling using the sliced wasserstein distance. In IEEE Conference on Computer Vision and Pattern Recognition, 2018.
285
+
286
+ Charlie Frogner, Chiyuan Zhang, Hossein Mobahi, Mauricio Araya, and Tomaso A Poggio. Learning with a wasserstein loss. In Advances in Neural Information Processing Systems, pp. 2053–2061, 2015.
287
+
288
+ Daniel T Gillespie. A theorem for physicists in the theory of random variables. American Journal of Physics, 51(6):520–533, 1983.
289
+
290
+ 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.
291
+
292
+ Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, Vincent Dumoulin, and Aaron C Courville. Improved training of wasserstein gans. In Advances in Neural Information Processing Systems, pp. 5769–5779, 2017.
293
+
294
+ Sigurdur Helgason. The radon transform on rn. In Integral Geometry and Radon Transforms, pp. 1–62. Springer, 2011.
295
+
296
+ Phillip Isola, Jun-Yan Zhu, Tinghui Zhou, and Alexei A Efros. Image-to-image translation with conditional adversarial networks. arXiv preprint, 2017.
297
+
298
+ Tero Karras, Timo Aila, Samuli Laine, and Jaakko Lehtinen. Progressive growing of gans for improved quality, stability, and variation. arXiv preprint arXiv:1710.10196, 2017.
299
+
300
+ Diederik $\mathrm { \bf P }$ Kingma and Max Welling. Auto-encoding variational Bayes. arXiv preprint arXiv:1312.6114, 2013.
301
+
302
+ Soheil Kolouri and Gustavo K Rohde. Transport-based single frame super resolution of very low resolution face images. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4876–4884, 2015.
303
+
304
+ Soheil Kolouri, Se Rim Park, and Gustavo K Rohde. The radon cumulative distribution transform and its application to image classification. IEEE transactions on image processing, 25(2):920–934, 2016a.
305
+
306
+ Soheil Kolouri, Yang Zou, and Gustavo K Rohde. Sliced Wasserstein kernels for probability distributions. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5258–5267, 2016b.
307
+
308
+ Soheil Kolouri, Se Rim Park, Matthew Thorpe, Dejan Slepcev, and Gustavo K Rohde. Optimal mass transport: Signal processing and machine-learning applications. IEEE Signal Processing Magazine, 34(4):43–59, 2017.
309
+
310
+ Soheil Kolouri, Gustavo K Rohde, and Heiko Hoffman. Sliced Wasserstein distance for learning Gaussian mixture models. In IEEE Conference on Computer Vision and Pattern Recognition, pp. 3427–, 2018.
311
+
312
+ Yann LeCun. The mnist database of handwritten digits. http://yann. lecun. com/exdb/mnist/, 1998.
313
+
314
+ Christian Ledig, Lucas Theis, Ferenc Huszár, Jose Caballero, Andrew Cunningham, Alejandro Acosta, Andrew Aitken, Alykhan Tejani, Johannes Totz, Zehan Wang, et al. Photo-realistic single image super-resolution using a generative adversarial network. arXiv preprint, 2016.
315
+
316
+ 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), December 2015.
317
+
318
+ Alireza Makhzani, Jonathon Shlens, Navdeep Jaitly, Ian Goodfellow, and Brendan Frey. Adversarial autoencoders. arXiv preprint arXiv:1511.05644, 2015.
319
+
320
+ Lars Mescheder, Sebastian Nowozin, and Andreas Geiger. Adversarial variational Bayes: Unifying variational autoencoders and generative adversarial networks. arXiv preprint arXiv:1701.04722, 2017.
321
+
322
+ Zak Murez, Soheil Kolouri, David Kriegman, Ravi Ramamoorthi, and Kyungnam Kim. Image to image translation for domain adaptation. In IEEE Conference on Computer Vision and Pattern Recognition, pp. 4500–4509, 2018.
323
+
324
+ 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.
325
+
326
+ Adam M Oberman and Yuanlong Ruan. An efficient linear programming method for optimal transportation. arXiv preprint arXiv:1509.03668, 2015.
327
+
328
+ Julien Rabin and Gabriel Peyré. Wasserstein regularization of imaging problem. In Image Processing (ICIP), 2011 18th IEEE International Conference on, pp. 1541–1544. IEEE, 2011.
329
+
330
+ Julien Rabin, Gabriel Peyré, Julie Delon, and Marc Bernot. Wasserstein barycenter and its application to texture mixing. In International Conference on Scale Space and Variational Methods in Computer Vision, pp. 435–446. Springer, 2011.
331
+
332
+ Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. arXiv preprint arXiv:1511.06434, 2015.
333
+
334
+ Filippo Santambrogio. Optimal transport for applied mathematicians. Birkäuser, NY, pp. 99–102, 2015.
335
+
336
+ Umut ¸Sim¸sekli, Antoine Liutkus, Szymon Majewski, and Alain Durmus. Sliced-wasserstein flows: Nonparametric generative modeling via optimal transport and diffusions. arXiv preprint arXiv:1806.08141, 2018.
337
+
338
+ Justin Solomon, Fernando De Goes, Gabriel Peyré, Marco Cuturi, Adrian Butscher, Andy Nguyen, Tao Du, and Leonidas Guibas. Convolutional wasserstein distances: Efficient optimal transportation on geometric domains. ACM Transactions on Graphics (TOG), 34(4):66, 2015.
339
+
340
+ Ilya Tolstikhin, Olivier Bousquet, Sylvain Gelly, and Bernhard Schoelkopf. Wasserstein auto-encoders. arXiv preprint arXiv:1711.01558, 2017.
341
+
342
+ Cédric Villani. Optimal transport: old and new, volume 338. Springer Science & Business Media, 2008.
343
+
344
+ Wei Wang, Yilin Mo, John A Ozolek, and Gustavo K Rohde. Penalized fisher discriminant analysis and its application to image-based morphometry. Pattern recognition letters, 32(15):2128–2135, 2011.
345
+
346
+ Raymond A Yeh, Chen Chen, Teck Yian Lim, Alexander G Schwing, Mark Hasegawa-Johnson, and Minh N Do. Semantic image inpainting with deep generative models. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5485–5493, 2017.
347
+
348
+ Fisher Yu, Yinda Zhang, Shuran Song, Ari Seff, and Jianxiong Xiao. Lsun: Construction of a largescale image dataset using deep learning with humans in the loop. arXiv preprint arXiv:1506.03365, 2015.
349
+
350
+ ![](images/e9428ba370cc5219cf8e6d29473c139346dc06ab2c48d3fe482c8f9706f24ef4.jpg)
351
+ Figure 6: These plots show $W _ { 1 } ( p , q _ { \tau } )$ and $J S ( p , q _ { \tau } )$ where $p$ is a uniform distribution around zero and $\boldsymbol { q } _ { \ u { \tau } } ( \boldsymbol { x } ) = \boldsymbol { p } ( \boldsymbol { x } - \boldsymbol { \tau } )$ . It is clear that JS divergence does not provide a usable gradient when distributions are supported on non-overlapping domains.
352
+
353
+ # SUPPLEMENTARY MATERIAL
354
+
355
+ COMPARISON OF DIFFERENT DISTANCES
356
+
357
+ Following the example by Arjovsky et al. (2017) and later Kolouri et al. (2018) here we show a simple example comparing the Jensen-Shannon divergence with the Wasserstein distance. First note that the Jensen-Shannon divergence is defined as,
358
+
359
+ $$
360
+ J S ( p , q ) = K L ( p , { \frac { p + q } { 2 } } ) + K L ( q , { \frac { p + q } { 2 } } )
361
+ $$
362
+
363
+ where $\begin{array} { r } { K L ( p , q ) = \int _ { X } p ( x ) l o g ( \frac { p ( x ) } { q ( x ) } ) d x } \end{array}$ is the Kullback-Leibler divergence. Now consider the following densities, $p ( x )$ be a uniform distribution around zero and let $\begin{array} { r } { q _ { \tau } ( x ) = p ( x - \tau ) } \end{array}$ be a shifted version of the $p$ . Figure 6 show $W _ { 1 } ( p , q _ { \tau } )$ and $J S ( p , q _ { \tau } )$ as a function of $\tau$ . As can be seen the JS divergence fails to provide a useful gradient when the distributions are supported on non-overlapping domains.
364
+
365
+ # LOG-LIKELIHOOD
366
+
367
+ To maximize (minimize) the similarity (dissimilarity) between $p _ { Z }$ and $q _ { Z }$ , we can write :
368
+
369
+ $$
370
+ \begin{array} { r c l } { { \mathrm { a r g m a x } _ { \phi } \displaystyle \int _ { Z } p _ { Z } ( z ) l o g ( q _ { Z } ( z ) ) d z } } & { { = } } & { { \displaystyle \int _ { Z } \int _ { X } p _ { X } ( x ) \delta ( z - \phi ( x ) ) l o g ( q _ { Z } ( z ) ) d x d z } } \\ { { } } & { { = } } & { { \displaystyle \int _ { X } p _ { X } ( x ) l o g ( q _ { Z } ( \phi ( x ) ) ) d x } } \end{array}
371
+ $$
372
+
373
+ where we replaced $p _ { Z }$ with equation 1. Furthermore, it is straightforward to show:
374
+
375
+ $$
376
+ \begin{array} { l l l } { { \mathrm { a r g m a x } _ { \phi } \displaystyle \int _ { Z } p _ { Z } ( z ) l o g ( q _ { Z } ( z ) ) d z } } & { { = } } & { { \mathrm { a r g m a x } _ { \phi } \displaystyle \int _ { Z } p _ { Z } ( z ) l o g ( \frac { q _ { Z } ( z ) } { p _ { Z } ( z ) } ) d z } } \\ { { } } & { { = } } & { { \mathrm { a r g m i n } _ { \phi } D _ { K L } ( p _ { Z } , q _ { Z } ) } } \end{array}
377
+ $$
378
+
379
+ PROOF OF EQUATION 3
380
+
381
+ The Wasserstein distance between the two probability measures $\rho _ { X }$ and $\rho _ { Y }$ with respective densities $p _ { X }$ and $p _ { Y }$ , can be measured via the Kantorovich formulation of the optimal mass transport problem:
382
+
383
+ $$
384
+ W _ { c } ( p _ { X } , p _ { Y } ) = \operatorname* { i n f } _ { \gamma \in \Gamma } \int _ { X } \int _ { Y } c ( x , y ) \gamma ( x , y ) d x d y
385
+ $$
386
+
387
+ where $\Gamma : = \{ \gamma : X \times Y \to \mathbb { R } ^ { + } | \int _ { Y } \gamma ( x , y ) d y = p _ { X } ( x ) , \int _ { X } \gamma ( x , y ) d x = p _ { Y } ( y ) \}$ is the set of all transportation plans (i.e., couplings or joint distributions) over $p _ { X }$ and $p _ { Y }$ . Now, note that the two step process of encoding $p _ { X }$ into the latent space $Z$ and decoding it to $p _ { Y }$ , provides a unique decomposition of $\gamma$ as $\gamma _ { 0 } ( x , y ) = \delta ( y - \psi ( \phi ( x ) ) ) p _ { X } ( x ) \in \Gamma$ .
388
+
389
+ ![](images/0c587a98a9b2ba0e4e04d80ae51d93adaa98cb6b82f1bdfe164cbcfdc362fb10.jpg)
390
+ Figure 7: The optimal coupling (i.e., transport plan) between $p _ { X }$ and $p _ { Y }$ could be equal or different from $\gamma ( x , y ) = \bar { \delta } ( y - \psi ( \phi ( x ) ) ) p _ { X } ( x )$ . This leads to the scenario on the right where $\bar { W _ { c } } ( p _ { X } , p _ { Y } ) = 0$ but $W _ { c } ^ { \ddagger } ( p _ { X } , p _ { Y } ) > 0$ .
391
+
392
+ Therefore we can write:
393
+
394
+ $$
395
+ \begin{array} { l } { \displaystyle { W _ { c } ( p _ { X } , p _ { Y } ) = \operatorname* { i n f } _ { \gamma \in \Gamma } \int _ { X } \int _ { Y } c ( x , y ) \gamma ( x , y ) d x d y \le } } \\ { \displaystyle { W _ { c } ^ { \dagger } ( p _ { X } , p _ { Y } ) : = \int _ { X } \int _ { Y } c ( x , y ) \gamma _ { 0 } ( x , y ) d x d y = \int _ { X } c ( x , \psi ( \phi ( x ) ) ) p _ { X } ( x ) d x } } \end{array}
396
+ $$
397
+
398
+ which proves equation 3. Finally, taking the infimum of the two sides of the inequality, with respect to $\phi$ and $\psi$ , we have:
399
+
400
+ $$
401
+ \begin{array} { l } { { \operatorname* { i n f } _ { \psi , \phi } W _ { c } ( p _ { X } , p _ { Y } ) = \operatorname* { i n f } _ { \psi , \phi } \operatorname* { i n f } _ { \gamma \in \Gamma _ { \psi , \phi } } \displaystyle \int _ { X } \int _ { Y } c ( x , y ) \gamma ( x , y ) d x d y \le } } \\ { { \operatorname* { i n f } _ { \psi , \phi } W _ { c } ^ { \dagger } ( p _ { X } , p _ { Y } ) = \operatorname* { i n f } _ { \psi , \phi } \displaystyle \int _ { X } c ( x , \psi ( \phi ( x ) ) ) p _ { X } ( x ) d x } } \end{array}
402
+ $$
403
+
404
+ where $\begin{array} { r } { \Gamma _ { \psi , \phi } : = \{ \gamma | \int _ { Y } \gamma ( x , y ) d y = p _ { X } ( x ) , \int _ { X } \gamma ( x , y ) d x = \int _ { X } p _ { X } ( x ) \delta ( y - \psi ( \phi ( x ) ) ) d x \} } \end{array}$ . Figure 7 demonstrates a simple scenario were the Wasserstein distance, $W _ { c } ( p _ { X } , p _ { Y } )$ , is zero however, $W _ { c } ^ { \ddagger } ( p _ { X } , p _ { Y } )$ is non-zero. Finally, we note that $\psi ( \phi ( \cdot ) ) = i d ( \cdot )$ is a global optima for both $W _ { c } ( p _ { X } , p _ { Y } )$ and $W _ { c } ^ { \ddagger } ( p _ { X } , p _ { Y } )$ .
405
+
406
+ # SLICING EMPIRICAL DISTRIBUTIONS
407
+
408
+ Following equation 10 a distribution can be sliced via:
409
+
410
+ $$
411
+ \mathcal { R } p _ { X } ( t , \theta ) = \int _ { X } p _ { X } ( x ) \delta ( t - \theta \cdot x ) d x
412
+ $$
413
+
414
+ Figure 8 visualizes two sample slices for an example distribution $p _ { X }$ . Here we calculate a Radon slice of the empirical distribution $\begin{array} { r } { p _ { X } ( x ) = \frac { 1 } { M } \sum _ { m = 1 } ^ { M } \delta ( x - x _ { m } ) } \end{array}$ with respect to $\theta \in \mathbb { S } ^ { d - 1 }$ . Using the definition of the Radon transform in equation 10 and RVT in equation 1 we have:
415
+
416
+ $$
417
+ \begin{array} { l l l } { \mathcal { R } p _ { X } ( t , { \boldsymbol { \theta } } ) } & { = } & { \displaystyle \frac { 1 } { M } \sum _ { m = 1 } ^ { M } \int _ { X } \delta ( { \boldsymbol { x } } - { \boldsymbol { x } } _ { m } ) \delta ( t - { \boldsymbol { \theta } } \cdot { \boldsymbol { x } } ) d { \boldsymbol { x } } } \\ & { = } & { \displaystyle \frac { 1 } { M } \sum _ { m = 1 } ^ { M } \delta ( { \boldsymbol { t } } - { \boldsymbol { \theta } } \cdot { \boldsymbol { x } } _ { m } ) } \end{array}
418
+ $$
419
+
420
+ ![](images/429e9c7831d7ecd943a497fd42137f225d184cf1748e87ec9f6729e01c6451ac.jpg)
421
+ Figure 8: Visualization of the slicing process defined in equation 10
422
+
423
+ ![](images/cabb5ea4b36339a1b5f58e3275886572765e8b0417c6e3618bbf41996510b3f6.jpg)
424
+ Figure 9: Trained SWAE outputs for sample input images with different embedding spaces of size $K = 2$ and $K = 1 2 8$ .
425
+
426
+ DIMENSIONALITY OF THE LATENT SPACE
427
+
428
+ Figure 9 demonstrates the outputs of trained SWAEs with $K = 2$ and $K = 1 2 8$ for sample input images. The input images were resized to $6 4 \times 6 4$ and then fed to our auto-encoder structure. This effect can also be seen for the MNIST dataset as shown in Figure 10. When the dimensionality of the latent-space (i.e. information bottleneck) is too low the latent space will not contain enough information to reconstruct crisp images. Increasing the dimensionality of the latent space leads to crisper images.
429
+
430
+ # CALCULATING THE SLICED WASSERSTEIN DISTANCE AS A MEASURE OF GOODNESS OF FIT
431
+
432
+ In this paper we also used the sliced Wasserstein distance as a measure of goodness of fit (for convergence analysis). To provide a fair comparison between different methods, we avoided random projections for this comparison. Instead, we calculated a discriminant subspace to separate $\psi ( z )$ from $\psi ( \phi ( x ) )$ for $z \sim q z$ and $x \sim p _ { X }$ , and set the projection parameters $\theta \mathrm { s }$ to the calculated discriminant components. This will lead to only slices that contain discriminant information. We point out that the linear discriminant analysis (LDA) is not a good choice for this task as it only leads to one discriminant component (because we only have two classes). We used the penalized linear discriminant analysis (p-LDA) that utilizes a combination of LDA and PCA. In short, p-LDA solves the following objective function:
433
+
434
+ $$
435
+ \operatorname { a r g m a x } _ { \theta } \quad { \frac { \theta ^ { T } S _ { T } \theta } { \theta ^ { T } ( S _ { W } + \alpha I ) \theta } }
436
+ $$
437
+
438
+ ![](images/94760fa749da093a17f528853e09b8d574db74970245ab6f1cd5e8503ad1ada2.jpg)
439
+ Figure 10: Interpolation results for on the MNIST dataset with various dimensions of the latent space. The parameter $t \in [ 0 , 1 ]$ indicates the interpolation parameter.
440
+
441
+ where $S _ { W }$ is the within class covariance matrix, $S _ { T }$ is the data covariance matrix, $I$ is the identity matrix, and $\alpha$ identifies the interpolation between PCA and LDA (i.e. $\alpha = 0$ leads to LDA and $\alpha \to \infty$ leads to PCA).
442
+
443
+ # ERROR ANALYSIS OF WASSERSTEIN DISTANCE
444
+
445
+ For $p \geq 1$ we can use the triangle inequality and write
446
+
447
+ $$
448
+ \begin{array} { l l l } { { W _ { p } ( p _ { X } , p _ { Y } ) } } & { { \le } } & { { W _ { p } ( p _ { X } , p _ { X , M } ) + W _ { p } ( p _ { Y } , p _ { X , M } ) } } \\ { { } } & { { \le } } & { { W _ { p } ( p _ { X } , p _ { X , M } ) + W _ { p } ( p _ { Y } , p _ { Y , M } ) + W _ { p } ( p _ { X , M } , p _ { Y , M } ) } } \end{array}
449
+ $$
450
+
451
+ which leads to
452
+
453
+ $$
454
+ \begin{array} { r l r } { W _ { p } ( p _ { X } , p _ { Y } ) - W _ { p } ( p _ { X , M } , p _ { Y , M } ) } & { \leq } & { W _ { p } ( p _ { X } , p _ { X , M } ) + W _ { p } ( p _ { Y } , p _ { Y , M } ) } \end{array}
455
+ $$
456
+
457
+ Taking the expectation of both sides of the inequality and using the empirical convergence bounds of $W _ { p }$ (in this case $W _ { 1 }$ ) we have,
458
+
459
+ $$
460
+ \begin{array} { r c l } { \mathbb { E } ( W _ { 1 } ( p _ { X } , p _ { Y } ) - W _ { 1 } ( p _ { X , M } , p _ { Y , M } ) ) } & { \leq } & { \mathbb { E } ( W _ { 1 } ( p _ { X } , p _ { X , M } ) ) + \mathbb { E } ( W _ { 1 } ( p _ { Y } , p _ { Y , M } ) ) } \\ & { \leq } & { \displaystyle \frac { C } { \sqrt { M } } } \end{array}
461
+ $$
462
+
463
+ for some absolute constant $C$ , where the last line comes from the empirical convergence bounds of distributions with respect to the Wasserstein distance, see Bobkov & Ledoux (2014).
464
+
465
+ ![](images/ee6714a1246396876bfdf7e82706671f769b0263c898e7ca94736d5e7cb9441c.jpg)
466
+
467
+ <table><tr><td rowspan=2 colspan=11>WAARJDPPPE 00OT WAARA DPP-PPS 000T(SANN)IISSNAAAAA(SALIIUSSMAA-AAA80ywewvvomzb~z&#x27;xd ~x&#x27;(z)p&#x27;x)ms)b01 zb~z&#x27;Xd ~x&#x27;(z&#x27;(x)Φ)Ms)b0100 0090020200 xd~x&#x27;(x)Φ0 0 ●zb~z26802101210 1 1</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=2></td></tr><tr><td rowspan=1 colspan=1>0000</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=4></td><td rowspan=1 colspan=2></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>:</td><td rowspan=1 colspan=1>:</td><td rowspan=1 colspan=4>:</td><td rowspan=1 colspan=2>:</td><td rowspan=1 colspan=1>:</td><td rowspan=1 colspan=1>:</td><td rowspan=1 colspan=1>:</td></tr><tr><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=4></td><td rowspan=1 colspan=2></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=4></td><td rowspan=1 colspan=2></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=4></td><td rowspan=1 colspan=2></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=4></td><td rowspan=1 colspan=2></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=4></td><td rowspan=1 colspan=2></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>茶</td></tr><tr><td rowspan=1 colspan=1>rtigen</td><td rowspan=1 colspan=1>o</td><td rowspan=1 colspan=4>MAAAAA</td><td rowspan=1 colspan=2>MAA-MAD</td><td rowspan=1 colspan=1>o</td><td rowspan=1 colspan=1>AAA-AAA</td><td rowspan=1 colspan=1>MAA-MARBBB)</td></tr></table>
468
+
469
+ SWAE provides a superior match between φ(x (i.e. pZ and qZwhile being less computationally expensive a ))
md/train/H1xipsA5K7/H1xipsA5K7.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/H1xk8jAqKQ/H1xk8jAqKQ.md ADDED
@@ -0,0 +1,398 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # BACKPLAY: ‘MAN MUSS IMMER UMKEHREN’
2
+
3
+ Cinjon Resnick∗ NYU cinjon@nyu.edu
4
+
5
+ Roberta Raileanu∗ NYU rr3009@nyu.edu
6
+
7
+ Sanyam Kapoor NYU sanyam@nyu.edu
8
+
9
+ Alexander Peysakhovich FAIR alexpeys@fb.com
10
+
11
+ Kyunghyun Cho
12
+ NYU, FAIR
13
+ kyunghyun.cho@nyu.edu
14
+ Joan Bruna
15
+ NYU, FAIR
16
+ bruna@cims.nyu.edu
17
+
18
+ # ABSTRACT
19
+
20
+ Model-free reinforcement learning (RL) requires a large number of trials to learn a good policy, especially in environments with sparse rewards. We explore a method to improve the sample efficiency when we have access to demonstrations. Our approach, Backplay, uses a single demonstration to construct a curriculum for a given task. Rather than starting each training episode in the environment’s fixed initial state, we start the agent near the end of the demonstration and move the starting point backwards during the course of training until we reach the initial state. Our contributions are that we analytically characterize the types of environments where Backplay can improve training speed, demonstrate the effectiveness of Backplay both in large grid worlds and a complex four player zero-sum game (Pommerman), and show that Backplay compares favorably to other competitive methods known to improve sample efficiency. This includes reward shaping, behavioral cloning, and reverse curriculum generation.
21
+
22
+ # 1 INTRODUCTION
23
+
24
+ An important goal of AI research is to construct agents that can learn well in new environments (Levine et al., 2016). An increasingly popular paradigm for this task is deep reinforcement learning (deep RL, Silver et al. (2016); Moravcík et al. (2017); Silver et al. (2017)). However, training an RL agent can take a very long time, particularly in environments with sparse rewards. In these settings, the agent typically requires a large number of episodes to stumble upon positive rewards and learn even a moderately effective policy that can then be refined. This is often resolved via hand-engineering a dense reward function. Such reward shaping, while effective, can also change the set of optimal policies and have unintended side effects $\mathrm { N g }$ et al., 1999; Clark & Amodei, 2016).
25
+
26
+ We consider an alternative technique for accelerating RL in sparse reward settings. The idea is to create a curriculum for the agent via reversing a single trajectory (i.e. state sequence) of reasonably good, but not necessarily optimal, behavior. We start our agent at the end of a demonstration and let it learn a policy in this easier setup. We then move the starting point backward until the agent is training only on the initial state of the task. We call this technique Backplay.
27
+
28
+ Our contributions are threefold:
29
+
30
+ 1. We characterize analytically and qualitatively which environments Backplay will aid. 2. We demonstrate Backplay’s effectiveness on both a grid world task (to gain intuition) as well as the four player stochastic zero-sum game Pommerman (MultiAgentLearning, 2018). 3. We empirically show that Backplay compares favorably to other methods that improve sample complexity.
31
+
32
+ Besides requiring vastly fewer number of samples to learn a good policy, an agent trained with Backplay can outperform its demonstrator and even learn an optimal policy following a sub-optimal demonstration. Our experiments further show Backplay’s strong performance relative to reward shaping (involves hand tuning reward functions), behavioral cloning (not intended for use with sub-optimal experts), and other forms of automatic curriculum generation (Florensa et al. (2017), requires a reversable environment).
33
+
34
+ # 2 RELATED WORK
35
+
36
+ The most related work to ours is a blog post describing a method similar to Backplay used to obtain state-of-theart performance on the challenging Atari game Montezuma’s Revenge (Salimans & Chen, 2018). This work was independent of and concurrent to our own. In addition to reporting results on a different, complex stochastic multi-agent environment, we provide an analytic characterization of the method as well as an in depth discussion of what kinds of environments a practitioner can expect Backplay to out or underperform other existing methods.
37
+
38
+ ![](images/cf7f8ad6e3c67f2fc2b5865e835dace28432e332ff9f7bdff2f7f869818e8747.jpg)
39
+ Figure 1. Backplay: We first collect a demonstration, from which we build a curriculum over the states. We then sample a state according to that curriculum and initialize our agent accordingly.
40
+
41
+ A popular method for improving RL with
42
+ access to expert demonstrations is behavioral cloning/imitation learning. These methods explicitly encourage the learned policy to mimic an expert policy (Bain & Sommut, 1999; Ross et al., 2011; Daumé et al., 2009; Zhang & Cho, 2016; Laskey et al., 2016; Nair et al., 2017; Hester et al., 2017; Ho & Ermon, 2016; Aytar et al., 2018; Lerer & Peysakhovich, 2018; Peng et al., 2018). Imitation learning requires access to both state and expert actions (whereas Backplay only requires states) and is designed to copy an expert, thus it cannot, without further adjustments (e.g. as proposed by Gao et al. (2018)), surpass a suboptimal expert. We discuss the pros and cons of an imitation learning $^ +$ adjustment vs. a Backplay-based approach in the main analysis section.
43
+
44
+ Other algorithms (Ranzato et al., 2015; Li et al., 2016; Das et al., 2017a;b), primarily in dialog, use a Backplay-like curriculum, albeit they utilize behavioral cloning for the first part of the trajectory. This is a major difference as we show that for many classes of problems, we only need to change the initial state distribution and do not see any gains from warm-starting with imitation learning. Backplay is more similar to Conservative Policy Iteration (Kakade & Langford, 2002), a theoretical paper which presents an algorithm designed to operate with an explicit restart distribution.
45
+
46
+ Also related to Backplay is the method of automatic reverse curriculum generation Florensa et al. (2017). These approaches assumes that the final goal state is known and that the environment is both resettable and reversible. The curricula are generated by taking random walks in the state space to generate starting states or by taking random actions starting at the goal state McAleer et al. (2018). These methods do not require an explicit ‘good enough’ demonstration as Backplay does. However, they require the environment to be reversible, an assumption that doesn’t hold in many realistic tasks such as a robot manipulating breakable objects or complex video games such as Starcraft. In addition, they may fare poorly when random walks reach parts of the state space that are not actually relevant for learning a good policy. Thus, whether a practitioner wants to generate curricula from a trajectory or a random walk depends on the environment’s properties. We discuss this in more detail in our analysis section and show empirical results suggesting that Backplay is superior.
47
+
48
+ Hosu & Rebedea (2016) use uniformly random states of an expert demonstration as starting states for a policy. Like Backplay, they show that using a single loss function to learn a policy from both demonstrations and rewards can outperform the demonstrator and is robust to sub-optimal demonstrations. However, they do not impose a curriculum over the demonstration and are equivalent to the Uniform baseline in our experiments.
49
+
50
+ Zhu et al. (2018) use a curriculum but manually tune it for each ‘stage’ of the environment. Within each stage, they use what we call Uniform training, which fails in our most challenging environments.
51
+
52
+ Goyal et al. (2018) and Edwards et al. (2018) simultaneously proposed the use of a learned backtracking model to generate traces that lead to high value states. Their methods rely on either having the agent visit high reward states or learning a model of the environment capable of generating the states. Both of these are challenging in environments in which the dynamics near starting states are very different from those near goal states.
53
+
54
+ Finally, Ivanovic et al. (2018) use a known (approximate) dynamics model to create a backwards curriculum for continuous control tasks. Their approach requires a physical prior which is not always available and often not applicable in multi-agent scenarios. In contrast, Backplay automatically creates a curriculum fit for any resettable environment with accompanying demonstrations.
55
+
56
+ # 3 BACKPLAY
57
+
58
+ Consider the standard formalism of a single agent Markov Decision Process (MDP) defined by a set of states $s$ , a set of actions $\mathcal { A }$ , and a transition function $\mathcal { T } : \mathcal { S } \times \mathcal { A } \mathcal { S }$ which gives the probability distribution of the next state given a current state and action. If $\mathcal { P } ( A )$ denotes the space of probability distributions over actions, the agent chooses actions by sampling from a stochastic policy $\pi : { \mathcal { S } } { \mathcal { P } } ( { \mathcal { A } } )$ , and receives reward $r : S \times \mathcal { A } \mathbb { R }$ at every time step. The agent’s goal is to construct a policy which minimizes its discounted expected return $\begin{array} { r } { R _ { t } = \bar { \mathbb { E } } \left[ \sum _ { k = 0 } ^ { \infty } \bar { \gamma } ^ { k } r _ { t + k + 1 } \right] } \end{array}$ where $r _ { t }$ is the reward at time $t$ and $\gamma \in [ 0 , 1 ]$ is the discount factor, and the expectation is taken with respect to both the policy and the environment.
59
+
60
+ The final component of an MDP is the distribution of initial starting states $s _ { 0 }$ . The key idea in demonstration which reaches a sequence of states Backplay is that we do not initialize the MDP in only a fixed $\{ s _ { 0 } ^ { \dot { d } } , s _ { 1 } ^ { d } , \ldots , s _ { T } ^ { d } \}$ $s _ { 0 }$ . Instead, we assume access to a . For each training episode, we uniformly sample starting states from the sub-sequence $\{ s _ { T - k } ^ { d } , s _ { T - k + 1 } ^ { d } , . . . , s _ { T - j } ^ { d } \}$ for some window $[ j , k ]$ . Note that this training regime requires the ability to reset the environment to any state. As training continues, we ‘advance’ the window according to a curriculum by increasing the values of $j$ and $k$ until we are training on the initial state in every episode $( j = k = T )$ ). In this manner, our hyperparameters for Backplay are the windows and the training epochs at which we advance them.
61
+
62
+ # 3.1 QUANTITATIVE ANALYSIS
63
+
64
+ Next, we consider a simple environment in which we can analytically show that Backplay will improve the sample-efficiency of RL training.
65
+
66
+ Consider a connected, undirected graph $G = ( V , E )$ . An agent is placed at a fixed node $v _ { 0 } \in V$ and moves to neighboring nodes at a negative reward of $- 1$ for each step. Its goal is to reach a target node $v _ { * } \in V$ , terminating the episode. This corresponds to an MDP $\overset { \cdot } { \mathcal { M } } = \overset { \cdot } { ( } S , \overset { \cdot } { \mathcal { A } } , P , R )$ with state space $s \sim V$ , action space $A \sim E$ , deterministic transition kernel corresponding to
67
+
68
+ $$
69
+ P ( s _ { t + 1 } = j \mid s _ { t } = i , a _ { t } = ( l , k ) ) = \delta ( j = k ) \delta ( l = i ) + \delta ( j = i ) \delta ( l \neq i )
70
+ $$
71
+
72
+ and uniform reward $R ( s _ { t } , a _ { t } ) = - 1$ for $s _ { t + 1 } \neq v _ { * }$ . Assume that $\pi$ is a fixed policy on $\mathcal { M }$ , such that the underlying Markov chain is irreducible and aperiodic:
73
+
74
+ $$
75
+ K _ { \pi } ( s ^ { \prime } , s ) = \sum _ { a \in \cal { A } } P ( s _ { t + 1 } = s ^ { \prime } \mid s _ { t } = s , a _ { t } = a ) \pi ( a \mid s )
76
+ $$
77
+
78
+ $K _ { \pi }$ has a single absorbing state at $s = s _ { * } : = v _ { * }$ . Our goal is to estimate the value function of this policy, equivalent to the expected first-passage time of the Markov chain $K _ { \pi }$ from $s _ { 0 } = s$ to $s _ { * }$ :
79
+
80
+ $$
81
+ V _ { \pi } ( s ) = \mathbb { E } \tau ( s , s _ { * } ) = \mathbb { E } \operatorname* { m i n } \{ j \geq 0 \ ; \ s . t . s _ { j } = s _ { * } , s _ { 0 } = s , s _ { i + 1 } \sim K _ { \pi } ( \cdot , s _ { i } ) \} .
82
+ $$
83
+
84
+ We consider a special tractable case where the value function can be well approximated by looking at the distance of a state from the goal state. Formally:
85
+
86
+ Assumption 1. For all $\theta$ $\begin{array} { r } { \mathrm { ~ , ~ } V _ { \theta } ( s ) = V _ { \theta } ( s ^ { \prime } ) \ w h e n e \nu e r d i s t _ { G } ( s ^ { \prime } , s _ { \ast } ) = d i s t _ { G } ( s , s _ { \ast } ) . } \end{array}$
87
+
88
+ We wish to analyze the process which is the projection of our Markov policy $\pi$ only in terms of the distance $z _ { t }$ . However, now the transition probabilities will not only be a function of only $z _ { t }$ and so
89
+
90
+ this projection will be non-Markovian. Its Markov approximation $\bar { z } _ { t }$ is defined as the Markov chain $\overline { { K } }$ given by the expected transition probabilities
91
+
92
+ $$
93
+ \begin{array} { r c l } { { \mathrm { P r } ( \bar { z } _ { t + 1 } = l - 1 | \bar { z } _ { t } = l ) } } & { { = } } & { { \alpha _ { l } : = \mathrm { P r } _ { \mu } ( z _ { t + 1 } = l - 1 | z _ { t } = l ) , } } \\ { { \mathrm { P r } ( \bar { z } _ { t + 1 } = l | \bar { z } _ { t } = l ) } } & { { = } } & { { \beta _ { l } : = \mathrm { P r } _ { \mu } ( z _ { t + 1 } = l | z _ { t } = l ) , l = 0 \ldots M } } \end{array}
94
+ $$
95
+
96
+ and thus Pr(¯zt+1 = l + 1|z¯ $\ L _ { t } = l ) = 1 - \alpha _ { l } - \beta _ { l } = \operatorname* { P r } _ { \mu } ( z _ { t + 1 } = l + 1 \mid z _ { t } = l$ ) under the stationary distribution $\mu$ of $K _ { \pi }$ .
97
+
98
+ Assumption 2. The projected process is well described by its Markovian approximation.
99
+
100
+ Though these assumptions are relatively strong, they makes the analysis of Backplay in this graph complex but analytically tractable. Given a demonstration $\mathbf { d } = ( d _ { 0 } = s _ { 0 } , \ldots , d _ { L } = { \dot { s } } _ { * } )$ , $d _ { l } \in S$ we will perform Backplay
101
+
102
+ Theorem 1. When assumptions 1 and 2 hold, the sample complexity gains from using Backplay rather than standard RL are exponential in the diameter of the graph. $\begin{array} { r } { O ( \frac { M ^ { 2 } } { m } \alpha ^ { - m } ) } \end{array}$ vs $\Omega ( M \alpha ^ { - M / 2 } )$
103
+
104
+ 3) to obtain Proof. we sample it using a step size $\bar { d } _ { l } : = \mathrm { d i s t } _ { G } ( \breve { d } _ { L - m l } , s _ { * } )$ , l = 0, 1, . . . , Lm , which satisfies (such that mod $\bar { d } _ { l } \leq l m \bar { }$ , where $j$ for all is defined in Section $l$ .
105
+
106
+ For fixed $l$ , we initialize the chain $\overline { { K } }$ at $\bar { d } _ { l }$ : $\bar { z } _ { 0 } = \bar { d } _ { l }$ . Since $\begin{array} { r } { P r ( \bar { z } _ { m } = 0 ) \geq \prod _ { j = 0 } ^ { m - 1 } \alpha _ { j } : = \gamma _ { 0 , m } } \end{array}$ , after $O ( \gamma _ { 0 , m } ^ { - 1 } )$ trials of length $\leq M$ , we will reach the absorbing state and finally have a signal-carrying update for the Q-function at the originating state.
107
+
108
+ We can consequently merge that state into the absorbing state and reduce the length of the chain by one. Repeat the argument $m$ times so that after $O ( \sum _ { j = 0 } ^ { m } \gamma _ { j , m } ^ { - 1 } ) = O ( m \gamma _ { 0 , m } ^ { - 1 } )$ trials, the Q-function is updated at $\bar { z } _ { 0 }$ . Repeat at Backplay steps $\begin{array} { r } { m , l = 1 , \dots \frac { M } { m } } \end{array}$ m , and we reach a sample complexity of
109
+
110
+ $$
111
+ T _ { m } = \sum _ { k = 0 } ^ { \frac { M } { m } - 1 } { \cal O } \left( M \sum _ { j = 0 } ^ { m } \gamma _ { k m , ( k + 1 ) m - j } ^ { - 1 } \right) \ .
112
+ $$
113
+
114
+ In the case where $\alpha _ { l } = \alpha$ for all $l$ , we obtain $\gamma _ { k m , ( k + 1 ) m - j } ^ { - 1 } = \gamma _ { 0 , m - j } = \alpha ^ { - m + j }$ and therefore $\begin{array} { r } { T _ { m } = O \left( \frac { M ^ { 2 } ( 1 - \alpha ^ { m + 1 } ) } { m ( 1 - \alpha ) } \alpha ^ { - m } \right) } \end{array}$ , where the important term is the rate $\textstyle { \frac { M ^ { 2 } } { m } } \alpha ^ { - m }$ .
115
+
116
+ On the other hand, Hong & Zhou (2017) shows that the first-passage time $\tau ( 0 , M )$ in a skip-free finite Markov chain of $M$ states with a single absorbing state is a random variable whose momentgenerating function $\varphi ( s ) = \mathbb { E } s ^ { \tau ( s , s _ { * } ) }$ is given by
117
+
118
+ $$
119
+ \varphi ( s ) = \prod _ { j = 1 } ^ { M } \frac { ( 1 - \lambda _ { j } ) s } { 1 - \lambda _ { j } s } ,
120
+ $$
121
+
122
+ where $\lambda _ { 1 } , \dots , \lambda _ { M }$ are the non-unit eigenvalues of the transition probability matrix. It follows that $\begin{array} { r } { \mathbb { E } \tau ( 0 , M ) = \varphi ^ { \prime } ( 1 ) = \sum _ { j = 1 } ^ { M } \frac { 1 } { 1 - \lambda _ { j } } \approx ( 1 - \lambda _ { 1 } ) ^ { - 1 } } \end{array}$ , which corresponds to the reciprocal spectral gap.1 Chen & Saloff-Coste (2013) further shows that this reciprocal spectral gap is $\Omega ( \alpha ^ { - M / 2 } )$ in our case, and therefore the model without Backplay will on average take $T _ { M } = \Omega ( \alpha ^ { - M / 2 } )$ trials to reach the absorbing state and receive information. □
123
+
124
+ We can analyze the uniform strategy similarly. The probability that a trajectory initialized at one of the uniform samples will reach the absorbing state is lower bounded by
125
+
126
+ $$
127
+ \sum _ { j = 1 } ^ { M } \alpha ^ { j } P ( \bar { z } _ { 0 } = j ) = \frac { 1 } { M } \sum _ { j = 1 } ^ { M } \alpha ^ { j } = \frac { \alpha - \alpha ^ { M + 1 } } { M ( 1 - \alpha ) } ,
128
+ $$
129
+
130
+ which is approximately $\frac { \alpha } { M }$ when $\alpha$ is small, leading to a sample complexity of $O ( M ^ { 2 } \alpha ^ { - 1 } )$ to update the value function at the originating state, and $O ( M ^ { 3 } \alpha ^ { - 1 } )$ at the starting state. Comparing this rate to Backplay with $m = 1$ , observe that the uniform strategy is slower by a factor of $M$ (and one can verify that the same is true for generic step size $m$ by imagining that we first sampled a window of size $m$ and then sub-sampled our state from that window), suggesting that it loses efficiency on environments with large diameter.
131
+
132
+ The preceding analysis suggests that a full characterization of Backplay is a fruitful direction for reinforcement and imitation learning theory, albeit beyond the scope of this paper.
133
+
134
+ # 3.2 QUALITATIVE ANALYSIS
135
+
136
+ We now provide intuition regarding the conditions under which Backplay can improve sampleefficiency or lead to a better policy than that of the demonstrator. In addition, we discuss the differences between Backplay and other methods of reducing sample complexity for deep RL as well as when practitioners would choose to use one or the other.
137
+
138
+ Figure 2 contains three grid worlds. In each, the agent begins at $s _ { 0 }$ , receives $+ 1$ when it reaches $s _ { * }$ , and otherwise incurs a per step cost. They each pose a challenge to model free RL and highlight advantages and disadvantages of Backplay compared to other approaches like behavioral cloning (BC, Bain & Sommut (1999)), generative adversarial imitation learning (GAIL, Ho & Ermon (2016)), and reverse curriculum generation (RCG, Florensa et al. (2017)). See Table 1 for a direct comparison of these algorithms.
139
+
140
+ ![](images/80c6f889e484645e180e67926e04933eee7f28c2ac4c3c88a6bf44468b8a2017.jpg)
141
+ Figure 2. Three environments illustrating when Backplay can help or hinder learning an optimal policy. Backplay is expected to learn faster than standard RL on the first and second mazes, but perform worse on the third maze.
142
+
143
+ The left grid world shows a sparse reward environment in which Backplay can decrease the requisite training time compared to standard RL. Using the sub-optimal demonstration will position the Backplay agent close to high value states. In addition, the agent will likely surpass the expert policy because, unlike in BC approaches, Backplay does not encourage the agent to imitate expert actions. Rather, the curriculum forces the agent to first explore states with large associated value and, consequently, estimating the value function suffers less from the curse of dimensionality. And finally, we expect it to also surpass results from RCG because random movements from the goal state will progress very haphazardly in such an open world.
144
+
145
+ The middle grid illustrates a maze with bottlenecks. Backplay will vastly decrease the exploration time relative to standard RL, because the agent will be less prone to exploring the errant right side chamber where it can get lost if it traverses to the right instead of going up to the goal. If we used BC, then the agent will sufficiently learn the optimal policy, however it will suffer when placed in nearby spots on the grid as they will be out of distribution; Backplay-trained agents will not have this problem as they also explore nearby states. When an RCG agent reaches the first fork, it has an even chance of exploring the right side of the grid and wasting lots of sample time.
146
+
147
+ On the rightmost grid world, while Backplay is still likely to surpass its demonstrator, it will have trouble doing better than standard RL because the latter always starts at $s _ { 0 }$ and consequently is more likely to stumble upon the optimal solution of going up and right. In contrast, Backplay will spend the dominant amount of its early training starting in states in the sub-optimal demonstration. Note that BC will be worse off than Backplay because by learning the demonstration, it will follow the trajectory into the basin instead of going up the right side. Finally, observe that RCG will likely outperform here given that it has a high chance of discovering the left side shortcut and, if not, it would more likely discover the right side shortcut than be trapped in the basin.
148
+
149
+ In summary, Backplay is not a universal strategy to improve sample complexity. Even in the navigation setting, if the task randomizes the initial state $s _ { 0 }$ , a single demonstration trajectory does not generally improve the coverage of the state-space outside an exponentially small region around said trajectory. For example, imagine a binary tree and a navigation task that starts at a random leaf and needs to reach the root. A single expert trajectory will be disjoint from half of the state space (because the root is absorbing), thus providing no sample complexity gains on average.
150
+
151
+ Table 1: Comparison of Backplay with related work: Behavioral Cloning (BC), Generative Adversarial Imitation Learning (GAIL), and Reverse Curriculum Generation (RCG).
152
+
153
+ <table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>Requirements</td><td rowspan=1 colspan=1>Main Idea</td><td rowspan=1 colspan=1>MainWeakness</td></tr><tr><td rowspan=1 colspan=1>BC</td><td rowspan=1 colspan=1>(State,Action) pairs fromexpert trajectory.</td><td rowspan=1 colspan=1>Learn policy that imitates theexpert demonstration.</td><td rowspan=1 colspan=1>Sub-optimal expert can yield avery poor learned policy.</td></tr><tr><td rowspan=1 colspan=1>GAIL</td><td rowspan=1 colspan=1>(State,Action) pairs fromexpert trajectory.</td><td rowspan=1 colspan=1>Learn a policythat matchesthe distribution of expert tra-jectory pairs.</td><td rowspan=1 colspan=1>Difficult to tune; Requires moreworld interactions; Can performworse than BC.</td></tr><tr><td rowspan=1 colspan=1>RCG</td><td rowspan=1 colspan=1>Reversable transition func-tion of environment; Reset-table environment.</td><td rowspan=1 colspan=1>Take randomwalks from goalstate to build curriculum of ini-tial starting states.</td><td rowspan=1 colspan=1>Complexitymay increase if ran-dom walks reach parts of statespace irrelevant to a good policy.</td></tr><tr><td rowspan=1 colspan=1>Backplay</td><td rowspan=1 colspan=1>State sequence froma‘good enough’ trajectory;Resettable environment.</td><td rowspan=1 colspan=1>Sample starting state fromgiven trajectory by walkingbackward along trajectory.</td><td rowspan=1 colspan=1>If states in‘good enough&#x27;tra- jectory are not optimal, then canslow learning the optimal policy.</td></tr></table>
154
+
155
+ # 4 EXPERIMENTS
156
+
157
+ We now move to evaluating Backplay empirically in two environments: a grid world maze and a four-player free-for-all game. The questions we study across both environments are the following:
158
+
159
+ • Is Backplay more efficient than training an RL agent from scratch? • How does the quality of the given demonstration affect the effectiveness of Backplay? • Can Backplay agents surpass the demonstrator when it is non-optimal? • Can Backplay agents generalize?
160
+
161
+ # 4.1 TRAINING DETAILS
162
+
163
+ We compare several training regimes. The first is Backplay, which uses the Backplay algorithm corresponding to a particular sequence of windows and epochs as specified in A.1. The second, Standard is vanilla model-free RL with the agent always starting at the initial state $s _ { 0 }$ . The last, Uniform, is an ablation that considers how important is the curriculum aspect of Backplay by sampling initial states randomly from the entire demonstration. In all these regimes, we use Proximal Policy Optimization (PPO, Schulman et al. (2017)) to train an agent with policy and value functions parameterized by convolutional neural networks.
164
+
165
+ On the Maze environment (detailed below), we also ran comparisons against Behavioral Cloning and Reverse Curriculum Generation. We chose BC over GAIL (Ho & Ermon, 2016) for three reasons. First, GAIL requires careful hyperparameter tuning and is thus difficult to train. Second, GAIL requires more environment interactions. And third, GAIL has recently been shown to perform significantly worse than BC (Behbahani et al., 2018).
166
+
167
+ Training details and network architectures for all the environments can be found in A.3 and A.6, while A.9 contains empirical observations for using Backplay in practice.
168
+
169
+ # 4.2 MAZE
170
+
171
+ We generated mazes of size $2 4 \times 2 4$ with 120 randomly placed walls, a random start position, and a random goal position. We then used $\mathbf { A } ^ { * }$ to generate trajectories. These included both Optimal demonstrations (true shortest path) and N-Optimal demonstrations (N steps longer than the shortest path). More details on this setup are given in A.2.
172
+
173
+ <table><tr><td rowspan=1 colspan=1>Algorithm</td><td rowspan=1 colspan=1>Map Set</td><td rowspan=1 colspan=1>% Optimal</td><td rowspan=1 colspan=1>% 0-5 Optimal</td><td rowspan=1 colspan=1>Avg Suboptimality</td><td rowspan=1 colspan=1> Std Suboptimality</td></tr><tr><td rowspan=1 colspan=1>Standard</td><td rowspan=1 colspan=1>All</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>N/A</td><td rowspan=1 colspan=1>N/A</td></tr><tr><td rowspan=1 colspan=1>Uniform</td><td rowspan=1 colspan=1>Optimal</td><td rowspan=1 colspan=1>27</td><td rowspan=1 colspan=1>91</td><td rowspan=1 colspan=1>8.26</td><td rowspan=1 colspan=1>32.92</td></tr><tr><td rowspan=1 colspan=1>Uniform</td><td rowspan=1 colspan=1>5-Optimal</td><td rowspan=1 colspan=1>51</td><td rowspan=1 colspan=1>98</td><td rowspan=1 colspan=1>2.04</td><td rowspan=1 colspan=1>17.39</td></tr><tr><td rowspan=1 colspan=1>Uniform</td><td rowspan=1 colspan=1>10-Optimal</td><td rowspan=1 colspan=1>49</td><td rowspan=1 colspan=1>98</td><td rowspan=1 colspan=1>2.04</td><td rowspan=1 colspan=1>16.79</td></tr><tr><td rowspan=1 colspan=1>Florensa</td><td rowspan=1 colspan=1>Optimal</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>51</td><td rowspan=1 colspan=1>63.36</td><td rowspan=1 colspan=1>78.08</td></tr><tr><td rowspan=1 colspan=1>Florensa</td><td rowspan=1 colspan=1>5-Optimal</td><td rowspan=1 colspan=1>48</td><td rowspan=1 colspan=1>77</td><td rowspan=1 colspan=1>25.44</td><td rowspan=1 colspan=1>56.89</td></tr><tr><td rowspan=1 colspan=1>Florensa</td><td rowspan=1 colspan=1>10-Optimal</td><td rowspan=1 colspan=1>49</td><td rowspan=1 colspan=1>69</td><td rowspan=1 colspan=1>39.75</td><td rowspan=1 colspan=1>70.92</td></tr><tr><td rowspan=1 colspan=1>Backplay</td><td rowspan=1 colspan=1>Optimal</td><td rowspan=1 colspan=1>31</td><td rowspan=1 colspan=1>100</td><td rowspan=1 colspan=1>0.64</td><td rowspan=1 colspan=1>4.96</td></tr><tr><td rowspan=1 colspan=1>Backplay</td><td rowspan=1 colspan=1>5-Optimal</td><td rowspan=1 colspan=1>37</td><td rowspan=1 colspan=1>94</td><td rowspan=1 colspan=1>7.94</td><td rowspan=1 colspan=1>33.35</td></tr><tr><td rowspan=1 colspan=1>Backplay</td><td rowspan=1 colspan=1>10-Optimal</td><td rowspan=1 colspan=1>54</td><td rowspan=1 colspan=1>99</td><td rowspan=1 colspan=1>0.37</td><td rowspan=1 colspan=1>3.49</td></tr></table>
174
+
175
+ Table 2: Results after 2000 epochs on 100 mazes. Note that for Backplay and Uniform, the Map Set is also the type of demonstrator, where N-optimal has demonstrations $\mathbf { N }$ steps longer than the shortest path. From left to right, the table shows: the percentage of mazes on which the agent optimally reaches the goal, percentage on which it reaches in at most five steps more than optimal, and the average and standard deviation of extra steps over optimal. Both Backplay and Uniform succeed on almost all mazes and, importantly, can outperform the experts’ demonstrations. On the other hand, Standard does not learn a useful policy and Florensa fails to learn more than $5 0 - 7 0 \%$ of the maps, which is why its sub-optimality mean and std is so high. Results for Backplay were generally consistent across all seeds. For others, we report their best score. See A.4 for further details.
176
+
177
+ Our model receives as input four $2 4 \times 2 4$ binary maps. They contain ones at the positions of, respectively, the agent, the goal, passages, and walls. It outputs one of five options: Pass, Up, Down, Left, or Right. The game ends when the agent has reached its goal or after a maximum of 200 steps, whereupon the agent receives reward of $+ 1$ if it reaches the goal and a per step penalty of -0.03.
178
+
179
+ Backplay, Uniform, Standard. Table 2 shows that Standard has immense trouble learning in this sparse reward environment while both Backplay and Uniform find an optimal path approximately 30- $50 \%$ of the time and a path within five of the optimal path almost always. Thus, in this environment, demonstrations of even sub-optimal experts are extremely useful, while the curriculum created by Backplay is not necessary. That curriculum does, however, aid convergence speed (A.4). We will see in 4.3 that the curriculum becomes vital as the environment increases in complexity.
180
+
181
+ Behavioral Cloning. We trained an agent using behavioral cloning from the same trajectories as the ones used for Backplay. While the agent learns to perfectly imitate those trajectories, we had immense difficult doing better than the expert. All of our attempts to use reward signal to improve the agent’s performance (over that of the behaviorally cloned agent) were unsuccessful, even after incorporating tricks in the literature such as those found in Schmitt et al. (2018). One possible reason is that the agent has no information about states outside of the demonstration trajectory.
182
+
183
+ Reverse Curriculum Generation. We also compared Backplay to the method proposed by Florensa et al. (2017). As illustrated in Table 2 and Section A.4, Florensa agents perform significantly worse with higher sample complexity variance compared to Backplay (or Uniform). This suggests that having demonstrations helps inordinately. Further details can be found in A.3.
184
+
185
+ # 4.3 POMMERMAN
186
+
187
+ Pommerman is a stochastic environment (Resnick et al., 2018) based on the classic console game Bomberman and will be a competition at NeurIPS 2018. It is played on an 11x11 grid where on every turn, each of four agents either move in a cardinal direction, pass, or lay a bomb. The agents begin fenced in their own area by two different types of walls - rigid and wooden. The former are indestructible while bombs destroy the latter. Upon blowing up wooden walls, there is a uniform chance at yielding one of three power-ups: an extra bomb, an extra unit of range in the agent’s bombs, or the ability to kick bombs. The maps are designed randomly, albeit there is always a guaranteed path between any two agents. For a visual aid of the start state, see Figure 8 in A.5.
188
+
189
+ In our experiments, we use the purely adversarial Free-For-All (FFA) environment. This environment is introduced in (MultiAgentLearning, 2018; Resnick et al., 2018) and we point the reader there for more details. The winner of the game is the last agent standing. It is played from the perspective of one agent whose starting position is uniformly picked among the four. The three opponents are copies of the winner of the June 3rd 2018 FFA competition, a stochastic agent using a Finite State Machine Tree-Search approach (FSMTS, Zhou et al. (2018)). We also make use of the FSMTS agent as the ‘expert’ in the Backplay demonstrations.
190
+
191
+ The observation state is represented by 19 11x11 maps, and we feed the concatenated last two states to our agent as input. A detailed description of this mapping is given in A.5. The game ends either when the learning agent wins or dies, or when 800 steps have passed. Upon game end, the agent receives $+ 1$ for winning and $- 1$ otherwise (Sparse). We also run experiments where the agent additionally receives $+ 0 . 1$ whenever it collects an item (Dense).
192
+
193
+ ![](images/6fb655e834f82f1f2fc914d07474766c75d5578066da4028f1af9df41f349a66.jpg)
194
+ Figure 3. Pommerman results (5 seeds) when training with sparse rewards. Plots a and $\mathbf { b }$ are trained from the perspective of the winning agent, while c is trained from that of the runner up. The red bar indicates when the Backplay models begin training only on the initial state. Plot a is our starkest result and displays results on games starting from the initial state only regardless of when training occurs. you can see here that Backplay attains strong results where Uniform and Standard fail to learn anything of note.
195
+
196
+ ![](images/9075ba624117740d560bc365ca0cba6177e44e0898a5d3c9a64593cbaa86e0f3.jpg)
197
+ Figure 4. Pommerman results (5 seeds) when training with dense rewards. Again, a and $\mathbf { b }$ are trained from the perspective of the winning agent, while c is trained from that of the runner up. The cause of the higher variance in a was one of the seeds was worse than the others. Nonetheless, they all still did much better than either Standard or Uniform.
198
+
199
+ Our first three scenarios follow the Sparse setup. We independently consider three Backplay trajectories, one following the winner over 100 maps, one following the winner over four maps, and one following the runner up over four maps, with the latter two set of maps being the same. Figure 3 shows that Backplay can soundly defeat the FSMTS agents in sparse settings when following the winner, even when there are 100 maps to consider, while other methods struggle in this setup. Modulo higher variance in Backplay’s result, we see a similar comparison in the runner-up case. Visit this link for an example gif of our trained Backplay agent (top left - red). Note that our agent learned to ‘throw’ bombs, a unique playing style that no prior Pommerman competitor had exhibited, including the FSMTS demonstrator.
200
+
201
+ Moreover, by training on 100 maps, Backplay generalizes (to some extent) on unseen boards. Backplay wins 416 / 1000 games on a held out set of ten maps, with the following success rates on each: $8 5 . 3 \%$ , $8 4 . 1 \%$ , $8 1 . 6 \%$ , $7 9 . 5 \%$ , $5 2 . 4 \%$ , $4 7 . 4 \%$ , $3 8 . 1 \%$ , $2 2 . 6 \%$ , $20 \%$ , and $1 8 . 3 \%$ . This was in contrast to our Maze experiments where no approach generalized. Given this discrepancy, we believe that the lack of generalization was a consequence of not including enough mazes during training.
202
+
203
+ # 5 CONCLUSION
204
+
205
+ We have introduced and analyzed Backplay, a technique which improves the sample efficiency of model-free RL by constructing a curriculum around a demonstration. We showed that Backplay agents can learn in complex environments where standard model-free RL fails, that they can outperform the ‘expert’ whose trajectories they use while training, and that they compare very favorably to related methods such as reversible curriculum generation. We also presented a theoretical analysis of its sample complexity gains in a simplified setting.
206
+
207
+ An important future direction is combining Backplay with more complex and complementary methods such as Monte Carlo Tree Search (MCTS, (Browne et al., 2012; Vodopivec et al., 2017)). There are many potential ways to do so, for example by using Backplay to warm-start MCTS.
208
+
209
+ Another direction is to use Backplay to accelerate self-play learning in zero-sum games. However, special care needs to be taken to avoid policy correlation during training (Lanctot et al., 2017) and thus to make sure that learned strategies are safe and not exploitable (Brown & Sandholm, 2017).
210
+
211
+ A third direction is towards non-zero sum games. It is well known that standard independent multiagent learning does not produce agents that are able to cooperate in social dilemmas (Leibo et al., 2017; Lerer & Peysakhovich, 2017; Peysakhovich & Lerer, 2017; Foerster et al., 2017) or risky coordination games (Yoshida et al., 2008; Peysakhovich & Lerer, 2018). In contrast, humans are much better at finding these coordinating and cooperating equilibria (Bó, 2005; Kleiman-Weiner et al., 2016). Thus, we conjecture that human demonstrations can be combined with Backplay to construct agents that perform well in such situations.
212
+
213
+ Other future priorities are to gain further understanding into when Backplay works well, when it fails, and how we can make the procedure more efficient. Could we speed up Backplay by ascertaining confidence estimates of state values? Do the gains in sample complexity come from value estimation like our analysis suggests, from policy iteration, or from both? Is there an ideal rate for advancing the curriculum window and is there a better approach than a hand-tuned schedule?
214
+
215
+ # REFERENCES
216
+
217
+ Yusuf Aytar, Tobias Pfaff, David Budden, Tom Le Paine, Ziyu Wang, and Nando de Freitas. Playing hard exploration games by watching youtube. arXiv preprint arXiv:1805.11592, 2018.
218
+ Michael Bain and Claude Sommut. A framework for behavioural claning. Machine intelligence, 15 (15):103, 1999.
219
+ Feryal Behbahani, Kyriacos Shiarlis, Xi Chen, Vitaly Kurin, Sudhanshu Kasewa, Ciprian Stirbu, João Gomes, Supratik Paul, Frans A Oliehoek, João Messias, et al. Learning from demonstration in the wild. arXiv preprint arXiv:1811.03516, 2018.
220
+ Pedro Dal Bó. Cooperation under the shadow of the future: experimental evidence from infinitely repeated games. American economic review, 95(5):1591–1604, 2005.
221
+ Noam Brown and Tuomas Sandholm. Safe and nested subgame solving for imperfect-information games. In Advances in Neural Information Processing Systems, pp. 689–699, 2017.
222
+ Cameron B Browne, Edward Powley, Daniel Whitehouse, Simon M Lucas, Peter I Cowling, Philipp Rohlfshagen, Stephen Tavener, Diego Perez, Spyridon Samothrakis, and Simon Colton. A survey of monte carlo tree search methods. IEEE Transactions on Computational Intelligence and AI in games, 4(1):1–43, 2012.
223
+ Guan-Yu Chen and Laurent Saloff-Coste. On the mixing time and spectral gap for birth and death chains. arXiv preprint arXiv:1304.4346, 2013.
224
+ J. Clark and D. Amodei. Faulty reward functions in the wild. https://blog.openai.com/ faulty-reward-functions/, 2016.
225
+ Abhishek Das, Samyak Datta, Georgia Gkioxari, Stefan Lee, Devi Parikh, and Dhruv Batra. Embodied question answering. CoRR, abs/1711.11543, 2017a.
226
+
227
+ Abhishek Das, Satwik Kottur, José M. F. Moura, Stefan Lee, and Dhruv Batra. Learning cooperative visual dialog agents with deep reinforcement learning. CoRR, abs/1703.06585, 2017b.
228
+
229
+ Hal Daumé, John Langford, and Daniel Marcu. Search-based structured prediction. Machine learning, 75(3):297–325, 2009.
230
+
231
+ Ashley D Edwards, Laura Downs, and James C Davidson. Forward-backward reinforcement learning. arXiv preprint arXiv:1803.10227, 2018.
232
+
233
+ Carlos Florensa, David Held, Markus Wulfmeier, and Pieter Abbeel. Reverse curriculum generation for reinforcement learning. arXiv preprint arXiv:1707.05300, 2017.
234
+
235
+ Jakob N Foerster, Richard Y Chen, Maruan Al-Shedivat, Shimon Whiteson, Pieter Abbeel, and Igor Mordatch. Learning with opponent-learning awareness. arXiv preprint arXiv:1709.04326, 2017.
236
+
237
+ Yang Gao, Ji Lin, Fisher Yu, Sergey Levine, Trevor Darrell, et al. Reinforcement learning from imperfect demonstrations. arXiv preprint arXiv:1802.05313, 2018.
238
+
239
+ Anirudh Goyal, Philemon Brakel, William Fedus, Timothy Lillicrap, Sergey Levine, Hugo Larochelle, and Yoshua Bengio. Recall traces: Backtracking models for efficient reinforcement learning. arXiv preprint arXiv:1804.00379, 2018.
240
+
241
+ Todd Hester, Matej Vecerik, Olivier Pietquin, Marc Lanctot, Tom Schaul, Bilal Piot, Dan Horgan, John Quan, Andrew Sendonaris, Gabriel Dulac-Arnold, et al. Deep q-learning from demonstrations. arXiv preprint arXiv:1704.03732, 2017.
242
+
243
+ Jonathan Ho and Stefano Ermon. Generative adversarial imitation learning. In Advances in Neural Information Processing Systems, pp. 4565–4573, 2016.
244
+
245
+ Wenming Hong and Ke Zhou. A note on the passage time of finite-state markov chains. Communications in Statistics-Theory and Methods, 46(1):438–445, 2017.
246
+
247
+ Ionel-Alexandru Hosu and Traian Rebedea. Playing atari games with deep reinforcement learning and human checkpoint replay. arXiv preprint arXiv:1607.05077, 2016.
248
+
249
+ Boris Ivanovic, James Harrison, Apoorva Sharma, Mo Chen, and Marco Pavone. Barc: Backward reachability curriculum for robotic reinforcement learning. arXiv preprint arXiv:1806.06161, 2018.
250
+
251
+ Sham Kakade and John Langford. Approximately optimal approximate reinforcement learning. In Claude Sammut and Achim G. Hoffmann (eds.), ICML, pp. 267–274. Morgan Kaufmann, 2002. ISBN 1-55860-873-7. URL http://dblp.uni-trier.de/db/conf/icml/ icml2002.html#KakadeL02.
252
+
253
+ Max Kleiman-Weiner, Mark K Ho, Joseph L Austerweil, Michael L Littman, and Joshua B Tenenbaum. Coordinate to cooperate or compete: abstract goals and joint intentions in social interaction. In COGSCI, 2016.
254
+
255
+ Marc Lanctot, Vinicius Zambaldi, Audrunas Gruslys, Angeliki Lazaridou, Julien Perolat, David Silver, Thore Graepel, et al. A unified game-theoretic approach to multiagent reinforcement learning. In Advances in Neural Information Processing Systems, pp. 4190–4203, 2017.
256
+
257
+ Michael Laskey, Sam Staszak, Wesley Yu-Shu Hsieh, Jeffrey Mahler, Florian T Pokorny, Anca D Dragan, and Ken Goldberg. Shiv: Reducing supervisor burden in dagger using support vectors for efficient learning from demonstrations in high dimensional state spaces. In Robotics and Automation (ICRA), 2016 IEEE International Conference on, pp. 462–469. IEEE, 2016.
258
+
259
+ Joel Z Leibo, Vinicius Zambaldi, Marc Lanctot, Janusz Marecki, and Thore Graepel. Multi-agent reinforcement learning in sequential social dilemmas. In Proceedings of the 16th Conference on Autonomous Agents and MultiAgent Systems, pp. 464–473. International Foundation for Autonomous Agents and Multiagent Systems, 2017.
260
+
261
+ Adam Lerer and Alexander Peysakhovich. Maintaining cooperation in complex social dilemmas using deep reinforcement learning. arXiv preprint arXiv:1707.01068, 2017.
262
+
263
+ Adam Lerer and Alexander Peysakhovich. Learning social conventions in markov games. arXiv preprint arXiv:1806.10071, 2018.
264
+
265
+ 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. URL http: //jmlr.org/papers/v17/15-522.html.
266
+
267
+ Jiwei Li, Will Monroe, Alan Ritter, Michel Galley, Jianfeng Gao, and Dan Jurafsky. Deep reinforcement learning for dialogue generation. CoRR, abs/1606.01541, 2016.
268
+
269
+ Stephen McAleer, Forest Agostinelli, Alexander Shmakov, and Pierre Baldi. Solving the rubik’s cube without human knowledge. arXiv preprint arXiv:1805.07470, 2018.
270
+
271
+ Matej Moravcík, Martin Schmid, Neil Burch, Viliam Lisý, Dustin Morrill, Nolan Bard, Trevor Davis, Kevin Waugh, Michael Johanson, and Michael H. Bowling. Deepstack: Expert-level artificial intelligence in no-limit poker. CoRR, abs/1701.01724, 2017. URL http://arxiv.org/abs/ 1701.01724.
272
+
273
+ MultiAgentLearning. Pommerman. https://github.com/MultiAgentLearning/ playground, 2018.
274
+
275
+ Ashvin Nair, Bob McGrew, Marcin Andrychowicz, Wojciech Zaremba, and Pieter Abbeel. Overcoming exploration in reinforcement learning with demonstrations. arXiv preprint arXiv:1709.10089, 2017.
276
+
277
+ Andrew Y Ng, Daishi Harada, and Stuart Russell. Policy invariance under reward transformations: Theory and application to reward shaping. In ICML, volume 99, pp. 278–287, 1999.
278
+
279
+ Xue Bin Peng, Pieter Abbeel, Sergey Levine, and Michiel van de Panne. Deepmimic: Example-guided deep reinforcement learning of physics-based character skills. arXiv preprint arXiv:1804.02717, 2018.
280
+
281
+ Alexander Peysakhovich and Adam Lerer. Consequentialist conditional cooperation in social dilemmas with imperfect information. arXiv preprint arXiv:1710.06975, 2017.
282
+
283
+ Alexander Peysakhovich and Adam Lerer. Prosocial learning agents solve generalized stag hunts better than selfish ones. Proceedings of the 17th Conference on Autonomous Agents and MultiAgent Systems, 2018.
284
+
285
+ Marc’Aurelio Ranzato, Sumit Chopra, Michael Auli, and Wojciech Zaremba. Sequence level training with recurrent neural networks. CoRR, abs/1511.06732, 2015.
286
+
287
+ Cinjon Resnick, Wes Eldridge, David Ha, Denny Britz, Jakob Foerster, Julian Togelius, Kyunghyun Cho, and Joan Bruna. Pommerman: A multi-agent playground, 2018.
288
+
289
+ Stéphane Ross, Geoffrey Gordon, and Drew Bagnell. A reduction of imitation learning and structured prediction to no-regret online learning. In Proceedings of the fourteenth international conference on artificial intelligence and statistics, pp. 627–635, 2011.
290
+
291
+ Tim Salimans and Richard Chen. Learning montezuma’s revenge from a single demonstration. https://blog.openai.com/ learning-montezumas-revenge-from-a-single-demonstration/, 2018. Accessed: 2018-07-12.
292
+
293
+ Simon Schmitt, Jonathan J Hudson, Augustin Zidek, Simon Osindero, Carl Doersch, Wojciech M Czarnecki, Joel Z Leibo, Heinrich Kuttler, Andrew Zisserman, Karen Simonyan, et al. Kickstarting deep reinforcement learning. arXiv preprint arXiv:1803.03835, 2018.
294
+
295
+ John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
296
+
297
+ David Silver, Aja Huang, Chris J. Maddison, Arthur Guez, Laurent Sifre, George van den Driessche, Julian Schrittwieser, Ioannis Antonoglou, Veda Panneershelvam, Marc Lanctot, Sander Dieleman, Dominik Grewe, John Nham, Nal Kalchbrenner, Ilya Sutskever, Timothy Lillicrap, Madeleine Leach, Koray Kavukcuoglu, Thore Graepel, and Demis Hassabis. Mastering the game of Go with deep neural networks and tree search. Nature, 529(7587):484–489, 2016.
298
+
299
+ David Silver, Thomas Hubert, Julian Schrittwieser, Ioannis Antonoglou, Matthew Lai, Arthur Guez, Marc Lanctot, Laurent Sifre, Dharshan Kumaran, Thore Graepel, Timothy P. Lillicrap, Karen Simonyan, and Demis Hassabis. Mastering chess and shogi by self-play with a general reinforcement learning algorithm. CoRR, abs/1712.01815, 2017. URL http://arxiv.org/ abs/1712.01815.
300
+
301
+ Tom Vodopivec, Spyridon Samothrakis, and Branko Šter. On monte carlo tree search and reinforcement learning. J. Artif. Int. Res., 60(1):881–936, September 2017. ISSN 1076-9757. URL http://dl.acm.org/citation.cfm?id $\equiv$ 3207692.3207712.
302
+
303
+ Wako Yoshida, Ray J Dolan, and Karl J Friston. Game theory of mind. PLoS computational biology, 4(12):e1000254, 2008.
304
+
305
+ Jiakai Zhang and Kyunghyun Cho. Query-efficient imitation learning for end-to-end autonomous driving. arXiv preprint arXiv:1605.06450, 2016.
306
+
307
+ Hongwei Zhou, Yichen Gong, Luvneesh Mugrai, Ahmed Khalifa, Andy Nealen, and Julian Togelius. A hybrid search agent in pommerman. In Proceedings of the 13th International Conference on the Foundations of Digital Games, FDG ’18, pp. 46:1–46:4, New York, NY, USA, 2018. ACM. ISBN 978-1-4503-6571-0. doi: 10.1145/3235765.3235812. URL http://doi.acm.org/10. 1145/3235765.3235812.
308
+
309
+ Yuke Zhu, Ziyu Wang, Josh Merel, Andrei A. Rusu, Tom Erez, Serkan Cabi, Saran Tunyasuvunakool, János Kramár, Raia Hadsell, Nando de Freitas, and Nicolas Heess. Reinforcement and imitation learning for diverse visuomotor skills. CoRR, abs/1802.09564, 2018.
310
+
311
+ # A APPENDIX
312
+
313
+ # A.1 BACKPLAY HYPERPARAMETERS
314
+
315
+ As mentioned in Section 3, the Backplay hyperparameters are the window bounds and the frequency with which they are shifted. When we get to a training epoch represented in the sequence of epochs, we advance to the corresponding value in the sequence of windows. For example, consider training an agent with Backplay in the Maze environment (Table 3) and assume we are at epoch 1000. We will select a maze at random, an $N \in [ 1 6 , 3 2 )$ , and start the agent in that game $N$ steps from the end. Whenever a pair is chosen such that the game’s length is smaller than $N$ , we use the initial state.
316
+
317
+ There isn’t any downside to having the model continue training in a window for too long, albeit the ideal is that this method increases the speed of training. There is however a downside to advancing the window too quickly. A scenario common to effective training is improving success curves punctured by step drops whenever the window advances.
318
+
319
+ Table 3: Backplay hyperparameters for Maze.
320
+
321
+ <table><tr><td>Starting at training epoch</td><td>Uniform window</td></tr><tr><td>0</td><td>[0,4)</td></tr><tr><td>350</td><td>[4,8)</td></tr><tr><td>700</td><td>[8,16)</td></tr><tr><td>1050</td><td>[16,32)</td></tr><tr><td>1400</td><td>[32, 64)</td></tr><tr><td>1750</td><td>[64,64)</td></tr></table>
322
+
323
+ Table 4: Backplay hyperparameters for Pommerman 4 maps.
324
+
325
+ <table><tr><td>Starting at training epoch</td><td>Uniform window</td></tr><tr><td>0</td><td>[0,32)</td></tr><tr><td>50</td><td>[24,64)</td></tr><tr><td>100</td><td>[56,128)</td></tr><tr><td>150</td><td>[120,256)</td></tr><tr><td>200</td><td>[248, 512)</td></tr><tr><td>250</td><td>[504,800)</td></tr><tr><td>300</td><td>[800,800]</td></tr></table>
326
+
327
+ Table 5: Backplay hyperparameters for Pommerman 100 maps.
328
+
329
+ <table><tr><td>Starting at training epoch</td><td>Uniformwindow</td></tr><tr><td>0</td><td>[0,32)</td></tr><tr><td>85</td><td>[24,64)</td></tr><tr><td>170</td><td>[56,128)</td></tr><tr><td>255</td><td>[120,256)</td></tr><tr><td>340</td><td>[248,512)</td></tr><tr><td>425</td><td>[504, 800)</td></tr><tr><td>510</td><td>[800,800]</td></tr></table>
330
+
331
+ # A.2 MAZE: DEMONSTRATION DETAILS
332
+
333
+ For N-Optimal demonstrations, we used a noisy $\mathbf { A } ^ { * }$ where at each step, we follow $\mathbf { A } ^ { * }$ with probability $p$ or choose a random action otherwise. We considered $N \in \{ 5 , 1 0 \}$ . In all scenarios, we only selected maps in which there exists at least a path from the the initial state to the goal state, we filtered any path that was less than 35 in length and stopped when we found a hundred valid training games. Note that we held the demonstration length invariant rather than the optimal length (i.e. all N-optimal paths have the same length regardless of N, which means that the length of the optimal path of a N-optimal demonstration decreases with N). This could explain why the results in Table 2 (column 1) show that Backplay’s performance increases with $_ \mathrm { N }$ (since the larger the N, the smaller the true optimal path, so the easier it is to learn an optimal policy for that maze configuration).
334
+
335
+ A.3 MAZE: NETWORK ARCHITECTURE AND TRAINING PARAMETERS
336
+
337
+ We use a standard deep RL setup for our agents. The agent’s policy and value functions are parameterized by a convolutional neural network with 2 layers each of 32 output channels, followed by two linear layers with 128 dimensions. Each of the layers are followed by ReLU activations. This body then feeds two heads, a scalar value function and a softmax policy function over the five actions. All of the CNN kernels are 3x3 with stride and padding of one.
338
+
339
+ We train our agent using Proximal Policy Optimization (PPO, Schulman et al. (2017)) with $\gamma = 0 . 9 9$ , learning rate $\mathrm { \check { 1 } } \times 1 0 ^ { - 3 }$ , batch size 102400, 60 parallel workers, clipping parameter 0.2, generalized advantage estimation with $\tau = 0 . 9 5$ , entropy coefficient 0.01, value loss coefficient 0.5, mini-batch size 5120, horizon 1707, and 4 PPO updates at each iteration. The number of interactions per epoch is equal to the batch size (102400).
340
+
341
+ The hyperparameters used for training the agent with Reverse Curriculum Generation (Florensa et al., 2017) are: $1 0 ^ { 4 }$ rollout states for nearby sampling, 50 Brownian steps, 200 samples from new starts, 100 samples from old starts, interval for the expected return [0.1, 0.9].
342
+
343
+ # A.4 MAZE: LEARNING CURVES
344
+
345
+ Below are our learning curves for the Maze challenge over five seeds. Note that we do not show any results for Standard as it failed to learn much of anything in the time allotted (3500 epochs). Also note that Backplay occasionally sees the actual grid starting position from epoch 1400, but it becomes the default starting state at epoch 1750. To align with this, our Florensa baseline switches to training from the actual start position at epoch 1750, and we show results for Uniform only over the initial starting state. Correspondingly, we show the graphs from epoch 1000 as all of the methods have commensurately poor results before that time.
346
+
347
+ ![](images/9683ae6ed274a6f5a198d8346d1fc4c297be1738c3474374ec9f07db24dcb867.jpg)
348
+ Figure 5. Maze results when training with demonstrations of length equal to the optimal path length. Note that Backplay has a very small variance and a very high success rate as early as epoch 1800. On the other hand, Florensa fails to break $70 \%$ and has a high variance, and Uniform doesn’t achieve a strong success rate until epoch 3000.
349
+
350
+ ![](images/6c9d50dd06c913c8b6a47a3e64624e2b4635303e1ce588f85fbb562e7dda40ba.jpg)
351
+ Figure 6. Maze results when training with demonstrations that are five steps longer than the optimal path length. Compared to the prior graph, Backplay doesn’t do as well, albeit it still performs favorably compared to Florensa, with a consistently higher expected return. Its advantage over Uniform is a reduced amount of necessary samples.
352
+
353
+ ![](images/27cbb6f8732e3a701353a515becbf95c1b3b9eddcd0f02bbed31cb4c37149d2e.jpg)
354
+ Figure 7. Maze results when training with demonstrations that are ten steps longer than the optimal path length. We again see that Backplay does very well compared to the Florensa baseline, with a much stronger expected return and lower variance. We also see, however, that Uniform is an able competitor to both of these as the expert becomes more suboptimal.
355
+
356
+ # A.5 POMMERMAN: OBSERVATION STATE
357
+
358
+ ![](images/1d4a42cfa8224d99a5d25bf7cf28bb43b8e5fda4938db59e2d2add13320321ab.jpg)
359
+ Figure 8. Pommerman start state. Each agent begins in one of four positions. Yellow squares are wood, brown are rigid, and gray are passages.
360
+
361
+ There are 19 feature maps that encompass each observation. They consist of the following: the agents’ identities and locations, the locations of the walls, power-ups, and bombs, the bombs’ blast strengths and remaining life counts, and the current time step.
362
+
363
+ The first map contains the integer values of each bomb’s blast strength at the location of that bomb. The second map is similar but the integer value is the bomb’s remaining life. At all other positions, the first two maps are zero. The next map is binary and contains a single one at the agent’s location. If the agent is dead, this map is zero everywhere. The following two maps are similar. One is full with the agent’s integer current bomb count, the other with its blast radius. We then have a full binary map that is one if the agent can kick and zero otherwise.
364
+
365
+ The next maps deal with the other agents. The first contains only ones if the agent has a teammate and zeros otherwise. This is useful for building agents that can play both team and solo matches. If the agent has a teammate, the next map is binary with a one at the teammate’s location (and zero if she is not alive). Otherwise, the agent has three enemies, so the next map contains the position of the enemy that started in the diagonally opposed corner from the agent. The following two maps contain the positions of the other two enemies, which are present in both solo and team games.
366
+
367
+ We then include eight feature maps representing the respective locations of passages, rigid walls, wooden walls, flames, extra-bomb power-ups, increase-blast-strength power-ups, and kicking-ability power-ups. All are binary with ones at the corresponding locations.
368
+
369
+ Finally, we include a full map with the float ratio of the current step to the total number of steps. This information is useful for distinguishing among observation states that are seemingly very similar, but in reality are very different because the game has a fixed ending step where the agent receives negative reward for not winning.
370
+
371
+ # A.6 POMMERMAN: NETWORK ARCHITECTURE AND TRAINING PARAMETERS
372
+
373
+ We use a similar setup to that used in the Maze game. The architecture differences are that we have an additional two convolutional layers at the beginning, use 256 output channels, and have output dimensions of 1024 and 512, respectively, for the linear layers. This architecture was not tuned at all duringrate of $3 \times 1 0 ^ { - 4 }$ of our experiments. Further hyperparameter differences are that wand a gamma of 1.0. These models trained for 72 hours, which is ${ \sim } 5 0 \mathrm { M }$ a learning frames. 2
374
+
375
+ ![](images/a92a40429cbdf3082c148b0c130b7d79543e398b569c02ef95298a350467e734.jpg)
376
+ Figure 9. Typical histograms for how the Pommerman action selections change over time. From left to right are the concatenated counts of the actions (Pass, Up, Down, Left, Right, Bomb), delineated on the y-axis by the epoch. Note how the Standard agent learns to not use bombs.
377
+
378
+ Pommerman can be difficult for reinforcement learning agents. The agent must learn to effectively wield the bomb action in order to win against competent opponents. However, bombs destroy agents indiscriminately, so placing one without knowing how to retreat often results in negative reward for that agent. Since agents begin in an isolated area, they are prone to converging to policies which do not use the bomb action (as seen in the histograms in Figure 9), which leads them to sub-optimal policies in the long-term.
379
+
380
+ # A.8 POMMERMAN: WIN RATES
381
+
382
+ Here we show the per-map win rates obtained by the agent trained with Backlpay on the 100 Pommerman maps.
383
+
384
+ <table><tr><td rowspan=1 colspan=1>Win</td><td rowspan=1 colspan=1>Maps</td></tr><tr><td rowspan=1 colspan=1>90%</td><td rowspan=1 colspan=1>24</td></tr><tr><td rowspan=1 colspan=1>80%</td><td rowspan=1 colspan=1>26</td></tr><tr><td rowspan=1 colspan=1>70%</td><td rowspan=1 colspan=1>6</td></tr><tr><td rowspan=1 colspan=1>60%</td><td rowspan=1 colspan=1>5</td></tr><tr><td rowspan=1 colspan=1>50%</td><td rowspan=1 colspan=1>5</td></tr></table>
385
+
386
+ Table 6: Aggregate per-map win rates of the model trained with Backplay on 100 Pommerman maps. The model was run over 5000 times in total, with at least 32 times on each of the 100 maps. The Maps column shows the number of maps on which the Backplay agent had a success rate of at least the percent in the Win column. Note that this model has a win rate of $> 8 0 \%$ on more than half of the maps and a win rate of $> 5 0 \%$ on all maps.
387
+
388
+ # A.9 PRACTICAL FINDINGS
389
+
390
+ We trained a large number of models through our research into Backplay. Though these findings are tangential to our main points (and are mainly qualitative), we list some observations here that may be helpful for other researchers working with Backplay.
391
+
392
+ First, we found that Backplay does not perform well when the curriculum is advanced too quickly, however it does not fail when the curriculum is advanced ‘too slowly.’ Thus, researchers interested in using Backplay should err on the side of advancing the window too slowly rather than too quickly.
393
+
394
+ Second, we found that Backplay does not need to hit a high success rate before advancing the starting state window. Initially, we tried using adaptive approaches that advanced the window when the agent reached a certain success threshold. This worked but was too slow. Our hypothesis is that what is more important is that the agent gets sufficiently exposed to enough states to attain a reasonable barometer of their value rather than that the agent learns a perfectly optimal policy for a particular set of starting states.
395
+
396
+ Third, Backplay can still recover if success goes to zero. This surprising and infrequent result occurred at the juncture where the window moved back to the initial state and even if the policy’s entropy over actions became maximal. We are unsure what differentiates these models from the ones that did not recover.
397
+
398
+ We also explored using DAgger (Ross et al. (2011)) for training our agent, but found that it achieved approximately the same win rate $( \sim 2 0 \% )$ ) as what we would expect when four FSMTS agents played each other (given that there are also ties).
md/train/H1xsSjC9Ym/H1xsSjC9Ym.md ADDED
@@ -0,0 +1,390 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LEARNING TO UNDERSTAND GOAL SPECIFICATIONS BY MODELLING REWARD
2
+
3
+ Dzmitry Bahdanau∗ Mila, Universite de Montr´ eal´ dimabgv@gmail.com
4
+
5
+ Felix Hill DeepMind
6
+
7
+ Jan Leike DeepMind
8
+
9
+ Edward Hughes DeepMind
10
+
11
+ Arian Hosseini Mila, Universite de Montr ´ eal ´
12
+
13
+ Pushmeet Kohli DeepMind
14
+
15
+ Edward Grefenstette† DeepMind egrefen@fb.com
16
+
17
+ # ABSTRACT
18
+
19
+ Recent work has shown that deep reinforcement-learning agents can learn to follow language-like instructions from infrequent environment rewards. However, this places on environment designers the onus of designing language-conditional reward functions which may not be easily or tractably implemented as the complexity of the environment and the language scales. To overcome this limitation, we present a framework within which instruction-conditional RL agents are trained using rewards obtained not from the environment, but from reward models which are jointly trained from expert examples. As reward models improve, they learn to accurately reward agents for completing tasks for environment configurations—and for instructions—not present amongst the expert data. This framework effectively separates the representation of what instructions require from how they can be executed. In a simple grid world, it enables an agent to learn a range of commands requiring interaction with blocks and understanding of spatial relations and underspecified abstract arrangements. We further show the method allows our agent to adapt to changes in the environment without requiring new expert examples.
20
+
21
+ # 1 INTRODUCTION
22
+
23
+ Developing agents that can learn to follow user instructions pertaining to an environment is a longstanding goal of AI research (Winograd, 1972). Recent work has shown deep reinforcement learning (RL) to be a promising paradigm for learning to follow language-like instructions in both 2D and 3D worlds (e.g. Hermann et al. (2017); Chaplot et al. (2018), see Section 4 for a review). In each of these cases, being able to reward an agent for successfully completing a task specified by an instruction requires the implementation of a full interpreter of the instruction language. This interpreter must be able to evaluate the instruction against environment states to determine when reward must be granted to the agent, and in doing so requires full knowledge (on the part of the designer) of the semantics of the instruction language relative to the environment. Consider, for example, 4 arrangements of blocks presented in Figure 1. Each of them can be interpreted as a result of successfully executing the instruction “build an L-like shape from red blocks”, despite the fact that these arrangements differ in the location and the orientation of the target shape, as well as in the positioning of the irrelevant blue blocks. At best (e.g. for instructions such as the aforementioned one), implementing such an interpreter is feasible, although typically onerous in terms of engineering efforts to ensure reward can be given—for any admissible instruction in the language—in potentially complex or large environments. At worst, if we wish to scale to the full complexity of natural language, with all its ambiguity and underspecification, this requires solving fundamental problems of natural language understanding.
24
+
25
+ ![](images/406de354b040b9b9ca8c19c472b453c5fee6d1a5078521954cc52463976c72c6.jpg)
26
+ Figure 1: Different valid goal states for the instruction “build an L-like shape from red blocks”.
27
+
28
+ If instruction-conditional reward functions cannot conveniently or tractably be implemented, can we somehow learn them in order to then train instruction-conditional policies? When there is a single implicit task, Inverse Reinforcement Learning (IRL; $\mathrm { N g }$ & Russell, 2000; Ziebart et al., 2008) methods in general, and Generative Adversarial Imitation Learning (Ho & Ermon, 2016) in particular, have yielded some success in jointly learning reward functions from expert data and training policies from learned reward models. In this paper, we wish to investigate whether such mechanisms can be adapted to the more general case of jointly learning to understand language which specifies task objectives (e.g. instructions, goal specifications, directives), and use such understanding to reward language-conditional policies which are trained to complete such tasks. For simplicity, we explore a facet of this general problem in this paper by focussing on the case of declarative commands that specify sets of possible goal-states (e.g. “arrange the red blocks in a circle.”), and where expert examples need only be goal states rather than full trajectories or demonstrations, leaving such extensions for further work. We introduce a framework—Adversarial Goal-Induced Learning from Examples (AGILE)—for jointly training an instruction-conditional reward model using expert examples of completed instructions alongside a policy which will learn to complete instructions by maximising the thus-modelled reward. In this respect, AGILE relies on familiar RL objectives, with free choice of model architecture or training mechanisms, the only difference being that the reward comes from a learned reward model rather than from the environment.
29
+
30
+ We first verify that our method works in settings where a comparison between AGILE-trained policies with policies trained from environment reward is possible, to which end we implement instructionconditional reward functions. In this setting, we show that the learning speed and performance of A3C agents trained with AGILE reward models is superior to A3C agents trained against environment reward, and comparable to that of true-reward A3C agents supplemented by auxiliary unsupervised reward prediction objectives. To simulate an instruction-learning setting in which implementing a reward function would be problematic, we construct a dataset of instructions and goal-states for the task of building colored orientation-invariant arrangements of blocks. On this task, without us ever having to implement the reward function, the agent trained within AGILE learns to construct arrangements as instructed. Finally, we study how well AGILE’s reward model generalises beyond the examples on which it was trained. Our experiments show it can be reused to allow the policy to adapt to changes in the environment.
31
+
32
+ # 2 ADVERSARIAL GOAL-INDUCED LEARNING FROM EXAMPLES
33
+
34
+ Here, we introduce AGILE (“Adversarial Goal-Induced Learning from Examples”, in homage to the adversarial learning mechanisms that inspire it), a framework for jointly learning to model reward for instructions, and learn a policy from such a reward model. Specifically, we learn an instructionconditional policy $\pi _ { \theta }$ with parameters $\theta$ , from a data stream ${ \mathcal { G } } ^ { \pi _ { \theta } }$ obtained from interaction with the environment, by adjusting $\theta$ to maximise the expected total reward $R _ { \pi } ( \theta )$ based on stepwise reward $\hat { r } _ { t }$ given to the policy, exactly as done in any normal Reinforcement Learning setup. The difference lies in the source of the reward: we introduce an additional discriminator network $D _ { \phi }$ , the reward model, whose purpose is to define a meaningful reward function for training $\pi _ { \theta }$ . We jointly learn this reward model alongside the policy by training it to predict whether a given state $s$ is a goal state for a given instruction $c$ or not. Rather than obtain positive and negative examples of hinstruction, statei pairs from a purely static dataset, we sample them from a policy-dependent data stream. This stream is defined as follows: positive examples are drawn from a fixed dataset $\mathcal { D }$ of instructions $c _ { i }$ paired with goal states $s _ { i }$ ; negative examples are drawn from a constantly-changing buffer of states obtained from the policy acting on the environment, paired with the instruction given to the policy. Formally, the policy is trained to maximize a return $R _ { \pi } ( \theta )$ and the reward model is trained to minimize a cross-entropy loss $L _ { D } ( \phi )$ , the equations for which are:
35
+
36
+ $$
37
+ \begin{array} { r l } & { R _ { \pi } ( \theta ) = \underset { ( c , s _ { 1 : \infty } ) \sim \mathcal { G } ^ { \pi _ { \theta } } } { \mathbb { E } } \underset { t = 1 } { \overset { \infty } { \sum } } \gamma ^ { t - 1 } \hat { r } _ { t } + \alpha H ( \pi _ { \theta } ) , } \\ & { L _ { D } ( \phi ) = \underset { ( c , s ) \sim \mathcal { B } } { \overset { \mathbb { E } } { \sum } } - \log ( 1 - D _ { \phi } ( c , s ) ) + \underset { ( c _ { i } , g _ { i } ) \sim \mathcal { D } } { \overset { \mathbb { E } } { \sum } } - \log D _ { \phi } ( c _ { i } , g _ { i } ) . } \end{array}
38
+ $$
39
+
40
+ where
41
+
42
+ $$
43
+ \hat { r } _ { t } = [ D _ { \phi } ( c , s _ { t } ) > 0 . 5 ]
44
+ $$
45
+
46
+ In the equations above, the Iverson Bracket $[ \ldots ]$ maps truth to 1 and falsehood to 0, e.g. $[ x > 0 ] = 1$ iff $x > 0$ and 0 otherwise. $\gamma$ is the discount factor. With $\left( c , s _ { 1 : \infty } \right) \sim \mathcal { G } ^ { \pi _ { \theta } }$ , we denote a state trajectory that was obtained by sampling $( c , s _ { 0 } ) \sim \mathcal { G }$ and running $\pi _ { \theta }$ conditioned on $c$ starting from $s _ { 0 }$ . $\boldsymbol { B }$ denotes a replay buffer to which $( c , s )$ pairs from $T$ -step episodes are added; i.e. it is the undiscounted occupancy measure over the first $T$ steps. $D _ { \phi } ( c , s )$ is the probability of $( c , s )$ having a positive label according to the reward model, and thus $[ D _ { \phi } ( c , s _ { t } ) > 0 . 5 ]$ indicates that a given state $s _ { t }$ is more likely to be a goal state for instruction $c$ than not, according to $D$ . $H ( \pi _ { \theta } )$ is the policy’s entropy, and $\alpha$ is a hyperparameter. The approach is illustrated in $\mathrm { F i g } 2$ . Pseudocode is available in Appendix A. We note that Equation 1 differs from a traditional RL objective only in that the modelled reward $\hat { r } _ { t }$ is used instead of the ground-truth reward $r _ { t }$ . Indeed, in Section 3, we will compare policies trained with AGILE to policies trained with traditional RL, simply by varying the reward source from the reward model to the environment.
47
+
48
+ ![](images/7a23a3d803eaf3a9901e9f80bc9ea7cb176c0bac50983c8064c0edc771e9ccca.jpg)
49
+ Figure 2: Information flow during AGILE training. The policy acts conditioned on the instruction and is trained using the reward from the reward model (Figure 2a). The reward model is trained, as a discriminator, to distinguish between “A”, the hinstruction, goal-statei pairs from the dataset (Figure 2b), and “B”, the hinstruction, statei pairs from the agent’s experience.
50
+
51
+ Dealing with False Negatives Let us call $\Gamma ( c )$ the objective set of goal states which satisfy instruction $c$ (which is typically unknown to us). Compared to the ideal case where all $( c , s )$ would be deemed positive if-and-only-if $s \in \Gamma ( c )$ , the labelling of examples implied by Equation 2 has a fundamental limitation when the policy performs well. As the policy improves, by definition, a increasing share of $( c , s ) \in B$ are objective goal-states from $\Gamma ( c )$ . However, as they are treated as negative examples in Equation 2, the discriminator accuracy drops, causing the policy to get worse. We therefore propose the following simple heuristic to rectify this fundamental limitation by approximately identifying the false negatives. We rank $( c , s )$ examples in $\boldsymbol { B }$ according to the reward model’s output $D _ { \phi } ( c , s )$ and discard the top $1 - \rho$ percent as potential false negatives. Only the other $\rho$ percent are used as negative examples of the reward model. Formally speaking, the first term in Equation 2 becomes $\mathbb { E } _ { ( c , s ) \sim \mathcal { B } _ { D _ { \phi } , \rho } } - \log ( 1 - D _ { \phi } ( c , s ) )$ , where $B _ { D _ { \phi } , \rho }$ stands for the $\rho$ percent of $\boldsymbol { B }$ selected, using $D _ { \phi }$ , as described above. We will henceforth refer to $\rho$ as the anticipated negative rate. Setting $\rho$ to $100 \%$ means using ${ \cal B } _ { D _ { \phi } , 1 0 0 } = { \cal B }$ like in Equation 2, but our preliminary experiments have shown clearly that this inhibits the reward model’s capability to correctly learn a reward function. Using too small a value for $\rho$ on the other hand may deprive the reward model of the most informative negative examples. We thus recommend to tune $\rho$ as a hyperparameter on a task-specific basis.
52
+
53
+ Reusability of the Reward Model An appealing advantage of AGILE is the fact that the reward model $D _ { \phi }$ and the policy $\pi _ { \theta }$ learn two related but distinct aspects of an instruction: the reward model focuses on recognizing the goal-states (what should be done), whereas the policy learns what to do in order to get to a goal-state (how it should be done). The intuition motivating this design is that the knowledge about how instructions define goals should generalize more strongly than the knowledge about which behavior is needed to execute instructions. Following this intuition, we propose to reuse a reward model trained in AGILE as a reward function for training or fine-tuning policies.
54
+
55
+ Relation to GAIL AGILE is strongly inspired by—and retains close relations to—Generative Adversarial Imitation Learning (GAIL; Ho & Ermon, 2016), which likewise trains both a reward function and a policy. The former is trained to distinguish between the expert’s and the policy’s trajectories, while the latter is trained to maximize the modelled reward. GAIL differs from AGILE in a number of important respects. First, AGILE is conditioned on instructions $c$ so a single AGILE agent can learn combinatorially many skills rather than just one. Second, in AGILE the reward model observes only states $s _ { i }$ (either goal states from an expert, or states from the agent acting on the environment) rather than state-action traces $( s _ { 1 } , a _ { 1 } ) , ( s _ { 2 } , a _ { 2 } ) , \ldots .$ , learning to reward the agent based on “what” needs to be done rather than according to “how” it must be done. Finally, in AGILE the policy’s reward is the thresholded probability $\big [ D _ { \phi } ( c , s _ { t } ) \big ]$ as opposed to the log-probability $\log D _ { \phi } ( s _ { t } , a _ { t } )$ used in GAIL. Our reasoning for this change is that, when adapted to the setting with goal-specifications, a GAIL-style reward $\log D _ { \phi } ( c , s _ { t } )$ could take arbitrarily low values for intermediate states visited by the agent, as the reward model $D _ { \phi }$ becomes confident that those are not goal states. Empirically, we found that dropping the logarithm from GAIL-style rewards is indeed crucial for AGILE’s performance, and that using the probability $D _ { \phi } ( c , s _ { t } )$ as the reward $\hat { r _ { t } }$ results in a performance level similar to that of the discretized AGILE reward $\hat { r _ { t } } = [ D _ { \phi } ( c , s _ { t } ) ]$ .
56
+
57
+ # 3 EXPERIMENTS
58
+
59
+ We experiment with AGILE in a grid world environment that we call GridLU, short for Grid Language Understanding and after the famous SHRDLU world (Winograd, 1972). GridLU is a fully observable grid world in which the agent can walk around the grid (moving up, down left or right), pick blocks up and drop them at new locations (see Figure 3 for an illustration and Appendix C for a detailed description of the environment).
60
+
61
+ # 3.1 MODELS
62
+
63
+ All our models receive the world state as a 56x56 RGB image. With regard to processing the instruction, we will experiment with two kinds of models: Neural Module Networks (NMN) that treat the instruction as a structured expression, and a generic model that takes an unstructured instruction representation and encodes it with an LSTM.
64
+
65
+ Because the language of our instructions is generated from a simple grammar, we perform most of our experiments using policy and reward model networks that are constructed using the NMN (Andreas et al., 2016) paradigm. NMN is an elegant architecture for grounded language processing in which a tree of neural modules is constructed based on the language input. The visual input is then fed to the leaf modules, which send their outputs to their parent modules, which process is repeated until the root of the tree. We mimick the structure of the instructions when constructing the tree of modules; for example, the NMN corresponding to the instruction $c _ { 1 } = _ { \it { 1 } }$ NorthFrom(Color(‘red’, Shape(‘circle’, SCENE)), Color(‘blue’, Shape(‘square’, SCENE))) performs a computation $h _ { N M N } = m _ { N o r t h F r o m } ( m _ { r e d } ( m _ { c i r c l e } ( h _ { s } ) ) , m _ { b l u e } ( m _ { s q u a r e } ( h _ { s } ) ) ) _ { K } ^ { }$ ), where $m _ { x }$ denotes the module corresponding to the token $x$ , and $h _ { s }$ is a representation of state $s$ . Each module $m _ { x }$ performs a convolution (weights shared by all modules) followed by a token-specific Feature-Wise Linear Modulation (FiLM) (Perez et al., 2017): $m _ { x } ( h _ { l } , h _ { r } ) = R e L U ( ( 1 + \gamma _ { x } ) \odot ( W _ { m ^ { * } } [ h _ { l } ; h _ { r } ] ) \oplus \beta _ { x } )$ , where $h _ { l }$ and $h _ { r }$ are module inputs, $\gamma _ { x }$ is a vector of FiLM multipliers, $\beta _ { x }$ are FiLM biases, $\odot$ and $\oplus$ are element-wise multiplication and addition with broadcasting, $^ *$ denotes convolution. The representation $h _ { s }$ is produced by a convnet. The NMN’s output $h _ { N M N }$ undergoes max-pooling and is fed through a 1-layer MLP to produce action probabilities or the reward model’s output. Note, that while structure-wise our policy and reward model are mostly similar, they do not share parameters.
66
+
67
+ NMN is an excellent model when the language structure is known, but this may not be the case for natural language. To showcase AGILE’s generality we also experiment with a very basic structure-agnostic architecture. We use FiLM to condition a standard convnet on an instruction representation $h _ { L S T M }$ produced by an LSTM. The $k$ -th layer of the convnet performs a computation $h _ { k } = R e L U ( ( 1 + \gamma _ { k } ) \odot ( W _ { k } * h _ { k - 1 } ) \oplus \beta _ { k } )$ e $\gamma _ { k } = W _ { k } ^ { \gamma } h _ { L S T M } + b _ { k } ^ { \gamma }$ , e $\bar { \beta } _ { k } = W _ { k } ^ { \beta } h _ { L S T M } + b _ { k } ^ { \beta }$ $h _ { N M N }$
68
+ output $h _ { 5 }$ of the $5 ^ { \mathrm { t h } }$ layer of the convnet.
69
+
70
+ In the rest of the paper we will refer to the architectures described above as FiLM-NMN and FiLMLSTM respectively. FiLM-NMN will be the default model in all experiments unless explicitly specified otherwise. Detailed information about network architectures can be found in Appendix G.
71
+
72
+ # 3.2 TRAINING DETAILS
73
+
74
+ For the purpose of training the policy networks both within AGILE, and for our baseline trained from ground-truth reward $r _ { t }$ instead of the modelled reward $\hat { r } _ { t }$ , we used the Asynchronous Advantage Actor-Critic (A3C; Mnih et al., 2016). Any alternative training mechanism which uses reward could be used—since the only difference in AGILE is the source of the reward signal, and for any such alternative the appropriate baseline for fair comparison would be that same algorithm applied to train a policy from ground-truth reward. We will refer to the policy trained within AGILE as AGILE-A3C. The A3C’s hyperparameters $\gamma$ and $\lambda$ were set to 0.99 and 0 respectively, i.e. we did not use without temporal difference learning for the baseline network. The length of an episode was 30, but we trained the agent on advantage estimation rollouts of length 15. Every experiment was repeated 5 times. We considered an episode to be a success if the final state was a goal state as judged by a task-specific success criterion, which we describe for the individual tasks below. We use the success rate (i.e. the percentage of successful episodes) as our main performance metric for the agents. Unless otherwise specified we use the NMN-based policy and reward model in our experiments. Full experimental details can be found in Appendix D.
75
+
76
+ ![](images/a27f583ee14d93edac88f671893fa868066b6ac8347ca3949bdbc4d921fd2c69.jpg)
77
+ Figure 3: Initial state and goal state for GridLU-Relations (top-left) and GridLU-Arrangements episodes (bottom-left), and the complete GridLU-Arrangements vocabulary (right), each with examples of some possible goal-states.
78
+
79
+ Our first task, GridLU-Relations, is an adaptation of the SHAPES visual question answering dataset (Andreas et al., 2016) in which the blocks can be moved around freely. GridLU-Relations requires the agent to induce the meaning of spatial relations such as above or right of, and to manipulate the world in order to instantiate these relationships. Named GridLU-Relations, the task involves five spatial relationships (NorthFrom, SouthFrom, EastFrom, WestFrom, SameLocation), whose arguments can be either the blocks, which are referred to by their shapes and colors, or the agent itself. To generate the full set of possible instructions spanned by these relations and our grid objects, we define a formal grammar that generates strings such as:
80
+
81
+ NorthFrom(Color(‘red’, Shape(‘circle’, SCENE)), Color(‘blue’, Shape(‘square’, SCENE)))
82
+
83
+ This string carries the meaning ‘put a red circle north from (above) a blue square’. In general, when a block is the argument to a relation, it can be referred to by specifying both the shape and the color, like in the example above, or by specifying just one of these attributes. In addition, the AGENT constant can be an argument to all relations, in which case the agent itself must move into a particular spatial relation with an object. Figure 3 shows two examples of GridLU-Relations instructions and their respective goal states. There are 990 possible instructions in the GridLU-Relations task, and the number of distinct training instances can be loosely lower-bounded by $1 . 8 \cdot 1 0 ^ { 7 }$ (see Appendix E for details).
84
+
85
+ Notice that, even for the highly concrete spatial relationships in the GridLU-Relations language, the instructions are underspecified and somewhat ambiguous—is a block in the top-right corner of the grid above a block in the bottom left corner? We therefore decided (arbitrarily) to consider all relations to refer to immediate adjacency (so that Instruction equation 3 is satisfied if and only if there is a red circle in the location immediately above a blue square). Notice that the commands are still underspecified in this case (since they refer to the relationship between two entities, not their absolute positions), even if the degree of ambiguity in their meaning is less than in many real-world cases. The policy and reward model trained within AGILE then have to infer this specific sense of what these spatial relations mean from goal-state examples, while the baseline agent is allowed to access our programmed ground-truth reward. The binary ground-truth reward (true if the state is a goal state) is also used as the success criterion for evaluating AGILE.
86
+
87
+ Having formally defined the semantics of the relationships and programmed a reward function, we compared the performance of an AGILE-A3C agent against a priviliged baseline A3C agent trained using ground-truth reward. Interestingly, we found that AGILE-A3C learned the task more easily than standard A3C (see the respective curves in Figure 4). We hypothesize this is because the modeled rewards are easy to learn at first and become more sparse as the reward model slowly improves. This naturally emerging curriculum expedites learning in the AGILE-A3C when compared to the A3C-trained policy that only receives signal upon reaching a perfect goal state.
88
+
89
+ We did observe, however, that the A3C algorithm could be improved significantly by applying the auxiliary task of reward prediction (RP; Jaderberg et al., 2016), which was applied to language learning tasks by Hermann et al. (2017) (see the A3C and A3C-RP curves in Figure 4). This objective reinforces the association between instructions and states by having the agent replay the states immediately prior to a non-zero reward and predict whether or not it the reward was positive (i.e. the states match the instruction) or not. This mechanism made a significant difference to the A3C performance, increasing performance to $9 9 . 9 \%$ . AGILE-A3C also achieved nearly perfect performance $( 9 9 . 5 \% )$ ). We found this to be a very promising result, since within AGILE, we induce the reward function from a limited set of examples.
90
+
91
+ The best results with AGILE-A3C were obtained using the anticipated negative rate $\rho = 2 5 \%$ . When we used larger values of $\rho$ AGILE-A3C training started quicker but after 100-200 million steps the performance started to deteriorate (see AGILE curves in Figure 4), while it remained stable with $\bar { \rho } = 2 5 \%$ .
92
+
93
+ Data efficiency These results suggest that the AGILE reward model was able to induce a near perfect reward function from a limited set of hinstruction, goal-statei pairs. We therefore explored how small this training set of examples could be to achieve reasonable performance. We found that with a training set of only 8000 examples, the AGILE-A3C agent could reach a performance of $60 \%$ (massively above chance). However, the optimal performance was achieved with more than 100,000 examples. The full results are available in Appendix D.
94
+
95
+ Generalization to Unseen Instructions In the experiments we have reported so far the AGILE agent was trained on all 990 possible GridLU-Relation instructions. In order to test generalization to unseen instructions we held out $10 \%$ of the instructions as the test set and used the rest $90 \%$ as the training set. Specifically, we restricted the training instances and hinstruction, goal-statei pairs to only contain instructions from the training set. The performance of the trained model on the test instructions was the same as on the training set, showing that AGILE did not just memorise the training instructions but learnt a general interpretation of GridLU-Relations instructions.
96
+
97
+ AGILE with Structure-Agnostic Models We report the results for AGILE with a structureagnostic FILM-LSTM model in Figure 4 (middle). AGILE with $\rho = 2 5 \%$ achieves a high $9 7 . 5 \%$ success rate, and notably it trains almost as fast as an RL-RP agent with the same architecture.
98
+
99
+ ![](images/fbde7ef34d849ffb38f216394e38de05042e533ab4bbd67b6c63a27658b7dd30.jpg)
100
+ Figure 4: Left: learning curves for A3C, A3C-RP (both using ground truth reward), and AGILE-A3C with different values of the anticipated negative rate $\rho$ on the GridLU-Relations task. We report success rate (see Section 3). Middle: learning curves for policies trained with ground-truth RL, and within AGILE, with different model architectures. Right: the reward model’s accuracy for different values of $\rho$ .
101
+
102
+ Analyzing the reward model We compare the binary reward provided by the reward model with the ground-truth from the environment during training on the GridLU-Relation task. With $\rho = 2 5 \%$ the accuracy of the reward model peaks at $9 9 . 5 \%$ . As shown in Figure 4 (right) the reward model learns faster in the beginning with larger values of $\rho$ but then deteriorates, which confirms our intuition about why $\rho$ is an important hyperparameter and is aligned with the success rate learning curves in Figure 4 (left). We also observe during training that the false negative rate is always kept reasonably low ( ${ < } 3 \%$ of rewards) whereas the reward model will initially be more generous with false positives $( 2 0 - 5 0 \%$ depending on $\rho$ during the first 20M steps of training) and will produce an increasing number of false positives for insufficiently small values of $\rho$ (see plots in Appendix E). We hypothesize that early false positives may facilitate the policy’s training by providing it with a sort of curriculum, possibly explaining the improvement over agents trained from ground-truth reward, as shown above.
103
+
104
+ The reward model as general reward function An instruction-following agent should be able to carry-out known instructions in a range of different contexts, not just settings that match identically the specific setting in which those skills were learned. To test whether the AGILE framework is robust to (semantically-unimportant) changes to the environment dynamics, we first trained the policy and reward model as normal and then modified the effective physics of the world by making all red square objects immovable. In this case, following instructions correctly is still possible in almost all cases, but not all solutions available during training are available at test time. As expected, this change impaired the policy and the agent’s success rate on the instructions referring to a red square dropped from $9 8 \%$ to $5 2 \%$ . However, after fine-tuning the policy (additional training of the policy on the test episodes using the reward from the previously-trained-then-frozen reward model), the success rate went up to $6 \bar { 9 } . 3 \%$ (Figure 5). This experiment suggests that the AGILE reward model learns useful and generalisable linguistic knowledge. The knowledge can be applied to help policies adapt in scenarios where the high-level meaning of commands is familiar but the low-level physical dynamics is not.
105
+
106
+ ![](images/2ff77a80cae73f9ec07c52cbe8d89e4308ff7516b5e4c9d5205601c00b54ddd2.jpg)
107
+ Figure 5: Fine-tuning for an immovable red square.
108
+
109
+ # 3.4 GRIDLU-ARRANGEMENTS TASK
110
+
111
+ The experiments thus far demonstrate that even without directly using the reward function AGILEA3C performs comparably to its pure A3C counter-part. However, the principal motivation for the AGILE framework is to avoid programming the reward function. To model this setting more explicitly, we developed the task GridLU-Arrangements, in which each instruction is associated with multiple viable goal-states that share some (more abstract) common form. The complete set of instructions and forms is illustrated in Figure 3. To get training data, we built a generator to produce random instantiations (i.e. any translation, rotation, reflection or color mapping of the illustrated forms) of these goal-state classes, as positive examples for the reward model. In the real world, this process of generating goal-states could be replaced by finding, or having humans annotate, labelled images. In total, there are 36 possible instructions in GridLU-Arrangements, which together refer to a total of 390 million correct goal-states (see Appendix F for details). Despite this enormous space of potentially correct goal-states, we found that for good performance it was necessary to train AGILE on only 100,000 (less than $0 . 3 \%$ ) of these goal-states, sampled from the same distribution as observed in the episodes. To replicate the conditions of a potential AGILE application as close as possible, we did not write a reward function for GridLU-Arrangements (even though it would have been theoretically possible), and instead carried out all evaluation manually.
112
+
113
+ The training regime for GridLU-Arrangements involved two classes of episodes (and instructions). Half of the episodes began with four square blocks (all of the same color), and the agent, in random unique positions, and an instruction sampled uniformly from the list of possible arrangement words. In the other half of the episodes, four square blocks of one color and four square blocks of a different color were initially each positioned randomly. The instruction in these episodes specified one of the two colors together with an arrangement word. We trained policies and reward models using AGILE with 10 different seeds for each level, and selected the best pair based on how well the policy maximised modelled reward. We then manually assessed the final state of each of 200 evaluation episodes, using human judgement that the correct shape has been produced as success criterion to evaluate AGILE. We found that the agent made the correct arrangement in $58 \%$ of the episodes. The failure cases were almost always in the episodes involving eight blocks1. In these cases, the AGILE agent tended towards building the correct arrangement, but was impeded by the randomly positioned non-target-color blocks and could not recover. Nonetheless, these scores, and the compelling behaviour observed in the video (https://www.youtube.com/watch? $\scriptstyle \mathtt { V } = 0$ 7S-x3MkEoQ), demonstrate the potential of AGILE for teaching agents to execute semantically vague or underspecified instructions.
114
+
115
+ # 4 RELATED WORK
116
+
117
+ Learning to follow language instructions has been approached in many different ways, for example by reinforcement learning using a reward function programmed by a system designer. Janner et al. (2017); Oh et al. (2017); Hermann et al. (2017); Chaplot et al. (2018); Denil et al. (2017); Yu et al. (2018) consider instruction-following in 2D or 3D environments and reward the agent for arriving at the correct location or object. Janner et al. (2017) and Misra et al. (2017) train RL agents to produce goal-states given instructions. As discussed, these approaches are constrained by the difficulty of programming language-related reward functions, a task that requires an programming expert, detailed access to the state of the environment and hard choices above how language should map to the world. Agents can be trained to follow instructions using complete demonstrations, that is sequences of correct actions describing instruction execution for given initial states.
118
+
119
+ Chen & Mooney (2011); Artzi & Zettlemoyer (2013) train semantic parsers to produce a formal representation of the query that when fed to a predefined execution model matches exactly the sequence of actions from the demonstration. Andreas & Klein (2015); Mei et al. (2016) sidestep the intermediate formal representation and train a Conditional Random Field (CRF) and a sequenceto-sequence neural model respectively to directly predict the actions from the demonstrations. A underlying assumption behind all these approaches is that the agent and the demonstrator share the same actuation model, which might not always be the case. In the case of navigational instructions the trajectories of the agent and the demonstrators can sometimes be compared without relying on the actions, like e.g. Vogel & Jurafsky (2010), but for other types of instructions such a hard-coded comparison may be infeasible. Tellex et al. (2011) train a log-linear model to map instruction constituents into their groundings, which can be objects, places, state sequences, etc. Their approach requires access to a structured representation of the world environment as well as intermediate supervision for grounding the constituents.
120
+
121
+ Our work can be categorized as apprenticeship (imitation) learning, which studies learning to perform tasks from demonstrations and feedback. Many approaches to apprenticeship learning are variants of inverse reinforcement learning (IRL), which aims to recover a reward function from expert demonstrations (Abbeel & Ng, 2004; Ziebart et al., 2008). As stated at the end of Section 2, the method most closely related to AGILE is the GAIL algorithm from the IRL family (Ho & Ermon, 2016). There have been earlier attempts to use IRL-style methods for instruction following (MacGlashan et al., 2015; Williams et al., 2018), but unlike AGILE, they relied on the availability of a formal reward specification language. To our knowledge, ours and the concurrent work by Fu et al. (2018) are the first works to showcase learning reward models for instructions from pixels directly. Besides IRL-style approaches, other apprenticeship learning methods involve training a policy (Knox & Stone, 2009; Warnell et al., 2017) or a reward function (Wilson et al., 2012; Christiano et al., 2017) directly from human feedback. Several recent imitation learning works consider using goal-states directly for defining the task (Ganin et al., 2018; Pathak et al., 2018). AGILE differs from these approaches in that goal-states are only used to train the reward module, which we show generalises to new environment configurations or instructions, relative to those seen in the expert data.
122
+
123
+ # 5 DISCUSSION
124
+
125
+ We have proposed AGILE, a framework for training instruction-conditional RL agents using rewards from learned reward models, which are jointly trained from data provided by both experts and the agent being trained, rather than reward provided by an instruction interpreter within the environment. This opens up new possibilities for training language-aware agents: in the real world, and even in rich simulated environments (Brodeur et al., 2017; Wu et al., 2018), acquiring such data via human annotation would often be much more viable than defining and implementing reward functions programmatically. Indeed, programming rewards to teach robust and general instruction-following may ultimately be as challenging as writing a program to interpret language directly, an endeavour that is notoriously laborious (Winograd, 1971), and some say, ultimately futile (Winograd, 1972).
126
+
127
+ As well as a means to learn from a potentially more prevalent form of data, our experiments demonstrate that policies trained in the AGILE framework perform comparably with and can learn as fast as those trained against ground-truth reward and additional auxiliary tasks. Our analysis of the reward model’s classifications gives a sense of how this is possible; the false positive decisions that it makes early in the training help the policy to start learning. The fact that AGILEs objective attenuates learning issues due to the sparsity of reward states within episodes in a manner similar to reward prediction suggests that the reward model within AGILE learns some form of shaped reward $( \mathrm { N g }$ et al., 1999), and could serve not only in the cases where a reward function need to be learned in the absence of true reward, but also in cases where environment reward is defined but sparse. As these cases are not the focus of this study, we note this here, but leave such investigation for future work.
128
+
129
+ As the policy improves, false negatives can cause the reward model accuracy to deteriorate. We determined a simple method to mitigate this, however, leading to robust training that is comparable to RL with reward prediction and unlimited access to a perfect reward function. Another attractive aspect of AGILE is that learning “what should be done” and “how it should be done” is performed by two different model components. Our experiments confirm that the “what” kind of knowledge generalizes better to new environments. When the dynamics of the environment changed at test time, fine-tuning using frozen reward model allowed to the policy recover some of its original capability in the new setting.
130
+
131
+ While there is a large gap to be closed between the sort of tasks and language experimented with in this paper and those which might be presented in “real world” situations or more complex environments, our results provide an encouraging first step in this direction. Indeed, it is interesting to consider how AGILE could be applied to more realistic learning settings, for instance involving first-person vision of 3D environments. Two issues would need to be dealt with, namely training the agent to factor out the difference in perspective between the expert data and the agent’s observations, and training the agent to ignore its own body parts if they are visible in the observations. Future work could focus on applying third-person imitation learning methods recently proposed by Stadie et al. (2017) learn the aforementioned invariances. Most of our experiments were conducted with a formal language with a known structure, however AGILE also performed very well when we used a structure-agnostic FiLM-LSTM model which processed the instruction as a plain sequence of tokens. This result suggest that in future work AGILE could be used with natural language instructions.
132
+
133
+ # ACKNOWLEDGMENTS
134
+
135
+ The authors want to thank Serkan Cabi for providing useful feedback. This research was enabled in part by support provided by Compute Canada (www.computecanada.ca).
136
+
137
+ # REFERENCES
138
+
139
+ Pieter Abbeel and Andrew Y. Ng. Apprenticeship Learning via Inverse Reinforcement Learning. In Proceedings of the Twenty-first International Conference on Machine Learning, ICML ’04, 2004. URL http://doi.acm.org/10.1145/1015330.1015430.
140
+
141
+ Jacob Andreas and Dan Klein. Alignment-Based Compositional Semantics for Instruction Following. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, 2015.
142
+
143
+ Jacob Andreas, Marcus Rohrbach, Trevor Darrell, and Dan Klein. Neural Module Networks. In Proceedings of 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016. URL http://arxiv.org/abs/1511.02799.
144
+
145
+ Yoav Artzi and Luke Zettlemoyer. Weakly supervised learning of semantic parsers for mapping instructions to actions. Transactions of the Association for Computational Linguistics, 1:49–62, 2013.
146
+
147
+ Simon Brodeur, Ethan Perez, Ankesh Anand, Florian Golemo, Luca Celotti, Florian Strub, Jean Rouat, Hugo Larochelle, and Aaron Courville. HoME: a Household Multimodal Environment. arXiv:1711.11017 [cs, eess], November 2017. URL http://arxiv.org/abs/1711. 11017. arXiv: 1711.11017.
148
+
149
+ Devendra Singh Chaplot, Kanthashree Mysore Sathyendra, Rama Kumar Pasumarthi, Dheeraj Rajagopal, and Ruslan Salakhutdinov. Gated-Attention Architectures for Task-Oriented Language Grounding. In Proceedings of 32nd AAAI Conference on Artificial Intelligence, 2018. URL http://arxiv.org/abs/1706.07230.
150
+
151
+ David L. Chen and Raymond J. Mooney. Learning to Interpret Natural Language Navigation Instructions from Observations. In Proceedings of the Twenty-Fifth AAAI Conference on Artificial Intelligence, pp. 859–865, 2011. URL http://dl.acm.org/citation.cfm?id= 2900423.2900560.
152
+
153
+ 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. 4302–4310, 2017.
154
+
155
+ Misha Denil, Sergio Gmez Colmenarejo, Serkan Cabi, David Saxton, and Nando de Freitas. Programmable Agents. arXiv:1706.06383 [cs, stat], June 2017. URL http://arxiv.org/abs/ 1706.06383.
156
+
157
+ Justin Fu, Anoop Korattikara, Sergey Levine, and Sergio Guadarrama. From Language to Goals: Inverse Reinforcement Learning for Vision-Based Instruction Following. In International Conference on Learning Representations, September 2018. URL https://openreview.net/ forum?id ${ \bf \Phi } = { \bf \Phi }$ r1lq1hRqYQ.
158
+
159
+ Yaroslav Ganin, Tejas Kulkarni, Igor Babuschkin, S. M. Ali Eslami, and Oriol Vinyals. Synthesizing Programs for Images using Reinforced Adversarial Learning. arXiv:1804.01118 [cs, stat], April 2018. URL http://arxiv.org/abs/1804.01118. arXiv: 1804.01118.
160
+
161
+ Karl Moritz Hermann, Felix Hill, Simon Green, Fumin Wang, Ryan Faulkner, Hubert Soyer, David Szepesvari, Wojciech Marian Czarnecki, Max Jaderberg, Denis Teplyashin, Marcus Wainwright, Chris Apps, Demis Hassabis, and Phil Blunsom. Grounded Language Learning in a Simulated 3d World. arXiv:1706.06551 [cs, stat], June 2017. URL http://arxiv.org/abs/1706. 06551.
162
+
163
+ Jonathan Ho and Stefano Ermon. Generative adversarial imitation learning. In Advances in Neural Information Processing Systems, pp. 4565–4573, 2016.
164
+
165
+ Max Jaderberg, Volodymyr Mnih, Wojciech Marian Czarnecki, Tom Schaul, Joel Z. Leibo, David Silver, and Koray Kavukcuoglu. Reinforcement Learning with Unsupervised Auxiliary Tasks. In ICLR, November 2016. URL http://arxiv.org/abs/1611.05397.
166
+
167
+ Michael Janner, Karthik Narasimhan, and Regina Barzilay. Representation Learning for Grounded Spatial Reasoning. Transactions of the Association for Computational Linguistics, July 2017. URL http://arxiv.org/abs/1707.03938.
168
+
169
+ W Bradley Knox and Peter Stone. Interactively shaping agents via human reinforcement: The TAMER framework. In International Conference on Knowledge Capture, pp. 9–16, 2009.
170
+
171
+ James MacGlashan, Monica Babes-Vroman, Marie desJardins, Michael L. Littman, Smaranda Muresan, Shawn Squire, Stefanie Tellex, Dilip Arumugam, and Lei Yang. Grounding english commands to reward functions. In Robotics: Science and Systems, 2015.
172
+
173
+ Hongyuan Mei, Mohit Bansal, and Matthew R. Walter. Listen, Attend, and Walk: Neural Mapping of Navigational Instructions to Action Sequences. In Proceedings of the AAAI Conference on Artificial Intelligence, 2016. URL http://arxiv.org/abs/1506.04089.
174
+
175
+ Dipendra Misra, John Langford, and Yoav Artzi. Mapping Instructions and Visual Observations to Actions with Reinforcement Learning. In arXiv:1704.08795 [cs], April 2017. URL http: //arxiv.org/abs/1704.08795.
176
+
177
+ 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.
178
+
179
+ Andrew Y. Ng and Stuart Russell. Algorithms for Inverse Reinforcement Learning. In in Proc. 17th International Conf. on Machine Learning, pp. 663–670. Morgan Kaufmann, 2000.
180
+
181
+ Andrew Y Ng, Daishi Harada, and Stuart Russell. Policy invariance under reward transformations: Theory and application to reward shaping. In ICML, volume 99, pp. 278–287, 1999.
182
+
183
+ Junhyuk Oh, Satinder Singh, Honglak Lee, and Pushmeet Kohli. Zero-Shot Task Generalization with Multi-Task Deep Reinforcement Learning. In Proceedings of The 34st International Conference on Machine Learning, June 2017. URL http://arxiv.org/abs/1706.05064.
184
+
185
+ 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 International Conference on Learning Representations, 2018.
186
+
187
+ Ethan Perez, Florian Strub, Harm de Vries, Vincent Dumoulin, and Aaron Courville. FiLM: Visual Reasoning with a General Conditioning Layer. In In Proceedings of the AAAI Conference on Artificial Intelligence, 2017. URL http://arxiv.org/abs/1709.07871.
188
+
189
+ 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. URL http://www.jmlr.org/papers/volume15/ srivastava14a.old/source/srivastava14a.pdf.
190
+
191
+ Bradly C. Stadie, Pieter Abbeel, and Ilya Sutskever. Third-Person Imitation Learning. In ICLR, March 2017. URL http://arxiv.org/abs/1703.01703.
192
+
193
+ Stefanie Tellex, Thomas Kollar, Steven Dickerson, Matthew R. Walter, Ashis Gopal Banerjee, Seth Teller, and Nicholas Roy. Understanding Natural Language Commands for Robotic Navigation and Mobile Manipulation. In Twenty-Fifth AAAI Conference on Artificial Intelligence, August 2011. URL https://www.aaai.org/ocs/index.php/AAAI/AAAI11/paper/ view/3623.
194
+
195
+ Adam Vogel and Dan Jurafsky. Learning to Follow Navigational Directions. In Proceedings of the 48th Annual Meeting of the Association for Computational Linguistics, pp. 806–814. Association for Computational Linguistics, 2010. URL http://dl.acm.org/citation.cfm?id= 1858681.1858764.
196
+
197
+ Garrett Warnell, Nicholas Waytowich, Vernon Lawhern, and Peter Stone. Deep TAMER: Interactive agent shaping in high-dimensional state spaces. arXiv preprint arXiv:1709.10163, 2017.
198
+
199
+ Edward C Williams, Nakul Gopalan, Mine Rhee, and Stefanie Tellex. Learning to parse natural language to grounded reward functions with weak supervision. In 2018 IEEE International Conference on Robotics and Automation (ICRA), pp. 1–7. IEEE, 2018.
200
+
201
+ Aaron Wilson, Alan Fern, and Prasad Tadepalli. A Bayesian approach for policy learning from trajectory preference queries. In Advances in Neural Information Processing Systems, pp. 1133– 1141, 2012.
202
+
203
+ Terry Winograd. Procedures as a representation for data in a computer program for understanding natural language. Technical report, 1971.
204
+
205
+ Terry Winograd. Understanding natural language. Cognitive Psychology, 3(1):1–191, 1972. doi: 10. 1016/0010-0285(72)90002-3. URL http://linkinghub.elsevier.com/retrieve/ pii/0010028572900023.
206
+
207
+ Yi Wu, Yuxin Wu, Georgia Gkioxari, and Yuandong Tian. Building Generalizable Agents with a Realistic and Rich 3d Environment. arXiv:1801.02209 [cs], January 2018. URL http: //arxiv.org/abs/1801.02209. arXiv: 1801.02209.
208
+
209
+ Haonan Yu, Haochao Zhang, and Wei Xu. Interactive Grounded Language Acquisition and Generalization in 2d Environment. In ICLR, 2018. URL https://openreview.net/forum?id= H1UOm4gA-&noteId=H1UOm4gA-.
210
+
211
+ Brian D. Ziebart, Andrew Maas, J. Andrew Bagnell, and Anind K. Dey. Maximum Entropy Inverse Reinforcement Learning. In Proc. AAAI, pp. 1433–1438, 2008.
212
+
213
+ # A AGILE PSEUDOCODE
214
+
215
+ # Algorithm 1 AGILE Discriminator Training
216
+
217
+ Require: The policy network $\pi _ { \theta }$ , the discriminator network $D _ { \phi }$ , the anticipated negative rate $\rho$ , a dataset $\mathcal { D }$ , a replay buffer $B$ , the batch size $B S$ , a stream of training instances $\mathcal { G }$ , the episode length $T$ , the rollout length $R$ .
218
+ 1: while Not Converged do
219
+ 2: 3: Sample a training instance $( c , s _ { 0 } ) \in \mathcal { G }$ . $t \gets 0$ while $\mathfrak { t } \mathfrak { j }$ T do
220
+ 5: Act with $\pi _ { \boldsymbol { \theta } } ( c , s )$ and produce a rollout $\big ( c , s _ { t \dots t + R } \big )$ .
221
+ 6: Add $( c , s )$ pairs from $\big ( c , s _ { t . . . t + R } \big )$ to the replay buffer $B$ . Remove old pairs from $B$ if it is overflowing.
222
+ 7: Sample a batch $D _ { + }$ of $B S / 2$ positive examples from $\mathcal { D }$ .
223
+ 8: Sample a batch $D _ { - }$ of $B S / ( 2 \cdot ( 1 - \rho ) )$ negative $( c , s )$ examples from $B$ .
224
+ 9: Compute $\kappa = D _ { \phi } ( c , s )$ for all $( c , s ) \in D _ { - }$ and reject the top $1 - \rho$ percent of $D _ { - }$ with the highest $\kappa$ . The resulting $D _ { - }$ will contain $B S / 2$ examples.
225
+ 10: Compute L˜D(φ) = 1BS $\begin{array} { r } { \tilde { L } _ { D } ( \phi ) = \frac { 1 } { B S } \displaystyle \sum _ { ( c , s ) \in D _ { - } } - \log ( 1 - D _ { \phi } ( c , s ) ) + \displaystyle \sum _ { ( c , g ) \in D _ { + } } - \log D _ { \phi } ( c _ { i } , g _ { i } ) . } \end{array}$
226
+ 11: Compute the gradient $\frac { d \tilde { L } _ { D } ( \phi ) } { d \phi }$ and use it to update $\phi$ .
227
+ 12: Synchronise $\theta$ and $\phi$ with other workers.
228
+ 13: $t \gets t + R$
229
+ 14: end while
230
+ 15: end while
231
+
232
+ # Algorithm 2 AGILE Policy Training
233
+
234
+ Require: The policy network $\pi \theta$ , the discriminator network $D _ { \phi }$ , a dataset $\mathcal { D }$ , a replay buffer $B$ , a stream of
235
+ training instances $\mathcal { G }$ , the episode length $T$ .
236
+ 1: while Not Converged do
237
+ 2: Sample a training instance $( c , s _ { 0 } ) \in \mathcal { G }$ .
238
+ 3: $t \gets 0$
239
+ 4: while $\mathfrak { t } \mathfrak { j }$ T do
240
+ 5: Act with $\pi _ { \boldsymbol { \theta } } ( c , s )$ and produce a rollout $\big ( c , s _ { t \dots t + R } \big )$ .
241
+ 6: Use the discriminator $D _ { \phi }$ to compute the rewards $r _ { \tau } = [ D _ { \phi } ( c , s _ { \tau } ) > 0 . 5$ ].
242
+ 7: Perform an RL update for $\theta$ using the rewards $r _ { \tau }$ .
243
+ 8: Synchronise $\theta$ and $\phi$ with other workers.
244
+ 9: $t \gets t + R$
245
+ 10: end while
246
+ 11: end while
247
+
248
+ # B TRAINING DETAILS
249
+
250
+ We trained the policy $\pi _ { \theta }$ and the discriminator $D _ { \phi }$ concurrently using RMSProp as the optimizer and Asynchronous Advantage Actor-Critic (A3C) (Mnih et al., 2016) as the RL method. A baseline predictor (see Appendix G for details) was trained to predict the discounted return by minimizing the mean square error. The RMSProp hyperparameters were different for $\pi _ { \theta }$ and $D _ { \phi }$ , see Table 1. A designated worker was used to train the discriminator (see Algorithm 1). Other workers trained only the policy (see Algorithm 2). We tried having all workers write to the replay buffer $B$ that was used for the discriminator training and found that this gave the same performance as using $( c , s )$ pairs produced by the discriminator worker only. We found it crucial to regularize the discriminator by clipping columns of all weights matrices to have the L2 norm of at most 1. In particular, we multiply incoming weights $w _ { u }$ of each unit $u$ by $\operatorname* { m i n } ( 1 , 1 / | | w _ { u } | | _ { 2 } )$ after each gradient update as proposed by Srivastava et al. (2014). We linearly rescaled the policy’s rewards to the $[ 0 ; 0 . 1 ]$ interval for both RL and AGILE. When using RL with reward prediction we fetch a batch from the replay buffer and compute the extra gradient for every rollout.
251
+
252
+ For the exact values of hyperparameters for the GridLU-Relations task we refer the reader to Table 1. The hyperparameters for GridLU-Arrangements were mostly the same, with the exception of the episode length and the rollout length, which were 45 and 30 respectively. For training the RL baseline for GridLU-Relations we used the same hyperparameter settings as for the AGILE policy.
253
+
254
+ Table 1: Hyperparameters for the policy and the discriminator for the GridLU-Relations task.
255
+
256
+ <table><tr><td>Group</td><td>Hyperparameter</td><td>Policy T</td><td>Discriminator DΦ</td></tr><tr><td rowspan="5">RMSProp</td><td>learning rate</td><td>0.0003</td><td>0.0005</td></tr><tr><td>decay</td><td>0.99</td><td>0.9</td></tr><tr><td>E</td><td>0.1</td><td>10-10</td></tr><tr><td>grad. norm threshold</td><td>40</td><td>25</td></tr><tr><td>batch size</td><td>1</td><td>256</td></tr><tr><td rowspan="6">RL</td><td>rollout length</td><td>15</td><td>一</td></tr><tr><td>episode length</td><td>30</td><td></td></tr><tr><td>discount</td><td>0.99</td><td></td></tr><tr><td>reward scale</td><td>0.1</td><td></td></tr><tr><td>baseline cost</td><td>1.0</td><td></td></tr><tr><td>reward prediction cost (when used)</td><td>1.0</td><td></td></tr><tr><td rowspan="2"></td><td>reward prediction batch size</td><td>4</td><td></td></tr><tr><td>num. workers training πθ</td><td>15</td><td>1</td></tr><tr><td rowspan="2">AGILE</td><td>size of replay buffer B</td><td></td><td>100000</td></tr><tr><td>num. workers training D</td><td></td><td>1</td></tr><tr><td rowspan="2">Regularization</td><td>entropy weight α</td><td>0.01</td><td></td></tr><tr><td>max.column norm</td><td>一</td><td>1</td></tr></table>
257
+
258
+ # C GRIDLU ENVIRONMENT
259
+
260
+ The GridLU world is a $5 \times 5$ gridworld surrounded by walls. The cells of the grid can be occupied by blocks of 3 possible shapes (circle, triangle, and square) and 3 possible colors (red, blue, and green). The grid also contains an agent sprite. The agent may carry a block; when it does so, the agent sprite changes color2. When the agent is free, i.e. when it does not carry anything, it is able to enter cells with blocks. A free agent can pick a block in the cell where both are situated. An agent that carries a block cannot enter non-empty cells, but it can instead drop the block that it carries in any non-empty cell. Both picking up and dropping are realized by the INTERACT action. Other available actions are LEFT, RIGHT, UP and DOWN and NOOP. The GridLU agent can be seen as a cursor (and this is also how it is rendered) that can be moved to select a block or a position where the block should be released. Figure 6 illustrates the GridLU world and its dynamics. We render the state of the world as a color image by displaying each cell as an $8 \times 8$ patch3 and stitching these patches in a $5 6 \times 5 6$ image4. All neural networks take this image as an input.
261
+
262
+ # D EXPERIMENT DETAILS
263
+
264
+ Every experiment was repeated 5 times and the average result is reported.
265
+
266
+ RL vs. AGILE All agents were trained for $5 \cdot 1 0 ^ { 8 }$ steps.
267
+
268
+ Data Efficiency We trained AGILE policies with datasets $\mathcal { D }$ of different sizes for $5 \cdot 1 0 ^ { 8 }$ steps. For each policy we report the maximum success rate that it showed in the course of training.
269
+
270
+ GridLU-Arrangements We trained the agent for 100M time steps, saving checkpoints periodically, and selected the checkpoint that best fooled the discriminator according to the agent’s internal reward.
271
+
272
+ ![](images/12a0250876976a70960bac26e489bbd937d4fe99d9cd1f5858afab85a8ce8779.jpg)
273
+ Figure 6: The dynamics of the GridLU world illustrated by a 6-step trajectory. The order of the states is indicated by arrows. The agent’s actions are written above arrows.
274
+
275
+ ![](images/c88d0530b92562c4ac9494853f2e5d902ffac1c59f458c306a94a2da6a6f7ad0.jpg)
276
+ Figure 7: Performance of AGILE for different sizes of the dataset of instructions and goal-states. For each dataset size of we report is the best average success rate over the course of training.
277
+
278
+ Data Efficiency We measure how many examples of instructions and goal-states are required by AGILE in order to understand the semantics of the GridLU-Relations instruction language. The results are reported in Figure 7. The AGILE-trained agent succeeds in more than $50 \%$ of cases starting from 8000 examples, but as many as 130000 is required for the best performance.
279
+
280
+ # E ANALYSIS OF THE GRIDLU-RELATIONS TASK
281
+
282
+ # E.1 GRIDLU RELATIONS INSTANCE GENERATOR
283
+
284
+ All GridLU instructions can be generated from <instruction $>$ using the following Backus-Naur form, with one exception: The first expansion of ${ < } \mathrm { { o b j } } >$ must not be identical to the second expansion of ${ < } \mathrm { { o b j } } >$ in <bring to instruction>.
285
+
286
+ <shape> :: $=$ circle | rect | triangle <color> :: $=$ red | green | blue
287
+
288
+ <relation1> :: $=$ NorthFrom | SouthFrom | EastFrom | WestFrom <relation2> :: $=$ <relation1> | SameLocation
289
+
290
+ <obj> :: $=$ Color(<color>, <obj_part $2 >$ ) | Shape(<shape>, SCENE) <obj_part2> :: $=$ Shape(<shape>, SCENE) | SCENE
291
+
292
+ <go_to_instruction> :: $=$ <relation2 $>$ (AGENT, <obj>) | <relation2 $>$ (<obj>, AGENT) <bring_to_instruction> :: $=$ <relation1 $>$ (<obj>, <obj>) <instruction> :: $=$ <go_to_instruction> | <bring_to_instruction>
293
+
294
+ There are 15 unique possibilities to expand the nonterminal ${ < } \mathrm { { o b j } } >$ , so there are 150 unique possibilities to expand <go to instruction> and 840 unique possibilities to expand <bring to instruction> (not counting the exceptions mentioned above). Hence there are 990 unique instructions in total. However, several syntactically different instructions can be semantically equivalent, such as EastFrom(AGENT, Shape(rect, SCENE)) and WestFrom(Shape(rect, SCENE), AGENT).
295
+
296
+ Every instruction partially specifies what kind of objects need to be available in the environment. For go-to-instructions we generate one object and for bring-to-instructions we generate two objects according to this partial specification (unspecified shapes or colors are picked uniformly at random). Additionally, we generate one “distractor object”. This distractor object is drawn uniformly at random from the 9 possible objects. All of these objects and the agent are each placed uniformly at random into one of 25 cells in the 5x5 grid.
297
+
298
+ The instance generator does not sample an instruction uniformly at random from a list of all possible instructions. Instead, it generates the environment at the same time as the instruction according to the procedure above. Afterwards we impose two ‘sanity checks’: are any two objects in the same location or are they all identical? If any of these two checks fail, the instance is discarded and we start over with a new instance.
299
+
300
+ Because of this rejection sampling technique, go-to-instructions are ultimately generated with approximately $2 5 \%$ probability even though they only represent $\approx 1 5 \%$ of all possible instructions.
301
+
302
+ The number of different initial arrangements of three objects can be lower-bounded by ${ \binom { 9 } { 3 } } = 2 3 0 0$ if we disregard their permutation. Hence every bring-to-instruction has at least $K = 2 3 0 0 \cdot 9 \approx 2 \cdot 1 0 ^ { 4 }$ associated initial arrangements. Therefore the total number of task instances can be lower-bounded with $8 4 0 \cdot K \approx 1 . 7 \cdot 1 \bar { 0 } ^ { 7 }$ , disregarding the initial position of the agent.
303
+
304
+ # E.2 DISCRIMINATOR EVALUATION
305
+
306
+ During the training on GridLU-Relations we compared the predictions of the discriminator with those of the ground-truth reward checker. This allowed us to monitor several performance indicators of the discriminator, see Figure 8.
307
+
308
+ ![](images/53291bcc68bf3c2ec5c30716cb671107ce129a7f067fbe67d0e2bc3a1d397656.jpg)
309
+ Figure 8: The discriminator’s errors in the course of training. Left: percentage of false positives. Right: percentage of false negatives.
310
+
311
+ # F ANALYSIS OF THE GRIDLU-ARRANGEMENTS TASK
312
+
313
+ Instruction Syntax We used two types of instructions in the GridLU-Arrangements task, those referring only to the arrangement and others that also specified the color of the blocks. Examples Connected(AGENT, SCENE) and Snake(AGENT, Color(’yellow’, SCENE)) illustrate the syntax that we used for both instruction types.
314
+
315
+ Number of Distinct Goal-States Table 2 presents our computation of the number of distinct goal-states in the GridLU-Arrangements Task.
316
+
317
+ Table 2: Number of unique goal-states in GridLU-Arrangements task.
318
+
319
+ <table><tr><td></td><td>Possible arrangement</td><td>Possible colors</td><td>Possible agent positions</td><td>Possible distractor positions</td><td>Possible distractor colors</td><td></td></tr><tr><td>Arrangement</td><td>positions 16</td><td>3</td><td>25</td><td>5985</td><td></td><td>Total goal states 14,364,000</td></tr><tr><td>Square Line</td><td>40</td><td>3</td><td>25</td><td>5985</td><td>22</td><td>35,910,000</td></tr><tr><td>Dline</td><td>8</td><td>3</td><td>25</td><td>5985</td><td>2</td><td>7,182,000</td></tr><tr><td>Triangle</td><td>48</td><td>3</td><td>25</td><td>5985</td><td>2</td><td>43,092,000</td></tr><tr><td>Circle</td><td>9</td><td>3</td><td>25</td><td>5985</td><td>2</td><td>8,079,750</td></tr><tr><td>Eel</td><td>48</td><td>3</td><td>25</td><td>5985</td><td>2</td><td>43,092,000</td></tr><tr><td>Snake</td><td>48</td><td>3</td><td>25</td><td>5985</td><td>2</td><td>43,092,000</td></tr><tr><td>Connected</td><td>200</td><td>3</td><td>25</td><td>5985</td><td>2</td><td>179,550,000</td></tr><tr><td>Disconnected</td><td>17</td><td>3</td><td>25</td><td>5985</td><td>2</td><td>15,261,750</td></tr></table>
320
+
321
+ Total
322
+
323
+ # G MODELS
324
+
325
+ ![](images/f9eddfd19899cbf466aa60efadf087a24d728a490ba73e4889eac47ccc502489.jpg)
326
+ Figure 9: Our policy and discriminator networks with a Neural Module Network (NMN) as the core component. The NMN’s structure corresponds to an instruction WestFrom(Color(‘red’, Shape(‘rect’, SCENE)), Color(‘yellow’, Shape(‘triangle’, SCENE))). The modules are depicted as blue rectangles. Subexpressions Color(’red’, ...), Shape(’rect’, ...), etc. are depicted as “red” and “rect” to save space. The bottom left of the figure illustrates the computation of a module in our variant of NMN.
327
+
328
+ In this section we explain in detail the neural architectures that we used in our experiments. We will use $^ *$ to denote convolution, $\odot$ , $\oplus$ to denote element-wise addition of a vector to a 3D tensor with broadcasting (i.e. same vector will be added/multiplied at each location of the feature map). We used ReLU as the nonlinearity in all layers with the exception of LSTM.
329
+
330
+ FiLM-NMN We will first describe the FiLM-NMN discriminator $D _ { \phi }$ . The discriminator takes a 56x56 RGB image $s$ as the representation of the state. The image $s$ is fed through a stem convnet that consisted of an $8 x 8$ convolution with 16 kernels and a $3 { \tt x } 3$ convolution with 64 kernels. The resulting tensor $h _ { s t e m }$ had a 5x5x64 shape.
331
+
332
+ As a Neural Module Metwork (Andreas et al., 2016), the FiLM-NMN is constructed of modules. The module $m _ { x }$ corresponding to a token $x$ takes a left-hand side input $h _ { l }$ and a right-hand side input $h _ { r }$ and performs the following computation with them:
333
+
334
+ $$
335
+ m _ { x } ( h _ { l } , h _ { r } ) = R e L U ( ( 1 + \gamma _ { x } ) \odot ( W _ { m } * [ h _ { l } ; h _ { r } ] ) \oplus \beta _ { x } ) ,
336
+ $$
337
+
338
+ where $\gamma _ { x }$ and $\beta _ { x }$ are FiLM coefficients (Perez et al., 2017) corresponding to the token $x$ , $W _ { m }$ is a weight tensor for a 3x3 convolution with 128 input features and 64 output features. Zero-padding is used to ensure that the output of $m _ { x }$ has the same shape as $h _ { l }$ and $h _ { r }$ . The equation above describes a binary module that takes two operands. For the unary modules that received only one input (e.g. $m _ { r e d }$ , $m _ { s q u a r e , \rangle }$ ) we present the input as $h _ { l }$ and zeroed out $h _ { r }$ . This way we are able to use the same set of weights $W _ { m }$ for all modules. We have 12 modules in total, 3 for color words, 3 for shape words, 5 for relations words and one $m _ { A G E N T }$ module used in go-to instructions. The modules are selected and connected based on the instructions, and the output of the root module is used for further processing. For example, the following computation would be performed for the instruction $c _ { 1 } =$ NorthFrom(Color(‘red’, Shape(‘circle’, SCENE)), Color(‘blue’, Shape(‘square’, SCENE))):
339
+
340
+ $$
341
+ h _ { n m n } = m _ { N o r t h F r o m } ( m _ { r e d } ( m _ { c i r c l e } ( h _ { s t e m } ) ) , m _ { b l u e } ( m _ { s q u a r e } ( h _ { s t e m } ) ) ) ,
342
+ $$
343
+
344
+ and the following one for $c _ { 2 } = { }$ NorthFrom(AGENT, Shape(‘triangle’, SCENE)):
345
+
346
+ $$
347
+ h _ { n m n } = m _ { N o r t h F r o m } ( m _ { A G E N T } ( h _ { s t e m } ) , m _ { t r i a n g l e } ( h _ { s t e m } ) ) .
348
+ $$
349
+
350
+ Finally, the output of the discriminator is computed by max-pooling the output of the FiLM-NMN across spatial dimensions and feeding it to an MLP with a hidden layer of 100 units:
351
+
352
+ $$
353
+ \begin{array} { r } { D ( c , s ) = \sigma ( w ^ { T } R e L U ( W \mathrm { m a x p o o l } ( h _ { n m n } ) + b ) ) , } \end{array}
354
+ $$
355
+
356
+ where $w$ , $W$ and $b$ are weights and biases, $\sigma ( x ) = e ^ { x } / ( 1 + e ^ { x } )$ is the sigmoid function.
357
+
358
+ The policy network $\pi _ { \phi }$ is similar to the discriminator network $D _ { \theta }$ . The only difference is that (1) it outputs softmax probabilites for 5 actions instead of one real number (2) we use an additional convolutional layer to combine the output of FiLM-NMN and $h _ { s t e m }$ :
359
+
360
+ $$
361
+ \begin{array} { r } { h _ { m e r g e } = R e L U ( W _ { m e r g e } * [ h _ { n m n } ; h _ { s t e m } ] + b _ { m e r g e } ) , } \\ { \pi ( c , s ) = \mathrm { s o f t m a x } ( W _ { 2 } R e L U ( W _ { 1 } \mathrm { m a x p o o l } ( h _ { m e r g e } ) + b _ { 1 } ) + b _ { 2 } ) , } \end{array}
362
+ $$
363
+
364
+ the output $h _ { m e r g e }$ of which is further used in the policy network instead of $h _ { n m n }$ .
365
+
366
+ Figure 9 illustrates our FiLM-NMN policy and discriminator networks.
367
+
368
+ FiLM-LSTM For our structure-agnostic models we use an LSTM of 100 hidden units to predict FiLM biases and multipliers for a 5 layer convnet. More specifically, let $h _ { L S T M }$ be the final state of the LSTM after it consumes the instruction $c$ . We compute the FiLM coefficients for the layer $k \in [ 1 ; 5 ]$ as follows:
369
+
370
+ $$
371
+ \begin{array} { r } { \gamma _ { k } = W _ { k } ^ { \gamma } h _ { L S T M } + b _ { k } ^ { \gamma } , } \\ { \beta _ { k } = W _ { k } ^ { \beta } h _ { L S T M } + b _ { k } ^ { \beta } , } \end{array}
372
+ $$
373
+
374
+ and use them as described by the equation below:
375
+
376
+ $$
377
+ h _ { k } = R e L U ( ( 1 + \gamma _ { k } ) \odot ( W _ { k } * h _ { k - 1 } ) \oplus \beta _ { k } ) ,
378
+ $$
379
+
380
+ where $W _ { k }$ are the convolutional weights, $h _ { 0 }$ is set to the pixel-level representation of the world state $s$ . The characteristics of the 5 layers were the following: (8x8, 16, VALID), (3x3, 32, VALID), (3x3, 64, SAME), (3x3, 64, SAME), (3x3, 64, SAME), where (mxm, $n _ { o u t } , p )$ stands for a convolutional layer with mxm filters, $n _ { o u t }$ output features, and $p \in \{ \mathrm { S A M E } , \mathrm { V A L I D } \}$ padding strategy. Layers with $p = { \tt V A L I D }$ do not use padding, whereas in those with $p = \mathsf { S A M E }$ zero padding is added in order to produce an output with the same shape as the input. The layer 5 is also connected to layer 3 by a residual connection. Similarly to FiLM-NMN, the output $h _ { 5 }$ of the convnet is max-pooled and fed into an MLP with 100 hidden units to produce the outputs:
381
+
382
+ $$
383
+ \begin{array} { r } { D ( c , s ) = \sigma ( w ^ { T } R e L U ( W m a x p o o l ( h _ { 5 } ) + b ) ) , } \\ { \pi ( c , s ) = \mathrm { s o f t m a x } ( W _ { 2 } R e L U ( W _ { 1 } \mathrm { m a x p o o l } ( h _ { 5 } ) + b _ { 1 } ) + b _ { 2 } ) . } \end{array}
384
+ $$
385
+
386
+ Baseline prediction In all policy networks the baseline predictor is a linear layer that took the same input as the softmax layer. The gradients of the baseline predictor are allowed to propagate through the rest of the network.
387
+
388
+ Reward prediction We use the result $h _ { m a x p o o l }$ of the max-pooling operation (which was a part of all models that we considered) as the input to the reward prediction pathway of our model. hmaxpool is fed through a linear layer and softmax to produce probabilities of the reward being positive or zero (the reward is never negative in AGILE).
389
+
390
+ Weight Initialization We use the standard initialisation methods from the Sonnet library5. Bias vectors are initialised with zeros. Weights of fully-connected layers are sampled from a truncated normal distribution with $\begin{array} { r } { \sigma = \frac { 1 } { \sqrt { n _ { i n } } } } \end{array}$ , where $n _ { i n }$ is the number of input units of the layer. Convolutional weights are sampled from a truncated normal distribution with $\begin{array} { r } { \sigma = \frac { 1 } { \sqrt { f a n _ { i n } } } } \end{array}$ where $f a n _ { i n }$ is the product of kernel width, kernel height and the number of input features.
md/train/H1xscnEKDr/H1xscnEKDr.md ADDED
@@ -0,0 +1,507 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DEFENDING AGAINST PHYSICALLY REALIZABLE ATTACKS ON IMAGE CLASSIFICATION
2
+
3
+ Tong Wu, Liang Tong & Yevgeniy Vorobeychik
4
+
5
+ Department of Computer Science and Engineering Washington University in St. Louis {tongwu, liangtong, yvorobeychik}@wustl.edu
6
+
7
+ # ABSTRACT
8
+
9
+ We study the problem of defending deep neural network approaches for image classification from physically realizable attacks. First, we demonstrate that the two most scalable and effective methods for learning robust models, adversarial training with PGD attacks and randomized smoothing, exhibit limited effectiveness against three of the highest profile physical attacks. Next, we propose a new abstract adversarial model, rectangular occlusion attacks, in which an adversary places a small adversarially crafted rectangle in an image, and develop two approaches for efficiently computing the resulting adversarial examples. Finally, we demonstrate that adversarial training using our new attack yields image classification models that exhibit high robustness against the physically realizable attacks we study, offering the first effective generic defense against such attacks. 1
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ State-of-the-art effectiveness of deep neural networks has made it the technique of choice in a variety of fields, including computer vision (He et al., 2016), natural language processing (Sutskever et al., 2014), and speech recognition (Hinton et al., 2012). However, there have been a myriad of demonstrations showing that deep neural networks can be easily fooled by carefully perturbing pixels in an image through what have become known as adversarial example attacks (Szegedy et al., 2014; Goodfellow et al., 2015; Carlini & Wagner, 2017b; Vorobeychik & Kantarcioglu, 2018). In response, a large literature has emerged on defending deep neural networks against adversarial examples, typically either proposing techniques for learning more robust neural network models (Wong & Kolter, 2018; Wong et al., 2018; Raghunathan et al., 2018b; Cohen et al., 2019; Madry et al., 2018), or by detecting adversarial inputs (Metzen et al., 2017; Xu et al., 2018).
14
+
15
+ Particularly concerning, however, have been a number of demonstrations that implement adversarial perturbations directly in physical objects that are subsequently captured by a camera, and then fed through the deep neural network classifier (Boloor et al., 2019; Eykholt et al., 2018; Athalye et al., 2018b; Brown et al., 2018; Bhattad et al., 2020). Among the most significant of such physical attacks on deep neural networks are three that we specifically consider here: 1) the attack which fools face recognition by using adversarially designed eyeglass frames (Sharif et al., 2016), 2) the attack which fools stop sign classification by adding adversarially crafted stickers (Eykholt et al., 2018), and 3) the universal adversarial patch attack, which causes targeted misclassification of any object with the adversarially designed sticker (patch) (Brown et al., 2018). Oddly, while considerable attention has been devoted to defending against adversarial perturbation attacks in the digital space, there are no effective methods specifically to defend against such physical attacks.
16
+
17
+ Our first contribution is an empirical evaluation of the effectiveness of conventional approaches to robust ML against two physically realizable attacks: the eyeglass frame attack on face recognition (Sharif et al., 2016) and the sticker attack on stop signs (Eykholt et al., 2018). Specifically, we study the performance on adversarial training and randomized smoothing against these attacks, and show that both have limited effectiveness in this context (quite ineffective in some settings, and somewhat more effective, but still not highly robust, in others), despite showing moderate effectiveness against $l _ { \infty }$ and $l _ { 2 }$ attacks, respectively.
18
+
19
+ Our second contribution is a novel abstract attack model which more directly captures the nature of common physically realizable attacks than the conventional $l _ { p }$ -based models. Specifically, we consider a simple class of rectangular occlusion attacks in which the attacker places a rectangular sticker onto an image, with both the location and the content of the sticker adversarially chosen. We develop several algorithms for computing such adversarial occlusions, and use adversarial training to obtain neural network models that are robust to these. We then experimentally demonstrate that our proposed approach is significantly more robust against physical attacks on deep neural networks than adversarial training and randomized smoothing methods that leverage $l _ { p }$ -based attack models.
20
+
21
+ Related Work While many approaches for defending deep learning in vision applications have been proposed, robust learning methods have been particularly promising, since alternatives are often defeated soon after being proposed (Madry et al., 2018; Raghunathan et al., 2018a; Wong & Kolter, 2018; Vorobeychik & Kantarcioglu, 2018). The standard solution approach for this problem is an adaptation of Stochastic Gradient Descent (SGD) where gradients are either with respect to the loss at the optimal adversarial perturbation for each $i$ (or approximation thereof, such as using heuristic local search (Goodfellow et al., 2015; Madry et al., 2018) or a convex over-approximation (Raghunathan et al., 2018b; Wang et al., 2018)), or with respect to the dual of the convex relaxation of the attacker maximization problem (Raghunathan et al., 2018a; Wong & Kolter, 2018; Wong et al., 2018). Despite these advances, adversarial training a la Madry et al. (2018) remains the most practically effective method for hardening neural networks against adversarial examples with $l _ { \infty }$ -norm perturbation constraints. Recently, randomized smoothing emerged as another class of techniques for obtaining robustness (Lecuyer et al., 2019; Cohen et al., 2019), with the strongest results in the context of $l _ { 2 }$ -norm attacks. In addition to training neural networks that are robust by construction, a number of methods study the problem of detecting adversarial examples (Metzen et al., 2017; Xu et al., 2018), with mixed results (Carlini & Wagner, 2017a). Of particular interest is recent work on detecting physical adversarial examples (Chou et al., 2018). However, detection is inherently weaker than robustness, which is our goal, as even perfect detection does not resolve the question of how to make decisions on adversarial examples. Finally, our work is in the spirit of other recent efforts that characterize robustness of neural networks to physically realistic perturbations, such as translations, rotations, blurring, and contrast (Engstrom et al., 2019; Hendrycks & Dietterich, 2019).
22
+
23
+ # 2 BACKGROUND
24
+
25
+ # 2.1 ADVERSARIAL EXAMPLES IN THE DIGITAL AND PHYSICAL WORLD
26
+
27
+ Adversarial examples involve modifications of input images that are either invisible to humans, or unsuspicious, and that cause systematic misclassification by state-of-the-art neural networks (Szegedy et al., 2014; Goodfellow et al., 2015; Vorobeychik & Kantarcioglu, 2018). Commonly, approaches for generating adversarial examples aim to solve an optimization problem of the following form:
28
+
29
+ $$
30
+ \arg \operatorname* { m a x } _ { \pmb { \delta } } L ( f ( \pmb { x } + \pmb { \delta } ; \pmb { \theta } ) , y ) \qquad s . t . \ \| \pmb { \delta } \| _ { p } \leq \epsilon ,
31
+ $$
32
+
33
+ where $_ { \textbf { \em x } }$ is the original input image, $\delta$ is the adversarial perturbation, $L ( \cdot )$ is the adversary’s utility function (for example, the adversary may wish to maximize the cross-entropy loss), and $\| \cdot \| _ { p }$ is some $l _ { p }$ norm. While a host of such digital attacks have been proposed, two have come to be viewed as state of the art: the attack developed by Carlini & Wagner (2017b), and the projected gradient descent attack (PGD) by Madry et al. (2018).
34
+
35
+ While most of the work to date has been on attacks which modify the digital image directly, we focus on a class of physical attacks which entail modifying the actual object being photographed in order to fool the neural network that subsequently takes its digital representation as input. The attacks we will focus on will have three characteristics:
36
+
37
+ 1. The attack can be implemented in the physical space (e.g., modifying the stop sign); 2. the attack has low suspiciousness; this is operationalized by modifying only a small part of the object, with the modification similar to common “noise” that obtains in the real world; for example, stickers on a stop sign would appear to most people as vandalism, but covering the stop sign with a printed poster would look highly suspicious; and 3. the attack causes misclassification by state-of-the-art deep neural network.
38
+
39
+ Since our ultimate purpose is defense, we will not concern ourselves with the issue of actually implementing the physical attacks. Instead, we will consider the digital representation of these attacks, ignoring other important issues, such as robustness to many viewpoints and printability. For example, in the case where the attack involves posting stickers on a stop sign, we will only be concerned with simulating such stickers on digital images of stop signs. For this reason, we refer to such attacks physically realizable attacks, to allude to the fact that it is possible to realize them in practice. It is evident that physically realizable attacks represent a somewhat stronger adversarial model than their actual implementation in the physical space. Henceforth, for simplicity, we will use the terms physical attacks and physically realizable attacks interchangeably.
40
+
41
+ ![](images/bedbb0a44ecf8456924ada9c0811bbf01af6405356cbf18bed6316127a1f9a9b.jpg)
42
+ Figure 1: (a) An example of the eyeglass frame attack. Left: original face input image. Middle: modified input image (adversarial eyeglasses superimposed on the face). Right: an image of the predicted individual with the adversarial input in the middle image. (b) An example of the stop sign attack. Left: original stop sign input image. Middle: adversarial mask. Right: stop sign image with adversarial stickers, classified as a speed limit sign.
43
+
44
+ We consider three physically realizable attacks. The first is the attack on face recognition by Sharif et al. (2016), in which the attacker adds adversarial noise inside printed eyeglass frames that can subsequently be put on to fool the deep neural network (Figure 1a). The second attack posts adversarially crafted stickers on a stop sign to cause it to be misclassified as another road sign, such as the speed limit sign (Figure 1b) (Eykholt et al., 2018). The third, adversarial patch, attack designs a patch (a sticker) with adversarial noise that can be placed onto an arbitrary object, causing that object to be misclassified by a deep neural network (Brown et al., 2018).
45
+
46
+ # 2.2 ADVERSARIALLY ROBUST DEEP LEARNING
47
+
48
+ While numerous approaches have been proposed for making deep learning robust, many are heuristic and have soon after been defeated by more sophisticated attacks (Carlini & Wagner, 2017b; He et al., 2017; Carlini & Wagner, 2017a; Athalye et al., 2018a). Consequently, we focus on principled approaches for defense that have not been broken. These fall broadly into two categories: robust learning and randomized smoothing. We focus on a state-of-the-art representative from each class.
49
+
50
+ Robust Learning The goal of robust learning is to minimize a robust loss, defined as follows:
51
+
52
+ $$
53
+ \pmb \theta ^ { * } = \underset { \pmb \theta } { \arg \operatorname* { m i n } } \ \underset { ( \pmb x , \pmb y ) \sim \mathcal D } { \mathbb E } \left[ \operatorname* { m a x } _ { \| \pmb \delta \| _ { p } \leq \epsilon } L ( f ( \pmb x + \pmb \delta ; \pmb \theta ) , \ b y ) \right] ,
54
+ $$
55
+
56
+ where $\mathcal { D }$ denotes the training data set. In itself this is a highly intractable problem. Several techniques have been developed to obtain approximate solutions. Among the most effective in practice is the adversarial training approach by Madry et al. (2018), who use the PGD attack as an approximation to the inner optimization problem, and then take gradient descent steps with respect to the associated adversarial inputs. In addition, we consider a modified version of this approach termed curriculum adversarial training (Cai et al., 2018). Our implementation of this approach proceeds as follows: first, apply adversarial training for a small $\epsilon$ , then increase $\epsilon$ and repeat adversarial training, and so on, increasing $\epsilon$ until we reach the desired level of adversarial noise we wish to be robust to.
57
+
58
+ Randomized Smoothing The second class of techniques we consider works by adding noise to inputs at both training and prediction time. The key idea is to construct a smoothed classifier $g ( \cdot )$ from a base classifier $f ( \cdot )$ by perturbing the input $_ { \textbf { \em x } }$ with isotropic Gaussian noise with variance $\sigma$ . The prediction is then made by choosing a class with the highest probability measure with respect to the induced distribution of ${ \dot { f } } ( \cdot )$ decisions:
59
+
60
+ $$
61
+ g ( \pmb { x } ) = \arg \operatorname* { m a x } _ { c } P ( f ( \pmb { x } + \pmb { \sigma } ) = c ) , \quad \pmb { \sigma } \sim \mathcal { N } \left( 0 , \sigma ^ { 2 } I \right) .
62
+ $$
63
+
64
+ To achieve provably robust classification in this manner one typically trains the classifier $f ( \cdot )$ by adding Gaussian noise to inputs at training time (Lecuyer et al., 2019; Cohen et al., 2019).
65
+
66
+ # 3 ROBUSTNESS OF CONVENTIONAL ROBUST ML METHODS AGAINST PHYSICAL ATTACKS
67
+
68
+ Most of the approaches for endowing deep learning with adversarial robustness focus on adversarial models in which the attacker introduces $l _ { p }$ -bounded adversarial perturbations over the entire input. Earlier we described two representative approaches in this vein: adversarial training, commonly focused on robustness against $l _ { \infty }$ attacks, and randomized smoothing, which is most effective against $l _ { 2 }$ attacks (although certification bounds can be extended to other $l _ { p }$ norms as well). We call these methods conventional robust ML.
69
+
70
+ In this section, we ask the following question:
71
+
72
+ # Are conventional robust ML methods robust against physically realizable attacks?
73
+
74
+ This is similar to the question was asked in the context of malware classifier evasion by Tong et al. (2019), who found that $l _ { p }$ -based robust ML methods can indeed be successful in achieving robustness against realizable evasion attacks. Ours is the first investigation of this issue in computer vision applications and for deep neural networks, where attacks involve adversarial masking of objects.2
75
+
76
+ We study this issue experimentally by considering two state-of-the-art approaches for robust ML: adversarial training a-la-Madry et al. (2018), along with its curriculum learning variation (Cai et al., 2018), and randomized smoothing, using the implementation by Cohen et al. (2019). These approaches are applied to defend against two physically realizable attacks described in Section 2.1: an attack on face recognition which adds adversarial eyeglass frames to faces (Sharif et al., 2016), and an attack on stop sign classification which adds adversarial stickers to a stop sign to cause misclassification (Eykholt et al., 2018).
77
+
78
+ We consider several variations of adversarial training, as a function of the $l _ { \infty }$ bound, , imposed on the adversary. Just as Madry et al. (2018), adversarial instances in adversarial training were generated using PGD. We consider attacks with $\epsilon \in \{ 4 , 8 \}$ (adversarial training failed to make progress when we used $\epsilon = 1 6$ ). For curriculum adversarial training, we first performed adversarial training with $\epsilon = 4$ , then doubled $\epsilon$ to 8 and repeated adversarial training with the model robust to $\epsilon = 4$ , then doubled $\epsilon$ again, and so on. In the end, we learned models for $\epsilon \in \{ 4 , 8 , 1 6 , 3 2 \}$ . For all versions of adversarial training, we consider 7 and 50 iterations of the PGD attack. We used the learning rate of $\epsilon / 4$ for the former and 1 for the latter. In all cases, pixels are in $0 \sim 2 5 5$ range and retraining was performed for 30 epochs using the ADAM optimizer.
79
+
80
+ For randomized smoothing, we consider noise levels $\sigma \in \{ 0 . 2 5 , 0 . 5 , 1 \}$ as in Cohen et al. (2019), and take 1,000 Monte Carlo samples at test time.
81
+
82
+ # 3.1 ADVERSARIAL EYEGLASSES IN FACE RECOGNITION
83
+
84
+ We applied white-box dodging (untargeted) attacks on the face recognition systems (FRS) from Sharif et al. (2016). We used both the VGGFace data and transferred VGGFace CNN model for the face recognition task, subselecting 10 individuals, with 300-500 face images for each. Further details about the dataset, CNN architecture, and training procedure are in Appendix A. For the attack, we used identical frames as in Sharif et al. (2016) occupying $6 . 5 \%$ of the pixels. Just as Sharif et al. (2016), we compute attacks (that is, adversarial perturbations inside the eyeglass frame area) by using the learning rate 20 as well as momentum value 0.4, and vary the number of attack iterations between 0 (no attack) and 300.
85
+
86
+ Figure 2 presents the results of classifiers obtained from adversarial training (left) as well as curriculum adversarial training (middle), in terms of accuracy (after the attack) as a function of the number of iterations of the Sharif et al. (2016) eyeglass frame attack. First, it is clear that none of the variations of adversarial training are particularly effective once the number of physical attack iterations is above 20. The best performance in terms of adversarial robustness is achieved by adversarial training with $\epsilon = 8$ , for approaches using either 7 or 50 PGD iterations (the difference between these appears negligible). However, non-adversarial accuracy for these models is below $70 \%$ , a ${ \sim } 2 0 \%$ drop in accuracy compared to the original model. Moreover, adversarial accuracy is under $40 \%$ for sufficiently strong physical attacks. Curriculum adversarial training generally achieves significantly higher non-adversarial accuracy, but is far less robust, even when trained with PGD attacks that use $\epsilon = 3 2$ .
87
+
88
+ ![](images/a4481dc13a4835cb8eb61567ebf1bf1e2f184ffb46c0832fa58e0cff35c86b07.jpg)
89
+ Figure 2: Performance of adversarial training (left), curriculum adversarial training (with 7 PGD iterations) (middle), and randomized smoothing (right) against the eyeglass frame attack.
90
+
91
+ Figure 2 (right) shows the performance of randomized smoothing when faced with the eyeglass frames attack. It is readily apparent that randomized smoothing is ineffective at deflecting this physical attack: even as we vary the amount of noise we add, accuracy after attacks is below $20 \%$ even for relatively weak attacks, and often drops to nearly 0 for sufficiently strong attacks.
92
+
93
+ # 3.2 ADVERSARIAL STICKERS ON STOP SIGNS
94
+
95
+ Following Eykholt et al. (2018), we use the LISA traffic sign dataset for our experiments, and 40 stop signs from this dataset as our test data and perform untargeted attacks (this is in contrast to the original work, which is focused on targeted attacks). For the detailed description of the data and the CNN used for traffic sign prediction, see Appendix A. We apply the same settings as in the original attacks and use ADAM optimizer with the same parameters. Since we observed few differences in performance between running PGD for 7 vs. 50 iterations, adversarial training methods in this section all use 7 iterations of PGD.
96
+
97
+ ![](images/863f1c786fec9ce6fa78b46724a1057d974f2bc97dfc55b986b515d1875a31d5.jpg)
98
+ Figure 3: Performance of adversarial training (left), curriculum adversarial training (with 7 PGD iterations) (middle), and randomized smoothing (right) against the stop sign attack.
99
+
100
+ Again, we begin by considering adversarial training (Figure 3, left and middle). In this case, both the original and curriculum versions of adversarial training with PGD are ineffective when $\epsilon = 3 2$ (error rates on clean data are above $90 \%$ ); these are consequently omitted from the plots. Curriculum adversarial training with $\epsilon = 1 6$ has the best performance on adversarial data, and works well on clean data. Surprisingly, most variants of adversarial training perform at best marginally better than the original model against the stop sign attack. Even the best variant has relatively poor performance, with robust accuracy under $50 \%$ for stronger attacks.
101
+
102
+ Figure 3 (right) presents the results for randomized smoothing. In this set of experiments, we found that randomized smoothing performs inconsistently. To address this, we used 5 random seeds to repeat the experiments, and use the resulting mean values in the final results. Here, the best variant uses $\sigma = 0 . 2 5$ , and, unlike experiments with the eyeglass frame attack, significantly outperforms adversarial training, reaching accuracy slightly above $60 \%$ even for the stronger attacks. Nevertheless, even randomized smoothing results in significant degradation of effectiveness on adversarial instances (nearly $40 \%$ , compared to clean data).
103
+
104
+ # 3.3 DISCUSSION
105
+
106
+ There are two possible reasons why conventional robust ML perform poorly against physical attacks: 1) adversarial models involving $l _ { p }$ -bounded perturbations are too hard to enable effective robust learning, and 2) the conventional attack model is too much of a mismatch for realistic physical attacks. In Appendix B, we present evidence supporting the latter. Specifically, we find that conventional robust ML models exhibit much higher robustness when faced with the $l _ { p }$ -bounded attacks they are trained to be robust to.
107
+
108
+ # 4 PROPOSED APPROACH: DEFENSE AGAINST OCCLUSION ATTACKS (DOA)
109
+
110
+ As we observed in Section 3, conventional models for making deep learning robust to attack can perform quite poorly when confronted with physically realizable attacks. In other words, the evidence strongly suggests that the conventional models of attacks in which attackers can make $l _ { p }$ -bounded perturbations to input images are not particularly useful if one is concerned with the main physical threats that are likely to be faced in practice. However, given the diversity of possible physical attacks one may perpetrate, is it even possible to have a meaningful approach for ensuring robustness against a broad range of physical attacks? For example, the two attacks we considered so far couldn’t be more dissimilar: in one, we engineer eyeglass frames; in another, stickers on a stop sign. We observe that the key common element in these attacks, and many other physical attacks we may expect to encounter, is that they involve the introduction of adversarial occlusions to a part of the input. The common constraint faced in such attacks is to avoid being suspicious, which effectively limits the size of the adversarial occlusion, but not necessarily its shape or location. Next, we introduce a simple abstract model of occlusion attacks, and then discuss how such attacks can be computed and how we can make classifiers robust to them.
111
+
112
+ # 4.1 ABSTRACT ATTACK MODEL: RECTANGULAR OCCLUSION ATTACKS (ROA)
113
+
114
+ We propose the following simple abstract model of adversarial occlusions of input images. The attacker introduces a fixed-dimension rectangle. This rectangle can be placed by the adversary anywhere in the image, and the attacker can furthermore introduce $l _ { \infty }$ noise inside the rectangle with an exogenously specified high bound $\epsilon$ (for example, $\epsilon = 2 5 5$ , which effectively allows addition of arbitrary adversarial noise). This model bears some similarity to $l _ { 0 }$ attacks, but the rectangle imposes a contiguity constraint, which reflects common physical limitations. The model is clearly abstract: in practice, for example, adversarial occlusions need not be rectangular or have fixed dimensions (for example, the eyeglass frame attack is clearly not rectangular), but at the same time cannot usually be arbitrarily superimposed on an image, as they are implemented in the physical environment. Nevertheless, the model reflects some of the most important aspects common to many physical attacks, such as stickers placed on an adversarially chosen portion of the object we wish to identify. We call our attack model a rectangular occlusion attack (ROA). An important feature of this attack is that it is untargeted: since our ultimate goal is to defend against physical attacks whatever their target, considering untargeted attacks obviates the need to have precise knowledge about the attacker’s goals. For illustrations of the ROA attack, see Appendix C.
115
+
116
+ # 4.2 COMPUTING ATTACKS
117
+
118
+ The computation of ROA attacks involves 1) identifying a region to place the rectangle in the image, and 2) generating fine-grained adversarial perturbations restricted to this region. The former task can be done by an exhaustive search: consider all possible locations for the upper left-hand corner of the rectangle, compute adversarial noise inside the rectangle using PGD for each of these, and choose the worst-case attack (i.e., the attack which maximizes loss computed on the resulting image). However, this approach would be quite slow, since we need to perform PGD inside the rectangle for every possible position. Our approach, consequently, decouples these two tasks. Specifically, we first perform an exhaustive search using a grey rectangle to find a position for it that maximizes loss, and then fix the position and apply PGD inside the rectangle.
119
+
120
+ An important limitation of the exhaustive search approach for ROA location is that it necessitates computations of the loss function for every possible location, which itself requires full forward propagation each time. Thus, the search itself is still relatively slow. To speed the process up further, we use the gradient of the input image to identify candidate locations. Specifically, we select a subset of $C$ locations for the sticker with the highest magnitude of the gradient, and only exhaustively search among these $C$ locations. $C$ is exogenously specified to be small relative to the number of pixels in the image, which significantly limits the number of loss function evaluations. Full details of our algorithms for computing ROA are provided in Appendix D.
121
+
122
+ # 4.3 DEFENDING AGAINST ROA
123
+
124
+ Once we are able to compute the ROA attack, we apply the standard adversarial training approach for defense. We term the resulting classifiers robust to our abstract adversarial occlusion attacks Defense against Occlusion Attacks $( D O A )$ , and propose these as an alternative to conventional robust ML for defending against physical attacks. As we will see presently, this defense against ROA is quite adequate for our purposes.
125
+
126
+ # 5 EFFECTIVENESS OF DOA AGAINST PHYSICALLY REALIZABLE ATTACKS
127
+
128
+ We now evaluate the effectiveness of DOA—that is, adversarial training using the ROA threat model we introduced—against physically realizable attacks (see Appendix G for some examples that defeat conventional methods but not DOA). Recall that we consider only digital representations of the corresponding physical attacks. Consequently, we can view our results in this section as a lower bound on robustness to actual physical attacks, which have to deal with additional practical constraints, such as being robust to multiple viewpoints. In addition to the two physical attacks we previously considered, we also evaluate DOA against the adversarial patch attack, implemented on both face recognition and traffic sign data.
129
+
130
+ # 5.1 DOA AGAINST ADVERSARIAL EYEGLASSES
131
+
132
+ We consider two rectangle dimensions resulting in comparable area: $1 0 0 \times 5 0$ and $7 0 \times 7 0$ , both in pixels. Thus, the rectangles occupy approximately $10 \%$ of the $2 2 4 \times 2 2 4$ face images. We used $\{ 3 0 , 5 0 \}$ iterations of PGD with $\epsilon = 2 5 5 / 2$ to generate adversarial noise inside the rectangle, and with learning rate $\alpha = \{ 8 , 4 \}$ correspondingly. For the gradient version of ROA, we choose $C = 3 0$ . DOA adversarial training is performed for 5 epochs with a learning rate of 0.0001.
133
+
134
+ ![](images/8fb68a77529d9750b1fe9efa20ecc65cb3fa3a3a05b61c88e1f566ad609df277.jpg)
135
+ Figure 4: Performance of DOA (using the $1 0 0 \times 5 0$ rectangle) against the eyeglass frame attack in comparison with conventional methods. Left: comparison between DOA, adversarial training, and randomized smoothing (using the most robust variants of these). Middle/Right: Comparing DOA performance for different rectangle dimensions and numbers of PGD iterations inside the rectangle. Middle: using exhaustive search for ROA; right: using the gradient-based heuristic for ROA.
136
+
137
+ Figure 4 (left) presents the results comparing the effectiveness of DOA against the eyeglass frame attack on face recognition to adversarial training and randomized smoothing (we took the most robust variants of both of these). We can see that DOA yields significantly more robust classifiers for this domain. The gradient-based heuristic does come at some cost, with performance slightly worse than when we use exhaustive search, but this performance drop is relatively small, and the result is still far better than conventional robust ML approaches. Figure 4 (middle and right) compares the performance of DOA between two rectangle variants with different dimensions. The key observation is that as long as we use enough iterations of PGD inside the rectangle, changing its dimensions (keeping the area roughly constant) appears to have minimal impact.
138
+
139
+ # 5.2 DOA AGAINST THE STOP SIGN ATTACK
140
+
141
+ We now repeat the evaluation with the traffic sign data and the stop sign attack. In this case, we used $1 0 \times 5$ and $7 \times 7$ rectangles covering ${ \sim } 5 \%$ of the $3 2 \times 3 2$ images. We set $C = 1 0$ for the gradientbased ROA. Implementation of DOA is otherwise identical as in the face recognition experiments above.
142
+
143
+ We present our results using the square rectangle, which in this case was significantly more effective; the results for the $1 0 \times 5$ rectangle DOA attacks are in Appendix F. Figure 5 (left) compares the effectiveness of DOA against the stop sign attack on traffic sign data with the best variants of adversarial training and randomized smoothing. Our results here are for 30 iterations of PGD; in Appendix F, we study the impact of varying the number of PGD iterations. We can observe that DOA is again significantly more robust, with robust accuracy over $90 \%$ for the exhaustive search variant, and ${ \sim } 8 5 \%$ for the gradient-based variant, even for stronger attacks. Moreover, DOA remains $100 \%$ effective at classifying stop signs on clean data, and exhibits ${ \sim } 9 5 \%$ accuracy on the full traffic sign classification task.
144
+
145
+ ![](images/299a1e9e6f3cc5cb0c40b1c17d293ec00ba94320cbc6d2a30b87b7e8dabc2396.jpg)
146
+ Figure 5: Performance of the best case of adversarial training, randomized smoothing, and DOA against the stop sign attack (left) and adversarial patch attack (right).
147
+
148
+ # 5.3 DOA AGAINST ADVERSARIAL PATCH ATTACKS
149
+
150
+ Finally, we evaluate DOA against the adversarial patch attacks. In these attacks, an adversarial patch (e.g., sticker) is designed to be placed on an object with the goal of inducing a target prediction. We study this in both face recognition and traffic sign classification tasks. Here, we present the results for face recognition; further detailed results on both datasets are provided in Appendix F.
151
+
152
+ As we can see from Figure 5 (right), adversarial patch attacks are quite effective once the attack region (fraction of the image) is $10 \%$ or higher, with adversarial training and randomized smoothing both performing rather poorly. In contrast, DOA remains highly robust even when the adversarial patch covers $20 \%$ of the image.
153
+
154
+ # 6 CONCLUSION
155
+
156
+ As we have shown, conventional methods for making deep learning approaches for image classification robust to physically realizable attacks tend to be relatively ineffective. In contrast, a new threat model we proposed, rectangular occlusion attacks (ROA), coupled with adversarial training, achieves high robustness against several prominent examples of physical attacks. While we explored a number of variations of ROA attacks as a means to achieve robustness against physical attacks, numerous questions remain. For example, can we develop effective methods to certify robustness against ROA, and are the resulting approaches as effective in practice as our method based on a combination of heuristically computed attacks and adversarial training? Are there other types of occlusions that are more effective? Answers to these and related questions may prove a promising path towards practical robustness of deep learning when deployed for downstream applications of computer vision such as autonomous driving and face recognition.
157
+
158
+ # ACKNOWLEDGMENTS
159
+
160
+ This work was partially supported by the NSF (IIS-1905558, IIS-1903207), ARO (W911NF-19-1- 0241), and NVIDIA.
161
+
162
+ # REFERENCES
163
+
164
+ Anish Athalye, Nicholas Carlini, and David Wagner. Obfuscated gradients give a false sense of security: Circumventing defenses to adversarial examples. In International Conference on Machine Learning, pp. 274–283, 2018a.
165
+
166
+ Anish Athalye, Logan Engstrom, Andrew Ilyas, and Kevin Kwok. Synthesizing robust adversarial examples. In ICML, 2018b.
167
+
168
+ Anand Bhattad, Min Jin Chong, Kaizhao Liang, Bo Li, and David Forsyth. Unrestricted adversarial examples via semantic manipulation. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id $=$ Sye_OgHFwH.
169
+
170
+ Adith Boloor, Xin He, Christopher Gill, Yevgeniy Vorobeychik, and Xuan Zhang. Simple physical adversarial examples against end-to-end autonomous driving models. In IEEE International Conference on Embedded Software and Systems, 2019.
171
+
172
+ Tom B. Brown, Dandelion Mane, Aurko Roy, Mart ´ ´ın Abadi, and Justin Gilmer. Adversarial patch. CoRR, abs/1712.09665, 2018.
173
+
174
+ Qi-Zhi Cai, Chang Liu, and Dawn Song. Curriculum adversarial training. In International Joint Conference on Artificial Intelligence, pp. 3740–3747, 2018.
175
+
176
+ N. Carlini and D. Wagner. Adversarial examples are not easily detected: Bypassing ten detection methods. In International Workshop on AI and Security, 2017a.
177
+
178
+ Nicholas Carlini and David A. Wagner. Towards evaluating the robustness of neural networks. IEEE Symposium on Security and Privacy, pp. 39–57, 2017b.
179
+
180
+ Edward Chou, Florian Tramer, and Giancarlo Pellegrino. Sentinet: Detecting physical attacks against deep learning systems, 2018. arxiv preprint.
181
+
182
+ Jeremy M. Cohen, Elan Rosenfeld, and J. Zico Kolter. Certified adversarial robustness via randomized smoothing. In International Conference on Machine Learning, 2019.
183
+
184
+ Logan Engstrom, Brandon Tran, Dimitris Tsipras, Ludwig Schmidt, and Aleksander Madry. Exploring the landscape of spatial robustness. In International Conference on Machine Learning, pp. 1802–1811, 2019.
185
+
186
+ Kevin Eykholt, Ivan Evtimov, Earlence Fernandes, Bo Li, Amir Rahmati, Chaowei Xiao, Atul Prakash, Tadayoshi Kohno, and Dawn Xiaodong Song. Robust physical-world attacks on deep learning visual classification. IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 1625–1634, 2018.
187
+
188
+ Ian Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. In International Conference on Learning Representations, 2015.
189
+
190
+ 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.
191
+
192
+ Warren He, James Wei, Xinyun Chen, Nicholas Carlini, and Dawn Song. Adversarial example defenses: ensembles of weak defenses are not strong. In USENIX Workshop on Offensive Technologies, 2017.
193
+
194
+ Dan Hendrycks and Thomas Dietterich. Benchmarking neural network robustness to common corruptions and perturbations. In International Conference on Learning Representations, 2019.
195
+
196
+ Geoffrey Hinton, Li Deng, George Dahl, Abdel rahman Mohamed, Navdeep Jaitly, Vincent Vanhoucke, and Tara N. Sainath. Deep neural networks for acoustic modeling in speech recognition. IEEE Signal Processing Magazine, 29(6):82–97, 2012.
197
+
198
+ Zico Kolter and Aleksander Madry. Adversarial robustness - theory and practice, 2019. https://adversarial-ml-tutorial.org/.
199
+
200
+ M. Lecuyer, V. Atlidakis, R. Geambasu, D. Hsu, and S. Jana. Certified robustness to adversarial examples with differential privacy. In IEEE Symposium on Security and Privacy, 2019.
201
+
202
+ Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. In International Conference on Learning Representations, 2018.
203
+
204
+ Jan Hendrik Metzen, Tim Genewein, Volker Fischer, and Bastian Bischoff. On detecting adversarial perturbations. In International Conference on Learning Representations, 2017.
205
+
206
+ Andreas Møgelmose, Mohan Manubhai Trivedi, and Thomas B. Moeslund. Vision-based traffic sign detection and analysis for intelligent driver assistance systems: Perspectives and survey. IEEE Transactions on Intelligent Transportation Systems, 13:1484–1497, 2012.
207
+
208
+ Nicolas Papernot, Patrick D. McDaniel, Somesh Jha, Matt Fredrikson, Z. Berkay Celik, and Ananthram Swami. The limitations of deep learning in adversarial settings. 2016 IEEE European Symposium on Security and Privacy (EuroS&P), pp. 372–387, 2015.
209
+
210
+ Omkar M. Parkhi, Andrea Vedaldi, and Andrew Zisserman. Deep face recognition. In BMVC, 2015.
211
+
212
+ Aditi Raghunathan, Jacob Steinhardt, and Percy Liang. Certified defenses against adversarial examples. In International Conference on Learning Representations, 2018a.
213
+
214
+ Aditi Raghunathan, Jacob Steinhardt, and Percy Liang. Semidefinite relaxations for certifying robustness to adversarial examples. In Neural Information Processing Systems, 2018b.
215
+
216
+ Mahmood Sharif, Sruti Bhagavatula, Lujo Bauer, and Michael K. Reiter. Accessorize to a crime: Real and stealthy attacks on state-of-the-art face recognition. In ACM SIGSAC Conference on Computer and Communications Security, pp. 1528–1540, 2016.
217
+
218
+ Ilya Sutskever, Oriol Vinyals, and Quoc V. Le. Sequence to sequence learning with neural networks. In NIPS, 2014.
219
+
220
+ Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. In International Conference on Learning Representations, 2014.
221
+
222
+ Liang Tong, Bo Li, Chen Hajaj, Chaowei Xiao, Ning Zhang, and Yevgeniy Vorobeychik. Improving robustness of ml classifiers against realizable evasion attacks using conserved features. In USENIX Security Symposium, pp. 285–302, 2019.
223
+
224
+ Yevgeniy Vorobeychik and Murat Kantarcioglu. Adversarial Machine Learning. Morgan Claypool, 2018.
225
+
226
+ S. Wang, K. Pei, J. Whitehouse, J. Yang, and S. Jana. Efficient formal safety analysis of neural networks. In Neural Information Processing Systems, 2018.
227
+
228
+ Eric Wong and J. Zico Kolter. Provable defenses against adversarial examples via the convex outer adversarial polytope. In International Conference on Machine Learning, 2018.
229
+
230
+ Eric Wong, Frank Schmidt, Jan Hendrik Metzen, and J. Zico Kolter. Scaling provable adversarial defenses. In Neural Information Processing Systems, 2018.
231
+
232
+ Weilin Xu, David Evans, and Yanjun Qi. Feature squeezing: Detecting adversarial examples in deep neural networks. In Network and Distributed Systems Security Symposium, 2018.
233
+
234
+ # A DESCRIPTION OF DATASETS AND DEEP LEARNING CLASSIFIERS
235
+
236
+ # A.1 FACE RECOGNITION
237
+
238
+ The VGGFace dataset3 (Parkhi et al., 2015) is a benchmark for face recognition, containing 2622 subjusts with 2.6 million images in total. We chose ten subjects: A. J. Buckley, A. R. Rahman, Aamir Khan, Aaron Staton, Aaron Tveit, Aaron Yoo, Abbie Cornish, Abel Ferrara, Abigail Breslin, and Abigail Spencer, and subselected face images pertaining only to these individuals. Since approximately half of the images cannot be downloaded, our final dataset contains 300-500 images for each subject.
239
+
240
+ We used the standard corp-and-resize method to process the data to be $2 2 4 \times 2 2 4$ pixels, and split the dataset into training, validation, and test according to a 7:2:1 ratio for each subject. In total, the data set has 3178 images in the training set, 922 images in the validation set, and 470 images in the test set.
241
+
242
+ We use the VGGFace convolutional neural network (Parkhi et al., 2015) model, a variant of the VGG16 model containing 5 convolutional layer blocks and 3 fully connected layers. We make use of standard transfer learning as we only classify 10 subjects, keeping the convolutional layers as same as VGGFace structure,4 but changing the fully connected layer to be $1 0 2 4 \to 1 0 2 4 \to 1 0$ instead of $4 0 9 6 \to 4 0 9 6 \to 2 6 2 2$ . Specifically, in our Pytorch implementation, we convert the images from RGB to BGR channel orders and subtract the mean value [129.1863, 104.7624, 93.5940] in order to use the pretrained weights from VGG-Face on convolutional layers. We set the batch size to be 64 and use Pytorch built-in Adam Optimizer with an initial learning rate of $1 0 ^ { - 4 }$ and default parameters in Pytorch.5 We drop the learning rate by 0.1 every 10 epochs. Additionally, we used validation set accuracy to keep track of model performance and choose a model in case of overfitting. After 30 epochs of training, the model successfully obtains $9 8 . 9 4 \%$ on test data.
243
+
244
+ # A.2 TRAFFIC SIGN CLASSIFICATION
245
+
246
+ To be consistent with (Eykholt et al., 2018), we select the subset of LISA which contains 47 different U.S. traffic signs (Møgelmose et al., 2012). To alleviate the problem of imbalance and extremely blurry data, we picked 16 best quality signs with 3509 training and 1148 validation data points. From the validation data, we obtain the test data that includes only 40 stop signs to evaluate performance with respect to the stop sign attack, as done by Eykholt et al. (2018). In the main body of the paper, we present results only on this test data to evaluate robustness to stop sign attacks. In the appendix below, we also include performance on the full validation set without adversarial manipulation.
247
+
248
+ All the data was processed by standard crop-and-resize to $3 2 \times 3 2$ pixels. We use the LISA-CNN architecture defined in (Eykholt et al., 2018), and construct a convolutional neural network containing three convolutional layers and one fully connected layer. We use the Adam Optimizer with initial learning rate of $1 0 ^ { - 1 }$ and default parameters 5, dropping the learning rate by 0.1 every 10 epochs. We set the batch size to be 128. After 30 epochs, we achieve the $9 8 . 6 9 \%$ accuracy on the validation set, and $100 \%$ accuracy in identifying the stop signs in our test data.
249
+
250
+ # B EFFECTIVENESS OF CONVENTIONAL ROBUST ML METHODS AGAINST $l _ { \infty }$ AND $l _ { 2 }$ ATTACKS
251
+
252
+ In this appendix, we show that adversarial training and randomized smoothing degrade more gracefully when faced with attacks that they are designed for. In particular, we consider here variants of projected gradient descent (PGD) for both the $l _ { \infty }$ and $l _ { 2 }$ attacks Madry et al. (2018). In particular, the form of PGD for the $l _ { \infty }$ attack is
253
+
254
+ $$
255
+ \boldsymbol { x } _ { t + 1 } = \mathrm { P r o j } ( \boldsymbol { x } _ { t } + \alpha \mathrm { s g n } ( \nabla L ( \boldsymbol { x } _ { t } ; \boldsymbol { \theta } ) ) ) ,
256
+ $$
257
+
258
+ where Proj is a projection operator which clips the result to be feasible, $x _ { t }$ the adversarial example in iteration $t$ , $\alpha$ the learning rate, and $L ( \cdot )$ the loss function. In the case of an $l _ { 2 }$ attack, PGD becomes
259
+
260
+ $$
261
+ x _ { t + 1 } = \mathrm { P r o j } \left( x _ { t } + \alpha \frac { \nabla L ( x _ { t } ; \theta ) } { \| \nabla L ( x _ { t } ; \theta ) \| _ { 2 } } \right) ,
262
+ $$
263
+
264
+ where the projection operator normalizes the perturbation $\delta = x _ { t + 1 } - x _ { t }$ to have $\lVert \delta \rVert _ { 2 } \leq \epsilon$ if it doesn’t already Kolter $\&$ Madry (2019).
265
+
266
+ The experiments were done on the face recognition and traffic sign datasets, but unlike physical attacks on stop signs, we now consider adversarial perturbations to all sign images.
267
+
268
+ # B.1 FACE RECOGNITION
269
+
270
+ Table 1: Curriculum Adversarial Training against 7 Iterations $L _ { \infty }$ Attacks on Face Recognition
271
+
272
+ <table><tr><td rowspan="2"></td><td colspan="5">Attack Strength</td></tr><tr><td>∈=0</td><td>e=2</td><td>∈=4</td><td>∈=8</td><td>∈=16</td></tr><tr><td>Clean Model</td><td>98.94%</td><td>57.87%</td><td>13.62%</td><td>0%</td><td>0%</td></tr><tr><td>CAdv. Training: ε = 4</td><td>97.45%</td><td>94.68%</td><td>87.02%</td><td>65.11%</td><td>17.23%</td></tr><tr><td>CAdv. Training: ∈ = 8</td><td>96.17%</td><td>93.40%</td><td>89.36%</td><td>75.53%</td><td>31.49%</td></tr><tr><td>CAdv. Training: ε = 16</td><td>90.64%</td><td>88.09%</td><td>84.04%</td><td>75.96%</td><td>45.74%</td></tr><tr><td>CAdv. Training: ε = 32</td><td>80.85%</td><td>76.60%</td><td>74.04%</td><td>65.10%</td><td>47.87 %</td></tr></table>
273
+
274
+ Table 2: Curriculum Adversarial Training against 20 Iterations $L _ { \infty }$ Attacks on Face Recognition
275
+
276
+ <table><tr><td rowspan="2"></td><td colspan="5">Attack Strength</td></tr><tr><td>∈=0</td><td>∈=2</td><td>∈=4</td><td>∈=8</td><td>∈=16</td></tr><tr><td>Clean Model</td><td>98.94%</td><td>44.04%</td><td>1.70%</td><td>0%</td><td>0%</td></tr><tr><td>CAdv. Training: ε= 4</td><td>97.45%</td><td>94.68%</td><td>85.74%</td><td>46.60%</td><td>5.11%</td></tr><tr><td>CAdv. Training: ε = 8</td><td>96.17%</td><td>93.19%</td><td>88.94%</td><td>69.36%</td><td>9.57%</td></tr><tr><td>CAdv. Training: ε = 16</td><td>90.64%</td><td>88.08%</td><td>83.83%</td><td>73.62%</td><td>35.96%</td></tr><tr><td>CAdv. Training: ε = 32</td><td>80.85%</td><td>76.17%</td><td>74.04%</td><td>63.82%</td><td>43.62%</td></tr></table>
277
+
278
+ We begin with our results on the face recognition dataset. Tables 1 and 2 present results for (curriculum) adversarial training for varying $\epsilon$ of the $l _ { \infty }$ attacks, separately for training and evaluation. As we can see, curriculum adversarial training with $\epsilon = 1 6$ is generally the most robust, and remains reasonably effective for relatively large perturbations. However, we do observe a clear tradeoff between accuracy on non-adversarial data and robustness, as one would expect.
279
+
280
+ Table 3: Randomized Smoothing against 20 Iterations $L _ { 2 }$ Attacks on Face Recognition
281
+
282
+ <table><tr><td rowspan="2"></td><td colspan="7">Attack Strength</td></tr><tr><td>∈=0</td><td>∈= 0.5</td><td>∈=1</td><td>∈= 1.5</td><td>∈=2</td><td>∈= 2.5</td><td>∈=3</td></tr><tr><td>Clean Model</td><td>98.94%</td><td>93.19%</td><td>70.85%</td><td>44.68%</td><td>22.13%</td><td>8.29%</td><td>3.19%</td></tr><tr><td>RS: σ = 0.25</td><td>98.51%</td><td>97.23%</td><td>95.53%</td><td>91.70%</td><td>81.06%</td><td>67.87%</td><td>52.97%</td></tr><tr><td>RS: σ = 0.5</td><td>97.65%</td><td>94.25%</td><td>93.61%</td><td>91.70%</td><td>87.87%</td><td>82.55%</td><td>71.70%</td></tr><tr><td>RS: σ =1</td><td>92.97%</td><td>93.19%</td><td>91.70%</td><td>91.06%</td><td>88.51%</td><td>85.53%</td><td>82.98%</td></tr></table>
283
+
284
+ Table 3 presents the results of using randomized smoothing on face recognition data, when facing the $l _ { 2 }$ attacks. Again, we observe a high level of robustness and, in most cases, relatively limited drop in performance, with $\sigma = 0 . 5$ perhaps striking the best balance.
285
+
286
+ # B.2 TRAFFIC SIGN CLASSIFICATION
287
+
288
+ Table 4: Curriculum Adversarial Training against 7 Iterations $L _ { \infty }$ Attacks on Traffic Signs
289
+
290
+ <table><tr><td rowspan="2"></td><td colspan="5">Attack Strength</td></tr><tr><td>∈=0</td><td>e=2</td><td>∈=4</td><td>∈=8</td><td>∈=16</td></tr><tr><td>Clean Model</td><td>98.69%</td><td>90.24%</td><td>65.24%</td><td>33.80%</td><td>10.10%</td></tr><tr><td>CAdv. Training: ε = 4</td><td>99.13%</td><td>97.13%</td><td>93.47%</td><td>63.85%</td><td>20.73%</td></tr><tr><td>CAdv. Training: e = 8</td><td>98.72%</td><td>96.86%</td><td>93.90%</td><td>81.70%</td><td>38.24%</td></tr><tr><td>CAdv. Training: ε = 16</td><td>96.95%</td><td>95.03%</td><td>92.77%</td><td>87.63%</td><td>64.02%</td></tr><tr><td>CAdv. Training: ε = 32</td><td>65.63%</td><td>53.83%</td><td>50.87%</td><td>46.69%</td><td>38.07%</td></tr></table>
291
+
292
+ Table 5: Curriculum Adversarial Training against 20 Iterations $L _ { \infty }$ Attacks on Traffic Signs
293
+
294
+ <table><tr><td rowspan="2"></td><td colspan="5">Attack Strength</td></tr><tr><td>∈=0</td><td>e=2</td><td>∈=4</td><td>∈=8</td><td>∈=16</td></tr><tr><td>Clean Model</td><td>98.69%</td><td>89.54%</td><td>61.58%</td><td>24.65%</td><td>5.14%</td></tr><tr><td>CAdv. Training: ε= 4</td><td>99.13%</td><td>96.95 %</td><td>91.90%</td><td>56.53%</td><td>12.02%</td></tr><tr><td>CAdv. Training: ε = 8</td><td>98.72%</td><td>96.68%</td><td>93.64%</td><td>76.22%</td><td>28.13%</td></tr><tr><td>CAdv. Training: ε = 16</td><td>96.95%</td><td>95.03%</td><td>92.51%</td><td>86.76%</td><td>54.01%</td></tr><tr><td>CAdv. Training: ε= 32</td><td>65.63%</td><td>53.83%</td><td>50.78%</td><td>46.08%</td><td>36.49%</td></tr></table>
295
+
296
+ Tables 4 and 5 present evaluation on traffic sign data for curriculum adversarial training against the $l _ { \infty }$ attack for varying $\epsilon$ . As with face recognition data, we can observe that the approaches tend to be relatively robust, and effective on non-adversarial data for adversarial training methods using $\epsilon < 3 2$ .
297
+
298
+ Table 6: Randomized Smoothing against 20 Iterations $L _ { 2 }$ Attacks on Traffic Signs
299
+
300
+ <table><tr><td rowspan="2"></td><td colspan="7">Attack Strength</td></tr><tr><td>∈=0</td><td>€=0.5</td><td>e=1</td><td>e=1.5</td><td>=2</td><td>€=2.5</td><td>e=3</td></tr><tr><td>Clean Model</td><td>98.69%</td><td>61.67%</td><td>25.78%</td><td>11.50%</td><td>7.84%</td><td>4.97%</td><td>3.57%</td></tr><tr><td>RS: σ = 0.25</td><td>98.22%</td><td>89.08%</td><td>55.69%</td><td>34.06%</td><td>23.46%</td><td>18.61%</td><td>14.75%</td></tr><tr><td>RS: σ = 0.5</td><td>96.28%</td><td>90.80%</td><td>76.13%</td><td>52.64%</td><td>35.31%</td><td>23.43%</td><td>16.52%</td></tr><tr><td>RS: σ=1</td><td>88.21%</td><td>83.68%</td><td>75.49%</td><td>64.90%</td><td>50.03%</td><td>36.53%</td><td>26.22%</td></tr></table>
301
+
302
+ The results of randomized smoothing on traffic sign data are given in Table 6. Since images are smaller here than in VGGFace, lower values of $\epsilon$ for the $l _ { 2 }$ attacks are meaningful, and for $\epsilon \leq 1$ we generally see robust performance on randomized smoothing, with $\sigma = 0 . 5$ providing a good balance between non-adversarial accuracy and robustness, just as before.
303
+
304
+ # C EXAMPLES OF ROA
305
+
306
+ ![](images/9b15613ea1509f85a39cec3e1d056e45270b026774ffe247b96ed4abe9f9f58d.jpg)
307
+ Figure 6: Examples of the ROA attack on face recognition, using a rectangle of size $1 0 0 \times 5 0$ . (a) Left: the original A. J. Buckley’s image. Middle: modified input image (ROA superimposed on the face). Right: an image of the predicted individual who is Aaron Tveit with the adversarial input in the middle image. (b) Left: the original Abigail Spencer’s image. Middle: modified input image (ROA superimposed on the face). Right: an image of the predicted individual who is Aaron Yoo with the adversarial input in the middle image.
308
+
309
+ Figure 6 provides several examples of the ROA attack in the context of face recognition. Note that in these examples, the adversaries choose to occlude the noise on upper lip and eye areas of the image, and, indeed, this makes the face more challenging to recognize even to a human observer.
310
+
311
+ ![](images/d8e0f63fdbb6afc2bd83ba613c0eb42cf062de9082242eb2b95e8249b43f13a2.jpg)
312
+ Figure 7: Examples of the ROA attack on traffic sign, using a rectangle of size $7 \times 7 .$ . (a) Left: the original Speedlimit45 sign. Middle: modified input image (ROA superimposed on the sign). Right: an image of the predicted which is Speedlimit30 with the adversarial input in the middle image. (b) Left: the original Stop sign. Middle: modified input image (ROA superimposed on the sign). Right: an image of the predicted Yield sign with the adversarial input in the middle image.
313
+
314
+ # D DETAILED DESCRIPTION OF THE ALGORITHMS FOR COMPUTING THE RECTANGULAR OCCLUSION ATTACKS
315
+
316
+ Our basic algorithm for computing rectangular occlusion attacks (ROA) proceeds through the following two steps:
317
+
318
+ 1. Iterate through possible positions for the rectangle’s upper left-hand corner point in the image. Find the position for a grey rectangle (RGB value =[127.5,127.5,127.5]) in the image that maximizes loss. 2. Generate high- $l _ { \infty }$ noise inside the rectangle at the position computed in step 1.
319
+
320
+ Algorithm 1 presents the full algorithm for identifying the ROA position, which amounts to exhaustive search through the image pixel region. This algorithm has several parameters. First, we assume that images are squares with dimensions $N ^ { 2 }$ . Second, we introduce a stride parameter $S$ . The purpose of this parameter is to make location computation faster by only considering every other $S _ { \mathrm { t h } }$ pixel during the search (in other words, we skip $S$ pixels each time). For our implementation of ROA attacks, we choose the stride parameter $S = 5$ for face recognition and $S = 2$ for traffic sign classification.
321
+
322
+ Algorithm 1 Computation of ROA position using exhaustive search.
323
+
324
+ Input: Data: $X _ { i } , y _ { i }$ ; Test data shape: $N \times N$ ; Target model parameters: $\theta$ ; Stride: $S$ ; Output: ROA Position: $( j ^ { \prime } , k ^ { \prime } )$ 1.function ExhaustiveSearching $( M o d e l , X _ { i } , y _ { i } , N , S )$ 2. for j in range $( N / S )$ do: 3. for $\mathrm { k }$ in range $( N / S )$ do: 4. Generate the adversarial $X _ { i } ^ { a d v }$ image by: 5. place a grey rectangle onto the image with top-left corner at $( j \times S , k \times S )$ ; 6. if $\operatorname { L } ( X _ { i } ^ { a \bar { d } v } , y _ { i } , \theta )$ is higher than previous loss: 7. Update $( j ^ { \prime } , k ^ { \prime } ) = { \mathsf { \bar { ( } } } j , k )$ 8. end for 9. end for 10. return $( j ^ { \prime } , k ^ { \prime } )$
325
+
326
+ Algorithm 2 Computation of ROA position using gradient-based search.
327
+
328
+ Input: Data: $X _ { i } , y _ { i }$ ; Test data shape: $N \times N$ ; Target Model: $\theta$ ; Stride: S ; Number of Potential Candidates: $C$ ; Output: Best Sticker Position: $( j ^ { \prime } , k ^ { \prime } )$
329
+
330
+ 1.function GradientBasedSearch $( X _ { i } , y _ { i } , N , S , C , \theta )$
331
+ 2. Calculate the gradient $\nabla L$ of $\operatorname { L o s s } ( X _ { i } , y _ { i } , \theta )$ w.r.t. $X _ { i }$
332
+ 3. $\mathbb { J } , \mathbb { K } =$ HelperSearching $( \nabla L , N , S , C )$
333
+ 4. for $j , k$ in $\mathbb { J } , \mathbb { K }$ do:
334
+ 5. Generate the adversarial $X _ { i } ^ { a d v }$ image by:
335
+ 6. put the sticker on the image where top-left corner at $( j \times S , k \times S )$ ;
336
+ 7. if $\mathrm { L o s s } ( X _ { i } ^ { a d v } , y _ { i } , \theta )$ is higher than previous loss:
337
+ 8. Update $( j ^ { \prime } , k ^ { \prime } ) = ( j , k )$
338
+ 9. end for
339
+ 10. return $( j ^ { \prime } , k ^ { \prime } )$
340
+ 1.function HelperSearching $( \nabla L , N , S , C )$
341
+ 2. for j in range $( N / S )$ do:
342
+ 3. for $\mathrm { k }$ in range $( N / S )$ do:
343
+ 4. Calculate the Sensitivity value $\begin{array} { r } { L = \sum _ { i \in \mathrm { r e c t a n g l e } } ( \nabla L _ { i } ) ^ { 2 } } \end{array}$ where top-left corner at $( j \times$
344
+ $S , k \times S )$ ;
345
+ 6. if the Sensitivity value $L$ is in top $C$ of previous values:
346
+ 7. Put $( j , k )$ in $\mathbb { J } , \mathbb { K }$ and discard $( j _ { s } , k _ { s } )$ with lowest $L$
347
+ 8. end for
348
+ 9. end for
349
+ 10. return $\mathbb { J } , \mathbb { K }$
350
+
351
+ Despite introducing the tunable stride parameter, the search for the best location for ROA still entails a large number of loss function evaluations, which are somewhat costly (since each such evaluation means a full forward pass through the deep neural network), and these costs add up quickly. To speed things up, we consider using the magnitude of the gradient of the loss as a measure of sensitivity of particular regions to manipulation. Specifically, suppose that we compute a gradient $\nabla L$ , and let $\nabla L _ { i }$ be the gradient value for a particular pixel $i$ in the image. Now, we can iterate over the possible ROA locations, but for each location compute the gradient of the loss at that location corresponding to the rectangular region. We do this by adding squared gradient values $( \nabla L _ { i } ) ^ { 2 }$ over pixels $i$ in the rectangle. We use this approach to find the top $C$ candidate locations for the rectangle. Finally, we consider each of these, computing the actual loss for each location, to find the position of ROA. The full algorithm is provided as Algorithm 2.
352
+
353
+ Once we’ve found the place for the rectangle, our next step is to introduce adversarial noise inside it. For this, we use the $l _ { \infty }$ version of the PGD attack, restricting perturbations to the rectangle. We used $\{ 7 , 2 0 , 3 0 , 5 0 \}$ iterations of PGD to generate adversarial noise inside the rectangle, and with learning rate $\alpha = \{ \bar { 3 } 2 , 1 6 , 8 , 4 \}$ correspondingly.
354
+
355
+ ![](images/e1f528781f2d8f0fef62932d9fabe44ef7f4f0ce321a821d9c9345250def1194.jpg)
356
+ Figure 8: Examples of different search techniques. From left to right: 1) the original input image, 2) the plot of input gradient, 3) face with ROA location identified using gradient-based search, 4) face with ROA location identified using exhaustive search. Each row is a different example.
357
+
358
+ Figure 8 offers a visual illustration of how gradient-based search compares to exhaustive search for computing ROA.
359
+
360
+ # E DETAILS OF PHYSICALLY REALIZABLE ATTACKS
361
+
362
+ Physically realizable attacks that we study have a common feature: first, they specify a mask, which is typically precomputed, and subsequently introduce adversarial noise inside the mask area. Let $M$ denote the mask matrix constraining the area of the perturbation $\delta$ ; $M$ has the same dimensions as the input image and contains 0s where no perturbation is allowed, and 1s in the area which can be perturbed. The physically realizable attacks we consider then solve an optimization problem of the following form:
363
+
364
+ $$
365
+ \underset { \pmb { \delta } } { \arg \operatorname* { m a x } } L ( f ( \pmb { x } + M \pmb { \delta } ; \pmb { \theta } ) , y ) .
366
+ $$
367
+
368
+ Next, we describe the details of the three physical attacks we consider in the main paper.
369
+
370
+ # E.1 EYEGLASS FRAME ATTACKS ON FACE RECOGNITION
371
+
372
+ Following Sharif et al. (2016), we first initialized the eyeglass frame with 5 different colors, and chose the best starting color by calculating the cross-entropy loss. For each update step, we divided the gradient value by its maximum value before multiplying by the learning rate which is 20. Then we only kept the gradient value of eyeglass frame area. Finally, we clipped and rounded the pixel value to keep it in the valid range.
373
+
374
+ # E.2 STICKER ATTACKS ON STOP SIGNS
375
+
376
+ Following Eykholt et al. (2018), we initialized the stickers on the stop signs with random noise. For each update step, we used the Adam optimizer with 0.1 learning rate and with default parameters. Just as for other attacks, adversarial perturbations were restricted to the mask area exogenously specified; in our case, we used the same mask as Eykholt et al. (2018)—a collection of small rectangles.
377
+
378
+ # E.3 ADVERSARIAL PATCH ATTACK
379
+
380
+ We used gradient ascent to maximize the log probability of the targeted class $P [ y _ { t a r g e t } | x ]$ , as in the original paper (Brown et al., 2018). When implementing the adversarial patch, we used a square patch rather than the circular patch in the original paper; we don’t anticipate this choice to be practically consequential. We randomly chose the position and direction of the patch, used the learning rate of 5, and fixed the number of attack iterations to 100 for each image. We varied the attack region (mask) $R \in \{ 0 \% , 5 \% , 1 0 \% , 1 5 \% , 2 0 \% , 2 5 \% \}$ .
381
+
382
+ For the face recognition dataset, we used 27 images (9 classes (without targeted class) $\times 3$ images in each class) to design the patch, and then ran the attack over 20 epochs. For the smaller traffic sign dataset, we used 15 images (15 classes (without targeted class) $\times \ 1$ image in each class) to design the patch, and then ran the attack over 5 epochs. Note that when evaluating the adversarial patch, we used the validation set without the targeted class images.
383
+
384
+ # F ADDITIONAL EXPERIMENTS WITH DOA
385
+
386
+ # F.1 FACE RECOGNITION AND EYEGLASS FRAME ATTACK
387
+
388
+ ![](images/1441a0032e5a921ca736427e1930a05ad8d874e67e093d370e82908208983afc.jpg)
389
+ Figure 9: Effectiveness of DOA using the gradient-based method and the $1 0 0 \times 5 0$ region against the eyeglass frame attack, varying the number of PGD iterations for adversarial perturbations inside the rectangle. Left: using exhaustive search. Right: using gradient-based search.
390
+
391
+ ![](images/53cdc4cd4f87c4d9cb8b65b7c7ce7cff90d80085f2e5b92e60c26f1c78cb0390.jpg)
392
+ Figure 10: Effectiveness of DOA using the gradient-based method and the $7 0 \times 7 0$ region against the eyeglass frame attack, varying the number of PGD iterations for adversarial perturbations inside the rectangle. Left: using exhaustive search. Right: using gradient-based search.
393
+
394
+ # F.2 TRAFFIC SIGN CLASSIFICATION AND THE STOP SIGN ATTACK
395
+
396
+ Table 7: Comparison of effectiveness of different approaches against the stop sign attack. Best parameter choices were made for each.
397
+
398
+ <table><tr><td rowspan="2">Validation Set</td><td rowspan="2"></td><td colspan="4">Attack Iterations</td></tr><tr><td>0</td><td>101</td><td>10²</td><td>103</td></tr><tr><td>Clean Model</td><td>98.69%</td><td>100%</td><td>42.5%</td><td>32.5%</td><td>25%</td></tr><tr><td>CAdv. Training: ε = 16</td><td>96.95%</td><td>97.5%</td><td>57.5%</td><td>45%</td><td>42.5%</td></tr><tr><td>Randomized Smoothing: o = 0.25</td><td>98.22%</td><td>100%</td><td>70%</td><td>64.5%</td><td>62.5%</td></tr><tr><td>DOA (exhaustive; 7 × 7; 30 PGD)</td><td>92.51%</td><td>100%</td><td>92%</td><td>92%</td><td>90.5%</td></tr><tr><td>DOA (gradient-based; 7 × 7; 30 PGD)</td><td>95.82%</td><td>100%</td><td>85%</td><td>85.5%</td><td>84%</td></tr></table>
399
+
400
+ Table 8: Effectiveness of $1 0 \times 5$ DOA using exhaustive search with different numbers of PGD iterations against the stop sign attack.
401
+
402
+ <table><tr><td colspan="2"></td><td colspan="4">Attack Iterations</td></tr><tr><td></td><td>Validation Set</td><td>0</td><td>101</td><td>10²</td><td>103</td></tr><tr><td>Clean Model</td><td>98.69 %</td><td>100%</td><td>42.5%</td><td>32.5%</td><td>25%</td></tr><tr><td>Exhaustive Search with 7PGD</td><td>96.50%</td><td>100%</td><td>73%</td><td>70.5%</td><td>71%</td></tr><tr><td>Exhaustive Search with 20 PGD</td><td>95.86%</td><td>100%</td><td>86%</td><td>85%</td><td>85%</td></tr><tr><td>Exhaustive Search with 30 PGD</td><td>95.59%</td><td>100%</td><td>86.5%</td><td>84%</td><td>82.5%</td></tr><tr><td>Exhaustive Search with 5O PGD</td><td>95.87%</td><td>100%</td><td>77%</td><td>76.5%</td><td>73.5%</td></tr></table>
403
+
404
+ Table 9: Effectiveness of $1 0 \times 5$ gradient-based DOA with different numbers of PGD iterations against the stop sign attack.
405
+
406
+ <table><tr><td rowspan="2"></td><td rowspan="2">Validation Set</td><td colspan="4">Attack Iterations</td></tr><tr><td>0</td><td>101</td><td>10²</td><td>103</td></tr><tr><td>Clean Model</td><td>98.69%</td><td>100%</td><td>42.5%</td><td>32.5%</td><td>25%</td></tr><tr><td>Gradient Based Search with 7 PGD</td><td>97.53%</td><td>100%</td><td>83.5%</td><td>78%</td><td>78%</td></tr><tr><td>Gradient Based Search with 20 PGD</td><td>97.11%</td><td>100%</td><td>82.5%</td><td>81.5%</td><td>80.5%</td></tr><tr><td>Gradient Based Search with 30 PGD</td><td>96.83%</td><td>100%</td><td>83.5%</td><td>79.5%</td><td>81%</td></tr><tr><td>Gradient Based Search with 50 PGD</td><td>96.46%</td><td>100%</td><td>82.5%</td><td>82.5%</td><td>81.5%</td></tr></table>
407
+
408
+ Table 10: Effectiveness of $7 \times 7$ DOA using exhaustive search with different numbers of PGD iterations against the stop sign attack.
409
+
410
+ <table><tr><td rowspan="2"></td><td rowspan="2">Validation Set</td><td colspan="4">Attack Iterations</td></tr><tr><td>0</td><td>101</td><td>10²</td><td>103</td></tr><tr><td>Clean Model</td><td>98.69%</td><td>100%</td><td>42.5%</td><td>32.5%</td><td>25%</td></tr><tr><td>Exhaustive Search with 7PGD</td><td>94.16%</td><td>100%</td><td>86.5%</td><td>85%</td><td>85%</td></tr><tr><td>Exhaustive Search with 2O PGD</td><td>92.74%</td><td>100%</td><td>83%</td><td>80%</td><td>79%</td></tr><tr><td>Exhaustive Search with 30 PGD</td><td>92.51%</td><td>100%</td><td>92%</td><td>92%</td><td>90.5%</td></tr><tr><td>Exhaustive Search with 50 PGD</td><td>92.94%</td><td>100%</td><td>89.5%</td><td>89%</td><td>88.5%</td></tr></table>
411
+
412
+ Table 11: Effectiveness of $7 \times 7$ gradient-based DOA with different numbers of PGD iterations against the stop sign attack.
413
+
414
+ <table><tr><td rowspan="2">Validation Set</td><td rowspan="2"></td><td colspan="4">Attack Iterations</td></tr><tr><td>0</td><td>101</td><td>10²</td><td>103</td></tr><tr><td>Clean Model</td><td>98.69 %</td><td>100%</td><td>42.5%</td><td>32.5%</td><td>25%</td></tr><tr><td>Gradient Based Search with 7PGD</td><td>96.52%</td><td>100%</td><td>81.5%</td><td>80%</td><td>79.5%</td></tr><tr><td>Gradient Based Search with 2O PGD</td><td>95.51%</td><td>100%</td><td>83.5%</td><td>82.5%</td><td>83%</td></tr><tr><td>Gradient Based Search with 30 PGD</td><td>95.82%</td><td>100%</td><td>85%</td><td>85.5%</td><td>84%</td></tr><tr><td>Gradient Based Search with 5O PGD</td><td>95.59%</td><td>100%</td><td>81%</td><td>81%</td><td>81.5%</td></tr></table>
415
+
416
+ # F.3 EVALUATION WITH THE ADVERSARIAL PATCH ATTACK
417
+
418
+ # F.3.1 FACE RECOGNITION
419
+
420
+ Table 12: Comparison of effectiveness of different approaches against the adversarial patch attack on the face recognition data. Best parameter choices were made for each.
421
+
422
+ <table><tr><td rowspan="2"></td><td colspan="6">Size of Attacking Region</td></tr><tr><td>0%</td><td>5%</td><td>10%</td><td>15%</td><td>20%</td><td>25%</td></tr><tr><td>Clean Model</td><td>99.30%</td><td>80.69%</td><td>41.21%</td><td>19.41%</td><td>9.76%</td><td>5.75%</td></tr><tr><td>CAdv. Training: ε = 16</td><td>94.15%</td><td>48.26%</td><td>34.38%</td><td>28.85%</td><td>23.54%</td><td>19.02%</td></tr><tr><td>Randomized Smoothing: σ= 1</td><td>98.83%</td><td>61.99%</td><td>36.26%</td><td>33.80%</td><td>24.68%</td><td>16.02%</td></tr><tr><td>DOA (exh. ; 100 × 50; 50 PGD)</td><td>99.30%</td><td>98.72%</td><td>97.83%</td><td>97.18%</td><td>81.24%</td><td>24.19%</td></tr><tr><td>DOA (exh. ; 70 × 70; 50 PGD)</td><td>99.41%</td><td>98.37%</td><td>97.29%</td><td>96.53%</td><td>63.23%</td><td>44.14%</td></tr></table>
423
+
424
+ Table 13: Effectiveness of adversarial training against the adversarial patch attack on face recognition data.
425
+
426
+ <table><tr><td rowspan="2"></td><td colspan="6">Size of Attacking Region</td></tr><tr><td>0%</td><td>5%</td><td>10%</td><td>15%</td><td>20%</td><td>25%</td></tr><tr><td>Clean Model</td><td>99.30%</td><td>80.69%</td><td>41.21%</td><td>19.41%</td><td>9.76%</td><td>5.75%</td></tr><tr><td>7 Iterations Adv. Training: ε= 4</td><td>92.28%</td><td>57.05%</td><td>39.15%</td><td>34.71%</td><td>10.52%</td><td>7.81%</td></tr><tr><td>7 Iterations Adv. Training: ε = 8</td><td>66.54%</td><td>27.98%</td><td>23.54%</td><td>21.26%</td><td>18.55%</td><td>17.03%</td></tr><tr><td>50 Iterations Adv. Training: ε = 4</td><td>90.29%</td><td>57.38%</td><td>53.58%</td><td>36.01%</td><td>28.85%</td><td>16.05%</td></tr><tr><td>50 Iterations Adv. Training: ε= 8</td><td>53.68%</td><td>21.80%</td><td>21.15%</td><td>17.79%</td><td>17.79%</td><td>16.70%</td></tr></table>
427
+
428
+ Table 14: Effectiveness of curriculum adversarial training against the adversarial patch attack on face recognition data.
429
+
430
+ <table><tr><td rowspan="2"></td><td colspan="6">Size of Attacking Region</td></tr><tr><td>0%</td><td>5%</td><td>10%</td><td>15%</td><td>20%</td><td>25%</td></tr><tr><td>Clean Model</td><td>99.30%</td><td>80.69%</td><td>41.21%</td><td>19.41%</td><td>9.76%</td><td>5.75%</td></tr><tr><td>CAdv. Training: ∈= 4</td><td>97.89%</td><td>52.49%</td><td>45.44%</td><td>30.91%</td><td>16.05%</td><td>10.85%</td></tr><tr><td>CAdv. Training: e = 8</td><td>96.84%</td><td>44.79%</td><td>29.18%</td><td>23.86%</td><td>12.47%</td><td>10.20%</td></tr><tr><td>CAdv. Training: ε = 16</td><td>94.15%</td><td>48.26%</td><td>34.38%</td><td>28.85%</td><td>23.54%</td><td>19.20%</td></tr><tr><td>CAdv. Training: ε = 32</td><td>81.05%</td><td>42.95%</td><td>40.46%</td><td>32.00%</td><td>20.93%</td><td>17.14%</td></tr></table>
431
+
432
+ Table 15: Effectiveness of randomized smoothing against the adversarial patch attack on face recognition data.
433
+
434
+ <table><tr><td rowspan="2"></td><td colspan="6">Size of Attacking Region</td></tr><tr><td>0%</td><td>5%</td><td>10%</td><td>15%</td><td>20%</td><td>25%</td></tr><tr><td>Clean Model</td><td>99.30%</td><td>80.69%</td><td>41.21%</td><td>19.41%</td><td>9.76%</td><td>5.75%</td></tr><tr><td>Randomized Smoothing: σ = 0.25</td><td>98.95%</td><td>60.35%</td><td>26.67%</td><td>13.80%</td><td>6.67%</td><td>5.15%</td></tr><tr><td>Randomized Smoothing: o = 0.5</td><td>97.66%</td><td>81.05%</td><td>58.83%</td><td>33.92%</td><td>26.55%</td><td>14.74%</td></tr><tr><td>Randomized Smoothing: o=1</td><td>98.83%</td><td>61.99%</td><td>36.26%</td><td>33.80%</td><td>24.68%</td><td>16.02%</td></tr></table>
435
+
436
+ Table 16: Effectiveness of DOA $5 0 ~ \mathrm { P G D }$ iterations) against the adversarial patch attack on face recognition data.
437
+
438
+ <table><tr><td rowspan="2"></td><td colspan="6"> Size of Attacking Region</td></tr><tr><td>0%</td><td>5%</td><td>10%</td><td>15%</td><td>20%</td><td>25%</td></tr><tr><td>Clean Model</td><td>99.30%</td><td>80.69%</td><td>41.21%</td><td>19.41%</td><td>9.76%</td><td>5.75%</td></tr><tr><td>(100 × 50)Exhaustive Search</td><td>99.30%</td><td>98.70%</td><td>97.83%</td><td>97.18%</td><td>81.24%</td><td>24.19%</td></tr><tr><td>(100 × 5O)Gradient Based Search</td><td>99.53%</td><td>98.41%</td><td>96.75%</td><td>87.42%</td><td>57.48%</td><td>24.62%</td></tr><tr><td>(70 × 7O)Exhaustive Search</td><td>99.41%</td><td>98.37%</td><td>97.29%</td><td>96.53%</td><td>63.23%</td><td>44.14%</td></tr><tr><td>(70 × 7O)Gradient Based Search</td><td>98.83%</td><td>97.51%</td><td>96.31%</td><td>93.82%</td><td>92.19%</td><td>31.34%</td></tr></table>
439
+
440
+ # F.3.2 TRAFFIC SIGN CLASSIFICATION
441
+
442
+ Table 17: Comparison of effectiveness of different approaches against the adversarial patch attack on the traffic sign data. Best parameter choices were made for each.
443
+
444
+ <table><tr><td rowspan="2"></td><td colspan="6">Size of Attacking Region</td></tr><tr><td>0%</td><td>5%</td><td>10%</td><td>15%</td><td>20%</td><td>25%</td></tr><tr><td>Clean Model</td><td>98.38%</td><td>75.87%</td><td>58.62%</td><td>40.68%</td><td>33.10%</td><td>22.47%</td></tr><tr><td>CAdv. Training: ε = 16</td><td>96.77%</td><td>86.93%</td><td>70.21%</td><td>66.11%</td><td>51.13%</td><td>40.77%</td></tr><tr><td>Randomized Smoothing: g = 0.5</td><td>95.39%</td><td>83.28%</td><td>68.17%</td><td>53.86%</td><td>48.79%</td><td>33.10%</td></tr><tr><td>DOA (grad. ; 7 × 7; 30 PGD)</td><td>94.69%</td><td>90.68%</td><td>88.41%</td><td>81.79%</td><td>72.30%</td><td>58.71%</td></tr><tr><td>DOA (grad. ; 7 × 7; 50 PGD)</td><td>94.69%</td><td>90.33%</td><td>89.29%</td><td>78.92%</td><td>70.21%</td><td>58.54%</td></tr></table>
445
+
446
+ Table 18: Effectiveness of adversarial training against the adversarial patch attack on traffic sign data.
447
+
448
+ <table><tr><td rowspan="2"></td><td colspan="6">Size of Attacking Region</td></tr><tr><td>0%</td><td>5%</td><td>10%</td><td>15%</td><td>20%</td><td>25%</td></tr><tr><td>Clean Model</td><td>98.38%</td><td>75.87%</td><td>58.62%</td><td>40.68%</td><td>33.10%</td><td>22.47%</td></tr><tr><td>Adv. Training: e = 4</td><td>98.96%</td><td>82.14%</td><td>64.46%</td><td>45.73%</td><td>31.36%</td><td>23.78%</td></tr><tr><td>Adv. Training: ε = 8</td><td>95.62%</td><td>76.74%</td><td>62.89%</td><td>46.60%</td><td>37.37%</td><td>25.09%</td></tr></table>
449
+
450
+ Table 19: Effectiveness of curriculum adversarial training against the adversarial patch attack on traffic sign data.
451
+
452
+ <table><tr><td rowspan="2"></td><td colspan="6">Size of Attacking Region</td></tr><tr><td>0%</td><td>5%</td><td>10%</td><td>15%</td><td>20%</td><td>25%</td></tr><tr><td>Clean Model</td><td>98.38%</td><td>75.87%</td><td>58.62%</td><td>40.68%</td><td>33.10%</td><td>22.47%</td></tr><tr><td>CAdv. Training: ∈= 4</td><td>98.96%</td><td>77.18%</td><td>57.32%</td><td>39.02%</td><td>38.94%</td><td>31.10%</td></tr><tr><td>CAdv. Training: e = 8</td><td>98.96%</td><td>86.24%</td><td>68.64%</td><td>60.19%</td><td>42.42%</td><td>35.10%</td></tr><tr><td>CAdv. Training: ε = 16</td><td>96.77%</td><td>86.93%</td><td>70.21%</td><td>66.11%</td><td>51.13%</td><td>40.77%</td></tr><tr><td>CAdv. Training: e = 32</td><td>63.78%</td><td>59.93%</td><td>51.57%</td><td>45.38%</td><td>37.37%</td><td>27.79%</td></tr></table>
453
+
454
+ Table 20: Effectiveness of randomized smoothing against the adversarial patch attack on traffic sign data.
455
+
456
+ <table><tr><td rowspan="2"></td><td colspan="6">Size of Attacking Region</td></tr><tr><td>0%</td><td>5%</td><td>10%</td><td>15%</td><td>20%</td><td>25%</td></tr><tr><td>Clean Model</td><td>98.38%</td><td>75.87%</td><td>58.62%</td><td>40.68%</td><td>33.10%</td><td>22.47%</td></tr><tr><td>Randomized Smoothing: g = 0.25</td><td>98.27%</td><td>82.24%</td><td>66.78%</td><td>54.67%</td><td>40.37%</td><td>33.79%</td></tr><tr><td>Randomized Smoothing: o = 0.5</td><td>95.39%</td><td>83.28%</td><td>68.17 %</td><td>53.86%</td><td>48.79%</td><td>33.10%</td></tr><tr><td>Randomized Smoothing: σ = 1</td><td>85.47%</td><td>74.39%</td><td>54.44%</td><td>45.44%</td><td>40.48%</td><td>29.06%</td></tr></table>
457
+
458
+ Table 21: Effectiveness of DOA $3 0 \mathrm { P G D }$ iterations) against the adversarial patch attack on traffic sign data.
459
+
460
+ <table><tr><td rowspan="2"></td><td colspan="6">Size of Attacking Region</td></tr><tr><td>0%</td><td>5%</td><td>10%</td><td>15%</td><td>20%</td><td>25%</td></tr><tr><td>Clean Model</td><td>98.38%</td><td>75.87%</td><td>58.62%</td><td>40.68%</td><td>33.10%</td><td>22.47%</td></tr><tr><td>(10 × 5)Exhaustive Search</td><td>94.00%</td><td>91.46%</td><td>86.67%</td><td>76.39%</td><td>68.12%</td><td>55.57%</td></tr><tr><td>(10 × 5)Gradient Based Search</td><td>93.77%</td><td>86.67%</td><td>80.57%</td><td>75.00%</td><td>64.90%</td><td>54.44%</td></tr><tr><td>(7 × 7)Exhaustive Search</td><td>92.27%</td><td>89.02%</td><td>82.93%</td><td>78.40%</td><td>66.90%</td><td>55.92%</td></tr><tr><td>(7 × 7)Gradient Based Search</td><td>94.69%</td><td>90.68%</td><td>88.41%</td><td>81.79%</td><td>72.30%</td><td>58.71%</td></tr></table>
461
+
462
+ Table 22: Effectiveness of DOA $\mathrm { 5 0 ~ P G D }$ iterations) against the adversarial patch attack on traffic sign data.
463
+
464
+ <table><tr><td rowspan="2"></td><td colspan="6">Size of Attacking Region</td></tr><tr><td>0%</td><td>5%</td><td>10%</td><td>15%</td><td>20%</td><td>25%</td></tr><tr><td>Clean Model</td><td>98.38%</td><td>75.87%</td><td>58.62%</td><td>40.68%</td><td>33.10%</td><td>22.47%</td></tr><tr><td>(10 × 5)Exhaustive Search</td><td>96.42%</td><td>93.90%</td><td>90.42%</td><td>80.66%</td><td>67.77%</td><td>53.92%</td></tr><tr><td>(10 × 5)Gradient Based Search</td><td>93.54%</td><td>90.33%</td><td>85.80%</td><td>79.79%</td><td>69.86%</td><td>49.74%</td></tr><tr><td>(7 × 7)Exhaustive Search</td><td>87.08%</td><td>82.49%</td><td>75.96%</td><td>70.99%</td><td>60.10%</td><td>52.53%</td></tr><tr><td>(7 × 7)Gradient Based Search</td><td>94.69%</td><td>90.33%</td><td>89.29%</td><td>78.92%</td><td>70.21%</td><td>58.54%</td></tr></table>
465
+
466
+ # G EXAMPLES OF PHYSICALLY REALIZABLE ATTACK AGAINST ALL DEFENSE MODELS
467
+
468
+ # G.1 FACE RECOGNITION
469
+
470
+ ![](images/ad9d887975dd6ae82cd73b37c1844a33d113d1ec49426c27754019d58ca740ec.jpg)
471
+ Figure 11: Examples of the eyeglass attack on face recognition. From left to right: 1) the original input image, 2) image with adversarial eyeglass frames, 3) face predicted by a model generated through adversarial training, 4) face predicted by a model generated through randomized smoothing, 5) face predicted (correctly) by a model generated through DOA. Each row is a separate example.
472
+
473
+ ![](images/8530a64664d83a030f6f9b6cdf6c1343d655db2d821d58f7594cd6379f85bcc2.jpg)
474
+ Figure 12: Examples of the stop sign attack. From left to right: 1) the original input image, 2) image with adversarial eyeglass frames, 3) face predicted by a model generated through adversarial training, 4) face predicted by a model generated through randomized smoothing, 5) face predicted (correctly) by a model generated through DOA. Each row is a separate example.
475
+
476
+ # H EFFECTIVENESS OF DOA METHODS AGAINST $l _ { \infty }$ ATTACKS
477
+
478
+ For completeness, this section includes evaluation of DOA in the context of $l _ { \infty }$ -bounded attack implemented using PGD, though these are outside the scope of our threat model.
479
+
480
+ Table 23: Effectiveness of DOA (50 PGD iterations) against 20 Iterations $L _ { \infty }$ Attacks on Face Recognition
481
+
482
+ <table><tr><td rowspan="2"></td><td colspan="5">Attack Strength</td></tr><tr><td>∈=0</td><td>∈=2</td><td>∈=4</td><td>e=8</td><td>∈=16</td></tr><tr><td>Clean Model</td><td>98.94%</td><td>44.04%</td><td>1.70%</td><td>0%</td><td>0%</td></tr><tr><td>(100 × 50)Exhaustive Search</td><td>98.72%</td><td>39.79%</td><td>1.06%</td><td>0%</td><td>0%</td></tr><tr><td>(100 × 50)Gradient Based Search</td><td>98.51%</td><td>40.64%</td><td>3.40%</td><td>0%</td><td>0%</td></tr><tr><td>(70 × 70)Exhaustive Search</td><td>98.51%</td><td>35.74%</td><td>0.43%</td><td>0%</td><td>0%</td></tr><tr><td>(70 × 70)Gradient Based Search</td><td>97.45%</td><td>33.40%</td><td>0.43%</td><td>0%</td><td>0%</td></tr></table>
483
+
484
+ Table 24: Effectiveness of DOA (50 PGD iterations) against 20 Iterations $L _ { \infty }$ Attacks on Traffic Sign Classification
485
+
486
+ <table><tr><td rowspan="2"></td><td colspan="5">Attack Strength</td></tr><tr><td>∈=0</td><td>∈=2</td><td>∈=4</td><td>∈=8</td><td>∈=16</td></tr><tr><td>Clean Model</td><td>98.69%</td><td>89.54%</td><td>61.58%</td><td>24.65%</td><td>5.14%</td></tr><tr><td>(10 × 5)Exhaustive Search</td><td>95.87%</td><td>91.55%</td><td>76.57%</td><td>39.02%</td><td>7.75%</td></tr><tr><td>(10 × 5)Gradient Based Search</td><td>96.46%</td><td>91.81%</td><td>78.83%</td><td>46.86%</td><td>7.84%</td></tr><tr><td>(7 × 7)Exhaustive Search</td><td>92.94%</td><td>89.54%</td><td>77.09%</td><td>42.77%</td><td>5.83%</td></tr><tr><td>(7 × 7)Gradient Based Search</td><td>95.59%</td><td>91.20%</td><td>79.52%</td><td>46.86%</td><td>6.70%</td></tr></table>
487
+
488
+ Table 23 presents results of several variants of DOA in the context of PGD attacks in the context of face recognition, while Table 24 considers these in traffic sign classification. The results are quite consistent with intuition: DOA is largely unhelpful against these attacks. The reason is that DOA fundamentally assumes that the attacker only modifies a relatively small proportion $( \sim 5 \% )$ of the scene (and the resulting image), as otherwise the physical attack would be highly suspicious. $l _ { \infty }$ bounded attacks, on the other hand, modify all pixels.
489
+
490
+ # I EFFECTIVENESS OF DOA METHODS AGAINST $l _ { 0 }$ ATTACKS
491
+
492
+ In addition to considering physical attacks, we evaluate the effectiveness of DOA against Jacobianbased saliency map attacks (JSMA) (Papernot et al., 2015) for implementing $l _ { 0 }$ -constraint adversarial examples. As Figure 13 shows, in both the face recognition and traffic sign classification, DOA is able to improve classificatio robustness compared to the original model.
493
+
494
+ ![](images/1fb85866c347ab74219f789d32b179319f34afa58e042e46fda9a686ac99f523.jpg)
495
+ Figure 13: $L _ { 0 }$ attacks on face recognition and traffic sign classification.
496
+
497
+ # J EFFECTIVENESS OF DOA AGAINST OTHER MASK-BASED ATTACKS
498
+
499
+ To further illustrate the ability of DOA to generalize, we evaluate its effectiveness in the context of three additional occlusion patterns: a union of triangles and circle, a single larger triangle, and a heart pattern.
500
+
501
+ As the results in Figures 14 and 15 suggest, DOA is able to generalize successfully to a variety of physical attack patterns. It is particularly noteworthy that the larger patterns (large triangle—middle of the figure, and large heart—right of the figure) are actually quite suspicious (particularly the heart pattern), as they occupy a significant fraction of the image (the heart mask, for example, accounts for $8 \%$ of the face).
502
+
503
+ ![](images/9635761bb3e3ede680c6080751756da8fdfde7354deebde15cf77f70cc443a28.jpg)
504
+ Figure 14: Additional mask-based attacks on face recognition.
505
+
506
+ ![](images/bba01976783beedb340e83a0e53bfa91e26b17192baa4f3d2b9d285bcb907827.jpg)
507
+ Figure 15: Additional mask-based attacks on traffic sign classification.
md/train/H1xwNhCcYm/H1xwNhCcYm.md ADDED
@@ -0,0 +1,382 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DO DEEP GENERATIVE MODELS KNOW WHAT THEY DON’T KNOW?
2
+
3
+ Eric Nalisnick∗†, Akihiro Matsukawa, Yee Whye Teh, Dilan Gorur, Balaji Lakshminarayanan∗ DeepMind
4
+
5
+ # ABSTRACT
6
+
7
+ A neural network deployed in the wild may be asked to make predictions for inputs that were drawn from a different distribution than that of the training data. A plethora of work has demonstrated that it is easy to find or synthesize inputs for which a neural network is highly confident yet wrong. Generative models are widely viewed to be robust to such mistaken confidence as modeling the density of the input features can be used to detect novel, out-of-distribution inputs. In this paper we challenge this assumption. We find that the density learned by flow-based models, VAEs, and PixelCNNs cannot distinguish images of common objects such as dogs, trucks, and horses (i.e. CIFAR-10) from those of house numbers (i.e. SVHN), assigning a higher likelihood to the latter when the model is trained on the former. Moreover, we find evidence of this phenomenon when pairing several popular image data sets: FashionMNIST vs MNIST, CelebA vs SVHN, ImageNet vs CIFAR-10 / CIFAR-100 / SVHN. To investigate this curious behavior, we focus analysis on flow-based generative models in particular since they are trained and evaluated via the exact marginal likelihood. We find such behavior persists even when we restrict the flows to constant-volume transformations. These transformations admit some theoretical analysis, and we show that the difference in likelihoods can be explained by the location and variances of the data and the model curvature. Our results caution against using the density estimates from deep generative models to identify inputs similar to the training distribution until their behavior for out-of-distribution inputs is better understood.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Deep learning has achieved impressive success in applications for which the goal is to model a conditional distribution $p ( y | \mathbf { \boldsymbol { x } } )$ , with $y$ being a label and $_ { \textbf { \em x } }$ the features. While the conditional model $p ( y | \mathbf { \boldsymbol { x } } )$ may be highly accurate on inputs $_ { \textbf { \em x } }$ sampled from the training distribution, there are no guarantees that the model will work well on $_ { \textbf { \em x } }$ ’s drawn from some other distribution. For example, Louizos & Welling (2017) show that simply rotating an MNIST digit can make a neural network predict another class with high confidence (see their Figure 1a). Ostensibly, one way to avoid such overconfidently wrong predictions would be to train a density model $p ( { \pmb x } ; { \pmb \theta } )$ (with $\pmb \theta$ denoting the parameters) to approximate the true distribution of training inputs $p ^ { * } ( { \pmb x } )$ and refuse to make a prediction for any $_ { \textbf { \em x } }$ that has a sufficiently low density under $p ( { \pmb x } ; { \pmb \theta } )$ . The intuition is that the discriminative model $p ( y | \mathbf { \boldsymbol { x } } )$ likely did not observe enough samples in that region to make a reliable decision for those inputs. This idea has been proposed by various papers, cf. (Bishop, 1994), and as recently as in the panel discussion at Advances in Approximate Bayesian Inference (AABI) 2017 (Blei et al., 2017).
12
+
13
+ Anomaly detection is just one motivating example for which we require accurate densities, and others include information regularization (Szummer & Jaakkola, 2003), open set recognition (Herbei & Wegkamp, 2006), uncertainty estimation, detecting covariate shift, active learning, model-based reinforcement learning, and transfer learning. Accordingly, these applications have lead to widespread interest in deep generative models, which take many forms such as variational auto-encoders (VAEs) (Kingma & Welling, 2014; Rezende et al., 2014), generative adversarial networks (GANs) (Goodfellow et al., 2014), auto-regressive models (van den Oord et al., 2016b;a), and invertible latent variable models (Tabak & Turner, 2013). The last two classes—auto-regressive and invertible models—are especially attractive since they offer exact computation of the marginal likelihood, requiring no approximate inference techniques.
14
+
15
+ In this paper, we investigate if modern deep generative models can be used for anomaly detection, as suggested by Bishop (1994) and the AABI pannel (Blei et al., 2017), expecting a well-calibrated model to assign higher density to the training data than to some other data set. However, we find this to not be the case: when trained on CIFAR-10 (Krizhevsky & Hinton, 2009), VAEs, autoregressive models, and flow-based generative models all assign a higher density to SVHN (Netzer et al., 2011) than to the training data. We find this observation to be quite problematic and unintuitive since SVHN’s digit images are so visually distinct from the dogs, horses, trucks, boats, etc. found in CIFAR-10. Yet this phenomenon is not restricted to CIFAR-10 vs SVHN, and we report similar findings for models trained on CelebA and ImageNet. We go on to study these curious observations in flow-based models in particular since they allow for exact marginal density calculations. When the flow is restricted to have constant volume across inputs, we show that the out-of-distribution behavior can be explained in terms of the data’s variance and the model’s curvature.
16
+
17
+ To the best of our knowledge, we are the first to report these unintuitive findings for a variety of deep generative models and image data sets. Moreover, our experiments with flow-based models isolate some crucial experimental variables such as the effect of constant-volume vs non-volume-preserving transformations. Lastly, our analysis provides some simple but general expressions for quantifying the gap in the model density between two data sets. We close the paper by urging more study of the out-of-training-distribution properties of deep generative models. Understanding their behaviour in this setting is crucial for their deployment to the real world.
18
+
19
+ # 2 BACKGROUND
20
+
21
+ We begin by establishing notation and reviewing the necessary background material. We denote matrices with upper-case and bold letters (e.g. $\boldsymbol { X }$ ), vectors with lower-case and bold (e.g. $\textbf { \em x }$ ), and scalars with lower-case and no bolding (e.g. $x )$ . As our focus is on generative models, let the collection of all observations be denoted by $\mathbf { \bar { X } } = \{ \pmb { x } _ { n } \} _ { n = 1 } ^ { N }$ with $_ { \textbf { \em x } }$ representing a vector containing all features and, if present, labels. All examples are assumed independently and identically drawn from some population $\pmb { x } \sim p ^ { * } ( \pmb { x } )$ (which is unknown) with support denoted $\mathcal { X }$ . We define the model density function to be $p ( { \pmb x } ; { \pmb \theta } )$ where $\theta \in \Theta$ are the model parameters, and let the model likelihood be denoted $\begin{array} { r } { p ( X ; \pmb { \theta } ) = \prod _ { n = 1 } ^ { N } p ( \pmb { x } _ { n } ; \pmb { \theta } ) } \end{array}$ .
22
+
23
+ # 2.1 TRAINING NEURAL GENERATIVE MODELS
24
+
25
+ Given (training) data $\boldsymbol { X }$ and a model class $\{ p ( \cdot ; \pmb \theta ) : \pmb \theta \in \Theta \}$ , we are interested in finding the parameters $\pmb \theta$ that make the model closest to the true but unknown data distribution $p ^ { * } ( { \pmb x } )$ . We can quantify this gap in terms of a Kullback–Leibler divergence (KLD):
26
+
27
+ $$
28
+ \mathrm { K L D } [ p ^ { * } ( x ) | | p ( x ; \pmb \theta ) ] = \int p ^ { * } ( \pmb x ) \log \frac { p ^ { * } ( \pmb x ) } { p ( \pmb x ; \pmb \theta ) } d \pmb x \approx - \frac { 1 } { N } \log p ( \pmb X ; \pmb \theta ) - \mathbb { H } [ p ^ { * } ]
29
+ $$
30
+
31
+ where the first term in the right-most expression is the average log-likelihood and the second is the entropy of the true distribution. As the latter is a fixed constant, minimizing the KLD amounts to finding the parameter settings that maximize the data’s log density: $\begin{array} { r } { \pmb { \theta } ^ { * } = \arg \operatorname* { m a x } _ { \pmb { \theta } } \log p ( \pmb { X } ; \pmb { \theta } ) = } \end{array}$ arg $\begin{array} { r } { \operatorname* { m a x } _ { \pmb { \theta } } \sum _ { n = 1 } ^ { N } \log p ( \pmb { x } _ { n } ; \pmb { \theta } ) } \end{array}$ . Note that $p ( { \pmb x } _ { n } ; { \pmb \theta } )$ alone does not have any interpretation as a probability. To extract probabilities from the model density, we need to integrate over some region $\begin{array} { r } { \Omega \colon \bar { P } ( \Omega ) = \int _ { \Omega } p ( \dot { \mathbf { x } } ; \pmb { \theta } ) d x } \end{array}$ . Adding noise to the data during model optimization can mock this integration step, encouraging the density model to output something nearer to probabilities (Theis et al., 2016):
32
+
33
+ $$
34
+ \log \int p ( { \pmb x } _ { n } + { \pmb \delta } ; { \pmb \theta } ) p ( { \pmb \delta } ) d { \pmb \delta } \geq \mathbb { E } _ { { \pmb \delta } } \left[ \log p ( { \pmb x } _ { n } + { \pmb \delta } ; { \pmb \theta } ) \right] \approx \log p ( { \pmb x } _ { n } + { \tilde { \pmb \delta } } ; { \pmb \theta } )
35
+ $$
36
+
37
+ where $\tilde { \delta }$ is a sample from $p ( \delta )$ . The resulting objective is a lower-bound, making it a suitable optimization target. All models in all of the experiments that we report are trained with input noise.
38
+
39
+ Due to this ambiguity between densities and probabilities, we call the quantity $\log p ( X + \tilde { \Delta } ; \pmb { \theta } )$ a ‘log-likelihood,’ even if $\boldsymbol { X }$ is drawn from a distribution unlike the training data.
40
+
41
+ Regarding the choice of density model, we could choose one of the standard density functions for $p ( { \pmb x } _ { n } ; { \pmb \theta } )$ , e.g. a Gaussian, but these may not be suitable for modeling the complex, high-dimensional data sets we often observe in the real world. Hence, we want to parametrize the model density with some high-capacity function $f$ , which is usually chosen to be a neural network. That way the model has a somewhat compact representation and can be optimized via gradient ascent. We experiment with three variants of neural generative models: autoregressive, latent variable, and invertible. In the first class, we study the PixelCNN (van den Oord et al., 2016b), and due to space constraints, we refer the reader to van den Oord et al. (2016b) for its definition. As a representative of the second class, we use a $V A E$ (Kingma & Welling, 2014; Rezende et al., 2014). See Rosca et al. (2018) for descriptions of the precise versions we use. Lastly, invertible flow-based generative models are the third class. We define them in detail below since we study them with the most depth.
42
+
43
+ # 2.2 GENERATIVE MODELS VIA CHANGE OF VARIABLES
44
+
45
+ The VAE and many other generative models are defined as a joint distribution between the observed and latent variables. However, another path forward is to perform a change of variables. In this case $_ { \textbf { \em x } }$ and $_ { z }$ are one and the same, and there is no longer any notion of a product space $\mathcal { X } \times \mathcal { Z }$ . Let $f : \mathcal X \mapsto \mathcal Z$ be a diffeomorphism from the data space $\mathcal { X }$ to a latent space $\mathcal { Z }$ . Using $f$ then allows us to compute integrals over $_ z$ as an integral over $_ { \textbf { \em x } }$ and vice versa:
46
+
47
+ $$
48
+ \int _ { z } p _ { z } ( z ) d z = \int _ { x } p _ { z } ( f ( x ) ) \left| { \frac { \partial f } { \partial x } } \right| d x = \int _ { x } p _ { x } ( x ) d x = \int _ { z } p _ { x } ( f ^ { - 1 } ( z ) ) \left| { \frac { \partial f ^ { - 1 } } { \partial z } } \right| d z
49
+ $$
50
+
51
+ where $| \partial f / \partial x |$ and $| \partial f ^ { - 1 } / \partial z |$ are known as the volume elements as they adjust for the volume change under the alternate measure. Specifically, when the change is w.r.t. coordinates, the volume element is the determinant of the diffeomorphism’s Jacobian matrix, which we denote as $| \partial f / \partial x |$ .
52
+
53
+ The change of variables formula is a powerful tool for generative modeling as it allows us to define a distribution $p ( { \pmb x } )$ entirely in terms of an auxiliary distribution $p ( z )$ , which we are free to choose, and $f$ . Denote the parameters of the change of variables model as $\pmb \theta = \{ \phi , \psi \}$ with $\phi$ being the diffeomorphism’s parameters, i.e. $f ( { \pmb x } ; \phi )$ , and $\psi$ being the auxiliary distribution’s parameters, i.e. $p ( z ; \psi )$ . We can perform maximum likelihood estimation for the model as follows:
54
+
55
+ $$
56
+ \theta ^ { * } = \underset { \theta } { \arg \operatorname* { m a x } } \log p _ { x } ( X ; \theta ) = \underset { \phi , \psi } { \arg \operatorname* { m a x } } \sum _ { n = 1 } ^ { N } \log p _ { z } ( f ( x _ { n } ; \phi ) ; \psi ) + \log \left| \frac { \partial f _ { \phi } } { \partial x _ { n } } \right| .
57
+ $$
58
+
59
+ Optimizing $\psi$ must be done carefully so as to not result in a trivial model. For instance, optimization could make $p ( z ; \psi )$ close to uniform if there are no constraints on its variance. For this reason, most implementations leave $\psi$ as fixed (usually a standard Gaussian) in practice. Likewise, we assume it as fixed from here forward, thus omitting $\psi$ from equations to reduce notational clutter. After training, samples can be drawn from the model via the inverse transform: $\tilde { \pmb { x } } = f ^ { - 1 } ( \tilde { z } ; \phi ) , \tilde { z } \sim p ( \mathbf { z } )$ .
60
+
61
+ For the particular form of $f$ , most work to date has constructed the bijection from affine coupling layers (ACLs) (Dinh et al., 2017), which transform $_ { \textbf { \em x } }$ by way of translation and scaling operations. Specifically, ACLs take the form: $f _ { \mathrm { A C L } } ( \pmb { x } ; \pmb { \phi } ) = [ \mathrm { e x p } \{ s ( \pmb { x } _ { d : } ; \phi _ { s } ) \} \odot \pmb { x } _ { : d } + t ( \pmb { x } _ { d : } ; \phi _ { t } ) , \pmb { x } _ { d : } ] .$ , where $\odot$ denotes an element-wise product. This transformation, firstly, splits the input vector in half, i.e. $\pmb { x } = [ \pmb { x } _ { : d } , \pmb { x } _ { d : } ]$ (using Python list syntax). Then the second half of the vector is fed into two arbitrary neural networks (possibly with tied parameters) whose outputs are denoted $t ( x _ { d } ; \phi _ { t } )$ and $s ( \pmb { x } _ { d : } ; \phi _ { s } )$ , with $\phi$ · being the collection of weights and biases. Finally, the output is formed by (1) scaling the first half of the input by one neural network output, i.e. $\mathrm { e x p } \{ s ( { \pmb x } _ { d : } ; \phi _ { s } ) \} \odot { \pmb x } _ { : d }$ , (2) translating the result of the scaling operation by the second neural network output, i.e. $( \cdot ) + t ( { \pmb x } _ { d : } ; \phi _ { t } )$ , and (3) copying the second half of $_ { \textbf { \em x } }$ forward, making it the second half of $f _ { \mathrm { A C L } } ( \pmb { x } ; \dot { \phi } )$ , i.e. $f _ { d : } = \pmb { x } _ { d : }$ . ACLs are stacked to make rich hierarchical transforms, and the latent representation $_ z$ is output from this composition, i.e. $z _ { n } = f ( \pmb { x } _ { n } ; \phi )$ . A permutation operation is required between ACLs to ensure the same elements are not repeatedly used in the copy operations. We use $f$ without subscript to denote the complete transform and overload the use of $\phi$ to denote the parameters of all constituent layers.
62
+
63
+ This class of transform is known as non-volume preserving (NVP) (Dinh et al., 2017) since the volume element does not necessarily evaluate to one and can vary with each input $_ { \textbf { \em x } }$ . Although non-zero, the log determinant of the Jacobian is still tractable: $\begin{array} { r } { \log | \partial f _ { \phi } / \partial \pmb { x } | = \sum _ { j = d } ^ { D } s _ { j } ( \pmb { x } _ { d } ; \pmb { \phi } _ { s } ) } \end{array}$ A diffeomorphic transform can also be defined with just translation operations, as was done in earlier work by Dinh et al. (2015), and this transformation is volume preserving (VP) since the volume term is one and thus has no influence in the likelihood calculation. We will examine another class of flows we term constant-volume (CV) since the volume, while not preserved, is constant across all $_ { \textbf { \em x } }$ . Appendix A provides additional details on implementing flow-based generative models.
64
+
65
+ # 3 MOTIVATING OBSERVATIONS
66
+
67
+ Given the impressive advances of deep generative models, we sought to test their ability to quantify when an input comes from a different distribution than that of the training set. This calibration w.r.t. out-of-distribution data is essential for applications such as safety—if we were using the generative model to filter the inputs to a discriminative model—and for active learning. For the experiment, we trained the same Glow architecture described in Kingma & Dhariwal (2018)—except small enough that it could fit on one $\mathrm { G P U ^ { 1 } }$ —on FashionMNIST and CIFAR-10. Appendix A provides additional implementation details. We then calculated the log-likelihood (higher value is better) and bits-per-dimension (BPD, lower value is better)2 of the test split of two different data sets of the same dimensionality—MNIST $( 2 8 \times 2 8 )$ and SVHN $( 3 2 \times 3 2 \times 3 )$ respectively. We expect the models to assign a lower probability to this data because they were not trained on it. Samples from the Glow models trained on each data set are shown in Figure 13 in the Appendix.
68
+
69
+ Data Set Avg. Bits Per Dimension
70
+
71
+ <table><tr><td colspan="2">Glow Trained on CIFAR-10</td></tr><tr><td>CIFAR10-Train</td><td>3.386</td></tr><tr><td>CIFAR10-Test SVHN-Test</td><td>3.464 2.389</td></tr><tr><td colspan="2">Glow Trained on SVHN</td></tr><tr><td>SVHN-Test</td><td>2.057</td></tr></table>
72
+
73
+ Data Set Avg. Bits Per Dimension
74
+ Figure 1: Testing Out-of-Distribution. Log-likelihood (expressed in bits per dimension) calculated from Glow (Kingma & Dhariwal, 2018) on MNIST, FashionMNIST, SVHN, CIFAR-10.
75
+
76
+ <table><tr><td>DataSet Avg.BitsPerDimension</td></tr><tr><td>Glow Trained on FashionMNIST</td></tr><tr><td>FashionMNIST-Train 2.902 FashionMNIST-Test 2.958</td></tr><tr><td>MNIST-Test 1.833</td></tr><tr><td>Glow Trained on MNIST</td></tr><tr><td></td></tr><tr><td>MNIST-Test 1.262</td></tr></table>
77
+
78
+ Beginning with FashionMNIST vs MNIST, the left subtable of Figure 1 shows the average BPD of the training data (FashionMNIST-Train), the in-distribution test data (FashionMNIST-Test), and the out-of-distribution data (MNIST-Test). We see a peculiar result: the MNIST split has the lowest BPD, more than one bit less than the FashionMNIST train and test sets. To check if this is due to outliers skewing the average, we report a (normalized) histogram in Figure 2 (a) of the log-likelihoods for the three splits. We see that MNIST (red bars) is clearly and systematically shifted to the RHS of the plot (highest likelihood).
79
+
80
+ Moving on to CIFAR-10 vs SVHN, the right subtable of Figure 1 again reports the BPD of the training data (CIFAR10-Train), the in-distribution test data (CIFAR10-Test), and the out-of-distribution data (SVHN-Test). We again see the phenomenon: the SVHN BPD is one bit lower than that of both in-distribution data sets. Figure 2 (b) shows a similar histogram of the log-likelihoods. Clearly the SVHN examples (red bars) have a systematically higher likelihood, and therefore the result is not caused by any outliers.
81
+
82
+ Subfigures (c) and (d) of Figure 2 show additional results for CelebA and ImageNet. When trained on CelebA, Glow assigns a higher likelihood to SVHN (red bars), a data set the model has never seen before. Similarly, when trained on ImageNet, Glow assigns a higher likelihood to the test splits of SVHN (red), CIFAR-10 (yellow), and CIFAR-100 (green). The difference is quite drastic in the case of SVHN (red) but modest for the two CIFAR splits. This phenomenon is not symmetric. CIFAR-10 does not have a higher likelihood under a Glow trained on SVHN; see Figure 6 in Appendix B for these results. We report results only for Glow, but we observed the same behavior for RNVP transforms (Dinh et al., 2017).
83
+
84
+ ![](images/0a9475f2441d377608b0ca17c4c491d7bfbbfe7d9410ec065c5f4f423f775144.jpg)
85
+ Figure 2: Histogram of Glow log-likelihoods for FashionMNIST vs MNIST (a), CIFAR-10 vs SVHN (b), CelebA vs SVHN (c), and ImageNet vs CIFAR-10 / CIFAR-100 / SVHN (d).
86
+
87
+ We next tested if the phenomenon occurs for other common deep generative models: PixelCNNs and VAEs. We do not include GANs in the comparison since evaluating their likelihood is an open problem. Figure 3 reports the same histograms as above for these models, showing the distribution of $\log p ( { \pmb x } )$ evaluations for FashionMNIST vs MNIST (a, b) and CIFAR-10 vs SVHN (c, d). The training splits are again denoted with black bars, and the test splits with blue, and the out-of-distribution splits with red. The red bars are shifted to the right in all four plots, signifying the behavior exists in spite of the differences between model classes.
88
+
89
+ # 4 DIGGING DEEPER INTO THE FLOW-BASED MODEL
90
+
91
+ While we observed the out-of-distribution phenomenon for PixelCNN, VAE, and Glow, now we narrow our investigation to just the class of invertible generative models. The rationale is that they allow for better experimental control as, firstly, they can compute exact marginal likelihoods (unlike VAEs), and secondly, the transforms used in flow-based models have Jacobian constraints that simplify the analysis we present in Section 5. To further analyze the high likelihood of the out-of-distribution (non-training) samples, we next report the contributions to the likelihood of each term in the change-of-variables formula. At first this suggested the volume element was the primary cause of SVHN’s high likelihood, but further experiments with constant-volume flows show the problem exists with them as well.
92
+
93
+ Decomposing the change-of-variables objective. To further examine this curious phenomenon, we inspect the change-of-variables objective itself, investigating if one or both terms give the outof-distribution data a higher value. We report the constituent $\log p ( z )$ and $\log | \partial f _ { \phi } / \partial x |$ terms for NVP-Glow in Figure 4, showing histograms for $\log p ( z )$ in subfigure (a) and for $\dot { \log { | \partial \dot { f } _ { \phi } / \partial x | } }$ in subfigure (b). We see that $p ( z )$ behaves mostly as expected. The red bars (SVHN) are clearly shifted to the left, representing lower likelihoods under the latent distribution. Moving on to the volume element, this term seems to cause SVHN’s higher likelihood. Subfigure (b) shows that all of the
94
+
95
+ ![](images/fc1649764335e1ea87f9326797000f78bfd2837c7e74868d0524da29d89f0651.jpg)
96
+ Figure 3: PixelCNN and VAE. Log-likelihoods calculated by PixelCNN (a, c) and VAE (b, d) on FashionMNIST vs MNIST (a, b) and CIFAR-10 vs SVHN (c, d). VAE models are the convolutional categorical variant described by Rosca et al. (2018).
97
+
98
+ ![](images/0a2b15e61de054ad748934aa2484ba56a64f549675399d1b0cdb99a606913a77.jpg)
99
+ Figure 4: Decomposing the Likelihood of NVP-Glow / CV-Glow Results. The histograms in (a) and (b) show NVP-Glow’s log-likelihood decomposed into contributions from the $_ z$ -distribution and volume element, respectively, for CIFAR-10 vs SVHN. Subfigure (c) shows log-likelihood evaluations for constant-volume (CV) Glow, again when trained on CIFAR-10 and tested on SVHN. Subfigure (d) reports NVP-Glow’s BPD over the course of training, showing that the phenomenon happens throughout and could not be prevented by early stopping.
100
+
101
+ SVHN log-volume evaluations (red) are conspicuously shifted to the right—to higher values—when compared to CIFAR-10’s (blue and black). Since SVHN’s $p ( z )$ evaluations are only slightly less than CIFAR-10’s, the volume term dominates, resulting in SVHN having a higher likelihood.
102
+
103
+ Is the volume the culprit? In addition to the empirical evidence against the volume element, we notice that one of the terms in the change-of-variables objective—by rewarding the maximization of the Jacobian determinant—encourages the model to increase its sensitivity to perturbations in $\mathcal { X }$ . This behavior starkly contradicts a long history of derivative-based regularization penalties that reward the model for decreasing its sensitivity to input directions. For instance, Girosi et al. (1995) and Rifai et al. (2011) propose penalizing the Frobenius norm of a neural network’s Jacobian for classifiers and autoencoders respectively. See Appendix C for more analysis of the log volume element.
104
+
105
+ To experimentally control for the effect of the volume term, we trained Glow with constant-volume (CV) transformations. We modify the affine layers to use only translation operations (Dinh et al., 2015) but keep the $1 \times 1$ convolutions as is. The log-determinant-Jacobian is then $\begin{array} { r } { H W \sum _ { k } \log \left| U _ { k } \right| } \end{array}$ where $| U _ { k } |$ is the determinant of the convolutional weights $U _ { k }$ for the $k$ th flow. This makes the volume element constant across all inputs $_ { \textbf { \em x } }$ , allowing us to isolate its effect while still keeping the model expressive. Subfigures (c) and (d) of Figure 4 show the results for this model, which we term CV-Glow (constant-volume Glow). Subfigure (c) shows a histogram of the $\log p ( { \pmb x } )$ evaluations, just as shown before in Figure 2, and we see that SVHN (red) still achieves a higher likelihood (lower BPD) than the CIFAR-10 training set. Subfigure (d) shows the SVHN vs CIFAR-10 BPD over the course of training for NVP-Glow. Notice that there is no cross-over point in the curves.
106
+
107
+ Other experiments: random and constant images, ensembles. Other work on generative models (Sønderby et al., 2017; van den Oord et al., 2018) has noted that they often assign the highest likelihood to constant inputs. We also test this case, reporting the BPD in Appendix Figure 8 for NVP-Glow models. We find constant inputs have the highest likelihood for our models as well: 0.589 BPD for CIFAR-10. We also include in the table the BPD of random inputs for comparison.
108
+
109
+ We also hypothesized that averaging over the parameters may mitigate the phenomenon. While integration over the entire parameter space would be ideal, this is analytically and computationally difficult for Glow. Lakshminarayanan et al. (2017) show that deep ensembles can guard against over-confidence for anomalous inputs while being more practical to implement. We opted for this approach, training five Glow models independently and averaging their likelihoods to evaluate test data. Each model was given a different initialization of the parameters to help diversify the ensemble. Figure 9 in Appendix F reports a histogram of the $\log p ( { \pmb x } )$ evaluations when averaging over the ensemble. We see nearly identical results: SVHN is still assigned a higher likelihood than the CIFAR-10 training data.
110
+
111
+ # 5 SECOND ORDER ANALYSIS
112
+
113
+ In this section, we aim to provide a more direct analysis of when another distribution might have higher likelihood than the one used for training. We propose analyzing the phenomenon by way of linearizing the difference in expected log-likelihoods. This approach undoubtedly gives a crude approximation, but as we show below, it agrees with and gives insight into some of the observations reported above. Consider two distributions: the training distribution $\ b { x } \sim p ^ { * }$ and some dissimilar distribution $x \sim q$ also with support on $\mathcal { X }$ . For a given generative model $p ( { \pmb x } ; { \pmb \theta } )$ , the adversarial distribution $q$ will have a higher likelihood than the training data’s if $\mathbb { E } _ { q } [ \log p ( { \pmb x } ; { \pmb \theta } ) ] - \mathbb { E } _ { p ^ { * } } [ \log p ( { \pmb x } ; { \pmb \theta } ) ] > 0$ . This expression is hard to analyze directly so we perform a second-order expansion of the log-likelihood around an interior point $\scriptstyle { \mathbf { { \mathit { x } } } } _ { 0 }$ . Applying the expansion $\begin{array} { r } { \log p ( { \pmb x } ; { \pmb \theta } ) \approx \log \bar { p } ( { \pmb x } _ { 0 } ; { \pmb \theta } ) + \nabla _ { { \pmb x } _ { 0 } } \log p ( { \pmb x } _ { 0 } ; { \pmb \theta } ) ^ { T } ( { \pmb x } - { \pmb x } _ { 0 } ) + } \end{array}$ $\begin{array} { r } { \frac { 1 } { 2 } \operatorname { T r } \{ \nabla _ { \pmb { x } _ { 0 } } ^ { 2 } \log p ( \pmb { x } _ { 0 } ; \mathbf { \hat { \theta } } ) ( \pmb { x } - \pmb { x } _ { 0 } ) ( \mathbf { \hat { x } } - \pmb { x } _ { 0 } ) ^ { T } \} } \end{array}$ 0 to both likelihoods, taking expectations, and canceling the common terms, we have:
114
+
115
+ $$
116
+ \begin{array} { r l } & { 0 < \mathbb { E } _ { q } [ \log p ( \pmb { x } ; \pmb { \theta } ) ] - \mathbb { E } _ { p ^ { * } } [ \log p ( \pmb { x } ; \pmb { \theta } ) ] } \\ & { \quad \approx \nabla _ { \pmb { x } _ { 0 } } \log p ( x _ { 0 } ; \pmb { \theta } ) ^ { T } ( \mathbb { E } _ { q } [ \pmb { x } ] - \mathbb { E } _ { p ^ { * } } [ \pmb { x } ] ) + \frac { 1 } { 2 } \operatorname { T r } \{ \nabla _ { \pmb { x } _ { 0 } } ^ { 2 } \log p ( \pmb { x } _ { 0 } ; \pmb { \theta } ) ( \pmb { \Sigma } _ { q } - \pmb { \Sigma } _ { p ^ { * } } ) \} } \end{array}
117
+ $$
118
+
119
+ where $\pmb { \Sigma } = \mathbb { E } \left[ ( \pmb { x } - \pmb { x } _ { 0 } ) ( \pmb { x } - \pmb { x } _ { 0 } ) ^ { T } \right]$ , the covariance matrix, and $\operatorname { T r } \{ \cdot \}$ is the trace operation. Since the expansion is accurate only locally around $\scriptstyle { \mathbf { { \mathit { x } } } } _ { 0 }$ , we next assume that $\mathbb { E } _ { q } [ { \pmb x } ] = \mathbb { E } _ { p ^ { * } } [ { \pmb x } ] = { \pmb x } _ { 0 }$ . While this at first glance may seem like a strong assumption, it is not too removed from practice since data is usually centered before being fed to the model. For SVHN and CIFAR-10 in particular, we find this assumption to hold; see Figure 5 (a) for the empirical means of each dimension of CIFAR-10 (green) and SVHN (orange). All of SVHN’s means fall within the empirical range of CIFAR-10’s, and the maximum difference between any dimension is less than 38 pixel values. Assuming equal means, we then have:
120
+
121
+ $$
122
+ \begin{array} { l } { 0 < \mathbb { E } _ { q } [ \log p ( \pmb { x } ; \pmb { \theta } ) ] - \mathbb { E } _ { p ^ { * } } [ \log p ( \pmb { x } ; \pmb { \theta } ) ] \approx \displaystyle \frac { 1 } { 2 } \operatorname { T r } \{ \nabla _ { \pmb { x } _ { 0 } } ^ { 2 } \log p ( \pmb { x } _ { 0 } ; \pmb { \theta } ) ( \pmb { \Sigma } _ { q } - \pmb { \Sigma } _ { p ^ { * } } ) \} } \\ { = \displaystyle \frac { 1 } { 2 } \operatorname { T r } \left\{ \left[ \nabla _ { \pmb { x } _ { 0 } } ^ { 2 } \log p _ { z } ( f ( \pmb { x } _ { 0 } ; \phi ) ) + \nabla _ { \pmb { x } _ { 0 } } ^ { 2 } \log \left| \frac { \partial f _ { \phi } } { \partial \pmb { x } _ { 0 } } \right| \right] ( \pmb { \Sigma } _ { q } - \pmb { \Sigma } _ { p ^ { * } } ) \right\} , } \end{array}
123
+ $$
124
+
125
+ where the second line assumes the generative model to be flow-based.
126
+
127
+ Analysis of CV-Glow. We use the expression in Equation 5 to analyze the behavior of CV-Glow on CIFAR-10 vs SVHN, seeing if the difference in likelihoods can be explained by the model curvature
128
+
129
+ and data’s second moment. The second derivative terms simplify considerably for CV-Glow with a
130
+ spherical latent density. Given a $C \times C$ kernel $U _ { k }$ , with $k$ indexing the flow and $C$ the number of
131
+ input channels, tspatial height andderivative is then $\begin{array} { r } { \partial f _ { h , w , c } / \partial x _ { h , w , c } = \prod _ { k } \sum _ { j = 1 } ^ { C } u _ { k , c , j } } \end{array}$ , with olutio $h$ and l ker $w$ indexing thel. The second $j$ $k$ $1 \times 1$ $\partial ^ { 2 } f _ { h , w , c } / \bar { \partial x } _ { h , w , c } ^ { 2 } = 0$
132
+
133
+ $$
134
+ \begin{array} { l } { { \mathrm { T r } \left\{ \left[ \nabla _ { x _ { 0 } } ^ { 2 } \log p ( x _ { 0 } ; \theta ) \right] ( \Sigma _ { q } - \Sigma _ { p ^ { * } } ) \right\} } } \\ { { \mathrm { } = \displaystyle \frac { \partial ^ { 2 } } { \partial z ^ { 2 } } \log p ( z ; \psi ) \sum _ { c = 1 } ^ { C } \left( \prod _ { k = 1 } ^ { K } \sum _ { j = 1 } ^ { C } u _ { k , c , j } \right) ^ { 2 } \sum _ { h , w } ( \sigma _ { q , h , w , c } ^ { 2 } - \sigma _ { p ^ { * } , h , w , c } ^ { 2 } ) . } } \end{array}
135
+ $$
136
+
137
+ The derivation is given in Appendix G. Plugging in the second derivative of the Gaussian’s log density—a common choice for the latent distribution in flow models (Dinh et al., 2017; Kingma & Dhariwal, 2018)—and the empirical variances, we have:
138
+
139
+ $$
140
+ \begin{array} { r l } & { \mathbb { E } _ { \mathrm { s v \pi } } [ \log p ( \boldsymbol { x } ; \boldsymbol { \theta } ) ] - \mathbb { E } _ { \mathrm { c I F A R - 1 0 } } [ \log p ( \boldsymbol { x } ; \boldsymbol { \theta } ) ] } \\ & { \qquad \approx \displaystyle \frac { - 1 } { 2 \sigma _ { \psi } ^ { 2 } } \left[ \alpha _ { 1 } ^ { 2 } ( 4 9 . 6 - 6 1 . 9 ) + \alpha _ { 2 } ^ { 2 } ( 5 2 . 7 - 5 9 . 2 ) + \alpha _ { 3 } ^ { 2 } ( 5 3 . 6 - 6 8 . 1 ) \right] } \\ & { \qquad \quad = \displaystyle \frac { 1 } { 2 \sigma _ { \psi } ^ { 2 } } \left[ \alpha _ { 1 } ^ { 2 } \cdot 1 2 . 3 + \alpha _ { 2 } ^ { 2 } \cdot 6 . 5 + \alpha _ { 3 } ^ { 2 } \cdot 1 4 . 5 \right] \ge 0 \quad \mathrm { w h e r e } \alpha _ { c } = \prod _ { k = 1 } ^ { K } \sum _ { j = 1 } ^ { C } u _ { k , c , j } } \end{array}
141
+ $$
142
+
143
+ and where $\sigma _ { \psi } ^ { 2 }$ is the variance of the latent distribution. We know the final expression is greater than or equal to zero since all $\alpha _ { c } ^ { 2 } \geq 0$ . Equality is achieved only for $\sigma _ { \psi _ { - } } ^ { 2 } \to \infty$ or in the unusual case of at least one all-zero row in any convolutional kernel for all channels. Thus, the second-order expression does indeed predict we should see a higher likelihood for SVHN than for CIFAR-10. Moreover, we leave the CV-Glow’s parameters as constants to emphasize the expression is non-negative for any parameter setting. This finding is supported by our observations that using an ensemble of Glows resulted in an almost identical likelihood gap (Figure 9) and that the gap remained relatively constant over the course of training (Figure 4d). Furthermore, the $\partial ^ { 2 } \log p ( z ; \bar { \psi } ) / \partial z ^ { 2 }$ term would be negative for any log-concave density function, meaning that changing the latent density to Laplace or logistic would not change the result.
144
+
145
+ ![](images/9404be5a5d1add49dc13ed53bdf4d51577914e8b6cda1879cef284556435b94c.jpg)
146
+ (a) Histogram of per-dimension means and variances (empirical). (b) Graying images increases likelihood.
147
+ Figure 5: Empirical Distributions and Graying Effect. Note that pixels are converted from 0-255 scale to 0-1 scale by diving by 256. See Figure 10 for results on datasets of $2 8 \times 2 8 \times 1$ images.
148
+
149
+ Our conclusion is that SVHN simply "sits inside of" CIFAR-10—roughly same mean, smaller variance—resulting in its higher likelihood. This insight also holds true for the additional results presented in subfigures (c) and (d) of Figure 2. Examining Figure 5 (a) again, we see that ImageNet, the CIFARs, and SVHN all have nearly overlapping means and that ImageNet has the highest variance. Therefore we expect SVHN and the CIFARs to have a higher likelihood than ImageNet on an ImageNet-trained model, which is exactly what we observe in Figure 2 (d). Moreover, the degree of the differences in likelihoods agrees with the differences in variances. SVHN clearly has the smallest variance and the largest likelihood. In turn, we can artificially increase the likelihood of a data set by shrinking its variance. For RGB images, shrinking the variance is equivalent to ’graying’ the images, i.e. making the pixel values closer to 128. We show in Figure 5 (b) that doing exactly this improves the likelihood of both CIFAR-10 and SVHN. Reducing the variance of the latent representations has the same effect, which is shown by Figure 12 in the Appendix.
150
+
151
+ # 6 RELATED WORK
152
+
153
+ This paper is inspired by and most related to recent work on evaluation of generative models. Worthy of foremost mention is the work of Theis et al. (2016), which showed that high likelihood is neither sufficient nor necessary for the model to produce visually satisfying samples. However, their paper does not consider out-of-distribution inputs. In this regard, there has been much work on adversarial inputs (Szegedy et al., 2014). While the term is used broadly, it commonly refers to inputs that have been imperceptibly modified so that the model can no longer provide an accurate output (a mis-classification, usually). Adversarial attacks on generative models have been studied by (at least) Tabacof et al. (2016) and Kos et al. (2018), but these methods of attack require access to the model. We, on the other hand, are interested in model calibration for any out-of-distribution set and especially for common data sets not constructed with any nefarious intentions nor for attack on a particular model. Various papers (Hendrycks & Gimpel, 2017; Lakshminarayanan et al., 2017; Liang et al., 2018) have reported that discriminative neural networks can produce overconfident predictions on out-of-distribution inputs. In a related finding, Lee et al. (2018) reported that it was much harder to recognize an input as out-of-distribution when the classifier was trained on CIFAR-10 in comparison to training on SVHN.
154
+
155
+ Testing the robustness of deep generative models to out-of-distribution inputs had not been investigated previously, to the best of our knowledge. However, there is work concurrent with ours that has tested their ability to detect anomalous inputs. Shafaei et al. (2018) and Hendrycks et al. (2019) also observe that $\mathrm { P i x e l C N N + + }$ cannot provide reliable outlier detection. Hendrycks et al. (2019) mitigate the CIFAR-10 vs SVHN issue by exposing the model to outliers during training. They do not consider flow-based models. Škvára et al. (2018) experimentally compare VAEs and GANs against $\mathbf { k }$ -nearest neighbors (kNNs), showing that VAEs and GANs outperform kNNs only when known outliers can be used for hyperparameter selection. In the work most similar to ours, Choi & Jang (2018) report the same CIFAR-10 vs SVHN phenomenon for Glow—independently confirming our motivating observation. As a fix, they propose training an ensemble of generative models with an adversarial objective and testing for out-of-training-distribution inputs by computing the WatanabeAkaike information criterion via the ensemble. This work is complementary to ours since they focus on providing a detection method whereas we are interested in understanding how and when the phenomenon can arise. The results we present in Equation 6 do not apply to Choi & Jang (2018)’s models since they use scaling operations in their affine coupling layers, making them NVP.
156
+
157
+ # 7 DISCUSSION
158
+
159
+ We have shown that comparing the likelihoods of deep generative models alone cannot identify the training set or inputs like it. Therefore we urge caution when using these models with outof-training-distribution inputs or in unprotected user-facing systems. Moreover, our analysis in Section 5 shows that the CIFAR-10 vs SVHN phenomenon would persist for any constant-volume Glow no matter the parameter values nor the choice of latent density (as long as it is log-concave). While we cannot conclude that this is a pathology in deep generative models, it does suggest the need for further work on generative models and their evaluation. The models we tested seem to be capturing low-level statistics rather than high-level semantics, and better inductive biases, optimization procedures, or uncertainty quantification may be necessary. Yet, deep generative models can detect out-of-distribution inputs when using alternative metrics (Choi & Jang, 2018) and modified training procedures (Hendrycks et al., 2019). The problem then may be a fundamental limitation of high-dimensional likelihoods. Until these open problems are better understood, we must temper the enthusiasm with which we preach the benefits of deep generative models.
160
+
161
+ # ACKNOWLEDGMENTS
162
+
163
+ We thank Aaron van den Oord, Danilo Rezende, Eric Jang, Florian Stimberg, Josh Dillon, Mihaela Rosca, Rui Shu, Sander Dieleman, and the anonymous reviewers for their helpful feedback and discussions.
164
+
165
+ # REFERENCES
166
+
167
+ Christopher M Bishop. Novelty Detection and Neural Network Validation. IEE Proceedings-Vision, Image and Signal processing, 141(4):217–222, 1994.
168
+
169
+ Christopher M Bishop. Training with Noise is Equivalent to Tikhonov Regularization. Neural Computation, 7(1):108–116, 1995.
170
+
171
+ David Blei, Katherine Heller, Tim Salimans, Max Welling, and Zoubin Ghahramani. Panel Discussion. Advances in Approximate Bayesian Inference, December 2017. URL https://youtu.be/ x1UByHT60mQ?t $= 4$ 6m2s. NeurIPS Workshop.
172
+
173
+ Hyunsun Choi and Eric Jang. Generative Ensembles for Robust Anomaly Detection. ArXiv e-Print arXiv:1810.01392, 2018.
174
+
175
+ Laurent Dinh, David Krueger, and Yoshua Bengio. NICE: Non-Linear Independent Components Estimation. ICLR Workshop Track, 2015.
176
+
177
+ Laurent Dinh, Jascha Sohl-Dickstein, and Samy Bengio. Density Estimation Using Real NVP. In International Conference on Learning Representations (ICLR), 2017.
178
+
179
+ Federico Girosi, Michael Jones, and Tomaso Poggio. Regularization Theory and Neural Networks Architectures. Neural Computation, 7(2):219–269, 1995.
180
+
181
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aäron Courville, and Yoshua Bengio. Generative Adversarial Nets. In Advances in Neural Information Processing Systems (NeurIPS), 2014.
182
+
183
+ Dan Hendrycks and Kevin Gimpel. A Baseline for Detecting Misclassified and Out-of-Distribution Examples in Neural Networks. In International Conference on Learning Representations (ICLR), 2017.
184
+
185
+ Dan Hendrycks, Mantas Mazeika, and Thomas Dietterich. Deep Anomaly Detection with Outlier Exposure. In International Conference on Learning Representations (ICLR), 2019.
186
+
187
+ Radu Herbei and Marten H Wegkamp. Classification with Reject Option. Canadian Journal of Statistics, 34(4):709–721, 2006.
188
+
189
+ Diederik P. Kingma and Prafulla Dhariwal. Glow: Generative Flow with Invertible 1x1 Convolutions. In Advances in Neural Information Processing Systems (NeurIPS), 2018.
190
+
191
+ Diederik P Kingma and Max Welling. Auto-Encoding Variational Bayes. International Conference on Learning Representations (ICLR), 2014.
192
+
193
+ Jernej Kos, Ian Fischer, and Dawn Song. Adversarial Examples for Generative Models. In 2018 IEEE Security and Privacy Workshops (SPW), pp. 36–42. IEEE, 2018.
194
+
195
+ Alex Krizhevsky and Geoffrey Hinton. Learning Multiple Layers of Features from Tiny Images. Technical report, University of Toronto, 2009.
196
+
197
+ Balaji Lakshminarayanan, Alexander Pritzel, and Charles Blundell. Simple and Scalable Predictive Uncertainty Estimation Using Deep Ensembles. In Advances in Neural Information Processing Systems (NeurIPS), 2017.
198
+
199
+ Kimin Lee, Honglak Lee, Kibok Lee, and Jinwoo Shin. Training Confidence-Calibrated Classifiers for Detecting Out-of-Distribution Samples. In International Conference on Learning Representations (ICLR), 2018.
200
+
201
+ Shiyu Liang, Yixuan Li, and R Srikant. Enhancing the Reliability of Out-of-Distribution Image Detection in Neural Networks. International Conference on Learning Representations (ICLR), 2018.
202
+
203
+ Christos Louizos and Max Welling. Multiplicative Normalizing Flows for Variational Bayesian Neural Networks. In Proceedings of the 34th International Conference on Machine Learning (ICML), 2017.
204
+
205
+ Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Y Ng. Reading Digits in Natural Images with Unsupervised Feature Learning. In NeurIPS Workshop on Deep Learning and Unsupervised Feature Learning, 2011.
206
+
207
+ Danilo Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic Backpropagation and Approximate Inference in Deep Generative Models. In Proceedings of the 31st International Conference on Machine Learning (ICML), pp. 1278–1286, 2014.
208
+
209
+ Salah Rifai, Pascal Vincent, Xavier Muller, Xavier Glorot, and Yoshua Bengio. Contractive AutoEncoders: Explicit Invariance During Feature Extraction. In Proceedings of the 28th International Conference on Machine Learning (ICML), 2011.
210
+
211
+ Mihaela Rosca, Balaji Lakshminarayanan, and Shakir Mohamed. Distribution matching in variational inference. ArXiv e-Print arXiv:1802.06847, 2018.
212
+
213
+ Alireza Shafaei, Mark Schmidt, and James J Little. Does Your Model Know the Digit 6 Is Not a Cat? A Less Biased Evaluation of “Outlier" Detectors. ArXiv e-Print arXiv:1809.04729, 2018.
214
+
215
+ Vít Škvára, Tomáš Pevny, and Václav Šmídl. Are Generative Deep Models for Novelty Detection \` Truly Better? KDD Workshop on Outlier Detection De-Constructed (ODD v5.0), 2018.
216
+
217
+ Casper Kaae Sønderby, Jose Caballero, Lucas Theis, Wenzhe Shi, and Ferenc Huszár. Amortised MAP Inference for Image Super-Resolution. International Conference on Learning Representations (ICLR), 2017.
218
+
219
+ Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing Properties of Neural Networks. International Conference on Learning Representations (ICLR), 2014.
220
+
221
+ Martin Szummer and Tommi S Jaakkola. Information Regularization with Partially Labeled Data. In Advances in Neural Information Processing Systems (NeurIPS), 2003.
222
+
223
+ Pedro Tabacof, Julia Tavares, and Eduardo Valle. Adversarial Images for Variational Autoencoders. ArXiv e-Print, 2016.
224
+
225
+ EG Tabak and Cristina V Turner. A Family of Nonparametric Density Estimation Algorithms. Communications on Pure and Applied Mathematics, 66(2):145–164, 2013.
226
+
227
+ Lucas Theis, Aäron van den Oord, and Matthias Bethge. A Note on the Evaluation of Generative Models. In International Conference on Learning Representations (ICLR), 2016.
228
+
229
+ Aäron 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 e-Print, 2016a.
230
+
231
+ Aäron van den Oord, Nal Kalchbrenner, Lasse Espeholt, Oriol Vinyals, Alex Graves, et al. Conditional image generation with pixel CNN decoders. In Advances in Neural Information Processing Systems (NeurIPS), 2016b.
232
+
233
+ 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 (ICML), pp. 3918–3926, 2018.
234
+
235
+ # A ADDITIONAL IMPLEMENTATION DETAILS
236
+
237
+ # A.1 FLOW-BASED MODELS
238
+
239
+ We have described the core building blocks of invertible generative models above, but there are several other architectural choices required in practice. Due to space requirements, we only describe them briefly, referring the reader to the original papers for details. In the most recent extension of this line of work, Kingma & Dhariwal (2018) propose the Glow architecture, with its foremost contribution being the use of $1 \times 1$ convolutions in place of discrete permutation operations. Convolutions of this form can be thought of as a relaxed but generalized permutation, having all the representational power of the discrete version with the added benefit of parameters amenable to gradient-based training. As the transformation function becomes deeper, it becomes prone to the same scale pathologies as deep neural networks and therefore requires a normalization step of some form. Dinh et al. (2017) propose incorporating batch normalization and describe how to compute its contribution to the log-determinant-Jacobian term. Kingma & Dhariwal (2018) apply a similar normalization, which they call actnorm, but it uses trainable parameters instead of batch statistics. Lastly, both Dinh et al. (2017) and Kingma & Dhariwal (2018) use multi-scale architectures that factor out variables at regular intervals, copying them forward to the final latent representation. This gradually reduces the dimensionality of the transformations, improving upon computational costs.
240
+
241
+ For our MNIST experiments, we used a Glow architecture of 2 blocks of 16 affine coupling layers, squeezing the spatial dimension in between the 2 blocks. For our CIFAR experiments, we used 3 blocks of 8 affine coupling blocks, applying the multi-scale architecture between each block. For all coupling blocks, we used a 3-layer Highway network with 200 hidden units for MNIST and 400 hidden units for CIFAR. The networks we trained were shallower than those in Kingma & Dhariwal (2018). We also found that initializing the last layer of the coupling networks to 0 was sufficient to prevent scale pathologies, hence we did not use any form of normalization (batchnorm nor actnorm) for ease of initialization and training in a distributed setting. Convolution kernels were initialized with a truncated normal with variance $1 / \sqrt { D }$ where $D$ is fan-in size, except where zero-initialization is prescribed by Glow. All networks were trained with the RMSProp optimizer, with a learning rate of $1 e - 5$ for 100K steps, decaying by half at 80K and 90K steps. We used a prior with zero mean and unit variance for all experiments. We applied L2 regularization of $5 e - 2$ to CIFAR experiments. All experiments used batch size 32.
242
+
243
+ For CV-Glow, we used additive rather than affine coupling blocks, which removes the influence of coupling blocks on the log-det-Jacobian term. The volume change of the $1 \times 1$ convolutions depend on its weights rather than the input, so the network has a constant volume change.
244
+
245
+ # A.2 PIXELCNN
246
+
247
+ We trained a GatedPixelCNN with a categorical distribution. For FashionMNIST, we used a network with 5 gated layers with 32 features, and the final skip connection layer with size 256. We trained for 100K steps with the Adam optimizer and an initial learning rate of $1 e - 4$ , and decaying at 80K and 90K steps. For CIFAR experiments, we used 15 dated layers with 128 features, and a skip connection size of 1024. Convolutions were initialized with Tensorflow’s variance scaling initializer with a uniform distribution and a scale of 1. We trained for 200K steps with the RMSProp optimizer with an initial learning rate of $1 e - 4$ , decaying by $1 / 3$ at 120K, 180K, and 195K steps. All experiments used batch size 32.
248
+
249
+ # A.3 VARIATIONAL AUTO-ENCODERS
250
+
251
+ We refer to (Rosca et al., 2018, Appendix K) for additional details on the VAEs used in our CIFAR experiments. We used the CIFAR configurations without modification. For FashionMNIST, we used the encoder given in Table 4 of (Rosca et al., 2018, Appendix K, Table 4) and a decoder composed of one linear layer with $7 * 7 * 6 4$ hidden units, followed by a reshape and three transposed convolutions of feature sizes 32, 32, 256 and strides 2, 2, 1. Weights were initialized with a normal distribution with variance 0.02. We trained for 200K steps using the RMSProp optimizer, with a constant learning rate of $1 e - 4$ .
252
+
253
+ ![](images/af5f921c69a777a494c952835d08bb95ffb4fad2c91d1e8de3fb97219106aefe.jpg)
254
+ Figure 6: Histogram of Glow log-likelihoods for MNIST vs FashionMNIST and SVHN vs CIFAR-10. Note that the model trained on SVHN (MNIST) is able to assign lower likelihood to CIFAR-10 (FashionMNIST), which illustrates the asymmetry compared to Figure 2.
255
+
256
+ # C ANALYZING THE CHANGE-OF-VARIABLES FORMULA AS ANOPTIMIZATION FUNCTION
257
+
258
+ Consider the intuition underlying the volume term in the change of variables objective (Equation 3). As we are maximizing the Jacobian’s determinant, it means that the model is being encouraged to maximize the $\partial f _ { j } / \partial { \bar { x } } _ { j }$ partial derivatives. In other words, the model is rewarded for making the transformation sensitive to small changes in $_ { \textbf { \em x } }$ . This behavior starkly contradicts a long history of derivative-based regularization penalties. Dating back at least to (Girosi et al., 1995), penalizing the Frobenius norm of a neural network’s Jacobian—which upper bounds the volume term3—has been shown to improve generalization. This agrees with intuition since we would like the model to be insensitive to small changes in the input, which are likely noise. Moreover, Bishop (1995) showed that training a network under additive Gaussian noise is equivalent to Jacobian regularization, and Rifai et al. (2011) proposed contractive autoencoders, which penalize the Jacobian-norm of the encoder. Allowing invertible generative models to maximize the Jacobian term without constraint suggests, at minimum, that these models will not learn robust representations.
259
+
260
+ Limiting Behavior. We next attempt to quantify the limiting behavior of the log volume element. Let us assume, for the purposes of a general treatment, that the bijection $f _ { \phi }$ is an $L$ -Lipschitz function. Both terms in Equation 3 can be bounded as follows:
261
+
262
+ $$
263
+ \log p ( { \pmb x } ; \pmb \theta ) = \underbrace { \log p _ { z } ( f ( { \pmb x } ; \phi ) ) } _ { \mathcal { O } ( \operatorname* { m a x } _ { z } \log p _ { z } ( z ) } + \underbrace { \log \left| \frac { \partial f _ { \phi } } { \partial { \pmb x } } \right| } _ { \mathcal { O } ( D \log L ) } \le \operatorname* { m a x } _ { z } \log p _ { z } ( z ) + D \log L
264
+ $$
265
+
266
+ where $L$ is the Lipschitz constant, $D$ the dimensionality, and $\mathcal { O } ( \operatorname* { m a x } _ { z } \log p _ { z } ( z ) )$ an expression for the (log) mode of $p ( z )$ . We will make this mode term for concrete for Gaussian distributions below. The bound on the volume term follows from Hadamard’s inequality:
267
+
268
+ $$
269
+ \log \left| \frac { \partial f _ { \phi } } { \partial x } \right| \leq \log \prod _ { j = 1 } ^ { D } \left| \frac { \partial f _ { \phi } } { \partial x } e _ { j } \right| \leq \log ( L \left| e _ { \cdot } \right| ) ^ { D } = D \log L
270
+ $$
271
+
272
+ where $e _ { j }$ is an eigenvector. While this expression is too general to admit any strong conclusions, we can see from it that the ‘peakedness’ of the distribution represented by the mode must keep pace with the Lipschitz constant, especially as dimensionality increases, in order for both terms to contribute equally to the objective.
273
+
274
+ We can further illuminate the connection between $L$ and the concentration of the latent distribution through the following proposition:
275
+
276
+ Proposition 1. Assume $x \sim p ^ { * }$ is distributed with moments $\mathbb { E } [ x ] = \mu _ { x }$ and $V a r [ x ] = \sigma _ { x } ^ { 2 }$ . Moreover, let $f : \mathcal X \mapsto \mathcal Z$ be $L$ -Lipschitz and $f ( \mu _ { x } ) = \mu _ { z }$ . We then have the following concentration inequality for some constant $\delta$ :
277
+
278
+ $$
279
+ P \left( | f ( x ) - \mu _ { z } | \geq \delta \right) \leq \frac { L ^ { 2 } \sigma _ { x } ^ { 2 } } { \delta ^ { 2 } } .
280
+ $$
281
+
282
+ Proof : From the fact that $f$ is $L$ -Lipschitz, we know $| f ( x ) - \mu _ { z } | \leq L \left| x - f ^ { - 1 } ( \mu _ { z } ) \right|$ . Assuming $\mu _ { x } = f ^ { - 1 } ( \mu _ { z } ) )$ , we can apply Chebyshev’s inequality to the RHS: $\begin{array} { r } { P r ( L \left| x - f ^ { - 1 } ( \dot { \mu } _ { z } ) \right| \ge \delta ) \le } \end{array}$ $L ^ { 2 } \sigma _ { x } ^ { 2 } / \delta ^ { 2 }$ . Since $L \left| x - f ^ { - 1 } ( \mu _ { z } ) \right| \geq | f ( x ) - \mu _ { z } |$ , we can plug the RHS into the inequality and the bound will continue to hold.
283
+
284
+ From the inequality we can see that the latent distribution can be made more concentrated by decreasing $L$ and/or the data’s variance $\sigma _ { x } ^ { 2 }$ . Since the latter is fixed, optimization only influences $L$ Yet, recall that the volume term in the change-of-variables objective rewards increasing $f$ ’s derivatives and thus $L$ . While we have given an upper bound and therefore cannot say that increasing $L$ will necessarily decrease concentration in latent space, it is for certain that leaving $L$ unconstrained does not directly pressure the $f ( { \pmb x } )$ evaluations to concentrate.
285
+
286
+ Previous work (Dinh et al., 2015; 2017; Kingma & Dhariwal, 2018) has almost exclusively used a factorized zero-mean Gaussian as the latent distribution, and therefore we examine this case in particular. The log-mode can be expressed as $- D / 2 \cdot \log 2 \pi \sigma _ { z } ^ { 2 }$ , making the likelihood bound
287
+
288
+ $$
289
+ \log \mathrm { N } ( f ( x ; \phi ) ; \mathbf { 0 } , \sigma _ { z } ^ { 2 } \mathbb { I } ) + \log \left| \frac { \partial f _ { \phi } } { \partial x } \right| \leq \frac { - D } { 2 } \log 2 \pi \sigma _ { z } ^ { 2 } + D \log L .
290
+ $$
291
+
292
+ We see that both terms scale with $D$ although in different directions, with the contribution of the $z$ -distribution becoming more negative and the volume term’s becoming more positive. We performed a simulation to demonstrate this behavior on the two moons data set, which is shown in Figure 7 (a). We replicated the original two dimensions to create data sets of dimensionality of up to 100. The results are shown in Figure 7 (b). The empirical values of the two terms are shown by the solid lines, and indeed, we see they exhibit the expected diverging behavior as dimensionality increases.
293
+
294
+ ![](images/d7b554b4592ddf24118bee1661fc3c2091763ae2808b35b528b8ce9251982b92.jpg)
295
+ Figure 7: Limiting Bounds. We trained an RNVP transformation on two moons data sets—which is shown in (a) for 2 dimensions—of increasing dimensionality, tracking the empirical value of each term against the upper bounds. Subfigure (b) shows Glow with an exp parametrization for the scales and (c) shows Glow with a sigmoid parametrization.
296
+
297
+ # D GLOW WITH SIGMOID PARAMETRIZATION
298
+
299
+ Upon reading the open source implementation of Glow,4 we found that Kingma & Dhariwal (2018) in practice parametrize the scaling factor as sigmoid $\left( s ( \pmb { x } _ { d : } ; \phi _ { s } ) \right)$ instead of $\exp \{ s ( \pmb { x } _ { d } ; \pmb { \phi } _ { s } ) \}$ . This
300
+
301
+ choice allows the volume only to decrease and thus results in the volume term being bounded as (ignoring the convolutional transforms)
302
+
303
+ $$
304
+ \log \left| \frac { \partial f _ { \phi } } { \partial \pmb { x } } \right| = \sum _ { f = 1 } ^ { F } \sum _ { j = 1 } ^ { d _ { f } } \log \textnormal { s i g m o i d } ( s _ { f , j } ( \pmb { x } _ { d _ { f } ; } \phi _ { s } ) ) \leq F D \log 1 = 0
305
+ $$
306
+
307
+ where $f$ indexes the flows and $d _ { f }$ the dimensionality at flow $f$ . Interestingly, this parametrization has a fixed upper bound of zero, removing the dependence on $D$ found in Equation 8. We demonstrate the change in behavior introduced by the alternate parametrization via the same two moon simulation. The only difference is that the RNVP transforms use a sigmoid parametrizations for the scaling operation. See Figure 7 (c) for the results: we see that now both change-of-variable terms are oriented downward as dimensionality grows. We conjecture this parametrization helps condition the log-likelihood, limiting the volume term’s influence, when training the large models $( \sim 9 0$ flows) used by Kingma & Dhariwal (2018). However, it does not fix the out-of-distribution over-confidence we report in Section 3.
308
+
309
+ # E CONSTANT AND RANDOM INPUTS
310
+
311
+ <table><tr><td>Data Set</td><td>Avg.Bits Per Dimension</td></tr><tr><td>Glow Trained on FashionMNIST</td><td></td></tr><tr><td>Random</td><td>8.686</td></tr><tr><td>Constant (0)</td><td>0.339</td></tr></table>
312
+
313
+ Figure 8: Random and constant images. Log-likelihood (expressed in bits per dimension) of random and constant inputs calculated from NVP-Glow for models trained on FashionMNIST (left) and CIFAR-10 (right).
314
+
315
+ <table><tr><td>Data Set Avg.</td><td>Bits Per Dimension</td></tr><tr><td>Glow Trained on CIFAR-10</td><td></td></tr><tr><td>Random</td><td>15.773</td></tr><tr><td>Constant (128)</td><td>0.589</td></tr></table>
316
+
317
+ # F ENSEMBLING GLOWS
318
+
319
+ The likelihood function technically measures how likely the parameters are under the data (and not how likely the data is under the model), and perhaps a better quantity would be the posterior predictive distribution $\begin{array} { r } { p ( { \pmb x } _ { t e s t } | { \pmb x } _ { t r a i n } ) = \frac { 1 } { M } \sum _ { m } \hat { p ( { \pmb x } _ { t e s t } | { \pmb \theta } _ { m } ) } } \end{array}$ where we draw samples from posterior distribution $\pmb { \theta } _ { m } \sim p ( \pmb { \theta } | \pmb { x } _ { t r a i n } )$ . Intutitively, it seems that such an integration would be more robust than a single maximum likelihood point estimate. As a crude approximation to Bayesian inference, we tried averaging over ensembles of generative models since Lakshminarayanan et al. (2017) showed that ensembles of discriminative models are robust to out-of-distribution inputs. We compute an “ensemble predictive distribution” as $\begin{array} { r } { p ( { \pmb x } ) = \frac { 1 } { M } \sum _ { m } p ( { \pmb x } ; { \pmb \theta } _ { m } ) } \end{array}$ , where $m$ indexes over models. However, as Figure 9 shows, ensembles did not significantly change the relative difference between in-distribution (CIFAR-10, black and blue) and out-of-distribution (SVHN, red).
320
+
321
+ # G DERIVATION OF CV-GLOW’S LIKELIHOOD DIFFERENCE
322
+
323
+ We start with Equation 5:
324
+
325
+ $$
326
+ \frac { 1 } { 2 } \operatorname { T r } \left\{ \left[ \nabla _ { x _ { 0 } } ^ { 2 } \log { p _ { z } ( f ( x _ { 0 } ; \phi ) ) } + \nabla _ { x _ { 0 } } ^ { 2 } \log { \left| \frac { \partial f _ { \phi } } { \partial x _ { 0 } } \right| } \right] ( \pmb { \Sigma } _ { q } - \pmb { \Sigma } _ { p ^ { * } } ) \right\} .
327
+ $$
328
+
329
+ The volume element for CV-Glow does not depend on $\scriptstyle { \mathbf { { \mathit { x } } } } _ { 0 }$ and therefore drops from the equation:
330
+
331
+ $$
332
+ \nabla _ { \pmb { x } _ { 0 } } ^ { 2 } \log \left| \frac { \partial { f _ { \phi } } } { \partial \pmb { x } _ { 0 } } \right| = \nabla _ { \pmb { x } _ { 0 } } ^ { 2 } H W \sum _ { k } \log \left| U _ { k } \right| = 0
333
+ $$
334
+
335
+ ![](images/f4b1b6ca847a7158dc914ed94b2dfdc2cb29f4e5ba3fe67b46306198e07497bb.jpg)
336
+ Figure 9: Ensemble of Glows. The plot above shows a histogram of log-likelihoods computed using an ensemble of Glow models trained on CIFAR-10, tested on SVHN. Ensembles were not found to be robust against this phenomenon.
337
+
338
+ where $U _ { k }$ denotes the $k$ th $1 \times 1$ -convolution’s kernel. Moving on to the first term, the log probability under the latent distribution, we have:
339
+
340
+ $$
341
+ \begin{array} { l } { \nabla _ { x _ { 0 } } ^ { 2 } \log p ( f ( x _ { 0 } ) ; \psi ) = \nabla _ { x _ { 0 } } ^ { 2 } \left\{ \displaystyle \frac { - 1 } { 2 \sigma _ { \psi } ^ { 2 } } | | f ( x _ { 0 } ) | | _ { 2 } ^ { 2 } - \frac { D } { 2 } \log 2 \pi \sigma _ { \psi } ^ { 2 } \right\} } \\ { = \nabla _ { x _ { 0 } } \left\{ \displaystyle \frac { - 1 } { \sigma _ { \psi } ^ { 2 } } \left( \sum _ { d } f _ { d } ( x _ { 0 } ) \right) \nabla _ { x _ { 0 } } f ( x _ { 0 } ) \right\} } \\ { = \displaystyle \frac { - 1 } { \sigma _ { \psi } ^ { 2 } } \left[ \nabla _ { x _ { 0 } } f ( x _ { 0 } ) ( \nabla _ { x _ { 0 } } f ( x _ { 0 } ) ) ^ { T } + \left( \sum _ { d } f _ { d } ( x _ { 0 } ) \right) \nabla _ { x _ { 0 } } ^ { 2 } f ( x _ { 0 } ) \right] . } \end{array}
342
+ $$
343
+
344
+ Since $f$ is comprised of translation operations and $1 \times 1$ convolutions, its partial derivatives involve just the latter (as the former are all ones), and therefore we have the partial derivatives:
345
+
346
+ $$
347
+ \frac { \partial f _ { h , w , c } ( \pmb { x } _ { 0 } ) } { \partial x _ { h , w , c } } = \prod _ { k = 1 } ^ { K } \sum _ { j = 1 } ^ { C _ { k } } u _ { k , c , j } , \quad \frac { \partial ^ { 2 } f _ { h , w , c } ( \pmb { x } _ { 0 } ) } { \partial x _ { h , w , c } ^ { 2 } } = 0
348
+ $$
349
+
350
+ where $h$ and $w$ index the input spatial dimensions, $c$ the input channel dimensions, $k$ the series of flows, and $j$ the column dimensions of the $C _ { k } \times C _ { k }$ -sized convolutional kernel $U _ { k }$ . The diagonal elements of $\nabla _ { { \pmb x } _ { 0 } } f ( { \pmb x } _ { 0 } ) ( \nabla _ { { \pmb x } _ { 0 } } f ( { \pmb x } _ { 0 } ) ) ^ { T }$ are then $( \textstyle \prod _ { k = 1 } ^ { K } \sum _ { j = 1 } ^ { C _ { k } } u _ { k , c , j } ) ^ { 2 }$ , and the diagonal element of $\nabla _ { \pmb { x } _ { 0 } } ^ { 2 } f ( \pmb { x } _ { 0 } )$ are all zero.
351
+
352
+ Then returning to the full equation, for the constant-volume Glow model we have:
353
+
354
+ $$
355
+ \begin{array} { r l } & { \frac { 1 } { 2 } \operatorname { T r } \left\{ \left[ \nabla _ { x _ { 0 } } ^ { 2 } \log p ( f ( x _ { 0 } ) ) + \nabla _ { x _ { 0 } } ^ { 2 } \log \left| \frac { \partial f } { \partial x _ { 0 } } \right| \right] ( \Sigma _ { q } - \Sigma _ { p ^ { * } } ) \right\} } \\ & { \quad = \frac { 1 } { 2 } \operatorname { T r } \left\{ \left[ \nabla _ { x _ { 0 } } ^ { 2 } \log p ( f ( x _ { 0 } ) ) \right] ( \Sigma _ { q } - \Sigma _ { p ^ { * } } ) \right\} } \\ & { \quad = \frac { - 1 } { 2 \sigma _ { \psi } ^ { 2 } } \operatorname { T r } \left\{ \left[ \nabla _ { x _ { 0 } } f ( x _ { 0 } ) ( \nabla _ { x _ { 0 } } f ( x _ { 0 } ) ) ^ { T } + \left( \sum _ { d } f _ { d } ( x _ { 0 } ) \right) \nabla _ { x _ { 0 } } ^ { 2 } f ( x _ { 0 } ) \right] ( \Sigma _ { q } - \Sigma _ { p ^ { * } } ) \right\} } \\ & { \quad = \frac { - 1 } { 2 \sigma _ { \psi } ^ { 2 } } \sum _ { l , m } \left\{ \left[ \nabla _ { x _ { 0 } } f ( x _ { 0 } ) ( \nabla _ { x _ { 0 } } f ( x _ { 0 } ) ) ^ { T } + \left( \sum _ { d } f _ { d } ( x _ { 0 } ) \right) \nabla _ { x _ { 0 } } ^ { 2 } f ( x _ { 0 } ) \right] \odot ( \Sigma _ { q } - \Sigma _ { p ^ { * } } ) \right\} _ { l , m } . } \end{array}
356
+ $$
357
+
358
+ Lastly, we assume that both $\Sigma _ { q }$ and $\Sigma _ { p ^ { * } }$ are diagonal and thus the element-wise multiplication with $\nabla _ { \pmb { x } _ { 0 } } ^ { 2 } \log p ( f ( \pmb { x } _ { 0 } ) )$ collects only its diagonal elements:
359
+
360
+ $$
361
+ \begin{array} { l } { \displaystyle \frac { - 1 } { 2 \sigma _ { \psi } ^ { 2 } } \displaystyle \sum _ { l , m } \left\{ \left[ \nabla _ { x _ { 0 } } f ( { \bf x } _ { 0 } ) \big ( \nabla _ { x _ { 0 } } f ( { \bf x } _ { 0 } ) \big ) ^ { T } + \left( \sum _ { d } f _ { d } ( { \bf x } _ { 0 } ) \right) \nabla _ { x _ { 0 } } ^ { 2 } f ( { \bf x } _ { 0 } ) \right] \odot \big ( \Sigma _ { q } - \Sigma _ { p ^ { * } } \big ) \right\} _ { l , m } } \\ { \displaystyle = \frac { - 1 } { 2 \sigma _ { \psi } ^ { 2 } } \displaystyle \sum _ { h } \sum _ { w } \sum _ { c } \left( \prod _ { k = 1 } ^ { H } \sum _ { j = 1 } ^ { C _ { k } } u _ { k , c , j } \right) ^ { 2 } \big ( \sigma _ { q , h , w , c } ^ { 2 } - \sigma _ { p ^ { * } , h , w , c } ^ { 2 } \big ) } \\ { \displaystyle = \frac { - 1 } { 2 \sigma _ { \psi } ^ { 2 } } \displaystyle \sum _ { c } ^ { C } \left( \prod _ { k = 1 } ^ { H } \sum _ { j = 1 } ^ { C _ { k } } u _ { k , c , j } \right) ^ { 2 } \sum _ { h } ^ { H } \sum _ { w } ^ { W } \big ( \sigma _ { q , h , w , c } ^ { 2 } - \sigma _ { p ^ { * } , h , w , c } ^ { 2 } \big ) } \end{array}
362
+ $$
363
+
364
+ where we arrived at the last line by rearranging the sum to collect the shared channel terms.
365
+
366
+ # H HISTOGRAM OF DATA STATISTICS
367
+
368
+ ![](images/7aa7221a8c3a23f4d65574966482690587b49f9c2688792fcc797d27c0082793.jpg)
369
+ Figure 10: Data statistics: Histogram of per-dimensional mean, computed as $\begin{array} { r } { \mu _ { d } = \frac { 1 } { N } \sum _ { n = 1 } ^ { N } x _ { n d } } \end{array}$ and per-dimensional variance, computed as 1N−1 PNn=1(xnd − µd)2. Note that pixels are converted from 0-255 scale to 0-1 scale by diving by 256. See Figure 5a for results on datasets of $3 2 \times 3 2 \times 3$ images: SVHN, CIFAR-10, CIFAR-100, CelebA and ImageNet.
370
+
371
+ ![](images/b8b72283e56202c4ac3bf358fd419c58470a0d95ddaa7328e89b69a5210d02f6.jpg)
372
+ Figure 11: Analysis of codes obtained using CV-Glow model. Histogram of means (left column) $\begin{array} { r } { \mu _ { d } = \frac { 1 } { N } \sum _ { n = 1 } ^ { N } z _ { n d } } \end{array}$ , standard deviation (middle column) $\begin{array} { r } { \sigma _ { d } = \sqrt { \frac { 1 } { N - 1 } \sum _ { n = 1 } ^ { N } ( z _ { n d } - \mu _ { d } ) ^ { 2 } } } \end{array}$ 1 PNn=1(znd − µd)2 and norms normalized by $\sqrt { D }$ (right column) computed as $\begin{array} { r } { \frac { | z _ { n } | } { \sqrt { D } } = \sqrt { \frac { 1 } { D } \sum _ { d } z _ { n d } ^ { 2 } } } \end{array}$ .
373
+
374
+ # I RESULTS ILLUSTRATING EFFECT OF GRAYING ON CODES
375
+
376
+ ![](images/de981bd99cad3a10e0361fb1a86d086337316d0ca7eb126960eeeda780a4cf74.jpg)
377
+ Figure 12 shows the effect of graying on codes.
378
+
379
+ Figure 12: Effect of graying on codes. Left (mean), middle (standard deviation) and norm (right).
380
+
381
+ ![](images/296d0783887fb325245e846e34703778c92446325cab2382062dd37a27a9b7bf.jpg)
382
+ Figure 13: Samples. Samples from CV-Glow models used for analysis.
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/H1zriGeCZ/H1zriGeCZ.md ADDED
@@ -0,0 +1,461 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # HYPERPARAMETER OPTIMIZATION:A SPECTRAL APPROACH
2
+
3
+ Elad Hazan Princeton University and Google Brain ehazan@cs.princeton.edu
4
+
5
+ Adam Klivans Department of Computer Science University of Texas at Austin klivans@cs.utexas.edu
6
+
7
+ Yang Yuan
8
+ Department of Computer Science Cornell University
9
+ yangyuan@cs.cornell.edu
10
+
11
+ # ABSTRACT
12
+
13
+ We give a simple, fast algorithm for hyperparameter optimization inspired by techniques from the analysis of Boolean functions. We focus on the high-dimensional regime where the canonical example is training a neural network with a large number of hyperparameters. The algorithm — an iterative application of compressed sensing techniques for orthogonal polynomials — requires only uniform sampling of the hyperparameters and is thus easily parallelizable.
14
+
15
+ Experiments for training deep neural networks on Cifar-10 show that compared to state-of-the-art tools (e.g., Hyperband and Spearmint), our algorithm finds significantly improved solutions, in some cases better than what is attainable by handtuning. In terms of overall running time (i.e., time required to sample various settings of hyperparameters plus additional computation time), we are at least an order of magnitude faster than Hyperband and Bayesian Optimization. We also outperform Random Search $8 \times$ .
16
+
17
+ Our method is inspired by provably-efficient algorithms for learning decision trees using the discrete Fourier transform. We obtain improved sample-complexty bounds for learning decision trees while matching state-of-the-art bounds on running time (polynomial and quasipolynomial, respectively).
18
+
19
+ # 1 INTRODUCTION
20
+
21
+ Large scale machine learning and optimization systems usually involve a large number of free parameters for the user to fix according to their application. A timely example is the training of deep neural networks for a signal processing application: the ML specialist needs to decide on an architecture, depth of the network, choice of connectivity per layer (convolutional, fully-connected, etc.), choice of optimization algorithm and recursively choice of parameters inside the optimization library itself (learning rate, momentum, etc.).
22
+
23
+ Given a set of hyperparameters and their potential assignments, the naive practice is to search through the entire grid of parameter assignments and pick the one that performed the best, a.k.a. “grid search”. As the number of hyperparameters increases, the number of possible assignments increases exponentially and a grid search becomes quickly infeasible. It is thus crucial to find a method for automatic tuning of these parameters.
24
+
25
+ This auto-tuning, or finding a good setting of these parameters, is now referred to as hyperparameter optimization (HPO), or simply automatic machine learning (auto-ML). For continuous hyperparameters, gradient descent is usually the method of choice (Maclaurin et al., 2015; Luketina et al., 2015; Fu et al., 2016). Discrete parameters, however, such as choice of architecture, number of layers, connectivity and so forth are significantly more challenging. More formally, let
26
+
27
+ $$
28
+ f : \{ - 1 , 1 \} ^ { n } \mapsto [ 0 , 1 ]
29
+ $$
30
+
31
+ be a function mapping hyperparameter choices to test error of our model. That is, each dimension corresponds to a certain hyperparameter (number of layers, connectivity, etc.), and for simplicity of illustration we encode the choices for each parameter as binary numbers $\{ - 1 , 1 \}$ . The goal of HPO is to approximate the minimizer $\begin{array} { r } { x ^ { * } = \arg \operatorname* { m i n } _ { x \in \{ 0 , 1 \} ^ { n } } f ( x ) } \end{array}$ in the following setting:
32
+
33
+ 1. Oracle model: evaluation of $f$ for a given choice of hyperparameters is assumed to be very expensive. Such is the case of training a given architecture of a huge dataset. 2. Parallelism is crucial: testing several model hyperparameters in parallel is entirely possible in cloud architecture, and dramatically reduces overall optimization time. 3. $f$ is structured.
34
+
35
+ The third point is very important since clearly HPO is information-theoretically hard and $2 ^ { n }$ evaluations of the function are necessary in the worst case. Different works have considered exploiting one or more of the properties above. The approach of Bayesian optimization (Snoek et al., 2012) addresses the structure of $f$ , and assumes that a useful prior distribution over the structure of $f$ is known in advance. Multi-armed bandit algorithms (Li et al., 2016), and Random Search (Bergstra & Bengio, 2012), exploit computational parallelism very well, but do not exploit any particular structure of $f ^ { 1 }$ . These approaches are surveyed in more detail later.
36
+
37
+ # 1.1 OUR CONTRIBUTION
38
+
39
+ In this paper we introduce a new spectral approach to hyperparameter optimization. Our main idea is to make assumptions on the structure of $f$ in the Fourier domain. Specifically we assume that $f$ can be approximated by a sparse and low degree polynomial in the Fourier basis. This means intuitively that it can be approximated well by a decision tree.
40
+
41
+ The implication of this assumption is that we can obtain a rigorous theoretical guarantee: approximate minimization of $f$ over the boolean hypercube with function evaluations only linear in sparsity that can be carried out in parallel. We further give improved heuristics on this basic construction and show experiments showing our assumptions are validated in practice for HPO as applied to deep learning over image datasets.
42
+
43
+ Thus our contributions can be listed as:
44
+
45
+ • A new spectral method called Harmonica that has provable guarantees: sample-efficient recovery if the underlying objective is a sparse (noisy) polynomial and easy to implement on parallel architectures. We demonstrate significant improvements in accuracy, sample complexity, and running time for deep neural net training experiments. We compare ourselves to state-of-the-art solvers from Bayesian optimization, Multi-armed bandit techniques, and Random Search. Projecting to even higher numbers of hyperparameters, we perform simulations that show several orders-of-magnitude of speedup versus Bayesian optimization techniques. Improved bounds on the sample complexity of learning noisy, size $s$ decision trees over $n$ variables under the uniform distribution. We observe that the classical sample complexity bound of $n ^ { O ( \log ( s / \varepsilon ) ) }$ due to Linial et al. (1993) can be improved to quadratic in the size of the tree ${ \tilde { O } } ( s ^ { 2 } / \varepsilon \cdot \log n )$ while matching the best known quasipolynomial bound in running time.
46
+
47
+ # 1.2 PREVIOUS WORK
48
+
49
+ The literature on discrete-domain HPO can be roughly divided into two: probabilistic approaches and decision-theoretic methods. In critical applications, researchers usually use a grid search over all parameter space, but that becomes quickly prohibitive as the number of hyperparameter grows. Gradient-based methods such as (Maclaurin et al., 2015; Luketina et al., 2015; Fu et al., 2016; Bengio, 2000) are applicable only to continuous hyperparameters which we do not consider. Neural network structural search based on reinforcement learning is an active direction (Baker et al., 2016; Zoph & Le, 2016; Zhong et al., 2017), which usually needs many samples of network architectures. 1 except that they could implicitly utilize smoothness or other local properties of the space.
50
+
51
+ Probabilistic methods and Bayesian optimization. Bayesian optimization (BO) algorithms (Bergstra et al., 2011; Snoek et al., 2012; Swersky et al., 2013; Snoek et al., 2014; Gardner et al., 2014; Wang et al., 2013; Ilievski et al., 2017) tune hyperparameters by assuming a prior distribution of the loss function, and then keep updating this prior distribution based on the new observations. Each new observation is selected according to an acquisition function, which balances exploration and exploitation such that the new observation gives us a better result, or helps gain more information. The BO approach is inherently serial and difficult to parallelize, and its theoretical guarantees have thus far been limited to statistical consistency (convergence in the limit).
52
+
53
+ Decision-theoretic methods. Perhaps the simplest approach to HPO is random sampling of different choices of parameters and picking the best amongst the chosen evaluations (Bergstra & Bengio, 2012). It is naturally very easy to implement and parallelize. Upon this simple technique, researchers have tried to allocate different budgets to the different evaluations, depending on their early performance. Using adaptive resource allocation techniques found in the multi-armed bandit literature, Successive Halving (SH) algorithm was introduced (Jamieson & Talwalkar, 2016). Hyperband further improves SH by automatically tuning the hyperparameters in SH (Li et al., 2016).
54
+
55
+ Learning decision trees. Prior work for learning decision trees (more generally Boolean functions that are approximated by low-degree polynomials) used the celebrated “low-degree” algorithm of Linial et al. (1993). Their algorithm uses random sampling to estimate each low-degree Fourier coefficient to high accuracy.
56
+
57
+ We make use of the approach of Stobbe & Krause (2012), who showed how to learn low-degree, sparse Boolean functions using tools from compressed sensing (similar approaches were taken by Kocaoglu et al. (2014) and Negahban & Shah (2012)). We observe that their approach can be extended to learn functions that are both “approximately sparse” (in the sense that the $L _ { 1 }$ norm of the coefficients is bounded) and “approximately low-degree” (in the sense that most of the $L _ { 2 }$ mass of the Fourier spectrum resides on monomials of low-degree). This implies the first decision tree learning algorithm with polynomial sample complexity that handles adversarial noise. In addition, we obtain the optimal dependence on the error parameter $\varepsilon$ .
58
+
59
+ For the problem of learning exactly $k$ -sparse Boolean functions over $n$ variables, Haviv & Regev (2015) have recently shown that $O ( n k \log n )$ uniformly random samples suffice. Their result is not algorithmic but does provide an upper bound on the information-theoretic problem of how many samples are required to learn. The best algorithm in terms of running time for learning $k$ -sparse Boolean functions is due to Feldman et al. (2009), and requires time $2 ^ { { \bar { \Omega } } ( n / \log n ) }$ . It is based on the Blum et al. (2003) algorithm for learning parities with noise.
60
+
61
+ Techniques. Our methods are heavily based on known results from the analysis of boolean functions as well as compressed sensing.
62
+
63
+ # 2 SETUP AND DEFINITIONS
64
+
65
+ The problem of hyperparameter optimization is that of minimizing a discrete, real-valued function, which we denote by $f : \{ - 1 , 1 \} ^ { n } \mapsto [ - 1 , 1 ]$ (we can handle arbitrary inputs, binary is chosen for simplicity of presentation).
66
+
67
+ In the context of hyperparameter optimization, function evaluation is very expensive, although parallelizable, as it corresponds to training a deep neural net. In contrast, any computation that does not involve function evaluation is considered less expensive, such as computations that require time $\Omega ( n ^ { d } )$ for “somewhat large” $d$ or are subexponential (we still consider runtimes that are exponential in $n$ to be costly).
68
+
69
+ # 2.1 BASICS OF FOURIER ANALYSIS
70
+
71
+ The reader is referred to O’Donnell (2014) for an in depth treatment of Fourier analysis of Boolean functions. Let $f : \mathcal { X } \mapsto [ - 1 , 1 ]$ be a function over domain $\mathcal { X } \subseteq \mathbb { R } ^ { n }$ . Let $\mathcal { D }$ a probability distribution on $\mathcal { X }$ . We write $g \equiv _ { \varepsilon } f$ and say that $f , g$ are $\varepsilon$ -close if $\begin{array} { r } { \mathbb { E } _ { x \sim \mathcal { D } } [ ( f ( x ) - g ( x ) ) ^ { \bar { 2 } } ] \le \varepsilon } \end{array}$ .
72
+
73
+ Definition 1. (Rauhut, 2010) We say a family of functions $\psi _ { 1 } , \ldots , \psi _ { N }$ ( $\psi _ { i }$ maps $\mathcal { X }$ to $\mathbb { R }$ ) is a Random Orthonormal Family with respect to $\mathcal { D }$ if
74
+
75
+ $$
76
+ \mathbb { E } _ { \mathcal { D } } [ \psi _ { i } ( X ) \cdot \psi _ { j } ( X ) ] = \delta _ { i j } = \left\{ \begin{array} { l l } { 1 } & { \mathrm { ~ i f ~ } i = j } \\ { 0 } & { \mathrm { ~ o t h e r w i s e } } \end{array} \right. .
77
+ $$
78
+
79
+ The expectation is taken with respect to probability distribution $\mathcal { D }$ . We say that the family is $K$ - bounded if $\begin{array} { r } { \operatorname* { s u p } _ { x \in \mathcal { X } } | \psi _ { i } ( x ) | \le K } \end{array}$ for every $i$ . Henceforth we assume $K = 1$ .
80
+
81
+ An important example of a random orthonormal family is the class of parity functions with respect to the uniform distribution on $\{ - 1 , 1 \} ^ { n }$ :
82
+
83
+ Definition 2. A parity function on some subset of variables $S \subseteq [ n ]$ is the function $\chi _ { S } : \{ - 1 , 1 \} ^ { n } \mapsto$ $\{ - 1 , 1 \}$ where $\begin{array} { r } { \bar { \chi } _ { S } ( x ) = \prod _ { i \in S } x _ { i } } \end{array}$ .
84
+
85
+ It is easy to see that the set of all $2 ^ { n }$ parity functions $\{ \chi _ { S } \}$ , one for each $S \subseteq [ n ]$ , form a random orthonormal family with respect to the uniform distribution on $\{ - 1 , 1 \} ^ { n }$ .
86
+
87
+ This random orthonormal family is often referred to as the Fourier basis, as it is a complete orthonormal basis for the class of Boolean functions with respect to the uniform distribution on $\{ - 1 , 1 \} ^ { n }$ . More generally, for any $f : \{ - 1 , 1 \} ^ { n } \mapsto \mathbb { R }$ , $f$ can be uniquely represented in this basis as $\begin{array} { r } { f ( x ) = \sum _ { S \subseteq [ n ] } \hat { f } _ { S } \chi _ { S } ( x ) } \end{array}$ where $\hat { f } _ { S } = \langle f , \chi _ { S } \rangle = \mathbb { E } _ { x \in \{ - 1 , 1 \} ^ { n } } [ f ( x ) \chi _ { S } ( x ) ]$ is the Fourier coefficient corresponding to $S$ where $x$ is drawn uniformly from $\{ - 1 , 1 \} ^ { n }$ . We also have Parseval’s identity: $\begin{array} { r } { \mathbb { E } [ f ^ { 2 } ] = \sum _ { S } \hat { f } _ { S } ^ { 2 } } \end{array}$ .
88
+
89
+ In this paper, we will work exclusively with the above parity basis. Our results apply more generally, however, to any orthogonal family of polynomials (and corresponding product measure on $\mathbb { R } ^ { n }$ ). For example, if we wished to work with continuous hyperparameters, we could work with families of Hermite orthogonal polynomials with respect to multivariate spherical Gaussian distributions.
90
+
91
+ We conclude with a definition of low-degree, approximately sparse (bounded $L _ { 1 }$ norm) functions:
92
+
93
+ Definition 3 (Approximately sparse function). Let $\{ \chi _ { S } \}$ be the parity basis, and let $\mathcal { C }$ be a class of functions mapping $\{ - 1 , 1 \} ^ { n }$ to $\mathbb { R }$ . Thus for $f \in { \mathcal { C } }$ , $\begin{array} { r } { f = \sum _ { S } \hat { f } ( S ) \chi _ { S } } \end{array}$ . We say a function $f \in C$ is $s$ -sparse if $L _ { 0 } ( f ) ~ \le ~ s$ , ie., f has at most $s$ nonzero entries in its polynomial expansion. $f$ is $( \varepsilon , d )$ -concentrated if $\begin{array} { r } { \mathbb { E } [ ( f - \sum _ { S , | S | } \le _ { d } \hat { f } ( S ) \chi _ { S } ) ^ { 2 } ] \ge 1 - \varepsilon . { \mathcal C } } \end{array}$ is $( \varepsilon , d , s )$ -bounded if for every $f \in { \mathcal { C } }$ , $f$ is $( \varepsilon , d )$ -concentrated and in addition $\mathcal { C }$ has $L _ { 1 }$ norm bounded by $s$ , that is, for every $f \in { \mathcal { C } }$ we have $\Sigma _ { S } \left| \hat { f } ( S ) \right| \le s$ .
94
+
95
+ It is easy to see that the class of functions with bounded $L _ { 1 }$ norm is more general than sparse functions. For example, the Boolean AND function has $L _ { 1 }$ norm bounded by 1 but is not sparse.
96
+
97
+ We also have the following simple fact:
98
+
99
+ Fact 4. (Mansour, 1994) Let $f$ be such that $L _ { 1 } ( f ) ~ \leq ~ s .$ . Then there exists $g$ such that $g$ is $s ^ { 2 } / \varepsilon$ sparse and $E [ ( f - g ) ^ { 2 } ] \ \leq \ \varepsilon .$ . The function $g$ is constructed by taking all coefficients of magnitude $\varepsilon / s$ or larger in $f$ ’s expansion as a polynomial.
100
+
101
+ # 2.2 COMPRESSED SENSING AND SPARSE RECOVERY
102
+
103
+ In the problem of sparse recovery, a learner attempts to recover a sparse vector $x \in \mathbb { R } ^ { n }$ which is $s$ sparse, i.e. $\| x \| _ { 0 } ~ \leq ~ s$ , from an observation vector $y \in R ^ { m }$ that is assumed to equal $y =$ $A x + e$ , where $e$ is assumed to be zero-mean, usually Gaussian, noise. The seminal work of Candes et al. (2006); Donoho (2006) shows how $x$ can be recovered exactly under various conditions on the observation matrix $A \in \mathbb { R } ^ { m \times n }$ and the noise. The usual method for recovering the signal proceeds by solving a convex optimization problem consisting of $\ell _ { 1 }$ minimization as follows (for some parameter $\lambda > 0$ ):
104
+
105
+ $$
106
+ \operatorname* { m i n } _ { x \in \mathbb { R } ^ { n } } \left\{ \| x \| _ { 1 } + \lambda \| A x - y \| _ { 2 } ^ { 2 } \right\} .
107
+ $$
108
+
109
+ The above formulation comes in many equivalent forms (e.g., Lasso), where one of the objective parts may appear as a hard constraint.
110
+
111
+ ![](images/99c3e11f461c522493c36ebff71c1d89e0b5b627007d4ccea635366a7149f59b.jpg)
112
+ Figure 1: Compressed sensing over the Fourier domain: Harmonica recovers the Fourier coefficients of a sparse low degree polynomial $\textstyle \sum _ { S } \alpha _ { S } \Psi _ { S } ( x _ { i } )$ from observations $f ( x _ { i } )$ of randomly chosen points $x _ { i } \in$ $\{ - 1 , 1 \} ^ { n }$ .
113
+
114
+ For our work, the most relevant extension of traditional sparse recovery is due to Rauhut (2010), who considers the problem of sparse recovery when the measurements are evaluated according to a random orthonormal family. More concretely, fix $x \in \mathbb { R } ^ { n }$ with $s$ non-zero entries. For $K$ - bounded random orthonormal family $\mathcal { F } = \{ \psi _ { 1 } , . . . , \psi _ { N } \}$ , and $m$ independent draws $z ^ { 1 } , \ldots , z ^ { m }$ from corresponding distribution $\mathcal { D }$ define the $m \times N$ matrix $A$ such that $A _ { i j } = \psi _ { j } ( z ^ { i } )$ . Rauhut gives the following result for recovering sparse vectors $x$ :
115
+
116
+ Theorem 5 (Sparse Recovery for Random Orthonormal Families, (Rauhut, 2010) Theorem 4.4). Given as input matrix √ $A \ \in \ \mathbb { R } ^ { m \times N }$ and vector $y$ with $y _ { i } ~ = ~ A x + e _ { i }$ for some vector e with $\| e \| _ { 2 } ~ \le ~ \bar { \eta \sqrt { m } } ,$ , mathematical program (1) finds a vector $x ^ { * }$ such that for constants $c _ { 1 }$ and $c _ { 2 }$ , $\begin{array} { r } { \| x - x ^ { * } \| _ { 2 } \ \leq \ c _ { 1 } \frac { \sigma _ { s } ( x ) _ { 1 } } { \sqrt { s } } + c _ { 2 } \eta } \end{array}$ with probability $1 - \delta$ as long as for sufficiently large constant $C _ { i }$ , $m \ge C K ^ { 2 } \log K \cdot s \log ^ { 3 } s \cdot \log ^ { 2 } N \cdot \log ( 1 / \delta )$ .
117
+
118
+ The term $\sigma _ { s } ( x ) _ { 1 }$ is equal to $\operatorname* { m i n } \{ \| x - z \| _ { 1 } , z$ is $s$ sparse}. Recent work (Bourgain, 2014; Haviv & Regev, 2016) has improved the dependence on the polylog factors in the lower bound for $m$ .
119
+
120
+ # 3 BASIC ALGORITHM AND MAIN THEORETICAL RESULTS
121
+
122
+ The main component of our spectral algorithm for hyperparameter optimization is given in Algorithm $1 ^ { 2 }$ . It is essentially an extension of sparse recovery (basis pursuit or Lasso) to the orthogonal basis of polynomials in addition to an optimization step. See Figure 1 for an illustration. We prove Harmonica’s theoretical guarantee, and show how it gives rise to new theoretical results in learning from the uniform distribution.
123
+
124
+ In the next section we describe extensions of this basic algorithm to a more practical algorithm with various heuristics to improve its performance.
125
+
126
+ # Algorithm 1 Harmonica-1
127
+
128
+ 1: Input: oracle for $f$ , number of samples $T$ , sparsity $s$ , degree $d$ , parameter $\lambda$ .
129
+ 2: Invoke $\mathrm { P S R } ( f , T , s , d , \lambda )$ (Procedure 2) to obtain $( g , J )$ , where $g$ is a function defined on vari
130
+ ables specified by index set $J \subseteq [ n ]$ .
131
+ 3: Set the variables in $[ n ] \mid J$ to arbitrary values, compute a minimizer $x ^ { \star } \in \arg \operatorname* { m i n } g ( x )$ .
132
+ 4: return $x ^ { \star }$
133
+
134
+ Theorem 6 (Noiseless recovery). Let $\{ \psi _ { S } \}$ be a 1-bounded orthonormal polynomial basis for distribution $\mathcal { D }$ . Let $f : \mathbb { R } ^ { n } \mapsto \mathbb { R }$ be a $( 0 , d , s )$ -bounded function as per definition $^ 3$ with respect to the basis $\psi _ { S }$ . Then Algorithm $^ { l }$ , in time $n ^ { O ( d ) }$ and sample complexity $T = { \tilde { O } } ( s \cdot d \log n )$ , returns $x ^ { \star }$ such that $x ^ { \star } \in \arg \operatorname* { m i n } f ( x )$ .
135
+
136
+ This theorem, and indeed most of the results in this paper, follows from the main recovery properties of Procedure 2. This recovery procedure satisfies the following main lemma. See its proof in Section A.1.
137
+
138
+ Lemma 7 (Noisy recovery). Let $\{ \psi _ { S } \}$ be a 1-bounded orthonormal polynomial basis for distribution $\mathcal { D }$ . Let $f ~ : ~ \mathbb { R } ^ { n } \ \mapsto \ \mathbb { R }$ be a $( \varepsilon / 4 , d , s )$ -bounded as per definition 3 with respect to the
139
+
140
+ # Procedure 2 Polynomial Sparse Recovery (PSR)
141
+
142
+ 1: Input: oracle for $f$ , number of samples $T$ , sparsity $s$ , degree $d$ , regularization parameter $\lambda$
143
+ 2: Query $T$ random samples: $\{ f ( x _ { 1 } ) , . . . . , f ( x _ { T } ) \}$ .
144
+
145
+ 3: Solve sparse $d$ -polynomial regression over all polynomials up to degree $d$
146
+
147
+ $$
148
+ \arg \operatorname* { m i n } _ { \alpha \in \mathbb { R } ^ { \left( \frac { n } { d } \right) } } \left\{ \sum _ { i = 1 } ^ { T } \left( \sum _ { | S | \leq d } \alpha _ { S } \psi _ { S } ( x _ { i } ) - f ( x _ { i } ) \right) ^ { 2 } + \lambda \| \alpha \| _ { 1 } \right\}
149
+ $$
150
+
151
+ 4: Let $S _ { 1 } , . . . , S _ { s }$ be the indices of the largest coefficients of $\vec { \alpha }$ .
152
+
153
+ 5: return $\begin{array} { r } { g \triangleq \sum _ { i \in [ s ] } \alpha _ { S _ { i } } \psi _ { S _ { i } } ( x ) } \end{array}$ and $J = \cup _ { i = 1 } ^ { s } S _ { i }$ basis $\psi _ { S }$ . Then Procedure 2 finds a function $\begin{array} { l l } { \boldsymbol { \mathit { g } } } & { \equiv _ { \varepsilon } } & { \boldsymbol { \mathit { f } } } \end{array}$ in time $O ( n ^ { d } )$ and sample complexity $T = \tilde { O } ( s ^ { 2 } / \varepsilon \cdot d \log n )$ .
154
+
155
+ Remark: Note that the above Lemma also holds in the adversarial or agnostic noise setting. That is, an adversary could add a noise vector $v$ to the labels received by the learner. In this case, the learner will see label vector $y = A x + e + v$ . If $\| v \| _ { 2 } ~ \le ~ \sqrt { \gamma m }$ , then we will recover a polynomial with squared-error at most $\varepsilon + O ( \gamma )$ via re-scaling $\varepsilon$ by a constant factor and applying the triangle inequality to $\lVert e + v \rVert _ { 2 }$ .
156
+
157
+ While this noisy recovery lemma is the basis for our enhanced algorithm in the next section as well as the learning-theoretic result on learning of decision trees detailed in the next subsection, it does not imply recovery of the global optimum. The reason is that noisy recovery guarantees that we output a hypothesis close to the underlying function, but even a single noisy point can completely change the optimum.
158
+
159
+ Nevertheless, we can use our techniques to prove recovery of optimality for functions that are computed exactly by a sparse, low-degree polynomial (Theorem 6). See the proof in Section A.2.
160
+
161
+ # 3.1 APPLICATION: LEARNING DECISION TREES IN QUASI-POLYNOMIAL TIME AND POLYNOMIAL SAMPLE COMPLEXITY
162
+
163
+ Lemma 7 has important applications for learning (in the PAC model (Valiant, 1984)) well-studied function classes with respect to the uniform distribution on $\{ - 1 , 1 \} ^ { n 3 }$ . For example, we obtain the first quasi-polynomial time algorithm for learning decision trees with respect to the uniform distribution on $\bar { \{ - 1 , 1 \} } ^ { n }$ with polynomial sample complexity:
164
+
165
+ Corollary 8. Let $\mathcal { X } = \{ - 1 , 1 \} ^ { n }$ and let $\mathcal { C }$ be the class of all decision trees of size s on n variables. Then $\mathcal { C }$ is learnable with respect to the uniform distribution in time $n ^ { O ( \log ( s / \varepsilon ) ) }$ and sample complexity $m = \tilde { O } ( s ^ { 2 } / \varepsilon \cdot \log n )$ . Further, if the labels are corrupted by arbitrary noise vector $v$ such that $\| v \| _ { 2 } ~ \le ~ \sqrt { \gamma m }$ , then the output classifier will have squared-error at most $\varepsilon + O ( \gamma )$ .
166
+
167
+ See the proof of Corollary 8 in Section A.3.
168
+
169
+ Comparison with the “Low-Degree” Algorithm. Prior work for learning decision trees (more generally Boolean functions that are approximated by low-degree polynomials) used the celebrated “low-degree” algorithm of Linial et al. (1993). Their algorithm uses random sampling to estimate each low-degree Fourier coefficient to high accuracy. In contrast, our approach is to use algorithms for compressed sensing to estimate the coefficients. Tools for compressed sensing take advantage of the incoherence of the design matrix and give improved results that seem unattainable from the “low-degree” algorithm.
170
+
171
+ For learning noiseless, Boolean decision trees, the low-degree algorithm uses quasipolynomial time and sample complexity ${ \tilde { O } } ( s ^ { 2 } / \varepsilon ^ { 2 } \cdot \log n )$ to learn to accuracy $\varepsilon$ . It is not clear, however, how to obtain any noise tolerance from their approach.
172
+
173
+ For general real-valued decision trees where $B$ is an upper bound on the maximum value at any leaf of a size $s$ tree, our algorithm will succeed with sample complexity $\tilde { O } ( B ^ { 2 } s ^ { 2 } / \varepsilon \cdot \log n )$ and be tolerant to noise while the low-degree algorithm will use $\bar { \tilde { O } } ( B ^ { 4 } s ^ { 2 } \bar { / } \varepsilon ^ { 2 } \cdot \mathrm { l o g } n )$ (and will have no noise tolerance properties). Note our improvement in the dependence on $\varepsilon$ (even in the noiseless setting), which is a consequence of the RIP property of the random orthonormal family.
174
+
175
+ # 4 HARMONICA: THE FULL ALGORITHM
176
+
177
+ Rather than applying Algorithm 1 directly, we found that performance is greatly enhanced by iteratively using Procedure 2 to estimate the most influential hyperparameters and their optimal values.
178
+
179
+ In the rest of this section we describe this iterative heuristic, which essentially runs Algorithm 1 for multiple stages. More concretely, we continue to invoke the PSR subroutine until the search space becomes small enough for us to use a “base” hyperparameter optimizer (in our case either SH or Random Search).
180
+
181
+ The space of minimizing assignments to a multivariate polynomial is a highly non-convex set that may contain many distinct points. As such, we take an average of several of the best minimizers (of subsets of hyperparameters) during each stage.
182
+
183
+ In order to describe this formally we need the following definition of a restriction of function:
184
+
185
+ Definition 9 (restriction (O’Donnell, 2014)). Let $f \in \{ - 1 , 1 \} ^ { n } \mapsto \mathbb { R }$ , $J \subseteq [ n ]$ , and $z \in \{ - 1 , 1 \} ^ { J }$ be given. We call $( J , z )$ a restriction pair of function $f$ . We denote $f _ { J , z }$ the function over $n - | J |$ variables given by setting the variables of $J$ to $z$ .
186
+
187
+ We can now describe our main algorithm (Algorithm 3). Here $q$ is the number of stages for which we apply the PSR subroutine, and the restriction size $t$ serves as a tie-breaking rule for the best minimizers (which can be set to 1).
188
+
189
+ # Algorithm 3 Harmonica- $q$
190
+
191
+ 1: Input: oracle for $f$ , number of samples $T$ , sparsity $s$ , degree $d$ , regularization parameter $\lambda$ ,
192
+ number of stages $q$ , restriction size $t$ , base hyperparameter optimizer ALG.
193
+ 2: for stage $i = 1$ to $q$ do
194
+ 3: Invoke $\mathrm { P S R } ( f , T , s , d , \lambda )$ (Procedure 2) to obtain $( g _ { i } , J _ { i } )$ , where $g _ { i }$ is a function defined on
195
+ variables specified by index set $J _ { i } \subseteq [ n ]$ .
196
+ 4: Let $M _ { i } = \left\{ x _ { 1 } ^ { \star } , . . . , x _ { t } ^ { \star } \right\} = \arg \operatorname* { m i n } g _ { i } ( x )$ be the best $t$ minimizers of $g _ { i }$ .
197
+ 5: Let $f _ { i } = \mathbb { E } _ { k \in [ t ] } [ f _ { J _ { i } , x _ { k } ^ { \star } } ]$ be the expected restriction of $f$ according to minimizers $M _ { i }$ . 4
198
+ 6: Set $f = f _ { i }$ .
199
+ 7: end for
200
+ 8: return Search for the global minimizer of $f _ { q }$ using base optimizer ALG
201
+
202
+ We defer the comparison of Harmonica and other algorithms in Section B.
203
+
204
+ # 5 EXPERIMENTS WITH TRAINING DEEP NETWORKS
205
+
206
+ We compare Harmonica5 with Spearmint6 (Snoek et al., 2012), Hyperband, $\mathrm { S H } ^ { 7 }$ and Random Search. Both Spearmint and Hyperband are state-of-the-art algorithms, and it is observed that Random Search $2 \mathbf { x }$ (Random Search with doubled function evaluation resources) is a very competitive benchmark that beats many algorithms8.
207
+
208
+ Our first experiment is over training residual network on Cifar-10 dataset9. We included 39 binary hyperparameters, including initialization, optimization method, learning rate schedule, momentum rate, etc. Table 1 (Section C.1) details the hyperparameters considered. We also include 21 dummy variables to make the task more challenging. Notice that Hyperband, SH, and Random Search are agnostic to the dummy variables in the sense that they just set the value of dummy variables randomly, therefore select essentially the same set of configurations with or without the dummy variables. Only Harmonica and Spearmint are sensitive to the dummy variables as they try to learn the high dimensional function space. To make a fair comparison, we run Spearmint without any dummy variables.
209
+
210
+ ![](images/e326dfc0161f280589b33fe67d80bfb2428d811436cb26680f2be72e5a9eecaf.jpg)
211
+ Figure 2: Distribution of the best results and running time of different algorithms
212
+
213
+ ![](images/08dbffb196c4680e0af6a48c558dd7b9325b550ec0ee2fc138f4b1e69ab23817.jpg)
214
+ Figure 3: Comparing different variants of Harmonica with SH on test error and running time
215
+
216
+ As most hyperparameters have a consistent effect as the network becomes deeper, a common handtuning strategy is “tune on small network, then apply the knowledge to big network” (See discussion in Section C.3). Harmonica can also exploit this strategy as it selects important features stageby-stage. More specifically, during the feature selection stages, we run Harmonica for tuning an 8 layer neural network with 30 training epochs. At each stage, we take 300 samples to extract 5 important features, and set restriction size $t \ : = \ : 4$ (see Procedure 2). After that, we fix all the important features, and run the SH or Random Search as our base algorithm on the big 56 layer neural network for training the whole 160 epochs10. To clarify, “stage” means the stages of the hyperparameter algorithms, while “epoch” means the epochs for training the neural network.
217
+
218
+ # 5.1 PERFORMANCE
219
+
220
+ We tried three versions of Harmonica for this experiment, Harmonica with 1 stage (Harmonica-1), 2 stages (Harmonica-2) and 3 stages (Harmonica-3). All of them use SH as the base algorithm. The top 10 test error results and running times of the different algorithms are depicted in Figure 2. SH based algorithms may return fewer than 10 results. For more runs of variants of Harmonica and its resulting test error, see Figure 3 (the results are similar to Figure 2).
221
+
222
+ Test error and scalability: Harmonica-1 uses less than $1 / 5$ time of Spearmint, $1 / 7$ time of Hyperband and $1 / 8$ time compared with Random Search, but gets better results than the competing algorithms. It beats the Random Search 8x benchmark (stronger than Random Search $2 \mathbf { x }$ benchmark of Li et al. (2016)). Harmonica-2 uses slightly more time, but is able to find better results.
223
+
224
+ Improving upon human-tuned parameters: Harmonica-3 obtains a better test error $( 6 . 5 8 \% )$ ) as compared to the best hand-tuning rate $6 . 9 7 \%$ reported in (He et al., 2016)11. Harmonica-3 uses only 6.1 GPU days, which is less than half day in our environment, as we have 20 GPUs running in parallel. Notice that we did not cherry pick the results for Harmonica-3. In Section 5.3 we show by running Harmonica-3 for longer time, one can obtain a few other solutions better than hand tuning.
225
+
226
+ Performance of provable methods: Harmonica-1 has noiseless and noisy recovery guarantees (Lemma 7), which are validated experimentally.
227
+
228
+ # 5.2 AVERAGE TEST ERROR FOR EACH STAGE
229
+
230
+ We computed the average test error among 300 random samples for an 8 layer network with 30 epochs after each stage. See Figure 4 in Appendix. After selecting 5 features in stage 1, the average test error drops from 60.16 to 33.3, which indicates the top 5 features are very important. As we proceed to stage 3, the improvement on test error becomes less significant as the selected features at stage 3 have mild contributions.
231
+
232
+ # 5.3 HYPERPARAMETERS FOR HARMONICA
233
+
234
+ To be clear, Harmonica itself has six hyperparameters that one needs to set including the number of stages, $\ell _ { 1 }$ regularizer for Lasso, the number of features selected per stage, base algorithm, small network configuration, and the number of samples per stage. Note, however, that we have reduced the search space of general hyperparameter optimization down to a set of only six hyperparameters. Empirically, our algorithm is robust to different settings of these parameters, and we did not even attempt to tune some of them (e.g., small network configuration).
235
+
236
+ Base algorithm and #stages. We tried different versions of Harmonica, including Harmonica with 1 stage, 2 stages and 3 stages using SH as the base algorithm (Harmonica-1, Harmonica-2, Harmonica-3), with 1 stage and 2 stages using Random Search as the base algorithm (Harmonica-1- Random-Search, Harmonica-2-Random-Search), and with 2 stages and 3 stages running SH as the base for longer time (Harmonica-2-Long, Harmonica-3-Long). As can be seen in Figure 3, most variants produce better results than SH and use less running time. Moreover, if we run SH for longer time, we will obtain more stable solutions with less variance in test error.
237
+
238
+ Lasso parameters are stable. See Table 3 in Appendix for stable range for regularization term $\lambda$ and the number of samples. Here stable range means as long as the parameters are set in this range, the top 5 features and the signs of their weights (which are what we need for computing $g ( x )$ in Procedure 2) do not change. In other words, the feature selection outcome is not affected. When parameters are outside the stable ranges, usually the top features are still unchanged, and we miss only one or two out of the five features.
239
+
240
+ On the degree of features. We set degree to be three because it does not find any important features with degree larger than this. Since Lasso can be solved efficiently (less than 5 minutes in our experiments), the choice of degree can be decided automatically.
241
+
242
+ # 5.4 EXPERIMENTS WITH SYNTHETIC FUNCTIONS
243
+
244
+ Our second experiment considers a synthetic hierarchically bounded function $h ( x )$ . In this experiment, we showed that the optimization time of Harmonica is significantly faster than Spearmint, and the estimation error of Harmonica is linear in the noise level of the function. See Section C.4 for details.
245
+
246
+ # 6 ACKNOWLEDGEMENTS
247
+
248
+ We thank Sanjeev Arora for helpful discussions and encouragement. We thank anonymous reviewers for their helpful comments. Elad Hazan is supported by NSF grant 1523815. This project is supported by a Microsoft Azure research award and Amazon AWS research award.
249
+
250
+ # REFERENCES
251
+
252
+ Bowen Baker, Otkrist Gupta, Nikhil Naik, and Ramesh Raskar. Designing neural network architectures using reinforcement learning. CoRR, abs/1611.02167, 2016.
253
+
254
+ Yoshua Bengio. Gradient-based optimization of hyperparameters. Neural Computation, 12(8): 1889–1900, 2000.
255
+
256
+ James Bergstra and Yoshua Bengio. Random search for hyper-parameter optimization. J. Mach. Learn. Res., 13:281–305, February 2012. ISSN 1532-4435.
257
+
258
+ James S. Bergstra, Remi Bardenet, Yoshua Bengio, and Bal ´ azs K ´ egl. Algorithms for hyper- ´ parameter optimization. In J. Shawe-Taylor, R. S. Zemel, P. L. Bartlett, F. Pereira, and K. Q. Weinberger (eds.), Advances in Neural Information Processing Systems 24, pp. 2546–2554. Curran Associates, Inc., 2011.
259
+
260
+ Avrim Blum, Adam Kalai, and Hal Wasserman. Noise-tolerant learning, the parity problem, and the statistical query model. J. ACM, 50(4):506–519, July 2003. ISSN 0004-5411.
261
+
262
+ Jean Bourgain. An Improved Estimate in the Restricted Isometry Problem, pp. 65–70. Springer International Publishing, Cham, 2014.
263
+
264
+ E. J. Candes, J. Romberg, and T. Tao. Robust uncertainty principles: Exact signal reconstruction from highly incomplete frequency information. IEEE Trans. Inf. Theor., 52(2):489–509, February 2006. ISSN 0018-9448.
265
+
266
+ D. L. Donoho. Compressed sensing. IEEE Trans. Inf. Theor., 52(4):1289–1306, April 2006. ISSN 0018-9448.
267
+
268
+ V. Feldman, Parikshit Gopalan, Subhash Khot, and Ashok Kumar Ponnuswami. On agnostic learning parities, monomials,and halfspaces. SIAM Journal on Computing, 39(2):606–645, 2009. ISSN 0097-5397.
269
+
270
+ Jie Fu, Hongyin Luo, Jiashi Feng, Kian Hsiang Low, and Tat-Seng Chua. Drmad: Distilling reversemode automatic differentiation for optimizing hyperparameters of deep neural networks. CoRR, abs/1601.00917, 2016.
271
+
272
+ Jacob R. Gardner, Matt J. Kusner, Zhixiang Eddie Xu, Kilian Q. Weinberger, and John P. Cunningham. Bayesian optimization with inequality constraints. In Proceedings of the 31th International Conference on Machine Learning, ICML 2014, Beijing, China, 21-26 June 2014, pp. 937–945, 2014.
273
+
274
+ 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, AISTATS 2010, Chia Laguna Resort, Sardinia, Italy, May 13-15, 2010, pp. 249– 256, 2010.
275
+
276
+ Ishay Haviv and Oded Regev. The list-decoding size of fourier-sparse boolean functions. In David Zuckerman (ed.), 30th Conference on Computational Complexity, CCC 2015, June 17- 19, 2015, Portland, Oregon, USA, volume 33 of LIPIcs, pp. 58–71. Schloss Dagstuhl - LeibnizZentrum fuer Informatik, 2015. ISBN 978-3-939897-81-1. URL http://www.dagstuhl. de/dagpub/978-3-939897-81-1.
277
+
278
+ Ishay Haviv and Oded Regev. The restricted isometry property of subsampled fourier matrices. In Proceedings of the Twenty-seventh Annual ACM-SIAM Symposium on Discrete Algorithms, SODA ’16, pp. 288–297, Philadelphia, PA, USA, 2016. Society for Industrial and Applied Mathematics. ISBN 978-1-611974-33-1. URL http://dl.acm.org/citation.cfm?id= 2884435.2884457.
279
+
280
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In 2015 IEEE International Conference on Computer Vision, ICCV 2015, Santiago, Chile, December 7-13, 2015, pp. 1026–1034, 2015.
281
+
282
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In 2016 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2016, Las Vegas, NV, USA, June 27-30, 2016, pp. 770–778, 2016.
283
+
284
+ Gao Huang, Zhuang Liu, and Kilian Q. Weinberger. Densely connected convolutional networks. CoRR, abs/1608.06993, 2016.
285
+
286
+ Ilija Ilievski, Taimoor Akhtar, Jiashi Feng, and Christine Annette Shoemaker. Efficient hyperparameter optimization for deep learning algorithms using deterministic RBF surrogates. In Proceedings of the Thirty-First AAAI Conference on Artificial Intelligence, February 4-9, 2017, San Francisco, California, USA., pp. 822–829, 2017.
287
+
288
+ 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, Lille, France, 6-11 July 2015, pp. 448–456, 2015.
289
+
290
+ Kevin G. Jamieson and Ameet Talwalkar. Non-stochastic best arm identification and hyperparameter optimization. In Proceedings of the 19th International Conference on Artificial Intelligence and Statistics, AISTATS 2016, Cadiz, Spain, May 9-11, 2016, pp. 240–248, 2016.
291
+
292
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. CoRR, abs/1412.6980, 2014.
293
+
294
+ Murat Kocaoglu, Karthikeyan Shanmugam, Alexandros G. Dimakis, and Adam R. Klivans. Sparse polynomial learning and graph sketching. 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. 3122–3130, 2014. URL http://papers.nips.cc/ book/advances-in-neural-information-processing-systems-27-2014.
295
+
296
+ L. Li, K. Jamieson, G. DeSalvo, A. Rostamizadeh, and A. Talwalkar. Hyperband: A Novel BanditBased Approach to Hyperparameter Optimization. ArXiv e-prints, March 2016.
297
+
298
+ Nathan Linial, Yishay Mansour, and Noam Nisan. Constant depth circuits, fourier transform, and learnability. J. ACM, 40(3):607–620, July 1993. ISSN 0004-5411.
299
+
300
+ Jelena Luketina, Mathias Berglund, Klaus Greff, and Tapani Raiko. Scalable gradient-based tuning of continuous regularization hyperparameters. CoRR, abs/1511.06727, 2015.
301
+
302
+ Dougal Maclaurin, David Duvenaud, and Ryan P. Adams. Gradient-based hyperparameter optimization through reversible learning. In Proceedings of the 32Nd International Conference on International Conference on Machine Learning - Volume 37, ICML’15, pp. 2113–2122. JMLR.org, 2015. URL http://dl.acm.org/citation.cfm?id=3045118.3045343.
303
+
304
+ Yishay Mansour. Learning Boolean Functions via the Fourier Transform, pp. 391–424. Springer US, Boston, MA, 1994. doi: 10.1007/978-1-4615-2696-4 11.
305
+
306
+ Sahand Negahban and Devavrat Shah. Learning sparse boolean polynomials. In Allerton, pp. 2032– 2036. IEEE, 2012. ISBN 978-1-4673-4537-8. URL http://ieeexplore.ieee.org/ xpl/mostRecentIssue.jsp?punumber $=$ 6475439.
307
+
308
+ Ryan O’Donnell. Analysis of Boolean Functions. Cambridge University Press, New York, NY, USA, 2014. ISBN 1107038324, 9781107038325.
309
+
310
+ Holger Rauhut. Compressive sensing and structured random matrices. Theoretical foundations and numerical methods for sparse recovery, 9:1–92, 2010.
311
+
312
+ Benjamin Recht. Embracing the random. http://www.argmin.net/2016/06/23/ hyperband/, 2016a.
313
+
314
+ Benjamin Recht. The news on auto-tuning. http://www.argmin.net/2016/06/20/ hypertuning/, 2016b.
315
+
316
+ 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.
317
+
318
+ Jasper Snoek, Kevin Swersky, Richard S. Zemel, and Ryan P. Adams. Input warping for bayesian optimization of non-stationary functions. In Proceedings of the 31th International Conference on Machine Learning, ICML 2014, Beijing, China, 21-26 June 2014, pp. 1674–1682, 2014.
319
+
320
+ 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.
321
+
322
+ Peter Stobbe and Andreas Krause. Learning fourier sparse set functions. In Neil D. Lawrence and Mark A. Girolami (eds.), Proceedings of the Fifteenth International Conference on Artificial Intelligence and Statistics, AISTATS 2012, La Palma, Canary Islands, April 21-23, 2012, volume 22 of JMLR Proceedings, pp. 1125–1133. JMLR.org, 2012. URL http://jmlr.org/ proceedings/papers/v22/.
323
+
324
+ Ilya Sutskever, James Martens, George E. Dahl, and Geoffrey E. Hinton. On the importance of initialization and momentum in deep learning. In Proceedings of the 30th International Conference on Machine Learning, ICML 2013, Atlanta, GA, USA, 16-21 June 2013, pp. 1139–1147, 2013.
325
+
326
+ 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.
327
+
328
+ R. Tibshirani. Regression shrinkage and selection via the lasso. Journal of the Royal Statistical Society (Series B), 58:267–288, 1996.
329
+
330
+ Leslie G Valiant. A theory of the learnable. Communications of the ACM, 27(11):1134–1142, 1984.
331
+
332
+ Ziyu Wang, Masrour Zoghi, Frank Hutter, David Matheson, and Nando de Freitas. Bayesian optimization in high dimensions via random embeddings. In IJCAI 2013, Proceedings of the $2 3 r d$ International Joint Conference on Artificial Intelligence, Beijing, China, August 3-9, 2013, pp. 1778–1784, 2013.
333
+
334
+ Jian Wu and Peter I. Frazier. The parallel knowledge gradient method for batch bayesian optimization. In Advances in Neural Information Processing Systems 29: Annual Conference on Neural Information Processing Systems 2016, December 5-10, 2016, Barcelona, Spain, pp. 3126–3134, 2016.
335
+
336
+ Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. CoRR, abs/1605.07146, 2016.
337
+
338
+ Zhao Zhong, Junjie Yan, and Cheng-Lin Liu. Practical network blocks design with q-learning. CoRR, abs/1708.05552, 2017.
339
+
340
+ Barret Zoph and Quoc V. Le. Neural architecture search with reinforcement learning. CoRR, abs/1611.01578, 2016.
341
+
342
+ # A MISSING PROOFS
343
+
344
+ A.1 PROOF OF LEMMA 7
345
+
346
+ Recall the Chebyshev inequality:
347
+
348
+ Fact 10 (Multidimensional Chebyshev inequality). Let $X$ be an m dimensional random vector, with expected value $\mu = \operatorname { \mathbb { E } } [ X ]$ , and covariance matrix $V = \mathbb { E } [ ( X - \mu ) ( X - \mu ) ^ { T } ]$ .
349
+
350
+ If $V$ is a positive definite matrix, for any real number $\delta > 0$ :
351
+
352
+ $$
353
+ \mathbb { P } ( \sqrt { ( X - \mu ) ^ { T } V ^ { - 1 } ( X - \mu ) } > \delta ) \le \frac { m } { \delta ^ { 2 } }
354
+ $$
355
+
356
+ For ease of notation we assume $K = 1$ . Let $f$ be an $( \varepsilon / 4 , s , d )$ -bounded function written in the orthonormal basis as $\textstyle \sum _ { S } { \hat { f } } ( S ) \psi _ { S }$ . We can equivalently write $f$ as $f = h + g$ , where $h$ is a degree $d$ polynomial that only includes coefficients of magnitude at least $\varepsilon / 4 s$ and the constant term of the polynomial expansion of $f$ .
357
+
358
+ Since $\begin{array} { r } { L _ { 1 } ( f ) = \sum _ { S } | \hat { f } _ { S } | \le s } \end{array}$ , by Fact 4 we have that $h$ is $4 s ^ { 2 } / \varepsilon + 1$ sparse. The function $g$ is thus the sum of the remaining ${ \hat { f } } ( S ) \psi _ { S }$ terms not included in $h$ .
359
+
360
+ Draw $m$ (to be chosen later) random labeled examples $\{ ( z ^ { 1 } , y ^ { 1 } ) , \dots , ( z ^ { m } , y ^ { m } ) \}$ and enumerate all $N = n ^ { d }$ basis functions $\psi _ { S }$ for $| S | \le d$ as $\{ \psi _ { 1 } , \ldots , \psi _ { N } \}$ . Form matrix $A$ such that $A _ { i j } = \psi _ { j } ( z ^ { i } )$ and consider the problem of recovering $4 s ^ { 2 } / \varepsilon + 1$ sparse $x$ given $A x + e = y$ where $x$ is the vector of coefficients of $h$ , the $i$ th entry of $y$ equals $y ^ { i }$ , and $e _ { i } = g ( \bar { z } ^ { i } )$ .
361
+
362
+ We will prove that with constant probability over the choice $m$ random examples, $\| e \| _ { 2 } ~ \le ~ \sqrt { \varepsilon m }$ . Applying Theorem 5 by setting $\eta = \sqrt { \varepsilon }$ and observing that $\sigma _ { 4 s ^ { 2 } / \varepsilon + 1 } ( x ) _ { 1 } = 0$ , we will recover $x ^ { \prime }$ such that $\| x - x ^ { \prime } \| _ { 2 } ^ { 2 } \ \leq \ c _ { 2 } ^ { 2 } \varepsilon$ for some constant $c _ { 2 }$ . As such, for the function $\begin{array} { r } { \tilde { f } = \sum _ { i = 1 } ^ { N } x _ { i } ^ { \prime } \psi _ { i } } \end{array}$ we will have $\mathbb { E } [ \| h - \tilde { f } \| ^ { 2 } ] \ \leq \ c _ { 2 } ^ { 2 } \varepsilon$ by Parseval’s identity. Note, however, that we may rescale $\varepsilon$ by constant factor $1 / ( 2 c _ { 2 } ^ { 2 } )$ to obtain error $\varepsilon / 2$ and only incur an additional constant (multiplicative) factor in the sample complexity bound.
363
+
364
+ By the definition of $g$ , we have
365
+
366
+ $$
367
+ \| g \| ^ { 2 } = \left( \sum _ { S , | S | > d } \hat { f } ( S ) ^ { 2 } + \sum _ { R } \hat { f } ( R ) ^ { 2 } \right)
368
+ $$
369
+
370
+ where each ${ \hat { f } } ( R )$ is of magnitude at most $\varepsilon / 4 s$ . By Fact 4 and Parseval’s identity we have $\textstyle \sum _ { R } { \hat { f } } ( R ) ^ { 2 } \ \leq \ \varepsilon / 4$ . Since $f$ is $( \varepsilon / 4 , d )$ -concentrated we have $\begin{array} { r } { \sum _ { S , | S | > d } { \hat { f } } ( S ) ^ { 2 } ~ \le ~ \varepsilon / 4 } \end{array}$ . Thus, $\| g \| ^ { 2 }$ is at most $\varepsilon / 2$ . Therefore, by triangle inequality $\mathbb { E } [ \| f - \tilde { f } \| ^ { 2 } ] \le \mathbb { E } [ \| h - \tilde { f } \| ^ { 2 } ] + \mathbb { E } [ \| g \| ^ { 2 } ] \le \varepsilon$ . It remains to bound $\| e \| _ { 2 }$ . Note that since the examples are chosen independently, the entries $e _ { i } =$ $g ( z ^ { i } )$ are independent random variables. Since $g$ is a linear combination of orthonormal monomials (not including the constant term), we have $\mathbb { E } _ { z \sim D } [ g ( z ) ] = 0$ . Here we can apply linearity of variance (the covariance of $\psi _ { i }$ and $\psi _ { j }$ is zero for all $i \neq j$ ) and calculate the variance
371
+
372
+ $$
373
+ \mathbf { V a r } ( g ( z ^ { i } ) ) = ( \sum _ { S , | S | > d } { \hat { f } } ( S ) ^ { 2 } + \sum _ { R } { \hat { f } } ( R ) ^ { 2 } )
374
+ $$
375
+
376
+ With the same calculation as (3), we know ${ \mathbf { V a r } } ( g ( z ^ { i } ) )$ is at most $\varepsilon / 2$ .
377
+
378
+ Now consider the covariance matrix $V$ of the vector $e$ which equals $\mathbb { E } [ e e ^ { \top } ]$ (recall every entry of $e$ has mean 0). Then $V$ is a diagonal matrix (covariance between two independent samples is zero), and every diagonal entry is at most $\varepsilon / 2$ . Applying Fact 10 we have
379
+
380
+ $$
381
+ \mathbb { P } ( \| e \| _ { 2 } > \sqrt { \frac { \varepsilon } { 2 } } \delta ) \ \leq \ \frac { m } { \delta ^ { 2 } } .
382
+ $$
383
+
384
+ Setting $\delta = { \sqrt { 2 m } }$ , we conclude that $\mathbb { P } ( \| e \| _ { 2 } > { \sqrt { \varepsilon m } } ) \leq { \frac { 1 } { 2 } }$ . Hence with probability at least $1 / 2$ , we have that $\| e \| _ { 2 } ~ \le ~ \sqrt { \varepsilon m }$ . From Theorem 5, we may choose $m = \tilde { O } ( s ^ { 2 } / \varepsilon \cdot \log n ^ { d } )$ . This completes the proof. Note that the probability $1 / 2$ above can be boosted to any constant probability with a constant factor loss in sample complexity.
385
+
386
+ # A.2 PROOF OF THEOREM 6
387
+
388
+ There are at most $N = n ^ { d }$ polynomials $\psi _ { S }$ with $| S | \le d$ . Let the enumeration of these polynomials be $\psi _ { 1 } , \ldots , \psi _ { N }$ . Draw $m$ labeled examples $\{ ( z ^ { 1 } , y ^ { 1 } ) , \dots , ( z ^ { m } , y ^ { m } ) \}$ independently from $\mathcal { D }$ and construct an $m \times N$ matrix $A$ with $A _ { i j } = \psi _ { j } ( z ^ { i } )$ . Since $f$ can be written as an $s$ sparse linear combination of $\psi _ { 1 } , \dots , \psi _ { N }$ , there exists an $s$ -sparse vector $x$ such that $A x = y$ where the ith entry of $y$ is $y ^ { i }$ . Hence we can apply Theorem 5 to recover $x$ exactly. These are the $s$ non-zero coefficients of $f$ ’s expansion in terms of $\{ \psi _ { S } \}$ . Since $f$ is recovered exactly, its minimizer is found in the optimization step.
389
+
390
+ # A.3 PROOF OF COROLLARY 8
391
+
392
+ As mentioned earlier, the orthonormal polynomial basis for the class of Boolean functions with respect to the uniform distribution on $\{ - 1 , 1 \} ^ { n }$ is the class of parity functions $\{ \chi _ { S } \}$ for $S \subseteq \{ - 1 , 1 \} ^ { n }$ . Further, it is easy to show that for Boolean function $f$ , if $\mathbb { E } [ ( h - f ) ^ { 2 } ] ~ \leq ~ \varepsilon$ then $\mathbb { P } [ \mathsf { s i g n } ( h ( x ) ) \neq$ $f ( x ) ] \ \leq \ \varepsilon$ . The corollary now follows by applying Lemma 7 and two known structural facts about decision trees: 1) a tree of size $s$ is $( \varepsilon , \log ( s / \varepsilon ) )$ -concentrated and has $L _ { 1 }$ norm bounded by $s$ (see e.g., Mansour Mansour (1994)) and 2) by Fact 4, for any function $f$ with $L _ { 1 }$ norm bounded by $s$ (i.e., a decision tree of size $s$ ), there exists an $s ^ { 2 } / \varepsilon$ sparse function $g$ such that $\mathbb { E } [ ( f - g ) ^ { 2 } ] \ \leq \ \varepsilon$ . The noise tolerance property follows immediately from the remark after the proof of Lemma 7.
393
+
394
+ # B ALGORITHM ATTRIBUTES AND HEURISTICS
395
+
396
+ Scalability. If the hidden function if $s$ -sparse, Harmonica can find such a sparse function using $\tilde { O } ( s \log s )$ samples. If at every stage of Harmonica, the target function can be approximated by an $s$ sparse function, we only need ${ \tilde { O } } ( q s \log s )$ samples where $q$ is the number of stages. For real world applications such as deep neural network hyperparameter tuning, it seems (empirically) reasonable to assume that the hidden function is indeed sparse at every stage (see Section 5).
397
+
398
+ For Hyperband (Li et al., 2016), SH (Jamieson & Talwalkar, 2016) or Random Search, even if the function is $s$ -sparse, in order to cover the optimal configuration by random sampling, we need $\Omega ( 2 ^ { s } )$ samples.
399
+
400
+ Optimization time. Harmonica runs the Lasso (Tibshirani, 1996) algorithm after each stage to solve (2), which is a well studied convex optimization problem and has very fast implementations. Hyperband and SH are also efficient in terms of running time as a function of the number of function evaluations, and require sorting or other simple computations. The running time of Bayesian optimization is cubic in number of function evaluations, which limits applicability for large number of evaluations / high dimensionality, as we shall see in Section C.4.
401
+
402
+ Parallelizability. Harmonica, similar to Hyperband, SH, and Random Search, has straightforward parallel implementations. In every stage of those algorithms, we could simply evaluate the objective functions over randomly chosen points in parallel.
403
+
404
+ It is hard to run Bayesian optimization algorithm in parallel due to its inherent serial nature. Previous works explored variants in which multiple points are evaluated at the same time in parallel (Wu & Frazier, 2016), though speed ups do not grow linearly in the number of machines, and the batch size is usually limited to a small number.
405
+
406
+ Feature Extraction. Harmonica is able to extract important features with weights in each stages, which automatically sorts all the features according to their importance. See Section C.2.
407
+
408
+ # C EXPERIMENTAL DETAILS
409
+
410
+ # C.1 OPTIONS
411
+
412
+ Table 1: 60 options used in Section 5
413
+
414
+ <table><tr><td colspan="1" rowspan="1">Option Name</td><td colspan="1" rowspan="1">Description</td></tr><tr><td colspan="1" rowspan="1">01. Weight initialization</td><td colspan="1" rowspan="1">Use standard initializations or other initializations?</td></tr><tr><td colspan="1" rowspan="1">02. Weight initialization (Detail 1)</td><td colspan="1" rowspan="1"> Xavier Glorot (Glorot &amp; Bengio,2010), Kaiming (He et al., 2015),1/n,or1/n2?</td></tr><tr><td colspan="1" rowspan="1">03.Optimization method</td><td colspan="1" rowspan="1"> SGD or ADAM? (Kingma &amp; Ba, 2014)</td></tr><tr><td colspan="1" rowspan="1">04. Initial learning rate</td><td colspan="1" rowspan="1">≥ 0.01 or&lt;0.01?</td></tr><tr><td colspan="1" rowspan="1">05. Initial learning rate (Detail 1)</td><td colspan="1" rowspan="1">≥ 0.1,&lt;0.1,≥ 0.001,0r&lt;0.001?</td></tr><tr><td colspan="1" rowspan="1">06. Initial learning rate (Detail 2)</td><td colspan="1" rowspan="1">0.3,0.1, 0.03,0.01,0.003,0.001,0.0003,0r 0.0001?</td></tr><tr><td colspan="1" rowspan="1"> 07. Learning rate drop</td><td colspan="1" rowspan="1">Do we need to decrease learning rate as we train? Yes or No?</td></tr><tr><td colspan="1" rowspan="1">08. Learning rate first drop time</td><td colspan="1" rowspan="1">If drop learning rate, when is the first time to drop by 1/1O? Epoch 40or Epoch 60?</td></tr><tr><td colspan="1" rowspan="1">09. Learning rate second drop time</td><td colspan="1" rowspan="1">If drop learning rate, when is the second time to drop by 1/10o? Epoch80 or Epoch 100?</td></tr><tr><td colspan="1" rowspan="1">10. Use momentum (Sutskever et al.,2013)</td><td colspan="1" rowspan="1">Yes or No?</td></tr><tr><td colspan="1" rowspan="1">11.Momentum rate</td><td colspan="1" rowspan="1">If use momentum, rate is 0.9 or 0.99?</td></tr><tr><td colspan="1" rowspan="1">12. Initial residual link weight</td><td colspan="1" rowspan="1">What is the initial residual link weight? All constant 1 or a randomnumber in [0,1]?</td></tr><tr><td colspan="1" rowspan="1">13.Tune residual link weight</td><td colspan="1" rowspan="1">Do we want to use back propagation to tune the weight of residual links?Yes or No?</td></tr><tr><td colspan="1" rowspan="1">14.Tune time of residual link weight</td><td colspan="1" rowspan="1">When do we start to tune residual link weight? At the first epoch orepoch 10?</td></tr><tr><td colspan="1" rowspan="1">15. Resblock first activation</td><td colspan="1" rowspan="1">Do we want to add activation layer after the first convolution? Yes orNo?</td></tr><tr><td colspan="1" rowspan="1">16. Resblock second activation</td><td colspan="1" rowspan="1">Do we want to add activation layer after the second convolution? YesorNo?</td></tr><tr><td colspan="1" rowspan="1">17. Resblock third activation</td><td colspan="1" rowspan="1">Do we want to add activation layer after adding the residual link? Yesor No?</td></tr><tr><td colspan="1" rowspan="1">18.Convolution bias</td><td colspan="1" rowspan="1">Do we want to have bias term in convolutional layers? Yes or No?</td></tr><tr><td colspan="1" rowspan="1">19.Activation</td><td colspan="1" rowspan="1">What kind of activations do we use? ReLU or others?</td></tr><tr><td colspan="1" rowspan="1">20. Activation (Detail 1)</td><td colspan="1" rowspan="1">ReLU, ReLU, Sigmoid,or Tanh?</td></tr><tr><td colspan="1" rowspan="1">21. Use dropout (Srivastava et al., 2014)</td><td colspan="1" rowspan="1">Yes or No?</td></tr><tr><td colspan="1" rowspan="1">22. Dropout rate</td><td colspan="1" rowspan="1"> If use dropout, rate is high or low?</td></tr><tr><td colspan="1" rowspan="1">23. Dropout rate (Detail 1)</td><td colspan="1" rowspan="1">If use dropout, the rate is 0.3, 0.2, 0.1, or 0.05?</td></tr><tr><td colspan="1" rowspan="1">24.Batch norm (Ioffe &amp; Szegedy, 2015)</td><td colspan="1" rowspan="1">Do we use batch norm? Yes or No?</td></tr><tr><td colspan="1" rowspan="1">25. Batch norm tuning</td><td colspan="1" rowspan="1">If we use batch norm,do we tune the parameters in the batch normlayers? Yes or No?</td></tr><tr><td colspan="1" rowspan="1">26. Resnet shortcut type</td><td colspan="1" rowspan="1">What kind of resnet shortcut type do we use? Identity or others?</td></tr><tr><td colspan="1" rowspan="1">27. Resnet shortcut type (Detail 1)</td><td colspan="1" rowspan="1">Identity, Identity, Type B or Type C?</td></tr><tr><td colspan="1" rowspan="1">28.Weight decay</td><td colspan="1" rowspan="1">Do we use weight decay during the training? Yes or No?</td></tr><tr><td colspan="1" rowspan="1">29.Weight decay parameter</td><td colspan="1" rowspan="1">If use weight decay, what is the parameter? 1e - 3 or 1e - 4?</td></tr><tr><td colspan="1" rowspan="1">30.Batch Size</td><td colspan="1" rowspan="1">What is the batch size we should use? Big or Small?</td></tr><tr><td colspan="1" rowspan="1">31.Batch Size (Detail 1)</td><td colspan="1" rowspan="1">256,128,64,or 32?</td></tr><tr><td colspan="1" rowspan="1">32. Optnet</td><td colspan="1" rowspan="1"> An option specific to the codel2. Yes or No?</td></tr><tr><td colspan="1" rowspan="1">33.Share gradInput</td><td colspan="1" rowspan="1"> An option specific to the code. Yes or No?</td></tr><tr><td colspan="1" rowspan="1">34.Backend</td><td colspan="1" rowspan="1">What kind of backend shall we use? cudnn or cunn?</td></tr><tr><td colspan="1" rowspan="1">35.cudnn running state</td><td colspan="1" rowspan="1">If use cudnn, shall we use fastest of other states?</td></tr><tr><td colspan="1" rowspan="1"> 36. cudnn running state (Detail 1)</td><td colspan="1" rowspan="1">Fastest,Fastest, default, deterministic</td></tr><tr><td colspan="1" rowspan="1">37. nthreads</td><td colspan="1" rowspan="1">How many threads shall we use? Many or few?</td></tr><tr><td>38.nthreads (Detail 1)</td><td>8,4,2,or 1?</td></tr><tr><td>39-60.Dummy variables</td><td>Just dummy variables,no effect at all.</td></tr></table>
415
+
416
+ See Table 1 for the specific hyperparameter options that we use in Section 5. For those variables with $k$ options $( k > 2 )$ , we use $\log k$ binary variables under the same name to represent them. For example, we have two variables (01, 02) and their binary representation to denote four kinds of possible initializations: Xavier Glorot (Glorot & Bengio, 2010), Kaiming (He et al., 2015), $1 / n$ , or $\mathbf { { \bar { 1 } } } / n ^ { 2 }$ .
417
+
418
+ # C.2 IMPORTANCE FEATURES
419
+
420
+ We show the selected important features and their weights during the first 3 stages in Table 2, where each feature is a monomial of variables with degree at most 3. We do not include the 4th stage because in that stage there are no features with nonzero weights.
421
+
422
+ Smart choices on important options. Based on Table 2, Harmonica will fix the following variables (sorted according to their importance): Batch Norm (Yes), Activation (ReLU), Initial learning rate ([0.001, 0.1]), Optimization method (Adam), Use momentum (Yes), Resblock first activation (Yes), Resblcok third activation (No), Weight decay (No if initial learning rate is comparatively small and Yes otherwise), Batch norm tuning (Yes). Most of these choices match what people are doing in practice.
423
+
424
+ A metric for the importance of variables. The features that Harmonica finds can serve as a metric for measuring the importance of different variables. For example, Batch Norm turns out to be the most significant variable, and ReLU is second important. By contrast, Dropout, when Batch Norm is presented, does not have significant contributions. This actually matches with the observations in (Ioffe & Szegedy, 2015).
425
+
426
+ No dummy/irrelevant variables selected. Although there are 21/60 dummy variables, we never select any of them. Moreover, the irrelevant variables like cudnn, backend, nthreads, which do not affect the test error, were not selected.
427
+
428
+ Table 2: Important features
429
+
430
+ <table><tr><td rowspan=1 colspan=1>Stage</td><td rowspan=1 colspan=1>Feature Name</td><td rowspan=1 colspan=1>Weights</td></tr><tr><td rowspan=1 colspan=1>1-1</td><td rowspan=1 colspan=1>24.Batch norm</td><td rowspan=1 colspan=1>8.05</td></tr><tr><td rowspan=1 colspan=1>1-2</td><td rowspan=1 colspan=1>19. Activation</td><td rowspan=1 colspan=1>3.47</td></tr><tr><td rowspan=1 colspan=1>1-3</td><td rowspan=1 colspan=1> 04. Initial learning rate * O5. Initial learning rate (Detail 1)</td><td rowspan=1 colspan=1>3.12</td></tr><tr><td rowspan=1 colspan=1>1-4</td><td rowspan=1 colspan=1>19. Activation * 24. Batch norm</td><td rowspan=1 colspan=1>-2.55</td></tr><tr><td rowspan=1 colspan=1>1-5</td><td rowspan=1 colspan=1>04. Initial learning rate</td><td rowspan=1 colspan=1>-2.34</td></tr><tr><td rowspan=1 colspan=1>1-6</td><td rowspan=1 colspan=1>28. Weight decay</td><td rowspan=1 colspan=1>-1.90</td></tr><tr><td rowspan=1 colspan=1>1-7</td><td rowspan=1 colspan=1>24. Batch norm * 28. Weight decay</td><td rowspan=1 colspan=1>1.79</td></tr><tr><td rowspan=1 colspan=1>1-8</td><td rowspan=1 colspan=1> 34. Optnet * 35. Share gradInput * 52. Dummy13</td><td rowspan=1 colspan=1>1.54</td></tr><tr><td rowspan=1 colspan=1>2-1</td><td rowspan=1 colspan=1>03.Optimization method</td><td rowspan=1 colspan=1>-4.22</td></tr><tr><td rowspan=1 colspan=1>2-2</td><td rowspan=1 colspan=1>03.Optimization method * 10. Use momentum</td><td rowspan=1 colspan=1>-3.02</td></tr><tr><td rowspan=1 colspan=1>2-3</td><td rowspan=1 colspan=1>15.Resblock first activation</td><td rowspan=1 colspan=1>2.80</td></tr><tr><td rowspan=1 colspan=1>2-4</td><td rowspan=1 colspan=1>10.Use momentum</td><td rowspan=1 colspan=1>2.19</td></tr><tr><td rowspan=1 colspan=1>2-5</td><td rowspan=1 colspan=1>15.Resblock first activation * 17. Resblock third activation</td><td rowspan=1 colspan=1>1.68</td></tr><tr><td rowspan=1 colspan=1>2-6</td><td rowspan=1 colspan=1>01.Good initialization</td><td rowspan=1 colspan=1>-1.26</td></tr><tr><td rowspan=1 colspan=1>2-7</td><td rowspan=1 colspan=1>01.Good initialization *10. Use momentum</td><td rowspan=1 colspan=1>-1.12</td></tr><tr><td rowspan=1 colspan=1>2-8</td><td rowspan=1 colspan=1>01.Good initialization * O3.Optimization method</td><td rowspan=1 colspan=1>0.67</td></tr><tr><td rowspan=1 colspan=1>3-1</td><td rowspan=1 colspan=1>29.Weight decayparameter</td><td rowspan=1 colspan=1>-0.49</td></tr><tr><td rowspan=1 colspan=1>3-2</td><td rowspan=1 colspan=1>28.Weight decay</td><td rowspan=1 colspan=1>-0.26</td></tr><tr><td rowspan=1 colspan=1>3-3</td><td rowspan=1 colspan=1>06. Initial learning rate (Detail 3) * 28. Weight decay</td><td rowspan=1 colspan=1>0.23</td></tr><tr><td rowspan=1 colspan=1>3-4</td><td rowspan=1 colspan=1>25. Batch norm tuning</td><td rowspan=1 colspan=1>0.21</td></tr><tr><td rowspan=1 colspan=1>3-5</td><td rowspan=1 colspan=1>28.Weight decay * 29. Weight decay parameter</td><td rowspan=1 colspan=1>0.20</td></tr></table>
431
+
432
+ ![](images/48480742a7e3047f910b83704d39f33d4d3f86debfcc321e9755db858d6028be.jpg)
433
+ Figure 4: Average test error drops.
434
+
435
+ ![](images/4ceac4a6b0b83a17cb4882f61038396f89c230f4cadd13e30482e53afbc844bf.jpg)
436
+ Figure 5: Optimization time comparison
437
+
438
+ Table 3: Stable ranges for parameters in Lasso
439
+
440
+ <table><tr><td rowspan=1 colspan=1>Parameter</td><td rowspan=1 colspan=1>Stage 1</td><td rowspan=1 colspan=1>Stage 2</td><td rowspan=1 colspan=1>Stage 3</td></tr><tr><td rowspan=1 colspan=1>入</td><td rowspan=1 colspan=1>[0.01,4.5]</td><td rowspan=1 colspan=1>[0.1,2.5]</td><td rowspan=1 colspan=1>[0.5, 1.1]</td></tr><tr><td rowspan=1 colspan=1>#Samples</td><td rowspan=1 colspan=1>≥250</td><td rowspan=1 colspan=1>≥180</td><td rowspan=1 colspan=1>≥150</td></tr></table>
441
+
442
+ # C.3 GENERALIZING FROM SMALL NETWORKS TO BIG NETWORKS
443
+
444
+ In our experiments, Harmonica first runs on a small network to extract important features and then uses these features to do fine tuning on a big network. Since Harmonica finds significantly better solutions, it is natural to ask whether other algorithms can also exploit this strategy to improve performance.
445
+
446
+ Unfortunately, it seems that all the other algorithms do not naturally support feature extraction from a small network. For Bayesian Optimization techniques, small networks and large networks have different optimization spaces. Therefore without some modification, Spearmint cannot use information from the small network to update the prior distribution for the large network.
447
+
448
+ Random-search-based techniques are able to find configurations with low test error on the small network, which might be good candidates for the large network. However, based on our simulation, good configurations of hyperparameters from random search do not generalize from small networks to large networks. This is in contrast to important features in our (Fourier) space, which do seem to generalize.
449
+
450
+ To test the latter observation using Cifar-10 dataset, we first spent 7 GPU days on 8 layer network to find top 10 configurations among 300 random selected configurations. Then we apply these 10 configurations, as well as 90 locally perturbed configurations (each of them is obtained by switching one random option from one top-10 configuration), so in total 100 “promising” configurations, to the large 56 layer network. This simulation takes 27 GPU days, but the best test error we obtained is only $1 1 . 1 \%$ , even worse than purely random search. Since Hyperband is essentially a fast version of Random Search, it also does not support feature extraction.
451
+
452
+ Hence, being able to extract important features from small networks seems empirically to be a unique feature of Harmonica.
453
+
454
+ # C.4 EXPERIMENTS WITH SYNTHETIC FUNCTIONS
455
+
456
+ Our second experiment considers a synthetic hierarchically bounded function $h ( x )$ . We run Harmonica with 100 samples, 5 features selected per stage, for 3 stages, using degree 3 features. See Figure 5 for optimization time comparison. We only plot the optimization time for Spearmint when $n = 6 0$ , which takes more than one day for 500 samples. Harmonica is several magnitudes faster than Spearmint. In Figure 6, we show that Harmonica is able to estimate the hidden function with error proportional to the noise level.
457
+
458
+ The synthetic function $h ( x ) \in \{ - 1 , + 1 \} ^ { n } \to \mathbb { R }$ is defined as follows. $h ( x )$ has three stages, and in $i$ -th stage $( i = 0 , 1 , 2 )$ , it has $3 2 ^ { i }$ sparse vectors $s _ { i , j }$ for $j = 0 , \cdots , 3 2 ^ { i } - 1$ . Each $s _ { i , j }$ contains 5 pairs of weight $w _ { i , j } ^ { k }$ and feature $f _ { i , j } ^ { k }$ for $k = 1 , \cdots 5$ , where $w _ { i , j } ^ { k } \in [ 1 0 + 1 0 ^ { - i } , 1 0 ^ { \top } + 1 0 ^ { 2 - i } ]$ . and $f _ { i , j } ^ { k }$ is a monomial on $x$ with degree at most 3. Therefore, for input $x \in \mathbb { R } ^ { n }$ , the sparse vector $\begin{array} { r } { s _ { i , j } ( x ) = \sum _ { k = 1 } ^ { 5 } w _ { i , j } ^ { k } f _ { i , j } ^ { k } ( x ) } \end{array}$ . Since $x \in \{ - 1 , + 1 \} ^ { n }$ , $f _ { i , j } ^ { k } ( x )$ is binary. Therefore, $\{ f _ { i , j } ^ { k } ( x ) \} _ { k = 1 } ^ { 5 }$ contains 5 binaries and represents a integer in $\left[ 0 , 3 1 \right]$ , denoted as $c _ { i , j } ( \boldsymbol { x } )$ . Let $h ( x ) = s _ { 1 , 1 } ( x ) +$ $s _ { 2 , c _ { 1 , 1 } ( x ) } ( x ) + s _ { 3 , c _ { 1 , 1 } ( x ) * 3 2 + c _ { 2 , c _ { 1 , 1 } ( x ) } ( x ) } ( x ) + \xi$ , where $\xi$ is the noise uniformly sampled from $[ - A , A ]$ ( $\boldsymbol { \cdot } \boldsymbol { A }$ is the noise level). In other words, in every stage $i$ we will get a sparse vector $s _ { i , j }$ . Based on $s _ { i , j } ( x )$ , we pick a the next sparse function and proceed to the next stage.
459
+
460
+ ![](images/254dee2622dc7cda4ac87acbbbbba38a06c9d97217697a782fcc87d4a610c65d.jpg)
461
+ Figure 6: The estimation error of Harmonica is linear in noise level.
md/train/H1zxjsCqKQ/H1zxjsCqKQ.md ADDED
@@ -0,0 +1,531 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GRADIENT-BASED LEARNING FOR THE $F$ -MEASURE AND OTHER PERFORMANCE METRICS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Many important classification performance metrics, e.g. the $F$ -measure, are nondifferentiable and non-decomposable, and are thus unfriendly to the gradient descent algorithm. Consequently, despite their popularity as evaluation metrics, these metrics are rarely optimized as training objectives in neural network community. In this paper, we propose an empirical utility maximization scheme with provable learning guarantees to address the non-differentiability of these metrics. We then derive a strongly consistent gradient estimator to handle nondecomposability. These innovations enable end-to-end optimization of these performance metrics with the same computational complexity as optimizing a decomposable and differentiable metric, e.g. the cross-entropy loss.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Different classification performance metrics are capable of revealing different aspects of a classifier’s behavior. For example, the $F$ -measure (Van Rijsbergen (1974)), compared to performance metrics such as accuracy, is better at evaluating a classifier’s performance when it encounters a sample belonging to a class that occurs with low frequency. Ideally, we can acquire a classifier with very tailored behavior by optimizing the classifier with respect to a carefully chosen performance metric. Unfortunately, many performance metrics, e.g. the $F$ -measure, are non-differentiable and non-decomposable, which renders it very difficult to optimize neural network classifiers with these metrics as training objective.
12
+
13
+ In this paper, we propose a method that enables gradient-based learning for these performance metrics. Our contributions are the following:
14
+
15
+ • We propose a learning algorithm based on empirical utility maximization for a class of performance metrics and prove its generalization and consistency.
16
+ We propose a strongly consistent gradient estimator that enables efficient gradient-based maximization of empirical utility.
17
+ We demonstrate experimentally that the binary $F _ { 1 }$ score of neural network classifiers can be efficiently optimized on datasets of decent scale and complexity.
18
+
19
+ We organize this paper as the following. In Section 2, we will sketch our method for the binary $F _ { 1 }$ score to provide an overview. In Section 3, we will present our method in its general form. We review related work in Section 4 and provide experiment results in Section 5.
20
+
21
+ # 2 GRADIENT-BASED LEARNING FOR THE BINARY $F _ { 1 }$ SCORE
22
+
23
+ # 2.1 PROBABILISTIC CLASSIFIER
24
+
25
+ Given a feature vector $\pmb { x } \in \pmb { \chi } \subset \mathbb { R } ^ { N }$ , a probabilistic classifier $h$ first infers a posterior $p ( \cdot | x )$ over a discrete output space $\mathcal { V }$ and then samples its output from the posterior, i.e. $h ( \pmb { x } ) \sim p ( \cdot | \pmb { x } )$ . In practice, $p ( \cdot | x )$ is typically the output of a neural network with softmax layer on its top.When the posterior is parameterized, e.g. being implemented as a neural network, we denote it as $\bar { p } _ { \theta } ( \cdot | { \boldsymbol { x } } )$ and the corresponding probabilistic classifier as $h _ { \theta }$ .
26
+
27
+ Given a posterior $p ( \cdot | x )$ , a deterministic classifier can result from the inference rule $h ( { \pmb x } ) \ =$ argm $\mathbf { a x } _ { y \in \mathcal { y } } p ( y | \mathbf { x } )$ .The difference between probabilistic and deterministic inference rules is negligible when the posterior is very concentrated. Although deterministic classifiers are more popular in the literature, in this paper we only consider probabilistic classifiers and leave it as future work to investigate the case where a probabilistic classifier is replaced by a deterministic one.
28
+
29
+ # 2.2 $F$ -MEASURE
30
+
31
+ Consider the case of binary classification, where $\mathcal { V } = \{ 0 , 1 \}$ with 1 and 0 respectively corresponding to the positive and negative class. Given a dataset $D = \{ ( { \dot { \mathbf { x } } } _ { 1 } , y _ { 1 } ) , . . . , ( { \mathbf { x } } _ { n } , y _ { n } ) \}$ consisting of $n$ i.i.d. pairs of feature vector and ground truth, let $\hat { y } _ { i }$ denote the label predicted by a classifier $h$ given $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ (not necessarily deterministically). Let $\hat { \pmb { y } } = ( \hat { y } _ { 1 } , . . . , \hat { y } _ { n } )$ and $\pmb { y } = ( y _ { 1 } , . . . , y _ { n } )$ . Then the truepositive, false-positive, false-negative and true-negative rate corresponding to $\hat { y }$ and $\textbf { { y } }$ are defined as
32
+
33
+ $$
34
+ \begin{array} { l l } { { \displaystyle { \mathrm { t p } } ( \hat { y } , y ) : = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \mathbb { I } \left( \hat { y } _ { i } = 1 \wedge y _ { i } = 1 \right) } } & { { \quad { \mathrm { f p } } ( \hat { y } , y ) : = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \mathbb { I } \left( \hat { y } _ { i } = 1 \wedge y _ { i } = 0 \right) } } \\ { { \displaystyle { \mathrm { f n } } ( \hat { y } , y ) : = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \mathbb { I } \left( \hat { y } _ { i } = 0 \wedge y _ { i } = 1 \right) } } & { { \quad { \mathrm { t n } } ( \hat { y } , y ) : = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \mathbb { I } \left( \hat { y } _ { i } = 0 \wedge y _ { i } = 0 \right) } } \end{array}
35
+ $$
36
+
37
+ where $\mathbb { I }$ denotes indicator function. The precision and recall are defined as
38
+
39
+ $$
40
+ \mathrm { p r e c i s i o n } ( { \pmb { \hat { y } } } , { \pmb { y } } ) = \frac { \mathrm { t p } ( { \pmb { \hat { y } } } , { \pmb { y } } ) } { \mathrm { t p } ( { \pmb { \hat { y } } } , { \pmb { y } } ) + \mathrm { f p } ( { \pmb { \hat { y } } } , { \pmb { y } } ) } \qquad \mathrm { r e c a l l } ( { \pmb { \hat { y } } } , { \pmb { y } } ) = \frac { \mathrm { t p } ( { \pmb { \hat { y } } } , { \pmb { y } } ) } { p _ { D } ^ { + } }
41
+ $$
42
+
43
+ where $\begin{array} { r } { p _ { D } ^ { + } : = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \mathbb { I } ( y _ { i } = 1 ) } \end{array}$ denotes the proportion of samples in $D$ that belong to positive class. The binary $F$ -measure is defined as (Van Rijsbergen (1974)):
44
+
45
+ $$
46
+ F _ { \beta } ( { \pmb \hat { y } } , { \pmb y } ) = ( 1 + \beta ^ { 2 } ) \cdot \frac { \mathrm { p r e c i s i o n } ( { \pmb \hat { y } } , { \pmb y } ) \cdot \mathrm { r e c a l l } ( { \pmb \hat { y } } , { \pmb y } ) } { \beta \cdot \mathrm { p r e c i s i o n } ( { \pmb \hat { y } } , { \pmb y } ) + \mathrm { r e c a l l } ( { \pmb \hat { y } } , { \pmb y } ) } \qquad \beta > 0
47
+ $$
48
+
49
+ or equivalently,
50
+
51
+ $$
52
+ F _ { \beta } ( { \pmb \hat { y } } , { \pmb y } ) = ( 1 + \beta ^ { 2 } ) \cdot \frac { p _ { D } ^ { + } - \mathrm { f n } ( { \pmb \hat { y } } , { \pmb y } ) } { ( 1 + \beta ^ { 2 } ) p _ { D } ^ { + } - \mathrm { f n } ( { \pmb \hat { y } } , { \pmb y } ) + \mathrm { f p } ( { \pmb \hat { y } } , { \pmb y } ) } \qquad \beta > 0
53
+ $$
54
+
55
+ which is more convenient for our purpose.
56
+
57
+ We will refer to $F _ { \beta } ( \hat { \pmb y } , \pmb y )$ as the data-dependent binary $F _ { \beta }$ -measure because it is evaluated on a specific set of data with pairs of ground truth and prediction vectors. $F _ { \beta }$ is non-differentiable because it is a composition of indicator functions. Nor does it decompose over samples in $D$ . More precisely, we are not aware of any function $f _ { \beta }$ that only depends on per sample ground-truth and prediction such that
58
+
59
+ $$
60
+ F _ { \beta } ( \hat { \pmb y } , \pmb y ) = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } f _ { \beta } ( \hat { y } _ { i } , y _ { i } )
61
+ $$
62
+
63
+ In the following we propose an empirical utility maximization scheme for optimizing the $F _ { \beta }$ - measure of probabilistic classifiers. For ease of exposition, in this section we focus on the binary $F _ { 1 }$ -measure, a.k.a. the binary $F _ { 1 }$ score. In Section 3, we will extend the method presented in this section to a family of non-decomposable and non-differentiable performance metrics, including $F _ { \beta }$ - measure for multi-class classification.
64
+
65
+ # 2.3 GRADIENT-BASED LEARNING FOR THE BINARY $F _ { 1 }$ SCORE
66
+
67
+ We consider a parameterized binary probabilistic classifier $h _ { \theta }$ . By linearity of expectation and the i.i.d. assumption,
68
+
69
+ $$
70
+ \mathbb { E } _ { \pmb { \hat { y } } , \pmb { y } } [ \mathrm { f p } ( \pmb { \hat { y } } , \pmb { y } ) ] = \mathbb { P } ( \hat { \mathbf { y } } = 1 \wedge \mathbf { y } = 0 )
71
+ $$
72
+
73
+ where the expectation is taken over all datasets with a fixed size $n$ and all possible predictions of $h _ { \theta }$ . Similarly, $\mathbb { E } _ { \pmb { \hat { y } } , \pmb { y } } [ \mathrm { f n } ( \pmb { \hat { y } } , \pmb { y } ) ] = \mathbb { P } ( \hat { \mathbf { y } } = 0 \land \mathbf { y } = 1 )$ . Let $\overline { { \mathrm { f n } } } ( h _ { \theta } ) : = \mathbb { E } _ { \hat { \pmb { y } } , \pmb { y } } [ \mathrm { f n } ( \hat { \pmb { y } } , \pmb { y } ) ]$ and ${ \overline { { \operatorname { f p } } } } ( h _ { \theta } ) : =$ $\mathbb { E } _ { \hat { \pmb { y } } , \pmb { y } } [ \mathbf { f p } ( \hat { \pmb { y } } , \pmb { y } ) ]$ . It follows from the law of large number that
74
+
75
+ $$
76
+ \operatorname * { l i m } _ { | D | \infty } \mathrm { f n } ( { \hat { y } } , y ) = \overline { { \mathrm { f n } } } ( h _ { \theta } ) \qquad \operatorname * { l i m } _ { | D | \infty } \mathrm { f p } ( { \hat { y } } , y ) = \overline { { \mathrm { f p } } } ( h _ { \theta } )
77
+ $$
78
+
79
+ with probability 1, where $| D |$ denotes the size of dataset $D$ . Thus on sufficiently large datasets,
80
+
81
+ $$
82
+ \mathrm { f n } ( { \pmb { \hat { y } } } , { \pmb { y } } ) \approx \overline { { \mathrm { f n } } } ( h _ { \theta } ) \qquad \mathrm { f p } ( { \pmb { \hat { y } } } , { \pmb { y } } ) \approx \overline { { \mathrm { f p } } } ( h _ { \theta } )
83
+ $$
84
+
85
+ With these approximate identities, we have the following approximation of $F _ { 1 } ( \hat { \pmb y } , \pmb y )$ :
86
+
87
+ $$
88
+ F _ { 1 } ( { \hat { y } } , y ) = 2 \cdot { \frac { p _ { D } ^ { + } - \operatorname { f n } ( { \hat { y } } , y ) } { 2 p _ { D } ^ { + } - \operatorname { f n } ( { \hat { y } } , y ) + \operatorname { f p } ( { \hat { y } } , y ) } } \approx 2 \cdot { \frac { p _ { D } ^ { + } - { \overline { { \operatorname { f n } } } } ( h _ { \theta } ) } { 2 p _ { D } ^ { + } - { \overline { { \operatorname { f n } } } } ( h _ { \theta } ) + { \overline { { \operatorname { f p } } } } ( h _ { \theta } ) } } : = { \bar { F } } _ { 1 } ( h _ { \theta } )
89
+ $$
90
+
91
+ which implies that the $F _ { 1 }$ score of any predictions of $h _ { \theta }$ on any sufficiently large dataset is close to $\bar { F } _ { 1 } ( h _ { \theta } )$ . We call $\bar { F } _ { 1 } ( h _ { \theta } )$ the expected utility of the $F _ { 1 }$ score and will state the precise meaning of $F _ { 1 } ( \hat { \pmb { y } } , \pmb { y } ) \approx \bar { F } _ { 1 } ( h _ { \theta } )$ in Section 3. The key point is that we can optimize $\bar { F } _ { 1 } ( h _ { \theta } )$ instead of $F _ { 1 } ( \hat { \pmb y } , \pmb y )$ if we are interested in the $F _ { 1 }$ score of $h _ { \theta }$ on sufficiently large datasets. However, $\overline { { \mathbf { f } \mathbf { n } } } ( h _ { \theta } )$ and ${ \overline { { \mathbf { f p } } } } ( h _ { \theta } )$ are unknown because they are expectations taken over data distribution (and the classifier’s posterior). Consequently, we have to estimate $\overline { { \mathbf { f } \mathbf { n } } } ( h _ { \theta } )$ and ${ \overline { { \mathbf { f p } } } } ( h _ { \theta } )$ by sampling from data distribution in order to estimate $\bar { F } _ { 1 } ( \dot { h } _ { \theta } )$ , as the following.
92
+
93
+ Let $p ^ { + } : = \mathbb { P } ( \mathbf { y } = 1 )$ denote the probability that a positive sample occurs, which can be estimated by the frequency of positive samples in a training set $D$ . Let $\begin{array} { r } { n ^ { + } : = \sum _ { ( \pmb { x } , y ) \in D } \mathbb { I } ( y = 1 ) } \end{array}$ denote the number of positive samples in the training set. Assume that the data distribution admits a density function (i.e. the data distribution is absolutely continuous w.r.t. the Lebesgue measure), and denote its density function by $p$ . We have the following unbiased estimator of $\overline { { \mathbf { f } \mathbf { n } } } ( \breve { h } _ { \theta } )$ :
94
+
95
+ $$
96
+ \begin{array} { r l } { \mathbf { f i } ( h _ { \theta } ) = \mathbb { P } ( \hat { \mathbf { y } } = \boldsymbol { 0 } \wedge \mathbf { y } = \boldsymbol { 1 } ) } \\ & { = \int _ { \boldsymbol { X } } \mathbb { P } ( h _ { \theta } ( \boldsymbol { x } ) = 0 ) p ( \boldsymbol { x } , \boldsymbol { 1 } ) \mathrm { d } \boldsymbol { x } } \\ & { = \int _ { \boldsymbol { X } } p \boldsymbol { \theta } ( \boldsymbol { 0 } | \boldsymbol { x } ) p ( \boldsymbol { x } | \boldsymbol { 1 } ) p ^ { + } \mathrm { d } \boldsymbol { x } } \\ & { = p ^ { + } \int _ { \boldsymbol { X } } p _ { \theta } ( \boldsymbol { 0 } | \boldsymbol { x } ) p ( \boldsymbol { x } | \boldsymbol { 1 } ) \mathrm { d } \boldsymbol { x } } \\ & { = p ^ { + } \mathbb { E } _ { \boldsymbol { x } \sim p ( \cdot \vert \boldsymbol { 1 } ) } \mathrm { [ } p \boldsymbol { \theta } ( \boldsymbol { 0 } | \boldsymbol { x } ) \big ] } \\ & { \approx \frac { p ^ { + } } { n ^ { + } } \sum _ { i = 1 } ^ { n ^ { + } } p _ { \theta } ( 0 | \mathbf { x } _ { i } ^ { + } ) : = \hat { \Pi } _ { D } ( h _ { \theta } ) } \end{array}
97
+ $$
98
+
99
+ where ${ \pmb x } _ { 1 } ^ { + } , . . . , { \pmb x } _ { n ^ { + } } ^ { + }$ .., x+n+ a re the feature vectors of samples belonging to the positive class in trainingset $D$ . Similarly,
100
+
101
+ $$
102
+ { \overline { { \mathsf { f p } } } } ( h _ { \theta } ) = \mathbb { P } \left( { \hat { \mathbf { y } } } = 1 \wedge \mathbf { y } = 0 \right) \approx { \frac { p ^ { - } } { n ^ { - } } } \sum _ { i = 1 } ^ { n ^ { - } } p _ { \theta } ( 1 | x _ { i } ^ { - } ) : = { \widehat { \mathbf { f } } } { \widehat { \mathbf { p } } } _ { D } ( h _ { \theta } )
103
+ $$
104
+
105
+ where $\begin{array} { r } { p ^ { - } : = \mathbb { P } ( \mathbf { y } = 0 ) , n ^ { - } : = \sum _ { ( \pmb { x } , \pmb { y } ) \in D } \mathbb { I } ( \pmb { y } = 0 ) . } \end{array}$ , and $\mathbf { \mathfrak { x } } _ { 1 } ^ { - } , . . . , \mathbf { \mathfrak { x } } _ { n } ^ { - }$ are the feature vectors of samples in $D$ belonging to the negative class. Thus $\bar { F } _ { 1 } ( h _ { \theta } )$ can be estimated as the following:
106
+
107
+ $$
108
+ \bar { F } _ { 1 } ( h _ { \theta } ) = 2 \cdot \frac { p ^ { + } - \overline { { \mathrm { f n } } } ( h _ { \theta } ) } { 2 p ^ { + } - \overline { { \mathrm { f n } } } ( h _ { \theta } ) + \overline { { \mathrm { f p } } } ( h _ { \theta } ) } \approx 2 \cdot \frac { p ^ { + } - \widehat { \mathrm { f n } } _ { D } ( h _ { \theta } ) } { 2 p ^ { + } - \widehat { \mathrm { f n } } _ { D } ( h _ { \theta } ) + \widehat { \mathrm { f p } } _ { D } ( h _ { \theta } ) } : = \hat { F } _ { D } ( h _ { \theta } )
109
+ $$
110
+
111
+ We will state the precise meaning of $\bar { F } _ { 1 } ( h _ { \theta } ) \approx \hat { F } _ { D } ( h _ { \theta } )$ in Section 3. Interestingly, although $\mathrm { f n } ( \hat { \pmb y } , \pmb y )$ and fp $( \hat { \pmb y } , \pmb y )$ are not differentiable, the estimators of their expectations, $\widehat { \mathrm { f n } } _ { D } ( h _ { \theta } )$ and ${ \widehat { \mathrm { f p } } } _ { D } ( h _ { \theta } )$ , are differentiable w.r.t. $\theta$ if $p _ { \theta }$ is differentiable. Because $\hat { F } _ { D } ( h _ { \theta } )$ is differentiable w.r.t. $\widehat { \mathrm { f n } } ( h _ { \theta } )$ and $\widehat { \mathrm { f p } } ( h _ { \theta } ) , \nabla _ { \theta } \widehat { F } _ { D } ( h _ { \theta } )$ can be computed by chain rule. Consequently, gradient descent can be applied to optimize $\hat { F } _ { D } ( \theta )$ .
112
+
113
+ We call $\hat { F } _ { D } ( \theta )$ the empirical utility of the expected utility $\bar { F } _ { 1 } ( h _ { \theta } )$ . They correspond to empirical and expected risk in the classical empirical risk minimization principle of statistical learning theory (Vapnik (1992)). We use the term “empirical utility maximization” because we would like to maximize, instead of minimize these performance metrics. There are two fundamental questions for every empirical risk minimization style learning algorithm, as the number of samples increases:
114
+
115
+ • Generalization. Given $h _ { \theta }$ , does $\hat { F } _ { D } ( h _ { \theta } ) \bar { F } _ { 1 } ( h _ { \theta } )$ as $| D | \to \infty ?$ • Consistency. Does argma $\mathrm { x } _ { \theta } \hat { F } _ { D } ( h _ { \theta } ) \mathrm { a r g m a x } _ { \theta } \bar { F } _ { 1 } ( h _ { \theta } )$ as $| D | \to \infty !$
116
+
117
+ We will address these two questions at the end of Section 3. For the moment let us consider a practical issue: how to maximize empirical utility $\bar { F } _ { D } ( h _ { \theta } )$ efficiently with gradient descent?
118
+
119
+ # 2.4 GRADIENT ESTIMATOR
120
+
121
+ In order for the approximation in Eq. 6 to be accurate, $| D |$ has to be sufficiently large. In order to optimize $\hat { F } _ { D } ( h _ { \theta } )$ efficiently via minibatch gradient descent, $\nabla _ { \theta } \hat { F } _ { D } ( h _ { \theta } )$ has to be estimated by $\nabla _ { \theta } \hat { F } _ { B } ( h _ { \theta } )$ , where $B \subset D$ is a mini-batch, such that $\mathbb { E } _ { B } [ \nabla _ { \theta } \hat { F } _ { B } ( h _ { \theta } ) ] \ : = \ : \nabla _ { \theta } \hat { F } _ { D } ( h _ { \theta } )$ . Suppose $\hat { F } _ { D } ( h _ { \theta } )$ is decomposable, i.e. there is a per-sample loss function $\hat { f }$ such that $\hat { F } _ { D } ( h _ { \theta } ) \ =$ $\begin{array} { r } { \frac { 1 } { | D | } \sum _ { ( { \pmb x } , y ) \in D } \hat { f } ( p _ { \theta } ( { \pmb x } ) , y ) } \end{array}$ , then it simply follows from linearity of differentiation and expectation that the requirement is satisfied. However, as $\hat { F } _ { D } ( h _ { \theta } )$ is non-decomposable, it becomes unlikely that $\nabla _ { \theta } \hat { F } _ { B } ( h _ { \theta } )$ is an unbiased estimator of $\nabla _ { \theta } \hat { F } _ { D } ( h _ { \theta } )$ . Fortunately, as a consequence of Theorem 1, $\nabla _ { \theta } \hat { F } _ { B } ( h _ { \theta } )$ is a strongly consistent estimator of $\nabla _ { \theta } \hat { F } _ { D } ( h _ { \theta } )$ when $| D |$ is sufficiently large. More precisely,
122
+
123
+ $$
124
+ \mathbb { P } ( \operatorname* { l i m } _ { | B | \infty } \nabla _ { \theta } \hat { F } _ { B } ( h _ { \theta } ) = \operatorname* { l i m } _ { | D | \infty } \nabla _ { \theta } \hat { F } _ { D } ( h _ { \theta } ) ) = 1
125
+ $$
126
+
127
+ Thus $\nabla _ { \theta } \hat { F } _ { B } ( h _ { \theta } )$ is almost as good as an unbiased estimator. More interestingly, the error incurred by estimating $\nabla _ { \theta } \hat { F } _ { D } ( h _ { \theta } )$ with $\nabla _ { \theta } \hat { F } _ { B } ( h _ { \theta } )$ can be further controlled. In the following we omit the dependence on $h _ { \theta }$ for brevity. Let $\phi _ { D } : = ( \widehat { \mathrm { f n } } _ { D } ( h _ { \theta } ) , \widehat { \mathrm { f p } } _ { D } ( h _ { \theta } ) ) \in \mathbb { R } ^ { 2 }$ and $\phi _ { B } : = ( \widehat { \mathrm { f n } } _ { B } \widetilde ( h _ { \theta } ) , \widehat { \mathrm { f p } } _ { B } ( h _ { \theta } ) ) \in$ $\mathbb { R } ^ { 2 }$ . Let $\widehat { J } _ { D }$ and ${ \widehat { \pmb J } } _ { B }$ denotes the Jacobian of $\widehat { \phi } _ { D }$ and $\widehat { \phi } _ { B }$ w.r.t. $\theta$ . Let $| \cdot |$ denote a vector norm and $| | \cdot | |$ denote the matrix norm induced by it. By chain rule,
128
+
129
+ $$
130
+ \begin{array} { r l } & { \nabla _ { \boldsymbol { \theta } } \hat { F } _ { B } = \nabla _ { \boldsymbol { \phi } _ { B } } \hat { F } _ { B } \hat { \boldsymbol { J } } _ { B } } \\ & { \qquad = \left( \nabla _ { \boldsymbol { \phi } _ { D } } \hat { F } _ { D } + \boldsymbol { \epsilon } \right) \left( \widehat { \boldsymbol { J } } _ { D } + \boldsymbol { \varepsilon } \right) } \\ & { \qquad = \nabla _ { \boldsymbol { \phi } _ { D } } \hat { F } _ { D } \widehat { \boldsymbol { J } } _ { D } + \nabla _ { \boldsymbol { \phi } _ { D } } \hat { F } _ { D } \pm \boldsymbol { \varepsilon } + \boldsymbol { \epsilon } \widehat { \boldsymbol { J } } _ { D } + \boldsymbol { \epsilon } \pmb { \varepsilon } } \end{array}
131
+ $$
132
+
133
+ where $\nabla _ { \phi _ { D } } \hat { F } _ { D } \cdot \hat { J } _ { D }$ is the true gradient and $\boldsymbol { \epsilon } \cdot \boldsymbol { \varepsilon }$ is negligible. The error $\pmb { \mathcal { E } } = \widehat { J } _ { B } ( h _ { \theta } ) - \widehat { J } _ { D } ( h _ { \theta } )$ is intrinsic in the sense that it results immediately from estimating $\nabla _ { \boldsymbol { \theta } } \widehat { \mathrm { f n } } _ { D } ( h _ { \boldsymbol { \theta } } )$ and $\nabla _ { \boldsymbol { \theta } } \widehat { \mathrm { f p } } _ { D } ( h _ { \boldsymbol { \theta } } )$ with $\nabla _ { \theta } \widehat { \mathrm { f n } } _ { B } ( h _ { \theta } )$ and $\nabla _ { \boldsymbol { \theta } } \widehat { \mathrm { f p } } _ { B } ( h _ { \boldsymbol { \theta } } )$ and it is always present in mini-batch gradient descent because $\mathbb { E } [ \nabla _ { \theta } \widehat { \mathbf { f } } _ { \mathbf { \Pi } _ { B } } ( h _ { \theta } ) ] \ : = \ : \nabla _ { \theta } \widehat { \mathbf { f } } \widehat { \mathbf { n } } _ { D } ( h _ { \theta } )$ and $\mathbb { E } [ \nabla _ { \theta } \widehat { \mathbf { f p } } _ { B } ( h _ { \theta } ) ] = \nabla _ { \theta } \widehat { \mathbf { f p } } _ { D } ( h _ { \theta } )$ . However, we can control the error $\epsilon \cdot \widehat { J } _ { D }$ because $| \epsilon \cdot \widehat { J } | \leq | | \widehat { J } | | \cdot | \epsilon |$ and we can control $| | \widehat { J } | |$ by limiting $| \theta |$ and the norm of intermediate activations when $p _ { \theta }$ is a neural network (He et al. (2015)). Despite these technicalities, the trick is very easy to implement: batch normalization (Ioffe & Szegedy (2015)) and weight decay will suffice. These are summarized in Algorithm 1.
134
+
135
+ # Algorithm 1 Gradient-based learning for the binary $F _ { 1 }$ score
136
+
137
+ Require: classifier $h _ { \theta }$ , batch size $b$ , dataset $D$ , learning rate $\alpha$ , weight decay strength $\lambda$ $\begin{array} { r } { \hat { p ^ { + } } \frac { 1 } { | D | } \sum _ { ( \pmb { x } , y ) \in D } \mathbb { I } ( y = 1 ) } \end{array}$ $\begin{array} { r } { p ^ { - } \frac { 1 } { | D | } \sum _ { ( \pmb { x } , y ) \in D } \mathbb { I } ( y = 0 ) } \end{array}$ while terminating criterion not satisfied do Sample $B _ { + } \doteq \{ ( \pmb { x } _ { 1 } ^ { + } , 1 ) , . . . , ( \pmb { x } _ { b } ^ { + } , 1 ) \}$ from $D$ Sample $B _ { - } = \{ ( \pmb { x } _ { 1 } ^ { - } , 0 ) , . . . , ( \pmb { x } _ { b } ^ { - } , 0 ) \}$ from $D$ $\begin{array} { r } { \mathrm { f n } \frac { p ^ { + } } { b } \sum _ { i = 1 } ^ { b } p _ { \theta } ( 0 | \pmb { x } _ { 1 } ^ { + } ) } \end{array}$ p b Pbi=1 pθ (1|x−1 ) δ ← ∇θ F1(fn, fp) − λ · |θ| θ ← θ + α · δ end while
138
+
139
+ The binary $F$ -measure in fact belongs to a class of performance metrics that are well behaved functions of the confusion matrix. In this section, we propose a gradient-based learning algorithm that extends the approach illustrated in previous section to this class of performance metrics. We state theorems concerning the generalization and consistency of the proposed algorithm as well. We defer all proofs to appendix. We begin with a specification of this class of performance metrics, which relies on the definition of confusion matrix:
140
+
141
+ Definition 1. Given a dataset $D = \{ ( { \pmb x } _ { 1 } , y _ { 1 } ) , . . . , ( { \pmb x } _ { n } , y _ { n } ) \}$ , let $\pmb { y } = ( y _ { 1 } , . . . , y _ { n } )$ denote the vector of ground truth and $\hat { \pmb { y } } = ( \hat { y } _ { 1 } , . . . , \hat { y } _ { n } )$ denote a vector of classifier predictions. Then the corresponding data-dependent confusion matrix $C ( \hat { \pmb y } , \pmb y )$ is defined as
142
+
143
+ $$
144
+ \big ( C ( \pmb { \mathscr { y } } , \pmb { y } ) \big ) _ { i j } : = \frac { 1 } { n } \sum _ { k = 1 } ^ { n } \mathbb { I } \left( \hat { y } _ { k } = i \wedge y _ { k } = j \right) \qquad 0 \leq i , j \leq | \pmb { \mathscr { y } } | - 1
145
+ $$
146
+
147
+ In the case of binary classification,
148
+
149
+ $$
150
+ C ( \hat { \pmb y } , \pmb y ) = \left[ \mathrm { t n } ( \hat { \pmb y } , \pmb y ) \ \mathrm { f n } ( \hat { \pmb y } , \pmb y ) \right]
151
+ $$
152
+
153
+ Let $\mathbb { P }$ be a probability measure induced by data distribution and a probabilistic classifier $h _ { \theta }$ over $\mathcal { X } \times \mathcal { Y } \times \mathcal { Y }$ , i.e. triples of feature vector, ground truth and classifier prediction. Let $\bar { C } ( h _ { \theta } )$ be the entry-wise expectation of $C ( \hat { \pmb y } , \pmb y )$ over $\mathbb { P }$ , referred to as the expected confusion matrix. Formally,
154
+
155
+ $$
156
+ \left( { \bar { C } } ( h _ { \theta } ) \right) _ { i j } : = \operatorname { \mathbb { E } } \left[ \mathbb { I } ( h _ { \theta } ( \mathbf { x } ) = i \wedge \mathbf { y } = j ) \right] = \mathbb { P } ( h _ { \theta } ( \mathbf { x } ) = i \wedge \mathbf { y } = j ) \qquad 0 \leq i , j \leq | \mathcal { D } | - 1
157
+ $$
158
+
159
+ As in Section 2, given a training set $D$ , we have the following unbiased estimator of $\bar { C } ( h _ { \theta } )$ , referred to as the empirical confusion matrix:
160
+
161
+ $$
162
+ \left( \hat { C } _ { D } ( h _ { \theta } ) \right) _ { i j } = \frac { p _ { j } } { n _ { j } } \sum _ { k = 1 } ^ { n _ { j } } p _ { \theta } ( i | x _ { k } ^ { j } ) \qquad 0 \le i , j \le | \mathcal { V } | - 1
163
+ $$
164
+
165
+ where $\begin{array} { r } { n _ { j } : = \sum _ { ( \pmb { x } , \pmb { y } ) \in D } \mathbb { I } ( \pmb { y } = j ) , p _ { j } : = \frac { n _ { j } } { | D | } } \end{array}$ , and $\pmb { x } _ { 1 } ^ { j } , . . . , \pmb { x } _ { n _ { j } } ^ { j }$ are the feature vectors of samples that belong to the $j$ -th class. Almost sure convergence follows from the law of large number:
166
+
167
+ $$
168
+ \mathbb { P } ( \operatorname* { l i m } _ { | D | \infty } ( C ( \pmb { \hat { y } } , \pmb { y } ) ) _ { i j } = ( \bar { C } ( h _ { \theta } ) ) _ { i j } ) = 1 \qquad \mathbb { P } ( \operatorname* { l i m } _ { | D | \infty } ( \hat { C } _ { D } ( h _ { \theta } ) ) _ { i j } = ( \bar { C } ( h _ { \theta } ) ) _ { i j } ) = 1
169
+ $$
170
+
171
+ The confusion matrix is well-defined for both single-label and multi-label classification (although these two settings impose different constraints on its entries). Many performance metrics are functions of the confusion matrix. For example, the accuracy of $h _ { \theta }$ is $\textstyle \sum _ { i = 1 } ^ { | y | } { \bar { C } } _ { i i } ( h _ { \theta } )$ . The $F _ { \beta }$ measure for multi-class classification can be defined in term of entries of the confusion matrix as the following. We first define for every class the data-dependent false positive and false negative rate as
172
+
173
+ $$
174
+ \mathrm { f p } _ { i } = \sum _ { j \neq i } C _ { i j } \qquad \mathrm { f n } _ { i } = \sum _ { j \neq i } C _ { j i } \qquad i = 1 , . . . , | { \mathcal { V } } |
175
+ $$
176
+
177
+ where we omit the dependence on $\hat { y }$ and $\textbf { { y } }$ for brevity. The data-dependent macro and micro $F$ - measure (Parambath et al. (2014)) are defined in term of $\mathrm { f p } _ { i }$ and $\mathrm { f n } _ { i }$ as
178
+
179
+ $$
180
+ F _ { \beta } ^ { \mathrm { m a c r o } } = \frac { 1 + \beta ^ { 2 } } { | \mathcal { V } | } \sum _ { i = 1 } ^ { | \mathcal { V } | } \frac { p _ { i } - \mathrm { f n } _ { i } } { ( 1 + \beta ^ { 2 } ) p _ { i } - \mathrm { f n } _ { i } + \mathrm { f p } _ { i } } \qquad \beta > 0
181
+ $$
182
+
183
+ $$
184
+ F _ { \beta } ^ { \mathrm { m i c r o } } = ( 1 + \beta ^ { 2 } ) \cdot \frac { \sum _ { i = 1 } ^ { | \mathcal { V } | } p _ { i } - \sum _ { i = 1 } ^ { | \mathcal { V } | } \mathrm { f n } _ { i } } { ( 1 + \beta ^ { 2 } ) \sum _ { i = 1 } ^ { | \mathcal { V } | } p _ { i } - \sum _ { i = 1 } ^ { | \mathcal { V } | } \mathrm { f n } _ { i } + \sum _ { i = 1 } ^ { | \mathcal { V } | } \mathrm { f p } _ { i } } \qquad \beta > 0
185
+ $$
186
+
187
+ Replacing $C ( \hat { \pmb y } , \pmb y )$ by $\bar { C } ( h _ { \theta } )$ and $\hat { C } ( h _ { \theta } )$ in these definitions will respectively result in the expected and empirical $F$ -measure.
188
+
189
+ We now specify the class of performance metrics that we are interested in, namely the class of well-behaved performance metrics. In the following, we will consider $C ( \hat { \pmb y } , \pmb y )$ , $\bar { C } ( h _ { \theta } )$ and $\hat { C } _ { D } ( h _ { \theta } )$ as vectors of dimension $| y | \times | y |$ and identify a performance metric with a function that maps $| \mathcal { V } | \times | \mathcal { V } |$ -dimensional vectors to real values.
190
+
191
+ Definition 2. We say that a performance metric $F : K \mapsto \mathbb { R } ,$ where $K$ is a compact subset of $\mathbb { R } ^ { | \mathcal { V } | \times | \mathcal { V } | }$ , is well-behaved if $F$ is continuously differentiable on $K$ .
192
+
193
+ Please refer to appendix for a non-exhaustive list of well-behaved performance metrics. Importantly, the binary $F _ { 1 }$ score and the macro and micro $F$ -measure are well-behaved performance metrics (proof deferred to appendix).
194
+
195
+ Given a well behaved performance metric $F$ , its corresponding data-dependent, expected and empirical utility are respectively defined as $F ( C ( \hat { \pmb y } , { \pmb y } ) )$ , $F ( { \bar { C } } ( h _ { \theta } ) )$ and $\bar { F } ( \hat { C } ( h _ { \theta } ) )$ . The following theorem establishes asymptotic equivalence between these three kinds of utilities.
196
+
197
+ Theorem 1. If $F$ is a well-behaved performance metric and $C _ { D }$ is a strongly consistent estimator of $C$ , i.e.
198
+
199
+ $$
200
+ \mathbb { P } ( \operatorname* { l i m } _ { | D | \infty } ( C _ { D } ) _ { i j } = C _ { i j } ) = 1 \qquad 0 \leq i , j \leq | \mathcal { V } | - 1
201
+ $$
202
+
203
+ then $F \left( C _ { D } \right)$ is a strongly consistent estimator of $F ( C )$ , i.e.
204
+
205
+ $$
206
+ \mathbb { P } ( \operatorname* { l i m } _ { | D | \infty } F ( C _ { D } ) = F ( C ) ) = 1
207
+ $$
208
+
209
+ As a consequence of this theorem, it follows from Eq. 9 that
210
+
211
+ $$
212
+ \mathbb { P } \left( \operatorname* { l i m } _ { | D | \to \infty } F \left( C ( \pmb { \hat { y } } , \pmb { y } ) \right) = F \left( \pmb { \bar { C } } ( h _ { \theta } ) \right) \right) = 1 \qquad \mathbb { P } \left( \operatorname* { l i m } _ { | D | \to \infty } F \left( \hat { C } _ { D } ( h _ { \theta } ) \right) = F \left( \pmb { \bar { C } } ( h _ { \theta } ) \right) \right) = 1
213
+ $$
214
+
215
+ i.e. both $F ( C ( \hat { \pmb y } , { \pmb y } ) )$ and $F ( { \hat { C } } ( h _ { \theta } ) )$ are strongly consistent estimators of (converge w.p. 1 to) $F ( { \bar { C } } ( h _ { \theta } ) )$ . As a special case,
216
+
217
+ $$
218
+ \mathbb { P } \left( \operatorname* { l i m } _ { | D | \to \infty } F _ { 1 } ( { \hat { y } } , { y } ) = { \bar { F } } _ { 1 } ( h _ { \theta } ) \right) = 1 \qquad \mathbb { P } \left( \operatorname* { l i m } _ { | D | \to \infty } { \hat { F } } _ { 1 } ( h _ { \theta } ) = { \bar { F } } _ { 1 } ( h _ { \theta } ) \right) = 1
219
+ $$
220
+
221
+ which justifies Eq. 4 and Eq. 6 when the dataset of interest is sufficiently large. Next we consider the issue of gradient estimation in this general setting.
222
+
223
+ Theorem 2. If $F$ is a well behaved performance metric, then $\nabla _ { \theta } F ( \hat { C } _ { B } ( h _ { \theta } ) )$ is a strongly consistent estimator of $\check { \nabla } _ { \theta } F ( \bar { C } ( h _ { \theta } ) )$ , where $B \subset D$ is a mini-batch. More precisely,
224
+
225
+ $$
226
+ \mathbb { P } ( \operatorname* { l i m } _ { | B | \infty } \nabla _ { \theta } F ( \hat { C } _ { B } ( h _ { \theta } ) ) = \nabla _ { \theta } F ( \bar { C } ( h _ { \theta } ) ) ) = 1
227
+ $$
228
+
229
+ As proved in Chen & Luss (2018), many convergence guarantees for stochastic gradient descent with unbiased gradient estimators holds for stochastic gradient descent with strongly consistent gradient estimators with probability 1. As illustrated in Eq. 8, batch normalization and weight decay can help control the noise of estimator. Please refer to Algorithm 2 for the resultant algorithm.
230
+
231
+ Finally, we state two theorems concerning the generalization and consistency of Algorithm 2. Rates of convergence are omitted for brevity.
232
+
233
+ Theorem 3 (Generalization). For a well behaved performance metric $F$ , for all $\epsilon > 0$ ,
234
+
235
+ $$
236
+ \operatorname* { l i m } _ { | D | \to \infty } \mathbb { P } \left( \left| F ( \hat { C } _ { D } ( h _ { \theta } ) ) - F ( \bar { C } ( h _ { \theta } ) ) \right| < \epsilon \right) = 1
237
+ $$
238
+
239
+ Theorem 4 (Consistency). For a well behaved performance metric $F$ , with appropriate constraints on the capacity of parametric model $p _ { \theta }$ (see the proof for details), we have that for all $\epsilon > 0$ ,
240
+
241
+ $$
242
+ \operatorname* { l i m } _ { | D | \to \infty } \mathbb { P } \left( \left| \arg \operatorname* { m a x } _ { \theta } F \left( \hat { C } _ { D } ( h _ { \theta } ) \right) - \arg \operatorname* { m a x } _ { \theta } F \left( \bar { C } ( h _ { \theta } ) \right) \right| < \epsilon \right) = 1
243
+ $$
244
+
245
+ i.e. Algorithm 2 is consistent.
246
+
247
+ Algorithm 2 Gradient-based learning for well behaved performance metrics
248
+
249
+ <table><tr><td>Algorithm2Gradient-basedlearningIorwellbehavedperformancemetrics Require: batch size b, clasifier hθ, dataset D,learning rate α, weight-decay strength X,and well-</td></tr><tr><td>behaved metric F</td></tr><tr><td>for i = 1,., [| do</td></tr><tr><td>Pi ←D∑(x,y)∈DI(y= i)</td></tr><tr><td>end for</td></tr><tr><td>while terminating criterion not satisfied do</td></tr><tr><td>for i= 1,.., |)| do</td></tr><tr><td>Sample Bi = {(xi,i),,., (x,i)} from D</td></tr><tr><td>Compute pe(-|xi),., Pe(·|x)</td></tr><tr><td>end for</td></tr><tr><td>for i = 1,.., |)| do</td></tr><tr><td>for j = i;,..., (V| do</td></tr><tr><td></td></tr><tr><td>end for</td></tr><tr><td>end for</td></tr><tr><td>0←0+α.δ</td></tr><tr><td>δ←∀θ(F(C)-λ|0)</td></tr><tr><td>end while</td></tr></table>
250
+
251
+ # 4 RELATED WORK
252
+
253
+ The optimization of non-decomposable and non-differentiable performance metrics, especially $F$ - measure, has been extensively studied. The heuristic algorithm considered in Jansche (2005) and Pastor-Pellicer et al. (2013) is essentially Algorithm 1 without techniques that stabilize gradient estimation. However, Jansche (2005) and Pastor-Pellicer et al. (2013) are not very well motivated theoretically and provide little mathematical insight into the heuristic. Also, as shown in Section 5, applying this heuristic algorithm without stabilization techniques can easily result in non-convergent models, even for a three-layer fully-connected network.
254
+
255
+ Another series of papers (Joachims (2005), Kar et al. (2014) and Narasimhan et al. (2015)) study optimizing differentiable lower bounds of various non-decomposable and non-differentiable binary classification metrics for linear classifiers. Despite proved learning guarantees for linear classifier, these lower bound methods are not very promising when applied to neural networks, as reported in Sanyal et al. (2018).
256
+
257
+ Thresholding is a computationally economical method if we only consider binary classification. Koyejo et al. (2014) proves that the optimal classifier with respect to a family of binary classification metrics, including the $F$ -measure, is appropriately thresholded Bayes classifier. Given an approximation of Bayes classifier, we can approach the optimal threshold via grid search. However, it remains unknown how to generalize thresholding to multi-class classification. More importantly, for binary classification, when training set is extremely imbalanced, it can be very difficult to train a classifier that approximates Bayes classifier very well.
258
+
259
+ The computational cost of aforementioned methods roughly equals that of training classifiers with standard classification losses such as cross-entropy. As proved in Parambath et al. (2014) and Koyejo et al. (2014), optimization of many performance metrics, including $F$ -measure, can be reduced to weighted classification. Unfortunately, the optimal weight is in general unknown and has to be approximated by an expensive grid search (see Section 5). Despite its computational cost, unlike thresholding, this method can perform reasonably well even when a training set is extremely balanced. Eban et al. (2016) proposes a similar method that performs well for neural networks coupled with the AUCPR metric.
260
+
261
+ Regarding theory, the equivalence between the data-dependent and expected utility of the $F$ -measure was first proved in Nan et al. (2012) and later generalized in Dembczynski et al. (2017) to ´ $p$ -Lipschitz binary classification performance metrics.
262
+
263
+ Table 1: Dataset statistics and results
264
+
265
+ <table><tr><td>DATASET</td><td>#FEATS</td><td># SAMPS</td><td>% POS</td><td>F1 GS</td><td>F1EUM</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Adult</td><td>108</td><td>48,842</td><td>23.93</td><td>0.701</td><td>0.689</td></tr><tr><td>CIFAR10</td><td>3072</td><td>60,000</td><td>10.00</td><td>0.630</td><td>0.635</td></tr><tr><td>Letter</td><td>16</td><td>20.000</td><td>3.92</td><td>0.990</td><td>0.975</td></tr><tr><td>Covtype</td><td>54</td><td>581,012</td><td>1.63</td><td>0.691</td><td>0.725</td></tr><tr><td>CIFAR100</td><td>3072</td><td>60,000</td><td>1.00</td><td>0.350</td><td>0.392</td></tr><tr><td>KDDCup08</td><td>117</td><td>102,294</td><td>0.61</td><td>0.543</td><td>0.556</td></tr></table>
266
+
267
+ # 5 EXPERIMENTS
268
+
269
+ We evaluate Algorithm 1 on the following datasets: Letter1, Adult2, Covertype3, $\mathrm { K D D C u p 0 8 ^ { 4 } }$ , CIFAR10 and CIFAR100 (Krizhevsky (2009)). The performance metric to optimize is the binary $F _ { 1 }$ score. The purpose of this experiment is to demonstrate that Algorithm 1 can match the performance of a provably optimal, yet considerably more expensive algorithm that optimizes the $F _ { 1 }$ score. We use a three-layer fully-connected network in our experiments, with batch normalization enabled. The statistics of these datasets are summarized in Table 1 (number of features, number of samples, percentage of positive samples). For multi-class datasets (Letter, Covertype, CIFAR10 and CIFAR100), we designate one class as the positive class and leave the rest as the negative class. We compare Algorithm 1 with the following baseline (Parambath et al. (2014) and Koyejo et al. (2014)):
270
+
271
+ $$
272
+ \theta ^ { * } \longleftarrow \operatorname * { a r g m a x } _ { \theta , \lambda \in ( 0 , 1 ) } \frac { 1 } { | D | } \sum _ { ( \pmb { x } , y ) \in D } l ( p _ { \theta } ( \pmb { x } ) , y ) \left( \lambda \mathbb { I } ( y = 0 ) + ( 1 - \lambda ) \mathbb { I } ( y = 1 ) \right)
273
+ $$
274
+
275
+ where $l$ denotes the cross-entropy loss. We let $\lambda = 0 . 1 , 0 . 2 , 0 . 3 , . . . , 0 . 9$ , and apply gradient descent to optimize $\theta$ for a fixed $\lambda$ . As proved in Parambath et al. (2014) and Koyejo et al. (2014), this baseline method should yield an approximately optimal $F _ { 1 }$ score (although at a cost considerably higher than Algorithm 1 because we have to optimize $\theta$ for every $\lambda$ ). In our case, the baseline method is 8 times slower than Algorithm 1. To our knowledge, the baseline method is the state-ofthe-art method in term of resultant $F _ { 1 }$ score (not in term of efficiency). We apply weight decay to both methods and find that in general weight decay improves the performance of Algorithm 1 while hurts the performance of baseline method. For the Covertype dataset, Algorithm 1 cannot converge without weight decay, which is an evidence that weight decay may improve gradient estimation. We report results in Table 1, where “ $F _ { 1 }$ GS” refers to the $F _ { 1 }$ score attained by the grid-search method and “ $F _ { 1 }$ EUM” refers to the $F _ { 1 }$ score attained by Algorithm 1.
276
+
277
+ # 6 CONCLUSION
278
+
279
+ We propose an empirical utility maximization scheme that enables efficient gradient-based learning for a class of non-decomposable and non-differentiable classification performance metrics. We inquire into the proposed scheme mathematically and present preliminary experiments that validate our approach. We leave it as future work to experiment on deeper neural networks, larger datasets, and more complex performance metrics.
280
+
281
+ # REFERENCES
282
+
283
+ Jie Chen and Ronny Luss. Stochastic gradient descent with biased but consistent gradient estimators. CoRR, abs/1807.11880, 2018. URL http://arxiv.org/abs/1807.11880.
284
+
285
+ Seung-Seok Choi, Sung-Hyuk Cha, and Charles C Tappert. A survey of binary similarity and distance measures. 2010.
286
+
287
+ Krzysztof Dembczynski, Wojciech Kotłowski, Oluwasanmi Koyejo, and Nagarajan Natarajan. Con- ´ sistency analysis for binary classification revisited. In International Conference on Machine Learning, pp. 961–969, 2017.
288
+
289
+ Luc Devroye. Classification and trees. In Structural, Syntactic, and Statistical Pattern Recognition, Joint IAPR International Workshop, SSPR&SPR 2010, Cesme, Izmir, Turkey, August 18-20, 2010. Proceedings, pp. 40–44, 2010. doi: 10.1007/978-3-642-14980-1\ 3. URL https://doi. org/10.1007/978-3-642-14980-1_3.
290
+
291
+ Elad ET Eban, Mariano Schain, Alan Mackey, Ariel Gordon, Rif A Saurous, and Gal Elidan. Scalable learning of non-decomposable objectives. arXiv preprint arXiv:1608.04802, 2016.
292
+
293
+ 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.
294
+
295
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. arXiv preprint arXiv:1502.03167, 2015.
296
+
297
+ Martin Jansche. Maximum expected f-measure training of logistic regression models. In Proceedings of the conference on Human Language Technology and Empirical Methods in Natural Language Processing, pp. 692–699. Association for Computational Linguistics, 2005.
298
+
299
+ Thorsten Joachims. A support vector method for multivariate performance measures. In Proceedings of the 22nd international conference on Machine learning, pp. 377–384. ACM, 2005.
300
+
301
+ Purushottam Kar, Harikrishna Narasimhan, and Prateek Jain. Online and stochastic gradient methods for non-decomposable loss functions. In Advances in Neural Information Processing Systems, pp. 694–702, 2014.
302
+
303
+ Oluwasanmi O Koyejo, Nagarajan Natarajan, Pradeep K Ravikumar, and Inderjit S Dhillon. Consistent binary classification with generalized performance metrics. In Advances in Neural Information Processing Systems, pp. 2744–2752, 2014.
304
+
305
+ Alex Krizhevsky. Learning multiple layers of features from tiny images. Technical report, Citeseer, 2009.
306
+
307
+ Ye Nan, Kian Ming Chai, Wee Sun Lee, and Hai Leong Chieu. Optimizing f-measure: A tale of two approaches. arXiv preprint arXiv:1206.4625, 2012.
308
+
309
+ Harikrishna Narasimhan, Purushottam Kar, and Prateek Jain. Optimizing non-decomposable performance measures: a tale of two classes. In International Conference on Machine Learning, pp. 199–208, 2015.
310
+
311
+ Shameem Puthiya Parambath, Nicolas Usunier, and Yves Grandvalet. Optimizing f-measures by cost-sensitive classification. In Advances in Neural Information Processing Systems, pp. 2123– 2131, 2014.
312
+
313
+ Joan Pastor-Pellicer, Francisco Zamora-Mart´ınez, Salvador Espana-Boquera, and Mar ˜ ´ıa Jose Castro- ´ Bleda. F-measure as the error function to train neural networks. In International Work-Conference on Artificial Neural Networks, pp. 376–384. Springer, 2013.
314
+
315
+ Amartya Sanyal, Pawan Kumar, Purushottam Kar, Sanjay Chawla, and Fabrizio Sebastiani. Optimizing non-decomposable measures with deep networks. arXiv preprint arXiv:1802.00086, 2018.
316
+
317
+ Cornelis Joost Van Rijsbergen. Foundation of evaluation. Journal of Documentation, 30(4):365– 373, 1974.
318
+
319
+ Vladimir Vapnik. Principles of risk minimization for learning theory. In Advances in neural information processing systems, pp. 831–838, 1992.
320
+
321
+ # PROOFS
322
+
323
+ Theorem 1. If $F$ is a well-behaved performance metric and $C _ { D }$ is a strongly consistent estimator of $C$ , i.e.
324
+
325
+ $$
326
+ \mathbb { P } ( \operatorname* { l i m } _ { | D | \infty } ( C _ { D } ) _ { i j } = C _ { i j } ) = 1 \qquad 0 \leq i , j \leq | \mathcal { V } | - 1
327
+ $$
328
+
329
+ then $F \left( C _ { D } \right)$ is a strongly consistent estimator of $F ( C )$ , i.e.
330
+
331
+ $$
332
+ \mathbb { P } ( \operatorname* { l i m } _ { | D | \infty } F ( C _ { D } ) = F ( C ) ) = 1
333
+ $$
334
+
335
+ Proof. Let $N = | \mathcal { V } | \times | \mathcal { V } | .$ . Instead of treating $C _ { D }$ and $C$ as $| \mathcal { V } | \times | \mathcal { V } |$ matrices, we treat them as $N$ -dimensional vectors $( C _ { 1 } ^ { \dot { \cal D } } , . . . , C _ { N } ^ { D } )$ and $( C _ { 1 } , . . . , C _ { N } )$ . For $i = 1 , . . . , N$ , let $E _ { i }$ be the event that
336
+
337
+ $$
338
+ \operatorname* { l i m } _ { | D | \to \infty } C _ { i } ^ { D } = C _ { i }
339
+ $$
340
+
341
+ Let $E$ be the event that
342
+
343
+ $$
344
+ \operatorname* { l i m } _ { | D | \infty } F ( C _ { D } ) = F ( C )
345
+ $$
346
+
347
+ By the continuity of $F$ ,
348
+
349
+ $$
350
+ ( \forall i = 1 , . . . , N , \operatorname* { l i m } _ { | D | \infty } C _ { i } ^ { D } = C _ { i } ) \Rightarrow ( \operatorname* { l i m } _ { | D | \infty } F ( C _ { D } ) = F ( C ) )
351
+ $$
352
+
353
+ which implies that
354
+
355
+ $$
356
+ \bigcap _ { i = 1 } ^ { N } E _ { i } \subset E
357
+ $$
358
+
359
+ Taking complement on both sides, we have
360
+
361
+ $$
362
+ E ^ { c } \subset \left( \bigcap _ { i = 1 } ^ { N } E _ { i } \right) ^ { c } = \bigcup _ { i = 1 } ^ { N } E _ { i } ^ { c }
363
+ $$
364
+
365
+ By the monotonicity of probability measure and the union bound,
366
+
367
+ $$
368
+ \mathbb { P } ( E ^ { c } ) \leq \mathbb { P } \left( \bigcup _ { i = 1 } ^ { N } E _ { i } ^ { c } \right) \leq \sum _ { i = 1 } ^ { N } \mathbb { P } ( E _ { i } ^ { c } ) = \sum _ { i = 1 } ^ { N } 1 - \mathbb { P } ( E _ { i } ) = \sum _ { i = 1 } ^ { N } 1 - 1 = 0
369
+ $$
370
+
371
+ Consequently,
372
+
373
+ $$
374
+ \mathbb { P } ( \operatorname* { l i m } _ { | D | \infty } F ( C _ { D } ) = F ( C ) ) = \mathbb { P } ( E ) = 1 - \mathbb { P } ( E ^ { c } ) = 1 - 0 = 1
375
+ $$
376
+
377
+ Theorem 2. If $F$ is a well behaved performance metric, then $\nabla _ { \theta } F ( \hat { C } _ { B } ( h _ { \theta } ) )$ is a strongly consistent estimator of $\check { \nabla } _ { \theta } F ( \bar { C } ( h _ { \theta } ) )$ , where $B \subset D$ is a mini-batch. More precisely,
378
+
379
+ $$
380
+ \mathbb { P } ( \operatorname* { l i m } _ { | B | \infty } \nabla _ { \theta } F ( \hat { C } _ { B } ( h _ { \theta } ) ) = \nabla _ { \theta } F ( \bar { C } ( h _ { \theta } ) ) ) = 1
381
+ $$
382
+
383
+ Proof. Let $N = | \mathcal { V } | \times | \mathcal { V } |$ . As in the proof of Theorem 1, instead of treating $\hat { C } _ { B } ( h _ { \theta } )$ and $\bar { C } ( h _ { \theta } )$ as $| y | \times | y |$ matrices, we treat them as $N$ -dimensional vectors $\hat { C } _ { B } = ( \hat { C } _ { 1 } ^ { B } , . . . , \hat { C } _ { N } ^ { B } )$ and $\bar { C } =$
384
+
385
+ $( \bar { C } _ { 1 } , . . . , \bar { C } _ { N } )$ , where we omit the dependence on $h _ { \theta }$ for brevity. For $i = 1 , . . . , N$ , let $E _ { i }$ be the event that
386
+
387
+ $$
388
+ \operatorname* { l i m } _ { | B | \infty } \nabla _ { \theta } \hat { C } _ { i } ^ { B } = \nabla _ { \theta } \bar { C } _ { i }
389
+ $$
390
+
391
+ and $E$ denote the event that
392
+
393
+ $$
394
+ \operatorname* { l i m } _ { | B | \infty } \nabla _ { \theta } F ( \hat { C } _ { B } ) = \nabla _ { \theta } F ( \bar { C } )
395
+ $$
396
+
397
+ Because $\nabla _ { \boldsymbol { \theta } } F ( \hat { C } _ { i } ^ { B } )$ is an unbiased estimator of $\nabla _ { \boldsymbol { \theta } } F ( \bar { C } _ { i } )$ , i.e. $\mathbb { E } [ \nabla _ { \theta } F ( \hat { C } _ { i } ^ { B } ) ] = \nabla _ { \theta } F ( \bar { C } _ { i } )$
398
+
399
+ $$
400
+ \mathbb { P } ( E _ { i } ) = \mathbb { P } ( \operatorname* { l i m } _ { | B | \infty } \nabla _ { \theta } F ( \hat { C } _ { i } ^ { B } ) = \nabla _ { \theta } F ( \bar { C } _ { i } ) ) = 1
401
+ $$
402
+
403
+ by the law of large number. Consequently, suppose
404
+
405
+ $$
406
+ \bigcap _ { i = 1 } ^ { N } E _ { i } \subset E
407
+ $$
408
+
409
+ which is equivalent to the proposition that
410
+
411
+ $$
412
+ ( \forall i = 1 , . . . , N , \operatorname* { l i m } _ { | B | \infty } \nabla _ { \theta } \hat { C } _ { i } ^ { B } = \nabla _ { \theta } \bar { C } _ { i } ) \Rightarrow ( \operatorname* { l i m } _ { | B | \infty } \nabla _ { \theta } F ( \hat { C } _ { B } ) = \nabla _ { \theta } F ( \bar { C } ) )
413
+ $$
414
+
415
+ then this theorem will follow from a union bound argument similar to that in the proof of theorem 1. We now prove this proposition. Let ${ \hat { J } } _ { B } $ and $\bar { J }$ be the Jacobian of $\hat { C } _ { B }$ and $\bar { C }$ w.r.t. $\theta$ , i.e.
416
+
417
+ $$
418
+ \hat { \pmb { J } } _ { B } = \left[ \begin{array} { c } { \nabla _ { \theta } \hat { C } _ { 1 } ^ { B } } \\ { \cdots } \\ { \nabla _ { \theta } \hat { C } _ { N } ^ { B } } \end{array} \right] \qquad \bar { \pmb { J } } = \left[ \begin{array} { c } { \nabla _ { \theta } \bar { C } _ { 1 } } \\ { \cdots } \\ { \nabla _ { \theta } \bar { C } _ { N } } \end{array} \right]
419
+ $$
420
+
421
+ By the chain rule,
422
+
423
+ $$
424
+ \nabla _ { \boldsymbol { \theta } } F \left( \hat { C } _ { B } \right) = \nabla F \left( \hat { C } _ { B } \right) \hat { J } _ { B }
425
+ $$
426
+
427
+ where $\nabla F \left( { \hat { C } } _ { B } \right)$ is the gradient of $F$ at $\hat { C } _ { B }$ . Because $F$ is continuously differentiable, i.e. $\nabla F$ exists and is continuous,
428
+
429
+ $$
430
+ ( \forall i = 1 , . . . , N , \operatorname* { l i m } _ { | B | \infty } \hat { C } _ { i } ^ { B } = \bar { C } _ { i } ) \Rightarrow ( \operatorname* { l i m } _ { | B | \infty } \nabla F ( \hat { C } _ { B } ) = \nabla F ( \bar { C } ) )
431
+ $$
432
+
433
+ Thus for all $\delta > 0$ , there exists $N _ { F , \delta }$ such that when $| B | > N _ { F }$ ,
434
+
435
+ $$
436
+ | \epsilon | : = \left| \nabla F \left( \hat { C } _ { B } \right) - \nabla F \left( \bar { C } \right) \right| < \frac { \delta } { 2 | | \bar { \boldsymbol J } | | }
437
+ $$
438
+
439
+ where $| | \bar { J } | |$ is the matrix norm of $\bar { J }$ , defined as
440
+
441
+ $$
442
+ | | \bar { J } | | = \operatorname* { s u p } _ { | { \pmb x } | \leq 1 } | \bar { J } { \pmb x } |
443
+ $$
444
+
445
+ Thus
446
+
447
+ $$
448
+ ( \forall i = 1 , . . . , N , \operatorname* { l i m } _ { | D | \infty } \nabla _ { \theta } \hat { C } _ { i } ^ { B } = \nabla _ { \theta } \bar { C } ) \Rightarrow ( \operatorname* { l i m } _ { | B | \infty } \hat { J } _ { B } = \bar { J } )
449
+ $$
450
+
451
+ where the convergence is in the Frobenius norm. Because convergence in the Frobenius norm is equivalent to convergence in matrix norm, for all $\delta > 0$ , there exists $N _ { \hat { J } }$ such that when $| D | > N _ { \hat { J } }$ ,
452
+
453
+ $$
454
+ | | \mathcal { E } | | : = \Big | \big | J _ { D } ( \theta ) - J ( \theta ) \big | \Big | < \frac { \delta } { 2 M }
455
+ $$
456
+
457
+ where
458
+
459
+ $$
460
+ M : = \operatorname* { s u p } _ { \pmb { x } \in K } \nabla F ( \pmb { x } ) < \infty
461
+ $$
462
+
463
+ because $K$ is compact and $\nabla F$ is continuous on $K$ by definition.
464
+
465
+ Thus for all $B$ such that $\lvert B \rvert > \operatorname* { m a x } \left\{ N _ { F } , N _ { \hat { J } } \right\}$ ,
466
+
467
+ $$
468
+ \begin{array} { r l } { \nabla _ { \theta } F ( \hat { C } _ { \theta } ) - \nabla _ { \theta } F ^ { \prime } ( \widetilde { C } ) \Big | = | \nabla F ^ { \prime } ( \hat { C } _ { \theta } ) \hat { J } _ { \theta } - \nabla F ^ { \prime } ( \widetilde { C } ) | } \\ & { = | ( \nabla F ^ { \prime } ( \overline { { C } } ) + \epsilon ) ( \bar { J } + \epsilon ) - \nabla F ^ { \prime } ( \widetilde { C } ) | } \\ & { = | ( \nabla F ^ { \prime } ( \overline { { C } } ) \hat { J } + \nabla F ^ { \prime } ( \overline { { C } } ) \hat { J } + \epsilon \bar { J } + \epsilon \bar { C } - \nabla F ^ { \prime } ( \overline { { C } } ) \hat { J } | } \\ & { = | \nabla F ( \overline { { C } } ) \hat { C } + \epsilon \bar { C } + \epsilon \bar { C } - \nabla F ( \overline { { C } } ) \hat { J } | } \\ & { \leq | \nabla F ( \overline { { C } } ) \hat { C } + | \epsilon \bar { C } | + | \epsilon \bar { C } - \nabla F ( \overline { { C } } ) \hat { J } | } \\ & { \lesssim | \nabla F ( \mathcal { C } ) \hat { S } | + | \epsilon \bar { J } | + | \epsilon \bar { C } | } \\ & { \lesssim | \nabla F ( \mathcal { C } ) \hat { C } + | \epsilon \bar { J } | } \\ & { \leq | \nabla F ( \mathcal { C } ) | | \epsilon | + | \epsilon | | J | | } \\ & { \leq \frac { \hat { \epsilon } } { 2 } + \frac { \hat { \epsilon } } { 2 } } \end{array}
469
+ $$
470
+
471
+ where we ignore the high-order term $| \epsilon \mathcal { E } |$ . Consequently,
472
+
473
+ $$
474
+ \operatorname* { l i m } _ { | D | \infty } \nabla _ { \theta } F ( \hat { C } _ { B } ) = \nabla _ { \theta } F ( \bar { C } )
475
+ $$
476
+
477
+ Theorem 3 (Generalization). For a well behaved performance metric $F$ , for all $\epsilon > 0$
478
+
479
+ $$
480
+ \operatorname* { l i m } _ { | D | \to \infty } \mathbb { P } \left( \left| F ( \hat { C } _ { D } ( h _ { \theta } ) ) - F ( \bar { C } ( h _ { \theta } ) ) \right| < \epsilon \right) = 1
481
+ $$
482
+
483
+ Proof. By Theorem 1,
484
+
485
+ which implies that
486
+
487
+ $$
488
+ \begin{array} { r l } & { \mathbb { P } ( \underset { | D | \infty } { \operatorname* { l i m } } \Big | F ( \hat { C } _ { D } ( h _ { \theta } ) ) - F ( \bar { C } ( h _ { \theta } ) ) \Big | < \epsilon ) = 1 } \\ & { \underset { | D | \infty } { \operatorname* { l i m } } \mathbb { P } ( \Big | F ( \hat { C } _ { D } ( h _ { \theta } ) ) - F ( \bar { C } ( h _ { \theta } ) ) \Big | < \epsilon ) = 1 } \end{array}
489
+ $$
490
+
491
+ Theorem 4 (Consistency). For a well behaved performance metric $F$ , with appropriate constraints on the capacity of parametric model $p _ { \theta }$ (see the proof for details), we have that for all $\epsilon > 0$ ,
492
+
493
+ $$
494
+ \operatorname* { l i m } _ { | D | \to \infty } \mathbb { P } \left( \left| \arg \operatorname* { m a x } _ { \theta } F \left( \hat { C } _ { D } ( h _ { \theta } ) \right) - \arg \operatorname* { m a x } _ { \theta } F \left( \bar { C } ( h _ { \theta } ) \right) \right| < \epsilon \right) = 1
495
+ $$
496
+
497
+ i.e. Algorithm 2 is consistent.
498
+
499
+ Proof. To prove consistency, it suffices to prove that (Vapnik (1992)):
500
+
501
+ $$
502
+ \operatorname* { l i m } _ { | D | \to \infty } \mathbb { P } \left( \operatorname* { s u p } _ { \theta } \left| F \left( { \hat { C } } _ { D } ( h _ { \theta } ) \right) - F \left( { \bar { C } } ( h _ { \theta } ) \right) \right| < \epsilon \right) = 1
503
+ $$
504
+
505
+ Because $F$ is well behaved, by the union bound argument in previous proofs, it suffices to show that
506
+
507
+ $$
508
+ \operatorname* { l i m } _ { | D | \infty } \mathbb { P } ( \operatorname* { s u p } _ { \theta } | ( \hat { C } _ { D } ( h _ { \theta } ) ) _ { i j } - \bar { C } _ { i j } ( h _ { \theta } ) | < \epsilon ) = 1 \qquad 1 \leq i , j \leq | \mathcal { X } |
509
+ $$
510
+
511
+ Because $\begin{array} { r } { ( \hat { C } _ { D } ( h _ { \theta } ) ) _ { i j } = \frac { p _ { j } } { n _ { j } } \sum _ { k = 1 } ^ { n _ { j } } p _ { \theta } ( i | \pmb { x } _ { k } ^ { j } ) } \end{array}$ , it suffices to show that
512
+
513
+ $$
514
+ \operatorname* { l i m } _ { | D | \infty } \mathbb { P } ( \operatorname* { s u p } _ { \theta } | \frac { p _ { j } } { n _ { j } } \sum _ { k = 1 } ^ { n _ { j } } p _ { \theta } ( i | x _ { k } ^ { j } ) - \bar { C } _ { i j } ( h _ { \theta } ) | < \epsilon ) = 1 \qquad 1 \leq i , j \leq | \mathcal { X } |
515
+ $$
516
+
517
+ which holds for $p _ { \theta }$ with finite VC-dimension by Lemma 29.1 in Devroye (2010) because
518
+
519
+ $$
520
+ \mathbb { E } _ { D } \left[ \frac { p _ { j } } { n _ { j } } \sum _ { k = 1 } ^ { n _ { j } } p _ { \theta } ( i | \pmb { x } _ { k } ^ { j } ) \right] = \bar { C } _ { i j } \left( h _ { \theta } \right)
521
+ $$
522
+
523
+ # WELL BEHAVED PERFORMANCE METRICS
524
+
525
+ The following is a non-exhaustive list of non-decomposable and non-differentiable, yet wellbehaved performance metrics in the setting of binary classification. They can be extended to the setting of multi-class classification in the same way that the $F$ -measure is extended to multi-class classification in Section 3.
526
+
527
+ $$
528
+ { \begin{array} { r l } & { \bullet \operatorname { A U C } = { \frac { \mathrm { f p } \cdot \mathrm { f n } } { ( \mathrm { i p } + \mathrm { f n } ) ( \mathrm { f p } + \mathrm { f n } ) } } } \\ & { \bullet F _ { \beta } = ( 1 + \beta ^ { 2 } ) \cdot { \frac { p ^ { + } - \mathrm { f n } } { ( 1 + \beta ^ { 2 } ) p ^ { + } - \mathrm { f n } + \mathrm { f p } } } } \\ & { \bullet \operatorname { G - M e a n } = { \sqrt { \mathrm { t p } \cdot \mathrm { t n } } } } \\ & { \bullet \operatorname { J a c c a r d } = { \frac { \mathrm { t p } } { \mathrm { t p } + \mathrm { f p } + \mathrm { f n } } } } \\ & { \bullet \operatorname { Q - M e a n } = 1 - { \sqrt { \frac { ( 1 - \mathrm { t p } ) ^ { 2 } + ( 1 - \mathrm { t n } ) ^ { 2 } } { 2 } } } } \end{array} }
529
+ $$
530
+
531
+ We refer interested readers to Choi et al. (2010) for a more exahustive list of these performance metrics.
md/train/H38f_9b90BO/H38f_9b90BO.md ADDED
@@ -0,0 +1,604 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TOWARDS ROBUST GRAPH NEURAL NETWORKS AGAINST LABEL NOISE
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Massive labeled data have been used in training deep neural networks, thus label noise has become an important issue therein. Although learning with noisy labels has made great progress on image datasets in recent years, it has not yet been studied in connection with utilizing GNNs to classify graph nodes. In this paper, we propose a method, named LPM, to address the problem using Label Propagation (LP) and Meta learning. Different from previous methods designed for image datasets, our method is based on a special attribute (label smoothness) of graphstructured data, i.e., neighboring nodes in a graph tend to have the same label. A pseudo label is computed from the neighboring labels for each node in the training set using LP; meta learning is utilized to learn a proper aggregation of the original and pseudo label as the final label. Experimental results demonstrate that LPM outperforms state-of-the-art methods in graph node classification task with both synthetic and real-world label noise. Source code to reproduce all results will be released.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Deep Neural Networks (DNNs) have achieved great success in various domains, but the necessity of collecting large amount of samples with high-quality labels is both expensive and time-consuming. To address this problem, cheaper alternatives have emerged. For example, the onerous labeling process can be completed on some crowdsourced system like Amazon Mechanical Turk 1. Besides, we can collect labeled samples from web with search engines and social media. However, all these methods are prone to produce noisy labels of low quality. As is shown in recent research (Zhang et al., 2016b), an intractable problem is that DNNs can easily overfit to noisy labels, which dramatically degrades the generalization performance. Therefore, it is necessary and urgent to design some valid methods for solving this problem.
12
+
13
+ Graph Neural Networks (GNNs) have aroused keen research interest in recent years, which resulted in rapid progress in graph-structured data analysis (Kipf & Welling, 2016; Velickovic et al., 2017; Xu et al., 2018; Hou et al., 2019; Wang & Leskovec, 2020). Graph node classification is the mostcommon issue in GNNs. However, almost all the previous works about label noise focus on image classification problem and handling noisy labels in the task of graph node classification with GNNs has not been studied yet. Fortunately, most edges in the graph-structured datasets are intra-class edges (Wang & Leskovec, 2020), indicating that a node’s label can be estimated by its neighbor nodes’ labels. In this paper, we utilize this special attribute of graph data to alleviate the damages caused by noisy labels. Moreover, meta learning paradigm serves as a useful tool for us to learn a proper aggregation between origin labels and pseudo labels as the final labels.
14
+
15
+ The key contributions of this paper are as follows:
16
+
17
+ • To the best of our knowledge, we are the first to focus on the label noise existing in utilizing GNNs to classify graph nodes, which may serve as a beginning for future research towards robust GNNs against label noise.
18
+
19
+ • We utilize meta-learning to learn how to aggregate origin labels and pseudo labels properly to get more credible supervision instead of learning to re-weight different samples.
20
+
21
+ We experimentally show that our LPM outperforms state-of-the-art algorithms in utilizing GNNs to classify graph nodes with both synthetic and real-world label noise.
22
+
23
+ # 2 RELATED WORK
24
+
25
+ # 2.1 GRAPH NEURAL NETWORKS
26
+
27
+ To start, we use $\mathcal { G } = ( \nu , \mathcal { E } , \mathcal { X } )$ to denote a graph whose nodes set is $\nu$ and edges set is $\mathcal { E }$ , and $\mathcal { X } \in R ^ { n \times d }$ is the input feature matrix, where $n$ denotes the number of nodes in the graph and $d$ is the dimension of the input feature vector of each node. We use $e _ { u , v } \in \mathcal { E }$ to denote the edge that connects node $u$ and $v$ . For each node $v \in \mathcal V$ , its neighbor nodes set can be donated as $\mathcal { N } _ { v } = \{ u : e _ { u , v } \in \mathcal { E } \}$ . For node classification task, the goal of GNNs is to learn optimal mapping function $f ( \cdot )$ to predict the class label $y _ { v }$ for node $v$ . Generally speaking, GNNs follows a framework including aggregation and combination in each layer. Different GNNs have proposed different ways of aggregation and combination. In general, the $k$ -th layer of a GNN reads
28
+
29
+ $$
30
+ a _ { v } ^ { ( k ) } = A g g r e g a t e ^ { ( k ) } ( \{ h _ { u } ^ { ( k - 1 ) } : u \in \mathcal { N } ( v ) \} ) , h _ { v } ^ { ( k ) } = C o m b i n e ^ { ( k ) } ( h _ { v } ^ { ( k - 1 ) } , a _ { v } ^ { ( k ) } ) ,
31
+ $$
32
+
33
+ where $h _ { v } ^ { ( k ) }$ is the output for $k$ -th layer of node $v$ , $h _ { v } ^ { ( 0 ) }$ is the input vector of node $v$
34
+
35
+ # 2.2 LABEL PROPAGATION
36
+
37
+ In Label Propagation (LP), node labels are propagated and aggregated along the edges in the graph (Zhou et al., 2004; Zhu et al., 2005; Wang & Zhang, 2007; Karasuyama & Mamitsuka, 2013). There are some works which were designed to improve the performance of label propagation. For example, Gong et al. (2016) proposed a novel iterative label propagation algorithm which explicitly optimizes the propagation quality by manipulating the propagation sequence to move from simple to difficult examples; Zhang et al. (2020) introduces a triple matrix recovery mechanism to remove noise from the estimated soft labels during propagation. Label propagation has been applied in semi-supervised image classification task. For example, Gong et al. (2017) used a weighted Knearest neighborhood graph to bridge the datapoints so that the label information can be propagated from the scarce labeled examples to unlabeled examples along the graph edges. Park et al. (2020) proposed a novel framwork to propagate the label information of the sampled data (reliable) to adjacent data along a similarity based graph. Compared to these methods, we utilize the intrinsic graph structure instead of handcrafted graph to propagate clean labels information, which is more reliable for graph-structured data. Besides, GNNs are utilized by us to extract features and classify nodes for graph-structured data.
38
+
39
+ # 2.3 META-LEARNING BASED METHODS AGAINST NOISY LABELS
40
+
41
+ Meta-learning aims to learn not only neural networks’ weights, but also itself, such as hand-designed parameters, optimizer and so on (Andrychowicz et al., 2016; Finn et al., 2017). Several works have utilized meta-learning paradigm to deal with label noise. For example, Li et al. (2019) has proposed to find noise-tolerant model parameters by keeping the consistency between the output of teacher and student networks, and Li et al. (2017b) trains the teacher networks with samples with clean labels and then transfer the knowledge to student networks so that the student can learn correctly even if the existence of mislabeled data. Besides, Ren et al. (2018); Jenni & Favaro (2018); Shu et al. (2019) utilize meta-learning paradigm to re-weight samples, i.e., weight samples with clean labels more and weight mislabeled samples less. The weighting factors are optimized by gradient decent or generated by a network to minimizes the loss on a small amount of samples with correct labels. In contrast, meta-learning paradigm is utilized in this paper to learn how to aggregate origin labels and pseudo labels properly. We can get more credible supervision by combining the original label information with the label information provided by LP properly.
42
+
43
+ ![](images/88e328481af02f8079b2ba69be71949f441f9d355e551c983965101d2e93aa17.jpg)
44
+ Figure 1: Illustration of label propagation in our method. The two types of nodes are distinguished by two colours (blue and green). The nodes surrounded by dotted line are training nodes $\mathcal { D } _ { t r a i n }$ whose label may be incorrect and those surrounded by solid line are clean sets $\mathcal { D } _ { c l e a n }$ . In Figure.1(b), one half of every training node is pseudo label predicted by LP and the other half is original label. Some nodes’ (node 5,7) pseudo labels are the same with their original labels, we select them $\mathcal { D } _ { s e l e c t }$ to train GNNs and inject them to clean sets for better label propagation. We can get proper labels for the left nodes $\mathcal { D } _ { l e f t }$ (node 6,8,9,10) based on meta learning.
45
+
46
+ # 3 METHODS
47
+
48
+ # 3.1 PRELIMINARIES
49
+
50
+ Given a graph data with $n$ nodes and their labels $\mathcal { D } \ = \ \{ ( x _ { 0 } , y _ { 0 } ) , ( x _ { 1 } , y _ { 1 } ) , . . . , ( x _ { n - 1 } , y _ { n - 1 } ) \}$ , where $x _ { j }$ is the $j$ -th node and $y _ { j } \in \{ 0 , 1 \} ^ { c }$ is the label over $c$ classes. $\begin{array} { r l } { \mathcal { D } _ { t r a i n } } & { { } = } \end{array}$ $\left\{ { \left( x _ { 0 } , y _ { 0 } \right) } , { \left( x _ { 1 } , y _ { 1 } \right) } , . . . , { \left( x _ { s - 1 } , y _ { s - 1 } \right) } \right\}$ are training nodes with noisy labels. Our goal is to enable the GNNs $f ( x _ { j } ; w )$ trained with noisy sets $\mathcal { D } _ { t r a i n }$ can also generalize well on test nodes. $\cdot$ is the learnable parameters of GNNs. In our method, $m$ nodes with true labels $\mathcal { D } _ { c l e a n } ~ =$ $\{ ( x _ { s } , y _ { s } ) , ( x _ { s + 1 } , y _ { s + 1 } ) , . . . , ( x _ { s + m - 1 } , y _ { s + m - 1 } ) \}$ in the graph are provided as the initial clean sets $( m \ll s )$ . GCN (Kipf & Welling, 2016) and GAT (Velickovic et al., 2017) are utilized in our experiments to extract features and classify nodes. Our method includes two main parts: label propagation and label aggregation. We will go into details about these two parts in the following section 3.2 and section 3.3.
51
+
52
+ # 3.2 LABEL PROPAGATION
53
+
54
+ Label Propagation is based on the label smoothness that two connected nodes tend to have the same label. Therefore, the weighted average of neighbor nodes’ label of a node is similar to this node��s true label. An illustration of LP part in our method can be found in Figure. 1. The first step of LP is to construct an appropriate neighborhood graph. A common choice is $\mathbf { k }$ -nearest graph (Iscen et al., 2019; Liu et al., 2018) but there is an intrinsic graph structure (adjacency matrix $A$ ) in graph data, so our similarities matrix $W$ with zero diagonal can be constructed with $A$ , whose elements $\cdot$ are pairwise similarities between node $i$ and node $j$ :
55
+
56
+ $$
57
+ = \frac { A _ { i , j } } { d ( h _ { i } , h _ { j } ) + \varepsilon } ,
58
+ $$
59
+
60
+ where $h _ { i } , h _ { j }$ are the feature vectors extracted by GNNs for node $i$ and node $j , \ d ( \cdot , \cdot )$ is a distance measure (e.g.,Euclidean distance). $\varepsilon$ is an infinitesimal. Note that we can get $W$ with time complexity $\mathcal { O } ( | \mathcal { E } | )$ instead of $\mathcal { O } ( n ^ { 2 } )$ because $A$ is a sparse matrix whose edge lists are given. Then we can normalize the similarities matrix $W$ :
61
+
62
+ $$
63
+ S = D ^ { - 1 / 2 } W D ^ { - 1 / 2 } ,
64
+ $$
65
+
66
+ $D$ atrix withbe the sof $( i , i )$ -value to be the sum of thbel matrix in LP iteration $i$ -th rowand the f -t $W$ . Low $Y ^ { ( k ) } =$ $[ y _ { 1 } ^ { ( k ) } , . . . , y _ { n } ^ { ( k ) } ] ^ { T } \ \in \ \mathbb { R } ^ { n \times c }$ $k$ $i$ $y _ { i } ^ { ( k ) }$ predicted label distribution for node $i$ . When $k = 0$ , the initial label matrix $Y ^ { ( 0 ) } = [ y _ { 1 } ^ { ( 0 ) } , . . . , y _ { n } ^ { ( 0 ) } ] ^ { T }$
67
+
68
+ consists of one-hot label vectors for $i = s , s + 1 , . . . , s + m - 1$ (i.e., initial clean sets) or zero vectors otherwise. The LP (Zhu et al., 2005) in iteration $k$ can be formulated as:
69
+
70
+ $$
71
+ Y ^ { ( k + 1 ) } = S Y ^ { ( k ) } ,
72
+ $$
73
+
74
+ $$
75
+ y _ { i } ^ { ( k + 1 ) } = y _ { i } ^ { ( 0 ) } , \forall i \in [ s , s + m - 1 ]
76
+ $$
77
+
78
+ In Eq. (4), every node’s label in the $( k + 1 )$ -th iteration equals the weighted average of its neighbor nodes’ labels in $k$ -th iteration. In this way, the clean sets propagate labels to the noisy training nodes according to normalized edge weights. And then in Eq. (5), the labels of clean sets nodes are reset to their initial values. The reason is that we can take full advantage of the tiny minority of clean nodes and in case that the effect of clean sets fade away.
79
+
80
+ Co-teaching (Han et al., 2018) and $\mathbf { C o }$ -teaching plus (Yu et al., 2019) have been proposed to train DNNs robustly against label noise. There are two DNNs which select samples with small loss from noisy training sets to train each other. Our method is similar to theirs to some extent because LP is utilized by us to select true-labeled samples from Gradients descent $\mathcal { D } _ { t r a i n }$ for training. However, instead of taking the nodes with small loss as true-labeled nodes, we select the nodes $\mathcal { D } _ { s e l e c t }$ whose original labels are same with pseudo labels for training. Original labels of $\mathcal { D } _ { s e l e c t }$ are credible and we also inject them to initial clean sets $\mathcal { D } _ { c l e a n }$ for better LP in next epoch. This is why our method can achieve better performance even if few true-labeled nodes are provided.
81
+
82
+ # 3.3 META-LEARNING BASED LABEL AGGREGATION
83
+
84
+ ![](images/459eb21005021877ff65bf3593cb8c4eb0cf30cf0af655437c1a8af9d5e2b904.jpg)
85
+ Figure 2: Computation graph of meta-learning based label aggregation.
86
+
87
+ In section 3.2, the selected training nodes (node 5,7 in Figure.1) have been utilized for training and LP but the left training nodes $\mathcal { D } _ { l e f t }$ (node 6,8,9,10 in Figure.1) with abundant information haven’t been fully exploited. In this section, we mine the abundant and precious information from $\mathcal { D } _ { l e f t }$ via meta learning. The computation process of label aggregation is shown in Figure. 2.
88
+
89
+ For $\forall ( x _ { j } , y _ { j } ) \in \mathcal { D } _ { l e f t }$ , we can get two loss values:
90
+
91
+ $$
92
+ \begin{array} { r } { l _ { 1 } = l o s s ( \hat { y } _ { j } , y _ { j } ) , } \\ { l _ { 2 } = l o s s ( \hat { y } _ { j } , \tilde { y } _ { j } ) , } \end{array}
93
+ $$
94
+
95
+ where $\hat { y } _ { j }$ is the label predicted by GNNs for training node $j$ and $\tilde { y } _ { j }$ is the pseudo label predicted by LP for node $j$ . We can also get final label ${ \overline { { y } } } _ { j }$ for node $j$ by aggregating original label $y _ { j }$ and pseudo label $\tilde { y } _ { j }$ :
96
+
97
+ $$
98
+ \overline { { y } } _ { j } = \lambda _ { j } y _ { j } + ( 1 - \lambda _ { j } ) \widetilde { y } _ { j } , \lambda _ { j } \in [ 0 , 1 ]
99
+ $$
100
+
101
+ where $\lambda$ is the aggregation coefficient. Some previous methods designed a weighting function mapping training loss to sample weights for noisy label problems (Kumar et al., 2010; Ren et al., 2018; Shu et al., 2019). Instead, we utilize a 3-layer multi-layer perceptron (MLP) as the aggregation network $g ( \cdot ; \cdot )$ to map loss values to aggregation coefficient $\lambda _ { j }$ :
102
+
103
+ $$
104
+ \lambda _ { j } = g ( l _ { 1 } \parallel l _ { 2 } ; \theta ) = \lambda _ { j } ( \theta ; w ) ,
105
+ $$
106
+
107
+ Where $l _ { 1 } \parallel l _ { 2 }$ is a 2-dimensional vector which is the concatenation of $l _ { 1 }$ and $l _ { 2 }$ and $\theta$ is the weights of aggregation network $g$ . The rationality lies on a consensus that samples’ loss values are affiliated with the credibility of samples’ original labels (Kumar et al., 2010; Shu et al., 2019; Yu et al., 2019). The MLP or aggregation networks’ input layer are 2 neurons and its output layer is one neuron, which can be an approximator to almost any continuous functions. The activation function of the last layer is sigmoid function to ensure that output $\lambda _ { j } \in [ 0 , 1 ]$ . We can get the training loss $L _ { j } ^ { t r }$ for node $j$ :
108
+
109
+ $$
110
+ L _ { j } ^ { t r } ( w , \theta ) = l o s s ( \hat { y } _ { j } ( w ) , \overline { { y } } _ { j } ( \theta ) ) ,
111
+ $$
112
+
113
+ Then we can backward on the GNNs:
114
+
115
+ $$
116
+ \hat { w } _ { t } \big ( \theta _ { t } \big ) = w _ { t } - \frac { \alpha } { \mid \mathcal { D } _ { l e f t } \mid } \sum _ { ( x _ { j } , y _ { j } ) \in \mathcal { D } _ { l e f t } } \nabla _ { w } L _ { j } ^ { t r } \big ( w , \theta _ { t } \big ) | _ { w _ { t } } ,
117
+ $$
118
+
119
+ where $\alpha$ is the learning rate of GNNs. Then we can get the loss $L ^ { c }$ on clean sets $\mathcal { D } _ { c l e a n }$
120
+
121
+ $$
122
+ L ^ { c } ( \hat { w } _ { t } ( \theta _ { t } ) ) = \frac { 1 } { | \mathcal { D } _ { c l e a n } ~ | } \sum _ { ( x _ { i } , y _ { i } ) \in \mathcal { D } _ { c l e a n } } l o s s ( f ( x _ { i } ; \hat { w } _ { t } ( \theta _ { t } ) ) , y _ { i } ) ,
123
+ $$
124
+
125
+ Where $f ( x _ { i } ; \hat { w } _ { t } ( \theta _ { t } ) )$ is the output of GNNs. Then we can utilize $L ^ { c }$ to update the weights of aggregation network:
126
+
127
+ $$
128
+ \theta _ { t + 1 } = \theta _ { t } - \beta \nabla _ { \theta } L ^ { c } ( \hat { w } ( \theta ) ) | _ { \theta _ { t } } ,
129
+ $$
130
+
131
+ where $\beta$ is the learning rate of aggregation network. Finally, GNNs’ weights can be updated:
132
+
133
+ $$
134
+ w _ { t + 1 } = w _ { t } - \frac { \alpha } { | \mathcal { D } _ { l e f t } ~ | } \sum _ { ( x _ { j } , y _ { j } ) \in \mathcal { D } _ { l e f t } } \nabla _ { w } L _ { j } ^ { t r } ( w , \theta _ { t + 1 } ) | _ { w _ { t } } .
135
+ $$
136
+
137
+ To some extent, this part is similar to re-weight based methods (Ren et al., 2018; Shu et al., 2019). However, LPM has two significant advantages. Firstly, re-weight based methods can not remove the damages caused by incorrect labels because they assign every noisy training sample a positive weight while LPM potentially has the ability to take full advantage of noisy samples positively. Secondly, LPM can generate comparatively credible labels for other usages while re-weight or some other methods can not. Algorithm. 1 shows all the steps of our algorithm.
138
+
139
+ # 3.4 CONVERGENCE OF LPM
140
+
141
+ Here we show theoretically that the loss functions will converge to critical points under some mild conditions. The detailed proof of the following theorems will be provided in Appendix C.
142
+
143
+ Theorem 1 Suppose the loss function loss is $L$ -Lipschitz smooth, and $\lambda ( \cdot )$ is differential with a $\delta$ - bounded gradient, twice differential with its Hessian bounded by $\boldsymbol { B }$ with respect to $\theta$ . Let the learning rate $\alpha _ { t } = \operatorname* { m i n } \{ 1 , { \frac { k } { T } } \}$ , for some $k > 0$ , such that $\begin{array} { r } { { \frac { k } { T } } < 1 } \end{array}$ and learning rate $\beta _ { t }$ a monotone descent sequence, $\begin{array} { r } { \beta _ { t } = \operatorname* { m i n } \{ \frac { 1 } { L } , \frac { c } { \sqrt { T } } \} } \end{array}$ for some $c > 0$ , such that $L \leq { \frac { c } { \sqrt { T } } }$ and $\begin{array} { r } { \sum _ { t = 1 } ^ { \infty } \beta _ { t } \le \infty , \sum _ { t = 1 } ^ { \infty } \beta _ { t } ^ { 2 } \le } \end{array}$ $\infty$ . Then the clean loss of Aggregation Net can achieve $\| \nabla _ { \theta } L ^ { c } ( \hat { w } ( \theta _ { t } ) ) \| _ { 2 } ^ { 2 } \le \epsilon$ in $\mathcal { O } ( 1 / \epsilon ^ { 2 } )$ steps. More specifically,
144
+
145
+ $$
146
+ \operatorname* { m i n } _ { 0 \leq t \leq T } \| \nabla _ { \boldsymbol { \theta } } L ^ { c } ( \hat { w } ( \boldsymbol { \theta } _ { t } ) ) \| _ { 2 } ^ { 2 } \leq \mathcal { O } ( \frac { C } { \sqrt { T } } ) .
147
+ $$
148
+
149
+ Theorem 2 Under the conditions of Theorem $^ { l }$ , with the gradient of loss bounded by $\rho$ , then
150
+
151
+ $$
152
+ \operatorname* { l i m } _ { t \to \infty } \| \nabla _ { w _ { t } } L ^ { t r } ( w _ { t } , \theta _ { t + 1 } ) \| _ { 2 } ^ { 2 } = 0 .
153
+ $$
154
+
155
+ Algorithm 1: LPM. Line 2-12: label propagation; Line 13-22: label aggregation.
156
+ Data: $\overline { { \mathcal { D } , \mathcal { D } _ { t r a i n } , \mathcal { D } _ { c l e a n } } }$ , max epochs $T$ , LP iterations $K$ in every epoch, $A$ ,feature matrix
157
+ $\mathcal { X }$ ,GNNs feature extractor $f$ , Aggregation Network $g$ , expanding clean set for LP $\cdot$
158
+ Result: Robust GNNs parameters $w _ { T }$
159
+ 1 Dc = Dclean
160
+ 2 for $t = 0 , 1 , 2 , . . . , T - 1$ do
161
+ 3 for $\forall v \in \mathcal { D }$ do $h _ { v } = f ( x _ { v } ; w _ { t } )$ ;
162
+ 4 for (i, j) ∈ {1, 2, ..., n}2 do Wi,j = Ai,jd(hi,hj )+ε ;
163
+ 5 $\left| \begin{array} { l } { \begin{array} { r l } { Y ^ { ( k + 1 ) } = D ^ { - 1 / 2 } W D ^ { - 1 / 2 } Y ^ { ( k ) } , y _ { j } ^ { ( k + 1 ) } = y _ { j } ^ { ( 0 ) } ( \forall \bmod { e } \ j \in \mathcal { D } _ { c } ) } \end{array} } \end{array} \right.$ $k = 0 , 1 , 2 , . . . , K - 1$
164
+ 7 end
165
+ 8 $\mathcal { D } _ { s e l e c t } = \mathcal { D } _ { l e f t } = \emptyset$ ;
166
+ 9 for ∀ node $i \in \mathcal { D } _ { t r a i n }$ do
167
+ 10 if onehot $( y _ { i } ^ { ( K ) } ) = y _ { i }$ do $\mathcal { D } _ { s e l e c t } =$ node $\{ i \} \cup \mathcal { D } _ { s e l e c t }$ ;
168
+ 11 else do $\mathcal { D } _ { l e f t } = \mathrm { n o d }$ e $\{ i \} \cup \mathcal { D } _ { l e f t }$ ;
169
+ 12 end
170
+ 13 $-$
171
+ 14 $w _ { t } \gets$ one-step optimization of $w _ { t }$ with the selected nodes $\mathcal { D } _ { s e l e c t }$ ;
172
+ 15 for $\forall$ node $j \in \mathcal { D } _ { l e f t }$ do
173
+ 16 $\hat { y } _ { j } = f ( x _ { j } ; w _ { t } )$ ;
174
+ 17 $\bar { l _ { 1 } } = l o s s ( \hat { y } _ { j } , y _ { j } ) ; l _ { 2 } = l o s s ( \hat { y } _ { j } , \tilde { y } _ { j } ) ;$ ;
175
+ 18 $\lambda _ { j } = g ( l _ { 1 } \parallel \bar { l } _ { 2 } ; \bar { \theta } _ { t } )$ ;
176
+ 19 $\overline { { y } } _ { j } = \lambda _ { j } y _ { j } + ( 1 - \lambda _ { j } ) \widetilde { y } _ { j } , \lambda _ { j } \in [ 0 , 1 ] ; L _ { j } ^ { t r } ( w , \theta ) = l o s s ( \widehat { y } _ { j } ( w ) , \overline { { y } } _ { j } ( \theta ) ) ;$
177
+ 20 end
178
+ 21 $\begin{array} { r } { \hat { w } _ { t } ( \theta _ { t } ) = w _ { t } - \frac { \alpha } { | \mathcal { D } _ { l e f t } | } \sum _ { ( x _ { j } , y _ { j } ) \in \mathcal { D } _ { l e f t } } \nabla _ { w } L _ { j } ^ { t r } ( w , \theta _ { t } ) | _ { w _ { t } } ; } \end{array}$
179
+ 22 $\begin{array} { r } { L ^ { c } ( \hat { w } _ { t } ( \boldsymbol { \theta } _ { t } ) ) = \frac { 1 } { | \mathcal { D } _ { c l e a n } | } \sum _ { ( \boldsymbol { x } _ { i } , \boldsymbol { y } _ { i } ) \in \mathcal { D } _ { c l e a n } } l o s s ( f ( \boldsymbol { x } _ { i } ; \boldsymbol { \hat { w } } _ { t } ( \boldsymbol { \theta } _ { t } ) ) , \boldsymbol { y } _ { i } ) . } \end{array}$ | P(xi,yi)∈Dclean l ;
180
+ 23 $\theta _ { t + 1 } = \theta _ { t } - \beta \nabla _ { \theta } L ^ { c } ( \hat { w } ( \theta ) ) | _ { \theta _ { t } }$ ;
181
+ 24 $\begin{array} { r } { w _ { t + 1 } = w _ { t } - \frac { \alpha } { | \mathscr { D } _ { l e f t } | } \sum _ { ( x _ { j } , y _ { j } ) \in \mathscr { D } _ { l e f t } } \nabla _ { w } L _ { j } ^ { t r } ( w ; \theta _ { t + 1 } ) | _ { w _ { t } } . } \end{array}$
182
+
183
+ 25 end
184
+
185
+ # 4 EXPERIMENTS
186
+
187
+ # 4.1 DATASETS AND IMPLEMENTATION DETAILS
188
+
189
+ We validate our method on six benchmark datasets, namely citation networks (Sen et al., 2008) including Cora, Citeseer and Pubmed. Coauthor-Phy dataset (Shchur et al., 2018) is also utilized in our experiments, but the results are shown in Appendix A due to the limited space. Summary of the graph datasets mentioned above are shown in Table. 1. The Clothing1M (Xiao et al., 2015) and Webvision (Li et al., 2017a) dataset are utilized to validate the effectiveness of our method in real-world label noise settings. We take a $k \mathbf { N N }$ graph $k = 5$ ) as the graph structure so that GNNs can be applied in these two datasets, which follows previous work (Franceschi et al., 2019). More details about our preprocessing on Clothing1M and Webvision datasets can be seen in Appendix B.
190
+
191
+ The experiments are conducted with two types of label noise: uniform noise and flip noise following previous works (Zhang et al., 2016a; Shu et al., 2019). The former means that the label of each sample is independently changed to a random class with probability $p$ , and the latter means that the label is independently flipped to a similar class with total probability $p$ . The ratio of training, validation, and test nodes are set as 4:4:2. Only nearly 25 nodes with clean labels in the validation set are provided as the clean set in each dataset and we ensure that each class has the same number of samples. For example, we use 8 clean samples per label class for Pubmed. GCN (Kipf & Welling, 2016) serves as the base classification network model in our experiments and it is trained using Adam (Kingma & Ba, 2014) with an initial learning rate 0.01 and a weight decay $5 \times 1 0 ^ { - 4 }$ , except that the weight decay equals to 0 in Clothing1M and Coauthor-Phy datasets.
192
+
193
+ We compare LPM with multiple baselines using the same network architecture. These baselines are typical and some of them achieve state-of-the-arts performance on image datasets, which include:
194
+
195
+ Table 1: Dataset statistics after removing self-loops and duplicate edges (Wang & Leskovec, 2020)
196
+
197
+ <table><tr><td></td><td>Cora</td><td>Citeseer</td><td>Pubmed</td><td>Coauthor-Phy</td></tr><tr><td>#nodes</td><td>2708</td><td>3327</td><td>19717</td><td>34493</td></tr><tr><td>#edges</td><td>5278</td><td>4552</td><td>44324</td><td>247962</td></tr><tr><td>#features</td><td>1433</td><td>3703</td><td>500</td><td>8415</td></tr><tr><td>#classes</td><td>7</td><td>6</td><td>3</td><td>5</td></tr><tr><td>#Intra-class edge rate</td><td>81.0%</td><td>73.6%</td><td>80.2%</td><td>93.1%</td></tr></table>
198
+
199
+ Table 2: Comparison with baselines in test accuracy $( \% )$ on Cora and Citeseer with uniform noise ranging from $0 \%$ to $80 \%$ . Mean accuracy (std) over 5 repetitions are reported. The best and the second best results are highlighted in bold and italic bold respectively.
200
+
201
+ <table><tr><td>Datasets</td><td colspan="5">Cora</td><td colspan="5">Citeseer</td></tr><tr><td>Method/noise rate</td><td>0.0</td><td>0.2</td><td>0.4</td><td>0.6</td><td>0.8</td><td>0.0</td><td>0.2</td><td>0.4</td><td>0.6</td><td>0.8</td></tr><tr><td>Basemodel</td><td>87.84 (0.04)</td><td>85.92 (0.10)</td><td>82.42 (0.13)</td><td>75.77 (0.18)</td><td>56.32 (0.19)</td><td>77.67 (0.13)</td><td>76.06 (0.15)</td><td>72.97 (0.09)</td><td>67.98 (0.12)</td><td>55.26 (0.22)</td></tr><tr><td>GCN+FT</td><td>88.05 (0.06)</td><td>86.07 (0.13)</td><td>82.48 (0.14)</td><td>75.88 (0.15)</td><td>58.81(0.22)</td><td>77.86 (0.15)</td><td>76.24 (0.07)</td><td>73.42 (0.21)</td><td>68.13 (0.19)</td><td>56.12 (0.28)</td></tr><tr><td>L2RW</td><td>88.84 (0.19)</td><td>85.10 (0.21)</td><td>80.67 (0.22)</td><td>73.43 (0.42)</td><td>50.09 (0.37)</td><td>76.73 (0.20)</td><td>73.68 (0.14)</td><td>69.93 (0.29)</td><td>62.31(0.32)</td><td>46.55 (0.49)</td></tr><tr><td>Co-teaching plus + FT</td><td>86.76 (0.14)</td><td>83.03 (0.19)</td><td>71.68 (0.21)</td><td>50.05 (0.31)</td><td>36.39 (0.44)</td><td>76.28 (0.19)</td><td>75.49 (0.24)</td><td>72.71 (0.13)</td><td>66.63 (0.41)</td><td>56.27 (0.36)</td></tr><tr><td>MW-Nets</td><td>88.33 (0.16)</td><td>85.93 (0.22)</td><td>82.61 (0.45)</td><td>75.60 (0.41)</td><td>56.37 (0.51)</td><td>78.27 (0.12)</td><td>76.62 (0.14)</td><td>74.25 (0.21)</td><td>68.06 (0.25)</td><td>56.53 (0.45)</td></tr><tr><td>GCEloss+FT</td><td>87.87 (0.13)</td><td>85.10 (0.09)</td><td>82.89 (0.07)</td><td>76.16 (0.15)</td><td>60.43 (0.21)</td><td>78.01 (0.12)</td><td>76.54 (0.09)</td><td>74.06 (0.18)</td><td>69.18 (0.24)</td><td>58.48 (0.31)</td></tr><tr><td>APL+FT</td><td>87.68 (0.08)</td><td>86.26 (0.05)</td><td>82.01 (0.13)</td><td>74.49 (0.19)</td><td>58.72 (0.25)</td><td>76.54 (0.08)</td><td>74.32 (0.17)</td><td>71.77 (0.15)</td><td>66.78 (0.22)</td><td>56.08 (0.34)</td></tr><tr><td>Ours</td><td>88.75 (0.07)</td><td>87.46 (0.11)</td><td>83.95 (0.15)</td><td>79.66 (0.22)</td><td>63.38 (0.27)</td><td>78.12 (0.13)</td><td>77.07 (0.06)</td><td>75.19 (0.15)</td><td>70.05 (0.11)</td><td>61.71 (0.22)</td></tr></table>
202
+
203
+ Base model, referring to the GCN that directly trained on noisy training nodes; Meta-learning based methods L2RW (Ren et al., 2018), MW-Nets (Shu et al., 2019); Typical and effective method Co-teaching plus (Yu et al., 2019); Robust loss function against label noise GCE loss (Zhang & Sabuncu, 2018) and APL (Ma et al., 2020); The most recent method based on co-training JoCoR (Wei et al., 2020). For those baselines that don’t need clean sets (Base model, Co-teaching plus, GCE loss, JoCoR and APL), we finetune (denoted by FT in this paper) them on the initial clean sets after the model was trained on training sets for a fair comparison. More experimental details about LPM and all baselines are available in the Appendix B.
204
+
205
+ # 4.2 RESULTS
206
+
207
+ Table. 2 shows the results on Cora and Citeseer with different levels of uniform noise ranging from $0 \%$ to $80 \%$ . Every experiment are repeated 5 times with different random seeds. Finally, we report the best test accuracy across all epochs averaged over 5 repetitions for each experiment. As can be seen in Table. 2, our method gets the best performance across all the datasets and all noise rates, except the second for $0 \%$ uniform noise rate. Our method performs even better when the labels are corrupted at high rate. Table. 3 shows the performance on Cora, Citeseer and Pubmed with different levels of flip noise ranging from $0 \%$ to $40 \%$ . It can be seen that our method also outperforms state-of-the-arts methods under flip noise across different noise rate, except that the second for $0 \%$ flip noise rate. Our method outperforms the corresponding second best method by a large margin when the noise rate is 0.4. As can be seen in Table. 4, our method can also perform better than other baselines in datasets with real-world label noise. We also experiment with Graph Attention Networks (Velickovic et al., 2017) as the feature extractor and classifier, the results shown in Appendix A demonstrate that our method can also perform well with other GNNs.
208
+
209
+ Table 3: Comparison with baselines in test accuracy $( \% )$ on Cora , Citeseer and Pubmed with flip noise ranging from $0 \%$ to $40 \%$ . Mean accuracy (std) over 5 repetitions are reported. The best and the second best results are highlighted in bold and italic bold respectively.
210
+
211
+ <table><tr><td>Datasets</td><td colspan="3">Cora</td><td colspan="3">Citeseer</td><td colspan="3">Pubmed</td></tr><tr><td>Method/noise rate</td><td>0</td><td>0.2</td><td>0.4</td><td>0</td><td>0.2</td><td>0.4</td><td>0</td><td>0.2</td><td>0.4</td></tr><tr><td>Basemodel</td><td>87.84 (0.04)</td><td>81.64 (0.11)</td><td>61.12 (0.24)</td><td>77.67 (0.13)</td><td>75.91 (0.14)</td><td>52.67 (0.35)</td><td>86.18 (0.08)</td><td>85.30 (0.21)</td><td>74.21 (0.29)</td></tr><tr><td>GCN+FT</td><td>88.05 (0.06)</td><td>82.89 (0.14)</td><td>67.39 (0.42)</td><td>77.86 (0.15)</td><td>75.08 (0.22)</td><td>61.41 (0.23)</td><td>86.21 (0.09)</td><td>85.55 (0.24)</td><td>80.88 (0.32)</td></tr><tr><td>L2RW</td><td>88.84 (0.19)</td><td>80.90 (0.21)</td><td>59.00 (0.34)</td><td>76.73 (0.20)</td><td>71.85 (0.25)</td><td>50.04 (0.44)</td><td>86.34 (0.14)</td><td>84.54 (0.19)</td><td>76.97 (0.31)</td></tr><tr><td>Co-teaching plus+FT</td><td>86.76 (0.14)</td><td>81.37 (0.21)</td><td>53.00 (0.51)</td><td>76.28 (0.19)</td><td>74.66 (0.21)</td><td>60.59 (0.33)</td><td>85.59 (0.09)</td><td>84.61 (0.22)</td><td>73.99 (0.33)</td></tr><tr><td>MW-Nets</td><td>88.33 (0.16)</td><td>85.33 (0.23)</td><td>67.71 (0.43)</td><td>78.27 (0.12)</td><td>76.84 (0.19)</td><td>61.97 (0.33)</td><td>86.02 (0.07)</td><td>84.74 (0.17)</td><td>78.59 (0.28)</td></tr><tr><td>GCEloss+FT</td><td>87.87 (0.13)</td><td>83.21 (0.13)</td><td>67.80 (0.37)</td><td>78.01 (0.12)</td><td>76.36 (0.20)</td><td>63.66 (0.46)</td><td>86.15 (0.11)</td><td>85.47 (0.06)</td><td>80.03 (0.42)</td></tr><tr><td>APL+FT</td><td>87.68 (0.08)</td><td>81.09 (0.14)</td><td>70.07 (0.19)</td><td>76.54 (0.08)</td><td>73.38 (0.13)</td><td>60.81 (0.52)</td><td>86.16 (0.05)</td><td>85.52 (0.06)</td><td>70.08 (0.16)</td></tr><tr><td>Ours</td><td>88.75 (0.07)</td><td>86.95 (0.12)</td><td>78.97 (0.33)</td><td>78.12 (0.13)</td><td>76.39 (0.14)</td><td>69.71 (0.39)</td><td>86.48 (0.05)</td><td>85.58 (0.13)</td><td>83.15 (0.36)</td></tr></table>
212
+
213
+ Table 4: Comparison with baselines in test accuracy $( \% )$ on Clothing1M and Webvision. Mean accuracy $\pm$ std) over 5 repetitions are reported. The best is highlighted in bold.
214
+
215
+ <table><tr><td>Methods</td><td>Basemodel</td><td>GCN+FT</td><td>L2RW</td><td>MW-Nets</td><td>GCEloss+FT</td><td>JoCoR+FT</td><td>Ours</td></tr><tr><td>Clothing1M</td><td>35.83±0.03</td><td>38.05±0.13</td><td>53.5±0.08</td><td>54.15±0.23</td><td>56.9±0.08</td><td>56.3±0.12</td><td>57.35±0.11</td></tr><tr><td>Webvision</td><td>32.43±0.05</td><td>34.58±0.08</td><td>50.12±0.16</td><td>52.42±0.25</td><td>53.45±0.13</td><td>54.12±0.22</td><td>55.43±0.17</td></tr></table>
216
+
217
+ ![](images/08f88f4348654662facdd2e5ddebef946582e909d05aae0475024c1ae7459de1.jpg)
218
+ Figure 3: Comparsion of the true-labeled samples rate in $\mathcal { D } _ { t r a i n }$ and $\mathcal { D } _ { s e l e c t }$ in various datasets.
219
+
220
+ Table 5: The performance of LPM without label aggregation and LPM with random $\lambda$ in Citeseer.
221
+
222
+ <table><tr><td>Noise type</td><td colspan="5">Uniform noise</td><td colspan="2">Flip noise</td></tr><tr><td>Method/noise rate</td><td>0</td><td>0.2</td><td>0.4</td><td>0.6</td><td>0.8</td><td>0.2</td><td>0.4</td></tr><tr><td>Ours w/o label aggregation</td><td>72.07</td><td>68.36</td><td>65.69</td><td>62.16</td><td>54.39</td><td>69.26</td><td>63.14</td></tr><tr><td>Ours with random 入</td><td>76.88</td><td>75.08</td><td>72.07</td><td>68.28</td><td>57.40</td><td>74.89</td><td>68.30</td></tr><tr><td> Ours with tuned 入</td><td>77.22</td><td>76.31</td><td>73.55</td><td>69.17</td><td>58.54</td><td>75.11</td><td>68.72</td></tr><tr><td>Ours</td><td>78.12</td><td>77.07</td><td>75.19</td><td>70.05</td><td>61.71</td><td>76.39</td><td>69.71</td></tr></table>
223
+
224
+ # 4.3 ANALYSIS OF THE NECESSITY AND EFFECTIVENESS OF DIFFERENT PARTS
225
+
226
+ We design five experiments to validate the necessity and effectiveness of different components of our algorithm. Firstly, we compare the ratio of truelabeled nodes in $\mathcal { D } _ { s e l e c t }$ with $\mathcal { D } _ { t r a i n }$ in the last epoch to validate the effectiveness of LP. Figure. 3 shows the ratio of true-labeled nodes in $\mathcal { D } _ { s e l e c t }$ in the last epoch and $\mathcal { D } _ { t r a i n }$ under uniform noise on various datasets. It can be found that nearly all the nodes selected by LP are true-labeled even if most training nodes are mislabeled, which demonstrates the great ability of LP to select true-labeled nodes from noisy training nodes. Secondly, we remove the label aggregation in LPM to validate its necessity and the result shows that the performance of our method become much worse without label aggregation. It is necessary to mine the potential information from the left noisy training nodes after LP selection. Besides, we validate the effectiveness by replacing the learned aggregation coefficients $\lambda$ with random numbers between 0 and 1. It is obvious that the aggregation coefficients $\lambda$ optimized by meta learning outperform random $\lambda$ . Also, we assign the percentage of clean nodes of each label class as $\cdot$ (tuned) for comparison. These validate the effectiveness of the meta-learning based label aggregation. The results of above two experiments are shown in Table. 5. We denote the average of $\cdot$ of clean nodes and noisy nodes in $\mathscr { D } _ { l e f t }$ as $\lambda _ { c l e a n }$ and $\cdot$ respectively, $-$ . We plot the variation of $\cdot$ during training stage in Figure. 4. It can be observed that $\lambda _ { c l e a n } > \lambda _ { n o i s e }$ across the training stage and the margin between $\lambda _ { c l e a n }$ and $\cdot$ grows larger with the training process, which suggests that $\lambda$ optimized by our method is valid.
227
+
228
+ ![](images/03d0ba0eeaf7908606d67d6994c9e324d3478aaaa12f68fe51a7639ae44eb405.jpg)
229
+ Figure 4: $\Delta \lambda$ varies during the training stage on Cora with various uniform noise rate.
230
+
231
+ ![](images/018150531e5b3cc45a63032fb743dfbc7c5e2fde9850f52237b079339ae5ce1d.jpg)
232
+ Figure 5: Test accuracy on Cora and Citeseer across various flip noise rate.
233
+
234
+ # 4.4 IMPACT OF FINETUNING AND NOISE RATE
235
+
236
+ We would like to investigate how our baselines can perform without finetuning. As can be seen in Figure. 5, the performance of the baselines will degenerate relatively significantly without finetuning across different noise rate. This illustrates that some baselines (without finetuning) that are designed for image datasets may perform relatively poor on graph-structured data and this motivates our work which trains GNNs robustly utilizing the structure information of graph data. Besides, We can also observe that our method only drops nearly $9 \%$ when the flip noise rate increased from $0 \%$ to $40 \%$ , whereas the baseline has dropped nearly $2 0 \% - 3 0 \%$ , which illustrates that our method is more robust, especially at high noise rate. At $0 \%$ noise, our method only slightly underperforms reweights besed methods. This is reasonable because the original labels are all correct but our method will inevitably perturb a few clean labels while the re-weights based methods will not.
237
+
238
+ # 4.5 SIZE OF THE CLEAN SET
239
+
240
+ We try to strike a balance and understand when finetuning will be effective. As can be seen in Figure. 6, our method can also perform better even if the size of clean set is extremely small. The overall test accuracy does not grow much when the size of clean set is large enough. Besides, the test accuracy of baselines with fintuning will increase significantly when the size of clean set grows larger. This suggests that finetuning will be valid when the size of clean set grows larger because GNNs can achieve good performance with relatively less samples (Kipf & Welling, 2016; Velickovi ˇ c et al., 2017). From this perspective, our method can also serve as complementary for ´ finetuning based methods when the size of clean set is large enough.
241
+
242
+ ![](images/8e987b26205d135963820007bc9f624c5916d6a9b90e8d4260014e400b707c59.jpg)
243
+ Figure 6: Test accuracy on Cora and Citeseer across various size of clean set.
244
+
245
+ # 5 CONCLUSION AND FUTURE WORK
246
+
247
+ In this work, we proposed a robust framwork for GNNs against label noise. This is the first method that specially designed for label noise problem existing in utilizing GNNs to classify graph nodes and it outperforms state-of-the-arts methods in graph-structured data, which may serve as the beginning for future research towards robust GNNs against label noise. As a future work, we may design an inductive robust method. Besides, better methods that don’t need clean sets are also the goals of us.
248
+
249
+ # REFERENCES
250
+
251
+ Marcin Andrychowicz, Misha Denil, Sergio Gomez, Matthew W Hoffman, David Pfau, Tom Schaul, Brendan Shillingford, and Nando De Freitas. Learning to learn by gradient descent by gradient descent. In Advances in neural information processing systems, pp. 3981–3989, 2016.
252
+
253
+ Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. arXiv preprint arXiv:1703.03400, 2017.
254
+
255
+ Luca Franceschi, Mathias Niepert, Massimiliano Pontil, and Xiao He. Learning discrete structures for graph neural networks. arXiv preprint arXiv:1903.11960, 2019.
256
+
257
+ Chen Gong, Dacheng Tao, Wei Liu, Liu Liu, and Jie Yang. Label propagation via teaching-tolearn and learning-to-teach. IEEE transactions on neural networks and learning systems, 28(6): 1452–1465, 2016.
258
+
259
+ Chen Gong, Hengmin Zhang, Jian Yang, and Dacheng Tao. Learning with inadequate and incorrect supervision. In 2017 IEEE International Conference on Data Mining (ICDM), pp. 889–894. IEEE, 2017.
260
+
261
+ Edward Grefenstette, Brandon Amos, Denis Yarats, Phu Mon Htut, Artem Molchanov, Franziska Meier, Douwe Kiela, Kyunghyun Cho, and Soumith Chintala. Generalized inner loop metalearning. arXiv preprint arXiv:1910.01727, 2019.
262
+
263
+ Bo Han, Quanming Yao, Xingrui Yu, Gang Niu, Miao Xu, Weihua Hu, Ivor Tsang, and Masashi Sugiyama. Co-teaching: Robust training of deep neural networks with extremely noisy labels. In Advances in neural information processing systems, pp. 8527–8537, 2018.
264
+
265
+ Yifan Hou, Jian Zhang, James Cheng, Kaili Ma, Richard TB Ma, Hongzhi Chen, and Ming-Chang Yang. Measuring and improving the use of graph information in graph neural networks. In International Conference on Learning Representations, 2019.
266
+
267
+ Ahmet Iscen, Giorgos Tolias, Yannis Avrithis, and Ondrej Chum. Label propagation for deep semisupervised learning. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 5070–5079, 2019.
268
+
269
+ Simon Jenni and Paolo Favaro. Deep bilevel learning. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 618–633, 2018.
270
+
271
+ Masayuki Karasuyama and Hiroshi Mamitsuka. Manifold-based similarity adaptation for label propagation. In Advances in neural information processing systems, pp. 1547–1555, 2013.
272
+
273
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
274
+
275
+ Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. arXiv preprint arXiv:1609.02907, 2016.
276
+
277
+ M Pawan Kumar, Benjamin Packer, and Daphne Koller. Self-paced learning for latent variable models. In Advances in neural information processing systems, pp. 1189–1197, 2010.
278
+
279
+ Junnan Li, Yongkang Wong, Qi Zhao, and Mohan S Kankanhalli. Learning to learn from noisy labeled data. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5051–5059, 2019.
280
+
281
+ Wen Li, Limin Wang, Wei Li, Eirikur Agustsson, and Luc Van Gool. Webvision database: Visual learning and understanding from web data. arXiv preprint arXiv:1708.02862, 2017a.
282
+
283
+ Yuncheng Li, Jianchao Yang, Yale Song, Liangliang Cao, Jiebo Luo, and Li-Jia Li. Learning from noisy labels with distillation. In Proceedings of the IEEE International Conference on Computer Vision, pp. 1910–1918, 2017b.
284
+
285
+ Yanbin Liu, Juho Lee, Minseop Park, Saehoon Kim, Eunho Yang, Sung Ju Hwang, and Yi Yang. Learning to propagate labels: Transductive propagation network for few-shot learning. arXiv preprint arXiv:1805.10002, 2018.
286
+
287
+ Xingjun Ma, Hanxun Huang, Yisen Wang, Simone Romano, Sarah Erfani, and James Bailey. Normalized loss functions for deep learning with noisy labels. arXiv preprint arXiv:2006.13554, 2020.
288
+
289
+ Hyoungseob Park, Minki Jeong, Youngeun Kim, and Changick Kim. Self-training of graph neural networks using similarity reference for robust training with noisy labels. In 2020 IEEE International Conference on Image Processing (ICIP), pp. 1951–1955. IEEE, 2020.
290
+
291
+ Mengye Ren, Wenyuan Zeng, Bin Yang, and Raquel Urtasun. Learning to reweight examples for robust deep learning. arXiv preprint arXiv:1803.09050, 2018.
292
+
293
+ Prithviraj Sen, Galileo Namata, Mustafa Bilgic, Lise Getoor, Brian Galligher, and Tina Eliassi-Rad. Collective classification in network data. AI magazine, 29(3):93–93, 2008.
294
+
295
+ Oleksandr Shchur, Maximilian Mumme, Aleksandar Bojchevski, and Stephan Gunnemann. Pitfalls ¨ of graph neural network evaluation. arXiv preprint arXiv:1811.05868, 2018.
296
+
297
+ Jun Shu, Qi Xie, Lixuan Yi, Qian Zhao, Sanping Zhou, Zongben Xu, and Deyu Meng. Meta-weightnet: Learning an explicit mapping for sample weighting. In Advances in Neural Information Processing Systems, pp. 1919–1930, 2019.
298
+
299
+ Petar Velickovic, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua Bengio. Graph attention networks. arXiv: Machine Learning, 2017.
300
+
301
+ Petar Velickovi ˇ c, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua ´ Bengio. Graph attention networks. arXiv preprint arXiv:1710.10903, 2017.
302
+
303
+ Fei Wang and Changshui Zhang. Label propagation through linear neighborhoods. IEEE Transactions on Knowledge and Data Engineering, 20(1):55–67, 2007.
304
+
305
+ Hongwei Wang and Jure Leskovec. Unifying graph convolutional neural networks and label propagation. arXiv preprint arXiv:2002.06755, 2020.
306
+
307
+ Hongxin Wei, Lei Feng, Xiangyu Chen, and Bo An. Combating noisy labels by agreement: A joint training method with co-regularization. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2020.
308
+
309
+ Tong Xiao, Tian Xia, Yi Yang, Chang Huang, and Xiaogang Wang. Learning from massive noisy labeled data for image classification. pp. 2691–2699, 2015.
310
+
311
+ Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? arXiv preprint arXiv:1810.00826, 2018.
312
+
313
+ Xingrui Yu, Bo Han, Jiangchao Yao, Gang Niu, Ivor W Tsang, and Masashi Sugiyama. How does disagreement help generalization against label corruption? arXiv preprint arXiv:1901.04215, 2019.
314
+
315
+ Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. arXiv preprint arXiv:1611.03530, 2016a.
316
+
317
+ Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. arXiv preprint arXiv:1611.03530, 2016b.
318
+
319
+ Huan Zhang, Zhao Zhang, Mingbo Zhao, Qiaolin Ye, Min Zhang, and Meng Wang. Robust triplematrix-recovery-based auto-weighted label propagation for classification. IEEE Transactions on Neural Networks and Learning Systems, 2020.
320
+
321
+ Zhilu Zhang and Mert Sabuncu. Generalized cross entropy loss for training deep neural networks with noisy labels. In Advances in neural information processing systems, pp. 8778–8788, 2018.
322
+
323
+ Dengyong Zhou, Olivier Bousquet, Thomas N Lal, Jason Weston, and Bernhard Scholkopf. Learn- ¨ ing with local and global consistency. In Advances in neural information processing systems, pp. 321–328, 2004.
324
+
325
+ Xiaojin Zhu, John Lafferty, and Ronald Rosenfeld. Semi-supervised learning with graphs. PhD thesis, Carnegie Mellon University, language technologies institute, school of . . . , 2005.
326
+
327
+ # A APPENDIX : ADDITIONAL EXPERIMENT RESULTS
328
+
329
+ Table A.6: Comparison with baselines in test accuracy $( \% )$ on Cora and Pubmed with flip noise ranging from $0 \%$ to $40 \%$ and Graph Attention Networks. The best result are highlighted in bold.
330
+
331
+ <table><tr><td>Datasets</td><td colspan="3">Cora</td><td colspan="3">Pubmed</td></tr><tr><td>Methods/Noise rate</td><td>0</td><td>0.2</td><td>0.4</td><td>0</td><td>0.2</td><td>0.4</td></tr><tr><td>GAT</td><td>89.85</td><td>84.13</td><td>67.10</td><td>85.55</td><td>84.57</td><td>74.11</td></tr><tr><td>GAT+FT</td><td>89.85</td><td>84.50</td><td>73.12</td><td>85.55</td><td>84.57</td><td>80.55</td></tr><tr><td>MW-Nets</td><td>87.52</td><td>84.26</td><td>69.99</td><td>85.64</td><td>84.5</td><td>75.82</td></tr><tr><td>Co-teaching plus+FT</td><td>88.56</td><td>85.42</td><td>74.94</td><td>85.56</td><td>84.48</td><td>82.40</td></tr><tr><td>GCEloss+FT</td><td>89.98</td><td>84.38</td><td>74.23</td><td>85.45</td><td>84.54</td><td>80.65</td></tr><tr><td>JoCoR+FT</td><td>90.16</td><td>85.00</td><td>73.74</td><td>85.47</td><td>84.58</td><td>80.95</td></tr><tr><td>Ours</td><td>89.92</td><td>87.20</td><td>75.65</td><td>85.72</td><td>84.62</td><td>83.00</td></tr></table>
332
+
333
+ Table A.7: Comparison with baselines in test accuracy $( \% )$ on Coauthor-Phy with flip noise ranging from $0 \%$ to $40 \%$ . The best result are highlighted in bold.
334
+
335
+ <table><tr><td>Method/Noise rate</td><td>0.0</td><td>0.1</td><td>0.2</td><td>0.3</td><td>0.4</td></tr><tr><td>Basemodel</td><td>96.92</td><td>96.32</td><td>95.57</td><td>94.91</td><td>86.25</td></tr><tr><td>GCN+FT</td><td>96.96</td><td>96.41</td><td>95.54</td><td>94.46</td><td>92.25</td></tr><tr><td>Co-teaching plus+FT</td><td>96.45</td><td>96.39</td><td>96.10</td><td>95.27</td><td>92.79</td></tr><tr><td>MW-Nets</td><td>96.56</td><td>96.24</td><td>95.62</td><td>95.56</td><td>89.25</td></tr><tr><td>GCEloss+FT</td><td>96.99</td><td>96.58</td><td>95.96</td><td>94.77</td><td>93.64</td></tr><tr><td>JoCoR+FT</td><td>96.83</td><td>96.59</td><td>96.07</td><td>94.95</td><td>94.11</td></tr><tr><td>Ours</td><td>96.75</td><td>96.71</td><td>96.49</td><td>96.14</td><td>95.14</td></tr></table>
336
+
337
+ We also take Graph Attention Networks (GAT) as the feature extractor and classifier and the results shown in Table. A.6 validate that our method can also perform well with various GNNs. Besides, LPM can also perform better than other baselines in larger graph dataset Coauthor-Phy, the results can be seen in Table. A.7. We also demonstrate confusion matrices of Basemodel and LPM in Figure. A.4, which visually show that our method can improve the robustness against label noise of GNNs by a large margin.
338
+
339
+ # B APPENDIX : ADDITIONAL DETAILS OF OUR EXPERIMENTS
340
+
341
+ Original Clothing1M and Webvision datasets are all large-scale datasets with real-world label noise. We randomly choose 5000 images in 10 classes from original datasets and every image serves as a node in the graph, a kNN graph $\left( \mathrm { k } \mathrm { = } 5 \right)$ is treated as the graph structure so that GNNs can be applied in Clothing1M datasets. This setting is similar to some previous works which also aim to apply GNNs in datasets without graph structure. ResNet-50 with ImageNet pretrained weights is utilized by us to extract feature vectors for all the images.
342
+
343
+ Table. A.8 shows the different hyper-parameters in LPM experiments for different datasets. In all the experiments, 25 true-labeled nodes are utilized as the initial clean sets or as the samples for finetuning and the total epoch of all the experiments is 300. In Co-teaching plus experiment, the initial epoch is 270, the forget rate is 0.1 and 5 epochs for linear drop rate ,the exponent of the forget rate is 1. For MW-Nets, the dimension of the meta net’s middle layer is 100 and the learning rate is $5 \times 1 0 ^ { - 3 }$ . $q$ for GCEloss is 0.1. The combination of Normalized Focal Loss and Mean Absolute Error is utilized in APL experiments, the weight of Normalized Focal Loss is 0.1 and the weight of Mean Absolute Error is 10. For JoCoR experiments, the epochs for linear drop rate is 5 and the exponent of the forget rate is 2. The balance coefficient between conventional supervised learning loss and contrastive loss is 0.01. The learning rate and weight decay of Graph Attention Networks are 0.01 and $5 \times 1 0 ^ { - 4 }$ . The dimension of hidden layer of GAT is 16 and the number of head attentions is 8. The alpha of the leaky relu is 0.2 and the dropout rate is 0.5. Throughout this work we implemented gradient based meta-learning algorithms in PyTorch using the Higher library (Grefenstette et al., 2019).
344
+
345
+ Table A.8: The hyper-parameters of LPM in different datasets.
346
+
347
+ <table><tr><td></td><td>Cora</td><td>Citeseer</td><td>Pubmed</td><td>Coauthor-Phy</td><td>Clothing1M</td></tr><tr><td>Aggregation Net&#x27;s learning rate</td><td>1×10-4</td><td>1×10-4</td><td>1×10-3</td><td>1×10-3</td><td>1×10-3</td></tr><tr><td>Aggregation Net&#x27;s mid-dimension</td><td>64</td><td>100</td><td>100</td><td>64</td><td>50</td></tr><tr><td>Aggregation Net&#x27;s weight decay</td><td>1×10-4</td><td>1×10-4</td><td>1×10-4</td><td>1×10-4</td><td>1×10-4</td></tr><tr><td>LPA iterations</td><td>50</td><td>50</td><td>50</td><td>50</td><td>50</td></tr></table>
348
+
349
+ ![](images/c0bf9ddecf3cf4ad60d9d9ff6ece4751d478fb438d0d72bc491040f95d3ac0c3.jpg)
350
+ Figure A.4: Confusion matrices of Basemodel and LPM on various datasets under $40 \%$ flip noise. Figure. 4(a)-4(c) are the results of Basemodel. Figure. 4(d)-4(f) are the results of LPM.
351
+
352
+ # C APPENDIX : CONVERGENCE OF LPM
353
+
354
+ Our proof of the convergence of LPM mainly follow some previous works (Ren et al., 2018; Shu et al., 2019) that utilize meta-learning to reweight noisy training samples. As is illustrated in some previous works (Zhou et al., 2004; Zhu et al., 2005), LPA will converge to a fixed point. Namely, $\mathcal { D } _ { s e l e c t }$ and $\mathcal { D } _ { l e f t }$ will converge to fixed sets. In our proof, the final $\mid \mathcal { D } _ { l e f t } \mid$ and final $\mid \mathcal { D } _ { c l e a n } \mid$ are denoted with $n$ and $m$ for easier illustration. Loss function loss is denoted by $l$ in this proof. Here we first rewrite the forward and backward equations as follows:
355
+
356
+ $$
357
+ \begin{array} { c } { { \displaystyle \hat { y } _ { j } = f ( x _ { j } ; w _ { t } ) = y _ { j } ( w ) \vert _ { w _ { t } } } } \\ { { \lambda _ { j } = g ( l ( y _ { j } , \hat { y } _ { j } ) \parallel l ( \tilde { y } _ { j } , \hat { y } _ { j } ) ; \theta _ { t } ) = \lambda _ { j } ( \theta ; w _ { t } ) \vert _ { \theta _ { t } } } } \\ { { { } } } \\ { { { \cal L } ^ { t r } ( w _ { t } ; \theta _ { t } ) = \displaystyle \frac { 1 } { n } \sum _ { j = 1 } ^ { n } l ( \lambda _ { j } y _ { j } + ( 1 - \lambda _ { j } ) \tilde { y } _ { j } , \hat { y } _ { j } ) } } \\ { { \hat { w } _ { t } ( \theta _ { t } ) = w _ { t } - \alpha \nabla _ { w } L ^ { c } ( w ; \theta _ { t } ) \vert _ { w _ { t } } } } \end{array}
358
+ $$
359
+
360
+ $$
361
+ \begin{array} { c } { \displaystyle \hat { y } _ { i } = f ( \boldsymbol { x } _ { i } ; \hat { \boldsymbol { w } } _ { t } ) = y _ { i } ( \hat { \boldsymbol { w } } ; \boldsymbol { x } _ { i } ) \vert _ { \hat { \boldsymbol { w } } _ { t } } } \\ { \displaystyle L ^ { c } ( \hat { \boldsymbol { w } } ) \vert _ { \hat { \boldsymbol { w } } _ { t } } = \frac { 1 } { m } \sum _ { i = 1 } ^ { m } L _ { i } ^ { c } ( \hat { \boldsymbol { w } } ) \vert _ { \hat { \boldsymbol { w } } _ { t } } = \frac { 1 } { m } \sum _ { i = 1 } ^ { m } L _ { i } ^ { c } ( \hat { w } _ { t } ( \boldsymbol { \theta } ) ) \vert _ { \theta _ { t } } = \frac { 1 } { m } \sum _ { i = 1 } ^ { m } l ( y _ { i } , \hat { y } _ { i } ) } \\ { \displaystyle \theta _ { t + 1 } = \theta _ { t } - \beta \nabla _ { \boldsymbol { \theta } } L ^ { c } ( \hat { w } ( \boldsymbol { \theta } ) ) \vert _ { \theta _ { t } } } \\ { \displaystyle w _ { t + 1 } = w _ { t } - \alpha \nabla _ { \boldsymbol { w } } L ^ { t r } ( w ; \theta _ { t + 1 } ) \vert _ { w _ { t } } } \end{array}
362
+ $$
363
+
364
+ $( x _ { j } , y _ { j } )$ is node from the final left training set $\mathcal { D } _ { l e f t }$
365
+
366
+ $( x _ { i } , y _ { i } )$ is node from the final clean set $\mathcal { D } _ { c l e a n }$ ;
367
+
368
+ $f$ is the GCN for classification with its weights $w$ ;
369
+ $g$ is the Aggregation Net whose input are the nodes from clean set with its weights $\theta$ ;
370
+ $L ^ { c }$ is the loss on clean sets. $L ^ { t r }$ is the final training loss.
371
+
372
+ $l ( y , \hat { y } )$ is the loss (such as Cross Entropy) which satisfies linearity given by
373
+
374
+ $$
375
+ l ( \lambda y _ { 1 } + ( 1 - \lambda ) y _ { 2 } , \hat { y } ) = \lambda l ( y _ { 1 } , \hat { y } ) + ( 1 - \lambda ) l ( y _ { 2 } , \hat { y } ) .
376
+ $$
377
+
378
+ # Derivation of the equation of updating the weights in Aggregation Net
379
+
380
+ $$
381
+ \frac { 1 } { m } \sum _ { i = 1 } ^ { m } \nabla _ { \theta } L _ { i } ^ { c } ( \hat { w } ( \theta ) ) | _ { \theta _ { t } } = \frac { 1 } { m } \sum _ { i = 1 } ^ { m } \frac { \partial L _ { i } ^ { c } ( \hat { w } ) } { \partial \hat { w } } | _ { \hat { w } _ { t } } \sum _ { j = 1 } ^ { n } \frac { \partial \hat { w } _ { t } ( \theta ) } { \partial \lambda _ { j } } | _ { \theta _ { t } } \frac { \partial \lambda _ { j } ( \theta ; w _ { t } ) } { \partial \theta } | _ { \theta _ { t } } .
382
+ $$
383
+
384
+ According to Equation (20)
385
+
386
+ $$
387
+ \begin{array} { l } { \displaystyle \dot { \varpi } _ { t } ( \theta ) | _ { \theta _ { t } } = w _ { t } - \alpha \nabla _ { w _ { t } } \frac { 1 } { n _ { j = 1 } ^ { n } } { l ( \lambda _ { j } y _ { j } + ( 1 - \lambda _ { j } ) \tilde { y } _ { j } , \hat { y } _ { j } ) } } \\ { \displaystyle \frac { \partial \hat { w } _ { t } ( \theta ) } { \partial \lambda _ { j } } | _ { \theta _ { t } } = - \frac { \alpha } { n } \nabla _ { w _ { t } } \frac { \partial ( l _ { \lambda j } y _ { j } + ( 1 - \lambda _ { j } ) \tilde { y } _ { j } , \hat { y } _ { j } ) } { \partial \lambda _ { j } } | _ { \theta _ { t } } } \\ { \displaystyle \frac { \partial \hat { w } _ { t } ( \theta ) } { \partial \lambda _ { j } } | _ { \theta _ { t } } = - \frac { \alpha } { n } \nabla _ { w _ { t } } \frac { \partial [ \lambda _ { j } l ( y _ { j } , \hat { y } _ { j } ) + ( 1 - \lambda _ { j } ) l ( \tilde { y } _ { j } , \hat { y } _ { j } ) ] } { \partial \lambda _ { j } } | _ { \theta _ { t } } } \\ { \displaystyle \frac { \partial \hat { w } _ { t } ( \theta ) } { \partial \lambda _ { j } } | _ { \theta _ { t } } = - \frac { \alpha } { n } \nabla _ { w _ { t } } ( l ( y _ { j } , \hat { y } _ { j } ) - l ( \tilde { y } _ { j } , \hat { y } _ { j } ) ) | _ { \theta _ { t } } } \\ { \displaystyle \frac { \partial \hat { w } _ { t } ( \theta ) } { \partial \lambda _ { j } } | _ { \theta _ { t } } = - \frac { \alpha } { n } \frac { \partial ( l ( y _ { j } , \hat { y } _ { j } ) - l ( \tilde { y } _ { j } , \hat { y } _ { j } ) ) } { \partial w _ { t } } | _ { w _ { t } } } \end{array}
388
+ $$
389
+
390
+ Therefore, Equation (25) can be written as
391
+
392
+ $$
393
+ \begin{array} { r l } & { \frac { 1 } { m } \displaystyle \sum _ { i = 1 } ^ { m } \nabla _ { \theta } L _ { i } ^ { c } ( \hat { w } ( \theta ) ) | _ { \theta _ { t } } } \\ & { = - \frac { \alpha } { m } \displaystyle \sum _ { i = 1 } ^ { m } \frac { \partial L _ { i } ^ { c } ( \hat { w } ( \theta ) ) } { \partial \hat { w } } | _ { \hat { w } _ { i } } \sum _ { j = 1 } ^ { n } \frac { \partial \left( l ( y _ { j } , \hat { y } _ { j } ) - l ( \hat { y } _ { j } , \hat { y } _ { j } ) \right) } { \partial w _ { t } } | _ { w _ { t } } \frac { \partial \lambda _ { j } \left( \theta ; w _ { t } \right) } { \partial \theta } | _ { \theta _ { t } } } \\ & { = - \frac { \alpha } { n } \displaystyle \sum _ { j = 1 } ^ { n } ( \frac { 1 } { m } \displaystyle \sum _ { i = 1 } ^ { m } \frac { \partial L _ { i } ^ { c } ( \hat { w } ( \theta ) ) } { \partial \hat { w } } | _ { \hat { w } _ { i } } \frac { \partial \left( l ( y _ { j } , \hat { y } _ { j } ) - l ( \hat { y } _ { j } , \hat { y } _ { j } ) \right) } { \partial \theta } | _ { w _ { t } } \frac { \partial \lambda _ { j } \left( \theta ; w _ { t } \right) } { \partial \theta } | _ { \theta _ { t } } } \\ & { = - \frac { \alpha } { n } \displaystyle \sum _ { j = 1 } ^ { n } ( \frac { 1 } { m } \displaystyle \sum _ { i = 1 } ^ { m } G _ { i j } ) \frac { \partial \lambda _ { j } \left( \theta ; w _ { t } \right) } { \partial \theta } | _ { \theta _ { t } } \mu _ { \epsilon } } \\ & { + \frac { \partial L _ { i } ^ { c } ( \hat { w } ) } { \partial \theta } | _ { \hat { w } _ { i } } \frac { \partial \left( l ( y _ { j } , \hat { y } _ { j } ) - l ( \hat { y } _ { j } , \hat { y } _ { j } ) \right) } { \partial \theta } | _ { \theta _ { t } } . } \end{array}
394
+ $$
395
+
396
+ where
397
+
398
+ Lemma 1. Suppose the loss function $l$ is $\mathrm { L }$ -Lipschitz smooth, and $\lambda ( \cdot )$ is differential with a $\delta$ -bounded gradient, twice differential with its Hessian bounded by $\boldsymbol { B }$ with respcet to $\theta$ , and the loss function $l ( \cdot , \cdot )$ have $\rho$ -bounded gradients with respect to the parameter $w$ . Then the gradient of $w$ with respect to $L _ { i } ^ { c } ( \hat { w } )$ is Lipschitz continuous.
399
+
400
+ Proof. The supposition is equivalent to the following inequalities,
401
+
402
+ $$
403
+ \| \nabla _ { \hat { w } } L ^ { c } ( \hat { w } ) | _ { w _ { 1 } } - \nabla _ { \hat { w } } L ^ { c } ( \hat { w } ) | _ { w _ { 2 } } \| \leq L \| w _ { 1 } - w _ { 2 } \| ,
404
+ $$
405
+
406
+ for any $w _ { 1 } , w _ { 2 }$ ;
407
+
408
+ $$
409
+ \begin{array} { r l r } & { } & { \| \nabla _ { \theta } \lambda ( \theta ; w _ { t } ) \| \le \rho ; } \\ & { } & { \| \nabla _ { \theta ^ { 2 } } ^ { 2 } \lambda ( \theta ; w _ { t } ) \| \le \mathcal B ; } \\ & { } & { \| \nabla _ { w } l ( y _ { i } , \hat { y } _ { i } ( ( \hat { w } _ { t } ( w ) ; x _ { i } ) ) ) \| \le \delta . } \end{array}
410
+ $$
411
+
412
+ The gradient of $\theta$ with respect to loss on clean set reads
413
+
414
+ $$
415
+ \begin{array} { l } { { \displaystyle \nabla _ { \theta } L _ { i } ^ { c } ( \hat { w } ( \theta ) ) \big | _ { \theta _ { t } } } } \\ { { \displaystyle = - \frac { \alpha } { n } \sum _ { j = 1 } ^ { n } \frac { \partial L _ { i } ^ { c } ( \hat { w } ) } { \partial \hat { w } } \vert _ { \hat { w } _ { t } } ^ { T } \frac { \partial ( l ( y _ { j } , \hat { y } _ { j } ) - l ( \tilde { y } _ { j } , \hat { y } _ { j } ) ) } { \partial { w _ { t } } } \vert _ { w _ { t } } \frac { \partial \lambda _ { j } ( \theta ; w _ { t } ) } { \partial \theta } \vert _ { \theta _ { t } } } } \\ { { \displaystyle = - \frac { \alpha } { n } \sum _ { j = 1 } ^ { n } G _ { i j } \frac { \partial \lambda _ { j } ( \theta ; w _ { t } ) } { \partial \theta } \vert _ { \theta _ { t } } } } \end{array}
416
+ $$
417
+
418
+ Taking the gradient of $\theta$ in both sides of the equation, we have
419
+
420
+ $$
421
+ \nabla _ { \theta ^ { 2 } } ^ { 2 } L _ { i } ^ { c } ( \hat { w } ( \theta ) ) | _ { \theta _ { t } } = - \frac { \alpha } { n } \sum _ { j = 1 } ^ { n } ( \frac { \partial G _ { i j } } { \partial \theta } | _ { \theta _ { t } } \frac { \partial \lambda _ { j } ( \theta ; w _ { t } ) } { \partial \theta } | _ { \theta _ { t } } + ( G _ { i j } ) \frac { \partial ^ { 2 } \lambda _ { j } ( \theta ; w _ { t } ) } { \partial \theta ^ { 2 } } | _ { \theta _ { t } } ) .
422
+ $$
423
+
424
+ For the first term in summation,
425
+
426
+ $$
427
+ \begin{array} { r l } & { \quad \| \frac { \partial G _ { i j } } { \partial \vartheta } | _ { \kappa _ { i } } \frac { \partial \lambda _ { j } ( \theta ; w _ { i } ) } { \partial \vartheta } | _ { \kappa _ { i } } \| } \\ & { \quad \le \delta \| \frac { \partial } { \partial \tilde { w } } ( \frac { \partial L _ { \epsilon } ^ { \epsilon } ( \tilde { w } ) } { \partial \vartheta } | _ { \kappa _ { i } } ) | _ { \kappa _ { i } } ^ { T } \frac { \partial ( l ( y _ { j } , \hat { y } _ { j } ) - l ( \tilde { y } _ { j } , \hat { y } _ { j } ) ) } { \partial w _ { k } } | _ { w _ { k } } \| } \\ & { \quad \le \delta \| \frac { \partial } { \partial \tilde { w } } ( - \frac { \alpha } { n } \sum _ { k = 1 } ^ { n } \frac { \partial L _ { \epsilon } ^ { \epsilon } ( \tilde { w } ) } { \partial \tilde { w } } | _ { \kappa _ { i } } ^ { T } \frac { \partial ( l ( y _ { k } , \hat { y } _ { k } ) - l ( \tilde { y } _ { k } , \hat { y } _ { k } ) ) } { \partial w _ { k } } | _ { w _ { k } } \frac { \partial \lambda _ { j } ( \theta ; w _ { k } ) } { \partial \theta } | _ { \kappa _ { i } } ) | _ { \tilde { w } _ { k } } ^ { T } \frac { \partial ( l ( y _ { j } , \hat { y } _ { j } ) - l ( \tilde { y } _ { j } , \hat { y } _ { j } ) ) } { \partial w _ { \ell } } | _ { w _ { k } } , } \\ & \quad \le \delta \| ( - \frac { \alpha } { n } \sum _ { k = 1 } ^ { n } \frac { \partial ^ { 2 } L _ { \epsilon } ^ { \epsilon } ( \tilde { w } ) } { \partial \tilde { w } ^ { 2 } } | _ { \kappa _ { i } } ^ { T } \frac { \partial ( l ( y _ { k } , \hat { y } _ { k } ) - l ( \tilde { y } _ { k } , \hat { y } _ { k } ) ) } { \partial w _ { \ell } } | _ { w _ { \ell } } \frac { \partial \lambda _ { k } ( \theta ; w _ { \ell } ) } { \partial \theta } | _ { \theta _ { k } } \| _ { \tilde { w } _ { \ell } } \frac \partial ( l ( y _ j \end{array}
428
+ $$
429
+
430
+ And for the second term,
431
+
432
+ $$
433
+ \| ( G _ { i j } ) \frac { \partial ^ { 2 } \lambda _ { j } ( \theta ; w _ { t } ) } { \partial \theta ^ { 2 } } | _ { \theta _ { t } } \| = \| \frac { \partial L _ { i } ^ { c } ( \hat { w } ) } { \partial \hat { w } } | _ { \hat { w } _ { t } } ^ { T } \frac { \partial ( l ( y _ { j } , \hat { y } _ { j } ) - l ( \tilde { y } _ { j } , \hat { y } _ { j } ) ) } { \partial w _ { t } } | _ { w _ { t } } \frac { \partial ^ { 2 } \lambda _ { j } ( \theta ; w _ { t } ) } { \partial \theta ^ { 2 } } | _ { \theta _ { t } } \| \leq 2 \mathcal { B } \rho ^ { 2 } .
434
+ $$
435
+
436
+ Therefore,
437
+
438
+ $$
439
+ \| \nabla _ { \theta ^ { 2 } } ^ { 2 } L _ { i } ^ { c } ( \hat { w } ( \theta ) ) | _ { \theta _ { t } } \| \leq 4 \alpha ^ { 2 } L \rho ^ { 2 } \delta ^ { 2 } + 2 \alpha \rho ^ { 2 } \mathcal { B } .
440
+ $$
441
+
442
+ Let $L _ { v } = 4 \alpha ^ { 2 } L \rho ^ { 2 } \delta ^ { 2 } + 2 \alpha \rho ^ { 2 } \beta$ ,Based on Lagrange mean value theorem, we have
443
+
444
+ $$
445
+ \lVert \nabla _ { \theta } L ^ { c } ( \hat { w } _ { t } ( \theta _ { 1 } ) ) - \nabla _ { \theta } L ^ { c } ( \hat { w } _ { t } ( \theta _ { 2 } ) ) \rVert \leq L _ { v } \lVert \theta _ { 1 } - \theta _ { 2 } \rVert ,
446
+ $$
447
+
448
+ for all $\theta _ { 1 } , \theta _ { 2 }$
449
+
450
+ Theorem 1. Suppose the loss function $l$ is L-Lipschitz smooth, and $\lambda ( \cdot )$ is differential with a $\delta$ - bounded gradient, twice differential with its Hessian bounded by $\boldsymbol { B }$ with respect to $\theta$ . Let the learning rate $\alpha _ { t } = \operatorname* { m i n } \{ 1 , { \frac { k } { T } } \}$ , for some $k > 0$ , such that $\begin{array} { r } { { \frac { k } { T } } < 1 } \end{array}$ and learning rate $\beta _ { t }$ a monotone descent sequence, $\begin{array} { r } { \beta _ { t } = \operatorname* { m i n } \{ \frac { 1 } { L } , \frac { c } { \sqrt { T } } \} } \end{array}$ for some $c > 0$ , such that $L \leq { \frac { c } { \sqrt { T } } }$ and $\begin{array} { r } { \sum _ { t = 1 } ^ { \infty } \beta _ { t } \le \infty , \sum _ { t = 1 } ^ { \infty } \beta _ { t } ^ { 2 } \le } \end{array}$ $\infty$ . Then the loss of Aggregation Net can achieve $\| \nabla _ { \theta } L ^ { c } ( \hat { w } ( \theta _ { t } ) ) \| _ { 2 } ^ { 2 } \le \epsilon$ in $\mathcal { O } ( 1 / \epsilon ^ { 2 } )$ steps. More specifically,
451
+
452
+ $$
453
+ \operatorname* { m i n } _ { 0 \leq t \leq T } \| \nabla _ { \boldsymbol { \theta } } L ^ { c } ( \hat { w } ( \boldsymbol { \theta } _ { t } ) ) \| _ { 2 } ^ { 2 } \leq \mathcal { O } ( \frac { C } { \sqrt { T } } ) .
454
+ $$
455
+
456
+ Proof. The iteration for updating the parameter $\theta$ reads
457
+
458
+ $$
459
+ \theta _ { t + 1 } = \theta _ { t } - \beta \nabla _ { \theta } L ^ { c } ( \hat { w } _ { t } ( \theta ) ) | _ { \theta _ { t } } .
460
+ $$
461
+
462
+ In two successive iteration, observe that
463
+
464
+ $$
465
+ \begin{array} { r l } & { \quad L ^ { c } ( \hat { w } _ { t + 1 } ( \theta _ { t + 1 } ) ) - L ^ { c } ( \hat { w } _ { t } ( \theta _ { t } ) ) } \\ & { = [ L ^ { c } ( \hat { w } _ { t + 1 } ( \theta _ { t + 1 } ) ) - L ^ { c } ( \hat { w } _ { t } ( \theta _ { t + 1 } ) ) ] + [ L ^ { c } ( \hat { w } _ { t } ( \theta _ { t + 1 } ) ) - L ^ { c } ( \hat { w } _ { t } ( \theta _ { t } ) ) ] . } \end{array}
466
+ $$
467
+
468
+ For the first term, given that loss function on clean set is Lipschitz smooth, we have
469
+
470
+ $$
471
+ \begin{array} { r l } & { \quad L ^ { c } ( \hat { w } _ { t + 1 } ( \theta _ { t + 1 } ) ) - L ^ { c } ( \hat { w } _ { t } ( \theta _ { t + 1 } ) ) } \\ & { \leq < \nabla L ^ { c } ( \hat { w } _ { t } ( \theta _ { t + 1 } ) ) , \hat { w } _ { t + 1 } ( \theta _ { t + 1 } ) - \hat { w } _ { t } ( \theta _ { t + 1 } ) > + \displaystyle \frac { L } { 2 } \| \hat { w } _ { t + 1 } ( \theta _ { t + 1 } ) - \hat { w } _ { t } ( \theta _ { t + 1 } ) \| _ { 2 } ^ { 2 } . } \end{array}
472
+ $$
473
+
474
+ According to Equation (20) and (23),
475
+
476
+ $$
477
+ \hat { w } _ { t + 1 } ( \theta _ { t + 1 } ) - \hat { w } _ { t } ( \theta _ { t + 1 } ) = - \frac { \alpha _ { t } } { n } \sum _ { j = 1 } ^ { n } [ \lambda _ { j } \nabla _ { w } l ( y _ { j } , \hat { y } _ { j } ) + ( 1 - \lambda _ { j } ) \nabla _ { w } l ( \tilde { y } _ { j } , \hat { y } _ { j } ) ] | _ { w _ { t + 1 } } ,
478
+ $$
479
+
480
+ and thus,
481
+
482
+ $$
483
+ \| L ^ { c } ( \hat { w } _ { t + 1 } ( \theta _ { t + 1 } ) ) - L ^ { c } ( \hat { w } _ { t } ( \theta _ { t + 1 } ) ) \| \leq \alpha _ { t } \rho ^ { 2 } + \frac { L } { 2 } \alpha _ { t } ^ { 2 } \rho ^ { 2 } ,
484
+ $$
485
+
486
+ since the first gradient of loss function is bounded by $\rho$
487
+
488
+ By the Lipschitz continuity of $L ^ { c } ( \hat { w } _ { t } ( \theta ) )$ according to Lemma 1., it can be obtained that
489
+
490
+ $$
491
+ \begin{array} { r l } & { \quad L ^ { c } ( \hat { w } _ { t } ( \theta _ { t + 1 } ) ) - L ^ { c } ( \hat { w } _ { t } ( \theta _ { t } ) ) } \\ & { \le \langle \nabla _ { \theta _ { t } } L ^ { c } ( \hat { w } _ { t } ( \theta _ { t } ) ) , \theta _ { t + 1 } - \theta _ { t } \rangle + \displaystyle \frac { L } { 2 } \| \theta _ { t + 1 } - \theta _ { t } \| _ { 2 } ^ { 2 } } \\ & { = \langle \nabla _ { \theta _ { t } } L ^ { c } ( \hat { w } _ { t } ( \theta _ { t } ) ) , - \beta _ { t } \nabla _ { \theta _ { t } } L ^ { c } ( \hat { w } _ { t } ( \theta _ { t } ) ) \rangle + \displaystyle \frac { L \beta _ { t } ^ { 2 } } { 2 } \| \nabla _ { \theta _ { t } } L ^ { c } ( \hat { w } _ { t } ( \theta _ { t } ) ) \| _ { 2 } ^ { 2 } } \\ & { = - ( \beta _ { t } - \displaystyle \frac { L \beta _ { t } ^ { 2 } } { 2 } ) \| \nabla _ { \theta _ { t } } L ^ { c } ( \hat { w } _ { t } ( \theta _ { t } ) ) \| _ { 2 } ^ { 2 } . } \end{array}
492
+ $$
493
+
494
+ Therefore, the Equation (32) satisfies
495
+
496
+ $$
497
+ \begin{array} { r l r } & { } & { L ^ { c } ( \hat { w } _ { t + 1 } ( \theta _ { t + 1 } ) ) - L ^ { c } ( \hat { w } _ { t } ( \theta _ { t } ) ) \le \alpha _ { t } \rho ^ { 2 } + \displaystyle \frac { L } { 2 } \alpha _ { t } ^ { 2 } \rho ^ { 2 } - ( \beta _ { t } - \frac { L \beta _ { t } ^ { 2 } } { 2 } ) \| \nabla _ { \theta _ { t } } L ^ { c } ( \hat { w } _ { t } ( \theta _ { t } ) ) \| _ { 2 } ^ { 2 } } \\ & { } & { ( \beta _ { t } - \frac { L \beta _ { t } ^ { 2 } } { 2 } ) \| _ { 2 } ^ { 2 } \nabla _ { \theta _ { t } } L ^ { c } ( \hat { w } _ { t } ( \theta _ { t } ) ) \| _ { 2 } ^ { 2 } \le \alpha _ { t } \rho ^ { 2 } + \displaystyle \frac { L } { 2 } \alpha _ { t } ^ { 2 } \rho ^ { 2 } - L ^ { c } ( \hat { w } _ { t + 1 } ( \theta _ { t + 1 } ) ) + L ^ { c } ( \hat { w } _ { t } ( \theta _ { t } ) ) . } \end{array}
498
+ $$
499
+
500
+ Summing up above inequalities from 1 to $T$ , we have
501
+
502
+ $$
503
+ \begin{array} { r } { \displaystyle \sum _ { t = 1 } ^ { T } ( \beta _ { t } - \frac { L \beta _ { t } ^ { 2 } } { 2 } ) \| \nabla _ { \theta _ { t } } L ^ { c } ( \hat { w } _ { t } ( \theta _ { t } ) ) \| _ { 2 } ^ { 2 } \leq L ^ { c } ( \hat { w } _ { 1 } ( \theta _ { 1 } ) ) + \displaystyle \sum _ { t = 1 } ^ { T } ( \alpha _ { t } \rho ^ { 2 } + \frac { L } { 2 } \alpha _ { t } ^ { 2 } \rho ^ { 2 } ) } \\ { \displaystyle \sum _ { t = 1 } ^ { T } ( \beta _ { t } - \frac { L \beta _ { t } ^ { 2 } } { 2 } ) \operatorname* { m i n } _ { t } \| \nabla _ { \theta _ { t } } L ^ { c } ( \hat { w } _ { t } ( \theta _ { t } ) ) \| _ { 2 } ^ { 2 } \leq L ^ { c } ( \hat { w } _ { 1 } ( \theta _ { 1 } ) ) + \displaystyle \sum _ { t = 1 } ^ { T } ( \alpha _ { t } \rho ^ { 2 } + \frac { L } { 2 } \alpha _ { t } ^ { 2 } \rho ^ { 2 } ) . } \end{array}
504
+ $$
505
+
506
+ Furthermore,
507
+
508
+ $$
509
+ \begin{array} { r l } { \operatorname* { m i n } _ { 1 } \| \nabla _ { 0 } , L ^ { \nu } ( \hat { \omega } ; \hat { \omega } _ { \hat { \omega } } ^ { \dagger } ) \| _ { 2 } ^ { 2 } \leq \frac { L ^ { 2 } ( \hat { \omega } ; \hat { \omega } ( \hat { \omega } _ { \hat { \omega } } ( \hat { \theta } _ { 1 } ) ) + 1 ) - \sum _ { i = 1 } ^ { N } ( \alpha _ { i } \mu ^ { 2 } + \frac { L ^ { 2 } } { 2 } \hat { \omega } _ { \hat { \omega } } ^ { 2 } \hat { \omega } _ { \hat { \omega } } ^ { 2 } ) } { \sum _ { \alpha ^ { \prime } = 1 } ^ { N } ( \beta _ { i } - \frac { L ^ { 2 } } { 2 } \mu ^ { 2 } ) } } \\ & { \leq \frac { 2 L ^ { 2 } ( \hat { \omega } ; \hat { \omega } ( \hat { \omega } _ { 1 } ( \hat { \omega } _ { 1 } ) ) + \sum _ { i = 1 } ^ { N } ( 2 \omega _ { i } \mu ^ { 2 } + \frac { L ^ { 2 } } { 2 } \mu ^ { 2 } ) + L ^ { 2 } \mu ^ { 2 } ) } { \sum _ { \alpha ^ { \prime } = 1 } ^ { N } ( 2 \hat { \omega } _ { \hat { \omega } } - \frac { L ^ { 2 } } { 2 } ) } } \\ & { \leq \frac { 2 L ^ { 2 } ( \hat { \omega } ; \hat { \omega } ( \hat { \omega } _ { 1 } ( \hat { \omega } _ { 1 } ) ) + \sum _ { i = 1 } ^ { N } ( 2 \omega _ { i } \mu ^ { 2 } + L ^ { 2 } \omega ^ { 2 } ) + L ^ { 2 } \mu ^ { 2 } ) } { \sum _ { \alpha ^ { \prime } = 1 } ^ { N } ( \beta _ { i } ) } } \\ & { \leq \frac { 2 L ^ { 2 } ( \hat { \omega } ; \hat { \omega } ( \hat { \omega } _ { 1 } ( \hat { \omega } _ { 1 } ) ) + \sum _ { i = 1 } ^ { N } ( 2 \omega _ { i } \mu ^ { 2 } + L ^ { 2 } \omega ^ { 2 } ) } { \sum _ { \alpha ^ { \prime } = 1 } ^ { N } ( \beta _ { i } ) } } \\ & \leq \frac 2 L ^ { 2 } ( \hat { \omega } ; \hat { \omega } ( \hat { \omega } _ { 1 } ) ) - 2 ( \hat { \omega } ; \hat { \omega } ^ { 2 } ) + L ^ { 2 } ( 2 \end{array}
510
+ $$
511
+
512
+ It holds for $\begin{array} { r } { \sum _ { t = 1 } ^ { T } ( \beta _ { t } ) \leq \sum _ { t = 1 } ^ { T } ( 2 \beta _ { t } - L \beta _ { t } ^ { 2 } ) } \end{array}$ . In conclusion, it proves that the algorithm can always achieve $\begin{array} { r } { \operatorname* { m i n } _ { 0 \leq t \leq T } \| \nabla _ { \theta } L ^ { c } ( \hat { w } ( \theta _ { t } ) ) \| _ { 2 } ^ { 2 } \leq \mathcal { O } ( \frac { 1 } { \sqrt { T } } ) } \end{array}$ in $T$ steps.
513
+
514
+ Lemma 2. Let $( a _ { n } ) _ { 1 \leq n } , ( b _ { n } ) _ { 1 \leq n }$ be two non-negative re nces such that the series $\textstyle \sum _ { i _ { i } } ^ { \infty } a _ { n }$ diverges, the series $\textstyle \sum _ { i _ { i } } ^ { \infty } a _ { n } b _ { n }$ converges, and there exists $K > 0$ such that $\| b _ { n + 1 } - b _ { n } \| \leq \dot { K } a _ { n }$ . Then the seqences $\left( b _ { n } \right) _ { 1 \leq n }$ converges to 0.
515
+
516
+ Proof. See the proof of Lemma A.5 in [Stochastic majorization-minimization algorithms for ].
517
+
518
+ Theorem 2. Suppose the loss function $l$ is L-Lipschitz smooth and have $\rho$ -bounded gradients with respect to training data and clean set, and $\lambda ( \cdot )$ is differential with a $\delta$ -bounded gradient twice differential with its Hessian bounded by $\boldsymbol { B }$ with respect to $\theta$ . Let the learning rate $\alpha _ { t } = \operatorname* { m i n } \{ 1 , { \frac { k } { T } } \}$ , for some $k > 0$ , such that $\begin{array} { r } { { \frac { k } { T } } < 1 } \end{array}$ and learning rate $\beta _ { t }$ a monotone descent sequence, $\begin{array} { r } { \beta _ { t } = \operatorname* { m i n } \{ \frac { 1 } { L } , \frac { c } { \sqrt { T } } \} } \end{array}$ for some $c > 0$ , such that $L \leq { \frac { c } { \sqrt { T } } }$ and $\begin{array} { r } { \sum _ { t = 1 } ^ { \infty } \beta _ { t } \leq \infty , \sum _ { t = 1 } ^ { \infty } \beta _ { t } ^ { 2 } \leq \infty } \end{array}$ . Then
519
+
520
+ $$
521
+ \operatorname* { l i m } _ { t \to \infty } \| \nabla _ { w _ { t } } L ^ { t r } ( w _ { t } ; \theta _ { t + 1 } ) \| _ { 2 } ^ { 2 } = 0 .
522
+ $$
523
+
524
+ Proof. It is obvious that $a _ { t }$ satisfy $\begin{array} { r } { \sum _ { t = 0 } ^ { \infty } a _ { t } = \infty , \sum _ { t = 0 } ^ { \infty } a _ { t } \le \infty . } \end{array}$ . In Eq. 18, 19, 20, and the linearity of $L$ , we rewrite the update of $w$ as
525
+
526
+ $$
527
+ \begin{array} { l } { { \displaystyle w _ { t + 1 } = w _ { t } - \alpha _ { t } \nabla L ^ { t r } ( w _ { t } ; \theta _ { t + 1 } ) } } \\ { { \displaystyle \qquad = w _ { t } - \frac { \alpha _ { t } } { n } \sum _ { j = 1 } ^ { n } \lambda _ { j } ( \theta _ { t + 1 } ; w _ { t } ) \nabla _ { w _ { t } } l ( y _ { j } , \hat { y } _ { j } ( w _ { t } ) ) + ( 1 - \lambda _ { j } ( \theta _ { t + 1 } ; w _ { t } ) ) \nabla _ { w _ { t } } l ( \tilde { y } _ { j } , \hat { y } _ { j } ( w _ { t } ) ) . } } \end{array}
528
+ $$
529
+
530
+ First, we have the difference of the loss function on training set between two iterations,
531
+
532
+ $$
533
+ \begin{array} { r l } & { \quad L ^ { t r } ( w _ { t + 1 } ; \theta _ { t + 2 } ) - L ^ { t r } ( w _ { t } ; \theta _ { t + 1 } ) } \\ & { = \lbrack L ^ { t r } ( w _ { t + 1 } ; \theta _ { t + 2 } ) - L ^ { t r } ( w _ { t + 1 } ; \theta _ { t + 1 } ) \rbrack + \lbrack L ^ { t r } ( w _ { t + 1 } ; \theta _ { t + 1 } ) - L ^ { t r } ( w _ { t } ; \theta _ { t + 1 } ) \rbrack . } \end{array}
534
+ $$
535
+
536
+ For the first term in Eq.33, by the L-Lipschitz-smooth and $\rho$ −bounded gradients of $\lambda$ with respect to training and clean set,
537
+
538
+ $$
539
+ \begin{array} { l } { { \displaystyle { \cal L } ^ { t r } ( w _ { t + 1 } ; \theta _ { t + 2 } ) - { \cal L } ^ { t r } ( w _ { t + 1 } ; \theta _ { t + 1 } ) } } \\ { \displaystyle { = \frac { 1 } { n } \sum _ { j = 1 } ^ { n } ( \lambda _ { j } ( \theta _ { t + 2 } ; w _ { t + 1 } ) - \lambda _ { j } ( \theta _ { t + 1 } ; w _ { t + 1 } ) ) l ( y _ { j } , \hat { y } ( w _ { t + 1 } ) ) + ( \lambda _ { j } ( \theta _ { t + 1 } ; w _ { t + 1 } ) - \lambda _ { j } ( \theta _ { t + 2 } ; w _ { t + 1 } ) ) l ( \tilde { y } _ { j } , \hat { y } ( w _ { t + 1 } ) ) } } \\ { \displaystyle { \le \frac { 1 } { n } \sum _ { j = 1 } ^ { n } ( \left. \frac { \partial \lambda _ { j } ( \theta _ { j } ; w _ { t + 1 } ) } { \partial \theta } \vert _ { \theta _ { t + 1 } } , \theta _ { t + 2 } - \theta _ { t + 1 } \right. + \frac { \delta } { 2 } \| \theta _ { t + 2 } - \theta _ { t + 1 } \| _ { 2 } ^ { 2 } ) ( l ( y _ { j } , \hat { y } ( w _ { t + 1 } ) ) + l ( y _ { j } , \hat { y } ( w _ { t + 1 } ) ) ) } } \\ { \displaystyle { = \frac { 1 } { n } \sum _ { j = 1 } ^ { n } ( \left. \frac { \partial \lambda _ { j } ( \theta ; w _ { t + 1 } ) } { \partial \theta } \vert _ { \theta ^ { t + 1 } } , - \beta _ { t } \nabla _ { \theta _ { t } } L ( \hat { w } _ { t } ( \theta _ { t } ) ) \right. + \frac { \delta \beta _ { t } ^ { 2 } } { 2 } \| \nabla _ { \theta _ { t } } L ( \hat { w } _ { t } ( \theta _ { t } ) ) \| _ { 2 } ^ { 2 } ) ( l ( y _ { j } , \hat { y } ( w _ { t + 1 } ) ) + l ( y _ { j } , \hat { y } ( w _ { t + 1 } ) ) ) } } \end{array}
540
+ $$
541
+
542
+ For the second term in Eq. 33,
543
+
544
+ $$
545
+ \begin{array} { r l } & { \quad L ^ { t r } ( w _ { t + 1 } ; \theta _ { t + 1 } ) - L ^ { t r } ( w _ { t } ; \theta _ { t + 1 } ) } \\ & { \le \bigl \langle \nabla _ { w _ { t } } L ^ { t r } ( w _ { t } ; \theta _ { t + 1 } ) , w _ { t + 1 } - w _ { t } \bigr \rangle + \frac { L } { 2 } \| w _ { t + 1 } - w _ { t } \| _ { 2 } ^ { 2 } } \\ & { = - \bigl ( \alpha _ { t } - \frac { L a _ { t } ^ { 2 } } { 2 } \bigr ) \| \nabla _ { w _ { t } } L ^ { t r } ( w _ { t } ; \theta _ { t + 1 } ) \| _ { 2 } ^ { 2 } . } \end{array}
546
+ $$
547
+
548
+ Therefore, we have
549
+
550
+ $$
551
+ \begin{array} { r l } & { \quad L ^ { t r } ( w _ { t + 1 } ; \theta _ { t + 2 } ) - L ^ { t r } ( w _ { t } ; \theta _ { t + 1 } ) } \\ & { \le \displaystyle \frac { 1 } { n } \sum _ { j = 1 } ^ { n } ( \left. \frac { \partial \lambda _ { j } ( \theta ; w _ { t + 1 } ) } { \partial \theta } | _ { \theta ^ { t + 1 } } , - \beta _ { t } \nabla _ { \theta _ { t } } L ^ { c } ( \hat { w } _ { t } ( \theta _ { t } ) ) \right. } \\ & { + \displaystyle \frac { \delta \beta _ { t } ^ { 2 } } { 2 } \| \nabla _ { \theta _ { t } } L ( \hat { w } _ { t } ( \theta _ { t } ) ) \| _ { 2 } ^ { 2 } ) ( l ( y _ { j } , \hat { y } ( w _ { t + 1 } ) ) + l ( y _ { j } , \hat { y } ( w _ { t + 1 } ) ) ) } \\ & { - ( \alpha _ { t } - \frac { L \alpha _ { t } ^ { 2 } } { 2 } ) \| \nabla _ { w _ { t } } L ^ { t r } ( w _ { t } ; \theta _ { t + 1 } ) \| _ { 2 } ^ { 2 } . } \end{array}
552
+ $$
553
+
554
+ Summing up the inequalities in both sides from $t = 1$ to $\infty$ , we have
555
+
556
+ $$
557
+ \begin{array} { r l } & { \displaystyle \underset { t = 1 } { \operatorname* { l i m } } \| L ^ { t r } ( w _ { t + 1 } ; \theta _ { t + 2 } ) - L ^ { t r } ( w _ { 1 } ; \theta _ { 2 } ) \| } \\ & { \le \displaystyle \sum _ { t = 1 } ^ { \infty } - \frac { \beta _ { t } } { n } \sum _ { j = 1 } ^ { n } [ \| \frac { \partial \lambda _ { j } ( \theta ; w _ { t + 1 } ) } { \partial \theta } | _ { \theta ^ { t + 1 } } \| _ { 2 } \| \nabla _ { \theta _ { t } } L ^ { c } ( \hat { w } _ { t } ( \theta _ { t } ) ) \| _ { 2 } ( \| l ( y _ { j } , \hat { y } ( w _ { t + 1 } ) ) \| _ { 2 } + \| l ( y _ { j } , \hat { y } ( w _ { t + 1 } ) ) \| _ { 2 } , } \\ & { + \displaystyle \sum _ { t = 1 } ^ { \infty } \frac { \delta \beta _ { t } ^ { 2 } } { 2 } \displaystyle \sum _ { j = 1 } ^ { n } \| \nabla _ { \theta _ { t } } L ^ { c } ( \hat { w } _ { t } ( \theta _ { t } ) ) \| _ { 2 } ^ { 2 } ] ( \| l ( y _ { j } , \hat { y } ( w _ { t + 1 } ) ) \| _ { 2 } + \| l ( y _ { j } , \hat { y } ( w _ { t + 1 } ) ) \| _ { 2 } ) } \\ & { - \displaystyle \sum _ { t = 1 } ^ { \infty } ( \alpha _ { t } - \frac { L \alpha _ { t } ^ { 2 } } { 2 } ) \| \nabla _ { w _ { t } } L ^ { t r } ( w _ { t } ; \theta _ { t + 1 } ) \| _ { 2 } ^ { 2 } . } \end{array}
558
+ $$
559
+
560
+ Rearrange the terms of the inequality, we obtain
561
+
562
+ $$
563
+ \begin{array} { r l } & { \displaystyle \sum _ { t = 1 } ^ { \infty } \alpha _ { t } \| \nabla _ { w _ { 1 } } L ^ { t \top } ( w _ { : t } , \theta _ { t + 1 } ) \| _ { 2 } ^ { 2 } } \\ & { + \displaystyle \sum _ { t = 1 } ^ { \infty } \frac { \beta _ { t } } { \eta } \displaystyle \sum _ { j = 1 } ^ { n } \| \frac { \partial \lambda _ { t } ( \theta ; w _ { t + 1 } ) } { \partial \theta } | _ { \theta ^ { ( 1 ) } } \| _ { \theta ^ { ( 1 ) } } \| _ { 2 } \| \nabla _ { \theta , L ^ { t } } ( \bar { w } _ { t } , \theta _ { t } ) \| _ { 2 } \| \boldsymbol { l } ( \vartheta _ { j } , \hat { \theta } ( w _ { + 1 } ) ) \| _ { 2 } + \| \boldsymbol { l } ( \boldsymbol { y } _ { j } , \hat { \psi } ( w _ { * + 1 } ) ) \| _ { 2 } ) } \\ & { \leq \displaystyle \sum _ { t = 1 } ^ { L \alpha _ { t } } \| \nabla _ { w _ { 1 } } L ^ { t \top } ( w _ { t } ; \theta _ { t + 1 } ) \| _ { 2 } ^ { 2 } } \\ & { + \displaystyle \sum _ { t = 1 } ^ { \infty } \frac { \delta \beta _ { t } ^ { 2 } } { 2 } \displaystyle \sum _ { s = 1 } ^ { n } \| \nabla _ { v _ { 1 } } L ^ { t \top } ( w _ { 1 } ; \theta _ { t } ) ) \| _ { 2 } ^ { 2 } \| \boldsymbol { l } ( \boldsymbol { l } ; \theta _ { s } , \hat { \boldsymbol { y } } ( w _ { t + 1 } ) ) \| _ { 2 } + \| \boldsymbol { l } ( \boldsymbol { y } _ { s } , \hat { \boldsymbol { y } } ( w _ { t + 1 } ) ) \| _ { 2 } ) } \\ & { - \displaystyle \operatorname* { l i m } _ { t = 1 } ^ { \infty } [ L ^ { t \top } ( w _ { t + 1 } ; \theta _ { t + 2 } ) ] + \| L ^ { t t \top } ( w _ { 1 } ; \theta _ { 2 } ) \| _ { 2 } } \\ & \leq \displaystyle \sum _ { t = 1 } ^ { \infty } \frac { L \alpha _ { t } } { 2 } \rho ^ { 2 } + \| L ^ { t t } ( w _ { 1 } ; \theta _ { 2 } ) \| _ { 2 } + \displaystyle \sum _ { t = 1 } ^ { \infty } \frac { \delta \beta _ { t } ^ { 2 } } { 2 } ( 2 \boldsymbol { y } _ { t } ) ^ 2 \end{array}
564
+ $$
565
+
566
+ The inequality next to last holds since our loss function is bounded by $M$ , and the last one holds for $\textstyle \sum _ { t = 1 } ^ { \infty } \alpha _ { t } ^ { 2 }$ and $\textstyle \sum _ { t = 1 } ^ { \infty } \beta _ { t } ^ { 2 }$ are finite.
567
+
568
+ In addition, since
569
+
570
+ $$
571
+ \begin{array} { r l } & { \displaystyle \sum _ { t = 1 } ^ { \infty } \frac { \beta _ { t } } { n } \sum _ { j = 1 } ^ { n } \| \frac { \partial \lambda _ { j } ( \theta ; w _ { t + 1 } ) } { \partial \theta } | _ { \theta ^ { t + 1 } } \| _ { 2 } \| \nabla _ { \theta _ { t } } L ^ { c } ( \hat { w } _ { t } ( \theta _ { t } ) ) \| _ { 2 } \big ( \| l ( y _ { j } , \hat { y } ( w _ { t + 1 } ) \big ) \| _ { 2 } + \| l ( y _ { j } , \hat { y } ( w _ { t + 1 } ) \big ) \| _ { 2 } \big ) } \\ & { \displaystyle \le 2 M \rho \delta \sum _ { t = 1 } ^ { \infty } \beta _ { t } \le \infty , } \end{array}
572
+ $$
573
+
574
+ we can obtain that
575
+
576
+ $$
577
+ \sum _ { t = 1 } ^ { \infty } \alpha _ { t } \| \nabla _ { w _ { t } } L ^ { t r } ( w _ { t } ; \theta _ { t + 1 } ) \| _ { 2 } ^ { 2 } \leq \infty .
578
+ $$
579
+
580
+ In the other hand, based on the inequality:
581
+
582
+ $$
583
+ ( \| a \| + \| b \| ) ( \| a \| - \| b \| ) \leq \| a + b \| \| a - b \| ,
584
+ $$
585
+
586
+ we have
587
+
588
+ $$
589
+ \begin{array} { r l } & { \quad \| \nabla L ^ { t r } ( w _ { t + 1 } ; \theta _ { t + 2 } ) \| _ { 2 } ^ { 2 } - \| \nabla L ^ { t r } ( w _ { t } ; \theta _ { t + 1 } ) \| _ { 2 } ^ { 2 } \| } \\ & { = ( \| \nabla L ^ { t r } ( w _ { t + 1 } ; \theta _ { t + 2 } ) \| _ { 2 } + \| \nabla L ^ { t r } ( w _ { t } ; \theta _ { t + 1 } ) \| _ { 2 } ) ( \| \nabla L ^ { t r } ( w _ { t + 1 } ; \theta _ { t + 2 } ) \| _ { 2 } - \| \nabla L ^ { t r } ( w _ { t } ; \theta _ { t + 1 } ) \| _ { 2 } ) } \\ & { \le \| \nabla L ^ { t r } ( w _ { t + 1 } ; \theta _ { t + 2 } ) + \nabla L ^ { t r } ( w _ { t } ; \theta _ { t + 1 } ) \| _ { 2 } \| \| _ { 2 } \| \nabla L ^ { t r } ( w _ { t + 1 } ; \theta _ { t + 2 } ) - \nabla L ^ { t r } ( w _ { t } ; \theta _ { t + 1 } ) \| _ { 2 } } \\ & { \le ( \| \nabla L ^ { t r } ( w _ { t + 1 } ; \theta _ { t + 2 } ) \| _ { 2 } + \| \nabla L ^ { t r } ( w _ { t } ; \theta _ { t + 1 } ) \| _ { 2 } ) \| \nabla L ^ { t r } ( w _ { t + 1 } ; \theta _ { t + 2 } ) - \nabla L ^ { t r } ( w _ { t } ; \theta _ { t + 1 } ) \| _ { 2 } ) } \\ & { \le 2 L \rho \| ( w _ { t + 1 } , \theta _ { t + 2 } ) - ( w _ { t } , \theta _ { t + 1 } ) \| _ { 2 } } \\ & { \le 2 L \rho \alpha _ { t } \beta _ { t } \| ( \nabla L ^ { t r } ( w _ { t } , \theta _ { t + 1 } ) , \nabla L ^ { c } ( w _ { t } , \theta _ { t + 1 } ) ) \| _ { 2 } } \\ & { \le 2 \sqrt { 2 } L \rho ^ { 2 } \beta _ { 1 } \alpha _ { t } } \end{array}
590
+ $$
591
+
592
+ For Eq. 34 which reads
593
+
594
+ $$
595
+ \sum _ { t = 1 } ^ { \infty } \alpha _ { t } \| \nabla _ { w _ { t } } L ^ { t r } ( w _ { t } ; \theta _ { t + 1 } ) \| _ { 2 } ^ { 2 } \leq \infty ,
596
+ $$
597
+
598
+ since $\textstyle \sum _ { t = 0 } ^ { \infty } \alpha _ { t } \ = \ \infty$ , and there exists $K \ = \ C \ > \ 0$ , such that $\big | \big | \nabla L ^ { t r } ( w _ { t + 1 } ; \theta _ { t + 2 } ) \big | \big | _ { 2 } ^ { 2 } \ -$ $\| \nabla L ^ { t r } ( w _ { t } ; \theta _ { t + 1 } ) \| _ { 2 } ^ { 2 } | \le C \alpha _ { t }$ , by Lemma 2., we can conclude that
599
+
600
+ $$
601
+ \operatorname* { l i m } _ { t \to \infty } \| \nabla _ { w _ { t } } L ^ { t r } ( w _ { t } ; \theta _ { t + 1 } ) \| _ { 2 } ^ { 2 } = 0 ,
602
+ $$
603
+
604
+ which indicates that the gradient of loss on training set of our algorithm will finally achieve to zero, and thus the iteration of $w$ enables training loss to converge.
md/train/H4e7mBnC9f0/H4e7mBnC9f0.md ADDED
@@ -0,0 +1,310 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Differentiable Spike: Rethinking Gradient-Descent for Training Spiking Neural Networks
2
+
3
+ Yuhang $\mathbf { L i } ^ { 1 : }$ ∗, Yufei $\mathbf { G u o ^ { 2 * } }$ , Shanghang Zhang3, Shikuang Deng1, Yongqing $\mathbf { H a i } ^ { 2 }$ , Shi $\mathbf { G u } ^ { \mathrm { 1 } \boxtimes }$
4
+
5
+ 1University of Electronic Science and Technology of China, 2Peking University, 3University of California Berkeley liyuhang699@gmail.com, yfguo@pku.edu.cn, gus@uestc.edu.cn
6
+
7
+ # Abstract
8
+
9
+ Spiking neural networks (SNNs) have emerged as a biology-inspired method mimicking the spiking nature of brain neurons. This biomimicry derives SNNs’ energy efficiency of inference on neuromorphic hardware. However, it also causes an intrinsic disadvantage in training high-performing SNNs from scratch since the discrete spike prohibits the gradient calculation. To overcome this issue, the surrogate gradient (SG) approach has been proposed as a continuous relaxation. Yet the heuristic choice of SG leaves it vacant how the SG benefits the SNN training. In this work, we first theoretically study the gradient descent problem in SNN training and introduce finite difference gradient to quantitatively analyze the training behavior of SNN. Based on the introduced finite difference gradient, we propose a new family of Differentiable Spike (Dspike) functions that can adaptively evolve during training to find the optimal shape and smoothness for gradient estimation. Extensive experiments over several popular network structures show that training SNN with Dspike consistently outperforms the state-of-the-art training methods. For example, on the CIFAR10-DVS classification task, we can train a spiking ResNet-18 and achieve $7 5 . 4 \%$ top-1 accuracy with 10 time steps.
10
+
11
+ # 1 Introduction
12
+
13
+ Recently, spiking neural networks (SNNs) have received increasing attention due to their biologyinspired neural behavior and efficient computation. SNNs deal with binary spike information and therefore enjoy the advantage of multiplication-free inference. Neuromorphic hardware such as TrueNorth [1] and Loihi [2] demonstrates that SNNs can save energy by orders of magnitude. Hybrid architecture like Tianjic [3] suggests its potential power for general intelligence when integrated with traditional artificial infrastructure. However, the bio-mimicry also causes an intrinsic disadvantage in training high-performing SNNs from scratch due to the discrete spike. As a result, obtaining a high-performing SNN has long been a critical problem limiting SNN’s deployment in practice.
14
+
15
+ To be more specific, the appealing advantage of the multiplication-free computation in SNN is not recognized in its training [4]. Modern ML frameworks such as Pytorch [5], JAX [6], and Tensorflow [7] do not provide efficient and general instructions or high-level functions to accelerate the convolution with 0/1 spike activation. Moreover, the binary activation in SNN produces allor-nothing gradients [8] that are incompatible with typical gradient-based optimization methods for efficient neural network training. To circumvent this problem, many works adopt surrogate gradients [8] (typically the derivative of a soft-relaxed function) to replace the spike non-linear gradient. Although the heuristic choice of SG is beneficial to enable the gradient descent in SNN training, the theoretical soundness of SG has not been justified so far. What’s more, the gradient descent in SNN training may follow different updating rules from ANN. In fact, since the true gradient value of spike activation does not exist, the adoption of SG raises a new question of how to replace the $\infty$ -gradient adaptively through the training process for a good updating strategy of parameters.
16
+
17
+ ![](images/012f9c41f16a3f7d725581105934c4ac57dfecbb0474bbc6673af5b5ff35c998.jpg)
18
+ Figure 1: Overall workflow of the proposed algorithm. We use a general, flexible Dspike function and control its shape with finite difference method to facilitate the surrogate gradient descent in training SNN.
19
+
20
+ In this work, we study this specialized problem of adaptive gradient estimation in SNN training. We first revisit the gradient descent algorithm with the finite difference method to accurately depict the loss landscape of adopting a surrogate gradient for the non-differentiable spike firing function. Then we further propose the Differentiable Spike (Dspike) function, which can adaptively change its shape and capture the direction of finite difference gradients. With such adaptive surrogate gradients, we establish an efficient algorithm of training SNN with large-scale models. The overall workflow of our algorithm is visualized in Fig. 1.
21
+
22
+ Our contributions can be summarized as follows:
23
+
24
+ • We identify the problem of adaptively estimating gradient in SNN training and propose a novel analysis framework for SNN’s surrogate gradient, through which we are able to not only explain why it works well but also indicate how we can improve its adaptivity to data through training. • We also introduce the novel Dspike function built from the hyperbolic tangent function. The Dspike function can learn its shape accordingly by matching it with the finite difference gradient. • Extensive experiments on both static and dynamic datasets show that our method is highly effective and efficient. For example, our model can achieve $7 5 . 4 \%$ top-1 accuracy on the CIFAR-DVS. Our SNN also only consumes $7 . 8 \%$ energy of the corresponding ANN on CIFAR-10.
25
+
26
+ # 2 Related Work
27
+
28
+ ANN-SNN Conversion. Generally, the algorithms to obtain a high-performance can be divided into two routes: (1) ANN-SNN conversion and (2) direct training SNN from scratch. Conversion-based methods [9, 10] utilize the knowledge from ANN and convert the ReLU activation to spike activation mechanism. This type of method can produce an SNN in a short time. For example, Rueckauer et al. [11] propose to traverse the training dataset to find the maximum activation. Then, the SNN can be converted by directly replacing several modules. In [12], maximum activation is abandoned since it may out-lie the central range of activation. The authors choose to find the percentile numbers for threshold voltage to improve the robustness. TSC [13] adopts the soft-reset (also known as reset by subtraction) mechanism and no leakage for conversion, which proves to be effective in conversion. Deng & Gu [14] decompose the conversion error to each layer, then propose to reduce the error by shifting the bias term. [15] first propose the calibration to reduce the conversion accuracy. ANN-SNN conversion is fast and accurate. However, achieving near lossless conversion requires a considerable amount of time steps $( > 2 0 0 )$ to accumulate the spikes, which may significantly add up the latency.
29
+
30
+ Direct Training SNN. In contrast to the conversion method, direct training of SNNs can lower the time step and may further reduce energy consumption. Direct training leverages gradient-descent algorithms. And many works have been developed to tackle the non-differentiability of spike activation. This non-differentiable activation function is similar to the quantization or binarization neural network [16, 17, 18] or adder neural network [19]. [20] achieve high performance on CIFAR10 and other neuromorphic datasets. Some works use probabilistic models to approximate the gradient [21], which is also developed in binary stochastic model [22]. Another common approach is to use rate-encoding networks for gradients calculation [23, 24]. They quantize the spike rate as the magnitude of information transmitted. (Wu et al. 2019 [25] improves the leaky integrate-and-fire (LIF) model to an iterative LIF model and develops STBP learning algorithm. Zheng et al. [26] further propose the tdBN algorithm to balance the gradient norm and smooth the loss function in SNN training, enabling large-scale model optimization.
31
+
32
+ # 3 Preliminary
33
+
34
+ # 3.1 Leaky Integrate-and-Fire Model
35
+
36
+ We use bold italic letters for vector representations. For example, $_ { \textbf { \em x } }$ and $\textbf { { y } }$ denote the input and target output variables. Bold capital letters like W denote the matrices (or tensors as clear from the text). Constants are denoted by small upright letters, e.g., $a$ . With bracketed superscript and subscript, we can denote the time dimension and the element indices, respectively. For example, $\mathbf { \boldsymbol { \mathsf { u } } } _ { i } ^ { ( t ) }$ means the $i$ -th membrane potential at time step $t$ . We adopt the well-known Leaky Integrate-and-Fire (LIF) neuron model for a spiking neural network (SNN). Given a membrane potential $\mathbf { \boldsymbol { u } } ^ { ( t ) }$ , the pre-synaptic potential is updated as
37
+
38
+ $$
39
+ \begin{array} { r } { \pmb { u } ^ { ( t + 1 ) , \mathrm { p r e } } = \tau \pmb { u } ^ { ( t ) } + \pmb { c } ^ { ( t + 1 ) } , \mathrm { w h e r e } \ \pmb { c } ^ { ( t + 1 ) } = \mathbf { W } \pmb { x } ^ { ( t + 1 ) } . } \end{array}
40
+ $$
41
+
42
+ Here, $\tau$ is a constant leaky factor within $( 0 , 1 )$ and $c ^ { ( t + 1 ) }$ is the pre-synaptic input at time step $t + 1$ . The input can be calculated from the dot-product between the weights and the spike from the previous layer. Let $V _ { t h }$ be the firing threshold, the membrane potential will fire a spike when it exceeds the threshold, and then hard-reset to 0, given by
43
+
44
+ $$
45
+ \pmb { y } ^ { ( t + 1 ) } = \{ \begin{array} { l l } { 1 } & { \mathrm { i f ~ } \pmb { u } ^ { ( t + 1 ) , \mathrm { p r e } } > V _ { t h } } \\ { 0 } & { \mathrm { o t h e r w i s e } } \end{array} , \pmb { u } ^ { ( t + 1 ) } = \pmb { u } ^ { ( t + 1 ) , \mathrm { p r e } } \cdot ( 1 - \pmb { y } ^ { ( t + 1 ) } )
46
+ $$
47
+
48
+ After firing, the spike output $\pmb { y } ^ { ( t + 1 ) }$ will propagate to the next layer and become the input $\boldsymbol { x } ^ { ( t + 1 ) }$ of the next layer, (note that we omit the layer index for simplicity). $V _ { t h }$ is set to 0.5 in this work.
49
+
50
+ Softmax in SNN. In the general classification model, the final network output will be leveraged to compute the softmax and then to find the winner class. However, the network output is highly variant per input sample, and unlike ReLU activation, the output could be positive or negative. For this reason, we choose to only integrate the network output, and do not fire them across time, as did in recent practices [26, 27].
51
+
52
+ $$
53
+ { \pmb y } _ { \mathrm { n e t } } = \frac { 1 } { T } \sum _ { i = 1 } ^ { T } { \pmb c } _ { \mathrm { n e t } } ^ { ( t ) } = \frac { 1 } { T } \sum _ { i = 1 } ^ { T } { \bf W } { \pmb x } ^ { ( t ) } ,
54
+ $$
55
+
56
+ Then, we can compute the cross-entropy loss based on the ture label and Softmax $( y _ { \mathrm { n e t } } )$
57
+
58
+ # 3.2 Time-dependent Batch Normalization
59
+
60
+ Batch Normalization (BN) [28] is used to reduce internal covariate shift and smooth the loss landscape [29] during the optimization of an ANN. It enables the stable training of ANN even with more than 100 layers on the large-scale dataset, e.g. ResNet-152 [30]. However, BN layers are not designed to normalize spatial-temporal data at first. And simply transplanting BN in SNN training will lead to undesired results. To solve this problem, Zheng et al. [26] propose time-dependent Batch Normalization (tdBN), which normalizes the data in both spatial and temporal paradigm. tdBN will gather the pre-synaptic input along the time dimension, denoted by $\mathbf { C } = [ \pmb { c } ^ { ( 1 ) } , \pmb { c } ^ { ( 2 ) } , \pmb { , . . . } , \pmb { c } ^ { ( T ) } ]$ , and then normalize it by
61
+
62
+ $$
63
+ \begin{array} { r l r } & { \bar { \bf C } = \frac { \alpha V _ { t h } \left( { \bf C } - \mathbb { E } \left[ { \bf C } \right] \right) } { \sqrt { \mathbb { V } \mathbb { A } \mathbb { R } \left( { \bf C } \right) + \epsilon } } \qquad } & { \# \mathrm { n o r m a l i z e } } \\ & { \hat { \bf C } = \gamma \bar { \bf C } + \beta , \qquad } & { \# \mathrm { a f f i n e ~ t r a n s f o r m a t i o n } } \end{array}
64
+ $$
65
+
66
+ where $\mathbb { E }$ and $\mathbb { V } \mathbb { A } \mathbb { R }$ compute the mean and variance in channel dimension. $\gamma$ and $\beta$ are learnable parameters. Note that in tdBN the normalized tensor will multiply $\alpha V _ { t h }$ , which can prevent over-fire and under-fire by choosing $\alpha$ wisely. After tdBN, the pre-synaptic input in each time step will be fed into Eq. (1). tdBN stabilizes the training of SNN and achieves good results. We also adopt this training technique in our framework. See [26] for more details of tdBN.
67
+
68
+ # 4 Methodology
69
+
70
+ # 4.1 Non-Differentiable Spike
71
+
72
+ One of the most notorious problems in SNN training is the non-differentiability of the firing function Eq. (2). The firing function could be viewed as a variant of sign function, whose derivative is identified as the Dirac delta function. This derivative is 0 almost everywhere except for the threshold that grows to infinity. Seemingly, directly using the Dirac delta function is not an ideal choice for gradient descent-based learning. To demonstrate this problem, let $L$ denote the task loss objective, we can compute the gradient of weights parameters using the spatial-temporal backpropagation (STBP):
73
+
74
+ $$
75
+ \frac { \partial L } { \partial \mathbf { W } } = \sum _ { t } \frac { \partial L } { \partial \pmb { y } ^ { ( t ) } } \frac { \partial \pmb { y } ^ { ( t ) } } { \partial \pmb { u } ^ { ( t ) , \mathrm { p r e } } } \frac { \partial \pmb { u } ^ { ( t ) , \mathrm { p r e } } } { \partial \pmb { c } ^ { ( t ) } } \frac { \partial \pmb { c } ^ { ( t ) } } { \partial \mathbf { W } } .
76
+ $$
77
+
78
+ In above equation, $\frac { \partial \pmb { y } ^ { ( t ) } } { \partial \pmb { u } ^ { ( t ) , \mathrm { p r e } } }$ is the gradient of firing function and is 0 almost everywhere, as aforementioned. As a consequence, the gradient descent $\begin{array} { r } { ( \mathbf { W } \mathbf { W } - \eta \frac { \partial L } { \partial \mathbf { W } } ) } \end{array}$ either freezes weights or updates the weights to infinity.
79
+
80
+ To mitigate this problem, prior work seeks an alternative gradient (also known as surrogate gradient) to circumvent this problem. A popular surrogate gradient may refer to the rectangular function proposed in [4], given by
81
+
82
+ $$
83
+ \frac { \partial \pmb { y } ^ { ( t ) } } { \partial \pmb { u } ^ { ( t ) , \mathrm { p r e } } } = \frac { 1 } { a } \mathrm { s i g n } \left( \left| \pmb { u } ^ { ( t ) , \mathrm { p r e } } - V _ { t h } \right| < \frac { a } { 2 } \right) ,
84
+ $$
85
+
86
+ where $a$ is a hyper-parameter and usually set to 1. When $V _ { t h } = 0 . 5 , a = 1$ , the gradient is simplified to 1 if $0 \leq u ^ { ( t ) , \mathrm { p r e } } \leq 1$ otherwise 0. This is known as the Straight-Through Estimator in Bengio et al. [22] and is broadly applied in binary networks [31]. Another family of surrogate gradient may refer to triangular gradients [32], given by
87
+
88
+ $$
89
+ \frac { \partial \pmb { y } ^ { ( t ) } } { \partial \pmb { u } ^ { ( t ) , \mathrm { p r e } } } = \gamma \operatorname* { m a x } \left( 0 , 1 - \left| \frac { \pmb { u } ^ { ( t ) , \mathrm { p r e } } } { V _ { t h } } - 1 \right| \right) .
90
+ $$
91
+
92
+ This surrogate gradient is computed based on the distance between the potential and threshold. Despite various surrogate gradients achieve acceptable accuracy, there lacks a theoretical justification for its reason and effectiveness.
93
+
94
+ # 4.2 Rethinking Gradient-Descent in Spiking Neural Networks
95
+
96
+ Gradient-descent (GD) algorithm is a first-order iterative optimization method. Theoretically, for each iteration, GD aims to find the steepest direction for the descent that minimizes the task loss:
97
+
98
+ $$
99
+ \operatorname* { m i n } _ { | | \Delta \mathbf { W } | | \leq \varepsilon } L ( \mathbf { W } + \Delta \mathbf { W } ) \approx \operatorname* { m i n } _ { | | \Delta \mathbf { W } | | \leq \varepsilon } L ( \mathbf { W } ) + \Delta \mathbf { W } \frac { \partial L } { \partial \mathbf { W } }
100
+ $$
101
+
102
+ Note that the right-hand side of the minimization is approximated by the first-order Taylor expansion. Given that $L ( \mathbf { W } )$ is constant at the current iteration, therefore we only have to find the right $\Delta \mathbf { W }$ that minimizes the second term. Since the 2nd term is a linear in $\Delta \mathbf { W }$ , it can be made as negative as we like by taking $\Delta { \bf W }$ large. Therefore the minimum is $\begin{array} { r } { \Delta \mathbf { W } = - \varepsilon \frac { \nabla \mathbf { w } L } { | | \nabla \mathbf { w } L | | } } \end{array}$ , (where $\begin{array} { r } { \nabla { \bf w } L = \frac { \partial L } { \partial \bf W } . } \end{array}$ ∂ L∂ W ).
103
+
104
+ Note that the above condition is only sufficient for $\varepsilon 0$ to correctly approximate the loss with Taylor expansion. However, $\varepsilon 0$ means $\begin{array} { r } { \Delta \mathbf { W } = - \varepsilon \frac { \nabla \mathbf { w } L } { | | \nabla \mathbf { w } L | | } 0 } \end{array}$ , but in practice GD updates the weights by a small step (determined by learning rate), which, indicates a mismatch between the practical implementation and the theoretical assumption. In other words, gradient only inspects the change rate of loss around an infinitely small neighborhood, however, we are interested in the change rate around a tiny (but not infinitely small) area. In the case of SNN, the gradient will always be $0 ^ { \mathit { \Phi } }$ , yet for a tiny neighborhood the loss function will change, leading to non-zero gradients. To penetrate the non-differentiability of the firing function, we adopt a technique called finite difference. It estimates the gradient by evaluating the loss objective near the coordinate:
105
+
106
+ ![](images/45783978b928cbb997105b7291a1e3566ef066a2a4fbc4c021e17b11b23e1ac2.jpg)
107
+ Figure $\mathbf { 2 \alpha \& }$ Table 1: Left: The cosine similarity between the gradients used for update and the FDG. In (a) we show ANN gradients and in (b) we show SNN rectangular surrogate gradients. Right: Training SNN with finite difference gradient, given different $\varepsilon$ .
108
+
109
+ $$
110
+ \hat { \nabla } _ { \varepsilon , w } L = \left( \frac { L ( w _ { 1 } + \varepsilon e _ { 1 } ) - L ( w _ { 1 } - \varepsilon e _ { 1 } ) } { 2 \varepsilon } , \ldots , \frac { L ( w _ { k } + \varepsilon e _ { k } ) - L ( w _ { k } - \varepsilon e _ { k } ) } { 2 \varepsilon } \right) ,
111
+ $$
112
+
113
+ where $\textbf { \em w }$ is the flattened vector of $\mathbf { W }$ and $e _ { i }$ refers to standard basis vector with 1 at $i$ -th index. $\varepsilon$ is some small constant, e.g. 0.001. We call $\hat { \nabla } _ { \varepsilon , w } L$ as finite difference gradient (FDG). By the definition of gradient, we know FDG becomes the true gradient when $\varepsilon 0$ . FDG can be a useful tool in GD-based learning, however, evaluating finite difference for each element in the weight vector is tedious, which greatly slows down the training process. Nevertheless, FDG still offers us a choice to evaluate the gradient mismatch problem quantitatively.
114
+
115
+ In order to illustrate this, we construct a toy problem: a simple 2-layer CNN on the MNIST dataset. The first layer is a $3 \mathrm { x } 3$ convolutional layer (output channel number is 6) with ReLU activation (or LIF spike activation) and average pooling for down-sampling. Then, we directly add a fully connected layer to predict the classification results. We train the toy model on MNIST for 5 epochs, with batch size 128 and learning rate 0.01 decayed to 0. In an effort to compute the FDG of the first layer, we have to perform $2 \times 1 \times 6 \times 3 \times 3 = 1 0 8$ times forward pass 3. In contrast, one has to perform 22 million times forward passes on a ResNet-18 [30] to compute the FDG of all parameters.
116
+
117
+ Experiment I: FDG in ANN. We first train an ANN on MNIST and compare the disparity between real gradients and FDG. We use cosine similarity (i.e. $\begin{array} { r } { \cos _ { - } \sin ( { \pmb x } _ { 1 } , { \pmb x } _ { 2 } ) = \frac { { \pmb x } _ { 1 } { \pmb x } _ { 2 } } { | | { \pmb x } _ { 1 } | | _ { 2 } | | { \pmb x } _ { 2 } | | _ { 2 } } ) } \end{array}$ x1x2||x1||2||x2||2 ) to determine the angle between these two gradient vectors. For each epoch, we compute the mean cosine similarity in the first 100 training iterations. The results are demonstrated in Fig. 2(a). The FDG and real gradients consistently have an extremely similar direction $( > 0 . 9 9 \mathrm { c o s \_ s i m } )$ with $\varepsilon$ varying from 0.1 to 0.001. In conclusion, we show that (1) FDG is a valid signal and (2) the real gradients can effectively find the change rate within a small neighborhood in ANN optimization.
118
+
119
+ Experiment II: FDG in SNN. Then, we compare the cosine similarity between the surrogate gradients in SNN and the FDG. In Fig. 2(b), we can tell that surrogate gradients share similar gradient direction with FDG when $\varepsilon = 0 . 1$ (i.e. more than 0.8 cosine similarity). However, decreasing $\varepsilon$ will lead to lower cosine similarity. In the case of $\varepsilon = 0 . 0 0 1$ , the angle between FDG and the surrogate gradients is nearly 90 degrees, (for comparison, in high-dimensional space, two arbitrary random Gaussian vectors are very likely to be orthogonal). This observation concludes that surrogate gradient can predict the change rate of loss in a relatively larger neighborhood, which justifies the soundness of surrogate gradients. However, SG fails to predict the FDG in small step size $\varepsilon$ . To this end, we need to figure out whether a large step size is better or a small step size is better.
120
+
121
+ Experiment III: Training SNN with FDG. In SNN optimization, a natural question arises: What ε is optimal for gradient descent? First, the $\varepsilon$ has to be small enough to compute the non-linearity of the loss surface, meanwhile, it has to be large enough to ignore the noise from the rough step function. For this reason, we explore the optimal $\varepsilon$ by applying FDG in SNN optimization. The results are demonstrated in the Table 1. Note that all methods are trained on MNIST for only 10 epochs here. We show that the rectangular surrogate gradient with $a = 1$ reaches $9 4 . 9 \%$ accuracy. For FDG optimization, we evaluate $\varepsilon$ ranging from 0.001 to 0.5, and we find 0.1 is the best choice for optimizing SNN. The results confirm our assumption that $\varepsilon$ has to be neither too big nor too small. It also tells us using the instant change rate (very small $\varepsilon$ ) will lead to undesired performance degradation.
122
+
123
+ # 4.3 Differentiable Spike
124
+
125
+ In this section, we introduce the Dspike function, a novel surrogate gradient estimator, which can cover a large range of choices for SG. We choose the hyperbolic tangent function $\begin{array} { r } { \operatorname { t a n h } ( x ) = \frac { e ^ { x } - e ^ { - x } } { e ^ { x } + e ^ { - x } } } \end{array}$ as our basic building function for gradient estimation:
126
+
127
+ $$
128
+ \operatorname { D s p i k e } ( x ) = { \left\{ \begin{array} { l l } { 1 } & { { \mathrm { i f ~ } } x > 1 } \\ { a \cdot \operatorname { t a n h } ( b ( x - c ) ) + d } & { { \mathrm { i f ~ } } 0 \leq x \leq 1 } \\ { 0 } & { { \mathrm { i f ~ } } x < 0 } \end{array} \right. }
129
+ $$
130
+
131
+ When $x < 0$ or $x > 1$ , we choose to clip $x$ as did in other practice. The vanilla tanh function maps $( - \infty , + \infty )$ to $( - 1 , 1 )$ , thus we have four parameters to control its shape to alter the function mapping: from $[ - 1 , 1 ]$ to [1, 1]. We first use $c = V _ { t h } = 0 . 5$ to set the symmetry center to (0.5, 0.5). Parameter $b ( b > 0 )$ is called the temperature factor, it controls the shape of the Dspike function. Parameter $a$ and $d$ can then be determined by setting $\mathrm { D s p i k e ( 0 ) } = 0 , \mathrm { D s p i k e ( 1 ) } = 1$ . As a result, we can rewrite the function as:
132
+
133
+ $$
134
+ \mathrm { D s p i k e } ( x , b ) = \frac { \operatorname { t a n h } ( b ( x - 0 . 5 ) ) + \operatorname { t a n h } ( b / 2 ) } { 2 ( \operatorname { t a n h } ( b / 2 ) ) } , \mathrm { i f ~ } 0 \leq x \leq 1 .
135
+ $$
136
+
137
+ Dspike function has the capability to adjust the shape of the function, leading to different surrogate gradient estimations. To demonstrate that, we have the following lemma:
138
+
139
+ Lemma 4.1. By changing the temperature $b$ , the shape of Dspike function can be altered. Specifically, we have $\dim _ { b \to 0 _ { + } } { \mathrm { D s p i k e } } ( x ) \to x$ and $\scriptstyle \operatorname* { l i m } _ { b \to + \infty }$ $\mathrm { D s p i k e } ( x ) \to \mathrm { s i g n } ( x - 0 . 5 )$ .
140
+
141
+ Proof. We first prove the case $b \to 0 _ { + }$ . In this case, applying Taylor expansion to the tanh we have:
142
+
143
+ $$
144
+ \operatorname { t a n h } ( b x ) \approx b x - { \frac { b ^ { 3 } x ^ { 3 } } { 3 } } + \cdots + { \frac { 2 ^ { ( 2 n ) } ( 2 ^ { ( 2 n ) } - 1 ) B _ { 2 n } ( b x ) ^ { 2 n - 1 } } { ( 2 n ) ! } } ,
145
+ $$
146
+
147
+ where $B _ { n }$ is the $n$ -th Bernoulli number. When $b \to 0$ , we can safely ignore higher-order terms and only keep $b x$ . Thus, we can rewrite Eq. (12) to ${ \mathrm { D s p i k e } } ( x , b ) = { \sqrt [ { b } ] { b } } { \stackrel { - } { = } } x$ . Then, we prove the case $b \to + \infty$ . Since $\scriptstyle \operatorname* { l i m } _ { x \to + \infty } \operatorname { t a n h } ( x ) \to 1$ , we have:
148
+
149
+ $$
150
+ \operatorname* { l i m } _ { b \to + \infty } \operatorname { D s p i k e } ( x , b ) \{ \{ \begin{array} { l l } { \frac { 2 * \operatorname { t a n h } ( + \infty ) } { 2 * \operatorname { t a n h } ( + \infty ) } = 1 } & { \mathrm { i f ~ } x > 0 . 5 } \\ { \frac { \operatorname { t a n h } ( + \infty ) } { 2 * \operatorname { t a n h } ( + \infty ) } = 0 . 5 } & { \mathrm { i f ~ } x = 0 . 5 } \\ { \frac { 0 } { 2 * \operatorname { t a n h } ( + \infty ) } = 0 } & { \mathrm { i f ~ } x < 0 . 5 } \end{array}
151
+ $$
152
+
153
+ With this temperature factor, our algorithm can simulate a wide range of surrogate gradients with different smoothness. We visualize the transition in Fig. 3 from both forward perspective and backward perspective. As aforementioned, surrogate gradient can mimic the FDG in a relatively large neighborhood. Our intuition is that the optimal surrogate gradient can be found by choosing temperature wisely. Thus our task becomes to optimize temperature and network parameters simultaneously during training. As did in former toy experiments (Sec. 4.2), we verify the cosine similarity between our Dspike gradients and the FDG at the beginning of each training epoch and update the temperature to better match the FDG. This algorithm is detailed in Algo. 1.
154
+
155
+ As abovementioned, evaluating FDG could be time-consuming, due to the two times evaluation of the final loss for each weight element. Therefore, we choose to only compute the FDG in the first layer for two reasons. First, the first layer has much fewer weights. In ResNet-18 (for CIFAR10 dataset), the first layer only has $3 \times 3 \times 3 \times 6 4 = 5 7 6$ elements. Second, the gradient propagation may accumulate the error in the former layers, which effectively measures the gradient mismatch.
156
+
157
+ ![](images/b058289d96cf2a3af515bea104b590c2e4c5ac976b0e01ce56486282f76a0509.jpg)
158
+ Figure 3: The forward plot (left) as well as the backward plot (right) of Dspike function. By changing temperature parameter we can manipulate the gradient estimation in SNN training.
159
+
160
+ # Algorithm 1: Training SNN with Dspike gradient
161
+
162
+ Input: SNN to be trained; Training dataset, total training epoch $E$ , total training iteration in one epoch $I$ , FDG step size $\varepsilon$ , temperature update step size $\Delta b$ , initialized temperature $b ^ { 0 }$ .
163
+ for all $e = 1 , 2 , \ldots , E$ -th epoch do Collect input data and labels, computing the FDG $( \hat { \nabla } _ { \varepsilon , w } L )$ of the first layer using $\varepsilon$ ; for all $b$ in $\{ b ^ { e - 1 } , b ^ { e - 1 } + \Delta b , b ^ { e - 1 } - \Delta b \}$ do Compute Dsipke surrogate gradient $\nabla _ { b , w } L$ and $\cos \underline { { \mathrm { ~ \scriptstyle ~ \psi ~ } } } \mathrm { s i m } ( \hat { \nabla } _ { \varepsilon , w } L , \nabla _ { b , w } L )$ Find the optimal temperature with the highest cosine similarity and update it to $b ^ { e }$ ; for all $i = 1 , 2 , \dots , I$ -iteration do Get training data and labels, compute Dspike surrogate gradient using optimal $b$ ; Descend loss function and update weights;
164
+
165
+ return trained SNN.
166
+
167
+ # 4.4 Time Inheritance Training
168
+
169
+ We also introduce a novel training pipeline that can effectively reduce the time for training multiple SNNs. Unlike ANN-SNN conversion, direct training SNN is performed with a fixed time step $T$ . As a result, we must learn a new SNN from scratch if we decide to use another different $T$ . We propose Time Inheritance Training (TIT) pipeline to ameliorate this problem. First, we train an SNN to converge with high $T$ , e.g. 20. Then, we use this well-trained model to initialize an SNN with lower $T$ , say $T = 1 0$ . Consequently, the initialized model has exactly the same output as the former model in the first 10 time steps, enabling better initialization and faster convergence. In other words, TIT progressively reduces the time step finetuning from a higher time step SNN first. This idea resembles the curriculum learning proposed in Bengio et al. [33], which suggests learning the easy task first. Armed with TIT, we can reduce the training time of subsequent models by $7 5 \%$ , while sharing the same task performances.
170
+
171
+ # 5 Experiments
172
+
173
+ In this section, we report experimental results for our Dspike algorithm on CIFAR [34] and ImageNet dataset [35]. For static image dataset, we encode the images to spike using the first layer in the SNN, as adopted in recent works [27]. For the neuromorphic image dataset, the images are already converted to 0/1 spike format. We also replace the max-pooling layer with the average-pooling layer in the network architecture. The detailed implementation is described in each subsection.
174
+
175
+ # 5.1 Network Architecture Choice
176
+
177
+ For CIFAR series experiments. We mainly adopt the ResNet-family architectures [30]. Unlike traditional ResNet structure [30], we use a modified version with 3 stem layers and avg-downsample block, as introduced in [36]. Our ResNet-18 architectures contains 4 stages with 2 basic residual block in each stage. Our initial channel is set to 64 and doubled in each stage. In comparison with [26], they use ResNet-19 with 3 stages, with 3 blocks in the first 2 stages and 2 blocks in the last stage. However, they choose 128 channel and they has larger receptive field than our model. In general, their ResNet-19 has ${ \sim } 1 0$ times more operations than our ResNet-18. For ImageNet, we use the same VGG-16 as used in [27] and the same ResNet-34 as used in [26].
178
+
179
+ Table 2: Training Spiking Neural Networks on CIFAR10 and CIFAR100.
180
+
181
+ <table><tr><td>Dataset</td><td>Method</td><td>Type</td><td>Architecture</td><td>Time Step</td><td>Accuracy</td></tr><tr><td rowspan="10">CIFAR10</td><td>SpikeNorm [10]</td><td>ANN-SNN conversion</td><td>VGG-16</td><td>2500</td><td>91.55</td></tr><tr><td>Hybrid-Train [40]</td><td>Hybrid</td><td>VGG-16</td><td>200</td><td>92.02</td></tr><tr><td>Spike-based BP [41]</td><td>SNN training</td><td>ResNet-11</td><td>100</td><td>90.95</td></tr><tr><td>STBP [4]</td><td>SNN training</td><td>5Conv, 2FC</td><td>12</td><td>90.53</td></tr><tr><td>TSSL-BP [42]</td><td>SNN training</td><td>5Conv,2FC</td><td>5</td><td>91.41</td></tr><tr><td>Diet-SNN [27]</td><td>SNN training</td><td>VGG-16</td><td>5</td><td>92.70</td></tr><tr><td></td><td>SNN training</td><td></td><td>6</td><td>93.16</td></tr><tr><td rowspan="3">STBP-tdBN[26]</td><td rowspan="3"></td><td>ResNet-19</td><td>4</td><td>92.92</td></tr><tr><td></td><td>2</td><td>92.34</td></tr><tr><td></td><td>6</td><td>94.25±0.07</td></tr><tr><td rowspan="3"></td><td>Dspike</td><td>SNN training</td><td>ResNet-18</td><td>4</td><td>93.66±0.05</td></tr><tr><td></td><td></td><td></td><td>2</td><td>93.13±0.07</td></tr><tr><td>BinarySNN [43] Diet-SNN [27]</td><td>BNN-SNN conversion SNN training</td><td>VGG-15 VGG-16</td><td>62</td><td>63.20</td></tr><tr><td rowspan="3">CIFAR100</td><td></td><td></td><td></td><td>5</td><td>69.67</td></tr><tr><td>Dspike</td><td>SNN training</td><td>ResNet-18</td><td>6 4</td><td>74.24±0.10 73.35±0.14</td></tr><tr><td></td><td></td><td></td><td>2</td><td>71.68±0.12</td></tr><tr><td rowspan="3"></td><td>Rollout [44]</td><td>Streaming roll out ANN</td><td>DenseNet</td><td></td><td></td></tr><tr><td>CIFAR10-DVS STBP-tdBN [26]</td><td>SNN training</td><td>ResNet-19</td><td>10 10</td><td>66.8</td></tr><tr><td>Dspike</td><td>SNN training</td><td>ResNet-18</td><td>10</td><td>67.8 75.4±0.05</td></tr></table>
182
+
183
+ # 5.2 CIFAR
184
+
185
+ The CIFAR10 (100) dataset contains 50K training and 10K test images with $3 2 \times 3 2$ pixels. We use AutoAugment [37] and Cutout [38] for data augmentation. We use ResNet-18 architecture for running experiments. We train the corresponding ANN first and use it to initialize the first SNN with $( T = 6$ ), then we use Time Inheritance Training to gradually reduce the time step to 2. For FDG computation, we use the best practice $\varepsilon = 0 . 1$ in the toy experiments. The temperature is initialized to 1, and we set the update step size to $\Delta b = 0 . 2$ . We adopt SGD optimizer with 0.9 momentum. In the first round of TIT, we train the model for 300 epochs with a learning rate of 0.01 cosine decayed [39] to 0. In the rest rounds of TIT, we only train the model for 50 epochs with a learning rate of 0.004. Weight decay (L2 regularization) is set to 0.0001. We run the model with 4 GTX 1080Tis. For each run, we report the mean accuracy as well as the standard deviation with 3 trials.
186
+
187
+ We summarize the overall results in Table 2. On CIFAR10, our work can outperform state-of-the-art by $1 . 0 9 \%$ accuracy when $T = 6$ . It is also worth noting that the ResNet-19 used in [26] has $2 \mathbf { x }$ channel numbers and a larger feature-map, translating to $1 0 \mathrm { x }$ computation cost. Nevertheless, our ResNet-18 with Dspike still achieves higher accuracy. Notably, our ResNet-18 $T = 2 , 4$ ) is trained with TIT for only 50 epochs, yet still reaches a new state-of-the-art. We also conduct an ablation study: training a 2 time step spiking ResNet-18 without TIT for 300 epochs. The accuracy is only $9 3 . 1 3 \%$ which is subpar with the TIT method. We also verify Dspike on CIFAR100, with the same training pipeline here and we find our model can achieve much better performances than Diet-SNN [27].
188
+
189
+ To further demonstrate the effectiveness of our method, we apply the Dspike function on the eventstream dataset CIFAR10-DVS [45]. CIFAR10-DVS contains 10k $1 2 8 \times 1 2 8$ images converted from CIFAR10. We split the dataset into 9k training images and $1 \mathrm { k }$ test images following the prior practice [26]. For data pre-processing and augmentation, we first resize the training image frames to $4 8 \times 4 8$ , then apply random horizontal flip. Additionally, we apply random roll within 5 pixels. The test images are directly resized to $4 8 \times 4 8$ . Training hyper-parameters are kept the same with the CIFAR10 experiments. Our proposed method can achieve $7 5 . 4 \%$ averaged top-1 accuracy on CIFAR10-DVS, with $7 . 6 \%$ absolute accuracy improvement compared with the existing state of the art.
190
+
191
+ ![](images/62ca32b702e6f8b0fce46b1b5de2fee86e70e10e3991c02c4413ea2c9190f967.jpg)
192
+ Figure 4 & Table 3: Left: Activation sparsity for each LIF layer. The $\mathbf { X }$ -axis denotes the layer index while the $\mathbf { y }$ -axis denotes the activation sparsity. Right: The computation operations count and the energy consumption comparison between ANN and SNN for each run, we select SNN from existing literature.
193
+
194
+ Table 4: Training Spiking Neural Networks on ImageNet.
195
+
196
+ <table><tr><td>Method</td><td>Type</td><td>Architecture</td><td>Time Step</td><td> Accuracy</td></tr><tr><td>SpikeNorm [10]</td><td>ANN-SNN conversion</td><td>ResNet-34</td><td>2500</td><td>65.47</td></tr><tr><td>Hybrid-Train [40]</td><td>Hybrid</td><td>ResNet-34</td><td>250</td><td>61.48</td></tr><tr><td>Hybrid-Train [41]</td><td>Hybrid</td><td>VGG-16</td><td>250</td><td>65.19</td></tr><tr><td>STBP-tdBN [4]</td><td>SNN training</td><td>ResNet-34</td><td>6</td><td>63.72</td></tr><tr><td>Diet-SNN [27]</td><td>SNN training</td><td>VGG-16</td><td>5</td><td>69.00</td></tr><tr><td>Dspike</td><td>SNN training</td><td>ResNet-34</td><td>6</td><td>68.19</td></tr><tr><td>Dspike</td><td>SNN training</td><td>VGG-16</td><td>5</td><td>71.24</td></tr></table>
197
+
198
+ # 5.3 ImageNet
199
+
200
+ In this section we verify our algorithm on the ImageNet dataset. ImageNet dataset has more than $1 2 5 0 \mathrm { k }$ training images and 50k test images. We use the standard pre-processing and augmentation for training data [30]. The test data is directly centered cropped to $2 2 4 \times 2 2 4$ . We train ResNet-34 and VGG-16 on ImageNet using the same architecture in the CIFAR experiments. Each network is trained for 100 epochs with SGD optimizer with 0.9 momentum. The learning rate is set to 0.04 and weight decay is set to 0.00004. We train each model on 32 GTX 1080Tis with batch size of 10 per GPU. Following [26], to avoid the biased statistics, we synchronize the batch mean and variance across each device. Results are demonstrated in Table 4, Dspike training obtain $4 . 5 \%$ improvement compared to STBP-tdBN [26] and $2 . 2 \%$ improvement compared to Diet-SNN [27].
201
+
202
+ # 5.4 Sparsity, Efficiency, and Energy Cost
203
+
204
+ In this section, we measure the sparsity and efficient computation as well as the energy consumption of SNN. For ANN, the dot-product performs multiply-accumulate (MAC) operation, which is composed of an addition and a multiplication. In the case of SNN, its event-based operation and binary activation enable multiplication-free (except for the first rate-encoding layer) inference. Only one addition is needed if a spike is activated. In Fig. 4 we visualize the mean sparsity of activation of our spiking ResNet-18 on the whole CIFAR10 test set. We can see that each LIF layer has no more than $32 \%$ sparsity rate, which greatly saves energy. We also measure the operation number in Table 3. The addition count is calculated by $s * T * A$ , where $s$ is the mean sparsity, $T$ is the time step and $A$ is the addition number in ANN. For multiplication in SNN, we set it to the FLOPs of the first layer and scale it by $T$ . Our spiking ResNet-18 with 2 time-step has the lowest operation need for the inference. Then, we measure the energy consumption. Following [27], the energy is measured in $4 5 \mathrm { { n m } }$ CMOS technology. The MAC operation in ANN costs $4 . 6 p J$ energy and the accumulation in SNN costs $0 . 9 p J$ energy. Based on this, we compute the energy cost and put it in the table. Our network only costs $8 0 . 3 m J$ for a single forward, and consumes $1 2 . 8 \times$ lower energy compared with ANN.
205
+
206
+ # 5.5 Ablation Study
207
+
208
+ Our experiments use the same $\varepsilon$ for dataset and network architectures. In this section, we use different
209
+
210
+ value for $\varepsilon$ and compare their results. The results is included in Table 5. Generally, we find a low temperature will decrease the performance, as we explained in Sec. 4.2, the desired optimization algorithm should ensure each update will decrease the loss function. Thus, the instantaneous derivative in SNN cannot measure such curvature information since the instantaneous
211
+
212
+ Table 5: Accuracy comparison given different $\varepsilon$
213
+
214
+ <table><tr><td>Dataset</td><td>ε=0.01</td><td>ε=0.05 ε=0.1 ε=0.2</td><td></td></tr><tr><td>CIFAR10</td><td>91.78</td><td>93.11</td><td>94.07</td></tr><tr><td>CIFAR100</td><td>70.97</td><td>72.19</td><td>93.84 74.31 74.57</td></tr></table>
215
+
216
+ derivative is always 0. Therefore, we find a large epsilon can help improve the performance. Indeed, the optimal $\varepsilon$ requires tuning, but our empirical results show that 0.1 can have good results.
217
+
218
+ # 5.6 Visualization
219
+
220
+ In this section, we provide further experimental visualization. In Fig. 5, we plot the temperature curve for CIFAR10-DVS experiments. The spiking ResNet-18 was trained for 300 epochs with cosine learning rate decay. We initialize $b$ to 1.0 and use $\Delta b { = } 0 . 2$ to optimize both temperature for gradient calculation and the weights parameters for network learning. For the initial 25 epochs, the temperature remains less-than-1. We think this is primarily due to the complex loss landscape at the starting stage of the training. During the 20 to 80 epoch, the temperature continues to be increasing. In this stage of learning the FDG desires to learn a sharp, narrow gradient with low bias but high variance. We also find the accuracy curve becomes more unstable in this stage of the training, as a consequence of the sharp gradient. After 80 epochs, the temperature becomes decreasing. Although the decreasing process is not aggressive as the former increasing stage, the trend is still obvious. From 80-250, the temperature decreases from 4.0 to 1.6 with some fluctuations. Then, at the end of the training stage, the temperature again becomes increasing.
221
+
222
+ The intuition behind this tuning mechanism may remain unexplainable right now, however, we think it is the intrinsic nature of the gradient estimation in SNN. Through FDG, we are able to optimize the gradient calculation along with the weights learning.
223
+
224
+ ![](images/cbb32f98c9e8e60b4ab37fe6eeffec456f9a770d5e75d61cb0dff82ce30137ae.jpg)
225
+ Figure 5: The evolutution of temperature $^ { b }$ during optimization.
226
+
227
+ # 6 Discussion
228
+
229
+ In this work, we inspect the training process of SNN when using the surrogate gradient. The proposed finite difference gradient and Dspike function can be assembled with other optimization methods as a fundamental module of gradient estimation for training SNN. This suggests that the performance of SNN can be further increased when more sophisticated training approaches are integrated with the currently proposed methods in the future. Although the improvement on model performance is very significant, be that as it may, our work is still an extension to the conventional SG. How to efficiently find the best FDG gradient to directly deal with the non-linearity of spiking function still remains a problem. In addition, we only consider the LIF neurons for the analyses here, the efficiency of the proposed approaches on other types of spiking neurons still needs examination in practice.
230
+
231
+ References
232
+ [1] Filipp Akopyan, Jun Sawada, Andrew Cassidy, Rodrigo Alvarez-Icaza, John Arthur, Paul Merolla, Nabil Imam, Yutaka Nakamura, Pallab Datta, Gi-Joon Nam, et al. Truenorth: Design and tool flow of a 65 mw 1 million neuron programmable neurosynaptic chip. IEEE transactions on computer-aided design of integrated circuits and systems, 34(10):1537–1557, 2015.
233
+ [2] Mike Davies, Narayan Srinivasa, Tsung-Han Lin, Gautham Chinya, Yongqiang Cao, Sri Harsha Choday, Georgios Dimou, Prasad Joshi, Nabil Imam, Shweta Jain, et al. Loihi: A neuromorphic manycore processor with on-chip learning. IEEE Micro, 38(1):82–99, 2018.
234
+ [3] Jing Pei, Lei Deng, Sen Song, Mingguo Zhao, Youhui Zhang, Shuang Wu, Guanrui Wang, Zhe Zou, Zhenzhi Wu, Wei He, et al. Towards artificial general intelligence with hybrid tianjic chip architecture. Nature, 572(7767):106–111, 2019.
235
+ [4] Yujie Wu, Lei Deng, Guoqi Li, Jun Zhu, Yuan Xie, and Luping Shi. Direct training for spiking neural networks: Faster, larger, better. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 1311–1318, 2019.
236
+ [5] Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, et al. Pytorch: An imperative style, high-performance deep learning library. arXiv preprint arXiv:1912.01703, 2019.
237
+ [6] James Bradbury, Roy Frostig, Peter Hawkins, Matthew James Johnson, Chris Leary, Dougal Maclaurin, George Necula, Adam Paszke, Jake VanderPlas, Skye Wanderman-Milne, and Qiao Zhang. JAX: composable transformations of Python+NumPy programs, 2018.
238
+ [7] Martín Abadi, Paul Barham, Jianmin Chen, Zhifeng Chen, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Geoffrey Irving, Michael Isard, et al. Tensorflow: A system for large-scale machine learning. In 12th {USENIX} symposium on operating systems design and implementation ({OSDI} 16), pages 265–283, 2016.
239
+ [8] Emre O Neftci, Hesham Mostafa, and Friedemann Zenke. Surrogate gradient learning in spiking neural networks: Bringing the power of gradient-based optimization to spiking neural networks. IEEE Signal Processing Magazine, 36(6):51–63, 2019. [9] Bing Han, Gopalakrishnan Srinivasan, and Kaushik Roy. Rmp-snn: Residual membrane potential neuron for enabling deeper high-accuracy and low-latency spiking neural network. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 13558–13567, 2020.
240
+ [10] Abhronil Sengupta, Yuting Ye, Robert Wang, Chiao Liu, and Kaushik Roy. Going deeper in spiking neural networks: Vgg and residual architectures. Frontiers in Neuroscience, 13:95, 2019.
241
+ [11] Bodo Rueckauer, Iulia-Alexandra Lungu, Yuhuang Hu, and Michael Pfeiffer. Theory and tools for the conversion of analog to spiking convolutional neural networks. arXiv preprint arXiv:1612.04052, 2016.
242
+ [12] Bodo Rueckauer, Iulia-Alexandra Lungu, Yuhuang Hu, Michael Pfeiffer, and Shih-Chii Liu. Conversion of continuous-valued deep networks to efficient event-driven networks for image classification. Frontiers in Neuroscience, 11:682, 2017.
243
+ [13] Bing Han and Kaushik Roy. Deep spiking neural network: Energy efficiency through time based coding. In Proc. IEEE Eur. Conf. Comput. Vis.(ECCV), pages 388–404, 2020.
244
+ [14] Shikuang Deng and Shi Gu. Optimal conversion of conventional artificial neural networks to spiking neural networks. arXiv preprint arXiv:2103.00476, 2021.
245
+ [15] Yuhang Li, Shikuang Deng, Xin Dong, Ruihao Gong, and Shi Gu. A free lunch from ann: Towards efficient, accurate spiking neural networks calibration. arXiv preprint arXiv:2106.06984, 2021.
246
+ [16] Yuhang Li, Xin Dong, and Wei Wang. Additive powers-of-two quantization: An efficient non-uniform discretization for neural networks. arXiv preprint arXiv:1909.13144, 2019.
247
+ [17] Yuhang Li, Ruihao Gong, Xu Tan, Yang Yang, Peng Hu, Qi Zhang, Fengwei Yu, Wei Wang, and Shi Gu. Brecq: Pushing the limit of post-training quantization by block reconstruction. arXiv preprint arXiv:2102.05426, 2021.
248
+ [18] Yuhang Li, Mingzhu Shen, Jian Ma, Yan Ren, Mingxin Zhao, Qi Zhang, Ruihao Gong, Fengwei Yu, and Junjie Yan. MQBench: Towards reproducible and deployable model quantization benchmark. In Thirty-fifth Conference on Neural Information Processing Systems Datasets and Benchmarks Track (Round 1), 2021.
249
+ [19] Hanting Chen, Yunhe Wang, Chunjing Xu, Boxin Shi, Chao Xu, Qi Tian, and Chang Xu. Addernet: Do we really need multiplications in deep learning? In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 1468–1477, 2020.
250
+ [20] Arnon Amir, Brian Taba, David Berg, Timothy Melano, Jeffrey McKinstry, Carmelo Di Nolfo, Tapan Nayak, Alexander Andreopoulos, Guillaume Garreau, Marcela Mendoza, et al. A low power, fully event-based gesture recognition system. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 7243–7252, 2017.
251
+ [21] Johanni Brea, Walter Senn, and Jean-Pascal Pfister. Matching recall and storage in sequence learning with spiking neural networks. Journal of neuroscience, 33(23):9565–9575, 2013.
252
+ [22] Yoshua Bengio, Nicholas Léonard, and Aaron Courville. Estimating or propagating gradients through stochastic neurons for conditional computation. arXiv preprint arXiv:1308.3432, 2013.
253
+ [23] Jun Haeng Lee, Tobi Delbruck, and Michael Pfeiffer. Training deep spiking neural networks using backpropagation. Frontiers in Neuroscience, 10:508, 2016.
254
+ [24] Emre O Neftci, Charles Augustine, Somnath Paul, and Georgios Detorakis. Event-driven random back-propagation: Enabling neuromorphic deep learning machines. Frontiers in Neuroscience, 11:324, 2017.
255
+ [25] Yujie Wu, Lei Deng, Guoqi Li, Jun Zhu, and Luping Shi. Spatio-temporal backpropagation for training high-performance spiking neural networks. Frontiers in Neuroscience, 12:331, 2018.
256
+ [26] Hanle Zheng, Yujie Wu, Lei Deng, Yifan Hu, and Guoqi Li. Going deeper with directly-trained larger spiking neural networks. arXiv preprint arXiv:2011.05280, 2020.
257
+ [27] Nitin Rathi and Kaushik Roy. Diet-snn: Direct input encoding with leakage and threshold optimization in deep spiking neural networks. arXiv preprint arXiv:2008.03658, 2020.
258
+ [28] Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In ICML, 2015.
259
+ [29] Shibani Santurkar, Dimitris Tsipras, Andrew Ilyas, and Aleksander Madry. How does batch normalization help optimization? arXiv preprint arXiv:1805.11604, 2018.
260
+ [30] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016.
261
+ [31] Matthieu Courbariaux, Yoshua Bengio, and Jean-Pierre David. Binaryconnect: Training deep neural networks with binary weights during propagations. In NeurIPS, 2015.
262
+ [32] Guillaume Bellec, Darjan Salaj, Anand Subramoney, Robert Legenstein, and Wolfgang Maass. Long short-term memory and learning-to-learn in networks of spiking neurons. arXiv preprint arXiv:1803.09574, 2018.
263
+ [33] Yoshua Bengio, Jérôme Louradour, Ronan Collobert, and Jason Weston. Curriculum learning. In Proceedings of the 26th annual international conference on machine learning, pages 41–48, 2009.
264
+ [34] Alex Krizhevsky, Vinod Nair, and Geoffrey Hinton. Cifar-10 (canadian institute for advanced research).
265
+ [35] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In CVPR, 2009.
266
+ [36] Tong He, Zhi Zhang, Hang Zhang, Zhongyue Zhang, Junyuan Xie, and Mu Li. Bag of tricks for image classification with convolutional neural networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 558–567, 2019.
267
+ [37] Ekin D Cubuk, Barret Zoph, Dandelion Mane, Vijay Vasudevan, and Quoc V Le. Autoaugment: Learning augmentation policies from data. arXiv preprint arXiv:1805.09501, 2018.
268
+ [38] Terrance DeVries and Graham W Taylor. Improved regularization of convolutional neural networks with cutout. arXiv preprint arXiv:1708.04552, 2017.
269
+ [39] Ilya Loshchilov and Frank Hutter. Sgdr: Stochastic gradient descent with warm restarts. arXiv preprint arXiv:1608.03983, 2016.
270
+ [40] Nitin Rathi, Gopalakrishnan Srinivasan, Priyadarshini Panda, and Kaushik Roy. Enabling deep spiking neural networks with hybrid conversion and spike timing dependent backpropagation. arXiv preprint arXiv:2005.01807, 2020.
271
+ [41] Chankyu Lee, Syed Shakib Sarwar, Priyadarshini Panda, Gopalakrishnan Srinivasan, and Kaushik Roy. Enabling spike-based backpropagation for training deep neural network architectures. Frontiers in Neuroscience, 14, 2020.
272
+ [42] Wenrui Zhang and Peng Li. Temporal spike sequence learning via backpropagation for deep spiking neural networks. arXiv preprint arXiv:2002.10085, 2020.
273
+ [43] Sen Lu and Abhronil Sengupta. Exploring the connection between binary and spiking neural networks. Frontiers in Neuroscience, 14:535, 2020.
274
+ [44] Alexander Kugele, Thomas Pfeil, Michael Pfeiffer, and Elisabetta Chicca. Efficient processing of spatio-temporal data streams with spiking neural networks. Frontiers in Neuroscience, 14:439, 2020.
275
+ [45] Hongmin Li, Hanchao Liu, Xiangyang Ji, Guoqi Li, and Luping Shi. Cifar10-dvs: an eventstream dataset for object classification. Frontiers in Neuroscience, 11:309, 2017.
276
+
277
+ # Checklist
278
+
279
+ 1. For all authors...
280
+
281
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
282
+ (b) Did you describe the limitations of your work? [Yes] Please see our discussion in Sec. 6
283
+ (c) Did you discuss any potential negative societal impacts of your work? [No]
284
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
285
+
286
+ 2. If you are including theoretical results...
287
+
288
+ (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] The proof is available in Sec. 4.3.
289
+
290
+ 3. If you ran experiments...
291
+
292
+ (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] Our code will be available in the supplemental.
293
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] All implementations are described in the experiments section.
294
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] We report the mean as well as the standard deviation accuracy in CIFAR experiments. For time consideration, we did not run them for ImageNet experiments, the results may be updated in the future.
295
+ (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] The computation resources description is provided in the experiment section.
296
+
297
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
298
+
299
+ (a) If your work uses existing assets, did you cite the creators? [Yes] We use CIFAR10/100 [34], ImageNet [35], and CIFAR10-DVS [45].
300
+ (b) Did you mention the license of the assets? [No] We adopt public datasets.
301
+ (c) Did you include any new assets either in the supplemental material or as a URL? [No]
302
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [No]
303
+
304
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No]
305
+
306
+ 5. If you used crowdsourcing or conducted research with human subjects...
307
+
308
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
309
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
310
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
md/train/H6ATjJ0TKdf/H6ATjJ0TKdf.md ADDED
@@ -0,0 +1,390 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LAYER-ADAPTIVE SPARSITY FOR THE MAGNITUDE-BASED PRUNING
2
+
3
+ Jaeho LeeE Sejun ParkA Sangwoo MoE Sungsoo AhnM∗ Jinwoo ShinÆ EKAIST EE AKAIST AI MMBZUAI {jaeho-lee,sejun.park,swmo,jinwoos}@kaist.ac.kr, peter.ahn@mbzuai.ac.ae
4
+
5
+ # ABSTRACT
6
+
7
+ Recent discoveries on neural network pruning reveal that, with a carefully chosen layerwise sparsity, a simple magnitude-based pruning achieves state-of-the-art tradeoff between sparsity and performance. However, without a clear consensus on “how to choose,” the layerwise sparsities are mostly selected algorithm-byalgorithm, often resorting to handcrafted heuristics or an extensive hyperparameter search. To fill this gap, we propose a novel importance score for global pruning, coined layer-adaptive magnitude-based pruning (LAMP) score; the score is a rescaled version of weight magnitude that incorporates the model-level $\ell _ { 2 }$ distortion incurred by pruning, and does not require any hyperparameter tuning or heavy computation. Under various image classification setups, LAMP consistently outperforms popular existing schemes for layerwise sparsity selection. Furthermore, we observe that LAMP continues to outperform baselines even in weight-rewinding setups, while the connectivity-oriented layerwise sparsity (the strongest baseline overall) performs worse than a simple global magnitude-based pruning in this case. Code: https://github.com/jaeho-lee/layer-adaptive-sparsity
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Neural network pruning is an art of removing “unimportant weights” from a model, with an intention to meet practical constraints (Han et al., 2015), mitigate overfitting (Hanson & Pratt, 1988), enhance interpretability (Mozer & Smolensky, 1988), or deepen our understanding on neural network training (Frankle & Carbin, 2019). Yet, the importance of weight is still a vaguely defined notion, and thus a wide range of pruning algorithms based on various importance scores has been proposed. One popular approach is to estimate the loss increment from removing the target weight to use as an importance score, e.g., Hessian-based approximations (LeCun et al., 1989; Hassibi & Stork, 1993; Dong et al., 2017), coreset-based estimates (Baykal et al., 2019; Mussay et al., 2020), convex optimization (Aghasi et al., 2017), and operator distortion (Park et al., 2020). Other approaches include on-the-fly1 regularization (Louizos et al., 2018; Xiao et al., 2019), Bayesian methods (Molchanov et al., 2017; Louizos et al., 2017; Dai et al., 2018), and reinforcement learning (Lin et al., 2017).
12
+
13
+ Recent discoveries (Gale et al., 2019; Evci et al., 2020) demonstrate that, given an appropriate choice of layerwise sparsity, simply pruning on the basis of weight magnitude yields a surprisingly powerful unstructured pruning scheme. For instance, Gale et al. (2019) evaluates the performance of magnitudebased pruning (MP; Han et al. (2015); Zhu & Gupta (2018)) with an extensive hyperparameter tuning, and shows that MP achieves comparable or better performance than state-of-the-art pruning algorithms that use more complicated importance scores. To arrive at such a performance level, the authors introduce the following handcrafted heuristic: Leave the first convolutional layer fully dense, and prune up to only $80 \%$ of weights from the last fully-connected layer; the heuristic is motivated by the sparsity pattern from other state-of-the-art algorithms (Molchanov et al., 2017) and additional experimental/architectural observations.
14
+
15
+ Unfortunately, there is an apparent lack of consensus on “how to choose the layerwise sparsity” for the magnitude-based pruning. Instead, the layerwise sparsity is selected mostly on an algorithm-byalgorithm basis. One common method is the global MP criteria (see, e.g., Morcos et al. (2019)), where the layerwise sparsity is automatically determined by using a single global threshold on weight magnitude. Lin et al. (2020) propose a magnitude-based pruning algorithm using a feedback signal, using a heuristic rule of keeping the last fully connected layer dense. A recent work by Evci et al. (2020) proposes a magnitude-based dynamic sparse training method, adopting layerwise sparsity inspired from the network science approach toward neural network pruning (Mocanu et al., 2018).
16
+
17
+ ![](images/13909bd9f8b6bcfb9e344fda65e2cb966ab9566f706117f1ace49666ec403539.jpg)
18
+ Figure 1: The LAMP score is a squared weight magnitude, normalized by the sum of all “surviving weights” in the layer. Global pruning by LAMP is equivalent to the layerwise magnitude-based pruning with an automatically chosen layerwise sparsity.
19
+
20
+ Contributions. In search of a “go-to” layerwise sparsity for MP, we take a model-level distortion minimization perspective towards MP. We build on the observation of Dong et al. (2017); Park et al. (2020) that each neural network layer can be viewed as an operator, and MP is a choice that incurs minimum $\ell _ { 2 }$ distortion to the operator output (given a worst-case input signal). We bring the perspective further to examine the “model-level” distortion incurred by pruning a layer; preceding layers scale the input signal to the target layer, and succeeding layers scale the output distortion.
21
+
22
+ Based on the distortion minimization framework, we propose a novel importance score for global pruning, coined LAMP (Layer-Adaptive Magnitude-based Pruning). The LAMP score is a rescaled weight magnitude, approximating the model-level distortion from pruning. Importantly, the LAMP score is designed to approximate the distortion on the model being pruned, i.e., all connections with a smaller LAMP score than the target weight is already pruned. Global pruning2 with the LAMP score is equivalent to the MP with an automatically determined layerwise sparsity. At the same time, pruning with LAMP keeps the benefits of MP intact; the LAMP score is efficiently computable, hyperparameter-free, and does not rely on any model-specific knowledge.
23
+
24
+ We validate the effectiveness of LAMP under a diverse experimental setup, encompassing various convolutional neural network architectures (VGG-16, ResNet-18/34, DenseNet-121, EfficientNet-B0) and various image datasets (CIFAR-10/100, SVHN, Restricted ImageNet). In all considered setups, LAMP consistently outperforms the baseline layerwise sparsity selection schemes. We also perform additional ablation studies with one-shot pruning and weight-rewinding setup to confirm that LAMP performs reliably well under a wider range of scenarios.
25
+
26
+ Organization. In Section 2, we briefly describe existing methods to choose the layerwise sparsity for magnitude-based pruning. In Section 3, we formally introduce LAMP and describe how the $\ell _ { 2 }$ distortion minimization perspective motivates the LAMP score. In Section 4, we empirically validate the effectiveness and versatility of LAMP. In Section 5, we take a closer look at the layerwise sparsity discovered by LAMP and compare with baseline methods and previously proposed handcrafted heuristics. In Section 6, we summarize our findings and discuss future directions. Appendices include the experimental details (Appendix A), complexity analysis (Appendix B), derivation of the LAMP score (Appendix C), additional experiments on Transformer (Appendix D), and detailed experimental results with standard deviations (Appendix E).
27
+
28
+ # 2 RELATED WORK
29
+
30
+ This section gives a (necessarily non-exhaustive) survey of various layerwise sparsity selection schemes used for magnitude-based pruning algorithms. Magnitude-based pruning of neural networks dates back to the early works of Janowsky (1989); LeCun et al. (1989), and has been actively studied again under the context of model compression since the work of Han et al. (2015). In Han et al. (2015), the authors propose an iterative pruning scheme where the layerwise pruning threshold is determined by the standard-deviation-based heuristic. Zhu & Gupta (2018) propose a uniform pruning algorithm with a carefully tuned gradual pruning schedule combined with weight re-growths. Gale et al. (2019) refine the algorithm by adding a heuristic constraint of keeping the first convolutional layer fully dense and keeping at least $2 0 \%$ of the weights surviving in the last fully-connected layer.
31
+
32
+ MP has also been widely used in the context of “pruning at initialization.” Frankle & Carbin (2019) combine MP with weight rewinding to discover efficiently trainable subnetworks: for small nets, the authors employ uniform layerwise sparsity, but use different rates for convolutional layers and fully-connected layers (with an added heuristic on the last fully-connected layer); for larger nets, authors use global MP. Morcos et al. (2019) consider transferring the “winning ticket” initializations, using the global MP. Evci et al. (2020) proposes a training scheme for sparsely initialized neural networks, where the layerwise sparsity is given by the Erdos-R ˝ enyi kernel method; the method ´ generalizes the scheme initially proposed by Mocanu et al. (2018) to convolutional neural networks.
33
+
34
+ We note that there is a line of results on the trainable layerwise sparsity; we refer the interested readers to the recent work of Kusupati et al. (2020) for a concise survey. However, we do not make direct comparisons to these methods, as our primary purpose is to deliver an easy-to-use layerwise sparsity selection scheme without requiring the modification of training objective, or an extensive hyperparameter tuning.
35
+
36
+ We also note that we focus on the unstructured sparsity. While such unstructured pruning techniques have been considered less practical (compared to structured pruning), several recent breakthroughs provide promising methods to bridge this gap; see Gale et al. (2020); Elsen et al. (2020).
37
+
38
+ # 3 LAYER-ADAPTIVE MAGNITUDE-BASED PRUNING (LAMP)
39
+
40
+ We now formally introduce the Layer-Adaptive Magnitude-based Pruning (LAMP) score. Consider a depth- $d$ feedforward neural network with weight tensors $W ^ { ( 1 ) } , \ldots , W ^ { ( d ) }$ associated with each fully-connected/convolutional layer. For fully-connected layers, corresponding weight tensors are twodimensional matrices, and for 2d convolutional layers, corresponding tensors are four-dimensional. To give a unified definition of the LAMP score for both fully-connected and convolutional layers, we assume that each weight tensor is unrolled (or flattened) to a one-dimensional vector. For each of these unrolled vectors, we assume (without loss of generality) that the weights are sorted in an ascending order according to the given index map, i.e., $| W [ u ] | \leq | W [ v ] |$ holds whenever $u < v$ , where $\bar { W [ u ] }$ denote the entry of $W$ mapped by the index $u$ .3
41
+
42
+ The LAMP score for the $u$ -th index of the weight tensor $W$ is then defined as
43
+
44
+ $$
45
+ \mathsf { s c o r e } ( u ; W ) : = \frac { ( W [ u ] ) ^ { 2 } } { \sum _ { v \ge u } ( W [ v ] ) ^ { 2 } } .
46
+ $$
47
+
48
+ Informally, the LAMP score (Eq. 1) measures the relative importance of the target connection among all surviving connections belonging to the same layer, where the connections with a smaller weight magnitude (in the same layer) have already been pruned. As a consequence, two connections with identical weight magnitudes have different LAMP scores, depending on the index map being used.
49
+
50
+ Once the LAMP score is computed, we globally prune the connections with smallest LAMP scores until the desired global sparsity constraint is met; the procedure is equivalent to performing MP with an automatically selected layerwise sparsity. To see this, it suffices to check that
51
+
52
+ $$
53
+ ( W [ u ] ) ^ { 2 } > ( W [ v ] ) ^ { 2 } \Rightarrow \mathsf { s c o r e } ( u ; W ) > \mathsf { s c o r e } ( v ; W )
54
+ $$
55
+
56
+ holds for any weight tensor $W$ and a pair of indices $u , v$ . From the definition of the LAMP score (Eq. 1), it is easy to see that the logical relation (2) holds. Indeed, for the connection with a larger weight magnitude, the denominator of Eq. 1 is smaller, while the numerator is larger.
57
+
58
+ We note that the global pruning with respect to the LAMP score is not identical to the global pruning with respect to the magnitude score $| W [ u ] |$ (or $( W [ u ] ) ^ { 2 }$ , equivalently). Indeed, in each layer, there exists exactly one connection with the LAMP score of 1, which is the maximum LAMP score possible. In other words, LAMP keeps at least one surviving connection in each layer. The same does not hold for the global pruning with respect to the weight magnitude score.
59
+
60
+ We also note that the LAMP score is easy-to-use. Similar to the vanilla MP, the LAMP score does not have any hyperparameter to be tuned, and is easily implementable via elementary tensor operations. Furthermore, the LAMP score can be computed with only a minimal computational overhead; the sorting of squared weight magnitudes required to compute the denominator in Eq. 1 is already a part of typical vanilla MP algorithms. For more discussions, see Appendix B.
61
+
62
+ # 3.1 DESIGN MOTIVATION: MINIMIZING OUTPUT $\ell _ { 2 }$ DISTORTION
63
+
64
+ The LAMP score (Eq. 1) is motivated by the following observation: The layerwise MP is the solution of the layerwise minimization of Frobenius distortion incurred by pruning, which can be viewed as a relaxation of the output $\ell _ { 2 }$ distortion minimization with respect to the worst-case input. This observation leads us to the speculation “Reducing the pruning-incurred $\ell _ { 2 }$ distortion of the model output with respect to the worst-case output may be beneficial to the performance of the retrained model (and perhaps that is why MP works well in practice).” This speculation is not entirely new; the optimal brain damage (OBD; (LeCun et al., 1989)) is also designed around a similar philosophy of loss minimization, without a complete understanding on how the benefit of loss minimization seems to pertain after retraining.
65
+
66
+ Nevertheless, we use this speculation as a guideline to design LAMP as a natural extension of layerwise MP to a global pruning scheme with an automatically determined layerwise sparsity. To make arguments a bit more formal, consider a depth- $d$ fully-connected4 neural net, whose output given the input $x$ is
67
+
68
+ $$
69
+ f ( x ; W ^ { ( 1 : d ) } ) = W ^ { ( d ) } \sigma \big ( W ^ { ( d - 1 ) } \sigma \big ( \cdots W ^ { ( 2 ) } \sigma \big ( W ^ { ( 1 ) } x \big ) \cdots \big ) ,
70
+ $$
71
+
72
+ where $\sigma$ denotes the ReLU activation and $W _ { i }$ denotes the weight matrix for the $i$ -th layer, and $W ^ { ( 1 : d ) } = ( W ^ { ( 1 ) } , \dots , W ^ { ( d ) } )$ denotes the set of weight matrices.
73
+
74
+ Viewing MP as a relaxed layerwise $\ell _ { 2 }$ distortion minimization. We first focus on a single fullyconnected layer (instead of a full model), and consider the problem of minimizing the pruning-incurred $\ell _ { 2 }$ distortion in the layer output, given the worst-case input signal. We then observe that the problem can be relaxed to the minimization of Frobenius distortion in the weight tensor, whose solution coincides with the layerwise MP. Formally, let $\xi \in \mathbb { R } ^ { n }$ be an input vector to a fully-connected layer with the weight tensor $W \in \mathbb { R } ^ { m \times n }$ . We want to prune the tensor to ${ \widetilde { W } } : = { \dot { M } } \odot W$ , where $M$ is an $m \times n$ binary matrix (i.e., having only 0s and 1s as its entries) satisfying some predefined sparsity constraint $\lvert \lvert M \rvert \rvert _ { 0 } \leq \kappa$ imposed by the operational constraints (e.g., model size requirements). We wish to find the pruning mask $M$ that incurs the minimum $\ell _ { 2 }$ distortion in the output given the worst-case $\ell _ { 2 }$ -bounded input, i.e.,
75
+
76
+ $$
77
+ \operatorname* { m i n } _ { \| M \| _ { 0 } \leq \kappa } \operatorname* { s u p } _ { \| \xi \| _ { 2 } \leq 1 } \| W \xi - ( M \odot W ) \xi \| _ { 2 } .
78
+ $$
79
+
80
+ The minimax distortion (4) upper-bounds the minimum expected $\ell _ { 2 }$ distortion for any distribution of $\xi$ supported on the unit ball, and thus can be viewed as a data-oblivious version of the pruning algorithms designed for loss minimization (using squared loss). By the definition of the spectral norm,5 Eq. 4 is equivalent to
81
+
82
+ $$
83
+ \operatorname* { m i n } _ { M \ b i \operatorname* { n a r y } _ { \| M \| _ { 0 } \leq \kappa } } \| W - M \odot W \| ,
84
+ $$
85
+
86
+ where $\| \cdot \|$ denotes the spectral norm. Using the fact that $\| A \| \leq \| A \| _ { F }$ holds for any matrix $A ^ { 6 }$ (where $\| \cdot \| _ { F }$ denotes the Frobenius norm), the optimization (5) can be relaxed to the Frobenius
87
+
88
+ distortion minimization
89
+
90
+ $$
91
+ \operatorname* { m i n } _ { M \ : \mathrm { b i n a y } } \ : \| W - M \odot W \| _ { F } = \ : \operatorname* { m i n } _ { \| M \| _ { 0 } \leq \kappa } \ : \sqrt { \sum _ { i \in \{ 1 , \dots , m \} } ( 1 - M _ { i j } ) W _ { i j } ^ { 2 } } ,
92
+ $$
93
+
94
+ where $W _ { i j } , M _ { i j }$ denote $( i , j )$ -th entries of $W , M$ , respectively. From the right-hand side of Eq. 6, we see that the layerwise MP, i.e., setting $M _ { i j } = 1$ for $( i , j )$ pairs with top- $\kappa$ largest $W _ { i j }$ , is the optimal choice to minimize the Frobenius distortion incurred by pruning. This observation motivates us to view the layerwise MP as the (approximate) solution of the output $\ell _ { 2 }$ distortion minimization procedure, and speculate the connection between the small output $\ell _ { 2 }$ distortion and the favorable performance of the pruned-retrained subnetwork (given the unreasonable effectiveness of seeminglyna¨ıve MP as demonstrated by Gale et al. (2019)).
95
+
96
+ LAMP: greedy, relaxed minimization of model output distortion. Building on this speculation, we now ask the following question: “How can we select the layerwise sparsity of MP to have small model-level output distortion?” To formalize, we consider the minimization
97
+
98
+ $$
99
+ \operatorname* { m i n } _ { \substack { \sum _ { i = 1 } ^ { d } \| M ^ { ( i ) } \| _ { 0 } \le \kappa } } \operatorname* { s u p } _ { \| x \| _ { 2 } \le 1 } \| f ( x ; W ^ { ( 1 : d ) } ) - f ( x ; \widetilde W ^ { ( 1 : d ) } ) \| _ { 2 } ,
100
+ $$
101
+
102
+ where $\kappa$ denotes the model-level sparsity constraint imposed by the operational requirements and $\widetilde { W } ^ { ( i ) } : = M ^ { ( i ) } \odot W ^ { ( i ) }$ denotes the pruned version of the $i$ -th layer weight matrix.
103
+
104
+ Due to the nonlinearities from the activation functions, it is difficult to solve Eq. 7 exactly. Instead, we consider the following greedy procedure: At each step, we (a) approximate the distortion incurred by pruning a single connection, (b) remove the connection with the smallest score, and then (c) go back to step (a) and re-compute the scores based on the pruned model.
105
+
106
+ Once we assume that only one connection is pruned at a single iteration of the step (a), we can use the following upper bound of the model output distortion to relax the optimization (7): With $\widetilde { W _ { i } }$ denoting a pruned version of $W _ { i }$ , we have
107
+
108
+ $$
109
+ \operatorname* { s u p } _ { \| x \| _ { 2 } \leq 1 } \| f ( x ; W ^ { ( 1 : d ) } ) - f ( x ; W ^ { ( 1 : i - 1 ) } , \widetilde W ^ { ( i ) } , W ^ { ( i + 1 : d ) } ) \| _ { 2 } \leq \frac { \| W ^ { ( i ) } - \widetilde W ^ { ( i ) } \| _ { F } } { \| W ^ { ( i ) } \| _ { F } } \left( \prod _ { j = 1 } ^ { d } \| W ^ { ( j ) } \| _ { F } \right)
110
+ $$
111
+
112
+ (see Appendix C for a derivation). Despite the sub-optimalities from the relaxation, considering the right-hand side of Eq. 8 provides two favorable properties. First, the right-hand side is free of any activation function, and is equivalent to the layerwise MP. Second, the score can be computed in advance, i.e., does not require re-computing after pruning each connection. In particular, the product term $\textstyle \prod _ { j = 1 } ^ { d } \| W ^ { ( j ) } \| _ { F }$ does not affect the pruning decision, and the denominator can be pre-computed with the cumulative sum $\textstyle \sum _ { v \geq u } ( W ^ { ( i ) } [ v ] ) ^ { 2 }$ for each index $u$ for $W ^ { ( i ) }$ . This computational trick leads us to the LAMP score (1).
113
+
114
+ # 4 EXPERIMENTS & ANALYSES
115
+
116
+ To empirically validate the effectiveness of the proposed method, we compare LAMP with following layerwise sparsity selection schemes for magnitude-based pruning:
117
+
118
+ • Global. A global threshold on the weight magnitudes is imposed on every layer to meet the global sparsity constraint, and the layerwise sparsity is automatically determined according to this threshold; see, e.g., Morcos et al. (2019).
119
+ • Uniform. Every layer is pruned to have identical layerwise sparsity levels, which is in turn equal to the global sparsity constraint; see, e.g., Zhu & Gupta (2018).
120
+ • Uniform+. Same as Uniform, but we impose two additional constraints: (1) we keep the first convolutional layer unpruned, and (2) retain at least $2 0 \%$ of connections alive in the last fullyconnected layer; this heuristic rule is proposed by Gale et al. (2019).
121
+
122
+ ![](images/19c60f464efbe811a285741dc9b06329ee22d53bb86a50869151822b3b77070c.jpg)
123
+ Figure 2: Sparsity-accuracy tradeoff curves of VGG-16, ResNet-18, DenseNet-121, and EfficientNetB0. All models are iteratively pruned and retrained with CIFAR-10 dataset.
124
+
125
+ • Erdos-R˝ enyi kernel.´ An extension of Erdos-R˝ enyi method (originally given by´ Mocanu et al. (2018)) accounting for convolutional layers, as proposed by Evci et al. (2020). The numbers of nonzero parameters of sparse convolutional layers are scaled proportional to 1 − nl−1+nl+wl+hll−1· l· l· l , where $n ^ { l }$ denotes the number of neurons at layer $l$ , and $w ^ { l } , h ^ { l }$ denotes the width and height of the lth layer convolutional kernel.
126
+
127
+ As a default setup, we perform five independent trials for each baseline method, where in each trial we use iterative pruning-and-retraining (Han et al., 2015): we prune $2 0 \%$ of the surviving weights at each iteration. For the Restricted-ImageNet experiment, we provide the result from four trials. For a clear presentation, we only report the average on the figures appearing in the main text. Standard deviations for five-seed results in Section 4.1 will be given in Appendix E. Also, in Appendix D, we report additional experimental results for language modeling tasks (Penn Treebank and WT-2) on Transformers (Vaswani et al., 2017).
128
+
129
+ Summary of observations. From the experimental results (Figs. 2 to 4), we observe that LAMP consistently outperforms all other baselines, in terms of the sparsity-accuracy tradeoff. The performance gap between LAMP and baseline methods seems be more pronounced with modern network architectures, e.g., EfficientNet-B0. We also observe that LAMP performs well under weight rewinding setup, while the strongest baseline (Erdos-R ˝ enyi kernel) seems to be sensitive to such rewinding. ´
130
+
131
+ # 4.1 MAIN RESULTS
132
+
133
+ Our main experimental results are on image classification models. We explore a diverse set of model architectures and datasets, with a base setup of VGG-16 (Simonyan & Zisserman, 2015) trained on CIFAR-10 (Krizhevsky & Hinton, 2009) dataset. In particular, our experiments cover the following models and datasets.
134
+
135
+ ![](images/cf04bae0181ee618965f749110e946edbfc05cc9fb2d008e81444e2d5f23358b.jpg)
136
+ Figure 3: Sparsity-accuracy tradeoff curves of pruned models trained for SVHN and CIFAR-100 (on VGG-16) and Restricted ImageNet (on ResNet-34).
137
+
138
+ Models. We consider four network architectures for image classification experiments: (1) VGG-16 (Simonyan & Zisserman, 2015) adapted for CIFAR-10 to have batch normalization layers and one fully-connected layer (as used in Liu et al. (2019); Frankle & Carbin (2019)); (2) ResNet-20/34 (He et al., 2016); (3) DenseNet-121 (Huang et al., 2017); (4) EfficientNet-B0 (Tan & Le, 2019). For all four models, we prune the weight tensors for fully-connected and convolutional units. Biases and batch normalization layers are kept unpruned.
139
+
140
+ Datasets. We consider the following datasets; CIFAR-10/100 (Krizhevsky & Hinton, 2009), SVHN (Netzer et al., 2011), and Restricted ImageNet (Tsipras et al., 2019). All datasets except for Restricted ImageNet are used for training VGG-16; Restricted ImageNet is used for training ResNet-34.
141
+
142
+ Other details. Detailed experimental setup is given in Appendix A.
143
+
144
+ In Fig. 2, we provide sparsity-accuracy tradeoff curves for four different model architectures trained on CIFAR-10 dataset. The first observation is that LAMP achieves the best tradeoff; in all four models, LAMP consistently outperforms baseline methods. We also observe that Erdos-R ˝ enyi kernel ´ method also outperforms other baselines in VGG-16, ResNet-20, and EfficientNet-B0, but fails to do so on DenseNet-121. Furthermore, the gap between LAMP and the Erdos-R ˝ enyi kernel method ´ seems to widen as the model architecture gets more complicated; the gap between two methods is notable especially in EfficientNet-B0, where mobile inverted bottleneck convolutional layers replace traditional convolutional modules. In particular, LAMP achieves $8 8 . 1 \%$ test accuracy when only $1 . 4 4 \%$ of all weights survive, while Erdos-R ˝ enyi kernel achieves ´ $7 7 . 8 \%$ . Lastly, we observe that the heuristic of Gale et al. (2019) seems to provide an improvement over the Uniform MP.
145
+
146
+ In Fig. 3, we present the tradeoff curves for three additional datasets: SVHN, CIFAR-100, and Restricted ImageNet. Similar to Fig. 2, we observe that LAMP outperforms all other baselines and Erdos-R ˝ enyi kernel remains to be the most competitive baseline. ´
147
+
148
+ 4.2 ABLATIONS: ONE-SHOT PRUNING, WEIGHT REWINDING, AND SNIP
149
+
150
+ Modern magnitude-based pruning algorithms are often used in combination with customized pruning schedules (e.g., Zhu & Gupta (2018)) or weight rewinding (e.g., Frankle & Carbin (2019); Renda et al. (2020)). As a sanity check that LAMP perform reliably well along with such techniques, we conduct following additional experiments.
151
+
152
+ • One-shot pruning. As an extreme case of pruning schedule, we test the scheme where we only run a single training-pruning-retraining cycle, instead of iterating multiple cycles. We test the one-shot pruning on VGG-16 trained with CIFAR-10 dataset.
153
+ Weight rewinding. After pruning, we rewind the remaining weights to their values in the early epoch, as in the “lottery ticket” experiments by Frankle & Carbin (2019). We perform iterative magnitude-based pruning (IMP) on VGG-16, using the warm-up step and the training schedule described in Frankle et al. (2020).
154
+ • SNIP. As an additional experiment, we test whether LAMP can provide a general-purpose layerwise sparsity for pruning schemes other than MP. We test under the “pruning at initialization” setup with SNIP scores (Lee et al., 2019). Baselines are similarly modified to use the SNIP score. We use Conv-6 model on CIFAR-10 dataset (see Frankle & Carbin (2019) for more details of the model) with a batch size of 128.
155
+
156
+ ![](images/2b73f575320a30dc04c7a034191f32d2fc0800ab8343f09659965b85c9a5a0a6.jpg)
157
+ Figure 4: Sparsity-accuracy tradeoff curves under one-shot pruning, weight rewinding, and the SNIP setup. One-shot pruning and the weight-rewinding experiments are done on VGG-16 trained on CIFAR-10 dataset. SNIP experiment is performed on Conv-6 trained on CIFAR-10.
158
+
159
+ Again, other experimental details are given at the Appendix A.
160
+
161
+ Results for all three experiments are given in Fig. 4. On one-shot pruning, we confirm that LAMP comfortably leads other baselines, as in the iterative pruning case. We note that the gap between one-shot pruning and iterative pruning is quite small for LAMP; when $1 . 1 5 \%$ of all prunable weights survive, iterative LAMP brings only $1 . 0 9 \%$ accuracy gain over one-shot LAMP. By contrast, the gain from iteration for Uniform MP is $4 1 . 6 2 \%$ at the same sparsity level.
162
+
163
+ On the weight-rewinding experiment, we observe that LAMP remains beneficial over the baseline methods. We also remark that the Global baseline tend to perform well in this case, even outperforming the Erdos-R ˝ enyi kernel method in the low-sparsity regime. This phenomenon seems to be ´ connected to the observation of Zhou et al. (2019) that the initial weights and final weights of a model are highly correlated; global MP may help preserving connections with larger initial magnitudes, which play important roles in terms of signal propagation at initialization (Lee et al., 2020).
164
+
165
+ On the SNIP experiment, we observe that LAMP achieves a similar performance to the Global SNIP. Recalling that the SNIP score is designed for global pruning (Lee et al., 2019), such high performance of LAMP is unexpected. We suspect that this is because LAMP is also designed for “output distortion minimization,” which shares a similar spirit with the “gradient distortion minimization.”
166
+
167
+ # 5 LAYERWISE SPARSITY: GLOBAL MP, ERDOS˝ -RENYI KERNEL ´ , AND LAMP
168
+
169
+ With the effectiveness of LAMP confirmed, we take a closer look at the layerwise sparsity discovered by LAMP. We focus on answering two questions: Q1. Does layerwise sparsity distilled from LAMP behave similarly to the heuristics constructed from experiences, e.g. the one given by Gale et al. (2019)? Q2. Is there any other defining characteristic of LAMP sparsity patterns, which may help us guide the design of (sparse) network architectures?
170
+
171
+ In Fig. 5, we plot the layerwise survival rates and the number of nonzero weights discovered by iteratively pruning VGG-16 (trained on CIFAR-10), by Global MP, Erdos-R ˝ enyi kernel, and LAMP. Lay- ´ erwise survival rates are given for the global survival rates of $\{ 5 1 . 2 \% , 2 6 . 2 \% , 1 3 . 4 \% , 6 . 8 7 \% , 3 . 5 2 \% \}$ (from lighter to darker). Number of nonzero weights are plotted for the pruned models with total $\{ 3 . 5 2 \% , 1 . 8 0 \% , 0 . 9 2 \% , 0 . 4 7 \% , 0 . 2 4 \% \}$ fraction of all weights surviving.
172
+
173
+ We observe that LAMP sparsities share a similar tendency to sparsity levels given by the Erdos-R ˝ enyi ´ kernel method. In particular, both methods tend to keep the first and layer layers of the neural network relatively dense; this property is reminiscent of the handcrafted heuristic given in Gale et al. (2019): keep the first convolutional layer unpruned, and prune at most $80 \%$ from the last fully-connected layer. While Global MP also keeps a large fraction of the last fully-connected layer unpruned, the first convolutional layer gets pruned quickly. LAMP sparsities differ from Erdos-R ˝ enyi kernel sparsities ´ in two senses.
174
+
175
+ • Although LAMP demonstrates its tendency to keep the first and the last layers relatively unpruned, this tendency is softer. When $3 . 5 2 \%$ of weights survive, LAMP keeps $\sim 7 9 \%$ and $\sim 6 2 \%$ of weights unpruned from the first and last layers (respectively), while Erdos-R ˝ enyi kernel does not ´ prune any weight from those two layers.
176
+
177
+ ![](images/67d795f7321b1e13ea0f112785f5804d818dcf62063f32a5b3e59d6e15cdadfb.jpg)
178
+ Figure 5: Layerwise statistics of VGG-16 iteratively pruned on CIFAR-10. Top: Layerwise survival rate for models with $\{ 5 1 . 2 \%$ , $2 6 . 2 \%$ , $1 3 . 4 \%$ , $6 . 8 7 \%$ , $3 . 5 2 \% \}$ weights surviving. Bottom: Number of nonzero weights for models with $\{ 3 . 5 2 \% , 1 . 8 0 \% , 0 . 9 2 \% , 0 . 4 7 \% , 0 . 2 4 \% \}$ weights surviving.
179
+
180
+ • LAMP tends to keep the number of nonzero weights relatively uniform throughout the layers at extreme sparsity levels (indeed, the first observation can be understood as a consequence of the second observation). In contrast, Erdos-R ˝ enyi kernel method keeps the relative ratio constant, ´ regardless of the global sparsity level.
181
+
182
+ Following the second observation, we conjecture that having a similar number of nonzero connections in each layer may be an essential condition to guarantee maximal memory capacity (see, e.g., Yun et al. (2019)), given a global sparsity constraint on the neural network. Theoretical investigations of the approximability by such sparse neural networks may be an interesting future research direction, potentially leading to a more principled and robust pruning algorithms.
183
+
184
+ As an additional remark, we note that the layerwise sparsity discovered by LAMP behaves similarly to that of AMC (He et al., 2018), which uses a reinforcement learning agent to search over the space of all available layerwise sparsity. We provide further details in Appendix F.
185
+
186
+ # 6 CONCLUSION
187
+
188
+ In this paper, we investigate an under-explored problem on the layerwise sparsity for magnitude-based pruning scheme. The proposed method, coined LAMP (Layer-Adaptive Magnitude-based Pruning), is motivated from the $\ell _ { 2 }$ distortion minimization perspective on magnitude-based pruning, and provides a consistent performance gain on a wide range of models and datasets. Furthermore, LAMP performs reliably well when combined with one-shot pruning schedule or weight rewinding, which makes it an attractive candidate as a “go-to” layerwise sparsity for the magnitude-based pruning. Taking a deeper look at LAMP-discovered layerwise sparsities, we observe that LAMP automatically recovers the handcrafted rules for the layerwise sparsity. Furthermore, we observe that LAMP tend to keep the number of nonzero weights relatively uniform throughout the layers, as we consider more extreme sparsity levels. We conjecture that such uniformity in the number of unpruned weights may be an essential condition for a maximal expressive power of sparsified neural networks.
189
+
190
+ # ACKNOWLEDGMENTS
191
+
192
+ This work was supported in part by Institute of Information & Communications Technology Planning & Evaluation (IITP) grant funded by the Korea government (MSIT) (No.2019-0-00075, Artificial Intelligence Graduate School Program (KAIST)) in part by Samsung Advanced Institute of Technology (SAIT), and in part by the Defense Challengeable Future Technology Program of the Agency for Defense Development, Republic of Korea.
193
+
194
+ REFERENCES
195
+ A. Aghasi, A. Abdi, N. Nguyen, and J. Romberg. Net-trim: Convex pruning of deep neural networks with performance guarantee. In Advances in Neural Information Processing Systems, 2017.
196
+ C. Baykal, L. Liebenwein, I. Gilitschenski, D. Feldman, and D. Rus. Data-dependent coresets for compressing neural networks with applications to generalization bounds. In International Conference on Learning Representations, 2019.
197
+ B. Dai, C. Zhu, B. Guo, and D. Wipf. Compressing neural networks using the variational information bottleneck. In Proceedings of International Conference on Machine Learning, 2018.
198
+ X. Dong, S. Chen, and S. J. Pan. Learning to prune deep neural networks via layer-wise optimal brain surgeon. In Advances in Neural Information Processing Systems, 2017.
199
+ E. Elsen, M. Dukhan, T. Gale, and K. Simonyan. Fast sparse ConvNets. In IEEE Conference on Computer Vision and Pattern Recognition, 2020.
200
+ U. Evci, T. Gale, J. Menick, P. S. Castro, and E. Elsen. Rigging the lottery: Making all tickets winners. In Proceedings of International Conference on Machine Learning, 2020.
201
+ J. Frankle and M. Carbin. The lottery ticket hypothesis: Finding sparse, trainable neural networks. In International Conference on Learning Representations, 2019.
202
+ J. Frankle, G. K. Dziugaite, D. M. Roy, and M. Carbin. Linear mode connectivity and the lottery ticket hypothesis. In Proceedings of International Conference on Machine Learning, 2020.
203
+ T. Gale, E. Elsen, and S. Hooker. The state of sparsity in deep neural networks. In ICML ODMLCDNNR Workshop, 2019.
204
+ T. Gale, M. Zaharia, C. Young, and E. Elsen. Sparse GPU kernels for deep learning. In Proceedings of the International Conference for High Performance Computing, Networking, Storage, and Analysis, 2020.
205
+ S. Han, J. Pool, J. Tran, and W. Dally. Learning both weights and connections for efficient neural network. In Advances in Neural Information Processing Systems, 2015.
206
+ S. J. Hanson and L. Y. Pratt. Comparing biases for minimal network construction with backpropagation. In Advances in Neural Information Processing Systems, 1988.
207
+ B. Hassibi and D. G. Stork. Second order derivatives for network pruning: Optimal brain surgeon. In Advances in Neural Information Processing Systems, 1993.
208
+ K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In IEEE Conference on Computer Vision and Pattern Recognition, 2016.
209
+ Y. He, J. Lin, H. Wang, L.-J. Li, and S. Han. AMC: AutoML for model compression and acceleration on mobile devices. In European Conference on Computer Vision, 2018.
210
+ Gao Huang, Zhuang Liu, Laurens Van Der Maaten, and Kilian Q Weinberger. Densely connected convolutional networks. In IEEE Conference on Computer Vision and Pattern Recognition, 2017.
211
+ S. A. Janowsky. Pruning versus clipping in neural networks. Physical Review A, 1989.
212
+ A. Krizhevsky and G. Hinton. Learning multiple layers of features from tiny images. Technical report, University of Toronto, 2009.
213
+ A. Kusupati, V. Ramanujan, R. Somani, M. Wortsman, P. Jain, S. Kakade, and A. Farhadi. Soft threshold weight reparametrization for learnable sparsity. In Proceedings of International Conference on Machine Learning, 2020.
214
+ Y. LeCun, J. S. Denker, and S. A. Solla. Optimal brain damage. In Advances in Neural Information Processing Systems, 1989.
215
+ N. Lee, T. Ajanthan, and P. H. S. Torr. Snip: Single-shot network pruning based on connection sensitivity. In International Conference on Learning Representations, 2019.
216
+ N. Lee, T. Ajanthan, S. Gould, and P. H. S. Torr. A signal propagation perspective for pruning neural networks at initialization. In International Conference on Learning Representations, 2020.
217
+ J. Lin, Y. Rao, J. Lu, and J. Zhou. Runtime neural pruning. In Advances in Neural Information Processing Systems, 2017.
218
+ T. Lin, S. U. Stich, L. Barba, D. Dmitriev, and M. Jaggi. Dynamic model pruning with feedback. In International Conference on Learning Representations, 2020.
219
+ Z. Liu, M. Sun, T. Zhou, G. Huang, and T. Darrell. Rethinking the value of network pruning. In International Conference on Learning Representations, 2019.
220
+ I. Loshchilov and F. Hutter. Decoupled weight decay regularization. In International Conference on Learning Representations, 2019.
221
+ C. Louizos, K. Ullrich, and M. Welling. Bayesian compression for deep learning. In Advances in Neural Information Processing Systems, 2017.
222
+ C. Louizos, M. Welling, and D. P. Kingma. Learning sparse neural networks through $l _ { 0 }$ regularization. In International Conference on Learning Representations, 2018.
223
+ M. Marcus, B. Santorini, and M. Marcinkiewicz. Building a larger annotated corpus of English: The Penn treebank. Computational Linguistics, 1993.
224
+ S. Merity, C. Xiong, J. Bradbury, and R. Socher. Pointer sentinel mixture models. In International Conference on Learning Representations, 2016.
225
+ D. C. Mocanu, E. Mocanu, P. Stone, P. H. Nguyen, M. Gibescu, and A. Liotta. Scalable training of artificial neural networks with adaptive sparse connec- tivity inspired by network science. Nature Communications, 2018.
226
+ D. Molchanov, A. Ashukha, and D. Vetrov. Variational dropout sparsifies deep neural networks. In Proceedings of International Conference on Machine Learning, 2017.
227
+ A. S. Morcos, H. Yi, M. Paganini, and Y. Tian. One ticket to win them all: Generalizing lottery ticket initializations across datasets and optimizers. In Advances in Neural Information Processing Systems, 2019.
228
+ M. C. Mozer and P. Smolensky. Skeletonization: A technique for trimming the fat from a network via relevance assessment. In Advances in Neural Information Processing Systems, 1988.
229
+ B. Mussay, M. Osadchy, V. Braverman, S. Zhou, and D. Feldman. Data-indenpendent neural pruning via coresets. In International Conference on Learning Representations, 2020.
230
+ Y. Netzer, T. Wang, A. Coates, A. Bissacco, B. Wu, and A. Y. Ng. Reading digits in natural images with unsupervised feature learning. In NeurIPS Deep Learning and Unsupervised Feature Learning Workshop, 2011.
231
+ B. Neyshabur, R. Tomioka, and N. Srebro. Norm-based capacity control in neural networks. In Conference on Learning Theory, 2015.
232
+ S. Park, J. Lee, S. Mo, and J. Shin. Lookahead: A far-sighted alternative of magnitude-based pruning. In International Conference on Learning Representations, 2020.
233
+ A. Renda, J. Frankle, and M. Carbin. Comparing fine-tuning and rewinding in neural network pruning. In International Conference on Learning Representations, 2020.
234
+ V. Sanh, T. Wolf, and A. M. Rush. Movement pruning: Adaptive sparsity by fine-tuning. arXiv preprint 2005.07683, 2020.
235
+ H. Sedghi, V. Gupta, and P. M. Long. The singular values of convolutional layers. In International Conference on Learning Representations, 2019.
236
+ K. Simonyan and A. Zisserman. Very deep convolutional networks for large-scale image recognition. In International Conference on Learning Representations, 2015.
237
+ M. Tan and Q. V. Le. Efficientnet: Rethinking model scaling for convolutional neural networks. In Proceedings of International Conference on Machine Learning, 2019.
238
+ D. Tsipras, S. Santurkar, L. Engstrom, A. Turner, and A. Madry. Robustness may be at odds with accuracy. In International Conference on Learning Representations, 2019.
239
+ A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, Ł. Kaiser, and I. Polosukhin. Attention is all you need. In Advances in Neural Information Processing Systems, 2017.
240
+ X. Xiao, Z. Wang, and S. Rajasekaran. AutoPrune: Automatic network pruning by regularizing auxiliary parameters. In Advances in Neural Information Processing Systems, 2019.
241
+ C. Yun, S. Sra, and A. Jadbabaie. Small ReLU networks are powerful memorizers: a tight analysis of memorization capacity. In Advances in Neural Information Processing Systems, 2019.
242
+ H. Zhou, J. Lan, R. Liu, and J. Yosinki. Deconstructing lottery tickets: Zeros, signs, and supermasks. In Advances in Neural Information Processing Systems, 2019.
243
+ M. Zhu and S. Gupta. To prune, or not to prune: exploring the efficacy of pruning for model compression. In ICLR Workshop track, 2018.
244
+
245
+ # A EXPERIMENTAL SETUPS
246
+
247
+ For any implementational details not given in this section, we refer to the code at:
248
+
249
+ # https://github.com/jaeho-lee/layer-adaptive-sparsity
250
+
251
+ Optimizer. With an exception of the weight rewinding experiment, we use AdamW (Loshchilov & Hutter, 2019) with learning rate 0.0003; we use vanilla Adam with learning rate 0.0003 for the weight rewinding experiment, following the setup of Frankle & Carbin (2019). For other hyperparameters, we follow the PyTorch default setup: $\vec { \beta } = ( 0 . 9 , 0 . 9 9 9 ) , \mathrm { w d } = 0 . 0 1 , \varepsilon = 1 0 ^ { - 8 }$ .
252
+
253
+ Pre-processing. CIFAR-10/100 dataset is augmented with random crops with a padding of 4 and random horizontal flips. We normalize both training and test datasets with constants
254
+
255
+ $$
256
+ ( 0 . 4 9 1 4 , 0 . 4 8 2 2 , 0 . 4 4 6 5 ) , ( 0 . 2 3 7 , 0 . 2 4 3 , 0 . 2 6 1 ) .
257
+ $$
258
+
259
+ SVHN training dataset is augmented with random crops with a padding of 2. We normalize both training and test datasets with constants
260
+
261
+ $$
262
+ ( 0 . 4 3 7 7 , 0 . 4 4 3 8 , 0 . 4 7 2 8 ) , ( 0 . 1 9 8 , 0 . 2 0 1 , 0 . 1 9 7 ) .
263
+ $$
264
+
265
+ Restricted ImageNet training dataset is augmented with Random resized crop to size 224 and random horizontal flips. Restricted ImageNet test dataset is resized to 256 and then center-cropped to size 224. We normalize both training and test datasets with constants
266
+
267
+ $$
268
+ ( 0 . 4 8 5 , 0 . 4 5 6 , 0 . 4 0 6 ) , ( 0 . 2 2 9 , 0 . 2 2 4 , 0 . 2 2 5 ) .
269
+ $$
270
+
271
+ Models. Some of the models used for CIFAR-10 datasets are originally developed for ImageNet: VGG-16, DenseNet-121, EfficientNet-B0. The models are adapted for CIFAR-10/100 datasets by modifying only the average pooling and the (first) fully-connected layer (and not convolutional layers) to fit the $3 2 \times 3 2$ resolution of the input image.
272
+
273
+ Table 1: Optimization details.
274
+
275
+ <table><tr><td>Dataset</td><td>Model</td><td>Initial training iter.</td><td>Re-training iter.</td><td>Batch size</td></tr><tr><td>SVHN</td><td>VGG-16</td><td>40000</td><td>30000</td><td>100</td></tr><tr><td>CIFAR-10</td><td>{VGG-16,EfficientNet-B0}</td><td>50000</td><td>40000</td><td>100</td></tr><tr><td>CIFAR-10</td><td>DenseNet-121</td><td>80000</td><td>60000</td><td>100</td></tr><tr><td>CIFAR-100</td><td>VGG-16</td><td>60000</td><td>50000</td><td>100</td></tr><tr><td>Restricted ImageNet</td><td>ResNet-34</td><td>80000</td><td>80000</td><td>128</td></tr><tr><td>CIFAR-10</td><td>Conv-6 (SNIP)</td><td>50000</td><td>40000</td><td>128</td></tr></table>
276
+
277
+ In this section, we discuss the computational complexity of LAMP and describe how LAMP can be implemented. We consider a depth- $d$ neural network, with $n _ { i }$ number of connections in $i$ -th layer. We also let $\textstyle n = \sum _ { i = 1 } ^ { d } n _ { i }$ .
278
+
279
+ The global MP is comprised of two steps:
280
+
281
+ • Step 1. Pool and sort the weight magnitudes of all connections, taking ${ \mathcal { O } } ( n \log n )$ operations. • Step 2. Assign 0s to connections with smallest weights until the desired sparsity level is achieved, taking ${ \mathcal { O } } ( n )$ computations.
282
+
283
+ The total computational cost is of order ${ \mathcal { O } } ( n \log n )$ . Similarly, we see that performing MP with any pre-determined sparsity levels incurs $\begin{array} { r } { \mathcal { O } ( \sum _ { i = 1 } ^ { d } n _ { i } \log n _ { i } ) } \end{array}$ computations.
284
+
285
+ LAMP, on the other hand, can be done in four steps.
286
+
287
+ • Step 1. Weight magnitudes are squared and sorted for each layer, which can be done with a computation cost of $\begin{array} { r } { \mathcal { O } ( \sum _ { i = 1 } ^ { d } n _ { i } \log n _ { i } ) } \end{array}$ .
288
+ • Step 2. LAMP score denominators $\textstyle \sum _ { v \geq u } W _ { i } ^ { 2 } [ v ]$ for each layer is computed by summing-andstoring the squared weight magnitudes according to a descending order; takes ${ \mathcal { O } } ( n )$ computations.
289
+ • Step 3. The LAMP score is computed by dividing squared weight magnitudes by the denominators, using ${ \mathcal { O } } ( n )$ steps.
290
+ • Step 4. We sort and prune as in global MP, taking ${ \mathcal { O } } ( n \log n )$ steps.7
291
+
292
+ We observe that step 4 is the dominant term, which is shared by the global MP. The first three steps can be easily implemented in PyTorch as follows.
293
+
294
+ # C DERIVATION OF INEQUALITY (8)
295
+
296
+ In this section, we prove the following inequality.
297
+
298
+ $$
299
+ \operatorname* { s u p } _ { \| \boldsymbol { x } \| _ { 2 } \le 1 } \| f ( \boldsymbol { x } ; W ^ { ( 1 : d ) } ) - f ( \boldsymbol { x } ; W ^ { ( 1 : i - 1 ) } , \widetilde { W } ^ { ( i ) } , W ^ { ( i + 1 : d ) } ) \| _ { 2 } \le \| W ^ { ( i ) } - \widetilde { W } ^ { ( i ) } \| _ { F } \cdot \prod _ { j \ne i } \| W ^ { ( j ) } \| _ { F } .
300
+ $$
301
+
302
+ This inequality is a simplified and modified version of what is popularly known as “peeling” procedure in the generalization literature (e.g., (Neyshabur et al., 2015)), and we present the proof only for the sake of completeness. We begin by peeling the outermost layer as
303
+
304
+ $$
305
+ \begin{array} { r l } & { \| f ( x ; W ^ { ( 1 : d ) } ) - f ( x ; W ^ { ( 1 : i - 1 ) } , \widetilde { W } ^ { ( i ) } , W ^ { ( i + 1 : d ) } ) \| _ { 2 } } \\ & { = \Big \| W ^ { ( d ) } \left( \sigma ( f ( x ; W ^ { ( 1 : d - 1 ) } ) - \sigma ( f ( x ; W ^ { ( 1 : i - 1 ) } , \widetilde { W } ^ { ( i ) } , W ^ { ( i + 1 : d - 1 ) } ) ) \right) \Big \| _ { 2 } } \\ & { \le \| W ^ { ( d ) } \| _ { F } \cdot \Big \| \sigma ( f ( x ; W ^ { ( 1 : d - 1 ) } ) - \sigma ( f ( x ; W ^ { ( 1 : i - 1 ) } , \widetilde { W } ^ { ( i ) } , W ^ { ( i + 1 : d - 1 ) } ) ) \Big \| _ { 2 } } \\ & { \le \| W ^ { ( d ) } \| _ { F } \cdot \Big \| f ( x ; W ^ { ( 1 : d - 1 ) } ) - f ( x ; W ^ { ( 1 : i - 1 ) } , \widetilde { W } ^ { ( i ) } , W ^ { ( i + 1 : d - 1 ) } ) \Big \| _ { 2 } , } \end{array}
306
+ $$
307
+
308
+ where we have used Cauchy-Schwarz inequality for the first inequality, and the 1-Lipschitzness of ReLU activation with respect to $\ell _ { 2 }$ norm. We keep on peeling until we get
309
+
310
+ $$
311
+ \begin{array} { r l } & { \| f ( x ; W ^ { ( 1 : d ) } ) - f ( x ; W ^ { ( 1 : i - 1 ) } , \widetilde W ^ { ( i ) } , W ^ { ( i + 1 : d ) } ) \| _ { 2 } } \\ & { \le \big ( \displaystyle \prod _ { j > i } \| W ^ { ( j ) } \| _ { F } \big ) \cdot \| f ( x ; W ^ { ( 1 : i ) } ) - f ( x ; W ^ { ( 1 : i - 1 ) } , \widetilde W ^ { ( i ) } ) \| _ { 2 } . } \end{array}
312
+ $$
313
+
314
+ The second multiplicative term on the right-hand side requires a slightly different treatment. Via Cauchy-Schwarz, we get
315
+
316
+ $$
317
+ \begin{array} { r l } & { \| f ( x ; W ^ { ( 1 : i ) } ) - f ( x ; W ^ { ( 1 : i - 1 ) } , \widetilde { W } ^ { ( i ) } ) \| _ { 2 } = \Big \| \Big ( W ^ { ( i ) } - \widetilde { W } ^ { ( i ) } \Big ) \sigma ( f ( x ; W ^ { ( 1 : i - 1 ) } ) ) \Big \| _ { 2 } } \\ & { \qquad \le \| W ^ { ( i ) } - \tilde { W } ^ { ( i ) } \| _ { F } \cdot \| \sigma ( f ( x ; W ^ { ( 1 : i - 1 ) } ) ) \| _ { 2 } . } \end{array}
318
+ $$
319
+
320
+ The activation functions from this point require zero-in-zero-out (ZIZO; $\sigma ( \mathbf { 0 } ) = \mathbf { 0 }$ ) property to be peeled, in addition to the Lipschitzness. Indeed, we can proceed as
321
+
322
+ $$
323
+ \begin{array} { r } { \| \sigma ( f ( x ; W ^ { ( 1 : i - 1 ) } ) ) \| _ { 2 } = \| \sigma ( f ( x ; W ^ { ( 1 : i - 1 ) } ) ) - \sigma ( \pmb 0 ) \| _ { 2 } \leq \| f ( x ; W ^ { ( 1 : i - 1 ) } ) - \pmb 0 \| _ { 2 } } \\ { = \| f ( x ; W ^ { ( 1 : i - 1 ) } ) \| _ { 2 } . } \end{array}
324
+ $$
325
+
326
+ Iteratively applying the Cauchy-Schwarz inequality and the step Eq. (19), we arrive at Eq. (9).
327
+
328
+ # D EXPERIMENTAL RESULTS ON LANGUAGE MODELING
329
+
330
+ In this section, we apply the proposed LAMP and baseline layerwise sparsities on language modeling tasks. We note, however, that it is still unclear whether magnitude-based pruning approaches achieve state-of-the-art results for pruning natural language processing tasks (see, e.g., Sanh et al. (2020), for more discussions). In particular, NLP model architectures (e.g., embedding layers) and learning pipelines (e.g., more prevalent use of pre-trained models) add more complications to model pruning, obscuring how pruning algorithms should be fairly compared. We also note that we do not test Uniform $^ +$ baseline for this task, as the heuristic is proposed explicitly for image classification models, not language models (Gale et al., 2019).
331
+
332
+ Model. We consider the simplified version of Transformer-XL (Dai et al., 2018) architecture, which has six self-attention layers (original has 16) and removed some regularizing heuristics, such as exponential moving average and cosine annealing. Similar to the setting of Sanh et al. (2020), we focus on pruning self-attention layers of the model (approximately 7.57M parameters).
333
+
334
+ Optimizer. We use AdamW (Loshchilov & Hutter, 2019) with learning rate 0.0003, following the PyTorch default setup for other hyperparameters: $\vec { \beta } = ( 0 . 9 , 0 . 9 9 9 )$ , $\mathrm { w d } = 0 . 0 1$ , $\varepsilon = 1 0 ^ { - 8 }$ . We use batch size 20 and maximum sequence length 70. We train the initial unpruned model for 200,000 iterations and re-train the model after pruning for 50,000 iterations.
335
+
336
+ Datasets. We use Penn Treebank (Marcus et al., 1993) and WikiText-2 (Merity et al., 2016) datasets.
337
+
338
+ We provide the experimental results in Tables 2 and 3. We observe that LAMP consistently achieves the near-best performance among all considered methods. We note, however, that the gain is marginal. We suspect that this marginal-ity is due to the fact that widths of the Transformer layers are relatively uniform compared to image classification models. We do not observe any notable pattern among the baseline methods.
339
+
340
+ Table 2: Test perplexities of Transformer-XL iteratively pruned and trained on Penn Treebank. Bold denotes the pruning scheme with accuracy within one standard deviation from the highest.
341
+
342
+ <table><tr><td>Surv. weights</td><td>26.2%</td><td>21.0%</td><td>16,8%</td><td>13.4%</td><td>10.8%</td><td>8.59%</td><td>6.87%</td><td>5.50%</td><td>4.40%</td><td>3.52%</td></tr><tr><td>Global</td><td>71.38±0.39</td><td>71.78±0.34</td><td>73.23±0.38</td><td>73.67±0.10</td><td>76.23±0.43</td><td>78.21±0.31</td><td>80.92±0.10</td><td>83.98±0.36</td><td>88.62±0.25</td><td>92.30±0.54</td></tr><tr><td>Uniform</td><td>71.57±0.46</td><td>71.74±0.39</td><td>73.27±0.36</td><td>74.18±0.34</td><td>76.98±0.41</td><td>79.25±0.29</td><td>81.79±0.13</td><td>84.95±0.35</td><td>89.41±0.39</td><td>92.44±0.69</td></tr><tr><td>Erdós-Renyi ker.</td><td>71.53±0.33</td><td>71.94±0.20</td><td>73.56±0.31</td><td>74.43±0.20</td><td>77.15±0.33</td><td>79.38±0.26</td><td>82.03±0.13</td><td>85.01±0.38</td><td>89.34±0.31</td><td>92.75±0.55</td></tr><tr><td> LAMP (Ours)</td><td>71.51±0.38</td><td>71.79±0.24</td><td>73.11±0.37</td><td>73.74±0.21</td><td>76.23±0.27</td><td>78.27±0.18</td><td>80.73±0.09</td><td>83.60±0.35</td><td></td><td>88.06±0.2491.24±0.38</td></tr></table>
343
+
344
+ Table 3: Test perplexities of Transformer-XL iteratively pruned and trained on WT-2. Bold denotes the pruning scheme with accuracy within one standard deviation from the highest.
345
+
346
+ <table><tr><td>Surv. weights</td><td>26.2%</td><td>21.0%</td><td>16,8%</td><td>13.4%</td><td>10.8%</td><td>8.59%</td><td>6.87%</td><td>5.50%</td><td>4.40%</td><td>3.52%</td></tr><tr><td>Global</td><td>87.62±0.28</td><td>90.43±0.58</td><td>91.35±0.21</td><td>94.65±0.30</td><td>96.34±0.35</td><td>100.07±0.48</td><td>103.56±0.48</td><td>107.95±0.74</td><td>112.20±0.34</td><td>117.03±0.63</td></tr><tr><td>Uniform</td><td>87.88±0.26</td><td>90.46±0.69</td><td>91.58±0.29</td><td>95.01±0.21</td><td>96.72±0.79</td><td>100.83±0.32</td><td>104.25±0.28</td><td>108.31±0.53</td><td>112.71±0.25</td><td>117.01±0.50</td></tr><tr><td>Erdós-Renyi ker.</td><td>88.01±0.23</td><td>90.62±0.64</td><td>91.99±0.28</td><td>95.40±0.36</td><td>97.13 ±0.72</td><td>100.83±0.38</td><td>104.49±0.51</td><td>108.51±0.90</td><td>112.56±0.47</td><td>116.69±0.34</td></tr><tr><td>LAMP (Ours)</td><td>87.73±0.26</td><td>90.76±0.54</td><td>91.47±0.33</td><td>94.58±0.30</td><td>96.10±0.53</td><td>99.62±0.19</td><td>103.01±0.22</td><td>106.60±0.46</td><td>110.87±0.63</td><td>115.31±0.64</td></tr></table>
347
+
348
+ # E DETAILED EXPERIMENTAL RESULTS (WITH STANDARD DEVIATIONS)
349
+
350
+ Table 4: Test accuracies of VGG-16 iteratively pruned and trained on CIFAR-10. Bold denotes the pruning scheme with accuracy within one standard deviation from the highest.
351
+
352
+ <table><tr><td>Surv. weights</td><td>6.87%</td><td>4.40%</td><td>2.81%</td><td>1.80%</td><td>1.15%</td><td>0.74%</td><td>0.47%</td><td>0.30%</td><td>0.19%</td><td>0.12%</td></tr><tr><td>Global</td><td>91.30±0.23</td><td>90.80±0.23</td><td>89.28±0.30</td><td>85.55±2.38</td><td>81.56±3.73</td><td>54.58±22.07</td><td>41.91±18.63</td><td>31.93±21.24</td><td>21.87±21.21</td><td>11.72±2.29</td></tr><tr><td>Uniform</td><td>91.47±0.19</td><td>90.78±0.12</td><td>88.61±1.09</td><td>84.17±4.46</td><td>55.68±12.20</td><td>38.51±24.83</td><td>26.41±8.83</td><td>16.75±6.62</td><td>11.58±2.79</td><td>9.95±0.28</td></tr><tr><td>Uniform+</td><td>91.54±0.19</td><td>91.20±0.28</td><td>90.16±0.12</td><td>89.44±0.15</td><td>87.85±0.26</td><td>86.53±0.05</td><td>84.84±0.41</td><td>82.41±0.44</td><td>74.54±5.41</td><td>24.46±14.98</td></tr><tr><td>Erdos-Renyi ker.</td><td>92.34±0.25</td><td>91.99±0.14</td><td>91.66±0.29</td><td>91.15±0.24</td><td>90.55±0.19</td><td>89.51±0.50</td><td>88.21±0.38</td><td>86.73±0.25</td><td>84.85±0.28</td><td>81.50±0.42</td></tr><tr><td>LAMP (Ours)</td><td>92.24±0.24 92.06±0.2191.71±0.30 91.66±0.21</td><td></td><td></td><td></td><td>91.07±0.40</td><td>90.49±0.21</td><td>89.64±0.32</td><td>88.75±0.29</td><td>87.07±0.37</td><td>84.90±0.59</td></tr></table>
353
+
354
+ Table 5: Test accuracies of ResNet-20 iteratively pruned and trained on CIFAR-10. Bold denotes the pruning scheme with accuracy within one standard deviation from the highest.
355
+
356
+ <table><tr><td>Surv. weights</td><td>20.97%</td><td>13.42%</td><td>8.59%</td><td>5.50%</td><td>3.52%</td><td>2.25%</td><td>1.44%</td><td>0.92%</td><td>0.59%</td><td>0.38%</td></tr><tr><td>Global</td><td>87.48±0.28</td><td>86.97±0.39</td><td>86.29±0.23</td><td>85.02±0.35</td><td>83.15±0.33</td><td>80.52±0.36</td><td>76.28±0.50</td><td>70.69±0.32</td><td>47.47±11.13</td><td>12.02±3.77</td></tr><tr><td>Uniform</td><td>87.24±0.28</td><td>86.70±0.20</td><td>86.09±0.21</td><td>84.53±0.34</td><td>82.05±0.23</td><td>77.19±2.36</td><td>64.24±14.50</td><td>47.97±2.91</td><td>20.45±8.73</td><td>13.35±2.66</td></tr><tr><td>Uniform+</td><td>87.30±0.29</td><td>87.00±0.23</td><td>86.27±0.13</td><td>85.00±0.15</td><td>83.23±0.19</td><td>80.40±0.31</td><td>76.40±0.45</td><td>69.31±1.27</td><td>52.06±2.53</td><td>20.19±8.44</td></tr><tr><td>Erdös-Renyi ker.</td><td>87.63±0.10</td><td>87.49±0.31</td><td>86.83±0.27</td><td>85.84±0.23</td><td>84.08±0.34</td><td>81.76±0.37</td><td>78.70±0.25</td><td>74.40±0.52</td><td>66.42±1.46</td><td>50.90±3.28</td></tr><tr><td>LAMP (Ours)</td><td>87.54±0.37</td><td>87.12±0.11</td><td>86.56±0.21</td><td>85.64±0.26</td><td>84.18±0.23</td><td>81.56±0.26</td><td>78.63±0.50</td><td>74.20±0.81</td><td>67.01±0.92</td><td>51.24±8.48</td></tr></table>
357
+
358
+ Table 6: Test accuracies of DenseNet-121 iteratively pruned and trained on CIFAR-10. Bold denotes the pruning scheme with accuracy within one standard deviation from the highest.
359
+
360
+ <table><tr><td>Surv. weights</td><td>5.50%</td><td>4.40%</td><td>3.52%</td><td>2.82%</td><td>2.25%</td><td>1.80%</td><td>1.44%</td><td>1.15%</td><td>0.92%</td><td>0.74%</td></tr><tr><td>Global</td><td>90.16±0.36</td><td>89.52±0.36</td><td>88.83±0.44</td><td>88.00±0.43</td><td>86.85±0.47</td><td>85.32±0.58</td><td>77.68±8.01</td><td>45.30±27.75</td><td>49.65±21.88</td><td>20.96±19.49</td></tr><tr><td>Uniform</td><td>90.24±0.11</td><td>89.50±0.13</td><td>88.44±0.19</td><td>87.94±0.45</td><td>86.83±0.41</td><td>85.00±1.54</td><td>82.16±3.37</td><td>70.13±13.69</td><td>66.46±18.72</td><td>48.71±21.42</td></tr><tr><td>Uniform+</td><td>90.25±0.18</td><td>89.70±0.20</td><td>89.03±0.17</td><td>88.22±0.27</td><td>87.40±0.41</td><td>86.26±0.44</td><td>84.55±0.45</td><td>81.87±0.77</td><td>69.25±19.28</td><td>58.91±8.26</td></tr><tr><td>Erdös-Renyi ker.</td><td>90.21±0.29</td><td>89.79±0.29</td><td>88.92±0.07</td><td>88.20±0.23</td><td>87.25±0.36</td><td>86.22±0.30</td><td>84.11±0.50</td><td>81.82±0.90</td><td>59.06±25.61</td><td>59.07±25.70</td></tr><tr><td>LAMP (Ours)</td><td>90.89±0.17</td><td>90.11±0.13</td><td>89.72±0.26</td><td>89.12±0.35</td><td>88.39±0.26</td><td>87.75±0.18</td><td>86.53±0.33</td><td>85.13±0.31</td><td>82.92±0.66</td><td>79.23±1.29</td></tr></table>
361
+
362
+ Table 7: Test accuracies of EfficientNet-B0 iteratively pruned and trained on CIFAR-10. Bold denote the pruning scheme with accuracy within one standard deviation from the highest.
363
+
364
+ <table><tr><td>Surv. weights</td><td>41.0%</td><td>26.2%</td><td>16.8%</td><td>10.7%</td><td>6.87%</td><td>4.40%</td><td>2.82%</td><td>1.80%</td><td>1.15%</td><td>0.74%</td></tr><tr><td>Global</td><td>89.66±0.21</td><td>89.55±0.30</td><td>88.80±0.32</td><td>87.64±0.35</td><td>84.36±0.59</td><td>79.25±0.67</td><td>11.09±2.14</td><td>10.62±1.38</td><td>10.00±0.00</td><td>10.00±0.00</td></tr><tr><td>Uniform</td><td>88.99±0.31</td><td>88.26±0.32</td><td>86.48±0.38</td><td>83.40±0.38</td><td>23.65±28.16</td><td>10.83±0.83</td><td>10.00±0.00</td><td>10.00±0.00</td><td>10.00±0.00</td><td>10.00±0.00</td></tr><tr><td>Uniform+</td><td>89.18±0.35</td><td>88.03±0.19</td><td>86.71±0.40</td><td>84.16±0.65</td><td>36.64±35.77</td><td>10.45±0.67</td><td>10.00±0.00</td><td>10.19±1.62</td><td>10.00±0.00</td><td>10.00±0.00</td></tr><tr><td>Erdös-Renyi ker.</td><td>89.54±0.17</td><td>90.09±0.09</td><td>90.01±0.31</td><td>89.62±0.26</td><td>88.82±0.39</td><td>87.08±0.32</td><td>84.72±0.24</td><td>81.53±0.44</td><td>51.31±25.77</td><td>13.40±3.04</td></tr><tr><td>LAMP (Ours)</td><td>89.52±0.51</td><td>89.95±0.20</td><td>89.97±0.23</td><td>90.21±0.28</td><td>89.91±0.14</td><td>89.79±0.33</td><td>89.30±0.08</td><td>88.51±0.37</td><td>86.79±0.73</td><td>65.76±20.07</td></tr></table>
365
+
366
+ Table 8: Test accuracies of VGG-16 iteratively pruned and trained on SVHN. Bold denotes the pruning scheme with accuracy within one standard deviation from the highest.
367
+
368
+ <table><tr><td>Surv. weights</td><td>6.87%</td><td>4.40%</td><td>2.82%</td><td>1.80%</td><td>1.15%</td><td>0.74%</td><td>0.47%</td><td>0.30%</td><td>0.19%</td><td>0.12%</td></tr><tr><td>Global</td><td>95.75±0.17</td><td>95.46±0.10</td><td>94.91±0.48</td><td>61.06±30.93</td><td>65.06±11.01</td><td>49.51±24.23</td><td>26.83±19.39</td><td>15.37±5.95</td><td>7.79±1.60</td><td>14.72±3.65</td></tr><tr><td>Uniform</td><td>95.78±0.16</td><td>95.52±0.10</td><td>95.35±0.14</td><td>94.98±0.19</td><td>93.26±1.42</td><td>64.32±15.03</td><td>29.54±10.21</td><td>19.63±7.54</td><td>13.73±6.97</td><td>17.94±4.85</td></tr><tr><td>Uniform+</td><td>95.70±0.13</td><td>95.68±0.17</td><td>95.42±0.11</td><td>95.05±0.15</td><td>94.57±0.16</td><td>93.87±0.10</td><td>93.07±0.16</td><td>92.25±0.25</td><td>74.88±25.75</td><td>17.67±14.33</td></tr><tr><td>Erdös-Renyi ker.</td><td>96.00±0.09</td><td>95.89±0.11</td><td>95.59±0.15</td><td>95.47±0.10</td><td>95.16±0.08</td><td>94.81±0.16</td><td>94.30±0.18</td><td>93.74±0.27</td><td>93.48±0.27</td><td>93.06±0.25</td></tr><tr><td>LAMP (Ours)</td><td></td><td>95.98±0.1595.87±0.1395.74±0.10</td><td></td><td>95.58±0.07</td><td>95.35±0.18</td><td>95.16±0.08</td><td>94.71±0.18</td><td>94.24±0.17</td><td>94.05±0.15</td><td>93.97±0.19</td></tr></table>
369
+
370
+ Table 9: Test accuracies of VGG-16 iteratively pruned and trained on CIFAR-100. Bold denotes the pruning scheme with accuracy within one standard deviation from the highest.
371
+
372
+ <table><tr><td>Surv. weights</td><td>13.42%</td><td>8.59%</td><td>5.50%</td><td>3.52%</td><td>2.25%</td><td>1.44%</td><td>0.92%</td><td>0.59%</td><td>0.38%</td><td>0.24%</td></tr><tr><td>Global</td><td>68.02±0.22</td><td>67.20±0.13</td><td>66.82±0.25</td><td>65.68±0.28</td><td>63.25±0.37</td><td>60.18±0.33</td><td>53.52±1.97</td><td>33.66±18.02</td><td>7.80±2.97</td><td>4.29±6.04</td></tr><tr><td>Uniform</td><td>67.92±0.23</td><td>67.43±0.37</td><td>66.41±0.54</td><td>63.94±0.71</td><td>57.62±2.01</td><td>48.88±4.56</td><td>32.60±14.16</td><td>14.99±8.65</td><td>3.94±3.67</td><td>3.35±2.80</td></tr><tr><td>Uniform+</td><td>67.94±0.32</td><td>67.41±0.16</td><td>66.37±0.09</td><td>65.51±0.33</td><td>63.43±0.35</td><td>60.76±0.29</td><td>57.93±0.39</td><td>55.40±0.22</td><td>51.90±1.30</td><td>33.35±13.08</td></tr><tr><td>Erdös-Renyi ker.</td><td>68.07±0.42</td><td>67.92±0.36</td><td>67.45±0.22</td><td>67.09±0.31</td><td>65.86±0.18</td><td>64.15±0.31</td><td>62.04±0.37</td><td>60.07±0.35</td><td>58.58±0.58</td><td>55.88±0.51</td></tr><tr><td>LAMP (Ours)</td><td>68.07±0.58</td><td>68.22±0.27</td><td>67.84±0.31</td><td>67.37±0.28</td><td>66.35±0.53</td><td>65.25±0.23</td><td>63.46±0.28</td><td>62.37±0.28</td><td>60.77±0.42</td><td>58.05±0.42</td></tr></table>
373
+
374
+ ![](images/94eff95c5fb910f5b31e8fdbd2d72c273c4da2299dabc51c4950d0473f7a7a09.jpg)
375
+ Figure 6: Layerwise survival rates of one-shot pruned ResNet-50 trained on ImageNet dataset. The global survival rates are $\{ 8 0 . 0 \% , 4 1 . 0 \% , 2 1 . 0 \% \}$ (from lighter to darker).
376
+
377
+ # F PEAKS AND CRESTS OF LAMP SPARSITY
378
+
379
+ In this section, we compare the layerwise sparsity discovered by LAMP (and other non-uniform baselines) to the sparsity discovered by AMC (He et al., 2018), which uses a reinforcement learning agent to explicitly search for the optimal layerwise sparsity. In particular, we focus on whether the “peaks and crests” phenomenon observed for AMC-discovered layerwise sparsity also takes place in the layerwise sparsity induced by LAMP: He et al. (2018) observe that the layerwise sparsity of ResNet-50 (trained on ImageNet) and pruned by AMC exhibits what they call peaks and crests, i.e., the sparsity oscillates between high and low periodically; see Figure 3 of He et al. (2018). The authors speculate that such phenomenon takes place, because AMC automatically learns that $3 \times 3$ convolution has more redundancy than $1 \times 1$ convolution and can be pruned more.
380
+
381
+ To see if LAMP also automatically discovers such “peaks and crests,” we prune the ImageNetpretrained ResNet-50 model with one-shot LAMP, global MP, and Erdos-R ¨ enyi kernel. The layerwise ´ survival ratios are reported in Fig. 6. From the figure, we observe that LAMP also discovers different sparsity ratio for $1 \times 1$ convolution and $3 \times 3$ convolution layers; $3 \times 3$ convolutional filters are pruned more. Such pattern is more noticeable in the later layers, where more weights are pruned. In other words, LAMP discovers a layerwise sparsity similar to that of AMC, even without training a reinforcement learning agent. We note, however, a slight discrepancy in the setting: AMC reports the sparsity from an iterative pruning setup, and the results in Fig. 6 are from a one-shot pruning setup.
382
+
383
+ In the model pruned with global MP, such pattern does not stand out. In the model pruned with Erdos-R ¨ enyi kernel method, peaks and crests are extremely evident, even more than those discovered ´ by AMC.
384
+
385
+ ![](images/20855651ae7072cd7948c2af8e2969f77901757a90429ea4bf3d8fb468b91c39.jpg)
386
+ Figure 7: Performance of LAMP and baselines on VGG-16 trained on CIFAR-10 dataset, using the training schedules from Liu et al. (2019).
387
+
388
+ # G LAMP WITH AN EXTENSIVE TRAINING SCHEDULE
389
+
390
+ In this section, we depart from the standardized training setup in the main text which uses Adam with weight decay Loshchilov & Hutter (2019), without any learning rate decay. Instead, we validate the effectiveness of LAMP using the optimizer and hyperparameters extensively tuned for the maximum performance of the model. In particular, we use configurations from Liu et al. (2019) for training VGG-16 on the CIFAR-10 dataset. The experimental result is reported in Fig. 7. Similar to the experiments appearing in the main text, we observe that LAMP continues to outperform or match the performances of the baselines.
md/train/H8VDvtm1ij8/H8VDvtm1ij8.md ADDED
@@ -0,0 +1,341 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # NORMALIZING FLOWS FOR CALIBRATION AND RECALIBRATION
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ In machine learning, due to model misspecification and overfitting, estimates of the aleatoric uncertainty are often inaccurate. One approach to fix this is isotonic regression, in which a monotonic function is fit on a validation set to map the model’s CDF to an optimally calibrated CDF. However, this makes it infeasible to compute additional statistics of interest on the model distribution (such as the mean). In this paper, through a reframing of recalibration as MLE, we replace isotonic regression with normalizing flows. This allows us to retain the ability to compute the statistical properties of the model (such as closed-form likelihoods, mean, correlation, etc.) and provides an opportunity for additional capacity at the cost of possible overfitting. Most importantly, the fundamental properties of normalizing flows allow us to generalize recalibration to conditional and multivariate distributions. To aid in detecting miscalibration and measuring our success at fixing it, we use a simple extension of the calibration Q-Q plot.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Recent advances in deep learning have led to models with significantly higher overall accuracy on both classification and regression tasks compared to what was achievable in the past. However, an important component in conjunction with accuracy is a model’s ability to accurately assess the uncertainty in its prediction. Most taxonomies classify uncertainty into three sources: approximation, aleatoric, and epistemic uncertainty (Der Kiureghian & Ditlevsen, 2009). Approximation uncertainty quantifies the error from fitting a simple model to complex data. Aleatoric uncertainty quantifies the uncertainty of the conditional distribution of the target variable given features. This uncertainty arises from hidden variables or measurement errors and cannot be reduced through collecting more data under the same experimental conditions. Epistemic uncertainty quantifies the uncertainty arising from fitting a model utilizing finite data, i.e. it is inversely proportional to the density of the training examples and can be reduced by collecting data in the low density regions.
12
+
13
+ These different sources of uncertainty have different techniques for handling them. Using high capacity models such as neural networks removes a large part of the approximation uncertainty. By fitting a full distribution on the target conditional on features, we can model the aleatoric uncertainty from observations. Inaccurate estimates of aleatoric uncertainty can be explained by underfitting (insufficient complexity in the conditional distributions) or overfitting (models with sufficient capacity can memorize the data, leading to the distributions collapsing to deltas). Though epistemic uncertainty is important for the model to answer what it does not know, the focus of this paper is on improving estimates of the aleatoric uncertainty.
14
+
15
+ Our approach in this paper is to handle both model fit and calibration using normalizing flows. Normalizing flows can be used in conjunction with amortized inference to improve the flexibility of the output distribution, and further, through a reframing of recalibration as maximum likelihood estimation (MLE), normalizing flows can be used to handle any miscalibration found on a validation set. Further, we use a simple extension of the calibration plot from Kuleshov et al. (2018) to help with the the analysis of the calibration of a model across different regions of the data.
16
+
17
+ # 2 RELATED WORK
18
+
19
+ One method for handling aleatoric uncertainty is amortized inference with Gaussians (Lakshminarayanan et al., 2017; Nix & Weigend, 1994; Kendall & Gal, 2017) where a model, such as a neural network, maps from features to the parameters of a Gaussian. This approach models aleatoric uncertainty directly but suffers from approximation uncertainty as a Gaussian cannot model complex targets.
20
+
21
+ Another approach is Bayesian methods such as Bayesian Ridge Regression (Tipping, 2001) and MC Dropout (Gal & Ghahramani, 2016). Similar to amortized inference with Gaussians, the output distribution limits the capacity of the model. Full Bayesian techniques with neural networks are often too computationally expensive in practice, and approximate methods often fail to capture the full complexity of the uncertainty (Lakshminarayanan et al., 2017).
22
+
23
+ Another family of methods uses quantile regression with non-linear techniques such as decision trees or neural networks. Some of these methods require a predefined set of quantiles (Takeuchi et al., 2006; Wen et al., 2017; Rodrigues & Pereira, 2018; Taylor, 2000). Simultaneous Quantile Regression (SQR, Tagasovska & Lopez-Paz (2019)) trains one model on all quantiles and is able to learn complex shaped distributions. However the training procedure requires the model to learn to be monotonic instead of being constrained to be so and is not trivial to extend to multidimensional outputs. Pearce et al. (2018) learns a finite set of quantiles by using quality metrics for predictive intervals.
24
+
25
+ Normalizing flows have been used in the contexts of variational inference and generative modeling. The approaches to normalizing flows can be categorized into autoregressive methods (Kingma et al., 2016; Papamakarios et al., 2017; Huang et al., 2018; Cao et al., 2019), coupling layers (Dinh et al., 2014; 2016; Kingma & Dhariwal, 2018; Ho et al., 2019), residual networks (Rezende & Mohamed, 2015; van den Berg et al., 2018; Gopal, 2020) and continuous flows (Grathwohl et al., 2018).
26
+
27
+ # 3 BACKGROUND
28
+
29
+ # 3.1 RECALIBRATION
30
+
31
+ An important goal in modeling is to have well-calibrated distributions as this allows users of the model to understand the confidence the model places on its prediction. In other words, with a well-calibrated model, we can better ascertain the uncertainty in the model’s predictions and respond differently to those predictions depending on the uncertainty surrounding them.
32
+
33
+ Guo et al. (2017) showed that unlike techniques used decades ago such as Bayesian Ridge Regression, modern neural network-based classifiers are very poorly calibrated. A simple variant of Platt scaling and other histogram based techniques applied to a validation set were shown to help alleviate the calibration problem where perfect calibration is defined as
34
+
35
+ $$
36
+ \mathbb { P } ( \hat { Y } = Y | \hat { P } = p ) = p , \quad \forall p \in [ 0 , 1 ]
37
+ $$
38
+
39
+ where $\hat { Y }$ is a class prediction and $\hat { P }$ is its predicted probability of correctness.
40
+
41
+ Kuleshov et al. (2018) extended the analysis in Guo et al. (2017) to neural network-based regressors; isotonic regression, a method for learning monotonic univariate functions, was applied to map from $\mathcal { F } _ { x _ { j } } ( y _ { j } ) = \hat { p } _ { j }$ to $| \{ y _ { n } | \mathcal { F } _ { x _ { n } } ( y _ { n } ) < \hat { p } _ { j } , n \stackrel { - } { = } 1 , . . . , N \} | / N$ (the fraction of the data where the model CDF is less than $\hat { p }$ ) to improve calibration where perfect calibration is defined as
42
+
43
+ $$
44
+ \mathbb { P } ( Y < \mathcal { F } _ { X } ^ { - 1 } ( p ) ) = p , \quad \forall p \in [ 0 , 1 ]
45
+ $$
46
+
47
+ where ${ \mathcal { F } } _ { X }$ is the predicted CDF function.
48
+
49
+ Kuleshov et al. (2018) further introduced calibration error as a metric to quantitatively measure how well the quantiles are aligned:
50
+
51
+ $$
52
+ \begin{array} { r } { \hat { p } _ { j } = \vert \{ y _ { n } \vert \mathcal { F } _ { x _ { n } } ( y _ { n } ) < p _ { j } , n = 1 , \ldots , N \} \vert / N } \\ { \operatorname { c a l } ( y _ { 1 } , \ldots , y _ { N } ) = \displaystyle \sum _ { j = 1 } ^ { M } ( p _ { j } - \hat { p } _ { j } ) ^ { 2 } } \end{array}
53
+ $$
54
+
55
+ where $M$ is the number of quantiles that are evaluated. In this paper, we set this to 100 evenly spaced quantiles.
56
+
57
+ ![](images/52aa6c065ffeced6d996d72cde20955f69b0c8da9a20d8031cebe127f210d0b4.jpg)
58
+ Figure 1: A comparison between using a hypernetwork approach versus conditional approach to creating Conditional QuAR Flows to model $p ( X | c )$ where $W _ { 1 }$ and $W _ { 2 }$ parametrize the layers in the residual connection.
59
+
60
+ # 3.2 NORMALIZING FLOWS
61
+
62
+ A crucial component in improving uncertainty estimates in this paper is to fit normalizing flows, a generative model for density estimation using invertible functions.
63
+
64
+ Suppose that we wish to formulate a joint distribution on an $n$ -dimensional real vector $x$ . A flowbased approach treats $x$ as the result of a transformation $g$ applied to an underlying vector $z$ sampled from a base distribution $p _ { z } ( z )$ . The generative process for flows is defined as:
65
+
66
+ $$
67
+ \begin{array} { l } { z \sim p _ { z } ( z ) } \\ { x = g ( z ) } \end{array}
68
+ $$
69
+
70
+ where $p _ { z }$ is often a Normal distribution and $g$ is an invertible function. Notationally, we will use $f = g ^ { - 1 }$ . Using change of variables, the log likelihood of $x$ is
71
+
72
+ $$
73
+ \log p _ { x } ( x ) = \log p _ { z } \left( f ( x ) \right) + \log \left| { \operatorname* { d e t } \left( \frac { \partial f ( x ) } { \partial x } \right) } \right|
74
+ $$
75
+
76
+ To train flows (i.e. maximize the log likelihood of data points), we need to be able to compute the logarithm of the absolute value of the determinant of the Jacobian of $f$ , also called the log-determinant. To construct large normalizing flows, we can compose smaller ones as this is still invertible and the log-determinant of this composition is the sum of the individual log-determinants.
77
+
78
+ An important observation is that every univariate distribution can be viewed as a flow in which the base distribution $p _ { z } ( z )$ is a Uniform distribution over $[ 0 , 1 ]$ and $g$ is the inverse CDF of the univariate distribution. This can be generalized to multivariate distributions using the chain rule.
79
+
80
+ # 3.3 CONDITIONAL QUAR FLOWS
81
+
82
+ In this paper, the specific normalizing flow used is Quasi-Autoregressive Residual Flows (QuAR Flows, Gopal (2020)). QuAR Flows were shown to handle modeling complex distributions while having nice optimization properties and computationally efficient log-likelihoods. Other commonly used normalizing flows have drawbacks. Coupling layers do not work for one-dimensional inputs. Autoregressive flows are often conditional Gaussians which means in the one-dimensional case, the flow is simply a Gaussian. Residual Flows (Chen et al., 2019) are expressive but, though equivalent to QuAR Flows in the one-dimensional case, are computationally expensive for high-dimensional distributions.
83
+
84
+ If we would like to condition a QuAR Flow given some features $c$ , we could use a hypernetwork that maps $c$ to the parameters of the QuAR Flow (Figure 1a). However, this can be computationally expensive if the QuAR Flow is parameterized with thousands of parameters. Instead, conditional information can be incorporated by concatenating the conditions $c$ before applying the first layer in the residual connection within a QuAR Flow (Figure 1b).
85
+
86
+ # 4 REGRESSION USING NORMALIZING FLOWS
87
+
88
+ The goal of regression is to model the conditional probability distribution $p ( y | x )$ . Frequently, this task is reduced to obtaining point estimates of the mean or median by minimizing the mean squared error or mean absolute error respectively. In order to access uncertainties, we must model the full conditional distribution; in addition to this, we can still retrieve point estimates of the mean, median, or any other distributional statistic. In this section, we discuss how normalizing flows can be used to this end as well as how recalibration can be reframed as maximum likelihood estimation (MLE).
89
+
90
+ # 4.1 CALIBRATION WITH NORMALIZING FLOWS
91
+
92
+ One approach to modeling aleatoric uncertainty is to use amortized inference with a Normal distribution as its output distribution, conditioned on features (Lakshminarayanan et al., 2017). However, if a Gaussian is not appropriate to fit the target, then the error in miscalibration can be attributed to approximation error, i.e. insufficient capacity to learn the distribution. A simple example of this is where we have no features to condition on (or all the features we have contain no relevant information) with a one-dimensional target. In Figure 2, we can see that since the target is bimodal, the Gaussian fit does not well describe the data.
93
+
94
+ To improve this model, we replace the Gaussian with a normalizing flow conditioned on our data, similar to Figure 1b. In this way, the distribution fit to the targets has sufficient capacity to learn complex distributions, including multimodal distributions (Figure 2).
95
+
96
+ # 4.2 RECALIBRATION WITH NORMALIZING FLOWS
97
+
98
+ To handle overfitting of the uncertainty, we recalibrate the results of the original model where we assume the original model outputs a full distribution that has closed-form likelihoods. Since the only requirement is a full distribution with a closed-form likelihood, the original model that we recalibrate can be as simple as a Bayesian Linear Regression model or as complicated as a conditional normalizing flow. We recalibrate the original model by fitting a normalizing flow on top of it. In this way, the training process is the following two-step procedure:
99
+
100
+ ![](images/ad181b91bb85b484eab2f815ac5f66a3057be04180b0b5783e57d91cc0f6099a.jpg)
101
+ Figure 2: One-dimensional example of Gaussian versus Flow
102
+
103
+ $$
104
+ \begin{array} { r l } & { 1 . \ f _ { \theta } = \arg \operatorname* { m a x } _ { f _ { \theta } } \sum _ { i = 1 } ^ { N _ { t r } } \log p _ { f _ { \theta } } ( y _ { i } ^ { t r } | x _ { i } ^ { t r } ) } \\ & { 2 . \ g _ { \phi } = \arg \operatorname* { m a x } _ { g _ { \phi } } \sum _ { i = 1 } ^ { N _ { v a l } } \log p _ { g _ { \phi } } ( F _ { \theta } ( y _ { i } ^ { v a l } | x _ { i } ^ { v a l } ) ) } \end{array}
105
+ $$
106
+
107
+ where the tra $f _ { \boldsymbol { \theta } } ( \boldsymbol { y } | \boldsymbol { x } )$ is thet and nction given is the valid $x$ , i $F _ { \theta } ( y | x )$ is the CDF of hough the for $f _ { \theta } ( y | x ) , \{ x ^ { t r } , y ^ { t r } \} _ { i = 1 } ^ { N _ { t r } }$ ison $\{ x ^ { v a l } , y ^ { v a l } \} _ { i = 1 } ^ { N _ { v a l } }$ above shows we can use any likelihood model for $g _ { \phi }$ , since isotonic regression is a method to fit a free form function to the CDFs, we choose to use normalizing flows, specifically QuAR Flows, as these are more flexible than using autoregressive flows such as MAFs (Papamakarios et al., 2017).
108
+
109
+ After the two-step training, the new generative process is:
110
+
111
+ $$
112
+ \begin{array} { l } { z \sim \mathrm { U n i f o r m } ( 0 , 1 ) } \\ { u = G _ { \phi } ^ { - 1 } ( z ) } \\ { y = F _ { \theta } ^ { - 1 } ( u | x ) } \end{array}
113
+ $$
114
+
115
+ where $G _ { \phi }$ is the CDF of $g _ { \phi }$ . The density function of the above generative process is simply the product of the individual density functions: $f _ { \theta }$ and $g _ { \phi }$ . Given this view of the generative process, one interpretation of the two-step process is to first fit $\theta$ on the training set where $\phi$ is initialized so that $G _ { \phi } ^ { - 1 }$ is the identity function, and then to fit $\phi$ on the validation set while keeping $\theta$ frozen. Though $\theta$ and $\phi$ could be trained end-to-end, similar to the approach in Section 4.1, we show in our experiments (Section 6.2) that there are benefits to this two-step approach.
116
+
117
+ ![](images/9212fa4438adc3e36c2e75cfd149f1d9ffde426fb5aa80f4de671bd843cb558c.jpg)
118
+ Figure 3: Comparison plots of isotonic regression and flow recalibration on multiple outputs. The two axes are different targets being modeled, and the scatter plot shows that the targets are correlated. The top and right sides show the marginal histogram as well as the fit from the recalibrated distribution. The contour plot shows the two-dimensional contours of the recalibrated distribution which can be seen to not align well for isotonic regression.
119
+
120
+ Given this log-likelihood viewpoint of recalibration, we can trivially incorporate conditioning of the normalizing flow on additional information. For example, say $f _ { \theta }$ outputs $\mu$ and $\sigma$ that parameterize a Normal distribution, we could then condition $g _ { \phi }$ on these two outputs. If we were to use many features to condition on, we would return to the first situation where we could overfit to the finite number of observations we have. We can think of the first model $f _ { \theta }$ as compressing/embedding the data into two dimensions, and the second model utilizing the embedding to create a meaningful and well-calibrated distribution on the target. Compared to isotonic regression, we can easily incorporate conditional information while retaining monotonicity as normalizing flows are monotonic by construction.
121
+
122
+ Recalibration is interesting in that it is useful for both overfitting as well as underfitting. From Guo et al. (2017), we see that multinomial classification models have sufficient capacity to overfit uncertainties and benefit from recalibration. On the other hand, the simple example in Figure 2 suffers from miscalibrated uncertainties due to approximation uncertainty (underfitting), and recalibration reduces the approximation error.
123
+
124
+ One solution to handling overfitting is to early-stop on a validation set. Whether early stopping occurs or not, our solution incorporates the information of the validation set to correct potential overfitting. However, if we try to correct for multiple sources of overfitting, then we could introduce a new overfitting problem. In essence, there is a tradeoff between the validation size (which in turn controls training size) and how many sources of overfitting one can try to correct after training.
125
+
126
+ # 4.3 MULTIVARIATE RECALIBRATION
127
+
128
+ Whereas Platt scaling (Guo et al., 2017) and isotonic regression (Kuleshov et al., 2018) have been shown to improve the calibration of distributions when we have one-dimensional outputs, scaling these solutions to high-dimensional targets is non-trivial.
129
+
130
+ Say we are modeling two-dimensional real-valued targets and use isotonic regression to calibrate the targets individually. For simplicity, say we use amortized inference with independent output distributions. If the targets are not conditionally independent, the distribution will not be wellcalibrated, even after recalibration with isotonic regression (Figure 3a). However, using normalizing flows, we can compute the CDF of the observed targets per output distribution and recalibrate this two-dimensional distribution (Figure 3b).
131
+
132
+ The general procedure of recalibrating $N$ -dimensional distributions is to fit a normalizing flow on the $N$ -dimensional vector $x _ { i } = F ( y _ { i } | y _ { < i } )$ .
133
+
134
+ ![](images/bd31ec7371b5fbab3c41c4af090e7e01d02a0effd5315ff0fe11e911a5356c31.jpg)
135
+ Figure 4: Calibration Q-Q plots for recalibration using isotonic regression and recalibration using flows for the simulated multivariate case in Figure 3a. The legend contains the calibration error for each curve.
136
+
137
+ # 5 MULTIVARIATE RECALIBRATION EXAMPLE
138
+
139
+ In multiclass classification, we often focus on individual metrics such as accuracy, precision, recall, F1, etc. However, exploring the accuracy of the separate classes using a confusion matrix can show if the model is biased even if the performance on average is good. Similar to this view for classification, we extend the calibration plot introduced in (Kuleshov et al., 2018) to show calibration performance on different subsets of the data, binned by either a feature or a prediction, e.g. Figure 4. The only restriction is the binning cannot be a function of the target we are evaluating.
140
+
141
+ Say we are modeling two-dimensional real-valued targets $( Y _ { 1 } , Y _ { 2 } )$ shown in Figure 3a. If we fit independent Gaussians to the target, the resulting distribution will not align with the contours of the data.
142
+
143
+ We first recalibrate the distribution by fittting isotonic regression models on $F ( Y _ { 1 } )$ and $F ( Y _ { 2 } | Y _ { 1 } )$ The results for $F ( Y _ { 2 } | Y _ { 1 } )$ are shown in Figure 4a where we can see that, though across the full dataset the calibration error is zero, when we bucket by $F ( Y _ { 1 } )$ , the calibration error achieved is both significant and a strong function of $Y _ { 1 }$ as it is unable to account for correlations in $Y _ { 1 }$ and $Y _ { 2 }$ . In other words, the model is not calibrated in any given region of the data but only in aggregate.
144
+
145
+ However, if we recalibrate using normalizing flows by fitting a flow on the pair $( F ( Y _ { 1 } ) , F ( Y _ { 2 } | Y _ { 1 } ) )$ , we can see in Figure 4b that even if we bucket by $F ( Y _ { 1 } )$ , the calibration error stays close to zero. Unlike isotonic regression, the flow can learn the correlation between the CDFs by being trained jointly on all of them. In addition to this, had we used a more complex calibration model that could model the correlations directly, we would not be able to compute the correlation after recalibrating with isotonic regression. By recalibrating with flows, we obtain a result that is still a distribution with a closed-form likelihood; this allows us to still be able to use the model to compute the correlation and any other distributional statistics.
146
+
147
+ In Figure 5, we show visually the difference between recalibration with flows and with isotonic regression. The key differences being that flows can recalibrate the CDFs jointly and be conditioned on additional information $c$ , while isotonic regression is fit on each CDF independently and is unable to incorporate any additional information. The reason is that flows are monotonic by construction and can therefore handle multiple variables and conditions.
148
+
149
+ # 6 EXPERIMENTS
150
+
151
+ In this section, we analyze the performance of flows on multiple UCI datasets. Importantly, we do not aim for state-of-the-art performance, nor do we expect normalizing flows to outperform isotonic
152
+
153
+ ![](images/875700dffcddbe4a75f5e5d09bdaf048c24fbe3c4bd6dcd6bef0495db4def2fa.jpg)
154
+ Figure 5: A diagram for multivariate recalibration using the same notation as that used in Section 4.2. The first step for recalibration is always the calibration step, shown in the blue box, where any likelihood model $f _ { \theta }$ can be used. On the left, isotonic regression is used to recalibrate the CDFs from $f _ { \theta }$ ; on the right, normalizing flows $g _ { \phi }$ are used to recalibrate the CDFs from $f _ { \theta }$ conditioned on some $c$ .
155
+
156
+ regression in aggregate. In terms of calibration, we show that the increase in expressivity can be beneficial; in terms of recalibration, we show specific failure points of isotonic regression that binning uncovers and how normalizing flows fixes these issues.
157
+
158
+ # 6.1 CALIBRATION
159
+
160
+ To test the effect of increased capacity in distributions, we tested how well normalizing flows improve performance in distributional estimates compared to a few other popular approaches for estimating uncertainties. We do not compare directly against other methods for conditional distributions such as autoregressive flows for the reason specified in Section 3.3: in the one dimensional case, those are often the same as ConditionalGaussian. Instead of replacing the output distribution with a complex distribution created by hand, such as an explicit mixture, we rely on using more expressive flows which can model mixture behavior as well as more complicated behavior such as skew and kurtosis.
161
+
162
+ Table 1: Results before and after recalibration on the UCI dataset “naval-propulsion-plant”. Details on the model methodology as well as performance on other UCI datasets are in Appendix B. The mean squared error (MSE) and its uncertainty is computed using 20 seeds. “Calib” is the calibration error (Equation 1) using 100 quantiles across 20 seeds instead of per seed.
163
+
164
+ <table><tr><td rowspan="3"></td><td colspan="2">Before Recalib.</td><td colspan="2">Isotonic Recalib.</td><td colspan="2">Flow Recalib.</td></tr><tr><td>MSE</td><td>Calib</td><td>MSE</td><td>Calib</td><td>MSE</td><td>Calib</td></tr><tr><td>ConditionalFlow</td><td>0.009 ±0.004</td><td>0.45</td><td>N.A.</td><td>&lt;0.01</td><td>0.016 ± 0.012</td><td>&lt;0.01</td></tr><tr><td>ConditionalGaussian</td><td>0.012 ±0.006</td><td>2.35</td><td>N.A.</td><td>&lt;0.01</td><td>0.012 ±0.006</td><td>&lt;0.01</td></tr><tr><td>BayesianRidgeRegression</td><td>0.055 ±0.004</td><td>8.03</td><td>N.A.</td><td>0.01</td><td>0.48 ± 0.02</td><td>&lt;0.01</td></tr><tr><td>MC Dropout</td><td>0.005 ±0.002</td><td>0.51</td><td>N.A.</td><td>N.A.</td><td>N.A.</td><td>N.A.</td></tr><tr><td>SQR</td><td>0.0052 ± 0.0012</td><td>1.44</td><td>N.A.</td><td>N.A.</td><td>N.A.</td><td>N.A.</td></tr></table>
165
+
166
+ All results were evaluated on a held out test set that was not used for calibration or recalibration. Due to limited space, the full extent of the results and details of the models are left for Appendix A and Appendix B. To show the usefulness of the plot we introduced in Section 5, we focus on the results on the UCI dataset “naval-propulsion-plant” (Dheeru & Karra Taniskidou, 2017) in Table 1 and Section 6.2.
167
+
168
+ The models with consistent performance across UCI datasets in terms of calibration are Bayesian Ridge Regression, Conditional Gaussian, and Conditional Flow, with Conditional Flow often performing well in cases where Conditional Gaussian is unable to. Whereas these three models are well calibrated, the mean performance is much weaker for Bayesian Ridge Regression due to the limitations of linear functions.
169
+
170
+ # 6.2 RECALIBRATION
171
+
172
+ Of the models we tested, we recalibrated the Bayesian Ridge Regression, Conditional Gaussian, and Conditional Flow models. MC Dropout and SQR could also be recalibrated, though we chose not to as they lack closed form CDFs, meaning the technique would be approximate. In Table 1, we see the calibration errors after recalibrating with normalizing flows are comparable to those from isotonic regression. However, after isotonic regression is applied, only the calibration error can be computed. In contrast, we can still compute ordinary distribution statistics such as the mean after applying normalizing flows. Due to this property, we can even detect cases in which an improvement in calibration error coincides with a degradation of mean performance, suggesting if the goal were to only get point estimates of the mean, recalibration could be detrimental. For example, in Table 1 this was the case for Bayesian Ridge Regression.
173
+
174
+ In Figure 6a, whereas the calibration error metric shows the flow recalibrated model is well-calibrated averaged across the full dataset, we can see that see that, when bucketing by the predicted mean, the calibration error is significant.
175
+
176
+ To improve this, we recalibrate with a normalizing flow conditioned on the mean predicted by the original model. In this way, we see in Figure 6b that though the aggregate performance does not change, the performance is improved across different buckets. In essence we see that if we were analyzing the distribution across the dataset, we would be accurate; if we started to look closer to individual distributions, the performance is worse suggesting the quantiles of individual distributions cannot be trusted.
177
+
178
+ ![](images/5ba0a74e3b6aa56744216a122f89938ce61fa7461edf3b64016e47551252acc8.jpg)
179
+ Figure 6: Calibration Q-Q plots for recalibration with an unconditional flow and recalibration with a conditional flow on the dataset “naval-propulsion-plant”. The legend contains the calibration error for each curve.
180
+
181
+ ![](images/96799e60b702cd7228ab4ea95bae04d75bb639f63db7286ef906822c86a386ab.jpg)
182
+ Figure 7: Calibration Q-Q plots for recalibration with isotonic regression and recalibration with normalizing flows on the second time step on the dataset “electricity”. The legend contains the calibration error for each curve.
183
+
184
+ # 6.3 TIME SERIES
185
+
186
+ For our time series example, we trained a model on the UCI Dataset “electricity”. We predict two time steps and show that even though we used an autoregressive model for calibration (the model could learn correlated distributions), there is still some correlation not captured that recalibration can help with.
187
+
188
+ Figure 7a shows that the calibration error of $F ( Y _ { 2 } | Y _ { 1 } )$ when recalibrated independently with isotonic regression is significant. Figure 7b shows that a flow trained jointly on the CDFs significantly reduces the errors. Although the calibration error of the marginal distribution for the second step is comparable between the two approaches, the conditional performance favors normalizing flows. A possible explanantion of the still imperfect calibration of the flow model, though better than isotonic regression, is distribution shift.
189
+
190
+ # 7 CONCLUSION AND FUTURE WORK
191
+
192
+ In this paper, we addressed the calibration issue in modern neural networks through using higher capacity distributions via normalizing flows. We showed that normalizing flows can not only help during calibration, but also in recalibrating miscalibrated distributions, even improving the fit in the underfitting case. Though isotonic regression also uses a two-step producedure, we reframe the problem as MLE through which we can trivially generalize recalibration to the multivariate case. Though isotonic regression could be extended such that we could compute the log likelihood implied by its change of variables, normalizing flows are a more natural way to handle this with more research backing this technique, and are easily extendable to conditional and joint distributions. Interestingly, though the Conditional Flow has all it needs to be well calibrated, recalibration helps the overall calibration which was similarly found for classification in Guo et al. (2017); it remains for future work to better understand why and when this is useful.
193
+
194
+ Further, we extend the plot introduced in Kuleshov et al. (2018) by showing the calibration error on different subsets of the data, for example bucketed by mean prediction. Though this plot is able to show the calibration error across buckets, for future work, we will explore ways to visually show any trends in the miscalibration as well as whether the misalignments of the quantiles are statistically significant.
195
+
196
+ # REFERENCES
197
+
198
+ Nicola De Cao, Wilker Aziz, and Ivan Titov. Block neural autoregressive flow. In Conference on Uncertainty in Artificial Intelligence, volume 3, pp. 1723–1735. UAI, 2019. URL http: //auai.org/uai2019/proceedings/papers/511.pdf.
199
+
200
+ Ricky T. Q. Chen, Jens Behrmann, David K Duvenaud, and Joern-Henrik Jacobsen. Residual flows for invertible generative modeling. In H. Wallach, H. Larochelle, A. Beygelzimer, F. dAlch ´ e-´ Buc, E. Fox, and R. Garnett (eds.), Advances in Neural Information Processing Systems 32, pp. 9916–9926. Curran Associates, Inc., 2019. URL http://papers.nips.cc/paper/9183- residual-flows-for-invertible-generative-modeling.pdf.
201
+
202
+ Djork-Arne Clevert, Thomas Unterthiner, and Sepp Hochreiter. Fast and Accurate Deep Network ´ Learning by Exponential Linear Units (ELUs). arXiv e-prints, art. arXiv:1511.07289, November 2015.
203
+
204
+ Armen Der Kiureghian and Ove Ditlevsen. Aleatory or epistemic? does it matter? Structural safety, 31(2):105–112, 2009.
205
+
206
+ Dua Dheeru and Efi Karra Taniskidou. UCI machine learning repository, 2017. URL http: //archive.ics.uci.edu/ml.
207
+
208
+ Laurent Dinh, David Krueger, and Yoshua Bengio. NICE: Non-linear Independent Components Estimation. arXiv e-prints, art. arXiv:1410.8516, October 2014.
209
+
210
+ Laurent Dinh, Jascha Sohl-Dickstein, and Samy Bengio. Density estimation using Real NVP. arXiv e-prints, art. arXiv:1605.08803, May 2016.
211
+
212
+ Yarin Gal and Zoubin Ghahramani. Dropout as a bayesian approximation: Representing model uncertainty in deep learning. In Maria Florina Balcan and Kilian Q. Weinberger (eds.), Proceedings of The 33rd International Conference on Machine Learning, volume 48 of Proceedings of Machine Learning Research, pp. 1050–1059, New York, New York, USA, 20–22 Jun 2016. PMLR. URL http://proceedings.mlr.press/v48/gal16.html.
213
+
214
+ Achintya Gopal. Quasi-Autoregressive Residual (QuAR) Flows. arXiv e-prints, art. arXiv:2009.07419, September 2020.
215
+
216
+ Will Grathwohl, Ricky T. Q. Chen, Jesse Bettencourt, Ilya Sutskever, and David Duvenaud. FFJORD: Free-form Continuous Dynamics for Scalable Reversible Generative Models. arXiv e-prints, art. arXiv:1810.01367, October 2018.
217
+
218
+ Chuan Guo, Geoff Pleiss, Yu Sun, and Kilian Q. Weinberger. On calibration of modern neural networks. In Doina Precup and Yee Whye Teh (eds.), Proceedings of the 34th International Conference on Machine Learning, volume 70 of Proceedings of Machine Learning Research, pp. 1321–1330, International Convention Centre, Sydney, Australia, 06–11 Aug 2017. PMLR. URL http://proceedings.mlr.press/v70/guo17a.html.
219
+
220
+ Jonathan Ho, Xi Chen, Aravind Srinivas, Yan Duan, and Pieter Abbeel. Flow $^ { + + }$ : Improving flowbased generative models with variational dequantization and architecture design. In Kamalika Chaudhuri and Ruslan Salakhutdinov (eds.), Proceedings of the 36th International Conference on Machine Learning, volume 97 of Proceedings of Machine Learning Research, pp. 2722–2730, Long Beach, California, USA, 09–15 Jun 2019. PMLR. URL http://proceedings.mlr.press/ v97/ho19a.html.
221
+
222
+ Chin-Wei Huang, David Krueger, Alexandre Lacoste, and Aaron Courville. Neural autoregressive flows. 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. 2078–2087, Stockholmsmssan, Stockholm Sweden, 10–15 Jul 2018. PMLR. URL http://proceedings.mlr.press/v80/huang18d.html.
223
+
224
+ Guolin Ke, Qi Meng, Thomas Finley, Taifeng Wang, Wei Chen, Weidong Ma, Qiwei Ye, and Tie-Yan Liu. Lightgbm: A highly efficient gradient boosting decision tree. In
225
+
226
+ 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. 3146–3154. Curran Associates, Inc., 2017. URL http://papers.nips.cc/paper/6907-lightgbm-ahighly-efficient-gradient-boosting-decision-tree.pdf.
227
+
228
+ Alex Kendall and Yarin Gal. What uncertainties do we need in bayesian deep learning for computer vision? 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. 5574–5584. Curran Associates, Inc., 2017. URL http://papers.nips.cc/paper/7141-what-uncertainties-do-we-needin-bayesian-deep-learning-for-computer-vision.pdf.
229
+
230
+ Durk P Kingma and Prafulla Dhariwal. Glow: Generative flow with invertible 1x1 convolutions. In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi, and R. Garnett (eds.), Advances in Neural Information Processing Systems 31, pp. 10215–10224. Curran Associates, Inc., 2018. URL http://papers.nips.cc/paper/8224-glow-generative-flowwith-invertible-1x1-convolutions.pdf.
231
+
232
+ Durk P Kingma, Tim Salimans, Rafal Jozefowicz, Xi Chen, Ilya Sutskever, and Max Welling. Improved variational inference with inverse autoregressive flow. In D. D. Lee, M. Sugiyama, U. V. Luxburg, I. Guyon, and R. Garnett (eds.), Advances in Neural Information Processing Systems 29, pp. 4743–4751. Curran Associates, Inc., 2016. URL http://papers.nips.cc/paper/6581-improved-variationalinference-with-inverse-autoregressive-flow.pdf.
233
+
234
+ Volodymyr Kuleshov, Nathan Fenner, and Stefano Ermon. Accurate uncertainties for deep learning using calibrated regression. 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. 2796–2804, Stockholmsmssan, Stockholm Sweden, 10–15 Jul 2018. PMLR. URL http://proceedings.mlr.press/v80/kuleshov18a.html.
235
+
236
+ Balaji Lakshminarayanan, Alexander Pritzel, and Charles Blundell. Simple and scalable predictive uncertainty estimation using deep ensembles. 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. 6402–6413. Curran Associates, Inc., 2017. URL http://papers.nips.cc/paper/7219-simple-and-scalablepredictive-uncertainty-estimation-using-deep-ensembles.pdf.
237
+
238
+ David A Nix and Andreas S Weigend. Estimating the mean and variance of the target probability distribution. In Proceedings of 1994 ieee international conference on neural networks (ICNN’94), volume 1, pp. 55–60. IEEE, 1994.
239
+
240
+ George Papamakarios, Theo Pavlakou, and Iain Murray. Masked autoregressive flow for density estimation. 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. 2338–2347. Curran Associates, Inc., 2017. URL http://papers.nips.cc/paper/6828-maskedautoregressive-flow-for-density-estimation.pdf.
241
+
242
+ Tim Pearce, Alexandra Brintrup, Mohamed Zaki, and Andy Neely. High-quality prediction intervals for deep learning: A distribution-free, ensembled approach. volume 80 of Proceedings of Machine Learning Research, pp. 4075–4084, Stockholmsmssan, Stockholm Sweden, 10–15 Jul 2018. PMLR. URL http://proceedings.mlr.press/v80/pearce18a.html.
243
+
244
+ Boris Polyak and Anatoli Juditsky. Acceleration of stochastic approximation by averaging. SIAM Journal on Control and Optimization, 30:838–855, 07 1992. doi: 10.1137/0330046.
245
+
246
+ Danilo Rezende and Shakir Mohamed. Variational inference with normalizing flows. In Francis Bach and David Blei (eds.), Proceedings of the 32nd International Conference on Machine Learning, volume 37 of Proceedings of Machine Learning Research, pp. 1530–1538, Lille, France, 07–09 Jul 2015. PMLR. URL http://proceedings.mlr.press/v37/rezende15.html.
247
+
248
+ Filipe Rodrigues and Francisco C. Pereira. Beyond expectation: Deep joint mean and quantile regression for spatio-temporal problems. arXiv e-prints, art. arXiv:1808.08798, August 2018.
249
+
250
+ David Salinas, Valentin Flunkert, and Jan Gasthaus. DeepAR: Probabilistic Forecasting with Autoregressive Recurrent Networks. arXiv e-prints, art. arXiv:1704.04110, April 2017.
251
+
252
+ Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: A simple way to prevent neural networks from overfitting. Journal of Machine Learning Research, 15(56):1929–1958, 2014. URL http://jmlr.org/papers/v15/ srivastava14a.html.
253
+
254
+ Natasa Tagasovska and David Lopez-Paz. Single-model uncertainties for deep learning. In Advances in Neural Information Processing Systems 32, pp. 6417–6428. Curran Associates, Inc., 2019. URL http://papers.nips.cc/paper/8870-single-modeluncertainties-for-deep-learning.pdf.
255
+
256
+ Ichiro Takeuchi, Quoc V Le, Timothy D Sears, and Alexander J Smola. Nonparametric quantile estimation. Journal of Machine Learning Research, 7:1231–1264, 2006.
257
+
258
+ James W Taylor. A quantile regression neural network approach to estimating the conditional density of multiperiod returns. Journal of Forecasting, 19:299–311, 2000.
259
+
260
+ Michael E Tipping. Sparse bayesian learning and the relevance vector machine. Journal of machine learning research, 1(Jun):211–244, 2001.
261
+
262
+ Rianne van den Berg, Leonard Hasenclever, Jakub M. Tomczak, and Max Welling. Sylvester Normalizing Flows for Variational Inference. arXiv e-prints, art. arXiv:1803.05649, March 2018.
263
+
264
+ Ruofeng Wen, Kari Torkkola, Balakrishnan Narayanaswamy, and Dhruv Madeka. A Multi-Horizon Quantile Recurrent Forecaster. arXiv e-prints, art. arXiv:1711.11053, November 2017.
265
+
266
+ ![](images/c75db8aacd9d4a38c987062b87207c17d500f45fc7262577a8766d51b64af6c7.jpg)
267
+ Figure 8: In this figure, we show our conditional flow model. A neural network takes $X$ and outputs the scale and shift of an affine flow and a condition vector for QuAR Flows. The condition used in the QuAR Flow is the same for both $\mathrm { Q u A R }$ Flows. After the first conditional affine flow, there are two QuAR Flows with unconditional affine flows placed in between these two and at the end. The Conditional Flow model is equivalent to a Conditional Gaussian if we removed the QuAR Flows.
268
+
269
+ # A MODEL TRAINING DETAILS
270
+
271
+ # A.1 CALIBRATION
272
+
273
+ We compare the performance of our model and multiple other popular approaches on 8 UCI datasets (Dheeru & Karra Taniskidou, 2017): boston-housing, concrete, energy, kin8nm, naval-propulsionplant, power-plant, wine-quality-red and yacht. The models we compared Conditional Flows to were: Conditional Gaussian (amortized inference with Gaussians, Lakshminarayanan et al. (2017)), Bayesian Ridge Regression (Tipping, 2001), MC Dropout (Gal & Ghahramani, 2016), Simultaneous Quantile Regression (SQR) (Tagasovska & Lopez-Paz, 2019), Conditional Quantile (SQR where we only learn prespecified quantiles), Quality Driven (Pearce et al., 2018), and a Gradient Boosted Decision Tree with LightGBM (Ke et al., 2017).
274
+
275
+ Figure 8 shows a representation of the Conditional Flow network we used. The QuAR Flows are conditioned on a 64-dimensional representation from the condition network. Each Conditional QuAR Flow has two hidden layers in the residual connection with a hidden size 64 with ELU (Clevert et al., 2015) as our activation. The condition network has a single hidden layer with size 64 and ReLU as our activation. The QuAR Flows are conditioned on the 64-dimensional representation from the condition network.
276
+
277
+ For the other neural network approaches, we used networks with two hidden layers with size 128 and used ReLU as our nonlinearity. For hyperparameter tuning on all our neural networks, we searched the following grid:
278
+
279
+ • Learning rate: 1e-2, 1e-3, 1e-4
280
+ • Weight decay: 0, 1e-3, 1e-2, 1e-1
281
+ • Dropout Rates: 0.1 0.25, 0.5 0.75
282
+
283
+ The hyperparameters we used were taken from Tagasovska & Lopez-Paz (2019). We trained each of our neural networks for 2000 epochs with batch size 128.
284
+
285
+ For our LightGBM tree model (Ke et al., 2017), we used mean squared error as our loss to learn the mean of the output distribution. The grid of hyperparameters we searched was:
286
+
287
+ • Number of Trees: 100, 1000
288
+ • Maximum Depths: 3, 5, 7, 9
289
+ • Learning Rates: 1e-1, 1e-2, 1e-3, 1e-4
290
+ • Minimum Child Samples: 1, 20
291
+ • Dropout Rates: 0.1 0.25, 0.5 0.75
292
+
293
+ To make the tree model distributional, assuming homoscedasticity, we computed the standard deviation of the predicted normal distribution by computing the standard deviation of the residuals (observations minus predictions).
294
+
295
+ For SQR and MC Dropout, we computed the estimated mean and CDF from 1000 samples. For Conditional Flows, we computed the estimated mean by using the Gauss-Legendre quadrature with 100 points to approximate the integral.
296
+
297
+ # A.2 RECALIBRATION
298
+
299
+ For recalibration, we trained the recalibration model on the validation set of each of the 20 seeds. For the flow architecture, we stacked 8 QuAR Flows with affine flows in between each one as well as at the beginning and end. Since the input to the flow is a $\mathrm { C D F } \in [ 0 , 1 ]$ , we also transform the data with a Logit Function as the first layer of the flow and account for the change of variables in the loss. In addition to this, we used a dropout rate of 0.25, two hidden layers with size 64 in each residual connection, and used Polyak averaging (Polyak & Juditsky, 1992) with a decay of 0.999 for evaluation.
300
+
301
+ # A.3 TIME SERIES
302
+
303
+ For our time series experiments, we tested the performance of flow recalibration on the UCI dataset “electricity”. We filtered the data down to observations after 2014-01-01. We split the data by date, where the first $72 \%$ of dates are in the train set, the next $18 \%$ are in validation set, and the last $10 \%$ are in the test set.
304
+
305
+ The data is given in 15 minute increments, and so similarly to Deep AR (Salinas et al., 2017), we averaged the values per hour to have hourly data. Since we were trying to analyze the effect of correlated targets, we predicted two time steps conditioned on 48 hours of data using an autoregressive model.
306
+
307
+ We included three numeric covariates: the time step within the sampled time series, the hour of the day, and the day of the week. Each of the covariates were normalized to have zero mean and one standard deviation. In addition to this, since there are 370 different types of time series, we also added an embedding layer from 370 to an embedding dimension of 20, same as that used in Deep AR (Salinas et al., 2017). We concatenated this vector with the observations and covariates, leading to a 27-dimensional vector.
308
+
309
+ Since all the observations are positive, we model the target with a conditional Gamma distribution (i.e. amortized inference with Gamma distributiet al., 2017), we normalized each time series $\{ z _ { i , t } \} _ { t = 0 } ^ { T - 1 }$ of by $\begin{array} { r } { v _ { i } = 1 + 1 / T \sum _ { t = 0 } ^ { T - 1 } z _ { i , t } . } \end{array}$ eep AR (Salinas. We account for the scaling in the output distribution, i.e. Gamma $( k , \theta * v _ { i } )$ .
310
+
311
+ The model we used was a 1 layer LSTM, and then two linear layers with a ReLU and Dropout (Srivastava et al., 2014) in between were applied to the hidden representation. We set the dropout rate to 0.5 and used a hidden size of 48 everywhere. For evaluation, we used Polyak averaging (Polyak & Juditsky, 1992) with a decay of 0.999.
312
+
313
+ For recalibration with flows, we trained on the CDFs for both time steps with a flow with the same architecture as that used in Appendix A.2.
314
+
315
+ # B EXPERIMENTAL RESULTS
316
+
317
+ # B.1 CALIBRATION
318
+
319
+ In Table 2, we compare Conditional Flows against multiple other approaches for estimating uncertainty, and we measure performance using Prediction Interval Coverage Probability (PICP), Mean Squared Error (MSE), and Calibration Error.
320
+
321
+ For each model, we trained the model on 20 different seeds where each seed randomly splits the data in $72 \%$ train, $18 \%$ validation, and $10 \%$ test. We picked the best hyperparameter by choosing the hyperparameters that gave the best average validation loss across the 20 seeds where the loss used is the loss defined by the training procedure for the model, e.g. for Conditional Gaussian, we used log likelihood; for LightGBM, we used MSE; for QualityDriven, we used the Quality Driven Loss, etc.
322
+
323
+ Table 2: Results on percentage of data captured from 0.025 to 0.975 quantiles (PICP), MSE, and calibration error with 100 buckets. The results are from minimizing the average validation loss across 20 seeds. The optimal value of PICP is 0.95, and the optimal value for MSE and Calib is 0.00.
324
+
325
+ <table><tr><td></td><td colspan="3">bostonHousing</td><td colspan="3">concrete</td></tr><tr><td></td><td>PICP</td><td>MSE</td><td>Calib</td><td>PICP</td><td>MSE</td><td>Calib</td></tr><tr><td>ConditionalFlow</td><td>0.93 ± 0.04</td><td>0.13 ± 0.06</td><td>0.06</td><td>0.92 ± 0.03</td><td>0.09 ±0.03</td><td>0.01</td></tr><tr><td>ConditionalGaussian</td><td>0.93 ± 0.03</td><td>0.14±0.07</td><td>0.13</td><td>0.91 ± 0.02</td><td>0.09 ±0.03</td><td>0.06</td></tr><tr><td>BayesianRidgeRegression</td><td>0.95 ± 0.03</td><td>0.28±0.08</td><td>0.34</td><td>0.95 ± 0.03</td><td>0.40±0.07</td><td>0.01</td></tr><tr><td>MC Dropout</td><td>0.50 ± 0.08</td><td>0.11 ± 0.05</td><td>2.99</td><td>0.69 ± 0.05</td><td>0.07±0.03</td><td>0.89</td></tr><tr><td>SQR</td><td>0.73 ± 0.08</td><td>0.11 ± 0.05</td><td>0.48</td><td>0.74± 0.04</td><td>0.07± 0.03</td><td>0.47</td></tr><tr><td>ConditionalQuantile</td><td>0.92 ± 0.05</td><td>N.A.</td><td>N.A.</td><td>0.93 ± 0.03</td><td>N.A.</td><td>N.A.</td></tr><tr><td>QualityDriven</td><td>0.83 ± 0.06</td><td>N.A.</td><td>N.A.</td><td>0.83± 0.04</td><td>N.A.</td><td>N.A.</td></tr><tr><td>LightGBM</td><td>0.04±0.03</td><td>0.12 ± 0.06</td><td>7.74</td><td>0.63±0.07</td><td>0.07±0.02</td><td>1.25</td></tr><tr><td></td><td colspan="3">energy</td><td colspan="3">kin8nm</td></tr><tr><td></td><td>PICP</td><td>MSE</td><td>Calib</td><td>PICP</td><td>MSE</td><td>Calib</td></tr><tr><td>ConditionalFlow</td><td>0.96 ± 0.02</td><td>0.0022 ± 0.0006</td><td>0.12</td><td>0.952 ± 0.006</td><td>0.081 ± 0.013</td><td>0.01</td></tr><tr><td>ConditionalGaussian</td><td>0.97 ± 0.03</td><td>0.0030± 0.0009</td><td>0.26</td><td>0.947 ± 0.007</td><td>0.071 ± 0.005</td><td>&lt;0.01</td></tr><tr><td>BayesianRidgeRegression</td><td>0.89 ± 0.04</td><td>0.09 ±0.02</td><td>0.24</td><td>0.951 ± 0.007</td><td>0.59 ± 0.02</td><td>0.09</td></tr><tr><td>MC Dropout</td><td>0.97± 0.02</td><td>0.0026 ± 0.0010</td><td>0.17</td><td>0.69 ± 0.02</td><td>0.069 ± 0.005</td><td>1.14</td></tr><tr><td>SQR</td><td>0.97± 0.02</td><td>0.0028 ± 0.0012</td><td>0.37</td><td>0.892 ± 0.010</td><td>0.072 ± 0.005</td><td>0.01</td></tr><tr><td>ConditionalQuantile</td><td>0.98 ±0.02</td><td>N.A.</td><td>N.A.</td><td>0.943 ± 0.011</td><td>N.A.</td><td>N.A.</td></tr><tr><td>QualityDriven</td><td>0.96 ± 0.04</td><td>N.A.</td><td>N.A.</td><td>0.88±0.02</td><td>N.A.</td><td>N.A.</td></tr><tr><td>LightGBM</td><td>0.24±0.05</td><td>0.0013 ± 0.0006</td><td>5.18</td><td>0.205 ± 0.010</td><td>0.190 ± 0.011</td><td>5.59</td></tr><tr><td></td><td colspan="3">naval-propulsion-plant</td><td colspan="3">power-plant</td></tr><tr><td></td><td>PICP</td><td>MSE</td><td>Calib</td><td>PICP</td><td>MSE</td><td>Calib</td></tr><tr><td>ConditionalFlow</td><td>0.98 ± 0.03</td><td>0.009 ±0.004</td><td>0.45</td><td>0.952 ± 0.007</td><td>0.048 ±0.007</td><td>0.01</td></tr><tr><td>ConditionalGaussian</td><td>0.9995 ± 0.0007</td><td>0.012 ± 0.006</td><td>2.35</td><td>0.947 ± 0.010</td><td>0.048 ±0.006</td><td>&lt;0.01</td></tr><tr><td>BayesianRidgeRegression</td><td>1.0 ±0.0</td><td>0.055 ± 0.004</td><td>8.03</td><td>0.964 ± 0.007</td><td>0.072 ± 0.007</td><td>0.01</td></tr><tr><td>MC Dropout</td><td>0.98 ±0.02</td><td>0.005±0.002</td><td>0.51</td><td>0.59 ±0.02</td><td>0.046±0.007</td><td>1.88</td></tr><tr><td>SQR</td><td>0.998 ± 0.002</td><td>0.0052 ± 0.0012</td><td>1.44</td><td>0.93 ± 0.02</td><td>0.048 ±0.007</td><td>0.02</td></tr><tr><td>ConditionalQuantile</td><td>0.97±0.02</td><td>N.A.</td><td>N.A.</td><td>0.937 ± 0.014</td><td>N.A.</td><td>N.A.</td></tr><tr><td>QualityDriven</td><td>0.949 ± 0.010</td><td>N.A.</td><td>N.A.</td><td>0.89 ±0.02</td><td>N.A.</td><td>N.A.</td></tr><tr><td>LightGBM</td><td>0.714 ± 0.011</td><td>0.0056 ± 0.0009</td><td>0.79</td><td>0.17 ± 0.02</td><td>0.035 ± 0.007</td><td>5.95</td></tr><tr><td></td><td colspan="3">wine-quality-red</td><td colspan="3">yacht</td></tr><tr><td></td><td>PICP</td><td>MSE</td><td>Calib</td><td>PICP</td><td>MSE</td><td>Calib</td></tr><tr><td>ConditionalFlow</td><td>0.90 ±0.02</td><td>0.6±0.2</td><td>0.04</td><td>0.95 ± 0.04</td><td>0.004��0.003</td><td>0.27</td></tr><tr><td>ConditionalGaussian</td><td>0.95 ± 0.02</td><td>0.59 ± 0.09</td><td>0.22</td><td>0.99 ±0.02</td><td>0.004±0.002</td><td>0.62</td></tr><tr><td>BayesianRidgeRegression</td><td>0.95 ± 0.02</td><td>0.63 ± 0.11</td><td>0.05</td><td>0.94± 0.03</td><td>0.35 ± 0.10</td><td>0.25</td></tr><tr><td>MC Dropout</td><td>0.35 ± 0.04</td><td>0.57 ±0.09</td><td>4.01</td><td>0.97 ± 0.04</td><td>0.004±0.002</td><td>0.21</td></tr><tr><td>SQR</td><td>0.81±0.09</td><td>0.59 ±0.10</td><td>0.15</td><td>0.96 ±0.04</td><td>0.004±0.004</td><td>0.49</td></tr><tr><td>ConditionalQuantile</td><td>0.95 ± 0.02</td><td>N.A.</td><td>N.A.</td><td>0.99 ± 0.02</td><td>N.A.</td><td>N.A.</td></tr><tr><td>QualityDriven</td><td>0.84 ±0.03</td><td>N.A.</td><td>N.A.</td><td>0.97 ± 0.04</td><td>N.A.</td><td>N.A.</td></tr><tr><td>LightGBM</td><td>0.40 ± 0.05</td><td>0.55± 0.10</td><td>2.93</td><td>0.45 ± 0.08</td><td>0.003±0.003</td><td>3.04</td></tr></table>
326
+
327
+ Table 3: Calibration error (with 100 buckets) before and after recalibration.
328
+
329
+ <table><tr><td></td><td colspan="3">BayesianRidgeRegression</td><td colspan="3">ConditionalGaussian</td><td colspan="3">ConditionalFlow</td></tr><tr><td></td><td>Before</td><td>Flow</td><td>Iso</td><td>Before</td><td>Flow</td><td>Iso</td><td>Before</td><td>Flow</td><td>Iso</td></tr><tr><td>bostonHousing</td><td>0.34</td><td>0.02</td><td>0.02</td><td>0.13</td><td>0.04</td><td>0.02</td><td>0.06</td><td>0.02</td><td>0.01</td></tr><tr><td>concrete</td><td>0.01</td><td>0.01</td><td>0.01</td><td>0.06</td><td>0.02</td><td>0.02</td><td>0.01</td><td>0.02</td><td>0.03</td></tr><tr><td>energy</td><td>0.24</td><td>0.02</td><td>0.01</td><td>0.26</td><td>&lt;0.01</td><td>0.01</td><td>0.12</td><td>0.01</td><td>0.01</td></tr><tr><td>kin8nm</td><td>0.09</td><td>0.01</td><td>&lt;0.01</td><td>&lt;0.01</td><td>&lt;0.01</td><td>&lt;0.01</td><td>0.01</td><td>&lt;0.01</td><td>&lt;0.01</td></tr><tr><td>naval-propulsion-plant</td><td>8.03</td><td>0.01</td><td>&lt;0.01</td><td>2.35</td><td>&lt;0.01</td><td>&lt;0.01</td><td>0.45</td><td>&lt;0.01</td><td>&lt;0.01</td></tr><tr><td>power-plant</td><td>0.01</td><td>&lt;0.01</td><td>&lt;0.01</td><td>&lt;0.01</td><td>&lt;0.01</td><td>&lt;0.01</td><td>0.01</td><td>&lt;0.01</td><td>&lt;0.01</td></tr><tr><td>wine-quality-red</td><td>0.05</td><td>0.02</td><td>&lt;0.01</td><td>0.22</td><td>0.04</td><td>0.02</td><td>0.04</td><td>0.01</td><td>0.01</td></tr><tr><td>yacht</td><td>0.25</td><td>0.05</td><td>0.07</td><td>0.62</td><td>0.03</td><td>0.03</td><td>0.27</td><td>0.02</td><td>0.03</td></tr></table>
330
+
331
+ Table 4: MSE performance before and after recalibration. We do not show the MSE for isotonic regression as the mean cannot be computed after recalibrating with isotonic regression.
332
+
333
+ <table><tr><td rowspan="3"></td><td colspan="2">BayesianRidgeRegression</td><td colspan="2">ConditionalGaussian</td></tr><tr><td>Before</td><td>Flow</td><td>Before</td><td>Flow</td></tr><tr><td>bostonHousing</td><td>0.28 ±0.08</td><td>0.28 ±0.08</td><td>0.14 ± 0.07</td><td>0.14 ± 0.07</td></tr><tr><td>concrete</td><td>0.40 ± 0.07</td><td>0.40 ± 0.07</td><td>0.09 ±0.03</td><td>0.09 ± 0.03</td></tr><tr><td>energy</td><td>0.09 ±0.02</td><td>0.09 ±0.02</td><td>0.0030 ±0.0009</td><td>0.0032 ± 0.0011</td></tr><tr><td>kin8nm</td><td>0.59 ± 0.02</td><td>0.59 ± 0.02</td><td>0.071 ± 0.005</td><td>0.072 ± 0.005</td></tr><tr><td>naval-propulsion-plant</td><td>0.055 ± 0.004</td><td>0.48 ±0.02</td><td>0.012 ± 0.006</td><td>0.012 ± 0.007</td></tr><tr><td>power-plant</td><td>0.072 ± 0.007</td><td>0.072 ± 0.007</td><td>0.048 ± 0.006</td><td>0.049 ± 0.006</td></tr><tr><td>wine-quality-red</td><td>0.63 ± 0.11</td><td>0.63 ± 0.11</td><td>0.59 ± 0.09</td><td>0.59 ± 0.10</td></tr><tr><td>yacht</td><td>0.35 ± 0.10</td><td>0.36 ± 0.10</td><td>0.004 ±0.002</td><td>0.004 ± 0.003</td></tr><tr><td colspan="2"></td><td colspan="2">ConditionalFlow</td><td></td></tr><tr><td rowspan="10"></td><td></td><td>Before</td><td>Flow</td><td></td></tr><tr><td>bostonHousing</td><td>0.13 ± 0.06</td><td></td><td></td></tr><tr><td>concrete</td><td>0.09 ± 0.03</td><td>0.13 ± 0.06 0.09 ± 0.03</td><td></td></tr><tr><td></td><td>0.0022 ± 0.0006</td><td>0.0027 ± 0.0007</td><td></td></tr><tr><td>energy kin8nm</td><td>0.081 ± 0.013</td><td>0.081 ± 0.013</td><td></td></tr><tr><td>naval-propulsion-plant</td><td>0.009 ± 0.004</td><td>0.016 ± 0.012</td><td></td></tr><tr><td>power-plant</td><td>0.048 ± 0.007</td><td>0.048 ± 0.007</td><td></td></tr><tr><td>wine-quality-red</td><td>0.6± 0.2</td><td>0.64 ± 0.15</td><td></td></tr><tr><td>yacht</td><td></td><td></td><td></td></tr><tr><td></td><td>0.004 ± 0.003</td><td>0.008 ± 0.012</td><td></td></tr></table>
334
+
335
+ Reported in Table 2 are the mean and standard deviation of PICP and MSE across the 20 seeds. Due to the limited data, for calibration error with 100 bins, we computed it over the CDFs from all 20 seeds. We included PICP (the percentage of true observations between the quantiles 0.025 and 0.975) to compare against alternative approaches where we prespecify which quantiles we need.
336
+
337
+ # B.2 RECALIBRATION
338
+
339
+ From the above section, we recalibrate the best Bayesian Ridge Regression, Conditional Gaussian, and Conditional Flow. In Table 3, we compare the calibration error before recalibration, after recalibration with isotonic regression, and after recalibration with normalizing flows.
340
+
341
+ As we can see, across all 8 UCI datasets, the calibration errors after recalibrating with normalizing flows are comparable to those from isotonic regression. More interestingly though, improvement in calibration error can be detrimental to mean performance.
md/train/HCSgyPUfeDj/HCSgyPUfeDj.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/HHiiQKWsOcV/HHiiQKWsOcV.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/HJ0NvFzxl/HJ0NvFzxl.md ADDED
@@ -0,0 +1,422 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LEARNING GRAPHICAL STATE TRANSITIONS
2
+
3
+ Daniel D. Johnson
4
+ Department of Computer Science
5
+ Harvey Mudd College
6
+ 301 Platt Boulevard
7
+ ddjohnson@hmc.edu
8
+
9
+ # ABSTRACT
10
+
11
+ Graph-structured data is important in modeling relationships between multiple entities, and can be used to represent states of the world as well as many data structures. Li et al. (2016) describe a model known as a Gated Graph Sequence Neural Network (GGS-NN) that produces sequences from graph-structured input. In this work I introduce the Gated Graph Transformer Neural Network (GGTNN), an extension of GGS-NNs that uses graph-structured data as an intermediate representation. The model can learn to construct and modify graphs in sophisticated ways based on textual input, and also to use the graphs to produce a variety of outputs. For example, the model successfully learns to solve almost all of the bAbI tasks (Weston et al., 2016), and also discovers the rules governing graphical formulations of a simple cellular automaton and a family of Turing machines.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ Many different types of data can be formulated using a graph structure. One form of data that lends itself to a graphical representation is data involving relationships (edges) between entities (nodes). Abstract maps of places and paths between them also have a natural graph representation, where places are nodes and paths are edges. In addition, many data structures can be expressed in graphical form, including linked lists and binary trees.
16
+
17
+ Substantial research has been done on producing output when given graph-structured input (Kashima et al., 2003; Shervashidze et al., 2011; Perozzi et al., 2014; Bruna et al., 2013; Duvenaud et al., 2015). Of particular relevance to this work are Graph Neural Networks (Gori et al., 2005; Scarselli et al., 2009), or GNNs, which extend recursive neural networks by assigning states to each node in a graph based on the states of adjacent nodes. Recently Li et al. (2016) have modified GNNs to use gated state updates and to produce output sequences. The resulting networks, called GG-NNs and GGS-NNs, are successful at solving a variety of tasks with graph-structured input.
18
+
19
+ The current work further builds upon GG-NNs and GGS-NNs by allowing graph-structured intermediate representations, as well as graph-structured outputs. This is accomplished using a more flexible graph definition, along with a set of graph transformations which take a graph and other information as input and produce a modified version of the graph. This work also introduces the Gated Graph Transformer Neural Network model (GGT-NN), which combines these transformations with a recurrent input model to incrementally construct a graph given natural language input, and can either produce a final graph representing its current state, or use the graph to produce a natural language output.
20
+
21
+ Extending GG-NNs in this way opens up a wide variety of applications. Since many types of data can be naturally expressed as a graph, it is possible to train a GGT-NN model to manipulate a meaningful graphical internal state. In this paper I demonstrate the GGT-NN model on the bAbI task dataset, which contains a set of stories about the state of the world. By encoding this state as a graph and providing these graphs to the model at training time, a GGT-NN model can be trained to construct the correct graph from the input sentences and then answer questions based on this internal graph. I also demonstrate that this architecture can learn complex update rules by training it to model a simple 1D cellular automaton and arbitrary 4-state Turing machines. This requires the network to learn how to transform its internal state based on the rules of each task.
22
+
23
+ ![](images/ef5cd43c594e7ef31036550081983820b4a1577a09156a006285b8662ff24e07.jpg)
24
+ Figure 1: Diagram of the differentiable encoding of a graphical structure, as described in section 3. On the left, the desired graph we wish to represent, in which there are 6 node types (shown as blue, purple, red, orange, green, and yellow) and two edge types (shown as blue/solid and red/dashed). Node 3 and the edge between nodes 6 and 7 have a low strength. On the right, depictions of the node and edge matrices: annotations, strengths, state, and connectivity correspond to $\mathbf { x } _ { v }$ , $s _ { v }$ , $\mathbf { h } _ { v }$ , and $\mathcal { C }$ , respectively. Saturation represents the value in each cell, where white represents 0, and fully saturated represents 1. Note that each node’s annotation only has a single nonzero entry, corresponding to each node having a single well-defined type, with the exception of node 3, which has an annotation that does not correspond to a single type. State vectors are shaded arbitrarily to indicate that they can store network-determined data. The edge connectivity matrix $\mathcal { C }$ is three dimensional, indicated by stacking the blue-edge cell on top of the red-edge cell for a given sourcedestination pair. Also notice the low strength for cell 3 in the strength vector and for the edge between node 6 and node 7 in the connectivity matrix.
25
+
26
+ # 2 BACKGROUND
27
+
28
+ # 2.1 GRU
29
+
30
+ Gated Recurrent Units (GRU) are a type of recurrent network cell introduced by Cho et al. (2014). Each unit uses a reset gate $r$ and an update gate $z$ , and updates according to
31
+
32
+ $$
33
+ \begin{array} { r l r l } & { \mathbf { r } ^ { ( t ) } = \sigma \left( \mathbf { W } _ { r } \mathbf { x } ^ { ( t ) } + \mathbf { U } _ { r } \mathbf { h } ^ { ( t - 1 ) } + \mathbf { b } _ { r } \right) \quad } & & { \mathbf { z } ^ { ( t ) } = \sigma \left( \mathbf { W } _ { z } \mathbf { x } ^ { ( t ) } + \mathbf { U } _ { z } \mathbf { h } ^ { ( t - 1 ) } + \mathbf { b } _ { z } \right) } \\ & { \widetilde { \mathbf { h } } ^ { ( t ) } = \phi \left( \mathbf { W } \mathbf { x } + \mathbf { U } \left( \mathbf { r } ^ { ( t ) } \odot \mathbf { h } ^ { ( t - 1 ) } \right) + \mathbf { b } \right) \quad } & & { \mathbf { h } ^ { ( t ) } = \mathbf { z } \odot \mathbf { h } ^ { ( t - 1 ) } + \left( 1 - \mathbf { z } \right) \odot \widetilde { \mathbf { h } } ^ { ( t ) } } \end{array}
34
+ $$
35
+
36
+ where $\sigma$ is the logistic sigmoid function, $\phi$ is an activation function (here tanh is used), $\mathbf { x } ^ { ( t ) }$ is the input vector at timestep $t$ , $\mathbf { h } ^ { ( t ) }$ is the hidden output vector at timestep $t$ , and ${ \bf W } , { \bf U } , { \bf W } _ { r } , { \bf U } _ { r } , { \bf W } _ { z }$ , $\mathbf { U } _ { z }$ , b, ${ \bf b } _ { r }$ and $\mathbf { b } _ { z }$ are learned weights and biases. Note that $\odot$ denotes elementwise multiplication.
37
+
38
+ # 2.2 GG-NN AND GGS-NN
39
+
40
+ The Gated Graph Neural Network (GG-NN) is a form of graphical neural network model described by Li et al. (2016). In a GG-NN, a graph $\mathcal { G } = ( \nu , \mathcal { E } )$ consists of a set $V$ of nodes $v$ with unique values and a set $\mathcal { E }$ of directed edges $e = ( v , v ^ { \prime } ) \in \mathcal { V } \times \mathcal { V }$ oriented from $v$ to $v ^ { \prime }$ . Each node has an annotation $\mathbf { x } _ { v } \in \mathbb { R } ^ { N }$ and a hidden state $\mathbf { h } _ { v } \in \mathbb { R } ^ { D }$ , and each edge has a type $y _ { e } \in \{ 1 , \cdots , M \}$ .
41
+
42
+ GG-NNs operate by first initializing the state $\mathbf { h } _ { v }$ of each node to correspond to the annotation $\mathbf { x } _ { v }$ . Then, a series of propagation steps occur. In each step, information is transferred between nodes across the edges, and the types of edge determine what information is sent. Each node sums the input it receives from all adjacent nodes, and uses that to update its own internal state, in the same manner as a GRU cell. Finally, the states of all nodes are used either to create a graph-level aggregate output, or to classify each individual node.
43
+
44
+ GGS-NNs extend GG-NNs by performing a large number of propagation-output cycles. At each stage, two versions of the GG-NN propagation process are run. The first is used to predict an output for that timestep, and the second is used to update the annotations of the nodes for the next timestep. This allows GGS-NNs to predict a sequence of outputs from a single graph.
45
+
46
+ ![](images/7d21775c1c752781426ffcd20b664960dc69107bea3e632b40212f682b3ee84f.jpg)
47
+ Figure 2: Summary of the graph transformations. Input and output are represented as gray squares. a) Node addition $( \mathcal { T } _ { \mathrm { a d d } } )$ , where the input is used by a recurrent network (white box) to produce new nodes, of varying annotations and strengths. b) Node state update $( \mathcal { T } _ { \mathbf { h } } )$ , where each node receives input (dashed line) and updates its internal state. c) Edge update $( \mathcal { T } _ { \mathcal { C } } )$ , where each existing edge (colored) and potential edge (dashed) is added or removed according to the input and states of the adjacent nodes (depicted as solid arrows meeting at circles on each edge). d) Propagation $( \mathcal { T } _ { \mathrm { p r o p } } )$ , where nodes exchange information along the current edges, and update their states. e) Aggregation $( \mathcal { T } _ { \mathrm { r e p r } } )$ , where a single representation is created using an attention mechanism, by summing information from all nodes weighted by relevance (with weights shown by saturation of arrows).
48
+
49
+ # 3 DIFFERENTIABLE GRAPH TRANSFORMATIONS
50
+
51
+ In this section, I describe some modifications to the graph structure to make it fully differentiable, and then propose a set of transformations which can be applied to a graph structure in order to transform it. In particular, I redefine a graph $\mathcal { G } = ( \nu , \mathcal { C } ) \in \Gamma$ as a set $V$ of nodes $v$ , and a connectivity matrix $\mathcal { C } \in \mathbb { R } ^ { | \mathcal { V } | \times | \mathcal { V } | \times Y }$ , where $Y$ is the number of possible edge types. As before, each node has an annotation $\mathbf { x } _ { v } \in \mathbb { R } ^ { N }$ and a hidden state $\mathbf { h } _ { v } \in \mathbb { R } ^ { D }$ . However, there is an additional constraint that $\textstyle \sum _ { j = 1 } ^ { N } x _ { v , j } = 1$ . One can then interpret $x _ { v , j }$ as the level of belief that $v$ should have type $j$ out of $N$ possible node types. Each node also has a strength $s _ { v } \in [ 0 , 1 ]$ . This represents the level of belief that node $v$ should exist, where $s _ { v } = 1$ means the node exists, and $s _ { v } = 0$ indicates that the node should not exist and thus should be ignored.
52
+
53
+ Similarly, elements of $\mathcal { C }$ are constrained to the range $[ 0 , 1 ]$ , and thus one can interpret $\mathcal { C } _ { v , v ^ { \prime } , y }$ as the level of belief that there should be a directed edge of type $y$ from $v$ to $v ^ { \prime }$ . (Note that it is possible for there to be edges of multiple types between the same two nodes $v$ and $v ^ { \prime }$ , i.e. it is possible for $\mathcal { C } _ { v , v ^ { \prime } , y } = \mathcal { C } _ { v , v ^ { \prime } , y ^ { \prime } } = 1$ where $y \ne y ^ { \prime }$ .) Figure 1 shows the values of $\mathbf { x } _ { v }$ , $s _ { v }$ , $\mathbf { h } _ { v }$ , and $\mathcal { C }$ corresponding to a particular graphical structure.
54
+
55
+ There are five classes of graph transformation:
56
+
57
+ a) Node addition $( \mathcal { T } _ { \mathrm { a d d } } )$ , which modifies a graph by adding new nodes and assigning them annotations $\mathbf { x } _ { v }$ and strengths $s _ { v }$ based on an input vector.
58
+ b) Node state update $( \mathcal { T } _ { \mathbf { h } } )$ , which modifies the internal state of each node using an input vector (similar to a GRU update step). Optionally, different input can be given to nodes of each type, based on direct textual references to specific node types. This version is called a direct reference update $( \mathcal { T } _ { \mathbf { h } , \mathrm { d i r e c t } } )$ .
59
+ c) Edge update $( \mathcal { T } _ { \mathcal { C } } )$ , which modifies the edges between each pair of nodes based on the internal states of the two nodes and an external input vector.
60
+ d) Propagation $( \mathcal { T } _ { \mathrm { p r o p } } )$ , which allows nodes to trade information across the existing edges and then update their internal states based on the information received.
61
+ e) Aggregation $( \mathcal { T } _ { \mathrm { r e p r } } )$ , which uses an attention mechanism to select relevant nodes and then generates a graph-level output.
62
+
63
+ Each transformation has its own trainable parameters. Together, these transformations can be combined to process a graph in complex ways. An overview of these operations is shown in Figure 2. For details about the implementation of each of these transformations, see Appendix B.
64
+
65
+ # 4 GATED GRAPH TRANSFORMER NEURAL NETWORK (GGT-NN)
66
+
67
+ In this section I introduce the Gated Graph Transformer Neural Network (GGT-NN), which is constructed by combining a series of these transformations. Depending on the configuration of the transformations, a GGT-NN can take textual or graph-structured input, and produce textual or graphstructured output. Here I describe one particular GGT-NN configuration, designed to build and modify a graph based on a sequence of input sentences, and then produce an answer to a query.
68
+
69
+ <table><tr><td colspan="3">Algorithm1 Graph Transformation Pseudocode</td></tr><tr><td colspan="2">1:g↑α</td><td>11: G←Tada(G,[i(k) hgd])</td></tr><tr><td colspan="2">2:for k from 1 to K do</td><td>12: 9←Te(g,i(𝑘)</td></tr><tr><td>3:</td><td>9 ←Th(g,i(k))</td><td>13:end for</td></tr><tr><td>4:</td><td>if direct reference enabled then</td><td>14: 9 ← Tuery(G,iquery)</td></tr><tr><td>5:</td><td>9 ← Th,direct(G,D(𝑘))</td><td>15:if direct reference enabled then</td></tr><tr><td>6:</td><td>end if</td><td></td></tr><tr><td>7:</td><td>if intermediate propagation enabled then</td><td>17:end if</td></tr><tr><td>8:</td><td>9 ← Tprop(S)</td><td>18:9←T(G))</td></tr><tr><td>9:</td><td>end if</td><td>19: hswer ←Trper(G))</td></tr><tr><td>10:</td><td>hgd ←Trepr(9)</td><td>20: return foutput(hanswer)</td></tr></table>
70
+
71
+ When run, the model performs the following: For each sentence $k$ , each word is converted to a one-hot vector $\mathbf { w } _ { l } ^ { ( k ) }$ , and the sequence of words (of length $L$ ) is passed through a GRU layer to produce a sequence of partial-sentence representation vectors ${ \bf p } _ { l } ^ { ( k ) }$ . The full sentence representation vector $\mathbf { i } ^ { ( k ) }$ is initialized to the last partial representation vector $\mathbf { p } _ { L } ^ { ( k ) }$ . Furthermore, a direct-reference input matrix $\mathbf { D } ^ { ( k ) }$ is set to the sum of partial representation vectors corresponding to the words that directly reference a node type, .e. $\begin{array} { r } { \mathbf { D } _ { n } ^ { ( k ) } = \sum _ { l \in R _ { n } } \mathbf { p } _ { l } ^ { ( k ) } } \end{array}$ where $R _ { n }$ is the set of words in sentence $k$ $n$ . This acts like an attention mechanism, by accumulating the partial representation vectors for the words that directly reference each type, and masking out the vectors corresponding to other words.
72
+
73
+ Next, a series of graph transformations are applied, as depicted in Algorithm 1. Depending on the task, direct reference updates and per-sentence propagation can be enabled or disabled. The output function $f _ { \mathrm { o u t p u t } }$ will depend on the specific type of answer desired. If the answer is a single word, $f _ { \mathrm { o u t p u t } }$ can be a multilayer perceptron followed by a softmax operation. If the answer is a sequence of words, $f _ { \mathrm { o u t p u t } }$ can use a recurrent network (such as a GRU) to produce a sequence of outputs. Note that transformations with different superscripts $\mathcal { T } _ { \mathbf { h } }$ and $\mathcal { T } _ { \mathbf { h } } ^ { \mathrm { q u e r y } }$ , for instance) refer to similar transformations with different learned weights.
74
+
75
+ Since the processing of the input and all of the graph transformations are differentiable, at this point the network output can be compared with the correct output for that query and used to update the network parameters, including both the GRU parameters used when processing the input and the internal weights associated with each transformation.
76
+
77
+ # 4.1 SUPERVISION
78
+
79
+ As with many supervised models, one can evaluate the loss based on the likelihood of producing an incorrect answer, and then minimize the loss by backpropagation. However, based on initial experiments, the model appeared to require additional supervision to extract meaningful graphstructured data. To provide this additional supervision, I found it beneficial to provide the correct graph at each timestep and train the network to produce that graph. This occurs in two stages, first when new nodes are proposed, and then when edges are adjusted. For the edge adjustment, the edge loss between a correct edge matrix $\mathcal { C } ^ { * }$ and the computed edge matrix $\mathcal { C }$ is given by
80
+
81
+ $$
82
+ { \mathcal { L } } _ { \mathrm { e d g e } } = - { \mathcal { C } } ^ { * } \cdot \ln ( { \mathcal { C } } ) - ( 1 - { \mathcal { C } } ^ { * } ) \cdot \ln ( 1 - { \mathcal { C } } ) .
83
+ $$
84
+
85
+ The node adjustment is slightly more complex. Multiple nodes are added in each timestep, but the order of those nodes is arbitrary, and only their existence is important. Thus it should be possible for the network to determine the optimal ordering of the nodes. In fact, this is important because there is no guarantee that the nodes will be ordered consistently in the training data.
86
+
87
+ Vinyals et al. (2016) demonstrate a simple method for training a network to output unordered sets: the network produces a sequence of outputs, and these outputs are compared with the closest ordering of the training data, i.e., the ordering of the training data which would produce the smallest loss when compared with the network output. Vinyals et al. show that when using this method, the network arbitrarily chooses an ordering which may not be the optimal ordering for the task. However, in this case any ordering should be sufficient, and I found the arbitrary orderings selected in this way to work well in practice. In particular, letting s∗π(v) and $\mathbf { x } _ { \pi ( v ) } ^ { * }$ denote the correct strength and annotations of node $v$ under ordering $\pi$ , the loss becomes
88
+
89
+ $$
90
+ \mathcal { L } _ { \mathrm { n o d e } } = - \operatorname* { m a x } _ { \pi } \sum _ { v = | \mathcal { V } _ { \mathrm { o d d } } | + 1 } ^ { | \mathcal { V } _ { \mathrm { n e v } } | } s _ { \pi ( v ) } ^ { * } \ln ( s _ { v } ) + ( 1 - s _ { \pi ( v ) } ^ { * } ) \ln ( 1 - s _ { v } ) + \mathbf { x } _ { \pi ( v ) } ^ { * } \cdot \ln ( \mathbf { x } _ { v } ) .
91
+ $$
92
+
93
+ At this point the correct values C∗, s∗π(v) a nd $\mathbf { x } _ { \pi ( v ) } ^ { * }$ are substituted into the graph for further processing. Note that only the edges and the new nodes are replaced by the supervision. The hidden states of all existing nodes are propagated without adjustment.
94
+
95
+ # 4.2 OTHER TRANSFORMATION CONFIGURATIONS
96
+
97
+ The structure described in Algorithm 1 is designed for question-answering tasks. However, due to the composability of the individual graph transformations, other configurations could be used to solve other tasks that operate on structured data.
98
+
99
+ For instance, if a task consists of tracking relationships between a fixed set of objects, one could construct a version of the model that does not use the new-nodes transformation $( \mathcal { T } _ { \mathrm { a d d } } )$ , but instead only modifies edges. If the task was to extract information from an existing graph, a structure similar to the GGS-NNs could be built by using only the propagation and aggregation transformations. If the task was to construct a graph based on textual input, the query processing steps could be omitted, and instead the final graph could be returned for processing. And if information should be gathered from a sequence of graphs instead of from a single graph, the query processing steps could be modified to run in parallel on the full sequence of graphs and extract information from each graph. This last modification is demonstrated in Appendix D.
100
+
101
+ # 5 EXPERIMENTS
102
+
103
+ # 5.1 BABI TASKS
104
+
105
+ I evaluated the GGT-NN model on the bAbI tasks, a set of simple natural-language tasks, where each task is structured as a sequence of sentences followed by a query (Weston et al., 2016). The generation procedure for the bAbI tasks includes a “Knowledge” object for each sentence, representing the current state of knowledge after that sentence. I exposed this knowledge object in graph format, and used this to train a GGT-NN in supervised mode. The knowledge object provides names for each node type, and direct reference was performed based on these names: if a word in the sentence matched a node type name, it was parsed as a direct reference to all nodes of that type. For details on this graphical format, see Appendix C.
106
+
107
+ # 5.1.1 ANALYSIS AND RESULTS
108
+
109
+ I trained two versions of the GGT-NN model for each task: one with and one without direct reference. Tasks 3 and 5, which involve a complex temporal component, were trained with intermediate propagation, whereas all of the other tasks were not because the structure of the tasks made such complexity unnecessary. Most task models were configured to output a single word, but task 19 (pathfinding) used a GRU to output multiple words, and task 8 (listing) was configured to output a strength for each possible word to allow multiple words to be selected without having to consider ordering.
110
+
111
+ Results are shown in Tables 1 and 2. The GGT-NN model was able to reach $9 5 \%$ accuracy in all but one of the tasks, and reached $100 \%$ accuracy in eleven of them (see Table 2). Additionally, for fourteen of the tasks, the model was able to reach $9 5 \%$ accuracy using 500 or fewer of the 1000 training examples (see Table 1).
112
+
113
+ The only task that the GGT-NN was unable to solve with $9 5 \%$ accuracy was task 17 (Positional Reasoning), for which the model was not able to attain a high accuracy. Task 17 has a larger number of possible entities than the other tasks: each entity consists of a color (chosen from five options) and a shape (chosen from four shapes), for a total of 20 unique entities that must be represented separately. Additionally, the stories are much shorter than those in other tasks (2 facts for each set of 8 questions). It is likely that these additional complexities caused the network performance to suffer.
114
+
115
+ Table 1: Number of training examples needed before the GGT-NN model could attain $\leq 5 \%$ error on each of the bAbI tasks. Experiments were run with 50, 100, 250, 500, and 1000 examples. “GGT-NN $^ +$ direct ref.” denotes the performance of the model with direct reference, and “GGTNN” denotes the performance of the model without direct reference. Dashes indicate that the model was unable to reach the desired accuracy with 1000 examples.
116
+
117
+ <table><tr><td>Task</td><td>CE-LNN rteeet CE-LNN</td><td>Task</td><td>CE-LNN aatteeat</td><td>CC-LNN</td></tr><tr><td></td><td></td><td>11-Basic Coreference</td><td>100</td><td>1000</td></tr><tr><td>1 - Single Supporting Fact 2 - Two Supporting Facts</td><td>100 1000 250</td><td>12 - Conjunction</td><td>500</td><td>1000</td></tr><tr><td>3 - Three Supporting Facts</td><td>= 1000</td><td>13 - Compound Coref.</td><td>100</td><td>1000</td></tr><tr><td>4 - Two Arg.Relations</td><td>1 1000 1000</td><td>14-Time Reasoning</td><td>1000</td><td>-</td></tr><tr><td>5 - Three Arg.Relations</td><td>500</td><td>15 -Basic Deduction</td><td>500</td><td>500</td></tr><tr><td>6 - Yes/No Questions</td><td>100 1</td><td>16 -Basic Induction</td><td>100</td><td>500</td></tr><tr><td>7 - Counting</td><td>250 =</td><td>17 -Positional Reasoning</td><td>-</td><td>1</td></tr><tr><td>8 -Lists/Sets</td><td>250 1000</td><td>18 - Size Reasoning</td><td>1000</td><td>=</td></tr><tr><td>9 - Simple Negation</td><td>250 1</td><td>19 -Path Finding</td><td>500</td><td>1</td></tr><tr><td>10 - Indefinite Knowledge</td><td>1000 1</td><td>20 -Agent&#x27;s Motivations</td><td>250</td><td>250</td></tr></table>
118
+
119
+ <table><tr><td></td><td colspan="6">1,000 examples</td><td colspan="5">10,000 examples</td></tr><tr><td>Task</td><td>CECLNN pa teeeer</td><td>CE-LNN</td><td>JLST</td><td>NNLIN</td><td>NIANNN</td><td>Greee</td><td>WLN</td><td>*ANNNN JLN-I</td><td>ONG</td><td>+NNI</td><td>Jeeg</td></tr><tr><td></td><td>0</td><td>0.7</td><td>50.0</td><td>0</td><td>0</td><td>8</td><td>招</td><td></td><td>0</td><td>0</td><td>0</td></tr><tr><td>1234</td><td>0</td><td>5.7</td><td>80.0</td><td>0</td><td>8.3</td><td></td><td></td><td></td><td>0.4</td><td>0.3</td><td>0.1</td></tr><tr><td></td><td>1.3</td><td>12.0</td><td>80.0</td><td>0</td><td>40.3</td><td></td><td>3</td><td>2.1</td><td>1.8</td><td>1.1</td><td>4.1</td></tr><tr><td></td><td>1.2</td><td>2.2</td><td>39.0</td><td>0</td><td>2.8</td><td>1.4</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td></tr><tr><td>5</td><td>1.6</td><td>10.9</td><td>30.0</td><td>2.0</td><td>13.1</td><td>4.6</td><td>0.8</td><td>0.8</td><td>0.8</td><td>0.5</td><td>0.3</td></tr><tr><td>6</td><td>0</td><td>7.7</td><td>52.0</td><td>0</td><td>7.6</td><td>30.0</td><td>17.1 1.5</td><td>0.1</td><td>0</td><td>0</td><td>0.2</td></tr><tr><td>7</td><td>0</td><td>5.6</td><td>51.0</td><td>15.0</td><td>17.3</td><td>22.3</td><td>17.8 60</td><td>2.0</td><td>0.6</td><td>2.4</td><td>0</td></tr><tr><td>8</td><td>0</td><td>3.3</td><td>55.0</td><td>9.0</td><td>10.0</td><td>19.2</td><td>13.8 1.7</td><td>0.9</td><td>0.3</td><td>0</td><td>0.5</td></tr><tr><td>9</td><td>0</td><td>11.6</td><td>36.0</td><td>0</td><td>13.2</td><td>31. 1.5</td><td>16.4 0.6</td><td>0.3</td><td>0.2</td><td>0</td><td>0.1</td></tr><tr><td>10</td><td>3.4</td><td>28.6</td><td>56.0</td><td>2.0</td><td>15.1</td><td>15.6</td><td>16.6 19.8</td><td>0</td><td>0.2</td><td>0</td><td>0.6</td></tr><tr><td>11</td><td>0</td><td>0.2</td><td>28.0</td><td>0</td><td>0.9</td><td>8.0</td><td>15.2</td><td>0</td><td>0</td><td>0</td><td>0.3</td></tr><tr><td>12</td><td>0.1</td><td>0.7</td><td>26.0</td><td>0</td><td>0.2</td><td>0.8</td><td>8.9 6.2</td><td>0</td><td>0</td><td>0.2</td><td>0</td></tr><tr><td>13</td><td>0</td><td>0.8</td><td>6.0</td><td>0</td><td>0.4</td><td>9.0</td><td>7.4 7.5</td><td>0</td><td>0</td><td>0</td><td>1 1.3</td></tr><tr><td>14</td><td>2.2</td><td>55.1</td><td>73.0</td><td>1.0</td><td>1.7</td><td>62.9</td><td>24.2 17.5</td><td>0.2</td><td>0.4</td><td>0.2</td><td>0</td></tr><tr><td>15</td><td>0.9</td><td>0</td><td>79.0</td><td>0</td><td>0</td><td>57. .8</td><td>47. 7.0</td><td>0</td><td>0</td><td>0</td><td>0</td></tr><tr><td>16</td><td>0</td><td>0</td><td>77.0</td><td>0</td><td>1.3</td><td>53.2</td><td>49.6 3.6</td><td>51.</td><td>S</td><td></td><td>0.2</td></tr><tr><td>17</td><td>34</td><td>48.0</td><td>49.0</td><td>35.0</td><td>51.0</td><td></td><td></td><td></td><td></td><td></td><td>0.5</td></tr><tr><td>18</td><td></td><td>10.6</td><td>48.0</td><td>5.0</td><td>11.1</td><td>8.8</td><td></td><td>12</td><td></td><td></td><td>0.3</td></tr><tr><td>19</td><td>0</td><td>70.6</td><td>92.0</td><td>64.0</td><td>82.8</td><td>90.4</td><td>4.3</td><td>39.5 2.3</td><td>3.9</td><td>0</td><td>2.3</td></tr><tr><td>20</td><td>0</td><td>1.0</td><td>9.0</td><td>0</td><td>0</td><td>2.6</td><td>1.5</td><td>0</td><td>0 0</td><td>0</td><td>0</td></tr></table>
120
+
121
+ For comparison, accuracy on the bAbI tasks is also included for a simple sequence-to-sequence LSTM model and for a variety of existing state-of-the-art approaches (see Table 2): a simple sequence-to-sequence LSTM model, as implemented in Weston et al. (2016), a modified Memory Network model (MemNN, Weston et al., 2016), End-To-End Memory Network (MemN2N, Sukhbaatar et al., 2015), Recurrent Entity Network (EntNet, Henaff et al., 2016), Neural Turing Machine (NTM, Graves et al., 2014), Dynamic NTM (D-NTM, Gulcehre et al., 2016), a larger version of the MemN2N model with weight tying and nonlinearity $( \mathrm { M e m N } 2 \mathrm { N } ^ { \ast }$ , Sukhbaatar et al., 2015), Differentiable Neural Computer (DNC, Graves et al., 2016), and Dynamic Memory Network $\mathrm { ( D M N + }$ , Xiong et al., 2016). Although the GGT-NN model was trained using only 1,000 training examples, results using 10,000 examples have also been reproduced here for comparison. Also, it is important to note that the GGT-NN and MemNN models were trained with strong supervision: the GGT-NN model was trained with full graph information, and the MemNN model was trained with information on which sentences were relevant to the query. All other models were trained end-to-end without additional supervision.
122
+
123
+ Since the GGT-NN and MemNN models are both strongly supervised, it is interesting to note that each approach outperforms the other on a subset of the tasks. In particular, the GGT-NN model with direct reference attains a higher level of accuracy on the following tasks, with an improvement of $0 . 4 \substack { - 6 4 \% }$ depending on the task: task 5 $( 0 . 4 \% )$ , task 7 $( 1 5 \% )$ , task 8 $( 9 \% )$ , task 17 $( 0 . 5 \% )$ , task 18 $( 2 . 9 \% )$ , and task 19 $( 6 4 \% )$ . This may indicate that a graphical representation is superior to a list of sentence memories for solving these tasks. On the other hand, the MemNN model outperforms the GGT-NN model $( 0 . 1 \mathrm { - } 2 . 9 \%$ greater accuracy) on tasks 3, 4, 10, 12, 14, and 15.
124
+
125
+ Of particular interest is the performance on task 19, the pathfinding task, for which the GGT-NN model with direct reference performs better than all but one of the other models $( \mathrm { D M N } + )$ ), and shows a large improvement over the performance of the MemNN model. This is reasonable, since pathfinding is a task that is naturally suited to a graphical representation. The shortest path between two nodes can be easily found by sending information across all paths away from one of the nodes in a distributed fashion, which the GGT-NN model allows. Note that the preexisting GGS-NN model (discussed in Section 2.2) was also able to successfully learn the pathfinding task, but required the input to be preprocessed into graphical form even when evaluating the model, and thus could not be directly evaluated on the textual form of any of the bAbI tasks (Li et al., 2016). The current results demonstrate that the proposed GGT-NN model is able to solve the pathfinding task when given textual input.
126
+
127
+ Similarly, both variants of the GGT-NN model show improvement over many other models on task 16, the induction task. Solving the induction task requires being able to infer relationships based on similarities between entities. (One example from this task: Lily is a swan. Lily is white. Bernhard is green. Greg is a swan. What color is Greg? A:white.) In a graphical setting, this can be done by following a sequence of edges $( \mathrm { G r e g } \to \mathrm { s w a n } \to \mathrm { L i l y } \to $ white), and the performance of the GGT-NN model indicates that this task is particularly suited to such a representation.
128
+
129
+ In general, the GGT-NN model with direct reference performs better than the model without it. The model with direct reference reaches $9 5 \%$ accuracy on 19/20 of the bAbI tasks, while the model without direct reference reaches that level of accuracy on $9 / 2 0$ of the tasks (see Table 2). Additionally, when compared to the direct-reference model, the model without direct reference requires more training examples in order to reach the accuracy threshold (see Table 1). This indicates that, although the model can be used without direct reference, adding direct reference greatly improves the training of the model.
130
+
131
+ # 5.2 RULE DISCOVERY TASKS
132
+
133
+ To demonstrate the power of GGT-NN to model a wide variety of graph-based problems, I applied the GGT-NN to two additional tasks. In each task, a sequence of data structures were transformed into a graphical format, and the GGT-NN was tasked with predicting the data for the next timestep
134
+
135
+ Table 3: Accuracy of GGT-NN on the Rule 30 Automaton and Turing Machine tasks.
136
+
137
+ <table><tr><td></td><td>Original Task</td><td>Generalization:20</td><td>Generalization:30</td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td>Automaton</td><td>100.0%</td><td>87.0%</td><td>69.5%</td></tr><tr><td>Turing</td><td>99.9%</td><td>90.4%</td><td>80.4%</td></tr></table>
138
+
139
+ ![](images/1eba93c492466429914e5eaf632b79c171018c8e7223ee0e87c583c7ce5c49fa.jpg)
140
+ Figure 3: Visualization of network performance on the Rule 30 Automaton task. Top node (purple) represents zero, bottom node (blue) represents 1, and middle nodes (green, orange, and red) represent individual cells. Blue edges indicate adjacent cells, and gold edges indicate the value of each cell. Three timesteps occur between each row.
141
+
142
+ based on the current timestep. No additional information was provided as textual input; instead, the network was tasked with learning the rules governing the evolution of the graph structure over time.
143
+
144
+ # 5.2.1 CELLULAR AUTOMATON TASK
145
+
146
+ The first task used was a 1-dimensional cellular automaton, specifically the binary cellular automaton known as Rule 30 (Wolfram, 2002). Rule 30 acts on an infinite set of cells, each with a binary state (either 0 or 1). At each timestep, each cell deterministically changes state based on its previous state and the states of its neighbors. In particular, the update rules are
147
+
148
+ $$
149
+ { \mathrm { C u r r e n t ~ n e i g h b o r h o o d } } { \left| \begin{array} { l } { 1 1 1 } \\ { ~ \mathbf { n e x t ~ v a l u e } } \end{array} \right| } { \begin{array} { l } { 1 1 1 } \\ { ~ \mathbf { 0 } ~ } \end{array} } { \left| \begin{array} { l } { ~ 1 \mathbf { 0 } ~ } \\ { ~ \mathbf { 0 } ~ } \end{array} \right| } { \begin{array} { l } { ~ \mathbf { 1 0 0 } ~ } \\ { ~ \mathbf { 1 } ~ } \end{array} } { \left| \begin{array} { l } { ~ 0 \mathbf { 1 } 1 } \\ { ~ \mathbf { 1 } ~ } \end{array} \right| } { \begin{array} { l } { ~ 0 \mathbf { 1 0 } ~ } \\ { ~ \mathbf { 1 } ~ } \end{array} } { \left| \begin{array} { l } { ~ 0 \mathbf { 0 } 1 } \\ { ~ \mathbf { 0 } ~ } \end{array} \right| }
150
+ $$
151
+
152
+ Cell states can be converted into graphical format by treating the cells as a linked list. Each of the cells is represented by a node with edges connecting it to the cell’s neighbors, and a value edge is used to indicate whether the cell is 0 or 1. This format is described in more detail in Appendix C.
153
+
154
+ # 5.2.2 TURING MACHINES
155
+
156
+ The second task was simulating an arbitrary 2-symbol 4-state Turing machine. A Turing machine operates on an infinite tape of cells, each containing a symbol from a finite set of possible symbols. It has a head, which points at a particular cell and can read and write the symbol at that cell. It also has an internal state, from a finite set of states. At each timestep, based on the current state and the contents of the cell at the head, the machine writes a new symbol, changes the internal state, and can move the head left or right or leave it in place. The action of the machine depends on a finite set of rules, which specify the actions to take for each state-symbol combination. Note that the version of Turing machine used here has only 2 symbols, and requires that the initial contents of the tape be all 0 (the first symbol) except for finitely many 1s (the second symbol).
157
+
158
+ When converting a Turing machine to graphical format, the tape of the machine is modeled as a linked list of cells. Additionally, each state of the machine is denoted by a state node, and edges between these nodes encode the transition rules. There is also a head node, which connects both to the current cell and to the current state of the machine. See Appendix C for more details.
159
+
160
+ # 5.2.3 ANALYSIS AND RESULTS
161
+
162
+ The GGT-NN model was trained on 1000 examples of the Rule 30 automaton with different initial states, each of which simulated 7 timesteps of the automaton, and 20,000 examples of Turing machines with different rules and initial tape contents, each of which simulated 6 timesteps of the Turing machine. Performance was then evaluated on 1000 new examples generated with the same format. The models were evaluated by picking the most likely graph generated by the model, and comparing it with the correct graph. The percent accuracy denotes the fraction of the examples for which these two graphs were identical at all timesteps. In addition to evaluating the performance on identical tasks, the generalization ability of the models was also assessed. The same trained models were evaluated on versions of the task with 20 and 30 timesteps of simulation.
163
+
164
+ Results are shown in Table 3. The models successfully learned the assigned tasks, reaching high levels of accuracy for both tasks. Additionally, the models show the ability to generalize to large inputs, giving a perfect output in the majority of extended tasks. For visualization purposes, Figure 3 shows the model at various stages of training when evaluated starting with a single 1 cell.
165
+
166
+ # 6 COMPARISON WITH RELATED WORK
167
+
168
+ Many methods have been proposed for combining neural networks with graphs. These methods generally require the input to the network to be in graphical format. For instance, GNNs and GGS-NNs take a graph as input, and propagate information between nodes according to the graph structure (Gori et al., 2005; Scarselli et al., 2009; Li et al., 2016). Similarly, graph convolutional networks extract information from an existing graph structure by using approximations to spectral graph convolutions (Kipf & Welling, 2016). These methods are similar to GGT-NNs in that they all store information in the nodes of a graph and use edges to determine how information flows. However, they all use a graph with fixed structure, and can only accept graphical data. The GGT-NN model, on the other hand, allows the graph structure to be built and modified based on unstructured input.
169
+
170
+ Giles et al. (1992) describe a method for extracting a finite state machine from a trained recurrent neural network by quantizing the hidden states of the network, recording all possible state transitions, and using them to construct a minimal directed graph representing the state machine. This method, however, requires postprocessing of the network to extract the graph, and is limited to extracting graphs that represent state machines. Additionally, although the FSM extraction method described by Giles et al. (1992) and the GGT-NN model both produce graphs using neural networks, the goals are different: the FSM extraction method aims to learn a single graph that can classify sequences, whereas the GGT-NN model aims to learn a neural network that can manipulate graphs.
171
+
172
+ The lifted relational neural network (LRNN) is another approach to working with structured data (Sourek et al., 2015). LRNNs require the input to be formatted as a combination of weighted predicate logic statements, encompassing both general rules and specific known facts. For each training example, the statements are used to construct a “ground neural network”, with a connection pattern determined by the dependencies between the statements. LRNNs can learn to extract information by adjusting the weights of each statement, but require the rules to be composed by hand based on the task structure. Furthermore, unlike in GGT-NNs, a LRNN has no internal state associated with the objects it describes (which are instead represented by single neurons), and the relationships between objects cannot be constructed or modified by the network.
173
+
174
+ Multiple recent architectures have included differentiable internal states. Memory Networks, as described in Weston et al. (2014), and the fully differentiable end-to-end memory networks, described in Sukhbaatar et al. (2015), both utilize a differentiable long-term memory component, consisting of a set of memories that are produced by encoding the input sentences. To answer a query, an attention mechanism is used to select a subset of these memories, and the resulting memories are processed to produce the desired output. Differentiable Neural Computers (DNCs), described in Graves et al. (2016), interact with a fixed-size memory using a set of read and write “heads”, which can be moved within the memory either by searching for particular content or by following temporal “links of association” that track the order in which data was written.
175
+
176
+ Memory networks and DNCs share with the GGT-NN model the ability to iteratively construct an internal state based on textual input, and use that internal state to answer questions about the underlying structured data. However, in these models, the structure of the internal state is implicit: although the network can store and work with structured data, the actual memory consists of a set of vectors that cannot be easily interpreted, except by monitoring the network access patterns. The GGT-NN model, on the other hand, explicitly models the internal state as a graph with labeled nodes and edges. This allows the produced graph to be extracted, visualized, and potentially used in downstream applications that require graph-structured input.
177
+
178
+ Hierarchical Attentive Memory (HAM) is a memory-based architecture that consists of a binary tree built on top of an input sequence (Andrychowicz & Kurach, 2016). A recurrent controller accesses the HAM module by performing a top-down search through the tree, at each stage choosing to attend to either the left or right subtrees. Once this process reaches a leaf, the value of the leaf is provided to the controller to use in predicting the next output, and this leaf’s value can be updated with a new value. This architecture is especially suited toward sequence-based tasks, and has been shown to generalize to longer sequences very efficiently due to the tree structure. However, it is unclear whether a HAM module would work well with non-sequential structured data, since the tree structure is fixed by the network.
179
+
180
+ One advantage of the GGT-NN model over existing works is that it can process data in a distributed fashion. Each node independently processes its surroundings, which can be beneficial for complex tasks such as pathfinding on a graph. This is in contrast to memory networks, DNCs, and HAM modules, which are restricted to processing only a fixed number of locations in a given timestep. On the other hand, the distributed nature of the GGT-NN model means that it is less time and space efficient than these other networks. Since every node can communicate with every other node, the time and space required to run a GGT-NN step scales quadratically with the size of the input. A DNC or memory network, on the other hand, either scales linearly (since it attends to all stored data or memories) or is constant (if restricted to a fixed-size memory), and a HAM module scales logarithmically (due to the tree structure).
181
+
182
+ # 7 CONCLUSION
183
+
184
+ The results presented here show that GGT-NNs are able to successfully model a wide variety of tasks using graph-structured states and potentially could be useful in solving many other types of problems. The specific GGT-NN model described here can be used as-is for tasks consisting of a sequence of input sentences and graphs, optionally followed by a query. In addition, due to the modular nature of GGT-NNs, it is possible to reconfigure the order of the transformations to produce a model suitable for a different task.
185
+
186
+ The GGT-NN architecture has a few advantages over the architectures described in existing works. In contrast to other approaches to working with structured data, GGT-NNs are designed to work with unstructured input, and are able to modify a graphical structure based on the input. And in contrast to memory networks or DNCs, the internal state of the network is explicitly graph structured, and complex computations can be distributed across the nodes of the graph.
187
+
188
+ One downside of the current model is that the time and space required to train the model increase very quickly as the complexity of the task increases, which limits the model’s applicability. It would be very advantageous to develop optimizations that would allow the model to train faster and with smaller space requirements, such as using sparse edge connections, or only processing some subset of the nodes at each timestep. Another promising direction of future work is in reducing the level of supervision needed to obtain meaningful graphs, for example by combining a few examples that have full graph-level supervision with a larger set of examples that do not have graph-level information, or using additional regularization to enable the GGT-NN model to be trained without any graph information.
189
+
190
+ There are exciting potential uses for the GGT-NN model. One particularly interesting application would be using GGT-NNs to extract graph-structured information from unstructured textual descriptions. More generally, the graph transformations provided here may allow machine learning to interoperate more flexibly with other data sources and processes with structured inputs and outputs.
191
+
192
+ # ACKNOWLEDGMENTS
193
+
194
+ I would like to thank Harvey Mudd College for computing resources. I would also like to thank the developers of the Theano library, which I used to run my experiments. This work used the Extreme Science and Engineering Discovery Environment (XSEDE), which is supported by National Science Foundation grant number ACI-1053575.
195
+
196
+ # REFERENCES
197
+
198
+ Marcin Andrychowicz and Karol Kurach. Learning efficient algorithms with hierarchical attentive memory. arXiv preprint arXiv:1602.03218, 2016.
199
+
200
+ Joan Bruna, Wojciech Zaremba, Arthur Szlam, and Yann LeCun. Spectral networks and locally connected networks on graphs. arXiv preprint arXiv:1312.6203, 2013.
201
+
202
+ 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.
203
+
204
+ David K Duvenaud, Dougal Maclaurin, Jorge Iparraguirre, Rafael Bombarell, Timothy Hirzel, Alan´ Aspuru-Guzik, and Ryan P Adams. Convolutional networks on graphs for learning molecular fingerprints. In Advances in Neural Information Processing Systems, pp. 2224–2232, 2015.
205
+
206
+ C Lee Giles, Clifford B Miller, Dong Chen, Hsing-Hen Chen, Guo-Zheng Sun, and Yee-Chun Lee. Learning and extracting finite state automata with second-order recurrent neural networks. Neural Computation, 4(3):393–405, 1992.
207
+
208
+ Marco Gori, Gabriele Monfardini, and Franco Scarselli. A new model for learning in graph domains. In Proceedings. 2005 IEEE International Joint Conference on Neural Networks, 2005., volume 2, pp. 729–734. IEEE, 2005.
209
+
210
+ Alex Graves, Greg Wayne, and Ivo Danihelka. Neural turing machines. arXiv preprint arXiv:1410.5401, 2014.
211
+
212
+ Alex Graves, Greg Wayne, Malcolm Reynolds, Tim Harley, Ivo Danihelka, Agnieszka GrabskaBarwinska, Sergio G ´ omez Colmenarejo, Edward Grefenstette, Tiago Ramalho, John Agapiou, ´ et al. Hybrid computing using a neural network with dynamic external memory. Nature, 538 (7626):471–476, 2016.
213
+
214
+ Caglar Gulcehre, Sarath Chandar, Kyunghyun Cho, and Yoshua Bengio. Dynamic neural turing machine with soft and hard addressing schemes. arXiv preprint arXiv:1607.00036, 2016.
215
+
216
+ Mikael Henaff, Jason Weston, Arthur Szlam, Antoine Bordes, and Yann LeCun. Tracking the world state with recurrent entity networks. arXiv preprint arXiv:1612.03969, 2016.
217
+
218
+ Hisashi Kashima, Koji Tsuda, and Akihiro Inokuchi. Marginalized kernels between labeled graphs. In ICML, volume 3, pp. 321–328, 2003.
219
+
220
+ Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. arXiv preprint arXiv:1609.02907, 2016.
221
+
222
+ Yujia Li, Daniel Tarlow, Marc Brockschmidt, and Richard Zemel. Gated graph sequence neural networks. ICLR, 2016.
223
+
224
+ Bryan Perozzi, Rami Al-Rfou, and Steven Skiena. Deepwalk: Online learning of social representations. In Proceedings of the 20th ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 701–710. ACM, 2014.
225
+
226
+ Franco Scarselli, Marco Gori, Ah Chung Tsoi, Markus Hagenbuchner, and Gabriele Monfardini. The graph neural network model. IEEE Transactions on Neural Networks, 20(1):61–80, 2009.
227
+
228
+ Nino Shervashidze, Pascal Schweitzer, Erik Jan van Leeuwen, Kurt Mehlhorn, and Karsten M Borgwardt. Weisfeiler-lehman graph kernels. Journal of Machine Learning Research, 12(Sep):2539– 2561, 2011.
229
+
230
+ Gustav Sourek, Vojtech Aschenbrenner, Filip Zelezny, and Ondrej Kuzelka. Lifted relational neural networks. arXiv preprint arXiv:1508.05128, 2015.
231
+
232
+ Sainbayar Sukhbaatar, Jason Weston, Rob Fergus, et al. End-to-end memory networks. In Advances in neural information processing systems, pp. 2440–2448, 2015.
233
+
234
+ Theano Development Team. Theano: A Python framework for fast computation of mathematical expressions. arXiv e-prints, abs/1605.02688, May 2016. URL http://arxiv.org/abs/ 1605.02688.
235
+
236
+ 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, 16(5):62–74, 2014.
237
+
238
+ Oriol Vinyals, Samy Bengio, and Manjunath Kudlur. Order matters: Sequence to sequence for sets. ICLR, 2016.
239
+
240
+ Jason Weston, Sumit Chopra, and Antoine Bordes. Memory networks. arXiv preprint arXiv:1410.3916, 2014.
241
+
242
+ Jason Weston, Antoine Bordes, Sumit Chopra, Alexander M Rush, Bart van Merrienboer, Armand ¨ Joulin, and Tomas Mikolov. Towards ai-complete question answering: A set of prerequisite toy tasks. ICLR, 2016.
243
+
244
+ Stephen Wolfram. A new kind of science, volume 5. Wolfram media Champaign, 2002.
245
+
246
+ Caiming Xiong, Stephen Merity, and Richard Socher. Dynamic memory networks for visual and textual question answering. In Proceedings of The 33rd International Conference on Machine Learning, pp. 2397–2406, 2016.
247
+
248
+ # APPENDIX A BACKGROUND ON GG-NNS AND GGS-NNS
249
+
250
+ This section gives additional background on the implementation of GG-NNs and GGS-NNs, described by Li et al. (2016).
251
+
252
+ Recall from section 2.2 that GG-NNs represent a graph $\mathcal { G } = ( \nu , \mathcal { E } )$ as a set $V$ of nodes $v$ with unique values $1 , \ldots , | \nu |$ and a set $\mathcal { E }$ of directed edges $e = ( v , v ^ { \prime } ) \in \mathcal { V } \times \mathcal { V }$ oriented from $v$ to $v ^ { \prime }$ . Each node has an annotation $\mathbf { x } _ { v } \in \mathbb { R } ^ { N }$ and a hidden state $\mathbf { h } _ { v } \in \mathbb { R } ^ { D }$ . Additionally, each edge has a type $y _ { e } \in \{ 1 , \cdots , M \}$ .
253
+
254
+ Initially, $\mathbf { h } _ { v } ^ { ( 1 ) }$ is set to the annotation $\mathbf { x } _ { v }$ padded with zeros. Then nodes exchange information for some fixed number of timesteps $T$ according to the propagation model
255
+
256
+ $$
257
+ \begin{array} { r l r l } & { \mathbf { h } _ { v } ^ { ( 1 ) } = [ \mathbf { x } _ { v } ^ { \top } , \mathbf { 0 } ] ^ { \top } } & { \mathbf { a } _ { v } ^ { ( t ) } = \mathbf { A } _ { v : } ^ { \top } [ \mathbf { h } _ { 1 } ^ { ( t - 1 ) \top } \cdot \cdot \cdot \mathbf { h } _ { | \mathcal { V } | } ^ { ( t - 1 ) \top } ] ^ { \top } } \\ & { \mathbf { z } _ { v } ^ { ( t ) } = \sigma ( \mathbf { W } _ { z } \mathbf { a } _ { v } ^ { ( t ) } + \mathbf { U } \mathbf { h } _ { v } ^ { ( t - 1 ) } ) } & { \mathbf { r } _ { v } ^ { ( t ) } = \sigma ( \mathbf { W } _ { r } \mathbf { a } _ { v } ^ { ( t ) } + \mathbf { U } _ { r } \mathbf { h } _ { v } ^ { ( t - 1 ) } ) } \\ & { \mathbf { \widehat { h } } _ { v } ^ { ( t ) } = \operatorname { t a n h } ( \mathbf { W } \mathbf { a } _ { v } ^ { ( t ) } + \mathbf { U } \mathbf { ( r } _ { v } ^ { ( t ) } \odot \mathbf { h } _ { v } ^ { ( t - 1 ) } ) ) } & { \mathbf { h } _ { v } ^ { ( t ) } = \big ( 1 - \mathbf { z } _ { v } ^ { ( t ) } \big ) \odot \mathbf { h } _ { v } ^ { ( t - 1 ) } + \mathbf { z } _ { v } ^ { ( t ) } \odot \mathbf { \widehat { h } } _ { v } ^ { ( t ) } . } \end{array}
258
+ $$
259
+
260
+ Here $\mathbf { a } _ { v } ^ { ( t ) }$ represents the information received by each node from its neighbors in the graph, and the matrix $\mathbf { A } \in \mathbf { \bar { \mathbb { R } } } ^ { D | \mathcal { V } | \times 2 D | \mathcal { V } | }$ has a specific structure that determines how nodes communicate. The first half of $\mathbf { A }$ , denoted $\mathbf { A } ^ { ( o u t ) } \in \mathbb { R } ^ { \tilde { D } | \mathcal { V } | \times D | \mathcal { V } | }$ , corresponds to outgoing edges, whereas the second half $\mathbf { A } ^ { ( i n ) } \in \mathbb { R } ^ { D | \mathcal { V } | \times D | \mathcal { V } | }$ corresponds to incoming edges.
261
+
262
+ Each edge type corresponds to specific forward and backward propagation matrices $\mathbf { P } _ { y } , \mathbf { P } _ { y } ^ { \prime } \in \mathbb { R } ^ { \tilde { D } \times D }$ which determine how to propagate information across an edge of that type in each direction. The $D \times D$ -sized submatrix of $\mathbf { A } ^ { ( o u t ) }$ in position $i , j$ contains $\mathbf { P } _ { y }$ if an edge of type $y$ connects nodes $n _ { i }$ to $n _ { j }$ , or 0 if no such edge connects in that direction. Similarly, the $D \times D$ - sized submatrix of the matrix $\mathbf { A } ^ { ( i n ) }$ in position $i , j$ contains $\mathbf { P } _ { y } ^ { \prime }$ if an edge of type $y$ connects nodes $n _ { j }$ to $n _ { i }$ , or 0 if no such edge connects in that direction. $\mathbf { A } _ { v : } \in \mathbb { R } ^ { D \times 2 D | \mathcal { V } | }$ is the submatrix of $\mathbf { A }$ corresponding to node $v$ . Thus, multiplication by $\mathbf { A } _ { v }$ : in 1 is equivalent to taking the following sum:
263
+
264
+ $$
265
+ \mathbf { a } _ { v } ^ { ( t ) } = \sum _ { v ^ { \prime } \in \mathcal { V } } \left( \sum _ { y = 1 } ^ { M } s _ { \mathrm { e d g e } } ( v , v ^ { \prime } , y ) \odot \mathbf { P } _ { y } + s _ { \mathrm { e d g e } } ( v ^ { \prime } , v , y ) \odot \mathbf { P } _ { y } ^ { \prime } \right) \mathbf { h } _ { v ^ { \prime } } ^ { ( t - 1 ) }
266
+ $$
267
+
268
+ where $s _ { \mathrm { e d g e } } ( v , v ^ { \prime } , y )$ is 1 if $e = ( v , v ^ { \prime } ) \in \mathcal { E }$ and $y _ { e } = y$ , and 0 otherwise.
269
+
270
+ The output from a GG-NN is flexible depending on the task. For node selection tasks, a node score $o _ { v } \ = \ g ( \mathbf { h } _ { v } ^ { ( T ) } , \mathbf { x } _ { v } )$ is given for each node, and then a softmax operation is applied. Graph-level outputs are obtained by combining an attention mechanism $i$ and a node representation function $j$ , both implemented as neural networks, to produce the output representation
271
+
272
+ $$
273
+ \begin{array} { r } { \mathbf { h } _ { \mathcal { G } } = \operatorname { t a n h } \left( \sum _ { v \in \mathcal { V } } \sigma ( i \big ( \mathbf { h } _ { v } ^ { ( T ) } , \mathbf { x } _ { v } \big ) \big ) \odot \operatorname { t a n h } ( j \big ( \mathbf { h } _ { v } ^ { ( T ) } , \mathbf { x } _ { v } ) ) \right) } \end{array}
274
+ $$
275
+
276
+ Gated Graph Sequence Neural Networks (GGS-NN) are an extension of GG-NNs to sequential output o(1), $\mathbf { o } ^ { ( 1 ) } , \ldots , \mathbf { \bar { o } } ^ { ( K ) }$ . At each output step $k$ , the annotation matrix $\mathcal { X }$ is given by $\begin{array} { r l } { \bar { \chi } ^ { } ( k ) } & { { } = } \end{array}$ $[ \mathbf { x } _ { 1 } ^ { ( k ) } , \ldots , \mathbf { x } _ { | \mathcal { V } | } ^ { ( k ) } ] ^ { \top } \in \mathbb { R } ^ { | \mathcal { V } | \times L _ { \mathcal { V } } }$ . A GG-NN $\mathcal { F } _ { \mathbf { o } }$ is trained to predict an output sequence $\mathbf { o } ^ { ( k ) }$ from $\chi ( k )$ , and another GG-NN $\mathcal { F } _ { \mathbf { X } }$ is trained to predict $\chi ( k { + } 1 )$ from $\chi ^ { ( k ) }$ . Prediction of the output at each step is performed as in a normal GG-NN, and prediction of $\chi ( k { + } 1 )$ from the set of all final hidden states $\mathcal { H } ^ { ( k , T ) }$ (after $T$ propagation steps of $\mathcal { F } _ { \mathbf { X } }$ ) occurs according to the equation
277
+
278
+ $$
279
+ \begin{array} { r } { \mathbf { x } _ { v } ^ { ( k + 1 ) } = \sigma \left( j ( \mathbf { h } _ { v } ^ { ( k , T ) } , \mathbf { x } _ { v } ^ { ( k ) } ) \right) . } \end{array}
280
+ $$
281
+
282
+ ![](images/09134bf13f89db5fbe8b19a73414cfe0b9b12e0650666fd28c035051132a23a6.jpg)
283
+ Figure 4: Diagram of the operations performed for each class of transformation. Graph state is shown in the format given by Figure 1. Input and output are shown as gray boxes. Black dots represent concatenation, and $^ +$ and $\times$ represent addition and multiplication, respectively. $1 - \#$ represents taking the input value and subtracting it from 1. Note that for simplicity, operations are only shown for single nodes or edges, although the operations act on all nodes and edges in parallel. In particular, the propagation section focuses on information sent and received by the first node only. In that section the strengths of the edges in the connectivity matrix determine what information is sent to each of the other nodes. Light gray connections indicate the value zero, corresponding to situations where a given edge is not present.
284
+
285
+ # APPENDIX B GRAPH TRANSFORMATION DETAILS
286
+
287
+ In this section I describe in detail the implementations of each type of differentiable graph transformation.1 A diagram of the implementation of each transformation is shown in Figure 4. Note that it is natural to think of these transformations as operating on a single graphical state, and each modifying the state in place. However, in the technical descriptions of these transformations, the operations will be described as functions that take in an old graph and produce a new one, similarly to unrolling a recurrent network over time.
288
+
289
+ # B.1 NODE ADDITION
290
+
291
+ The node addition transformation $\mathcal { T } _ { \mathrm { a d d } } : \Gamma \times \mathbb { R } ^ { \alpha } \Gamma$ takes as input a graph $\mathcal { G }$ and an input vector $\mathbf { a } \in \mathbb { R } ^ { \alpha }$ , and produces a graph $\mathcal { G } ^ { \prime }$ with additional nodes. The annotation and strength of each new node is determined by a function $f _ { \mathrm { a d d } } : \mathbb { R } ^ { \alpha } \times \mathbb { R } ^ { \beta } \to \mathbb { R } \times \mathbb { R } ^ { N } \times \mathbb { R } ^ { \beta }$ , where $\alpha$ is the length of the input vector, $\beta$ is the length of the internal state vector, and as before $N$ is the number of node types. The new nodes are then produced according to
292
+
293
+ $$
294
+ \begin{array} { r } { \left( s _ { | V _ { \mathcal { G } } | + i } , \mathbf { x } _ { | V _ { \mathcal { G } } | + i } , \mathbf { h } _ { i } \right) = f _ { \mathrm { a d d } } ( \mathbf { a } , \mathbf { h } _ { i - 1 } ) , } \end{array}
295
+ $$
296
+
297
+ starting with $\mathbf { h } _ { 0 }$ initialized to some learned initial state, and recurrently computing $s _ { v }$ and $\mathbf { x } _ { v }$ for each new node, up to some maximum number of nodes. Based on initial experiments, I found that implementing $f _ { \mathrm { a d d } }$ as a GRU layer followed by 2 hidden tanh layers was effective, although other recurrent networks would likely be similarly effective. The node hidden states $\mathbf { h } _ { v }$ are initialized to zero. The recurrence should be computed as many times as the maximum number of nodes that might be produced. The recurrent function $f _ { \mathrm { a d d } }$ can learn to output $s _ { v } = 0$ for some nodes to create fewer nodes, if necessary.
298
+
299
+ Note that in order to use information from all of the existing nodes to produce the new nodes, the input to this transformation should include information provided by an aggregation transformation $\bar { \mathcal { T } _ { \mathrm { r e p r } } }$ , described in section B.5.
300
+
301
+ # B.2 NODE STATE UPDATE
302
+
303
+ The node state update transformation $\mathcal { T } _ { \mathbf { h } } : \Gamma \times \mathbb { R } ^ { \alpha } \Gamma$ takes as input a graph $\mathcal { G }$ and an input vector $\mathbf { a } \in \mathbb { R } ^ { \alpha }$ , and produces a graph $\mathcal { G } ^ { \prime }$ with updated node states. This is accomplished by performing a GRU-style update for each node, where the input is a concatenation of a and that node’s annotation vector $\mathbf { x } _ { v }$ and the state is the node’s hidden state, according to
304
+
305
+ $$
306
+ \begin{array} { r l r l } & { \mathbf { r } _ { v } = \sigma \left( \mathbf { W } _ { r } [ \mathbf { a } \mathbf { x } _ { v } ] + \mathbf { U } _ { r } \mathbf { h } _ { v } + \mathbf { b } _ { r } \right) , } & & { \mathbf { z } _ { v } = \sigma \left( \mathbf { W } _ { z } [ \mathbf { a } \mathbf { x } _ { v } ] + \mathbf { U } _ { z } \mathbf { h } _ { v } + \mathbf { b } _ { z } \right) , } \\ & { \widetilde { \mathbf { h } } _ { v } ^ { \prime } = \operatorname { t a n h } \left( \mathbf { W } [ \mathbf { a } \mathbf { x } _ { v } ] + \mathbf { U } \left( \mathbf { r } \odot \mathbf { h } _ { v } \right) + \mathbf { b } \right) , } & & { \mathbf { h } _ { v } ^ { \prime } = \mathbf { z } _ { v } \odot \mathbf { h } _ { v } + \left( 1 - \mathbf { z } _ { v } \right) \odot \widetilde { \mathbf { h } } _ { v } ^ { \prime } } \end{array}
307
+ $$
308
+
309
+ # B.2.1 DIRECT REFERENCE UPDATE
310
+
311
+ For some tasks, performance can be improved by providing information to nodes of a particular type only. For instance, if the input is a sentence, and one word of that sentence directly refers to a node type (e.g., if nodes of type 1 represent Mary, and Mary appears in the sentence), it can be helpful to allow all nodes of type 1 to perform an update using this information. To accomplish this, $\mathcal { T } _ { \mathbf { h } }$ can be modified to take node types into account. (This modification is denoted $\tau _ { \mathrm { h , d i r e c t } }$ .) Instead of a single vector $\mathbf { a } \in \mathbb { R } ^ { \alpha }$ , the direct-reference transformation takes in $\mathbf { A } \in \mathbb { R } ^ { N \times \alpha }$ , where $\mathbf { A } _ { n } \in \mathbb { R } ^ { \alpha }$ is the input vector for nodes with type $n$ . The update equations then become
312
+
313
+ $$
314
+ \begin{array} { c c } { { \bf a } _ { v } = { \bf x } _ { v } { \bf A } } & { } \\ { { \bf r } _ { v } = \sigma \left( { \bf W } _ { r } [ { \bf a } _ { v } { \bf x } _ { v } ] + { \bf U } _ { r } { \bf h } _ { v } + { \bf b } _ { r } \right) , } & { { \bf z } _ { v } = \sigma \left( { \bf W } _ { z } [ { \bf a } _ { v } { \bf x } _ { v } ] + { \bf U } _ { z } { \bf h } _ { v } + { \bf b } _ { z } \right) , } \\ { { \bf \tilde { h } } _ { v } ^ { \prime } = \operatorname { t a n h } \left( { \bf W } [ { \bf a } _ { v } { \bf x } _ { v } ] + { \bf U } \left( { \bf r } \odot { \bf h } _ { v } \right) + { \bf b } \right) , } & { { \bf h } _ { v } ^ { \prime } = { \bf z } _ { v } \odot { \bf h } _ { v } + \left( 1 - { \bf z } _ { v } \right) \odot { \bf \tilde { h } } _ { v } ^ { \prime } } \end{array}
315
+ $$
316
+
317
+ # B.3 EDGE UPDATE
318
+
319
+ The edge update transformation $\mathcal { T } _ { \mathcal { C } } : \Gamma \times \mathbb { R } ^ { \alpha } \Gamma$ takes a graph $\mathcal { G }$ and an input vector $\mathbf { a } \in \mathbb { R } ^ { \alpha }$ , and produces a graph $\mathcal { G } ^ { \prime }$ with updated edges. For each pair of nodes $( \boldsymbol { v } , \boldsymbol { v } ^ { \prime } )$ , the update equations are
320
+
321
+ $$
322
+ \begin{array} { r l } & { \mathbf { c } _ { v , v ^ { \prime } } = f _ { \mathrm { s e t } } ( \mathbf { a } , \mathbf { x } _ { v } , \mathbf { h } _ { v } , \mathbf { x } _ { v ^ { \prime } } , \mathbf { h } _ { v ^ { \prime } } ) } \\ & { \mathcal { C } _ { v , v ^ { \prime } } ^ { \prime } = ( 1 - \mathcal { C } _ { v , v ^ { \prime } } ) \odot \mathbf { c } _ { v , v ^ { \prime } } + \mathcal { C } _ { v , v ^ { \prime } } \odot ( 1 - \mathbf { r } _ { v , v ^ { \prime } } ) . } \end{array} \quad \begin{array} { r l } & { \mathbf { r } _ { v , v ^ { \prime } } = f _ { \mathrm { r e s e t } } ( \mathbf { a } , \mathbf { x } _ { v } , \mathbf { h } _ { v } , \mathbf { x } _ { v ^ { \prime } } , \mathbf { h } _ { v ^ { \prime } } ) } \\ & { } \end{array}
323
+ $$
324
+
325
+ The functions $f _ { \mathrm { s e t } } , f _ { \mathrm { r e s e t } } ~ : ~ \mathbb { R } ^ { \alpha \times 2 N \times 2 D } \ ~ [ 0 , 1 ] ^ { Y }$ are implemented as neural networks. (In my experiments, I used a simple 2-layer fully connected network.) $\mathbf { c } _ { v , v ^ { \prime } , y }$ gives the level of belief in $[ 0 , 1 ]$ that an edge from $v$ to $v ^ { \prime }$ of type $y$ should be created if it does not exist, and $\mathbf { r } _ { v , v ^ { \prime } , y }$ gives the level of belief in $[ 0 , 1 ]$ that an edge from $v$ to $v ^ { \prime }$ of type $y$ should be removed if it does. Setting both to zero results in no change for that edge, and setting both to 1 toggles the edge state.
326
+
327
+ # B.4 PROPAGATION
328
+
329
+ The propagation transformation $\mathcal { T } _ { \mathrm { p r o p } } : \Gamma \to \Gamma$ takes a graph ${ \mathcal { G } } = { \mathcal { G } } ^ { ( 0 ) }$ and runs a series of $T$ propagation steps (as in GG-NN), returning the resulting graph $\mathcal { G } ^ { \prime } = \mathcal { G } ^ { ( T ) }$ . The GG-NN propagation step is extended to handle node and edge strengths, as well as to allow more processing to occur to
330
+
331
+ the information transferred across edges. The full propagation equations for step $t$ are
332
+
333
+ $$
334
+ \begin{array} { r l } & { \mathbf { a } _ { v } ^ { ( t ) } = \displaystyle \sum _ { v ^ { \prime } \in \mathcal { V } } s _ { v ^ { \prime } } \displaystyle \sum _ { y = 1 } ^ { M } \mathcal { C } _ { v , v ^ { \prime } , y } \odot f _ { y } ^ { \mathrm { f w d } } ( \mathbf { x } _ { v ^ { \prime } } , \mathbf { h } _ { v ^ { \prime } } ^ { ( t - 1 ) } ) + \mathcal { C } _ { v ^ { \prime } , v , y } \odot f _ { y } ^ { \mathrm { f w d } } ( \mathbf { x } _ { v ^ { \prime } } , \mathbf { h } _ { v ^ { \prime } } ^ { ( t - 1 ) } ) } \\ & { \mathbf { z } _ { v } ^ { ( t ) } = \sigma ( \mathbf { W } _ { z } [ \mathbf { a } _ { v } ^ { ( t ) } \ \mathbf { x } _ { v } ] + \mathbf { U } \mathbf { h } _ { v } ^ { ( t - 1 ) } + \mathbf { b } _ { z } ) } \\ & { \mathbf { r } _ { v } ^ { ( t ) } = \sigma ( \mathbf { W } _ { r } [ \mathbf { a } _ { v } ^ { ( t ) } \ \mathbf { x } _ { v } ] + \mathbf { U } _ { r } \mathbf { h } _ { v } ^ { ( t - 1 ) } + \mathbf { b } _ { r } ) } \\ & { \mathbf { \widetilde { h } } _ { v } ^ { ( t ) } = \mathrm { t a n h } ( \mathbf { W } [ \mathbf { a } _ { v } ^ { ( t ) } \ \mathbf { x } _ { v } ] + \mathbf { U } ( \mathbf { r } _ { v } ^ { ( t ) } \odot \mathbf { h } _ { v } ^ { ( t - 1 ) } ) + \mathbf { b } _ { h } ) } \\ & { \mathbf { h } _ { v } ^ { ( t ) } = ( 1 - \mathbf { z } _ { v } ^ { ( t ) } ) \odot \mathbf { h } _ { v } ^ { ( t - 1 ) } + \mathbf { z } _ { v } ^ { ( t ) } \odot \mathbf { \widetilde { h } } _ { v } ^ { ( t ) } . } \end{array}
335
+ $$
336
+
337
+ Equation 5 has been adjusted in the most significant manner (relative to Equation 2). In particular, $s _ { v ^ { \prime } }$ restricts propagation so that nodes with low strength send less information to adjacent nodes, $s _ { \mathrm { e d g e } }$ has been replaced with $\mathcal { C }$ to allow edges with fractional strength, and the propagation matrices $\mathbf { P } _ { y } , \mathbf { P } _ { z } ^ { \prime }$ have been replaced with arbitrary functions $f _ { y _ { . } } ^ { \mathrm { f w d } } , f _ { y } ^ { \mathrm { b w d } } : \mathbb { R } ^ { N } \times \mathbb { R } ^ { D } \mathbb { R } ^ { \alpha }$ , where $\alpha$ is the length of the vector a. I used a fully connected layer to implement each function in my experiments. Equations 6, 7, and 8 have also been modified slightly to add a bias term.
338
+
339
+ # B.5 AGGREGATION
340
+
341
+ The aggregation transformation $\mathcal { T } _ { \mathrm { r e p r } } : \Gamma \to \mathbb { R } ^ { \alpha }$ produces a graph-level representation vector from a graph. It functions very similarly to the output representation of a GG-NN (equation 3), combining an attention mechanism with a node representation function, but is modified slightly to take into account node strengths. As in GG-NN, both $i$ and $j$ are neural networks, and in practice a single fully connected layer appears to be adequate for both.
342
+
343
+ $$
344
+ \begin{array} { r } { \mathbf { h } _ { \mathcal { G } } = \operatorname { t a n h } \left( \sum _ { v \in \mathcal { V } } s _ { v } \sigma \big ( i \big ( \mathbf { h } _ { v } ^ { ( T ) } , \mathbf { x } _ { v } \big ) \big ) \odot \operatorname { t a n h } \big ( j \big ( \mathbf { h } _ { v } ^ { ( T ) } , \mathbf { x } _ { v } \big ) \big ) \right) . } \end{array}
345
+ $$
346
+
347
+ # APPENDIX C GRAPH FORMAT DETAILS
348
+
349
+ # C.1 BABI TASKS
350
+
351
+ The knowledge graph object used during generation of the bAbI tasks is structured as a dictionary relating entities to each other with specific relationship types. Entities are identified based on their names, and include people (John, Mary, Sandra), locations (bedroom, kitchen, garden), objects (football, apple, suitcase), animals (mouse, wolf, cat), and colors (white, yellow, green), depending on the particular task. Relationships between entities are also expressed as strings, and are directed: if John is holding the milk there is an “is in” relationship from “milk” to “John”; if Sandra is in the bedroom there is an “is in” relationship from “Sandra” to “bedroom”; if Lily is green there is a “has color” relationship from “Lily” to “green”, etc.
352
+
353
+ The transformation from the knowledge object to a graph is straightforward: each entity used is assigned to a new node type, and relationships between entities are represented as edges between the corresponding nodes. To avoid confusion from overloaded relationships (such as “is in” being used to represent an object being held by a person as well as a person being in a room), relation names are given a distinct edge type depending on the usage context. For instance, when a person is carrying an object, the generic “is in” relationship becomes an edge of type “gettable is in actor”.
354
+
355
+ Some of the graph representations had to be modified in order to ensure that they contained all of the necessary information. For instance, task 3 requires the network to remember where items were in the past, but the knowledge object only contained references to their current locations. In these cases, a linked list structure was added to the knowledge object to allow the history information to be represented in the graph.
356
+
357
+ In particular, each time an item changed locations, a new “record” node was added, with a “previous” edge to the previous history node and a “value” edge to the current location of the item. Each item then connected to the most recent history node using a “history-head” edge. This ensures that the history of each node is present in the graph.
358
+
359
+ 1. John grabbed the milk.
360
+ 2. John travelled to the bedroom.
361
+ 3. Sandra took the football.
362
+ 4. John went to the garden.
363
+ 5. John let go of the milk.
364
+ 6. Sandra let go of the football.
365
+ 7. John got the football.
366
+ 8. John grabbed the milk.
367
+ Where is the milk?
368
+ $\begin{array} { r l } & { \mathrm { 1 . ~ i n i t ~ 1 } } \\ & { \mathrm { 2 . ~ i n i t ~ 1 } } \\ & { \mathrm { 3 . ~ i n i t ~ 1 } } \\ & { \mathrm { 4 . ~ i n i t ~ 1 } } \\ & { \mathrm { 5 . ~ i n i t ~ 1 } } \\ & { \mathrm { 6 . ~ i n i t ~ 0 } } \\ & { \mathrm { 7 . ~ i n i t ~ 0 } } \\ & { \mathrm { 8 . ~ i n i t ~ 0 } } \\ & { \mathrm { 9 . ~ i n i t ~ 1 } } \\ & { \mathrm { 1 0 . ~ i n i t ~ 1 } } \end{array}$ 11. init 1
369
+ 12. init 1
370
+ 13. init 0
371
+ 14. simulate
372
+ 15. simulate
373
+ 16. simulate
374
+ 17. simulate
375
+ 18. simulate
376
+ 19. simulate
377
+ 1 20. simulate
378
+
379
+ ![](images/2c34ea3e1cbe4483bbb0315d748361ce7e834d6d8095e097205ca3c36486bb96.jpg)
380
+ Figure 5: Diagram of one sample story from the bAbI dataset (Task 2), along with a graphical representation of the knowledge state after the italicized sentence.
381
+
382
+ ![](images/1bd521739a8142652bc7990baf791d6be79f95ea969bddc4076b0e596aa625e3.jpg)
383
+ Figure 6: Diagram of one example from the automaton task, along with a graphical representation of the automaton state after the fourth simulate command (italicized).
384
+
385
+ ![](images/c9c3011cf6664a53330d88027e8ebd96cacbb70f36cac9ad865b9be8d469e828.jpg)
386
+ Figure 7: Diagram of an example from the Turing machine task, with a graphical representation of the machine state after the second run command (italicized).
387
+
388
+ In a few of the tasks, specific entities had multi-word representations. While this works for normal input, it makes it difficult to do direct reference, since direct reference is checked on an individual word level. These tasks were modified slightly so that the entities are referred to with single words (e.g. “red square” instead of “red square”).
389
+
390
+ An example of a graph produced from the bAbI tasks is given in Figure 5.
391
+
392
+ # C.2 CELLULAR AUTOMATON
393
+
394
+ The cellular automaton task was mapped to graphical format as follows: Nodes have 5 types: zero, one, init-cell, left-cell, and right-cell. Edges have 2 types: value, and next-r. There is always exactly one “zero” node and one “one” node, and all of the cell nodes form a linked list, with a “value” edge connecting to either zero or one, and a “next-r” edge pointing to the next cell to the right (or no edge for the rightmost cell).
395
+
396
+ At the start of each training example, there are 13 timesteps with input of the form “init X” where X is 0 or 1. These timesteps indicate the first 13 initial cells. Afterward, there are 7 “simulate” inputs. At each of these timesteps, one new left-cell node is added on the left, one new right-cell node is added on the right, and then all cells update their value according to the Rule 30 update rules.
397
+
398
+ An example of the graphical format for the cellular automaton task is given in Figure 6.
399
+
400
+ # C.3 TURING MACHINE
401
+
402
+ For the Turing machine task, nodes were assigned to 8 types: state-A, state-B, state-C, state-D, head, cell, 0, and 1. Edges have 16 types: head-cell, next-left, head-state, value, and 12 types of the form rule-R-W-D, where R is the symbol read (0 or 1), W is the symbol written (0 or 1), and D is the direction to move afterward (Left, Right, or None). State nodes are connected with rule edges, which together specify the rules governing the Turing machine. Cell nodes are connected to adjacent cells with next-left edges, and to the symbol on the tape with value edges. Finally, the head node is connected to the current state with a head-state edge, and to the current cell of the head with a head-cell edge.
403
+
404
+ At the start of each training example, each of the rules for the Turing machine are given, in the form “rule state-X R W state-Y D”. Next, the initial state is given in the format “start state-X”, and the initial contents of the tape (of length 4) are given sequentially in the format “input symbol-X”, with the position for the head to start marked by “input symbol-X head”. Finally, there are 6 “run” inputs, after each of which the head node updates its edges and the cell at the head updates its value according to the rules of the Turing machine. If the head leaves the left or right of the tape, a new node is introduced there.
405
+
406
+ An example of the graphical format for the Turing machine task is given in Figure 7.
407
+
408
+ # APPENDIX D GRAPH SEQUENCE INPUT
409
+
410
+ The model described in Section 4 conditions the output of the model on the final graph produced by the network. This is ideal when the graph represents all of the necessary knowledge for solving the task. However, it may also be desirable for each graph to represent a subset of knowledge corresponding to a particular time, and for the output to be based on the sequence of graphs produced. For instance, in the third bAbI task (which requires reasoning about the temporal sequence of events) each graph could represent the state of the word at that particular time, instead of representing the full sequence of events prior to that time. In Appendix C, section C.1, I describe a transformation to the tasks which allows all information to be contained in the graph. But this adds complexity to the graphical structure. If it were possible for the model to take into account the full sequence of graphs, instead of just the final one, we could maintain the simplicity of the graph transformation.
411
+
412
+ To this end, I present an extension of the GGT-NN model that can produce output using the full graphical sequence. In the extended model, the graphical output of the network after each input sentence is saved for later use. Then, when processing the query, the same set of query transformations are applied to every intermediate graph, producing a sequence of representation vectors hanswer1 , . $\mathbf { h } _ { 1 } ^ { \mathrm { a n s w e r } } , \ldots , \mathbf { h } _ { K } ^ { \mathrm { a n s w e r } }$ , hanswer . These are then combined into a final summary representation vector hanswersummary using a recurrent network such as a GRU layer, from which the output can be produced. The modified pseudocode for this is shown in Algorithm 2.
413
+
414
+ Table 4: Performance of the sequence-extended GGT-NN on the two bAbI tasks with a temporal component.
415
+
416
+ <table><tr><td rowspan=1 colspan=1>Task</td><td rowspan=1 colspan=1>Direct referenceAccuracy</td><td rowspan=1 colspan=1>No direct referenceAccuracy</td></tr><tr><td rowspan=1 colspan=1>3 - Three Supporting Facts5 - Three Arg. Relations</td><td rowspan=1 colspan=1>90.3%89.8%</td><td rowspan=1 colspan=1>65.4%74.2%</td></tr></table>
417
+
418
+ <table><tr><td colspan="2">Algorithm2 Sequence-Extended Pseudocode</td></tr><tr><td>9↑</td><td>Initialize G to an empty graph</td></tr><tr><td>for k from1 to K do</td><td>Process each sentence</td></tr><tr><td>9k ←Th(Sk-1,i(k))</td><td></td></tr><tr><td>if direct reference enabled then</td><td></td></tr><tr><td>9k ← Tiret(G,D(k))</td><td></td></tr><tr><td>end if</td><td></td></tr><tr><td>if intermediate propagation enabled then</td><td></td></tr><tr><td>9k←Tprop(Sk)</td><td></td></tr><tr><td>end if</td><td></td></tr><tr><td>h←Trepr(G)</td><td></td></tr><tr><td>9k←Tadd(Sk,[i(k) )hg])</td><td></td></tr><tr><td>9k ←Tc(Sk,i(k))</td><td></td></tr><tr><td>end for</td><td></td></tr><tr><td>hameary←0</td><td></td></tr><tr><td>for k from1 to K do</td><td>&gt;Process the query for each graph</td></tr><tr><td>9 ←Tuery(, query)</td><td></td></tr><tr><td>if direct reference enabled then</td><td></td></tr><tr><td>t(9k,Dquery)</td><td></td></tr><tr><td>end if</td><td></td></tr><tr><td>Tpy(G) 9k←</td><td></td></tr><tr><td>←Trepery(G)</td><td></td></tr><tr><td>answer r,summeary)</td><td></td></tr><tr><td>end for</td><td></td></tr><tr><td>return fouput(hamary)</td><td></td></tr></table>
419
+
420
+ I evaluated the extended model on bAbI tasks 3 and 5, the two tasks which asked questions about a sequence of events. (Note that although Task 14 also involves a sequence of events, it uses a set of discrete named time periods and so is not applicable to this modification.) The model was trained on each of these tasks, without the extra record and history nodes used to store the sequence, instead simply using the sequence of graphs to encode the relevant information. Due to the simpler graphs produced, intermediate propagation was also disabled.
421
+
422
+ Results from training the model are shown in Table 4. The accuracy of the extended model appears to be slightly inferior to the original model in general, although the extended direct-reference model of task 5 performs slightly better than its original counterpart. One possible explanation for the inferiority of the extended model is that the increased amount of query processing made the model more likely to overfit on the training data. Even so, the extended model shows promise, and could be advantageous for modeling complex tasks for which preprocessing the graph would be impractical.
md/train/HJ0UKP9ge/HJ0UKP9ge.md ADDED
@@ -0,0 +1,285 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # BI-DIRECTIONAL ATTENTION FLOW FOR MACHINE COMPREHENSION
2
+
3
+ Minjoon $\mathbf { S e o ^ { 1 * } }$ Aniruddha Kembhavi2 Ali Farhadi1,2 Hananneh Hajishirzi1 University of Washington1, Allen Institute for Artificial Intelligence2 {minjoon,ali,hannaneh}@cs.washington.edu, $\{ \mathtt { a n i k } \} \ @ \mathtt { a l l e n a i . o r g }$
4
+
5
+ # ABSTRACT
6
+
7
+ Machine comprehension (MC), answering a query about a given context paragraph, requires modeling complex interactions between the context and the query. Recently, attention mechanisms have been successfully extended to MC. Typically these methods use attention to focus on a small portion of the context and summarize it with a fixed-size vector, couple attentions temporally, and/or often form a uni-directional attention. In this paper we introduce the Bi-Directional Attention Flow (BIDAF) network, a multi-stage hierarchical process that represents the context at different levels of granularity and uses bidirectional attention flow mechanism to obtain a query-aware context representation without early summarization. Our experimental evaluations show that our model achieves the state-of-the-art results in Stanford Question Answering Dataset (SQuAD) and CNN/DailyMail cloze test.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ The tasks of machine comprehension (MC) and question answering (QA) have gained significant popularity over the past few years within the natural language processing and computer vision communities. Systems trained end-to-end now achieve promising results on a variety of tasks in the text and image domains. One of the key factors to the advancement has been the use of neural attention mechanism, which enables the system to focus on a targeted area within a context paragraph (for MC) or within an image (for Visual QA), that is most relevant to answer the question (Weston et al., 2015; Antol et al., 2015; Xiong et al., 2016a). Attention mechanisms in previous works typically have one or more of the following characteristics. First, the computed attention weights are often used to extract the most relevant information from the context for answering the question by summarizing the context into a fixed-size vector. Second, in the text domain, they are often temporally dynamic, whereby the attention weights at the current time step are a function of the attended vector at the previous time step. Third, they are usually uni-directional, wherein the query attends on the context paragraph or the image.
12
+
13
+ In this paper, we introduce the Bi-Directional Attention Flow (BIDAF) network, a hierarchical multi-stage architecture for modeling the representations of the context paragraph at different levels of granularity (Figure 1). BIDAF includes character-level, word-level, and contextual embeddings, and uses bi-directional attention flow to obtain a query-aware context representation. Our attention mechanism offers following improvements to the previously popular attention paradigms. First, our attention layer is not used to summarize the context paragraph into a fixed-size vector. Instead, the attention is computed for every time step, and the attended vector at each time step, along with the representations from previous layers, is allowed to flow through to the subsequent modeling layer. This reduces the information loss caused by early summarization. Second, we use a memory-less attention mechanism. That is, while we iteratively compute attention through time as in Bahdanau et al. (2015), the attention at each time step is a function of only the query and the context paragraph at the current time step and does not directly depend on the attention at the previous time step. We hypothesize that this simplification leads to the division of labor between the attention layer and the modeling layer. It forces the attention layer to focus on learning the attention between the query and the context, and enables the modeling layer to focus on learning the interaction within the query-aware context representation (the output of the attention layer). It also allows the attention at each time step to be unaffected from incorrect attendances at previous time steps. Our experiments show that memory-less attention gives a clear advantage over dynamic attention. Third, we use attention mechanisms in both directions, query-to-context and context-to-query, which provide complimentary information to each other.
14
+
15
+ ![](images/8ae29f18b08da1ee65cc07b50c3d43461883b2cbc78ed590d8d2592a92dfe01e.jpg)
16
+ Figure 1: BiDirectional Attention Flow Model (best viewed in color)
17
+
18
+ Our BIDAF model1 outperforms all previous approaches on the highly-competitive Stanford Question Answering Dataset (SQuAD) test set leaderboard at the time of submission. With a modification to only the output layer, BIDAF achieves the state-of-the-art results on the CNN/DailyMail cloze test. We also provide an in-depth ablation study of our model on the SQuAD development set, visualize the intermediate feature spaces in our model, and analyse its performance as compared to a more traditional language model for machine comprehension (Rajpurkar et al., 2016).
19
+
20
+ # 2 MODEL
21
+
22
+ Our machine comprehension model is a hierarchical multi-stage process and consists of six layers (Figure 1):
23
+
24
+ 1. Character Embedding Layer maps each word to a vector space using character-level CNNs.
25
+ 2. Word Embedding Layer maps each word to a vector space using a pre-trained word embedding model.
26
+ 3. Contextual Embedding Layer utilizes contextual cues from surrounding words to refine the embedding of the words. These first three layers are applied to both the query and context.
27
+ 4. Attention Flow Layer couples the query and context vectors and produces a set of queryaware feature vectors for each word in the context.
28
+ 5. Modeling Layer employs a Recurrent Neural Network to scan the context.
29
+ 6. Output Layer provides an answer to the query.
30
+
31
+ 1. Character Embedding Layer. Character embedding layer is responsible for mapping each word to a high-dimensional vector space. Let $\{ \pmb { x } _ { 1 } , \hdots \pmb { x } _ { T } \}$ and $\{ q _ { 1 } , \dots q _ { J } \}$ represent the words in the input context paragraph and query, respectively. Following Kim (2014), we obtain the characterlevel embedding of each word using Convolutional Neural Networks (CNN). Characters are embedded into vectors, which can be considered as 1D inputs to the CNN, and whose size is the input channel size of the CNN. The outputs of the CNN are max-pooled over the entire width to obtain a fixed-size vector for each word.
32
+
33
+ 2. Word Embedding Layer. Word embedding layer also maps each word to a high-dimensional vector space. We use pre-trained word vectors, GloVe (Pennington et al., 2014), to obtain the fixed word embedding of each word.
34
+
35
+ The concatenation of the character and word embedding vectors is passed to a two-layer Highway Network (Srivastava et al., 2015). The outputs of the Highway Network are two sequences of $d$ - dimensional vectors, or more conveniently, two matrices: $\breve { \mathbf { X } } \in \breve { \mathbb { R } } ^ { d \times T }$ for the context and $\mathbf { Q } \in \mathbb { R } ^ { d \times J }$ for the query.
36
+
37
+ 3. Contextual Embedding Layer. We use a Long Short-Term Memory Network (LSTM) (Hochreiter & Schmidhuber, 1997) on top of the embeddings provided by the previous layers to model the temporal interactions between words. We place an LSTM in both directions, and concatenate the outputs of the two LSTMs. Hence we obtain $\mathbf { H } \in \mathbb { R } ^ { 2 d \times T }$ from the context word vectors $\mathbf { X }$ , and $\mathbf { U } \in \mathbb { R } ^ { 2 d \times J }$ from query word vectors $\mathbf { Q }$ . Note that each column vector of $\mathbf { H }$ and $\mathbf { U }$ is $2 d$ -dimensional because of the concatenation of the outputs of the forward and backward LSTMs, each with $d .$ -dimensional output.
38
+
39
+ It is worth noting that the first three layers of the model are computing features from the query and context at different levels of granularity, akin to the multi-stage feature computation of convolutional neural networks in the computer vision field.
40
+
41
+ 4. Attention Flow Layer. Attention flow layer is responsible for linking and fusing information from the context and the query words. Unlike previously popular attention mechanisms (Weston et al., 2015; Hill et al., 2016; Sordoni et al., 2016; Shen et al., 2016), the attention flow layer is not used to summarize the query and context into single feature vectors. Instead, the attention vector at each time step, along with the embeddings from previous layers, are allowed to flow through to the subsequent modeling layer. This reduces the information loss caused by early summarization.
42
+
43
+ The inputs to the layer are contextual vector representations of the context H and the query U. The outputs of the layer are the query-aware vector representations of the context words, $\mathbf { G }$ , along with the contextual embeddings from the previous layer.
44
+
45
+ In this layer, we compute attentions in two directions: from context to query as well as from query to context. Both of these attentions, which will be discussed below, are derived from a shared similarity matrix, $\mathbf { S } \in \mathbb { R } ^ { T \times J }$ , between the contextual embeddings of the context $( \mathbf { H } )$ and the query (U), where $\mathbf { S } _ { t j }$ indicates the similarity between $t$ -th context word and $j$ -th query word. The similarity matrix is computed by
46
+
47
+ $$
48
+ \mathbf { S } _ { t j } = \alpha ( \mathbf { H } _ { : t } , \mathbf { U } _ { : j } ) \in \mathbb { R }
49
+ $$
50
+
51
+ where $\alpha$ is a trainable scalar function that encodes the similarity between its two input vectors, $\mathbf { H } _ { : t }$ is $t$ -th column vector of $\mathbf { H }$ , and $\mathbf { U } _ { : j }$ is $j$ -th column vector of $\mathbf { U }$ , We choose $\alpha ( \mathbf { h } , \mathbf { u } ) { \bf \bar { \alpha } } = \mathbf { w } _ { ( \mathbf { s } ) } ^ { \top } [ \mathbf { h } ; \mathbf { u } ; \mathbf { h } \circ$ $\mathbf { u } ]$ , where $\mathbf { w } _ { ( \mathbf { S } ) } \in \mathbb { R } ^ { 6 d }$ is a trainable weight vector, $\circ$ is elementwise multiplication, $[ ; ]$ is vector concatenation across row, and implicit multiplication is matrix multiplication. Now we use $\mathbf { S }$ to obtain the attentions and the attended vectors in both directions.
52
+
53
+ Context-to-query Attention. Context-to-query (C2Q) attention signifies which query words are most relevant to each context word. Let $\mathbf { a } _ { t } \in \mathbf { \overline { { \mathbb { R } } } } ^ { J }$ represent the attention weights on the query words by $t { \cdot }$ -th context word, $\textstyle \sum { \mathbf { a } } _ { t j } = 1$ for all $t$ . The attention weight is computed by $\mathbf { a } _ { t } = \mathrm { s o f t m a x } ( \mathbf { S } _ { t : } ) \in$ $\mathbb { R } ^ { J }$ , and subsequently each attended query vector is $\begin{array} { r } { \tilde { \mathbf { U } } _ { : t } = \sum _ { j } \mathbf { a } _ { t j } \mathbf { U } _ { : j } } \end{array}$ . Hence $\tilde { \textbf { U } }$ is a $2 d$ -by- $\mathcal { T }$ matrix containing the attended query vectors for the entire context.
54
+
55
+ Query-to-context Attention. Query-to-context (Q2C) attention signifies which context words have the closest similarity to one of the query words and are hence critical for answering the query.
56
+
57
+ We obtain the attention weights on the context words by $\mathbf { b } = \mathrm { s o f t m a x } ( \operatorname* { m a x } _ { c o l } ( \mathbf { S } ) ) \in \mathbb { R } ^ { T }$ , where the maximum function $( \mathrm { m a x } _ { c o l } )$ is performed across the column. Then the attended context vector is $\begin{array} { r } { \tilde { \mathbf { h } } = \sum _ { t } \mathbf { b } _ { t } \mathbf { H } _ { : t } \in \mathbb { R } ^ { 2 d } } \end{array}$ . This vector indicates the weighted sum of the most important words in the context with respect to the query. $\tilde { \mathbf { h } }$ is tiled $T$ times across the column, thus giving $\tilde { \mathbf { H } } \in \mathbb { R } ^ { 2 d \times T }$ .
58
+
59
+ Finally, the contextual embeddings and the attention vectors are combined together to yield $\mathbf { G }$ , where each column vector can be considered as the query-aware representation of each context word. We define $\mathbf { G }$ by
60
+
61
+ $$
62
+ \mathbf { G } _ { : t } = \beta ( \mathbf { H } _ { : t } , \tilde { \mathbf { U } } _ { : t } , \tilde { \mathbf { H } } _ { : t } ) \in \mathbb { R } ^ { d _ { \mathbf { G } } }
63
+ $$
64
+
65
+ where $\mathbf { G } _ { : t }$ is the $t { \cdot }$ -th column vector (corresponding to $t$ -th context word), $\beta$ is a trainable vector function that fuses its (three) input vectors, and $d _ { \mathbf { G } }$ is the output dimension of the $\beta$ function. While the $\beta$ function can be an arbitrary trainable neural network, such as multi-layer perceptron, a simple concatenation as following still shows good performance in our experiments: $\bar { \beta } ( { \bf h } , \bar { \tilde { \bf u } } , \tilde { \bf h } ) =$ $[ \mathbf { h } ; \tilde { \mathbf { u } } ; \mathbf { h } \circ \tilde { \mathbf { u } } ; \mathbf { h } \circ \tilde { \mathbf { h } } ] \in \mathbb { R } ^ { 8 d \times T }$ (i.e., $d _ { \mathbf { G } } = 8 d _ { \mathbf { \rho } }$ ).
66
+
67
+ 5. Modeling Layer. The input to the modeling layer is $\mathbf { G }$ , which encodes the query-aware representations of context words. The output of the modeling layer captures the interaction among the context words conditioned on the query. This is different from the contextual embedding layer, which captures the interaction among context words independent of the query. We use two layers of bi-directional LSTM, with the output size of $d$ for each direction. Hence we obtain a matrix $\mathbf { M } \in \mathbb { R } ^ { 2 d \times T }$ , which is passed onto the output layer to predict the answer. Each column vector of M is expected to contain contextual information about the word with respect to the entire context paragraph and the query.
68
+
69
+ 6. Output Layer. The output layer is application-specific. The modular nature of BIDAF allows us to easily swap out the output layer based on the task, with the rest of the architecture remaining exactly the same. Here, we describe the output layer for the QA task. In section 5, we use a slight modification of this output layer for cloze-style comprehension.
70
+
71
+ The QA task requires the model to find a sub-phrase of the paragraph to answer the query. The phrase is derived by predicting the start and the end indices of the phrase in the paragraph. We obtain the probability distribution of the start index over the entire paragraph by
72
+
73
+ $$
74
+ \mathbf { p } ^ { 1 } = \mathrm { s o f t m a x } ( \mathbf { w } _ { ( \mathbf { p } ^ { 1 } ) } ^ { \top } [ \mathbf { G } ; \mathbf { M } ] ) ,
75
+ $$
76
+
77
+ where $\mathbf { w } _ { ( \mathbf { p } ^ { 1 } ) } \in \mathbb { R } ^ { 1 0 d }$ is a trainable weight vector. For the end index of the answer phrase, we pass $\mathbf { M }$ to another bidirectional LSTM layer and obtain $\mathbf { M } ^ { 2 } \in \mathbb { R } ^ { 2 d \times T }$ . Then we use $\mathbf { M } ^ { 2 }$ to obtain the probability distribution of the end index in a similar manner:
78
+
79
+ $$
80
+ \mathbf { p } ^ { 2 } = \mathrm { s o f t m a x } ( \mathbf { w } _ { ( \mathbf { p } ^ { 2 } ) } ^ { \top } [ \mathbf { G } ; \mathbf { M } ^ { 2 } ] )
81
+ $$
82
+
83
+ Training. We define the training loss (to be minimized) as the sum of the negative log probabilities of the true start and end indices by the predicted distributions, averaged over all examples:
84
+
85
+ $$
86
+ L ( \theta ) = - \frac { 1 } { N } \sum _ { i } ^ { N } \log ( \mathbf { p } _ { y _ { i } ^ { 1 } } ^ { 1 } ) + \log ( \mathbf { p } _ { y _ { i } ^ { 2 } } ^ { 2 } )
87
+ $$
88
+
89
+ where $\theta$ is the set of all trainable weights in the model (the weights and biases of CNN filters and LSTM cells, $\mathbf { w } _ { ( \mathbf { S } ) } , \mathbf { w } _ { ( \mathbf { p } ^ { 1 } ) }$ and $\mathbf { w } _ { ( \mathbf { p } ^ { 2 } ) , }$ ), $N$ is the number of examples in the dataset, $y _ { i } ^ { 1 }$ and $y _ { i } ^ { 2 }$ are the true start and end indices of the $i$ -th example, respectively, and $\mathbf { p } _ { k }$ indicates the $k$ -th value of the vector $\mathbf { p }$ .
90
+
91
+ Test. The answer span $( k , l )$ where $k \leq l$ with the maximum value of $\mathbf { p } _ { k } ^ { 1 } \mathbf { p } _ { l } ^ { 2 }$ is chosen, which can be computed in linear time with dynamic programming.
92
+
93
+ # 3 RELATED WORK
94
+
95
+ Machine comprehension. A significant contributor to the advancement of MC models has been the availability of large datasets. Early datasets such as MCTest (Richardson et al., 2013) were too small to train end-to-end neural models. Massive cloze test datasets (CNN/DailyMail by Hermann et al. (2015) and Childrens Book Test by Hill et al. (2016)), enabled the application of deep neural architectures to this task. More recently, Rajpurkar et al. (2016) released the Stanford Question Answering (SQuAD) dataset with over 100,000 questions. We evaluate the performance of our comprehension system on both SQuAD and CNN/DailyMail datasets.
96
+
97
+ Previous works in end-to-end machine comprehension use attention mechanisms in three distinct ways. The first group (largely inspired by Bahdanau et al. (2015)) uses a dynamic attention mechanism, in which the attention weights are updated dynamically given the query and the context as well as the previous attention. Hermann et al. (2015) argue that the dynamic attention model performs better than using a single fixed query vector to attend on context words on CNN & DailyMail datasets. Chen et al. (2016) show that simply using bilinear term for computing the attention weights in the same model drastically improves the accuracy. Wang & Jiang (2016) reverse the direction of the attention (attending on query words as the context RNN progresses) for SQuAD. In contrast to these models, BIDAF uses a memory-less attention mechanism.
98
+
99
+ The second group computes the attention weights once, which are then fed into an output layer for final prediction (e.g., Kadlec et al. (2016)). Attention-over-attention model (Cui et al., 2016) uses a 2D similarity matrix between the query and context words (similar to Equation 1) to compute the weighted average of query-to-context attention. In contrast to these models, BIDAF does not summarize the two modalities in the attention layer and instead lets the attention vectors flow into the modeling (RNN) layer.
100
+
101
+ The third group (considered as variants of Memory Network (Weston et al., 2015)) repeats computing an attention vector between the query and the context through multiple layers, typically referred to as multi-hop (Sordoni et al., 2016; Dhingra et al., 2016). Shen et al. (2016) combine Memory Networks with Reinforcement Learning in order to dynamically control the number of hops. One can also extend our BIDAF model to incorporate multiple hops.
102
+
103
+ Visual question answering. The task of question answering has also gained a lot of interest in the computer vision community. Early works on visual question answering (VQA) involved encoding the question using an RNN, encoding the image using a CNN and combining them to answer the question (Antol et al., 2015; Malinowski et al., 2015). Attention mechanisms have also been successfully employed for the VQA task and can be broadly clustered based on the granularity of their attention and the approach to construct the attention matrix. At the coarse level of granularity, the question attends to different patches in the image (Zhu et al., 2016; Xiong et al., 2016a). At a finer level, each question word attends to each image patch and the highest attention value for each spatial location (Xu & Saenko, 2016) is adopted. A hybrid approach is to combine questions representations at multiple levels of granularity (unigrams, bigrams, trigrams) (Yang et al., 2015). Several approaches to constructing the attention matrix have been used including element-wise product, element-wise sum, concatenation and Multimodal Compact Bilinear Pooling (Fukui et al., 2016).
104
+
105
+ Lu et al. (2016) have recently shown that in addition to attending from the question to image patches, attending from the image back to the question words provides an improvement on the VQA task. This finding in the visual domain is consistent with our finding in the language domain, where our bi-directional attention between the query and context provides improved results. Their model, however, uses the attention weights directly in the output layer and does not take advantage of the attention flow to the modeling layer.
106
+
107
+ # 4 QUESTION ANSWERING EXPERIMENTS
108
+
109
+ In this section, we evaluate our model on the task of question answering using the recently released SQuAD (Rajpurkar et al., 2016), which has gained a huge attention over a few months. In the next section, we evaluate our model on the task of cloze-style reading comprehension.
110
+
111
+ Dataset. SQuAD is a machine comprehension dataset on a large set of Wikipedia articles, with more than 100,000 questions. The answer to each question is always a span in the context. The model is given a credit if its answer matches one of the human written answers. Two metrics are used to evaluate models: Exact Match (EM) and a softer metric, F1 score, which measures the weighted average of the precision and recall rate at character level. The dataset consists of $9 0 \mathrm { k } / 1 0 \mathrm { k }$
112
+
113
+ <table><tr><td></td><td colspan="2">Single Model</td><td colspan="2">Ensemble</td></tr><tr><td></td><td>EM</td><td>F1</td><td>EM</td><td>F1</td></tr><tr><td>Logistic Regression Baselinea</td><td>40.4</td><td>51.0</td><td>-</td><td>-</td></tr><tr><td>Dynamic Chunk Readerb</td><td>62.5</td><td>71.0</td><td>-</td><td>-</td></tr><tr><td>Fine-Grained Gatingc</td><td>62.5</td><td>73.3</td><td>1</td><td>-</td></tr><tr><td>Match-LSTMd</td><td>64.7</td><td>73.7</td><td>67.9</td><td>77.0</td></tr><tr><td>Multi-Perspective Matchinge</td><td>65.5</td><td>75.1</td><td>68.2</td><td>77.2</td></tr><tr><td>Dynamic Coattention Networksf</td><td>66.2</td><td>75.9</td><td>71.6</td><td>80.4</td></tr><tr><td>R-Net9</td><td>68.4</td><td>77.5</td><td>72.1</td><td>79.7</td></tr><tr><td>BIDAF (Ours)</td><td>68.0</td><td>77.3</td><td>73.3</td><td>81.1</td></tr></table>
114
+
115
+ (a) Results on the SQuAD test set
116
+
117
+ <table><tr><td></td><td>EM</td><td>F1</td></tr><tr><td>No char embedding No word embedding No C2Q attention</td><td>65.0 55.5 57.2</td><td>75.4 66.8 67.7</td></tr><tr><td>No Q2C attention Dynamic attention</td><td>63.6 63.5</td><td>73.7 73.6</td></tr><tr><td>BIDAF (single)</td><td>67.7</td><td>77.3</td></tr><tr><td>BIDAF (ensemble)</td><td>72.6</td><td>80.7</td></tr></table>
118
+
119
+ (b) Ablations on the SQuAD dev set
120
+
121
+ Table 1: (1a) The performance of our model BIDAF and competing approaches by Rajpurkar et al. $( 2 0 1 6 ) ^ { a }$ , Yu et al. $( 2 0 1 6 ) ^ { b }$ , Yang et al. $( 2 0 1 6 ) ^ { c }$ , Wang & Jiang $( 2 0 1 6 ) ^ { d }$ , IBM Watsone (unpublished), Xiong et al. $( 2 0 1 6 \mathrm { b } ) ^ { f }$ , and Microsoft Research $\mathrm { A s i a } ^ { g }$ (unpublished) on the SQuAD test set. A concurrent work by Lee et al. (2016) does not report the test scores. All results shown here reflect the SQuAD leaderboard (stanford-qa.com) as of 6 Dec 2016, $1 2 \mathrm { p m }$ PST. (1b) The performance of our model and its ablations on the SQuAD dev set. Ablation results are presented only for single runs.
122
+
123
+ train/dev question-context tuples with a large hidden test set. It is one of the largest available MC datasets with human-written questions and serves as a great test bed for our model.
124
+
125
+ Model Details. The model architecture used for this task is depicted in Figure 1. Each paragraph and question are tokenized by a regular-expression-based word tokenizer (PTB Tokenizer) and fed into the model. We use $1 0 0 ~ 1 \mathrm { D }$ filters for CNN char embedding, each with a width of 5. The hidden state size $( d )$ of the model is 100. The model has about 2.6 million parameters. We use the AdaDelta (Zeiler, 2012) optimizer, with a minibatch size of 60 and an initial learning rate of 0.5, for 12 epochs. A dropout (Srivastava et al., 2014) rate of 0.2 is used for the CNN, all LSTM layers, and the linear transformation before the softmax for the answers. During training, the moving averages of all weights of the model are maintained with the exponential decay rate of 0.999. At test time, the moving averages instead of the raw weights are used. The training process takes roughly 20 hours on a single Titan X GPU. We also train an ensemble model consisting of 12 training runs with the identical architecture and hyper-parameters. At test time, we choose the answer with the highest sum of confidence scores amongst the 12 runs for each question.
126
+
127
+ Results. The results of our model and competing approaches on the hidden test are summarized in Table 1a. BIDAF (ensemble) achieves an EM score of 73.3 and an F1 score of 81.1, outperforming all previous approaches.
128
+
129
+ Ablations. Table 1b shows the performance of our model and its ablations on the SQuAD dev set. Both char-level and word-level embeddings contribute towards the model’s performance. We conjecture that word-level embedding is better at representing the semantics of each word as a whole, while char-level embedding can better handle out-of-vocab (OOV) or rare words. To evaluate bidirectional attention, we remove C2Q and Q2C attentions. For ablating C2Q attention, we replace the attended question vector $\tilde { \textbf { U } }$ with the average of the output vectors of the question’s contextual embedding layer (LSTM). C2Q attention proves to be critical with a drop of more than 10 points on both metrics. For ablating Q2C attention, the output of the attention layer, G, does not include terms that have the attended Q2C vectors, $\tilde { \bf H }$ . To evaluate the attention flow, we study a dynamic attention model, where the attention is dynamically computed within the modeling layer’s LSTM, following previous work (Bahdanau et al., 2015; Wang & Jiang, 2016). This is in contrast with our approach, where the attention is pre-computed before flowing to the modeling layer. Despite being a simpler attention mechanism, our proposed static attention outperforms the dynamically computed attention by more than 3 points. We conjecture that separating out the attention layer results in a richer set of features computed in the first 4 layers which are then incorporated by the modeling layer. We also show the performance of BIDAF with several different definitions of $\alpha$ and $\beta$ functions (Equation 1 and 2) in Appendix B.
130
+
131
+ <table><tr><td>Layer</td><td>Query</td><td>Closest words in the Context using cosine similarity</td></tr><tr><td>Word</td><td>When</td><td>when,When,After,after,He,he,But,but,before,Before</td></tr><tr><td>Contextual</td><td>When</td><td>When, when,1945,1991,1971,1967,1990,1972,1965,1953</td></tr><tr><td>Word</td><td>Where</td><td>Where,where,It,IT,it,they,They,that,That,city</td></tr><tr><td>Contextual</td><td>Where</td><td>where,Where,Rotterdam,area,Nearby,location,outside,Area,across,locations</td></tr><tr><td>Word Contextual</td><td>Who Who</td><td>Who,who,He,he,had,have,she,She,They,they who,whose,whom,Guiscard, person, John,Thomas,families,Elway,Louis</td></tr><tr><td>Word Contextual</td><td>city</td><td>City,city, town,Town, Capital,capital, district, cities,province,Downtown</td></tr><tr><td>Word</td><td>city January</td><td>city,City,Angeles,Paris,Prague,Chicago,Port,Pittsburgh,London,Manhattan July,December,June,October,Juary,eptember,February,April,November,rch</td></tr><tr><td>Contextual</td><td>January</td><td>January,March,December,August,December,July,July,July,March,December</td></tr><tr><td>Word</td><td>Seahawks</td><td>Seahawks,Broncos,49ers,Ravens,Chargers,Steelers,quarterback,Vikings,Colts,NFL</td></tr><tr><td>Contextual Word</td><td>Seahawks</td><td>Seahawks,Broncos,Panthers,Vikings,Packers,Ravens,Patriots,Falcons,Steelers,Chargers</td></tr><tr><td>Contextual</td><td>date</td><td>date,dates,until,Until,June,July,Year,year,December,deadline</td></tr><tr><td></td><td>date</td><td>date,dates,December,July,January,October,June,November,March,February</td></tr></table>
132
+
133
+ ![](images/7757c7656332a6a3b06f97b0ebf7763ba27b455d0c2af2acf07a0dcd8b41d2e2.jpg)
134
+ Table 2: Closest context words to a given query word, using a cosine similarity metric computed in the Word Embedding feature space and the Phrase Embedding feature space.
135
+ Figure 2: (a) t-SNE visualizations of the months names embedded in the two feature spaces. The contextual embedding layer is able to distinguish the two usages of the word May using context from the surrounding text. (b) Venn diagram of the questions answered correctly by our model and the more traditional baseline (Rajpurkar et al., 2016). (c) Correctly answered questions broken down by the 10 most frequent first words in the question.
136
+
137
+ Visualizations. We now provide a qualitative analysis of our model on the SQuAD dev set. First, we visualize the feature spaces after the word and contextual embedding layers. These two layers are responsible for aligning the embeddings between the query and context words which are the inputs to the subsequent attention layer. To visualize the embeddings, we choose a few frequent query words in the dev data and look at the context words that have the highest cosine similarity to the query words (Table 2). At the word embedding layer, query words such as When, Where and Who are not well aligned to possible answers in the context, but this dramatically changes in the contextual embedding layer which has access to context from surrounding words and is just 1 layer below the attention layer. When begins to match years, Where matches locations, and Who matches names.
138
+
139
+ We also visualize these two feature spaces using t-SNE in Figure 2. t-SNE is performed on a large fraction of dev data but we only plot data points corresponding to the months of the year. An interesting pattern emerges in the Word space, where May is separated from the rest of the months because May has multiple meanings in the English language. The contextual embedding layer uses contextual cues from surrounding words and is able to separate the usages of the word May. Finally we visualize the attention matrices for some question-context tuples in the dev data in Figure 3. In the first example, Where matches locations and in the second example, many matches quantities and numerical symbols. Also, entities in the question typically attend to the same entities in the context, thus providing a feature for the model to localize possible answers.
140
+
141
+ Discussions. We analyse the performance of our our model with a traditional language-featurebased baseline (Rajpurkar et al., 2016). Figure 2b shows a Venn diagram of the dev set questions correctly answered by the models. Our model is able to answer more than $86 \%$ of the questions correctly answered by the baseline. The $14 \%$ that are incorrectly answered does not have a clear pattern. This suggests that neural architectures are able to exploit much of the information captured by the language features. We also break this comparison down by the first words in the questions (Figure 2c). Our model outperforms the traditional baseline comfortably in every category.
142
+
143
+ ![](images/26d62f32002af2aad3857c67045cb6f5ec597c54027d4550e780e69ce794908c.jpg)
144
+ Figure 3: Attention matrices for question-context tuples. The left palette shows the context paragraph (correct answer in red and underlined), the middle palette shows the attention matrix (each row is a question word, each column is a context word), and the right palette shows the top attention points for each question word, above a threshold.
145
+
146
+ Error Analysis. We randomly select 50 incorrect questions (based on EM) and categorize them into 6 classes. $50 \%$ of errors are due to the imprecise boundaries of the answers, $28 \%$ involve syntactic complications and ambiguities, $14 \%$ are paraphrase problems, $4 \%$ require external knowledge, $2 \%$ need multiple sentences to answer, and $2 \%$ are due to mistakes during tokenization. See Appendix A for the examples of the error modes.
147
+
148
+ # 5 CLOZE TEST EXPERIMENTS
149
+
150
+ We also evaluate our model on the task of cloze-style reading comprehension using the CNN and Daily Mail datasets (Hermann et al., 2015).
151
+
152
+ Dataset. In a cloze test, the reader is asked to fill in words that have been removed from a passage, for measuring one’s ability to comprehend text. Hermann et al. (2015) have recently compiled a massive Cloze-style comprehension dataset, consisting of $3 0 0 \mathrm { k } / 4 \mathrm { k } / 3 \mathrm { k }$ and 879k/65k/53k (train/dev/test) examples from CNN and DailyMail news articles, respectively. Each example has a news article and an incomplete sentence extracted from the human-written summary of the article. To distinguish this task from language modeling and force one to refer to the article to predict the correct missing word, the missing word is always a named entity, anonymized with a random ID. Also, the IDs must be shuffled constantly during test, which is also critical for full anonymization.
153
+
154
+ Model Details. The model architecture used for this task is very similar to that for SQuAD (Section 4) with only a few small changes to adapt it to the cloze test. Since each answer in the CNN/DailyMail datasets is always a single word (entity), we only need to predict the start index $( \mathbf { p } ^ { 1 } )$ ; the prediction for the end index $( \mathbf { p } ^ { 2 } )$ is omitted from the loss function. Also, we mask out all non-entity words in the final classification layer so that they are forced to be excluded from possible answers. Another important difference from SQuAD is that the answer entity might appear more than once in the context paragraph. To address this, we follow a similar strategy from Kadlec et al. (2016). During training, after we obtain $\mathbf { p } ^ { 1 }$ , we sum all probability values of the entity instances in the context that correspond to the correct answer. Then the loss function is computed from the summed probability. We use a minibatch size of 48 and train for 8 epochs, with early stop when the accuracy on validation data starts to drop. Inspired by the window-based method (Hill et al., 2016), we split each article into short sentences where each sentence is a 19-word window around each entity (hence the same word might appear in multiple sentences). The RNNs in BIDAF are not feed-forwarded or back-propagated across sentences, which speed up the training process by parallelization. The entire training process takes roughly 60 hours on eight Titan X GPUs. The other hyper-parameters are identical to the model described in Section 4.
155
+
156
+ Results. The results of our single-run models and competing approaches on the CNN/DailyMail datasets are summarized in Table 3. ∗ indicates ensemble methods. BIDAF outperforms previous single-run models on both datasets for both val and test data. On the DailyMail test, our single-run model even outperforms the best ensemble method.
157
+
158
+ Table 3: Results on CNN/DailyMail datasets. We also include the results of previous ensemble methods (marked with $^ *$ ) for completeness.
159
+
160
+ <table><tr><td rowspan="2"></td><td colspan="2">CNN</td><td colspan="2">DailyMail</td></tr><tr><td>val</td><td>test</td><td>val</td><td>test</td></tr><tr><td>Attentive Reader (Hermann et al.,2015)</td><td>61.6</td><td>63.0</td><td>70.5</td><td>69.0</td></tr><tr><td>MemNN (Hill et al.,2016)</td><td>63.4</td><td>6.8</td><td>=</td><td></td></tr><tr><td>AS Reader (Kadlec et al.,2016)</td><td>68.6</td><td>69.5</td><td>75.0</td><td>73.9</td></tr><tr><td>DER Network (Kobayashi et al.,2016)</td><td>71.3</td><td>72.9</td><td>1</td><td>-</td></tr><tr><td>Iterative Attention (Sordoni et al.,2016)</td><td>72.6</td><td>73.3</td><td>-</td><td>=</td></tr><tr><td>EpiReader (Trischler et al.,2016) Stanford AR (Chen et al.,2016)</td><td>73.4</td><td>74.0</td><td>=</td><td>-</td></tr><tr><td>GAReader (Dhingra et al.,2016)</td><td>73.8</td><td>73.6</td><td>77.6</td><td>76.6</td></tr><tr><td>AoA Reader (Cui et al., 2016)</td><td>73.0</td><td>73.8</td><td>76.7</td><td>75.7</td></tr><tr><td></td><td>73.1</td><td>74.4</td><td></td><td>=</td></tr><tr><td>ReasoNet (Shen et al.,2016) BIDAF (Ours)</td><td>72.9</td><td>74.7</td><td>77.6</td><td>76.6</td></tr><tr><td>MemNN* (Hill et al., 2016)</td><td>76.3</td><td>76.9</td><td>80.3</td><td>79.6</td></tr><tr><td></td><td>66.2</td><td>69.4</td><td>-</td><td>=</td></tr><tr><td>ASReader* (Kadlec et al.,2016)</td><td>73.9</td><td>75.4</td><td>78.7</td><td>77.7</td></tr><tr><td>Iterative Attention*(Sordoni et al.,2016)</td><td>74.5</td><td>75.7</td><td>-</td><td>-</td></tr><tr><td>GA Reader* (Dhingra et al.,2016)</td><td>76.4</td><td>77.4</td><td>79.1</td><td>78.1</td></tr><tr><td>Stanford AR*(Chen et al., 2016)</td><td>77.2</td><td>77.6</td><td>80.2</td><td>79.2</td></tr></table>
161
+
162
+ # 6 CONCLUSION
163
+
164
+ In this paper, we introduce BIDAF, a multi-stage hierarchical process that represents the context at different levels of granularity and uses a bi-directional attention flow mechanism to achieve a queryaware context representation without early summarization. The experimental evaluations show that our model achieves the state-of-the-art results in Stanford Question Answering Dataset (SQuAD) and CNN/DailyMail cloze test. The ablation analyses demonstrate the importance of each component in our model. The visualizations and discussions show that our model is learning a suitable representation for MC and is capable of answering complex questions by attending to correct locations in the given paragraph. Future work involves extending our approach to incorporate multiple hops of the attention layer.
165
+
166
+ # ACKNOWLEDGMENTS
167
+
168
+ This research was supported by the NSF (IIS 1616112), NSF (III 1703166), Allen Institute for AI (66-9175), Allen Distinguished Investigator Award, Google Research Faculty Award, and Samsung GRO Award. We thank the anonymous reviewers for their helpful comments.
169
+
170
+ # REFERENCES
171
+
172
+ Stanislaw Antol, Aishwarya Agrawal, Jiasen Lu, Margaret Mitchell, Dhruv Batra, C Lawrence Zitnick, and Devi Parikh. Vqa: Visual question answering. In ICCV, 2015.
173
+
174
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. ICLR, 2015.
175
+
176
+ Danqi Chen, Jason Bolton, and Christopher D. Manning. A thorough examination of the cnn/daily mail reading comprehension task. In ACL, 2016.
177
+
178
+ Yiming Cui, Zhipeng Chen, Si Wei, Shijin Wang, Ting Liu, and Guoping Hu. Attention-overattention neural networks for reading comprehension. arXiv preprint arXiv:1607.04423, 2016.
179
+
180
+ Bhuwan Dhingra, Hanxiao Liu, William W Cohen, and Ruslan Salakhutdinov. Gated-attention readers for text comprehension. arXiv preprint arXiv:1606.01549, 2016.
181
+
182
+ Akira Fukui, Dong Huk Park, Daylen Yang, Anna Rohrbach, Trevor Darrell, and Marcus Rohrbach. Multimodal compact bilinear pooling for visual question answering and visual grounding. In EMNLP, 2016.
183
+
184
+ Karl Moritz Hermann, Tomas Kocisk ´ y, Edward Grefenstette, Lasse Espeholt, Will Kay, Mustafa ´ Suleyman, and Phil Blunsom. Teaching machines to read and comprehend. In NIPS, 2015.
185
+
186
+ Felix Hill, Antoine Bordes, Sumit Chopra, and Jason Weston. The goldilocks principle: Reading children’s books with explicit memory representations. In ICLR, 2016.
187
+
188
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. Neural Computation, 1997.
189
+
190
+ Rudolf Kadlec, Martin Schmid, Ondrej Bajgar, and Jan Kleindienst. Text understanding with the attention sum reader network. In ACL, 2016.
191
+
192
+ Yoon Kim. Convolutional neural networks for sentence classification. In EMNLP, 2014.
193
+
194
+ Sosuke Kobayashi, Ran Tian, Naoaki Okazaki, and Kentaro Inui. Dynamic entity representation with max-pooling improves machine reading. In NAACL-HLT, 2016.
195
+
196
+ Kenton Lee, Tom Kwiatkowski, Ankur Parikh, and Dipanjan Das. Learning recurrent span representations for extractive question answering. arXiv preprint arXiv:1611.01436, 2016.
197
+
198
+ Jiasen Lu, Jianwei Yang, Dhruv Batra, and Devi Parikh. Hierarchical question-image co-attention for visual question answering. In NIPS, 2016.
199
+
200
+ Mateusz Malinowski, Marcus Rohrbach, and Mario Fritz. Ask your neurons: A neural-based approach to answering questions about images. In ICCV, 2015.
201
+
202
+ Jeffrey Pennington, Richard Socher, and Christopher D Manning. Glove: Global vectors for word representation. In EMNLP, 2014.
203
+
204
+ Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. Squad: $1 0 0 { , } 0 0 0 { + }$ questions for machine comprehension of text. In EMNLP, 2016.
205
+
206
+ Matthew Richardson, Christopher JC Burges, and Erin Renshaw. Mctest: A challenge dataset for the open-domain machine comprehension of text. In EMNLP, 2013.
207
+
208
+ Yelong Shen, Po-Sen Huang, Jianfeng Gao, and Weizhu Chen. Reasonet: Learning to stop reading in machine comprehension. arXiv preprint arXiv:1609.05284, 2016.
209
+
210
+ Alessandro Sordoni, Phillip Bachman, and Yoshua Bengio. Iterative alternating neural attention for machine reading. arXiv preprint arXiv:1606.02245, 2016.
211
+
212
+ Nitish Srivastava, Geoffrey E. Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. JMLR, 2014.
213
+
214
+ Rupesh Kumar Srivastava, Klaus Greff, and Jurgen Schmidhuber. Highway networks. ¨ arXiv preprint arXiv:1505.00387, 2015.
215
+
216
+ Adam Trischler, Zheng Ye, Xingdi Yuan, and Kaheer Suleman. Natural language comprehension with the epireader. In EMNLP, 2016.
217
+ Shuohang Wang and Jing Jiang. Machine comprehension using match-lstm and answer pointer. arXiv preprint arXiv:1608.07905, 2016.
218
+ Jason Weston, Sumit Chopra, and Antoine Bordes. Memory networks. In ICLR, 2015.
219
+ Caiming Xiong, Stephen Merity, and Richard Socher. Dynamic memory networks for visual and textual question answering. In ICML, 2016a.
220
+ Caiming Xiong, Victor Zhong, and Richard Socher. Dynamic coattention networks for question answering. arXiv preprint arXiv:1611.01604, 2016b.
221
+ Huijuan Xu and Kate Saenko. Ask, attend and answer: Exploring question-guided spatial attention for visual question answering. In ECCV, 2016.
222
+ Zhilin Yang, Bhuwan Dhingra, Ye Yuan, Junjie Hu, William W Cohen, and Ruslan Salakhutdinov. Words or characters? fine-grained gating for reading comprehension. arXiv preprint arXiv:1611.01724, 2016.
223
+ Zichao Yang, Xiaodong He, Jianfeng Gao, Li Deng, and Alex Smola. Stacked attention networks for image question answering. arXiv preprint arXiv:1511.02274, 2015.
224
+ Yang Yu, Wei Zhang, Kazi Hasan, Mo Yu, Bing Xiang, and Bowen Zhou. End-to-end reading comprehension with dynamic answer chunk ranking. arXiv preprint arXiv:1610.09996, 2016.
225
+ Matthew D Zeiler. Adadelta: an adaptive learning rate method. arXiv preprint arXiv:1212.5701, 2012.
226
+ Yuke Zhu, Oliver Groth, Michael S. Bernstein, and Li Fei-Fei. Visual7w: Grounded question answering in images. In CVPR, 2016.
227
+
228
+ # A ERROR ANALYSIS
229
+
230
+ Table 4 summarizes the modes of errors by BIDAF and shows examples for each category of error in SQuAD.
231
+
232
+ <table><tr><td>Error type</td><td>Ratio (%)</td><td>Example</td></tr><tr><td>Imprecise answer boundaries</td><td>50</td><td>Context: “The Free Movement of Workers Regulation articles 1 to 7 set out the main provisions on equal treatment of workers.” Question:“Which articles of the Free Movement of Workers Regulation set out the primary provisions on equal treatment of workers?” Prediction: “1 to 7&quot;, Answer: “articles 1 to 7”</td></tr><tr><td>Syntactic complications and ambiguities</td><td>28</td><td>Context: “A piece of paper was later found on which Luther had written his last statement.” Question: “What was later discovered written by Luther?&quot; Prediction: “A piece of paper&quot;,Answer: “his last statement&quot;</td></tr><tr><td>Paraphrase problems</td><td>14</td><td>tier model which includes primary education (primary schools), followed by secondary education (secondary schools/high schools) and tertiary education (universities and/or TAFE colleges).” Question:“What is the first model of education, in the Aus- tralian system?” Prediction: “three-tier”,Answer: “primary education&quot;</td></tr><tr><td>External knowledge</td><td>4</td><td>Context:“On June 4, 2014, the NFL announced that the practice of branding Super Bowl games with Roman numerals, a practice established at Super Bowl V,would be temporarily suspended,and that the game would be named using Arabic numerals as Super Bowl 50 as opposed to Super Bowl L.&quot; Question: “If Roman numerals were used in the naming of the 50th Super Bowl, which one would have been used?&#x27; Prediction: “Super Bowl 5O”, Answer: “L&quot;</td></tr><tr><td>Multi- sentence</td><td>2 starting in the mid-1980s.&quot;</td><td>interactive connections the network was enhanced to support terminal to host connections,host to host batch connections (remote job submission,remote printing,batch file transfer), interactive file transfer, gateways to the Tymnet and Telenet public data networks, X.25 host atachments, gateways to X.25 data networks,Ethernet attached hosts,and eventually TCP/IP and additional public universities in Michigan join the network. All of this set the stage for Merit&#x27;s role in the NSFNET project Question: “What set the stage for Merits role in NSFNET&quot; Prediction:“All of this set the stage for Merit &#x27;s role in the</td></tr><tr><td>Incorrect preprocessing</td><td>2</td><td>this work by showing that fire requires only a part of air that he called spiritus nitroaereus or just nitroaereus.&quot; Question: “John Mayow died in what year?&quot; Prediction: “1641-1679&quot;,Answer: “1679&quot;</td></tr></table>
233
+
234
+ into 6 different categories. Only relevant sentence(s) from the context shown for brevity.
235
+
236
+ # B VARIATIONS OF SIMILARITY AND FUSION FUNCTIONS
237
+
238
+ <table><tr><td></td><td>EM</td><td>F1</td></tr><tr><td>Eqn. 1: dot product Eqn. 1: linear Eqn. 1: bilinear</td><td>65.5 59.5 61.6</td><td>75.5 69.7 71.8</td></tr><tr><td>Eqn. 1: linear after MLP</td><td>66.2</td><td>76.4</td></tr><tr><td>Eqn. 2: MLP after concat</td><td>67.1</td><td>77.0</td></tr><tr><td>BIDAF (single)</td><td>68.0</td><td>77.3</td></tr></table>
239
+
240
+ Table 5: Variations of similarity function $\alpha$ (Equation 1) and fusion function $\beta$ (Equation 2) and their performance on the dev data of SQuAD. See Appendix B for the details of each variation.
241
+
242
+ In this appendix section, we experimentally demonstrate how different choices of the similarity function $\alpha$ (Equation 1) and the fusion function $\beta$ (Equation 2) impact the performance of our model. Each variation is defined as following:
243
+
244
+ Eqn. 1: dot product. Dot product $\alpha$ is defined as
245
+
246
+ $$
247
+ \alpha ( \mathbf { h } , \mathbf { u } ) = \mathbf { h } ^ { \top } \mathbf { u }
248
+ $$
249
+
250
+ where $\top$ indicates matrix transpose. Dot product has been used for the measurement of similarity between two vectors by Hill et al. (2016).
251
+
252
+ Eqn. 1: linear. Linear $\alpha$ is defined as
253
+
254
+ $$
255
+ \alpha ( \mathbf { h } , \mathbf { u } ) = \mathbf { w } _ { \mathrm { l i n } } ^ { \top } [ \mathbf { h } ; \mathbf { u } ]
256
+ $$
257
+
258
+ where $\mathbf { w } _ { \mathrm { l i n } } ^ { \top } \in \mathbb { R } ^ { 4 d }$ is a trainable weight matrix. This can be considered as the simplification of Equation 1 by dropping the term $\mathbf { h } \circ \mathbf { u }$ in the concatenation.
259
+
260
+ Eqn. 1: bilinear. Bilinear $\alpha$ is defined as
261
+
262
+ $$
263
+ \alpha ( \mathbf { h } , \mathbf { u } ) = \mathbf { h } ^ { \top } \mathbf { W } _ { \mathbf { \mathrm { b i } } } \mathbf { u }
264
+ $$
265
+
266
+ where $\mathbf { W _ { \mathrm { b i } } } \in \mathbb { R } ^ { 2 d \times 2 d }$ is a trainable weight matrix. Bilinear term has been used by Chen et al.
267
+ (2016).
268
+
269
+ Eqn. 1: linear after MLP. We can also perform linear mapping after single layer of perceptron:
270
+
271
+ $$
272
+ \alpha ( \mathbf { h } , \mathbf { u } ) = \mathbf { w } _ { \mathrm { l i n } } ^ { \top } \operatorname { t a n h } ( \mathbf { W } _ { \mathrm { m l p } } [ \mathbf { h } ; \mathbf { u } ] + \mathbf { b } _ { \mathrm { m l p } } )
273
+ $$
274
+
275
+ where $\mathbf { W } _ { \mathrm { m l p } }$ and $\mathbf { b } _ { \mathrm { m l p } }$ are trainable weight matrix and bias, respectively. Linear mapping after perceptron layer has been used by Hermann et al. (2015).
276
+
277
+ Eqn. 2: MLP after concatenation. We can define $\beta$ as
278
+
279
+ $$
280
+ \beta ( \mathbf { h } , { \tilde { \mathbf { u } } } , { \tilde { \mathbf { h } } } ) = \operatorname* { m a x } ( 0 , \mathbf { W } _ { \mathrm { m l p } } [ \mathbf { h } ; { \tilde { \mathbf { u } } } ; \mathbf { h } \circ { \tilde { \mathbf { u } } } ; \mathbf { h } \circ { \tilde { \mathbf { h } } } ] + \mathbf { b } _ { \mathrm { m l p } } )
281
+ $$
282
+
283
+ where $\mathbf { W } _ { \mathrm { m l p } } \in \mathbb { R } ^ { 2 d \times 8 d }$ and ${ \bf b } _ { \mathrm { m l p } } \in \mathbb { R } ^ { 2 d }$ are trainable weight matrix and bias. This is equivalent to adding ReLU after linearly transforming the original definition of $\beta$ . Since the output dimension of $\beta$ changes, the input dimension of the first LSTM of the modeling layer will change as well.
284
+
285
+ The results of these variations on the dev data of SQuAD are shown in Table 5. It is important to note that there are non-trivial gaps between our definition of $\alpha$ and other definitions employed by previous work. Adding MLP in $\beta$ does not seem to help, yielding slightly worse result than $\beta$ without MLP.
md/train/HJ1HFlZAb/HJ1HFlZAb.md ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # EVALUATION OF GENERATIVE NETWORKS THROUGH THEIR DATA AUGMENTATION CAPACITY
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Generative networks are known to be difficult to assess. Recent works on generative models, especially on generative adversarial networks, produce nice samples of varied categories of images. But the validation of their quality is highly dependent on the method used. A good generator should generate data which contain meaningful and varied information and that fit the distribution of a dataset. This paper presents a new method to assess a generator. Our approach is based on training a classifier with a mixture of real and generated samples. We train a generative model over a labeled training set, then we use this generative model to sample new data points that we mix with the original training data. This mixture of real and generated data is thus used to train a classifier which is afterwards tested on a given labeled test dataset. We compare this result with the score of the same classifier trained on the real training data mixed with noise. By computing the classifier’s accuracy with different ratios of samples from both distributions (real and generated) we are able to estimate if the generator successfully fits and is able to generalize the distribution of the dataset. Our experiments compare different generators from the VAE and GAN framework on MNIST and fashion MNIST dataset.
8
+
9
+ # 1 INTRODUCTION AND MOTIVATION
10
+
11
+ Generative network approaches have been widely used to generate samples in recent years. Methods such as GAN (Goodfellow et al., 2014), WGAN (Arjovsky et al., 2017), CGAN (Mirza & Osindero, 2014), CVAE (Sohn et al., 2015) and VAE (Kingma & Welling, 2014) have produced nice samples on various image datasets such as MNIST, bedrooms (Radford et al., 2015) or imageNet (Nguyen et al., 2017).
12
+
13
+ One commonly accepted tool to evaluate a generative model trained on images is visual assessment to validate the realistic character of samples. One case of this method is called ’visual Turing tests’, in which samples are visualized by humans who try to guess if the images are generated or not. It has been used to assess generative models of images from ImageNet (Denton et al., 2015) and also on digit images (Lake et al., 2015). Salimans et al. (2016) proposes to automate this method with the inception score, which replaces the human judgment by the use of a pretrained classifier to assess the variability of the samples with an entropy measure of the predicted classes and the confidence in the prediction. Unfortunately, those two methods do not indicate if the generator collapses to a particular mode of the data distribution. Log-likelihood based evaluation metrics were widely used to evaluate generative models but as shown in Lucas Theis & Bethge (2016), those evaluations can be misleading in high dimensional cases.
14
+
15
+ The solution we propose to estimate both sample quality and global fit of the data distribution is to incorporate generated data into the training phase of a classifier before evaluating it. Using generated samples for training has several advantages over using only the original dataset. First, it can make training more efficient when the amount of data is low. As shown in $\mathrm { N g } \ \&$ Jordan (2002), where the conditional distribution $P ( { Y \vert } X )$ (X represents the samples and Y the classes) learned by a generative model is compared to the same conditional distribution learned by a discriminative model, the generative model performs better in learning this conditional distribution by regularizing the model when the amount of data is low. Secondly, once the generative model is trained, it can sample as much images as needed and can produce interpolations between two images which will induce less risk of overfitting on the data. Other works use generative models for data augmentation (Ratner et al., 2017) or to produce labeled data (Sixt et al., 2016) in order to improve the training of discriminative models, but their intention is not to use it to evaluate or compare generative neural networks.
16
+
17
+ Our method evaluates the quality of a generative model by assessing its capacity to fit the real distribution of the data. For this purpose, we use the samples generated by a given trained generative model. Our work aims to show how this data augmentation can benefit the training of a classifier and how we can use this benefit as an evaluation tool in order to assess a generative model. This method evaluates whether the information of the original distribution is still present in the generated data and whether the generator is able to produce new samples that are eventually close to unseen data. We compare classifiers trained over mixtures of generated and real data with varying ratios and with varying total amounts of data. This allows us to compare generative models in various data settings (i.e., when there is few or many data points).
18
+
19
+ The next section will present the related work on generative models, the exploitation of the generated samples and their evaluation. We then present our generative model evaluation framework before presenting experimental results on several generative models with different datasets.
20
+
21
+ # 2 RELATED WORK
22
+
23
+ # 2.1 GENERATIVE MODELS
24
+
25
+ The variational auto-encoder (VAE) framework (Kingma & Welling, 2014), (Rezende et al., 2014) is a particular kind of auto-encoder which has control over its latent space, in which each variable is a sample from a prior distribution, often chosen as an univariate normal distribution $\mathbf { N } ( 0 , I )$ (where $I$ is the identity matrix). The VAE learns to map this low dimensional latent space to the observation space. This characteristic makes the VAE an interesting option for generating new data after training. The particularity of the latent space comes from the minimization of the KL divergence between the distribution of the latent space and the prior $\mathbf { N } ( 0 , I )$ . For the sake of simplicity, in this paper we will speak about the decoder of the VAE as a generator.
26
+
27
+ Generative adversarial networks (Goodfellow et al., 2014) are a framework of models that learn by a game between two networks: a generator that learns to produce images from a distribution $P$ and a discriminator which learns to discriminate between generated and true images. The generator wants to fool the discriminator and the discriminator wants to beat the generator. This class of generative models can produce visually realistic samples from diverse datasets but they suffer from instabilities in their training. Some recent approaches such as Wasserstein GAN (WGAN) (Arjovsky et al., 2017) try to address those issues by enforcing a Lipschitz constraint on the discriminator.
28
+
29
+ Conditional neural networks (Sohn et al., 2015) and in particular Conditional Variational Autoencoders (CVAE) or Conditional Generative adversarial networks (CGAN) (Mirza & Osindero, 2014) are a class of generative models that have control over the sample’s class. By imposing a label during training, a conditional generative network can generate from any class and thus produces labeled data. The conditional approach has been used to improve the quality of generative networks and make them more discriminative (Odena et al., 2017). They are particularly adapted for our setup because we need to generate labeled data to train our classifiers.
30
+
31
+ # 2.2 EXPLOITATION AND EVALUATION OF GENERATED SAMPLES
32
+
33
+ In Ratner et al. (2017), a generator is used to perform data augmentation. Instead of designing a composition of fine tuned transformations for this objective, the authors use adversarial training to learn a sequence of incremental operations (for example rotating or swapping words in a sentence). Their approach uses a GAN to be able to generalize in terms of better data-augmentation and to increase their performance on different datasets such as Cifar10 and the ACE relation extraction task. Sixt et al. (2016) also learns a sequence of transformations with generative networks from the GAN family, but they use a 3D model as input and create an augmented view of it. Our approach is similar by using generative networks for data-augmentation but we do not attempt to learn transformations.
34
+
35
+ Instead, we use the generated data to assess if the generative model has been able to generalize over the distribution of the data.
36
+
37
+ The evaluation of generative networks is discussed in Lucas Theis & Bethge (2016). The authors show that different metrics (as Parzen windows, Nearest Neighbor or Log likelihood) applied to generative models can lead to different results. Good results in one application of a generative model can not be used as evidence of good performance in another application. Their conclusion is that evaluation based on sample visual quality is a bad indicator for the entropy of samples. Conversely, the log-likelihood can be used to produce samples with high entropy but does not assure good visual quality. The method we propose can both estimate the quality and the entropy of samples as we will show in Section 3.
38
+
39
+ The quality of the internal representation of a generator can also be estimated with a discriminator. In Radford et al. (2015) they use the discriminator of a ACGAN as feature extractor for evaluating the quality of unsupervised representation learning algorithms. They apply the feature extractor on supervised datasets and evaluate the performance of linear models fitted on top of these features. They experiment a good accuracy on Cifar10 thanks to this method. This approach gives insight on how the discriminator estimates if an image is true or false. If the discriminator has good enough feature extractors for classification, it means that the generator samples are hard to be discriminated from samples from the true distribution. It assess indirectly the quality of the generator. This method is however applicable only if a deep convolutional neural networks is used as discriminator and can not be applied, e.g., on variational auto-encoders. The principal difference between a discriminator and our classifier is that it is not involved in the training process. In our approach, the generator is completely independent from the classifier and therefore there is no bias from the classifier in the generator.
40
+
41
+ Parzen windows estimate is a method to estimate the unknown probability density function $f$ of a probability distribution $P$ . This method uses a mixture of simpler probability density functions, called kernels, as approximates for $f$ . In general, a popular kernel used is an isotropic Gaussian centered on a given data point with a small variance (the variance is an hyper parameter here). The idea, like other methods based on Kernel Density Estimation, is to have a small window on each data point such that we apply some smoothing over the function we try to approximate. However, even if the number of samples is high, Parzen windows estimator can be still very far from the true likelihood as shown in Lucas Theis & Bethge (2016), and thus cannot be a good approach to evaluate if the data distribution learned by a model is close to the original one.
42
+
43
+ Multi-scale structural similarity (MS-SIM, Wang et al. (2003)) is a measurement that gives a way to incorporate image details at different resolutions in order to compare two images. This similarity is generally used in the context of image compression to compare image before and after compression. In Odena et al. (2017) the authors use this similarity to estimate the variability inside a class. They randomly sample two images of a certain class and measure the MS-SIM. If the result is high, then images are considered different. By operating this process several times, the similarity should give an insight on the entropy of $P ( X | Y )$ (X a data point and $\mathrm { Y }$ its class): if the MS-SIM gives high result, the entropy is high; otherwise, the entropy is low. However, it can not estimate if the sample comes from one or several modes of the distribution $P ( X | Y )$ . For example, if we want to generate images of cats, the MS-SIM similarity can not differentiate a generator that produces different kinds of black cats from a network that produces different cats of different colors. In our method, if the generator is able to generate in only one mode of $P ( X | Y )$ , the score will be low in the testing phase.
44
+
45
+ Another approach that aims to evaluate a generative model by using a conditional distribution learned by a classifier is the inception score (Salimans et al., 2016; Odena et al., 2017). The authors use a pretrained inception classifier model to get the conditional label distribution $P ( { Y \vert } X )$ over the generated samples. They proposed the following score in order to evaluate a generative model:
46
+
47
+ $$
48
+ \exp ( \mathbb { E } _ { X } K L ( P _ { d a t a } ( Y | X ) \parallel P ( Y ) ) ,
49
+ $$
50
+
51
+ When the score is high, the generator produces samples on varied classes (Cross entropy of $P ( { Y } | { X } ) , P ( { Y } )$ is high) and the samples look like real images from the original dataset (entropy of $P ( { Y \vert } X )$ is low ). Inception score can be seen as a measurement of the variability of the generated data while penalizing the uncertainty of $P ( { Y \vert } X )$ . Unfortunately, it does not estimate if the samples are varied inside a certain class (the entropy of $p ( X | Y ) )$ . Our approach imposes a high entropy of $P ( Y )$ and gives an unbiased indicator about the entropy of both $P ( { Y \vert } X )$ and $P ( X | Y )$ .
52
+
53
+ # 3 METHODS
54
+
55
+ We evaluate generators in a supervised training setup. We have a dataset $D$ composed of pair of examples $( x , y )$ where $x$ is a data point and $y$ the label associated to this data point. The dataset is split in three parts $D _ { t r a i n } , D _ { v a l i d }$ and $D _ { t e s t }$ . Our method needs a generative model that can sample conditionally from any given label $y$ . This conditional generative model is thus trained on $D _ { t r a i n }$ . Once the training of this model is done, we sample random labels and use the generative model to get a new dataset $D _ { g e n }$ . Then, we mix the true training set $D _ { t r a i n }$ with the new generated data $D _ { g e n }$ . The ratio of generated data into the whole mixture $D _ { m i x }$ is called $\tau$ . $\tau$ is used as the probability to sample a generated batch rather than a batch of true data during training. $D _ { m i x }$ is used to train a classifier on the classes of the dataset. This classifier is evaluated at each epoch over the portion $D _ { v a l i d }$ of the dataset. Once, we get the best model over $D _ { v a l i d }$ , we compute the score of this classifier over the test set $D _ { t e s t }$ . We compare the results from training on $D _ { m i x }$ with a baseline. The baseline is the score of the same classifier model trained only on training data $D _ { t r a i n }$ . Our conditional generative model evaluation can be seen as a ratio between those two scores. We can summarize our method as follows:
56
+
57
+ 1. Train a conditional generative model over $n$ sample of $D _ { t r a i n }$
58
+ 2. Mix the samples $D _ { g e n }$ generated by this model with $D _ { t r a i n }$ under a probability $\tau$ into $D _ { m i x }$
59
+ 3. Train a discriminative model over $D _ { m i x }$
60
+ 4. Train a discriminative model over $D _ { t r a i n }$ using the $n$ same sample as for the generator training
61
+ 5. Select a classifiers over a valid set $D _ { v a l i d }$ .
62
+ 6. Compare the score of those classifiers over a test set $D _ { t e s t }$ .
63
+
64
+ By iterating this method on diverse values of $\tau$ and $n$ we can evaluate the quality of a generator given a dataset.
65
+
66
+ # 4 EXPERIMENTS
67
+
68
+ # 4.1 EXPERIMENTAL PROTOCOL
69
+
70
+ Often, generative models are presented on popular datasets like MNIST. Fashion-MNIST (Xiao et al., 2017) can also serve as a direct drop-in replacement for the original MNIST dataset. This dataset is however more complex than MNIST as images have a higher variability. Thus, we use these datasets in order to evaluate different generative models.
71
+
72
+ We used two different methods in order to get conditional generative models. The first uses traditional generative neural network which can not produce labeled data. In order to associate each generated sample to a label, we train one generator for each specific class $y$ on $D _ { t r a i n }$ . This makes us able to label any generated sample. Once the training of those generators is done, we mix the samples obtained by each generator in order to produce $D _ { g e n }$ . For the experiments, we compare two generative models is this setting: a standard VAE and a WGAN. The second method uses conditional generative models which can generate samples in all classes while controlling the class of a particular sample. Conditional models can thus generate various labeled samples and produce a whole dataset $D _ { g e n }$ directly. In this last case, we ran our experiments on CVAE and CGAN. Once the dataset $D _ { g e n }$ is generated, we mixed it with the real dataset $D _ { t r a i n }$ . As we can generate as much data as we want, we experimented different ratios between real datasets and generated datasets. We call $\tau$ the probability of sampling from $D _ { g e n }$ . We made experiments with different values for $\tau = [ 0 . 0 0 0 , 0 . \bar { 1 } 2 5 , 0 . 2 5 \bar { 0 } , 0 . 3 7 5 , \bar { 0 } . 5 0 \bar { 0 } , 0 . 6 2 5 , \bar { 0 } . 7 5 0 , 0 . 8 7 5 , 1 . 0 0 \bar { 0 } ] .$ $\tau = 0$ implies that we use only data from $D _ { t r a i n }$ . In this specific setting, we compare the effectiveness of the data augmentation with generated samples versus classic data augmentation as isotropic Gaussian noise with an optimized variance or a random pixel dropout with a probability $\alpha$ of putting a pixel to 0. We also train a classifier without any data augmentation as baseline.
73
+
74
+ We use a standard CNN with a softmax output as classifier to predict the labels on this mixture of samples. On each epoch we evaluate this classifier over a validation set $D _ { v a l i d }$ . Then, we choose the classifier that performs best on this validation set. We use early stopping to stop the training if the accuracy does not improve anymore on the validation set after 50 epochs. The classifier is then tested on $D _ { t e s t }$ . We train a classifier for each value of $\tau$ . We assess the quality of the generative model by comparing the test score of this classifier when $\tau = 0$ versus the best test score of the classifier with $\tau > 0$ . The result gives an indication on how the learned distribution from $D _ { t r a i n }$ fits and generalizes the distribution from $D _ { t r a i n }$ . In order to be able to compare results from different generators on a given dataset, we always use the same classifier architecture.
75
+
76
+ ![](images/203f196e0eaa3b481878d1d1ce48cf70072d1cf46ee7f54b255ca20b975ad17c.jpg)
77
+ Figure 1: Representation of test accuracy when $\tau$ increases on fashion-MNIST (MNIST in appendix) with different amounts of training data.
78
+
79
+ To be able to estimate the impact of learning from generative settings versus discriminative ones, we have made variable the amount of data in $D _ { t r a i n }$ used to train both generator and classifier. Thus, we repeat all our experiments for the following amount of data samples: [100, 500, 1000, 5000, 10000, 50000]. This allows us to measure the regularization capacity of the generated samples over the classifier’s training. We interpret this regularization capacity of those samples as a capacity of generalization.
80
+
81
+ # 4.2 RESULTS
82
+
83
+ In Figure 1, we present the test accuracy when $\tau$ increase. When $\tau = 0$ there is no generated data, this is the result of the baseline without data augmentation. Our interpretation of the figure is that if the accuracy is better than baseline with a low $\tau$ $( \mathit { \Theta } < 0 . 5 )$ it means that the generator is able to generalize by learning meaningful informations about the dataset. When $\tau > 0 . 5$ if the accuracy is maintained it means the generated data can replace the dataset in most parts of the distribution. When $\tau = 1$ there is no more original data, the classifier is thus trained only on generated samples. If the accuracy is still better than the baseline, it means that the generator has fit the training distribution (and eventually has learned to generalize if this score is high over the test set).
84
+
85
+ ![](images/49ec4ba23b51ce2ef6dc8b2b43e516f6e5fb55b4f8d50566adaf900e38702c04.jpg)
86
+ (a) Relative accuracy wrt. baseline on mnist for (b) Relative accuracy wrt. baseline on fashiondifferent models mnist for different models
87
+ Figure 2: Representation of the data augmentation capacity of each generative models. For each number of training example we show the maximum accuracy a generative model can achieve by tuning $\tau$ . We also show results when tuning hyper-parameter for data augmentation method.
88
+
89
+ Following this interpretation, Figure 1 allows us to compare different generative neural networks on fashion-MNIST. For example we can see that VAE (Figure 1b) and CVAE (Figure 1a) are able to maintain the baseline accuracy when we do data augmentation with generated samples for different amount of data $n$ . But the accuracy goes down when there are only generated data, which means that these generative models in those settings did not fit the whole distribution. CGAN has the same kind of behavior but the degradation is worse when $\tau = 1$ . However WGAN is able improve the accuracy for $\tau < 0 . 5$ and to maintain it even when $\tau = 1$ . Figure 1 also allows to estimate the entropy of $P ( X )$ . As a deep neural network can not be trained efficiently without various data samples, if the the accuracy on test set is good with only generated data $\mathit { \Pi } _ { \mathcal { T } } = 0 \mathit { \Pi } _ { \mathcal { r } }$ ), necessary the entropy of $P ( X )$ is high as the entropy of $P ( X | Y )$ . This condition is sufficient but not necessary to assess the quality of a generator on a given task.
90
+
91
+ Our result shows that training one WGAN per class is the best solution to fit the complete distribution, whatever the number of training data used. The bad results on CGAN can be explained by the difficulties to train this model and it’s instability.
92
+
93
+ Figure 2 represents the best accuracy that each model can achieve when $\tau$ is tuned. It shows that, aside from CGAN on MNIST, all generator can be used to increase accuracy, whatever the number of training data. In this context $\tau$ can be seen as a tunable hyper parameter for data augmentation. Figure 2 also shows that the capacity of generalization is particularly effective when the number of example is low. This can be explained by the fact that when the data number increases the need of data augmentation decrease.
94
+
95
+ $$
96
+ \Psi _ { G } = \frac { 1 } { n } \sum _ { n } m a x _ { \tau } [ ( a c c _ { n } ( G , \tau ) ) ] - a c c _ { n } ( \tau = 0 ) ,
97
+ $$
98
+
99
+ The results shown in Table 1 summarize Figure 2 for each generator $G$ by a numerical value $\Psi _ { G }$ (Eq. 2). We call $\Psi _ { G }$ the data augmentation capacity of a generator. It is computed, for a given generator $G$ , by the mean of the differences between the accuracy on mixture with $\tau$ tuned and the baseline accuracy for each number $n$ of training data. The different number of data is arbitrary chosen. In our experiment we compute it with $[ 0 . 2 \%$ , $1 \%$ , $2 \%$ , $1 0 \%$ , $2 0 \%$ , $1 0 0 \%$ , ] of the train set of the dataset. The important thing is to operate at different scales to estimate how the generative model is able to generalize.
100
+
101
+ The results of Table 1 indicates if a generative model is globally able to perform data augmentation for a given data set. A positive result indicates that the generative model is able to generalize well on the dataset at different sizes. In case of low amount of data, it is better to refer to Figure 2 to choose the best model for that specific case.
102
+
103
+ Table 1: Results Table : $\Psi _ { G }$ values
104
+
105
+ <table><tr><td rowspan=1 colspan=1>Datasets</td><td rowspan=1 colspan=1>Gaussian</td><td rowspan=1 colspan=1>Random Dropout</td><td rowspan=1 colspan=1>VAE</td><td rowspan=1 colspan=1>CVAE</td><td rowspan=1 colspan=1>WGAN</td><td rowspan=1 colspan=1>CGAN</td></tr><tr><td rowspan=1 colspan=1>MNIST</td><td rowspan=1 colspan=1>0.0024</td><td rowspan=1 colspan=1>0.0027</td><td rowspan=1 colspan=1>0.0123</td><td rowspan=1 colspan=1>0.0116</td><td rowspan=1 colspan=1>0.0474</td><td rowspan=1 colspan=1>0.0027</td></tr><tr><td rowspan=1 colspan=1>Fashion MNIST</td><td rowspan=1 colspan=1>0.0014</td><td rowspan=1 colspan=1>0.0018</td><td rowspan=1 colspan=1>0.0047</td><td rowspan=1 colspan=1>0.0041</td><td rowspan=1 colspan=1>0.0357</td><td rowspan=1 colspan=1>-0.0021</td></tr></table>
106
+
107
+ # 5 DISCUSSION
108
+
109
+ We presented a method to estimate how well a generative model has learned to generalize in a conditional setting. Using generated samples as data augmentation in order to improve a discriminative model is a well known technique. However, assessing the quality of a generative model with a discriminative model seems to have been less explored. As we have shown, this evaluation is meaningful to measure how well the generative model can sample data points that are probable under the true distribution we want to approximate. In this paper we applied this method on images samples. It means that we can correlate our measure with a visually assess of the samples quality as the generator outputs are in pixel space. Our assessment method can also be used in other spaces as long as labeled data are available.
110
+
111
+ The relative benefits of discriminative and generative models have been studied in $\mathrm { N g }$ & Jordan (2002). They found that for a small number of training examples $n$ , a generative model will be less prone to overfitting. A discriminative model on a small number of examples risks to learn some spurious nodes that will penalize the generalization capacity. Our results are coherent with their conclusion as the data augmentation induced by generated data is particularly effective when $n$ is low.
112
+
113
+ Our evaluation was performed on several datasets, generative models, different ratios and amounts of training data. With the current results, WGAN seems to be the most efficient solution. However, this result should be confirmed by experiments on other datasets, generative models and with different types of discriminative models to get a more general comparison. This will be explored in further experiments.
114
+
115
+ As presented in White (2016), the sampling method of a generator can be adapted, which can have an impact on the data produced. A way to boost the performance of a generator can be to focus on improving the sampling phase instead of the model design or the training. An extension of this work could be to look into the impact of several sampling techniques on the performance of a generative model.
116
+
117
+ # 6 CONCLUSION
118
+
119
+ This paper introduces a new method to assess and compare the performances of generative models on various labeled datasets. By training a classifier on several mixture of generated and real data we can estimate the ability of a generative model to generalize. When addition of generated data into the training set achieved better data augmentation than traditional data augmentation as Gaussian noise or random dropout, it demonstrates the ability of generative models to create meaningful samples. By varying the number of training data, we compute a data augmentation capacity $\Psi _ { G }$ for each model on MNIST and fashion-MNIST datasets. $\Psi _ { G }$ is a global estimation of the generalization capacity of a generative model on a given dataset. The results presented here are produced on image datasets but this method can be used on all kinds of datasets or generative models as long as labeled data is available.
120
+
121
+ # REFERENCES
122
+
123
+ Martin Arjovsky, Soumith Chintala, and Leon Bottou. Wasserstein generative adversarial networks.´ In Proceedings of the 34th International Conference on Machine Learning, 2017.
124
+
125
+ Emily L Denton, Soumith Chintala, arthur szlam, and Rob Fergus. Deep generative image models using a laplacian pyramid of adversarial networks. In Advances in Neural Information Processing Systems 28. 2015.
126
+
127
+ 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 27. 2014.
128
+
129
+ Diederik P Kingma and Max Welling. Auto-encoding variational bayes. In Proceedings of the 2nd International Conference on Learning Representations (ICLR), 2014.
130
+
131
+ B. M. Lake, R. Salakhutdinov, and J. B. Tenenbaum. Human-level concept learning through probabilistic program induction. Science, 2015.
132
+
133
+ Aaron van den Oord Lucas Theis and Matthias Bethge. A note on the evaluation of generative ¨ models. In Proceedings of the 4th International Conference on Learning Representations (ICLR), 2016.
134
+
135
+ Mehdi Mirza and Simon Osindero. Conditional generative adversarial nets. CoRR, abs/1411.1784, 2014.
136
+
137
+ Andrew Y Ng and Michael I Jordan. On discriminative vs. generative classifiers: A comparison of logistic regression and naive bayes. In Advances in neural information processing systems, 2002.
138
+
139
+ Anh Nguyen, Jeff Clune, Yoshua Bengio, Alexey Dosovitskiy, and Jason Yosinski. Plug & play generative networks: Conditional iterative generation of images in latent space. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2017.
140
+
141
+ Augustus Odena, Christopher Olah, and Jonathon Shlens. Conditional image synthesis with auxiliary classifier GANs. In Proceedings of the 34th International Conference on Machine Learning, 2017.
142
+
143
+ Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. CoRR, abs/1511.06434, 2015.
144
+
145
+ Alexander J Ratner, Henry R Ehrenberg, Zeshan Hussain, Jared Dunnmon, and Christopher Re.´ Learning to compose domain-specific transformations for data augmentation. stat, 2017.
146
+
147
+ Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. In Proceedings of the 31th International Conference on Machine Learning,, 2014.
148
+
149
+ Tim Salimans, Ian J. Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. CoRR, abs/1606.03498, 2016.
150
+
151
+ Leon Sixt, Benjamin Wild, and Tim Landgraf. Rendergan: Generating realistic labeled data. CoRR, abs/1611.01331, 2016.
152
+
153
+ Kihyuk Sohn, Honglak Lee, and Xinchen Yan. Learning structured output representation using deep conditional generative models. In Advances in Neural Information Processing Systems 28, 2015.
154
+
155
+ Z Wang, E P Simoncelli, and A C Bovik. Multiscale structural similarity for image quality assessment. In Proc 37th Asilomar Conf on Signals, Systems and Computers, 2003.
156
+
157
+ T. White. Sampling Generative Networks. ArXiv e-prints, September 2016.
158
+
159
+ Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms, 2017.
160
+
161
+ # A ADDITIONAL RESULTS
162
+
163
+ ![](images/172e954e19a082588a6212e6c53874988a74b56efd8e72f184ab9efe38852e41.jpg)
164
+ (c) VAE samples when trained with (d) VAE samples when trained with 500 images 1000 images
165
+ Figure 3: This figure presents samples from VAEs when trained with different amounts of data. It represents the overfitting capacity of a VAE. All four samples set look good, but for example, the top left trained with only 50 different data often produce similar images (as the samples on top right trained with 100 images). When the number of training images increases the variability seems good afterwards but as we can see in Figure $_ \mathrm { 4 c }$ when $\tau = 1$ the generator generalizes better the distribution when n is $< 1 0 0 0$ than when $> 1 0 0 0$ is high.
166
+
167
+ ![](images/439eeed9799f3f92e624bd200c6a10a30fe30c4e5df56c3bea8add5da29dd861.jpg)
168
+ Figure 4: Relative accuracy improvement between the baseline trained on original data and the accuracy with generated or noise data augmentation in training. $\tau$ is the ratio between the number of generated data and the total number of data used for training.
169
+
170
+ ![](images/d3f24e2f0234780496f4199cd1780a10954dc5d378e04b22941e08e7fda1d5ed.jpg)
171
+ Figure 5: Test accuracy on each model for different values of $\tau$ and different amounts of training data.
172
+
173
+ ![](images/38674be7b9468c15f1c71ac365ce7448bc87d14d737a59ea6eb899d7fdd62779.jpg)
174
+ Figure 6: Test accuracy when $\tau$ increases with different amounts of training data on MNIST.
md/train/HJ1JBJ5gl/HJ1JBJ5gl.md ADDED
@@ -0,0 +1,306 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # REPRESENTING INFERENTIAL UNCERTAINTY IN DEEP NEURAL NETWORKS THROUGH SAMPLING
2
+
3
+ Patrick McClure & Nikolaus Kriegeskorte
4
+ MRC Cognition and Brain Sciences Unit
5
+ University of Cambridge
6
+ Cambridge, UK
7
+ {patrick.mcclure,nikolaus.kriegeskorte}@mrc-cbu.cam.ac.uk
8
+
9
+ # ABSTRACT
10
+
11
+ As deep neural networks (DNNs) are applied to increasingly challenging problems, they will need to be able to represent their own uncertainty. Modelling uncertainty is one of the key features of Bayesian methods. Bayesian DNNs that use dropout-based variational distributions and scale to complex tasks have recently been proposed. We evaluate Bayesian DNNs trained with Bernoulli or Gaussian multiplicative masking of either the units (dropout) or the weights (dropconnect). We compare these Bayesian DNNs ability to represent their uncertainty about their outputs through sampling during inference. We tested the calibration of these Bayesian fully connected and convolutional DNNs on two visual inference tasks (MNIST and CIFAR-10). By adding different levels of Gaussian noise to the test images in z-score space, we assessed how these DNNs represented their uncertainty about regions of input space not covered by the training set. These Bayesian DNNs represented their own uncertainty more accurately than traditional DNNs with a softmax output. We find that sampling of weights, whether Gaussian or Bernoulli, led to more accurate representation of uncertainty compared to sampling of units. However, sampling units using either Gaussian or Bernoulli dropout led to increased convolutional neural network (CNN) classification accuracy. Based on these findings we use both Bernoulli dropout and Gaussian dropconnect concurrently, which approximates the use of a spike-andslab variational distribution. We find that networks with spike-and-slab sampling combine the advantages of the other methods: they classify with high accuracy and robustly represent the uncertainty of their classifications for all tested architectures.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ Deep neural networks (DNNs), particularly convolutional neural networks (CNN), have recently been used to solve complex perceptual and decision tasks (Krizhevsky et al., 2012; Mnih et al., 2015; Silver et al., 2016). However, these networks fail to model the uncertainty of their predictions or actions. Although many networks deterministically map an input to a probabilistic prediction, they do not model the uncertainty of that mapping. In contrast, Bayesian neural networks (NNs) attempt to learn a distribution over their parameters thereby offering uncertainty estimates for their outputs (MacKay, 1992; Neal, 2012). However, these methods do not scale well due to the difficulty in computing the posterior of a network’s parameters.
16
+
17
+ One type of method for sampling from the posteriors of these networks is Hamiltonian Monte Carlo (HMC) (Neal, 2012). These techniques use the gradient information calculated using backpropagation to perform Markov chain Monte Carlo (MCMC) sampling by randomly walking through parameter space. proposed stochastic gadient Langevien dynamcis (SGLD)
18
+
19
+ Approximate methods, in particular variational inference, have been used to make Bayesian NNs more tractable (Hinton & Van Camp, 1993; Barber & Bishop, 1998; Graves, 2011; Blundell et al., 2015). Due in large part to the fact that these methods substantially increase the number of parameters in a network, they have not been applied to large DNNs, such as CNNs. Gal & Ghahramani (2016) and Kingma et al. (2015) bypassed this issue by developing Bayesian CNNs using dropout (Srivastava et al., 2014). Dropout is a widely used regularization technique where units are dropped out of a network with a probability $p$ during training and the output of all unit are multiplied by $p$ during inference. A similar technique is dropconnect (Wan et al., 2013), which drops network connections instead of units. Gal & Ghahramani (2015) detailed how dropping units was equivalent to sampling weights from a Bernoulli-based variational distribution and that in order to make a DNN with dropout Bayesian, sampling should be used during both training and inference. Monte-Carlo (MC) sampling at inference allows a DNN to efficiently model a distribution over its outputs. One limitation of the Bayesian dropout method is that it does not model the uncertatiniy of each network parameter. The uncertainty of a DNN can then be calculated using this probability distribution. In addition to Bernoulli and Gaussian distributions, there has also been work done using spike-anslab distributions (Louizos, 2015), a combination of the two, which has been shown to increase the quality of linear regression (Ishwaran & Rao, 2005). Interestingly, dropout and dropconnect can be seen as approximations to spike-and-slab distributions for units and weights, respectively (Louizos, 2015; Gal, 2016; Li et al., 2016). Dropout- and dropconnect-based variational DNNs are dependent on the dropout probability, which is often used as a hyperparameter. However, work has been done on automatically learning the dropout probability during training for dropconnect (Louizos, 2015) using spike-and-slab distributions and Gaussian dropout (Kingma et al., 2015).
20
+
21
+ In this paper, we investigate how using MC sampling to model uncertainty affects a network’s probabilistic predictions. Specifically, we test if using MC sampling improves the calibration of the probabilistic predictions made by Bayesian DNNs with softmax output layers. We used variational distributions based on dropout and dropconnect with either Bernoulli or Gaussian sampling during both training and inference. Additonally, we propose a formulation of a spike-and-slab variational distribution based on Bernoulli dropout and Gaussian dropconnect. We find that the spike-and-slab networks robustly represented their uncertainty like Bayesian dropconnect networks and have the increased CNN classification accuracy of Bayesian dropout networks. Each of these variational distributions scale extremely well and make the results of this work applicable to a large range of state-of-the-art DNNs.
22
+
23
+ # 2 METHODS
24
+
25
+ # 2.1 BAYESIAN NEURAL NETWORKS
26
+
27
+ Artificial neural networks (NNs) can be trained using Bayesian learning by finding the maximum a posteriori (MAP) weights given the training data $( D _ { t r a i n } )$ and a prior over the weight matrix $W$ $( p ( W ) )$ :
28
+
29
+ $$
30
+ \operatorname* { m a x } _ { W } p ( W | D _ { t r a i n } ) = \operatorname* { m a x } _ { W } p ( D _ { t r a i n } | W ) p ( W )
31
+ $$
32
+
33
+ This is usually done by minimizing the mean squared error (MSE) or cross entropy error for either regression or classification, respectively, while using L2 regularization, which corresponds to a Gaussian prior over the weights. At inference, the probability of the test data $( D _ { t e s t } )$ is then calculated using only the maximum likelihood estimate (MLE) of the weights $( W ^ { * } )$ :
34
+
35
+ $$
36
+ p ( D _ { t e s t } | W ^ { * } )
37
+ $$
38
+
39
+ However, ideally the full posterior distribution over the weights would be learned instead of just the MLE:
40
+
41
+ $$
42
+ p ( W | D _ { t r a i n } ) = \frac { p ( D _ { t r a i n } | W ) p ( W ) } { p ( D _ { t r a i n } ) }
43
+ $$
44
+
45
+ This can be intractable due to both the difficulty in calculating $p ( D _ { t r a i n } )$ and in calculating the joint distribution of a large number of parameters. Instead, $p ( W | D _ { t r a i n } )$ can be approximated using a variational distribution $q ( W )$ . This distribution is constructed to allow for easy generation of samples. Using variational inference, $q ( W )$ is learned by minimizing:
46
+
47
+ $$
48
+ - \int \log \ p ( D _ { t r a i n } | W ) q ( W ) d W + K L ( q ( W ) | | p ( W ) )
49
+ $$
50
+
51
+ Monte-Carlo (MC) sampling can then be used to estimate the probability of test data using $q ( W )$
52
+
53
+ $$
54
+ p ( D _ { t e s t } ) \approx \frac { 1 } { n } \sum _ { i } ^ { n } p ( D _ { t e s t } | \hat { W } ^ { i } ) ~ w h e r e ~ \hat { W } ^ { i } \sim q ( W )
55
+ $$
56
+
57
+ ![](images/ebf36505305400ebfea2455be798a5425ee463c578f90d65ea7251041a7987f6.jpg)
58
+ Figure 1: A visualization of the different variational distributions on a simple neural network.
59
+
60
+ # 2.2 VARIATIONAL DISTRIBUTIONS
61
+
62
+ The number and continuous nature of the parameters in DNNs makes sampling from the entire distribution of possible weight matrices computationally challenging. However, variational distributions can make sampling easier. In deep learning, the most common sampling method is dropout with Bernoulli variables. However, dropconnect, which independently samples a Bernoulli for each weight, and Gaussian weights have also been used. A visualization of the different methods is shown in Figure 1. All of these methods can be formulated as variational distributions where weights are sampled by element-wise multiplying the variational parameters $V$ , the $n \times n$ connection matrix with an element for each connection between the $n$ units in the network, by a mask $\hat { M }$ , which is sampled from some probability distribution. Mathematically, this can be written as:
63
+
64
+ $$
65
+ \hat { W } = V \circ \hat { M } w h e r e \hat { M } \sim p ( M )
66
+ $$
67
+
68
+ From this perspective, the difference between dropout and dropconnect, as well as Bernoulli and Gaussian methods, is simply the probability distribution used to generate the mask sample, $\hat { M }$ (Figure 2).
69
+
70
+ ![](images/5fd29ce6bf9a42bf5eb9412eccdb30721d4bd6bbbbf2e2cc5dc088871bfe0e65.jpg)
71
+ Figure 2: An illustration of sampling network weights using the different variational distributions.
72
+
73
+ # 2.2.1 BERNOULLI DROPCONNECT & DROPOUT
74
+
75
+ Bernoulli distributions are simple distributions which return 1 with probability $p$ and 0 with probability $( 1 - p )$ . In Bernoulli dropconnect, each element of the mask is sampled independently, so $\hat { m } _ { i , j } \sim B e r n o u l l i ( p )$ . This sets $\hat { w } _ { i , j }$ to $v _ { i , j }$ with probability $p$ and 0 with a probability $( 1 - p )$ .
76
+
77
+ In dropout, however, the weights are not sampled independently. Instead, one Bernoulli variable is sampled for each row of the weight matrix, so $\hat { m } _ { i , * } \sim B e r n o u l l i ( p )$ .
78
+
79
+ # 2.2.2 GAUSSIAN DROPCONNECT & DROPOUT
80
+
81
+ In Gaussian dropconnect and dropout, the elements of the mask are sampled from normal distributions. This corresponds to sampling $\hat { w } _ { i , j }$ from a Gaussian distribution centered at variational parameter $v _ { i , j }$ . Srivastava et al. (2014) proposed using Gaussian distribution with a mean of 1 and a variance of $\sigma _ { d c } ^ { 2 } = ( 1 - p ) / p$ , which matches the mean and variance of dropout when training time scaling is used. In Gaussian dropconnect, each element of the mask is sampled independently, which results in $\hat { m } _ { i , j } \sim { \mathcal N } ( 1 , \sigma _ { d c } ^ { 2 } )$ . In Gaussian dropout, each element in a row has the same random variable, so $\hat { m } _ { i , * } \sim \mathcal N ( 1 , \sigma _ { d c } ^ { 2 } )$ .
82
+
83
+ # 2.2.3 SPIKE-AND-SLAB DROPOUT
84
+
85
+ A spike-and-slab distribution is the normalized linear combination of a ”spike” of probability mass at zero andprobability $p _ { s p i k e }$ b” consisting of a Gaussian distribution. This spor a random sample from a Gaussian distribution $\mathcal { N } ( \mu _ { s l a b } , \sigma _ { s l a b } ^ { 2 } )$ urns a 0 with. We propose and-slab variational distribution by optimizing a lower-bound of the objective function (See Appendix A). In this formulation, $m _ { i , j } \sim b _ { i , * } \mathcal { N } ( \bar { 1 } , \sigma _ { d c } ^ { 2 } )$ , where $b _ { i , * } \sim B e r n ( p _ { d o } )$ for each mask row and $\sigma _ { d c } ^ { 2 } = p _ { d c } / ( 1 - p _ { d c } )$ . As for Bernoulli dropout, each row of the mask $M$ , $m _ { i , * }$ , is multiplied by 0 with probability $\left( 1 - p _ { d o } \right)$ , otherwise each element in that row is multiplied by a value independently sampled from a Gaussian distribution as in Gaussian dropconnect. During non-sampling inference, spike-and-slab dropout uses the mean weight values and, per Bernoulli dropout, multiplies unit outputs by $p _ { d o }$ . This differs from the work done by Louizos (2015) and Gal (2016) in that they used additive Gaussian noise and learn separate means and variances for each weight. In contrast, we define the variance as a function of the learned weight mean $v _ { i , j }$ . Tying the variance of a weight to its magnitude makes it only beneficial to learn large weights if they are robust to variance (Wang & Manning, 2013). Although we treat $p _ { d o }$ and $p _ { d c }$ as a hyperparameters thereby reducing the space of variational distributions we optimize over, similar methods could potentially learn these during training (Louizos, 2015; Kingma et al., 2015; Gal, 2016).
86
+
87
+ ![](images/3af3171b184d75daf489e8d01e3d53b15332531ac388ee6b9c7a8d1df4a13daa.jpg)
88
+ Figure 3: Examples of MNIST images with added Gaussian noise with varying standard deviations.
89
+
90
+ # 3 RESULTS
91
+
92
+ In this paper, we investigate how using MC sampling affects a DNN’s ability to represent the uncertainty of it’s probabalistic predictions. To test this, we trained several networks differing only in whether no sampling was performed (baseline DNN and DNN with L2-regularization), sampling was only performed during training (dropout and dropconnect), or sampling was performed both during training and inference (MC dropout and MC dropconnect). We used the MNIST and CIFAR10 datasets to train networks that sampled from different variational distribution using the above methods.
93
+
94
+ For these DNNs, we compared the test classification error, the uncertainty of the softmax output, and the calibration of the softmax output for each type of sampling and variational distribution. The test classification error shows how well the probability distribution learned by each DNN models the data. The uncertainty shows how the probability distribution learned by each DNN is distributed across classes. A low entropy means that the probability mass is primarily located at a few labels and a high entropy means that the probability mass is distributed across many labels. The calibration shows how well the probability distribution learned by the DNN models it’s own uncertainty. We evaluated how calibrated a prediction was by the following procedure: (1) We binned test set predictions by predicted probability. (2) We calculated the percentage of predictions in each predicted-probability bin that correctly predicted a target label. Perfect calibration means that targets predicted with probability $z$ are correct in $z$ times $100 \%$ of the cases. We therefore (3) calculated the mean squared calibration error (i.e. the mean across bins of the squared deviations between the bin-mean predicted probability and the proportion of correct predictions in that bin). We evaluated these three measures for the trained networks on the MNIST and CIFAR test set with noise sampled from Gaussian distributions with varying standard deviations (Figure 3). This tested how well modelled each network’s uncertainty was for the test sets and the regions of input space not seen in the training set. For dropout and dropconnect, $p$ was set to 0.5, which corresponds to the best value for regularizing a linear layer Baldi & Sadowski (2013). However in practice, different values for $p$ have been used Srivastava et al. (2014). We found that 0.5 was a robust choice for different networks, measures and sampling methods we used. The one exception were the dropconnect parameter used for spike-and-slab distributions where 0.5 made learning difficult due to the variance during training. Through validation, we found that using larger values spike-and-slab probabilities (0.75 for the fully connected and 0.9 for the convolutional) allowed the networks to fit to the training data better while still maintaining good generalization.
95
+
96
+ ![](images/f9bbb36a30f17a436418786ef4e6823d485564aa13cafeab003021f582ded0d4.jpg)
97
+ Figure 4: The MNIST test classification error, entropy, and calibration of the predictions of the fully connected networks: NN, $_ { \mathrm { N N + L } 2 }$ , Bernoulli DropConnect (BDC) with and without Monte-Carlo (MC) sampling, Gaussian DropConnect (GDC) with and without MC sampling, Bernoulli Dropout (BDO) with and without MC sampling, Gaussian Dropout with and without MC sampling, and spike-and-slab Dropout (SSD) with and without MC sampling.
98
+
99
+ ![](images/8ba652d0bc5e0638f545cbd8e7287f5b36c65535eb1d2efa902e56f3654579e4.jpg)
100
+ Figure 5: The calibration curves for the MNIST test set with and without Gaussian noise of the softmax outputs of the fully connected networks: NN, $_ { \mathrm { N N + L } 2 }$ , Bernoulli DropConnect (BDC) with and without Monte-Carlo (MC) sampling, Gaussian DropConnect (GDC) with and without MC sampling, Bernoulli Dropout (BDO) with and without MC sampling, Gaussian Dropout with and without MC sampling, and spike-and-slab Dropout (SSD) with and without MC sampling.
101
+
102
+ Table 1: MNIST test error for the trained fully connected neural networks with and without MonteCarlo (MC) sampling using 100 samples.
103
+
104
+ <table><tr><td>Method</td><td>Mean Error(%)</td><td>Std. Dev.</td></tr><tr><td>NN</td><td>1.68</td><td>-</td></tr><tr><td>NN+L2</td><td>1.64</td><td></td></tr><tr><td>Bernoulli DropConnect</td><td>1.33</td><td></td></tr><tr><td>MC Bernoulli DropConnect</td><td>1.30</td><td>0.04</td></tr><tr><td>Gaussian DropConnect</td><td>1.24</td><td></td></tr><tr><td>MC Gaussian DropConnect</td><td>1.27</td><td>0.03</td></tr><tr><td>Bernoulli Dropout</td><td>1.45</td><td>-</td></tr><tr><td>MC Bernoulli Dropout</td><td>1.42</td><td>0.03</td></tr><tr><td>Gaussian Dropout</td><td>1.36</td><td></td></tr><tr><td>MC Gaussian Dropout</td><td>1.37</td><td>0.03</td></tr><tr><td>Spike-and-Slab Dropout</td><td>1.23</td><td></td></tr><tr><td>MC Spike-and-Slab Dropout</td><td>1.23</td><td>0.03</td></tr></table>
105
+
106
+ # 3.1 MNIST
107
+
108
+ We trained two groups of DNNs, one with a fully connected (FC) architecture and one with a convolutional architecture, on digit classification using the MNIST dataset (LeCun et al., 1998). This set contains 60,000 training images and 10,000 testing images. No data augmentation was used.
109
+
110
+ # 3.1.1 FULLY CONNECTED NEURAL NETWORKS
111
+
112
+ First, we trained DNNs with two FC hidden layers, each with 800 units and ReLU non-linearities. For the L2-regularized network, an L2-coefficient of 1e-5 was used for all weights. For the dropout methods, unit sampling was performed after each FC layer. For the dropconnect methods, every weight was sampled. The classification errors of the FC networks on the MNIST test set are shown in Table 1. Sampling during learning significantly increased accuracy in comparison to the baseline NNs, with the dropconnect-based networks being the most accurate. MC sampling at inference did not significantly increase accuracy. We found that Gaussian dropconnect and spike-and-slab dropout had the best accuracy.
113
+
114
+ The classification error, uncertainty, and calibration of the learned probability distributions of each FC network for varying levels of noise are shown in Figure 4. While not improving accuracy, MC sampling led to networks that better represent their own uncertainty. As the noise in the test set was increased, the uncertainty of the networks with MC sampling highly increased, especially when compared to networks with no sampling at inference. This resulted in better calibrated FC networks for all levels of noise.
115
+
116
+ The calibration curves show that sampling only during training, especially when using only dropout, led to overconfidence through placing too much probability mass on the most predicted label (Figure 5). In particular, sampling only during training resulted in under-confidence for low predicted probabilities and over-confidence for high predicted probabilities. By distributing probability mass over several labels, the DNNs that sampled at inference better represented the uncertainty of their predictions.
117
+
118
+ ![](images/4569abac1e0eef01c33168f64efac9c35bb9c2d269ce5812ad28a0a1d25984cc.jpg)
119
+ Figure 6: The MNIST test classification error, entropy, and calibration of the predictions of the convolutional networks: CNN, $\mathrm { C N N + L } 2$ , Bernoulli DropConnect (BDC) with and without MonteCarlo (MC) sampling, Gaussian DropConnect (GDC) with and without MC sampling, Bernoulli Dropout (BDO) with and without MC sampling, Gaussian Dropout with and without MC sampling, and spike-and-slab Dropout (SSD) with and without MC sampling.
120
+
121
+ ![](images/5115246f909d10143a32429f907d51728a3b3bbb2fd8f022558bd6238546771e.jpg)
122
+ Figure 7: The calibration curves for the MNIST test set with and without Gaussian noise of the softmax outputs of the convolutional networks: CNN, $\mathrm { C N N + L } 2$ , Bernoulli DropConnect (BDC) with and without Monte-Carlo (MC) sampling, Gaussian DropConnect (GDC) with and without MC sampling, Bernoulli Dropout (BDO) with and without MC sampling, Gaussian Dropout with and without MC sampling, and spike-and-slab Dropout (SSD) with and without MC sampling.
123
+
124
+ # 3.1.2 CONVOLUTIONAL NEURAL NETWORKS
125
+
126
+ We also trained CNNs on MNIST. Every network had two convolutional layers and a fully-connected layer (See Appendix B for details). For the L2-regularized network, an L2-coefficient of 1e-5 was used for all weights. For Bernoulli and Gaussian dropout, dropout was performed after each convolutional layer and after the FC layer. For Bernoulli and Gaussian dropconnect, every weight was sampled. The classification error of the CNNs on the MNIST test set is shown in Table 2. Sampling during training significantly increased the accuracy for the all of the networks, but especially for the Gaussian dropout network. However, unlike for the FC networks, the dropout-based methods were more accurate than the dropconnect-based methods. Unlike for the FC networks, spike-and-slab had accuracies more similar to Bernoulli dropout, which classified more accurately than Gaussian dropconnect. MC sampling during inference did not significantly increase the accuracy of the networks.
127
+
128
+ Table 2: MNIST test error for the trained convolutional neural networks (CNNs) with and without Monte-Carlo (MC) sampling using 100 samples.
129
+
130
+ <table><tr><td>Method</td><td>Mean Error(%)</td><td>Error Std.Dev.</td></tr><tr><td>CNN</td><td>0.70</td><td>-</td></tr><tr><td>CNN+L2</td><td>0.70</td><td></td></tr><tr><td>Bernoulli DropConnect</td><td>0.59</td><td>-</td></tr><tr><td>MC Bernoulli DropConnect</td><td>0.59</td><td>0.02</td></tr><tr><td>Gaussian DropConnect</td><td>0.49</td><td></td></tr><tr><td>MC Gaussian DropConnect</td><td>0.49</td><td>0.01</td></tr><tr><td>Bernoulli Dropout</td><td>0.45</td><td>-</td></tr><tr><td>MC Bernoulli Dropout</td><td>0.46</td><td>0.01</td></tr><tr><td>Gaussian Dropout</td><td>0.38</td><td>-</td></tr><tr><td>MC Gaussian Dropout</td><td>0.37</td><td>0.01</td></tr><tr><td>Spike-and-Slab Dropout</td><td>0.43</td><td>1</td></tr><tr><td>MC Spike-and-Slab Dropout</td><td>0.44</td><td>0.01</td></tr></table>
131
+
132
+ The classification error, uncertainty, and calibration of the learned probability distributions of each network for varying levels of noise are shown in Figure 6. As with the FC networks, MC sampling at inference greatly increased the CNNs’ ability to estimate their own uncertainty, particularly for inputs that are different from the training set. MC sampling led to increased entropy as inputs became more noisy, which resulted in better calibration. In particular, this was true of both the Bernoulli and Gaussian dropconnect networks, which very accurately represented their uncertainty even for highly noisy inputs. The spike-and-slab CNN had similar robust calibration. The calibration curves show that not using MC sampling at inference led networks that were under-confident when making low probability predictions and over-confident when making high probability predictions (Figure 7).
133
+
134
+ # 3.2 CIFAR-10
135
+
136
+ We trained large CNNs on natural image classification using the CIFAR-10 dataset, which contains 50,000 training images and 10,000 testing images (Krizhevsky & Hinton, 2009). The CNNs had 13 convolutional layer followed by a fully connected layer (See Appendix B for details). For L2- regularization, an L2-coefficient of 5e-4 was used for all weights. For the dropout networks, was used after each convolutional layer, but before the non-linearities. For the dropconnect networks, all weights were sampled. During training, random horizontal flipping was used. The classification error of the CNNs on the CIFAR-10 test set is shown in Table 3. For each variational distribution, MC sampling significantly increased test accuracy. Also, the that used dropout, including spike-andslab, had significantly higher accuracies than the networks that only used dropconnect.
137
+
138
+ The classification error, uncertainty, and calibration of the learned probability distributions of each network for varying levels of noise are shown in Figure 8. One of the major differences between the CIFAR-10 and the MNIST results was that using the layer-wise expectation for dropout did not produce good models, regardless of what variational distribution was used. Instead, the standard test time dropout methods led to relatively inaccurate networks with very high output entropy even when no input noise was used. This agrees with the results reported by Gal & Ghahramani (2015)), who also found that using dropout at every layer can reduce accuracy if MC sampling is not used. However, these results differ from those of Srivastava et al. (2014). In our experience, deeper networks with higher regularization (e.g. Bernoulli dropout probabilities closer to 0.5) result in traditional dropout inference performing significantly worse than MC dropout. As for the MNIST networks, MC sampling at inference overall greatly increased the CIFAR-10 trained CNNs’ ability to estimate their own uncertainty when no or little noise was added to the test images.
139
+
140
+ Table 3: CIFAR-10 test error for the trained convolutional neural networks (CNNs) with and without Monte-Carlo (MC) sampling using 100 samples.
141
+
142
+ <table><tr><td>Method</td><td>Mean Error(%)</td><td>Error Std. Dev.</td></tr><tr><td>CNN</td><td>19.63</td><td>1</td></tr><tr><td>CNN+L2</td><td>19.44</td><td>1</td></tr><tr><td>Bernoulli DropConnect</td><td>17.64</td><td>=</td></tr><tr><td>MC Bernoulli DropConnect</td><td>17.29</td><td>0.05</td></tr><tr><td>Gaussian DropConnect</td><td>16.00</td><td></td></tr><tr><td>MC Gaussian DropConnect</td><td>15.63</td><td>0.04</td></tr><tr><td>Bernoulli Dropout</td><td>37.47</td><td></td></tr><tr><td>MC Bernoulli Dropout</td><td>10.19</td><td>0.06</td></tr><tr><td>Gaussian Dropout</td><td>24.10</td><td></td></tr><tr><td>MC Gaussian Dropout</td><td>9.29</td><td>0.10</td></tr><tr><td>Spike-and-Slab Dropout</td><td>18.05</td><td></td></tr><tr><td>MCSpike-and-Slab Dropout</td><td>10.44</td><td>0.03</td></tr></table>
143
+
144
+ ![](images/e5b981d48a35b2905daa6461fdfd4d81a72b0d75025b054d06fb8e6d87bc14f1.jpg)
145
+ Figure 8: The CIFAR-10 test classification error, entropy, and calibration of the predictions of the convolutional neural networks: CNN, $\mathrm { C N N + L } 2$ , Bernoulli DropConnect (BDC) with and without Monte-Carlo (MC) sampling, Gaussian DropConnect (GDC) with and without MC sampling, Bernoulli Dropout (BDO) with and without MC sampling, Gaussian Dropout with and without MC sampling, and spike-and-slab Dropout (SSD) with and without MC sampling.
146
+
147
+ ![](images/fc26828ec759e0f563f0d693175073c62b1146eb1b437ec6973876d91418b1c8.jpg)
148
+ Figure 9: The calibration curves for the CIFAR-10 test set with and without Gaussian noise of the softmax outputs of the convolutional neural networks: CNN, $\mathrm { C N N + L } 2$ , Bernoulli DropConnect (BDC) with and without Monte-Carlo (MC) sampling, Gaussian DropConnect (GDC) with and without MC sampling, Bernoulli Dropout (BDO) with and without MC sampling, Gaussian Dropout with and without MC sampling, and spike-and-slab Dropout (SSD) with and without MC sampling.
149
+
150
+ The classification accuracies and the ability to model uncertainty of the networks with dropconnect sampling were far more robust to noise than the networks with only dropout. However, the MC dropconnect networks are significantly less accurate than the MC dropout networks for the CIFAR
151
+
152
+ 10 test set when no noise was added. Networks that used traditional dropout inference instead of sampling were consistently uncertain, regardless of the noise. These networks have worse calibration than the MC dropout networks at low levels of noise but better calibration than the MC dropout networks at low levels of noise because they always had high uncertainty. For CIFAR-10, not using MC sampling resulted in networks that were generally over-confident when making predictions (Figure 9). However, this was not true for the non-sampling dropout networks when no input noise was used. In that case, the networks were highly under-confident.
153
+
154
+ # 4 DISCUSSION
155
+
156
+ In this paper, we investigated the ability of MC sampling to improve a DNN’s representation of its own uncertainty. We did this by training Bayesian DNNs with either multiplicative masking of the weights (dropconnect) or units (dropout) using Bernoulli, Gaussian, or spike-and-slab sampling. Based on the results, we draw the following main conclusions:
157
+
158
+ 1. Sampling during both learning and inference improved a network’s ability to represent its own uncertainty
159
+
160
+ MC sampling at inference improved the calibration of a network’s predictions. Overall, this improvement was particularly large for inputs from outside the training set, which traditional models classified with high confidence despite not being trained on similar inputs.
161
+
162
+ 2. Sampling weights independently led to networks that best represented their own uncertainty
163
+
164
+ For all the network architectures and datasets tested, using dropconnect sampling at training and inference resulted in the best calibrated networks overall. This was true regardless of whether dropconnect sampling led to the most accurate network. This is in contrast to CNNs with Gaussian dropout sampling, which were significantly the most accurate and also the worst calibrated of the networks with sampling both during training an inference
165
+
166
+ 3. Sampling weights independently led to the most accurate FC networks, but sampling units led to the most accurate CNNs
167
+
168
+ For the FC networks, using dropconnect, particularly with Gaussian sampling, resulted in the most accurate networks. However, using dropout led to the most accurate CNNs. A potential cause of this is the large correlation in the information contained by adjacent elements in an image, which are often covered by the same convolutional kernel. This could mean that sampling the weights of a kernel does not provide as much regularization as the dropout methods.
169
+
170
+ 4. Sampling using both Bernoulli dropout and Gaussian dropconnect led to accurate and well calibrated networks
171
+
172
+ Using spike-and-slab dropout, which combines Bernoulli dropout and Gaussian dropconnect, resulted in networks that performed well for all architectures. Spike-and-slab networks had accuracies similar to the Bernoulli dropout or Gaussian dropconnect depending on which performed better for a given architecture and task, Gaussian dropconnect for FC networks and Bernoulli dropout for CNNs. Spike-and-slab networks also were robustly well calibrated similar to all of the other dropconnect methods.
173
+
174
+ These scalable methods for improving a network’s representation of its own uncertainty are widely applicable, since most DNNs already use dropout and getting uncertainty estimates only requires using MC sampling at inference. We plan to further investigate the use of different variational distributions. We also plan to evaluate the use of dropout and dropconnect sampling on large recurrent neural networks. Our results suggest that sampling at inference allows DNNs to efficiently represent their own uncertainty, an essential part of real-world perception and decision making.
175
+
176
+ # ACKNOWLEDGMENTS
177
+
178
+ We would like to thank Yarin Gal and Sergii Strelchuk for their helpful discussions regarding the manuscript. This research was funded by the Cambridge Commonwealth, European & International Trust, the UK Medical Research Council (Program MC-A060-5PR20), and a European Research Council Starting Grant (ERC-2010-StG 261352).
179
+
180
+ # REFERENCES
181
+
182
+ Pierre Baldi and Peter J Sadowski. Understanding dropout. In Advances in Neural Information Processing Systems, pp. 2814–2822, 2013.
183
+
184
+ David Barber and Christopher M Bishop. Ensemble learning in bayesian neural networks. NATO ASI SERIES F COMPUTER AND SYSTEMS SCIENCES, 168:215–238, 1998.
185
+
186
+ Charles Blundell, Julien Cornebise, Koray Kavukcuoglu, and Daan Wierstra. Weight uncertainty in neural network. In Proceedings of The 32nd International Conference on Machine Learning, pp. 1613–1622, 2015.
187
+
188
+ Yarin Gal. Uncertainty in Deep Learning. PhD thesis, University of Cambridge, 2016.
189
+
190
+ Yarin Gal and Zoubin Ghahramani. Dropout as a bayesian approximation: Insights and applications. In Deep Learning Workshop, ICML, 2015.
191
+
192
+ Yarin Gal and Zoubin Ghahramani. Bayesian convolutional neural networks with Bernoulli approximate variational inference. In 4th International Conference on Learning Representations (ICLR) workshop track, 2016.
193
+
194
+ Alex Graves. Practical variational inference for neural networks. In Advances in Neural Information Processing Systems, pp. 2348–2356, 2011.
195
+
196
+ Geoffrey E Hinton and Drew Van Camp. Keeping the neural networks simple by minimizing the description length of the weights. In Proceedings of the sixth annual conference on Computational learning theory, pp. 5–13. ACM, 1993.
197
+
198
+ Hemant Ishwaran and J Sunil Rao. Spike and slab variable selection: frequentist and bayesian strategies. Annals of Statistics, pp. 730–773, 2005.
199
+
200
+ Diederik P Kingma, Tim Salimans, and Max Welling. Variational dropout and the local reparameterization trick. In Advances in Neural Information Processing Systems, pp. 2575–2583, 2015.
201
+
202
+ Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images, 2009.
203
+
204
+ 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.
205
+
206
+ Yann LeCun, Leon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to ´ document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
207
+
208
+ Chunyuan Li, Andrew Stevens, Changyou Chen, Yunchen Pu, Zhe Gan, and Lawrence Carin. Learning weight uncertainty with stochastic gradient mcmc for shape classification. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2016.
209
+
210
+ Christos Louizos. Smart regularization of deep architectures. Master’s thesis, University of Amsterdam, 2015.
211
+
212
+ David JC MacKay. A practical bayesian framework for backpropagation networks. Neural computation, 4(3):448–472, 1992.
213
+
214
+ 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.
215
+
216
+ Radford M Neal. Bayesian learning for neural networks, volume 118. Springer Science & Business Media, 2012.
217
+
218
+ 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.
219
+
220
+ 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.
221
+
222
+ Li Wan, Matthew Zeiler, Sixin Zhang, Yann L Cun, and Rob Fergus. Regularization of neural networks using dropconnect. In Proceedings of the 30th International Conference on Machine Learning (ICML-13), pp. 1058–1066, 2013.
223
+
224
+ Sida Wang and Christopher Manning. Fast dropout training. In Proceedings of the 30th International Conference on Machine Learning (ICML), pp. 118–126, 2013.
225
+
226
+ # A DERIVATION OF APPROXIMATE SPIKE-AND-SLAB DROPOUT
227
+
228
+ For Bayesian inference:
229
+
230
+ $$
231
+ p ( D _ { t e s t } | D _ { t r a i n } ) = \int p ( D _ { t e s t } | W ) p ( W | D _ { t r a i n } ) d W
232
+ $$
233
+
234
+ Using variational inference:
235
+
236
+ $$
237
+ p ( D _ { t e s t } ) = \int p ( D _ { t e s t } | W ) q ( W ) d W
238
+ $$
239
+
240
+ Where the variational distribution $q ( W )$ is learned by maximizing the log-evidence lower bound:
241
+
242
+ $$
243
+ l o g ( p ( D _ { t r a i n } ) ) \ge \int \log ( p ( D _ { t r a i n } | W ) ) q ( W ) d W - K L ( q ( W ) | | p ( W ) )
244
+ $$
245
+
246
+ For spike-and-slab dropout, as when using Bernoulli dropout, $W = B \circ V$ where $b _ { i , * } \sim B e r n ( p _ { d o } )$ so if we assume independence between the random variables $B$ and $V$ :
247
+
248
+ $$
249
+ \begin{array} { c } { { l o g ( p ( D _ { t r a i n } ) ) \ge \displaystyle \sum _ { B } \int _ { V } \log ( p ( D _ { t r a i n } | B , V ) ) q ( B ) q ( V ) d V d B } } \\ { { - K L ( q ( B ) | | p ( B ) ) - K L ( q ( V ) | | p ( V ) ) } } \end{array}
250
+ $$
251
+
252
+ For a spike-distribution, bution, each element of . As in Gaussian dropco $V$ is iect, s. pled from a Gaussiancan be sampled using $\mathcal { N } ( \mu _ { v _ { i , j } } , \sigma _ { v _ { i , j } } ^ { 2 } )$ $\sigma _ { v _ { i , j } } ^ { 2 } = \alpha \mu _ { v _ { i , j } } ^ { 2 }$ $V$ the “reparameterization trick”:
253
+
254
+ $$
255
+ v _ { i , j } = N ( \mu _ { v _ { i , j } } , \alpha \mu _ { v _ { i , j } } ^ { 2 } ) = g ( \mu _ { v _ { i , j } } , \epsilon _ { i , j } ) = \mu _ { v _ { i , j } } + \sqrt { \alpha } \mu _ { v _ { i , j } } \epsilon _ { i , j }
256
+ $$
257
+
258
+ where $\epsilon \sim N ( 0 , 1 )$ , $\alpha = ( 1 - p _ { d c } ) / p _ { d c }$ , and $p _ { d c }$ is the dropconnect keep probability.
259
+
260
+ This leads to:
261
+
262
+ $$
263
+ \begin{array} { r l r } & { } & { l o g ( p ( D _ { t r a i n } ) ) \ge \displaystyle \sum _ { B } \int _ { \epsilon } \log ( p ( D _ { t r a i n } | B , V ) q ( \epsilon ) q ( B ) d \epsilon d B } \\ & { } & { \quad - K L ( q ( B ) | | p ( B ) ) - K L ( q ( V ) | | p ( V ) ) } \end{array}
264
+ $$
265
+
266
+ This results in the following minimization objective function:
267
+
268
+ $$
269
+ \mathcal { L } _ { \mu _ { V } } : = - \sum _ { B } \int _ { \epsilon } \log ( p ( D _ { t r a i n } | B , V ) ) q ( \epsilon ) q ( B ) d \epsilon d B + K L ( q ( B ) | | p ( B ) ) + K L ( q ( V ) | | p ( V ) ) ,
270
+ $$
271
+
272
+ Using $B e r n ( p _ { d o } )$ as a prior for $B$ leads to a constant KLD of zero. Using a prior of $\mathcal { N } ( 0 , \sigma _ { p } ^ { 2 } )$ for each element of $V$ leads to the following:
273
+
274
+ $$
275
+ K L ( q ( v _ { i , j } ) | | p ( v _ { i , j } ) ) = \frac { ( \mu _ { v _ { i , j } } - 0 ) ^ { 2 } } { 2 \sigma _ { p } ^ { 2 } } + \log \frac { \sigma _ { p } } { \sigma _ { v _ { i , j } } } + \frac { \sigma _ { v _ { i , j } } ^ { 2 } } { 2 \sigma _ { p } ^ { 2 } } - \frac { 1 } { 2 }
276
+ $$
277
+
278
+ By using L2 regularization, we are optimizing a lower-bound of the KLD between $q ( V )$ and $\dot { \mathcal { N } } ( 0 , \lambda ^ { - 1 } )$ by only matching the first moment (i.e. the mean):
279
+
280
+ $$
281
+ \mathcal { L } _ { \mu \nu } \geq \widetilde { \mathcal { L } } _ { \mu \nu } : = - \sum _ { B } \int _ { \epsilon } \log ( p ( D _ { t r a i n } | B , V ) ) q ( \epsilon ) q ( B ) d \epsilon d B + \frac { \lambda } { 2 } \mu _ { V } \mu _ { V } ^ { \intercal }
282
+ $$
283
+
284
+ where $\mu _ { V }$ is a vector containing each $\mu _ { v _ { i , j } }$ and $\epsilon$ is a vector containing each $\epsilon _ { i , j }$ .
285
+
286
+ Approximating using Monte Carlo integration for learning (Eq. A.10) and inference (Eq. A.11):
287
+
288
+ $$
289
+ \begin{array} { c l c r } { { \displaystyle \widetilde { \mathcal { L } } _ { \mu \nu } : \approx - \frac { 1 } { n } \sum _ { ( B , \epsilon ) } \log ( p ( D _ { t r a i n } | B , V ) ) + \frac { \lambda } { 2 } \mu _ { V } \mu _ { V } ^ { \intercal } } } \\ { { \displaystyle p ( D _ { t e s t } ) \approx \frac { 1 } { n } \sum _ { ( B , \epsilon ) } p ( D _ { t e s t } | B , V ) } } \end{array}
290
+ $$
291
+
292
+ where $b _ { i , * } \sim B e r n ( p _ { d o } )$ and $\epsilon \sim N ( 0 , 1 )$ .
293
+
294
+ # B CONVOLUTIONAL NEURAL NETWORK ARCHITECTURES
295
+
296
+ # B.1 MNIST
297
+
298
+ Table B.1: The convolutional neural network (CNN) architecture used for MNIST.
299
+
300
+ <table><tr><td rowspan=1 colspan=1>Layer</td><td rowspan=1 colspan=1>Kernel Size</td><td rowspan=1 colspan=1>#Features</td><td rowspan=1 colspan=1>Stride</td><td rowspan=1 colspan=1>Non-linearity</td></tr><tr><td rowspan=1 colspan=1>Conv-1</td><td rowspan=1 colspan=1>5x5</td><td rowspan=1 colspan=1>32</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>ReLU</td></tr><tr><td rowspan=1 colspan=1>MaxPool-1</td><td rowspan=1 colspan=1>2x2</td><td rowspan=1 colspan=1>32</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>Max</td></tr><tr><td rowspan=1 colspan=1>Conv-2</td><td rowspan=1 colspan=1>5x5</td><td rowspan=1 colspan=1>64</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>ReLU</td></tr><tr><td rowspan=1 colspan=1>MaxPool-2</td><td rowspan=1 colspan=1>2x2</td><td rowspan=1 colspan=1>64</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>Max</td></tr><tr><td rowspan=1 colspan=1>FC</td><td rowspan=1 colspan=1>1500</td><td rowspan=1 colspan=1>500</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>ReLU</td></tr><tr><td rowspan=1 colspan=1>Linear</td><td rowspan=1 colspan=1>500</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>-</td></tr></table>
301
+
302
+ # B.2 CIFAR-10
303
+
304
+ Table B.2: The convolutional neural network (CNN) architecture used for CIFAR-10.
305
+
306
+ <table><tr><td rowspan=1 colspan=1>Layer</td><td rowspan=1 colspan=1>Kernel Size</td><td rowspan=1 colspan=1>#Features</td><td rowspan=1 colspan=1>Stride</td><td rowspan=1 colspan=1>Non-linearity</td></tr><tr><td rowspan=1 colspan=1>Conv-1</td><td rowspan=1 colspan=1>3x3</td><td rowspan=1 colspan=1>64</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>ReLU</td></tr><tr><td rowspan=1 colspan=1>Conv-2</td><td rowspan=1 colspan=1>3x3</td><td rowspan=1 colspan=1>64</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>ReLU</td></tr><tr><td rowspan=1 colspan=1>MaxPool-1</td><td rowspan=1 colspan=1>2x2</td><td rowspan=1 colspan=1>64</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>Max</td></tr><tr><td rowspan=1 colspan=1>Conv-3</td><td rowspan=1 colspan=1>3x3</td><td rowspan=1 colspan=1>128</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>ReLU</td></tr><tr><td rowspan=1 colspan=1>Conv-4</td><td rowspan=1 colspan=1>3x3</td><td rowspan=1 colspan=1>128</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>ReLU</td></tr><tr><td rowspan=1 colspan=1>MaxPool-2</td><td rowspan=1 colspan=1>2x2</td><td rowspan=1 colspan=1>128</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>Max</td></tr><tr><td rowspan=1 colspan=1>Conv-5</td><td rowspan=1 colspan=1>3x3</td><td rowspan=1 colspan=1>256</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>ReLU</td></tr><tr><td rowspan=1 colspan=1>Conv-6</td><td rowspan=1 colspan=1>3x3</td><td rowspan=1 colspan=1>256</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>ReLU</td></tr><tr><td rowspan=1 colspan=1>Conv-7</td><td rowspan=1 colspan=1>3x3</td><td rowspan=1 colspan=1>256</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>ReLU</td></tr><tr><td rowspan=1 colspan=1>MaxPool-3</td><td rowspan=1 colspan=1>2x2</td><td rowspan=1 colspan=1>256</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>Max</td></tr><tr><td rowspan=1 colspan=1>Conv-8</td><td rowspan=1 colspan=1>3x3</td><td rowspan=1 colspan=1>512</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>ReLU</td></tr><tr><td rowspan=1 colspan=1>Conv-9</td><td rowspan=1 colspan=1>3x3</td><td rowspan=1 colspan=1>512</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>ReLU</td></tr><tr><td rowspan=1 colspan=1>Conv-10</td><td rowspan=1 colspan=1>3x3</td><td rowspan=1 colspan=1>512</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>ReLU</td></tr><tr><td rowspan=1 colspan=1>MaxPool-4</td><td rowspan=1 colspan=1>2x2</td><td rowspan=1 colspan=1>512</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>Max</td></tr><tr><td rowspan=1 colspan=1>Conv-11</td><td rowspan=1 colspan=1>3x3</td><td rowspan=1 colspan=1>512</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>ReLU</td></tr><tr><td rowspan=1 colspan=1>Conv-12</td><td rowspan=1 colspan=1>3x3</td><td rowspan=1 colspan=1>512</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>ReLU</td></tr><tr><td rowspan=1 colspan=1>Conv-13</td><td rowspan=1 colspan=1>3x3</td><td rowspan=1 colspan=1>512</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>ReLU</td></tr><tr><td rowspan=1 colspan=1>MaxPool-5</td><td rowspan=1 colspan=1>2x2</td><td rowspan=1 colspan=1>512</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>Max</td></tr><tr><td rowspan=1 colspan=1>FC</td><td rowspan=1 colspan=1>512</td><td rowspan=1 colspan=1>512</td><td rowspan=1 colspan=1>二</td><td rowspan=1 colspan=1>ReLU</td></tr><tr><td rowspan=1 colspan=1>Linear</td><td rowspan=1 colspan=1>512</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>-</td></tr></table>
md/train/HJ1kmv9xx/HJ1kmv9xx.md ADDED
@@ -0,0 +1,333 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LR-GAN: LAYERED RECURSIVE GENERATIVE ADVERSARIAL NETWORKS FOR IMAGE GENERATION
2
+
3
+ Jianwei Yang∗ Virginia Tech Blacksburg, VA jw2yang@vt.edu
4
+
5
+ Anitha Kannan Facebook AI Research Menlo Park, CA akannan@fb.com
6
+
7
+ Dhruv Batra∗and Devi Parikh∗ Georgia Institute of Technology Atlanta, GA {dbatra, parikh}@gatech.edu
8
+
9
+ # ABSTRACT
10
+
11
+ We present LR-GAN: an adversarial image generation model which takes scene structure and context into account. Unlike previous generative adversarial networks (GANs), the proposed GAN learns to generate image background and foregrounds separately and recursively, and stitch the foregrounds on the background in a contextually relevant manner to produce a complete natural image. For each foreground, the model learns to generate its appearance, shape and pose. The whole model is unsupervised, and is trained in an end-to-end manner with gradient descent methods. The experiments demonstrate that LR-GAN can generate more natural images with objects that are more human recognizable than DCGAN.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ Generative adversarial networks (GANs) (Goodfellow et al., 2014) have shown significant promise as generative models for natural images. A flurry of recent work has proposed improvements over the original GAN work for image generation (Radford et al., 2015; Denton et al., 2015; Salimans et al., 2016; Chen et al., 2016; Zhu et al., 2016; Zhao et al., 2016), multi-stage image generation including part-based models (Im et al., 2016; Kwak & Zhang, 2016), image generation conditioned on input text or attributes (Mansimov et al., 2015; Reed et al., 2016b;a), image generation based on 3D structure (Wang & Gupta, 2016), and even video generation (Vondrick et al., 2016).
16
+
17
+ While the holistic ‘gist’ of images generated by these approaches is beginning to look natural, there is clearly a long way to go. For instance, the foreground objects in these images tend to be deformed, blended into the background, and not look realistic or recognizable.
18
+
19
+ One fundamental limitation of these methods is that they attempt to generate images without taking into account that images are 2D projections of a 3D visual world, which has a lot of structures in it. This manifests as structure in the 2D images that capture this world. One example of this structure is that images tend to have a background, and foreground objects are placed in this background in contextually relevant ways.
20
+
21
+ We develop a GAN model that explicitly encodes this structure. Our proposed model generates images in a recursive fashion: it first generates a background, and then conditioned on the background generates a foreground along with a shape (mask) and a pose (affine transformation) that together define how the background and foreground should be composed to obtain a complete image. Conditioned on this composite image, a second foreground and an associated shape and pose are generated, and so on. As a byproduct in the course of recursive image generation, our approach generates some object-shape foreground-background masks in a completely unsupervised way, without access to any object masks for training. Note that decomposing a scene into foreground-background layers is a classical ill-posed problem in computer vision. By explicitly factorizing appearance and transformation, LR-GAN encodes natural priors about the images that the same foreground can be ‘pasted’ to the different backgrounds, under different affine transformations. According to the experiments, the absence of these priors result in degenerate foreground-background decompositions, and thus also degenerate final composite images.
22
+
23
+ ![](images/92f1dafd19871af9a89f576fc0395ce1ddba7cbe105573c7bc7d9d76a4374c01.jpg)
24
+ Figure 1: Generation results of our model on CUB-200 (Welinder et al., 2010). It generates images in two timesteps. At the first timestep, it generates background images, while generates foreground images, masks and transformations at the second timestep. Then, they are composed to obtain the final images. From top left to bottom right (row major), the blocks are real images, generated background images, foreground images, foreground masks, carved foreground images, carved and transformed foreground images, final composite images, and their nearest neighbor real images in the training set. Note that the model is trained in a completely unsupervised manner.
25
+
26
+ We mainly evaluate our approach on four datasets: MNIST-ONE (one digit) and MNIST-TWO (two digits) synthesized from MNIST (LeCun et al., 1998), CIFAR-10 (Krizhevsky & Hinton, 2009) and CUB-200 (Welinder et al., 2010). We show qualitatively (via samples) and quantitatively (via evaluation metrics and human studies on Amazon Mechanical Turk) that LR-GAN generates images that globally look natural and contain clear background and object structures in them that are realistic and recognizable by humans as semantic entities. An experimental snapshot on CUB-200 is shown in Fig. 1. We also find that LR-GAN generates foreground objects that are contextually relevant to the backgrounds (e.g., horses on grass, airplanes in skies, ships in water, cars on streets, etc.). For quantitative comparison, besides existing metrics in the literature, we propose two new quantitative metrics to evaluate the quality of generated images. The proposed metrics are derived from the sufficient conditions for the closeness between generated image distribution and real image distribution, and thus supplement existing metrics.
27
+
28
+ # 2 RELATED WORK
29
+
30
+ Early work in parametric texture synthesis was based on a set of hand-crafted features (Portilla & Simoncelli, 2000). Recent improvements in image generation using deep neural networks mainly fall into one of the two stochastic models: variational autoencoders (VAEs) (Kingma et al., 2016) and generative adversarial networks (GANs) (Goodfellow et al., 2014). VAEs pair a top-down probabilistic generative network with a bottom up recognition network for amortized probabilistic inference. Two networks are jointly trained to maximize a variational lower bound on the data likelihood. GANs consist of a generator and a discriminator in a minmax game with the generator aiming to fool the discriminator with its samples with the latter aiming to not get fooled.
31
+
32
+ Sequential models have been pivotal for improved image generation using variational autoencoders: DRAW (Gregor et al., 2015) uses attention based recurrence conditioning on the canvas drawn so far. In Eslami et al. (2016), a recurrent generative model that draws one object at a time to the canvas was used as the decoder in VAE. These methods are yet to show scalability to natural images. Early compelling results using GANs used sequential coarse-to-fine multiscale generation and classconditioning (Denton et al., 2015). Since then, improved training schemes (Salimans et al., 2016) and better convolutional structure (Radford et al., 2015) have improved the generation results using
33
+
34
+ GANs. PixelRNN (van den Oord et al., 2016) is also recently proposed to sequentially generates a pixel at a time, along the two spatial dimensions.
35
+
36
+ In this paper, we combine the merits of sequential generation with the flexibility of GANs. Our model for sequential generation imbibes a recursive structure that more naturally mimics image composition by inferring three components: appearance, shape, and pose. One closely related work combining recursive structure with GAN is that of Im et al. (2016) but it does not explicitly model object composition and follows a similar paradigm as by Gregor et al. (2015). Another closely related work is that of Kwak & Zhang (2016). It combines recursive structure and alpha blending. However, our work differs in three main ways: (1) We explicitly use a generator for modeling the foreground poses. That provides significant advantage for natural images, as shown by our ablation studies; (2) Our shape generator is separate from the appearance generator. This factored representation allows more flexibility in the generated scenes; (3) Our recursive framework generates subsequent objects conditioned on the current and previous hidden vectors, and previously generated object. This allows for explicit contextual modeling among generated elements in the scene. See Fig. 17 for contextually relevant foregrounds generated for the same background, or Fig. 6 for meaningful placement of two MNIST digits relative to each.
37
+
38
+ Models that provide supervision to image generation using conditioning variables have also been proposed: Style/Structure GANs (Wang & Gupta, 2016) learns separate generative models for style and structure that are then composed to obtain final images. In Reed et al. (2016a), GAN based image generation is conditioned on text and the region in the image where the text manifests, specified during training via keypoints or bounding boxes. While not the focus of our work, the model proposed in this paper can be easily extended to take into account these forms of supervision.
39
+
40
+ # 3 PRELIMINARIES
41
+
42
+ # 3.1 GENERATIVE ADVERSARIAL NETWORKS
43
+
44
+ Generative Adversarial Networks (GANs) consist of a generator $G$ and a discriminator $D$ that are simultaneously trained with competing goals: The generator $G$ is trained to generate samples that can ‘fool’ a discriminator $D$ , while the discriminator is trained to classify its inputs as either real (coming from the training dataset) or fake (coming from the samples of $G$ ). This competition leads to a minmax formulation with a value function:
45
+
46
+ $$
47
+ \operatorname* { m i n } _ { \theta _ { G } } \operatorname* { m a x } _ { \theta _ { D } } \Big ( \mathrm { E } _ { a \sim p _ { d a t a } ( x ) } [ \log ( D ( x ; \theta _ { D } ) ) ] + \mathrm { E } _ { z \sim p _ { z } ( z ) } [ \log ( 1 - D ( G ( z ; \theta _ { G } ) ; \theta _ { D } ) ) ] \Big ) ,
48
+ $$
49
+
50
+ where $_ { z }$ is a random vector from a standard multivariate Gaussian or a uniform distribution $p _ { z } ( z )$ , $G ( z ; \theta _ { G } )$ maps $_ z$ to the data space, $D ( { \pmb x } )$ is the probability that $_ { \textbf { \em x } }$ is real estimated by $D$ . The advantage of the GANs formulation is that it lacks an explicit loss function and instead uses the discriminator to optimize the generative model. The discriminator, in turn, only cares whether the sample it receives is on the data manifold, and not whether it exactly matches a particular training example (as opposed to losses such as MSE). Hence, the discriminator provides a gradient signal only when the generated samples do not lie on the data manifold so that the generator can readjust its parameters accordingly. This form of training enables learning the data manifold of the training set and not just optimizing to reconstruct the dataset, as in autoencoder and its variants.
51
+
52
+ While the GANs framework is largely agnostic to the choice of $G$ and $D$ , it is clear that generative models with the ‘right’ inductive biases will be more effective in learning from the gradient information (Denton et al., 2015; Im et al., 2016; Gregor et al., 2015; Reed et al., 2016a; Yan et al., 2015). With this motivation, we propose a generator that models image generation via a recurrent process – in each time step of the recurrence, an object with its own appearance and shape is generated and warped according to a generated pose to compose an image in layers.
53
+
54
+ # 3.2 LAYERED STRUCTURE OF IMAGE
55
+
56
+ An image taken of our 3D world typically contains a layered structure. One way of representing an image layer is by its appearance and shape. As an example, an image $_ { \textbf { \em x } }$ with two layers, foreground $f$ and background $^ { b }$ may be factorized as:
57
+
58
+ $$
59
+ \pmb { x } = \pmb { f } \odot \pmb { m } + \pmb { b } \odot ( 1 - \pmb { m } ) ,
60
+ $$
61
+
62
+ where $_ { \mathbf { \nabla } } \mathbf { m } _ { \mathbf { \nabla } }$ is the mask depicting the shapes of image layers, and $\odot$ the element wise multiplication operator. Some existing methods assume the access to the shape of the object either during training (Isola & Liu, 2013) or both at train and test time (Reed et al., 2016a; Yan et al., 2015). Representing images in layered structure is even straightforward for video with moving objects (Darrell & Pentland, 1991; Wang & Adelson, 1994; Kannan et al., 2005). Vondrick et al. (2016) generates videos by separately generating a fixed background and moving foregrounds. A similar way of generating single image can be found in Kwak & Zhang (2016).
63
+
64
+ Another way is modeling the layered structure with object appearance and pose as:
65
+
66
+ $$
67
+ \pmb { x } = S T ( \pmb { f } , \pmb { a } ) + \pmb { b } ,
68
+ $$
69
+
70
+ where $f$ and $^ { b }$ are foreground and background, respectively; $\textbf { \em a }$ is the affine transformation; $S T$ is the spatial transformation operator. Several works fall into this group (Roux et al., 2011; Huang & Murphy, 2015; Eslami et al., 2016). In Huang & Murphy (2015), images are decomposed into layers of objects with specific poses in a variational autoencoder framework, while the number of objects (i.e., layers) is adaptively estimated in Eslami et al. (2016).
71
+
72
+ To contrast with these works, LR-GAN uses a layered composition, and the foreground layers simultaneously model all three dominant factors of variation: appearance $f$ , shape $_ { \mathbf { \nabla } } \mathbf { m }$ and pose $\textbf { \em a }$ . We will elaborate it in the following section.
73
+
74
+ # 4 LAYERED RECURSIVE GAN (LR-GAN)
75
+
76
+ The basic structure of LR-GAN is similar to GAN: it consists of a discriminator and a generator that are simultaneously trained using the minmax formulation of GAN, as described in $\ S . 3 . 1$ . The key innovation of our work is the layered recursive generator, which is what we describe in this section.
77
+
78
+ The generator in LR-GAN is recursive in that the image is constructed recursively using a recurrent network. Layered in that each recursive step composes an object layer that is ‘pasted’ on the image generated so far. Object layer at timestep $t$ is parameterized by the following three constituents – ‘canonical’ appearance $\pmb { f } _ { t }$ , shape (or mask) $\mathbf { \nabla } m _ { t }$ , and pose (or affine transformation) $\mathbf { } \mathbf { a } _ { t }$ for warping the object before pasting in the image composition.
79
+
80
+ Fig. 2 shows the architecture of the LR-GAN with the generator architecture unrolled for generating background $\scriptstyle { \mathbf { { \mathit { x } } } } _ { 0 }$ $( \doteq \pmb { x } _ { b } )$ and foreground $\scriptstyle { \mathbf { { \vec { x } } } } _ { 1 }$ and $\mathbf { x } _ { 2 }$ . At each time step $t$ , the generator composes the next image $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ via the following recursive computation:
81
+
82
+ $$
83
+ \begin{array} { r l } { x _ { t } = \mathrm { ~ { \mathcal { S } } ~ } T ( m _ { t } , a _ { t } ) , \quad \odot \quad } & { { } { \mathcal { S } } T ( f _ { t } , a _ { t } ) , \quad \quad + ( 1 - { S T } ( m _ { t } , a _ { t } ) ) \odot x _ { t - 1 , } , \quad \forall t \in [ 1 , T ] } \end{array}
84
+ $$
85
+
86
+ where $S T ( \circ , \pmb { a } _ { t } )$ is a spatial transformation operator that outputs the affine transformed version of $\diamond$ with $\mathbf { } \mathbf { a } _ { t }$ indicating parameters of the affine transformation.
87
+
88
+ Since our proposed model has an explicit transformation variable $\mathbf { } \mathbf { a } _ { t }$ that is used to warp the object, it can learn a canonical object representation that can be re-used to generate scenes where the object occurs as mere transformations of it, such as different scales or rotations. By factorizing the appearance, shape and pose, the object generator can focus on separately capturing regularities in these three factors that constitute an object. We will demonstrate in our experiments that removing these factorizations from the model leads to its spending capacity in variability that may not solely be about the object in Section 5.5 and 5.6.
89
+
90
+ # 4.1 DETAILS OF GENERATOR ARCHITECTURE
91
+
92
+ Fig. 2 shows our LR-GAN architecture in detail – we use different shapes to indicate different kinds of layers (convolutional, fractional convolutional, (non)linear, etc), as indicated by the legend. Our model consists of two main pieces – a background generator $G _ { b }$ and a foreground generator $G _ { f }$ . $G _ { b }$ and $G _ { f }$ do not share parameters with each other. $G _ { b }$ computation happens only once, while $G _ { f }$ is recurrent over time, i.e., all object generators share the same parameters. In the following, we will introduce each module and connections between them.
93
+
94
+ Temporal Connections. LR-GAN has two kinds of temporal connections – informally speaking, one on ‘top’ and one on ‘bottom’. The ‘top’ connections perform the act of sequentially ‘pasting’ object layers (Eqn. 4). The ‘bottom’ connections are constructed by a LSTM on the noise vectors $z _ { \mathrm { 0 } } , z _ { \mathrm { 1 } } , z _ { \mathrm { 2 } }$ . Intuitively, this noise-vector-LSTM provides information to the foreground generator about what else has been generated in past. Besides, when generating multiple objects, we use a pooling layer $P _ { f } ^ { c }$ and a fully-connected layer $E _ { f } ^ { c }$ to extract the information from previous generated object response map. By this way, the model is able to ‘see’ previously generated objects.
95
+
96
+ ![](images/79a2c73e95232f085950c43b5fe393cac10d2e42a3969656315cbce8f01e7db4.jpg)
97
+ Figure 2: LR-GAN architecture unfolded to three timesteps. It mainly consists of one background generator, one foreground generator, temporal connections and one discriminator. The meaning of each component is explained in the legend.
98
+
99
+ Background Generator. The background generator $G _ { b }$ is purposely kept simple. It takes the hidden state of noise-vector-LSTM $h _ { l } ^ { 0 }$ as the input and passes it to a number of fractional convolutional layers (also called ‘deconvolution’ layer in some papers) to generate images at its end. The output of background generator $\scriptstyle { \mathbf { \mathcal { x } } } _ { b }$ will be used as the canvas for the following generated foregrounds.
100
+
101
+ Foreground Generator. The foreground generator $G _ { f }$ is used to generate an object with appearance and shape. Correspondingly, $G _ { f }$ consists of three sub-modules, $G _ { f } ^ { c }$ , which is a common ‘trunk’ whose outputs are shared by $G _ { f } ^ { i }$ and $G _ { f } ^ { m }$ . $G _ { f } ^ { i }$ is used to generate the foreground appearance $\pmb { f } _ { t }$ , while $G _ { f } ^ { m }$ generates the mask $\mathbf { \nabla } m _ { t }$ for the foreground. All three sub-modules consists of one or more fractional convolutional layers combined with batch-normalization and nonlinear layers. The generated foreground appearance and mask have the same spatial size as the background. The top of $G _ { f } ^ { m }$ is a sigmoid layer in order to generate one channel mask whose values range in $( 0 , 1 )$ .
102
+
103
+ Spatial Transformer. To spatially transform foreground objects, we need to estimate the transformation matrix. As in Jaderberg et al. (2015), we predict the affine transformation matrix with a linear layer $T _ { f }$ that has six-dimensional outputs. Then based on the predicted transformation matrix, we use a grid generator $G _ { g }$ to generate the corresponding sampling coordinates in the input for each location at the output. The generated foreground appearance and mask share the same transformation matrix, and thus the same sampling grid. Given the grid, the sampler $S$ will simultaneously sample the $\pmb { f } _ { t }$ and ${ \mathbf { } } m _ { t }$ to obtain $\hat { f } _ { t }$ and $\hat { m } _ { t }$ , respectively. Different from Jaderberg et al. (2015), our sampler here normally performs downsampling, since the the foreground typically has smaller size than the background. Pixels in $\hat { f } _ { t }$ and $\hat { m } _ { t }$ that are from outside the extent of $\pmb { f } _ { t }$ and ${ \mathbf { } } m _ { t }$ are set to zero. Finally, $\hat { f } _ { t }$ and $\hat { m } _ { t }$ are sent to the compositor $C$ which combines the canvas ${ \mathbf { } } _ { { \mathbf { } } { \mathbf { } } { \mathbf { } } - 1 }$ and $\hat { f } _ { t }$ through layered composition with blending weights given by $\hat { m } _ { t }$ (Eqn. 4).
104
+
105
+ Pseudo-code for our approach and detailed model configuration are provided in the Appendix.
106
+
107
+ # 4.2 NEW EVALUATION METRICS
108
+
109
+ Several metrics have been proposed to evaluate GANs, such as Gaussian parzen window (Goodfellow et al., 2014), Generative Adversarial Metric (GAM) (Im et al., 2016) and Inception Score (Salimans et al., 2016). The common goal is to measure the similarity between the generated data distribution $P _ { g } ( \pmb { x } ) = G ( \pmb { z } ; \theta _ { z } )$ and the real data distribution $P ( { \pmb x } )$ . Most recently, Inception Score has been used in several works (Salimans et al., 2016; Zhao et al., 2016). However, it is an assymetric metric and could be easily fooled by generating centers of data modes.
110
+
111
+ In addition to these metrics, we present two new metrics based on the following intuition – a sufficient (but not necessary) condition for closeness of $P _ { g } ( \pmb { x } )$ and $P ( { \pmb x } )$ is closeness of $P _ { g } ( \pmb { x } | y )$ and $P ( { \pmb x } | { \pmb y } )$ , i.e., distributions of generated data and real data conditioned on all possible variables of interest $y$ , e.g., category label. One way to obtain this variable of interest $y$ is via human annotation. Specifically, given the data sampled from $P _ { g } ( \pmb { x } )$ and $P ( { \pmb x } )$ , we ask people to label the category of the samples according to some rules. Note that such human annotation is often easier than comparing samples from the two distributions (e.g., because there is no 1:1 correspondence between samples to conduct forced-choice tests).
112
+
113
+ After the annotations, we need to verify whether the two distributions are similar in each category. Clearly, directly comparing the distributions $P _ { g } ( \pmb { x } | y )$ and $P ( { \pmb x } | { \pmb y } )$ may be as difficult as comparing $P _ { g } ( \pmb { x } )$ and $P ( { \pmb x } )$ . Fortunately, we can use Bayes rule and alternatively compare $P _ { g } ( y | \mathbf { \boldsymbol { x } } )$ and $P ( y | \bar { \mathbf { x } } )$ , which is a much easier task. In this case, we can simply train a discriminative model on the samples from $P _ { g } ( \pmb { x } )$ and $P ( { \pmb x } )$ together with the human annotations about categories of these samples. With a slight abuse of notation, we use $P _ { g } ( y | \mathbf { \boldsymbol { x } } )$ and $P ( y | \pmb { x } )$ to denote probability outputs from these two classifiers (trained on generated samples vs trained on real samples). We can then use these two classifiers to compute the following two evaluation metrics:
114
+
115
+ Adversarial Accuracy: Computes the classification accuracies achieved by these two classifiers on a validation set, which can be the training set or another set of real images sampled from $P ( { \pmb x } )$ . If $P _ { g } ( \pmb { x } )$ is close to $P ( { \pmb x } )$ , we expect to see similar accuracies.
116
+
117
+ Adversarial Divergence: Computes the KL divergence between $P _ { g } ( y | \mathbf { \boldsymbol { x } } )$ and $P ( \boldsymbol { y } | \boldsymbol { x } )$ . The lower the adversarial divergence, the closer two distributions are. The low bound for this metric is exactly zero, which means $\bar { P _ { g } } ( y | \mathbf { x } ) = P ( y | \mathbf { x } )$ for all samples in the validation set.
118
+
119
+ As discussed above, we need human efforts to label the real and generated samples. Fortunately, we can further simplify this. Based on the labels given on training data, we split the training data into categories, and train one generator for each category. With all these generators, we generate samples of all categories. This strategy will be used in our experiments on the datasets with labels given.
120
+
121
+ # 5 EXPERIMENT
122
+
123
+ We conduct qualitative and quantitative evaluations on three datasets: 1) MNIST (LeCun et al., 1998); 2) CIFAR-10 (Krizhevsky & Hinton, 2009); 3) CUB-200 (Welinder et al., 2010). To add variability to the MNIST images, we randomly scale (factor of 0.8 to 1.2) and rotate $( - \frac { \pi } { 4 }$ to $\frac { \pi } { 4 }$ ) the digits and then stitch them to $4 8 \times 4 8$ uniform backgrounds with random grayscale value between [0, 200]. Images are then rescaled back to $3 2 \times 3 2$ . Each image thus has a different background grayscale value and a different transformed digit as foreground. We rename this sythensized dataset as MNIST-ONE (single digit on a gray background). We also synthesize a dataset MNIST-TWO containing two digits on a grayscale background. We randomly select two images of digits and perform similar transformations as described above, and put one on the left and the other on the right side of a $7 8 \times 7 8$ gray background. We resize the whole image to $6 4 \times 6 4$ .
124
+
125
+ We develop LR-GAN based on open source code1. We assume the number of objects is known. Therefore, for MNIST-ONE, MNIST-TWO, CIFAR-10, and CUB-200, our model has two, three, two, and two timesteps, respectively. Since the size of foreground object should be smaller than that of canvas, we set the minimal allowed scale 2 in affine transforamtion to be 1.2 for all datasets except for MNIST-TWO, which is set to 2 (objects are smaller in MNIST-TWO). In LR-GAN, the background generator and foreground generator have similar architectures. One difference is that the number of channels in the background generator is half of the one in the foreground generator. We compare our results to that of DCGAN (Radford et al., 2015). Note that LR-GAN without LSTM at the first timestep corresponds exactly to the DCGAN. This allows us to run controlled experiments. In both generator and discriminator, all the (fractional) convolutional layers have $4 \times$ 4 filter size with stride 2. As a result, the number of layers in the generator and discriminator automatically adapt to the size of training images. Please see the Appendix (Section 6.2) for details about the configurations. We use three metrics for quantitative evaluation, including Inception Score (Salimans et al., 2016) and the proposed Adversarial Accuracy, Adversarial Divergence. Note that we report two versions of Inception Score. One is based on the pre-trained Inception net, and the other one is based on the pre-trained classifier on the target datasets.
126
+
127
+ ![](images/ea9d1888db5f0175c63f7dc33705c1a85c916ddedfeb9fbe58ce22e363880dc6.jpg)
128
+ Figure 3: Generated images on CIFAR-10 based on our model.
129
+
130
+ ![](images/e4acd62c5dabc349e9e9d71827aa0583fbb417f9871d9c1a9114d2dafafaa62e.jpg)
131
+ Figure 4: Generated images on CUB-200 based on our model.
132
+
133
+ # 5.1 QUALITATIVE RESULTS
134
+
135
+ In Fig. 3 and 4, we show the generated samples for CIFAR-10 and CUB-200, respectively. MNIST results are shown in the next subsection. As we can see from the images, the compositional nature of our model results in the images being free of blending artifacts between backgrounds and foregrounds. For CIFAR-10, we can see the horses and cars with clear shapes. For CUB-200, the bird shapes tend to be even sharper.
136
+
137
+ # 5.2 MNIST-ONE AND MNIST-TWO
138
+
139
+ We now report the results on MNIST-ONE and MNIST-TWO. Fig. 5 shows the generation results of our model on MNIST-ONE. As we can see, our model generates the background and the foreground in separate timestep, and can disentagle the foreground digits from background nearly perfectly. Though initial values of the mask randomly distribute in the range of $( 0 , 1 )$ , after training, the masks are nearly binary and accurately carve out the digits from the generated foreground. More results on MNIST-ONE (including human studies) can be found in the Appendix (Section 6.3).
140
+
141
+ Fig. 6 shows the generation results for MNIST-TWO. Similarly, the model is also able to generate background and the two foreground objects separately. The foreground generator tends to generate a single digit at each timestep. Meanwhile, it captures the context information from the previous time steps. When the first digit is placed to the left side, the second one tends to be placed on the right side, and vice versa.
142
+
143
+ ![](images/c9088480f0d89fd14b3ceff741b6beacdf0fbbe1c67e90e5b58b50cda1cee1bc.jpg)
144
+ Figure 5: Generation results of our model on MNIST-ONE. From left to right, the image blocks are real images, generated background images, generated foreground images, generated masks and final composite images, respectively.
145
+
146
+ ![](images/2d8099797d1198840f43f9d1a7f0d7128c29860c6fe6e072e1b531c7c038e259.jpg)
147
+ Figure 6: Generation results of our model on MNIST-TWO. From top left to bottom right (row major), the image blocks are real images, generated background images, foreground images and masks at the second timestep, composite images at the second time step, generated foreground images and masks at the third timestep and the final composite images, respectively.
148
+
149
+ # 5.3 CUB-200
150
+
151
+ We study the effectiveness of our model trained on the CUB-200 bird dataset. In Fig. 1, we have shown a random set of generated images, along with the intermediate generation results of the model. While being completely unsupervised, the model, for a large fraction of the samples, is able to successfully disentangle the foreground and the background. This is evident from the generated bird-like masks.
152
+
153
+ ![](images/989f9d2e3d2a4070720b93cdc749bb21b33c2a5270b5c3240d846bda141714b0.jpg)
154
+ Figure 7: Matched pairs of generated images based on DCGAN and LR-GAN, respectivedly. The odd columns are generated by DCGAN, and the even columns are generated by LR-GAN. These are paired according to the perfect matching based on Hungarian algorithm.
155
+
156
+ ![](images/a9475bb0409c08b9126b69efdcf7c3260d528ffc6572639fda597aa5f1790a74.jpg)
157
+ Figure 8: Qualitative comparison on CIFAR-10. Top three rows are images generated by DCGAN; Bottom three rows are by LR-GAN. From left to right, the blocks display generated images with increasing quality level as determined by human studies.
158
+
159
+ We do a comparative study based on Amazon Mechanical Turk (AMT) between DCGAN and LRGAN to quantify relative visual quality of the generated images. We first generated 1000 samples from both the models. Then, we performed perfect matching between the two image sets using the Hungarian algorithm on $L 2$ norm distance in the pixel space. This resulted in 1000 image pairs. Some examplar pairs are shown in Fig. 7. For each image pair, 9 judges are asked to choose the one that is more realistic. Based on majority voting, we find that our generated images are selected $6 8 . 4 \%$ times, compared with $3 1 . 6 \%$ times for DCGAN. This demonstrates that our model has generated more realistic images than DCGAN. We can attribute this difference to our model’s ability to generate foreground separately from the background, enabling stronger edge cues.
160
+
161
+ # 5.4 CIFAR-10
162
+
163
+ We now qualitatively and quantitatively evaluate our model on CIFAR-10, which contains multiple object categories and also various backgrounds.
164
+
165
+ Comparison of image generation quality: We conduct AMT studies to compare the fidelity of image generation. Towards this goal, we generate 1000 images from DCGAN and LR-GAN, respectively. We ask 5 judges to label each image to either belong to one of the 10 categories or as ‘non recognizable’ or ‘recognizable but not belonging to the listed categories’. We then assign each image a quality level between [0,5] that captures the number of judges that agree with the majority choice. Fig. 8 shows the images generated by both approaches, ordered by increasing quality level. We merge images at quality level 0 (all judges said non-recognizable) and 1 together, and similarly images at level 4 and 5. Visually, the generated samples by our model have clearer boundaries and object structures. We also computed the fraction of non-recognizable images: Our model had a $10 \%$ absolute drop in non-recognizability rate $( 6 7 . 3 \%$ for ours vs. $7 7 . 7 \%$ for DCGAN). For reference, $1 1 . 4 \%$ of real CIFAR images were categorized as non-recognizable. Fig. 9 shows more generated (intermediate) results of our model.
166
+
167
+ Quantitative evaluation on generators: We evaluate the generators based on three metrics: 1) Inception Score; 2) Adversarial Accuracy; 3) Adversarial Divergence. To obtain a classifier model for evaluation, we remove the top layer in the discriminator used in our model, and then append two fully connected layers on the top of it. We train this classifier using the training samples of CIFAR-10 based on the annotations. Following Salimans et al. (2016), we generated 50,000 images based on DCGAN and LR-GAN, repsectively. We compute two types of Inception Scores. The standard Inception Score is based on the Inception net as in Salimans et al. (2016), and the contextual Inception Score is based on our trained classifier model. To distinguish, we denote the standard one as ‘Inception Score†’, and the contextual one as ‘Inception Score††’. To obtain the Adversarial Accuracy and Adversarial Divergence scores, we train one generator on each of 10 categories for DCGAN and LR-GAN, respectively. Then, we use these generators to generate samples of different categories. Given these generated samples, we train the classifiers for DCGAN and LR-GAN separately. Along with the classifier trained on the real samples, we compute the Adversarial Accuracy and Adversarial Divergence on the real training samples. In Table 1, we report the Inception Scores, Adversarial Accuracy and Adversarial Divergence for comparison. We can see that our model outperforms DCGAN across the board. To point out, we obtan different Inception Scores based on different classifier models, which indicates that the Inception Score varies with different models.
168
+
169
+ Table 1: Quantitative comparison between DCGAN and LR-GAN on CIFAR-10.
170
+
171
+ <table><tr><td>Training Data</td><td>Real Images</td><td>DCGAN</td><td>Ours</td></tr><tr><td>Inception Scoret</td><td>11.18±0.18</td><td>6.64±0.14</td><td>7.17±0.07</td></tr><tr><td>Inception Scorett</td><td>7.23±0.09</td><td>5.69±0.07</td><td>6.11±0.06</td></tr><tr><td>Adversarial Accuracy</td><td>83.33±0.08</td><td>37.81±0.02</td><td>44.22 ±0.08</td></tr><tr><td>Adversarial Divergence</td><td>0</td><td>7.58±0.04</td><td>5.57±0.06</td></tr></table>
172
+
173
+ †Evaluate using the pre-trained Inception net as Salimans et al. (2016) ††Evaluate using the supervisedly trained classifier based on the discriminator in LR-GAN.
174
+
175
+ ![](images/62ac4ea9d7d7caf7d3df3bbf1cae137f708b8b0c172bc331afc28396ddbc5e74.jpg)
176
+ Figure 9: Generation results of our model on CIFAR-10. From left to right, the blocks are: generated background images, foreground images, foreground masks, foreground images carved out by masks, carved foregrounds after spatial transformation, final composite images and nearest neighbor training images to the generated images.
177
+
178
+ ![](images/e40422586846dc636bdcad89dabebfc927006c7e46aae4a86839c89cd3cfcb2d.jpg)
179
+ Figure 10: Category specific generation results of our model on CIFAR-10 categories of horse, frog, and cat (top to bottom). The blocks from left to right are: generated background images, foreground images, foreground masks, foreground images carved out by masks, carved foregrounds after spatial transformation and final composite images.
180
+
181
+ Quantitative evaluation on discriminators: We evaluate the discriminator as an extractor for deep representations. Specifically, we use the output of the last convolutional layer in the discriminator as features. We perform a 1-NN classification on the test set given the full training set. Cosine similarity is used as the metric. On the test set, our model achieves $6 2 . 0 9 \% \pm 0 . 0 1 \%$ compared to DCGAN’s $5 6 . 0 5 \% \pm 0 . 0 2 \%$ .
182
+
183
+ Contextual generation: We also show the efficacy of our approach to generate diverse foregrounds conditioned on fixed background. The results in Fig. 17 in Appendix showcase that the foreground generator generates objects that are compatible with the background. This indicates that the model has captured contextual dependencies between the image layers.
184
+
185
+ Category specific models: The objects in CIFAR-10 exhibit huge variability in shapes. That can partly explain why some of the generated shapes are not as compelling in Fig. 9. To test this hypothesis, we reuse the generators trained for each of 10 categories used in our metrics to obtain the generation results. Fig. 10 shows results for categories ‘horse’, ‘frog’ and ‘cat’. We can see that the model is now able to generate object-specific appearances and shapes, similar in vein to our results on the CUB-200 dataset.
186
+
187
+ # 5.5 IMPORTANCE OF TRANSFORMATIONS
188
+
189
+ ![](images/4ce0b42c6c668769875b477b80ca2f9c2683243d0e9ffa760e24f65378ec4efe.jpg)
190
+ Figure 11: Generation results from an ablated LR-GAN model without affine transformations. From top to bottom, the block rows correspond to different datasets: MNIST-ONE, CUB-200, CIFAR-10. From left to right, the blocks show generated background images, foreground images, foreground masks, and final composite images. For comparison, the rightmost column block shows final generated images from a non-ablated model with affine transformations.
191
+
192
+ Fig. 11 shows results from an ablated model without affine transformations in the foreground layers, and compares the results with the full model that does include these transformations. We note that one significant problem emerges that the decompositions are degenerate, in the sense that the model is unable to break the symmetry between foreground and background layers, often generating object appearances in the model’s background layer and vice versa. For CUB-200, the final generated images have some blendings between foregrounds and backgrounds. This is particularly the case for those images without bird-shape masks. For CIFAR-10, a number of generated masks are inverted. In this case, the background images are carved out as the foreground objects. The foreground generator takes almost all the duty to generate the final images, which make it harder to generate images as clear as the model with transformation. From these comparisons, we qualitatively demonstrate the importance of modeling transformations in the foreground generation process. Another merit of using transformation is that the intermediate outputs of the model are more interpretable and faciliate to the downstreaming tasks, such as scene paring, which is demonstrated in Section 6.8.
193
+
194
+ ![](images/069b696a48bdecf8e3ddad01ced1477fa9c80c42733db17aea2ce3df16990a4b.jpg)
195
+ Figure 12: Generation results from an ablated LR-GAN model without mask generator. The block rows correspond to different datasets (from top to bottom: MNIST-ONE, CUB-200, CIFAR-10). From left to right, the blocks show generated background images, foreground images, transformed foreground images, and final composite images. For comparison, the rightmost column block shows final generated images from a non-ablated model with mask generator.
196
+
197
+ # 5.6 IMPORTANCE OF SHAPES
198
+
199
+ We perform another ablation study by removing the mask generator to understand the importance of modeling object shapes. In this case, the generated foreground is simply pasted on top of the generated background after being transformed. There is no alpha blending between the foregrounds and backgrounds. The generation results for three datasets, MNIST-ONE, CUB-200, CIFAR-10 are shown in Fig. 12. As we can see, though the model works well for the generation of MNIST-ONE, it fails to generate reasonable images across the other datasets. Particularly, the training does not even converge for CUB-200. Based on these results, we qualitatively demonstrate that mask generator in our model is fairly important to obtain plausible results, especially for realistic images.
200
+
201
+ # REFERENCES
202
+
203
+ Xi Chen, Yan Duan, Rein Houthooft, John Schulman, Ilya Sutskever, and Pieter Abbeel. Infogan: Interpretable representation learning by information maximizing generative adversarial nets. arXiv preprint arXiv:1606.03657, 2016.
204
+
205
+ Trevor Darrell and Alex Pentland. Robust estimation of a multi-layered motion representation. IEEE Workshop on Visual Motion, 1991.
206
+
207
+ Emily L Denton, Soumith Chintala, Rob Fergus, et al. Deep generative image models using a laplacian pyramid of adversarial networks. In Advances in neural information processing systems, pp. 1486–1494, 2015.
208
+ S. M. Ali Eslami, Nicolas Heess, Theophane Weber, Yuval Tassa, Koray Kavukcuoglu, and Geoffrey E. Hinton. Attend, infer, repeat: Fast scene understanding with generative models. CoRR, abs/1603.08575, 2016.
209
+ 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.
210
+ Karol Gregor, Ivo Danihelka, Alex Graves, Danilo Jimenez Rezende, and Daan Wierstra. Draw: A recurrent neural network for image generation. arXiv preprint arXiv:1502.046239, 2015.
211
+ Gary B. Huang, Manu Ramesh, Tamara Berg, and Erik Learned-Miller. Labeled faces in the wild: A database for studying face recognition in unconstrained environments. Technical Report 07-49, University of Massachusetts, Amherst, October 2007.
212
+ Jonathan Huang and Kevin Murphy. Efficient inference in occlusion-aware generative models of images. CoRR, abs/1511.06362, 2015.
213
+ Daniel Jiwoong Im, Chris Dongjoo Kim, Hui Jiang, and Roland Memisevic. Generating images with recurrent adversarial networks. arXiv preprint arXiv:1602.05110, 2016.
214
+ Phillip Isola and Ce Liu. Scene collaging: Analysis and synthesis of natural images with semantic layers. In IEEE International Conference on Computer Vision, pp. 3048–3055, 2013.
215
+ Max Jaderberg, Karen Simonyan, Andrew Zisserman, and koray kavukcuoglu. Spatial transformer networks. In Advances in Neural Information Processing Systems 28, pp. 2017–2025, 2015.
216
+ Anitha Kannan, Nebojsa Jojic, and Brendan Frey. Generative model for layers of appearance and deformation. AISTATS, 2005.
217
+ Diederik P Kingma, Tim Salimans, and Max Welling. Improving variational inference with inverse autoregressive flow. arXiv preprint arXiv:1606.04934, 2016.
218
+ Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. 2009.
219
+ Hanock Kwak and Byoung-Tak Zhang. Generating images part by part with composite generative adversarial networks. arXiv preprint arXiv:1607.05387, 2016.
220
+ Yann LeCun, Leon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to ´ document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
221
+ Elman Mansimov, Emilio Parisotto, Jimmy Lei Ba, and Ruslan Salakhutdinov. Generating images from captions with attention. arXiv preprint arXiv:1511.02793, 2015.
222
+ Javier Portilla and Eero P Simoncelli. A parametric texture model based on joint statistics of complex wavelet coefficients. International journal of computer vision, 40(1):49–70, 2000.
223
+ Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. arXiv preprint arXiv:1511.06434, 2015.
224
+ Scott Reed, Zeynep Akata, Santosh Mohan, Samuel Tenka, Bernt Schiele, and Honglak Lee. Learning what and where to draw. arXiv preprint arXiv:1610.02454, 2016a.
225
+ Scott Reed, Zeynep Akata, Xinchen Yan, Lajanugen Logeswaran, Bernt Schiele, and Honglak Lee. Generative adversarial text to image synthesis. arXiv preprint arXiv:1605.05396, 2016b.
226
+ Nicolas Le Roux, Nicolas Heess, Jamie Shotton, and John Winn. Learning a generative model of images by factoring appearance and shape. Neural Computation, 23:593–650, 2011.
227
+ Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. arXiv preprint arXiv:1606.03498, 2016.
228
+ Aaron van den Oord, Nal Kalchbrenner, and Koray Kavukcuoglu. Pixel recurrent neural networks.¨ CoRR, abs/1601.06759, 2016.
229
+ Carl Vondrick, Hamed Pirsiavash, and Antonio Torralba. Generating videos with scene dynamics. arXiv preprint arXiv:1609.02612, 2016.
230
+ John Wang and Edward Adelson. Representing moving images with layers. IEEE Transactions on Image Processing, 1994.
231
+ Xiaolong Wang and Abhinav Gupta. Generative image modeling using style and structure adversarial networks. arXiv preprint arXiv:1603.05631, 2016.
232
+ P. Welinder, S. Branson, T. Mita, C. Wah, F. Schroff, S. Belongie, and P. Perona. Caltech-UCSD Birds 200. Technical Report CNS-TR-2010-001, California Institute of Technology, 2010.
233
+ Xinchen Yan, Jimei Yang, Kihyuk Sohn, and Honglak Lee. Attribute2image: Conditional image generation from visual attributes. CoRR, abs/1512.00570, 2015.
234
+ Junbo Zhao, Michael Mathieu, and Yann LeCun. Energy-based generative adversarial network. arXiv preprint arXiv:1609.03126, 2016.
235
+ Jun-Yan Zhu, Philipp Krahenb ¨ uhl, Eli Shechtman, and Alexei A Efros. Generative visual manipu- ¨ lation on the natural image manifold. In European Conference on Computer Vision, pp. 597–613. Springer, 2016.
236
+
237
+ # 6 APPENDIX
238
+
239
+ # 6.1 ALGORITHM
240
+
241
+ Algo. 1 illustrates the generative process in our model. $g ( \star )$ evaluates the function $g$ at $\star$ . $\circ$ is a composition operator that composes its operands so that $f \circ g ( \star ) = f ( g ( \star ) )$ .
242
+
243
+ Algorithm 1 Stochastic Layered Recursive Image Generation
244
+
245
+ <table><tr><td>1: zo ~ N(0,I)</td></tr><tr><td>2: xg=Gb(z0) &gt;background generator</td></tr><tr><td>4:c←0 5: fort∈[1..·T] do 6: zt ~ N(0,I)</td></tr><tr><td>7: ht,ct ←LSTM([zt,ht-1,ct-1]) &gt; pass through LSTM</td></tr><tr><td>8: if t=1 then</td></tr><tr><td>9: yt←ht 10: else</td></tr><tr><td>11: yt←E(hth-1) &gt; pass through non-linear embedding layers El</td></tr><tr><td>12: end if</td></tr><tr><td>13: St←G(yt) V predict shared cube for G&#x27;f and Gm</td></tr><tr><td>14: at←Tf(yt) Vobject transformation</td></tr><tr><td>15: ft←G(st) Vgenerate object appearance</td></tr><tr><td>16: mt←Gm(st) generate object shape</td></tr><tr><td>17: h←EoPf(st) &gt; predict shared represenation embedding</td></tr><tr><td>18: xt ← ST(mt,at) ① ST(ft,at) +(1- ST(mt,at)) ① xt-1 19: end for</td></tr></table>
246
+
247
+ # 6.2 MODEL CONFIGURATIONS
248
+
249
+ Table 2 lists the information and model configuration for different datasets. The dimensions of random vectors and hidden vectors are all set to 100. We also compare the number of parameters in DCGAN and LR-GAN. The numbers before $" / "$ are our model, after $\cdot / { \cdot }$ are DCGAN. Based on the same notation used in (Zhao et al., 2016), the architectures for the different datasets are:
250
+
251
+ Table 2: Information and model configurations on different datasets.
252
+
253
+ <table><tr><td>Dataset</td><td>MNIST-ONE</td><td>MNIST-TWO</td><td>CIFAR-10</td><td>CUB-200</td></tr><tr><td>Image Size</td><td>32</td><td>64</td><td>32</td><td>64</td></tr><tr><td>#Images</td><td>60,000</td><td>60,000</td><td>50,000</td><td>5,994</td></tr><tr><td>#Timesteps</td><td>2</td><td>3</td><td>2</td><td>2</td></tr><tr><td>#Parameters</td><td>5.25M/4.11M</td><td>7.53M/6.33M</td><td>5.26M/4.11M</td><td>27.3M/6.34M</td></tr></table>
254
+
255
+ • MNIST-ONE: $G _ { b }$ : (256)4c-(128)4c2s-(64)4c2s-(3)4c2s; $G _ { f } ^ { c }$ : (512)4c-(256)4c2s$( 1 2 8 ) 4 \mathrm { c } 2 \mathrm { s }$ ; ${ \cal G } _ { f } ^ { i }$ : $( 3 ) 4 \mathrm { c } 2 \mathrm { s }$ ; $G _ { f } ^ { m }$ : (1)4c2s; D: (64)4c2s-(128)4c2s-(256)4c2s-(256)4p4s-1
256
+ MNIST-TWO: $G _ { b }$ : (256)4c-(128)4c2s-(64)4c2s-(32)4c2s-(3)4c2s; $G _ { f } ^ { c }$ : (512)4c(256)4c2s-(128)4c2s-(64)4c2s; ${ \cal G } _ { f } ^ { i }$ : (3)4c2s; $G _ { f } ^ { m }$ : (1)4c2s;D: (64)4c2s-(128)4c2s(256)4c2s-(512)4c2s-(512)4p4s-1 CUB-200: $G _ { b }$ : (512)4c-(256)4c2s-(128)4c2s-(64)4c2s-(3)4c2s; $G _ { f } ^ { c }$ : (1024)4c-(512)4c2s(256)4c2s-(128)4c2s; ${ G } _ { f } ^ { i }$ : (3)4c2s; $G _ { f } ^ { m }$ : (1)4c2s;D: (128)4c2s-(256)4c2s-(512)4c2s(1024)4c2s-(1024)4p4s-1
257
+ CIFAR-10: $G _ { b }$ : $( 2 5 6 ) 4 \mathrm { c } - ( 1 2 8 ) 4 \mathrm { c } 2 \mathrm { s } - ( 6 4 ) 4 \mathrm { c } 2 \mathrm { s } - ( 3 ) 4 \mathrm { c } 2 \mathrm { s } ;$ $G _ { f } ^ { c }$ : (512)4c-(256)4c2s-(128)4c2s; ${ G } _ { f } ^ { i }$ : (3)4c2s; $G _ { f } ^ { m }$ : (1)4c2s $D$ : (64)4c2s-(128)4c2s-(256)4c2s-(256)4p4s-1
258
+
259
+ # 6.3 RESULTS ON MNIST-ONE
260
+
261
+ We conduct human studies on generation results on MNIST-ONE. Specifically, we generate 1,000 images using both LR-GAN and DCGAN. As references, we also include 1000 real images. Then we ask the users on AMT to label each image to be one of the digits (0-9). We also provide them an option ‘non recognizable’ in case the generated image does not seem to contain a digit. Each image was judged by 5 unique workers. Similar to CIFAR-10, if an image is recognized to be the same digit by all 5 users, it is assigned to quality level 5. If it is not recognizable according to all users, it is assigned to quality level 0. Fig. 13 (left) shows the number of images assigned to all six quality levels. Compared to DCGAN, our model generated more samples with high quality levels. As expected, the real images have many samples with high quality levels. In Fig. 13 (right), we show the number of images that are recognized to each digit category (0-9). For qualitative comparison, we show examplar images at each quality level in Fig. 14. From left to right, the quality level increases from 0 to 5. As expected, the images with higher quality level are more clear.
262
+
263
+ For quantitative evaluation, we use the same way as for CIFAR-10. The classifier model used for contextual Inception Score is trained based on the training set. We generate 60,000 samples based on DCGAN and LR-GAN for evaluation, respectively. To obtain the Adversarial Accuracy and Adversarial Divergence, we first train 10 generators for 10 digit categories separately, and then use the generated samples to train the classifier. As shown in Table 3, our model has higher scores than DCGAN on both standard and contextual Inception Score. Also, our model has a slightly higher adversarial accuracy, and lower adversarial divergence than DCGAN. We find that the all three image sets have low standard Inception Scores. This is mainly because the Inception net is trained on ImageNet, which has a very different data distribution from the MNIST dataset. Based on this, we argue that the standard Inception Score is not suitable for some image datasets.
264
+
265
+ ![](images/f65151910a30b067f353d6b747248729efa4db3cc5af82ea1910883017bfacfd.jpg)
266
+ Figure 13: Statistics of annotations in human studies on MNIST-ONE. Left: distribution of quality level; Right: distribution of recognized digit categories.
267
+
268
+ ![](images/8466a362068c2ab386d9e2c3063a92dd648912e83f6540f33e88725175034978.jpg)
269
+ Figure 14: Qualitative comparison on MNIST-ONE. Top three rows are samples generated by DCGAN. Bottom three rows are samples generated by LR-GAN. The quality level increases from left to right as determined via human studies.
270
+
271
+ Table 3: Quantitative comparison on MNIST-ONE.
272
+
273
+ <table><tr><td>Training Data</td><td>Real Images</td><td>DCGAN</td><td>Ours</td></tr><tr><td>Inception Score†</td><td>1.83±0.01</td><td>2.03±0.01</td><td>2.06±0.01</td></tr><tr><td>Inception Scorett</td><td>9.15±0.04</td><td>6.42±0.03</td><td>7.15±0.04</td></tr><tr><td>Adversarial Accuracy</td><td>95.22 ± 0.25</td><td>26.12 ± 0.07</td><td>26.61 ± 0.06</td></tr><tr><td>Adversarial Divergence Score</td><td>0</td><td>8.47 ± 0.03</td><td>8.39 ± 0.04</td></tr></table>
274
+
275
+ †Evaluate using the pre-trained Inception net as Salimans et al. (2016) ††Evaluate using the supervisedly trained classifier based on the discriminator in LR-GAN.
276
+
277
+ # 6.4 MORE RESULTS ON CUB-200
278
+
279
+ In this experiment, we reduce the minimal allowed object scale to 1.1, which allows the model to generate larger foreground objects. The results are shown in Fig. 15. Similar to the results when the constraint is 1.2, the crisp bird-like masks are generated automatically by our model.
280
+
281
+ ![](images/999f8f427a47ea9e2ea5b589cba077741a87930277f8220175c5debf8936c899.jpg)
282
+ Figure 15: Generation results of our model on CUB-200 when setting minimal allowed scale to 1.1. From left to right, the blocks show the generated background images, foreground images, foreground masks, foreground images carved out by masks, carved foreground images after spatial transformation. The sixth and seventh blocks are final composite images and the nearest neighbor real images.
283
+
284
+ # 6.5 MORE RESULTS ON CIFAR-10
285
+
286
+ # 6.5.1 QUALITATIVE RESULTS
287
+
288
+ In Fig. 16, we show more results on CIFAR-10 when setting minimal allowed object scale to 1.1. The rightmost column block also shows the training images that are closest to the generated images (cosine similarity in pixel space). We can see our model does not memorize the training data.
289
+
290
+ ![](images/d54ce9b1433367df429539cb16b39a92a77af9defcf75c1126f7c71f5c00180d.jpg)
291
+ Figure 16: Generation results of our model on CIFAR-10 with minimal allowed scale be 1.1, From left to right, the layout is same to Fig. 15.
292
+
293
+ # 6.5.2 WALKING IN THE LATENT SPACE
294
+
295
+ Similar to DCGAN, we also show results by walking in the latent space. Note that our model has two or more inputs. So we can walk along any of them or their combination. In Fig. 17, we generate multiple foregrounds for the same fixed generated background. We find that our model consistently generates contextually compatible foregrounds. For example, for the grass-like backgrounds, the foreground generator generates horses and deer, and airplane-like objects for the blue sky.
296
+
297
+ # 6.5.3 WORD CLOUD BASED ON HUMAN STUDY
298
+
299
+ As we mentioned above, we conducted human studies on CIFAR-10. Besides asking people to select a name from a list for an image, we also conducted another human study where we ask people to use one word (free-form) to describe the main object in the image. Each image was ‘named’ by 5 unique people. We generate word clouds for real images, images generated by DCGAN and LR-GAN, as shown in Fig. 18.
300
+
301
+ # 6.6 RESULTS ON LFW FACE DATASET
302
+
303
+ We conduct experiment on face images in LFW dataset (Huang et al., 2007). Different from previous works which work on cropped and aligned faces, we directly generate the original images which contains a large portion of backgrounds. This configuration helps to verify the efficiency of LR-GAN to model the object appearance, shape and pose. In Fig. 19, we show the (intermediate) generation results of LR-GAN. Surprisingly, without any supervisions, the model generated background and faces in separate steps, and the generated masks accurately depict face shapes. Moreover, the model learns where to place the generated faces so that the whole image looks natural. For comparison, please refer to (Kwak & Zhang, 2016) which does not model the transformation. We can find the generation results degrade much.
304
+
305
+ ![](images/3a93e369441daba5927f9a8da078f8b1c4f6f78c2e063daca18b2b51a249b891.jpg)
306
+ Figure 17: Walking in the latent foreground space by fixing backgrounds in our model on CIFAR10. From left to right, the blocks are: generated background images, foreground images, foreground masks, foreground images carved out by masks, carved out foreground images after spatial transformation, and final composite images. Each row has the same background, but different foregrounds.
307
+
308
+ ![](images/bec2166c5d0f1cd6eb736809996471e14f963e4067bd61661d678da884b734a4.jpg)
309
+ Figure 18: Statistics of annotations in human studies on CIFAR-10. Left to right: word cloud for real images, images generated by DCGAN, images generated by LR-GAN.
310
+
311
+ ![](images/d8e4d5aa1f9649246f471c2fc8dbbcbc545914d6835c9041a6bef7610a54e1b4.jpg)
312
+ Figure 19: Generation results of our model on LFW. From left to right, the blocks are: generated background images, foreground images, foreground masks, carved out foreground images after spatial transformation, and final composite images.
313
+
314
+ # 6.7 STATISTICS ON TRANSFORMATION MATRICES
315
+
316
+ In this part, we analyze the statistics on the transformation matrices generated by our model for different datasets, including MNIST-ONE, CUB-200, CIFAR-10 and LFW. We used affine transformation in our model. So there are 6 parameters, scaling in the $\mathbf { X }$ coordinate $( s _ { x } )$ , scaling in the y coordinate $( s _ { y } )$ , translation in the x coordinate $( t _ { x } )$ , translation in the y coordinate $( t _ { y } )$ , rotation in the x coordinate $( r _ { x } )$ and rotation in the y coordinate $( r _ { y } )$ . In Fig. 20, we show the histograms on different parameters for different datasets.These histograms show that the model produces non-trivial varied scaling, translation and rotation on all datasets. For different datasets, the learned transformation have different patterns. We hypothesize that this is mainly determined by the configurations of objects in the images. For example, on MNIST-ONE, all six parameters have some fluctuations since the synthetic dataset contains digits randomly placed at different locations. For the other three datasets, the scalings converge to single value since the object sizes do not vary much, and the variations on rotation and translation suffice to generate realistic images. Specifically, we can find the generator largely relies on the translation on x coordinate for generating CUB-200. This makes sense since birds in the images have similar scales, orientations but various horizontal locations. For CIFAR-10, since there are 10 different object categories, the configurations are more diverse, hence the generator uses all parameters for generation except for the scaling. For LFW, since faces have similar configurations, the learned transformations have less fluctuation as well. As a result, we can see that LR-GAN indeed models the transformations on the foreground to generate images.
317
+
318
+ # 6.8 CONDITIONAL IMAGE GENERATION
319
+
320
+ Considering our model can generate object-like masks (shapes) for images, we conducted an experiment to evaluate whether our model can be potentially used for image segmentation and object detection. We make some changes to the model. For the background generator, the input is a real image instead of a random vector. Then the image is passed through an encoder to extract the hidden features, which replaces the random vector $z _ { \mathrm { 0 } }$ and are fed to the background generator. For the foreground generator, we subtract the image generated by the background generator from the input image to obtain a residual image. Then this residual image is fed to the same encoder to get the hidden features, which are used as the input for foreground generator. In our conditional model, we want to reconstruct the image, so we add a reconstruction loss along with the adversarial loss. We train this conditional model on CIFAR-10. The (intermediate) outputs of the model is shown in Fig. 21. Interestingly, the model successfully learned to decompose the input images into background and foreground. The background generator tends to do an image inpainting by generating a complete background without object, while the foreground generator works as a segmentation model to get object mask from the input image.
321
+
322
+ Similarly, we also run the conditional LR-GAN on LFW dataset. As we can see in Fig. 22, the foreground generator automatically and consistently learned to generate the face regions, even though there are large portion of background in the input images. In other words, the conditional LR-GAN successfully learned to detection faces in images. We suspect this success is due to that it has low cost for the generator to generate similar images, and thus converge to the case that the first generator generate background, and the second generator generate face images.
323
+
324
+ Based on these experiments, we argue that our model can be possibly used for image segmentation and object detection in a generative and unsupervised manner. One future work would be verifying this by applying it to high-resolution and more complicate datasets.
325
+
326
+ ![](images/0b8f1bdffe8f04e40df2b53cf17d91ee74a89dfcfd628e1bf10ee257600d04b7.jpg)
327
+ Figure 20: Histograms of transformation parameters learnt in our model for different datasets. From left to right, the datasets are: MNIST-ONE, CUB-200, CIFAR-10 and LFW. From top to bottom, they are scaling $s _ { x }$ , $s _ { y }$ , translation $t _ { x } , t _ { y }$ , and rotation $r _ { x }$ , $r _ { y }$ in $x$ and $y$ coordinate, respectively.
328
+
329
+ ![](images/fef056a8733f18849e71dc175c08276f74f2f2be4cf05c8343170ae723b0c071.jpg)
330
+ Figure 21: Conditional generation results of our model on CIFAR-10. From left to right, the blocks are: real images, generated background images, foreground images, foreground masks, foreground images carved out by masks, carved foreground images after spatial transformation, and final composite (reconstructed) images.
331
+
332
+ ![](images/bc504a5eb37f6be231b58df1f390632f076bde0b1068e92b1f6ac47d62532dce.jpg)
333
+ Figure 22: Conditional generation results of our model on LFW, displayed with the same layout to Fig. 21.
md/train/HJ94fqApW/HJ94fqApW.md ADDED
@@ -0,0 +1,288 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # RETHINKING THE SMALLER-NORM-LESSINFORMATIVE ASSUMPTION IN CHANNEL PRUNING OF CONVOLUTION LAYERS
2
+
3
+ Jianbo $\mathbf { Y e ^ { * } }$
4
+ College of Information Sciences and Technology
5
+ The Pennsylvania State University
6
+ jxy198@ist.psu.edu
7
+ Xin Lu, Zhe Lin
8
+ Adobe Research
9
+ {xinl,zlin}@adobe.com
10
+ James Z. Wang
11
+ College of Information Sciences and Technology
12
+ The Pennsylvania State University
13
+ jwang@ist.psu.edu
14
+
15
+ # ABSTRACT
16
+
17
+ Model pruning has become a useful technique that improves the computational efficiency of deep learning, making it possible to deploy solutions in resourcelimited scenarios. A widely-used practice in relevant work assumes that a smallernorm parameter or feature plays a less informative role at the inference time. In this paper, we propose a channel pruning technique for accelerating the computations of deep convolutional neural networks (CNNs) that does not critically rely on this assumption. Instead, it focuses on direct simplification of the channel-tochannel computation graph of a CNN without the need of performing a computationally difficult and not-always-useful task of making high-dimensional tensors of CNN structured sparse. Our approach takes two stages: first to adopt an end-toend stochastic training method that eventually forces the outputs of some channels to be constant, and then to prune those constant channels from the original neural network by adjusting the biases of their impacting layers such that the resulting compact model can be quickly fine-tuned. Our approach is mathematically appealing from an optimization perspective and easy to reproduce. We experimented our approach through several image learning benchmarks and demonstrate its interesting aspects and competitive performance.
18
+
19
+ # 1 INTRODUCTION
20
+
21
+ Not all computations in a deep neural network are of equal importance. In a typical deep learning pipeline, an expert crafts a neural architecture, which is trained using a prepared dataset. The success of training a deep model often requires trial and error, and such loop usually has little control on prioritizing the computations happening in the neural network. Recently researchers started to develop model-simplification methods for convolutional neural networks (CNNs), bearing in mind that some computations are indeed non-critical or redundant and hence can be safely removed from a trained model without substantially degrading the model’s performance. Such methods not only accelerate computational efficiency but also possibly alleviate the model’s overfitting effects.
22
+
23
+ Discovering which subsets of the computations of a trained CNN are more reasonable to prune, however, is nontrivial. Existing methods can be categorized from either the learning perspective or from the computational perspective. From the learning perspective, some methods use a dataindependent approach where the training data does not assist in determining which part of a trained CNN should be pruned, e.g. He et al. (2017) and Zhang et al. (2016), while others use a datadependent approach through typically a joint optimization in generating pruning decisions, e.g., Han et al. (2015) and Anwar et al. (2017). From the computational perspective, while most approaches focus on setting the dense weights of convolutions or linear maps to be structured sparse, we propose here a method adopting a new conception to achieve in effect the same goal.
24
+
25
+ Instead of regarding the computations of a CNN as a collection of separate computations sitting at different layers, we view it as a network flow that delivers information from the input to the output through different channels across different layers. We believe saving computations of a CNN is not only about reducing what are calculated in an individual layer, but perhaps more importantly also about understanding how each channel is contributing to the entire information flow in the underlying passing graph as well as removing channels that are less responsible to such process. Inspired by this new conception, we propose to design a “gate” at each channel of a CNN, controlling whether its received information is actually sent out to other channels after processing. If a channel “gate” closes, its output will always be a constant. In fact, each designed “gate” will have a prior intention to close, unless it has a “strong” duty in sending some of its received information from the input to subsequent layers. We find that implementing this idea in pruning CNNs is unsophisticated, as will be detailed in Sec 4.
26
+
27
+ Our method neither introduces any extra parameters to the existing CNN, nor changes its computation graph. In fact, it only introduces marginal overheads to existing gradient training of CNNs. It also possess an attractive feature that one can successively build multiple compact models with different inference performances in a single round of resource-intensive training (as in our experiments). This eases the process to choose a balanced model to deploy in production. Probably, the only applicability constraint of our method is that all convolutional layers and fully-connected layer (except the last layer) in the CNN should be batch normalized (Ioffe & Szegedy, 2015). Given batch normalization has becomes a widely adopted ingredient in designing state-of-the-art deep learning models, and many successful CNN models are using it, we believe our approach has a wide scope of potential impacts.1
28
+
29
+ In this paper, we start from rethinking a basic assumption widely explored in existing channel pruning work. We point out several issues and gaps in realizing this assumption successfully. Then, we propose our alternative approach, which works around several numerical difficulties. Finally, we experiment our method across different benchmarks and validate its usefulness and strengths.
30
+
31
+ # 2 RELATED WORK
32
+
33
+ Reducing the size of neural network for speeding up its computational performance at inference time has been a long-studied topic in the communities of neural network and deep learning. Pioneer works include Optimal Brain Damage (LeCun et al., 1990) and Optimal Brain Surgeon (Hassibi & Stork, 1993). More recent developments focused on either reducing the structural complexity of a provided network or training a compact or simplified network from scratch. Our work can be categorized into the former, thus the literature review below revolves around reducing the structural complexity.
34
+
35
+ To reduce the structural complexity of deep learning models, previous work have largely focused on sparsifying the weights of convolutional kernels or the feature maps across multiple layers in a network (Anwar et al., 2017; Han et al., 2015). Some recent efforts proposed to impose structured sparsity on those vector components motivated from the implementation perspective on specialized hardware (Wen et al., 2016; Zhou et al., 2016; Alvarez & Salzmann, 2016; Lebedev & Lempitsky, 2016). Yet as argued by Molchanov et al. (2017), regularization-based pruning techniques require per layer sensitivity analysis which adds extra computations. Their method relies on global rescaling of criteria for all layers and does not require sensitivity estimation, a beneficial feature that our approach also has. To our knowledge, it is also unclear how widely useful those works are in deep learning. In Section 3, we discuss in details the potential issues in regularization-based pruning techniques potentially hurting them being widely applicable, especially for those that regularize high-dimensional tensor parameters or use magnitude-based pruning methods. Our approach works around the mentioned issues by constraining the anticipated pruning operations only to batchnormalized convolutional layers. Instead of posing structured sparsity on kernels or feature maps, we enforce sparsity on the scaling parameter $\gamma$ in batch normalization operator. This blocks the sample-wise information passing through part of the channels in convolution layer, and in effect implies one can safely remove those channels.
36
+
37
+ A recent work by Huang & Wang (2017) used a similar technique as ours to remove unimportant residual modules in ResNet by introducing extra scaling factors to the original network. However, some optimization subtleties as to be pointed out in our paper were not well explained. Another recent work called Network-Slimming (Liu et al., 2017) also aims to sparsify the scaling parameters of batch normalization. But instead of using off-the-shelf gradient learning like theirs, we propose a new algorithmic approach based on ISTA and rescaling trick, improving robustness and speed of the undergoing optimization. In particular, the work of Liu et al. (2017) was able to prune VGG-A model on ImageNet. It is unclear how their work would deal with the $\gamma { - } W$ rescaling effect and whether their approach can be adopted to large pre-trained models, such as ResNets and Inceptions. We experimented with the pre-trained ResNet-101 and compared to most recent work that were shown to work well with large CNNs. We also experimented with an image segmentation model which has an inception-like module (pre-trained on ImageNet) to locate foreground objects.
38
+
39
+ # 3 RETHINKING THE SMALLER-NORM-LESS-INFORMATIVE ASSUMPTION
40
+
41
+ In most regularized linear regressions, a large-norm coefficient is often a strong indicator of a highly informative feature. This has been widely perceived in statistics and machine learning communities. Removing features which have a small coefficient does not substantially affect the regression errors. Therefore, it has been an established practice to use tractable norm to regularize the parameters in optimizing a model and pick the important ones by comparing their norms after training. However, this assumption is not unconditional. By using Lasso or ridge regression to select important predictors in linear models, one always has to first normalize each predictor variable. Otherwise, the result might not be explanatory. For example, ridge regression penalizes more the predictors which has low variance, and Lasso regression enforces sparsity of coefficients which are already small in OLS. Such normalization condition for the right use of regularization is often unsatisfied for nonconvex learning. For example, one has to carefully consider two issues outlined below. We provides these two cases to exemplify how regularization could fail or be of limited usage. There definitely exist ways to avoid the described failures.
42
+
43
+ Model Reparameterization. In the first case, we show that it is not easy to have fine-grained control of the weights’ norms across different layers. One has to either choose a uniform penalty in all layers or struggle with the reparameterization patterns. Consider to find a deep linear (convolutional) network subject to a least square with Lasso: for $\lambda > 0$ ,
44
+
45
+ $$
46
+ \operatorname* { m i n } _ { \{ W _ { i } \} _ { i = 1 } ^ { 2 n } } \mathbb { E } _ { ( x , y ) \sim \mathcal { D } } \| W _ { 2 n } \ast \ldots \ast W _ { 2 } \ast W _ { 1 } \ast x - y \| ^ { 2 } + \lambda \sum _ { i = 1 } ^ { n } \| W _ { 2 i } \| _ { 1 } .
47
+ $$
48
+
49
+ The above formulation is not a well-defined problem because for any parameter set 0 2n $\{ W _ { i } \} _ { i = 1 } ^ { 2 n }$ , one i=1can always find another parameter set {W i } i=1 such that it achieves a smaller total loss while keeping the corresponding $l _ { 0 }$ norm unchanged by actually setting
50
+
51
+ $$
52
+ W _ { i } ^ { \prime } = \alpha W _ { i } , i = 1 , 3 , \ldots , 2 n - 1 \mathrm { ~ a n d ~ } W _ { i } ^ { \prime } = W _ { i } / \alpha , i = 2 , 4 , \ldots , 2 n .
53
+ $$
54
+
55
+ where $\alpha > 1$ . In another word, for any $\epsilon > 0$ , one can always find a parameter set $\{ W _ { i } \} _ { i = 1 } ^ { 2 n }$ (which is usually non-sparse) that minimizes the first least square loss while having its second Lasso term less than $\epsilon$ .
56
+
57
+ We note that gradient-based learning is highly inefficient in exploring such model reparameterization patterns. In fact, there are some recent discussions around this (Dinh et al., 2017). If one adopts a pre-trained model, and augments its original objective with a new norm-based parameter regularization, the new gradient updates may just increase rapidly or it may take a very long time for the variables traveling along the model’s reparameterization trajectory. This highlights a theoretical gap questioning existing sparsity-inducing formulation and actual computational algorithms whether they can achieve widely satisfactory parameter sparsification for deep learning models.
58
+
59
+ Transform Invariance. In the second case, we show that batch normalization is not compatible with weight regularization. The example is penalizing $l _ { 1 }$ - or $l _ { 2 }$ -norms of filters in convolution layer which is then followed by a batch normalization: at the $l$ -th layer, we let
60
+
61
+ $$
62
+ x ^ { l + 1 } = \operatorname* { m a x } \{ \gamma \cdot \mathbf { B N } _ { \mu , \sigma , \epsilon } ( W ^ { l } * x ^ { l } ) + \beta , 0 \} ,
63
+ $$
64
+
65
+ where $\gamma$ and $\beta$ are vectors whose length is the number of channels. Likewise, one can clearly see that any uniform scaling of $W ^ { l }$ which changes its $l _ { 1 }$ - and $l _ { 2 }$ -norms would have no effects on the output $x ^ { l + 1 }$ . Alternatively speaking, if one is interested in minimizing the weight norms of multiple layers together, it becomes unclear how to choose proper penalty for each layer. Theoretically, there always exists an optimizer that can change the weight to one with infinitesimal magnitude without hurting any inference performance. As pointed by one of the reviewers, one can tentatively avoid this issue by projecting the weights to the surface of unit ball. Then one has to deal with a non-convex feasible set of parameters, causing extra difficulties in developing optimization for data-dependent pruning methods. It is also worth noting that some existing work used such strategy in a layer-by-layer greedy way (He et al., 2017; Zhang et al., 2016).
66
+
67
+ Based on this discussion, many existing works which claim to use Lasso, group Lasso (e.g. Wen et al. (2016); Anwar et al. (2017)), or thresholding (e.g. Molchanov et al. (2017)) to enforce parameter sparsity have some theoretical gaps to bridge. In fact, many heuristic algorithms in neural net pruning actually do not naturally generate a sparse parameterized solution. More often, thresholding is used to directly set certain subset of the parameters in the network to zeros, which can be problematic. The reason is in essence around two questions. First, by setting parameters less than a threshold to zeros, will the functionality of neural net be preserved approximately with certain guarantees? If yes, then under what conditions? Second, how should one set those thresholds for weights across different layers? Not every layer contributes equally in a neural net. It is expected that some layers act critically for the performance but only use a small computation and memory budget, while some other layers help marginally for the performance but consume a lot resources. It is naturally more desirable to prune calculations in the latter kind of layers than the former.
68
+
69
+ In contrast with these existing approaches, we focus on enforcing sparsity of a tiny set of parameters in CNN — scale parameter $\gamma \mathbf { s }$ in all batch normalization. Not only placing sparse constraints on $\gamma$ is simpler and easier to monitor, but more importantly, we have two strong reasons:
70
+
71
+ 1. Every $\gamma$ always multiplies a normalized random variable, thus the channel importance becomes comparable across different layers by measuring the magnitude values of $\gamma$ ;
72
+ 2. The reparameterization effect across different layers is avoided if its subsequent convolution layer is also batch-normalized. In other words, the impacts from the scale changes of $\gamma$ parameter are independent across different layers.
73
+
74
+ Nevertheless, our current work still falls short of a strong theoretical guarantee. We believe by working with normalized feature inputs and their regularized coefficients together, one is closer to a more robust and meaningful approach. Sparsity is not the goal, but to find less important channels using sparsity inducing formulation is.
75
+
76
+ # 4 CHANNEL PRUNING OF BATCH-NORMALIZED CNN
77
+
78
+ We describe the basic principle and algorithm of our channel pruning technique.
79
+
80
+ # 4.1 PRELIMINARIES
81
+
82
+ Pruning constant channels. Consider convolution with batch normalization:
83
+
84
+ $$
85
+ x ^ { l + 1 } = \operatorname* { m a x } \left\{ \gamma ^ { l } \cdot { \mathrm { B N } } _ { \mu ^ { l } , \sigma ^ { l } , \epsilon ^ { l } } ( W ^ { l } * x ^ { l } ) + \beta ^ { l } , 0 \right\} .
86
+ $$
87
+
88
+ For the ease of notation, we let $\gamma = \gamma ^ { l }$ . Note that if some element in $\gamma$ is set to zero, say, $\gamma [ k ] = 0$ , its output image xl+1:,:,:,k becomes a constant $\beta _ { k }$ , and a convolution of a constant image channel is almost everywhere constant (except for padding regions, an issue to be discussed later). Therefore, we show those constant image channels can be pruned while the same functionality of network is approximately kept:
89
+
90
+ • If the subsequent convolution layer does not have batch normalization,
91
+
92
+ $$
93
+ x ^ { l + 2 } = \operatorname* { m a x } \left\{ W ^ { l + 1 } * x ^ { l + 1 } + b ^ { l + 1 } , 0 \right\} ,
94
+ $$
95
+
96
+ its values (a.k.a. elements in $\beta$ ) is absorbed into the bias term by the following equation
97
+
98
+ $$
99
+ b _ { n e w } ^ { l + 1 } : = b ^ { l + 1 } + I ( \gamma = 0 ) \cdot \mathrm { R e L U } ( \beta ) ^ { T } \mathrm { s u m . r e d u c e d } ( W _ { : , : , \cdot } ^ { l + 1 } , ) ,
100
+ $$
101
+
102
+ such that
103
+
104
+ $$
105
+ x ^ { l + 2 } \approx \mathrm { m a x } \left\{ W ^ { l + 1 } * _ { \gamma } x ^ { l + 1 } + b _ { n e w } ^ { l + 1 } , 0 \right\} ,
106
+ $$
107
+
108
+ where $\ast _ { \gamma }$ denotes the convolution operator which is only calculated along channels indexed by non-zeros of $\gamma$ . Remark that $W ^ { * } =$ sum reduced $( W _ { : , : , \cdot , \cdot } )$ if $\begin{array} { r } { W _ { a , b } ^ { * } = \sum _ { i , j } W _ { i , j , a , b } } \end{array}$ .
109
+
110
+ • If the subsequent convolution layer has batch normalization,
111
+
112
+ $$
113
+ x ^ { l + 2 } = \operatorname * { m a x } \left\{ \gamma ^ { l + 1 } \cdot { \bf B } { \bf N } _ { \mu ^ { l + 1 } , \sigma ^ { l + 1 } , \epsilon ^ { l + 1 } } \left( W ^ { l + 1 } * x ^ { l + 1 } \right) + \beta ^ { l + 1 } , 0 \right\} ,
114
+ $$
115
+
116
+ instead its moving average is updated as
117
+
118
+ $$
119
+ \begin{array} { r } { \mu _ { n e w } ^ { l + 1 } : = \mu ^ { l + 1 } - I ( \gamma = 0 ) \cdot \mathrm { R e L U } ( \beta ) ^ { T } \mathrm { s u m . r e d u c e d } ( W _ { : , : , \cdot , \cdot } ^ { l + 1 } ) , } \end{array}
120
+ $$
121
+
122
+ such that
123
+
124
+ $$
125
+ x ^ { l + 2 } \approx \operatorname * { m a x } \left\{ \gamma ^ { l + 1 } \cdot { \bf B N } _ { \mu _ { n e w } ^ { l + 1 } , \sigma ^ { l + 1 } , \epsilon ^ { l + 1 } } \left( W ^ { l + 1 } * _ { \gamma } x ^ { l + 1 } \right) + \beta ^ { l + 1 } , 0 \right\} .
126
+ $$
127
+
128
+ Remark that the approximation $( \approx )$ is strictly equivalence $( = )$ if no padding is used in the convolution operator $^ *$ , a feature that the parallel work Liu et al. (2017) does not possess. When the original model uses padding in computing convolution layers, the network function is not strictly preserved after pruning. In our practice, we fine-tune the pruned network to fix such performance degradation at last. In short, we formulate the network pruning problem as simple as to set more elements in $\gamma$ to zero. It is also much easier to deploy the pruned model, because no extra parameters or layers are introduced into the original model.
129
+
130
+ To better understand how it works in an entire CNN, imagine a channel-to-channel computation graph formed by the connections between layers. In this graph, each channel is a node, their inference dependencies are represented by directed edges. The $\gamma$ parameter serves as a “dam” at each node, deciding whether let the received information “flood” through to other nodes following the graph. An end-to-end training of channel pruning is essentially like a flood control system. There suppose to be rich information of the input distribution, and in two ways, much of the original input information is lost along the way of CNN inference, and the useful part — that is supposed to be preserved by the network inference — should be label sensitive. Conventional CNN has one way to reduce information: transforming feature maps (non-invertible) via forward propagation. Our approach introduces the other way: block information at each channel by forcing its output being constant using ISTA.
131
+
132
+ ISTA. Despite the gap between Lasso and sparsity in the non-convex settings, we found that ISTA (Beck & Teboulle, 2009) is still a useful sparse promoting method. But we just need to use it more carefully. Specifically, we adopt ISTA in the updates of $\gamma \mathbf { s }$ . The basic idea is to project the parameter at every step of gradient descent to a potentially more sparse one subject to a proxy problem: let $l$ denote the training loss of interest, at the $( t + 1 )$ -th step, we set
133
+
134
+ $$
135
+ \gamma _ { t + 1 } = \operatorname* { m i n } _ { \gamma } \frac { 1 } { \mu _ { t } } \| \gamma - \gamma _ { t } + \mu _ { t } \nabla _ { \gamma } l _ { t } \| ^ { 2 } + \lambda \| \gamma \| _ { 1 } \mathrm { ~ , ~ }
136
+ $$
137
+
138
+ where $\nabla _ { \gamma } l _ { t }$ is the derivative with respect to $\gamma$ computed at step $t$ , $\mu _ { t }$ is the learning rate, $\lambda$ is the penalty. In the stochastic learning, $\nabla _ { \gamma } l _ { t }$ is estimated from a mini-batch at each step. Eq. (1) has closed form solution as
139
+
140
+ $$
141
+ \gamma _ { t + 1 } = \mathrm { p r o x } _ { \mu _ { t } \lambda } \bigl ( \gamma _ { t } - \mu _ { t } \nabla _ { \gamma } l _ { t } \bigr ) ,
142
+ $$
143
+
144
+ where $\mathrm { p r o x } _ { \eta } ( x ) = \operatorname* { m a x } \{ | x | - \eta , 0 \} \cdot \mathrm { s g n } ( x )$ . The ISTA method essentially serves as a “flood control system” in our end-to-end learning, where the functionality of each $\gamma$ is like that of a dam. When $\gamma$ is zero, the information flood is totally blocked, while $\gamma \neq 0$ , the same amount of information is passed through in form of geometric quantities whose magnitudes are proportional to $\gamma$ .
145
+
146
+ Scaling effect. One can also see that if $\gamma$ is scaled by $\alpha$ meanwhile $W ^ { l + 1 }$ is scaled by $1 / \alpha$ , that is,
147
+
148
+ $$
149
+ \gamma : = \alpha \gamma , \qquad W ^ { l + 1 } : = \frac { 1 } { \alpha } W ^ { l + 1 }
150
+ $$
151
+
152
+ the output $x ^ { l + 2 }$ is unchanged for the same input $x ^ { l }$ . Despite not changing the output, scaling of $\gamma$ and $W ^ { l + 1 }$ also scales the gradients $\nabla _ { \gamma } l$ and $\nabla _ { W ^ { l + 1 } } l$ by $1 / \alpha$ and $\alpha$ , respectively. As we observed, the parameter dynamics of gradient learning with ISTA depends on the scaling factor $\alpha$ if one decides to choose it other than 1.0. Intuitively, if $\alpha$ is large, the optimization of $\bar { W } ^ { l + 1 }$ is progressed much slower than that of $\gamma$ .
153
+
154
+ # 4.2 THE ALGORITHM
155
+
156
+ We describe our algorithm below. The following method applies to both training from scratch or re-training from a pre-trained model. Given a training loss $l$ , a convolutional neural net $\mathcal { N }$ , and hyper-parameters $\rho , \alpha , \mu _ { 0 }$ , our method proceeds as follows:
157
+
158
+ 1. Computation of sparse penalty for each layer. Compute the memory cost per channel for each layer denoted by $\setminus { l }$ and set the ISTA penalty for layer $l$ to $\rho \lambda ^ { l }$ . Here
159
+
160
+ $$
161
+ \lambda ^ { l } = \frac { 1 } { I _ { w } ^ { i } \cdot I _ { h } ^ { i } } \left[ k _ { w } ^ { l } \cdot k _ { h } ^ { l } \cdot c ^ { l - 1 } + \sum _ { l ^ { \prime } \in \mathcal { T } ( l ) } k _ { w } ^ { l ^ { \prime } } \cdot k _ { h } ^ { l ^ { \prime } } \cdot c ^ { l ^ { \prime } } + I _ { w } ^ { l } \cdot I _ { h } ^ { l } \right] ,
162
+ $$
163
+
164
+ where
165
+
166
+ • $I _ { w } ^ { i } \cdot I _ { h } ^ { i }$ is the size of input image of the neural network.
167
+ • $k _ { w } ^ { l } \cdot k _ { h } ^ { l }$ is the kernel size of the convolution at layer $l$ . Likewise, $k _ { w } ^ { l ^ { \prime } } \cdot k _ { h } ^ { l ^ { \prime } }$ is the kernel size of subsequent convolution at layer $l ^ { \prime }$ .
168
+ • $\tau ( l )$ represents the set of the subsequent convolutional layers of layer $l$
169
+ • $c ^ { l - 1 }$ denotes the channel size of the previous layer, which the $l$ -th convolution operates over; and $c ^ { l ^ { \prime } }$ denotes the channel size of one subsequent layer $l ^ { \prime }$ .
170
+ • $I _ { w } ^ { l } \cdot I _ { h } ^ { l }$ is the image size of the feature map at layer $l$ .
171
+
172
+ 2. $\gamma { = } W$ rescaling trick. For layers whose channels are going to get reduced, scale all $\gamma ^ { l } \mathbf { s }$ i n batch normalizations by $\alpha$ meanwhile scale weights in their subsequent convolutions by $1 / \alpha$ .
173
+
174
+ 3. End-to-End training with ISTA on $\gamma$ . Train $\mathcal { N }$ by the regular SGD, with the exception that $\gamma ^ { l } \mathbf { s }$ are updated by ISTA, where the initial learning rate is $\mu _ { 0 }$ . Train $\mathcal { N }$ until the loss $l$ plateaus, the total sparsity of $\gamma ^ { l } \mathbf { s }$ converges, and Lasso $\textstyle { \dot { \rho } } \sum _ { l } \lambda ^ { l } \| \gamma ^ { l } \| _ { 1 }$ converges.
175
+ 4. Post-process to remove constant channels. Prune channels in layer $l$ whose elements in $\gamma ^ { l }$ are zero and output the pruned model $\widetilde { \mathcal { N } }$ by absorbing all constant channels into subsequent layers (as described in the earlier section.).
176
+ 5. $\gamma { = } W$ rescaling trick. For $\gamma ^ { l } \mathbf { s }$ and weights in $\widetilde { \mathcal { N } }$ which were scaled in Step 2 before training, scale them by $1 / \alpha$ and $\alpha$ respectively (scaling back).
177
+ 6. Fine-tune $\widetilde { \mathcal { N } }$ using regular stochastic gradient learning.
178
+
179
+ Remark that choosing a proper $\alpha$ as used in Steps 2 and 5 is necessary for using a large $\mu _ { t } \cdot \rho$ in ISTA, which makes the sparsification progress of $\gamma ^ { l } \mathbf { s }$ faster.
180
+
181
+ # 4.3 GUIDELINES FOR TUNING HYPER-PARAMETERS
182
+
183
+ We summarize the sensitivity of hyper-parameters and their impacts for optimization below:
184
+
185
+ • $\mu$ (learning rate): larger $\mu$ leads to fewer iterations for convergence and faster progress of sparsity. But if if $\mu$ too large, the SGD approach wouldn’t converge. • $\rho$ (sparse penalty): larger $\rho$ leads to more sparse model at convergence. If trained with a very large $\rho$ , all channels will be eventually pruned.
186
+
187
+ • $\alpha$ (rescaling): we use $\alpha$ other than 1. only for pretrained models, we typically choose $\alpha$ from $\{ 0 . 0 0 1 , 0 . 0 1 , 0 . 1 , 1 \}$ and smaller $\alpha$ warms up the progress of sparsity.
188
+
189
+ We recommend the following parameter tuning strategy. First, check the cross-entropy loss and the regularization loss, select $\rho$ such that these two quantities are comparable at the beginning. Second, choose a reasonable learning rate. Third, if the model is pretrained, check the average magnitude of $\gamma \mathbf { s }$ in the network, choose $\alpha$ such that the magnitude of rescaled $\gamma ^ { l }$ is around $1 0 0 \bar { \mu } \lambda ^ { l } \rho$ . We found as long as one choose those parameters in the right range of magnitudes, the optimization progress is enough robust. Again one can monitor the mentioned three quantities during the training and terminate the iterations when all three quantities plateaus.
190
+
191
+ There are several patterns we found during experiments that may suggest the parameter tuning has not been successful. If during the first few epochs the Lasso-based regularization loss keeps decreasing linearly while the sparsity of $\gamma \mathbf { s }$ stays near zero, one may decrease $\alpha$ and restart. If during the first few epochs the sparsity of $\gamma \mathbf { s }$ quickly raise up to $100 \%$ , one may decrease $\rho$ and restart. If during the first few epochs the cross-entropy loss keeps at or increases dramatically to a non-informative level, one may decrease $\mu$ or $\rho$ and restart.
192
+
193
+ # 5 EXPERIMENTS
194
+
195
+ # 5.1 CIFAR-10 EXPERIMENT
196
+
197
+ We experiment with the standard image classification benchmark CIFAR-10 with two different network architectures: ConvNet and ResNet-20 (He et al., 2016). We resize images to $3 2 \times 3 2$ and zero-pad them to $4 0 \times 4 0$ . We pre-process the padded images by randomly cropping with size $3 2 \times 3 2$ , randomly flipping, randomly adjusting brightness and contrast, and standardizing them such that their pixel values have zero mean and one variance.
198
+
199
+ ConvNet For reducing the channels in ConvNet, we are interested in studying whether one can easily convert a over-parameterized network into a compact one. We start with a standard 4-layer convolutional neural network whose network attributes are specified in Table 1. We use a fixed learning rate $\mu _ { t } = 0 . 0 1$ , scaling parameter $\alpha = 1 . 0$ , and set batch size to 125.
200
+
201
+ Model A is trained from scratch using the base model with an initial warm-up $\rho ~ = ~ 0 . 0 0 0 2$ for $3 0 \mathrm { k }$ steps, and then is trained by raising up $\rho$ to 0.001. After the termination criterion are met, we prune the channels of the base model to generate a smaller network called model A. We evaluate the classification performance of model A with the running exponential average of its parameters. It is found that the test accuracy of model A is even better than the base model. Next, we start from the pre-trained model A to create model B by raising $\rho$ up to 0.002. We end up with a smaller network called model B, which is about $1 \%$ worse than model A, but saves about one third parameters. Likewise, we start from the pre-trained model B to create model C. The detailed statistics and its pruned channel size are reported in Table 1. We also train a reference ConvNet from scratch whose channel sizes are 32-64-64-128 with totally 224,008 parameters and test accuracy being $8 6 . 3 \%$ . The referenced model is not as good as Model B, which has smaller number of parameters and higher accuracy.
202
+
203
+ We have two major observations from the experiment: (1) When the base network is overparameterized, our approach not only significantly reduces the number of channels of the base model but also improves its generalization performance on the test set. (2) Performance degradation seems unavoidable when the channels in a network are saturated, and our approach gives satisfactory tradeoff between test accuracy and model efficiency.
204
+
205
+ ResNet-20 We also want to verify our second observation with the state-of-art models. We choose the popular ResNet-20 as our base model for the CIFAR-10 benchmark, whose test accuracy is $92 \%$ . We focus on pruning the channels in the residual modules in ResNet-20, which has 9 convolutions in total. As detailed in Table 2, model A is trained from scratch using ResNet-20’s network structure as its base model. We use a warm-up $\rho = 0 . 0 0 1$ for 30k steps and then train with $\rho = 0 . 0 0 5$ . We are able to remove $37 \%$ parameters from ResNet-20 with only about 1 percent accuracy loss. Likewise, Model B is created from model A with a higher penalty $\rho = 0 . 0 1$ .
206
+
207
+ Table 1: Comparisons between different pruned networks and the base network.
208
+
209
+ <table><tr><td colspan="4">base</td><td>model A</td><td>model B</td><td></td><td>model C</td></tr><tr><td>layer</td><td>output</td><td>kernel</td><td>channel</td><td>channel</td><td>channel</td><td></td><td>channel</td></tr><tr><td>conv1</td><td>32 × 32</td><td>5×5</td><td>96</td><td>53</td><td>41</td><td></td><td>31</td></tr><tr><td>pool1</td><td>16 ×16</td><td>3×3</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>conv2</td><td>16 ×16</td><td>5×5</td><td>192</td><td>86</td><td></td><td>64</td><td>52</td></tr><tr><td>pool2</td><td>8×8</td><td>3×3</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>conv3</td><td>8×8</td><td>3×3</td><td>192</td><td>67</td><td></td><td>52</td><td>40</td></tr><tr><td>pool4</td><td>4×4</td><td>3×3</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>fc</td><td>1×1</td><td>4×4</td><td>384</td><td>128</td><td>128</td><td></td><td>127</td></tr><tr><td>p</td><td></td><td></td><td></td><td></td><td>0.001</td><td>0.002</td><td>0.008</td></tr><tr><td>param. size</td><td></td><td></td><td>1,986,760</td><td>309,655</td><td></td><td>207,583</td><td>144,935</td></tr><tr><td>test accuracy (%)</td><td></td><td></td><td>89.0</td><td>89.5</td><td></td><td>87.6</td><td>86.0</td></tr></table>
210
+
211
+ Table 2: Comparisons between ResNet-20 and its two pruned versions. The last columns are the number of channels of each residual modules after pruning.
212
+
213
+ <table><tr><td></td><td>group - block</td><td>1-1</td><td>1-2</td><td>1-3</td><td>2-1</td><td>2-2</td><td>2-3</td><td>3-1</td><td>3-2</td><td>3-3</td></tr><tr><td>ResNet-20</td><td>channels param size.= 281,304 test accuracy (%) = 92.0</td><td>16</td><td>16</td><td>16</td><td>32</td><td>32</td><td>32</td><td>64</td><td>64</td><td>64</td></tr><tr><td>model A</td><td>channels param size. = 176,596 test accuracy (%) = 90.9</td><td>12</td><td>6</td><td>11</td><td>32</td><td>28</td><td>28</td><td>47</td><td></td><td>3425</td></tr><tr><td>model B</td><td>channels param size.= 90,504 test accuracy (%) = 88.8</td><td>8</td><td>2</td><td>今</td><td></td><td>271816</td><td></td><td>25</td><td>9</td><td>8</td></tr></table>
214
+
215
+ # 5.2 ILSVRC2012 EXPERIMENT
216
+
217
+ We experiment our approach with the pre-trained ResNet-101 on ILSVRC2012 image classification dataset (He et al., 2016). ResNet-101 is one of the state-of-the-art network architecture in ImageNet Challenge. We follow the standard pipeline to pre-process images to $2 2 4 \times 2 2 4$ for training ResNets. We adopt the pre-trained TensorFlow ResNet-101 model whose single crop error rate is $2 3 . 6 \%$ with about $4 . 4 7 \times 1 0 ^ { 7 }$ parameters.2 We set the scaling parameter $\alpha = 0 . 0 1$ , the initial learning rate $\mu _ { t } = 0 . 0 0 1$ , the sparsity penalty $\rho = 0 . 1$ , and the batch $\mathrm { s i z e } = 1 2 8$ (across 4 GPUs). The learning rate is decayed every four epochs with rate 0.86. We create two pruned models from the different iterations of training ResNet-101: one has $2 . 3 6 \times 1 0 ^ { 7 }$ parameters and the other has $1 . 7 3 \times 1 0 ^ { 7 }$ parameters. We then fine-tune these two models using the standard way for training ResNet-101, and report their error rates. The Top-5 error rate increases of both models are less than $0 . 5 \%$ . The Top-1 error rates are summarized in Table 3. To our knowledge, only a few works have reported their performance on this very large-scale benchmark w.r.t. the Top-1 errors. We compare our approach with some recent works in terms of model parameter size, flops, and error rates. As shown in Table 3, our model v2 has achieved a compression ratio more than 2.5 while maintaining more than $1 \%$ lower error rates than that of other state-of-the-art models at comparable size of parameters.
218
+
219
+ In the first experiment (CIFAR-10), we train the network from scratch and allocate enough steps for both $\gamma$ and $W$ adjusting their own scales. Thus, initialization of an improper scale of $\gamma { - } W$ is not really an issue given we optimize with enough steps. But for the pre-trained models which were originally optimized without any constraints of $\gamma$ , the $\gamma \mathbf { s }$ scales are often unanticipated. It actually takes as many steps as that of training from scratch for $\gamma$ to warm up. By adopting the rescaling trick setting $\alpha$ to a smaller value, we are able to skip the warm-up stage and quick start to sparsify $\gamma \mathbf { s }$ . For example, it might take more than a hundred epoch to train ResNet-101, but it only takes about 5-10 epochs to complete the pruning and a few more epochs to fine-tune.
220
+
221
+ <table><tr><td>network</td><td>param size.</td><td>fops</td><td>error (%)</td><td>ratio</td></tr><tr><td>resnet-50 pruned (Huang &amp; Wang,2017)</td><td>~1.65×107</td><td>3.03×109</td><td>~26.8</td><td>66%</td></tr><tr><td>resnet-101 pruned (v2,ours)</td><td>1.73 ×107</td><td>3.69×109</td><td>25.44</td><td>39%</td></tr><tr><td>resnet-34 pruned (Li et al., 2017)</td><td>1.93 ×107</td><td>2.76 ×109</td><td>27.8</td><td>89%</td></tr><tr><td>resnet-34</td><td>2.16 ×107</td><td>3.64×109</td><td>26.8</td><td>1</td></tr><tr><td>resnet-101 pruned (v1, ours)</td><td>2.36×107</td><td>4.47 ×109</td><td>24.73</td><td>53%</td></tr><tr><td>resnet-50</td><td>2.5×107</td><td>4.08 ×109</td><td>24.8</td><td>1</td></tr><tr><td>resnet-101</td><td>4.47 × 107</td><td>7.8×109</td><td>23.6</td><td>1</td></tr></table>
222
+
223
+ Table 3: Attributes of different versions of ResNet and their single crop errors on ILSVRC2012 benchmark. The last column means the parameter size of pruned model vs. the base model.
224
+
225
+ # 5.3 IMAGE FOREGROUND-BACKGROUND SEGMENTATION EXPERIMENT
226
+
227
+ As we have discussed about the two major observations in Section 5.1, a more appealing scenario is to apply our approach in pruning channels of over-parameterized model. It often happens when one adopts a pre-trained network on a large task (such as ImageNet classification) and fine-tunes the model to a different and smaller task (Molchanov et al., 2017). In this case, one might expect that some channels that have been useful in the first pre-training task are not quite contributing to the outputs of the second task.
228
+
229
+ We describe an image segmentation experiment whose neural network model is composed from an inception-like network branch and a densenet network branch. The entire network takes a $2 2 4 \times 2 2 4$ image and outputs binary mask at the same size. The inception branch is mainly used for locating the foreground objects while the densenet network branch is used to refine the boundaries around the segmented objects. This model was originally trained on multiple datasets.
230
+
231
+ In our experiment, we attempt to prune channels in both the inception branch and densenet branch. We set $\alpha = 0 . 0 1$ , $\rho = 0 . 5$ , $\bar { \mu _ { t } } = \bar { 2 } \times 1 0 ^ { - 5 }$ , and batch size $= 2 4$ . We train the pre-trained base model until all termination criterion are met, and build the pruned model for fine-tuning. The pruned model saves $86 \%$ parameters and $81 \%$ flops of the base model. We also compare the fine-tuned pruned model with the pre-trained base model across different test benchmark. Mean IOU is used as the evaluation metric.3 It shows that pruned model actually improves over the base model on four of the five test datasets with about $2 \% \sim 5 \%$ , while it performs worse than the base model on the most challenged dataset DUT-Omron, whose foregrounds might contain multiple objects.
232
+
233
+ Table 4: mIOU reported on different test datasets for the base model and the pruned model.
234
+
235
+ <table><tr><td></td><td>base model</td><td>pruned model</td></tr><tr><td>test dataset (#images)</td><td>mIOU</td><td>mIOU</td></tr><tr><td>MSRA10K (Liu et al., 2011) (2,500)</td><td>83.4%</td><td>85.5%</td></tr><tr><td>DUT-Omron (Yang et al., 2013) (1,292)</td><td>83.2%</td><td>79.1%</td></tr><tr><td>Adobe Flickr-portrait (Shen et al., 20i6) (150)</td><td>88.6%</td><td>93.3%</td></tr><tr><td>Adobe Flickr-hp (Shen et al., 2016) (300)</td><td>84.5%</td><td>89.5%</td></tr><tr><td>COCO-person (Lin et al.,2014) (50)</td><td>84.1%</td><td>87.5%</td></tr><tr><td>param.size</td><td>1.02 ×107</td><td>1.41 × 106</td></tr><tr><td>flops</td><td>5.68 ×109</td><td>1.08 × 109</td></tr></table>
236
+
237
+ # 6 CONCLUSIONS
238
+
239
+ We proposed a model pruning technique that focuses on simplifying the computation graph of a deep convolutional neural network. Our approach adopts ISTA to update the $\gamma$ parameter in batch normalization operator embedded in each convolution. To accelerate the progress of model pruning, we use a $\gamma { - } W$ rescaling trick before and after stochastic training. Our method cleverly avoids some possible numerical difficulties such as mentioned in other regularization-based related work, hence is easier to apply for practitioners. We empirically validated our method through several benchmarks and showed its usefulness and competitiveness in building compact CNN models.
240
+
241
+ # REFERENCES
242
+
243
+ Jose M Alvarez and Mathieu Salzmann. Learning the number of neurons in deep networks. In Advances in Neural Information Processing Systems, pp. 2270–2278, 2016.
244
+
245
+ Sajid Anwar, Kyuyeon Hwang, and Wonyong Sung. Structured pruning of deep convolutional neural networks. ACM Journal on Emerging Technologies in Computing Systems (JETC), 13(3):32, 2017.
246
+
247
+ Amir Beck and Marc Teboulle. A fast iterative shrinkage-thresholding algorithm for linear inverse problems. SIAM Journal on Imaging Sciences, 2(1):183–202, 2009.
248
+
249
+ Laurent Dinh, Razvan Pascanu, Samy Bengio, and Yoshua Bengio. Sharp minima can generalize for deep nets. In Proceedings of International Conference on Machine Learning, 2017.
250
+
251
+ Song Han, Jeff Pool, John Tran, and William Dally. Learning both weights and connections for efficient neural network. In Advances in Neural Information Processing Systems, pp. 1135–1143, 2015.
252
+
253
+ Babak Hassibi and David G Stork. Second order derivatives for network pruning: Optimal brain surgeon. In Advances in Neural Information Processing Systems, pp. 164–171, 1993.
254
+
255
+ 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.
256
+
257
+ Yihui He, Xiangyu Zhang, and Jian Sun. Channel pruning for accelerating very deep neural networks. In Proceedings of International Conference on Computer Vision, 2017.
258
+
259
+ Zehao Huang and Naiyan Wang. Data-driven sparse structure selection for deep neural networks. arXiv preprint arXiv:1707.01213, 2017.
260
+
261
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In International Conference on Machine Learning, pp. 448–456, 2015.
262
+
263
+ Vadim Lebedev and Victor Lempitsky. Fast convnets using group-wise brain damage. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2554–2564, 2016.
264
+
265
+ Yann LeCun, John S Denker, and Sara A Solla. Optimal brain damage. In Advances in Neural Information Processing Systems, pp. 598–605, 1990.
266
+
267
+ Hao Li, Asim Kadav, Igor Durdanovic, Hanan Samet, and Hans Peter Graf. Pruning filters for efficient convnets. In International Conference on Learning Representations, 2017.
268
+
269
+ Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollar, and ´ C Lawrence Zitnick. Microsoft coco: Common objects in context. In European conference on computer vision, pp. 740–755. Springer, 2014.
270
+
271
+ Tie Liu, Zejian Yuan, Jian Sun, Jingdong Wang, Nanning Zheng, Xiaoou Tang, and Heung-Yeung Shum. Learning to detect a salient object. IEEE Transactions on Pattern analysis and machine intelligence, 33(2): 353–367, 2011.
272
+
273
+ Zhuang Liu, Jianguo Li, Zhiqiang Shen, Gao Huang, Shoumeng Yan, and Changshui Zhang. Learning efficient convolutional networks through network slimming. arXiv preprint arXiv:1708.06519, 2017.
274
+
275
+ Pavlo Molchanov, Stephen Tyree, Tero Karras, Timo Aila, and Jan Kautz. Pruning convolutional neural networks for resource efficient transfer learning. In International Conference on Learning Representations, 2017.
276
+
277
+ Xiaoyong Shen, Aaron Hertzmann, Jiaya Jia, Sylvain Paris, Brian Price, Eli Shechtman, and Ian Sachs. Automatic portrait segmentation for image stylization. In Computer Graphics Forum, volume 35, pp. 93–102. Wiley Online Library, 2016.
278
+
279
+ 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.
280
+
281
+ Chuan Yang, Lihe Zhang, Huchuan Lu, Xiang Ruan, and Ming-Hsuan Yang. Saliency detection via graphbased manifold ranking. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 3166–3173, 2013.
282
+
283
+ Xiangyu Zhang, Jianhua Zou, Kaiming He, and Jian Sun. Accelerating very deep convolutional networks for classification and detection. IEEE Transactions on Pattern Analysis and Machine Intelligence, 38(10): 1943–1955, 2016.
284
+
285
+ Hao Zhou, Jose M Alvarez, and Fatih Porikli. Less is more: Towards compact cnns. In European Conference on Computer Vision, pp. 662–677. Springer, 2016.
286
+
287
+ ![](images/9f3a9db4aa3de8ff16f04d70491a4b364af864f221ad2e7ad9dee6582b55f869.jpg)
288
+ Figure 1: Visualization of the number of pruned channels at each convolution in the inception branch. Colored regions represents the number of channels kept. The height of each bar represents the size of feature map, and the width of each bar represents the size of channels. It is observed that most of channels in the bottom layers are kept while most of channels in the top layers are pruned.
md/train/HJBhEMbRb/HJBhEMbRb.md ADDED
@@ -0,0 +1,557 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # A SPECTRAL APPROACH TO GENERALIZATION ANDOPTIMIZATION IN NEURAL NETWORKS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ The recent success of deep neural networks stems from their ability to generalize well on real data; however, Zhang et al. (Zhang et al., 2016) have observed that neural networks can easily overfit random labels. This observation demonstrates that with the existing theory, we cannot adequately explain why gradient methods can find generalizable solutions for neural networks. In this work, we use a Fourierbased approach to study the generalization properties of gradient-based methods over 2-layer neural networks with sinusoidal activation functions. We prove that if the underlying distribution of data has nice spectral properties such as bandlimitedness, then the gradient descent method will converge to generalizable local minima. We also establish a Fourier-based generalization bound for bandlimited spaces, which generalizes to other activation functions. Our generalization bound motivates a grouped version of path norms for measuring the complexity of 2-layer neural networks with ReLU activation functions. We demonstrate numerically that regularization of this group path norm results in neural network solutions that can fit true labels without losing test accuracy while not overfitting random labels.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Deep neural networks (DNNs) have achieved state-of-the-art performance on a wide array of diverse tasks (LeCun et al., 2015). A given DNN architecture represents a highly rich space of hypotheses. However, numerous empirical results have demonstrated that a simple stochastic gradient descent (SGD) learner can efficiently search over this space to find a solution that achieves high performance on both training and test data. Despite many successful applications of DNNs to practical tasks such as computer vision (Krizhevsky et al., 2012), natural language processing (Collobert & Weston, 2008) and speech recognition (Hinton et al., 2012), our basic understanding of the factors that drive DNN generalization is still lacking.
12
+
13
+ Addressing generalization for DNNs is hard for two fundamental reasons: 1) Empirical risk minimization for neural networks is a non-convex optimization problem with possibly many local minima, and 2) Two different local minima with the same training performance can achieve significantly different performance on test data. For these reasons, the neural network optimization method plays an important role in the generalizability of the local minima found. For example, SGD has been empirically shown to outperform large-batch gradient descent (Keskar et al., 2016). Also, the performance of gradient methods can be improved upon by incorporating the geometry of observed data (Duchi et al., 2011; Neyshabur et al., 2015a).
14
+
15
+ For DNNs, however, a good optimization method is not sufficient for guaranteeing good generalization. Zhang et al. (Zhang et al., 2016) empirically demonstrate that a neural network trained by SGD can easily overfit random labels on the CIFAR-10 (Krizhevsky & Hinton, 2009) data. Yet, the same neural network fitted by the same SGD algorithm achieves good generalization performance for the original CIFAR-10 labels. This observation challenges the ability of traditional learning theory to explain why SGD learns generalizable hypotheses over neural networks. To shed light on this phenomenon, two recent works have developed generalization bounds and complexity measures for neural networks which can distinguish the local minima found for true and random labels. (Bartlett et al., 2017) proves a margin-based generalization bound and shows how it correlates with the generalization risk of DNNs when fitting true and random labels. (Neyshabur et al., 2017) explores different complexity scores for DNNs and how they behave differently for true and random labels. The complexity measures investigated in these works can effectively distinguish generalizable from poorly-generalizable local minima. They do not explain, however, why SGD converges to generalizable local minima when there exist poorly-generalizable local minima which can also perfectly fit the training set.
16
+
17
+ ![](images/eae1e91408a7d3edf31f6a8267c65fa3430e2b118f63f5b6bee8650d1cc10a30.jpg)
18
+ Figure 1: (a) A 2-layer neural network with activation function $\phi$ , (b) Training and test accuracy on CIFAR10 with true and random labels on a 2-layer neural network with 512 ReLU hidden units, regularized with an additive penalty: (b1) no penalty, (b2) $\ell _ { 2 }$ -norm, (b3) $\chi _ { 2 }$ -group path norm, (b4) $\ell _ { 1 }$ -path norm. The $\chi _ { 2 }$ -group path norm and $\ell _ { 1 }$ -path norm were successful to close the generalization gap for both true and random labels.
19
+
20
+ To approach this question, one needs to understand the key characteristic of CIFAR-10’s original labeling which differentiates it from random labels and how it is exploited by SGD to achieve good generalization performance. In this work, we approach this problem in the Fourier domain where non-random labeling schemes behave completely differently from random labeling schemes. While signals recoverable from few measurements possess nice spectral properties such as bandlimitedness, fully random stochastic processes are not bandlimited and not recoverable from any finite number of measurements.
21
+
22
+ Using spectral analysis, we focus on characterizing spectral properties of an underlying distribution which can be exploited by gradient-based methods to converge to generalizable local minima. We address this problem for 2-layer neural networks (see Figure 1a) with sinusoidal activation functions, where we show that if the underlying labeling scheme has limited bandwidth and Fourier $\ell _ { 1 }$ -norm (i.e. "nice" Fourier properties), we expect a gradient-based method to achieve good generalization performance. To arrive at this result, we first develop a Fourier-based generalization bound for 2-layer neural networks in terms of bandwidth and Fourier $\ell _ { 1 }$ -norm. Next, we prove that the local minima found by the gradient descent method over a 2-layer neural network with sine activation have bandwidth and Fourier $\ell _ { 1 }$ -norm bounded in terms of the spectral properties of the underlying labeling scheme.
23
+
24
+ As a byproduct of our Fourier analysis, we derive generalization bounds for 2-layer neural networks with general activation functions. For bandlimited activation functions with finite Fourier $\ell _ { 1 }$ -norm, such as sinusoidal or Gaussian activation1, our bound is tighter than the generalization bound obtained using only the Lipschitz constant of the activation function. For ReLU-type activation functions, our generalization bound is comparable to Lipschitz-based bounds; however, it leads to a grouped version of the path norms developed in (Neyshabur et al., 2015a). We therefore call this capacity norm group path norm which can be used as an additive penalty to regularize 2-layer neural networks with ReLU activation. Our numerical experiments suggest that the generalization gap can be effectively tightened by regularizing the group path norm. Figure 1b demonstrates how group path norm regularization can help close the generalization gap for both true and random labels.
25
+
26
+ # 2 RELATED WORK
27
+
28
+ Generalization has been a topic of central interest in statistical learning theory (Vapnik, 1999; ShalevShwartz & Ben-David, 2014). Generalization bounds have been derived using the stability of a learning algorithm (Bousquet & Elisseeff, 2002) and various complexity measures of a function space such as VC-dimension (Vapnik, 2013) and Rademacher complexity (Bartlett & Mendelson, 2002). (Hardt et al., 2015) develops a stability-based generalization result for SGD as the learning algorithm, which holds for both convex and non-convex loss functions.
29
+
30
+ We note that spectral analysis has provided a powerful framework for studying neural networks. (Barron, 1993) uses a Fourier-based approach to prove the universal approximation theorem for 2-layer neural networks. Similarly, (Lee et al., 2017) applies Fourier analysis to extend Barron’s result to a general feedforward neural network. (Rippel et al., 2015) uses a spectral approach to model and analyze convolutional neural networks (CNNs) and introduce the spectral pooling scheme for CNNs. Also, our Fourier-based approach to analyze SGD’s performance for 2-layer neural networks follows the same prinicples as the analysis performed in (Shamir, 2016) to prove the hardness of fitting periodic labeling schemes via gradient-based methods. We should note that in this work we use only periodic activation functions and not periodic labeling schemes. Therefore, the hardness result shown in (Shamir, 2016) does not affect our numerical experiments.
31
+
32
+ In general, theoretical studies of neural networks can be categorized into three main categories: 1) Approximation: Neural networks have been proven to be powerful in expressing a very rich class of functions (Cybenko, 1989) and in general deeper networks need fewer neurons to express the same class of functions (Eldan & Shamir, 2016; Liang & Srikant, 2016). 2) Generalization: Tight bounds have been shown on the VC dimesnion of feedforward neural networks (Anthony & Bartlett, 2009; Harvey et al., 2017). Also, norm-based Rademacher complexity bounds have been developed at (Bartlett & Mendelson, 2002; Neyshabur et al., 2015b). Sharpness of local minima and its connection to their generalizibility have been the focus of several recent works (Keskar et al., 2016; Dinh et al., 2017; Neyshabur et al., 2017) 3) Optimization: theoretical studies have shown both positive (Andoni et al., 2014; Daniely, 2017) and negative (Shalev-Shwartz et al., 2017) results about the performance of gradient-based methods in training neural networks.
33
+
34
+ # 3 PRELIMINARIES
35
+
36
+ # 3.1 SUPERVISED LEARNING AND GENERALIZATION
37
+
38
+ Suppose that we are given $n$ samples $( { \bf x } _ { i } , y _ { i } ) _ { i = 1 } ^ { n }$ drawn i.i.d. from a population distribution $P _ { \mathbf { X } , Y }$ Here $\mathbf { X }$ denotes the random vector of features and $Y$ denotes the target variable. Using these $n$ samples, the goal of a supervised learner is to find a prediction rule $f$ from a function space $\mathcal { F }$ which can predict $Y$ for an unseen test sample $\mathbf { X }$ . Therefore, given loss function $\ell$ the supervised learner wants to find $f ^ { * } \in { \mathcal { F } }$ minimizing the population risk, defined as $\mathbb { E } \big [ \ell \big ( f ( \mathbf { X } ) , Y \big ) \big ]$ averaged under the population distribution.
39
+
40
+ However, the supervised learner does not know the population distribution $P _ { \mathbf { X } , Y }$ and has only access to the $n$ training samples. The supervised learner can minimize the empirical risk, defined as $\textstyle 1 / n \sum _ { i = 1 } ^ { n } \ell \bigl ( f ( \mathbf { x } _ { i } ) , \mathbf { \bar { y } } _ { i } \bigr )$ and find $f _ { n } ^ { \mathrm { e m p } }$ . Since we only observe a limited number of samples, the empirical risk would be different from the population risk. The generalization risk, defined for $f \in { \mathcal { F } }$ as $\begin{array} { r l } { } & { { \mathbb E } [ \ell ( f ( \mathbf { X } ) , Y ) ] - \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \ell ( f ( \mathbf { x } _ { i } ) , y _ { i } ) } \end{array}$ , is the difference among the population risk and empirical risk for $f$ . Studying the behavior of $f _ { n } ^ { \mathrm { e m p } }$ ’s generalization risk for different function spaces and learning algorithms is a topic of central interest in statistical learning theory.
41
+
42
+ # 3.2 FOURIER TRANSFORM AND BANDLIMITED FUNCTIONS
43
+
44
+ Consider a real-valued function $f : \mathbb { R } ^ { k } \mathbb { R }$ . The Fourier transform of this function, which we denote by $\hat { f }$ , is defined as
45
+
46
+ $$
47
+ { \widehat { f } } ( \pmb { \xi } ) = \int f ( \mathbf { x } ) \exp \left( - 2 \pi i \pmb { \xi } ^ { T } \mathbf { x } \right) \mathrm { d } \mathbf { x } .
48
+ $$
49
+
50
+ Some important examples of Fourier transform are:
51
+
52
+ • Sinusoidal function: $f ( \mathbf { x } ) = \exp ( 2 \pi i \omega ^ { T } \mathbf { x } )$ , then ${ \widehat { f } } ( \pmb { \xi } ) = \delta ( \pmb { \xi } - \omega )$ where $\delta$ denotes the Dirac delta function, which also implies
53
+
54
+ • Gaussian function: $f ( \mathbf { x } ) = ( \sqrt { 2 \pi } \sigma ) ^ { k } \exp \bigl ( - \| \mathbf { x } \| _ { 2 } ^ { 2 } / 2 \sigma ^ { 2 } \bigr )$ , then $\widehat { f } ( \pmb { \xi } ) = \exp \left( - \sigma ^ { 2 } \| \pmb { \xi } \| _ { 2 } ^ { 2 } / 2 \right)$ . Thus, the Fourier transform of a Gaussian function preserves the Gaussian shape.
55
+
56
+ A function $f$ is called $B$ -bandlimited if ${ \widehat { f } } ( \pmb { \xi } ) = 0$ for every $\boldsymbol { \xi }$ where $\| { \pmb \xi } \| _ { 2 } > B$ . The smallest $B$ for which this property holds is called the bandwidth of $f$ . We use $B ( f )$ to denote the bandwidth of function $f$ . We also use $\| { \widehat { f } } \| _ { 1 }$ to denote the $\ell _ { 1 }$ -norm of $f$ ’s Fourier transform,
57
+
58
+ $$
59
+ \| { \widehat { f } } \| _ { 1 } = \int | { \widehat { f } } ( \pmb { \xi } ) | \mathrm { d } \pmb { \xi }
60
+ $$
61
+
62
+ which we call the Fourier $\ell _ { 1 }$ -norm of $f$ . Fourier $\ell _ { 1 }$ -norm can be interpreted as the absolute volume under $f$ ’s Fourier transform, and is an approximate measure of $\widehat { f }$ ’s sparsity. Fourier $\ell _ { 1 }$ -norm is both scale and shift invariant, i.e. if we define $g ( \mathbf { x } ) = f ( \mathbf { W } \mathbf { x } + \mathbf { b } )$ for a real-valued $f$ and $\mathbf { W } \in \mathbb { R } ^ { r \times k }$ and $\mathbf { b } \in \mathbb { R } ^ { r }$ for some $r \leq k$ , then $\| { \widehat { g } } \| _ { 1 } = \| { \widehat { f } } \| _ { 1 }$ . Some other useful properties of Fourier transform are:
63
+
64
+ • Synthesis: $\begin{array} { r } { f ( \mathbf { x } ) = \int \widehat { f } ( \pmb { \xi } ) \exp \left( 2 \pi i \pmb { \xi } ^ { T } \mathbf { x } \right) \mathrm { d } \pmb { \xi } } \end{array}$ , which also implies $\| { \widehat { f } } \| _ { 1 } = f ( 0 )$ if $\widehat { f }$ is real and non-negative.
65
+ • Shift: $\widehat { f } _ { \mathbf { b } } ( \pmb { \xi } ) = \exp ( 2 \pi i \mathbf { b } ^ { T } \pmb { \xi } ) \widehat { f } ( \pmb { \xi } )$ where $f _ { \mathbf { b } } ( \mathbf { x } ) : = f ( \mathbf { x } - \mathbf { b } )$ , which implies $\| { \widehat { f _ { \mathbf { b } } } } \| _ { 1 } = \| { \widehat { f } } \| _ { 1 }$ and $B ( f _ { \mathbf { b } } ) = B ( f )$ .
66
+ • Derivative: ${ \widehat { \nabla f } } ( \pmb { \xi } ) = 2 \pi i ~ { \widehat { f } } ( \pmb { \xi } ) \pmb { \xi }$ , where $\nabla f$ denotes the gradient of $f$ .
67
+ • Isometry: $\begin{array} { r } { \int f ( \mathbf { x } ) \overline { { g ( \mathbf { x } ) } } \mathrm { d } \mathbf { x } = \int \widehat { f } ( \pmb { \xi } ) \overline { { \widehat { g } ( \pmb { \xi } ) } } \mathrm { d } \pmb { \xi } } \end{array}$ where $\overline { z }$ denotes the complex conjugate of $z$ .
68
+ • Convolution: $\widehat { f g } = \widehat { f } \star \widehat { g }$ where $\star$ denotes the convolution operator i.e. ${ \widehat { f } } \star { \widehat { g } } ( \xi ) : = $ $\begin{array} { r } { \int \widehat { f } ( \pmb { \eta } ) \widehat { g } ( \pmb { \xi } - \pmb { \eta } ) \mathrm { d } \pmb { \eta } } \end{array}$ . Therefore, $B ( f g ) \le B ( f ) + B ( g )$ and $\| \widehat { f g } \| _ { 1 } \leq \| \widehat { f } \| _ { 1 } \| \widehat { g } \| _ { 1 }$ .
69
+
70
+ # 4 A FOURIER-BASED GENERALIZATION BOUND
71
+
72
+ Consider a supervised learning task with n training samples xi, yini=1 and function space $\mathcal { F }$ . We are interested in uniform convergence bounds on the generalization risk. A standard approach to bound the generalization risk is based on the notion of Rademacher complexity. Given samples $\left( \mathbf { x } _ { i } , y _ { i } \right) _ { i = 1 } ^ { n }$ , the empirical Rademacher complexity of $\mathcal { F }$ is defined as
73
+
74
+ $$
75
+ \mathcal { R } _ { n } ^ { \mathrm { e m p } } ( \mathcal { F } ) : = \mathbb { E } _ { \pmb { \sigma } } \bigg [ \operatorname* { s u p } _ { f \in \mathcal { F } } \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \sigma _ { i } f ( \mathbf { x } _ { i } ) \bigg ]
76
+ $$
77
+
78
+ where $\sigma _ { i }$ ’s are i.i.d. random variables uniformly distributed over $\{ - 1 , + 1 \}$ . In fact, the Rademacher complexity of $\mathcal { F }$ measures how well $\mathcal { F }$ can fit some random labels over input $\mathbf { x } _ { i }$ ’s. The following result shows how to bound the generalization risk over $\mathcal { F }$ through its Rademacher complexity.
79
+
80
+ Theorem 1 (Bartlett & Mendelson (2002)). Consider a $\rho$ -Lipschitz loss function $\ell ( f ( \mathbf { x } ) , y )$ bounded as $| \ell ( z , y ) | \leq c .$ . Then, for any $\delta > 0$ , with probability at least $1 - \delta$
81
+
82
+ $$
83
+ \forall f \in \mathcal { F } : \quad \mathbb { E } \big [ \ell ( f ( \mathbf { X } ) , Y ) \big ] - \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \ell ( f ( \mathbf { x } _ { i } ) , y _ { i } ) \leq 2 \rho \mathcal { R } _ { n } ^ { \mathrm { e n p } } ( \mathcal { F } ) + 4 c \sqrt { \frac { 2 \log ( 4 / \delta ) } { n } } .
84
+ $$
85
+
86
+ Since the Rademacher complexity of norm-bounded linear functions can be appropriately bounded (Kakade et al., 2009), one can effectively apply Theorem 1 to bound generalization risk over normbounded linear functions. To use Theorem 1 in the Fourier domain, here we provide a Rademacher complexity bound for bandlimited functions with bounded Fourier $\ell _ { 1 }$ -norm. We apply the following Rademacher complexity bound to bound generalization risk for 2-layer neural networks in Section 5, and also to analyze the performance of gradient-based methods with sinusoidal activation functions in Section 6.
87
+
88
+ Theorem 2. Consider function space $\mathcal { F } = \{ \boldsymbol { f } : \mathbb { R } ^ { k } \mathbb { R } $ s.t. $B ( f ) \leq B , \| { \widehat { f } } \| _ { 1 } \leq V \}$ of $B$ - bandlimited functions with $V$ -bounded Fourier $\mathbf { \dot { \ell } } _ { 1 }$ -norm. Then, the empirical Rademacher complexity for samples $( { \bf x } _ { i } , y _ { i } ) _ { i = 1 } ^ { n }$ is bounded as
89
+
90
+ $$
91
+ \mathcal { R } _ { n } ^ { \mathrm { e m p } } ( \mathcal { F } ) \leq V \sqrt { \frac { 4 k \log \left( 6 4 n B \operatorname* { m a x } _ { i } \| \mathbf { x } _ { i } \| _ { 2 } \right) } { n } } .
92
+ $$
93
+
94
+ Proof. We defer the proof to the Appendix.
95
+
96
+ Corollary 1. Assume that $\| \mathbf { X } \| _ { 2 } \leq C$ holds almost surely and the loss function $\ell$ is $\rho$ -Lipschitz. Then, for any $\delta > 0$ with probability at least $1 - \delta$ the following generalization bound holds for any $B$ -bandlimited function $f$ with $V$ -bounded Fourier $\ell _ { 1 }$ -norm:
97
+
98
+ $$
99
+ \mathbb { E } \big [ \ell ( f ( \mathbf { X } ) , Y ) \big ] - \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \ell ( f ( \mathbf { x } _ { i } ) , y _ { i } ) \leq O \bigg ( \rho V \sqrt { \frac { k \log ( n B C / \delta ) } { n } } \bigg ) .
100
+ $$
101
+
102
+ Proof. The corrollary is a direct result of applying the bound in Theorem 2 to Theorem 1.
103
+
104
+ The above corollary bounds the generalization risk uniformly over all bandlimited $f$ ’s such that $B ( f ) \le B$ and $\| { \widehat { f } } \| _ { 1 } \leq V$ . Next, we apply the above results to 2-layer neural networks.
105
+
106
+ # 5 APPLICATION OF THEOREM 2 TO 2-LAYER NEURAL NETWORKS
107
+
108
+ Consider a 2-layer neural network including $d$ neurons with activation function $\phi$ in the hidden layer (See Figure 1a). The output of this neural network is
109
+
110
+ $$
111
+ f _ { \mathbf { a } , \mathbf { W } , \mathbf { b } } ( \mathbf { x } ) = \mathbf { a } ^ { T } \phi ( \mathbf { W } \mathbf { x } + \mathbf { b } ) .
112
+ $$
113
+
114
+ If $\phi$ has bounded bandwidth and Fourier $\ell _ { 1 }$ -norm, we can apply Theorem 2 to bound the Rademacher complexity and hence generalization risk over the 2-layer neural network. Here, we use $\| \mathbf { W } \| _ { 2 , \infty }$ to denote the maximum $\ell _ { 2 }$ -norm $\left\| \mathbf { w } _ { i } \right\| _ { 2 }$ among all rows of $\mathbf { W }$ .
115
+
116
+ Corollary 2. Let $\mathcal { F } _ { \phi } = \left\{ f ( \mathbf { x } ) = \mathbf { a } ^ { T } \phi ( \mathbf { W } \mathbf { x } + \mathbf { b } ) : ~ \| \mathbf { W } \| _ { 2 , \infty } \leq W , ~ \| \mathbf { a } \| _ { 1 } \leq A \right\}$ be the class of 2-layer neural networks where $B ( \phi ) = B$ and $\| \widehat { \phi } \| _ { 1 } = V$ . Then, the empirical Rademacher complexity of $\mathcal { F } _ { \phi }$ for samples $( { \bf x } _ { i } , y _ { i } ) _ { i = 1 } ^ { n }$ is bounded as follows
117
+
118
+ $$
119
+ \mathcal { R } _ { n } ^ { \mathrm { e m p } } ( \mathcal { F } _ { \phi } ) \leq O \biggl ( A V \sqrt { \frac { k \log \bigl ( n B W \operatorname* { m a x } \| \mathbf { x } _ { i } \| _ { 2 } \bigr ) } { n } } \biggr ) .
120
+ $$
121
+
122
+ Proof. We defer the proof to the Appendix.
123
+
124
+ Notice that for bandlimited activation functions with bounded Fourier $\ell _ { 1 }$ -norm, the above generalization bound is increasing logarithmically with $\| \mathbf { W } \| _ { 2 , \infty }$ . For example, this result holds for sinusoidal activation $\phi ( x ) = \sin ( 2 \pi x )$ where $\| \widehat { \phi } \| _ { 1 } = 1$ , $B ( \phi ) = 1$ . On the other hand, the existing Rademacher complexity bounds which use only the Lipschitz constant of the activation function are linear in W’s norm (Bartlett & Mendelson, 2002). Therefore, by exploiting the spectral properties of $\phi$ , Corollary 2 results in a tighter generalization bound than the bounds using only the Lipschitz constant of $\phi$ .
125
+
126
+ However, an unbounded function such as ReLU $\phi ( x ) = \operatorname* { m a x } ( x , 0 )$ has an infinite Fourier $\ell _ { 1 }$ -norm. Therefore, Corollary 2 does not directly apply to these functions. The following theorem uses a boundedness assumption on input $\mathbf { X }$ to apply Theorem 2 to ReLU-type activation functions. Although the following bound is growing faster than logarithmically with W’s norm, it introduces new capacity norms for 2-layer ReLU-based networks.
127
+
128
+ Theorem 3. Suppose that $\phi _ { \alpha } ( x ) = \operatorname* { m a x } \{ x , \alpha x \}$ where $\alpha \in [ 0 , 1 ]$ is an arbitrary constant. Consider the pair of dual norms $( \| \cdot \| _ { p } , \| \cdot \| _ { q } )$ where $1 \leq p , q \leq \infty$ and $1 / p + 1 / q = 1$ . Assume that $\| \mathbf { x } _ { i } \| _ { p } \leq C$ holds for all $\mathbf { x } _ { i } \mathbf { \ ' } _ { s . }$ . Then, for $\begin{array} { r } { \mathcal { F } _ { \phi _ { \alpha } } = \left\{ f _ { \mathbf { a } , \mathbf { W } } ( \mathbf { x } ) = \mathbf { a } ^ { T } \phi _ { \alpha } ( \mathbf { W } \mathbf { x } ) : \sum _ { i = 1 } ^ { d } | a _ { i } | \| \mathbf { w } _ { i } \| _ { q } \leq V \right\} } \end{array}$
129
+
130
+ $$
131
+ \mathcal { R } _ { n } ^ { \mathrm { e m p } } ( \mathcal { F } _ { \phi _ { \alpha } } ) \leq O \bigg ( V C \sqrt { \frac { k \log ( n k C ) } { n } } \bigg ) .
132
+ $$
133
+
134
+ Proof. We relegate the proof to the Appendix.
135
+
136
+ The above bound uses the complexity score $\begin{array} { r } { \sum _ { i = 1 } ^ { d } | a _ { i } | \| \mathbf { w } _ { i } \| _ { q } } \end{array}$ for each $f _ { \mathbf { a } , \mathbf { W } } ( \mathbf { x } ) = \mathbf { a } ^ { T } \phi _ { \alpha } ( \mathbf { W } \mathbf { x } )$ . We can rewrite this complexity score in the following way, which is an $\ell _ { 1 , q }$ -group norm on the product of weights for each path from the input nodes to the output node of the 2-layer neural network,
137
+
138
+ $$
139
+ \chi _ { q } \big ( f _ { \mathbf { a } , \mathbf { W } } \big ) = \sum _ { i = 1 } ^ { d } \biggl ( \sum _ { j = 1 } ^ { k } \bigl ( | a _ { i } | | w _ { i , j } | \bigr ) ^ { q } \biggr ) ^ { 1 / q } .
140
+ $$
141
+
142
+ Here $w _ { i , j }$ denotes the weight on the link from the $j$ th node of the input layer to the ith node of the hidden layer. Based on the path-norm function defined at (Neyshabur et al., 2015a), we call $\chi _ { q } \left( f _ { \mathbf { a } , \mathbf { w } } \right)$ the group path norm. For $q = 1$ , $\chi _ { 1 }$ -group path norm leads to the $\ell _ { 1 }$ -path norm for 2-layer neural networks. We can use group path norms as an additive regularization penalty to learn over 2-layer neural networks. In our numerical experiments, we test the performance of $\chi _ { 2 }$ -group path norm and $\ell _ { 1 }$ -path norm regularization to control the generalization risk over 2-layer neural networks.
143
+
144
+ # 6 FOURIER ANALYSIS OF GRADIENT-BASED METHODS FOR 2-LAYER NEURAL NETWORKS WITH SINE ACTIVATION
145
+
146
+ In this section, we apply Fourier analysis for a 2-layer neural network with sinusoidal activation. We aim to understand the connection between generalizibility of local minima found by gradient-based methods and spectral properties of the population distribution $P _ { \mathbf { X } , Y }$ . As a simplifying assumption, let’s assume that target variable $Y$ is a deterministic function $Y ( \mathbf { \dot { x } } )$ of input $\mathbf { X }$ , which we call the labeling scheme. In our analysis, we consider the squared-error loss $\ell ( y , y ^ { \prime } ) = ( y - y ^ { \prime } ) ^ { 2 }$ .
147
+
148
+ We specifically ask this question: how can spectral properties of labeling scheme $Y ( \mathbf { x } )$ and population density function $P _ { \mathbf { X } } ( \mathbf { x } )$ affect the generalization performance of a gradient-based method? To address this question, we use a similar strategy to the analysis performed in (Mei et al., 2016) by establishing generalization results for both the empirical risk and the gradient of empirical risk. First, we show that the bandwidth and Fourier $\ell _ { 1 }$ -norm for the local minima of the population risk can be bounded in terms of the bandwidth and Fourier $\ell _ { 1 }$ -norm of $Y ( \mathbf { x } )$ and $P _ { \mathbf { X } } ( \mathbf { x } )$ . Next, we establish a generalization result for the gradient of the empirical risk, proving that the gradient of empirical risk would stay close to the gradient of population risk given that $Y ( \mathbf { x } )$ has limited bandwidth and Fourier $\ell _ { 1 }$ -norm. These two results show that by assuming a labeling scheme with limited bandwidth and Fourier $\ell _ { 1 }$ -norm, the local minima found by the gradient descent (in general large-batch gradient descent) method will generalize well.
149
+
150
+ # 6.1 POPULATION RISK WITH SINUSOIDAL ACTIVATION
151
+
152
+ Consider sinusoida $\begin{array} { r } { f _ { \mathbf { a } , \mathbf { W } , \mathbf { b } } ( \mathbf { x } ) = \sum _ { j = 1 } ^ { d } a _ { j } \sin ( 2 \pi \mathbf { w } _ { j } ^ { T } \mathbf { x } + b _ { j } ) } \end{array}$ ing from a 2-layer neural network with the population risk will be $d$ $Y ( \mathbf { x } )$
153
+
154
+ $$
155
+ \mathbb { E } _ { P _ { \mathbf { X } } } \left[ \ell \big ( f _ { \mathbf { a } , \mathbf { W } , \mathbf { b } } ( \mathbf { x } ) , Y ( \mathbf { x } ) \big ) \right] = \mathbb { E } _ { P _ { \mathbf { X } } } \big [ \big ( Y ( \mathbf { x } ) - \sum _ { j = 1 } ^ { d } a _ { j } \mathrm { s i n } ( 2 \pi \mathbf { w } _ { j } ^ { T } \mathbf { x } + b _ { j } ) \big ) ^ { 2 } \big ] ,
156
+ $$
157
+
158
+ where the expectation is according to the population density function $P _ { \mathbf { X } } ( \mathbf { x } )$ .
159
+
160
+ Lemma 1. Consider the population risk in (11). Assume $\mathbf { w } _ { j }$ satisfies $\forall i \neq j : \operatorname* { m i n } \{ \| \mathbf { w } _ { i } - { }$ $\mathbf { w } _ { j } \| _ { 2 } , \| \mathbf { w } _ { i } + \mathbf { w } _ { j } \| _ { 2 } \big \} > B ( P _ { \mathbf { X } } )$ . Then, $i f ( \mathbf { a } , \mathbf { W } , \mathbf { b } )$ is assumed to be a local minimum of the population risk,
161
+
162
+ $$
163
+ \big | a _ { j } \big | \leq 2 \big | \widehat { Y } \star \widehat { P _ { \mathbf { X } } } ( \mathbf { w } _ { j } ) \big | .
164
+ $$
165
+
166
+ Proof. We defer the proof to the Appendix.
167
+
168
+ Lemma 1 says that if the component $a _ { j } \sin ( 2 \pi \mathbf { w } _ { j } ^ { T } \mathbf { x } )$ becomes isolated for a local minimum, by which we mean there are no other component $a _ { i } \sin ( 2 \pi \mathbf { w } _ { i } ^ { T } \mathbf { x } )$ with $\operatorname* { m i n } \{ \| \mathbf { w } _ { i } - \mathbf { w } _ { j } \| _ { 2 } , \| \mathbf { w } _ { i } + \mathbf { w } _ { j } \| _ { 2 } \}$ less than $P _ { \mathbf { X } }$ ’s bandwidth, then the value of $a _ { j }$ for that local minimum is nicely bounded in terms of the population distribution. This result leads to the following Theorem which describes the Fourier properties of the local minima of the population risk.
169
+
170
+ Theorem 4. Consider the minimization problem of the population risk (11). If a local minimum $( \mathbf { a } ^ { * } , \mathbf { W } ^ { * } , \mathbf { b } ^ { * } )$ satisfies the isolated components condition, i.e. for any two different $i , j$ we have $\operatorname* { m i n } \bigl \{ \| \mathbf { w } _ { i } ^ { * } - \mathbf { w } _ { j } ^ { * } \| _ { 2 } , \| \mathbf { w } _ { i } ^ { * } + \mathbf { w } _ { j } ^ { * } \| _ { 2 } \bigr \} > 2 B ( P _ { \mathbf { X } } )$ , then for the local minimum function $f _ { \mathbf { a } ^ { * } , \mathbf { W } ^ { * } , \mathbf { b } ^ { * } }$
171
+
172
+ $$
173
+ \begin{array} { r l } & { \bullet \mathcal { B } ( f _ { \mathbf { a } ^ { * } , \mathbf { W } ^ { * } , \mathbf { b } ^ { * } } ) \leq \mathcal { B } ( Y ) + \mathcal { B } ( P _ { \mathbf { X } } ) , } \\ & { \bullet \| \widehat { f } _ { \mathbf { a } ^ { * } , \mathbf { W } ^ { * } , \mathbf { b } ^ { * } } \| _ { 1 } \leq 2 \| \widehat { Y } \| _ { 1 } . } \end{array}
174
+ $$
175
+
176
+ Proof. We defer the proof to the Appendix.
177
+
178
+ Theorem 4 implies that the bandwidth of the local minima of the population risk is less than the sum of bandwidths for $Y$ and $P _ { \mathbf { X } }$ . Also, the Fourier $\ell _ { 1 }$ -norm for the local minima of the population distribution is bounded by twice the Fourier $\ell _ { 1 }$ -norm of $Y$ .
179
+
180
+ Remark 1. To apply Theorem 4, the bandwidth of $P _ { \mathbf { X } }$ needs to be smaller than half the distance among $\mathbf { w } _ { i } ^ { * }$ ’s. For example, suppose that $\mathbf { X } \sim { \mathcal { N } } ( { \pmb { \mu } } , \sigma ^ { 2 } \mathbf { I } _ { k \times k } )$ has a multivariate Gaussian distribution with mean $\pmb { \mu }$ and diagonal covariance matrix with standard deviation $\sigma$ . Then, the above theorem shows that if for any $i , j$ we have $\operatorname* { m i n } \bigr \{ \| \mathbf { w } _ { i } ^ { * } - \mathbf { w } _ { j } ^ { * } \| _ { 2 } , \| \mathbf { w } _ { i } ^ { * } + \mathbf { w } _ { j } ^ { * } \| _ { 2 } \bigr \} > 2 C / \sigma$ for some constant $C$ then
181
+
182
+ $$
183
+ \begin{array} { r l } & { \bullet \mathcal { B } ( f _ { \mathbf { a } ^ { * } , \mathbf { W } ^ { * } , \mathbf { b } ^ { * } } ) \leq \mathcal { B } ( Y ) + O \big ( \sqrt { k } / \sigma \big ) , } \\ & { \bullet \| \widehat { f } _ { \mathbf { a } ^ { * } , \mathbf { W } ^ { * } , \mathbf { b } ^ { * } } \| _ { 1 } \leq 2 ( 1 + d \exp ( - C ^ { 2 } / 2 ) ) \| \widehat { Y } \| _ { 1 } . } \end{array}
184
+ $$
185
+
186
+ Proof. See the proof of Theorem 4 in the Appendix.
187
+
188
+ # 6.2 GENERALIZATION TO THE EMPIRICAL RISK
189
+
190
+ Theorem 4 characterizes the Fourier properties of the local minima for the population risk. However, we want to investigate the generalization performance of the local minima of the empirical risk defined for training samples $\mathbf { \bar { \rho } } ( \mathbf { x } _ { i } , Y ( \mathbf { x } _ { i } ) ) _ { i = 1 } ^ { n }$ as
191
+
192
+ $$
193
+ \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \ell \big ( f _ { \mathbf { a } , \mathbf { W } , \mathbf { b } } ( \mathbf { x } _ { i } ) , Y ( \mathbf { x } _ { i } ) \big ) = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \bigg ( Y ( \mathbf { x } _ { i } ) - \sum _ { j = 1 } ^ { d } a _ { j } \sin ( 2 \pi \mathbf { w } _ { j } ^ { T } \mathbf { x } _ { i } + b _ { j } ) \bigg ) ^ { 2 } .
194
+ $$
195
+
196
+ To address this question, note that the bandwidth and Fourier $\ell _ { 1 }$ -norm of the loss’s gradient with respect to each $a _ { j }$ are bounded in terms of the bandwidth and Fourier $\ell _ { 1 }$ -norm of $Y ( \mathbf { x } )$ as
197
+
198
+ $$
199
+ \begin{array} { r l } & { \quad \big \| \nabla _ { a _ { j } } \ell \big ( \widehat { f _ { \mathbf { a } , \mathbf { W } , \mathbf { b } } } ( \mathbf { x } ) , Y ( \mathbf { x } ) \big ) \big \| _ { 1 } \leq \| \widehat { Y } \| _ { 1 } + \| \mathbf { a } \| _ { 1 } , } \\ & { \mathcal { B } \big ( \nabla _ { a _ { j } } \ell \big ( f _ { \mathbf { a } , \mathbf { W } , \mathbf { b } } ( \mathbf { x } ) , Y ( \mathbf { x } ) \big ) \big ) \leq \mathcal { B } ( Y ) + 2 \| \mathbf { W } \| _ { 2 , \infty } . } \end{array}
200
+ $$
201
+
202
+ We can apply Corollary 1 to show that not only the empirical risk uniformly converges to the population risk but also the gradient of the empirical risk will stay close to the gradient of the population risk.
203
+
204
+ Corollary 3. Consider $\begin{array} { r } { f _ { \mathbf { a } , \mathbf { W } , \mathbf { b } } ( \mathbf { x } ) = \sum _ { j = 1 } ^ { d } a _ { j } \sin ( \mathbf { w } _ { j } ^ { T } \mathbf { x } + b _ { j } ) } \end{array}$ and squared error loss \`. Then, given that $\| \mathbf { X } \| _ { 2 } \leq C$ , for any $\delta > 0$ with probability at least $1 - \delta$ we have
205
+
206
+ $\forall j , \mathbf { a } , \mathbf { W } , \mathbf { b }$ s.t. $\| \mathbf { a } \| _ { 1 } + \| { \widehat { Y } } \| _ { 1 } \leq V , \ 2 \| \mathbf { W } \| _ { 2 , \infty } + B ( Y ) \leq B \ :$
207
+
208
+ $$
209
+ \begin{array} { r l } & { \displaystyle \mathbb { E } [ \nabla _ { a _ { j } } \ell ( f _ { \mathbf { a } , \mathbf { W } , \mathbf { b } } ( \mathbf { X } ) , Y ( \mathbf { X } ) ) ) ] - \frac { 1 } { n } \sum _ { i = 1 } ^ { n } [ \nabla _ { a _ { j } } \ell ( f _ { \mathbf { a } , \mathbf { W } , \mathbf { b } } ( \mathbf { x } _ { i } ) , Y ( \mathbf { x } _ { i } ) ) ) ] \Big \vert \leq O \big ( V \sqrt { \frac { k \log ( n B C / \delta ) } { n } } \big ) . } \end{array}
210
+ $$
211
+
212
+ Proof. The corollary is a direct result of Corollary (1) given (14) and (15). Note that the generalization bound holds with probability $1 - \delta$ for the derivative with respect to all $a _ { j }$ ’s, since the bounds in (14) and (15) hold for all $j$ ’s. □
213
+
214
+ We emphasize that to prove Theorem 4 we need to analyze the risk function’s derivative only with respect to $a _ { j }$ ’s. Hence, generalization of the empirical risk’s gradient with respect to $a _ { j }$ ’s, which is shown in the above corollary under certain assumptions, is sufficient to apply an approximate version of Theorem 4 in section 8.6 to a local minimum $( { \bf a } ^ { * } , { \bf W } ^ { * } , { \bf b } ^ { * } )$ satisfying the isolated components assumption and found by the gradient descent approach initialized at a low $\left\| \mathbf { a } \right\| _ { 1 }$ and $\lVert \mathbf { W } \rVert _ { 2 , \infty } ^ { - }$ . We can conclude that with probability at least $1 - \delta$ the $\ell _ { 1 }$ -norm of $f _ { \mathbf { a } ^ { * } , \mathbf { W } ^ { * } , \mathbf { b } ^ { * } }$ ’s Fourier transform outside the bandwidth $\mathcal { B } ( Y ) + \mathcal { B } ( P _ { \mathbf { X } } )$ is bounded by $O \big ( d V \sqrt { \frac { k \log \big ( n B C / \delta \big ) } { n } } \big )$ , and also
215
+
216
+ ![](images/914686f543f146ed0aa239713cbfcd289a4969ea062bc0a533bafbbb1b15a0f0.jpg)
217
+ Figure 2: Training an test performance on cat and airplane CIFAR10 images with true and random labels. Sine activation and mean-squared-error loss were used.
218
+
219
+ ![](images/3a0eb3a058ec45fed9e212dca7302bb4d59e8eba4b3a5b5bba3855e8b79b0e81.jpg)
220
+ Figure 3: Training and test performance on cat and airplane CIFAR10 images with true and random labels. ReLU activation and cross-entropy loss were used.
221
+
222
+ $$
223
+ \| \widehat { f } _ { \mathbf { a } ^ { * } , \mathbf { W } ^ { * } , \mathbf { b } ^ { * } } \| _ { 1 } \leq 2 \| \widehat { Y } \| _ { 1 } + O \big ( d V \sqrt { \frac { k \log ( n B C / \delta } { n } } \big ) .
224
+ $$
225
+
226
+ Based on the above discussion, if a large-batch gradient descent method starts learning from $f _ { \mathbf { a } , \mathbf { w } , \mathbf { b } }$ with low $\lVert \mathbf { a } \rVert _ { 1 }$ and $\| \mathbf { W } \| _ { 2 , \infty }$ and also we assume that the bandwidth and the Fourier $\ell _ { 1 }$ -norm for $Y ( \mathbf { x } )$ are properly bounded, Theorem 4 combined with Corollary 1 will guarantee good generalization performance for the local minima found by the gradient descent method.
227
+
228
+ # 7 NUMERICAL EXPERIMENTS
229
+
230
+ For all experiments described in this section, we implemented and trained the two-layer neural network described in Figure 1a using TensorFlow 1.3.0. We used SGD to train the model for 2000 epochs with an initial learning rate of 0.01. The learning rate decayed slightly each epoch at a rate of 0.95 every 390 epochs. We used $h = 5 1 2$ hidden units and a batch size of 128. When working with CIFAR10 data, we preprocessed the data as described in (Zhang et al., 2016), resulting in each training sample having dimension $d = 2 3 5 2$ . Initial weights from the first layer were sampled from $\mathcal { N } ( 0 , \bar { 0 . 0 1 } / \bar { d } )$ and initial weights from the second layer were sampled from $\dot { \mathcal { N } } ( 0 , 0 . 0 1 / h )$ .
231
+
232
+ 7.1 SGD GRADUALLY LEARNS HIGHER FOURIER $\ell _ { 1 }$ -NORM, BANDWIDTH HYPOTHESES
233
+
234
+ We first numerically demonstrate that how Fourier $\ell _ { 1 }$ -norm and bandwidth both increases during training via SGD. Motivated by the analysis from Section 6, we use the squared-error as our loss function and sine as our activation function. Our samples consist of cats and airplanes from the CIFAR10 dataset with the labels mapped to $- 1$ and 1. We use 5000 and 2000 samples from each category for training and test, respectively. We arbitrarily chose two of the ten classes to accommodate our choice of loss function. We evaluate the network’s performance for both random and true labels.
235
+
236
+ Figure 2a shows that without regularization, SGD learns to perfectly fit both the true and random labels, which is consistent with the results from Zhang et al. (2016). Additionally, the random labels are harder to learn, requiring more epochs before achieving a perfect fit. Figures 2b and 2c confirm that both Fourier $\ell _ { 1 }$ -norm and bandwidth consistently increase with training, highlighting how SGD gradually finds more complex hypotheses in order to fit the data. Finally, we see in figures 2d and 2e how both Fourier $\ell _ { 1 }$ -norm and bandwidth increase with generalization risk (the difference between test mean squared-error (MSE) and training MSE) with almost perfect correlation. This suggests that, as implied by the theory above, regularizing Fourier $\ell _ { 1 }$ -norm and bandwidth could improve generalizability of the final learned model.
237
+
238
+ # 7.2 GROUP PATH NORM REGULARIZATION FOR RELU ACTIVATION
239
+
240
+ We regularize group path norm for ReLU activation as motivated by Theorem 3. Although $\chi _ { 2 }$ -group path norm is not convex, it is differentiable and we can use it as an additive penalty and find a local minimum via SGD. Using the same experimental setup as from section 7.1, we swap sine for ReLU and test the network’s performance for both random and true labels.
241
+
242
+ Figure 3a confirms that, like before, the network can fit both true and random labels. The generalization gap, however, remains large for random labels. By regularizing the $\ell _ { 2 }$ -norm of all the weights, we see that the generalization gap closes for both the true labels and the random labels without compromising test accuracy significantly (Figure 3b). This result is further improved when we use the $\chi _ { 2 }$ -group path norm and $\ell _ { 1 }$ -path norm (Figure 3c and 3d), demonstrating that direct regularization of Fourier $\ell _ { 1 }$ -norm leads to better generalization.
243
+
244
+ We cross-validated the value of $\lambda$ for each regularization technique, and we chose the $\lambda$ that resulted in the smallest generalization gap with comparable validation performance. To fairly compare different regularization strategies, we tested five lambda values for each strategy and then reported the performance on the test set for the lambda value that resulted in the best performance on the validation set.
245
+
246
+ We repeated the experiment using all 50000 CIFAR10 training samples (and 10000 test samples). We included all 10 classes and switched to cross-entropy loss. The results are shown in Figure 1b. Again, we see that while all regularization techniques give similar test performance, the generalization gap is closed significantly for the $\chi _ { 2 }$ -group path norm and $\ell _ { 1 }$ -path norm.
247
+
248
+ # REFERENCES
249
+
250
+ Alexandr Andoni, Rina Panigrahy, Gregory Valiant, and Li Zhang. Learning polynomials with neural networks. In International Conference on Machine Learning, pp. 1908–1916, 2014.
251
+ Martin Anthony and Peter L Bartlett. Neural network learning: Theoretical foundations. cambridge university press, 2009.
252
+ Andrew R Barron. Universal approximation bounds for superpositions of a sigmoidal function. IEEE Transactions on Information theory, 39(3):930–945, 1993.
253
+ Peter Bartlett, Dylan J Foster, and Matus Telgarsky. Spectrally-normalized margin bounds for neural networks. arXiv preprint arXiv:1706.08498, 2017.
254
+ 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.
255
+ Olivier Bousquet and André Elisseeff. Stability and generalization. Journal of Machine Learning Research, 2 (Mar):499–526, 2002.
256
+
257
+ Ronan Collobert and Jason Weston. A unified architecture for natural language processing: Deep neural networks with multitask learning. In Proceedings of the 25th international conference on Machine learning, pp. 160–167, 2008.
258
+
259
+ George Cybenko. Approximation by superpositions of a sigmoidal function. Mathematics of Control, Signals, and Systems (MCSS), 2(4):303–314, 1989.
260
+
261
+ Amit Daniely. Sgd learns the conjugate kernel class of the network. arXiv preprint arXiv:1702.08503, 2017.
262
+
263
+ Laurent Dinh, Razvan Pascanu, Samy Bengio, and Yoshua Bengio. Sharp minima can generalize for deep nets. arXiv preprint arXiv:1703.04933, 2017.
264
+
265
+ John Duchi, Elad Hazan, and Yoram Singer. Adaptive subgradient methods for online learning and stochastic optimization. Journal of Machine Learning Research, 12(Jul):2121–2159, 2011.
266
+
267
+ Ronen Eldan and Ohad Shamir. The power of depth for feedforward neural networks. In Conference on Learning Theory, pp. 907–940, 2016.
268
+
269
+ Moritz Hardt, Benjamin Recht, and Yoram Singer. Train faster, generalize better: Stability of stochastic gradient descent. arXiv preprint arXiv:1509.01240, 2015.
270
+
271
+ Nick Harvey, Chris Liaw, and Abbas Mehrabian. Nearly-tight vc-dimension bounds for piecewise linear neural networks. arXiv preprint arXiv:1703.02930, 2017.
272
+
273
+ Geoffrey Hinton, Li Deng, Dong Yu, George E Dahl, Abdel-rahman Mohamed, Navdeep Jaitly, Andrew Senior, Vincent Vanhoucke, Patrick Nguyen, Tara N Sainath, et al. Deep neural networks for acoustic modeling in speech recognition: The shared views of four research groups. IEEE Signal Processing Magazine, 29(6): 82–97, 2012.
274
+
275
+ Sham M Kakade, Karthik Sridharan, and Ambuj Tewari. On the complexity of linear prediction: Risk bounds, margin bounds, and regularization. In Advances in neural information processing systems, pp. 793–800, 2009.
276
+
277
+ 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.
278
+
279
+ Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. 2009.
280
+
281
+ 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.
282
+
283
+ Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep learning. Nature, 521(7553):436–444, 2015.
284
+
285
+ Holden Lee, Rong Ge, Andrej Risteski, Tengyu Ma, and Sanjeev Arora. On the ability of neural nets to express distributions. arXiv preprint arXiv:1702.07028, 2017.
286
+
287
+ Shiyu Liang and R Srikant. Why deep neural networks? arXiv preprint arXiv:1610.04161, 2016.
288
+
289
+ Song Mei, Yu Bai, and Andrea Montanari. The landscape of empirical risk for non-convex losses. arXiv preprint arXiv:1607.06534, 2016.
290
+
291
+ Behnam Neyshabur, Ruslan R Salakhutdinov, and Nati Srebro. Path-sgd: Path-normalized optimization in deep neural networks. In Advances in Neural Information Processing Systems, pp. 2413–2421, 2015a.
292
+
293
+ Behnam Neyshabur, Ryota Tomioka, and Nathan Srebro. Norm-based capacity control in neural networks. In COLT, pp. 1376–1401, 2015b.
294
+
295
+ Behnam Neyshabur, Srinadh Bhojanapalli, David McAllester, and Nathan Srebro. Exploring generalization in deep learning. arXiv preprint arXiv:1706.08947, 2017.
296
+
297
+ Oren Rippel, Jasper Snoek, and Ryan P Adams. Spectral representations for convolutional neural networks. In Advances in Neural Information Processing Systems, pp. 2449–2457, 2015.
298
+
299
+ Shai Shalev-Shwartz and Shai Ben-David. Understanding machine learning: From theory to algorithms. Cambridge university press, 2014.
300
+
301
+ Shai Shalev-Shwartz, Ohad Shamir, and Shaked Shammah. Failures of gradient-based deep learning. In International Conference on Machine Learning, pp. 3067–3075, 2017.
302
+
303
+ Ohad Shamir. Distribution-specific hardness of learning neural networks. arXiv preprint arXiv:1609.01037, 2016.
304
+
305
+ Vladimir Vapnik. The nature of statistical learning theory. Springer science & business media, 2013.
306
+
307
+ Vladimir N Vapnik. An overview of statistical learning theory. IEEE transactions on neural networks, 10(5): 988–999, 1999.
308
+
309
+ Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. arXiv preprint arXiv:1611.03530, 2016.
310
+
311
+ # 8 APPENDIX
312
+
313
+ # 8.1 PROOF OF THEOREM 2
314
+
315
+ We use a high-dimensional grid in the Fourier domain to approximate the Fourier transform of a $B$ -bandlimited function. Consider the ball $\displaystyle \mathbf { \bar { \boldsymbol { \{ \xi } } } \colon \| \pmb { \xi } \| _ { 2 } \leq B \}$ . Using the bounds on the covering number for $\ell _ { 2 }$ -norm, for any $0 < \epsilon < B$ we can find a set of points $\{ \pmb { \xi } _ { j } : 1 \le j \le ( 3 B / \epsilon ) ^ { k } \}$ such that for any $\pmb { \xi }$ with $\| { \pmb { \xi } } \| _ { 2 } \le B$ , there exists some $\xi _ { j }$ with $\| \pmb { \xi } - \pmb { \xi } _ { j } \| _ { 2 } \le \epsilon$ .
316
+
317
+ Let $S _ { j } = \{ \pmb { \xi } : \| \pmb { \xi } - \pmb { \xi } _ { j } \| _ { 2 } \leq \epsilon \}$ for each $1 \le j \le ( 3 B / \epsilon ) ^ { k }$ . Note that $\{ \pmb { \xi } : \ \| \pmb { \xi } \| _ { 2 } \le B \} \subset \cup _ { j } S _ { j }$ . We then define $S _ { j } ^ { \prime } = S _ { j } \setminus \cup _ { t = 1 } ^ { j - 1 } S _ { t }$ to have a group of disjoint sets $S _ { j } ^ { \prime }$ covering $\{ \pmb { \xi } : \ \| \pmb { \xi } \| _ { 2 } \leq B \}$ . Since any $f \in { \mathcal { F } }$ is assumed to be $B$ -bandlimited, for $f \in { \mathcal { F } }$
318
+
319
+ $$
320
+ \begin{array} { l } { f ( \mathbf { x } ) = \displaystyle \int \widehat { f } ( \pmb { \xi } ) \exp ( 2 \pi i \pmb { \xi } ^ { T } \mathbf { x } ) \mathrm { d } \pmb { \xi } } \\ { = \displaystyle \sum _ { j = 1 } ^ { ( 3 B / \epsilon ) ^ { k } } \int _ { \pmb { \xi } \in S _ { j } ^ { \prime } } \widehat { f } ( \pmb { \xi } ) \exp ( 2 \pi i \pmb { \xi } ^ { T } \mathbf { x } ) \mathrm { d } \pmb { \xi } . } \end{array}
321
+ $$
322
+
323
+ Then, for any $f \in { \mathcal { F } } = \{ f : { \mathcal { B } } ( f ) \leq B , \| { \widehat { f } } \| _ { 1 } \leq V \}$ we have
324
+
325
+ $$
326
+ \begin{array} { r l } | | \begin{array} { l l } { f ( \Phi ) } & { - \frac { \lambda ( \xi ) \xi } { 2 } [ \exp ( \xi ) \log ( \xi ) ] | _ { \xi = \xi } | \langle \Phi \rangle | } \\ & { + | \frac { \lambda ( \xi ) \xi } { 2 } [ \exp ( \xi ) \log ( \xi ) ] | _ { \xi = \xi } | \langle \Phi \rangle | _ { \xi = \xi } | } \\ & { - | \frac { \lambda ( \xi ) \xi } { 2 } [ \frac { \lambda ( \xi ) } { 2 } [ \xi \xi ] [ \log ( \xi ) ) + \frac { \lambda ( \xi ) } { 2 } [ \xi ] [ \xi ] ] | _ { \xi = \xi } ^ { \xi } } \\ & { \le \frac { \lambda ( \xi ) } { 2 } [ \frac { \lambda ( \xi ) } { 2 } [ \xi ] [ \xi ] [ \xi ] [ \lambda ( \xi ) ) [ \xi ] [ \xi ] ] ] | _ { \xi = \xi } ^ { \xi } [ \xi ] [ \xi ] | _ { \xi = \xi } ^ { \xi } } \\ & { \overset { \mathrm { B ( a ) } } { \le } \frac { \lambda ( \xi ) } { 2 } \int _ { \xi \in \xi } [ \frac { \lambda ( \xi ) } { 2 } [ \xi ] [ \xi ] [ \xi ] \xi ] [ \xi - \xi ] \xi ] \le \frac { \lambda ( \xi ) } { 2 } [ \xi ] [ \xi ] \frac { \lambda ( \xi ) } { 2 } } \\ & { \le \frac { \lambda ( \xi ) } { 2 } [ \frac { \lambda ( \xi ) } { 2 } [ \xi ] [ \xi ] \xi ] [ \xi ] \xi [ \xi ] \xi [ \xi ] \xi [ \xi ] \xi ] \ } \\ & { \overset { \mathrm { C ( I ) } } { \le } \frac { \lambda ( \xi ) } { 2 } [ \frac { \lambda ( \xi ) } { 2 } \int _ { \xi \in \xi } [ \frac { \lambda ( \xi ) } { 2 } [ \xi ] \xi ] [ \xi ] \xi [ \xi ] \xi ] \xi } \\ & \overset { \mathrm { B ( a ) } } { \le } \frac { \lambda ( \xi ) } { 2 } \int _ { \xi \in \xi } \frac { \lambda ( \xi ) } { 2 } \int _ \xi \ \end{array} \end{array}
327
+ $$
328
+
329
+ Here, (a) is a direct application of (17). (b) holds as $\exp ( i b z ) = \cos ( b z ) + i \sin ( b z )$ is $^ { b }$ -Lipschitz as a function of $z \in \mathbb { R }$ for any real number $b > 0$ . (c) holds because according to our definitions $\bar { S _ { j } ^ { \prime } } \subseteq S _ { j }$ and $S _ { j } = \{ \pmb { \xi } : \ \| \pmb { \xi } - \pmb { \xi } _ { j } \| _ { 2 } \leq \epsilon \}$ .
330
+
331
+ Therefore, the following function space $\mathcal { F } _ { \epsilon }$ can approximate any $f \in { \mathcal { F } } = \left\{ f : { \mathcal { B } } ( f ) \leq B , \| { \widehat { f } } \| _ { 1 } \leq V \right\}$ within $2 \pi \epsilon C V$ accuracy for any $\| \mathbf { x } \| _ { 2 } \leq C$ . Here a is, in general, a vector of complex numbers, and $\begin{array} { r } { \| \dot { \bf a } \| _ { 1 } : = \sum _ { j } | a _ { j } | } \end{array}$
332
+
333
+ where $| z |$ denotes the absolute value of complex number $z$
334
+
335
+ $$
336
+ \mathcal { F } _ { \epsilon } = \Bigg \{ f ( \mathbf { x } ) = \sum _ { j = 1 } ^ { ( 3 B / \epsilon ) ^ { k } } a _ { j } \exp ( 2 \pi i \pmb { \xi } _ { j } ^ { T } \mathbf { x } ) : \| \mathbf { a } \| _ { 1 } \leq V \Bigg \} .
337
+ $$
338
+
339
+ Then, $\mathcal { F } _ { \epsilon }$ is the space of $\ell _ { 1 }$ -norm bounded linear functions in terms of the input vector $\left[ \exp ( 2 \pi i \pmb { \xi } _ { j } ^ { T } \mathbf { x } ) \right] _ { j }$ . Now, we can apply a well-known bound (Shalev-Shwartz & Ben-David, 2014) on the Rademacher complexity of $\ell _ { 1 }$ -norm bounded linear space $\mathcal { F } _ { \mathrm { l i n } , 1 } = \{ \boldsymbol { f } : \mathbb { R } ^ { k } \mathbb { R } $ s.t. $f ( \mathbf { x } ) = \mathbf { a } ^ { T } \mathbf { x }$ , $\| \mathbf { a } \| _ { 1 } \leq A \}$ as
340
+
341
+ $$
342
+ \mathcal { R } _ { n } ^ { \mathrm { e m p } } ( \mathcal { F } _ { \mathrm { l i n } , 1 } ) \leq A \operatorname* { m a x } _ { i } \| \mathbf { x } _ { i } \| _ { \infty } \sqrt { \frac { 2 \log ( 2 k ) } { n } } .
343
+ $$
344
+
345
+ Applying the above bound, we can bound the Rademacher complexity of $\mathcal { F } _ { \epsilon }$ as
346
+
347
+ $$
348
+ \mathcal { R } _ { n } ^ { \mathrm { e m p } } ( \mathcal { F } _ { \epsilon } ) \leq V \sqrt { \frac { 2 k \log ( 6 B / \epsilon ) } { n } } .
349
+ $$
350
+
351
+ Since for each $f \in { \mathcal { F } }$ there exists $\tilde { f } \in \mathcal { F } _ { \epsilon }$ such that $\forall \| \mathbf { x } \| _ { 2 } \leq C : | f ( \mathbf { x } ) - \tilde { f } ( \mathbf { x } ) | \leq 2 \pi \epsilon C V$ ,
352
+
353
+ $$
354
+ \begin{array} { r l } { { \mathcal { R } _ { n } ^ { \mathrm { e m p } } ( \mathcal { F } ) = \mathbb { E } _ { \sigma } \bigg [ \operatorname* { s u p } _ { f \in \mathcal { F } } \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \sigma _ { i } f ( \mathbf { x } _ { i } ) \bigg ] } \quad } & { } \\ & { \leq \mathbb { E } _ { \sigma } \bigg [ \operatorname* { s u p } _ { \tilde { f } \in \mathcal { F } _ { \epsilon } } \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \sigma _ { i } \tilde { f } ( \mathbf { x } _ { i } ) \bigg ] + 2 \pi \epsilon V \operatorname* { m a x } _ { i } \| \mathbf { x } _ { i } \| _ { 2 } } \\ & { = \mathcal { R } _ { n } ^ { \mathrm { e m p } } ( \mathcal { F } _ { \epsilon } ) + 2 \pi \epsilon V \operatorname* { m a x } _ { i } \| \mathbf { x } _ { i } \| _ { 2 } . } \end{array}
355
+ $$
356
+
357
+ Finally, combining (20) and (21) we obtain:
358
+
359
+ $$
360
+ \forall \epsilon > 0 : \quad \mathcal { R } _ { n } ^ { \mathrm { e m p } } ( \mathcal { F } ) \leq V \sqrt { \frac { 2 k \log ( 6 B / \epsilon ) } { n } } + 2 \pi \epsilon V \operatorname* { m a x } _ { i } \| \mathbf { x } _ { i } \| _ { 2 } .
361
+ $$
362
+
363
+ If we choose the value $\begin{array} { r } { \epsilon = \frac { 1 } { 2 \pi n \operatorname* { m a x } _ { i } \| \mathbf { x } _ { i } \| _ { 2 } } } \end{array}$ , then we get
364
+
365
+ $$
366
+ \begin{array} { r l } & { \mathcal { R } _ { n } ^ { \mathrm { e m p } } ( \mathcal { F } ) \leq V \bigg ( \sqrt { \frac { 2 k \log \left( 1 2 \pi n B \operatorname* { m a x } _ { i } \| \mathbf { x } _ { i } \| _ { 2 } \right) } { n } } + \frac { 1 } { n } \bigg ) } \\ & { \qquad \leq V \sqrt { \frac { 4 k \log \left( 1 2 \pi n B \operatorname* { m a x } _ { i } \| \mathbf { x } _ { i } \| _ { 2 } \right) + 2 / n } { n } } } \\ & { \qquad \leq V \sqrt { \frac { 4 k \log \left( 6 4 n B \operatorname* { m a x } _ { i } \| \mathbf { x } _ { i } \| _ { 2 } \right) } { n } } , } \end{array}
367
+ $$
368
+
369
+ where the last inequality follows from the fact that $1 \leq k , n$ . Therefore, the proof is complete.
370
+
371
+ # 8.2 PROOF OF COROLLARY 2
372
+
373
+ First, we prove the following lemma.
374
+
375
+ Lemma 2. Given function $f : \mathbb { R } ^ { k } \mathbb { R }$ and matrix $\mathbf { W } \in \mathbb { R } ^ { k \times k }$ , we define $g ( \mathbf { x } ) = f ( \mathbf { W } \mathbf { x } )$ . Then,
376
+
377
+ • $B ( g ) \leq \| \mathbf { W } \| _ { 2 } B ( f )$ with $\| \mathbf { W } \| _ { 2 }$ denoting the spectral norm of $\mathbf { W }$ , • $\| { \widehat { g } } \| _ { 1 } = \| { \widehat { f } } \| _ { 1 }$ .
378
+
379
+ Proof. From the properties of the Fourier transform we know
380
+
381
+ $$
382
+ \widehat { g } ( \pmb { \xi } ) = \frac { 1 } { | \operatorname* { d e t } ( \mathbf { W } ) | } \widehat { f } \big ( \mathbf { W } ^ { - T } \pmb { \xi } \big ) .
383
+ $$
384
+
385
+ Therefore, $\begin{array} { r } { \widehat { g } ( \mathbf { W } ^ { T } \pmb { \xi } ^ { \prime } ) = \frac { 1 } { | \operatorname* { d e t } ( \mathbf { W } ) | } \widehat { f } \big ( \pmb { \xi } ^ { \prime } \big ) } \end{array}$ and if $\| \pmb { \xi } ^ { \prime } \| _ { 2 } \le B ( f )$ , then $\| \mathbf { W } ^ { T } \pmb { \xi } ^ { \prime } \| _ { 2 } \le \| \mathbf { W } \| _ { 2 } B ( f )$ gives an upperbound on $B ( g )$ . Also,
386
+
387
+ $$
388
+ \begin{array} { r l } & { \| \hat { g } \| _ { 1 } = \int \big | \hat { g } ( \xi ) \big | \mathrm { d } \xi } \\ & { \quad = \int \frac { 1 } { \big | \operatorname* { d e t } ( \mathbf { W } ) \big | } \big | \widehat { f } ( \mathbf { W } ^ { - T } \xi ) \big ) \big | \mathrm { d } \xi } \\ & { \quad = \frac { 1 } { \big | \operatorname* { d e t } ( \mathbf { W } ) \big | } \int \big | \widehat { f } ( \mathbf { W } ^ { - T } \xi ) \big | \mathrm { d } \xi } \\ & { \quad = \frac { 1 } { \big | \operatorname* { d e t } ( \mathbf { W } ) \big | } \int \big | \widehat { f } ( \xi ^ { \prime } ) \big ) \big | \frac { 1 } { \big | \operatorname* { d e t } ( \mathbf { W } ^ { - T } \setminus j ) \big | } \mathrm { d } \xi ^ { \prime } } \\ & { \quad = \int \big | \widehat { f } ( \xi ^ { \prime } ) \big | \mathrm { d } \xi ^ { \prime } } \\ & { \quad = \| \widehat { f } \| _ { 1 } . } \end{array}
389
+ $$
390
+
391
+ It can be seen that this result remains valid even if $\mathbf { W }$ is not an invertible matrix, which will complete the proof for Corollary 2. However, we continue proving Corollary 2 without using this fact.
392
+
393
+ As shown in the above lemma, Fourier $\ell _ { 1 }$ -norm and bandwidth are invariant to an orthonormal transformation $\mathbf { W }$ . Given $f _ { i } ( \mathbf { x } ) = a _ { i } \phi ( \mathbf { w } _ { i } ^ { T } \mathbf { x } )$ , we define $g _ { i } ( { \bf x } ) = f _ { i } ( { \bf A } _ { i } { \bf x } )$ where $A _ { i }$ is an orthonormal matrix with ${ \bf w } _ { i }$ as an eigenvector. Note that $\lVert \widehat { f } _ { i } \rVert _ { 1 } = \lVert \widehat { g _ { i } } \rVert _ { 1 }$ and $B ( f _ { i } ) \ : = \ : B ( g _ { i } )$ . However, $g _ { i } ( \mathbf { x } )$ is a function of only bone of the coordinates, which we can assume, without loss of generality, to be the first coordinate. Hence, $g _ { i } ( \mathbf { x } ) = a _ { i } \phi ( \| \mathbf { w } _ { i } \| _ { 2 } x _ { 1 } )$ for the first coordinate $x _ { 1 }$ , implying $\begin{array} { r } { \widehat { g _ { i } } ( \pmb { \xi } ) = \frac { a _ { i } } { \| \mathbf { w } _ { i } \| _ { 2 } } \widehat { \phi } ( \frac { \xi _ { 1 } } { \| \mathbf { w } _ { i } \| _ { 2 } } ) . \delta _ { 2 } ( \xi _ { 2 } ) \ldots \delta _ { k } ( \xi _ { k } ) } \end{array}$ $\delta _ { j }$ is the Dirac delta function across the $j$ th dimension. Hence, we can use the above lemma in the 1-dimensional case to show $\| \widehat { g _ { i } } \| _ { 1 } = | a _ { i } | \| \widehat { \phi } \| _ { 1 }$ and $B ( g _ { i } ) = \| \mathbf { w } _ { i } \| _ { 2 } B ( \phi )$ . As a result,
394
+
395
+ $$
396
+ \| \widehat { f } _ { i } \| _ { 1 } = | a _ { i } | \| \widehat { \phi } \| _ { 1 } , \quad \mathcal { B } ( f _ { i } ) \leq \| \mathbf { w } _ { i } \| _ { 2 } \mathcal { B } ( \phi ) .
397
+ $$
398
+
399
+ Hence, for $\begin{array} { r } { f ( \mathbf { x } ) = \mathbf { a } ^ { T } \boldsymbol { \phi } ( \mathbf { W } \mathbf { x } + \mathbf { b } ) = \sum _ { i = 1 } ^ { d } a _ { i } \boldsymbol { \phi } ( \mathbf { w } _ { i } ^ { T } \mathbf { x } + b _ { i } ) } \end{array}$ we have
400
+
401
+ $$
402
+ \| \widehat { f } \| _ { 1 } \leq \| \mathbf { a } \| _ { 1 } \| \widehat { \phi } \| _ { 1 } , \quad \mathcal { B } ( f ) \leq \| \mathbf { W } \| _ { 2 , \infty } \mathcal { B } ( \phi ) .
403
+ $$
404
+
405
+ The corollary is then a direct application of Theorem 2.
406
+
407
+ # 8.3 PROOF OF THEOREM 3
408
+
409
+ Given a ReLU-type activation function $\phi _ { \alpha } ( z ) = \operatorname* { m a x } \{ z , \alpha z \}$ ,
410
+
411
+ $$
412
+ \phi _ { \alpha } \big ( \mathbf { w } ^ { T } \mathbf { x } \big ) = \| \mathbf { w } \| _ { q } \phi _ { \alpha } \big ( ( \frac { \mathbf { w } } { \| \mathbf { w } \| _ { q } } ) ^ { T } \mathbf { x } \big ) .
413
+ $$
414
+
415
+ Since ${ \left\| \frac { \mathbf { w } } { \left\| \mathbf { w } \right\| _ { q } } \right\| } _ { q } = 1$ , if $\| \mathbf { x } \| _ { p } \leq C$ , then ${ \Big | } { \big ( } { \frac { \mathbf { w } } { \| \mathbf { w } \| _ { q } } } { \big ) } ^ { T } \mathbf { x } { \Big | } \leq C$ and hence the input to $\phi _ { \alpha }$ in the R.H.S. of (28) is always between $- C$ and $C$ .
416
+
417
+ Suppose that function $\psi _ { \alpha }$ satisfies $\psi _ { \alpha } ( z ) = \phi _ { \alpha } ( z )$ for $z \in [ - C , C ]$ . Then, based on the above discussion, we can bound the Rademacher complexity of ${ \mathcal F } _ { \phi _ { \alpha } }$ by finding a bound on the Rademacher complexity of $\mathcal { F } _ { \psi _ { \alpha } } = \left\{ f _ { \mathbf { v } , \mathbf { U } } ( \mathbf { x } ) = \mathbf { v } ^ { T } \psi _ { \alpha } ( \mathbf { U } \mathbf { x } ) : ~ \| \mathbf { v } \| _ { 1 } \leq V , \forall i : ~ \| \mathbf { u } _ { i } \| _ { q } = 1 \right\}$ .
418
+
419
+ To find a good candidate for $\psi _ { \alpha }$ , we use a symmetrization trick to define
420
+
421
+ $$
422
+ \psi _ { \alpha } ( z ) = \left\{ \begin{array} { c l } { - \alpha C } & { \mathrm { i f } z < - C , } \\ { \phi _ { \alpha } ( z ) } & { \mathrm { i f } - C \le z < C , } \\ { \phi _ { \alpha } ( 2 C - z ) } & { \mathrm { i f } C \le z < 3 C , } \\ { - \alpha C } & { \mathrm { i f } 3 C \le z . } \end{array} \right.
423
+ $$
424
+
425
+ Note that $\begin{array} { r } { \psi _ { \alpha } ( z ) = ( 1 - \alpha ) C h ( \frac { z - C } { C } ) + 2 \alpha C h ( \frac { z - C } { 2 C } ) - \alpha C } \end{array}$ where $h ( z ) = \operatorname* { m a x } \{ 0 , 1 - | z | \} .$ . It can be seen that $\begin{array} { r } { { \widehat { h } } ( \xi ) = \big ( \frac { \sin ( \pi \xi ) } { \pi \xi } \big ) ^ { 2 } } \end{array}$ which is real and positive everywhere. Therefore, $\| \widehat { h } \| _ { 1 } = h ( 0 ) = 1$ which means that $\| \widehat { \psi _ { \alpha } } \| _ { 1 } \leq C ( 1 + 2 \alpha ) \leq 3 C .$ .
426
+
427
+ Since $\vert \widehat { h } ( \xi ) \vert \le \frac { 1 } { \xi ^ { 2 } }$ , we have $\widehat { | \psi _ { \alpha } ( \xi ) | } \le \frac { 1 } { \xi ^ { 2 } }$ . For $B > 0$ , we let the $B$ -filtered $\psi _ { \alpha , B }$ be a function with the following Fourier transform:
428
+
429
+ $$
430
+ \widehat { \psi _ { \alpha , B } } ( \xi ) = \left\{ \begin{array} { l l } { \widehat { \psi _ { \alpha } } ( \xi ) } & { \mathrm { i f ~ } | \xi | \leq B } \\ { 0 } & { \mathrm { o t h e r w i s e } . } \end{array} \right.
431
+ $$
432
+
433
+ Then, since $\bigl | \widehat { \psi _ { \alpha } } ( \xi ) \bigr | \le \frac { 1 } { \xi ^ { 2 } }$ we have
434
+
435
+ $$
436
+ \forall z \in \mathbb { R } : \quad \left| \psi _ { \alpha } ( z ) - \psi _ { \alpha , B } ( z ) \right| \leq \int _ { | \xi | \geq B } \left| \widehat { \psi _ { \alpha } } ( \xi ) \right| \mathrm { d } \xi \leq \frac { 2 } { B } .
437
+ $$
438
+
439
+ Thus, for any $B > 0$ the defined $\psi _ { \alpha , B }$ approximates $\phi _ { \alpha }$ with a maximum error of $\frac { 2 } { B }$ uniformly over $[ - C , C ]$ . $\psi _ { \alpha , B }$ also satisfies $\| \widehat { \psi _ { \alpha , B } } \| _ { 1 } \leq 3 C$ and $\begin{array} { r } { B ( \psi _ { \alpha , B } ) = B } \end{array}$ . Applying Corollary 2, we get
440
+
441
+ $$
442
+ \forall B > 0 : \quad \mathcal { R } _ { n } ^ { \mathrm { e m p } } \big ( \mathcal { F } _ { \phi _ { \alpha } } \big ) \leq O \Bigg ( V C \sqrt { \frac { k \log \left( n B \operatorname* { m a x } \| \mathbf { x } _ { i } \| _ { 2 } \right) } { n } } \Bigg ) + \frac { 2 } { B } .
443
+ $$
444
+
445
+ Here we can bound m $\begin{array} { r } { \mathrm { a x } _ { i } \| \mathbf { x } _ { i } \| _ { 2 } \leq \sqrt { k } \operatorname* { m a x } _ { i } \| \mathbf { x } _ { i } \| _ { \infty } \leq \sqrt { k } C } \end{array}$ , and choose $B = n$ to get
446
+
447
+ $$
448
+ \mathcal { R } _ { n } ^ { \mathrm { e m p } } \big ( \mathcal { F } _ { \phi _ { \alpha } } \big ) \leq O \bigg ( V C \sqrt { \frac { k \log \big ( n k C \big ) } { n } } + \frac { 1 } { n } \bigg ) ,
449
+ $$
450
+
451
+ which completes the proof.
452
+
453
+ # 8.4 PROOF OF LEMMA 1
454
+
455
+ Note that
456
+
457
+ $$
458
+ \begin{array} { r l } { \overset { \_ } { \nabla } _ { \mathbf { X } _ { 3 } } \left[ \ell \big ( f _ { \mathrm { a } , \mathbf { W } , \mathbf { b } } ( \mathbf { X } ) , Y ( \mathbf { X } ) \big ) \right] = \mathbb { E } _ { P _ { \mathbf { X } } } \left[ \nabla _ { a _ { j } } \ell \big ( f _ { \mathrm { a } , \mathbf { W } , \mathbf { b } } ( \mathbf { X } ) , Y ( \mathbf { X } ) \big ) \right] } & { } \\ & { = \mathbb { E } _ { P _ { \mathbf { X } } } \left[ \nabla _ { a _ { j } } \big ( f _ { \mathrm { a } , \mathbf { W } , \mathbf { b } } ( \mathbf { X } ) - Y ( \mathbf { X } ) \big ) ^ { 2 } \right] } \\ & { = \mathbb { E } _ { P _ { \mathbf { Y } } } \left[ 2 \sin ( 2 \pi \mathbf { w } _ { j } ^ { T } \mathbf { X } + b _ { j } ) \big ( \underset { t = 1 } { \overset { d } { \sum } } a _ { t } \sin ( 2 \pi \mathbf { w } _ { t } ^ { T } \mathbf { X } + b _ { t } ) - Y ( \mathbf { X } ) \big ) \right] } \\ & { = \mathbb { E } _ { P _ { \mathbf { X } } } \left[ 2 a _ { j } \sin ^ { 2 } ( 2 \pi \mathbf { w } _ { j } ^ { T } \mathbf { X } + b _ { j } ) \right] - \mathbb { E } _ { P _ { \mathbf { X } } } \left[ 2 \sin ( 2 \pi \mathbf { w } _ { j } ^ { T } \mathbf { X } + b _ { j } ) Y ( \mathbf { X } ) \right] } \\ & { \ + \mathbb { E } _ { P _ { \mathbf { X } } } \left[ \underset { t \neq j } { \sum } 2 a _ { t } \sin ( 2 \pi \mathbf { w } _ { t } ^ { T } \mathbf { X } + b _ { t } ) \sin ( 2 \pi \mathbf { w } _ { j } ^ { T } \mathbf { X } + b _ { j } ) \right] } \\ & { = a _ { j } - 2 \left[ \cos ( b _ { j } ) \ln \big \{ \hat { Y } * \widehat { P _ { \mathbf { X } } } ( \mathbf { w } _ { j } ) \big \} + \sin ( b _ { j } ) \mathrm { R e } \big \{ \hat { Y } * \widehat { P _ { \mathbf { X } } } ( \mathbf { w } _ { j } ) \big \} \right] . } \end{array}
459
+ $$
460
+
461
+ To show the last equality, we use the isolatedness assumption for $\mathbf { w } _ { j }$ , i.e. $\forall t \neq j : \operatorname* { m i n } \{ \| \mathbf { w } _ { t } - \mathbf { w } _ { j } \| _ { 2 } , \| \mathbf { w } _ { t } +$ $\mathbf { w } _ { j } \| _ { 2 } \big \} > B ( P \mathbf { x } )$ , and also $\| \mathbf { w } _ { j } \| _ { 2 } \geq B ( P \mathbf { x } ) / 2$ . Then, for each $t$
462
+
463
+ $$
464
+ \begin{array} { r l } { \mathbb { E } _ { P \mathbf x } \left[ 2 \sin ( 2 \pi \mathbf w _ { t } ^ { T } \mathbf X + b _ { t } ) \sin ( 2 \pi \mathbf w _ { j } ^ { T } \mathbf X + b _ { t } ) \right] = 2 \int P \mathbf x ( \mathbf x ) \sin ( 2 \pi \mathbf w _ { t } ^ { T } \mathbf x + b _ { t } ) \sin ( 2 \pi \mathbf w _ { j } ^ { T } \mathbf x + b _ { t } ) \mathrm { d } \mathbf x } & { } \\ { = } & { \int P \mathbf x ( \mathbf x ) \biggl [ \cos ( 2 \pi ( \mathbf w _ { t } - \mathbf w _ { s } ) ^ { T } \mathbf x + b _ { t } - b _ { s } ) } \\ & { \phantom { 2 } - \cos ( 2 \pi ( \mathbf w _ { t } + \mathbf w _ { s } ) ^ { T } \mathbf x + b _ { t } + b _ { s } ) \biggr ] \mathrm { d } \mathbf x } \\ { = } & { 0 . 5 \exp ( j ( b _ { t } - b _ { s } ) ) \widehat { P } \widetilde { \mathbf x } ( \mathbf w _ { 1 } - \mathbf w _ { s } ) } \\ { + 0 . 5 \exp ( j ( b _ { t } - b _ { t } ) ) \widehat { P } \widetilde { \mathbf x } ( \mathbf w _ { j } - \mathbf w _ { t } ) } \\ & { \phantom { 2 } - 0 . 5 \exp ( j ( b _ { t } + b _ { s } ) ) \widehat { P } \widetilde { \mathbf x } ( \mathbf w _ { 1 } + \mathbf w _ { s } ) } \\ { - 0 . 5 \exp ( j ( b _ { t } + b _ { s } ) ) \widehat { P } \widetilde { \mathbf x } ( \mathbf w _ { 1 } + \mathbf w _ { s } ) } \\ & { \phantom { 2 } - 0 . 5 \exp ( j ( b _ { t } + b _ { t } ) ) \widehat { P } \widetilde { \mathbf x } ( - \mathbf w _ { t } - \mathbf w _ { j } ) } \\ { = \left\{ \begin{array} { l l } { 0 } & { \mathrm { i f ~ } t < j _ { s } } \\ { 1 } & { \mathrm { i f ~ } t = j _ { s } } \end{array} \right. } \end{array}
465
+ $$
466
+
467
+ Also, by applying the convolution property of Fourier transform we can show
468
+
469
+ $$
470
+ \begin{array} { r l } { \mathbb { E } _ { P _ { \mathbf { X } } } \left[ \sin ( 2 \pi \mathbf { w } _ { j } ^ { T } \mathbf { X } + b _ { j } ) Y ( \mathbf { X } ) \right] = \displaystyle \int P _ { \mathbf { X } } ( \mathbf { x } ) Y ( \mathbf { x } ) \sin ( 2 \pi \mathbf { w } _ { j } ^ { T } \mathbf { x } + b _ { j } ) \mathrm { d } \mathbf { x } } & { } \\ { = \displaystyle \int ( P _ { \mathbf { X } } \times Y ) ( \mathbf { x } ) \left[ \cos ( b _ { j } ) \sin ( 2 \pi \mathbf { w } _ { j } ^ { T } \mathbf { X } ) + \sin ( b _ { j } ) \cos ( 2 \pi \mathbf { w } _ { j } ^ { T } \mathbf { X } ) \right] \mathrm { d } \mathbf { x } } & { } \\ { = \cos ( b _ { j } ) \mathrm { I m } \{ \widehat { Y } \star \widehat { P _ { \mathbf { X } } } ( \mathbf { w } _ { j } ) \} + \sin ( b _ { j } ) \mathrm { R e } \{ \widehat { Y } \star \widehat { P _ { \mathbf { X } } } ( \mathbf { w } _ { j } ) \} . } & { } \end{array}
471
+ $$
472
+
473
+ Finally if $( \mathbf { a } , \mathbf { W } , \mathbf { b } )$ is a local minimum for the population risk, for all $t$ ’s we have $\nabla _ { a _ { t } } \bar { \mathbb { E } } _ { P _ { \mathbf { X } } } \big [ \ell \big ( \dot { f } _ { \mathbf { a } , \mathbf { W } , \mathbf { b } } ( \mathbf { X } ) , Y ( \mathbf { X } ) \big ) \big ] \ = \ 0$ . Therefore, due to the isolatedness assumption of $\mathbf { w } _ { j }$ we have
474
+
475
+ $$
476
+ | a _ { j } | = 2 \left| \cos ( b _ { j } ) \operatorname { I m } \bigl \{ \widehat { Y } \star \widehat { P } _ { \mathbf { X } } ( { \mathbf { w } } _ { j } ) \bigr \} + \sin ( b _ { j } ) \operatorname { R e } \bigl \{ \widehat { Y } \star \widehat { P } _ { \mathbf { X } } ( { \mathbf { w } } _ { j } ) \bigr \} \right| \leq 2 \bigl | \widehat { Y } \star \widehat { P } _ { \mathbf { X } } ( { \mathbf { w } } _ { j } ) \bigr | .
477
+ $$
478
+
479
+ # 8.5 PROOF OF THEOREM 4
480
+
481
+ Since the isolatedness assumption holds for all $j$ ’s, by Lemma 1,
482
+
483
+ $$
484
+ \forall j : \quad | a _ { j } ^ { * } | \leq 2 \bigl | \widehat { Y } \star \widehat { P _ { \mathbf { X } } } ( \mathbf { w } _ { j } ^ { * } ) \bigr | .
485
+ $$
486
+
487
+ If $\| \mathbf { w } _ { t } ^ { * } \| _ { 2 } > B ( Y ) + B ( P _ { \mathbf { X } } )$ holds for some $t$ , (37) implies
488
+
489
+ $$
490
+ | a _ { t } ^ { * } | \leq 2 \bigl | \widehat { Y } \star \widehat { P _ { \mathbf { X } } } ( \mathbf { w } _ { t } ^ { * } ) \bigr | = 0 .
491
+ $$
492
+
493
+ Hence, $a _ { t } ^ { * }$ will be 0, implying there will be no component in $f _ { \mathbf { a } ^ { * } , \mathbf { W } ^ { * } , \mathbf { b } ^ { * } }$ with $\| \mathbf { w } _ { t } ^ { * } \| _ { 2 } > B ( Y ) + B ( P _ { \mathbf { X } } )$ . This discussion proves the first part of Theorem, i.e. $B ( f _ { \mathbf { a } ^ { * } } , \mathbf { W } ^ { * } , \mathbf { b } ^ { * } ) \leq B ( Y ) + B ( P _ { \mathbf { X } } )$ .
494
+
495
+ To show the second part, note that
496
+
497
+ $$
498
+ \begin{array} { r l } { \| A _ { \varepsilon } ^ { \varepsilon } ( s ) \| _ { \infty } ^ { 2 } } & { = | \alpha | ^ { 3 } \| _ { \infty } ^ { 3 } } \\ & { \stackrel { \mathrm { i . e . } } { = } 2 \displaystyle \sum _ { u = 1 } ^ { 3 } \int _ { u } ^ { 1 } \hat { \rho } _ { u } ^ { \varepsilon } ( s ) \| _ { \infty } ^ { 3 } } \\ & { = 2 \displaystyle \sum _ { u = 1 } ^ { 3 } \int _ { u } ^ { 1 } \hat { \rho } _ { u } ^ { \varepsilon } ( s ) \hat { \rho } _ { u } ^ { \varepsilon } ( u ) ^ { \varepsilon } ( s ) \| _ { \infty } ^ { 3 } } \\ & { \stackrel { \mathrm { i . e . } } { = } 2 \displaystyle \sum _ { u = 1 } ^ { 3 } \int _ { u } ^ { 1 } \hat { \rho } _ { u } ^ { \varepsilon } ( u ) ^ { \varepsilon } ( s ) \hat { \rho } _ { u } ^ { \varepsilon } ( u ) ^ { \varepsilon } ( s ) } \\ & { = 2 \displaystyle \sum _ { u = 1 } ^ { 3 } \int _ { u } ^ { 1 } \hat { \rho } _ { u } ^ { \varepsilon } ( u ) ^ { \varepsilon } ( s ) \| _ { \infty } ^ { 3 } } \\ & { = 2 \displaystyle \sum _ { u = 1 } ^ { 3 } \int _ { u } ^ { 1 } \hat { \rho } _ { u } ^ { \varepsilon } ( u ) ^ { \varepsilon } ( s ) \| _ { \infty } ^ { 3 } \mathrm { d } u \varepsilon } \\ & { = 2 \displaystyle \int _ { u } ^ { 1 } \hat { \rho } _ { u } ^ { \varepsilon } ( s ) \| _ { \infty } ^ { 3 } \mathrm { d } u \varepsilon } \\ & { \stackrel { \mathrm { i . e . } } { = } 2 \displaystyle \sum _ { u = 1 } ^ { 3 } \int _ { u } ^ { 1 } \hat { \rho } _ { u } ^ { \varepsilon } ( u ) ^ { \varepsilon } ( s ) \| _ { \infty } ^ { 4 } } \\ & { = 2 \displaystyle \sum _ { u = 1 } ^ { 3 } \int _ { u } ^ { 1 } \hat { \rho } _ { u } ^ { \varepsilon } ( u ) ^ { \varepsilon } ( s ) \| _ { \infty } ^ { 3 } } \\ & { = 2 \displaystyle \sum _ { u = 1 } ^ { 3 } \int _ { u } ^ { 1 } | \hat { \rho } _ { u } ^ { \varepsilon } ( u ) ^ { \varepsilon } ( s ) \| _ { \infty } ^ { 3 } } \\ & - 2 \displaystyle \int _ { u } ^ { 1 } \hat { \rho } _ { u } ^ \ \end{array}
499
+ $$
500
+
501
+ Here, (a) comes from Lemma 1. Also, since $\operatorname* { m i n } \Bigl \{ \| \mathbf { w } _ { t } ^ { * } - \mathbf { w } _ { r } ^ { * } \| _ { 2 } , \| \mathbf { w } _ { t } ^ { * } + \mathbf { w } _ { r } ^ { * } \| _ { 2 } \Bigr \} > 2 B ( P _ { \mathbf { X } } )$ is assumed for any $t \neq r$ , for any $\boldsymbol { \xi }$ at most one element in $\left[ \widehat { P _ { \mathbf { X } } } ( \mathbf { w } _ { t } ^ { * } - \pmb { \xi } ) \right] _ { t = 1 } ^ { d }$ can be nonzero. Because if both $\widehat { P _ { \mathbf { X } } } ( \mathbf { w } _ { t } ^ { * } - \pmb { \xi } )$ and $\widehat { P _ { \mathbf { X } } } ( \mathbf { w } _ { r } ^ { * } - \pmb { \xi } )$ are nonzero for $r \neq t$ , then $\| \mathbf { w } _ { t } ^ { * } - \pmb { \xi } \| \leq B ( P _ { \mathbf { X } } )$ and also $\| \mathbf { w } _ { r } ^ { * } - \pmb { \xi } \| \leq B ( P _ { \mathbf { X } } )$ which results in $\| \mathbf { w } _ { t } ^ { * } - \mathbf { w } _ { r } ^ { * } \| \leq 2 B ( P _ { \mathbf { X } } )$ which is a contradiction. Hence,
502
+
503
+ $$
504
+ \sum _ { t = 1 } ^ { d } \left| \widehat { P } \mathbf { x } ( \mathbf { w } _ { t } ^ { * } - \pmb { \xi } ) \right| \leq \operatorname* { m a x } _ { \pmb { \xi } ^ { \prime } } \left| \widehat { P } \mathbf { x } ( \pmb { \xi } ^ { \prime } ) \right| \leq \int \left| P \mathbf { x } ( \mathbf { x } ) \right| \mathrm { d } \mathbf { x } = 1 ,
505
+ $$
506
+
507
+ which proves (b) and completes the proof.
508
+
509
+ # 8.5.1 APPLYING THEOREM 4 TO MULTIVARIATE GAUSSIAN X
510
+
511
+ Assume $\mathbf { X } \sim { \mathcal { N } } ( \mu , \sigma ^ { 2 } \mathbf { I } _ { k \times k } )$ has a multivariate Gaussian distribution with mean $\pmb { \mu }$ and standard deviation $\sigma$ . Then, the Fourier transform $\hat { P } _ { \mathbf { X } }$ has a Gaussian shape with mean 0 and standard deviation $1 / \sigma$ . Hence, if for any $i , j$ we have $\operatorname* { m i n } \bigr \{ \| \mathbf { w } _ { i } ^ { * } - \mathbf { w } _ { j } ^ { * } \| _ { 2 } , \| \mathbf { w } _ { i } ^ { * } + \mathbf { w } _ { j } ^ { * } \| _ { 2 } \bigr \} \stackrel { } { > } 2 C / \sigma$ for some constant $C$ , the approximation error term which should be added to the upperbound in Equation (39) is $2 \| \widehat { Y } \| _ { 1 } d \exp ( - C ^ { 2 } / 2 )$ . Also, given any $\epsilon > 0$ the Fourier $\ell _ { 1 }$ norm outside the bandwidth $O ( \sqrt { k } \log ( 1 / \epsilon ) / \sigma )$ is at most $\epsilon$ . Therefore, Theorem 4 implies
512
+
513
+ $$
514
+ \begin{array} { r l } & { \bullet \mathcal { B } ( f _ { \mathbf { a } ^ { * } , \mathbf { W } ^ { * } , \mathbf { b } ^ { * } } ) \leq \mathcal { B } ( Y ) + O \big ( \sqrt { k } / \sigma \big ) , } \\ & { \bullet \| \widehat { f } _ { \mathbf { a } ^ { * } , \mathbf { W } ^ { * } , \mathbf { b } ^ { * } } \| _ { 1 } \leq 2 ( 1 + d \exp ( - C ^ { 2 } / 2 ) ) \| \widehat { Y } \| _ { 1 } . } \end{array}
515
+ $$
516
+
517
+ # 8.6 APPROXIMATE VERSION OF THEOREM 4
518
+
519
+ Here we show an approximate version of Theorem 4 which applies to approximate population local minima.
520
+
521
+ Theorem 5. Consider minimizing the population risk (11). Consider an approximate local minimum $( \mathbf { a } ^ { * } , \mathbf { W } ^ { * } , \mathbf { b } ^ { * } )$ where $| \nabla _ { a _ { j } } \mathbb { E } \big [ \ell \big ( f _ { { \mathbf a } ^ { * } , { \mathbf W } ^ { * } , { \mathbf b } ^ { * } } ( { \mathbf { \dot { X } } } ) , Y ( { \mathbf { X } } ) \big ) \big ) \big ] | \ \leq \ \epsilon$ for all $j$ ’s. If for any two different $i , j$ we
522
+
523
+ have $\operatorname* { m i n } \bigl \{ \| \mathbf { w } _ { i } ^ { * } - \mathbf { w } _ { j } ^ { * } \| _ { 2 } , \| \mathbf { w } _ { i } ^ { * } + \mathbf { w } _ { j } ^ { * } \| _ { 2 } \bigr \} > 2 B ( P _ { \mathbf { X } } )$ , then the Fourier $\ell _ { 1 }$ -norm of $f _ { \mathbf { a } ^ { * } , \mathbf { W } ^ { * } , \mathbf { b } ^ { * } }$ outside the bandwidth $\mathcal { B } ( Y ) + \mathcal { B } ( P _ { \mathbf { X } } )$ is bounded by $d \epsilon$ and
524
+
525
+ $$
526
+ \begin{array} { r } { \| \widehat { f } _ { \mathbf { a } ^ { * } , \mathbf { W } ^ { * } , \mathbf { b } ^ { * } } \| _ { 1 } \leq 2 \| \widehat { Y } \| _ { 1 } + d \epsilon . } \end{array}
527
+ $$
528
+
529
+ Proof. Since the isolated components condition holds, we can apply Lemma 1’s proof to show under the above assumptions
530
+
531
+ $$
532
+ \forall j : \quad | a _ { j } ^ { * } | \leq 2 \big | \hat { Y } \star \hat { P } _ { \mathbf { X } } ( \mathbf { w } _ { j } ^ { * } ) \big | + \epsilon .
533
+ $$
534
+
535
+ Then, a simple modification of Theorem 4’s proof according to the above inequality proves the above theorem. □
536
+
537
+ # 8.7 PROOF OF THEOREM 4 WITHOUT THE ISOLATED COMPONENTS ASSUMPTION
538
+
539
+ What happens if a component $\mathbf { w } _ { i }$ is not isolated from the other components which has been assumed in Theorem 4? As a simplifying assumption, we assume that $\mathbf b = \mathbf 0$ and $\widehat { P _ { \mathbf { X } } }$ is real. We can write
540
+
541
+ $$
542
+ \begin{array} { r l } { \displaystyle \forall i : \nabla _ { a _ { i } } \mathbb { E } _ { P _ { \mathbf { X } } } \left[ \ell \Big ( f _ { \mathbf { a } , \mathbf { w } } ( \mathbf { x } ) , Y ( \mathbf { x } ) \Big ) \right] = \sum _ { j = 1 } ^ { d } \left[ a _ { j } \widehat { P _ { \mathbf { X } } } ( \mathbf { w } _ { i } - \mathbf { w } _ { j } ) \right] - \operatorname { I m } \left\{ \widehat { Y } \star \widehat { P _ { \mathbf { X } } } ( \mathbf { w } _ { i } ) \right\} } & { } \\ { \displaystyle } & { \approx \sum _ { j = 1 } ^ { d } \left[ \left( a _ { j } - \int _ { \xi \in S _ { \mathbf { w } _ { j } } } \operatorname { I m } \{ \widehat { Y } ( \xi ) \} { \mathrm { d } } \xi \right) \widehat { P _ { \mathbf { X } } } ( \mathbf { w } _ { i } - \mathbf { w } _ { j } ) \right] } \end{array}
543
+ $$
544
+
545
+ Here $S _ { \mathbf { w } _ { i } }$ ’s, which are centered around $\mathbf { w } _ { j }$ ’s, are disjoint sets covering the bandwidth region for $\widehat { Y }$ , i.e. $\{ \pmb { \xi } : \| \pmb { \xi } \| _ { 2 } ^ { \prime } \leq B ( Y ) \} \subseteq \bigcup _ { j } S _ { \mathbf { w } _ { j } }$ . Note that in (41) we have approximated the convolution integral as
546
+
547
+ $$
548
+ \begin{array} { r l } { \widehat { Y } \star \widehat { P _ { \mathbf { X } } } ( \mathbf { w } _ { i } ) = \displaystyle \int _ { \pm : \| \xi \| _ { 2 } \leq B ( Y ) } \widehat { P _ { \mathbf { X } } } ( \mathbf { w } _ { i } - \pmb { \xi } ) \widehat { Y } ( \pmb { \xi } ) \mathrm { d } \xi } & { } \\ { = \displaystyle \sum _ { j = 1 } ^ { d } \displaystyle \int _ { \pmb { \xi } \in S _ { \mathbf { w } _ { j } } } \widehat { P _ { \mathbf { X } } } ( \mathbf { w } _ { i } - \pmb { \xi } ) \widehat { Y } ( \pmb { \xi } ) \mathrm { d } \xi } & { } \\ { \approx \displaystyle \sum _ { j = 1 } ^ { d } \widehat { P _ { \mathbf { X } } } ( \mathbf { w } _ { i } - \mathbf { w } _ { j } ) \displaystyle \int _ { \pmb { \xi } \in S _ { \mathbf { w } _ { j } } } \widehat { Y } ( \pmb { \xi } ) \mathrm { d } \xi . } \end{array}
549
+ $$
550
+
551
+ Letting the gradient element in (41) be zero for all $a _ { i }$ ’s at a local minimum $( \mathbf { a } ^ { * } , \mathbf { W } ^ { * } )$ of the population risk, the following approximation holds in general case:
552
+
553
+ $$
554
+ \forall j : a _ { j } ^ { * } \approx \int _ { \pmb { \xi } \in S _ { \mathbf { w } _ { j } } } \mathrm { I m } \{ \widehat { Y } ( \pmb { \xi } ) \} \mathrm { d } \pmb { \xi } ,
555
+ $$
556
+
557
+ Here, the matrix $\left[ \widehat { P _ { \mathbf { X } } } ( \mathbf { w } _ { i } - \mathbf { w } _ { j } ) \right] _ { 1 \leq i , j \leq d }$ is positive-definite and hence invertible, because $\widehat { P \mathbf { x } }$ is the Fourier transform of $P \mathbf { x }$ and due to Bochner’s theorem a positive-definite kernel function. Therefore, the system of linear equations -PcX(w∗i − w∗j ) -a∗j − Rξ∈Sw $\begin{array} { r } { \left[ \widehat { P _ { { \bf X } } } ( { \bf w } _ { i } ^ { * } - { \bf w } _ { j } ^ { * } ) \right] \left[ a _ { j } ^ { * } - \int _ { \pmb { \xi } \in S _ { { \bf w } _ { j } } } \mathrm { I m } \{ \widehat { Y } ( \pmb { \xi } ) \} \mathrm { d } \pmb { \xi } \right] \approx \mathbf { 0 } } \end{array}$ would imply (42). This discussion indicates that the result of Theorem 4 would remain valid even if the isolated components condition does not hold.
md/train/HJC2SzZCW/HJC2SzZCW.md ADDED
@@ -0,0 +1,533 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SENSITIVITY AND GENERALIZATION IN NEURAL NETWORKS: AN EMPIRICAL STUDY
2
+
3
+ Roman Novak, Yasaman Bahri∗, Daniel A. Abolafia, Jeffrey Pennington, Jascha Sohl-Dickstein
4
+
5
+ Google Brain
6
+
7
+ {romann, yasamanb, danabo, jpennin, jaschasd}@google.com
8
+
9
+ # ABSTRACT
10
+
11
+ In practice it is often found that large over-parameterized neural networks generalize better than their smaller counterparts, an observation that appears to conflict with classical notions of function complexity, which typically favor smaller models. In this work, we investigate this tension between complexity and generalization through an extensive empirical exploration of two natural metrics of complexity related to sensitivity to input perturbations. Our experiments survey thousands of models with various fully-connected architectures, optimizers, and other hyper-parameters, as well as four different image classification datasets.
12
+
13
+ We find that trained neural networks are more robust to input perturbations in the vicinity of the training data manifold, as measured by the norm of the input-output Jacobian of the network, and that it correlates well with generalization. We further establish that factors associated with poor generalization – such as full-batch training or using random labels – correspond to lower robustness, while factors associated with good generalization – such as data augmentation and ReLU non-linearities – give rise to more robust functions. Finally, we demonstrate how the input-output Jacobian norm can be predictive of generalization at the level of individual test points.
14
+
15
+ # 1 INTRODUCTION
16
+
17
+ The empirical success of deep learning has thus far eluded interpretation through existing lenses of computational complexity (Blum & Rivest, 1988), numerical optimization (Choromanska et al., 2015; Goodfellow & Vinyals, 2014; Dauphin et al., 2014) and classical statistical learning theory (Zhang et al., 2016): neural networks are highly non-convex models with extreme capacity that train fast and generalize well. In fact, not only do large networks demonstrate good test performance, but larger networks often generalize better, counter to what would be expected from classical measures, such as VC dimension. This phenomenon has been observed in targeted experiments (Neyshabur et al., 2015), historical trends of Deep Learning competitions (Canziani et al., 2016), and in the course of this work (Figure 1).
18
+
19
+ This observation is at odds with Occam’s razor, the principle of parsimony, as applied to the intuitive notion of function complexity (see A.2 for extended discussion). One resolution of the apparent contradiction is to examine complexity of functions in conjunction with the input domain. $f ( x ) =$ $x ^ { 3 } \sin ( x )$ may seem decisively more complex than $g ( x ) \ = \ x$ . But restrained to a narrow input domain of $[ - 0 . 0 1 , 0 . 0 1 ]$ they appear differently: $g$ remains a linear function of the input, while $f ( x ) = \mathcal { O } \left( x ^ { 4 } \right)$ resembles a constant 0. In this work we find that such intuition applies to neural networks, that behave very differently close to the data manifold than away from it (§4.1).
20
+
21
+ We therefore analyze the complexity of models through their capacity to distinguish different inputs in the neighborhood of datapoints, or, in other words, their sensitivity. We study two simple metrics presented in $\ S$ and find that one of them, the norm of the input-output Jacobian, correlates with generalization in a very wide variety of scenarios.
22
+
23
+ ![](images/70e4dcb8c0388fbbde3942926af0c8f10e7242245a9f4630754e1feb8e6f2486.jpg)
24
+ Figure 1: 2160 networks trained to $100 \%$ training accuracy on CIFAR10 (see $\ S$ for experimental details). Left: while increasing capacity of the model allows for overfitting (top), very few models do, and a model with the maximum parameter count yields the best generalization (bottom right). Right: train loss does not correlate well with generalization, and the best model (minimum along the $y$ -axis) has training loss many orders of magnitude higher than models that generalize worse (left). This observation rules out underfitting as the reason for poor generalization in low-capacity models. See (Neyshabur et al., 2015) for similar findings in the case of achievable 0 training loss.
25
+
26
+ This work considers sensitivity only in the context of image classification tasks. We interpret the observed correlation with generalization as an expression of a universal prior on (natural) image classification functions that favor robustness (see $\ S \mathrm { A } . 2$ for details). While we expect a similar prior to exist in many other perceptual settings, care should be taken when extrapolating our findings to tasks where such a prior may not be justified (e.g. weather forecasting).
27
+
28
+ # 1.1 PAPER OUTLINE
29
+
30
+ We first define sensitivity metrics for fully-connected neural networks in §3. We then relate them to generalization through a sequence of experiments of increasing level of nuance:
31
+
32
+ • In §4.1 we begin by comparing the sensitivity of trained neural networks on and off the training data manifold, i.e. in the regions of best and typical (over the whole input space) generalization.
33
+ • In §4.2 we compare sensitivity of identical trained networks that differ in a single hyperparameter which is important for generalization. Further, $\ S$ associates sensitivity and generalization in an unrestricted manner, i.e. comparing networks of a wide variety of hyper-parameters such as width, depth, non-linearity, weight initialization, optimizer, learning rate and batch size.
34
+ • Finally, $\ S$ explores how predictive sensitivity (as measured by the Jacobian norm) is for individual test points.
35
+
36
+ # 1.2 SUMMARY OF CONTRIBUTIONS
37
+
38
+ The novelty of this work can be summarized as follows:
39
+
40
+ • Study of the behavior of trained neural networks on and off the data manifold through sensitivity metrics (§4.1). • Evaluation of sensitivity metrics on trained neural networks in a very large-scale experimental setting and finding that they correlate with generalization (§4.2, §4.3, §4.4).
41
+
42
+ §2 puts our work in context of related research studying complexity, generalization, or sensitivity metrics similar to ours.
43
+
44
+ # 2 RELATED WORK
45
+
46
+ # 2.1 COMPLEXITY METRICS
47
+
48
+ We analyze complexity of fully-connected neural networks for the purpose of model comparison through the following sensitivity measures (see §3 for details):
49
+
50
+ • estimating the number of linear regions a network splits the input space into;
51
+ • measuring the norm of the input-output Jacobian within such regions.
52
+
53
+ A few prior works have examined measures related to the ones we consider. In particular, Pascanu et al. (2013); Montufar et al. ´ (2014); Raghu et al. (2016) have investigated the expressive power of fully-connected neural networks built out of piecewise-linear activation functions. Such functions are themselves piecewise-linear over their input domain, so that the number of linear regions into which input space is divided is one measure of how nonlinear the function is. A function with many linear regions has the capacity to build complex, flexible decision boundaries. It was argued in (Pascanu et al., 2013; Montufar et al. ´ , 2014) that an upper bound to the number of linear regions scales exponentially with depth but polynomially in width, and a specific construction was examined. Raghu et al. (2016) derived a tight analytic bound and considered the number of linear regions for generic networks with random weights, as would be appropriate, for instance, at initialization. However, the evolution of this measure after training has not been investigated before. We examine a related measure, the number of hidden unit transitions along one-dimensional trajectories in input space, for trained networks. Further motivation for this measure is discussed in §3.
54
+
55
+ Another perspective on function complexity can be gained by studying their robustness to perturbations to the input. Indeed, Rasmussen & Ghahramani (2000) demonstrate on a toy problem how complexity as measured by the number of parameters may be of limited utility for model selection, while measuring the output variation allows the invocation of Occam’s razor. In this work we apply related ideas to a large-scale practical context of neural networks with up to a billion free parameters ( 4.2, 4.3) and discuss potential ways in which sensitivity permits the application of Occam’s razor to neural networks (§A.2).
56
+
57
+ Sokolic et al. (2017) provide theoretical support for the relevance of robustness, as measured by the input-output Jacobian, to generalization. They derive bounds for the generalization gap in terms of the Jacobian norm within the framework of algorithmic robustness (Xu & Mannor, 2012). Our results provide empirical support for their conclusions through an extensive number of experiments. Several other recent papers have also focused on deriving tight generalization bounds for neural networks (Bartlett et al., 2017; Dziugaite & Roy, 2017; Neyshabur et al., 2018). We do not propose theoretical bounds in this paper but establish a correlation between our metrics and generalization in a substantially larger experimental setting than undertaken in prior works.
58
+
59
+ # 2.2 REGULARIZATION
60
+
61
+ In the context of regularization, increasing robustness to perturbations is a widely-used strategy: data augmentation, noise injection (Jiang et al., 2009), weight decay (Krogh & Hertz, 1992), and max-pooling all indirectly reduce sensitivity of the model to perturbations, while Rifai et al. (2011); Sokolic et al. (2017) explicitly penalize the Frobenius norm of the Jacobian in the training objective.
62
+
63
+ In this work we relate several of the above mentioned regularizing techniques to sensitivity, demonstrating through extensive experiments that improved generalization is consistently coupled with better robustness as measured by a single metric, the input-output Jacobian norm (§4.2). While some of these findings confirm common-sense expectations (random labels increase sensitivity, Figure 4, top row), others challenge our intuition of what makes a neural network robust (ReLU-networks, with unbounded activations, tend to be more robust than saturating HardSigmoid-networks, Figure 4, third row).
64
+
65
+ # 2.3 INDUCTIVE BIAS OF SGD
66
+
67
+ One of our findings demonstrates an inductive bias towards robustness in stochastic mini-batch optimization compared to full-batch training (Figure 4, bottom row). Interpreting this regularizing effect in terms of some measure of sensitivity, such as curvature, is not new (Hochreiter & Schmidhuber, 1997; Keskar et al., 2016), yet we provide a novel perspective by relating it to reduced sensitivity to inputs instead of parameters.
68
+
69
+ The inductive bias of SGD (“implicit regularization”) has been previously studied in (Neyshabur et al., 2015), where it was shown through rigorous experiments how increasing the width of a singlehidden-layer network improves generalization, and an analogy with matrix factorization was drawn to motivate constraining the norm of the weights instead of their count. Neyshabur et al. (2017) further explored several weight-norm based measures of complexity that do not scale with the size of the model. One of our measures, the Frobenius norm of the Jacobian is of similar nature (since the Jacobian matrix size is determined by the task and not by a particular network architecture). However, this particular metric was not considered, and, to the best of our knowledge, we are the first to evaluate it in a large-scale setting (e.g. our networks are up to 65 layers deep and up to $2 ^ { 1 6 }$ units wide).
70
+
71
+ # 2.4 ADVERSARIAL EXAMPLES
72
+
73
+ Sensitivity to inputs has attracted a lot of interest in the context of adversarial examples (Szegedy et al., 2013). Several attacks locate points of poor generalization in the directions of high sensitivity of the network (Goodfellow et al., 2014; Papernot et al., 2016; Moosavi-Dezfooli et al., 2016), while certain defences regularize the model by penalizing sensitivity (Gu & Rigazio, 2014) or employing decaying (hence more robust) non-linearities (Kurakin et al., 2016). However, work on adversarial examples relates highly specific perturbations to a similarly specific kind of generalization (i.e. performance on a very small, adversarial subset of the data manifold), while this paper analyzes average-case sensitivity (§3) and typical generalization.
74
+
75
+ # 3 SENSITIVITY METRICS
76
+
77
+ We propose two simple measures of sensitivity for a fully-connected neural network (without biases) $\mathbf { f } : \bar { \mathbb { R } } ^ { d } \overset { \cdot } { } \mathbb { R } ^ { n }$ with respect to its input $\mathbf { x } \in \mathbb { R } ^ { d }$ (the output being unnormalized logits of the $n$ classes). Assume f employs a piecewise-linear activation function, like ReLU. Then f itself, as a composition of linear and piecewise-linear functions, is a piecewise-linear map, splitting the input space $\mathbf { \mathbb { R } } ^ { d }$ into disjoint regions, implementing a single affine mapping on each. Then we can measure two aspects of sensitivity by answering
78
+
79
+ 1. How does the output of the network change as the input is perturbed within the linear region?
80
+
81
+ 2. How likely is the linear region to change in response to change in the input?
82
+
83
+ We quantify these qualities as follows:
84
+
85
+ 1. For a local sensitivity measure we adopt the Frobenius norm of the class probabilities Jacobian $\mathbf { J } ( \mathbf { x } ) = \partial \mathbf { f } _ { \sigma } \left( \mathbf { x } \right) / \partial \mathbf { x } ^ { \mathbf { T } }$ (with $\bar { J _ { i j } } ( \mathbf { x } ) = \partial \left[ \mathbf { f } _ { \sigma } \left( \mathbf { x } \right) \right] _ { i } / \partial x _ { j } )$ , where $\mathbf { f } _ { \sigma } = \sigma \circ \mathbf { f }$ with $\pmb { \sigma }$ being the softmax function1. Given points of interest $\mathbf { x } _ { \mathrm { t e s t } }$ , we estimate the sensitivity of the function in those regions with the average Jacobian norm:
86
+
87
+ $$
88
+ \mathbb { E } _ { \mathbf { x } _ { \mathrm { t e s t } } } \left[ \left. \mathbf { J } \left( \mathbf { x } _ { \mathrm { t e s t } } \right) \right. _ { F } \right] ,
89
+ $$
90
+
91
+ that we will further refer to as simply “Jacobian norm”. Note that this does not require the labels for $\mathbf { x } _ { \mathrm { t e s t } }$ .
92
+
93
+ Interpretation. The Frobenius norm $\begin{array} { r } { \| \mathbf { J } ( \mathbf { x } ) \| _ { F } = \sqrt { \sum _ { i j } J _ { i j } ( \mathbf { x } ) ^ { 2 } } } \end{array}$ estimates the averagecase sensitivity of $\mathbf { f } _ { \sigma }$ around $\mathbf { x }$ . Indeed, consider an infinitesimal Gaussian perturbation
94
+
95
+ $\Delta \mathbf { x } \sim \mathcal { N } \left( \mathbf { 0 } , \epsilon \mathbf { I } \right)$ : the expected magnitude of the output change is then
96
+
97
+ $$
98
+ \begin{array} { l } { \displaystyle \mathbb { E } _ { \Delta \mathbf { x } } \left[ \big \| \mathbf { f } _ { \sigma } \left( \mathbf { x } \right) - \mathbf { f } _ { \sigma } \left( \mathbf { x } + \Delta \mathbf { x } \right) \big \| _ { 2 } ^ { 2 } \right] \approx \mathbb { E } _ { \Delta \mathbf { x } } \left[ \big \| \mathbf { J } ( \mathbf { x } ) \Delta \mathbf { x } \big \| _ { 2 } ^ { 2 } \right] = \mathbb { E } _ { \Delta \mathbf { x } } \bigg [ \displaystyle \sum _ { i } \left( \displaystyle \sum _ { j } J _ { i j } x _ { j } \right) ^ { 2 } \bigg ] } \\ { = \displaystyle \sum _ { i j j ^ { \prime } } J _ { i j ^ { \prime } } \mathbb { E } _ { \Delta \mathbf { x } } \left[ x _ { j } x _ { j ^ { \prime } } \right] = \displaystyle \sum _ { i j } J _ { i j } ^ { 2 } \mathbb { E } _ { \Delta \mathbf { x } } \left[ x _ { j } ^ { 2 } \right] } \\ { = \epsilon \left\| \mathbf { J } \left( \mathbf { x } \right) \right\| _ { F } ^ { 2 } . } \end{array}
99
+ $$
100
+
101
+ 2. To detect a change in linear region (further called a “transition”), we need to be able to identify it. We do this analogously to Raghu et al. (2016). For a network with piecewiselinear activations, we can, given an input $\mathbf { x }$ , assign a code to each neuron in the network f, that identifies the linear region of the pre-activation of that neuron. E.g. each ReLU unit will have 0 or 1 assigned to it if the pre-activation value is less or greater than 0 respectively. Similarly, a ReLU6 unit (see definition in A.4) will have a code of 0, 1, or 2 assigned, since it has 3 linear regions2. Then, a concatenation of codes of all neurons in the network (denoted by $\mathbf { c } ( \mathbf { x } ) \dot { }$ ) uniquely identifies the linear region of the input $\mathbf { x }$ (see A.1.1 for discussion of edge cases).
102
+
103
+ Given this encoding scheme, we can detect a transition by detecting a change in the code. We then sample $k$ equidistant points $\mathbf { z } _ { 0 } , \ldots , \mathbf { z } _ { k - 1 }$ on a closed one-dimensional trajectory $\tau ( \mathbf { x } )$ (generated from a data point $\mathbf { x }$ and lying close to the data manifold; see below for details) and count transitions $t ( \mathbf { x } )$ along it to quantify the number of linear regions:
104
+
105
+ $$
106
+ t ( \mathbf { x } ) : = \sum _ { i = 0 } ^ { k - 1 } \left\| \mathbf { c } \left( \mathbf { z } _ { i } \right) - \mathbf { c } \left( \mathbf { z } _ { ( i + 1 ) } \% \right) \right\| _ { 1 } \approx \oint _ { \mathbf { z } \in \mathcal { T } ( \mathbf { x } ) } \left\| \frac { \partial \mathbf { c } ( \mathbf { z } ) } { \partial \left( d \mathbf { z } \right) } \right\| _ { 1 } d \mathbf { z } ,
107
+ $$
108
+
109
+ where the norm of the directional derivative $\| \partial \mathbf { c ( z ) } / \partial \left( d \mathbf { z } \right) \| _ { 1 }$ amounts to a Dirac delta function at each transition (see A.1.2 for further details).
110
+
111
+ By sampling multiple such trajectories around different points, we estimate the sensitivity metric:
112
+
113
+ $$
114
+ \mathbb { E } _ { \mathbf { x } _ { \mathrm { t e s t } } } \left[ t \left( \mathbf { x } _ { \mathrm { t e s t } } \right) \right] ,
115
+ $$
116
+
117
+ that we will further refer to as simply “transitions” or “number of transitions.”
118
+
119
+ To assure the sampling trajectory $\tau ( \mathbf { x } _ { \mathrm { t e s t } } )$ is close to the data manifold (since this is the region of interest), we construct it through horizontal translations of the image $\mathbf { x } _ { \mathrm { t e s t } }$ in pixel space (Figure App.7, right). We similarly augment our training data with horizontal and vertical translations in the corresponding experiments (Figure 4, second row).
120
+
121
+ As earlier, this metric does not require knowing the label of $\mathbf { x } _ { \mathrm { t e s t } }$
122
+
123
+ Interpretation. We can draw a qualitative parallel between the number of transitions and curvature of the function. One measure of curvature of a function $\mathbf { f }$ is the total norm of the directional derivative of its first derivative $\mathbf { f ^ { \prime } }$ along a path:
124
+
125
+ $$
126
+ C \left( \mathbf { f } , \mathcal { T } \left( \mathbf { x } \right) \right) : = \oint _ { \mathbf { z } \in \mathcal { T } \left( \mathbf { x } \right) } \left. \frac { \partial \mathbf { f } ^ { \prime } \left( \mathbf { z } \right) } { \partial \left( d \mathbf { z } \right) } \right. _ { F } d \mathbf { z } .
127
+ $$
128
+
129
+ A piecewise-linear function $\mathbf { f }$ has a constant first derivative $\mathbf { f ^ { \prime } }$ everywhere except for the transition boundaries. Therefore, for a sufficiently large $k$ , curvature can be expressed as
130
+
131
+ $$
132
+ C \left( \mathbf { f } , \mathcal { T } \left( { \mathbf { x } } \right) \right) = \frac { 1 } { 2 } \sum _ { i = 0 } ^ { k - 1 } \left\| \mathbf { f } ^ { \prime } \left( \mathbf { z } _ { i } \right) - \mathbf { f } ^ { \prime } \left( \mathbf { z } _ { \left( i + 1 \right) \mathcal { V } _ { 0 } k } \right) \right\| _ { F } ,
133
+ $$
134
+
135
+ where $\mathbf { z } _ { 0 } , \ldots , \mathbf { z } _ { k - 1 }$ are equidistant samples on $\tau ( \mathbf { x } )$ . This sum is similar to $t ( \mathbf { x } )$ as defined in Equation 1, but quantifies the amount of change in between two linear regions in a nonbinary way. However, estimating it on a densely sampled trajectory is a computationallyintensive task, which is one reason we instead count transitions.
136
+
137
+ As such, on a qualitative level, the two metrics (Jacobian norm and number of transitions) track the first and second order terms of the Taylor expansion of the function.
138
+
139
+ Above we have defined two sensitivity metrics to describe the learned function around the data, on average. In $\ S 4 . 1$ we analyze these measures on and off the data manifold by simply measuring them along circular trajectories in input space that intersect the data manifold at certain points, but generally lie away from it (Figure 2, left).
140
+
141
+ # 4 EXPERIMENTAL RESULTS
142
+
143
+ In the following subsections $( \ S 4 . 2 , \ S 4 . 3 )$ each study analyzes performance of a large number (usually thousands) of fully-connected neural networks having different hyper-parameters and optimization procedures. Except where specified, we include only models which achieve $1 0 0 \%$ training accuracy. This allows us to study generalization disentangled from properties like expressivity and trainability, which are outside the scope of this work.
144
+
145
+ In order to efficiently evaluate the compute-intensive metrics (§3) in a very wide range of hyperparameters settings (see e.g. §A.5.5) we only consider fully-connected networks. Extending the investigation to more complex architectures is left for future work.
146
+
147
+ # 4.1 SENSITIVITY ON AND OFF THE TRAINING DATA MANIFOLD
148
+
149
+ We analyze the behavior of a trained neural network near and away from training data. We do this by comparing sensitivity of the function along 3 types of trajectories:
150
+
151
+ 1. A random ellipse. This trajectory is extremely unlikely to pass anywhere near the real data, and indicates how the function behaves in random locations of the input space that it never encountered during training.
152
+ 2. An ellipse passing through three training points of different class (Figure 2, left). This trajectory does pass through the three data points, but in between it traverses images that are linear combinations of different-class images, and are expected to lie outside of the natural image space. Sensitivity of the function along this trajectory allows comparison of its behavior on and off the data manifold, as it approaches and moves away from the three anchor points.
153
+ 3. An ellipse through three training points of the same class. This trajectory is similar to the previous one, but, given the dataset used in the experiment (MNIST), is expected to traverse overall closer to the data manifold, since linear combinations of the same digit are more likely to resemble a realistic image. Comparing transition density along this trajectory to the one through points of different classes allows further assessment of how sensitivity changes in response to approaching the data manifold.
154
+
155
+ We find that, according to both the Jacobian norm and transitions metrics, functions exhibit much more robust behavior around the training data (Figure 2, center and right). We further visualize this effect in 2D in Figure 3, where we plot the transition boundaries of the last (pre-logit) layer of a neural network before and after training. After training we observe that training points lie in regions of low transition density.
156
+
157
+ The observed contrast between the neural network behavior near and away from data further strengthens the empirical connection we draw between sensitivity and generalization in 4.2, $\ S$ and $\ S 4 . 4$ ; it also confirms that, as mentioned in $\ S$ , if a certain quality of a function is to be used for model comparison, input domain should always be accounted for.
158
+
159
+ # 4.2 SENSITIVITY AND GENERALIZATION FACTORS
160
+
161
+ In §4.1 we established that neural networks implement more robust functions in the vicinity of the training data manifold than away from it.
162
+
163
+ We now consider the more practical context of model selection. Given two perfectly trained neural networks, does the model with better generalization implement a less sensitive function?
164
+
165
+ ![](images/666edda8ac9d9eaf5f6fdc66680a7967be41df151d5abab635405f764d8a91b0.jpg)
166
+ Figure 2: A $100 \%$ -accurate (on training data) MNIST network implements a function that is much more stable near training data than away from it. Left: depiction of a hypothetical circular trajectory in input space passing through three digits of different classes, highlighting the training point locations $( \pi / 3 , \pi , 5 \pi / 3 )$ . Center: Jacobian norm as the input traverses an elliptical trajectory. Sensitivity drops significantly in the vicinity of training data while remaining uniform along random ellipses. Right: transition density behaves analogously. According to both metrics, as the input moves between points of different classes, the function becomes less stable than when it moves between points of the same class. This is consistent with the intuition that linear combinations of different digits lie further from the data manifold than those of same-class digits (which need not hold for more complex datasets). See §A.5.2 for experimental details.
167
+
168
+ ![](images/26dc8232e5455fc3cbb5efbca372d66b95f65de0585c5ca9cc90eb6957706b9c.jpg)
169
+ Figure 3: Transition boundaries of the last (pre-logits) layer over a 2-dimensional slice through the input space defined by 3 training points (indicated by inset squares). Left: boundaries before training. Right: after training, transition boundaries become highly non-isotropic, with training points lying in regions of lower transition density. See §A.5.3 for experimental details.
170
+
171
+ We study approaches in the machine learning community that are commonly believed to influence generalization (Figure 4, top to bottom):
172
+
173
+ random labels;
174
+ • data augmentation;
175
+ • ReLUs;
176
+ • full-batch training.
177
+
178
+ We find that in each case, the change in generalization is coupled with the respective change in sensitivity (i.e. lower sensitivity corresponds to smaller generalization gap) as measured by the Jacobian norm (and almost always for the transitions metric).
179
+
180
+ ![](images/0bc5498be3d19fbcc6011eabf8d2030c7f31633b9b2f22923c2c452f4aa39526.jpg)
181
+ Figure 4: Improvement in generalization (left column) due to using correct labels, data augmentation, ReLUs, mini-batch optimization (top to bottom) is consistently coupled with reduced sensitivity as measured by the Jacobian norm (center column). Transitions (right column) correlate with generalization in all considered scenarios except for comparing optimizers (bottom right). Each point on the plot corresponds to two neural networks that share all hyper-parameters and the same optimization procedure, but differ in a certain property as indicated by axes titles. The coordinates along each axis reflect the values of the quantity in the title of the plot in the respective setting (i.e. with true or random labels). All networks have reached $1 0 0 \%$ training accuracy on CIFAR10 in both settings (except for the data-augmentation study, second row; see $\ S$ for details). See §A.5.5 for experimental details (§A.5.4 for the data-augmentation study) and §4.2.1 for plot interpretation.
182
+
183
+ # 4.2.1 HOW TO READ PLOTS
184
+
185
+ In Figure 4, for many possible hyper-parameter configurations, we train two models that share all parameters and optimization procedure, but differ in a single binary setting (i.e. trained on true or random labels; with or without data augmentation; etc). Out of all such network pairs, we select only those where each network reached $100 \%$ training accuracy on the whole training set (apart from the data augmentation study). The two generalization or sensitivity values are then used as the $x$ and $y$ coordinates of a point corresponding to this pair of networks (with the plot axes labels denoting the respective value of the binary parameter considered). The position of the point with respect to the diagonal $y = x$ visually demonstrates which configuration has smaller generalization gap / lower sensitivity.
186
+
187
+ # 4.3 SENSITIVITY AND GENERALIZATION GAP
188
+
189
+ We now perform a large-scale experiment to establish direct relationships between sensitivity and generalization in a realistic setting. In contrast to $\ S 4 . 1$ , where we selected locations in the input space, and $\ S 4 . 2$ , where we varied a single binary parameter impacting generalization, we now sweep simultaneously over many different architectural and optimization choices (§A.5.5).
190
+
191
+ Our main result is presented in Figure 5, indicating a strong relationship between the Jacobian norm and generalization. In contrast, Figure App.8 demonstrates that the number of transitions is not alone sufficient to compare networks of different sizes, as the number of neurons in the networks has a strong influence on transition count.
192
+
193
+ ![](images/26166cb15d9564aa43e341cc1c2adec5770289cc4323ba4a4686e1bf2299d8f6.jpg)
194
+ Figure 5: Jacobian norm correlates with generalization gap on all considered datasets. Each point corresponds to a network trained to $100 \%$ training accuracy (or at least $9 9 . 9 \%$ in the case of CIFAR100). See §A.5.4 and §A.5.5 for experimental details of bottom and top plots respectively.
195
+
196
+ # 4.4 SENSITIVITY AND PER-POINT GENERALIZATION
197
+
198
+ In §4.3 we established a correlation between sensitivity (as measured by the Jacobian norm) and generalization averaged over a large test set $1 0 ^ { 4 }$ points). We now investigate whether the Jacobian norm can be predictive of generalization at individual points.
199
+
200
+ As demonstrated in Figure 6 (top), Jacobian norm at a point is predictive of the cross-entropy loss, but the relationship is not a linear one, and not even bijective (see $\ S$ for analytic expressions explaining it). In particular, certain misclassified points (right sides of the plots) have a Jacobian norm many orders of magnitude smaller than that of the correctly classified points (left sides). However, we do remark a consistent tendency for points having the highest values of the Jacobian norm to be mostly misclassified. A similar yet noisier trend is observed in networks trained using $\ell _ { 2 }$ -loss as depicted in Figure 6 (bottom). These observations make the Jacobian norm a promising quantity to consider in the contexts of active learning and confidence estimation in future research.
201
+
202
+ ![](images/c9925fc3388e008626ec6a041d41f0857febf74c821ea40576c4b1e1fc8a20b5.jpg)
203
+ Figure 6: Jacobian norm plotted against individual test point loss. Each plot shows 5 random networks that fit the respective training set with $1 0 0 \%$ accuracy, with each network having a unique color. Top: Jacobian norm plotted against cross-entropy loss. These plots experimentally confirm the relationship established in $\ S$ and Figure App.11. Bottom: Jacobian norm plotted against $\ell _ { 2 }$ -loss, for networks trained on $\ell _ { 2 }$ -loss, exhibits a similar behavior. See $\ S$ for experimental details and Figure App.9 for similar observations on other datasets.
204
+
205
+ # 5 CONCLUSION
206
+
207
+ We have investigated sensitivity of trained neural networks through the input-output Jacobian norm and linear regions counting in the context of image classification tasks. We have presented extensive experimental evidence indicating that the local geometry of the trained function as captured by the input-output Jacobian can be predictive of generalization in many different contexts, and that it varies drastically depending on how close to the training data manifold the function is evaluated. We further established a connection between the cross-entropy loss and the Jacobian norm, indicating that it can remain informative of generalization even at the level of individual test points. Interesting directions for future work include extending our investigation to more complex architectures and other machine learning tasks.
208
+
209
+ # REFERENCES
210
+
211
+ Mart´ın Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, Zhifeng Chen, Craig Citro, Greg S Corrado, Andy Davis, Jeffrey Dean, Matthieu Devin, et al. Tensorflow: Large-scale machine learning on heterogeneous distributed systems. arXiv preprint arXiv:1603.04467, 2016.
212
+
213
+ Peter L Bartlett, Dylan J Foster, and Matus J Telgarsky. Spectrally-normalized margin bounds for neural networks. In Advances in Neural Information Processing Systems, pp. 6241–6250, 2017.
214
+
215
+ Avrim Blum and Ronald L. Rivest. Training a 3-node neural network is np-complete. In Machine Learning: From Theory to Applications, 1988.
216
+
217
+ Alfredo Canziani, Adam Paszke, and Eugenio Culurciello. An analysis of deep neural network models for practical applications. CoRR, abs/1605.07678, 2016.
218
+
219
+ Anna Choromanska, Mikael Henaff, Michael Mathieu, Gerard Ben Arous, and Yann LeCun. The ´ loss surfaces of multilayer networks. In Artificial Intelligence and Statistics, pp. 192–204, 2015.
220
+
221
+ Yann Dauphin, Razvan Pascanu, aglar Gulehre, Kyunghyun Cho, Surya Ganguli, and Yoshua Ben- ¨ gio. Identifying and attacking the saddle point problem in high-dimensional non-convex optimization. In NIPS, 2014.
222
+
223
+ Gintare Karolina Dziugaite and Daniel M Roy. Computing nonvacuous generalization bounds for deep (stochastic) neural networks with many more parameters than training data. arXiv preprint arXiv:1703.11008, 2017.
224
+
225
+ Daniel Golovin, Benjamin Solnik, Subhodeep Moitra, Greg Kochanski, John Karro, and D Sculley. Google vizier: A service for black-box optimization. In Proceedings of the 23rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pp. 1487–1495. ACM, 2017.
226
+
227
+ Ian J. Goodfellow and Oriol Vinyals. Qualitatively characterizing neural network optimization problems. CoRR, abs/1412.6544, 2014.
228
+
229
+ Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572, 2014.
230
+
231
+ Shixiang Gu and Luca Rigazio. Towards deep neural network architectures robust to adversarial examples. arXiv preprint arXiv:1412.5068, 2014.
232
+
233
+ Caglar Gulcehre, Marcin Moczulski, Misha Denil, and Yoshua Bengio. Noisy activation functions. In International Conference on Machine Learning, pp. 3059–3068, 2016.
234
+
235
+ Geoffrey Hinton, Nitish Srivastava, and Kevin Swersky. Neural networks for machine learninglecture 6a-overview of mini-batch gradient descent, 2012.
236
+
237
+ Sepp Hochreiter and Jurgen Schmidhuber. Flat minima. ¨ Neural Computation, 9(1):1–42, 1997.
238
+
239
+ William H Jefferys and James O Berger. Ockham’s razor and bayesian analysis. American Scientist, 80(1):64–72, 1992.
240
+
241
+ Yulei Jiang, Richard M Zur, Lorenzo L Pesce, and Karen Drukker. A study of the effect of noise injection on the training of artificial neural networks. In Neural Networks, 2009. IJCNN 2009. International Joint Conference on, pp. 1428–1432. IEEE, 2009.
242
+
243
+ 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.
244
+
245
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
246
+
247
+ Alex Krizhevsky. Convolutional deep belief networks on cifar-10. 2010.
248
+
249
+ Anders Krogh and John A Hertz. A simple weight decay can improve generalization. In Advances in neural information processing systems, pp. 950–957, 1992.
250
+
251
+ Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial machine learning at scale. arXiv preprint arXiv:1611.01236, 2016.
252
+
253
+ Jaehoon Lee, Yasaman Bahri, Roman Novak, Sam Schoenholz, Jeffrey Pennington, and Jascha Sohldickstein. Deep neural networks as gaussian processes. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id $\equiv$ B1EA-M-0Z.
254
+
255
+ David JC MacKay. Bayesian interpolation. 1991.
256
+
257
+ David JC MacKay. A practical bayesian framework for backpropagation networks. Neural computation, 4(3):448–472, 1992.
258
+
259
+ G. Montufar, R. Pascanu, K. Cho, and Y. Bengio. On the Number of Linear Regions of Deep Neural ´ Networks. Neural Information Processing Systems, February 2014.
260
+
261
+ Seyed-Mohsen Moosavi-Dezfooli, Alhussein Fawzi, Omar Fawzi, and Pascal Frossard. Universal adversarial perturbations. arXiv preprint arXiv:1610.08401, 2016.
262
+
263
+ Iain Murray and Zoubin Ghahramani. A note on the evidence and bayesian occam’s razor, 2005.
264
+
265
+ Vinod Nair and Geoffrey E Hinton. Rectified linear units improve restricted boltzmann machines. In Proceedings of the 27th international conference on machine learning (ICML-10), pp. 807–814, 2010.
266
+
267
+ Radford M. Neal. Priors for infinite networks (tech. rep. no. crg-tr-94-1). University of Toronto, 1994.
268
+
269
+ Behnam Neyshabur, Ryota Tomioka, and Nathan Srebro. In search of the real inductive bias: On the role of implicit regularization in deep learning. Proceeding of the international Conference on Learning Representations workshop track, abs/1412.6614, 2015.
270
+
271
+ Behnam Neyshabur, Srinadh Bhojanapalli, David McAllester, and Nathan Srebro. Exploring generalization in deep learning. CoRR, abs/1706.08947, 2017.
272
+
273
+ Behnam Neyshabur, Srinadh Bhojanapalli, and Nathan Srebro. A PAC-bayesian approach to spectrally-normalized margin bounds for neural networks. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id=Skz_WfbCZ.
274
+
275
+ Nicolas Papernot, Patrick McDaniel, Somesh Jha, Matt Fredrikson, Z Berkay Celik, and Ananthram Swami. The limitations of deep learning in adversarial settings. In Security and Privacy (EuroS&P), 2016 IEEE European Symposium on, pp. 372–387. IEEE, 2016.
276
+
277
+ R. Pascanu, G. Montufar, and Y. Bengio. On the number of response regions of deep feed forward networks with piece-wise linear activations. International Conference on Learning Representations, December 2013.
278
+
279
+ B. Poole, S. Lahiri, M. Raghu, J. Sohl-Dickstein, and S. Ganguli. Exponential expressivity in deep neural networks through transient chaos. Neural Information Processing Systems, June 2016.
280
+
281
+ M. Raghu, B. Poole, J. Kleinberg, S. Ganguli, and J. Sohl-Dickstein. On the Expressive Power of Deep Neural Networks. International Conference on Machine Learning, June 2016.
282
+
283
+ Carl E. Rasmussen and Zoubin Ghahramani. Occam’s razor. In NIPS, 2000.
284
+
285
+ Salah Rifai, Pascal Vincent, Xavier Muller, Xavier Glorot, and Yoshua Bengio. Contractive autoencoders: Explicit invariance during feature extraction. In Proceedings of the 28th international conference on machine learning (ICML-11), pp. 833–840, 2011.
286
+
287
+ David E Rumelhart, Geoffrey E Hinton, Ronald J Williams, et al. Learning representations by back-propagating errors. Cognitive modeling, 5(3):1, 1988.
288
+
289
+ Jure Sokolic, Raja Giryes, Guillermo Sapiro, and Miguel RD Rodrigues. Robust large margin deep neural networks. IEEE Transactions on Signal Processing, 2017.
290
+
291
+ Ercan Solak, Roderick Murray-Smith, William E Leithead, Douglas J Leith, and Carl E Rasmussen. Derivative observations in gaussian process models of dynamic systems. In Advances in neural information processing systems, pp. 1057–1064, 2003.
292
+
293
+ 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.
294
+
295
+ Matus Telgarsky. Representation benefits of deep feedforward networks. CoRR, abs/1509.08101, 2015.
296
+
297
+ Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms, 2017.
298
+
299
+ Huan Xu and Shie Mannor. Robustness and generalization. Machine learning, 86(3):391–423, 2012.
300
+
301
+ C. Zhang, S. Bengio, M. Hardt, B. Recht, and O. Vinyals. Understanding deep learning requires rethinking generalization. International Conference on Learning Representations, November 2016.
302
+
303
+ # A APPENDIX
304
+
305
+ # A.1 TRANSITION METRIC DETAILS
306
+
307
+ # A.1.1 LINEAR REGION ENCODING
308
+
309
+ The way of encoding a linear region $\mathbf { c } \left( \mathbf { z } \right)$ of a point $\mathbf { z }$ described in §3 (2) guarantees that different regions obtain different codes, but different codes might be assigned to the same region if all the neurons in any layer of the network are saturated (or if weights leading from the transitioning unit to active units are exactly zero, or exactly cancel). However, the probability of such an arrangement drops exponentially with width and hence is ignored in this work.
310
+
311
+ # A.1.2 TRANSITION COUNTING
312
+
313
+ The equality between the discrete and continuous versions of $t \left( \mathbf { x } \right)$ in Equation 1 becomes exact with a high-enough sampling density $k$ such that there are no narrow linear regions missed in between consecutive points (precisely, the encoding $\mathbf { c } \left( \mathbf { z } \right)$ has to only change at most once on the line between two consecutive points $\mathbf { z } _ { i }$ and $\mathbf { z } _ { i + 1 }$ ).
314
+
315
+ For computational efficiency we also assume that no two neurons transitions simultaneously, which is extremely unlikely in the context of random initialization and stochastic optimization.
316
+
317
+ ![](images/1a3bf6f1955f6cf898f95de9d05feffa17ba642a01582b9d5c4d3f71d290741a.jpg)
318
+ Figure App.7: Depiction of a trajectory in input space used to count transitions as defined in §3 (2). An interpolation between 28 horizontal translations of a single digit results in a complex trajectory that constrains all points to lie close to the translation-augmented data, and allows for a tractable estimate of transition density around the data manifold. This metric is used to compare models in 4.2 and 4.3. Straight lines indicate boundaries between different linear regions (straight-line boundaries between linear regions is accurate for the case of a single-layer piecewise-linear network. The partition into linear regions is more complex for deeper networks (Raghu et al., 2016)).
319
+
320
+ ![](images/f27e7f4b1b4dd167346b5033c21867861f4178042017ef8e48e7ba3e522d108b.jpg)
321
+ Figure App.8: Number of transitions, in contrast to Figure 5, does not generally correlate with generalization gap. Left: 2160 networks with $1 0 0 \%$ train accuracy on CIFAR10. Right: 2097 networks with at least $9 9 . 9 \%$ training accuracy on CIFAR100. See §A.5.5 for experimental details.
322
+
323
+ ![](images/3c841fa462085be2747162741dc6ac9a5e7c78e3273c86d56ac75bc6efde0b3f.jpg)
324
+ Figure App.9: Jacobian norm plotted against individual test point loss on Fashion-MNIST (Xiao et al., 2017) and CIFAR100. As in Figure 6, each plot shows 5 random networks that fit the respective training set to a $1 0 0 \%$ with each network having a unique color. See §A.5.6 for experimental details.
325
+
326
+ # A.2 DO NEURAL NETWORKS DEFY OCCAM’S RAZOR?
327
+
328
+ Here we briefly discuss the motivation of this work in the context of Occam’s razor.
329
+
330
+ Occam’s razor is a heuristic for model comparison based on their complexity. Given a dataset $\mathcal { D }$ , Occam’s razor gives preference to simpler models $\mathcal { H }$ . In the Bayesian interpretation of the heuristic (Jefferys & Berger, 1992) simplicity is defined as evidence $\mathbb { P } \left[ \mathcal { D } | \mathcal { H } \right]$ and is often computed using the Laplace approximation. Under further assumptions (MacKay, 1991), this evidence can be shown to be inversely proportional to the number of parameters in the model. Therefore, given a uniform prior $\mathbb { P } \left[ \mathcal { H } \right]$ on two competing hypothesis classes, the class posterior $\mathbb { P } \left[ \mathcal { H } | \mathcal { D } \right] \sim \bar { \mathbb { P } } \left[ \mathcal { D } | \mathcal { H } \right] \mathbb { P } \left[ \mathcal { H } \right]$ is higher for a model with fewer parameters.
331
+
332
+ An alternative, qualitative justification of the heuristic is through considering the evidence as a normalized probability distribution over the whole dataset space:
333
+
334
+ $$
335
+ \int _ { D ^ { \prime } } \mathbb { P } \left[ \mathcal { D ^ { \prime } } | \mathcal { H } \right] d \mathcal { D ^ { \prime } } = 1
336
+ $$
337
+
338
+ and remarking that models with more parameters have to spread the probability mass more evenly across all the datasets by virtue of being able to fit more of them (Figure App.10, left). This similarly suggests (under a uniform prior on competing hypothesis classes) preferring models with fewer parameters, assuming that evidence is unimodal and peaks close to the dataset of interest.
339
+
340
+ Occam’s razor for neural networks. As seen in Figure 1, the above reasoning does not apply to neural networks: the best achieved generalization is obtained by a model that has around $1 0 ^ { \bar { 4 } }$ times as many parameters as the simplest model capable of fitting the dataset (within the evaluated search space).
341
+
342
+ On one hand, Murray & Ghahramani (2005); Telgarsky (2015) demonstrate on concrete examples that a high number of free parameters in the model doesn’t necessarily entail high complexity. On the other hand, a large body of work on the expressivity of neural networks (Pascanu et al., 2013; Montufar et al. ´ , 2014; Raghu et al., 2016; Poole et al., 2016) shows that their ability to compute complex functions increases rapidly with size, while Zhang et al. (2016) validates that they also easily fit complex (even random) functions with stochastic optimization. Classical metrics like VC dimension or Rademacher complexity increase with size of the network as well. This indicates that weights of a neural network may actually correspond to its usable capacity, and hence “smear” the evidence $\mathbb { P } \left[ \mathcal { D } | \mathcal { H } \right]$ along a very large space of datasets $\mathcal { D } ^ { \prime }$ , making the dataset of interest $\mathcal { D }$ less likely.
343
+
344
+ Potential issues. We conjecture the Laplace approximation of the evidence $\mathbb { P } \left[ \mathcal { D } | \mathcal { H } \right]$ and the simplified estimation of the “Occam’s factor” in terms of the accessible volume of the parameter space might not hold for neural networks in the context of stochastic optimization, and, in particular, do not account for the combinatorial growth of the accessible volume of parameter space as width increases (MacKay, 1992). Similarly, when comparing evidence as probability distributions over datasets, the difference between two neural networks may not be as drastic as in Figure App.10 (left), but more nuanced as depicted in Figure App.10 (right), with the evidence ratio being highly dependent on the particular dataset.
345
+
346
+ We interpret our work as defining hypothesis classes based on sensitivity of the hypothesis (which yielded promising results in (Rasmussen & Ghahramani, 2000) on a toy task) and observing a strongly non-uniform prior on these classes that enables model comparison. Indeed, at least in the context of natural images classification, putting a prior on the number of parameters or Kolmogorov complexity of the hypothesis is extremely difficult. However, a statement that the true classification function is robust to small perturbations in the input is much easier to justify. As such, a prior $\mathbb { P } \left[ \mathcal { H } \right]$ in favor of robustness over sensitivity might fare better than a prior on specific network hyper-parameters.
347
+
348
+ Above is one way to interpret the correlation between sensitivity and generalization that we observe in this work. It does not explain why large networks tend to converge to less sensitive functions. We conjecture large networks to have access to a larger space of robust solutions due to solving a highly-underdetermined system when fitting a dataset, while small models converge to more extreme weight values due to being overconstrained by the data. However, further investigation is needed to confirm this hypothesis.
349
+
350
+ ![](images/12e600f6f7004b1aeff2de1183fd3bae4d13d1b72b3ab0b7d54ee9951c86c3aa.jpg)
351
+ Figure App.10: Occam’s razor: simplified expectation vs hypothesized reality. All datasets $\mathcal { D } ^ { \prime }$ with input and target dimensions matching those of a particular dataset $\mathcal { D }$ are sorted according to the evidence $\mathbb { P } \left[ \mathcal { D } ^ { \prime } | \mathcal { H } \right]$ of a large model $\mathcal { H } _ { \mathrm { l } }$ from left to right along the horizontal axis. Left: a classic simplified depiction of Bayesian Occam’s razor. Evidence $\mathbb { P } [ \bar { \mathcal { D } } ^ { \prime } | \mathcal { H } ]$ of a small model $\mathcal { H } _ { \mathrm { s } }$ with few parameters has narrow support in the dataset space and is more peaked. If the model fits the dataset $\mathcal { D }$ well, it falls close to the peak and outperforms a larger model $\mathcal { H } _ { \mathrm { l } }$ with more parameters, having wider support. Right: suggested potential reality of neural networks. Evidence of the small model $\mathcal { H } _ { \mathrm { s } }$ peaks higher, but the large model $\mathcal { H } _ { \mathrm { l } }$ might nonetheless concentrate the majority of probability mass on simple functions and the evidence curves might intersect at a small angle. In this case, while a dataset $\mathcal { D }$ lying close to the intersection can be fit by both models, the Bayesian evidence ratio depends on its exact position with respect to the intersection.
352
+
353
+ # A.3 BOUNDING THE JACOBIAN NORM
354
+
355
+ Here we analyze the relationship between the Jacobian norm and the cross-entropy loss at individual test points as studied in §4.4.
356
+
357
+ Target class Jacobian. We begin by relating the derivative of the target class probability $\mathbf { J } _ { y ( \mathbf { x } ) }$ to per-point cross-entropy loss $l ( \mathbf { x } ) = - \log \left[ \mathbf { f } _ { \sigma } ( \mathbf { x } ) \right] _ { y ( \mathbf { x } ) }$ (where $y ( \mathbf x )$ is the correct integer class).
358
+
359
+ We will denote ${ \bf f } _ { \sigma } ( { \bf x } )$ by $\sigma$ and drop the $\mathbf { x }$ argument to de-clutter notation (i.e. write f instead of $\mathbf { f } \left( \mathbf { x } \right) .$ ). Then the Jacobian can be expressed as
360
+
361
+ $$
362
+ \mathbf { J } = \left[ \left( \sigma \mathbf { 1 } ^ { T } \right) \odot \left( \mathbf { I } - \pmb { \sigma } \mathbf { 1 } ^ { T } \right) ^ { T } \right] \left( \frac { \partial \mathbf { f } } { \partial \mathbf { x } ^ { T } } \right) ,
363
+ $$
364
+
365
+ where $\odot$ is the Hadamard element-wise product. Then indexing both sides of the equation at the correct class $y$ yields
366
+
367
+ $$
368
+ \mathbf { J } _ { y } = \sigma _ { y } \left( \left( \mathbf { e } _ { y } - \pmb { \sigma } \right) ^ { T } \left( \frac { \partial \mathbf { f } } { \partial \mathbf { x } ^ { T } } \right) \right) ,
369
+ $$
370
+
371
+ where $\mathbf { e } _ { y }$ is a vector of zeros everywhere except for $e _ { y } = 1$ . Taking the norm of both sides results in
372
+
373
+ $$
374
+ \begin{array} { c } { \displaystyle | | \mathbf { J } _ { y } | | _ { 2 } ^ { 2 } = \sigma _ { y } ^ { 2 } \sum _ { k = 1 } ^ { d } \left[ \left( 1 - \sigma _ { y } \right) ^ { 2 } \left( \frac { \partial f _ { y } } { \partial x _ { k } } \right) ^ { 2 } + \sum _ { j \neq y } ^ { n } \left( \sigma _ { j } \frac { \partial f _ { j } } { \partial x _ { k } } \right) ^ { 2 } \right] } \\ { = \displaystyle \sigma _ { y } ^ { 2 } \left[ \left( 1 - \sigma _ { y } \right) ^ { 2 } \sum _ { k = 1 } ^ { d } \left( \frac { \partial f _ { y } } { \partial x _ { k } } \right) ^ { 2 } + \sum _ { j \neq y } ^ { n } \sigma _ { j } ^ { 2 } \sum _ { k = 1 } ^ { d } \left( \frac { \partial f _ { j } } { \partial x _ { k } } \right) ^ { 2 } \right] } \\ { = \displaystyle \sigma _ { y } ^ { 2 } \left[ \left( 1 - \sigma _ { y } \right) ^ { 2 } \left\| \frac { \partial f _ { y } } { \partial \mathbf { x } ^ { T } } \right\| _ { 2 } ^ { 2 } + \sum _ { j \neq y } ^ { n } \sigma _ { j } ^ { 2 } \left\| \frac { \partial f _ { j } } { \partial \mathbf { x } ^ { T } } \right\| _ { 2 } ^ { 2 } \right] } \end{array}
375
+ $$
376
+
377
+ We now assume that magnitudes of the individual logit derivatives vary little in between logits and over the input space3:
378
+
379
+ $$
380
+ \left. \frac { \partial f _ { i } } { \partial \mathbf { x } ^ { T } } \right. _ { 2 } ^ { 2 } \approx \frac { 1 } { n } \mathbb { E } _ { \mathbf { x } _ { \mathrm { t e s t } } } \left. \frac { \partial \mathbf { f } } { \partial \mathbf { x } _ { \mathrm { t e s t } } ^ { T } } \right. _ { F } ^ { 2 } ,
381
+ $$
382
+
383
+ which simplifies Equation 4 to
384
+
385
+ $$
386
+ \left\| \mathbf { J } _ { y } \right\| _ { 2 } ^ { 2 } \approx M \sigma _ { y } ^ { 2 } \left[ ( 1 - \sigma _ { y } ) ^ { 2 } + \sum _ { j \neq y } ^ { n } \sigma _ { j } ^ { 2 } \right] ,
387
+ $$
388
+
389
+ where $M = \mathbb { E } _ { \mathbf { x } _ { \mathrm { t e s t } } } \left\| \partial \mathbf { f } / \partial \mathbf { x } _ { \mathrm { t e s t } } ^ { T } \right\| _ { F } ^ { 2 } / n$ . Since $\sigma$ lies on the $( n - 1 )$ -simplex $\Delta ^ { n - 1 }$ , under these assumptions we can bound:
390
+
391
+ $$
392
+ \frac { ( 1 - \sigma _ { y } ) ^ { 2 } } { n - 1 } \leqslant \sum _ { j \neq y } ^ { n } \sigma _ { j } ^ { 2 } \leqslant ( 1 - \sigma _ { y } ) ^ { 2 } ,
393
+ $$
394
+
395
+ and finally
396
+
397
+ $$
398
+ \frac { n } { n - 1 } M \sigma _ { y } ^ { 2 } \left( 1 - \sigma _ { y } \right) ^ { 2 } \lessapprox \left\| \mathbf { J } _ { y } \right\| _ { 2 } ^ { 2 } \lessapprox 2 M \sigma _ { y } ^ { 2 } \left( 1 - \sigma _ { y } \right) ^ { 2 } ,
399
+ $$
400
+
401
+ or, in terms of the cross-entropy loss $l = - \log \sigma _ { y }$
402
+
403
+ $$
404
+ \sqrt { \frac { n M } { n - 1 } } \mathbb { e } ^ { - l } \left( 1 - \Phi ^ { - l } \right) \lessapprox \left. \mathbf { J } _ { y } \right. _ { 2 } \lessapprox \sqrt { 2 M } \mathbb { e } ^ { - l } \left( 1 - \Phi ^ { - l } \right) .
405
+ $$
406
+
407
+ We validate these approximate bounds in Figure App.11 (top).
408
+
409
+ Full Jacobian. Equation 5 establishes a close relationship between $\mathbf { J } _ { y }$ and loss $l = - \log \sigma _ { y }$ , but of course, at test time we do not know the target class $y$ . This allows us to only bound the full Jacobian norm from below:
410
+
411
+ $$
412
+ \sqrt { \frac { n M } { n - 1 } } \circledast ^ { - l } \left( 1 - \circledast ^ { - l } \right) \precapprox \| \mathbf { J } _ { y } \| _ { 2 } \leqslant \| \mathbf { J } \| _ { F } .
413
+ $$
414
+
415
+ For the upper bound, we assume the maximum-entropy case of $\sigma _ { y }$ : $\sigma _ { i } \approx ( 1 - \sigma _ { y } ) / ( n - 1 )$ , for $i \neq y$ . The Jacobian norm is
416
+
417
+ $$
418
+ \left\| \mathbf { J } \right\| _ { F } ^ { 2 } = \sum _ { i = 1 } ^ { n } \left\| \mathbf { J } _ { i } \right\| _ { 2 } ^ { 2 } = \left\| \mathbf { J } _ { y } \right\| _ { 2 } ^ { 2 } + \sum _ { i \neq y } ^ { n } \left\| \mathbf { J } _ { i } \right\| _ { 2 } ^ { 2 } ,
419
+ $$
420
+
421
+ where the first summand becomes:
422
+
423
+ $$
424
+ \Vert \mathbf { J } _ { y } \Vert _ { 2 } ^ { 2 } \approx M \sigma _ { y } ^ { 2 } \left[ \left( 1 - \sigma _ { y } \right) ^ { 2 } + \left( n - 1 \right) \left( \frac { 1 - \sigma _ { y } } { n - 1 } \right) ^ { 2 } \right] = \frac { M n } { n - 1 } \sigma _ { y } ^ { 2 } \left( 1 - \sigma _ { y } \right) ^ { 2 } ,
425
+ $$
426
+
427
+ and each of the others
428
+
429
+ $$
430
+ \begin{array} { l } { { \displaystyle \left\| { \bf J } _ { i } \right\| _ { 2 } ^ { 2 } \approx M \left( \frac { 1 - \sigma _ { y } } { n - 1 } \right) ^ { 2 } \left[ \left( 1 - \frac { 1 - \sigma _ { y } } { n - 1 } \right) ^ { 2 } + \left( \sigma _ { y } ^ { 2 } + ( n - 2 ) \left( \frac { 1 - \sigma _ { y } } { n - 1 } \right) ^ { 2 } \right) \right] } } \\ { { \displaystyle \qquad = \frac { M } { ( n - 1 ) ^ { 3 } } \left( 1 - \sigma _ { y } \right) ^ { 2 } \left( n \sigma _ { y } ^ { 2 } + n - 2 \right) ^ { 2 } . } } \end{array}
431
+ $$
432
+
433
+ Adding $n - 1$ of such summands to $\| \mathbf { J } _ { y } \| _ { 2 } ^ { 2 }$ results in
434
+
435
+ $$
436
+ \| { \bf J } \| _ { F } \approx \frac { \sqrt { M } } { ( n - 1 ) } ( 1 - \sigma _ { y } ) \sqrt { n ^ { 2 } \sigma _ { y } ^ { 2 } + n - 2 } = \frac { \sqrt { M } } { ( n - 1 ) } \left( 1 - \mathrm { e } ^ { - l } \right) \sqrt { n ^ { 2 } \mathrm { e } ^ { - 2 l } + n - 2 } ,
437
+ $$
438
+
439
+ compared against the lower bound (Equation 6) and experimental data in Figure App.11.
440
+
441
+ ![](images/e0625d13f1d1704d242feb7d156eb440d03aab6c519bb88881e108cfcac63f04.jpg)
442
+ Cross-entropy loss
443
+
444
+ Figure App.11: Top: Jacobian norm $\left\| \mathbf { J } _ { y } \left( \mathbf { x } \right) \right\| _ { 2 } = \left\| \partial \mathbf { f } _ { \sigma } \left( \mathbf { x } \right) _ { y } / \partial \mathbf { x } ^ { T } \right\| _ { 2 }$ of the true class $y$ output probability is tightly related to the cross-entropy loss. Each point corresponds to one of the 1000 test inputs to a $100 \%$ trained network on CIFAR10, while lines depict analytic bounds from Equation 5. Bottom: Same experiment plotting the full Jacobian norm $\| \bar { \mathbf { J } } \| _ { F }$ against cross-entropy. Solid lines correspond to the lower bound from Equation 6 and the norm approximation from Equation 7. See $\ S _ { \mathrm { A } . 5 . 7 }$ for experimental details and Figures 6 and App.9 for empirical evaluation of this relationship on multiple datasets and models.
445
+
446
+ # A.4 NON-LINEARITIES DEFINITIONS
447
+
448
+ Following activation functions are used in this work:
449
+
450
+ 1. ReLU (Nair & Hinton, 2010): $\mathrm { m a x } ( x , 0 )$ ;
451
+ 2. ReLU6 (Krizhevsky, 2010): min $( \operatorname* { m a x } ( x , 0 ) , 6 )$ ;
452
+ 3. Tanh: hyperbolic tangent, $( e ^ { x } - e ^ { - x } ) / ( e ^ { x } + e ^ { - x } )$ ;
453
+ 4. HardTanh (Gulcehre et al., 2016): $\operatorname* { m i n } { ( \operatorname* { m a x } ( x , - 1 ) , 1 ) }$ ;
454
+ 5. HardSigmoid (Gulcehre et al., 2016): $\operatorname* { m i n } { ( \operatorname* { m a x } ( x + 0 . 5 , 0 ) , 1 ) }$ ;
455
+
456
+ # A.5 EXPERIMENTAL SETUP
457
+
458
+ All experiments were implemented in Tensorflow (Abadi et al., 2016) and executed with the help of Vizier (Golovin et al., 2017). All networks were trained with cross-entropy loss. All networks were trained without biases. All computations were done with 32-bit precision. Learning rate decayed by a factor of 0.1 every 500 epochs.
459
+
460
+ Unless specified otherwise, initial weights were drawn from a normal distribution with zero mean and variance $2 / n$ for ReLU, ReLU6 and HardSigmoid; $1 / n$ for Tanh and HardTanh, where $n$ is the number of inputs to the current layer.
461
+
462
+ All inputs were normalized to have zero mean and unit variance, or, in other terms, lie on the $d$ - dimensional sphere of radius $\sqrt { d }$ , where $d$ is the dimensionality of the input.
463
+
464
+ All reported values, when applicable, were evaluated on the whole training and test sets of sizes 50000 and 10000 respectively. E.g. “generalization gap” is defined as the difference between train and test accuracies evaluated on the whole train and test sets.
465
+
466
+ When applicable, all trajectories/surfaces in input space were sampled with $2 ^ { 2 0 }$ points.
467
+
468
+ # A.5.1 PLOTS AND ERROR BARS
469
+
470
+ All figures except for 6 and App.11 are plotted with (pale) error bars (when applicable). The reported quantity was usually evaluated 8 times with random seeds from 1 to $8$ , unless specified otherwise. E.g. if a network is said to be $100 \%$ -accurate on the training set, it means that each of the 8 randomlyinitialized networks is $100 \%$ -accurate after training.
471
+
472
+ The error bar is centered at the mean value of the quantity and spans the standard error of the mean in each direction. If the bar appears to not be visible, it may be smaller than the mean value marker.
473
+
474
+ Weight initialization, training set shuffling, data augmentation, picking anchor points of data-fitted trajectories, selecting axes of a zero-centered elliptic trajectory depend on the random seed.
475
+
476
+ # A.5.2 SENSITIVITY ALONG A TRAJECTORY
477
+
478
+ Relevant figure 2.
479
+
480
+ A 20-layer ReLU-network of width 200 was trained on MNIST 128 times, with plots displaying the averaged values.
481
+
482
+ A random zero-centered ellipse was obtained by generating two axis vectors with normallydistributed entries of zero mean and unit variance (as such making points on the trajectory have an expected norm equal to that of training data) and sampling points on the ellipse with given axes.
483
+
484
+ A random data-fitted ellipse was generated by projecting three arbitrary input points onto a plane where they fall into vertices of an equilateral triangle, and then projecting their circumcircle back into the input space.
485
+
486
+ # A.5.3 LINEAR REGION BOUNDARIES
487
+
488
+ Relevant figure 3.
489
+
490
+ A 15-layer ReLU6-network of width 300 was trained on MNIST for $2 ^ { 1 8 }$ steps using SGD with momentum (Rumelhart et al., 1988); images were randomly translated with wrapping by up to 4 pixels in each direction, horizontally and vertically, as well as randomly flipped along each axis, and randomly rotated by 90 degrees clockwise and counter-clockwise.
491
+
492
+ The sampling grid in input space was obtain by projecting three arbitrary input points into a plane as described in §A.5.2 such that the resulting triangle was centered at 0 and it’s vertices were at a distance 0.8 form the origin. Then, a sampling grid of points in the $[ - 1 ; 1 ] ^ { \times 2 }$ square was projected back into the input space.
493
+
494
+ # A.5.4 SMALL EXPERIMENT
495
+
496
+ Relevant figures: 4 (second row) and 5 (bottom).
497
+
498
+ All networks were trained for $2 ^ { 1 8 }$ steps of batch size of 256 using SGD with momentum. Learning rate was set to 0.005 and momentum term coefficient to 0.9.
499
+
500
+ Data augmentation consisted of random translation of the input by up to 4 pixels in each direction with wrapping, horizontally and vertically. The input was also flipped horizontally with probability 0.5. When applying data augmentation (second row of Figure 4), the network is unlikely to encounter the canonical training data, hence few configurations achieved $1 0 0 \%$ training accuracy. However, we verified that all networks trained with data augmentation reached a higher test accuracy than their analogues without, ensuring that the generalization gap shrinks not simply because of lower training accuracy.
501
+
502
+ For each dataset, networks of width $\{ 1 0 0 , 2 0 0 , 5 0 0 , 1 0 0 0 , 2 0 0 0 , 3 0 0 0 \}$ , depth $\{ 2 , 3 , 5 , 1 0 , 1 5 , 2 0 \}$ and activation function ReLU, ReLU6, HardTanh, HardSigmoid were evaluated on 8 random seeds from 1 to 8.
503
+
504
+ # A.5.5 LARGE EXPERIMENT
505
+
506
+ Relevant figures: 1, 4 (except for the second row), 5 (top), App.8.
507
+
508
+ 335671 networks were trained for $2 ^ { 1 9 }$ steps with random hyper-parameters; if training did not complete, a checkpoint at step $2 ^ { 1 8 }$ was used instead, if available. When using L-BFGS, the maximum number of iterations was set to 2684. The space of available hyper-parameters included5:
509
+
510
+ 1. CIFAR10 and CIFAR100 datasets cropped to a $2 4 \times 2 4$ center region;
511
+ 2. all 5 non-linearities from $\ S _ { \mathrm { ~ \tiny ~ \cdot ~ } }$ ;
512
+ 3. SGD, Momentum, ADAM (Kingma & Ba, 2014), RMSProp (Hinton et al., 2012) and LBFGS optimizers;
513
+ 4. learning rates from $\{ 0 . 0 1 , 0 . 0 0 5 , 0 . 0 0 0 5 \}$ , when applicable. Secondary coefficients were fixed at default values of Tensorflow implementations of respective optimizers;
514
+ 5. batch sizes of $\{ 1 2 8 , 5 1 2 \}$ (unless using L-BFGS with the full batch of 50000);
515
+ 6. standard deviations of initial weights from $\{ 0 . 5 , 1 , 4 , 8 \}$ multiplied by the default value described in $\ S _ { \mathrm { A } . 5 }$ ;
516
+ 7. widths from $\{ 1 , 2 , 4 , \cdots , 2 ^ { 1 6 } \}$ ;
517
+ 8. depths from $\{ 2 , 3 , 5 , \cdots , 2 ^ { 6 } + 1 \}$ ;
518
+ 9. true and random training labels;
519
+ 10. random seeds from 1 to 8.
520
+
521
+ # A.5.6 PER-POINT GENERALIZATION
522
+
523
+ Relevant figures 6, App.9.
524
+
525
+ Networks were with either cross-entropy or $\ell _ { 2 }$ -loss trained for $2 ^ { 1 9 }$ steps on whole datasets (CIFAR100, CIFAR10, Fashion-MNIST and MNIST) and evaluated on random subsets of 1000 test images.
526
+
527
+ Hyper-parameters were: non-linearity (all functions from §A.4), width (50, 100, 200, 500, 1000), depth (2, 5, 10, 20, 30), learning rate (0.0001, 0.001, 0.01), optimizer (SGD, Momentum, ADAM, RMSProp). Only one random seed (1) was used. For each dataset a random subset of 5 configurations among all the $1 0 0 \%$ -accurate (on training) networks was plotted (apart from the case of CIFAR100, where networks of training accuracy of at least $9 9 . 9 8 \%$ were selected).
528
+
529
+ # A.5.7 CROSS-ENTROPY AND SENSITIVITY ANALYSIS
530
+
531
+ Relevant figure App.11.
532
+
533
+ Networks were trained for $2 ^ { 1 8 }$ on the whole CIFAR10 training set and evaluated networks on a random test subset of size 1000. The hyper-parameters consisted of non-linearity (all functions from $\ S \mathrm { A } . 4 )$ , width (50, 100 or 200) and depth (2, 5, 10, 20). Only one random seed (1) was considered. A single random $100 \%$ -accurate (on training data) network was drawn to compare experimental measurements with analytic bounds on the Jacobian norm.
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/HJDBUF5le/HJDBUF5le.md ADDED
@@ -0,0 +1,312 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TOWARDS A NEURAL STATISTICIAN
2
+
3
+ # Amos Storkey
4
+
5
+ Harrison Edwards
6
+ School of Informatics
7
+ University of Edinburgh
8
+ Edinburgh, UK
9
+ H.L.Edwards@sms.ed.ac.uk
10
+
11
+ School of Informatics University of Edinburgh Edinburgh, UK A.Storkey@ed.ac.uk
12
+
13
+ # ABSTRACT
14
+
15
+ An efficient learner is one who reuses what they already know to tackle a new problem. For a machine learner, this means understanding the similarities amongst datasets. In order to do this, one must take seriously the idea of working with datasets, rather than datapoints, as the key objects to model. Towards this goal, we demonstrate an extension of a variational autoencoder that can learn a method for computing representations, or statistics, of datasets in an unsupervised fashion. The network is trained to produce statistics that encapsulate a generative model for each dataset. Hence the network enables efficient learning from new datasets for both unsupervised and supervised tasks. We show that we are able to learn statistics that can be used for: clustering datasets, transferring generative models to new datasets, selecting representative samples of datasets and classifying previously unseen classes. We refer to our model as a neural statistician, and by this we mean a neural network that can learn to compute summary statistics of datasets without supervision.
16
+
17
+ # 1 INTRODUCTION
18
+
19
+ The machine learning community is well-practised at learning representations of data-points and sequences. A middle-ground between these two is representing, or summarizing, datasets - unordered collections of vectors, such as photos of a particular person, recordings of a given speaker or a document as a bag-of-words. Where these sets take the form of i.i.d samples from some distribution, such summaries are called statistics. We explore the idea of using neural networks to learn statistics and we refer to our approach as a neural statistician.
20
+
21
+ The key result of our approach is a statistic network that takes as input a set of vectors and outputs a vector of summary statistics specifying a generative model of that set - a mean and variance specifying a Gaussian distribution in a latent space we term the context. The advantages of our approach are that it is:
22
+
23
+ • Unsupervised: It provides principled and unsupervised way to learn summary statistics as the output of a variational encoder of a generative model.
24
+ • Data efficient: If one has a large number of small but related datasets, modelling the datasets jointly enables us to gain statistical strength.
25
+ • Parameter Efficient: By using summary statistics instead of say categorical labellings of each dataset, we decouple the number of parameters of the model from the number of datasets.
26
+ • Capable of few-shot learning: If the datasets correspond to examples from different classes, class embeddings (summary statistics associated with examples from a class), allow us to handle new classes at test time.
27
+
28
+ # 2 PROBLEM STATEMENT
29
+
30
+ We are given datasets $D _ { i }$ for $i \in \mathcal { Z }$ . Each dataset $D _ { i } = \{ x _ { 1 } , \ldots , x _ { k _ { i } } \}$ consists of a number of i.i.d samples from an associated distribution $p _ { i }$ over $\mathbb { R } ^ { n }$ . The task can be split into learning and inference components. The learning component is to produce a generative model $\hat { p } _ { i }$ for each dataset $D _ { i }$ . We assume there is a common underlying generative process $p$ such that $p _ { i } = p ( \cdot | c _ { i } )$ for $c _ { i } \in \mathbb { R } ^ { l }$ drawn from $p ( c )$ . We refer to $c$ as the context. The inference component is to give an approximate posterior over the context $q ( c | D )$ for a given dataset produced by a statistic network.
31
+
32
+ # 3 NEURAL STATISTICIAN
33
+
34
+ In order to exploit the assumption of a hierarchical generative process over datasets we will use a ‘parameter-transfer approach’ (see Pan & Yang, 2010) to extend the variational autoencoder model of Kingma & Welling (2013).
35
+
36
+ ![](images/6e6de22e59acbd630cacaf80d1e1542ac5d29c3f4627ec81e0775900d79c83d2.jpg)
37
+ Figure 1: Left: basic hierarchical model, where the plate encodes the fact that the context variable $c$ is shared across each item in a given dataset. Center: full neural statistician model with three latent layers $z _ { 1 } , z _ { 2 } , z _ { 3 }$ . Each collection of incoming edges to a node is implemented as a neural network, the input of which is the concatenation of the edges’ sources, the output of which is a parameterization of a distribution over the random variable represented by that node. Right: The statistic network, which combines the data via an exchangeable statistic layer.
38
+
39
+ # 3.1 VARIATIONAL AUTOENCODER
40
+
41
+ The variational autoencoder is a latent variable model $p ( x | z ; \theta )$ (often called the decoder) with parameters $\theta$ . For each observed $x$ , a corresponding latent variable $z$ is drawn from $p ( z )$ so that
42
+
43
+ $$
44
+ p ( x ) = \int p ( x | z ; \theta ) p ( z ) d z .
45
+ $$
46
+
47
+ The generative parameters $\theta$ are learned by introducing a recognition network (also called an encoder) $q ( z | x ; \phi )$ with parameters $\phi$ . The recognition network gives an approximate posterior over the latent variables that can then be used to give the standard variational lower bound (Saul & Jordan, 1996) on the single-datum log-likelihood. I.e. $\log P ( x | \theta ) \geq \mathcal { L } _ { x }$ , where
48
+
49
+ $$
50
+ \mathcal { L } _ { x } = \mathbb { E } _ { q ( z | x , \phi ) } \left[ \log p ( x | z ; \theta ) \right] - D _ { K L } \left( q ( z | x ; \phi ) \| p ( z ) \right) .
51
+ $$
52
+
53
+ Likewise the full-data log likelihood is lower bounded by the sum of the ${ \mathcal { L } } _ { x }$ terms over the whole dataset. We can then optimize this lower bound with respect to $\phi$ and $\theta$ using the reparameterization trick introduced by Kingma & Welling (2013) and Rezende et al. (2014) to get a Monte-Carlo estimate of the gradient.
54
+
55
+ # 3.2 BASIC MODEL
56
+
57
+ We extend the variational autoencoder to the model depicted on the left in Figure 1. This includes a latent variable $c$ , the context, that varies between different datasets but is constant, a priori, for items within the same dataset. Now, the likelihood of the parameters $\theta$ for one single particular dataset $D$ is given by
58
+
59
+ $$
60
+ p ( D ) = \int p ( c ) \left[ \prod _ { x \in D } \int p ( x | z ; \theta ) p ( z | c ; \theta ) d z \right] d c .
61
+ $$
62
+
63
+ The prior $p ( c )$ is chosen to be a spherical Gaussian with zero mean and unit variance. The conditional $p ( z | c ; \theta )$ is Gaussian with diagonal covariance, where all the mean and variance parameters depend on $c$ through a neural network. Similarly the observation model $p ( x | z ; \theta )$ will be a simple likelihood function appropriate to the data modality with dependence on $z$ parameterized by a neural network. For example, with real valued data, a diagonal Gaussian likelihood could be used where the mean and log variance of $x$ are created from $z$ via a neural network.
64
+
65
+ We use approximate inference networks $q ( \boldsymbol { z } | \boldsymbol { x } , c ; \phi )$ , $q ( c | D ; \phi )$ , with parameters collected into $\phi$ , to once again enable the calculation and optimization of a variational lower bound on the loglikelihood. The single dataset log likelihood lower bound is given by
66
+
67
+ $$
68
+ \begin{array}{c} \mathcal { L } _ { D } = \mathbb { E } _ { q ( c | D ; \phi ) } \left[ \sum _ { x \in d } \mathbb { E } _ { q ( z | c , x ; \phi ) } \left[ \log p ( x | z ; \theta ) \right] - D _ { K L } \left( q ( z | c , x ; \phi ) \| p ( z | c ; \theta ) \right) \right] \\ & { \phantom { = \ } - D _ { K L } \left( q ( c | D ; \phi ) \| p ( c ) \right) . } \end{array}
69
+ $$
70
+
71
+ As with the generative distributions, the likelihood forms for $q ( \boldsymbol { z } | \boldsymbol { x } , c ; \phi )$ and $q ( c | D ; \phi )$ are diagonal Gaussian distributions, where all the mean and log variance parameters in each distribution are produced by a neural network taking the conditioning variables as inputs. Note that $q ( c | D ; \phi )$ accepts as input a dataset $D$ and we refer to this as the statistic network. We describe this in Subsection 3.4.
72
+
73
+ The full-data variational bound is given by summing the variational bound for each dataset in our collection of datasets. It is by learning the difference of the within-dataset and between-dataset distributions that we are able to discover an appropriate statistic network.
74
+
75
+ # 3.3 FULL MODEL
76
+
77
+ The basic model works well for modelling simple datasets, but struggles when the datasets have complex internal structure. To increase the sophistication of the model we use multiple stochastic layers $z _ { 1 } , \ldots , z _ { k }$ and introduce skip-connections for both the inference and generative networks. The generative model is shown graphically in Figure 1 in the center. The probability of a dataset $D$ is then given by
78
+
79
+ $$
80
+ p ( D ) = \int p ( c ) \prod _ { x \in D } \int p ( x | c , z _ { 1 : L } ; \theta ) p ( z _ { L } | c ; \theta ) \prod _ { i = 1 } ^ { L - 1 } p ( z _ { i } | z _ { i + 1 } , c ; \theta ) d z _ { 1 : L } d c
81
+ $$
82
+
83
+ where the $p ( z _ { i } | z _ { i + 1 } , c , \theta )$ are again Gaussian distributions where the mean and log variance are given as the output of neural networks. The generative process for the full model is described in Algorithm 1.
84
+
85
+ The full approximate posterior factorizes analogously as
86
+
87
+ $$
88
+ q ( c , z _ { 1 : L } | D ; \phi ) = q ( c | D ; \phi ) \prod _ { x \in D } q ( z _ { L } | x , c ; \phi ) \prod _ { i = 1 } ^ { L - 1 } q ( z _ { i } | z _ { i + 1 } , x , c ; \phi ) .
89
+ $$
90
+
91
+ For convenience we give the variational lower bound as sum of a three parts, a reconstruction term $R _ { D }$ , a context divergence $C _ { D }$ and a latent divergence $L _ { D }$ :
92
+
93
+ $$
94
+ \begin{array} { l } { \displaystyle R _ { D } = \mathbb { E } _ { q ( c | D ; \phi ) } \sum _ { x \in D } \mathbb { E } _ { q ( z _ { 1 : L } | c , x ; \phi ) } \log p ( x | z _ { 1 : L } , c ; \theta ) } \\ { \displaystyle C _ { D } = D _ { K L } \left( q ( c | D ; \phi ) \| p ( c ) \right) } \\ { \displaystyle L _ { D } = \mathbb { E } _ { q ( c , z _ { 1 : L } | D ; \phi ) } \left[ \displaystyle \sum _ { x \in D } D _ { K L } \left( q ( z _ { L } | c , x ; \phi ) \| p ( z _ { L } | c ; \theta ) \right) \right. } \\ { \displaystyle \left. \qquad \quad + \displaystyle \sum _ { i = 1 } ^ { L - 1 } D _ { K L } \left( q ( z _ { i } | z _ { i + 1 } , c , x ; \phi ) \| p ( z _ { i } | z _ { i + 1 } , c ; \theta ) \right) \right] . } \end{array}
95
+ $$
96
+
97
+ The skip-connections $p ( z _ { i } | z _ { i + 1 } , c ; \theta )$ and $q ( z _ { i } | z _ { i + 1 } , x ; \phi )$ allow the context to specify a more precise distribution for each latent variable by explaining-away more generic aspects of the dataset at each stochastic layer. This architecture was inspired by recent work on probabilistic ladder networks in Kaae Sønderby et al. (2016). Complementing these are the skip-connections from each latent variable to the observation $p ( x | z _ { 1 : L } , c ; \theta )$ , the intuition here is that each stochastic layer can focus on representing a certain level of abstraction, since its information does not need to be copied into the next layer, a similar approach was used in Maaløe et al. (2016).
98
+
99
+ Once again, note that we are maximizing the lower bound to the log likelihood over many datasets $D$ : we want to maximize the expectation of $\mathcal { L } _ { D }$ over all datasets. We do this optimization using stochastic gradient descent. In contrast to a variational autoencoder where a minibatch would consist of a subsample of datapoints from the dataset, we use minibatches consisting of a subsample of datasets - tensors of shape (batch size, sample size, number of features).
100
+
101
+ # 3.4 STATISTIC NETWORK
102
+
103
+ In addition to the standard inference networks we require a statistic network $q ( c | D ; \phi )$ to give an approximate posterior over the context $c$ given a dataset $D = \{ x _ { 1 } , \ldots , x _ { k } \}$ . This inference network must capture the exchangeability of the data in $D$ .
104
+
105
+ We use a feedforward neural network consisting of three main elements:
106
+
107
+ • An instance encoder $E$ that takes each individual datapoint $x _ { i }$ to a vector $e _ { i } = E ( x _ { i } )$ . • An exchangeable instance pooling layer that collapses the matrix $( e _ { 1 } , \ldots , e _ { k } )$ to a single pre-statistic vector $v$ . Examples include elementwise means, sums, products, geometric means and maximum. We use the sample mean for all experiments. • A final post-pooling network that takes $v$ to a parameterization of a diagonal Gaussian.
108
+
109
+ The graphical model for this is given at the right of Figure 1.
110
+
111
+ We note that the humble sample mean already gives the statistic network a great deal of representational power due to the fact that the instance encoder can learn a representation where averaging makes sense. For example since the instance encoder can approximate a polynomial on a compact domain, and so can the post-pooling network, a statistic network can approximate any moment of a distribution.
112
+
113
+ # 4 RELATED WORK
114
+
115
+ Due to the general nature of the problem considered, our work touches on many different topics which we now attempt to summarize.
116
+
117
+ Topic models and graphical models The form of the graphical model in Figure 1 on the left is equivalent to that of a standard topic model. In contrast to traditional topic models we do not use discrete latent variables, or restrict to discrete data. Work such as that by Ranganath et al. (2014) has extended topic models in various directions, but importantly we use flexible conditional distributions and dependency structures parameterized by deep neural networks. Recent work has explored neural networks for document models (see e.g. Miao et al., 2015) but has been limited to modelling datapoints with little internal structure. Along related lines are ‘structured variational autoencoders’ (see Johnson et al., 2016), where they treat the general problem of integrating graphical models with variational autoencoders.
118
+
119
+ Transfer learning There is a considerable literature on transfer learning, for a survey see Pan & Yang (2010). There they discuss ‘parameter-transfer’ approaches whereby parameters or priors are shared across datasets, and our work fits into that paradigm. For examples see Lawrence & Platt (2004) where share they priors between Gaussian processes, and Evgeniou & Pontil (2004) where they take an SVM-like approach to share kernels.
120
+
121
+ One-shot Learning Learning quickly from small amounts of data is a topic of great interest. Lake et al. (2015) use Bayesian program induction for one-shot generation and classification, and Koch (2015) train a Siamese (Chopra et al. (2005)) convolutional network for one-shot image classification. We note the relation to the recent work (Rezende et al., 2016) in which the authors use a conditional recurrent variational autoencoder capable of one-shot generalization by taking as extra input a conditioning data point. The important differences here are that we jointly model datasets and datapoints and consider datasets of any size. Recent approaches to one-shot classification are matching networks (Vinyals et al., 2016b) (which was concurrent with the initial preprint of this work), and related previous work (Santoro et al., 2016). The former can be considered a kind of differentiable nearest neighbour classifier, and the latter augments their network with memory to store information about the classification problem. Both are trained end-to-end for the classification problem, whereas the present work is a general approach to learning representations of datasets. Probably the closest previous work is by Salakhutdinov et al. (2012) where the authors learn a topic model over the activations of a DBM for one-shot learning. Compared with their work we use modern architectures and easier to train VAEs, in particular we have fast and amortized feedforward inference for test (and training) datasets, avoiding the need for MCMC.
122
+
123
+ Multiple-Instance Learning There is previous work on classifying sets in multiple-instance learning, for a useful survey see Cheplygina et al. (2015). Typical approaches involve adapting kernel based methods such as support measure machines (Muandet et al., 2012), support distribution machines (Poczos et al., 2012) and ´ multiple-instance-kernels (Gartner et al., 2002). We do not consider applications to multiple-instance learning type problems here, but it may be fruitful to do so in the future.
124
+
125
+ Set2Seq In very related work, Vinyals et al. (2016a) explore architectures for mapping sets to sequences. There they use an LSTM to repeatedly compute weighted-averages of the datapoints and use this to tackle problems such as sorting a list of numbers. The main difference between their work and ours is that they primarily consider supervised problems, whereas we present a general unsupervised method for learning representations of sets of i.i.d instances. In future work we may also explore recurrently computing statistics.
126
+
127
+ ABC There has also been work on learning summary statistics for Approximate Bayesian Computation by either learning to predict the parameters generating a sample as a supervised problem, or by using kernel embeddings as infinite dimensional summary statistics. See the work by Fukumizu et al. (2013) for an example of kernel-based approaches. More recently Jiang et al. (2015) used deep neural networks to predict the parameters generating the data. The crucial differences are that their problem is supervised, they do not leverage any exchangeability properties the data may have, nor can it deal with varying sample sizes.
128
+
129
+ # 5 EXPERIMENTAL RESULTS
130
+
131
+ Given an input set $x _ { 1 } , \ldots x _ { k }$ we can use the statistic network to calculate an approximate posterior over contexts $q ( c | x _ { 1 } , \ldots , x _ { k } ; \phi )$ . Under the generative model, each context $c$ specifies a conditional model $p ( x | c ; \bar { \theta } )$ . To get samples from the model corresponding to the most likely posterior value of $c$ , we set $c$ to the mean of the approximate posterior and then sample directly from the conditional distributions. This is described in Algorithm 2. We use this process in our experiments to show samples. In all experiments, we use the Adam optimization algorithm (Kingma & Ba, 2014) to optimize the parameters of the generative models and variational approximations. Batch normalization (Ioffe & Szegedy, 2015) is implemented for convolutional layers and we always use a batch size of 16. We primarily use the Theano (Theano Development Team, 2016) framework with the Lasagne (Dieleman et al., 2015) library, but the final experiments with face data were done using Tensorflow (Abadi et al., 2015). In all cases experiments were terminated after a given number of epochs when training appeared to have sufficiently converged (300 epochs for omniglot, youtube and spatial MNIST examples, and 50 epochs for the synthetic experiment).
132
+
133
+ # 5.1 SIMPLE 1-D DISTRIBUTIONS
134
+
135
+ In our first experiment we wanted to know if the neural statistician will learn to cluster synthetic 1-D datasets by distribution family. We generated a collection of synthetic 1-D datasets each containing 200 samples. Datasets consist of samples from either an Exponential, Gaussian, Uniform or Laplacian distribution with equal probability. Means and variances are sampled from $U [ - 1 , 1 ]$ and $U [ \bar { 0 } . 5 , 2 ]$ respectively. The training data contains $1 0 K$ sets.
136
+
137
+ The architecture for this experiment contains a single stochastic layer with 32 units for $z$ and 3 units for $c _ { \cdot }$ , . The model $p ( \boldsymbol { x } | \boldsymbol { z } , c ; \boldsymbol { \theta } )$ and variational approximation $\dot { q ( \boldsymbol { z } | \boldsymbol { x } , \boldsymbol { c } ; \boldsymbol { \phi } ) }$ are each a diagonal Gaussian distribution with all mean and log variance parameters given by a network composed of three dense layers with ReLU activations and 128 units. The statistic network determining the mean and log variance parameters of posterior over context variables is composed of three dense layers before and after pooling, each with 128 units with Rectified Linear Unit (ReLU) activations.
138
+
139
+ Figure 2 shows 3-D scatter plots of the summary statistics learned. Notice that the different families of distribution cluster. It is interesting to observe that the Exponential cluster is differently orientated to the others, perhaps reflecting the fact that it is the only non-symmetric distribution. We also see that between the Gaussian and Laplacian clusters there is an area of ambiguity which is as one might expect. We also see that within each cluster the mean and variance are mapped to orthogonal directions.
140
+
141
+ ![](images/e82aa8476b90fc3fe6c80a77c4987d5d4f95485cd667e79fb1c7bdb8913f02e9.jpg)
142
+ Figure 2: Three different views of the same data. Each point is the mean of the approximate posterior over the context $q ( c | D ; \phi )$ where $c \in \mathbb { R } ^ { 3 }$ . Each point is a summary statistic for a single dataset with 200 samples. Top plot shows points colored by distribution family, left plot colored by the mean and right plot colored by the variance. The plots have been rotated to illustrative angles.
143
+
144
+ # 5.2 SPATIAL MNIST
145
+
146
+ Building on the previous experiments we investigate 2-D datasets that have complex structure, but the datapoints contain little information by themselves, making it a good test of the statistic network. We created a dataset called spatial MNIST. In spatial MNIST each image from MNIST (LeCun et al., 1998) is turned into a dataset by interpreting the normalized pixel intensities as a probability density and sampling coordinate values. An example is shown in Figure 3. This creates two-dimensional spatial datasets. We used a sample size of 50. Note that since the pixel coordinates are discrete, it is necessary to dequantize them by adding uniform noise $u \sim U [ 0 , 1 ]$ to the coordinates if one models them as real numbers, else you can get arbitrarily high densities (see Theis et al. (2016) for a discussion of this point).
147
+
148
+ ![](images/5260004343dab07772be2c07e4ccd346a980af8a90502f574063c61798f31e23.jpg)
149
+ Figure 3: An image from MNIST on the left, transformed to a set of 50 $( x , y )$ coordinates, shown as a scatter plot on the right.
150
+
151
+ The generative architecture for this experiment contains 3 stochastic $z$ layers, each with 2 units, and a single $c$ layer with 64 units. The means and log variances of the Gaussian likelihood for $p ( x | z _ { 1 : 3 } , \bar { c } ; \theta )$ , and each subnetwork for $z$ in both the encoder and decoder contained 3 dense layers with 256 ReLU units each. The statistic network also contained 3 dense layers pre-pooling and 3 dense layers post pooling with 256 ReLU units.
152
+
153
+ In addition to being able to sample from the model conditioned on a set of inputs, we can also summarize a dataset by choosing a subset $S \subseteq D$ to minimise the KL divergence of $q ( C | D ; \phi )$ from $q ( C | S ; \phi )$ . We do this greedily by iteratively discarding points from the full sample. Pseudocode for this process is given in Algorithm 3. The results are shown in Figure 4. We see that the model is capable of handling complex arrangements of datapoints. We also see that it can select sensible subsets of a dataset as a summary.
154
+
155
+ # 5.3 OMNIGLOT
156
+
157
+ Next we work with the OMNIGLOT data (Lake et al., 2015). This contains 1628 classes of handwritten characters but with just 20 examples per class. This makes it an excellent test-bed for transfer / few-shot learning. We constructed datasets by splitting each class into datasets of size 5. We train on datasets drawn from 1200 classes and reserve the remaining classes to test few-shot sampling and classification. We created new classes by rotating and reflecting characters. We resized the images to $2 8 \times 2 8$ . We sampled a binarization of each image for each epoch. We also randomly applied the dilation operator from computer vision as further data augmentation since we observed that the stroke widths are quite uniform in the OMNIGLOT data, whereas there is substantial variation in MNIST, this augmentation improved the visual quality of the few-shot MNIST samples considerably and increased the few-shot classification accuracy by about 3 percent. Finally we used ‘sample dropout’ whereby a random subset of each dataset was removed from the pooling in the statistic network, and then included the number of samples remaining as an extra feature. This was beneficial since it reduced overfitting and also allowed the statistic network to learn to adjust the approximate posterior over $c$ based on the number of samples.
158
+
159
+ ![](images/28105ff1bd0578e7f26caba92274867ed296cc4f906f44fda9289ea57607f180.jpg)
160
+ Figure 4: Conditioned samples from spatial MNIST data. Blue and red digits are the input sets, black digits above correspond to samples given the input. Red points correspond to a 6-sample summary of the dataset
161
+
162
+ ![](images/c4d7da7a84dd63fbee15ce45457934785ddee8a48d232a86fb352d939fe0c78a.jpg)
163
+ Figure 5: Few-shot learning Left: Few-shot learning from OMNIGLOT to MNIST. Left rows are input sets, right rows are samples given the inputs. Right: Few-shot learning from with OMNIGLOT data to unseen classes. Left rows are input sets, right rows are samples given the inputs. Black-white inversion is applied for ease of viewing.
164
+
165
+ We used a single stochastic layer with 16 units for $z$ , and 512 units for $c$ . We used a shared convolutional encoder between the inference and statistic networks and a deconvolutional decoder network. Full details of the networks are given in Appendix B.1. The decoder used a Bernoulli likelihood.
166
+
167
+ In Figure 5 we show two examples of few-shot learning by conditioning on samples of unseen characters from OMNIGLOT, and conditioning on samples of digits from MNIST. The samples are mostly of a high-quality, and this shows that the neural statistician can generalize even to new datasets.
168
+
169
+ As a further test we considered few-shot classification of both unseen OMNIGLOT characters and MNIST digits. Given a sets of labelled examples of each class $D _ { 0 } , \ldots , D _ { 9 }$ (for MNIST say), we computed the approximate posteriors $q ( C | D _ { i } ; \phi )$ using the statistic network. Then for each test image $x$ we also computed the posterior $q ( C | x ; \phi )$ and classified it according to the training dataset $D _ { i }$ minimizing the KL divergence from the test context $t o$ the training context. This process is described in Algorithm 4. We tried this with either 1 or 5 labelled examples per class and either 5 or 20 classes. For each trial we randomly select $K$ classes, randomly select training examples for each class, and test on the remaining examples. This process is repeated 100 times and the results averaged. The results are shown in Table 1. We compare to a number of results reported in Vinyals et al. (2016b) including Santoro et al. (2016) and Koch (2015). Overall we see that the neural statistician model can be used as a strong classifier, particularly for the 5-way tasks, but performs worse than matching networks for the 20-way tasks. One important advantage that matching networks have is that, whilst each class is processed independently in our model, the representation in matching networks is conditioned on all of the classes in the few-shot problem. This means that it can exaggerate differences between similar classes, which are more likely to appear in a 20-way problem than a 5-way problem.
170
+
171
+ <table><tr><td colspan="3">Task</td><td rowspan="2"></td><td colspan="3">Method</td></tr><tr><td>Test Dataset</td><td>K Shot</td><td>K Way</td><td>Siamese</td><td>MANN</td><td>Matching Ours</td></tr><tr><td>MNIST</td><td>1</td><td>10</td><td>70</td><td>=</td><td>72</td><td>78.6</td></tr><tr><td>MNIST</td><td>5</td><td>10</td><td>=</td><td>=</td><td>=</td><td>93.2</td></tr><tr><td>OMNIGLOT</td><td>1</td><td>5</td><td>97.3</td><td>82.8</td><td>98.1</td><td>98.1</td></tr><tr><td>OMNIGLOT</td><td>5</td><td>5</td><td>98.4</td><td>94.9</td><td>98.9</td><td>99.5</td></tr><tr><td>OMNIGLOT</td><td>1</td><td>20</td><td>88.1</td><td>-</td><td>93.8</td><td>93.2</td></tr><tr><td>OMNIGLOT</td><td>5</td><td>20</td><td>97.0</td><td>=</td><td>98.7</td><td>98.1</td></tr></table>
172
+
173
+ Table 1: The table shows the classification accuracies of various few-shot learning tasks. Models are trained on OMNIGLOT data and tested on either unseen OMNIGLOT classes or MNIST with varying numbers of samples per class (K-shot) with varying numbers of classes (K-way). Comparisons are to Vinyals et al. (2016b) (Matching), Santoro et al. (2016) (MANN) and Koch (2015) (Siamese). 5-shot MNIST results are included for completeness.
174
+
175
+ # 5.4 YOUTUBE FACES
176
+
177
+ ![](images/fafb5e74c2af1ea1f3189d1b879c5489693d5f0f55cb2ce7cdf8398d5995f5eb.jpg)
178
+ Figure 6: Few-shot learning for face data. Samples are from model trained on Youtube Faces Database. Left: Each row shows an input set of size 5. Center: Each row shows 5 samples from the model corresponding to the input set on the left. Right: Imagined new faces generated by sampling contexts from the prior. Each row consists of 5 samples from the model given a particular sampled context.
179
+
180
+ Finally, we provide a proof of concept for generating faces of a particular person. We use the Youtube Faces Database from Wolf et al. (2011). It contains 3, 245 videos of 1, 595 different people. We use the aligned and cropped to face version, resized to $6 4 \times 6 4$ . The validation and test sets contain 100 unique people each, and there is no overlap of persons between data splits. The sets were created by sampling frames randomly without replacement from each video, we use a set size of 5 frames. We resample the sets for the training data each epoch.
181
+
182
+ Our architecture for this problem is based on one presented in Lamb et al. (2016). We used a single stochastic layer with 500 dimensional latent $c$ and 16 dimensional $z$ variable. The statistic network and the inference network $q ( \boldsymbol { z } | \boldsymbol { x } , c ; \phi )$ share a common convolutional encoder, and the deocder uses deconvolutional layers. For full details see Appendix B.2. The likelihood function is a Gaussian, but where the variance parameters are shared across all datapoints, this was found to make training faster and more stable.
183
+
184
+ The results are shown in Figure 6. Whilst there is room for improvement, we see that it is possible to specify a complex distribution on-the-fly with a set of photos of a previously unseen person. The samples conditioned on an input set have a reasonable likeness of the input faces. We also show the ability of the model to generate new datasets and see that the samples have a consistent identity and varied poses.
185
+
186
+ # 6 CONCLUSION
187
+
188
+ We have demonstrated a highly flexible model on a variety of tasks. Going forward our approach will naturally benefit from advances in generative models as we can simply upgrade our base generative model, and so future work will pursue this. Compared with some other approaches in the literature for few-shot learning, our requirement for supervision is weaker: we only ask at training time that we are given datasets, but we do not need labels for the datasets, nor even information on whether two datasets represent the same or different classes. It would be interesting then to explore application areas where only this weaker form of supervision is available. There are two important limitations to this work, firstly that the method is dataset hungry: it will likely not learn useful representations of datasets given only a small number of them. Secondly at test time the few-shot fit of the generative model will not be greatly improved by using larger datasets unless the model was also trained on similarly large datasets. The latter limitation seems like a promising future research direction - bridging the gap between fast adaptation and slow training.
189
+
190
+ # ACKNOWLEDGMENTS
191
+
192
+ This work was supported in part by the EPSRC Centre for Doctoral Training in Data Science, funded by the UK Engineering and Physical Sciences Research Council (grant EP/L016427/1) and the University of Edinburgh.
193
+
194
+ # REFERENCES
195
+
196
+ Mart´ın Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, and Zhifeng Chen et al. TensorFlow: Large-scale machine learning on heterogeneous systems, 2015. URL http://tensorflow. org/. Software available from tensorflow.org.
197
+ Veronika Cheplygina, David M.J. Tax, and Marco Loog. On classification with bags, groups and sets. Pattern Recognition Letters, 59:11 – 17, 2015.
198
+ S. Chopra, R. Hadsell, and Y. LeCun. Learning a similarity metric discriminatively, with application to face verification. In Computer Vision and Pattern Recognition, 2005. CVPR 2005. IEEE Computer Society Conference on, pp. 539–546 Vol. 1, June 2005.
199
+ Sander Dieleman, Jan Schluter, Colin Raffel, Eben Olson, SK Sønderby, D Nouri, D Maturana, ¨ M Thoma, E Battenberg, J Kelly, et al. Lasagne: First release. Zenodo: Geneva, Switzerland, 2015.
200
+ Theodoros Evgeniou and Massimiliano Pontil. Regularized multi–task learning. In Proceedings of the tenth ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 109–117. ACM, 2004.
201
+ Kenji Fukumizu, Le Song, and Arthur Gretton. Kernel Bayes’ rule: Bayesian inference with positive definite kernels. The Journal of Machine Learning Research, 14(1):3753–3783, 2013.
202
+ Thomas Gartner, Peter A. Flach, Adam Kowalczyk, and Alex J. Smola. Multi-instance kernels. In In Proc. 19th International Conf. on Machine Learning, pp. 179–186. Morgan Kaufmann, 2002.
203
+ 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, pp. 448–456, 2015.
204
+
205
+ Bai Jiang, Tung-yu Wu, Charles Zheng, and Wing H Wong. Learning summary statistic for approximate Bayesian computation via deep neural network. arXiv preprint arXiv:1510.02175, 2015.
206
+
207
+ Matthew J Johnson, David Duvenaud, Alexander B Wiltschko, Sandeep R Datta, and Ryan P Adams. Structured vaes: Composing probabilistic graphical models and variational autoencoders. arXiv preprint arXiv:1603.06277, 2016.
208
+
209
+ Casper Kaae Sønderby, Tapani Raiko, Lars Maaløe, Søren Kaae Sønderby, and Ole Winther. How to train deep variational autoencoders and probabilistic ladder networks. arXiv preprint arXiv:1602.02282, 2016.
210
+
211
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
212
+
213
+ Diederik P Kingma and Max Welling. Auto-encoding variational Bayes. In Proceedings of the 2nd International Conference on Learning Representations (ICLR), number 2014, 2013.
214
+
215
+ Gregory Koch. Siamese neural networks for one-shot image recognition. Doctoral dissertation, University of Toronto, 2015.
216
+
217
+ Brenden M Lake, Ruslan Salakhutdinov, and Joshua B Tenenbaum. Human-level concept learning through probabilistic program induction. Science, 350(6266):1332–1338, 2015.
218
+
219
+ Alex Lamb, Vincent Dumoulin, and Aaron Courville. Discriminative regularization for generative models. arXiv preprint arXiv:1602.03220, 2016.
220
+
221
+ Neil D Lawrence and John C Platt. Learning to learn with the informative vector machine. In Proceedings of the twenty-first international conference on Machine learning, pp. 65. ACM, 2004.
222
+
223
+ Yann LeCun, Leon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to ´ document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
224
+
225
+ Lars Maaløe, Casper Kaae Sønderby, Søren Kaae Sønderby, and Ole Winther. Auxiliary deep generative models. arXiv preprint arXiv:1602.05473, 2016.
226
+
227
+ Yishu Miao, Lei Yu, and Phil Blunsom. Neural variational inference for text processing. arXiv preprint arXiv:1511.06038, 2015.
228
+
229
+ Krikamol Muandet, Kenji Fukumizu, Francesco Dinuzzo, and Bernhard Schlkopf. Learning from distributions via support measure machines. In P. Bartlett, FCN. Pereira, CJC. Burges, L. Bottou, and KQ. Weinberger (eds.), Advances in Neural Information Processing Systems 25, pp. 10–18. 2012.
230
+
231
+ Sinno Jialin Pan and Qiang Yang. A survey on transfer learning. Knowledge and Data Engineering, IEEE Transactions on, 22(10):1345–1359, 2010.
232
+
233
+ Barnabas P ´ oczos, Liang Xiong, Dougal J Sutherland, and Jeff Schneider. Support distribution ma- ´ chines. Technical Report, 2012. URL http://arxiv.org/abs/1202.0302.
234
+
235
+ Rajesh Ranganath, Sean Gerrish, and David M Blei. Black box variational inference. In AISTATS, pp. 814–822, 2014.
236
+
237
+ Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. In Proceedings of The 31st International Conference on Machine Learning, pp. 1278–1286, 2014.
238
+
239
+ Danilo Jimenez Rezende, Shakir Mohamed, Ivo Danihelka, Karol Gregor, and Daan Wierstra. Oneshot generalization in deep generative models. arXiv preprint arXiv:1603.05106, 2016.
240
+
241
+ Ruslan Salakhutdinov, Joshua B Tenenbaum, and Antonio Torralba. One-shot learning with a hierarchical nonparametric bayesian model. In ICML Unsupervised and Transfer Learning, pp. 195–206, 2012.
242
+
243
+ Adam Santoro, Sergey Bartunov, Matthew Botvinick, Daan Wierstra, and Timothy Lillicrap. Oneshot learning with memory-augmented neural networks. arXiv preprint arXiv:1605.06065, 2016.
244
+
245
+ Lawrence K Saul and Michael I Jordan. Exploiting tractable substructures in intractable networks. In Advances in Neural Processing Systems 8, 1996.
246
+
247
+ Theano Development Team. Theano: A Python framework for fast computation of mathematical expressions. arXiv e-prints, abs/1605.02688, May 2016. URL http://arxiv.org/abs/ 1605.02688.
248
+
249
+ L. Theis, A. van den Oord, and M. Bethge. A note on the evaluation of generative models. In International Conference on Learning Representations (ICLR), 2016.
250
+
251
+ Oriol Vinyals, Samy Bengio, and Manjunath Kudlur. Order matters: sequence to sequence for sets. In International Conference on Learning Representations (ICLR), 2016a.
252
+
253
+ Oriol Vinyals, Charles Blundell, Timothy Lillicrap, Koray Kavukcuoglu, and Daan Wierstra. Matching networks for one shot learning. arXiv preprint arXiv:1606.04080, 2016b.
254
+
255
+ Lior Wolf, Tal Hassner, and Itay Maoz. Face recognition in unconstrained videos with matched background similarity. In Computer Vision and Pattern Recognition (CVPR), 2011 IEEE Conference on, pp. 529–534. IEEE, 2011.
256
+
257
+ # A APPENDIX A: PSEUDOCODE
258
+
259
+ # Algorithm 1 Sampling a dataset of size $k$
260
+
261
+ sample $c \sim p ( c )$
262
+ for $i = 1$ to $k$ do sample $z _ { i , L } \sim p ( z _ { L } | c ; \theta )$ for $j = L - 1$ to 1 do sample $z _ { i , j } \sim p ( z _ { j } | z _ { i , j + 1 } , c ; \theta )$ end for sample $x _ { i } \sim p ( x | z _ { i , 1 } , . . . , z _ { i , L } , c ; \theta )$
263
+ end for
264
+
265
+ <table><tr><td>Algorithm 2 Sampling a dataset of size k conditioned on a dataset of size m</td></tr><tr><td>μc,O² ← q(c|x1,...,Xm; Φ) {Calculate approximate posterior over c using statistic network.} c ← μc {Set c to be the mean of the approximate posterior.}</td></tr><tr><td>fori=1 to k do sample zi,L ~ p(zLlc; 0)</td></tr><tr><td>forj=L-1to1do</td></tr><tr><td>sample zi,j ~ p(zj|zi,j+1,C;0)</td></tr><tr><td>end for</td></tr><tr><td></td></tr><tr><td>sample xi ~p(x|zi,1,.., Zi,L,c;0)</td></tr></table>
266
+
267
+ # Algorithm 3 Selecting a representative sample of size $k$
268
+
269
+ S ← {x1, . . . , xm}
270
+ I ← {1, . . . , m}
271
+ SI = {xi ∈ S : i ∈ I}
272
+ $N _ { S _ { I } } q ( c | S _ { I } ; \phi )$ {Calculate approximate posterior over $c$ using statistic network.}
273
+ for $i = 1$ to $k$ do $\begin{array} { l } { t \gets a r g m i n _ { j \in I } D _ { K L } \left( N _ { S } \| N _ { S _ { I - j } } \right) } \\ { I \gets I - t } \end{array}$
274
+ end for
275
+
276
+ <table><tr><td>Algorithm4K-way few-shot classification</td></tr><tr><td>Do,...,Dk ← sets of labelled examples for each class</td></tr><tr><td>x ← datapoint to be classified</td></tr><tr><td>Nx ← q(c|x;) {approximate posterior over c given query point}</td></tr><tr><td>for i=1 to K do</td></tr><tr><td>Ni ← q(c|Di;Φ)</td></tr><tr><td>end for</td></tr><tr><td>y ←argminiDkL (NillNx)</td></tr></table>
277
+
278
+ # B APPENDIX B: FURTHER EXPERIMENTAL DETAILS
279
+
280
+ # B.1 OMNIGLOT
281
+
282
+ # Shared encoder $x \to h$
283
+
284
+ $\overline { { 2 \times \left\{ \begin{array} { l } { c o n \nu 2 d 6 4 } \end{array} \right. } }$ feature maps with $3 \times 3$ kernels and ELU activations } conv2d 64 feature maps with $3 \times 3$ kernels, stride 2 and ELU activations $2 \times \left\{ c o n \nu 2 d 1 2 \ 8 \right.$ feature maps with $3 \times 3$ kernels and ELU activations $\}$ conv2d 128 feature maps with $3 \times 3$ kernels, stride 2 and ELU activations $2 \times \{ c o n \nu 2 d 2 5 6$ feature maps with $3 \times 3$ kernels and ELU activations $\}$ conv2d 256 feature maps with $3 \times 3$ kernels, stride 2 and ELU activations
285
+
286
+ Statistic network $q ( c | D ; \phi ) : h _ { 1 } , \ldots , h _ { k } \to \mu _ { c } , \sigma _ { c } ^ { 2 }$ fully-connected layer with 256 units and ELU activations sample-dropout and concatenation with number of samples average pooling within each dataset $2 \times$ {fully-connected layer with 256 units and ELU activations $\}$ fully-connected linear layers to $\mu _ { c }$ and $\log \sigma _ { c } ^ { 2 }$
287
+
288
+ # Inference network $q ( z | x , c ; \phi ) : h , c \to \mu _ { z } , \sigma _ { z } ^ { 2 }$
289
+
290
+ concatenate c and $\overline { { h } }$ $3 \times$ {fully-connected layer with 256 units and ELU activations $\}$ fully-connected linear layers to $\mu _ { z }$ and $\log \sigma _ { z } ^ { 2 }$
291
+
292
+ Latent decoder network $p ( z | c ; \theta ) : c \mu _ { z } , \sigma _ { z } ^ { 2 }$ $\overline { { 3 \times } }$ {fully-connected layer with 256 units and ELU activations } fully-connected linear layers to $\mu _ { z }$ and $\log \sigma _ { z } ^ { 2 }$
293
+
294
+ # Observation decoder network $p ( x | c , z ; \theta ) : c , z \to \mu _ { x }$
295
+
296
+ concatenate $z$ and $c$ fully-connected linear layers with $4 \cdot 4 \cdot 2 5 6$ units $2 \times \ \left\{ \begin{array} { r l } \end{array} \right.$ { conv2d 256 feature maps with $3 \times 3$ kernels and ELU activations $\}$ deconv2d 256 feature maps with $2 \times 2$ kernels, stride 2, ELU activations $2 \times \left\{ \begin{array} { r l } \end{array} \right.$ { conv2d 128 feature maps with $3 \times 3$ kernels and ELU activations $\}$ deconv2d 128 feature maps with $2 \times 2$ kernels, stride 2, ELU activations $2 \times \left\{ \begin{array} { r l } \end{array} \right.$ { conv2d 64 feature maps with $3 \times 3$ kernels and ELU activations $\}$ deconv $2 d 6 4$ feature maps with $2 \times 2$ kernels, stride 2, ELU activations conv2d 1 feature map with $1 \times 1$ kernels, sigmoid activations
297
+
298
+ # B.2 YOUTUBE FACES
299
+
300
+ # Shared encoder $x \to h$
301
+
302
+ $\overline { { 2 \times \{ \ c o n \nu 2 d \} 3 2 } }$ feature maps with $\overline { { 3 \times 3 } }$ kernels and ELU activations $ { \mathfrak { J } }$ conv2d 32 feature maps with $3 \times 3$ kernels, stride 2 and ELU activations $2 \times \left\{ c o n \nu 2 d \ : 6 4 \right.$ feature maps with $3 \times 3$ kernels and ELU activations $\}$ conv2d 64 feature maps with $3 \times 3$ kernels, stride 2 and ELU activations $2 \times \left\{ \begin{array} { l l } { c o n \nu 2 d 1 2 8 } \end{array} \right.$ feature maps with $3 \times 3$ kernels and ELU activations $\}$ conv2d 128 feature maps with $3 \times 3$ kernels, stride 2 and ELU activations $2 \times \{ c o n \nu 2 d 2 5 6$ feature maps with $3 \times 3$ kernels and ELU activations $\}$ conv2d 256 feature maps with $3 \times 3$ kernels, stride 2 and ELU activations
303
+
304
+ Statistic network $q ( c | D , \phi ) : h _ { 1 } , \ldots , h _ { k } \to \mu _ { c } , \sigma _ { c } ^ { 2 }$ fully-connected layer with 1000 units and ELU activations average pooling within each dataset fully-connected linear layers to $\mu _ { c }$ and $\log \sigma _ { c } ^ { 2 }$
305
+
306
+ Inference network $q ( z | x , c , \phi ) : h , c \to \mu _ { z } , \sigma _ { z } ^ { 2 }$ concatenate c and $\overline { { h } }$ fully-connected layer with 1000 units and ELU activations fully-connected linear layers to $\mu _ { z }$ and $\log \sigma _ { z } ^ { 2 }$
307
+
308
+ Latent decoder network $p ( z | c , ; \theta ) : c \mu _ { z } , \sigma _ { z } ^ { 2 }$ fully-connected layer with 1000 units and ELU activations fully-connected linear layers to $\mu _ { z }$ and $\log \sigma _ { z } ^ { 2 }$
309
+
310
+ # Observation decoder network $p ( x | c , z ; \theta ) : c , z \mu _ { x }$
311
+
312
+ concatenate $z$ and $c$ fully-connected layer with 1000 units and ELU activations fully-connected linear layer with $8 \cdot 8 \cdot 2 5 6$ units $2 \times \left\{ \begin{array} { r l } \end{array} \right.$ { conv2d 256 feature maps with $3 \times 3$ kernels and ELU activations $\}$ deconv2d 256 feature maps with $2 \times 2$ kernels, stride 2, ELU activations $2 \times \left\{ \begin{array} { r l } \end{array} \right.$ { conv2d 128 feature maps with $3 \times 3$ kernels and ELU activations $\}$ deconv2d 128 feature maps with $2 \times 2$ kernels, stride 2, ELU activations $\gtrsim \gtrsim \left\{ c o n \nu 2 d 6 4 \right.$ feature maps with $3 \times 3$ kernels and ELU activations $\}$ deconv $2 d 6 4$ feature maps with $2 \times 2$ kernels, stride 2, ELU activations $2 \times \left\{ \begin{array} { r l } \end{array} \right.$ { conv2d 32 feature maps with $3 \times 3$ kernels and ELU activations $\}$ deconv $2 d 3 2$ feature maps with $2 \times 2$ kernels, stride 2, ELU activations conv2d 3 feature maps with $1 \times 1$ kernels, sigmoid activations
md/train/HJGXzmspb/HJGXzmspb.md ADDED
@@ -0,0 +1,327 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TRAINING AND INFERENCE WITH INTEGERS IN DEEP NEURAL NETWORKS
2
+
3
+ Shuang $\mathbf { W } \mathbf { u } ^ { 1 }$ , Guoqi $\mathbf { L i } ^ { 1 }$ , Feng Chen2, Luping Shi1
4
+
5
+ 1Department of Precision Instrument
6
+ 2Department of Automation
7
+ Center for Brain Inspired Computing Research
8
+ Beijing Innovation Center for Future Chip
9
+ Tsinghua University
10
+ {lpshi,chenfeng}@mail.tsinghua.edu.cn
11
+
12
+ # ABSTRACT
13
+
14
+ Researches on deep neural networks with discrete parameters and their deployment in embedded systems have been active and promising topics. Although previous works have successfully reduced precision in inference, transferring both training and inference processes to low-bitwidth integers has not been demonstrated simultaneously. In this work, we develop a new method termed as “WAGE” to discretize both training and inference, where weights (W), activations (A), gradients (G) and errors (E) among layers are shifted and linearly constrained to low-bitwidth integers. To perform pure discrete dataflow for fixed-point devices, we further replace batch normalization by a constant scaling layer and simplify other components that are arduous for integer implementation. Improved accuracies can be obtained on multiple datasets, which indicates that WAGE somehow acts as a type of regularization. Empirically, we demonstrate the potential to deploy training in hardware systems such as integer-based deep learning accelerators and neuromorphic chips with comparable accuracy and higher energy efficiency, which is crucial to future AI applications in variable scenarios with transfer and continual learning demands.
15
+
16
+ # 1 INTRODUCTION
17
+
18
+ Recently deep neural networks (DNNs) are being widely used for numerous AI applications (Krizhevsky et al., 2012; Hinton et al., 2012; Silver et al., 2016). Depending on the massive tunable parameters, DNNs are considered to have powerful multi-level feature extraction and representation abilities. However, training DNNs needs energy-intensive devices such as GPU and CPU with high precision (float32) processing units and abundant memory, which has greatly challenged their extensive applications for portable devices. In addition, a state-of-art network often has far more weights and effective capacity to shatter all training samples (Zhang et al., 2016), leading to overfitting easily.
19
+
20
+ As a result, there is much interest in reducing the size of network during inference (Hubara et al., 2016; Rastegari et al., 2016; Li et al., 2016), as well as dedicated hardware for commercial solutions (Jouppi et al., 2017; Chen et al., 2017; Shi et al., 2015). Due to the accumulation in stochastic gradient descent (SGD) optimization, the precision demand for training is usually higher than inference (Hubara et al., 2016; Li et al., 2017). Therefore, most of the existing techniques only focus on the deployment of a well-trained compressed network, while still keeping high precision and computational complexity during training. In this work, we address this problem as how to process both training and inference with low-bitwidth integers, which is essential for implementing DNNs in dedicated hardware. To this end, two fundamental issues are addressed for discretely training DNNs: i) how to quantize all the operands and operations, and ii) how many bits or states are needed for SGD computation and accumulation.
21
+
22
+ With respect to the issues, we propose a framework termed as “WAGE” that constrains weights (W), activations (A), gradients (G) and errors (E) among all layers to low-bitwidth integers in both training and inference. Firstly, for operands, linear mapping and orientation-preserved shifting are applied to achieve ternary weights, 8-bit integers for activations and gradients accumulation. Secondly, for operations, batch normalization (Ioffe & Szegedy, 2015) is replaced by a constant scaling factor. Other techniques for fine-tuning such as SGD optimizer with momentum and L2 regularization are simplified or abandoned with little performance degradation. Considering the overall bidirectional propagation, we completely streamline inference into accumulate-compare cycles and training into low-bitwidth multiply-accumulate (MAC) cycles with alignment operations, respectively.
23
+
24
+ We heuristically explore the bitwidth requirements of integers for error computation and gradient accumulation, which have rarely been discussed in previous works. Experiments indicate that it is the relative values (orientations) rather than absolute values (orders of magnitude) in error that guides previous layers to converge. Moreover, small values have negligible effects on previous orientations though propagated layer by layer, which can be partially discarded in quantization. We leverage these phenomena and use an orientation-preserved shifting operation to constrain errors. As for the gradient accumulation, though weights are quantized to ternary values in inference, a relatively higher bitwidth is indispensable to store and accumulate gradient updates.
25
+
26
+ The proposed framework is evaluated on MNIST, CIFAR10, SVHN, ImageNet datasets. Comparing to those who only discretize weights and activations at inference time, it has comparable accuracy and can further alleviate overfitting, indicating some type of regularization. WAGE produces pure bidirectional low-precision integer dataflow for DNNs, which can be applied for training and inference in dedicated hardware neatly. We publish the code on GitHub1.
27
+
28
+ # 2 RELATED WORK
29
+
30
+ We mainly focus on reducing precision of operands and operations in both training and inference. Orthogonal and complementary techniques for reducing complexity like network compression, pruning (Han et al., 2015; Zhou et al., 2017) and compact architectures (Howard et al., 2017) are impressively efficient but outside the scope this paper.
31
+
32
+ Weight and activation Courbariaux et al. (2015); Hubara et al. (2016) propose methods to train DNNs with binary weights (BC) and activations (BNN) successively. They add noises to weights and activations as a form of regularization but real-valued gradients are accumulated in real-valued variables, suggesting that high precision accumulation is likely required for SGD optimization. XNOR-Net (Rastegari et al., 2016) has a filter-wise scaling factor for weights to improve the performance. Convolutions in XNOR-Net can be implemented efficiently using XNOR logical units and bit-count operations. However, these floating-point factors are calculated simultaneously during training, which generally aggravates the training effort. In TWN (Li et al., 2016) and TTQ (Zhu et al., 2016) two symmetric thresholds are introduced to constrain the weights to be ternary-valued: $\{ + 1 , 0 , - 1 \}$ . They claimed a tradeoff between model complexity and expressive ability.
33
+
34
+ Gradient computation and accumulation DoReFa-Net (Zhou et al., 2016) quantizes gradients to low-bitwidth floating-point numbers with discrete states in the backward pass. TernGrad (Wen et al., 2017) quantizes gradient updates to ternary values to reduce the overhead of gradient synchronization in distributed training. Nevertheless, weights in DoReFa-Net and TernGrad are stored and updated with float32 during training like previous works. Besides, the quantization of batch normalization and its derivative is ignored. Thus, the overall computation graph for the training process is still presented with float32 and more complex with external quantization. Generally, it is difficult to apply DoReFa-Net training in an integer-based hardware directly, but it shows potential for exploring high-dimensional discrete spaces with discrete gradient descent directions.
35
+
36
+ # 3 WAGE QUANTIZATION
37
+
38
+ The main idea of WAGE quantization is to constrain four operands to low-bitwidth integers: weight $W$ and activation $^ { a }$ in inference, error $e$ and gradient $\textbf { { g } }$ in backpropagation training, see Figure 1. We extend the original definition of errors to multi-layer: error $e$ is the gradient of activation $\textbf { \em a }$ for the perspective of each convolution or fully-connected layer, while gradient $\textbf { { g } }$ particularly refers to the gradient accumulation of weight $W$ . Considering the $i$ -th layer of a feed-forward network, we
39
+
40
+ have:
41
+
42
+ $$
43
+ e ^ { i } = { \frac { \partial { \mathcal { L } } } { \partial a ^ { i } } } , \pmb { g } ^ { i } = { \frac { \partial { \mathcal { L } } } { \partial W ^ { i } } }
44
+ $$
45
+
46
+ where $\mathcal { L }$ is the loss function. We separate these two terms that are mixed up in most existing schemes. The gradient of weight $\textbf { { g } }$ and the gradient of activation $e$ flow to different paths in each layer, which is a fork both in inference and in backward training and generally acts as node of MAC operations.
47
+
48
+ For the forward propagation in the $i$ -th layer, assuming that weights are stored and accumulated with $k _ { G }$ -bit integers, then numerous works strive for a better quantization function $Q _ { W } ( \cdot )$ that maps higher precision weights to their $k _ { W }$ -bit reflections, for example, $[ - 0 . 9 , 0 . 1 , 0 . 7 ]$ to $[ - 1 , 0 , 1 ]$ . Although weights are accumulated with high precision like float32, the deployment of the reflections in dedicated hardware are much more memory efficient after training. Activations are quantized with function $Q _ { A } ( \cdot )$ to $k _ { A }$ bits to align the increased bitwidth caused by MACs. Weights and activations are discretized to even binary values in previous works, then MACs degrade into logical and bit-count operations that are extremely efficient (Rastegari et al., 2016).
49
+
50
+ For the backward propagation in the $i$ -th layer, the gradients of activations and weights are calculated by the derivatives of MACs that are generally considered to be in 16-bit floating-point precision at least. As illustrated in Figure 1, the MACs between $k _ { A }$ -bit inputs and $k _ { W }$ -bit weights will increase the bitwidth of outputs to $[ k _ { A } + k _ { W } - 1 ]$ in signed integer representation, and the similar broadening happens to errors $e$ as well. In consideration of training with only low-bitwidth integers, we propose additional functions $Q _ { E } ( \cdot )$ and $Q _ { G } ( \cdot )$ to constrain bitwidth of $e$ and $\textbf { { g } }$ to $k _ { E }$ bits and $k _ { G }$ bits, respectively. In general, where there is a MAC operation, there are quantization operators named $Q _ { W } ( \cdot ) , \bar { Q _ { A } ( \cdot ) } , \bar { Q _ { G } ( \cdot ) }$ and $Q _ { E } ( \cdot )$ in inference and backpropagation.
51
+
52
+ ![](images/817241608beb2d22ed2d6644708fd32b8726cbfd6e15f235e1d6beb8e0af7390.jpg)
53
+ Figure 1: Four operators $Q _ { W } ( \cdot )$ , $Q _ { A } ( \cdot )$ , $Q _ { G } ( \cdot )$ , $Q _ { E } ( \cdot )$ added in WAGE computation dataflow to reduce precision, bitwidth of signed integers are below or on the right of arrows, activations are included in MAC for concision.
54
+
55
+ # 3.1 SHIFT-BASED LINEAR MAPPING AND STOCHASTIC ROUNDING
56
+
57
+ In WAGE quantization, we adopt a linear mapping with $k$ -bit integers for simplicity, where continuous and unbounded values are discretized with uniform distance $\sigma$ :
58
+
59
+ $$
60
+ \sigma ( k ) = 2 ^ { 1 - k } , k \in \mathbb { N } _ { + }
61
+ $$
62
+
63
+ Then the basic quantization function that converts a floating-point number $x$ to its $k$ -bitwidth signed integer representation can be formulated as:
64
+
65
+ $$
66
+ Q ( x , k ) = C l i p \left\{ \sigma ( k ) \cdot r o u n d \left[ \frac { x } { \sigma ( k ) } \right] , - 1 + \sigma ( k ) , 1 - \sigma ( k ) \right\}
67
+ $$
68
+
69
+ where round approximates continuous values to their nearest discrete states. Clip is the saturation function that clips unbounded values to $[ - 1 + \sigma , 1 - \sigma ]$ , where the negative maximum value $- 1$ is removed to maintain symmetry. For example, $Q ( x , 2 )$ quantizes $\{ - 1 , 0 . 2 , 0 . 6 \}$ to $\{ - 0 . 5 , 0 , 0 . 5 \}$ . Equation 3 is merely used for simulation in floating-point hardware like GPU, whereas in a fixedpoint device, quantization and saturation is satisfied automatically.
70
+
71
+ Before applying linear mapping in some operands (e.g., error), we introduce an additional monolithic scaling factor for shifting values distribution to an appropriate order of magnitude, otherwise values will be all saturated or cleared by Equation 3. The scaling factor is calculated by $S h i f t$ function and then divided in later steps:
72
+
73
+ $$
74
+ S h i f t ( x ) = 2 ^ { r o u n d ( \log _ { 2 } x ) }
75
+ $$
76
+
77
+ Finally, we propose stochastic rounding to substitute small and real-valued updates for gradient accumulation in training. Section 3.3.4 will detail the implementation of operator $Q _ { G } ( \cdot )$ , where high bitwidth gradients are constrained to $k _ { G }$ -bit integers stochastically by a 16-bit random number generator. Figure 2 summarizes quantization methods used in WAGE.
78
+
79
+ ![](images/8125076d734879fbe78137103e8555a0f12b097c5c8576071434819e97b020a4.jpg)
80
+ Figure 2: Quantization methods used in WAGE. The notation $P , \pmb { x } , \lfloor \cdot \rfloor$ and $\lceil \cdot \rceil$ denotes probability, vector, floor and ceil, respectively. $S h i f t ( \cdot )$ refers to Equation 4 with a certain argument.
81
+
82
+ # 3.2 WEIGHT INITIALIZATION
83
+
84
+ In previous works, weights are binarized directly by sgn function or ternarized by threshold parameters calculated during training. However, BNN fails to converge without batch normalization because weight values $\pm 1$ are rather big for a typical DNN. Batch normalization not only efficiently avoids the problem of exploding and vanishing gradients, but also alleviates the demand for proper initialization. However, normalizing outputs for each layer and computing their gradients are quite complex without floating point unit (FPU). Besides, the moving averages of batch outputs occupy external memory. BNN shows a shift-based variation of batch normalization but it is hard to transform all of the elements to the fixed-point representations. As a result, weights should be cautiously initialized in this work where batch normalization is simplified to a constant scaling layer. A modified initialization method based on MSRA (He et al., 2015) can be formulated as:
85
+
86
+ $$
87
+ W \sim U ( - L , + L ) , L = m a x \{ \sqrt { 6 / n _ { i n } } , L _ { m i n } \} , L _ { m i n } = \beta \sigma
88
+ $$
89
+
90
+ where $n _ { i n }$ is the layer fan-in number, and the original limit $\sqrt { 6 / n _ { i n } }$ in MSRA is calculated to keep same variance between inputs and outputs of the same layer theoretically. The additional limit $L _ { m i n }$ is a minimum value that the uniform distribution $U$ should reach, and $\beta$ is a constant greater than 1 to create overlaps between minimum step size $\sigma$ and maximum value $L$ . In case of $k _ { W }$ -bit linear mapping, if weights $W$ are quantized directly with original limits, we will get all-zero tensors when bitwidth $k _ { W }$ is small enough, e.g., 4, or fan-in $n _ { i n }$ is wide enough, where initialized weights may never reach the minimum step $\sigma$ presented by fixed-point integers. So $L _ { m i n }$ ensures that weights can go beyond $\sigma$ and quantized to non-zero values after $Q _ { W } ( \cdot )$ when initialized randomly.
91
+
92
+ # 3.3 QUANTIZATION DETAILS
93
+
94
+ # 3.3.1 WEIGHT $Q _ { W } ( \cdot )$
95
+
96
+ The modified initialization in Equation 5 will amplify weights holistically and guarantee their proper distribution, then $W$ is quantized directly with Equation 3:
97
+
98
+ $$
99
+ \boldsymbol { W _ { q } } = \boldsymbol { Q _ { W } } ( \boldsymbol { W } ) = \boldsymbol { Q } ( \boldsymbol { W } , \boldsymbol { k _ { W } } )
100
+ $$
101
+
102
+ It should be noted that the variance of weights is scaled compared to the original limit, which will cause exploding of network’s outputs. To alleviate the amplification effect, XNOR-Net proposed a filter-wise scaling factor calculated continuously with full precision. In consideration of integer implementation, we introduce a layer-wise shift-based scaling factor $\alpha$ to attenuate the amplification effect:
103
+
104
+ $$
105
+ \alpha = m a x \{ S h i f t ( L _ { m i n } / L ) , 1 \}
106
+ $$
107
+
108
+ where $\alpha$ is a pre-defined constant for each layer determined by the network structure. The modified initialization and attenuation factor $\alpha$ together approximates floating-point weights to their integer representations, except that $\alpha$ takes effect after activations to maintain precision of weights presented by $k _ { W }$ -bit integers.
109
+
110
+ # 3.3.2 ACTIVATION $Q _ { A } ( \cdot )$
111
+
112
+ As stated above, the bitwidth of operands increases after MACs. Then a typical CNN is usually followed with pooling, normalization and activation. Average pooling is avoided because mean operations will increase precision demand. Besides, we hypothesize that batch outputs of each hidden layer approximately have zero-mean, then batch normalization degenerates into to a scaling layer where trainable and batch-calculated scaling parameters are replaced by $\alpha$ mentioned in Equation 7. If activations are presented in $k _ { A }$ bits, the overall quantization of activations can be formulated as:
113
+
114
+ $$
115
+ \pmb { a } _ { q } = Q _ { A } ( \pmb { a } ) = Q ( \pmb { a } / \alpha , k _ { A } )
116
+ $$
117
+
118
+ # 3.3.3 ERROR $Q _ { E } ( \cdot )$
119
+
120
+ Errors $e$ are calculated layer by layer using the chain rule during training. Although the computation graph of backpropagation is similar to the inference, the inputs are the gradients of $\mathcal { L }$ , which are relatively small compared to actual inputs for networks. More importantly, the errors are unbounded and might have significantly larger ranges than that of activations, e.g., $[ 1 0 ^ { - 9 } , 1 0 ^ { - 4 } ]$ . DoReFa-Net first applies an affine transform on $e$ to map them into $[ - 1 , 1 ]$ , and then inverts the transform after quantization. Thus, the quantized $e$ are still presented as float32 numbers with discrete states and mostly small values.
121
+
122
+ However, experiments uncover that it is the orientations rather than orders of magnitude in errors that guides previous layers to converge, then the inverse transformation after quantization in DoReFa-Net is no longer needed. The orientation-only preservation prompts us to propagate errors with integer√ √ thoroughly, where error distribution is firstly scaled into $[ - { \sqrt { 2 } } , + { \sqrt { 2 } } ]$ by dividing a shift factor as shown in Figure 2 and then quantized by $Q ( e , k _ { E } )$ :
123
+
124
+ $$
125
+ \pmb { e _ { q } } = Q _ { E } ( \pmb { e } ) = Q ( \pmb { e } / S h i f t ( m a x \{ | \pmb { e } | \} ) , k _ { E } )
126
+ $$
127
+
128
+ where $m a x \{ | e | \}$ extracts the layer-wise maximum absolute value among all elements in error $e$ , multi-channel for convolution and multi-sample for batch training. The quantization of error discards large proportion of values smaller than $\sigma$ , we will discuss the influence on accuracy later.
129
+
130
+ # 3.3.4 GRADIENT $Q _ { G } ( \cdot )$
131
+
132
+ Since we only preserve relative values of error after shifting, the gradient updates $\textbf { { g } }$ derived from MACs between backward errors $e$ and forward activations $^ { a }$ are shifted consequently. We first rescale gradients $\textbf { { g } }$ with another scaling factor and then bring in shift-based learning rate $\eta$ :
133
+
134
+ $$
135
+ g _ { s } = \eta \cdot g / S h i f t ( m a x \{ | g | \} )
136
+ $$
137
+
138
+ where $\eta$ is an integer power of 2. The shifted gradients $\mathbf { \nabla } _ { \mathbf { { \boldsymbol { g } } } _ { s } }$ represent for minimum step numbers and directions for updating weights. If weights are stored with $k _ { G }$ -bit numbers, the minimum step of modification will be $\pm 1$ for integers and $\pm \sigma ( k _ { G } )$ for floating-point values, respectively. The implement of learning rate $\eta$ here is quite different from that in a vanilla DNN based on float32. In WAGE, there only remain directions for weights to change and the step sizes are integer multiples of minimum step $\sigma$ . Shifted gradients $\mathbf { \nabla } _ { \mathbf { { \boldsymbol { g } } } _ { s } }$ may get greater than 1 if $\eta$ is 2 or bigger to accelerate training at the beginning, or smaller than 0.5 during latter half of training when learning rate decay is usually applied. As illustrated in Figure 2, to substitute accumulation of small gradients in latter case, we separate $\mathbf { \nabla } _ { \mathbf { { \boldsymbol { g } } } _ { s } }$ into integer parts and decimal parts, then use a 16-bit random number generator to constrain high bitwidth $\mathbf { \nabla } _ { \mathbf { { \boldsymbol { g } } } _ { s } }$ to $k _ { G }$ -bit integers stochastically:
139
+
140
+ $$
141
+ \Delta W = Q _ { G } ( g ) = \sigma ( k _ { G } ) \cdot s g n ( g _ { s } ) \cdot \Big \{ \lfloor | g _ { s } | \rfloor + B e r n o u l l i ( | g _ { s } | - \lfloor | g _ { s } | \rfloor ) \Big \}
142
+ $$
143
+
144
+ where Bernoulli (Zhou et al., 2016) stochastically samples decimal parts to either 0 or 1. With proper setting of $k _ { G }$ , quantization of gradients will restrict the minimum step size, which may avoid local minimum and overfitting. Furthermore, the gradients will be ternary values when $\eta$ is not greater than 1, which reduces communication costs for distributed training (Wen et al., 2017). At last, weights $W$ might exceed the range $[ - 1 + \sigma , 1 - \sigma ]$ presented by $k _ { G }$ -bit integers after updating with discrete increments $\Delta \mathbf { W }$ . So $C l i p$ function is indispensable to saturate and make sure there are only $2 ^ { k _ { G } - 1 } - 1$ states for weights accumulation. In case of the $t$ -th iteration, we have:
145
+
146
+ $$
147
+ W _ { t + 1 } = C l i p \left\{ { \cal W } _ { t } - \Delta { \cal W } _ { t } , - 1 + \sigma ( k _ { G } ) , 1 - \sigma ( k _ { G } ) \right\}
148
+ $$
149
+
150
+ # 3.4 MISCELLANEOUS
151
+
152
+ From the above, we have illustrated our quantization methods for weights, activations, gradients and errors. See Algorithm 1 for the detailed computation graph. There remain some issues to specify in an overall training process with only integers.
153
+
154
+ Gradient descent optimizer like Momentum, RMSProp and Adam contains at least one copy of gradient updates $\Delta \mathbf { W }$ or their moving average, doubling memory consumption for weights during training, which is partially equivalent to use bigger $k _ { G }$ . Since the weight updates $\Delta \mathbf { W }$ are quantized to integer multiple of $\sigma$ and scaled by $\eta$ , we adopt pure mini-batch SGD without any form of momentum or adaptive learning rate to show the potential of reducing storage demands.
155
+
156
+ Although L2 regularization works quite well for many large-scale DNNs where overfitting occurs commonly, WAGE removes small values in Equation 3 and introduces randomness in Equation 11, acting as certain types of regularization and can get comparable accuracy in later experiments. Thus, we remain L2 weight decay and dropout as supplementary regularization methods.
157
+
158
+ The Softmax layer and cross-entropy criterion are widely adopted in classification tasks but the calculation of $e ^ { x }$ can hardly be applied in low-bitwidth linear mapping occasions. For tasks with small number of categories, we avoid Softmax layer and apply mean-square-error criterion but omit mean operation to form a sum-square-error (SSE) criterion since shifted errors will get the same values in Equation 9.
159
+
160
+ # 4 EXPERIMENTS
161
+
162
+ In this section, we set W-A-G-E bits to 2-8-8-8 as default for all layers in a CNN or MLP. The bitwidth $k _ { W }$ is 2 for ternary weights, which implies that there are no multiplications during inference. Constant parameter $\beta$ is 1.5 to make equal probabilities for ternary weights when initialized randomly. Activations and errors should be of the same bitwidth since computation graph of backpropagation is similar to inference and might be applied in the same partition of hardware or memristor array (Sheridan et al., 2017). Although XNOR-Net achieves 1-bit activations, reducing errors to 4 or less bits dramatically degenerates accuracies in our tests, so the bitwidth $k _ { A }$ and $k _ { E }$ are increased to 8 simultaneously. Weights are stored with 8-bit integers during training and ternarized by two constant symmetrical thresholds during inference. We first build the computation graph for a vanilla network, then insert quantization nodes in forward propagation and override gradients in backward propagation for each layer on Tensorflow (Abadi et al., 2016). Our method is evaluated on MNIST, SVHN, CIFAR10 and ILSVRC12 (Russakovsky et al., 2015) and Table 1 shows the comparison results.
163
+
164
+ # 4.1 IMPLEMENT DETAILS
165
+
166
+ MNIST: A variation of LeNet-5 (LeCun et al., 1998) with 32C5-MP2-64C5-MP2-512FC-10SSE is adopted. The input grayscale images are regarded as activations and quantized by Equation 8 where $\alpha$ equals to 1. The learning rate $\eta$ in WAGE remains as 1 for the whole 100 epochs. We report average accuracy of 10 runs on the test set.
167
+
168
+ SVHN & CIFAR10: We use a VGG-like network (Simonyan & Zisserman, 2014) with $2 \times ( 1 2 8 { \bf C } 3 )$ - $\mathbf { M P } 2 . 2 \times ( 2 5 6 \mathbf { C } 3 ) \mathbf { - M P } 2 . 2 \times ( 5 1 2 \mathbf { C } 3 ) .$ -MP2-1024FC-10SSE. For CIFAR10 dataset, we follow the data augmentation in Lee et al. (2015) for training: 4 pixels are padded on each side, and a $3 2 \times 3 2$ patch is randomly cropped from the padded image or its horizontal flip. For testing, only single view of the original $3 2 \times 3 2$ image is evaluated. The model is trained with mini-batch size of 128 and totally 300 epochs. Learning rate $\eta$ is set to 8 and divided by 8 at epoch 200 and epoch 250. The original images are scaled and biased to the range of $[ - 1 , + 1 ]$ for 8-bit integer activation representation. As for SVHN dataset, we leave out randomly flip augmentation and reduce training epochs to 40 since it is a rather big dataset. The error rate is evaluated in the same way as MNIST.
169
+
170
+ ImageNet: WAGE framework is evaluated on ILSVRC12 dataset with AlexNet (Krizhevsky et al., 2012) model but removes dropout and local response normalization layers. Images are firstly resized to $2 5 6 \times 2 5 6$ then randomly cropped to $2 2 4 \times 2 2 4$ and horizontally flipped, followed by bias subtraction as CIFAR10. For testing, the single center crop in validation set is evaluated. Since ImageNet task is much difficult than CIFAR10 and has 1000 categories, it is hard to converge when applying SSE or hinge loss criterion in WAGE, so we add Softmax and remove quantizations in the last layer for fear of severe accuracy drop (Tang et al., 2017). The model is trained with mini-batch size of 256 and totally 70 epochs. Learning rate $\eta$ is set to 4 and divided by 8 at epoch 60 and epoch 65.
171
+
172
+ Table 1: Test or validation error rates $( \% )$ in previous works and WAGE on multiple datasets. Opt denotes gradient descent optimizer and withM means SGD with momentum, BN represents for batch normalization and 32 bits refers to float32, ImageNet top- $\mathbf { \nabla } \cdot \mathbf { k }$ format: top1/top5.
173
+
174
+ <table><tr><td>Method</td><td>kw</td><td>kA</td><td>kG</td><td>kE</td><td>Opt</td><td>BN</td><td>MNIST</td><td>SVHN</td><td>CIFAR10</td><td>ImageNet</td></tr><tr><td>BC</td><td>1</td><td>32</td><td>32</td><td>32</td><td>Adam</td><td>V</td><td>1.29</td><td>2.30</td><td>9.90</td><td>1</td></tr><tr><td>BNN</td><td>1</td><td>1</td><td>32</td><td>32</td><td>Adam</td><td>√</td><td>0.96</td><td>2.53</td><td>10.15</td><td>1</td></tr><tr><td>BWN1</td><td>1</td><td>32</td><td>32</td><td>32</td><td>withM</td><td>√</td><td>1</td><td>1</td><td>1</td><td>43.2/20.6</td></tr><tr><td>XNOR</td><td>1</td><td>1</td><td>32</td><td>32</td><td>Adam</td><td>√</td><td>-</td><td>1</td><td>1</td><td>55.8/30.8</td></tr><tr><td>TWN</td><td>2</td><td>32</td><td>32</td><td>32</td><td>withM</td><td>√</td><td>0.65</td><td>-</td><td>7.44</td><td>34.7/13.8</td></tr><tr><td>TTQ</td><td>2</td><td>32</td><td>32</td><td>32</td><td>Adam</td><td>√</td><td>-</td><td>1</td><td>6.44</td><td>42.5/20.3</td></tr><tr><td>DoReFa²</td><td>8</td><td>8</td><td>32</td><td>8</td><td>Adam</td><td>√</td><td>1</td><td>2.30</td><td>-</td><td>47.0/-</td></tr><tr><td>TernGrad3</td><td>32</td><td>32</td><td>2</td><td>32</td><td>Adam</td><td>√</td><td>1</td><td>1</td><td>14.36</td><td>42.4/19.5</td></tr><tr><td>WAGE</td><td>2</td><td>8</td><td>8</td><td>8</td><td>SGD</td><td>×</td><td>0.40</td><td>1.92</td><td>6.78</td><td>51.6/27.8</td></tr></table>
175
+
176
+ # 4.2 TRAINING CURVES AND REGULARIZATION
177
+
178
+ We further compare WAGE variations and a vanilla CNN on CIFAR10. The vanilla CNN has the same VGG-like architecture described above except that none quantization of any operand or operation is applied. We add batch normalization in each layer and Softmax for the last layer, replace SSE with cross-entropy criterion, and then use a L2 weight decay of 1e-4 and momentum of 0.9 for training. The learning rate is set to 0.1 and divided by 10 at epoch 200 and epoch 250. For variations of WAGE, pattern 28ff has no quantization nodes in backpropagation. Although the 28ff pattern has the same optimizer and learning rate annealing method as the vanilla pattern, we find that weight updates are decreased by the rescale factor $\alpha$ in Equation 7. Therefore, the learning rate for $2 8 \mathrm { f f }$ is amplified and tuned, which reduces the error rate by $3 \%$ . Figure 3 shows the training curves of three counterparts. It can be seen that the 2888 pattern has comparable convergence rate to the vanilla CNN, better accuracy than those who only discretize weights and activations in inference time, though slightly more volatile. The discretization of backpropagation somehow acts as another type of regularization and have significant error rate drop when decreasing learning rate $\eta$ .
179
+
180
+ ![](images/4a436c0768c09e887e192b39a7ea39f460e8366485af64c63c70957efd0b1595.jpg)
181
+ Figure 3: Training curves of WAGE variations and a vanilla CNN on CIFAR10.
182
+
183
+ # 4.3 BITWIDTH OF ERRORS
184
+
185
+ The bitwidth $k _ { E }$ is set to 8 as default in previous experiments. To further explore a proper bitwidth and its truncated boundary, we firstly export errors from vanilla CNN for CIFAR10 after 100 training epochs. The histogram of errors in the last convolution layer among 128 mini-batch data is shown in Figure 4. It is obvious that errors approximately obey logarithmic normal distribution where values are relatively small and have significantly large range. When quantized with $k _ { E }$ -bit integers, a proper window function should be chosen to truncate the distribution while retaining the approximate orientations for backpropagation. For more details about the layerwise histograms of all W, A, G, E operands, see Figure 5.
186
+
187
+ Firstly, the upper (right) boundary is immobilized to the maximum absolute value among all elements in errors as described in Equation 9. Then the left boundary will be based on the bitwidth $k _ { E }$ . We conduct a series of experiments for $k _ { E }$ ranging from 4 to 15. The boxplot in Figure 4 indicates that 4-8 bits of errors represented by integers are enough for CIFAR10 classification task. Bitwidth 8 is chosen as default to match the 8-bit image color levels and most operands in the micro control unit (MCU). The histogram of errors in the same layer of WAGE-2888 shows that after being shifted and quantized layer by layer, the distribution of errors reshapes and mostly aggregates into truncated window. Thus, most information for orientations is retained. Besides, the smaller values in errors have negligible effects on previous orientations though accumulated layer by layer, which are partially discarded in quantization.
188
+
189
+ Since the width of the window has been optimized, we left-shift the window with factor $\gamma$ to explore its horizontal position. The right boundary can be formulated as $m a x \{ | e | \} / \gamma$ . Table 2 shows the effect of shifting errors: although large values are in the minority, they play critical roles for backpropagation training while the majority with small values actually act as noises.
190
+
191
+ Table 2: Test error rates $( \% )$ on CIFAR10 when left-shift upper boundary with factor $\gamma$
192
+
193
+ <table><tr><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>8</td></tr><tr><td rowspan=1 colspan=1>error</td><td rowspan=1 colspan=1>6.78</td><td rowspan=1 colspan=1>7.31</td><td rowspan=1 colspan=1>8.08</td><td rowspan=1 colspan=1>16.92</td></tr></table>
194
+
195
+ # 4.4 BITWIDTH OF GRADIENTS
196
+
197
+ The bitwidth $k _ { G }$ is set to 8 as default in previous experiments. Although weights are propagated with ternary values in inference and achieve $1 6 \times$ compression rate than float32 weights, they are saved and accumulated in a relatively higher bitwidth (8 bits) for backpropagation training. Therefore, the overall compression rate is only $4 \times$ . The inconsistent bitwidth between weight updates $k _ { G }$ and their effects in inference $k _ { W }$ provides indispensable buffer space. Otherwise, there might be too many weights changing their ternary values in each iteration, making training very slow and unstable. To further explore a proper bitwidth for gradients, we use WAGE 2-8-8-8 in CIFAR10 as baseline and range $k _ { G }$ from 2 to 12, the learning rate $\eta$ is divided by 2 every time the $k _ { G }$ decreases 1 bit to keep approximately equal weights accumulation in large number of iterations. Results from Table 3 show the effect of $k _ { G }$ and indicate the similar bitwidth requirement as previous experiments for $k _ { E }$ .
198
+
199
+ ![](images/6656974d908cf6666067d8870d249173758fdec06426277d8625030220173579.jpg)
200
+ Figure 4: Left are histograms of errors $e$ for same layer in vanilla network and WAGE-2888 network. Upper boundaries are the $m a x \{ | e | \}$ while lower boundaries are determined by the bitwidth $k _ { E }$ . The 10 run accuracies of different $k _ { E }$ are shown on the right.
201
+
202
+ Table 3: Test error rates $( \% )$ on CIFAR10 with different $k _ { G }$
203
+
204
+ <table><tr><td rowspan=1 colspan=1>kG</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>6</td><td rowspan=1 colspan=1>7</td><td rowspan=1 colspan=1>8</td><td rowspan=1 colspan=1>9</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>11</td><td rowspan=1 colspan=1>12</td></tr><tr><td rowspan=1 colspan=1>error</td><td rowspan=1 colspan=1>54.22</td><td rowspan=1 colspan=1>51.57</td><td rowspan=1 colspan=1>28.22</td><td rowspan=1 colspan=1>18.01</td><td rowspan=1 colspan=1>11.48</td><td rowspan=1 colspan=1>7.61</td><td rowspan=1 colspan=1>6.78</td><td rowspan=1 colspan=1>6.63</td><td rowspan=1 colspan=1>6.43</td><td rowspan=1 colspan=1>6.55</td><td rowspan=1 colspan=1>6.57</td></tr></table>
205
+
206
+ For ImageNet implementation, we conduct six patterns to show bitwidth requirements: 2888 from Table 1, 288C for more accurate errors (12 bits), 28C8 for larger buffer space, 28f8 for none quantization of gradients, 28ff for errors and gradients in float32 as unlimited case and its BN counterpart. The accuracy of original AlexNet reproduction is reported as baseline. Learning rate $\eta$ is set to 64 and divided by 8 in 28C8 pattern, 0.01 and divided by 10 in 28f8, 28ff counterparts and vanilla AlexNet. We observe overfitting when increasing $k _ { G }$ thus add L2 weight decay of 1e-4, 1e-4 and 5e-4 for 28f8, 28ff and 28ff-BN patterns, respectively. In table 4, the comparison between pattern 28C8 and 288C reveals that it might be more important to make more buffer space $k _ { G }$ for gradient accumulation than to keep high-resolution orientation $k _ { E }$ . Besides, when it comes to ImageNet dataset, the gradient accumulation, i.e., the bit width of gradients $( k _ { G } )$ and batch normalization become more important (Li et al., 2017) since samples in training set are so variant.
207
+
208
+ To avoid external memory consumption of full-precision weights during training, Deng et al. (2018) achieved 1-bit weights representation in both training and inference. They use a much larger minibatch size of 1000 and float32 backpropagation dataflow to accumulate more precise weight updates, equally compensating the buffer space in WAGE provided by external bits of $k _ { G }$ . However, large batch size will dramatically increase total training time, counteracting the speed benefits brought by integer arithmetic units. Besides, intermediate variables like feature maps often consume much more memory than weights and linearly correlated with mini-batch size. Therefore, we apply bigger $k _ { G }$ for better convergence rate, accuracy and lower memory usage.
209
+
210
+ Table 4: Top-5 error rates $( \% )$ on ImageNet with different $k _ { G }$ and $k _ { E }$
211
+
212
+ <table><tr><td rowspan=1 colspan=1>Pattern</td><td rowspan=1 colspan=1>Vanilla</td><td rowspan=1 colspan=1>28ff-BN</td><td rowspan=1 colspan=1>28ff</td><td rowspan=1 colspan=1>28f8</td><td rowspan=1 colspan=1>28C8</td><td rowspan=1 colspan=1>288C</td><td rowspan=1 colspan=1>2888</td></tr><tr><td rowspan=1 colspan=1>error</td><td rowspan=1 colspan=1>19.29</td><td rowspan=1 colspan=1>20.67</td><td rowspan=1 colspan=1>24.14</td><td rowspan=1 colspan=1>23.92</td><td rowspan=1 colspan=1>26.88</td><td rowspan=1 colspan=1>28.06</td><td rowspan=1 colspan=1>27.82</td></tr></table>
213
+
214
+ # 5 DISCUSSION AND FUTURE WORK
215
+
216
+ The goal of this work is to demonstrate potentials of applying training and inference with lowbitwidth integers in DNNs. Compared with FP16, 8-bit integer operations will not only reduce the energy and area costs for IC design (about $5 \times$ , see Table 5), but also halve the memory accesses costs and memory size requirements during training, which will greatly benefit mobile devices with on-site learning capability. There are some points not involved in this work but yet to be improved or solved in future algorithm developments and hardware deployment.
217
+
218
+ MAC Operation: WAGE framework is mainly tested with 2-8-8-8 bitwidth configuration, which means that though there are no multiplications during inference with ternary weights, MACs are still needed to calculate $\textbf { { g } }$ in training. Possible solution is 2-2-8-8 pattern if we do not consider the matching of bitwidths between $\textbf { \em a }$ and $e$ . However, ternary $\textbf { \em a }$ will dramatically slow down convergence and hurt accuracy since $Q ( x , 2 )$ has two relatively high thresholds and clear most outputs of each layer at the beginning of training, this phenomenon is also observed in our BNN replication.
219
+
220
+ Non-linear quantization: The linear mapping with uniform distance is adopted in WAGE for its simplicity. However, non-linear quantization method like logarithmic representation (Miyashita et al., 2016; Zhou et al., 2017) might be more efficient because the weights and activations in a trained network naturally have logarithmic normal distributions as shown in Figure 4. Besides, values in logarithmic representation have much larger range with fewer bits than fixed-point representation and are naturally encoded in digital hardware. It is promising to training DNNs with integers encoded with logarithmic representation.
221
+
222
+ Normalization: Normalization layers like Softmax and batch normalization are avoided or removed in some WAGE demonstrations. We think normalizations are essential for end-to-end multi-channel perception where sensors with different modalities have different input distributions, as well as cross-model features encoding and cognition where information from different branches gather to form higher-level representations. Therefore, a better way to quantize normalization is of great interest in further studies.
223
+
224
+ Table 5: Rough relative costs in $4 5 \mathrm { n m } 0 . 9 \mathrm { V }$ from Sze et al. (2017).
225
+
226
+ <table><tr><td rowspan=2 colspan=1>Operation</td><td rowspan=1 colspan=1>Energy(pJ)</td><td rowspan=1 colspan=1>Area(um2)</td></tr><tr><td rowspan=1 colspan=1>MUL ADD</td><td rowspan=1 colspan=1>MUL ADD</td></tr><tr><td rowspan=1 colspan=1>8-bit INT</td><td rowspan=1 colspan=1>0.2 pJ 0.03 pJ</td><td rowspan=1 colspan=1>282 36</td></tr><tr><td rowspan=1 colspan=1>16-bit FP</td><td rowspan=1 colspan=1>1.1 pJ 0.40 pJ</td><td rowspan=1 colspan=1>1640 1360</td></tr><tr><td rowspan=1 colspan=1>32-bit FP</td><td rowspan=1 colspan=1>3.7 pJ 0.90 pJ</td><td rowspan=1 colspan=1>7700 4184</td></tr></table>
227
+
228
+ # 6 CONCLUSION
229
+
230
+ WAGE empowers pure low-bitwidth integer dataflow in DNNs for both training and inference. We introduce a new initialization method and a layer-wise constant scaling factor to replace batch normalization, which is a pain spot for network quantization. Many other components for training are also considered or simplified by alternative solutions. In addition, the bitwidth requirements for error computation and gradient accumulation are explored. Experiments reveal that we can quantize relative values of gradients, as well as discard the majority of small values and their orders of magnitude in backpropagation. Although the accumulation for weights updates are indispensable for stable convergence and final accuracy, there still remain works for compression and memory consumption can be further reduced in training. WAGE achieves state-of-art accuracies on multiple datasets with 2-8-8-8 bitwidth configuration. It is promising for incremental works via fine-tuning, more efficient mapping, quantization of batch normalization, etc. Overall, we introduce a framework without floating-point representation and demonstrate the potential to implement both discrete training and inference on integer-based lightweight ASIC or FPGA with on-site learning capability.
231
+
232
+ # ACKNOWLEDGMENTS
233
+
234
+ This work is partially supported by the Project of NSFC (61327902), the SuZhou-Tsinghua innovation leading program (2016SZ0102), the National Natural Science Foundation of China (61603209) and the Independent Research Plan of Tsinghua University (20151080467). We discuss a lot with Peng Jiao and Lei Deng, gratefully acknowledge for their thoughtful comments.
235
+
236
+ # REFERENCES
237
+
238
+ Mart´ın Abadi, Paul Barham, Jianmin Chen, Zhifeng Chen, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Geoffrey Irving, Michael Isard, et al. Tensorflow: A system for largescale machine learning. In OSDI, volume 16, pp. 265–283, 2016.
239
+
240
+ Yu-Hsin Chen, Tushar Krishna, Joel S Emer, and Vivienne Sze. Eyeriss: An energy-efficient reconfigurable accelerator for deep convolutional neural networks. IEEE Journal of Solid-State Circuits, 52(1):127–138, 2017.
241
+
242
+ Matthieu Courbariaux, Yoshua Bengio, and Jean-Pierre David. Binaryconnect: Training deep neural networks with binary weights during propagations. In Advances in Neural Information Processing Systems, pp. 3123–3131, 2015.
243
+
244
+ Lei Deng, Peng Jiao, Jing Pei, Zhenzhi Wu, and Guoqi Li. Gxnor-net: Training deep neural networks with ternary weights and activations without full-precision memory under a unified discretization framework. Neural Networks, 2018.
245
+
246
+ Song Han, Huizi Mao, and William J Dally. Deep compression: Compressing deep neural networks with pruning, trained quantization and huffman coding. arXiv preprint arXiv:1510.00149, 2015.
247
+
248
+ 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.
249
+
250
+ Geoffrey Hinton, Li Deng, Dong Yu, George E Dahl, Abdel-rahman Mohamed, Navdeep Jaitly, Andrew Senior, Vincent Vanhoucke, Patrick Nguyen, Tara N Sainath, et al. Deep neural networks for acoustic modeling in speech recognition: The shared views of four research groups. IEEE Signal Processing Magazine, 29(6):82–97, 2012.
251
+
252
+ Andrew G Howard, Menglong Zhu, Bo Chen, Dmitry Kalenichenko, Weijun Wang, Tobias Weyand, Marco Andreetto, and Hartwig Adam. Mobilenets: Efficient convolutional neural networks for mobile vision applications. arXiv preprint arXiv:1704.04861, 2017.
253
+
254
+ Itay Hubara, Matthieu Courbariaux, Daniel Soudry, Ran El-Yaniv, and Yoshua Bengio. Binarized neural networks. In Advances in Neural Information Processing Systems, pp. 4107–4115, 2016.
255
+
256
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In International Conference on Machine Learning, pp. 448–456, 2015.
257
+
258
+ Norman P Jouppi, Cliff Young, Nishant Patil, David Patterson, Gaurav Agrawal, Raminder Bajwa, Sarah Bates, Suresh Bhatia, Nan Boden, Al Borchers, et al. In-datacenter performance analysis of a tensor processing unit. In Proceedings of the 44th Annual International Symposium on Computer Architecture, pp. 1–12. ACM, 2017.
259
+
260
+ 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.
261
+
262
+ Yann LeCun, Leon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to ´ document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
263
+
264
+ Chen-Yu Lee, Saining Xie, Patrick Gallagher, Zhengyou Zhang, and Zhuowen Tu. Deeplysupervised nets. In Artificial Intelligence and Statistics, pp. 562–570, 2015.
265
+
266
+ Fengfu Li, Bo Zhang, and Bin Liu. Ternary weight networks. arXiv preprint arXiv:1605.04711, 2016.
267
+
268
+ Hao Li, Soham De, Zheng Xu, Christoph Studer, Hanan Samet, and Tom Goldstein. Training quantized nets: A deeper understanding. In Advances in Neural Information Processing Systems, pp. 5813–5823, 2017.
269
+
270
+ Daisuke Miyashita, Edward H Lee, and Boris Murmann. Convolutional neural networks using logarithmic data representation. arXiv preprint arXiv:1603.01025, 2016.
271
+
272
+ Mohammad Rastegari, Vicente Ordonez, Joseph Redmon, and Ali Farhadi. Xnor-net: Imagenet classification using binary convolutional neural networks. In European Conference on Computer Vision, pp. 525–542. Springer, 2016.
273
+
274
+ 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.
275
+
276
+ Patrick M Sheridan, Fuxi Cai, Chao Du, Wen Ma, Zhengya Zhang, and Wei D Lu. Sparse coding with memristor networks. Nature nanotechnology, 12(8):784, 2017.
277
+
278
+ Luping Shi, Jing Pei, Ning Deng, Dong Wang, Lei Deng, Yu Wang, Youhui Zhang, Feng Chen, Mingguo Zhao, Sen Song, et al. Development of a neuromorphic computing system. In Electron Devices Meeting (IEDM), 2015 IEEE International, pp. 4–3. IEEE, 2015.
279
+
280
+ 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.
281
+
282
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
283
+
284
+ Vivienne Sze, Yu-Hsin Chen, Tien-Ju Yang, and Joel S Emer. Efficient processing of deep neural networks: A tutorial and survey. Proceedings of the IEEE, 105(12):2295–2329, 2017.
285
+
286
+ Wei Tang, Gang Hua, and Liang Wang. How to train a compact binary neural network with high accuracy? In Thirty-First AAAI Conference on Artificial Intelligence, 2017.
287
+
288
+ 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 Advances in Neural Information Processing Systems, pp. 1508–1518, 2017.
289
+
290
+ Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. arXiv preprint arXiv:1611.03530, 2016.
291
+
292
+ Aojun Zhou, Anbang Yao, Yiwen Guo, Lin Xu, and Yurong Chen. Incremental network quantization: Towards lossless cnns with low-precision weights. arXiv preprint arXiv:1702.03044, 2017.
293
+
294
+ Shuchang Zhou, Yuxin Wu, Zekun Ni, Xinyu Zhou, He Wen, and Yuheng Zou. Dorefa-net: Training low bitwidth convolutional neural networks with low bitwidth gradients. arXiv preprint arXiv:1606.06160, 2016.
295
+
296
+ Chenzhuo Zhu, Song Han, Huizi Mao, and William J Dally. Trained ternary quantization. arXiv preprint arXiv:1612.01064, 2016.
297
+
298
+ # A ALGORITHM
299
+
300
+ We assume that network structures are defined and initialized with Equation 5. The annotations after pseudo code are potential corresponding operations for implementation in a fixed-point dataflow.
301
+
302
+ Algorithm 1 Training an $I$ -layer net with WAGE method on floating-point-based or integer-based device. Weights, activations, gradients and errors are quantized according to Equations 6 - 12.
303
+
304
+ Require: a mini-batch of inputs and targets $( \pmb { a } _ { q } ^ { 0 } , \pmb { a } ^ { * } )$ which are quantized to $k _ { A }$ -bit integers, shiftbased $\alpha$ for each layer, learning rate scheduler $\eta$ , previous weight $W$ saved in $k _ { G }$ bits.
305
+
306
+ Ensure: updated weights $W _ { t + 1 }$
307
+
308
+ 1. Forward propagation:
309
+ 1: for $i = 1$ to $I$ do
310
+ 2: $W _ { q } ^ { i } Q _ { W } ( W ^ { i } )$
311
+ 3: $\pmb { a } ^ { i } \gets R e L U ( \pmb { a } _ { q } ^ { i - 1 } \pmb { W } _ { q } ^ { i } )$
312
+ 4: $\pmb { a } _ { q } ^ { i } Q _ { A } ( \pmb { a } ^ { i } )$
313
+
314
+ 5: end for 2. Back propagation: Compute $\mathbf { \Psi } _ { e ^ { I } } \mathbf { \bar { \Psi } } _ { } \mathbf { \frac { \partial \mathcal { L } } { \partial \mathbf { a } ^ { I } } }$ knowing $\pmb { a } ^ { I }$ and $\mathbf { \delta } \mathbf { \textit { a } } ^ { * }$
315
+
316
+ 6: for $i = I$ to 1 do
317
+ 7: 0 $e _ { q } ^ { i } Q _ { E } ( e ^ { i } )$
318
+ 8: $e ^ { i - 1 } e _ { q } ^ { i } W _ { q } ^ { i }$
319
+ 9: g i ← e iq T a i − 1q
320
+ 10: $\Delta W ^ { i } Q _ { G } ( \pmb { g } ^ { i } )$
321
+ 11: Update and Clip $\dot { W } ^ { i }$ according to Equation 12
322
+ 12: end for
323
+
324
+ # B LAYERWISE HISTOGRAM
325
+
326
+ ![](images/43901665d2658825e17c80f353f099762fdcf082af6320b8c868442672e31a6e.jpg)
327
+ Figure 5: Layerwise histograms of a trained VGG-like network with bitwidth configuration: 2-8- 8-8 and learning rate $\eta$ equals to 8. The Y-axis represents for probability in W-plots and G-plots, and logarithmic probability in A-plots and E-plots, respectively. In A-plots histograms are one-layer ahead so the first figure shows the quantized input data.
md/train/HJGkisCcKm/HJGkisCcKm.md ADDED
@@ -0,0 +1,260 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # A UNIVERSAL MUSIC TRANSLATION NETWORK
2
+
3
+ Noam Mor Facebook AI Research noam.mor@gmail.com
4
+
5
+ Lior Wolf & Adam Polyak Facebook AI Research & Tel Aviv Uni. wolf,adampolyak@fb.com
6
+
7
+ Yaniv Taigman Facebook AI Research yaniv@fb.com
8
+
9
+ # ABSTRACT
10
+
11
+ We present a method for translating music across musical instruments and styles. This method is based on unsupervised training of a multi-domain wavenet autoencoder, with a shared encoder and a domain-independent latent space that is trained end-to-end on waveforms. Employing a diverse training dataset and large net capacity, the single encoder allows us to translate also from musical domains that were not seen during training. We evaluate our method on a dataset collected from professional musicians, and achieve convincing translations. We also study the properties of the obtained translation and demonstrate translating even from a whistle, potentially enabling the creation of instrumental music by untrained humans.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ Humans have always created music and replicated it – whether it is by singing, whistling, clapping, or, after some training, playing improvised or standard musical instruments. This ability is not unique to us, and there are many other vocal mimicking species that are able to repeat music from hearing. Music is also one of the first domains to be digitized and processed by modern computers and algorithms. It is, therefore, somewhat surprising that in the core music task of mimicry, AI is still much inferior to biological systems.
16
+
17
+ In this work, we present a novel way to produce convincing musical translation between instruments and styles. For example1, we convert the audio of a Mozart symphony performed by an orchestra to an audio in the style of a pianist playing Beethoven. Our ability builds upon two technologies that have recently become available: (i) the ability to synthesize high quality audio using autoregressive models, and (ii) the recent advent of methods that transform between domains in an unsupervised way. The first technology allows us to generate high quality and realistic audio and thanks to the teacher forcing technique, autoregressive models are efficiently trained as decoders. The second family of technologies contributes to the practicality of the solution, since posing the learning problem in the supervised setting, would require a parallel dataset of different musical instruments.
18
+
19
+ In our architecture, we employ a single, universal, encoder and apply it to all inputs (universal here means that a single encoder can address all input music, allowing us to achieve capabilities that are known as universal translation). In addition to the advantage of training fewer networks, this also enables us to convert from musical domains that were not heard during training to any of the domains encountered.
20
+
21
+ The key to being able to train a single encoder architecture, is making sure that the domain-specific information is not encoded. We do this using a domain confusion network that provides an adversarial signal to the encoder. In addition, it is important for the encoder not to memorize the input signal but to encode it in a semantic way. We achieve this by distorting the input audio by random local pitch modulation. During training, the network is trained as a denoising autoencoder, which recovers the undistorted version of the original input. Since the distorted input is no longer in the musical domain of the output, the network learns to project out-of-domain inputs to the desired output domain. In addition, the network no longer benefits from memorizing the input signal and employs a higher-level encoding.
22
+
23
+ Asked to convert one musical instrument to another, our network shows a level of performance that seems to approach that of musicians. When controlling for audio quality, which is still lower for generated music, it is many times hard to tell which is the original audio file and which is the output of the conversion that mimics a completely different instrument. The network is also able to successfully process unseen musical instruments such as drums, or other sources, such as whistles.
24
+
25
+ # 2 PREVIOUS WORK
26
+
27
+ Domain Transfer Recently, there has been a considerable amount of work, mostly on images and text, which performs unsupervised translation between domains $\mathcal { A }$ and $\boldsymbol { B }$ , without being shown any matching pairs, i.e., in a completely unsupervised way. Almost all of this work employs GAN constraints (Goodfellow et al., 2014), in order to ensure a high level of indistinguishability between the translations of samples in $A$ and samples from the domain $B$ . In our work, the output is generated by an autoregressive model and training takes place using the ground truth output of the previous time steps (“teacher forcing”), instead of the predicted ones. A complete autoregressive inference is only done during test time, and it is not practical to apply such inference during training in order to get a realistic generated (“fake”) sample for the purpose of training the GAN.
28
+
29
+ Another popular constraint is that of circularity, namely that by mapping from $\mathcal { A }$ to $\boldsymbol { B }$ and back to $\mathcal { A }$ a reconstruction of the original sample is obtained (Kim et al., 2017; Zhu et al., 2017; Yi et al., 2017). In our work, for the same reason mentioned above, the output during training does not represent the future test time output, and such a constraint is unrealistic. An application of circularity in audio was present in (Kaneko & Kameoka, 2017), where a non-autoregressive model between vocoder features is used to convert between voices in an unsupervised way.
30
+
31
+ Cross domain translation is not restricted to a single pair of domains. The recent StarGAN (Choi et al., 2017) method creates multiple cycles for mapping between multiple (more than two) domains. The method employs a single generator that receives as input the source image as well as the specification of the target domain. It then produces the analog “fake” image from the target domain. Our work employs multiple decoders, one per domain, and attempts to condition a single decoder on the selection of the output domain failed to produce convincing results.
32
+
33
+ UNIT (Liu et al., 2017) employs an encoder-decoder pair per each domain, where the latent spaces of the domains are assumed to be shared. This is achieved by sharing the network layers that are distant from the image (the top layers of the encoder and the bottom layers of the decoder), similarly to CoGAN (Liu & Tuzel, 2016). Cycle-consistency is also added, and structure is added to the latent space using a variational autoencoder (Kingma & Welling, 2014) loss terms. Our method employs a single encoder, which eliminates the need for many of the associated constraints. In addition, we do not impose a VAE loss term (Kingma & Welling, 2014) on the latent space of the encodings and instead employ a domain confusion loss (Ganin et al., 2016). The work of Louizos et al. (2015) investigates the problem of learning invariant representations by employing the Maximum Mean Discrepancy (MMD), which we do not use.
34
+
35
+ Audio Synthesis WaveNet (van den Oord et al., 2016) is an autoregressive model that predicts the probability distribution of the next sample, given the previous samples and an input conditioning signal. Its generated output is currently considered of the highest naturalness, and is applied in a range of tasks. In (Rethage et al., 2017), the authors have used it for denoising waveforms by predicting the middle ground-truth sample from its noisy input support. Recent contributions in Text-To-Speech(TTS) (Ping et al., 2018; Shen et al., 2018) have successfully conditioned wavenet on linguistic and acoustic features to obtain state of the art performance.
36
+
37
+ In VQ-VAE (van den Oord et al., 2017), voice conversion was obtained by employing a variational autoencoder that produces a quantized latent space that is conditioned on the speaker identity. Similar to our work, the decoder is based on WaveNet. However, we impose a greater constraint on the latent space by (a) having a universal encoder, forcing the embeddings of all domains to lie in the same space, yet (b) training a separate reconstructing decoder for each domain, provided that (c) the latent space is domain independent, thereby reducing source-target pathways memorization, which is also accomplished by (d) employing augmentation to distort the input signal. Invariance is achieved in VQ-VAE through the strong bottleneck effect achieved by discretization. Despite some effort, we were not able to use a discrete latent space here.
38
+
39
+ ![](images/8b9792730bd1bbfaf4808011743662447a7857a2b456112cf8a61abcd73a70b2.jpg)
40
+ Figure 1: (a) The schematic architecture of our translation network. The confusion term (marked by the dashed line) is employed only during training. $E$ is the shared encoder, $C$ is the domain classification network employed in the domain confusion term, $D ^ { i }$ are the various decoders. (b) A detailed depiction of our architecture. ‘NC’ indicates non-causal convolution. ‘1x1’ indicates a 1-D convolution with kernel size 1.
41
+
42
+ Recently, Dieleman et al. (2018) explored discretization as a method to capture long-range dependencies in unconditioned music generation, for up to 24 seconds. We focus on translation, and the conditioning on the source signal carries some long-range information on the development of the music. Consider an analogy to a myopic language translation system, where the input is a story in English and the output is a story in Spanish. Even if the translation occurs one sentence at a time, the main theme of the story is carried by the “conditioning” on the source text.
43
+
44
+ The architecture of the autoencoder we employ is the wavenet-autoencoder presented in (Engel et al., 2017). In comparison to this work, our inputs are not controlled and are collected from consumer media. Our overall architecture differs in that multiple decoders and an additional auxiliary network, which is used for disentangling the domain information from the other aspects of the music representation, are trained and by the addition of an important augmentation step.
45
+
46
+ In the supervised learning domain, an audio style transfer between source and target spectrograms was performed with sequence-to-sequence recurrent networks (Haque et al., 2018). This method requires matching pairs of samples played on different instruments. In another fully supervised work (Hadjeres & Pachet, 2017), a graphical model aimed at modeling polyphonic tones of Bach was trained on notes, capturing the specificity of Bach’s chorales. This model is based on RNNs and requires a large corpus of notes of a particular instrument produced with a music editor.
47
+
48
+ Style Transfer Style transfer is often confused with domain translation and the distinction is not always clear. In the task of style transfer, the “content” remains the same between the input and the output, but the ”style” is modified. Notable contributions in the field include (Gatys et al., 2016; Ulyanov et al., 2016; Johnson et al., 2016), which synthesize a new image that minimizes the content loss with respect to the content-donor sample and the style loss with respect to one or more samples of a certain style. The content loss is based on comparing the activations of a network training for an image categorization task. The style loss compares the statistics of the activations in various layers of the categorization layer. An attempt at audio style transfer is described in (Barry & Kim, 2018).
49
+
50
+ Concatenative Synthesis In the computer music and audio effects literature, the conversion task we aim to solve is tackled by concatenating together short pieces of audio from the target domain, such that the output audio resembles the input audio from the source domain Verfaille & Arfib (2000); Schwarz (2006); Zils & Pachet (2001); Simon et al. (2005). The method has been extensively researched, see the previous work section of Nuanain et al. (2017) and the online resource of Schwarz ´ (2018). A direct comparison to such methods is challenging, since many of the methods have elaborate interfaces with many tunable parameters that vary from one conversion task to the next. To the extent possible, we compare with some of the published results in Sec. 4.2, obtaining what we believe to be clearly superior results.
51
+
52
+ # 3 METHOD
53
+
54
+ Our domain translation method is based on training multiple autoencoder pathways, one per musical domain, such that the encoders are shared. During training, a softmax-based reconstruction loss is applied to each domain separately. The input data is randomly augmented, prior to applying the encoder, in order to force the network to extract high-level semantic features, instead of simply memorizing the data. In addition, a domain confusion loss (Ganin et al., 2016) is applied to the latent space to ensure that the encoding is not domain-specific. A diagram of the translation architecture is shown in Fig. 1 (a).
55
+
56
+ # 3.1 WAVENET AUTOENCODER
57
+
58
+ We reuse an existing autoencoder architecture that is based on a WaveNet decoder and a WaveNetlike dilated convolution encoder (Engel et al., 2017). The WaveNet of each decoder is conditioned on the latent representation produced by the encoder. In order to reduce the inferencetime, the nv-wavenet CUDA kernels provided by NVIDIA ( https://github.com/NVIDIA/ nv-wavenet) were used after modification to better match the architecture suggested by van den Oord et al. (2016), as described below.
59
+
60
+ The encoder is a fully convolutional network that can be applied to any sequence length. The network has three blocks of ten residual-layers, a total of thirty layers. Each residual-layer contains a RELU nonlinearity, a non-causal dilated convolution with an increasing kernel size, a second RELU, and a $1 \times 1$ convolution followed by the residual summation of the activations before the first RELU. There is a fixed width of 128 channels. After the three blocks, there is an additional $1 \times 1$ layer. An average pooling with a kernel size of 50 milliseconds (800 samples) follows in order to obtain an encoding in $\mathbb { R } ^ { 6 \bar { 4 } }$ , which implies a temporal down sampling by a factor of $\times 1 2 . 5$ .
61
+
62
+ The encoding is upsampled temporally to the original audio rate, using nearest neighbor interpolation and is used to condition a WaveNet decoder. The conditioning signal is passed through a $1 \times 1$ layer that is different for each WaveNet layer. The audio (both input and output) is quantized using 8-bit mu-law encoding, similarly to both (van den Oord et al., 2016; Engel et al., 2017), which results in some inherent loss of quality. The WaveNet decoder has either four blocks of 10 residual-layers and a resulting receptive field of 250 milliseconds (4,093 samples), as in Engel et al. (2017), or 14 layer blocks and a much larger receptive field of 4 seconds. Each residual-layer contains a causal dilated convolution with an increasing kernel size, a gated hyperbolic tangent activation, a $1 \times 1$ convolution followed by the residual summation of the layer input, and a $1 \times 1$ convolution layer which introduces a skip connection. Each residual-layer is conditioned on the encoding described above. The summed skip connections are passed through two fully connected layers and a softmax activation to output the next timestep probability. A detailed diagram of the WaveNet autoencoder is shown in Fig. 1 (b).
63
+
64
+ We modify the fast nv-wavenet CUDA inference kernels, which implement the architecture suggested by Ping et al. (2018), and create efficient WaveNet kernels that implement the WaveNet architecture suggested by Engel et al. (2017). Specifically, we make the following modifications to nv-wavenet: (i) we add initialization of skip connections with previous WAV samples, (ii) we increase the kernel capacity to support 128 residual channels and (iii) we also add the conditioning to the last fully connected layer.
65
+
66
+ # 3.2 AUDIO INPUT AUGMENTATION
67
+
68
+ In order to improve the generalization capability of the encoder, as well as to enforce it to maintain higher-level information, we employ a dedicated augmentation procedure that changes the pitch locally. The resulting audio is of a similar quality but is slightly out of tune.
69
+
70
+ Specifically, we perform our training on segments of one second length. For augmentation, we uniformly select a segment of length between 0.25 and 0.5 seconds, and modulate its pitch by a random number between -0.5 and 0.5 of half-steps, using librosa (McFee et al., 2015).
71
+
72
+ # 3.3 TRAINING AND THE LOSSES USED
73
+
74
+ Let $s ^ { j }$ be an input sample from domain $j = 1 , 2 , \dots , k ,$ $k$ being the number of domains employed during training. Let $E$ be the shared encoder, and $D ^ { j }$ the WaveNet decoder for domain $j$ . Let $C$ be the domain classification network, and $O ( s , r )$ be the random augmentation procedure applied to a sample $s$ with a random seed $r$ .
75
+
76
+ The network $C$ predicts which domain the input data came from, based on the latent vectors. It applies three 1D-convolution layers, with the ELU (Clevert et al., 2017) nonlinearity. The last layer projects the vectors to dimension $k$ and the vectors are subsequently averaged to a single $\mathbb { R } ^ { k }$ vector. A detailed diagram of network $C$ is shown as part of Fig. 1 (b).
77
+
78
+ During training, the domain classification network $C$ minimizes the classification loss
79
+
80
+ $$
81
+ \Omega = \sum _ { j } \sum _ { s ^ { j } } \operatorname { \mathbb { E } } _ { r } \mathcal { L } ( C ( E ( O ( s ^ { j } , r ) ) ) , j ) ,
82
+ $$
83
+
84
+ and the music to music autoencoders $j = 1 , 2 , \dots$ are trained with the loss
85
+
86
+ $$
87
+ - \lambda \Omega + \sum _ { j } \sum _ { s ^ { j } } \operatorname { \mathbb { E } } \mathcal { L } ( D ^ { j } ( E ( O ( s ^ { j } , r ) ) ) , s ^ { j } )
88
+ $$
89
+
90
+ where $\mathcal { L } ( o , y )$ is the cross entropy loss applied to each element of the output $o$ and the corresponding element of the target $y$ separately. Note that the decoder $D ^ { j }$ is an autoregressive model that is conditioned on the output of $E$ . During training, the autoregressive model is fed the target output $s ^ { j }$ from the previous time-step, instead of the generated output.
91
+
92
+ # 3.4 NETWORK DURING INFERENCE
93
+
94
+ To perform the actual transformation from a sample $s$ from any domain, even from an unseen musical domain, to output domain $j$ , we apply the autoencoder of domain $j$ to it, without applying the distortion. The new sample $\hat { s } ^ { j }$ is, therefore, given as $D ^ { j } ( E ( s ) )$ . The bottleneck during inference is the WaveNet autoregressive process, which is optimized by the dedicated CUDA kernels.
95
+
96
+ # 4 EXPERIMENTS
97
+
98
+ We conduct music translation experiments, using a mix of human evaluation and qualitative analysis, in order to overcome the challenges of evaluating generative models. The experiments were done in two phases. In the first phase, described in an earlier technical report (Mor et al., 2018), we train our network on six arbitrary classical musical domains: (i) Mozart’s symphonies conducted by Karl Bohm, (ii) Haydn’s string quartets, performed by the Amadeus Quartet, (iii) J.S Bach’s cantatas for ¨ orchestra, chorus and soloists, (iv) J.S Bach’s organ works, (v) Beethoven’s piano sonatas, performed by Daniel Barenboim, and (vi) J.S Bach’s keyboard works, played on Harpsichord. The music recordings by Bach (iii,iv,vi) are from the Teldec 2000 Complete Bach collection.
99
+
100
+ In the second phase, in order to allow reproducibility and sharing of the code and models, we train on audio data from MusicNET (Thickstun et al., 2017). Domains were chosen as the largest domains that show variability between composers and instruments. The following six domains were selected: (i) J.S Bach’s suites for cello, (ii) Beethoven’s piano sonatas, (iii) Cambini’s Wind Quintet, (iv) J.S Bach’s fugues, played on piano, (v) Beethoven’s violin sonatas and (vi) Beethoven’s string quartet. This public dataset is somewhat smaller than the data used in phase one.
101
+
102
+ The phases differ in the depth of the decoders: in the first phase, we employed blocks of ten layers, while in the second, we shifted to larger receptive fields and blocks of 14. The training and test splits are strictly separated by dividing the tracks (or audio files) between the two sets. The segments used in the evaluation experiments below were not seen during training. During training, we iterate over the training domains, such that each training batch contains 16 randomly sampled one second samples from a single domain. Each batch is first used to train the domain classification network $C$ , and then to train the universal encoder and the domain decoder, given the updated discriminator.
103
+
104
+ The method was implemented in the PyTorch framework, and trained on eight Tesla V100 GPUs for a total of 6 days. We used the ADAM optimization algorithm with a learning rate of $1 0 ^ { - 3 }$ and a decay factor of 0.98 every 10,000 samples. We weighted the confusion loss with $\lambda = 1 0 ^ { - 2 }$ .
105
+
106
+ Table 1: MOS scores (mean $\pm$ SD) for the conversion tasks.
107
+
108
+ <table><tr><td rowspan="2">Converter</td><td colspan="2">Harpsichord→Piano</td><td colspan="2">Orchestra-→ Piano</td><td colspan="2">New domains-→ Piano</td></tr><tr><td>Audio quality</td><td>Translation success</td><td>Audio quality</td><td>Translation success</td><td>Audio quality</td><td>Translation success</td></tr><tr><td>Musician E</td><td>3.89 ± 1.06</td><td>4.10± 0.94</td><td>4.02± 0.81</td><td>4.12± 0.97</td><td>4.44±0.82</td><td>4.13± 0.83</td></tr><tr><td>Musician M</td><td>3.82 ± 1.18</td><td>3.75± 1.17</td><td>4.13± 0.89</td><td>4.12± 0.98</td><td>4.48±0.72</td><td>3.97± 0.88</td></tr><tr><td>Musician A</td><td>3.69 ± 1.08</td><td>3.91± 1.16</td><td>4.06± 0.86</td><td>3.99± 1.08</td><td>4.53±0.79</td><td>3.93± 0.95</td></tr><tr><td>Our</td><td>2.95 ± 1.18</td><td>3.07± 1.30</td><td>2.56± 1.04</td><td>2.86± 1.16</td><td>2.36±1.17</td><td>3.18± 1.14</td></tr></table>
109
+
110
+ # 4.1 EVALUATION OF TRANSLATION QUALITY
111
+
112
+ The first set of experiments compared the method to human musicians using the phase one network. Since human musicians, are equipped by evolution with music skills, selected among their peers according to their talent, and who have trained for decades, we do not expect to do better than humans at this point. To perform this comparsion, music from domain $X$ was converted to piano, for various $X$ . The piano was selected for practical reasons: pianists are in higher availability than other musicians and a piano is easier to produce than, e.g., an orchestra.
113
+
114
+ Three professional musicians with a diverse background were employed for the conversion task: E, who is a conservatory graduate with an extensive background in music theory and piano performance, and also specializes in transcribing music; M, who is a professional producer, composer, pianist and audio engineer, who is an expert in musical transcription; and A who is a music producer, editor, and a skilled player of keyboards and other instruments.
115
+
116
+ The task used for comparison was to convert 60 segments of five seconds each to piano. Three varied sources were used. 20 of the segments were from Bach’s keyboard works, played on a Harpsichord, and 20 others were from Mozart’s 46 symphonies conducted by Karl Bohm, which are ¨ orchestral works. The last group of 20 segments was a mix of three different domains that were not encountered during training – Swing Jazz, metal guitar riffs, and instrumental Chinese music. The 60 music segments were encoded by the universal encoder and decoded by the WaveNet trained on Beethoven’s piano sonatas, as performed by Daniel Barenboim.
117
+
118
+ In order to compare between the conversions, we employed human evaluation, which is subjective and could be a mix of the assessment of the audio quality and the assessment of the translation itself. This limits the success of the automatic method, since the quality of the algorithm’s output is upper bounded by the neural network architecture and cannot match that of a high quality recording.
119
+
120
+ Since there is a trade-off between the fidelity to the original piece and the ability to create audio in the target domain, we present two scores: audio quality of the output piano and a matching score for the translation. While one can argue that style is hard to define and, therefore, such subjective experiments are not well founded, there are many similar MOS experiments in image to image translation, e.g., (Lample et al., 2017), and indeed MOS studies are used exactly where the translation metric is perceptual and subjective.
121
+
122
+ Specifically, Mean Opinion Scores (MOS) were collected using the CrowdMOS (Ribeiro et al., 2011) package. Two questions were asked: (1) what is the quality of the audio, and (2) how well does the converted version match the original. The results are shown in Tab. 1. It shows that our audio quality is considerably lower than the results produced by humans, using a keyboard connected to a computer (which should be rated as near perfect and makes any other audio quality in the MOS experiment pale in comparison). Regarding the translation success, the conversion from Harpsichord is better than the conversion from Orchestra. Surprisingly, the conversion from unseen domains is more successful than both these domains. In all three cases, our system is outperformed by the human musicians, whose conversions will soon be released to form a public benchmark.
123
+
124
+ Lineup experiment In another set of experiments, we evaluate the ability of persons to identify the source musical segment from the conversions. We present, in each test, a set of six segments. One segment is a real segment from a random domain out of the ones used to train our network, and five are the associated translations. We shuffle the segments and ask which is the original one and which are conversions. To equate the quality of the source to that of the translations and prevent identification by quality, we attach the source after passing it through its domain’s autoencoder.
125
+
126
+ ![](images/293098298e93b1a6e0ff4c825ebfca2e556ed1d935525d1d4f333f50890f2a8e.jpg)
127
+ Figure 2: Results of the lineup experiment. (a) listeners from the general population tend to select the same domain as the source regardless of the actual source. (b) the musician A failed to identify the source most of the time. (c) the amateurs T and (d) S failed most of the time.
128
+
129
+ The translation is perfectly authentic, if the distribution of answers is uniform. However, the task is hard to define. In a first attempt, Amazon Mechanical Turk (AMT) freelancers tended to choose the Mozart domain as the source, regardless of the real source and the presentation order, probably due to its relatively complex nature in comparison to the other domains. This is shown in the confusion matrix of Fig. 2(a). We, therefore, asked two amateur musicians (T, a guitarist, and S a dancer and a drummer with a background in piano) and the professional musician A (from the first experiment) to identify the source sample out of the six options, based on authenticity.
130
+
131
+ The results, in Fig. 2(b-d) show that there is a great amount of confusion. T and A failed in most cases, and A tended to show a similar bias to the AMT freelancers. S also failed to identify the majority of the cases, but showed coherent confusion patterns between pairs of instruments.
132
+
133
+ NSynth pitch experiments NSynth (Engel et al., 2017) is an audio dataset containing samples of 1,006 instruments, each sample labeled with a unique pitch, timbre, and envelope. Each sample is a four second monophonic 16kHz snippet, ranging over every pitch of a standard MIDI piano (21-108) as well as five different velocities. It was not seen during training of our system.
134
+
135
+ We measure the correlation of embeddings retrieved using the encoder of our network across pitch for multiple instruments. The first two columns (from the left hand side) of Fig. 3 show selfcorrelations, while the third column shows correlation across instruments. As can be seen, the embedding encodes pitch information very clearly, despite being trained on complex polyphonic audio. The cosine similarity between the two instruments for the same pitch is, on average, 0.90-0.95 (mean of the diagonal), depending on the pair of instruments.
136
+
137
+ # 4.2 EXPLORATORY EXPERIMENTS
138
+
139
+ In order to freely share our trained models and allow for maximal reproducibility, we have retrained the network with data from MusicNet (Thickstun et al., 2017). The following experiments are based on this network and are focused on understanding the properties of the conversion. The description is based on the supplementary media available at musictranslation.github.io.
140
+
141
+ Are we doing more than timbral transfer? Is our system equivalent to pitch estimation followed by rendering with a different instrument, or can it capture stylistic musical elements? We demonstrate that our system does more than timbral transfer in two ways. Consider the conversions presented in supplementary S1, which consist of many conversion examples from each of the domains to every other domain. There are many samples where it is clear that more than timbral transfer is happening. For example, when converting Beethoven’s string quartet music to a wind quintet (Sample #30), an ornamentation note is added in the output that is nowhere to be found in the input music; when converting Beethoven’s violin sonata to Beethoven’s solo piano (Samples $\# 2 4$ and $\# 2 3$ ), the violin line seamlessly integrated into the piano part; when converting Beethoven’s solo piano music to Bach’s solo cello (Sample #9), the bass line of the piano is converted to cello. It is perhaps most evident when converting solo piano to piano and violin; an identity transformation would have been a valid translation, but the network adds a violin part to better match the output distribution.
142
+
143
+ ![](images/f0d11ae8c94a6609dda271d7e0f52ae9c63c2c0eb4bb65d8e3c358b93bc58141.jpg)
144
+ Figure 3: Correlation of embeddings across pitch. (a) Self-correlation for NSynth’s flute-acoustic027. (b) Self-correlation for keyboard-electronic-019. (c) The correlation between the electronic keyboard (y-axis) and the flute. (d) Self-correlation for brass-acoustic-018. (e) Self-correlation for string-acoustic-029. (f) The correlation between the brass instrument (y-axis) and the string.
145
+
146
+ To further demonstrate the capabilities of our system, we train a network on two piano domains: MusicNet solo piano recordings of Bach and Beethoven. We reduce the size of the latent space to 8 to limit the ability of the original input to be repeated exactly, thereby encouraging the decoders to be more ”creative” than they normally would, with the goal of observing how decoders trained on different training data will use their freedom of expression. The input we employ is a simple MIDI synthesized as a piano. Supplementary S2 presents a clear stylistic difference: one can hear some counterpoint in the Bach sample, whereas the Beethoven output exhibits a more “Sturm und Drang” feeling, indicating that the network learns stylistic elements from the training data.
147
+
148
+ Comparison with previous methods We compare our results with those of Concatenative Synthesis methods in supplementary S3. To do that, we use our system to translate target files from published results of two works in that field, and present the methods’ results side-by-side. Samples 1 and 2 are compared with the published results of Coleman (2016), a work comparing several Concatenative Synthesis methods, and uses a violin passage as source audio input. Sample 3 is compared with MATConcat (Sturm, 2006), which uses a corpus of string quartets as a source material. Sample 1 is a fugue performed on a piano. We show that we are able to convincingly produce string quartet and wind ensemble renditions of the piece. To push our model to its boundaries, we also attempt to convert the polyphonic fugue to solo cello, obtaining a rather convincing result. We believe that our results surpass in naturalness those obtained by concatenative methods. Sample 2 is an orchestra piece, which for our system is data that has never been seen during training. We convert it to piano, solo cello and a wind quintet, achieving convincing results, that we believe surpass the concatenative synthesis results. Sample 3 is another orchestra piece, which includes a long drum roll, followed by brass instruments. It is not quite well-defined how to convert a drum roll to a string quartet, but we believe our rendition is more coherent. Our method is able to render the brass instruments and orchestral music after the drum roll more convincingly than MATConcat, which mimics the audio volume but loses most musical content.
149
+
150
+ Universality Note that our network has never observed drums, brass instruments or an entire orchestra during training, and, therefore, the results of supplementary S3 also serve to demonstrate the versatility of the encoder module resulting from our training procedure (and so do those of S2). Supplementary S4 presents more out-of-domain conversion results, including other domains from MusicNet, whistles, and even spontaneous hand clapping.
151
+
152
+ The universality property hinges on the success of training a domain-independent representation. As can be seen in the confusion matrices given in Fig. 4, the domain classification network does not do considerably better than chance when the networks converge.
153
+
154
+ Ablation Analysis We conducted three ablation studies. In the first study, the training procedure did not use the augmentation procedure of Sec. 3.2. This resulted in a learning divergence during training, and we were unable to obtain a working model trained without augmentation, despite considerable effort.
155
+
156
+ In order to investigate the option of not using augmentation in a domain where training without it converges, we have applied our method to the task of voice conversion. Our experiments show a clear advantage for applying augmentation, see Appendix A. Additional experiments were conducted, for voice conversion, using the VQ-VAE method of van den Oord et al. (2017).
157
+
158
+ In the second ablation study, the domain classification network was not used $\lambda = 0$ ). Without requiring that the shared encoder remove domain-specific information from the latent representation of the input, the network learned to simply encode all information in the latent vectors, and all decoders learned to turn this information back to the original waveform. This resulted in a model that does not do any conversion at all.
159
+
160
+ Finally, we performed an ablation study on the latent code size, in which we convert a simple MIDI clip to the Beethoven domain and the Bach domain. Samples are available as supplementary S6. As can be heard, a latent dimensionality of 64 tends to reconstruct the input (unwanted memorization). A model with a latent space of 8 (used in S2) performs well. A model with a latent dimensionality of 4 is more creative, less related to the input midi, and also suffers from a reduction in quality.
161
+
162
+ Semantic blending We blend two encoded musical segments linearly in order to check the additivity of the embedding space. For that, we have selected two random five second segments $i$ and $j$ from each domain and embedded both using the encoder, obtaining $e _ { i }$ and $e _ { j }$ . We then combine the embeddings as follows: starting with 3.5 seconds from $e _ { i }$ , we combine the next 1.5 seconds of $e _ { i }$ with the first 1.5 seconds of $e _ { j }$ using a linear weighting with weights $1 - t / 1 . 5$ and $t / 1 . 5$ respectively, where $t \in [ 0 , 1 . 5 ]$ . We then use the various decoders to generate audio. The results are natural and the shift is completely seamless, as far as we observe. See supplementary S5 for samples.
163
+
164
+ The samples also demonstrate that in the scenario we tested, one can alternatively use fade-in and fade-out to create a similar effect. We therefore employ a second network that is used for a related task of voice conversion (see Appendix A) and demonstrate that in the case of voice conversion, latent space embedding is clearly superior to converting the audio itself. These samples can also be found in supplementary S5 for details and samples.
165
+
166
+ # 5 DISCUSSION
167
+
168
+ Our work demonstrates capabilities in music conversion, which is a high-level task (a terminology that means that they are more semantic than low-level audio processing tasks), and could open the door to other high-level tasks, such as composition. We have initial results that we find interesting: by reducing the size of the latent space, the decoders become more “creative” and produce outputs that are natural yet novel, in the sense that the exact association with the original input is lost.
169
+
170
+ # ACKNOWLEDGMENTS
171
+
172
+ This work is part of Adam Polyak’s Ph.D thesis research conducted at Tel Aviv University.
173
+
174
+ ![](images/97bfcf7f6456a18cd5c56163146ca7fee1bd8ddc8d766e43a47d611f03e524aa.jpg)
175
+ Figure 4: Accuracy of the domain classification network. (a) A confusion matrix of the domain classification network at the end of training on the private dataset used in the first phase of experiments. The mean accuracy is 0.30. (b) The confusion matrix for the MusicNet dataset used in the second phase of experiments. The mean accuracy is 0.24.
176
+
177
+ # REFERENCES
178
+
179
+ Shaun Barry and Youngmoo Kim. style transfer for musical audio using multiple time-frequency representations, 2018. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } }$ BybQ7zWCb.
180
+
181
+ Yunjey Choi, Min-Je Choi, Munyoung Kim, Jung-Woo Ha, Sunghun Kim, and Jaegul Choo. StarGAN: Unified generative adversarial networks for multi-domain image-to-image translation. In arXiv preprint 1711.09020, 2017.
182
+
183
+ Djork-Arne Clevert, Thomas Unterthiner, and Sepp Hochreiter. Fast and accurate deep network ´ learning by exponential linear units (elus). In International Conference on Learning Representations (ICLR), 2017.
184
+
185
+ G Coleman. Descriptor Control of Sound Transformations and Mosaicing Synthesis. PhD thesis, Universitat Pompeu Fabra, Barcelona, 2016.
186
+
187
+ Sander Dieleman, Aaron van den Oord, and Karen Simonyan. The challenge of realistic music ¨ generation: modelling raw audio at scale. In Advances in Neural Information Processing Systems, 2018.
188
+
189
+ Jesse Engel, Cinjon Resnick, Adam Roberts, Sander Dieleman, Mohammad Norouzi, Douglas Eck, and Karen Simonyan. Neural audio synthesis of musical notes with WaveNet autoencoders. In ICML, 2017.
190
+
191
+ Yaroslav Ganin, Evgeniya Ustinova, Hana Ajakan, Pascal Germain, Hugo Larochelle, Franc¸ois Laviolette, Mario Marchand, and Victor Lempitsky. Domain-adversarial training of neural networks. J. Mach. Learn. Res., 17(1):2096–2030, 2016.
192
+
193
+ Leon A. Gatys, Alexander S. Ecker, and Matthias Bethge. Image style transfer using convolutional neural networks. In CVPR, 2016.
194
+
195
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In NIPS. 2014.
196
+
197
+ Gaetan Hadjeres and Franc¸ois Pachet. DeepBach: a steerable model for bach chorales generation.¨ In ICML, 2017.
198
+
199
+ Albert Haque, Michelle Guo, and Prateek Verma. Conditional end-to-end audio transforms. In Arxiv preprint 1804.00047, 2018.
200
+
201
+ Keith Ito. The lj speech dataset, 2017. URL ttps://keithito.com/ LJ-Speech-Dataset.
202
+ Justin Johnson, Alexandre Alahi, and Li Fei-Fei. Perceptual losses for real-time style transfer and super-resolution. In ECCV, 2016.
203
+ Takuhiro Kaneko and Hirokazu Kameoka. Parallel-data-free voice conversion using cycle-consistent adversarial networks. arXiv preprint arXiv:1711.11293, 2017.
204
+ Taeksoo Kim, Moonsu Cha, Hyunsoo Kim, Jungkwon Lee, and Jiwon Kim. Learning to Discover Cross-Domain Relations with Generative Adversarial Networks. In ICML, 2017.
205
+ Simon King and Vasilis Karaiskos. The blizzard challenge 2011. In Blizzard Challenge workshop, 2011.
206
+ Simon King and Vasilis Karaiskos. The blizzard challenge 2013. In Blizzard Challenge workshop, 2013.
207
+ Diederik P Kingma and Max Welling. Auto-encoding variational bayes. Stat, 2014.
208
+ Guillaume Lample, Neil Zeghidour, Nicolas Usunier, Antoine Bordes, Ludovic Denoyer, et al. Fader networks: Manipulating images by sliding attributes. In Advances in Neural Information Processing Systems, pp. 5967–5976, 2017.
209
+ Ming-Yu Liu and Oncel Tuzel. Coupled generative adversarial networks. In NIPS, pp. 469–477. 2016.
210
+ Ming-Yu Liu, Thomas Breuel, and Jan Kautz. Unsupervised image-to-image translation networks. In NIPS. 2017.
211
+ Christos Louizos, Kevin Swersky, Yujia Li, Max Welling, and Richard Zemel. The variational fair autoencoder. arXiv preprint arXiv:1511.00830, 2015.
212
+ Brian McFee, Colin Raffel, Dawen Liang, Daniel PW Ellis, Matt McVicar, Eric Battenberg, and Oriol Nieto. librosa: Audio and music signal analysis in python. 2015.
213
+ Noam Mor, Lior Wolf, Adam Polyak, and Yaniv Taigman. A universal music translation network. arXiv preprint arXiv:1805.07848, 2018.
214
+ Carthach ´ O Nuan ´ ain, Perfecto Herrera, and Sergi Jord ´ a. Rhythmic concatenative synthesis for elec- \` tronic music: Techniques, implementation, and evaluation. Computer Music Journal, 41(2):21– 37, June 2017. ISSN 0148-9267. doi: 10.1162/COMJ a 00412.
215
+ Wei Ping, Kainan Peng, Andrew Gibiansky, Sercan Omer Arik, Ajay Kannan, Sharan Narang, ¨ Jonathan Raiman, and John Miller. Deep Voice 3: 2000-speaker neural text-to-speech. In ICLR, 2018.
216
+ Dario Rethage, Jordi Pons, and Xavier Serra. A wavenet for speech denoising. arXiv preprint arXiv:1706.07162, 2017.
217
+ Flavio Ribeiro, Dinei Flor ´ encio, Cha Zhang, and Michael Seltzer. Crowdmos: An approach for ˆ crowdsourcing mean opinion score studies. In Acoustics, Speech and Signal Processing (ICASSP), IEEE International Conference, pp. 2416–2419. IEEE, 2011.
218
+ Diemo Schwarz. Concatenative sound synthesis: The early years. Journal of New Music Research, 35(1):3–22, 2006.
219
+ Diemo Schwarz. Corpus-based sound synthesis survey, 2018. URL http://imtr.ircam.fr/ imtr/Corpus-Based_Sound_Synthesis_Survey.
220
+ Jonathan Shen, Ruoming Pang, Ron J. Weiss, Mike Schuster, Navdeep Jaitly, Zongheng Yang, Zhifeng Chen, Yu Zhang, Yuxuan Wang, R. J. Skerry-Ryan, Rif A. Saurous, Yannis Agiomyrgiannakis, and Yonghui Wu. Natural TTS synthesis by conditioning wavenet on mel spectrogram predictions. In ICASSP, 2018.
221
+
222
+ Ian Simon, Sumit Basu, David Salesin, and Maneesh Agrawala. Audio analogies: Creating new music from an existing performance by concatenative synthesis. In Int. Computer Music Conference, 2005.
223
+
224
+ Bob L Sturm. Adaptive concatenative sound synthesis and its application to micromontage composition. Computer Music Journal, 30(4):46–66, 2006.
225
+
226
+ John Thickstun, Zaid Harchaoui, and Sham Kakade. Learning Features of Music From Scratch. In ICLR, 2017.
227
+
228
+ D. Ulyanov, V. Lebedev, A. Vedaldi, and V. Lempitsky. Texture networks: Feed-forward synthesis of textures and stylized images. In ICML, 2016.
229
+
230
+ Aaron van den Oord, Oriol Vinyals, and Koray Kavukcuoglu. Neural Discrete Representation Learning. In NIPS, 2017.
231
+
232
+ Aron van den Oord, Sander Dieleman, Heiga Zen, Karen Simonyan, Oriol Vinyals, Alexander Graves, Nal Kalchbrenner, Andrew Senior, and Koray Kavukcuoglu. Wavenet: A generative model for raw audio. In Arxiv preprint 1609.03499, 2016.
233
+
234
+ V Verfaille and D Arfib. A-dafx: Adaptive digital audio effects. energy, 2000.
235
+
236
+ Zili Yi, Hao Zhang, Ping Tan, and Minglun Gong. DualGAN: Unsupervised dual learning for image-to-image translation. In ICCV, 2017.
237
+
238
+ Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A Efros. Unpaired image-to-image translation using cycle-consistent adversarial networks. In ICCV, 2017.
239
+
240
+ Aymeric Zils and Franc¸ois Pachet. Musical mosaicing. In Digital Audio Effects $( D A F x )$ , volume 2, pp. 135, 2001.
241
+
242
+ # A VOICE CONVERSION EXPERIMENTS
243
+
244
+ We further evaluate our method on the task of voice conversion, which is not as challenging as the music conversion task explored in this work. It is, therefore, a convenient test bed when comparing to the VQ-VAE (van den Oord et al., 2017) method, which, as we mention in the paper, did not perform well in our music-based experiments, and which was shown by the authors to work on voice conversion.
245
+
246
+ In addition, as mentioned in Sec. 4.2, successful training on the music domains requires data augmentation. In voice conversion, we were able to successfully train our network even without data augmentation, and we can therefore perform a direction comparison.
247
+
248
+ We apply our method, a variant without data augmentation, and the VQVQE method on three publicly available datasets: “Nancy” from Blizzard 2011 (King & Karaiskos, 2011), Blizzard 2013 (King & Karaiskos, 2013) and LJ (Ito, 2017) dataset. The generated samples are obtained by converting an audio produced by the Google Cloud TTS robot to these three voices. The models are evaluated by their quality using the Mean Opinion Score, as obtained with the CrowdMOS (Ribeiro et al., 2011) package.
249
+
250
+ As can be seen in Tab. 2, samples generated by our WaveNet autoencoder based method are of higher quality than those of VQ-VAE. A second results is that the method trains well in voice conversion, even without the data augmentation. However, this leads to inferior results.
251
+
252
+ # A.1 VOICE CONVERSION ARCHITECTURES
253
+
254
+ We slightly modify the WaveNet autoencoder used in our method for the voice conversion task. Specifically, we modify the size of the latent encoding to be in $\mathbb { R } ^ { 4 8 }$ , instead of $\mathbb { R } ^ { 6 4 }$ . The rest of the model details remain the same as in the music translation task.
255
+
256
+ In our implementation of the VQ-VAE, the encoder was composed of 6 one-dimensional convolution layer with a ReLU activation. As in the original paper, the convolutions were with a stride of 2 and kernel size of 4. Therefore, the mu-law quantized waveform is temporally downsampled by $\times 6 4$ . We used a dictionary of 512 vectors in $\mathbb { R } ^ { 1 2 8 }$ . The obtained quantized encoding is upsampled and serves to condition a decoder which reconstructs the input waveform. Here as well, we follow the original paper and implement a single WaveNet decoder for all three speaker domains, this is achieved by concatenating the quantized encoding with a learned speaker embedding. We train the VQ-VAE using dictionary updates with Exponential Moving Averages (EMA) with a decay parameter of $\gamma = 0 . 9 9$ and a commitment parameter of $\beta = 1$ .
257
+
258
+ Table 2: MOS scores (mean $\pm$ SD) for the unseen speaker conversion.
259
+
260
+ <table><tr><td></td><td>Blizzard 2013</td><td>Nancy</td><td>LJ</td></tr><tr><td>Our method</td><td>3.16 ± 0.79</td><td>3.85 ± 0.84</td><td>3.40± 0.77</td></tr><tr><td>Our method - without augmentation</td><td>3.07 ± 0.79</td><td>3.87 ± 0.85</td><td>2.85± 0.92</td></tr><tr><td>VQ-VAE</td><td>2.53 ± 1.08</td><td>2.92 ± 0.92</td><td>2.22± 0.96</td></tr></table>
md/train/HJGv1Z-AW/HJGv1Z-AW.md ADDED
@@ -0,0 +1,263 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # EMERGENCE OF LINGUISTIC COMMUNICATION FROM REFERENTIAL GAMES WITH SYMBOLIC AND PIXEL INPUT
2
+
3
+ Angeliki Lazaridou∗, Karl Moritz Hermann, Karl Tuyls, Stephen Clark
4
+ DeepMind,
5
+ London, UK
6
+
7
+ # ABSTRACT
8
+
9
+ The ability of algorithms to evolve or learn (compositional) communication protocols has traditionally been studied in the language evolution literature through the use of emergent communication tasks. Here we scale up this research by using contemporary deep learning methods and by training reinforcement-learning neural network agents on referential communication games. We extend previous work, in which agents were trained in symbolic environments, by developing agents which are able to learn from raw pixel data, a more challenging and realistic input representation. We find that the degree of structure found in the input data affects the nature of the emerged protocols, and thereby corroborate the hypothesis that structured compositional language is most likely to emerge when agents perceive the world as being structured.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ The study of emergent communication is important for two related problems in language development, both human and artificial: language evolution, the development of communication protocols from scratch (Nowak & Krakauer, 1999); and language acquisition, the ability of an embodied agent to learn an existing language. In this paper we focus on the problem of how environmental or pre-linguistic conditions affect the nature of the communication protocol that an agent learns. The increasing realism and complexity of environments being used for grounded language learning (Brockman et al., 2016; Hermann et al., 2017) present an opportunity to analyse these effects in detail.
14
+
15
+ In line with previous work on emergent communication, we are strongly motivated by the view that language derives meaning from its use (Wittgenstein, 1953; Wagner et al., 2003). This perspective especially motivates the study of language emergence in cases where co-operative agents try to achieve shared goals in game scenarios (Steels, 2003; Brighton & Kirby, 2006; Mordatch & Abbeel, 2017), and is related to the study of multi-agent and self-play methods that have found great success in other areas of machine learning (Bansal et al., 2017; Silver et al., 2017). Here we focus on simple referential games, in which one agent must communicate to another a target object in the agent’s environment.
16
+
17
+ One of the most important properties of natural language is compositionality. Smaller building blocks (e.g. words, morphemes) are used to generate unbounded numbers of more complex forms (e.g. sentences, multi-word expressions), with the meaning of the larger form being determined by the meanings of its parts and how they are put together (Frege, 1892). Compositionality is an advantage in any communication protocol as it allows in principle infinite expression through a finite dictionary and a finite set of combination rules. In emergent communication research, previous work has shown that agents can produce (somewhat) compositional protocols when engaging in language games (Steels, 2003). However, the computational agents were typically situated in artificial worlds containing just a handful of objects, represented as disentangled, structured, and sometimes even atomic symbols, e.g. attribute-based or one-hot vectors (Batali, 1998; Brighton, 2002; Franke, 2015; Andreas & Klein, 2017; Mordatch & Abbeel, 2017). However, humans receive raw sensorimotor rather than symbolic input, and little work to date has tested whether these findings carry over when agents are situated in less idealized worlds that bear more similarity to the kind of entangled and noisy environments to which humans are typically exposed.1
18
+
19
+ ![](images/aea3a2fceb920cffdae0270c243ac52b72776e4d05ae8e6a4c4b0000f5f4d17a.jpg)
20
+ Figure 1: High-level overview of the referential game.
21
+
22
+ In this work, in the context of referential communication games (see Figure 1), we contrast the results of two studies that lie at the extremes of how much structure is provided by the environment. The first study (Section 3) focuses on symbolic representations, where objects are represented as bags-of-attributes; this representation is inherently disentangled since dimensions encode individual properties. The second study (Section 4) considers raw perceptual input, hence data that more closely resembles what humans are exposed to. Clearly, the latter is a more challenging and realistic scenario as the computational agents are operating on entangled inputs with no pre-coded semantics. Crucially, both studies use the same referential game setup, the same learning procedure (policy learning methods) and the same neural network agent architectures.
23
+
24
+ We show that reinforcement learning agents can successfully communicate, not only when presented with symbolic and highly structured input data, but (and more importantly) even when presented with raw pixel input. This result opens up the possibility of more realistic simulations of language emergence. We successfully use the learning signal from the referential game to train agents end-to-end, including cases where the agents need to perform visual processing of images with a convolutional neural network. However, we find that the agents struggle to produce structured messages when presented with entangled input data (Bengio et al., 2013) due to the difficulty of uncovering the true factors of variation, corroborating the hypothesis of Smith et al. (2003) that structured (compositional) language is most likely to emerge when agents perceive the world as structured.
25
+
26
+ # 2 REFERENTIAL GAMES AS MULTI-AGENT CO-OPERATIVEREINFORCEMENT LEARNING
27
+
28
+ The referential game is implemented as an instance of multi-agent co-operative reinforcement learning, in which two agents take discrete actions in their environment in order to maximize a shared reward.
29
+
30
+ # 2.1 GAME AND TERMINOLOGY
31
+
32
+ The referential game is a variant of the Lewis signaling game (Lewis, 1969), which has been extensively used in linguistic and cognitive studies in the context of language evolution (e.g., Briscoe, 2002; Cangelosi & Parisi, 2002; Steels & Loetzsch, 2012; Spike et al., 2016; Lazaridou et al., 2017).
33
+
34
+ Figure 1 provides a schematic description of our setup. First, a speaker is presented with a target object (highlighted as CAR in the symbolic example on the left, and highlighted as the far right image in the pixel example on the right). Then, by making use of an alphabet consisting of primitive discrete symbols $( ^ { \ast \cdot } 2 2 ^ { \cdot \prime } , ^ { \cdot \cdot } 1 0 ^ { \cdot \prime } , ^ { \cdot \cdot } 0 ^ { \cdot \prime } , ^ { \cdot \cdot } 2 ^ { \cdot \prime } )$ , the speaker constructs a message describing that object (“22 $2 0 ^ { \circ } )$ . We will refer to the set of all distinct messages generated by the speaker as their lexicon or protocol. Finally, the listener is presented with the target and a set of distractor objects, and—by making use of the speaker’s message—has to identify the target object from the set of candidate objects. Communicative success is defined as the correct identification of the target by the listening agent.
35
+
36
+ Formally, the attribute-based object vectors (disentangled) or the pixel-based images (entangled) are the set of pre-linguistic items $W = \{ o _ { 1 } , \ldots , o _ { N } \}$ . From this set we draw a target $t \in W$ and subsequently $K - 1$ distractors $D = \{ d _ { 1 } , \dots , d _ { K - 1 } \} \subset W$ s.t. ∀j $t \neq d _ { j }$ . The speaker has only access to the target $t$ , while the listener receives candidate set $C = t \cup D$ , not knowing which of the elements in $C$ is target $t$ .
37
+
38
+ # 2.2 AGENTS
39
+
40
+ The speaker encodes $t$ into a dense representation $u$ using an encoder $f ^ { S } ( t , \theta _ { f } ^ { S } )$ . The function of this encoder depends on the type of pre-linguistic data used and is discussed separately for each study. Given an alphabet $A$ of discrete unit symbols (akin to words) and $u$ , the speaker next generates a discrete, variable-length, bounded message m by sampling symbols from a recurrent policy $\pi ^ { S }$ defined by a decoder $\check { g } ^ { S } ( u , \theta _ { g } ^ { S } )$ . The sequence generation is terminated either by the production of a stop symbol or when the maximum length $L$ has been reached. We implement the decoder as a single-layer LSTM (Hochreiter $\&$ Schmidhuber, 1997). Note that the symbols in the agents’ alphabet $A$ have no a priori meaning; rather, these symbols get grounded during the game.
41
+
42
+ The listening agent uses a similar encoder to the speaker but has independent network weights $( \theta _ { f } ^ { L } )$ . Applying this encoder to all candidate objects results in a set $U = \{ f ^ { L } ( c , \theta _ { f } ^ { L } ) \mid c \in C \}$ . For encoding the message $\mathbf { m }$ , we use a single-layer LSTM, denoted $h ^ { L }$ , which produces an encoding $z$ : $z = h ^ { L } ( \mathbf { \bar { m } } , \theta _ { h } ^ { L } )$ .
43
+
44
+ Given encoded message $z$ and candidates $U$ , the listener predicts a target object $t ^ { \prime } \in C$ following a policy $\pi ^ { L }$ implemented using a non-parametric pointing module; this module samples the predicted object from a Gibbs distribution computed via the dot product between vector $z$ and all encoded candidates $u \in U$ . See Appendix B for information regarding the agents’ architecture.
45
+
46
+ At inference time, we replace the stochastic sampling of the speaker’s message and the listener’s stochastic pointing module with deterministic processes. For the pointing module, the object with the highest probability is chosen. For the speaker’s message, this is generated in a greedy fashion by selecting the highest-probability symbol at each step.
47
+
48
+ # 2.3 LEARNING
49
+
50
+ All weights of the speaker and listener agents, $\theta = \{ \theta _ { f } ^ { S } , \theta _ { g } ^ { S } , \theta _ { f } ^ { L } , \theta _ { h } ^ { L } \}$ , are jointly optimized while playing the game. We emphasize that no weights are shared between the speaker and the listener, and the only supervision used is communicative success, i.e. whether the listener identified the correct target. The objective function that the two agents maximize for one training instance is:
51
+
52
+ $$
53
+ R ( t ^ { \prime } ) \left( \sum _ { l = 1 } ^ { L } \log p ( m _ { t } ^ { l } | m _ { t } ^ { < l } , u ) + \log p ( u _ { t ^ { \prime } } | z , U ) \right)
54
+ $$
55
+
56
+ where $R$ is the reward function returning 1 if $t = t ^ { \prime }$ (if the listener pointed to the correct target) and 0 otherwise. To maintain exploration in the speaker’s policy $\pi ^ { S }$ of generating a message, and the listener’s policy $\pi ^ { L }$ of pointing to the target, we add to the loss an entropy regularization term (Mnih et al., 2016). The parameters are estimated using the REINFORCE update rule (Williams, 1992). See Appendix $\mathbf { B }$ for more details regarding the learning.
57
+
58
+ <table><tr><td>max length</td><td>alphabet size</td><td>lexicon size</td><td>training accuracy</td><td>topographic p</td></tr><tr><td>2</td><td>10</td><td>31</td><td>92.0%</td><td>0.13</td></tr><tr><td>5</td><td>17</td><td>293</td><td>98.2%</td><td>0.16</td></tr><tr><td>10</td><td>40</td><td>355</td><td>98.5%</td><td>0.26</td></tr></table>
59
+
60
+ Table 1: Commumicative success (training accuracy in percentage) with varying maximum message length. alphabet size denotes the effective size of the symbol set used from a maximum of 100. lexicon size is the effective number of unique messages used. topographic $\rho$ reports the structural similarity in terms of Spearman $\rho$ correlation between the message and the object vector space. All Spearman $\rho$ correlations throughout the paper are significant with $p < 0 . 0 1$ .
61
+
62
+ # 3 STUDY 1: REFERENTIAL GAME WITH SYMBOLIC DATA
63
+
64
+ We first present experiments where agents are learning to communicate when presented with structured and disentangled input. We use the Visual Attributes for Concepts Dataset (VisA) of Silberer et al. (2013), which contains human-generated per-concept attribute annotations for 500 concrete concepts (e.g., cat, sofa, car) spanning across different categories (e.g., mammals, furniture, vehicles), annotated with 636 general attributes (e.g., has tail, is black, has wheels). We disregarded homonym concepts (e.g., bat), thus reducing our working set of concepts to 463 and the number of attributes to 573 (after eliminating any attribute that did not occur with the working concepts). On average, each concept has 11 attributes. All pre-linguistic objects are represented in terms of binary vectors $o \in \{ 0 , 1 \} ^ { 5 7 3 }$ . Note that these representations do carry some inherent structure; the dimensions in the object vectors are disentangled and so each object can be seen as a conjunction of properties. Speaker and listener convert the pre-linguistic representations to dense representations $u$ by using a single-layer MLP with a sigmoid activation function.
65
+
66
+ In all experiments, we set the number of candidate objects $K$ to five, meaning there were four wrong choices per correct one (resulting in a $2 0 \%$ random baseline). Inspired by Kottur et al. (2017), who show that non-compositional language emerges in the case of overcomplete alphabets, we set the size of alphabet $A$ to 100 symbols, which is smaller than the size of the set of objects (463).
67
+
68
+ # 3.1 AGENT PERFORMANCE AND AMBIGUITY
69
+
70
+ We first report model performance on the training data, comparing different settings for the maximal allowed message length (2, 5 or 10 symbols). Results are presented in Table 1 (ignore the last row topographic $\rho$ which will be explained in later sections).
71
+
72
+ In the case of the shortest message settings (maximum length 2), our trained agents on average only develop a protocol of 31 unique messages used to describe 363 training concepts (leaving aside 100 for testing). This indicates high levels of ambiguity, with each message being used to denote 11 concepts on average. Interestingly, recent findings suggest that ambiguity is a design feature of language that prevents the inefficient use of redundant codes, since some of the message content can be extracted from context: “the most efficient communication system will not convey information already provided by the context” (Piantadosi et al., 2012). In our case, we do no explicitly encode any bias towards ambiguity. We hypothesize that ambiguity arises due to the difficult exploration problem that agents are faced with, in combination with the fact that ambiguous protocols present a good local optimum that is over-represented in the hypothesis search space. As a result, in the absence of environmental pressures (e.g., a high number of carefully constructed distractors) a suboptimal policy can still achieve a reasonably high accuracy $( 9 2 \% )$ , making it even harder during training to escape from such a solution.
73
+
74
+ In classic signaling games, this polysemy phenomenon manifests itself as different states receiving the same signal and is termed partial pooling equilibrium (Skyrms, 2010). Perhaps rather counterintuitively, Skyrms (p.131) suggests that a way to obtain communication protocols that are robust to this type of local communication minima is to allow the invention of new signals, essentially increasing the search space of signals. Motivated by this suggestion, we play variants of the game in which we allow the agents to produce messages of greater maximum length (5 and 10), which leads to improved communicative success $9 8 . 2 \%$ and $9 8 . 5 \%$ respectively). We observe that the number of messages in the protocol increases from 31 to 293 and 355, respectively, reducing the average number of concepts a message can denote from 11 concepts to (approximately) 1 concept.
75
+
76
+ ![](images/f54b6c616adb9b6e25c20297338305d82c03c1c6cbacf39ded5809edadfd7eb1.jpg)
77
+ Figure 2: Training curves of different experimental setups with uniform and context-dependent target selection.
78
+
79
+ # 3.2 REALISTIC CONTEXT DISTRIBUTION
80
+
81
+ In the real world, when speakers refer to cats, listeners would likely be in a situation where they had to discriminate a cat in the context of a couch or a dog, rather than in the context of a mirror or a cow.2 Simply put, objects in the world do not appear in random contexts, but rather there is regularity in the distribution of situational and visual co-occurrences. This property of the world is typically not captured in referential games studied in the language emergence literature, with distractors usually drawn from a uniform distribution.
82
+
83
+ We address this issue and design an additional experiment with distractors sampled from a targetspecific context distribution reflecting normalized object co-occurrence statistics. Co-occurrence data is extracted from the MSCOCO caption dataset (Lin et al., 2014). This leads to more plausible distractor sets with, for instance, the target goat more likely being mixed with sheep and cow as distractors rather than bike or eggplant.
84
+
85
+ We find that the distractor selection process (uniform vs context-dependent) affects the language learning dynamics; see Figure 2 for training curves for different experimental configurations. While the non-uniform distractor sampling of the context-dependent setting can be exploited to learn a degenerate strategy —giving up to $40 \%$ communicative success shortly after the start of training— subsequently learning under this scenario takes longer. This effect is likely a combination of the local minimum achieved by the degenerate strategy of picking a target at random from only the topically relevant set of distractors, which initially makes the problem easier; however, the fact that the co-occurrence statistics tend to align with the feature vectors, means that similar objects are more likely to appear as distractors and hence the overall game becomes more difficult.
86
+
87
+ We now consider the question of how objects denoted by the same (ambiguous) message are related. When the context is drawn uniformly, object similarity is a predictor of object confusability, as similar objects tend to be mapped onto the same message (0.26 and 0.43 median pairwise cosine similarities of objects that received the same message as computed on the VisA space, for maximum message length 2 and 5, respectively). In the non-uniform case, we observe object confusability to be less influenced by object similarity (0.15 and 0.17 median pairwise cosine similarities of objects that received the same message, for maximum message length 2 and 5, respectively), but rather driven by the visual context co-occurrences. Simply put, in the non-uniform case confusability is less influenced by similarity since the agents must learn to distinguish between objects that naturally co-occur (e.g. sheep and goat). Thus, the choice of distractors, an experimental design decision that in existing language emergence literature has been neglected, has an effect on the organization (and potentially the naturalness) of the emerged language, for example as reflected in the semantics of ambiguous or homonym words in the language.
88
+
89
+ Table 2: Communicative success (acc in percentage) of agents evaluated on training (first row) and novel (last three rows) data. lexicon size column reports the percentage of novel messages (i.e., messages that were not used during the training).
90
+
91
+ <table><tr><td>Data</td><td>length 2 lexicon size</td><td>acc.</td><td>length 5 lexicon size</td><td>acc.</td><td>length 10 lexicon size</td><td>acc.</td></tr><tr><td>training data</td><td>31</td><td>92.0</td><td>293</td><td>98.2</td><td>355</td><td>98.5</td></tr><tr><td>test data</td><td>1</td><td>74.2</td><td>70</td><td>76.8</td><td>98</td><td>81.6</td></tr><tr><td>unigram chimera</td><td>5</td><td>39.3</td><td>88</td><td>40.5</td><td>99</td><td>47.0</td></tr><tr><td>uniform chimera</td><td>3</td><td>31.2</td><td>87</td><td>32.2</td><td>100</td><td>42.6</td></tr></table>
92
+
93
+ # 3.3 STRUCTURAL PROPERTIES OF EMERGED PROTOCOLS
94
+
95
+ Quantifying the degree of compositionality and structure found in the emerged language is a challenging task; to the best of our knowledge, there is no formal mathematical definition of compositionality that would allow for a definitive quantitative measure. Thus, research on this topic usually relies on defining necessary requirements that any language claiming to be compositional should adhere to, such as the ability to generalize to novel situations (Batali, 1998; Franke, 2015; Kottur et al., 2017). We adopt a similar strategy by measuring the extent to which an emerged language is able to generalize to novel objects (Section 3.3.1). Moreover, we also report quantitative results (Section 3.3.2) using a measure of message structure proposed in the language evolution literature (Brighton & Kirby, 2006; Carr et al., 2017).
96
+
97
+ # 3.3.1 GENERALIZATION TO NOVEL OBJECTS
98
+
99
+ We perform experiments where trained agents from Section 3.1 are exposed to different types of unseen objects, each of them differing to the degree to which the unseen objects resemble the objects found in the training data. In the test scenario, objects come from the same data distribution as the training data, but were not presented to the agents during training (e.g., a mouse); in the unigram chimeras scenario, the novel objects are constructed by sampling properties from a property-based distribution inferred from the training data, thus breaking any feature correlation (e.g., a mouselike animal with wheels); in the uniform chimeras scenario, the novel objects are constructed by uniformly sampling properties (e.g., a square red furry metallic object).
100
+
101
+ Table 2 reports the communicative success. While there is a drop in performance for unseen objects, agents are performing above random chance $( 2 0 \% )$ . The emerged language is indeed able to generalize to unseen objects; however, the degree of generalization is a function of the similarity between the training and unseen objects, thus resulting in the uniform chimeras setting obtaining the lowest performance.
102
+
103
+ Moreover, we observe examples of productivity, a key feature of compositionality. At test time, speakers are able to concoct novel messages on-the-fly (i.e., messages that are not part of their lexicon induced during training) to describe unseen objects. See the last three rows of Table 2, and the lexicon size column, for the percentage of novel messages. Even though listeners were not trained to associate novel messages with novel objects, they are still able comprehend such messages and correctly identify the target object. In the test data and length 10 cases, novel messages account for almost all of the generated messages, but with performance at $8 1 . 6 \%$ , providing evidence of the structure found in the messages.
104
+
105
+ # 3.3.2 TOPOGRAPHIC SIMILARITY
106
+
107
+ Given a set of objects, their meanings and the associated signals, Brighton & Kirby (2006) define topographic similarity to be the correlation of the distances between all the possible pairs of meanings and the corresponding pairs of signals. Figure 3 shows mappings between states and signals for examples of holistic (b) and compositional (c,d) languages, with the topographic similarity of compositional languages being higher than that of holistic. The intuition behind this measure is that semantically similar objects should have similar messages.
108
+
109
+ ![](images/cd5d57f50366fee02fe1b3ce12b993334e48d59f130b088d0fbe530764268416.jpg)
110
+ Figure 3: left: Three languages with different properties, taken from Brighton & Kirby (2006). The mapping between states and signals shown in (b) is random; there is no relationship between points in the meaning and signal space. In (c) and (d), similar meanings map to similar signals, i.e., there is a topographic relation between meanings and signals. right: Relation between objects’ cosine similarity and their message Levenshtein distance for trained and random agents.
111
+
112
+ To compute this measure, we first compute two lists of numbers: (i) the Levenshtein distances between all pairs of objects’ messages; and (ii) the cosine similarity between all pairs of objects’ VisA vectors. Given these two lists, the topographic similarity is defined as their negative Spearman $\rho$ correlation (since we are correlating distances with similarities, negative values of correlation indicate topographic similarity of the two spaces). Intuitively, if similar objects share much of the message structure (e.g., common prefixes or suffixes), and dissimilar objects have little common structure in their respective messages, then the topographic similarity should be high, the highest possible value being 1.
113
+
114
+ Results presented back in Table 1, in the topographic $\rho$ column, show that topographic similarity is positive in all experimental setups, indicating that similar objects receive similar messages $( p < 0 . 0 1$ , permutation test). A qualitative analysis of the messages generated in the length 10 and training data cases showed that, for example, $32 \%$ of the mammal objects had as a message prefix the bigram $9 5 \# 1 0 ^ { \star }$ ; $36 \%$ of vehicle objects had $\cdot 6 8 \# 9 5 $ ; and $11 \%$ of tool objects had ‘0#61’, suggesting that these prefix bigrams encode category-specific information.
115
+
116
+ Next, for each object pair, we calculate their Levenshtein message distance and respective cosine similarity, and plot in Figure 3 (right), for each distance, the average cosine similarities of the pairs with that distance (this is done for the length 10 and training data experiment). We observe that there is a clear relation between message similarity and meaning similarity (as measured by overlap in the VisA properties). In Figure 3, we also plot a similar correlation curve for an emerged language obtained by producing messages with randomly initialized and untrained speaker/listener architectures. This emerged language is at random in terms of communicative success; however, the generated messages do show signs of structure, since similar objects obtain somewhat similar messages. This seems to suggest that structured and disentangled pre-linguistic representations are, perhaps, a sufficient condition for the emergence of structured language, especially in neural network-based agents which, due to the nature of representation and information flow, favor similar inputs to trigger similar outputs.
117
+
118
+ # 4 STUDY 2: REFERENTIAL GAME WITH RAW PIXEL DATA
119
+
120
+ In this section, we present experiments in which agents receive as input entangled data in the form of raw pixel input, and have to learn to perform visual conceptual processing guided by the communication-based reward.
121
+
122
+ We use a synthetic dataset of scenes consisting of geometric objects generated using the MuJoCo physics engine (Todorov et al., 2012). We generate RGB images of resolution $1 2 4 \times 1 2 4$ depicting single object scenes. For each object, we pick one of eight colors (blue, red, white, black, yellow, green, cyan, magenta) and five shapes (box, sphere, cylinder, capsule, ellipsoid) resulting in 40 combinations, for each of which we generate 100 variations, varying the floor color and the object location in the image. Moreover, we introduce different variants of the game: game A with 19 distractors; game B with 1 distractor; game C with 1 distractor, and with speaker and listener having different viewpoints of the target object (the target object on the listener’s side is in a different location); game D with 1 distractor, with speaker and listener having different viewpoints, and with balanced numbers of shapes and color (obtained by downsampling from 8 colors to 5 and removing any image containing objects of the 3 disregarded objects). For each game, we create train and test splits with proportions 75/25 (i.e., 3000/1000 for games A and B, and 1850/650 for games C and D).
123
+
124
+ Pre-linguistic objects are presented in the form of pixel input, $o \in [ 0 , 2 5 5 ] ^ { 3 \times 1 2 4 \times 1 2 4 }$ . Speaker and listener convert the images $o$ to dense representations $u$ , each of them using an 8-layer convolutional neural network (ConvNet). Crucially, we do not pre-train the ConvNets on an object classification task; the only learning signal is the communication-based reward. Despite this fact, we observe that the lower layers of the ConvNets are encoding similar information to a ConvNet pre-trained on ImageNet (Deng et al., 2009).3 Conceptually, we can think of the whole speaker/listener architecture as an encoder-decoder with a discrete bottleneck (the message). Given our initial positive findings, this reward-based learning signal induced from the communication game setup could be used for classagnostic large-scale ConvNet training. Moreover, we find that, even though no weights were shared, the agents’ conceptual spaces get aligned at different levels, reminiscent of theories of interactive conceptual alignment during dialogue (Garrod & Pickering, 2004) (see Appendix A for the related experiment).
125
+
126
+ # 4.1 COMMUNICATIVE SUCCESS AND EMERGENT PROTOCOLS
127
+
128
+ Unlike the experiments of Section 3, where agents start from disentangled representations, starting from raw perceptual input presents a greater challenge: the agents have to establish naming conventions about scenes, while at the same time learning to process the input with their own visual conceptual system. Since we do not pre-train their ConvNets on an object recognition task, the dense representations $u$ used to derive the message contain no bias towards any image- or scene-specific information (e.g, object color, shape or location). The extraction of visual properties is thus driven entirely by the communication game. This contrasts with the cases of Havrylov & Titov (2017) and Lazaridou et al. (2017) who use pre-trained visual vectors, and qualitatively observe that the induced communication protocols encode information about objects. Table 3 presents the results in terms of communicative train and test success (see Appendix C for additional experiments when having access to gold object attribute classifiers). Moreover, we also report the topographic similarity (column topographic $\rho \mathrm { \Sigma }$ ) between the symbolic attribute-based representations of scenes (floor color, object color, shape and location) and the generated messages.
129
+
130
+ Overall, despite the challenges posed in this setup due to the raw nature of the data, performance across all games is well above chance, indicating that reinforcement learning agents trained end-toend are able to establish a communication protocol in this grounded environment. In game A, the agents reach $9 3 . 7 \%$ accuracy, with their lexicon consisting of 1068 messages, describing 3000 training objects. Most importantly, as captured by the positive topographic similarity, agents produce messages that respect (even to a limited degree) the compositional nature of scenes (i.e., objects as bags-of-attributes), indicating that similar scenes receive similar messages. Indeed, by examining their protocol (see Table 4), we find that messages encode in a structurally consistent way information about absolute location of objects, with the message prefix and suffix denoting the horizontal and vertical co-ordinate, respectively. Interestingly, this communication strategy is also typically followed by human players of referential games (Kazemzadeh et al., 2014).
131
+
132
+ ![](images/1a48df6cd3a8b1c8b52b9ee8420e381abf4d505b03645f3a5586570289a52a63.jpg)
133
+ Figure 4: Target images and their associated messages from game A and game B.
134
+
135
+ Table 3: Communicative success of agents playing different games. Columns random, train and test report percentage accuracies. Column topographic $\rho$ reports the topographic similarity between the symbolic representation of scenes and the generated messages $( p < 0 . 0 1$ , permutation test).
136
+
137
+ <table><tr><td>game</td><td>distractors</td><td>balanced</td><td>viewpoints</td><td>lexicon size</td><td>random</td><td>train</td><td>test</td><td>topographic p</td></tr><tr><td>A</td><td>20</td><td>No</td><td>No</td><td>1068</td><td>5.0</td><td>93.7</td><td>93.6</td><td>0.13</td></tr><tr><td>B</td><td>2</td><td>No</td><td>No</td><td>13</td><td>50.0</td><td>93.2</td><td>93.4</td><td>0.006</td></tr><tr><td>C</td><td>2</td><td>No</td><td>Yes</td><td>8</td><td>50.0</td><td>86.0</td><td>85.7</td><td>0.07</td></tr><tr><td>D</td><td>2</td><td>Yes</td><td>Yes</td><td>5</td><td>50.0</td><td>90.4</td><td>89.9</td><td>0.06</td></tr></table>
138
+
139
+ However, we find the emerged protocols to be very unstable and too grounded in the specific game situation. Small modifications of the game setup, while having close to no negative impact on the communicative performance, can radically alter the form, semantics and interpretability of the communication protocol. In game B, performance remains at the same level $( 9 3 . 2 \% )$ as game A. However, we observe that the protocol consists of 13 unique messages which do not reflect the objects’ attributes (as indicated by the close to zero topographic similarity), thus making the messages harder to interpret (see Figure 4 for randomly sampled examples). When we change the viewpoint of the agents in game C, biasing them against communicating about absolute object location, the players derive a compact communication protocol consisting of 8 unique messages that describe primarily color. Finally, when color and shape are balanced, as in game $\mathbf { D }$ , we still observe a bias towards describing the color of objects, with the five induced messages providing a perfect clustering of the objects according to their colors.4
140
+
141
+ In an entangled world, agents do not possess a priori visual biases and knowledge of concepts. Since objects can be conceptualized in indefinitely many ways, the type of information encoded in the messages is tied to the environmental pressures; communication behaviour is a function of the environment, which also dictates what data structures can emerge. The implication of this observation is that protocols essentially overfit to the particular game situation, to the degree that they become specialized ad-hoc naming conventions.
142
+
143
+ Interestingly, the emergence of ad-hoc naming conventions has also been observed during humanhuman interaction: when participants engage in some specific game situation (e.g., communicating about abstract tangram shapes), they tend to form highly specialized naming conceptions (conceptual pacts) that allow them to communicate with maximum efficiency (Brennan & Clark, 1996). While in this study we do not address the issue of how a stable and general language could emerge in entangled worlds, we believe that to alleviate the formation of such ad-hoc communication protocols, it is essential to increase the complexity of the games as well as requiring transfer across a variety of games.
144
+
145
+ <table><tr><td>game (random baseline)</td><td>object position (20.0)</td><td>object shape (20.0)</td><td>object color (12.0)</td><td>floor color (33.0)</td></tr><tr><td>A</td><td>95.3</td><td>90.2</td><td>24.7</td><td>36.4</td></tr><tr><td>B</td><td>88.6</td><td>41.2</td><td>63.8</td><td>45.4</td></tr><tr><td>C</td><td>85.9</td><td>43.5</td><td>65.8</td><td>43.8</td></tr><tr><td>D</td><td>89.4</td><td>47.1</td><td>82.0</td><td>42.3</td></tr></table>
146
+
147
+ Table 4: Accuracy of probe linear classifiers of speaker’s induced visual representations (all accuracies are in percentage format).
148
+
149
+ # 4.2 PROBE MODELS
150
+
151
+ In order to investigate what information gets captured by the speaker’s ConvNet, we probe the inferred visual representations $u$ used to derive the message. Specifically, we design 4 probe classifiers for the color and shape of the object; object position which is derived by discretizing each co-ordinate into 3 bins; and floor color which is obtained by clustering the RGB color representation of the floor. For each probe, we performed 5-fold cross validation with a linear classifier, and report accuracy results in Table 4. Overall, different games result in visual representations with different predictive power; object position is almost always encoded in the speaker’s visual representation, even in situations where location of the object is not a good strategy for communication. On the other hand, object shape seems to provide less salient information, despite the fact that it is relevant for communication, at least in the C&D games.
152
+
153
+ As expected, the structure and semantics of the emergent protocols are a function of the information captured in the visual representations. The degree to which the agents are able to pull apart the objects’ factors of variation impacts their ability to communicate about those factors, with the most extreme case being game D, where the message ignores the shape entirely. Thus, disentanglement seems to be a necessary condition for communication, at least in the case of pixel input.
154
+
155
+ # 5 CONCLUSION
156
+
157
+ We presented a series of studies investigating the properties of protocols emerging when reinforcement learning agents are trained end-to-end on referential communication games. We found that when agents are presented with disentangled input data in the form of attribute vectors, this inherent compositional structure is successfully retained in the output. Moreover, we showed that communication can also be achieved in cases where agents are presented with raw pixel data, a type of input that aligns better with the raw sensorimotor data that humans are exposed to. At the same time, we found that their ability to form compositional protocols in these cases is hampered by their ability to pull apart the objects’ factors of variations. Altogether, we were able to successfully scale up traditional research from the language evolution literature on emergent communication tasks to the contemporary deep learning framework, thus opening avenues to more realistic, and large scale, computational simulations of language emergence with complex image stimuli.
158
+
159
+ # ACKNOWLEDGEMENTS
160
+
161
+ We would like to thank Murray Shanahan, Laura Rimell and Gabor Melis for their very helpful feedback on this paper, as well as the rest of the DeepMind language team for many discussions. AL would also like to thank Marco Baroni and Alex Peysakhovich for the email correspondence and discussions from a year ago, which provided inspiration for some of the experiments on this paper.
162
+
163
+ # REFERENCES
164
+
165
+ Jacob Andreas and Dan Klein. Analogs of linguistic structure in deep representations. arXiv preprint arXiv:1707.08139, 2017.
166
+
167
+ Trapit Bansal, Jakub Pachocki, Szymon Sidor, Ilya Sutskever, and Igor Mordatch. Emergent complexity via multi-agent competition. arXiv preprint arXiv:1710.03748, 2017.
168
+
169
+ John Batali. Computational simulations of the emergence of grammar. pp. 405–426, 1998.
170
+
171
+ 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.
172
+
173
+ Susan E Brennan and Herbert H Clark. Conceptual pacts and lexical choice in conversation. Journal of Experimental Psychology: Learning, Memory, and Cognition, 22(6):1482, 1996.
174
+
175
+ Henry Brighton. Compositional syntax from cultural transmission. Artificial life, 8(1):25–54, 2002.
176
+
177
+ Henry Brighton and Simon Kirby. Understanding linguistic evolution by visualizing the emergence of topographic mappings. Artificial life, 12(2):229–242, 2006.
178
+
179
+ Ted Briscoe (ed.). Linguistic evolution through language acquisition. Cambridge University Press, Cambridge, UK, 2002.
180
+
181
+ Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym, 2016.
182
+
183
+ Angelo Cangelosi and Domenico Parisi (eds.). Simulating the evolution of language. Springer, New York, 2002.
184
+
185
+ Jon W Carr, Kenny Smith, Hannah Cornish, and Simon Kirby. The cultural evolution of structured languages in an open-ended, continuous world. Cognitive science, 41(4):892–923, 2017.
186
+
187
+ Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In Computer Vision and Pattern Recognition, 2009. CVPR 2009. IEEE Conference on, pp. 248–255. IEEE, 2009.
188
+
189
+ Katrina Evtimova, Andrew Drozdov, Douwe Kiela, and Kyunghyun Cho. Emergent language in a multi-modal, multi-step referential game. arXiv preprint arXiv:1705.10369, 2017.
190
+
191
+ Michael Franke. The evolution of compositionality in signaling games. Journal of Logic, Language and Information, pp. 1–23, 2015.
192
+
193
+ Gottlob Frege. Uber Sinn und Bedeutung. ¨ Zeitschrift fur Philosophie und philosophische Kritik ¨ , 100:25–50, 1892.
194
+
195
+ Simon Garrod and Martin J Pickering. Why is conversation so easy? Trends in cognitive sciences, 8(1):8–11, 2004.
196
+
197
+ Serhii Havrylov and Ivan Titov. Emergence of language with multi-agent games: Learning to communicate with sequences of symbols. arXiv preprint arXiv:1705.11192, 2017.
198
+
199
+ 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.
200
+
201
+ Karl Moritz Hermann, Felix Hill, Simon Green, Fumin Wang, Ryan Faulkner, Hubert Soyer, David Szepesvari, Wojtek Czarnecki, Max Jaderberg, Denis Teplyashin, et al. Grounded language learning in a simulated 3d world. arXiv preprint arXiv:1706.06551, 2017.
202
+
203
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997.
204
+
205
+ Sahar Kazemzadeh, Vicente Ordonez, Mark Matten, and Tamara L Berg. Referitgame: Referring to objects in photographs of natural scenes. In EMNLP, pp. 787–798, 2014.
206
+
207
+ Satwik Kottur, Jose MF Moura, Stefan Lee, and Dhruv Batra. Natural language does not ´ emerge’naturally’in multi-agent dialog. arXiv preprint arXiv:1706.08502, 2017.
208
+
209
+ Angeliki Lazaridou, Alexander Peysakhovich, and Marco Baroni. Multi-agent cooperation and the emergence of (natural) language. In ICLR, 2017.
210
+
211
+ David Lewis. Convention. Harvard University Press, Cambridge, MA, 1969.
212
+
213
+ Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollar, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In ´ European conference on computer vision, pp. 740–755. Springer, 2014.
214
+
215
+ 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.
216
+
217
+ Igor Mordatch and Pieter Abbeel. Emergence of grounded compositional language in multi-agent populations. arXiv preprint arXiv:1703.04908, 2017.
218
+
219
+ Martin A Nowak and David C Krakauer. The evolution of language. Proceedings of the National Academy of Sciences, 96(14):8028–8033, 1999.
220
+
221
+ Steven T Piantadosi, Harry Tily, and Edward Gibson. The communicative function of ambiguity in language. Cognition, 122(3):280–291, 2012.
222
+
223
+ Carina Silberer, Vittorio Ferrari, and Mirella Lapata. Models of semantic representation with visual attributes. In Proceedings of the 51st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 572–582, Sofia, Bulgaria, August 2013. Association for Computational Linguistics. URL http://www.aclweb.org/anthology/P13-1056.
224
+
225
+ 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:354–359, 2017.
226
+
227
+ Brian Skyrms. Signals: Evolution, learning, and information. Oxford University Press, 2010.
228
+
229
+ Kenny Smith, Simon Kirby, and Henry Brighton. Iterated learning: A framework for the emergence of language. Artificial life, 9(4):371–386, 2003.
230
+
231
+ Matthew Spike, Kevin Stadler, Simon Kirby, and Kenny Smith. Minimal requirements for the emergence of learned signaling. Cognitive Science, 2016. In press.
232
+
233
+ Luc Steels. Social language learning. In Mario Tokoro and Luc Steels (eds.), The Future of Learning, pp. 133–162. IOS, Amsterdam, 2003.
234
+
235
+ Luc Steels and Martin Loetzsch. The grounded naming game. In Luc Steels (ed.), Experiments in Cultural Language Evolution, pp. 41–59. John Benjamins, Amsterdam, 2012.
236
+
237
+ Emanuel Todorov, Tom Erez, and Yuval Tassa. Mujoco: A physics engine for model-based control. In Intelligent Robots and Systems (IROS), 2012 IEEE/RSJ International Conference on, pp. 5026– 5033. IEEE, 2012.
238
+
239
+ Kyle Wagner, James A Reggia, Juan Uriagereka, and Gerald S Wilkinson. Progress in the simulation of emergent communication and language. Adaptive Behavior, 11(1):37–69, 2003.
240
+
241
+ Ronald J. Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Mach. Learn., 8(3-4):229–256, May 1992. ISSN 0885-6125. doi: 10.1007/ BF00992696. URL https://doi.org/10.1007/BF00992696.
242
+
243
+ Ludwig Wittgenstein. Philosophical Investigations. Blackwell, Oxford, UK, 1953. Translated by G.E.M. Anscombe.
244
+
245
+ # A CONCEPTUAL ALIGNMENT OF SPEAKER AND LISTENER
246
+
247
+ During conversation, communication allows interlocutors to achieve interactive conceptual alignment (Garrod & Pickering, 2004). We are able to communicate because we have established a common ground and our representations at different levels become aligned (e.g., participants mutually understand that “he” in the conversation refers to Bob). We investigated whether the agents’ conceptual systems achieve a similar structural alignment. We measure the alignment in terms of Spearman $\rho$ correlation of the intra-agent pairwise object cosine similarities as calculated via representing objects as activations from ConvNet layers.
248
+
249
+ Interestingly, we observe a gradual increase in the structural similarity as we represent the objects with layer activations closer to the pixel space. Conceptual spaces are more aligned the closer they are to the raw pixel input $\mathrm { ~ \ ' ~ } \rho = 0 . 9 7 \mathrm { - } 0 . 9 1$ , depending on the game) and become more dissimilar as the representations become more abstract. We can draw the analogy to language processing, as first ConvNet layers perform some low-level processing analogous to phoneme recognition or word segmentation (and are thus more objective) while higher layers perform more abstract processing, vaguely analogous to semantics and pragmatics (thus, represent more subjective knowledge). In cases of successful communication, speakers’ and listeners’ conceptual spaces closer to the communication point are structurally very similar $\prime \rho = 0 . 8 5 – 0 . 6 2$ , depending on the game), however this similarity drops dramatically in cases of failure of communication $\mathit { \Pi } _ { \rho } = 0 . 1 5 $ ).
250
+
251
+ # B HYPERPARAMETER DETAILS
252
+
253
+ All LSTM hidden states of the “speaking” and “listening” module as well and the “seeing” prelinguistic feed-forward encoders (see Section 3), have dimension 50. The “seeing” pre-linguistic ConvNet encoders (see Section 4) has 8 layers, 32 filters with the kernel size 3 for every layer and with strides $[ 2 , 1 , 1 , 2 , 1 , 2 , 1 , 2 ]$ for each layer. We use ReLU as activation function as well as batch normalization for every layer.
254
+
255
+ For learning, we used the Rmsprop optimizer, with learning rate 0.0001. We use a separate value of entropy regularization for each policy. For $\pi ^ { S }$ we use 0.01 and for $\pi ^ { L }$ we use 0.001. We use a mini-batch of 32.
256
+
257
+ # C COMMUNICATIVE SUCCESS USING GOLD ATTRIBUTE CLASSIFIERS
258
+
259
+ We assume a model which has access to perfect attribute classifiers for color, shape and object position, for the latter using a classifier operating on the discretized annotations we obtained in Section 4.2 after quantazing the real-valued object location. For computing the performance of this model using gold attribute classifiers, we first remove from the distractors any candidate not matching the target’s attributes and them pick at random. We repeat this experiment for single attribute classifiers and their pairwise combinations. Table 5 reports the communicative success results obtained empirically by averaging across 1000 simulations, alongside the training and test accuracies of the trained agents of Section 4.1 for comparison.
260
+
261
+ Table 5: Communicative success of trained models from Section 4.1 (train and test) as well as models with access to gold classifiers. All accuracies are in percentage format.
262
+
263
+ <table><tr><td> game</td><td>train</td><td>test</td><td>color</td><td>shape</td><td>position</td><td>color &amp; shape</td><td> position &amp; shape</td><td>position &amp; color</td></tr><tr><td>A</td><td>93.7</td><td>93.6</td><td>37.2</td><td>24.8</td><td>69.3</td><td>80.4</td><td>92.1</td><td>95.6</td></tr><tr><td>B</td><td>93.2</td><td>93.4</td><td>93.2</td><td>90.1</td><td>97.2</td><td>98.8</td><td>99.3</td><td>99.4</td></tr><tr><td>C</td><td>86.0</td><td>85.7</td><td>93.2</td><td>90.1</td><td>-</td><td>98.8</td><td>1</td><td>1</td></tr><tr><td>D</td><td>90.4</td><td>89.9</td><td>89.6</td><td>89.2</td><td>1</td><td>98.5</td><td>1</td><td>1</td></tr></table>
md/train/HJGven05Y7/HJGven05Y7.md ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # HOW TO TRAIN YOUR MAML
2
+
3
+ Antreas Antoniou University of Edinburgh {a.antoniou}@sms.ed.ac.uk
4
+
5
+ Harrison Edwards OpenAI, University of Edinburgh {h.l.edwards}@sms.ed.ac.uk
6
+
7
+ Amos Storkey University of Edinburgh {a.storkey}@ed.ac.uk
8
+
9
+ # ABSTRACT
10
+
11
+ The field of few-shot learning has recently seen substantial advancements. Most of these advancements came from casting few-shot learning as a meta-learning problem. Model Agnostic Meta Learning or MAML is currently one of the best approaches for few-shot learning via meta-learning. MAML is simple, elegant and very powerful, however, it has a variety of issues, such as being very sensitive to neural network architectures, often leading to instability during training, requiring arduous hyperparameter searches to stabilize training and achieve high generalization and being very computationally expensive at both training and inference times. In this paper, we propose various modifications to MAML that not only stabilize the system, but also substantially improve the generalization performance, convergence speed and computational overhead of MAML, which we call $M A M L + +$ .
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ The human capacity to learn new concepts using only a handful of samples is immense. In stark contrast, modern deep neural networks need, at a minimum, thousands of samples before they begin to learn representations that can generalize well to unseen data-points (Krizhevsky et al., 2012; Huang et al., 2017), and mostly fail when the data available is scarce. The fact that standard deep neural networks fail in the small data regime can provide hints about some of their potential shortcomings. Solving those shortcomings has the potential to open the door to understanding intelligence and advancing Artificial Intelligence. Few-shot learning encapsulates a family of methods that can learn new concepts with only a handful of data-points (usually 1-5 samples per concept). This possibility is attractive for a number of reasons. First, few-shot learning would reduce the need for data collection and labelling, thus reducing the time and resources needed to build robust machine learning models. Second, it would potentially reduce training and fine-tuning times for adapting systems to newly acquired data. Third, in many real-world problems there are only a few samples available per class and the collection of additional data is either remarkably time-consuming and costly or altogether impossible, thus necessitating the need to learn from the available few samples.
16
+
17
+ The nature of few-shot learning makes it a very hard problem if no prior knowledge exists about the task at hand. For a model to be able to learn a robust model from a few samples, knowledge transfer (see e.g. Caruana, 1995) from other similar tasks is key. However, manual knowledge transfer from one task to another for the purpose of fine-tuning on a new task can be a time consuming and ultimately inefficient process. Meta-learning (Schmidhuber, 1987; Vilalta & Drissi, 2002), or learning to learn (Thrun & Pratt, 1998), can instead be used to automatically learn across-task knowledge usually referred to as across-task (or sometimes slow) knowledge such that our model can, at inference time, quickly acquire task-specific (or fast) knowledge from new tasks using only a few samples. Meta-learning can be broadly defined as a class of machine learning models that become more proficient at learning with more experience, thus learning how to learn. More specifically meta-learning involves learning at two levels. At the task-level, where the base-model is required to acquire task-specific (fast) knowledge rapidly, and at the meta-level, where the meta-model is required to slowly learn across-task (slow) knowledge. Recent work in meta-learning has produced state of the art results in a variety of settings (Wang et al., 2016; Ba et al., 2016; Zoph & Le, 2016; Andrychowicz et al., 2016; Vinyals et al., 2016; Li & Malik, 2016; Li et al., 2017; Antoniou et al., 2017; Brock et al., 2017; Munkhdalai & Yu, 2017). The application of meta-learning in the fewshot learning setting has enabled the overwhelming majority of the current state of the art few-shot learning methods (Vinyals et al., 2016; Ravi & Larochelle, 2016; Edwards & Storkey, 2016; Finn et al., 2017; Li et al., 2017; Munkhdalai & Yu, 2017). One such method, known for its simplicity and state of the art performance, is Model Agnostic Meta-Learning (MAML) (Finn et al., 2017). In MAML, the authors propose learning an initialization for a base-model such that after applying a very small number of gradient steps with respect to a training set on the base-model, the adapted model can achieve strong generalization performance on a validation set (the validation set consists of new samples from the same classes as the training set). Relating back to the definitions of metamodel and base-model, in MAML the meta-model is effectively the initialization parameters. These parameters are used to initialize the base-model, which is then used for task-specific learning on a support set, which is then evaluated on a target set. MAML is a simple yet elegant meta-learning framework that has achieved state of the art results in a number of settings. However, MAML suffers from a variety of problems which: 1) cause instability during training, 2) restrict the model’s generalization performance, 3) reduce the framework’s flexibility, 4) increase the system’s computational overhead and 5) require that the model goes through a costly (in terms of time and computation needed) hyperparameter tuning before it can work robustly on a new task.
18
+
19
+ ![](images/ba257213020783eadbe5dd3605b6adf2da072553d4175db612e96a87af65e972.jpg)
20
+ Figure 1: Stabilizing MAML: This figure illustrates 3 seeds of the original strided MAML vs strided $\begin{array} { r } { \mathbf { M A M L + + } . } \end{array}$ . One can see that 2 out of 3 seeds with the original strided MAML seem to become unstable and erratic, whereas all 3 of the strided $\mathbf { M A M L + }$ models seem to consistently converge very fast, to much higher generalization accuracy without any stability issues.
21
+
22
+ In this paper we propose $\mathbf { M A M L + + }$ , an improved variant of the MAML framework that offers the flexibility of MAML along with many improvements, such as robust and stable training, automatic learning of the inner loop hyperparameters, greatly improved computational efficiency both during inference and training and significantly improved generalization performance. $\mathbf { M A M L + } +$ is evaluated in the few-shot learning setting where the system is able to set a new state of the art across all established few-shot learning tasks on both Omniglot and Mini-Imagenet, performing as well as or better than all established meta learning methods on both tasks.
23
+
24
+ # 2 RELATED WORK
25
+
26
+ The set-to-set few-shot learning setting (Vinyals et al., 2016), neatly casts few-shot learning as a meta-learning problem. In set-to-set few-shot learning we have a number of tasks, each task is composed by a support set which is used for task-level learning, and a target set which is used for evaluating the base-model on a certain task after it has acquired task-specific (or fast) knowledge. Furthermore, all available tasks are split into 3 sets, the meta-training set, the meta-validation set and the meta-test set, used for training, validating and testing our meta-learning model respectively.
27
+
28
+ Once meta-learning was shown to be an effective framework for few-shot learning and the set to set approach was introduced, further developments in few-shot learning were made in quick succession. One contribution was Matching Networks (Vinyals et al., 2016). Matching networks achieve few-shot learning by learning to match target set items to support set items. More specifically, a matching network learns to match the target set items to the support set items using cosine distance and a fully differentiable embedding function. First, the support set embedding function $g$ , parameterized as a deep neural network, embeds the support set items into embedding vectors, then the target set embedding function $f$ embeds the target set items. Once all data-item embeddings are available, cosine distance is computed for all target set embeddings when compared to all support set embeddings. As a result, for each target set item, a vector of cosine distances with respect to all support set items will be generated (with each distance’s column tied to the respective support set class). Then, the softmax function is applied on the generated distance vectors, to convert them into probability distributions over the support set classes.
29
+
30
+ Another notable advancement was the gradient-conditional meta-learner LSTM (Ravi & Larochelle, 2016) that learns how to update a base-learner model. At inference time, the meta-learner model applies a single update on the base-learner given gradients with respect to the support set. The fully updated base-model then computes predictions on the target set. The target set predictions are then used to compute a task loss. Furthermore they jointly learn the meta-learner’s parameters as well as the base-learners initializations such that after a small number of steps it can do very well on a given task. The authors ran experiments on Mini-Imagenet where they exceed the performance of Matching Networks.
31
+
32
+ In Model Agnostic meta-learning (MAML) (Finn et al., 2017) the authors proposed increasing the gradient update steps on the base-model and replacing the meta-learner LSTM with Batch Stochastic Gradient Descent (Krizhevsky et al., 2012), which as a result speeds up the process of learning and interestingly improves generalization performance and achieves state of the art performance in both Omniglot and Mini-Imagenet.
33
+
34
+ In Meta-SGD (Li et al., 2017) the authors proposed learning a static learning rate and an update direction for each parameter in the base-model, in addition to learning the initialization parameters of the base-model. Meta-SGD showcases significantly improved generalization performance (when compared to MAML) across all few-shot learning tasks, whilst only requiring a single inner loop update step. However this practice effectively doubles the model parameters and computational overheads of the system.
35
+
36
+ # 3 MODEL AGNOSTIC META LEARNING
37
+
38
+ Model Agnostic Meta-Learning (MAML) (Finn et al., 2017) is a meta-learning framework for fewshot learning. MAML is elegantly simple yet can produce state of the art results in few-shot regression/classification and reinforcement learning problems. In a sentence, MAML learns good initialization parameters for a network, such that after a few steps of standard training on a few-shot dataset, the network will perform well on that few shot task.
39
+
40
+ More formally, we define the base model to be a neural network $f _ { \theta }$ with meta-parameters $\theta$ . We want to learn an initial $\theta = \theta _ { 0 }$ that, after a small number $N$ of gradient update steps on data from a support set $S _ { b }$ to obtain $\theta _ { N }$ , the network performs well on that task’s target set $T _ { b }$ . Here $b$ is the index of a particular support set task in a batch of support set tasks. This set of $N$ updates steps is called the inner-loop update process.
41
+
42
+ The updated base-network parameters after $i$ steps on data from the support task $S _ { b }$ can be expressed as:
43
+
44
+ $$
45
+ \theta _ { i } ^ { b } = \theta _ { i - 1 } ^ { b } - \alpha \nabla _ { \theta } \mathcal { L } _ { S _ { b } } \big ( f _ { \theta _ { i - 1 } ^ { b } } \big ) ,
46
+ $$
47
+
48
+ where $\alpha$ is the learning rate, $\theta _ { i } ^ { b }$ are the base-network weights after $i$ steps towards task $b$ $, \mathcal { L } _ { S _ { b } } ( f _ { \theta _ { ( i - 1 ) } } )$ is the loss on the support set of task $b$ after $( i - 1 )$ (i.e. the previous step) update steps. Assuming that our task batch size is $B$ we can define a meta-objective, which can be expressed as:
49
+
50
+ $$
51
+ \mathcal { L } _ { m e t a } ( \theta _ { 0 } ) = \sum _ { b = 1 } ^ { B } \mathcal { L } _ { T _ { b } } ( f _ { \theta _ { N } ^ { b } } ( \theta _ { 0 } ) )
52
+ $$
53
+
54
+ where we have explicitly denoted the dependence of $\theta _ { N } ^ { b }$ on $\theta _ { 0 }$ , given by unrolling (1). The objective (2) measures the quality of an initialization $\theta _ { 0 }$ in terms of the total loss of using that initialization across all tasks. This meta objective is now minimized to optimize the initial parameter value $\theta _ { 0 }$ . It is this initial $\theta _ { 0 }$ that contains the across-task knowledge. The optimization of this meta-objective is called the outer-loop update process.
55
+
56
+ The resulting update for the meta-parameters $\theta _ { 0 }$ can be expressed as:
57
+
58
+ $$
59
+ \theta _ { 0 } = \theta _ { 0 } - \beta \nabla _ { \theta } \sum _ { b = 1 } ^ { B } \mathcal { L } _ { T _ { b } } ( f _ { \theta _ { N } ^ { b } \left( \theta _ { 0 } \right) } )
60
+ $$
61
+
62
+ where $\beta$ is a learning rate and $\mathcal { L } _ { T _ { b } }$ denotes the loss on the target set for task $b$
63
+
64
+ In this paper we use the cross-entropy (De Boer et al., 2005; Rubinstein, 1999) loss throughout.
65
+
66
+ # 3.1 MODEL AGNOSTIC META-LEARNING PROBLEMS
67
+
68
+ The simplicity, elegance and high performance of MAML make it a very powerful framework for meta-learning. However, MAML has also many issues that make it problematic to use.
69
+
70
+ Training Instability: Depending on the neural network architecture and the overall hyperparameter setup, MAML can be very unstable during training as illustrated in Figure 1. Optimizing the outer loop involved backpropagating derivatives through an unfolded inner loop consisting of the same network multiple times. This alone could be cause for gradient issues. However, the gradient issues are further compounded by the model architecture, which is a standard 4-layer convolutional network without skip-connections. The lack of any skip-connections means that every gradient must be passed through each convolutional layer many times; effectively the gradients will be multiplied by the same sets of parameters multiple times. After multiple back-propagation passes, the large depth structure of the unfolded network and lack of skip connections can cause gradient explosions and diminishing gradient problems respectively.
71
+
72
+ Second Order Derivative Cost: Optimization through gradient update steps requires the computation of second order gradients which are very expensive to compute. The authors of MAML proposed using first-order approximations to speed up the process by a factor of three, however using these approximations can have a negative impact on the final generalization error. Further attempts at using first order methods have been attempted in Reptile (Nichol et al., 2018) where the authors apply standard SGD on a base-model and then take a step from their initialization parameters towards the parameters of the base-model after $N$ steps. The results of Reptile vary, in some cases exceeding MAML, and in others producing results inferior to MAML. Approaches to reduce computation time while not sacrificing generalization performance have yet to be proposed.
73
+
74
+ Absence of Batch Normalization Statistic Accumulation: A further issue that affects the generalization performance is the way that batch normalization is used in the experiments in the original MAML paper. Instead of accumulating running statistics, the statistics of the current batch were used for batch normalization. This results in batch normalization being less effective, since the biases learned have to accommodate for a variety of different means and standard deviations instead of a single mean and standard deviation. On the other hand, if batch normalization uses accumulated running statistics it will eventually converge to some global mean and standard deviation. This leaves only a single mean and standard deviation to learn biases for. Using running statistics instead of batch statistics, can greatly increase convergence speed, stability and generalization performance as the normalized features will result in smoother optimization landscape (Santurkar et al., 2018).
75
+
76
+ Shared (across step) Batch Normalization Bias: An additional problem with batch normalization in MAML stems from the fact that batch normalization biases are not updated in the inner-loop; instead the same biases are used throughout all iterations of base-models. Doing this implicitly assumes that all base-models are the same throughout the inner loop updates and hence have the same distribution of features passing through them. This is a false assumption to make, since, with each inner loop update, a new base-model is instantiated that is different enough from the previous one to be considered a new model from a bias estimation point of view. Thus learning a single set of biases for all iterations of the base-model can restrict performance.
77
+
78
+ Shared Inner Loop (across step and across parameter) Learning Rate: One issue that affects both generalization and convergence speed (in terms of training iterations) is the issue of using a shared learning rate for all parameters and all update-steps. Doing so introduces two major problems. Having a fixed learning rate requires doing multiple hyperparameter searches to find the correct learning rate for a specific dataset; this process can be very computationally costly, depending on how search is done.
79
+
80
+ The authors in (Li et al., 2017) propose to learn a learning rate and update direction for each parameter of the network. Doing so solves the issue of manually having to search for the right learning rate, and also allows individual parameters to have smaller or larger learning rates. However this approach brings its own problems. Learning a learning rate for each network parameter means increased computational effort and increased memory usage since the network contains between 40K and 50K parameters depending on the dimensionality of the data-points.
81
+
82
+ Fixed Outer Loop Learning Rate: In MAML the authors use Adam with a fixed learning rate to optimize the meta-objective. Annealing the learning rate using either step or cosine functions has proven crucial to achieving state of the art generalization performance in a multitude of settings (Loshchilov & Hutter, 2016; He et al., 2016; Larsson et al., 2016; Huang et al., 2017). Thus, we theorize that using a static learning rate reduces MAML’s generalization performance and might also be a reason for slower optimization. Furthermore, having a fixed learning rate might mean that one has to spend more (computational) time tuning the learning rate.
83
+
84
+ # 4 STABLE, AUTOMATED AND IMPROVED MAML
85
+
86
+ In this section we propose methods for solving the issues with the MAML framework, described in Section 3.1. Each solution has a reference identical to the reference of the issue it is attempting to solve.
87
+
88
+ Gradient Instability Multi-Step Loss Optimization (MSL): MAML works by minimizing the target set loss computed by the base-network after it has completed all of its inner-loop updates towards a support set task. Instead we propose minimizing the target set loss computed by the base-network after every step towards a support set task. More specifically, we propose that the loss minimized is a weighted sum of the target set losses after every support set loss update. More formally:
89
+
90
+ $$
91
+ \theta = \theta - \beta \nabla _ { \theta } \sum _ { b = 1 } ^ { B } \sum _ { i = 0 } ^ { N } v _ { i } \mathcal { L } _ { T _ { b } } ( f _ { \theta _ { i } ^ { b } } )
92
+ $$
93
+
94
+ Where $\beta$ is a learning rate, $\mathcal { L } _ { T _ { b } } ( f _ { \theta _ { i } ^ { b } } )$ denotes the target set loss of task $b$ when using the base-network weights after $i$ steps towards minimizing the support set task and $v _ { i }$ denotes the importance weight of the target set loss at step $i$ , which is used to compute the weighted sum.
95
+
96
+ By using the multi-step loss proposed above we improve gradient propagation, since now the basenetwork weights at every step receive gradients both directly (for the current step loss) and indirectly (from losses coming from subsequent steps). With the original methodology described in Section 3 the base-network weights at every step except the last one were optimized implicitly as a result of backpropagation, which caused many of the instability issues MAML had. However using the multi-step loss alleviates this issue as illustrated in Figure 1. Furthermore, we employ an annealed weighting for the per step losses. Initially all losses have equal contributions towards the loss, but as iterations increase, we decrease the contributions from earlier steps and slowly increase the contribution of later steps. This is done to ensure that as training progresses the final step loss receives more attention from the optimizer thus ensuring it reaches the lowest possible loss. If the annealing is not used, we found that the final loss might be higher than with the original formulation.
97
+
98
+ Second Order Derivative $\mathbf { C o s t } $ Derivative-Order Annealing (DA): One way of making MAML more computationally efficient is reducing the number of inner-loop updates needed, which can be achieved with some of the methods described in subsequent sections of this report. However, in this paragraph, we propose a method that reduces the per-step computational overhead directly. The authors of MAML proposed the usage of first-order approximations of the gradient derivatives. However they applied the first-order approximation throughout the whole of the training phase. Instead, we propose to anneal the derivative-order as training progresses. More specifically, we propose to use first-order gradients for the first 50 epochs of the training phase, and to then switch to second-order gradients for the remainder of the training phase. We empirically demonstrate that doing so greatly speeds up the first 50 epochs, while allowing the second-order training needed to achieve the strong generalization performance the second-order gradients provide to the model. An additional interesting observation is that derivative-order annealing experiments showed no incidents of exploding or diminishing gradients, contrary to second-order only experiments which were more unstable. Using first-order before starting to use second-order derivatives can be used as a strong pretraining method that learns parameters less likely to produce gradient explosion/diminishment issues.
99
+
100
+ Absence of Batch Normalization Statistic Accumulation Per-Step Batch Normalization Running Statistics (BNRS): In the original implementation of MAML Finn et al. (2017) the authors used only the current batch statistics as the batch normalization statistics. This, we argue, caused a variety of undesirable effects described in Section 3.1. To alleviate the issues we propose using running batch statistics for batch normalization. A naive implementation of batch normalization in the context of MAML would require sharing running batch statistics across all update steps of the inner-loop fast-knowledge acquisition process. However doing so would cause the undesirable consequence that the statistics stored be shared across all inner loop updates of the network. This would cause optimization issues and potentially slow down or altogether halt optimization, due to the increasing complexity of learning parameters that can work across various updates of the network parameters. A better alternative would be to collect statistics in a per-step regime. To collect running statistics per-step, one needs to instantiate $N$ (where $N$ is the total number of inner-loop update steps) sets of running mean and running standard deviation for each batch normalization layer in the network and update the running statistics respectively with the steps being taken during the optimization. The per-step batch normalization methodology should speed up optimization of MAML whilst potentially improving generalization performance.
101
+
102
+ Shared (across step) Batch Normalization Bias $\bf { \Gamma } \to \bf { P e r }$ -Step Batch Normalization Weights and Biases (BNWB): In the MAML paper the authors trained their model to learn a single set of biases for each layer. Doing so assumes that the distributions of features passing through the network are similar. However, this is a false assumption since the base-model is updated for a number of times, thus making the feature distributions increasingly dissimilar from each other. To fix this problem we propose learning a set of biases per-step within the inner-loop update process. Doing so, means that batch normalization will learn biases specific to the feature distributions seen at each set, which should increase convergence speed, stability and generalization performance.
103
+
104
+ Shared Inner Loop Learning Rate (across step and across parameter) Learning Per-Layer Per-Step Learning Rates and Gradient Directions (LSLR): Previous work in Li et al. (2017) demonstrated that learning a learning rate and gradient direction for each parameter in the basenetwork improved the generalization performance of the system. However, that had the consequence of increased number of parameters and increased computational overhead. So instead, we propose, learning a learning rate and direction for each layer in the network as well as learning different learning rates for each adaptation of the base-network as it takes steps. Learning a learning rate and direction for each layer instead for each parameter should reduce memory and computation needed whilst providing additional flexibility in the update steps. Furthermore, for each learning rate learned, there will be $N$ instances of that learning rate, one for each step to be taken. By doing this, the parameters are free to learn to decrease the learning rates at each step which may help alleviate overfitting.
105
+
106
+ Fixed Outer Loop Learning Rate Cosine Annealing of Meta-Optimizer Learning Rate (CA): In MAML the authors use a static learning rate for the optimizer of the meta-model. Annealing the learning rate, either by using step-functions (He et al., 2016) or cosine functions (Loshchilov & Hutter, 2016) has proved vital in learning models with higher generalization power. The cosine annealing scheduling has been especially effective in producing state of the art results whilst removing the need for any hyper-parameter searching on the learning rate space. Thus, we propose applying the cosine annealing scheduling on the meta-model’s optimizer (i.e. the meta-optimizer). Annealing the learning rate allows the model to fit the training set more effectively and as a result might produce higher generalization performance.
107
+
108
+ # 4.1 DATASETS
109
+
110
+ The datasets used to evaluate our methods were the Omniglot (Lake et al., 2015) and Mini-Imagenet (Vinyals et al., 2016; Ravi & Larochelle, 2016) datasets. Each dataset is split into 3 sets, a training, validation and test set. The Omniglot dataset is composed of 1623 characters classes from various alphabets. There exist 20 instances of each class in the dataset. For Omniglot we shuffle all character classes and randomly select 1150 for the training set and from the remaining classes we use 50 for validation and 423 for testing. In most few-shot learning papers the first 1200 classes are used for training and the remaining for testing. However, having a small validation set to choose the best model is crucial, so we choose to use a small set of 50 classes as validation set. For each class we use all available 20 samples in the sets. Furthermore for the Omniglot dataset, data augmentation is used on the images in the form of rotations of 90 degree increments. Class samples that are rotated are considered new classes, e.g. a 180 degree rotated character $C$ is considered a different class from a non rotated $C$ , thus effectively having $1 6 2 3 \mathrm { ~ x ~ } 4$ classes in total. However the rotated classes are generated dynamically after the character classes have been split into the sets such that rotated samples from a class reside in the same set (i.e. the training, validation or test set). The Mini-Imagenet dataset was proposed in Ravi & Larochelle (2016), it consists of 600 instances of 100 classes from the ImageNet dataset, scaled down to $8 4 \mathrm { x } 8 4$ . We use the split proposed in Ravi & Larochelle (2016), which consists of 64 classes for training, 12 classes for validation and 24 classes for testing.
111
+
112
+ # 4.2 EXPERIMENTS
113
+
114
+ To evaluate our methods we adopted a hierarchical hyperparameter search methodology. First we began with the baseline MAML experiments, which were ran on the 5/20-way and 1/5-shot settings on the Omniglot dataset and the 5-way 1/5-shot setting on the Mini-Imagenet dataset. Then we added each one of our 6 methodologies on top of the default MAML and ran experiments for each one separately. Once this stage was completed we combined the approaches that showed improvements in either generalization performance or convergence speed (both in terms of number of epochs and clock-time) and ran a final experiment to establish any potential gains from the combination of the techniques.
115
+
116
+ An experiment consisted of training for 150 epochs, each epoch consisting of 500 iterations. At the end of each epoch, we evaluated the performance of the model on the validation set. Upon completion of all epochs, an ensemble of the top 3 performing per-epoch-models on the validation set were applied on the test set, thus producing the final test performance of the model. An evaluation ran consisted of inference on 600 unique tasks. A distinction between the training and evaluation tasks, was that the training tasks were generated dynamically continually without repeating previously sampled tasks, whilst the 600 evaluation tasks generated were identical across epochs. Thus ensuring that the comparison between models was fair, from an evaluation set viewpoint. Every experiment was repeated for 3 independent runs.
117
+
118
+ The models were trained using the Adam optimizer with a learning rate of 0.001, $\beta _ { 1 } = 0 . 9$ and $\beta _ { 2 } = 0 . 9 9$ . Furthermore, all Omniglot experiments used a task batch size of 16, whereas for the Mini-Imagenet experiments we used a task batch size of 4 and 2 for the 5-way 1-shot and 5-way 5-shot experiments respectively.
119
+
120
+ # 4.3 RESULTS
121
+
122
+ Our proposed methodologies are empirically shown to improve the original MAML framework. In Table 1 one can see how our proposed approach performs on Omniglot. Each proposed methodology can individually outperform MAML, however, the most notable improvements come from the learned per-step per-layer learning rates and the per-step batch normalization methodology. In the 5- way 1-shot tasks it achieves $9 9 . 4 7 \%$ and in the 20-way Omniglot tasks $\mathbf { M A M L + + }$ achieves $9 7 . 7 6 \%$ and $9 9 . 3 3 \%$ in the 1-shot and 5-shot tasks respectively. MAML $^ { + + }$ also showcases improved convergence speed in terms of training iterations required to reach the best validation performance. Furthermore, the multi-step loss optimization technique substantially improves the training stability of the model as illustrated in Figure 1. In Table 1 we also include the results of our own implementation of MAML, which reproduces all results except the 20-way 1-shot Omniglot case. Difficulty in replicating the specific result has also been noted before in Jamal et al. (2018). We base our conclusions on the relative performance between our own MAML implementation and the proposed methodologies.
123
+
124
+ Table 1: $\mathbf { M A M L + + }$ Omniglot 20-way Few-Shot Results: Our reproduction of MAML appears to be replicating all the results except the 20-way 1-shot results. Other authors have come across this problem as well Jamal et al. (2018). We report our own base-lines to provide better relative intuition on how each method impacted the test accuracy of the model. We showcase how our proposed improvements individually improve on the MAML performance. Our method improves on the existing state of the art.
125
+
126
+ <table><tr><td rowspan=1 colspan=3>Omniglot 20-wayFew-Shot Classification</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=2>Accuracy</td></tr><tr><td rowspan=1 colspan=1>Approach</td><td rowspan=1 colspan=1>1-shot</td><td rowspan=1 colspan=1>5-shot</td></tr><tr><td rowspan=1 colspan=1>Siamese Nets</td><td rowspan=1 colspan=1>88.2%</td><td rowspan=1 colspan=1>97.0%</td></tr><tr><td rowspan=1 colspan=1>Matching Nets</td><td rowspan=1 colspan=1>93.8%</td><td rowspan=1 colspan=1>98.5%</td></tr><tr><td rowspan=1 colspan=1>Neural Statistician</td><td rowspan=1 colspan=1>93.2%</td><td rowspan=1 colspan=1>98.1%</td></tr><tr><td rowspan=1 colspan=1>Memory Mod.</td><td rowspan=1 colspan=1>95.0%</td><td rowspan=1 colspan=1>98.6%</td></tr><tr><td rowspan=1 colspan=1>Meta-SGD</td><td rowspan=1 colspan=1>95.93±0.38%</td><td rowspan=1 colspan=1>98.97±0.19%</td></tr><tr><td rowspan=1 colspan=1>Meta-Networks</td><td rowspan=1 colspan=1>97.00%</td><td rowspan=1 colspan=1>二</td></tr><tr><td rowspan=1 colspan=1>MAML (original)</td><td rowspan=1 colspan=1>95.8±0.3%</td><td rowspan=1 colspan=1>98.9±0.2%</td></tr><tr><td rowspan=1 colspan=1>MAML (local replication)</td><td rowspan=1 colspan=1>91.27±1.07%</td><td rowspan=1 colspan=1>98.78%</td></tr><tr><td rowspan=1 colspan=1>MAML++</td><td rowspan=1 colspan=1>97.65±0.05%</td><td rowspan=1 colspan=1>99.33±0.03%</td></tr><tr><td rowspan=1 colspan=1>MAML+MSL</td><td rowspan=1 colspan=1>91.53±0.69%</td><td rowspan=1 colspan=1>-</td></tr><tr><td rowspan=1 colspan=1>MAML+LSLR</td><td rowspan=1 colspan=1>95.77±0.38%</td><td rowspan=1 colspan=1>二</td></tr><tr><td rowspan=1 colspan=1>MAML+BNWB+BNRS</td><td rowspan=1 colspan=1>95.35±0.23%</td><td rowspan=1 colspan=1>二</td></tr><tr><td rowspan=1 colspan=1>MAML +CA</td><td rowspan=1 colspan=1>93.03±0.44%</td><td rowspan=1 colspan=1>二</td></tr><tr><td rowspan=1 colspan=1>MAML +DA</td><td rowspan=1 colspan=1>92.3±0.55%</td><td rowspan=1 colspan=1>-</td></tr></table>
127
+
128
+ Table 2: $\mathbf { M A M L + + }$ Mini-Imagenet Results. $M A M L + +$ indicates MAML $^ +$ all the proposed fixes. Our reproduction of MAML appears to be replicating all the results of the original. Our approach sets a new state of the art across all tasks. It is also worth noting, that our approach, with only 1 inner loop step can already exceed all other methods. Additional steps allow for even better performance.
129
+
130
+ <table><tr><td rowspan=1 colspan=4>Mini-Imagenet 5-wayFew-Shot Classification</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Inner Steps</td><td rowspan=1 colspan=1>Accuracy</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>Mini-Imagenet</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1-shot</td><td rowspan=1 colspan=1>5-shot</td></tr><tr><td rowspan=1 colspan=1>Matching Nets</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>43.56%</td><td rowspan=1 colspan=1>55.31%</td></tr><tr><td rowspan=1 colspan=1>Meta-SGD</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>50.47±1.87%</td><td rowspan=1 colspan=1>64.03±0.94%</td></tr><tr><td rowspan=1 colspan=1>Meta-Networks</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>49.21%</td><td rowspan=1 colspan=1>1</td></tr><tr><td rowspan=1 colspan=1>MAML (original paper)</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>48.70±1.84%</td><td rowspan=1 colspan=1>63.11±0.92%</td></tr><tr><td rowspan=1 colspan=1>MAML (local reproduction)</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>48.25±0.62%</td><td rowspan=1 colspan=1>64.39±0.31%</td></tr><tr><td rowspan=1 colspan=1>MAML++</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>51.05±0.31%</td><td rowspan=1 colspan=1>二</td></tr><tr><td rowspan=1 colspan=1>MAML++</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>51.49±0.25%</td><td rowspan=1 colspan=1>-</td></tr><tr><td rowspan=1 colspan=1>MAML++</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>51.11±0.11%</td><td rowspan=1 colspan=1>二</td></tr><tr><td rowspan=1 colspan=1>MAML++</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>51.65±0.34%</td><td rowspan=1 colspan=1>-</td></tr><tr><td rowspan=1 colspan=1>MAML++</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>52.15±0.26%</td><td rowspan=1 colspan=1>68.32±0.44%</td></tr></table>
131
+
132
+ Table 2 showcases MAML $+ + 0 \mathrm { n }$ Mini-Imagenet tasks, where $\mathbf { M A M L + } +$ sets a new state of the art in both the 5-way 1-shot and 5-shot cases where the method achieves $5 2 . 1 5 \%$ and $6 8 . 3 2 \%$ respectively. More notably, $\mathbf { M A M L + }$ can achieve very strong 1-shot results of $5 1 . 0 5 \%$ with only a single inner loop step required. Not only is $\mathbf { M A M L + + }$ cheaper due to the usage of derivative order annealing, but also because of the much reduced inner loop steps. Another notable observation is that MAML $^ { + + }$ converges to its best generalization performance much faster (in terms of iterations required) when compared to MAML as shown in Figure 1.
133
+
134
+ # 5 CONCLUSION
135
+
136
+ In this paper we delve deep into what makes or breaks the MAML framework and propose multiple ways to reduce the inner loop hyperparameter sensitivity, improve the generalization error, stabilize and speed up MAML. The resulting approach, called MAML $^ { + + }$ sets a new state of the art across all few-shot tasks, across Omniglot and Mini-Imagenet. The results of the approach indicate that learning per-step learning rates, batch normalization parameters and optimizing on per-step target losses appears to be key for fast, highly automatic and strongly generalizable few-shot learning.
137
+
138
+ # REFERENCES
139
+
140
+ 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, pp. 3981–3989, 2016.
141
+
142
+ Antreas Antoniou, Amos Storkey, and Harrison Edwards. Data augmentation generative adversarial networks. arXiv preprint arXiv:1711.04340, 2017.
143
+
144
+ Jimmy Ba, Geoffrey E Hinton, Volodymyr Mnih, Joel Z Leibo, and Catalin Ionescu. Using fast weights to attend to the recent past. In Advances In Neural Information Processing Systems, pp. 4331–4339, 2016.
145
+
146
+ Andrew Brock, Theodore Lim, James M Ritchie, and Nick Weston. Smash: one-shot model architecture search through hypernetworks. arXiv preprint arXiv:1708.05344, 2017.
147
+
148
+ Rich Caruana. Learning many related tasks at the same time with backpropagation. In Advances in neural information processing systems, pp. 657–664, 1995.
149
+
150
+ Pieter-Tjerk De Boer, Dirk P Kroese, Shie Mannor, and Reuven Y Rubinstein. A tutorial on the cross-entropy method. Annals of operations research, 134(1):19–67, 2005.
151
+
152
+ Harrison Edwards and Amos Storkey. Towards a neural statistician. arXiv preprint arXiv:1606.02185, 2016.
153
+
154
+ Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. arXiv preprint arXiv:1703.03400, 2017.
155
+
156
+ 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.
157
+
158
+ Gao Huang, Zhuang Liu, Laurens Van Der Maaten, and Kilian Q Weinberger. Densely connected convolutional networks. In CVPR, volume 1, pp. 3, 2017.
159
+
160
+ Muhammad Abdullah Jamal, Guo-Jun Qi, and Mubarak Shah. Task-agnostic meta-learning for few-shot learning. arXiv preprint arXiv:1805.07722, 2018.
161
+
162
+ 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.
163
+
164
+ Brenden M Lake, Ruslan Salakhutdinov, and Joshua B Tenenbaum. Human-level concept learning through probabilistic program induction. Science, 350(6266):1332–1338, 2015.
165
+
166
+ Gustav Larsson, Michael Maire, and Gregory Shakhnarovich. Fractalnet: Ultra-deep neural networks without residuals. arXiv preprint arXiv:1605.07648, 2016.
167
+
168
+ Ke Li and Jitendra Malik. Learning to optimize. arXiv preprint arXiv:1606.01885, 2016.
169
+
170
+ Zhenguo Li, Fengwei Zhou, Fei Chen, and Hang Li. Meta-sgd: Learning to learn quickly for few shot learning. arXiv preprint arXiv:1707.09835, 2017.
171
+
172
+ Ilya Loshchilov and Frank Hutter. Sgdr: Stochastic gradient descent with warm restarts. arXiv preprint arXiv:1608.03983, 2016.
173
+
174
+ Tsendsuren Munkhdalai and Hong Yu. Meta networks. arXiv preprint arXiv:1703.00837, 2017.
175
+
176
+ Alex Nichol, Joshua Achiam, and John Schulman. On first-order meta-learning algorithms. CoRR, abs/1803.02999, 2018. URL http://arxiv.org/abs/1803.02999.
177
+
178
+ Sachin Ravi and Hugo Larochelle. Optimization as a model for few-shot learning. 2016.
179
+
180
+ Reuven Rubinstein. The cross-entropy method for combinatorial and continuous optimization. Methodology and computing in applied probability, 1(2):127–190, 1999.
181
+
182
+ Shibani Santurkar, Dimitris Tsipras, Andrew Ilyas, and Aleksander Madry. How does batch normalization help optimization?(no, it is not about internal covariate shift). arXiv preprint arXiv:1805.11604, 2018.
183
+
184
+ Jurgen Schmidhuber. Evolutionary principles in self-referential learning. On learning how to learn: The meta-meta-... hook.) Diploma thesis, Institut f. Informatik, Tech. Univ. Munich, 1987.
185
+
186
+ Sebastian Thrun and Lorien Pratt. Learning to learn: Introduction and overview. In Learning to learn, pp. 3–17. Springer, 1998.
187
+
188
+ Ricardo Vilalta and Youssef Drissi. A perspective view and survey of meta-learning. Artificial Intelligence Review, 18(2):77–95, 2002.
189
+
190
+ Oriol Vinyals, Charles Blundell, Tim Lillicrap, Daan Wierstra, et al. Matching networks for one shot learning. In Advances in Neural Information Processing Systems, pp. 3630–3638, 2016.
191
+
192
+ J. X Wang, Z. Kurth-Nelson, D. Tirumala, H. Soyer, J. Z Leibo, R. Munos, C. Blundell, D. Kumaran, and M. Botvinick. Learning to reinforcement learn. ArXiv e-prints, November 2016.
193
+
194
+ Barret Zoph and Quoc V Le. Neural architecture search with reinforcement learning. arXiv preprint arXiv:1611.01578, 2016.
195
+
196
+ # A ADDITIONAL RESULTS
197
+
198
+ Table 3: Mini-Imagenet Training Iteration Timing table. In this table, one can see per training iteration wall-clock timings for MAML vs $\mathbf { M A M L + }$ . We provide timings for variants of the model spanning 1 to 5 inner loop steps. It can be observed that $\mathbf { M A M L + + }$ needs less time per training iteration, even though it needs more parameters and has more computations needed. We can see that more steps require more computation in return for better generalization performance as evidenced in Table 2.
199
+
200
+ <table><tr><td rowspan=1 colspan=1>Inner Loop Steps</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>5</td></tr><tr><td rowspan=1 colspan=1>MAML ++ (ms/iter)</td><td rowspan=1 colspan=1>275.319</td><td rowspan=1 colspan=1>433.8172</td><td rowspan=1 colspan=1>579.314</td><td rowspan=1 colspan=1>786.3278</td><td rowspan=1 colspan=1>947.0376</td></tr><tr><td rowspan=1 colspan=1>MAML (ms/iter)</td><td rowspan=1 colspan=1>294.373</td><td rowspan=1 colspan=1>475.1218</td><td rowspan=1 colspan=1>658.4436</td><td rowspan=1 colspan=1>859.1158</td><td rowspan=1 colspan=1>1028.1656</td></tr></table>
201
+
202
+ Table 4 $: \mathrm { M A M L } + +$ Omniglot 5-way Results: $M A M L + +$ indicates MAML $^ +$ all the proposed fixes. We report our own base-lines on MAML to provide better relative intuition on how each method impacted the test accuracy of the model. We can see that MAML $^ { + + }$ matches or improves on MAML across all cases. MAML $^ { + + }$ also has performance very close to Meta-SGD which uses double the amount of parameters that MAML requires (about 40K extra parameters), whilst only using 1 extra parameter, per layer, per step for LSLR and $( f \times l \times ( s - 1 ) )$ (where $f$ is the number of filters at layers preceding batch normalization, $l$ is number of layers and $s$ is number of inner loop step) when using BNWB. Having less parameters also means smaller training and testing times.
203
+
204
+ <table><tr><td rowspan=1 colspan=3>Omniglot5-wayFew-Shot Classification</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=2>Accuracy</td></tr><tr><td rowspan=1 colspan=1>Omniglot</td><td rowspan=1 colspan=1>1-shot</td><td rowspan=1 colspan=1>5-shot</td></tr><tr><td rowspan=1 colspan=1>Siamese Nets</td><td rowspan=1 colspan=1>97.3%</td><td rowspan=1 colspan=1>98.4%</td></tr><tr><td rowspan=1 colspan=1>Matching Nets</td><td rowspan=1 colspan=1>98.1%</td><td rowspan=1 colspan=1>98.9%</td></tr><tr><td rowspan=1 colspan=1>Neural Statistician</td><td rowspan=1 colspan=1>98.1%</td><td rowspan=1 colspan=1>99.5%</td></tr><tr><td rowspan=1 colspan=1>Memory Mod.</td><td rowspan=1 colspan=1>98.4%</td><td rowspan=1 colspan=1>99.6%</td></tr><tr><td rowspan=1 colspan=1>Meta-SGD</td><td rowspan=1 colspan=1>99.53±0.26%</td><td rowspan=1 colspan=1>99.93±0.09%</td></tr><tr><td rowspan=1 colspan=1>Meta-Networks</td><td rowspan=1 colspan=1>98.95%</td><td rowspan=1 colspan=1>1</td></tr><tr><td rowspan=1 colspan=1>MAML (original)</td><td rowspan=1 colspan=1>98.70±0.4%</td><td rowspan=1 colspan=1>99.9±0.1%</td></tr><tr><td rowspan=1 colspan=1>MAML (local replication)</td><td rowspan=1 colspan=1>98.57%</td><td rowspan=1 colspan=1>99.82%</td></tr><tr><td rowspan=1 colspan=1>MAML++</td><td rowspan=1 colspan=1>99.47%</td><td rowspan=1 colspan=1>99.93%</td></tr></table>
md/train/HJGwcKclx/HJGwcKclx.md ADDED
@@ -0,0 +1,334 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SOFT WEIGHT-SHARING FOR NEURAL NETWORK COMPRESSION
2
+
3
+ Karen Ullrich University of Amsterdam karen.ullrich@uva.nl
4
+
5
+ Max Welling
6
+ University of Amsterdam
7
+ Canadian Institute for Advanced Research (CIFAR)
8
+ welling.max@gmail.com
9
+
10
+ # ABSTRACT
11
+
12
+ The success of deep learning in numerous application domains created the desire to run and train them on mobile devices. This however, conflicts with their computationally, memory and energy intense nature, leading to a growing interest in compression. Recent work by Han et al. (2015a) propose a pipeline that involves retraining, pruning and quantization of neural network weights, obtaining state-of-the-art compression rates. In this paper, we show that competitive compression rates can be achieved by using a version of ”soft weight-sharing” (Nowlan & Hinton, 1992). Our method achieves both quantization and pruning in one simple (re-)training procedure. This point of view also exposes the relation between compression and the minimum description length (MDL) principle.
13
+
14
+ # 1 INTRODUCTION
15
+
16
+ ”Bigger is better” is the ruling maxim in deep learning land. Deep neural nets with billions of parameters are no longer an exception. Networks of such size are unfortunately not practical for mobile, on-device applications which face strong limitations with respect to memory and energy consumption. Compressing neural networks could not only improve memory and energy consumption, but also lead to less network bandwidth, faster processing and better privacy. It has been shown that large networks are heavily over-parametrized and can be compressed by approximately two orders of magnitude without significant loss of accuracy. Apparently, over-parametrization is beneficial for optimization, but not necessary for accurate prediction. This observation has opened the door for a number of highly successful compression algorithms, which either train the network from scratch (Hinton et al., 2015; Iandola et al., 2016; Courbariaux & Bengio, 2016; Courbariaux et al., 2016) or apply compression post-optimization (Han et al., 2015b;a; Guo et al., 2016; Chen et al., 2015; Wen et al., 2016).
17
+
18
+ It has been long known that compression is directly related to (variational) Bayesian inference and the minimum description principle (Hinton & Van Camp, 1993). One can show that good compression can be achieved by encoding the parameters of a model using a good prior and specifying the parameters up to an uncertainty given, optimally, by the posterior distribution. An ingenious bitsback argument can then be used to get a refund for using these noisy weights. A number of papers have appeared that encode the weights of a neural network with limited precision (say 8 bits per weight), effectively cashing in on this ”bits-back” argument (Gupta et al., 2015; Courbariaux et al., 2014; Venkatesh et al., 2016). Some authors go so far of arguing that even a single bit per weight can be used without much loss of accuracy (Courbariaux et al., 2015; Courbariaux & Bengio, 2016).
19
+
20
+ In this work we follow a different but related direction, namely to learn the prior that we use to encode the parameters. In Bayesian statistics this is known as empirical Bayes. To encourage compression of the weights to $K$ clusters, we fit a mixture of Gaussians prior model over the weights. This idea originates from the nineties, known as soft weight-sharing (Nowlan & Hinton, 1992) where it was used to regularize a neural network. Here our primary goal is network compression, but as was shown in Hinton & Van Camp (1993) these two objectives are almost perfectly aligned. By fitting the mixture components alongside the weights, the weights tend to concentrate very tightly around a number of cluster components, while the cluster centers optimize themselves to give the network high predictive accuracy. Compression is achieved because we only need to encode $K$ cluster means (in full precision) in addition to the assignment of each weight to one of these $J$ values (using $\log ( J )$ bits per weight). We find that competitive compression rates can be achieved by this simple idea.
21
+
22
+ # 2 MDL VIEW ON VARIATIONAL LEARNING
23
+
24
+ Model compression was first discussed in the context of information theory. The minimum description length (MDL) principle identifies the best hypothesis to be the one that best compresses the data. More specifically, it minimizes the cost to describe the model (complexity cost $\mathcal { L } ^ { C }$ ) and the misfit between model and data (error cost $\mathcal { L } ^ { E }$ ) (Rissanen, 1978; 1986). It has been shown that variational learning can be reinterpreted as an MDL problem (Wallace, 1990; Hinton & Van Camp, 1993; Honkela & Valpola, 2004; Graves, 2011). In particular, given data $\mathcal D = \left\{ \mathbf X = \{ \mathbf x _ { n } \} _ { n = 1 } ^ { N } , \mathbf T = \{ \mathbf t _ { n } \} _ { n = 1 } ^ { N } \right\}$ , a set of parameters $\mathbf { w } = \{ w _ { i } \} _ { i = 1 } ^ { I }$ that describes the model and an approximation $q ( \mathbf { w } )$ of the posterior $p ( \mathbf { w } | \mathcal { D } )$ , the variational lower bound, also known as negative variational free energy, $\mathcal { L } ( q ( \mathbf { w } ) , \mathbf { w } )$ can be decomposed in terms of error and complexity losses
25
+
26
+ $$
27
+ { \mathcal { L } } ( q ( \mathbf { w } ) , \mathbf { w } ) = - \mathbb { E } _ { q ( \mathbf { w } ) } \left[ \log \left( { \frac { p ( { \mathcal { D } } | \mathbf { w } ) p ( \mathbf { w } ) } { q ( \mathbf { w } ) } } \right) \right] = \underbrace { \mathbb { E } _ { q ( \mathbf { w } ) } \left[ - \log p ( { \mathcal { D } } | \mathbf { w } ) \right] } _ { { \mathcal { L } } ^ { E } } + \underbrace { \mathrm { K L } ( q ( \mathbf { w } ) | | p ( \mathbf { w } ) ) } _ { { \mathcal { L } } ^ { C } }
28
+ $$
29
+
30
+ where $p ( \mathbf { w } )$ is the prior over $\mathbf { w }$ and $p ( \mathcal { D } | \mathbf { w } )$ is the model likelihood. According to Shannon’s source coding theorem, $\mathring { \mathcal { L } } ^ { E }$ lower bounds the expected amount of information needed to communicate the targets $\mathbf { T }$ , given the receiver knows the inputs $\mathbf { X }$ and the model w. The functional form of the likelihood term is conditioned by the target distribution. For example, in case of regression the predictions of the model are assumed be normally distributed around the targets $\mathbf { T }$ .
31
+
32
+ $$
33
+ p ( \mathcal { D } | \mathbf { w } ) = p ( \mathbf { T } | \mathbf { X } , \mathbf { w } ) = \prod _ { n = 1 } ^ { N } \mathcal { N } ( \mathbf { t } _ { n } | \mathbf { x } _ { n } , \mathbf { w } )
34
+ $$
35
+
36
+ where $\mathcal { N } ( \mathbf { t } _ { n } , \mathbf { x } _ { n } , \mathbf { w } )$ is a normal distribution. Another typical example is classification where the conditional distribution of targets given data is assumed to be Bernoulli distributed1. These assumptions eventually lead to the well known error functions, namely cross-entropy error and squared error for classification and regression, respectively.
37
+
38
+ Before however we can communicate the data we first seek to communicate the model. Similarly to $\mathcal { L } ^ { E } , \mathcal { L } ^ { C }$ is a lower bound for transmitting the model. More specifically, if sender and receiver agree on a prior, $\mathcal { L } ^ { C }$ is the expected cost of communicating the parameters w. This cost is again twofold,
39
+
40
+ $$
41
+ \mathrm { K L } ( q ( \mathbf { w } ) | | p ( \mathbf { w } ) ) = \mathbb { E } _ { q ( \mathbf { w } ) } \left[ - \log p ( \mathbf { w } ) \right] - H ( q ( \mathbf { w } ) )
42
+ $$
43
+
44
+ where $H ( \cdot )$ denotes the entropy. In Wallace (1990) and Hinton & Van Camp (1993) it was shown that noisy encoding of the weights can be beneficial due to the bits-back argument if the uncertainty does not harm the error loss too much. The number of bits to get refunded by an uncertain weight distribution $q ( \mathbf { w } )$ is given by its entropy. Further, it can be shown that the optimal distribution for $q ( \mathbf { w } )$ is the Bayesian posterior distribution. While bits-back is proven to be an optimal coding scheme (Honkela $\&$ Valpola, 2004), it is often not practical in real world settings. A practical way to cash in on noisy weights (or bits-back) is to only encode a weight value up to a limited number of bits. To see this, assume a factorized variational posteriors $q ( \mathbf { w } ) { \bar { \mathbf { \Gamma } } } = \prod q ( w _ { i } )$ . Each posterior $q ( w _ { i } )$ is associated with a Dirac distribution up to machine precision, for example, a Gaussian distribution with variance $\sigma$ , for small values of $\sigma$ . This implies that we formally incur a very small refund per weight,
45
+
46
+ $$
47
+ H ( q ( \mathbf { w } ) ) = - \intop _ { \Omega } q ( \mathbf { w } ) \log q ( \mathbf { w } ) \mathrm { d } \mathbf { w } = - \intop _ { \mathbb { R } ^ { I } } \mathcal { N } ( \mathbf { w } | \mathbf { 0 } , \sigma \mathbf { I } ) \log \mathcal { N } ( \mathbf { w } | \mathbf { 0 } , \sigma \mathbf { I } ) = [ \log ( 2 \pi e \sigma ^ { 2 } ) ] ^ { I } .
48
+ $$
49
+
50
+ Note that the more coarse the quantization of weights the more compressible the model. The bitsback scheme makes three assumptions: (i) weights are being transmitted independently, (ii) weights are independent of each other (no mutual information), and (iii) the receiver knows the prior. Han et al. (2015a) show that one can successfully exploit (i) and (ii) by using a form of arithmetic coding (Witten et al., 1987). In particular, they employ range coding schemes such as the Sparse Matrix Format (discussed in Appendix A). This is beneficial because the weight distribution has low entropy. Note that the cost of transmitting the prior should be negligible. Thus a factorized prior with different parameters for each factor is not desirable.
51
+
52
+ The main objective of this work is to find a suitable prior for optimizing the cross-entropy between a delta posterior $q ( \mathbf { w } )$ and the prior $p ( \mathbf { w } )$ while at the same time keeping a practical coding scheme in mind. Recall that the cross entropy is a lower bound on the average number of bits required to encode the weights of the neural network (given infinite precision). Following Nowlan & Hinton (1992) we will model the prior $p ( \mathbf { w } )$ as a mixture of Gaussians,
53
+
54
+ $$
55
+ p ( \mathbf { w } ) = \prod _ { i = 1 } ^ { I } \sum _ { j = 0 } ^ { J } \pi _ { j } \mathcal { N } ( w _ { i } | \mu _ { j } , \sigma _ { j } ^ { 2 } ) .
56
+ $$
57
+
58
+ We learn the mixture parameters $\mu _ { j } , \sigma _ { j } ,$ $\pi _ { j }$ via maximum likelihood simultaneously with the network weights. This is equivalent to an empirical Bayes approach in Bayesian statistics. For stateof-the-art compression schemes pruning plays a major role. By enforcing an arbitrary “zero” component to have fixed $\mu _ { 0 } = 0$ location and $\pi _ { 0 }$ to be close to 1, a desired weight pruning rate can be enforced. In this scenario $\pi _ { 0 }$ may be fixed or trainable. In the latter case a Beta distribution as hyperprior might be helpful. The approach naturally encourages quantization because in order to optimize the cross-entropy the weights will cluster tightly around the cluster means, while the cluster means themselves move to some optimal location driven by $\mathcal { L } ^ { E }$ . The effect might even be so strong that it is beneficial to have a Gamma hyper-prior on the variances of the mixture components to prevent the components from collapsing. Furthermore, note that, mixture components merge when there is not enough pressure from the error loss to keep them separated because weights are attracted by means and means are attracted by weights hence means also attract each other. In that way the network learns how many quantization intervals are necessary. We demonstrate that behaviour in Figure 3.
59
+
60
+ # 3 RELATED WORK
61
+
62
+ There has been a recent surge in interest in compression in the deep neural network community. Denil et al. (2013) showed that by predicting parameters of neural networks there is great redundancy in the amount of parameters being used. This suggests that pruning, originally introduced to reduce structure in neural networks and hence improve generalization, can be applied to the problem of compression and speed-up (LeCun et al., 1989). In fact, (Han et al., 2015b; Guo et al., 2016) show that neural network survive severe weight pruning (up to $9 9 \%$ ) without significant loss of accuracy. A variational version is is proposed by Molchanov et al. (2017), the authors learn the dropout rate for each weight in the network separately. Some parameters will effectively be pruned when the dropout rate is very high. In an approach slightly orthogonal to weight pruning, (Wen et al., 2016) applied structural regularization to prune entire sets of weights from the neural network. Such extreme weight pruning can lead to entire structures being obsolete, which for the case of convolutional filters, can greatly speed up prediction. Most importantly for compression, however, is that in conjunction with Compressed Sparse Column (CSC) format, weight pruning is a highly effective way to store and transfer weights. In Appendix A we discuss CSC format in more detail.
63
+
64
+ Reducing the bit size per stored weight is another approach to model compression. For example, reducing 32 bit floats to 1 bit leads to a $3 2 \times$ storage improvement. Gong et al. (2014) proposed and experimented with a number of quantization approaches: binary quantization, $\mathbf { k }$ -means quantization, product quantization and residual quantization. Other work finds optimal fixed points (Lin et al., 2015), applies hashing (Chen et al., 2015) or minimizes the estimation error (Wu et al., 2015). Merolla et al. (2016) demonstrates that neural networks are robust against certain amounts of low precision; indeed several groups have exploited this and showed that decreasing the weight encoding precision has little to no effect on the accuracy loss (Gupta et al., 2015; Courbariaux et al., 2014; Venkatesh et al., 2016). Pushing the idea of extreme quantization, (Courbariaux et al., 2015) and Courbariaux & Bengio (2016) trained networks from scratch that use only 1bit weights with floating point gradients; to achieve competitive results, however, they require many more of these weights.
65
+
66
+ Han et al. (2015a) elaborate on combining these ideas. They introduce an multi-step algorithm that compresses CNNS up to $4 9 \times$ . First, weights are pruned (giving $9 - 1 3 \times$ compression); second they quantize the weights (increasing compression to $2 7 - 3 1 \times )$ ; and last, they apply Huffman Encoding (giving a final compression of $3 5 - 4 9 \times )$ . The quantization step is trainable in that after each weight is assigned to a cluster centroid, the centroids get trained with respect to the original loss function. Note that this approach has several restrictions: the number of weights set to zero is fixed after the pruning step, as is the assignment of a weight to a given cluster in the second step. Our approach overcomes all these restrictions.
67
+
68
+ A final approach to compressing information is to apply low rank matrix decomposition. First introduced by (Denton et al., 2014) and Jaderberg et al. (2014), and elaborated on by using low rank filters (Ioannou et al., 2015), low rank regularization (Tai et al., 2015) or combining low rank decomposition with sparsity (Liu et al., 2015).
69
+
70
+ # 4 METHOD
71
+
72
+ This section presents the procedure of network compression as applied in the experiment section. A summary can be found in Algorithm 1.
73
+
74
+ # 4.1 GENERAL SET-UP
75
+
76
+ We retrain pre-trained neural networks with soft weight-sharing and factorized Dirac posteriors. Hence we optimize
77
+
78
+ $$
79
+ \begin{array} { r l } & { \mathcal { L } ( \mathbf { w } , \{ \mu _ { j } , \sigma _ { j } , \pi _ { j } \} _ { j = 0 } ^ { J } ) = \mathcal { L } ^ { E } + \tau \mathcal { L } ^ { C } } \\ & { \qquad = - \log p ( \mathbf { T } | \mathbf { X } , \mathbf { w } ) - \tau \log p ( \mathbf { w } , \{ \mu _ { j } , \sigma _ { j } , \pi _ { j } \} _ { j = 0 } ^ { J } ) , } \end{array}
80
+ $$
81
+
82
+ via gradient descent, specifically using Adam (Kingma & Ba, 2014). The KL divergence reduces to the prior because the entropy term does not depend on any trainable parameters. Note that, similar to (Nowlan & Hinton, 1992) we weigh the log-prior contribution to the gradient by a factor of $\tau = 0 . 0 0 5$ . In the process of retraining the weights, the variances, means, and mixing proportions of all but one component are learned. For one component, we fix $\mu _ { j = 0 } = 0$ and $\pi _ { j = 0 } = 0 . 9 9 9$ . Alternatively we can train $\pi _ { j = 0 }$ as well but restrict it by a Beta distribution hyper-prior. Our Gaussian MM prior is initialized with $2 ^ { 4 } + 1 = 1 7$ components. We initialize the learning rate for the weights and means, log-variances and log-mixing proportions separately. The weights should be trained with approximately the same learning rate used for pre-training. The remaining learning rates are set to $5 \cdot 1 0 ^ { - 4 }$ . Note that this is a very sensitive parameter. The Gaussian mixtures will collapse very fast as long as the error loss does not object. However if it collapses too fast weights might be left behind, thus it is important to set the learning rate such that the mixture does collapse too soon. If the learning rate is too small the mixture will converge too slowly. Another option to keep the mixture components from collapsing is to apply an Inverse-Gamma hyperprior on the mixture variances.
83
+
84
+ # 4.2 INITIALIZATION OF MIXTURE MODEL COMPONENTS
85
+
86
+ In principle, we follow the method proposed by Nowlan & Hinton (1992). We distribute the means of the 16 non-fixed components evenly over the range of the pre-trained weights. The variances will be initialized such that each Gaussian has significant probability mass in its region. A good orientation for setting a good initial variance is weight decay rate the original network has been trained on. The trainable mixing proportions are initialized evenly $\pi _ { j } = ( 1 - \pi _ { j = 0 } ) / J$ . We also experimented with other approaches such as distributing the means such that each component assumes an equal amount of probability. We did not observe any significant improvement over the simpler initialization procedure.
87
+
88
+ # 4.3 POST-PROCESSING
89
+
90
+ After re-training we set each weight to the mean of the component that takes most responsibility for it i.e. we quantize the weights. Before quantizing, however, there might be redundant components
91
+
92
+ as explained in section 2. To eliminate those we follow Adhikari & Hollmen (2012) by computing ´ the KL divergence between all components. For a KL divergence smaller than a threshold, we merge two components as follows
93
+
94
+ $$
95
+ \pi _ { \mathrm { n e w } } = \pi _ { i } + \pi _ { j } , \mu _ { \mathrm { n e w } } = \frac { \pi _ { i } \mu _ { i } + \pi _ { j } \mu _ { j } } { \pi _ { i } + \pi _ { j } } , \sigma _ { \mathrm { n e w } } ^ { 2 } = \frac { \pi _ { i } \sigma _ { i } ^ { 2 } + \pi _ { j } \sigma _ { j } ^ { 2 } } { \pi _ { i } + \pi _ { j } }
96
+ $$
97
+
98
+ for two components with indices $i$ and $j$ .
99
+
100
+ Finally, for practical compression we use the storage format used in Han et al. (2015a) (see Appendix A).
101
+
102
+ Algorithm 1 Soft weight-sharing for compression, our proposed algorithm for neural network model compression. It is divided into two main steps: network re-training and post-processing.
103
+
104
+ Require: $\tau \mathrm { s e t }$ the trade-off between error and complexity loss
105
+ Require: $\Theta $ set parameters for gradient decent scheme such as learning rate or momentum
106
+ Require: $\alpha , \beta \gets { \sf s e t }$ gamma hyper-prior parameter (optional) $\mathbf { w } \gets$ initialize network weights with pre-trained network weights $\theta = \{ \mu _ { j } , \sigma _ { j } , \pi _ { j } \} _ { j = 1 } ^ { J } $ initialize mixture parameters (see Sec. 4.2) while $\mathbf { w } , \theta$ not converged do $\mathbf { w } , \theta \gets \nabla _ { \mathbf { w } , \theta } \mathcal { L } ^ { E } + \overline { { \tau } } \mathcal { L } ^ { C }$ update $\mathbf { w }$ and $\theta$ with the gradient decent scheme of choice end while $\mathbf { w } \gets \mathop { \mathrm { a r g m a x } } _ { \mu _ { k } } \frac { \pi _ { k } \mathcal { N } ( \mathbf { w } | \mu _ { k } , \sigma _ { k } ) } { \sum \pi _ { j } \mathcal { N } ( \mathbf { w } | \mu _ { j } , \sigma _ { j } ) }$ compute final weight by setting it to the mean that takes most responsibility (for details see Sec. 4.3)
107
+
108
+ # 5 MODELS
109
+
110
+ We test our compression procedure on two neural network models used in previous work we compare against in our experiments:
111
+
112
+ (a) LeNet-300-100 an MNIST model described in LeCun et al. (1998). As no pre-trained model is available, we train our own, resulting in an error rate of $1 . 8 9 \%$ .
113
+ (b) LeNet-5-Caffe a modified version of the LeNet-5 MNIST model in LeCun et al. (1998). The model specification can be downloaded from the Caffe MNIST tutorial page 2. As no pre-trained model is available, we train our own, resulting in an error rate of $0 . 8 8 \%$ .
114
+ (c) ResNets have been invented by He et al. (2015) and further developed by He et al. (2016) and Zagoruyko & Komodakis (2016). We choose a model version of the latter authors. In accordance with their notation, we choose a network with depth 16, width $k = 4$ and no dropout. This model has $2 . 7 \mathbf { M }$ parameters. In our experiments, we follow the authors by using only light augmentation, i.e., horizontal flips and random shifts by up to 4 pixels. Furthermore the data is normalized. The authors report error rates of $5 . 0 2 \%$ and $2 4 . 0 3 \%$ for CIFAR-10 and CIFAR-100 respectively. By reimplementing their model we trained models that achieve errors $6 . 4 8 \%$ and $2 8 . 2 3 \%$ .
115
+
116
+ # 6 EXPERIMENTS
117
+
118
+ # 6.1 INITIAL EXPERIMENT
119
+
120
+ First, we run our algorithm without any hyper-priors, an experiment on LeNet-300-100. In Figure 1 we visualise the original distribution over weights, the final distribution over weight and how each weight changed its position in the training process. After retraining, the distribution is sharply peaked around zero. Note that with our procedure the optimization process automatically determines how many weights per layer are pruned. Specifically in this experiment, $96 \%$ of the first layer (235K parameter), $90 \%$ of the second (30K) and only $18 \%$ of the final layer (10K) are pruned. From observations of this and other experiments, we conclude that the amount of pruned weights depends mainly on the number of parameters in the layer rather than its position or type (convolutional or fully connected).
121
+
122
+ Evaluating the model reveals a compression rate of 64.2. The accuracy of the model does not drop significantly from 0.9811 to 0.9806. However, we do observe that the mixture components eventually collapse, i.e., the variances go to zero. This makes the prior inflexible and the optimization can easily get stuck because the prior is accumulating probability mass around the mixture means. For a weight, escaping from those high probability plateaus is impossible. This motivates the use hyper-priors such as an Inverse-Gamma prior on the variances to essentially lower bound them.
123
+
124
+ ![](images/366fcfb9d4f32f72391a0724ed8b6315b098dcac6186c9ceaf7a26d458a50213.jpg)
125
+ Figure 1: On top we show the distribution of a pretrained network. On the right the same distribution after retraining. The change in value of each weight is illustrated by a scatter plot.
126
+
127
+ 6.2 HYPER-PARAMETER TUNING USING BAYESIAN OPTIMIZATION
128
+
129
+ The proposed procedure offers various freedoms: there are many hyper-parameters to optimize, one may use hyper-priors as motivated in the previous section or even go as far as using other distributions as mixture components.
130
+
131
+ To cope with the variety of choices, we optimize 13 hyper-parameters using the Bayesian optimization tool Spearmint Snoek et al. (2012). These include the learning rates of the weight and mixing components, the number of components, and $\tau$ . Furthermore, we assume an Inverse-Gamma prior over the variances separately for the zero component and the other components and a Beta prior over the zero mixing components.
132
+
133
+ In these experiments, we optimize re-training hyperparameters for LeNet-300-100 and LeNet-5- Caffe. Due to computational restrictions, we set the number of training epochs to 40 (previously 100), knowing that this may lead to solutions that have not fully converged. Spearmint acts on an objective that balances accuracy loss vs compression rate. The accuracy loss in this case is measured over the training data. The results are shown in Figure 2. In the illustration we use the accuracy loss as given by the test data. The best results predicted by our spearmint objective are colored in dark blue. Note that we achieve competitive results in this experiment despite the restricted optimization time of 40 epochs, i.e. 18K updates.
134
+
135
+ ![](images/62da5f3a931a29608a1c8683b52053a43dbe573da65df1fe113163626c3d12b3.jpg)
136
+ Figure 2: We show the results of optimizing hyper-parameters with spearmint. Specifically, we plot the accuracy loss of a re-trained network against the compression rate. Each point represents one hyper-parameter setting. The guesses of the optimizer improve over time. We also present the results of other methods for comparison. Left: LeNet-300-100 Right: LeNet-5-Caffe.
137
+
138
+ ![](images/b0bf8e6826b727729b43ba5975e9440a88a49d3cdb787f100f770c3392a0e2f2.jpg)
139
+ Figure 3: Illustration of our mixture model compression procedure on LeNet-5-Caffe. Left: Dynamics of Gaussian mixture components during the learning procedure. Initially there are $1 7 \mathrm { \ c o m { - } }$ ponents, including the zero component. During learning components are absorbed into other components, resulting in roughly 6 significant components. Right: A scatter plot of initial versus final weights, along with the Gaussian components’ uncertainties. The initial weight distribution is roughly one broad Gaussian, whereas the final weight distribution matches closely the final, learned prior which has become very peaked, resulting in good quantization properties.
140
+
141
+ The conclusions from this experiment are a bit unclear, on the one hand we do achieve state-ofthe-art results for LeNet-5-Caffe, on the other hand there seems to be little connection between the parameter settings of best results. One wonders if a 13 dimensional parameter space can be searched efficiently with the amount of runs we were conducting. It may be more reasonable to get more inside in the optimization process and tune parameters according to those.
142
+
143
+ # 6.3 COMPRESSION RESULTS
144
+
145
+ We compare our compression scheme with Han et al. (2015a) and Guo et al. (2016) in Table 1. The results on MNIST networks are very promising. We achieve state-of-the-art compression rates in both examples. We can furthermore show results for a light version of ResNet with 2.7M parameters to illustrate that our method does scale to modern architectures. We used more components (64)
146
+
147
+ Table 1: Compression Results. We compare methods based on the post-processing error (we also indicate the starting error), the accuracy loss $\Delta$ , the number of non zero weights $| \mathbf { W } _ { \neq 0 } |$ and the final compression rate CR based on the method proposed by Han et al. (2015a).
148
+
149
+ <table><tr><td>Model</td><td>Method</td><td>Top-1 Error[%]</td><td>△[%]</td><td>[W|[106]</td><td>W0 [%] W</td><td>CR</td></tr><tr><td rowspan="3">LeNet-300-100</td><td>Han et al. (2015a)</td><td>1.64 → 1.58</td><td>0.06</td><td>0.2</td><td>8.0</td><td>40</td></tr><tr><td>Guo et al. (2016)</td><td>2.28→ 1.99</td><td>-0.29</td><td></td><td>1.8</td><td>56</td></tr><tr><td>Ours</td><td>1.89 →1.94</td><td>-0.05</td><td></td><td>4.3</td><td>64</td></tr><tr><td rowspan="3">LeNet-5-Caffe</td><td>Han et al. (2015a)</td><td>0.80 →0.74</td><td>-0.06</td><td>0.4</td><td>8.0</td><td>39</td></tr><tr><td>Guo et al. (2016)</td><td>0.91 →0.91</td><td>0.00</td><td></td><td>0.9</td><td>108</td></tr><tr><td>Ours</td><td>0.88 →0.97</td><td>0.09</td><td></td><td>0.5</td><td>162</td></tr><tr><td>ResNet (light)</td><td>Ours</td><td>6.48 →8.50</td><td>2.02</td><td>2.7</td><td>6.6</td><td>45</td></tr></table>
150
+
151
+ here to cover the large regime of weights. However, for large networks such as VGG with 138M parameters the algorithm is too slow to get usable results. We propose a solution for this problem in Appendix C; however, we do not have any experimental results yet.
152
+
153
+ # 7 DISCUSSION AND FUTURE WORK
154
+
155
+ In this work we revived a simple and principled regularization method based on soft weight-sharing and applied it directly to the problem of model compression. On the one hand we showed that we can optimize the MDL complexity lower bound, while on the other hand we showed that our method works well in practice when being applied to different models. A short-coming of the method at the moment is its computational cost and the ease of implementation. For the first, we provide a proposal that will be tested in future work. The latter is an open question at the moment. Note that our method—since it is optimizing the lower bound directly—will most likely also work when applied to other storage formats, such as those proposed originally by Hinton & Van Camp (1993). In the future we would like to extend beyond Dirac posteriors as done in Graves (2011) by extending the weight sharing prior to more general priors. For example, from a compression point of view, we could learn to prune entire structures from the network by placing Bernoulli priors over structures such as convolutional filters or ResNet units. Furthermore, it could be interesting to train models from scratch or in a student-teacher setting.
156
+
157
+ # ACKNOWLEDGEMENTS
158
+
159
+ We would like to thank Louis Smit, Christos Louizos, Thomas Kipf, Rianne van den Berg and Peter O’Connor for helpful discussions on the paper and the public code3.
160
+
161
+ This research has been supported by Google.
162
+
163
+ # REFERENCES
164
+
165
+ Prem Raj Adhikari and Jaakko Hollmen. Multiresolution mixture modeling using merging of mix- ´ ture components. 2012.
166
+
167
+ Christopher M Bishop. Pattern recognition. Machine Learning, 2006.
168
+
169
+ Wenlin Chen, James T Wilson, Stephen Tyree, Kilian Q Weinberger, and Yixin Chen. Compressing convolutional neural networks. arXiv preprint arXiv:1506.04449, 2015.
170
+
171
+ Matthieu Courbariaux and Yoshua Bengio. Binarynet: Training deep neural networks with weights and activations constrained to $+ 1$ or $- 1$ . arXiv preprint arXiv:1602.02830, 2016.
172
+
173
+ Matthieu Courbariaux, Jean-Pierre David, and Yoshua Bengio. Training deep neural networks with low precision multiplications. arXiv preprint arXiv:1412.7024, 2014.
174
+
175
+ Matthieu Courbariaux, Yoshua Bengio, and Jean-Pierre David. Binaryconnect: Training deep neural networks with binary weights during propagations. In Advances in Neural Information Processing Systems, pp. 3123–3131, 2015.
176
+
177
+ Matthieu Courbariaux, Itay Hubara, Daniel Soudry, Ran El-Yaniv, and Yoshua Bengio. Binarized neural networks: Training neural networks with weights and activations constrained to $+ 1$ or $- 1$ 2016.
178
+
179
+ Misha Denil, Babak Shakibi, Laurent Dinh, Nando de Freitas, et al. Predicting parameters in deep learning. In Advances in Neural Information Processing Systems, pp. 2148–2156, 2013.
180
+
181
+ Emily L Denton, Wojciech Zaremba, Joan Bruna, Yann LeCun, and Rob Fergus. Exploiting linear structure within convolutional networks for efficient evaluation. In Advances in Neural Information Processing Systems, pp. 1269–1277, 2014.
182
+
183
+ Yunchao Gong, Liu Liu, Ming Yang, and Lubomir Bourdev. Compressing deep convolutional networks using vector quantization. arXiv preprint arXiv:1412.6115, 2014.
184
+
185
+ Alex Graves. Practical variational inference for neural networks. In Advances in Neural Information Processing Systems, pp. 2348–2356, 2011.
186
+
187
+ Yiwen Guo, Anbang Yao, and Yurong Chen. Dynamic network surgery for efficient dnns. In Advances In Neural Information Processing Systems, pp. 1379–1387, 2016.
188
+
189
+ Suyog Gupta, Ankur Agrawal, Kailash Gopalakrishnan, and Pritish Narayanan. Deep learning with limited numerical precision. CoRR, abs/1502.02551, 392, 2015.
190
+
191
+ 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, 2, 2015a.
192
+
193
+ Song Han, Jeff Pool, John Tran, and William Dally. Learning both weights and connections for efficient neural networks. In Advances in Neural Information Processing Systems, pp. 1135– 1143, 2015b.
194
+
195
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. arXiv preprint arXiv:1512.03385, 2015.
196
+
197
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Identity mappings in deep residual networks. arXiv preprint arXiv:1603.05027, 2016.
198
+
199
+ Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015.
200
+
201
+ Geoffrey E Hinton and Drew Van Camp. Keeping the neural networks simple by minimizing the description length of the weights. In Proceedings of the sixth annual conference on Computational learning theory, pp. 5–13. ACM, 1993.
202
+
203
+ Antti Honkela and Harri Valpola. Variational learning and bits-back coding: an informationtheoretic view to bayesian learning. IEEE Transactions on Neural Networks, 15(4):800–810, 2004.
204
+
205
+ Forrest N Iandola, Matthew W Moskewicz, Khalid Ashraf, Song Han, William J Dally, and Kurt Keutzer. Squeezenet: Alexnet-level accuracy with 50x fewer parameters and¡ 1mb model size. arXiv preprint arXiv:1602.07360, 2016.
206
+
207
+ Yani Ioannou, Duncan Robertson, Jamie Shotton, Roberto Cipolla, and Antonio Criminisi. Training cnns with low-rank filters for efficient image classification. arXiv preprint arXiv:1511.06744, 2015.
208
+
209
+ Max Jaderberg, Andrea Vedaldi, and Andrew Zisserman. Speeding up convolutional neural networks with low rank expansions. arXiv preprint arXiv:1405.3866, 2014.
210
+
211
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
212
+
213
+ Yann LeCun, John S Denker, Sara A Solla, Richard E Howard, and Lawrence D Jackel. Optimal brain damage. In NIPs, volume 2, pp. 598–605, 1989.
214
+ Yann LeCun, Leon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to ´ document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
215
+ Darryl D Lin, Sachin S Talathi, and V Sreekanth Annapureddy. Fixed point quantization of deep convolutional networks. arXiv preprint arXiv:1511.06393, 2015.
216
+ Baoyuan Liu, Min Wang, Hassan Foroosh, Marshall Tappen, and Marianna Pensky. Sparse convolutional neural networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 806–814, 2015.
217
+ Paul Merolla, Rathinakumar Appuswamy, John Arthur, Steve K Esser, and Dharmendra Modha. Deep neural networks are robust to weight binarization and other non-linear distortions. arXiv preprint arXiv:1606.01981, 2016.
218
+ Dmitry Molchanov, Arsenii Ashukha, and Dmitry Vetrov. Variational dropout sparsifies deep neural networks. arXiv preprint arXiv:1701.05369, 2017.
219
+ Steven J Nowlan and Geoffrey E Hinton. Simplifying neural networks by soft weight-sharing. Neural computation, 4(4):473–493, 1992.
220
+ Jorma Rissanen. Modeling by shortest data description. Automatica, 14(5):465–471, 1978.
221
+ Jorma Rissanen. Stochastic complexity and modeling. The annals of statistics, pp. 1080–1100, 1986.
222
+ Herbert Robbins and Sutton Monro. A stochastic approximation method. The annals of mathematical statistics, pp. 400–407, 1951.
223
+ Jasper Snoek, Hugo Larochelle, and Ryan P Adams. Practical bayesian optimization of machine learning algorithms. In Advances in neural information processing systems, pp. 2951–2959, 2012.
224
+ Cheng Tai, Tong Xiao, Xiaogang Wang, et al. Convolutional neural networks with low-rank regularization. arXiv preprint arXiv:1511.06067, 2015.
225
+ Ganesh Venkatesh, Eriko Nurvitadhi, and Debbie Marr. Accelerating deep convolutional networks using low-precision and sparsity. arXiv preprint arXiv:1610.00324, 2016.
226
+ Chris S Wallace. Classification by minimum-message-length inference. In International Conference on Computing and Information, pp. 72–81. Springer, 1990.
227
+ 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.
228
+ Ian H Witten, Radford M Neal, and John G Cleary. Arithmetic coding for data compression. Communications of the ACM, 30(6):520–540, 1987.
229
+ Jiaxiang Wu, Cong Leng, Yuhang Wang, Qinghao Hu, and Jian Cheng. Quantized convolutional neural networks for mobile devices. arXiv preprint arXiv:1512.06473, 2015.
230
+ Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. arXiv preprint arXiv:1605.07146, 2016.
231
+
232
+ # APPENDIX
233
+
234
+ # A REVIEW OF STATE-OF-THE-ART NEURAL NETWORK COMPRESSION
235
+
236
+ We apply the compression scheme proposed by Han et al. (2015b;a) that highly optimizes the storage utilized by the weights. First of all, the authors store the weights in regular compressed sparse-row (CSR) format. Instead of storing $| W ^ { ( l ) } |$ parameters with a bit length of (commonly) $p _ { \mathrm { o r i g } } = 3 2 $ bit, CSR format stores three vectors (A, IR, IC).
237
+
238
+ • A stores all non-zero entries. It is thus of size $| W ^ { ( l ) } | _ { \neq 0 } \times p _ { \mathrm { o r i g } }$ , where $\vert W ^ { ( l ) } \vert _ { \neq 0 }$ is the number of non-zero entries in $W ^ { ( l ) }$ .
239
+ • IR Is defined recursively: $\mathrm { { I R } _ { 0 } ~ = ~ 0 }$ , $\mathrm { I R } _ { k } \ = \mathrm { I R } _ { k - 1 } +$ (number of non-zero entries in the $( k - 1 )$ -th row of $W ^ { ( l ) }$ ). It got $K + 1$ entries each of size $p _ { \mathrm { o r i g } }$ .
240
+ • IC contains the column index in $W ^ { ( l ) }$ of each element of A. The size is hence, $| W ^ { ( l ) } | _ { \neq 0 } \times$ $p _ { \mathrm { o r i g } }$ .
241
+
242
+ An example shall illustrate the format, let
243
+
244
+ $$
245
+ W ^ { ( l ) } = \left( \begin{array} { c c c c } { { 0 } } & { { 0 } } & { { 0 } } & { { 1 } } \\ { { 0 } } & { { 2 } } & { { 0 } } & { { 0 } } \\ { { 0 } } & { { 0 } } & { { 0 } } & { { 0 } } \\ { { 2 } } & { { 5 } } & { { 0 } } & { { 0 } } \\ { { 0 } } & { { 0 } } & { { 0 } } & { { 1 } } \end{array} \right)
246
+ $$
247
+
248
+ than
249
+
250
+ $$
251
+ \begin{array} { r } { \mathbf { A } = [ 1 , 2 , 2 , 5 , 1 ] } \\ { \mathbf { I R } = [ 0 , 1 , 2 , 2 , 4 , 5 ] } \\ { \mathbf { I C } = [ 3 , 1 , 0 , 1 , 3 ] } \end{array}
252
+ $$
253
+
254
+ The compression rate achieved by applying the CSC format naively is
255
+
256
+ $$
257
+ r _ { p } = \frac { | W ^ { ( l ) } | } { 2 | W ^ { ( l ) } | \neq 0 + ( K + 1 ) }
258
+ $$
259
+
260
+ However, this result can be significantly improved by optimizing each of the three arrays.
261
+
262
+ # A.1 STORING THE INDEX ARRAY IR
263
+
264
+ To optimize IR, note that the biggest number in IR is $\vert W ^ { ( l ) } \vert _ { \neq 0 }$ . This number will be much smaller than $2 ^ { p _ { \mathrm { o r i g } } }$ . Thus one could try to find $p \in \mathbf { Z } _ { + }$ such that $| W ^ { ( l ) } | _ { \neq 0 } < 2 ^ { p _ { \mathrm { p r u n } } }$ . A codebook would not be necessary. Thus instead of storing $( K + 1 )$ values with $p _ { \mathrm { o r i g } }$ , we store them with $p _ { \mathrm { p r u n } }$ depth.
265
+
266
+ # A.2 STORING THE INDEX ARRAY IC
267
+
268
+ Instead of storing the indexes, we store the differences between indexes. Thus there is a smaller range of values being used. We further shrink the range of utilized values by filling A with zeros whenever the distance between two non-zero weights extends the span of $2 _ { \mathrm { p r u n } } ^ { p ^ { \mathrm { - } } }$ . Han et al. (2015a) propose $\mathrm { p } = 5$ for fully connected layers and $\mathtt { p } = 8$ for convolutional layers. An illustration of the process can is shown in Fig. 4. Furthermore, the indexes will be compressed Hoffman encoding.
269
+
270
+ # A.3 STORING THE WEIGHT ARRAY A
271
+
272
+ In order to minimize the storage occupied by A. We quantize the values of A. Storing indexes in A and a consecutive codebook. Indexing can be improved further by again applying Huffman encoding.
273
+
274
+ ![](images/967d05c1ee545bf31e180b6cf4b3b53db00615e1a558cc6d8dbde06265e37d8f.jpg)
275
+ Figure 4: Illustration of the process described in A.2. IC is represented by relative indexes(diff). If the a relative index is larger than $8 ( = 2 ^ { \bar { 3 } } )$ , A will be filled with an additional zero. Figure from Han et al. (2015a).
276
+
277
+ # B CONFIGURING THE HYPER-PRIORS
278
+
279
+ # B.1 GAMMA DISTRIBUTION
280
+
281
+ The Gamma distribution is the conjugate prior for the precision of a univariate Gaussian distribution.
282
+ It is defined for positive random variables $\lambda > 0$ .
283
+
284
+ $$
285
+ \Gamma ( \lambda | \alpha , \beta ) = \frac { \beta ^ { \alpha } } { \Gamma ( \alpha ) } \lambda ^ { \alpha - 1 } e ^ { - \beta \lambda }
286
+ $$
287
+
288
+ For our purposes it is best characterised by its mode $\lambda ^ { * } = \frac { \alpha - 1 } { \beta }$ and its variance $\operatorname { v a r } _ { \gamma } = { \frac { \alpha } { \beta ^ { 2 } } }$ I n our experiments we set the desired variance of the mixture components to 0.05. This corresponds to $\lambda ^ { * } \stackrel { - } { = } 1 / ( 0 . 0 5 ) ^ { 2 } = 4 0 0$ . We show the effect of different choices for the variance of the Gamma distribution in Figure 5.
289
+
290
+ ![](images/2fedb28eefbd0883b40013cbd6042a6a9179fd6fe06521759b16e872c3976948.jpg)
291
+ Figure 5: Gamma distribution with $\lambda ^ { * } ~ = ~ 1 0 0$ . $\alpha$ and $\beta$ correspond to different choices for the variance of the distribution.
292
+
293
+ # B.2 BETA DISTRIBUTION
294
+
295
+ The Beta distribution is the conjugate prior for the Bernoulli distribution, thus is often used to represent the probability for a binary event. It is defined for some random variable $\pi _ { j = 0 } \in [ 0 , 1 ]$
296
+
297
+ $$
298
+ \mathcal { B } ( \pi _ { j = 0 } | \alpha , \beta ) = \frac { \Gamma ( \alpha + \beta ) } { \Gamma ( \alpha ) \Gamma ( \beta ) } ( \pi _ { j = 0 } ) ^ { \alpha - 1 } ( 1 - \pi _ { j = 0 } ) ^ { \beta - 1 }
299
+ $$
300
+
301
+ with $\alpha , \beta \ > \ 0$ . $\alpha$ and $\beta$ can be interpreted as the effective number of observations prior to an experiment, of $\pi _ { j = 0 } = 1$ and $\pi _ { j = 0 } = 0$ , respectively. In the literature, $\alpha + \beta$ is defined as the pseudo-count. The higher the pseudo-count the stronger the prior. In Figure 6, we show the Beta distribution at constant mode $\pi _ { j = 0 } ^ { * } = \frac { \alpha - 1 } { \alpha + \beta - 2 } = 0 . 9$ . Note, that, the beta distribution is a special case of the Dirichlet distribution in a different problem setting it might be better to rely on this distribution to control all $\pi _ { j }$ .
302
+
303
+ ![](images/fb22eba7ee7a7216b148cabc5af0ccbc7462a7dbb5d9204749c1581c7c945cfb.jpg)
304
+ Figure 6: Beta distribution with $\pi _ { j = 0 } ^ { * } = 0 . 9$ . $\alpha$ and $\beta$ correspond to different choices for the pseudocount.
305
+
306
+ # C SCALABILITY
307
+
308
+ Neural Networks are usually trained with a form of batch gradient decent (GD) algorithm. These methods fall into the umbrella of stochastic optimization (Robbins $\&$ Monro, 1951). Here the model parameters $\mathbf { W }$ are updated iteratively. At each iteration $t$ , a set of $B$ data instances is used to compute a noisy approximation of the posterior derivative with respect to $\mathbf { W }$ given all data instances $N$ .
309
+
310
+ $$
311
+ \nabla _ { \mathbf { W } } \log p ( \mathbf { W } | \mathcal { D } ) = \frac { N } { B } \sum _ { n = 1 } ^ { B } \nabla _ { \mathbf { W } } \log p ( \mathbf { t } _ { n } | \mathbf { x } _ { n } , \mathbf { w } ) + \sum _ { i = 1 } ^ { I } \nabla _ { \mathbf { W } } \log p ( w _ { i } )
312
+ $$
313
+
314
+ This gradient approximation can subsequently be used in various update schemes such as simple GD.
315
+
316
+ For large models estimating the prior gradient can be an expensive operation. This is why we propose to apply similar measures for the gradient estimation of the prior as we did for the likelihood term. To do so, we sample $\mathbf { K }$ weights randomly. The noisy approximation of the posterior derivative is
317
+
318
+ now:
319
+
320
+ $$
321
+ \nabla _ { \mathbf { W } } \log p ( \mathbf { W } | \mathcal { D } ) = \frac { N } { B } \sum _ { n = 1 } ^ { B } \nabla _ { \mathbf { w } } \log p ( \mathbf { t } _ { n } | \mathbf { x } _ { n } , \mathbf { w } ) + \frac { I } { K } \sum _ { i = 1 } ^ { K } \nabla _ { \mathbf { w } } \log p ( w _ { i } )
322
+ $$
323
+
324
+ # D FILTER VISUALISATION
325
+
326
+ In Figure D we show the pre-trained and compressed filters for the first and second layers of LeNet5-Caffe. For some of the feature maps from layer 2 seem to be redundant hence the almost empty columns. In Figure D we show the pre-trained and compressed filters for the first and second layers of LeNet-300-100.
327
+
328
+ ![](images/2d79616dc4994d71c20571be67f8d8cf0e2083ec9b4c242efabdf8774c606032.jpg)
329
+ Figure 7: Convolution filters from LeNet-5-Caffe. Left: Pre-trained filters. Right: Compressed filters. The top filters are the 20 first layer convolution weights; the bottom filters are the 20 by 50 convolution weights of the second layer.
330
+
331
+ ![](images/d76996240a46681f55f0e1b612c41b39ea04f303b875a74effbeff5ef9fd1f26.jpg)
332
+ Figure 8: Feature filters for LeNet-300-100. Left: Pre-trained filters. Right: Compressed filters.
333
+
334
+ ![](images/7ecb0ba3ec00310a1cdf97893c7d3ec5e1e886c75fb0891f197f03a357b0b852.jpg)
md/train/HJIoJWZCZ/HJIoJWZCZ.md ADDED
@@ -0,0 +1,342 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ADVERSARIAL DROPOUT REGULARIZATION
2
+
3
+ Kuniaki Saito1, Yoshitaka Ushiku1, Tatsuya Harada1,2, and Kate Saenko3
4
+
5
+ 1The University of Tokyo, 2RIKEN, 3Boston University {k-saito,ushiku,harada}@mi.t.u-tokyo.ac.jp, saenko@bu.edu
6
+
7
+ # ABSTRACT
8
+
9
+ We present a domain adaptation method for transferring neural representations from label-rich source domains to unlabeled target domains. Recent adversarial methods proposed for this task learn to align features across domains by “fooling” a special domain classifier network. However, a drawback of this approach is that the domain classifier simply labels the generated features as in-domain or not, without considering the boundaries between classes. This means that ambiguous target features can be generated near class boundaries, reducing target classification accuracy. We propose a novel approach, Adversarial Dropout Regularization (ADR), which encourages the generator to output more discriminative features for the target domain. Our key idea is to replace the traditional domain critic with a critic that detects non-discriminative features by using dropout on the classifier network. The generator then learns to avoid these areas of the feature space and thus creates better features. We apply our ADR approach to the problem of unsupervised domain adaptation for image classification and semantic segmentation tasks, and demonstrate significant improvements over the state of the art.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Transferring knowledge learned by deep neural networks from label-rich domains to new target domains is a challenging problem, especially when the source and target input distributions have different characteristics. Such domain shifts occurs in many practical applications. For example, while simulated driving images rendered by games provide a rich source of labeled data for semantic segmentation Richter et al. (2016), deep models trained on such source data do not transfer well to real target domains (Fig. 1(a-d)). When target-domain labels are unavailable for fine-tuning, unsupervised domain adaptation must be applied to improve the source model.
14
+
15
+ Recent methods for unsupervised domain adaptation attempt to reduce the discrepancy between the source and target features via adversarial learning (Tzeng et al. (2014); Ganin $\&$ Lempitsky (2014)). They divide the base network into a feature encoder $G$ and classifier $C$ , and add a separate domain classifier (critic) network $D$ . The critic takes the features generated by $G$ and labels them as either source- or target-domain. The encoder $G$ is then trained with an additional adversarial loss that maximizes $D$ ’s mistakes and thus aligns features across domains.
16
+
17
+ However, a major drawback of this approach is that the critic simply predicts the domain label of the generated point and does not consider category information. Thus the generator may create features that look like they came from the right domain, but are not discriminative. In particular, it can generate points close to class boundaries, as shown in Fig. 1(e), which are likely to be misclassified by the source model. We argue that to achieve good performance on the target data, the adaptation model must take the decision boundaries between classes into account while aligning features across domains (Fig. 1(f)). Moreover, since our setting is unsupervised adaptation, this must be accomplished without labels on target data.
18
+
19
+ In this paper, we propose a novel adversarial alignment technique that overcomes the above limitation and preserves class boundaries. We make the following observation: if the critic could detect points near the decision boundary, then the generator would have to avoid these areas of the feature space in order to fool the critic. Thus the critic would force the generator to create more discriminative features. How can we obtain such a critic? If we alter the boundary of the classifier $C$ slightly and measure the change in the posterior class probability $p ( y | x )$ , where $y$ and $x$ denote class and input respectively, then samples near the decision boundary are likely to have the largest change. In fact, this posterior discrepancy is inversely proportional to the distance from the class boundary. We thus propose to maximize this posterior discrepancy to turn $C$ into a critic sensitive to nondiscriminative points. We call this technique Adversarial Dropout Regularization. Here, dropout is not used in the standard way, which is to regularize the main classifier and make it insensitive to noise. Instead, we use dropout in an adversarial way, to transform the classifier into a critic sensitive to noise. Compared to previous adversarial feature alignment methods, where the distributions $p ( x )$ are aligned globally, our method aligns target features away from decision boundaries, as illustrated in Fig.1(f).
20
+
21
+ ![](images/b6f4ca41441b05f1a91aeb791d5664cfbced0e867e90f0899d66085405d66cc1.jpg)
22
+ Figure 1: (a-d) An illustration of a deep model trained on simulated source training data failing to segment a real target domain image: (a) shows the target image, (b) is the ground truth segmentation into semantic categories (car, road, etc), (c) is the output of the unadapted source model, (d) is the improved segmentation obtained by our proposed ADR method. (e) Previous distribution matching methods do not consider the source decision boundary when aligning source and target feature points. (f) We propose to use the boundary information to achieve low-density separation of aligned points.
23
+
24
+ Our ADR approach has several benefits. First, we train the generator $G$ with feedback from the classifier $C$ , in contrast to existing methods, which use an unrelated critic $D$ . Second, our method is general and straightforward to apply to a variety of domain adaptation problems, such as classification and semantic segmentation. Finally, since ADR is trained to align distributions, it is also applicable to semi-supervised learning and training of generative models, such as Generative Adversarial Networks (GANs) (Goodfellow et al. (2014a)). Through extensive experiments, we demonstrate the benefit of ADR over existing domain adaptation approaches, achieving state-of-the-art results in difficult domain shifts. We also show an application to semi-supervised learning using GANs in appendix.
25
+
26
+ # 2 RELATED WORK
27
+
28
+ Domain Adaptation. Recent unsupervised domain adaptation (UDA) methods for visual data aim to align the feature distributions of the source and target domains (Sun et al. (2016); Sun & Saenko (2016); Tzeng et al. (2014); Ganin et al. (2016); Long et al. (2015b); Yan et al. (2017); Long et al. (2017)). Such methods are motivated by theoretical results stating that minimizing the divergence between domains will lower the upper bound of the error on target domain (Ben-David et al. (2010)). Many works in deep learning utilize the technique of distribution matching in hidden layers of a network such as a CNN (Tzeng et al. (2014); Ganin et al. (2016); Long et al. (2015b)). However, they measure the domain divergence based on the hidden features of the network without considering the relationship between its decision boundary and the target features, as we do in this paper.
29
+
30
+ Low-density Separation. Many semi-supervised learning (SSL) methods utilize the relationship between the decision boundary and unlabeled samples, a technique called low-density separation (Chapelle & Zien (2005); Joachims (1999)). By placing the boundary in the area where the unlabeled samples are sparse, these models aim to obtain discriminative representations. Our method aims to achieve low-density separation for deep domain adaptation and is related to entropy minimization for semi-supervised learning (Grandvalet & Bengio (2005)). (Long et al. (2016)) used entropy minimization in their approach to directly measure how far samples are from a decision boundary by calculating entropy of the classifier’s output. On the other hand, our method tries to achieve low-density separation by slightly moving the boundary and detecting target samples sensitive to the movement. As long as target samples features are robust to the movement, they will be allowed to exist relatively nearby the boundary compared to source samples, as Fig. 1 shows.
31
+
32
+ In (Long et al. (2016)) entropy minimization is only a part of the overall approach. To compare our ADR approach to entropy minimization more directly, we use a new baseline method. To our knowledge, though this method has not been proposed by any previous work, it is easily achieved by modifying a method proposed by (Springenberg (2015)). For this baseline, we train a model that generates features to minimize the entropy of the output probability for target samples. The details of the baseline are provided in appendix. In short, the generator tries to minimize the entropy of the target samples, whereas the critic tries to maximize it. The entropy is directly measured by the output of the classifier. This baseline is similar to our approach in that the goal of the method is to achieve low-density separation.
33
+
34
+ Dropout. Dropout is a method that prevents deep networks from overfitting (Srivastava et al. (2014)) by randomly dropping units from the neural network during training. Effectively, dropout samples from an exponential number of different thinned networks at training time, which prevents units from co-adapting too much. At test time, predictions are obtained by using the outputs of all neurons. If the thinned networks are able to classify the samples accurately, the full network will as well. In other words, dropout encourages the network to be robust to noise. In our work, we use dropout to regularize the feature generation network $G$ , but in an adversarial way. We train the critic $C$ to be sensitive to the noise caused by dropout and use $C$ to regularize $G$ so that it generates noise-robust features. To our knowledge, this use of dropout is completely different from existing methods.
35
+
36
+ # 3 METHOD
37
+
38
+ We assume that we have access to a labeled source image $\mathbf { x _ { s } }$ and a corresponding label $y _ { s }$ drawn from a set of labeled source images $\{ X _ { s } , Y _ { s } \}$ , as well as an unlabeled target image $\mathbf { x _ { t } }$ drawn from unlabeled target images $X _ { t }$ . We train a feature generation network $G$ , which takes inputs $\mathbf { x _ { s } }$ or $\mathbf { x _ { t } }$ , and a network $C$ that acts as both the main classifier and the critic. When acting as the classifier, $C$ takes features from $G$ and classifies them into $K$ classes, predicting a $K$ -dimensional vector of logits $\{ l _ { 1 } , l _ { 2 } , l _ { 3 } . . . l _ { K } \}$ . The logits are then converted to class probabilities by applying the softmax function. Namely, the probability that $\mathbf { x }$ is classified into class $j$ is denoted by $\begin{array} { r } { p ( y = j | \mathbf { x } ) = \frac { e x p ( l _ { j } ) } { \sum _ { k = 1 } ^ { K } e x p ( l _ { k } ) } } \end{array}$ . We use the notation $p ( \mathbf { y } \vert \mathbf { x } )$ to denote the $K$ -dimensional probabilistic output for input $\mathbf { x }$ .
39
+
40
+ When $C$ is acting as the critic, we want it to detect the feature encodings of target samples near the decision boundary. We propose to make $C$ sensitive to such samples by slightly perturbing its decision boundary and measuring the change in the posterior class probability $p ( \mathbf { y } \vert \mathbf { x } )$ . This change is likely to be largest for samples near the decision boundary. The network $C$ is then trained to increase this change, while the feature generation network $G$ is trained to decrease it. Through this adversarial training, $G$ learns to ‘fool’ the critic and generate target features far away from the decision boundary, thus avoiding ambiguous features. The weights of $G$ can be initialized either by pre-training on some auxiliary dataset (e.g., ImageNet), or with random weights, while $C$ uses random initialization. In the next section, we show how we utilize dropout to perturb the boundary in the critic and measure sensitivity. We then show the training procedure of our method. Finally, we give some intuition behind adversarial dropout and improve our method based on this insight.
41
+
42
+ # 3.1 CLASSIFIER SELECTION VIA DROPOUT
43
+
44
+ Consider the standard training of a neural network using dropout. For every sample within a minibatch, each node of the network is removed with some probability, effectively selecting a different classifier for every sample during training. We harness this idea in a very simple way.
45
+
46
+ We forward input features $G ( \bf x _ { t } )$ to $C$ twice, dropping different nodes each time and obtaining two different output vectors denoted as $C _ { 1 } ( G ( \mathbf { x _ { t } } ) )$ , $\bar { C } _ { 2 } \bar { ( \cal G ( x _ { t } ) ) }$ . In other words, we are selecting two different classifiers $C _ { 1 }$ and $C _ { 2 }$ from $C$ by dropout as in Fig. 2. In the figure, the corresponding posterior probabilities are indicated as $p _ { 1 } ( \mathbf { y } | \mathbf { x _ { t } } )$ , $p _ { 2 } ( \mathbf { y } \vert \mathbf { x _ { t } } )$ , abbreviated as $p _ { 1 }$ and $p _ { 2 }$ in the following discussion. In order to detect the change of predictions near the boundary, the critic tries to increase the difference between the predictions of $C _ { 1 }$ and $C _ { 2 }$ . This difference corresponds to $C$ ’s sensitivity to the noise caused by dropout.
47
+
48
+ To measure the sensitivity $d ( p _ { 1 } , p _ { 2 } )$ between the two obtained probabilistic outputs, we use the symmetric Kullback Leibler (KL) divergence. Formally, the divergence is calculated as
49
+
50
+ $$
51
+ d ( p _ { 1 } , p _ { 2 } ) = { \frac { 1 } { 2 } } ( D _ { k l } ( p _ { 1 } | p _ { 2 } ) + D _ { k l } ( p _ { 2 } | p _ { 1 } ) )
52
+ $$
53
+
54
+ ![](images/5b7992174e2f2c0d5a92732e1d6cc79162abd221b22a4267b1f8758b2b378f90.jpg)
55
+ Figure 2: Overview of ADR. Left: We train $G$ , $C$ with classification loss on source and sample a critic consisting of two classifiers using dropout. The critic’s sensitivity is measured as the divergence between the class predictions of $C _ { 1 }$ and $C _ { 2 }$ on the same input. Right: Adversarial training iterates two steps: the critic tries to maximize the sensitivity while the generator tries to minimize it.
56
+
57
+ where KL divergence between $p$ and $q$ is denoted as $D _ { k l } ( p | q )$ .
58
+
59
+ # 3.2 TRAINING PROCEDURE
60
+
61
+ In our approach, $C$ works as both critic and classifier. The following three requirements are imposed by our method: 1) $C$ and $G$ must classify source samples correctly to obtain discriminative features; 2) $C$ should maximize the sensitivity for target samples to detect the samples near the boundary; 3) $G$ should learn to minimize the sensitivity to move target samples away from the boundary.
62
+
63
+ The training within the same mini-batch consists of the following three steps.
64
+
65
+ Step 1, in this step, $C$ is trained as a classifier. $C$ and $G$ have to classify source samples correctly to obtain discriminative features. Thus, we update both networks’ parameters based on the following standard classification loss. Given source labels $y _ { s }$ and samples $\mathbf { x _ { s } }$ , the objective in this step is
66
+
67
+ $$
68
+ \underset { G , C } { \operatorname* { m i n } } L ( X _ { s } , Y _ { s } ) = - \mathbb { E } _ { ( \mathbf { x } _ { s } , y _ { s } ) \sim ( X _ { s } , Y _ { s } ) } \sum _ { k = 1 } ^ { K } \mathbb { 1 } _ { [ k = y _ { s } ] } \log C ( G ( \mathbf { x } _ { \mathbf { s } } ) ) _ { k }
69
+ $$
70
+
71
+ $C ( G ( \mathbf { x _ { s } } ) ) _ { k }$ returns the probability that the sample $\mathbf { x _ { s } }$ is assigned to class $k$
72
+
73
+ Step 2, in this step, $C$ is trained as a critic to detect target samples near the boundary. Two classifiers are sampled from $C$ for each target sample using dropout twice to obtain $p _ { 1 }$ and $p _ { 2 }$ . Then, $C$ ’s parameters are updated to maximize the sensitivity as measured by Eq. 1. Since $C$ should learn discriminative features for source samples, in addition to the sensitivity term, we add Eq. 2. We experimentally confirmed that this term is essential to obtain good performance.
74
+
75
+ $$
76
+ \operatorname* { m i n } _ { C } L ( X _ { s } , Y _ { s } ) - L _ { a d v } ( X _ { t } )
77
+ $$
78
+
79
+ $$
80
+ L _ { a d v } ( X _ { t } ) = \mathbb { E } _ { \mathbf { x _ { t } } \sim X _ { t } } [ d ( C _ { 1 } ( G ( \mathbf { x _ { t } } ) ) , C _ { 2 } ( G ( \mathbf { x _ { t } } ) ) ) ]
81
+ $$
82
+
83
+ $C _ { 1 }$ and $C _ { 2 }$ are sampled from $C$ randomly.
84
+
85
+ Step 3, in order to obtain representations where target samples are placed far from the decision boundary, $G$ is trained to minimize sensitivity. Here we do not add the categorical loss for source samples as in Step 2, as the generator is able to obtain discriminative features without it.
86
+
87
+ $$
88
+ \operatorname* { m i n } _ { G } L _ { a d v } ( X _ { t } )
89
+ $$
90
+
91
+ We update the parameters of $C$ and $G$ in every step following the defined objectives. We experimentally found it beneficial to repeat Step 3 $n$ times for each mini-batch.
92
+
93
+ ![](images/e236a8f1f63678aa39e6008db6475416d17c9cf2b19a9b860caab2ab1b9a4cd9.jpg)
94
+ Figure 3: (Best viewed in color) Toy Experiment. Top row: Model trained without adaptation. Columns 1-5 show the decision boundary obtained by keeping one neuron in the last hidden layer and removing the rest. Red points are source samples of class one, green points are class two. Black points are target samples. The yellow region indicates where the samples are classified as class one, cyan region class two. We see that the neurons do not learn very diverse features. Column 6 shows the boundary obtained by keeping all 5 neurons. Bottom row: Boundaries learned by the model adapted by our adversarial dropout method. Unlike the top row, here neurons 3,4,5 learn diverse features which result in diverse boundaries.
95
+
96
+ # 3.3 INSIGHT AND IMPROVEMENT
97
+
98
+ Our ADR approach encourages different neurons of the classifier to learn different characteristics of the input (see Sec. 4.1.) The output is the combination of shared and unshared nodes, therefore, to maximize the sensitivity, the unshared nodes must learn different features of target samples. As learning proceeds, each neuron in $C$ will capture different characteristics. At the same time, to minimize the sensitivity, $G$ learns to extract pure categorical information. If $G$ outputs features which are not related to categorical information, such as texture, slight contrast or difference of color, $C$ will utilize them to maximize sensitivity.
99
+
100
+ The trained classifier will be sensitive to the perturbation of targets caused by dropout. We note that our approach is contrary to methods called adversarial example training (Goodfellow et al. (2014b); Miyato et al. (2016)) which train the classifier to be robust to adversarial examples. They utilize input noise which can deceive or change the output of the classifier, and incorporate it to obtain a good classifier. Our ADR method encourages the feature generator to obtain noise-robust target features. However, with regard to the classifier, it is trained to be sensitive to noise. To improve the final accuracy, we learn another classifier $C ^ { \prime }$ that is not trained to be sensitive to the noise. $C ^ { \prime }$ takes features generated by $G$ and is trained with classification loss on source samples. The loss of $C ^ { \prime }$ is not used to update $G$ . We compare the accuracy of $C$ and $C ^ { \prime }$ in experiments on image classification.
101
+
102
+ # 4 EXPERIMENTS
103
+
104
+ # 4.1 EXPERIMENT ON TOY DATA
105
+
106
+ Experimental Setting. In this experiment, we observe the decision boundary obtained by each neuron to demonstrate that ADR encourages the neurons to learn different input characteristics. We use synthetic “two moons” data for this problem. Two dimensional samples from two classes are generated as source samples. Target samples are obtained by rotating the source samples. In our setting, the rotation was set to 30 degrees and data was generated with scikit-learn (Pedregosa et al. (2011)). We train a six-layered fully-connected network; the lower 3 layers are used as feature generator, and upper 3 layers are used as classifier. We used Batch Normalization (Ioffe & Szegedy (2015)) and ReLU as activation function. The number of neurons are [2,5,5] for feature generator, [5,5,2] for classifier. We visualize the boundary obtained from each neuron in the last layer by removing the output of all other neurons.
107
+
108
+ Results. We show the learned boundary in Fig. 3. In the baseline model trained only with source samples (top row), two of five neurons do not seem to learn an effective boundary, and three neurons learn a similar boundary. On the other hand, in our method (bottom row), although two neurons do not seem to learn any meaningful boundary, three neurons learn distinctive boundaries, demonstrating greater diversity. Each neuron is trained to be sensitive to the noise caused by target samples. The final decision boundary (rightmost column) classifies most target samples correctly. The accuracy of our proposed method is $96 \%$ whereas the accuracy of the non-adapted model was $84 \%$ .
109
+
110
+ ![](images/739f2d31aa495e5a9d6c4fd7b45d22559c2abb1868aa853612bc7403b34eaae2.jpg)
111
+ Figure 4: Relationship between sensitivity loss on target (blue line), on source (yellow line), and accuracy (red: accuracy of $C ^ { \prime }$ , green: accuracy of $C$ ) during training on digits.
112
+
113
+ # 4.2 UNSUPERVISED DOMAIN ADAPTATION FOR CLASSIFICATION
114
+
115
+ Experiments on Digits Classification. We evaluate our model on adaptation between digits datasets. We use MNIST (LeCun et al. (1998)), SVHN (Netzer et al. (2011)) and USPS datasets and follow the protocol of unsupervised domain adaptation used by (Tzeng et al. (2017)). To extensively compare our method with previous methods, in adaptation from MNIST to USPS, we applied our method to a different protocol used in Bousmalis et al. (2017). We assume no labeled target samples and use fixed hyper-parameters for all experiments, unlike other works that use a target validation set (Saito et al. (2017)). The number of iterations for Step 3 was fixed at $n = 4$ . We used the same network architecture as in (Tzeng et al. (2017)), but inserted a Batch Normalization layer before the activation layer to stabilize the training. We used Adam (Kingma & Ba (2014)) for optimizer and set the learning rate to $2 . 0 \times 1 0 ^ { - 4 }$ , a value commonly reported in the GAN literature. We compare our approach to several existing methods and to the entropy minimization baseline (ENT) obtained by modifying (Springenberg (2015)). As we mentioned in Section 2, this is a model that generates features to minimize the entropy of the output probability for target samples. Due to space limitations, we provide a detailed explanation of this baseline in the appendix.
116
+
117
+ Results in Table 1 demonstrate that ADR obtains better performance than existing methods. In particular, on the challenging adaptation task from SVHN to MNIST, our method achieves much better accuracy than previously reported. Fig. 4 shows the learning curve of each experiment. As sensitivity loss increases, the target accuracy improves. This means that as critic $C$ learns to detect the non-discriminative samples, feature generator $G$ learns to fool it, resulting in improved accuracy. In addition, we can see that the sensitivity of source samples increases too. As mentioned in Sec 3.3, the critic network should learn to capture features which are not very important for classification, such as texture or slight edges, and it seems to also capture such information in source samples. The accuracy of the classifier $C ^ { \prime }$ (denoted by red), which is trained not to be sensitive to the noise, is almost always better than the accuracy of the critic network. In adaptation from SVHN to MNIST (Fig. 5(c)), the accuracy of the critic often suffers as it becomes too sensitive to the noise caused by dropout. On the other hand, the accuracy shown by the red line is stable. Our ENT baseline shows good performance compared to other existing methods. This result indicates the effectiveness of methods based on entropy minimization. In Fig. 5, we compare our proposed method and ENT in terms of entropy of target samples. Our method clearly decreases the entropy, because target samples are moved away from the decision boundary. Yet, its behavior is different from ENT. Interestingly, the entropy is made smaller than ENT in case of adaptation from USPS to MNIST (Fig. 4(a)) though ENT directly minimizes the entropy and our method does not. On the SVHN to MNIST task (Fig. 4(c)), the entropy of ADR is larger than ENT, which indicates that our method places the target samples closer to the decision boundary than ENT does.
118
+
119
+ Experiments on Object Classification. We next evaluate our method on fine-tuning a pretrained CNN. We use a new domain adaptation benchmark called the VisDA Challenge (Peng et al. (2017)) which focuses on the challenging task of adapting from synthetic to real images. The source domain consists of 152,409 synthetic 2D images from 12 object classes rendered from 3D models. The validation and test target domains consists of real images, which belong to the same classes. We used the validation domain (55,400 images) as our target domain in an unsupervised domain adaptation setting.
120
+
121
+ ![](images/177e15de1ac8fd6d27b034896b5372cb923b428390b94b1a14d9cc289b6a1b4f.jpg)
122
+ Figure 5: Comparison of entropy of ours (blue line) with ENT (yellow line). The entropy is calculated on target samples by using the output of the classifier.
123
+
124
+ Table 1: Results on digits datasets. Please note that $^ \dagger$ means the result obtained using a few labeled target samples for validation. The reported accuracy of our method is obtained from $C ^ { \prime }$ . ENT is our proposed entropy minimization baseline, described in the appendix. MNIST(P1) and MNIST(P2) indicate different experimental settings used in Tzeng et al. (2017) and Bousmalis et al. (2017) respectively.
125
+
126
+ <table><tr><td>METHOD</td><td>SVHN to MNIST</td><td>USPS to MNIST</td><td>MNIST(P1) to USPS</td><td>MNIST(P2) to USPS</td></tr><tr><td>Source Only</td><td>67.1</td><td>68.1</td><td>77.0</td><td>78.9</td></tr><tr><td>LTN (Sener et al. (2016))</td><td>78.8</td><td>-</td><td>1</td><td>-</td></tr><tr><td>ATDA (Saito et al. (2017))</td><td>86.2†</td><td>=</td><td>1</td><td>-</td></tr><tr><td>DSN (Bousmalis et al. (2016))</td><td>82.7†</td><td></td><td></td><td>91.3†</td></tr><tr><td>PixelDA (Bousmalis et al. (2017)</td><td>1</td><td>=</td><td>-</td><td>95.9†</td></tr><tr><td>DANN (Ganin &amp; Lempitsky (2014))</td><td>73.9</td><td>73.0±2.0</td><td>77.1±1.8</td><td>85.1†</td></tr><tr><td>DoC (Tzeng et al. (2014))</td><td>68.1±0.3</td><td>66.5±3.3</td><td>79.1±0.5</td><td>1</td></tr><tr><td>ADDA (Tzeng et al. (2017))</td><td>76.0±1.8</td><td>90.1±0.8</td><td>89.4±0.2</td><td>-</td></tr><tr><td>CoGAN (Liu &amp; Tuzel (2016))</td><td>did not converge</td><td>89.1±0.8</td><td>91.2±0.8</td><td>=</td></tr><tr><td>DTN (Taigman et al. (2016))</td><td>84.7</td><td>1</td><td>-</td><td></td></tr><tr><td>ENT (Our proposed baseline) Ours</td><td>94.9±4.11 95.0±1.87</td><td>91.2±1.92 93.1±1.27</td><td>93.7±0.54 93.2±2.46</td><td>96.7±1.27 96.1±0.29</td></tr></table>
127
+
128
+ We evaluate our model on fine-tuning networks pretrained on ImageNet (Deng et al. (2009)): ResNet101 (He et al. (2016)) and ResNext (Xie et al. (2016)). For the feature generator, we use the pretrained CNN after removing the top fully connected layer. For the classification network, we use a three-layered fully connected network.
129
+
130
+ Table 2 shows that our method outperformed other distribution matching methods and our new baseline (ENT) in finetuning both networks by a large margin. ENT did not achieve better performance than existing methods, though improvement over the source only model was observed. Although this method performed well on digits, it does not work as well here, possibly because of the larger shift between very different domains. In the experiment on ResNext, after training $G$ and $C$ , we retrained a classifier $C ^ { ' }$ just on the features generated by $G$ due to GPU memory limitations, and observed improvement in both networks.
131
+
132
+ Fig. 6 visualizes the target features obtained by $G$ with the pretrained model, model fine-tuned on source, and our ADR method. While the embedding of the source only model does not separate classes well due to domain shift, we can see clearly improved separation with ADR.
133
+
134
+ Image Segmentation experiments. Next, we apply our method to adaptation for semantic image segmentation. Image segmentation is different from classification in that we classify each pixel in the image. To evaluate the performance on segmentation, the synthetic GTA5 (Richter et al. (2016)) dataset is used as source, and real CityScape (Cordts et al. (2016)) dataset is used as target. Previous work tackled this problem by matching distributions of each pixel’s feature in a middle layer of the network (Hoffman et al. (2016)). In this work, we apply ADR by calculating sensitivity between all pixels. The training procedure is exactly the same as in classification experiments.
135
+
136
+ We use the ResNet50 pretrained on ImageNet, and utilize an FCN (Long et al. (2015a)) based network architecture. Further, we utilize the more recent Dilated Residual Networks (DRN) 105 layered model (Yu et al. (2017)), which outperforms ResNet50 on a semantic segmentation task.
137
+
138
+ Table 2: Results on Visda2017 classification datasets (Peng et al. (2017)). DANN and MMD are distribution alignment methods proposed by (Ganin & Lempitsky (2014)) and (Long et al. (2015b)) respectively. Ours (retrain classifier) means the classifier retrained for our proposed generator as we mentioned in Sec 3.3. Our proposed method shows much better performance than existing methods.
139
+
140
+ <table><tr><td>Method</td><td>grrrdorae</td><td>gpaleie </td><td>3u</td><td>eoor</td><td></td><td>morreilt</td><td>uosiad</td><td></td><td>sareraert</td><td></td><td>r</td><td>naaa</td></tr><tr><td>Finetuning on ResNet101</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Source Only</td><td>55.1</td><td>53.3 61.9</td><td>59.1</td><td>80.6</td><td>17.9</td><td>79.7</td><td>31.2</td><td>81.0</td><td>26.5</td><td>73.5</td><td>8.5</td><td>52.4</td></tr><tr><td>MMD</td><td>87.1</td><td>63.0 76.5</td><td>42.0</td><td>90.3</td><td>42.9</td><td>85.9</td><td>53.1</td><td>49.7</td><td>36.3</td><td>85.8</td><td>20.7</td><td>61.1</td></tr><tr><td>DANN</td><td>81.9</td><td>77.7 82.8</td><td>44.3</td><td>81.2</td><td>29.5</td><td>65.1</td><td>28.6</td><td>51.9</td><td>54.6</td><td>82.8</td><td>7.8</td><td>57.4</td></tr><tr><td>ENT</td><td>80.3</td><td>75.5 75.8</td><td>48.3</td><td>77.9</td><td>27.3</td><td>69.7</td><td>40.2</td><td>46.5</td><td>46.6</td><td>79.3</td><td>16.0</td><td>57.0</td></tr><tr><td>Ours</td><td>94.1</td><td>51.3 83.2</td><td>72.2</td><td>88.7</td><td>68.8</td><td>92.8</td><td>70.2</td><td>77.2</td><td>63.6</td><td>82.9</td><td>30.3</td><td>72.9</td></tr><tr><td>Ours (retrained classifier)</td><td>94.2</td><td>48.5 84.0</td><td>72.9</td><td>90.1</td><td>74.2</td><td>92.6</td><td>72.5</td><td>80.8</td><td>61.8</td><td>82.2</td><td>28.8</td><td>73.5</td></tr><tr><td>Finetuning on ResNeXt</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Source Only</td><td></td><td>74.3 37.6 61.8 68.2 59.5</td><td></td><td></td><td></td><td></td><td>10.7 81.412.8 61.6 26.070.0</td><td></td><td></td><td></td><td>5.6</td><td>47.4</td></tr><tr><td>MMD</td><td>90.7</td><td>51.1 64.8</td><td>65.6</td><td>89.9</td><td>46.5</td><td>91.9</td><td>40.1</td><td>81.5</td><td>24.1</td><td>90.0</td><td>28.5</td><td>63.7</td></tr><tr><td>DANN</td><td>86.0</td><td>66.3 60.8 56.0</td><td></td><td>79.8</td><td>53.7</td><td>82.3</td><td>25.2</td><td>58.2</td><td>31.0</td><td>89.3</td><td>26.1</td><td>59.6</td></tr><tr><td>ENT</td><td>94.7</td><td>81.0 57.0</td><td>46.6</td><td>73.9</td><td>49.0</td><td>69.2</td><td>31.0</td><td>40.5</td><td>34.3</td><td>87.3</td><td>15.1</td><td>56.6</td></tr><tr><td>Ours</td><td>86.3 71.9</td><td>87.6</td><td>78.1</td><td>93.0</td><td>84.8</td><td>94.5</td><td>78.9</td><td>91.8</td><td>58.9</td><td>77.7</td><td>26.7</td><td>77.5</td></tr><tr><td>Ours (retrained classifier)</td><td>89.2</td><td>70.9 85.7</td><td>82.0</td><td>93.7</td><td></td><td>86.7 93.3</td><td>72.3</td><td>89.5</td><td>53.0</td><td>86.7</td><td>28.3</td><td>77.6</td></tr></table>
141
+
142
+ ![](images/f85e9efe625959ba93fdcfd4024851f548acbeebd038701c1fb299173a9f68e4.jpg)
143
+ Figure 6: Visualization of VisDA-classification (12 classes) target features using T-SNE (Maaten & Hinton (2008)): (a) features obtained by the Imagenet-pretrained ResNext model not finetuned on VisDA; (b) features from the ResNext model fine-tuned only on VisDA source samples without any adaptation; (c) features obtained by ResNext adapted by our ADR method.
144
+
145
+ For the feature generator, we use the pretrained network without fully-connected layers. For the classifier, we use a fully-convolutional network with dropout layers. Due to limited memory, the batch size is set to 1. We include details of the network architecture in appendix. For comparison, we train a domain classifier based model for our network (DANN). We build a domain classifier network for the features of each pixel following (Hoffman et al. (2016)).
146
+
147
+ In Table 3, we show the qualitative comparison with existing methods. ADR clearly improves mean IoU (Intersection-over-Union) compared to the source-only and competing models, beating state-ofthe-art by a large margin. When we apply ADR to DRN, the accuracy improves much more than for ResNet50, and is 12.4 points higher than the model trained only on GTA5 source samples. This is likely because ADR exploits the strong representation of the pretrained DRN network. Although we implemented ENT in this setting, the accuracy was much worse than the Source Only model with a mIoU of 15.0 in training ResNet50. The ENT method does not seem to work well on syntheticto-real shifts. Finally, we illustrate our method’s improvement on example input images, ground truth labels, images segmented by the Source Only model and our method in Fig. 7. While the Source Only model seems to suffer from domain shift, ADR generates a clean segmentation. These experiments demonstrate the effectiveness of ADR on semantic segmentation.
148
+
149
+ # 5 CONCLUSION
150
+
151
+ In this paper, we introduced a novel approach for aligning deep representation, Adversarial Dropout Regularization, which learns to generate discriminative features for the target domain. The method consists of a critic network that can detect samples near the task decision boundary and a feature generator that fools the critic. Our approach is general, applies to a variety of tasks, and does not require target domain labels. In extensive domain adaptation experiments, our method outperformed baseline methods, including entropy minimization, and achieved state-of-the-art results on three datasets.
152
+
153
+ <table><tr><td rowspan=1 colspan=1>Network</td><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>xeeepre</td><td rowspan=1 colspan=1>Buiplng</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>8</td><td rowspan=1 colspan=1>irilen</td><td rowspan=1 colspan=1>买</td><td rowspan=1 colspan=1>uosrad</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Mu</td><td rowspan=1 colspan=1>r0</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>mrrqee</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>mIoU</td></tr><tr><td rowspan=1 colspan=1>VGG-16</td><td rowspan=1 colspan=1>FCN Wild</td><td rowspan=1 colspan=1>70.4</td><td rowspan=1 colspan=1>32.4</td><td rowspan=1 colspan=1>62.1</td><td rowspan=1 colspan=1>14.9</td><td rowspan=1 colspan=1>5.4</td><td rowspan=1 colspan=1>10.9</td><td rowspan=1 colspan=1>14.2</td><td rowspan=1 colspan=1>2.7</td><td rowspan=1 colspan=1>79.2</td><td rowspan=1 colspan=1>21.3</td><td rowspan=1 colspan=1>64.6</td><td rowspan=1 colspan=1>44.1</td><td rowspan=1 colspan=1>4.2</td><td rowspan=1 colspan=1>70.4</td><td rowspan=1 colspan=1>8.0</td><td rowspan=1 colspan=1>7.3</td><td rowspan=1 colspan=1>0.0</td><td rowspan=1 colspan=1>3.5</td><td rowspan=1 colspan=1>0.0</td><td rowspan=1 colspan=1>27.1</td></tr><tr><td rowspan=2 colspan=1>ResNet50</td><td rowspan=2 colspan=1>Source OnlyDANNOurs</td><td rowspan=2 colspan=1>64.572.487.8</td><td rowspan=2 colspan=1>24.919.115.6</td><td rowspan=1 colspan=1>73.7</td><td rowspan=2 colspan=1>14.83.920.6</td><td rowspan=2 colspan=1>2.59.39.7</td><td rowspan=2 colspan=1>18.017.319.0</td><td rowspan=2 colspan=1>15.913.119.9</td><td rowspan=2 colspan=1>0.05.57.7</td><td rowspan=1 colspan=1>74.9</td><td rowspan=1 colspan=1>16.4</td><td rowspan=1 colspan=1>72.0</td><td rowspan=1 colspan=1>42.3</td><td rowspan=1 colspan=1>0.0</td><td rowspan=1 colspan=1>39.5</td><td rowspan=2 colspan=1>8.612.117.5</td><td rowspan=2 colspan=1>13.49.927.7</td><td rowspan=2 colspan=1>0.00.01.8</td><td rowspan=2 colspan=1>0.05.89.7</td><td rowspan=2 colspan=1>0.00.00.0</td><td rowspan=2 colspan=1>25.326.433.3</td></tr><tr><td rowspan=1 colspan=1>73.077.4</td><td rowspan=1 colspan=1>71.082.0</td><td rowspan=1 colspan=1>20.131.5</td><td rowspan=1 colspan=1>62.274.3</td><td rowspan=1 colspan=1>32.643.5</td><td rowspan=1 colspan=1>5.29.0</td><td rowspan=1 colspan=1>68.477.8</td></tr><tr><td rowspan=2 colspan=1>DRN-105</td><td rowspan=2 colspan=1>Source OnlyOurs</td><td rowspan=2 colspan=1>25.986.2</td><td rowspan=2 colspan=1>10.910.1</td><td rowspan=2 colspan=1>50.578.8</td><td rowspan=2 colspan=1>3.320.1</td><td rowspan=2 colspan=1>12.27.4</td><td rowspan=1 colspan=1>25.4</td><td rowspan=1 colspan=1>28.6</td><td rowspan=2 colspan=1>13.015.0</td><td rowspan=2 colspan=1>78.384.5</td><td rowspan=2 colspan=1>7.338.9</td><td rowspan=1 colspan=1>63.9</td><td rowspan=1 colspan=1>52.1</td><td rowspan=1 colspan=1>7.9</td><td rowspan=1 colspan=1>66.3</td><td rowspan=2 colspan=1>5.229.6</td><td rowspan=2 colspan=1>7.832.7</td><td rowspan=2 colspan=1>0.90.2</td><td rowspan=2 colspan=1>13.719.2</td><td rowspan=2 colspan=1>0.78.3</td><td rowspan=2 colspan=1>24.937.3</td></tr><tr><td rowspan=1 colspan=1>21.2</td><td rowspan=1 colspan=1>26.5</td><td rowspan=1 colspan=1>81.1</td><td rowspan=1 colspan=1>54.6</td><td rowspan=1 colspan=1>13.6</td><td rowspan=1 colspan=1>80.8</td></tr></table>
154
+
155
+ ![](images/2a431aecdd2cbdb38788dec71565dbda6f38a671d3881b7e8cbaa1c5630bfb5c.jpg)
156
+ Table 3: Results on adaptation from $\mathrm { G T A } 5 $ Cityscapes. DANN and FCN Wild denote methods proposed by (Ganin & Lempitsky (2014)) and (Hoffman et al. (2016) respectively.
157
+ Figure 7: Comparison of results on two real images segmented by ResNet50. Clockwise from upper left: Original image; Ground truth; Segmented image before adaptation; Segmented image after adaptation by our method.
158
+
159
+ We also show how to apply our method to train Generative Adversarial Networks for semisupervised learning in the appendix.
160
+
161
+ # 6 ACKNOWLEDGEMENTS
162
+
163
+ We would like to thank Trevor Darrell for his great advice on our paper. The first author’s stay at Boston University was partially supported by a scholarship from the University of Tokyo. The work was partially funded by the ImPACT Program of the Council for Science, Technology, and Innovation (Cabinet Office, Government of Japan), and was partially supported by CREST, JST. Saenko was supported by IARPA and NSF grants CCF-1723379 and IIS-1724237.
164
+
165
+ # REFERENCES
166
+
167
+ Shai Ben-David, John Blitzer, Koby Crammer, Alex Kulesza, Fernando Pereira, and Jennifer Wortman Vaughan. A theory of learning from different domains. Machine learning, 79(1-2):151–175, 2010.
168
+
169
+ Konstantinos Bousmalis, George Trigeorgis, Nathan Silberman, Dilip Krishnan, and Dumitru Erhan. Domain separation networks. In NIPS, 2016.
170
+
171
+ Konstantinos Bousmalis, Nathan Silberman, David Dohan, Dumitru Erhan, and Dilip Krishnan. Unsupervised pixel-level domain adaptation with generative adversarial networks. In CVPR, 2017.
172
+
173
+ Olivier Chapelle and Alexander Zien. Semi-supervised classification by low density separation. In AISTATS, 2005.
174
+
175
+ Marius Cordts, Mohamed Omran, Sebastian Ramos, Timo Rehfeld, Markus Enzweiler, Rodrigo Benenson, Uwe Franke, Stefan Roth, and Bernt Schiele. The cityscapes dataset for semantic urban scene understanding. In CVPR, 2016.
176
+
177
+ Zihang Dai, Zhilin Yang, Fan Yang, William W Cohen, and Ruslan Salakhutdinov. Good semisupervised learning that requires a bad gan. arXiv preprint arXiv:1705.09783, 2017.
178
+
179
+ Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In CVPR, 2009.
180
+
181
+ Vincent Dumoulin, Ishmael Belghazi, Ben Poole, Alex Lamb, Martin Arjovsky, Olivier Mastropietro, and Aaron Courville. Adversarially learned inference. arXiv preprint arXiv:1606.00704, 2016.
182
+
183
+ Yaroslav Ganin and Victor Lempitsky. Unsupervised domain adaptation by backpropagation. In ICML, 2014.
184
+
185
+ Yaroslav Ganin, Evgeniya Ustinova, Hana Ajakan, Pascal Germain, Hugo Larochelle, Franc¸ois Laviolette, Mario Marchand, and Victor Lempitsky. Domain-adversarial training of neural networks. JMLR, 17(59):1–35, 2016.
186
+
187
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In NIPS, 2014a.
188
+
189
+ Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. In ICLR, 2014b.
190
+
191
+ Yves Grandvalet and Yoshua Bengio. Semi-supervised learning by entropy minimization. In NIPS, 2005.
192
+
193
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016.
194
+
195
+ Judy Hoffman, Dequan Wang, Fisher Yu, and Trevor Darrell. Fcns in the wild: Pixel-level adversarial and constraint-based adaptation. arXiv preprint arXiv:1612.02649, 2016.
196
+
197
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In ICML, 2015.
198
+
199
+ Thorsten Joachims. Transductive inference for text classification using support vector machines. In ICML, 1999.
200
+
201
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
202
+
203
+ Yann LeCun, Leon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to ´ document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
204
+
205
+ Ming-Yu Liu and Oncel Tuzel. Coupled generative adversarial networks. In NIPS, 2016.
206
+
207
+ Jonathan Long, Evan Shelhamer, and Trevor Darrell. Fully convolutional networks for semantic segmentation. In CVPR, 2015a.
208
+
209
+ Mingsheng Long, Yue Cao, Jianmin Wang, and Michael I Jordan. Learning transferable features with deep adaptation networks. In ICML, 2015b.
210
+
211
+ Mingsheng Long, Han Zhu, Jianmin Wang, and Michael I Jordan. Unsupervised domain adaptation with residual transfer networks. In NIPS, 2016.
212
+
213
+ Mingsheng Long, Jianmin Wang, and Michael I Jordan. Deep transfer learning with joint adaptation networks. In ICML, 2017.
214
+
215
+ Lars Maaløe, Casper Kaae Sønderby, Søren Kaae Sønderby, and Ole Winther. Auxiliary deep generative models. arXiv preprint arXiv:1602.05473, 2016.
216
+
217
+ Laurens van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. JMLR, 9(Nov):2579– 2605, 2008.
218
+
219
+ Takeru Miyato, Shin-ichi Maeda, Masanori Koyama, Ken Nakae, and Shin Ishii. Distributional smoothing with virtual adversarial training. 2016.
220
+
221
+ Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Y Ng. Reading digits in natural images with unsupervised feature learning. In NIPS workshop on deep learning and unsupervised feature learning, 2011.
222
+
223
+ Fabian Pedregosa, Ga”el Varoquaux, Alexandre Gramfort, Vincent Michel, Bertrand Thirion, Olivier Grisel, Mathieu Blondel, Peter Prettenhofer, Ron Weiss, Vincent Dubourg, et al. Scikitlearn: Machine learning in python. JMLR, 12(10):2825–2830, 2011.
224
+
225
+ Xingchao Peng, Ben Usman, Neela Kaushik, Judy Hoffman, Dequan Wang, and Kate Saenko. Visda: The visual domain adaptation challenge. arXiv preprint arXiv:1710.06924, 2017.
226
+
227
+ Stephan R Richter, Vibhav Vineet, Stefan Roth, and Vladlen Koltun. Playing for data: Ground truth from computer games. In ECCV, 2016.
228
+
229
+ Kuniaki Saito, Yoshitaka Ushiku, and Tatsuya Harada. Asymmetric tri-training for unsupervised domain adaptation. In ICML, 2017.
230
+
231
+ Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. In NIPS, 2016.
232
+
233
+ Ozan Sener, Hyun Oh Song, Ashutosh Saxena, and Silvio Savarese. Learning transferrable representations for unsupervised domain adaptation. In NIPS, 2016.
234
+
235
+ Jost Tobias Springenberg. Unsupervised and semi-supervised learning with categorical generative adversarial networks. arXiv preprint arXiv:1511.06390, 2015.
236
+
237
+ Nitish Srivastava, Geoffrey E Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. JMLR, 15(1):1929–1958, 2014.
238
+
239
+ Baochen Sun and Kate Saenko. Deep coral: Correlation alignment for deep domain adaptation. In ECCV 2016 Workshops, 2016.
240
+
241
+ Baochen Sun, Jiashi Feng, and Kate Saenko. Return of frustratingly easy domain adaptation. In AAAI, 2016.
242
+
243
+ Yaniv Taigman, Adam Polyak, and Lior Wolf. Unsupervised cross-domain image generation. In ICLR, 2016.
244
+
245
+ Eric Tzeng, Judy Hoffman, Ning Zhang, Kate Saenko, and Trevor Darrell. Deep domain confusion: Maximizing for domain invariance. arXiv preprint arXiv:1412.3474, 2014.
246
+
247
+ Eric Tzeng, Judy Hoffman, Kate Saenko, and Trevor Darrell. Adversarial discriminative domain adaptation. In CVPR, 2017.
248
+
249
+ Saining Xie, Ross Girshick, Piotr Dollar, Zhuowen Tu, and Kaiming He. Aggregated residual trans- ´ formations for deep neural networks. arXiv preprint arXiv:1611.05431, 2016.
250
+
251
+ Hongliang Yan, Yukang Ding, Peihua Li, Qilong Wang, Yong Xu, and Wangmeng Zuo. Mind the class weight bias: Weighted maximum mean discrepancy for unsupervised domain adaptation. In CVPR, 2017.
252
+
253
+ Fisher Yu, Vladlen Koltun, and Thomas Funkhouser. Dilated residual networks. In CVPR, 2017.
254
+
255
+ # APPENDIX
256
+
257
+ # A ENTROPY BASED METHOD FOR DOMAIN ADAPTATION (ENT)
258
+
259
+ Our method aims to move target samples away from the decision boundary. Some techniques used in training Generative Adversarial Networks can be applied to achieve our goal too. (Springenberg (2015); Salimans et al. (2016)) used small number of labeled samples to train critic. Critic is trained to classify real samples into $K$ classes. They also trained critic to move unlabeled real images away from the boundary by minimizing entropy of the critic’s output. Generated fake images are moved near the boundary by maximizing the entropy. On the other hand, generator is trained to generate fake images which should be placed away from the boundary. This kind of method can be easily applied to domain adaptation problem. We would like to describe the method along with our problem setting.
260
+
261
+ Similar to our method, we have critic networks $C$ and generator $G$ . $C$ classifies samples into $K$ class. $C$ is trained to maximize the entropy of target samples, which encourages to move the target samples near the boundary. Then, $G$ is trained to minimize the entropy of them. Thus, $G$ tries to move target samples away from the boundary.
262
+
263
+ The only difference from our method is that we used entropy term for adversarial training loss. That is, in this method, we replace our sensitivity term $d ( p _ { 1 } , p _ { 2 } )$ in Eq. 4 with entropy of the classifier output. The adversarial loss for this baseline method is a following one.
264
+
265
+ $$
266
+ \begin{array} { r c l } { { { \cal L } _ { a d v } ( X _ { t } ) } } & { { = } } & { { \displaystyle \mathbb { E } _ { { \mathbf { x _ { t } } } \sim X _ { t } } [ H [ p ( \mathbf { y } | { \mathbf { x _ { t } } } ) ] } } \\ { { { \cal H } [ p ( \mathbf { y } | { \mathbf { x _ { t } } } ) ] } } & { { = } } & { { \displaystyle - \sum _ { k = 1 } ^ { K } p ( y = k | { \mathbf { x _ { t } } } ) \log p ( y = k | { \mathbf { x _ { t } } } ) } } \end{array}
267
+ $$
268
+
269
+ $$
270
+ H [ p ( y | x ) ] = - \sum _ { k = 1 } ^ { K } p ( y = k | x ) \log p ( y = k | x )
271
+ $$
272
+
273
+ The hyper-parameter $n$ , how many times we update $G$ for adversarial loss in one mini-batch, is set as $n = 4$ . Experimentally, it worked well for all settings.
274
+
275
+ # B DIGITS CLASSIFICATION TRAINING DETAIL
276
+
277
+ We follow the protocol used in (Tzeng et al. (2017)). For adaptation from SVHN to MNIST, we used standard training splits of each datasets as training data. For evaluation, we used test splits of MNIST. For the adaptation between MNIST and USPS (P1), we sampled 2000 images from MNIST and 1800 images from USPS. For the adaptation between MNIST and USPS (P2), we used all training images of MNIST and USPS following Bousmalis et al. (2017). In these experiments, we composed the mini-batch half from source and half from target samples. The batch-size was set as 128 for both source and target. We report the score after repeating Step $1 { \sim } 3$ (please see Sec 3.2) 20000 times. For our baseline, ENT, we used the same network architecture and the same hyper-parameters as used in our proposed method.
278
+
279
+ # C OBJECT CLASSIFICATION TRAINING DETAIL
280
+
281
+ In this experiment, SGD with learning rate $1 . 0 \times 1 0 ^ { - 3 }$ is used to optimize the parameters. For the finetuning of ResNet101, we set batch-size as 32. Due to the limit of GPU memory, we set it as 24 in finetuning ResNext model. We report the score after 20 epochs training. In order to train MMD model, we use 5 RBF kernels with the following standard deviation parameters:
282
+
283
+ $$
284
+ \sigma = [ 0 . 1 , 0 . 0 5 , 0 . 0 1 , 0 . 0 0 0 1 , 0 . 0 0 0 0 1 ]
285
+ $$
286
+
287
+ We changed the number of the kernels and their parameters, but we could not observe significant performance difference. We report the performance after 5 epochs. We could not see any improvement after the epoch.
288
+
289
+ To train a model (Ganin & Lempitsky (2014)), we used two-layered domain classification networks. Experimentally, we did not see any improvement when the network architecture is changed. According to the original method (Ganin $\&$ Lempitsky (2014)), learning rate is decreased every iteration. However, in our experiment, we could not see improvement, thus, we fixed learning rate $\mathrm { i . 0 \times 1 0 ^ { - 3 } }$ . We report the accuracy after 1 epoch. The accuracy dropped significantly after the first epoch. We assume this is due to the large domain difference between synthetic and real images.
290
+
291
+ ![](images/91334547d8f045bbc50bad32d13e84fbdd9717e2bd91e1f11d2951fede231eb5.jpg)
292
+ Figure 9: Example of results on segmentation experiments performed by DRN-105. From top to bottom, Original image; Ground truth; Segmented image before adaptation; Segmented image after adaptation by our method.
293
+
294
+ For our new baseline, ENT, we used the same hyper-parameter as we used for our proposed method. Since the accuracy of ENT drops significantly after around 5 epochs, we report the accuracy after 5 epoch updates.
295
+
296
+ # D SEGMENTATION EXPERIMENTS
297
+
298
+ We modified FCN Long et al. (2015a) architecture suitable for ResNet structure. The features from ResBlock $2 { \sim } 4$ and the first convolution layer and maxpooling layer are used in our implementation. In Fig. 8, we show how we integrated the features of each layers. We regard the layers of ResNet50 as generator and rest of the networks, namely convolution and upsampling layers as a critic network. The input images were resized to $5 1 2 \mathrm { x } 1 0 2 4$ due to the limit of GPU memory. For the same reason, the batchsize was set to one. In Fig. 9, we show the example of segmented images by DRN-105. The images are cleanly segmented by our proposed method.
299
+
300
+ ![](images/239b4a962924dc544fc56d44223b3182af3fbba803795fe928439774dffc489c.jpg)
301
+ Figure 8: Overview of architecture for semantic segmentation
302
+
303
+ # E SEMI-SUPERVISED LEARNING USING GANS
304
+
305
+ In this section, we demonstrate how to apply our method in training a Generative Adversarial Network (GAN) applied to semi-supervised learning. We follow the method proposed by (Springenberg (2015); Salimans et al. (2016)), who use a $K$ -class classification network as a critic to train a GAN in the semi-supervised setting.
306
+
307
+ Approach. In contrast to the domain adaptation setting, here $G$ tries to generate images which fool the critic $C$ . Also, in this setting, we are given labeled and unlabeled real images from the same domain. Then, we train the critic to classify labeled images correctly and to move unlabeled images far from the decision boundary. To achieve this, we propose to train the critic with the following objective:
308
+
309
+ $$
310
+ \operatorname* { m i n } _ { C } L _ { C } = L ( X _ { L } , Y _ { L } ) + L _ { a d v } ( X _ { u } ) - L _ { a d v } ( X _ { g } ) - H [ \frac { 1 } { M } \sum _ { i = 1 } ^ { M } p ( y | x _ { u } { } ^ { i } , C ) ]
311
+ $$
312
+
313
+ $$
314
+ L _ { a d v } ( X _ { u } ) = \mathbb { E } _ { \mathbf { x _ { u } } \sim X _ { u } } [ d ( C _ { 1 } ( G ( \mathbf { x _ { u } } ) ) , C _ { 2 } ( G ( \mathbf { x _ { u } } ) ) ) ]
315
+ $$
316
+
317
+ ![](images/63364abe673b063e24a800150d6aed5d16f2ac6fd54204e6ef2d434abc5d60e1.jpg)
318
+ Figure 10: Examples of generated images.
319
+
320
+ <table><tr><td></td><td>SVHN (% errors)</td><td>CIFAR (% errors)</td></tr><tr><td>Labeled Only SDGM (Maalge et al. (2016)</td><td>16.61 ± 0.24</td><td></td></tr><tr><td>CatGAN (Springenberg (2015))</td><td>=</td><td>19.58±0.46</td></tr><tr><td>ALI (Dumoulin et al. (2016))</td><td>7.42±0.65</td><td>17.99±1.62</td></tr><tr><td>ImpGAN (Salimans et al. (2016))</td><td>8.11±1.3</td><td>18.63±2.32</td></tr><tr><td>Ours</td><td>6.26±1.05</td><td>19.63±0.37</td></tr></table>
321
+
322
+ Table 4: Comparison with state-of-the-art methods on two benchmark datasets. Only methods without data augmentation are included. We used the same critic architecture as used in ImpGAN.
323
+
324
+ $$
325
+ L _ { a d v } ( X _ { g } ) = \mathbb { E } _ { { \mathbf { x } } _ { \mathbf { g } } \sim X _ { G } } [ d ( C _ { 1 } ( G ( { \mathbf { x } } _ { \mathbf { g } } ) ) , C _ { 2 } ( G ( { \mathbf { x } } _ { \mathbf { g } } ) ) ) ]
326
+ $$
327
+
328
+ where $X _ { L }$ denotes the subset of labeled samples, $X _ { u }$ denotes unlabeled ones and $X _ { g }$ denotes images generated by $G$ and $H$ denotes entropy as Eq.6 shows. The critic is trained to minimize the loss on labeled samples in the first term. Since unlabeled images should be far away from the decision boundary and should be distributed uniformly among the classes, we add the second and fourth term. The third term encourages the critic to detect fake images generated near the boundary.
329
+
330
+ The objective of $G$ is as follows,
331
+
332
+ $$
333
+ \operatorname* { m i n } _ { G } L _ { a d v } ( X _ { g } ) + | | \mathbb { E } _ { x _ { g } \sim X _ { g } } f ( \mathbf { x _ { g } } ) - \mathbb { E } _ { \mathbf { x _ { u } } \sim X _ { u } } f ( \mathbf { x _ { u } } ) | | ^ { 2 }
334
+ $$
335
+
336
+ where the second term encourages generated images to be similar to real images, which is known to be effective to stabilize the training. The first term encourages the generator to create fake images which should be placed far away from the boundary. Such images should be similar to real images because they are likely to be assigned to some class with high probability. Here, we update $C$ and $G$ same number of times.
337
+
338
+ Experiment. We evaluate our proposed GAN training method by using SVHN and CIFAR10 datasets, using the critic network architecture from (Salimans et al. (2016)). We set the batch size as 100 and used Adam with learning rate $2 . 0 \times 1 . 0 ^ { - 4 }$ for optimizer. After the conv6 layer of the critic, we constructed a classifier which was not concerned with adversarial learning process.
339
+
340
+ In the experiment on SVHN, we replaced Weight Normalization with Batch Normalization for $C$ . Also, in the experiment on CIFAR10, we construct a classifier from a middle layer of the critic, which is not incorporated into the adversarial training step. This is motivated by the insight that the critic in our method is trained to be too sensitive to the dropout noise as we explained in Sec 3.3.
341
+
342
+ Results. From Fig. 10(a), we can see that ADR seems to generate realistic SVHN images. Some images are significantly blurred, but most of the images are clear and diverse. As for generated CIFAR10 images, they do not seem as realistic, but some objects appear in most images. In Table 4, we can see that the accuracy of the critic trained by our method has better performance than other models for SVHN. For CIFAR10, the accuracy was slightly worse than other state-of-the-art methods. We conclude that, despite its clear advantage on the domain adaptation tasks, our method produces mixed results on the SSL tasks. It could still be useful for SSL, however, it needs further exploration to improve the accuracy. For example, in Eq. 6, we propose to maximize the entropy of the marginal class distribution of the unlabeled real images, as well as forcing them to be far from the boundary. However, these objectives may contradict each other, which may in turn degrade the performance. In late-breaking results, Dai et al. (2017) theoretically showed that just generating fake images that are far from decision boundaries does not help to improve accuracy in training GANs in the setting of SSL. Further improvement of our SSL approach based on these results is an interesting direction for future work.
md/train/HJKkY35le/HJKkY35le.md ADDED
@@ -0,0 +1,321 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MODE REGULARIZED GENERATIVE ADVERSARIAL NETWORKS
2
+
3
+ †Tong Che∗, ‡Yanran Li∗, †,§Athul Paul Jacob, †Yoshua Bengio, ‡Wenjie Li
4
+ †Montreal Institute for Learning Algorithms, Universite de Montr ´ eal, Montr ´ eal, QC H3T 1J4, Canada ´
5
+ ‡Department of Computing, The Hong Kong Polytechnic University, Hong Kong
6
+ §David R. Cheriton School of Computer Science, University Of Waterloo, Waterloo, ON N2L 3G1, Canada
7
+ {tong.che,ap.jacob,yoshua.bengio}@umontreal.ca
8
+ {csyli,cswjli}@comp.polyu.edu.hk
9
+
10
+ # ABSTRACT
11
+
12
+ Although Generative Adversarial Networks achieve state-of-the-art results on a variety of generative tasks, they are regarded as highly unstable and prone to miss modes. We argue that these bad behaviors of GANs are due to the very particular functional shape of the trained discriminators in high dimensional spaces, which can easily make training stuck or push probability mass in the wrong direction, towards that of higher concentration than that of the data generating distribution. We introduce several ways of regularizing the objective, which can dramatically stabilize the training of GAN models. We also show that our regularizers can help the fair distribution of probability mass across the modes of the data generating distribution, during the early phases of training and thus providing a unified solution to the missing modes problem.
13
+
14
+ # 1 INTRODUCTION
15
+
16
+ Generative adversarial networks (GAN) (Goodfellow et al., 2014) have demonstrated their potential on various tasks, such as image generation, image super-resolution, 3D object generation, and video prediction (Radford et al., 2015; Ledig et al., 2016; Sønderby et al., 2016; Nguyen et al., 2016; Wu et al., 2016; Mathieu et al., 2015). The objective is to train a parametrized function (the generator) which maps noise samples (e.g., uniform or Gaussian) to samples whose distribution is close to that of the data generating distribution. The basic scheme of the GAN training procedure is to train a discriminator which assigns higher probabilities to real data samples and lower probabilities to generated data samples, while simultaneously trying to move the generated samples towards the real data manifold using the gradient information provided by the discriminator. In a typical setting, the generator and the discriminator are represented by deep neural networks.
17
+
18
+ Despite their success, GANs are generally considered as very hard to train due to training instability and sensitivity to hyper-parameters. On the other hand, a common failure pattern observed while training GANs is the collapsing of large volumes of probability mass onto a few modes. Namely, although the generators produce meaningful samples, these samples are often from just a few modes (small regions of high probability under the data distribution). Behind this phenomenon is the missing modes problem, which is widely conceived as a major problem for training GANs: many modes of the data generating distribution are not at all represented in the generated samples, yielding a much lower entropy distribution, with less variety than the data generating distribution.
19
+
20
+ This issue has been the subject of several recent papers proposing several tricks and new architectures to stabilize GAN’s training and encourage its samples’ diversity. However, we argue that a general cause behind these problems is the lack of control on the discriminator during GAN training. We would like to encourage the manifold of the samples produced by the generator to move towards that of real data, using the discriminator as a metric. However, even if we train the discriminator to distinguish between these two manifolds, we have no control over the shape of the discriminator function in between these manifolds. In fact, the shape of the discriminator function in the data space can be very non-linear with bad plateaus and wrong maxima and this can therefore hurt the training of GANs (Figure 1).
21
+
22
+ ![](images/369f34d05cb3594aa3e375375091c128e3752c2e993fd9075254cddcb9f00c0b.jpg)
23
+ Figure 1: Samples with very high discrimination values $\mathrm { ( D = } 1 . 0$ ) in DCGAN model trained on CelebA dataset.
24
+
25
+ To remedy this problem, we propose a novel regularizer for the GAN training target. The basic idea is simple yet powerful: in addition to the gradient information provided by the discriminator, we want the generator to take advantage of other similarity metrics with much more predictable behavior, such as the $L _ { 2 }$ norm. Differentiating these similarity metrics will provide us with more stable gradients to train our generator. Combining this idea with an approach meant to penalize the missing modes, we propose a family of additional regularizers for the GAN objective. We then design a set of metrics to evaluate the generated samples in terms of both the diversity of modes and the distribution fairness of the probability mass. These metrics are shown to be more robust in judging complex generative models, including those which are well-trained and collapsed ones.
26
+
27
+ Regularizers usually bring a trade-off between model variance and bias. Our results have shown that, when correctly applied, our regularizers can dramatically reduce model variance, stabilize the training, and fix the missing mode problem all at once, with positive or at the least no negative effects on the generated samples. We also discuss a variant of the regularized GAN algorithm, which can even improve sample quality as compared to the DCGAN baseline.
28
+
29
+ # 2 RELATED WORK
30
+
31
+ The GAN approach was initially proposed by Goodfellow et al. (2014) where both the generator and the discriminator are defined by deep neural networks.
32
+
33
+ In Goodfellow et al. (2014), the GAN is able to generate interesting local structure but globally incoherent images on various datasets. Mirza & Osindero (2014) enlarges GAN’s representation capacity by introducing an extra vector to allow the generator to produce samples conditioned on other beneficial information. Motivated from this, several conditional variants of GAN has been applied to a wide range of tasks, including image prediction from a normal map Wang & Gupta (2016), image synthesis from text Reed et al. (2016) and edge map Isola et al. (2016), real-time image manipulation Zhu et al. (2016), temporal image generation Zhou & Berg (2016); Saito & Matsumoto (2016); Vondrick et al. (2016), texture synthesis, style transfer, and video stylization Li & Wand (2016).
34
+
35
+ Researchers also aim at stretching GAN’s limit to generate higher-resolution, photo-realistic images. Denton et al. (2015) initially apply a Laplacian pyramid framework on GAN to generate images of high resolution. At each level of their LAPGAN, both the generator and the discriminator are convolutional networks. As an alternative to LAPGAN, Radford et al. (2015) successfully designs a class of deep convolutional generative adversarial networks which has led to significant improvements on unsupervised image representation learning. Another line of work aimed at improving GANs are through feature learning, including features from the latent space and image space. The motivation is that features from different spaces are complementary for generating perceptual and natural-looking images. With this perspective, some researchers use distances between learned features as losses for training objectives for generative models. Larsen et al. (2015) combine a variational autoencoder objective with a GAN and utilize the learned features from the discriminator in the GANs for better image similarity metrics. It is shown that the learned distance from the discriminator is of great help for the sample visual fidelity. Recent literature have also shown impressive results on image super-resolution to infer photo-realistic natural images for $4 \mathbf { x }$ upscaling factors Ledig et al. (2016); Sønderby et al. (2016); Nguyen et al. (2016).
36
+
37
+ Despite these promising successes, GANs are notably hard to train. Although Radford et al. (2015) provide a class of empirical architectural choices that are critical to stabilize GAN’s training, it would be even better to train GANs more robustly and systematically. Salimans et al. (2016) propose feature matching technique to stabilize GAN’s training. The generator is required to match the statistics of intermediate features of the discriminator. Similar idea is adopted by Zhao et al. (2016).
38
+
39
+ In addition to feature distances, Dosovitskiy & Brox (2016) found that the counterpart loss in image space further improves GAN’s training stability. Furthermore, some researchers make use of information in both spaces in a unified learning procedure (Dumoulin et al., 2016; Donahue et al., 2016). In Dumoulin et al. (2016), one trains not just a generator but also an encoder, and the discriminator is trained to distinguish between two joint distributions over image and latent spaces produced either by the application of the encoder on the training data or by the application of the generator (decoder) to the latent prior. This is in contrast with the regular GAN training, in which the discriminator only attempts to separate the distributions in the image space. Parallelly, Metz et al. (2016) stabilize GANs by unrolling the optimization of discriminator, which can be considered as an orthogonal work with ours.
40
+
41
+ Our work is related to VAEGAN (Larsen et al., 2015) in terms of training an autoencoder or VAE jointly with the GAN model. However, the variational autoencoder (VAE) in VAEGAN is used to generate samples whereas our autoencoder based losses serves as a regularizer to penalize missing modes and thus improving GAN’s training stability and sample qualities. We demonstrate detailed differences from various aspects in Appendix D.
42
+
43
+ # 3 MODE REGULARIZERS FOR GANS
44
+
45
+ The GAN training procedure can be viewed as a non-cooperative two player game, in which the discriminator $D$ tries to distinguish real and generated examples, while the generator $G$ tries to fool the discriminator by pushing the generated samples towards the direction of higher discrimination values. Training the discriminator $D$ can be viewed as training an evaluation metric on the sample space. Then the generator $G$ has to take advantage of the local gradient $\nabla \log D ( G )$ provided by the discriminator to improve itself, namely to move towards the data manifold.
46
+
47
+ We now take a closer look at the root cause of the instabilities while training GANs. The discriminator is trained on both generated and real examples. As pointed out by Goodfellow et al. (2014); Denton et al. (2015); Radford et al. (2015), when the data manifold and the generation manifold are disjoint (which is true in almost all practical situations), it is equivalent to training a characteristic function to be very close to 1 on the data manifold, and 0 on the generation manifold. In order to pass good gradient information to the generator, it is important that the trained discriminator produces stable and smooth gradients. However, since the discriminator objective does not directly depend on the behavior of the discriminator in other parts of the space, training can easily fail if the shape of the discriminator function is not as expected. As an example,Denton et al. (2015) noted a common failure pattern for training GANs which is the vanishing gradient problem, in which the discriminator $D$ perfectly classifies real and fake examples, such that around the fake examples, $D$ is nearly zero. In such cases, the generator will receive no gradient to improve itself.1
48
+
49
+ Another important problem while training GANs is mode missing. In theory, if the generated data and the real data come from the same low dimensional manifold, the discriminator can help the generator distribute its probability mass, because the missing modes will not have near-0 probability under the generator and so the samples in these areas can be appropriately concentrated towards regions where $D$ is closer to 1. However, in practice since the two manifolds are disjoint, $D$ tends to be near 1 on all the real data samples, so large modes usually have a much higher chance of attracting the gradient of discriminator. For a typical GAN model, since all modes have similar $D$ values, there is no reason why the generator cannot collapse to just a few major modes. In other words, since the discriminator’s output is nearly 0 and 1 on fake and real data respectively, the generator is not penalized for missing modes.
50
+
51
+ # 3.1 GEOMETRIC METRICS REGULARIZER
52
+
53
+ Compared with the objective for the GAN generator, the optimization targets for supervised learning are more stable from an optimization point of view. The difference is clear: the optimization target for the GAN generator is a learned discriminator. While in supervised models, the optimization targets are distance functions with nice geometric properties. The latter usually provides much easier training gradients than the former, especially at the early stages of training.
54
+
55
+ Inspired by this observation, we propose to incorporate a supervised training signal as a regularizer on top of the discriminator target. Assume the generator $G ( z ) : Z \to X$ generates samples by sampling first from a fixed prior distribution in space $Z$ followed by a deterministic trainable transformation $G$ into the sample space $X$ . Together with $G$ , we also jointly train an encoder $E ( x ) : X Z$ . Assume $d$ is some similarity metric in the data space, we add $\mathbb { E } _ { { x } \sim { p } _ { d } } [ d ( { x } , G \circ E ( { x } ) ) ]$ as a regularizer, where $p _ { d }$ is the data generating distribution. The encoder itself is trained by minimizing the same reconstruction error.
56
+
57
+ In practice, there are many options for the distance measure $d$ . For instance, the pixel-wise $L ^ { 2 }$ distance, or the distance of learned features by the discriminator (Dumoulin et al., 2016) or by other networks, such as a VGG classifier. (Ledig et al., 2016)
58
+
59
+ The geometric intuition for this regularizer is straight-forward. We are trying to move the generated manifold to the real data manifold using gradient descent. In addition to the gradient provided by the discriminator, we can also try to match the two manifolds by other geometric distances, say, $L ^ { s }$ metric. The idea of adding an encoder is equivalent to first training a point to point mapping $G ( E ( x ) )$ between the two manifolds and then trying to minimize the expected distance between the points on these two manifolds.
60
+
61
+ # 3.2 MODE REGULARIZER
62
+
63
+ In addition to the metric regularizer, we propose a mode regularizer to further penalize missing modes. In traditional GANs, the optimization target for the generator is the empirical sum $\begin{array} { r } { \sum _ { i } { \nabla _ { \theta } \log { D ( G _ { \theta } ( z _ { i } ) ) } } } \end{array}$ . The missing mode problem is caused by the conjunction of two facts: (1) the areas near missing modes are rarely visited by the generator, by definition, thus providing very few examples to improve the generator around those areas, and (2) both missing modes and nonmissing modes tend to correspond to a high value of $D$ , because the generator is not perfect so that the discriminator can take strong decisions locally and obtain a high value of $D$ even near non-missing modes.
64
+
65
+ As an example, consider the situation in Figure 2. For most $z$ , the gradient of the generator $\nabla _ { \theta } \log D ( G _ { \theta } ( z ) )$ pushes the generator towards the major mode $M _ { 1 }$ . Only when $G ( z )$ is very close to the mode $M _ { 2 }$ can the generator get gradients to push itself towards the minor mode $M _ { 2 }$ . However, it is possible that such $z$ is of low or zero probability in the prior distribution $p _ { 0 }$ .
66
+
67
+ ![](images/7385e91fa5a2d1dc34cba4cf1f79b9eaf272d966fa73d5daac595e2758dd374d.jpg)
68
+ Figure 2: Illustration of missing modes problem.
69
+
70
+ Given this observation, consider a regularized GAN model with the metric regularizer. Assume $M _ { 0 }$ is a minor mode of the data generating distribution. For $x \ \in \ M _ { 0 }$ , we know that if $G \circ E$ is a good autoencoder, $G ( E ( x ) )$ will be located very close to mode $M _ { 0 }$ . Since there are sufficient training examples of mode $M _ { 0 }$ in the training data, we add the mode regularizer $\mathbb { E } _ { { x } \sim p _ { d } } [ \log { \bar { D } } ( G \circ E ( x ) ) ]$ to our optimization target for the generator, to encourage $G ( E ( x ) )$
71
+
72
+ to move towards a nearby mode of the data generating distribution. In this way, we can achieve fair probability mass distribution across different modes.
73
+
74
+ In short, our regularized optimization target for the generator and the encoder becomes:
75
+
76
+ $$
77
+ \begin{array} { r } { T _ { G } = - \mathbb { E } _ { z } [ \log D ( G ( z ) ) ] + \mathbb { E } _ { x \sim p _ { d } } [ \lambda _ { 1 } d ( x , G \circ E ( x ) ) + \lambda _ { 2 } \log D ( G \circ E ( x ) ) ] } \\ { T _ { E } = \mathbb { E } _ { x \sim p _ { d } } [ \lambda _ { 1 } d ( x , G \circ E ( x ) ) + \lambda _ { 2 } \log D ( G \circ E ( x ) ) ] } \end{array}
78
+ $$
79
+
80
+ # 3.3 MANIFOLD-DIFFUSION TRAINING FOR REGULARIZED GANS
81
+
82
+ On some large scale datasets, CelebA for example, the regularizers we have discussed do improve the diversity of generated samples, but the quality of samples may not be as good without carefully tuning the hyperparameters. Here we propose a new algorithm for training metric-regularized GANs, which is very stable and much easier to tune for producing good samples.
83
+
84
+ The proposed algorithm divides the training procedure of GANs into two steps: a manifold step and a diffusion step. In the manifold step, we try to match the generation manifold and the real data manifold with the help of an encoder and the geometric metric loss. In the diffusion step, we try to distribute the probability mass on the generation manifold fairly according to the real data distribution.
85
+
86
+ An example of manifold-diffusion training of GAN (MDGAN for short) is as follows: we train a discriminator $D _ { 1 }$ which separates between the samples $x$ and $G \circ E ( x )$ , for $x$ from the data, and we optimize $G$ with respect to the regularized GAN loss $\mathbb { E } [ \log D _ { 1 } ( G \circ E ( x ) ) + \lambda d ( x , G \circ E ( x ) ) ]$ in order to match the two manifolds. In the diffusion step we train a discriminator $D _ { 2 }$ between distributions $G ( z )$ and $G \circ E ( x )$ , and we train $G$ to maximize $\log { D _ { 2 } ( G ( z ) ) }$ . Since these two distributions are now nearly on the same low dimensional manifold, the discriminator $D _ { 2 }$ provides much smoother and more stable gradients. The detailed training procedure is given in Appendix A. See Figure 6 for the quality of generated samples.
87
+
88
+ # 3.4 EVALUATION METRICS FOR MODE MISSING
89
+
90
+ In order to estimate both the missing modes and the sample qualities in our experiments, we used several different metrics for different experiments instead of human annotators.
91
+
92
+ The inception score (Salimans et al., 2016) was considered as a good assessment for sample quality from a labelled dataset:
93
+
94
+ $$
95
+ \exp { ( \mathbb { E } _ { x } K L ( p ( y | \mathbf { x } ) | | p ^ { * } ( y ) ) ) }
96
+ $$
97
+
98
+ Where $\mathbf { x }$ denotes one sample, $p ( y | x )$ is the softmax output of a trained classifier of the labels, and $p ^ { * } ( y )$ is the overall label distribution of generated samples. The intuition behind this score is that a strong classifier usually has a high confidence for good samples. However, the inception score is sometimes not a good metric for our purpose. Assume a generative model that collapse to a very bad image. Although the model is very bad, it can have a perfect inception score, because $p ( y | x )$ can have a high entropy and $p ^ { * } ( y )$ can have a low entropy. So instead, for labelled datasets, we propose another assessment for both visual quality and variety of samples, the MODE score:
99
+
100
+ $$
101
+ \exp \left( \mathbb { E } _ { x } K L ( p ( y | \mathbf { x } ) | | p ( y ) ) - K L ( p ^ { * } ( y ) | | p ( y ) ) \right)
102
+ $$
103
+
104
+ where $p ( y )$ is the distribution of labels in the training data. According to our human evaluation experiences, the MODE score successfully measures two important aspects of generative models, i.e., variety and visual quality, in one metric.
105
+
106
+ However, in datasets without labels (LSUN) or where the labels are not sufficient to characterize every data mode (CelebA), the above metric does not work well. We instead train a third party discriminator between the real data and the generated data from the model. It is similar to the GAN discriminator but is not used to train the generator. We can view the output of the discriminator as an estimator for the quantity (See (Goodfellow et al., 2014) for proof):
107
+
108
+ $$
109
+ D ^ { * } ( s ) \approx \frac { p _ { g } ( s ) } { p _ { g } ( s ) + p _ { d } ( s ) }
110
+ $$
111
+
112
+ Where $p _ { g }$ is the probability density of the generator and $p _ { d }$ is the density of the data distribution. To prevent $D ^ { * }$ from learning a perfect 0-1 separation of $p _ { g }$ and $p _ { d }$ , we inject a zero-mean Gaussian noise to the inputs when training $D ^ { * }$ . After training, we test $D ^ { * }$ on the test set $T$ of the real dataset. If for any test sample $t \in T$ , the discrimination value $D ( t )$ is close to 1, we can conclude that the mode corresponding to $t$ is missing. In this way, although we cannot measure exactly the number of modes that are missing, we have a good estimator of the total probability mass of all the missing modes.
113
+
114
+ # 4 EXPERIMENTS
115
+
116
+ # 4.1 MNIST
117
+
118
+ We perform two classes of experiments on MNIST. For the MNIST dataset, we can assume that the data generating distribution can be approximated with ten dominant modes, if we define the term “mode” here as a connected component of the data manifold.
119
+
120
+ # 4.1.1 GRID SEARCH FOR MNIST GAN MODELS
121
+
122
+ Table 1: Grid Search for Hyperparameters.
123
+
124
+ <table><tr><td>nLayerG</td><td>[2,3,4]</td></tr><tr><td>nLayerD</td><td>[2,3,4]</td></tr><tr><td>sizeG sizeD</td><td>[400,800,1600,3200]</td></tr><tr><td></td><td>[256, 512, 1024]</td></tr><tr><td>dropoutD</td><td>[True,False]</td></tr><tr><td>optimG</td><td>[SGD,Adam]</td></tr><tr><td>optimD</td><td>[SGD,Adam]</td></tr><tr><td>lr</td><td>[1e-2,1e-3,1e-4]</td></tr></table>
125
+
126
+ In order to systemically explore the effect of our proposed regularizers on GAN models in terms of improving stability and sample quality, we use a large scale grid search of different GAN hyper-parameters on the MNIST dataset. The grid search is based on a pair of randomly selected loss weights: $\lambda _ { 1 } = 0 . 2$ and $\lambda _ { 2 } ~ = ~ 0 . 4$ . We use the same hyper-parameter settings for both GAN and Regularized GAN, and list the search ranges in Table 1. Our grid search is similar to those proposed in Zhao et al. (2016). Please refer to it for detailed explanations regarding these hyper-parameters.
127
+
128
+ For evaluation, we first train a 4-layer CNN classifier on the MNIST digits, and then apply it to compute the MODE scores for the generated samples from all these models. The resulting distribution of MODE score is shown in Figure 3. Clearly, our proposed regularizer significantly improves the MODE scores and thus demonstrates its benefits on stabilizing GANs and improving sample qualities.
129
+
130
+ ![](images/23691178a9332efa7d0b890615c2cf021c092595979c93013beab8b2b47d1ea1.jpg)
131
+ Figure 3: The distributions of MODE scores for GAN and regularized GAN.
132
+
133
+ To illustrate the effect of regularizers with different coefficients, we randomly pick an architecture and train it with different $\lambda _ { 1 } = \lambda _ { 2 }$ . The results are shown in Figure 4.
134
+
135
+ ![](images/ba0462a6a90a59f8d012d3b775739a6a034addf655922b4e85364f2d3f1a8aa3.jpg)
136
+ Figure 4: (Left 1-5) Different hyperparameters for MNIST generation. The values of the $\lambda _ { 1 }$ and $\lambda _ { 2 }$ in our Regularized GAN are listed below the corresponding samples. (Right 6-7) Best samples through grid search for GAN and Regularized GAN.
137
+
138
+ # 4.1.2 COMPOSITIONAL MNIST DATA WITH 1000 MODES
139
+
140
+ In order to quantitatively study the effect of our regularizers on the missing modes, we concatenate three MNIST digits to a number in [0,999] in a single 64x64 image, and then train DCGAN as a baseline model on the 1000 modes dataset. The digits on the image are sampled with different probabilities, in order to test the model’s capability to preserve small modes in generation. We again use a pre-trained classifier for MNIST instead of a human to evaluate the models.
141
+
142
+ Table 2: Results for Compositional MNIST with 1000 modes. The proposed regularization (RegDCGAN) allows to substantially reduce the number of missed modes as well as the KL divergence that measures the plausibility of the generated samples (like in the Inception score).
143
+
144
+ <table><tr><td rowspan="2"></td><td colspan="2">Set 1</td><td colspan="2">Set 2</td><td colspan="2">Set3</td><td colspan="2">Set4</td></tr><tr><td>#Miss</td><td>KL</td><td>#Miss</td><td>KL</td><td>#Miss</td><td>KL</td><td>#Miss</td><td>KL</td></tr><tr><td>DCGAN</td><td>204.7</td><td>77.9</td><td>204.3</td><td>60.2</td><td>103.4</td><td>75.9</td><td>89.3</td><td>77.8</td></tr><tr><td>Reg-DCGAN</td><td>32.1</td><td>62.3</td><td>71.5</td><td>58.9</td><td>42.7</td><td>68.4</td><td>31.6</td><td>67.8</td></tr></table>
145
+
146
+ The performances on the compositional experiment are measured by two metrics. #Miss represents the classifier-reported number of missing modes, which is the size of the set of numbers that the model never generates. KL stands for the KL divergence between the classifier-reported distribution of generated numbers and the distribution of numbers in the training data (as for the Inception score). The results are shown in Table 2. With the help of our proposed regularizer, both the number of missing modes and KL divergence drop dramatically among all the sets of the compositional MNIST dataset, which again proves the effectiveness of our regularizer for preventing the missing modes problem.
147
+
148
+ # 4.2 CELEBA
149
+
150
+ To test the effectiveness of our proposal on harder problems, we implement an encoder for the DCGAN algorithm and train our model with different hyper-parameters together with the DCGAN baseline on the CelebA dataset. We provide the detailed architecture of our regularized DCGAN in Appendix B.
151
+
152
+ # 4.2.1 MISSING MODES ESTIMATION ON CELEBA
153
+
154
+ We also employ a third party discriminator trained with injected noise as a metric for missing mode estimation. To implement this, we add noise in the input layer in the discriminator network. For each GAN model to be estimated, we independently train this noisy discriminator, as mode estimator, with the same architecture and hyper-parameters on the generated data and the training data. We then apply the mode estimator to the test data. The images which have high mode estimator outputs can be viewed as on the missing modes.
155
+
156
+ Table 3: Number of images on the missing modes on CelebA estimated by a third-party discriminator. The numbers in the brackets indicate the dimension of prior $z$ . $\sigma$ denotes the standard deviation of the added Gaussian noise applied at the input of the discriminator to regularize it. MDGAN achieves a very high reduction in the number of missing modes, in comparison to other methods .
157
+
158
+ <table><tr><td>0</td><td>DCGAN (100)</td><td>DCGAN (200)</td><td>Reg-GAN (100)</td><td>Reg-GAN (200)</td><td>MDGAN (200)</td></tr><tr><td>3.5</td><td>5463</td><td>17089</td><td>754</td><td>3644</td><td>74</td></tr><tr><td>4.0</td><td>590</td><td>15832</td><td>42</td><td>391</td><td>13</td></tr></table>
159
+
160
+ The comparison result is shown in Table 3. Both our proposed Regularized-GAN and MDGAN outperform baseline DCGAN models on all settings. Especially, MDGAN suppresses other models, showing its superiority on modes preserving. We also find that, although sharing the same architecture, the DCGAN with 200-dimensional noise performs quite worse than that with 100-dimensional noise as input. On the contrary, our regularized GAN performs more consistently.
161
+
162
+ To get a better understanding of the models’ performance, we want to figure out when and where these models miss the modes. Visualizing the test images associated with missed modes is instructive. In Figure 5, the left three images are missed by all models. It is rare to see in the training data the cap in the second image and the type of background in the third, which thus can be viewed as small modes under this situation. These three images should be considered as the hardest test data for GAN to learn. Nonetheless, our best model, MDGAN still capture certain small modes. The seven images on the right in Figure 5 are only missed by DCGAN. The sideface, paleface, black, and the berets are special attributes among these images, but our proposed MDGAN performs well on all of them.
163
+
164
+ ![](images/dd60ba26724f057d75e53e8f9051cfa7ab0d2f40c846afeeccfbb3ecd6ec1b15.jpg)
165
+ Figure 5: Test set images that are on missing mode. Left: Both MDGAN and DCGAN missing. Right: Only DCGAN missing.
166
+
167
+ # 4.2.2 QUALITATIVE EVALUATION OF GENERATED SAMPLES
168
+
169
+ After quantitative evaluation, we manually examine the generated samples by our regularized GAN to see whether the proposed regularizer has side-effects on sample quality. We compare our model with ALI (Dumoulin et al., 2016), VAEGAN (Larsen et al., 2015), and DCGAN (Radford et al., 2015) in terms of sample visual quality and mode diversity. Samples generated from these models are shown in Figure $6 ^ { 2 ^ { \circ } }$ .
170
+
171
+ ![](images/601224511ba5ab1ca605c826bf8588ec4a9779fd983509775ed6e2be4b574de3.jpg)
172
+ Figure 6: Samples generated from different generative models. For each compared model, we directly take ten decent samples reported in their corresponding papers and code repositories. Note how MDGAN samples are both globally more coherent and locally have sharp textures.
173
+
174
+ Both MDGAN and Regularized-GAN generate clear and natural-looking face images. Although ALI’s samples are plausible, they are sightly deformed in comparison with those from MDGAN. The samples from VAEGAN and DCGAN seem globally less coherent and locally less sharp.
175
+
176
+ As to sample quality, it is worth noting that the samples from MDGAN enjoy fewer distortions. With all four other models, the majority of generated samples suffer from some sort of distortion. However, for the samples generated by MDGAN, the level of distortion is lower compared with the other four compared models. We attribute it to the help of the autoencoder as the regularizer to alter the generation manifolds. In this way, the generator is able to learn fine-grained details such as face edges. As a result, MDGAN is able to reduce distortions.
177
+
178
+ ![](images/7ccfe9752c1edde7bf368397e5fc0a44880f5ada2037abd62a3f910d669af1b5.jpg)
179
+ Figure 7: Sideface samples generated by Regularized-GAN and MDGAN.
180
+
181
+ In terms of missing modes problem, we instructed five individuals to conduct human evaluation on the generated samples. They achieve consensus that MDGAN wins in terms of mode diversities. Two people pointed out that MDGAN generates a larger amount of samples with side faces than other models. We select several of these side face samples in Figure 7. Clearly, our samples maintain acceptable visual fidelity meanwhile share diverse modes. Combined with the above quantitative results, it is convincing that our regularizers bring benefits for both training stability and mode variety without the loss of sample quality.
182
+
183
+ # 5 CONCLUSIONS
184
+
185
+ Although GANs achieve state-of-the-art results on a large variety of unsupervised learning tasks, training them is considered highly unstable, very difficult and sensitive to hyper-parameters, all the while, missing modes from the data distribution or even collapsing large amounts of probability mass on some modes. Successful GAN training usually requires large amounts of human and computing efforts to fine tune the hyper-parameters, in order to stabilize training and avoid collapsing. Researchers usually rely on their own experience and published tricks and hyper-parameters instead of systematic methods for training GANs.
186
+
187
+ We provide systematic ways to measure and avoid the missing modes problem and stabilize training with the proposed autoencoder-based regularizers. The key idea is that some geometric metrics can provide more stable gradients than trained discriminators, and when combined with the encoder, they can be used as regularizers for training. These regularizers can also penalize missing modes and encourage a fair distribution of probability mass on the generation manifold.
188
+
189
+ # ACKNOWLEDGEMENTS
190
+
191
+ We thank Naiyan Wang, Jianbo Ye, Yuchen Ding, Saboya Yang for their GPU support. We also want to thank Huiling Zhen for helpful discussions, Junbo Zhao for providing the details of grid search experiments on the EBGAN model, as well as Anders Boesen Lindbo Larsen for kindly helping us on running VAEGAN experiments. We appreciate for the valuable suggestions and comments from the anonymous reviewers. The work described in this paper was partially supported by NSERC, Calcul Quebec, Compute Canada, the Canada Research Chairs, CIFAR, National Natural Science Foundation of China (61672445 and 61272291), Research Grants Council of Hong Kong (PolyU 152094/14E), and The Hong Kong Polytechnic University (G-YBP6).
192
+
193
+ # REFERENCES
194
+
195
+ Emily L Denton, Soumith Chintala, Rob Fergus, et al. Deep generative image models using a laplacian pyramid of adversarial networks. In Advances in neural information processing systems, pp. 1486–1494, 2015.
196
+ Jeff Donahue, Philipp Krahenb ¨ uhl, and Trevor Darrell. Adversarial feature learning. ¨ arXiv preprint arXiv:1605.09782, 2016.
197
+ Alexey Dosovitskiy and Thomas Brox. Generating images with perceptual similarity metrics based on deep networks. arXiv preprint arXiv:1602.02644, 2016.
198
+ Vincent Dumoulin, Ishmael Belghazi, Ben Poole, Alex Lamb, Martin Arjovsky, Olivier Mastropietro, and Aaron Courville. Adversarially learned inference. arXiv preprint arXiv:1606.00704, 2016.
199
+
200
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In Advances in Neural Information Processing Systems, pp. 2672–2680, 2014.
201
+
202
+ Phillip Isola, Jun-Yan Zhu, Tinghui Zhou, and Alexei A Efros. Image-to-image translation with conditional adversarial networks. arxiv, 2016.
203
+
204
+ Anders Boesen Lindbo Larsen, Søren Kaae Sønderby, Hugo Larochelle, and Ole Winther. Autoencoding beyond pixels using a learned similarity metric. arXiv preprint arXiv:1512.09300, 2015.
205
+
206
+ Christian Ledig, Lucas Theis, Ferenc Huszar, Jose Caballero, Andrew Aitken, Alykhan Tejani, Jo- ´ hannes Totz, Zehan Wang, and Wenzhe Shi. Photo-realistic single image super-resolution using a generative adversarial network. arXiv preprint arXiv:1609.04802, 2016.
207
+
208
+ Chuan Li and Michael Wand. Precomputed real-time texture synthesis with markovian generative adversarial networks. arXiv preprint arXiv:1604.04382, 2016.
209
+
210
+ Michael Mathieu, Camille Couprie, and Yann LeCun. Deep multi-scale video prediction beyond mean square error. arXiv preprint arXiv:1511.05440, 2015.
211
+
212
+ Luke Metz, Ben Poole, David Pfau, and Jascha Sohl-Dickstein. Unrolled generative adversarial networks. arXiv preprint arXiv:1611.02163, 2016.
213
+
214
+ Mehdi Mirza and Simon Osindero. Conditional generative adversarial nets. arXiv preprint arXiv:1411.1784, 2014.
215
+
216
+ Anh Nguyen, Jason Yosinski, Yoshua Bengio, Alexey Dosovitskiy, and Jeff Clune. Plug & play generative networks: Conditional iterative generation of images in latent space. arXiv preprint arXiv:1612.00005, 2016.
217
+
218
+ Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. arXiv preprint arXiv:1511.06434, 2015.
219
+
220
+ Scott Reed, Zeynep Akata, Xinchen Yan, Lajanugen Logeswaran, Bernt Schiele, and Honglak Lee. Generative adversarial text to image synthesis. arXiv preprint arXiv:1605.05396, 2016.
221
+
222
+ Masaki Saito and Eiichi Matsumoto. Temporal generative adversarial nets. arXiv preprint arXiv:1611.06624, 2016.
223
+
224
+ Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. arXiv preprint arXiv:1606.03498, 2016.
225
+
226
+ Casper Kaae Sønderby, Jose Caballero, Lucas Theis, Wenzhe Shi, and Ferenc Huszar. Amortised ´ map inference for image super-resolution. arXiv preprint arXiv:1610.04490, 2016.
227
+
228
+ Carl Vondrick, Hamed Pirsiavash, and Antonio Torralba. Generating videos with scene dynamics. In Advances In Neural Information Processing Systems, pp. 613–621, 2016.
229
+
230
+ Xiaolong Wang and Abhinav Gupta. Generative image modeling using style and structure adversarial networks. In ECCV, 2016.
231
+
232
+ Jiajun Wu, Chengkai Zhang, Tianfan Xue, William T Freeman, and Joshua B Tenenbaum. Learning a probabilistic latent space of object shapes via 3d generative-adversarial modeling. In Neural Information Processing Systems (NIPS), 2016.
233
+
234
+ Junbo Zhao, Michael Mathieu, and Yann LeCun. Energy-based generative adversarial network. arXiv preprint arXiv:1609.03126, 2016.
235
+
236
+ Yipin Zhou and Tamara L Berg. Learning temporal transformations from time-lapse videos. In European Conference on Computer Vision, pp. 262–277. Springer, 2016.
237
+
238
+ Jun-Yan Zhu, Philipp Krahenb ¨ uhl, Eli Shechtman, and Alexei A. Efros. Generative visual manipula- ¨ tion on the natural image manifold. In Proceedings of European Conference on Computer Vision (ECCV), 2016.
239
+
240
+ # A APPENDIX: PSEUDO CODE FOR MDGAN
241
+
242
+ In this Appendix, we give the detailed training procedure of an MDGAN example we discuss in Section 3.3.
243
+
244
+ # Manifold Step:
245
+
246
+ 1. Sample $\left\{ \mathbf { x } _ { 1 } , \mathbf { x } _ { 2 } , \cdots \mathbf { x } _ { m } \right\}$ from data generating distribution $p _ { d a t a } ( x )$
247
+
248
+ 2. Update discriminator $D _ { 1 }$ using SGD with gradient ascent:
249
+
250
+ $$
251
+ \nabla _ { \theta _ { d } ^ { 1 } } \frac { 1 } { m } \sum _ { i = 1 } ^ { m } [ \log D _ { 1 } ( \mathbf { x } _ { i } ) + \log ( 1 - D _ { 1 } ( G ( E ( \mathbf { x } _ { i } ) ) ) ) ]
252
+ $$
253
+
254
+ 3. Update generator $G$ using SGD with gradient ascent:
255
+
256
+ $$
257
+ \nabla _ { \theta _ { g } } \frac { 1 } { m } \sum _ { i = 1 } ^ { m } [ \lambda \log D _ { 1 } ( G ( E ( \mathbf { x } _ { i } ) ) ) - | | \mathbf { x } _ { i } - G ( E ( \mathbf { x } _ { i } ) ) | | ^ { 2 } ]
258
+ $$
259
+
260
+ # Diffusion Step:
261
+
262
+ 4. Sample $\left\{ \mathbf { x } _ { 1 } , \mathbf { x } _ { 2 } , \cdots \mathbf { x } _ { m } \right\}$ from data generating distribution $p _ { d a t a } ( x )$ .
263
+ 5. Sample $\{ \mathbf { z } _ { 1 } , \mathbf { z } _ { 2 } , \cdots \mathbf { z } _ { m } \}$ from prior distribution $p _ { \sigma } ( z )$ .
264
+ 6. Update discriminator $D _ { 2 }$ using SGD with gradient ascent:
265
+
266
+ $$
267
+ \nabla _ { \theta _ { d } ^ { 2 } } \frac { 1 } { m } \sum _ { i = 1 } ^ { m } [ \log D _ { 2 } ( G ( E ( \mathbf { x } _ { i } ) ) ) + \log ( 1 - D _ { 2 } ( \mathbf { z } _ { i } ) ) ]
268
+ $$
269
+
270
+ 7. Update generator $G$ using SGD with gradient ascent:
271
+
272
+ $$
273
+ \nabla _ { \boldsymbol { \theta } _ { g } } \frac { 1 } { m } \sum _ { i = 1 } ^ { m } [ \log D _ { 2 } ( G ( \mathbf { z } _ { i } ) ) ]
274
+ $$
275
+
276
+ # B APPENDIX: ARCHITECTURE FOR EXPERIMENTS
277
+
278
+ We use similar architectures for Compositional MNIST and CelebA experiments. The architecture is based on that found in DCGAN Radford et al. (2015). Apart from the discriminator and generator which are the same as DCGAN, we add an encoder which is the ”inverse” of the generator, by reversing the order of layers and replacing the de-convolutional layers with convolutional layers.
279
+
280
+ One has to pay particular attention to batch normalization layers. In DCGAN, there are batch normalization layers both in the generator and the discriminator. However, two classes of data go through the batch normalization layers in the generator. One come from sampled noise $z$ , the other one come from the encoder. In our implementation, we separate the batch statistics for these two classes of data in the generator, while keeping the parameters of BN layer to be shared. In this way, the batch statistics of these two kinds of batches cannot interfere with each other.
281
+
282
+ # C APPENDIX: ADDITIONAL SYNTHESIZED EXPERIMENTS
283
+
284
+ To demonstrate the effectiveness of mode-regularized GANs proposed in this paper, we train a very simple GAN architecture on synthesized 2D dataset, following Metz et al. (2016).
285
+
286
+ The data is sampled from a mixture of 6 Gaussians, with standard derivation of 0.1. The means of the Gaussians are placed around a circle with radius 5. The generator network has two ReLU hidden layers with 128 neurons. It generates 2D output samples from 3D uniform noise from [0,1]. The discriminator consists of only one fully connected layer of ReLU neurons, mapping the 2D input to a real 1D number. Both networks are optimized with the Adam optimizer with the learning rate of 1e-4.
287
+
288
+ In the regularized version, we choose $\lambda _ { 1 } = \lambda _ { 2 } = 0 . 0 0 5$ . The comparison between the generator distribution from standard GAN and our proposed regularized GAN are shown in Figure 9.
289
+
290
+ ![](images/2acc16f21eb9e8b9d0333914b869f7d2c9aea0b818b3a87da7a5c415e117f9f3.jpg)
291
+ Figure 9: Comparison results on a toy 2D mixture of Gaussians dataset. The columns on the left shows heatmaps of the generator distributions as the number of training epochs increases, whereas the rightmost column presents the target, the original data distribution. The top row shows standard GAN result. The generator has a hard time oscillating among the modes of the data distribution, and is only able to “recover” a single data mode at once. In contrast, the bottom row shows results of our regularized GAN. Its generator quickly captures the underlying multiple modes and fits the target distribution.
292
+
293
+ # D APPENDIX: COMPARISON WITH VAEGAN
294
+
295
+ In this appendix section, we demonstrate the effectiveness and uniqueness of mode-regularized GANs proposed in this paper as compared to Larsen et al. (2015) in terms of its theoretical difference, sample quality and number of missing modes.
296
+
297
+ With regard to the theoretical difference, the optimization of VAEGAN relies on the probabilistic variational bound, namely $p ( x ) \geq \mathbb { E } _ { q ( z | x ) } [ \log p ( x | z ) ] - { \mathrm { K L } } ( q ( z | x ) | | p ( z ) )$ . This variational bound together with a GAN loss is optimized with several assumptions imposed in VAEGAN:
298
+
299
+ 1. In general, VAE is based on the assumption that the true posterior $p ( z | x )$ can be well approximated by factorized Gaussian distribution $q$ .
300
+ 2. As to VAEGAN, It is also assumed that the maximum likelihood objectives does not conflict with GAN objective in terms of probabilistic framework.
301
+
302
+ The first assumption does not necessarily hold for GANs. We have found that in some trained models of DCGANs, the real posterior $p ( z | x )$ is even not guaranteed to have only one mode, not to mention it is anything close to factorized Gaussian. We believe that this difference in probabilistic framework is an essential obstacle when one tries to use the objective of VAEGAN as a regularizer. However, in our algorithm, where we use a plain auto-encoder instead of VAE as the objective. Plain auto-encooders works better than VAE for our purposes because as long as the model $G ( z )$ is able to generate training samples, there always exists a function $E ^ { \ast } ( x )$ such that $G ( E ( x ) ) = x$ . Our encoder can therefore be viewed as being trained to approximate this real encoder $E ^ { * }$ . There are no conflicts between a good GAN generator and our regularization objective. Hence, our objectives can be used as regularizers for encoding the prior knowledge that good models should be able to generate the training samples. This is why our work is essentially different from VAEGAN. In our experiments, we also believe that this is the reason why VAEGAN generates worse samples than a carefully tuned regularized GANs.
303
+
304
+ In terms of sample quality and missing modes, we run the official code of VAEGAN 3 with their default setting. We train VAEGAN for 30 epochs 4 and our models for only 20 epochs. For fairness, their model was run 3 times and the trained model with the best sample visual quality was taken for the comparison.
305
+
306
+ The generated samples are shown in Figure 10. The most obvious difference between our samples and VAEGAN’s samples is the face distortion, which is consistent with our experimental results in Section 4.2.2. We conjecture that the distortions of VAEGAN’s samples are due to the conflicts between the two objectives, as we present above. In other words, the way we introduce auto-encoders as regularizers for GAN models is different from VAEGAN’s. The difference is that the second assumption mentioned above is not required in our approaches. In our framework, the auto-encoders helps alter the generation manifolds, leading to fewer distortions in fine-grained details in our generated samples.
307
+
308
+ ![](images/e0082f3127f2aab9defa52d7d88f547f2ca4aa33600ecc6c7008814eebed363b.jpg)
309
+ Figure 10: Samples generated by our models and VAEGAN. The third line are samples generated by our self-trained VAEGAN model, with default settings. The last line are generated samples reported in the original VAEGAN paper. We depict both of them here for a fair comparison.
310
+
311
+ In terms of the missing modes problem, we use the same method described in Section 4.2.1 for computing the number of images with missing modes. The results are shown below.
312
+
313
+ Table 4: Number of images on the missing modes on CelebA estimated by a third-party discriminator. The numbers in the brackets indicate the dimension of prior $z$ . $\sigma$ denotes the standard deviation of the added Gaussian noise applied at the input of the discriminator to regularize it. MDGAN achieves a very high reduction in the number of missing modes, in comparison to VAEGAN.
314
+
315
+ <table><tr><td>0</td><td>VAEGAN (100)</td><td>Reg-GAN (100)</td><td>Reg-GAN (200)</td><td>MDGAN (200)</td></tr><tr><td>3.5</td><td>9720</td><td>754</td><td>3644</td><td>74</td></tr><tr><td>4.0</td><td>5862</td><td>42</td><td>391</td><td>13</td></tr></table>
316
+
317
+ We see that using our proposed regularizers results in a huge drop in the number of missing modes. We conjecture that the reason why VAEGAN performs very bad in our metric for missing modes is because the samples generated are of low quality, so the discriminator classifies the samples as “not on mode”. Namely, the data generated is too far away from many real data modes. Essentially if a model generates very bad samples, we can say that the model misses all or most modes.
318
+
319
+ To conduct more fair evaluation between VAEGAN and our methods, we also perform a blind human evaluation. Again we instructed five individuals to conduct this evaluation of sample variability. Without telling them which is generated by VAEGAN and which is generated by our methods, four people agree that our method wins in terms of sample diversity. One person thinks the samples are equally diverse.
320
+
321
+ In conclusion, we demonstrate that our proposed mode-regularized GANs, i.e., Reg-GAN and MDGAN, are different from VAEGAN theoretically as discussed above. Such differences empirically result in better sample quality and mode preserving ability, which are our main contributions.
md/train/HJMC_iA5tm/HJMC_iA5tm.md ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LEARNING A SAT SOLVER FROM SINGLE-BIT SUPER-VISION
2
+
3
+ Daniel Selsam, Matthew Lamm, Benedikt Bunz, Percy Liang, David L. Dill ¨
4
+
5
+ Department of Computer Science
6
+ Stanford University
7
+ Stanford, CA 94305
8
+ {dselsam,mlamm,buenz,pliang,dill}@cs.stanford.edu
9
+
10
+ Leonardo de Moura Microsoft Research Redmond, WA 98052 leonardo@microsoft.com
11
+
12
+ # ABSTRACT
13
+
14
+ We present NeuroSAT, a message passing neural network that learns to solve SAT problems after only being trained as a classifier to predict satisfiability. Although it is not competitive with state-of-the-art SAT solvers, NeuroSAT can solve problems that are substantially larger and more difficult than it ever saw during training by simply running for more iterations. Moreover, NeuroSAT generalizes to novel distributions; after training only on random SAT problems, at test time it can solve SAT problems encoding graph coloring, clique detection, dominating set, and vertex cover problems, all on a range of distributions over small random graphs.
15
+
16
+ # 1 INTRODUCTION
17
+
18
+ The propositional satisfiability problem (SAT) is one of the most fundamental problems of computer science. Cook (1971) showed that the problem is NP-complete, which means that searching for any kind of efficiently-checkable certificate in any context can be reduced to finding a satisfying assignment of a propositional formula. In practice, search problems arising from a wide range of domains such as hardware and software verification, test pattern generation, planning, scheduling, and combinatorics are all routinely solved by constructing an appropriate SAT problem and then calling a SAT solver (Gomes et al., 2008). Modern SAT solvers based on backtracking search are extremely well-engineered and have been able to solve problems of practical interest with millions of variables (Biere et al., 2009).
19
+
20
+ We consider the question: can a neural network learn to solve SAT problems? To answer, we develop a novel message passing neural network (MPNN) (Scarselli et al., 2009; Li et al., 2015; Gilmer et al., 2017), NeuroSAT, and train it as a classifier to predict satisfiability on a dataset of random SAT problems. We provide NeuroSAT with only a single bit of supervision for each SAT problem that indicates whether or not the problem is satisfiable. When making a prediction about a new SAT problem, we find that NeuroSAT guesses unsatisfiable with low confidence until it finds a solution, at which point it converges and guesses satisfiable with very high confidence. The solution itself can almost always be automatically decoded from the network’s activations, making NeuroSAT an end-to-end SAT solver. See Figure 1 for an illustration of the train and test regimes.
21
+
22
+ Although it is not competitive with state-of-the-art SAT solvers, NeuroSAT can solve SAT problems that are substantially larger and more difficult than it ever saw during training by simply performing more iterations of message passing. Despite only running for a few dozen iterations during training, at test time NeuroSAT continues to find solutions to harder problems after hundreds and even thousands of iterations. The learning process has yielded not a traditional classifier but rather a procedure that can be run indefinitely to search for solutions to problems of varying difficulty.
23
+
24
+ ![](images/1d225b957fb03a6856771f4a7ff69ce2bb215e56e9ecf9dadd0703c9dec0e7b8.jpg)
25
+ Figure 1: We train NeuroSAT to predict whether SAT problems are satisfiable, providing only a single bit of supervision for each problem. At test time, when NeuroSAT predicts satisfiable, we can almost always extract a satisfying assignment from the network’s activations. The problems at test time can also be substantially larger, more difficult, and even from entirely different domains than the problems seen during training.
26
+
27
+ Moreover, NeuroSAT generalizes to entirely new domains. Since NeuroSAT operates on SAT problems and since SAT is NP-complete, NeuroSAT can be queried on SAT problems encoding any kind of search problem for which certificates can be checked in polynomial time. Although we train it using only problems from a single random problem generator, at test time it can solve SAT problems encoding graph coloring, clique detection, dominating set, and vertex cover problems, all on a range of distributions over small random graphs.
28
+
29
+ The same neural network architecture can also be used to help construct proofs for unsatisfiable problems. When we train it on a different dataset in which every unsatisfiable problem contains a small contradiction (call this trained model NeuroUNSAT), it learns to detect these contradictions instead of searching for satisfying assignments. Just as we can extract solutions from NeuroSAT’s activations, we can extract the variables involved in the contradiction from NeuroUNSAT’s activations. When the number of variables involved in the contradiction is small relative to the total number of variables, knowing which variables are involved in the contradiction can enable constructing a resolution proof more efficiently.
30
+
31
+ # 2 PROBLEM SETUP
32
+
33
+ Background. A formula of propositional logic is a boolean expression built using the constants true (1) and false (0), variables, negations, conjunctions, and disjunctions. A formula is satisfiable provided there exists an assignment of boolean values to its variables such that the formula evaluates to 1. For example, the formula $( x _ { 1 } \lor x _ { 2 } \lor x _ { 3 } ) \land \lnot ( x _ { 1 } \land x _ { 2 } \land x _ { 3 } )$ is satisfiable because it will evaluate to 1 under every assignment that does not map $x _ { 1 }$ , $x _ { 2 }$ and $x _ { 3 }$ to the same value. For every formula, there exists an equisatisfiable formula in conjunctive normal form (CNF), expressed as a conjunction of disjunctions of (possibly negated) variables.1 Each conjunct of a formula in CNF is called a clause, and each (possibly negated) variable within a clause is called a literal. The formula above is equivalent to the CNF formula $\left( x _ { 1 } \lor x _ { 2 } \lor x _ { 3 } \right) \land \left( \lnot x _ { 1 } \lor \lnot x _ { 2 } \lor \lnot x _ { 3 } \right)$ , which we can represent more concisely as $\{ 1 | 2 | 3 , { \overline { { 1 } } } | { \overline { { 2 } } } | { \overline { { 3 } } } \}$ . A formula in CNF has a satisfying assignment if and only if it has an assignment such that every clause has at least one literal mapped to 1. A SAT problem is a formula in CNF, where the goal is to determine if the formula is satisfiable, and if so, to produce a satisfying assignment of truth values to variables. We use $n$ to denote the number of of variables in a SAT problem, and $m$ to denote the number of clauses.
34
+
35
+ Classification task. For a SAT problem $P$ , we define $\phi ( P )$ to be true if and only if $P$ is satisfiable. Our first goal is to learn a classifier that approximates $\phi$ . Given a distribution $\Psi$ over SAT problems, we can construct datasets $\mathcal { D } _ { \mathrm { t r a i n } }$ and $\mathcal { D } _ { \mathrm { t e s t } }$ with examples of the form $( P , \phi ( P ) )$ by sampling problems $P \sim \Psi$ and computing $\phi ( P )$ using an existing SAT solver. At test time, we get only the problem $P$ and the goal is to predict $\phi ( P )$ , i.e. to determine if $P$ is satisfiable. Ultimately we care about the solving task, which also includes finding solutions to satisfiable problems.
36
+
37
+ # 3 MODEL
38
+
39
+ A SAT problem has a simple syntactic structure and therefore could be encoded into a vector space using standard methods such as an RNN. However, the semantics of propositional logic induce rich invariances that such a syntactic method would ignore, such as permutation invariance and negation invariance. Specifically, the satisfiability of a formula is not affected by permuting the variables (e.g. swapping $x _ { 1 }$ and $x _ { 2 }$ throughout the formula), by permuting the clauses (e.g. swapping the first clause with the second clause), or by permuting the literals within a clause (e.g. replacing the clause $1 | \overline { { 2 } }$ with $\overline { { 2 } } | 1$ . The satisfiability of a formula is also not affected by negating every literal corresponding to a given variable (e.g. negating all occurrences of $x _ { 1 }$ in $\{ 1 | \overline { { 2 } } , \overline { { 1 } } | \overline { { 3 } } \}$ to yield $\{ { \overline { { 1 } } } | { \overline { { 2 } } } , 1 | { \overline { { 3 } } } \} )$ .
40
+
41
+ We now describe our neural network architecture, NeuroSAT, that enforces both permutation invariance and negation invariance. We encode a SAT problem as an undirected graph with one node for every literal, one node for every clause, an edge between every literal and every clause it appears in, and a different type of edge between each pair of complementary literals (e.g. between $x _ { i }$ and $\overline { { x _ { i } } }$ ). NeuroSAT iteratively refines a vector space embedding for each node by passing “messages” back and forth along the edges of the graph as described in Gilmer et al. (2017). At every time step, we have an embedding for every literal and every clause. An iteration consists of two stages. First, each clause receives messages from its neighboring literals and updates its embedding accordingly. Next, each literal receives messages from its neighboring clauses as well as from its complement, then updates its embedding accordingly. Figure 2 provides a high-level illustration of the architecture.
42
+
43
+ ![](images/f0aae2ef71377da7802b98440976e9a312f6b983b1f98b853dd17e23a76f7d0b.jpg)
44
+ Figure 2: High-level illustration of NeuroSAT operating on the graph representation of $\{ 1 | 2 , { \overline { { 1 } } } | { \overline { { 2 } } } \}$ . On the top of both figures are nodes for each of the four literals, and on the bottom are nodes for each of the two clauses. At every time step $t$ , we have an embedding for every literal and every clause. An iteration consists of two stages. First, each clause receives messages from its neighboring literals and updates it embedding accordingly (Figure 2a). Next, each literal receives messages from its neighboring clause as well as from its complement, and updates its embedding accordingly (Figure 2b).
45
+
46
+ More formally, our model is parameterized by two vectors $\mathbf { L } _ { \mathrm { i n i t } }$ , $\mathbf { C } _ { \mathrm { i n i t } } )$ , three multilayer perceptrons $( \mathbf { L } _ { \mathrm { m s g } } , \mathbf { C } _ { \mathrm { m s g } } , \mathbf { L } _ { \mathrm { v o t e } } )$ and two layer-norm LSTMs (Ba et al., 2016; Hochreiter & Schmidhuber, 1997) $( { \bf L } _ { \bf u } , { \bf C } _ { \bf u } )$ . At every time step $t$ , we have a matrix $L ^ { ( t ) } \in \mathbb { R } ^ { 2 n \times d }$ whose ith row contains the embedding for the literal $\ell _ { i }$ and a matrix $C ^ { ( t ) } \in \mathbb { R } ^ { m \times d }$ whose $j$ th row contains the embedding for the clause $c _ { j }$ , which we initialize by tiling $\mathbf { L } _ { \mathrm { i n i t } }$ and $\mathbf { C } _ { \mathrm { i n i t } }$ respectively. We also have hidden states $L _ { h } ^ { ( t ) } \in \mathbb { R } ^ { 2 n \times d }$ and artite $C _ { h } ^ { ( t ) } \in \mathbb { R } ^ { m \times d }$ for atrix $\mathbf { L } _ { \mathrm { u } }$ and fined $\mathbf { C } _ { \mathbf { u } }$ alized to zero matrices. Letand let Flip be the operator $M$ $M ( i , j ) = \mathrm { ~ \bar { 1 } ~ } \{ \ell _ { i } \in c _ { j } \}$
47
+ that takes a matrix $L$ and swaps each row of $L$ with the row corresponding to the literal’s negation. A single iteration consists of applying the following two updates:
48
+
49
+ $$
50
+ \begin{array} { r l } & { ( C ^ { ( t + 1 ) } , C _ { h } ^ { ( t + 1 ) } ) \gets \mathbf { C } _ { \mathbf { u } } ( [ C _ { h } ^ { ( t ) } , M ^ { \top } \mathbf { L } _ { \mathrm { m s g } } ( L ^ { ( t ) } ) ] ) } \\ & { ( L ^ { ( t + 1 ) } , L _ { h } ^ { ( t + 1 ) } ) \gets \mathbf { L } _ { \mathbf { u } } ( [ L _ { h } ^ { ( t ) } , \mathrm { F l i p } ( L ^ { ( t ) } ) , M \mathbf { C } _ { \mathrm { m s g } } ( C ^ { ( t + 1 ) } ) ] ) } \end{array}
51
+ $$
52
+
53
+ After $T$ iterations, we compute $L _ { * } ^ { ( T ) } \mathbf { L } _ { \mathrm { v o t e } } ( L ^ { ( T ) } ) \in \mathbb { R } ^ { 2 n }$ , which contains a single scalar for each literal (the literal’s vote), and then we compute the average of the literal votes $y ^ { ( T ) } \gets \mathrm { m e a n } ( L _ { * } ^ { ( T ) } ) \in$ $\mathbb { R }$ . We train the network to minimize the sigmoid cross-entropy loss between the logit $y ^ { ( T ) }$ and the true label $\phi ( P )$ .
54
+
55
+ Our architecture enforces permutation invariance by operating on nodes and edges according to the topology of the graph without any additional ordering over nodes or edges. Likewise, it enforces negation invariance by treating all literals the same no matter whether they originated as a positive or negative occurrence of a variable.
56
+
57
+ ![](images/eddc765e938654a29717017c9c02dd342e57d38a5f900cee4678095d179f8f86.jpg)
58
+ Iteration
59
+ Figure 3: The sequence of literal votes $L _ { * } ^ { ( 1 ) }$ 1) to L(24)∗ as NeuroSAT runs on a satisfiable problem from SR(20). For clarity, we reshape each $L _ { * } ^ { ( t ) }$ to be an $\mathbb { R } ^ { n \times 2 }$ matrix so that each literal is paired with its complement; specifically, the ith row contains the scalar votes for $x _ { i }$ and $\overline { { x _ { i } } }$ . Here white represents zero, blue negative and red positive. For several iterations, almost every literal is voting unsat with low confidence (light blue). Then a few scattered literals start voting sat for the next few iterations, but not enough to affect the mean vote. Suddenly there is a phase transition and all the literals (and hence the network as a whole) start to vote sat with very high confidence (dark red). After the phase transition, the vote for each literal converges and the network stops evolving.
60
+
61
+ We stress that none of the learned parameters depend on the size of the SAT problem and that a single model can be trained and tested on problems of arbitrary and varying sizes. At both train and test time, the input to the model is simply any bipartite adjacency matrix $M$ over any number of literals and clauses. The learned parameters only determine how each individual literal and clause behaves in terms of its neighbors in the graph. Variation in problem size is handled by the aggregation operators: we sum the outgoing messages of each of a node’s neighbors to form the incoming message, and we take the mean of the literal votes at the end of message passing to form the logit $y ^ { ( T ) }$ .
62
+
63
+ # 4 TRAINING DATA
64
+
65
+ We want our neural network to be able to classify (and ultimately solve) SAT problems from a variety of domains that it never trained on. One can easily construct distributions over SAT problems for which it would be possible to predict satisfiability with perfect accuracy based only on crude statistics; however, a neural network trained on such a distribution would be unlikely to generalize to problems from other domains. To force our network to learn something substantive, we create a distribution $\mathbf { S R } ( n )$ over pairs of random SAT problems on $n$ variables with the following property: one element of the pair is satisfiable, the other is unsatisfiable, and the two differ by negating only a single literal occurrence in a single clause. To generate a random clause on $n$ variables, $\mathbf { S R } ( n )$ first samples a small integer $k$ (with mean 5) 2 then samples $k$ variables uniformly at random without replacement, and finally negates each one with independent probability $50 \%$ . It continues to generate clauses $c _ { i }$ in this fashion, adding them to the SAT problem, and then querying a traditional SAT solver (we used Minisat Sorensson & Een (2005)), until adding the clause $c _ { m }$ finally makes the problem unsatisfiable. Since $\{ c _ { 1 } , \ldots , c _ { m - 1 } \}$ had a satisfying assignment, negating a single literal in $c _ { m }$ must yield a satisfiable problem $\{ c _ { 1 } , \ldots , c _ { m - 1 } , c _ { m } ^ { \prime } \}$ . The pair $( \{ c _ { 1 } , \hdots , c _ { m - 1 } , c _ { m } \} , \{ c _ { 1 } , \hdots , c _ { m - 1 } , c _ { m } ^ { \prime } \} )$ are a sample from $\mathbf { S R } ( n )$ .
66
+
67
+ # 5 PREDICTING SATISFIABILITY
68
+
69
+ Although our ultimate goal is to solve SAT problems arising from a variety of domains, we begin by training NeuroSAT as a classifier to predict satisfiability on SR(40). Problems in $\mathbf { S R } ( 4 0 )$ are small enough to be solved efficiently by modern SAT solvers—a fact we rely on to generate the problems—but the classification problem is highly non-trivial from a machine learning perspective. Each problem has 40 variables and over 200 clauses on average, and the positive and negative examples differ by negating only a single literal occurrence out of a thousand. We were unable to train an LSTM on a many-hot encoding of clauses (specialized to problems with 40 variables) to predict with $5 5 0 \%$ accuracy on its training set. Even the canonical SAT solver MiniSAT (Sorensson & Een, 2005) needs to backjump3 almost ten times on average, and needs to perform over a hundred primitive logical inferences (i.e. unit propagations) to solve each problem.
70
+
71
+ We instantiated the NeuroSAT architecture described in $\ S 3$ with $d = 1 2 8$ dimensions for the literal embeddings, the clause embeddings, and all the hidden units; 3 hidden layers and a linear output layer for each of the MLPs $\mathbf { L } _ { \mathrm { m s g } }$ , $\mathbf { C } _ { \mathrm { m s g } }$ , and $\scriptstyle \mathbf { L } _ { \mathrm { v o t e } }$ ; and rectified linear units for all non-linearities. We regularized by the $\ell _ { 2 }$ norm of the parameters scaled by $1 0 ^ { - 1 0 }$ , and performed $T = 2 6$ iterations of message passing on every problem. We trained our model using the ADAM optimizer (Kingma & Ba, 2014) with a learning rate of $2 \times 1 0 ^ { - 5 }$ , clipping the gradients by global norm with clipping ratio 0.65 (Pascanu et al., 2012). We batched multiple problems together, with each batch containing up to 12,000 nodes (i.e. literals plus clauses). To accelerate the learning, we sampled the number of variables $n$ uniformly from between 10 and 40 during training (i.e. we trained on $\mathbf { S R ( U ( 1 0 , 4 0 ) ) } )$ , though we only evaluate on SR(40). We trained on millions of problems.
72
+
73
+ After training, NeuroSAT is able to classify the test set correctly with $8 5 \%$ accuracy. In the next section, we examine how NeuroSAT manages to do so and show how we can decode solutions to satisfiable problems from its activations. Note: for the entire rest of the paper, NeuroSAT refers to the specific trained model that has only been trained on $\mathbf { S R } ( \mathbf { U } ( 1 0 , 4 0 ) )$ .
74
+
75
+ # 6 DECODING SATISFYING ASSIGNMENTS
76
+
77
+ Let us try to understand what NeuroSAT (trained on $\mathbf { S R ( U ( 1 0 , 4 0 ) ) } )$ is computing as it runs on new problems at test time. For a given run, we can compute and visualize the $2 n$ -dimensional vector of literal votes $L _ { * } ^ { ( t ) } \gets \mathbf { L } _ { \mathrm { v o t e } } ( L ^ { ( t ) } )$ at every iteration $t$ . Figure 3 illustrates the sequence of literal votes $L _ { * } ^ { ( 1 ) }$ ) to L(24)∗ a s NeuroSAT runs on a satisfiable problem from SR(20). For clarity, we reshape each $L _ { * } ^ { ( t ) }$ to be an $\mathbb { R } ^ { n \times 2 }$ matrix so that each literal is paired with its complement; specifically, the ith row contains the scalar votes for $x _ { i }$ and $\overline { { x _ { i } } }$ . Here white represents zero, blue negative and red positive. For several iterations, almost every literal is voting unsat with low confidence (light blue). Then a few scattered literals start voting sat for the next few iterations, but not enough to affect the mean vote. Suddenly, there is a phase transition and all the literals (and hence the network as a whole) start to vote sat with very high confidence (dark red). After the phase transition, the vote for each literal converges and the network stops evolving.
78
+
79
+ NeuroSAT seems to exhibit qualitatively similar behavior on every satisfiable problem that it predicts correctly. The problems for which NeuroSAT guesses unsat are similar except without the phase change: it continues to guess unsat with low-confidence for as many iterations as NeuroSAT runs for. NeuroSAT never becomes highly confident that a problem is unsat, and it almost never guesses sat on an unsat problem. These results suggest that NeuroSAT searches for a certificate of satisfiability, and that it only guesses sat once it has found one.
80
+
81
+ Let us look more carefully at the literal votes $L _ { * } ^ { ( 2 4 ) }$ from Figure 3 after convergence. Note that most of the variables have one literal vote distinctly darker than the other. Moreover, the dark votes are all approximately equal to each other, and the light votes are all approximately equal to each other as well. Thus the votes seem to encode one bit for each variable. It turns out that these bits encode a satisfying assignment in this case, but they do not do so reliably in general. Recall from $\ S 3$ that NeuroSAT projects the higher dimensional literal embeddings $L ^ { ( \bar { T } ) } \in \bar { \mathbb { R } } ^ { 2 n \times d }$ to the literal votes $L _ { * } ^ { ( T ) }$ using the MLP $\scriptstyle \mathbf { L } _ { \mathrm { v o t e } }$ . Figure 4 illustrates the two-dimensional PCA embeddings for $L ^ { ( 1 2 ) }$ to $L ^ { ( 2 6 ) }$ (skipping every other time step) as NeuroSAT runs on a satisfiable problem from SR(40). Blue and red dots indicate literals that are set to 0 and 1 in the satisfying assignment that it eventually finds, respectively. The blue and red dots cannot be linearly separated until the phase transition at the end, at which point they form two distinct clusters according to the satisfying assignment. We observe a similar clustering almost every time the network guesses sat. Thus the literal votes $L _ { * } ^ { ( T ) }$ only ever encode the satisfying assignment by chance, when the projection $\scriptstyle \mathbf { L } _ { \mathrm { v o t e } }$ happens to preserve this clustering.
82
+
83
+ <table><tr><td>Trained on: Trained with: Tested on: Tested with: Overall test accuracy: Accuracy on unsat problems: Accuracy on sat problems: Percent of sat problems solved:</td><td>SR(U(10,40)) 26 iterations SR(40) 26 iterations 85% 96%</td></tr></table>
84
+
85
+ Our analysis suggests a more reliable way to decode solutions from NeuroSAT’s internal activations: 2-cluster $L ^ { ( T ) }$ to get cluster centers $\Delta _ { 1 }$ and $\Delta _ { 2 }$ , partition the variables according to the predicate $\lVert x _ { i } - \Delta _ { 1 } \rVert ^ { 2 } + \lVert \overline { { x _ { i } } } - \Delta _ { 2 } \rVert ^ { 2 } < \lVert x _ { i } - \Delta _ { 2 } \rVert ^ { 2 } + \lVert \overline { { x _ { i } } } - \bar { \Delta _ { 1 } } \rVert ^ { 2 }$ , and then try both candidate assignments that result from mapping the partitions to truth values. This decoding procedure (using $k$ -means to find the two cluster centers) successfully decodes a satisfying assignment for over $7 0 \%$ of the satisfiable problems in the $\mathbf { S R } ( 4 0 )$ test set. Table 1 summarizes the results when training on $\mathbf { S R } ( \mathbf { U } ( 1 0 , 4 0 ) )$ ) and testing on SR(40).
86
+
87
+ ![](images/b2b93ec940f8c8d4be4ceb084ea9fda5f802889227023d9d651d2520db825f72.jpg)
88
+ Table 1: NeuroSAT’s performance at test time on $\mathbf { S R } ( 4 0 )$ after training on $\mathbf { S R } ( \mathbf { U } ( 1 0 , 4 0 ) )$ . It almost never guesses sat on unsatisfiable problems. On satisfiable problems, it correctly guesses sat $73 \%$ of the time, and we can decode a satisfying assignment for $70 \%$ of the satisfiable problems by clustering the literal embeddings $L ^ { ( T ) }$ as described in $\ S 6$ .
89
+ Figure 4: PCA projections for the high-dimensional literal embeddings $L ^ { ( 1 2 ) }$ to $L ^ { ( 2 6 ) }$ (skipping every other time step) as NeuroSAT runs on a satisfiable problem from SR(40). Blue and red dots indicate literals that are set to 0 and 1 in the satisfying assignment that it eventually finds, respectively. We see that the blue and red dots are mixed up and cannot be linearly separated until the phase transition at the end, at which point they form two distinct clusters according to the satisfying assignment.
90
+
91
+ Recall that at training time, NeuroSAT is only given a single bit of supervision for each SAT problem. Moreover, the positive and negative examples in the dataset differ only by the placement of a single edge. NeuroSAT has learned to search for satisfying assignments solely to explain that single bit of supervision.
92
+
93
+ # 7 EXTRAPOLATING TO OTHER PROBLEM DISTRIBUTIONS
94
+
95
+ # 7.1 BIGGER PROBLEMS
96
+
97
+ Even though we only train NeuroSAT on $\mathbf { S R } ( \mathbf { U } ( 1 0 , 4 0 ) )$ , it is able to solve SAT problems sampled from $\mathbf { S R } ( n )$ for $n$ much larger than 40 by simply running for more iterations of message passing. Figure 5 shows NeuroSAT’s success rate on $\mathbf { S R } ( n )$ for a range of $n$ as a function of the number of iterations $T$ . For $n = 2 0 0$ , there are $2 ^ { 1 6 0 }$ times more possible assignments to the variables than any problem it saw during training, and yet it can solve $2 5 \%$ of the satisfiable problems in SR(200) by running for four times more iterations than it performed during training. On the other hand, when restricted to the number of iterations it was trained with, it solves under $10 \%$ of them. Thus we see that its ability to solve bigger and harder problems depends on the fact that the dynamical system it has learned encodes generic procedural knowledge that can operate effectively over a wide range of time frames.
98
+
99
+ ![](images/dbe3a32da539b3b746da55e6820e1c1309ef869418443eaf7cb15324a6c0c755.jpg)
100
+ Figure 5: NeuroSAT’s success rate on $\mathbf { S R } ( n )$ for a range of $n$ as a function of the number of iterations $T$ . Even though we only train NeuroSAT on $\mathbf { S R } ( 4 0 )$ and below, it is able to solve SAT problems sampled from $\mathbf { S R } ( n )$ for $n$ much larger than 40 by simply running for more iterations.
101
+
102
+ ![](images/2057d6fd092a8ad0636c64dc52a0e726556d1b2ea9e61829c6e767ae383eebb6.jpg)
103
+ Figure 6: Example graph from the Forest-Fire distribution. The graph has a coloring for $k \geq 5$ , a clique for $k \leq 3$ , a dominating set for $k \geq 3$ , and a vertex cover for $k \geq 6$ . However, these properties are not perceptually obvious and require deliberate computation to determine.
104
+
105
+ # 7.2 DIFFERENT PROBLEMS
106
+
107
+ Every problem in NP can be reduced to SAT in polynomial time, and SAT problems arising from different domains may have radically different structural and statistical properties. Even though NeuroSAT has learned to search for satisfying assignments on problems from $\mathbf { S R } ( n )$ , we may still find that the dynamical system it has learned only works properly on problems similar to those it was trained on.
108
+
109
+ To assess NeuroSAT’s ability to extrapolate to different classes of problems, we generated problems in several other domains and then encoded them all into SAT problems (using standard encodings). In particular, we started by generating one hundred graphs from each of six different random graph distributions (Barabasi, Erdos-Renyi, Forest-Fire, Random-¨ $k$ -Regular, Random-Static-Power-Law, and Random-Geometric).4 We found parameters for the random graph generators such that each graph has ten nodes and seventeen edges on average. For each graph in each collection, we generated graph coloring problems $( 3 \leq k \leq 5 )$ ), dominating-set problems $( 2 \leq k \leq 4 )$ ), clique-detection problems $( 3 ~ \leq ~ k ~ \leq ~ 5 )$ , and vertex cover problems $( 4 ~ \leq ~ k ~ \leq ~ 6 )$ .5 We chose the range of $k$ for each problem to include the threshold for most of the graphs while avoiding trivial problems such as 2-clique. As before, we used Minisat Sorensson & Een (2005) to determine satisfiability. Figure 6 shows an example graph from the distribution. Note that the trained network does not know anything a priori about these tasks; the generated SAT problems need to encode not only the graphs themselves but also formal descriptions of the tasks to be solved.
110
+
111
+ Out of the 7,200 generated problems, we kept only the 4,888 satisfiable problems. On average these problems contained over two and a half times as many clauses as the problems in SR(40). We ran NeuroSAT for 512 iterations on each of them and found that we could successfully decode solutions for $8 5 \%$ of them. In contrast, Survey Propagation (SP) (Braunstein et al., 2005), the canonical (learning-free) message passing algorithm for satisfiability, does not on its own converge to a satisfying assignment on any of these problems.6 This suggests that NeuroSAT has not simply found a way to approximate SP, but rather has synthesized a qualitatively different algorithm.
112
+
113
+ # 8 FINDING UNSAT CORES
114
+
115
+ NeuroSAT (trained on $\mathbf { S R ( U ( 1 0 , 4 0 ) ) } \rangle$ can find satisfying assignments but is not helpful in constructing proofs of unsatisfiability. When it runs on an unsatisfiable problem, it keeps searching for a satisfying assignment indefinitely and non-systematically. However, when we train the same architecture on a dataset in which each unsatisfiable problem has a small subset of clauses that are already unsatisfiable (called an unsat core), it learns to detect these unsat cores instead of searching for satisfying assignments. The literals involved in the unsat core can be decoded from its internal activations. When the number of literals involved in the unsat core is small relative to the total number of literals, knowing the literals involved in the unsat core can enable constructing a resolution proof more efficiently.
116
+
117
+ We generated a new distribution $\mathbf { S R C } ( n , u )$ that is similar to $\mathbf { S R } ( n )$ except that every unsatisfiable problem contains a small unsat core. Here $n$ is the number of variables as before, and $u$ is an unsat core over $x _ { 1 } , \ldots , x _ { k }$ $( k < n )$ that can be made into a satisfiable set of clauses $u ^ { \prime }$ by negating a single literal. We sample a pair from $\mathbf { S R C } ( n , u )$ as follows. First, we initialize a problem with $u ^ { \prime }$ , and then we sample clauses (over $x _ { 1 }$ to $x _ { n }$ ) just as we did for $\mathbf { S R } ( n )$ until the problem becomes unsatisfiable. We can now negate a literal in the final clause to get a satisfiable problem $p _ { s }$ , and then we can swap $u ^ { \prime }$ for $u$ in $p _ { s }$ to get $p _ { u }$ , which is unsatisfiable since it contains the unsat core $u$ . We created train and test datasets from $\mathbf { S R C } ( 4 0 , u )$ with $u$ sampled at random for each problem from a collection of three unsat cores ranging from three clauses to nine clauses: the unsat core $R$ from Knuth (2015), and the two unsat cores resulting from encoding the pigeonhole principles $\mathbf { P P } ( 2 , 1 )$ and $\mathbf { P P } ( 3 , 2 )$ . 7 We trained our architecture on this dataset, and we refer to the trained model as NeuroUNSAT.
118
+
119
+ ![](images/2066957dcb07a7a9e9535cf1b143befffa21bfff5771e38c35e096823d40388f.jpg)
120
+ (b) NeuroUNSAT running on an unsatisfiable problem.
121
+
122
+ (a) NeuroUNSAT running on a satisfiable problem.
123
+
124
+ ![](images/eb4246e96b30294841909d61559d94429bb6ad22b8aa7eb85c820bd8894b2939.jpg)
125
+ Figure 7: The sequence of literal votes $L _ { * } ^ { ( t ) }$ as NeuroUNSAT runs on a pair of problems from $\mathbf { S } \bar { \mathbf { R C } } ( 3 0 , \mathbf { P P } ( 3 , \bar { 2 } ) )$ . In both cases, the literals in the first six rows are involved in the unsat core. In 7a, NeuroUNSAT inspects the modified core $u ^ { \prime }$ of the satisfiable problem but concludes that it does not match the pattern. In 7b, NeuroUNSAT finds the unsat core $u$ and votes unsat with high confidence (dark blue).
126
+
127
+ NeuroUNSAT is able to predict satisfiability on the test set with $100 \%$ accuracy. Upon inspection, it seems to do so by learning to recognize the unsat cores. Figure 7 shows NeuroUNSAT running on a pair of problems from $\bar { \mathbf { S } } \mathbf { R } \mathbf { C } ( 3 0 , \mathbf { \bar { P } } \mathbf { P } ( 3 , 2 ) )$ . In both cases, the literals in the first six rows are involved in the unsat core. In Figure 7a, NeuroUNSAT inspects the modified core $u ^ { \prime }$ of the satisfiable problem but concludes that it does not match the pattern exactly. In Figure 7b, NeuroUNSAT finds the unsat core $u$ and votes unsat with high confidence (dark blue). As in $\ S 6$ , the literals involved in the unsat core can sometimes be decoded from the literal votes $L _ { * } ^ { ( T ) }$ , but it is more reliable to 2- cluster the higher-dimensional literal embeddings $L ^ { ( T ) }$ . On the test set, the small number of literals involved in the unsat core end up in their own cluster $98 \%$ of the time.
128
+
129
+ Note that we do not expect NeuroUNSAT to generalize to arbitary unsat cores: as far as we know it is simply memorizing a collection of specific subgraphs, and there is no evidence it has learned a generic procedure to prove unsat.
130
+
131
+ # 9 RELATED WORK
132
+
133
+ There have been many attempts over the years to apply statistical learning to various aspects of the SAT problem: restart strategies (Haim & Walsh, 2009), branching heuristics (Liang et al., 2016;
134
+
135
+ Grozea & Popescu, 2014; Flint & Blaschko, 2012), parameter tuning (Singh et al., 2009), and solver selection (Xu et al., 2008). None of these approaches use neural networks, and instead make use of both generic graph features and features extracted from the runs of SAT solvers. Moreover, these approaches are designed to assist existing solvers and do not aim to solve SAT problems on their own.
136
+
137
+ From the machine learning perspective, the closest work to ours is Palm et al. (2017), which showed that an MPNN can be trained to predict the unique solutions of Sudoku puzzles. We believe that their network’s success is an instance of the phenomenon we study in this paper, namely that MPNNs can synthesize local search algorithms for constraint satisfaction problems. Evans et al. (2018) present a neural network architecture that can learn to predict whether one propositional formula entails another by randomly sampling and evaluating candidate assignments. Unlike NeuroSAT, their network does not perform heuristic search and can only work on simple problems for which random guessing is tractable. There have also been several recent papers showing that various neural network architectures can learn good heuristics for NP-hard combinatorial optimization problems (Vinyals et al., 2015; Bello et al., 2016; Dai et al., 2017); however, finding low-cost solutions to optimization problems requires less precise reasoning than finding satisfying assignments.
138
+
139
+ # 10 DISCUSSION
140
+
141
+ Our main motivation has been scientific: to better understand the extent to which neural networks are capable of precise, logical reasoning. Our work has definitively established that neural networks can learn to perform discrete search on their own without the help of hard-coded search procedures, even after only end-to-end training with minimal supervision. We found this result surprising and think it constitutes an important contribution to the community’s evolving understanding of the capabilities and limitations of neural networks.
142
+
143
+ Although not our primary concern, we also hope that our findings eventually lead to improvements in practical SAT solving. As we stressed early on, as an end-to-end SAT solver the trained NeuroSAT system discussed in this paper is still vastly less reliable than the state-of-the-art. We concede that we see no obvious path to beating existing SAT solvers. One approach might be to continue to train NeuroSAT as an end-to-end solver on increasingly difficult problems. A second approach might be to use a system like NeuroSAT to help guide decisions within a more traditional SAT solver, though it is not clear that NeuroSAT provides any useful information before it finds a satisfying assignment. However, as we discussed in $\ S 8$ , when we trained our architecture on different data it learned an entirely different procedure. In a separate experiment omitted for space reasons, we also trained our architecture to predict whether there is a satisfying assignment involving each individual literal in the problem and found that it was able to predict these bits with high accuracy as well. Unlike NeuroSAT, it made both type I and type II errors, had no discernable phase transition, and could make reasonable predictions within only a few rounds. We believe that architectures descended from NeuroSAT will be able to learn very different mechanisms and heuristics depending on the data they are trained on and the details of their objective functions. We are cautiously optimistic that a descendant of NeuroSAT will one day lead to improvements to the state-of-the-art.
144
+
145
+ # ACKNOWLEDGEMENTS
146
+
147
+ We thank Steve Mussmann, Alexander Ratner, Nathaniel Thomas, Vatsal Sharan and Cristina White for providing valuable feedback on early drafts. We also thank William Hamilton, Geoffrey Irving and Arun Chaganty for helpful discussions. This work was supported by Future of Life Institute grant 2017-158712.
148
+
149
+ # REFERENCES
150
+
151
+ Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016.
152
+
153
+ Irwan Bello, Hieu Pham, Quoc V Le, Mohammad Norouzi, and Samy Bengio. Neural combinatorial optimization with reinforcement learning. arXiv preprint arXiv:1611.09940, 2016.
154
+
155
+ Armin Biere, Marijn Heule, Hans van Maaren, and Toby Walsh. Conflict-driven clause learning sat solvers. Handbook of Satisfiability, Frontiers in Artificial Intelligence and Applications, pp. 131–153, 2009.
156
+
157
+ Alfredo Braunstein, Marc Mezard, and Riccardo Zecchina. Survey propagation: An algorithm for ´ satisfiability. Random Structures & Algorithms, 27(2):201–226, 2005.
158
+
159
+ Stephen A Cook. The complexity of theorem-proving procedures. In Proceedings of the third annual ACM symposium on Theory of computing, pp. 151–158. ACM, 1971.
160
+
161
+ Hanjun Dai, Elias B Khalil, Yuyu Zhang, Bistra Dilkina, and Le Song. Learning combinatorial optimization algorithms over graphs. arXiv preprint arXiv:1704.01665, 2017.
162
+
163
+ Richard Evans, David Saxton, David Amos, Pushmeet Kohli, and Edward Grefenstette. Can neural networks understand logical entailment? arXiv preprint arXiv:1802.08535, 2018.
164
+
165
+ Alex Flint and Matthew Blaschko. Perceptron learning of sat. In Advances in Neural Information Processing Systems, pp. 2771–2779, 2012.
166
+
167
+ Justin Gilmer, Samuel S Schoenholz, Patrick F Riley, Oriol Vinyals, and George E Dahl. Neural message passing for quantum chemistry. arXiv preprint arXiv:1704.01212, 2017.
168
+
169
+ Carla P Gomes, Henry Kautz, Ashish Sabharwal, and Bart Selman. Satisfiability solvers. Foundations of Artificial Intelligence, 3:89–134, 2008.
170
+
171
+ Cristian Grozea and Marius Popescu. Can machine learning learn a decision oracle for np problems? a test on sat. Fundamenta Informaticae, 131(3-4):441–450, 2014.
172
+
173
+ Shai Haim and Toby Walsh. Restart strategy selection using machine learning techniques. CoRR, abs/0907.5032, 2009.
174
+
175
+ S. Hochreiter and J. Schmidhuber. Long short-term memory. Neural Computation, 9(8):1735–1780, 1997.
176
+
177
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
178
+
179
+ Donald E Knuth. The art of computer programming, volume 4, fascicle 6: Satisfiability, 2015.
180
+
181
+ Harry R Lewis. Computers and intractability. a guide to the theory of np-completeness, 1983.
182
+
183
+ Yujia Li, Daniel Tarlow, Marc Brockschmidt, and Richard Zemel. Gated graph sequence neural networks. arXiv preprint arXiv:1511.05493, 2015.
184
+
185
+ Jia Hui Liang, Vijay Ganesh, Pascal Poupart, and Krzysztof Czarnecki. Learning rate based branching heuristic for sat solvers. In International Conference on Theory and Applications of Satisfiability Testing, pp. 123–140. Springer, 2016.
186
+
187
+ Mark Newman. Networks: an introduction. Oxford university press, 2010.
188
+
189
+ Rasmus Berg Palm, Ulrich Paquet, and Ole Winther. Recurrent relational networks for complex relational reasoning. arXiv preprint arXiv:1711.08028, 2017.
190
+
191
+ Razvan Pascanu, Tomas Mikolov, and Yoshua Bengio. Understanding the exploding gradient problem. CoRR, abs/1211.5063, 2012.
192
+
193
+ Franco Scarselli, Marco Gori, Ah Chung Tsoi, Markus Hagenbuchner, and Gabriele Monfardini. The graph neural network model. IEEE Transactions on Neural Networks, 20(1):61–80, 2009.
194
+
195
+ Rishabh Singh, Joseph P Near, Vijay Ganesh, and Martin Rinard. Avatarsat: An auto-tuning boolean sat solver. 2009.
196
+
197
+ Niklas Sorensson and Niklas Een. Minisat v1. 13-a sat solver with conflict-clause minimization. SAT, 2005(53):1–2, 2005.
198
+
199
+ G Tseitin. On the complexity ofderivation in propositional calculus. Studies in Constrained Mathematics and Mathematical Logic, 1968.
200
+ O. Vinyals, M. Fortunato, and N. Jaitly. Pointer networks. In Advances in Neural Information Processing Systems (NIPS), pp. 2674–2682, 2015.
201
+ L. Xu, F. Hutter, H. H. Hoos, and K. Leyton-Brown. SATzilla: portfolio-based algorithm selection for SAT. Journal of Artificial Intelligence Research (JAIR), 32:565–606, 2008.
md/train/HJMHpjC9Ym/HJMHpjC9Ym.md ADDED
@@ -0,0 +1,402 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # BIG-LITTLE NET: AN EFFICIENT MULTI-SCALE FEATURE REPRESENTATION FOR VISUAL AND SPEECH RECOGNITION
2
+
3
+ Chun-Fu (Richard) Chen, Quanfu Fan, Neil Mallinar, Tom Sercu, Rogerio Feris IBM T.J. Watson Research Center, Yorktown Heights, NY 10598 {chenrich, qfan, neil.r.mallinar, tom.sercu1, rsferis}@us.ibm.com
4
+
5
+ # ABSTRACT
6
+
7
+ In this paper, we propose a novel Convolutional Neural Network (CNN) architecture for learning multi-scale feature representations with good tradeoffs between speed and accuracy. This is achieved by using a multi-branch network, which has different computational complexity at different branches with different resolutions. Through frequent merging of features from branches at distinct scales, our model obtains multi-scale features while using less computation. The proposed approach demonstrates improvement of model efficiency and performance on both object recognition and speech recognition tasks, using popular architectures including ResNet, ResNeXt and SEResNeXt. For object recognition, our approach reduces computation by $1 / 3$ while improving accuracy significantly over $1 \%$ point than the baselines, and the computational savings can be higher up to $1 / 2$ without compromising the accuracy. Our model also surpasses state-of-the-art CNN acceleration approaches by a large margin in terms of accuracy and FLOPs. On the task of speech recognition, our proposed multi-scale CNNs save $30 \%$ FLOPs with slightly better word error rates, showing good generalization across domains.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Deep Convolutional Neural Network (CNN) models have achieved substantial performance gains in many computer vision and speech recognition tasks (He et al., 2016; 2017; Vinyals et al., 2017; Sercu & Goel, 2016). However, the accuracy obtained by these models usually grows proportionally with their complexity and computational cost. This poses an issue for deploying these models in applications that require real-time inferencing and low-memory footprint, such as self-driving vehicles, human-machine interaction on mobile devices, and robotics.
12
+
13
+ Motivated by these applications, many methods have been proposed for model compression and acceleration, including techniques such as pruning (Dong et al., 2017; Li et al., 2017; Han et al., 2015), quantization (Hubara et al., 2016; Li & Liu, 2016), and low-rank factorization (Wen et al., 2017; Ioannou et al., 2015; Zhang et al., 2016). Most of these methods have been applied to single-scale inputs, without considering multi-resolution processing. More recently, another line of work applies dynamic routing to allocate different workloads in the networks according to image complexity (Wu et al., 2018; Wang et al., 2018; Figurnov et al., 2017; Veit & Belongie, 2018). Multi-scale feature representations have proven successful for many vision and speech recognition tasks compared to single-scale methods (Nah et al., 2017; Chen et al., 2017a; Tóth, 2017; Farabet et al., 2013); however, the computational complexity has not been addressed much in multi-scale networks.
14
+
15
+ The computational cost of a CNN model has much to do with the input image size. A model, if running at half of the image size, can gain a remarkable computational saving of $7 5 \%$ . Based on this fact, we propose an efficient network architecture by combining image information at different scales through a multi-branch network. As shown in Fig. 1, our key idea is to use a high-complexity branch (accurate but costly) for low-scale feature representation and low-complexity branch (efficient but less accurate) for high-scale feature representation. The two types of features are frequently merged together to complement and enrich each other, leading to a stronger feature representation than either of them individually. We refer to the deeper branch operating at low image resolution as Big-Branch and the shallower one as Little-Branch to reflect their differences in computation. The new network architecture is thus called Big-Little Net or bL-Net for short in this paper.
16
+
17
+ ![](images/0574022df5e50adb5747f9dd6217fb99fafb4314cbc906cbae2227b65290d2a4.jpg)
18
+ Figure 1: Our proposed Big-Little Net (bL-Net) for efficient multi-scale feature representations. (a) The bL-Net stacks several Big-Little Modules. A bL-module include $K$ branches $K = 2$ in this illustration) where the $k ^ { t h }$ branch represents an image scale of $1 / 2 ^ { k }$ . ‘M’ here denotes a merging operation. (b) Our implementation of the Big-Little Module includes two branches. The Big-Branch has the same structure as the baseline model while the Little-Branch reduces the convolutional layers and feature maps by $\alpha$ and $\beta$ , respectively. Larger values of $\alpha$ and $\beta$ lead to lower computational complexity in Big-Little Net.
19
+
20
+ While being structurally simple, our approach is quite effective. We demonstrate later that when bL-Net is integrated into state-of-the-art CNNs such as ResNet, ResNeXt and SEResNeXt, it yields $2 \times$ computational savings over the baselines without losing any accuracy. It also outperforms many other recently developed approaches based on more sophisticated architectures at the same FLOP count. One work that relates to ours is the Inception model (Szegedy et al., 2016a; 2017), which also leverages parallel pathways in a network building block for efficiency. However, the efficiency of these models relies on substantial use of $1 \times 1$ and separable filters (i.e. $1 \times 3$ and $3 \times 1$ ). In contrast, bL-Net is general and applicable to many architectures including Inception.
21
+
22
+ The main contributions of our paper are summarized as follows:
23
+
24
+ • We propose an efficient and effective multi-scale CNN architecture for object and speech recognition.
25
+ • We demonstrate that our approach reduces computation by $1 / 3$ in models such as ResNet and ResNeXt while improving accuracy over $1 \%$ point than the baselines, and the computational savings can be higher up to $1 / 2$ without losing any accuracy; these results outperform state-of-the-art networks that focus on CNN acceleration by a large margin at the same FLOPs.
26
+ We validate the proposed method on a speech recognition task, where we also achieve better word error rates while reducing the number of FLOPs by $30 \%$ .
27
+
28
+ # 2 RELATED WORK
29
+
30
+ Model Compression and Acceleration. Network pruning (Dong et al., 2017; Li et al., 2017) and quantization (Hubara et al., 2016; Li & Liu, 2016) are popular techniques to remove model redundancy and save computational cost. Another thread of work consists of training a sparse model directly, such as IGCv2 (Xie et al., 2018) and SCConv (Fan et al., 2017). Efficient network architectures like MobileNetV2 (Sandler et al., 2018) and ShuffleNetV2 (Ma et al., 2018) have also been explored for training compact deep networks. Other methods include knowledge distillation (Hinton et al., 2015), compression with structured matrices (Cheng et al., 2015; Sindhwani et al., 2015), and hashing (Chen et al., 2015). Dynamic routing (Wu et al., 2018; Wang et al., 2018; Figurnov et al., 2017; Veit & Belongie, 2018) has also been explored in residual networks to improve efficiency. These methods operate with single-resolution inputs, while our approach processes multi-resolution data. It could be used in tandem with these methods to further improve efficiency.
31
+
32
+ Multi-Resolution Feature Representations. The notion of multi-scale feature representation can be dated back to image pyramids (Adelson et al., 1984) and scale-space theory (Lindeberg & ter Haar Romeny, 1994). More recently, several methods have proposed multi-scale CNN-based architectures for object detection and recognition. MSCNN (Cai et al., 2016), DAG-CNN (Yang & Ramanan, 2015) and FPN (Lin et al., 2017) use features at different layers to form multi-scale features. Hourglass networks (Newell et al., 2016) use a hierarchical multi-resolution model for human pose estimation. However, this approach induces a heavy workload as the complexity of each sub-network in their model is equal. Nah et al. (Nah et al., 2017) and Eigen et al. (Eigen & Fergus, 2015) combine the features from multiple networks working on different resolutions to generate multi-scale features. The overall computational cost grows along with the number of scales, leading to inefficient models. In contrast to existing methods, our approach uses different network capacities for different scales, and yields more powerful multi-scale features by fusing them at multiple levels of the network model.
33
+
34
+ Closely related to our work, approaches such as (Huang et al., 2018; Saxena & Verbeek, 2016), apply multiple branches at multi-scales while aiming at reducing computational complexity. In contrast to our work, their computational gain mostly comes from early exit depending on the input image. Our approach speeds up a network constantly regardless of the input image.
35
+
36
+ # 3 OUR APPROACH
37
+
38
+ We develop a simple, easy-to-implement, yet very efficient and effective network architecture. It learns multi-scale feature representations by fusing multiple branches with different image scales and computational complexity. As shown in Fig. 1, we design a multi-scale feature module with the following principles: (I) each branch corresponds to a single unique image scale (or resolution); (II) the computational cost of a branch is inversely proportional to the scale. Note that the principle (II) implies that we use high-complexity networks at lower resolutions and low-complexity networks at higher resolutions for the sake of efficiency.
39
+
40
+ # 3.1 BIG-LITTLE NET
41
+
42
+ Big-Little Net is a sequence of Big-Little Modules, each one taking input $\mathbf { x } _ { i }$ and producing output $\mathbf { x } _ { i + 1 }$ . Within a Big-Little Module, assume we have $K$ branches working on $K$ scales $[ 1 , \bar { 1 } / 2 , 1 / 4 , . . . , 1 / 2 ^ { K - 1 } ]$ . We denote a feature map $\mathbf { x } _ { i }$ at scale $1 / 2 ^ { k }$ as $\mathbf { x } _ { i } ^ { k }$ , indicating the spatial size of $\mathbf { x } _ { i }$ downsampled by $2 ^ { k }$ with respect to the original input dimension. We use a weighted sum to combine all branches into a feature representation at scale $1 / 2 ^ { k }$ . Mathematically, the module’s output $\mathbf x _ { i + 1 }$ can be expressed by
43
+
44
+ $$
45
+ \mathbf { x } _ { i + 1 } = F \left( \sum _ { k = 0 } ^ { K - 1 } c ^ { k } S ^ { k } \left( f _ { k } \left( \mathbf { x } _ { i } ^ { k } \right) \right) \right) ,
46
+ $$
47
+
48
+ where $f _ { k } ( \cdot )$ denotes a sequence of convolutional layers. Typically for higher $k$ , $f _ { k }$ will have more convolutional layers having more feature maps. $S ^ { k } ( \cdot )$ is the operation that matches the output size of the branches, either: (1) increasing the number feature maps with a $1 \times 1$ convolution, (2) upsampling to match the output size of the $k = 0$ branch, or both. $c ^ { k }$ indicates the weighting coefficients of each scale in the merge while $F ( \cdot )$ is an optional final fusion layer like a convolutional layer.
49
+
50
+ Note that branches are merged at the end of every Big-Little Module and merging the branch outputs happens at the highest resolution and highest number of feature maps between the branches. Maintaining these large intermediate states avoids information loss. A crucial aspect of this design is that through consecutive merging and downsampling, the expensive branches operating at low resolution still have access to the high resolution information, processed by the cheaper branches in the previous module.
51
+
52
+ While our design is suitable for any number of networks, in this work we primarily focus on the case of two networks, i.e., $K = 2$ . We also experimented with $K > 2$ in object and speech recognition; however, the $K = 2$ case provided the best balance between accuracy and computation (See Appendix A.4 and Section 4.2 for details). Following the principles above, we propose a multinetwork architecture that integrates two branches for multi-scale feature representation. Figure 1 (b) shows an example Big-Little Net architecture.
53
+
54
+ The module includes two branches, each of which represents a separate network block from a deep model (accurate but costly) and a less deep counterpart (efficient but less accurate). The two branches are fused at the end through linear combination with unit weights (i.e., $c ^ { 0 } = c ^ { 1 } = 1 . 0$ ). Before fusion, the low resolution feature maps are upsampled using bilinear interpolation to spatially match the higher-resolution counterparts $\bar { ( = { S ^ { 1 } ( \cdot ) } ) }$ . Similarly, the high resolution feature map has an additional $1 \times 1$ convolutional layer to increase the number of output channels $( = S ^ { 0 } ( \cdot ) )$ . Furthermore, since our design is based on ResNet, we add a residual block to further fuse the combined features (i.e., $F ( \cdot )$ is a residual block). For convenience, we refer to these two branches as Big-Branch (more layers and channels at low resolution) and Little-Branch (fewer layers and channels at high resolution), respectively. We also denote the module as Big-Little Module and the entire architecture as Big-Little Net or bL-Net.
55
+
56
+ To control the complexity of bL-Net, we introduce two parameters to specify the complexity of the Little-Branch with respect to the Big-Branch. The Big-Branch typically follows the structure of the original network, but the Little-Branch needs to be heavily slimmed and shortened to reduce computation as it operates on high resolution. Here we use two parameters $\alpha$ and $\beta$ to control the width and depth of the Little-Branch, respectively. As shown in Fig. 1 (b), $\alpha$ specifies the reduction factor of the number of channels in the convolutional layers of Little-Branch with respect to that of the original network while $\beta$ is the reduction factor of the number of convolutional layers. Larger values of $\alpha$ and $\beta$ lead to lower complexity in bL-Net. As demonstrated later, with an appropriate choice of $\alpha$ and $\beta$ (See Table 1 and Table 3), the cost of the Little-Branch can be $1 / 6$ of the $b L$ -Net and $1 / 1 2$ of the original network while still providing sufficient complementary information to the Big-Branch.
57
+
58
+ # 3.2 NETWORK MERGING
59
+
60
+ We consider two options for merging the outputs of the branches. The first option is a linear combination, which joins features from two networks by addition (Newell et al., 2016). The alternative concatenates the outputs of the two networks along the channel dimension, and if needed, a $1 \times 1$ convolution can be subsequently applied to reduce the number of feature maps (Szegedy et al., 2015). Both merging approaches have their pros and cons. With linear combination, the branches can easily compensate each other, meaning each branch can activate output neurons not activated by the other. However, additional cost is added as both the size of feature maps and the number of channels in the two branches need to be adjusted to be the same before addition. On the other hand, merging by concatenation only needs to spatially align the feature maps. On the other hand, concatenation only needs to align the feature map size, however requires a $1 \times 1$ convolution reducing the number of channels after concatenation, which is a more expensive operation than the pointwise addition.
61
+
62
+ While linear combination provides an immediate exchange of the activations of both branches, concatenation relies on the following layers for this exchange. This delay in exchange could possibly be problematic if the information from each branch is destructively altered before merging. For example, a nonlinearity such as ReLU would discard all activations less than zero, effectively ignoring negative features in both branches before merging. Since linear combination does not cause too much overhead and provides better accuracy, we chose linear combination as our merging approach. In Appendix A.4, we empirically show that the linear combination approach performs better than concatenation in object recognition.
63
+
64
+ # 4 EXPERIMENTAL RESULTS
65
+
66
+ We conducted extensive experiments, as discussed below, to validate the effectiveness of our proposed bL-Net on object and speech recognition tasks. bL-Net can be easily integrated with many modern CNNs and here we chose ResNet (He et al., 2016) as the primary architecture to evaluate our approach. For simplicity, from now on, we denote by bL-M the bL-Net using a backbone network $M$ For example, bL-ResNet-50 is the Big-Little net based on ResNet-50.
67
+
68
+ # 4.1 OBJECT RECOGNITION
69
+
70
+ We used the ImageNet dataset (Russakovsky et al., 2015) for all the experiments below on object recognition. This dataset is a common benchmark for object recognition, which contains 1.28 million training images and $5 0 \mathrm { k }$ validation images with labels from 1000 categories. The details of our experimental setup and the network structures for bL-ResNet-50, 101 and 152 can be found in Appendix A.1.
71
+
72
+ Table 1: Complexity study of the Little-Branch $\scriptstyle { \alpha }$ and $\beta$ ) for bL-ResNet-50.
73
+
74
+ <table><tr><td>Model</td><td>Top-1 Error</td><td>FLOPs (109)</td><td>Params (106)</td></tr><tr><td>ResNet-50</td><td>23.66%</td><td>4.09</td><td>25.55</td></tr><tr><td>bL-ResNet-50 (α = 2, β = 2)</td><td>22.72%</td><td>2.91 (1.41×)</td><td>26.97</td></tr><tr><td>bL-ResNet-50(α = 2, β= 4)</td><td>22.69%</td><td>2.85 (1.44×)</td><td>26.69</td></tr><tr><td>bL-ResNet-50 (α = 4, β = 2)</td><td>23.20%</td><td>2.49 (1.64×)</td><td>26.31</td></tr><tr><td>bL-ResNet-50 (α= 4, β= 4)</td><td>23.15%</td><td>2.48 (1.65×)</td><td>26.24</td></tr></table>
75
+
76
+ Table 2: Performance comparison for bL-ResNet, bL-ResNeXt and bL-SEResNeXt.
77
+
78
+ <table><tr><td>Model</td><td>Top-1 Error</td><td>FLOPs (109)</td><td>Params (106)</td><td>Speed (ms/batch)t</td></tr><tr><td>ResNet-101</td><td>21.95%</td><td>7.80</td><td>44.54</td><td>186</td></tr><tr><td>bL-ResNet-101 (α= 2,β= 4)</td><td>21.80%</td><td>3.89 (2.01×)</td><td>41.85</td><td>140 (1.33×)</td></tr><tr><td>bL-ResNet-101@256(α = 2,β= 4)</td><td>21.04%</td><td>5.08 (1.54×)</td><td>41.85</td><td>162 (1.15×)</td></tr><tr><td>ResNet-152</td><td>21.51%</td><td>11.51</td><td>60.19</td><td>266</td></tr><tr><td>bL-ResNet-152(α = 2,β =4)</td><td>21.16%</td><td>5.04 (2.28×)</td><td>57.36</td><td>178 (1.49×)</td></tr><tr><td>bL-ResNet-152@256 (α= 2, β=4)</td><td>20.34%</td><td>6.58 (1.75x)</td><td>57.36</td><td>205 (1.30×)</td></tr><tr><td>ResNeXt-50 (32×4d)</td><td>22.20%</td><td>4.23</td><td>25.03</td><td>157</td></tr><tr><td>bL-ResNeXt-50 (32×4d) (α =2,β= 4)</td><td>21.60%</td><td>3.03 (1.40×)</td><td>26.19</td><td>125 (1.26×)</td></tr><tr><td>bL-ResNeXt-50@256(α = 2, β= 4)</td><td>20.96%</td><td>3.95 (1.08×)</td><td>26.19</td><td>153 (1.03×)</td></tr><tr><td>ResNeXt-101 (32×4d)</td><td>21.20%</td><td>7.97</td><td>44.17</td><td>269</td></tr><tr><td>bL-ResNeXt-101 (32×4d) (α =2,β =4)</td><td>21.08%</td><td>4.08 (1.95×)</td><td>41.51</td><td>169 (1.59×)</td></tr><tr><td>bL-ResNeXt-101@256(α = 2, β=4)</td><td>20.48%</td><td>5.33 (1.50x)</td><td>41.51</td><td>203 (1.33×)</td></tr><tr><td>ResNeXt-101(64×4d)</td><td>20.73%</td><td>15.46</td><td>83.46</td><td>485</td></tr><tr><td>bL-ResNeXt-101 (64×4d) (α = 2,β =4)</td><td>20.48%</td><td>7.14 (2.17×)</td><td>77.36</td><td>263 (1.98×)</td></tr><tr><td>bL-ResNeXt-101@256 (64×4d) (α = 2, β = 4)</td><td>19.65%</td><td>9.32 (1.66x)</td><td>77.36</td><td>318 (1.53×)</td></tr><tr><td>SEResNeXt-50 (32×4d)</td><td>21.78%</td><td>4.23</td><td>27.56</td><td>216</td></tr><tr><td>bL-SEResNeXt-50 (32×4d) (α = 2,β=4) bL-SEResNeXt-50@256 (32×4d) (α= 2, β = 4)</td><td>21.44%</td><td>3.03 (1.40×)</td><td>28.77</td><td>163 (1.33×)</td></tr><tr><td></td><td>20.74%</td><td>3.95 (1.08×)</td><td>28.77</td><td>192 (1.03×)</td></tr><tr><td>SEResNeXt-101 (32×4d)</td><td>21.00%</td><td>7.97</td><td>48.96</td><td>376</td></tr><tr><td>bL-SEResNeXt-101 (32×4d) (α = 2, β = 4)</td><td>20.87%</td><td>4.08 (1.95×)</td><td>45.88</td><td>235 (1.60×)</td></tr><tr><td>bL-SEResNeXt-101@256 (32×4d) (α = 2,β= 4)</td><td>19.87%</td><td>5.33 (1.50×)</td><td>45.88</td><td>270 (1.39×)</td></tr></table>
79
+
80
+ †: speed is benchmarked on NVIDIA Tesla K80 with batch size 16. Except for $@ 2 5 6$ , speed is evaluated under image size $2 2 4 \times 2 2 4$ . We trained all the ResNet, ResNeXt and SEResNeXt models by ourselves, so the accuracy is slightly different from the papers.
81
+
82
+ ResNet as the backbone network. We experimented with different complexity control factors ( $\overset { \cdot } { \alpha }$ and $\beta$ ) to better understand their effects on performance. $\alpha$ and $\beta$ control both the structural and computational complexity of the Little-Branch, which determines the overall computational cost of bL-Net.
83
+
84
+ As can be seen in Table 1, all the models based on ResNet-50 yield better performance over the baseline with less computation, clearly demonstrating the advantage of combining low- and highcomplexity networks to balance between speed and accuracy. In addition, the small performance gaps between these models suggest that a computationally light Little-Branch ( $\textless 1 5 \%$ of the entire network) can compensate well for the low resolution representation by providing finer image details. We consider $\alpha = 2$ and $\beta = 4$ as the default setting for the following experiments. Furthermore, there are more ablation studies on the design of bL-Net in the Appendix A.4.
85
+
86
+ We further evaluated our approach on deeper models by using ResNet-101 and ResNet-152 as the backbone networks. We see from Table 2 that bL-ResNet-101 and bL-ResNet-152 behave similarly to bL-ResNet-50. As expected, both of them produce better results against the baseline models and achieving notable computational gains. Interestingly, our approach computationally favors deeper models, as evidenced by the fact that more speedups are observed on bL-ResNet-152 $( 2 . 3 \times )$ than on bL-ResNet-101 $( 2 . 0 \times )$ and bL-ResNet-50 $( 1 . 4 \times )$ . This is mainly because the Little Branch operating on low resolution spends less computation in a deeper model.
87
+
88
+ ResNeXt and SEResNeXt as the backbone network. We extended bL-Net to ResNeXt and SEResNeXt, two of the more accurate yet compact network architectures. We also experimented with (SE)ResNeXt-50 and (SE)ResNeXt-101 using the $3 2 \times 4 \mathrm { d }$ and $6 4 \times 4 \mathrm { d }$ setting (Xie et al., 2017; Hu et al., 2018). In our case, the Big-Branch follows the same setting of (SE)ResNeXt; however, we changed the cardinality of the Little-Branch to align with the input channels of a group convolution in the Big-Branch. All the results are shown in Table 2.
89
+
90
+ ![](images/a6d6b75cec7913fe409b728001e78bc9467fe9e9c10ca41f278de9c663887d7f.jpg)
91
+ Figure 2: Comparison with the ResNet and ResNeXt related works.
92
+
93
+ bL-ResNeXt-50 achieves a moderate speedup $( 1 . 4 0 \times )$ and provides an additional gain of $0 . 6 \%$ i n accuracy. However, bL-ResNeXt-101 $( 3 2 \times 4 \mathrm { d } )$ gains a much more substantial speedup of $2 \times$ and seeing $0 . 1 2 \%$ improvement in accuracy. The same trend can be seen on bL-ResNeXt-101 $( 6 4 \times 4 \mathrm { d } )$ . On the other hand, our bL-SEResNeXts also produce better performance while reducing more FLOPs than SEResNeXts. bL-SEResNeXt-101 achieves $2 \times$ speedups and improves accuracy by $0 . 1 3 \%$ .
94
+
95
+ Since our bL-Net saves more budget in computation, we can evaluate a model at a larger image scale for better performance, e.g., $2 5 6 \times 2 5 6$ . As illustrated in Table 2, our models evaluated at $2 5 6 \times 2 5 6$ is consistently better than their corresponding baselines while still using fewer FLOPs. The advantage becomes more pronounced with deeper models. For instance, with $40 \%$ reduction on FLOPs, bL-ResNeXt-101 $\textcircled { \scriptsize { a } } 2 5 6$ $( 6 4 \times 4 \mathrm { d } )$ boosts the top-1 performance by $1 . 1 \%$ , which is quite impressive given that ResNeXt-101 $( 6 4 \times 4 \mathrm { d } )$ is a very competitive baseline. Table 2 also shows the running times of bL-Net on GPU, which indicate the practical speedups of these models are consistent with the theoretical FLOP reductions reported in Table 2.
96
+
97
+ # 4.1.1 COMPARISON WITH RELATED WORK
98
+
99
+ We first compared our method with the approaches that aim to accelerate ResNets or ResNeXts using techniques such as network pruning and adaptive computations. The results are shown in Figure 2.
100
+
101
+ Our bL-Net significantly outperforms all related works regarding FLOPs reduction and accuracy. Our bL-ResNet-101 is $\sim 5 \%$ better than the network pruning approaches such as PFEC (Li et al., 2017) and LCCL (Dong et al., 2017), but still using less computation. When compared to SACT and ACT (Figurnov et al., 2017), our bL-ResNet-101 improves the accuracy by $5 \%$ while using the same number of FLOPs. On the other hand, our bL-ResNet-101 outperforms some of the most recent works including BlockDrop (Wu et al., 2018), SkipNet (Wang et al., 2018) and ConvNet-AIG (Veit & Belongie, 2018) by $3 . 7 \%$ , $2 . 2 \%$ , $1 . 2 \%$ top-1 accuracy at the same FLOPs, respectively. This clearly demonstrates the advantages of a simple fusion of two branches at different scales over the more sophisticated dynamic routing techniques developed in these approaches. In comparison to SPPoint (Kuen et al., 2018) under the same FLOPs, our bL-ResNet-101 surpasses it by $2 . 2 \%$ in accuracy.
102
+
103
+ We also compared bL-Net with the variants of ResNets, like ResAttNe(X)t (Wang et al., 2017), SEResNeXt (Hu et al., 2018) and CBAM (Woo et al., 2018). These models introduces attention mechanisms to enhance feature representations in either the channel or the spatial domain. From Figure 2, it can be seen that our bL-Net outperforms all of them in both FLOPs and accuracy. Our bL-Net achieves better performance than ResAttNeXt while saving $1 . 5 \times \mathrm { F L O P s }$ . It also surpasses ${ \sim } 1 \%$ point with similar FLOPs or the similar accuracy with ${ \sim } 1 . 7 \times$ FLOPs reduction for both SEResNeXt and CBAM. It’s worth noting that bL-Net can be potentially integrated with these models to further improve their accuracy and efficiency.
104
+
105
+ Finally, we ran a benchmark test on bL-ResNeXt $@ 2 5 6$ under the PyTorch framework with a batch size of 16 on a K80 GPU, and compared against various models that are publicly available. These models include Inception-V3 (Szegedy et al., 2016a), Inception-V4 (Szegedy et al., 2017), Inception-ResNetV2 (Szegedy et al., 2017), PolyNet (Zhang et al., 2017), NASNet (Zoph et al., 2018), PNASNet (Liu et al., 2018), DualPathNet (Chen et al., 2017b) and DenseNet (Huang et al., 2017b). Among them, NASNet currently achieves the best accuracy on ImageNet.
106
+
107
+ ![](images/d00d2c0fac8445379485651a3bc5072b0003cb35fce602124c3b6ac1929e4ff2.jpg)
108
+ Figure 3: Comparison performance among other types of networks. (a) FLOPs. (b) GPU Speed.
109
+
110
+ From Fig. 3, we can see that overall, our bL-ResNeXt gains a better tradeoff between efficiency and accuracy. Compared to the Inception networks, bL-Net are better in both FLOPs and GPU running time. The bL-ResNeXt is also $2 \%$ point better than DenseNet at the same running speed, and $2 \times$ faster than DualPathNet at the same performance.
111
+
112
+ NASNet achieves lower FLOPs and higher accuracy than bL-Net; however, the networks result in slow GPU running time since their operations are divided into small pieces (i.e. a fragmented structure), which are not friendly for parallel computations. On the other hand, bL-Net, although requiring more FLOPs, can still enjoy the computation optimization brought by modern GPU cards. Moreover, compared with the lowest FLOP configuration of NASNet, our bL-ResNeXt is $0 . 5 \%$ point better while running $1 . 5 \times$ faster.
113
+
114
+ To further validate the generality of bL-Net, we also integrated the bL-Net with the highly efficient network, ShuffleNetV2 (Ma et al., 2018), and the results can be found in Appendix A.5. We also demonstrate the adaptability of $b L$ -Net on the object detection task (see Appendix A.6).
115
+
116
+ # 4.2 SPEECH RECOGNITION
117
+
118
+ We train ResNet style acoustic models in the hybrid framework on Switchboard $+$ Fisher (2000h) and provide results on Hub5 (Switchboard and Call Home portions). Switchboard is a large dataset with 2000 hours of transcribed speech from 28, 000 speakers, which is actively used as benchmark (Xiong et al., 2016; Saon et al., 2017) akin to ImageNet in the computer vision community. Our ResNet acoustic models are similar to the state of the art models described in (Saon et al., 2017), though slightly simplified (less fully connected layers) and trained with a simpler procedure (no class balancing). We provide results only after Cross-Entropy training and after decoding with a small language model (4M n-grams). Gains from this setting are typically maintained in the standard further pipelines like fine-tuning with sequence training, using more complex language models.
119
+
120
+ Appendix B gives a thorough overview of the architecture of the speech acoustic models. The main difference speech acoustic models have compared to image classification networks, is that striding or pooling only happens along the frequency axis, while along in the time direction we need to output dense predictions per frame (Sercu & Goel, 2016). This means that the branches at different resolutions have a fundamentally different view of the signal as it is propagating through the network; the ratio of resolution in frequency (downsampled in the Big-Branch) vs resolution in time (same between branches) is different. We can think about this as the convolutional kernels having different “aspect ratios” between branches. Therefore we not only expect FLOP reductions in bL-Net, but expect to have increased representational power. In addition, similar to the case in object recognition (Table 2), we could process the speech signal at higher frequency resolution than what is computationally feasible for the baseline ResNets.
121
+
122
+ Table 3 shows the results for the different architectures described in Appendix B. Most results are in line with the observations in the object recognition bL-Net. When comparing the baseline ResNet-22 (line 1) to the best bL-ResNet-22 (line 5), we see not only a reduction in FLOPs, but also a modest gain in Word Error Rate (WER). Comparing lines 2-4, we see that increasing $\beta$ (i.e. shorter little branches at full resolution) causes no WER degradation, while reducing the number of FLOPs. From line 5 we see that, similar to the object recognition ResNet results, decreasing $\alpha$ from 4 to 2 (i.e. keeping more feature maps in the full-resolution little branches) is important for performance, even though this increases the FLOPs again. We can summarize the best setting of $\alpha = 2$ and $\beta = 3$ for the little branches at full resolution: make them shorter but with more feature maps. This is consistent with the image classification results. From line 2 vs. line 6, the concatenation merge mode performs similar to the default additive merging, while increasing the number of FLOPs. Line 7 (compare to line 2) shows an experiment with additional branches on the lower layers (See Appendix B). Although there is some gain in WER, the added parameters and compute on the lower layers may not make this a worthwhile trade-off.
123
+
124
+ Table 3: Speech recognition results. We present results on Hub5 and the CallHome portion of Hub5, while the RT-02 Switchboard set was used for selecting decode epoch and HMM prior settings.
125
+
126
+ <table><tr><td>Model</td><td></td><td>FLOPs (109)</td><td>Params (106)</td><td>WER Avg</td><td>Hub5</td><td>Hub5 CH</td></tr><tr><td>1</td><td>Baseline: ResNet-22</td><td>1.11</td><td>3.02</td><td>14.67%</td><td>11.15%</td><td>18.17%</td></tr><tr><td>2</td><td>bL-ResNet-22 (α = 4,β = 1)</td><td>0.68 (1.63×)</td><td>3.15</td><td>14.72%</td><td>11.24%</td><td>18.18%</td></tr><tr><td>3</td><td>bL-ResNet-22 (α = 4,β = 2)</td><td>0.66 (1.68×)</td><td>3.11</td><td>14.47%</td><td>10.95%</td><td>17.95%</td></tr><tr><td>4</td><td>bL-ResNet-22(α = 4,β= 3)</td><td>0.65 (1.70×)</td><td>3.10</td><td>14.66%</td><td>11.25%</td><td>18.05%</td></tr><tr><td>5</td><td>bL-ResNet-22 (α = 2,β = 3)</td><td>0.77 (1.43×)</td><td>3.07</td><td>14.46%</td><td>11.10%</td><td>17.80%</td></tr><tr><td>6</td><td>bL-ResNet-22 (α = 4,β=1) cat</td><td>0.70 (1.58×)</td><td>3.18</td><td>14.67%</td><td>11.31%</td><td>18.00%</td></tr><tr><td>7</td><td>bL-PYR-ResNet-22 (α = 4, β =1)</td><td>0.98 (1.13×)</td><td>3.32</td><td>14.50%</td><td>11.05%</td><td>17.92%</td></tr></table>
127
+
128
+ # 4.3 DISCUSSION ON bL-Net
129
+
130
+ From the results of both tasks, we observe the following common insights, which enable us to design an efficient multi-scale network with competitive performance: (I) The Little-Branch can be very light-weight, (II) bL-Net performs better when the Little-Branch is wide and shallow (smaller $\alpha$ and larger $\beta$ ), (III) merging is effective when the feature dimension has changed, and (IV) branch merging by addition is more effective than concatenation. (I) is because the Big-Branch can extract essential information, a light Little-Branch is good enough to provide sufficient information the Big-Branch lacks. Regarding (II), wider networks have been shown to perform better than deep networks while using a similar number of parameters. (III) is well-discussed in Appendix A.4. Finally (IV), merging through addition provides better regularization for both branches to learn complementary features to form strong features.
131
+
132
+ # 5 CONCLUSION
133
+
134
+ We proposed an efficient multi-scale feature representation based on integrating multiple networks for object and speech recognition. The Big-Branches gain significant computational reduction by working at low-resolution input but still extract meaningful features while the Little-Branch enriches the features from high-resolution input but with light computation. On object recognition task, we demonstrated that our approach provides approximately $2 \times$ speedup over baselines while improving accuracy, and the result significantly outperforms the state-of-the-art networks by a large margin in terms of accuracy and FLOPs reduction. Furthermore, when using the proposed method on speech recognition task, we gained $0 . 2 \%$ WER and saved $30 \%$ FLOPs at the same time. In pratice, the proposed bL-Net shows that the reduced FLOPs can consistently speed up the running time on GPU. That evidence showed that the proposed bL-Net is an efficient multi-scale feature representation structure for competitive performance with less computation. In this paper, we chose ResNet, ResNeXt and SEResNeXt as our backbone networks but $b L$ -Net can be integrated with other advanced network structures, like DenseNet (Huang et al., 2017b), DualPathNet (Chen et al., 2017b) and NASNet (Zoph et al., 2018) to achieve competitive performance while saving computations. Furthermore, bL-Net can be integrated with those CNN acceleration approaches to make models more compact and efficient.
135
+
136
+ # ACKNOWLEDGMENTS
137
+
138
+ The authors would like to thank Dr. Paul Crumley and Dr. I-Hsin Chung for their help with the hardware infrastructure setup.
139
+
140
+ Quanfu Fan and Rogerio Feris are supported by IARPA via DOI/IBC contract number D17PC00341. The U.S. Government is authorized to reproduce and distribute reprints for Governmental purposes notwithstanding any copyright annotation thereon. Disclaimer: The views and conclusions contained herein are those of the authors and should not be interpreted as necessarily representing the official policies or endorsements, either expressed or implied, of IARPA, DOI/IBC, or the U.S. Government.
141
+
142
+ # REFERENCES
143
+
144
+ Martín Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, Zhifeng Chen, Craig Citro, Greg S. Corrado, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Ian Goodfellow, Andrew Harp, Geoffrey Irving, Michael Isard, Yangqing Jia, Rafal Jozefowicz, Lukasz Kaiser, Manjunath Kudlur, Josh Levenberg, Dan Mané, Rajat Monga, Sherry Moore, Derek Murray, Chris Olah, Mike Schuster, Jonathon Shlens, Benoit Steiner, Ilya Sutskever, Kunal Talwar, Paul Tucker, Vincent Vanhoucke, Vijay Vasudevan, Fernanda Viégas, Oriol Vinyals, Pete Warden, Martin Wattenberg, Martin Wicke, Yuan Yu, and Xiaoqiang Zheng. TensorFlow: Large-scale machine learning on heterogeneous systems, 2015. URL https://www.tensorflow.org/. Software available from tensorflow.org.
145
+
146
+ Edward H Adelson, Charles H Anderson, James R Bergen, Peter J Burt, and Joan M Ogden. Pyramid methods in image processing. RCA engineer, 29(6):33–41, 1984.
147
+
148
+ Zhaowei Cai, Quanfu Fan, Rogerio S Feris, and Nuno Vasconcelos. A Unified Multi-scale Deep Convolutional Neural Network for Fast Object Detection. In Bastian Leibe, Jiri Matas, Nicu Sebe, and Max Welling (eds.), European Conference on Computer Vision (ECCV), pp. 354–370, 2016.
149
+
150
+ Wenlin Chen, James T. Wilson, Stephen Tyree, Kilian Q. Weinberger, and Yixin Chen. Compressing neural networks with the hashing trick. In Proceedings of the 32Nd International Conference on International Conference on Machine Learning - Volume 37, ICML’15, pp. 2285–2294. JMLR.org, 2015. URL http: //dl.acm.org/citation.cfm?id=3045118.3045361.
151
+
152
+ Yanbei Chen, Xiatian Zhu, and Shaogang Gong. Person Re-Identification by Deep Learning Multi-Scale Representations. In The IEEE International Conference on Computer Vision (ICCV), October 2017a.
153
+
154
+ Yunpeng Chen, Jianan Li, Huaxin Xiao, Xiaojie Jin, Shuicheng Yan, and Jiashi Feng. Dual Path Networks. In Advances in Neural Information Processing Systems 30, pp. 4467–4475. Curran Associates, Inc., 2017b.
155
+
156
+ Y Cheng, F X Yu, R S Feris, S Kumar, A Choudhary, and S F Chang. An Exploration of Parameter Redundancy in Deep Networks with Circulant Projections. In 2015 IEEE International Conference on Computer Vision (ICCV), pp. 2857–2865. IEEE, December 2015.
157
+
158
+ Xuanyi Dong, Junshi Huang, Yi Yang, and Shuicheng Yan. More is less: A more complicated network with less inference complexity. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), July 2017.
159
+
160
+ David Eigen and Rob Fergus. Predicting depth, surface normals and semantic labels with a common multi-scale convolutional architecture. In The IEEE International Conference on Computer Vision (ICCV), December 2015.
161
+
162
+ Mark Everingham, Luc Van Gool, Christopher K I Williams, John Winn, and Andrew Zisserman. The Pascal Visual Object Classes (VOC) Challenge. International Journal of Computer Vision, 88(2):303–338, June 2010.
163
+
164
+ Quanfu Fan, Chun-Fu (Richard) Chen, and Gwo Giun (Chris) Lee. Sparse Deep Feature Representation for Object Detection from Wearable Cameras. In Proceedings of the British Machine Vision Conference (BMVC). BMVA Press, September 2017.
165
+
166
+ Clement Farabet, Camille Couprie, Laurent Najman, and Yann LeCun. Learning hierarchical features for scene labeling. Pattern Analysis and Machine Intelligence, 2013.
167
+
168
+ Michael Figurnov, Maxwell D. Collins, Yukun Zhu, Li Zhang, Jonathan Huang, Dmitry Vetrov, and Ruslan Salakhutdinov. Spatially adaptive computation time for residual networks. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), July 2017.
169
+
170
+ Sam Gross and Michael Wilber. Training and investigating residual nets. http://torch.ch/blog/2016/ 02/04/resnets.html, 2016.
171
+
172
+ Song Han, Huizi Mao, and William J Dally. Deep Compression: Compressing Deep Neural Network with Pruning, Trained Quantization and Huffman Coding. ArXiv, abs/1510.00149, 2015.
173
+
174
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep Residual Learning for Image Recognition. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2016.
175
+
176
+ Kaiming He, Georgia Gkioxari, Piotr Dollár, and Ross Girshick. Mask R-CNN. In The IEEE International Conference on Computer Vision (ICCV), October 2017.
177
+
178
+ Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. arXiv:1503.02531, 2015.
179
+
180
+ Jie Hu, Li Shen, and Gang Sun. Squeeze-and-Excitation Networks. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2018.
181
+
182
+ G. Huang, Y. Li, Z. Liu G. Pleiss, J. E. Hopcroft, and K. Q. Weinberger. Snapshot ensembles: Train 1, get m for free. In International Conference on Learning Representations (ICLR), 2017a.
183
+
184
+ Gao Huang, Zhuang Liu, Laurens van der Maaten, and Kilian Q Weinberger. Densely Connected Convolutional Networks. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), July 2017b.
185
+
186
+ Gao Huang, Danlu Chen, Tianhong Li, Felix Wu, Laurens van der Maaten, and Kilian Weinberger. Multiscale dense networks for resource efficient image classification. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id $\equiv$ Hk2aImxAb.
187
+
188
+ Itay Hubara, Matthieu Courbariaux, Daniel Soudry, Ran El-Yaniv, and Yoshua Bengio. Binarized Neural Networks. In D D Lee, M Sugiyama, U V Luxburg, I Guyon, and R Garnett (eds.), Advances in Neural Information Processing Systems 29, pp. 4107–4115. Curran Associates, Inc., 2016.
189
+
190
+ Yani Ioannou, Duncan P Robertson, Jamie Shotton, Roberto Cipolla, and Antonio Criminisi. Training CNNs with Low-Rank Filters for Efficient Image Classification. ArXiv, abs/1511.06744, 2015.
191
+
192
+ Jason Kuen, Xiangfei Kong, Zhe Lin, Gang Wang, Jianxiong Yin, Simon See, and Yap-Peng Tan. Stochastic downsampling for cost-adjustable inference and improved regularization in convolutional networks. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2018.
193
+
194
+ Fengfu Li and Bin Liu. Ternary weight networks. CoRR, abs/1605.04711, 2016. URL http://arxiv.org/ abs/1605.04711.
195
+
196
+ Hao Li, Asim Kadav, Igor Durdanovic, Hanan Samet, and Hans Peter Graf. Pruning Filters for Efficient ConvNets. In International Conference on Learning Representation 2017, pp. 1–13, March 2017.
197
+
198
+ Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. Microsoft COCO: Common Objects in Context. In David Fleet, Tomas Pajdla, Bernt Schiele, and Tinne Tuytelaars (eds.), Computer Vision – ECCV 2014: 13th European Conference, Zurich, Switzerland, September 6-12, 2014, Proceedings, Part V, pp. 740–755. Springer International Publishing, Cham, 2014.
199
+
200
+ Tsung-Yi Lin, Piotr Dollar, Ross Girshick, Kaiming He, Bharath Hariharan, and Serge Belongie. Feature pyramid networks for object detection. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), July 2017.
201
+
202
+ Tony Lindeberg and Bart M ter Haar Romeny. Linear scale-space i: Basic theory. In Geometry-Driven Diffusion in Computer Vision, pp. 1–38. Springer, 1994.
203
+
204
+ Chenxi Liu, Barret Zoph, Maxim Neumann, Jonathon Shlens, Wei Hua, Li-Jia Li, Li Fei-Fei, Alan Yuille, Jonathan Huang, and Kevin Murphy. Progressive Neural Architecture Search. In The European Conference on Computer Vision (ECCV), September 2018.
205
+
206
+ I. Loshchilov and F. Hutter. Sgdr. Stochastic Gradient Descent with Restarts. In International Conference on Learning Representations (ICLR), 2017.
207
+
208
+ Ningning Ma, Xiangyu Zhang, Hai-Tao Zheng, and Jian Sun. ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design. In The European Conference on Computer Vision (ECCV), September 2018.
209
+
210
+ Seungjun Nah, Tae Hyun Kim, and Kyoung Mu Lee. Deep Multi-Scale Convolutional Neural Network for Dynamic Scene Deblurring. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), July 2017.
211
+
212
+ Alejandro Newell, Kaiyu Yang, and Jia Deng. Stacked Hourglass Networks for Human Pose Estimation. In Computer Vision – ECCV 2016, pp. 483–499, Cham, 2016. Springer International Publishing.
213
+
214
+ 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-W, 2017.
215
+
216
+ Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, Alexander C. Berg, and Li Fei-Fei. ImageNet Large Scale Visual Recognition Challenge. International Journal of Computer Vision (IJCV), 115(3):211–252, 2015. doi: 10.1007/s11263-015-0816-y.
217
+
218
+ Mark Sandler, Andrew Howard, Menglong Zhu, Andrey Zhmoginov, and Liang Chieh Chen. MobileNetV2: Inverted Residuals and Linear Bottlenecks. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2018.
219
+
220
+ George Saon, Gakuto Kurata, Tom Sercu, Kartik Audhkhasi, Samuel Thomas, Dimitrios Dimitriadis, Xiaodong Cui, Bhuvana Ramabhadran, Michael Picheny, Lynn-Li Lim, et al. English conversational telephone speech recognition by humans and machines. arXiv preprint arXiv:1703.02136, 2017.
221
+
222
+ Shreyas Saxena and Jakob Verbeek. Convolutional neural fabrics. In Proceedings of the 30th International Conference on Neural Information Processing Systems, NIPS’16, pp. 4060–4068, USA, 2016. Curran Associates Inc. ISBN 978-1-5108-3881-9. URL http://dl.acm.org/citation.cfm?id $\equiv$ 3157382.3157551.
223
+
224
+ Tom Sercu and Vaibhava Goel. Dense prediction on sequences with time-dilated convolutions for speech recognition. NIPS End-to-end Learning for Speech and Audio Processing Workshop, 2016.
225
+
226
+ Vikas Sindhwani, Tara Sainath, and Sanjiv Kumar. Structured Transforms for Small-Footprint Deep Learning. In C Cortes, N d Lawrence, D D Lee, M Sugiyama, and R Garnett (eds.), Advances in Neural Information Processing Systems 28, pp. 3088–3096. Curran Associates, Inc., 2015.
227
+
228
+ C Szegedy, Wei Liu, Yangqing Jia, P Sermanet, S Reed, D Anguelov, D Erhan, V Vanhoucke, and A Rabinovich. Going deeper with convolutions. In 2015 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 1–9, 2015.
229
+
230
+ Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and Zbigniew Wojna. Rethinking the Inception Architecture for Computer Vision. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2016a.
231
+
232
+ Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and Zbigniew Wojna. Rethinking the Inception Architecture for Computer Vision. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2016b.
233
+
234
+ Christian Szegedy, Sergey Ioffe, Vincent Vanhoucke, and Alexander Alemi. Inception-v4, Inception-ResNet and the Impact of Residual Connections on Learning. In Conference on Artificial Intelligence (AAAI), 2017.
235
+
236
+ László Tóth. Multi-resolution spectral input for convolutional neural network-based speech recognition. In Speech Technology and Human-Computer Dialogue (SpeD), 2017.
237
+
238
+ Andreas Veit and Serge Belongie. Convolutional Networks with Adaptive Inference Graphs. In The European Conference on Computer Vision (ECCV), September 2018.
239
+
240
+ O Vinyals, A Toshev, S Bengio, and D Erhan. Show and Tell: Lessons Learned from the 2015 MSCOCO Image Captioning Challenge. IEEE Transactions on Pattern Analysis and Machine Intelligence (TPAMI), 39(4): 652–663, April 2017.
241
+
242
+ Fei Wang, Mengqing Jiang, Chen Qian, Shuo Yang, Cheng Li, Honggang Zhang, Xiaogang Wang, and Xiaoou Tang. Residual Attention Network for Image Classification. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), July 2017.
243
+
244
+ Xin Wang, Fisher Yu, Zi-Yi Dou, and Joseph E. Gonzalez. Skipnet: Learning dynamic routing in convolutional networks. In SysML, Feb 2018.
245
+
246
+ Wei Wen, Cong Xu, Chunpeng Wu, Yandan Wang, Yiran Chen, and Hai Li. Coordinating Filters for Faster Deep Neural Networks. In The IEEE International Conference on Computer Vision (ICCV), October 2017.
247
+
248
+ Sanghyun Woo, Jongchan Park, Joon-Young Lee, and In So Kweon. CBAM: Convolutional Block Attention Module. In The European Conference on Computer Vision (ECCV), September 2018.
249
+
250
+ Yuxin Wu. Tensorpack. https://github.com/ppwwyyxx/tensorpack, 2017.
251
+
252
+ Zuxuan Wu, Tushar Nagarajan, Abhishek Kumar, Steven Rennie, Larry S Davis, Kristen Grauman, and Rogerio Feris. Blockdrop: Dynamic inference paths in residual networks. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2018.
253
+
254
+ Guotian Xie, Jingdong Wang, Ting Zhang, Jianhuang Lai, Richang Hong, and Guo-Jun Qi. IGCV2: Interleaved Structured Sparse Convolutional Neural Networks. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), July 2018.
255
+
256
+ Saining Xie, Ross Girshick, Piotr Dollár, Zhuowen Tu, and Kaiming He. Aggregated Residual Transformations for Deep Neural Networks. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), July 2017.
257
+
258
+ W Xiong, J Droppo, X Huang, F Seide, M Seltzer, A Stolcke, D Yu, and G Zweig. Achieving human parity in conversational speech recognition. arXiv:1610.05256, 2016.
259
+
260
+ Songfan Yang and Deva Ramanan. Multi-Scale Recognition With DAG-CNNs. In The IEEE International Conference on Computer Vision (ICCV), December 2015.
261
+
262
+ X Zhang, J Zou, K He, and J Sun. Accelerating Very Deep Convolutional Networks for Classification and Detection. IEEE Transactions on Pattern Analysis and Machine Intelligence, PP(38):1943–1955, October 2016.
263
+
264
+ Xingcheng Zhang, Zhizhong Li, Chen Change Loy, and Dahua Lin. PolyNet: A Pursuit of Structural Diversity in Very Deep Networks. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), July 2017.
265
+
266
+ Barret Zoph, Vijay Vasudevan, Jonathon Shlens, and Quoc V. Le. Learning transferable architectures for scalable image recognition. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2018.
267
+
268
+ # Appendix
269
+
270
+ The appendix illustrates the details of our experiments on object recognition and speech recognition and more ablation study.
271
+
272
+ # A bL-Net FOR OBJECT RECOGNITION
273
+
274
+ # A.1 EXPERIMENTAL SETUP
275
+
276
+ We used the ImageNet dataset for all experiments. We trained all the models by Tensorpack (Wu, 2017), a higher-level wrapper for Tensorflow (Abadi et al., 2015). All the models were trained with 110 epochs, batch size 256, weight decay 0.0001, momentum 0.9 and Nesterov momentum optimizer. Furthermore, we used cosine learning-rate schedule as (Huang et al., $2 0 1 7 \mathrm { a }$ ; Loshchilov & Sgdr, 2017). We deployed the popular augmentation technique in (Szegedy et al., 2016b; Gross & Wilber, 2016) to increase the variety of training data, and randomly crop a $2 2 4 \times 2 2 4$ patch as training image. The validation error is evaluated by resizing the shorter side of an image to 256 and then crop a $2 2 4 \times 2 2 4$ from the center. Note that the results reported here for the vanilla ResNet, ResNeXt and SEResNeXt models are difference from those reported in the original paper (He et al., 2016; Gross & Wilber, 2016; Hu et al., 2018). Our vanilla ResNet is better than the original paper while vanilla ResNeXt and SEResNeXt is slightly worse than the original paper.
277
+
278
+ Table 4: Network configurations of bL-ResNet-50. Output size is illustrated in the parenthesis.
279
+
280
+ <table><tr><td rowspan=1 colspan=1>Layers</td><td rowspan=1 colspan=1>bL-ResNet-50</td><td rowspan=1 colspan=1>ResNet-50</td></tr><tr><td rowspan=1 colspan=1>Convolution</td><td rowspan=1 colspan=2>7 × 7,64, s2 (112 × 112)</td></tr><tr><td rowspan=1 colspan=1>bL-module</td><td rowspan=1 colspan=1>3×3,323 × 3,64,s2 3×3,32,s2(56 × 56)(1×1,64</td><td rowspan=1 colspan=1>MaxPooling (56 × 56)</td></tr><tr><td rowspan=1 colspan=1>bL-module</td><td rowspan=1 colspan=1>ResBlockg,256 ×2 ResBlockL,128 ×1ResBlock,256,s2 (28 × 28)</td><td rowspan=1 colspan=1>ResBlock,256 ×3, s1(56 × 56)</td></tr><tr><td rowspan=1 colspan=1>bL-module</td><td rowspan=1 colspan=1>ResBlockp,512 ×3 ResBlockL,256 ×1ResBlock, 512, s2 (14 × 14)</td><td rowspan=1 colspan=1>ResBlock,512 ×4, s2(28× 28)</td></tr><tr><td rowspan=1 colspan=1>bL-module</td><td rowspan=1 colspan=1>ResBlockb,1024 ×5 ResBlockL,512 ×1ResBlock,1024 (14 × 14)</td><td rowspan=1 colspan=1>ResBlock,1024 ×6, s2(14 × 14)</td></tr><tr><td rowspan=1 colspan=1>ResBlock</td><td rowspan=1 colspan=2>ResBlock,2048 ×3, s2 (7 × 7)</td></tr><tr><td rowspan=1 colspan=1>Average pool</td><td rowspan=1 colspan=2>7 ×7 average pooling</td></tr><tr><td rowspan=1 colspan=1>FC, softmax</td><td rowspan=1 colspan=2>1000</td></tr></table>
281
+
282
+ ResBlockB: the first $3 \times 3$ convolution is with stride 2, and a bi-linear upsampling is applied at the end. $\mathbf { R e s B l o c k } _ { L }$ : a $1 \times 1$ convolution is applied at the end to align the channel size. $\mathbf { s } 2$ : the stride is set to 2 for the $3 \times 3$ convolution in the ResBlock.
283
+
284
+ # A.2 NETWORK STRUCTURE
285
+
286
+ This section shows the details of network structures of our bL-ResNet, and the setting of $\alpha$ and $\beta$ is 2 and 4, respectively. To understand how do we design bL-ResNet-50 based on ResNet-50, Table 4 shows the details of network structure. We used a bottleneck residual block as a ResBlock, and a ResBlock, $C$ denotes a block composed of $1 \times 1 , 3 \times 3$ , and $1 \times 1$ convolutions, where the first $1 \times 1$ and the $3 \times 3$ have $C / 4$ kernels and the last $1 \times 1$ has $C$ kernels.
287
+
288
+ First, the Big-Branch and the Little-Branch shares a residual block at the transition layer, so the number of residual blocks in each branch will be subtracted by 1. The number of residual blocks in the Little-Branch is defined as $\begin{array} { r } { \left\lceil { \frac { L } { \beta } } \right\rceil - 1 } \end{array}$ and at least one, where $L$ is the number of residual blocks in the Big-Branch, and the number of kernels in a convolutional layer would be $\frac { C } { \alpha }$ , where $C$ is the number of kernels in the Big-Branch. Thus, for all stages, the number of blocks in the Little-Branch is only one, and the number of blocks in the Big-Branch would be the number of blocks in ResNet-50 miuns one.
289
+
290
+ For bL-ResNet-101 and bL-ResNet-152, we redistributed the residual blocks to different stages to balance the residual blocks at each stage. A ResNet model has 5 stages, and each stage has the same spatial size. These two models accumulate most of the convolutions (or computations) on the $4 ^ { t h }$ stage, where the size of feature maps is $1 4 \times 1 4$ when input size is $2 2 4 \times 2 2 4$ . While such a design may be suitable for a very deep model, it likely limits the ability of Big-Branch to learn information at large scales, which mostly resides at earlier stages. Thus, we move some blocks in the $4 ^ { t h }$ stage of these two models to the ${ \dot { \mathbf { \zeta } } } _ { 2 ^ { n d } }$ and $3 ^ { r d }$ stages. Table 5 shows the details of bL-ResNet-101 and bLResNet-152.
291
+
292
+ Table 5: Network configurations of bL-ResNets, and $\alpha = 2$ and $\beta = 4$
293
+
294
+ <table><tr><td>Layers</td><td>Output Size</td><td colspan="6">bL-ResNet-101 bL-ResNet-152</td></tr><tr><td>Convolution</td><td>112 × 112</td><td colspan="6">7 × 7,64,s2</td></tr><tr><td>bL-module</td><td>56× 56</td><td colspan="6">(3×3,32 3 ×3,64,s2 3×3,32,s2 (1×1,64</td></tr><tr><td>bL-module</td><td>56×56</td><td>/1×1,64 3×3,64 ×3(2) (1×1,256) B</td><td>/1×1,32 3×3,32 (1×1,128) L</td><td>×1</td><td>/1×1,64 3×3,64 × 4(2) (1×1,256) B</td><td>/1×1,32 3×3,32 (1×1,128)</td><td>×1 L</td></tr><tr><td>transition layer</td><td>28×28</td><td colspan="6">/1×1,64 3×3,64,s2 ×1 (1×1,256</td></tr><tr><td>bL-module</td><td>28×28</td><td>(1×1,128) /1×1,64 3×3,128 ×7(3) 3×3,64 (1×1,512) B</td><td>×1 (1×1,256) L</td><td colspan="2">(1×1,128) 3×3,128 (1×1,512)</td><td>× 11(7)</td><td>/1×1,64 3×3,64 ×2 (1×1,256) L</td></tr><tr><td>transition layer</td><td>14 × 14</td><td colspan="2"></td><td colspan="2">/1×1,128 3×3,128,s2 ×1 (1×1,512</td><td colspan="3">B</td></tr><tr><td>bL-module</td><td>14 × 14</td><td>/1×1,256 3×3,256 �� 17(22) (1×1,1024)B</td><td>(1×1,128) 3×3,128 (1×1,512 L</td><td>×3</td><td>/1×1,256 3×3,256 (1×1,1024) B</td><td>× 29(35)</td><td>(1×1,128) 3×3,128 (1×1,512)</td><td>×6 L</td></tr><tr><td>transition layer</td><td>14 × 14</td><td colspan="6">/1×1,256 3×3,256 ×1 (1×1,1024)</td></tr><tr><td>ResBlock</td><td>7×7</td><td colspan="6">/1×1,512 3 ×3,512,s2 ×3</td></tr><tr><td>Average pool</td><td>1×1</td><td colspan="6">(1×1,2048 7×7 average pooling</td></tr><tr><td>FC, softmax</td><td colspan="7">1000</td></tr></table>
295
+
296
+ For each $\overline { B }$ block, the first $3 \times 3$ convolution is with stride 2, and a bi-linear upsampling is applied at the end. For each $L$ block, a $1 \times 1$ convolution is applied at the end. $^ { s 2 }$ : the stride is set to 2 for the convolutional layer. The number in the parethesis denotes the original number of blocks in ResNet.
297
+
298
+ # A.3 PERFORMANCE ON LOW RESOLUTION INPUT
299
+
300
+ We analyzed what advantages bL-Net could provide as compared to the network which works on low resolution input directly (ResNet-50-lowres). As shown in Table 6, ResNet-50-lowres reduces lots of computations but its accuracy is not acceptable; however, bL-ResNet-50 $\alpha = 2$ and $\beta = 4$ ) achieves a better balance between accuracy and performance. A similar trend is also observed on a deeper model ResNet-101-lowres. While such performance is unsatisfying compared to the state of the art, it is quite reasonable and expected given that almost $3 \sim 4 \times$ reduction of computation are achieved in such a case.
301
+
302
+ Figure 4 shows the prediction results from bL-ResNet-50 and ResNet-50-lowres. When both models predict correctly (4 (a) and (b)), the bL-ResNet-50 provides better confidence for the prediction. Because the object only occupies a small portion of an image, the Little-Branch can still capture the object clearly. On the other hand, when the key features of an object is small, like the shape of beak of a bird (c) and the spots of a ladybug (d), bL-ResNet-50 can easily retain that key feature to predict correctly while ResNet-50-lowres provides wrong predicted label.
303
+
304
+ ![](images/bf948a2c1696a33afbd37fc5e16cb47be047e9384139f171958c590313dc30a9.jpg)
305
+ Figure 4: Prediction results for bL-ResNet-50 and ResNet-50-lowres. True labels, predicted labels and their probability are listed in the table. When both models predicts correctly ((a) and (b)), bL-ResNet-50 achieves much higher probability; on the other hand, bL-ResNet-50 captures the details on the object and then predicts correctly ((c) and (d)).
306
+
307
+ Table 6: Performance of ResNets at different input resolutions.
308
+
309
+ <table><tr><td>Network</td><td>Top-1 Error</td><td>FLOPs (109)</td><td>Params (106)</td></tr><tr><td>ResNet-50</td><td>23.66%</td><td>4.09</td><td>25.55</td></tr><tr><td>ResNet-50-lowres</td><td>26.10%</td><td>1.29 (3.17×)</td><td>25.60</td></tr><tr><td>ResNet-101</td><td>21.95%</td><td>7.80</td><td>44.54</td></tr><tr><td>ResNet-101-lowres</td><td>24.80%</td><td>2.22 (3.51x)</td><td>44.57</td></tr></table>
310
+
311
+ # A.4 ABLATION STUDY ON NETWORK MERGING AND MULTI-BRANCH
312
+
313
+ Is linear combination better than concatenation? We adopt the simpler addition in bL-Net. Nonetheless, if we design the Big-Branch in a way that the output channels is identical to the backbone networks, then the number of kernels in the Big-Branch would be only $1 - \alpha$ with respect to the total number of kernels of the backbone network; thus, in this case, the overall $b L$ -Net can be more efficient while the performance degradation could be compromised. We compared the performance of these two different merging schemes in Table 7. Although concatenation approach is more efficient, it performs much worse than addition with a gap of almost $1 . 5 \%$ . This leaves addition as a better choice for bL-Net in both visual and speech tasks.
314
+
315
+ More-branch in bL-Net As mentioned in Section 3.1, our approach can be extended to a scenario with multiple image scales. We experimented with three scales [1/4, 1/2, 1] on bL-ResNet-50 $( K = 3$ ) where ResNet-50 is served as the Big-Branch at the scale of 1/4 of the original input, i.e. $5 6 \times 5 6$ As indicated in Table 7, a 3-scale bL-Net requires more FLOPs and parameters due to the fact that the overhead in merging more branches is significant for ResNet-50, but even though, it still cannot provide superior performance of a 2-scale bL-Net. This is because the Big-Branch in the 3-scale bL-Net is downsampled aggressively by 4 times, thus substantially degrade the capability of feature representation in the Big-Branch.
316
+
317
+ Table 7: Different scales and merging schemes on bL-ResNet.
318
+
319
+ <table><tr><td>Network</td><td>Top-1 Error</td><td>FLOPs (109)</td><td>Params (106)</td></tr><tr><td>ResNet-50</td><td>23.66%</td><td>4.09</td><td>25.55</td></tr><tr><td>bL-ResNet-50 (addition,K = 2)</td><td>22.69 %</td><td>2.85 (1.43×)</td><td>26.69</td></tr><tr><td>bL-ResNet-50 (concatenation,K = 2)</td><td>24.04%</td><td>2.01 ( (2.03x)</td><td>20.57</td></tr><tr><td>bL-ResNet-50 (addition,K = 3)</td><td>24.12%</td><td>3.91 (1.04×)</td><td>27.23</td></tr></table>
320
+
321
+ Table 8: Different number of merges in bL-ResNet. $m$ : number of merges. $( \alpha = 2 , \beta = 4 )$
322
+
323
+ <table><tr><td>Model</td><td>Top-1 Error</td><td>FLOPs (109)</td><td>Params (106)</td></tr><tr><td>bL-ResNet-50 (m = 4) (baseline)</td><td>22.69%</td><td>2.85</td><td>26.69</td></tr><tr><td>bL-ResNet-50 (m = 2)</td><td>23.48%</td><td>2.74</td><td>26.66</td></tr><tr><td>bL-ResNet-50 (m = 1)</td><td>24.57%</td><td>2.64</td><td>26.64</td></tr><tr><td>bL-ResNet-101 (m= 4) (baseline)</td><td>21.80%</td><td>3.89</td><td>41.85</td></tr><tr><td>bL-ResNet-101 (m = 7)</td><td>21.85%</td><td>5.21</td><td>44.44</td></tr></table>
324
+
325
+ # Number of Merges in bL-Net
326
+
327
+ We also analyzed the number of merges we needed in the bL-Net. One big difference between our approach and others is that $b L$ -Net merges multiple times as opposed to only once in most of the other approaches. Below we provide an explanation of why more information exchange is encouraged in our approach and when is the best moment for merging operation.
328
+
329
+ In the above bL-Net, we merged branches before the feature dimension changes, except for the first stride convolution; thus, we used 4 merges $m = 4 ,$ ). We experimented with a different number of merges for bL-ResNet-50 and bL-ResNet-101, and the results are shown in Table 8. Since there are fewer layers in bL-ResNet-50, we reduce the number of merges to show their importance; on the other hand, there are more layers in bL-ResNet-101, so we add more merges to show that those additional merges would similarly not improve the performance anymore.
330
+
331
+ The accuracy of the bL-ResNet-50 models with less number of merges ( $m = 1$ and $m = 2$ ) is significantly worse than with more $\textlangle m = 4$ ) and they do not save many FLOPs and parameters at all. This justifies frequent information exchange improves the performance. On the other hand, bL-ResNet-101 $m = 7 ,$ ) uses more merges; however, it also does not improve the performance and requires more FLOPs, which comes from more merges. This is because the original setting for the amount of merging happened when either the channel number or feature map size is changed, so extra merges happened at the feature dimension. Thus, those extra merges could be redundant since merging at identical dimension could be reduced to one merging. Hence, it empirically proves that merging before dimension is changed is the most effective.
332
+
333
+ # A.5 bL-Net FOR HIGH-EFFICIENCY NETWORK
334
+
335
+ To demenstrate bL-Net can be applied on different types of network, we deploy bL-Net on the high-efficiency network, ShuffleNetV2 (Ma et al., 2018), and results are shown in Table 9. Our bL-ShuffleNetV2@256 outperforms ShuffleNetV2 by up to $0 . 5 \%$ point under similar FLOPs, which suggests that our approach can also improve the high-efficiency networks.
336
+
337
+ Table 9: Comparison with ShuffleNetV2 (Ma et al., 2018) $( \alpha = 2 , \beta = 2 ) .$
338
+
339
+ <table><tr><td>Model</td><td>|Model width</td><td>Top-1 Error</td><td>FLOPs (106)</td><td>Params (106)</td></tr><tr><td rowspan="3">ShuffleNetV2</td><td>1×</td><td>30.60%</td><td>146</td><td>2.30</td></tr><tr><td>1.5×</td><td>28.03%</td><td>299</td><td>3.51</td></tr><tr><td>2×</td><td>26.85%</td><td>588</td><td>7.40</td></tr><tr><td rowspan="3">bL-ShuffleNetV2 @ 256</td><td>1×</td><td>30.84%</td><td>150</td><td>2.33</td></tr><tr><td>1.5×</td><td>27.83%</td><td>298</td><td>4.80</td></tr><tr><td>2×</td><td>26.38%</td><td>590</td><td>7.60</td></tr></table>
340
+
341
+ All models are trained by ourselves.
342
+
343
+ # A.6 bL-Net FOR OBJECT DETECTION
344
+
345
+ We demonstrate the effectiveness of bL-Net on object detection. We use bL-Net as a backbone network for FasterRCNN $+$ FPN (Lin et al., 2017) on the PASCAL VOC (Everingham et al., 2010) and MS COCO datasets (Lin et al., 2014). Table 10 shows the comparison with the detector with ResNet-101
346
+
347
+ as the backbone network, and the results show that bL-Net achieves competitive performance while saving about $1 . 5 \times \mathrm { F L O P s } ^ { 1 }$ , suggesting that bL-Net is transferable to other vision tasks.
348
+
349
+ Table 10: Objection detection results. Detection performance on the PASCAL VOC 2007test dataset.
350
+
351
+ <table><tr><td>Network</td><td>mAP@[IoU=0.5] (bbox)</td><td>FLOPst (109)</td></tr><tr><td>ResNet-101</td><td>81.5</td><td>137.70</td></tr><tr><td>bL-ResNet-101 (α=2, β=4)</td><td>81.4</td><td>89.21 (1.54×)</td></tr><tr><td>bL-ResNet-101 (α=2, β=2)</td><td>81.5</td><td>93.95 (1.47×)</td></tr></table>
352
+
353
+ Detection performance on the MS COCO val2017 dataset.
354
+
355
+ <table><tr><td>Network</td><td>mAP@[IoU=0.50:0.95](bbox)|FLOPs‡ (109)</td><td></td></tr><tr><td>ResNet-101</td><td>39.2</td><td>234.85</td></tr><tr><td>bL-ResNet-101 (α=2, β=4)</td><td>39.5</td><td>151.11 (1.55×)</td></tr><tr><td>bL-ResNet-101 (α=2, β=2)</td><td>40.4</td><td>160.21 (1.47×)</td></tr></table>
356
+
357
+ †: FLOPs is calculated when the size of input image is $6 0 0 \times 1 0 2 4$ with 300 proposals. ‡: FLOPs is calculated when the size of input image is $8 0 0 \times 1 3 4 4$ with 300 proposals.
358
+
359
+ # A.7 COMPARISON OF MEMORY REQUIREMENT
360
+
361
+ We benchmarked the GPU memory consumption in runtime at both the training and test phases for all the models evaluated in Fig. 3. The results are shown in Fig. 5. The batch size was set to 8, which is the largest number allowed for NASNet on a P100 GPU card. The image size for any model in this benchmark experiment is the same as that used in the experiment reported in Fig. 3. For bL-Net, the input image size is $2 2 4 \times 2 2 4$ in training and $2 5 6 \times 2 5 6$ in test.
362
+
363
+ From Fig. 5, we can see that bL-Net is the most memory-efficient for training among all the approaches. In test, bL-ResNeXt consumes more memory than inception-resnet-v2 and inception-v4 at the same accuracy, but bL-SEResNeXt outperforms all the approaches. Note that NASNet and PNASNet are not memory friendly. This is largely because they are trained on a larger image size $( 3 3 1 \times 3 3 1 )$ ) and these models are composed of many layers.
364
+
365
+ ![](images/da4e5aec7cfa4b70d0b83baf77d263cacc8fcabedbed9c1b250d87d538f80742.jpg)
366
+ Figure 5: Comparison memory requirement at the training and test phases among other types of networks. (a) Training. (b) Test. (The batch size is 8.)
367
+
368
+ Table 11: Complexity study of the Little-Branch $\scriptstyle { \alpha }$ and $\beta$ ) for bL-ResNet-50 and bL-ResNet-101.
369
+
370
+ <table><tr><td>Model</td><td>Top-1 Error</td><td>FLOPs (109)</td><td>Params (106)</td></tr><tr><td>ResNet-50</td><td>23.66%</td><td>4.09</td><td>25.55</td></tr><tr><td>bL-ResNet-50 (α =1, β=1)</td><td>21.75%</td><td>5.65</td><td>34.12</td></tr><tr><td>bL-ResNet-50 (α =1, β=2)</td><td>22.11%</td><td>4.34</td><td>30.14</td></tr><tr><td>bL-ResNet-50(α= 2,) β=2)</td><td>22.72%</td><td>2.91</td><td>26.97</td></tr><tr><td>bL-ResNet-50(α =2,) β=4)</td><td>22.69%</td><td>2.85</td><td>26.69</td></tr><tr><td>bL-ResNet-50(α = 4, β = 2)</td><td>23.20%</td><td>2.49</td><td>26.31</td></tr><tr><td>bL-ResNet-50 (α =4, β= 4)</td><td>23.15%</td><td>2.48</td><td>26.24</td></tr><tr><td>ResNet-101</td><td>21.95%</td><td>7.80</td><td>44.54</td></tr><tr><td>bL-ResNet-101 (α=1,β=1)</td><td>20.31%</td><td>10.29</td><td>63.32</td></tr><tr><td>bL-ResNet-101 (α = 2, β= 2)</td><td>21.40%</td><td>4.27</td><td>43.39</td></tr><tr><td>bL-ResNet-101 (α = 2,β=4)</td><td>21.80%</td><td>3.89</td><td>41.85</td></tr></table>
371
+
372
+ # B bL-Net FOR SPEECH RECOGNITION
373
+
374
+ # B.1 EXPERIMENTAL SETUP
375
+
376
+ In our experiments, we start with an input size of $6 4 \times 4 9$ , where 64 is the number of logmel filterbanks, calculated for each utterance on-the-fly. We also stack their first and second derivatives to get 3 input channels, resulting in our final input of dimensionality batch_si $\mathsf { \Omega } : \in \times 3 \times 6 4 \times 4 9$ . Our output is of size batch_si $\mathsf { z e } \times 5 1 2 \times 4 \times 1$ , which is then projected to batch_si $\mathsf { z e } \times 5 1 2 \times 1 \times 1$ and finally to batch_ $\mathrm { ~ s ~ i ~ z ~ e ~ } \times \mathrm { 3 2 k } \times 1 \times 1$ for classification. We then perform softmax cross-entropy over this output space of 32k tied CD states from forced alignment, doing phone prediction on the central frame of the input utterance. We report results after Cross-Entropy training, on ${ \mathrm { H u b } } 5 ^ { \prime } { 0 0 }$ (SWB and CH part) after decoding using the standard small 4M n-gram language model with a $3 0 . 5 \mathrm { k }$ word vocabulary.
377
+
378
+ All models were trained in PyTorch (Paszke et al., 2017) over 16 epochs on 2 GPUs with per-GPU batch size 256 (total batch size of 512), gradient clipping 10.0, weight decay √ $1 \times 1 0 ^ { - 6 }$ , nesterov accelerated momentum 0.9, and learning rate 0.03 (annealed by $\sqrt { 0 . 5 }$ per epoch $\geq 1 0 $ ).
379
+
380
+ # B.2 NETWORK STRUCTURES
381
+
382
+ ResNet-22 Our models follow a ResNet architecture without padding in time (Saon et al., 2017), which accounts for the fact that padding in time adds undesirable artifacts when processing a longer utterance (Sercu & Goel, 2016). Under this constraint, each convolution operation reduces our input sequence in time by $k - 1$ , where $k$ is the kernel width used. This effect can be seen in Table 12, in which the time variable, $T$ , is reduced in accordance with the number of convolutions. For similar reasons, when we stride we only do so in frequency, and not in time. For the rest of this section, when we refer to striding we are referring only to striding in frequency. We define our residual blocks as a series of $3 \times 3$ convolutions. When we transition from one stage to the next, we stride by 2 on the first convolution of the following block. All of our models start with a $5 \times 5$ convolution with stride 2, which downsamples the input from 64 melbins to 32.
383
+
384
+ Our baseline model, ResNet-22, consists of four stages of two-convolution residual blocks: $( 3 \times$ $3 , 6 4 ) \times 3$ $\times 3 ; ( 3 \times 3 , 1 2 8 , s 2 ) \times 3 ; ( 3 \times 3 , 2 5 6 , s 2 ) \times 3 ; ( 3 \times 3 , 5 1 2 , s 2 ) \times 2$ . The output then goes through a bottleneck projection layer to the 32k-dimensional output CD state: $( 4 \times 1 , 5 1 2 )$ and $( 1 \times 1 , 3 2 \mathbf { k } )$ .
385
+
386
+ bL-ResNet-22 $( \alpha = 4 , \beta = 1 ,$ ) Table 12 displays two bL-Net architectures that we experimented with based on the ResNet-22 baseline. The bL-Net baseline, bL-ResNet-22 $( \alpha = 4 , \beta = 1 )$ , consists of two branches in each Big-Little Module and is well-defined through the parameters $\alpha$ and $\beta$ . In between each Big-Little Module we downsample our input using a transition layer consisting of a residual block with a single $3 \times 3$ convolution with stride 2. Therefore, we shift one convolution operation out of the last residual block in each stage that precedes a transition layer.
387
+
388
+ Whenever downsampling is performed in the Big-Branch, it is only in the frequency dimension and not in time. Similarly, bilinear upsampling only occurs in the frequency dimension. All $b L$ -Net variants end with the same projection and output layer as ResNet-22. All merges, unless otherwise specified, are through linear combination with unit weights per branch. For comparison, we experimented with a version of bL-ResNet-22 $\mathbf { \Phi } ( \alpha = 4 , \beta = 1 $ ) using concatenation to merge branches, the results of which are presented in Table 3. Using concatenation instead of linear combination in this model results in each stage having more channels after concatenation than the current stage of the network calls for (i.e. in stage 1 we end up with $6 4 + 1 6 = 8 0$ channels at the end of the relevant Big-Little Module, whereas we only want 64 channels to be outputted). To resolve this, we apply a $1 \times 1$ convolution to reduce the number of channels accordingly and fuse the two separate feature maps.
389
+
390
+ Table 12: Network configurations of bL-ResNets applied to speech for acoustic modeling.
391
+
392
+ <table><tr><td>Layers</td><td>Output Size 一</td><td colspan="3">bL-ResNet-22 (α=4,β=1)</td><td colspan="3">bL-ResNet-22 (α= 2,β=3)</td></tr><tr><td>Convolution</td><td>32×T T=49→45</td><td colspan="6">5×5,64,s2</td></tr><tr><td>bL-module</td><td>32×T T=45→35</td><td>(3×3,64) 3×3,64 ×2 B (3×3,64)g ×1</td><td>(3×3,16) (3×3,16)L (3 ×3,16), × 1</td><td>×2</td><td>(3×3,64) ×2 3×3,64) B (3 ×3,64)B ×1</td><td>(3×3,32) (3×3,32)</td><td>×1</td></tr><tr><td>transition layer</td><td>16×T T=35→33</td><td colspan="6">(3×3,64,s2)×1</td></tr><tr><td>bL-module</td><td>16×T T= 33→23</td><td>(3×3,128) ×2 (3×3,128) B</td><td>(3×3,32) (3×3,32)</td><td>×2 L</td><td>(3×3,128) ×2 3×3,128 B</td><td>(3×3,64) 3×3,64)</td><td>×1 L</td></tr><tr><td>transition layer</td><td>8×T T=23→21</td><td colspan="6">(3×3,128)B ×1 (3×3,32) ×1 (3×3,128)g ×1 (3×3,128,s2)×1</td></tr><tr><td>bL-module</td><td>8×T T=21→11</td><td>(3×3,256) ×2 3×3,256 B</td><td>(3×3,64) (3×3,64) L</td><td>×2</td><td>(3×3,256) ×2 3×3,256 B</td><td>(3×3,128) 3×3,128)</td><td>×1 L</td></tr><tr><td>transition layer</td><td>4×T</td><td colspan="6">(3×3,256)B ×1 (3×3,64) ×1 (3×3,256)g ×1 (3×3,256,s2) ×1</td></tr><tr><td>bL-module</td><td>T=11→9 4×T</td><td colspan="6">(3×3,512) (3×3,128) (3×3,512) ×2 ×2 ×2</td></tr><tr><td>Convolution</td><td>T=9→1 1×1</td><td colspan="6">(3×3,512) (3×3,128) (3×3,512) B L</td></tr><tr><td>Convolution</td><td>1×1</td><td colspan="6">4×1,512 1 × 1,32k</td></tr></table>
393
+
394
+ For each $B$ block, the first $3 \times 3$ convolution is with stride 2 (in frequency), and a bilinear upsampling is applied at the end. For each $L$ block, a $1 \times 1$ convolution is applied at the end to match feature maps. $s 2$ : the stride is set to 2 in the frequency dimension (not in time) for the convolutional layer. $T = T _ { 0 } T _ { 1 }$ indicates that $T _ { 0 }$ is the size of the time dimension at the start of the given layer, which is reduced to $T _ { 1 }$ by the end of the layer.
395
+
396
+ bL-ResNet-22 $( \alpha = 4 , \beta = 2 , 3 )$ We explored two more models where we fix $\alpha = 4$ , one in which we take $\beta = 2$ and another where $\beta = 3$ . All Big-Branchs in these models are the same as bL-ResNet-22 $( \alpha = 4 , \beta = 1 )$ ). The difference in each Little-Branch is based on the setting of $\beta$ . Since the number of convolutions we use in the bL-Net baseline is uneven in the first three stages, we take $\lceil L / \beta \rceil$ to be the depth of the Little-Branch, where $L$ is the depth of the Big-Branch. For $\beta = 2$ , the first three stages of the network have a Little-Branch consisting of one residual block with two $3 \times 3$ convolutions and one residual block with one $3 \times 3$ convolution. This results in a reduction of the number of convolutions from 5 in the Big-Branch to 3 in the Little-Branch. For $\beta = 3$ , the first three stages of the network have a Little-Branch consisting of one residual block with two $3 \times 3$ convolutions, resulting in a reduction in the number of convolutions from 5 in the Big-Branch to 2 in the Little-Branch. For both models, the Little-Branch in the final stage consists of a single residual block with two $3 \times 3$ convolutions, since there are only four convolutions in the Big-Branch of the final stage and $\lceil 4 / 3 \rceil = \lceil 4 / 2 \rceil = 2$ .
397
+
398
+ In all bL-Net variants in which $\beta > 1$ , because we can’t pad in time, we see that the time dimension will get out of sync between the Big-Branch and Little-Branch. Therefore, before merging we need to match the output size of each branch. To do this, we crop the shallower branches in time to match the deepest branch (i.e. the Big-Branch will always have a smaller time dimension due to having more convolutions, so we crop to match it). This is similar to the way the shortcut in ResNet is dealt with in (Saon et al., 2017), and does not introduce edge artifacts when processing longer sequences.
399
+
400
+ bL-ResNet-22 $( \alpha = 2 , \beta = 3 )$ ) The last of our two-branch models is where $\alpha = 2$ and $\beta = 3$ which is also presented in Table 12. This variant is well-defined in $\alpha$ and $\beta$ up to the first three stages of the network. In the last stage, however, we opt to not branch and instead follow identically the final stage of ResNet-22 with two residual blocks operating at the full input resolution with 512 channels.
401
+
402
+ bL-PYR-ResNet-22 $( \alpha = 4 , \beta = 1$ ) We additionally present results on a pyramidal structure, in which the first stage of the network operates with four branches, the second with three, the third with two, and the fourth equivalent to the fourth stage of ResNet-22 (and bL-ResNet-22 $( \alpha = 2 , \beta = 3 )$ ). Due to the setting of $\alpha = 4$ , we increased the number of channels in the first stage Big-Branch to have 256 channels (with the three Little-Branches in this stage having 64, 16, and 4 channels), avoiding a single channel on the smallest branch. Note that the middle branches require both resolution upsampling and $1 \times 1$ convolution to match channels. The third stage Big-Little Module operates on two branches and is identical to the analagous stage in bL-ResNet-22 $\alpha = 4 , \beta = 1$ ).
md/train/HJMN-xWC-/HJMN-xWC-.md ADDED
@@ -0,0 +1,237 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LEARNING PARSIMONIOUS DEEP FEED-FORWARD NETWORKS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Convolutional neural networks and recurrent neural networks are designed with network structures well suited to the nature of spacial and sequential data respectively. However, the structure of standard feed-forward neural networks (FNNs) is simply a stack of fully connected layers, regardless of the feature correlations in data. In addition, the number of layers and the number of neurons are manually tuned on validation data, which is time-consuming and may lead to suboptimal networks. In this paper, we propose an unsupervised structure learning method for learning parsimonious deep FNNs. Our method determines the number of layers, the number of neurons at each layer, and the sparse connectivity between adjacent layers automatically from data. The resulting models are called Backbone-Skippath Neural Networks (BSNNs). Experiments on 17 tasks show that, in comparison with FNNs, BSNNs can achieve better or comparable classification performance with much fewer parameters. The interpretability of BSNNs is also shown to be better than that of FNNs.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Deep neural networks have made breakthroughs in all kinds of machine learning tasks (LeCun et al., 2015; Hinton et al., 2012a; Mikolov et al., 2011), specifically with convolutional neural networks (CNNs) for tasks with spacial data (Krizhevsky et al., 2012) and recurrent neural networks (RNNs) for tasks with sequential data (Sutskever et al., 2014). One of the key reasons for the effectiveness of CNNs and RNNs is the well-designed network structures together with the parameter sharing schemes. For example, in the convolution layers of CNNs, each neuron is connected to a local region in the input volume instead of all the input neurons. Besides, the neurons in the same channel share the same set of weights. This design utilizes the local and “stationary” properties of spacial data and consequently forms effective feature extractors. In addition, it also prevents CNNs from having an exploding number of parameters when the networks become deeper and deeper.
12
+
13
+ However, in practice, there are also many data which are neither spacial nor sequential, and hence the only applicable neural networks are the standard feed-forward neural networks (FNNs). In contrast to CNN and RNN, FNN’s network structure is simple. It consists of multiple layers of neurons and each layer is fully connected to the next layer up, without considering any correlations in data or among neurons. The network structure has two main shortcomings. The first is that, there can be high connection redundancies. As the number of layers and the number of neuron at each layer increase, the number of parameters increases quickly, which can cause severe overfitting. The other shortcoming is that, ignoring all the correlations existing in data weakens the model’s strength (as a feature extractor) and hurts the model’s interpretability.
14
+
15
+ We are interested in learning parsimonious deep feed-forward neural networks. The goal is to learn FNNs which contain as few parameters as possible. Parsimonious FNNs are desirable for several reasons. Firstly, fewer parameters can ease overfitting. Secondly, parsimonious FNNs require less storage and computation than FNNs, which makes it possible to be run on devices like mobile phones. Lastly, parsimonious FNNs can have very flexible and different structures from each other depending on the specific tasks and data. This would help the models fit the data well and also have good interpretability. In general, it is desirable to solve a problem using the simplest model possible because it implies a good understanding of the problem.
16
+
17
+ ![](images/333a9c4fb5cf8f596a69bdbdee6d7260ec7ae00c48fb7d378637c2ab79ff8d0c.jpg)
18
+ Figure 1: Model structure of Backbone-Skippath Neural Network. The wide layers with sparse connections $( x - h _ { 1 } , h _ { 1 } - h _ { 2 } )$ form the Backbone path. The narrow fully-connected layers $( x - h _ { 3 }$ , $h _ { 1 } - h _ { 3 }$ , $h _ { 2 } - h _ { 3 } )$ are the Skip-paths. The number of units at $h _ { 3 }$ is relatively smaller than that at $x$ , $h _ { 1 }$ and $h _ { 2 }$ .
19
+
20
+ Learning parsimonious FNNs is challenging mainly because we need to determine the sparse connectivity between layers. Network pruning is a potential way to achieve this. However, it requires to start from a network which is much larger than necessary for the task at hand. This can cause a lot of computations wasted on those useless connections. In addition, network pruning is not able to learn the number of units and number of layers.
21
+
22
+ In this paper, we assume that data are generated by a sparse probabilistic model with multiple layers of latent variables, and view the feed-forward network to be built as a way to approximate the relationships between the observed variables and the top-level latent variables in the probabilistic model. The level 1 latent variables induce correlations among the observed variables. Therefore, it is possible to determine them by analysing how the observed variables are correlated. Similarly, by analysing how the level 1 latent variables are correlated, we can determine the level 2 latent variables, and so on. We empirically show that our method can significantly reduce the number of parameters in FNNs, and the resulting model still achieves better or comparable results than FNNs in 17 classification tasks.
23
+
24
+ # 2 RELATED WORKS
25
+
26
+ Network Structure Learning One early attempt to learn network structure for FNNs is the approach based on constructive algorithms (Ash, 1989; Bello, 1992; Kwok & Yeung, 1997). These algorithms start from a small network and gradually add new neurons to the network until some stopping criterion are met (e.g. no more performance gain is observed). They require manuallydesigned strategies to decide how to connect new neurons to the existing network. Besides, each time when new neurons are introduced, the network needs to be retrained completely or partially. Lately, Adams et al. (2010) proposes to learn the structure of deep belief networks by using cascading Indian buffet process, which is very time-consuming. In Chen et al. (2017b), the authors propose a structure learning method, based on hierarchical latent tree analysis (Liu et al., 2014; Chen et al., 2016; 2017a), for RBM-like models. The method automatically determines the number of hidden units and the sparse connections between layers. However, it is not tested on deep models and in supervised learning tasks. Recently, reinforcement learning (Baker et al., 2017; Zoph & Le, 2017) and genetic algorithms (Real et al., 2017; Xie & Yuille, 2017) are also applied to learning complex structures for CNNs. Generally, these methods require tens of thousands of full training runs before giving a feasible network structure, which is prohibitive for many applications.
27
+
28
+ Network Pruning In contrast to constructive algorithms, network pruning starts from a large network and prune connections or neurons to achieve structure learning. Optimal Brain Damage (Cun et al., 1990) and Optimal Brain Surgeon (Hassibi et al., 1993) prune connections based on the Hessian matrix of the loss function. Recently, Han et al. (2015) proposes to conduct pruning by iteratively pruning connections with absolute weight value smaller than a threshold and retraining the network. One drawback of the method is that the retraining process is time-consuming. Guo et al. (2016) proposes Dynamic Network Surgery which conducts parameter learning and connection pruning simultaneously and avoids the retraining process. Moreover, it also allows mistakenly pruned connections to be rebuilt in subsequent training. Similar to connection pruning, neurons pruning methods are proposed and tested in Srinivas & Babu (2015); Li et al. (2017). The main drawback of all these pruning methods is that, they require to start from a network which is larger than necessary for the task at hand. This causes some wasted computations on the useless connections or neurons. In addition, the number of layers is still set manually instead of learned from data.
29
+
30
+ # 3 METHODS
31
+
32
+ In this section, we present a method for learning parsimonious deep FNNs. The method is called Parsimonious Structure Analysis (PSA). PSA learns a model which contains two parts as shown in Figure 1. The first is the main part of the model, called the Backbone. It is a wide, deep but sparse feed-forward path in the network. The second part is the Skip-paths. It consists of multiple narrow paths, each of which is a fully-connected layer. We call the resulting model Backbone-Skippath Neural Network (BSNN). We will introduce how PSA learns the Backbone and the Skip-paths in Section 3.1 and Section 3.2 respectively.
33
+
34
+ # 3.1 LEARNING THE BACKBONE
35
+
36
+ Structure learning for neural networks is challenging since generally the features in data do not always have apparent relationships as the units in convolutional networks. In a convolutional layer, units in a feature map are only connected to a group of units strongly correlated in the spacial dimension at the layer below. This significantly reduces the number of parameters in CNNs and is essential if we want to learn a very sparse structure. The same intuition can be applied to general data other than images in feed-forward neural networks. A hidden unit, detecting one particular feature such as co-occurrence pattern, should only be connected to a group of units that are strongly correlated in the layer below. However, unlike CNNs where the spatial correlation is apparent, the correlations of units in feed-forward neural networks are not easy to discover. In PSA, we propose to apply Hierarchical Latent Tree Analysis (HLTA) (Liu et al., 2014; Chen et al., 2016; 2017a) to identify the co-occurrence patterns among units and construct hidden units to explain the co-occurrence patterns.
37
+
38
+ # 3.1.1 LEARNING A TWO-LAYER STRUCTURE
39
+
40
+ PSA treats the input features as a set of isolated random variables as in Figure 3(a). Although no apparent spacial or sequential relationships exist among the variables, PSA seeks to discover the correlations among the variables and groups the highly correlated ones together. It starts from finding two most correlated variables to form one group and keeps expanding the group if necessary. Let $S$ denotes the set of observed variables which haven’t been included into any variable groups.
41
+
42
+ ![](images/b90b7261dcbb1cd8991ccd4cc59a9bf00375b867b45504166123254c9987295e.jpg)
43
+ Figure 2: Example: (a) The best model with one latent variable for five observed variables. (b) The best model with two latent variables for five observed variables.
44
+
45
+ ![](images/af2b0fbfa98ce86a5194cc77219ca1cc12f14dbfa0f6baa3ee868b062112e634.jpg)
46
+ Figure 3: The structure learning steps of PSA. Black circles represent observed variables while white circles represent latent variables. (a) A set of observed variables. (b) Partitions the observed variables into groups. (c) Introduces a latent variable for each group and link the latent variables up as a Chow-Liu tree. (d) Converts the latent variables at layer 1 into observed variables and repeat the previous process on them. (e) Stacks the layer 2 latent variables on the top previous model.
47
+
48
+ PSA firstly computes the mutual information between each pair of observed variables. Then it picks the pair in $S$ with the highest mutual information and uses them as the seeds of a new variable group $G$ . New variables from $S$ are then added to $G$ one by one in descending order of their mutual information with variables already in $G$ . Each time when a new variable is added into $G$ , PSA builds two models $\mathcal { M } _ { 1 }$ and $\mathcal { M } _ { 2 }$ ) with $G$ as the observed variables. The two models are the best models with one single latent variable and two latent variables respectively, as shown in Figure 2. PSA computes the BIC scores of the two models and tests whether the following condition is met:
49
+
50
+ $$
51
+ B I C ( \mathcal { M } _ { 2 } | D ) - B I C ( \mathcal { M } _ { 1 } | D ) \leq \delta ,
52
+ $$
53
+
54
+ where $D$ is the dataset and $\delta$ is a threshold which is usually set at 3 (Chen et al., 2017a). When the condition is met, the two latent variable model $\mathcal { M } _ { 2 }$ is not significantly better than the one latent variable model $\mathcal { M } _ { 1 }$ . Correlations among variables in $\mathbf { G }$ are still well modeled using a single latent variable. Then PSA keeps on adding new variables to $G$ . If the test fails, PSA takes the subtree in $\mathcal { M } _ { 2 }$ which doesn’t contain the newly added variable and identifies the observed variables in it as a finalized variable group. The group is then removed from $S$ . And the above process is repeated on $S$ until all the variables in $S$ are partitioned into disjoint groups. An efficient algorithm progressive EM (Chen et al., 2016) is used to estimate the parameters in $\mathcal { M } _ { 1 }$ and $\mathcal { M } _ { 2 }$ .
55
+
56
+ As shown in Figure 2(b), after the above process, all the observed variables are partitioned into disjoint groups such that the variables in each group are strongly correlated and their correlations can be explained using a single latent variables. Then PSA introduces a latent variable for each group and computes the mutual information among the latent variables. After that, it links up the latent variables to form a Chow-Liu tree (Chow & Liu, 1968). The result is a latent tree model (Pearl, 1988; Zhang, 2004), as shown in Figure 2(c). Parameter estimation for the model is done using the EM algorithm. Since the model is tree-structured, EM is efficient in this process.
57
+
58
+ ![](images/fee4c49cd7403a11a15dde2a7df33190ba7cb78e6c98a466dde56e925944bf34.jpg)
59
+ Figure 4: Expanding the tree structure for the Backbone path: A three-layer structure is first learned (left). New connections are added to all the layers according to empirical conditional mutual information (middle). The connections between variables at the top layer are removed and the structure is finalized (right).
60
+
61
+ # 3.1.2 LEARNING A DEEP STRUCTURE
62
+
63
+ While the above procedure gives us a one-layer network, we seek to build deep model to capture the long-range correlations among variables. We perform the construction of deep structure in a layerwise manner. Using the obtained one-layer model, PSA converts the latent variables into observed ones through data completion. With this, another layer of latent variables can be learned in the same manner as the first layer by grouping the first-layer latent variables and linking up the groups, as in Figure 2(d). Then the two models can be stacked up to form a three-layer network, with the latent variables in the higher layer capturing longer-range correlations of the observed variables. This procedure can be recursively conducted to build deep hierarchy until the number of variables at the top layer falls below a threshold $K$ . And it results in a hierarchical latent tree model (Liu et al., 2014; Chen et al., 2016; 2017a).
64
+
65
+ # 3.1.3 EXPANDING TREE STRUCTURE
66
+
67
+ While the above deep structure captures the most important correlations among the observed variables, the tree structure might cause underfitting for discovering non-trivial correlations. Thus we introduce additional links to model the salient interactions that are not captured by the tree model. For each latent variable $V _ { l }$ at level $l$ , PSA considers adding connections to link it to more nodes at level $l - 1$ . To do so, PSA considers how closely $V _ { l }$ is related to each node $V _ { l - 1 }$ at level $l - 1$ given the parent variable $Z$ of $V _ { l - 1 }$ . The strength of correlation is measured using the conditional mutual information:
68
+
69
+ $$
70
+ I ( V _ { l } , V _ { l - 1 } | Z ) .
71
+ $$
72
+
73
+ The top $N$ nodes with the highest $I ( V _ { l } , V _ { l - 1 } | Z )$ are then connected to $V _ { l }$ . After expanding the connections for all the layers, PSA removes the links among the variables at the top layer and uses the resulting structure for the Backbone. The process of expanding tree structure is illustrated in Figure 4.
74
+
75
+ # 3.2 SKIP-PATHS
76
+
77
+ Although the Backbone path is deep and wide, its sparsity can easily lead to model which cannot capture global features. For example, suppose there is an essential feature which is correlated to all the input features. When the Backbone path is very sparse, even after multiple layers of projections, it is still unlikely that there will be a feature in the model which is projected from all the input features.
78
+
79
+ To tackle the above problem, we introduce Skip-paths to our BSNN. Figure 1 shows the whole model structure of BSNN. The path from $x$ to $h _ { 2 }$ illustrates the Backbone path whose sparse structure is learned using the method we propose. To complement the the model’s power of extracting features, narrow Skip-paths $( x - h _ { 3 } , h _ { 1 } - h _ { 3 } , h _ { 2 } - h _ { 3 } )$ are added to the model. The Skip-paths take all the feature layers in the Backbone as input and compress them to layers with a small number of units through fully-connected projections.
80
+
81
+ Table 1: Statistics of all the datasets.
82
+
83
+ <table><tr><td>Dataset</td><td>Task</td><td>Classes</td><td>Training Samples</td><td>Validation Samples</td><td>Test Samples</td></tr><tr><td>Tox21</td><td>Toxicity prediction</td><td>2</td><td>6,901~ 9,154</td><td>500</td><td>516~ 622</td></tr><tr><td>Yelp Review Full</td><td>Sentiment prediction</td><td>5</td><td>640,000</td><td>10,000</td><td>50,000</td></tr><tr><td>DBPedia</td><td>Topic classification</td><td>14</td><td>549,990</td><td>10,010</td><td>70.000</td></tr><tr><td>Sogou News</td><td>Topic classification</td><td>5</td><td>440,000</td><td>10,000</td><td>60,000</td></tr><tr><td>Yahoo!Answer</td><td>Topic classification</td><td>10</td><td>1,390,000</td><td>10,000</td><td>60.000</td></tr><tr><td>AG&#x27;s News</td><td>Topic classification</td><td>4</td><td>110,000</td><td>10,000</td><td>7,600</td></tr></table>
84
+
85
+ # 3.3 BUILDING BSNN
86
+
87
+ After the structure for the Backbone path and the Skip-paths are determined, a classification layer or regression layer can then be added to the top of all the paths, utilizing all the features extracted. The network can then be trained using back-propagation algorithms as in normal neural networks.
88
+
89
+ # 4 EXPERIMENTS
90
+
91
+ In experiment, we evaluate our method in 17 classification tasks. We consider applications where the data is neither spacial nor sequential. Unlike CNNs or RNNs where the structure is designed to exploit spatial or sequential correlation, few effort has been put to learn the structure of feedfoward neural networks, which have highly redudant parameters and is prone to overfit. Our proposed method learns the structure of feedforward neural network from data. It significantly reduces the model complexity and parameters while achieving better or comparable classification performance, and leads to models which are more interpretable.
92
+
93
+ # 4.1 DATASETS
94
+
95
+ Table 1 gives a summary of all the datasets used in the experiment. We choose 12 tasks for chemical compounds classification and 5 tasks for text classification. All the datasets are published by previous researchers and are available to the public.
96
+
97
+ Tox21 challenge dataset. 1 There are about 12,000 environmental chemical compounds in the dataset, each represented as its chemical structure. The tasks are to predict 12 different toxic effects for the chemical compounds. We treat them as 12 binary classification tasks. We filter out sparse features which are present in fewer than $5 \%$ compounds, and rescale the remaining 1,644 features to zero mean and unit variance. The dataset contains a training set and a test set, and we randomly sample 500 compounds from training data to build the validation set. All the experiments are run for three times and we report the average AUC together with the standard deviations.
98
+
99
+ Text classification datasets. 2 We use 5 text classification datasets from Zhang et al. (2015). After removing stop words, the top 10,000 frequent words in each dataset are selected as the vocabulary respectively and each document is represented as bag-of-words over the vocabulary. The validation set is randomly sampled from the original training samples. We run all the experiments for three times and report the average classification accuracies with the standard deviations.
100
+
101
+ Table 2: Hyper-parameters for the structure of FNNs.
102
+
103
+ <table><tr><td>Hyper-parameter</td><td>Values considered</td></tr><tr><td>Number ofhiddenunits</td><td>{512,1024,2048}</td></tr><tr><td>Number of hidden layers</td><td>{1,2,3,4}</td></tr><tr><td>Network shape</td><td>{Rectangle, Conic}</td></tr></table>
104
+
105
+ # 4.2 EXPERIMENT SETUP
106
+
107
+ We compare our model with standard feed-forward neural networks (FNNs) and sparse neural networks whose weak connections are pruned (Pruned FNNs) in the 17 classification tasks. The models involved in the experiment are as follows:
108
+
109
+ • BSNN: Backbone-Skippath Neural Network is the resulting model of our method PSA. For all the tasks, we keep only $5 \%$ of the connections in the Backbone path and limit the number of units in the narrow Skip-paths to 100. FNN: Feed-forward Neural Network is a standard fully-connected neural network. It is mainly composed of linear layers and activation functions. Each hidden unit is connected to all neurons in the previous layer. Information flows from low layers to high layers in a feed-forward manner. Pruned FNN: Pruned Feed-forward Neural Network is trained by using the method proposed in Han et al. (2015). We Firstly train a fully-connected FNN from scratch, and then prune out the weak connections with small absolute weight values. The pruned network is then retrained from the initial training phase by keeping the surviving weight parameters.
110
+
111
+ We learn the structure of BSNNs using PSA. The number of layers, the number of hidden units in each layer and the sparse connections between adjacent layers are automatically determined. After structure learning, we train the sparse model from scratch by random initialization of weights. As for FNNs, we treat the number of hidden units and number of layers as hyper-parameters of network and determine the best structure by grid-search over all the combinations using validation data. Table 2 shows the space of network structures considered. Following the method in Klambauer et al. (2017) , both “rectangle ” and “conic” network shapes are tested. In FNNs with rectangle shape, all the hidden layers have constant number of units. FNNs with conic shape start with the given number of hidden units and decrease it layer by layer in a geometric progression manner towards the output layer. For Pruned FNNs, we take the best FNNs as the initial model and perform pruning as in Han et al. (2015). The pruned model is then retrained for final model.
112
+
113
+ We implement all the experiments using PyTroch3 which is a flexible deep learning framework. We use ReLUs (Nair & Hinton, 2010; Glorot et al., 2011) as the non-linear activation functions in all the networks. Dropout (Hinton et al., 2012b; Srivastava et al., 2014) with rate 0.5 is applied after each non-linear projection. We use Adam (Kingma & Ba, 2014) as the optimizer to optimize the training objective function. During training, we select models by monitoring validation loss. Codes will be released after the paper is accepted to the conference.
114
+
115
+ # 4.3 RESULTS
116
+
117
+ # 4.3.1 BSNNS VS FNNS
118
+
119
+ Table 3 shows the classification results of BSNNs and FNNs on Tox21 dataset. The structures of FNNs are tuned individually for each task. It is clear that BSNNs achieve better AUC scores on 10 out of the 12 classification tasks. Even when it is not better, the average AUC value of BSNNs, e.g. on task SR.MMP, is also very close to that of FNNs. More importantly, BSNNs always contain much fewer parameters than FNNs, with the ratios of parameter number ranging from $7 \%$ to $4 0 . 1 1 \%$ .
120
+
121
+ Table 4 shows the results of BSNNs and FNNs over the 5 text classification tasks. Although BSNNs contain much fewer parameters than FNNs, BSNNs still achieve higher classification accuracy in the first two tasks, and comparable accuracy in the remaining tasks. Note that the ratios of parameter number ranges from $6 . 2 5 \%$ to $3 2 . 0 7 \%$ . This again confirms that our method learns good parsimonious deep models which can achieve high classification performance with much fewer parameters than standard FNNs.
122
+
123
+ Table 3: Comparison between BSNNs and FNNs on $\mathrm { T o x } 2 1$ challenge dataset. The structures of FNNs are chosen by using validation data. Each experiment is run for three times.
124
+
125
+ <table><tr><td></td><td colspan="2">BSNNs</td><td colspan="2">FNNs</td></tr><tr><td></td><td colspan="3">Parameter#/</td><td></td></tr><tr><td>Task</td><td>AUC</td><td>Ratio W.r.t FNNs</td><td>AUC</td><td>Parameter #</td></tr><tr><td>NR.AhR</td><td>0.8930± 0.0014</td><td>338K/ 37.08%</td><td>0.8843 ± 0.0030</td><td>912K</td></tr><tr><td>NR.AR</td><td>0.7316 ± 0.0245</td><td>338K/ 20.05%</td><td>0.6629 ± 0.0155</td><td>1.69M</td></tr><tr><td>NR.AR.LBD</td><td>0.7827 ± 0.0200</td><td>338K/ 20.05%</td><td>0.7216 ± 0.0245</td><td>1.69M</td></tr><tr><td>NR.Aromatase</td><td>0.7854 ± 0.0098</td><td>338K/ 40.11%</td><td>0.7834 ± 0.0046</td><td>843K</td></tr><tr><td>NR.ER</td><td>0.7804 ± 0.0042</td><td>338K/ 12.36%</td><td>0.7671 ± 0.0090</td><td>2.73M</td></tr><tr><td>NR.ER.LBD</td><td>0.7772 ± 0.0088</td><td>338K/ 20.75%</td><td>0.8145 ± 0.0035</td><td>1.63M</td></tr><tr><td>NR.PPAR.gamma</td><td>0.8232 ± 0.0019</td><td>338K/ 39.38%</td><td>0.8024 ± 0.0098</td><td>858K</td></tr><tr><td>SR.ARE</td><td>0.7877 ± 0.0036</td><td>338K/ 7.00%</td><td>0.7809 ± 0.0092</td><td>4.83M</td></tr><tr><td>SR.ATAD5</td><td>0.8188 ± 0.0085</td><td>338K/ 40.11%</td><td>0.7980 ± 0.0014</td><td>843K</td></tr><tr><td>SR.HSE</td><td>0.8330 ± 0.0053</td><td>338K/ 30.59%</td><td>0.8318 ± 0.0047</td><td>1.10M</td></tr><tr><td>SR.MMP</td><td>0.9249 ± 0.0014</td><td>338K/ 20.05%</td><td>0.9253 ± 0.0038</td><td>1.69M</td></tr><tr><td>SR.p53</td><td>0.8425 ± 0.0023</td><td>338K/ 40.11%</td><td>0.8401 ± 0.0049</td><td>843K</td></tr><tr><td>Average</td><td>0.8150 ± 0.0038</td><td>27.30%</td><td>0.8010± 0.0017</td><td></td></tr></table>
126
+
127
+ Table 4: Comparison between BSNNs and FNNs on 5 text classification datasets. The structures of FNNs are chosen by using validation data. Each experiment is run for three times.
128
+
129
+ <table><tr><td></td><td colspan="3">BSNNs</td><td colspan="2">FNNs</td></tr><tr><td>Task</td><td></td><td>Parameter#/</td><td></td><td></td><td></td></tr><tr><td>Yelp Review Full</td><td>Accuracy 59.14% ± 0.06%</td><td>Ratio w.r.t FNNs</td><td>32.07%</td><td>Accuracy</td><td>Parameter #</td></tr><tr><td>DBPedia</td><td>98.11% ± 0.03%</td><td>1.73M/ 1.78M /</td><td>17.13%</td><td>59.13% ± 0.14% 97.99% ± 0.04%</td><td>5.38M 10.36M</td></tr><tr><td>Sogou News</td><td>96.09% ± 0.06%</td><td>1.84M /</td><td>13.77%</td><td>96.12% ± 0.06%</td><td>13.39M</td></tr><tr><td>Yahoo!Answer</td><td>71.42% ± 0.06%</td><td>1.69M /</td><td>31.42%</td><td>71.84% ± 0.07 %</td><td></td></tr><tr><td>AG&#x27;s News</td><td>91.39% ± 0.03%</td><td>1.81M /</td><td>6.25%</td><td>91.61% ± 0.01%</td><td>5.39M 28.88M</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
130
+
131
+ # 4.3.2 CONTRIBUTION OF THE BACKBONE
132
+
133
+ Table 5: Comparison between BSNNs and BSNNs with only the backbone path. Tox21 Average corresponds to the result averaged over the 12 tasks in Tox21 dataset. Each experiment is run for three times.
134
+
135
+ <table><tr><td></td><td>BSNNs</td><td colspan="3">Backbone Path in BSNNs</td></tr><tr><td></td><td></td><td></td><td>Parameterratio</td><td>Parameterratio</td></tr><tr><td>Task Tox21 Average</td><td>AUC/Accuracy</td><td>AUC/Accuracy</td><td>w.r.t BSNNs</td><td>w.r.t FNNs</td></tr><tr><td>Yelp Review Full</td><td>0.8150± 0.0038 59.14% ± 0.06%</td><td>0.7839± 0.0076 58.63% ± 0.13%</td><td>30.47% 35.47%</td><td>8.32% 11.38%</td></tr><tr><td>DBPedia</td><td>98.11% ± 0.03%</td><td></td><td>36.67%</td><td></td></tr><tr><td>Sogou News</td><td>96.09% ± 0.06%</td><td>97.91% ± 0.04%</td><td>38.63%</td><td>6.28%</td></tr><tr><td>Yahoo!Answer</td><td>71.42% ± 0.06%</td><td>95.67% ± 0.04%</td><td>34.39%</td><td>5.32%</td></tr><tr><td>AG&#x27;s News</td><td></td><td>69.95% ± 0.08%</td><td></td><td>10.80%</td></tr><tr><td></td><td>91.39% ± 0.03%</td><td>91.33% ± 0.03%</td><td>37.55%</td><td>2.35%</td></tr></table>
136
+
137
+ To validate our assumption that the backbone path in BSNNs captures most of the information in data and acts as a main part of the model, we remove the narrow skip-paths in BSNNs and train the model to test its performance in classification tasks. Table 5 shows the results. As we can see from the results, the backbone path alone already achieves AUC scores or accuracies which are only slightly worse than BSNNs. Note that the number of parameters in the sparse path is even much smaller than BSNNs. Compared with FNNs, the number of parameters is only $2 \%$ $11 \%$ , significantly smaller than that of FNNs. However, without the backbone, the performance of the model will be significantly worse due to the insufficient capability of the other narrow path. The results not only show the importance of the backbone path in BSNNs, but also shows that our structure learning method in the backbone path is effective enough.
138
+
139
+ Table 6: AUC scores of BSNNs, BSNN-FCs and Pruned FNNs on Tox21 dataset. For each task, better result between BSNNs and BSNN-FCs is underlined, while better result between BSNNs and Pruned FNNs is bold.
140
+
141
+ <table><tr><td>Task</td><td>BSNNs</td><td>BSNN-FCs</td><td>Pruned FNNs</td></tr><tr><td>NR.AhR</td><td>0.8930± 0.0014</td><td>0.8910±0.0014</td><td>0.8845 ± 0.0047</td></tr><tr><td>NR.AR</td><td>0.7316 ± 0.0245</td><td>0.6780 ± 0.0252</td><td>0.6660 ± 0.0206</td></tr><tr><td>NR.AR.LBD</td><td>0.7827 ± 0.0200</td><td>0.7796 ± 0.0136</td><td>0.7475 ± 0.0356</td></tr><tr><td>NR.Aromatase</td><td>0.7854 ± 0.0098</td><td>0.7757 ± 0.0124</td><td>0.7782 ± 0.0069</td></tr><tr><td>NR.ER</td><td>0.7804 士 0.0042</td><td>0.7693 ± 0.0049</td><td>0.7767 ± 0.0059</td></tr><tr><td>NR.ER.LBD</td><td>0.7772 士 0.0088</td><td>0.7970 ± 0.0057</td><td>0.8054 ± 0.0071</td></tr><tr><td>NR.PPAR.gamma</td><td>0.8232 士 0.0019</td><td>0.8136 ±0.0032</td><td>0.7803 ± 0.0045</td></tr><tr><td>SR.ARE</td><td>0.7877 士 0.0036</td><td>0.7771 士 0.0058</td><td>0.7812 ± 0.0024</td></tr><tr><td>SR.ATAD5</td><td>0.8188 士 0.0085</td><td>0.8162 士 :0.0062</td><td>0.7924 ± 0.0051</td></tr><tr><td>SR.HSE</td><td>0.8330 ± 0.0053</td><td>0.8453 土 0.0072</td><td>0.8308 ± 0.0103</td></tr><tr><td>SR.MMP</td><td>0.9249 ± 0.0014</td><td>0.9219 ±0.0004</td><td>0.9262 ± 0.0036</td></tr><tr><td>SR.p53</td><td>0.8425 ± 0.0023</td><td>0.8194± :0.0010</td><td>0.8278 ± 0.0090</td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td>Average</td><td>0.8150± 0.0038</td><td>0.8070± 0.0002</td><td>0.7998 ± 0.0034</td></tr></table>
142
+
143
+ # 4.3.3 EFFECTIVENESS OF OUR STRUCTURE LEARNING
144
+
145
+ To further show the effectiveness of our structure learning method, we introduce a new model called BSNN-FC. For each specific task, the structure of BSNN-FC is completely the same as that of BSNN, except that the layers in the sparse Backbone path are changed to fully-connected layers. We train BSNN-FC for all the tasks in Tox21 dataset and the results are shown in Table 6. From the table we can see that, although BSNN keeps only $5 \%$ of the connections in the sparse path, it gives classification results which are very similar to that of BSNN-FC. It shows that our structure learning method successfully removes the useless connections in BSNN-FC.
146
+
147
+ We also compare BSNNs with Pruned FNNs whose weak connections are pruned using the method in Han et al. (2015). We start from the fully pretrained FNNs reported in Table 3, and prune the connections with the smallest absolute weight values. After pruning, the number of remaining parameters in each FNN is the same as that in the corresponding BSNN for the same task. The comparison between BSNNs and pruned FNNs is shown in Table 6. Again BSNNs give higher AUC scores than pruned FNNs in 10 of the 12 classification tasks.
148
+
149
+ # 4.3.4 INTERPRETABILITY
150
+
151
+ Next we compare the interpretability of BSNNs with FNNs and Pruned FNNs on the text datasets. Here is how we interpret hidden units. We feed the data to the networks and do forward propagation to get the values of the hidden units corresponding to each data sample. Then for each hidden unit, we sort the words in descending order of the correlations between the words and the hidden unit. The top 10 words with the highest correlations are chosen to characterize the hidden unit. Following Chen et al. (2017b), we measure the interpretability of a hidden unit by considering how similar pairs of words in the top-10 list are. The similarity between two words is determined using a word2vec model (Mikolov et al., 2013a;b) trained on part of the Google News datasets, where each word is mapped to a high dimensional vector. The similarity between two words is defined as the cosine similarity of the two corresponding vectors. High similarity suggests that the two words appear in similar contexts. The interpretability score of a hidden unit is defined as the compactness of its characterizing words and is computed as the average similarity of all pairs of words. The interpretability score of a model is defined as the average of interpretability scores of all hidden units.
152
+
153
+ Table 7: Interpretability scores of BSNNS, FNNs and Pruned FNNs on different datasets
154
+
155
+ <table><tr><td>Task</td><td>BSNNs</td><td>FNNs</td><td>Pruned FNNs</td></tr><tr><td>Yelp Review Full</td><td>0.1632</td><td>0.1117</td><td>0.1</td></tr><tr><td>DBPedia</td><td>0.0609</td><td>0.0497</td><td>0.0553</td></tr><tr><td>Yahoo!Answer</td><td>0.1729</td><td>0.1632</td><td>0.1553</td></tr><tr><td>AG&#x27;s News</td><td>0.0531</td><td>0.0595</td><td>0.0561</td></tr></table>
156
+
157
+ Table 8: Qualitative interpretability results of hidden units in BSNNs. Each line corresponds to one hidden unit.
158
+
159
+ <table><tr><td>Task</td><td>BSNNs</td></tr><tr><td>Yelp Review Full</td><td>tastelessunseasoned flavorlessblandlacked paprika panko crusts unagi crumb vindaloo tortas spicey wink drapes</td></tr><tr><td>DBPedia</td><td>album songwriting chet saxophone thrash hurling backstroke badminton skier outfelder journalists hardcover editors reprinted republished</td></tr><tr><td>Yahoo!Answer</td><td>harddrive antispyware wifi mcafee routers javascript linux tcp linksys laptops romantic dating foreplay flirt boyfriend</td></tr><tr><td>AG&#x27;s News</td><td>mozilla mainframe designs collaborate microprocessors republicans prosecutor argument jfk protesters noted furious harsh concessions apologizes</td></tr></table>
160
+
161
+ Table 7 reports the interpretability scores of BSNNs, FNNs and Pruned FNNs for different datasets. Sogounews dataset is not included in the experiment since its vocabulary are Chinese pingyin characters and most of them do not appear in the Google News word2vec model. We measure the interpretability scores by considering the top-layer hidden units. For the fair of comparison, all models have approximately the same number of top-layer hidden units. As it can be seen that BSNNs significantly outperform the FNNs and Pruned FNNs in most cases and is comparable if not better, showing superior coherency and compactness in the characterizations of the hidden units and thus better model interpretability. Pruned FNNs, on the other hand, reduce the interpretability of FNNs with the pruning strategy. Table 8 shows the qualitative interpretability results by presenting the characterization words of hidden units with high interpretability scores in BSNNs. The hidden units are very meaningful for different datasets. For example, in Yelp Review dataset, the first hidden unit represents negative opinions on food with words “tasteless” and“flavorless”; the second hidden unit is more related to food like “paprika”, “crust” and “unagi”. In DBPedia, the first hidden unit is found out to have closer relationship with music, while the second one is more closely related to sport. Similar phenomena can be found in the rest of the table. This shows that the proposed BSNNs, with the statistical property, have better model interpretability and make a step further towards understandable deep learning models.
162
+
163
+ # 5 CONCLUSIONS
164
+
165
+ Structure learning for deep neural network is a challenging and interesting research problem. We have proposed an unsupervised structure learning method which utilizes the correlation information in data for learning parsimonious deep feed-forward networks. In comparison with standard FNN, although the resulting model of our method contains much fewer parameters, it achieves better or comparable classification performance in all kinds of tasks. Our method is also shown to learn models with better interpretability, which is also an important problem in deep learning. In the future, we will generalize our method to other networks like RNNs and CNNs.
166
+
167
+ # REFERENCES
168
+
169
+ Ryan Prescott Adams, Hanna M Wallach, and Zoubin Ghahramani. Learning the structure of deep sparse graphical models. In AISTATS, 2010.
170
+
171
+ Timur Ash. Dynamic node creation in backpropagation networks. Connection science, 1(4):365– 375, 1989.
172
+
173
+ Bowen Baker, Otkrist Gupta, Nikhil Naik, and Ramesh Raskar. Designing neural network architectures using reinforcement learning. In ICLR, 2017.
174
+
175
+ Martin G Bello. Enhanced training algorithms, and integrated training/architecture selection for multilayer perceptron networks. IEEE Transactions on Neural networks, 3(6):864–875, 1992.
176
+
177
+ Peixian Chen, Nevin L Zhang, Leonard KM Poon, and Zhourong Chen. Progressive em for latent tree models and hierarchical topic detection. In AAAI, 2016.
178
+
179
+ Peixian Chen, Nevin L Zhang, Tengfei Liu, Leonard KM Poon, Zhourong Chen, and Farhan Khawar. Latent tree models for hierarchical topic detection. Artificial Intelligence, 250:105–124, 2017a.
180
+
181
+ Zhourong Chen, Nevin L Zhang, Dit-Yan Yeung, and Peixian Chen. Sparse boltzmann machines with structure learning as applied to text analysis. In AAAI, 2017b.
182
+
183
+ C Chow and Cong Liu. Approximating discrete probability distributions with dependence trees. IEEE transactions on Information Theory, 14(3):462–467, 1968.
184
+
185
+ Yann Le Cun, John S. Denker, and Sara A. Solla. Optimal brain damage. In NIPS, 1990.
186
+
187
+ Xavier Glorot, Antoine Bordes, and Yoshua Bengio. Deep sparse rectifier neural networks. In AISTATS, 2011.
188
+
189
+ Yiwen Guo, Anbang Yao, and Yurong Chen. Dynamic network surgery for efficient dnns. In NIPS, 2016.
190
+
191
+ Song Han, Jeff Pool, John Tran, and William Dally. Learning both weights and connections for efficient neural network. In NIPS, 2015.
192
+
193
+ Babak Hassibi, David G. Stork, and Stork Crc. Ricoh. Com. Second order derivatives for network pruning: Optimal brain surgeon. In NIPS, 1993.
194
+
195
+ Geoffrey E Hinton, Li Deng, Dong Yu, George E Dahl, Abdel-rahman Mohamed, Navdeep Jaitly, Andrew Senior, Vincent Vanhoucke, Patrick Nguyen, Tara N Sainath, et al. Deep neural networks for acoustic modeling in speech recognition: The shared views of four research groups. IEEE Signal Processing Magazine, 29(6):82–97, 2012a.
196
+
197
+ Geoffrey E Hinton, Nitish Srivastava, Alex Krizhevsky, Ilya Sutskever, and Ruslan R Salakhutdinov. Improving neural networks by preventing co-adaptation of feature detectors. arXiv preprint arXiv:1207.0580, 2012b.
198
+
199
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
200
+
201
+ Gunter Klambauer, Thomas Unterthiner, Andreas Mayr, and Sepp Hochreiter. Self-normalizing ¨ neural networks. In NIPS, 2017.
202
+
203
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In NIPS, 2012.
204
+
205
+ Tin-Yau Kwok and Dit-Yan Yeung. Constructive algorithms for structure learning in feedforward neural networks for regression problems. IEEE Transactions on Neural Networks, 8(3):630–645, 1997.
206
+
207
+ Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep learning. Nature, 521(7553):436–444, 2015.
208
+
209
+ Hao Li, Asim Kadav, Igor Durdanovic, Hanan Samet, and Hans Peter Graf. Pruning filters for efficient convnets. In ICLR, 2017.
210
+
211
+ Tengfei Liu, Nevin L. Zhang, and Peixian Chen. Hierarchical latent tree analysis for topic detection. In ECML/PKDD, 2014.
212
+
213
+ Toma´s Mikolov, Anoop Deoras, Daniel Povey, Luk ˇ a´s Burget, and Jan ˇ Cernock ˇ y. Strategies for \` training large scale neural network language models. In IEEE Workshop on Automatic Speech Recognition and Understanding, pp. 196–201, 2011.
214
+
215
+ Tomas Mikolov, Kai Chen, Greg Corrado, and Jeffrey Dean. Efficient estimation of word representations in vector space. In International Conference on Learning Representations Workshops, 2013a.
216
+
217
+ Tomas Mikolov, Ilya Sutskever, Kai Chen, Gregory S. Corrado, and Jeffrey Dean. Distributed representations of words and phrases and their compositionality. In NIPS, 2013b.
218
+
219
+ Vinod Nair and Geoffrey E Hinton. Rectified linear units improve restricted boltzmann machines. In ICML, 2010.
220
+
221
+ Judea Pearl. Probabilistic Reasoning in Intelligent Systems: Networks of Plausible Inference. Morgan Kaufmann Publishers Inc., San Francisco, CA, USA, 1988. ISBN 0-934613-73-7.
222
+
223
+ Esteban Real, Sherry Moore, Andrew Selle, Saurabh Saxena, Yutaka Leon Suematsu, Quoc Le, and Alex Kurakin. Large-scale evolution of image classifiers. In ICML, 2017.
224
+
225
+ Suraj Srinivas and R. Venkatesh Babu. Data-free parameter pruning for deep neural networks. In Proceedings of the British Machine Vision Conference, 2015.
226
+
227
+ 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.
228
+
229
+ Ilya Sutskever, Oriol Vinyals, and Quoc V Le. Sequence to sequence learning with neural networks. In NIPS, 2014.
230
+
231
+ Lingxi Xie and Alan Yuille. Genetic cnn. arXiv preprint arXiv:1703.01513, 2017.
232
+
233
+ Nevin L Zhang. Hierarchical latent class models for cluster analysis. Journal of Machine Learning Research, 5(6):697–723, 2004.
234
+
235
+ Xiang Zhang, Junbo Zhao, and Yann LeCun. Character-level convolutional networks for text classification. In NIPS, 2015.
236
+
237
+ Barret Zoph and Quoc V Le. Neural architecture search with reinforcement learning. In ICLR, 2017.
md/train/HJNJws0cF7/HJNJws0cF7.md ADDED
@@ -0,0 +1,283 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CONVOLUTIONAL NEURAL NETWORKS COMBINED WITH RUNGE-KUTTA METHODS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ A convolutional neural network for image classification can be constructed mathematically since it can be regarded as a multi-period dynamical system. In this paper, a novel approach is proposed to construct network models from the dynamical systems view. Since a pre-activation residual network can be deemed an approximation of a time-dependent dynamical system using the forward Euler method, higher order Runge-Kutta methods (RK methods) can be utilized to build network models in order to achieve higher accuracy. The model constructed in such a way is referred to as the Runge-Kutta Convolutional Neural Network (RKNet). RK methods also provide an interpretation of Dense Convolutional Networks (DenseNets) and Convolutional Neural Networks with Alternately Updated Clique (CliqueNets) from the dynamical systems view. The proposed methods are evaluated on benchmark datasets: CIFAR-10/100, SVHN and ImageNet. The experimental results are consistent with the theoretical properties of RK methods and support the dynamical systems interpretation. Moreover, the experimental results show that the RKNets are superior to the state-of-the-art network models on CIFAR-10 and on par on CIFAR-100, SVHN and ImageNet.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Residual Networks (ResNets) which are feed-forward network models with skip connections have achieved great success on several vision benchmarks (He et al., 2016a). Recently, researchers have studied the relation between ResNets and dynamical systems (Liao & Poggio, 2016; E, 2017; Haber et al., 2017; Chang et al., 2018a;b; Lu et al., 2018). Forward Euler method, a first-order RK method, has been employed to explain ResNets with full pre-activation (He et al., 2016b) from the dynamical systems view (Haber et al., 2017; Chang et al., 2018b). Nevertheless, there is no firm evidence to prove that the residual block is just forward Euler method but not any other RK method. We regard the residual mapping as an approximation to the increment in a time-step. The accuracy of the approximation is determined by the structure of the convolutional network. Wide residual network (WRN) (Zagoruyko & Komodakis, 2016) has been proposed to improve the ability of the convolutional subnetwork. However, it is not very efficient only to widen the subnetwork. The new explanation of pre-activation ResNet and its variants which focus on improving residual mapping is one of our contributions.
12
+
13
+ In addition, some improvements on network architecture based on ordinary differential equations (ODEs) are proposed (Chang et al., 2018a; Lu et al., 2018; Chen et al., 2018). Under the assumption that pre-activation ResNet is forward Euler method, Chang et al. (2018a); Lu et al. (2018) use special linear multi-step methods (LM methods) with low order to construct the network. Chen et al. (2018) utilize a third-party package which offers numerical ODE methods to replace residual block. There is no efficient network architecture for systematic generalization to high order till now. Nevertheless, a higher-order method can achieve a lower truncation error. Since a lower truncation error likely leads to a high accuracy, it is necessary to study an efficient network architecture with a high order.
14
+
15
+ If the process of image classification is deemed a sequence of time-dependent dynamical systems, there should be a series of ODEs to describe these systems. RK methods are widely-used procedures to solve ODEs in numerical analysis (Butcher, 2008). They are also the building blocks of highorder LM methods. Consequently, these methods can be used to build network models for visual processing.
16
+
17
+ The neural network community has long been aware of the numerical methods for dynamical systems. Runge-Kutta Neural Network (RKNN) is proposed for identification of unknown dynamical systems in high accuracy (Wang & Lin, 1998), but it has not been used to model the visual system nor been extended to convolutional networks. Moreover, RKNNs adopt a specific RK methods by indicating every coefficient for the RK methods. Thus, it is hard to apply high order RK methods in RKNNs. In addition, the time-step size need to be prespecified. Hence, RKNN cannot be used in tasks where the total time is unknown such as image classification. In contrast, we learn all the coefficients and time-step sizes implicitly by training in order to avoid these difficulties. As a result, one of the major contributions of the paper is a novel and effective neural network architecture inspired by the RK methods.
18
+
19
+ In order to apply RK methods to the image classification problem, the following assumptions are made throughout the paper. Firstly, the image classification procedure is multi-period and there are transitions between adjacent periods. Secondly, each period is modeled by a time-dependent firstorder dynamical system. Based on these assumptions, a novel network model called the RKNet is proposed.
20
+
21
+ In an RKNet, a period is composed of iterations of time-steps. A particular RK method is adopted throughout the time-steps in a period to approximate the increment in each step. The increment in each step is broken down to the increments in several stages according to the adopted RK method. Each stage is approximated by a convolutional subnetwork due to the versatility of neural networks on approximation.
22
+
23
+ Another contribution of this paper is a theoretical interpretation of DenseNets and CliqueNets from the dynamical systems view. The dense connections in DenseNet resemble the relationship among increments in the stages in explicit RK methods (ERK methods). Similarly, the clique blocks in CliqueNets resemble the relationship among increments in the stages in implicit RK methods (IRK methods). Under some conditions, DenseNets and CliqueNets can be formulated as approximating dynamical systems using multi-stage RK methods. We also propose a method to convert a DenseNet to an explicit RKNet (ERKNet) and a method convert a CliqueNet to an implicit RKNet (IRKNet). Furthermore, DenseNets and CliqueNets have only one time-step in each period, whereas RKNets are more general and can have multiple time-steps in each period.
24
+
25
+ We evaluate the performance of RKNets on benchmark datasets including CIFAR-10, CIFAR100 (Krizhevsky, 2009), SVHN (Netzer et al., 2011) and ILSVRC2012 classification dataset (Russakovsky et al., 2015). Experimental results show that both ERKNets and IRKNets conform to the mathematical properties. Additionally, RKNets achieve higher accuracy than the state-of-the-art network models on CIFAR-10 and comparable accuracy on CIFAR-100, SVHN and ImageNet.
26
+
27
+ The rest of the paper is organized as follows. The related work is reviewed in Section 2. The architecture of RKNets, the dynamical systems interpretation of DenseNets and CliqueNets, and the conversion from them to RKNets are described in Section 3. The performance of RKNets is evaluated in Section 4. The conclusion and future work is described in Section 5.
28
+
29
+ # 2 RELATED WORK
30
+
31
+ ResNets have gained much attention over the past few years since they have obtained impressive performance on many challenging image tasks, such as ImageNet (Russakovsky et al., 2015) and COCO object detection (Lin et al., 2014). ResNets are deep feed-forward networks with the shortcuts as identity mappings. ResNets with pre-activation can be regarded as an unfolded shallow RNN, which implements a discrete dynamical system (Liao & Poggio, 2016). It provides a novel point of view for explaining pre-activation ResNets from dynamical systems view.
32
+
33
+ Recently, more work has emerged to connect dynamical systems with deep neural networks (E, 2017) or ResNets in particular (Haber et al., 2017; Chang et al., 2018a;b; Li et al., 2018; Long et al., 2018; Lu et al., 2018; Wang et al., 2018; Chen et al., 2018). E (2017) proposes to use continuous dynamical systems as a tool for machine learning. Chang et al. (2018a) propose three reversible architectures based on ResNets and ODE systems. Chang et al. (2018b) propose a novel method for accelerating ResNets training based on the interpretation of ResNets from dynamical systems view (Haber et al., 2017). Li et al. (2018) present a training algorithm which can be used in the context of ResNets. Lu et al. (2018) propose a 2-step architecture based on ResNets. In addition, research combining dynamical system identification and RK methods with neural networks for scientific computing has emerged recently (Raissi et al., 2017a;b; Raissi, 2018), introducing physics informed neural networks with automatic differentiation. Chen et al. (2018) utilize a third-party package which offers some numerical methods to compute the numerical solution in each time-step.
34
+
35
+ DenseNets (Huang et al., 2017) are the state-of-the-art network models after ResNets. The dense connection is the main difference from the previous models. There are direct connections from a layer to all subsequent layers in a dense block in order to allow better information and gradient flow. There is no interpretation of DenseNets from dynamical systems view yet. CliqueNets (Yang et al., 2018) are the state-of-the-art network models based on DenseNets. They adopt the alternately updated clique blocks to incorporate both forward and backward connections between any two layers in the same block. However, there is no interpretation of CliqueNets from dynamical systems view yet.
36
+
37
+ Given that the process of image classification is regarded as a sequence of time-dependent dynamical systems, there should be a set of ODEs that describes these systems. Consequently, mathematical tools could be employed to construct network models. RK methods are commonly used to solve ODEs in numerical analysis (Butcher, 2008). Higher order RK methods can achieve lower truncation error. Moreover, these methods are usually the building blocks of high-order LM methods. Therefore, RK methods are ideal tools to construct network models from dynamical systems view.
38
+
39
+ RK methods have been adopted to construct neural networks, which are known as RKNN, for identification of unknown dynamical systems described by ODEs (Wang & Lin, 1998). In that paper, neural networks are classified into two categories: (1) a network that directly learns the state trajectory of a dynamical system is called a direct-mapping neural network (DMNN); (2) a network that learns the rate of change of system states is called a RKNN. Hence, AlexNet (Krizhevsky et al., 2012), VGGNet (Simonyan & Zisserman, 2015), GoogLeNet (Szegedy et al., 2015) and ResNet (He et al., 2016a) all belong to DMNNs. Specifically, the original ResNet (He et al., 2016a) is a DMNN because of the ReLU layer after the addition operation. As a result, the ResNet building block learns the state trajectory directly, not the rate of change of the system states. On the contrary, a ResNet with pre-activation (He et al., 2016b) is an RKNN.
40
+
41
+ RKNNs are proposed to eliminate several drawbacks of DMNNs, such as the difficulty in obtaining high accuracy for the multi-step prediction of state trajectories. It has been shown theoretically and experimentally that the RKNN has higher prediction accuracy and better generalization capability than the conventional DMNN (Wang & Lin, 1998).
42
+
43
+ Therefore, it is reasonable to believe that RK methods can be adopted to design effective network architectures for image classification problems. Additionally, the RK methods might improve the performance of image classification since the convolutional subnetworks are able to approximate the rate of change of the dynamical system states more precisely.
44
+
45
+ # 3 RKNETS
46
+
47
+ The introduction to RK methods are in Section 3.1. We describe the overall structure of RKNet in Section 3.2. The structure of subnetwork for increment in each time-step is elaborated on in Section 3.3.
48
+
49
+ # 3.1 RUNGE-KUTTA METHODS
50
+
51
+ An initial value problem for a time-dependent first-order dynamical system can be described by the following ODE (Butcher, 2008):
52
+
53
+ $$
54
+ { \frac { d { \pmb y } } { d t } } = f \left( t , \pmb y ( t ) \right) , \qquad \pmb y \left( t _ { 0 } \right) = \pmb y _ { 0 } .
55
+ $$
56
+
57
+ where $\textbf { { y } }$ is a vector representing the system state. The dimension of $\textbf { { y } }$ should be equal to the dimension of the dynamical system. The ODE represents the rate of change of the system states. The rate of change is a function of time and the current system state. RK methods utilize the rate of change calculated from the ODE to approximate the increment in each time-step, and then obtain the predicted final state at the end of each step. RK methods are numerical methods originated from
58
+
59
+ ![](images/1e71843579b62c9107ba64a9e8e4f3b1c926584345b9727647f70fab120e78f4.jpg)
60
+ Figure 1: Architecture of a 3-period RKNet. $\pmb { y } ^ { ( d ) }$ denotes the system state of period $d$ . $\pmb { y } _ { 0 } ^ { ( d ) }$ is the initial state of period $d$ . ${ \pmb y } _ { r } ^ { ( d ) }$ is the final state after $r$ time-steps in period $d , r$ is the total number of time-steps in a period. It can vary in different periods. Period 1 and time-step 1 in it are unfolded as an example. System state changes throughout a period. The final state of a step is estimated as the initial state of this step adding an increment. This operation originates from RK methods. To approximate the increment is the key point in RKNet. The dotted lines are for multiscale feature strategy.
61
+
62
+ Euler method. There are two types of RK methods: explicit and implicit. Both of them are employed in the RKNet. The family of RK methods is given by the following equations (Sli & Mayers, 2003):
63
+
64
+ $$
65
+ { \pmb y } _ { n + 1 } = { \pmb y } _ { n } + h \sum _ { i = 1 } ^ { s } b _ { i } { \pmb z } _ { i } , \qquad t _ { n + 1 } = t _ { n } + h ,
66
+ $$
67
+
68
+ where
69
+
70
+ $$
71
+ z _ { i } = f \left( t _ { n } + c _ { i } h , \ y _ { n } + h \sum _ { j = 1 } ^ { s } a _ { i j } z _ { j } \right) , \qquad 1 \leq i \leq s .
72
+ $$
73
+
74
+ In equation 2, ${ \mathbf { } } ^ { \pmb { y } _ { n + 1 } }$ is an approximation of the solution to equation 1 at time $t _ { n + 1 }$ , i.e. $\boldsymbol { y } ( t _ { n + 1 } )$ ; $\scriptstyle { \mathbf { 3 0 } }$ is the input initial value; $\begin{array} { r } { h \sum _ { i = 1 } ^ { \bar { s } } b _ { i } z _ { i } } \end{array}$ is the increment of system state $\textbf { { y } }$ from $t _ { n }$ to $t _ { n + 1 }$ ; $\textstyle \sum _ { i = 1 } ^ { s } b _ { i } z _ { i }$ is the estimated slope which is the weighted average of the slopes $z _ { i }$ computed in different stages. The positive integer $s$ is the number of $z _ { i }$ , i.e. the number of stages of the RK method. The equation 3 is the general formula of $z _ { i }$ . $h$ is the time-step size which can be adaptive for different time-steps but must be fixed across stages within a time-step.
75
+
76
+ In numerical analysis, $s$ , $a _ { i j }$ , $b _ { i }$ and $c _ { i }$ in equation 2 and equation 3 need to be prespecified for a particular RK method. These coefficients are displayed in a Butcher tableau. The ERK methods are those methods with $a _ { i j } = 0$ when $1 \leq i \leq j \leq s$ . All the RK methods other than ERK methods are IRK methods. The algebraic relationships of the coefficients have to meet the order conditions to reach the highest possible order. Different RK methods have different truncation errors which are denoted by the order: an order $p$ indicates that the local truncation error is $O ( h ^ { p + 1 } )$ . If a $s$ -stage ERK method has order $p$ , then $s \geq p$ ; if $p \geq 5$ , then $s > p$ (Butcher, 2008). Furthermore, a $s$ -stage IRK method can has order $p = 2 s$ when its coefficients are chosen under some conditions (Butcher, 2008). Therefore, more stages may achieve higher orders, i.e. lower truncation errors. The Euler method is a one-stage first-order RK method with $b _ { 1 } = 1$ and $c _ { 1 } = 0$ . In other words, high-order RK methods can be expected to achieve lower truncation errors than Euler method. Thus, the goal of our proposed RKNets is to improve the classification accuracy by taking advantage of high-order RK methods.
77
+
78
+ It is necessary to specify $h$ in order to control the error of approximation in common numerical analysis. The varying time-step size can be adaptive to the regions with different rates of change. The truncation error is lower when the $h$ is smaller.
79
+
80
+ # 3.2 FROM RK METHODS TO RKNETS
81
+
82
+ There are three components of RKNets: the preprocessor, the multi-periods and the postprocessor. The preprocessor manipulates the raw images and passes the results to the first period. The postprocessor deals with the output from the last period or all the periods while adopting multiscale feature strategy (Yang et al., 2018). Then, it passes the result to the classifier to make a decision. The periods between those two components are divided by the transition layers. These periods can be modeled by time-dependent dynamical systems. Each period of an RKNet is divided into $r$ timesteps as shown in Figure 1. RK methods approximate the final state of every time-step using the rate of change of the system state. Some guiding principles when applying RK methods to RKNets are listed as follows.
83
+
84
+ Firstly, dimensionality reduction is often carried out to simplify the system identification issue, when the dimension of real dynamical system is too high. The dimension of $\textbf { { y } }$ in each period in RKNet is predefined as the multiplication of the size of feature map and the number of channels at the beginning of a period. The dimensions of $\textbf { { y } }$ in the same periods of different RKNets can be different due to various degrees of dimensionality reduction. Nevertheless, the dimension of $\textbf { { y } }$ is consistent within a period.
85
+
86
+ Secondly, given that there is no explicit ODE for image classification, a convolutional subnetwork is employed to approximate the increment in each time-step. The number of neurons in each hidden layer can be more than the dimension of $\textbf { { y } }$ .
87
+
88
+ Thirdly, the number of stages $s$ in each period is predefined in RKNet but the other coefficients, $a _ { i j }$ $b _ { i }$ and $c _ { i }$ in equation 2 and equation 3 are learned by training. Due to the order conditions (Butcher, 2008), the relationship among the coefficients are more important than the specific value of any individual coefficient. Hence, the coefficients are learned implicitly but not as explicit parameters. The optimal relationship among the coefficients with a highest possible order is obtained after training.
89
+
90
+ Lastly, the number of time-steps $r$ in each period is predefined in RKNet, but the step size $h$ is learned by training. $n$ in equation 2 and equation 3 is limited to the range $[ 0 , r )$ . The learned $h$ is thus considered adaptive. In theory, the adaptive time-step size can achieve higher accuracy.
91
+
92
+ A variety of RK methods can be adopted in the different periods of RKNets, but the same RK method is used for all time-steps within one period in an RKNet. The network models are named after the specific method in each period, such as RKNet- $3 \times 2 . 4 \times 1 . 2 \times 5 . 1 \times 1$ . The suffix in the name of an RKNet is composed of several $s \times r$ terms; each stands for the method in corresponding period. The number of such terms equals the total number of periods. $s$ or $r$ can vary in different periods. For example, RKNet- $\cdot 3 { \times } 2 . 4 { \times } 1 . 2 { \times } 5 . 1 { \times } 1$ has four periods: period one has 2 time-steps and each step has 3 stages; period two has 1 time-step and it has 4 stages; period three has 5 time-steps and each step has 2 stages; period four has 1 time-step and it has 1 stage. We use this notation throughout this paper. In addition, ERKNets only adopt ERK methods and IRKNets only adopt IRK methods.
93
+
94
+ Given an RKNet model, $s$ and $r$ can be modified to construct more variants with the same dimensions in the corresponding periods. In other words, $s$ and $r$ control depth of the network while dimensionality reduction controls the width of the network. More stages, more time-steps and larger dimensions usually lead to higher classification accuracy. However, the complexity of an ODE increases with the increase of dimensions. As a result, the convolutional subnetwork which approximates the increment in a time-step need be more complex for larger dimensions. Hence, the accuracy is also associated with the matching degree of the dimension and the convolutional subnetwork. The unmatched high-dimensional network model may have lower accuracy. Additionally, the training method might affect the classification accuracy too.
95
+
96
+ # 3.3 ERKNETS AND IRKNETS
97
+
98
+ In this section, we introduce the architecture of RKNets. As shown in equation 2, the sum of $h b _ { i } z _ { i }$ represents the increment in a time-step. It is crucial to approximate this increment in RKNet. For
99
+
100
+ ![](images/289c04b98656e522707995f6f43d5d3bb5e2b591c63fc7eb12570933a0a3de3f.jpg)
101
+ Figure 2: Architecture of one time-step in ERKNet using an $s$ -stage ERK method. ${ \bf { { y } } } _ { n }$ is the approximation of $\pmb { y } ( t _ { n } )$ . A dense block grows every $m$ times at a growth rate of $k$ to form a convolutional subnetwork for generating each $h b _ { i } z _ { i }$ . Here, $h$ is time-step size, $b _ { i }$ is coefficient of ERK method, and $z _ { i }$ is the slope of each stage in ERK method. The total number of growth is $m s$ in a dense block in order to generate $h b _ { i } z _ { i }$ for $i = 1$ , . . . , $s$ . An explicit summation layer is added after a dense block to complete a time-step.
102
+
103
+ the purpose of constructing an RKNet, it is necessary to hide the time-step size and the coefficients in RK methods. $h b _ { i } z _ { i }$ can be described as follows according to equation 3:
104
+
105
+ $$
106
+ \begin{array} { l } { { \displaystyle h b _ { i } z _ { i } = h b _ { i } f \left( t _ { n } + c _ { i } h , ~ y _ { n } + h \sum _ { j = 1 } ^ { s } a _ { i j } z _ { j } \right) } } \\ { { \displaystyle ~ = g _ { i } \left( y _ { n } + h \sum _ { j = 1 } ^ { s } a _ { i j } z _ { j } \right) } } \\ { { \displaystyle ~ = F _ { i } \left( y _ { n } , ~ h a _ { i 1 } z _ { 1 } , ~ . . . , ~ h a _ { i s } z _ { s } \right) . } } \end{array}
107
+ $$
108
+
109
+ The above transformation first changes the explicit dependence on the time in equation 3 to an implicit one. Since the time parameter $t _ { n } + c _ { i } h$ is different for the different stages, it can be absorbed into $g _ { i } ( \cdot )$ , which implicitly depends on time for stage $i$ . Afterward, the summation in the input parameter of $g _ { i } ( \cdot )$ is split into separate terms. $F _ { i } ( \cdot )$ denotes the function of these terms for each stage. We verify that $F _ { i } ( \cdot )$ can equal to $g _ { i } ( \cdot )$ after training by experiment though $F _ { i } ( \cdot )$ is more expressive than $g _ { i } ( \cdot )$ in expression. Additionally, $F _ { i } ( \cdot )$ is more memory efficient than $g _ { i } ( \cdot )$ because of saving the storage for the summation inputted to $g _ { i } ( \cdot )$ .
110
+
111
+ # 3.3.1 CONNECT ERKNETS WITH DENSENETS
112
+
113
+ In order to construct ERKNets, $h b _ { i } z _ { i }$ can be described by the equation below, according to equation 4.
114
+
115
+ $$
116
+ \begin{array} { r l } & { h b _ { i } z _ { i } = e _ { i } \left( { { y } _ { n } } , \ h a _ { i 1 } { { z } _ { 1 } } , \ \ldots , \ h a _ { i ( i - 1 ) } { { z } _ { i - 1 } } \right) } \\ & { \qquad = E _ { i } \left( { { y } _ { n } } , \ h b _ { 1 } { { z } _ { 1 } } , \ \ldots , \ h b _ { i - 1 } { { z } _ { i - 1 } } \right) . } \end{array}
117
+ $$
118
+
119
+ The above transformation first eliminates $h a _ { i j } z _ { j }$ $( i \leq j )$ from $F _ { i } ( \cdot )$ in equation 4 since $a _ { i j } = 0$ when $1 \leq i \leq j \leq s$ for ERK methods (See 3.1). As a result, $h b _ { i } z _ { i }$ is denoted by a function of $y _ { n }$ and $h a _ { i j } z _ { j }$ for $j = 1$ , . . . , $i - 1$ . It is written as $e _ { i } ( \cdot )$ . After that, adjusting the coefficients of each parameter from $a _ { i j }$ to $b _ { j }$ yields another function $E _ { i } ( \cdot )$ . It is a function of $y _ { n }$ and $h b _ { j } z _ { j }$ for $j = 1 , \ldots , i - 1$ .
120
+
121
+ If a convolutional subnetwork is adopted to model $E _ { i } ( \cdot )$ in equation 5, the most similar network structure is the dense connections in DenseNets. To be specific, a growth in a dense block concatenates all the preceding layers as the input of convolutional subnetwork just like that $h b _ { i } z _ { i }$ uses $y _ { n }$ and all the increments in preceding stages as the input of $E _ { i } ( \cdot )$ . For the purpose of adopting dense block in ERKNets, the dense blocks must conform to the following rules.
122
+
123
+ Rule 1 The number of channels of ${ \bf { { y } } } _ { n }$ is in the form of $m k$ , where $m$ and $k$ are positive integers and $k$ is known as the growth rate in DenseNet literature. The dimension of ${ \bf { \nabla } } \pmb { y } _ { n }$ is the multiplication of the size of feature map and $m k$ .
124
+
125
+ Rule 2 Every $m$ successive growth constructs a convolutional subnetwork for $E _ { i } ( \cdot )$ . Each subnetwork outputs mk channels which are regarded as a group according to the number of channels of ${ \bf { \nabla } } \pmb { y } _ { n }$ . Each convolutional subnetwork concatenates ${ \bf { { y } } } _ { n }$ and all the preceding groups as its input. The $i$ th group generated by the ith subnetwork corresponds to $h b _ { i } z _ { i }$ .
126
+
127
+ Rule 3 The total number of growth is $m s$ , where $s$ is number of stages of RK methods. Consequently, $s$ groups representing $h b _ { i } z _ { i }$ for $i = 1$ , . . . , $s$ are generated by $s$ convolutional subnetworks modeling $E _ { i } ( \cdot )$ for $i = 1$ , . . . , $s$ successively in a dense block.
128
+
129
+ Appending to a restricted dense block conforming to the above rules, ${ \bf { \nabla } } \pmb { y } _ { n }$ and the groups $h b _ { i } z _ { i }$ for $i = 1 , \dots , s$ are added to obtain $\mathbf { \nabla } _ { \mathbf { y } _ { n + 1 } }$ according to equation 2. Figure 2 illustrates one time-step of ERKNet.
130
+
131
+ In DenseNets, every dense block together with part of the subsequent computation can be regarded as a period using a $s$ -stage ERK method with $r = 1$ time-step. The transition layers and the postprocessor contain the summation operation in equation 2. This gives an explanation of DenseNets from the dynamical systems view.
132
+
133
+ # 3.3.2 CONNECT IRKNETS WITH CLIQUENETS
134
+
135
+ $h b _ { i } z _ { i }$ for IRK methods can be described by the equation below, according to equation 4.
136
+
137
+ $$
138
+ \begin{array} { r l } & { h b _ { i } z _ { i } = H _ { i } \left( y _ { n } , \ h b _ { 1 } z _ { 1 } , \ \ldots , \ h b _ { s } z _ { s } \right) } \\ & { \qquad = G _ { i } \left( h b _ { 1 } z _ { 1 } , \ \ldots , \ h b _ { i - 1 } z _ { i - 1 } , \ h b _ { i + 1 } z _ { i + 1 } , \ \ldots , \ h b _ { s } z _ { s } \right) } \\ & { \qquad = I _ { i } \left( h b _ { 1 } z _ { 1 } , \ \ldots , \ h b _ { i - 1 } z _ { i - 1 } , \ v _ { i + 1 } , \ \ldots , \ v _ { s } \right) } \end{array}
139
+ $$
140
+
141
+ where
142
+
143
+ $$
144
+ \begin{array} { l } { { \pmb { v } } _ { j } = V _ { j } ( h b _ { j } z _ { j } ) } \\ { = J _ { j } \left( \pmb { y } _ { n } , \ \pmb { v } _ { 1 } , \ \dots , \ \pmb { v } _ { j - 1 } \right) . } \end{array}
145
+ $$
146
+
147
+ The above transformation first adjusts the coefficients of each parameter of $F _ { i } ( \cdot )$ in equation 4 from $a _ { i j }$ to $b _ { j }$ . It yields another function $H _ { i } ( \cdot )$ . As a result, every $h b _ { i } z _ { i }$ is a function of $y _ { n }$ . Thus, $h b _ { i } z _ { i }$ can be denoted by a function of $h b _ { j } z _ { j }$ for $j = 1 , \ \dots , \ s , \ j \neq i$ . This function is written as $G _ { i } ( \cdot )$ .
148
+
149
+ Inspired by Newton method which is used to implement IRK methods (Butcher, 2008), $h b _ { i } z _ { i }$ is initialized using all available information firstly and then updated alternately. Given $v _ { j }$ is the initial value of $h b _ { j } z _ { j }$ , the relationship between them is denoted by the function $V _ { j } ( \cdot )$ . Therefore, $h b _ { i } z _ { i }$ can be denoted by a function of $h b _ { j } z _ { j }$ for $j = 1$ , . . . , $i - 1$ and ${ \boldsymbol { v } } _ { j }$ for $j = i \dot { + } 1$ , . . . , $s$ . This function is written as $I _ { i } ( \cdot )$ . It is the update function of $h b _ { i } z _ { i }$ . Since every $h b _ { j } z _ { j }$ is a function of $y _ { n }$ , every ${ \pmb v } _ { j }$ is also a function of $y _ { n }$ . Thus, $v _ { j }$ can be denoted by a function of $y _ { n }$ and $v _ { q }$ for $q = 1$ , . . . , $j - 1$ . This function is written as $J _ { j } ( \cdot )$ . It is the initialization function of $h b _ { j } z _ { j }$ .
150
+
151
+ The update process is a sequence of iterations till convergence in Newton method. In other words, ${ \pmb v } _ { j }$ is updated for many times to approach $h b _ { j } z _ { j }$ . During updating, $G _ { i } ( \cdot )$ with the biased input is used as the update function since $I _ { i } ( \cdot )$ is unknown. If using convolutional subnetwork to model each $I _ { i } ( \cdot )$ , these functions can be learned under the help of training. As a result, each ${ \boldsymbol { v } } _ { j }$ needs to be updated only once. Therefore, the computational cost is reduced remarkably.
152
+
153
+ If a convolutional subnetwork is adopted to model $J _ { j } ( \cdot )$ in equation 7 and $I _ { i } ( \cdot )$ in equation 6, the most similar network structure is the clique block in CliqueNets. To be specific, a clique block is composed of Stage-I and Stage-II in CliqueNet literature. Stage-I which initializes all layers in a clique block is regarded as a sequence of $J _ { j } ( \cdot )$ . Then, Stage-II for updating all layers alternately corresponds to all $I _ { i } ( \cdot )$ . In CliqueNet literature, all layers in a clique block except the top layer to be updated are concatenated as the bottom layer, i.e. the input of a convolutional subnetwork for updating. It is just like $I _ { i } ( \cdot )$ uses $h b _ { j } z _ { j }$ for $j = 1$ , . . . , $i - 1$ and ${ \pmb v } _ { j }$ for $j = i + 1$ , . . . , $s$ as input. In order to adopt clique block in IRKNets, the clique blocks must conform to the following rules.
154
+
155
+ ![](images/3964a1541e8814e122044fe8ad72fd24615d1403b7304702d7acbd86036528a0.jpg)
156
+ Figure 3: Architecture of one time-step in IRKNet using a 3-stage IRK method. ${ \bf { { y } } } _ { n }$ is the approximation of $\pmb { y } ( t _ { n } )$ . A dense block, which is Stage-I of a clique block, grows $k$ channels every time to generate the initial value of each $h b _ { i } z _ { i }$ , written as ${ \mathbf { } } v _ { i }$ . Here, $h$ is time-step size, $b _ { i }$ is coefficient of IRK method, and $z _ { i }$ is the slope of each stage in IRK method. In Stage-II of a clique block, the convolutional subnetwork concatenating the current values of $h b _ { j } z _ { j }$ for $j = 1$ , . . . , 3, $j \neq i$ to update every $h b _ { i } z _ { i }$ alternately. An explicit summation layer is added after a clique block to complete a time-step.
157
+
158
+ Rule 1 The number of channels of ${ \bf { { y } } } _ { n }$ is $k$ , which is the growth rate in Stage-I since Stage-I is a dense block. The dimension of ${ \bf { \nabla } } \pmb { y } _ { n }$ is the multiplication of the size of feature map and $k$ .
159
+
160
+ Rule 2 Every growth in Stage-I constructs a convolutional subnetwork. Each subnetwork outputs $k$ channels which are regarded as a group according to the number of channels of ${ \bf { \nabla } } \pmb { y } _ { n }$ . Each convolutional subnetwork concatenates ${ \bf { \nabla } } \pmb { y } _ { n }$ and all the preceding groups as its input. The ith group generated by the ith subnetwork is ${ \mathbf { } } v _ { i }$ .
161
+
162
+ Rule 3 The total number of growth in Stage-I is $s$ , which is number of stages of RK methods. Consequently, $s$ groups representing ${ \mathbf { } } v _ { i }$ for $i = 1$ , . . . , $s$ are generated by $s$ convolutional subnetworks successively in Stage-I. $s$ should be larger than 1 for updating alternately in Stage-II.
163
+
164
+ Appending to a restricted clique block conforming to the above rules, ${ \bf { \nabla } } \pmb { y } _ { n }$ and the groups $h b _ { i } z _ { i }$ for $i = 1 , \dots , s$ are added to obtain $\mathbf { \nabla } _ { \mathbf { y } _ { n + 1 } }$ according to equation 2. Figure 3 illustrates one time-step of IRKNet using a 3-stage IRK method as an example.
165
+
166
+ In CliqueNets, every clique block together with part of the subsequent computation can be regarded as a period using a $s$ -stage IRK method with $r = 1$ time-step. The transition layers and the postprocessor contain the summation operation in equation 2. This gives an explanation of CliqueNets from the dynamical systems view.
167
+
168
+ # 4 EXPERIMENTS
169
+
170
+ To verify the theoretical properties of RK methods and evaluate the performance of RKNets on image classification, experiments are conducted using the proposed network architectures. The experimental setup is described in Appendix A. Some extra techniques, including attentional transition, bottleneck and multiscale feature strategy, can be adopted in RKNets following CliqueNets. They are introduced in Appendix B.
171
+
172
+ Table 1: Test errors of ERKNets and IRKNets, evaluated on CIFAR-10 without data augmentation. The growth rate $k$ is 36 in every period of the RKNets. The times of successive growth in each stage, $m$ , is 1. The multiscale feature strategy is used. All the models are run with batchsize 64.
173
+
174
+ <table><tr><td>ERKNet</td><td>FLOPs (G)</td><td>Params (M)</td><td>Error (%)</td><td>IRKNet</td><td>FLOPs (G)</td><td>Params (M)</td><td>Error (%)</td></tr><tr><td>-6×1_6×1.6×1</td><td></td><td>0.74</td><td>7.08</td><td>-3×1_3×1_3×1</td><td>0.38</td><td>0.32</td><td></td></tr><tr><td>-7×1.6×1.6×1</td><td>0.66 0.83</td><td>0.83</td><td>7.02</td><td>-4×1.3×1.3×1</td><td>0.62</td><td>0.40</td><td>7.18 6.89</td></tr><tr><td>-7×1_7×1_6×1</td><td>0.87</td><td>0.91</td><td>6.67</td><td>-4×1_4×1.3×1</td><td>0.68</td><td>0.49</td><td>6.63</td></tr><tr><td>-7×1_7×1_7×1</td><td>0.88</td><td>0.99</td><td>6.61</td><td>-4×1_4×1_4×1</td><td>0.69</td><td>0.57</td><td>6.50</td></tr></table>
175
+
176
+ Table 2: Test errors evaluated on CIFAR and SVHN. $k$ is growth rate. The multiscale feature strategy is used in RKNets. A and B represent attentional transition and bottleneck respectively. The bottleneck layers which output $k$ channels to the following layers are used in IRKNets. C10 and C100 stand for CIFAR-10 and CIFAR-100 respectively. $\ " + \ "$ indicates standard data augmentation. When data augmentation is not used, dropout layers are added. The values with \* are provided by Huang et al. (2017). The values with $\dagger$ are provided by Kuen et al. (2017). The values with $\star$ are computed by ourselves. FLOPs and Params are calculated on CIFAR-10 or SVHN. RKNets are run with batchsize 32 on CIFAR but run with batchsize 64 on SVHN. Results that outperform all competing methods are bold and the overall best result is blue.
177
+
178
+ <table><tr><td>Model</td><td>FLOPs ParamsC10 (G)</td><td>(M)</td><td>(%)</td><td>C10+ (%)</td><td>C100 (%)</td><td>(%)</td><td>C100+ SVHN (%)</td></tr><tr><td>pre-act ResNet (He et al., 2016b)</td><td></td><td>10.2</td><td>10.56*</td><td>4.62</td><td>33.47*</td><td>22.71</td><td></td></tr><tr><td>WRN (Zagoruyko &amp; Komodakis,2016)</td><td>3.10+ 10.49+</td><td>11.0 36.5</td><td></td><td>4.27 4.00</td><td>一 =</td><td>20.43 19.25</td><td>1.54</td></tr><tr><td>DenseNet (Huang et al., 2017)</td><td>14.53* 27.2 10.83* 15.3</td><td></td><td>5.83 5.19</td><td>3.74 3.62</td><td>23.42 19.64</td><td>19.25 17.60</td><td>1.59 1.74</td></tr><tr><td>Hamiltonian (Chang et al.,2018a)</td><td>18.59* 25.6</td><td>1.68</td><td>1</td><td>3.46 5.98</td><td></td><td>17.18</td><td></td></tr><tr><td>LM-architecture (Lu et al., 2018)</td><td></td><td>1.7</td><td></td><td>5.27</td><td>=</td><td>26.11 22.9</td><td></td></tr><tr><td>CliqueNet (Yang et al., 2018)</td><td></td><td>68.8</td><td></td><td>=</td><td>1</td><td>16.79</td><td></td></tr><tr><td></td><td>9.45 10.56*</td><td>10.14 10.48× 5.06</td><td>5.06</td><td></td><td>23.14 21.83</td><td></td><td>1.51 1.64</td></tr><tr><td>IRKNet-5×1_5×1_5×1-AB (k=80)</td><td>2.17</td><td>1.40</td><td>5.27</td><td></td><td></td><td></td><td></td></tr><tr><td>IRKNet-5×1_5×1_5×1-A (k=80)</td><td>5.44</td><td></td><td></td><td>4.23</td><td>24.35</td><td>21.77</td><td>1.74</td></tr><tr><td></td><td></td><td>4.37</td><td>■</td><td>=</td><td>1</td><td>=</td><td>1.63</td></tr><tr><td>IRKNet-5×1_5×1_5×1-AB (k=150)</td><td>7.62</td><td>4.87</td><td>4.60</td><td>3.60</td><td>21.39</td><td>19.42</td><td>1.64</td></tr><tr><td>IRKNet-6×1_6×1_6×1-A (k=80)</td><td>7.92</td><td>6.28</td><td></td><td></td><td>=</td><td></td><td>1.52</td></tr><tr><td>IRKNet-5×1_5×1_5×1-AB (k=180)</td><td>10.98</td><td>6.99</td><td>4.56</td><td></td><td>20.88</td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td>=</td><td></td><td>18.61</td><td>1</td></tr><tr><td>IRKNet-5×1_5×1_5×1-AB (k=200)</td><td>13.55</td><td>8.63</td><td></td><td>3.54</td><td>20.67</td><td>18.11</td><td></td></tr><tr><td>IRKNet-5×1_5×1_5×1-AB (k=240)</td><td>19.51</td><td>12.41</td><td></td><td>3.40</td><td>20.58</td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
179
+
180
+ According to the theoretical results, an RK method with more stages usually has a higher order and a lower truncation error. Therefore, as the number of stages increases, a more precise approximation of the system states in every period leads to more accurate classification. Table 1 shows the number of FLOPs and parameters and classification error on CIFAR-10 for RKNets with varying number of stages in each period. The empirical results are consistent with the theoretical properties.
181
+
182
+ Table 3: Classification errors on ImageNet validation set with a single-crop $( 2 2 4 \times 2 2 4 )$ ). The growth rate $k$ is 32 and $m k$ is the initial number of channels in each period in RKNets. $m _ { n }$ stands for $m$ in the $n$ th period. For each RKNet in this table, $m _ { 0 }$ is 2, $m _ { 1 }$ is 4 and $m _ { 2 }$ is 8. B represents bottleneck. The bottleneck layers which output $4 k$ channels to the following layers are used in ERKNets.
183
+
184
+ <table><tr><td>Model</td><td>m3</td><td>FLOPs (G)</td><td>Params (M)</td><td>Top1 (%)</td><td>Top5 (%)</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>ERKNet-3×1_3×1_3×1_1×1-B</td><td>16</td><td>5.20</td><td>6.95</td><td>25.47</td><td>7.81</td></tr><tr><td>ERKNet-3×1_3×1_4×1_2×1-B</td><td>20</td><td>6.35</td><td>14.49</td><td>24.12</td><td>7.17</td></tr><tr><td>ERKNet-3×1_3×1_6×1_2×1-B</td><td>28</td><td>8.50</td><td>25.51</td><td>23.14</td><td>6.66</td></tr></table>
185
+
186
+ ![](images/f788b26a46f073120e78b1ff01754f04850c1b09b7f84227eee08acb24d92866.jpg)
187
+ Figure 4: Comparison of the DenseNets, CliqueNets and RKNets. The top-1 error rates (single-crop testing) on the ImageNet validation dataset are shown as a function of learned parameters (left) and FLOPs during test-time (right). RKNets compared here are the models shown in Table 3.
188
+
189
+ IRKNets are evaluated on CIFAR-10, CIFAR-100 and SVHN while ERKNets are evaluated on ImageNet to compare with the state-of-the-art network models. The test errors of IRKNets on CIFAR10, CIFAR-100 and SVHN are shown in Table 2. The top-1 and top-5 errors on ImageNet validation set with a single-crop $( 2 2 4 \times 2 2 4 )$ are shown in Table 3. Figure 4 shows the single-crop top-1 validation errors of DenseNets, CliqueNets and RKNets as a function of the number of parameters (left) and FLOPs (right). According to the experimental results, RKNets are more efficient than the state-of-the-art models on CIFAR-10 and on par on CIFAR-100, SVHN and ImageNet.
190
+
191
+ # 5 CONCLUSION
192
+
193
+ We propose to employ a type of numerical ODE methods, the RK methods, to construct convolutional neural networks for image classification tasks. The proposed network architecture can systematically generalize to high order. At the same time, we give a theoretical interpretation of the DenseNet and CliqueNet via the dynamical systems view. The model constructed using the RK methods is referred to as the RKNet, which can be converted from a DenseNet or CliqueNet by enforcing theoretical constraints.
194
+
195
+ The experimental results validate the theoretical properties of RK methods and support the dynamical systems interpretation. Moreover, the experimental results demonstrate that RKNets surpass the state-of-the-art models on CIFAR-10 and are on par on CIFAR-100, SVHN and ImageNet.
196
+
197
+ With the help of the dynamical systems view and various numerical ODE methods including RK methods, more general neural networks can be constructed. Many aspects of RKNets and the dynamical systems view still require further investigation. We hope this work inspires future research directions.
198
+
199
+ # REFERENCES
200
+
201
+ John Charles Butcher. Numerical methods for ordinary differential equations. John Wiley & Sons, 2008.
202
+
203
+ Bo Chang, Lili Meng, Eldad Haber, Lars Ruthotto, David Begert, and Elliot Holtham. Reversible architectures for arbitrarily deep residual neural networks. In AAAI Conference on Artificial Intelligence, 2018a.
204
+
205
+ Bo Chang, Lili Meng, Eldad Haber, Frederick Tung, and David Begert. Multi-level residual networks from dynamical systems view. In International Conference on Learning Representations, 2018b.
206
+
207
+ Tian Qi Chen, Yulia Rubanova, Jesse Bettencourt, and David Duvenaud. Neural ordinary differential equations. In Advances in Neural Information Processing Systems, 2018.
208
+
209
+ Weinan E. A proposal on machine learning via dynamical systems. Communications in Mathematics and Statistics, 5(1):1–11, Mar 2017. ISSN 2194-671X. doi: 10.1007/s40304-017-0103-z. URL https://doi.org/10.1007/s40304-017-0103-z.
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
+ Eldad Haber, Lars Ruthotto, Elliot Holtham, and Seong-Hwan Jun. Learning across scales - multiscale methods for convolution neural networks. arXiv preprint arXiv:1703.02009, 2017.
214
+
215
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In The IEEE International Conference on Computer Vision (ICCV), December 2015.
216
+
217
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2016a.
218
+
219
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Identity mappings in deep residual networks. In European Conference on Computer Vision, pp. 630–645. Springer, 2016b.
220
+
221
+ Andrew G Howard. Some improvements on deep convolutional neural network based image classification. In International Conference on Learning Representations, 2014.
222
+
223
+ Gao Huang, Zhuang Liu, Laurens van der Maaten, and Kilian Q. Weinberger. Densely connected convolutional networks. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), July 2017.
224
+
225
+ Alex Krizhevsky. Learning multiple layers of features from tiny images. 2009.
226
+
227
+ 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.
228
+
229
+ Jason Kuen, Xiangfei Kong, Gang Wang, and Yap-Peng Tan. Delugenets: Deep networks with efficient and flexible cross-layer information inflows. In The IEEE International Conference on Computer Vision (ICCV) Workshops, Oct 2017.
230
+
231
+ Qianxiao Li, Long Chen, Cheng Tai, and Weinan E. Maximum principle based algorithms for deep learning. Journal of Machine Learning Research, 18(165):1–29, 2018. URL http://jmlr. org/papers/v18/17-653.html.
232
+
233
+ Qianli Liao and Tomaso Poggio. Bridging the gaps between residual learning, recurrent neural networks and visual cortex. arXiv preprint arXiv:1604.03640, 2016.
234
+
235
+ Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollar, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In ´ European conference on computer vision, pp. 740–755. Springer, 2014.
236
+
237
+ Zichao Long, Yiping Lu, Xianzhong Ma, and Bin Dong. PDE-net: Learning PDEs from data. 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. 3208–3216, Stockholmsmssan, Stockholm Sweden, 10–15 Jul 2018. PMLR. URL http://proceedings. mlr.press/v80/long18a.html.
238
+
239
+ Yiping Lu, Aoxiao Zhong, Quanzheng Li, and Bin Dong. Beyond finite layer neural networks: Bridging deep architectures and numerical differential equations. 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. 3276–3285, Stockholmsmssan, Stockholm Sweden, 10–15 Jul 2018. PMLR. URL http://proceedings.mlr.press/v80/ lu18d.html.
240
+
241
+ Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Y. Ng. Reading digits in natural images with unsupervised feature learning. In NIPS Workshop on Deep Learning and Unsupervised Feature Learning 2011, 2011. URL http://ufldl.stanford.edu/ housenumbers/nips2011_housenumbers.pdf.
242
+
243
+ Maziar Raissi. Deep hidden physics models: Deep learning of nonlinear partial differential equations. arXiv preprint arXiv:1801.06637, 2018.
244
+
245
+ Maziar Raissi, Paris Perdikaris, and George Em Karniadakis. Physics informed deep learning (part i): Data-driven solutions of nonlinear partial differential equations. arXiv preprint arXiv:1711.10561, 2017a.
246
+
247
+ Maziar Raissi, Paris Perdikaris, and George Em Karniadakis. Physics informed deep learning (part ii): Data-driven discovery of nonlinear partial differential equations. arXiv preprint arXiv:1711.10566, 2017b.
248
+
249
+ 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.
250
+
251
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In International Conference on Learning Representations, 2015.
252
+
253
+ Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: A simple way to prevent neural networks from overfitting. Journal of Machine Learning Research, 15:1929–1958, 2014. URL http://jmlr.org/papers/v15/ srivastava14a.html.
254
+
255
+ Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2015.
256
+
257
+ Endre Sli and David F. Mayers. An Introduction to Numerical Analysis. Cambridge University Press, 2003.
258
+
259
+ Bao Wang, Xiyang Luo, Zhen Li, Wei Zhu, Zuoqiang Shi, and Stanley J Osher. Deep learning with data dependent implicit activation function. arXiv preprint arXiv:1802.00168, 2018.
260
+
261
+ Yi-Jen Wang and Chin-Teng Lin. Runge-kutta neural network for identification of dynamical systems in high accuracy. IEEE Transactions on Neural Networks, 9(2):294–307, 1998.
262
+
263
+ Yibo Yang, Zhisheng Zhong, Tiancheng Shen, and Zhouchen Lin. Convolutional neural networks with alternately updated clique. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2018.
264
+
265
+ Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. In BMVC, 2016.
266
+
267
+ # A EXPERIMENTAL SETUP
268
+
269
+ The RKNets are evaluated on CIFAR-10, CIFAR-100, SVHN and ImageNet. The CIFAR-10 dataset contains 60,000 color images of size $3 2 \times 3 2$ in 10 classes, with 5,000 training images and 1,000 test images per class. The CIFAR-100 is similar to the CIFAR-10 except that it has 100 classes and 500 training images and 100 test images per class. The Street View House Numbers (SVHN) dataset (Netzer et al., 2011) contains $3 2 \times 3 2$ colored digit images. There are 73,257 images in the training set, 26,032 images in the test set, and 531,131 images for additional training. ImageNet, which denotes the ILSVRC2012 classification dataset in this paper, consists of 1.28 million training images and 50,000 validation images. It has 1,000 classes and $7 3 2 \sim 1 , 3 0 0$ training images and 50 validation images per class.
270
+
271
+ The weights of convolution layer are initialized as in (He et al., 2015). A weight decay of 0.0001 and Nesterov momentum of 0.9 are used. The learning rate is set to 0.1 initially.
272
+
273
+ On both CIFAR and SVHN, the learning rate is divided by 10 at $50 \%$ and $7 5 \%$ of the training procedure. Moreover, the weights of fully connected layer are using Xavier initialization (Glorot & Bengio, 2010). For the cases without data augmentation, we add a dropout layer (Srivastava et al., 2014) with dropout rate 0.2 after each convolution layer following (Huang et al., 2017; Yang et al., 2018).
274
+
275
+ On CIFAR, the models are trained using stochastic gradient descent with a mini-batch size of 64 or 32 as required. A standard data augmentation scheme is adopted in some cases following (He et al., 2016a). The models are trained for 300 epochs.
276
+
277
+ On SVHN, the models are trained using stochastic gradient descent with a mini-batch size of 64. Following (Yang et al., 2018), we use all training samples without augmentation and divide images by 255 for normalization. The models are trained for 40 epochs.
278
+
279
+ On ImageNet, the models are trained with a mini-batch size of 256 for 90 epochs. Scale and aspect ratio augmentation in (Szegedy et al., 2015), the standard color augmentation in (Krizhevsky et al., 2012) as well as the photometric distortions in (Howard, 2014) are adopted. The learning rate is divided by 10 every 30 epochs.
280
+
281
+ # B EXTRA TECHNIQUES
282
+
283
+ The attentional transition is a channelwise attention mechanism in transition layers, following the method proposed in (Yang et al., 2018). In attentional transition, the filters are globally averaged after the convolution in transition firstly. Then, two fully connected (FC) operations are conducted. The first FC layer has half of the filters and is activated by a ReLU function. The second FC layer has the same number of filters and is activated by a sigmoid function. At last, the output of the second FC layer acts on the output of the convolution by filter-wise multiplication. The bottleneck layer is a $1 \times 1$ convolution layer which is placed before each $3 \times 3$ convolution layer in periods. The multiscale feature strategy is a mechanism in the postprocessor to collect outputs from all the periods but not only from the last period.
md/train/HJOQ7MgAW/HJOQ7MgAW.md ADDED
@@ -0,0 +1,226 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LONG SHORT-TERM MEMORY AS A DYNAMICALLYCOMPUTED ELEMENT-WISE WEIGHTED SUM
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Long short-term memory networks (LSTMs) were introduced to combat vanishing gradients in simple recurrent neural networks (S-RNNs) by augmenting them with additive recurrent connections controlled by gates. We present an alternate view to explain the success of LSTMs: the gates themselves are powerful recurrent models that provide more representational power than previously appreciated. We do this by showing that the LSTM’s gates can be decoupled from the embedded S-RNN, producing a restricted class of RNNs where the main recurrence computes an element-wise weighted sum of context-independent functions of the inputs. Experiments on a range of challenging NLP problems demonstrate that the simplified gate-based models work substantially better than S-RNNs, and often just as well as the original LSTMs, strongly suggesting that the gates are doing much more in practice than just alleviating vanishing gradients.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Long short-term memory networks (LSTM) (Hochreiter & Schmidhuber, 1997) have become the de-facto recurrent neural network (RNN) for learning representations of sequences in many research areas, including natural language processing (NLP). Like simple recurrent neural networks (SRNNs) (Elman, 1990), LSTMs are able to learn non-linear functions of arbitrary-length input sequences. However, they also introduce an additional memory cell to mitigate the vanishing gradient problem (Hochreiter, 1991; Bengio et al., 1994). This memory is controlled by a mechanism of gates, whose additive connections allow long-distance dependencies to be learned more easily during backpropagation. While this view is mathematically accurate, in this paper we argue that it does not provide a complete picture of why LSTMs work in practice.
12
+
13
+ We present an alternate view to explain the success of LSTMs: the gates themselves are powerful recurrent models that provide more representational power than previously appreciated. To demonstrate this, we first show that LSTMs can be seen as a combination of two recurrent models: (1) an S-RNN, and (2) an element-wise weighted sum of the S-RNN’s outputs over time, which is implicitly computed by the gates. We hypothesize that, for many practical NLP problems, the weighted sum serves as the main modeling component. The S-RNN, while theoretically expressive, is in practice only a minor contributor that clouds the mathematical clarity of the model. By replacing the S-RNN with a context-independent function of the input, we arrive at a much more restricted class of RNNs, where the main recurrence is via the element-wise weighted sums that the gates are computing.
14
+
15
+ We test our hypothesis on NLP problems, where LSTMs are wildly popular at least in part due to their ability to model crucial language phenomena such as word order (Adi et al., 2017), syntactic structure (Linzen et al., 2016), and even long-range semantic dependencies (He et al., 2017). We consider four challenging tasks: language modeling, question answering, dependency parsing, and machine translation. Experiments show that while removing the gates from an LSTM can severely hurt performance, replacing the S-RNN with a simple linear transformation of the input results in minimal or no loss in model performance. We further show that in many cases, LSTMs can be further simplified by removing the output gate, arriving at an even more transparent architecture, where the output is a context-independent function of the weighted sum. Together, these results suggest that the gates’ ability to compute an element-wise weighted sum, rather than the non-linear transition dynamics of S-RNNs, are the driving force behind LSTM’s success.
16
+
17
+ # 2 THE MEMORY CELL COMPUTES AN ELEMENT-WISE WEIGHTED SUM
18
+
19
+ LSTMs are typically motivated as an augmentation of simple RNNs (S-RNNs), defined as follows:
20
+
21
+ $$
22
+ \pmb { h } _ { t } = \operatorname { t a n h } ( \pmb { W } _ { h h } \pmb { h } _ { t - 1 } + \pmb { W } _ { h x } \pmb { x } _ { t } + \pmb { b } _ { h } )
23
+ $$
24
+
25
+ S-RNNs suffer from the vanishing gradient problem (Hochreiter, 1991; Bengio et al., 1994) due to compounding multiplicative updates of the hidden state. By introducing a memory cell and an output layer that are controlled by a set of gates, LSTMs enable shortcuts through which gradients can flow easily when learning with backpropagation. This mechanism enables learning of long-distance dependencies while preserving the expressive power of recurrent non-linear transformations provided by S-RNNs.
26
+
27
+ Rather than viewing the gates as simply an auxiliary mechanism to address a learning problem, we present an alternate view that emphasizes their modeling strengths. We argue that the LSTM should be interpreted as a hybrid of two distinct recurrent architectures: (1) the S-RNN which provides multiplicative connections across timesteps, and (2) the memory cell which provides additive connections across timesteps. On top of these recurrences, an output layer is included that simply squashes and filters the memory cell at each step.
28
+
29
+ Throughout this paper, let $\{ \pmb { x } _ { 1 } , \ldots , \pmb { x } _ { n } \}$ be the sequence of input vectors, $\{ h _ { 1 } , \ldots , h _ { n } \}$ be the sequence of output vectors, and $\{ c _ { 1 } , \ldots , c _ { n } \}$ be the memory cell’s states. Then, given the basic LSTM definition below, we can formally identify three sub-components.
30
+
31
+ $$
32
+ \begin{array} { r l } & { \tilde { c } _ { t } = \mathrm { t a n h } ( W _ { c h } h _ { t - 1 } + W _ { c x } { \boldsymbol x } _ { t } + { \boldsymbol b } _ { c } ) } \\ & { ~ i _ { t } = \sigma ( W _ { i h } h _ { t - 1 } + W _ { i x } { \boldsymbol x } _ { t } + { \boldsymbol b } _ { i } ) } \\ & { f _ { t } = \sigma ( W _ { f h } h _ { t - 1 } + W _ { f x } { \boldsymbol x } _ { t } + { \boldsymbol b } _ { f } ) } \\ & { c _ { t } = i _ { t } \circ \tilde { c } _ { t } + f _ { t } \circ c _ { t - 1 } } \\ & { o _ { t } = \sigma ( W _ { o h } h _ { t - 1 } + W _ { o x } { \boldsymbol x } _ { t } + { \boldsymbol b } _ { o } ) } \\ & { h _ { t } = o _ { t } \circ \mathrm { t a n h } ( c _ { t } ) } \end{array}
33
+ $$
34
+
35
+ Content Layer (Equation 2) We refer to $\widetilde { c } _ { t }$ as the content layer, which is the output of an S-RNN. eEvaluating the need for the multiplicative recurrent connections in this content layer is the focus of this work. The content layer is passed to the memory cell, which decides which parts of it to store.
36
+
37
+ Memory Cell (Equations 3-5) The memory cell $c _ { t }$ is controlled by two gates. The input gate $\mathbf { \delta } _ { i _ { t } }$ controls what part of the content $( \widetilde { c } _ { t } )$ is written to the memory, while the forget gate $f _ { t }$ controls what epart of the memory is deleted by filtering the previous state of the memory $( c _ { t - 1 } )$ . Writing to the memory is done by adding the filtered content $( i _ { t } \circ \widetilde { c } _ { t } )$ to the retained memory $( f _ { t } \circ c _ { t - 1 } )$ .
38
+
39
+ Output Layer (Equations 6-7) The output layer $h _ { t }$ passes the memory cell through a tanh activation function and uses an output gate $\mathbf { } _ { o _ { t } }$ to read selectively from the squashed memory cell.
40
+
41
+ Our goal is to study how much each of these components contribute to the empirical performance of LSTMs. In particular, it is worth considering the memory cell in more detail to reveal why it could serve as a standalone powerful model of long-distance context. It is possible to show that it implicitly computes an element-wise weighted sum of all the previous content layers by expanding the recurrence relation in equation (5):
42
+
43
+ $$
44
+ \begin{array} { l } { { \displaystyle c _ { t } = \dot { a } _ { t } \circ \widetilde c _ { t } + f _ { t } \circ c _ { t - 1 } } } \\ { { \displaystyle \quad = \sum _ { j = 0 } ^ { t } \left( \dot { a } _ { j } \circ \prod _ { k = j + 1 } ^ { t } f _ { k } \right) \circ \widetilde c _ { j } } } \\ { { \displaystyle \quad = \sum _ { j = 0 } ^ { t } w _ { j } ^ { t } \circ \widetilde c _ { j } } } \end{array}
45
+ $$
46
+
47
+ Each weight $\boldsymbol { w } _ { j } ^ { t }$ is a product of the input gate $i _ { j }$ (when its respective input $\widetilde { c } _ { j }$ was read) and every subsequent forget gate $f _ { k }$ e. An interesting property of these weights is that, like the gates, they are also soft element-wise binary filters.1
48
+
49
+ This sum is similar to recent architectures that rely on self-attention to learn context-dependent word representations (Cheng et al., 2016; Parikh et al., 2016; Vaswani et al., 2017). There are two major differences from self-attention: (1) instead of computing a weighted sum for each attention head, a separate weighted sum is computed for every dimension of the memory cell, (2) the weighted sum is accumulated with a dynamic program, enabling a linear rather than quadratic complexity in comparison to self-attention.
50
+
51
+ # 3 MEMORY CELLS ARE POWERFUL STANDALONE MODELS
52
+
53
+ The restricted space of element-wise weighted sums allows for easier mathematical analysis, visualization, and perhaps even learnability. However, constrained function spaces are also less expressive, and a natural question is whether these models will work well for NLP problems that need highly contextualized word representations. We hypothesize that the memory cell (which computes weighted sums) can function as a standalone contextualizer. To test this hypothesis, we present several simplifications of the LSTM’s architecture (Section 3.1), and show on a variety of NLP benchmarks that there is a qualitative performance difference between models that contain a memory cell and those that do not (Section 3.2). We conclude that the content and output layers are relatively minor contributors, and that the space of element-wise weighted sums is sufficiently powerful to compete with fully parameterized LSTMs (Section 3.3).
54
+
55
+ # 3.1 SIMPLIFIED MODELS
56
+
57
+ The modeling power of LSTMs is commonly assumed to derive from the S-RNN in the content layer, with the rest of the model acting as a learning aid to bypass the vanishing gradient problem. We first isolate the S-RNN by ablating the gates (denoted as $L S T M - G A T E S$ for consistency).
58
+
59
+ To test whether the memory cell has enough modeling power of its own, we take an LSTM and replace the S-RNN in the content layer from Equation 2 with a simple linear transformation, creating the LSTM – S-RNN model:
60
+
61
+ $$
62
+ \begin{array} { r l } & { \tilde { c } _ { t } = W _ { c x } { \boldsymbol x } _ { t } } \\ & { i _ { t } = \sigma ( W _ { i h } h _ { t - 1 } + W _ { i x } { \boldsymbol x } _ { t } + b _ { i } ) } \\ & { f _ { t } = \sigma ( W _ { f h } h _ { t - 1 } + W _ { f x } { \boldsymbol x } _ { t } + b _ { f } ) } \\ & { c _ { t } = i _ { t } \circ \tilde { c } _ { t } + f _ { t } \circ c _ { t - 1 } } \\ & { o _ { t } = \sigma ( W _ { o h } h _ { t - 1 } + W _ { o x } { \boldsymbol x } _ { t } + b _ { o } ) } \\ & { h _ { t } = o _ { t } \circ \operatorname { t a n h } ( c _ { t } ) } \end{array}
63
+ $$
64
+
65
+ We further simplify the LSTM by removing the output gate from Equation 7, leaving only the activation function in the output layer $( L S T M - S - R N N - O U T )$ :
66
+
67
+ $$
68
+ \begin{array} { r l } & { \tilde { c } _ { t } = W _ { c x } { \boldsymbol x } _ { t } } \\ & { i _ { t } = \sigma ( W _ { i h } h _ { t - 1 } + W _ { i x } { \boldsymbol x } _ { t } + b _ { i } ) } \\ & { f _ { t } = \sigma ( W _ { f h } h _ { t - 1 } + W _ { f x } { \boldsymbol x } _ { t } + b _ { f } ) } \\ & { c _ { t } = i _ { t } \circ \tilde { c } _ { t } + f _ { t } \circ c _ { t - 1 } } \\ & { h _ { t } = \operatorname { t a n h } ( c _ { t } ) } \end{array}
69
+ $$
70
+
71
+ After removing the S-RNN and the output gate from the LSTM, the entire ablated model can be written in a modular, compact form:
72
+
73
+ $$
74
+ \pmb { h } _ { t } = \mathrm { O U T P U T } \Big ( \sum _ { j = 0 } ^ { t } \pmb { w } _ { j } ^ { t } \circ \mathrm { C O N T E N T } ( \pmb { x } _ { j } ) \Big )
75
+ $$
76
+
77
+ where the content layer CONTENT $( \cdot )$ and the output layer OUTPUT $( \cdot )$ are both context-independent functions, making the entire model highly constrained and interpretable. The complexity of modeling contextual information is needed only for computing the weights $\boldsymbol { w } _ { j } ^ { t }$ . As we will see in Section 3.2, both of these ablations perform on par with LSTMs on language modeling, question answering, dependency parsing, and machine translation.
78
+
79
+ There are many other models that can be expressed in the weighted-sum form (Equation 11). In this work, we focus on the closest variant of LSTM that satisfies this property; removing the S-RNN and the output gate is sufficient for the content and output functions to be context-independent. We leave more thorough investigations into the necessity of the remaining architecture as future work.
80
+
81
+ # 3.2 EXPERIMENTS
82
+
83
+ We compare model performance on four NLP tasks, with an experimental setup that is lenient towards LSTMs and harsh towards its simplifications. In each case, we use existing implementations and previously reported hyperparameter settings. Since these settings were tuned for LSTMs, any simplification that performs equally to (or better than) LSTMs under these LSTM-friendly settings provides strong evidence that the ablated component is not a contributing factor. For each task we also report the mean and standard deviation of 5 runs of the LSTM settings to demonstrate the typical variance observed due to training with different random initializations.2 The code and settings to replicate these experiments are publicly available.3
84
+
85
+ # 3.2.1 LANGUAGE MODELING
86
+
87
+ We evaluate on two language modeling datasets: the Penn Treebank (PTB) (Marcus et al., 1993), and Google’s billion-word benchmark (BWB) (Chelba et al., 2014). PTB contains approximately 1M tokens over a vocabulary of 10K words. We used the implementation of Zaremba et al. (2014) while replacing any invocation of LSTMs with simpler models. We tested two of their configurations: medium, which uses two layers of 650-dimension LSTMs, and large, which uses two layers of 1500-dimension LSTMs.
88
+
89
+ BWB is about a thousand times larger than PTB, and uses a more diverse vocabulary of 800K words. Using the implementation of Józefowicz et al. (2016), we tested their LSTM-2048-512 configuration. Our experiments use exactly the same hyperparameters (dimensions, dropout, learning rates, etc) that were originally tuned for LSTMs (Józefowicz et al., 2016). Following their implementation, we project the hidden state at each time step down to 512 dimensions. Due to the enormous size of this dataset, we stopped training after 5 epochs.
90
+
91
+ Table 1 shows overall model performance. In all three cases, replacing the LSTM’s content layer with a linear transformation results in small differences in perplexity. The most important result is that the small fluctuations in performance between the various gated architectures are minuscule in comparison to the enormous gap between the S-RNN $( L S T M - G A T E S )$ and the original LSTM. This striking difference strongly supports our hypothesis that the weighted sums computed by the gates – not the S-RNN – is the recurrent model that contributes mostly strongly to the final performance.
92
+
93
+ # 3.2.2 QUESTION ANSWERING
94
+
95
+ For question answering, we use two different QA systems on the Stanford question answering dataset (SQuAD) (Rajpurkar et al., 2016): the Bidirectional Attention Flow model (BiDAF) (Seo et al., 2016) and DrQA (Chen et al., 2017). BiDAF contains 3 LSTMs, which are referred to as the phrase layer, the modeling layer, and the span end encoder. Our experiments replace each of these LSTMs with their simplified counterparts. We directly use the implementation of BiDAF from AllenNLP (Gardner et al., 2017), and all experiments reuse the existing hyperparameters that were tuned for LSTMs. Likewise, we use an open-source implementation of $\mathrm { \dot { D r } Q A } ^ { 4 }$ and replace only the LSTMs, while leaving everything else intact.
96
+
97
+ Table 2 shows that all the gated models do comparably. Most importantly, ablating the S-RNN from the LSTM has a minor effect in comparison to the drop in performance when ablating the gates.
98
+
99
+ # 3.2.3 DEPENDENCY PARSING
100
+
101
+ For dependency parsing, we use the Deep Biaffine Dependency Parser (Dozat & Manning, 2016), which relies on stacked bidirectional LSTMs to learn context-sensitive word embeddings for determining arcs between a pair of words. We directly use their released implementation, which is evaluated on the Universal Dependencies English Web Treebank v1.3 (Silveira et al., 2014). In our experiments, we use the existing hyperparameters and only replace the LSTMs with the simplified architectures.
102
+
103
+ Table 1: The performance of simplified LSTM architectures on language modeling benchmarks, measured by perplexity.
104
+
105
+ <table><tr><td>Configuration</td><td>Model</td><td>Perplexity</td></tr><tr><td rowspan="4">PTB</td><td>LSTM</td><td>83.9 ± 0.3</td></tr><tr><td>- GATES</td><td>140.9</td></tr><tr><td>- S-RNN</td><td>80.5</td></tr><tr><td>- S-RNN-OUT</td><td>81.6</td></tr><tr><td rowspan="4">PTB (Large Model)</td><td>LSTM</td><td>78.8± 0.2</td></tr><tr><td>- GATES</td><td>126.1</td></tr><tr><td>- S-RNN</td><td>76.0</td></tr><tr><td>- S-RNN -OUT</td><td>78.5</td></tr><tr><td rowspan="4">BWB</td><td>LSTM (J6zefowicz et al., 2016)</td><td>47.5</td></tr><tr><td>- GATES</td><td>82.2</td></tr><tr><td>- S-RNN</td><td>45.4</td></tr><tr><td>- S-RNN-OUT</td><td>47.9</td></tr></table>
106
+
107
+ Table 2: The performance of simplified LSTM architectures on the question answering benchmark, SQuAD, measured by exact match (EM) and span overlap (F1).
108
+
109
+ <table><tr><td>System</td><td>Model</td><td>EM</td><td>F1</td></tr><tr><td rowspan="5">BiDAF</td><td>LSTM</td><td>67.9 ± 0.3</td><td>77.5 ± 0.2</td></tr><tr><td>- GATES</td><td>62.9</td><td>73.3</td></tr><tr><td>- S-RNN</td><td>68.4</td><td>78.2</td></tr><tr><td>- S-RNN-OUT</td><td>67.4</td><td>77.2</td></tr><tr><td></td><td></td><td></td></tr><tr><td rowspan="4">DrQA</td><td>LSTM</td><td>68.8 ± 0.2</td><td>78.2 ± 0.2</td></tr><tr><td>- GATES</td><td>56.4</td><td>66.5</td></tr><tr><td>- S-RNN</td><td>67.7</td><td>77.0</td></tr><tr><td>- S-RNN -OUT</td><td>67.0</td><td>76.2</td></tr></table>
110
+
111
+ Table 3: The performance of simplified LSTM architectures on the universal dependencies parsing benchmark, measured by unlabeled attachment score (UAS) and labeled attachment score (LAS).
112
+
113
+ <table><tr><td>Model</td><td>UAS</td><td>LAS</td></tr><tr><td>LSTM</td><td>90.60 ± 0.21</td><td>88.05 ± 0.33</td></tr><tr><td>- GATES</td><td>87.75</td><td>84.61</td></tr><tr><td>- S-RNN</td><td>90.77</td><td>88.49</td></tr><tr><td>- S-RNN-OUT</td><td>90.70</td><td>88.31</td></tr></table>
114
+
115
+ We observe the same pattern in the ablations for dependency parsing. The differences in performance between the gated models fall within the differences between multiple experiments with LSTMs. Consistent with ablation results from other tasks, removing the gating mechanisms causes a 3-4 point drop in performance.
116
+
117
+ # 3.2.4 MACHINE TRANSLATION
118
+
119
+ For machine translation, we used OpenNMT (Klein et al., 2017) to train English to German translation models on the multi-modal benchmarks from WMT 2016 (used in OpenNMT’s readme file). We use OpenNMT’s default model and hyperparameters, replacing the stacked bidirectional LSTM of its
120
+
121
+ <table><tr><td>Model</td><td>BLEU</td></tr><tr><td>LSTM</td><td>35.95</td></tr><tr><td>- GATES</td><td>12.22</td></tr><tr><td>- S-RNN</td><td>36.66</td></tr><tr><td>- S-RNN-OUT</td><td>36.39</td></tr></table>
122
+
123
+ Table 4: The performance of simplified LSTM architectures on the WMT 2016 multi-modal English to German translation benchmark, measured by BLEU.
124
+
125
+ encoder with the simplified architectures. Table 4 shows that while models containing memory cells perform more-or-less on par, removing the memory cell yields a substantial performance drop.
126
+
127
+ # 3.3 DISCUSSION
128
+
129
+ In the above experiments, we show three major ablations of the LSTM. In the S-RNN experiments $( L S T M - G A T E S )$ , we ablate the memory cell and the output layer. In the LSTM �� S-RNN and LSTM – $S – R M N - O U T$ experiments, we ablate the S-RNN. As consistent with previous literature, removing the memory cell degrades performance drastically. In contrast, removing the S-RNN makes little to no difference in the final performance, suggesting that the memory cell alone is largely responsible for the success of LSTMs in NLP. The results also confirm our hypothesis that weighted sums of context words is a powerful, yet more interpretable, model of contextual information.
130
+
131
+ # 4 WEIGHT VISUALIZATION
132
+
133
+ Given the empirical evidence that LSTMs are effectively learning weighted sums of the content layers, it is natural to investigate what weights the model learns in practice. Using the more mathematically transparent simplification of LSTMs, we can visualize the weights $\boldsymbol { w } _ { j } ^ { t }$ that are placed on every input $j$ at every timestep $t$ (see Equation 11).
134
+
135
+ Unlike attention mechanisms, these weights are vectors rather than scalar values. Therefore, we can only provide a coarse-grained visualization of the weights by rendering their $L ^ { 2 }$ -norm, as shown in Table 5. In the visualization, each column indicates the word represented by the weighted sum, and each row indicates the word over which the weighted sum is computed. Dark horizontal streaks indicate the duration for which a word was remembered. Unsurprisingly, the weights on the diagonal are always the largest since it indicates the weight of the current word. More interesting task-specific patterns emerge when inspecting the off-diagonals that represent the weight on the context words.
136
+
137
+ The first visualization uses the language model from BWB. Due to the language modeling setup, there are only non-zero weights on the current or previous words. We find that the common function words are quickly forgotten, while infrequent words that signal the topic are remembered over very long distances.
138
+
139
+ The second visualization uses the dependency parser. In this setting, since the recurrent architectures are bidirectional, there are non-zero weights on all words in the sentence. The top-right triangle indicates weights from the forward direction, and the bottom-left triangle indicates from the backward direction. For syntax, we see a significantly different pattern. Function words that are useful for determining syntax are more likely to be remembered. Weights on head words are also likely to persist until the end of a constituent.
140
+
141
+ This illustration provides only a glimpse into what the model is capturing, and perhaps future, more detailed visualizations that take the individual dimensions into account can provide further insight into what LSTMs are learning in practice.
142
+
143
+ # 5 RELATED WORK
144
+
145
+ Many variants of LSTMs (Hochreiter & Schmidhuber, 1997) have been previously explored. These typically consist of a different parameterization the gates, such as LSTMs with peephole connections (Gers & Schmidhuber, 2000), or a rewiring of the connections, such as GRUs (Cho et al., 2014).
146
+
147
+ ![](images/116dcdff4d795d2dbda889b8d0af463695037f8ed08b70dd44a413daf868c26c.jpg)
148
+ Table 5: Visualization of the weights on context words learned by the memory cell. Each column represents the current word $t$ , and each row represents a context word $j$ . The gating mechanism implicitly computes element-wise weighted sums over each column. The darkness of each square indicates the $L ^ { \dot { 2 } }$ -norm of the vector weights $\boldsymbol { w } _ { j } ^ { t }$ from Equation 11. Figures on the left show weights learned by a language model. Figures on the right show weights learned by a dependency parser.
149
+
150
+ However, these modifications invariably maintain the recurrent content layer. Even more systematic explorations of LSTM variants (Józefowicz et al., 2015; Greff et al., 2016; Zoph & Le, 2017) do not question the importance of the embedded S-RNN. This is the first study to provide apples-to-apples comparisons between LSTMs and LSTMs without the recurrent content layer.
151
+
152
+ Several other recent works have also reported promising results with recurrent models that are vastly simpler than LSTMs, such as quasi-recurrent neural networks (Bradbury et al., 2016), strongly-typed recurrent neural networks (Balduzzi & Ghifary, 2016), kernel neural networks (Lei et al., 2017), and simple recurrent units (Lei & Zhang, 2017), making it increasingly apparent that LSTMs are over-parameterized. While these works indicate an obvious trend, their focus is not to provide insight into what exactly LSTMs are learning. In our carefully controlled ablation studies, we propose and evaluate the minimal changes required to test our hypothesis that LSTMs are powerful because they dynamically compute element-wise weighted sums of content layers.
153
+
154
+ As mentioned in Section 2, this weighted-sum view of LSTMs is highly related to neural attention (Bahdanau et al., 2015), which assigns a normalized scalar weight to each element as a function of its compatibility with an external element. The ability to inspect attention weights has driven the use of more interpretable neural models. Self-attention (Cheng et al., 2016; Parikh et al., 2016) extends this notion by computing intra-sequence attention. Vaswani et al. (2017) further showed that state-of-the-art machine translation can be achieved using only self-attention and without LSTMs. Recently, Arora et al. (2017) proposed a theory-driven approach to assign scalar weights to elements in a bag of words. The success of self-attention corroborates our findings that weighted sums are indeed a more effective method of learning context-sensitive representations than previously appreciated.
155
+
156
+ # 6 CONCLUSION
157
+
158
+ We presented an alternate view of LSTMs: they are a hybrid of S-RNNs and a gated model that dynamically computes weighted sums of the S-RNN outputs. Our experiments investigated whether the S-RNN is a necessary component of LSTMs. In other words, are the gates alone as powerful of a model as an LSTM? Results across four major NLP tasks (language modeling, question answering, dependency parsing, and machine translation) indicate that LSTMs suffer little to no performance loss when removing the S-RNN, but removing the gates can degrade performance substantially. This provides evidence that the gating mechanism is doing the heavy lifting in modeling context, and that element-wise weighted sums of context-independent functions of the inputs are often as effective as fully-parameterized LSTMs.
159
+
160
+ This work sheds light on the inner workings of the relatively opaque LSTM. By removing the S-RNN and the output gate, we also show that the resulting model is a far more mathematically transparent variant of LSTMs. This transparency enables a visualization of how the context affects the output of the model at every timestep, much like in attention-based models. We hope that this new outlook on LSTMs will foster better and more efficient models of contextualization.
161
+
162
+ # REFERENCES
163
+
164
+ Yossi Adi, Einat Kermany, Yonatan Belinkov, Ofer Lavi, and Yoav Goldberg. Fine-grained analysis of sentence embeddings using auxiliary prediction tasks. In ICLR, 2017.
165
+
166
+ Sanjeev Arora, Yingyu Liang, and Tengyu Ma. A simple but tough-to-beat baseline for sentence embeddings. In ICLR, 2017.
167
+
168
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In ICLR, 2015.
169
+
170
+ David Balduzzi and Muhammad Ghifary. Strongly-typed recurrent neural networks. In Proceedings of the 33nd International Conference on Machine Learning, ICML 2016, New York City, NY, USA, June 19-24, 2016, pp. 1292–1300, 2016. URL http://jmlr.org/proceedings/ papers/v48/balduzzi16.html.
171
+
172
+ Yoshua Bengio, Patrice Y. Simard, and Paolo Frasconi. Learning long-term dependencies with gradient descent is difficult. IEEE Transactions on Neural Networks, 5(2):157–166, 1994.
173
+
174
+ James Bradbury, Stephen Merity, Caiming Xiong, and Richard Socher. Quasi-recurrent neural networks. CoRR, abs/1611.01576, 2016.
175
+
176
+ Ciprian Chelba, Tomas Mikolov, Mike Schuster, Qi Ge, Thorsten Brants, and Phillipp Koehn. One billion word benchmark for measuring progress in statistical language modeling. In INTERSPEECH, 2014.
177
+
178
+ Danqi Chen, Adam Fisch, Jason Weston, and Antoine Bordes. Reading Wikipedia to answer open-domain questions. In Association for Computational Linguistics (ACL), 2017.
179
+
180
+ Jianpeng Cheng, Li Dong, and Mirella Lapata. Long short-term memory-networks for machine reading. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pp. 551–561, Austin, Texas, November 2016. Association for Computational Linguistics. URL https://aclweb.org/anthology/D16-1053.
181
+
182
+ Kyunghyun Cho, Bart van Merrienboer, Caglar Gulcehre, Dzmitry Bahdanau, Fethi Bougares, Holger Schwenk, and Yoshua Bengio. Learning phrase representations using rnn encoder–decoder for statistical machine translation. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 1724–1734, Doha, Qatar, October 2014. Association for Computational Linguistics. URL http://www.aclweb.org/anthology/D14-1179.
183
+
184
+ Timothy Dozat and Christopher D. Manning. Deep biaffine attention for neural dependency parsing. CoRR, abs/1611.01734, 2016.
185
+
186
+ Jeffrey L. Elman. Finding structure in time. Cognitive Science, 14:179–211, 1990.
187
+
188
+ Matt Gardner, Joel Grus, Mark Neumann, Oyvind Tafjord, Pradeep Dasigi, Nelson Liu, Matthew Peters, Michael Schmitz, and Luke Zettlemoyer. Allennlp: A deep semantic natural language processing platform, 2017. URL http://allennlp.org/papers/AllenNLP_white_ paper.pdf.
189
+
190
+ Felix A. Gers and Jürgen Schmidhuber. Recurrent nets that time and count. In IJCNN, 2000.
191
+
192
+ Klaus Greff, Rupesh K Srivastava, Jan Koutník, Bas R Steunebrink, and Jürgen Schmidhuber. Lstm: A search space odyssey. IEEE Transactions on Neural Networks and Learning Systems, 2016.
193
+
194
+ Luheng He, Kenton Lee, Mike Lewis, and Luke Zettlemoyer. Deep semantic role labeling: What works and what’s next. In Proceedings of the Annual Meeting of the Association for Computational Linguistics, 2017.
195
+
196
+ Sepp Hochreiter. Untersuchungen zu dynamischen neuronalen netzen. Diploma, Technische Universität München, 91, 1991.
197
+
198
+ Sepp Hochreiter and Jürgen Schmidhuber. Long Short-term Memory. Neural computation, 9(8): 1735–1780, 1997.
199
+
200
+ Rafal Józefowicz, Wojciech Zaremba, and Ilya Sutskever. An empirical exploration of recurrent network architectures. In ICML, 2015.
201
+
202
+ Rafal Józefowicz, Oriol Vinyals, Mike Schuster, Noam Shazeer, and Yonghui Wu. Exploring the limits of language modeling. arXiv preprint arXiv:1602.02410, 2016.
203
+
204
+ Guillaume Klein, Yoon Kim, Yuntian Deng, Jean Senellart, and Alexander M. Rush. Opennmt: Opensource toolkit for neural machine translation. In Proc. ACL, 2017. doi: 10.18653/v1/P17-4012. URL https://doi.org/10.18653/v1/P17-4012.
205
+
206
+ Tao Lei and Yu Zhang. Training rnns as fast as cnns. arXiv preprint arXiv:1709.02755, 2017.
207
+
208
+ Tao Lei, Wengong Jin, Regina Barzilay, and Tommi Jaakkola. Deriving neural architectures from sequence and graph kernels. In ICML, 2017.
209
+
210
+ Tal Linzen, Emmanuel Dupoux, and Yoav Goldberg. Assessing the ability of lstms to learn syntaxsensitive dependencies. TACL, 4:521–535, 2016.
211
+
212
+ Mitchell P. Marcus, Beatrice Santorini, and Mary Ann Marcinkiewicz. Building a large annotated corpus of english: The penn treebank. Computational Linguistics, 19:313–330, 1993.
213
+
214
+ Ankur Parikh, Oscar Täckström, Dipanjan Das, and Jakob Uszkoreit. A decomposable attention model for natural language inference. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pp. 2249–2255, Austin, Texas, November 2016. Association for Computational Linguistics. URL https://aclweb.org/anthology/D16-1244.
215
+
216
+ Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. Squad: 100, $0 0 0 +$ questions for machine comprehension of text. In EMNLP, 2016.
217
+
218
+ Min Joon Seo, Aniruddha Kembhavi, Ali Farhadi, and Hannaneh Hajishirzi. Bidirectional attention flow for machine comprehension. CoRR, abs/1611.01603, 2016.
219
+
220
+ Natalia Silveira, Timothy Dozat, Marie-Catherine de Marneffe, Samuel Bowman, Miriam Connor, John Bauer, and Christopher D. Manning. A gold standard dependency corpus for English. In Proceedings of the Ninth International Conference on Language Resources and Evaluation (LREC-2014), 2014.
221
+
222
+ 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.
223
+
224
+ Wojciech Zaremba, Ilya Sutskever, and Oriol Vinyals. Recurrent neural network regularization. arXiv preprint arXiv:1409.2329, 2014.
225
+
226
+ Barret Zoph and Quoc V Le. Neural architecture search with reinforcement learning. In ICLR, 2017.
md/train/HJPmdP9le/HJPmdP9le.md ADDED
@@ -0,0 +1,299 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # EFFICIENT SUMMARIZATION WITH READ-AGAIN AND COPY MECHANISM
2
+
3
+ Wenyuan Zeng†, Wenjie $\mathbf { L u o } ^ { \ddagger }$ , Sanja Fidler‡, Raquel Urtasun‡
4
+
5
+ †Tsinghua University, ‡University of Toronto cengwy13@mails.tsinghua.edu.cn {wenjie, fidler, urtasun}@cs.toronto.edu
6
+
7
+ # ABSTRACT
8
+
9
+ Encoder-decoder models have been widely used to solve sequence to sequence prediction tasks. However current approaches suffer from two shortcomings. First, the encoders compute a representation of each word taking into account only the history of the words it has read so far, yielding suboptimal representations. Second, current models utilize large vocabularies in order to minimize the problem of unknown words, resulting in slow decoding times and large storage costs. In this paper we address both shortcomings. Towards this goal, we first introduce a simple mechanism that first reads the input sequence before committing to a representation of each word. Furthermore, we propose a simple copy mechanism that is able to exploit very small vocabularies and handle out-of-vocabulary words. We demonstrate the effectiveness of our approach on the Gigaword dataset and DUC competition outperforming the state-of-the-art.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Encoder-decoder models have been widely used in sequence to sequence tasks such as machine translation (Cho et al. (2014); Sutskever et al. (2014)). They consist of an encoder which represents the whole input sequence with a single feature vector. The decoder then takes this representation and generates the desired output sequence. The most successful models are LSTM and GRU as they are much easier to train than vanilla RNNs.
14
+
15
+ In this paper we are interested in summarization where the input sequence is a sentence/paragraph and the output is a summary of the text. Several encoding-decoding approaches have been proposed (Rush et al. (2015); Hu et al. (2015); Chopra et al. (2016)). Despite their success, it is commonly believed that the intermediate feature vectors are limited as they are created by only looking at previous words. This is particularly detrimental when dealing with large input sequences. Bi-directorial RNNs (Schuster & Paliwal (1997); Bahdanau et al. (2014)) try to address this problem by computing two different representations resulting of reading the input sequence left-to-right and right-to-left. The final vectors are computed by concatenating the two representations. However, the word representations are computed with limited scope.
16
+
17
+ The decoder employed in all these methods outputs at each time step a distribution over a fixed vocabulary. In practice, this introduces problems with rare words (e.g., proper nouns) which are out of vocabulary. To alleviate this problem, one could potentially increase the size of the decoder vocabulary, but decoding becomes computationally much harder, as one has to compute the soft-max over all possible words. Gulcehre et al. (2016), Nallapati et al. (2016) and Gu et al. (2016) proposed to use a copy mechanism that dynamically copy the words from the input sequence while decoding. However, they lack the ability to extract proper embeddings of out-of-vocabulary words from the input context. Bahdanau et al. (2014) proposed to use an attention mechanism to emphasize specific parts of the input sentence when generating each word. However the encoder problem still remains in this approach.
18
+
19
+ In this work, we propose two simple mechanisms to deal with both encoder and decoder problems. We borrowed intuition from human readers which read the text multiple times before generating summaries. We thus propose a ‘Read-Again’ model that first reads the input sequence before committing to a representation of each word. The first read representation then biases the second read representation and thus allows the intermediate hidden vectors to capture the meaning appropriate for the input text. We show that this idea can be applied to both LSTM and GRU models. Our second contribution is a copy mechanism which allows us to use much smaller vocabulary sizes resulting in much faster decoding and much smaller storage space. Our copy mechanism also allows us to construct a better representation of out-of-vocabulary words. We demonstrate the effectiveness of our approach in the challenging Gigaword dataset and DUC competition showing state-of-the-art performance.
20
+
21
+ # 2 RELATED WORK
22
+
23
+ # 2.1 SUMMARIZATION
24
+
25
+ In the past few years, there has been a lot of work on extractive summarization, where a summary is created by composing words or sentences from the source text. Notable examples are Neto et al. (2002), Erkan & Radev (2004), Wong et al. (2008), Filippova & Altun (2013) and Colmenares et al. (2015). As a consequence of their extractive nature the summary is restricted to words (sentences) in the source text.
26
+
27
+ Abstractive summarization, on the contrary, aims at generating consistent summaries based on understanding the input text. Although there has been much less work on abstractive methods, they can in principle produce much richer summaries. Abstractive summarization is standardized by the DUC2003 and DUC2004 competitions (Over et al. (2007)). Some of the prominent approaches on this task includes Banko et al. (2000), Zajic et al. (2004), Cohn & Lapata (2008) and Woodsend et al. (2010). Among them, the TOPIARY system (Zajic et al. (2004)) performs the best in the competitions amongst non neural net based methods.
28
+
29
+ Very recently, the success of deep neural networks in many natural language processing tasks (Collobert et al. (2011)) has inspired new work in abstractive summarization . Rush et al. (2015) propose a neural attention model with a convolutional encoder to solve this task. Hu et al. (2015) build a large dataset for Chinese text summarization and propose to feed all hidden states from the encoder into the decoder. More recently, Chopra et al. (2016) extended Rush et al. (2015)’s work with an RNN decoder, and Nallapati et al. (2016) proposed an RNN encoder-decoder architecture for summarization. Both techniques are currently the state-of-the-art on the DUC competition. However, the encoders exploited in these methods lack the ability to encode each word condition on the whole text, as an RNN encodes a word into a hidden vector by taking into account only the words up to that time step.
30
+
31
+ In contrast, in this work we propose a ‘Read-Again’ encoder-decoder architecture, which enables the encoder to understand each input word after reading the whole sentence. Our encoder first reads the text, and the results from the first read help represent the text in the second pass over the source text. Our second contribution is a simple copy mechanism that allows us to significantly reduce the decoder vocabulary size resulting in much faster inference times. Furthermore our copy mechanism allows us to handle out-of-vocabulary words in a principled manner. Finally our experiments show state-of-the-art performance on the DUC competition.
32
+
33
+ # 2.2 NEURAL MACHINE TRANSLATION
34
+
35
+ Our work is also closely related to recent work on neural machine translation, where neural encoderdecoder models have shown promising results (Kalchbrenner & Blunsom (2013); Cho et al. (2014); Sutskever et al. (2014)). Bahdanau et al. (2014) further developed an attention mechanism in the decoder in order to pay attention to a specific part of the input at every generating time-step. Our approach also exploits an attention mechanism during decoding.
36
+
37
+ # 2.3 OUT-OF-VOCABULARY AND COPY MECHANISM
38
+
39
+ Dealing with Out-Of-Vocabulary words (OOVs) is an important issue in sequence to sequence approaches as we cannot enumerate all possible words and learn their embeddings since they might not be part of our training set. Luong et al. (2014) address this issue by annotating words on the source, and aligning OOVs in the target with those source words. Recently, Vinyals et al. (2015)
40
+
41
+ ![](images/653fea17ac317937d4d03ec1901f36f8de6b5af657201f58b2b1b20b091388a4.jpg)
42
+ Figure 1: Read-Again Summarization Model
43
+
44
+ propose Pointer Networks, which calculate a probability distribution over the input sequence instead of predicting a token from a pre-defined dictionary. Cheng & Lapata (2016) develop a neural-based extractive summarization model, which predicts the targets from the input sequences. Gulcehre et al. (2016); Nallapati et al. (2016) use explicit gating to decide adaptively wether to generate a target word from the fixed-size dictionary or from the input sequence. Gu et al. (2016) use a implicit implicit gating operation instead of the explicit gating. This is similar to our decoder. However, our decoder can also extract different OOVs’ embedding accordingly from the input text instead of using a single ${ \bf \mathrm { < U N K > } }$ embedding to represent all OOVs. This further enhances the model’s ability to handle OOVs.
45
+
46
+ # 3 THE READ AGAIN MODEL
47
+
48
+ Text summarization can be formulated as a sequence to sequence prediction task, where the input is a longer text and the output is a summary of that text. In this paper we develop an encoder-decoder approach to summarization. The encoder is used to represent the input text with a set of continuous vectors, and the decoder is used to generate a summary word by word.
49
+
50
+ In the following, we first introduce our ‘Read-Again’ model for encoding sentences. The idea behind our approach is very intuitive and is inspired by how humans do this task. When we create summaries, we first read the text and then we do a second read where we pay special attention to the words that are relevant to generate the summary. Our ‘Read-Again’ model implements this idea by reading the input text twice and using the information acquired from the first read to bias the second read. This idea can be seamlessly plugged into LSTM and GRU models. Our second contribution is a copy mechanism used in the decoder. It allows us to reduce the decoder vocabulary size dramatically and can be used to extract a better embedding for OOVs. Fig. 1(a) gives an overview of our model.
51
+
52
+ # 3.1 ENCODER
53
+
54
+ We first review the typical encoder used in machine translation (e.g., Sutskever et al. (2014); Bahdanau et al. (2014)). Let $x = \{ x _ { 1 } , x _ { 2 } , \cdot \cdot \cdot , x _ { n } \}$ be the input sequence of words. An encoder sequentially reads each word and creates the hidden representation $h _ { i }$ by exploting a recurrent neural network (RNN)
55
+
56
+ $$
57
+ h _ { i } = \mathrm { R N N } ( \mathbf { x _ { i } } , h _ { i - 1 } ) ,
58
+ $$
59
+
60
+ where $\mathbf { x _ { i } }$ is the word embedding of $x _ { i }$ . The hidden vectors $h = \{ h _ { 1 } , h _ { 2 } , \cdots , h _ { n } \}$ are then treated as the feature representations for the whole input sentence and can be used by another RNN to decode and generate a target sentence. Although RNNs have been shown to be useful in modeling sequences, one of the major drawback is that $h _ { i }$ depends only on past information i.e., $\{ x _ { 1 } , \cdots , x _ { i } \}$ . However, it is hard (even for humans) to have a proper representation of a word without reading the whole input sentence.
61
+
62
+ Following this intuition, we propose our ‘Read-Again’ model where the encoder reads the input sentence twice. In particular, the first read is used to bias the second more attentive read. We apply this idea to two popular RNN architectures, i.e. GRU and LSTM, resulting in better encodings of the input text. Note that although other alternatives, such as bidirectional RNN exist, the hidden states from the forward RNN lack direct interactions with the backward RNN, and thus forward/backward hidden states still cannot utilize the whole sequence. Besides, although we only use our model in a uni-directional manner, it can also be easily adapted to the bidirectional case. We now describe the two variants of our model.
63
+
64
+ ![](images/7583a902ba579cd1e646597ef8cc176db700cc72ce413c7267649ce33a2c585e.jpg)
65
+ Figure 2: Read-Again Model
66
+
67
+ # 3.1.1 GRU READ-AGAIN
68
+
69
+ We read the input sentence $\{ x _ { 1 } , x _ { 2 } , \cdots , x _ { n } \}$ for the first-time using a standard GRU
70
+
71
+ $$
72
+ h _ { i } ^ { 1 } = \mathrm { G R U } ^ { 1 } ( \mathbf { x _ { i } } , h _ { i - 1 } ^ { 1 } ) ,
73
+ $$
74
+
75
+ where the function $G R U ^ { 1 }$ is defined as,
76
+
77
+ $$
78
+ \begin{array} { r l } & { z _ { i } = \sigma ( W _ { z } [ \mathbf { x _ { i } } , h _ { i - 1 } ^ { 1 } ] ) } \\ & { r _ { i } = \sigma ( W _ { r } [ \mathbf { x _ { i } } , h _ { i - 1 } ^ { 1 } ] ) } \\ & { \widetilde { h } _ { i } ^ { 1 } = t a n h ( W _ { h } [ \mathbf { x _ { i } } , r _ { i } \odot h _ { i - 1 } ^ { 1 } ] ) } \\ & { h _ { i } ^ { 1 } = ( 1 - z _ { i } ) \odot h _ { i - 1 } ^ { 1 } + z _ { i } \odot \widetilde { h } _ { i } ^ { 1 } } \end{array}
79
+ $$
80
+
81
+ It consists of two gatings $z _ { i } , r _ { i }$ , controlling whether the current hidden state $h _ { i } ^ { 1 }$ should be directly copied from $h _ { i - 1 } ^ { 1 }$ or should pass through a more complex path $\widetilde { h } _ { i } ^ { 1 }$ .
82
+
83
+ Given the sentence feature vector $h _ { n } ^ { 1 }$ , we then compute an importance weight vector $\alpha _ { i }$ of each word for the second reading. We put the importance weight $\alpha _ { i }$ on the skip-connections as shown in Fig. 2(a) to bias the two information flows: If the current word $x _ { i }$ has a very small weight $\alpha _ { i }$ , then the second read hidden state $h _ { i } ^ { 2 }$ will mostly take the information directly from the previous state $h _ { i - 1 } ^ { 2 }$ , ignoring the influence of the current word. If $\alpha _ { i }$ is close to 1 then it will be similar to a standard GRU, which is only influenced from the current word. Thus the second reading has the following update rule
84
+
85
+ $$
86
+ h _ { i } ^ { 2 } = ( 1 - \alpha _ { i } ) \odot h _ { i - 1 } ^ { 2 } + \alpha _ { i } \odot \mathrm { G R U } ^ { 2 } ( \mathbf { x _ { i } } , h _ { i - 1 } ^ { 2 } ) ,
87
+ $$
88
+
89
+ where $\odot$ means element-wise product. We compute the importance weights by attending $h _ { i } ^ { 1 }$ with $h _ { n } ^ { 1 }$ as follows
90
+
91
+ $$
92
+ \alpha _ { i } = t a n h ( W _ { e } h _ { i } ^ { 1 } + U _ { e } h _ { n } ^ { 1 } + V _ { e } \mathbf { x _ { i } } ) ,
93
+ $$
94
+
95
+ where $W _ { e }$ , $U _ { e }$ , $V _ { e }$ are learnable parameters. Note that $\alpha _ { i }$ is a vector representing the importance of each dimension in the word embedding. Empirically, we find that using a vector is better than a scalar gating. We hypothesize that this is because different dimensions represent different semantic meanings, and a scalar gating mechanism lacks the ability to capture the variances among these dimensions.
96
+
97
+ ![](images/60a53f9808b57076e7e777d401e2e7704cf3b6e00e61e896a2bbfa86eaee9eec.jpg)
98
+ Figure 3: Hierachical Read-Again
99
+
100
+ Combining this with the standard GRU update rule
101
+
102
+ $$
103
+ \mathrm { G R U } ^ { 2 } ( \mathbf { x _ { i } } , h _ { i - 1 } ^ { 2 } ) = ( 1 - z _ { i } ) \odot h _ { i - 1 } ^ { 2 } + z _ { i } \odot \widetilde { h } _ { i } ^ { 2 } ,
104
+ $$
105
+
106
+ we can simplify the updating rule Eq. (4) to get
107
+
108
+ $$
109
+ h _ { i } ^ { 2 } = ( 1 - \alpha _ { i } \odot z _ { i } ) \odot h _ { i - 1 } ^ { 2 } + ( \alpha _ { i } \odot z _ { i } ) \odot \widetilde { h } _ { i } ^ { 2 }
110
+ $$
111
+
112
+ This equations shows that our ‘read-again’ model on GRU is equivalent to replace the GRU cell with a more general gating mechanism that also depends on the feature representation of the whole sentence computed from the first reading pass. We argue that adding this global information could help direct the information flow for the forward pass resulting in a better encoder.
113
+
114
+ # 3.1.2 LSTM READ-AGAIN
115
+
116
+ We now apply the ‘Read-Again’ idea to the LSTM architecture as shown in Fig. 2(b). Our first reading is performed by an $\bar { L } S T M ^ { 1 }$ defined as
117
+
118
+ $$
119
+ \begin{array} { l } { f _ { i } = \sigma ( W _ { f } [ { \bf x _ { i } } , h _ { i - 1 } ] ) } \\ { ~ i _ { i } = \sigma ( W _ { i } [ { \bf x _ { i } } , h _ { i - 1 } ] ) } \\ { o _ { i } = \sigma ( W _ { o } [ { \bf x _ { i } } , h _ { i - 1 } ] ) } \\ { ~ \widetilde C _ { i } = t a n h ( W _ { C } [ { \bf x _ { i } } , h _ { i - 1 } ] ) } \\ { ~ C _ { i } = f _ { t } \odot C _ { i - 1 } + i _ { i } \odot \widetilde C _ { i } } \\ { h _ { i } = o _ { i } \odot t a n h ( C _ { i } ) } \end{array}
120
+ $$
121
+
122
+ Different from the GRU architecture, LSTM calculates the hidden state by applying a non-linear activation function to the cell state $C _ { i }$ , instead of a linear combination of two paths used in the GRU. Thus for our second read, instead of using skip-connections, we make the gating functions explicitly depend on the whole sentence vector computed from the first reading pass. We argue that this helps the encoding of the second reading $L S T M ^ { 2 }$ , as all gating and updating increments are also conditioned on the whole sequence feature vector $\left( h _ { i } ^ { 1 } , h _ { n } ^ { 1 } \right)$ . Thus
123
+
124
+ $$
125
+ h _ { i } ^ { 2 } = \mathrm { L S T M } ^ { 2 } ( [ \mathbf { x _ { i } } , h _ { i } ^ { 1 } , h _ { n } ^ { 1 } ] , h _ { i - 1 } ^ { 2 } ) ,
126
+ $$
127
+
128
+ # 3.1.3 READING MULTIPLE SENTENCES
129
+
130
+ In this section we extend our ‘Read-Again’ model to the case where the input sequence has more than one sentence. Towards this goal, we propose to use a hierarchical representation, where each sentence has its own feature vector from the first reading pass. We then combine them into a single vector to bias the second reading pass. We illustrate this in the context of two input sentences, but it is easy to generalize to more sentences. Let $\{ x _ { 1 } , x _ { 2 } , \cdots , x _ { n } \}$ and $\{ x _ { 1 } ^ { \prime } , \cdots , x _ { m } ^ { \bar { \prime } } \}$ be the two input sentences. The first RNN reads these two sentences independently to get two sentence feature vectors $h _ { n } ^ { 1 }$ and $h _ { m } ^ { \prime 1 }$ respectively.
131
+
132
+ Here we investigate two different ways to handle multiple sentences. Our first option is to simply concatenate the two feature vectors to bias our second reading pass:
133
+
134
+ $$
135
+ h _ { i } ^ { 2 } = \mathbf { R N N ^ { 2 } } ( [ \mathbf { x _ { i } } , h _ { i } ^ { 1 } , h _ { n } ^ { 1 } , h _ { m } ^ { \prime 1 } ] , h _ { i - 1 } ^ { 2 } )
136
+ $$
137
+
138
+ $$
139
+ h _ { i } ^ { \prime 2 } = \mathrm { R N N } ^ { 2 } ( [ \mathbf { x } _ { \mathbf { i } } ^ { \prime } , h _ { i } ^ { \prime 1 } , h _ { n } ^ { 1 } , h _ { m } ^ { \prime 1 } ] , h _ { i - 1 } ^ { \prime 2 } )
140
+ $$
141
+
142
+ where $h _ { 0 } ^ { 2 }$ and $h _ { 0 } ^ { \prime 2 }$ are initialized as zero vectors. Feeding $h _ { n } ^ { 1 } , h _ { m } ^ { \prime 1 }$ into the second RNN provides more global information explicitly and helps acquire long term dependencies.
143
+
144
+ The second option we explored is shown in Fig. 3. In particular, we use a non-linear transformation to get a single feature vector $h _ { g l o b a l }$ from both sentence feature vectors:
145
+
146
+ $$
147
+ h _ { g l o b a l } = t a n h ( W _ { r } h _ { n } ^ { 1 } + U _ { r } h _ { m } ^ { \prime 1 } + v _ { r } )
148
+ $$
149
+
150
+ The second reading pass is then
151
+
152
+ $$
153
+ \begin{array} { r l } & { \widetilde { h _ { i } ^ { 2 } } = \mathrm { R N N } ^ { 2 } ( [ \mathbf { x _ { i } } , h _ { i } ^ { 1 } , h _ { n } ^ { 1 } , h _ { g l o b a l } ] , h _ { i - 1 } ^ { 2 } ) } \\ & { \widetilde { h _ { i } ^ { \prime 2 } } = \mathrm { R N N } ^ { 2 } ( [ \mathbf { x _ { i } ^ { \prime } } , h _ { i } ^ { \prime 1 } , h _ { m } ^ { \prime 1 } , h _ { g l o b a l } ] , h _ { i - 1 } ^ { \prime 2 } ) } \end{array}
154
+ $$
155
+
156
+ Note that this is more easily scalable to more sentences. In our experiments both approaches perform similarly.
157
+
158
+ # 3.2 DECODER WITH COPY MECHANISM
159
+
160
+ In this paper we argue that only a small number of common words are needed for generating a summary in addition to the words that are present in the source text. We can consider this as a hybrid approach which combines extractive and abstractive summarization. This has two benefits: first it allow us to use a very small vocabulary size, speeding up inference. Furthermore, we can create summaries which contain OOVs if they are present in the source text.
161
+
162
+ Our decoder reads the vector representations of the input text using an attention mechanism, and generates the target summary word by word. We use an LSTM as our decoder, with a fixed-size vocabulary dictionary $Y$ and learnable word embeddings $\mathbf { Y } \in \mathbf { R } ^ { | Y | \times d i m }$ . At time-step $t$ the LSTM generates a summary word $y _ { t }$ by first computing the current hidden state $s _ { t }$ from the previous hidden state $s _ { t - 1 }$ , previous summary word $y _ { t - 1 }$ and current context vector $c _ { t }$
163
+
164
+ $$
165
+ s _ { t } = L S T M ( [ \mathbf { y _ { t - 1 } } , c _ { t } ] , s _ { t - 1 } ) ,
166
+ $$
167
+
168
+ where the context vector $c _ { t }$ is computed with an attention mechanism on the encoder hidden states:
169
+
170
+ $$
171
+ c _ { t } = \sum _ { i = 1 } ^ { n } \beta _ { i t } h _ { i } ^ { 2 } .
172
+ $$
173
+
174
+ The attention score $\beta _ { i t }$ at time-step $t$ on the $i$ -th word is computed via a soft-max over $o _ { i t }$ , where
175
+
176
+ $$
177
+ o _ { i t } = a t t ( s _ { t - 1 } , h _ { i } ^ { 2 } ) = v _ { a } ^ { T } t a n h ( W _ { a } s _ { t - 1 } + U _ { a } h _ { i } ^ { 2 } ) ,
178
+ $$
179
+
180
+ with $v _ { a }$ , $W _ { a }$ , $U _ { a }$ learnable parameters.
181
+
182
+ A typical way to treat OOVs is to encode them with a single shared embedding. However, different OOVs can have very different meanings, and thus using a single embedding for all OOVs will confuse the model. This is particularly detrimental when using small vocabulary sizes. Here we address this issue by deriving the representations of OOVs from their corresponding context in the input text. Towards this goal, we change the update rule of $\mathbf { y _ { t - 1 } }$ . In particular, if $y _ { t - 1 }$ belongs to a word that is in our decoder vocabulary we take its representation from the word embedding, otherwise if it appears in the input sentence as $x _ { i }$ we use
183
+
184
+ $$
185
+ \mathbf { y _ { t - 1 } } = \mathbf { p _ { i } } = t a n h ( W _ { c } h _ { i } ^ { 2 } + b _ { c } )
186
+ $$
187
+
188
+ where $W _ { c }$ and $b _ { c }$ are learnable parameters. Since $h _ { i } ^ { 2 }$ encodes useful context information of the source word $x _ { i }$ , $p _ { i }$ can be interpreted as the semantics of this word extracted from the input sentence. Furthermore, if $y _ { t - 1 }$ does not appear in the input text, nor in $Y$ , then we represent $\mathbf { y _ { t - 1 } }$ using the ${ \bf \mathrm { < U N K > } }$ embedding.
189
+
190
+ Given the current decoder’s hidden state $s _ { t }$ , we can generate the target summary word $y _ { t }$ . As shown in Fig. 1(b), at each time step during decoding, the decoder outputs a distribution over generating words from $Y$ , as well as over copying a specific word $x _ { i }$ from the source sentence.
191
+
192
+ # 3.3 LEARNING
193
+
194
+ We jointly learn our encoder and decoder by maximizing the likelihood of decoding the correct word at each time step. We refer the reader to the experimental evaluation for more details.
195
+
196
+ # 4 EXPERIMENTAL EVALALUATION
197
+
198
+ In this section, we show results of abstractive summarization on Gigaword (Graff & Cieri (2003); Napoles et al. (2012)) and DUC2004 (Over et al. (2007)) datasets. Our model can learn a meaningful re-reading weight distribution for each word in the input text, putting more emphasis on important verb and nous, while ignoring common words such as prepositions. As for the decoder, we demonstrate that our copy mechanism can successfully reduce the typical vocabulary size by a factor 5 while achieving much better performance than the state-of-the-art, and by a factor of 30 while maintaining the same level of performance. In addition, we provide an analysis and examples of which words are copied during decoding.
199
+
200
+ Dataset and Evaluation Metric: We use the Gigaword corpus to train and evaluate our models. Gigaword is a news corpus where the title is employed as a proxy for the summary of the article. We follow the same pre-processing steps of Rush et al. (2015), which include filtering, PTB tokenization, lower-casing, replacing digit characters with #, replacing low-frequency words with UNK and extracting the first sentence in each article. This results in a training set of $3 . 8 \mathbf { M }$ articles, a validation set and a test set each containing 400K articles. The average sentence length is 31.3 words for the source, and 8.3 words for the summaries. Following the standard protocol we evaluate ROUGE score on 2000 random samples from the test set. As for evaluation metric, we use full-length F1 score on Rouge-1, Rouge-2 and Rouge-L, following Chopra et al. (2016) and Nallapati et al. (2016), since these metrics are less bias to the outputs’ length than full-length recall scores.
201
+
202
+ Implemetation Details: We implement our model in Tensorflow and conduct all experiments on a NVIDIA Titan X GPU. Our models converged after 2-3 days of training, depending on model size. Our RNN cells in all models have 1 layer, 512-dimensional hidden states, and 512-dimensional word embeddings. We use dropout rate of 0.2 in all activation layers. All parameters, except the biases are initialized uniformly with a range of $\sqrt { 3 / d }$ , where $d$ is the dimension of the hidden state (Sussillo & Abbott (2014)). The biases are initialized to 0.1. We use plain SGD to train the model with gradient clipped at 10. We start with an initial learning rate of 2, and halve it every epoch after first 5 epochs. Our max epoch for training is 10. We use a mini-batch size of 64, which is shuffled during training.
203
+
204
+ # 4.1 QUANTITATIVE EVALUATION
205
+
206
+ Table 1: Different Read-Again Model. Ours denotes Read-Again models. C denotes copy mechanism. Ours-Opt-1 and Ours-Opt-2 are the models described in section 3.1.3. Size denotes the size of decoder vocabulary in a model.
207
+
208
+ <table><tr><td>#Input</td><td>Model</td><td>Size</td><td>Rouge-1</td><td>Rouge-2</td><td>Rouge-L</td></tr><tr><td rowspan="7">1 sent</td><td>ABS (baseline)</td><td>69K</td><td>24.12</td><td>10.24</td><td>22.61</td></tr><tr><td>GRU (baseline)</td><td>69K</td><td>26.79</td><td>12.03</td><td>25.14</td></tr><tr><td>Ours-GRU</td><td>69K</td><td>27.26</td><td>12.28</td><td>25.48</td></tr><tr><td>Ours-LSTM</td><td>69K</td><td>27.82</td><td>12.74</td><td>26.01</td></tr><tr><td>GRU (baseline)</td><td>15K</td><td>24.67</td><td>11.30</td><td>23.28</td></tr><tr><td>Ours-GRU</td><td>15K</td><td>25.04</td><td>11.40</td><td>23.47</td></tr><tr><td>Ours-LSTM</td><td>15K</td><td>25.30</td><td>11.76</td><td>23.71</td></tr><tr><td>Ours-GRU (C)</td><td>15K</td><td>27.41</td><td>12.58</td><td>25.74</td></tr><tr><td rowspan="2">2 sent</td><td>Ours-LSTM (C) Ours-Opt-1 (C)</td><td>15K 15K</td><td>27.37 27.95</td><td>12.64</td><td>25.69</td></tr><tr><td></td><td></td><td></td><td>12.65</td><td>26.10</td></tr><tr><td></td><td>Ours-Opt-2 (C)</td><td>15K</td><td>27.96</td><td>12.65</td><td>26.18</td></tr></table>
209
+
210
+ Results on Gigaword: We compare the performances of different architectures and report ROUGE scores in Table 1. Our baselines include the ABS model of Rush et al. (2015) with its proposed vocabulary size as well as an attention encoder-decoder model with uni-directional GRU encoder. We allow the decoder to generate variable length summaries. As shown in Table 1 our Read-Again models outperform the baselines on all ROUGE scores, when using both 15K and 69K sized vocabularies. We also observe that adding the copy mechanism further helps to improve performance: Even though the decoder vocabulary size of our approach with copy (15K) is much smaller than ABS (69K) and GRU (69K), it achieves a higher ROUGE score. Besides, our Multiple-Sentences model achieves the best performance.
211
+
212
+ Table 2: Rouge-N limited-length recall on DUC2004. Size denotes the size of decoder vocabulary in a model.
213
+
214
+ <table><tr><td>Models</td><td>Size</td><td>Rouge-1</td><td>Rouge-2</td><td>Rouge-L</td></tr><tr><td>ZOPIARY (Zajic et al. (2004))</td><td>-</td><td>25.12</td><td>6.46</td><td>20.12</td></tr><tr><td>ABS (Rush et al. (2015))</td><td>69K</td><td>26.55</td><td>7.06</td><td>23.49</td></tr><tr><td>ABS+ (Rush et al. (2015))</td><td>69K</td><td>28.18</td><td>8.49</td><td>23.81</td></tr><tr><td>RAS-LSTM (Chopra et al. (2016))</td><td>69K</td><td>27.41</td><td>7.69</td><td>23.06</td></tr><tr><td>RAS-Elman (Chopra et al. (2016))</td><td>69K</td><td>28.97</td><td>8.26</td><td>24.06</td></tr><tr><td>big-words-lvt2k-1sent (Nallapati et al. (2016))</td><td>69K</td><td>28.35</td><td>9.46</td><td>24.59</td></tr><tr><td>big-words-lvt5k-1sent (Nallapati et al. (2016))</td><td>200K</td><td>28.61</td><td>9.42</td><td>25.24</td></tr><tr><td>Ours-GRU (C)</td><td>15K</td><td>29.08</td><td>9.20</td><td>25.25</td></tr><tr><td>Ours-LSTM (C)</td><td>15K</td><td>29.89</td><td>9.37</td><td>25.93</td></tr><tr><td>Ours-Opt-2 (C)</td><td>15K</td><td>29.74</td><td>9.44</td><td>25.94</td></tr></table>
215
+
216
+ Evaluation on DUC2004: DUC 2004 (Over et al. (2007)) is a commonly used benchmark on summarization task consisting of 500 news articles. Each article is paired with 4 different humangenerated reference summaries, capped at 75 characters. This dataset is evaluation-only. Similar to Rush et al. (2015), we train our neural model on the Gigaword training set, and show the models’ performances on DUC2004. Following the convention, we also use ROUGE limited-length recall as our evaluation metric, and set the capping length to 75 characters. We generate summaries with 15 words using beam-size of 10. As shown in Table 2, our method outperforms all previous methods on Rouge-1 and Rouge-L, and is comparable on Rouge-2. Furthermore, our model only uses $1 5 \mathrm { k }$ decoder vocabulary, while previous methods use $6 9 \mathrm { k }$ or 200k.
217
+
218
+ Importance Weight Visualization: As we described in the section before, $\alpha _ { i }$ is a high-dimension vector representing the importance of each word $x _ { i }$ . While the importance of a word is different over each dimension, by averaging we can still look at general trends of which word is more relevant.indonesia has moved #.# million people and resettl Fig. 4 depicts sample sentences with the importance weight #,### village $\alpha _ { i }$ over input words. Words such asn a national transmigration scheme the, a, ${ \bf \Phi } _ { s }$ , have small $\alpha _ { i }$ , while words such as aeronautics, resettled, impediments, which carry morepast ## years , president suharto said here mo information have higher values. This shows that our read-again technique indeed extracts usefultariffs and other barriers remain serious impediments to information from the first reading to help bias the second reading results.onesia 's state-owned domestic carrier merpati nusantara and business in the asia-p
219
+
220
+ ![](images/539b0be6900581910a2f2c98f2c6c4cb02dad3c5523881834fbd893b85b67305.jpg)
221
+ Figure 4: Weight Visualization. Black indicates high weight
222
+
223
+ # 4.2 EVALUATION OF COPY MECHANISM
224
+
225
+ Table 3 shows the effect on our model of decreasing the decoder vocabulary size. We can see that when using the copy mechanism, we are able to reduce the decoder vocabulary size from 69K to 2K, with only 2-3 points drop on ROUGE score. This contrasts the models that do not use the copy mechanism. Equipped with a copy mechanism, our model is able to generate OOVs as summary words, and thus maintains its expressive ability even with a small decoder vocabulary size. We also observe from Table 4 that the copy mechanism help us to decrease the encoder vocabulary size as well. The model without copy suffers from severe OOV problem when encoder size is small, since a single shared ${ \bf \mathrm { < U N K > } }$ embedding cannot depict many different OOVs. This makes it difficult for the encoder to understand the input text. Meanwhile, our copy model can extract an OOV’s meaning accordingly from its context in the input text, and thus it is sufficient to learn and store only the high-frequency words embeddings using our model, which in turn save the storage. We also notice that shrinking the encoder vocabulary to $1 5 \mathrm { k }$ achieves better result. One possible reason is that long tail words can not learn efficient embeddings during training, and representing them with extracted embedding from our model performs better.
226
+
227
+ Table 3: ROUGE Evaluation for Models with Different Decoder Size and 110k Encoder Size. Ours denotes Read-Again. C denotes copy mechanism.
228
+
229
+ <table><tr><td></td><td colspan="2">Rouge-1</td><td colspan="2">Rouge-2</td><td colspan="2">Rouge-L</td></tr><tr><td>Size</td><td>Ours-LSTM</td><td>Ours-LSTM (C)</td><td>Ours-LSTM</td><td>Ours-LSTM (C)</td><td>Ours-LSTM</td><td>Ours-LSTM(C)</td></tr><tr><td>2K</td><td>14.39</td><td>24.21</td><td>6.46</td><td>11.27</td><td>13.74</td><td>23.09</td></tr><tr><td>5K</td><td>20.61</td><td>26.83</td><td>9.67</td><td>12.66</td><td>19.58</td><td>25.31</td></tr><tr><td>15K</td><td>25.30</td><td>27.37</td><td>11.76</td><td>12.64</td><td>23.74</td><td>25.69</td></tr><tr><td>30K</td><td>26.86</td><td>27.49</td><td>11.93</td><td>12.75</td><td>25.16</td><td>25.77</td></tr><tr><td>69K</td><td>27.82</td><td>27.89</td><td>12.73</td><td>12.69</td><td>26.01</td><td>26.03</td></tr></table>
230
+
231
+ Table 4: ROUGE Evaluation for Models with Different Encoder Size and 15k Decoder Size. Ours denotes Read-Again. C denotes copy mechanism.
232
+
233
+ <table><tr><td colspan="3"></td><td colspan="2">Rouge-2</td><td colspan="2">Rouge-L</td></tr><tr><td>Size</td><td>Ours-LSTM</td><td>Ours-LSTM (C)</td><td>Ours-LSTM</td><td>Ours-LSTM(C)</td><td>Ours-LSTM</td><td>Ours-LSTM(C)</td></tr><tr><td>5K</td><td>21.82</td><td>26.57</td><td>9.80</td><td>11.98</td><td>20.60</td><td>25.00</td></tr><tr><td>15K</td><td>23.84</td><td>27.79</td><td>10.69</td><td>12.54</td><td>22.50</td><td>25.96</td></tr><tr><td>30K</td><td>23.78</td><td>27.48</td><td>10.68</td><td>12.56</td><td>22.28</td><td>25.94</td></tr><tr><td>110K</td><td>25.30</td><td>27.37</td><td>11.76</td><td>12.64</td><td>23.74</td><td>25.69</td></tr></table>
234
+
235
+ Table 5 shows the decoding time as a function of vocabulary size. As computing the soft-max is usually the bottleneck for decoding, reducing vocabulary size dramatically reduces the decoding time from 0.38 second per sentence to 0.08 second.
236
+
237
+ Table 5: Decoding Time (s) per Sentence of Models with Different Decoder Size
238
+
239
+ <table><tr><td>Decoder-Size</td><td>2k</td><td>5k</td><td>15k</td><td>30k</td><td>69k</td></tr><tr><td>Ours-LSTM</td><td>0.076</td><td>0.081</td><td>0.111</td><td>0.161</td><td>0.356</td></tr><tr><td>Ours-LSTM(C)</td><td>0.084</td><td>0.090</td><td>0.123</td><td>0.171</td><td>0.376</td></tr></table>
240
+
241
+ Table 6 provides some examples of visualization of the copy mechanism. Note that we are able to copy key words from source sentences to improve the summary. From these examples we can see that our model is able to copy different types of rare words, such as special entities’ names in case 1 and 2, rare nouns in case 3 and 4, adjectives in case 5 and 6, and even rare verbs in the last example. Note that in the third example, when the copy model’s decoder uses the embedding of headmaster as its first input, which is extracted from the source sentence, it generates the same following sentence as the no-copy model. This probably means that the extracted embedding of headmaster is closely related to the learned embedding of teacher.
242
+
243
+ Table 6: Visualization of Copy Mechanism
244
+
245
+ <table><tr><td>Input: Golden: No Copy: </td><td>air new zealand said friday it had reached agreement to buya ## percent interest inaustralia&#x27;s ansett holdings limited for ### million australian -lrb-### million us dollars -rrb-. urgent air new zealand buys ## percent of australia &#x27;s ansett airlines air nz to buy ## percent stake in australia&#x27;s &lt;unk&gt; air nz to buy ## percent stake in ansett</td></tr><tr><td>Copy: Input: Golden: No Copy: Copy:</td><td>yemen &#x27;s ruling party was expected wednesday to nominate president ali abdullah saleh as its candidate for september &#x27;s presidential election ,although saleh insisted he is not bluffing about bowing out. the #### gmt news advisory yemen &#x27;s ruling party expected to nominate president as presidential candidate yemen &#x27;s ruling party expected to nominate saleh as presidential candidate</td></tr><tr><td>Input: Golden: No Copy: Copy:</td><td>a ##-year-old headmaster who taught children in care homes for more than ## years was jailed for ## years on friday after being convicted of ## sexual assaults against his pupils. britain :headmaster jailed for ## years for paedophilia teacher jailed for ## years for sexuallyabusing childre headmaster jailed for ## years for sexually abusing children</td></tr><tr><td>Input: Golden: No Copy: Copy:</td><td>singapore ’s rapidly ageing population poses the major challenge to fiscal policy in the ##st century, finance minister richard hu said,and warned against european-style state &lt;unk&gt;. ageing population to pose major fiscal challenge to singapore finance minister warns against &lt;unk&gt; state s pore &#x27;s ageing population poses challenge to fiscal policy</td></tr><tr><td>Input: Golden: No Copy:</td><td>angola is planning to refit its ageing soviet-era fleet of military jets in russan factories,a media report said on tuesday. angola to refit jet fighters in russia :report angola to &lt;unk&gt; soviet-era soviet-era fleet</td></tr></table>
246
+
247
+ # 5 CONCLUSION
248
+
249
+ In this paper we have proposed two simple mechanisms to alleviate the problems of current encoderdecoder models. Our first contribution is a ‘Read-Again’ model which does not form a representation of the input word until the whole sentence is read. Our second contribution is a copy mechanism that can handle out-of-vocabulary words in a principled manner allowing us to reduce the decoder vocabulary size and significantly speed up inference. We have demonstrated the effectiveness of our approach in the context of summarization and shown state-of-the-art performance. In the future, we plan to tackle summarization problems with large input text. We also plan to exploit our findings in other tasks such as machine translation.
250
+
251
+ # REFERENCES
252
+
253
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. arXiv preprint arXiv:1409.0473, 2014.
254
+
255
+ Michele Banko, Vibhu O Mittal, and Michael J Witbrock. Headline generation based on statistical translation. In Proceedings of the 38th Annual Meeting on Association for Computational Linguistics, pp. 318–325. Association for Computational Linguistics, 2000.
256
+
257
+ Jianpeng Cheng and Mirella Lapata. Neural summarization by extracting sentences and words. arXiv preprint arXiv:1603.07252, 2016.
258
+
259
+ 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.
260
+
261
+ Sumit Chopra, Michael Auli, Alexander M Rush, and SEAS Harvard. Abstractive sentence summarization with attentive recurrent neural networks. arXiv preprint arXiv:1602.06023, 2016.
262
+
263
+ Trevor Cohn and Mirella Lapata. Sentence compression beyond word deletion. In Proceedings of the 22nd International Conference on Computational Linguistics-Volume 1, pp. 137–144. Association for Computational Linguistics, 2008.
264
+
265
+ Ronan Collobert, Jason Weston, Leon Bottou, Michael Karlen, Koray Kavukcuoglu, and Pavel ´ Kuksa. Natural language processing (almost) from scratch. Journal of Machine Learning Research, 12(Aug):2493–2537, 2011.
266
+
267
+ Carlos A Colmenares, Marina Litvak, Amin Mantrach, and Fabrizio Silvestri. Heads: Headline generation as sequence prediction using an abstract feature-rich space. 2015.
268
+
269
+ Gunes Erkan and Dragomir R Radev. Lexrank: Graph-based lexical centrality as salience in text ¨ summarization. Journal of Artificial Intelligence Research, 22:457–479, 2004.
270
+
271
+ Katja Filippova and Yasemin Altun. Overcoming the lack of parallel data in sentence compression. In EMNLP, pp. 1481–1491. Citeseer, 2013.
272
+
273
+ David Graff and Christopher Cieri. English giga-word, 2003. Linguistic Data Consortium, Philadeplhia, 2003.
274
+
275
+ Jiatao Gu, Zhengdong Lu, Hang Li, and Victor OK Li. Incorporating copying mechanism in sequence-to-sequence learning. arXiv preprint arXiv:1603.06393, 2016.
276
+
277
+ Caglar Gulcehre, Sungjin Ahn, Ramesh Nallapati, Bowen Zhou, and Yoshua Bengio. Pointing the unknown words. arXiv preprint arXiv:1603.08148, 2016.
278
+
279
+ Baotian Hu, Qingcai Chen, and Fangze Zhu. Lcsts: A large scale chinese short text summarization dataset. arXiv preprint arXiv:1506.05865, 2015.
280
+
281
+ Nal Kalchbrenner and Phil Blunsom. Recurrent continuous translation models. In EMNLP, volume 3, pp. 413, 2013.
282
+
283
+ Minh-Thang Luong, Ilya Sutskever, Quoc V Le, Oriol Vinyals, and Wojciech Zaremba. Addressing the rare word problem in neural machine translation. arXiv preprint arXiv:1410.8206, 2014.
284
+
285
+ Ramesh Nallapati, Bowen Zhou, C¸ a glar Gulc¸ehre, and Bing Xiang. Abstractive text summarization using sequence-to-sequence rnns and beyond. 2016.
286
+
287
+ Courtney Napoles, Matthew Gormley, and Benjamin Van Durme. Annotated gigaword. In Proceedings of the Joint Workshop on Automatic Knowledge Base Construction and Web-scale Knowledge Extraction, pp. 95–100. Association for Computational Linguistics, 2012.
288
+
289
+ Joel Larocca Neto, Alex A Freitas, and Celso AA Kaestner. Automatic text summarization using a machine learning approach. In Brazilian Symposium on Artificial Intelligence, pp. 205–215. Springer, 2002.
290
+
291
+ Paul Over, Hoa Dang, and Donna Harman. Duc in context. Information Processing & Management, 43(6):1506–1520, 2007.
292
+ Alexander M Rush, Sumit Chopra, and Jason Weston. A neural attention model for abstractive sentence summarization. arXiv preprint arXiv:1509.00685, 2015.
293
+ Mike Schuster and Kuldip K Paliwal. Bidirectional recurrent neural networks. IEEE Transactions on Signal Processing, 45(11):2673–2681, 1997.
294
+ David Sussillo and LF Abbott. Random walk initialization for training very deep feedforward networks. arXiv preprint arXiv:1412.6558, 2014.
295
+ 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.
296
+ Oriol Vinyals, Meire Fortunato, and Navdeep Jaitly. Pointer networks. In Advances in Neural Information Processing Systems, pp. 2692–2700, 2015.
297
+ Kam-Fai Wong, Mingli Wu, and Wenjie Li. Extractive summarization using supervised and semisupervised learning. In Proceedings of the 22nd International Conference on Computational Linguistics-Volume 1, pp. 985–992. Association for Computational Linguistics, 2008.
298
+ Kristian Woodsend, Yansong Feng, and Mirella Lapata. Generation with quasi-synchronous grammar. In Proceedings of the 2010 conference on empirical methods in natural language processing, pp. 513–523. Association for Computational Linguistics, 2010.
299
+ David Zajic, Bonnie Dorr, and Richard Schwartz. Bbn/umd at duc-2004: Topiary. In Proceedings of the HLT-NAACL 2004 Document Understanding Workshop, Boston, pp. 112–119, 2004.
md/train/HJSA_e1AW/HJSA_e1AW.md ADDED
@@ -0,0 +1,378 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # NORMALIZED DIRECTION-PRESERVING ADAM
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Optimization algorithms for training deep models not only affects the convergence rate and stability of the training process, but are also highly related to the generalization performance of trained models. While adaptive algorithms, such as Adam and RMSprop, have shown better optimization performance than stochastic gradient descent (SGD) in many scenarios, they often lead to worse generalization performance than SGD, when used for training deep neural networks (DNNs). In this work, we identify two problems regarding the direction and step size for updating the weight vectors of hidden units, which may degrade the generalization performance of Adam. As a solution, we propose the normalized direction-preserving Adam (ND-Adam) algorithm, which controls the update direction and step size more precisely, and thus bridges the generalization gap between Adam and SGD. Following a similar rationale, we further improve the generalization performance in classification tasks by regularizing the softmax logits. By bridging the gap between SGD and Adam, we also shed some light on why certain optimization algorithms generalize better than others.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ In contrast with the growing complexity of neural network architectures (Szegedy et al., 2015; He et al., 2016; Hu et al., 2017), the training methods remain relatively simple. Most practical optimization methods for deep neural networks (DNNs) are based on the stochastic gradient descent (SGD) algorithm. However, the learning rate of SGD, as a hyperparameter, is often difficult to tune, since the magnitudes of different parameters can vary widely, and adjustment is required throughout the training process.
12
+
13
+ To tackle this problem, several adaptive variants of SGD have been developed, including Adagrad (Duchi et al., 2011), Adadelta (Zeiler, 2012), RMSprop (Tieleman & Hinton, 2012), Adam (Kingma & Ba, 2014), etc. These algorithms aim to adapt the learning rate to different parameters automatically, based on the statistics of gradient. Although they usually simplify learning rate settings, and lead to faster convergence, it is observed that their generalization performance tend to be significantly worse than that of SGD in some scenarios (Wilson et al., 2017). This intriguing phenomenon may explain why SGD (possibly with momentum) is still prevalent in training state-of-the-art deep models, especially feedforward DNNs (Szegedy et al., 2015; He et al., 2016; Hu et al., 2017). Furthermore, recent work has shown that DNNs are capable of fitting noise data (Zhang et al., 2017), suggesting that their generalization capabilities are not the mere result of DNNs themselves, but are entwined with optimization (Arpit et al., 2017).
14
+
15
+ This work aims to bridge the gap between SGD and Adam in terms of the generalization performance. To this end, we identify two problems that may degrade the generalization performance of Adam, and show how these problems are (partially) avoided by using SGD with L2 weight decay. First, the updates of SGD lie in the span of historical gradients, whereas it is not the case for Adam. This difference has been discussed in rather recent literature (Wilson et al., 2017), where the authors show that adaptive methods can find drastically different but worse solutions than SGD. Second, while the magnitudes of Adam parameter updates are invariant to rescaling of the gradient, the effect of the updates on the same overall network function still varies with the magnitudes of parameters. As a result, the effective learning rates of weight vectors tend to decrease during training, which leads to sharp local minima that do not generalize well (Hochreiter & Schmidhuber, 1997).
16
+
17
+ To fix the two problems for Adam, we propose the normalized direction-preserving Adam (NDAdam) algorithm, which controls the update direction and step size more precisely. We show that
18
+
19
+ ND-Adam is able to achieve significantly better generalization performance than vanilla Adam, and matches that of SGD in image classification tasks.
20
+
21
+ We summarize our contributions as follows:
22
+
23
+ • We observe that the directions of Adam parameter updates are different from that of SGD, i.e., Adam does not preserve the directions of gradients as SGD does. We fix the problem by adapting the learning rate to each weight vector, instead of each individual weight, such that the direction of the gradient is preserved.
24
+ For both Adam and SGD without L2 weight decay, we observe that the magnitude of each vector’s direction change depends on its L2-norm. We show that, using SGD with L2 weight decay implicitly normalizes the weight vectors, and thus remove the dependence in an approximate manner. We fix the problem for Adam by explicitly normalizing each weight vector, and by optimizing only its direction, such that the effective learning rate can be precisely controlled.
25
+ We further show that, without proper regularization, the learning signal backpropagated from the softmax layer may vary with the overall magnitude of the logits in an undesirable way. Based on the observation, we apply batch normalization or L2-regularization to the logits, which further improves the generalization performance in classification tasks.
26
+
27
+ In essence, our proposed methods, ND-Adam and regularized softmax, improve the generalization performance of Adam by enabling more precise control over the directions of parameter updates, the learning rates, and the learning signals.
28
+
29
+ # 2 BACKGROUND AND MOTIVATION
30
+
31
+ # 2.1 ADAPTIVE MOMENT ESTIMATION (ADAM)
32
+
33
+ Adaptive moment estimation (Adam) (Kingma & Ba, 2014) is a stochastic optimization method that applies individual adaptive learning rates to different parameters, based on the estimates of the first and second moments of the gradients. Specifically, for $n$ trainable parameters, $\boldsymbol \theta \in \mathbb { R } ^ { n }$ , Adam maintains a running average of the first and second moments of the gradient w.r.t. each parameter as
34
+
35
+ $$
36
+ m _ { t } = \beta _ { 1 } m _ { t - 1 } + \left( 1 - \beta _ { 1 } \right) g _ { t } ,
37
+ $$
38
+
39
+ $$
40
+ v _ { t } = \beta _ { 2 } v _ { t - 1 } + \left( 1 - \beta _ { 2 } \right) g _ { t } ^ { 2 } .
41
+ $$
42
+
43
+ Here, $t$ denotes the time step, $m _ { t } \in \mathbb { R } ^ { n }$ and $\boldsymbol { v } _ { t } ~ \in ~ \mathbb { R } ^ { n }$ denote respectively the first and second moments, and $\beta _ { 1 } \in \mathbb { R }$ and $\beta _ { 2 } \in \mathbb { R }$ are the corresponding decay factors. Kingma & Ba (2014) further notice that, since $m _ { 0 }$ and $v _ { 0 }$ are initialized to $0 \mathrm { { s } }$ , they are biased towards zero during the initial time steps, especially when the decay factors are large (i.e., close to 1). Thus, for computing the next update, they need to be corrected as
44
+
45
+ $$
46
+ \hat { m } _ { t } = \frac { m _ { t } } { 1 - \beta _ { 1 } ^ { t } } , \hat { v } _ { t } = \frac { v _ { t } } { 1 - \beta _ { 2 } ^ { t } } ,
47
+ $$
48
+
49
+ where $\beta _ { 1 } ^ { t } , \beta _ { 2 } ^ { t }$ are the $t$ -th powers of $\beta _ { 1 } , \beta _ { 2 }$ respectively. Then, we can update each parameter as
50
+
51
+ $$
52
+ \theta _ { t } = \theta _ { t - 1 } - \frac { \alpha _ { t } } { \sqrt { \hat { v } _ { t } } + \epsilon } \hat { m } _ { t } ,
53
+ $$
54
+
55
+ where $\alpha _ { t }$ is the global learning rate, and $\epsilon$ is a small constant to avoid division by zero. Note the above computations between vectors are element-wise.
56
+
57
+ A distinguishing merit of Adam is that the magnitudes of parameter updates are invariant to rescaling of the gradient, as shown by the adaptive learning rate term, $\frac { \alpha _ { t } } { \sqrt { \hat { v } _ { t } } + \epsilon }$ . However, there are two potential problems when applying Adam to DNNs.
58
+
59
+ First, in some scenarios, DNNs trained with Adam generalize worse than that trained with stochastic gradient descent (SGD) (Wilson et al., 2017). Zhang et al. (2017) demonstrate that overparameterized DNNs are capable of memorizing the entire dataset, no matter if it is natural data or meaningless noise data, and thus suggest much of the generalization power of DNNs comes from the training algorithm, e.g., SGD and its variants. It coincides with another recent work (Wilson et al., 2017), which shows that simple SGD often yields better generalization performance than adaptive gradient methods, such as Adam. As pointed out by the latter, the difference in the generalization performance may result from the different directions of updates. Specifically, for each hidden unit, the SGD update of its input weight vector can only lie in the span of all possible input vectors, which, however, is not the case for Adam due to the individually adapted learning rates. We refer to this problem as the direction missing problem.
60
+
61
+ Second, while batch normalization (Ioffe & Szegedy, 2015) can significantly accelerate the convergence of DNNs, the input weights and the scaling factor of each hidden unit can be scaled in infinitely many (but consistent) ways, without changing the function implemented by the hidden unit. Thus, for different magnitudes of an input weight vector, the updates given by Adam can have different effects on the overall network function, which is undesirable. Furthermore, even when batch normalization is not used, a network using linear rectifiers (e.g., ReLU, leaky ReLU) as activation functions, is still subject to ill-conditioning of the parameterization (Glorot et al., 2011), and hence the same problem. We refer to this problem as the ill-conditioning problem.
62
+
63
+ # 2.2 L2 WEIGHT DECAY
64
+
65
+ L2 weight decay is a regularization technique frequently used with SGD. It often has a significant effect on the generalization performance of DNNs. Despite the simplicity and crucial role of L2 weight decay in the training process, it remains to be explained how it works in DNNs. A common justification for L2 weight decay is that it can be introduced by placing a Gaussian prior upon the weights, when the objective is to find the maximum a posteriori (MAP) weights (Blundell et al., 2015). However, as discussed in Sec. 2.1, the magnitudes of input weight vectors are irrelevant in terms of the overall network function, in some common scenarios, rendering the variance of the Gaussian prior meaningless.
66
+
67
+ We propose to view L2 weight decay in neural networks as a form of weight normalization, which may better explain its effect on the generalization performance. Consider a neural network trained with the following loss function:
68
+
69
+ $$
70
+ \widetilde { L } \left( \boldsymbol { \theta } ; \mathcal { D } \right) = L \left( \boldsymbol { \theta } ; \mathcal { D } \right) + \frac { \lambda } { 2 } \sum _ { i \in \mathcal { N } } \left. w _ { i } \right. _ { 2 } ^ { 2 } ,
71
+ $$
72
+
73
+ where $L \left( \theta ; \mathcal { D } \right)$ is the original loss function specified by the task, $\mathcal { D }$ is a batch of training data, $\mathcal { N }$ is the set of all hidden units, and $w _ { i }$ denotes the input weights of hidden unit $i$ , which is included in the trainable parameters, $\theta$ . For simplicity, we consider SGD updates without momentum. Therefore, the update of $w _ { i }$ at each time step is
74
+
75
+ $$
76
+ \Delta w _ { i } = - \alpha \frac { \partial \widetilde { L } } { \partial w _ { i } } = - \alpha \left( \frac { \partial L } { \partial w _ { i } } + \lambda w _ { i } \right) ,
77
+ $$
78
+
79
+ where $\alpha$ is the learning rate. As we can see from Eq. (5), the gradient magnitude of the L2 penalty is proportional to $\lVert \boldsymbol { w } _ { i } \rVert _ { 2 }$ , thus forms a negative feedback loop that stabilizes $\lVert \boldsymbol { w } _ { i } \rVert _ { 2 }$ to an equilibrium value. Empirically, we find that $\lVert \boldsymbol { w } _ { i } \rVert _ { 2 }$ tends to increase or decrease dramatically at the beginning of the training, and then varies mildly within a small range, which indicates $\lVert \boldsymbol { w } _ { i } \rVert _ { 2 } \approx \lVert \boldsymbol { w } _ { i } + \Delta \boldsymbol { w } _ { i } \rVert _ { 2 }$ . In practice, we usually have $\left\| \Delta w _ { i } \right\| _ { 2 } / \left\| w _ { i } \right\| _ { 2 } \ll 1$ , thus $\Delta w _ { i }$ is approximately orthogonal to $w _ { i }$ , i.e. $w _ { i } \cdot \Delta w _ { i } \approx 0$ .
80
+
81
+ Let $l _ { \parallel w _ { i } }$ and $l \_ w _ { i }$ be the vector projection and rejection of $\frac { \partial L } { \partial w _ { i } }$ on $w _ { i }$ , which are defined as
82
+
83
+ $$
84
+ l _ { \parallel w _ { i } } = \left( \frac { \partial L } { \partial w _ { i } } \cdot \frac { w _ { i } } { \parallel w _ { i } \parallel _ { 2 } } \right) \frac { w _ { i } } { \parallel w _ { i } \parallel _ { 2 } } , l _ { \perp w _ { i } } = \frac { \partial L } { \partial w _ { i } } - l _ { \parallel w _ { i } } .
85
+ $$
86
+
87
+ From Eq. (5) and (6), it is easy to show
88
+
89
+ $$
90
+ \frac { \left. \Delta w _ { i } \right. _ { 2 } } { \left. w _ { i } \right. _ { 2 } } \approx \frac { \left. l _ { \perp w _ { i } } \right. _ { 2 } } { \left. l _ { \parallel w _ { i } } \right. _ { 2 } } \alpha \lambda .
91
+ $$
92
+
93
+ As discussed in Sec. 2.1, when batch normalization is used, or when linear rectifiers are used as activation functions, the magnitude of $\lVert \boldsymbol { w } _ { i } \rVert _ { 2 }$ is irrelevant. Thus, it is the direction of $w _ { i }$ that actually makes a difference in the overall network function. If L2 weight decay is not applied, the magnitude of $w _ { i }$ ’s direction change will decrease as $\lVert \boldsymbol { w } _ { i } \rVert _ { 2 }$ increases during the training process, which can potentially lead to overfitting (discussed in detail in Sec. 3.2). On the other hand, Eq. (7) shows that L2 weight decay implicitly normalizes the weights, such that the magnitude of $w _ { i }$ ’s direction change does not depend on $\lVert \boldsymbol { w } _ { i } \rVert _ { 2 }$ , and can be tuned by the product of $\alpha$ and $\lambda$ . In the following, we refer to $\| \Delta w _ { i } \| _ { 2 } | \| w _ { i } \| _ { 2 }$ as the effective learning rate of $w _ { i }$ .
94
+
95
+ While L2 weight decay produces the normalization effect in an implicit and approximate way, we will show that explicitly doing so enables more precise control of the effective learning rate.
96
+
97
+ # 3 NORMALIZED DIRECTION-PRESERVING ADAM
98
+
99
+ We first present the normalized direction-preserving Adam (ND-Adam) algorithm, which essentially improves the optimization of the input weights of hidden units, while employing the vanilla Adam algorithm to update other parameters. Specifically, we divide the trainable parameters, $\theta$ , into two sets, $\theta ^ { v }$ and $\theta ^ { s }$ , such that $\mathcal { \tilde { \theta } } ^ { v } = \{ w _ { i } | i \in \bar { \mathcal { N } } \}$ , and $\theta ^ { s } = \{ \theta \setminus \theta ^ { v } \}$ . Then we update $\theta ^ { v }$ and $\theta ^ { s }$ by different rules, as described by Alg. 1. The learning rates for the two sets of parameters are denoted respectively by $\alpha _ { t } ^ { v }$ and $\alpha _ { t } ^ { s }$ .
100
+
101
+ # Algorithm 1: Normalized direction-preserving Adam
102
+
103
+ $/ \star$ Initialization \*/
104
+ $t \gets 0$ ;
105
+ for $i \in \mathcal N$ do $w _ { i , 0 } w _ { i , 0 } / \parallel w _ { i , 0 } \parallel _ { 2 } ;$ $m _ { 0 } \left( w _ { i } \right) \gets 0$ ; $v _ { 0 } ( w _ { i } ) 0$ ;
106
+ $/ \star$ Perform $T$ iterations of training \*/
107
+ while $t < T$ do $t \gets t + 1$ ; $/ \star$ Update $\theta ^ { v }$ \*/ for $i \in \mathcal N$ do $\bar { g } _ { t } ( w _ { i } ) \partial L / \partial w _ { i }$ ; $g _ { t } \left( w _ { i } \right) \gets \bar { g } _ { t } \left( w _ { i } \right) - \left( \bar { g } _ { t } \left( w _ { i } \right) \cdot w _ { i , t - 1 } \right) w _ { i , t - 1 } ;$ $m _ { t } \left( w _ { i } \right) \gets \beta _ { 1 } m _ { t - 1 } \left( w _ { i } \right) + \left( 1 - \beta _ { 1 } \right) g _ { t } \left( w _ { i } \right) ;$ $v _ { t } ( w _ { i } ) \beta _ { 2 } v _ { t - 1 } ( w _ { i } ) + ( 1 - \beta _ { 2 } ) \| g _ { t } ( w _ { i } ) \| _ { 2 } ^ { 2 } ;$ $\hat { m } _ { t } \left( w _ { i } \right) \gets m _ { t } \left( w _ { i } \right) / \left( 1 - \beta _ { 1 } ^ { t } \right)$ ; $\hat { v } _ { t } ( w _ { i } ) v _ { t } ( w _ { i } ) / ( 1 - \beta _ { 2 } ^ { t } )$ ; $\bar { w } _ { i , t } w _ { i , t - 1 } - \alpha _ { t } ^ { v } \hat { m } _ { t } ( w _ { i } ) / ( \sqrt { \hat { v } _ { t } ( w _ { i } ) } + \epsilon ) ;$ ; $w _ { i , t } \gets \bar { w } _ { i , t } / \left. \bar { w } _ { i , t } \right. _ { 2 }$ ; /\* Update $\theta ^ { s }$ using Adam \*/ $\theta _ { t } ^ { s } \gets$ AdamUpdate $\left( \theta _ { t - 1 } ^ { s } ; \alpha _ { t } ^ { s } , \beta _ { 1 } , \beta _ { 2 } \right)$ ;
108
+
109
+ return $\theta _ { T }$
110
+
111
+ In Alg. 1, the iteration over $\mathcal { N }$ can be performed in parallel, and thus introduces no extra computational complexity. Compared to Adam, computing $g _ { t } \left( w _ { i } \right)$ and $w _ { i , t }$ may take slightly more time, which, however, is negligible in practice. On the other hand, to estimate the second order moment of each $w _ { i } \in \mathbb { R } ^ { n }$ , Adam maintains $n$ scalars, whereas ND-Adam requires only one scalar, $v _ { t } \left( w _ { i } \right)$ . Thus, ND-Adam has smaller memory overhead than Adam.
112
+
113
+ In the following, we address the direction missing problem and the ill-conditioning problem discussed in Sec. 2.1, and explain Alg. 1 in detail. We show how the proposed algorithm jointly solves the two problems, as well as its relation to other normalization schemes.
114
+
115
+ # 3.1 PRESERVING GRADIENT DIRECTIONS
116
+
117
+ Assuming the stationarity of a hidden unit’s input distribution, the SGD update (possibly with momentum) of the input weight vector is a linear combination of historical gradients, and thus can only lie in the span of the input vectors. As a result, the input weight vector itself will eventually converge to the same subspace.
118
+
119
+ On the contrary, the Adam algorithm adapts the global learning rate to each scalar parameter independently, such that the gradient of each parameter is normalized by a running average of its magnitudes, which changes the direction of the gradient. To preserve the direction of the gradient w.r.t. each input weight vector, we generalize the learning rate adaptation scheme from scalars to vectors.
120
+
121
+ Let $g _ { t } ( w _ { i } ) , m _ { t } ( w _ { i } ) , v _ { t } ( w _ { i } )$ be the counterparts of $g _ { t }$ , $m _ { t }$ , $v _ { t }$ for vector $w _ { i }$ . Since Eq. (1a) is a linear combination of historical gradients, it can be extended to vectors without any change; or equivalently, we can rewrite it for each vector as
122
+
123
+ $$
124
+ m _ { t } \left( w _ { i } \right) = \beta _ { 1 } m _ { t - 1 } \left( w _ { i } \right) + \left( 1 - \beta _ { 1 } \right) g _ { t } \left( w _ { i } \right) .
125
+ $$
126
+
127
+ We then extend Eq. (1b) as
128
+
129
+ $$
130
+ v _ { t } \left( w _ { i } \right) = \beta _ { 2 } v _ { t - 1 } \left( w _ { i } \right) + \left( 1 - \beta _ { 2 } \right) \left. g _ { t } \left( w _ { i } \right) \right. _ { 2 } ^ { 2 } ,
131
+ $$
132
+
133
+ i.e., instead of estimating the average gradient magnitude for each individual parameter, we estimate the average of $\| g _ { t } \left( w _ { i } \right) \| _ { 2 } ^ { 2 }$ for each vector $w _ { i }$ . In addition, we modify Eq. (2) and (3) accordingly as
134
+
135
+ $$
136
+ \hat { m } _ { t } \left( w _ { i } \right) = \frac { m _ { t } \left( w _ { i } \right) } { 1 - \beta _ { 1 } ^ { t } } , \hat { v } _ { t } \left( w _ { i } \right) = \frac { v _ { t } \left( w _ { i } \right) } { 1 - \beta _ { 2 } ^ { t } } ,
137
+ $$
138
+
139
+ and
140
+
141
+ $$
142
+ w _ { i , t } = w _ { i , t - 1 } - \frac { \alpha _ { t } ^ { v } } { \sqrt { { \hat { v } } _ { t } \left( w _ { i } \right) } + \epsilon } { \hat { m } } _ { t } \left( w _ { i } \right) .
143
+ $$
144
+
145
+ Here, $\hat { m } _ { t } \left( \boldsymbol { w } _ { i } \right)$ is a vector with the same dimension as $w _ { i }$ , whereas $\hat { v } _ { t } \left( w _ { i } \right)$ is a scalar. Therefore, when applying Eq. (11), the direction of the update is the negative direction of $\hat { m } _ { t } \left( \boldsymbol { w } _ { i } \right)$ , and thus is in the span of the historical gradients of $w _ { i }$ .
146
+
147
+ It is worth noting that only the input to the first layer (i.e., the training data) is stationary throughout training. Thus, for the weights of an upper layer to converge to the span of its input vectors, it is necessary for the lower layers to converge first. Interestingly, this predicted phenomenon may have been observed in practice (Brock et al., 2017).
148
+
149
+ Despite the empirical success of SGD, a question remains as to why it is desirable to constrain the input weights in the span of the input vectors. A possible explanation is related to the manifold hypothesis, which suggests that real-world data presented in high dimensional spaces (images, audios, text, etc) concentrates on manifolds of much lower dimensionality (Cayton, 2005; Narayanan & Mitter, 2010). In fact, commonly used activation functions, such as (leaky) ReLU, sigmoid, tanh, can only be activated (not saturating or having small gradients) by a portion of the input vectors, in whose span the input weights lie upon convergence. Assuming the local linearity of the manifolds of data or hidden-layer representations, constraining the input weights in the subspace that contains some of the input vectors, encourages the hidden units to form local coordinate systems on the corresponding manifold, which can lead to good representations (Rifai et al., 2011).
150
+
151
+ # 3.2 SPHERICAL WEIGHT OPTIMIZATION
152
+
153
+ The ill-conditioning problem occurs when the magnitude change of an input weight vector can be compensated by other parameters, such as the scaling factor of batch normalization, or the output weight vector, without affecting the overall network function. Consequently, suppose we have two DNNs that parameterize the same function, but with some of the input weight vectors having different magnitudes, applying the same SGD or Adam update rule will, in general, change the network functions in different ways. Thus, the ill-conditioning problem makes the training process inconsistent and difficult to control.
154
+
155
+ More importantly, when the weights are not properly regularized (e.g., without using L2 weight decay), the magnitude of $w _ { i }$ ’s direction change will decrease as $\lVert \boldsymbol { w } _ { i } \rVert _ { 2 }$ increases during the training process. As a result, the effective learning rate for $w _ { i }$ tends to decrease faster than expected, making the network converge to sharp minima. It is well known that sharp minima generalize worse than flat minima (Hochreiter & Schmidhuber, 1997; Keskar et al., 2017).
156
+
157
+ As shown in Sec. 2.2, L2 weight decay can alleviate the ill-conditioning problem by implicitly and approximately normalizing the weights. However, we still do not have a precise control over the effective learning rate, since $\| \bar { l _ { \perp w _ { i } } } \| _ { 2 } / | \bar { \| l _ { \parallel w _ { i } } } | | _ { 2 }$ is unknown and not necessarily stable. Moreover, the approximation fails when $\lVert \boldsymbol { w } _ { i } \rVert _ { 2 }$ is far from the equilibrium due to improper initialization, or drastic changes in the magnitudes of the weight vectors. This problem is also addressed by (Neyshabur et al., 2015), by employing a geometry invariant to rescaling of weights. However, their proposed methods do not preserve the direction of gradient.
158
+
159
+ To address the ill-conditioning problem in a more principled way, we restrict the L2-norm of each $w _ { i }$ to 1, and only optimize its direction. In other words, instead of optimizing $w _ { i }$ in a $n$ -dimensional space, we optimize $w _ { i }$ on a $( n - 1 )$ -dimensional unit sphere. Specifically, we first obtain the raw gradient w.r.t. $w _ { i } , \bar { g } _ { t } \left( w _ { i } \right) = \partial L / \partial w _ { i }$ , and project the gradient onto the unit sphere as
160
+
161
+ $$
162
+ g _ { t } \left( w _ { i } \right) = \bar { g } _ { t } \left( w _ { i } \right) - \left( \bar { g } _ { t } \left( w _ { i } \right) \cdot w _ { i , t - 1 } \right) w _ { i , t - 1 } .
163
+ $$
164
+
165
+ Here, $\| w _ { i , t - 1 } \| _ { 2 } = 1$ . Then we follow Eq. (8)-(10), and replace (11) with
166
+
167
+ and
168
+
169
+ $$
170
+ \begin{array} { c } { \displaystyle \bar { w } _ { i , t } = w _ { i , t - 1 } - \frac { \alpha _ { t } ^ { v } } { \sqrt { \hat { v } _ { t } \left( w _ { i } \right) } + \epsilon } \hat { m } _ { t } \left( w _ { i } \right) , } \\ { \displaystyle w _ { i , t } = \frac { \bar { w } _ { i , t } } { \| \bar { w } _ { i , t } \| _ { 2 } } . } \end{array}
171
+ $$
172
+
173
+ In Eq. (12), we keep only the component that is orthogonal to $w _ { i , t - 1 }$ . However, $\hat { m } _ { t } \left( \boldsymbol { w } _ { i } \right)$ is not necessarily orthogonal as well. In addition, even when $\hat { m } _ { t } \left( \boldsymbol { w } _ { i } \right)$ is orthogonal to $w _ { i , t - 1 }$ , Eq. (13a) can still increase $\lVert \boldsymbol { w } _ { i } \rVert _ { 2 }$ , according to the Pythagorean theorem. Therefore, we explicitly normalize $w _ { i , t }$ in Eq. (13b), to ensure $\| w _ { i , t } \| _ { 2 } = 1$ after each update. Also note that, since $w _ { i , t - 1 }$ is a linear combination of its historical gradients, $g _ { t } \left( w _ { i } \right)$ still lies in the span of the historical gradients after the projection in Eq. (12).
174
+
175
+ Compared to SGD with L2 weight decay, spherical weight optimization explicitly normalizes the weight vectors, such that each update to the weight vectors only changes their directions, and strictly keeps the magnitudes constant. As a result, the effective learning rate of a weight vector is
176
+
177
+ $$
178
+ \frac { \left. \Delta w _ { i , t } \right. _ { 2 } } { \left. w _ { i , t - 1 } \right. _ { 2 } } \approx \frac { \left. \hat { m } _ { t } \left( w _ { i } \right) \right. _ { 2 } } { \sqrt { \hat { v } _ { t } \left( w _ { i } \right) } } \alpha _ { t } ^ { v } ,
179
+ $$
180
+
181
+ which enables precise control over the learning rate of $w _ { i }$ through a single hyperparameter, $\alpha _ { t } ^ { v }$ rather than two as required by Eq. (7). Note that it is possible to control the effective learning rate more precisely, by normalizing $\hat { m } _ { t } \left( \boldsymbol { w } _ { i } \right)$ with $\| \hat { m } _ { t } \left( w _ { i } \right) \| _ { 2 }$ , instead of by $\sqrt { \hat { v } _ { t } \left( w _ { i } \right) }$ . However, by doing so, we lose the information provided by $\| \hat { m } _ { t } \left( \boldsymbol { w } _ { i } \right) \| _ { 2 }$ at different time steps. In addition, since $\hat { m } _ { t } \left( \boldsymbol { w } _ { i } \right)$ is less noisy than $g _ { t } \left( w _ { i } \right)$ , $\Vert \hat { m } _ { t } \left( w _ { i } \right) \Vert _ { 2 } / \sqrt { \hat { v } _ { t } \left( w _ { i } \right) }$ becomes small near convergence, which is considered a desirable property of Adam (Kingma $\&$ Ba, 2014). Thus, we keep the gradient normalization scheme intact.
182
+
183
+ We note the difference between various gradient normalization schemes and the normalization scheme employed by spherical weight optimization. As shown in Eq. 11, ND-Adam generalizes the gradient normalization scheme of Adam, and thus both Adam and ND-Adam normalize the gradient by a running average of its magnitude. This, and other similar schemes (Hazan et al., 2015; Yu et al., 2017) make the optimization less susceptible to vanishing and exploding gradients. On the other hand, the proposed spherical weight optimization serves a different purpose. It normalizes each weight vector and projects the gradient onto a unit sphere, such that the effective learning rate can be controlled more precisely. Moreover, it provides robustness to improper weight initialization, since the magnitude of each weight vector is kept constant.
184
+
185
+ For nonlinear activation functions, such as sigmoid and tanh, an extra scaling factor is needed for each hidden unit to express functions that require unnormalized weight vectors. For instance, given an input vector $x \in \mathbb { R } ^ { n }$ , and a nonlinearity $\phi \left( \cdot \right)$ , the activation of hidden unit $i$ is then given by
186
+
187
+ $$
188
+ y _ { i } = \phi \left( \gamma _ { i } w _ { i } \cdot x + b _ { i } \right) ,
189
+ $$
190
+
191
+ where $\gamma _ { i }$ is the scaling factor, and $b _ { i }$ is the bias.
192
+
193
+ # 3.3 RELATION TO WEIGHT NORMALIZATION AND BATCH NORMALIZATION
194
+
195
+ A related normalization and reparameterization scheme, weight normalization (Salimans & Kingma, 2016), has been developed as an alternative to batch normalization, aiming to accelerate the convergence of SGD optimization. We note the difference between spherical weight optimization and weight normalization. First, the weight vector of each hidden unit is not directly normalized in weight normalization, i.e, $\| w _ { i } \| _ { 2 } \neq 1$ in general. At training time, the activation of hidden unit $i$ is
196
+
197
+ $$
198
+ y _ { i } = \phi \left( \frac { \gamma _ { i } } { \left\| w _ { i } \right\| _ { 2 } } w _ { i } \cdot x + b _ { i } \right) ,
199
+ $$
200
+
201
+ which is equivalent to Eq. (15) for the forward pass. For the backward pass, the effective learning rate still depends on $\lVert \boldsymbol { w } _ { i } \rVert _ { 2 }$ in weight normalization, hence it does not solve the ill-conditioning problem. At inference time, both of these two schemes can combine $w _ { i }$ and $\gamma _ { i }$ into a single equivalent weight vector, $w _ { i } ^ { \prime } = \gamma _ { i } w _ { i }$ , o r $\begin{array} { r } { w _ { i } ^ { \prime } = \frac { \gamma _ { i } } { \Vert w _ { i } \Vert _ { 2 } } w _ { i } } \end{array}$ .
202
+
203
+ While spherical weight optimization naturally encompasses weight normalization, it can further benefit from batch normalization. When combined with batch normalization, Eq. (15) evolves into
204
+
205
+ $$
206
+ y _ { i } = \phi \left( \gamma _ { i } \operatorname { B N } \left( w _ { i } \cdot x \right) + b _ { i } \right) ,
207
+ $$
208
+
209
+ where $\mathrm { B N } \left( { \cdot } \right)$ represents the transformation done by batch normalization without scaling and shifting. Here, $\gamma _ { i }$ serves as the scaling factor for both the normalized weight vector and batch normalization. At training time, the distribution of the input vector, $x$ , changes over time, slowing down the training of the sub-network composed by the upper layers. Salimans & Kingma (2016) observe that, such problem cannot be eliminated by normalizing the weight vectors alone, but can be substantially mitigated by combining weight normalization and mean-only batch normalization.
210
+
211
+ Additionally, in linear rectifier networks, the scaling factors, $\gamma _ { i }$ , can be removed (or set to 1), without changing the overall network function. Since $w _ { i } \cdot x$ is standardized by batch normalization, we have
212
+
213
+ $$
214
+ \mathbb { E } _ { x } \left[ \mathrm { B N } \left( \boldsymbol { w } _ { i } \cdot \boldsymbol { x } \right) ^ { 2 } \right] \approx 1 ,
215
+ $$
216
+
217
+ and hence
218
+
219
+ $$
220
+ \operatorname { V a r } _ { \boldsymbol { x } } \left[ \operatorname { B N } \left( \boldsymbol { w } _ { i } \cdot \boldsymbol { x } \right) + b _ { i } \right] \approx 1 .
221
+ $$
222
+
223
+ Therefore, $y _ { i }$ ’s that belong to the same layer, or different dimensions of $x$ that fed to the upper layer, will also have comparable variances, which potentially makes the weight updates of the upper layer more stable. For these reasons, we combine the use of spherical weight optimization and batch normalization, as shown in Eq. (17).
224
+
225
+ # 4 REGULARIZED SOFTMAX
226
+
227
+ For multi-class classification tasks, the softmax function is the de facto activation function for the output layer. Despite its simplicity and intuitive probabilistic interpretation, we observe a related problem to the ill-conditioning problem we have addressed. Similar to how different magnitudes of weight vectors result in different updates to the same network function, the learning signal backpropagated from the softmax layer varies with the overall magnitude of the logits.
228
+
229
+ Specifically, when using cross entropy as the surrogate loss with one-hot target vectors, the prediction is considered correct as long as arg $\mathrm { m a x } _ { c \in \mathcal { C } } \left( z _ { c } \right)$ is the target class, where $z _ { c }$ is the logit before the softmax activation, corresponding to category $c \in { \mathcal { C } }$ . Thus, the logits can be positively scaled together without changing the predictions, whereas the cross entropy and its derivatives will vary with the scaling factor. Concretely, denoting the scaling factor by $\eta$ , the gradient w.r.t. each logit is
230
+
231
+ $$
232
+ \frac { \partial L } { \partial z _ { \hat { c } } } = \eta \left[ \frac { \exp \left( \eta z _ { \hat { c } } \right) } { \sum _ { c \in \mathcal { C } } \exp \left( \eta z _ { c } \right) } - 1 \right] ,
233
+ $$
234
+
235
+ and
236
+
237
+ $$
238
+ \frac { \partial L } { \partial z _ { \bar { c } } } = \frac { \eta \exp \left( \eta z _ { \bar { c } } \right) } { \sum _ { c \in \mathcal { C } } \exp \left( \eta z _ { c } \right) } .
239
+ $$
240
+
241
+ where $\hat { c }$ is the target class, and ${ \bar { c } } \in { \mathcal { C } } \backslash \{ { \hat { c } } \}$ .
242
+
243
+ For Adam and ND-Adam, since the gradient w.r.t. each scalar or vector are normalized, the absolute magnitudes of Eq. (20a) and (20b) are irrelevant. Instead, the relative magnitudes make a difference here. When $\eta$ is small, we have
244
+
245
+ $$
246
+ \operatorname* { l i m } _ { \eta \to 0 } \left| \frac { \partial L / \partial z _ { \bar { c } } } { \partial L / \partial z _ { \hat { c } } } \right| = \frac { 1 } { | \mathcal { C } | - 1 } ,
247
+ $$
248
+
249
+ which indicates that, when the magnitude of the logits is small, softmax encourages the logit of the target class to increase, while equally penalizing that of the other classes. On the other end of the spectrum, assuming no two digits are the same, we have
250
+
251
+ $$
252
+ \operatorname* { l i m } _ { \eta \infty } | \frac { \partial L / \partial z _ { \bar { c } ^ { \prime } } } { \partial L / \partial z _ { \hat { c } } } | = 1 , \operatorname* { l i m } _ { \eta \infty } | \frac { \partial L / \partial z _ { \bar { c } ^ { \prime \prime } } } { \partial L / \partial z _ { \hat { c } } } | = 0 ,
253
+ $$
254
+
255
+ where $\bar { c } ^ { \prime } = \arg \operatorname* { m a x } _ { c \in \mathcal { C } \backslash \{ \hat { c } \} } \left( z _ { c } \right)$ , and $\bar { c } ^ { \prime \prime } \in \mathcal { C } \backslash \{ \hat { c } , \bar { c } ^ { \prime } \}$ . Eq. (22) indicates that, when the magnitude of the logits is large, softmax penalizes only the largest logit of the non-target classes. The latter case is related to the saturation problem of softmax discussed in Oland et al. (2017). However, they focus on the problem of small absolute gradient magnitude, which does not affect Adam and ND-Adam.
256
+
257
+ It is worth noting that both of these two cases can happen without the scaling factor. For instance, varying the norm of the weights of the softmax layer is equivalent to varying the value of $\eta$ , in terms of the relative magnitude of the gradient. In the case of small $\eta$ , the logits of all non-target classes are penalized equally, regardless of the difference in $\hat { z } - \bar { z }$ for different $\bar { z } \in \mathcal { C } \backslash \{ \hat { z } \}$ . However, it is more reasonable to penalize more the logits that are closer to $\hat { z }$ , which are more likely to cause misclassification. In the case of large $\eta$ , although the logit that is most likely to cause misclassification is strongly penalized, the logits of other non-target classes are ignored. As a result, the logits of the non-target classes tend to be similar at convergence, ignoring the fact that some classes are closer to each other than the others.
258
+
259
+ We propose two methods to exploit the prior knowledge that the magnitude of the logits should not be too small or too large. First, we can apply batch normalization to the logits. But instead of setting $\gamma _ { c }$ ’s as trainable variables, we consider them as a single hyperparameter, $\gamma _ { \mathcal { C } }$ , such that $\gamma _ { c } = \gamma _ { c } , \forall c \in \mathcal { C }$ . Tuning the value of $\gamma _ { \mathcal { C } }$ can lead to a better trade-off between the two extremes described by Eq. (21) and (22). The optimal value of $\gamma _ { \mathcal { C } }$ tends to remain the same for different optimizers or different network widths, but varies with dataset and network depth. We refer to this method as batch-normalized softmax (BN-Softmax).
260
+
261
+ Alternatively, since the magnitude of the logits tends to grow larger than expected (in order to minimize the cross entropy), we can apply L2-regularization to the logits by adding the following penalty to the loss function:
262
+
263
+ $$
264
+ L _ { \mathcal { C } } = \frac { \lambda _ { \mathcal { C } } } { 2 } \sum _ { c \in \mathcal { C } } z _ { c } ^ { 2 } ,
265
+ $$
266
+
267
+ where $\lambda _ { \mathcal { C } }$ is a hyperparameter to be tuned. Different from BN-Softmax, $\lambda _ { C }$ can be shared by different datasets and networks of different depths.
268
+
269
+ # 5 EXPERIMENTS
270
+
271
+ In this section, we provide empirical evidence for the analysis in Sec. 2.2, and evaluate the performance of ND-Adam and regularized softmax on CIFAR-10 and CIFAR-100.
272
+
273
+ # 5.1 THE EFFECT OF L2 WEIGHT DECAY
274
+
275
+ To empirically examine the effect of L2 weight decay, we train a wide residual network (WRN) (Zagoruyko & Komodakis, 2016b) of 22 layers, with a width of 7.5 times that of a vanilla ResNet. Using the notation in Zagoruyko & Komodakis (2016b), we refer to this network as WRN-22-7.5. We train the network on the CIFAR-10 dataset (Krizhevsky & Hinton, 2009), with a small modification to the original WRN architecture, and with a different learning rate annealing schedule. Specifically, for simplicity and slightly better performance, we replace the last fully connected layer with a convolutional layer with 10 output feature maps. I.e., we change the layers after the last residual block from BN-ReLU-GlobalAvgPool-FC-Softmax to
276
+
277
+ BN-ReLU-Conv-GlobalAvgPool-Softmax. In addition, for clearer comparisons, the learning rate is annealed according to a cosine function without restart (Loshchilov & Hutter, 2016; Gastaldi, 2017). We train the model for 80k iterations with a batch size of 128, similar to the settings in Zagoruyko & Komodakis (2016b). The experiments are based on a TensorFlow implementation of WRN (Wu, 2016).
278
+
279
+ As a common practice, we use SGD with a momentum of 0.9, the analysis for which is similar to that in Sec. 2.2. Due to the linearity of derivatives and momentum, $\Delta w _ { i }$ can be decomposed as $\Delta w _ { i } = \Delta w _ { i } ^ { l } + \Delta w _ { i } ^ { p }$ , where $\Delta w _ { i } ^ { l }$ and $\Delta w _ { i } ^ { p }$ are the components corresponding to the original loss function, $L \left( \cdot \right)$ , and the L2 penalty term (see Eq. (4)), respectively. Fig. 1a shows the ratio between the scalar projection of $\Delta \bar { w } _ { i } ^ { l }$ on $\bar { \Delta } w _ { i } ^ { p }$ and $\left. \Delta w _ { i } ^ { p } \right. _ { 2 }$ , which indicates how the tendency of $\Delta w _ { i } ^ { l }$ to increase $\lVert \boldsymbol { w } _ { i } \rVert _ { 2 }$ is compensated by $\Delta w _ { i } ^ { p }$ . Note that $\Delta w _ { i } ^ { p }$ points to the negative direction of $w _ { i }$ , even when momentum is used, since the direction change of $w _ { i }$ is slow. As shown in Fig. 1a, at the beginning of the training, $\Delta w _ { i } ^ { p }$ dominants and quickly adjusts $\lVert \boldsymbol { w } _ { i } \rVert _ { 2 }$ to its equilibrium value. During the middle stage of the training, the projection of $\Delta w _ { i } ^ { l }$ on $\Delta w _ { i } ^ { p }$ , and $\Delta w _ { i } ^ { p }$ almost cancel each other out. Then, near the end of the training, the gradient of $w _ { i }$ diminishes rapidly to near zero, making $\Delta w _ { i } ^ { p }$ dominant again. Therefore, Eq. (7) holds more accurately during the middle stage of the training.
280
+
281
+ In Fig. 1b, we show how the effective learning rate varies in different hyperparameter settings. By Eq. (7), $\left\| \Delta w _ { i } \right\| _ { 2 } / \left\| w _ { i } \right\| _ { 2 }$ is expected to remain the same as long as $\alpha \lambda$ stays constant, which is confirmed by the fact that the curve for $\alpha _ { 0 } = 0 . 1 , \lambda = 0 . 0 0 1$ overlaps with that for $\alpha _ { 0 } = 0 . 0 5 , \lambda =$ 0.002. However, comparing the curve for $\alpha _ { 0 } = 0 . 1 , \lambda = 0 . 0 0 1$ , with that for $\alpha _ { 0 } = 0 . 1 , \lambda =$ 0.0005, we can see that the value of $\| \Delta w _ { i } \| _ { 2 } / \| w _ { i } \| _ { 2 }$ does not change proportionally to $\alpha \lambda$ . On the other hand, by using ND-Adam, we can control the value of $\lVert \Delta w _ { i } \rVert _ { 2 } \dot { / } \lVert \dot { w } _ { i } \rVert _ { 2 }$ more precisely by adjusting the learning rate for weight vectors, $\alpha ^ { v }$ . For the same training step, changes in $\alpha ^ { v }$ lead to approximately proportional changes in $\| \Delta w _ { i } \| _ { 2 } / \| w _ { i } \| _ { 2 }$ , as shown by the two curves corresponding to ND-Adam in Fig. 1b.
282
+
283
+ ![](images/dcf5f1c901e84b092b98192aad1de61f46fb687abe7413362a2285ff99d328ee.jpg)
284
+ (a) The scalar projection of $\Delta w _ { i } ^ { l }$ on $\Delta w _ { i } ^ { p }$ normalized by(b) The relative magnitude of the weight updates, or the $\left. \Delta w _ { i } ^ { p } \right. _ { 2 }$ . effective learning rate.
285
+ Figure 1: An illustration of how L2 weight decay and ND-Adam control the effective learning rate. The results are obtained from the 5th layer of the network, and other layers show similar results.
286
+
287
+ # 5.2 PERFORMANCE EVALUATION
288
+
289
+ To compare the generalization performance of SGD, Adam, and ND-Adam, we train the same WRN22-7.5 network on the CIFAR-10 and CIFAR-100 datasets. For SGD and ND-Adam, we first tune the hyperparameters for SGD $( \alpha _ { 0 } = 0 . 1 , \lambda = 0 . 0 0 1$ , momentum 0.9), then tune the initial learning rate of ND-Adam for weight vectors to match the effective learning rate to that of SGD $\alpha _ { 0 } ^ { v } = 0 . 0 5 )$ , as shown in Fig. 1b. While L2 weight decay can greatly affect the performance of SGD, it does not noticeably benefit Adam in our experiments. For Adam and ND-Adam, $\beta _ { 1 }$ and $\beta _ { 2 }$ are set to the default values of Adam, i.e., $\beta _ { 1 } = 0 . 9$ , $\beta _ { 2 } = 0 . 9 9 9$ . Although the learning rate of Adam is usually set to a constant value, we observe better performance with the cosine learning rate schedule. The initial learning rate of Adam $( \alpha _ { 0 } )$ , and that of ND-Adam for scalar parameters $( \alpha _ { 0 } ^ { s } )$ are both tuned to 0.001. We use the same data augmentation scheme as used in Zagoruyko & Komodakis (2016b), including horizontal flips and random crops, but no dropout is used.
290
+
291
+ We first experiment with the use of trainable scaling parameters $( \gamma _ { i } )$ of batch normalization. As shown in Fig. 2b, at convergence, the test accuracies of ND-Adam are significantly improved upon that of vanilla Adam, and matches that of SGD. Note that at the early stage of training, the training losses of Adam drop dramatically as shown in Fig. 2a, and the test accuracies also increase more rapidly than that of ND-Adam and SGD. However, the test accuracies remain at a high level afterwards, which indicates that Adam tends to quickly find and get stuck in bad local minima that do not generalize well.
292
+
293
+ The average results of 3 runs are summarized in the first part of Table 1. Interestingly, compared to SGD, ND-Adam shows slightly better performance on CIFAR-10, but worse performance on CIFAR-100. This inconsistency may be related to the problem of softmax discussed in Sec. 4, that there is a lack of proper control over the magnitude of the logits. But overall, given comparable effective learning rates, ND-Adam and SGD show similar generalization performance. In this sense, the effective learning rate is a more natural learning rate measure than the learning rate hyperparameters.
294
+
295
+ ![](images/2258af99304275cba3dda8e135ac5499ddd95a8b02f54c25a7f467886f8ef9b4.jpg)
296
+ Figure 2: The training losses and test accuracies of the same network trained with SGD, Adam, and ND-Adam. Batch normalization with scaling factors is used.
297
+
298
+ Next, we repeat the experiments with the use of BN-Softmax. As discussed in Sec. 3.2, $\gamma _ { i }$ ’s can be removed from a linear rectifier network, without changing the overall network function. Although this property does not strictly hold for residual networks due to the skip connections, we find that simply removing the scaling factors results in slightly improved generalization performance when using ND-Adam. However, the improvement is not consistent as it degrades performance of SGD. Interestingly, when BN-Softmax is further used, we observe consistent improvement over all three algorithms. Thus, we only report results for this setting. The scaling factor of the logits, $\gamma _ { \mathcal { C } }$ , is set to 2.5 for CIFAR-10, and 1 for CIFAR-100. As shown in the second part of Table 1, BN-Softmax significantly improves the performance of Adam and ND-Adam. Moreover, in this setting, we obtain the best generalization performance with ND-Adam, outperforming SGD and Adam on both CIFAR-10 and CIFAR-100.
299
+
300
+ While the TensorFlow implementation we use already provides an adequate test bed, we notice that it is different from the original implementation of WRN in several aspects. For instance, they use different nonlinearities (leaky ReLU vs. ReLU), and use different skip connections for downsampling (average pooling vs. strided convolution). A seemingly subtle but important difference is that, L2-regularization is applied not only to weight vectors, but also to the scales and biases of batch normalization in the original implementation, which leads to better generalization performance. For further comparison between SGD and ND-Adam, we reimplement ND-Adam and test its performance on a PyTorch version of the original implementation (Zagoruyko & Komodakis, 2016a).
301
+
302
+ Due to the aforementioned differences, we use a slightly different hyperparameter setting in this experiment. Specifically, for SGD $\lambda$ is set to 5e 4, while for ND-Adam $\lambda$ is set to 5e 6 (L2- regularization for biases), and both $\alpha _ { 0 } ^ { s }$ and $\alpha _ { 0 } ^ { v }$ are set to 0.04. In this case, regularizing softmax does not yield improved performance for SGD, since the L2-regularization applied to $\gamma _ { i }$ ’s and the last layer weights can serve a similar purpose. Thus, we only apply L2-regularized softmax for ND-Adam with $\lambda _ { C } = 0 . 0 0 1$ . The average results of 3 runs are summarized in Table 2. Note that the performance of SGD for WRN-28-10 is slightly better than that reported with the original implementation (i.e., 4.00 and 19.25), due to the modifications described in Sec. 5.1. In this experiment, SGD and ND-Adam show almost identical generalization performance.
303
+
304
+ ![](images/6b18d8319a01a5b33527c5568d4d8a9daa311ed6b273f8af12a0ff24dd7216e8.jpg)
305
+ Figure 3: The training losses and test accuracies of the same network trained with SGD, Adam, and ND-Adam. Batch normalization without scaling factors, and BN-Softmax are used.
306
+ Table 2: Test error rates of WRN-22-7.5 and WRN-28-10 networks on CIFAR-10 and CIFAR-100. Based on the original implementation of WRN.
307
+
308
+ Table 1: Test error rates of WRN-22-7.5 networks on CIFAR-10 and CIFAR-100. Based on a TensorFlow implementation of WRN.
309
+
310
+ <table><tr><td>CIFAR-10 Method Error (%)</td><td>CIFAR-100 Error (%)</td></tr><tr><td>BN w/ scaling factors</td></tr><tr><td>SGD 4.61 20.60</td></tr><tr><td>Adam 6.14 25.51</td></tr><tr><td>ND-Adam 4.53 21.45</td></tr><tr><td colspan="2">BN w/o scaling factors,BN-Softmax</td></tr><tr><td>SGD 4.49</td><td>20.18</td></tr><tr><td>Adam 5.43</td><td>22.48</td></tr><tr><td>ND-Adam 4.14</td><td>19.90</td></tr></table>
311
+
312
+ <table><tr><td>Method</td><td>CIFAR-10 Error (%)</td><td>CIFAR-100 Error (%)</td></tr><tr><td></td><td>WRN-22-7.5</td><td></td></tr><tr><td>SGD</td><td>3.84</td><td>19.24</td></tr><tr><td>ND-Adam</td><td>3.70</td><td>19.30</td></tr><tr><td>WRN-28-10</td><td></td><td></td></tr><tr><td>SGD</td><td>3.80</td><td>18.48</td></tr><tr><td>ND-Adam</td><td>3.70</td><td>18.42</td></tr></table>
313
+
314
+ # 6 CONCLUSION
315
+
316
+ In this paper, we have introduced ND-Adam, a tailored version of Adam for training DNNs, to bridge the generalization gap between Adam and SGD. ND-Adam is designed to preserve the direction of gradient for each weight vector, and produce the regularization effect of L2 weight decay in a more precise and principled way. Moreover, we have introduced regularized softmax, which limits the magnitude of softmax logits to provide better learning signals. By combining ND-Adam and regularized softmax, our experiments have shown significantly improved generalization performance, eliminating the gap between Adam and SGD. From a high-level view, our analysis and empirical results suggest the need for more precise control over the training process of DNNs.
317
+
318
+ # REFERENCES
319
+
320
+ Devansh Arpit, Stanisław Jastrz˛ebski, Nicolas Ballas, David Krueger, Emmanuel Bengio, Maxinder S Kanwal, Tegan Maharaj, Asja Fischer, Aaron Courville, Yoshua Bengio, et al. A closer look at memorization in deep networks. arXiv preprint arXiv:1706.05394, 2017.
321
+
322
+ Charles Blundell, Julien Cornebise, Koray Kavukcuoglu, and Daan Wierstra. Weight uncertainty in neural networks. In ICML 2015, 2015.
323
+
324
+ Andrew Brock, Theodore Lim, JM Ritchie, and Nick Weston. Freezeout: Accelerate training by progressively freezing layers. arXiv preprint arXiv:1706.04983, 2017.
325
+
326
+ Lawrence Cayton. Algorithms for manifold learning. Univ. of California at San Diego Tech. Rep, pp. 1–17, 2005.
327
+
328
+ John Duchi, Elad Hazan, and Yoram Singer. Adaptive subgradient methods for online learning and stochastic optimization. Journal of Machine Learning Research, 12(Jul):2121–2159, 2011.
329
+
330
+ Xavier Gastaldi. Shake-shake regularization of 3-branch residual networks. In ICLR 2017 Workshop, 2017.
331
+
332
+ Xavier Glorot, Antoine Bordes, and Yoshua Bengio. Deep sparse rectifier neural networks. In Proceedings of the Fourteenth International Conference on Artificial Intelligence and Statistics, pp. 315–323, 2011.
333
+
334
+ Elad Hazan, Kfir Levy, and Shai Shalev-Shwartz. Beyond convexity: Stochastic quasi-convex optimization. In Advances in Neural Information Processing Systems, pp. 1594–1602, 2015.
335
+
336
+ 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.
337
+
338
+ Sepp Hochreiter and Jürgen Schmidhuber. Flat minima. Neural Computation, 9(1):1–42, 1997.
339
+
340
+ Jie Hu, Li Shen, and Gang Sun. Squeeze-and-excitation networks. arXiv preprint arXiv:1709.01507, 2017.
341
+
342
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In International Conference on Machine Learning, pp. 448–456, 2015.
343
+
344
+ 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. ICLR 2017, 2017.
345
+
346
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
347
+
348
+ Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. 2009.
349
+
350
+ Ilya Loshchilov and Frank Hutter. Sgdr: stochastic gradient descent with restarts. arXiv preprint arXiv:1608.03983, 2016.
351
+
352
+ Hariharan Narayanan and Sanjoy Mitter. Sample complexity of testing the manifold hypothesis. In Advances in Neural Information Processing Systems, pp. 1786–1794, 2010.
353
+
354
+ Behnam Neyshabur, Ruslan R Salakhutdinov, and Nati Srebro. Path-sgd: Path-normalized optimization in deep neural networks. In Advances in Neural Information Processing Systems, pp. 2422–2430, 2015.
355
+
356
+ Anders Oland, Aayush Bansal, Roger B Dannenberg, and Bhiksha Raj. Be careful what you backpropagate: A case for linear output activations & gradient boosting. arXiv preprint arXiv:1707.04199, 2017.
357
+
358
+ Salah Rifai, Yann N Dauphin, Pascal Vincent, Yoshua Bengio, and Xavier Muller. The manifold tangent classifier. In Advances in Neural Information Processing Systems, pp. 2294–2302, 2011.
359
+
360
+ Tim Salimans and Diederik P Kingma. Weight normalization: A simple reparameterization to accelerate training of deep neural networks. In Advances in Neural Information Processing Systems, pp. 901–909, 2016.
361
+
362
+ Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1–9, 2015.
363
+
364
+ Tijmen Tieleman and Geoffrey Hinton. Lecture 6.5—RmsProp: Divide the gradient by a running average of its recent magnitude. COURSERA: Neural Networks for Machine Learning, 2012.
365
+
366
+ Ashia C Wilson, Rebecca Roelofs, Mitchell Stern, Nathan Srebro, and Benjamin Recht. The marginal value of adaptive gradient methods in machine learning. In Advances in Neural Information Processing Systems, 2017.
367
+
368
+ Neal Wu. A tensorflow implementation of wide residual networks, 2016. URL https:// github.com/tensorflow/models/tree/master/research/resnet.
369
+
370
+ Adams Wei Yu, Qihang Lin, Ruslan Salakhutdinov, and Jaime Carbonell. Normalized gradient with adaptive stepsize method for deep neural network training. arXiv preprint arXiv:1707.04822, 2017.
371
+
372
+ Sergey Zagoruyko and Nikos Komodakis. A pytorch implementation of wide residual networks, 2016a. URL https://github.com/szagoruyko/wide-residual-networks.
373
+
374
+ Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. arXiv preprint arXiv:1605.07146, 2016b.
375
+
376
+ Matthew D Zeiler. Adadelta: an adaptive learning rate method. arXiv preprint arXiv:1212.5701, 2012.
377
+
378
+ Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. In ICLR 2017, 2017.
md/train/HJTzHtqee/HJTzHtqee.md ADDED
@@ -0,0 +1,281 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # A COMPARE-AGGREGATE MODEL FOR MATCHING TEXT SEQUENCES
2
+
3
+ Shuohang Wang School of Information Systems Singapore Management University shwang.2014@phdis.smu.edu.sg
4
+
5
+ Jing Jiang School of Information Systems Singapore Management University jingjiang@smu.edu.sg
6
+
7
+ # ABSTRACT
8
+
9
+ Many NLP tasks including machine comprehension, answer selection and text entailment require the comparison between sequences. Matching the important units between sequences is a key to solve these problems. In this paper, we present a general “compare-aggregate” framework that performs word-level matching followed by aggregation using Convolutional Neural Networks. We particularly focus on the different comparison functions we can use to match two vectors. We use four different datasets to evaluate the model. We find that some simple comparison functions based on element-wise operations can work better than standard neural network and neural tensor network.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Many natural language processing problems involve matching two or more sequences to make a decision. For example, in textual entailment, one needs to determine whether a hypothesis sentence can be inferred from a premise sentence (Bowman et al., 2015). In machine comprehension, given a passage, a question needs to be matched against it in order to find the correct answer (Richardson et al., 2013; Tapaswi et al., 2016). Table 1 gives two example sequence matching problems. In the first example, a passage, a question and four candidate answers are given. We can see that to get the correct answer, we need to match the question against the passage and identify the last sentence to be the answer-bearing sentence. In the second example, given a question and a set of candidate answers, we need to find the answer that best matches the question. Because of the fundamental importance of comparing two sequences of text to judge their semantic similarity or relatedness, sequence matching has been well studied in natural language processing.
14
+
15
+ With recent advances of neural network models in natural language processing, a standard practice for sequence modeling now is to encode a sequence of text as an embedding vector using models such as RNN and CNN. To match two sequences, a straightforward approach is to encode each sequence as a vector and then to combine the two vectors to make a decision (Bowman et al., 2015; Feng et al., 2015). However, it has been found that using a single vector to encode an entire sequence is not sufficient to capture all the important information from the sequence, and therefore advanced techniques such as attention mechanisms and memory networks have been applied to sequence matching problems (Hermann et al., 2015; Hill et al., 2016; Rocktaschel et al., 2015). ¨
16
+
17
+ A common trait of a number of these recent studies on sequence matching problems is the use of a “compare-aggregate” framework (Wang & Jiang, 2016b; He & Lin, 2016; Parikh et al., 2016). In such a framework, comparison of two sequences is not done by comparing two vectors each representing an entire sequence. Instead, these models first compare vector representations of smaller units such as words from these sequences and then aggregate these comparison results to make the final decision. For example, the match-LSTM model proposed by Wang & Jiang (2016b) for textual entailment first compares each word in the hypothesis with an attention-weighted version of the premise. The comparison results are then aggregated through an LSTM. He & Lin (2016) proposed a pairwise word interaction model that first takes each pair of words from two sequences and applies a comparison unit on the two words. It then combines the results of these word interactions using a similarity focus layer followed by a multi-layer CNN. Parikh et al. (2016) proposed a decomposable attention model for textual entailment, in which words from each sequence are compared with an attention-weighted version of the other sequence to produce a series of comparison vectors. The comparison vectors are then aggregated and fed into a feed forward network for final classification.
18
+
19
+ Table 1: The example on the left is a machine comprehension problem from MovieQA, where the correct answer here is The Shire. The example on the right is an answer selection problem from InsuranceQA.
20
+
21
+ <table><tr><td>Plot:... Aragorn is crowned King of Gon- dor and taking Arwen as his queen before all present at his coronation bowing before Frodo and the other Hobbits.The Hobbits return to the Shire where Sam marries Rosie Cotton ....</td></tr><tr><td>Qustion: Where does Sam marry Rosie?</td></tr><tr><td>Candidate answers: O) Grey Havens.1) Gon- dor.2) The Shire.3) Erebor.4) Mordor.</td></tr></table>
22
+
23
+ <table><tr><td>Question: can i have auto insurance without a car</td></tr><tr><td>Ground-truth answer: yes,it be possible have auto insurance without own a vehicle.you will purchase what be call a name ..</td></tr><tr><td>Another candidate answer: insurance not be a tax or merely a legal obligation because auto insurance follow a car...</td></tr></table>
24
+
25
+ Although these studies have shown the effectiveness of such a “compare-aggregate” framework for sequence matching, there are at least two limitations with these previous studies: (1) Each of the models proposed in these studies is tested on one or two tasks only, but we hypothesize that this general framework is effective on many sequence matching problems. There has not been any study that empirically verifies this. (2) More importantly, these studies did not pay much attention to the comparison function that is used to compare two small textual units. Usually a standard feedforward network is used (Hu et al., 2014; Wang & Jiang, 2016b) to combine two vectors representing two units that need to be compared, e.g., two words. However, based on the nature of these sequence matching problems, we essentially need to measure how semantically similar the two sequences are. Presumably, this property of these sequence matching problems should guide us in choosing more appropriate comparison functions. Indeed He & Lin (2016) used cosine similarity, Euclidean distance and dot product to define the comparison function, which seem to be better justifiable. But they did not systematically evaluate these similarity or distance functions or compare them with a standard feedforward network.
26
+
27
+ In this paper, we argue that the general “compare-aggregate” framework is effective for a wide range of sequence matching problems. We present a model that follows this general framework and test it on four different datasets, namely, MovieQA, InsuranceQA, WikiQA and SNLI. The first three datasets are for Question Answering, but the setups of the tasks are quite different. The last dataset is for textual entailment. More importantly, we systematically present and test six different comparison functions. We find that overall a comparison function based on element-wise subtraction and multiplication works the best on the four datasets.
28
+
29
+ The contributions of this work are twofold: (1) Using four different datasets, we show that our model following the “compare-aggregate” framework is very effective when compared with the state-ofthe-art performance on these datasets. (2) We conduct systematic evaluation of different comparison functions and show that a comparison function based on element-wise operations, which is not widely used for word-level matching, works the best across the different datasets. We believe that these findings will be useful for future research on sequence matching problems. We have also made our code available online.1
30
+
31
+ # 2 METHOD
32
+
33
+ In this section, we propose a general model following the “compare-aggregate” framework for matching two sequences. This general model can be applied to different tasks. We focus our discussion on six different comparison functions that can be plugged into this general “compare-aggregate” model. In particular, we hypothesize that two comparison functions based on element-wise operations, SUB and MULT, are good middle ground between highly flexible functions using standard neural network models and highly restrictive functions based on cosine similarity and/or Euclidean distance. As we will show in the experiment section, these comparison functions based on elementwise operations can indeed perform very well on a number of sequence matching problems.
34
+
35
+ ![](images/bd9a255fdaa82548a427cb5a4a44ace17f1c92aeebb388009fa7221b6faef7c6.jpg)
36
+ Figure 1: The left hand side is an overview of the model. The right hand side shows the details about the different comparison functions. The rectangles in dark represent parameters to be learned. $\times$ represents matrix multiplication.
37
+
38
+ # 2.1 PROBLEM DEFINITION AND MODEL OVERVIEW
39
+
40
+ The general setup of the sequence matching problem we consider is the following. We assume there are two sequences to be matched. We use two matrices $\mathbf { Q } \in \mathbb { R } ^ { d \times Q }$ and $\mathbf { A } \in \mathbf { \mathbb { R } } ^ { d \times A }$ to represent the word embeddings of the two sequences, where $Q$ and $A$ are the lengths of the two sequences, respectively, and $d$ is the dimensionality of the word embeddings. In other words, each column vector of $\mathbf { Q }$ or $\mathbf { A }$ is an embedding vector representing a single word. Given a pair of $\mathbf { Q }$ and $\mathbf { A }$ , the goal is to predict a label $y$ . For example, in textual entailment, $\mathbf { Q }$ may represent a premise and $\mathbf { A }$ a hypothesis, and $y$ indicates whether $\mathbf { Q }$ entails $\mathbf { A }$ or contradicts A. In question answering, $\mathbf { Q }$ may be a question and A a candidate answer, and $y$ indicates whether A is the correct answer to $\mathbf { Q }$ .
41
+
42
+ We treat the problem as a supervised learning task. We assume that a set of training examples in the form of $( \mathbf { Q } , \mathbf { A } , y )$ is given and we aim to learn a model that maps any pair of $( \mathbf { Q } , \mathbf { A } )$ to a $y$ .
43
+
44
+ An overview of our model is shown in Figure 1. The model can be divided into the following four layers:
45
+
46
+ 1. Preprocessing: We use a preprocessing layer (not shown in the figure) to process $\mathbf { Q }$ and A to obtain two new matrices $\mathbf { \bar { Q } } \in \mathbb { R } ^ { l \times \mathbf { \bar { Q } } }$ and $\overline { { \mathbf { A } } } \in \mathbb { R } ^ { l \times A }$ . The purpose here is to use some gate values to control the importance of different words in making the predictions on the sequence pair. For example, $\overline { { \mathbf { q } } } _ { i } \in \mathbb { R } ^ { l }$ , which is the $i ^ { \mathrm { { t h } } }$ column vector of $\overline { { \mathbf { Q } } }$ , encodes the $i ^ { \mathrm { { t h } } }$ word in $\mathbf { Q }$ .
47
+
48
+ 2. Attention: We apply a standard attention mechanism on $\overline { { \mathbf { Q } } }$ and $\overline { { \mathbf A } }$ to obtain attention weights over the column vectors in $\overline { { \mathbf { Q } } }$ for each column vector in $\overline { { \bf A } }$ . With these attention weights, for each column vector $\overline { { \mathbf { a } } } _ { j }$ in $\overline { { \mathbf A } }$ , we obtain a corresponding vector $\mathbf { h } _ { j }$ , which is an attention-weighted sum of the column vectors of $\overline { { \mathbf { Q } } }$ .
49
+
50
+ 3. Comparison: We use a comparison function $f$ to combine each pair of $\overline { { \mathbf { a } } } _ { j }$ and $\mathbf { h } _ { j }$ into a vector $\mathbf { t } _ { j }$ .
51
+
52
+ 4. Aggregation: We use a CNN layer to aggregate the sequence of vectors $\mathbf { t } _ { j }$ for the final classification.
53
+
54
+ Although this model follows more or less the same framework as the model proposed by Parikh et al. (2016), our work has some notable differences. First, we will pay much attention to the comparison function $f$ and compare a number of options, including some uncommon ones based on elementwise operations. Second, we apply our model to four different datasets representing four different tasks to evaluate its general effectiveness for sequence matching problems. There are also some other differences from the work by Parikh et al. (2016). For example, we use a CNN layer instead of summation and concatenation for aggregation. Our attention mechanism is one-directional instead of two-directional.
55
+
56
+ In the rest of this section we will present the model in detail. We will focus mostly on the comparison functions we consider.
57
+
58
+ # 2.2 PREPROCESSING AND ATTENTION
59
+
60
+ Inspired by the use of gates in LSTM and GRU, we preprocess $\mathbf { Q }$ and A with the following formulas:
61
+
62
+ $$
63
+ \begin{array} { r l r } { \overline { { \mathbf { Q } } } } & { = } & { \sigma ( \mathbf { W } ^ { \mathrm { i } } \mathbf { Q } + \mathbf { b } ^ { \mathrm { i } } \otimes \mathbf { e } _ { Q } ) \odot \mathrm { t a n h } ( \mathbf { W } ^ { \mathrm { u } } \mathbf { Q } + \mathbf { b } ^ { \mathrm { u } } \otimes \mathbf { e } _ { Q } ) , } \\ { \overline { { \mathbf { A } } } } & { = } & { \sigma ( \mathbf { W } ^ { \mathrm { i } } \mathbf { A } + \mathbf { b } ^ { \mathrm { i } } \otimes \mathbf { e } _ { A } ) \odot \mathrm { t a n h } ( \mathbf { W } ^ { \mathrm { u } } \mathbf { A } + \mathbf { b } ^ { \mathrm { u } } \otimes \mathbf { e } _ { A } ) , } \end{array}
64
+ $$
65
+
66
+ where $\odot$ is element-wise multiplication, and $\mathbf { W } ^ { \mathrm { i } } , \mathbf { W } ^ { \mathrm { u } } \in \mathbb { R } ^ { l \times d }$ and $\mathbf { b } ^ { \mathrm { i } } , \mathbf { b } ^ { \mathrm { u } } \in \mathbb { R } ^ { l }$ are parameters to be learned. The outer product $\left( \cdot \otimes \mathbf { e } _ { X } \right)$ produces a matrix or row vector by repeating the vector or scalar on the left for $X$ times. Here $\sigma ^ { \prime } ( { \mathbf { W } } ^ { \mathrm { i } } \mathbf { Q } + { \mathbf { b } } ^ { \mathrm { i } } \otimes \mathbf { e } _ { Q } )$ and $\sigma ( \mathbf { W } ^ { \mathrm { i } } \mathbf { A } + \mathbf { b } ^ { \mathrm { i } } \otimes \mathbf { e } _ { A } ) $ act as gate values to control the degree to which the original values of $\mathbf { Q }$ and $\mathbf { A }$ are preserved in $\overline { { \mathbf { Q } } }$ and $\overline { { \mathbf A } }$ . For example, for stop words, their gate values would likely be low for tasks where stop words make little difference to the final predictions.
67
+
68
+ In this preprocessing step, the word order does not matter. Although a better way would be to use RNN such as LSTM and GRU to chain up the words such that we can capture some contextual information, this could be computationally expensive for long sequences. In our experiments, we only incorporated LSTM into the formulas above for the SNLI task.
69
+
70
+ The general attention (Luong et al., 2015) layer is built on top of the resulting $\overline { { \mathbf { Q } } }$ and $\overline { { \mathbf A } }$ as follows:
71
+
72
+ $$
73
+ \begin{array} { l l l } { { { \bf { G } } } } & { { = } } & { { \mathrm { s o f t m a x } \left( { ( { \bf { W } } ^ { \mathrm { g } } { \overline { { { \bf { Q } } } } } + { \bf { b } } ^ { \mathrm { g } } \otimes { \bf { e } } _ { Q } ) ^ { \mathrm { { T } } } { \overline { { { \bf { A } } } } } } \right) , } } \\ { { { \bf { H } } } } & { { = } } & { { { \overline { { { \bf { Q } } } } } { \bf { G } } , } } \end{array}
74
+ $$
75
+
76
+ where $\mathbf { W ^ { g } } \in \mathbb { R } ^ { l \times l }$ and $\mathbf { b } ^ { \mathrm { g } } \in \mathbb { R } ^ { l }$ are parameters to be learned, $\mathbf { G } \in \mathbb { R } ^ { Q \times A }$ is the attention weight matrix, and $\mathbf { H } \in \mathbb { R } ^ { l \times A }$ are the attention-weighted vectors. Specifically, $\mathbf { h } _ { j }$ , which is the $j ^ { \mathrm { t h } }$ column vector of $\mathbf { H }$ , is a weighted sum of the column vectors of $\overline { { \mathbf { Q } } }$ and represents the part of $\mathbf { Q }$ that best matches the $j ^ { \mathrm { t h } }$ word in A. Next we will combine $\mathbf { h } _ { j }$ and $\overline { { \mathbf { a } } } _ { j }$ using a comparison function.
77
+
78
+ # 2.3 COMPARISON
79
+
80
+ The goal of the comparison layer is to match each $\overline { { \mathbf { a } } } _ { j }$ , which represents the $j ^ { \mathrm { t h } }$ word and its context in $\mathbf { A }$ , with $\mathbf { h } _ { j }$ , which represents a weighted version of $\mathbf { Q }$ that best matches $\overline { { \mathbf { a } } } _ { j }$ . Let $f$ denote a comparison function that transforms $\overline { { \mathbf { a } } } _ { j }$ and $\mathbf { h } _ { j }$ into a vector $\mathbf { t } _ { j }$ to represent the comparison result.
81
+
82
+ A natural choice of $f$ is a standard neural network layer that consists of a linear transformation followed by a non-linear activation function. For example, we can consider the following choice:
83
+
84
+ $$
85
+ \mathrm { N E U R A L N E T } \left( \mathrm { N N } \right) ; \qquad \mathbf { t } _ { j } = f \bigl ( \mathbf { \overline { { a } } } _ { j } , \mathbf { h } _ { j } \bigr ) = \mathrm { R e L U } \bigl ( \mathbf { W } \left[ \mathbf { \overline { { a } } } _ { j } \right] + \mathbf { b } \bigr ) ,
86
+ $$
87
+
88
+ where matrix $\mathbf { W } \in \mathbb { R } ^ { l \times { 2 l } }$ and vector $\mathbf { b } \in \mathbb { R } ^ { l }$ are parameters to be learned.
89
+
90
+ Alternatively, another natural choice is a neural tensor network (Socher et al., 2013) as follows:
91
+
92
+ $\mathrm { N E U R A L T E N S O R N E T } \left( \mathrm { N T N } \right) : \qquad \mathbf { t } _ { j } = f ( \overline { { \mathbf { a } } } _ { j } , \mathbf { h } _ { j } ) = \mathrm { R e L U } ( \overline { { \mathbf { a } } } _ { j } ^ { \mathrm { { T } } } \mathbf { T } ^ { [ 1 \ldots l ] } \mathbf { h } _ { j } + \mathbf { b } ) ,$ where tensor $\mathbf { T } ^ { [ 1 \ldots l ] } \in \mathbb { R } ^ { l \times l \times l }$ and vector $\mathbf { b } \in \mathbb { R } ^ { l }$ are parameters to be learned.
93
+
94
+ However, we note that for many sequence matching problems, we intend to measure the semantic similarity or relatedness of the two sequences. So at the word level, we also intend to check how similar or related $\overline { { \mathbf { a } } } _ { j }$ is to $\mathbf { h } _ { j }$ . For this reason, a more natural choice used in some previous work is Euclidean distance or cosine similarity between $\overline { { \mathbf { a } } } _ { j }$ and $\mathbf { h } _ { j }$ . We therefore consider the following definition of $f$ :
95
+
96
+ $$
97
+ \begin{array} { r } { \mathrm { E U C L I D E A N + C O S I N E ~ ( E U C C O S ) : } \qquad \mathbf { t } _ { j } = f ( \overline { { \mathbf { a } } } _ { j } , \mathbf { h } _ { j } ) = \left[ \Vert \overline { { \mathbf { a } } } _ { j } - \mathbf { h } _ { j } \Vert _ { 2 } \right] . } \end{array}
98
+ $$
99
+
100
+ Note that with EUCCOS, the resulting vector $\mathbf { t } _ { j }$ is only a 2-dimensional vector. Although EUCCOS is a well-justified comparison function, we suspect that it may lose some useful information from the original vectors $\overline { { \mathbf { a } } } _ { j }$ and $\mathbf { h } _ { j }$ . On the other hand, NN and NTN are too general and thus do not capture the intuition that we care mostly about the similarity between $\mathbf { \overline { { a } } } _ { j }$ and $\mathbf { h } _ { j }$ .
101
+
102
+ To use something that is a good compromise between the two extreme cases, we consider the following two new comparison functions, which operate on the two vectors in an element-wise manner. These functions have been used previously by Mou et al. (2016).
103
+
104
+ $$
105
+ \begin{array} { r l } { \mathrm { S U B T R A C T I O N ~ ( S U B ) } \colon \quad } & { \mathbf { t } _ { j } = f ( \overline { { \mathbf { a } } } _ { j } , \mathbf { h } _ { j } ) = ( \overline { { \mathbf { a } } } _ { j } - \mathbf { h } _ { j } ) \odot ( \overline { { \mathbf { a } } } _ { j } - \mathbf { h } _ { j } ) , } \\ { \mathrm { M U L T I P L I C A T I O N ~ ( M U L T ) } \colon \quad } & { \mathbf { t } _ { j } = f ( \overline { { \mathbf { a } } } _ { j } , \mathbf { h } _ { j } ) = \overline { { \mathbf { a } } } _ { j } \odot \mathbf { h } _ { j } . } \end{array}
106
+ $$
107
+
108
+ Note that the operator $\odot$ is element-wise multiplication. For both comparison functions, the resulting vector $\mathbf { t } _ { j }$ has the same dimensionality as $\overline { { \mathbf { a } } } _ { j }$ and $\mathbf { h } _ { j }$ .
109
+
110
+ We can see that SUB is closely related to Euclidean distance in that Euclidean distance is the sum of all the entries of the vector $\mathbf { t } _ { j }$ produced by SUB. But by not summing up these entries, SUB preserves some information about the different dimensions of the original two vectors. Similarly, MULT is closely related to cosine similarity but preserves some information about the original two vectors.
111
+
112
+ Finally, we consider combining SUB and MULT followed by an NN layer as follows:
113
+
114
+ $$
115
+ \begin{array} { r l } { \mathrm { S U B M U L T + N N : } \quad } & { \mathbf { t } _ { j } = f ( \overline { { \mathbf { a } } } _ { j } , \mathbf { h } _ { j } ) = \mathrm { R e L U } \big ( \mathbf { W } \left[ \mathbf { ( \overline { { a } } } _ { j } - \mathbf { h } _ { j } ) \odot ( \overline { { \mathbf { a } } } _ { j } - \mathbf { h } _ { j } ) \right] + \mathbf { b } \big ) . } \end{array}
116
+ $$
117
+
118
+ In summary, we consider six different comparison functions: NN, NTN, EUCCOS, SUB, MULT and SUBMULT $\mathbf { \Gamma } + \mathbf { N N }$ . Among these functions, the last three (SUB, MULT and SUBMULT $+ \mathrm { N N }$ ) have not been widely used in previous work for word-level matching.
119
+
120
+ # 2.4 AGGREGATION
121
+
122
+ After we apply the comparison function to each pair of $\overline { { \mathbf { a } } } _ { j }$ and $\mathbf { h } _ { j }$ to obtain a series of vectors $\mathbf { t } _ { j }$ , finally we aggregate these vectors using a one-layer CNN (Kim, 2014):
123
+
124
+ $$
125
+ \begin{array} { r l r } { { \bf r } } & { { } = } & { { \bf C } { \bf N } { \bf N } ( [ { \bf t } _ { 1 } , \ldots , { \bf t } _ { A } ] ) . } \end{array}
126
+ $$
127
+
128
+ $\mathbf { r } \in \mathbb { R } ^ { n l }$ is then used for the final classification, where $n$ is the number of windows in CNN.
129
+
130
+ # 3 EXPERIMENTS
131
+
132
+ <table><tr><td></td><td colspan="3">MovieQA</td><td colspan="3">InsuranceQA</td><td colspan="3">WikiQA</td><td colspan="3">SNLI</td></tr><tr><td></td><td>train</td><td>dev</td><td>test</td><td>train</td><td>dev</td><td>test</td><td>train</td><td>dev</td><td>test</td><td>train</td><td>dev</td><td>test</td></tr><tr><td>#Q</td><td>9848</td><td>1958</td><td>3138</td><td>13K</td><td>1K</td><td>1.8K*2</td><td>873</td><td>126</td><td>243</td><td>549K</td><td>9842</td><td>9824</td></tr><tr><td>#C</td><td>5</td><td>5</td><td>5</td><td>50</td><td>500</td><td>500</td><td>10</td><td>9</td><td>10</td><td>-</td><td>-</td><td>-</td></tr><tr><td>#w in P</td><td>873</td><td>866</td><td>914</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>1</td><td>-</td><td>-</td><td>1</td></tr><tr><td>#w in Q</td><td>10.6</td><td>10.6</td><td>10.8</td><td>7.2</td><td>7.2</td><td>7.2</td><td>6.5</td><td>6.5</td><td>6.4</td><td>14</td><td>15.2</td><td>15.2</td></tr><tr><td>#w in A</td><td>5.9</td><td>5.6</td><td>5.5</td><td>92.1</td><td>92.1</td><td>92.1</td><td>25.5</td><td>24.7</td><td>25.1</td><td>8.3</td><td>8.4</td><td>8.3</td></tr></table>
133
+
134
+ Table 2: The statistics of different datasets. Q:question/hypothesis, C:candidate answers for each question, A:answer/hypothesis, P:plot, w:word (average).
135
+
136
+ Table 3: Experiment Results
137
+
138
+ <table><tr><td rowspan="2">Models</td><td colspan="2">MovieQA</td><td colspan="3">InsuranceQA</td><td colspan="2">WikiQA</td><td colspan="2">SNLI</td></tr><tr><td>dev</td><td>test</td><td>dev</td><td>test1</td><td>test2</td><td>MAP</td><td>MRR</td><td>train</td><td>test</td></tr><tr><td>Cosine Word2Vec</td><td>46.4</td><td>45.63</td><td>-</td><td>=</td><td></td><td>=</td><td>=</td><td>=</td><td>=</td></tr><tr><td>Cosine TFIDF</td><td>47.6</td><td>47.36</td><td>=</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>SSCB TFIDF</td><td>48.5</td><td>1</td><td>=</td><td>=</td><td>=</td><td></td><td></td><td></td><td></td></tr><tr><td>IR model</td><td>1</td><td>=</td><td>52.7</td><td>55.1</td><td>50.8</td><td></td><td></td><td></td><td></td></tr><tr><td>CNN with GESD</td><td></td><td>=</td><td>65.4</td><td>65.3</td><td>61.0</td><td></td><td></td><td></td><td></td></tr><tr><td>Attentive LSTM</td><td></td><td></td><td>68.9</td><td>69.0</td><td>64.8</td><td></td><td></td><td></td><td></td></tr><tr><td>IARNN-Occam</td><td></td><td>=</td><td>69.1</td><td>68.9</td><td>65.1</td><td>0.7341</td><td>0.7418</td><td></td><td></td></tr><tr><td>IARNN-Gate</td><td></td><td></td><td>70.0</td><td>70.1</td><td>62.8</td><td>0.7258</td><td>0.7394</td><td></td><td></td></tr><tr><td>CNN-Cnt</td><td></td><td></td><td>-</td><td>-</td><td>-</td><td>0.6520</td><td>0.6652</td><td></td><td></td></tr><tr><td>ABCNN</td><td></td><td></td><td>=</td><td></td><td>=</td><td>0.6921</td><td>0.7108</td><td></td><td></td></tr><tr><td>CubeCNN</td><td></td><td></td><td></td><td></td><td></td><td>0.7090</td><td>0.7234</td><td></td><td></td></tr><tr><td>W-by-WAttention</td><td></td><td></td><td></td><td></td><td></td><td>=</td><td>=</td><td>85.3</td><td>83.5</td></tr><tr><td>match-LSTM</td><td></td><td></td><td></td><td></td><td></td><td></td><td>=</td><td>92.0</td><td>86.1</td></tr><tr><td>LSTMN</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>88.5</td><td>86.3</td></tr><tr><td>Decomp Attention</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>90.5</td><td>86.8</td></tr><tr><td>EBIM+TreeLSTM</td><td>=</td><td></td><td>=</td><td>=</td><td>=</td><td>=</td><td>=</td><td>93.0</td><td>88.3</td></tr><tr><td>NN</td><td>31.6</td><td>=</td><td>76.8</td><td>74.9</td><td>72.4</td><td>0.7102</td><td>0.7224</td><td>89.3</td><td>86.3</td></tr><tr><td>NTN</td><td>31.6</td><td>=</td><td>75.6</td><td>75.0</td><td>72.5</td><td>0.7349</td><td>0.7456</td><td>91.6</td><td>86.3</td></tr><tr><td>EucCos</td><td>71.9</td><td>=</td><td>70.6</td><td>70.2</td><td>67.9</td><td>0.6740</td><td>0.6882</td><td>87.1</td><td>84.0</td></tr><tr><td>SUB</td><td>64.9</td><td></td><td>70.0</td><td>71.3</td><td>68.2</td><td>0.7019</td><td>0.7151</td><td>89.8</td><td>86.8</td></tr><tr><td>MULT</td><td>66.4</td><td>=</td><td>76.0</td><td>75.2</td><td>73.4</td><td>0.7433</td><td>0.7545</td><td>89.7</td><td>85.8</td></tr><tr><td>SUBMULT+NN</td><td>72.1</td><td>72.9</td><td>77.0</td><td>75.6</td><td>72.3</td><td>0.7332</td><td>0.7477</td><td>89.4</td><td>86.8</td></tr></table>
139
+
140
+ <table><tr><td rowspan="2">Models</td><td colspan="2">MovieQA</td><td colspan="3">InsuranceQA</td><td colspan="2">WikiQA</td><td colspan="2">SNLI</td></tr><tr><td>dev</td><td>test</td><td>dev</td><td>test1</td><td>test2</td><td>MAP</td><td>MRR</td><td>train</td><td>test</td></tr><tr><td>SUBMULT+NN (no preprocess)</td><td>72.0</td><td>:</td><td>72.8</td><td>73.8</td><td>70.7</td><td>0.6996</td><td>0.7156</td><td>89.6</td><td>82.8</td></tr><tr><td>SUBMULT+NN (no attention)</td><td>60.4</td><td>:</td><td>69.4</td><td>70.4</td><td>67.8</td><td>0.7164</td><td>0.7238</td><td>89.0</td><td>84.4</td></tr></table>
141
+
142
+ Table 4: Ablation Experiment Results. “no preprocess”: remove the preprocessing layer by directly using word embeddings $\mathbf { Q }$ and A to replace $\overline { { \mathbf { Q } } }$ and $\overline { { \mathbf A } }$ in Eqn. 1; “no attention”: remove the attention layer by using mean pooling of $\overline { { \mathbf { Q } } }$ to replace all the vectors of $\mathbf { H }$ in Eqn. 2.
143
+
144
+ In this section, we evaluate our model on four different datasets representing different tasks. The first three datasets are question answering tasks while the last one is on textual entailment. The statistics of the four datasets are shown in Table 2. We will fist introduce the task settings and the way we customize the “compare-aggregate” structure to each task. Then we will show the baselines for the different datasets. Finally, we discuss the experiment results shown in Table 3 and the ablation study shown in Table 4.
145
+
146
+ # 3.1 TASK-SPECIFIC MODEL STRUCTURES
147
+
148
+ In all these tasks, we use matrix $\mathbf { Q } \in \mathbb { R } ^ { d \times Q }$ to represent the question or premise and matrix $\mathbf { A } _ { k } \in$ $\mathbb { R } ^ { d \times A _ { k } }$ $( k \in [ 1 , K ] )$ to represent the $k ^ { \mathrm { { t h } } }$ answer or the hypothesis. For the machine comprehension task MovieQA (Tapaswi et al., 2016), there is also a matrix $\mathbf { P } \in \mathbb { R } ^ { d \times P }$ that represents the plot of a movie. Here $Q$ is the length of the question or premise, $A _ { k }$ the length of the $\bar { k ^ { \mathrm { { t h } } } }$ answer, and $P$ the length of the plot.
149
+
150
+ For the SNLI (Bowman et al., 2015) dataset, the task is text entailment, which identifies the relationship (entailment, contradiction or neutral) between a premise sentence and a hypothesis sentence. Here $K = 1$ , and there are exactly two sequences to match. The actual model structure is what we have described before.
151
+
152
+ For the InsuranceQA (Feng et al., 2015) dataset, the task is an answer selection task which needs to select the correct answer for a question from a candidate pool. For the WikiQA (Yang et al., 2015) datasets, we need to rank the candidate answers according to a question. For both tasks, there are $K$ candidate answers for each question. Let us use $\mathbf { r } _ { k }$ to represent the resulting vector produced by Eqn. 9 for the $k ^ { \mathrm { { t h } } }$ answer. In order to select one of the $K$ answers, we first define $\mathbf { R } = [ \mathbf { r } _ { 1 } , \mathbf { r } _ { 2 } , \ldots , \mathbf { r } _ { K } ]$ . We then compute the probability of the $k ^ { \mathrm { { t h } } }$ answer to be the correct one as follows:
153
+
154
+ $$
155
+ \begin{array} { r l r } { p ( k | { \bf R } ) } & { = } & { \mathrm { s o f t m a x } ( { \bf w } ^ { \mathrm { T } } \operatorname { t a n h } ( { \bf W } ^ { \mathrm { s } } { \bf R } + { \bf b } ^ { \mathrm { s } } \otimes { \bf e } _ { K } ) + b \otimes { \bf e } _ { K } ) , } \end{array}
156
+ $$
157
+
158
+ where $\mathbf { W ^ { s } } \in \mathbb { R } ^ { l \times n l }$ , $\mathbf { w } \in \mathbb { R } ^ { l }$ , $\mathbf { b } ^ { \mathrm { s } } \in \mathbb { R } ^ { l }$ , $b \in \mathbb { R }$ are parameters to be learned.
159
+
160
+ For the machine comprehension task MovieQA, each question is related to Plot Synopses written by fans after watching the movie and each question has five candidate answers. So for each candidate answer there are three sequences to be matched: the plot $\mathbf { P }$ , the question $\mathbf { Q }$ and the answer $\mathbf { A } _ { k }$ . For each $k$ , we first match $\mathbf { Q }$ and $\mathbf { P }$ and refer to the matching result at position $j$ as $\mathbf { t } _ { j } ^ { \mathrm { q } }$ , as generated by one of the comparison functions $f$ . Similarly, we also match $\mathbf { A } _ { k }$ with $\mathbf { P }$ and refer to the matching result at position $j$ as $\mathbf { t } _ { k , j } ^ { \mathrm { a } }$ . We then define
161
+
162
+ $$
163
+ \begin{array} { r l r } { \mathbf { \mathrm { t } } _ { k , j } } & { { } = } & { \left[ \begin{array} { c } { \mathbf { \mathrm { t } } _ { j } ^ { \mathrm { q } } } \\ { \mathbf { \mathrm { t } } _ { k , j } ^ { \mathrm { a } } } \end{array} \right] , } \end{array}
164
+ $$
165
+
166
+ and
167
+
168
+ $$
169
+ \begin{array} { l l l } { \mathbf { r } _ { k } } & { = } & { \mathbf { C N N } ( [ \mathbf { t } _ { k , 1 } , \dots , \mathbf { t } _ { k , P } ] ) . } \end{array}
170
+ $$
171
+
172
+ To select an answer from the $K$ candidate answers, again we use Eqn. 10 to compute the probabilities.
173
+
174
+ The implementation details of the modes are as follows. The word embeddings are initialized from GloVe (Pennington et al., 2014). During training, they are not updated. The word embeddings not found in GloVe are initialized with zero.
175
+
176
+ The dimensionality $l$ of the hidden layers is set to be 150. We use ADAMAX (Kingma & Ba, 2015) with the coefficients $\beta _ { 1 } = 0 . 9$ and $\beta _ { 2 } = 0 . 9 9 9$ to optimize the model. We do not use L2- regularization. The main parameter we tuned is the dropout on the embedding layer. For WikiQA, which is a relatively small dataset, we also tune the learning rate and the batch size. For the others, we set the batch size to be 30 and the learning rate 0.002.
177
+
178
+ # 3.2 BASELINES
179
+
180
+ Here, we will introduce the baselines for each dataset. We did not re-implement these models but simply took the reported performance for the purpose of comparison.
181
+
182
+ SNLI: • W-by-W Attention: The model by Rocktaschel et al. (2015), who first introduced attention ¨ mechanism into text entailment. • match-LSTM: The model by Wang & Jiang (2016b), which concatenates the matched words as the inputs of an LSTM. • LSTMN: Long short-term memorynetworks proposed by Cheng et al. (2016). • Decomp Attention: Another “compare-aggregate” model proposed by Parikh et al. (2016). • EBIM $\mathbf { + }$ TreeLSTM: The state-of-the-art model proposed by Chen et al. (2016) on the SNLI dataset.
183
+
184
+ InsuranceQA: • IR model: This model by Bendersky et al. (2010) learns the concept information to help rank the candidates. • CNN with GESD: This model by Feng et al. (2015) uses Euclidean distance and dot product between sequence representations built through convolutional neural networks to select the answer. • Attentive LSTM: Tan et al. (2016) used soft-attention mechanism to select the most important information from the candidates according to the representation of the questions. • IARNN-Occam: This model by Wang et al. (2016) adds regularization on the attention weights. • IARNN-Gate: This model by Wang et al. (2016) uses the representation of the question to build the GRU gates for each candidate answer.
185
+
186
+ WikiQA: • IARNN-Occam and IARNN-Gate as introduced before. • CNN-Cnt: This model by Yang et al. (2015) combines sentence representations built by a convolutional neural network with logistic regression. • ABCNN: This model is Attention-Based Convolutional Neural Network proposed by Yin et al. (2015). • CubeCNN proposed by He & Lin (2016) builds a CNN on all pairs of word similarity.
187
+
188
+ MovieQA: All the baselines we consider come from Tapaswi et al. (2016)’s work: • Cosine Word2Vec: A sliding window is used to select the answer according to the similarities computed through Word2Vec between the sentences in plot and the question/answer. • Cosine TFIDF: This model is similar to the previous method but uses bag-of-word with tf-idf scores to compute similarity. • SSCB TFIDF: Instead of using the sliding window method, a convolutional neural network is built on the sentence level similarities.
189
+
190
+ # 3.3 ANALYSIS OF RESULTS
191
+
192
+ We use accuracy as the evaluation metric for the datasets MovieQA, InsuranceQA and SNLI, as there is only one correct answer or one label for each instance. For WikiQA, there may be multiple correct answers, so evaluation metrics we use are Mean Average Precision (MAP) and Mean Reciprocal Rank (MRR).
193
+
194
+ We observe the following from the results. (1) Overall, we can find that our general “compareaggregate” structure achieves the best performance on MovieQA, InsuranceQA, WikiQA datasets and very competitive performance on the SNLI dataset. Especially for the InsuranceQA dataset, with any comparison function we use, our model can outperform all the previous models. (2) The comparison method SUBMULT $\bf { \Phi } + \bf { N N }$ is the best in general. (3) Some simple comparison functions can achieve better performance than the neural networks or neural tensor network comparison functions. For example, the simplest comparison function EUCCOS achieves nearly the best performance in the MovieQA dataset, and the element-wise comparison functions, which do not need parameters can achieve the best performance on the WikiQA dataset. (4) We find the preprocessing layer and the attention layer for word selection to be important in the “compare-aggregate” structure through the experiments of removing these two layers separately. We also see that for sequence matching with big difference in length, such as the MovieQA and InsuranceQA tasks, the attention layer plays a more important role. For sequence matching with smaller difference in length, such as the WikiQA and SNLI tasks, the pre-processing layer plays a more important role. (5) For the MovieQA, InsuranceQA and WikiQA tasks, our preprocessing layer is order-insensitive so that it will not take the context information into consideration during the comparison, but our model can still outperform the previous work with order-sensitive preprocessing layer. With this finding, we believe the word-by-word comparison part plays a very important role in these tasks. We will further explore the preprocessing layer in the future.
195
+
196
+ # 3.4 FURTHER ANALYSES
197
+
198
+ To further explain how our model works, we visualize the max values in each dimension of the convolutional layer. We use two examples shown in Table 1 from MovieQA and InsuranceQA datasets respectively. In the top of Figure 2, we can see that the plot words that also appear in either the question or the answer will draw more attention by the CNN. We hypothesize that if the nearby words in the plot can match both the words in question and the words in one answer, then this answer is more likely to be the correct one. Similarly, the bottom one of Figure 2 also shows that the CNN will focus more on the matched word representations. If the words in one answer continuously match the words in the question, this answer is more likely to be the correct one.
199
+
200
+ # 4 RELATED WORK
201
+
202
+ We review related work in three types of general structures for matching sequences.
203
+
204
+ Siamense network: These kinds of models use the same structure, such as RNN or CNN, to build the representations for the sequences separately and then use them for classification. Then cosine similarity (Feng et al., 2015; Yang et al., 2015), element-wise operation (Tai et al., 2015; Mou et al., 2016) or neural network-based combination Bowman et al. (2015) are used for sequence matching.
205
+
206
+ Attentive network: Soft-attention mechanism (Bahdanau et al., 2014; Luong et al., 2015) has been widely used for sequence matching in machine comprehension (Hermann et al., 2015), text entailment (Rocktaschel et al., 2015) and question answering (Tan et al., 2016). Instead of using the ¨ final state of RNN to represent a sequence, these studies use weighted sum of all the states for the sequence representation.
207
+
208
+ Compare-Aggregate network: This kind of framework is to perform the word level matching (Wang & Jiang, 2016a; Parikh et al., 2016; He & Lin, 2016; Trischler et al., 2016; Wan et al.,
209
+
210
+ ![](images/27f1d5e7b23b964c7ee665e91a3e8b362fec068358e8183d673024ba6b5afb7d.jpg)
211
+ Figure 2: An visualization of the largest value of each dimension in the convolutional layer of CNN. The top figure is an example from the dataset MovieQA with CNN window size 5. The bottom figure is an example from the dataset InsuranceQA with CNN window size 3. Due to the sparsity of the representation, we show only the dimensions with larger values. The dimensionality of the raw representations is 150.
212
+
213
+ 2016). Our work is under this framework. But our structure is different from previous models and our model can be applied on different tasks. Besides, we analyzed different word-level comparison functions separately.
214
+
215
+ # 5 CONCLUSIONS
216
+
217
+ In this paper, we systematically analyzed the effectiveness of a “compare-aggregate” model on four different datasets representing different tasks. Moreover, we compared and tested different kinds of word-level comparison functions and found that some element-wise comparison functions can outperform the others. According to our experiment results, many different tasks can share the same “compare-aggregate” structure. In the future work, we would like to test its effectiveness on multi-task learning.
218
+
219
+ # 6 ACKNOWLEDGMENTS
220
+
221
+ This research is supported by the National Research Foundation, Prime Ministers Office, Singapore under its International Research Centres in Singapore Funding Initiative.
222
+
223
+ # REFERENCES
224
+
225
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In Proceedings of the International Conference on Learning Representations, 2014.
226
+
227
+ Michael Bendersky, Donald Metzler, and W Bruce Croft. Learning concept importance using a weighted dependence model. In Proceedings of the third ACM International Conference on Web Search and Data Mining. ACM, 2010.
228
+
229
+ Samuel R Bowman, Gabor Angeli, Christopher Potts, and Christopher D Manning. A large annotated corpus for learning natural language inference. In Proceedings of the Conference on Empirical Methods in Natural Language Processing, 2015.
230
+
231
+ Qian Chen, Xiaodan Zhu, Zhenhua Ling, Si Wei, and Hui Jiang. Enhancing and combining sequential and tree LSTM for natural language inference. arXiv preprint arXiv:1609.06038, 2016.
232
+
233
+ Jianpeng Cheng, Li Dong, and Mirella Lapata. Long short-term memory-networks for machine reading. In Proceedings of the Conference on Empirical Methods in Natural Language Processing, 2016.
234
+
235
+ Minwei Feng, Bing Xiang, Michael R Glass, Lidan Wang, and Bowen Zhou. Applying deep learning to answer selection: A study and an open task. In 2015 IEEE Workshop on Automatic Speech Recognition and Understanding (ASRU), pp. 813–820. IEEE, 2015.
236
+
237
+ Hua He and Jimmy Lin. Pairwise word interaction modeling with deep neural networks for semantic similarity measurement. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, 2016.
238
+
239
+ Karl Moritz Hermann, Tomas Kocisky, Edward Grefenstette, Lasse Espeholt, Will Kay, Mustafa Suleyman, and Phil Blunsom. Teaching machines to read and comprehend. In Proceedings of the Conference on Advances in Neural Information Processing Systems, 2015.
240
+
241
+ Felix Hill, Antoine Bordes, Sumit Chopra, and Jason Weston. The Goldilocks principle: Reading children’s books with explicit memory representations. In Proceedings of the International Conference on Learning Representations, 2016.
242
+
243
+ Baotian Hu, Zhengdong Lu, Hang Li, and Qingcai Chen. Convolutional neural network architectures for matching natural language sentences. In Advances in Neural Information Processing Systems, 2014.
244
+
245
+ Yoon Kim. Convolutional neural networks for sentence classification. In Proceedings of the Conference on Empirical Methods in Natural Language Processing, 2014.
246
+
247
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In Proceedings of the International Conference on Learning Representations, 2015.
248
+
249
+ Minh-Thang Luong, Hieu Pham, and Christopher D Manning. Effective approaches to attentionbased neural machine translation. Proceedings of the Conference on Empirical Methods in Natural Language Processing, 2015.
250
+
251
+ Lili Mou, Rui Men, Ge Li, Yan Xu, Lu Zhang, Rui Yan, and Zhi Jin. Natural language inference by tree-based convolution and heuristic matching. In Proceedings of the Conference on Empirical Methods in Natural Language Processing, 2016.
252
+
253
+ Ankur P Parikh, Oscar Tackstr ¨ om, Dipanjan Das, and Jakob Uszkoreit. A decomposable attention ¨ model for natural language inference. In Proceedings of the Conference on Empirical Methods in Natural Language Processing, 2016.
254
+
255
+ Jeffrey Pennington, Richard Socher, and Christopher D Manning. GloVe: Global vectors for word representation. In Proceedings of the Conference on Empirical Methods in Natural Language Processing, 2014.
256
+
257
+ Matthew Richardson, Christopher JC Burges, and Erin Renshaw. MCTest: A challenge dataset for the open-domain machine comprehension of text. In Proceedings of the Conference on Empirical Methods in Natural Language Processing, 2013.
258
+
259
+ Tim Rocktaschel, Edward Grefenstette, Karl Moritz Hermann, Tom ¨ a´s Ko ˇ cisk ˇ y, and Phil Blunsom. \` Reasoning about entailment with neural attention. In Proceedings of the International Conference on Learning Representations, 2015.
260
+
261
+ Richard Socher, Alex Perelygin, Jean Y Wu, Jason Chuang, Christopher D Manning, Andrew Y $\mathrm { N g }$ , and Christopher Potts. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of the Conference on Empirical Methods in Natural Language Processing, 2013.
262
+
263
+ Kai Sheng Tai, Richard Socher, and Christopher D Manning. Improved semantic representations from tree-structured long short-term memory networks. In Proceedings of the Conference on Association for Computational Linguistics, 2015.
264
+
265
+ Ming Tan, Cicero dos Santos, Bing Xiang, and Bowen Zhou. Improved representation learning for question answer matching. In Proceedings of the Conference on Association for Computational Linguistics, 2016.
266
+
267
+ Makarand Tapaswi, Yukun Zhu, Rainer Stiefelhagen, Antonio Torralba, Raquel Urtasun, and Sanja Fidler. MovieQA: Understanding stories in movies through question-answering. In Proceedings of IEEE Conference on Computer Vision and Pattern Recognition, 2016.
268
+
269
+ Adam Trischler, Zheng Ye, Xingdi Yuan, Jing He, Phillip Bachman, and Kaheer Suleman. A parallel-hierarchical model for machine comprehension on sparse data. In Proceedings of the Conference on Association for Computational Linguistics, 2016.
270
+
271
+ Shengxian Wan, Yanyan Lan, Jun Xu, Jiafeng Guo, Liang Pang, and Xueqi Cheng. Match-srnn: Modeling the recursive matching structure with spatial RNN. International Joint Conference on Artificial Intelligence, 2016.
272
+
273
+ Bingning Wang, Kang Liu, and Jun Zhao. Inner attention based recurrent neural networks for answer selection. In Proceedings of the Conference on Association for Computational Linguistics, 2016.
274
+
275
+ Shuohang Wang and Jing Jiang. Machine comprehension using match-LSTM and answer pointer. arXiv preprint arXiv:1608.07905, 2016a.
276
+
277
+ Shuohang Wang and Jing Jiang. Learning natural language inference with LSTM. In Proceedings of the Conference on the North American Chapter of the Association for Computational Linguistics, 2016b.
278
+
279
+ Yi Yang, Wen-tau Yih, and Christopher Meek. WikiQA: A challenge dataset for open-domain question answering. In Proceedings of the Conference on Empirical Methods in Natural Language Processing, 2015.
280
+
281
+ Wenpeng Yin, Hinrich Schutze, Bing Xiang, and Bowen Zhou. ABCNN: Attention-based convolu- ¨ tional neural network for modeling sentence pairs. arXiv preprint arXiv:1512.05193, 2015.
md/train/HJUOHGWRb/HJUOHGWRb.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/HJV1zP5xg/HJV1zP5xg.md ADDED
@@ -0,0 +1,385 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DIVERSE BEAM SEARCH: DECODING DIVERSE SOLUTIONS FROM NEURAL SEQUENCE MODELS
2
+
3
+ Ashwin K Vijayakumar1, Michael Cogswell1, Ramprasaath R. Selvaraju1, Qing Sun1
4
+ Stefan Lee1, David Crandall2 & Dhruv Batra1
5
+
6
+ {ashwinkv,cogswell,ram21,sunqing,steflee}@vt.edu djcran@indiana.edu, dbatra@vt.edu
7
+
8
+ 1 Department of Electrical and Computer Engineering, Virginia Tech, Blacksburg, VA, USA
9
+
10
+ 2 School of Informatics and Computing Indiana University, Bloomington, IN, USA
11
+
12
+ # ABSTRACT
13
+
14
+ Neural sequence models are widely used to model time-series data. Equally ubiquitous is the usage of beam search (BS) as an approximate inference algorithm to decode output sequences from these models. BS explores the search space in a greedy left-right fashion retaining only the top $B$ candidates. This tends to result in sequences that differ only slightly from each other. Producing lists of nearly identical sequences is not only computationally wasteful but also typically fails to capture the inherent ambiguity of complex AI tasks. To overcome this problem, we propose Diverse Beam Search (DBS), an alternative to BS that decodes a list of diverse outputs by optimizing a diversity-augmented objective. We observe that our method not only improved diversity but also finds better top 1 solutions by controlling for the exploration and exploitation of the search space. Moreover, these gains are achieved with minimal computational or memory overhead compared to beam search. To demonstrate the broad applicability of our method, we present results on image captioning, machine translation, conversation and visual question generation using both standard quantitative metrics and qualitative human studies. We find that our method consistently outperforms BS and previously proposed techniques for diverse decoding from neural sequence models.
15
+
16
+ # 1 INTRODUCTION
17
+
18
+ In the last few years, Recurrent Neural Networks (RNNs), Long Short-Term Memory networks (LSTMs) or more generally, neural sequence models have become the standard choice for modeling time-series data for a wide range of applications including speech recognition (Graves et al., 2013), machine translation (Bahdanau et al., 2014), conversation modeling (Vinyals & Le, 2015), image and video captioning (Vinyals et al., 2015; Venugopalan et al., 2015), and visual question answering (Antol et al., 2015). RNN based sequence generation architectures model the conditional probability, $\operatorname* { P r } ( \mathbf { y } | \mathbf { x } )$ of an output sequence $\mathbf { y } = ( y _ { 1 } , \dots , y _ { T } )$ given an input $\mathbf { x }$ (possibly also a sequence); where the output tokens $y _ { t }$ are from a finite vocabulary, $\nu$ .
19
+
20
+ Inference in RNNs. Maximum a Posteriori (MAP) inference for RNNs is the task of finding the most likely output sequence given the input. Since the number of possible sequences grows as $| \mathcal { V } | ^ { T }$ , exact inference is NP-hard – so, approximate inference algorithms like beam search (BS) are commonly employed. BS is a heuristic graph-search algorithm that maintains the $B$ top-scoring partial sequences expanded in a greedy left-to-right fashion. Fig. 1 shows a sample BS search tree.
21
+
22
+ Lack of Diversity in BS. Despite the widespread usage of BS, it has long been understood that solutions decoded by BS are generic and lacking in diversity (Finkel et al., 2006; Gimpel et al.,
23
+
24
+ ![](images/9d5741424271b2b680ca96a29deae3b58d1f3f59e3921635d32795b4ae741c13.jpg)
25
+ Single engine train rolling down the tracks. A locomotive drives along the tracks amongst trees and bushes. An engine is coming down the train track. A steam locomotive is blowing steam. An old fashion train with steam coming out of its pipe. A black and red train moving down a train track.
26
+ Figure 1: Comparing image captioning outputs decoded by BS (top) and our method, Diverse Beam Search (middle) – we notice that BS captions are near-duplicates with similar shared paths in the search tree and minor variations in the end. In contrast, DBS captions are significantly diverse and similar to the variability in human-generated ground truth captions (bottom).
27
+
28
+ 2013; Li et al., 2015; Li & Jurafsky, 2016). Comparing the human (bottom) and BS (top) generated captions shown in Fig. 1 demonstrates this deficiency. While this behavior of BS is disadvantageous for many reasons, we highlight the three most crucial ones here:
29
+
30
+ i) The production of near-identical beams make BS a computationally wasteful algorithm, with essentially the same computation being repeated for no significant gain in performance.
31
+ ii) Due to loss-evaluation mismatch (i.e. improvements in posterior-probabilities not necessarily corresponding to improvements in task-specific metrics), it is common practice to deliberately throttle BS to become a poorer optimization algorithm by using reduced beam widths (Vinyals et al., 2015; Karpathy & Fei-Fei, 2015; Ferraro et al., 2016). This treatment of an optimization algorithm as a hyperparameter is not only intellectually dissatisfying but also has a significant practical side-effect – it leads to the decoding of largely bland, generic, and “safe” outputs, e.g. always saying “I don’t know” in conversation models (Kannan et al., 2016).
32
+ iii) Most importantly, lack of diversity in the decoded solutions is fundamentally crippling in AI problems with significant ambiguity – e.g. there are multiple ways of describing an image or responding in a conversation that are “correct” and it is important to capture this ambiguity by finding several diverse plausible hypotheses.
33
+
34
+ Overview and Contributions. To address these shortcomings, we propose Diverse Beam Search $( D B S ) - \mathbf { a }$ general framework to decode a set of diverse sequences that can be used as an alternative to BS. At a high level, DBS decodes diverse lists by dividing the given beam budget into groups and enforcing diversity between groups of beams. Drawing from recent work in the probabilistic graphical models literature on Diverse M-Best (DivMBest) MAP inference (Batra et al., 2012; Prasad et al., 2014; Kirillov et al., 2015), we optimize an objective that consists of two terms – the sequence likelihood under the model and a dissimilarity term that encourages beams across groups to differ. This diversity-augmented model score is optimized in a doubly greedy manner – greedily optimizing along both time (like BS) and groups (like DivMBest).
35
+
36
+ Our primary technical contribution is Diverse Beam Search, a doubly greedy approximate inference algorithm to decode diverse sequences from neural sequence models. We report results on image captioning, machine translation, conversations and visual question generation to demonstrate the broad applicability of DBS. Results show that DBS produces consistent improvements on both task-specific oracle and other diversity-related metrics while maintaining run-time and memory requirements similar to BS. We also evaluate human preferences between image captions generated by BS or DBS. Further experiments show that DBS is robust over a wide range of its parameter values and is capable of encoding various notions of diversity through different forms of the diversty term.
37
+
38
+ Overall, our algorithm is simple to implement and consistently outperforms BS in a wide range of domains without sacrificing efficiency. Our implementation is publicly available at https: //github.com/ashwinkalyan/dbs. Additionally, we provide an interactive demonstration of DBS for image captioning at http://dbs.cloudcv.org.
39
+
40
+ # 2 PRELIMINARIES: DECODING RNNS WITH BEAM SEARCH
41
+
42
+ We begin with a refresher on BS, before describing our generalization, Diverse Beam Search. For notational convenience, let $[ n ]$ denote the set of natural numbers from 1 to $n$ and let $\mathbf { v } _ { [ n ] } =$ $[ v _ { 1 } , \ldots , v _ { n } ] ^ { \intercal }$ index the first $n$ elements of a vector $\mathbf { v } \in \mathbb { R } ^ { m }$ .
43
+
44
+ The Decoding Problem. RNNs are trained to estimate the likelihood of sequences of tokens from a finite dictionary $\nu$ given an input $\mathbf { x }$ . The RNN updates its internal state and estimates the conditional probability distribution over the next output given the input and all previous output tokens. We denote the logarithm of this conditional probability distribution over all tokens at time $t$ as $\theta ( y _ { t } ) =$ $\log \operatorname* { P r } ( y _ { t } | y _ { t - 1 } , \dots , y _ { 1 } , \mathbf { x } )$ . To avoid notational clutter, we index $\theta ( \cdot )$ with a single variable $y _ { t }$ , but it should be clear that it depends on all previous outputs, $\mathbf { y } _ { [ t - 1 ] }$ . We write the log probability of a partial solution (i.e. the sum of log probabilities of all tokens decoded so far) as $\Theta ( \mathbf { y } _ { [ t ] } ) =$ $\textstyle \sum _ { \tau \in [ t ] } \theta ( y _ { \tau } )$ . The decoding problem is then the task of finding a sequence y that maximizes $\Theta ( \mathbf { y } )$ .
45
+
46
+ As each output is conditioned on all the previous outputs, decoding the optimal length- $\mathcal { T }$ sequence in this setting can be viewed as MAP inference on a $T$ -order Markov chain with nodes corresponding to output tokens at each time step. Not only does the size of the largest factor in such a graph grow as $| \nu | ^ { \star }$ , but computing these factors also requires repetitively evaluating the sequence model. Thus, approximate algorithms are employed and the most prevalent method is beam search (BS).
47
+
48
+ Beam search is a heuristic search algorithm which stores the top $B$ highest scoring partial candidates at each time step; where $B$ is known as the beam width. Let us denote the set of $B$ solutions held by BS at the start of time $t$ as $Y _ { [ t - 1 ] } = \{ \mathbf { y } _ { 1 , [ t - 1 ] } , \dotsc , \mathbf { y } _ { B , [ t - 1 ] } \}$ . At each time step, BS considers all possible single token extensions of these beams given by the set $\mathscr { V } _ { t } = Y _ { [ t - 1 ] } \times \mathscr { V }$ and retains the $B$ highest scoring extensions. More formally, at each step the beams are updated as
49
+
50
+ $$
51
+ Y _ { [ t ] } = \operatorname * { a r g m a x } _ { \substack { \mathbf { y } _ { 1 , [ t ] } , \ldots , \mathbf { y } _ { B , [ t ] } \in \mathcal { V } _ { t } } } \sum _ { b \in [ B ] } \Theta ( \mathbf { y } _ { b , [ t ] } ) \ \ldots t . \ \mathbf { y } _ { i , [ t ] } \neq \mathbf { y } _ { j , [ t ] } \ \forall i \neq j .
52
+ $$
53
+
54
+ The above objective can be trivially maximized by sorting all $B \times | \mathcal { V } |$ members of $\mathcal { V } _ { t }$ by their log probabilities and selecting the top $B$ . This process is repeated until time $T$ and the most likely sequence is selected by ranking the $B$ complete beams according to their log probabilities.
55
+
56
+ While this method allows for multiple sequences to be explored in parallel, most completions tend to stem from a single highly valued beam – resulting in outputs that are often only minor perturbations of a single sequence (and typically only towards the end of the sequences).
57
+
58
+ # 3 DIVERSE BEAM SEARCH: FORMULATION AND ALGORITHM
59
+
60
+ To overcome this, we augment the objective in Eq. 1 with a dissimilarity term $\Delta ( Y _ { [ t ] } )$ that measures the diversity between candidate sequences, assigning a penalty $\Delta ( Y _ { [ t ] } ) [ c ]$ to each possible sequence completion $c \in \mathcal V$ . Jointly optimizing this augmented objective for all $B$ candidates at each time step is intractable as the number of possible solutions grows with $| \gamma | ^ { B }$ (easily $1 0 ^ { 6 0 }$ for typical language modeling settings). To avoid this, we opt for a greedy procedure that divides the beam budget $B$ into $G$ groups and promotes diversity between these groups. The approximation is doubly greedy – across both time and groups – so $\Delta ( Y _ { [ t ] } )$ is constant with respect to other groups and we can sequentially optimize each group using regular BS. We now explain the specifics of our approach.
61
+
62
+ Diverse Beam Search. As joint optimization is intractable, we form $G$ smaller groups of beams and optimize them sequentially. Consider a partition of the set of beams $Y _ { [ t ] }$ into $G$ smaller sets $Y _ { [ t ] } ^ { g } , g { \in } [ G ]$ of $B ^ { \prime } = B / G$ beams each (we pick $G$ to divide $B$ ). In the example shown in Fig. 2, $B = 6$ beams are divided into $G = 3$ differently colored groups containing $B ^ { \prime } = 2$ beams each.
63
+
64
+ Considering diversity only between groups, reduces the search space at each time step; however, inference remains intractable. To enforce diversity efficiently, we consider a greedy strategy that steps each group forward in time sequentially while considering the others fixed. Each group can then evaluate the diversity term with respect to the fixed extensions of previous groups, returning the search space to $B ^ { \prime } \times | \mathcal { V } |$ . In the snapshot shown in Fig. 2, the third group is being stepped forward at time step $t = 4$ and the previous groups have already been completed. With this staggered beamfront, the diversity term of the third group can be computed using these completions. Here we use hamming diversity, which adds diversity penalty -1 for each appearance of a possible extension word at the same time step in a previous group – ‘birds’, ‘the’, and ‘an’ in the example – and 0 to all other possible completions. We discuss other forms for the diversity function in Section 5.1.
65
+
66
+ ![](images/5956b1f134b4b09453be0d3d8e6cbba937e5b3fe2aba0ca90f414b51d98be929.jpg)
67
+ Figure 2: Diverse beam search operates left-to-right through time and top to bottom through groups. Diversity between groups is combined with joint log probabilities, allowing continuations to be found efficiently. The resulting outputs are more diverse than for standard approaches.
68
+
69
+ As we optimize each group with the previous groups fixed, extending group $g$ at time $t$ amounts to a standard BS using dissimilarity augmented log probabilities and can be written as:
70
+
71
+ $$
72
+ \begin{array} { r l } { Y _ { [ t ] } ^ { g } } & { = \underset { \mathbf { y } _ { 1 , [ t ] } ^ { g } \dots \mathbf { y } _ { B ^ { \prime } , [ t ] } ^ { g } \in \mathcal { Y } _ { t } ^ { g } } { \mathrm { a r g m a x } } \quad \quad \displaystyle \sum _ { b \in [ B ^ { \prime } ] } \Theta \left( \mathbf { y } _ { b , [ t ] } ^ { g } \right) + \lambda \Delta \left( \underset { h = 1 } { \bigcup ^ { g - 1 } } Y _ { [ t ] } ^ { h } \right) [ y _ { b , t } ^ { g } ] , } \\ & { \quad \quad s . t . \lambda \geq 0 , \mathbf { y } _ { i , [ t ] } ^ { g } \neq \mathbf { y } _ { j , [ t ] } ^ { g } \forall i \neq j } \end{array}
73
+ $$
74
+
75
+ where $\lambda$ is scalar controlling the strength of the diversity term. The full procedure to obtain diverse sequences using our method, Diverse Beam Search (DBS), is presented in Algorithm 1. It consists of two main steps for each group at each time step –
76
+
77
+ 1) augmenting the log probabilities of each possible extension with the diversity term computed from previously advanced groups (Algorithm 1, Line 5) and,
78
+ 2) running one step of a smaller BS with $B ^ { \prime }$ beams using the augmented log probabilities to extend the current group (Algorithm 1, Line 6).
79
+
80
+ Note that the first group $( g = 1 )$ ) is not ‘conditioned’ on other groups during optimization, so our method is guaranteed to perform at least as well as a beam search of size $B ^ { \prime }$ .
81
+
82
+ # Algorithm 1: Diverse Beam Search
83
+
84
+ 1 Perform a diverse beam search with $G$ groups using a beam width of $B$
85
+ 2 for $t = 1$ , . . . $T$ do
86
+ // perform one step of beam search for first group without diversity
87
+ 3 $\begin{array} { r } { Y _ { [ t ] } ^ { 1 } \operatorname { a r g m a x } _ { ( \mathbf { y } _ { 1 , [ t ] } ^ { 1 } , \dots , \mathbf { y } _ { B ^ { \prime } , [ t ] } ^ { 1 } ) } \sum _ { b \in [ B ^ { \prime } ] } \Theta ( \mathbf { y } _ { b , [ t ] } ^ { 1 } ) } \end{array}$
88
+ 4 for $g = 2$ , . . . $G$ do
89
+ 5 $\begin{array} { r } { \Theta ( \mathbf { y } _ { b , [ t ] } ^ { g } ) \Theta ( \mathbf { y } _ { b , [ t ] } ^ { g } ) + \lambda \Delta ( \bigcup _ { h = 1 } ^ { g - 1 } Y _ { [ t ] } ^ { h } ) [ y _ { b , t } ^ { g } ] \quad \ b \in [ B ^ { \prime } ] , \mathbf { y } _ { b , [ t ] } ^ { g } \in \mathcal { Y } _ { t } ^ { g } : } \end{array}$ and $\lambda > 0$
90
+ 6 $Y _ { [ t ] } ^ { g } \overset { \cdot } { } \operatorname { a r g m a x } _ { ( \mathbf { y } _ { 1 , [ t ] } ^ { g } , \ldots , \mathbf { y } _ { B ^ { \prime } , [ t ] } ^ { g } ) } \sum _ { b \in [ B ^ { \prime } ] } \Theta ( \mathbf { y } _ { b , [ t ] } ^ { g } )$ r thes.t. $\mathbf { y } _ { i , [ t ] } \neq \mathbf { y } _ { j , [ t ] } \forall i \neq j$
91
+
92
+ 7 Return set of B solutions, $\begin{array} { r } { Y _ { [ T ] } = \bigcup _ { g = 1 } ^ { G } Y _ { [ T ] } ^ { g } } \end{array}$
93
+
94
+ # 4 RELATED WORK
95
+
96
+ Diverse M-Best Lists. The task of generating diverse structured outputs from probabilistic models has been studied extensively (Park & Ramanan, 2011; Batra et al., 2012; Kirillov et al., 2015; Prasad et al., 2014). Batra et al. (2012) formalized this task for Markov Random Fields as the DivMBest problem and presented a greedy approach which solves for outputs iteratively, conditioning on previous solutions to induce diversity. Kirillov et al. (2015) show how these solutions can be found jointly (non-greedily) for certain kinds of energy functions. The techniques developed by Kirillov are not directly applicable to decoding from RNNs, which do not satisfy the assumptions made.
97
+
98
+ Most related to our proposed approach is the work of Gimpel et al. (2013), who applied DivMBest to machine translation using beam search as a black-box inference algorithm. Specifically, in this approach, DivMBest knows nothing about the inner-workings of BS and simply makes $B$ sequential calls to BS to generate $B$ diverse solutions. This approach is extremely wasteful because BS is called $B$ times, run from scratch every time, and even though each call to BS produces $B$ solutions, only one solution is kept by DivMBest. In contrast, DBS avoids these shortcomings by integrating diversity within BS such that no beams are discarded. By running multiple beam searches in parallel and at staggered time offsets, we obtain large time savings making our method comparable to $a$ single run of classical BS. One potential disadvantage of our method w.r.t. Gimpel et al. (2013) is that sentence-level diversity metrics cannot be incorporated in DBS since no group is complete when diversity is encouraged. However, as observed empirically by us and Li et al. (2015), initial words tend to disproportionally impact the diversity of the resultant sequences – suggesting that later words may not be important for diverse inference.
99
+
100
+ Diverse Decoding for RNNs. Efforts have been made by Li et al. (2015) and Li & Jurafsky (2016) to produce diverse decodings from recurrent models for conversation modeling and machine translation. Both of these works propose new heuristics for creating diverse M-Best lists and employ mutual information to re-rank lists of sequences. The latter achieves a goal separate from ours, which is simply to re-rank diverse lists.
101
+
102
+ Li & Jurafsky (2016) proposes a BS diversification heuristic that discourages beams from sharing common roots, implicitly resulting in diverse lists. Introducing diversity through a modified objective (as in DBS) rather than via a procedural heuristic provides easier generalization to incorporate different notions of diversity and control the exploration-exploitation trade-off as detailed in Section 5.1. Furthermore, we find that DBS outperforms the method of Li & Jurafsky (2016).
103
+
104
+ Li et al. (2015) introduced a novel decoding objective that maximizes mutual information between inputs and predicted outputs to penalize generic sequences. This operates on a principle orthogonal and complementary to DBS and Li & Jurafsky (2016). It works by penalizing utterances that are generally more frequent (diversity independent of input) rather than penalizing utterances that are similar to other utterances produced for the same input (diversity conditioned on input). Furthermore, the input-independent approach requires training a new language model for the target language while DBS just requires a diversity function $\Delta$ . Combination of these complementary techniques is left as interesting future work.
105
+
106
+ In other recent work, Wu et al. (2016) modify the beam search objective by introducing lengthnormalization to favor longer sequences and a coverage penalty that favors sequences that account for the complete input sequence. While the coverage term does not generalize to all neural sequence models, the length-normalization term can be implemented by modifying the joint-log-probability of each sequence. Although the goal of this method is not to produce diverse lists and hence not directly comparable, it is a complementary technique that can be used in conjunction with our diverse decoding method.
107
+
108
+ # 5 EXPERIMENTS
109
+
110
+ In this section, we evaluate our approach on image captioning, machine translation, conversation and visual question generation tasks to demonstrate both its effectiveness against baselines and its general applicability to any inference currently supported by beam search. We also analyze the effects of DBS parameters, explore human preferences for diversity, and discuss diversity’s importance in explaining complex images. We first explain the baselines and evaluations used in this paper.
111
+
112
+ Baselines & Metrics. Apart from classical beam search, we compare DBS with the diverse decoding method proposed in Li & Jurafsky (2016). We also compare against two other complementary decoding techniques proposed in Li et al. (2015) and Wu et al. (2016). Note that these two techniques are not directly comparable with DBS since the goal is not to produce diverse lists. We now provide a brief description of the comparisons mentioned:
113
+
114
+ - Li & Jurafsky (2016): modify BS by introducing an intra-sibling rank. For each partial solution, the set of $| \nu |$ beam extensions are sorted and assigned intra-sibling ranks $k \in \ [ | \nu | ]$ in order of decreasing log probabilities, $\theta _ { t } ( y _ { t } )$ . The log probability of an extension is then reduced in proportion to its rank, and continuations are re-sorted under these modified log probabilities to select the top $B$ ‘diverse’ beam extensions.
115
+
116
+ - Li et al. (2015): train an additional unconditioned target sequence model $U ( \mathbf { y } )$ and perform BS decoding on an augmented objective $P ( \mathbf { y } | x ) - \lambda U ( \mathbf { y } )$ , penalizing input-independent decodings.
117
+
118
+ - $\mathrm { { W u } }$ et al. (2016) modify the beam-search objective by introducing length-normalization that favors longer sequences. The joint log-probability of completed sequences is divided by a factor, $( 5 + | \mathbf { y } | ) ^ { \alpha } / ( 5 + 1 ) ^ { \alpha }$ , where $\alpha \in [ 0 , 1 ]$ .
119
+
120
+ We compare to our own implementations of these methods as none are publicly available. Both Li & Jurafsky (2016) and Li et al. (2015) develop and use re-rankers to pick a single solution from the generated lists. Since we are interested in evaluating the quality of the generated lists and in isolating the gains due to diverse decoding, we do not implement any re-rankers, simply sorting by log-probability.
121
+
122
+ We evaluate the performance of the generated lists using the following two metrics:
123
+
124
+ - Oracle Accuracy: Oracle or top $k$ accuracy w.r.t. some task-specific metric, such as BLEU (Papineni et al., 2002) or SPICE (Anderson et al., 2016), is the maximum value of the metric achieved over a list of $k$ potential solutions. Oracle accuracy is an upper bound on the performance of any re-ranking strategy and thus measures the maximum potential of a set of outputs. - Diversity Statistics: We count the number of distinct n-grams present in the list of generated outputs. Similar to Li et al. (2015), we divide these counts by the total number of words generated to bias against long sentences.
125
+
126
+ Simultaneous improvements in both metrics indicate that output sequences have increased diversity without sacrificing fluency and correctness with respect to target tasks.
127
+
128
+ 5.1 SENSITIVITY ANALYSIS AND EFFECT OF DIVERSITY FUNCTIONS
129
+
130
+ Here we discuss the impact of the number of groups, strength of diversity , and various forms of diversity for language models. Note that the parameters of DBS (and other baselines) were tuned on a held-out validation set for each experiment. The supplement provides further discussion and experimental details.
131
+
132
+ Number of Groups $\mathbf { \Pi } ( \mathbf { G } )$ . Setting $G { = } B$ allows for the maximum exploration of the search space, while setting $G { = } 1$ reduces DBS to BS, resulting in increased exploitation of the search-space around the 1-best decoding. Empirically, we find that maximum exploration correlates with improved oracle accuracy and hence use $G { = } B$ to report results unless mentioned otherwise. See the supplement for a comparison and more details.
133
+
134
+ Diversity Strength $( \lambda )$ . The diversity strength $\lambda$ specifies the trade-off between the model score and diversity terms. As expected, we find that a higher value of $\lambda$ produces a more diverse list; however, very large values of $\lambda$ can overpower model score and result in grammatically incorrect outputs. We set $\lambda$ via grid search over a range of values to maximize oracle accuracies achieved on the validation set. We find a wide range of $\lambda$ values (0.2 to 0.8) work well for most tasks and datasets.
135
+
136
+ Choice of Diversity Function $( \Delta )$ . In Section 3, we defined $\Delta ( \cdot )$ as a function over a set of partial solutions that outputs a vector of dissimilarity scores for all possible beam completions. Assuming that each of the previous groups influences the completion of the current group independently, we can simplify $\Delta ( \bar { \bigcup } _ { h = 1 } ^ { g - 1 } Y _ { [ t ] } ^ { h } )$ as the sum of each group’s contributions as $\bar { \sum _ { h = 1 } ^ { g - 1 } \Delta ( Y _ { [ t ] } ^ { h } ) }$ . In Section 3, we illustrated a simple hamming diversity of this form that penalizes selection of tokens proportionally to the number of time it was used in previous groups. However, this factorized diversity term can take various forms in our model – with hamming diversity being the simplest. For language models, we study the effect of using cumulative (i.e. considering all past time steps), n-gram and neural embedding based diversity functions. Each of these forms encode differing notions of diversity and result in DBS outperforming BS. We find simple hamming distance to be effective and report results based on this diversity measure unless otherwise specified. More details about these forms of the diversity term are provided in the supplementary.
137
+
138
+ # 5.2 IMAGE CAPTIONING
139
+
140
+ Dataset and Models. We evaluate on two datasets – COCO (Lin et al., 2014) and PASCAL-50S (Vedantam et al., 2015). We use the public splits as in Karpathy & Fei-Fei (2015) for COCO. PASCAL-50S is used only for testing (with 200 held out images used to tune hyperparameters). We train a captioning model (Vinyals et al., 2015) using the neuraltalk21 code repository.
141
+
142
+ Results. Table 1 shows Oracle (top $k$ ) SPICE for different values of $k$ . DBS consistently outperforms BS and Li & Jurafsky (2016) on both datasets. We observe that gains on PASCAL-50S are more pronounced $7 . 1 4 \%$ and $4 . 6 5 \%$ SPICE $\textcircled{ a} 2 0$ improvements over BS and Li & Jurafsky (2016)) than COCO. This suggests diverse predictions are especially advantageous when there is a mismatch between training and testing sets, implying DBS may be better suited for real-world applications.
143
+
144
+ Table 1 also shows the number of distinct n-grams produced by different techniques. Our method produces significantly more distinct n-grams (almost $300 \%$ increase in the number of 4-grams produced) as compared to BS. We also note that our method tends to produce slightly longer captions compared on average. Moreover, on the PASCAL-50S test split we observe that DBS finds more likely top-1 solutions on average – DBS obtains an average maximum log probability of -6.53 opposed to -6.91 found by BS of the same beam width. This empirical evidence suggests that using DBS as a replacement to BS may lead to lower inference approximation error.
145
+
146
+ Table 1: Oracle accuracy and distinct n-grams on COCO and PASCAL-50S datasets for image captioning at $B = 2 0$ . While we report SPICE, we observe similar trends in other metrics (reported in supplement).
147
+
148
+ <table><tr><td rowspan="2">Dataset</td><td rowspan="2">Method</td><td colspan="4">Oracle Accuracy (SPICE)</td><td colspan="4">Diversity Statistics</td></tr><tr><td>@1</td><td>@5</td><td>@10</td><td>@20</td><td>distinct-1</td><td>distinct-2</td><td>distinct-3</td><td>distinct-4</td></tr><tr><td rowspan="5">PASCAL-50S</td><td>Beam Search</td><td>4.933</td><td>7.046</td><td>7.949</td><td>8.747</td><td>0.12</td><td>0.57</td><td>1.35</td><td>2.50</td></tr><tr><td>Li &amp; Jurafsky (2016)</td><td>5.083</td><td>7.248</td><td>8.096</td><td>8.917</td><td>0.15</td><td>0.97</td><td>2.43</td><td>5.31</td></tr><tr><td>DBS</td><td>5.357</td><td>7.357</td><td>8.269</td><td>9.293</td><td>0.18</td><td>1.26</td><td>3.67</td><td>7.33</td></tr><tr><td>Wu et al. (2016)</td><td>5.301</td><td>7.322</td><td>8.236</td><td>8.832</td><td>0.16</td><td>1.10</td><td>3.16</td><td>6.45</td></tr><tr><td>Li et al. (2015)</td><td>5.129</td><td>7.175</td><td>8.168</td><td>8.560</td><td>0.13</td><td>1.15</td><td>3.58</td><td>8.42</td></tr><tr><td rowspan="5">COCO</td><td>Beam Search</td><td>16.278</td><td>22.962</td><td>25.145</td><td>27.343</td><td>0.40</td><td>1.51</td><td>3.25</td><td>5.67</td></tr><tr><td>Li &amp; Jurafsky (2016)</td><td>16.351</td><td>22.715</td><td>25.234</td><td>27.591</td><td>0.54</td><td>2.40</td><td>5.69</td><td>8.94</td></tr><tr><td>DBS</td><td>16.783</td><td>23.081</td><td>26.088</td><td>28.096</td><td>0.56</td><td>2.96</td><td>7.38</td><td>13.44</td></tr><tr><td>Wu et al. (2016)</td><td>16.642</td><td>22.643</td><td>25.437</td><td>27.783</td><td>0.54</td><td>2.42</td><td>6.01</td><td>7.08</td></tr><tr><td>Li et al. (2015)</td><td>16.749</td><td>23.271</td><td>26.104</td><td>27.946</td><td>0.42</td><td>1.37</td><td>3.46</td><td>6.10</td></tr></table>
149
+
150
+ Human Studies. To evaluate human preference between captions generated by DBS and BS, we perform a human study via Amazon Mechanical Turk using all 1000 images of PASCAL-50S. For each image, both DBS and standard BS captions are shown to 5 different users. They are then asked – “Which of the two robots understands the image better?” In this forced-choice test, DBS captions were preferred over BS $60 \%$ of the time by human annotators.
151
+
152
+ Is diversity always needed? While these results show that diverse outputs are important for systems that interact with users, is diversity always beneficial? While images with many objects (e.g., a park or a living room) can be described in multiple ways, the same is not true when there are few objects (e.g., a close up of a cat or a selfie). This notion is studied by Ionescu et al. (2016), which defines a “difficulty score”: the human response time for solving a visual search task. On the PASCAL50S dataset, we observe a positive correlation $\zeta \rho = 0 . 7 3 )$ between difficulty scores and humans preferring DBS to BS. Moreover, while DBS is generally preferred by humans for ‘difficult’ images, both are about equally preferred on ‘easier’ images. Details are provided in the supplement.
153
+
154
+ # 5.3 MACHINE TRANSLATION
155
+
156
+ We use the WMT’14 dataset containing $4 . 5 { \mathrm { M } }$ sentences to train our machine translation models. We train stacking LSTM models as detailed in Luong et al. (2015), consisting of 4 layers and 1024- dimensional hidden states. While decoding sentences, we employ the same strategy to replace UNK tokens. We train our models using the publicly available seq2seq-attn2 code repository. We report results on news-test-2013 and news-test-2014 and use the news-test-2012 to tune the parameters of DBS. We use sentence level BLEU scores to compute oracle metrics and report distinct $\mathbf { n }$ -grams similar to image captioning. Results are shown in Table 2 and we again find that DBS consistently outperforms all baselines.
157
+
158
+ Table 2: Quantitative results on English-German translation on the newstest-2013 and newstest-2014 datasets combined (at $B = 2 0$ ).
159
+
160
+ <table><tr><td rowspan="2">Method</td><td colspan="4">Oracle Accuracy (BLEU-4)</td><td colspan="4">Diversity Statistics</td></tr><tr><td>@1</td><td>@5</td><td>@10</td><td>@20</td><td>distinct-1</td><td>distinct-2</td><td>distinct-3</td><td>distinct-4</td></tr><tr><td>Beam Search</td><td>20.5</td><td>22.4</td><td>23.8</td><td>24.2</td><td>0.04</td><td>0.75</td><td>2.10</td><td>3.23</td></tr><tr><td>Li &amp; Jurafsky (2016)</td><td>20.7</td><td>22.6</td><td>24.0</td><td>24.3</td><td>0.04</td><td>0.81</td><td>2.92</td><td>4.61</td></tr><tr><td>DBS</td><td>20.8</td><td>22.9</td><td>24.4</td><td>24.8</td><td>0.06</td><td>0.95</td><td>3.67</td><td>5.54</td></tr><tr><td>Wu et al. (2016)</td><td>20.6</td><td>22.6</td><td>24.3</td><td>24.6</td><td>0.05</td><td>0.88</td><td>2.83</td><td>4.50</td></tr><tr><td>Li et al. (2015)</td><td>20.7</td><td>23.1</td><td>24.4</td><td>24.6</td><td>0.04</td><td>0.86</td><td>2.76</td><td>4.31</td></tr></table>
161
+
162
+ # 5.4 DIALOG GENERATION
163
+
164
+ Dialog generation is a task that is inherently diverse as there are multiple valid ways to respond to a statement. We train a seq2seq model consisting of LSTMs as in Vinyals & Le (2015) on the Cornell Movie Dialogs Corpus (Danescu-Niculescu-Mizil & Lee, 2011) using the neuralconvo3 repository. The training dataset consists of 222,182 conversational exchanges between movie characters. Since automatic evaluation of dialog generation responses is an open research problem with existing metrics being poorly correlated with human judgement (Liu et al., 2016), we show qualitative results to demonstrate the effectiveness of DBS. Table 3 compares BS and DBS at $\scriptstyle \mathrm { B } = 3$ .
165
+
166
+ Table 3: Qualitative examples of dialog generation comparing best-first search, BS and DBS
167
+
168
+ <table><tr><td>Prompt</td><td>Beam Search</td><td>Diverse Beam Search</td></tr><tr><td rowspan="2">Why do you want to be the president?</td><td>I don&#x27;t know. I don&#x27;t know...</td><td>I don&#x27;t know.</td></tr><tr><td>I don&#x27;t know,but Iam the best</td><td>Because you know! Because,I have another life.</td></tr><tr><td rowspan="2">It&#x27;s such a beautiful day!</td><td>I know!</td><td>I know.</td></tr><tr><td>It&#x27;s true.</td><td>Well...</td></tr><tr><td rowspan="2">What&#x27;s your name?</td><td>Yeah. Jacob.</td><td>That&#x27;s not true,honey.</td></tr><tr><td>Berger, my man. Berger, Thomas.</td><td>Jacob. Berger,darling</td></tr></table>
169
+
170
+ # 5.5 VISUAL QUESTION GENERATION
171
+
172
+ We also report results on Visual Question Generation (VQG) (Mostafazadeh et al., 2016), where a model is trained to produce questions about an image. Generating visually focused questions is interesting because it requires reasoning about multiple problems that are central to vision – e.g., object attributes, relationships between objects, and natural language. Furthermore, many questions could make sense for one image, so it is important that lists of generated questions be diverse.
173
+
174
+ We use the VQA dataset (Antol et al., 2015) to train a model similar to image captioning architectures. Instead of captions, the training set now consists of 3 questions per image. Similar to previous results, using beam search to sample outputs results in similarly worded questions (see Fig. 3) and DBS brings out new details captured by the model. Counting the number of types of questions generated (as defined by Antol et al. (2015)) allows us to measure this diversity. We observe that the number of question types generated per image increases from 2.3 for BS to 3.7 for DBS (at $B = 6$ ).
175
+
176
+ # 6 CONCLUSION
177
+
178
+ Beam search is widely a used approximate inference algorithm for decoding sequences from neural sequence models; however, it suffers from a lack of diversity. Producing multiple highly similar and generic outputs is not only wasteful in terms of computation but also detrimental for tasks with
179
+
180
+ ![](images/a0a6e647a739605ab7556bbb6177817a288cd3a8aeb6a5f579e90b1d1debca11.jpg)
181
+
182
+ Figure 3: Qualitative results on Visual Question Generation. DBS generates questions that are non-generic and belong to different question types.
183
+
184
+ inherent ambiguity like many involving language. In this work, we modify Beam Search with a diversity-augmented sequence decoding objective to produce Diverse Beam Search. We develop a ‘doubly greedy’ approximate algorithm to minimize this objective and produce diverse sequence decodings. Our method consistently outperforms beam search and other baselines across all our experiments without extra computation or task-specific overhead. DBS is task-agnostic and can be applied to any case where BS is used, which we demonstrate in multiple domains. Our implementation available at https://github.com/ashwinkalyan/dbs.
185
+
186
+ # REFERENCES
187
+
188
+ Peter Anderson, Basura Fernando, Mark Johnson, and Stephen Gould. Spice: Semantic propositional image caption evaluation. In Proceedings of European Conference on Computer Vision (ECCV), 2016. 6
189
+ Stanislaw Antol, Aishwarya Agrawal, Jiasen Lu, Margaret Mitchell, Dhruv Batra, C Lawrence Zitnick, and Devi Parikh. VQA: Visual question answering. In Proceedings of IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 2425–2433, 2015. 1, 8
190
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. Proceedings of the International Conference on Learning Representations (ICLR), 2014. 1
191
+ Dhruv Batra, Payman Yadollahpour, Abner Guzman-Rivera, and Gregory Shakhnarovich. Diverse M-Best Solutions in Markov Random Fields. In Proceedings of European Conference on Computer Vision (ECCV), 2012. 2, 4
192
+ Cristian Danescu-Niculescu-Mizil and Lillian Lee. Chameleons in imagined conversations: A new approach to understanding coordination of linguistic style in dialogs. In Proceedings of the Workshop on Cognitive Modeling and Computational Linguistics, ACL 2011, 2011. 8
193
+ Francis Ferraro, Ishan Mostafazadeh, Nasrinand Misra, Aishwarya Agrawal, Jacob Devlin, Ross Girshick, Xiadong He, Pushmeet Kohli, Dhruv Batra, and C Lawrence Zitnick. Visual storytelling. Proceedings of the Conference of the North American Chapter of the Association for Computational Linguistics – Human Language Technologies (NAACL HLT), 2016. 2
194
+ Jenny Rose Finkel, Christopher D Manning, and Andrew Y Ng. Solving the problem of cascading errors: Approximate bayesian inference for linguistic annotation pipelines. In Proceedings of the Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 618–626, 2006. 1
195
+ K. Gimpel, D. Batra, C. Dyer, and G. Shakhnarovich. A systematic exploration of diversity in machine translation. In Proceedings of the Conference on Empirical Methods in Natural Language Processing (EMNLP), 2013. 1, 5, 12
196
+ Alex Graves, Abdel-rahman Mohamed, and Geoffrey E. Hinton. Speech recognition with deep recurrent neural networks. abs/1303.5778, 2013. 1
197
+
198
+ Radu Tudor Ionescu, Bogdan Alexe, Marius Leordeanu, Marius Popescu, Dim Papadopoulos, and Vittorio Ferrari. How hard can it be? Estimating the difficulty of visual search in an image. In Proceedings of IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016. 7
199
+
200
+ Anjuli Kannan, Karol Kurach, Sujith Ravi, Tobias Kaufmann, Andrew Tomkins, Balint Miklos, Greg Corrado, László Lukács, Marina Ganea, Peter Young, et al. Smart reply: Automated reeponse suggestion for email. In Proceedings of the ACM SIGKDD Conference on Knowledge Discovery and Data Mining (KDD), 2016. 2
201
+
202
+ Andrej Karpathy and Li Fei-Fei. Deep visual-semantic alignments for generating image descriptions. In Proceedings of IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2015. 2, 7
203
+
204
+ Alexander Kirillov, Bogdan Savchynskyy, Dmitrij Schlesinger, Dmitry Vetrov, and Carsten Rother. Inferring m-best diverse labelings in a single one. In Proceedings of IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2015. 2, 4
205
+
206
+ Jiwei Li and Dan Jurafsky. Mutual information and diverse decoding improve neural machine translation. arXiv preprint arXiv:1601.00372, 2016. 2, 5, 6, 7, 8, 13, 14
207
+
208
+ Jiwei Li, Michel Galley, Chris Brockett, Jianfeng Gao, and Bill Dolan. A diversity-promoting objective function for neural conversation models. Proceedings of the Conference of the North American Chapter of the Association for Computational Linguistics – Human Language Technologies (NAACL HLT), 2015. 2, 5, 6, 7, 8, 13, 14
209
+
210
+ Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollar, and C. Lawrence Zitnick. Microsoft COCO: Common objects in context, 2014. 7
211
+
212
+ Chia-Wei Liu, Ryan Lowe, Iulian Vlad Serban, Michael Noseworthy, Laurent Charlin, and Joelle Pineau. How NOT to evaluate your dialogue system: An empirical study of unsupervised evaluation metrics for dialogue response generation. 2016. URL http://arxiv.org/abs/1603. 08023. 8
213
+
214
+ Minh-Thang Luong, Hieu Pham, and Christopher D Manning. Effective approaches to attentionbased neural machine translation. arXiv preprint arXiv:1508.04025, 2015. 7
215
+
216
+ 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 (NIPS), 2013. 12
217
+
218
+ Nasrin Mostafazadeh, Ishan Misra, Jacob Devlin, Margaret Mitchell, Xiaodong He, and Lucy Vanderwende. Generating natural questions about an image. Proceedings of the Annual Meeting on Association for Computational Linguistics (ACL), 2016. 8
219
+
220
+ Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. Bleu: a method for automatic evaluation of machine translation. In Proceedings of the Annual Meeting on Association for Computational Linguistics (ACL), 2002. 6
221
+
222
+ Dennis Park and Deva Ramanan. N-best maximal decoders for part models. In Proceedings of IEEE International Conference on Computer Vision (ICCV), 2011. 4
223
+
224
+ Adarsh Prasad, Stefanie Jegelka, and Dhruv Batra. Submodular meets structured: Finding diverse subsets in exponentially-large structured item sets. In Advances in Neural Information Processing Systems (NIPS), 2014. 2, 4
225
+
226
+ Ramakrishna Vedantam, C Lawrence Zitnick, and Devi Parikh. Cider: Consensus-based image description evaluation. In Proceedings of IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2015. 7
227
+
228
+ Subhashini Venugopalan, Marcus Rohrbach, Jeffrey Donahue, Raymond Mooney, Trevor Darrell, and Kate Saenko. Sequence to sequence-video to text. In Proceedings of IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 4534–4542, 2015. 1
229
+
230
+ Oriol Vinyals and Quoc Le. A neural conversational model. arXiv preprint arXiv:1506.05869, 2015. 1, 8
231
+
232
+ Oriol Vinyals, Alexander Toshev, Samy Bengio, and Dumitru Erhan. Show and tell: A neural image caption generator. In Proceedings of IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2015. 1, 2, 7
233
+
234
+ Yonghui Wu, Mike Schuster, Zhifeng Chen, Quoc V Le, Mohammad Norouzi, Wolfgang Macherey, Maxim Krikun, Yuan Cao, Qin Gao, Klaus Macherey, et al. Google’s neural machine translation system: Bridging the gap between human and machine translation. arXiv preprint arXiv:1609.08144, 2016. 5, 6, 7, 8, 13, 14
235
+
236
+ # APPENDIX
237
+
238
+ SENSIVITY STUDIES
239
+
240
+ Number of Groups. Fig. 4 presents snapshots of the transition from BS to DBS at $B = 6$ and $G = \{ 1 , 3 , 6 \}$ . As beam width moves from 1 to $G$ , the exploration of the method increases resulting in more diverse lists.
241
+
242
+ ![](images/556736eb871c5bae6f8e4101360fb2a4fb9a43d36b74e6a03d44b1d63a05f8f0.jpg)
243
+
244
+ Figure 4: Effect of increasing the number of groups $G$ . The beams that belong to the same group are colored similarly. Recall that diversity is only enforced across groups such that $G = 1$ corresponds to classical BS.
245
+
246
+ Diversity Strength. As noted in Section 5.1, our method is robust to a wide range of values of the diversity strength $( \lambda )$ . Fig. 5a shows a grid search of $\lambda$ for image-captioning on the PASCAL-50S dataset.
247
+
248
+ Choice of Diversity Function. The diversity function can take various forms ranging from simple hamming diversity to neural embedding based diversity. We discuss some forms for language modelling below:
249
+
250
+ - Hamming Diversity. This form penalizes the selection of tokens used in previous groups proportional to the number of times it was selected before.
251
+ - Cumulative Diversity. Once two sequences have diverged sufficiently, it seems unnecessary and perhaps harmful to restrict that they cannot use the same words at the same time. To encode this ‘backing-off’ of the diversity penalty we introduce cumulative diversity which keeps a count of identical words used at every time step, indicative of overall dissimilarity. Specifically, $\begin{array} { r } { \Delta ( Y _ { [ t ] } ^ { h } ) [ y _ { [ t ] } ^ { g } ] = \exp \{ - \big ( \sum _ { \tau \in t } \sum _ { b \in B ^ { \prime } } I \big [ y _ { b , \tau } ^ { h } \neq y _ { b , \tau } ^ { g } ] \big ) / \Gamma \} } \end{array}$ where $\Gamma$ is a temperature parameter controlling the strength of the cumulative diversity term and $I [ \cdot ]$ is the indicator function.
252
+ - $n$ -gram Diversity. The current group is penalized for producing the same n-grams as previous groups, regardless of alignment in time – similar to Gimpel et al. (2013). This is proportional to the number of times each $\mathbf { n }$ -gram in a candidate occurred in previous groups. Unlike hamming diversity, n-grams capture higher order structures in the sequences.
253
+ - Neural-embedding Diversity. While all the previous diversity functions discussed above perform exact matches, neural embeddings such as word2vec (Mikolov et al., 2013) can penalize semantically similar words like synonyms. This is incorporated in each of the previous diversity functions by replacing the hamming similarity with a soft version obtained by computing the cosine similarity between word2vec representations. When using with n-gram diversity, the representation of the n-gram is obtained by summing the vectors of the constituent words.
254
+
255
+ Each of these various forms encode different notions of diversity. Hamming diversity ensures different words are used at different times, but can be circumvented by small changes in sequence alignment. While n-gram diversity captures higher order statistics, it ignores sentence alignment. Neural-embedding based encodings can be seen as a semantic blurring of either the hamming or n-gram metrics, with word2vec representation similarity propagating diversity penalties not only to exact matches but also to close synonyms. Fig. 5b shows the oracle performace of various forms of the diversity function described in Section 5.1. We find that using any of the above functions help outperform BS in the tasks we examine; hamming diversity achieves the best oracle performance despite its simplicity.
256
+
257
+ # IMAGE CAPTIONING EVALUATION
258
+
259
+ While we report oracle SPICE values in the paper, our method consistently outperforms baselines and classical BS on other standard metrics such as CIDEr (Table 4), METEOR (Table 5) and ROUGE (Table 6). We provide these additional results in this section.
260
+
261
+ ![](images/ea97b6acbd398b4c75fa8a982a70103fc8074070dad4bb764dd796b23c52143e.jpg)
262
+ Figure 5: Fig. 5a shows the results of a grid search of the diversity strength $( \lambda )$ parameter of DBS on the validation split of PASCAL 50S dataset. We observe that it is robust for a wide range of values. Fig. 5b compares the performance of multiple forms for the diversity function $( \Delta )$ . While naïve diversity performs the best, other forms are comparable while being better than BS.
263
+
264
+ Table 4: CIDEr Oracle accuracy on COCO and PASCAL-50S datasets for image captioning at $B = 2 0$ .
265
+
266
+ <table><tr><td>Dataset</td><td>Method</td><td colspan="4">Oracle Accuracy (CIDEr)</td></tr><tr><td></td><td></td><td>@1</td><td>@5</td><td>@10</td><td>@20</td></tr><tr><td rowspan="5">PASCAL-50S</td><td>Beam Search</td><td>53.79</td><td>83.94</td><td>96.70</td><td>107.63</td></tr><tr><td>Li &amp; Jurafsky (2016)</td><td>54.61</td><td>85.21</td><td>99.80</td><td>110.64</td></tr><tr><td>DBS</td><td>57.82</td><td>89.38</td><td>103.75</td><td>113.43</td></tr><tr><td>Wu et al. (2016)</td><td>47.77</td><td>72.12</td><td>84.64</td><td>105.66</td></tr><tr><td>Li et al. (2015)</td><td>49.80</td><td>81.35</td><td>96.87</td><td>107.37</td></tr><tr><td rowspan="5">COCO</td><td>Beam Search</td><td>87.27</td><td>121.74</td><td>133.46</td><td>140.98</td></tr><tr><td>Li &amp; Jurafsky (2016)</td><td>91.42</td><td>111.33</td><td>116.94</td><td>119.14</td></tr><tr><td>DBS</td><td>86.88</td><td>123.38</td><td>135.68</td><td>142.88</td></tr><tr><td>Wu et al. (2016)</td><td>87.54</td><td>122.06</td><td>133.21</td><td>139.43</td></tr><tr><td>Li et al. (2015)</td><td>88.18</td><td>124.20</td><td>138.65</td><td>150.06</td></tr></table>
267
+
268
+ Table 5: METEOR Oracle accuracy on COCO and PASCAL-50S datasets for image captioning at $B = 2 0$
269
+
270
+ <table><tr><td>Dataset</td><td>Method</td><td colspan="4">Oracle Accuracy (METEOR)</td></tr><tr><td></td><td></td><td>@1</td><td>@5</td><td>@10</td><td>@20</td></tr><tr><td rowspan="4">PASCAL-50S</td><td>Beam Search</td><td>12.24</td><td>16.74</td><td>19.14</td><td>21.22</td></tr><tr><td>Li &amp; Jurafsky (2016)</td><td>13.52</td><td>17.65</td><td>19.91</td><td>21.76</td></tr><tr><td>DBS</td><td>13.71</td><td>18.45</td><td>20.67</td><td>22.83</td></tr><tr><td>Wu et al. (2016)</td><td>13.34</td><td>17.20</td><td>18.98</td><td>21.13</td></tr><tr><td rowspan="5">COCO</td><td>Li et al. (2015)</td><td>13.04</td><td>17.92</td><td>19.73</td><td>22.32</td></tr><tr><td>Beam Search</td><td>24.81</td><td>28.56</td><td>30.59</td><td>31.87</td></tr><tr><td>Li &amp; Jurafsky (2016)</td><td>24.88</td><td>29.10</td><td>31.44</td><td>33.56</td></tr><tr><td>DBS</td><td>25.04</td><td>29.67</td><td>33.25</td><td>35.42</td></tr><tr><td>Wu et al. (2016)</td><td>24.82</td><td>28.92</td><td>31.53</td><td>34.14</td></tr><tr><td></td><td>Li et al. (2015)</td><td>24.93</td><td>30.11</td><td>32.34</td><td>34.88</td></tr></table>
271
+
272
+ Modified SPICE evaluation. To measure both the quality and the diversity of the generated captions, we compute SPICE-score by comparing the graph union of all the generated hypotheses with the ground truth scene graph. This measure rewards all the relevant relations decoded as against oracle accuracy that compares to relevant relations present only in the top-scoring caption. We observe that DBS outperforms both baselines under this measure with a score of 18.345 as against a score of 16.988 (beam search) and 17.452 (Li & Jurafsky, 2016).
273
+
274
+ Table 6: ROUGE Oracle accuracy on COCO and PASCAL-50S datasets for image captioning at $B = 2 0$
275
+
276
+ <table><tr><td>Dataset</td><td>Method</td><td colspan="4">Oracle Accuracy (ROUGE-L)</td></tr><tr><td></td><td></td><td>@1</td><td>@5</td><td>@10</td><td>@20</td></tr><tr><td rowspan="4">PASCAL-50S</td><td>Beam Search</td><td>45.23</td><td>56.12</td><td>59.61</td><td>62.04</td></tr><tr><td>Li &amp; Jurafsky (2016)</td><td>46.21</td><td>56.17</td><td>60.15</td><td>62.95</td></tr><tr><td>DBS</td><td>46.24</td><td>56.90</td><td>60.35</td><td>63.02</td></tr><tr><td>Wu et al. (2016)</td><td>43.73</td><td>52.29</td><td>56.49</td><td>61.65</td></tr><tr><td rowspan="5">COCO</td><td>Li et al. (2015)</td><td>44.12</td><td>54.67</td><td>57.34</td><td>60.11</td></tr><tr><td>Beam Search</td><td>52.46</td><td>58.43</td><td>62.56</td><td>65.14</td></tr><tr><td>Li &amp; Jurafsky (2016)</td><td>52.87</td><td>59.89 60.89</td><td>63.45</td><td>65.42</td></tr><tr><td>DBS</td><td>53.04</td><td></td><td>64.24</td><td>67.72</td></tr><tr><td>Wu et al. (2016) Li et al. (2015)</td><td>52.13 53.10</td><td>58.26 59.32</td><td>62.89 63.04</td><td>65.77 66.19</td></tr></table>
277
+
278
+ # HUMAN STUDIES
279
+
280
+ For image-captioning, we conduct a human preference study between BS and DBS captions as explained in Section 5. A screen shot of the interface used to collect human preferences for captions generated using DBS and BS is presented in Fig. 6. The lists were shuffled to guard the task from being gamed by a turker.
281
+
282
+ Table 7: Frequency table for image difficulty and human preference for DBS captions on PASCAL50S dataset
283
+
284
+ <table><tr><td>difficulty score bin range</td><td>#images</td><td>% images DBS was preffered</td></tr><tr><td>≤μ-σ</td><td>481</td><td>50.51%</td></tr><tr><td>[μ-σ,μ+σ]</td><td>409</td><td>69.92%</td></tr><tr><td>≥μ+σ</td><td>110</td><td>83.63%</td></tr></table>
285
+
286
+ As mentioned in Section 5, we observe that difficulty score of an image and human preference for DBS captions are positively correlated. The dataset contains more images that are less difficulty and so, we analyze the correlation by dividing the data into three bins. For each bin, we report the $\%$ of images for which DBS captions were preferred after a majority vote (i.e. at least 3/5 turkers voted in favor of DBS) in Table 7. At low difficulty scores consisting mostly of iconic images – one might expect that BS would be preferred more often than chance. However, mismatch between the statistics of the training and testing data results in a better performance of DBS. Some examples for this case are provided in Fig. 7. More general qualitative examples are provided in Fig. 8.
287
+
288
+ # DISCUSSION
289
+
290
+ Are longer sentences better? Many recent works propose a scoring or a ranking objective that depends on the sequence length. These favor longer sequences, reasoning that they tend to have more details and resulting in improved accuracies. We measure the correlation between length of a sequence and its accuracy (here, SPICE) and observe insignificant correlation between SPICE and sequence length. On the PASCAL-50S dataset, we find that BS and DBS have are negatively correlated ${ \mathrm { \Delta } } \rho = - 0 . 0 0 3$ and $\rho = - 0 . 0 1 5$ respectively), while (Li & Jurafsky, 2016) is correlated positively $\zeta = 0 . 0 0 2 )$ . Length is not correlated with performance in this case.
291
+
292
+ Efficient utilization of beam budget. In this experiment, we emperically show that DBS makes efficient use of the beam budget in exploring the search space for better solutions. Fig. 9 shows the variation of oracle SPICE $( \ @ \mathbf { B } )$ with the beam size. At really high beam widths, all decoding techniques achieve similar oracle accuracies. However, diverse decoding techniques like DBS achieve the same oracle at much lower beam widths. Hence, DBS not only produces sequence lists that are significantly different but also efficiently utilizes the beam budget to decode better solutions.
293
+
294
+ # Instructions
295
+
296
+ # Which of the two robots understands the image better?
297
+
298
+ Two robots are shown an image.They both make 5 guesses each for describing the image with a single sentence.
299
+
300
+ Which robot do you think is more intellgent or uman-like displaying a better understanding of the image?
301
+
302
+ ![](images/662dc603494fb0f0a451658ae4e0c273db83b292b1f52a884fc7756064dc03cb.jpg)
303
+ Note: Select the radio button above the set of captions that you pick.
304
+ Figure 6: Screen-shot of the interface used to perform human studies
305
+
306
+ ![](images/62aa5f9e25d94974a1969061c1a3754f7e38d4142f17f0d79c955450596c86d6.jpg)
307
+
308
+ # Beam Search
309
+
310
+ A man riding a motorcycle on a dirt road A man riding a motorcycle on a beach A man riding a motorcycle on the side of a road A man riding a bike on a dirt road A man riding a motorcycle on the side of the road A man riding a motorcycle on the side of a beach
311
+
312
+ # Diverse Beam Search
313
+
314
+ A man riding a motorcycle on a beach
315
+ A man riding abike on a dirt road
316
+ A man riding a bike on a dirt road
317
+ A man on a motorcycle is flying a kite
318
+ A person on a skateboard riding on the side of a road
319
+ A person on a bicycle with a helmet on on the ground
320
+
321
+ Difficulty Score : 2.8308
322
+
323
+ ![](images/77403f71019e18c04f4f1a6720d4a5cc1c89577890e2881d56f41bc788761f27.jpg)
324
+ Difficulty Score :2.9287
325
+
326
+ # Beam Search
327
+
328
+ A black bear standing in a grassy field A black bear standing in a field of grass A black bear is standing in the grass A black bear is standing in a field A black bear standing in the grass next to a tree A black bear standing in the grass near a fence
329
+
330
+ # Diverse Beam Search
331
+
332
+ # A black dog is standing in the grass A black dog is standing in the grass
333
+
334
+ A black bear walking through a grassy field A black bear walking ina field of grass A black and white dog is standing in the grass A black bear standing in the grass near a fence
335
+
336
+ Difficulty Score :2.8999
337
+
338
+ # Beam Search
339
+
340
+ A close up of a bowl of broccoli A close up of a plate of broccoli A close up of a broccoli plant on a table Aclose up of a bowl of broccoli on a table A close up of a broccoli plant in a garden A close up of a plate of broccoli and cauliflower
341
+
342
+ ![](images/b066fe5f4248b97c1b655d251233ccf7a81c79004631b695b39d783bfb1cbbe8.jpg)
343
+ Figure 7: For images with low difficulty score, BS captions are preferred to DBS – as show in the first figure. However, we observe that DBS captions perform better when there is a mismatch between the statistics of the testing and training sets. Interesting captions are colored in blue for readability.
344
+
345
+ # Diverse Beam Search
346
+
347
+ Aclose up of a bowl of broccoli Aclose up of a plate of broccoli and broccoli A green plant with a green plant in it A green plant with a bunch of green leaves A white plate topped with broccoli and a plant A small green plant with a green plant in it
348
+
349
+ ![](images/4b1f21718dfbe05f9421ad7e3a2d6c2c85f0d31c7f6d33e3643ef377219dcbb5.jpg)
350
+ Difficulty Score : 5.4382
351
+
352
+ # Beam Search
353
+
354
+ A group of people sitting at a table with laptops A group of people sitting at a table A couple of people that are sitting at a table A group of people sitting around a table with laptops A group of people sitting at a table in front of laptops A group of people sitting at a table with a laptop
355
+
356
+ # Diverse Beam Search
357
+
358
+ A group of people sitting at a table with laptops A group of people sitting at a table with laptops A group of people sitting around a table with laptops A group of people are sitting at a table Two people sitting at a table with laptops Three people are siting at a table with laptops
359
+
360
+ ![](images/30135864d55d2af3015cf71afa6f0c1390585b3ec4aae52f68046d295327111e.jpg)
361
+ Difficulty Score : 4.1815
362
+
363
+ # Beam Search
364
+
365
+ A woman sitting in front of a laptop computer A woman sitting at a table with a laptop A woman sitting at a table with a laptop computer A woman is working on a laptop computer A woman siting at a desk with a laptop computer A woman is sitting at a table with a laptop
366
+
367
+ # Diverse Beam Search
368
+
369
+ A woman sitting at a table with a laptop computer A woman is working on a laptop computer A woman is sitting at a table with a laptop A man sitting at a desk with a laptop computer A woman in a kitchen with a laptop computer A man is sitting at a table with a laptop and a computer
370
+
371
+ ![](images/2e49b474bdeec252ee0c8fd4ca955890a4b6e467353d29d34401fb1dd843d6f0.jpg)
372
+ Difficulty Score : 3.8146
373
+
374
+ # Beam Search
375
+
376
+ A wooden table topped with plates of food A table with plates of food on it A wooden table topped with plates and bowls of food A table that hasa bunch of plates on it A wooden table topped with plates of food and glasses A wooden table topped with plates of food and cups
377
+
378
+ # Diverse Beam Search
379
+
380
+ A table with a plate of food and a glass of wine A table with a plate of food and a glass A table with plates of food and a glass of wine A dining table with a plate of food and a glass of wine A table with a bowl of food and a bowl of soup on it A dining room table with a plate of food and a glass of wine on it
381
+
382
+ Figure 8: For images with a high difficulty score, captions produced by DBS are preferred to BS. Interesting captions are colored in blue for readability.
383
+
384
+ ![](images/65ed921c683ee3a93446aacd14516bad30606979e9db87e3bf875653961e6660.jpg)
385
+ Figure 9: As the number of beams increases, all decoding methods tend to achieve about the same oracle accuracy. However, diverse decoding techniques like DBS utilize the beam budget efficiently achieving higher oracle accuracies at much lower beam budgets.
md/train/HJWGdbbCW/HJWGdbbCW.md ADDED
@@ -0,0 +1,299 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # REINFORCEMENT AND IMITATION LEARNING FOR DIVERSE VISUOMOTOR SKILLS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ We propose a general deep reinforcement learning method and apply it to robot manipulation tasks. Our approach leverages demonstration data to assist a reinforcement learning agent in learning to solve a wide range of tasks, mainly previously unsolved. We train visuomotor policies end-to-end to learn a direct mapping from RGB camera inputs to joint velocities. Our experiments indicate that our reinforcement and imitation approach can solve contact-rich robot manipulation tasks that neither the state-of-the-art reinforcement nor imitation learning method can solve alone. We also illustrate that these policies achieved zero-shot sim2real transfer by training with large visual and dynamics variations.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Recent advances in deep reinforcement learning (RL) have performed very well in several challenging domains such as video games (Mnih et al., 2015) and Go (Silver et al., 2016). For robotics, RL in combination with powerful function approximators provides a general framework for designing sophisticated controllers that would be hard to handcraft otherwise. Yet, despite significant leaps in other domains the application of deep RL to control and robotic manipulation has proven challenging. While there have been successful demonstrations of deep RL for manipulation (e.g. Nair et al. 2017; Popov et al. 2017) and also noteworthy applications on real robotic hardware (e.g. Levine et al. 2015; Yahya et al. 2016) there have been very few examples of learned controllers for sophisticated tasks even in simulation.
12
+
13
+ Robotics exhibits several unique challenges. These include the need to rely on multi-modal and partial observations from noisy sensors, such as cameras. At the same time, realistic tasks often come with a large degree of variation (visual appearance, position, shapes, etc.) posing significant generalization challenges. Training on real robotics hardware can be daunting due to constraints on the amount of training data that can be collected in reasonable time. This is typically much less than the millions of frames needed by modern algorithms. Safety considerations also play an important role, as well as the difficulty of accessing information about the state of the environment (like the position of an object) e.g. to define a reward. Even in simulation when perfect state information and large amounts of training data are available, exploration can be a significant challenge. This is partly due to the often high-dimensional and continuous action space, but also due to the difficulty of designing suitable reward functions.
14
+
15
+ In this paper, we present a general deep reinforcement learning method that addresses these issues and that can solve a wide range of robot arm manipulation tasks directly from pixels, most of which have not been solved previously. Our key insight is 1) to reduce the difficulty of exploration in continuous domains by leveraging a handful of human demonstrations; 2) several techniques to stabilize the learning of complex manipulation policies from vision; and 3) to improve generalization by increasing the diversity of the training conditions. As a result, the trained policies work well under significant variations of system dynamics, object appearances, task lengths, etc. We ground these policies in the real world, demonstrating zero-shot transfer from simulation to real hardware.
16
+
17
+ We develop a new method to combine imitation learning with reinforcement learning. Our method requires only a small number of human demonstrations to dramatically simplify the exploration problem. It uses demonstration data in two ways: first, it uses a hybrid reward that combines sparse environment reward with imitation reward based on Generative Adversarial Imitation Learning (Ho & Ermon, 2016), which produces more robust controllers; second, it uses demonstration as a curriculum to initiate training episodes along demonstration trajectories, which facilitates the agent to reach new states and solve longer tasks. As a result, it solves dexterous manipulation tasks that neither the state-of-the-art reinforcement learning nor imitation learning method can solve alone.
18
+
19
+ ![](images/3da1dcf2a407228cf883b16987f42fe9cbfef255dde0766f2788e3e98e48d9b5.jpg)
20
+ Figure 1: Our proposal of a principled robot learning pipeline. We used 3D motion controllers to collect human demonstrations of a task. Our reinforcement and imitation learning model leveraged these demonstrations to facilitate learning in a simulated physical engine. We then performed sim2real transfer to deploy the learned visuomotor policy to a real robot.
21
+
22
+ Previous RL-based robot manipulation policies (Nair et al., 2017; Popov et al., 2017) largely rely on low-level states as input, or use severely limited action spaces that ignore the arm and instead learn Cartesian control of a simple gripper. This limits the ability of these methods to represent and solve more complex tasks (e.g., manipulating arbitrary 3D objects) and to deploy in real environments where the privileged state information is unavailable. Our method learns an end-to-end visuomotor policy that maps RGB camera observations to joint space control over the full 9-DoF arm (6 arm joints plus 3 actuated fingers).
23
+
24
+ To sidestep the constraints of training on real hardware we embrace the sim2real paradigm which has recently shown promising results (James et al., 2017; Rusu et al., 2016a). Through the use of a physics engine and high-throughput RL algorithms, we can simulate parallel copies of a robot arm to perform millions of complex physical interactions in a contact-rich environment while eliminating the practical concerns of robot safety and system reset. Furthermore, we can, during training, exploit privileged information about the true system state with several new techniques, including learning policy and value in separate modalities, an object-centric GAIL discriminator, and auxiliary tasks for visual modules. These techniques stabilize and speed up policy learning from pixels.
25
+
26
+ Finally, we diversify training conditions such as visual appearance as well as e.g. the size and shape of objects. This improves both generalization with respect to different task conditions as well as transfer from simulation to reality.
27
+
28
+ To demonstrate our method, we use the same model and the same algorithm for visuomotor control of six diverse robot arm manipulation tasks. Combining reinforcement and imitation, our policies solve the tasks that the state-of-the-art reinforcement and imitation learning cannot solve and outperform human demonstrations. Our approach sheds light on a principled deep visuomotor learning pipeline illustrated in Fig. 1, from collecting real-world human demonstration to learning in simulation, and back to real-world deployment via sim2real policy transfer.
29
+
30
+ # 2 RELATED WORK
31
+
32
+ Reinforcement learning methods have been extensively used with low-dimensional policy representations such as movement primitives to solve a variety of control problems both in simulation and in reality. Three classes of RL algorithms are currently dominant for continuous control problems: guided policy search methods (GPS; Levine & Koltun 2013), value-based methods such as the deterministic policy gradient (DPG; Silver et al. 2014; Lillicrap et al. 2016; Heess et al. 2015) or the normalized advantage function (NAF; Gu et al. 2016b) algorithm, and trust-region based policy gradient algorithms such as trust region policy optimization (TRPO) and proximal policy optimization (PPO). TRPO (Schulman et al., 2015) and PPO (Schulman et al., 2017) hold appeal due to their robustness to hyper-parameter settings as well as their scalability (Heess et al., 2017) but the lack of sample efficiency makes them unsuitable for training directly on robotics hardware.
33
+
34
+ GPS (Levine & Koltun, 2013) has been used e.g. by Levine et al. (2015) and Yahya et al. (2016) to learn visuomotor policies directly on a real robotics hardware after a network pretraining phase. Gupta et al. (2016) and Kumar et al. (2016) use GPS for learning controllers for robotic hand models. Value-based methods have been employed, e.g. by Gu et al. (2016a) who use NAF to learn a door opening task directly on a robot while Popov et al. (2017) demonstrate how to solve a stacking problem efficiently using a distributed variant of DPG.
35
+
36
+ The idea of using large-scale data collection for training visuomotor controllers has been the focus of Levine et al. (2016) and Pinto & Gupta (2015) who train a convolutional network to predict grasp success for diverse sets of objects using a large dataset with 10s or 100s of thousands of grasp attempts collected from multiple robots in a self-supervised setting.
37
+
38
+ An alternative strategy for dealing with the data demand is to train in simulation and transfer the learned controller to real hardware, or to augment real-world training with synthetic data. Rusu et al. (2016b) learn simple visuomotor policies for a Jaco robot arm and transfer to reality using progressive networks (Rusu et al. 2016a). Viereck et al. (2017) minimize the reality gap by relying on depth. Tobin et al. (2017) use visual variations to learn robust object detectors that can transfer to reality; James et al. (2017) combine randomization with supervised learning. Bousmalis et al. (2017) augments the training with simulated data to learn grasp prediction of diverse shapes.
39
+
40
+ Suitable cost functions and exploration strategies for control problems are challenging to design, so demonstrations have long played an important role. Demonstrations can be used to initialize policies, design cost functions, guide exploration, augment the training data, or a combination of these. Cost functions can be derived from demonstrations either via tracking objectives (e.g. Gupta et al. 2016) or, via inverse RL (e.g. Boularias et al. 2011; Finn et al. 2016), or, as in our case, via adversarial learning (Ho & Ermon, 2016). When expert actions or expert policies are available, behavioral cloning or DAgger can be used (Rahmatizadeh et al. 2017; James et al. 2017; Duan et al. 2017). Alternatively, expert trajectories can be used as additional training data for off-policy algorithms such as DPG (e.g. Vecerik et al. 2017). Most of these methods require observation and/or action spaces to be aligned between robot and demonstrations. Recently, methods for third person imitation have been proposed (e.g. Sermanet et al. 2017; Liu et al. 2017; Finn et al. 2017).
41
+
42
+ Concurrently with our work several papers have presented results on manipulation tasks. Rajeswaran et al. (2017); Nair et al. (2017) both use human demonstrations to aid exploration. Nair et al. (2017) extends the DDPGfD algorithm (Vecerik et al., 2017) to learn a block stacking task on a position-controlled arm in simulation. Rajeswaran et al. (2017) use the demonstrations with a form of behavioral cloning and data augmentation to learn several complex manipulation tasks. In both cases, controllers observe a low-dimensional state space representation and the methods inherently require aligned state and action spaces with the demonstrations. Pinto et al. (2017) and Peng et al. (2017) address the transfer from simulation to reality, focusing on randomizing visual appearance and robot dynamics respectively. Peng et al. transfer a block-pushing policy operating from state features to a 7-DoF position controlled Fetch robotics arm. Pinto et al. consider different tasks using visual input with end-effector position control.
43
+
44
+ # 3 MODEL
45
+
46
+ Our goal is to learn a deep visuomotor policy for robot manipulation tasks. The policy takes both an RGB camera observation and a proprioceptive feature that describes the joint positions and angular velocities. These two sensory modalities are also available on the real robot, enabling us to perform zero-shot policy transfer once trained in simulation. Fig. 2 provides an overview of our model. The deep visuomotor policy encodes the pixel observation with a convolutional network (CNN) and the proprioceptive feature with a multilayer perceptron (MLP). The features from these two modules are concatenated and passed to a recurrent LSTM layer before producing the joint velocities. The whole network is trained end-to-end. We start with a brief review of the basics of generative adversarial imitation learning (GAIL) and proximal policy optimization (PPO). Our model extends upon these two methods for visuomotor skills.
47
+
48
+ ![](images/1631fa6f9bf52330c1120085322dc3e3cd32e7871d2a6cfc35443316773b4738.jpg)
49
+ Figure 2: Model overview. The core of our model is the deep visuomotor policy, which takes the camera observation and the proprioceptive feature as input and produces the next joint velocities.
50
+
51
+ # 3.1 BACKGROUND: GAIL AND PPO
52
+
53
+ Imitation learning $\left( \operatorname { I L } \right)$ is the problem of learning a behavior policy by mimicking a set of demonstrations. Here we assume that human demonstration is provided as a dataset of state-action pairs $\mathcal { D } = \{ ( s _ { i } , a _ { i } ) \} _ { i = 1 \ldots N }$ . Traditional $\mathrm { I L }$ methods cast it as a supervised learning problem, i.e., behavior cloning. These methods use maximum likelihood to train a parameterized policy $\pi _ { \theta } : { \mathcal { S } } A$ , where $s$ is the state space and $\mathcal { A }$ is the action space, such that $\begin{array} { r } { \theta ^ { * } = \arg \operatorname* { m a x } _ { \theta } \sum _ { N } \log \pi _ { \theta } ( a _ { i } | s _ { i } ) } \end{array}$ . The behavior cloning approach works effectively in cases when the demonstrations abound (Ross et al., 2011). However, as robot demonstrations can be costly and time-consuming, we are in favor of a method that can learn from a handful of demonstrations. GAIL (Ho & Ermon, 2016) makes a more efficient use of demonstration data by allowing the agent to interact with the environment and learn from its own experiences. Similar to Generative Adversarial Networks (Goodfellow et al., 2014), GAIL has two networks, a policy network $\pi _ { \theta } : { \mathcal { S } } A$ and a discriminator network $D _ { \psi } : \mathcal { S } \times \mathcal { A } [ 0 , 1 ]$ . GAIL uses a similar min-max objective function as in GANs:
54
+
55
+ $$
56
+ \operatorname* { m i n } _ { \psi } \theta \operatorname* { m a x } _ { \psi } \mathbb { E } _ { \pi _ { E } } [ \log D _ { \psi } ( s , a ) ] + \mathbb { E } _ { \pi _ { \theta } } [ \log ( 1 - D _ { \psi } ( s , a ) ) ] ,
57
+ $$
58
+
59
+ where $\pi _ { E }$ denotes the expert policy that generated the demonstration trajectories. This learning objective encourages the policy $\pi _ { \theta }$ to have an occupancy measure close to the expert policy $\pi _ { E }$ .
60
+
61
+ In practice, we train $\pi _ { \theta }$ with policy gradient methods to maximize the discounted sum of the reward function $r _ { g a i l } ( s _ { t } , a _ { t } ) = - \log ( 1 - D _ { \psi } ( s _ { t } , a _ { t } ) )$ , clipped by a max value of 10. In continuous domains, trust region methods greatly stabilize policy training. The original GAIL model uses TRPO (Schulman et al., 2015) in the policy update steps. Recently, PPO (Schulman et al., 2017) is proposed as a simple and scalable approximation to TRPO. PPO only relies on the first-order gradients and can be easily implemented with recurrent networks in a distributed setting (Heess et al., 2017). The key idea of PPO is to use the Kullback-Leibler (KL) divergence to dynamically change the coefficient of a regularization term, where the coefficient is adapted based on whether the previous policy update step violates the KL constraint. We use distributed PPO to perform data collection and synchronous gradient updates across many workers in parallel. We trained all our policies with 256 CPU workers, which brings a significant speedup in wall-clock time.
62
+
63
+ # 3.2 REINFORCEMENT AND IMITATION LEARNING MODEL
64
+
65
+ # 3.2.1 HYBRID IL/RL REWARD
66
+
67
+ A common approach to guiding exploration is by engineering a shaping reward. Although reward shaping sometimes provides informative guidance for policy search, it has the well-known drawback of producing suboptimal behaviors $\mathrm { N g }$ et al., 1999). Hence, we use sparse piecewise constant rewards in this work. Training agents in continuous domains under sparse rewards is particularly challenging. Inspired by reward augmentation introduced in Li et al. 2017 and Merel et al. 2017, we design a hybrid reward function to mix the imitation reward $r _ { g a i l }$ with the sparse task reward $r _ { t a s k }$ :
68
+
69
+ $$
70
+ r ( s _ { t } , a _ { t } ) = \lambda r _ { g a i l } ( s _ { t } , a _ { t } ) + ( 1 - \lambda ) r _ { t a s k } ( s _ { t } , a _ { t } ) \quad \lambda \in [ 0 , 1 ] .
71
+ $$
72
+
73
+ Maximizing this hybrid reward can be interpreted as simultaneous reinforcement and imitation learning, where the imitation reward encourages the policy to generate trajectories closer to demonstration trajectories, and the task reward encourages the policy to achieve high returns in the task. Setting $\lambda$ to either 0 or 1 reduces this method to the standard RL or GAIL setups. Our experiments suggest that with a balanced contribution of these two rewards, the agents can solve tasks that neither GAIL nor RL can solve alone. Further, the final agents achieved higher returns than the human demonstrations owing to the exposure to task rewards.
74
+
75
+ # 3.2.2 LEVERAGING PHYSICAL STATES IN SIMULATION
76
+
77
+ The use of simulated system provides us access to the underlying physical states. Even though such privileged information is unavailable on a real system, we can take advantage of it when training the policy in simulation. We propose four techniques to leverage the physical states in simulation to stabilize and accelerate learning, including demonstration curriculum, learning value from states, building object-centric discriminator, and auxiliary tasks.
78
+
79
+ Demonstration as a curriculum. The problem of exploration in continuous domains is exacerbated by the long duration of realistic tasks. Previous work indicates that shaping the distribution of start states towards states where the optimal policy tends to visit can greatly improve policy learning (Kakade & Langford, 2002; Popov et al., 2017). We alter the start state distribution with demonstration states. We build a curriculum that contains clusters of states in different stages of a task. For instance, we define three clusters for the pouring task, including reaching the mug, grasping the mug, and pouring. For a training episode, with probability $\epsilon$ we start it from a random initial state, and with probability $1 - \epsilon$ we uniformly select a cluster and reset the episode to a demonstration state from the cluster. This is possible as our simulated system is fully characterized by the physical states.
80
+
81
+ Learning value functions from states. PPO uses a learnable value function $V _ { \phi }$ to estimate the advantage for policy gradient. During training, each PPO worker executes the policy for $K$ steps and uses the discounted sum of rewards and the value as an advantage function estimator $\hat { A } _ { t } \overset { \cdot } { = }$ $\begin{array} { r } { \sum _ { i = 1 } ^ { K } \gamma ^ { i - 1 } r _ { t + i } + \gamma ^ { K - 1 } V _ { \phi } ( s _ { t + K } ) - V _ { \phi } ( s _ { t } ) , } \end{array}$ , where $\gamma$ is the discount factor. As the policy gradient relies on the value function to reduce variance, it is beneficial to accelerate learning of the value function. Rather than using pixel inputs as the policy network, we take advantage of the low-level physical states (e.g., the position and velocity of the 3D objects and the robot arm) to train the value $V _ { \phi }$ with a smaller multilayer perceptron. We find that training the policy and value in two different modalities stabilizes training and reduces oscillation in the agent’s performance. This technique has also been adopted by a concurrent work by Pinto et al. 2017.
82
+
83
+ Object-centric discriminator. Similar to the value function, the GAIL discriminator leverages the physical states to construct task-specific features as its input. In manipulation tasks, we find that object-centric representations (e.g., absolute and relative positions of the objects) provide the salient and relevant signals to the discriminator. The states of the robot arm, on the contrary, tend to make the discriminator too strong and stagnate the training of the policy. Inspired by information hiding strategies used in locomotion domains (Heess et al., 2016; Merel et al., 2017), our discriminator only takes the object-centric features as input while masking out arm-related information.
84
+
85
+ State prediction auxiliary tasks. Auxiliary tasks have been shown effective in improving the learning efficiency and the final performance of deep RL methods (Jaderberg et al., 2016). To facilitate learning visuomotor policies, we add a state prediction layer on the top of the CNN module to predict the locations of objects from the camera observation. We use a fully-connected layer to regress the 3D coordinates of objects in the task. We train this auxiliary task by minimizing the $\ell _ { 2 }$ loss between the predicted and ground-truth object locations.
86
+
87
+ # 3.2.3 SIM2REAL POLICY TRANSFER
88
+
89
+ Policy transfer is shown to a real-world Kinova Jaco robot arm. The simulation was manually aligned to generally match the visuals and dynamics: a Kinect camera was visually calibrated to match the position and orientation of the simulated camera, and the simulation’s dynamics parameters were manually adjusted to match the dynamics of the real arm. Instead of using professional calibration equipment, our approach to sim2real policy transfer relies on domain randomization of camera position and orientation (Tobin et al., 2017; James et al., 2017). in contrast, we do not create intermediate position goals using object position information in reality, but rather train an end-to-end, pixels to velocities, feedback control policy. In addition, to alleviate the issues caused by latency on the real robot, we also fine-tune our policies while subjecting them to action dropping. Detailed descriptions are available in Appendix B.
90
+
91
+ # 4 EXPERIMENTS
92
+
93
+ Here we demonstrate that our proposed approach offers a general framework to visuomotor policy learning. We evaluate the performance of our model in six manipulation tasks illustrated in Fig. 3. We provide more qualitative results in this video.
94
+
95
+ # 4.1 ENVIRONMENT SETUP
96
+
97
+ We use a Kinova Jaco arm that has 9 degrees of freedom, including six arm joints and three actuated fingers. The robot arm interacts with a diverse set of objects on a tabletop. The visuomotor policy controls the robot using joint velocity commands. Our policy produces 9-dimensional continuous velocities in the range of $[ - 1 , 1 ]$ at $2 0 \mathrm { H z }$ . The proprioceptive features consist of the positions and angular velocities of the arm joints and the fingers. We use a positioned camera to collect real-time RGB observations. The proprioceptive features and the camera observations are available in both simulation and real environments. Thus, it enables policy transfer.
98
+
99
+ We use the MuJoCo physics simulator (Todorov et al., 2012) as our training platform. We use a large variety of objects, from basic geometric shapes to procedurally generated 3D objects as ensembles of primitive shapes. We increase the diversity of objects by randomizing various physical properties, including dimension, color, mass, friction, etc. We used a 3D motion controller called SpaceNavigator, which allows us to operate the robot arm with a position controller, to collect 30 episodes of demonstration for each task and recorded the observations, actions, and physical states into a dataset. As each episode takes less than a minute to complete, demonstrating each task can be done within half an hour.
100
+
101
+ # 4.2 ROBOT ARM MANIPULATION TASKS
102
+
103
+ Fig. 3 shows visualizations of the six manipulation tasks in our experiments. The first column shows the six tasks in simulated environments, and the second column shows the real-world setup of the block lifting and stacking tasks. We see obvious visual discrepancies of the same task in simulation and reality. These six tasks exhibit learning challenges to varying degrees. The first three tasks use simple colored blocks, which allows us to easily construct the tasks for a real robot. We study sim2real policy transfer with the block lifting and stacking tasks in Sec. 4.4.
104
+
105
+ Block lifting. The goal is to grasp and lift a randomized block, allowing us to evaluate the model’s robustness. We vary several random factors, including the robot arm dynamics (friction and armature), lighting conditions, camera poses, background colors, as well as the properties of the block. Each episode starts with a new configuration with these random factors uniformly drawn from a preset range.
106
+
107
+ Block stacking. The goal is to stack one block on top of the other block. Together with the block lifting task, this is evaluated in sim2real transfer experiments.
108
+
109
+ Clearing blocks. This task aims at clearing the tabletop that has two blocks. One strategy to do this task using a single arm is to stack the blocks and pick up both together. This task requires longer time and a more dexterous controller, introducing a significant challenge for exploration.
110
+
111
+ The next three tasks involve a large variety of procedurally generated 3D shapes, making them difficult to recreate in real environments. We use them to examine the model’s ability to generalize across object variations in long and complex tasks.
112
+
113
+ ![](images/500c4e82d7c70a53a90aba7e6097cefcf2952fcef850a953da75af3119384acf.jpg)
114
+ Figure 3: Visualizations of the six manipulation tasks in our experiments. The left column shows RGB images of all six tasks in the simulated environments. These images correspond to the actual pixel observations as input to the visuomotor policies. The right column shows the two tasks with color blocks on the real robot.
115
+
116
+ Clearing tabletop. In this task, the goal is to clear the tabletop that has a box and a toy car. One strategy is to grasp the toy, put it into the box, and lift the box. Both the box and the toy car are randomly generated for each episode.
117
+
118
+ Pouring liquid. Modeling and reasoning about deformable objects and fluids is a long-standing challenge in the robotics community (Schenck & Fox, 2017). We design a pouring task where we use many small spheres to simulate liquid. The goal is to pour the “liquid” from one mug to the other container. This task is particularly challenging due to the dexterity required. Even trained humans struggled to demonstrate the task with our 3D motion controller.
119
+
120
+ Order fulfillment. In this task, we randomly place a variable number of procedurally generated toy planes and cars on the table. The goal is to place all the planes into the green box and all the cars into the red box. This task requires the policy to generalize at an abstract level. It needs to recognize the object categories, perform successful grasps on diverse shapes, and handle tasks with variable lengths.
121
+
122
+ # 4.3 QUANTITATIVE EVALUATION
123
+
124
+ Our full model can solve all six tasks, with only occasional failures, using the same policy network, the same training algorithm, and a fixed set of hyperparameters. On the contrary, neither reinforcement nor imitation alone can solve all tasks. We compare the full model with three baseline methods, where we evaluate degenerated versions of our model, which correspond to RL, GAIL, and RL w/o demonstration curriculum. These baselines use the same setup as the full model, except that we set $\lambda = 0$ for RL and $\lambda = 1$ for GAIL, while our model uses a balanced contribution of the hybrid reward, where $\lambda = 0 . 5$ . In the third baseline, all the training episodes start from random initial states rather than resetting to demonstration states. This corresponds to a standard RL setup.
125
+
126
+ We report the mean episode returns as a function of the number of training iterations in Fig. 4. Our full model achieves the highest returns in all six tasks. The only case where the baseline model is on par with the full model is the block lifting task, in which both the RL baseline and the full model achieved similar levels of performance. We hypothesize that this is due to the short length of the lifting task, where random exploration in RL is likely to reach the goal states without the aid of GAIL.
127
+
128
+ ![](images/f42db9c29d42cf74a7da404a6d76c2b791f22b99a1f70b41c8fa2f490e715488.jpg)
129
+ Figure 4: Learning efficiency of our reinforcement and imitation model against baselines. The plots are averaged over 5 runs with different random seeds. All the policies use the same network architecture and the same hyperparameters (except $\lambda$ ).
130
+
131
+ ![](images/44c129be75f9308aefc493276536f020f20acf69c3de0ed33d53b3c232e1476a.jpg)
132
+ Figure 5: Model analysis in the stacking task. On the left we investigate the impact on performance by removing each individual component from the full model. On the right we investigate the model’s sensitivity to the hyperparameter $\lambda$ that moderates the contribution of reinforcement and imitation.
133
+
134
+ In the other five tasks, the full model outperforms both the reinforcement learning and imitation learning baselines by a large margin, demonstrating the effectiveness of combining reinforcement and imitation for learning complex tasks. Comparing the two variants of RL with and without using demonstration as a curriculum, we see a pronounced effect of altering the start state distribution. We see that RL from scratch leads to a very slow learning progress; while initiating episodes along demonstration trajectories enables the agent to train on states from different stages of a task. As a result, it greatly reduces the burden of exploration and improves the learning efficiency. We also report the mean episode returns of human demonstrations in these figures. While demonstrations using the 3D motion controller are imperfect, especially for pouring (see video), the trained agents can surpass them via interacting with the environment.
135
+
136
+ Two findings are noteworthy. First, the RL agent learns faster than the full model in the table clearing task, but the full model eventually outperforms. This is because the full model discovers a novel strategy, different from the strategy demonstrated by human operators (see video). In this case, imitation gave contradictory signals but eventually, reinforcement learning guided the policy towards a better strategy. Second, pouring liquid is the only task where GAIL outperforms its RL counterpart. Imitation can effectively shape the agent’s behaviors towards the demonstration trajectories (Wang et al., 2017). This is a viable solution for the pouring task, where a controller that generates similar-looking behaviors can complete the task. In contact-rich domains, however, a controller learned solely from dozens of demonstrations would struggle to handle complex object dynamics and to infer the true task goal. We hypothesize that this is why the baseline RL agent outperforms the GAIL agent in the other five tasks.
137
+
138
+ We further perform an ablation study in the block stacking task to understand the impacts of different components of our model. In Fig. 5a, we trained our agents with a number of configurations, each with a single modification to the full model. We see that the final performances of the experiments cluster into two groups: agents that learn to stack (with average returns greater than 400) and agents that only learn to lift (with average returns between 200 and 300). These results indicate that the hybrid RL/IL reward, learning value function from states, and object-centric discriminator play an integral role in learning good policies. Using sole RL or GAIL reward, learning value function on pixels, or no information hiding for discriminator input (no discriminator mask) all result in inferior performances. In contrast, the optional components include the recurrent policy core (LSTM), the use of state prediction auxiliary tasks, and whether to include actions in discriminator input. We then examine the model’s sensitivity to the $\lambda$ values in Eq. 2. We see in Fig. 5b that, our model works well with a broad range of $\lambda$ values from 0.3 to 0.7 that provide a balanced mix of the RL and GAIL rewards.
139
+
140
+ # 4.4 SIM2REAL POLICY TRANSFER RESULTS
141
+
142
+ To assess the robustness of the simulation-trained policy, we evaluate zero-shot transfer (no additional training) on a real Jaco arm. Given a real-world set up that mirrored the simulated domain to a large extent, including camera positions and robot kinematics and approximate object size and color, we ran the trained network policy and counted the number of successful trials for both the lifting and stacking tasks. Although the sim and real domains were similar, there was still a sizable reality gap that made zero-shot transfer challenging. For example, the objects were non-rigid foam blocks which deformed and bounced unpredictably. The arm position was randomly initialized and the target block(s) placed in a number of repeatable start configurations for each task. The zero-shot transfer of the lifting policy had a success rate of $6 4 \%$ over 25 trials (split between 5 block configurations). The stacking policy had a success rate of $3 5 \%$ over 20 trials (split between 2 block configurations). $8 0 \%$ of the stacking trajectories, however, contain successful lifting behavior. Qualitatively, the policies are notably robust even on failed attempts — rather than exhibiting “open-loop” behaviors such as attempting to stack a non-existent block, the policy repeatedly chases the block to get a successful grasp before trying to stack (see video). For more detailed descriptions of the sim2real results, refer to Appendix B.
143
+
144
+ # 5 CONCLUSION
145
+
146
+ We have shown that combining reinforcement and imitation learning considerably improves the agents’ ability to solve challenging dexterous manipulation tasks from pixels. Our proposed method sheds light on the three stages of a principled pipeline for robot skill learning: first, we collected a small amount of demonstration data to simplify the exploration problem; second, we relied on physical simulation to perform large-scale distributed robot training; and third, we performed sim2real transfer for real-world deployment. In future work, we seek to improve the sample efficiency of the learning method and to leverage real-world experience to close the reality gap for policy transfer.
147
+
148
+ # REFERENCES
149
+
150
+ Abdeslam Boularias, Jens Kober, and Jan Peters. Relative entropy inverse reinforcement learning. In JMLR Workshop and Conference Proceedings Volume 15: AISTATS 2011, pp. 182–189, Cambridge, MA, USA, April 2011. MIT Press.
151
+
152
+ Konstantinos Bousmalis, Alex Irpan, Paul Wohlhart, Yunfei Bai, Matthew Kelcey, Mrinal Kalakrishnan, Laura Downs, Julian Ibarz, Peter Pastor, Kurt Konolige, Sergey Levine, and Vincent Vanhoucke. Using Simulation and Domain Adaptation to Improve Efficiency of Deep Robotic Grasping. ArXiv e-prints, 2017.
153
+
154
+ Yan Duan, Marcin Andrychowicz, Bradly C. Stadie, Jonathan Ho, Jonas Schneider, Ilya Sutskever, Pieter Abbeel, and Wojciech Zaremba. One-shot imitation learning. CoRR, abs/1703.07326, 2017. URL http://arxiv.org/abs/1703.07326.
155
+
156
+ Chelsea Finn, Sergey Levine, and Pieter Abbeel. Guided cost learning: Deep inverse optimal control via policy optimization. In Proceedings of the 33nd International Conference on Machine Learning, ICML 2016, New York City, NY, USA, June 19-24, 2016, pp. 49–58, 2016. URL http://jmlr.org/proceedings/papers/v48/finn16.html.
157
+
158
+ Chelsea Finn, Tianhe Yu, Tianhao Zhang, Pieter Abbeel, and Sergey Levine. One-Shot Visual Imitation Learning via Meta-Learning. ArXiv e-prints, 2017.
159
+
160
+ 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.
161
+
162
+ Shixiang Gu, Ethan Holly, Timothy P. Lillicrap, and Sergey Levine. Deep reinforcement learning for robotic manipulation. CoRR, abs/1610.00633, 2016a.
163
+
164
+ Shixiang Gu, Tim Lillicrap, Ilya Sutskever, and Sergey Levine. Continuous deep q-learning with model-based acceleration. In International Conference on Machine Learning (ICML), 2016b.
165
+
166
+ Abhishek Gupta, Clemens Eppner, Sergey Levine, and Pieter Abbeel. Learning dexterous manipulation for a soft robotic hand from human demonstration. CoRR, abs/1603.06348, 2016.
167
+
168
+ Nicolas Heess, Gregory Wayne, David Silver, Tim Lillicrap, Tom Erez, and Yuval Tassa. Learning continuous control policies by stochastic value gradients. In Advances in Neural Information Processing Systems (NIPS), pp. 2926–2934, 2015.
169
+
170
+ Nicolas Heess, Greg Wayne, Yuval Tassa, Timothy Lillicrap, Martin Riedmiller, and David Silver. Learning and transfer of modulated locomotor controllers. arXiv preprint arXiv:1610.05182, 2016.
171
+
172
+ Nicolas Heess, Srinivasan Sriram, Jay Lemmon, Josh Merel, Greg Wayne, Yuval Tassa, Tom Erez, Ziyu Wang, Ali Eslami, Martin Riedmiller, et al. Emergence of locomotion behaviours in rich environments. arXiv preprint arXiv:1707.02286, 2017.
173
+
174
+ Jonathan Ho and Stefano Ermon. Generative adversarial imitation learning. In Advances in Neural Information Processing Systems, pp. 4565–4573, 2016.
175
+
176
+ 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.
177
+
178
+ Stephen James, Andrew J. Davison, and Edward Johns. Transferring end-to-end visuomotor control from simulation to real world for a multi-stage task. CoRR, abs/1707.02267, 2017.
179
+
180
+ Sham Kakade and John Langford. Approximately optimal approximate reinforcement learning. In ICML, 2002.
181
+
182
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
183
+
184
+ Vikash Kumar, Abhishek Gupta, Emanuel Todorov, and Sergey Levine. Learning dexterous manipulation policies from experience and imitation. CoRR, abs/1611.05095, 2016. URL http: //arxiv.org/abs/1611.05095.
185
+
186
+ Sergey Levine and Vladlen Koltun. Guided policy search. In International Conference on Machine Learning (ICML), pp. 1–9, 2013.
187
+
188
+ Sergey Levine, Chelsea Finn, Trevor Darrell, and Pieter Abbeel. End-to-end training of deep visuomotor policies. CoRR, abs/1504.00702, 2015.
189
+
190
+ Sergey Levine, Peter Pastor, Alex Krizhevsky, and Deirdre Quillen. Learning hand-eye coordination for robotic grasping with deep learning and large-scale data collection. CoRR, abs/1603.02199, 2016.
191
+
192
+ Yunzhu Li, Jiaming Song, and Stefano Ermon. Inferring the latent structure of human decisionmaking from raw visual inputs. arXiv preprint arXiv:1703.08840, 2017.
193
+
194
+ 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 (ICLR), 2016.
195
+
196
+ Yuxuan Liu, Abhishek Gupta, Pieter Abbeel, and Sergey Levine. Imitation from observation: Learning to imitate behaviors from raw video via context translation. CoRR, abs/1707.03374, 2017.
197
+
198
+ Josh Merel, Yuval Tassa, Dhruva TB, Sriram Srinivasan, Jay Lemmon, Ziyu Wang, Greg Wayne, and Nicolas Heess. Learning human behaviors from motion capture by adversarial imitation. CoRR, abs/1707.02201, 2017.
199
+
200
+ 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.
201
+
202
+ Ashvin Nair, Bob McGrew, Marcin Andrychowicz, Wojciech Zaremba, and Pieter Abbeel. Overcoming exploration in reinforcement learning with demonstrations. CoRR, abs/1709.10089, 2017.
203
+
204
+ Andrew Y Ng, Daishi Harada, and Stuart J Russell. Policy invariance under reward transformations: Theory and application to reward shaping. In ICML, pp. 278–287, 1999.
205
+
206
+ Xue Bin Peng, Marcin Andrychowicz, Wojciech Zaremba, and Pieter Abbeel. Sim-to-Real Transfer of Robotic Control with Dynamics Randomization. ArXiv e-prints, October 2017.
207
+
208
+ Lerrel Pinto and Abhinav Gupta. Supersizing self-supervision: Learning to grasp from 50k tries and 700 robot hours. CoRR, abs/1509.06825, 2015. URL http://arxiv.org/abs/1509. 06825.
209
+
210
+ Lerrel Pinto, Marcin Andrychowicz, Peter Welinder, Wojciech Zaremba, and Pieter Abbeel. Asymmetric Actor Critic for Image-Based Robot Learning. ArXiv e-prints, 2017.
211
+
212
+ Ivaylo Popov, Nicolas Heess, Timothy P. Lillicrap, Roland Hafner, Gabriel Barth-Maron, Matej Vecerik, Thomas Lampe, Yuval Tassa, Tom Erez, and Martin A. Riedmiller. Data-efficient deep reinforcement learning for dexterous manipulation. CoRR, abs/1704.03073, 2017.
213
+
214
+ Rouhollah Rahmatizadeh, Pooya Abolghasemi, Ladislau Bol¨ oni, and Sergey Levine. Vision-based ¨ multi-task manipulation for inexpensive robots using end-to-end learning from demonstration. CoRR, abs/1707.02920, 2017. URL http://arxiv.org/abs/1707.02920.
215
+
216
+ 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, 2017.
217
+
218
+ Stephane Ross, Geoffrey J Gordon, and Drew Bagnell. A reduction of imitation learning and struc- ´ tured prediction to no-regret online learning. In International Conference on Artificial Intelligence and Statistics, pp. 627–635, 2011.
219
+
220
+ Andrei Rusu, Neil Rabinowitz, Guillaume Desjardins, Hubert Soyer, James Kirkpatrick, Koray Kavukcuoglu, Razvan Pascanu, and Raia Hadsell. Progressive neural networks. arXiv preprint arXiv:1606.04671, 2016a.
221
+
222
+ Andrei Rusu, Matej Vecerik, Thomas Rothorl, Nicolas Heess, Razvan Pascanu, and Raia Hadsell.¨ Sim-to-real robot learning from pixels with progressive nets. CoRR, abs/1610.04286, 2016b.
223
+
224
+ Connor Schenck and Dieter Fox. Reasoning about liquids via closed-loop simulation. arXiv preprint arXiv:1703.01656, 2017.
225
+
226
+ 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.
227
+
228
+ John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
229
+
230
+ Pierre Sermanet, Corey Lynch, Jasmine Hsu, and Sergey Levine. Time-contrastive networks: Selfsupervised learning from multi-view observation. CoRR, abs/1704.06888, 2017.
231
+
232
+ David Silver, Guy Lever, Nicolas Heess, Thomas Degris, Daan Wierstra, and Martin Riedmiller. Deterministic policy gradient algorithms. In International Conference on Machine Learning (ICML), 2014.
233
+
234
+ 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.
235
+
236
+ Joshua 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. CoRR, abs/1703.06907, 2017.
237
+
238
+ Emanuel Todorov, Tom Erez, and Yuval Tassa. Mujoco: A physics engine for model-based control. In Intelligent Robots and Systems (IROS), 2012 IEEE/RSJ International Conference on, pp. 5026– 5033. IEEE, 2012.
239
+
240
+ 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.
241
+
242
+ Ulrich Viereck, Andreas ten Pas, Kate Saenko, and Robert Platt. Learning a visuomotor controller for real world robotic grasping using easily simulated depth images. CoRR, abs/1706.04652, 2017.
243
+
244
+ Ziyu Wang, Josh Merel, Scott E. Reed, Greg Wayne, Nando de Freitas, and Nicolas Heess. Robust imitation of diverse behaviors. NIPS, abs/1707.02747, 2017.
245
+
246
+ Ali Yahya, Adrian Li, Mrinal Kalakrishnan, Yevgen Chebotar, and Sergey Levine. Collective robot reinforcement learning with distributed asynchronous guided policy search. CoRR, abs/1610.00673, 2016. URL http://arxiv.org/abs/1610.00673.
247
+
248
+ # A EXPERIMENT DETAILS
249
+
250
+ The policy network takes the pixel observation and the proprioceptive feature as input. The pixel observation is an RGB image of size $6 4 \times 6 4 \times 3$ . We used the Kinect for Xbox One camera in the real environment. The proprioceptive feature describes the joint positions and velocities of the Kinova Jaco arm. Each joint position is represented as the sin and cos of the angle of the joint in joint coordinates. Each joint velocity is represented as the scalar angular velocity. This results in a 24-dimensional proprioceptive feature that contains the positions (12-d) and velocities (6-d) of the six arm joints and the positions (6-d) of the three fingers. We exclude the finger velocities due to the noisy sensory readings on the real robot.
251
+
252
+ We used Adam (Kingma & Ba, 2014) to train the neural network parameters. We set the learning rate of policy and value to $1 0 ^ { - 4 }$ and $1 0 ^ { - 3 }$ respectively, and $1 0 ^ { - 4 }$ for both the discriminator and the auxiliary tasks. The pixel observation is encoded by a two-layer convoluational network. We use 2 convolutional layers followed by a fully-connected layer with 128 hidden units. The first convolutional layer has $1 6 8 \times 8$ filters with stride 4 and the second $3 2 4 \times 4$ filters with stride 2. We add a recurrent layer of 100 LSTM units before the policy and value outputs. The policy output is the mean and the standard deviation of a conditional Gaussian distribution over the 9-dimensional joint velocities. The initial policy standard deviation is set to $\exp ( - 3 )$ for the clearing table with blocks task and $\exp ( - 1 )$ for the other five tasks. The auxiliary head of the policy contains a separate 3-layer MLP sitting on top of the convolutional network. The first two layers of the MLP has 200 and 100 hidden units respectively, while the third layer predicts the auxiliary outputs. Finally, the discriminator is a simple three-layer MLP of 100 and 64 hidden units for the first two layers with the third layer producing log probabilities. The networks use tanh nonlinearities.
253
+
254
+ We trained the visuomotor policies using the distributed PPO algorithm (Heess et al., 2017) with synchronous gradient updates from 256 CPU workers. Each worker runs the policy to complete an entire episode before the parameter updates are computed. We set a constant episode length for each task based on its difficulty, with the longest being 1000 time steps (50 seconds) for the clearing table with blocks and order fulfillment tasks. We set $K = 5 0$ as the number of time steps for computing $K$ -step returns and truncated backpropagation through time to train the LSTM units. After a worker collects a batch of data points, it performs 50 parameter updates for the policy and value networks, 5 for the discriminator and 5 for the auxiliary prediction network.
255
+
256
+ # B SIM2REAL DETAILS
257
+
258
+ To better facilitate sim2real transfer, we lower the frequency at which we sample the observations. Pixel observations are only observed at the rate of $5 \mathrm { H z }$ despite the fact that our controller runs at $2 0 \mathrm { H z }$ . Similarly, the proprioceptive features are observed at a rate of $1 0 \mathrm { H z }$ . In addition to observation delays, we also apply domain variations. Gaussian noise (of standard deviation 0.01) are added proprioceptive features. Uniform integers noise in the range of $[ - 5 , 5 ]$ are added to each pixel independently. Pixels of values outside the range of $[ 0 , 2 5 5 ]$ are clipped. We also vary randomly the shade of grey on the Jaco arm, the color of the table top, as well as the location and orientation of the light source (see Fig. 6).
259
+
260
+ In the case of block lifting, we vary in addition the dynamics of the arm. Specifically, we dynamically change the friction, damping, armature, and gain parameters of the robot arm in simulation to further robustify the agent’s performance.
261
+
262
+ # B.1 ACTION DROPPING
263
+
264
+ Our analysis indicates that, on the real robot, there is often a delay in the execution of actions. The amount of delay also varies significantly. This has an adverse effect on the performance of our agent on the physical robot since our agents’ performance depends on the timely execution of their actions. To better facilitate the transfer to the real robot, we fine-tune our trained agent in simulation while subjecting them to a random chance of dropping actions. Specifically, each action emitted by the agent has a $5 0 \%$ chance of being executed immediately in which case the action is flagged as the last executed action. If the current action is not executed, the last executed action will then be executed.
265
+
266
+ ![](images/6321f7405a110f1a781e4aefa1233f51f25d6f8eddd6d6a79a9b9948ef2629cc.jpg)
267
+ Figure 6: Tiles show the representative range of diversity seen in the domain-randomized variations of the colors, lighting, background, etc.
268
+
269
+ Table 1: Block Lifting success rate from different positions. (LL, LR, UL, UR, and C represents the positions of lower left, lower right, upper left, upper right, and center respectively.)
270
+
271
+ <table><tr><td></td><td>LL</td><td>LR</td><td>UL</td><td>UR</td><td>C</td><td>All</td></tr><tr><td>No Action Dropping</td><td>2/5</td><td>2/5</td><td>1/5</td><td>3/5</td><td>4/5</td><td>12/25</td></tr><tr><td>Action Dropping</td><td>4/5</td><td>4/5</td><td>4/5</td><td>0/5</td><td>4/5</td><td>16/25</td></tr></table>
272
+
273
+ Using the above procedure, we fine-tune our agents on both block lifting and block stacking for a further 2 million iterations.
274
+
275
+ To demonstrate the effectiveness of action dropping, we compare our agent on the real robot over the task of block lifting. Without action dropping, the baseline agent lifts $4 \bar { 8 } \%$ percent of the time. After fine-tuning using action dropping, our agent succeeded $6 4 \%$ percent of the time. For the complete set of results, please see Table 1 and Table 2.
276
+
277
+ # C TASK DETAILS
278
+
279
+ We use a fixed episode length for each task, which is determined by the amount of time a skilled human demonstrator can complete the task. An episode terminates when a maximum number of agent steps are performed. The robot arm operates at a control frequency of $2 0 \mathrm { H z }$ , which means each time step takes 0.05 second.
280
+
281
+ We segment into a sequence of stages that represent an agent’s progress in a task. For instance, the block stacking task can be characterized by three stages, including reaching the block, lifting the block and stacking the block. We define functions on the underlying physical state to determine the stage of a state. This way, we can cluster demonstration states according to their corresponding stages. These clusters are used to reset training episodes in our demonstration as a curriculum technique proposed in Sec. 3.2.2. The definition of stages also gives rise to a convenient way of specifying the reward functions without hand-engineering a shaping reward. We define a piecewise constant reward function for each task, where we assign the same constant reward to all the states that belong to the same stage. We detail the stages, reward functions, auxiliary tasks, and objectcentric features for the six tasks in our experiments.
282
+
283
+ Block lifting. Each episode lasts 100 time steps. We define three stages and their rewards (in parentheses) to be initial (0), reaching the block (0.125) and lifting the block (1.0). The auxiliary task is to predict the 3D coordinates of the color block. The object-centric feature consists of the relative position between the gripper and the block.
284
+
285
+ Block stacking. Each episode lasts 500 time steps. We define four stages and their rewards to be initial (0), reaching the orange block (0.125), lifting the orange block (0.25), and stacking the orange block onto the pink block (1.0). The auxiliary task is to predict the 3D coordinates of the two blocks.
286
+
287
+ Table 2: Success rate of the block stacking agent from different starting positions. Left and Right indicates the position of the support block upon initialization.
288
+
289
+ <table><tr><td></td><td>Left</td><td>Right</td><td>All</td></tr><tr><td>Stacking Success Rate</td><td>5/10</td><td>2/10</td><td>7/20</td></tr><tr><td>Lifting Success Rate</td><td>9/10</td><td>7/10</td><td>16/20</td></tr></table>
290
+
291
+ The object-centric feature consists of the relative positions between the gripper and the two blocks respectively.
292
+
293
+ Clearing table with blocks. Each episode lasts 1000 time steps. We define five stages and their rewards to be initial (0), reaching the orange block (0.125), lifting the orange block (0.25), stacking the orange block onto the pink block (1.0), and lifting both blocks off the ground (2.0). The auxiliary task is to predict the 3D coordinates of the two blocks. The object-centric feature consists of the 3D positions of the two blocks as well as the relative positions between the gripper and the two blocks respectively.
294
+
295
+ Clearing table with a box. Each episode lasts 500 time steps. We define five stages and their rewards to be initial (0), reaching the toy (0.125), grasping the toy (0.25), putting the toy into the box (1.0), and lifting the box (2.0). The auxiliary task is to predict the 3D coordinates of the toy and the box. The object-centric feature consists of the 3D positions of the toy and the box as well as the relative positions between the gripper and these two objects respectively.
296
+
297
+ Pouring liquid. Each episode lasts 500 time steps. We define three stages and their rewards to be initial (0), grasping the mug (0.05), pouring $\left( 0 . 1 N \right)$ , where $N$ is the number of small spheres in the other container. The auxiliary task is to predict the 3D coordinates of the mug. The object-centric feature consists of the 3D positions of the mug, the relative position between the gripper and the mug, and the relative position between the mug and the container.
298
+
299
+ Order fulfillment. Each episode lasts 1000 time steps. The number of objects varies from 1 to 4 across episodes. We define five stages that correspond to the number of toys in the boxes. The immediate reward corresponds to the number of toys placed in the correct boxes (number of toy planes in the green box and toy cars in the red box). To handle the variable number of objects, we only represent the objects nearest to the gripper for the auxiliary task and the object-centric feature. The auxiliary task is to predict the 3D coordinates of the nearest plane and the nearest car to the gripper. The object-centric feature consists of the relative positions from the gripper to these two nearest objects.
md/train/HJWHIKqgl/HJWHIKqgl.md ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GENERATIVE MODELS AND MODEL CRITICISM VIA OPTIMIZED MAXIMUM MEAN DISCREPANCY
2
+
3
+ Danica J. Sutherland∗ † Aaditya Ramdas‡
4
+
5
+ Hsiao-Yu Tung† Alex Smola†
6
+
7
+ Heiko Strathmann∗ Soumyajit De∗ Arthur Gretton∗
8
+
9
+ ∗ Gatsby Computational Neuroscience Unit, University College London † School of Computer Science, Carnegie Mellon University ‡ Departments of EECS and Statistics, University of California at Berkeley djs@djsutherland.ml htung@cs.cmu.edu
10
+
11
+ # ABSTRACT
12
+
13
+ We propose a method to optimize the representation and distinguishability of samples from two probability distributions, by maximizing the estimated power of a statistical test based on the maximum mean discrepancy (MMD). This optimized MMD is applied to the setting of unsupervised learning by generative adversarial networks (GAN), in which a model attempts to generate realistic samples, and a discriminator attempts to tell these apart from data samples. In this context, the MMD may be used in two roles: first, as a discriminator, either directly on the samples, or on features of the samples. Second, the MMD can be used to evaluate the performance of a generative model, by testing the model’s samples against a reference data set. In the latter role, the optimized MMD is particularly helpful, as it gives an interpretable indication of how the model and data distributions differ, even in cases where individual model samples are not easily distinguished either by eye or by classifier.
14
+
15
+ This post-publication revision corrects some errors in constants of the estimator (5). The appendix deriving the estimator has been replaced by Sutherland (2019).
16
+
17
+ # 1 INTRODUCTION
18
+
19
+ Many problems in testing and learning require evaluating distribution similarity in high dimensions, and on structured data such as images or audio. When a complex generative model is learned, it is necessary to provide feedback on the quality of the samples produced. The generative adversarial network (Goodfellow et al., 2014; Gutmann et al., 2014) is a popular method for training generative models, where a rival discriminator attempts to distinguish model samples from reference data. Training of the generator and discriminator is interleaved, such that a saddle point is eventually reached in the joint loss.
20
+
21
+ A useful insight into the behavior of GANs is to note that when the discriminator is properly trained, the generator is tasked with minimizing the Jensen-Shannon divergence measure between the model and data distributions. When the model is insufficiently powerful to perfectly simulate the test data, as in most nontrivial settings, the choice of divergence measure is especially crucial: it determines which compromises will be made. A range of adversarial divergences were proposed by Huszar (2015), using a weight to interpolate between KL, inverse KL, and Jensen-Shannon. This weight may be interpreted as a prior probability of observing samples from the model or the real world: when there is a greater probability of model samples, we approach reverse KL and the model seeks out modes of the data distribution. When there is a greater probability of drawing from the data distribution, the model approaches the KL divergence, and tries to cover the full support of the data, at the expense of producing some samples in low probability regions.
22
+
23
+ This insight was further developed by Nowozin et al. (2016), who showed that a much broader range of $f$ -divergences can be learned for the discriminator in adversarial models, based on the variational formulation of $f$ -divergences of Nguyen et al. (2008). For a given $f$ -divergence, the model learns the composition of the density ratio (of data to model density) with the derivative of $f$ , by comparing generator and data samples. This provides a lower bound on the “true” divergence that would be obtained if the density ratio were perfectly known. In the event that the model is in a smaller class than the true data distribution, this broader family of divergences implements a variety of different approximations: some focus on individual modes of the true sample density, others try to cover the support. It is straightforward to visualize these properties in one or two dimensions (Nowozin et al., 2016, Figure 5), but in higher dimensions it becomes difficult to anticipate or visualize the behavior of these various divergences.
24
+
25
+ An alternative family of divergences are the integral probability metrics (Müller, 1997), which find a witness function to distinguish samples from $P$ and $Q$ .1 A popular such class of witness functions in GANs is the maximum mean discrepancy (Gretton et al., 2012a), simultaneously proposed by Dziugaite et al. (2015) and Li et al. (2015). The architecture used in these two approaches is actually quite different: Dziugaite et al. use the MMD as a discriminator directly at the level of the generated and test images, whereas Li et al. apply the MMD on input features learned from an autoencoder, and share the decoding layers of the autoencoder with the generator network (see their Figure 1(b)). The generated samples have better visual quality in the latter method, but it becomes difficult to analyze and interpret the algorithm given the interplay between the generator and discriminator networks. In a related approach, Salimans et al. (2016) propose to use feature matching, where the generator is tasked with minimizing the squared distance between expected discriminator features under the model and data distributions, thus retaining the adversarial setting.
26
+
27
+ In light of these varied approaches to discriminator training, it is important to be able to evaluate quality of samples from a generator against reference data. An approach used in several studies is to obtain a Parzen window estimate of the density and compute the log-likelhiood (Goodfellow et al., 2014; Nowozin et al., 2016; Breuleux et al., 2011). Unfortunately, density estimates in such high dimensions are known to be very unreliable both in theory (Wasserman, 2006, Ch. 6) and in practice (Theis et al., 2016). We can instead ask humans to evaluate the generated images (Denton et al., 2015; Salimans et al., 2016), but while evaluators should be able to distinguish cases where the samples are over-dispersed (support of the model is too large), it may be more difficult to find under-dispersed samples (too concentrated at the modes), or imbalances in the proportions of different shapes, since the samples themselves will be plausible images. Recall that different divergence measures result in different degrees of mode-seeking: if we rely on human evaluation, we may tend towards always using divergences with under-dispersed samples.
28
+
29
+ We propose to use the MMD to distinguish generator and reference data, with features and kernels chosen to maximize the test power of the quadratic-time MMD of Gretton et al. (2012a). Optimizing MMD test power requires a sophisticated treatment due to the different form of the null and alternative distributions (Section 2). We also develop an efficient approach to obtaining quantiles of the MMD distribution under the null (Section 3). We demonstrate on simple artificial data that simply maximizing the MMD (as in Sriperumbudur et al., 2009) provides a less powerful test than our approach of explicitly maximizing test power. Our procedure applies even when our definition of the MMD is computed on features of the inputs, since these can also be trained by power maximization.
30
+
31
+ When designing an optimized MMD test, we should choose a kernel family that allows us to visualize where the probability mass of the two samples differs most. In our experiments on GAN performance evaluation, we use an automatic relevance determination (ARD) kernel over the output dimensions, and learn which coordinates differ meaningfully by finding which kernels retain significant bandwidth when the test power is optimized. We may further apply the method of Lloyd & Ghahramani (2015, Section 5) to visualize the witness function associated with this MMD, by finding those model and data samples occurring at the maxima and minima of the witness function (i.e., the samples from one distribution least likely to be in high probability regions of the other). The optimized witness function gives a test with greater power than a standard RBF kernel, suggesting that the associated witness function peaks are an improved representation of where the distributions differ. We also propose a novel generative model based on the feature matching idea of Salimans et al. (2016), using MMD rather than their “minibatch discrimination” heuristic, for a more principled and more stable enforcement of sample diversity, without requiring labeled data.
32
+
33
+ # 2 MAXIMIZING TEST POWER OF A QUADRATIC MMD TEST
34
+
35
+ Our methods rely on optimizing the power of a two-sample test over the choice of kernel. We first describe how to do this, then review alternative kernel selection approaches.
36
+
37
+ # 2.1 MMD AND TEST POWER
38
+
39
+ We will begin by reviewing the maximum mean discrepancy and its use in two-sample tests. Let $k$ be the kernel of a reproducing kernel Hilbert space (RKHS) $\mathcal { H } _ { k }$ of functions on a set $\mathcal { X }$ . We assume that $k$ is measurable and bounded, $\textstyle \operatorname* { s u p } _ { x \in { \mathcal { X } } } k ( x , x ) < \infty$ . Then the MMD in $\mathcal { H } _ { k }$ between two distributions $P$ and $Q$ over $\mathcal { X }$ is (Gretton et al., 2012a):
40
+
41
+ $$
42
+ \mathbf { M M D } _ { k } ^ { 2 } ( P , Q ) : = \mathbb { E } _ { x , x ^ { \prime } } \left[ k ( x , x ^ { \prime } ) \right] + \mathbb { E } _ { y , y ^ { \prime } } \left[ k ( y , y ^ { \prime } ) \right] - 2 \mathbb { E } _ { x , y } \left[ k ( x , y ) \right]
43
+ $$
44
+
45
+ where $x , x ^ { \prime } \overset { i i d } { \sim } P$ and $y , y ^ { \prime } \stackrel { i i d } { \sim } Q$ . Many kernels, including the popular Gaussian RBF, are characteristic (Fukumizu et al., 2008; Sriperumbudur et al., 2010), which implies that the MMD is a metric, and in particular that $\boldsymbol { \mathrm { M M D } } _ { k } ( P , Q ) = 0$ if and only if $P = Q$ , so that tests with any characteristic kernel are consistent. That said, different characteristic kernels will yield different test powers for finite sample sizes, and so we wish to choose a kernel $k$ to maximize the test power. Below, we will usually suppress explicit dependence on $k$ .
46
+
47
+ Given $X = \{ X _ { 1 } , \ldots , X _ { m } \} \stackrel { i i d } { \sim } P$ and $Y = \{ Y _ { 1 } , \dots , Y _ { m } \} \overset { i i d } { \sim } Q , ^ { 2 }$ one estimator of $\mathbf { M M D } ( P , Q )$ is
48
+
49
+ $$
50
+ { \widehat { \mathrm { M M D } } } _ { \mathrm { U } } ^ { 2 } ( X , Y ) : = { \frac { 1 } { { \binom { m } { 2 } } } } \sum _ { i \neq i ^ { \prime } } k ( X _ { i } , X _ { i ^ { \prime } } ) + { \frac { 1 } { { \binom { m } { 2 } } } } \sum _ { j \neq j ^ { \prime } } k ( Y _ { j } , Y _ { j ^ { \prime } } ) - { \frac { 2 } { { \binom { m } { 2 } } } } \sum _ { i \neq j } k ( X _ { i } , Y _ { j } ) .
51
+ $$
52
+
53
+ This estimator is unbiased, and has nearly minimal variance among unbiased estimators (Gretton et al., 2012a, Lemma 6).
54
+
55
+ Following Gretton et al. (2012a), we will conduct a hypothesis test with null hypothesis $H _ { 0 } : P = Q$ and alternative $H _ { 1 } : P \neq Q$ , using test statistic $m \widehat { \mathrm { M M D } } _ { \mathrm { U } } ^ { 2 } ( X , Y )$ . For a given allowable probability of false rejection $\alpha$ , we choose a test threshold $c _ { \alpha }$ and reject $H _ { 0 }$ if $m \widehat { \mathrm { M M D } } _ { \mathrm { U } } ^ { 2 } ( X , Y ) > c _ { \alpha }$ .
56
+
57
+ Under $H _ { 0 } : P = Q$ , $m \widehat { \mathrm { M M D } } _ { \mathrm { U } } ^ { 2 } ( X , Y )$ converges asymptotically to a distribution that depends on the unknown distribution $P$ (Gretton et al., 2012a, Theorem 12); we thus cannot evaluate the test threshold $c _ { \alpha }$ in closed form. We instead estimate a data-dependent threshold $\hat { c } _ { \alpha }$ via permutation: randomly partition the data $X \cup Y$ into $X ^ { \prime }$ and $Y ^ { \prime }$ many times, evaluate $m \widehat { \mathrm { M M D } } _ { \mathrm { U } } ^ { 2 } ( X ^ { \prime } , Y ^ { \prime } )$ on each split, and estimate the $( 1 - \alpha )$ th quantile $\hat { c } _ { \alpha }$ from these samples. Section 3 discusses efficient computation of this process.
58
+
59
+ We now describe a mechanism to choose the kernel $k$ so as to maximize the power of its associated test. First, note that under the alternative $H _ { 1 } : P \neq Q$ , $\widehat { \overline { { { \bf M } { \bf M } { \bf D } } } _ { \mathrm { U } } ^ { 2 } }$ is asymptotically normal,
60
+
61
+ $$
62
+ \frac { \widehat { \mathrm { { M M D } } } _ { \mathrm { { U } } } ^ { 2 } ( X , Y ) - \mathrm { { M M D } } ^ { 2 } ( P , Q ) } { \sqrt { V _ { m } ( P , Q ) } } \stackrel { D } { } { \mathcal { N } } ( 0 , 1 ) ,
63
+ $$
64
+
65
+ where $V _ { m } ( P , Q )$ denotes the asymptotic variance of the $\widehat { \overline { { { \bf M } { \bf M } { \bf D } } } _ { \mathrm { U } } ^ { 2 } }$ estimator for samples of size $m$ from $P$ and $Q$ (Serfling, 1980). The power of our test is thus, using $\mathrm { P r } _ { 1 }$ to denote probability under $H _ { 1 }$ ,
66
+
67
+ $$
68
+ \begin{array} { r l r } & { } & { \mathrm { P r } _ { 1 } \left( m \widehat { \mathbf { M } \mathbf { M } \mathbf { D } } _ { \mathrm { U } } ^ { 2 } ( X , Y ) > \widehat { c } _ { \alpha } \right) = \mathrm { P r } _ { 1 } \left( \frac { \widehat { \mathbf { M } \mathbf { M } \mathbf { D } } _ { \mathrm { U } } ^ { 2 } ( X , Y ) - \mathbf { M } \mathbf { M } \mathbf { D } ^ { 2 } ( P , Q ) } { \sqrt { V _ { m } ( P , Q ) } } > \frac { \widehat { c } _ { \alpha } / m - \mathbf { M } \mathbf { M } \mathbf { D } ^ { 2 } ( P , Q ) } { \sqrt { V _ { m } ( P , Q ) } } \right) } \\ & { } & { \to \Phi \left( \frac { \mathbf { M } \mathbf { M } \mathbf { D } ^ { 2 } ( P , Q ) } { \sqrt { V _ { m } ( P , Q ) } } - \frac { c _ { \alpha } } { m \sqrt { V _ { m } ( P , Q ) } } \right) \qquad ( 4 ) } \end{array}
69
+ $$
70
+
71
+ where $\Phi$ is the CDF of the standard normal distribution. The second step follows by (3) and the convergence of $\hat { c } _ { \alpha } \to c _ { \alpha }$ (Alba Fernández et al., 2008). Test power is therefore maximized by maximizing the argument of $\Phi$ : i.e. increasing the ratio of $\mathbf { M } \mathbf { M } \mathbf { D } ^ { 2 } ( \boldsymbol { P } , \boldsymbol { Q } )$ to $\sqrt { V _ { m } ( P , Q ) }$ , and reducing the ratio of $c _ { \alpha }$ to $m \sqrt { V _ { m } ( P , Q ) }$ .
72
+
73
+ For a given kernel $k$ , $V _ { m }$ is $O ( m ^ { - 1 } )$ , while both $c _ { \alpha }$ and $\mathrm { { \bf M M D } ^ { 2 } }$ are constants. Thus the first term is $O ( { \sqrt { m } } )$ , and the second is $O ( 1 / \sqrt { m } )$ . Two situations therefore arise: when $m$ is small relative to the difference in $P$ and $Q$ (i.e., we are close to the null), both terms need to be taken into acccount to maximize test power. Here, we propose to maximize (4) using the efficient computation of $\hat { c } _ { \alpha }$ in Section 3. As $m$ grows, however, we can asymptotically maximize the power of the test by choosing a kernel $k$ that maximizes the $t { \cdot }$ -statistic $t _ { k } ( P , Q ) : = \mathbf { M M D } _ { k } ^ { 2 } ( P , Q ) / \sqrt { V _ { m } ^ { ( k ) } ( P , Q ) }$ . In practice, we maximize an estimator of $t _ { k } ( P , Q )$ given by $\widehat { t } _ { k } ( X , Y ) : = \widehat { \mathrm { M M D } } _ { \mathrm { U } } ^ { 2 } ( X , Y ) / \sqrt { \widehat { V } _ { m } ( X , Y ) }$ , with ${ \widehat { V } } _ { m } ( X , Y )$ discussed shortly.
74
+
75
+ To maintain the validity of the hypothesis test, we will need to divide the observed data $X$ and $Y$ into a “training sample,” used to choose the kernel, and a “testing sample,” used to perform the final hypothesis test with the learned kernel.
76
+
77
+ We next consider families of kernels over which to optimize. The most common kernels used for MMD tests are standard kernels from the literature, e.g. the Gaussian RBF, Matérn, or Laplacian kernels. It is the case, however, that for any function $z : \mathcal { X } _ { 1 } \mathcal { X } _ { 2 }$ and any kernel $\kappa : \mathcal { X } _ { 2 } \times \mathcal { X } _ { 2 } \to \mathbb { R }$ , the composition $\kappa \circ z$ is also a kernel on $\mathcal { X } _ { 1 }$ .3 We can thus choose a function $z$ to extract meaningful features of the inputs, and use a standard kernel $\kappa$ to compare those features. We can select such a function $z$ (as well as $\kappa$ ) by performing kernel selection on the family of kernels $\kappa \circ z$ . To do so, we merely need to maximize $\bar { t } _ { \kappa \circ z } ( \boldsymbol { X } , \boldsymbol { Y } )$ through standard optimization techniques based on the gradient of $\hat { t } _ { \kappa \circ z }$ with respect to the parameterizations of $z$ and $\kappa$ .
78
+
79
+ We now give an expression for an empirical estimate $\widehat { V } _ { m }$ of the variance $V _ { m } ( P , Q )$ that appears in our test power. This estimate is similar to that given by Bounliphone et al. (2016, Appendix A.1), but incorporates second-order terms and corrects some small sources of bias. Though the expression is somewhat unwieldy, it is defined by various sums of the kernel matrices and is differentiable with respect to the kernel $k$ .
80
+
81
+ $V _ { m } ( P , Q )$ is given in terms of expectations of $k$ under $P$ and $Q$ in Appendix A. We replace these expectations with finite-sample averages, giving us the required estimator. Define matrices $K _ { X Y }$ , $\tilde { K } _ { X X }$ , and $\tilde { K } _ { Y Y }$ by $( K _ { X Y } ) _ { i , j } \ : = \ : k ( X _ { i } , Y _ { j } ) , \ : ( \tilde { K } _ { X X } ) _ { i i } \ : = \ : 0 , \ : ( \tilde { K } _ { X X } ) _ { i j } \ : = \ : k ( X _ { i } , X _ { j } )$ for $i \neq j$ , and $\tilde { K } _ { Y Y }$ similarly to $\tilde { K } _ { X X }$ . Let $e$ be an $m$ -vector of ones, and use the falling factorial notation $( m ) _ { r } : = m ( m - 1 ) \cdot \cdot \cdot ( m - r + 1 )$ . Then an unbiased estimator for $V _ { m } ( P , Q )$ is:
82
+
83
+ $$
84
+ \begin{array} { l } { \widehat { V } _ { m } : = \frac { 4 } { ( m ) _ { 4 } } \left[ \left\| \tilde { K } _ { X X } e \right\| ^ { 2 } + \left\| \tilde { K } _ { Y Y } e \right\| ^ { 2 } \right] + \frac { 4 ( m ^ { 2 } - m - 1 ) } { m ^ { 3 } ( m - 1 ) ^ { 2 } } \left[ \left\| K _ { X Y } e \right\| ^ { 2 } + \left\| K _ { X Y } ^ { \top } e \right\| ^ { 2 } \right] } \\ { \displaystyle \qquad \otimes } \\ { \displaystyle \qquad - \frac { 8 } { m ^ { 2 } ( m ^ { 2 } - 3 m + 2 ) } \left[ e ^ { \top } \tilde { K } _ { X X } K _ { X Y } e + e ^ { \top } \tilde { K } _ { Y Y } K _ { X Y } ^ { \top } e \right] } \\ { \displaystyle \qquad + \frac { 8 } { m ^ { 2 } ( m ) _ { 3 } } \left[ \left( e ^ { \top } \tilde { K } _ { X X } e + e ^ { \top } \tilde { K } _ { Y Y } e \right) \left( e ^ { \top } K _ { X Y } e \right) \right] } \\ { \displaystyle \qquad - \frac { 2 ( 2 m - 3 ) } { ( m ) _ { 2 } ( m ) _ { 4 } } \left[ \left( e ^ { \top } \tilde { K } _ { X X } e \right) ^ { 2 } + \left( e ^ { \top } \tilde { K } _ { Y Y } e \right) ^ { 2 } \right] - \frac { 4 ( 2 m - 3 ) } { m ^ { 3 } ( m - 1 ) ^ { 3 } } \left[ \left( e ^ { \top } K _ { X Y } e \right) ^ { 2 } \right] } \\ { \displaystyle \qquad - \frac { 2 } { m ( m ^ { 3 } - 6 m ^ { 2 } + 1 1 m - 6 ) } \left[ \left\| \tilde { K } _ { X X } \right\| _ { F } ^ { 2 } + \left\| \tilde { K } _ { Y Y } \right\| _ { F } ^ { 2 } \right] + \frac { 4 ( m - 2 ) } { m ^ { 2 } ( m - 1 ) ^ { 3 } } \left\| K _ { X Y } \right\| _ { F } ^ { 2 } . } \end{array}
85
+ $$
86
+
87
+ # 2.2 OTHER APPROACHES TO MMD KERNEL SELECTION
88
+
89
+ The most common practice in performing two-sample tests with MMD is to use a Gaussian RBF kernel, with bandwidth set to the median pairwise distance among the joint data. This heuristic often works well, but fails when the scale on which $P$ and $Q$ vary differs from the scale of their overall variation (as in the synthetic experiment of Section 4). Ramdas et al. (2015a;b) study the power of the median heuristic in high-dimensional problems, and justify its use for the case where the means of $P$ and $Q$ differ.
90
+
91
+ An early heuristic for improving test power was to simply maximize $\widehat { \overline { { { \bf M } { \bf M } { \bf D } } } _ { \mathrm { U } } ^ { 2 } }$ . Sriperumbudur et al. (2009) proved that, for certain classes of kernels, this yields a consistent test. As further shown by Sriperumbudur et al., however, maximizing MMD amounts to minimizing training classification error under linear loss. Comparing with (4), this is plainly not an optimal approach for maximizing test power, since variance is ignored.4 One can also consider maximizing criteria based on cross validation (Sugiyama et al., 2011; Gretton et al., 2012b; Strathmann, 2012). This approach is not differentiable, and thus difficult to maximize among more than a fixed set of candidate kernels. Moreover, where this cross-validation is used to maximize the MMD on a validation set (as in Sugiyama et al., 2011), it again amounts to maximizing classification performance rather than test performance, and is suboptimal in the latter setting (Gretton et al., 2012b, Figure 1). Finally, Gretton et al. (2012b) previously studied direct optimization of the power of an MMD test for a streaming estimator of the MMD, for which optimizing the ratio of the empirical statistic to its variance also optimizes test power. This streaming estimator uses data very inefficiently, however, often requiring $m ^ { 2 }$ samples to achieve power comparable to tests based on $\widehat { \overline { { { \bf M } { \bf M } { \bf D } } } _ { \mathrm { U } } ^ { 2 } }$ with $m$ samples (Ramdas et al., 2015a).
92
+
93
+ # 3 EFFICIENT IMPLEMENTATION OF PERMUTATION TESTS FOR $\widehat { \mathrm { M M D } } _ { \mathrm { U } } ^ { 2 }$
94
+
95
+ Practical implementations of tests based on $\widehat { \overline { { { \bf M } { \bf M } { \bf D } } } _ { \mathrm { U } } ^ { 2 } }$ require efficient estimates of the test threshold $\hat { c } _ { \alpha }$ . There are two known test threshold estimates that lead to a consistent test: the permutation test mentioned above, and a more sophisticated null distribution estimate based on approximating the eigenspectrum of the kernel, previously reported to be faster than the permutation test (Gretton et al., 2009). In fact, the relatively slow reported performance of the permutation approach was due to the naive Matlab implementation of the permutation test in the code accompanying Gretton et al. (2012a), which creates a new copy of the kernel matrix for every permutation. We show here that, by careful design, permutation thresholds can be computed substantially faster – even when compared to parallelized state-of-the-art spectral solvers (not used by Gretton et al.).
96
+
97
+ First, we observe that we can avoid copying the kernel matrix simply by generating permutation indices for each null sample and accessing the precomputed kernel matrix in permuted order. In practice, however, this does not give much performance gain due to the random nature of memoryaccess which conflicts with how modern CPUs implement caching. Second, if we rather maintain an inverse map of the permutation indices, we can easily traverse the matrix in a sequential fashion. This approach exploits the hardware prefetchers and reduces the number of CPU cache misses from almost $100 \%$ to less than $10 \%$ . Furthermore, the sequential access pattern of the kernel matrix enables us to invoke multiple threads for computing the null samples, each traversing the matrix sequentially, without compromising the locality of reference in the CPU cache.
98
+
99
+ We consider an example problem of computing the test using 200 null distribution samples on $m = 2 0 0 0$ two-dimensional samples, comparing a Gaussian to a Laplace distribution with matched moments. We compare our optimized permutation test against a spectral test using the highlyoptimized (and proprietary) state-of-the-art spectral solver of Intel’s MKL library (Intel, 2003–17). All results are averaged over 30 runs; the variance across runs was negligible.
100
+
101
+ Figure 1 (left) shows the obtained speedups as the number of computing threads grow for $m = 2 0 0 0$ Our implementation is not only faster on a single thread, but also saturates more slowly as the number of threads increases. Figure 1 (right) shows timings for increasing problem sizes (i.e. $m$ ) when using all available system threads (here 24). For larger problems, our permutation implementation (scaling as $\mathcal { O } ( m ^ { 2 } ) )$ is an order of magnitude faster than the spectral test (scaling as $\bar { \mathcal { O } } ( m ^ { 3 } ) )$ . For smaller problems (for which Gretton et al. suggested the spectral test), there is still a significant performance increase.
102
+
103
+ ![](images/fe5c6469236793f0c15616b92699b1c7de4442302950c111a8023f5178efa19b.jpg)
104
+ Figure 1: Runtime comparison for sampling the null distribution. We compare our optimized permutation approach to the spectral method using Intel’s MKL spectral solver. Time spent precomputing the kernel matrix is not included. Left: Increasing number of threads for fixed problem size $m = 2 0 0 0$ . Single-threaded times of other implementations: Matlab reference spectral 381s, Python permutation 182s, Shogun spectral (eigen3) 87s. Right: Increasing problem sizes using the maximum number of 24 system threads.
105
+
106
+ For further reference, we also report timings of available non-parallelized implementations for $m = 2 0 0 0$ , compared to our version’s 12s in Figure 1 (left): 87s for an open-sourced spectral test in Shogun using eigen3 (Sonnenburg et al., 2016; Guennebaud et al., 2010), 381s for the reference Matlab spectral implementation (Gretton et al., 2012a), and 182s for a naive Python permutation test that partly avoids copying via masking. (All of these times also exclude kernel computation.)
107
+
108
+ # 4 EXPERIMENTS
109
+
110
+ Code for these experiments is available at github.com/djsutherland/opt-mmd.
111
+
112
+ Synthetic data We consider the problem of bandwidth selection for Gaussian RBF kernels on the Blobs dataset of Gretton et al. (2012b). $P$ here is a $5 \times 5$ grid of two-dimensional standard normals, with spacing 10 between the centers. $Q$ is laid out identically, but with covariance $\frac { \varepsilon - 1 } { \varepsilon + 1 }$ between the coordinates (so that the ratio of eigenvalues in the variance is $\varepsilon$ .) Figure 2a shows two samples from $X$ and $Y$ with $\varepsilon = 6$ . Note that when $\varepsilon = 1$ , $P = Q$ .
113
+
114
+ For $\varepsilon ~ \in ~ \{ 1 , 2 , 4 , 6 , 8 , 1 0 \}$ , we take $m \ = \ 5 0 0$ samples from each distribution and compute ${ \widehat { \bf M M D } } _ { \mathrm { U } } ^ { 2 } ( X , Y )$ , ${ \widehat { V } } _ { m } ( X , Y )$ , and $\hat { c } _ { 0 . 1 }$ using 1 000 permutations, for Gaussian RBF kernels with each of 30 bandwidths. We repeat this process 100 times. Figure 2b shows that the median heuristic always chooses too large a bandwidth. When maximizing MMD alone, we see a bimodal distribution of bandwidths, with a significant number of samples falling into the region with low test power. The variance of $\widehat { \overline { { { \bf M } { \bf M } { \bf D } } } _ { \mathrm { U } } ^ { 2 } }$ is much higher in this region, however, hence optimizing the ratio $\hat { t }$ never returns these bandwidths. Figure 2c shows that maximizing $\hat { t }$ outperforms maximizing the MMD across a variety of problem parameters, and performs near-optimally.
115
+
116
+ Model criticism As an example of a real-world two-sample testing problem, we will consider distinguishing the output of a generative model from the reference distribution it attempts to reproduce. We will use the semi-supervised GAN model of Salimans et al. (2016), trained on the MNIST dataset of handwritten images.5 True samples from the dataset are shown in Figure 3a; samples from the learned model are in Figure 3b. Salimans et al. (2016) called their results “completely indistinguishable from dataset images,” and reported that annotators on Mechanical Turk were able to distinguish samples only in $5 2 . 4 \%$ of cases. Comparing the results, however, there are several pixel-level artifacts that make distinguishing the datasets trivial; our methods can pick up on these quickly.
117
+
118
+ ![](images/98c515445af039a26c3d0356824eb9ba49cf9330c65f8ad17230dcd4f246d90f.jpg)
119
+ Figure 2: Results for the Blobs problem. Maximizing $\hat { t }$ performs near-optimally.
120
+
121
+ To make the problem more interesting, we discretized the sampled pixels into black or white (which barely changes the images visually). The samples are then in $\dot { \{ 0 , 1 \} } ^ { 2 8 \times 2 8 }$ . We trained an automatic relevance determination (ARD)-type kernel: in the notation of Section 2.1, $z$ scales each pixel by some learned value, and $k$ is a Gaussian RBF kernel with a learned global bandwidth. We optimized $\mathbf { \widetilde { \Gamma } } _ { \hat { t } }$ on 2 000 samples in batches of size 500 using the Adam optimizer (Kingma & Ba, 2015), where the learned weights are visualized in Figure 3c. This network has essentially perfect discriminative power: testing it on 100 different samples with 1000 permutations for each test, in 98 cases we obtained $p$ -values of 0.000 and twice got 0.001. By contrast, using an RBF kernel with a bandwidth optimized by maximizing the $t$ statistic gave a less powerful test: the worst $p$ -value in 100 repetitions was 0.135, with power $5 7 \%$ at the $\alpha = 0 . 0 1$ threshold. An RBF kernel based on the median heuristic, which here found a bandwidth five times the size of the $t$ -statistic-optimized bandwidth, performed worse still: three out of 100 repetitions found a $p$ -value of exactly 1.000, and power at the .01 threshold was $42 \%$ . The learned weights show that the model differs from the true dataset along the outsides of images, as well as along a vertical line in the center.
122
+
123
+ We can investigate these results in further detail using the approach of Lloyd & Ghahramani (2015), considering the witness function associated with the MMD, which has largest amplitude where the probability mass of the two samples is most different. Thus, samples falling at maxima and minima of the witness function best represent the difference in the distributions. The value of the witness function on each sample is plotted in Figure 3d, along with some images with different values of the witness function. Apparently, the GAN is slightly overproducing images resembling the /-like digits on the left, while underproducing vertical 1s. It is not the case that the GAN is simply underproducing 1s in general: the $p$ -values of a $\chi ^ { 2 }$ contingency test between the outputs of digit classifiers on the two distributions are uniform. This subtle difference in proportions among types of digits would be quite difficult for human observers to detect. Our testing framework allows the model developer to find such differences and decide whether to act on them. One could use a more complex representation function $z$ to detect even more subtle differences between distributions.
124
+
125
+ GAN criterion We now demonstrate the use of MMD as a training criterion in GANs. We consider two basic approaches, and train on MNIST.6 First, the generative moment matching network (GMMN; Figure 4a) approach (Li et al., 2015; Dziugaite et al., 2015) uses an MMD statistic computed with an
126
+
127
+ ![](images/f7c7aa33b1ea67b1a32dae78a7009435a9cf654beace86068b806c52dc66073b.jpg)
128
+ distribution means; the distance between them is small but highly consistent.
129
+ Figure 3: Model criticism of Salimans et al. (2016)’s semi-supervised GAN on MNIST.
130
+
131
+ RBF kernel directly on the images as the discriminator of a GAN model. The $t$ -GMMN (Figure 4b) has the generator minimize the $\hat { t } _ { k }$ statistic for a fixed kernel.7 Compared to standard GMMNs, the $t$ -GMMN more directly attempts to make the distributions indistinguishable under the kernel function; it avoids a situation like that of Figure 3d, where although the MMD value is quite small, the two distributions are perfectly distinguishable due to the small variance.
132
+
133
+ Next, feature matching GANs (Figure 4c) train the discriminator as a classifier like a normal GAN, but train the generator to minimize the MMD between generator samples and reference samples with a kernel computed on intermediate features of the discriminator. Salimans et al. (2016) proposed feature matching using the mean features at the top of the discriminator (effectively using an MMD with a linear kernel); we instead use MMD with a mixture of RBF kernels, ensuring that the full feature distributions match, rather than just their means. This helps avoid the common failure mode of GANs where the generator collapses to outputting a small number of samples considered highly realistic by the discriminator. Using the MMD-based approach, however, no single point can approximate the feature distribution. The minibatch discrimination approach of Salimans et al. (2016) attempts to solve the same problem, by introducing features measuring the similarity of each sample to a selection of other samples, but we were unable to get it to work without labels to force the discriminator in a reasonable direction; Figure 4d demonstrates some of those failures, with each row showing six samples from each of six representative runs of the model.
134
+
135
+ # ACKNOWLEDGEMENTS
136
+
137
+ We would like to thank Tim Salimans, Ian Goodfellow, and Wojciech Zaremba for providing their code and for gracious assistance in using it, as well as Jeff Schneider for helpful discussions.
138
+
139
+ ![](images/93232b430bbd8dfdaf9f60be7276feac59d36c2e89cb7cb0941278bb584d8e46.jpg)
140
+ Figure 4: MNIST digits from various models. Part d shows six runs of the minibatch discrimination model of Salimans et al. (2016), trained without labels — the same model that, with labels, generated Figure 3b. (The third row is the closest we got the model to generating digits without any labels.)
141
+
142
+ # REFERENCES
143
+
144
+ V. Alba Fernández, M. Jiménez-Gamero, and J. Muñoz Garcia. A test for the two-sample problem based on empirical characteristic functions. Computational Statistics & Data Analysis, 52:3730– 3748, 2008.
145
+
146
+ Wacha Bounliphone, Eugene Belilovsky, Matthew B. Blaschko, Ioannis Antonoglou, and Arthur Gretton. A test of relative similarity for model selection in generative models. In International Conference on Learning Representations, 2016. arXiv:1511.04581.
147
+
148
+ Olivier Breuleux, Yoshua Bengio, and Pascal Vincent. Quickly generating representative samples from an rbm-derived process. Neural Computation, 23(8):2053–2073, 2011.
149
+
150
+ Emily Denton, Soumith Chintala, Arthur Szlam, and Rob Fergus. Deep generative image models using a laplacian pyramid of adversarial networks. In Advances in Neural Information Processing Systems, pp. 1486–1494. 2015.
151
+
152
+ Gintare Karolina Dziugaite, Daniel M. Roy, and Zoubin Ghahramani. Training generative neural networks via maximum mean discrepancy optimization. In Uncertainty in Artificial Intelligence, 2015. arXiv:1505.03906.
153
+
154
+ Kenji Fukumizu, Arthur Gretton, Xiaohai Sun, and Bernhard Schölkopf. Kernel measures of conditional dependence. In Advances in Neural Information Processing Systems, 2008.
155
+
156
+ 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. arXiv:1406.2661.
157
+
158
+ Arthur Gretton, Kenji Fukumizu, Zaid Harchaoui, and Bharath K. Sriperumbudur. A fast, consistent kernel two-sample test. In Advances in Neural Information Processing Systems, pp. 673–681, 2009.
159
+
160
+ Arthur Gretton, Karsten M. Borgwardt, Malte J Rasch, Bernhard Schölkopf, and Alex J. Smola. A kernel two-sample test. The Journal of Machine Learning Research, 13, 2012a.
161
+
162
+ Arthur Gretton, Bharath Sriperumbudur, Dino Sejdinovic, Heiko Strathmann, and Massimiliano Pontil. Optimal kernel choice for large-scale two-sample tests. In Advances in Neural Information Processing Systems, 2012b.
163
+
164
+ Gaël Guennebaud, Benoît Jacob, et al. Eigen v3. http://eigen.tuxfamily.org, 2010.
165
+
166
+ Michael U. Gutmann, Ritabrata Dutta, Samuel Kaski, and Jukka Corander. Statistical inference of intractable generative models via classification. 2014. arXiv:1407.4981.
167
+
168
+ Ferenc Huszar. How (not) to train your generative model: Scheduled sampling, likelihood, adversary? 2015. arXiv:1511.05101.
169
+
170
+ MKL Intel. Intel math kernel library, 2003–17.
171
+
172
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations, 2015. arXiv:1412.6980.
173
+
174
+ Yujia Li, Kevin Swersky, and Richard Zemel. Generative moment matching networks. In Uncertainty in Artificial Intelligence, 2015. arXiv:1502.02761.
175
+
176
+ James Robert Lloyd and Zoubin Ghahramani. Statistical model criticism using kernel two sample tests. In Advances in Neural Information Processing Systems, pp. 829–837, 2015.
177
+
178
+ Alfred Müller. Integral probability metrics and their generating classes of functions. Advances in Applied Probability, 29(2):429–443, 1997.
179
+
180
+ XuanLong Nguyen, Martin J. Wainwright, and Michael I. Jordan. On optimal quantization rules in some problems in sequential decentralized detection. IEEE Transactions on Information Theory, 54(7):3285–3295, 2008.
181
+
182
+ Sebastian Nowozin, Botond Cseke, and Ryota Tomioka. $f$ -GAN: Training generative neural samplers using variational divergence minimization. In Advances in Neural Information Processing Systems, 2016.
183
+
184
+ Aaaditya Ramdas, Sashank Reddi, Barnabás Póczos, Aarti Singh, and Larry Wasserman. Adaptivity and Computation-Statistics Tradeoffs for Kernel and Distance based High Dimensional Two Sample Testing, 2015a. arXiv:1508.00655.
185
+
186
+ Aaditya Ramdas, Sashank J. Reddi, Barnabás Póczos, Aarti Singh, and Larry Wasserman. On the decreasing power of kernel and distance based nonparametric hypothesis tests in high dimensions. In AAAI Conference on Artificial Intelligence, 2015b. arXiv:1406.2083.
187
+
188
+ Aaditya Ramdas, Aarti Singh, and Larry Wasserman. Classification accuracy as a proxy for two sample testing, 2016. arXiv:1602.02210.
189
+
190
+ Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training GANs. In Advances in Neural Information Processing Systems, 2016. arXiv:1606.03498.
191
+
192
+ Robert J. Serfling. Approximation Theorems of Mathematical Statistics. John Wiley & Sons, 1980.
193
+
194
+ Soeren Sonnenburg, Heiko Strathmann, Sergey Lisitsyn, Viktor Gal, Fernando J. Iglesias García, Wu Lin, Chiyuan Zhang, Soumyajit De, frx, tklein23, Evgeniy Andreev, JonasBehr, sploving, Parijat Mazumdar, Christian Widmer, Abhijeet Kislay, Kevin Hughes, Roman Votyakov, khalednasr, Saurabh Mahindre, Alesis Novik, Abinash Panda, Evangelos Anagnostopoulos, Liang Pang, serialhex, Alex Binder, Sanuj Sharma, Michal Uˇricᡠˇr, Björn Esser, and Daniel Pyrathon. shogun: Shogun 4.1.0 - tajinohi no agatamori, May 2016.
195
+
196
+ Bharath K. Sriperumbudur, Kenji Fukumizu, Arthur Gretton, Gert R. G. Lanckriet, and Bernhard Schölkopf. Kernel choice and classifiability for RKHS embeddings of probability distributions. In Advances in Neural Information Processing Systems, 2009.
197
+
198
+ Bharath K. Sriperumbudur, Arthur Gretton, Kenji Fukumizu, Gert R. G. Lanckriet, and Bernhard Schölkopf. Hilbert space embeddings and metrics on probability measures. Journal of Machine Learning Research, 11:1517–1561, 2010.
199
+
200
+ Bharath K. Sriperumbudur, Kenji Fukumizu, Arthur Gretton, Bernhard Schölkopf, and Gert R. G. Lanckriet. On the empirical estimation of integral probability metrics. Electronic Journal of Statistics, 6:1550–1599, 2012.
201
+
202
+ Heiko Strathmann. Adaptive Large-Scale Kernel Two-Sample Testing. M.Sc. thesis, University College London, 2012.
203
+
204
+ Masashi Sugiyama, Taiji Suzuki, Yuta Itoh, Takafumi Kanamori, and Manabu Kimura. Least-squares two-sample test. Neural Networks, 24(7):735–751, sep 2011.
205
+
206
+ Danica J. Sutherland. Unbiased estimators for the variance of MMD estimators, 2019. arXiv:1906.02104.
207
+
208
+ Lucas Theis, Aäron van den Oord, and Matthias Bethge. A note on the evaluation of generative models. In International Conference on Learning Representations, 2016. arXiv:1511.01844.
209
+
210
+ Larry Wasserman. All of Nonparametric Statistics. Springer, 2006.
211
+
212
+ # A VARIANCE OF THE PAIRWISE MMD ESTIMATOR
213
+
214
+ The publication version of this appendix contained some small mistakes. Please refer instead to Sutherland (2019); in particular, the estimator (5) is equivalent to (4) of that document.
md/train/HJWLfGWRb/HJWLfGWRb.md ADDED
@@ -0,0 +1,264 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MATRIX CAPSULES WITH EM ROUTING
2
+
3
+ Geoffrey Hinton, Sara Sabour, Nicholas Frosst
4
+ Google Brain
5
+ Toronto, Canada
6
+ {geoffhinton, sasabour, frosst}@google.com
7
+
8
+ # ABSTRACT
9
+
10
+ A capsule is a group of neurons whose outputs represent different properties of the same entity. Each layer in a capsule network contains many capsules. We describe a version of capsules in which each capsule has a logistic unit to represent the presence of an entity and a $4 \mathbf { x } 4$ matrix which could learn to represent the relationship between that entity and the viewer (the pose). A capsule in one layer votes for the pose matrix of many different capsules in the layer above by multiplying its own pose matrix by trainable viewpoint-invariant transformation matrices that could learn to represent part-whole relationships. Each of these votes is weighted by an assignment coefficient. These coefficients are iteratively updated for each image using the Expectation-Maximization algorithm such that the output of each capsule is routed to a capsule in the layer above that receives a cluster of similar votes. The transformation matrices are trained discriminatively by backpropagating through the unrolled iterations of EM between each pair of adjacent capsule layers. On the smallNORB benchmark, capsules reduce the number of test errors by $45 \%$ compared to the state-of-the-art. Capsules also show far more resistance to white box adversarial attacks than our baseline convolutional neural network.
11
+
12
+ # 1 INTRODUCTION
13
+
14
+ Convolutional neural nets are based on the simple fact that a vision system needs to use the same knowledge at all locations in the image. This is achieved by tying the weights of feature detectors so that features learned at one location are available at other locations. Convolutional capsules extend the sharing of knowledge across locations to include knowledge about the part-whole relationships that characterize a familiar shape. Viewpoint changes have complicated effects on pixel intensities but simple, linear effects on the pose matrix that represents the relationship between an object or object-part and the viewer. The aim of capsules is to make good use of this underlying linearity, both for dealing with viewpoint variations and for improving segmentation decisions.
15
+
16
+ Capsules use high-dimensional coincidence filtering: a familiar object can be detected by looking for agreement between votes for its pose matrix. These votes come from parts that have already been detected. A part produces a vote by multiplying its own pose matrix by a learned transformation matrix that represents the viewpoint invariant relationship between the part and the whole. As the viewpoint changes, the pose matrices of the parts and the whole will change in a coordinated way so that any agreement between votes from different parts will persist.
17
+
18
+ Finding tight clusters of high-dimensional votes that agree in a mist of irrelevant votes is one way of solving the problem of assigning parts to wholes. This is non-trivial because we cannot grid the high-dimensional pose space in the way the low-dimensional translation space is gridded to facilitate convolutions. To solve this challenge, we use a fast iterative process called “routingby-agreement” that updates the probability with which a part is assigned to a whole based on the proximity of the vote coming from that part to the votes coming from other parts that are assigned to that whole. This is a powerful segmentation principle that allows knowledge of familiar shapes to derive segmentation, rather than just using low-level cues such as proximity or agreement in color or velocity. An important difference between capsules and standard neural nets is that the activation of a capsule is based on a comparison between multiple incoming pose predictions whereas in a standard neural net it is based on a comparison between a single incoming activity vector and a learned weight vector.
19
+
20
+ # 2 HOW CAPSULES WORK
21
+
22
+ Neural nets typically use simple non-linearities in which a non-linear function is applied to the scalar output of a linear filter. They may also use softmax non-linearities that convert a whole vector of logits into a vector of probabilities. Capsules use a much more complicated non-linearity that converts the whole set of activation probabilities and poses of the capsules in one layer into the activation probabilities and poses of capsules in the next layer.
23
+
24
+ A capsule network consists of several layers of capsules. The set of capsules in layer $L$ is denoted as $\Omega _ { L }$ . Each capsule has a 4x4 pose matrix, $M$ , and an activation probability, $a$ . These are like the activities in a standard neural net: they depend on the current input and are not stored. In between each capsule $i$ in layer $L$ and each capsule $j$ in layer $L + 1$ is a 4x4 trainable transformation matrix, $W _ { i j }$ . These $W _ { i j } { \bf s }$ (and two learned biases per capsule) are the only stored parameters and they are learned discriminatively. The pose matrix of capsule $i$ is transformed by $W _ { i j }$ to cast a vote $V _ { i j } = M _ { i } W _ { i j }$ for the pose matrix of capsule $j$ . The poses and activations of all the capsules in layer $L + 1$ are calculated by using a non-linear routing procedure which gets as input $V _ { i j }$ and $a _ { i }$ for all $i \in \Omega _ { L } , j \in \Omega _ { L + 1 }$ .
25
+
26
+ The non-linear procedure is a version of the Expectation-Maximization procedure. It iteratively adjusts the means, variances, and activation probabilities of the capsules in layer $L + 1$ and the assignment probabilities between all $i \in \Omega _ { L } , j \in \Omega _ { L + 1 }$ . In appendix 1, we give a gentle intuitive introduction to routing-by-agreement and describe in detail how it relates to the EM algorithm for fitting a mixture of Gaussians.
27
+
28
+ # 3 USING EM FOR ROUTING-BY-AGREEMENT
29
+
30
+ Let us suppose that we have already decided on the poses and activation probabilities of all the capsules in a layer and we now want to decide which capsules to activate in the layer above and how to assign each active lower-level capsule to one active higher-level capsule. Each capsule in the higher-layer corresponds to a Gaussian and the pose of each active capsule in the lower-layer (converted to a vector) corresponds to a data-point (or a fraction of a data-point if the capsule is partially active).
31
+
32
+ Using the minimum description length principle we have a choice when deciding whether or not to activate a higher-level capsule. Choice 0: if we do not activate it, we must pay a fixed cost of $- \beta _ { u }$ per data-point for describing the poses of all the lower-level capsules that are assigned to the higher-level capsule. This cost is the negative log probability density of the data-point under an improper uniform prior. For fractional assignments we pay that fraction of the fixed cost. Choice 1: if we do activate the higher-level capsule we must pay a fixed cost of $- \beta _ { a }$ for coding its mean and variance and the fact that it is active and then pay additional costs, pro-rated by the assignment probabilities, for describing the discrepancies between the lower-level means and the values predicted for them when the mean of the higher-level capsule is used to predict them via the inverse of the transformation matrix. A much simpler way to compute the cost of describing a datapoint is to use the negative log probability density of that datapoint’s vote under the Gaussian distribution fitted by whatever higher-level capsule it gets assigned to. This is incorrect for reasons explained in appendix 1, but we use it because it requires much less computation (also explained in the appendix). The difference in cost between choice 0 and choice 1, is then put through the logistic function on each iteration to determine the higher-level capsule’s activation probability. Appendix 1 explains why the logistic is the correct function to use.
33
+
34
+ Using our efficient approximation for choice 1 above, the incremental cost of explaining a whole data-point $i$ by using an active capsule $j$ that has an axis-aligned covariance matrix is simply the sum over all dimensions of the cost of explaining each dimension, $h$ , of the vote $V _ { i j }$ . This is simply $- l n ( P _ { i | j } ^ { h } )$ where $P _ { i | j } ^ { h }$ is the probability density of the $h ^ { t h }$ component of the vectorized vote $V _ { i j }$ under $j$ ’s Gaussian model for dimension $h$ which has variance $( \sigma _ { j } ^ { h } ) ^ { 2 }$ and mean $\mu _ { j } ^ { h }$ where $\mu _ { j }$ is the vectorized version of $j$ ’s pose matrix $M _ { j }$ .
35
+
36
+ $$
37
+ { \bf \Phi } _ { i \vert j } ^ { o h } = \frac { 1 } { \sqrt { 2 \pi ( \sigma _ { j } ^ { h } ) ^ { 2 } } } \exp \left( - \frac { ( V _ { i j } ^ { h } - \mu _ { j } ^ { h } ) ^ { 2 } } { 2 ( \sigma _ { j } ^ { h } ) ^ { 2 } } \right) , \quad \quad \quad l n ( P _ { i \vert j } ^ { h } ) = - \frac { ( V _ { i j } ^ { h } - \mu _ { j } ^ { h } ) ^ { 2 } } { 2 ( \sigma _ { j } ^ { h } ) ^ { 2 } } - l n ( \sigma _ { j } ^ { h } ) - l n ( 2 \pi ) / 2
38
+ $$
39
+
40
+ Summing over all lower-level capsules for a single dimension, $h$ , of $j$ we get:
41
+
42
+ $$
43
+ \begin{array} { l } { { c o s t _ { j } ^ { h } = \displaystyle \sum _ { i } - r _ { i j } l n ( P _ { i | j } ^ { h } ) } } \\ { { = \displaystyle \frac { \sum _ { i } r _ { i j } ( V _ { i j } ^ { h } - \mu _ { j } ^ { h } ) ^ { 2 } } { 2 ( \sigma _ { j } ^ { h } ) ^ { 2 } } + \left( l n ( \sigma _ { j } ^ { h } ) + \displaystyle \frac { l n ( 2 \pi ) } { 2 } \right) \sum _ { i } r _ { i j } } } \\ { { = \left( l n ( \sigma _ { j } ^ { h } ) + \displaystyle \frac { 1 } { 2 } + \frac { l n ( 2 \pi ) } { 2 } \right) \sum _ { i } r _ { i j } } } \end{array}
44
+ $$
45
+
46
+ where $\sum _ { i } r _ { i j }$ is the amount of data assigned to $j$ and $V _ { i j } ^ { h }$ is the value on dimension $h$ of $V _ { i j }$ . Turningon capsule $j$ increases the description length for the means of the lower-level capsules assigned to $j$ from $- \beta _ { u }$ per lower-level capsule to $- \beta _ { a }$ plus the sum of the cost over all dimensions so we define the activation function of capsule $j$ to be:
47
+
48
+ $$
49
+ a _ { j } = l o g i s t i c \left( \lambda \left( \beta _ { a } - \beta _ { u } \sum _ { i } r _ { i j } - \sum _ { h } c o s t _ { j } ^ { h } \right) \right)
50
+ $$
51
+
52
+ where $\beta _ { a }$ is the same for all capsules and $\lambda$ is an inverse temperature parameter. We learn $\beta _ { a }$ and $\beta _ { u }$ discriminatively and set a fixed schedule for $\lambda$ as a hyper-parameter.
53
+
54
+ For finalizing the pose parameters and activations of the capsules in layer $L + 1$ we run the EM algorithm for few iterations (normally 3) after the pose parameters and activations have already been finalized in layer $L$ . The non-linearity implemented by a whole capsule layer is a form of cluster finding using the EM algorithm, so we call it EM Routing.
55
+
56
+ Procedure 1 Routing algorithm returns activation and pose of the capsules in layer $L + 1$ given the activations and votes of capsules in layer $L$ . $V _ { i j } ^ { h }$ is the $h ^ { t h }$ dimension of the vote from capsule $i$ with activation $a _ { i }$ in layer $L$ to capsule $j$ in layer $\boldsymbol { L } + 1$ . $\beta _ { a }$ , $\beta _ { u }$ are learned discriminatively and the inverse temperature $\lambda$ increases at each iteration with a fixed schedule.
57
+
58
+ <table><tr><td colspan="2">1: procedure EM RoUTING(a, V)</td></tr><tr><td>2:</td><td>∀i∈ΩL,j∈ΩL+1:Rij←1/|ΩL+1l</td></tr><tr><td>3:</td><td>for t iterations do</td></tr><tr><td>4:</td><td>∀j ∈ ΩL+1: M-STEP(a,R,V,j)</td></tr><tr><td>5: return a, M</td><td>∀i∈ΩL:E-STEP(μ,σ,a,V,i)</td></tr><tr><td>1: procedure M-sTEP(a,R, V, j)</td><td>for one higher-level capsule, j</td></tr><tr><td>2:</td><td>∀i∈ΩL:Rij ←Rij *ai</td></tr><tr><td>3:</td><td>Ah:←RV ∑Rij</td></tr><tr><td>4:</td><td>Vh:(o)²∑Rij(V-μ)²</td></tr><tr><td>5:</td><td>∑Rij costh ←(βu+log(o))∑Rij</td></tr><tr><td>6:</td><td>aj ← logistic(λ(βa -∑ncostʰ))</td></tr><tr><td>1: procedure E-STEP(μ,σ,a,V,i)</td><td></td></tr><tr><td>1</td><td>&gt;for one lower-level capsule, i H exp £h</td></tr><tr><td>2: ∀j ∈ΩL+1: Pj ← √II 2π()2</td><td>2()</td></tr><tr><td>3:</td><td>j ∈ΩL+1: Rij ← ∑κeΩL+1 ajpj akPk</td></tr></table>
59
+
60
+ # 4 THE CAPSULES ARCHITECTURE
61
+
62
+ The general architecture of our model is shown in Fig. 1. The model starts with a 5x5 convolutional layer with 32 channels $\scriptstyle ( \mathrm { A } = 3 2 )$ and a stride of 2 with a ReLU non-linearity. All the other layers are capsule layers starting with the primary capsule layer. The 4x4 pose of each of the $\scriptstyle \mathbf { B } = 3 2$ primary capsule types is a learned linear transformation of the output of all the lower-layer ReLUs centered at that location. The activations of the primary capsules are produced by applying the sigmoid function to the weighted sums of the same set of lower-layer ReLUs.
63
+
64
+ ![](images/a2c6d4f8620b305d4fa78a8a298083d07d8afb958f0e06f571bd0bde4277aca1.jpg)
65
+ Figure 1: A network with one ReLU convolutional layer followed by a primary convolutional capsule layer and two more convolutional capsule layers.
66
+
67
+ The primary capsules are followed by two $3 { \bf x } 3$ convolutional capsule layers $\left( \mathrm { K } \mathrm { = } 3 \right)$ , each with 32 capsule types $\mathrm { ( C = D } { = } 3 2$ ) with strides of 2 and one, respectively. The last layer of convolutional capsules is connected to the final capsule layer which has one capsule per output class.
68
+
69
+ When connecting the last convolutional capsule layer to the final layer we do not want to throw away information about the location of the convolutional capsules but we also want to make use of the fact that all capsules of the same type are extracting the same entity at different positions. We therefore share the transformation matrices between different positions of the same capsule type and add the scaled coordinate (row, column) of the center of the receptive field of each capsule to the first two elements of the right-hand column of its vote matrix. We refer to this technique as Coordinate Addition. This should encourage the shared final transformations to produce values for those two elements that represent the fine position of the entity relative to the center of the capsule’s receptive field.
70
+
71
+ The routing procedure is used between each adjacent pair of capsule layers. For convolutional capsules, each capsule in layer $L + 1$ sends feedback only to capsules within its receptive field in layer $L$ . Therefore each convolutional instance of a capsule in layer $L$ receives at most kernel size X kernel size feedback from each capsule type in layer $L + 1$ . The instances closer to the border of the image receive fewer feedbacks with corner ones receiving only one feedback per capsule type in layer $L + 1$ .
72
+
73
+ # 4.1 SPREAD LOSS
74
+
75
+ In order to make the training less sensitive to the initialization and hyper-parameters of the model, we use “spread loss” to directly maximize the gap between the activation of the target class $\left( { { a } _ { t } } \right)$ and the activation of the other classes. If the activation of a wrong class, $a _ { i }$ , is closer than the margin, $m$ , to $a _ { t }$ then it is penalized by the squared distance to the margin:
76
+
77
+ $$
78
+ L _ { i } = ( m a x ( 0 , m - ( a _ { t } - a _ { i } ) ) ^ { 2 } , L = \sum _ { i \neq t } L _ { i }
79
+ $$
80
+
81
+ By starting with a small margin of 0.2 and linearly increasing it during training to 0.9, we avoid dead capsules in the earlier layers. Spread loss is equivalent to squared Hinge loss with $m = 1$ . Guermeur & Monfrini (2011) studies a variant of this loss in the context of multi class SVMs.
82
+
83
+ # 5 EXPERIMENTS
84
+
85
+ The smallNORB dataset (LeCun et al. (2004)) has gray-level stereo images of 5 classes of toys: airplanes, cars, trucks, humans and animals. There are 10 physical instances of each class which are painted matte green. 5 physical instances of a class are selected for the training data and the other 5 for the test data. Every individual toy is pictured at 18 different azimuths (0-340), 9 elevations and 6 lighting conditions, so the training and test sets each contain 24,300 stereo pairs of 96x96 images. We selected smallNORB as a benchmark for developing our capsules system because it is carefully designed to be a pure shape recognition task that is not confounded by context and color, but it is much closer to natural images than MNIST.
86
+
87
+ Table 1: The effect of varying different components of our capsules architecture on smallNORB.
88
+
89
+ <table><tr><td>Routing iterations</td><td>Pose structure</td><td>Loss</td><td>Coordinate Addition</td><td>Test error rate</td></tr><tr><td>1</td><td>Matrix</td><td>Spread</td><td>Yes</td><td>9.7%</td></tr><tr><td>2</td><td>Matrix</td><td>Spread</td><td>Yes</td><td>2.2%</td></tr><tr><td>3</td><td>Matrix</td><td>Spread</td><td>Yes</td><td>1.8%</td></tr><tr><td>5</td><td>Matrix</td><td>Spread</td><td>Yes</td><td>3.9%</td></tr><tr><td>3</td><td>Vector</td><td>Spread</td><td>Yes</td><td>2.9%</td></tr><tr><td>3</td><td>Matrix</td><td>Spread</td><td>No</td><td>2.6%</td></tr><tr><td>3</td><td>Vector</td><td>Spread</td><td>No</td><td>3.2%</td></tr><tr><td>3</td><td>Matrix</td><td>Margin1</td><td>Yes</td><td>3.2%</td></tr><tr><td>3</td><td>Matrix</td><td>CrossEnt</td><td>Yes</td><td>5.8%</td></tr><tr><td colspan="3">Baseline CNN with 4.2M parameters</td><td></td><td>5.2%</td></tr><tr><td colspan="4">CNN of Ciresan et al. (2O11) with extra input images &amp; deformations</td><td>2.56%</td></tr><tr><td colspan="3">Our Best model (third row), with multiple crops during testing</td><td></td><td>1.4%</td></tr></table>
90
+
91
+ We downsample smallNORB to $4 8 \times 4 8$ pixels and normalize each image to have zero mean and unit variance. During training, we randomly crop $3 2 \times 3 2$ patches and add random brightness and contrast to the cropped images. During test, we crop a $3 2 \times 3 2$ patch from the center of the image and achieve $\mathbf { 1 . 8 \% }$ test error on smallNORB. If we average the class activations over multiple crops at test time we achieve $1 . 4 \%$ . The best reported result on smallNORB without using meta data is $2 . 5 6 \%$ (Cires¸an et al. (2011)). To achieve this, they added two additional stereo pairs of input images that are created by using an on-center off-surround filter and an off-center on-surround filter. They also applied affine distortions to the images. Our work also beats the Sabour et al. (2017) capsule work which achieves $2 . 7 \%$ on smallNORB. We also tested our model on NORB which is a jittered version of smallNORB with added background and we achieved a $2 . 6 \%$ error rate which is on par with the state-of-the-art of $2 . 7 \%$ (Ciresan et al. (2012)).
92
+
93
+ As the baseline for our experiments on generalization to novel viewpoints we train a CNN which has two convolutional layers with 32 and 64 channels respectively. Both layers have a kernel size of 5 and a stride of 1 with a $2 \times 2$ max pooling. The third layer is a 1024 unit fully connected layer with dropout and connects to the 5-way softmax output layer. All hidden units use the ReLU non-linearity. We use the same image preparation for the CNN baseline as described above for the capsule network. Our baseline CNN was the result of an extensive hyperparameter search over filter sizes, numbers of channels and learning rates.
94
+
95
+ The CNN baseline achieves $5 . 2 \%$ test error rate on smallNORB and has $4 . 2 \mathbf { M }$ parameters. We deduce that the Cires¸an et al. (2011) network has $2 . 7 \mathbf { M }$ parameters. By using small matrix multiplies, we reduced the number of parameters by a factor of 15 to 310K compared with our baseline CNN (and a factor of 9 w.r.t Cires¸an et al. (2011)). A smaller capsule network of $A = 6 4 , B = 8 , C =$ $D = 1 6$ with only 68K trainable parameters achieves $2 . 2 \%$ test error rate which also beats the prior state-of-the-art.
96
+
97
+ Fig. 2 shows how EM routing adjusts the vote assignments and the capsule means to find the tight clusters in the votes. The histograms show the distribution of vote distances to the mean (pose) of each class capsule during routing iterations. At the first iteration, votes are distributed equally between 5 final layer capsules. Therefore, all capsules receive votes closer than 0.05 to their calculated mean. In the second iteration, the assignment probability for agreeing votes increases. Therefore, most of the votes are assigned to the detected clusters, the animal and human class in the middle row, and the other capsules only receive scattered votes which are further than 0.05 from the calculated mean. The zoomed-out version of Fig. 2 in the Appendix shows the full distribution of vote distances at each routing iteration.
98
+
99
+ Instead of using our MDL-derived capsule activation term which computes a separate activation probability per capsule, we could view the capsule activations like the mixing proportions in a mixture of Gaussians and set them to be proportional to the sum of the assignment probabilities of a capsule and to sum to 1 over all the capsules in a layer. This increases the test error rate on smallNORB to $4 . 5 \%$ . Tab. 1 summarizes the effects of the number of routing iterations, the type of loss, and the use of matrices rather than vectors for the poses.
100
+
101
+ ![](images/8be3ea0bab1e25a6aa71bd0340609a27c13551bcb7eab555f8c2f16e24393e2e.jpg)
102
+ Figure 2: Histogram of distances of votes to the mean of each of the 5 final capsules after each routing iteration. Each distance point is weighted by its assignment probability. All three images are selected from the smallNORB test set. The routing procedure correctly routes the votes in the truck and the human example. The plane example shows a rare failure case of the model where the plane is confused with a car in the third routing iteration. The histograms are zoomed-in to visualize only votes with distances less than 0.05. Fig. B.2 shows the complete histograms for the ”human” capsule without clipping the $\mathbf { X } ^ { } -$ -axis or fixing the scale of the y-axis.
103
+
104
+ Table 2: A comparison of the smallNORB test error rate of the baseline CNN and the capsules model on novel viewpoints when both models are matched on error rate for familiar viewpoints.
105
+
106
+ <table><tr><td rowspan="2">Test set</td><td colspan="2">Azimuth</td><td colspan="2">Elevation</td></tr><tr><td>CNN</td><td>Capsules</td><td>1 CNN</td><td>Capsules</td></tr><tr><td>Novel viewpoints</td><td>20%</td><td>13.5%</td><td>17.8%</td><td>12.3%</td></tr><tr><td>Familiar viewpoints</td><td>3.7%</td><td>3.7%</td><td>4.3%</td><td>4.3%</td></tr></table>
107
+
108
+ The same capsules architecture as Fig. 1 achieves $0 . 4 4 \%$ test error rate on MNIST. If the number of channels in the first hidden layer is increased to 256, it achieves $1 1 . 9 \%$ test error rate on Cifar10 (Krizhevsky & Hinton (2009)).
109
+
110
+ # 5.1 GENERALIZATION TO NOVEL VIEWPOINTS
111
+
112
+ A more severe test of generalization is to use a limited range of viewpoints for training and to test on a much wider range. We trained both our convolutional baseline and our capsule model on one-third of the training data containing azimuths of (300, 320, 340, 0, 20, 40) and tested on the two-thirds of the test data that contained azimuths from 60 to 280. In a separate experiment, we trained on the 3 smaller elevations and tested on the 6 larger elevations.
113
+
114
+ It is hard to decide if the capsules model is better at generalizing to novel viewpoints because it achieves better test accuracy on all viewpoints. To eliminate this confounding factor, we stopped training the capsule model when its performance matched the baseline CNN on the third of the test set that used the training viewpoints. Then, we compared these matched models on the twothirds of the test set with novel viewpoints. Results in Tab. 2 show that compared with the baseline CNN capsules with matched performance on familiar viewpoints reduce the test error rate on novel viewpoints by about $3 0 \%$ for both novel azimuths and novel elevations.
115
+
116
+ # 6 ADVERSARIAL ROBUSTNESS
117
+
118
+ There is growing interest in the vulnerability of neural networks to adversarial examples; inputs that have been slightly changed by an attacker to trick a neural net classifier into making the wrong classification. These inputs can be created in a variety of ways, but straightforward strategies such as FGSM (Goodfellow et al. (2014)) have been shown to drastically decrease accuracy in convolutional neural networks on image classification tasks. We compare our capsule model and a traditional convolutional model on their ability to withstand such attacks.
119
+
120
+ FGSM computes the gradient of the loss w.r.t. each pixel intensity and then changes the pixel intensity by a fixed amount $\epsilon$ in the direction that increases the loss. So the changes only depend on the sign of the gradient at each pixel. This can be extended to a targeted attack by updating the input to maximize the classification probability of a particular wrong class. We generated adversarial attacks using FGSM because it has only one hyper-parameter and it is easy to compare models that have very different gradient magnitudes. To test the robustness of our model, we generated adversarial images from the test set using a fully trained model. We then reported the accuracy of the model on these images.
121
+
122
+ We found that our model is significantly less vulnerable to both general and targeted FGSM adversarial attacks; a small $\epsilon$ can be used to reduce a convolutional model’s accuracy much more than an equivalent $\epsilon$ can on the capsule model (Fig. 3). It should also be noted that the capsule model’s accuracy after the untargeted attack never drops below chance $( 2 0 \% )$ whereas the convolutional model’s accuracy is reduced to significantly below chance with an $\epsilon$ as small as 0.2.
123
+
124
+ We also tested our model on the slightly more sophisticated adversarial attack of the Basic Iterative Method (Kurakin et al. (2016)), which is simply the aforementioned attack except it takes multiple smaller steps when creating the adversarial image. Here too we find that our model is much more robust to the attack than the traditional convolutional model.
125
+
126
+ ![](images/beef58cad854849bc8c253f9108a4d2c51f1152db1fc48d7ca3c09464317b0d7.jpg)
127
+ Figure 3: Accuracy against $\epsilon$ after an adversarial attack (left) and Success Rate after a targeted adversarial attack (right). The targeted attack results were evaluated by averaging the success rate after the attack for each of the 5 possible classes.
128
+
129
+ It has been shown that some robustness to adversarial attacks in models can be due to simple numerical instability in the calculation of the gradient Brendel & Bethge (2017). To ensure that this was not the sole cause of our model’s robustness, we calculated the percentage of zero values in the gradient with respect to the image in the capsule model and found it to be smaller than that of the CNN. Furthermore, the capsule gradients, although smaller that those of the CNN, are only smaller by 2 orders of magnitude, as opposed to 16 orders of magnitude seen in Brendel & Bethge (2017)’s work.
130
+
131
+ Finally we tested our model’s robustness to black box attacks by generating adversarial examples with a CNN and testing them on both our capsule model and a different CNN. We found that the capsule model did not perform noticeably better at this task than the CNN.
132
+
133
+ # 7 RELATED WORK
134
+
135
+ Among the multiple recent attempts at improving the ability of neural networks to deal with viewpoint variations, there are two main streams. One stream attempts to achieve viewpoint invariance and the other aims for viewpoint equivariance. The work presented by Jaderberg et al. (2015)), Spatial Transformer Networks, seeks viewpoint invariance by changing the sampling of CNNs according to a selection of affine transformations. De Brabandere et al. (2016) extends spatial transformer networks where the filters are adapted during inference depending on the input. They generate different filters for each locality in the feature map rather than applying the same transformation to all filters. Their approach is a step toward input covariance detection from traditional pattern matching frameworks like standard CNNs (LeCun et al. (1990)). Dai et al. (2017) improves upon spatial transformer networks by generalizing the sampling method of filters. Our work differs substantially in that a unit is not activated based on the matching score with a filter (either fixed or dynamically changing during inference). In our case, a capsule is activated only if the transformed poses coming from the layer below match each other. This is a more effective way to capture covariance and leads to models with many fewer parameters that generalize better.
136
+
137
+ The success of CNNs has motivated many researchers to extend the translational equivariance built in to CNNs to include rotational equivariance (Cohen & Welling (2016), Dieleman et al. (2016), Oyallon & Mallat (2015)). The recent approach in Harmonic Networks (Worrall et al. (2017)) achieves rotation equivariant feature maps by using circular harmonic filters and returning both the maximal response and orientation using complex numbers. This shares the basic representational idea of capsules: By assuming that there is only one instance of the entity at a location, we can use several different numbers to represent its properties. They use a fixed number of streams of rotation orders. By enforcing the equality of the sum of rotation orders along any path, they achieve patch-wise rotation equivariance. This approach is more parameter-efficient than data augmentation approaches, duplicating feature maps, or duplicating filters (Fasel & Gatica-Perez (2006), Laptev et al. (2016)). Our approach encodes general viewpoint equivariance rather than only affine 2D rotations. Symmetry networks (Gens & Domingos (2014)) use iterative Lucas-Kanade optimization to find poses that are supported by the most low-level features. Their key weakness is that the iterative algorithm always starts at the same pose, rather than the mean of the bottom-up votes.
138
+
139
+ Lenc & Vedaldi (2016) proposes a feature detection mechanism (DetNet) that is equivariant to affine transformations. DetNet is designed to detect the same points in the image under different viewpoint variations. This effort is orthogonal to our work but DetNet might be a good way to implement the de-rendering first-stage that activates the layer of primary capsules.
140
+
141
+ Our routing algorithm can be seen as an attention mechanism. In this view, it is related to the work of Gregor et al. (2015), where they improved the decoder performance in a generative model by using Gaussian kernels to attend to different parts of the feature map generated by the encoder. Vaswani et al. (2017) uses a softmax attention mechanism to match parts of the query sequence to parts of the input sequence for the translation task and when generating an encoding for the query. They show improvement upon previous translation efforts using recurrent architectures. Our algorithm has attention in the opposite direction. The competition is not between the lower-level capsules that a higher-level capsule might attend to. It is between the higher-level capsules that a lower-level capsule might send its vote to.
142
+
143
+ # 7.1 PREVIOUS WORK ON CAPSULES
144
+
145
+ Hinton et al. (2011) used a transformation matrix in a transforming autoencoder that learned to transform a stereo pair of images into a stereo pair from a slightly different viewpoint. However, that system requires the transformation matrix to be supplied externally. More recently, routing-byagreement was shown to be effective for segmenting highly overlapping digits (Sabour et al. (2017)), but that system has several deficiencies that we have overcome in this paper:
146
+
147
+ 1. It uses the length of the pose vector to represent the probability that the entity represented by a capsule is present. To keep the length less than 1, requires an unprincipled non-linearity and this prevents the existence of any sensible objective function that is minimized by the iterative routing procedure.
148
+ 2. It uses the cosine of the angle between two pose vectors to measure their agreement. Unlike the negative log variance of a Gaussian cluster, the cosine saturates at 1, which makes it insensitive to the difference between a quite good agreement and a very good agreement.
149
+ 3. It uses a vector of length $n$ rather than a matrix with $n$ elements to represent a pose, so its transformation matrices have $n ^ { 2 }$ parameters rather than just $n$ .
150
+
151
+ # 8 CONCLUSION
152
+
153
+ Building on the work of Sabour et al. (2017), we have proposed a new type of capsule system in which each capsule has a logistic unit to represent the presence of an entity and a 4x4 pose matrix to represent the pose of that entity. We also introduced a new iterative routing procedure between capsule layers, based on the EM algorithm, which allows the output of each lower-level capsule to be routed to a capsule in the layer above in such a way that active capsules receive a cluster of similar pose votes. This new system achieves significantly better accuracy on the smallNORB data set than the state-of-the-art CNN, reducing the number of errors by $45 \%$ . We have also shown it to be significantly more robust to white box adversarial attacks than a baseline CNN.
154
+
155
+ SmallNORB is an ideal data-set for developing new shape-recognition models precisely because it lacks many of the additional features of images in the wild. Now that our capsules model works well on NORB, we plan to implement an efficient version to test much larger models on much larger data-sets such as ImageNet.
156
+
157
+ ACKNOWLEDGMENTS Thanks to Robert Gens, Eric Langlois, Taco Cohen and anonymous commentators for helpful discussions and to everyone who made TensorFlow.
158
+
159
+ # REFERENCES
160
+
161
+ Wieland Brendel and Matthias Bethge. Comment on” biologically inspired protection of deep networks from adversarial attacks”. arXiv preprint arXiv:1704.01547, 2017.
162
+
163
+ Dan Ciresan, Ueli Meier, and Jurgen Schmidhuber. Multi-column deep neural networks for image ¨ classification. In Computer Vision and Pattern Recognition (CVPR), 2012 IEEE Conference on, pp. 3642–3649. IEEE, 2012.
164
+
165
+ Dan C Cires¸an, Ueli Meier, Jonathan Masci, Luca M Gambardella, and Jurgen Schmidhuber. High- ¨ performance neural networks for visual object classification. arXiv preprint arXiv:1102.0183, 2011.
166
+
167
+ Taco Cohen and Max Welling. Group equivariant convolutional networks. In International Conference on Machine Learning, pp. 2990–2999, 2016.
168
+
169
+ Jifeng Dai, Haozhi Qi, Yuwen Xiong, Yi Li, Guodong Zhang, Han Hu, and Yichen Wei. Deformable convolutional networks. arXiv preprint arXiv:1703.06211, 2017.
170
+
171
+ Bert De Brabandere, Xu Jia, Tinne Tuytelaars, and Luc Van Gool. Dynamic filter networks. In Neural Information Processing Systems (NIPS), 2016.
172
+
173
+ Sander Dieleman, Jeffrey De Fauw, and Koray Kavukcuoglu. Exploiting cyclic symmetry in convolutional neural networks. In Proceedings of the 33rd International Conference on International Conference on Machine Learning - Volume 48, ICML’16, pp. 1889–1898. JMLR.org, 2016. URL http://dl.acm.org/citation.cfm?id=3045390.3045590.
174
+
175
+ Beat Fasel and Daniel Gatica-Perez. Rotation-invariant neoperceptron. In Pattern Recognition, 2006. ICPR 2006. 18th International Conference on, volume 3, pp. 336–339. IEEE, 2006.
176
+
177
+ Robert Gens and Pedro M Domingos. Deep symmetry networks. In Advances in neural information processing systems, pp. 2537–2545, 2014.
178
+
179
+ Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572, 2014.
180
+
181
+ Karol Gregor, Ivo Danihelka, Alex Graves, Danilo Rezende, and Daan Wierstra. Draw: A recurrent neural network for image generation. In International Conference on Machine Learning, pp. 1462–1471, 2015.
182
+
183
+ Yann Guermeur and Emmanuel Monfrini. A quadratic loss multi-class svm for which a radius– margin bound applies. Informatica, 22(1):73–96, 2011.
184
+
185
+ Geoffrey E Hinton, Alex Krizhevsky, and Sida D Wang. Transforming auto-encoders. In International Conference on Artificial Neural Networks, pp. 44–51. Springer, 2011.
186
+
187
+ Max Jaderberg, Karen Simonyan, Andrew Zisserman, and Koray Kavukcuoglu. Spatial transformer networks. In Advances in Neural Information Processing Systems, pp. 2017–2025, 2015.
188
+
189
+ Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. 2009.
190
+
191
+ Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial examples in the physical world. arXiv preprint arXiv:1607.02533, 2016.
192
+
193
+ Dmitry Laptev, Nikolay Savinov, Joachim M Buhmann, and Marc Pollefeys. Ti-pooling: transformation-invariant pooling for feature learning in convolutional neural networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 289–297, 2016.
194
+
195
+ Yann LeCun, Bernhard E Boser, John S Denker, Donnie Henderson, Richard E Howard, Wayne E Hubbard, and Lawrence D Jackel. Handwritten digit recognition with a back-propagation network. In Advances in neural information processing systems, pp. 396–404, 1990.
196
+
197
+ Yann LeCun, Fu Jie Huang, and Leon Bottou. Learning methods for generic object recognition with invariance to pose and lighting. In Computer Vision and Pattern Recognition, 2004. CVPR 2004. Proceedings of the 2004 IEEE Computer Society Conference on, volume 2, pp. II–104. IEEE, 2004.
198
+
199
+ Karel Lenc and Andrea Vedaldi. Learning covariant feature detectors. In Computer Vision–ECCV 2016 Workshops, pp. 100–117. Springer, 2016.
200
+
201
+ Edouard Oyallon and Stephane Mallat. Deep roto-translation scattering for object classification. ´ In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2865– 2873, 2015.
202
+
203
+ Sara Sabour, Nicholas Fross, and Geoffrey E Hinton. Dynamic routing between capsules. In Neural Information Processing Systems (NIPS), 2017.
204
+
205
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Neural Information Processing Systems (NIPS), 2017.
206
+
207
+ Daniel E. Worrall, Stephan J. Garbin, Daniyar Turmukhambetov, and Gabriel J. Brostow. Harmonic networks: Deep translation and rotation equivariance. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), July 2017.
208
+
209
+ # A APPENDIX 1: AN INTUITIVE EXPLANATION OF THE COST FUNCTION THATIS MINIMIZED DURING DYNAMIC ROUTING
210
+
211
+ Dynamic routing is performed between two adjacent layers of capsules. We will refer to these layers as the higher-level and the lower-level. We complete the routing between one pair of layers before starting the routing between the next pair of layers. The routing process has a strong resemblance to fitting a mixture of Gaussians using EM, where the higher-level capsules play the role of the Gaussians and the means of the activated lower-level capsules for a single input image play the role of the datapoints.
212
+
213
+ We start by explaining the cost function that is minimized when using the EM procedure to fit a mixture of Gaussians. We then derive our dynamic routing procedure by making two modifications to the procedure for fitting a mixture of Gaussians.
214
+
215
+ # A.1 THE COST FUNCTION FOR FITTING A MIXTURE OF GAUSSIANS
216
+
217
+ The EM algorithm for fitting a mixture of Gaussians alternates between an E-step and an M-step. The E-step is used to determine, for each datapoint, the probability with which it is assigned to each of the Gaussians. These assignment probabilities act as weights and the M-step for each Gaussian consists of finding the mean of these weighted datapoints and the variance about that mean. If we are also fitting mixing proportions for each Gaussian, they are set to the fraction of the data assigned to the Gaussian.
218
+
219
+ The M-step holds the assignment probabilities constant and adjusts each Gaussian to maximize the sum of the weighted log probabilities that the Gaussian would generate the datapoints assigned to it. The negative log probability density of a datapoint under a Gaussian can be treated like the energy of a physical system and the M-step is minimizing the expected energy where the expectations are taken using the assignment probabilities.
220
+
221
+ The E-step adjusts the assignment probabilities for each datapoint to minimize a quantity called “free energy” which is the expected energy minus the entropy. We can minimize the expected energy by assigning each datapoint with probabilty 1 to whichever Gaussian gives it the lowest energy (i. e. the highest probability density). We can maximize the entropy by assigning each datapoint with equal probability to every Gaussian ignoring the energy. The best trade-off is to make the assignment probabilities be proportional to $e x p ( - E )$ . This is known as the Boltzmann distribution in physics or the posterior distribution in statistics. Since the $\mathrm { E }$ -step minimizes the free energy w.r.t. the assignment distribution and the M-step leaves the entropy term unchanged and minimizes the expected energy w.r.t. the parameters of the Gaussians, the free energy is an objective function for both steps.
222
+
223
+ The softmax function computes the distribution that minimizes free energy when the logits are viewed as negative energies. So when we use a softmax in our routing procedure to recompute assignment probabilities we are minimizing a free energy. When we refit the Gaussian model of each capsule we are minimizing the same free energy provided the logits of the softmax are based on the same energies as are optimized when refitting the Gaussians. The energies we use are the negative log probabilities of the votes coming from a lower-level capsule under the Gaussian model of a higher-level capsule. These are not the correct energies for maximizing the log probability of the data (see the discussion of determinants below) but this does not matter for convergence so long as we use the same energies for fitting the Gaussians and for revising the assignment probabilities.
224
+
225
+ The objective function minimizes Eq. 4 which consists of:
226
+
227
+ • MDL cost $- \beta _ { a }$ scaled by the probability of presence of capsules in layer $L + 1 ( a _ { j } , j \in$ $\Omega _ { L + 1 } )$ .
228
+ • Negative entropy of activations $a _ { j } , j \in \Omega _ { L + 1 }$ .
229
+ • The expected energy minimized in M-step: sum of the weighted log probabilities $( c o s t _ { j } ^ { h } )$ .
230
+ • Negative entropy of routing softmax assignments $( R _ { i j } )$ ) scaled by the probability of presence of the datapoint $( a _ { i } , i \in \Omega _ { L } )$ .
231
+
232
+ $$
233
+ \sum _ { j \in \Omega _ { L + 1 } } { a _ { j } ( - \beta _ { a } ) } + a _ { j } l n ( a _ { j } ) + ( 1 - a _ { j } ) l n ( 1 - a _ { j } ) + \sum _ { h } { c o s t _ { j } ^ { h } } + \beta _ { u } \sum _ { i \in \Omega _ { L } } { r _ { i j } } + \sum _ { i \in \Omega _ { L } } { a _ { i } * r _ { i j } } * l n ( { r _ { i j } } )
234
+ $$
235
+
236
+ # A.2 MODIFICATION 1: MIXTURES OF TRANSFORMING GAUSSIANS
237
+
238
+ In a standard mixture of Gaussians, each Gaussian only has a subset of the datapoints assigned to it but all of the Gaussians see the same data. If we view the capsules in the higher-layer as the Gaussians and the means of the active capsules in the lower-layer as the dataset, each Gaussian sees a dataset in which the datapoints have been transformed by transformation matrices and these matrices are different for different Gaussians. For one higher-level capsule, two transformed datapoints may be close together and for another higher-level capsule the same two datapoints may be transformed into points that are far apart. Every Gaussian has a different view of the data. This is a far more effective way to break symmetry than simply initializing the Gaussians with different means and it generally leads to much faster convergence.
239
+
240
+ If the fitting procedure is allowed to modify the transformation matrices, there is a trivial solution in which the transformation matrices all collapse to zero and the transformed data points are all identical. We avoid this problem by learning the transformation matrices discriminatively in an outer loop and we restrict the dynamic routing to modifying the means and variances of the Gaussians and the probabilities with which the datapoints are assigned to the Gaussians.
241
+
242
+ There is a more subtle version of the collapse problem that arises when different transformation matrices have different determinants. Suppose that the datapoints in a particular subset are transformed into a cluster of points in the pose space of higher-level capsule $j$ and they are transformed into a different but equally tight cluster of points in the pose space of higher-level capsule $k$ . It may seem that $j$ and $k$ provide equally good models of this subset of the datapoints, but this is not correct from a generative modeling perspective. If the transformation matrices that map the datapoints into the pose space used by capsule $j$ have bigger determinants, then $j$ provides a better model. This is because the probability density of a point in the pose space of a lower-level capsule gets diluted by the determinant of the relevant transformation matrix when it is mapped to the pose of a higherlevel capsule. This would be a serious issue if we wanted to learn the transformation matrices by maximizing the probability of the observed datapoints, but we are learning the transformation matrices discriminatively so it does not matter. It does, however, mean that when the dynamic routing maximizes the probability of the transformed datapoints it cannot be viewed as also maximizing the probability of the untransformed points.
243
+
244
+ The obvious way to avoid the determinant issue is to take the mean in pose space of a higher-level capsule and to map this mean back into the pose space of each lower-level capsule using the inverses of the transformation matrices. A mean in a higher-level pose space will generally map to different points in the pose spaces of different lower-level capsules because the pose of a whole will generally make different predictions for the poses of the different parts of that whole. If we use the lowerlevel pose space when measuring the misfit between the actual pose of a lower-level capsule and the top-down prediction of that pose obtained by applying the inverse transformation matrix to the mean of the higher-level capsule, the collapse problem disappears and we can base decisions about routing on a fair comparison of how well two different top-down predictions fit the actual pose of the lower-level capsule. We do not use this correct method for two reasons. First, it involves inverting the transformation matrices. Second, it requires a new multiplication by the inverse transformation matrices every time the higher-level mean is modified during the dynamic routing. By measuring misfits in the higher-level pose space we avoid matrix inversions and, more importantly, we avoid having to multiply by the inverses in each iteration of the dynamic routing. This allows us to do many iterations of dynamic routing for the same computational cost as one forward propagation through the transformation matrices.
245
+
246
+ # A.3 MODIFICATION 2: MIXTURES OF SWITCHABLE TRANSFORMING GAUSSIANS
247
+
248
+ In a standard mixture of Gaussians, the modifiable parameters are the means, (co)variances, and mixing proportions and the only thing that distinguishes different Gaussians is the values of these parameters. In a mixture of transforming Gaussians, however, Gaussians also differ in the transformation matrices they use. If these transformation matrices are fixed during the fitting of the other parameters, it makes sense to have a large set of transforming Gaussians available but to only use the small subset of them that have appropriate transformation matrices for explaining the data at hand. Fitting to a dataset will then involve deciding which of the transforming Gaussians should be “switched on”. We therefore give each transforming Gaussian an additional activation parameter which is its probability of being switched on for the current dataset. The activation parameters are not mixing proportions because they do not sum to 1.
249
+
250
+ To set the activation probability for a particular higher-level capsule, $j$ , we compare the description lengths of two different ways of coding the poses of the activated lower-level capsules assigned to $j$ by the routing, as described in section 3. “Description length” is just another term for energy. The difference in the two description lengths (in nats) is put through a logistic function to determine the activation probability of capsule $j$ . The logistic function computes the distribution $( p , 1 - p )$ that minimizes free energy when the difference in the energies of the two alternatives is the argument of the logistic function. The energies we use for determining the activation probabilities are the same energies as we use for fitting the Gaussians and computing the assignment probabilities. So all three steps minimize the same free energy but with respect to different parameters for each step.
251
+
252
+ In some of the explanations above we have implicitly assumed that the lower-level capsules have activities of 1 or 0 and the assignment probabilities computed during the dynamic routing are also 1 or 0. In fact, these numbers are both probabilities and we use the product of these two probabilities as a multiplier on both the baseline description length of each lower-level mean and its alternative description length obtained by making use of the Gaussian fitted by a higher-level capsule.
253
+
254
+ # B SUPPLEMENTARY FIGURES
255
+
256
+ ![](images/f93f00c30c72d1121379190595a15099a4a67e12f27f4a9a06010f17d052d406.jpg)
257
+ Figure B.1: Sample smallNORB images at different viewpoints. All images in first row are at azimuth 0 and elevation 0. The second row shows a set of images at a higher-elevation and different azimuth.
258
+
259
+ ![](images/321861167ad93da7ba755cfb32ff47de35eba2b33847857ce9b7947343e7a219.jpg)
260
+ Figure B.2: Log scale histogram of distances between the receiving votes and the center of each of the 5 final capsules. The three rows show the 5 histograms for iterations 1, 2 and 3. Unlike Fig. 2 the histograms are independently log scaled so that small and large counts can both be seen. Also, the considered distance range is 60 and the number of bins is much larger.
261
+
262
+ ![](images/8816d3a83013d88e794acdbae80f4df9d941a6d0449e90bba9d4c43d58c6a99c.jpg)
263
+ Figure B.3: Adverserial images generated with FGSM with $\epsilon = 0 . 1$ and $\epsilon = 0 . 4$ on the CNN model and the Capsule model.
264
+ (a) $\epsilon = 0 . 1$ on CNN (b) $\epsilon = 0 . 4$ on CNN (c) $\epsilon = 0 . 1$ on Capsules (d) $\epsilon = 0 . 4$ on Capsules
md/train/HJYoqzbC-/HJYoqzbC-.md ADDED
@@ -0,0 +1,233 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # A COMPARISON OF SECOND-ORDER METHODS FOR DEEP CONVOLUTIONAL NEURAL NETWORKS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Despite many second-order methods have been proposed to train neural networks, most of the results were done on smaller single layer fully connected networks, so we still cannot conclude whether it’s useful in training deep convolutional networks. In this study, we conduct extensive experiments to answer the question ”whether second-order method is useful for deep learning?”. In our analysis, we find out although currently second-order methods are too slow to be applied in practice, it can reduce training loss in fewer number of iterations compared with SGD. In addition, we have the following interesting findings: (1) When using a large batch size, inexact-Newton methods will converge much faster than SGD. Therefore inexact-Newton method could be a better choice in distributed training of deep networks. (2) Quasi-newton methods are competitive with SGD even when using ReLu activation function (which has no curvature) on residual networks. However, current methods are too sensitive to parameters and not easy to tune for different settings. Therefore, quasi-newton methods with more selfadjusting mechanisms might be more useful than SGD in training deeper networks.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ In training deep neural networks and many other machine learning models, first-order methods have been extensively used. Stochastic Gradient Descent (SGD) method has shown positive results on various tasks in practice. It is very easy to implement and suitable to be applied in large-scale machine learning. However, SGD also has certain disadvantages. Practical success usually comes with laborious work of hyper-parameter searching. Furthermore, pure SGD often struggles to regions of loss surface with largely varying magnitudes of curvature (Dauphin et al., 2014). More importantly, it is very difficult to parallelize SGD—when increasing batch size, it is known that SGD will converge slowly and often obtain a solution with relatively poor generalization error (Keskar et al., 2016; Kawaguchi et al., 2017).
12
+
13
+ Second-order methods, on the other hand, improves the search direction using exact or approximate Hessian. Using curvature information enables such methods to make more progress per step than first-order methods relying solely on the gradient. Unfortunately, it is relatively hard to implement an efficient second-order method for large-scale deep neural networks. As parameters in the model scale up to millions, storing full hessian matrix is simply infeasible. Besides, larger datasets makes calculating exact or approximate hessian over whole dataset impossible. We will need to adopt the same mini-batch scheme as in SGD—using sub-sampled hessian in a data batch to calculate the update direction. Stochastic hessian cannot guarantee the approximated local quadratic problem to be positive semidefinite. Consequently the calculated update direction might not be a descent direction and the guarantee of the faster convergence rate of second-order method might not hold.
14
+
15
+ To overcome these challenges, few second-order methods have been proposed in the literature. Most of these methods can be categorized into into stochastic inexact-Newton methods and stochastic quasi-Newton methods, and both types of methods show certain advantages in their experimental results. However, when we try to answer the question ”whether second-order method is useful for deep learning”, we are still unsure the answer. The reasons are as follows.
16
+
17
+ First, the reported results in previous methods usually are based on reduce of training loss versus number of epochs. But to compute an update direction, these methods incur the extra costs of having to compute second-order information, so overall training time might become too long to really use those methods in practice. We need a comparison of training loss versus training time to evaluate the applicability of second-order methods.
18
+
19
+ More importantly, previous methods are mostly tested on simple networks such as multi-layer fully connected networks rather than deep convolutional network, which is deemed as the standard model in applying neural networks these days. Indeed, a similar study has been conducted before (Ngiam et al., 2011), but models used in the study are mostly shallow autoencoders and only one secondorder method is compared. It is still not obvious to us the advantage of second-order methods and to what extent these methods are useful in training modern deep networks, especially convolutional neural networks.
20
+
21
+ Hence, instead of proposing yet another second-order method, in this study we step back to experiment with some representative second-order methods on two datasets with various settings, and analyze both success and failure cases of second-order methods to conclude the advantages and limits of it. And we hope these information can be used in the future when designing new second-order methods.
22
+
23
+ Through this study, our major findings are as follows.
24
+
25
+ • Second-order methods can achieve better training loss in fewer number of epochs. This confirms that curvature information is still useful when training convolutional networks.
26
+ • Larger batch size benefits inexact-Newton methods more than SGD but not the case for quasi-Newton methods.
27
+ • Currently, second-order methods are too slow to be considered practical in training deep neural networks as compared to SGD.
28
+ • Network structures with zero second-order derivatives will deteriorate performance of inexact-Newton methods but not quasi-Newton methods.
29
+ • Fixed learning rate is not applicable to second-order methods
30
+
31
+ We will review the existing second-order works in the next section, and experimental and analysis will be given subsequently to support our claims above.
32
+
33
+ # 2 EXISTING SECOND-ORDER METHODS
34
+
35
+ Essentially, second-order methods obtain the update direction by minimizing a quadratic approximate function around the current solution, and the update rule can often be written as
36
+
37
+ $$
38
+ w _ { k + 1 } = w _ { k } - \alpha _ { k } H _ { k } { \hat { \nabla } } f ( w _ { k } ) ,
39
+ $$
40
+
41
+ where $H _ { k }$ is the inverse of Hessian or its approximation. For large-scale deep network training, due to the huge amount of parameters, all second-order methods need to approximate the calculation of (1) in certain ways. Based on the approximations they made, second-order methods can be categorized into following types.
42
+
43
+ # 2.1 STOCHASTIC INEXACT-NEWTON METHODS
44
+
45
+ The first family of algorithms, called ”inexact-Newton method”, use exact Hessian inverse as $H _ { k }$ but compute $H _ { k } \nabla f ( w _ { k } )$ inexactly. In (Martens & Sutskever, 2011), a ”Hessian-free” approach is proposed. By using hessian-vector products, Newton updates can be solved by Conjugate Gradient (CG) inexactly, in which the search direction is computed by applying CG to the Newton method, and terminating it once it has made sufficient progress. Hessian-vector products can be computed efficiently using a form of automatic differentiation supported by most popular deep learning frameworks. (Wang et al., 2015) proposed a similar method which solves Newton equation with gradient replaced by linear combination of current and previous gradients. In practice, this method does not show prominent improvement over basic inexact-Newton method; therefore, we choose method in (Martens & Sutskever, 2011) to represent this category.
46
+
47
+ # 2.2 STOCHASTIC QUASI-NEWTON METHODS
48
+
49
+ Recently, several stochastic quasi-Newton algorithms have been developed for large-scale machine learning (Wang et al., 2017; Curtis, 2016; Keskar & Berahas, 2016; Ramamurthy & Duffy, 2016; Byrd et al., 2016). These methods use approximate hessian instead of the real one for (1), and they differ from each other by using different criteria to obtain curvature pairs and different frequencies of updating. Basically, the spirit of Quasi-Newton methods is to obtain a lower per-iteration cost but good enough second-order approximation to have better update per iteration. (Wang et al., 2017) and (Curtis, 2016) modify the BFGS update rule to prevent the updates steps from becoming unbounded values. (Byrd et al., 2016) extends L-BFGS method by decoupling of the parameter updates from the curvature estimation to achieve a better stability when dealing with large-scale problems. (Keskar & Berahas, 2016) further extended this direction by adding more checking conditions to make sure the update direction is likely descendent. In addition, they approximate empirical fisher information matrix instead of hessian matrix. (Ramamurthy & Duffy, 2016) proposed to use rank one approximation in a limited memory version manner. It combines L-SR1 method with either Line Search or Trust Region scheme to optimize the model. Notice that not all methods above are proposed specifically for non-convex problems. But even as proposed in (Keskar & Berahas, 2016) which claims its applicability for non-convex problem, in our implementation we found out the empirical fisher information becomes too small and the corresponding update is negligible. Both (Wang et al., 2017) and (Curtis, 2016) don’t provide large-scale derivation in their methods and to directly implement their method, large size of hessian information needed to be stored, which is in feasible in our experiments. Therefore, we only choose (Byrd et al., 2016) and (Ramamurthy & Duffy, 2016) to represent this category.
50
+
51
+ # 2.3 STOCHASTIC GAUSS-NEWTON METHODS
52
+
53
+ Gauss-Newton is a positive semidefinite approximation to the hessian matrix. In (Botev et al., 2017), an efficient block-diagonal approximation to the Gauss-Newton matrix for multi-layer fully connected networks is proposed. It represents the approximation by Kronecker Product and factorize it to achieve an easier calculation. A similar work was done in (Martens & Grosse, 2015). The difference is that in (Martens & Grosse, 2015), Fisher-information matrix instead of hessian matrix is approximated. Although we want to include this type of optimization methods in comparison, these methods requires dedicate implementation for each type of neural network. When the network contains layers that are not fully connected and possibly with weight sharing, such as convolutional layers, it is hard to exploit the Kronecker product structure to form the Gauss-Newton matrix. Since we are focusing on convolutional neural networks in this paper, we did not take this category into comparison.
54
+
55
+ # 2.4 TRUST-REGION METHODS
56
+
57
+ Trust region methods are another important family of second-order methods. Instead of solving the linear system in (1), they obtain the update direction by minimizing the quadratic approximation around the current solution with the norm constraints. The 2-norm constraint, known as “trust region”, is used to prevent the iterate from moving too far. However, this non-convex quadratic subproblem with bounded constraint is non-trivial to solve for large-scale applications, thus trust region methods have not been studied much for training deep networks. Similar to trust region method, cubic regularization method (Nesterov & Polyak, 2006) solves a similar subproblem but replaces the bounded constraints by cubic regularization. Just before submitting this work, a recent paper (Xu et al., 2017b;a) on arXiv tested a trust region method and cubic regularization method on multi-layer perceptons, but it has not been applied to convolutional neural network. We will try to include this type of methods into comparison in the future.
58
+
59
+ # 3 EXPERIMENTAL SETUPS
60
+
61
+ # 3.1 DATASETS
62
+
63
+ We will use MNIST and CIFAR-10 datasets in the experiments. MNIST consists of 60,000 1x28x28 images of hand-written digits. In this study, we report results based on all 60,000 images including both training and validation sets. CIFAR-10 dataset consists of $6 0 , 0 0 0 \ 3 \mathrm { x } 3 2 \mathrm { x } 3 2$ colour images in 10 classes, with 6,000 images per class. We follow the same setting as provided with 50,000 training images and 10,000 test images. There are many data augmentation methods mentioned in the literature; however, as our analysis focuses more on optimization rather than achieving highest accuracy, we didn’t augment datasets.
64
+
65
+ Table 1: Testing accuracy achieved by SGD for eahc model.
66
+
67
+ <table><tr><td></td><td>MNIST</td><td>CIFAR-10</td></tr><tr><td>LeNet</td><td>99.2</td><td>69</td></tr><tr><td>AlexNet</td><td>99.4</td><td>77.48</td></tr><tr><td>DRN</td><td>99.3</td><td>82.3</td></tr></table>
68
+
69
+ # 3.2 MODELS
70
+
71
+ In this study, we are interested in analyzing performance of second-order methods on convolutional neural networks. We first start with the basic LeNet5 (LeCun et al., 1995), and then test results with AlexNet (Krizhevsky et al., 2012), which can be thought as adding more layer of convolutions with larger number of filters. Last, we evaluate optimization methods on latest 18-layer Deep Residual Network(DRN) (He et al., 2016). For LeNet, we have 2 convolutional layers with 20 and $5 0 ~ 5 \mathrm { x } 5$ filters. For AlexNet, 3 convolutional layers with 64, 64, 128 5x5 filters are used. For DRN, we follow the same implementation as listed in (He et al., 2016). Best testing accuracy achieved by fixed learning rate SGD for each model is listed in Table 1.
72
+
73
+ Notice that there are certain different settings we used as compared to standard deep neural networks. First, the nonlinear activation unit used in all our implementations except few designed experiments is tanh instead of ReLu. As we will show in the following discussions, ReLu will cause the vanishing second-order information and thus prohibit the training with stochastic inexact-Newton methods. Second, we used fixed learning rate of SGD instead of having a decaying schedule. As this study mainly wants to investigate the effectiveness of second-order information over first-order gradients, we stick to the most basic usage of first-order method.
74
+
75
+ Finally, we restrict ourselves to SGD without momentum since our goal is to study whether secondorder information is useful. Because of these reasons and no data augmentation, our reported best test accuracy might not be the same as in the literature. We verified that with decaying schedule, data augmentation and momentum used, our DRN implementation on CIFAR-10 can achieve around $9 3 \%$ test accuracy and this is almost the same as in (He et al., 2016).
76
+
77
+ # 3.3 OPTIMIZATION METHODS
78
+
79
+ We will compare SGD with one inexact-Newton method and two quasi-Newton methods. For inexact-Newton method, we compare with the hessian-free method proposed in (Martens & Sutskever, 2011), which uses Stochastic Hessian and full Gradient (SHG), and compute the update direction by conjugate gradient method. Computation of full gradient is time-consuming and sometimes is not necessary when applying this method. On MNIST with LeNet model, we show in Figure 1 that SHG with larger full gradient used is indeed better, but it’s not significantly better than only partial gradients. Therefore, in our experiment when applying SHG we will only use $2 0 \%$ of data to compute the gradient. For quasi-Newton method, we use L-SR1 (SR1) (Ramamurthy & Duffy, 2016) and Stochastic Quasi-Newton method (SQN) (Bollapragada et al., 2016) as representative. In this study, results are based on selecting batch size as 100 except for certain designed experiments. As we are trying to understand the best applicability of each method, all the hyper-parameters are tuned to achieve the best possible results.
80
+
81
+ # 3.4 FIX LEARNING RATE VERSUS LINE SEARCH
82
+
83
+ While in (Byrd et al., 2016) a decaying schedule $1 / k$ ,where $\mathbf { k }$ is the current number of iteration, is proposed to be the step size of each update, in practice we find out this scheme does not work on most of our experiments. Instead, we improve the stability by applying line search to find out the
84
+
85
+ ![](images/b59153e177dc1e92dcd9b117b4555c7a9632a2f00d40b3ed70354a30cb3db724.jpg)
86
+ Figure 1: Percentage of data (or simply one batch) used to calculate gradient used in SHG method. We can see $2 0 \%$ data to compute gradient is enough. One epoch refers to iterate whole dataset once. Following figures follow the same definition.
87
+
88
+ step size. We adopt the backtracking line search and accept the step size whenever it satisfies the following sufficient decrease condition (see (Wright, 2008)):
89
+
90
+ $$
91
+ \begin{array} { r } { f ( w + \eta p ) - f ( w ) \leq 0 . 1 \eta \nabla f ( w ) ^ { T } p , } \end{array}
92
+ $$
93
+
94
+ where $p$ is the search direction, and both gradient and function values are computed using the current batch. In this study, without further notice, SGD and GD will use well tuned fix learning rate and we will apply line search for SHG, SQN and SR1. Due to this finding, we are also interested in knowing whether line search is essential when applying second-order methods. Analysis will be provided below.
95
+
96
+ # 4 RESULTS AND ANALYSIS
97
+
98
+ # 4.1 SHG OUTPERFORMS SGD IN NUMBER OF TRAINING STEPS BUT SGD IS SUBSTANTIALLY FASTER
99
+
100
+ We show MNIST results in Figure 2 and CIFAR-10 results in Figure 3. Is second-order methods useful in training deep neural network? By only looking at number of epochs to minimize training objective, we can clearly answer yes. SHG method performs well on both datasets, and quasi-Newton methods have slightly worse performance on MNIST but are significantly better than SGD on CIFAR-10. Another point to notice is that we could not find a set of parameters to make SQN work with AlexNet on CIFAR-10. This signals that quasi-Netwon methods without parameter control or self-adjusting features can easily fall short in training non-convex problems.
101
+
102
+ It might be argued that as each update, SHG accesses much more data $2 0 \%$ of total as mentioned) than SGD (one batch), so it is self-evident that SHG can have better results. Nevertheless, we also include the Gradient Descent (GD) method to verify that amount of data accessed is not the key to performance in this case. In each iteration, GD will use average gradient of $2 0 \%$ of data to be the update direction. So GD has same number of updates as SGD, and access same amount of data as SHG in each update. If amount of data accessed were the key, GD should have a similar performance as SHG method. But we can clearly tell from the both figures that GD has a very different training loss curve from SHG. GD is actually worse than SGD in most cases which indicates that aggregated gradient information is not helpful in training deep neural networks. This verifies the effectiveness of second-order information.
103
+
104
+ Thus, second-order methods sound like a promising optimization method in deep learning. But when we look at the time spent to optimize as shown in Figure 4 and 5, clearly second-order methods won’t be a practical choice. SHG takes hundred to thousand times more to finish the training. This is because SHG needs to computes (almost) full gradient information. As the training data grows larger, this will be a demanding computational task. We also include time required to achieve a designated accuracy for both datasets. SGD is still substantially faster than all second-order methods. Quasi-Newton methods in general take shorter time to train and achieve decent testing results. Especially SQN is the fastest among three second-order methods. It is because SQN decouples the computation of update pairs and parameter updates. Therefore, in each iteration the required computation is reduced.
105
+
106
+ ![](images/7d506e26a930b7527165cf6abceebf01fdf9417aa89a6a04371e953423bf8ad0.jpg)
107
+ Figure 2: Average training loss versus epochs of SGD, SHG, GD, SR1, SQN on MNIST dataset. SHG is slightly faster than SGD. Quasi-Newton methods are comparable to SGD.
108
+
109
+ In our implementation, computation of full gradient is done by iterating many smaller batches. Ideally, we could parallelize this operation to accelerate the SHG method so SHG might become competitive to SGD in time when distributed training is available. Furthermore, in next section we will show SHG benefits from big batches, which is also a good feature for parallelizing the computation.
110
+
111
+ <table><tr><td rowspan=2 colspan=1></td><td rowspan=1 colspan=1>MNIST</td><td rowspan=1 colspan=1>CIFAR-10</td></tr><tr><td rowspan=1 colspan=1>LeNet AlexNet</td><td rowspan=1 colspan=1>LeNet AlexNet</td></tr><tr><td rowspan=1 colspan=1>SGD</td><td rowspan=1 colspan=1>4.4 4.0</td><td rowspan=1 colspan=1>89.7 51.3</td></tr><tr><td rowspan=1 colspan=1>SHG</td><td rowspan=1 colspan=1>183 122</td><td rowspan=1 colspan=1>1422 1856</td></tr><tr><td rowspan=1 colspan=1>SQN</td><td rowspan=1 colspan=1>71.9 50.7</td><td rowspan=1 colspan=1>229 NA</td></tr><tr><td rowspan=1 colspan=1>SR1</td><td rowspan=1 colspan=1>172.9 121.9</td><td rowspan=1 colspan=1>2744 483</td></tr></table>
112
+
113
+ Table 2: Time(sec) required to achieve desginated testing accuracy, MNIST: $9 8 \%$ and CIFAR$1 0 { : } 7 3 \%$
114
+
115
+ # 4.2 SHG PERFORMS BETTER UNDER BIG BATCH SETTING
116
+
117
+ It has been observed that increasing the batch size will hurt the convergence speed of SGD (Goyal et al., 2017; ?; You et al., 2017). Therefore, it is interesting to see the performance of second-order methods as we increase batch size.
118
+
119
+ In Figure 6, we test the performance of SQN when we increase batch size. As we can see, SQN works well when batch size is small but the training becomes stagnant when batch size becomes larger. We believe it’s because there are many hyper-parameters in quasi-Newton methods such as batch size, number of curvature pairs to use, learning rate and frequency of updates. Again without a good controlling mechanism, the approximation computed might be noisy and sudden change one of any parameters alone will make the algorithm problematic. Same situation can be observed in SR1 as shown in Figure 7. Its performance becomes worse than SGD when the batch size is increased.
120
+
121
+ ![](images/117b56239de3b838f5a2111aad818b00fbcd5ed9375305f67f650f29b9b28567.jpg)
122
+ Figure 3: Average training loss versus epochs of SGD, SHG, GD, SR1, SQN on CIFAR-10 dataset. Clearly both inexact-Newton and quasi-Newton methods optimize the training loss faster than SGD.
123
+
124
+ On the other hand, the behavior is totally different for inexact-Newton method such as SHG—SHG benefits from bigger batches, as shown in Figure 8. Although the effect of larger batches seems to be stronger for SGD when batch size grows to 400, SHG with even larger sizes (e.g., 3200) will outperform SGD more when compared to smaller batch sizes. This implies unlike first-order methods which rely on the noisy of gradient estimation to jump out the valley, curvature information captured by SHG is enough to optimize the objective function, and larger batch size of hessian-vector product used in SHG leads to better results. When batch size is larger, it’s even easier to parallelize and compute the full gradient part. This shows a good direction to apply second-order methods in the future.
125
+
126
+ # 4.3 LIMITS OF SECOND-ORDER METHODS: RELU UNIT AND IDENTITY LINK
127
+
128
+ At first glance, second-order methods especially SHG can achieve good results with standard deep convolutional neural networks. But when it comes to Deep Residual Network, the story is different as shown in Figure 9. SHG is able to train a DRN on MNIST but not CIFAR-10. As derived in (Botev et al., 2017), hessian matrix of multi-layer fully connected network will be related to this recursive pre-activation hessian $_ \mathrm { H }$ :
129
+
130
+ $$
131
+ H _ { \lambda } = B _ { \lambda } W _ { \lambda + 1 } ^ { T } H _ { \lambda + 1 } W _ { \lambda + 1 } B _ { \lambda } + D _ { \lambda }
132
+ $$
133
+
134
+ where we could define the diagonal matrices:
135
+
136
+ $$
137
+ B _ { \lambda } = \mathrm { d i a g } ( f _ { \lambda } ^ { \prime } ( h _ { \lambda } ) )
138
+ $$
139
+
140
+ ![](images/eb9810a45d4749ae95baaaea5fd1b3f94b3231311e964401a335c607b61f74e1.jpg)
141
+ Figure 4: Average training loss versus time of SGD,SHG,GD,SR1,SQN on MNIST dataset.
142
+
143
+ $$
144
+ D _ { \lambda } = \mathrm { d i a g } ( f _ { \lambda } ^ { \prime \prime } ( h _ { \lambda } ) { \frac { \partial E } { \partial a _ { \lambda } } } )
145
+ $$
146
+
147
+ where E is the total loss, f is the activation function and $a _ { \lambda }$ is the activation of certain layer $\lambda$ . Therefore, if ReLu is used as nonlinear unit of the network, it will have zero second-order derivatives so part of the hessian information will be lost. In addition, identity link used in the DRN also has zero second-order derivatives. Since DRN contains both designs, we are not sure which unit deteriorates SHG more. Therefore, we design an ablation test to verify the effects.
148
+
149
+ First, we compare AlexNet with tanh and AlexNet with ReLu. This is a straightforward comparison to understand the influence of using ReLu. Next, we take AlexNet with tanh and substitute the last convolutional layer in AlexNet with a single residual block. Within the block, again tanh is used instead of ReLu and we keep the identity link. Although it’s a relatively shallow network compared to the one used in DRN, it’s enough to tell the influence of using identity link. As shown in Figure 10 and 11, both designs will deteriorate the performance of SHG. And ReLu posts stronger challenges to this type of second-order methods. This is a really problematic issue as nowadays, popularity of DRN grows fast and likely it will become the standard type of neural network. Without an efficient way of solving this problem means SHG won’t be useful even it can be parallelized. On contrary, quasi-Newton methods use first-order information to approximate second-order information. Despite the second-order information is disrupted by vanishing effect, it can still receive gradients to complete the calculation. Besides, we observe that it converges to smaller training loss than SGD on both MNIST and CIFAR-10. It has the potential to be applied in training deeper residual networks.
150
+
151
+ The reason why SHG still works on training MNIST is likely due to the fact that images in MNIST are simple patterns with most parts black. So the information lost is not severe enough to stop us from training. But in general it should become an issue on most of real-world datasets.
152
+
153
+ ![](images/0d3556ad7c642e95de87bf6052fc72cded8492d2b05dd6a8a4cb119f45bab3b3.jpg)
154
+ Figure 5: Average training loss versus time of SGD,SHG,GD,SR1,SQN on CIFAR-10 dataset. SGD in practice requires minimal computations and consequently faster than second-order methods.
155
+
156
+ ![](images/9c3282b1f4dd944c86b7ee53d56cb51770c23488c71a6b24676c292c3a8152a7.jpg)
157
+ Figure 6: Effect of changing batch size of SQN method. SQN fails to generalize the performance to larger batches. In principle SQN is sentitive to hyper-parameters.
158
+
159
+ 4.4 LINE SEARCH IS ESSENTIAL TO SECOND-ORDER METHODS
160
+
161
+ In this part, we replace the line search computations with well tuned fixed learning rate. In sum, second-order methods will not work on most of cases as shown in figure 12. As each update might not be descent direction, larger step sizes usually cause model to explode at certain point of training. With a fixed step size, only smaller values could be chosen. Consequently, the training process is relatively stagnant. The full capability of second-order methods cannot be achieved.
162
+
163
+ ![](images/74ae4feb605195a28019dc66325dda32d6ab1ea5934a00b68a403b8db7de6fa9.jpg)
164
+ Figure 7: Effect of changing batch size of SGD and SR1 methods. SR1 is sensitive to batch size too. As batch size grows, SGD outperforms SR1 on both datasets.
165
+
166
+ # 5 CONCLUSIONS
167
+
168
+ Second-order information is helpful to reduce the number of training epochs needed but it severely suffers from computational cost. So presently, light-weight first-order methods still dominate the optimization of deep neural network. Fortunately, both inexact-Newton methods and quasi-Newton methods seem to have certain ways to improve in the future. For inexact-Newton methods, parallelization is obviously the most promising direction to further study. With bigger batches and proper distributed system supported, it has a chance to achieve competitive results in practical timing constraints. Nevertheless, we will need to figure out how to deal with vanishing second-order information to make it really useful in deep learning.
169
+
170
+ For quasi-Newton method, although currently it is fast enough to be considered as the same order as SGD, a good balance between the precision of approximation and frequency of updates should still be considered to further cut the computational time. In addition, a more efficient and safer selfadjusting or correction mechanism can be added to make it stable under different setup of parameters and batch sizes. In addition, from preliminary analysis, quasi-Newton methods show competitive results when training DRN on both MNIST and CIFAR-10. This is another interesting research direction to explore.
171
+
172
+ ![](images/4a918bceba5e9385e39b1f7c96b0f2a700d0ac7950318a60be570be7fd2d1e52.jpg)
173
+ Figure 8: Effect of changing batch size of SGD and SHG methods. SGD benefits a bit when batch size grows to 400 but not larger. SHG outperforms SGD significantly when batch size keeps growing. Notice that large batch size means smaller number of updates in each epoch.
174
+
175
+ ![](images/01f1b93fae803d8b3498c2594f848a5aed9db7f4bb78ef4f9e7b1e4fd1ce8251.jpg)
176
+ Figure 9: Results of training regular DRN with ReLu activation. Although SHG can still optimize DRN on MNIST well, it fails to converge to better training loss on CIFAR-10 dataset.
177
+
178
+ ![](images/559aacb55b499ae8f3adffc23415cfe7b7fa142d5858ef6c4e4de60fffd5673b.jpg)
179
+ Figure 10: Effect of using ReLu in AlextNet. Left figure is Regular AlexNet with tanh activation and right figure is AlexNet with ReLu activation. Apparently using ReLu in deep neural networks deteriorates performance of SHG but not SR1.
180
+
181
+ ![](images/d00c6857b425ff567092c45773ca41afcb1c801186eaec4f86561ba9261fb259.jpg)
182
+ Figure 11: Effect of adding Identity expression in AlexNet. Left figure is Regular AlexNet with tanh activation and right figure is AlexNet with last convolutional layer replaced by a residual block. The influence of identity link is not as strong as ReLu but still affects the performance of SHG.
183
+
184
+ ![](images/79dcb4b7b16dfaafa0731fe712a223c1698a3c8d4f8aeb4888bb26c17b66b192.jpg)
185
+ Figure 12: Effect of using fixed learning rate of SGD and SR1 methods. Second-order methods cannot work with fixed learning rate.
186
+
187
+ # REFERENCES
188
+
189
+ Raghu Bollapragada, Richard Byrd, and Jorge Nocedal. Exact and inexact subsampled newton methods for optimization. arXiv preprint arXiv:1609.08502, 2016.
190
+
191
+ Aleksandar Botev, Hippolyt Ritter, and David Barber. Practical gauss-newton optimisation for deep learning. In ICML, 2017.
192
+
193
+ Richard H Byrd, Samantha L Hansen, Jorge Nocedal, and Yoram Singer. A stochastic quasi-newton method for large-scale optimization. SIAM Journal on Optimization, 26(2):1008–1031, 2016.
194
+
195
+ Frank Curtis. A self-correcting variable-metric algorithm for stochastic optimization. In International Conference on Machine Learning, pp. 632–641, 2016.
196
+
197
+ Yann N Dauphin, Razvan Pascanu, Caglar Gulcehre, Kyunghyun Cho, Surya Ganguli, and Yoshua Bengio. Identifying and attacking the saddle point problem in high-dimensional non-convex optimization. In Advances in neural information processing systems, pp. 2933–2941, 2014.
198
+
199
+ Priya Goyal, Piotr Dollar, Ross Girshick, Pieter Noordhuis, Lukasz Wesolowski, Aapo Kyrola, An-´ drew Tulloch, Yangqing Jia, and Kaiming He. Accurate, large minibatch sgd: Training imagenet in 1 hour. arXiv preprint arXiv:1706.02677, 2017.
200
+
201
+ 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.
202
+
203
+ Kenji Kawaguchi, Leslie Pack Kaelbling, and Yoshua Bengio. Generalization in deep learning. arXiv preprint arXiv:1710.05468, 2017.
204
+
205
+ Nitish Shirish Keskar and Albert S Berahas. adaqn: An adaptive quasi-newton algorithm for training rnns. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases, pp. 1–16. Springer, 2016.
206
+
207
+ 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.
208
+
209
+ 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.
210
+
211
+ Yann LeCun, LD Jackel, Leon Bottou, Corinna Cortes, John S Denker, Harris Drucker, Isabelle ´ Guyon, UA Muller, Eduard Sackinger, Patrice Simard, et al. Learning algorithms for classification: A comparison on handwritten digit recognition. Neural networks: the statistical mechanics perspective, 261:276, 1995.
212
+
213
+ James Martens and Roger Grosse. Optimizing neural networks with kronecker-factored approximate curvature. In ICML, 2015.
214
+
215
+ James Martens and Ilya Sutskever. Learning recurrent neural networks with hessian-free optimization. In Proceedings of the 28th International Conference on Machine Learning (ICML-11), pp. 1033–1040, 2011.
216
+
217
+ Yurii Nesterov and Boris T Polyak. Cubic regularization of newton method and its global performance. Mathematical Programming, 108(1):177–205, 2006.
218
+
219
+ Jiquan Ngiam, Adam Coates, Ahbik Lahiri, Bobby Prochnow, Quoc V Le, and Andrew Y Ng. On optimization methods for deep learning. In Proceedings of the 28th international conference on machine learning (ICML-11), pp. 265–272, 2011.
220
+
221
+ Vivek Ramamurthy and Nigel Duffy. L-sr1: A second order optimization method for deep learning. https://openreview.net/pdf?id=By1snw5gl, 2016.
222
+
223
+ Chien-Chih Wang, Chun-Heng Huang, and Chih-Jen Lin. Subsampled hessian newton methods for supervised learning. Neural computation, 2015.
224
+
225
+ Xiao Wang, Shiqian Ma, Donald Goldfarb, and Wei Liu. Stochastic quasi-newton methods for nonconvex stochastic optimization. SIAM Journal on Optimization, 27(2):927–956, 2017.
226
+
227
+ Jorge Nocedal Stephen J Wright. Numerical optimization. 2008.
228
+
229
+ Peng Xu, Farbod Roosta-Khorasan, and Michael W Mahoney. Second-order optimization for nonconvex machine learning: An empirical study. arXiv preprint arXiv:1708.07827, 2017a.
230
+
231
+ Peng Xu, Farbod Roosta-Khorasani, and Michael W Mahoney. Newton-type methods for nonconvex optimization under inexact hessian information. arXiv preprint arXiv:1708.07164, 2017b.
232
+
233
+ Yang You, Zhao Zhang, Cho-Jui Hsieh, and James Demmel. 100-epoch imagenet training with alexnet in 24 minutes. arXiv preprint arXiv:1709.05011, 2017.
md/train/HJ_aoCyRZ/HJ_aoCyRZ.md ADDED
@@ -0,0 +1,542 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SPECTRALNET: SPECTRAL CLUSTERING USING DEEP NEURAL NETWORKS
2
+
3
+ Uri Shaham∗†, Kelly Stanton∗, Henry Li∗
4
+ Yale University
5
+ New Haven, CT, USA
6
+ {uri.shaham, kelly.stanton, henry.li}@yale.edu
7
+
8
+ # Yuval Kluger
9
+
10
+ Boaz Nadler, Ronen Basri
11
+ Weizmann Institute of Science
12
+ Rehovot, Israel
13
+ {boaz.nadler, ronen.basri}@gmail.com
14
+
15
+ Yale University New Haven, CT, USA yuval.kluger@yale.edu
16
+
17
+ # ABSTRACT
18
+
19
+ Spectral clustering is a leading and popular technique in unsupervised data analysis. Two of its major limitations are scalability and generalization of the spectral embedding (i.e., out-of-sample-extension). In this paper we introduce a deep learning approach to spectral clustering that overcomes the above shortcomings. Our network, which we call SpectralNet, learns a map that embeds input data points into the eigenspace of their associated graph Laplacian matrix and subsequently clusters them. We train SpectralNet using a procedure that involves constrained stochastic optimization. Stochastic optimization allows it to scale to large datasets, while the constraints, which are implemented using a specialpurpose output layer, allow us to keep the network output orthogonal. Moreover, the map learned by SpectralNet naturally generalizes the spectral embedding to unseen data points. To further improve the quality of the clustering, we replace the standard pairwise Gaussian affinities with affinities learned from the given unlabeled data using a Siamese network. Additional improvement of the resulting clustering can be achieved by applying the network to code representations produced, e.g., by standard autoencoders. Our end-to-end learning procedure is fully unsupervised. In addition, we apply VC dimension theory to derive a lower bound on the size of SpectralNet. State-of-the-art clustering results are reported on the Reuters dataset. Our implementation is publicly available at https://github.com/kstant0725/SpectralNet.
20
+
21
+ # 1 INTRODUCTION
22
+
23
+ Discovering clusters in unlabeled data is a task of significant scientific and practical value. With technological progress images, texts, and other types of data are acquired in large numbers. Their labeling, however, is often expensive, tedious, or requires expert knowledge. Clustering techniques provide useful tools to analyze such data and to reveal its underlying structure.
24
+
25
+ Spectral Clustering (Shi & Malik, 2000; $\mathrm { N g }$ et al., 2002; Von Luxburg, 2007) is a leading and highly popular clustering algorithm. It works by embedding the data in the eigenspace of the Laplacian matrix, derived from the pairwise similarities between data points, and applying $k$ -means to this representation to obtain the clusters. Several properties make spectral clustering appealing: First, its embedding optimizes a natural cost function, minimizing pairwise distances between similar data points; moreover, this optimal embedding can be found analytically. Second, spectral clustering variants arise as relaxations of graph balanced-cut problems (Von Luxburg, 2007). Third, spectral clustering was shown to outperform other popular clustering algorithms such as $k$ -means (Von Luxburg, 2007), arguably due to its ability to handle non-convex clusters. Finally, it has a solid probabilistic interpretation, since the Euclidean distance in the embedding space is equal to a diffusion distance, which, informally, measures the time it takes probability mass to transfer between points, via all the other points in the dataset (Nadler et al., 2006; Coifman & Lafon, 2006a).
26
+
27
+ ![](images/cce14ac5e75034178b1104d64bd8efe36caa7ab333478be3aa3fab6b3217250f.jpg)
28
+ Figure 1: Illustrative 2D and 3D examples showing the results of our SpectralNet clustering (top) compared to typical results obtained with DCN, VaDE, DEPICT and IMSAT (bottom) on simulated datasets in 2D and 3D. Our approach successfully finds these non-convex clusters, whereas the competing algorithms fail on all five examples. (The full set of results for these algorithms is shown in Figure 4 in Appendix A.)
29
+
30
+ While spectral embedding of data points can be achieved by a simple eigen-decomposition of their graph Laplacian matrix, with large datasets direct computation of eigenvectors may be prohibitive. Moreover, generalizing a spectral embedding to unseen data points, a task commonly referred to as out-of-sample-extension (OOSE), is a non-trivial task; see, for example, (Belkin et al., 2006; Bengio et al., 2004; Fowlkes et al., 2004; Coifman & Lafon, 2006b).
31
+
32
+ In this work we introduce SpectralNet, a deep learning approach to spectral clustering, which addresses the scalability and OOSE problems pointed above. Specifically, SpectralNet is trained in a stochastic fashion, which allows it to scale. Moreover, once trained, it provides a function, implemented as a feed-forward network, that maps each input data point to its spectral embedding coordinates. This map can easily be applied to new test data. Unlike optimization of standard deep learning models, SpectralNet is trained using constrained optimization, where the constraint (orthogonality of the net outputs) is enforced by adding a linear layer, whose weights are set by the QR decomposition of its inputs. In addition, as good affinity functions are crucial for the success of spectral clustering, rather than using the common Euclidean distance to compute Gaussian affinity, we show how Siamese networks can be trained from the given unlabeled data to learn more informative pairwise distances and consequently significantly improve the quality of the clustering. Further improvement can be achieved if our network is applied to transformed data obtained by an autoencoder (AE). On the theoretical front, we utilize VC-dimension theory to derive a lower bound on the size of neural networks that compute spectral clustering. Our experiments indicate that our network indeed approximates the Laplacian eigenvectors well, allowing the network to cluster challenging non-convex point sets, which recent deep network based methods fail to handle; see examples in Figure 1. Finally, SpetralNet achieves competitive performance on MNIST handwritten digit dataset and state-of-the-art on the Reuters document dataset, whose size makes standard spectral clustering inapplicable.
33
+
34
+ # 2 RELATED WORK
35
+
36
+ Recent deep learning approaches to clustering largely attempt to learn a code for the input that is amenable to clustering according to either the $k$ -means or mixture of gaussians clustering models. DCN (Yang et al., 2017) directly optimizes a loss composed of a reconstruction term (for the code) and the $k$ -means functional. DEC (Xie et al., 2016) iteratively updates a target distribution to sharpen cluster associations. DEPICT (Dizaji et al., 2017) adds a regularization term that prefers balanced clusters. All three methods are pre-trained as autoencoders, while DEPICT also initializes its target distribution using $k$ -means or other standard clustering algorithms. Several other recent approaches rely on a variational autoencoder that utilizes a Gaussian mixture prior, see, for example, VaDE (Zheng et al., 2016) and GMVAE (Dilokthanakul et al., 2016). IMSAT (Hu et al., 2017) is based on data augmentation, where the net is trained to maximize the mutual information between inputs and predicted clusters, while regularizing the net so that the cluster assignment of original data points will be consistent with the assignment of augmented points. Different approaches are proposed by Chen (2015), who uses a deep belief net followed by non-parametric maximum margin clustering (NMMC), and by Yang et al. (2016), who introduce a recurrent-agglomerative framework to image clustering.
37
+
38
+ While these approaches achieve accurate clustering results on standard datasets (such as the MNIST and Reuters), the use of the $k$ -means criterion, as well as the Gaussian mixture prior, seems to introduce an implicit bias towards the formation of clusters with convex shapes. This limitation seems to hold even in code space. This bias is demonstrated in Figure 1(bottom), which shows the failure of several of the above approaches on relatively simple clustering tasks. In contrast, as is indicated in Figure 1(top), our SpectralNet approach appears to be less vulnerable to such bias. The full set of runs can be found in Appendix A.
39
+
40
+ In the context of spectral clustering, Tian et al. (2014) learn an autoencoder that maps the rows of a graph Laplacian matrix onto the corresponding spectral embedding, and then use $k$ -means in code space to cluster the underlying data. Unlike our work, which learns to map an input data point to its spectral embedding, Tian et al.’s network takes as input an entire row of the graph Laplacian, and therefore OOSE is impractical, as it requires to compute the affinities of each new data point to all the training data. Also of interest is the kernel spectral method by Alzate & Suykens (2010), which allows for out of sample extension and handles large datasets through smart sampling (but does not use a neural network).
41
+
42
+ Yi et al. (2016) address the problem of 3D shape segmentation. Their work, which focuses on learning graph convolutions, uses a graph spectral embedding through eigenvector decomposition, which is not learned. In addition, we enforce orthogonalization stochastically through a constraint layer, while they attempt to learn orthogonalized functional maps by adding an orthogonalization term to the loss function, which involves non-trivial balancing between two loss components.
43
+
44
+ Other deep learning works use a spectral approach in the context of supervised learning. Law et al. (2017) apply supervised metric learning, showing that their method approximates the eigenvectors of a 0-1 affinity matrix constructed from the true labels. Mishne et al. (2017) trained a network to compute graph Laplacian eigenvectors using supervised regression. Their approach, however, requires the true eigenvectors for training, and hence does not easily scale to large datasets.
45
+
46
+ Finally, a number of papers showed that stochastic gradient descent can be used effectively to compute the principal components of covariance matrices, see, e.g., (Shamir, 2015) and references therein. The setup in these papers assumes that in each iteration a noisy estimate of the entire input matrix is provided. In contrast, in our work we use in each iteration only a small submatrix of the affinity matrix, corresponding to a small minibatch. In future work, we plan to examine how these algorithms can be adapted to improve the convergence rate of our proposed network.
47
+
48
+ # 3 SPECTRALNET
49
+
50
+ In this section we present our proposed approach, describe its key components, and explain its connection to spectral clustering. Consider the following standard clustering setup: Let $\scriptscriptstyle \textit { \textbf { X } } =$ $\{ x _ { 1 } , \ldots , x _ { n } \} \subseteq \mathbb { R } ^ { d }$ denote a collection of unlabeled data points drawn from some unknown distribution $\mathcal { D }$ ; given a target number of clusters $k$ and a distance measure between points, the goal is to learn a similarity measure between points in $\mathcal { X }$ and use it to learn a map that assigns each of $x _ { 1 } , \ldots , x _ { n }$ to one of $k$ possible clusters, so that similar points tend to be grouped in the same cluster. As in classification tasks we further aim to use the learned map to determine the cluster assignments of new, yet unseen, points drawn from $\mathcal { D }$ . Such out-of-sample-extension is based solely on the learned map, and requires neither computation of similarities between the new points and the training points nor re-clustering of combined data.
51
+
52
+ In this work we propose SpectralNet, a neural network approach for spectral clustering. Once trained, SpectralNet computes a map $F _ { \theta } : \mathbb { R } ^ { d } \mathbb { R } ^ { k }$ and a cluster assignment function $c : \mathbb { R } ^ { k } $ $\{ 1 , \ldots , k \}$ . It maps each input point $x$ to an output $y = F _ { \theta } ( x )$ and provides its cluster assignment $c ( y )$ . The spectral map $F _ { \theta }$ is implemented using a neural network, and the parameter vector $\theta$ denotes the network weights.
53
+
54
+ The training of SpectralNet consists of three components: (i) unsupervised learning of an affinity given the input distance measure, via a Siamese network (see Section 3.2); (ii) unsupervised learning of the map $F _ { \theta }$ by optimizing a spectral clustering objective while enforcing orthogonality (see Section 3.1); (iii) learning the cluster assignments, by k-means clustering in the embedded space.
55
+
56
+ # 3.1 LEARNING THE SPECTRAL MAP $F _ { \theta }$
57
+
58
+ In this section we describe the main learning step in SpectralNet, component (ii) above. To this end, let $w : \mathbb { R } ^ { d } \times \mathbb { R } ^ { d } \to [ 0 , \infty )$ be a symmetric affinity function, such that $w ( x , x ^ { \prime } )$ expresses the similarity between $x$ and $x ^ { \prime }$ . Given $w$ , we would like points $x , x ^ { \prime }$ which are similar to each other (i.e., with large $w ( x , x ^ { \prime } ) )$ to be embedded close to each other. Hence, we define the loss
59
+
60
+ $$
61
+ \begin{array} { r } { \mathcal { L } _ { \mathrm { S p e c t r a l N e t } } ( \theta ) = \mathbb { E } \left[ w ( x , x ^ { \prime } ) \lVert y - y ^ { \prime } \rVert ^ { 2 } \right] , } \end{array}
62
+ $$
63
+
64
+ where $y , y ^ { \prime } \in \mathbb { R } ^ { k }$ , the expectation is taken with respect to pairs of i.i.d. elements $( x , x ^ { \prime } )$ drawn from $\mathcal { D }$ , and $\theta$ denotes the parameters of the map $y = F _ { \theta } ( x )$ . Clearly, the loss $\mathcal { L } _ { \mathrm { S p e c t r a l N e t } } ( \theta )$ can be minimized by mapping all points to the same output vector $( F _ { \theta } ( x ) = y _ { 0 }$ for all $x$ ). To prevent this, we require that the outputs will be orthonormal in expectation with respect to $\mathcal { D }$ , i.e.,
65
+
66
+ $$
67
+ \mathbb { E } \left[ y y ^ { T } \right] = I _ { k \times k } .
68
+ $$
69
+
70
+ As the distribution $\mathcal { D }$ is unknown, we replace the expectations in (1) and (2) by their empirical analogues. Furthermore, we perform the optimization in a stochastic fashion. Specifically, at each iteration we randomly sample a minibatch of $m$ samples, which without loss of generality we denote $x _ { 1 } , \ldots , x _ { m } \in \mathcal { X }$ , and organize them in an $m \times d$ matrix $X$ whose $i$ th row contains $x _ { i } ^ { T }$ . We then minimize the loss
71
+
72
+ $$
73
+ L _ { { \mathrm { S p e c t r a l N e t } } } ( \theta ) = \frac { 1 } { m ^ { 2 } } \sum _ { i , j = 1 } ^ { m } W _ { i , j } \| y _ { i } - y _ { j } \| ^ { 2 } ,
74
+ $$
75
+
76
+ where $y _ { i } = F _ { \theta } ( x _ { i } )$ and $W$ is a $m \times m$ matrix such that $W _ { i , j } = w ( x _ { i } , x _ { j } )$ . The analogue of (2) for a small minibatch is
77
+
78
+ $$
79
+ { \frac { 1 } { m } } Y ^ { T } Y = I _ { k \times k } ,
80
+ $$
81
+
82
+ where $Y$ is a $m \times k$ matrix of the outputs whose $i$ th row is $y _ { i } ^ { T }$
83
+
84
+ We implement the map $F _ { \theta }$ as a general neural network whose last layer enforces the orthogonality constraint (4). This layer gets input from $k$ units, and acts as a linear layer with $k$ outputs, where the weights are set to orthogonalize the output $Y$ for the minibatch $X$ . Let $\tilde { Y }$ denote the $m \times k$ matrix containing the inputs to this layer for $X$ (i.e., the outputs of $F _ { \theta }$ over the minibatch before orthogonalization). A linear map that orthogonalizes the columns of $\tilde { Y }$ is computed through its QR decomposition. Specifically, for any matrix $A$ such that $A ^ { T } A$ is full rank, one can obtain the QR decomposition via the Cholesky decomposition $A ^ { T } A = L L ^ { T }$ , where $L$ is a lower triangular matrix, and then setting $Q \ : = \ : A \left( L ^ { - 1 } \right) ^ { T }$ . This is verified in Appendix B. Therefore, in order to orthogonalize $\tilde { Y }$ , the last layer multiplies $\tilde { Y }$ from the right by $\sqrt { m } \left( \tilde { L } ^ { - 1 } \right) ^ { T }$ , where $\tilde { L }$ is obtained from the Cholesky decomposition of $\tilde { Y } ^ { T } \tilde { Y }$ and the $\sqrt { m }$ factor is needed to satisfy (4).
85
+
86
+ We train this spectral map in a coordinate descent fashion, where we alternate between orthogonalization and gradient steps. Each of these steps uses a different minibatch (possibly of different sizes), sampled uniformly from the training set $\mathcal { X }$ . In each orthogonalization step we use the QR decomposition to tune the weights of the last layer. In each gradient step we tune the remaining weights using standard backpropagation. Once SpectralNet is trained, all the weights are freezed, including those of the last layer, which simply acts as a linear layer. Finally, to obtain the cluster assignments $c _ { 1 } , \ldots c _ { 2 }$ , we propagate $x _ { 1 } , \ldots . x _ { n }$ through it to obtain the embeddings $y _ { 1 } , \ldots , y _ { n } \in \mathbb { R } ^ { k }$ , and perform $k$ -means on them, obtaining $k$ cluster centers, as in standard spectral clustering. These algorithmic steps are summarized below in Algorithm 1 in Sec. 3.3.
87
+
88
+ # Connection with Spectral Clustering The loss (3) can also be written as
89
+
90
+ $$
91
+ L _ { \mathrm { S p e c t r a l N e t } } ( \theta ) = \frac { 2 } { m ^ { 2 } } \operatorname { t r a c e } \left( Y ^ { T } ( D - W ) Y \right) ,
92
+ $$
93
+
94
+ where $D$ is a $m \times m$ diagonal matrix such that $\begin{array} { r } { D _ { i , i } = \sum _ { j } W _ { i , j } } \end{array}$ . The symmetric, positive semidefinite matrix $D - W$ forms the (unnormalized) graph Laplacian of the minibatch $x _ { 1 } , \ldots , x _ { m }$ . For $k = 1$ the loss is minimized when $y$ is the eigenvector of $D - W$ corresponding to the smallest eigenvalue. Similarly, for general $k$ , under the constraint (4), the minimum is attained when the column space of $Y$ is the subspace of the $k$ eigenvectors corresponding to the smallest $k$ eigenvalues of $D - W$ . Note that this subspace includes the constant vector whose inclusion does not affect the final cluster assignment.
95
+
96
+ Hence, SpectralNet approximates spectral clustering, where the main differences are that the training is done in a stochastic fashion, and that the orthogonality constraint with respect to the full dataset $\mathcal { X }$ holds only approximately. SpectralNet therefore trades accuracy with scalability and generalization ability. Specifically, while its outputs are an approximation of the true eigenvectors, the stochastic training enables its scalability and thus allows one to cluster large datasets that are prohibitive for standard spectral clustering. Moreover, once trained, SpectralNet provides a parametric function whose image for the training points is (approximately) the eigenvectors of the graph Laplacian. This function can now naturally embed new test points, which were not present at training time. Our experiments with the MNIST dataset (Section 5) indicate that the outputs of SpectralNet closely approximate the true eigenvectors.
97
+
98
+ Finally, as in common spectral clustering applications, cluster assignments are determined by applying $k$ -means to the embeddings $y _ { 1 } , \ldots y _ { n }$ . We note that the $k$ -means step can be replaced by other clustering algorithms. Our preference to use $k$ -means is based on the interpretation (for normalized Laplacian matrices) of the Euclidean distance in the embedding space as diffusion distance in the input space (Nadler et al., 2006; Coifman $\&$ Lafon, 2006a).
99
+
100
+ Normalized graph Laplacian In spectral clustering, the symmetric normalized graph Laplacian $I - D ^ { - { \frac { 1 } { 2 } } } W D ^ { - { \frac { 1 } { 2 } } }$ can use as an alternative to the unnormalized Laplacian $D - W$ . In order to train SpectralNet with normalized graph Laplacian, the loss function (3) should be replaced by
101
+
102
+ $$
103
+ L _ { \mathrm { S p e c t r a l N e t } } ( \theta ) = \frac { 1 } { m ^ { 2 } } \sum _ { i , j = 1 } ^ { m } W _ { i , j } \left\| \frac { y _ { i } } { d _ { i } } - \frac { y _ { j } } { d _ { j } } \right\| ^ { 2 } ,
104
+ $$
105
+
106
+ where $\begin{array} { r } { d _ { i } = D _ { i , i } = \sum _ { j = 1 } ^ { m } W _ { i , j } } \end{array}$
107
+
108
+ Batch size considerations Typically in classification or regression, the loss is a sum over the losses of individual examples. In contrast, SpectralNet loss (3) is summed over pairs of points, and each summand describes relationships between data points. This relation is encoded by the full $n \times n$ affinity matrix $W _ { \mathrm { f u l l } }$ (which we never compute explicitly). The minibatch size $m$ should therefore be sufficiently large to capture the structure of the data. For this reason, it is also highly important that minibatches will be sampled at random from the entire dataset at each step, and not be fixed across epochs. When the minibatches are fixed, the knowledge of $W _ { \mathrm { f u l l } }$ is reduced to a (possibly permuted) diagonal sequence of $m \times m$ blocks, thus ignoring many of the entries of $W _ { \mathrm { f u l l } }$ . In addition, while the output layer orthogonalizes $\tilde { Y }$ , we do not have any guarantees on how well it orthogonalizes other random minibatches. However, in our experiments we observed that if $m$ is large enough, it approximately orthogonalizes other batches as well, and its weights stabilize as training progresses. Therefore, to train SpectralNet, we use larger minibatches compared to common choices made by practitioners in the context of classification. In our experiments we use minibatches of size 1024 for MNIST and 2048 for Reuters, re-sampled randomly at every step.
109
+
110
+ # 3.2 LEARNING AFFINITIES USING A SIAMESE NETWORK
111
+
112
+ Choosing a good affinity measure is crucial to the success of spectral clustering. In many applications, practitioners use an affinity measure that is positive for a set of nearest neighbor pairs, combined with a Gaussian kernel with some scale $\sigma > 0$ , e.g.,
113
+
114
+ $$
115
+ W _ { i , j } = \left\{ \begin{array} { l l } { \exp \left( - \frac { \| x _ { i } - x _ { j } \| ^ { 2 } } { 2 \sigma ^ { 2 } } \right) , } & { ~ x _ { j } \mathrm { ~ i s ~ a m o n g ~ t h e ~ n e a r e s t ~ n e i g h b o r s ~ o f ~ } x _ { i } } \\ { 0 , } & { \mathrm { ~ o t h e r w i s e , } } \end{array} \right.
116
+ $$
117
+
118
+ where one typically symmetrizes $W$ , for example, by setting $W _ { i , j } \gets ( W _ { i , j } + W _ { j , i } ) / 2$
119
+
120
+ Euclidean distance may be overly simplistic measure of similarity; seeking methods that can capture more complex similarity relations might turn out advantageous. Siamese nets (Hadsell et al., 2006; Shaham & Lederman, 2018) are trained to learn affinity relations between data points; we empirically found that the unsupervised application of a Siamese net to determine the distances often improves the quality of the clustering.
121
+
122
+ Siamese nets are typically trained on a collection of similar (positive) and dissimilar (negative) pairs of data points. When labeled data are available, such pairs can be chosen based on label information (i.e., pairs of points with the same label are considered positive, while pairs of points with different labels are considered negative). Here we focus on datasets that are unlabeled. In this case we can learn the affinities directly from Euclidean proximity or from graph distance, e.g., by “labeling” points $x _ { i } , x _ { j }$ positive if $\| x _ { i } - x _ { j } \|$ is small and negative otherwise. In our experiments, we construct positive pairs from the nearest neighbors of each point. Negative pairs are constructed from points with larger distances. This Siamese network, therefore, is trained to learn an adaptive nearest neighbor metric.
123
+
124
+ A Siamese net maps every data point $x _ { i }$ into an embedding $z _ { i } = G _ { \theta _ { \mathrm { s i a m e s e } } } ( x _ { i } )$ in some space. The net is typically trained to minimize contrastive loss, defined as
125
+
126
+ $$
127
+ L _ { \mathrm { s i a m e s e } } ( \theta _ { \mathrm { s i a m e s e } } ; x _ { i } , x _ { j } ) = \left\{ \begin{array} { l l } { \| z _ { i } - z _ { j } \| ^ { 2 } , } & { ( x _ { i } , x _ { j } ) \mathrm { ~ i s ~ a ~ p o s i t i v e ~ p a i r } } \\ { \operatorname* { m a x } \left( c - \| z _ { i } - z _ { j } \| , 0 ) \right) ^ { 2 } , } & { ( x _ { i } , x _ { j } ) \mathrm { ~ i s ~ a ~ n e g a t i v e ~ p a i r } , } \end{array} \right.
128
+ $$
129
+
130
+ where $c$ is a margin (typically set to 1).
131
+
132
+ Once the Siamese net is trained, we use it to define a batch affinity matrix $W$ for the training of SpectralNet, by replacing the Euclidean distance $\| x _ { i } - x _ { j } \|$ in (6) with $\| z _ { i } - z _ { j } \|$ .
133
+
134
+ Remarkably, despite being trained in an unsupervised fashion on a training set constructed from relatively naive nearest neighbor relations, in Section 5 we show that affinities that use the Siamese distances yield dramatically improved clustering quality over affinities that use Euclidean distances. This implies that unsupervised training of Siamese nets can lead to learning useful and rich affinity relations.
135
+
136
+ # 3.3 ALGORITHM
137
+
138
+ Our end-to-end training approach is summarized in Algorithm 1.
139
+
140
+ Input: $\mathcal { X } \subseteq \mathbb { R } ^ { d }$ , number of clusters $k$ , batch size $m$
141
+
142
+ Output: embeddings $y _ { 1 } , \dots , y _ { n } , \ y _ { i } \in \mathbb { R } ^ { k }$ , cluster assignments $c _ { 1 } , \ldots c _ { n } , \ c _ { i } \in \{ 1 , \ldots k \}$ Construct a training set of positive and negative pairs for the Siamese network; Train a Siamese network;
143
+
144
+ Randomly initialize the network weights $\theta$ ; while $L _ { S p e c t r a l N e t } ( \theta )$ not converged do
145
+
146
+ # Orthogonalization step:
147
+
148
+ Sample a random minibatch $X$ of size $m$ ;
149
+
150
+ Forward propagate $X$ and compute inputs to orthogonalization layer $\tilde { Y }$ ;
151
+
152
+ Compute the Cholesky factorization $L L ^ { T } = \tilde { Y } ^ { T } \tilde { Y }$
153
+
154
+ Set the weights of the orthogonalization layer to be $\sqrt { m } \left( L ^ { - 1 } \right) ^ { T }$ ;
155
+
156
+ # Gradient step:
157
+
158
+ Sample a random minibatch $x _ { 1 } , \ldots , x _ { m }$ ;
159
+ Compute the $m \times m$ affinity matrix $W$ using the Siamese net;
160
+ Forward propagate $x _ { 1 } , \ldots , x _ { m }$ to get $y _ { 1 } , \ldots , y _ { m }$ ;
161
+ Compute the loss (3) or (5);
162
+ Use the gradient of $L _ { \mathrm { S p e c t r a l N e t } } ( \theta )$ to tune all $F _ { \theta }$ weights, except those of the output layer;
163
+
164
+ # end
165
+
166
+ Forward propagate $x _ { 1 } , \ldots , x _ { n }$ and obtain $F _ { \theta }$ outputs $y _ { 1 } , \ldots , y _ { n }$ ;
167
+ Run $k$ -means on $y _ { 1 } , \ldots , y _ { n }$ to determine cluster centers;
168
+
169
+ Algorithm 1: SpectralNet training
170
+
171
+ Once SpectralNet is trained, computing the embeddings of new test points (i.e., out-of-sampleextension) and their cluster assignments is straightforward: we simply propagate each test point $x _ { i }$ through the network $F _ { \theta }$ to obtain their embeddings $y _ { i }$ , and assign the point to its nearest centroid, where the centroids were computed using $k$ -means on the training data, at the last line of Algorithm 1.
172
+
173
+ # 3.4 SPECTRAL CLUSTERING IN CODE SPACE
174
+
175
+ Given a dataset $\mathcal { X }$ , one can either apply SpectralNet in the original input space, or in a code space (obtained, for example, by an autoencoder). A code space representation is typically lower dimensional, and often contains less nuisance information (i.e., information on which an appropriate similarity measure should not depend). Following (Yang et al., 2017; Xie et al., 2016; Zheng et al., 2016) and others, we empirically observed that SpectralNet performs best in code space. Unlike these works, which use an autoencoder as an initialization for their clustering networks, we use the code as our data representation and apply SpectralNet directly in that space, (i.e., we do not change the code space while training SpectralNet). In our experiments, we use code spaces obtained from publicly available autoencoders trained by Zheng et al. (2016) on the MNIST and Reuters datasets.
176
+
177
+ # 4 THEORETICAL ANALYSIS
178
+
179
+ Our proposed SpectralNet not only determines cluster assignments in training, as clustering algorithms commonly do, but it also produces a map that can generalize to unseen data points at test time. Given a training set with $n$ points, it is thus natural to ask how large should such a network be to represent this spectral map. The theory of VC-dimension can provide useful worst-case bounds for this size.
180
+
181
+ In this section, we use the VC dimension theory to study the minimal size a neural network should have in order to compute spectral clustering for $k = 2$ . Specifically, we consider the class of functions that map all training points to binary values, determined by thresholding at zero the eigenvector of the graph Laplacian with the second smallest eigenvalue. We denote this class of binary classifiers $\mathcal { F } _ { n } ^ { \mathrm { s g } }$ ectral clustering. Note that with $k = 2$ , $k$ -means can be replaced by thresholding of the second smallest eigenvector, albeit not necessarily at zero. We are interested in the minimal number of weights and neurons required to allow the net to compute such functions, assuming the affinities decay exponentially with the Euclidean distance. We do so by studying the VC dimension of function classes obtained by performing spectral clustering on $n$ points in arbitrary Euclidean spaces $\mathbb { R } ^ { d }$ , with $d \geq 3$ . We will make no assumption on the underlying distribution of the points.
182
+
183
+ In the main result of this section, we prove a lower bound on the VC dimension of spectral clustering, which is linear in the number of points $n$ . In contrast, the VC dimension of $k$ -means, for example, depends solely on the dimension $d$ , but not on $n$ , hence making $k$ -means significantly less expressive than spectral clustering1. As a result of our main theorem, we bound from below the number of weights and neurons in any net that is required to compute Laplacian eigenvectors. The reader might find the analysis in this section interesting in its own right.
184
+
185
+ Our main result shows that for data in $\mathbb { R } ^ { d }$ with $d \geq 3$ , the VC dimension of $\mathcal { F } _ { n } ^ { \mathrm { s p e c t r a l ~ c l u s t e r i n g } }$ is linear in the number $n$ of points, making spectral clustering almost as rich as arbitrary clustering of the $n$ points.
186
+
187
+ Theorem 4.1. VC dim(F spectral clusteringn ) ≥ 110 n.
188
+
189
+ The formal proof of Theorem 4.1 is deferred to Appendix C. Below we informally sketch its principles. We show that for any integer $n$ (assuming for simplicity that $n$ is divisible by 10), there exists a set of $m = n / 1 0$ points in $\mathbb { R } ^ { d }$ that is shattered by $\mathcal { F } _ { n } ^ { \mathrm { s p } }$ ectral clustering. In particular, we show this for the set of $m$ points placed in a 2-dimensional grid in $\mathbb { R } ^ { d }$ . We then show that for any arbitrary dichotomy of these $m$ points, we can augment the set of points to a larger set $X$ , containing $n = 1 0 m$ points, with a balanced partition of $X$ into two disjoint sets $S$ and $T$ that respects the dichotomy of the original $m$ points. The larger set has the special properties: (1) within $S$ (and resp. $T$ ), there is a path between any two points such that the distances between all pairs of consecutive points along the path are small, and (2) all pairs $( s , t ) \in S \times T$ are far apart. We complete the proof by constructing a Gaussian affinity $W$ with a suitable value of $\sigma$ and showing that the minimizer of the spectral clustering loss for $( X , W )$ (i.e., the second eigenvector of the Laplacian), when thresholded at 0, separates $S$ from $T$ , and hence respects the original dichotomy.
190
+
191
+ By connecting Theorem 4.1 with known results regarding the VC dimension of neural nets, see, e.g., (Shalev-Shwartz & Ben-David, 2014), we can bound the size from below (in terms of number of weights and neurons) of any neural net that computes spectral clustering. This is formalized in the following corollary.
192
+
193
+ # Corollary 4.2.
194
+
195
+ 1. For the class of neural nets with $| v |$ sigmoid nodes and $| w |$ weights to represent all functions realizable by spectral clustering (i.e., second eigenvector of the Laplacian, thresholded at 0) on n points, it is necessary to have $| w | ^ { 2 } | v | ^ { 2 } \geq O ( n )$ .
196
+ 2. For the class of neural nets with $| w |$ weights from a finite family (e.g., single-precision weights) to represent all functions realizable by spectral clustering, it is necessary to have $| w | \geq O ( n )$ .
197
+
198
+ #
199
+
200
+ 1. The VC dimension of the class of neural nets with $| v |$ sigmoid units and $| w |$ weights is at most $O ( | w | ^ { 2 } | v | ^ { 2 } )$ (Shalev-Shwartz & Ben-David, 2014, p. 275). Hence, if $| w | ^ { 2 } \bar { | v | } ^ { 2 } <$ $O ( n )$ , such net cannot shatter any collection of points of size $O ( n )$ . From Theorem 4.1, $\mathcal { F } _ { n } ^ { \mathrm { s p e c t r a l ~ c l u s t e r i n g } }$ shatters at least $O ( n )$ points. Therefore, in order for a class of networks to be able to express any function that can be computed using spectral clustering, it is a necessary (but not sufficient) condition to satisfy $| w | ^ { 2 } | v | ^ { 2 } \geq O ( n )$ .
201
+
202
+ 2. The VC dimension of the class of neural nets with $| w |$ weights from a finite family is $O ( w )$ (Shalev-Shwartz & Ben-David, 2014, p. 276). The arguments above imply that $| w | \geq$ $O ( n )$ .
203
+
204
+ Corollary 4.2 implies that in the general case (i.e., without assuming any structure on the $n$ data points), to perform spectral clustering, the size of the net has to grow with $n$ . However, when the data has some geometric structure, the net size can be much smaller. Indeed, in a related result, the ability of neural networks to learn eigenvectors of Laplacian matrices was demonstrated both empirically and theoretically by Mishne et al. (2017). They proved that there exist networks which approximate the eigenfunctions of manifold Laplacians arbitrarily well (where the size of the network depends on the desired error and the parameters of the manifold, but not on $n$ ).
205
+
206
+ # 5 EXPERIMENTAL RESULTS
207
+
208
+ # 5.1 EVALUATION METRICS
209
+
210
+ To numerically evaluate the accuracy of the clustering, we use two commonly used measures, the unsupervised clustering accuracy (ACC), and the normalized mutual information (NMI). For completeness, we define ACC and NMI below, and refer the reader to (Cai et al., 2011) for more details. For data point $x _ { i }$ , let $l _ { i }$ and $c _ { i }$ denote its true label and predicted cluster, respectively. Let $l = ( l _ { 1 } , \ldots l _ { n } )$ and similarly $c = ( c _ { 1 } , \ldots c _ { n } )$ .
211
+
212
+ ACC is defined as
213
+
214
+ $$
215
+ \operatorname { A C C } ( l , c ) = { \frac { 1 } { n } } \operatorname* { m a x } _ { \pi \in \Pi } \sum _ { i = 1 } ^ { n } \mathbb { 1 } \left\{ l _ { i } = \pi \left( c _ { i } \right) \right\} ,
216
+ $$
217
+
218
+ where $\Pi$ is the collection of all permutations of $\{ 1 , \ldots k \}$ . The optimal permutation $\pi$ can be computed using the Kuhn-Munkres algorithm (Munkres, 1957).
219
+
220
+ Table 1: Performance of various clustering methods on MNIST and Reuters datasets. $( ^ { * } )$ reported in (Xie et al., 2016). $( ^ { * * } )$ reported in (Yang et al., 2017), $( ^ { \dag } )$ reported in (Zheng et al., 2016), $( ^ { \ddagger } )$ ) reported in (Dizaji et al., 2017), $( ^ { \dag \dag } )$ reported in (Yang et al., 2016), $( ^ { \ddagger \ddagger } )$ reported in (Hu et al., 2017). The IMSAT result on Reuters was obtained on a subset of 10,000 from the full dataset.
221
+
222
+ <table><tr><td rowspan=1 colspan=1>Algorithm</td><td rowspan=1 colspan=1>ACC (MNIST)</td><td rowspan=1 colspan=1>NMI (MNIST)</td><td rowspan=1 colspan=1>ACC(Reuters)</td><td rowspan=1 colspan=1>NMI (Reuters)</td></tr><tr><td rowspan=1 colspan=1>k-means</td><td rowspan=1 colspan=1>.534</td><td rowspan=1 colspan=1>.499</td><td rowspan=1 colspan=1>.533</td><td rowspan=1 colspan=1>.401</td></tr><tr><td rowspan=1 colspan=1>Spectral clustering</td><td rowspan=1 colspan=1>.717</td><td rowspan=1 colspan=1>.754</td><td rowspan=1 colspan=1>NA</td><td rowspan=1 colspan=1>NA</td></tr><tr><td rowspan=1 colspan=1>DEC</td><td rowspan=1 colspan=1>.843*</td><td rowspan=1 colspan=1>.8**</td><td rowspan=1 colspan=1>.756*</td><td rowspan=1 colspan=1>not reported</td></tr><tr><td rowspan=1 colspan=1>DCN</td><td rowspan=1 colspan=1>.83**</td><td rowspan=1 colspan=1>.81**</td><td rowspan=1 colspan=1>not reported</td><td rowspan=1 colspan=1>not reported</td></tr><tr><td rowspan=1 colspan=1>VaDE</td><td rowspan=1 colspan=1>.9446†</td><td rowspan=1 colspan=1>not reported</td><td rowspan=1 colspan=1>.7938†</td><td rowspan=1 colspan=1>not reported</td></tr><tr><td rowspan=1 colspan=1>JULE</td><td rowspan=1 colspan=1>not reported</td><td rowspan=1 colspan=1>.913</td><td rowspan=1 colspan=1>not reported</td><td rowspan=1 colspan=1>not reported</td></tr><tr><td rowspan=1 colspan=1>DEPICT</td><td rowspan=1 colspan=1>.965tt</td><td rowspan=1 colspan=1>.9171t</td><td rowspan=1 colspan=1>not reported</td><td rowspan=1 colspan=1>not reported</td></tr><tr><td rowspan=1 colspan=1>IMSAT</td><td rowspan=1 colspan=1>.984±.004‡#</td><td rowspan=1 colspan=1>not reported</td><td rowspan=1 colspan=1>.719</td><td rowspan=1 colspan=1>not reported</td></tr><tr><td rowspan=1 colspan=1>SpectralNet (input space,Euclidean distance)</td><td rowspan=1 colspan=1>.622±.008</td><td rowspan=1 colspan=1>.687±.004</td><td rowspan=1 colspan=1>.645±.01</td><td rowspan=1 colspan=1>.444±.01</td></tr><tr><td rowspan=1 colspan=1>SpectralNet (input space,Siamese distance)</td><td rowspan=1 colspan=1>.826±.03</td><td rowspan=1 colspan=1>.884±.02</td><td rowspan=1 colspan=1>.661± 017</td><td rowspan=1 colspan=1>.381 ± .057</td></tr><tr><td rowspan=1 colspan=1>SpectralNet (code space,Euclidean distance)</td><td rowspan=1 colspan=1>.800±.003</td><td rowspan=1 colspan=1>.814±.008</td><td rowspan=1 colspan=1>.605±.053</td><td rowspan=1 colspan=1>.401±.061</td></tr><tr><td rowspan=1 colspan=1>SpectralNet (code space, Siamese distance)</td><td rowspan=1 colspan=1>.971±.001</td><td rowspan=1 colspan=1>.924±.001</td><td rowspan=1 colspan=1>.803±.006</td><td rowspan=1 colspan=1>.532±.010</td></tr></table>
223
+
224
+ NMI is defined as
225
+
226
+ $$
227
+ \operatorname { N M I } ( l , c ) = \frac { I ( l ; c ) } { \operatorname* { m a x } \{ H ( l ) , H ( c ) \} } ,
228
+ $$
229
+
230
+ where $I ( l ; c )$ denotes the mutual information between $l$ and $c$ , and $H ( \cdot )$ denotes their entropy. Both ACC and NMI are in $[ 0 , 1 ]$ , with higher values indicating better correspondence the clusters and the true labels.
231
+
232
+ # 5.2 CLUSTERING
233
+
234
+ We compare SpectralNet to several deep learning-based clustering approaches on two real world datasets. In all runs we assume the number of clusters is given $_ { \mathrm { k = 1 0 } }$ in MNIST and ${ \bf k } { = } 4$ in Reuters). As a reference, we also report the performance of $k$ -means and (standard) spectral clustering. Specifically, we compare SpectralNet to DEC (Xie et al., 2016), DCN (Yang et al., 2017), VaDE (Zheng et al., 2016), JULE (Yang et al., 2016), DEPICT (Dizaji et al., 2017), and IMSAT (Hu et al., 2017). The results for these six methods are reported in the corresponding papers. Technical details regarding the application of $k$ -means and spectral clustering appear in Appendix D.
235
+
236
+ We considered two variants of Gaussian affinity functions: using Euclidean distances (6), and Siamese distances; the latter case follows Algorithm 1. In all experiments we used the loss (3). In addition, we report results of SpectralNet (and the Siamese net) in both input space and code space. The code spaces are obtained using the publicly available autoencoders which are used to pre-train the weights of $\mathrm { V a D E } ^ { 2 }$ , and are 10-dimensional. We refer the reader to Appendix D for technical details about the architectures and training procedures.
237
+
238
+ # 5.2.1 MNIST
239
+
240
+ MNIST is a collection of $7 0 , 0 0 0 2 8 \times 2 8$ gray-scale images of handwritten digits, divided to training (60,000) and test (10,000) sets. To construct positive pairs for the Siamese net, we paired each instance with its two nearest neighbors. An equal number of negative pairs were chosen randomly from non-neighboring points.
241
+
242
+ Table 1 shows the performance of the various clustering algorithms on the MNIST dataset, using all 70,000 images for training. As can be seen, the performance of SpectralNet is significantly improved when using Siamese distance instead of Euclidean distance, and when the data is represented in code space rather than in pixel space. With these two components, SpectralNet outperforms DEC, DCN, VaDE, DEPICT and JULE, and is competitive with IMSAT.
243
+
244
+ To evaluate how well the outputs of SpectralNet approximate the true eigenvectors of the graph Laplacian, we compute the Grassmann distance between the subspace of SpectralNet outputs and that of the true eigenvectors. The squared Grassmann distance measures the sum of squared sines of the angles between two $k$ -dimensional subspaces; the distance is in $[ 0 , k ]$ . Figure 2 shows the Grassmann distance on the MNIST dataset as a function of the training time (expressed as number of parameter updates). It can be seen that the distance decreases rapidly at the beginning of training and stabilizes around 0.026 as time progresses.
245
+
246
+ ![](images/f93e3b7ecef14241f849e4c0db9373612fcec33d0574b020c421e8c5db2e56f1.jpg)
247
+ Figure 2: Grassmann distance as a function of iteration update for the MNIST dataset.
248
+
249
+ To check the generalization ability of SpectralNet to new test points, we repeated the experiment, this time training SpectralNet only on the training set, and predicting the labels of the test examples by passing them through the net and associating each test example with the nearest centroid from the $k$ -means that were performed on the embedding of the training examples. The accuracy on test examples was .970, implying that SpectralNet generalizes well to unseen test data in this case. We similarly also evaluated the generalization performance of $\mathbf { k }$ -means. The accuracy of $\mathbf { k }$ -means on the test set is .546 when using the input space and .776 when using the code space, both significantly inferior to SpectralNet.
250
+
251
+ # 5.2.2 REUTERS
252
+
253
+ The Reuters dataset is a collection of English news, labeled by category. Like DEC and VaDE, we used the following categories: corporate/industrial, government/social, markets, and economics as labels and discarded all documents with multiple labels. Each article is represented by a tfidf vector, using the $2 0 0 0 \ \mathrm { m o s t }$ frequent words. The dataset contains $n = 6 8 5 , 0 7 1$ documents. Performing vanilla spectral clustering on a dataset of this size in a standard way is prohibitive. The AE used to map the data to code space was trained based on a random subset of 10,000 samples from the full dataset. To construct positive pairs for the Siamese net, we randomly sampled 300,000 examples from the entire dataset, and paired each one with a random neighbor from its 3000 nearest neighbors. An equal number of negative pairs was obtained by randomly pairing each point with one of the remaining points.
254
+
255
+ Table 1 shows the performance of the various algorithms on the Reuters dataset. Overall, we see similar behavior to what we observed on MNIST: SpectralNet outperforms all other methods, and performs best in code space, and using Siamese affinity. Our SpectralNet implementation took less than 20 minutes to learn the spectral map on this dataset, using a GeForce GTX 1080 GPU. For comparison, computing the top four eigenvectors of the Laplacian matrix of the complete data, needed for spectral clustering, took over 100 minutes using ARPACK. Note that both SpectralNet and spectral clustering require pre-computed nearest neighbor graph. Moreover, spectral clustering using the ARPACK eigenvectors failed to produce reasonable clustering. This illustrates the robustness of our method in contrast to the well known instability of spectral clustering to outliers.
256
+
257
+ To evaluate the generalization ability of SpectralNet, we divided the data randomly to a $90 \%$ - $10 \%$ split, re-trained the Siamese net and SpectralNet on the larger subset, and predicted the labels of the smaller subset. The test accuracy was 0.798, implying that as on MNIST, SpectralNet generalizes well to new examples.
258
+
259
+ # 6 CONCLUSIONS
260
+
261
+ We have introduced SpectralNet, a deep learning approach for approximate spectral clustering. The stochastic training of SpectralNet allows us to scale to larger datasets than what vanilla spectral clustering can handle, and the parametric map obtained from the net enables straightforward out of sample extension. In addition, we propose to use unsupervised Siamese networks to compute distances, and empirically show that this results in better performance, comparing to standard Euclidean distances. Further improvement are achieved by applying our network to code representations produced with a standard stacked autoencoder. We present a novel analysis of the VC dimension of spectral clustering, and derive a lower bound on the size of neural nets that compute it. In addition, we report state of the art results on two benchmark datasets, and show that SpectralNet outperforms existing methods when the clusters cannot be contained in non overlapping convex shapes. We believe the integration of spectral clustering with deep learning provides a useful tool for unsupervised deep learning.
262
+
263
+ # ACKNOWLEDGEMENTS
264
+
265
+ We thank Raphy Coifman and Sahand Negahban for helpful discussions. R.B is supported in part by the Minerva foundation with funding from the Federal German Ministry for Education and Research. Y.K and B.N are supported by NIH grant 1R01HG008383-01A1.
266
+
267
+ # REFERENCES
268
+
269
+ Carlos Alzate and Johan AK Suykens. Multiway spectral clustering with out-of-sample extensions through weighted kernel pca. IEEE transactions on pattern analysis and machine intelligence, 32 (2):335–347, 2010.
270
+
271
+ Mikhail Belkin, Partha Niyogi, and Vikas Sindhwani. Manifold regularization: A geometric framework for learning from labeled and unlabeled examples. Journal of machine learning research, 7 (Nov):2399–2434, 2006.
272
+
273
+ Yoshua Bengio, Jean-franc¸cois Paiement, Pascal Vincent, Olivier Delalleau, Nicolas L Roux, and Marie Ouimet. Out-of-sample extensions for lle, isomap, mds, eigenmaps, and spectral clustering. In Advances in neural information processing systems, pp. 177–184, 2004.
274
+
275
+ Deng Cai, Xiaofei He, and Jiawei Han. Locally consistent concept factorization for document clustering. IEEE Transactions on Knowledge and Data Engineering, 23(6):902–913, 2011.
276
+
277
+ Gang Chen. Deep learning with nonparametric clustering. arXiv preprint arXiv:1501.03084, 2015.
278
+
279
+ Ronald R Coifman and Stephane Lafon. Diffusion maps. ´ Applied and computational harmonic analysis, 21(1):5–30, 2006a.
280
+
281
+ Ronald R Coifman and Stephane Lafon. Geometric harmonics: a novel tool for multiscale out-of- ´ sample extension of empirical functions. Applied and Computational Harmonic Analysis, 21(1): 31–52, 2006b.
282
+
283
+ Nat Dilokthanakul, Pedro AM Mediano, Marta Garnelo, Matthew CH Lee, Hugh Salimbeni, Kai Arulkumaran, and Murray Shanahan. Deep unsupervised clustering with gaussian mixture variational autoencoders. arXiv preprint arXiv:1611.02648, 2016.
284
+
285
+ Kamran Ghasedi Dizaji, Amirhossein Herandi, and Heng Huang. Deep clustering via joint convolutional autoencoder embedding and relative entropy minimization. arXiv preprint arXiv:1704.06327, 2017.
286
+
287
+ Charless Fowlkes, Serge Belongie, Fan Chung, and Jitendra Malik. Spectral grouping using the nystrom method. IEEE transactions on pattern analysis and machine intelligence, 26(2):214– 225, 2004.
288
+
289
+ Raia Hadsell, Sumit Chopra, and Yann LeCun. Dimensionality reduction by learning an invariant mapping. In Computer vision and pattern recognition, 2006 IEEE computer society conference on, volume 2, pp. 1735–1742. IEEE, 2006.
290
+
291
+ Weihua Hu, Takeru Miyato, Seiya Tokui, Eiichi Matsumoto, and Masashi Sugiyama. Learning discrete representations via information maximizing self augmented training. arXiv preprint arXiv:1702.08720, 2017.
292
+
293
+ Marc T Law, Raquel Urtasun, and Richard S Zemel. Deep spectral clustering learning. In International Conference on Machine Learning, pp. 1985–1994, 2017.
294
+
295
+ Gal Mishne, Uri Shaham, Alexander Cloninger, and Israel Cohen. Diffusion nets. Applied and Computational Harmonic Analysis, 2017.
296
+
297
+ James Munkres. Algorithms for the assignment and transportation problems. Journal of the society for industrial and applied mathematics, 5(1):32–38, 1957.
298
+
299
+ Boaz Nadler, Stephane Lafon, Ioannis Kevrekidis, and Ronald R Coifman. Diffusion maps, spectral clustering and eigenfunctions of fokker-planck operators. In Advances in neural information processing systems, pp. 955–962, 2006.
300
+
301
+ Andrew Y Ng, Michael I Jordan, and Yair Weiss. On spectral clustering: Analysis and an algorithm. In Advances in neural information processing systems, pp. 849–856, 2002.
302
+
303
+ Uri Shaham and Roy R Lederman. Learning by coincidence: Siamese networks and common variable learning. Pattern Recognition, 74:52–63, 2018.
304
+
305
+ Shai Shalev-Shwartz and Shai Ben-David. Understanding machine learning: From theory to algorithms. Cambridge university press, 2014.
306
+
307
+ Ohad Shamir. A stochastic pca and svd algorithm with an exponential convergence rate. In Proceedings of the 32nd International Conference on Machine Learning (ICML-15), pp. 144–152, 2015.
308
+
309
+ Jianbo Shi and Jitendra Malik. Normalized cuts and image segmentation. IEEE Transactions on pattern analysis and machine intelligence, 22(8):888–905, 2000.
310
+
311
+ Fei Tian, Bin Gao, Qing Cui, Enhong Chen, and Tie-Yan Liu. Learning deep representations for graph clustering. In AAAI, pp. 1293–1299, 2014.
312
+
313
+ Ulrike Von Luxburg. A tutorial on spectral clustering. Statistics and computing, 17(4):395–416, 2007.
314
+
315
+ Junyuan Xie, Ross Girshick, and Ali Farhadi. Unsupervised deep embedding for clustering analysis. In International Conference on Machine Learning (ICML), 2016.
316
+
317
+ Bo Yang, Xiao Fu, Nicholas D Sidiropoulos, and Mingyi Hong. Towards k-means-friendly spaces: Simultaneous deep learning and clustering. International Conference on Machine Learning (ICML), 2017.
318
+
319
+ Jianwei Yang, Devi Parikh, and Dhruv Batra. Joint unsupervised learning of deep representations and image clusters. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5147–5156, 2016.
320
+
321
+ Li Yi, Hao Su, Xingwen Guo, and Leonidas Guibas. Syncspeccnn: Synchronized spectral cnn for 3d shape segmentation. arXiv preprint arXiv:1612.00606, 2016.
322
+
323
+ Yin Zheng, Huachun Tan, Bangsheng Tang, Hanning Zhou, et al. Variational deep embedding: A generative approach to clustering. arXiv preprint arXiv:1611.05148, 2016.
324
+
325
+ ![](images/739b5ebb06c9d939b24aba474a0d11edbae9d0e47657cacb7e3bb6eef34ff190.jpg)
326
+ Figure 3: SpectralNet performance on the nested $\mathbf { \tilde { C } } \mathbf { \Psi }$ example. Top row: clustering using SpectralNet (left), spectral clustering (center), and $k$ -means (right). Bottom row, left panel: SpectralNet outputs (plotted in blue and green) vs. the true eigenvectors. Bottom row, right panel: loss and Grassmann distance as a function of iteration number; the values on the horizontal axis $\times 1 0 0$ are the numbers of the parameter updates.
327
+
328
+ # A ILLUSTRATIVE DATASETS
329
+
330
+ To compare SpectralNet to spectral clustering, we consider a simple dataset of 1500 points in two dimensions, containing two nested $\mathbf { \bar { C } } '$ -shaped clusters. We applied spectral clustering to the dataset by computing the eigenvectors of the unnormalized graph Laplacian $L = D - W$ corresponding to the two smallest eigenvalues, and then applying $k$ -means (with $k { = } 2$ ) to these eigenvector embeddings. The affinity matrix $W$ was computed using $\begin{array} { r } { W _ { i , j } = \exp \left( { - \frac { \| x _ { i } - x _ { j } \| ^ { 2 } } { \sigma ^ { 2 } } } \right) } \end{array}$ , where the scale $\sigma$ was set to be the median distance between a point to its 3rd neighbor – a standard practice in diffusion applications.
331
+
332
+ Figure 3 shows the clustering of the data obtained by SpectralNet, standard spectral clustering, and $k$ -means. It can be seen that both SpectralNet and spectral clustering identify the correct cluster structure, while $k$ -means fails to do so. Moreover, despite the stochastic training, the net outputs closely approximate the two true eigenvectors of $W$ with smallest eigenvalues. Indeed the Grassmann distance between the net outputs and the true eigenvectors approaches zero as the loss decreases.
333
+
334
+ In the next experiment, we trained, DCN, VaDE, DEPICT (using agglomerative clustering initialization) and IMSAT (using adversarial perturbations for data augmentation) on the 2D datasets of Figure 1. The experiments were performed using the code published by the authors of each paper. For each method, we tested various network architectures and hyper-parameter settings. Unfortunately, we were unable to find a setting that will yield an appropriate clustering on any of the datasets for DCN, VaDE and DEPICT. IMSAT worked on two out of the five datasets, however failed to yield an appropriate clustering in fairly simple cases. Plots with typical results of each of the methods on each of the five 2D datasets is shown in Figure 4.
335
+
336
+ To further investigate why these methods fail, we performed a sequence of experiments with the two nested ’C’s data, while changing the distance between the two clusters. The results are shown in Figure 5. We can see that all three methods fail to cluster the points correctly once the clusters cannot be linearly separated.
337
+
338
+ Interestingly, although the target distribution of DEPICT was initialized with agglomerative clustering, which successfully clusters the nested ’C’s, its target distribution becomes corrupted throughout the training, although its loss is considerably reduced, see Figure 6.
339
+
340
+ ![](images/88632c7ab15857817e7c33daf8c8baf048b3b8ede672c77163311d0296056c46.jpg)
341
+ Figure 4: from top to bottom: Results of DCN, VaDE, DEPICT and IMSAT on our illustrative datasets.
342
+
343
+ ![](images/cf18cc1727d052768abac2b32cb2d0fb9630b3e3aec7c351045b74fbaa5e1dec.jpg)
344
+ Figure 5: From top: Typical results of DCN, VaDE, DEPICT and IMSAT on the nested ’C’s, with several different distances between the two clusters.
345
+
346
+ ![](images/545636146f1c96b47d8afd990dc4645e46b0e447502cf4a5485c76f72ae9b66e.jpg)
347
+ Figure 6: The nested ’C’s, colored by DEPICT target distribution. Left: at initialization (with agglomerative clustering initialization). the DEPICT loss at this stage is 9.01. Right: after DEPICT training. The loss is 0.22. Although the loss decreases with training, the target distribution becomes corrupted.
348
+
349
+ # B CORRECTNESS OF THE $Q R$ DECOMPOSITION
350
+
351
+ We next verify that the Cholesky decomposition can indeed be used to compute the QR decomposition of a positive definite matrix. First, observe that since $L$ is lower triangular, then so is $L ^ { - 1 }$ , and $( L ^ { - 1 } ) ^ { T }$ is upper triangular. Hence for $i = 1 , \ldots m$ , the column space of the first $i$ columns of $A$ is the same as the column space of the first $i$ columns of $Q = A ( \dot { L } ^ { - 1 } ) ^ { T }$ . To show that the columns of $Q$ corresponds to Gram-Schmidt orthogonalization of the columns of $A$ , it therefore remains to show that $\hat { Q } ^ { T } Q = I$ . Indeed:
352
+
353
+ $$
354
+ Q ^ { T } Q = L ^ { - 1 } A ^ { T } A ( L ^ { - 1 } ) ^ { T } = L ^ { - 1 } L L ^ { T } ( L ^ { - 1 } ) ^ { T } = ( L ^ { - 1 } L ) ^ { T } = I .
355
+ $$
356
+
357
+ # C SECTION 4 PROOFS
358
+
359
+ # C.1 PRELIMINARIES
360
+
361
+ To prove Theorem 4.1, we begin with the following definition and lemmas.
362
+
363
+ Definition C.1 $( \alpha , \beta )$ -separated graph). Let $\alpha > \beta \ge 0$ . An $( \alpha , \beta )$ -separated graph is $G =$ $( V , W )$ , where $V$ has an even number of vertices and has a balanced partition $V = S \cup T$ , $| S | = | T |$ , and $W$ is an affinity matrix so that:
364
+
365
+ • For any $v _ { i } , v _ { j } \in S$ (resp. $T _ { \cdot }$ ), there is a path $v _ { i } = v _ { k _ { 1 } } , v _ { k _ { 2 } } , \ldots , v _ { k _ { l } } = v _ { j } \in S$ , so that for every two consecutive points $v _ { k _ { l } } , v _ { k _ { l + 1 } }$ along the path, $W _ { k _ { l } , k _ { l + 1 } } \geq \alpha$ .
366
+
367
+ • For any $v _ { i } \in S , \ v _ { j } \in T , W _ { i , j } \leq \beta .$
368
+
369
+ Lemma C.2. For any integer $m > 0$ there exists a set ${ \tilde { X } } = \{ x _ { 1 } , \ldots , x _ { m } \} \subseteq \mathbb { R } ^ { d } \left( d \geq 3 \right)$ , so that for any binary partition ${ \tilde { X } } = { \tilde { S } } \cup { \tilde { T } }$ , we can construct a set $X$ of $n = 1 0 m$ points, ${ \tilde { X } } \subset X$ , and $a$ balanced binary partition $X = S \cup T$ , $| S | = | T |$ of it, such that
370
+
371
+ • $\tilde { S } \subset S , \tilde { T } \subset T$
372
+ • For any $x _ { i } , x _ { j } \in S \left( r e s p . \ T \right)$ , there is a path $x _ { i } , x _ { k _ { 1 } } , x _ { k _ { 2 } } , \ldots , x _ { k _ { l } } , x _ { j } \in S$ , so that for every two consecutive points $x _ { k _ { l } } , x _ { k _ { l + 1 } }$ along the path, $\| x _ { k _ { l } } - x _ { k _ { l + 1 } } \| \le b < 1$ (property $\pmb { a }$ ).
373
+ • For any $x _ { i } \in S , \ x _ { j } \in T , \ \| x _ { i } - x _ { j } | \geq 1 ( p r o p e r t y \ b ) .$
374
+
375
+ Proof. We will prove this for the case $d = 3$ ; the proof holds for any $d \geq 3$ .
376
+
377
+ Let $m > 0$ be integer. We choose the set $\tilde { X }$ to lie in a 2-dimensional unit grid inside a square of minimal diameter, which is placed in the $Z = 0$ plane. Each point $x _ { i }$ is at a distance 1 from its neighbors.
378
+
379
+ Next, given a partition of $x _ { 1 } , \ldots , x _ { m }$ to two subsets, $\tilde { S }$ and $\tilde { T }$ , we will construct a set $X \supset { \tilde { X } }$ with $n = 1 0 m$ points and a partition $S \cup T$ that satisfy the conditions of the lemma (an illustration can be seen in Figure 7). First, we add points to obtain a balanced partition. We do so by adding $m$ new points $x _ { m + 1 } , \ldots , x _ { 2 m }$ , assigning each of them arbitrarily to either $\tilde { S }$ or $\tilde { T }$ until $| \tilde { S } | = | \tilde { T } | = m$ . We place all these points also on grid points in the $Z = 0$ plane so that all $2 m$ points lie inside a square of minimal diameter. We further add all the points in $\bar { \tilde { S } }$ to $S$ and those in $\tilde { T }$ to $T$ .
380
+
381
+ ![](images/c8c20b018fdd0d7d18405f40366bb3bc5ae6e66cca2404ba836e6a8bbb3fd305.jpg)
382
+ Figure 7: Illustration of the construction of Lemma C.2. We select the set $\tilde { X }$ to lie in a grid in the $Z = 0$ plane. Given an arbitrary dichotomy ${ \tilde { X } } = { \tilde { S } } \cup { \tilde { T } }$ (points are marked with filled circles, colored respectively in red and blue), we first add points to make the sets balanced (not shown). Next, we make a copy for $S$ at $Z = 1$ and for $T$ at $Z = - 1$ (filled squares). We then add midpoints between each point and its copy (empty circles), and finally add more points along the minimal length spanning tree (empty squares). Together, all the red points form the set $S$ ; the blue points form the set $T$ , and $X = S \cup T$ .
383
+
384
+ In the next step, we prepare a copy of the $\tilde { S }$ -points at $Z = 1$ (with the same $X , Y$ coordinates) and a copy of the $\tilde { T }$ -points at $Z = - 1$ . We denote these copies by $x _ { 1 } ^ { \prime } , . . . , x _ { 2 m } ^ { \prime }$ and refer to the lifted points at $Z = 1$ by $S ^ { \prime }$ and at $Z = - 1$ by $T ^ { \prime }$ . Next, we will add $6 m$ more points to make the full set of $n = 1 0 m$ points satisfy properties a and $\mathbf { b }$ . First, we will add the midpoint between every point and its copy, i.e., $x _ { i } ^ { \prime \prime } = ( x _ { i } + x _ { i } ^ { \prime } ) / 2$ . We assign each such midpoint to $S$ (resp. $T$ ) if it is placed between $x _ { i } \in S$ and $x _ { i } ^ { \prime } \in S ^ { \prime }$ (resp. $T$ and $T ^ { \prime }$ ). Then we connect the points in $S ^ { \prime }$ (resp. $T ^ { \prime }$ ) by a minimal length spanning tree and add $4 m$ more points along the edges of these two spanning trees so that the added points are equally spaced along every edge. We assign the new points on the spanning tree of $S ^ { \prime }$ to $S$ and of $T ^ { \prime }$ to $T$ .
385
+
386
+ We argue that the obtained point set $X$ of size $1 0 m$ satisfies the conditions of the lemma. Clearly, $\tilde { S } \subset \bar { S }$ and $\tilde { T } \subset T$ . To show that property a is satisfied, note that the length of each spanning tree cannot exceed $2 m$ , since the full $2 m$ grid points $\tilde { X }$ can be connected with a tree of length $2 m - 1$ . It is evident therefore that every two points $x _ { i } , x _ { j } \in S$ (resp. $T$ ) are connected by a path in which the distance between each two consecutive points is strictly less than 1 (property a). Property $\mathbf { b }$ too is satisfied because the grid points in $\tilde { X }$ are at least distance 1 apart; each midpoint $x _ { i } ^ { \prime \prime }$ is distance $1 / 2$ from $x _ { i }$ and $\boldsymbol { x } _ { i } ^ { \prime }$ (and they all belong to the same set, either $S$ or $T$ ), but its distance to the rest of the points in $\tilde { X }$ exceeds 1, and the rest of the points in $S$ (resp. $T$ ) are on the $Z = 1$ (resp. $Z = 1$ ) plane, and so they are at least distance 1 away from members of the opposite set which all lie in the $Z \le 0$ (resp. $Z \geq 0$ ) half space. □
387
+
388
+ Lemma C.3. . Let $f ( \cdot )$ be the spectral clustering loss
389
+
390
+ $$
391
+ f ( y ) = \sum _ { i , j } W _ { i , j } ( y _ { i } - y _ { j } ) ^ { 2 } .
392
+ $$
393
+
394
+ Let $G = ( X , W )$ be a $( \alpha , \beta )$ -separated graph, such that $\vert X \vert = n \ge 4$ . Let $y ^ { * }$ be a minimizer of $f ( y ) w . r . t W$ , subject to $1 ^ { T } y = 0 , \ \| y \| = 1$ . Let
395
+
396
+ and similarly
397
+
398
+ $$
399
+ \begin{array} { r l } & { \Delta _ { S } = \operatorname* { m a x } \{ y _ { i } ^ { * } - y _ { j } ^ { * } : x _ { i } , x _ { j } \in S \} , } \\ & { } \\ & { \Delta _ { T } = \operatorname* { m a x } \{ y _ { i } ^ { * } - y _ { j } ^ { * } : x _ { i } , x _ { j } \in T \} . } \end{array}
400
+ $$
401
+
402
+ Let $\Delta = \operatorname* { m a x } \left\{ \Delta _ { S } , \Delta _ { T } \right\}$ . Then
403
+
404
+ $$
405
+ \frac { \alpha } { \beta } \Delta ^ { 2 } \leq \frac { n ^ { 2 } } { 2 } .
406
+ $$
407
+
408
+ Proof. Without loss of generality, assume that $x _ { 1 } , \ldots , x _ { \frac { n } { 2 } } \in S$ , $x _ { \frac { n } { 2 } + 1 } , \ldots , x _ { n } \in T$ , and that $y _ { 1 } ^ { * } \leq$ $y _ { 2 } ^ { * } \leq . . . \leq y _ { \frac { n } { 2 } } ^ { * }$ and $y _ { \frac { n } { 2 } + 1 } ^ { * } \leq y _ { \frac { n } { 2 } + 2 } ^ { * } \leq \cdot \cdot \cdot \leq y _ { n } ^ { * }$ . Also wlog, $\Delta = \Delta ^ { \acute { \prime } } s$ . We begin by lower-bounding $f ( y ^ { * } )$ .
409
+
410
+ $$
411
+ \begin{array} { l } { f ( y ^ { * } ) = \displaystyle \sum _ { i , j } W _ { i , j } ( y _ { i } ^ { * } - y _ { j } ^ { * } ) ^ { 2 } } \\ { \geq \displaystyle \sum _ { x _ { i } , x _ { j } \in S } W _ { i , j } ( y _ { i } ^ { * } - y _ { j } ^ { * } ) ^ { 2 } + \displaystyle \sum _ { x _ { i } , x _ { j } \in T } W _ { i , j } ( y _ { i } ^ { * } - y _ { j } ^ { * } ) ^ { 2 } . } \end{array}
412
+ $$
413
+
414
+ Since $G$ is $( \alpha , \beta )$ -separated, there exists a path from $y _ { 1 }$ to $y _ { \frac { n } { 2 } }$ (and likewise from $y _ { \frac { n } { 2 } + 1 } ^ { { n } }$ to $y _ { n }$ where the affinity of every pair of consecutive points exceeds $\alpha$ . Denote this path by $\Gamma _ { S }$ (resp. $\Gamma _ { T }$ ), therefore
415
+
416
+ $$
417
+ f ( \boldsymbol { y } ^ { * } ) \ge \alpha \left( \sum _ { x _ { k _ { i } } , x _ { k _ { i + 1 } } \in \Gamma _ { S } } ( \boldsymbol { y } _ { k _ { i + 1 } } ^ { * } - \boldsymbol { y } _ { k _ { i } } ^ { * } ) ^ { 2 } + \sum _ { x _ { k _ { i } } , x _ { k _ { i + 1 } } \in \Gamma _ { T } } ( \boldsymbol { y } _ { k _ { i + 1 } } ^ { * } - \boldsymbol { y } _ { k _ { i } } ^ { * } ) ^ { 2 } \right) .
418
+ $$
419
+
420
+ Note that these are telescopic sums of squares. Clearly, such sum of squares is minimized if all $n / 2$ points are ordered and equi-distant, i.e., if we divide a segment of length $\Delta$ into $n / 2 - 1$ segments of equal length. Consequently, discarding the second summand,
421
+
422
+ $$
423
+ f ( y ^ { * } ) \geq \alpha \left( \frac { n } { 2 } - 1 \right) \left( \frac { \Delta } { n / 2 - 1 } \right) ^ { 2 } = \frac { 2 \Delta ^ { 2 } \alpha } { n - 2 } \geq \frac { 2 \Delta ^ { 2 } \alpha } { n } ,
424
+ $$
425
+
426
+ Next, to produce an upper bound, we consider the vector $\bar { y } = \textstyle \frac { 1 } { \sqrt { n } } ( - 1 , \dotsc , - 1 , 1 , \dotsc 1 )$ , i.e., $\bar { y } _ { i } =$ $- { \frac { 1 } { \sqrt { n } } }$ for $i \leq \frac { n } { 2 }$ , and $\scriptstyle { \frac { 1 } { \sqrt { n } } }$ otherwise. For this vector,
427
+
428
+ $$
429
+ f ( \bar { y } ) \leq \beta \left( \frac { n } { 2 } \right) ^ { 2 } \left( \frac { 2 } { \sqrt { n } } \right) ^ { 2 } = n \beta .
430
+ $$
431
+
432
+ In summary, we obtain
433
+
434
+ Hence
435
+
436
+ $$
437
+ \begin{array} { c } { { \displaystyle \frac { 2 \Delta ^ { 2 } \alpha } { n } \leq f ( y ^ { * } ) \leq f ( \bar { y } ) \leq n \beta , } } \\ { { { } } } \\ { { \displaystyle \frac { \alpha } { \beta } \Delta ^ { 2 } \leq \frac { n ^ { 2 } } { 2 } . } } \end{array}
438
+ $$
439
+
440
+ Lemma C.4. Let $y \in \mathbb { R } ^ { n }$ be a vector such that $1 ^ { T } y ~ = ~ 0$ , and $\| y \| = 1$ . Let $X \ = \ S \cup T$ , $\begin{array} { r } { | S | = | T | = \frac { n } { 2 } } \end{array}$ .
441
+
442
+ and similarly
443
+
444
+ $$
445
+ \begin{array} { r l } & { \Delta _ { S } = \operatorname* { m a x } \{ y _ { i } - y _ { j } : x _ { i } , x _ { j } \in S \} , } \\ & { } \\ & { \Delta _ { T } = \operatorname* { m a x } \{ y _ { i } - y _ { j } : x _ { i } , x _ { j } \in T \} . } \end{array}
446
+ $$
447
+
448
+ Let $\Delta = \operatorname* { m a x } \left\{ \Delta _ { S } , \Delta _ { T } \right\}$ . If $\begin{array} { r } { \Delta < \frac { 1 } { \sqrt { 2 n } } } \end{array}$ , then
449
+
450
+ $$
451
+ \operatorname* { m a x } \{ y _ { i } : x _ { i } \in S \} < 0 < \operatorname* { m i n } \{ y _ { i } : x _ { i } \in T \} .
452
+ $$
453
+
454
+ Proof. Let
455
+
456
+ $$
457
+ m _ { S } = \frac { 2 } { n } \sum _ { x _ { i } \in S } y _ { i } , m _ { T } = \frac { 2 } { n } \sum _ { x _ { i } \in T } y _ { i } .
458
+ $$
459
+
460
+ Since $1 ^ { T } y = 0$ , we have $m _ { S } = - m _ { T }$ . Without loss of generality, assume that $m _ { S } < 0 < m _ { T }$ . For every $y _ { i }$ such that $x _ { i } \in S$ ,
461
+
462
+ $$
463
+ ( y _ { i } - m _ { S } ) ^ { 2 } \leq \Delta ^ { 2 } .
464
+ $$
465
+
466
+ Similarly, for every $y _ { i }$ such that $x _ { i } \in T$ ,
467
+
468
+ $$
469
+ ( y _ { i } + m _ { S } ) ^ { 2 } = ( y _ { i } - m _ { T } ) ^ { 2 } \leq \Delta ^ { 2 } .
470
+ $$
471
+
472
+ This gives
473
+
474
+ $$
475
+ \begin{array} { r c l } { { } } & { { } } & { { { n \displaystyle \Delta ^ { 2 } \geq \sum _ { x _ { i } \in S } ( y _ { i } - m _ { S } ) ^ { 2 } + \sum _ { x _ { i } \in T } ( y _ { i } + m _ { S } ) ^ { 2 } } } } \\ { { } } & { { } } & { { = \displaystyle \sum _ { x _ { i } \in S \cup T } y _ { i } ^ { 2 } - 2 m _ { S } \sum _ { x _ { i } \in S } y _ { i } + 2 m _ { S } \sum _ { x _ { i } \in T } y _ { i } + n m _ { S } ^ { 2 } } } \\ { { } } & { { } } & { { = 1 - 2 m _ { S } \cdot m _ { S } \frac { n } { 2 } + 2 m _ { S } \cdot - m _ { S } \frac { n } { 2 } + n m _ { S } ^ { 2 } } } \\ { { } } & { { } } & { { = 1 - n m _ { S } ^ { 2 } , } } \end{array}
476
+ $$
477
+
478
+ which gives
479
+
480
+ $$
481
+ m _ { S } ^ { 2 } \geq \frac { 1 - n \Delta ^ { 2 } } { n } .
482
+ $$
483
+
484
+ In order to obtain the desired result, i.e., that $\operatorname* { m a x } \{ y _ { i } : x _ { i } \in S \} < 0 < \operatorname* { m i n } \{ y _ { i } : x _ { i } \in T \}$ , it therefore remains to show that for a sufficiently small $\Delta$ , by (7), $m _ { S } + \Delta < 0$ (this will also yield $m _ { T } - \Delta > 0 ,$ ). Hence, we will require
485
+
486
+ $$
487
+ { \frac { 1 - n \Delta ^ { 2 } } { n } } \geq \Delta ^ { 2 } ,
488
+ $$
489
+
490
+ which holds for $\begin{array} { r } { \Delta < \frac { 1 } { \sqrt { 2 n } } } \end{array}$
491
+
492
+ # C.2 PROOF OF THEOREM 4.1
493
+
494
+ Proof. To determine the VC-dimension of $\mathcal { F } _ { n } ^ { \mathrm { s p } }$ ectral clustering we need to show that there exists a set of $m = n / 1 0$ points (assuming for simplicity that $n$ is divisible by 10) that is shattered by spectral clustering. By Lemma C.2, there exists a set of $m$ points $\tilde { X } \subseteq \mathbb { R } ^ { d } \left( d \geq 3 \right)$ so that for any dichotomy of $\tilde { X }$ there exists a set $X \supset { \tilde { X } }$ of $n = 1 0 m$ points, with a balanced partition $X = S \cup T$ that respects the dichotomy of $\tilde { X }$ , and whose points satisfy properties a and $\mathbf { b }$ of Lemma C.2 with $0 \leq b < 1$ .
495
+
496
+ Consider next the complete graph $G = ( V , W )$ whose vertices $v _ { i } \in V$ correspond to point $x _ { i }$ and the affinity matrix $W$ is set with the standard Gaussian affinity $\begin{array} { r } { W _ { i , j } = \exp \left( { - \frac { \| x _ { i } - x _ { j } \| ^ { 2 } } { 2 \sigma ^ { 2 } } } \right) } \end{array}$ where the value of $\sigma$ will be provided below. It can be readily verified that, due to properties a and $\mathbf { b }$ , $G$ is $( \alpha , \beta )$ -separated, where
497
+
498
+ $$
499
+ \alpha = \exp \left( - \frac { b ^ { 2 } } { 2 \sigma ^ { 2 } } \right) , \beta = \exp \left( - \frac { 1 } { 2 \sigma ^ { 2 } } \right) .
500
+ $$
501
+
502
+ Let $y ^ { * }$ be the second-smallest eigenvector of the graph Laplacian matrix for $G$ , i.e., the minimizer of
503
+
504
+ $$
505
+ f ( y ) = \sum _ { i , j } W _ { i , j } ( y _ { i } - y _ { j } ) ^ { 2 } , \quad \mathrm { s . t . } \quad 1 ^ { T } y = 0 , y ^ { T } y = 1 .
506
+ $$
507
+
508
+ By Lemma C.3, since $G$ is $( \alpha , \beta )$ -separated, $\Delta$ , i.e, the spread of the entries of $y ^ { * }$ for the partition $S \cup T$ , should satisfy
509
+
510
+ $$
511
+ \frac { \alpha } { \beta } \Delta ^ { 2 } \leq \frac { n ^ { 2 } } { 2 } .
512
+ $$
513
+
514
+ Notice that
515
+
516
+ $$
517
+ \frac { \alpha } { \beta } = \exp \left( \frac { 1 - b ^ { 2 } } { 2 \sigma ^ { 2 } } \right) ,
518
+ $$
519
+
520
+ allowing us to make $\Delta$ arbitrarily small by pushing the scale $\sigma$ towards $0 ^ { 3 }$ . In particular, we can set $\sigma$ so as to make $\Delta$ satisfy $\Delta < 1 / \sqrt { 2 n }$ . Therefore, by lemma (C.4), thresholding $y ^ { * }$ at 0 respects the partition of $X$ , and hence also the dichotomy of $\tilde { X }$ .
521
+
522
+ In summary, we have shown that any dichotomy of $\tilde { X }$ can be obtained from a second-smallest eigenvector of some graph Laplacian of $n$ points. Hence the VC dimension of $\mathcal { F }$ is at least $m =$ $n / 1 0$ . □
523
+
524
+ Table 2: Siamese net and SpectralNet architectures in the MNIST and Reuters experiments.
525
+
526
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Siamese net</td><td rowspan=1 colspan=1>SpectralNet</td></tr><tr><td rowspan=1 colspan=1>MNIST</td><td rowspan=1 colspan=1>ReLU,size=1024ReLU,size = 1024ReLU,size = 512ReLU,size = 10■</td><td rowspan=1 colspan=1>ReLU,size=1024ReLU,size = 1024ReLU,size = 512tanh, size = 10orthonorm</td></tr><tr><td rowspan=1 colspan=1>Reuters</td><td rowspan=1 colspan=1>ReLU, size= 512ReLU,size = 256ReLU,size = 128=</td><td rowspan=1 colspan=1>ReLU, size = 512ReLU, size = 256tanh, size =4orthonorm</td></tr></table>
527
+
528
+ Table 3: Additional technical details.
529
+
530
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>MNISTSiamese</td><td rowspan=1 colspan=1>MNISTSpectralNet</td><td rowspan=1 colspan=1>ReutersSiamese</td><td rowspan=1 colspan=1>ReutersSpectralNet</td></tr><tr><td rowspan=1 colspan=1>Batch size</td><td rowspan=1 colspan=1>128</td><td rowspan=1 colspan=1>1024</td><td rowspan=1 colspan=1>128</td><td rowspan=1 colspan=1>2048</td></tr><tr><td rowspan=1 colspan=1>Ortho.batch size</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>1024</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>2048</td></tr><tr><td rowspan=1 colspan=1>Initial LR</td><td rowspan=1 colspan=1>10-3</td><td rowspan=1 colspan=1>10-3</td><td rowspan=1 colspan=1>10-3</td><td rowspan=1 colspan=1>5·10-5</td></tr><tr><td rowspan=1 colspan=1>LR decay</td><td rowspan=1 colspan=1>.1</td><td rowspan=1 colspan=1>.1</td><td rowspan=1 colspan=1>.1</td><td rowspan=1 colspan=1>.1</td></tr><tr><td rowspan=1 colspan=1>Optimizer</td><td rowspan=1 colspan=1>RMSprop</td><td rowspan=1 colspan=1>RMSprop</td><td rowspan=1 colspan=1>RMSprop</td><td rowspan=1 colspan=1>RMSprop</td></tr><tr><td rowspan=1 colspan=1>Patience epochs</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>10</td></tr></table>
531
+
532
+ # D TECHNICAL DETAILS
533
+
534
+ For $k$ -means we used Python’s sklearn.cluster; we used the default configuration (in particular, 300 iterations of the algorithm, 10 restarts from different centroid seeds, final results are from the run with the best objective). To perform spectral clustering, we computed an affinity matrix $W$ using (6), with the number of neighbors set to 25 and the scale $\sigma$ set to the median distance from each point to its $2 5 \mathrm { t h }$ neighbor. Once $W$ was computed, we took the $k$ eigenvectors of $D - W$ corresponding to the smallest eigenvalues, and then applied $k$ -means to that embedding. The $k$ -means configuration was as above. In our experiments, the loss (3) was computed with a factor of $\frac { 1 } { m }$ rather than $\scriptstyle { \frac { 1 } { m ^ { 2 } } }$ , for numerical stability. The architectures of the Siamese net and SpectralNet are described in Table 2. Additional technical details are shown in Table 3.
535
+
536
+ The learning rate policy for all nets was determined by monitoring the loss on a validation set (a random subset of the training set); once the validation loss did not improve for a specified number of epochs (see patience epochs in Table 3), we divided the learning rate by 10 (see $L R$ decay in Table 3). Training stopped once the learning rate reached $1 0 ^ { - 8 }$ . Typical training took about 100 epochs for a Siamese net and less than 20,000 parameter updates for SpectralNet, on both MNIST and Reuters.
537
+
538
+ In the MNIST experiments, the training set for the Siamese was obtained by pairing each data point with its two nearest neighbors (in Euclidean distance). During the training of the spectral map, we construct the batch affinity matrix $W$ by connecting each point to its nearest two neighbors in the Siamese distance. The scale $\sigma$ in (6) was set to the median of the distances from each point to its nearest neighbor.
539
+
540
+ In the Reuters experiment, we obtained the training set for the Siamese net by pairing each point from that set to a random point from its 100 nearest neighbors, found by approximate nearest neighbor algorithm4. To evaluate the generalization performance, the Siamese nets were trained using training data only. The scale $\sigma$ in (6) was set globally to the median (across all points in the dataset) distance from any point to its 10th neighbor.
541
+
542
+ Finally, we used the validation loss to determine the hyper-parameters. To demonstrate that indeed the validation loss is correlated to clustering accuracy, we conducted a series of experiments with the MNIST dataset, where we varied the net architectures and learning rate policies; the Siamese net and Gaussian scale parameter $\sigma$ were held fixed throughout all experiments. In each experiment, we measured the loss on a validation set and the clustering accuracy (over the entire data). The correlation between loss and accuracy across these experiments was -0.771. This implies that hyperparameter setting for the spectral map learning can be chosen based on the validation loss, and a setup that yields a smaller validation loss should be preferred. We remark that we also use the convergence of the validation loss to determine our learning rate schedule and stopping criterion.
md/train/HJaDJZ-0W/HJaDJZ-0W.md ADDED
@@ -0,0 +1,294 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # BLOCK-SPARSE RECURRENT NEURAL NETWORKS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Recurrent Neural Networks (RNNs) are used in state-of-the-art models in domains such as speech recognition, machine translation, and language modelling. Sparsity is a technique to reduce compute and memory requirements of deep learning models. Sparse RNNs are easier to deploy on devices and high-end server processors. Even though sparse operations need less compute and memory relative to their dense counterparts, the speed-up observed by using sparse operations is less than expected on different hardware platforms. In order to address this issue, we investigate two different approaches to induce block sparsity in RNNs: pruning blocks of weights in a layer and using group lasso regularization with pruning to create blocks of weights with zeros. Using these techniques, we can create block-sparse RNNs with sparsity ranging from $80 \%$ to $90 \%$ with a small loss in accuracy. This technique allows us to reduce the model size by roughly $1 0 \times$ . Additionally, we can prune a larger dense network to recover this loss in accuracy while maintaining high block sparsity and reducing the overall parameter count. Our technique works with a variety of block sizes up to $3 2 \times 3 2$ . Block-sparse RNNs eliminate overheads related to data storage and irregular memory accesses while increasing hardware efficiency compared to unstructured sparsity.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Improvements in several applications such as speech recognition (Amodei et al., 2016), language modeling (Jozefowicz et al. ´ , 2016), and machine translation (Wu et al., 2016) are a result of large Recurrent Neural Networks (RNNs) trained on large scale datasets. As the datasets available to train these models have grown, so have model sizes. Deployment of such large models is compute and memory intensive.
12
+
13
+ Pruning weights of deep neural networks is an effective strategy to reduce the overall memory and compute requirements of these models (Narang et al., 2017; Han et al., 2015). However, these approaches induce random, unstructured sparsity in the weight matrices. Speed-up obtained with unstructured sparsity on various hardware platforms are often lower than expected (as shown in Narang et al. (2017); Narang & Diamos (2017)). Sparse formats do not efficiently utilize the hardware resources due to storage overheads and irregular memory access. Block sparsity can address these issues. Saving indices of non-zero blocks instead of indices for non-zero elements reduces the storage overhead by a factor of block size. Block-sparse formats store blocks contiguously in memory reducing irregular memory accesses.
14
+
15
+ Another disadvantage of unstructured sparsity is that it cannot directly exploit array-data-paths in modern processors. These include the $1 6 \times 1 6$ TensorCore units in the Volta GPU (NVIDIA, 2017) or the $2 5 6 \times 2 5 6$ hardware units in the Tensor Processing Unit (TPU) (Jouppi et al., 2017). Structured sparsity in the form of two-dimensional blocks allows us to take advantage of these faster units.
16
+
17
+ In order to induce block sparsity in RNNs, we propose a block pruning approach that zeros out blocks of weights in the matrix while the network is training. At the end of training, the algorithm creates a block-sparse RNN. In addition to this pruning technique, we examine the efficacy of group lasso regularization (Yuan & Lin, 2006b) to induce block sparsity in the network. We also combine group lasso regularization with block pruning.
18
+
19
+ We demonstrate that block pruning and group lasso regularization with pruning are successful in creating block-sparse RNNs. Inducing block sparsity with $4 \times 4$ blocks in vanilla RNNs and Gated Recurrent Units (GRUs) (Cho et al., 2014) results in $9 \%$ to $17 \%$ loss in accuracy compared to the dense baseline. Model size reduces by nearly $1 0 \times$ for speech recognition. Block sizes can be scaled up to $3 2 \times 3 2$ with our approach. We can also reduce accuracy loss by starting with a larger dense matrix than the baseline and then pruning it down while still reducing the number of parameters compared to the baseline. We demonstrate that this approach works with Long Short Term Memory (LSTM) (Hochreiter & Schmidhuber, 1997) cells for Language Modelling as well.
20
+
21
+ Our approach is agnostic to the optimization algorithm and does not require any hyper-parameter retuning (besides pruning and regularization hyper-parameters). Furthermore, since our approach does not require re-training the model, training time remains constant.
22
+
23
+ # 2 RELATED WORK
24
+
25
+ There have been several approaches to reduce the network size by pruning the model. Hanson & Pratt (1989) use several bias techniques to decay weights in a network. LeCun et al. (1989) and Hassibi et al. (1993) both use Hessian-based approaches to prune weights below a certain threshold. Simpler approaches like sorting or thresholding can be used to prune a neural network. Han et al. (2015) and Liu et al. (2015) prune Convolution Neural Networks (CNNs) while maintaining high accuracy. Yu et al. (2012) use a hard threshold to prune deep learning models. Narang et al. (2017) and Zhu & Gupta (2017) prune recurrent neural networks during the initial training run with a small accuracy loss using gradual pruning. Unlike our technique, all of the above approaches induce random, unstructured sparsity in neural networks.
26
+
27
+ Several approaches exist to induce structured sparsity in neural networks. Mao et al. (2017) use a simple threshold based technique to create structurally sparse CNNs. Yu et al. (2017) propose Scalpel, which prunes CNNs taking into account the underlying target hardware architecture. Wen et al. (2017) alter the structure of LSTMs to create cells with smaller memory footprint. They demonstrate that this technique works for language modeling on the Penn Tree Bank dataset. Our approach works with both vanilla RNN and GRU models trained on a large-scale datasets for speech recognition.
28
+
29
+ Regularization is a known method to induce sparsity in deep neural networks (Faraone et al., 2017; Fan et al., 2016). Group lasso regularization has been used as an efficient method for generating sparse structures (Yuan & Lin, 2006b; Kim & Xing, 2010). Wen et al. (2016) use group lasso regularization to induce structured sparsity in CNNs. Scardapane et al. (2017) also use group lasso regularization to induce sparisty in fully connected networks. To the best of our knowledge, none of these approaches have been used with RNNs trained on large-scale datasets.
30
+
31
+ Other approaches to reduce compute and memory footprint for deep learning models include quantization (Micikevicius et al., 2017; Vanhoucke et al., 2011; Rastegari et al., 2016; Gupta et al., 2015) and low-rank factorization (Denil et al., 2013; Denton et al., 2014). Our approach is orthogonal to these methods and can be combined with them.
32
+
33
+ # 3 IMPLEMENTATION
34
+
35
+ # 3.1 BLOCK PRUNING
36
+
37
+ Our approach to pruning deep learning models builds on the work by Narang et al. (2017). They propose a weight pruning algorithm that introduces random, unstructured sparsity in RNNs. In their work, they propose pruning weights below a monotonically increasing threshold. Their pruning strategy does not impose any structure on the weights.
38
+
39
+ We extend this approach to prune blocks of a matrix instead of individual weights. We divide the weight matrix into a grid of two-dimensional blocks with a fixed block size. Block size ranges between $4 \times 4$ to $3 2 \times 3 2$ in our experiments. In order to prune blocks, we pick the weight with the maximum magnitude to represent the entire block. If this maximum magnitude of a block is below the threshold, we set all the weights in that block to zeros. Figure 1 depicts the process of generating a block-sparse mask from a weight matrix for a given threshold. The block-sparse mask is multiplied with the weights to generate block-sparse weight matrix. The monotonically growing threshold () causes more blocks to be pruned as training progresses. We stop pruning more blocks after $40 \%$ of training has completed. All zeroed out blocks are held at zero until the end of training.
40
+
41
+ ![](images/43956c67f51eedb731c5c97436e5b3e9cdfdf7c433163dc3796f60388fc1bb3a.jpg)
42
+ Figure 1: Generating block-sparse masks from a weight matrix
43
+
44
+ Table 1: Heuristics to pick hyper-parameters for block-pruning
45
+
46
+ <table><tr><td>HYPER-PARAM</td><td>DESCRIPTION</td><td>HEURISTICVALUES</td></tr><tr><td>start_itr ramp_itr</td><td>Iteration to start pruning</td><td>Start of second epoch Start of 20% of total epochs</td></tr><tr><td>end_itr</td><td>Iteration to increase the rate of pruning Iteration to stop pruning more parame-</td><td>Start of 40% of total epochs</td></tr><tr><td>start_slope</td><td>ters Initial rate of increasing the threshold</td><td>See Equation 2</td></tr><tr><td>(0) ramp_slope</td><td>Rate of increasing threshold after ramp</td><td>1.20 to 1.70</td></tr><tr><td>() freq</td><td>iteration Number of iterations after whiché is updated</td><td>100</td></tr></table>
47
+
48
+ Narang et al. (2017) use six hyper-parameters to determine the threshold at a given iteration. Table 1 provides the description and heuristics (adapted for block pruning) for these hyper-parameters. The start slope and ramp slope determine the rate at which the threshold increases. In order to determine start slope, they recommend using weights from an existing dense model. To achieve $90 \%$ sparsity, they assign $q$ to the weight that is the 90th percentile of the absolute values in a weight matrix. Assuming $\phi$ is $1 . 5 \theta$ , they use Equation 1 to determine $\theta$ .
49
+
50
+ $$
51
+ \theta = { \frac { 2 \times q \times f r e q } { 2 \times ( r a m p . i t r - s t a r t . i t r ) + 3 \times ( e n d . i t r - r a m p . i t r ) } }
52
+ $$
53
+
54
+ For block pruning, we need to modify the start slope to take into account the number of elements in a block $( N _ { b } )$ . In order to calculate the start slope, we first calculate start slope for weight pruning $( \theta _ { w } )$ using the Equation 1. Given $\theta _ { w }$ , we suggest using Equation 2 to determine the initial slope $( \theta _ { b } )$ for block pruning. Based on empirical results, we have found that using this approach allows us to achieve block sparsity ranging from $8 5 \%$ to $9 5 \%$ . Further tuning of these hyper-parameters is required to achieve desired block sparsity.
55
+
56
+ $$
57
+ \theta _ { b } = \theta _ { w } \times \sqrt [ 4 ] { N _ { b } }
58
+ $$
59
+
60
+ We prune all the recurrent and fully connected layers in the network using the same block size. The pruning hyper-parameters are same for each type of layer in the network — recurrent weight layer and linear or fully connected layer.
61
+
62
+ # 3.2 GROUP LASSO REGULARIZATION
63
+
64
+ Group lasso is a type of weight regularization that works on groups of weights. For each group, we add a loss term proportional to the $\ell _ { 2 }$ norm of the group.
65
+
66
+ $$
67
+ L = L _ { \mathrm { t r a i n i n g } } + \lambda _ { g } \sum _ { g = 1 } ^ { G } \| w ^ { ( g ) } \| _ { 2 }
68
+ $$
69
+
70
+ where $w ^ { ( g ) }$ is a group of weights, $\| w ^ { ( g ) } \| _ { 2 }$ is the $\ell _ { 2 }$ norm of the group, and $G$ is the total number of groups. Our use of $\ell _ { 2 }$ norm is a variant of the more general group lasso defined in Yuan & Lin (2006a) as $\| n \| _ { K } = ( n ^ { \prime } K n ) ^ { 1 / 2 }$ .
71
+
72
+ A large enough $\lambda _ { g }$ will drive all weights within certain groups to zeros. The choice of grouping varies by application, and group lasso is widely-used to induce various kinds of structured sparsity (Wen et al., 2017; Scardapane et al., 2017). By choosing groups to exactly match our 2D grid of blocks, we can induce block-sparsity. Thus, group lasso is an existing sparsity algorithm that we can readily compare to our block pruning approach.
73
+
74
+ In addition, we extend group lasso to work with block pruning. The groups match the 2D grid of blocks used by the pruning algorithm. One interpretation of weight regularization is that less important weights are driven towards zero and more important weights retain large absolute values. Thus, group lasso guides the selection of blocks to prune. We apply group lasso to coincide with the pruning schedule. We use a relatively small $\lambda _ { g }$ to avoid underfitting due to excessive regularization. We turn off group lasso when the pruning schedule ends, which is typically after around $40 \%$ o f training epochs. Weights that were already set to zero remain unchanged after this point.
75
+
76
+ Group lasso is related to the well-known $\ell _ { 1 }$ regularization. In Appendix A, we discuss exploration of $\ell _ { 1 }$ regularization combined with weight pruning.
77
+
78
+ # 4 EXPERIMENTS
79
+
80
+ We present results on two different applications: Speech Recognition (Section 4.1) and Language Modelling (Section 4.2).
81
+
82
+ # 4.1 SPEECH RECOGNITION
83
+
84
+ We run block sparsity experiments on two different speech recognition models from Amodei et al. (2016). The RNN model consists of seven bidirectional vanilla recurrent layers with 1760 hidden units for a total of 67 million parameters. The GRU model consists of three recurrent layers with GRU cells with 2560 hidden units for a total of 115 million parameters. Both models use the Connectionist Temporal Classification (CTC) (Graves et al., 2006) cost function. We use a training set of 2100 hours of speech and validation set of 3.46 hours. The Character Error Rate (CER) results are reported on an independent test set, consisting of 2.9 hours of English data.
85
+
86
+ In order to introduce block sparsity in these models, we run two different types of experiments — Block Pruning (BP) and Group Lasso with block pruning (GLP). We prune weights in the recurrent layers (both linear and recurrent weights) and fully connected layers. Biases, batch-normalization parameters and weights in the convolutional and CTC layers are not pruned since they account for a small portion of the total weights in the network. No existing hyper-parameter changes were required for sparse training runs. The models are trained using Nesterov Stochastic Gradient Descent (SGD) with momentum. All models are trained for 25 epochs.
87
+
88
+ In Section 4.1.1, we report results for different sparse models pruned with $4 \times 4$ blocks and compare these results with other pruning approaches. In Section 4.1.2, we discuss the impact of varying the block size on the accuracy of the model.
89
+
90
+ # 4.1.1 BLOCK SPARSITY
91
+
92
+ Initially, we prune the dense RNN model. Using BP, we are able to reduce the parameter count for both these models by nearly $1 0 \times$ . As shown in Table 2, the block-sparse RNN model with 1760 hidden units has an overall block sparsity of $89 \%$ with a CER of 17.93.
93
+
94
+ As mentioned in Section 3, group lasso by itself can induce block-sparsity. However, as shown in Table 2, group lasso results in significantly worse CER than our block pruning approach. In order to achieve high sparsity $80 \%$ or higher) with group lasso, we need to set $\lambda _ { g }$ to a relatively high value. This high regularization factor hurts the model accuracy. The dense baseline model is trained without any regularization. Therefore, group lasso results in underfitting the training data due to the high value of $\lambda _ { g }$ . Group lasso could be more successful in inducing block-sparsity where the dense model overfits the training dataset.
95
+
96
+ Table 2: Bidirectional RNN model results. Block-Sparse models are trained with 4x4 blocks
97
+
98
+ <table><tr><td>MODEL</td><td>LAYER SIZE</td><td># PARAMS (in millions)</td><td>CER (% LOSS)</td><td>EPOCHS</td><td>PRUNING ALGORITHM</td></tr><tr><td>RNN Dense</td><td>1760</td><td>67</td><td>15.36 (0.0%)</td><td>25</td><td>N/A</td></tr><tr><td>RNN Block-Sparse</td><td>1760</td><td>10.9</td><td>30.14 (-96%)</td><td>25</td><td>Group lasso</td></tr><tr><td>RNN Sparse</td><td>1760</td><td>8.3</td><td>18.91 (-23%)</td><td>25</td><td>Yu et al. (2012)</td></tr><tr><td>RNN Sparse</td><td>1760</td><td>7.3</td><td>17.32 (-13%)</td><td>25</td><td>Narang et al. (2017)</td></tr><tr><td>RNN Sparse</td><td>1760</td><td>7.1</td><td>15.41 (-0.3%)</td><td>60</td><td>Han et al. (2015)</td></tr><tr><td>RNN Block-Sparse</td><td>1760</td><td>7.3</td><td>17.93 (-17%)</td><td>25</td><td>Ours (BP)</td></tr><tr><td>RNN Block-Sparse</td><td>2560</td><td>12.9</td><td>15.89 (-3.4%)</td><td>25</td><td>Ours (GLP)</td></tr><tr><td>RNN Block-Sparse</td><td>3072</td><td>25.8</td><td>15.66 (-1.9%)</td><td>25</td><td>Ours (BP)</td></tr></table>
99
+
100
+ Table 3: GRU model results with $4 \times 4$ blocks
101
+
102
+ <table><tr><td>MODEL</td><td>LAYER SIZE</td><td>#PARAMS (in millions)</td><td>CER (% LOSS)</td><td>EPOCHS</td><td>PRUNING ALGORITHM</td></tr><tr><td>GRU Dense</td><td>2560</td><td>115</td><td>15.42 (0.0%)</td><td>25</td><td>N/A</td></tr><tr><td>GRU Block-Sparse</td><td>2560</td><td>10.8</td><td>16.78 (-8.8%)</td><td>25</td><td>Ours (GLP)</td></tr><tr><td>GRU Block-Sparse</td><td>3584</td><td>25.6</td><td>16.23 (-5.3%)</td><td>25</td><td>Ours (BP)</td></tr></table>
103
+
104
+ Comparison to other pruning methods: In addition to group lasso, we compare our block pruning approach with three existing pruning methods. As shown in Table 2, our block-sparse model achieves better accuracy than the hard thresholding scheme in Yu et al. (2012). Sparse RNNs generated using Narang et al. (2017) is about $4 \%$ better than the block-sparse model. The sparse RNN model generated using iterative pruning (Han et al., 2015) is significantly better than than blocksparse model. However, this approach requires training the model for 60 epochs instead of 25 epochs for all other approaches. This results in 180 hours of additional training time for the RNN model. This $2 { - } 3 \times$ increase in training time may not be practical for state-of-the-art models trained on large datasets, which usually need weeks of training time. Additionally, all the above approaches generate random, unstructured sparsity in the model. In current hardware, the compute and memory savings with block sparsity are significantly higher than random sparsity. We discuss the performance aspect in more detail in Section 5.
105
+
106
+ Larger models: In order to recover the accuracy loss with our approach, we train sparse models with more hidden units in each recurrent layers. For RNN models, we increase the hidden layer size to 2560 and 3072. As shown in Table 2, the RNN sparse 3072 is only $1 . 9 \%$ worse than the dense baseline model. The 2560 and 3072 sparse RNN models reduce the overall parameter count by $5 \times$ and $2 . 5 \times$ respectively relative to the dense model with 1760 hidden units in each layer.
107
+
108
+ GRU model: Similar to the RNN models, the block-sparse GRU model can reduce the overall parameter count by $1 1 \times$ . As shown in Table 3, the block-sparse GRU model achieves slightly higher sparsity $( 9 0 \% )$ with a CER of 16.23 which is only $9 \%$ worse than the dense GRU model. This indicates that the block-sparse GRU model retains most of the capacity of the dense model. As demonstrated with the RNN model, pruning a larger GRU model with 3584 hidden nodes reduces the accuracy loss to about $5 \%$ while still shrinking the model by $4 . 5 \times$ relative to the dense model with 2560 hidden nodes in each layer.
109
+
110
+ # 4.1.2 BLOCK SIZE VARIATION
111
+
112
+ Table 4 shows that block pruning works for block sizes upto $3 2 \times 3 2$ . Increasing the block size to $1 6 \times 1 6$ and $3 2 \times 3 2$ requires reducing the sparsity to $8 3 . 6 \%$ and $7 9 . 1 \%$ respectively for RNN models to obtain good accuracy. Similar results hold true for the GRU model as well. Large sparse blocks reduce memory overhead for storing non zero values and can take advantage of array data-paths in modern processors. Therefore, even though large blocks achieve lower sparsity, they result in lower memory and compute requirements.
113
+
114
+ Table 4: Results for GRU model with 2560 layer size and bidirectional RNN model with 170 layer size pruned with different block sizes using BP.
115
+
116
+ <table><tr><td>MODEL</td><td>BLOCK SIZE</td><td>#PARAMS (in millions)</td><td>SPARSITY</td><td>CER (% LOSS)</td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>RNN Block-Sparse</td><td>4x4</td><td>7.3</td><td>89.2%</td><td>17.93 (-17%)</td></tr><tr><td>RNN Block-Sparse</td><td>12x2</td><td>10.8</td><td>84.1%</td><td>16.96 (-10%)</td></tr><tr><td>RNN Block-Sparse</td><td>8x8</td><td>10.7</td><td>84.1%</td><td>17.66 (-15%)</td></tr><tr><td>RNN Block-Sparse</td><td>16x16</td><td>11.1</td><td>83.6%</td><td>17.10 (-11%)</td></tr><tr><td>RNN Block-Sparse</td><td>32x32</td><td>14.1</td><td>79.1%</td><td>16.67 (-8.5%)</td></tr><tr><td>GRU Block-Sparse</td><td>4x4</td><td>16.2</td><td>86.0%</td><td>16.97 (-10%)</td></tr><tr><td>GRU Block-Sparse</td><td>16x16</td><td>20.8</td><td>81.9%</td><td>16.84 (-9.2%)</td></tr></table>
117
+
118
+ Table 5: Word language modelling results on Penn Tree Bank using BP for $4 \times 4$ blocks.
119
+
120
+ <table><tr><td>MODEL</td><td>LAYER SIZE</td><td># PARAMS (in millions)</td><td>PERPLEXITY (% LOSS)</td><td>EPOCHS</td><td>PRUNING ALGORITHM</td></tr><tr><td>LSTM Dense</td><td>1500</td><td>66.0</td><td>78.29 (0.0%)</td><td>55</td><td>N/A</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>LSTM Block-Sparse LSTM Block-Sparse</td><td>1500 1500</td><td>23.1 11.6</td><td>77.04 (1.6%) 80.25 (-2.5%)</td><td>55 55</td><td>Ours (BP) Ours (BP)</td></tr><tr><td>LSTM Block-Sparse</td><td>1500</td><td>7.95</td><td>82.72 (-5.7%)</td><td>55</td><td>Ours (BP)</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
121
+
122
+ The exact choice of block size for a given application depends on the underlying hardware used for inference. For example, NVIDIA’s Volta processor supports $1 6 \times 1 6$ blocks whereas ARM processors support blocks of $1 2 \mathbf { x } 2$ . We demonstrate that our approach is agnostic to block size and can be used to generate block-sparse models for arbitrary blocks.
123
+
124
+ # 4.2 NEURAL LANGUAGE MODELLING
125
+
126
+ We conducted block pruning experiments on Penn Tree Bank (PTB) (Marcus et al., 1993) dataset using word level language models. For our experiments, we use the large LSTM model with 1500 hidden units from Zaremba et al. (2014). The hyperparameters are unchanged from the original model, except for slightly increased dropout keep probability which ranges from 0.4 to 0.52 for the sparse models. We prune weights in the embedding, LSTM and softmax layers of the model.
127
+
128
+ We report results on the test set using BP with $4 \times 4$ blocks in Table 5. Block pruning can reduce the parameter count by nearly $3 \times$ while retaining the accuracy of the dense model. With a $5 \%$ loss in accuracy, we can reduce the parameter count by $8 . 3 \times$ . There is a trade-off between sparsity and accuracy of the model. For inference, we would pick the model that meets the desired memory and compute budget. Further work remains in evaluating this technique for large scale datasets like the Billion word datasets (Chelba et al., 2013) for language modelling.
129
+
130
+ # 5 PERFORMANCE
131
+
132
+ Sparse formats incur at least three types of overhead: i) indexing overhead, ii) irregular memory accesses, and ii) incompatibility with array-data-paths, all of which are mitigated by using larger block sizes.
133
+
134
+ Indexing Overheads. Sparse formats use extra memory to track the location of each non-zero value. For example, the compressed-sparse-row (CSR) format uses between one and two extra index values for each non-zero value. Assuming that neural network weights and indices are represented with 16-bits as in Micikevicius et al. (2017), this is at least $1 0 0 \%$ overhead. Block sparsity reduces this overhead by a factor of the block size because the index is shared over the entire block. For example, using a block size of 4x4 reduces the memory bloat to $6 . 2 5 \%$ , and using a block size of 16x16 reduces it to less than $1 \%$ .
135
+
136
+ Irregular Memory Accesses. Caches lines, DRAM row buffers, and TLBs provide the best performance when memory is accessed in relatively large contiguous units (e.g. 64 bytes for cache lines, 4KB for a DRAM row) as opposed to in fine-grained random accesses. Block-sparse formats store blocks contiguously in memory, resulting in large coalesced accesses.
137
+
138
+ Array Data-Paths. Block-sparse models make it easier to exploit array-data-paths in modern processors. There are significant advantages of using these units, for example, on the Volta V100 GPU, they enable up to ${ 8 } \mathbf { { x } }$ higher throughput than the SIMD data-paths. In order to keep these units busy, the block size should be at least as large as the hardware data-path size ( $1 6 \times 1 6$ or larger on V100).
139
+
140
+ # 5.1 INFERENCE PERFORMANCE
141
+
142
+ Inference performance depends of three different factors: accuracy, latency of evaluation and memory requirements. In order to understand the trade-off between unstructured sparsity and block sparsity, we benchmark the General Matrix Multiply (GEMM) speed-up and memory reduction for a single layer in the speech recongition RNN model. We evaluate GEMM speed-up with batch size of 16 using NVIDIA’s CuSparse and CuBLAS libraries on a TitanX Maxwell GPU. Sparse matrices are represented in CSR or Block-CSR format depending on the sparsity structure. Memory savings are calculated using CSR and Block Sparse Row (BSR) from Scipy module in Python. We evaluate a single layer with different block sizes. We also evaluate the best unstructured sparsity result obtained using iterative pruning from Han et al. (2015).
143
+
144
+ As shown in Table 6, the unstructured sparsity model (Han et al., 2015) achieves the best accuracy but requires much longer training time and does not improve the compute time relative to the dense model. For a small loss in accuracy, block-sparse models can significantly reduce both compute and memory requirements. For example, layers with 16x16 block sparsity reduce memory consumption by $1 1 \times$ and speedup compute by $3 \times$ with a $10 \%$ loss in accuracy. Additionally, Figure 2 shows that block-sparse matrices achieve higher speed-up than unstructured sparsity for large batch sizes for RNN and GRU layers. The speed-up is achieved due to reducing irregular memory accesses and improving load balance. Future work involves efficient implementation of block-sparse kernels to take advantage of array-data-paths in modern processors.
145
+
146
+ Table 6: Accuracy, speed-up and memory reduction for sparse layers. Block-sparse layers achieve higher speedup and memory reduction with some loss in accuracy.
147
+
148
+ <table><tr><td>MODEL</td><td>LAYER SIZE</td><td>GEMM SPEEDUP</td><td>MEMORY SAVINGS</td><td>CER (% LOSS)</td><td>ALGORITHM</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>RNN Sparse</td><td>1760</td><td>1.0×</td><td>5.0×</td><td>15.41 (-0.3%)</td><td>Han et al. (2015)</td></tr><tr><td>RNN Block-Sparse</td><td>2560</td><td>1.1×</td><td>6.2×</td><td>15.89 (-3.4%)</td><td>BP (4x4)</td></tr><tr><td>RNN Block-Sparse</td><td>1760</td><td>1.5×</td><td>7.1×</td><td>16.67 (-8.5%)</td><td>BP (32x32)</td></tr><tr><td>RNN Block-Sparse</td><td>1760</td><td>3.0×</td><td>11×</td><td>17.10 (-11%)</td><td>BP (16x16)</td></tr><tr><td>RNN Block-Sparse</td><td>1760</td><td>1.9×</td><td>17×</td><td>17.93 (-17%)</td><td>BP (4x4)</td></tr></table>
149
+
150
+ # 6 IMPACT OF SPARSITY ON ACCURACY
151
+
152
+ Using our baseline RNN model, we run many Weight Pruning (WP) (using (Narang et al., 2017)) and block pruning experiments, varying hyper-parameters to produce a spectrum of results ranging from $70 \%$ to $9 7 \%$ sparsity. For these experiments, the models are trained for 20 epochs and the accuracy is reported on the validation set. As shown in Figure 3, models pruned using WP with sparsity less than $9 5 \%$ have relative accuracy ranging from $- 2 0 \%$ to $- 2 7 \%$ . Increasing the sparsity for the model beyond $9 5 \%$ results in $30 \%$ or more accuracy loss. This “accuracy cliff” is earlier for models pruned with block sparsity. For block size $4 \times 4$ , models with sparsity greater $90 \%$ yield a relative accuracy loss of $30 \%$ or higher. Similarly, for blocks of $1 6 \times 1 6$ , models with sparsity greater than $86 \%$ have $30 \%$ or more accuracy loss. A similar trend is observed for block size $3 2 \times 3 2$ . This indicates that there is a trade-off between sparsity and block-size for a given accuracy. Larger blocks reach the “accuracy cliff” sooner.
153
+
154
+ ![](images/77a2c488c33a18b5241dc112abc22b35692143a9c4e257b6ad57b3b19de142c9.jpg)
155
+
156
+ ![](images/2fb7fe20bdf392368dff38691958bb0bfa2b419980f1fe202dcd8c0bacb3fdb6.jpg)
157
+ Figure 2: Speed-up for sparse matrix multiply over GEMM. RNN matrix sizes are (1760,1760) with $90 \%$ sparsity and (1760, batch size). GRU matrix sizes are (7680,2560) with $9 5 \%$ sparsity and (2560, batch size). Block-sparse matrices achieve consistently good speedup across batch-sizes
158
+ Figure 3: Relative accuracy for different block sizes (4x4, 16x16) and WP for varying sparsity on the RNN 1760 model. Any models with relative accuracy worse than $- 7 5 \%$ are capped at $7 5 \%$ .
159
+
160
+ # 7 CONCLUSION AND FUTURE WORK
161
+
162
+ We have demonstrated that using block pruning and group lasso combined with pruning during training can build block-sparse RNNs that are about as accurate as the dense baseline models. The block-sparse models have significantly fewer parameters than the dense baselines reducing memory requirements. Block-sparse models can take advantage of the underlying hardware efficiently.
163
+
164
+ We would like to investigate if pruning can be performed even earlier in the training, thereby allowing us to train sparse models. Training sparse models would allow us to reap the benefits of sparsity during training resulting in lesser compute and memory demands. Further work remains to implement efficient block-sparse matrix multiplies for array-data-paths in modern processors that would provide increased speed-up during deployment.
165
+
166
+ # REFERENCES
167
+
168
+ Dario Amodei, Rishita Anubhai, Eric Battenberg, Carl Case, Jared Casper, Bryan Catanzaro, JingDong Chen, Mike Chrzanowski, Adam Coates, Greg Diamos, et al. Deep speech 2: End-to-end speech recognition in english and mandarin. In Proceedings of The 33rd International Conference on Machine Learning, pp. 173–182, 2016.
169
+
170
+ Ciprian Chelba, Tomas Mikolov, Mike Schuster, Qi Ge, Thorsten Brants, Phillipp Koehn, and Tony Robinson. One billion word benchmark for measuring progress in statistical language modeling. Technical report, Google, 2013. URL http://arxiv.org/abs/1312.3005.
171
+
172
+ Kyunghyun Cho, Bart Van Merrienboer, Caglar Gulcehre, Dzmitry Bahdanau, Fethi Bougares, Holger ¨ Schwenk, and Yoshua Bengio. Learning phrase representations using rnn encoder-decoder for statistical machine translation. arXiv preprint arXiv:1406.1078, 2014.
173
+
174
+ Misha Denil, Babak Shakibi, Laurent Dinh, Marc’Aurelio Ranzato, and Nando de Freitas. Predicting parameters in deep learning. CoRR, abs/1306.0543, 2013. URL http://arxiv.org/abs/1306.0543.
175
+
176
+ Emily Denton, Wojciech Zaremba, Joan Bruna, Yann LeCun, and Rob Fergus. Exploiting linear structure within convolutional networks for efficient evaluation. CoRR, abs/1404.0736, 2014. URL http://arxiv.org/ abs/1404.0736.
177
+
178
+ Qinwei Fan, Wei Wu, and Jacek M Zurada. Convergence of batch gradient learning with smoothing regularization and adaptive momentum for neural networks. SpringerPlus, 5(1):295, 2016.
179
+
180
+ Julian Faraone, Nicholas Fraser, Giulio Gamberdella, Michaela Blott, and Philip HW Leong. Compressing low precision deep neural networks using sparsity-induced regularization in ternary networks. arXiv preprint arXiv:1709.06262, 2017.
181
+
182
+ Alex Graves, Santiago Fernandez, Faustino Gomez, and J ´ urgen Schmidhuber. Connectionist temporal classi-¨ fication: labelling unsegmented sequence data with recurrent neural networks. In Proceedings of the $2 3 r d$ international conference on Machine learning, pp. 369–376. ACM, 2006.
183
+
184
+ Suyog Gupta, Ankur Agrawal, Kailash Gopalakrishnan, and Pritish Narayanan. Deep learning with limited numerical precision. In Proceedings of the 32nd International Conference on Machine Learning (ICML15), pp. 1737–1746, 2015.
185
+
186
+ Song Han, Huizi Mao, and William J Dally. Deep compression: Compressing deep neural networks with pruning, trained quantization and huffman coding. arXiv preprint arXiv:1510.00149, 2015.
187
+
188
+ Stephen Jose Hanson and Lorien Pratt. Advances in neural information processing systems 1. chapter Com-´ paring Biases for Minimal Network Construction with Back-propagation, pp. 177–185. Morgan Kaufmann Publishers Inc., San Francisco, CA, USA, 1989. ISBN 1-558-60015-9. URL http://dl.acm.org/ citation.cfm?id $=$ 89851.89872.
189
+
190
+ Babak Hassibi, David G Stork, and Gregory J Wolff. Optimal brain surgeon and general network pruning. In Neural Networks, 1993., IEEE International Conference on, pp. 293–299. IEEE, 1993.
191
+
192
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural Comput., 9(8):1735–1780, November 1997. ISSN 0899-7667. doi: 10.1162/neco.1997.9.8.1735. URL http://dx.doi.org/ 10.1162/neco.1997.9.8.1735.
193
+
194
+ Norman P. Jouppi, Cliff Young, Nishant Patil, David Patterson, Gaurav Agrawal, Raminder Bajwa, Sarah Bates, Suresh Bhatia, Nan Boden, Al Borchers, Rick Boyle, Pierre-luc Cantin, Clifford Chao, Chris Clark, Jeremy Coriell, Mike Daley, Matt Dau, Jeffrey Dean, Ben Gelb, Tara Vazir Ghaemmaghami, Rajendra Gottipati, William Gulland, Robert Hagmann, Richard C. Ho, Doug Hogberg, John Hu, Robert Hundt, Dan Hurt, Julian Ibarz, Aaron Jaffey, Alek Jaworski, Alexander Kaplan, Harshit Khaitan, Andy Koch, Naveen Kumar, Steve Lacy, James Laudon, James Law, Diemthu Le, Chris Leary, Zhuyuan Liu, Kyle Lucke, Alan Lundin, Gordon MacKean, Adriana Maggiore, Maire Mahony, Kieran Miller, Rahul Nagarajan, Ravi Narayanaswami, Ray Ni, Kathy Nix, Thomas Norrie, Mark Omernick, Narayana Penukonda, Andy Phelps, Jonathan Ross, Amir Salek, Emad Samadiani, Chris Severn, Gregory Sizikov, Matthew Snelham, Jed Souter, Dan Steinberg, Andy Swing, Mercedes Tan, Gregory Thorson, Bo Tian, Horia Toma, Erick Tuttle, Vijay Vasudevan, Richard Walter, Walter Wang, Eric Wilcox, and Doe Hyun Yoon. In-datacenter performance analysis of a tensor processing unit. CoRR, abs/1704.04760, 2017. URL http://arxiv.org/abs/1704.04760.
195
+
196
+ Rafal Jozefowicz, Oriol Vinyals, Mike Schuster, Noam Shazeer, and Yonghui Wu. Exploring the limits of ´ language modeling. CoRR, abs/1602.02410, 2016. URL http://arxiv.org/abs/1602.02410.
197
+
198
+ Seyoung Kim and Eric P Xing. Tree-guided group lasso for multi-task regression with structured sparsity. 2010.
199
+
200
+ Yann LeCun, John S Denker, Sara A Solla, Richard E Howard, and Lawrence D Jackel. Optimal brain damage. In NIPs, volume 2, pp. 598–605, 1989.
201
+
202
+ Baoyuan Liu, Min Wang, Hassan Foroosh, Marshall Tappen, and Marianna Pensky. Sparse convolutional neural networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 806–814, 2015.
203
+
204
+ Huizi Mao, Song Han, Jeff Pool, Wenshuo Li, Xingyu Liu, Yu Wang, and William Dally. Exploring the regularity of sparse structure in convolutional neural networks. 05 2017.
205
+
206
+ Mitchell P Marcus, Mary Ann Marcinkiewicz, and Beatrice Santorini. Building a large annotated corpus of english: The penn treebank. Computational linguistics, 19(2):313–330, 1993.
207
+
208
+ P. Micikevicius, S. Narang, J. Alben, G. Diamos, E. Elsen, D. Garcia, B. Ginsburg, M. Houston, O. Kuchaiev, G. Venkatesh, and H. Wu. Mixed Precision Training. ArXiv e-prints, October 2017.
209
+
210
+ Sharan Narang and Gregory Diamos. Deepbench. https://svail.github.io/ DeepBench-update/, 2017. Accessed: 2017-06-28.
211
+
212
+ Sharan Narang, Gregory Diamos, Shubho Sengupta, and Erich Elsen. Exploring sparsity in recurrent neural networks. arXiv preprint arXiv:1704.05119, 2017.
213
+
214
+ NVIDIA. NVIDIA Tesla V100 GPU Architecture. Technical report, 2017.
215
+
216
+ Mohammad Rastegari, Vicente Ordonez, Joseph Redmon, and Ali Farhadi. XNOR-Net: ImageNet Classification Using Binary Convolutional Neural Networks, pp. 525–542. Springer International Publishing, Cham, 2016. ISBN 978-3-319-46493-0. doi: 10.1007/978-3-319-46493-0 32. URL https: //doi.org/10.1007/978-3-319-46493-0_32.
217
+
218
+ Simone Scardapane, Danilo Comminiello, Amir Hussain, and Aurelio Uncini. Group sparse regularization for deep neural networks. Neurocomputing, 241:81–89, 2017.
219
+
220
+ Vincent Vanhoucke, Andrew Senior, and Mark Z. Mao. Improving the speed of neural networks on cpus. In Deep Learning and Unsupervised Feature Learning Workshop, NIPS 2011, 2011.
221
+
222
+ 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.
223
+
224
+ Wei Wen, Yuxiong He, Samyam Rajbhandari, Wenhan Wang, Fang Liu, Bin Hu, Yiran Chen, and Hai Li. Learning intrinsic sparse structures within long short-term memory. arXiv preprint arXiv:1709.05027, 2017.
225
+
226
+ Yonghui Wu, Mike Schuster, Zhifeng Chen, Quoc V. Le, Mohammad Norouzi, Wolfgang Macherey, Maxim Krikun, Yuan Cao, Qin Gao, Klaus Macherey, Jeff Klingner, Apurva Shah, Melvin Johnson, Xiaobing Liu, Lukasz Kaiser, Stephan Gouws, Yoshikiyo Kato, Taku Kudo, Hideto Kazawa, Keith Stevens, George Kurian, Nishant Patil, Wei Wang, Cliff Young, Jason Smith, Jason Riesa, Alex Rudnick, Oriol Vinyals, Greg Corrado, Macduff Hughes, and Jeffrey Dean. Google’s neural machine translation system: Bridging the gap between human and machine translation. CoRR, abs/1609.08144, 2016. URL http://arxiv.org/abs/1609. 08144.
227
+
228
+ Dong Yu, Frank Seide, Gang Li, and Li Deng. Exploiting sparseness in deep neural networks for large vocabulary speech recognition. In 2012 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 4409–4412. IEEE, 2012.
229
+
230
+ Jiecao Yu, Andrew Lukefahr, David Palframan, Ganesh Dasika, Reetuparna Das, and Scott Mahlke. Scalpel: Customizing dnn pruning to the underlying hardware parallelism. In Proceedings of the 44th Annual International Symposium on Computer Architecture, pp. 548–560. ACM, 2017.
231
+
232
+ Ming Yuan and Yi Lin. Model selection and estimation in regression with grouped variables. 2006a.
233
+
234
+ Ming Yuan and Yi Lin. Model selection and estimation in regression with grouped variables. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 68(1):49–67, 2006b.
235
+
236
+ Wojciech Zaremba, Ilya Sutskever, and Oriol Vinyals. Recurrent neural network regularization. CoRR, abs/1409.2329, 2014. URL http://arxiv.org/abs/1409.2329.
237
+
238
+ Michael Zhu and Suyog Gupta. To prune, or not to prune: exploring the efficacy of pruning for model compression. arXiv preprint arXiv:1710.01878, 2017.
239
+
240
+ # A $\ell _ { 1 }$ AND $\ell _ { 1 / 2 }$ REGULARIZATION
241
+
242
+ Prior to our work with group lasso regularization, we considered $\ell _ { 1 }$ and $\ell _ { 1 / 2 }$ regularizers to induce sparsity in the network. These regularizers act on individual weights and could aid in inducing unstructured sparsity in the network. $\ell _ { 1 }$ regularization is defined as:
243
+
244
+ $$
245
+ L = L _ { \mathrm { t r a i n i n g } } + \lambda \sum _ { i = 1 } ^ { k } \left| w _ { i } \right|
246
+ $$
247
+
248
+ where $| w _ { i } |$ is the absolute value of a weight and $k$ is the total number of weights. Note the gradient expression for each weight $w _ { j }$ :
249
+
250
+ $$
251
+ { \frac { \partial } { \partial w _ { j } } } \sum _ { i = 1 } ^ { k } | w _ { i } | = s g n ( w _ { j } )
252
+ $$
253
+
254
+ As with the group lasso experiments described in 3.2, we explore $\ell _ { 1 }$ regularization with and without pruning. The weight pruning (WP) algorithm from Narang et al. (2017) is used along with regularization. The motivation is the same as group lasso block sparsity experiments: either to guide pruning or to produce sparsity directly.
255
+
256
+ We also explore $\ell _ { 1 / 2 }$ regularization which is defined as:
257
+
258
+ $$
259
+ L = L _ { \mathrm { t r a i n i n g } } + \lambda \sum _ { i = 1 } ^ { k } | w _ { i } | ^ { 1 / 2 }
260
+ $$
261
+
262
+ Fan et al. (2016) uses $\ell _ { 1 / 2 }$ regularization to produce sparsity directly. The gradient for $\ell _ { 1 / 2 }$ regularization is $\scriptstyle { \frac { 1 } { 2 } } \left| w _ { j } \right| ^ { - 1 / 2 }$ . This term is smaller for weights with larger magnitude. Our expectation is that $\ell _ { 1 / 2 }$ will drive unimportant weights towards zero while leaving large weights relatively unaffected, thus avoiding the accuracy loss associated with excessive regularization.
263
+
264
+ For our $\ell _ { 1 }$ and $\ell _ { 1 / 2 }$ experiments, we use the Deep Speech 2 Bidirectional RNN baseline model described in Section 4. These models are trained for 25 epochs on our internal training dataset of 2000 hours. The results are reported on a independent test set consisting of 2.9 hours.
265
+
266
+ Table 7: $\ell _ { 1 }$ and $\ell _ { 1 / 2 }$ results with the bidirectional RNN model with 1760 hidden units
267
+
268
+ <table><tr><td>MODEL</td><td>#PARAMS (in millions)</td><td>SPARSITY</td><td>CER</td><td>RELATIVE PERF</td><td>PRUNING ALGORITHM</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>RNN Dense</td><td>67</td><td>0.0%</td><td>15.36</td><td>0.0%</td><td>N/A</td></tr><tr><td>RNN Sparse</td><td>7.3</td><td>89.2%</td><td>17.32</td><td>-12.8%</td><td>Weight pruning</td></tr><tr><td>RNN Sparse</td><td>11.2</td><td>83.6%</td><td>24.8</td><td>-61.5%</td><td>l1</td></tr><tr><td>RNN Sparse</td><td>7.4</td><td>89.1%</td><td>17.28</td><td>-12.5%</td><td>l1 with pruning</td></tr><tr><td>RNN Sparse</td><td>6.6</td><td>90.3%</td><td>18.50</td><td>-20.4%</td><td>l1/2 with pruning</td></tr></table>
269
+
270
+ Without pruning, $\ell _ { 1 }$ model results in significantly worse accuracy compared to the dense baseline. Combining $\ell _ { 1 }$ with weight pruning allows us to recover the loss in accuracy with similar sparsity. The $\ell _ { 1 / 2 }$ with pruning model performs worse than the $\ell _ { 1 }$ with pruning model. Comparing the two regularizers, this result indicates that $\ell _ { 1 }$ is better at guiding pruning than $\ell _ { 1 / 2 }$ , more suitable as a regularizer, or both.
271
+
272
+ Similar to group lasso experiments, $\ell _ { 1 }$ regularization experiments require a significantly higher $\lambda$ to achieve high sparsity without any pruning. We suspect that these regularizers would be more successful in inducing sparsity for models that overfit the training training dataset.
273
+
274
+ # B PRUNING CHARACTERISTICS
275
+
276
+ In this section, we discuss some pruning characteristics and how they relate to training and accuracy of the models.
277
+
278
+ # B.1 PRUNING SCHEDULE
279
+
280
+ In Figure 4a, we plot the pruning schedule of a recurrent and linear layer of the bidirectional model trained with Block Pruning (BP) and Weight Pruning (WP) (Narang et al., 2017) and Group lasso with block pruning (GLP). For all three algorithms, pruning begins just after the first epoch at 2700 iterations. The BP and GLP models result in a sharper curve with more weights being set to zero in a short span of iterations. In these experiments, we use the max function to reduce the blocks to a single value which could be the cause of the sharpness in pruning. Also the GLP model reaches $90 \%$ sparsity just before 10,000 iterations which is significantly earlier than the BP model. GLP training encourages sparsity early on in the training run by pushing the blocks of weights towards zero.
281
+
282
+ # B.2 OUTPUT CONNECTIONS
283
+
284
+ Figure 4b shows the histogram of the number of output connections for all the neurons in a network for two models with different sparsity pruned with BP. The $94 \%$ sparse model does significantly worse than the $89 \%$ sparse. For the model with $89 \%$ sparsity, only 180 neurons have all their output weights set to zero out of a total of 38270. This model produced good accuracy relative to the dense baseline. However, increasing the sparsity to $94 \%$ for the layer results in 1620 neurons having all zero output weights. Additionally, a lot more neurons have a smaller number of non-zero output weights.
285
+
286
+ ![](images/cf8909cb8007d8c56d86178dbf5138a82bbc5a635c84dcf15624555460165d5b.jpg)
287
+ Figure 4: Figure 4a shows the pruning schedule for two layers in the network for WP, GLP and BP models. The GLP and BP models use block size of $4 \mathbf { x } 4$ . Figure 4b plots the histogram of the number of output connections for all neurons in the network using block pruning with $4 \times 4$ blocks.
288
+
289
+ # B.3 SPARSITY VS LAYERS
290
+
291
+ Figure 5 shows the sparsity of all the recurrent layers in the network using BP and WP. All recurrent layers have the same pruning hyper-parameters. Layer 1 is the first recurrent layer and layer 14 is the final recurrent layer before the CTC cost layer. For both block pruning and weight pruning, we see that the initial layers are pruned more aggressively compared to the final layers. Increasing sparsity in the layers closer to the output results in poor accuracy. Additionally, the variance in sparsity across the layers increases with the block size. This increasing variance makes it harder to increase the block size beyond $3 2 \times 3 2$ with the same pruning hyper-parameters for all recurrent layers.
292
+
293
+ ![](images/e29ca40fca4c38e0eac458b2a8d3b7dfbe2215d5a98cc4e29b9ba5ef4b5aaa2f.jpg)
294
+ Figure 5: Sparsity of different recurrent layers in the network in the RNN model, pruned using BP and WP.
md/train/HJcSzz-CZ/HJcSzz-CZ.md ADDED
@@ -0,0 +1,319 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # META-LEARNING FOR SEMI-SUPERVISED FEW-SHOTCLASSIFICATION
2
+
3
+ Mengye $\mathbf { R e n } ^ { \dagger \ltimes }$ , Eleni Triantafillou∗ †on, Sachin Ravi∗ §, Jake Snell†on, Kevin Swersky¶, Joshua B. Tenenbaum\, Hugo Larochelle¶‡ & Richard S. Zemel†‡on
4
+
5
+ †University of Toronto, §Princeton University, ¶Google Brain, \MIT, ‡CIFAR, onVector Institute {mren,eleni}@cs.toronto.edu, sachinr@cs.princeton.edu, jsnell@cs.toronto.edu, kswersky@google.com, jbt@mit.edu, hugolarochelle@google.com, zemel@cs.toronto.edu
6
+
7
+ # ABSTRACT
8
+
9
+ In few-shot classification, we are interested in learning algorithms that train a classifier from only a handful of labeled examples. Recent progress in few-shot classification has featured meta-learning, in which a parameterized model for a learning algorithm is defined and trained on episodes representing different classification problems, each with a small labeled training set and its corresponding test set. In this work, we advance this few-shot classification paradigm towards a scenario where unlabeled examples are also available within each episode. We consider two situations: one where all unlabeled examples are assumed to belong to the same set of classes as the labeled examples of the episode, as well as the more challenging situation where examples from other distractor classes are also provided. To address this paradigm, we propose novel extensions of Prototypical Networks (Snell et al., 2017) that are augmented with the ability to use unlabeled examples when producing prototypes. These models are trained in an end-to-end way on episodes, to learn to leverage the unlabeled examples successfully. We evaluate these methods on versions of the Omniglot and miniImageNet benchmarks, adapted to this new framework augmented with unlabeled examples. We also propose a new split of ImageNet, consisting of a large set of classes, with a hierarchical structure. Our experiments confirm that our Prototypical Networks can learn to improve their predictions due to unlabeled examples, much like a semi-supervised algorithm would.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ The availability of large quantities of labeled data has enabled deep learning methods to achieve impressive breakthroughs in several tasks related to artificial intelligence, such as speech recognition, object recognition and machine translation. However, current deep learning approaches struggle in tackling problems for which labeled data are scarce. Specifically, while current methods excel at tackling a single problem with lots of labeled data, methods that can simultaneously solve a large variety of problems that each have only a few labels are lacking. Humans on the other hand are readily able to rapidly learn new classes, such as new types of fruit when we visit a tropical country. This significant gap between human and machine learning provides fertile ground for deep learning developments.
14
+
15
+ For this reason, recently there has been an increasing body of work on few-shot learning, which considers the design of learning algorithms that specifically allow for better generalization on problems with small labeled training sets. Here we focus on the case of few-shot classification, where the given classification problem is assumed to contain only a handful of labeled examples per class. One approach to few-shot learning follows a form of meta-learning 1 (Thrun, 1998; Hochreiter et al., 2001), which performs transfer learning from a pool of various classification problems generated from large quantities of available labeled data, to new classification problems from classes unseen at training time. Meta-learning may take the form of learning a shared metric (Vinyals et al., 2016; Snell et al., 2017), a common initialization for few-shot classifiers (Ravi & Larochelle, 2017; Finn et al., 2017) or a generic inference network (Santoro et al., 2016; Mishra et al., 2017).
16
+
17
+ These various meta-learning formulations have led to significant progress recently in few-shot classification. However, this progress has been limited in the setup of each few-shot learning episode, which differs from how humans learn new concepts in many dimensions. In this paper we aim to generalize the setup in two ways. First, we consider a scenario where the new classes are learned in the presence of additional unlabeled data. While there have been many successful applications of semisupervised learning to the regular setting of a single classification task (Chapelle et al., 2010) where classes at training and test time are the same, such work has not addressed the challenge of performing transfer to new classes never seen at training time, which we consider here. Second, we consider the situation where the new classes to be learned are not viewed in isolation. Instead, many of the unlabeled examples are from different classes; the presence of such distractor classes introduces an additional and more realistic level of difficulty to the fewshot problem.
18
+
19
+ ![](images/712ced75c31849892a977ed5de7faabcb52f69269afed899f0f80eac77b18e73.jpg)
20
+ Figure 1: Consider a setup where the aim is to learn a classifier to distinguish between two previously unseen classes, goldfish and shark, given not only labeled examples of these two classes, but also a larger pool of unlabeled examples, some of which may belong to one of these two classes of interest. In this work we aim to move a step closer to this more natural learning framework by incorporating in our learning episodes unlabeled data from the classes we aim to learn representations for (shown with dashed red borders) as well as from distractor classes .
21
+
22
+ This work is a first study of this challenging semi-supervised form of few-shot learning. First, we define the problem and propose benchmarks for evaluation that are adapted from the Omniglot and miniImageNet benchmarks used in ordinary few-shot learning. We perform an extensive empirical investigation of the two settings mentioned above, with and without distractor classes. Second, we propose and study three novel extensions of Prototypical Networks (Snell et al., 2017), a state-ofthe-art approach to few-shot learning, to the semi-supervised setting. Finally, we demonstrate in our experiments that our semi-supervised variants successfully learn to leverage unlabeled examples and outperform purely supervised Prototypical Networks.
23
+
24
+ # 2 BACKGROUND
25
+
26
+ We start by defining precisely the current paradigm for few-shot learning and the Prototypical Network approach to this problem.
27
+
28
+ # 2.1 FEW-SHOT LEARNING
29
+
30
+ Recent progress on few-shot learning has been made possible by following an episodic paradigm. Consider a situation where we have a large labeled dataset for a set of classes $\mathcal { C } _ { \mathrm { t r a i n } }$ . However, after training on examples from $\mathcal { C } _ { \mathrm { t r a i n } }$ , our ultimate goal is to produce classifiers for a disjoint set of new classes $\mathcal { C } _ { \mathrm { t e s t } }$ , for which only a few labeled examples will be available. The idea behind the episodic paradigm is to simulate the types of few-shot problems that will be encountered at test, taking advantage of the large quantities of available labeled data for classes $\mathcal { C } _ { \mathrm { t r a i n } }$ .
31
+
32
+ Specifically, models are trained on $K$ -shot, $N$ -way episodes constructed by first sampling a small subset of $N$ classes from $\mathcal { C } _ { \mathrm { t r a i n } }$ and then generating: 1) a training (support) set ${ \boldsymbol { s } } \ =$ $\left\{ ( \pmb { x } _ { 1 } , y _ { 1 } ) , ( \pmb { x } _ { 2 } , y _ { 2 } ) , \dots , ( \pmb { x } _ { N \times K } , y _ { N \times K } ) \right\}$ containing $K$ examples from each of the $N$ classes and 2) a test (query) set $\mathcal { Q } = \{ ( \pmb { x } _ { 1 } ^ { * } , y _ { 1 } ^ { * } ) , ( \pmb { x } _ { 2 } ^ { * } , y _ { 2 } ^ { * } ) , . . . , ( \pmb { x } _ { T } ^ { * } , y _ { T } ^ { * } ) \}$ of different examples from the same $N$ classes. Each $\pmb { x } _ { i } \in \mathbb { R } ^ { D }$ is an input vector of dimension $D$ and $y _ { i } \in \{ 1 , 2 , \ldots , N \}$ is a class label (similarly for $\boldsymbol { \mathscr { x } } _ { i } ^ { * }$ and $y _ { i } ^ { * }$ ). Training on such episodes is done by feeding the support set $s$ to the model and updating its parameters to minimize the loss of its predictions for the examples in the query set $\mathcal { Q }$ .
33
+
34
+ One way to think of this approach is that our model effectively trains to be a good learning algorithm. Indeed, much like a learning algorithm, the model must take in a set of labeled examples and produce a predictor that can be applied to new examples. Moreover, training directly encourages the classifier produced by the model to have good generalization on the new examples of the query set. Due to this analogy, training under this paradigm is often referred to as learning to learn or meta-learning.
35
+
36
+ On the other hand, referring to the content of episodes as training and test sets and to the process of learning on these episodes as meta-learning or meta-training (as is sometimes done in the literature) can be confusing. So for the sake of clarity, we will refer to the content of episodes as support and query sets, and to the process of iterating over the training episodes simply as training.
37
+
38
+ # 2.2 PROTOTYPICAL NETWORKS
39
+
40
+ Prototypical Network (Snell et al., 2017) is a few-shot learning model that has the virtue of being simple and yet obtaining state-of-the-art performance. At a high-level, it uses the support set $s$ to extract a prototype vector from each class, and classifies the inputs in the query set based on their distance to the prototype of each class.
41
+
42
+ More precisely, Prototypical Networks learn an embedding function $h ( { \pmb x } )$ , parameterized as a neural network, that maps examples into a space where examples from the same class are close and those from different classes are far. All parameters of Prototypical Networks lie in the embedding function.
43
+
44
+ To compute the prototype $\pmb { p } _ { c }$ of each class $c$ , a per-class average of the embedded examples is performed:
45
+
46
+ $$
47
+ p _ { c } = \frac { \sum _ { i } h ( \pmb { x } _ { i } ) z _ { i , c } } { \sum _ { i } z _ { i , c } } , \mathrm { w h e r e } z _ { i , c } = \mathbb { 1 } [ y _ { i } = c ] .
48
+ $$
49
+
50
+ These prototypes define a predictor for the class of any new (query) example $\mathbf { \boldsymbol { x } } ^ { * }$ , which assigns a probability over any class $c$ based on the distances between $\pmb { x } ^ { * }$ and each prototype, as follows:
51
+
52
+ $$
53
+ p ( c | \pmb { x } ^ { * } , \{ p _ { c } \} ) = \frac { \exp ( - | | h ( \pmb { x } ^ { * } ) - \pmb { p } _ { c } | | _ { 2 } ^ { 2 } ) } { \sum _ { c ^ { \prime } } \exp ( - | | h ( \pmb { x } ^ { * } ) - \pmb { p } _ { c ^ { \prime } } | | _ { 2 } ^ { 2 } ) } .
54
+ $$
55
+
56
+ The loss function used to update Prototypical Networks for a given training episode is then simply the average negative log-probability of the correct class assignments, for all query examples:
57
+
58
+ $$
59
+ - \frac { 1 } { T } \sum _ { i } \log p ( y _ { i } ^ { * } | \pmb { x } _ { i } ^ { * } , \{ \pmb { p } _ { c } \} ) .
60
+ $$
61
+
62
+ Training proceeds by minimizing the average loss, iterating over training episodes and performing a gradient descent update for each.
63
+
64
+ Generalization performance is measured on test set episodes, which contain images from classes in $\mathcal { C } _ { \mathrm { t e s t } }$ instead of $\mathcal { C } _ { \mathrm { t r a i n } }$ . For each test episode, we use the predictor produced by the Prototypical Network for the provided support set $s$ to classify each of query input $\pmb { x } ^ { * }$ into the most likely class $\hat { y } = \operatorname { a r g m a x } _ { c } p ( \bar { c } | \pmb { x } ^ { * } , \{ \pmb { p } _ { c } \} )$ .
65
+
66
+ # 3 SEMI-SUPERVISED FEW-SHOT LEARNING
67
+
68
+ We now define the semi-supervised setting considered in this work for few-shot learning.
69
+
70
+ The training set is denoted as a tuple of labeled and unlabeled examples: $( S , R )$ . The labeled portion is the usual support set $s$ of the few-shot learning literature, containing a list of tuples of inputs and targets. In addition to classic few-shot learning, we introduce an unlabeled set $\mathcal { R }$ containing only inputs: $\mathcal { R } = \{ \tilde { { \pmb { x } } } _ { 1 } , \tilde { { \pmb { x } } } _ { 2 } , \ldots , \tilde { { \pmb { x } } } _ { M } \}$ . As in the purely supervised setting, our models are trained to perform well when predicting the labels for the examples in the episode’s query set $\mathcal { Q }$ . Figure 2 shows a visualization of training and test episodes.
71
+
72
+ ![](images/5436151688cbedebe02d2802538405afd5470e7719eccd33d5f925b943abe901.jpg)
73
+ Figure 2: Example of the semi-supervised few-shot learning setup. Training involves iterating through training episodes, consisting of a support set $s$ , an unlabeled set $\mathcal { R }$ , and a query set $\mathcal { Q }$ . The goal is to use the labeled items (shown with their numeric class label) in $s$ and the unlabeled items in $\mathcal { R }$ within each episode to generalize to good performance on the corresponding query set. The unlabeled items in $\mathcal { R }$ may either be pertinent to the classes we are considering (shown above with green plus signs) or they may be distractor items which belong to a class that is not relevant to the current episode (shown with red minus signs). However note that the model does not actually have ground truth information as to whether each unlabeled example is a distractor or not; the plus/minus signs are shown only for illustrative purposes. At test time, we are given new episodes consisting of novel classes not seen during training that we use to evaluate the meta-learning method.
74
+
75
+ # 3.1 SEMI-SUPERVISED PROTOTYPICAL NETWORKS
76
+
77
+ In their original formulation, Prototypical Networks do not specify a way to leverage the unlabeled set $\mathcal { R }$ . In what follows, we now propose various extensions that start from the basic definition of prototypes $\pmb { p _ { c } }$ and provide a procedure for producing refined prototypes $\tilde { p } _ { c }$ using the unlabeled examples in $\mathcal { R }$ .
78
+
79
+ After the refined prototypes are obtained, each of these models is trained with the same loss function for ordinary Prototypical Networks of Equation 3, but replacing ${ \pmb p } _ { c }$ with $\tilde { p } _ { c }$ . That is, each query example is classified into one of the $N$ classes based on the proximity of its embedded position with the corresponding refined prototypes, and the average negative logprobability of the correct classification is used for training.
80
+
81
+ ![](images/5e1bc913e73854521429d9147f4e5fea101390e46ff01bf72a7b6a79261c8160.jpg)
82
+ Figure 3: Left: The prototypes are initialized based on the mean location of the examples of the corresponding class, as in ordinary Prototypical Networks. Support, unlabeled, and query examples have solid, dashed, and white colored borders respectively. Right: The refined prototypes obtained by incorporating the unlabeled examples, which classifies all query examples correctly.
83
+
84
+ # 3.1.1 PROTOTYPICAL NETWORKS WITH SOFT $k$ -MEANS
85
+
86
+ We first consider a simple way of leveraging unlabeled examples for refining prototypes, by taking inspiration from semi-supervised clustering. Viewing each prototype as a cluster center, the refinement process could attempt to adjust the cluster locations to better fit the examples in both the support and unlabeled sets. Under this view, cluster assignments of the labeled examples in the support set are considered known and fixed to each example’s label. The refinement process must instead estimate the cluster assignments of the unlabeled examples and adjust the cluster locations (the prototypes) accordingly.
87
+
88
+ One natural choice would be to borrow from the inference performed by soft $k$ -means. We prefer this version of $k$ -means over hard assignments since hard assignments would make the inference non-differentiable. We start with the regular Prototypical Network’s prototypes $\pmb { p _ { c } }$ (as specified in Equation 1) as the cluster locations. Then, the unlabeled examples get a partial assignment $( \tilde { z } _ { j , c } )$ to each cluster based on their Euclidean distance to the cluster locations. Finally, refined prototypes are obtained by incorporating these unlabeled examples.
89
+
90
+ This process can be summarized as follows:
91
+
92
+ $$
93
+ \tilde { p } _ { c } = \frac { \sum _ { i } h ( { \bf x } _ { i } ) z _ { i , c } + \sum _ { j } h ( \tilde { x } _ { j } ) \tilde { z } _ { j , c } } { \sum _ { i } z _ { i , c } + \sum _ { j } \tilde { z } _ { j , c } } , \mathrm { w h e r e } z _ { j , c } = \frac { \exp \left( - | | h ( \tilde { x } _ { j } ) - p _ { c } | | _ { 2 } ^ { 2 } \right) } { \sum _ { c ^ { \prime } } \exp \left( - | | h ( \tilde { x } _ { j } ) - p _ { c ^ { \prime } } | | _ { 2 } ^ { 2 } \right) }
94
+ $$
95
+
96
+ Predictions of each query input’s class is then modeled as in Equation 2, but using the refined prototypes $\tilde { p } _ { c }$ .
97
+
98
+ We could perform several iterations of refinement, as is usual in $k$ -means. However, we have experimented with various number of iterations and found results to not improve beyond a single refinement step.
99
+
100
+ # 3.1.2 PROTOTYPICAL NETWORKS WITH SOFT $k$ -MEANS WITH A DISTRACTOR CLUSTER
101
+
102
+ The soft $k$ -means approach described above implicitly assumes that each unlabeled example belongs to either one of the $N$ classes in the episode. However, it would be much more general to not make that assumption and have a model robust to the existence of examples from other classes, which we refer to as distractor classes. For example, such a situation would arise if we wanted to distinguish between pictures of unicycles and scooters, and decided to add an unlabeled set by downloading images from the web. It then would not be realistic to assume that all these images are of unicycles or scooters. Even with a focused search, some may be from similar classes, such as bicycle.
103
+
104
+ Since soft $k$ -means distributes its soft assignments across all classes, distractor items could be harmful and interfere with the refinement process, as prototypes would be adjusted to also partially account for these distractors. A simple way to address this is to add an additional cluster whose purpose is to capture the distractors, thus preventing them from polluting the clusters of the classes of interest:
105
+
106
+ $$
107
+ \pmb { p _ { c } } = \left\{ \begin{array} { l l } { \frac { \sum _ { i } h ( \pmb { x _ { i } } ) z _ { i , c } } { \sum _ { i } z _ { i , c } } } & { \quad \mathrm { f o r } c = 1 . . . N } \\ { \mathbf { 0 } } & { \quad \mathrm { f o r } c = N + 1 } \end{array} \right.
108
+ $$
109
+
110
+ Here we take the simplifying assumption that the distractor cluster has a prototype centered at the origin. We also consider introducing length-scales $r _ { c }$ to represent variations in the within-cluster distances, specifically for the distractor cluster:
111
+
112
+ $$
113
+ \tilde { z } _ { j , c } = \frac { \exp \left( - \frac { 1 } { r _ { c } ^ { 2 } } | | \tilde { x } _ { j } - p _ { c } | | _ { 2 } ^ { 2 } - A ( r _ { c } ) \right) } { \sum _ { c ^ { \prime } } \exp \left( - \frac { 1 } { r _ { c } ^ { 2 } } | | \tilde { x } _ { j } - p _ { c ^ { \prime } } | | _ { 2 } ^ { 2 } - A ( r _ { c ^ { \prime } } ) \right) } , \mathrm { ~ w h e r e ~ } A ( r ) = \frac { 1 } { 2 } \log ( 2 \pi ) + \log ( r )
114
+ $$
115
+
116
+ For simplicity, we set $r _ { 1 \dots N }$ to 1 in our experiments, and only learn the length-scale of the distractor cluster rN+1.
117
+
118
+ # 3.1.3 PROTOTYPICAL NETWORKS WITH SOFT $k$ -MEANS AND MASKING
119
+
120
+ Modeling distractor unlabeled examples with a single cluster is likely too simplistic. Indeed, it is inconsistent with our assumption that each cluster corresponds to one class, since distractor examples may very well cover more than a single natural object category. Continuing with our unicycles and bicycles example, our web search for unlabeled images could accidentally include not only bicycles, but other related objects such as tricycles or cars. This was also reflected in our experiments, where we constructed the episode generating process so that it would sample distractor examples from multiple classes.
121
+
122
+ To address this problem, we propose an improved variant: instead of capturing distractors with a high-variance catch-all cluster, we model distractors as examples that are not within some area of any of the legitimate class prototypes. This is done by incorporating a soft-masking mechanism on the contribution of unlabeled examples. At a high level, we want unlabeled examples that are closer to a prototype to be masked less than those that are farther.
123
+
124
+ More specifically, we modify the soft $k$ -means refinement as follows. We start by computing normalized distances $\tilde { d } _ { j , c }$ between examples $\tilde { \mathbfit { x } } _ { j }$ and prototypes $\pmb { p _ { c } }$ :
125
+
126
+ $$
127
+ \tilde { d } _ { j , c } = \frac { d _ { j , c } } { \frac { 1 } { M } \sum _ { j } d _ { j , c } } , \ \mathrm { w h e r e } \ d _ { j , c } = | | h ( \tilde { \bf x } _ { j } ) - { \bf p } _ { c } | | _ { 2 } ^ { 2 }
128
+ $$
129
+
130
+ Then, soft thresholds $\beta _ { c }$ and slopes $\gamma _ { c }$ are predicted for each prototype, by feeding to a small neural network various statistics of the normalized distances for the prototype:
131
+
132
+ $$
133
+ [ \beta _ { c } , \gamma _ { c } ] = \mathrm { M L P } \left( \left[ \operatorname* { m i n } _ { j } ( \tilde { d } _ { j , c } ) , \operatorname* { m a x } _ { j } ( \tilde { d } _ { j , c } ) , \operatorname { v a r } _ { j } ( \tilde { d } _ { j , c } ) , \operatorname { s k e w } ( \tilde { d } _ { j , c } ) , \operatorname { k u r t } _ { j } ( \tilde { d } _ { j , c } ) \right] \right)
134
+ $$
135
+
136
+ This allows each threshold to use information on the amount of intra-cluster variation to determine how aggressively it should cut out unlabeled examples.
137
+
138
+ Then, soft masks $m _ { j , c }$ for the contribution of each example to each prototype are computed, by comparing to the threshold the normalized distances, as follows:
139
+
140
+ $$
141
+ \tilde { p } _ { c } = \frac { \sum _ { i } h ( { \bf x } _ { i } ) z _ { i , c } + \sum _ { j } h ( \tilde { x } _ { j } ) \tilde { z } _ { j , c } m _ { j , c } } { \sum _ { i } z _ { i , c } + \sum _ { j } \tilde { z } _ { j , c } m _ { j , c } } , \mathrm { ~ w h e r e ~ } m _ { j , c } = \sigma \left( - \gamma _ { c } \left( \tilde { d } _ { j , c } - \beta _ { c } \right) \right)
142
+ $$
143
+
144
+ where $\sigma ( \cdot )$ is the sigmoid function.
145
+
146
+ When training with this refinement process, the model can now use its MLP in Equation 8 to learn to include or ignore entirely certain unlabeled examples. The use of soft masks makes this process entirely differentiable2. Finally, much like for regular soft $k$ -means (with or without a distractor cluster), while we could recursively repeat the refinement for multiple steps, we found a single step to perform well enough.
147
+
148
+ # 4 RELATED WORK
149
+
150
+ We summarize here the most relevant work from the literature on few-shot learning, semi-supervised learning and clustering.
151
+
152
+ The best performing methods for few-shot learning use the episodic training framework prescribed by meta-learning. The approach within which our work falls is that of metric learning methods. Previous work in metric-learning for few-shot-classification includes Deep Siamese Networks (Koch et al., 2015), Matching Networks (Vinyals et al., 2016), and Prototypical Networks (Snell et al., 2017), which is the model we extend to the semi-supervised setting in our work. The general idea here is to learn an embedding function that embeds examples belonging to the same class close together while keeping embeddings from separate classes far apart. Distances between embeddings of items from the support set and query set are then used as a notion of similarity to do classification. Lastly, closely related to our work with regard to extending the few-shot learning setting, Bachman et al. (2017) employ Matching Networks in an active learning framework where the model has a choice of which unlabeled item to add to the support set over a certain number of time steps before classifying the query set. Unlike our setting, their meta-learning agent can acquire ground-truth labels from the unlabeled set, and they do not use distractor examples.
153
+
154
+ Other meta-learning approaches to few-shot learning include learning how to use the support set to update a learner model so as to generalize to the query set. Recent work has involved learning either the weight initialization and/or update step that is used by a learner neural network (Ravi & Larochelle, 2017; Finn et al., 2017). Another approach is to train a generic neural architecture such as a memory-augmented recurrent network (Santoro et al., 2016) or a temporal convolutional network (Mishra et al., 2017) to sequentially process the support set and perform accurate predictions of the labels of the query set examples. These other methods are also competitive for few-shot learning, but we chose to extend Prototypical Networks in this work for its simplicity and efficiency.
155
+
156
+ As for the literature on semi-supervised learning, while it is quite vast (Zhu, 2005; Chapelle et al., 2010), the most relevant category to our work is related to self-training (Yarowsky, 1995; Rosenberg et al., 2005). Here, a classifier is first trained on the initial training set. The classifier is then used to classify unlabeled items, and the most confidently predicted unlabeled items are added to the training set with the prediction of the classifier as the assumed label. This is similar to our soft $k$ -Means extension to Prototypical Networks. Indeed, since the soft assignments (Equation 4) match the regular Prototypical Network’s classifier output for new inputs (Equation 2), then the refinement can be thought of re-feeding to a Prototypical Network a new support set augmented with (soft) self-labels from the unlabeled set.
157
+
158
+ Our algorithm is also related to transductive learning (Vapnik, 1998; Joachims, 1999; Fu et al., 2015), where the base classifier gets refined by seeing the unlabeled examples. In practice, one could use our method in a transductive setting where the unlabeled set is the same as the query set; however, here to avoid our model memorizing labels of the unlabeled set during the meta-learning procedure, we split out a separate unlabeled set that is different from the query set.
159
+
160
+ In addition to the original $k$ -Means method (Lloyd, 1982), the most related work to our setup involving clustering algorithms considers applying $k$ -Means in the presence of outliers (Hautamäki et al., 2005; Chawla & Gionis, 2013; Gupta et al., 2017). The goal here is to correctly discover and ignore the outliers so that they do not wrongly shift the cluster locations to form a bad partition of the true data. This objective is also important in our setup as not ignoring outliers (or distractors) will wrongly shift the prototypes and negatively influence classification performance.
161
+
162
+ Our contribution to the semi-supervised learning and clustering literature is to go beyond the classical setting of training and evaluating within a single dataset, and consider the setting where we must learn to transfer from a set of training classes $\mathcal { C } _ { \mathrm { t r a i n } }$ to a new set of test classes $\mathcal { C } _ { \mathrm { t e s t } }$ .
163
+
164
+ # 5 EXPERIMENTS
165
+
166
+ # 5.1 DATASETS
167
+
168
+ We evaluate the performance of our model on three datasets: two benchmark few-shot classification datasets and a novel large-scale dataset that we hope will be useful for future few-shot learning work.
169
+
170
+ Omniglot (Lake et al., 2011) is a dataset of 1,623 handwritten characters from 50 alphabets. Each character was drawn by 20 human subjects. We follow the few-shot setting proposed by Vinyals et al. (2016), in which the images are resized to $2 8 \times 2 8$ pixels and rotations in multiples of $9 0 ^ { \circ }$ are applied, yielding 6,492 classes in total. These are split into 4,112 training classes, 688 validation classes, and 1,692 testing classes.
171
+
172
+ miniImageNet (Vinyals et al., 2016) is a modified version of the ILSVRC-12 dataset (Russakovsky et al., 2015), in which 600 images for each of 100 classes were randomly chosen to be part of the dataset. We rely on the class split used by Ravi & Larochelle (2017). These splits use 64 classes for training, 16 for validation, and 20 for test. All images are of size $8 4 \times 8 4$ pixels.
173
+
174
+ tieredImageNet is our proposed dataset for few-shot classification. Like miniImagenet, it is a subset of ILSVRC-12. However, tieredImageNet represents a larger subset of ILSVRC-12 (608 classes rather than 100 for miniImageNet). Analogous to Omniglot, in which characters are grouped into alphabets, tieredImageNet groups classes into broader categories corresponding to higher-level nodes in the ImageNet (Deng et al., 2009) hierarchy. There are 34 categories in total, with each category containing between 10 and 30 classes. These are split into 20 training, 6 validation and 8 testing categories (details of the dataset can be found in the supplementary material). This ensures that all of the training classes are sufficiently distinct from the testing classes, unlike miniImageNet and other alternatives such as randImageNet proposed by Vinyals et al. (2016). For example, “pipe organ” is a training class and “electric guitar” is a test class in the Ravi & Larochelle (2017) split of miniImagenet, even though they are both musical instruments. This scenario would not occur in tieredImageNet since “musical instrument” is a high-level category and as such is not split between training and test classes. This represents a more realistic few-shot learning scenario since in general we cannot assume that test classes will be similar to those seen in training. Additionally, the tiered structure of tieredImageNet may be useful for few-shot learning approaches that can take advantage of hierarchical relationships between classes. We leave such interesting extensions for future work.
175
+
176
+ Table 1: Omniglot 1-shot classification results. In this table as well as those below “w/ D” denotes “with distractors”, where the unlabeled images contain irrelevant classes.
177
+
178
+ <table><tr><td rowspan=1 colspan=1>Models</td><td rowspan=1 colspan=1>Acc.</td><td rowspan=1 colspan=1>Acc. w/ D</td></tr><tr><td rowspan=1 colspan=1>Supervised</td><td rowspan=1 colspan=1>94.62 ± 0.09</td><td rowspan=1 colspan=1>94.62 ± 0.09</td></tr><tr><td rowspan=1 colspan=1>Semi-Supervised Inference</td><td rowspan=1 colspan=1>97.45 ± 0.05</td><td rowspan=1 colspan=1>95.08 ± 0.09</td></tr><tr><td rowspan=1 colspan=1>Soft k-Means</td><td rowspan=1 colspan=1>97.25 ± 0.10</td><td rowspan=1 colspan=1>95.01 ± 0.09</td></tr><tr><td rowspan=1 colspan=1>Soft k-Means+Cluster</td><td rowspan=1 colspan=1>97.68 ± 0.07</td><td rowspan=1 colspan=1>97.17 ± 0.04</td></tr><tr><td rowspan=1 colspan=1>Masked Soft k-Means</td><td rowspan=1 colspan=1>97.52 ± 0.07</td><td rowspan=1 colspan=1>97.30 ± 0.08</td></tr></table>
179
+
180
+ # 5.2 ADAPTING THE DATASETS FOR SEMI-SUPERVISED LEARNING
181
+
182
+ For each dataset, we first create an additional split to separate the images of each class into disjoint labeled and unlabeled sets. For Omniglot and tieredImageNet we sample $10 \%$ of the images of each class to form the labeled split. The remaining $90 \%$ can only be used in the unlabeled portion of episodes. For miniImageNet we use $40 \%$ of the data for the labeled split and the remaining $60 \%$ for the unlabeled, since we noticed that $10 \%$ was too small to achieve reasonable performance and avoid overfitting. We report the average classification scores over 10 random splits of labeled and unlabeled portions of the training set, with uncertainty computed in standard error (standard deviation divided by the square root of the total number of splits).
183
+
184
+ We would like to emphasize that due to this labeled/unlabeled split, we are using strictly less label information than in the previously-published work on these datasets. Because of this, we do not expect our results to match the published numbers, which should instead be interpreted as an upperbound for the performance of the semi-supervised models defined in this work.
185
+
186
+ Episode construction then is performed as follows. For a given dataset, we create a training episode by first sampling $N$ classes uniformly at random from the set of training classes $\mathcal { C } _ { \mathrm { t r a i n } }$ . We then sample $K$ images from the labeled split of each of these classes to form the support set, and $M$ images from the unlabeled split of each of these classes to form the unlabeled set. Optionally, when including distractors, we additionally sample $H$ other classes from the set of training classes and $M$ images from the unlabeled split of each to act as the distractors. These distractor images are added to the unlabeled set along with the unlabeled images of the $N$ classes of interest (for a total of $M N + M H$ unlabeled images). The query portion of the episode is comprised of a fixed number of images from the labeled split of each of the $N$ chosen classes. Test episodes are created analogously, but with the $N$ classes (and optionally the $H$ distractor classes) sampled from $\mathcal { C } _ { \mathrm { t e s t } }$ . In the experiments reported here we used $H = N = 5$ , i.e. 5 classes for both the labeled classes and the distractor classes. We used $M = 5$ for training and $M = 2 0$ for testing in most cases, thus measuring the ability of the models to generalize to a larger unlabeled set size. Details of the dataset splits, including the specific classes assigned to train/validation/test sets, can be found in Appendices A and B.
187
+
188
+ In each dataset we compare our three semi-supervised models with two baselines. The first baseline, referred to as “Supervised” in our tables, is an ordinary Prototypical Network that is trained in a purely supervised way on the labeled split of each dataset. The second baseline, referred to as “Semi-Supervised Inference”, uses the embedding function learned by this supervised Prototypical Network, but performs semi-supervised refinement of the prototypes at test time using a step of Soft $k$ -Means refinement. This is to be contrasted with our semi-supervised models that perform this refinement both at training time and at test time, therefore learning a different embedding function. We evaluate each model in two settings: one where all unlabeled examples belong to the classes of interest, and a more challenging one that includes distractors. Details of the model hyperparameters can be found in Appendix D and our online repository.3
189
+
190
+ # 5.3 RESULTS
191
+
192
+ Results for Omniglot, miniImageNet and tieredImageNet are given in Tables 1, 2 and 5, respectively, while Figure 4 shows the performance of our models on tieredImageNet (our largest dataset) using different values for $M$ (number of items in the unlabeled set per class). Additional results comparing the ProtoNet model to various baselines on these datasets, and analysis of the performance of the Masked Soft $k$ -Means model can be found in Appendix C.
193
+
194
+ Table 2: miniImageNet 1/5-shot classification results.
195
+
196
+ <table><tr><td rowspan=1 colspan=1>Models</td><td rowspan=1 colspan=1>1-shot Acc.</td><td rowspan=1 colspan=1>5-shot Acc.</td><td rowspan=1 colspan=1>1-shot Acc w/ D</td><td rowspan=1 colspan=1> 5-shot Acc. w/ D</td></tr><tr><td rowspan=1 colspan=1>Supervised</td><td rowspan=1 colspan=1>43.61 ± 0.27</td><td rowspan=1 colspan=1>59.08 ± 0.22</td><td rowspan=1 colspan=1>43.61 ± 0.27</td><td rowspan=1 colspan=1>59.08 ± 0.22</td></tr><tr><td rowspan=1 colspan=1>Semi-Supervised Inference</td><td rowspan=1 colspan=1>48.98 ± 0.34</td><td rowspan=1 colspan=1>63.77 ± 0.20</td><td rowspan=1 colspan=1>47.42 ± 0.33</td><td rowspan=1 colspan=1>62.62 ± 0.24</td></tr><tr><td rowspan=1 colspan=1>Soft k-Means</td><td rowspan=1 colspan=1>50.09 ± 0.45</td><td rowspan=1 colspan=1>64.59 ± 0.28</td><td rowspan=1 colspan=1>48.70 ± 0.32</td><td rowspan=1 colspan=1>63.55 ± 0.28</td></tr><tr><td rowspan=1 colspan=1>Soft k-Means+Cluster</td><td rowspan=1 colspan=1>49.03 ± 0.24</td><td rowspan=1 colspan=1>63.08 ± 0.18</td><td rowspan=1 colspan=1>48.86± 0.32</td><td rowspan=1 colspan=1>61.27 ± 0.24</td></tr><tr><td rowspan=1 colspan=1>Masked Soft k-Means</td><td rowspan=1 colspan=1>50.41 ± 0.31</td><td rowspan=1 colspan=1>64.39 ± 0.24</td><td rowspan=1 colspan=1>49.04 ± 0.31</td><td rowspan=1 colspan=1>62.96 ± 0.14</td></tr></table>
197
+
198
+ Table 3: tieredImageNet 1/5-shot classification results.
199
+
200
+ <table><tr><td rowspan=1 colspan=1>Models</td><td rowspan=1 colspan=1>1-shot Acc.</td><td rowspan=1 colspan=1> 5-shot Acc.</td><td rowspan=1 colspan=1>1-shot Acc. w/ D</td><td rowspan=1 colspan=1> 5-shot Acc. w/ D</td></tr><tr><td rowspan=1 colspan=1>Supervised</td><td rowspan=1 colspan=1>46.52 ± 0.52</td><td rowspan=1 colspan=1>66.15 ± 0.22</td><td rowspan=1 colspan=1>46.52 ± 0.52</td><td rowspan=1 colspan=1>66.15 ± 0.22</td></tr><tr><td rowspan=1 colspan=1>Semi-Supervised Inference</td><td rowspan=1 colspan=1>50.74 ± 0.75</td><td rowspan=1 colspan=1>69.37 ± 0.26</td><td rowspan=1 colspan=1>48.67 ± 0.60</td><td rowspan=1 colspan=1>67.46 ± 0.24</td></tr><tr><td rowspan=1 colspan=1>Soft k-Means</td><td rowspan=1 colspan=1>51.52 ± 0.36</td><td rowspan=1 colspan=1>70.25 ± 0.31</td><td rowspan=1 colspan=1>49.88 ± 0.52</td><td rowspan=1 colspan=1>68.32 ± 0.22</td></tr><tr><td rowspan=1 colspan=1>Soft k-Means+Cluster</td><td rowspan=1 colspan=1>51.85 ± 0.25</td><td rowspan=1 colspan=1>69.42 ± 0.17</td><td rowspan=1 colspan=1>51.36 ± 0.31</td><td rowspan=1 colspan=1>67.56 ± 0.10</td></tr><tr><td rowspan=1 colspan=1>Masked Soft k-Means</td><td rowspan=1 colspan=1>52.39 ± 0.44</td><td rowspan=1 colspan=1>69.88 ± 0.20</td><td rowspan=1 colspan=1>51.38 ± 0.38</td><td rowspan=1 colspan=1>69.08 ± 0.25</td></tr></table>
201
+
202
+ Across all three benchmarks, at least one of our proposed models outperforms the baselines, demonstrating the effectiveness of our semi-supervised meta-learning procedure. In the nondistractor settings, all three proposed models outperform the baselines in almost all the experiments, without a clear winner between the three models across the datasets and shot numbers. In the scenario where training and testing includes distractors, Masked Soft $k$ -Means shows the most robust performance across all three datasets, attaining the best results in each case but one. In fact this model reaches performance that is close to the upper bound based on the results without distractors.
203
+
204
+ From Figure 4, we observe clear improvements in test accuracy when the number of items in the unlabeled set per class grows from 0 to 25. These models were trained with $M = 5$ and thus are showing an ability to extrapolate in generalization. This confirms that, through meta-training, the models learn to acquire a better representation that is improved by semi-supervised refinement.
205
+
206
+ # 6 CONCLUSION
207
+
208
+ In this work, we propose a novel semi-supervised few-shot learning paradigm, where an unlabeled set is added to each episode. We also extend the setup to more realistic situations where the unlabeled set has novel classes distinct from the labeled classes. To address the problem that current fewshot classification datasets are too small for a labeled vs. unlabeled split and also lack hierarchical levels of labels, we introduce a new dataset, tieredImageNet. We propose several novel extensions of Prototypical Networks, and they show consistent improvements under semi-supervised settings compared to our baselines. As future work, we are working on incorporating fast weights (Ba et al., 2016; Finn et al., 2017) into our framework so that examples can have different embedding representations given the contents in the episode.
209
+
210
+ Acknowledgement Supported by grants from NSERC, Samsung, and the Intelligence Advanced Research Projects Activity (IARPA) via Department of Interior/Interior Business Center (DoI/IBC) contract number D16PC00003. The U.S. Government is authorized to reproduce and distribute reprints for Governmental purposes notwithstanding any copyright annotation thereon. Disclaimer: The views and conclusions contained herein are those of the authors and should not be interpreted as necessarily representing the official policies or endorsements, either expressed or implied, of IARPA, DoI/IBC, or the U.S. Government.
211
+
212
+ ![](images/efb36bc0731609f9e536fc139ba587b8e6c9de34b7909d4c66be59f685b76cab.jpg)
213
+ Figure 4: Model Performance on tieredImageNet with different numbers of unlabeled items during test time.
214
+
215
+ # REFERENCES
216
+
217
+ Jimmy Ba, Geoffrey E. Hinton, Volodymyr Mnih, Joel Z. Leibo, and Catalin Ionescu. Using fast weights to attend to the recent past. In Advances in Neural Information Processing Systems 29: Annual Conference on Neural Information Processing Systems 2016, December 5-10, 2016, Barcelona, Spain, pp. 4331–4339, 2016.
218
+
219
+ Philip Bachman, Alessandro Sordoni, and Adam Trischler. Learning algorithms for active learning. 2017.
220
+
221
+ Olivier Chapelle, Bernhard Schölkopf, and Alexander Zien. Semi-Supervised Learning. The MIT Press, 1st edition, 2010. ISBN 0262514125, 9780262514125.
222
+
223
+ Sanjay Chawla and Aristides Gionis. k-means–: A unified approach to clustering and outlier detection. In Proceedings of the 2013 SIAM International Conference on Data Mining, pp. 189– 197. SIAM, 2013.
224
+
225
+ Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In Computer Vision and Pattern Recognition, 2009. CVPR 2009. IEEE Conference on, pp. 248–255. IEEE, 2009.
226
+
227
+ Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In 34th International Conference on Machine Learning, 2017.
228
+
229
+ Yanwei Fu, Timothy M. Hospedales, Tao Xiang, and Shaogang Gong. Transductive multi-view zero-shot learning. IEEE Trans. Pattern Anal. Mach. Intell., 37(11):2332–2345, 2015.
230
+
231
+ Shalmoli Gupta, Ravi Kumar, Kefu Lu, Benjamin Moseley, and Sergei Vassilvitskii. Local search methods for k-means with outliers. Proceedings of the VLDB Endowment, 10(7):757–768, 2017.
232
+
233
+ Ville Hautamäki, Svetlana Cherednichenko, Ismo Kärkkäinen, Tomi Kinnunen, and Pasi Fränti. Improving k-means by outlier removal. In Scandinavian Conference on Image Analysis, pp. 978– 987. Springer, 2005.
234
+
235
+ Sepp Hochreiter, A Steven Younger, and Peter R Conwell. Learning to learn using gradient descent. In International Conference on Artificial Neural Networks, pp. 87–94. Springer, 2001.
236
+
237
+ Thorsten Joachims. Transductive inference for text classification using support vector machines. In Proceedings of the Sixteenth International Conference on Machine Learning, 1999.
238
+
239
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
240
+
241
+ Gregory Koch, Richard Zemel, and Ruslan Salakhutdinov. Siamese neural networks for one-shot image recognition. In ICML Deep Learning Workshop, volume 2, 2015.
242
+
243
+ 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, Boston, Massachusetts, USA, July 20-23, 2011, 2011.
244
+
245
+ Stuart Lloyd. Least squares quantization in pcm. IEEE transactions on information theory, 28(2): 129–137, 1982.
246
+
247
+ Nikhil Mishra, Mostafa Rohaninejad, Xi Chen, and Pieter Abbeel. Meta-learning with temporal convolutions. CoRR, abs/1707.03141, 2017.
248
+
249
+ Sachin Ravi and Hugo Larochelle. Optimization as a model for few-shot learning. In 5th International Conference on Learning Representations, 2017.
250
+
251
+ Chuck Rosenberg, Martial Hebert, and Henry Schneiderman. Semi-supervised self-training of object detection models. 2005.
252
+
253
+ 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.
254
+
255
+ Adam Santoro, Sergey Bartunov, Matthew Botvinick, Daan Wierstra, and Timothy P. Lillicrap. Oneshot learning with memory-augmented neural networks. In 33rd International Conference on Machine Learning, 2016.
256
+
257
+ Jake Snell, Kevin Swersky, and Richard S. Zemel. Prototypical networks for few-shot learning. In Advances in Neural Information Processing Systems 30, 2017.
258
+
259
+ Sebastian Thrun. Lifelong learning algorithms. In Learning to learn, pp. 181–209. Springer, 1998.
260
+
261
+ V.N. Vapnik. Statistical Learning Theory. Wiley, 1998. ISBN 9788126528929.
262
+
263
+ 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, pp. 3630–3638, 2016.
264
+
265
+ David Yarowsky. Unsupervised word sense disambiguation rivaling supervised methods. In Proceedings of the 33rd annual meeting on Association for Computational Linguistics, pp. 189– 196. Association for Computational Linguistics, 1995.
266
+
267
+ Xiaojin Zhu. Semi-supervised learning literature survey. 2005.
268
+
269
+ # A OMNIGLOT DATASET DETAILS
270
+
271
+ We used the following split details for experiments on Omniglot dataset. This is the same train/test split as (Vinyals et al., 2016), but we created our own validation split for selecting hyper-parameters. Models are trained on the train split only.
272
+
273
+ Train Alphabets: Alphabet_of_the_Magi, Angelic, Anglo-Saxon_Futhorc, Arcadian, Asomtavruli_(Georgian), Atemayar_Qelisayer, Atlantean, Aurek-Besh, Avesta, Balinese, Blackfoot_(Canadian_Aboriginal_Syllabics), Braille, Burmese_(Myanmar), Cyrillic, Futurama, Ge_ez, Glagolitic, Grantha, Greek, Gujarati, Gurmukhi (character 01-41), Inuktitut_(Canadian_Aboriginal_Syllabics), Japanese_(hiragana), Japanese_(katakana), Korean, Latin, Malay_(Jawi_-_Arabic), N_Ko, Ojibwe_(Canadian_Aboriginal_Syllabics), Sanskrit, Syriac_(Estrangelo), Tagalog, Tifinagh
274
+
275
+ Validation Alphabets: Armenian, Bengali, Early_Aramaic, Hebrew, Mkhedruli_(Geogian)
276
+
277
+ Test Alphabets: Gurmukhi (character 42-45), Kannada, Keble, Malayalam, Manipuri, Mongolian, Old_Church_Slavonic_(Cyrillic), Oriya, Sylheti, Syriac_(Serto), Tengwar, Tibetan, ULOG
278
+
279
+ # B tieredIMAGENET DATASET DETAILS
280
+
281
+ Each high-level category in tieredImageNet contains between 10 and 30 ILSVRC-12 classes (17.8 on average). In the ImageNet hierarchy, some classes have multiple parent nodes. Therefore, classes belonging to more than one category were removed from the dataset to ensure separation between training and test categories. Test categories were chosen to reflect various levels of separation between training and test classes. Some test categories (such as “working dog”) are fairly similar to training categories, whereas others (such as “geological formation”) are quite different. The list of categories is shown below and statistics of the dataset can be found in Table 4. A visualization of the categories according to the ImageNet hierarchy is shown in Figure 5. The full list of classes per category will also be made public, however for the sake of brevity we do not include it here.
282
+
283
+ Table 4: Statistics of the tieredImageNet dataset.
284
+
285
+ <table><tr><td></td><td>Train</td><td>Val</td><td>Test</td><td>Total</td></tr><tr><td>Categories</td><td>20</td><td>6</td><td>8</td><td>34</td></tr><tr><td>Classes</td><td>351</td><td>97</td><td>160</td><td>608</td></tr><tr><td>Images</td><td>448,695</td><td>124,261</td><td>206,209</td><td>779,165</td></tr></table>
286
+
287
+ Train Categories: n02087551 (hound, hound dog), n02092468 (terrier), n02120997 (feline, felid), n02370806 (ungulate, hoofed mammal), n02469914 (primate), n01726692 (snake, serpent, ophidian), n01674216 (saurian), n01524359 (passerine, passeriform bird), n01844917 (aquatic bird), n04081844 (restraint, constraint), n03574816 (instrument), n03800933 (musical instrument, instrument), n03125870 (craft), n04451818 (tool), n03414162 (game equipment), n03278248 (electronic equipment), n03419014 (garment), n03297735 (establishment), n02913152 (building, edifice), n04014297 (protective covering, protective cover, protection).
288
+
289
+ Validation Categories: n02098550 (sporting dog, gun dog), n03257877 (durables, durable goods, consumer durables), n03405265 (furnishing), n03699975 (machine), n03738472 (mechanism), n03791235 (motor vehicle, automotive vehicle),
290
+
291
+ Test Categories: n02103406 (working dog), n01473806 (aquatic vertebrate), n02159955 (insect), n04531098 (vessel), n03839993 (obstruction, obstructor, obstructer, impediment, impedimenta), n09287968 (geological formation, formation), n00020090 (substance), n15046900 (solid).
292
+
293
+ Table 5: Few-shot learning baseline results using labeled/unlabeled splits. Baselines either takes inputs directly from the pixel space or use a CNN to extract features. “rnd” denotes using a randomly initialized CNN, and “pre” denotes using a CNN that is pretrained for supervised classification for all training classes.
294
+
295
+ <table><tr><td rowspan="2">Models</td><td>Omniglot</td><td colspan="2">miniImageNet</td><td colspan="2">tieredImageNet</td></tr><tr><td>1-shot</td><td>1-shot</td><td>5-shot</td><td>1-shot</td><td>5-shot</td></tr><tr><td>1-NN Pixel</td><td>40.39± 0.36</td><td>26.74 ± 0.48</td><td>31.43 ± 0.51</td><td>26.55± 0.50</td><td>30.79± 0.53</td></tr><tr><td>1-NN CNN rnd</td><td>59.55 ± 0.46</td><td>24.03 ± 0.38</td><td>27.54 ± 0.42</td><td>25.49 ± 0.45</td><td>30.01 ± 0.47</td></tr><tr><td>1-NN CNN pre</td><td>52.53 ± 0.51</td><td>32.90 ± 0.58</td><td>40.79 ± 0.76</td><td>32.76 ± 0.66</td><td>40.26 ± 0.67</td></tr><tr><td>LRPixel</td><td>49.15 ± 0.39</td><td>24.50 ± 0.41</td><td>33.33±0.68</td><td>25.70± 0.46</td><td>36.30± 0.62</td></tr><tr><td>LR CNN rnd</td><td>57.80 ± 0.45</td><td>24.10 ± 0.50</td><td>28.40 ± 0.42</td><td>26.55 ± 0.48</td><td>32.51 ± 0.52</td></tr><tr><td>LR CNN pre</td><td>48.49 ± 0.47</td><td>30.28 ± 0.54</td><td>40.27 ± 0.59</td><td>34.52 ± 0.68</td><td>43.58 ± 0.72</td></tr><tr><td>ProtoNet</td><td>94.62 ± 0.09</td><td>43.61 ± 0.27</td><td>59.08 ± 0.22</td><td>46.52 ± 0.32</td><td>66.15 ± 0.34</td></tr></table>
296
+
297
+ # C EXTRA EXPERIMENTAL RESULTS
298
+
299
+ # C.1 FEW-SHOT CLASSIFICATION BASELINES
300
+
301
+ We provide baseline results on few-shot classification using 1-nearest neighbor and logistic regression with either pixel inputs or CNN features. Compared with the baselines, Regular ProtoNet performs significantly better on all three few-shot classification datasets.
302
+
303
+ # C.2 NUMBER OF UNLABELED ITEMS
304
+
305
+ Figure 6 shows test accuracy values with different number of unlabeled items during test time.
306
+ Figure 7 shows our mask output value distribution of the Masked Soft $k$ -Means model on Omniglot.
307
+ The mask values have a bi-modal distribution, corresponding to distractor and non-distractor items.
308
+
309
+ # D HYPERPARAMETER DETAILS
310
+
311
+ For Omniglot, we adopted the best hyperparameter settings found for ordinary Prototypical Networks in Snell et al. (2017). In these settings, the learning rate was set to 1e-3, and cut in half every 2K updates starting at update 2K. We trained for a total of 20K updates. For miniImagenet and tieredImageNet, we trained with a starting learning rate of 1e-3, which we also decayed. We started the decay after 25K updates, and every 25K updates thereafter we cut it in half. We trained for a total of 200K updates. We used ADAM (Kingma & Ba, 2014) for the optimization of our models. For the MLP used in the Masked Soft $k$ -Means model, we use a single hidden layer with 20 hidden units with a tanh non-linearity for all 3 datasets. We did not tune the hyparameters of this MLP so better performance may be attained with a more rigorous hyperparameter search.
312
+
313
+ ![](images/ffb830cb65e716257aac92f1eea002089be7b6cbf27a6e110c0024a441fb44be.jpg)
314
+
315
+ ![](images/ee3b37c708ea4994f31dc10d74e3a6730fa8e3abdad49f0c128dfa6ea0a94972.jpg)
316
+ Figure 6: Model Performance on tieredImageNet with different number of unlabeled items during test time. We include test accuracy numbers in this chart.
317
+
318
+ ![](images/4ec598503b0edfd3103a0860e66835f81c8129fecdd7d502de22ec3016fed891.jpg)
319
+ Figure 7: Mask values predicted by masked soft k-means on Omniglot.