ZHANGYUXUAN-zR commited on
Commit
66b60d9
·
verified ·
1 Parent(s): ab82bea

Add files using upload-large-folder tool

Browse files
Files changed (50) hide show
  1. md/train/0migj5lyUZl/0migj5lyUZl.md +360 -0
  2. md/train/1AoMhc_9jER/1AoMhc_9jER.md +352 -0
  3. md/train/AY8zfZm0tDd/AY8zfZm0tDd.md +578 -0
  4. md/train/BJgnXpVYwS/BJgnXpVYwS.md +774 -0
  5. md/train/BJlgNh0qKQ/BJlgNh0qKQ.md +532 -0
  6. md/train/Bkl086VYvH/Bkl086VYvH.md +193 -0
  7. md/train/BygqBiRcFQ/BygqBiRcFQ.md +612 -0
  8. md/train/FrIDgjDOH1u/FrIDgjDOH1u.md +281 -0
  9. md/train/Goz-qsH1F14/Goz-qsH1F14.md +288 -0
  10. md/train/H1faSn0qY7/H1faSn0qY7.md +486 -0
  11. md/train/H1lVvgHKDr/H1lVvgHKDr.md +243 -0
  12. md/train/H1ldNoC9tX/H1ldNoC9tX.md +519 -0
  13. md/train/H1xipsA5K7/H1xipsA5K7.md +0 -0
  14. md/train/HJMN-xWC-/HJMN-xWC-.md +237 -0
  15. md/train/HJeRkh05Km/HJeRkh05Km.md +294 -0
  16. md/train/HJxiMAVtPH/HJxiMAVtPH.md +444 -0
  17. md/train/Hk0olMdZOIU/Hk0olMdZOIU.md +275 -0
  18. md/train/HkCsm6lRb/HkCsm6lRb.md +425 -0
  19. md/train/HkNDsiC9KQ/HkNDsiC9KQ.md +702 -0
  20. md/train/HkXWCMbRW/HkXWCMbRW.md +363 -0
  21. md/train/HyxPx3R9tm/HyxPx3R9tm.md +529 -0
  22. md/train/KRODJAa6pzE/KRODJAa6pzE.md +325 -0
  23. md/train/P42rXLGZQ07/P42rXLGZQ07.md +422 -0
  24. md/train/Pz_dcqfcKW8/Pz_dcqfcKW8.md +274 -0
  25. md/train/QtTKTdVrFBB/QtTKTdVrFBB.md +537 -0
  26. md/train/RovX-uQ1Hua/RovX-uQ1Hua.md +453 -0
  27. md/train/SJ1nzBeA-/SJ1nzBeA-.md +330 -0
  28. md/train/SJgwzCEKwH/SJgwzCEKwH.md +0 -0
  29. md/train/SJlpYJBKvH/SJlpYJBKvH.md +401 -0
  30. md/train/SUyxNGzUsH/SUyxNGzUsH.md +386 -0
  31. md/train/SkE6PjC9KX/SkE6PjC9KX.md +298 -0
  32. md/train/SkeXehR9t7/SkeXehR9t7.md +335 -0
  33. md/train/Wj4ODo0uyCF/Wj4ODo0uyCF.md +325 -0
  34. md/train/ZKbZ4mebI9l/ZKbZ4mebI9l.md +340 -0
  35. md/train/_b8l7rVPe8z/_b8l7rVPe8z.md +392 -0
  36. md/train/cu7IUiOhujH/cu7IUiOhujH.md +283 -0
  37. md/train/g-wu9TMPODo/g-wu9TMPODo.md +0 -0
  38. md/train/iAX0l6Cz8ub/iAX0l6Cz8ub.md +590 -0
  39. md/train/j7u7cJDBo8p/j7u7cJDBo8p.md +250 -0
  40. md/train/lR4aaWCQgB/lR4aaWCQgB.md +294 -0
  41. md/train/r1l1myStwr/r1l1myStwr.md +528 -0
  42. md/train/rJY3vK9eg/rJY3vK9eg.md +397 -0
  43. md/train/rkA1f3NpZ/rkA1f3NpZ.md +209 -0
  44. md/train/rkaT3zWCZ/rkaT3zWCZ.md +339 -0
  45. md/train/rkcQFMZRb/rkcQFMZRb.md +445 -0
  46. md/train/rkl6As0cF7/rkl6As0cF7.md +576 -0
  47. md/train/ryH20GbRW/ryH20GbRW.md +350 -0
  48. md/train/rygBVTVFPB/rygBVTVFPB.md +368 -0
  49. md/train/s95BePNvykX/s95BePNvykX.md +255 -0
  50. md/train/v_1Soh8QUNc/v_1Soh8QUNc.md +570 -0
md/train/0migj5lyUZl/0migj5lyUZl.md ADDED
@@ -0,0 +1,360 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # A STRONG ON-POLICY COMPETITOR TO PPO
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ As a recognized variant and improvement for Trust Region Policy Optimization (TRPO), proximal policy optimization (PPO) has been widely used with several advantages: efficient data utilization, easy implementation, and good parallelism. In this paper, a first-order gradient reinforcement learning algorithm called Policy Optimization with Penalized Point Probability Distance (POP3D), which is a lower bound to the square of total variance divergence, is proposed as another powerful variant. The penalty item has dual effects, prohibiting policy updates from overshooting and encouraging more explorations. By carefully controlled experiments on both discrete and continuous benchmarks, our approach is proved highly competitive to PPO.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ With the development of deep reinforcement learning, lots of impressive results have been produced in a wide range of fields such as playing Atari game (Mnih et al., 2015; Hessel et al., 2018), controlling robotics (Lillicrap et al., 2015), Go (Silver et al., 2017), neural architecture search (Tan et al., 2019; Pham et al., 2018).
12
+
13
+ The basis of a reinforcement learning algorithm is generalized policy iteration (Sutton & Barto, 2018), which states two essential iterative steps: policy evaluation and improvement. Among various algorithms, policy gradient is an active branch of reinforcement learning whose foundations are Policy Gradient Theorem and the most classical algorithm REINFORCEMENT (Sutton & Barto, 2018). Since then, handfuls of policy gradient variants have been proposed, such as Deep Deterministic Policy Gradient (DDPG) (Lillicrap et al., 2015), Asynchronous Advantage Actor-Critic (A3C) (Mnih et al., 2016), Actor-Critic using Kronecker-factored Trust Region (ACKTR) (Wu et al., 2017), and Proximal Policy Optimization (PPO) (Schulman et al., 2017).
14
+
15
+ Improving the strategy monotonically had been nontrivial until Schulman et al. (2015) proposed Trust Region Policy Optimization (TRPO), in which Fisher vector product is utilized to cut down the computing burden. Specifically, Kullback–Leibler divergence (KLD) acts as a hard constraint in place of objective, because its corresponding coefficient is difficult to set for different problems. However, TRPO still has several drawbacks: too complicated, inefficient data usage. Quite a lot of efforts have been devoted to improving TRPO since then and the most commonly used one is PPO.
16
+
17
+ PPO can be regarded as a first-order variant of TRPO and have obvious improvements in several facets. In particular, a pessimistic clipped surrogate objective is proposed where TRPO’s hard constraint is replaced by the clipped action probability ratio. In such a way, it constructs an unconstrained optimization problem so that any first-order stochastic gradient optimizer can be directly applied. Besides, it’s easier to be implemented and more robust against various problems, achieving an impressive result on Atari games (Brockman et al., 2016). However, the cost of data sampling is not always cheap. Haarnoja et al. (2018) design an off-policy algorithm called Soft Actor-Critic and achieves the state of the art result by encouraging better exploration using maximum entropy.
18
+
19
+ In this paper, we focus on the on-policy improvement to improve PPO and answer the question: how to successfully leverage penalized optimization to solve the constrained one which is formulated by Schulman et al. (2015).
20
+
21
+ 1. It proposes a simple variant of TRPO called POP3D along with a new surrogate objective containing a point probability penalty item, which is symmetric lower bound to the square of the total variance divergence of policy distributions. Specifically, it helps to stabilize the learning process and encourage exploration. Furthermore, it escapes from penalty item setting headache along with penalized version TRPO, where is arduous to select one fixed value for various environments.
22
+
23
+ 2. It achieves state-of-the-art results among on-policy algorithms with a clear margin on 49 Atari games within 40 million frame steps based on two shared metrics. Moreover, it also achieves competitive results compared with PPO in the continuous domain. It dives into the mechanism of PPO’s improvement over TRPO from the perspective of solution manifold, which also plays an important role in our method.
24
+
25
+ 3. It enjoys almost all PPO’s advantages such as easy implementation, fast learning ability.
26
+
27
+ We provide the code and training logs to make our work reproducible.
28
+
29
+ # 2 PRELIMINARY KNOWLEDGE AND RELATED WORK
30
+
31
+ # 2.1 POLICY GRADIENT
32
+
33
+ Agents interact with the environment and receive rewards which are used to adjust their policy in turn. At state $s _ { t }$ , one agent takes strategy $\pi$ and transfers to a new state $s _ { t + 1 }$ , rewarded $r _ { t }$ by the environment. Maximizing discounted return (accumulated rewards) $R _ { t }$ is its objective. In particular, given a policy $\pi$ , $R _ { t }$ is defined as
34
+
35
+ $$
36
+ R _ { t } = \sum _ { n = 0 } ^ { \infty } ( r _ { t } + \gamma r _ { t + 1 } + \gamma ^ { 2 } r _ { t + 2 } + \ldots + \gamma ^ { n } r _ { t + n } ) .
37
+ $$
38
+
39
+ $\gamma$ is the discounted coefficient to control future rewards, which lies in the range $( 0 , 1 )$ . Regarding a neural network with parameter $\theta$ , the policy $\pi _ { \boldsymbol { \theta } } ( a | \boldsymbol { s } )$ can be learned by maximizing Equation 1 using the back-propagation algorithm. Particularly, given $Q ( s , a )$ which represents the agent’s return in state $s$ after taking action $a$ , the objective function can be written as
40
+
41
+ $$
42
+ \operatorname* { m a x } _ { \theta } \quad \mathbb { E } _ { s , a } \log \pi _ { \theta } ( a | s ) Q ( s , a ) .
43
+ $$
44
+
45
+ Equation 2 lays the foundation for handfuls of policy gradient based algorithms. Another variant can be deduced by using
46
+
47
+ $$
48
+ A ( s , a ) = Q ( s , a ) - V ( s )
49
+ $$
50
+
51
+ to replace $Q ( s , a )$ in Equation 2 equivalently, $V ( s )$ can be any function so long as $V$ depends on $s$ but not $a$ . In most cases, state value function is used for $V$ , which not only helps to reduce variations but has clear physical meaning. Formally, it can be written as
52
+
53
+ $$
54
+ \operatorname* { m a x } _ { \theta } \quad \mathbb { E } _ { s , a } \log \pi _ { \theta } ( a | s ) A ( s , a ) .
55
+ $$
56
+
57
+ # 2.2 ADVANTAGE ESTIMATE
58
+
59
+ A commonly used method for advantage calculation is one-step estimation, which follows
60
+
61
+ $$
62
+ A ( s _ { t } , a _ { t } ) = Q ( s _ { t } , a _ { t } ) - V ( s _ { t } ) = r _ { t } + \gamma V ( s _ { t + 1 } ) - V ( s _ { t } ) .
63
+ $$
64
+
65
+ However, a more accurate method called generalized advantage estimation is proposed in Schulman et al. (2016), where all time steps of estimation are combined and summarized using $\lambda$ -based weights,. The generalized advantage estimator $\hat { A } _ { t } ^ { G A E ( \gamma , \lambda ) }$ is defined by Schulman et al. (2016) as
66
+
67
+ $$
68
+ \begin{array} { c } { { \hat { A } _ { t } ^ { G A E ( \gamma , \lambda ) } : = ( 1 - \lambda ) * ( \hat { A } _ { t } ^ { ( 1 ) } + \lambda \hat { A } _ { t } ^ { ( 2 ) } + \lambda ^ { 2 } \hat { A } _ { t } ^ { ( 3 ) } + . . . ) = \displaystyle \sum _ { l = 0 } ^ { \infty } ( \gamma \lambda ) ^ { l } \delta _ { t + l } ^ { V } } } \\ { { \displaystyle \delta _ { t + l } ^ { V } = r _ { t + l } + \gamma V ( s _ { t + l + 1 } ) - V ( s _ { t + l } ) . } } \\ { { \displaystyle \hat { A } _ { t } ^ { ( k ) } : = \sum _ { l = 0 } ^ { k - 1 } \gamma ^ { l } \delta _ { t + l } ^ { V } = - V ( s _ { t } ) + r _ { t } + \gamma r _ { t + 1 } + \cdot \cdot \cdot + \gamma ^ { k - 1 } r _ { t + k - 1 } + \gamma ^ { k } V ( s _ { t + k } ) } } \end{array}
69
+ $$
70
+
71
+ The parameter $\lambda$ meets $0 \leq \lambda \leq 1$ , which controls the trade-off between bias and variance. All methods in this paper utilize $\hat { A } _ { t } ^ { G A E ( \gamma , \lambda ) }$ to estimate the advantage.
72
+
73
+ # 2.3 TRUST REGION POLICY OPTIMIZATION
74
+
75
+ Schulman et al. (2015) propose TRPO to update the policy monotonically. In particular, its mathematical form is
76
+
77
+ $$
78
+ \begin{array} { r l } { \underset { \theta } { \operatorname* { m a x } } } & { \mathbb { E } _ { t } [ \frac { \pi _ { \theta } \left( a _ { t } \vert s _ { t } \right) } { \pi _ { \theta _ { o l d } } \left( a _ { t } \vert s _ { t } \right) } \hat { A } _ { t } ] - C \mathbb { E } _ { t } [ K L [ \pi _ { \theta _ { o l d } } ( \cdot \vert s _ { t } ) , \pi _ { \theta } ( \cdot \vert s _ { t } ) ] ] } \\ & { \epsilon = \underset { s } { \operatorname* { m a x } } E _ { a \sim \pi _ { \theta } \left( a \vert s \right) } [ A _ { \pi _ { \theta _ { o l d } } } ( s , a ) ] ) } \end{array}
79
+ $$
80
+
81
+ where $C$ is the penalty coefficient, $\begin{array} { r } { C = \frac { 2 \epsilon \gamma } { ( 1 - \gamma ) ^ { 2 } } } \end{array}$ .
82
+
83
+ In practice, the policy update steps would be too small if $C$ is valued as Equation 7. In fact, it’s intractable to calculate $C$ beforehand since it requires traversing all states to reach the maximum. Moreover, inevitable bias and variance will be introduced by estimating the advantages of old policy while training. Instead, a surrogate objective is maximized based on the KLD constraint between the old and new policy, which can be written as below,
84
+
85
+ $$
86
+ \begin{array} { r l } { \underset { \theta } { \operatorname* { m a x } } } & { \mathbb { E } _ { t } [ \frac { \pi _ { \theta } \left( a _ { t } \vert s _ { t } \right) } { \pi _ { \theta _ { o l d } } \left( a _ { t } \vert s _ { t } \right) } \hat { A } _ { t } ] } \\ { s . t . } & { \mathbb { E } _ { t } [ K L [ \pi _ { \theta _ { o l d } } ( \cdot \vert s _ { t } ) , \pi _ { \theta } ( \cdot \vert s _ { t } ) ] ] \leq \delta } \end{array}
87
+ $$
88
+
89
+ where $\delta$ is the KLD upper limitation. In addition, the conjugate gradient algorithm is applied to solve Equation 8 more efficiently. Two major problems have yet to be addressed: one is its complexity even using the conjugate gradient approach, another is compatibility with architectures that involve noise or parameter sharing tricks (Schulman et al., 2017).
90
+
91
+ # 2.4 PROXIMAL POLICY OPTIMIZATION
92
+
93
+ To overcome the shortcomings of TRPO, PPO replaces the original constrained problem with a pessimistic clipped surrogate objective where KL constraint is implicitly imposed. The loss function can be written as
94
+
95
+ $$
96
+ \begin{array} { r l r } & { } & { L ^ { { \cal C } L I P } ( \theta ) = \mathbb { E } _ { t } [ \operatorname* { m i n } ( r _ { t } ( \theta ) \hat { A } _ { t } , c l i p ( r _ { t } ( \theta ) , 1 - \epsilon , 1 + \epsilon ) \hat { A } _ { t } ) ] } \\ & { } & { r _ { t } ( \theta ) = \frac { \pi _ { \theta } \left( a _ { t } | s _ { t } \right) } { \pi _ { \theta _ { o l d } } \left( a _ { t } | s _ { t } \right) } } \end{array}
97
+ $$
98
+
99
+ where $\epsilon$ is a hyper-parameter to control the clipping ratio. Except for the clipped PPO version, KL penalty versions including fixed and adaptive KLD. Besides, their simulation results convince that clipped PPO performs best with an obvious margin across various domains.
100
+
101
+ # 3 POLICY OPTIMIZATION WITH PENALIZED POINT PROBABILITY DISTANCE
102
+
103
+ Before diving into the details of POP3D, we review some drawbacks of several methods, which partly motivate us.
104
+
105
+ # 3.1 DISADVANTAGES OF KULLBACK-LEIBLER DIVERGENCE
106
+
107
+ TRPO (Schulman et al., 2015) induced the following inequality1,
108
+
109
+ $$
110
+ \begin{array} { c } { { \eta ( \pi _ { \theta } ) \leq L _ { \pi _ { \theta _ { o l d } } } ( \pi _ { \theta } ) + \displaystyle \frac { 2 \epsilon \gamma } { ( 1 - \gamma ) ^ { 2 } } \alpha ^ { 2 } } } \\ { { \alpha = D _ { T V } ^ { \operatorname* { m a x } } ( \pi _ { \theta _ { o l d } } , \pi _ { \theta } ) } } \\ { { D _ { T V } ^ { \operatorname* { m a x } } ( \pi _ { \theta _ { o l d } } , \pi _ { \theta } ) = \displaystyle \operatorname* { m a x } _ { s } D _ { T V } \bigl ( \pi _ { \theta _ { o l d } } | | \pi _ { \theta } \bigr ) } } \end{array}
111
+ $$
112
+
113
+ TRPO replaces the square of total variation divergence $D _ { T V } ^ { m a x } ( \pi _ { \theta _ { o l d } } , \pi _ { \theta } )$ by $D _ { K L } ^ { \operatorname * { m a x } } ( \pi _ { \theta _ { o l d } } , \pi _ { \theta } ) =$ $\operatorname* { m a x } _ { s } D _ { K L } ( \pi _ { \theta _ { o l d } } | | \pi _ { \theta } )$ .
114
+
115
+ Given a discrete distribution $p$ and $q$ , their total variation divergence $D _ { T V } ( p | | q )$ is defined as
116
+
117
+ $$
118
+ D _ { T V } ( p | | q ) : = \frac { 1 } { 2 } \sum _ { i } \left| p _ { i } - q _ { i } \right|
119
+ $$
120
+
121
+ in TRPO (Schulman et al., 2015). Obviously, $D _ { T V }$ is symmetric by definition, while KLD is asymmetric. Formally, given state $s$ , KLD of $\pi _ { \theta _ { o l d } } ( \cdot | s )$ for $\pi _ { \boldsymbol { \theta } } ( \cdot | s )$ can be written as
122
+
123
+ $$
124
+ D _ { K L } ( \pi _ { \theta _ { o l d } } ( \cdot | s ) | | \pi _ { \theta } ( \cdot | s ) ) : = \sum _ { a } \pi _ { \theta _ { o l d } } ( a | s ) \ln \frac { \pi _ { \theta _ { o l d } } ( a | s ) } { \pi _ { \theta } ( a | s ) } .
125
+ $$
126
+
127
+ Similarly, KLD in the continuous domain can be defined simply by replacing summation with integration. The consequence of KLD’s asymmetry leads to a non-negligible difference of whether choose $D _ { K L } ( \pi _ { \theta _ { o l d } } | | \pi _ { \theta } )$ or $D _ { K L } ( \pi _ { \theta } | | \pi _ { \theta _ { o l d } } \rangle$ . Sometimes, those two choices result in quite different solutions. Robert compared the forward and reverse KL on a distribution, one solution matches only one of the modes, and another covers both modes (Murphy, 2012). Therefore, KLD is not an ideal bound or approximation for the expected discounted cost.
128
+
129
+ # 3.2 DISCUSSION ABOUT PESSIMISTIC PROXIMAL POLICY
130
+
131
+ In fact, PPO is called pessimistic proximal policy optimization2 in the meaning of its objective construction style. Without loss of generality, supposing $A _ { t } > 0$ for given state $s _ { t }$ and action $a _ { t }$ , and the optimal choice is $a _ { t } ^ { \star }$ . When $a _ { t } = a _ { t } ^ { \star }$ , a good update policy is to increase the probability of action to a relatively high value $a _ { t } ^ { \star }$ by adjusting $\theta$ . However, the clipped item $c l i p ( r _ { t } ( \theta ) , 1 - \epsilon , 1 + \epsilon ) \hat { A } _ { t }$ will fully contribute to the loss function by the minimum operation, which ignores further reward by zero gradients even though it’s the optimal action. Other situation with $A _ { t } < 0$ can be analyzed in the same manner.
132
+
133
+ However, if the pessimistic limitation is removed, PPO’s performance decreases dramatically (Schulman et al., 2017), which is again confirmed by our preliminary experiments. In a word, the pessimistic mechanism plays a very critical role for PPO in that it has a relatively weak preference for a good action decision at a given state, which in turn affects its learning efficiency.
134
+
135
+ # 3.3 RESTRICTED SOLUTION MANIFOLD FOR EXACT DISTRIBUTION MATCHING
136
+
137
+ To be simple, we don’t take the model identifiability issues along with deep neural network into account here because they don’t affect the following discussion much (LeCun et al., 2015). Suppose $\pi _ { \theta \star }$ is the optimal solution for a given environment, in most cases, more than one parameter set for $\theta$ can generate the ideal policy, especially when $\pi _ { \theta \star }$ is learned by a deep neural network. In other words, the relationship between $\theta$ and $\pi _ { \theta \star }$ is many to one. On the other hand, when agents interact with the environment using policy represented by neural networks, they prefer to takes the action with the highest probability. Although some strategies of enhancing exploration are applied, they don’t affect the policy much in the meaning of expectation.
138
+
139
+ RL methods can help agents learn useful policies after fully interacting with the environment. Take Atari-Pong game for example, when an agent sees a Pong ball coming close to the right (state $s _ { 1 }$ ), its optimal policy is moving the racket to the right position (for example, the "RIGHT" action) with a distribution $p _ { \theta _ { 1 } } ^ { \bar { s _ { 1 } } } = [ 0 . 0 5 , \mathbf { \bar { 0 } } . 0 5 , 0 . 1 , 0 . 7 , 0 . 0 5 , 0 . 0 5 ] ^ { 3 }$ . The probability of selecting "RIGHT" is a relatively high value such as 0.7. It’s almost impossible to push it to be 1.0 exactly since it’s produced by a softmax operation on several discrete actions. In fact, we hardly obtain the optimal solution accurately. Instead, our goal is to find a good enough policy. In this case, the policy of pushing $p ( { \mathrm { R I G H T } } | s _ { 1 } )$ above a threshold is sufficient to be a good one. In other words, paying attention to the most critical actions is sufficient, and we don’t care much the probability value of the other non-critical actions. For example, a good policy at $s _ { 1 }$ is $[ ? , ? , \geq 0 . 7$ , ?,?,?]. Note that $\pi _ { \boldsymbol { \theta } } ( a | \boldsymbol { s } )$ is represented by a neural network parameterized using $\theta$ and a good policy for the whole game means that the network can perform well across the whole state space. Focusing on those critical actions at each state4 and ignoring non-critical ones can help the network learn better and more easily.
140
+
141
+ Using a penalty such as KLD cannot utilize this good property, because it involves all of the actions’ probabilities. Moreover, it doesn’t stop penalizing unless two distributions become exactly indifferent or the advantage item is large enough to compensate for the KLD cost. Therefore, even if $\theta$ outputs hat two $\theta _ { o l d }$ the same meters for obaband ty for th, where s. Su and $\theta _ { 1 } \colon \theta _ { 2 }$ $\theta _ { 3 }$ $\mathcal { P } _ { \theta _ { 2 } } ^ { s _ { 1 } - } = [ 0 . 0 1 , 0 . 1 5 , 0 . 0 5 , 0 . 7 , 0 . 0 1 , 0 . 0 8 ]$ $p _ { \theta _ { 3 } } ^ { s _ { 1 } } =$ [0.01, 0.01, 0.01, 0.7, 0.26, 0.01]. When the agent already chooses RIGHT at $S _ { 1 }$ , the loss item from a good penalized distance should be small. However, $D _ { K L } ( \pi _ { \theta _ { 1 } } ( \cdot | s _ { 1 } ) | | \pi _ { \theta _ { 2 } } ( \cdot | s _ { 1 } ) ) { = } 0 . 1 5$ and $D _ { K L } \big ( \pi _ { \theta _ { 1 } } ( \cdot | s _ { 1 } ) \vert \vert \pi _ { \theta _ { 3 } } ( \cdot | s _ { 1 } ) \big ) { = } 0 . 3 9$ . However, it’s not necessary to require the distribution of other actions $( \mathbf { \hat { \Pi } } \mathbf { \tilde { N O O P } } ^ { \prime }$ , ‘FIRE’, ‘LEFT’, ‘RIGHTFIRE’, ‘LEFTFIRE’) of $p _ { \theta _ { 2 } } ^ { s _ { 1 } }$ near to $p _ { \theta _ { 1 } } ^ { s _ { 1 } }$ . Instead, it’s better to relax this requirement to enlarge the freedom degree of the network and focus on learning important actions. Doing this brings another advantage, the agent can explore more for non critical actions. From the perspective of the manifold, optimal parameters constitute a solution manifold. The KLD penalty will act until $\theta$ exactly locates in the solution if possible, akin to mapping a point onto a curve. Instead, if the agent concentrates only on critical actions like a human does, it’s much easier to approach the manifold in a higher dimension. This is comparable to expanding the solution manifold by at least one dimension, e.g. from curves to surfaces or from surfaces to spheres.
142
+
143
+ # 3.4 EXPLORATION
144
+
145
+ One shared highlight in reinforcement learning is the balance between exploitation and exploration. For a policy-gradient algorithm, entropy is added in the total loss to encourage exploration in most cases. When included in the loss function, KLD penalizes the old and new policy probability mismatch for all possible actions as Equation 12 given a state $s$ . This strict punishment for every action’s probability mismatch, which discourages exploration.
146
+
147
+ # 3.5 POINT PROBABILITY DISTANCE
148
+
149
+ To overcome the above-mentioned shortcomings, we propose a surrogate objective with the point probability distance penalty, which is symmetric and more optimistic than PPO. In the discrete domain, when the agent takes action $a$ , the point probability distance between $\pi _ { \theta _ { o l d } } ( \cdot | s )$ and $\pi _ { \boldsymbol { \theta } } ( \cdot | \boldsymbol { s } )$ is defined by
150
+
151
+ $$
152
+ D _ { p p } ^ { a } ( \pi _ { \theta _ { o l d } } ( \cdot | s ) , \pi _ { \theta } ( \cdot | s ) ) = ( \pi _ { \theta _ { o l d } } ( a | s ) - \pi _ { \theta } ( a | s ) ) ^ { 2 } .
153
+ $$
154
+
155
+ Attention should be paid to the penalty definition item, the distance is measured by the point probability, which emphasizes its mismatch for the sampled actions for a state. Unless it would lead to confusion, we omit $a$ for simplicity in the following sections. Undoubtedly, $D _ { p p }$ is symmetric by definition. Furthermore, it can be proved that $D _ { p p }$ is indeed a lower bound for the total variance divergence $D _ { T V }$ . As a special case, it can be easily proved that for binary distribution, $D _ { T V } ^ { 2 } ( p | | q ) =$ $D _ { p p } ( p | | q )$ .
156
+
157
+ Theorem 3.1. For two discrete probability distributions $p$ and $q$ with $K$ values, then $D _ { T V } ^ { 2 } ( p | | q ) \geq$ $D _ { p p } ^ { a } ( p | | q )$ holds for any action a and $\mathbb { E } _ { a } D _ { p p } ^ { a } ( p | | q )$ is a lower bound for $D _ { T V } ^ { 2 } ( p | | q )$ .
158
+
159
+ Proof. Let $p _ { l } = \alpha , q _ { l } = \beta$ for the $l$ -th action $a$ , and suppose $a \geq b$ without loss of generalization. So,
160
+
161
+ $$
162
+ \begin{array} { l c l } { \displaystyle D _ { T V } ^ { 2 } ( p | | q ) } & { = } & { \displaystyle ( \frac { 1 } { 2 } \sum _ { i = 1 } ^ { K } | p _ { i } - q _ { i } | ) ^ { 2 } = ( \frac { 1 } { 2 } \sum _ { i = 1 , i \neq l } ^ { K } | p _ { i } - q _ { i } | + \frac { 1 } { 2 } | p _ { l } - q _ { l } | ) ^ { 2 } } \\ & { \ge } & { \displaystyle ( \frac { 1 } { 2 } | \sum _ { i = 1 , i \neq l } ^ { K } p _ { i } - q _ { i } | + \frac { 1 } { 2 } ( \alpha - \beta ) ) ^ { 2 } = ( \frac { 1 } { 2 } | 1 - \alpha - ( 1 - \beta ) | + \frac { 1 } { 2 } ( \alpha - \beta ) ) ^ { 2 } } \\ & { = } & { \displaystyle ( \frac { 1 } { 2 } ( \alpha - \beta ) + \frac { 1 } { 2 } ( \alpha - \beta ) ) ^ { 2 } = D _ { p p } ^ { \alpha } ( p | | q ) } \\ { \mathbb { E } _ { a } D _ { p p } ^ { a } ( p | | q ) } & { = } & { \displaystyle \sum _ { a } p ( a ) D _ { p p } ^ { a } ( p | | q ) \le \sum _ { a } p ( a ) D _ { T V } ^ { 2 } ( p | | q ) = D _ { T V } ^ { 2 } ( p | | q ) } \end{array}
163
+ $$
164
+
165
+ Since $0 \leq \pi _ { \theta } ( a | s ) \leq 1$ holds for discrete action space, $D _ { p p }$ has a lower and upper boundary: $0 \leq D _ { p p } \leq 1$ . Moreover, $D _ { p p }$ is less sensitive to action space dimension than KLD, which has a similar effect as PPO’s clipped ratio to increase robustness and enhance stability. Equation 13 stays unchanged for the continuous domain, and the only difference is $\pi _ { \boldsymbol { \theta } } ( a | \boldsymbol { s } )$ represents point probability density instead of probability.
166
+
167
+ # 3.6 POP3D
168
+
169
+ After we have defined the point probability distance, we use a new surrogate objective $f _ { \theta }$ for POP3D, which can be written as
170
+
171
+ $$
172
+ \operatorname* { m a x } _ { \theta } \quad \mathbb { E } _ { t } [ \frac { \pi _ { \theta } ( a _ { t } | s _ { t } ) } { \pi _ { \theta _ { o l d } } ( a _ { t } | s _ { t } ) } \hat { A } _ { t } - \beta D _ { p p } ^ { a _ { t } } ( \pi _ { \theta _ { o l d } } ( \cdot | s _ { t } ) , \pi _ { \theta } ( \cdot | s _ { t } ) ) ] ,
173
+ $$
174
+
175
+ where $\beta$ is the penalized coefficient. These combined advantages lead to considerable performance improvement, which escapes from the dilemma of choosing preferable penalty coefficient. Besides, we use generalized advantage estimates to calculate $\hat { A } _ { t }$ . Algorithm 1 shows the complete iteration process of POP3D. Moreover, it possesses the same computing cost and data efficiency as PPO.
176
+
177
+ # Algorithm 1 POP3D
178
+
179
+ 1: Input: max iterations $L$ , actors $N$ , epochs $K$
180
+ 2: for iteration $= 1$ to $L$ do
181
+ 3: for actor $= 1$ to $N$ do
182
+ 4: Run policy $\pi _ { \theta _ { o l d } }$ for $T$ time steps
183
+ 5: Compute advantage estimations $\hat { A } _ { 1 } , . . . , \hat { A } _ { T }$
184
+ 6: end for
185
+ 7: for epoch $, = 1$ to $K$ do
186
+ 8: Optimized loss objective $f ( \theta )$ w.r.t $\theta$ with mini-batch size $M \leq N T$ , then update $\theta _ { o l d } \theta$ .
187
+ 9: end for
188
+ 10: end for
189
+
190
+ # 3.7 WORKING MECHANISM OF POP3D
191
+
192
+ As for the toy example in Section 3.3, Therefore, it can help the agent to f $D _ { p p } ^ { R I G H T } ( \pi _ { \theta _ { 1 } } ( \cdot | s ) | | \pi _ { \theta _ { 2 } } ( \cdot | s ) = D _ { p p } ^ { R I G H T } ( \pi _ { \theta _ { 1 } } ( \cdot | s ) | | \pi _ { \theta _ { 3 } } ( \cdot | s ) = 0 .$ $\theta$ $\theta _ { o l d }$ Equation 14, the gradient $f ( \theta )$ w.r.t. $\theta$ can be written as
193
+
194
+ $$
195
+ \begin{array} { l l } { \nabla _ { \theta } f ( \theta ) = \frac { \nabla _ { \theta } \pi _ { \theta } \left( a _ { t } | s _ { t } \right) } { \pi _ { \theta _ { o l d } } \left( a _ { t } | s _ { t } \right) } \hat { A } _ { t } - 2 \beta [ \pi _ { \theta } ( a _ { t } | s _ { t } ) - \pi _ { \theta _ { o l d } } ( a _ { t } | s _ { t } ) ] \nabla _ { \theta } \pi _ { \theta } ( a _ { t } | s _ { t } ) } \\ { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \hat { A } _ { t } } \\ { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \pi _ { \theta } \pi _ { \theta } ( a _ { t } | s _ { t } ) [ \frac { \hat { A } _ { t } } { \pi _ { \theta _ { o l d } } \left( a _ { t } | s _ { t } \right) } - 2 \beta ( \pi _ { \theta } ( a _ { t } | s _ { t } ) - \pi _ { \theta _ { o l d } } ( a _ { t } | s _ { t } ) ) ] } \\ { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \hat { A } _ { t } } \\ { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \end{array}
196
+ $$
197
+
198
+ where $\delta ( \boldsymbol { a } _ { t } | \boldsymbol { s } _ { t } ) : = \pi _ { \boldsymbol { \theta } } ( \boldsymbol { a } _ { t } | \boldsymbol { s } _ { t } ) - \pi _ { \boldsymbol { \theta } _ { o l d } } ( \boldsymbol { a } _ { t } | \boldsymbol { s } _ { t } )$ . Suppose the agent selects $a _ { t }$ at $s _ { t }$ using $\pi _ { \theta _ { o l d } }$ and obtains a positive advantage $\hat { A } _ { t }$ , if $\pi _ { \boldsymbol { \theta } } \big ( a _ { t } | \boldsymbol { s } _ { t } \big )$ is larger than $\pi _ { \boldsymbol { \theta } } ( a _ { t } | \boldsymbol { s } _ { t } )$ , then $2 \beta \delta ( a _ { t } | s _ { t } )$ will play a damping role to avoid too greedy preference for $a _ { t }$ (i.e. too large probability), which in turn leaves more space for other actions to be explored. Other cases such as negative $\hat { A } _ { t }$ can be analyzed similarly. The hyper-parameter $\beta$ controls the damping force.
199
+
200
+ In the early stage of learning, $\pi _ { \theta _ { o l d } } ( a _ { t } | s _ { t } )$ is near $1 / K$ (taking $K$ discrete spaces for example) and the magnitude of $\hat { A } _ { t }$ is large, while the damping force is a bit weak. Therefore, the agent learns fast. Then $\beta$ shows a relative stronger force to avoid overshooting for action selection and encourage more exploration. As for the final stage, the policy changes slowly because the learning rate is low, where $\delta ( \boldsymbol { a } _ { t } | \boldsymbol { s } _ { t } )$ is small and therefore it converges.
201
+
202
+ # 3.8 RELATIONSHIP WITH PPO
203
+
204
+ To conclude this section, we take some time to see why PPO works by taking the above viewpoints into account. When we pour more attention to Equation 9, the ratio $r _ { t } ( \boldsymbol { \dot { \theta } } )$ only involves the probability for given action $a$ , which is chosen by policy $\pi$ . In other words, all other actions’ probabilities except $a$ are not activated, which no longer contribute to back-propagation and allow probability mismatch, which encourage exploration. This procedure behaves similarly to POP3D, which helps the network to learn more easily. Above all, POP3D is designed to conform with the regulations for overcoming above mentioned problems, and in the next section experiments from commonly used benchmarks will evaluate its performance.
205
+
206
+ # 4 EXPERIMENTS
207
+
208
+ # 4.1 CONTROLLED EXPERIMENTS SETUP
209
+
210
+ OpenAI Gym is a well-known simulation environment to test and evaluate various reinforcement algorithms, which is composed of both discrete (Atari) and continuous (Mujoco) domains (Brockman et al., 2016). Most recent deep reinforcement learning methods such as DQN variants (Van Hasselt et al., 2016; Wang et al., 2016; Schaul et al., 2015; Bellemare et al., 2017; Hessel et al., 2018), A3C, ACKTR, PPO are evaluated using only one set of hyper-parameters5. Therefore, we evaluate POP3D’s performance on 49 Atari games(v4, discrete action space ) and 7 Mujoco (v2, continuous).
211
+
212
+ Since PPO is a distinguished RL algorithm which defeats various methods such as A3C, A2C ACKTR, we focus on a detailed quantitative comparison with fine-tuned PPO. And we don’t consider large scale distributed algorithms Apex-DQN (Horgan et al., 2018) and IMPALA (Espeholt et al., 2018), because we concentrate on comparable and fair evaluation, while the latter is designed to apply with large scale parallelism. Nevertheless, some orthogonal improvements from those methods have the potentials to improve our method further. Furthermore, we include TRPO to acts as a baseline method. Engstrom et al. (2020) carefully study the underlying factor that helps PPO outperform TPRO. To avoid unfair comparisons, we carefully control the settings. In addition, quantitative comparisons between KLD and point probability penalty helps to convince the critical role of the latter, where the former strategy is named fixed KLD in Schulman et al. (2017) and can act as another good baseline in this context, named by BASELINE below.
213
+
214
+ In particular, we retrained one agent for each game with fine-tuned hyper-parameters6. To avoid the problems of reproduction about reinforcement algorithms mentioned in Henderson et al. (2018), we take the following measures:
215
+
216
+ • Use the same training steps and make use of the same amount of game frames(40M for Atari game and 10M for Mujoco).
217
+ • Use the same neural network structures, which is the CNN model with one action head and one value head for the Atari game, and a fully-connected model with one value head and one action head which produces the mean and standard deviation of diagonal Gaussian distribution as PPO.
218
+ • Initialize parameters using the same strategy as PPO.
219
+ • Keep Gym wrappers from Deepmind such as reward clipping and frame stacking unchanged for Atari domain, and enable 30 no-ops at the beginning of each episode.
220
+ • Use Adam optimizer (Kingma & Ba, 2014) and decrease $\alpha$ linearly from 1 to 0 for Atari domain as PPO.
221
+
222
+ To facilitate further comparisons with other approaches, we release the seeds and detailed results7(across the entire training process for different trials). In addition, we randomly select three seeds from $\{ 0 , 1 0 , 1 0 0 , 1 0 0 0 , 1 0 0 0 0 \}$ for two domains, {10,100,1000} for Atari and {0,10,100} for Mujoco in order to decrease unfavorable subjective bias stated in Henderson et al. (2018).
223
+
224
+ # 4.2 EVALUATION METRICS
225
+
226
+ PPO utilizes two score metrics for evaluating agents’ performance using various RL algorithms. One is the mean score of the last 100 episodes $S c o r e _ { 1 0 0 }$ , which measures how high a strategy can hit eventually. Another is the average score across all episodes $S c o r e _ { a l l }$ , which evaluates how fast an agent learns. In this paper, we conform to this routine and calculate individual metric by averaging three seeds in the same way.
227
+
228
+ # 4.3 DISCRETE DOMAIN COMPARISONS
229
+
230
+ Hyper-parameters We search hyper-parameter four times for the penalty coefficient $\beta$ based on four Atari games while keeping other hyper-parameters unchanged as PPO and fix $\beta = 5 . 0$ to train all Atari games. For BASELINE, we also search hyper-parameter four times on penalty coefficient $\beta$ and choose $\beta = 1 0 . 0$ . To save space, detailed hyper-parameter setting can be found in Table 6 and 7.
231
+
232
+ This process is not beneficial for POP3D owing to missing optimization for all hyper-parameters. There are two reasons to make this choice. On the one hand, it’s the simplest way to make a relatively fair comparison group such as keeping the same iterations and epochs within one loop to our knowledge. On the other hand, this process imposes low search requirements for time and resources. That’s to say, we can draw a conclusion that our method is at least competitive to PPO if it performs better on benchmarks.
233
+
234
+ Comparisons The final score of each game is averaged by three different seeds and the highest is in bold. As Table 1 shows, POP3D outperforms 32 across 49 Atari games given the final score, followed by PPO with 11, BASELINE with 5, and TRPO with 1. Interestingly, for games that POP3D score highest, BASELINE score worse than PPO more often than the other way round, which means that POP3D is not just an approximate version of BASELINE.
235
+
236
+ For another metric, POP3D wins 20 out of 49 Atari games which matches PPO with 18, followed by BASELINE with 6, and last ranked by TRPO with 5. If we measure the stability of an algorithm by the score variance of different trials, POP3D scores high with good stability across various seeds. And PPO behaves worse in Game Kangaroo and UpNDown. Interestingly, BASELINE shows a large variance for different seeds for several games such as BattleZone, Freeway, Pitfall, and Seaquest. POP3D reveals its better capacity to score high and similar fast learning ability in this domain. The detailed metric for each game is listed in Table 3 and 4.
237
+
238
+ # 4.4 CONTINUOUS DOMAIN COMPARISONS
239
+
240
+ Hyper-parameters For PPO, we use the same hyperparameter configuration as Schulman et al. (2017). Regarding POP3D, we search on two games three times and select 5.0 as the penalty coefficient. More details about hyper-parameters for PPO and POP3D are listed in Table 8. Unlike the Atari domain, we utilize the constant learning rate strategy as Schulman et al. (2017) in the continuous domain instead of the linear decrease strategy.
241
+
242
+ Comparison Results The scores are also averaged on three trials and summarized in Table 1. POP3D occupies 6 out of 7 games on $S c o r e _ { 1 0 0 }$ . Evaluation metrics of both across different games are illustrated in Table 2
243
+
244
+ Table 1: Top: The number of games "won" by each algorithm for Atari games. Bottom: The number of games won by each algorithm for Mujoco games. Each experiment is averaged across three seeds.
245
+
246
+ <table><tr><td>Metric</td><td colspan="4">PPO POP3D BASELINE TRPO</td></tr><tr><td>Score100 Scoreall</td><td>11 18</td><td>32 20</td><td>5 6</td><td>1 5</td></tr><tr><td></td><td>Metric</td><td>PPO POP3D</td><td></td><td></td></tr><tr><td></td><td>Score100</td><td>1</td><td>6</td><td></td></tr><tr><td></td><td>Scoreall</td><td>4</td><td>3</td><td></td></tr></table>
247
+
248
+ and 5. In summary, both metrics indicate that POP3D is competitive to PPO in the continuous domain.
249
+
250
+ # 5 CONCLUSION
251
+
252
+ In this paper, we introduce a new reinforcement learning algorithm called POP3D (Policy Optimization with Penalized Point Probability Distance), which acts as a TRPO variant like PPO. Compared with KLD that is an upper bound for the square of total variance divergence between two distributions, the penalized point probability distance is a symmetric lower bound. Besides, it equivalently expands the optimal solution manifold effectively while encouraging exploration, which is a similar mechanism implicitly possessed by PPO. The proposed method not only possesses several critical improvements from PPO but outperforms with a clear margin on 49 Atari games from the respective of final scores and meets PPO’s match as for fast learning ability.
253
+
254
+ Table 2: Mean final scores (last 100 episodes) of PPO, POP3D on Mujoco games after 10M frames. The results are averaged by three trials.
255
+
256
+ <table><tr><td>Game</td><td>PPO</td><td>POP3D</td></tr><tr><td>HalfCheetah</td><td>2726.03</td><td>3184.54</td></tr><tr><td>Hopper</td><td>2027.21</td><td>1452.09</td></tr><tr><td>InvertedDblPendulum 4455.03</td><td></td><td>4907.64</td></tr><tr><td>InvertedPendulum</td><td>544.02</td><td>741.94</td></tr><tr><td>Reacher</td><td>-5.00</td><td>-4.29</td></tr><tr><td>Swimmer</td><td>111.88</td><td>112.08</td></tr><tr><td>Walker2d</td><td>1112.25</td><td>3966.01</td></tr></table>
257
+
258
+ More interestingly, it not only suffers less from the penalty item setting headache along with TRPO, where is arduous to select one fixed value for various environments but outperforms fixed KLD baseline from PPO. In summary, POP3D is highly competitive and an alternative to PPO.
259
+
260
+ # REFERENCES
261
+
262
+ Marc G Bellemare, Will Dabney, and Rémi Munos. A distributional perspective on reinforcement learning. arXiv preprint arXiv:1707.06887, 2017.
263
+
264
+ Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym. arXiv preprint arXiv:1606.01540, 2016.
265
+
266
+ Logan Engstrom, Andrew Ilyas, Shibani Santurkar, Dimitris Tsipras, Firdaus Janoos, Larry Rudolph, and Aleksander Madry. Implementation matters in deep rl: A case study on ppo and trpo. In International Conference on Learning Representations, 2020. URL https://openreview. net/forum?id ${ . } = { }$ r1etN1rtPB.
267
+
268
+ Lasse Espeholt, Hubert Soyer, Remi Munos, Karen Simonyan, Volodymir Mnih, Tom Ward, Yotam Doron, Vlad Firoiu, Tim Harley, Iain Dunning, et al. Impala: Scalable distributed deep-rl with importance weighted actor-learner architectures. arXiv preprint arXiv:1802.01561, 2018.
269
+
270
+ Tuomas Haarnoja, Aurick Zhou, Pieter Abbeel, and Sergey Levine. Soft actor-critic: Off-policy maximum entropy deep reinforcement learning with a stochastic actor. In International Conference on Machine Learning, pp. 1861–1870, 2018.
271
+
272
+ Peter Henderson, Riashat Islam, Philip Bachman, Joelle Pineau, Doina Precup, and David Meger. Deep reinforcement learning that matters. In Thirty-Second AAAI Conference on Artificial Intelligence, 2018.
273
+
274
+ Matteo Hessel, Joseph Modayil, Hado Van Hasselt, Tom Schaul, Georg Ostrovski, Will Dabney, Dan Horgan, Bilal Piot, Mohammad Azar, and David Silver. Rainbow: Combining improvements in deep reinforcement learning. In Thirty-Second AAAI Conference on Artificial Intelligence, 2018.
275
+
276
+ Dan Horgan, John Quan, David Budden, Gabriel Barth-Maron, Matteo Hessel, Hado van Hasselt, and David Silver. Distributed prioritized experience replay. In International Conference on Learning Representations, 2018.
277
+
278
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
279
+
280
+ Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep learning. nature, 521(7553):436–444, 2015.
281
+
282
+ Timothy P Lillicrap, Jonathan J Hunt, Alexander Pritzel, Nicolas Heess, Tom Erez, Yuval Tassa, David Silver, and Daan Wierstra. Continuous control with deep reinforcement learning. arXiv preprint arXiv:1509.02971, 2015.
283
+
284
+ 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.
285
+
286
+ 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.
287
+
288
+ Kevin P Murphy. Machine learning: a probabilistic perspective. MIT press, 2012.
289
+
290
+ Hieu Pham, Melody Guan, Barret Zoph, Quoc Le, and Jeff Dean. Efficient neural architecture search via parameters sharing. In International Conference on Machine Learning, pp. 4095–4104, 2018.
291
+
292
+ Tom Schaul, John Quan, Ioannis Antonoglou, and David Silver. Prioritized experience replay. arXiv preprint arXiv:1511.05952, 2015.
293
+
294
+ John Schulman, Sergey Levine, Pieter Abbeel, Michael Jordan, and Philipp Moritz. Trust region policy optimization. In International conference on machine learning, pp. 1889–1897, 2015.
295
+
296
+ John Schulman, Philipp Moritz, Sergey Levine, Michael Jordan, and Pieter Abbeel. High-dimensional continuous control using generalized advantage estimation. In ICLR, 2016.
297
+
298
+ John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
299
+
300
+ David Silver, Julian Schrittwieser, Karen Simonyan, Ioannis Antonoglou, Aja Huang, Arthur Guez, Thomas Hubert, Lucas Baker, Matthew Lai, Adrian Bolton, et al. Mastering the game of go without human knowledge. nature, 550(7676):354–359, 2017.
301
+
302
+ Richard S Sutton and Andrew G Barto. Reinforcement learning: An introduction. MIT press, 2018.
303
+
304
+ Mingxing Tan, Bo Chen, Ruoming Pang, Vijay Vasudevan, Mark Sandler, Andrew Howard, and Quoc V Le. Mnasnet: Platform-aware neural architecture search for mobile. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2820–2828, 2019.
305
+
306
+ Hado Van Hasselt, Arthur Guez, and David Silver. Deep reinforcement learning with double qlearning. In Thirtieth AAAI conference on artificial intelligence, 2016.
307
+
308
+ Ziyu Wang, Tom Schaul, Matteo Hessel, Hado Hasselt, Marc Lanctot, and Nando Freitas. Dueling network architectures for deep reinforcement learning. In International conference on machine learning, pp. 1995–2003, 2016.
309
+
310
+ Yuhuai Wu, Elman Mansimov, Roger B Grosse, Shun Liao, and Jimmy Ba. Scalable trust-region method for deep reinforcement learning using kronecker-factored approximation. In Advances in neural information processing systems, pp. 5279–5288, 2017.
311
+
312
+ # A SCORE TABLES AND CURVES
313
+
314
+ Mean scores of various methods for Atari domain are listed in Table 3 and 4.
315
+
316
+ Table 3: Mean final scores (last 100 episodes) of PPO, POP3D, BASELINE and TRPO on Atari games after 40M frames. The results are averaged on three trials.
317
+
318
+ <table><tr><td>game</td><td>POP3D</td><td>PPO</td><td>BASELINE</td><td>TPRO</td></tr><tr><td>Alien</td><td>1510.80</td><td>1431.17</td><td>1311.23</td><td>1110.40</td></tr><tr><td>Amidar</td><td>729.15</td><td>790.75</td><td>655.10</td><td>200.56</td></tr><tr><td>Assault</td><td>5400.13</td><td>4438.82</td><td>1846.75</td><td>1363.46</td></tr><tr><td>Asterix</td><td>4310.67</td><td>3483.17</td><td>3657.67</td><td>2651.33</td></tr><tr><td>Asteroids</td><td>2488.10</td><td>1605.33</td><td>1615.37</td><td>2205.70</td></tr><tr><td>Atlantis</td><td>2193605.67</td><td>2140536.33</td><td>1515993.33</td><td>1419104.67</td></tr><tr><td>BankHeist</td><td>1212.23</td><td>1206.67</td><td>1124.43</td><td>1125.17</td></tr><tr><td>BattleZone</td><td>15466.67</td><td>14766.67</td><td>14690.00</td><td>15123.33</td></tr><tr><td>BeamRider</td><td>4549.00</td><td>2624.19</td><td>6898.09</td><td>5073.75</td></tr><tr><td>Bowling</td><td>38.99</td><td>47.27</td><td>30.48</td><td>31.24</td></tr><tr><td>Boxing</td><td>97.23</td><td>93.70</td><td>65.33</td><td>50.07</td></tr><tr><td>Breakout</td><td>458.41</td><td>281.93</td><td>67.70</td><td>40.65</td></tr><tr><td>Centipede</td><td>3315.44</td><td>3565.18</td><td>3393.93</td><td>3353.14</td></tr><tr><td>Chopper-Command</td><td>6308.33</td><td>4872.67</td><td>2676.00</td><td>2286.67</td></tr><tr><td>CrazyClimber</td><td>120247.33</td><td>105940.00</td><td>98219.67</td><td>87522.33</td></tr><tr><td>DemonAttack</td><td>61147.33</td><td>26740.57</td><td>57476.65</td><td>21525.08</td></tr><tr><td>DoubleDunk</td><td>-7.89</td><td>-11.22</td><td>-8.61</td><td>-10.04</td></tr><tr><td>Enduro</td><td>459.85</td><td>698.46</td><td>518.41</td><td>365.95</td></tr><tr><td>FishingDerby</td><td>28.99</td><td>17.72</td><td>-64.27</td><td>-69.64</td></tr><tr><td>Freeway</td><td>21.21</td><td>21.11</td><td>18.37</td><td>20.89</td></tr><tr><td>Frostbite</td><td>316.87</td><td>280.30</td><td>280.30</td><td>291.77</td></tr><tr><td>Gopher</td><td>6207.00</td><td>1791.00</td><td>940.87</td><td>938.27</td></tr><tr><td>Gravitar</td><td>557.17</td><td>753.50</td><td>449.00</td><td>495.17</td></tr><tr><td>IceHockey</td><td>-4.12</td><td>-4.83</td><td>-3.61</td><td>-4.61</td></tr><tr><td>Jamesbond</td><td>527.17</td><td>488.17</td><td>685.17</td><td>901.67</td></tr><tr><td>Kangaroo</td><td>3891.67</td><td>6845.00</td><td>1850.00</td><td>1214.67</td></tr><tr><td>Krull</td><td>7715.68</td><td>8329.08</td><td>7204.95</td><td>4881.65</td></tr><tr><td>KungFuMaster</td><td>33728.00</td><td>29958.67</td><td>29843.67</td><td>26808.00</td></tr><tr><td>Montezuma-Revenge</td><td>0.00</td><td>10.67</td><td>0.67</td><td>0.00</td></tr><tr><td>MsPacman</td><td>1683.87</td><td>1981.50</td><td>1170.70</td><td>1133.57</td></tr><tr><td>NameThisGame</td><td>6065.63</td><td>5397.47</td><td>5672.60</td><td>5604.10</td></tr><tr><td>Pitfall</td><td>0.00</td><td>-2.32</td><td>-17.26</td><td>-43.60</td></tr><tr><td>Pong</td><td>20.50</td><td>20.80</td><td>20.79</td><td>19.63</td></tr><tr><td>PrivateEye</td><td>79.67</td><td>36.50</td><td>99.67</td><td>99.33</td></tr><tr><td>Qbert</td><td>15396.67</td><td>14556.83</td><td>4114.00</td><td>3781.58</td></tr><tr><td>Riverraid</td><td>8052.23</td><td>7360.40</td><td>7722.00</td><td>6773.67</td></tr><tr><td>RoadRunner</td><td>44679.67</td><td>36289.33</td><td>43626.33</td><td>24061.33</td></tr><tr><td>Robotank</td><td>4.60</td><td>14.15</td><td>24.60</td><td>24.18</td></tr><tr><td>Seaquest</td><td>1807.47</td><td>1470.60</td><td>1501.47</td><td>926.40</td></tr><tr><td>SpaceInvaders</td><td>1216.15</td><td>944.63</td><td>814.53</td><td>634.07</td></tr><tr><td>StarGunner</td><td>48984.00</td><td>33862.00</td><td>47738.00</td><td>33442.67</td></tr><tr><td>Tennis</td><td>-8.32</td><td>-13.74</td><td>-19.13</td><td>-18.40</td></tr><tr><td>TimePilot</td><td>3770.33</td><td>5321.33</td><td>6278.33</td><td>5701.00</td></tr><tr><td>Tutankham</td><td>241.21</td><td>177.58</td><td>135.80</td><td>136.21</td></tr><tr><td>UpNDown</td><td>242701.51</td><td>153160.66</td><td>11815.87</td><td>10949.53</td></tr><tr><td>Venture</td><td>36.33</td><td>0.00</td><td>4.00</td><td>0.00</td></tr><tr><td>VideoPinball</td><td>37780.70</td><td>31577.24</td><td>21438.64</td><td>25095.20</td></tr><tr><td>WizardOfWor</td><td>4704.00</td><td>4886.67</td><td>3533.67</td><td>3103.00</td></tr><tr><td>Zaxxon</td><td>9472.00</td><td>5728.67</td><td>1179.67</td><td>4796.67</td></tr></table>
319
+
320
+ Table 4: All episodes mean scores of PPO, POP3D, BASELINE and TRPO on Atari games after 40M frames. The results are averaged by three trials.
321
+
322
+ <table><tr><td>game</td><td>POP3D</td><td>PPO</td><td>BASELINE</td><td>TRPO</td></tr><tr><td>Alien</td><td>1147.29</td><td>1115.94</td><td>851.13</td><td>841.08</td></tr><tr><td>Amidar</td><td>299.55</td><td>413.46</td><td>295.91</td><td>169.12</td></tr><tr><td>Assault</td><td>2139.15</td><td>2168.93</td><td>1159.50</td><td>971.78</td></tr><tr><td>Asterix</td><td>2004.43</td><td>2102.10</td><td>1884.68</td><td>1342.83</td></tr><tr><td>Asteroids</td><td>1652.48</td><td>1470.46</td><td>1477.71</td><td>1760.73</td></tr><tr><td>Atlantis</td><td>488134.03</td><td>596807.27</td><td>192798.74</td><td>174394.94</td></tr><tr><td>BankHeist</td><td>662.26</td><td>643.94</td><td>859.25</td><td>831.95</td></tr><tr><td>BattleZone</td><td>11131.44</td><td>9387.77</td><td>11674.30</td><td>12918.39</td></tr><tr><td>BeamRider</td><td>1965.27</td><td>1460.59</td><td>3321.25</td><td>2431.63</td></tr><tr><td>Bowling</td><td>37.97</td><td>39.41</td><td>33.90</td><td>30.99</td></tr><tr><td>Boxing</td><td>83.12</td><td>78.61</td><td>27.92</td><td>23.07</td></tr><tr><td>Breakout</td><td>143.60</td><td>124.98</td><td>29.99</td><td>26.56</td></tr><tr><td>Centipede</td><td>3056.81</td><td>3344.63</td><td>3042.48</td><td>3142.22</td></tr><tr><td>Chopper-</td><td></td><td></td><td></td><td></td></tr><tr><td>Command</td><td>3269.47</td><td>3106.14</td><td>1780.38</td><td>1595.82</td></tr><tr><td>CrazyClimber</td><td>97257.52</td><td>90169.60</td><td>69258.31</td><td>63189.78</td></tr><tr><td>DemonAttack</td><td>7611.27</td><td>7180.43</td><td>9814.42</td><td>6204.68</td></tr><tr><td>DoubleDunk</td><td>-13.70</td><td>-15.45</td><td>-15.93</td><td>-14.57</td></tr><tr><td>Enduro</td><td>107.84</td><td>321.20</td><td>92.59</td><td>140.67</td></tr><tr><td>FishingDerby</td><td>-21.00</td><td>-27.51</td><td>-81.90</td><td>-81.97</td></tr><tr><td>Freeway</td><td>17.76</td><td>15.87</td><td>15.93</td><td>17.33</td></tr><tr><td>Frostbite</td><td>276.47</td><td>267.73</td><td>270.42</td><td>270.57</td></tr><tr><td>Gopher</td><td>1556.29</td><td>1196.20</td><td>900.74</td><td>875.93</td></tr><tr><td>Gravitar</td><td>413.20</td><td>509.81</td><td>342.74</td><td>317.86</td></tr><tr><td>IceHockey</td><td>-4.67</td><td>-5.50</td><td>-4.61</td><td>-5.21</td></tr><tr><td>Jamesbond</td><td>358.54</td><td>394.45</td><td>380.91</td><td>519.01</td></tr><tr><td>Kangaroo</td><td>1614.63</td><td>2199.74</td><td>937.98</td><td>566.85</td></tr><tr><td>Krull</td><td>6538.16</td><td>7195.24</td><td>4760.66</td><td>3861.87</td></tr><tr><td>KungFuMaster</td><td>23253.96</td><td>23283.31</td><td>19637.58</td><td>18293.12</td></tr><tr><td>Montezuma- Revenge</td><td>0.14</td><td>0.74</td><td>0.22</td><td>0.12</td></tr><tr><td>MsPacman</td><td>1214.09</td><td>1482.77</td><td>860.63</td><td>864.84</td></tr><tr><td>NameThisGame</td><td>5353.14</td><td>5199.37</td><td>4562.32</td><td>4504.67</td></tr><tr><td>Pitfall</td><td>-2.41</td><td>-5.81</td><td>-31.27</td><td>-33.93</td></tr><tr><td>Pong</td><td>13.24</td><td>12.83</td><td>7.20</td><td>-2.91</td></tr><tr><td>PrivateEye</td><td>87.37</td><td>52.76</td><td>56.70</td><td>98.79</td></tr><tr><td>Qbert</td><td>5852.10</td><td>6744.13</td><td>1760.92</td><td>1679.03</td></tr><tr><td>Riverraid</td><td>5260.89</td><td>5487.17</td><td>5220.64</td><td>4549.22</td></tr><tr><td>RoadRunner</td><td>25456.31</td><td>24688.07</td><td>20385.91</td><td>16269.40</td></tr><tr><td>Robotank</td><td>3.08</td><td>8.65</td><td>13.89</td><td>14.57</td></tr><tr><td></td><td>1487.84</td><td></td><td></td><td>848.47</td></tr><tr><td>Seaquest</td><td></td><td>1120.15</td><td>1112.51</td><td>483.48</td></tr><tr><td>SpaceInvaders StarGunner</td><td>693.26</td><td>632.17</td><td>552.50</td><td>13341.23</td></tr><tr><td></td><td>14734.11</td><td>13643.80</td><td>16288.35</td><td>-21.04</td></tr><tr><td>Tennis</td><td>-19.86</td><td>-21.80</td><td>-21.84</td><td></td></tr><tr><td>TimePilot Tutankham</td><td>3396.61</td><td>4410.87</td><td>4718.46</td><td>4544.68 109.18</td></tr><tr><td></td><td>179.96</td><td>152.72</td><td>103.95</td><td>7085.02</td></tr><tr><td>UpNDown</td><td>38728.48</td><td>43208.99</td><td>5430.22</td><td></td></tr><tr><td>Venture</td><td>15.89</td><td>14.66</td><td>0.57</td><td>0.03</td></tr><tr><td>VideoPinball WizardOfWor</td><td>27346.44 2340.60</td><td>27549.55 2743.40</td><td>23998.09 2409.94</td><td>23705.39</td></tr><tr><td></td><td></td><td></td><td></td><td>2045.17</td></tr><tr><td>Zaxxon</td><td>3739.56</td><td>1813.90</td><td>256.78</td><td>1521.28</td></tr></table>
323
+
324
+ Table 5: All episodes mean scores of PPO, POP3D on Mujoco games after 10M frames. The results are averaged by three trials.
325
+
326
+ <table><tr><td>game</td><td>PPO</td><td>POP3D</td></tr><tr><td>HalfCheetah</td><td>3250.22</td><td>2373.30</td></tr><tr><td>Hopper</td><td>1767.14</td><td>1257.72</td></tr><tr><td>InvertedDoublePendulum</td><td>3684.92</td><td>2561.77</td></tr><tr><td>InvertedPendulum</td><td>531.77</td><td>552.98</td></tr><tr><td>Reacher</td><td>-5.94</td><td>-8.05</td></tr><tr><td>Swimmer</td><td>94.01</td><td>108.27</td></tr><tr><td>Walker2d</td><td>1770.37</td><td>2439.54</td></tr></table>
327
+
328
+ # B EXPERIMENTS
329
+
330
+ # B.1 HYPER-PARAMETERS
331
+
332
+ B.1.1 ATARI
333
+
334
+ PPO’s and POP3D’s hyper-parameters for Mujoco games are respectively listed in Table 6.
335
+
336
+ <table><tr><td>Hyper-parameter</td><td>Value</td></tr><tr><td>Horizon (T) Adam step-size</td><td>128 2.5 ×10-4 × α</td></tr><tr><td>Num epochs Mini-batch size</td><td>3 32×8</td></tr><tr><td>Discount (γ) GAE parameter (入)</td><td>0.99 0.95</td></tr><tr><td>Number of actors</td><td>8</td></tr><tr><td></td><td>0.1×α</td></tr><tr><td>Clipping parameter VF coeff. Entropy coeff.</td><td>1 0.01</td></tr></table>
337
+
338
+ Table 6: Left: PPO’s hyper-parameters for Atari games. Right:POP3D’s hyper-parameters for Atari games.
339
+
340
+ <table><tr><td>Hyper-parameter</td><td>Value</td></tr><tr><td>Horizon (T) Adam step-size Num epochs</td><td>128 2.5 ×10-4 × α 3</td></tr><tr><td>Mini-batch size Discount (γ)</td><td>32×8</td></tr><tr><td>GAE parameter (入)</td><td>0.99 0.95</td></tr><tr><td>Number of actors</td><td>8</td></tr><tr><td></td><td>1</td></tr><tr><td>VF coeff. Entropy coeff. KL penalty coeff.</td><td>0.01</td></tr></table>
341
+
342
+ Table 7: BASELINE’s hyper-parameters for Atari games.
343
+
344
+ <table><tr><td>Hyper-parameter</td><td>Value</td></tr><tr><td>Horizon (T)</td><td>128 2.5 ×10-4 × α</td></tr><tr><td>Adam step-size Num epochs</td><td>3</td></tr><tr><td>Mini-batch size</td><td>32×8</td></tr><tr><td>Discount (γ)</td><td>0.99</td></tr><tr><td>GAE parameter (入)</td><td>0.95</td></tr><tr><td>Number of actors</td><td>8</td></tr><tr><td>VF coeff.</td><td>1</td></tr><tr><td>Entropy coeff.</td><td>0.01</td></tr><tr><td>KL penalty coeff.</td><td>10.0</td></tr></table>
345
+
346
+ # B.1.2 MUJOCO
347
+
348
+ PPO’s and POP3D’s hyper-parameters for Mujoco games are respectively listed in Table 8.
349
+
350
+ Table 8: Left: PPO’s hyper-parameters for Mujoco games. Right:POP3D’s hyper-parameters for Mujoco games.
351
+
352
+ <table><tr><td>Hyper-parameter</td><td>Value</td></tr><tr><td>Horizon (T) Adam step-size</td><td>2048 3×10-4</td></tr><tr><td>Num epochs Mini-batch size</td><td>10 64</td></tr><tr><td>Discount (γ)</td><td>0.99</td></tr><tr><td>GAE parameter (入) KL penalty coeff.</td><td>0.95 5.0</td></tr></table>
353
+
354
+ <table><tr><td>Hyper-parameter</td><td>Value</td></tr><tr><td>Horizon (T) Adam step-size</td><td>2048 3×10-4</td></tr><tr><td>Num epochs</td><td>10</td></tr><tr><td>Mini-batch size</td><td>64</td></tr><tr><td>Discount (γ)</td><td>0.99</td></tr><tr><td>GAE parameter (入) Clipping parameter</td><td>0.95</td></tr></table>
355
+
356
+ ![](images/5b4b33235a0ab6b0e0a9c1d57d3efcec9854cb8d2269eea795279d7288f562d1.jpg)
357
+ Figure 1: Score curves of three methods on Atari games within 40 million frame steps.
358
+
359
+ ![](images/b334ff90f04d263256c24e4717cabc5143d181c1eaf5c3b306260b9cbbd026d5.jpg)
360
+ Figure 2: Score curves on 7 Mujoco games within 10 million frame steps.
md/train/1AoMhc_9jER/1AoMhc_9jER.md ADDED
@@ -0,0 +1,352 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GANS CAN PLAY LOTTERY TICKETS TOO
2
+
3
+ Xuxi Chen1\*, Zhenyu Zhang1\*, Yongduo $\mathbf { S u i ^ { 1 } }$ , Tianlong Chen2 1University of Science and Technology of China, 2University of Texas at Austin {chanyh,zzy19969,syd2019}@mail.ustc.edu.cn, tianlong.chen@utexas.edu
4
+
5
+ # ABSTRACT
6
+
7
+ Deep generative adversarial networks (GANs) have gained growing popularity in numerous scenarios, while usually suffer from high parameter complexities for resource-constrained real-world applications. However, the compression of GANs has less been explored. A few works show that heuristically applying compression techniques normally leads to unsatisfactory results, due to the notorious training instability of GANs. In parallel, the lottery ticket hypothesis shows prevailing success on discriminative models, in locating sparse matching subnetworks capable of training in isolation to full model performance. In this work, we for the first time study the existence of such trainable matching subnetworks in deep GANs. For a range of GANs, we certainly find matching subnetworks at $6 7 \% - 7 4 \%$ sparsity. We observe that with or without pruning discriminator has a minor effect on the existence and quality of matching subnetworks, while the initialization weights used in the discriminator plays a significant role. We then show the powerful transferability of these subnetworks to unseen tasks. Furthermore, extensive experimental results demonstrate that our found subnetworks substantially outperform previous state-of-the-art GAN compression approaches in both image generation (e.g. SNGAN) and image-to-image translation GANs (e.g. CycleGAN). Codes available at https://github.com/VITA-Group/GAN-LTH.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Generative adversarial networks (GANs) have been successfully applied to many fields like image translation (Jing et al., 2019; Isola et al., 2017; Liu & Tuzel, 2016; Shrivastava et al., 2017; Zhu et al., 2017) and image generation (Miyato et al., 2018; Radford et al., 2016; Gulrajani et al., 2017; Arjovsky et al., 2017). However, they are often heavily parameterized and often require intensive calculation at the training and inference phase. Network compressing techniques (LeCun et al., 1990; Wang et al., 2019; 2020b; Li et al., 2020) can be of help at inference by reducing the number of parameters or usage of memory; nonetheless, they can not save computational burden at no cost. Although they strive to maintain the performance after compressing the model, a non-negligible drop in generative capacity is usually observed. A question is raised:
12
+
13
+ Is there any way to compress a GAN model while preserving or even improving its performance?
14
+
15
+ The lottery ticket hypothesis (LTH) (Frankle & Carbin, 2019) provides positive answers with matching subnetworks (Chen et al., 2020b). It states that there exist matching subnetworks in dense models that can be trained to reach a comparable test accuracy to the full model within similar training iterations. The hypothesis has successfully shown its success in various fields (Yu et al., 2020; Renda et al., 2020; Chen et al., 2020b), and its property has been studied widely (Malach et al., 2020; Pensia et al., 2020; Elesedy et al., 2020). However, it is never introduced to GANs, and therefore the presence of matching subnetworks in generative adversarial networks still remains mysterious.
16
+
17
+ To address this gap in the literature, we investigate the lottery ticket hypothesis in GANs. One most critical challenge of extending LTH in GANs emerges: how to deal with the discriminator while compressing the generator, including (i) whether prunes the discriminator simultaneously and (ii) what initialization should be adopted by discriminators during the re-training? Previous GAN compression methods (Shu et al., 2019; Wang et al., 2019; Li et al., 2020; Wang et al., 2020b) prune the generator model only since they aim at reducing parameters in the inference stage. The effect of pruning the discriminator has never been studied by these works, which is unnecessary for them but possibly essential in finding matching subnetworks. It is because that finding matching subnetworks involves re-training the whole GAN network, in which an imbalance in generative and discriminative power could result in degraded training results. For the same reason, the disequilibrium between initialization used in generators and discriminators incurs severe training instability and unsatisfactory results.
18
+
19
+ Another attractive property of LTH is the powerful transferability of located matching subnetworks. Although it has been well studied in discriminative models (Mehta, 2019; Morcos et al., 2019; Chen et al., 2020b), an in-depth understanding of transfer learning in GAN tickets is still missing. In this work, we not only show whether the sparse matching subnetworks in GANs can transfer across multiple datasets but also study what initialization benefits more to the transferability.
20
+
21
+ To convert parameter efficiency of LTH into the advantage of computational saving, we also utilize channel pruning (He et al., 2017) to find the structural matching subnetworks of GANs, which enjoys the bonus of accelerated training and inference. Our contributions can be summarized in the following four aspects:
22
+
23
+ • Using unstructured magnitude pruning, we identify matching subnetworks at $74 \%$ sparsity in SNGAN (Miyato et al., 2018) and $67 \%$ in CycleGAN (Zhu et al., 2017). The matching subnetworks in GANs exist no matter whether pruning discriminators, while the initialization weights used in the discriminator are crucial.
24
+ • We show that the matching subnetworks found by iterative magnitude pruning outperform subnetworks extracted by randomly pruning and random initialization in terms of extreme sparsity and performance. To fully exploit the trained discriminator, we using the dense discriminator as a distillation source and further improve the quality of winning tickets.
25
+ • We demonstrate that the found subnetworks in GANs transfer well across diverse generative tasks.
26
+ • The matching subnetworks found by channel pruning surpass previous state-of-the-art GAN compression methods (i.e., GAN Slimming (Wang et al., 2020b)) in both efficiency and performance.
27
+
28
+ # 2 RELATED WORK
29
+
30
+ GAN Compression Generative adversarial networks (GANs) have succeeded in computer vision fields, for example, image generation and translation. One significant drawback of the generative models is the high computational cost of the models’ complex structure. A wide range of neural network compression techniques has been applied to generative models to address this problem. There are several categories of compression techniques, including pruning (removing some parameters), quantization (reducing the bit width), and distillation. Shu et al. (2019) proposed a channel pruning method for CycleGAN by using a co-evolution algorithm. Wang et al. (2019) proposed a quantization method for GANs based on the EM algorithm. Li et al. (2020) used a distillation method to transfer knowledge of the dense to the compressed model. Recently Wang et al. (2020b) proposed a GAN compression framework, GAN slimming, that integrated the above three mainstream compression techniques into a unified form. Previous works on GAN pruning usually aim at finding a sparse structure of the trained generator model for faster inference speed, while we are focusing on finding trainable structures of GANs following the lottery ticket hypothesis. Moreover, in existing GAN compression methods, only the generator is pruned, which could undermine the performance of re-training since the left-out discriminator may have a stronger computational ability than the pruned generator and therefore cause a degraded result due to the imparity of these two models.
31
+
32
+ The Lottery Ticket Hypothesis The lottery ticket hypothesis (LTH) (Frankle & Carbin, 2019) claims the existence of sparse, separate trainable sub-networks in a dense network. These subnetworks are capable of reaching comparable or even better performance than full dense model, which has been evidenced in various fields, such as image classification (Frankle & Carbin, 2019; Liu et al., 2019; Wang et al., 2020a; Evci et al., 2019; Frankle et al., 2020; Savarese et al., 2020; Yin et al., 2020; You et al., 2020; Ma et al., 2021; Chen et al., 2020a), natural language processing (Gale et al., 2019; Chen et al., 2020b), reinforcement learning (Yu et al., 2020), lifelong learning (Chen et al., 2021b), graph neural networks (Chen et al., 2021a), and adversarial robustness (Cosentino et al., 2019). Most works of LTH use unstructured weight magnitude pruning (Han et al., 2016; Frankle &
33
+
34
+ Carbin, 2019) to find the matching subnetworks, and the channel pruning is also adopted in a recent work (You et al., 2020). In order to scale up LTH to larger networks and datasets, the “late rewinding” technique is proposed by Frankle et al. (2019); Renda et al. (2020). Mehta (2019); Morcos et al. (2019); Desai et al. (2019) are the pioneers to study the transferability of found subnetworks. However, all previous works focus on discriminative models. In this paper, we extend LTH to GANs and reveal unique findings of GAN tickets.
35
+
36
+ # 3 PRELIMINARIES
37
+
38
+ In this section, we describe our pruning algorithms and list related experimental settings.
39
+
40
+ Backbone Networks We use two GANs in our experiments in Section 4: SNGAN (Miyato et al., 2018) and CycleGAN (Zhu et al., 2017)). SNGAN with ResNet (He et al., 2016) is one of the most popular noise-to-image GAN network and has strong performance on several datasets like CIFAR10. CycleGAN is a popular and well-studied image-to-image GAN network that also performs well on several benchmarks. For SNGAN, let $g ( \mathbf { z } ; \pmb { \theta } _ { g } )$ be the output of the generator network $\mathcal { G }$ with parameters $\theta _ { g }$ and a latent variable $\textbf { z } \in \mathbb { R } ^ { | | z | | _ { 0 } }$ and $d ( \mathbf { x } ; \pmb { \theta } _ { d } )$ be the output of the discriminator network $\mathcal { D }$ with parameters $\theta _ { d }$ and input example $\mathbf { x }$ . For CycleGAN which is composed of two generator-discriminator pairs, we use $g ( \mathbf { x } ; \pmb { \theta } _ { g } )$ and $\theta _ { g }$ again to represent the output and the weights of the two generators where $\mathbf { x } = ( \mathbf { x } _ { 1 } , \mathbf { x } _ { 2 } )$ indicates a pair of input examples. The same modification can be done for the two discriminators in CycleGAN.
41
+
42
+ Datasets For image-to-image experiments, we use a widely-used benchmark horse2zebra (Zhu et al., 2017) for model training. As for noise-to-image experiments, we use CIFAR-10 (Krizhevsky et al., 2009) as the benchmark. For the transfer study, the experiments are conducted on CIFAR-10 and STL-10 (Coates et al., 2011). For better transferring, we resize the image in STL-10 to $3 2 \times 3 2$ .
43
+
44
+ Subnetworks For a network $f ( \cdot ; \pmb \theta )$ parameterized by $\pmb \theta$ , a subnetwork is defined as $f ( \cdot ; m \odot \pmb { \theta } )$ , where $m \in \{ 0 , 1 \} ^ { \| \theta \| _ { 0 } }$ is a pruning mask for $\pmb { \theta } \in \mathbb { R } ^ { | | \theta | | _ { 0 } }$ and $\odot$ is the element-wise product. For GANs, two separate masks, $\mathbf { \nabla } m _ { d }$ and $m _ { g }$ , are needed for both the generator and the discriminator. Consequently, a subnetwork of GANs is consistent of: a sparse generator $g ( \cdot ; m _ { g } \odot \theta _ { g } )$ and a sparse discriminator $d ( \cdot ; m _ { d } \odot \theta _ { d } )$ .
45
+
46
+ Let $\pmb { \theta _ { 0 } }$ be the initialization weights of model $f$ and $\theta _ { t }$ be the weights at training step $t$ . Following Frankle et al. (2019), we define a matching network as a subnetwork $f ( \cdot ; m \odot \pmb \theta )$ , where $\pmb { \theta }$ is initialized with $\theta _ { t }$ , that can reach the comparable performance to the full network within a similar training iterations when trained in isolation; a winning ticket is defined as a matching subnetwork where $t = 0$ , i.e. $\pmb \theta$ initialized with $\pmb { \theta } _ { 0 }$ .
47
+
48
+ Finding subnetworks Finding GAN subnetworks is to find two masks $m _ { g }$ and $\mathbf { \nabla } m _ { d }$ for the generator and the discriminator. We use both an unstructured magnitude method, i.e. the iterative magnitude pruning (IMP), and a structured pruning method, i.e. the channel pruning (He et al., 2017), to generate the masks.
49
+
50
+ For unstructured pruning, we follow the following steps. After we finish training the full GAN model for $N$ iterations, we prune the weights with the lowest magnitude globally (Han et al., 2016) to obtain masks $\pmb { m } = ( m _ { g } , m _ { d } )$ , where the position of a remaining weight in $_ { \mathbf { \nabla } } \mathbf { m }$ is marked as one, and the position of a pruned weight is marked as zero. The weights of the sparse generator and the sparse discriminator are then reset to the initial weights of the full network. Previous works have shown that the iterative magnitude pruning (IMP) method is better than the one-shot pruning method. So rather than pruning the network only once to reach the desired sparsity, we prune a certain amount of non-zero parameters and re-train the network several times to meet the requirement. Details of this algorithm are in Appendix A1.1, Algorithm 1.
51
+
52
+ As for channel pruning, the first step is to train the full model as well. Besides using a normal loss function $\mathcal { L } _ { \mathrm { G A N } }$ , we follow Liu et al. (2017) to apply a $\ell _ { 1 }$ -norm on the trainable scale parameters $\gamma$ in the normalization layers to encourage channel-level sparsity: $\mathcal { L } _ { \mathrm { c p } } = | | \gamma | | _ { 1 }$ . To prevent the compressed network behave severely differently with the original large network, we introduce a distillation loss as Wang et al. (2020b) did: $\mathcal { L } _ { \mathrm { d i s t } } = \mathbb { E } _ { \mathbf { z } } [ \mathrm { d i s t } ( g ( \bar { \mathbf { z } } ; \theta _ { g } ) , g ( \mathbf { z } ; m _ { g } \odot \pmb { \theta } _ { g } ) ) ]$ . We train the
53
+
54
+ GAN network with these two additional losses for $N _ { 1 }$ epochs and get the sparse networks $g ( \cdot ; m _ { g } \odot$ $\theta _ { g , \mathrm { ~ \tiny ~ ~ } }$ ) and $d ( \cdot ; m _ { d } \odot \theta _ { g } )$ . Details of this algorithm are in Appendix A1.1, Algorithm 2.
55
+
56
+ Evaluation of subnetworks After obtaining the subnetworks $g ( \cdot ; \theta _ { g } \odot m _ { g } )$ and $d ( \cdot ; \pmb { \theta } _ { d } \odot \pmb { m } _ { d } )$ , we test whether the subnetworks are matching or not. We reset the weights to a specific step $i$ , and train the subnetworks for $N$ iterations and evaluate them using two specific metrics, Inception Score (Salimans et al., 2016) and Frechet Inception Distance (Heusel et al., 2017). ´
57
+
58
+ Other Pruning Methods We compare the size and the performance of subnetworks found by IMP with subnetworks found by other techniques that aim at compressing the network after training to reduce computational costs at inference. We use a benchmark pruning approach named Standard Pruning (Chen et al., 2020b; Han et al., 2016), which iteratively prune the $20 \%$ of lowest magnitude weights, and train the network for another $N$ iterations without any rewinding, and repeat until we have reached the target sparsity.
59
+
60
+ In order to verify that the statement of iterative magnitude pruning is better than one-shot pruning, we compare $\mathrm { I M P _ { G } }$ and $\mathrm { I M P _ { G D } }$ with their one-shot counterparts. Additionally, we compare IMP with some randomly pruning techniques to prove the effectiveness of IMP. They are: 1) Randomly Pruning: Randomly generate a sparsity mask $m ^ { \prime }$ . 2) Random Tickets: Rewinding the weights to another initialization $\theta _ { \mathbf { 0 } } ^ { \prime }$ .
61
+
62
+ # 4 THE EXISTENCE OF WINNING TICKETS IN GAN
63
+
64
+ In this section, we will validate the existence of winning tickets in GANs with initialization $\theta _ { 0 } : =$ $( \theta _ { g _ { 0 } } , \theta _ { d _ { 0 } } )$ . Specifically, we will empirically prove several important properties of the tickets by authenticating the following four claims:
65
+
66
+ Claim $I$ : Iterative Magnitude Pruning (IMP) finds winning tickets in GANs, $g ( \cdot ; m _ { g } \odot \theta _ { g _ { 0 } } )$ and $d ( \cdot ; m _ { d } \odot \theta _ { d _ { 0 } } )$ . Channel pruning is also able to find winning tickets as well.
67
+
68
+ Claim 2: Whether pruning the discriminator $\mathcal { D }$ does not change the existence of winning tickets. It is the initialization used in $\mathcal { D }$ that matters. Moreover, pruning the discriminator has a slight boost of matching networks in terms of extreme sparsity and performance.
69
+
70
+ Claim 3: IMP finds winning tickets at sparsity where some other pruning methods (randomly pruning, one-shot magnitude pruning, and random tickets) are not matching.
71
+
72
+ Claim 4: The late rewinding technique (Frankle et al., 2019) helps. Matching subnetworks that are initialized to $\theta _ { i }$ , i.e., $i$ steps from $\pmb { \theta _ { 0 } }$ , can outperform those initialized to $\pmb { \theta _ { 0 } }$ . Moreover, matching subnetworks that are late rewound can be trained to match the performance of standard pruning.
73
+
74
+ Claim 1: Are there winning tickets in GANs? To answer this question, we first conduct experiments on SNGAN by pruning the generator only in the following steps: 1) Run IMP to get sequential sparsity masks $( m _ { d _ { i } } , m _ { g _ { i } } )$ of sparsity $s _ { i } \bar { \% }$ remaining weights; 2) Apply the masks to the GAN and reset the weights of the subnetworks to the same random initialization $\theta _ { \mathbf { 0 } } ; 3 )$ Train models to evaluate whether they are winning tickets. 1 We set $s _ { i } \% = ( 1 - 0 . 8 ^ { i } ) \times 1 0 0 \%$ , which we use for all the experiments that involve iteratively pruning hereinafter. The number of training epochs for subnetworks is identical to that of training the full models.
75
+
76
+ Figure 1 verifies the existence of winning tickets in SNGAN and CycleGAN. We are able to find winning tickets by iterative pruning the generators at the highest sparsity, around $74 \%$ in SNGAN, and around $67 \%$ in CycleGAN, where the FID scores of these subnetworks successfully match the FID scores of the full network respectively. The confidence interval also suggests that the winning tickets at some sparsities are statistically significantly better than the full model.
77
+
78
+ To show that channel pruning can find winning tickets as well, we extract several subnetworks from the trained full SNGAN and CycleGAN by varying $\rho$ in Algorithm 2. We define the channel-pruned model’s sparsity as the ratio of MFLOPs between the sparse model and the full model.
79
+
80
+ ![](images/7513d5cd63eac48aa4d57f06bcfa222e824d83221d800f1918c160f8bd993b4a.jpg)
81
+ Figure 1: The Frechet Inception Distance (FID) curve of subnetworks of SNGAN (left) and CycleGAN (right) ´ generated by iterative magnitude pruning (IMP) on CIFAR-10 and horse2zebra. The dashed line indicates the FID score of the full model on CIFAR-10 and horse2zebra. The $9 5 \%$ confidence interval of 5 runs is reported.
82
+
83
+ We can confirm that winning tickets can also be found by channel pruning (CP). CP is able to find winning tickets in SNGAN at sparsity around $34 \%$ . We will analyze it more carefully in Section 7.
84
+
85
+ ![](images/8911baf780540c2c3bb95561086c246e134ffe27ca1dfbd17bf48521ae5c5f05.jpg)
86
+ Figure 2: Visualization by sampling and interpolation of SNGAN Winning Tickets found by IMP. Sparsity of best winning tickets : $4 8 . 8 0 \%$ . Extreme sparsity of matching subnetworks: $7 3 . 7 9 \%$ .
87
+
88
+ ![](images/58e0acd15a2f5c11aa5a7559feab903e95dea4d4079e86d4039c325cf35e41dd.jpg)
89
+ Figure 3: Visualization of CycleGAN Winning Tickets found by IMP. Sparsity of best winning tickets : $5 9 . 0 4 \%$ . Extreme sparsity of matching subnetworks: $6 7 . 2 4 \%$ . Left: visualization results on horse2zebra. Right: visualization results on zebra2horse.
90
+
91
+ Claim 2: Does the treatment of the discriminator affect the existence of winning tickets? Previous works of GAN pruning did not analyze the effect of pruning the discriminator. To study the effect, we compare two different iterative pruning settings: 1) Prune the generator only $\left( \mathrm { I M P _ { G } } \right)$ and 2) Prune both the generator and the discriminator iteratively $( \mathrm { I M P _ { G D } } )$ . Both the generator and the discriminator are reset to the same random initialization $\pmb { \theta _ { 0 } }$ after the masks are obtained.
92
+
93
+ The FID scores of the two experiments are shown in Figure 4. The graph suggests that the two settings share similar patterns: the minimal FID of $\mathrm { I M P _ { G } }$ is 14.19, and the minimal FID of $\mathrm { I M P _ { G D } }$ is 14.59. The difference between these two best FID is only 0.4, showing a slight difference in generative power. The FID curve of $\mathrm { I M P _ { G } }$ lies below that of $\mathrm { I M P _ { G D } }$ at low sparsity but lies above at high sparsity, indicating that pruning the discriminator produces slightly better performance when the percent of remaining weights is small. The extreme sparsity where $\mathrm { I M P _ { G D } }$ can match the performance of the full model is $7 3 . 8 \%$ . In contrast, $\mathrm { I M P _ { G } }$ can only match no sparser than $6 7 . 2 \%$ , demonstrating that pruning the discriminator can also push the frontier of extreme sparsity where the pruned models are still able to match.
94
+
95
+ In addition, we study the effects of different initialization for the sparse discriminator. We compare different weights loading methods when applying the iterative magnitude pruning process: 1) Reset the weights of generator to $\theta _ { g _ { 0 } }$ and reset the weights of discriminator to $\theta _ { d _ { 0 } }$ , which is identical to $\mathrm { I M P _ { G } }$ ; 2) Reset the weights of generator to $\theta _ { g _ { 0 } }$ and fine-tune the discriminator, which we will call $\mathrm { I M P _ { G } ^ { F } }$ . Figure 4 shows that resetting both the weights to $\pmb { \theta _ { 0 } }$ produces a much better result than only resetting the generator. The discriminator $\mathcal { D }$ without resetting its weights is too strong for the generator $\mathcal { G }$ with initial weights $\theta _ { g _ { 0 } }$ that will lead to degraded performance. In summary, different initialization of the discriminator will significantly influence the existence and quality of winning tickets in GAN models.
96
+
97
+ ![](images/66ed5eab2be7c87a44dd7ec54916199d028c93910d2e62b9e9fe26aa369272b9.jpg)
98
+ Figure 4: The FID score of Left: The FID score of best subnetworks generated by two different pruning settings: $\mathrm { I M P _ { G } }$ and $\mathrm { I M P } _ { \mathrm { G D } }$ . Right: The FID score of best subnetworks generated by two different pruning settings: $\mathrm { I M P _ { G } }$ and $\mathrm { I M P _ { G } ^ { F } }$ . $\mathrm { I M P _ { G } }$ : iteratively prune and reset the generator. $\mathrm { I M P } _ { \mathrm { G D } }$ : iteratively prune and reset the generator and the discriminator. $\mathrm { I M P _ { G } ^ { \tilde { \mathrm { F } } } }$ : iteratively prune and reset the generator, and iteratively prune but not reset the discriminator.
99
+
100
+ A follow-up question arises from the previous observations: is there any way to use the weights of the dense discriminator, as the direct usage of the dense weights yields inferior results? One possible way is to use it as a “teacher” and transfer the knowledge to pruned discriminator using a consistency loss. Formally speaking, an additional regularization term is used when training the whole network:
101
+
102
+ $$
103
+ \mathcal { L } _ { \mathrm { K D } } ( \mathbf { x } ; \pmb { \theta } _ { d } , m _ { d } ) = \mathbb { E } _ { \mathbf { x } } [ \mathrm { K L } _ { \mathrm { D i v } } ( d ( \mathbf { x } ; m _ { d } \odot \pmb { \theta } _ { d } ) , d ( \mathbf { x } ; \pmb { \theta } _ { d _ { 1 } } ) ) ]
104
+ $$
105
+
106
+ where $\mathrm { K L } _ { \mathrm { D i v } }$ denotes the KL-Divergence. We name the iterative pruning method with this additional regularization $\mathrm { I M P _ { G D } ^ { K D } }$ .
107
+
108
+ Figure 5 shows the result of pruning method IMPKD compared to the previous two pruning methods we proposed, $\mathrm { I M P _ { G } }$ and $\mathrm { I M P _ { G D } }$ . $\mathrm { I M P _ { G D } ^ { K D } }$ is capable of finding winning tickets at sparsity around $70 \%$ , outperforming $\mathrm { I M P _ { G } }$ , and showing comparable results to $\mathrm { I M P _ { G D } }$ regarding the extreme sparsity. The FID curve of setting $\mathrm { \tilde { I M P } _ { G D } ^ { K D } }$ is further mostly located below the curve of $\mathrm { \Delta I M P _ { G D } }$ , demonstrating a stronger generative ability than $\mathrm { I M P _ { G D } }$ . It suggests transferring knowledge from the full discriminator benefits to find the winning tickets.
109
+
110
+ ![](images/a8b60e4bcd678fb4f89a4ccc93e2d320ddc699b7352edcc9c2574225e0eddc94.jpg)
111
+ Figure 5: The FID curve of best subnetworks generated by three different pruning methods: $\mathrm { I M P G }$ , $\mathrm { I M P } _ { \mathrm { G D } }$ and $\mathrm { I M P _ { G D } ^ { K D } }$ . $\mathrm { I M P _ { G D } ^ { K D } }$ : iteratively prune and reset both the generator and the discriminator, and train them with the KD regularization.
112
+
113
+ Claim 3: Can IMP find matching subnetworks sparser than other pruning methods? Previous works claim that both a specific sparsity mask and a specific initialization are necessary for finding winning tickets (Frankle & Carbin, 2019), and iterative magnitude pruning is better than one-shot pruning. To extend such a statement in the context of GANs, we compare IMP with several other benchmarks, randomly pruning (RP), one-shot magnitude pruning (OMP), and random tickets (RT), to see if IMP can find matching networks at higher sparsity.
114
+
115
+ ![](images/8d085d6300af245b69cf6781c1d9e225b046161a0b431dbf111e4009fc915ef9.jpg)
116
+ Figure 6: FID curves: $\mathrm { O M P G }$ , $\mathrm { I M P G }$ , ${ \mathrm { O M P } } _ { \mathrm { G D } }$ and $\mathrm { I M P } _ { \mathrm { G D } }$ . $\mathrm { O M P _ { G } }$ : one-shot prune the generator. ${ \mathrm { O M P } } _ { \mathrm { G P } }$ : one-shot prune generator/discriminator.
117
+
118
+ <table><tr><td>Method</td><td>FIDBest (Sparsity)</td><td>FIDExtreme (Sparsity)</td></tr><tr><td>No Pruning</td><td>15.69 (0.0%)</td><td>1</td></tr><tr><td>IMPG</td><td>14.19 (20.0%)</td><td>15.58 (67.2%)</td></tr><tr><td>IMPGD</td><td>14.59 (59.0%)</td><td>15.53 (73.8%)</td></tr><tr><td>OMPG</td><td>14.36 (36.0%)</td><td>15.33 (59.0%)</td></tr><tr><td>OMPGD</td><td>14.52 (20.0%)</td><td>15.69 (48.8%)</td></tr></table>
119
+
120
+ Table 1: The extreme sparsity of the matching networks and the FID score of best subnetworks, found by iterative pruning and one-shot pruning. $\mathrm { O M P G }$ : one-shot prune the generator. ${ \mathrm { O M P } } _ { \mathrm { G P } }$ : one-shot prune generator/discriminator.
121
+
122
+ Figure 6 and Table 1 show that iterative magnitude pruning outperforms one-shot magnitude pruning no matter pruning the discriminator or not. IMP finds winning tickets at higher sparsity $( 6 7 . 2 3 \%$ and $7 3 . 7 9 \%$ , respectively) than one-shot pruning $( 5 9 . 0 0 \%$ and $4 8 . 8 0 \%$ , respectively). The minimal FID score of subnetworks found by IMP is smaller than that of subnetworks found by OMP as well. This observation defends the statement that pruning iteratively is superior compared to one-shot pruning.
123
+
124
+ We also list the minimal FID scores and extreme sparsity of matching networks for other pruning methods in Figure 7 and Table 2. It can be seen that IMP finds winning tickets at sparsity where some other pruning methods, randomly pruning and random initialization, cannot match. Since $\mathrm { I M P _ { G } }$ shows the best overall result, we authenticate the previous statement that both the specific sparsity mask and the specific initialization are essential for finding winning tickets.
125
+
126
+ ![](images/459ef32da8d72453aabd929c181e761be23bb6bb14cfc391573cf4c04ab0f836.jpg)
127
+ Figure 7: The FID curve of best subnetworks generated by three different pruning settings: $\mathrm { I M P G }$ , RP, and RT. RP: iteratively randomly prune the generator. RT: iteratively prune the generator but reset the weights randomly.
128
+
129
+ Table 2: The FID score of best subnetworks and the extreme sparsity of matching networks found by Random Pruning, Random Rickets, and iterative magnitude pruning.
130
+
131
+ <table><tr><td>Method</td><td>FIDBest (Sparsity)</td><td>FIDExtreme (Sparsity)</td></tr><tr><td>No Pruning</td><td>15.69 (0.0%)</td><td></td></tr><tr><td>IMPG</td><td>14.19 (20.0%)</td><td>15.58 (67.2%)</td></tr><tr><td>Random Pruning</td><td>14.57 (20.0%)</td><td>15.60 (36.0%)</td></tr><tr><td>Random Tickets</td><td>14.28 (36.0%)</td><td>15.33 (59.0%)</td></tr></table>
132
+
133
+ Claim 4: Does rewinding improve performance? In previous paragraphs, we show that we are able to find winning tickets in both SNGAN and CycleGAN. However, these subnetworks cannot match the performance of the original network at extremely high sparsity, while the subnetworks found by standard pruning can (Table 3). To find matching subnetworks at such high sparsity, we adopt the rewinding paradigm: after the masks are obtained, the weights of the model are rewound to $\theta _ { i }$ , the weights after $i$ steps of training, rather than reset to the same random initialization $\pmb { \theta _ { 0 } }$ . It was pointed out by Renda et al. (2020) that subnetworks found by IMP and rewound early in training can be trained to achieve the same accuracy at the same sparsity as subnetworks found by the standard pruning, providing a possibility that rewinding can also help GAN subnetworks.
134
+
135
+ We choose different rewinding settings: $5 \%$ , $10 \%$ , and $20 \%$ of the whole training epochs. The results are shown in Table 3. We observe that rewinding can significantly increase the extreme sparsity of matching networks. Rewinding to even only $5 \%$ of the training process can raise the extreme sparsity from $6 7 . 2 3 \%$ to $8 6 . 2 6 \%$ , and rewinding to $20 \%$ can match the performance of standard pruning. We also compare the FID score of subnetworks found at $89 \%$ sparsity. Rewind to $2 0 \%$ of the training
136
+
137
+ Table 3: Rewinding results. $\mathrm { S _ { E x t r e m e } }$ : Extreme sparsity where matching subnetworks exist. $\mathrm { F I D } _ { \mathrm { B e s t } }$ : The minimal FID score of all subnetworks. $\mathrm { F I D } _ { 8 9 \% }$ : The FID score of subnetworks at $8 9 \%$ sparsity.
138
+
139
+ <table><tr><td>Setting of rewinding</td><td>SExtreme</td><td>FIDBest</td><td>FID89%</td></tr><tr><td>Rewind 0%</td><td>67.23%</td><td>14.20</td><td>19.60</td></tr><tr><td>Rewind 5%</td><td>86.26%</td><td>13.96</td><td>15.82</td></tr><tr><td>Rewind 10%</td><td>86.26%</td><td>14.43</td><td>15.63</td></tr><tr><td>Rewind 20%</td><td>89.26%</td><td>14.82</td><td>15.29</td></tr><tr><td>Standard Pruning</td><td>89.26%</td><td>14.18</td><td>15.22</td></tr></table>
140
+
141
+ process can match the performance of standard pruning at $89 \%$ sparsity, and other late rewinding settings can match the performance of the full model. This suggests that late rewinding techniques can greatly contribute to matching subnetworks with higher sparsity.
142
+
143
+ Summary Extensive experiments are conducted to examine the existence of matching subnetworks in generative adversarial models. We confirmed that there were matching subnetworks at high sparsities, and both the sparsity mask and the initialization matter for finding winning tickets. We also studied the effect of pruning the discriminator and demonstrate that pruning the discriminator can slightly boost the performance regarding the extreme sparsity and the minimal FID. We proposed a method to utilize the weights of the dense discriminator model to boost the performance further. We also compare IMP with different pruning methods, showing that IMP is superior to random tickets and random pruning. In addition, late rewinding can match the performance of standard pruning, which again shows consistency with previous works.
144
+
145
+ # 5 THE TRANSFER LEARNING OF GAN MATCHING NETWORKS
146
+
147
+ In the previous section, we confirm the presence of winning tickets in GANs. In this section, we will study the transferability of winning tickets. Existing works (Mehta, 2019) show that the matching networks in discriminative models can transfer across tasks. Here we evaluate this claim in GANs.
148
+
149
+ To investigate the transferability, we propose three transfer experiments from CIFAR-10 to STL-10 on SNGAN. We first identify matching subnetworks $g ( \cdot , m _ { g } \odot \theta )$ and $d ( \cdot , m _ { d } \odot \pmb \theta )$ on CIFAR10, and then train and evaluate the subnetworks on STL-10. To assess whether the same random initialization $\pmb { \theta _ { 0 } }$ is needed for transferring, we test three different weights loading method: 1) reset the weights to $\theta _ { 0 } ; 2 )$ reset the weights to another initialization $\theta _ { \mathbf { 0 } } ^ { \prime }$ ; 3) rewind the weights to $\theta _ { N }$ . We train the network on STL-10 using the same hyper-parameters as on CIFAR-10. It is noteworthy that the hyper-parameters setting might not be optimal for the target task, yet it is fair to compare different transferring settings.
150
+
151
+ Table 4: Results of late rewinding experiments. $\pmb { \theta _ { 0 } }$ : train the target model from the same random initialization as the source model; $\theta _ { r }$ : train from random initialization; $\pmb { \theta } _ { \mathbf { B } \mathbf { e s t } }$ : train from the weights of trained source model. Baseline: full model trained on STL-10.
152
+
153
+ <table><tr><td>Model</td><td>Baseline</td><td>IMPg (S = 67.23%)</td><td></td><td>IMPGD (S = 73.79%)</td><td>IMPKB</td><td>(S= 73.79%)</td></tr><tr><td>Metrics</td><td>FIDBest</td><td>FIDBest</td><td>Matching?</td><td>FIDBest</td><td>Matching?</td><td>FIDBest Matching?</td></tr><tr><td>0</td><td></td><td>116.7</td><td>√</td><td>121.8</td><td>× 120.1</td><td>×</td></tr><tr><td>0r</td><td>115.3</td><td>119.2</td><td>×</td><td>113.1 √</td><td>115.5</td><td>√</td></tr><tr><td>0Best</td><td></td><td>204.7</td><td>×</td><td>163.0 ×</td><td>179.1</td><td>×</td></tr></table>
154
+
155
+ The FID score of different settings is shown in Table 4. Subnetworks initialized by $\theta _ { 0 }$ and using masks generated by $\mathrm { I M P _ { G } }$ can be trained to achieve comparable results to the baseline model. Surprisingly, random re-initialization ${ \pmb \theta } _ { \mathbf { 0 } } ^ { \prime }$ shows better transferability than using the same initialization $\pmb { \theta _ { 0 } }$ in our transfer settings and outperforms the full model trained on STL-10, indicating that the combination of $\pmb { \theta _ { 0 } }$ and the mask generated by $\mathrm { I M P } _ { \mathrm { G D } }$ is more focused on the source dataset and consequently has lower transferability.
156
+
157
+ Summary In this section, we tested the transferability of IMP subnetworks. Transferring from $\pmb { \theta _ { 0 } }$ and $\theta _ { r }$ both produce matching results on the target dataset, STL-10. $\pmb { \theta _ { 0 } }$ works better with masks generated by $\mathrm { I M P _ { G } }$ while the masks generated by $\mathrm { I M P _ { G D } }$ prefer a different initialization $\theta _ { r }$ . Given that $\mathrm { I M P _ { G D } }$ performs better on CIFAR-10, it is reasonable that the same initialization $\pmb { \theta _ { 0 } }$ has lower transferability when using masks from $\mathrm { I M P _ { G D } }$ .
158
+
159
+ # 6 EXPERIMENTS ON OTHER GAN MODELS AND OTHER DATASETS
160
+
161
+ We conducted experiments on DCGAN (Radford et al., 2016), WGAN-GP (Gulrajani et al., 2017), ACGAN (Odena et al., 2017), GGAN (Lim & Ye, 2017), DiffAugGAN (Zhao et al., 2020a), ProjGAN (Miyato & Koyama, 2018), SAGAN (Zhang et al., 2019), as well as a NAS-based GAN, AutoGAN (Gong et al., 2019). We use CIFAR-10 and Tiny ImageNet (Wu et al., 2017) as our benchmark datasets.
162
+
163
+ Table 5 and 6 consistently verify that the existence of winning tickets in diverse GAN architectures in spite of the different extreme sparsities, showing that the lottery ticket hypothesis can be generalized to various GAN models.
164
+
165
+ # 7 EFFICIENCY OF GAN WINNING TICKETS
166
+
167
+ Unlike the unstructured magnitude pruning method, channel pruning can reduce the number of parameters in GANs. Therefore, winning tickets found by channel pruning are more efficient than the original model regarding computational cost. To fully exploit the advantage of subnetworks founded by structural pruning, we further compare our prune-and-train pipeline with a state-of-the-art GAN compression framework (Wang et al., 2020b). The pipeline is described as follows: after extracting the sparse structure generated by channel pruning, we reset the model weights to the same random initialization $\pmb { \theta _ { 0 } }$ and then train for the same number of epochs as the dense model used.
168
+
169
+ Table 5: Results on other GAN models on CIFAR-10. $\mathrm { F I D } _ { \mathrm { F u l l } }$ : FID score of the full model. $\mathrm { F I D } _ { \mathrm { B e s t } }$ : The minimal FID score of all subnetworks. $\mathrm { F I D } _ { \mathrm { E x t r e m e } }$ : The FID score of matching networks at extreme sparsity level. AutoGAN-A/B/C are three representative GAN architectures represented in the official repository (https://github.com/VITA-Group/AutoGAN)
170
+
171
+ <table><tr><td>Model</td><td>Benchmark</td><td>FIDFull (Sparsity)</td><td>FIDBest (Sparsity)</td><td>SExtreme (Sparsity)</td></tr><tr><td>DCGAN (Radford et al., 2016)</td><td>CIFAR-10</td><td>57.39 (0%)</td><td>49.31 (20.0%)</td><td>54.48 (67.2%)</td></tr><tr><td>WGAN-GP(Gulrajani et al., 2017)</td><td>CIFAR-10</td><td>19.23 (0%)</td><td>16.77 (36.0%)</td><td>17.28 (73.8%)</td></tr><tr><td>ACGAN (Odena et al.,2017)</td><td>CIFAR-10</td><td>39.26 (0%)</td><td>31.45 (36.0%)</td><td>38.95 (79.0%)</td></tr><tr><td>GGAN(Lim &amp; Ye,2017)</td><td>CIFAR-10</td><td>38.50 (0%)</td><td>33.42 (20.0%)</td><td>36.67 (48.8%)</td></tr><tr><td>ProjGAN (Miyato &amp; Koyama,2018)</td><td>CIFAR-10</td><td>31.47 (0%)</td><td>28.19 (20.0%)</td><td>31.31 (67.2%)</td></tr><tr><td>SAGAN (Zhang et al.,2019)</td><td>CIFAR-10</td><td>14.73 (0%)</td><td>13.57 (20.0%)</td><td>14.68 (48.8%)</td></tr><tr><td>AutoGAN(A) (Gong et al.,2019)</td><td>CIFAR-10</td><td>14.38 (0%)</td><td>14.04 (36.0%)</td><td>14.04 (36.0%)</td></tr><tr><td>AutoGAN(B) (Gong et al., 2019)</td><td>CIFAR-10</td><td>14.62 (0%)</td><td>13.16 (20.0%)</td><td>14.20 (36.0%)</td></tr><tr><td>AutoGAN(C) (Gong et al.,2019)</td><td>CIFAR-10</td><td>13.61 (0%)</td><td>13.41 (48.8%)</td><td>13.41 (48.8%)</td></tr><tr><td>DiffAugGAN (Zhao et al., 2020b)</td><td>CIFAR-10</td><td>8.23 (0%)</td><td>8.05 (48.8%)</td><td>8.05 (48.8%)</td></tr></table>
172
+
173
+ Table 6: Results on other GAN models on Tiny ImageNet. $\mathrm { F I D } _ { \mathrm { F u l l } }$ : FID score of the full model. $\mathrm { F I D } _ { \mathrm { B e s t } }$ : The minimal FID score of all subnetworks. $\mathrm { F I D } _ { \mathrm { E x t r e m e } }$ : The FID score of matching networks at extreme sparsity level.
174
+
175
+ <table><tr><td>Model</td><td>Benchmark</td><td>FIDFull (Sparsity)</td><td>FIDBest (Sparsity)|SExtreme (Sparsity)</td><td></td></tr><tr><td>DCGAN (Radford et al., 2016)</td><td>Tiny ImageNet</td><td>121.35 (0%)</td><td>78.51 (36.0%)</td><td>114.00 (67.2%)</td></tr><tr><td>WGAN-GP(Gulrajani et al.,2017)</td><td>Tiny ImageNet</td><td>211.77 (0%)</td><td>194.72 (48.8%)</td><td>200.22 (67.2%)</td></tr></table>
176
+
177
+ We can see from Figure 8 that subnetworks are founded by the channel pruning method at about $67 \%$ sparsity, which provides a new path for winning tickets other than magnitude pruning. The matching networks at $6 7 . 7 \%$ outperform GS-32 regarding Inception Score by 0.25; the subnetworks at about $2 9 \%$ sparsity can outperform GS-32 by 0.20, setting up a new benchmark for GAN compressions.
178
+
179
+ # 8 CONCLUSION
180
+
181
+ In this paper, the lottery ticket hypothesis has been extended to GANs. We successfully identify winning tickets in GANs, which are separately trainable to match the full dense GAN performance. Pruning the discriminator, which is rarely studied before, had only slight effects on the ticket finding process, while the initialization used in the discriminator is essential. We also demonstrate that the winning tickets found can transfer across diverse tasks. Moreover, we provide a new way of finding winning tickets that alter the structure of models. Channel pruning is able to extract matching subnetworks from a dense model that can outperform the current state-of-the-art GAN compression after resetting the weights and re-training.
182
+
183
+ ![](images/46aff1e9d2922bac930f9ce3e210cba2f3eb0ea47700daac3ace1446a848b52f.jpg)
184
+ Figure 8: Relationship between the best IS score of SNGAN subnetworks generated by channel pruning and the percent of remaining weights. GS-32: GAN Slimming without quantization (Wang et al., 2020b). Full Model: Full model trained on CIFAR-10.
185
+
186
+ # ACKNOWLEDGEMENT
187
+
188
+ Zhenyu Zhang is supported by the National Natural Science Foundation of China under grand No.U19B2044.
189
+
190
+ # REFERENCES
191
+
192
+ Martin Arjovsky, Soumith Chintala, and Leon Bottou. Wasserstein generative adversarial networks. ´ In Proceedings of the 34th International Conference on Machine Learning, 2017.
193
+
194
+ Tianlong Chen, Jonathan Frankle, Shiyu Chang, Sijia Liu, Yang Zhang, Michael Carbin, and Zhangyang Wang. The lottery tickets hypothesis for supervised and self-supervised pre-training in computer vision models. arXiv, abs/2012.06908, 2020a.
195
+
196
+ Tianlong Chen, Jonathan Frankle, Shiyu Chang, Sijia Liu, Yang Zhang, Zhangyang Wang, and Michael Carbin. The lottery ticket hypothesis for pre-trained bert networks. arXiv, abs/2007.12223, 2020b.
197
+
198
+ Tianlong Chen, Yongduo Sui, Xuxi Chen, Aston Zhang, and Zhangyang Wang. A unified lottery ticket hypothesis for graph neural networks, 2021a.
199
+
200
+ Tianlong Chen, Zhenyu Zhang, Sijia Liu, Shiyu Chang, and Zhangyang Wang. Long live the lottery: The existence of winning tickets in lifelong learning. In International Conference on Learning Representations, 2021b.
201
+
202
+ Adam Coates, Andrew Y. Ng, and Honglak Lee. An analysis of single-layer networks in unsupervised feature learning. In Proceedings of the 14th International Conference on Artificial Intelligence and Statistics, 2011.
203
+
204
+ Justin Cosentino, Federico Zaiter, Dan Pei, and Jun Zhu. The search for sparse, robust neural networks. arXiv, abs/1912.02386, 2019.
205
+
206
+ Shrey Desai, Hongyuan Zhan, and Ahmed Aly. Evaluating lottery tickets under distributional shifts. In Proceedings of the 2nd Workshop on Deep Learning Approaches for Low-Resource NLP, 2019.
207
+
208
+ Bryn Elesedy, Varun Kanade, and Y. Teh. Lottery tickets in linear models: An analysis of iterative magnitude pruning. arXiv, abs/2007.08243, 2020.
209
+
210
+ Utku Evci, Fabian Pedregosa, Aidan Gomez, and Erich Elsen. The difficulty of training sparse neural networks. arXiv, abs/1906.10732, 2019.
211
+
212
+ Jonathan Frankle and Michael Carbin. The lottery ticket hypothesis: Finding sparse, trainable neural networks. In 7th International Conference on Learning Representations, 2019.
213
+
214
+ Jonathan Frankle, Gintare Karolina Dziugaite, Daniel M. Roy, and Michael Carbin. Linear mode connectivity and the lottery ticket hypothesis. arXiv, abs/1912.05671, 2019.
215
+
216
+ Jonathan Frankle, David J. Schwab, and Ari S. Morcos. The early phase of neural network training. In 8th International Conference on Learning Representations, 2020.
217
+
218
+ Trevor Gale, Erich Elsen, and Sara Hooker. The state of sparsity in deep neural networks. arXiv, abs/1902.09574, 2019.
219
+
220
+ Xinyu Gong, Shiyu Chang, Yifan Jiang, and Zhangyang Wang. Autogan: Neural architecture search for generative adversarial networks. In Proceedings of the IEEE International Conference on Computer Vision, 2019.
221
+
222
+ Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, Vincent Dumoulin, and Aaron Courville. Improved training of wasserstein gans. In Advances in Neural Information Processing Systems 30, 2017.
223
+
224
+ Song Han, Huizi Mao, and William J. Dally. Deep compression: Compressing deep neural networks with pruning, trained quantization and huffman coding. In 4th International Conference on Learning Representations, 2016.
225
+
226
+ 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, 2016.
227
+
228
+ Yihui He, Xiangyu Zhang, and Jian Sun. Channel pruning for accelerating very deep neural networks. In Proceedings of the IEEE International Conference on Computer Vision, 2017.
229
+
230
+ Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. Gans trained by a two time-scale update rule converge to a local nash equilibrium, 2017.
231
+
232
+ Phillip Isola, Jun-Yan Zhu, Tinghui Zhou, and Alexei A. Efros. Image-to-image translation with conditional adversarial networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2017.
233
+
234
+ Yongcheng Jing, Yezhou Yang, Zunlei Feng, Jingwen Ye, Yizhou Yu, and Mingli Song. Neural style transfer: A review. IEEE Transactions on Visualization and Computer Graphics, 2019.
235
+
236
+ Alex Krizhevsky et al. Learning multiple layers of features from tiny images. 2009.
237
+
238
+ Yann LeCun, John S. Denker, and Sara A. Solla. Optimal brain damage. In Advances in Neural Information Processing Systems 2, 1990.
239
+
240
+ Muyang Li, Ji Lin, Yaoyao Ding, Zhijian Liu, Jun-Yan Zhu, and Song Han. Gan compression: Efficient architectures for interactive conditional gans. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2020.
241
+
242
+ Jae Hyun Lim and Jong Chul Ye. Geometric gan. abs/1705.02894, 2017.
243
+
244
+ Ming-Yu Liu and Oncel Tuzel. Coupled generative adversarial networks. In Advances in Neural Information Processing Systems 29, 2016.
245
+
246
+ Zhuang Liu, Jianguo Li, Zhiqiang Shen, Gao Huang, Shoumeng Yan, and Changshui Zhang. Learning efficient convolutional networks through network slimming. In Proceedings of the IEEE International Conference on Computer Vision, 2017.
247
+
248
+ Zhuang Liu, Mingjie Sun, Tinghui Zhou, Gao Huang, and Trevor Darrell. Rethinking the value of network pruning. In 7th International Conference on Learning Representations, 2019.
249
+
250
+ Haoyu Ma, Tianlong Chen, Ting-Kuei Hu, Chenyu You, Xiaohui Xie, and Zhangyang Wang. Good students play big lottery better. arXiv, abs/2101.03255, 2021.
251
+
252
+ Eran Malach, Gilad Yehudai, Shai Shalev-Shwartz, and Ohad Shamir. Proving the lottery ticket hypothesis: Pruning is all you need. arXiv, abs/2002.00585, 2020.
253
+
254
+ Rahul Mehta. Sparse transfer learning via winning lottery tickets. arXiv, abs/1905.07785, 2019.
255
+
256
+ Takeru Miyato and Masanori Koyama. cgans with projection discriminator. In 6th International Conference on Learning Representations, 2018.
257
+
258
+ Takeru Miyato, Toshiki Kataoka, Masanori Koyama, and Yuichi Yoshida. Spectral Normalization for Generative Adversarial Networks. In 6th International Conference on Learning Representations, 2018.
259
+
260
+ Ari Morcos, Haonan Yu, Michela Paganini, and Yuandong Tian. One ticket to win them all: generalizing lottery ticket initializations across datasets and optimizers. In Advances in Neural Information Processing Systems 32, 2019.
261
+
262
+ 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.
263
+
264
+ Ankit Pensia, Shashank Rajput, Alliot Nagle, Harit Vishwakarma, and Dimitris Papailiopoulos. Optimal lottery tickets via subsetsum: Logarithmic over-parameterization is sufficient. In Advances in Neural Information Processing Systems 33 pre-proceedings, 2020.
265
+
266
+ Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. In 4th International Conference on Learning Representations, 2016.
267
+
268
+ Alex Renda, Jonathan Frankle, and Michael Carbin. Comparing rewinding and fine-tuning in neural network pruning. In 8th International Conference on Learning Representations, 2020.
269
+
270
+ Mehdi SM Sajjadi, Olivier Bachem, Mario Lucic, Olivier Bousquet, and Sylvain Gelly. Assessing generative models via precision and recall. In Advances in Neural Information Processing Systems 31, 2018.
271
+
272
+ 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 29, 2016.
273
+
274
+ Pedro Savarese, Hugo Silva, and Michael Maire. Winning the lottery with continuous sparsification. In Advances in Neural Information Processing Systems 33 pre-proceedings, 2020.
275
+
276
+ Ashish Shrivastava, Tomas Pfister, Oncel Tuzel, Josh Susskind, Wenda Wang, and Russ Webb. Learning from simulated and unsupervised images through adversarial training. In Proceedings of IEEE Conference on Computer Vision and Pattern Recognition, 2017.
277
+
278
+ Han Shu, Yunhe Wang, Xu Jia, Kai Han, Hanting Chen, Chunjing Xu, Qi Tian, and Chang Xu. Coevolutionary compression for unpaired image translation. In Proceedings of IEEE International Conference on Computer Vision, 2019.
279
+
280
+ Chaoqi Wang, Guodong Zhang, and Roger Grosse. Picking winning tickets before training by preserving gradient flow. In 8th International Conference on Learning Representations, 2020a.
281
+
282
+ Haotao Wang, Shupeng Gui, Haichuan Yang, Ji Liu, and Zhangyang Wang. Gan slimming: All-inone gan compression by a unified optimization framework. In Proceedings of the 16th European Conference on Computer Vision, 2020b.
283
+
284
+ Peiqi Wang, Dongsheng Wang, Yu Ji, Xinfeng Xie, Haoxuan Song, XuXin Liu, Yongqiang Lyu, and Yuan Xie. Qgan: Quantized generative adversarial networks. abs/1901.08263, 2019.
285
+
286
+ Jiayu Wu, Qixiang Zhang, and Guoxi Xu. Tiny imagenet challenge. Technical report, 2017.
287
+
288
+ Shihui Yin, Kyu-Hyoun Kim, Jinwook Oh, Naigang Wang, Mauricio Serrano, Jae-Sun Seo, and Jungwook Choi. The sooner the better: Investigating structure of early winning lottery tickets, 2020.
289
+
290
+ Haoran You, Chaojian Li, Pengfei Xu, Yonggan Fu, Yue Wang, Xiaohan Chen, Richard G. Baraniuk, Zhangyang Wang, and Yingyan Lin. Drawing early-bird tickets: Toward more efficient training of deep networks. In 8th International Conference on Learning Representations, 2020.
291
+
292
+ Haonan Yu, Sergey Edunov, Yuandong Tian, and Ari S. Morcos. Playing the lottery with rewards and multiple languages: lottery tickets in rl and nlp. In 8th International Conference on Learning Representations, 2020.
293
+
294
+ Han Zhang, Ian J. Goodfellow, Dimitris N. Metaxas, and Augustus Odena. Self-attention generative adversarial networks. In Proceedings of the 36th International Conference on Machine Learning, 2019.
295
+
296
+ Shengyu Zhao, Zhijian Liu, Ji Lin, Jun-Yan Zhu, and Song Han. Differentiable augmentation for data-efficient gan training. In 34th Conference on Neural Information Processing Systems, 2020a.
297
+
298
+ Shengyu Zhao, Zhijian Liu, Ji Lin, Jun-Yan Zhu, and Song Han. Differentiable augmentation for data-efficient gan training. In Advances in Neural Information Processing Systems 33 preproceedings, 2020b.
299
+
300
+ Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A. Efros. Unpaired image-to-image translation using cycle-consistent adversarial networks. In Proceedings of the IEEE International Conference on Computer Vision, 2017.
301
+
302
+ # A1 MORE TECHNICAL DETAILS
303
+
304
+ # A1.1 ALGORITHMS
305
+
306
+ In this section, we describe the details of the algorithm we used in finding lottery tickets. Two distinct pruning methods are used in Algorithm 1 and Algorithm 2.
307
+
308
+ <table><tr><td>Model</td><td>F8</td><td>F1/8</td></tr><tr><td>Full Model</td><td>0.971</td><td>0.974</td></tr><tr><td>Best Winning Tickets</td><td>0.977</td><td>0.977</td></tr><tr><td>Extreme Winning Tickets</td><td>0.974</td><td>0.971</td></tr></table>
309
+
310
+ ![](images/d3f50733c9ff213e215e08b8f571fd038bc11685be71b72a50c143e2f15bc01f.jpg)
311
+ Figure A9: The curve of precision and recall of SNGANs under different sparsities. baseline: Full model. best: Best winning tickets (Sparsity: $4 8 . 8 0 \%$ ). extreme: Extreme winning tickets (Sparsity: $7 3 . 7 9 \%$ ).
312
+
313
+ Table A7: The $\mathrm { F } _ { 8 }$ and $\mathrm { F _ { 1 / 8 } }$ score of the full network, best subnetworks and the matching networks at extreme sparsity. We used the official codes to calculate recall, precision, $\mathrm { F } _ { 8 }$ and $\mathrm { F _ { 1 / 8 } }$ .
314
+
315
+ # A2 MORE EXPERIMENTS RESULTS AND ANALYSIS
316
+
317
+ We will provide extra experiments results and analysis in this section.
318
+
319
+ # A2.1 MORE VISUALIZATION OF IMP WINNING TICKETS
320
+
321
+ We also conducted experiments to find winning tickets in CycleGAN on dataset winter2summer (Zhu et al., 2017). We observed similar patterns and found matching networks at $7 9 . 0 2 \%$ sparsity. We randomly sample four images from the dataset and show the translated images in Figure A10, Figure A11, and Figure A12. The winning tickets of CycleGAN can generate comparable visual quality to the full model under all cases.
322
+
323
+ ![](images/a4a7cd1df085f55ab9c026cb42d9ca927154695ca8510814ca18dd8991c93ff1.jpg)
324
+ Figure A10: Visualization of CycleGAN Winning Tickets found by IMP on summer2winter. Sparsity of best winning tickets: $5 9 . 0 4 \%$ . Extreme sparsity of matching subnetworks: $7 9 . 0 2 \%$ . Left: visualization results of task summer2winter. Right: visualization results of task winter2summer.
325
+
326
+ # A2.2 EXTRA METRICS FOR EVALUATING SNGAN
327
+
328
+ We also evaluate the quality of images generated by SNGAN using precision and recall Sajjadi et al. (2018). The results are shown in Table A7 and Figure A9. The results show that the best winning tickets have higher $\mathrm { F _ { 8 } }$ and $\mathrm { F _ { 1 / 8 } }$ compared to the full model, and the extreme winning tickets have on-par performance.
329
+
330
+ ![](images/9c051b9b4a45c22ea552b6f3e653ce2126427bed0b801be34f7105798ecd2d7d.jpg)
331
+ Figure A11: Extra visualization of CycleGAN Winning Tickets found by IMP on horse2zebra. Sparsity of best winning tickets : $5 9 . 0 4 \%$ . Extreme sparsity of matching subnetworks: $6 7 . 2 4 \%$ .
332
+
333
+ ![](images/2a47c17dde15327013127d3e523874a5ff24da9dfa9dc6259a8443ef29c8c9a3.jpg)
334
+ Figure A12: Extra visualization of CycleGAN Winning Tickets found by IMP on summer2winter. Sparsity of best winning tickets : $5 9 . 0 4 \%$ . Extreme sparsity of matching subnetworks: $7 9 . 0 2 \%$ .
335
+
336
+ ![](images/28a3242fa0eb244811de40579e0a15a3304f07ebcd1c07f6f4b5f06da441b30e.jpg)
337
+ Figure A13: Relationship between the best IS score of SNGAN subnetworks generated by channel pruning and the percent of remaining model size. GS-32: GAN Slimming without quantization (Wang et al., 2020b). Full Model: Full model trained on CIFAR-10.
338
+
339
+ ![](images/862d8474dad0d7cec22aa65a73af92677ffbb75e0aaba0af4e37d7d5b0d8ddfa.jpg)
340
+ Figure A14: Relationship between the best FID score of CycleGAN subnetworks generated by channel pruning and the percent of remaining weights. GS-32: GAN Slimming without quantization (Wang et al., 2020b). Full Model: Full un-pruned CycleGAN trained on horse2zebra.
341
+
342
+ # A2.3 CHANNEL PRUNING FOR SNGAN
343
+
344
+ We study the relationship between the Inception Score and the remaining model size, i.e. the ratio between the size of a channel-pruned model and its original model. The results are plotted in Figure A13. A similar conclusion can be drawn from the graph that matching networks exist, and at the same sparsity, the matching networks can be trained to outperform the current state-of-the-art GAN compression framework.
345
+
346
+ # A2.4 CHANNEL PRUNING FOR CYCLEGAN
347
+
348
+ We also conducted experiments on CycleGAN using channel pruning. The task we choose is horseto-zebra, i.e., we prune each of the two generators separately, which is aligned with SNGAN, which has only one generator. We prove that channel pruning is also capable of finding winning tickets in CycleGAN in Figure A14. Moreover, at extreme sparsity, the sparse subnetwork that we obtain can be trained to reach slightly better results than the current state-of-the-art GAN compression framework without quantization.
349
+
350
+ <table><tr><td>Algorithm 1: Finding winning tickets by Iterative Magnitude Pruning</td></tr><tr><td>Input: The desired sparsity s Output: A sparse GAN g(- mg 0g)</td></tr><tr><td>and d(·; md 0d) 1 Set mg = 1 ∈ Rg llo and</td></tr><tr><td>md =1∈ Rl0dollo. 2 Set 0go := initial weights of the generator model, 0do := initial weights</td></tr><tr><td>of the discriminator model. 3 Iteration i= 0</td></tr><tr><td>4 while the sparsity of mg &lt; s do Train the generator g(*; mg ? 0go) 5</td></tr><tr><td>and the discriminator d( ; md ? 0dg) for N epochs to get parameters 0gN and 0dN</td></tr><tr><td>6 if pruning the discriminator then Prune 2O% of the parameters in 7</td></tr><tr><td>Na and Odn, creating two mask m&#x27;g and m&#x27;:</td></tr><tr><td>8 else Prune 2O% of the parameters in 9</td></tr><tr><td>0 gN, creating a mask m&#x27;. m&#x27; remains1 ∈ Rdo llo. 10 end</td></tr></table>
351
+
352
+ <table><tr><td>Algorithm 2: Finding winning tickets by Channel Pruning Input:A threshold ρ of importance score,</td></tr><tr><td>number of steps for training N Output: A sparse GAN g(:; mg 0go) and d(-; md ③ 0do)</td></tr><tr><td>1 Randomly initialize Yg for every normalization layers in generator G and Yd for discriminator D. γ = (Yg, Yd) 2 Set 0go := initial weights of the generator</td></tr><tr><td>model, 0do := initial weights of the discriminator model. 3i=0</td></tr><tr><td>4 whilei&lt;N do Compute masks md from Yd and mg 5 from Yg: Compute Lcp, LGAN and Ldist: 6</td></tr><tr><td>Update 0g and 0d by training the 7 generator g(-; mg ?0g) and the</td></tr><tr><td></td></tr><tr><td>discriminator d(·; md 0d) for one step. Update γ: γ ← proxρn(γ -n∀γLcp), 8 where proxx(𝑥)= sgn(x)①max(|𝑥|-λ·1,0) 9 i←i+1 10 end</td></tr></table>
md/train/AY8zfZm0tDd/AY8zfZm0tDd.md ADDED
@@ -0,0 +1,578 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # RANDOMIZED ENSEMBLED DOUBLE Q-LEARNING: LEARNING FAST WITHOUT A MODEL
2
+
3
+ Xinyue Chen1∗
4
+
5
+ Zijian Zhou1∗
6
+
7
+ Keith Ross1,2†
8
+
9
+ 1 New York University Shanghai
10
+ 2 New York University
11
+
12
+ # ABSTRACT
13
+
14
+ Using a high Update-To-Data (UTD) ratio, model-based methods have recently achieved much higher sample efficiency than previous model-free methods for continuous-action DRL benchmarks. In this paper, we introduce a simple modelfree algorithm, Randomized Ensembled Double Q-Learning (REDQ), and show that its performance is just as good as, if not better than, a state-of-the-art modelbased algorithm for the MuJoCo benchmark. Moreover, REDQ can achieve this performance using fewer parameters than the model-based method, and with less wall-clock run time. REDQ has three carefully integrated ingredients which allow it to achieve its high performance: (i) a UTD ratio $\gg 1$ ; (ii) an ensemble of $\mathrm { Q }$ functions; (iii) in-target minimization across a random subset of Q functions from the ensemble. Through carefully designed experiments, we provide a detailed analysis of REDQ and related model-free algorithms. To our knowledge, REDQ is the first successful model-free DRL algorithm for continuous-action spaces using a UTD ratio $\gg 1$ .
15
+
16
+ # 1 INTRODUCTION
17
+
18
+ Recently, model-based methods in continuous action space domains have achieved much higher sample efficiency than previous model-free methods. Model-based methods often attain higher sample efficiency by using a high Update-To-Data (UTD) ratio, which is the number of updates taken by the agent compared to the number of actual interactions with the environment. For example, Model-Based Policy Optimization (MBPO) (Janner et al., 2019), is a state-of-the-art model-based algorithm which updates the agent with a mix of real data from the environment and “fake” data from its model, and uses a large UTD ratio of 20-40. Compared to Soft-Actor-Critic (SAC), which is model-free and uses a UTD of 1, MBPO achieves much higher sample efficiency in the OpenAI MuJoCo benchmark (Todorov et al., 2012; Brockman et al., 2016). This raises the question of whether it is also possible to achieve such high performance without a model?
19
+
20
+ In this paper, we introduce a simple model-free algorithm called Randomized Ensemble Double Q learning (REDQ), and show that its performance is just as good as, if not better than, MBPO. The result indicates, that at least for the MuJoCo benchmark, simple model-free algorithms can attain the performance of current state-of-the-art model-based algorithms. Moreover, REDQ can achieve this performance using fewer parameters than MBPO, and with less wall-clock run time.
21
+
22
+ Like MBPO, REDQ employs a UTD ratio that is $\gg 1$ , but unlike MBPO it is model-free, has no roll outs, and performs all updates with real data. In addition to using a UTD ratio that is $\gg 1$ , it has two other carefully integrated ingredients: an ensemble of Q functions; and in-target minimization across a random subset of Q functions from the ensemble.
23
+
24
+ Through carefully designed experiments, we provide a detailed analysis of REDQ. We introduce the metrics of average Q-function bias and standard deviation (std) of Q-function bias. Our results show that using ensembles with in-target minimization reduces the std of the Q-function bias to close to zero for most of training, even when the UTD is very high. Furthermore, by adjusting the number of randomly selected Q-functions for in-target minimization, REDQ can control the average Q-function bias. In comparison with standard ensemble averaging and with SAC with a higher UTD, REDQ has much lower std of Q-function bias while maintaining an average bias that is negative but close to zero throughout most of training, resulting in significantly better learning performance. We perform an ablation study, and show that REDQ is very robust to choices of hyperparameters, and can work well with a small ensemble and a small number of Q functions in the in-target minimization. We also provide a theoretical analysis, providing additional insights into REDQ. Finally, we consider combining the REDQ algorithm with an online feature extractor network (OFENet) (Ota et al., 2020) to further improve performance, particularly for the more challenging environments Ant and Humanoid. We achieve more than $7 \mathbf { x }$ the sample efficiency of SAC to reach a score of 5000 for both Ant and Humanoid. In Humanoid, REDQ-OFE also greatly outperforms MBPO, reaching a score of 5000 at 150K interactions, which is $3 \mathbf { x }$ MBPO’s score at that point.
25
+
26
+ To ensure our comparisons are fair, and to ensure our results are reproducible (Henderson et al., 2018; Islam et al., 2017; Duan et al., 2016), we provide open source code1. For all algorithmic comparisons, we use the same codebase (except for MBPO, for which we use the authors’ code).
27
+
28
+ # 2 RANDOMIZED ENSEMBLED DOUBLE Q-LEARNING (REDQ)
29
+
30
+ Janner et al. (2019) proposed Model-Based Policy Optimization (MBPO), which was shown to be much more sample efficient than popular model-free algorithms such as SAC and PPO for the MuJoCo environments. MBPO learns a model, and generates “fake data” from its model as well as “real data” through environment interactions. It then performs parameter updates using both the fake and the real data. One of the distinguishing features of MBPO is that it has a UTD ratio $\gg 1$ for updating its Q functions, enabling MBPO to achieve high sample efficiency.
31
+
32
+ We propose Randomized Ensembled Double Q-learning (REDQ), a novel model-free algorithm whose sample-efficiency performance is just as good as, if not better than, the state-of-the-art modelbased algorithm for the MuJoCo benchmark. The pseudocode for REDQ is shown in Algorithm 1. REDQ can be used with any standard off-policy model-free algorithm, such as SAC (Haarnoja et al., 2018b), SOP (Wang et al., 2019), TD3 (Fujimoto et al., 2018), or DDPG (Lillicrap et al., 2015). For the sake of concreteness, we use SAC in Algorithm 1. REDQ has the following key components: $( i )$ To improve sample efficiency, the UTD ratio $G$ is much greater than one; $( i i )$ To reduce the variance in the Q-function estimate, REDQ uses an ensemble of $N$ Q-functions, with each Q-function randomly and independently initialized but updated with the same target; $( i i i )$ To reduce over-estimation bias, the target for the Q-function includes a minimization over a random subset $\mathcal { M }$ of the $N$ Q-functions. The size of the subset $\mathcal { M }$ is kept fixed, and is denoted as $M$ , and is referred to as the $i n$ -target minimization parameter. Since our default choice for $M$ is $M = 2$ , we refer to the algorithm as Randomized Ensembled Double Q-learning (REDQ).
33
+
34
+ REDQ shares some similarities with Maxmin Q-learning (Lan et al., 2020), which also uses ensembles and also minimizes over multiple Q-functions in the target. However, Maxmin Q-learning and REDQ have many differences, e.g., Maxmin Q-learning minimizes over the full ensemble in the target, whereas REDQ minimizes over a random subset of Q-functions. Unlike Maxmin Q-learning, REDQ controls over-estimation bias and variance of the Q estimate by separately setting $M$ and $N$ . REDQ has many possible variations, some of which are discussed in the ablation section.
35
+
36
+ REDQ has three key hyperparameters, $G , N$ , and $M$ . When $N = M = 2$ and $G = 1$ , then REDQ simply becomes the underlying off-policy algorithm such as SAC. When $N = M > 2$ and $G = 1$ , then REDQ is similar to, but not equivalent to, Maxmin Q-learning (Lan et al., 2020). In practice, we find $M = 2$ works well for REDQ, and that a wide range of values around $N = 1 0$ and $G = 2 0$ work well. To our knowledge, REDQ is the first successful model-free DRL algorithm for continuous-action spaces using a UTD ratio $G \gg 1$ .
37
+
38
+ # Algorithm 1 Randomized Ensembled Double Q-learning (REDQ)
39
+
40
+ 1: Initialize policy parameters $\theta$ , $N$ Q-function parameters $\phi _ { i }$ , $i = 1 , \ldots , N$ , empty replay buffer $\mathcal { D }$ . Set target parameters $\phi _ { \mathrm { t a r g } , i } \phi _ { i }$ , for $i = 1 , 2 , \dots , N$
41
+
42
+ # 2: repeat
43
+
44
+ 3: $a _ { t } \sim \pi _ { \theta } ( \cdot | s _ { t } )$ $r _ { t }$ $s _ { t + 1 }$
45
+
46
+ Add data to buffer: $\mathcal { D } \mathcal { D } \cup \{ ( s _ { t } , a _ { t } , r _ { t } , s _ { t + 1 } ) \}$
47
+
48
+ 5: for $\cdot$ updates do
49
+ 6: Sample a mini-batch $B = \{ ( s , a , r , s ^ { \prime } ) \}$ from $\mathcal { D }$
50
+ 7: Sample a set $\mathcal { M }$ of $\cdot$ distinct indices from $\{ 1 , 2 , \ldots , N \}$
51
+ 8: Compute the Q target $y$ (same for all of the $N$ Q-functions):
52
+
53
+ $$
54
+ y = r + \gamma \left( \underset { i \in \mathcal { M } } { \operatorname* { m i n } } Q _ { \phi _ { \mathrm { t a r g } , i } } \left( s ^ { \prime } , \tilde { a } ^ { \prime } \right) - \alpha \log \pi _ { \theta } \left( \tilde { a } ^ { \prime } \mid s ^ { \prime } \right) \right) , \quad \tilde { a } ^ { \prime } \sim \pi _ { \theta } \left( \cdot \mid s ^ { \prime } \right)
55
+ $$
56
+
57
+ 9: for $i = 1 , \ldots , N$ do
58
+
59
+ Update $\phi _ { i }$ with gradient descent using
60
+
61
+ $$
62
+ \nabla _ { \phi } \frac { 1 } { | B | } \sum _ { ( s , a , r , s ^ { \prime } ) \in B } \left( Q _ { \phi _ { i } } ( s , a ) - y \right) ^ { 2 }
63
+ $$
64
+
65
+ Update target networks with $\phi _ { \mathrm { t a r g } , i } \rho \phi _ { \mathrm { t a r g } , i } + ( 1 - \rho ) \phi _ { i }$
66
+
67
+ 12: Update policy parameters $\theta$ with gradient ascent using
68
+
69
+ $$
70
+ \nabla _ { \theta } \frac { 1 } { | B | } \sum _ { s \in B } \left( \frac { 1 } { N } \sum _ { i = 1 } ^ { N } Q _ { \phi _ { i } } \left( s , \widetilde { a } _ { \theta } ( s ) \right) - \alpha \log \pi _ { \theta } \left( \widetilde { a } _ { \theta } ( s ) | s \right) \right) , \quad \widetilde { a } _ { \theta } ( s ) \sim \pi _ { \theta } ( \cdot \vert s ) ,
71
+ $$
72
+
73
+ # 2.1 EXPERIMENTAL RESULTS FOR REDQ
74
+
75
+ We now provide experimental results for REDQ and MBPO for the four most challenging MuJoCo environments, namely, Hopper, Walker2d, Ant, and Humanoid. We have taken great care to make a fair comparison of REDQ and MBPO. The MBPO results are reproduced using the author’s open source code, and we use the hyperparameters suggested in the MBPO paper, including $G = 2 0$ . We obtain MBPO results similar to those reported in the MBPO paper. For REDQ, we use $G = 2 0$ , $N = 1 0$ , and $M = 2$ for all environments. We use the evaluation protocol proposed in the MBPO paper. Specifically, after every epoch we run one test episode with the current policy and record the performance as the undiscounted sum of all the rewards in the episode. A more detailed discussion on hyperparameters and implementation details is given in the Appendix.
76
+
77
+ Figure 1 shows the training curves for REDQ, MBPO, and SAC. For each algorithm, we plot the average return of 5 independent trials as the solid curve, and plot the standard deviation across 5 seeds as the transparent shaded region. For each environment, we train each algorithm for exactly the same number of environment interactions as done in the MBPO paper. Figure 1 shows that both REDQ and MBPO learn much faster than SAC, with REDQ performing somewhat better than MBPO on the whole. In particular, REDQ learns significantly faster for Hopper, and has somewhat better asymptotic performance for Hopper, Walker2d, and Humanoid. A more detailed performance comparison is given in the Appendix, where it is shown that, averaging across the environments, REDQ performs $1 . 4 \mathbf { x }$ better than MBPO half-way through training and 1.1x better at the end of training. These results taken together are perhaps counter-intuitive. They show that a simple modelfree algorithm can achieve as good or better sample-efficiency performance as the state-of-the-art model-based algorithm for the MuJoCo environments.
78
+
79
+ Does REDQ achieve its sample efficiency using more computational resources than MBPO? We now compare the number of parameters used in REDQ and MBPO. With REDQ, for each Q network and the policy network, we use a multi-layer perceptron with two hidden layers, each with 256 units. For MBPO, we use the default network architectures for the Q networks, policy network, and model ensembles (Janner et al., 2019). The Appendix provides a table comparing the number of parameters: REDQ uses fewer parameters than MBPO for all four environments, specifically, between
80
+
81
+ ![](images/2a5631f27cef84e2b16a940ae8ef84cab91b157d0f25e61ecf82a04da0bc4b77.jpg)
82
+ Figure 1: REDQ compared to MBPO and SAC. Both REDQ and MBPO use $G = 2 0$ .
83
+
84
+ $26 \%$ and $70 \%$ as many parameters depending on the environment. Additionally, we measured the runtime on a 2080-Ti GPU and found that MBPO roughly takes $7 5 \%$ longer. In summary, the results in this section show that the model-free algorithm REDQ is not only at least as sample efficient as MBPO, but also has fewer parameters and is significantly faster in terms of wall-clock time.
85
+
86
+ # 3 WHY DOES REDQ SUCCEED WHEREAS OTHERS FAIL?
87
+
88
+ REDQ is a simple model-free algorithm that matches the performance of a state-of-the-art modelbased algorithm. Key to REDQ’s sample efficiency is using a $\mathrm { U T D } \gg 1 .$ . Why is it that SAC and ordinary ensemble averaging (AVG) cannot do as well as REDQ by simply increasing the UTD?
89
+
90
+ To address these questions, let $Q ^ { \pi } ( s , a )$ be the action-value function for policy $\pi$ using the standard infinite-horizon discounted return definition. Let $Q _ { \phi } ( s , a )$ be an estimate of $Q ^ { \pi } ( s , a )$ , which is defined as the average of $Q _ { \phi _ { i } } ( s , a )$ , $i = 1 , \ldots , N$ , when using an ensemble. We define the bias of an estimate at state-action pair $( s , a )$ to be $Q _ { \phi } ( s , a ) - Q ^ { \pi } ( s , a )$ . We are primarily interested in the accuracy of $Q _ { \phi } ( s , a )$ over the state-action distribution of the current policy $\pi$ . To quantitatively analyze how estimation error accumulates in the training process, we perform an analysis that is similar to previous work (Van Hasselt et al., 2016; Fujimoto et al., 2018), but not exactly the same. We run a number of analysis episodes from different random initial states using the current policy $\pi$ . For each state-action pair visited, we obtain both the discounted Monte Carlo return and the estimated $\mathrm { Q }$ value using $Q _ { \phi }$ , and then compute the difference to obtain an estimate of the bias for that state-action pair. We then calculate the average and std of these bias values. The average gives us an idea of whether $Q _ { \phi }$ is in general overestimating or underestimating, and the std measures how uniform the bias is across different state-action pairs. We argue that the std is just as important as the average of the bias. As discussed in Van Hasselt et al. (2016), a uniform bias is not necessarily harmful as it does not change the action selection. Thus near-uniform bias can be preferable to a highly non-uniform bias with a small average value. Although average bias has been analyzed in several previous works (Van Hasselt et al., 2016; Fujimoto et al., 2018; Anschel et al., 2017), the std does not seem to have received much attention.
91
+
92
+ Since the MC return values can change significantly throughout training, to make comparisons more meaningful, we define the normalized bias of the estimate $Q _ { \phi } ( s , a )$ to be $( Q _ { \phi } ( s , a ) \ - $ $Q ^ { \pi } ( s , a ) ) / | E _ { \bar { s } , \bar { a } \sim \pi } ^ { - } [ Q ^ { \pi } ( \bar { s } , \bar { a } ) ] |$ , which is simply the bias divided by the absolute value of the expected discounted MC return for state-action pairs sampled from the current policy. We focus on the normalized bias in our analysis since it helps show how large the bias is, compared to the scale of the current MC return.
93
+
94
+ In this and the subsequent section, we compare REDQ with several algorithms and variants. We emphasize that all of the algorithms and variants use the same code base as used in the REDQ experiments (including using SAC as the underlying off-policy algorithm). The only difference is how the targets are calculated in lines 7 and 8 of Algorithm 1.
95
+
96
+ We first compare REDQ with two natural algorithms, which we call SAC-20 and ensemble averaging (AVG). SAC-20 is SAC but with $G$ increased from 1 (as in standard SAC) to 20. For AVG, we use an ensemble of Q functions, and when computing the Q target, we take the average of all Q values without any in-target minimization. In these comparisons, all three algorithms use a UTD of $G = 2 0$ . In the later ablation section we also have a detailed discussion on experimental results with Maxmin, and explain why it does not work well for the MuJoCo benchmark when using a large ensemble.
97
+
98
+ Figure 2 presents the results for Ant; the results for the other three environments are consistent with those for Ant and are shown in the Appendix. For each experiment we use 5 random seeds. We first note REDQ learns significantly faster than both SAC-20 and AVG. Strikingly, relative to the other two algorithms, REDQ has a very low normalized std of bias for most of training, indicating the bias across different in-distribution state-action pairs is about the same. Furthermore, throughout most of training, REDQ has a small and near-constant under-estimation bias. The shaded areas for mean and std of bias are also smaller, indicating that REDQ is robust to random initial conditions.
99
+
100
+ ![](images/383d91b800c79a9a4defa964b1dd4606be9766cad48c9202eb071bc2869fbd53.jpg)
101
+ Figure 2: Performance, mean and std of normalized Q bias for REDQ, AVG, and SAC for Ant. Figures for the other three environments have similar trends and are shown in the Appendix.
102
+
103
+ SAC with a UTD ratio of 20 performs poorly for the most challenging environments Ant and Humanoid. For SAC-20, the high UTD ratio leads to an average bias that fluctuates during training. We also see a high normalized std of bias, indicating that the bias is highly non-uniform, which can be detrimental. The bias values also have large variance across random initial seeds, as indicated by the large shaded area, showing that the bias in SAC-20 is sensitive to initial conditions. Comparing AVG and SAC-20, we see AVG performs significantly better than SAC-20 in Ant and Humanoid. This can be explained again by the bias: due to ensemble averaging, AVG can achieve a lower std of bias; and when it does, its performance improves significantly faster than SAC-20.
104
+
105
+ REDQ has two critical components that allow it to maintain stable and near-uniform bias under high UTD ratios: an ensemble and in-target minimization. AVG and SAC-20 each has one of these components but neither has both. Thus the success of REDQ is largely due to a careful integration of both of these critical components. Additionally, as shown in the ablation study, the random selection of Q functions in the in-target minimization can give REDQ a further performance boost.
106
+
107
+ # 3.1 THEORETICAL ANALYSIS
108
+
109
+ We now characterize the relation between the estimation error, the in-target minimization parameter $M$ and the size of the ensemble $N$ . We use the theoretical framework introduced in Thrun & Schwartz (1993) and extended in Lan et al. (2020). We do this for the tabular version of REDQ, for which the target for $Q ^ { i } ( s , a )$ for each $i = 1 , \ldots , N$ is:
110
+
111
+ $$
112
+ r + \gamma \operatorname* { m a x } _ { a ^ { \prime } \in \mathcal { A } } \operatorname* { m i n } _ { j \in \mathcal { M } } Q ^ { j } ( s ^ { \prime } , a ^ { \prime } )
113
+ $$
114
+
115
+ where $\mathcal { A }$ is the finite action space, $( s , a , r , s ^ { \prime } )$ is a transition, and $\mathcal { M }$ is again a uniformly random subset from $\{ 1 , \ldots , N \}$ with $| { \mathcal { M } } | = M$ . The complete pseudocode for tabular REDQ is provided in the Appendix.
116
+
117
+ Let $Q ^ { i } ( s , a ) - Q ^ { \pi } ( s , a )$ be the pre-update estimation bias for the ith Q-function, where $Q ^ { \pi } ( s , a )$ is once again the ground-truth Q-value for the current policy $\pi$ . We are interested in how the bias changes after an update, and how this change is effected by $M$ and $N$ . Similar to Thrun $\&$ Schwartz (1993) and Lan et al. (2020), define the post-update estimation bias as the difference between the target (1) and the target when using the ground-truth:
118
+
119
+ $$
120
+ \begin{array} { r l } & { Z _ { M , N } \triangleq r + \gamma \underset { a ^ { \prime } \in A } { \operatorname* { m a x } } \underset { j \in \mathcal { M } } { \operatorname* { m i n } } Q ^ { j } ( s ^ { \prime } , a ^ { \prime } ) - ( r + \gamma \underset { a ^ { \prime } \in A } { \operatorname* { m a x } } Q ^ { \pi } ( s ^ { \prime } , a ^ { \prime } ) ) } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \end{array}
121
+ $$
122
+
123
+ Here we write $Z _ { M , N }$ to emphasize its dependence on both $M$ and $N$ . Following Thrun & Schwartz (1993) and Lan et al. (2020), fix $s$ and assume each $Q ^ { i } ( s , a )$ has a random approximation error $e _ { s a } ^ { i }$ :
124
+
125
+ $$
126
+ Q ^ { i } ( s , a ) = Q ^ { \pi } ( s , a ) + e _ { s a } ^ { i }
127
+ $$
128
+
129
+ where for each fixed $s { \mathrm { . } }$ , $\{ e _ { s a } ^ { i } \}$ are zero-mean independent random variables such that $\{ e _ { s a } ^ { i } \}$ are identically distributed across $i$ for each fixed $( s , a )$ pair. Note that due to the zero-mean assumption, the expected pre-update estimation bias is $\mathbb { E } [ Q ^ { i } ( s , a ) - Q ^ { \pi } ( s , a ) ] = 0$ . Thus if $\mathbb { E } \big [ Z _ { M , N } \big ] > 0$ , then the expected post-update bias is positive and there is a tendency for over-estimation accumulation; and if $\mathbf { \mathbb { E } } \big [ Z _ { M , N } \big ] < \mathbf { \dot { 0 } }$ , then there is a tendency for under-estimation accumulation.
130
+
131
+ Theorem 1. 1. For any fixed $M$ , $\mathbb { E } \left[ Z _ { M , N } \right]$ does not depend on $N$ .
132
+
133
+ 2. $\mathbb { E } \left[ Z _ { 1 , N } \right] \geq 0$ for all $N \geq 1$ .
134
+
135
+ 3. $\mathbb E \big [ Z _ { M + 1 , N } \big ] \leq \mathbb E \big [ Z _ { M , N } \big ]$ for any $M < N$ .
136
+
137
+ 4. Suppose that $e _ { s a } ^ { i } \leq c$ for some $c > 0$ for all s, a and $i$ . Then there exists an $M$ such that for all $N \geq M$ , $\mathbb { E } \big [ Z _ { M , N } \big ] < 0$ .
138
+
139
+ Points 2-4 of the Theorem indicate that we can control the expected post-update bias $\mathbb { E } \left[ Z _ { M , N } \right]$ , bringing it from above zero (over estimation) to under zero (under estimation) by increasing $\bar { M }$ . Moreover, from the first point, the expected bias only depends on $M$ , which implies that increasing $N$ can reduce the variance of the ensemble average but does not change the expected post-update bias. Thus, we can control the post-update bias with $M$ and separately control the variance of the average of the ensemble with $N$ . Note that this is not possible for Maxmin Q-learning, for which $M = N$ , and thus increasing the ensemble size $N$ will also decrease the post-update bias, potentially making it more negative, which can be detrimental. Note that this also cannot be done for standard ensemble averaging, for which there is no in-target minimization parameter $M$ .
140
+
141
+ Note we make very weak assumptions on the distribution of the error term. Thrun & Schwartz (1993) and Lan et al. (2020) make a strong assumption, namely, the error term is uniformly distributed. Because our assumption is much weaker, our proof methodology in the Appendix is very different.
142
+
143
+ We also consider a variant of REDQ where instead of choosing a random set of size $M$ in the target, we calculate the target by taking the expected value over all possible subsets of size $M$ . In this case, the target in the tabular version becomes
144
+
145
+ $$
146
+ Y _ { M , N } = r ( s , a ) + \gamma \frac { 1 } { { \binom { N } { M } } } \sum _ { \stackrel { B \subset \mathcal { N } } { | B | = M } } \operatorname* { m a x } _ { a ^ { \prime } } \operatorname* { m i n } _ { j \in B } Q ^ { j } ( s ^ { \prime } , a ^ { \prime } )
147
+ $$
148
+
149
+ We write the target here as $Y _ { M , N }$ to emphasize its dependence on both $M$ and $N$ . We refer to this variant of REDQ as “Weighted” since we can efficiently calculate the target as a weighted sum of a re-ordering of the $N$ Q-functions, as described in the Appendix.
150
+
151
+ The following theorem shows that the variance of this target goes to zero as $N \infty$ . We note, however, that in practice, some variance in the target may be beneficial in reducing overfitting or help exploration. We can retain some variance by keeping $N$ finite or using the unweighted REDQ scheme.
152
+
153
+ Let $\begin{array} { r } { v _ { M } : = \operatorname { V a r } ( \operatorname* { m a x } _ { a ^ { \prime } } \operatorname* { m i n } _ { j \in B } Q ^ { j } ( s ^ { \prime } , a ^ { \prime } ) ) } \end{array}$ for any subset $B \subset { \mathcal { N } }$ where $| B | = M$ . (It is easily seen that $v _ { M }$ only depends on $M$ and not only the specific elements of $B$ .)
154
+
155
+ # Theorem 2.
156
+
157
+ $$
158
+ \mathrm { V a r } ( Y _ { M , N } ) \leq G _ { M } ( N )
159
+ $$
160
+
161
+ for some function $G _ { M } ( N )$ satisfying
162
+
163
+ $$
164
+ \operatorname* { l i m } _ { N \infty } \frac { G _ { M } ( N ) } { M ^ { 2 } v _ { M } / N } = 1
165
+ $$
166
+
167
+ Consequently,
168
+
169
+ $$
170
+ \operatorname* { l i m } _ { N \infty } \mathrm { V a r } ( Y _ { M , N } ) = 0
171
+ $$
172
+
173
+ Also in the Appendix we show that the tabular version of REDQ convergences to the optimal Q function with probability one.
174
+
175
+ # 4 REDQ VARIANTS AND ABLATIONS
176
+
177
+ In this section, we use ablations to provide further insight into REDQ. We focus on the Ant environment. We first look at how the ensemble size $N$ affects REDQ. The top row in Figure 3 shows REDQ with $N = 2 , 3 , 5 , 1 0 ,$ 15. We can see that when we increase the ensemble size, we generally get a more stable average bias, a lower std of bias, and stronger performance. The result shows that even a small ensemble (e.g., $N = 5$ ) can greatly help in stabilizing bias accumulation when training under high UTD.
178
+
179
+ ![](images/2c1c83ca9f024eb267901a55655271fb8e95334ae11d5bdf509513d0921f185b.jpg)
180
+ Figure 3: REDQ ablation results for Ant. The top row shows the effect of the ensemble size $N$ . The middle row shows the effect of the in-target minimization parameter $M$ . The bottom row compares REDQ to several variants.
181
+
182
+ The middle row of Figure 3 shows how $M$ , the in-target minimization parameter, can affect performance. When $M$ is not an integer, e.g., $M = 1 . 5$ , for each update, with probability 0.5 only one randomly-chosen Q function is used in the target, and with probability 0.5, two randomly-chosen functions are used. Similarly, for $M = 2 . 5$ , for each update either two or three Q functions are used. Consistent with the theoretical result in Theorem 1, by increasing $M$ we lower the average bias. When $M$ gets too large, the Q estimate becomes too conservative and the large negative bias makes learning difficult.
183
+
184
+ $M = 2$ , which has the overall best performance, strikes a good balance between average bias (small underestimation during most of training) and std of the bias (consistently small).
185
+
186
+ The bottom row of Figure 3 shows the results for different target computation methods. The Maxmin curve in the figures is a variant based on Maxmin Q-learning, where the min of all the Q networks in the ensemble is taken to compute the Q target. As the ensemble size increases, Maxmin Q-learning shifts from overestimation to underestimation (Lan et al., 2020); Figure 3 shows Maxmin with $N =$ 3 instead of $N = 1 0$ , since a large $N$ value will cause even more divergence of the Q values. When varying the ensemble size of Maxmin, we see the same problem as shown in the middle row of Figure 3. When we increase the ensemble size to be larger than 3, Maxmin starts to reduce the bias so much that we get a highly negative Q bias, which accumulates quickly, leading to instability in the Q networks and poor performance. In the Maxmin paper, it was mainly tested on Atari environments with a small finite action space, in which case it provides good performance. Our results show that when using environments with high-dimensional continuous action spaces, such as MuJoCo, the rapid accumulation of (negative) bias becomes a problem. This result parallels some recent research in offline (i.e., batch) DRL. In Agarwal et al. (2020), it is shown that with small finite action spaces, naive offline training with deep Q-networks (DQN) only slightly reduces performance. However, continuous action Q-learning based methods such as Deep Deterministic Policy Gradient and SAC suffer much more from Q bias accumulation compared to discrete action methods. Recent work shows that offline training with these methods often lead to poor performance, and can even entirely diverge (Fujimoto et al., 2019; Kumar et al., 2019).
187
+
188
+ Random ensemble mixture (REM) is a method originally proposed to boost performance of DQN in the discrete-action setting. REM uses the random convex combination of Q values to compute the target: it is similar to ensemble average (AVG), but with more randomization (Agarwal et al., 2020).
189
+
190
+ For Weighted, the target is computed as the expectation of all the REDQ targets, where the expectation is taken over all $N$ -choose-2 pairs of Q-functions. This leads to a formula that is a weighted sum of the ordered Q-functions, where the ordering is from the lowest to the highest Q value in the ensemble, as described in the Appendix. Our baseline REDQ in Algorithm 1 can be considered as a random-sample version of Weighted. For the MinPair REDQ variant, we divide the $1 0 \mathrm { Q }$ networks into 5 fixed pairs, and during an update we sample a pair of Q networks from these 5 fixed pairs.
191
+
192
+ From Figure 3 we see that REDQ and MinPair are the best and their performance is similar. For Ant, the performance of Weighted is much lower than REDQ. However, as shown in the Appendix, Weighted and REDQ have similar performance for the other three environments. The randomization might help alleviate overfitting in the early stage, or improve exploration. REM has performance similar to AVG, studied in Section 3. In terms of the Q bias, REM has a positive average bias, while REDQ, MinPair, and Weighted all have a small negative average bias. Overall these results indicate that the REDQ algorithm is robust across different mechanisms for choosing the functions, and that randomly choosing the Q functions can sometimes boost performance. Additional results and discussions are provided in the appendix.
193
+
194
+ # 4.1 IMPROVING REDQ WITH AUXILIARY FEATURE LEARNING
195
+
196
+ We now investigate whether we can further improve the performance of REDQ by incorporating better representation learning? Ota et al. (2020) recently proposed the online feature extractor network (OFENet), which learns representation vectors from environment data, and provides them to the agent as additional input, giving significant performance improvement.
197
+
198
+ Is it possible to further improve the performance of REDQ with OFENet? We trained an OFENet together with REDQ to provide extra input, giving the algorithm REDQ-OFE. We found that OFENet did not help much for Hopper and Walker2d, which may be because REDQ already learns very fast, leaving little room for improvement. But as shown in Figure 4, online feature extraction can further improve REDQ performance for the more challenging environments Ant and Humanoid.
199
+
200
+ REDQ-OFE achieves $7 \mathbf { x }$ the sample efficiency of SAC to reach 5000 on Ant and Humanoid, and outperforms MBPO with $3 . 1 2 \mathrm { x }$ and $1 . 2 6 \mathrm { x }$ the performance of MBPO at 150K and 300K data, respectively. A more detailed performance comparison table can be found in the Appendix.
201
+
202
+ ![](images/6f7eacb7d82e11c9f4c74e1e673f1d8d657ff551d411650c43ed477a1022ecc7.jpg)
203
+ Figure 4: Performance of REDQ, REDQ with OFE, and SAC.
204
+
205
+ # 5 RELATED WORK
206
+
207
+ It has long been recognized that maximization bias in Q-learning can significantly impede learning. Thrun & Schwartz (1993) first highlighted the existence of maximization bias. Van Hasselt (2010) proposed Double Q-Learning to address maximization bias for the tabular case, and showed that in general it leads to an under-estimation bias. Van Hasselt et al. (2016) showed that adding Double Q-learning to deep Q networks (DQN) (Mnih et al., 2013; 2015) gives a major performance boost for the Atari games benchmark. For continuous-action spaces, Fujimoto et al. (2018) introduced clipped-double Q-learning (CDQ), which further reduces maximization bias and brings significant improvements over the deep deterministic policy gradient (DDPG) algorithm (Lillicrap et al., 2015). CDQ was later combined with entropy maximization in SAC to achieve even stronger performance (Haarnoja et al., 2018a;b). Other bias reduction techniques include using bias-correction terms (Lee et al., 2013), using weighted Q estimates (Zhang et al., 2017; Li & Hou, 2019), penalizing deterministic policies at early stage of training (Fox et al., 2015), using multi-step methods (Meng et al., 2020), performing weighted Bellman updates to mitigate error propagation (Lee et al., 2020), and truncating sampled Q estimates with distributional networks (Kuznetsov et al., 2020).
208
+
209
+ It has also long been recognized that using ensembles can improve the performance of DRL algorithms (Faußer & Schwenker, 2015; Osband et al., 2016). For Q-learning based methods, Anschel et al. (2017) use the average of multiple Q estimates to reduce variance. Agarwal et al. (2020) introduced Random Ensemble Mixture (REM), which enforces optimal Bellman consistency on random convex combinations of multiple Q estimates. Lan et al. (2020) introduced Maxmin Q-learning, as discussed in Sections 2-4. Although in discrete action domains it has been found that fine-tuning DQN variants, including the UTD, can boost performance, little experimental or theoretical analysis is given to explain how this improvement is obtained (Kielak, 2020; van Hasselt et al., 2019).
210
+
211
+ To address some of the critical issues in model-based learning (Langlois et al., 2019), recent methods such as MBPO combine a model ensemble with a carefully controlled rollout horizon to obtain better performance (Janner et al., 2019; Buckman et al., 2018). These model-based methods can also be enhanced with advanced sampling (Zhang et al., 2020), bidirectional models (Lai et al., 2020), or backprop through the model (Clavera et al., 2020), and be analyzed through new theoretical frameworks (Rajeswaran et al., 2020; Dong et al., 2020).
212
+
213
+ # 6 CONCLUSION
214
+
215
+ The contributions of this paper are as follows. (1) We propose a simple model-free algorithm that attains sample efficiency that is as good as or better than state-of-the-art model-based algorithms for the MuJoCo benchmark. This result indicates that, at least for the MuJoCo benchmark, models may not be necessary for achieving high sample efficiency. (2) Using carefully designed experiments, we explain why REDQ succeeds when other model-free algorithms with high UTD ratios fail. (3) Finally, we combine REDQ with OFE, and show that REDQ-OFE can learn extremely fast for the challenging environments Ant and Humanoid.
216
+
217
+ # REFERENCES
218
+
219
+ Rishabh Agarwal, Dale Schuurmans, and Mohammad Norouzi. An optimistic perspective on offline reinforcement learning. In International Conference on Machine Learning (ICML), 2020.
220
+
221
+ Oron Anschel, Nir Baram, and Nahum Shimkin. Averaged-dqn: Variance reduction and stabilization for deep reinforcement learning. In International Conference on Machine Learning, pp. 176–185, 2017.
222
+
223
+ Dimitri P Bertsekas and John N Tsitsiklis. Neuro-dynamic programming, volume 5. Athena Scientific Belmont, MA, 1996.
224
+
225
+ Ronen I Brafman and Moshe Tennenholtz. R-max-a general polynomial time algorithm for nearoptimal reinforcement learning. Journal of Machine Learning Research, 3(Oct):213–231, 2002.
226
+
227
+ Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym. arXiv preprint arXiv:1606.01540, 2016.
228
+
229
+ Jacob Buckman, Danijar Hafner, George Tucker, Eugene Brevdo, and Honglak Lee. Sampleefficient reinforcement learning with stochastic ensemble value expansion. In Advances in Neural Information Processing Systems, pp. 8224–8234, 2018.
230
+
231
+ Kamil Ciosek, Quan Vuong, Robert Loftin, and Katja Hofmann. Better exploration with optimistic actor critic. In Advances in Neural Information Processing Systems, pp. 1787–1798, 2019.
232
+
233
+ Ignasi Clavera, Violet Fu, and Pieter Abbeel. Model-augmented actor-critic: Backpropagating through paths. arXiv preprint arXiv:2005.08068, 2020.
234
+
235
+ Kefan Dong, Yuping Luo, Tianhe Yu, Chelsea Finn, and Tengyu Ma. On the expressivity of neural networks for deep reinforcement learning. International Conference on Machine Learning (ICML), 2020.
236
+
237
+ Yan Duan, Xi Chen, Rein Houthooft, John Schulman, and Pieter Abbeel. Benchmarking deep reinforcement learning for continuous control. In International Conference on Machine Learning, pp. 1329–1338, 2016.
238
+
239
+ Stefan Faußer and Friedhelm Schwenker. Neural network ensembles in reinforcement learning. Neural Processing Letters, 41(1):55–69, 2015.
240
+
241
+ Meire Fortunato, Mohammad Gheshlaghi Azar, Bilal Piot, Jacob Menick, Ian Osband, Alex Graves, Vlad Mnih, Remi Munos, Demis Hassabis, Olivier Pietquin, et al. Noisy networks for exploration. ICLR, 2018.
242
+
243
+ Roy Fox, Ari Pakman, and Naftali Tishby. Taming the noise in reinforcement learning via soft updates. arXiv preprint arXiv:1512.08562, 2015.
244
+
245
+ Scott Fujimoto, Herke van Hoof, and Dave Meger. Addressing function approximation error in actor-critic methods. arXiv preprint arXiv:1802.09477, 2018.
246
+
247
+ Scott Fujimoto, David Meger, and Doina Precup. Off-policy deep reinforcement learning without exploration. In International Conference on Machine Learning, pp. 2052–2062, 2019.
248
+
249
+ Tuomas Haarnoja, Aurick Zhou, Pieter Abbeel, and Sergey Levine. Soft actor-critic: Offpolicy maximum entropy deep reinforcement learning with a stochastic actor. arXiv preprint arXiv:1801.01290, 2018a.
250
+
251
+ Tuomas Haarnoja, Aurick Zhou, Kristian Hartikainen, George Tucker, Sehoon Ha, Jie Tan, Vikash Kumar, Henry Zhu, Abhishek Gupta, Pieter Abbeel, et al. Soft actor-critic algorithms and applications. arXiv preprint arXiv:1812.05905, 2018b.
252
+
253
+ Peter Henderson, Riashat Islam, Philip Bachman, Joelle Pineau, Doina Precup, and David Meger. Deep reinforcement learning that matters. In Thirty-Second AAAI Conference on Artificial Intelligence, 2018.
254
+
255
+ Riashat Islam, Peter Henderson, Maziar Gomrokchi, and Doina Precup. Reproducibility of benchmarked deep reinforcement learning tasks for continuous control. arXiv preprint arXiv:1708.04133, 2017.
256
+
257
+ Michael Janner, Justin Fu, Marvin Zhang, and Sergey Levine. When to trust your model: Modelbased policy optimization. In Advances in Neural Information Processing Systems, pp. 12519– 12530, 2019.
258
+
259
+ Kacper Kielak. Do recent advancements in model-based deep reinforcement learning really improve data efficiency? arXiv preprint arXiv:2003.10181, 2020.
260
+
261
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
262
+
263
+ Aviral Kumar, Justin Fu, Matthew Soh, George Tucker, and Sergey Levine. Stabilizing off-policy q-learning via bootstrapping error reduction. In Advances in Neural Information Processing Systems, pp. 11784–11794, 2019.
264
+
265
+ Arsenii Kuznetsov, Pavel Shvechikov, Alexander Grishin, and Dmitry Vetrov. Controlling overestimation bias with truncated mixture of continuous distributional quantile critics. arXiv preprint arXiv:2005.04269, 2020.
266
+
267
+ Hang Lai, Jian Shen, Weinan Zhang, and Yong Yu. Bidirectional model-based policy optimization. arXiv preprint arXiv:2007.01995, 2020.
268
+
269
+ Qingfeng Lan, Yangchen Pan, Alona Fyshe, and Martha White. Maxmin q-learning: Controlling the estimation bias of q-learning. arXiv preprint arXiv:2002.06487, 2020.
270
+
271
+ Eric Langlois, Shunshi Zhang, Guodong Zhang, Pieter Abbeel, and Jimmy Ba. Benchmarking model-based reinforcement learning. arXiv preprint arXiv:1907.02057, 2019.
272
+
273
+ Donghun Lee, Boris Defourny, and Warren B Powell. Bias-corrected q-learning to control maxoperator bias in q-learning. In 2013 IEEE Symposium on Adaptive Dynamic Programming and Reinforcement Learning (ADPRL), pp. 93–99. IEEE, 2013.
274
+
275
+ Kimin Lee, Michael Laskin, Aravind Srinivas, and Pieter Abbeel. Sunrise: A simple unified framework for ensemble learning in deep reinforcement learning. arXiv preprint arXiv:2007.04938, 2020.
276
+
277
+ Zhunan Li and Xinwen Hou. Mixing update q-value for deep reinforcement learning. In 2019 International Joint Conference on Neural Networks (IJCNN), pp. 1–6. IEEE, 2019.
278
+
279
+ Timothy P Lillicrap, Jonathan J Hunt, Alexander Pritzel, Nicolas Heess, Tom Erez, Yuval Tassa, David Silver, and Daan Wierstra. Continuous control with deep reinforcement learning. arXiv preprint arXiv:1509.02971, 2015.
280
+
281
+ Lingheng Meng, Rob Gorbet, and Dana Kulic. The effect of multi-step methods on overestimation ´ in deep reinforcement learning. arXiv preprint arXiv:2006.12692, 2020.
282
+
283
+ Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Alex Graves, Ioannis Antonoglou, Daan Wierstra, and Martin Riedmiller. Playing atari with deep reinforcement learning. arXiv preprint arXiv:1312.5602, 2013.
284
+
285
+ Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 518(7540):529, 2015.
286
+
287
+ Ian Osband, Charles Blundell, Alexander Pritzel, and Benjamin Van Roy. Deep exploration via bootstrapped dqn. In Advances in neural information processing systems, pp. 4026–4034, 2016.
288
+
289
+ Kei Ota, Tomoaki Oiki, Devesh K Jha, Toshisada Mariyama, and Daniel Nikovski. Can increasing input dimensionality improve deep reinforcement learning? arXiv preprint arXiv:2003.01629, 2020.
290
+
291
+ Aravind Rajeswaran, Igor Mordatch, and Vikash Kumar. A game theoretic framework for model based reinforcement learning. arXiv preprint arXiv:2004.07804, 2020.
292
+
293
+ Richard S Sutton and Andrew G Barto. Reinforcement learning: An introduction. MIT press, 2018.
294
+
295
+ Sebastian Thrun and Anton Schwartz. Issues in using function approximation for reinforcement learning. In Proceedings of the 1993 Connectionist Models Summer School Hillsdale, NJ. Lawrence Erlbaum, 1993.
296
+
297
+ 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.
298
+
299
+ John N Tsitsiklis. Asynchronous stochastic approximation and q-learning. Machine learning, 16 (3):185–202, 1994.
300
+
301
+ Hado Van Hasselt. Double q-learning. In Advances in neural information processing systems, pp. 2613–2621, 2010.
302
+
303
+ Hado Van Hasselt, Arthur Guez, and David Silver. Deep reinforcement learning with double qlearning. In AAAI, volume 2, pp. 5. Phoenix, AZ, 2016.
304
+
305
+ Hado P van Hasselt, Matteo Hessel, and John Aslanides. When to use parametric models in reinforcement learning? In Advances in Neural Information Processing Systems, pp. 14322–14333, 2019.
306
+
307
+ Che Wang, Yanqiu Wu, Quan Vuong, and Keith Ross. Striving for simplicity and performance in off-policy drl: Output normalization and non-uniform sampling. arXiv, pp. arXiv–1910, 2019.
308
+
309
+ Chi Zhang, Sanmukh Rao Kuppannagari, and Viktor K Prasanna. Maximum entropy model rollouts: Fast model based policy optimization without compounding errors. arXiv preprint arXiv:2006.04802, 2020.
310
+
311
+ Zongzhang Zhang, Zhiyuan Pan, and Mykel J Kochenderfer. Weighted double q-learning. In IJCAI, pp. 3455–3461, 2017.
312
+
313
+ # A THEORETICAL RESULTS
314
+
315
+ # A.1 TABULAR VERSION OF REDQ
316
+
317
+ In the tabular algorithm below, for clarity we use $G = 1$ .
318
+
319
+ # Algorithm 2 Tabular REDQ
320
+
321
+ 1: Initialize 2: repeat3: Choo $\left\{ Q ^ { i } ( s , a ) , s \in \mathcal { S } , a \in \mathcal { A } \right\} _ { i = 1 } ^ { N }$ , observe
322
+ $a \in { \mathcal { A } }$ $\left\{ Q ^ { i } ( s , a ) \right\} _ { i = 1 } ^ { N }$ $r$ $s ^ { \prime }$
323
+ 4: Randomly choose a subset $\mathcal { M }$ of size $M$ from $\{ 1 , . . , N \}$
324
+ 5: $\begin{array} { r } { y = r + \gamma \operatorname* { m a x } _ { a ^ { \prime } \in \mathcal { A } } \operatorname* { m i n } _ { j \in \mathcal { M } } Q ^ { j } ( s ^ { \prime } , a ^ { \prime } ) } \end{array}$
325
+ 6: for $i = 1 , \ldots , N$ do:
326
+ 7: $Q ^ { i } ( s , a ) \stackrel { . } { } Q ^ { i } ( s , a ) + \alpha ( y - Q ^ { i } ( s , a ) )$
327
+ 8: $s \gets s ^ { \prime }$
328
+ 9: until end
329
+
330
+ Alternatively in Algorithm 2, at each iteration we could just update one of the $Q ^ { i }$ functions.
331
+
332
+ # A.2 PROOF OF THEOREM 1
333
+
334
+ We first prove the following lemma:
335
+
336
+ Lemma 1. Let $X _ { 1 } , X _ { 2 } , \ldots$ be an infinite sequence of i.i.d. random variables. Let $F ( x )$ be the cdf of $X _ { m }$ and let $\tau = \operatorname* { i n f } \{ x : F ( x ) > 0 \}$ . Also let $Y _ { m } = \operatorname* { m i n } \{ X _ { 1 } , X _ { 2 } , \dots , X _ { m } \}$ . Then $Y _ { 1 } , Y _ { 2 } , \dots$ converges to $\tau$ almost surely.
337
+
338
+ # Proof:
339
+
340
+ Let $F _ { m } ( x )$ be the cdf of $Y _ { m }$ . Since $X _ { 1 } , . . . , X _ { m }$ are independent,
341
+
342
+ $$
343
+ F _ { m } ( x ) = 1 - [ 1 - F ( x ) ] ^ { m }
344
+ $$
345
+
346
+ For $x \ < \ \tau$ , $F _ { m } ( x ) = 0$ since $F ( x ) = 0$ . For $x > \tau , F _ { m } ( x ) \xrightarrow { m \infty } 1 \quad$ . Therefore, $Y _ { m }$ weakly converges to $\tau$ .
347
+
348
+ Moreover, for each $\omega \in \Omega$ , $\{ Y _ { m } ( \omega ) \}$ is a decreasing sequence. So $\{ Y _ { m } ( \omega ) \}$ either converges to a real number or $- \infty$ . Therefore $Y _ { m } Y$ almost surely for some random variable $Y$ . Combined with the result that $Y _ { m } \overset { d } { \to } \tau$ , we can conclude that
349
+
350
+ $$
351
+ Y _ { m } \xrightarrow { a . s . } \tau
352
+ $$
353
+
354
+ # Proof of Theorem 1:
355
+
356
+ 1. Let $B _ { 1 } , B _ { 2 }$ be two subsets of $\mathcal { N } = \{ 1 , . . . , N \}$ of size $M$ . First of all, since $\{ Q ^ { j } ( s , a ) \} _ { j = 1 } ^ { N }$ are i.i.d for any $a \in \mathcal { A } , \operatorname* { m i n } _ { j \in B _ { 1 } } Q ^ { j } ( s , a )$ and $\textstyle \operatorname* { m i n } _ { j \in B _ { 2 } } Q ^ { j } ( s , a )$ are identically distributed. Furthermore, since $Q ^ { j } ( s , a )$ are independent for all $a \in { \mathcal { A } }$ and $1 \leq j \leq N$ , $\textstyle { \left\{ \operatorname* { m i n } _ { j \in B } Q ^ { j } ( s , a ) \right\} } _ { a \in { \mathcal { A } } }$ are independent for any $B \subset { \mathcal { N } }$ . Denote the distribution function of $\textstyle \operatorname* { m a x } _ { a } \operatorname* { m i n } _ { j \in B _ { 1 } } Q ^ { j } ( s , a )$ as $F _ { 1 } ( x )$ and the distribution function of $\textstyle \operatorname* { m a x } _ { a } \operatorname* { m i n } _ { j \in B _ { 2 } } Q ^ { j } { \big ( } s , a { \big ) }$ as $F _ { 2 } ( x )$ . Then for any $x \in \mathbb { R }$ ,
357
+
358
+ $$
359
+ \begin{array} { r l } & { F _ { 1 } ( x ) = \mathbb { P } \big ( \underset { a } { \operatorname* { m a x } } \underset { j \in B _ { 1 } } { \operatorname* { m i n } } Q ^ { j } ( s , a ) \le x \big ) = \mathbb { P } \big ( \cap _ { a \in \mathcal { A } } \left\{ \underset { i \in B _ { 1 } } { \operatorname* { m i n } } Q ^ { j } ( s , a ) \le x \right\} \big ) } \\ & { \quad \quad = \underset { a \in \mathcal { A } } { \prod } \mathbb { P } \big ( \underset { j \in B _ { 1 } } { \operatorname* { m i n } } Q ^ { j } ( s , a ) \le x \big ) = \underset { a \in \mathcal { A } } { \prod } \mathbb { P } \big ( \underset { j \in B _ { 2 } } { \operatorname* { m i n } } Q ^ { j } ( s , a ) \le x \big ) } \\ & { \quad \quad = \mathbb { P } \big ( \underset { a } { \operatorname* { m a x } } \underset { j \in B _ { 2 } } { \operatorname* { m i n } } Q ^ { j } ( s , a ) \le x \big ) = F _ { 2 } ( x ) } \end{array}
360
+ $$
361
+
362
+ Therefore, we have proved that $\textstyle \operatorname* { m a x } _ { a } \operatorname* { m i n } _ { j \in B _ { 1 } } Q ^ { j } ( s , a )$ and $\textstyle \operatorname* { m a x } _ { a } \operatorname* { m i n } _ { j \in B _ { 2 } } Q ^ { j } ( s , a )$ are identically distributed. Then
363
+
364
+ $$
365
+ \begin{array} { r l } & { \mathbb { E } \big [ Z _ { M , N } \big ] = \gamma \mathbb { E } \big [ ( \underset { a } { \operatorname* { m a x } } \underset { j \in \mathcal { M } } { \operatorname* { m i n } } Q ^ { j } ( s , a ) - \underset { a } { \operatorname* { m a x } } Q ^ { \pi } ( s , a ) ) \big ] } \\ & { \quad \quad \quad = \gamma \mathbb { E } \big [ \frac { 1 } { \binom { N } { M } } \underset { | B | = M } { \overset { \sum } { \sum } } \underset { \substack { i \geq N } } { \operatorname* { m a x } } \underset { j \in B } { \operatorname* { m i n } } Q ^ { j } ( s , a ) \big ] - \gamma \underset { a } { \operatorname* { m a x } } Q ^ { \pi } ( s , a ) } \\ & { \quad \quad \quad = \gamma \bigg ( \mathbb { E } \big [ \underset { a } { \operatorname* { m a x } } \underset { 1 \leq j \leq M } { \operatorname* { m i n } } Q ^ { j } ( s , a ) \big ] - \underset { a } { \operatorname* { m a x } } Q ^ { \pi } ( s , a ) \bigg ) } \end{array}
366
+ $$
367
+
368
+ which does not depend on $N$ .
369
+
370
+ 2. It follows from 1 that
371
+
372
+ $$
373
+ \mathbb { E } \big [ Z _ { 1 , N } \big ] = \gamma \bigg ( \mathbb { E } \big [ \operatorname* { m a x } _ { a } Q ^ { 1 } ( s , a ) \big ] - \operatorname* { m a x } _ { a } Q ^ { \pi } ( s , a ) \bigg )
374
+ $$
375
+
376
+ Since $\operatorname* { m a x } _ { a } Q ^ { 1 } ( s , a ) \geq Q ^ { 1 } ( s , a ^ { \prime } )$ for all $a ^ { \prime } \in { \mathcal { A } }$ , we have
377
+
378
+ $$
379
+ \mathbb { E } \big [ \operatorname* { m a x } _ { a } Q ^ { 1 } ( s , a ) \big ] \geq \mathbb { E } \big [ Q ^ { 1 } ( s , a ^ { \prime } ) \big ]
380
+ $$
381
+
382
+ for all $a ^ { \prime } \in { \mathcal { A } }$ . Consequently,
383
+
384
+ $$
385
+ \mathbb { E } \big [ \operatorname* { m a x } _ { a } Q ^ { 1 } ( s , a ) \big ] \geq \operatorname* { m a x } _ { a } \mathbb { E } \big [ Q ^ { 1 } ( s , a ) \big ] = \operatorname* { m a x } _ { a } Q ^ { \pi } ( s , a )
386
+ $$
387
+
388
+ $$
389
+ \begin{array} { r l } & { \qquad \mathbf { \Phi } _ { a } ^ { a } } \\ & { \qquad \mathbb { E } \left[ Z _ { 1 , N } \right] = \gamma \left( \mathbb { E } \left[ \underset { a } { \mathrm { m a x } } Q ^ { 1 } ( s , a ) \right] - \underset { a } { \mathrm { m a x } } Q ^ { \pi } ( s , a ) \right) \geq 0 } \\ & { \qquad \mathrm { m a x } _ { a } \mathrm { m i n } _ { 1 \leq j \leq M } Q ^ { j } ( s , a ) \geq \mathrm { m a x } _ { a } \mathrm { m i n } _ { 1 \leq j \leq M + 1 } Q ^ { j } ( s , a ) , } \\ & { \qquad \mathbb { E } \left[ Z _ { M , N } \right] = \gamma \left( \mathbb { E } \left[ \underset { a } { \mathrm { m a x } } \underset { 1 \leq j \leq M + 1 } { \mathrm { m i n } } Q ^ { j } ( s , a ) \right] - \underset { a } { \mathrm { m a x } } Q ^ { \pi } ( s , a ) \right) } \\ & { \qquad \geq \gamma \left( \mathbb { E } \left[ \underset { a } { \mathrm { m a x } } \underset { 1 \leq j \leq M + 1 } { \mathrm { m i n } } Q ^ { j } ( s , a ) \right] - \underset { a } { \mathrm { m a x } } Q ^ { \pi } ( s , a ) \right) = \mathbb { E } \left[ Z _ { M + 1 , N } \right] } \end{array}
390
+ $$
391
+
392
+ 4. Let $F _ { a } ( x )$ be the cdf of $Q ^ { j } ( s , a )$ and let $\tau _ { a } = \operatorname* { i n f } \{ x : F _ { a } ( x ) > 0 \}$ . Here we assume the approximation error $e _ { s a } ^ { i }$ is non-trivial, which implies $\tau _ { a } < Q ^ { \pi } ( s , a )$ . Note that $\tau _ { a }$ can be equal to $- \infty$ . Let
393
+
394
+ $$
395
+ Y _ { a } ^ { M } = \operatorname* { m i n } _ { 1 \leq i \leq M } Q ^ { j } ( s , a )
396
+ $$
397
+
398
+ From Lemma 1 we have $Y _ { a } ^ { M }$ converges to $\tau _ { a }$ almost surely for each $a$ . Because the action space is finite, it therefore follows that
399
+
400
+ $$
401
+ Y ^ { M } = \operatorname* { m a x } _ { a } Y _ { a } ^ { M }
402
+ $$
403
+
404
+ converges almost surely to $\tau = \operatorname* { m a x } _ { a } \tau _ { a }$ . Furthermore, for each $a$ we have
405
+
406
+ $$
407
+ Y _ { a } ^ { M } = \operatorname * { m i n } _ { 1 \leq j \leq M } Q ^ { j } ( s , a ) \geq \operatorname * { m i n } _ { 1 \leq j \leq M + 1 } Q ^ { j } ( s , a ) = Y _ { a } ^ { M + 1 }
408
+ $$
409
+
410
+ from which it follows that $Y ^ { M } \ge Y ^ { M + 1 }$ . Thus $\{ Y ^ { M } \}$ is a monotonically decreasing sequence. We also note that due to the assumption $e _ { s a } ^ { i } \ \leq \ c$ for all $a$ and $i$ , and because $Q ^ { \pi } ( s , a )$ is finite for all $s$ and $a$ , it follows that $Y ^ { M } \leq d$ for all $M$ for a finite $d$ . Thus $\{ Y ^ { M } \}$ is a bounded-above, monotonically-decreasing sequence of random variables which converges almost surely to $\tau$ . We can therefore apply the monotone convergence theorem, giving
411
+
412
+ $$
413
+ \begin{array} { r l } & { \mathbb { E } \big [ Z _ { M , N } \big ] = \gamma \bigg ( \mathbb { E } \big [ \underset { a } { \operatorname* { m a x } } \underset { 1 \leq j \leq M } { \operatorname* { m i n } } Q ^ { j } ( s , a ) \big ] - \underset { a } { \operatorname* { m a x } } Q ^ { \pi } ( s , a ) \bigg ) } \\ & { \quad \quad \quad = \gamma \bigg ( \mathbb { E } [ \underset { a } { \operatorname* { m a x } } Y _ { a } ^ { M } ] - \underset { a } { \operatorname* { m a x } } Q ^ { \pi } ( s , a ) \bigg ) \xrightarrow { M \to \infty } \gamma \bigg ( \underset { a } { \operatorname* { m a x } } \tau _ { a } - \underset { a } { \operatorname* { m a x } } Q ^ { \pi } ( s , a ) \bigg ) < 0 , } \end{array}
414
+ $$
415
+
416
+ where the last inequality follows from $\tau _ { a } < Q ^ { \pi } ( s , a )$ for all actions $a$ .
417
+
418
+ # A.3 PROOF OF THEOREM 2
419
+
420
+ For convenience, define $\begin{array} { r } { Y _ { B } = \operatorname* { m a x } _ { a ^ { \prime } } \operatorname* { m i n } _ { j \in B } Q ^ { j } ( s ^ { \prime } , a ^ { \prime } ) } \end{array}$ . Suppose $N > 2 M$
421
+
422
+ $$
423
+ \begin{array} { l } { { \mathrm { V a r } ( Y _ { M , N } ) = \displaystyle \frac { \gamma ^ { 2 } } { \binom { N } { M } ^ { 2 } } \mathrm { V a r } ( \displaystyle \sum _ { B \subset N } Y _ { B } ) } \ ~ } \\ { { \mathrm { ~ } = \displaystyle \frac { \gamma ^ { 2 } ( M ! ) ^ { 2 } } { \left( \Pi _ { i = 0 } ^ { M - 1 } ( N - i ) \right) ^ { 2 } } \biggl [ \sum _ { B \subset \mathcal { N } } \mathrm { V a r } ( Y _ { B } ) + 2 \cdot \sum _ { B _ { 1 } , B _ { 2 } \subset N } \mathrm { C o v } ( Y _ { B _ { 1 } } , Y _ { B _ { 2 } } ) \biggr ] } } \end{array}
424
+ $$
425
+
426
+ Let $\begin{array} { r } { A = \sum _ { B _ { 1 } , B _ { 2 } \subset \mathcal { N } } \mathrm { C o v } ( Y _ { B _ { 1 } } , Y _ { B _ { 2 } } ) } \\ { B _ { 1 } \ne B _ { 2 } \qquad } \end{array}$ , which consists of
427
+
428
+ $$
429
+ \begin{array} { r l r } { { \binom { \binom { N } { M } } { 2 } = \frac { 1 } { 2 } \cdot \frac { N ! } { ( N - M ) ! M ! } \cdot ( \frac { N ! } { ( N - M ) ! M ! } - 1 ) } } \\ & { } & { = \frac { 1 } { 2 ( M ! ) ^ { 2 } } \cdot \Pi _ { i = 0 } ^ { M - 1 } ( N - i ) ^ { 2 } - \frac { N ! } { 2 \cdot M ! ( N - M ) ! } } \end{array}
430
+ $$
431
+
432
+ terms. $\binom { \binom { N } { M } } { 2 }$ can be seen as a polynomial function of $N$ with degree $2 M$ . The coefficient for the term $N ^ { 2 M }$ i s 12(M!)2 . The coefficient for the term N 2M−1 i s $\begin{array} { r } { \frac { 1 } { 2 ( M ! ) ^ { 2 } } \cdot ( - 2 \sum _ { i = 0 } ^ { M - 1 } i ) } \end{array}$
433
+
434
+ Note that $Y _ { B _ { 1 } }$ and $Y _ { B _ { 2 } }$ are independent if $B _ { 1 } \cap B _ { 2 } = \mathcal { O }$ . The total number of different pairs $( B _ { 1 } , B _ { 2 } )$ such that $B _ { 1 } \cap B _ { 2 } = \emptyset$ is
435
+
436
+ $$
437
+ { \binom { N } { 2 M } } \cdot { \binom { 2 M } { M } } \cdot { \frac { 1 } { 2 } } = { \frac { 1 } { 2 ( M ! ) ^ { 2 } } } \cdot { \frac { N ! } { ( N - 2 M ) ! } } = { \frac { 1 } { 2 ( M ! ) ^ { 2 } } } \cdot \Pi _ { i = 0 } ^ { 2 M - 1 } ( N - i )
438
+ $$
439
+
440
+ This is again a polynomial function of $N$ with degree $2 M$ . The coefficient of the term $N ^ { 2 M }$ is 12(M!)2 . The coefficient of the term N 2M−1 is $\begin{array} { r } { \frac { 1 } { 2 ( M ! ) ^ { 2 } } \cdot ( - \sum _ { i = 0 } ^ { 2 M - 1 } i ) } \end{array}$ . So the number of non-zero terms in $A$ is at most
441
+
442
+ $$
443
+ \begin{array} { l } { { { \displaystyle { \frac { 1 } { 2 ( M ! ) ^ { 2 } } } \cdot \Pi _ { i = 0 } ^ { M - 1 } ( N - i ) ^ { 2 } - { \displaystyle { \frac { N ! } { 2 \cdot M ! ( N - M ) ! } } } - { \displaystyle { \frac { 1 } { 2 ( M ! ) ^ { 2 } } } \cdot \Pi _ { i = 0 } ^ { 2 M - 1 } ( N - i ) } } } } \\ { { { \displaystyle { = \frac { M ^ { 2 } } { 2 ( M ! ) ^ { 2 } } } \cdot N ^ { 2 M - 1 } + O ( N ^ { 2 M - 2 } ) } } } \end{array}
444
+ $$
445
+
446
+ Moreover, by Cauchy-Schwarz inequality, for any $B _ { 1 } , B _ { 2 } \subset \mathcal { N }$
447
+
448
+ $$
449
+ \mathrm { C o v } ( Y _ { B _ { 1 } } , Y _ { B _ { 2 } } ) \leq \sqrt { \mathrm { V a r } ( Y _ { B _ { 1 } } ) \cdot \mathrm { V a r } ( Y _ { B _ { 2 } } ) } = v _ { M }
450
+ $$
451
+
452
+ Therefore,
453
+
454
+ $$
455
+ A \leq [ \frac { M ^ { 2 } } { 2 ( M ! ) ^ { 2 } } \cdot N ^ { 2 M - 1 } + O ( N ^ { 2 M - 2 } ) ] v _ { M }
456
+ $$
457
+
458
+ which implies
459
+
460
+ $$
461
+ \begin{array} { r l } & { \mathrm { V a r } ( Y _ { M , N } ) = \displaystyle \frac { \gamma ^ { 2 } ( M ! ) ^ { 2 } } { \left( \Pi _ { i = 0 } ^ { M - 1 } ( N - i ) \right) ^ { 2 } } \Biggl [ \sum _ { B \subset \mathcal { N } } \mathrm { V a r } ( Y _ { B } ) + 2 \cdot \sum _ { B _ { 1 } , B _ { 2 } \subset \mathcal { N } } \mathrm { C o v } ( Y _ { B _ { 1 } } , Y _ { B _ { 2 } } ) \Biggr ] } \\ & { \quad \quad \quad = \displaystyle \frac { \gamma ^ { 2 } ( M ! ) ^ { 2 } } { \left( \Pi _ { i = 0 } ^ { M - 1 } ( N - i ) \right) ^ { 2 } } \Biggl [ \sum _ { B \subset \mathcal { N } } \mathrm { V a r } ( Y _ { B } ) + 2 A \Biggr ] } \\ & { \quad \quad \quad \leq \gamma ^ { 2 } \big [ M ^ { 2 } \cdot \frac { N ^ { 2 M - 1 } } { \Pi _ { i = 0 } ^ { M - 1 } ( N - i ) ^ { 2 } } + O ( \frac { 1 } { N ^ { 2 } } ) \big ] v _ { M } \xrightarrow { N \to \infty } 0 } \end{array}
462
+ $$
463
+
464
+ Moreover,
465
+
466
+ $$
467
+ \operatorname* { l i m } _ { N \to \infty } \frac { M ^ { 2 } v _ { M } / N } { \left[ M ^ { 2 } \cdot \frac { N ^ { 2 M - 1 } } { \Pi _ { i = 0 } ^ { M - 1 } ( N - i ) ^ { 2 } } + { \cal O } ( \frac { 1 } { N ^ { 2 } } ) \right] v _ { M } } = \operatorname* { l i m } _ { N \to \infty } \frac { \Pi _ { i = 0 } ^ { M - 1 } ( N - i ) ^ { 2 } } { N ^ { 2 M } } = 1
468
+ $$
469
+
470
+ # A.4 PROOF OF CONVERGENCE OF TABULAR REDQ
471
+
472
+ Assuming that the step size satisfies the standard Robbins-Monro conditions, it is easily seen that the tabular version of REDQ converges with probability 1 to the optimal Q function. In fact, for our Weighted scheme, where we take the expectation over all sets of size $M$ , the convergence conditions in Lan et al. (2020) are fully satisfied.
473
+
474
+ For the randomized case, only very minor changes are needed in the proof in Lan et al. (2020). Note that in the case of REDQ, the underlying deterministic target is:
475
+
476
+ $$
477
+ F \left( Q ^ { 1 } , Q ^ { 2 } , \dots , Q ^ { N } \right) ( s , a ) = r ( s , a ) + \gamma \sum _ { s ^ { \prime } } p \left( s ^ { \prime } \mid s , a \right) \sum _ { \stackrel { B \subset \mathcal { N } } { | B | = M } } \frac { 1 } { \left( { \frac { N } { M } } \right) } \operatorname* { m a x } _ { a ^ { \prime } } \operatorname* { m i n } _ { j \in B } Q ^ { j } ( s ^ { \prime } , a ^ { \prime } )
478
+ $$
479
+
480
+ Let $\tau$ be the operator that concatenates $N$ identical copies of $F$ , so that $\mathcal { T } \colon \mathbb { R } ^ { S \times A \times N } \mathbb { R } ^ { S \times A \times N }$ where $S$ and $A$ are the cardinalities of the state and action spaces, respectively. It is easy to show that the operator $\tau$ is a contraction with the $l _ { \infty }$ norm. The stochastic approximation noise term is given by
481
+
482
+ $$
483
+ \ L _ { \nu } ( s , a ) = R - r ( s , a ) + \gamma \Big [ \operatorname* { m a x } _ { a ^ { \prime } } \operatorname* { m i n } _ { j \in B } Q ^ { j } ( s ^ { \prime } , a ^ { \prime } ) - \sum _ { s ^ { \prime } } p \left( s ^ { \prime } \mid s , a \right) \sum _ { \stackrel { B \subset \mathcal { N } } { | B | = M } } \frac { 1 } { \binom { N } { M } } \operatorname* { m a x } _ { a ^ { \prime } } \operatorname* { m i n } _ { j \in B } Q ^ { j } ( s ^ { \prime } , a ^ { \prime } ) \Big ]
484
+ $$
485
+
486
+ It is straightforward to show
487
+
488
+ $$
489
+ \mathbb { E } \left[ \omega ^ { 2 } ( s , a ) \mid \mathcal { F } _ { \mathrm { p a s t } } \right] \leq \mathrm { V a r } \left( R \mid s , a \right) + \operatorname* { m a x } _ { 1 \leq i \leq N } \operatorname* { m a x } _ { s ^ { \prime } , a ^ { \prime } } \left( Q ^ { i } ( s ^ { \prime } , a ^ { \prime } ) \right) ^ { 2 }
490
+ $$
491
+
492
+ As in Lan et al. (2020), it follows from the contraction property and (2) that REDQ converges with probability 1 to the optimal Q function (Tsitsiklis, 1994; Bertsekas & Tsitsiklis, 1996).
493
+
494
+ # B HYPERPARAMETERS AND IMPLEMENTATION DETAILS
495
+
496
+ Since MBPO builds on top of a SAC agent, to make our comparisons fair, meaningful, and consistent with previous work, we make all SAC related hyperparameters exactly the same as used in the MBPO paper (Janner et al., 2019). Table 1 gives a list of hyperparameter used in the experiments. For all the REDQ curves reported in the results section, we use a Q network ensemble size $N$ of 10. We use a UTD ratio $G$ of 20 on the four MuJoCo environments, which is the same value that was used in the MBPO paper. Thus most of the hyperparameters are made to be the same as in the MBPO paper to ensure fairness and consistency in comparisons.
497
+
498
+ For all the algorithms and variants, we also first obtain 5000 data points by randomly sampling actions from the action space without making parameter updates. In our experiments we found that using a high UTD from the very beginning with a very small amount of data can easily lead to complete divergence on SAC-20. Sampling a number of random datapoints at the start of training is also a common technique that has been used in previous model-free as well as model-based works (Haarnoja et al., 2018a; Fujimoto et al., 2018; Janner et al., 2019).
499
+
500
+ Table 1: REDQ hyperparameters
501
+
502
+ <table><tr><td rowspan=1 colspan=1>Parameter</td><td rowspan=1 colspan=1>Value</td></tr><tr><td rowspan=1 colspan=1>Sharedoptimizerlearning ratediscount (γ)target smoothing coefficient (p)replay buffer sizenumber of hidden layers forall networksnumber of hidden units per layermini-batch sizenonlinearityrandom starting data</td><td rowspan=1 colspan=1>Adam (Kingma&amp; Ba,2014)3.10-40.990.0051062256256ReLU5000</td></tr><tr><td rowspan=1 colspan=1>REDQensemble size Nin-target minimization parameter MUTD ratio G</td><td rowspan=1 colspan=1>10220</td></tr><tr><td rowspan=1 colspan=1>OFENetrandom starting dataOFENet number of pretraining updatesOFENet UTD ratio</td><td rowspan=1 colspan=1>20.000100,0004</td></tr></table>
503
+
504
+ For the REDQ-OFE experiments, we implemented a minimal version of the OFENet in the original paper, with no batchnorm layers. We use the recommended hyperparameters as described in the original paper (Ota et al., 2020). Compared to REDQ without OFENet, the main difference is we now first collect 20,000 random data points (which is accounted for in the training curves), and then pre-train the OFENet for 100,000 updates, with the same learning rate and batch size. We then train OFENet together with REDQ agent, and the OFENet uses a UTD ratio of 4. We tried a simple hyperparameter search on Ant with 200,000, 100,000 and 50,000 pre-train updates, and learning rates of 1e-4, 3e-4, 5e-4, and a OFENet UTD of 1, 4 and 20. However, the results are not very different. It is possible that better results can be obtained through a more extensive hyperparameter search or other modifications.
505
+
506
+ # B.1 EFFICIENT CALCULATION OF TARGET FOR WEIGHTED VERSION OF REDQ
507
+
508
+ In section 4 we provided experimental results for the Weighted version of REDQ. Recall that in this version, instead of sampling a random subset $\mathcal { M }$ in the target, we average over all subsets $B$ in
509
+
510
+ $\{ 1 , \ldots , N \}$ of size $M$ :
511
+
512
+ $$
513
+ y = r + \gamma \frac { 1 } { \binom { N } { M } } \sum _ { B } \left( \operatorname* { m i n } _ { i \in B } Q _ { \phi _ { \mathrm { t a r g } , i } } \left( s ^ { \prime } , \tilde { a } ^ { \prime } \right) \right)
514
+ $$
515
+
516
+ In practice, however, we do not need to sum over all $N$ choose $M$ subsets. Instead we can re-order the indices so that
517
+
518
+ $$
519
+ Q _ { \phi _ { \mathrm { t a r g } , i } } \left( s ^ { \prime } , \tilde { a } ^ { \prime } \right) \leq Q _ { \phi _ { \mathrm { t a r g } , i + 1 } } \left( s ^ { \prime } , \tilde { a } ^ { \prime } \right)
520
+ $$
521
+
522
+ for $i = 1 , \ldots , N - 1$ . After the re-ordering, we can use the identity:
523
+
524
+ $$
525
+ \frac { 1 } { { \binom { N } { M } } } \sum _ { B } \left( \operatorname* { m i n } _ { i \in B } Q _ { \phi _ { \mathrm { t a r g } , i } } \left( s ^ { \prime } , \tilde { a } ^ { \prime } \right) \right) = \frac { 1 } { { \binom { N } { M } } } \sum _ { i = 1 } ^ { N - M + 1 } { \binom { N - i } { M - 1 } } Q _ { \phi _ { \mathrm { t a r g } , i } } \left( s ^ { \prime } , \tilde { a } ^ { \prime } \right)
526
+ $$
527
+
528
+ # C SAMPLE EFFICIENCY COMPARISON FOR REDQ, SAC AND MBPO
529
+
530
+ The sample efficiency claims made in the main paper are based on Table 2 and Table 3. Table 2 shows that compared to naive SAC, REDQ is much more sample efficient. REDQ reaches 3500 on Hopper with ${ 8 } \mathbf { { x } }$ sample efficiency, and reaches 5000 for Ant and Humanoid with ${ 5 } \mathrm { x }$ and $3 . 7 \mathbf { x }$ sample efficiency. After adding OFE, this becomes more than $7 \mathbf { x }$ on Ant and Humanoid. If we average all the numbers for the four environments, then REDQ is $5 . 0 \mathrm { x }$ as sample efficient, and $6 . 4 \mathrm { x }$ after including OFE results.
531
+
532
+ Table 3 compares REDQ to SAC and MBPO. As in the MBPO paper, we train for 125K for Hopper, and 300K for the other three environments (Janner et al., 2019). The numbers in Table 3 show the performance when trained to half and to the full length of the MBPO training limits. When averaging the numbers, we see that REDQ reaches $4 . 5 \mathrm { x }$ and $2 . 1 \mathbf { x }$ the performance of SAC at 150K and 300K. REDQ is also stronger than MBPO, with $1 . 4 \mathrm { x }$ and $1 . 1 \mathrm { x }$ the performance of MBPO at 150K and $3 0 0 \mathrm { K }$ . If we include the results of REDQ-OFE, then the numbers become $5 . 5 \mathrm { x }$ and $2 . 3 \mathbf { x }$ the SAC performance at 150K and 300K, and $1 . 8 \mathrm { x }$ and $1 . 2 \mathrm { x }$ the MBPO performance at 150 and 300K.
533
+
534
+ Table 2: Sample efficiency comparison of SAC and REDQ. The numbers show the amount of data collected when the specified performance level is reached. The last two columns show how many times REDQ and REDQ-OFE are more sample efficient than SAC in reaching that performance.
535
+
536
+ <table><tr><td>Score</td><td>SAC</td><td>REDQ</td><td>REDQ-OFE</td><td>REDQ faster</td><td>REDQ-OFE faster</td></tr><tr><td>Hopper at 3500</td><td>933K</td><td>116K</td><td>1</td><td>8.04</td><td>1</td></tr><tr><td>Walker2d at 3500</td><td>440K</td><td>141K</td><td>=</td><td>3.12</td><td>=</td></tr><tr><td>Ant at 5000</td><td>771K</td><td>153K</td><td>106K</td><td>5.04</td><td>7.27</td></tr><tr><td>Humanoid at 5000</td><td>945K</td><td>255K</td><td>134K</td><td>3.71</td><td>7.05</td></tr></table>
537
+
538
+ Table 3: Performance comparison of REDQ, REDQ-OFE, MBPO and SAC. The numbers show the performance achieved when the specific amount of data is collected. The last two columns show the ratio of REDQ or REDQ-OFE performance compared to SAC and MBPO performance.
539
+
540
+ <table><tr><td>Amount of data</td><td>SAC</td><td>MBPO</td><td>REDQ</td><td>REDQ/SAC</td><td>REDQ/MBPO</td></tr><tr><td>Hopper at 62K</td><td>594</td><td>1919</td><td>3278</td><td>5.52</td><td>1.71</td></tr><tr><td>Hopper at 125K Walker2d at150K</td><td>2404</td><td>3131</td><td>3517</td><td>1.46</td><td>1.12</td></tr><tr><td>Walker2dat 300K</td><td>760</td><td>3308</td><td>3544</td><td>4.66</td><td>1.07</td></tr><tr><td></td><td>2556</td><td>3537</td><td>4589</td><td>1.80</td><td>1.30</td></tr><tr><td>Ant at150K</td><td>1245</td><td>4388</td><td>4803</td><td>3.86</td><td>1.09</td></tr><tr><td>Ant at 300K</td><td>2485</td><td>5774</td><td>5369</td><td>2.16</td><td>0.93</td></tr><tr><td>Humanoid at150K</td><td>674</td><td>1604</td><td>2641</td><td>3.92</td><td>1.65</td></tr><tr><td>Humanoid at 300K</td><td>1633</td><td>4199</td><td>4674</td><td>2.86</td><td>1.11</td></tr><tr><td>Amount of data</td><td>SAC</td><td>MBPO</td><td>REDQ-OFE</td><td>OFE/SAC</td><td>OFE/MBPO</td></tr><tr><td>Antat150K</td><td>1245</td><td>4388</td><td>5524</td><td>4.44</td><td>1.26</td></tr><tr><td>Ant at 300K</td><td>2485</td><td>5774</td><td>6578</td><td>2.65</td><td>1.14</td></tr><tr><td>Humanoid at150K</td><td>674</td><td>1604</td><td>5011</td><td>7.43</td><td>3.12</td></tr><tr><td>Humanoid at 300K</td><td>1633</td><td>4199</td><td>5309</td><td>3.25</td><td>1.26</td></tr></table>
541
+
542
+ # D NUMBER OF PARAMETERS COMPARISON
543
+
544
+ Table 4 gives the number of parameters for MBPO, REDQ and REDQ-OFE, for all four environments. As discussed in the main paper, REDQ uses fewer parameters than MBPO for all four environments: between $26 \%$ and $70 \%$ as many parameters depending on the environment. After adding OFENet, REDQ still uses fewer parameters than MBPO, with $80 \%$ and $3 5 \%$ as many parameters on Ant and Humanoid. In particular, it is surprising that REDQ-OFE can achieve a much stronger result on Humanoid with much fewer parameters.
545
+
546
+ Table 4: Number of parameters in millions. REDQ uses the same network structure and ensemble size for all four environments. The difference in the number of parameters comes from the fact that the environments have very different observation and action dimensions, which will affect the size of the input and output layers of the networks.
547
+
548
+ <table><tr><td>Algorithm</td><td>Hopper</td><td>Walker2d</td><td>Ant</td><td>Humanoid</td></tr><tr><td>MBPO</td><td>1.106M</td><td>1.144M</td><td>1.617M</td><td>7.087M</td></tr><tr><td>REDQ N = 10</td><td>0.769M</td><td>0.795M</td><td>1.066M</td><td>1.840M</td></tr><tr><td>REDQ-OFE N = 10</td><td></td><td></td><td>1.294M</td><td>2.460M</td></tr></table>
549
+
550
+ # E ADDITIONAL RESULTS FOR REDQ, SAC-20, AND AVG
551
+
552
+ Due to lack of space, Figure 2 in Section 3 only compared REDQ with SAC-20 and AVG for the Ant environment. Figure 5 presents the results for all four environments. We can see that in all four environments, REDQ has much stronger performance and much lower std of bias compared to SAC-20 and AVG. Note in terms of average normalized bias, AVG is slightly closer to zero in Ant compared to REDQ, and SAC-20 is a bit closer to zero in Humanoid compared to REDQ; however, their std of normalized bias is consistently higher. This shows the importance of having a low std of the bias in addition to a close-to-zero average bias.
553
+
554
+ ![](images/9b139659c8dc601f20360cd70f4f9285204328e7b4879ba930128056b52e003f.jpg)
555
+ Figure 5: Performance, mean and std of normalized Q bias for REDQ, AVG, and SAC. All three algorithms have a UTD ratio of 20.
556
+
557
+ # F REDQ AND SAC WITH AND WITHOUT POLICY DELAY
558
+
559
+ Note that in the REDQ pseudocode, the number of policy updates is always one for each data point collected. We set the UTD ratio for the policy update to always be one in order to isolate the effect of additional policy updates from Q updates. Note in this way, REDQ, SAC-20 and SAC-1 all take the same number of policy updates. This helps show that the performance gain mainly comes from the additional Q updates.
560
+
561
+ Having a lower number of policy updates can also be seen as a delayed policy update, or policy delay, and is a method that has been used in previous works to improve learning stability (Fujimoto et al., 2018). In this section we discuss how delayed policy update, or policy delay, impact the performance of REDQ and SAC (with UTD of 20). Figure 6 compares REDQ and SAC-20 with and without policy delay (NPD for no policy delay). We can see that having the policy delay consistently makes the bias and std of bias lower and more stable, although they have a smaller effect on REDQ than on SAC. Performance-wise SAC always gets a performance boost with policy delay, while REDQ sees improvement in Hopper and Humanoid, and becomes slightly worse in Walker2d and Ant. The results show that policy delay can be important under high UTD when the variance is not properly controlled. However, with enough variance reduction, the effect of policy delay is diminished, and in some cases having more policy update can give better performance.
562
+
563
+ ![](images/275e75d6a32ee0a39ed534c8349ce05c5a9a0fb4184aa7e57ec16a35052b9dd2.jpg)
564
+ Figure 6: Performance, mean and std of normalized Q bias of REDQ and SAC, with and without policy delay.
565
+
566
+ # G REDQ AND SAC WITH DIFFERENT UTD RATIOS
567
+
568
+ How do different UTD ratio values $G$ impact the performance of REDQ and SAC? Figure 7 compares the two algorithms under UTD ratio values of 1, 5, 10 and 20 for the Ant environment. The results show that in the Ant environment, REDQ greatly benefits from larger UTD values, with UTD of 20 giving the best result. For SAC, performance improves slightly for UTD ratios of 5 and 10, but becomes much worse at 20. Looking at the normalized bias and the std of the bias, we see that changing the UTD ratio does not change the values very much for REDQ, while for SAC, we see that as the UTD ratio increases, both the mean and the std of the bias becomes larger and more unstable.
569
+
570
+ ![](images/3818cf6441caf9d9d60bb22816183b2ada332b91f21db2897d6fc9e6d84438c2.jpg)
571
+ Figure 7: Performance, mean and std of normalized Q bias for REDQ, and SAC, with different UTD ratios, in Ant environment.
572
+
573
+ # H ADDITIONAL RESULTS FOR WEIGHTED VARIANT
574
+
575
+ In this section we provide additional results for the Weighted variant. Figure 8 shows the performance and bias comparison on all four environments. Results show that Weighted and REDQ have similar average bias and std of bias. In terms of performance, Weighed is worse in Ant and Hopper, similar in Humanoid and slightly stronger in Walker2d. Overall REDQ seems to have stronger performance and is more robust. Randomness in the networks might help alleviate overfitting in the early stage, or improve exploration, as shown in previous studies (Osband et al., 2016; Fortunato et al., 2018). This can be important since positive bias in Q learning-based methods can sometimes help exploration. This is commonly referred to as optimistic initial values, or optimism in the face of uncertainty (Sutton & Barto, 2018; Brafman & Tennenholtz, 2002). Thus conservative Q estimates in recent algorithms can lead to the problem of pessimistic underexploration (Ciosek et al., 2019). An interesting future work direction is to study how robust and effective exploration can be achieved without relying on optimistic estimates.
576
+
577
+ ![](images/a13f0d096a0da35a65dd180dae59dfc593695d6113c26ffa5e67f13c90ccf029.jpg)
578
+ Figure 8: Performance, mean and std of normalized Q bias for REDQ and Weighted.
md/train/BJgnXpVYwS/BJgnXpVYwS.md ADDED
@@ -0,0 +1,774 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # WHY GRADIENT CLIPPING ACCELERATES TRAINING: A THEORETICAL JUSTIFICATION FOR ADAPTIVITY
2
+
3
+ Jingzhao Zhang, Tianxing He, Suvrit Sra & Ali Jadbabaie
4
+
5
+ Massachusetts Institute of Technology
6
+ Cambridge, MA 02139, USA
7
+ {jzhzhang, tianxing, suvrit, jadbabai}@mit.edu
8
+
9
+ # ABSTRACT
10
+
11
+ We provide a theoretical explanation for the effectiveness of gradient clipping in training deep neural networks. The key ingredient is a new smoothness condition derived from practical neural network training examples. We observe that gradient smoothness, a concept central to the analysis of first-order optimization algorithms that is often assumed to be a constant, demonstrates significant variability along the training trajectory of deep neural networks. Further, this smoothness positively correlates with the gradient norm, and contrary to standard assumptions in the literature, it can grow with the norm of the gradient. These empirical observations limit the applicability of existing theoretical analyses of algorithms that rely on a fixed bound on smoothness. These observations motivate us to introduce a novel relaxation of gradient smoothness that is weaker than the commonly used Lipschitz smoothness assumption. Under the new condition, we prove that two popular methods, namely, gradient clipping and normalized gradient, converge arbitrarily faster than gradient descent with fixed stepsize. We further explain why such adaptively scaled gradient methods can accelerate empirical convergence and verify our results empirically in popular neural network training settings.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ We study optimization algorithms for neural network training and aim to resolve the mystery of why adaptive methods converge fast. Specifically, we study gradient-based methods for minimizing a differentiable nonconvex function $f : \mathbb { R } ^ { d } \bar { \mathbb { R } }$ , where $f ( x )$ can potentially be stochastic, i.e., $f ( x ) = \mathbb { E } _ { \xi } [ F ( x , \xi ) ]$ . Such choices of $f$ cover a wide range of problems in machine learning, and their study motivates a vast body of current optimization literature.
16
+
17
+ A widely used (and canonical) approach for minimizing $f$ is the (stochastic) gradient descent (GD) algorithm. Despite its simple form, GD often achieves superior empirical (Wilson et al., 2017) performances and theoretical (Carmon et al., 2017) guarantees. However, in many tasks such as reinforcement learning and natural language processing (NLP), adaptive gradient methods (e.g., Adagrad (Duchi et al., 2011), ADAM (Kingma and Ba, 2014), and RMSProp (Tieleman and Hinton, 2012)) outperform SGD. Despite their superior empirical performance, our understanding of the fast convergence of adaptive methods is limited. Previous analysis has shown that adaptive methods are more robust to variation in hyper-parameters (Ward et al., 2018) and adapt to sparse gradients (Duchi et al., 2011) (a more detailed literature review is in Appendix A). However, in practice, the gradient updates are dense, and even after extensively tuning the SGD hyperparameters, it still converges much slower than adaptive methods in NLP tasks.
18
+
19
+ We analyze the convergence of clipped gradient descent and provide an explanation for its fast convergence. Even though gradient clipping is a standard practice in tasks such as language models (e.g. Merity et al., 2018; Gehring et al., 2017; Peters et al., 2018), it lacks a firm theoretical grounding. Goodfellow et al. (2016); Pascanu et al. (2013; 2012) discuss the gradient explosion problem in recurrent models and consider clipping as an intuitive work around. We formalize this intuition and prove that clipped GD can converge arbitrarily faster than fixed-step gradient descent. This result is shown to hold under a novel smoothness condition that is strictly weaker than the standard Lipschitzgradient assumption pervasive in the literature. Hence our analysis captures many functions that are not globally Lipschitz smooth. Importantly, the proposed smoothness condition is derived on the basis of extensive NLP training experiments, which are precisely the same type of experiments for which adaptive gradient methods empirically perform superior to gradient methods.
20
+
21
+ By identifying a a new smoothness condition through experiments and then using it to analyze the convergence of adaptively-scaled methods, we reduce the following gap between theory and practice. On one hand, powerful techniques such as Nesterov’s momentum and variance reduction theoretically accelerate convex and nonconvex optimization. But, at least for now, they seem to have limited applicability in deep learning (Defazio and Bottou, 2018). On the other hand, some widely used techniques (e.g., heavy-ball momentum, adaptivity) lack theoretical acceleration guarantees. We suspect that a major reason here is the misalignment of the theoretical assumptions with practice. Our work demonstrates that the concept of acceleration critically relies on the problem assumptions and that the standard global Lipschitz-gradient condition may not hold in the case of some applications and thus must be relaxed to admit a wider class of objective functions.
22
+
23
+ # 1.1 CONTRIBUTIONS
24
+
25
+ In light of the above background, the main contributions of this paper are the following:
26
+
27
+ Inspired and supported by neural network training experiments, we introduce a new smoothness condition that allows the local smoothness constant to increase with the gradient norm. This condition is strictly weaker than the pervasive Lipschitz-gradient assumption. We provide a convergence rate for clipped GD under our smoothness assumption (Theorem 3). We prove an upper-bound (Theorem 6) and a lower-bound (Theorem 4) on the convergence rate of GD under our relaxed smoothness assumption. The lower-bound demonstrates that GD with fixed step size can be arbitrarily slower than clipped GD. We provide upper bounds for stochastic clipped GD (Theorem 7) and SGD (Theorem 8). Again, stochastic clipped GD can be arbitrarily faster than SGD with a fixed step size.
28
+
29
+ We support our proposed theory with realistic neural network experiments. First, in the state of art LSTM language modeling (LM) setting, we observe the function smoothness has a strong correlation with gradient norm (see Figure 2). This aligns with the known fact that gradient clipping accelerates LM more effectively compared to computer vision (CV) tasks. Second, our experiments in CV and LM demonstrate that clipping accelerates training error convergence and allows the training trajectory to cross non-smooth regions of the loss landscape. Furthermore, gradient clipping can also achieve good generalization performance even in image classification (e.g., $9 5 . 2 \%$ test accuracy in 200 epochs for ResNet20 on Cifar10). Please see Section 5 for more details.
30
+
31
+ # 2 A NEW RELAXED SMOOTHNESS CONDITION
32
+
33
+ In this section, we motivate and develop a relaxed smoothness condition that is weaker (and thus, more general) than the usual global Lipschitz smoothness assumption. We start with the traditional definition of smoothness.
34
+
35
+ # 2.1 FUNCTION SMOOTHNESS (LIPSCHITZ GRADIENTS)
36
+
37
+ Recall that $f$ denotes the objective function that we want to minimize. We say that $f$ is $L$ -smooth if
38
+
39
+ $$
40
+ \begin{array} { r } { \| \nabla f ( x ) - \nabla f ( y ) \| \leq L \| x - y \| , \quad \mathrm { f o r ~ a l l ~ } x , y \in \mathbb { R } ^ { d } . } \end{array}
41
+ $$
42
+
43
+ For twice differentiable functions, condition (1) is equivalent to $\| \nabla ^ { 2 } f ( x ) \| \leq L , \forall x \in \mathbb { R } ^ { d }$ . This smoothness condition enables many important theoretical results. For example, Carmon et al. (2017) show that GD with $h = 1 / L$ is up to a constant optimal for optimizing smooth nonconvex functions.
44
+
45
+ But the usual $L$ -smoothness assumption (1) also has its limitations. Assuming existence of a global constant $L$ that upper bounds the variation of the gradient is very restrictive. For example, simple polynomials such as $f ( x ) = x ^ { 3 }$ break the assumption. One workaround is to assume that $L$ exists in a compact region, and either prove that the iterates do not escape the region or run projectionbased algorithms. However, such assumptions can make $L$ very large and slow down the theoretical convergence rate. In Section 4, we will show that a slow rate is unavoidable for gradient descent with fixed step size, whereas clipped gradient descent can greatly improve the dependency on $L$ .
46
+
47
+ The above limitations force fixed-step gradient descent (which is tailored for Lipschitz smooth functions) to converge slowly in many tasks. In Figure 1, we plot the estimated function smoothness at different iterations during training neural networks. We find that function smoothness varies greatly at different iterations. From Figure 1, we further find that local smoothness positively correlates with the full gradient norm, especially in the language modeling experiment. A natural question is:
48
+
49
+ Can we find a fine-grained smoothness condition under which we can design theoretically and empirically fast algorithms at the same time?
50
+
51
+ To answer this question, we introduce the relaxed smoothness condition in the next section, which is developed on the basis of extensive experiments— Figure 1 provides an illustrative example.
52
+
53
+ ![](images/9d05bb6168e0956a20c95d567abf3e64a789884ebd862ee8ef4e8eacb6daaf44.jpg)
54
+ Figure 1: Gradient norm vs local gradient Lipschitz constant on a log-scale along the training trajectory for AWD-LSTM (Merity et al., 2018) on PTB dataset. The colorbar indicates the number of iterations during training. More experiments can be found in Section 5. Experiment details are in Appendix H.
55
+
56
+ # 2.2 A NEW RELAXED SMOOTHNESS CONDITION
57
+
58
+ We observe strong positive correlation between function smoothness and gradient norm in language modeling experiments (Figure 1(a)). This observation leads us to propose the following smoothness condition that allows local smoothness to grow with function gradients.
59
+
60
+ Definition 1. A second order differentiable function $f$ is $( L _ { 0 } , L _ { 1 } )$ -smooth if
61
+
62
+ $$
63
+ \begin{array} { r } { \| \nabla ^ { 2 } f ( x ) \| \leq L _ { 0 } + L _ { 1 } \| \nabla f ( x ) \| . } \end{array}
64
+ $$
65
+
66
+ Definition 1 strictly relaxes the usual (and widely used) $L$ -smoothness. There are two ways to interpret the relaxation: First, when we focus on a compact region, we can balance the constants $L _ { 0 }$ and $L _ { 1 }$ such that $L _ { 0 } \ll L$ while $L _ { 1 } \ll L$ . Second, there exist functions that are $( L _ { 0 } , L _ { 1 } )$ -smooth globally, but not $L$ -smooth. Hence the constant $L$ for $L$ -smoothness gets larger as the compact set increases but $L _ { 0 }$ and $L _ { 1 }$ stay fixed. An example is given in Lemma 2.
67
+
68
+ Remark 1. It is worth noting that we do not need the Hessian operator norm and gradient norm to necessarily satisfy the linear relation (2). As long as these norms are positively correlated, gradient clipping can be shown to achieve faster rate than fixed step size gradient descent. We use the linear relationship (2) for simplicity of exposition.
69
+
70
+ Lemma 2. Let smooth for som $f$ the and variate but not lynomial -smooth. $\begin{array} { r } { f ( x ) = \sum _ { i = 1 } ^ { d } a _ { i } x ^ { i } } \end{array}$ . When $d \geq 3 ,$ , then $f$ is $( L _ { 0 } , L _ { 1 } )$ $L _ { 0 }$ $L _ { 1 }$ $L$
71
+
72
+ Proof. The first claim follows from $\begin{array} { r } { \operatorname* { l i m } _ { x \to \infty } \left| \frac { f ^ { \prime } ( x ) } { f ^ { \prime \prime } ( x ) } \right| = \operatorname* { l i m } _ { x \to - \infty } \left| \frac { f ^ { \prime } ( x ) } { f ^ { \prime \prime } ( x ) } \right| = \infty } \end{array}$ . The second claim follows by the unboundedness of $f ^ { \prime \prime } ( x )$ .
73
+
74
+ # 2.3 SMOOTHNESS IN NEURAL NETWORKS
75
+
76
+ We saw that our smoothness condition relaxes the traditional smoothness assumption and is motivated empirically (Figure 1). Below we develop some intuition for this phenomenon. We conjecture that the proposed positive correlation results from the common components in expressions of the gradient and the Hessian. We illustrate the reasoning behind this conjecture by considering an $\ell$ - layer linear network with quadratic loss—a similar computation also holds for nonlinear networks.
77
+
78
+ The $L _ { 2 }$ regression loss of a deep linear network is $\mathcal { L } ( Y , f ( X ) ) : = \| Y - W _ { \ell } \cdot \cdot \cdot W _ { 1 } X \| ^ { 2 } .$ , where $Y$ denotes labels, $X$ denotes the input data matrix, and $W _ { i }$ denotes the weights in the $i ^ { \mathrm { { t h } } }$ layer. By (Lemma 4.3 Kawaguchi, 2016), we know that
79
+
80
+ $$
81
+ \nabla _ { \mathsf { v e c } ( w _ { i } ) } \mathcal { L } ( Y , f ( X ) ) = ( ( W _ { \ell } \cdots W _ { i + 1 } ) \otimes ( W _ { i - 1 } \cdots W _ { 2 } W _ { 1 } X ) ^ { T } ) ^ { T } \operatorname { v e c } ( f ( X ) - Y ) ,
82
+ $$
83
+
84
+ where $\mathrm { v e c } ( \cdot )$ flattens a matrix in $\mathbb { R } ^ { m \times n }$ into a vector in $\mathbb { R } ^ { m n }$ ; $\otimes$ denotes the Kronecker product. For constants $i , j$ such that $\ell \geq j > i > 0$ , the second order derivative
85
+
86
+ $$
87
+ \begin{array} { r l } & { \nabla _ { \mathrm { v e c } ( w _ { j } ) } \nabla _ { \mathrm { v e c } ( w _ { i } ) } \mathcal { L } ( Y , f ( X ) ) = } \\ & { \qquad ( ( W _ { \ell } \cdot \cdot \cdot W _ { i + 1 } ) \otimes ( W _ { i - 1 } \cdot \cdot \cdot W _ { 2 } W _ { 1 } X ) ^ { T } ) ^ { T } ( ( W _ { \ell } \cdot \cdot \cdot W _ { j + 1 } ) \otimes ( W _ { j - 1 } \cdot \cdot \cdot W _ { 2 } W _ { 1 } X ) ^ { T } ) + } \\ & { \qquad ( ( W _ { j - 1 } \cdot \cdot \cdot W _ { i + 1 } ) \otimes ( W _ { i - 1 } \cdot \cdot \cdot W _ { 2 } W _ { 1 } X ) ) ( I \otimes ( ( f ( X ) - Y ) W _ { \ell } \cdot \cdot \cdot W _ { j + 1 } ) ) . } \end{array}
88
+ $$
89
+
90
+ When $j = i$ , the second term equals 0. Based on the above expressions, we notice that the gradient norm and Hessian norm may be positively correlated due to the following two observations. First, the gradient and the Hessian share many components such as the matrix product of weights across layers. Second, if one naively upper bounds the norm using Cauchy-Schwarz, then both upperbounds would be monotonically increasing with respect to $\| W _ { i } \|$ and $\| f ( X ) - Y \|$ .
91
+
92
+ # 3 PROBLEMS SETUP AND ALGORITHMS
93
+
94
+ In this section, we state the optimization problems and introduce gradient based algorithms for them that work under the new smoothness condition (2). Convergence analysis follows in Section 4.
95
+
96
+ Recall that we wish to solve the nonconvex optimization problem $\operatorname* { m i n } _ { x \in \mathbb { R } ^ { d } } f ( x )$ . Since in general this problem is intractable, following common practice we also seek an $\epsilon$ -stationary point, i.e., a point $x$ such that $\| \nabla f ( x ) \| \leq \epsilon$ . Furthermore, we make the following assumptions to regularize the function class studied and subsequently provide nonasymptotic convergence rate analysis.
97
+
98
+ Assumption 1. The function $f$ is lower bounded by $f ^ { * } > - \infty$ .
99
+
100
+ Assumption 2. The function $f$ is twice differentiable.
101
+
102
+ Assumption 3 $( ( L _ { 0 } , L _ { 1 } )$ -smoothness). The function $f$ is $( L _ { 0 } , L _ { 1 } )$ -smooth, i.e., there exist positive constants $L _ { 0 }$ and $L _ { 1 }$ such that $\| \nabla ^ { 2 } f ( x ) \| \leq L _ { 0 } + L _ { 1 } \| \nabla f ( x ) \|$ —see condition (2).
103
+
104
+ The first assumption is standard. Twice differentiability in Assumption 2 can relaxed to first-order differentiability by modifying the definition of $( L _ { 0 } , L _ { 1 } )$ -smoothness as
105
+
106
+ $$
107
+ \begin{array} { r } { \operatorname* { l i m } _ { \delta \to \vec { 0 } } \frac { \| \nabla f ( x ) - \nabla f ( x + \delta ) \| } { \| \delta \| } \leq L _ { 1 } \| \nabla f ( x ) \| + L _ { 0 } . } \end{array}
108
+ $$
109
+
110
+ The above inequality implies $\nabla f ( x )$ is locally Lipschitz, and hence almost everywhere differentiable. Therefore, all our results can go through by handling the integrations more carefully. But to avoid complications and simplify exposition, we assume that the function is twice differentiable.
111
+
112
+ To further relax the global assumptions, by showing that GD and clipped GD are monotonically decreasing in function value, we require the above assumptions to hold just in a neighborhood determined by the sublevel set $S ^ { 1 }$ for a given initialization $x _ { 0 }$ , where
113
+
114
+ $$
115
+ f ( y ) \leq f ( x _ { 0 } ) , { \mathrm { ~ a n d ~ } } \| x - y \| \leq 1 \} .
116
+ $$
117
+
118
+ # 3.1 GRADIENT DESCENT ALGORITHMS
119
+
120
+ In this section, we review a few well-known variants of gradient based algorithms that we analyze. We start with the ordinary gradient descent with a fixed step size $\eta$ ,
121
+
122
+ $$
123
+ \boldsymbol { x } _ { k + 1 } = \boldsymbol { x } _ { k } - \eta \nabla f ( \boldsymbol { x } _ { k } ) .
124
+ $$
125
+
126
+ This algorithm (pedantically, its stochastic version) is widely used in neural network training. Many modifications of it have been proposed to stabilize or accelerate training. One such technique of particular importance is clipped gradient descent, which performs the following updates:
127
+
128
+ $$
129
+ \begin{array} { r } { x _ { k + 1 } = x _ { k } - h _ { c } \nabla f ( x _ { k } ) , \quad \mathrm { w h e r e ~ } h _ { c } : = \operatorname* { m i n } \{ \eta _ { c } , \frac { \gamma \eta _ { c } } { \| \nabla f ( x ) \| } \} . } \end{array}
130
+ $$
131
+
132
+ Another algorithm that is less common in practice but has attracted theoretical interest is normalized gradient descent. The updates for normalized GD method can be written as
133
+
134
+ $$
135
+ \begin{array} { r } { x _ { k + 1 } = x _ { k } - h _ { n } \nabla f ( x _ { k } ) , \quad \mathrm { w h e r e ~ } h _ { n } : = \frac { \eta _ { n } } { \| \nabla f ( x ) \| + \beta } . } \end{array}
136
+ $$
137
+
138
+ The stochastic version of the above algorithms replace the gradient with a stochastic estimator.
139
+
140
+ We note that Clipped GD and NGD are almost equivalent. Indeed, for any given $\eta _ { n }$ and $\beta$ , if we set $\gamma \eta _ { c } = \eta _ { n }$ and $\eta _ { c } = \eta _ { n } / \beta$ , then we have
141
+
142
+ $$
143
+ \begin{array} { r } { \frac { 1 } { 2 } h _ { c } \leq h _ { n } \leq 2 h _ { c } . } \end{array}
144
+ $$
145
+
146
+ Therefore, clipped GD is equivalent to NGD up to a constant factor in the step size choice. Consequently, the nonconvex convergence rates in Section 4 and Section 4.2 for clipped GD also apply to NGD. We omit repeating the theorem statements and the analysis for conciseness.
147
+
148
+ # 4 THEORETICAL ANALYSIS
149
+
150
+ In this section, we analyze the oracle complexities of GD and clipped GD under our relaxed smoothness condition. All the proofs are in the appendix. We highlight the key theoretical challenges that needed to overcome in Appendix B (e.g., due to absence of Lipschitz-smoothness, already the firststep of analysis, the so-called “descent lemma” fails).
151
+
152
+ Since we are analyzing the global iteration complexity, let us recall the formal definition being used. We follow the notation from Carmon et al. (2017). For a deterministic sequence $\{ x _ { k } \} _ { k \in \mathbb { N } }$ , define the complexity of $\{ x _ { k } \} _ { k \in \mathbb { N } }$ for a function $f$ as
153
+
154
+ $$
155
+ T _ { \epsilon } ( \{ x _ { t } \} _ { t \in \mathbb { N } } , f ) : = \operatorname* { i n f } \{ t \in \mathbb { N } | \| \nabla f ( x _ { t } ) \| \le \epsilon \} .
156
+ $$
157
+
158
+ For a random process $\{ x _ { k } \} _ { k \in \mathbb { N } }$ , we define the complexity of $\{ x _ { k } \} _ { k \in \mathbb { N } }$ for function $f$ as
159
+
160
+ $$
161
+ \begin{array} { r } { T _ { \epsilon } ( \{ x _ { t } \} _ { t \in \mathbb { N } } , f ) : = \operatorname* { i n f } \biggr \{ t \in \mathbb { N } | \mathrm { P r o b } ( \| \nabla f ( x _ { k } ) \| \ge \epsilon \mathrm { ~ f o r ~ a l l ~ } k \le t ) \le \frac { 1 } { 2 } \biggr \} . } \end{array}
162
+ $$
163
+
164
+ In particular, if the condition is never satisfied, then the complexity is $\infty$ . Given an algorithm $A _ { \theta }$ , where $\theta$ denotes hyperparameters such as step size and momentum coefficient, we denote $A _ { \theta } [ f , x _ { 0 } ]$ as the sequence of (potentially stochastic) iterates generated by $A$ when operating on $f$ with initialization $x _ { 0 }$ . Finally, we define the iteration complexity of an algorithm class parameterized by $p$ hyperparameters, $\overset { \cdot } { A } \overset { \cdot } { = } \{ A _ { \theta } \} _ { \theta \in \mathbb { R } ^ { p } }$ on a function class $\mathcal { F }$ as
165
+
166
+ $$
167
+ { \mathcal { N } } ( A , { \mathcal { F } } , \epsilon ) : = \operatorname* { i n f } _ { A _ { \theta } \in A } \operatorname* { s u p } _ { x _ { 0 } \in \mathbb { R } ^ { d } , f \in { \mathcal { F } } } T _ { \epsilon } ( A _ { \theta } [ f , x _ { 0 } ] , f ) .
168
+ $$
169
+
170
+ The definition in the stochastic setting simply replaces the expression (7) with the expression (8). In the rest of the paper, “iteration complexity” refers to the quantity defined above.
171
+
172
+ # 4.1 CONVERGENCE IN THE DETERMINISTIC SETTING
173
+
174
+ In this section, we present the convergence rates for GD and clipped GD under deterministic setting.
175
+ We start by analyzing the clipped GD algorithm with update defined in equation (5).
176
+
177
+ Theorem 3. Let $\mathcal { F }$ denote the class of functions that satisfy Assumptions 1, 2, and $^ 3$ in set $s$ defined in (3). Recall $f ^ { * }$ is a global lower bound for function value. With $\begin{array} { r } { \dot { \eta _ { c } } = \frac { 1 } { 1 0 L _ { 0 } } , \gamma = \operatorname* { m i n } \{ \frac { 1 } { \eta _ { c } } , \frac { \tilde { 1 } } { 1 0 L _ { 1 } \eta _ { c } } \} } \end{array}$ , we can prove that the iteration complexity of clipped $G D$ (Algorithm 5) is upper bounded by
178
+
179
+ $$
180
+ \frac { 2 0 L _ { 0 } ( f ( x _ { 0 } ) - f ^ { * } ) } { \epsilon ^ { 2 } } + \frac { 2 0 \operatorname * { m a x } \{ 1 , L _ { 1 } ^ { 2 } \} ( f ( x _ { 0 } ) - f ^ { * } ) } { L _ { 0 } } \ .
181
+ $$
182
+
183
+ The proof of Theorem 3 is included in Appendix C.
184
+
185
+ Now, we discuss the convergence of vanilla GD. The standard GD is known to converge to first order $\epsilon$ -stationary points in $\mathcal { O } ( ( \bar { L ( } f ( x _ { 0 } ) - f ^ { * } ) ) \epsilon ^ { - 2 } )$ iterations for $( L , 0 ) -$ smooth nonconvex functions. By Theorem 1 of Carmon et al. (2017), this rate is up to a constant optimal.
186
+
187
+ However, we will show below that gradient descent is suboptimal under our relaxed $( L _ { 0 } , L _ { 1 } )$ - smoothness condition. In particular, to prove the convergence rate for gradient descent with fixed step size, we need to permit it benefit from an additional assumption on gradient norms.
188
+
189
+ Assumption 4. Given an initialization $x _ { 0 }$ , we assume that
190
+
191
+ This assumption is in fact necessary, as our next theorem reveals.
192
+
193
+ Theorem 4. Let $\mathcal { F }$ be the class of objectives satisfying Assumptions 1, 2, 3, and 4 with fixed constants $L _ { 0 } \ge 1 , L _ { 1 } \ge 1 , M > 1$ . The iteration complexity for the fixed-step gradient descent algorithms parameterized by step size $h$ is at least
194
+
195
+ $$
196
+ \frac { L _ { 1 } M ( f ( x _ { 0 } ) - f ^ { * } - 5 \epsilon / 8 ) } { 8 \epsilon ^ { 2 } ( \log M + 1 ) } .
197
+ $$
198
+
199
+ The proof can be found in Appendix D.
200
+
201
+ Remark 5. Theorem 1 of Carmon et al. (2017) and Theorem 4 together show that gradient descent with a fixed step size cannot converge to an $\epsilon$ -stationary point faster than $\Omega \left( ( L _ { 1 } M / \log ( M ) + L _ { 0 } ) ( f ( x _ { 0 } ) { \stackrel { . } { - } } f ^ { * } ) \epsilon ^ { - 2 } \right)$ . Recall that clipped GD algorithm converges as $\mathcal { O } \left( L _ { 0 } ( f ( x _ { 0 } ) - f ^ { * } ) \epsilon ^ { - 2 } + L _ { 1 } ^ { 2 } ( f ( x _ { 0 } ) - f ^ { * } ) L _ { 0 } ^ { - 1 } \right)$ . Therefore, clipped GD can be arbitrarily faster than GD when $L _ { 1 } M$ is large, or in other words, when the problem has a poor initialization.
202
+
203
+ Below, we provide an iteration upper bound for the fixed-step gradient descent update (4).
204
+
205
+ Theorem 6. Suppose assumptions 1, 2, 3 and $^ { 4 }$ hold in set $s$ defined in (3). If we pick parameters such that $\begin{array} { r } { h = \frac { 1 } { \left( 2 ( M L _ { 1 } + L _ { 0 } ) \right) } } \end{array}$ , then we can prove that the iteration complexity of $G D$ with a fixed step size defined in Algorithm 4 is upper bounded by
206
+
207
+ $$
208
+ 4 ( M L _ { 1 } + L _ { 0 } ) ( f ( x _ { 0 } ) - f ^ { \ast } ) \epsilon ^ { - 2 } .
209
+ $$
210
+
211
+ Please refer to Appendix $\mathrm { E }$ for the proof. Theorem 6 shows that gradient descent with a fixed step size converges in $\bar { \mathcal { O } } ( ( M L _ { 1 } + L _ { 0 } ) ( \bar { f } ( x _ { 0 } ) - f ^ { * } ) / \epsilon ^ { 2 } )$ iterations. This suggests that the lower bound in Remark 5 is tight up to a log factor in $M$ .
212
+
213
+ # 4.2 CONVERGENCE IN THE STOCHASTIC SETTING
214
+
215
+ In the stochastic setting, we assume GD and clipped GD have access to an unbiased stochastic gradient $\nabla { \hat { f } } ( x )$ instead of the exact gradient $\nabla f ( x )$ . For simplicity, we denote $g _ { k } \ = \ \nabla \hat { f } ( x _ { k } )$ below. To prove convergence, we need the following assumption.
216
+
217
+ Assumption 5. There exists $\tau > 0$ , such that $\| \nabla { \hat { f } } ( x ) - \nabla f ( x ) \| \leq \tau$ almost surely.
218
+
219
+ Bounded noise can be relaxed to sub-gaussian noise if the noise is symmetric. Furthermore, up to our knowledge, this is the first stochastic nonconvex analysis of adaptive methods that does not require the gradient norm $\| \nabla f ( x ) \|$ to be bounded globally.
220
+
221
+ The main result of this section is the following convergence guarantee for stochastic clipped GD (based on the stochastic version of the update (5)).
222
+
223
+ Theorem 7. Let Assumptions 1–3 and $5$ hold globally with $L _ { 1 } \quad > \quad 0$ . Let $\begin{array} { r l } { h } & { { } = } \end{array}$ $\begin{array} { r } { \operatorname* { m i n } \bigr \{ \frac { 1 } { 1 6 \eta L _ { 1 } ( \lVert g _ { k } \rVert + \tau ) } , \eta \bigr \} } \end{array}$ where $\begin{array} { r } { \eta \ = \ \operatorname* { m i n } \bigr \{ \frac { 1 } { 2 0 L _ { 0 } } , \frac { 1 } { 1 2 8 L _ { 1 } \tau } , \frac { 1 } { \sqrt { T } } \bigr \} } \end{array}$ . Then we can show that iteration complexity for stochastic clipped $G D$ after of update (5) is upper bounded by
224
+
225
+ $$
226
+ \begin{array} { c } { { \Delta \operatorname* { m a x } \{ \displaystyle \frac { 1 2 8 L _ { 1 } } { \epsilon } , \frac { 4 \Delta } { \epsilon ^ { 4 } } , \frac { 8 0 L _ { 0 } + 5 1 2 L _ { 1 } \tau } { \epsilon ^ { 2 } } \} , } } \\ { { \Delta = \big ( f ( x _ { 0 } ) - f ^ { * } + \big ( 5 L _ { 0 } + 2 L _ { 1 } \tau \big ) \tau ^ { 2 } + 9 \tau L _ { 0 } ^ { 2 } / L _ { 1 } \big ) . } } \end{array}
227
+ $$
228
+
229
+ In comparison, we have the following upper bound for ordinary SGD.
230
+
231
+ Theorem 8. Let Assumptions $I { - } 3 ,$ , and 5 hold globally with $L _ { 1 } > 0$ . Let $\begin{array} { r } { h = \operatorname* { m i n } \{ \frac { 1 } { \sqrt { T } } , \frac { 1 } { L _ { 1 } ( M + \tau ) } \} } \end{array}$ Then the iteration complexity for the stochastic version of $G D$ (4) is upper bounded by
232
+
233
+ We cannot provide a lower bound for this algorithm. In fact, lower bound is not known for SGD even in the global smoothness setting. However, the deterministic lower bound in Theorem 4 is still valid, though probably loose. Therefore, the convergence of SGD still requires additional assumption and can again be arbitrarily slower compared to clipped SGD when $M$ is large.
234
+
235
+ ![](images/787914712b864132ab352fe73cd796ba31239f16993e05604bd712f4f343585f.jpg)
236
+
237
+ Figure 2: Gradient norm vs smoothness on log scale for LM training. The dot color indicates the iteration number. Darker ones correspond to earlier iterations. Note that the spans of $_ { x }$ and $^ { \prime \prime }$ axis are not fixed.
238
+
239
+ ![](images/d70016e843770b36a2307fbfeb5f5fede62bac4822fab934687c7df17f416aec.jpg)
240
+ Figure 3: Gradient norm vs smoothness on log scale for ResNet20 training. The dot color indicates the iteration number.
241
+
242
+ # 5 EXPERIMENTS
243
+
244
+ In this section, we summarize our empirical findings on the positive correlation between gradient norm and local smoothness. We then show that clipping accelerates convergence during neural network training. Our experiments are based on two tasks: language modeling and image classification. We run language modeling on the Penn Treebank (PTB) (Mikolov et al., 2010) dataset with AWD-LSTM models (Merity et al., 2018)2. We train ResNet20 (He et al., 2016) on the Cifar10 dataset (Krizhevsky and Hinton, 2009). Details about the smoothness estimation and experimental setups are in Appendix H. An additional synthetic experiment is discussed in Appendix I.
245
+
246
+ First, our experiments test whether the local smoothness constant increases with the gradient norm, as suggested by the relaxed smoothness conditions defined in (2) (Section 2). To do so, we evaluate both quantities at points generated by the optimization procedure. We then scatter the local smoothness constants against the gradient norms in Figure 2 and Figure 3. Note that the plots are on a log-scale. A linear scale plot is shown in Appendix Figure 5.
247
+
248
+ We notice that the correlation exists in the default training procedure for language modeling (see Figure 2a) but not in the default training for image classification (see Figure 3a). This difference aligns with the fact that gradient clipping is widely used in language modeling but is less popular in ResNet training, offering empirical support to our theoretical findings.
249
+
250
+ We further investigate the cause of correlation. The plots in Figures 2 and 3 show that correlation appears when the models are trained with clipped GD and large learning rates. We propose the following explanation. Clipping enables the training trajectory to stably traverse non-smooth regions. Hence, we can observe that gradient norms and smoothness are positively correlated in Figures 2a and 3c. Without clipping, the optimizer has to adopt a small learning rate and stays in a region where local smoothness does not vary much, otherwise the sequence diverges, and a different learning rate is used. Therefore, in other plots of Figures 2 and 3, the correlation is much weaker.
251
+
252
+ As positive correlations are present in both language modeling and image classification experiments with large step sizes, our next set of experiments checks whether clipping helps accelerate convergence as predicted by our theory. From Figure 4, we find that clipping indeed accelerates convergence. Because gradient clipping is a standard practice in language modeling, the LSTM models trained with clipping achieve the best validation performance and the fastest training loss convergence as expected. For image classification, surprisingly, clipped GD also achieves the fastest convergence and matches the test performance of SGD $+$ momentum. These plots show that clipping can accelerate convergence and achieve good test performance at the same time.
253
+
254
+ ![](images/9e4d337c612b117620776a0dbb4872f33f755f209ec629c5ea936a75e04971f4.jpg)
255
+ Figure 4: Training and validation loss obtained with different training methods for LSTM and ResNet training. The validation loss plots the cross entropy. The training loss additionally includes the weight regularization term. In the legend, $\cdot \mathrm { l r } 3 0 \mathrm { c l i p } 0 . 2 5 $ denotes that clipped SGD uses step size 30 and that the $L _ { 2 }$ norm of the stochastic gradient is clipped by 0.25. In ResNet training, we threshold the stochastic gradient norm at 0.25 when clipping is applied.
256
+
257
+ # 6 DISCUSSION
258
+
259
+ Much progress has been made to close the gap between upper and lower oracle complexities for first order smooth optimization. The works dedicated to this goal provide important insights and tools for us to understand the optimization procedures. However, there is another gap that separates theoretically accelerated algorithms from empirically fast algorithms.
260
+
261
+ Our work aims to close this gap. Specifically, we propose a relaxed smoothness assumption that is supported by empirical evidence. We analyze a simple but widely used optimization technique known as gradient clipping and provide theoretical guarantees that clipping can accelerate gradient descent. This phenomenon aligns remarkably well with empirical observations.
262
+
263
+ There is still much to be explored in this direction. First, though our smoothness condition relaxes the usual Lipschitz assumption, it is unclear if there is an even better condition that also matches the experimental observations while also enabling a clean theoretical analysis. Second, we only study convergence of clipped gradient descent. Studying the convergence properties of other techniques such as momentum, coordinate-wise learning rates (more generally, preconditioning), and variance reduction is also interesting. Finally, the most important question is: “can we design fast algorithms based on relaxed conditions that achieve faster convergence in neural network training?”
264
+
265
+ Our experiments also have noteworthy implications. First, though advocating clipped gradient descent in ResNet training is not a main point of this work, it is interesting to note that gradient descent and clipped gradient descent with large step sizes can achieve a similar test performance as momentum-SGD. Second, we learned that the performance of the baseline algorithm can actually beat some recently proposed algorithms. Therefore, when we design or learn about new algorithms, we need to pay extra attention to check whether the baseline algorithms are properly tuned.
266
+
267
+ # 7 ACKNOWLEDGEMENT
268
+
269
+ SS acknowledges support from an NSF-CAREER Award (Number 1846088) and an Amazon Research Award. AJ acknowledges support from an MIT-IBM-Exploratory project on adaptive, robust, and collaborative optimization.
270
+
271
+ # REFERENCES
272
+
273
+ N. Agarwal, B. Bullins, X. Chen, E. Hazan, K. Singh, C. Zhang, and Y. Zhang. The case for fullmatrix adaptive regularization. arXiv preprint arXiv:1806.02958, 2018.
274
+ Z. Allen-Zhu. Katyusha: The first direct acceleration of stochastic gradient methods. The Journal of Machine Learning Research, 18(1):8194–8244, 2017.
275
+ L. Armijo. Minimization of functions having Lipschitz continuous first partial derivatives. Pacific Journal of mathematics, 16(1):1–3, 1966.
276
+ F. Bach and E. Moulines. Non-strongly-convex smooth stochastic approximation with convergence rate $o ( 1 / n )$ . In Advances in Neural Information Processing Systems, pages 773–781, 2013.
277
+ A. Beck and M. Teboulle. A fast iterative shrinkage-thresholding algorithm for linear inverse problems. SIAM journal on imaging sciences, 2(1):183–202, 2009.
278
+ Y. Carmon, J. C. Duchi, O. Hinder, and A. Sidford. Lower bounds for finding stationary points i. arXiv preprint arXiv:1710.11606, 2017.
279
+ Y. Carmon, J. C. Duchi, O. Hinder, and A. Sidford. Accelerated methods for nonconvex optimization. SIAM Journal on Optimization, 28(2):1751–1772, 2018.
280
+ X. Chen, S. Liu, R. Sun, and M. Hong. On the convergence of a class of adam-type algorithms for non-convex optimization. arXiv preprint arXiv:1808.02941, 2018.
281
+ K. Cho, B. van Merrienboer, C¸ . G ¨ ulc¸ehre, D. Bahdanau, F. Bougares, H. Schwenk, and Y. 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), pages 1724–1734, Doha, Qatar, Oct. 2014. Association for Computational Linguistics. URL http://www.aclweb.org/anthology/D14-1179.
282
+ Z. Dai, Z. Yang, Y. Yang, J. G. Carbonell, Q. V. Le, and R. Salakhutdinov. Transformer-XL: Attentive language models beyond a fixed-length context. CoRR, abs/1901.02860, 2019. URL http://arxiv.org/abs/1901.02860.
283
+ A. Defazio and L. Bottou. On the ineffectiveness of variance reduced optimization for deep learning. arXiv preprint arXiv:1812.04529, 2018.
284
+ A. Defazio, F. Bach, and S. Lacoste-Julien. SAGA: A fast incremental gradient method with support for non-strongly convex composite objectives. In NIPS, pages 1646–1654, 2014.
285
+ J. Duchi, E. Hazan, and Y. Singer. Adaptive subgradient methods for online learning and stochastic optimization. Journal of Machine Learning Research, 12(Jul):2121–2159, 2011.
286
+ C. Fang, C. J. Li, Z. Lin, and T. Zhang. Spider: Near-optimal non-convex optimization via stochastic path integrated differential estimator. arXiv preprint arXiv:1807.01695, 2018.
287
+ J. Gehring, M. Auli, D. Grangier, D. Yarats, and Y. N. Dauphin. Convolutional sequence to sequence learning. ArXiv e-prints, May 2017.
288
+ S. Ghadimi and G. Lan. Optimal stochastic approximation algorithms for strongly convex stochastic composite optimization i: A generic algorithmic framework. SIAM Journal on Optimization, 22 (4):1469–1492, 2012.
289
+ S. Ghadimi and G. Lan. Accelerated gradient methods for nonconvex nonlinear and stochastic programming. Mathematical Programming, 156(1-2):59–99, 2016.
290
+ P. Gong and J. Ye. Linear convergence of variance-reduced stochastic gradient without strong convexity. arXiv preprint arXiv:1406.1102, 2014.
291
+ I. Goodfellow, Y. Bengio, and A. Courville. Deep learning. MIT press, 2016.
292
+ E. Hazan, K. Levy, and S. Shalev-Shwartz. Beyond convexity: Stochastic quasi-convex optimization. In Advances in Neural Information Processing Systems, pages 1594–1602, 2015.
293
+ K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770–778, 2016.
294
+ S. Hochreiter and J. Schmidhuber. Long short-term memory. Neural computation, 9(8):1735–1780, 1997.
295
+ C. Jin, P. Netrapalli, and M. I. Jordan. Accelerated gradient descent escapes saddle points faster than gradient descent. In Conference On Learning Theory, pages 1042–1085, 2018.
296
+ R. Johnson and T. Zhang. Accelerating stochastic gradient descent using predictive variance reduction. In Advances in Neural Information Processing Systems, pages 315–323, 2013.
297
+ K. Kawaguchi. Deep learning without poor local minima. In Advances in neural information processing systems, pages 586–594, 2016.
298
+ D. P. Kingma and J. Ba. ADAM: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
299
+ J. Konecnˇ y and P. Richt \` arik. Semi-stochastic gradient descent methods. ´ arXiv:1312.1666, 2013.
300
+ A. Krizhevsky and G. Hinton. Learning multiple layers of features from tiny images. Technical report, Citeseer, 2009.
301
+ K. Y. Levy. The power of normalization: Faster evasion of saddle points. arXiv preprint arXiv:1611.04831, 2016.
302
+ X. Li and F. Orabona. On the convergence of stochastic gradient descent with adaptive stepsizes. arXiv preprint arXiv:1805.08114, 2018.
303
+ H. Lin, J. Mairal, and Z. Harchaoui. A universal catalyst for first-order optimization. In Advances in Neural Information Processing Systems, pages 3384–3392, 2015.
304
+ S. Merity, N. S. Keskar, and R. Socher. Regularizing and optimizing LSTM language models. In International Conference on Learning Representations, 2018. URL https://openreview. net/forum?id ${ . } = { }$ SyyGPP0TZ.
305
+ T. Mikolov, M. Karafiat, L. Burget, J. Cernock ´ y, and S. Khudanpur. Recurrent neural network based ´ language model. In INTERSPEECH 2010, 11th Annual Conference of the International Speech Communication Association, Makuhari, Chiba, Japan, September 26-30, 2010, pages 1045–1048, 2010. URL http://www.isca-speech.org/archive/interspeech_2010/i10_ 1045.html.
306
+ Y. Nesterov. A method of solving a convex programming problem with convergence rate $\mathcal { O } ( 1 / k ^ { 2 } )$ . In Soviet Mathematics Doklady, volume 27, pages 372–376, 1983.
307
+ Y. Nesterov. Efficiency of coordinate descent methods on huge-scale optimization problems. SIAM Journal on Optimization, 22(2):341–362, 2012.
308
+ R. Pascanu, T. Mikolov, and Y. Bengio. Understanding the exploding gradient problem. CoRR, abs/1211.5063, 2, 2012.
309
+ R. Pascanu, T. Mikolov, and Y. Bengio. On the difficulty of training recurrent neural networks. In International conference on machine learning, pages 1310–1318, 2013.
310
+ M. E. Peters, M. Neumann, M. Iyyer, M. Gardner, C. Clark, K. Lee, and L. Zettlemoyer. Deep contextualized word representations. arXiv preprint arXiv:1802.05365, 2018.
311
+ B. T. Polyak. Some methods of speeding up the convergence of iteration methods. USSR Computational Mathematics and Mathematical Physics, 4(5):1–17, 1964.
312
+ B. T. Polyak. Introduction to optimization. optimization software. Inc., Publications Division, New York, 1, 1987.
313
+ S. J. Reddi, S. Kale, and S. Kumar. On the convergence of ADAM and beyond. arXiv preprint arXiv:1904.09237, 2019.
314
+ S. Santurkar, D. Tsipras, A. Ilyas, and A. Madry. How does batch normalization help optimization? In Advances in Neural Information Processing Systems, pages 2483–2493, 2018.
315
+ M. Schmidt, N. Le Roux, and F. Bach. Minimizing finite sums with the stochastic average gradient. Mathematical Programming, 162, 2017.
316
+ S. Shalev-Shwartz and T. Zhang. Accelerated proximal stochastic dual coordinate ascent for regularized loss minimization. In International Conference on Machine Learning, pages 64–72, 2014.
317
+ N. Srivastava, G. Hinton, A. Krizhevsky, I. Sutskever, and R. 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.
318
+ M. Staib, S. J. Reddi, S. Kale, S. Kumar, and S. Sra. Escaping saddle points with adaptive gradient methods. arXiv preprint arXiv:1901.09149, 2019.
319
+ M. Sundermeyer, R. Schluter, and H. Ney. LSTM neural networks for language modeling. In ¨ INTERSPEECH 2012, 13th Annual Conference of the International Speech Communication Association, Portland, Oregon, USA, September 9-13, 2012, pages 194–197, 2012. URL http: //www.isca-speech.org/archive/interspeech_2012/i12_0194.html.
320
+ I. Sutskever, O. Vinyals, and Q. V. Le. Sequence to sequence learning with neural networks. In Advances in Neural Information Processing Systems 27: Annual Conference on Neural Information Processing Systems 2014, December 8-13 2014, Montreal, Quebec, Canada, pages 3104–3112, 2014. URL http://papers.nips.cc/paper/ 5346-sequence-to-sequence-learning-with-neural-networks.
321
+ T. Tieleman and G. Hinton. Lecture 6.5-rmsprop: Divide the gradient by a running average of its recent magnitude. COURSERA: Neural networks for machine learning, 4(2):26–31, 2012.
322
+ L. Wan, M. Zeiler, S. Zhang, Y. L. Cun, and R. Fergus. Regularization of neural networks using DropConnect. In S. Dasgupta and D. McAllester, editors, Proceedings of the 30th International Conference on Machine Learning, volume 28 of Proceedings of Machine Learning Research, pages 1058–1066, Atlanta, Georgia, USA, 17–19 Jun 2013. PMLR. URL http: //proceedings.mlr.press/v28/wan13.html.
323
+ R. Ward, X. Wu, and L. Bottou. Adagrad stepsizes: Sharp convergence over nonconvex landscapes, from any initialization. arXiv preprint arXiv:1806.01811, 2018.
324
+ A. C. Wilson, R. Roelofs, M. Stern, N. Srebro, and B. Recht. The marginal value of adaptive gradient methods in machine learning. In Advances in Neural Information Processing Systems, pages 4148–4158, 2017.
325
+ L. Xiao and T. Zhang. A proximal stochastic gradient method with progressive variance reduction. SIAM Journal on Optimization, 24(4):2057–2075, 2014.
326
+ T. Young, D. Hazarika, S. Poria, and E. Cambria. Recent trends in deep learning based natural language processing. CoRR, abs/1708.02709, 2017. URL http://arxiv.org/abs/1708. 02709.
327
+ D. Zhou, Y. Tang, Z. Yang, Y. Cao, and Q. Gu. On the convergence of adaptive gradient methods for nonconvex optimization. arXiv preprint arXiv:1808.05671, 2018a.
328
+ D. Zhou, P. Xu, and Q. Gu. Stochastic nested variance reduction for nonconvex optimization. In Proceedings of the 32nd International Conference on Neural Information Processing Systems, pages 3925–3936. Curran Associates Inc., 2018b.
329
+ Z. Zhou, Q. Zhang, G. Lu, H. Wang, W. Zhang, and Y. Yu. Adashift: Decorrelation and convergence of adaptive learning rate methods. arXiv preprint arXiv:1810.00143, 2018c.
330
+ F. Zou and L. Shen. On the convergence of weighted adagrad with momentum for training deep neural networks. arXiv preprint arXiv:1808.03408, 2018.
331
+ F. Zou, L. Shen, Z. Jie, W. Zhang, and W. Liu. A sufficient condition for convergences of ADAM and RMSProp. arXiv preprint arXiv:1811.09358, 2018.
332
+
333
+ # A MORE RELATED WORK ON ACCELERATING GRADIENT METHODS
334
+
335
+ Variance reduction. Many efforts have been made to accelerate gradient-based methods. One elegant approach is variance reduction (e.g. Schmidt et al., 2017; Johnson and Zhang, 2013; Defazio et al., 2014; Bach and Moulines, 2013; Konecnˇ y and Richt \` arik ´ , 2013; Xiao and Zhang, 2014; Gong and Ye, 2014; Fang et al., 2018; Zhou et al., 2018b). This technique aims to solve stochastic and finite sum problems by averaging the noise in the stochastic oracle via utilizing the smoothness of the objectives.
336
+
337
+ Momentum methods. Another line of work focuses on achieving acceleration with momentum. Polyak (1964) showed that momentum can accelerate optimization for quadratic problems; later, Nesterov (1983) designed a variation that provably accelerate any smooth convex problems. Based on Nesterov’s work, much theoretical progress was made to accelerate different variations of the original smooth convex problems (e.g. Ghadimi and Lan, 2016; 2012; Beck and Teboulle, 2009; Shalev-Shwartz and Zhang, 2014; Jin et al., 2018; Carmon et al., 2018; Allen-Zhu, 2017; Lin et al., 2015; Nesterov, 2012).
338
+
339
+ Adaptive step sizes. The idea of varying step size in each iteration has long been studied. Armijo (1966) proposed the famous backtracking line search algorithm to choose step size dynamically. Polyak (1987) proposed a strategy to choose step size based on function suboptimality and gradient norm. More recently, Duchi et al. (2011) designed the Adagrad algorithm that can utilize the sparsity in stochastic gradients.
340
+
341
+ Since 2018, there has been a surge in studying the theoretical properties of adaptive gradient methods. One starting point is (Reddi et al., 2019), which pointed out that ADAM is not convergent and proposed the AMSGrad algorithm to fix the problem. Ward et al. (2018); Li and Orabona (2018) prove that Adagrad converges to stationary point for nonconvex stochastic problems. Zhou et al. (2018a) generalized the result to a class of algorithms named Padam. Zou et al. (2018); Staib et al. (2019); Chen et al. (2018); Zhou et al. (2018c); Agarwal et al. (2018); Zhou et al. (2018b); Zou and Shen (2018) also studied different interesting aspects of convergence of adaptive methods. In addition, Levy (2016) showed that normalized gradient descent may have better convergence rate in presence of injected noise. However, the rate comparison is under dimension dependent setting. Hazan et al. (2015) studied the convergence of normalized gradient descent for quasi-convex functions.
342
+
343
+ # B CHALLENGES IN THE PROOFS
344
+
345
+ In this section, we highlight a few key challenges in our proofs. First, the analysis convergence under the relaxed smoothness condition is more difficult than the traditional setup. In particular, classical analyses based on Lipschitz-smooth gradients frequently exploit the descent condition:
346
+
347
+ $$
348
+ \begin{array} { r } { f ( y ) \leq f ( x ) + \langle \nabla f ( x ) , y - x \rangle + \frac { L } { 2 } \| y - x \| ^ { 2 } . } \end{array}
349
+ $$
350
+
351
+ However, under our relaxed smoothness condition, the last term will increase exponentially in $\| y - x \| ^ { 2 }$ . To solve this challenge, we bound the distance moved by clipping and apply Gronwall’s ¨ inequality.
352
+
353
+ Second, our algorithm specific lower bound proved in Theorem 4 is novel and tight up to a log factor.
354
+ To our knowledge, the worst case examples used have not been studied before.
355
+
356
+ Last, proving the convergence of adaptive methods in the nonconvex stochastic setting suffers from a fundamental challenge: the stochastic gradient is dependent on the update step size. This problem is usually circumvented by either assuming gradients have bounded norms or by using a lagging-byone step-size to decouple the correlation. The situation is even worse under the relaxed smoothness assumption. In our case, we overcome this challenge by a novel analysis that divides the proof into the large gradient scenario and the small gradient scenario.
357
+
358
+ # C PROOF OF THEOREM 3
359
+
360
+ We start by proving a lemma that is repeatedly used in later proofs. The lemma bounds the gradient in a neighborhood of the current point by Gronwall’s inequality (integral form). ¨
361
+
362
+ Lemma 9. Given $x$ such that $f ( x ) \leq f ( x _ { 0 } )$ , for any $x ^ { + }$ such that $\| x ^ { + } - x \| \leq \operatorname* { m i n } \{ 1 / L _ { 1 } , 1 \}$ , we have $\| \nabla f ( x ^ { + } ) \| \leq 4 ( L _ { 0 } / L _ { 1 } + \| \nabla f ( x ) \| )$ .
363
+
364
+ Remark 10. Note that the constant “1” comes from the definition of $s$ in (3). If Assumption 3 holds globally, then we do not need to constrain $\| x ^ { + } - x \| \leq 1$ . This version will be used in Theorem 7.
365
+
366
+ Proof. Let $\gamma ( t )$ be a curve defined below,
367
+
368
+ $$
369
+ \gamma ( t ) = t ( x ^ { + } - x ) + x , t \in [ 0 , 1 ] .
370
+ $$
371
+
372
+ Then we have
373
+
374
+ $$
375
+ \nabla f ( \gamma ( t ) ) = \int _ { 0 } ^ { t } \nabla ^ { ( 2 ) } f ( \gamma ( \tau ) ) ( x ^ { + } - x ) d \tau + \nabla f ( \gamma ( 0 ) ) .
376
+ $$
377
+
378
+ By Cauchy-Schwarz’s inequality, we get
379
+
380
+ $$
381
+ \begin{array} { r l r } { { \| \nabla f ( \gamma ( t ) ) \| \le \| x ^ { + } - x \| \int _ { 0 } ^ { t } \| \nabla ^ { ( 2 ) } f ( \gamma ( \tau ) ) \| d \tau + \| \nabla f ( x ) \| } } \\ & { } & { \le \frac { 1 } { L _ { 1 } } \int _ { 0 } ^ { t } ( L _ { 0 } + L _ { 1 } \| \nabla f ( \gamma ( \tau ) ) \| ) d \tau + \| \nabla f ( x ) \| . } \end{array}
382
+ $$
383
+
384
+ The second inequality follows by Assumption 3. Then we can apply the integral form of Gronwall’s ¨ inequality and get
385
+
386
+ $$
387
+ \| \nabla f ( \gamma ( t ) ) \| \leq \frac { L _ { 0 } } { L _ { 1 } } + \| \nabla f ( x ) \| + \int _ { 0 } ^ { t } \left( \frac { L _ { 0 } } { L _ { 1 } } + \| \nabla f ( x ) \| \right) \exp ( t - \tau ) d \tau .
388
+ $$
389
+
390
+ The Lemma follows by setting $t = 1$ .
391
+
392
+ # C.1 PROOF OF THE THEOREM
393
+
394
+ We parameterize the path between $x _ { k }$ and its updated iterate $x _ { k + 1 }$ as follows:
395
+
396
+ $$
397
+ \gamma ( t ) = t ( x _ { k + 1 } - x _ { k } ) + x _ { k } , \forall t \in [ 0 , 1 ] .
398
+ $$
399
+
400
+ Since $x _ { k + 1 } = x _ { k } { - h _ { k } \nabla f } ( x _ { k } )$ , using Taylor’s theorem, the triangle inequality, and Cauchy-Schwarz, we obtain
401
+
402
+ $$
403
+ f ( x _ { k + 1 } ) \leq f ( x _ { k } ) - h _ { k } \| \nabla f ( x _ { k } ) \| ^ { 2 } + \frac { \| x _ { k + 1 } - x _ { k } \| ^ { 2 } } { 2 } \int _ { 0 } ^ { 1 } \| \nabla ^ { 2 } f ( \gamma ( t ) ) \| d t .
404
+ $$
405
+
406
+ Since
407
+
408
+ $$
409
+ h _ { k } \leq \frac { \gamma \eta } { \Vert \nabla f ( x ) \Vert } \leq \operatorname* { m i n } \left\{ \frac { 1 } { \Vert \nabla f ( x ) \Vert } , \frac { 1 } { L _ { 1 } \Vert \nabla f ( x _ { k } ) \Vert } \right\} ,
410
+ $$
411
+
412
+ we know by Lemma 9
413
+
414
+ $$
415
+ \begin{array} { r } { \| \nabla f ( \gamma ( t ) \| \leq 4 ( \frac { L _ { 0 } } { L _ { 1 } } + \| \nabla f ( x ) \| ) . } \end{array}
416
+ $$
417
+
418
+ Then by Assumption 3, we obtain the “descent inequality”:
419
+
420
+ $$
421
+ f ( x _ { k + 1 } ) \leq f ( x _ { k } ) - h _ { k } \| \nabla f ( x _ { k } ) \| ^ { 2 } + \frac { 5 L _ { 0 } + 4 L _ { 1 } \| \nabla f ( x _ { k } ) \| } { 2 } \| \nabla f ( x _ { k } ) \| ^ { 2 } h _ { k } ^ { 2 } .
422
+ $$
423
+
424
+ Therefore, as long as $h _ { k } \leq 1 / ( 5 L _ { 0 } + 4 L _ { 1 } \| \nabla f ( x _ { k } ) \| )$ (which follows by our choice of $\eta , \gamma )$ , we can quantify the descent to be
425
+
426
+ $$
427
+ f ( x _ { k + 1 } ) \leq f ( x _ { k } ) - { \frac { h _ { k } \| \nabla f ( x _ { k } ) \| ^ { 2 } } { 2 } } .
428
+ $$
429
+
430
+ When $\| \nabla f ( x _ { k } ) \| \ge L _ { 0 } / L _ { 1 }$ , we have
431
+
432
+ $$
433
+ \frac { h _ { k } \| \nabla f ( x _ { k } ) \| ^ { 2 } } { 2 } \geq \frac { L _ { 0 } } { 2 0 \operatorname* { m a x } \{ 1 , L _ { 1 } ^ { 2 } \} } .
434
+ $$
435
+
436
+ When $\epsilon \leq \| \nabla f ( x _ { k } ) \| \leq L _ { 0 } / L _ { 1 }$ , we have
437
+
438
+ $$
439
+ \frac { h _ { k } \| \nabla f ( x _ { k } ) \| ^ { 2 } } { 2 } \geq \frac { \| \nabla f ( x _ { k } ) \| ^ { 2 } } { 2 0 L _ { 0 } } \geq \frac { \epsilon ^ { 2 } } { 2 0 L _ { 0 } } .
440
+ $$
441
+
442
+ Therefore,
443
+
444
+ $$
445
+ f ( x _ { k + 1 } ) \leq f ( x _ { k } ) - \operatorname* { m i n } \left\{ \frac { L _ { 0 } } { 2 0 \operatorname* { m a x } \{ 1 , L _ { 1 } ^ { 2 } \} } , \frac { \epsilon ^ { 2 } } { 2 0 L _ { 0 } } \right\} .
446
+ $$
447
+
448
+ Assume that $\epsilon \leq \| \nabla f ( x _ { k } ) \|$ for $k \leq T$ iterations. By doing a telescopic sum, we get
449
+
450
+ $$
451
+ \sum _ { k = 0 } ^ { T - 1 } f ( x _ { k + 1 } ) - f ( x _ { k } ) \leq - T \operatorname* { m i n } \left\{ \frac { L _ { 0 } } { 2 0 \operatorname* { m a x } \{ 1 , L _ { 1 } ^ { 2 } \} } , \frac { \epsilon ^ { 2 } } { 2 0 L _ { 0 } } \right\} .
452
+ $$
453
+
454
+ Rearranging we get
455
+
456
+ $$
457
+ T \leq \frac { 2 0 L _ { 0 } ( f ( x _ { 0 } ) - f ^ { * } ) } { \epsilon ^ { 2 } } + \frac { 2 0 \operatorname* { m a x } \{ 1 , L _ { 1 } ^ { 2 } \} ( f ( x _ { 0 } ) - f ^ { * } ) } { L _ { 0 } } .
458
+ $$
459
+
460
+ # D PROOF OF THEOREM 4
461
+
462
+ We will prove a lower bound for the iteration complexity of GD with fixed step size. The high level idea is that if GD converges for all functions satisfying the assumptions, then the step size needs to be small. However, this small step size will lead to very slow convergence for another function.
463
+
464
+ Recall that the fixed step size GD algorithm is parameterized by the scaler: step size $h$ . First, we show that when $h > \frac { 2 \bar { \log } ( M ) + 2 } { M L _ { 1 } }$ ,
465
+
466
+ $$
467
+ \operatorname* { s u p } _ { x _ { 0 } \in \mathbb { R } ^ { d } } T _ { \epsilon } ( A _ { h } [ f , x _ { 0 } ] , f ) = \infty
468
+ $$
469
+
470
+ We start with a function that grows exponentially. Let $L _ { 1 } > 1 , M > 1$ be fixed constants. Pick the initial point $x _ { 0 } = ( \log ( M ) + 1 ) / L _ { 1 }$ . Let the objective be defined as follows,
471
+
472
+ $$
473
+ f ( x ) = \left\{ \begin{array} { l l } { \frac { e ^ { - L _ { 1 } x } } { L _ { 1 } e } , } & { \mathrm { f o r } x < - \frac { 1 } { L _ { 1 } } , } \\ & { } \\ { \frac { L _ { 1 } x ^ { 2 } } { 2 } + \frac { 1 } { 2 L _ { 1 } } , } & { \mathrm { f o r } x \in [ - \frac { 1 } { L _ { 1 } } , \frac { 1 } { L _ { 1 } } ] , } \\ & { } \\ { \frac { e ^ { L _ { 1 } x } } { L _ { 1 } e } , } & { \mathrm { f o r } x > \frac { 1 } { L _ { 1 } } . } \end{array} \right.
474
+ $$
475
+
476
+ We notice that the function satisfies the assumptions with constants
477
+
478
+ $$
479
+ L _ { 0 } = 1 , \quad L _ { 1 } > 1 , \quad M > 1 .
480
+ $$
481
+
482
+ When $h > 2 x _ { 0 } / M$ , we would have $\vert x _ { 1 } \vert > \vert x _ { 0 } \vert$ . By symmetry of the function and the super-linear growth of the gradient norm, we know that the iterates will diverge. Hence, in order for gradient descent with a fixed step size $h$ to converge, $h$ must be small enough. Formally,
483
+
484
+ $$
485
+ h \leq \frac { 2 x _ { 0 } } { M } = \frac { 2 \log ( M ) + 2 } { M L _ { 1 } } .
486
+ $$
487
+
488
+ Second, we show that when $\begin{array} { r } { h \le \frac { 2 \log ( M ) + 2 } { M L _ { 1 } } } \end{array}$ ,
489
+
490
+ $$
491
+ \operatorname* { s u p } _ { x _ { 0 } \in \mathbb { R } ^ { d } , \atop f \in { \mathcal F } } T _ { \epsilon } ( A _ { h } [ f , x _ { 0 } ] , f ) \geq \Delta L _ { 1 } M / ( 4 \epsilon ^ { 2 } ( \log M + 1 ) )
492
+ $$
493
+
494
+ Now, let’s look at a different objective that grows slowly.
495
+
496
+ $$
497
+ f ( x ) = \left\{ \begin{array} { l l } { - 2 \epsilon ( x + 1 ) + \frac { 5 \epsilon } { 4 } , } & { \mathrm { f o r } x < - 1 , } \\ { \frac { \epsilon } { 4 } ( 6 x ^ { 2 } - x ^ { 4 } ) , } & { \mathrm { f o r } x \in [ - 1 , 1 ] , } \\ { 2 \epsilon ( x - 1 ) + \frac { 5 \epsilon } { 4 } , } & { \mathrm { f o r } x > 1 . } \end{array} \right.
498
+ $$
499
+
500
+ This function is also second order differentiable and satisfies the assumptions with constants in (11). If we set $x _ { 0 } = 1 + \Delta / \epsilon$ for some constant $\Delta > 0$ , we know that $f ( x _ { 0 } ) - f ^ { * } = 2 \Delta + 5 \epsilon / 4$ . With the step size choice $h \leq ( 2 \log M + 2 ) / ( M L _ { 1 } )$ , we know that in each step, $x _ { k + 1 } \geq x _ { k } - ( 4 \epsilon ( \log M +$ $1 ) \bar { ) } / ( L _ { 1 } M )$ . Therefore, for $k \leq \Delta L _ { 1 } M / ( 4 \epsilon ^ { 2 } ( \log M + 1 ) )$ ,
501
+
502
+ $$
503
+ \| \nabla f ( x _ { k } ) \| = 2 \epsilon .
504
+ $$
505
+
506
+ After combining these two points, we proved the theorem by definition (9).
507
+
508
+ # E PROOF OF THEOREM 6
509
+
510
+ We start by parametrizing the function value along the update,
511
+
512
+ $$
513
+ f ( \gamma ( t ) ) : = f ( x _ { k } - t h \nabla f ( x _ { k } ) ) , t \in [ 0 , 1 ] .
514
+ $$
515
+
516
+ Note that with this parametrization, we have $\gamma ( 0 ) = x _ { k } , \gamma ( 1 ) = x _ { k + 1 } .$ Now we would like to argue that if $f ( x _ { k } ) \leq f ( { \bar { x } } _ { 0 } )$ , then $\| \nabla f ( x ( t ) ) \| \leq M , \forall t \leq 1$ . Assume by contradiction that this is not true. Then there exists $\epsilon > 0 , t \in [ 0 , 1 ]$ such that $\| \nabla f ( x ( t ) ) \| \ge M + \epsilon$ . Since $\epsilon$ can be made arbitrarily small below a threshold, we assume $\epsilon < M$ . Denote
517
+
518
+ $$
519
+ t ^ { * } = \operatorname* { i n f } \{ t \mid \| \nabla f ( x ( t ) ) \| \geq M + \epsilon \} .
520
+ $$
521
+
522
+ The value $t ^ { * }$ exists by continuity of $\| \nabla f ( x ( t ) ) \|$ as a function of $t$ . Then we know by Assumption 4 that $f ( x ( t ^ { * } ) ) > f ( \dot { x _ { k } } )$ . However, by Taylor expansion, we know that
523
+
524
+ $$
525
+ \begin{array} { r l } & { f ( x ( t ^ { * } ) ) \leq f ( x _ { k } ) - t h \| \nabla f ( x _ { k } ) \| ^ { 2 } + ( t h ) ^ { 2 } \| \nabla f ( x _ { k } ) \| ^ { 2 } \displaystyle \int _ { 0 } ^ { t } \| \nabla ^ { ( 2 ) } f ( x ( \tau ) ) \| d \tau } \\ & { \qquad \leq f ( x _ { k } ) - t h \| \nabla f ( x _ { k } ) \| ^ { 2 } + ( t h ) ^ { 2 } \| \nabla f ( x _ { k } ) \| ^ { 2 } \displaystyle ( L _ { 1 } ( M + \epsilon ) + L _ { 0 } ) } \\ & { \qquad \leq f ( x _ { k } ) . } \end{array}
526
+ $$
527
+
528
+ The last inequality follows by $h = 1 / ( 2 ( M L _ { 1 } + L _ { 0 } ) )$ . Hence we get a contradiction and conclude that for all $t \leq 1$ , $\| \nabla f ( x ( t ) ) \| \leq M$ . Therefore, following the above inequality and Assumption 3, we get
529
+
530
+ $$
531
+ \begin{array} { l } { f ( x _ { k + 1 } ) \leq f ( x _ { k } ) - h \| \nabla f ( x _ { k } ) \| ^ { 2 } + h ^ { 2 } \displaystyle \frac { L _ { 1 } M + L _ { 0 } } { 2 } \| \nabla f ( x _ { k } ) \| ^ { 2 } } \\ { \leq f ( x _ { k } ) - \displaystyle \frac { \epsilon ^ { 2 } } { 4 ( M L _ { 1 } + L _ { 0 } ) } . } \end{array}
532
+ $$
533
+
534
+ The conclusion follows by the same argument as in Theorem 3 via a telescopic sum over $k$ .
535
+
536
+ # F PROOF OF THEOREM 7
537
+
538
+ Recall that we set the following parameters
539
+
540
+ $$
541
+ \begin{array} { l } { { h _ { k } = \operatorname* { m i n } \{ \frac { 1 } { 1 6 \eta L _ { 1 } ( \left| \left| g _ { k } \right| \right| + \tau ) } , \eta \} } } \\ { { \eta = \operatorname* { m i n } \{ \frac { 1 } { 2 0 L _ { 0 } } , \frac { 1 } { 1 2 8 L _ { 1 } \tau } , \frac { 1 } { \sqrt { T } } \} } } \end{array}
542
+ $$
543
+
544
+ Similar to proof of Theorem 3, we have
545
+
546
+ $$
547
+ \begin{array} { r l } { { \mathbb { E } [ f ( x _ { k + 1 } ) ] \| \leq f ( x _ { k } ) - \mathbb { E } [ h _ { k } \langle g _ { k } , \nabla f ( x _ { k } ) \rangle ] + \frac { 5 L _ { 0 } + 4 L _ { 1 } \| \nabla f ( x _ { k } ) \| } { 2 } \mathbb { E } [ h _ { k } ^ { 2 } \| g _ { k } \| ^ { 2 } ] } } \\ & { \leq f ( x _ { k } ) - \mathbb { E } [ h _ { k } \langle g _ { k } , \nabla f ( x _ { k } ) \rangle ] + \frac { 5 L _ { 0 } + 4 L _ { 1 } \| \nabla f ( x _ { k } ) \| } { 2 } \mathbb { E } [ h _ { k } ^ { 2 } ( \| \nabla f ( x _ { k } ) \| ^ { 2 } } \\ & { \quad + \| g _ { k } - \nabla f ( x _ { k } ) \| ^ { 2 } + 2 \langle \nabla f ( x _ { k } ) , g _ { k } - \nabla f ( x _ { k } ) \rangle ] } \\ & { \leq f ( x _ { k } ) + \mathbb { E } [ - h _ { k } + \frac { 5 L _ { 0 } + 4 L _ { 1 } \| \nabla f ( x _ { k } ) \| } { 2 } h _ { k } ^ { 2 } ] \| \nabla f ( x _ { k } ) \| ^ { 2 } } \\ & { \quad + \mathbb { E } [ h _ { k } ( - 1 + ( 5 L _ { 0 } + 4 L _ { 1 } \| \nabla f ( x _ { k } ) \| ) h _ { k } ) \langle \nabla f ( x _ { k } ) , g _ { k } - \nabla f ( x _ { k } ) \rangle ] } \\ & { \quad + \frac { 5 L _ { 0 } + 4 L _ { 1 } \| \nabla f ( x _ { k } ) \| } { 2 } \mathbb { E } [ h _ { k } ^ { 2 } ( \| g _ { k } - \nabla f ( x _ { k } ) \| ^ { 2 } ) ] } \end{array}
548
+ $$
549
+
550
+ First we show $\begin{array} { r } { ( 5 L _ { 0 } + 4 L _ { 1 } \| \nabla f ( x _ { k } ) \| ) h _ { k } \leq \frac 1 2 } \end{array}$ . This follows by $\begin{array} { r } { 5 L _ { 0 } h _ { k } \le \frac { 1 } { 4 } , h _ { k } 4 L _ { 1 } \| \nabla f ( x _ { k } ) \| \le } \end{array}$ $h _ { k } 4 L _ { 1 } ( \left\| g _ { k } \right\| + \tau ) \leq \frac 1 4$ . Substitute in (15) and we get
551
+
552
+ $$
553
+ \begin{array} { r l } & { \mathbb { E } [ f ( x _ { k + 1 } ) \| \le f ( x _ { k } ) + \mathbb { E } [ - \frac { 3 h _ { k } } { 4 } ] \| \nabla f ( x _ { k } ) \| ^ { 2 } } \\ & { \qquad + \underbrace { \mathbb { E } [ - h _ { k } \langle \nabla f ( x _ { k } ) , g _ { k } - \nabla f ( x _ { k } ) \rangle ] } _ { T _ { 1 } } } \\ & { \qquad + \underbrace { \mathbb { E } [ ( 5 L _ { 0 } + 4 L _ { 1 } \| \nabla f ( x _ { k } ) \| ) h _ { k } ^ { 2 } \langle \nabla f ( x _ { k } ) , g _ { k } - \nabla f ( x _ { k } ) \rangle ] } _ { T _ { 2 } } } \\ & { \qquad + \underbrace { \frac { 5 L _ { 0 } + 4 L _ { 1 } \| \nabla f ( x _ { k } ) \| } { 2 } \mathbb { E } [ h _ { k } ^ { 2 } ( \| g _ { k } - \nabla f ( x _ { k } ) \| ^ { 2 } ) ] } _ { T _ { 3 } } } \end{array}
554
+ $$
555
+
556
+ Then we bound $T _ { 1 } , T _ { 2 } , T _ { 3 }$ in Lemma 11,12,13 and get
557
+
558
+ $$
559
+ \begin{array} { r l } { { \mathbb { E } [ f ( x _ { k + 1 } ) ] ] \le f ( x _ { k } ) + \mathbb { E } [ - \frac { h _ { k } } { 4 } ] \| \nabla f ( x _ { k } ) \| ^ { 2 } } } \\ & { \quad + ( 5 L _ { 0 } + 2 L _ { 1 } \tau ) \eta ^ { 2 } \tau ^ { 2 } + 9 \eta ^ { 2 } \tau L _ { 0 } ^ { 2 } / L _ { 1 } } \end{array}
560
+ $$
561
+
562
+ Rearrange and do a telescopic sum, we get
563
+
564
+ $$
565
+ \begin{array} { r l r } { { \mathbb { E } [ \sum _ { k \le T } \frac { h _ { k } } { 4 } \| \nabla f ( x _ { k } ) \| ^ { 2 } ] \le f ( x _ { 0 } ) - f ^ { * } + \eta ^ { 2 } T \bigl ( ( 5 L _ { 0 } + 2 L _ { 1 } \tau ) \tau ^ { 2 } + 9 \tau L _ { 0 } ^ { 2 } / L _ { 1 } \bigr ) } } \\ & { } & \\ & { } & { \le f ( x _ { 0 } ) - f ^ { * } + \bigl ( ( 5 L _ { 0 } + 2 L _ { 1 } \tau ) \tau ^ { 2 } + 9 \tau L _ { 0 } ^ { 2 } / L _ { 1 } \bigr ) } \end{array}
566
+ $$
567
+
568
+ Furthermore, we know
569
+
570
+ $$
571
+ \begin{array} { l } { h _ { k } \| \nabla f _ { k } \| ^ { 2 } = \operatorname* { m i n } \lbrace \eta , \frac { 1 } { 1 6 L _ { 1 } ( \| \nabla f _ { k } \| + \tau ) } \rbrace \| \nabla f _ { k } \| ^ { 2 } } \\ { \qquad \geq \operatorname* { m i n } \lbrace \eta , \frac { 1 } { 3 2 L _ { 1 } \| \nabla f _ { k } \| } , \frac { 1 } { 3 2 L _ { 1 } \tau } \rbrace \| \nabla f _ { k } \| ^ { 2 } } \\ { \qquad \geq \operatorname* { m i n } \lbrace \eta , \frac { 1 } { 3 2 L _ { 1 } \| \nabla f _ { k } \| } \rbrace \| \nabla f _ { k } \| ^ { 2 } } \end{array}
572
+ $$
573
+
574
+ Hence along with $\eta \le T ^ { - 1 / 2 }$ , we get
575
+
576
+ $$
577
+ \mathbb { E } [ \sum _ { k \le T } \operatorname* { m i n } \{ \eta \| \nabla f _ { k } \| ^ { 2 } , \frac { \| \nabla f _ { k } \| } { 3 2 L _ { 1 } } \} ] \le f ( x _ { 0 } ) - f ^ { * } + ( ( 5 L _ { 0 } + 2 L _ { 1 } \tau ) \tau ^ { 2 } + 9 \tau L _ { 0 } ^ { 2 } / L _ { 1 } )
578
+ $$
579
+
580
+ Let $\begin{array} { r } { \mathcal { U } = \{ k | \eta | \| \nabla f _ { k } \| ^ { 2 } \le \frac { \| \nabla f _ { k } \| } { 1 6 L _ { 1 } } \} } \end{array}$ , we know that
581
+
582
+ $$
583
+ \mathbb { E } [ \sum _ { k \in \mathcal { U } } \eta \| \nabla f _ { k } \| ^ { 2 } ] \le f ( x _ { 0 } ) - f ^ { * } + ( ( 5 L _ { 0 } + 2 L _ { 1 } \tau ) \tau ^ { 2 } + 9 \tau L _ { 0 } ^ { 2 } / L _ { 1 } ) ,
584
+ $$
585
+
586
+ and
587
+
588
+ $$
589
+ \mathbb { E } [ \sum _ { k \in \mathcal { U } ^ { c } } \frac { \| \nabla f _ { k } \| } { 3 2 L _ { 1 } } ] \le f ( x _ { 0 } ) - f ^ { * } + ( ( 5 L _ { 0 } + 2 L _ { 1 } \tau ) \tau ^ { 2 } + 9 \tau L _ { 0 } ^ { 2 } / L _ { 1 } ) .
590
+ $$
591
+
592
+ Therefore,
593
+
594
+ $$
595
+ \begin{array} { r l } & { \mathsf { f } [ \operatorname* { m i n } _ { k } \| \nabla f ( x _ { k } ) \| ] \le \mathbb { E } [ \operatorname* { m i n } \{ \displaystyle \frac { 1 } { | { \cal U } | } \sum _ { k \in { \cal U } } \| \nabla f _ { k } \| ] , \displaystyle \frac { 1 } { | { \cal U } ^ { c } | } \sum _ { k \in { \cal U } ^ { c } } \| \nabla f _ { k } \| \} ] } \\ & { \le \mathbb { E } [ \operatorname* { m i n } \{ \sqrt { \displaystyle \frac { 1 } { | { \cal U } | } \sum _ { k \in { \cal U } } \| \nabla f _ { k } \| ^ { 2 } } , \displaystyle \frac { 1 } { | { \cal U } ^ { c } | } \sum _ { k \in { \cal U } ^ { c } } \| \nabla f _ { k } \| \} ] } \\ & { \le \operatorname* { m a x } \{ \sqrt { f ( x _ { 0 } ) - f ^ { * } + ( ( 5 L _ { 0 } + 2 L _ { 1 } \tau ) \tau ^ { 2 } + 9 \tau L _ { 0 } ^ { 2 } / L _ { 1 } ) \displaystyle \frac { \sqrt { T } + 2 0 L _ { 0 } + 1 2 8 L _ { 1 } \tau } { T } } , } \\ & { \quad \quad \quad \quad ( f ( x _ { 0 } ) - f ^ { * } + ( 5 L _ { 0 } + 2 L _ { 1 } \tau ) \tau ^ { 2 } + 9 \tau L _ { 0 } ^ { 2 } / L _ { 1 } ) \displaystyle \frac { 6 4 L _ { 1 } } { T } \} . } \end{array}
596
+ $$
597
+
598
+ The last inequality follow by the fact that either $| \mathcal { U } | \ge T / 2$ or $| \mathcal { U } ^ { c } | \ge T / 2$ . This implies that $\begin{array} { r } { \mathbb { E } [ \operatorname* { m i n } _ { k \leq T } \| \nabla f ( x _ { k } ) \| ] \leq 2 \epsilon } \end{array}$ when
599
+
600
+ $$
601
+ T \geq \Delta \operatorname* { m a x } \{ \frac { 1 2 8 L _ { 1 } } { \epsilon } , \frac { 4 \Delta } { \epsilon ^ { 4 } } , \frac { 8 0 L _ { 0 } + 5 1 2 L _ { 1 } \tau } { \epsilon ^ { 2 } } \} ,
602
+ $$
603
+
604
+ where $\Delta = ( f ( x _ { 0 } ) - f ^ { * } + ( 5 L _ { 0 } + 2 L _ { 1 } \tau ) \tau ^ { 2 } + 9 \tau L _ { 0 } ^ { 2 } / L _ { 1 } )$ . By Markov inequality,
605
+
606
+ $$
607
+ \mathbb { P } \{ \operatorname* { m i n } _ { k \leq T } \| \nabla f ( x _ { k } ) \| \leq \epsilon \} \geq \frac { 1 } { 2 } .
608
+ $$
609
+
610
+ The theorem follows by the definition in (9).
611
+
612
+ # F.1 TECHNICAL LEMMAS
613
+
614
+ # Lemma 11.
615
+
616
+ $$
617
+ \mathbb { E } [ - h _ { k } \langle \nabla f ( x _ { k } ) , g _ { k } - \nabla f ( x _ { k } ) \rangle ] \leq { \frac { 1 } { 4 } } \mathbb { E } [ h _ { k } ] \| \nabla f ( x _ { k } ) \| ^ { 2 } .
618
+ $$
619
+
620
+ Proof. By unbiasedness of $g _ { k }$ and the fact that $\eta$ is a constant, we have
621
+
622
+ $$
623
+ \begin{array} { r l } { \mathbb { E } [ - h _ { k } \langle \nabla f ( x _ { k } ) , g _ { k } - \nabla f ( x _ { k } ) \rangle ] = \mathbb { E } [ ( \eta - h _ { k } ) \langle \nabla f ( x _ { k } ) , g _ { k } - \nabla f ( x _ { k } ) \rangle ] } & { } \\ & { = \mathbb { E } [ ( \eta - h _ { k } ) \langle \nabla f ( x _ { k } ) , g _ { k } - \nabla f ( x _ { k } ) \rangle \mathbb { 1 } _ { \{ \| g _ { k } \| \ge \frac { 1 } { 1 6 L _ { 1 } \eta } - \tau \} } ] } \\ & { \le \eta \| \nabla f ( x _ { k } ) \| \mathbb { E } [ \| g _ { k } - \nabla f ( x _ { k } ) \| \mathbb { 1 } _ { \{ \| g _ { k } \| \ge \frac { 1 } { 1 6 L _ { 1 } \eta } - \tau \} } ] } \\ & { \le \eta \| \nabla f ( x _ { k } ) \| ^ { 2 } 3 2 L _ { 1 } \mathbb { E } [ h _ { k } ] \tau } \end{array}
624
+ $$
625
+
626
+ The second last inequality follows by $h _ { k } \leq \eta$ and Cauchy-Schwartz inequality. The last inequality follows by
627
+
628
+ $$
629
+ \Vert \nabla f ( x _ { k } ) \Vert \ge \Vert g _ { k } \Vert - \tau = \frac { 1 } { 1 6 L _ { 1 } h _ { k } } - 2 \tau \ge \frac { 1 } { 1 6 L _ { 1 } h _ { k } } - \frac { 1 } { 3 2 L _ { 1 } \eta } \ge \frac { 1 } { 3 2 L _ { 1 } h _ { k } } .
630
+ $$
631
+
632
+ The equality above holds because $\begin{array} { r } { h _ { k } = \frac { 1 } { 1 6 \eta L _ { 1 } ( \left. { g _ { k } } \right. + \tau ) } . } \end{array}$ . The lemma follows by $3 2 \eta L _ { 1 } \tau \leq 1 / 4$ .
633
+
634
+ # Lemma 12.
635
+
636
+ $$
637
+ \mathbb { E } \big [ ( 5 L _ { 0 } + 4 L _ { 1 } \| \nabla f ( x _ { k } ) \| ) h _ { k } ^ { 2 } \langle \nabla f ( x _ { k } ) , g _ { k } - \nabla f ( x _ { k } ) \rangle \big ] \leq 9 \eta ^ { 2 } \tau L _ { 0 } ^ { 2 } / L _ { 1 } + \frac { 1 } { 8 } \mathbb { E } [ h _ { k } ] \| \nabla f ( x _ { k } ) \| ^ { 2 } .
638
+ $$
639
+
640
+ Proof. When $\| \nabla f ( x _ { k } ) \| \ge L _ { 0 } / L _ { 1 }$
641
+
642
+ $$
643
+ \begin{array} { r l } & { \mathbb { E } [ ( 5 L _ { 0 } + 4 L _ { 1 } \| \nabla f ( x _ { k } ) \| ) h _ { k } ^ { 2 } \langle \nabla f ( x _ { k } ) , g _ { k } - \nabla f ( x _ { k } ) \rangle ] \leq 9 L _ { 1 } \| \nabla f ( x _ { k } ) \| \mathbb { E } [ h _ { k } ^ { 2 } ] \| \nabla f ( x _ { k } ) \| \tau } \\ & { \qquad \leq \frac { 1 } { 8 } \mathbb { E } [ h _ { k } ] \| \nabla f ( x _ { k } ) \| ^ { 2 } } \end{array}
644
+ $$
645
+
646
+ The last inequality follows by (12).
647
+
648
+ When $\| \nabla f ( x _ { k } ) \| \leq L _ { 0 } / L _ { 1 }$ ,
649
+
650
+ $$
651
+ \mathbb { E } [ ( 5 L _ { 0 } + 4 L _ { 1 } \| \nabla f ( x _ { k } ) \| ) h _ { k } ^ { 2 } \langle \nabla f ( x _ { k } ) , g _ { k } - \nabla f ( x _ { k } ) \rangle ] \le 9 \eta ^ { 2 } \tau L _ { 0 } ^ { 2 } / L _ { 1 }
652
+ $$
653
+
654
+ # Lemma 13.
655
+
656
+ $$
657
+ \frac { 5 L _ { 0 } + 4 L _ { 1 } \| \nabla f ( x _ { k } ) \| } { 2 } \mathbb { E } [ h _ { k } ^ { 2 } ( \| g _ { k } - \nabla f ( x _ { k } ) \| ^ { 2 } ) ] \leq ( 5 L _ { 0 } + 2 L _ { 1 } \tau ) \eta ^ { 2 } \tau ^ { 2 } + \frac { 1 } { 8 } \| \nabla f ( x _ { k } ) \| ^ { 2 } \mathbb { E } [ h _ { k } ] .
658
+ $$
659
+
660
+ Proof. When $\| \nabla f ( x _ { k } ) \| \ge L _ { 0 } / L _ { 1 } + \tau$ , we get
661
+
662
+ $$
663
+ \frac { 5 L _ { 0 } + 4 L _ { 1 } \| \nabla f ( x _ { k } ) \| } { 2 } \mathbb { E } [ h _ { k } ^ { 2 } ( \| g _ { k } - \nabla f ( x _ { k } ) \| ^ { 2 } ) ] \le 5 L _ { 1 } \| \nabla f ( x _ { k } ) \| ^ { 2 } \mathbb { E } [ h _ { k } ] \eta \tau \le \frac { 1 } { 8 } \| \nabla f ( x _ { k } ) \| ^ { 2 } \mathbb { E } [ h _ { k } ] .
664
+ $$
665
+
666
+ The first inequality follows by $h _ { k } \leq \eta$ and $\| g _ { k } - \nabla f ( x _ { k } ) \| \leq \tau \leq \| \nabla f ( x _ { k } ) \|$ .The last inequality follows by (12).
667
+
668
+ When $\| \nabla f ( x _ { k } ) \| \le L _ { 0 } / L _ { 1 } + \tau$ , we get
669
+
670
+ $$
671
+ \frac { 5 L _ { 0 } + 4 L _ { 1 } \| \nabla f ( x _ { k } ) \| } { 2 } \mathbb { E } [ h _ { k } ^ { 2 } ( \| g _ { k } - \nabla f ( x _ { k } ) \| ^ { 2 } ) ] \le ( 5 L _ { 0 } + 2 L _ { 1 } \tau ) \eta ^ { 2 } \tau ^ { 2 } .
672
+ $$
673
+
674
+ # G PROOF OF THEOREM 8
675
+
676
+ Similar to proof of Theorem 3, we have
677
+
678
+ $$
679
+ \begin{array} { l } { \displaystyle \mathbb { E } [ f ( x _ { k + 1 } ) | ] \leq f ( x _ { k } ) - \mathbb { E } [ h _ { k } \langle g _ { k } , \nabla f ( x _ { k } ) \rangle ] + \frac { 5 L _ { 0 } + 4 L _ { 1 } \| \nabla f ( x _ { k } ) \| } { 2 } \mathbb { E } [ h _ { k } ^ { 2 } \| g _ { k } \| ^ { 2 } ] } \\ { \displaystyle \leq f ( x _ { k } ) - \frac { 1 } { \sqrt { T } } \| \nabla f ( x _ { k } ) \| ^ { 2 } + \frac { 5 L _ { 0 } + 4 L _ { 1 } M ( M + \tau ) ^ { 2 } } { 2 T } } \end{array}
680
+ $$
681
+
682
+ Sum across $k \in \{ 0 , . . . , T - 1 \}$ and take expectations, then we can get
683
+
684
+ $$
685
+ 0 \leq f ( x _ { 0 } ) - \mathbb { E } [ f ( x _ { T } ) ] - { \frac { 1 } { \sqrt { T } } } \sum _ { k = 1 } ^ { T } \mathbb { E } \Big [ \| \nabla f ( x _ { k } ) \| ^ { 2 } \Big ] + { \frac { 5 L _ { 0 } + 4 L _ { 1 } M ( M + \tau ) ^ { 2 } } { 2 } }
686
+ $$
687
+
688
+ Rearrange and we get
689
+
690
+ $$
691
+ \frac { 1 } { T } \sum _ { k = 1 } ^ { T } \mathbb { E } \Big [ \| \nabla f ( x _ { k } ) \| ^ { 2 } \Big ] \leq \frac { 1 } { \sqrt { T } } \Bigg ( f ( x _ { 0 } ) - f ^ { * } + \frac { 5 L _ { 0 } + 4 L _ { 1 } M ( M + \tau ) ^ { 2 } } { 2 } \Bigg )
692
+ $$
693
+
694
+ By Jensen’s inequality,
695
+
696
+ $$
697
+ \frac { 1 } { T } \sum _ { k = 1 } ^ { T } \mathbb { E } [ \| \nabla f ( x _ { k } ) \| ] \leq \sqrt { \frac { 1 } { \sqrt { T } } } \bigg ( f ( x _ { 0 } ) - f ^ { * } + \frac { 5 L _ { 0 } + 4 L _ { 1 } M ( M + \tau ) ^ { 2 } } { 2 } \bigg )
698
+ $$
699
+
700
+ By Markov inequality,
701
+
702
+ $$
703
+ \mathbb { P } \Bigg \{ \frac { 1 } { T } \sum _ { k = 1 } ^ { T } \Big [ \| \nabla f ( x _ { k } ) \| ^ { 2 } \Big ] > \frac { 2 } { \sqrt { T } } \bigg ( f ( x _ { 0 } ) - f ^ { * } + \frac { 5 L _ { 0 } + 4 L _ { 1 } M ( M + \tau ) ^ { 2 } } { 2 } \bigg ) \Bigg \} \leq 0 . 5
704
+ $$
705
+
706
+ The theorem follows by the definition in (9) and Jensen’s inequality.
707
+
708
+ # H EXPERIMENT DETAILS
709
+
710
+ In this section, we first briefly overview the tasks and models used in our experiment. Then we explain how we estimate smoothness of the function. Lastly, we describe some details for generating the plots in Figure 2 and Figure 3.
711
+
712
+ # H.1 LANGUAGE MODELLING
713
+
714
+ Clipped gradient descent was introduced in (vanilla) recurrent neural network (RNN) language model (LM) (Mikolov et al., 2010) training to alleviate the exploding gradient problem, and has been used in more sophisticated RNN models (Hochreiter and Schmidhuber, 1997) or seq2seq models for language modelling or other NLP applications (Sutskever et al., 2014; Cho et al., 2014). In this work we experiment with LSTM LM (Sundermeyer et al., 2012), which has been an important building block for many popular NLP models (Young et al., 2017).
715
+
716
+ The task of language modelling is to model the probability of the next word $w _ { t + 1 }$ based on word history (or context). Given a document of length $T$ (words) as training data, the training objective is to minimize negative log-likelihood of the data $\begin{array} { r } { \frac { - 1 } { T } \dot { \Sigma } _ { t = 1 } ^ { T } \log P ( w _ { t } | w _ { 1 } . . . w _ { t - 1 } ) } \end{array}$ .
717
+
718
+ We run LM experiments on the Penn Treebank (PTB) (Mikolov et al., 2010) dataset, which has been a popular benchmark for language modelling. It has a vocabulary of size $1 0 \mathrm { k }$ , and $8 8 7 \mathrm { k } / 7 0 \mathrm { k } / 7 8 \mathrm { k }$ words for training/validation/testing.
719
+
720
+ To train the LSTM LM, we follow the training recipe from 3 (Merity et al., 2018). The model is a 3-layer LSTM LM with hidden size of 1150 and embedding size of 400. Dropout (Srivastava et al., 2014) of rate 0.4 and DropConnect (Wan et al., 2013) of rate 0.5 is applied. For optimization, clipped SGD with clip value of 0.25 and a learning rate of 30 is used, and the model is trained for 500 epochs. After training, the model reaches a text-set perplexity of 56.5, which is very close to the current state-of-art result (Dai et al., 2019) on the PTB dataset.
721
+
722
+ # H.2 IMAGE CLASSIFICATION
723
+
724
+ As a comparison, we run the same set of experiments on image classification tasks. We train the ResNet20 (He et al., 2016) model on Cifar10 (Krizhevsky and Hinton, 2009) classification dataset. The dataset contains $5 0 \mathrm { k }$ training images and 10k testing images in 10 classes.
725
+
726
+ Unless explicitly state, we use the standard hyper-parameters based on the Github repository4. Our baseline algorithm runs SGD momentum with learning rate 0.1, momentum 0.9 for 200 epochs. We choose weight decay to be $5 e { - 4 }$ . The learning rate is reduced by 10 at epoch 100 and 150. Up to our knowledge, this baseline achieves the best known test accuracy $( 9 5 . 0 \% )$ for Resnet20 on Cifar10. The baseline already beats some recently proposed algorithms which claim to improve upon SGD momentum.
727
+
728
+ ![](images/1d1019a5d7cc78ff94457a13bb6bd1316ab20bfd283c1721542c9ffe3a28ddc8.jpg)
729
+ Figure 5: Auxiliary plots for Figure 2a. The left subfigure shows the values scattered on linear scale. The right subfigure shows more data points from 200 epochs.
730
+
731
+ ![](images/f78c85ce67c6a1b84eb78b1135eef1177756e0e26917f85ed7a3cb2ed6acfc4c.jpg)
732
+ Figure 6: Estimated gradient norm and smoothness using $10 \%$ data versus all data. The values are computed from checkpoints of the LSTM LM model in the first epoch. This shows that statistics evaluated from $1 0 \%$ of the entire dataset provides accurate estimation.
733
+
734
+ # H.3 ESTIMATING SMOOTHNESS
735
+
736
+ Our smoothness estimator follows a similar implementation as in (Santurkar et al., 2018). More precisely, given a sequence of iterates generated by training procedure $\{ x _ { k } \} _ { k }$ , we estimate the smoothness $\hat { L } ( x _ { k } )$ as follows. For some small value $\delta \in ( 0 , 1 ) , d = x _ { k + 1 } - x _ { k }$ ,
737
+
738
+ $$
739
+ \hat { L } ( x _ { k } ) = \operatorname* { m a x } _ { \gamma \in \{ \delta , 2 \delta , \ldots , 1 \} } \frac { \| \nabla f ( x + \gamma d ) - \nabla f ( x ) \| } { \| \gamma d \| } .
740
+ $$
741
+
742
+ This suggests that we only care about the variation of gradient along $x _ { k + 1 } - x _ { k }$ . The motivation is based on the function upper bound (10), which shows that the deviation of the objective from its linear approximation is determined by the variation of gradient between $x _ { k + 1 }$ and $x _ { k }$ .
743
+
744
+ # H.4 ADDITIONAL PLOTS
745
+
746
+ The plots in Figure 2a show log-scale scattered data for iterates in the first epoch. To supplement this result, we show in Figure 5a the linear scale plot of the same data as in Figure 2a. In Figure 5b, we run the same experiment as in Figure 2a for 200 epochs instead of 1 epoch and plot the gradient norm and estimated smoothness along the trajectory.
747
+
748
+ In Figure 2, we plot the correlation between gradient norm and smoothness in LSTM LM training. We take snapshots of the model every 5 iterations in the first epoch, and use $10 \%$ of training data to estimate gradient norm and smoothness. As shown in Figure 6, using $1 0 \%$ of the data provides a very accurate estimate of the smoothness computed from the entire data.
749
+
750
+ # I A SYNTHETIC EXPERIMENT
751
+
752
+ In this section, we demonstrate the different behaviors of gradient descent versus clipped gradient descent by optimizing a simple polynomial $f ( x ) = x ^ { 4 }$ . We initialize the point at $x _ { 0 } = 3 0$ and run both algorithms. Within the sublevel set $[ - 3 0 , 3 0 ]$ , the function satisfies
753
+
754
+ $$
755
+ \begin{array} { r } { f ^ { \prime \prime } ( x ) \leq 1 2 \times 3 0 ^ { 2 } = 1 . 0 8 \times 1 0 ^ { 4 } } \\ { f ^ { \prime \prime } ( x ) \leq 1 0 f ^ { \prime } ( x ) + 0 . 1 . } \end{array}
756
+ $$
757
+
758
+ Therefore, we can either pick $L _ { 1 } = 0 , L _ { 0 } = 1 . 0 8 ^ { 4 }$ for gradient descent or $L _ { 1 } = 1 0 . L _ { 0 } = 0 . 1$ for clipped GD. Since the theoretical analysis is not tight with respect to constants, we scan the step sizes to pick the best parameter for both algorithms. For gradient descent, we scan step size by halving the current steps. For clipped gradient descent, we fix threshold to be 0.01 and pick the step size in the same way. The convergence results are shown in Figure 7. We can conclude that clipped gradient descent converges much faster than vanilla gradient descent, as the theory suggested.
759
+
760
+ ![](images/406142130d68091d97cbda80b97306a35ddaa7afad510075ae1dd74a4a75a1e7.jpg)
761
+ Figure 7: An synthetic experiment to optimize $f ( x ) = x ^ { 4 }$ . (a) Gradient descent with different step size. (b) Clipped gradient descent with different step size and threshold $= 0 . 0 1$ .
762
+
763
+ # J A QUANTITATIVE COMPARISON OF THEOREMS AND EXPERIMENTS
764
+
765
+ To quantify how much the result align with the theorem, we assume that the leading term in the iteration complexity is the $\epsilon$ dependent term. For GD, the term scales as $\begin{array} { r } { \mathcal { O } ( \frac { M L _ { 1 } + L _ { 0 } ^ { - } } { \sqrt { T } } ) } \end{array}$ , while for Clipped GD, the term scales as $\begin{array} { r l } { \mathcal { O } \big ( \frac { L _ { 0 } } { \sqrt { T } } \big ) } \end{array}$ .
766
+
767
+ First, we start with the synthetic experiment presented in I. From theory, we infer that the improvement of $\begin{array} { r } { \frac { f ^ { \prime } ( x _ { G D } ) } { f ^ { \prime } ( x _ { C G D } ) } \ \approx \ \frac { L _ { 0 } } { M L _ { 1 } + L _ { 0 } } \ \approx \ 1 e 5 } \end{array}$ . In experiment, the best performing GD reaches $f ^ { \prime } ( x _ { T } ) = 0 . 3 6$ , while for clipped GD, the value is $1 . 3 e \mathrm { ~ - ~ } 8$ , and the ratio is $\begin{array} { r } { \frac { f ^ { \prime } ( x _ { G D } ) } { f ^ { \prime } ( x _ { C G D } ) } \approx 1 e 7 . } \end{array}$ . This suggests that in this very adversarial (against vanilla GD) synthetic experiment, the theorem is correct but conservative.
768
+
769
+ Next, we test how well the theory can align with practice in neural network training. To do so, we rerun the PTB experiment in 5 with a smaller architecture (2-Layer LSTM with 200 embedding dimension and 512 inner dimension). We choose hyperparameters based on Figure 4a. For clipped GD, we choose clipping threshold to be 0.25 and learning rate to be 10. For GD, we use a learning rate 2. One interesting observation is that, though GD makes steady progress in minimizing function value, its gradient norm is not decreasing.
770
+
771
+ To quantify the difference between theory and practice, we follow the procedure as in the synthetic experiment. First, we estimate $M L _ { 1 } + L _ { 0 } = 2 5$ for GD from Figure 8(c). Second, we estimate $L _ { 1 } = 1 0 , L _ { 0 } = 5$ for clipped GD’s trajectory from subplot (d). Then the theory predicts that the ratio between gradients should be roughly $2 5 / 5 = 5$ . Empirically, we found the ratio to be $\approx 3$ by taking the average (as in Theorem 3 and Theorem 6). This doesn’t exactly align but is of the same scale. From our view, the main reason for the difference could be the presence of noise in this experiment. As theorems suggested, noise impacts convergence rates but is absent in our rough estimates $\frac { M L _ { 1 } + L _ { 0 } } { L _ { 0 } }$ .
772
+
773
+ ![](images/749b0e61a64465bdbd5945689768eb0636b75a453ad58da244ef0cc9012a6c71.jpg)
774
+ Figure 8: (a) Gradient norm. (b) Loss curves. (c)The scatter points of smoothness vs gradient norm for the model trained with gradient descent.(d)The scatter points of smoothness vs gradient norm for the model trained with clipped GD.
md/train/BJlgNh0qKQ/BJlgNh0qKQ.md ADDED
@@ -0,0 +1,532 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DIFFERENTIABLE PERTURB-AND-PARSE:SEMI-SUPERVISED PARSING WITH A STRUCTUREDVARIATIONAL AUTOENCODER
2
+
3
+ Caio Corro Ivan Titov
4
+ ILCC, School of Informatics, University of Edinburgh ILLC, University of Amsterdam
5
+ c.f.corro@uva.nl ititov@inf.ed.ac.uk
6
+
7
+ # ABSTRACT
8
+
9
+ Human annotation for syntactic parsing is expensive, and large resources are available only for a fraction of languages. A question we ask is whether one can leverage abundant unlabeled texts to improve syntactic parsers, beyond just using the texts to obtain more generalisable lexical features (i.e. beyond word embeddings). To this end, we propose a novel latent-variable generative model for semi-supervised syntactic dependency parsing. As exact inference is intractable, we introduce a differentiable relaxation to obtain approximate samples and compute gradients with respect to the parser parameters. Our method (Differentiable Perturb-and-Parse) relies on differentiable dynamic programming over stochastically perturbed arc weights. We demonstrate effectiveness of our approach with experiments on English, French and Swedish.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ A dependency tree is a lightweight syntactic structure exposing (possibly labeled) bi-lexical relations between words (Tesniere, 1959; Kaplan & Bresnan, 1982), see Figure 1. This representation \` has been widely studied by the NLP community leading to very efficient state-of-the-art parsers (Kiperwasser & Goldberg, 2016; Dozat & Manning, 2017; Ma & Hovy, 2017), motivated by the fact that dependency trees are useful in downstream tasks such as semantic parsing (Reddy et al., 2016; Marcheggiani & Titov, 2017), machine translation (Ding & Palmer, 2005; Bastings et al., 2017), information extraction (Culotta & Sorensen, 2004; Liu et al., 2015), question answering (Cui et al., 2005) and even as a filtering method for constituency parsing (Kong et al., 2015), among others.
14
+
15
+ Unfortunately, syntactic annotation is a tedious and expensive task, requiring highly-skilled human annotators. Consequently, even though syntactic annotation is now available for many languages, the datasets are often small. For example, 31 languages in the Universal Dependency Treebank,1 the largest dependency annotation resource, have fewer than 5,000 sentences, including such major languages as Vietnamese and Telugu. This makes the idea of using unlabeled texts as an additional source of supervision especially attractive.
16
+
17
+ In previous work, before the rise of deep learning, the semi-supervised parsing setting has been mainly tackled with two-step algorithms. On the one hand, feature extraction methods first learn an intermediate representation using an unlabeled dataset which is then used as input to train a supervised parser (Koo et al., 2008; Yu et al., 2008; Chen et al., 2009; Suzuki et al., 2011). On the other hand, the self-training and co-training methods start by learning a supervised parser that is then used to label extra data. Then, the parser is retrained with this additional annotation (Sagae & Tsujii, 2007; Kawahara & Uchimoto, 2008; McClosky et al., 2006). Nowadays, unsupervised feature extraction is achieved in neural parsers by the means of word embeddings (Mikolov et al., 2013; Peters et al., 2018). The natural question to ask is whether one can exploit unlabeled data in neural parsers beyond only inducing generalizable word representations.
18
+
19
+ ![](images/57a203574d20c1a79180e24b2900928a30db287413896c9f8fcdc3042f37cd5b.jpg)
20
+ Figure 1: Dependency tree example: each arc represents a labeled relation between the head word (the source of the arc) and the modifier word (the destination of the arc). The first token is a fake root word.
21
+
22
+ Table 1: Number of labeled and unlabeled instances in each dataset.
23
+
24
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Labeled</td><td rowspan=1 colspan=1>Unlabeled</td></tr><tr><td rowspan=1 colspan=1>English</td><td rowspan=1 colspan=1>3984</td><td rowspan=1 colspan=1>35848</td></tr><tr><td rowspan=1 colspan=1>French</td><td rowspan=1 colspan=1>1476</td><td rowspan=1 colspan=1>13280</td></tr><tr><td rowspan=1 colspan=1>Swedish</td><td rowspan=1 colspan=1>4880</td><td rowspan=1 colspan=1>5331</td></tr></table>
25
+
26
+ Our method can be regarded as semi-supervised Variational Auto-Encoder (VAE, Kingma et al., 2014). Specifically, we introduce a probabilistic model (Section 3) parametrized with a neural network (Section 4). The model assumes that a sentence is generated conditioned on a latent dependency tree. Dependency parsing corresponds to approximating the posterior distribution over the latent trees within this model, achieved by the encoder component of VAE, see Figure 2a. The parameters of the generative model and the parser (i.e. the encoder) are estimated by maximizing the likelihood of unlabeled sentences. In order to ensure that the latent representation is consistent with treebank annotation, we combine the above objective with maximizing the likelihood of gold parse trees in the labeled data.
27
+
28
+ Training a VAE via backpropagation requires marginalization over the latent variables, which is intractable for dependency trees. In this case, previous work proposed approximate training methods, mainly differentiable Monte-Carlo estimation (Kingma & Welling, 2013; Rezende et al., 2014) and score function estimation, e.g. REINFORCE (Williams, 1992). However, REINFORCE is known to suffer from high variance (Mnih & Gregor, 2014). Therefore, we propose an approximate differentiable Monte-Carlo approach that we call Differentiable Perturb-and-Parse (Section 5). The key idea is that we can obtain a differentiable relaxation of an approximate sample by (1) perturbing weights of candidate dependencies and (2) performing structured argmax inference with differentiable dynamic programming, relying on the perturbed scores. In this way we bring together ideas of perturb-and-map inference (Papandreou & Yuille, 2011; Maddison et al., 2017) and continuous relaxation for dynamic programming (Mensch & Blondel, 2018). Our model differs from previous works on latent structured models which compute marginal probabilities of individual edges Kim et al. (2017); Liu & Lapata (2018). Instead, we sample a single tree from the distribution that is represented with a soft selection of arcs. Therefore, we preserve higher-order statistics, which can then inform the decoder. Computing marginals would correspond to making strong independence assumptions. We evaluate our semi-supervised parser on English, French and Swedish and show improvement over a comparable supervised baseline (Section 6).
29
+
30
+ Our main contributions can be summarized as follows: (1) we introduce a variational autoencoder for semi-supervised dependency parsing; (2) we propose the Differentiable Perturb-and-Parse method for its estimation; (3) we demonstrate the effectiveness of the approach on three different languages. In short, we introduce a novel generative model for learning latent syntactic structures.
31
+
32
+ # 2 DEPENDENCY PARSING
33
+
34
+ A dependency is a bi-lexical relation between a head word (the source) and a modifier word (the target), see Figure 1. The set of dependencies of a sentence defines a tree-shaped structure.2 In the parsing problem, we aim to compute the dependency tree of a given sentence.
35
+
36
+ Formally, we define a sentence as a sequence of tokens (words) from vocabulary $\mathbb { W }$ . We assume a one-to-one mapping between $\mathbb { W }$ and integers $1 \dots | \mathbb { W } |$ . Therefore, we write a sentence of length $n$ as a vector of integers $\pmb { s }$ of size $n + 1$ with $1 \leq s _ { i } \leq | \mathbb { W } |$ and where $s _ { 0 }$ is a special root symbol. A dependency tree of sentence $\pmb { s }$ is a matrix of booleans $T \in \{ 0 , 1 \} ^ { ( n + 1 ) \times ( n + 1 ) }$ with $T _ { h , m } = 1$ meaning that word $s _ { h }$ is the head of word $s _ { m }$ in the dependency tree.
37
+
38
+ ![](images/ad92dde7d414cbc6f4e306ea0e02357183eb10bb007616dad3f88b00b4ad9cfb.jpg)
39
+ Figure 2: (a) Illustration of our probabilistic model with random variables $\pmb { s }$ , $_ { \mathbf { T } }$ and $_ z$ for sentences, dependency trees and sentence embeddings, respectively. The gray area delimits the latent space. Solid arcs denote the generative process, dashed arcs denotes posterior distributions over the latent variables. (b) Stochastic computation graph. (c) Illustration of the decoder when computing the probability distribution of $s _ { 4 }$ , the word at position 4. Dashed arcs at the bottom represent syntactic dependencies between word at position 4 and previous positions. At each step, the LSTM takes as input an embedding of the previous word $\scriptstyle { \mathcal { s } } _ { 0 }$ is a special start-of-sentence symbol). Then, the GCN combines different outputs of the LSTM by transforming them with respect to their syntactic relation with the current position. Finally, the probability of $s _ { 4 }$ is computed via the softmax function.
40
+
41
+ More specifically, a dependency tree $\mathbf { T }$ is the adjacency matrix of a directed graph with $n + 1$ vertices $\mathbf { v } _ { 0 } \ldots \mathbf { v } _ { n }$ . A matrix $\mathbf { T }$ is a valid dependency tree if and only if this graph is a $\mathbf { v } _ { 0 }$ -rooted spanning arborescence,3 i.e. the graph is connected, each vertex has at most one incoming arc and the only vertex without incoming arc is $\mathbf { v } _ { 0 }$ . A dependency tree is projective if and only if, for each arc $\mathbf { v } _ { h } \mathbf { v } _ { m }$ , if $h < m$ (resp. $m < h$ ) then there exists a path with arcs $\mathbf { T }$ from $\mathbf { V } _ { h }$ to each vertex $\mathbf { v } _ { k }$ such that $h < k < m$ (resp. $m < k < h$ ). From a linguistic point of view, projective dependency trees combine contiguous phrases (sequence of words) only. Intuitively, this means that we can draw the dependency tree above the sentence without crossing arcs.
42
+
43
+ Given a sentence $\pmb { s }$ , an arc-factored dependency parser computes the dependency tree $_ { \mathbf { T } }$ which maximizes a weighting function $\begin{array} { r } { f ( \mathbf { T } ; \mathbf { W } ) = \sum _ { h , m } { T _ { h , m } { W _ { h , m } } } } \end{array}$ , where $W$ is a matrix of dependency (arc) weights. This problem can be solved with a $\mathcal { O } ( n ^ { 2 } )$ time complexity (Tarjan, 1977; McDonald et al., 2005). If we restrict $\mathbf { T }$ to be a projective dependency tree, then the optimal solution can be computed with a $\mathcal { O } ( n ^ { 3 } )$ time complexity using dynamic programming (Eisner, 1996). Restricting the search space to projective trees is appealing for treebanks exhibiting this property (either exactly or approximately): they enforce a structural constraint that can be beneficial for accuracy, especially in a low-resource scenario. Moreover, using a more restricted search space of potential trees may be especially beneficial in a semi-supervised scenario: with a more restricted space a model is less likely to diverge from a treebank grammar and capture non-syntactic phenomena. Finally, Eisner’s algorithm (Eisner, 1996) can be described as a deduction system (Pereira & Warren, 1983), a framework that unifies many parsing algorithms. As such, our methodology could be applied to other grammar formalisms. For all these reasons, in this paper, we focus on projective dependency trees only.
44
+
45
+ # 3 GENERATIVE MODEL
46
+
47
+ We now turn to the learning problem, i.e. estimation of the matrix $W$ . We assume that we have access to a set of i.i.d. labeled sentences $\mathbb { L } = \{ \langle s , T \rangle , \dots \}$ and a set of i.i.d. unlabeled sentences $\mathbb { U } = \{ s , \ldots \}$ . In order to incorporate unlabeled data in the learning process, we introduce a generative model where the dependency tree is latent (Subsection 3.1). As such, we can maximize the likelihood of observed sentences even if the ground-truth dependency tree is unknown. We learn the parameters of this model using a variational Bayes approximation (Subsection 3.2) augmented with a discriminative objective on labeled data (Subsection 3.3).
48
+
49
+ # 3.1 GENERATIVE STORY
50
+
51
+ Under our probabilistic model, a sentence $\pmb { s }$ is generated from a continuous sentence embedding $_ { z }$ and with respect to a syntactic structure $\mathbf { T }$ . We formally define the generative process of a sentence of length $n$ as:
52
+
53
+ $$
54
+ T \sim p ( T | n ) \qquad z \sim p ( z | n ) \qquad s \sim p ( s | T , z , n )
55
+ $$
56
+
57
+ This Bayesian network is shown in Figure 2a. In order to simplify notation, we omit conditioning on $n$ in the following. $_ { \mathbf { T } }$ and $_ { z }$ are latent variables and $p ( s | \bar { T } , \bar { z ) }$ is the conditional likelihood of observations. We assume that the priors $p ( \pmb { T } )$ and $p ( z )$ are the uniform distribution over projective trees and the multivariate standard normal distribution, respectively. The true distribution underlying the observed data is unknown, so we have to learn a model $p _ { \theta } ( \pmb { s } | \pmb { T } , \pmb { z } )$ parametrized by $\theta$ that best fits the given samples:
58
+
59
+ $$
60
+ \theta = \arg \operatorname* { m a x } _ { \theta } \sum _ { s } \log p _ { \theta } ( s )
61
+ $$
62
+
63
+ Then, the posterior distribution of latent variables $p _ { \theta } ( \pmb { T } , z | \pmb { s } )$ models the probability of underlying representations (including dependency trees) with respect to a sentence. This conditional distribution can be written as:
64
+
65
+ $$
66
+ p _ { \theta } ( \pmb { T } , z | \pmb { s } ) = \frac { p _ { \theta } ( \pmb { s } | \pmb { T } , z ) p ( \pmb { T } ) p ( z ) } { p _ { \theta } ( \pmb { s } ) }
67
+ $$
68
+
69
+ In the next subsection, we explain how these two quantities can be estimated from data.
70
+
71
+ # 3.2 VARIATIONAL AUTO-ENCODERS
72
+
73
+ Computations in Equation 1 and Equation 2 require marginalization over the latent variables:
74
+
75
+ $$
76
+ p _ { \theta } ( s ) = \sum _ { T } \int p _ { \theta } ( s , T , z ) d z
77
+ $$
78
+
79
+ which is intractable in general. We rely on the Variational Auto-Encoder (VAE) framework to tackle this challenge (Kingma $\&$ Welling, 2013; Rezende et al., 2014). We introduce a variational distribution $q _ { \phi } ( T , z | s )$ which is intended to be similar to $p _ { \theta } ( \pmb { T } , z | s )$ . More formally, we want $\mathrm { K L } [ q _ { \phi } ( \pmb { T } , \pmb { z } | \pmb { s } ) ] | p _ { \theta } ( \pmb { T } , \pmb { z } | \pmb { s } ) ]$ to be as small as possible, where $\mathrm { K L }$ is the Kulback-Leibler (KL) divergence. Then, the following equality holds:
80
+
81
+ $$
82
+ \begin{array} { r } { \log p _ { \theta } ( s ) = \mathbb { E } _ { q _ { \phi } ( T , z | s ) } [ \log p _ { \theta } ( s | T , z ) ] - \mathrm { K L } [ q _ { \phi } ( T , z | s ) | p ( T , z ) ] + \mathrm { K L } [ q _ { \phi } ( T , z | s ) | ] p _ { \theta } ( T , z | s ) ] } \end{array}
83
+ $$
84
+
85
+ where $\log p _ { \theta } ( s )$ is called the evidence. The KL divergence is always positive, therefore by removing the last term we have:
86
+
87
+ $$
88
+ \begin{array} { r } { \log p _ { \theta } ( s ) \geq \mathbb { E } _ { q _ { \phi } ( T , z \mid s ) } [ \log p _ { \theta } ( s | T , z ) ] - { \mathrm { K L } } [ q _ { \phi } ( T , z | s ) | p ( T , z ) ] = \tilde { \mathcal { E } } _ { \theta , \phi } ( s ) } \end{array}
89
+ $$
90
+
91
+ where the right-hand side is called the Evidence Lower Bound (ELBO). By maximizing the ELBO term, the divergence KL $[ q _ { \phi } ( \pmb { T } , z | \pmb { s } ) \| p _ { \theta } ( \pmb { T } , z | \pmb { s } ) ]$ is implicitly minimized. Therefore, we define a surrogate objective, replacing the objective in Equation 1:
92
+
93
+ $$
94
+ \theta = \arg \operatorname* { m a x } _ { \theta } \sum _ { s } \operatorname* { m a x } _ { \phi } \tilde { \mathcal { E } } _ { \theta , \phi } ( s )
95
+ $$
96
+
97
+ The ELBO in Equation 4 has two components. First, the KL divergence with the prior, which usually has a closed form solution. For the distribution over dependency trees, it can be computed with the semiring algorithm of Li & Eisner (2009). Second, the non-trivial term $\mathbb { E } _ { q _ { \phi } ( T , z | s ) } [ \log p _ { \theta } ( s | T , z ) ]$ . During training, Monte-Carlo method provides a tractable and unbiased estimation of the expectation. Note that a single sample from $q _ { \phi } ( T , z | s )$ can be understood as encoding the observation into the latent space, whereas regenerating a sentence from the latent space can be understood as decoding. However, training a VAE requires the sampling process to be differentiable. In the case of the sentence embedding, we follow the usual setting and define $q _ { \phi } ( z | s )$ as a diagonal Gaussian: backpropagation through the the sampling process $z \sim q _ { \phi } ( z | s )$ can be achieved thanks to the reparametrization trick (Kingma & Welling, 2013; Rezende et al., 2014). Unfortunately, this approach cannot be applied to dependency tree sampling $T \sim q _ { \phi } ( T | s )$ . We tackle this issue in Section 5.
98
+
99
+ # 3.3 SEMI-SUPERVISED LEARNING
100
+
101
+ VAEs are a convenient approach for semi-supervised learning (Kingma et al., 2014) and have been successfully applied in NLP (Kocisk ˇ y et al., 2016; Xu et al., 2017; Zhou & Neubig, 2017; Yin et al., ´ 2018). In this scenario, we are given the dependency structure of a subset of the observations, i.e. $_ { \mathbf { T } }$ is an observed variable. Then, the supervised ELBO term is defined as:
102
+
103
+ $$
104
+ \bar { \mathcal { E } } _ { \theta , \phi } ( s , \pmb { T } ) = \mathbb { E } _ { q _ { \phi } ( z | s ) } [ \log p _ { \theta } ( s | \pmb { T } , z ) ] - \mathrm { K L } [ q _ { \phi } ( z | s ) | p ( z ) ]
105
+ $$
106
+
107
+ Note that our end goal is to estimate the posterior ditribution over dependency trees $q _ { \phi } ( \pmb { T } | s )$ , i.e. the dependency parser, which does not appear in the supervised ELBO. We want to explicitly use the labeled data in order to learn the parameters of this parser. This can be achieved by adding a discriminative training term to the overall loss.4
108
+
109
+ The loss function for training a semi-supervised VAE is:
110
+
111
+ $$
112
+ \mathcal { L } _ { \boldsymbol { \theta , \phi } } ( \mathbb { L } , \mathbb { U } ) = - \sum _ { s , T \in \mathbb { L } } \log q _ { \phi } ( \boldsymbol { T } | s ) - \sum _ { s , T \in \mathbb { L } } \bar { \mathcal { E } } _ { \boldsymbol { \theta , \phi } } ( s , T ) - \sum _ { s \in \mathbb { U } } \tilde { \mathcal { E } } _ { \boldsymbol { \theta , \phi } } ( s )
113
+ $$
114
+
115
+ where the first term is the standard loss for supervised learning of log-linear models (Johnson et al., 1999; Lafferty et al., 2001).
116
+
117
+ # 4 NEURAL PARAMETRIZATION
118
+
119
+ In this section, we describe the neural parametrization of the encoder distribution $q _ { \phi }$ (Subsection 4.1) and the decoder distribution $p _ { \theta }$ (Subsection 4.2). A visual representation is given in Figure 2b.
120
+
121
+ # 4.1 ENCODER
122
+
123
+ We factorize the encoder as $q _ { \phi } ( T , z | s ) = q _ { \phi } ( T | s ) q _ { \phi } ( z | s )$ . The categorical distribution over dependency trees is parametrized by a log-linear model (Lafferty et al., 2001) where the weight of an arc is given by the neural network of Kiperwasser $\&$ Goldberg (2016).The sentence embedding model is specified as a diagonal Gaussian parametrized by a LSTM, similarly to the seq2seq framework (Sutskever et al., 2014; Bowman et al., 2016). That is:
124
+
125
+ $$
126
+ \begin{array} { c c } { { W = \mathrm { D E P W E I G H T S } ( s ) } } & { { \qquad m , \log v ^ { 2 } = \mathrm { E M B P A R A M S } ( s ) } } \\ { { q _ { \phi } ( T | s ) = \displaystyle \frac { \exp ( \sum _ { i , j } W _ { i , j } T _ { i , j } ) } { \sum _ { T ^ { \prime } } \exp ( \sum _ { i , j } W _ { i , j } T _ { i , j } ^ { \prime } ) } } } & { { \qquad q _ { \phi } ( z | s ) = \mathcal { N } ( z | m , v ) } } \end{array}
127
+ $$
128
+
129
+ where $_ { m }$ and $\textbf { { v } }$ are mean and variance vectors, respectively.5
130
+
131
+ # 4.2 DECODER
132
+
133
+ We use an autoregressive decoder that combines an LSTM and a Graph Convolutional Network (GCN, Kipf & Welling, 2016; Marcheggiani & Titov, 2017). The LSTM keeps the history of generated words, while the GCN incorporate information about syntactic dependencies.
134
+
135
+ The hidden state of the LSTM is initialized with latent variable $_ z$ (the sentence embedding). Then, at each step $1 \leq i \leq n$ , an embedding associated with word at position $i - 1$ is fed as input. A special start-of-sentence symbol embedding is used at the first position.
136
+
137
+ Let $o ^ { i }$ be the hidden state of the LSTM at position $i$ . The standard seq2seq architecture uses this vector to predict the word at position $i$ . Instead, we transform it in order to take into account the syntactic structure described by the latent variable $\mathbf { T }$ . Due to the autoregressive nature of the decoder, we can only take into account dependencies $T _ { h , m }$ such that $h < i$ and $m < i$ . Before being fed to the GCN, the output of the LSTM is fed to distinct multi-layer perceptrons6 that characterize syntactic relations: if $s _ { h }$ is the head of $s _ { i }$ , $o ^ { h }$ is transformed with ${ \bf M L P } ^ { \curvearrowright }$ , if $s _ { m }$ is a modifier of $s _ { i }$ , $\pmb { o } ^ { m }$ is transformed with ${ \bf M L P } ^ { \curvearrowright }$ , and lastly $o ^ { i }$ is transformed with ${ \bf M L P } ^ { \bigcirc }$ . Formally, the GCN is defined as follows:
138
+
139
+ $$
140
+ g ^ { i } = \operatorname { t a n h } \left( \mathbf { M } \mathbf { L } \mathbf { P } ^ { \mathcal { O } } ( \pmb { \sigma } ^ { i } ) + \sum _ { h = 0 } ^ { i - 1 } T _ { h , i } \times \mathbf { M } \mathbf { L } \mathbf { P } ^ { \mathcal { N } } ( \pmb { \sigma } ^ { h } ) + \sum _ { m = 0 } ^ { i - 1 } T _ { i , m } \times \mathbf { M } \mathbf { L } \mathbf { P } ^ { \mathcal { O } } ( \pmb { \sigma } ^ { m } ) \right)
141
+ $$
142
+
143
+ The output vector $g ^ { i }$ is then used to estimate the probability of word $s _ { i }$ . The neural architecture of the decoder is illustrated on Figure 2c.
144
+
145
+ # 5 DIFFERENTIABLE PERTURB-AND-PARSE
146
+
147
+ Encoder-decoder architectures are usually straightforward to optimize with the back-propagation algorithm (Linnainmaa, 1976; LeCun et al., 2012) using any autodiff library. Unfortunately, our VAE contains stochastic nodes that can not be differentiated efficiently as marginalization is too expensive or intractable (see Figure 2b for the list of stochastic nodes in our computation graph). Kingma & Welling (2013) and Rezende et al. (2014) proposed to rely on a Monte-Carlo estimation of the gradient. This approximation is differentiable because the sampling process is moved out of the backpropagation path.7
148
+
149
+ In this section, we introduce our Differentiable Perturb-and-Parse operator to cope with the distribution over dependency trees. Firstly, in Subsection 5.1, we propose an approximate sampling process by computing the best parse tree with respect to independently perturbed arc weights. Secondly, we propose a differentiable surrogate of the parsing algorithm in Subsection 5.2.
150
+
151
+ # 5.1 PERTURB-AND-PARSE
152
+
153
+ Sampling from a categorical distributions can be achieved through the Gumbel-Max trick (Gumbel, 1954; Maddison et al., 2014).8 Unfortunately, this reparametrization is difficult to apply when the discrete variable can take an exponential number of values as in Markov Random Fields (MRF). Papandreou & Yuille (2011) proposed an approximate sampling process: each component is perturbed independently. Then, standard MAP inference algorithm computes the sample. This technique is called perturb-and-map.
154
+
155
+ Arc-factored dependency parsing can be expressed as a MRF where variable nodes represent arcs, singleton factors weight arcs and a fully connected factor forces the variable assignation to describe a valid dependency tree (Smith & Eisner, 2008). Therefore, we can apply the perturb-and-map method to dependency tree sampling:9
156
+
157
+ $$
158
+ \begin{array} { r c l } { { W } } & { { = } } & { { \operatorname { E M B P A R A M S } ( s ) } } \\ { { P } } & { { \sim } } & { { \mathcal { G } ( 0 , 1 ) } } \\ { { T } } & { { = } } & { { \operatorname { E I S N E R } ( W + P ) } } \end{array}
159
+ $$
160
+
161
+ where $\mathcal { G } ( 0 , 1 )$ is the Gumbel distribution, that is sampling matrix $_ { r }$ is equivalent to setting $P _ { i , j } =$ $- \log ( - \log U _ { i , j } ) )$ ) where $U _ { i , j } \sim \mathrm { U n i f o r m } ( 0 , 1 )$ .
162
+
163
+ <table><tr><td>Algorithm1 This function search the best split point for constructing an element given its span.b is a one-hot vector such that bi-k = 1iff k is the best split position.</td></tr><tr><td>1: function DEDUCE-URIGHT(i, j, W) 2: s ← null-initialized vec.of size j-i 3: fori≤k&lt;jdo 4: Si-k←[ik] +[k+1△j]</td></tr><tr><td>+Wji</td></tr><tr><td>5: b ← ONE-HOT-ARGMAX(s) 6: BACKPTR[ij]←b</td></tr><tr><td>7: WEIGHT[i j]←bs</td></tr></table>
164
+
165
+ <table><tr><td>Algorithm2If item [ij]has contributed the optimal objective, this function sets Ti,j to 1.Then, it propagates the contribution in- formation to its antecedents.</td></tr><tr><td>1: function BACKTRACK-URIGHT(𝑖, j,T) 2: Ti,j←CONTRIB[i j]</td></tr><tr><td>3: b←BACKPTR[𝑖j] 4: fori≤k&lt;jdo</td></tr><tr><td>CONTRIB[i△ k] ←bi-kTi,j 5: CONTRIB[k+1△j]←bi-kTi,j 6:</td></tr></table>
166
+
167
+ The (approximate) Monte-Carlo estimation of the expectation in Equation 3 is then defined as:10
168
+
169
+ $$
170
+ \begin{array} { r } { { \mathbb E } _ { q _ { \phi } ( { \pmb T } | s ) } \left[ \log p _ { \theta } ( { \pmb s } | { \pmb T } ) \right] \simeq \log p _ { \theta } ( s | \mathrm { E I S N E R } ( { \pmb W } + { \pmb P } ) ) } \end{array}
171
+ $$
172
+
173
+ where $\simeq$ denotes a Monte-Carlo estimation of the gradient, $\textstyle P \sim { \mathcal { G } } ( 0 , 1 )$ is sampled in the last line and EISNER is an algorithm that compute the projective dependency tree with maximum (perturbed) weight (Eisner, 1996). Therefore, the sampling process is outside of the backpropagation path. Unfortunately, the EISNER algorithm is built using ONE-HOT-ARGMAX operations that have illdefined partial derivatives. We propose a differentiable surrogate in the next section.
174
+
175
+ # 5.2 DIFFERENTIABLE PARSING ALGORITHM
176
+
177
+ We now propose a continuous relaxation of the projective dependency parsing algorithm. We start with a brief outline of the algorithm using the parsing-as-deduction formalism, restricting this presentation to the minimum needed to describe our continuous relaxation. We refer the reader to Eisner (1996) for an in-depth presentation.
178
+
179
+ The parsing-as-deduction formalism provides an unified presentation of many parsing algorithms (Pereira & Warren, 1983; Shieber et al., 1995). In this framework, a parsing algorithm is defined as a deductive system, i.e. as a set of axioms, a goal item and a set of deduction rules. Each deduced item represents a sub-analysis of the input. Regarding implementation, the common way is to rely on dynamic programming: items are deduced in a bottom-up fashion, from smaller sub-analyses to large ones. To this end, intermediate results are stored in a global chart.
180
+
181
+ For projective dependency parsing, the algorithm builds a chart whose items are of the form $[ i \triangleright j ]$ , $\left[ i \right] \varTheta \ j$ , $[ i \triangleright j ]$ and $[ i { \varDelta j } ]$ that represent sub-analyses from word $i$ to word $j$ . An item $[ i \triangleright j ]$ (resp. $[ i \complement j ] ,$ ) represents a sub-analysis where every word $s _ { k } , i \le k \le j$ is a descendant of $s _ { i }$ and where $s _ { j }$ cannot have any other modifier (resp. can have). The two other types are defined similarly for descendants of word $s _ { j }$ . In the first stage of the algorithm, the maximum weight of items are computed (deduced) in a bottom-up fashion. For example, the weight WEIGHT $[ i \stackrel { \bar { \mathbf { \sigma } } } { \supset } j ]$ is defined as the maximum of WEIGHT $[ i \triangleright k ] + \mathrm { w E I G H T } [ k + 1 \varDelta j ] ,$ , $\forall k$ s.t. $i \le k < j$ , plus $W _ { i , j }$ because $[ i \vartriangleright j ]$ assumes a dependency with head $s _ { i }$ and modifier $s _ { j }$ . In the second stage, the algorithm retrieves arcs whose scores have contributed to the optimal objective. Part of the pseudo-code for the first and second stages are given in Algorithm 1 and Algorithm 2, respectively. Note that, usually, the second stage is implemented with a linear time complexity but we cannot rely on this optimization for our continuous relaxation.
182
+
183
+ This algorithm can be thought of as the construction of a computational graph where WEIGHT, BACKPTR and CONTRIB are sets of nodes (variables). This graph includes ONE-HOT-ARGMAX operations that are not differentiable (see line 5 in Algorithm 1). This operation takes as input a vector of weights $\textbf { { v } }$ of size $k$ and returns a one-hot vector $^ o$ of the same size with $o _ { i } = 1$ if and only
184
+
185
+ if $v _ { i }$ is the element of maximum value:11
186
+
187
+ $$
188
+ o _ { i } = \mathbb { 1 } [ \forall 1 \leq j \leq k , j \neq i : v _ { i } > v _ { j } ]
189
+ $$
190
+
191
+ We follow a recent trend (Jang et al., 2017; Maddison et al., 2017; Goyal et al., 2017; 2018) in differentiable approximation of the ONE-HOT-ARGMAX function and replace it with the PEAKEDSOFTMAX operator:
192
+
193
+ $$
194
+ o _ { i } = \frac { \exp ( 1 / \tau \ v _ { i } ) } { \sum _ { 1 \leq j \leq k } \exp ( 1 / \tau \ v _ { j } ) }
195
+ $$
196
+
197
+ where $\tau > 0$ is a temperature hyperparameter controlling the smoothness of the relaxation: when $\tau \infty$ the relaxation becomes equivalent to ONE-HOT-ARGMAX. With this update, the parsing algorithm is fully differentiable.12 Note, however, that outputs are not valid dependency trees anymore. Indeed, then an output matrix $_ { \mathbf { T } }$ contains continuous values that represent soft selection of arcs. Mensch & Blondel (2018) introduced a alternative but similar approach for tagging with the Viterbi algorithm. We report pseudo-codes for the forward and backward passes of our continuous relaxation of EISNER’s algorithm in Appendix F.
198
+
199
+ # 5.3 DISCUSSION
200
+
201
+ The fact that $\mathbf { T }$ is a soft selection of arcs, and not a combinatorial structure, does not impact the decoder. Indeed, a GCN can be run over weighted graphs, the message passed between nodes is simply multiplied by the continuous weights. This is one of motivations for using GCNs rather than a Recursive LSTMs (Tai et al., 2015) in the decoder. On the one hand, running a GCN with a matrix that represents a soft selection of arcs (i.e. with real values) has the same computational cost than using a standard adjacency matrix (i.e. with binary elements) if we use matrix multiplication on GPU.13 On the other hand, a recursive network over a soft selection of arcs requires to build a $O ( n ^ { 2 } )$ set of RNN-cells that follow the dynamic programming chart where the possible inputs of a cell are multiplied by their corresponding weight in T, which is expensive and not GPU-friendly.
202
+
203
+ # 6 EXPERIMENTS
204
+
205
+ We ran a series of experiments on 3 different languages to test our method for semi-supervised dependency parsing: English, French and Swedish. Details about corpora can be found in Appendix C. The size of each dataset is reported in Table 1. Note that the setting is especially challenging for Swedish: the amount of unlabeled data we use here barely exceeds that of labeled data. The hyperparameters of our network are described in Appendix D. In order to ensure that we do not bias our model for the benefit of the semi-supervised scenario, we use the same parameters as Kiperwasser & Goldberg (2016) for the parser. Also, we did not perform any language-specific parameter selections. This makes us hope that our method can be applied to other languages with little extra effort. We stress that no part-of-speech tags are used as input in any part of our network. For English, the supervised parser took 1.5 hours to train on a NVIDIA Titan X GPU while the semi-supervised parser without sentence embedding, which sees 2 times more instances per epoch, took 3.5 hours to train.
206
+
207
+ Previous work has shown that learned latent structures tend to differ from linguistic syntactic structures (Kim et al., 2017; Williams et al., 2018). Therefore, we encourage the VAE to rely on latent structures close to the targeted ones by bootstrapping the training procedure with labeled data only. We follow a common practice for VAEs: we experimented with scaling down the KL-divergence of priors (Bowman et al., 2016; Miao et al., 2017; Yin et al., 2018). We use weights 0.01 the KLdivergence with the prior for distributions over sentence embeddings. For dependency trees, we report all experiments with the weight of 0, as removing the term or heavily downweighting it was yielding the best results. As the encoder is bootstrapped with the supervised loss, it is implicitly regularized toward linguistic trees, and the KL term would negate this effect. Intuitively, the KL term favors models which are uncertain on unlabeled examples, which may also be problematic, given that we would expect a strong parser to have sharp posteriors.
208
+
209
+ Table 2: (a) Parsing results: unlabeled attachment score / labeled attachment score. We also report results with the parser of (Kiperwasser & Goldberg, 2016) which uses a different discriminative loss for supervised training. (b) Recall / Precision evaluation with respect to dependency lengths for the supervised parser and the best semi-supervised parser on the English test set. Bold numbers highlight the main differences. (c) Recall / Precision evaluation with respect to dependency labels for multi-word expressions (mwe), adverbial modifiers (advmod) and appositional modifiers (appos).
210
+ (a) Parsing results
211
+
212
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>English</td><td rowspan=1 colspan=1>French</td><td rowspan=1 colspan=1>Swedish</td></tr><tr><td rowspan=1 colspan=1>Supervised</td><td rowspan=1 colspan=1>88.79/84.74</td><td rowspan=1 colspan=1>84.09/77.58</td><td rowspan=1 colspan=1>86.59 /78.95</td></tr><tr><td rowspan=1 colspan=1>VAE w. z</td><td rowspan=1 colspan=1>89.39/85.44</td><td rowspan=1 colspan=1>84.43/77.89</td><td rowspan=1 colspan=1>86.92/80.01</td></tr><tr><td rowspan=1 colspan=1>VAE w/o z</td><td rowspan=1 colspan=1>89.50/ 85.48</td><td rowspan=1 colspan=1>84.69/78.49</td><td rowspan=1 colspan=1>86.97/79.80</td></tr><tr><td rowspan=1 colspan=1>Kipperwasser&amp; Goldberg</td><td rowspan=1 colspan=1>89.88 / 86.49</td><td rowspan=1 colspan=1>84.30/77.83</td><td rowspan=1 colspan=1>86.93/ 80.12</td></tr></table>
213
+
214
+ (b) Dependency length analysis
215
+
216
+ <table><tr><td rowspan=1 colspan=1>Distance</td><td rowspan=1 colspan=1>SupervisedRe/Pr</td><td rowspan=1 colspan=1> Semi-sup.Re/Pr</td></tr><tr><td rowspan=1 colspan=1>(to root)</td><td rowspan=1 colspan=1>93.46 / 89.30</td><td rowspan=1 colspan=1>93.84 /92.41</td></tr><tr><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>95.61 /94.07</td><td rowspan=1 colspan=1>95.33/994.57</td></tr><tr><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>93.01/990.88</td><td rowspan=1 colspan=1>92.50/92.09</td></tr><tr><td rowspan=1 colspan=1>3...6</td><td rowspan=1 colspan=1>85.95/88.13</td><td rowspan=1 colspan=1>87.31/ 87.93</td></tr><tr><td rowspan=1 colspan=1>&gt;7</td><td rowspan=1 colspan=1>72.47 / 83.26</td><td rowspan=1 colspan=1>78.72 / 83.11</td></tr></table>
217
+
218
+ (c) Dependency label analysis
219
+
220
+ <table><tr><td rowspan=1 colspan=1>Label</td><td rowspan=1 colspan=1>SupervisedRe/Pr</td><td rowspan=1 colspan=1> Semi-sup.Re/Pr</td></tr><tr><td rowspan=1 colspan=1>mwe</td><td rowspan=1 colspan=1>75.58 / 81.25</td><td rowspan=1 colspan=1>90.70/84.78</td></tr><tr><td rowspan=1 colspan=1>advmod</td><td rowspan=1 colspan=1>87.27/85.95</td><td rowspan=1 colspan=1>87.32/87.51</td></tr><tr><td rowspan=1 colspan=1>appos</td><td rowspan=1 colspan=1>77.49/880.27</td><td rowspan=1 colspan=1>81.39/81.03</td></tr></table>
221
+
222
+ # 6.1 PARSING RESULTS
223
+
224
+ For each dataset, we train under the supervised and the semi-supervised scenario. Moreover, in the semi-supervised setting, we experiment with and without latent sentence embedding $_ z$ . We compare only to the model of Kiperwasser & Goldberg (2016). Recently, even more accurate models have been proposed (e.g., Dozat & Manning, 2017). In principle, the ideas introduced in recent work are mostly orthogonal to our proposal as we can modify our VAE model accordingly. For example, we experimented with using bi-affine attention of Dozat & Manning (2017), though it has not turned out beneficial in our low-resource setting. Comparing to multiple previous parsers would have also required tuning each of them on our dataset, which is infeasible. Therefore, we only report results with a comparable baseline, i.e. trained with a structured hinge loss (Kiperwasser & Goldberg, 2016; Taskar et al., 2005). We did not perform further tuning in order to ensure that our analysis is not skewed toward one setting. Parsing results are summarized in Table 2a.
225
+
226
+ We observe a score increase in all three languages. Moreover, we observe that VAE performs slightly better without latent sentence embedding. We assume this is due to the fact that dependencies are more useful when no information leaks in the decoder through $_ z$ . Interestingly, we observe an improvement, albeit smaller, even on Swedish, where we used a very limited amount of unlabeled data. We note that training with structured hinge loss gives stronger results than our supervised baseline. In order to maintain the probabilistic interpretation of our model, we did not include a similar term in our model.
227
+
228
+ We conducted qualitative analyses for English.14 We report scores with respect to dependency lengths in Table 2b. We observe that the semi-supervised parser tends to correct two kind of errors. Firstly, it makes fewer mistakes on root attachments, i.e. the recall is similar between the two parsers but the precision of the semi-supervised one is higher. We hypothesis that root attachment errors come at a high price in the decoder because there is only a small fraction of the vocabulary that is observed with this syntactic function. Secondly, the semi-supervised parser recovers more long distance relations, i.e. the recall for dependencies with a distance superior or equal to 7 is higher. Intuitively, we assume these dependencies are more useful in the decoder: for short distance dependencies, the LSTM efficiently captures the context of the word to predict, whereas this information could be vanishing for long distances, meaning the GCN has more impact on the prediction. We also checked how the scores differ across dependency labels. We report main differences in Tables 2c. The largest improvements are obtained for multi-word expressions: this is particularly interesting because they are known to be challenging in NLP.
229
+
230
+ # 7 RELATED WORK
231
+
232
+ Dependency parsing in the low-ressource scenario has been of interest in the NLP community due to the expensive nature of annotation. On the one hand, transfer approaches learn a delexicalized parser for a resource-rich language which is then used to parse a low-resource one (Agic et al., 2016; ´ McDonald et al., 2011). On the other hand, the grammar induction approach learns a dependency parser in an unsupervised manner. Klein & Manning (2004) introduced the first generative model that outperforms the right-branching heuristic in English. Close to our work, Cai et al. (2017) use an auto-encoder setting where the decoder tries to rebuild the source sentence. However, their decoder is unstructured (e.g. it is not auto-regressive).
233
+
234
+ Variational Auto-Encoders (Kingma & Welling, 2013; Rezende et al., 2014) have been investigated in the semi-supervised settings (Kingma et al., 2014) for NLP. Kocisk ˇ y et al. (2016) learn a semantic ´ parser where the latent variable is a discrete sequence of symbols. Zhou & Neubig (2017) successfully applied the variational method to semi-supervised morphological re-inflection where discrete latent variables represent linguistic features (e.g. tense, part-of-speech tag). Yin et al. (2018) proposed a semi-supervised semantic parser. Similarly to our model, they rely on a structured latent variable. However, all of these systems use either categorical random variables or the REINFORCE score estimator. To the best of our knowledge, no previous work used continuous relaxation of a dynamic programming latent variable in the VAE setting.
235
+
236
+ The main challenge is backpropagation through discrete random variables. Maddison et al. (2017) and Jang et al. (2017) first introduced the Gumbel-Softmax operator for the categorical distribution. There are two issues regarding more complex discrete distributions. Firstly, one have to build a reparametrization of the the sampling process. Papandreou & Yuille (2011) showed that low-order perturbations provide samples of good qualities for graphical models. Secondly, one have to build a good differentiable surrogate to the structured arg max operator. Early work replaced the structured arg max with structured attention (Kim et al., 2017). However, computing the marginals over the parse forest is sensitive to numerical stability outside specific cases like non-projective dependency parsing (Liu & Lapata, 2018; Tran & Bisk, 2018). Mensch & Blondel (2018) proposed a stable algorithm based on dynamic program smoothing. Our approach is highly related but we describe a continuous relaxation using the parsing-as-deduction formalism. Peng et al. (2018) propose to replace the true gradient with a proxy that tries to satisfy constraints on a arg max operator via a projection. However, their approach is computationally expensive, so they remove the tree constraint on dependencies during backpropagation. A parallel line of work focuses on sparse structures that are differentiable (Martins & Astudillo, 2016; Niculae et al., 2018).
237
+
238
+ # 8 CONCLUSIONS
239
+
240
+ We presented a novel generative learning approach for semi-supervised dependency parsing. We model the dependency structure of a sentence as a latent variable and build a VAE. We hope to motivate investigation of latent syntactic structures via differentiable dynamic programming in neural networks. Future work includes research for an informative prior for the dependency tree distribution, for example by introducing linguistic knowledge (Naseem et al., 2010; Noji et al., 2016) or with an adversarial training criterion Makhzani et al. (2016). This work could also be extended to the unsupervised scenario.
241
+
242
+ # ACKNOWLEDGMENTS
243
+
244
+ We thank Diego Marcheggiani, Wilker Ferreira Aziz and Serhii Havrylov for their comments and suggestions. We thank the anonymous reviewers for their comments. The project was supported by the Dutch National Science Foundation (NWO VIDI 639.022.518) and European Research Council (ERC Starting Grant BroadSem 678254).
245
+
246
+ # REFERENCES
247
+
248
+ Anne Abeille, Lionel Cl ´ ement, and Alexandra Kinyon. Building a treebank for french. In ´ Proceedings of the Second International Conference on Language Resources and Evaluation (LREC’00). European Language Resources Association (ELRA), 2000. URL http://www.aclweb. org/anthology/L00-1175.
249
+
250
+ Zeljko Agi ˇ c, Anders Johannsen, Barbara Plank, H ´ ector Mart ´ ´ınez Alonso, Natalie Schluter, and Anders Søgaard. Multilingual projection for parsing truly low-resource languages. Transactions of the Association for Computational Linguistics, 4:301–312, 2016. URL http://aclweb. org/anthology/Q16-1022.
251
+
252
+ Rami Al-Rfou, Bryan Perozzi, and Steven Skiena. Polyglot: Distributed word representations for multilingual NLP. In Proceedings of the Seventeenth Conference on Computational Natural Language Learning, pp. 183–192, Sofia, Bulgaria, August 2013. Association for Computational Linguistics. URL http://www.aclweb.org/anthology/W13-3520.
253
+
254
+ Joost Bastings, Ivan Titov, Wilker Aziz, Diego Marcheggiani, and Khalil Simaan. Graph convolutional encoders for syntax-aware neural machine translation. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pp. 1947–1957. Association for Computational Linguistics, 2017. URL http://www.aclweb.org/anthology/ D17-1208.
255
+
256
+ Samuel R. Bowman, Luke Vilnis, Oriol Vinyals, Andrew Dai, Rafal Jozefowicz, and Samy Bengio. Generating sentences from a continuous space. In Proceedings of The 20th SIGNLL Conference on Computational Natural Language Learning, pp. 10–21. Association for Computational Linguistics, 2016. doi: 10.18653/v1/K16-1002. URL http://www.aclweb.org/ anthology/K16-1002.
257
+
258
+ Jiong Cai, Yong Jiang, and Kewei Tu. CRF autoencoder for unsupervised dependency parsing. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pp. 1638–1643. Association for Computational Linguistics, 2017. URL http://aclweb.org/ anthology/D17-1171.
259
+
260
+ Wenliang Chen, Daisuke Kawahara, Kiyotaka Uchimoto, Yujie Zhang, and Hitoshi Isahara. Using short dependency relations from auto-parsed data for chinese dependency parsing. ACM Transactions on Asian Language Information Processing, pp. 10:1–10:20, 2009. ISSN 1530-0226.
261
+
262
+ Hang Cui, Renxu Sun, Keya Li, Min-Yen Kan, and Tat-Seng Chua. Question answering passage retrieval using dependency relations. In Proceedings of the 28th annual international ACM SIGIR conference on Research and development in information retrieval, pp. 400–407. ACM, 2005.
263
+
264
+ Aron Culotta and Jeffrey Sorensen. Dependency tree kernels for relation extraction. In Proceedings of the 42nd Annual Meeting of the Association for Computational Linguistics (ACL-04), 2004. URL http://www.aclweb.org/anthology/P04-1054.
265
+
266
+ Marie-Catherine De Marneffe and Christopher D Manning. Stanford typed dependencies manual. Technical report, Technical report, Stanford University, 2008.
267
+
268
+ Yuan Ding and Martha Palmer. Machine translation using probabilistic synchronous dependency insertion grammars. In Proceedings of the 43rd Annual Meeting of the Association for Computational Linguistics (ACL’05), pp. 541–548. Association for Computational Linguistics, 2005. URL http://www.aclweb.org/anthology/P05-1067.
269
+
270
+ Timothy Dozat and Christopher D Manning. Deep biaffine attention for neural dependency parsing. In Proceedings of the 2017 International Conference on Learning Representations, 2017.
271
+
272
+ Chris Dyer, Miguel Ballesteros, Wang Ling, Austin Matthews, and Noah A. Smith. Transitionbased dependency parsing with stack long short-term memory. In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pp. 334–343. Association for Computational Linguistics, 2015. doi: 10.3115/v1/P15-1033. URL http: //www.aclweb.org/anthology/P15-1033.
273
+
274
+ Jason Eisner. Inside-outside and forward-backward algorithms are just backprop (tutorial paper). In Proceedings of the Workshop on Structured Prediction for NLP, pp. 1–17. Association for Computational Linguistics, 2016. doi: 10.18653/v1/W16-5901. URL http://www.aclweb. org/anthology/W16-5901.
275
+
276
+ Jason M. Eisner. Three new probabilistic models for dependency parsing: An exploration. In COLING 1996 Volume 1: The 16th International Conference on Computational Linguistics, 1996. URL http://www.aclweb.org/anthology/C96-1058.
277
+
278
+ Joshua Goodman. Semiring parsing. Computational Linguistics, 25(4), 1999. URL http://www. aclweb.org/anthology/J99-4004.
279
+
280
+ Kartik Goyal, Chris Dyer, and Taylor Berg-Kirkpatrick. Differentiable scheduled sampling for credit assignment. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pp. 366–371. Association for Computational Linguistics, 2017. doi: 10.18653/v1/P17-2058. URL http://www.aclweb.org/anthology/P17-2058.
281
+
282
+ Kartik Goyal, Graham Neubig, Chris Dyer, and Taylor Berg-Kirkpatrick. A continuous relaxation of beam search for end-to-end training of neural sequence models. In Thirty-Second AAAI Conference on Artificial Intelligence (AAAI-18), New Orleans, Louisiana, February 2018. URL https://arxiv.org/abs/1708.00111.
283
+
284
+ Emil Julius Gumbel. Statistical theory of extreme values and some practical applications: a series of lectures. Number 33. US Govt. Print. Office, 1954.
285
+
286
+ Johan Hall, Joakim Nivre, and Jens Nilsson. Discriminative classifiers for deterministic dependency parsing. In Proceedings of the COLING/ACL 2006 Main Conference Poster Sessions, pp. 316– 323. Association for Computational Linguistics, 2006. URL http://www.aclweb.org/ anthology/P06-2041.
287
+
288
+ Eric Jang, Shixiang Gu, and Ben Poole. Categorical reparameterization with gumbel-softmax. In Proceedings of the 2017 International Conference on Learning Representations, 2017.
289
+
290
+ Mark Johnson, Stuart Geman, Stephen Canon, Zhiyi Chi, and Stefan Riezler. Estimators for stochastic “unification-based” grammars. In Proceedings of the 37th Annual Meeting of the Association for Computational Linguistics, 1999. URL http://www.aclweb.org/anthology/ P99-1069.
291
+
292
+ Ronald M Kaplan and Joan Bresnan. Lexical-functional grammar: A formal system for grammatical representation. Formal Issues in Lexical-Functional Grammar, pp. 29–130, 1982.
293
+
294
+ Daisuke Kawahara and Kiyotaka Uchimoto. Learning reliability of parses for domain adaptation of dependency parsing. In Proceedings of the Third International Joint Conference on Natural Language Processing: Volume-II, 2008. URL http://www.aclweb.org/anthology/ I08-2097.
295
+
296
+ Yoon Kim, Carl Denton, Luong Hoang, and Alexander M Rush. Structured attention networks. In Proceedings of the 2017 International Conference on Learning Representations, 2017.
297
+
298
+ Diederik P Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013.
299
+
300
+ Diederik P Kingma, Shakir Mohamed, Danilo Jimenez Rezende, and Max Welling. Semi-supervised learning with deep generative models. In Z. Ghahramani, M. Welling, C. Cortes, N. D. Lawrence, and K. Q. Weinberger (eds.), Advances in Neural Information Processing Systems 27, pp. 3581–3589. Curran Associates, Inc., 2014. URL http://papers.nips.cc/paper/ 5352-semi-supervised-learning-with-deep-generative-models.pdf.
301
+
302
+ Eliyahu Kiperwasser and Yoav Goldberg. Simple and accurate dependency parsing using bidirectional LSTM feature representations. Transactions of the Association of Computational Linguistics, 4:313–327, 2016. URL http://www.aclweb.org/anthology/Q16-1023.
303
+
304
+ Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. arXiv preprint arXiv:1609.02907, 2016.
305
+
306
+ Dan Klein and Christopher Manning. Corpus-based induction of syntactic structure: Models of dependency and constituency. In Proceedings of the 42nd Annual Meeting of the Association for Computational Linguistics (ACL-04), 2004. URL http://www.aclweb.org/ anthology/P04-1061.
307
+
308
+ Toma´s Ko ˇ cisk ˇ y, G ´ abor Melis, Edward Grefenstette, Chris Dyer, Wang Ling, Phil Blunsom, and´ Karl Moritz Hermann. Semantic parsing with semi-supervised sequential autoencoders. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pp. 1078–1087. Association for Computational Linguistics, 2016. doi: 10.18653/v1/D16-1116. URL http://www.aclweb.org/anthology/D16-1116.
309
+
310
+ Lingpeng Kong, Alexander M. Rush, and Noah A. Smith. Transforming dependencies into phrase structures. In Proceedings of the 2015 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 788–798. Association for Computational Linguistics, 2015. doi: 10.3115/v1/N15-1080. URL http: //www.aclweb.org/anthology/N15-1080.
311
+
312
+ Terry Koo, Xavier Carreras, and Michael Collins. Simple semi-supervised dependency parsing. In Proceedings of ACL-08: HLT, pp. 595–603. Association for Computational Linguistics, 2008. URL http://www.aclweb.org/anthology/P08-1068.
313
+
314
+ John Lafferty, Andrew McCallum, and Fernando CN Pereira. Conditional random fields: Probabilistic models for segmenting and labeling sequence data. In Proceedings of the International Conference on Machine Learning, 2001.
315
+
316
+ Yann A LeCun, Leon Bottou, Genevieve B Orr, and Klaus-Robert M ´ uller. Efficient backprop. In ¨ Neural networks: Tricks of the trade, pp. 9–48. Springer, 2012.
317
+
318
+ Zhifei Li and Jason Eisner. First- and second-order expectation semirings with applications to minimum-risk training on translation forests. In Proceedings of the 2009 Conference on Empirical Methods in Natural Language Processing, pp. 40–51. Association for Computational Linguistics, 2009. URL http://aclweb.org/anthology/D09-1005.
319
+
320
+ Wang Ling, Chris Dyer, Alan W Black, and Isabel Trancoso. Two/too simple adaptations of word2vec for syntax problems. In Proceedings of the 2015 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 1299–1304. Association for Computational Linguistics, 2015. doi: 10.3115/v1/N15-1142. URL http://www.aclweb.org/anthology/N15-1142.
321
+
322
+ Seppo Linnainmaa. Taylor expansion of the accumulated rounding error. BIT Numerical Mathematics, 16(2):146–160, 1976.
323
+
324
+ Yang Liu and Mirella Lapata. Learning structured text representations. Transactions of the Association for Computational Linguistics, 6:63–75, 2018. URL http://aclweb.org/ anthology/Q18-1005.
325
+
326
+ Yang Liu, Furu Wei, Sujian Li, Heng Ji, Ming Zhou, and Houfeng WANG. A dependency-based neural network for relation classification. In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing (Volume 2: Short Papers), pp. 285–290. Association for Computational Linguistics, 2015. doi: 10.3115/v1/P15-2047. URL http://www.aclweb.org/anthology/ P15-2047.
327
+
328
+ Xuezhe Ma and Eduard Hovy. Neural probabilistic model for non-projective mst parsing. In Proceedings of the Eighth International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pp. 59–69, Taipei, Taiwan, November 2017. Asian Federation of Natural Language Processing. URL http://www.aclweb.org/anthology/I17-1007.
329
+
330
+ Chris J. Maddison, Daniel Tarlow, and Tom Minka. A\* Sampling. In Advances in Neural Information Processing Systems 27, 2014.
331
+
332
+ Chris J. Maddison, Andriy Mnih, and Yee Whye Teh. The Concrete Distribution: A Continuous Relaxation of Discrete Random Variables. In International Conference on Learning Representations, 2017.
333
+
334
+ Alireza Makhzani, Jonathon Shlens, Navdeep Jaitly, Ian Goodfellow, and Brendan Frey. Adversarial autoencoders. In ICLR 2016 Workshop, International Conference on Learning Representations, 2016.
335
+
336
+ Diego Marcheggiani and Ivan Titov. Encoding sentences with graph convolutional networks for semantic role labeling. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pp. 1507–1516. Association for Computational Linguistics, 2017. URL http://www.aclweb.org/anthology/D17-1159.
337
+
338
+ 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.
339
+
340
+ Andre Martins and Ramon Astudillo. From softmax to sparsemax: A sparse model of attention and multi-label classification. In International Conference on Machine Learning, pp. 1614–1623, 2016.
341
+
342
+ David McClosky, Eugene Charniak, and Mark Johnson. Reranking and self-training for parser adaptation. In Proceedings of the 21st International Conference on Computational Linguistics and 44th Annual Meeting of the Association for Computational Linguistics, pp. 337–344. Association for Computational Linguistics, 2006. URL http://www.aclweb.org/anthology/ P06-1043.
343
+
344
+ Ryan McDonald, Fernando Pereira, Kiril Ribarov, and Jan Hajic. Non-projective dependency parsing using spanning tree algorithms. In Proceedings of Human Language Technology Conference and Conference on Empirical Methods in Natural Language Processing, 2005. URL http://www.aclweb.org/anthology/H05-1066.
345
+
346
+ Ryan McDonald, Slav Petrov, and Keith Hall. Multi-source transfer of delexicalized dependency parsers. In Proceedings of the 2011 Conference on Empirical Methods in Natural Language Processing, pp. 62–72. Association for Computational Linguistics, 2011. URL http://www. aclweb.org/anthology/D11-1006.
347
+
348
+ Arthur Mensch and Mathieu Blondel. Differentiable dynamic programming for structured prediction and attention. In In Proceedings of International Conference on Machine Learning, 2018.
349
+
350
+ Yishu Miao, Edward Grefenstette, and Phil Blunsom. Discovering discrete latent topics with neural variational inference. In International Conference on Machine Learning, 2017.
351
+
352
+ Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg S Corrado, and Jeff Dean. Distributed representations of words and phrases and their compositionality. In Advances in neural information processing systems, pp. 3111–3119, 2013.
353
+
354
+ Andriy Mnih and Karol Gregor. Neural variational inference and learning in belief networks. In Proceedings of the 31st International Conference on Machine Learning, 2014.
355
+
356
+ Tahira Naseem, Harr Chen, Regina Barzilay, and Mark Johnson. Using universal linguistic knowledge to guide grammar induction. In Proceedings of the 2010 Conference on Empirical Methods in Natural Language Processing, pp. 1234–1244. Association for Computational Linguistics, 2010. URL http://www.aclweb.org/anthology/D10-1120.
357
+
358
+ Graham Neubig, Chris Dyer, Yoav Goldberg, Austin Matthews, Waleed Ammar, Antonios Anastasopoulos, Miguel Ballesteros, David Chiang, Daniel Clothiaux, Trevor Cohn, Kevin Duh, Manaal Faruqui, Cynthia Gan, Dan Garrette, Yangfeng Ji, Lingpeng Kong, Adhiguna Kuncoro, Gaurav Kumar, Chaitanya Malaviya, Paul Michel, Yusuke Oda, Matthew Richardson, Naomi Saphra, Swabha Swayamdipta, and Pengcheng Yin. Dynet: The dynamic neural network toolkit. arXiv preprint arXiv:1701.03980, 2017.
359
+
360
+ Vlad Niculae, Andre FT Martins, Mathieu Blondel, and Claire Cardie. SparseMAP: Differentiable ´ sparse structured inference. In Proceedings of ICML 2018, 2018.
361
+
362
+ J. Nivre, J. Nilsson, and J. Hall. Talbanken05: A swedish treebank with phrase structure and dependency annotation. In Proceedings of the Fifth International Conference on Language Resources and Evaluation (LREC’06). European Language Resources Association (ELRA), 2006. URL http://www.aclweb.org/anthology/L06-1121.
363
+
364
+ Hiroshi Noji, Yusuke Miyao, and Mark Johnson. Using left-corner parsing to encode universal structural constraints in grammar induction. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pp. 33–43. Association for Computational Linguistics, 2016. doi: 10.18653/v1/D16-1004. URL http://www.aclweb.org/anthology/ D16-1004.
365
+
366
+ George Papandreou and Alan L Yuille. Perturb-and-MAP random fields: Using discrete optimization to learn and sample from energy models. In Computer Vision (ICCV), 2011 IEEE International Conference on, pp. 193–200. IEEE, 2011.
367
+
368
+ Hao Peng, Sam Thomson, and Noah A. Smith. Backpropagating through structured argmax using a spigot. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1863–1873. Association for Computational Linguistics, 2018. URL http://aclweb.org/anthology/P18-1173.
369
+
370
+ Fernando C. N. Pereira and David H. D. Warren. Parsing as deduction. In 21st Annual Meeting of the Association for Computational Linguistics, 1983. URL http://www.aclweb.org/ anthology/P83-1021.
371
+
372
+ Matthew Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke Zettlemoyer. Deep contextualized word representations. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pp. 2227–2237. Association for Computational Linguistics, 2018. URL http://aclweb.org/anthology/N18-1202.
373
+
374
+ Siva Reddy, Oscar Tackstr ¨ om, Michael Collins, Tom Kwiatkowski, Dipanjan Das, Mark Steedman, ¨ and Mirella Lapata. Transforming dependency structures to logical forms for semantic parsing. Transactions of the Association for Computational Linguistics, 4:127–140, 2016.
375
+
376
+ 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, volume 32 of Proceedings of Machine Learning Research, pp. 1278–1286, Bejing, China, 22–24 Jun 2014. PMLR. URL http://proceedings.mlr. press/v32/rezende14.html.
377
+
378
+ Kenji Sagae and Jun’ichi Tsujii. Dependency parsing and domain adaptation with lr models and parser ensembles. In Proceedings of the 2007 Joint Conference on Empirical Methods in Natural Language Processing and Computational Natural Language Learning (EMNLP-CoNLL), 2007. URL http://www.aclweb.org/anthology/D07-1111.
379
+
380
+ Djame Seddah, Reut Tsarfaty, Sandra K ´ ubler, Marie Candito, Jinho D. Choi, Rich ¨ ard Farkas, Jen- ´ nifer Foster, Iakes Goenaga, Koldo Gojenola Galletebeitia, Yoav Goldberg, Spence Green, Nizar Habash, Marco Kuhlmann, Wolfgang Maier, Joakim Nivre, Adam Przepiorkowski, Ryan Roth, ´ Wolfgang Seeker, Yannick Versley, Veronika Vincze, Marcin Wolinski, Alina Wr ´ oblewska, and ´ Eric Villemonte de la Clergerie. Overview of the spmrl 2013 shared task: A cross-framework evaluation of parsing morphologically rich languages. In Proceedings of the Fourth Workshop on Statistical Parsing of Morphologically-Rich Languages, pp. 146–182. Association for Computational Linguistics, 2013. URL http://www.aclweb.org/anthology/W13-4917.
381
+
382
+ Stuart M Shieber, Yves Schabes, and Fernando CN Pereira. Principles and implementation of deductive parsing. The Journal of logic programming, 24(1-2):3–36, 1995.
383
+
384
+ David Smith and Jason Eisner. Dependency parsing by belief propagation. In Proceedings of the 2008 Conference on Empirical Methods in Natural Language Processing, pp. 145–156. Association for Computational Linguistics, 2008. URL http://www.aclweb.org/anthology/ D08-1016.
385
+
386
+ Ilya Sutskever, Oriol Vinyals, and Quoc V Le. Sequence to sequence learning with neural networks. In Z. Ghahramani, M. Welling, C. Cortes, N. D. Lawrence, and K. Q. Weinberger (eds.), Advances in Neural Information Processing Systems 27, pp. 3104–3112. Curran Associates, Inc., 2014. URL http://papers.nips.cc/paper/ 5346-sequence-to-sequence-learning-with-neural-networks.pdf.
387
+
388
+ Jun Suzuki, Hideki Isozaki, and Masaaki Nagata. Learning condensed feature representations from large unsupervised data sets for supervised learning. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies, pp. 636– 641. Association for Computational Linguistics, 2011. URL http://www.aclweb.org/ anthology/P11-2112.
389
+
390
+ Kai Sheng Tai, Richard Socher, and Christopher D. Manning. Improved semantic representations from tree-structured long short-term memory networks. In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pp. 1556–1566. Association for Computational Linguistics, 2015. doi: 10.3115/v1/P15-1150. URL http://www.aclweb.org/ anthology/P15-1150.
391
+
392
+ Robert Endre Tarjan. Finding optimum branchings. Networks, 7(1):25–35, 1977.
393
+
394
+ Ben Taskar, Vassil Chatalbashev, Daphne Koller, and Carlos Guestrin. Learning structured prediction models: A large margin approach. In Proceedings of the 22nd international conference on Machine learning, pp. 896–903. ACM, 2005.
395
+
396
+ Lucien Tesniere. \` Les el´ ements de Syntaxe structurale ´ . Editions Klincksieck, 1959.
397
+
398
+ Ke Tran and Yonatan Bisk. Inducing grammars with and for neural machine translation. In Proceedings of the 2nd Workshop on Neural Machine Translation and Generation, pp. 25–35. Association for Computational Linguistics, 2018. URL http://aclweb.org/anthology/ W18-2704.
399
+
400
+ Adina Williams, Andrew Drozdov, and Samuel R Bowman. Do latent tree learning models identify meaningful structure in sentences? Transactions of the Association for Computational Linguistics, 6:253–267, 2018.
401
+
402
+ Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3-4):229–256, 1992.
403
+
404
+ Weidi Xu, Haoze Sun, Chao Deng, and Ying Tan. Variational autoencoder for semi-supervised text classification. In AAAI, pp. 3358–3364, 2017.
405
+
406
+ Pengcheng Yin, Chunting Zhou, Junxian He, and Graham Neubig. Structvae: Tree-structured latent variable models for semi-supervised semantic parsing. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 754–765. Association for Computational Linguistics, 2018. URL http://aclweb.org/anthology/ P18-1070.
407
+
408
+ Kun Yu, Daisuke Kawahara, and Sadao Kurohashi. Chinese dependency parsing with large scale automatically constructed case structures. In Proceedings of the 22nd International Conference on Computational Linguistics (Coling 2008), pp. 1049–1056. Coling 2008 Organizing Committee, 2008. URL http://www.aclweb.org/anthology/C08-1132.
409
+
410
+ Matthew D Zeiler. Adadelta: an adaptive learning rate method. arXiv preprint arXiv:1212.5701, 2012.
411
+
412
+ Chunting Zhou and Graham Neubig. Multi-space variational encoder-decoders for semi-supervised labeled sequence transduction. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 310–320. Association for Computational Linguistics, 2017. doi: 10.18653/v1/P17-1029. URL http://www.aclweb.org/ anthology/P17-1029.
413
+
414
+ # A REPARAMETRIZATION TRICK
415
+
416
+ Sampling from a diagonal Gaussian random variable with mean vector $_ { \mathbf { \nabla } } \mathbf { m } _ { \mathbf { \nabla } }$ and variance vector $\pmb { v }$ can be re-expressed as:
417
+
418
+ $$
419
+ \begin{array} { l } { e \sim \mathcal { N } ( 0 , 1 ) } \\ { z = m + v \times e } \end{array}
420
+ $$
421
+
422
+ where $_ { z }$ is the sample. As such, $\mathbf { \boldsymbol { e } } \sim \mathcal { N } ( \mathbf { \boldsymbol { 0 } } , \mathbf { \boldsymbol { 1 } } )$ is an input of the neural network for which we do not need to compute partial derivatives. This technique is called the reparametrization trick (Kingma & Welling, 2013; Rezende et al., 2014).
423
+
424
+ # B GUMBEL-MAX TRICK
425
+
426
+ Sampling from a categorical distributions can be achieved through the Gumbel-Max trick (Gumbel, 1954; Maddison et al., 2014). Randomly generated Gumbel noise is added to the log-probability of every element of the sample space. Then, the sample is simply the element with maximum perturbed log-probability. Let $d \in \triangle ^ { k }$ be a random variable taking values in the corner of the unit-simplex of dimension $k$ with probability:
427
+
428
+ $$
429
+ p ( d \in \triangle ^ { k } ) = \frac { \exp ( \pmb { w } ^ { \top } d ) } { \sum _ { d ^ { \prime } \in \triangle ^ { k } } \exp ( \pmb { w } ^ { \top } d ^ { \prime } ) }
430
+ $$
431
+
432
+ where $\textbf { \em w }$ is a vector of weights. Sampling $d \sim p ( d )$ can be re-expressed as follows:
433
+
434
+ $$
435
+ \begin{array} { l } { \pmb { g } \sim \pmb { \mathcal { G } } ( 0 , 1 ) } \\ { \pmb { d } = \arg \operatorname* { m a x } ( \pmb { w } + \pmb { g } ) ^ { \top } \pmb { d } } \\ { \pmb { d } \in \triangle ^ { k } } \end{array}
436
+ $$
437
+
438
+ where $\mathcal { G } ( 0 , 1 )$ is the Gumbel distribution. Sampling $\mathbf { \boldsymbol { \mathscr { g } } } \sim \mathcal { G } ( 0 , 1 )$ is equivalent to setting $g _ { i } =$ $- \log ( - \log u _ { i } ) )$ where $u _ { i } \sim \mathrm { U n i f o r m } ( 0 , 1 )$ . If $\pmb { w }$ is computed by a neural network, the sampling process is outside the backpropagation path.
439
+
440
+ # C CORPORA
441
+
442
+ English We use the Stanford Dependency conversion (De Marneffe & Manning, 2008) of the Penn Treebank (Marcus et al., 1993) with the usual section split: 02-21 for training, 22 for development and 23 for testing. In order to simulate our framework under a low-resource setting, the annotation is kept for $1 0 \%$ of the training set only: a labeled sentence is the sentence which has an index (in the training set) modulo 10 equal to zero.
443
+
444
+ French We use a similar setting with the French Treebank version distributed for the SPMRL 2013 shared task and the provided train/dev/test split (Abeille et al., 2000; Seddah et al., 2013). ´
445
+
446
+ Swedish We use the Talbanken dataset (Nivre et al., 2006) which contains two written text parts: the professional prose part (P) and the high school students’ essays part (G). We drop the annotation of (G) in order to use this section as unlabeled data. We split the (P) section in labeled train/dev/test using a pseudo-randomized scheme. We follow the splitting scheme of Hall et al. (2006) but fix section 9 as development instead of $k$ -fold cross-validation. Sentence $i$ is allocated to section $i$ mod 10. Then, section 1-8 are used for training, section 9 for dev and section 0 for test.
447
+
448
+ # D HYPER-PARAMETERS
449
+
450
+ Encoder: word embeddings We concatenate trainable word embeddings of size 100 with external word embeddings.15 We use the word-dropout settings of Kiperwasser & Goldberg (2016). For English, external embeddings are pre-trained with the structured skip n-gram objective (Ling et al., 2015).16 For French and Swedish, we use the Polyglot embeddings (Al-Rfou et al., 2013).17 We stress out that no part-of-speech tag is used as input in any part of our network.
451
+
452
+ Encoder: dependency parser The dependency parser is built upon a two-stack BiLSTM with a hidden layer size of 125 (i.e. the output at each position is of size 250). Each dependency is then weighted using a single-layer perceptron with a tanh activation function. Arc label prediction rely on a similar setting, we refer to the reader to Kiperwasser & Goldberg (2016) for more information about the parser’s architecture.
453
+
454
+ Encoder: sentence embedding The sentence is encoded into a fixed size vector with a simple leftto-right LSTM with an hidden size of 100. The hidden layer at the last position of the sentence is then fed to two distinct single-layer perceptrons, with an output size of 100 followed by a piecewise tanh activation function, that computes means and standard deviations of the diagonal Gaussian distribution.
455
+
456
+ Decoder The decoder use fixed pre-trained embeddings only. The recurrent layer of the decoder is a LSTM with an hidden layer size of $1 0 0 . ~ \mathrm { M L P } ^ { \sim }$ , ${ \bf M L P } ^ { \curvearrowright }$ and ${ \bf M L P } ^ { \mathrm { O } }$ are all single-layer perceptrons with an output size of 100 and without activation function.
457
+
458
+ Training We encourage the VAE to rely on latent structures close to the targeted ones by bootstrapping the training procedure with labeled data only. In the first two epochs, we train the network with the discriminative loss only. Then, for the next two epochs, we add the supervised ELBO term (Equation 5). Finally, after the 6th epoch, we also add the unsupervised ELBO term (Equation 3). We train our network using stochastic gradient descent for 30 epochs using Adadelta (Zeiler, 2012) with default parameters as provided by the Dynet library (Neubig et al., 2017). In the semisupervised scenario, we alternate between labeled and unlabeled instances. The temperature of the PEAKED-SOFTMAX operator is fixed to $\tau = 1$ .
459
+
460
+ # E COMPARISON WITH SEMIRING PARSING
461
+
462
+ Dynamic programs for parsing have been studied as abstract algorithms that can be instantiated with different semirings (Goodman, 1999). For example, computing the weight of the best parse relies on the $\langle \mathbb { R } , \operatorname* { m a x } , + \rangle$ semiring. This semiring can be augmented with set-valued operations to retrieve the best derivation. However, a straightforward implementation would have a $\hat { \mathcal { O } } ( n ^ { 5 } )$ space complexity: for each item in the chart, we also need to store the set of arcs. Under this formalism, the backpointer trick is a method to implicitly constructs these sets and maintain the optimal $\mathcal { O } ( n ^ { 3 } )$ complexity. Our continuous relaxation replaces the max operator with a smooth surrogate and the set values with a soft-selection of sets. Unfortunately, $\langle \mathbb { R }$ , PEAKED-SOFTMAXi is not a commutative monoid, therefore the semiring analogy is not transposable.
463
+
464
+ # F DIFFERENTIABLE DYNAMIC PROGRAMMING FOR PROJECTIVEDEPENDENCY PARSING
465
+
466
+ We describe how we can embed a continuous relaxation of projective dependency parsing as a node in a neural network. During the forward pass, we are given arc weights $W$ and we compute the relaxed projective dependency tree $_ { \mathbf { T } }$ that maximize the arc-factored weight $\begin{array} { r } { \sum _ { h , m } T _ { h , m } \times \bar { W _ { h , m } } } \end{array}$ . Each output variable $T _ { h , m } \in [ 0 , 1 ]$ is a soft selection of dependency with head-word $s _ { h }$ and modifier $s _ { m }$ . During back-propagation, we are given partial derivatives of the loss with respect to each arc and we compute the ones with respect to arc weights:
467
+
468
+ $$
469
+ \frac { \partial \mathcal { L } } { \partial W _ { h , m } } = \sum _ { i , j } \frac { \partial \mathcal { L } } { \partial T _ { i , j } } \frac { \partial T _ { i , j } } { \partial W _ { h , m } }
470
+ $$
471
+
472
+ Note that the Jacobian matrix has $\mathcal { O } ( n ^ { 4 } )$ values but we do need to explicitly compute it. The space and time complexity of the forward and backward passes are both cubic, similar to Eisner’s algorithm.
473
+
474
+ # F.1 FORWARD PASS
475
+
476
+ The forward pass is a two step algorithm:
477
+
478
+ 1. First, we compute the cumulative weight of each item and store soft backpointers to keep track of contribution of antecedents. This step is commonly called to inside algorithm. 2. Then, we compute the contribution of each arc thanks to the backpointers. This step is somewhat similar to the arg max reconstruction algorithm.
479
+
480
+ The outline of the algorithm is given in Algorithm 3.
481
+
482
+ The inside algorithm computes the following variables:
483
+
484
+ • $a [ i \triangleright j ] [ k ]$ is the weight of item $[ i \triangleright j ]$ if we split its antecedent at $k$ .
485
+ • $b [ i \triangleright j ] [ k ]$ is the soft backpointer to antecedents of item $[ i \triangleright j ]$ with split at $k$ .
486
+ • $c [ i \triangleright j ]$ is the cumulative weight of item $[ i \triangleright j ]$ .
487
+
488
+ and similarly for the other chart values. The algorithm is given in Algorithm 5.
489
+
490
+ The backpointer reconstruction algorithm compute the contribution of each arc. We follow backpointers in reverse order in order to compute the contribution of each item $\tilde { c } [ i \triangleright j ]$ . The algorithm is given in Algorithm 6.
491
+
492
+ # F.2 BACKWARD PASS
493
+
494
+ During the backward pass, we compute the partial derivatives of variables using the chain rule, i.e. in the reverse order of their creation: we first run backpropagation through the backpointer reconstruction algorithm and then through the inside algorithm (see Algorithm 4). Given the partial derivatives in Figure 3, backpropagation through the backpointer reconstruction algorithm is straighforward to compute, see Algorithm 7. Partial derivatives of the inside algorithm’s variables are given in Figure 4.
495
+
496
+ <table><tr><td>Algorithm3Forward algorithm</td></tr><tr><td>function RELAXED-EISNER(</td></tr><tr><td>INSIDE()</td></tr><tr><td>BACKPTRO</td></tr><tr><td></td></tr><tr><td>fori=O...ndo for j=1...n do</td></tr><tr><td>if i&lt;jthen</td></tr><tr><td>Ti,j←ci口j]</td></tr><tr><td>else if j&lt;ithen Ti,j←i□j</td></tr></table>
497
+
498
+ <table><tr><td>Algorithm4Backward algorithm</td></tr><tr><td>function BACKPROP-RELAXED-EISNER()</td></tr><tr><td>BACKPROP-BACKPTR()</td></tr><tr><td>BACKPROP-INSIDE(</td></tr><tr><td></td></tr><tr><td>fori=O...ndo for j=1...n do</td></tr><tr><td>ifi&lt;jthen</td></tr><tr><td>8L 8L ↑</td></tr><tr><td>Wi,j dc[iDj else if j&lt;ithen</td></tr><tr><td>Algorithm 5 Inside algorithm - Forward pass</td></tr><tr><td>function INSIDE(n)</td></tr><tr><td>fori←O...ndo</td></tr><tr><td>c[𝑖△i]←O,c[i△i]←O,c[i△i]←O,c[ii]←0</td></tr><tr><td>forl←1...ndo</td></tr><tr><td>fori←O...n-ldo j←i+l</td></tr><tr><td>for k=i...j-1do</td></tr><tr><td>a[𝑖j][k]←c[𝑖△k]+c[k+1△j]</td></tr><tr><td>b[ij] ← softmax(a[i j])</td></tr><tr><td>c[iDj]←Wi,j +∑k=i.j-1b[iDj][]× a[ Dj][]</td></tr><tr><td>fork=i...j-1do</td></tr><tr><td>a[ij][k]←c[𝑖△k]+c[k+1△j] b[ij] ← softmax(a[ijl)</td></tr><tr><td>c[i□j]←Wj,i+∑k=i.j-1b[i △j][k] × a[i j][k]</td></tr><tr><td>for k=i+1...j do</td></tr><tr><td>a[i△j][k]←c[𝑖△k]+c[k△j]</td></tr><tr><td>b[i j] ← softmax(a[i jl)</td></tr><tr><td>c[i△j]←∑k=i+1.,jb[𝑖△j][k] × a[i△ j][k]</td></tr><tr><td></td></tr><tr><td>fork=i...j-1do</td></tr><tr><td>a[i △j][k]←c[𝑖△k]+c[kj] b[i △ j] ← softmax(a[i △ jl)</td></tr><tr><td>c[i△j]←∑k=i..j-1b[i △j][k]×a[i △j[k]</td></tr><tr><td>Algorithm 6 Backpointer reconstruction algorithm - Forward pass</td></tr><tr><td>function BACKPTR()</td></tr><tr><td>fori=O...ndo</td></tr><tr><td>forj=i...n do c[𝑖□j]←0,c[𝑖△j]←0,c[𝑖△j]←0,c[𝑖△j]←0</td></tr><tr><td>c[0△n]←1</td></tr><tr><td>forl=n...1do</td></tr><tr><td>fori=O...n-ldo</td></tr><tr><td>j←i+l</td></tr><tr><td>for k=i+1...j do</td></tr><tr><td>[ik][i△j]×b[i△j[]</td></tr><tr><td>[k△j]↑c[i△j]×b[i△j][]</td></tr><tr><td>for k=i...j-1 do</td></tr><tr><td>c[i△k]←c[i△j]×b[i△j][k]</td></tr><tr><td>[k△j]↑[i△j]×b[i△j[k]</td></tr><tr><td></td></tr><tr><td>for k=i...j-1 do [i△k]←[ij]×b[ij][k]</td></tr><tr><td>c[k+1△j]↑c[ij]×6[ij][k]</td></tr><tr><td></td></tr><tr><td>for k =i...j-1 do</td></tr><tr><td>[i△k]←[ij]×b[ij][k]</td></tr><tr><td>[k+1△j]←[ij]×b[𝑖j][]</td></tr></table>
499
+
500
+ $$
501
+ \begin{array} { r l r l r l r l } & { \langle \Psi | \le K \le \xi \ge \frac { 1 } { 2 } ; } & & { \frac { \partial \langle \Psi | \le R \vec { \xi } \perp \vec { K } \_ j \big | } { \partial \xi } = b | \le \ \sqrt { \xi } , } & & { \forall \xi \le \ k \le \ j : } & & { \frac { \partial \langle \Psi | \le R \vec { \xi } \perp \vec { K } \_ j \big | } { \partial \xi } = c | \mathrm { t s } \cdot \ b | \le \vec { \xi } \big | } \\ & { \langle \Psi | \le K \le \xi \ge \frac { 1 } { 2 } ; } & & { \frac { \partial \langle \Psi | \cdot K \vec { \xi } \_ j \big | } { \partial \xi } - b | \sqrt { \xi } \big | \sqrt { \xi } \quad , } & & { \forall \xi \le \ k \le \ j : } & & { \frac { \partial \langle \Psi | \cdot K \vec { \xi } \_ j \big | } { \partial \xi } \big | \sqrt { \xi } \big | \sqrt { \xi } \big | \sqrt { \xi } \big | \sqrt { \xi } \big | } \\ & { \langle \Psi | \le K \le \xi \le \frac { 1 } { 2 } ; } & & { \frac { \partial \langle \Psi | \le R \vec { \xi } \_ j \big | } { \partial \xi } \big | \frac { 1 } { \partial \xi } \big | \frac { 1 } { \partial \xi } \big | \sqrt { \xi } \big | \sqrt { \xi } \big | \sqrt { \xi } \big | \sqrt { \xi } \big | \xi \big | \xi \big | \xi \big | , } & & { \forall \xi \le \ k \le \ j \ } & & { \frac { \partial \langle \Psi | \cdot K \vec { \xi } \_ j \big | } { \partial \xi } \big | \sqrt { \xi } \big | \xi \big | \xi \big | \xi \big | \xi \big | \xi \big | } \\ & { \langle \Psi | \le K \le \xi \le \frac { 1 } { 2 } ; } & & \frac { \partial \langle \Psi | \cdot K \vec { \xi } \_ j \big | } { \partial \xi } \big | \frac { 1 } { \partial \xi } \big | \frac { 1 } { \partial \xi } \big | \sqrt { \xi } \big | \xi \big | \xi \big | \xi \big | \xi \big | \xi \big | \xi \big | \xi \big | \xi \big | \xi \big | \xi \big | \xi \big | \xi \xi \xi \xi \xi \xi \xi \big | \xi \big | \xi \big | \xi \big | \xi \big | \xi \big | \xi \big | \xi \big | \xi \big | \xi \big | \xi \big | \xi \end{array}
502
+ $$
503
+
504
+ <table><tr><td>Algorithm 7 Backpointer reconstruction algorithm - Backward pass</td><td></td></tr><tr><td>function BACKPROP-BACKPTR(n) for l=1...ndo</td><td></td></tr><tr><td>fori=O...n-ldo</td><td></td></tr><tr><td>j↑i+l</td><td></td></tr><tr><td>aL aL</td><td>3L 8 ↑ 0, ↑ 0, ↑0</td></tr><tr><td>0, dj dc[ij] fork=i...j-1do</td><td>i dcij</td></tr><tr><td>aL 仁 aL</td><td>6ij][]+ aL 6[ij][]</td></tr><tr><td>dii d[iK] 8L aL ↑</td><td>dc[k+14j] ci□j]+ 8 ci□j</td></tr><tr><td>6[ij][] i]</td><td>ac[k+14j]</td></tr><tr><td>fork=i...j-1do</td><td></td></tr><tr><td>8L 土 aL</td><td>6[i□j][]+ aL</td></tr><tr><td>Dj] aL 8L ↑</td><td>k] dc[k+1j] 8L</td></tr><tr><td>6[j][]</td><td>iDj+ C[iDj] ] dc[k+14j]</td></tr><tr><td></td><td></td></tr><tr><td>for=i...j-1do aL 仁 8L</td><td></td></tr><tr><td>diAj ac[ik]</td><td>6[i△j][]+ aL 6[i△j][] kj</td></tr><tr><td>8 ab[ij][k] 个</td><td>a i△j]+ 8 i△j]</td></tr><tr><td></td><td>dciZk] ci</td></tr><tr><td></td><td></td></tr><tr><td>for=i+1...j do</td><td></td></tr><tr><td>aL ↑</td><td>aL aL</td></tr><tr><td>j]</td><td>bi△j][k]+ 6[ij][]</td></tr><tr><td></td><td>dc[ik] d[i]</td></tr><tr><td>aL</td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td>aL cij]</td></tr><tr><td></td><td>ij+ 8</td></tr><tr><td></td><td></td></tr><tr><td>6[ij][]</td><td>ik]</td></tr><tr><td></td><td>dkj</td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr></table>
505
+
506
+ $$
507
+ \begin{array} { r l r l } & { \mathrm { ~ w h e r e a g e ~ \_ t h ~ } } & { \frac { \mathrm { S u b s i n g ~ i n g ~ 1 } } { \mathrm { S u b s i n g ~ 1 } } } & { \quad \forall i \in \Sigma \setminus \Omega _ { \theta } } & { \frac { \mathrm { S u b s i n g ~ 1 } } { \mathrm { S u b s i n g ~ 1 } } } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \times \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \times \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \times \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \end{array}
508
+ $$
509
+
510
+ Algorithm 8 Inside algorithm - Backward pass
511
+
512
+ function BACKPROP-INSIDE(n)
513
+
514
+ $$
515
+ \begin{array} { r } { \frac { \partial \mathcal { L } } { \partial c [ i \mathcal { L } j ] } 0 , \frac { \partial \mathcal { L } } { \partial c [ i \triangleright j ] } 0 , \frac { \partial \mathcal { L } } { \partial c [ i \mathcal { L } j ] } 0 , \frac { \partial \mathcal { L } } { \partial c [ i \triangleright j ] } 0 } \end{array}
516
+ $$
517
+
518
+ do $\triangleright$ Backpropagation through the ”inside” algorithm
519
+ $i = 0 \dots n - l$ do
520
+ $j \gets i + l$
521
+ for $k = i \dots j - 1$ $\begin{array} { r } { \frac { \partial \mathcal { L } } { \partial b [ i \mathcal { A } j ] [ k ] } \^ { } - \frac { \partial \mathcal { L } } { \partial c [ i \mathcal { A } j ] } a [ i \mathcal { A } j ] [ k ] } \end{array}$ $\begin{array} { r } { \frac { \partial \mathcal { L } } { \partial a [ i \mathcal { A } j ] [ k ] } \frac { \partial \mathcal { L } } { \partial c [ i \mathcal { A } j ] } b [ i \mathcal { A } j ] [ k ] } \end{array}$
522
+ s = Pk=i...j−1 ∂L∂b[i j][k ] b[i j][k] . Backpropagate through the softmax function
523
+ for k = i . . . j − 1 do ∂L∂a[i j][k] ← b[i j][k]  ∂L∂b[i j][k] − s
524
+ for $k = i \dots j - 1$ do ∂L +← ∂L ∂c[i k] ∂a[i j][k] $\begin{array} { r } { \frac { \partial \mathcal { L } } { \partial c [ k \varTheta _ { j } ] } \stackrel { + } { } \frac { \partial \mathcal { L } } { \partial a [ i \varTheta _ { j } ] [ k ] } } \end{array}$
525
+ for $k = i + 1 \ldots j$ do∂L $\begin{array} { r } { \frac { \partial \mathcal { L } } { \partial b [ i \triangleright j ] [ k ] } \frac { \partial \mathcal { L } } { \partial c [ i \triangleright j ] } a [ i \triangleright j ] [ k ] } \end{array}$ $\begin{array} { r } { \frac { \partial \mathcal { L } } { a [ i \triangleright j ] [ k ] } \frac { \partial \mathcal { L } } { \partial c [ i \triangleright j ] } { \partial b [ i \triangleright j ] [ k ] } } \end{array}$
526
+ s = Pk=i+1...j ∂L∂b[i j][k] b . Backpropagate through the softmax function
527
+ for $k = i + 1 \dots j$ do
528
+ for $\begin{array} { r l } & { \frac { \partial \mathcal { L } } { \partial a [ i \triangleright j ] [ k ] } b [ i \triangleright j ] [ k ] ( \frac { \partial \mathcal { L } } { \partial b [ i \triangleright j ] [ k ] } - s ) } \\ & { k = i + 1 \ldots j \bf { d o } } \\ & { \frac { \partial \mathcal { L } } { \partial c [ i \triangleright k ] } \frac { \partial \mathcal { L } } { \partial a [ i \triangleright j ] [ k ] } } \\ & { \frac { \partial \mathcal { L } } { \partial c [ k \triangleright j ] } \frac { \partial \mathcal { L } } { \partial a [ i \triangleright j ] [ k ] } } \end{array}$ $\begin{array} { r l } & { \begin{array} { r l } & { \mathrm { f o r ~ } k = i , \ldots , j - 1 \mathrm { ~ d o } } \\ & { \frac { \partial b ( k ) } { \partial a ( k ^ { 2 } ) [ k ] } \in - \frac { \partial C } { \partial ( k ^ { 2 } ) [ k ] } a [ i \coth ] } \\ & { \frac { \partial C } { \partial a ( k ^ { 2 } ) [ k ] } \in - \frac { \partial C } { \partial ( k ^ { 2 } ) [ k ] } b [ i \coth ] } \end{array} } \\ & { \begin{array} { r l } & { \mathrm { S ~ a c k ~ } } \\ & { \mathrm { f o r ~ } k = i , \ldots , j - 1 \frac { \partial C } { \partial ( k ^ { 2 } ) [ k ] } b [ i \coth ] } \\ & { \mathrm { f o r ~ } k = i , \ldots , j - 1 \mathrm { ~ d o } } \\ & { \frac { \partial C } { \partial a ( k ^ { 2 } ) [ k ] } b [ i \coth ] [ k ] ( \frac { \partial C } { \partial b [ k ^ { 2 } ] [ k ] } - s ) } \end{array} } \\ & { \begin{array} { r l } & { \mathrm { f o r ~ } k = i , \ldots , j - 1 \mathrm { ~ d o } } \\ & { \frac { \partial C } { \partial a ( k ^ { 2 } ) [ k ] } \in - b [ i \coth ] [ k ] ( \frac { \partial C } { \partial ( k ^ { 2 } ) [ k ] } - s ) } \end{array} } \\ & { \begin{array} { r l } & { \mathrm { f o r ~ } k = i , \ldots , j - 1 \mathrm { ~ d o } } \\ & { \frac { \partial C } { \partial a ( k ^ { 2 } ) [ k ] } \neq \frac { \partial C } { \partial a ( k ^ { 2 } ) [ k ] } } \\ & { \frac { \partial C } { \partial c [ k \coth ] } \neq \frac { \partial C } { \partial a ( k ^ { 2 } ) [ k ] } } \end{array} } \end{array}$
529
+ for $k = i \dots j - 1$ do $\begin{array} { r } { \frac { \partial \mathcal { L } } { \partial b [ i \sum j ] [ k ] } \frac { \partial \mathcal { L } } { \partial c [ i \sum j ] } a [ i \triangleright j ] [ k ] } \end{array}$ ← ∂L∂c[i j] a[i j][k] $\begin{array} { r } { \frac { \partial \mathcal { L } } { \partial a [ i \sum j ] [ k ] } \frac { \partial \mathcal { L } } { \partial c [ i \sum j ] } b [ i \triangleright j ] [ k ] } \end{array}$
530
+ $\begin{array} { r } { s = \sum _ { k = i \dots j - 1 } \frac { \partial \mathcal { L } } { \partial b [ i \sum j ] [ k ] } b [ i \triangleright j ] [ k ] } \end{array}$ . Backpropagate through the softmax function
531
+ for k = i . . . j − 1 do ∂L∂a[i j][k] ← b[i j][k]  ∂L∂b[i j][k] − s
532
+ for k = i . . . j − 1 do ∂L +← ∂L ∂c[i k]∂L ∂a[i j][k]+ ∂L 24 ∂c[k+1 j] ∂a[i j][k]
md/train/Bkl086VYvH/Bkl086VYvH.md ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # FEATURE-MAP-LEVEL ONLINE ADVERSARIAL KNOWLEDGE DISTILLATION
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Feature maps contain rich information about image intensity and spatial correlation. However, previous online knowledge distillation methods only utilize the class probabilities. Thus in this paper, we propose an online knowledge distillation method that transfers not only the knowledge of the class probabilities but also that of the feature map using the adversarial training framework. We train multiple networks simultaneously by employing discriminators to distinguish the feature map distributions of different networks. Each network has its corresponding discriminator which discriminates the feature map from its own as fake while classifying that of the other network as real. By training a network to fool the corresponding discriminator, it can learn the other network’s feature map distribution. Discriminators and networks are trained concurrently in a minimax twoplayer game. Also, we propose a novel cyclic learning scheme for training more than two networks together. We have applied our method to various network architectures on the classification task and discovered a significant improvement of performance especially in the case of training a pair of a small network and a large one.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ With the advent of Alexnet (Krizhevsky et al., 2012), deep convolution neural networks have achieved remarkable success in a variety of computer vision tasks. However, high-performance of deep neural network is often gained by increasing the depth or the width of a network. Deep and wide networks cost a large number of computation as well as memory storage which is not suitable for a resource-limited environment such as mobile or embedded systems. To overcome this issue, many researches have been conducted to develop smaller but accurate neural networks. Some of the well-known methods in this line of research are parameter quantization or binarization (Rastegari et al., 2016), pruning (Li et al., 2016) and knowledge distillation (KD) (Hinton et al., 2015).
12
+
13
+ KD has been an active area of research as a solution to improve the performance of a light-weight network by transferring the knowledge of a large pre-trained network (or an ensemble of small networks) as a teacher network. KD sets the teacher network’s class probabilities as a target which a small student network tries to mimic. By aligning the student’s predictions to those of the teacher, the student can improve its performance. Recently, some studies have shown that rather than using a pretrained teacher, simultaneously training networks to learn from each other in a peer-teaching manner is also possible. This approach is called online distillation. Deep mutual learning (DML) (Zhang et al., 2018) and on-the-fly native ensemble (ONE) (Lan et al., 2018) are the representative online distillation methods that show appealing results in the image classification tasks. Conventional distillation method requires pre-training a powerful teacher network and performs an one-way transfer to a relatively small and untrained student network. On the other hand, in online mutual distillation, there is no specific teacher-student role. All the student networks learn simultaneously by teaching each other from the start of training. It trains with the conventional cross-entropy loss from the ground truth label along with the mimicry loss to learn from its peers. Networks trained in such an online distillation way achieve results superior not only to the networks trained with the cross-entropy loss alone but also to those trained in conventional offline distillation manner from a pre-trained teacher network.
14
+
15
+ ![](images/152e0f91fd83e929bd1339fb8de49322b8e5b1b9dd90640fa5570de8581ff42d.jpg)
16
+ Figure 1: The concept of online Adversarial Feature map Distillation (AFD) Each point represents a feature map for the corresponding input denoted by different colors. The thin line arrow indicates the evolvement of feature map data points as iteration goes on and the broader arrow indicates the way each method compares the feature maps from different networks. (a) In direct feature map alignment, networks are trained such that the distance between each pair of points with the same color is minimized. (b) In AFD, the discriminators contain information on feature map distributions and thus the networks are trained such that the distributions match. (best viewed in color)
17
+
18
+ However, aforementioned online distillation methods make use of only the logit information. While the logit contains the probabilistic information over classes, the feature map, the output of convolution layer, has more meaningful and abundant feature information on image intensity and spatial correlation. In offline distillation which utilizes a pre-trained model as a teacher network, many methods such as FitNet (Romero et al., 2014), attention transfer (AT) (Zagoruyko & Komodakis, 2016a) and factor transfer (FT) (Kim et al., 2018) make use of this intermediate feature representation as a target to learn for the student network, but in online distillation, to the best of our knowledge, no feature map-based knowledge distillation method has been proposed.
19
+
20
+ This is due to some challenges. Unlike the offline methods that have a clear target to mimic, there is no static target to follow in an online method. At every training iteration, the feature maps of the co-trained network change, thus in online feature map-level distillation, the problem turns into mimicking the moving target properly. While each node of the logit is confined to represent its assigned class probability which does not change drastically over iterations, at the feature map-level, much more flexibility comes into play, which makes the problem more challenging. Therefore, the direct aligning method such as using L1 or L2 distance is not suitable for online mutual feature map distillation because it updates the network parameters to generate a feature map that tries to mimic the current output feature map of the other network. In other words, the direct alignment method only tries to minimize the distance between the two feature map points (one for each network), hence it ignores the distributional difference between the two feature maps (Fig. 1(a)).
21
+
22
+ To alleviate this problem, in this paper, we propose a novel online distillation method that transfers the knowledge of feature maps adversarially as well as a cyclic learning framework for training more than two networks simultaneously. Unlike the direct aligning method, our adversarial distillation method enables a network to learn the overall feature map distribution of the co-trained network (Fig. 1(b)). Since the discriminator is trained to distinguish the difference between the networks’ feature map distributions (containing the history of feature maps for different input images) at every training iteration, by fooling the discriminator, the network learns the co-trained network’s changing feature map distribution. Exchanging the knowledge of feature map distribution facilitates the networks to converge to a better feature map manifold that generalizes better and yields more accurate results.
23
+
24
+ Our method consists of two major losses: 1) logit-based loss and 2) feature map-based loss. Logitbased loss is defined by two different loss terms which are conventional cross-entropy (CE) loss and the mutual distillation loss using the Kullback-Leibler divergence (KLD). Our newly proposed feature map-based loss is to distill the feature map indirectly via discriminators. We use the feature map from the last convolution layer since deeper convolution layer generates more meaningful features with a high-level abstraction (Kim et al., 2018). The adversarial training scheme of generative adversarial networks (GAN) (Goodfellow et al., 2014) is utilized to transfer the knowledge at feature map-level.
25
+
26
+ The contributions of this paper can be summarized as follows: 1) we propose an online knowledge distillation method that utilizes not only the logit but also the feature map from the convolution layer. 2) Our method transfers the knowledge of feature maps not by directly aligning them using
27
+
28
+ the distance loss but by learning their distributions using the adversarial training via discriminators.
29
+ 3) We propose a novel cyclic learning scheme for training more than two networks simultaneously.
30
+
31
+ # 2 RELATED WORK
32
+
33
+ The idea of model compression by transferring the knowledge of a high performing model to a smaller model was originally proposed by Bucilua et al. (2006). Then in recent years, this research ˇ area got invigorated due to the work of knowledge distillation (KD) by Hinton et al. (2015). The main contribution of KD is to use the softened logit of pre-trained teacher network that has higher entropy as an extra supervision to train a student network. KD trains a compact student network to learn not only by the conventional CE loss subjected to the labeled data but also by the final outputs of the teacher network. While KD only utilizes the logit, method such as FitNet (Romero et al., 2014), AT (Zagoruyko & Komodakis, 2016a), FT (Kim et al., 2018) and KTAN (Liu et al., 2018) use the intermediate feature representation to transfer the knowledge of a teacher network.
34
+
35
+ Online Knowledge Distillation: Conventional offline methods require training a teacher model in advance while online methods do not require any pre-trained model. Instead, the networks teach each other mutually by sharing their knowledge throughout the training process. Some examples of recent online methods are DML (Zhang et al., 2018) and ONE (Lan et al., 2018) which demonstrate promising results. DML simply applies KD losses mutually, treating each other as teachers, and it achieves results that is even better than the offline KD method. The drawback of DML is that it lacks an appropriate teacher role, hence provides only limited information to each network. ONE pointed out this defect of DML. Rather than mutually distilling between the networks, ONE generates a gated ensemble logit of the training networks and uses it as a target to align for each network. ONE tries to create a powerful teacher logit that can provide more generalized information. The flaw of ONE is that it can not train different network architectures at the same time due to its architecture of sharing the low-level layers for the gating module. The common limitation of existing online methods is that they are dependent only on the logit and do not make any use of the feature map information. Considering that KD loss term is only applicable to the classification task, transferring knowledge at feature map-level can enlarge the applicability to other tasks. Therefore, our method proposes a distillation method that utilizes not only the logit but also the feature map via adversarial training, moreover, our method can be applied in case where the co-trained networks have different architectures.
36
+
37
+ Generative Adversarial Network (GAN): GAN (Goodfellow et al., 2014) is a generative model framework that is proposed with an adversarial training scheme, using a generator network $G$ and a discriminator network $D$ . $G$ learns to generate the real data distribution while $D$ is trained to distinguish the real samples of the dataset from the fake results generated by $G$ . The goal of $G$ is to trick $D$ to make a mistake of determining the fake results as the real samples. Though it was initially proposed for generative models, its adversarial training scheme is not limited to data generation. Adversarial training has been adapted to various tasks such as image translation (Isola et al., 2017; Zhu et al., 2017), captioning (Dai et al., 2017), semi-supervised learning (Miyato et al., 2016; Springenberg, 2015), reinforcement learning (Pfau & Vinyals, 2016), and many others. In this paper, we utilize GAN’s adversarial training strategy to transfer the knowledge at feature map-level in an online manner. The networks learn the other networks’ feature map distributions by trying to deceive the discriminators while the discriminators are trained to distinguish the different distributions of each network.
38
+
39
+ # 3 PROPOSED METHOD
40
+
41
+ In this section, we describe the overall process of our proposed Online Adversarial Feature map Distillation (AFD). As can be seen in Figure 2, when training two different networks, $\Theta _ { 1 }$ and $\Theta _ { 2 }$ , in an online manner, we employ two discriminators, $D _ { 1 }$ and $D _ { 2 }$ . We train $D _ { 1 }$ such that the feature map of $\Theta _ { 2 }$ is regarded as a real and that of $\Theta _ { 1 }$ is classified as a fake and do vice versa for discriminator $D _ { 2 }$ . Then, each network $\Theta _ { 1 }$ and $\Theta _ { 2 }$ are trained to fool its corresponding discriminator so that it can generate a feature map that mimics the other network’s feature map. Throughout this adversarial training, each network learns the feature map distribution of the other network. By exploiting both logit-based distillation loss and feature map-based adversarial loss together, we could observe a significant improvement of performance in various pairs of network architectures especially when training small and large networks together. Also we introduce a cyclic learning scheme for training more than two networks simultaneously. It reduces the number of required discriminators from $2 \times _ { 2 } C _ { K }$ (when employing discriminators bidirectionally between every network pairs.) to $K$ where $K$ is the number of networks participating. This cyclic learning framework not only requires less computation than the bidirectional way but also achieves better results compared to other online training schemes for multiple networks.
42
+
43
+ ![](images/59ee2b5d08ffdf4df067c9b42ab71081ff7a5d972694eb4afb866124a1cfea94.jpg)
44
+ Figure 2: Overall schematic of online adversarial feature map distillation (AFD). At feature maplevel, each network is trained to deceive the corresponding discriminator so that it can mimic the other network’s feature map distribution. While at logit-level, KL loss to learn the peer network’s logit is applied as well as the conventional CE loss.
45
+
46
+ First, we explain the conventional mutual knowledge distillation method conducted among the networks at the logit-level. Then we introduce our novel online feature map distillation method using the adversarial training scheme in addition to the cyclic learning framework for training more than two networks at the same time.
47
+
48
+ # 3.1 LOGIT-BASED MUTUAL KNOWLEDGE DISTILLATION
49
+
50
+ We use two loss terms for logit-based learning, one is the conventional cross-entropy(CE) loss and the other is mutual distillation loss between networks based on Kullback Leibler(KL) divergence. We formulate our proposed method assuming training two networks. Training scheme for more than two networks will be explained in Sec 3.3. Below is the overall logit-based loss for two networks:
51
+
52
+ $$
53
+ \begin{array} { r l } & { \mathcal { L } _ { l o g i t } ^ { 1 } = \mathcal { L } _ { c e } ( y , \sigma ( z _ { 1 } ) ) + T ^ { 2 } \times \mathcal { L } _ { k l } ( \sigma ( z _ { 2 } / T ) , \sigma ( z _ { 1 } / T ) ) } \\ & { \mathcal { L } _ { l o g i t } ^ { 2 } = \mathcal { L } _ { c e } ( y , \sigma ( z _ { 2 } ) ) + T ^ { 2 } \times \mathcal { L } _ { k l } ( \sigma ( z _ { 1 } / T ) , \sigma ( z _ { 2 } / T ) ) . } \end{array}
54
+ $$
55
+
56
+ Here, $\sigma ( \cdot )$ refers to softmax function and $z \in \mathbb { R } ^ { C }$ is the logit produced from a network for $C$ - class classification problem. The temperature term $T$ is used to control the level of smoothness in probabilities. As the temperature term $T$ goes up, it creates a more softened probability distribution. We use $T = 3$ for every experiment. $\mathcal { L } _ { c e }$ is the CE loss between the ground truth label $y$ and the softmax output $\sigma ( z )$ that is commonly used in image classification. $\mathcal { L } _ { k l }$ is the KL loss between the softened logit of each network. We multiply the KL loss term with $T ^ { 2 }$ because the gradients produced by the soft targets are scaled by $1 / \dot { T } ^ { 2 }$ . While the CE loss is between the correct labels and the outputs of the model, the KL loss is the KL distance between the outputs of two training networks. The KL loss provides an extra information from the peer network so that the network can improve its generalization performance. The difference with DML is that while DML updates asynchronously which means that it updates one network first and then the other network, our AFD updates the networks synchronously, not alternatingly. The CE loss trains the networks to predict the correct truth label while the mutual distillation loss tries to match the outputs of the peer-networks, enabling the networks to share the knowledge at logit-level.
57
+
58
+ # .2 FEATURE MAP-BASED LEARNING VIA ADVERSARIAL TRAINING
59
+
60
+ Our AFD uses adversarial training to transfer knowledge at feature map-level. We formulate our adversarial feature map distillation for two networks which will be extended for more networks later. We divide a network into two parts, one is the feature extractor part that generates a feature map and the other is the classifier part that transforms the feature map into a logit. Each network also has a corresponding discriminator which distinguishes different feature map distributions. The architecture of the discriminator is simply a series of Conv-Batch Normalization-Leaky ReLU-Conv-Sigmoid. It takes a feature map of the last layer and it reduces the spatial size and the number of channel of the feature map as it goes through the convolution operation so that it can produce a single scalar value. Then we apply the sigmoid function of the value to normalize it between 0 and 1.
61
+
62
+ We utilize the feature extractor part to enable feature map-level distillation. For the convenience of mathematical notation, we name the feature extractor part as $G _ { k }$ and its discriminator as $D _ { k }$ , $k$ indicates the network number. As depicted in Figure 2, each network has to fool its discriminator to mimic the peer network’s feature map and the discriminator has to discriminate from which network the feature map is originated. Following LSGAN (Mao et al., 2017), our overall adversarial loss for discriminator and the feature extractor can be written as below:
63
+
64
+ $$
65
+ \begin{array} { r l } & { \mathcal { L } _ { D _ { 1 } } = [ 1 - D _ { 1 } ( G _ { 2 } ( x ) ) ] ^ { 2 } + [ D _ { 1 } ( G _ { 1 } ( x ) ) ] ^ { 2 } } \\ & { } \\ & { \mathcal { L } _ { G _ { 1 } } = [ 1 - D _ { 1 } ( G _ { 1 } ( x ) ) ] ^ { 2 } . } \end{array}
66
+ $$
67
+
68
+ The feature extractors $G _ { 1 }$ and $G _ { 2 }$ take input $x$ and generate feature maps. The discriminator $D _ { 1 }$ takes a feature map and yields a scalar between 0 (fake) and 1 (real). It is trained to output 1 if the feature map came from the co-trained network (in this case, $G _ { 2 }$ ) or 0 if the feature map is produced from the network it belongs to ( $G _ { 1 }$ in this case). The goal of $D _ { 1 }$ is to minimize the discriminator loss term $\mathcal { L } _ { D 1 }$ by correctly distinguishing the two different feature map distributions while $G _ { 1 }$ ’s goal is to minimize the loss term ${ \mathcal L } _ { G _ { 1 } }$ by fooling $D _ { 1 }$ to make mistake of determining $G _ { 1 }$ ’s feature map as real and yield 1. Each training network’s object is to minimize $\mathcal { L } _ { G _ { k } }$ to mimic the peer network’s feature map distribution. This adversarial scheme works exactly the same by changing the role of two networks.
69
+
70
+ In case where the two networks’ feature map outputs have different channel sizes, for example a pair like (WRN-16-2, WRN-16-4) (Zagoruyko & Komodakis, 2016b), we use a transfer layer that is composed of a convolution layer, a batch normalization and a ReLU which converts the number of channels to that of peer network. The above loss terms change as ${ \mathcal { L } } _ { D _ { 1 } } = [ 1 - D _ { 1 } ( T _ { 2 } ( G _ { 2 } ( x ) ) ) ] ^ { 2 } +$ $[ D _ { 1 } ( T _ { 1 } ( G _ { 1 } ( x ) ) ) ] ^ { 2 }$ and $\mathcal { L } _ { G _ { 1 } } = [ 1 - D _ { 1 } ( T _ { 1 } ( G _ { 1 } ( x ) ) ) ] ^ { 2 }$ when using the transfer layer $T _ { k }$ .
71
+
72
+ Optimization: Combining both logit-based loss and the adversarial feature map-based loss, the overall loss for each network $\Theta _ { 1 }$ and $\Theta _ { 2 }$ are as follows:
73
+
74
+ $$
75
+ \mathcal { L } _ { \Theta _ { 1 } } = \mathcal { L } _ { l o g i t } ^ { 1 } + \mathcal { L } _ { G _ { 1 } } , \qquad \mathcal { L } _ { \Theta _ { 2 } } = \mathcal { L } _ { l o g i t } ^ { 2 } + \mathcal { L } _ { G _ { 2 } }
76
+ $$
77
+
78
+ However, the logit-based loss term by the same optimizer. In fact, they $\mathcal { L } _ { l o g i t } ^ { k }$ and the feature map-based loss term ptimized alternatingly in a same min $\mathcal { L } _ { G _ { k } }$ are not optimizedch. At every minibatch iteration, we infer an image into a model and it computes a logit and a feature map. Then we calculate the two loss terms and optimize the networks based on the two losses separately, meaning that we update the parameters by the logit-based loss once and then update again by the feature map-based loss. The reason we optimize separately for each loss term is because they use different learning rates. The adversarial loss requires much slower learning rate thus if we use the same optimizer with the same learning rate, the networks would not be optimized. Note that we do not infer for each loss term, inference is conducted only once, only the optimization is conducted twice, one for each loss term.
79
+
80
+ # 3.3 CYCLIC LEARNING FRAMEWORK
81
+
82
+ Our method proposes a novel cyclic peer-learning scheme for training more than two networks simultaneously. As can be seen in Figure 3, each network transfers its knowledge to its next peer network in an one-way cyclic manner. If we train $K$ number of networks together, each network distills its knowledge to its next network except the last network transfers its knowledge to the first network, creating a cyclic knowledge transfer flow as $1 \to 2 , 2 \to 3 , \cdots , ( K - 1 ) \to K , K \to 1$ . The main contribution of using this cyclic learning framework is to avoid employing too many number of discriminators. If we apply our adversarial loss for every pair of networks, it would demand two times the amount of every possible pair of $K$ networks which would cost a lot of computation. Also in Sec 4.5, we empirically show that our cyclic training scheme is better than other online methods’ training scheme for multiple networks.
83
+
84
+ ![](images/20e560521e4bd10e2bb504a563a10b0cff737518c82eda761a1ab98a29880778.jpg)
85
+ Figure 3: Schematic of cyclic-learning framework for training 3 networks simultaneously.
86
+
87
+ # 4 EXPERIMENT
88
+
89
+ In this section, to show the adequacy of our method, we first present comparison experiment with distance method and ablation study to analyze our method. Then we compare our approach with existing online knowledge distillation methods under different settings. First of all, we demonstrate results on using the same sub-network architectures in Sec 4.3. Then, we apply our method on subnetworks with different architectures in Sec 4.4. In Sec 4.5, we also show the results of training more than two networks to demonstrate that our method generalizes well even when the number of networks increases.
90
+
91
+ In most of the experiments, we use the CIFAR-100 (Krizhevsky et al.) dataset. It consists of 50K training images and 10K test images over 100 classes, accordingly it has 600 images per each class. All the reported results on CIFAR-100 are average of 5 experiments. Since our method uses two loss terms, logit-based loss and feature map-based loss, we use different learning details for each loss term. For overall learning schedule, we follow the learning schedule of ONE(Lan et al., 2018) to conduct fair comparison which is 300 epochs of training. In terms of logit-based loss, the learning rate starts at 0.1 and is multiplied by 0.1 at 150, 225 epoch. We optimize the logit-based loss using SGD with mini-batch size of 128, momentum 0.9 and weight decay of 1e-4. This learning details for logit-based loss is equally applied to other compared online distillation methods. For feature map-based loss, the learning rate starts at 2e-5 for both discriminators and feature extractors and is decayed by 0.1 at 75, 150 epoch. The feature map-based loss is optimized by ADAM(Kingma & Ba, 2014) with the same mini-batch size and weight decay of 1e-1.
92
+
93
+ In tables, ‘2 Net Avg’ and ‘Ens’ represents the average accuracy of the two sub-networks and the ensemble accuracy respectively. The average ensemble is used for AFD, DML and KD while ONE uses gated ensemble of sub-networks according to its methodology.
94
+
95
+ # .1 COMPARISON WITH DIRECT FEATURE MAP ALIGNMENT METHODS
96
+
97
+ Since our goal is to distill feature map information that suits for mutual online distillation, we briefly compare our method with conventional direct alignment method in Table 1. We train two networks together, in one setting, we use the same architecture (ResNet-32 (He et al., 2016)) and in the other, we use different types (WRN-16-2, WRN-28-2 (Zagoruyko & Komodakis, 2016b)). For $L _ { 1 }$ , each network is trained not only to follow the ground-truth label by CE loss, but also to mimic the other network’s feature map using the $L _ { 1 }$ distance loss. For $L _ { 1 } +$ KD, KD (Hinton et al., 2015) loss is applied mutually along with the $L _ { 1 }$ loss between the feature maps. We also compare our results with offline method, $L 1 +$ KD (offline) employs a pre-trained network as a teacher network and distills its feature map knowledge to an untrained student network by $L 1$ loss as well as the KD loss at logit level. ResNet-32 and WRN-28-2 that shows $6 9 . 7 9 \%$ and $7 3 . 6 2 \%$ accuracy are used as the teacher networks in the two settings respectively. The results clearly show that learning the distributions of feature maps with adversarial loss performs better than direct alignment method in both mutual online distillation and offline distillation. We could observe that using $L _ { 1 }$ distance loss actually disturbs the networks to learn good features in online environment. The accuracy of ResNet-32 has dropped more than $2 \%$ compared to its vanilla version accuracy $( 6 9 . 3 8 \% )$ and the accuracy of WRN-16-2 is also lower than its vanilla network $( 7 1 . 0 7 \% )$ . Even when combined with KD loss $( L 1 + \mathrm { K D } )$ , direct alignment method shows poor performance compared to ours in both online and offline manner. Though distance loss is used in many conventional offline methods, they suffer when it comes to online environment. In case of different architecture types, our method also outperforms the direct alignment method. It indicates that when it comes to online feature map distillation, transferring feature map information with direct alignment method such as $L 1$ distance is worse than indirect distillation that uses feature map distribution via adversarial loss.
98
+
99
+ Table 1: Top-1 accuracy( $\%$ ) comparison with direct alignment methods using CIFAR-100 dataset.
100
+
101
+ <table><tr><td>Model Type</td><td colspan="2">L1</td><td colspan="2">L1+ KD</td><td colspan="3">L1+KD(offline)</td><td colspan="2">AFD</td><td colspan="2"></td><td colspan="2">Vanilla</td></tr><tr><td>Same Arch.</td><td>2 Net Avg</td><td>Ens</td><td>2 NetAvg</td><td></td><td>Ens</td><td>Student</td><td>Teacher</td><td>Ens</td><td></td><td>2 Net Avg</td><td>Ens</td><td>Net</td><td></td></tr><tr><td>ResNet-32</td><td>66.82</td><td>70.69</td><td></td><td>70.16</td><td>72.44</td><td>71.91</td><td>69.79</td><td>72.07</td><td>74.03</td><td></td><td>75.64</td><td>69.38</td><td></td></tr><tr><td>Different Arch.</td><td>Net1 Net2</td><td>Ens</td><td>Net1</td><td>Net2</td><td>Ens</td><td>Student</td><td>Teacher</td><td>Ens</td><td>Net1</td><td>Net2</td><td>Ens</td><td>Net1</td><td>Net2</td></tr><tr><td>WRN-(16-2,28-2)</td><td>69.84 73.41</td><td>74.63</td><td>72.35</td><td>74.82</td><td>75.10</td><td>73.94</td><td>73.62</td><td>76.56</td><td>75.88</td><td>77.08</td><td>77.82</td><td>71.07</td><td>73.50</td></tr></table>
102
+
103
+ Table 2: Ablation study of AFD. Top-1 accuracy $\% )$ on CIFAR-100 dataset.
104
+
105
+ <table><tr><td>Model Type</td><td colspan="3">w/o KD (Adv only)</td><td colspan="3">w/o Adv (KD only)</td><td colspan="3">Full model (AFD)</td></tr><tr><td>Same Arch.</td><td colspan="2">2 Net Avg</td><td>Ens</td><td colspan="2">2 Net Avg</td><td>Ens</td><td colspan="2">2 Net Avg</td><td>Ens</td></tr><tr><td>ResNet-32</td><td colspan="2">70.09</td><td>74.77</td><td colspan="2">73.38</td><td>75.21</td><td colspan="2">74.03</td><td>75.64</td></tr><tr><td>WRN-16-2</td><td colspan="2">71.94</td><td>75.92</td><td colspan="2">74.81</td><td>76.20</td><td colspan="2">75.33</td><td>76.34</td></tr><tr><td>Different Arch.</td><td>Net1</td><td>Net2</td><td>Ens</td><td>Net1</td><td>Net2</td><td>Ens</td><td>Net1</td><td>Net2</td><td>Ens</td></tr><tr><td>WRN-(16-2,28-2)</td><td>72.05</td><td>73.80</td><td>76.82</td><td>74.99</td><td>76.64</td><td>77.28</td><td>75.88</td><td>77.08</td><td>77.82</td></tr></table>
106
+
107
+ # 4.2 ABLATION STUDY
108
+
109
+ Table 2 shows the ablation study of our proposed method. We conduct experiments using the same and different sub-network architectures. We run three experiments with different training settings for each model case. The three settings are full model, without mutual knowledge distillation at logitlevel and without adversarial feature map distillation. When trained without the adversarial feature map distillation, the accuracy decreases in all three model cases. The accuracy of both ResNet-32 and WRN-16-2 dropped by $0 . 6 5 \%$ and $0 . 5 2 \%$ respectively, and those of (WRN-16-2, WRN-28-2) pair declined by $0 . 8 9 \%$ and $0 . 4 4 \%$ compared to the full model. Ensemble results are also lower than those of the full models. When only the adversarial feature map distillation is applied, the accuracy has increased by $0 . 7 1 \%$ and $0 . 8 7 \%$ compared to the vanilla versions of ResNet-32 and WRN-16-2 respectively. Especially in case of different sub-network architecture, the accuracy of WRN-16-2 has increased by almost $1 \%$ . Based on these experiments, we could confirm that adversarial feature map distillation has some efficacy of improving the performance in online environment.
110
+
111
+ # 4.3 SAME ARCHITECTURE
112
+
113
+ We compare our method with DML and ONE for training two sub-networks with the same architecture. The vanilla network refers to the original network trained without any distillation method. As shown in Table 3, in both ResNet and WRN serises, DML, ONE and AFD all improves the networks’ accuracy compared to the vanilla networks. However, AFD shows the highest improvement of performance in both sub-network and ensemble accuracy among the compared distillation methods. Especially in case of ResNet-20, ResNet-32 and WRN-16-2, our method significantly improves the accuracy by more than $4 \%$ compared to the vanilla version while other distillation methods improve around $3 \%$ on average except the ResNet-32 of DML.
114
+
115
+ Table 3: Top-1 accuracy $\% )$ comparison with other online distillation methods for training two same architecture networks as a pair on the CIFAR-100 dataset. The numbers in parentheses refer to the amount of increase in accuracy compared to the vanilla network.
116
+
117
+ <table><tr><td rowspan="2">Model Type</td><td colspan="2">DML</td><td colspan="2">ONE</td><td colspan="2">AFD</td><td rowspan="2">Vanila</td></tr><tr><td>2 Net Avg</td><td>Ens</td><td>2 Net Avg</td><td>Ens</td><td>2 Net Avg</td><td>Ens</td></tr><tr><td>ResNet-20</td><td>70.90(+3.42%)</td><td>72.08</td><td>70.56(+3.08%)</td><td>72.26</td><td>71.72(+4.24%)</td><td>72.98</td><td>67.48</td></tr><tr><td>ResNet-32</td><td>73.40(+4.02%)</td><td>74.89</td><td>72.61(+3.23%)</td><td>74.07</td><td>74.03(+4.65%)</td><td>75.64</td><td>69.38</td></tr><tr><td>ResNet-56</td><td>75.48(+1.64%)</td><td>76.73</td><td>76.45(+2.61%)</td><td>77.16</td><td>77.25(+3.41%)</td><td>78.35</td><td>73.84</td></tr><tr><td>WRN-16-2</td><td>74.68(+3.61%)</td><td>75.81</td><td>73.85(+2.78%)</td><td>74.84</td><td>75.33(+4.26%)</td><td>76.34</td><td>71.07</td></tr><tr><td>WRN-16-4</td><td>78.17(+2.79%)</td><td>79.06</td><td>77.32(+1.94%)</td><td>77.79</td><td>78.55(+3.17%)</td><td>79.28</td><td>75.38</td></tr><tr><td>WRN-28-2</td><td>77.02(+3.52%)</td><td>78.64</td><td>76.67(+3.17%)</td><td>77.40</td><td>77.22(+3.72%)</td><td>78.72</td><td>73.50</td></tr><tr><td>WRN-28-4</td><td>79.16(+2.56%)</td><td>80.56</td><td>79.25(+2.65%)</td><td>79.73</td><td>79.46(+2.86%)</td><td>80.65</td><td>76.60</td></tr></table>
118
+
119
+ Table 4: Top-1 accuracy $( \% )$ comparison with other online distillation methods for training two different architectures as a pair on CIFAR-100 dataset.
120
+
121
+ <table><tr><td colspan="2">Model Types</td><td colspan="3">KD</td><td colspan="3">DML</td><td colspan="3">AFD</td></tr><tr><td>Net1</td><td>Net2</td><td>Net1</td><td>Net2</td><td>Ens</td><td>Net1</td><td>Net2</td><td>Ens</td><td>Net1</td><td>Net2</td><td>Ens</td></tr><tr><td>ResNet-32</td><td>ResNet-56</td><td>72.92</td><td>76.27</td><td>76.71</td><td>73.48</td><td>76.35</td><td>76.74</td><td>74.13</td><td>76.69</td><td>77.11</td></tr><tr><td>ResNet-32</td><td>WRN-16-4</td><td>72.67</td><td>77.26</td><td>76.94</td><td>73.48</td><td>77.43</td><td>77.01</td><td>74.43</td><td>77.82</td><td>77.67</td></tr><tr><td>ResNet-56</td><td>WRN-28-4</td><td>75.48</td><td>78.91</td><td>79.23</td><td>76.03</td><td>79.32</td><td>79.38</td><td>77.95</td><td>79.21</td><td>80.01</td></tr><tr><td>ResNet-20</td><td>WRN-28-10</td><td>70.08</td><td>78.17</td><td>76.12</td><td>71.03</td><td>77.70</td><td>75.78</td><td>72.62</td><td>77.83</td><td>76.70</td></tr><tr><td>WRN-16-2</td><td>WRN-16-4</td><td>74.87</td><td>77.42</td><td>77.30</td><td>74.87</td><td>77.17</td><td>76.96</td><td>75.81</td><td>78.00</td><td>77.84</td></tr><tr><td>WRN-16-2</td><td>WRN-28-2</td><td>74.86</td><td>76.45</td><td>77.29</td><td>75.11</td><td>76.91</td><td>77.24</td><td>75.88</td><td>77.08</td><td>77.82</td></tr><tr><td>WRN-16-2</td><td>WRN-28-4</td><td>74.51</td><td>78.18</td><td>77.60</td><td>74.95</td><td>78.23</td><td>77.67</td><td>76.23</td><td>78.26</td><td>78.28</td></tr><tr><td colspan="2">Average</td><td>73.63</td><td>77.52</td><td>77.31</td><td>74.14</td><td>77.59</td><td>77.25</td><td>75.29</td><td>77.84</td><td>77.92</td></tr></table>
122
+
123
+ # 4.4 DIFFERENT ARCHITECTURE
124
+
125
+ In this section, we compare our method with DML and KD using different network architectures. We set Net2 as the higher capacity network. For KD, we use the ensemble of the two sub-networks as a teacher to mimic at every iteration. The difference with original KD (Hinton et al., 2015) is that it is an online learning method, not offline. We did not include ONE because ONE can not be applied in case where the sub-networks have different model types due to its architecture of sharing the lowlevel layers. In table 4, we could observe that our method shows better performance improvement than other methods in both Net1 and Net2 except for a couple of cases. The interesting result is that when AFD is applied, the performance of Net1 (smaller network) is improved significantly compared to other online distillation methods. This is because AFD can transfer the higher capacity network’s meaningful knowledge (feature map distribution) to the lower capacity one better than other online methods. When compared with KD and DML, AFD’s Net1 accuracy is higher by $1 . 6 6 \%$ and $1 . 1 5 \%$ and the ensemble accuracy is better by $0 . 6 1 \%$ and $0 . 6 7 \%$ on average respectively. In case of (WRN-16-2, WRN-28-4) pair, the Net1’s parameter size (0.70M) is more than 8 times smaller than Net2 (5.87M). Despite the large size difference, our method improves both networks’ accuracy, particularly our Net1 performance is better than KD and DML by $1 . 7 2 \%$ and $1 . 2 8 \%$ respectively. The performance of KD and DML seems to decline as the difference between the two model sizes gets larger. Throughout this experiment, we have shown that our method also works properly for different architectures of sub-networks even when two networks have large difference in their model sizes. Using our method, smaller network considerably benefits from the large network.
126
+
127
+ # 4.5 EXPANSION TO 3 NETWORKS
128
+
129
+ To show our method’s expandability for training more than two networks, we conduct experiment of training 3 networks in this section. As proposed in Sec 3.3, our method uses a cyclic learning framework rather than employing adversarial loss between every network pairs in order to reduce the amount of computation and memory. DML calculates the mutual knowledge distillation loss between every network pairs and uses the average of the losses. ONE generates a gated ensemble of the sub-networks and transfers the knowledge of the ensemble logit to each network. As it can be seen in Table 5, AFD outperforms the compared online distillation methods on both $3 \ \mathrm { N e t }$ average and ensemble accuracy in every model types. Comparing the results of Table 5 to that of Table 3, the overall tendency of performance gains compared to DML and ONE is maintained.
130
+
131
+ Table 5: Top-1 accuracy $\% )$ comparison with other online distillation methods using 3 networks on CIFAR-100 dataset. ’3 Net Avg’ represents the average accuracy of the 3 networks.
132
+
133
+ <table><tr><td rowspan="2">Model Type</td><td colspan="2">DML</td><td colspan="2">ONE</td><td colspan="2">AFD</td><td rowspan="2">Vanilla</td></tr><tr><td>3 Net Avg</td><td>Ens</td><td>3 Net Avg</td><td>Ens</td><td>3 Net Avg</td><td>Ens</td></tr><tr><td>ResNet-32</td><td>73.43</td><td>76.11</td><td>73.25</td><td>74.94</td><td>74.14</td><td>76.64</td><td>69.38</td></tr><tr><td>ResNet-56</td><td>76.11</td><td>77.83</td><td>76.49</td><td>77.38</td><td>77.37</td><td>79.18</td><td>73.84</td></tr><tr><td>WRN-16-2</td><td>75.15</td><td>76.93</td><td>73.87</td><td>75.26</td><td>75.65</td><td>77.54</td><td>71.07</td></tr><tr><td>WRN-28-2</td><td>77.12</td><td>79.41</td><td>76.66</td><td>77.53</td><td>77.20</td><td>79.78</td><td>73.50</td></tr></table>
134
+
135
+ Table 6: Top-1 accuracy( $\textcircled{9}$ comparison with DML on ImageNet dataset.
136
+
137
+ <table><tr><td colspan="2">Model Types</td><td colspan="3">DML</td><td colspan="3">AFD</td><td colspan="2">Vanilla</td></tr><tr><td>Net1</td><td>Net2</td><td>Net1</td><td>Net2</td><td>Ens</td><td>Net1</td><td>Net2</td><td>Ens</td><td>Net1</td><td>Net2</td></tr><tr><td>ResNet-18</td><td>ResNet-34</td><td>70.19</td><td>73.57</td><td>73.33</td><td>70.39</td><td>74.00</td><td>74.47</td><td>69.76</td><td>73.27</td></tr></table>
138
+
139
+ # 4.6 IMAGENET EXPERIMENT
140
+
141
+ We evaluate our method on ImageNet dataset to show that our method can also be applicable to a large scale image dataset. We use ImageNet LSVRC 2015 (Russakovsky et al., 2015) which has 1.2M training images and 50K validation images over 1,000 classes. We compare our method with DML using two pre-trained networks ResNet-18 and ResNet-34 as a pair. The results are after 30 epochs of training. As shown in Table 6, our method improves the networks better than DML.
142
+
143
+ # 5 CONCLUSION
144
+
145
+ We proposed an online knowledge distillation method that transfers the knowledge not only at logitlevel but also at feature map-level using the adversarial training scheme. Unlike existing online distillation methods, our method utilizes the feature map information and showed that knowledge transfer at feature map-level is possible even in an online environment. Through extensive experiments, we demonstrated the adequacy of adopting the distribution learning via adversarial training for online feature map distillation and could achieve better performance than existing online methods. We also introduced a novel cyclic learning framework for training multiple networks concurrently and presented its efficacy by comparing with existing approaches. We also confirmed that our method is broadly suitable to various architecture types from a very small network (ResNet-20) to a large (WRN-28-4) network. We hope that due to the work of our research, the area of knowledge distillation can be further advanced and studied by many researchers.
146
+
147
+ # REFERENCES
148
+
149
+ Cristian Bucilua, Rich Caruana, and Alexandru Niculescu-Mizil. Model compression. In ˇ Proceedings of the 12th ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 535–541. ACM, 2006.
150
+ Bo Dai, Sanja Fidler, Raquel Urtasun, and Dahua Lin. Towards diverse and natural image descriptions via a conditional gan. In Proceedings of the IEEE International Conference on Computer Vision, pp. 2970–2979, 2017.
151
+ 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.
152
+
153
+ 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.
154
+
155
+ Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015.
156
+
157
+ Phillip Isola, Jun-Yan Zhu, Tinghui Zhou, and Alexei A Efros. Image-to-image translation with conditional adversarial networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1125–1134, 2017.
158
+
159
+ Jangho Kim, SeongUk Park, and Nojun Kwak. Paraphrasing complex network: Network compression via factor transfer. In Advances in Neural Information Processing Systems, pp. 2760–2769, 2018.
160
+
161
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
162
+
163
+ Alex Krizhevsky, Vinod Nair, and Geoffrey Hinton. Cifar-100 (canadian institute for advanced research). URL http://www.cs.toronto.edu/˜kriz/cifar.html.
164
+
165
+ 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.
166
+
167
+ Xu Lan, Xiatian Zhu, and Shaogang Gong. Knowledge distillation by on-the-fly native ensemble. In Proceedings of the 32nd International Conference on Neural Information Processing Systems, pp. 7528–7538. Curran Associates Inc., 2018.
168
+
169
+ Hao Li, Asim Kadav, Igor Durdanovic, Hanan Samet, and Hans Peter Graf. Pruning filters for efficient convnets. arXiv preprint arXiv:1608.08710, 2016.
170
+
171
+ Peiye Liu, Wu Liu, Huadong Ma, Tao Mei, and Mingoo Seok. Ktan: knowledge transfer adversarial network. arXiv preprint arXiv:1810.08126, 2018.
172
+
173
+ Xudong Mao, Qing Li, Haoran Xie, Raymond YK Lau, Zhen Wang, and Stephen Paul Smolley. Least squares generative adversarial networks. In Proceedings of the IEEE International Conference on Computer Vision, pp. 2794–2802, 2017.
174
+
175
+ Takeru Miyato, Andrew M Dai, and Ian Goodfellow. Adversarial training methods for semisupervised text classification. arXiv preprint arXiv:1605.07725, 2016.
176
+
177
+ David Pfau and Oriol Vinyals. Connecting generative adversarial networks and actor-critic methods. arXiv preprint arXiv:1610.01945, 2016.
178
+
179
+ 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.
180
+
181
+ Adriana Romero, Nicolas Ballas, Samira Ebrahimi Kahou, Antoine Chassang, Carlo Gatta, and Yoshua Bengio. Fitnets: Hints for thin deep nets. arXiv preprint arXiv:1412.6550, 2014.
182
+
183
+ 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.
184
+
185
+ Jost Tobias Springenberg. Unsupervised and semi-supervised learning with categorical generative adversarial networks. arXiv preprint arXiv:1511.06390, 2015.
186
+
187
+ Sergey Zagoruyko and Nikos Komodakis. Paying more attention to attention: Improving the performance of convolutional neural networks via attention transfer. arXiv preprint arXiv:1612.03928, 2016a.
188
+
189
+ Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. arXiv preprint arXiv:1605.07146, 2016b.
190
+
191
+ Ying Zhang, Tao Xiang, Timothy M Hospedales, and Huchuan Lu. Deep mutual learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4320– 4328, 2018.
192
+
193
+ Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A Efros. Unpaired image-to-image translation using cycle-consistent adversarial networks. In Proceedings of the IEEE international conference on computer vision, pp. 2223–2232, 2017.
md/train/BygqBiRcFQ/BygqBiRcFQ.md ADDED
@@ -0,0 +1,612 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DIFFUSION SCATTERING TRANSFORMS ON GRAPHS
2
+
3
+ Fernando Gama
4
+ Dept. of Electrical and Systems Engineering
5
+ University of Pennsylvania
6
+ Alejandro Ribeiro
7
+ Dept. of Electrical and Systems Engineering
8
+ University of Pennsylvania
9
+ Joan Bruna
10
+ Courant Institute of Mathematical Sciences
11
+ New York University
12
+
13
+ # ABSTRACT
14
+
15
+ Stability is a key aspect of data analysis. In many applications, the natural notion of stability is geometric, as illustrated for example in computer vision. Scattering transforms construct deep convolutional representations which are certified stable to input deformations. This stability to deformations can be interpreted as stability with respect to changes in the metric structure of the domain.
16
+
17
+ In this work, we show that scattering transforms can be generalized to nonEuclidean domains using diffusion wavelets, while preserving a notion of stability with respect to metric changes in the domain, measured with diffusion maps. The resulting representation is stable to metric perturbations of the domain while being able to capture “high-frequency” information, akin to the Euclidean Scattering.
18
+
19
+ # 1 INTRODUCTION
20
+
21
+ Convolutional Neural Networks (CNN) are layered information processing architectures. Each of the layers in a CNN is itself the composition of a convolution operation with a pointwise nonlinearity where the filters used at different layers are the outcome of a data-driven optimization process (LeCun et al., 2010; 2015). Scattering transforms have an analogous layered architecture but differ from CNNs in that the convolutional filters used at different layers are not trained but selected from a multi-resolution filter bank (Mallat, 2012; Bruna & Mallat, 2013). The fact that they are not trained endows scattering transforms with intrinsic value in situations where training is impossible – and inherent limitations in the converse case. That said, an equally important value of scattering transforms is that by isolating the convolutional layered architecture from training effects it permits analysis of the fundamental properties of CNN information processing architectures. This analysis is undertaken in Mallat (2012); Bruna & Mallat (2013) where the fundamental conclusion is about the stability of scattering transforms with respect to deformations in the underlying domain that are close to translations.
22
+
23
+ In this paper we consider graphs and signals supported on graphs such as brain connectivity networks and functional activity levels (Huang et al., 2016), social networks and opinions (Jackson, 2008), or user similarity networks and ratings in recommendation systems (Huang et al., 2018). Our specific goals are: (i) To define a family of graph-scattering transforms. (ii) To define a notion of deformation for graph signals. (iii) To study the stability of graph scattering transforms with respect to this notion of deformation. To accomplish goal (i) we consider the family of graph diffusion wavelets which provide an appropriate construction of a multi-resolution filter bank (Coifman & Maggioni, 2006). Our diffusion scattering transforms are defined as the layered composition of diffusion wavelet filter banks and pointwise nonlinearities. To accomplish goal (ii) we adopt the graph diffusion distance as a measure of deformation of the underlying domain (Coifman & Lafon, 2006; Nadler et al., 2006). Diffusion distances measure the similarity of two graphs through the time it takes for a signal to be diffused on the graph. The major accomplishment of this paper is to show that the diffusion graph scattering transforms are stable with respect to deformations as measured with respect to diffusion distances. Specifically, consider a signal $\mathbf { x }$ supported on graph $G$ whose diffusion scattering transform is denoted by the operator $\Psi _ { G }$ . Consider now a deformation of the signal’s domain so that the signal’s support is now described by the graph $G ^ { \prime }$ whose diffusion scattering operator is $\Psi _ { G ^ { \prime } }$ . We show that the operator norm distance $\| \Psi _ { G } - \Psi _ { G ^ { \prime } } \|$ is bounded by a constant multiplied by the diffusion distance between the graphs $G$ and $G ^ { \prime }$ . The constant in this bound depends on the spectral gap of $G$ but, very importantly, does not depend on the number of nodes in the graph.
24
+
25
+ It is important to point out that finding stable representations is not difficult. E.g., taking signal averages is a representation that is stable to domain deformations – indeed, invariant. The challenge is finding a representation that is stable and rich in its description of the signal. In our numerical analyses we show that linear filters can provide representations that are either stable or rich but that cannot be stable and rich at the same time. The situation is analogous to (Euclidean) scattering transforms and is also associated with high frequency components. We can obtain a stable representation by eliminating high frequency components but the representation loses important signal features. Alternatively, we can retain high frequency components to have a rich representation but that representation is unstable to deformations. Diffusion scattering transforms are observed to be not only stable – as predicted by our theoretical analysis – but also sufficiently rich to achieve good performance in graph signal classification examples.
26
+
27
+ # 2 RELATED WORK
28
+
29
+ Since graph and graph signals are of increasing interest but do not have the regular structure that would make use of CNNs appealing, it is pertinent to ask the question of what should be an appropriate generalization of CNNs to graphs and the graph signals whose topology they describe (Bronstein et al., 2017). If one accepts the value of convolutions as prima facie, a natural solution is to replace convolutions with graph shift invariant filters which are known to be valid generalizations of (convolutional) time invariant filters (Bruna et al., 2014). This idea is not only natural but has been demonstrated to work well in practical implementations of Graph Neural Networks (GNNs) (Defferrard et al., 2016; Gama et al., 2019; Gilmer et al., 2017; Henaff et al., 2015; Kipf & Welling, 2017). Same as Euclidean scattering transforms, our graph scattering transforms differ from GNNs in that they do not have to be trained. The advantages and limitations of the absence of training notwithstanding, our work also sheds light on the question of why graph convolutions are appropriate generalizations of regular domain convolutions for signal classification problems. Our work suggests that the value of GNNs stems from their stability relative to deformations of the underlying domain that are close to permutations – which is the property that a pair of graphs must satisfy to have small diffusion distance.
30
+
31
+ The stability results obtained in this paper build on the notion of scattering transforms. These scattering representations were introduced by Mallat (2012) and further developed in Bruna & Mallat (2013) with computer vision applications. Since, these representations have been extended to handle transformations on more complex groups, such as roto-translations (Sifre & Mallat, 2013; Oyallon & Mallat, 2015), and to domains such as audio processing (Anden & Mallat, 2014) and quantum ´ chemistry (Eickenberg et al., 2017).
32
+
33
+ Similarly as in this work, extensions of scattering to general graphs have been considered in Chen et al. (2014) and Zou & Lerman (2018). Chen et al. (2014) focuses on Haar wavelets that hierarchically coarsen the graph, and relies on building multiresolution pairings. The recent Zou & Lerman (2018) is closest to our work. There, the authors define graph scattering using spectrally constructed wavelets from (Hammond et al., 2011), and establish some properties of the resulting representation, such as energy conservation and stability to spectral perturbations. In contrast, our stability results are established with respect to diffusion metric perturbations, which are generally weaker, in the sense that they define a weaker topology (see Section 3). We use diffusion wavelets (Coifman & Maggioni, 2006) to obtain multi-resolution graph filter banks that are localized in frequency as well as in the graph domain, while spanning the whole spectrum. Diffusion wavelets serve as the constructive basis for the obtained stability results. Our work is also closely related to recent analysis of stability of Graph Neural Networks in the context of surface representations in (Kostrikov et al., 2017). In our work, however, we do not rely on extrinsic deformations and exploit the specific multiresolution structure of wavelets.
34
+
35
+ # 3 PROBLEM SET-UP
36
+
37
+ This section introduces our framework and states the desired stability properties of signal representations defined on general non-Euclidean domains.
38
+
39
+ # 3.1 EUCLIDEAN STABILITY TO DEFORMATIONS WITH SCATTERING
40
+
41
+ Motivated by computer vision applications, our analysis starts with the notion of deformation stability. If $\mathbf { x } ( \bar { u } ) \in \bar { L ^ { 2 } } ( \Omega )$ is an image defined over an Euclidean domain $\Omega \subset \mathbb { R } ^ { d }$ , we are interested in signal representations $\Phi : L ^ { 2 } ( \bar { \Omega } ) \to \mathbb { R } ^ { K }$ that are stable with respect to small deformations. If $\mathbf { x } _ { \tau } ( \bar { u } ) : = \bar { \mathbf { x } ( } u - \tau ( u ) )$ denotes a change of variables with a differentiable field $\tau : \Omega \Omega$ such that $\| \nabla \tau \| < 1$ , then we ask
42
+
43
+ $$
44
+ \forall \mathbf { x } , \tau , \lVert \Phi ( \mathbf { x } ) - \Phi ( \mathbf { x } _ { \tau } ) \rVert \lesssim \lVert \mathbf { x } \rVert \lVert \tau \rVert , \mathrm { w i t h }
45
+ $$
46
+
47
+ $\| \tau \| : = \| \nabla \tau \| _ { \infty }$ denoting a uniform bound on the operator norm of $\nabla \tau$ . In this setting, a notorious challenge to achieving (1) while keeping enough discriminative power in $\Phi ( \mathbf { x } )$ is to transform the high-frequency content of $\mathbf { x }$ in such a way that it becomes stable.
48
+
49
+ Scattering transforms (Mallat, 2012; Bruna & Mallat, 2013) provide such representations by cascading wavelet decompositions with pointwise modulus activation functions. We briefly summarize here their basic definition. Given a mother wavelet $\psi \in L ^ { 1 } ( \Omega )$ with at least a vanishing moment $\textstyle \int { \psi ( u ) d u } = 0$ and with good spatial localization, we consider rotated and dilated versions $\psi _ { j , c } ( u ) = 2 ^ { - j d } \psi ( 2 ^ { - j } R _ { c } u )$ using scale parameter $j$ and angle $\theta \in \{ 2 \pi c / C \} _ { c = 0 , \ldots , C - 1 }$ . A wavelet decomposition operator is defined as a filter bank spanning all scales up to a cutoff $2 ^ { J }$ and all angles: $\Psi _ { J } : \bar { \mathbf { x } } \mapsto ( \mathbf { x } \ast \bar { \psi } _ { j , c } ) _ { j \leq J , c \leq C }$ . This filter bank is combined with a pointwise modulus activation function $\rho ( z ) = | z |$ , as well as a low-pass average pooling operator $U$ computing the average over the domain. The resulting representation using $m$ layers becomes
50
+
51
+ $$
52
+ \begin{array} { l l l } { \Phi ( \mathbf { x } ) } & { = } & { \left\{ S _ { 0 } ( \mathbf { x } ) , S _ { 1 } ( \mathbf { x } ) , \ldots , S _ { m - 1 } ( \mathbf { x } ) \right\} , \mathrm { w i t h } } \\ { S _ { k } ( \mathbf { x } ) } & { = } & { U \rho \Psi _ { J } \rho \ldots \Psi _ { J } \mathbf { x } = \{ U ( | | \mathbf { x } * \psi _ { \alpha _ { 1 } } | * \psi _ { \alpha _ { 2 } } | \ldots * \psi _ { \alpha _ { k } } | ) ; \} _ { \alpha _ { 1 } , \ldots , \alpha _ { k } } ( k = 0 , \ldots , m - 1 ) } \end{array}
53
+ $$
54
+
55
+ The resulting signal representation has the structure of a CNN, in which feature maps are not recombined with each other, and trainable filters are replaced by multiscale, oriented wavelets. It is shown in Mallat (2012) that for appropriate signal classes and wavelet families, the resulting scattering transform satisfies a deformation stablity condition of the form (1), which has been subsequently generalised to broader multiresolution families (Wiatowski & Bolcskei, 2018). In essence, ¨ the mechanism that provides stability is to capture high-frequency information with the appropriate spatio-temporal tradeoffs, using spatially localized wavelets.
56
+
57
+ # 3.2 DEFORMATIONS AND METRIC STABILITY
58
+
59
+ Whereas deformations provide the natural framework to describe geometric stability in Euclidean domains, their generalization to non-Euclidean, non-smooth domains is not straightforward. Let $\mathbf { x } \in L ^ { 2 } ( \mathcal { X } )$ . If $\mathcal { X }$ is embedded into a low-dimension Euclidean space $\Omega \subset \overline { { \mathbb { R } } } ^ { d }$ , such as a 2- surface within a three-dimensional space, then one can still define meaningful deformations on $\mathcal { X }$ via extrinsic deformations of $\Omega$ (Kostrikov et al., 2017).
60
+
61
+ However, in this work we are interested in intrinsic notions of geometric stability, that do not necessarily rely on a pre-existent low-dimensional embedding of the domain. The change of variables $\varphi ( u ) = u - \tau ( u )$ defining the deformation can be seen as a perturbation of the Euclidean metric in $L ^ { 2 } ( \mathbb { R } ^ { d } )$ . Indeed,
62
+
63
+ $$
64
+ \langle \mathbf { x } _ { \tau } , \mathbf { y } _ { \tau } \rangle _ { L ^ { 2 } ( \mathbb { R } ^ { d } , \mu ) } = \int _ { \mathbb { R } ^ { d } } \mathbf { x } _ { \tau } ( u ) \mathbf { y } _ { \tau } ( u ) d \mu ( u ) = \int _ { \mathbb { R } ^ { d } } \mathbf { x } ( u ) \mathbf { y } ( u ) | I - \nabla \tau ( u ) | d \mu ( u ) = \langle \mathbf { x } , \mathbf { y } \rangle _ { L ^ { 2 } ( \mathbb { R } ^ { d } , \tilde { \mu } ) } ,
65
+ $$
66
+
67
+ with $d \tilde { \mu } ( u ) = | I - \nabla \tau ( u ) | d \mu ( u )$ , and $| I - \nabla \tau ( u ) | \approx 1$ if $\| \nabla \tau \|$ is small, where $I$ is the identity. Therefore, a possible way to extend the notion of deformation stability to general domains $L ^ { 2 } ( \dot { \mathcal { X } } )$ is to think of $\mathcal { X }$ as a metric space and reason in terms of stability of $\bar { \Phi } : \bar { L ^ { 2 } } ( \mathcal { X } ) \to \mathbb { R } ^ { K }$ to metric changes in $\mathcal { X }$ . This requires a representation that can be defined on generic metric spaces, as well as a criteria to compare how close two metric spaces are.
68
+
69
+ # 3.3 DIFFUSION WAVELETS AND METRICS ON GRAPHS
70
+
71
+ Graphs are flexible data structures that enable general metric structures and modeling non-Euclidean domains. The main ingredients of the scattering transform can be generalized using tools from computational harmonic analysis on graphs. We note that, unlike the case of Euclidean domains, where deformations are equivalent whether they are analyzed from the function domain or its image, in the case of graphs, we focus on deformations on the underlying graph domain, while keeping the same function mapping (i.e. we model deformations as a change of the underlying graph support and analyze how this affects the interaction between the function mapping and the graph).
72
+
73
+ In particular, diffusion wavelets (Coifman & Maggioni, 2006) provide a simple framework to define a multi-resolution analysis from powers of a diffusion operator defined on a graph. A weighted, undirected graph $G = ( V , E , W )$ with $| V | = n$ nodes, edge set $E$ and adjacency matrix $W \in \mathbb { R } ^ { n \times n }$ defines a diffusion process $A$ in its nodes, given in its symmetric form by the normalized adjacency
74
+
75
+ $$
76
+ A : = D ^ { - 1 / 2 } W D ^ { - 1 / 2 } , \mathrm { w i t h } D = \mathrm { d i a g } ( d _ { 1 } , \dots , d _ { n } ) ,
77
+ $$
78
+
79
+ where $\begin{array} { r } { d _ { i } = \sum _ { ( i , j ) \in E } W _ { i , j } } \end{array}$ denotes the degree of node $i$ . Denote by $\mathbf { d } = W \mathbf { 1 }$ the degree vector containing $d _ { i }$ in the ith element. By construction, $A$ is well-localized in space (it is nonzero only where there is an edge connecting nodes), it is self-adjoint and satisfies $\| A \| \leq 1$ , where $\| A \|$ is the operator norm. Let √ √ $\lambda _ { 0 } \geq \lambda _ { 1 } \geq . . . \lambda _ { n - 1 }$ denote its eigenvalues in decreasing order. Defining ${ \bf d } ^ { 1 / 2 } = ( \sqrt { d _ { 1 } } , \dots , \sqrt { d _ { n } } )$ , one can easily verify that the normalized squared root degree vector $\mathbf { v } = \mathbf { d } ^ { 1 / 2 } / \lVert \mathbf { d } ^ { 1 / 2 } \rVert _ { 2 } = \mathbf { d } / \lVert \mathbf { d } \rVert _ { 1 }$ is the eigenvector with associated eigenvalue $\lambda _ { 0 } = 1$ . Also, note that $\lambda _ { n - 1 } = - 1$ if and only if $G$ has a connected component that is non-trivial and bipartite (Chung, 1997).
80
+
81
+ In the following, it will be convenient to assume that the spectrum of $A$ (which is real and discrete since $A$ is self-adjoint and in finite-dimensions) is non-negative. Since we shall be taking powers of $A$ , this will avoid folding negative eigenvalues into positive ones. For that purpose, we adopt the so-called lazy diffusion, given by $T = { \frac { 1 } { 2 } } ( I + A )$ . In Section 4 we use this diffusion operator to define both a multiscale wavelet filter bank and a low-pass average pooling, leading to the diffusion scattering representation.
82
+
83
+ This diffusion operator can also be used to construct a metric on $G$ . The so-called diffusion distances (Coifman & Lafon, 2006; Nadler et al., 2006) measure distances between two nodes $x , x ^ { \prime } \in V$ in terms of their associated diffusion at time $s$ : $d _ { G , s } ( x , x ^ { \prime } ) = \Vert T _ { G } ^ { s } \delta _ { x } - T _ { G } ^ { s } \delta _ { x ^ { \prime } } \Vert$ , where $\delta _ { x }$ is a vector with all zeros except a 1 in position $x$ .
84
+
85
+ In this work, we build on this diffusion metric to define a distance between two graphs $G , G ^ { \prime }$ . Assuming first that $G$ and $G ^ { \prime }$ have the same size, the simplest formulation is to compare the diffusion metric generated by $G$ and $G ^ { \prime }$ up to a node permutation:
86
+
87
+ Definition 3.1. Let $G = ( V , E , W )$ , $G ^ { \prime } = ( V ^ { \prime } , E ^ { \prime } , W ^ { \prime } )$ have the same size $| V | = | V ^ { \prime } | = n$ . The normalized diffusion distance between graphs $G$ , $G ^ { \prime }$ at time $s > 0$ is
88
+
89
+ $$
90
+ \mathrm { d } ^ { s } ( G , G ^ { \prime } ) : = \operatorname* { i n f } _ { \Pi \in \Pi _ { n } } \Vert ( T _ { G } ^ { s } ) ^ { * } ( T _ { G } ^ { s } ) - \Pi ^ { \boldsymbol { \mathsf { T } } } ( T _ { G ^ { \prime } } ^ { s } ) ^ { * } ( T _ { G ^ { \prime } } ^ { s } ) \Pi \Vert = \operatorname* { i n f } _ { \Pi \in \Pi _ { n } } \Vert T _ { G } ^ { 2 s } - \Pi ^ { \boldsymbol { \mathsf { T } } } T _ { G ^ { \prime } } ^ { 2 s } \Pi \Vert ,
91
+ $$
92
+
93
+ where $\Pi _ { n }$ is the space of $n \times n$ permutation matrices.
94
+
95
+ The diffusion distance is defined at a specific time $s$ . As $s$ increases, this distance becomes weaker1, since it compares points at later stages of diffusion. The role of time is thus to select the smoothness of the ‘graph deformation’, similarly as $\| \nabla \tau \|$ measures the smoothness of the deformation in the Euclidean case. For convenience, we denote $\operatorname { d } ( G , G ^ { \prime } ) = \mathrm { d } ^ { 1 / 2 } ( G , G ^ { \prime } )$ and use the distance at $s =$ $1 / 2$ as our main deformation measure. The quantity d defines a distance between graphs (seen as metric spaces) yielding a stronger topology than other alternatives such as the Gromov-Hausdorff distance, defined as
96
+
97
+ $$
98
+ d _ { \mathrm { G H } } ^ { s } ( G , G ^ { \prime } ) = \operatorname* { i n f } _ { \Pi } \operatorname* { s u p } _ { x , x ^ { \prime } \in V } | d _ { G } ^ { s } ( x , x ^ { \prime } ) - d _ { G ^ { \prime } } ^ { s } ( \pi ( x ) , \pi ( x ^ { \prime } ) ) |
99
+ $$
100
+
101
+ with $d _ { G } ^ { s } ( x , x ^ { \prime } ) = \lVert T _ { G } ^ { t } ( \delta _ { x } - \delta _ { x ^ { \prime } } ) \rVert _ { L ^ { 2 } ( G ) }$ . We choose $\mathrm { d } ( G , G ^ { \prime } )$ in this work for convenience and mathematical tractability, but leave for future work the study of stability relative to $d _ { \mathrm { G H } } ^ { s }$ . Finally,
102
+
103
+ we consider for simplicity only the case where the sizes of $G$ and $G ^ { \prime }$ are equal, but definition (3.1) can be naturally extended to compare variable-sized graphs by replacing permutations by softcorrespondences (see Bronstein et al., 2010).
104
+
105
+ # 3.4 PROBLEM STATEMENT
106
+
107
+ Our goal is to build a stable and rich representation $\Phi _ { G } ( \mathbf { x } )$ . The stability property is stated in terms of the diffusion metric above: For a chosen diffusion time $s , \forall \textbf { x } \in \mathbb { R } ^ { n }$ , $G = ( V , E , W ) , G ^ { \prime } =$ $( V ^ { \prime } , E ^ { \prime } , W ^ { \prime } )$ with $| V | = | V ^ { \prime } | = n$ , we want
108
+
109
+ $$
110
+ \begin{array} { r } { \| \Phi _ { G } ( \mathbf { x } ) - \Phi _ { G ^ { \prime } } ( \mathbf { x } ) \| \lesssim \| \mathbf { x } \| \mathrm { d } ^ { s } ( G , G ^ { \prime } ) . } \end{array}
111
+ $$
112
+
113
+ This representation can be used to model both signals and domains, or just domains $G$ , by considering a prespecified $\mathbf { x } = f ( G )$ , such as the degree, or by marginalizing from an exchangeable distribution, $\Phi _ { G } = \mathbb { E } _ { \mathbf { x } \sim Q } \Phi _ { G } ( \mathbf { x } )$ .
114
+
115
+ The motivation of (5) is two-fold: On the one hand, we are interested in applications where the signal of interest may be measured in dynamic environments that modify the domain, e.g. in measuring brain signals across different individuals. On the other hand, in other applications, such as building generative models for graphs, we may be interested in representing the domain $G$ itself. A representation from the adjacency matrix of $G$ needs to build invariance to node permutations, while capturing enough discriminative information to separate different graphs. In particular, and similarly as with Gromov-Hausdorff distances, the definition of $\mathrm { d } ( G , G ^ { \prime } )$ involves a matching problem between two kernel matrices, which defines an NP-hard combinatorial problem. This further motivates the need for efficient representations of graphs $\Phi _ { G }$ that can efficiently tell apart two graphs, and such that $\ell ( \theta ) = \| \Phi _ { G } - \Phi _ { G ( \theta ) } \|$ can be used as a differentiable loss for training generative models.
116
+
117
+ # 4 GRAPH DIFFUSION SCATTERING
118
+
119
+ Let $T$ be a lazy diffusion operator associated with a graph $G$ of size $n$ such as those described in Section 3.3. Following Coifman & Maggioni (2006), we construct a family of multiscale filters by exploiting the powers of the diffusion operator $T ^ { 2 ^ { j } }$ . We define
120
+
121
+ $$
122
+ \psi _ { 0 } : = I - T , \psi _ { j } : = T ^ { 2 ^ { j - 1 } } ( I - { T ^ { 2 ^ { j - 1 } } } ) = { T ^ { 2 ^ { j - 1 } } } - { T ^ { 2 ^ { j } } } , ( j > 0 ) .
123
+ $$
124
+
125
+ This corresponds to a graph wavelet filter bank with optimal spatial localization. Graph diffusion wavelets are localized both in space and frequency, and favor a spatial localization, since they can be obtained with only two filter coefficients, namely $h _ { 0 } ~ = ~ 1$ for diffusion $T ^ { 2 ^ { j - 1 } }$ and $h _ { 1 } ~ = ~ - 1$ for diffusion $T ^ { 2 ^ { j } }$ . The finest scale $\psi _ { 0 }$ corresponds to one half of the normalized Laplacian operator $\psi _ { 0 } = ( 1 / 2 ) \Delta = 1 / 2 ( I - D ^ { - 1 / 2 } W D ^ { - 1 / 2 } )$ , here seen as a temporal difference in a diffusion process, seeing each diffusion step (each multiplication by $\Delta$ ) as a time step. The coarser scales $\psi _ { j }$ capture temporal differences at increasingly spaced diffusion times. For $j = 0 , \ldots , J _ { n } - 1$ , we consider the linear operator
126
+
127
+ $$
128
+ \begin{array} { r c l } { \Psi : L ^ { 2 } ( G ) } & { \to } & { ( L ^ { 2 } ( G ) ) ^ { J _ { n } } } \\ { \mathbf { x } } & { \mapsto } & { ( \psi _ { j } \mathbf { x } ) _ { j = 0 , \ldots , J _ { n } - 1 } , } \end{array}
129
+ $$
130
+
131
+ which is the analog of the wavelet filter bank in the Euclidean domain. Whereas several other options exist to define graph wavelet decompositions (Rustamov & Guibas, 2013; Gavish et al., 2010), and GNN designs that favor frequency localization, such as Cayley filters (Levie et al., 2019), we consider here wavelets that can be expressed with few diffusion terms, favoring spatial over frequential localization, for stability reasons that will become apparent next. We choose dyadic scales for convenience, but the construction is analogous if one replaces scales $2 ^ { j }$ by $\lceil \gamma ^ { j } \rceil$ for any $\gamma > 1$ in (6).
132
+
133
+ If the graph $G$ exhibits a spectral gap, i.e., $\beta _ { G } = \operatorname* { s u p } _ { i = 1 , \dots n - 1 } | \lambda _ { i } | < 1$ , the following proposition proves that the linear operator $\Psi$ defines a stable frame.
134
+
135
+ Proposition 4.1. For each $n$ , let $\Psi$ define the diffusion wavelet decomposition (7) and assume $\beta _ { G } < 1$ . Then there exists a constant $0 < C ( \beta )$ depending only on $\beta$ such that for any $\mathbf { x } \in \mathbb { R } ^ { n }$
136
+
137
+ satisfying $\langle \mathbf { x } , \mathbf { v } \rangle = 0$ ,
138
+
139
+ $$
140
+ C ( \boldsymbol { \beta } ) \| \mathbf { x } \| ^ { 2 } \leq \sum _ { j = 0 } ^ { J _ { n } - 1 } \| \psi _ { j } \mathbf { x } \| ^ { 2 } \leq \| \mathbf { x } \| ^ { 2 } .
141
+ $$
142
+
143
+ This proposition thus provides the Littlewood-Paley bounds of $\Psi$ , which control the ability of the filter bank to capture and amplify the signal $\mathbf { x }$ along each ‘frequency’ (i.e. the ability of the filter to increase or decrease the energy of the representation, relative to the energy of the $\mathbf { x }$ ). We note that diffusion wavelets are neither unitary nor analytic and therefore do not preserve energy. However, the frame bounds in Proposition 4.1 provide lower bounds on the energy lost, such that the smaller $1 - \ \beta$ is, the less “unitary” our diffusion wavelets are. It also informs us about how the spectral gap $\beta$ determines the appropriate diffusion scale $J$ : The maximum of $p ( u ) = ( u ^ { r } - u ^ { 2 r } ) ^ { 2 }$ is at $u = 2 ^ { - 1 / r }$ , thus the cutoff $r _ { * }$ should align with $\beta$ as $\begin{array} { r } { r _ { * } = \frac { - 1 } { \log _ { 2 } \beta } } \end{array}$ −1log β , since larger values of r capture energy in a spectral range where the graph has no information. Therefore, the maximum scale can be adjusted as $\begin{array} { r } { J = \lceil 1 + \log _ { 2 } r _ { * } \rceil = 1 + \left\lceil \log _ { 2 } \left( \frac { - 1 } { \log _ { 2 } \beta } \right) \right\rceil } \end{array}$ .
144
+
145
+ Recall that the Euclidean Scattering transform is constructed by cascading three building blocks: a wavelet decomposition operator, a pointwise modulus activation function, and an averaging operator. Following the Euclidean scattering, given a graph $G$ and $\mathbf { x } \in L ^ { 2 } ( G )$ , we define an analogous Diffusion Scattering transform $\Phi _ { G } ( \mathbf { x } )$ by cascading three building blocks: the Wavelet decomposition operator $\Psi$ , a pointwise activation function $\rho$ , and an average operator $U$ which extracts the average over the domain. The average over a domain can be interpreted as the diffusion at infinite time, thus $U \mathbf { x } = \operatorname* { l i m } _ { t \to \infty } T ^ { t } \mathbf { x } = \langle \mathbf { v } ^ { \mathsf { T } } , \mathbf { x } \rangle$ . More specifically, we consider a first layer transformation given by
146
+
147
+ $$
148
+ \phi _ { 1 } ( G , { \bf x } ) = U \rho \Psi \bf x = \{ U \rho \psi _ { \boldsymbol \rho } \bf x \} _ { 0 \leq { j \leq J _ { n } - 1 } } \ ,
149
+ $$
150
+
151
+ followed by second order coefficients
152
+
153
+ $$
154
+ \phi _ { 2 } ( G , { \bf x } ) = U \rho \Psi \rho \Psi { \bf x } = \{ U \rho \psi _ { j _ { 2 } } \rho \psi _ { j _ { 1 } } { \bf x } \} _ { 0 \leq j _ { 1 } , j _ { 2 } \leq J _ { n } - 1 } , ,
155
+ $$
156
+
157
+ and so on. The representation obtained from $m$ layers of such transformation is thus
158
+
159
+ $$
160
+ \Phi _ { G } ( { \bf x } ) = \left\{ U x , \phi _ { 1 } ( G , { \bf x } ) , \ldots , \phi _ { m - 1 } ( G , { \bf x } ) \right\} = \left\{ U ( \rho \Psi ) ^ { k } { \bf x } ; k = 0 , \ldots , m - 1 \right\} .
161
+ $$
162
+
163
+ # 5 STABILITY OF GRAPH DIFFUSION SCATTERING
164
+
165
+ # 5.1 STABILITY AND EQUIVARIANCE OF DIFFUSION WAVELETS
166
+
167
+ Given two graphs $G , G ^ { \prime }$ of size $n$ and a signal $\mathbf { x } \in \mathbb { R } ^ { n }$ , our objective is to bound $\left\| \Phi _ { G } ( \mathbf { x } ) - \Phi _ { G ^ { \prime } } ( \mathbf { x } ) \right\|$ in terms of $\mathrm { d } ( G , G ^ { \prime } )$ . Let $\pi _ { * }$ the permutation minimising the distortion between $G$ and $G ^ { \prime }$ in (4). Since all operations in $\Phi$ are either equivariant or invariant with respect to permutations, we can assume w.l.o.g. that $\pi = 1$ , so that the diffusion distance can be directly computed by comparing nodes with the given order. A key property of $G$ that drives the stability of the diffusion scattering is given by its spectral gap $1 - \beta _ { G } = 1 - \operatorname* { s u p } _ { i = 1 , \dots n - 1 } | \lambda _ { i } | \geq 0$ . In the following, we use $\ell _ { 2 }$ operator norms, unless stated otherwise.
168
+
169
+ Lemma 5.1. Assume $\beta : = \operatorname* { m a x } ( \beta _ { G } , \beta _ { G ^ { \prime } } ) < 1$ . Then
170
+
171
+ $$
172
+ \operatorname* { i n f } _ { \Pi \in \Pi _ { n } } \| \Psi _ { G } - \Pi \Psi _ { G ^ { \prime } } \Pi ^ { \mathsf { T } } \| \leq 2 \mathrm { d } ( G , G ^ { \prime } ) \sqrt { \frac { \beta ^ { 2 } ( 1 + \beta ^ { 2 } ) } { ( 1 - \beta ^ { 2 } ) ^ { 3 } } } .
173
+ $$
174
+
175
+ Remark: If diffusion distance is measured at time different from $s = 1 / 2$ , the stability bound would be modified due to scales $j$ such that $2 ^ { j } < s$ .
176
+
177
+ The following lemma studies the stability of the low-pass operator $U$ with respect to graph perturbations.
178
+
179
+ Lemma 5.2. Let $G , G ^ { \prime }$ be two graphs with same size, denote by v and $\mathbf { v } ^ { \prime }$ their respective squaredroot degree vectors, and by $\beta , \beta ^ { \prime }$ their spectral gap. Then
180
+
181
+ $$
182
+ \operatorname* { i n f } _ { \Pi \in \Pi _ { n } } \| \mathbf { v } - \Pi \mathbf { v } ^ { \prime } \| ^ { 2 } \leq 2 \frac { \mathrm { d } ( G , G ^ { \prime } ) } { 1 - \operatorname* { m i n } ( \beta , \beta ^ { \prime } ) } .
183
+ $$
184
+
185
+ Spectral Gap asymptotic behavior Lemmas 5.1 and 5.2 leverage the spectral gap of the lazy diffusion operator associated with $G$ . In some cases, such as regular graphs, the spectral gap vanishes asymptotically as $n \to \infty$ , thus degrading the upper bound asymptotically. Improving the bound by leveraging other properties of the graph (such as regular degree distribution) is an important open task.
186
+
187
+ # 5.2 STABILITY AND INVARIANCE OF DIFFUSION SCATTERING
188
+
189
+ The scattering transform coefficients $\Phi _ { G } ( \mathbf { x } )$ obtained after $m$ layers are given by equation 11, for low-pass operator $U$ such that $U \mathbf { x } = \langle \mathbf { v } , \mathbf { x } \rangle$ so that $U = \mathbf { v } ^ { \mathsf { T } }$ .
190
+
191
+ From Lemma 5.1 we have that, $\| \Psi _ { G } - \Psi _ { G ^ { \prime } } \| \leq \varepsilon _ { \Psi } = 2 \mathrm { d } ( G , G ^ { \prime } ) \sqrt { \beta ^ { 2 } ( 1 + \beta ^ { 2 } ) / ( 1 - \beta ^ { 2 } ) ^ { 3 } }$ . We also know, from Proposition 4.1 that $\Psi$ conforms a frame, i.e. $C ( \beta ) \| \mathbf { x } \| ^ { 2 } \leq \| \Psi \mathbf { x } \| ^ { 2 } \leq \| \mathbf { x } \| ^ { 2 }$ fo r known constant $C ( \beta )$ given in Prop. 4.1. Additionally, from Lemma 5.2 we get that $\left\| U _ { G } - U _ { G ^ { \prime } } \right\| \leq$ $\varepsilon _ { U } = 2 \mathrm { d } ( G , G ^ { \prime } ) / ( 1 - \operatorname* { m i n } ( \beta , \beta ^ { \prime } ) )$ .
192
+
193
+ The objective now is to prove stability of the scattering coefficients $\Phi _ { G } ( \mathbf { x } )$ , that is, to prove that
194
+
195
+ $$
196
+ \begin{array} { r } { \| \Phi _ { G } ( \mathbf { x } ) - \Phi _ { G ^ { \prime } } ( \mathbf { x } ) \| \lesssim \mathrm { d } ( G , G ^ { \prime } ) \| \mathbf { x } \| . } \end{array}
197
+ $$
198
+
199
+ This is captured in the following Theorem:
200
+
201
+ Theorem 5.3. Let $G , G ^ { \prime }$ be two graphs and let $\mathrm { d } ( G , G ^ { \prime } )$ be their distance measured as in equation 4. Let $T _ { G }$ and $T _ { G ^ { \prime } }$ be the respective diffusion operators. Denote by $U _ { G } , \rho _ { G }$ and $\Psi _ { G }$ and by $U _ { G ^ { \prime } } , \rho _ { G ^ { \prime } }$ and $\Psi _ { G ^ { \prime } }$ the low pass operator, pointwise nonlinearity and the wavelet filter bank used on the scattering transform defined on each graph, respectively, cf. equation $1 l$ . Assume $\rho _ { G } = \rho _ { G ^ { \prime } }$ and that $\rho _ { G }$ is non-expansive. Let $\beta _ { - } = \operatorname* { m i n } ( \beta _ { G } , \beta _ { G ^ { \prime } } )$ , $\beta _ { + } = \operatorname* { m a x } ( \beta _ { G } , \beta _ { G ^ { \prime } } )$ and assume $\beta _ { + } < 1$ . Then, we have that, for each $k = 0 , \ldots , m - 1$ , the following holds
202
+
203
+ $$
204
+ \| U _ { G } ( \rho _ { G } \Psi _ { G } ) ^ { k } - U _ { G ^ { \prime } } ( \rho _ { G ^ { \prime } } \Psi _ { G ^ { \prime } } ) ^ { k } \| \leq \left( \frac { 2 } { 1 - \beta _ { - } } \mathrm { d } ( G , G ^ { \prime } ) \right) ^ { 1 / 2 } + k \sqrt { \frac { \beta _ { + } ^ { 2 } ( 1 + \beta _ { + } ^ { 2 } ) } { ( 1 - \beta _ { + } ^ { 2 } ) ^ { 3 } } } \mathrm { d } ( G , G ^ { \prime } ) .
205
+ $$
206
+
207
+ Defining forward t $\begin{array} { r } { \| \Phi _ { G } ( \mathbf { x } ) \| ^ { 2 } = \sum _ { k = 0 } ^ { m - 1 } \| U _ { G } ( \rho _ { G } \Psi _ { G } ) ^ { k } \| ^ { 2 } } \end{array}$ analogously to Bruna & Mallat (2013), it is straight-cattering coefficients as follows.
208
+
209
+ Corollary 5.4. In the context of Theorem 5.3, let $\mathbf { x } \in \mathbb { R } ^ { n }$ and let $\Phi _ { G } ( \mathbf { x } )$ be the scattering coefficients computed by means of equation $_ { l I }$ on graph $G$ after $m$ layers, and let $\ { \Phi } _ { G ^ { \prime } } ( { \bf x } )$ be the corresponding coefficients on graph $G ^ { \prime }$ . Then,
210
+
211
+ $$
212
+ \begin{array} { r l } & { \| \Phi _ { G } ( \mathbf { x } ) - \Phi _ { G ^ { \prime } } ( \mathbf { x } ) \| ^ { 2 } \leq \displaystyle \sum _ { k = 0 } ^ { m - 1 } \bigg [ \bigg ( \frac { 2 } { 1 - \beta _ { - } } \mathrm { d } ( G , G ^ { \prime } ) \bigg ) ^ { 1 / 2 } + k \sqrt { \frac { \beta _ { + } ^ { 2 } ( 1 + \beta _ { + } ^ { 2 } ) } { ( 1 - \beta _ { + } ^ { 2 } ) ^ { 3 } } } \mathrm { d } ( G , G ^ { \prime } ) \bigg ] ^ { 2 } \| \mathbf { x } \| ^ { 2 } } \\ & { \| \Phi _ { G } ( \mathbf { x } ) - \Phi _ { G ^ { \prime } } ( \mathbf { x } ) \| \lesssim m ^ { 1 / 2 } \mathrm { d } ^ { 1 / 2 } ( G , G ^ { \prime } ) \| \mathbf { x } \| ~ i f \mathrm { d } ( G , G ^ { \prime } ) \ll 1 . } \end{array}
213
+ $$
214
+
215
+ Corollary 5.4 satisfies equation 5. It also shows that the closer the graphs are in terms of the diffusion metric, the closer their scattering representations will be. The constant is given by topological properties, the spectral gaps of $G$ and $G ^ { \prime }$ , as well as design parameters, the number of layers $m$ . We observe that the stability bound grows the smaller the spectral gap is and also as more layers are considered. The spectral gap is tightly linked with diffusion processes on graphs, and thus it does emerge from the choice of a diffusion metric. Graphs with values of beta closer to 1, exhibit weaker diffusion paths, and thus a small perturbation on the edges of these graphs would lead to a larger diffusion distance. The contrary holds as well. In other words, the tolerance of the graph to edge perturbations (i.e., $\mathrm { d } ( G , G )$ being small) depends on the spectral gap of the graph. We also note that, as stated at the end of Section 5.1, the spectral gap appears in our upper bounds, but it is not necessarily sharp. In particular, the spectral gap is a poor indication of stability in regular graphs, and we believe our bound can be improved by leveraging structural properties of regular domains.
216
+
217
+ Finally, we note that the size of the graphs impacts the stability result inasmuch as it impacts the distance measure $\mathrm { d } ( G , G ^ { \prime } )$ . This is expected, since graphs of different size can be compared, as mentioned in Section 3.3. Different from Zou & Lerman (2018), our focus is on obtaining graph wavelet banks that are localized in the graph domain to improve computational efficiency as discussed in Defferrard et al. (2016). We also notice that the scattering transform in Zou & Lerman (2018) is stable with respect to a graph measure that depends on the spectrum of the graph through both eigenvectors and eigenvalues. More specifically, it is required that the spectrum gets concentrated as the graphs grow. However, in general, it is not straightforward to relate the topological structure of the graph with its spectral properties.
218
+
219
+ As mentioned in Section 3.3, the stability is computed with a metric $\mathrm { d } ( G , G ^ { \prime } )$ which is stronger than what could be hoped for. Our metric is permutation-invariant, in analogy with the rigid translation invariance in the Euclidean case, and stable to small perturbations around permutations. The extension of (16) to weaker metrics, using e.g. multiscale deformations, is left for future work.
220
+
221
+ # 5.3 FROM DIFFUSION SCATTERING TO DIFFUSION GNNS
222
+
223
+ By denoting $T _ { j } \ = \ T ^ { 2 ^ { j } }$ , observe that one can approximate the diffusion wavelets from (6) as a cascade of low-pass diffusions followed by a high-pass filter at resolution $2 ^ { j }$ :
224
+
225
+ $$
226
+ \psi _ { j } = T _ { j - 1 } ( I - T _ { j - 1 } ) \approx T ^ { \sum _ { j ^ { \prime } < j - 1 } 2 ^ { j ^ { \prime } } } ( I - T _ { j - 1 } ) = \left( \prod _ { j ^ { \prime } < j - 1 } T _ { j ^ { \prime } } \right) ( I - T _ { j - 1 } ) .
227
+ $$
228
+
229
+ This pyramidal structure of multi-resolution analysis wavelets — in which each layer now corresponds to a different scale, shows that the diffusion scattering is a particular instance of GNNs where each layer $j$ is generated by the pair of operators $\{ I , T _ { j - 1 } \}$ . If $\mathbf { x } ^ { ( j ) } \in \mathbb { R } ^ { n \times d _ { j } }$ denotes the feature representation at layer $j$ using $d _ { j }$ feature maps per node, the corresponding update is given by
230
+
231
+ $$
232
+ \mathbf { x } ^ { ( j + 1 ) } = \rho \left( \mathbf { x } ^ { ( j ) } \theta _ { 1 } ^ { ( j ) } + T _ { j - 1 } \mathbf { x } ^ { ( j ) } \theta _ { 2 } ^ { ( j ) } \right) ,
233
+ $$
234
+
235
+ where $\theta _ { 1 } ^ { ( j ) } , \theta _ { 2 } ^ { ( j ) }$ are $d _ { j } \times d _ { j + 1 }$ weight matrices. In this case, a simple modification of the previous theorem shows that the resulting GNN representation $\Phi _ { G } ( \mathbf { x } , \Theta )$ , $\Theta = ( \theta _ { 1 } ^ { ( j ) } , \theta _ { 2 } ^ { ( j ) } ) _ { j \le J }$ is also stable with respect to $\mathrm { d } ( G , G ^ { \prime } )$ , albeit this time the constants are parameter-dependent:
236
+
237
+ Corollary 5.5. The $J$ layer GNN with parameters $\Theta = ( \theta _ { 1 } ^ { ( j ) } , \theta _ { 2 } ^ { ( j ) } ) _ { j \le J }$ satisfies
238
+
239
+ $$
240
+ \| \Phi _ { G } ( \mathbf { x } , \Theta ) - \Phi _ { G ^ { \prime } } ( \mathbf { x } , \Theta ) \| \le \mathrm { d } ( G , G ^ { \prime } ) \frac { \| \mathbf { x } \| } { 1 - \beta } \left[ \prod _ { j \le J } ( 1 + \| \theta _ { 1 } ^ { ( j ) } \| + \| \theta _ { 2 } ^ { ( j ) } \| ) \right] ^ { 2 } .
241
+ $$
242
+
243
+ This bound is thus learning-agnostic and is proved by elementary application of the diffusion distance definition. An interesting question left for future work is to relate such stability to gradient descent optimization biases, similarly as in (Gunasekar et al., 2018; Wei et al., 2018), which could provide stability certificates for learnt GNN representations.
244
+
245
+ # 6 NUMERICAL EXPERIMENTS
246
+
247
+ In this section, we first show empirically the dependence of the stability result with respect to the spectral gap, and then we illustrate the discriminative power of the diffusion scattering transform in two different classification tasks; namely, the problems of authorship attribution and source localization.
248
+
249
+ Consider a small-world graph $G$ with $N = 2 0 0$ nodes, edge probability $p _ { \mathsf { S W } }$ and rewiring probability $q _ { \mathrm { S W } } = 0 . 1$ . Let $\mathbf { x } \sim \mathcal { N } ( 0 , \mathbf { I } )$ be a random graph signal defined on top of $G$ and $\Phi _ { G } ( \mathbf { x } )$ the corresponding scattering transform. Let $G ^ { \prime }$ be another realization of the small-world graph, and let $\Phi _ { G ^ { \prime } } ( \mathbf { x } )$ be the scattering representation of the same graph signal $\mathbf { x }$ but on the different support $G ^ { \prime }$ . We can then proceed to compute $\left\| \Phi _ { G } ( \mathbf { x } ) - \Phi _ { G ^ { \prime } } ( \mathbf { x } ) \right\|$ . By changing the value of $p _ { \mathrm { { S W } } }$ we can change value of the spectral gap $\beta$ and study the dependence of the difference in representations as a function of the spectral gap. Results shown in Fig. 1a are obtained by varying $p _ { \mathsf { S W } }$ from 0.1 to 0.9. For each value of $p _ { \mathrm { { S W } } }$ we generate one graph $G$ and 50 different graphs $G ^ { \prime }$ ; and for each graph $G ^ { \prime }$ we compute $\left\| \Phi _ { G } ( \mathbf { x } ) - \Phi _ { G ^ { \prime } } ( \mathbf { x } ) \right\|$ for $1 , 0 0 0$ different graph signal realizations $\mathbf { x }$ . The average across all signal realizations is considered the estimate of the representation difference, and then the mean as well as the variance across all graphs are computed and shown in the figure (error bars).
250
+
251
+ ![](images/ab3c76d016013659ebc8bed4952003e1dc647cd2d0ff1cb9ea96f8e7921a8d8e.jpg)
252
+ Figure 1. (a) Difference in representation between the signal defined on the original graph $G$ and on the deformed graph $G ^ { \prime }$ as a function of the spectral gap $\beta$ . (b)-(c) Classification error percentage as a function of perturbation for the authorship attribution and the Facebook graph, respectively.
253
+
254
+ Fig. 1a shows the average difference $\| \Phi _ { G } ( \mathbf { x } ) - \Phi _ { G } ( \mathbf { x } ^ { \prime } ) \|$ as a function of the spectral gap (changing $p _ { \mathsf { S W } }$ from 0.1 to 0.9 led to values of spectral gap between 0.5 and close to 1). First and foremost we observe that, indeed, as $\beta$ reaches one, the stability result gets worse and the representation difference increases. We also observe that, for deeper scattering representations, the difference also gets worse, although it is not a linear behaviour as predicted in equation 16, which suggest that the bound is not tight.
255
+
256
+ For classifying we train a SVM linear model fed by features obtained from different representations. We thus compare with two non-trainable linear representations of the data: a data-based method (using the graph signals to feed the classifier) and a graph-based method (obtaining the GFT coefficients as features for the data). Additionally, we consider the graph scattering with varying depth to analyze the richness of the representation. Our aim is mainly to illustrate that the scattering representation is rich enough, relative to linear representations, and is stable to graph deformations.
257
+
258
+ First, we consider the problem of authorship attribution where the main task is to determine if a given text was written by a certain author. We construct author profiles by means of word adjacency networks (WAN). This WAN acts as the underlying graph support for the graph signal representing the word count (bag-of-words) of the target text of unknown authorship. Intuitively, the choice of words of the target text should reflect the pairwise connections in the WAN, see Segarra et al. (2015) for detailed construction of WANs. In particular, we consider all works by Jane Austen. To illustrate the stability result, we construct a WAN with 188 nodes (functional words) using a varying number of texts to form the training set, obtaining an array of graphs that are similar but not exactly the same. For the test set, we include 154 excerpts by Jane Austen and 154 excerpts written by other contemporary authors, totaling 308 data points. Fig. 1b shows classification error as a function of the number of training samples used. We observe that graph scattering transforms monotonically improve while considering more training data, whereas other methods vary more erratically, showing their lack of stability (their representations vary more wildly when the underlying graph support changes). This shows that scattering diffusion transforms strike a good balance between stability and discriminative power.
259
+
260
+ For the second task, let $G$ be a 234-node graph modeling real-world Facebook interactions (McAuley & Leskovec, 2012). In the source localization problem, we observe a diffusion process after some unknown time $t$ , that originated at some unknown node $i$ , i.e. we observe $\mathbf { x } = \mathbf { \bar { W } } ^ { t } \delta _ { i }$ , where $\delta _ { i }$ is the signal with all zeros except a 1 on node $i$ . The objective is to determine which community the source node $i$ belongs to. These signals can be used to model rumors that percolate through the social network by interaction between users and the objective is to determine which user group generated said rumor (or initiated a discussion on some topic). We generate a training sample of size 2, 000, for nodes $i$ chosen at random and diffusion times $t$ chosen as random as well. The GFT is computed by projecting on the eigenbasis of the operator $T$ . We note that, to avoid numerical instabilities, the diffusion is carried out using the normalized operator $( W / \lambda _ { \operatorname* { m a x } } ( W ) )$ and $t \le t _ { \mathrm { m a x } } = 2 0$ . The representation coefficients (graph signals, GFT or scattering coefficients) obtained from this set are used to train different linear SVMs to perform classification. For the test set, we draw 200 new signals. We compute the classification errors on the test set as a measure of usefulness of the obtained representations. Results are presented in Fig. 1c, where perturbations are illustrated by dropping edges with probability $p$ (adding or removing friends in Facebook). Again, it is observed that the scattering representation exhibits lower variations when the underlying graph changes, compared to the linear approaches.
261
+
262
+ Finally, to remark the discriminative power of the scattering representation, we observe that as the graph scattering grows deeper, the obtained features help in more accurate classification. We remark that in regimes with sufficient labeled examples, trainable GNN architectures will generally outperform scattering-based representations.
263
+
264
+ # 7 CONCLUSIONS
265
+
266
+ In this work we addressed the problem of stability of graph representations. We designed a scattering transform of graph signals using diffusion wavelets and we proved that this transform is stable under deformations of the underlying graph support. More specifically, we showed that the scattering transform of a graph signal supported on two different graphs is proportional to the diffusion distance between those graphs. As a byproduct of our analysis, we obtain stability bounds for Graph Neural Networks generated by diffusion operators. Additionally, we showed that the resulting descriptions are also rich enough to be able to adequately classify plays by author in the context of authorship attribution, and identify the community origin of a signal in a source localization problem.
267
+
268
+ That said, there are a number of directions to build upon from these results. First, our stability bounds depend on the spectral gap of the graph diffusion. Although lazy diffusion prevents this spectral gap to vanish, as the size of the graph increases we generally do not have a tight bound, as illustrated by regular graphs. An important direction of future research is thus to develop stability bounds which are robust to vanishing spectral gaps. Next, and related to this first point, we are working on extending the analysis to broader families of wavelet decompositions on graphs and their corresponding graph neural network versions, including stability with respect to the GromovHausdorff metric, which can be achieved by using graph wavelet filter banks that achieve bounds analogous to those in Lemmas 5.1 and 5.2.
269
+
270
+ # ACKNOWLEDGMENTS
271
+
272
+ Work supported by NSF CCF 1717120, US ARO W911NF1710438, ARL DCIST CRA W911NF17-2-0181, ISTC-WAS and Intel AI DevCloud.
273
+
274
+ # REFERENCES
275
+
276
+ J. Anden and S. Mallat. Deep scattering spectrum. ´ IEEE Trans. Signal Process., 62(16):4114–4128, Aug. 2014.
277
+ A. M. Bronstein, M. M. Bronstein, R. Kimmel, M. Mahmoudi, and G. Sapiro. A Gromov-Hausdorff framework with diffusion geometry for topologically-robust non-rigid shape matching. Int. J. of Comput. Vision, 89(2-3):266–286, 2010.
278
+ M. M. Bronstein, J. Bruna, Y. LeCun, A. Szlam, and P. Vandergheynst. Geometric deep learning: Going beyond euclidean data. IEEE Signal Process. Mag., 34(4):18–42, July 2017.
279
+ J. Bruna and S. Mallat. Invariant scattering convolution networks. IEEE Trans. Pattern Anal. Mach. Intell., 35(8):1872–1886, Aug. 2013.
280
+ J. Bruna, W. Zaremba, A. Szlam, and Y. LeCun. Spectral networks and deep locally connected networks on graphs. arXiv:1312.6203v3 [cs.LG], 21 May 2014. URL http://arxiv.org/ abs/1213.6203.
281
+ X. Chen, X. Cheng, and S. Mallat. Unsupervised deep Haar scattering on graphs. In Annu. Conf. Neural Inform. Process. Syst. 2014, Montreal, QC, 8-13 Dec. 2014. NIPS Foundation. ´
282
+ F. R. K. Chung. Spectral Graph Theory. Number 92 in Conference Board of the Mathematical Sciences: Regional Conference Series in Mathematics. American Mathematical Society, Providence, RI, 1997.
283
+ R. R. Coifman and S. Lafon. Diffusion maps. Appl. Comput. Harmonic Anal., 21(1):5–30, July 2006.
284
+ R. R. Coifman and M. Maggioni. Diffusion wavelets. Appl. Comput. Harmonic Anal., 21(1):53–94, July 2006.
285
+ M. Defferrard, X. Bresson, and P. Vandergheynst. Convolutional neural networks on graphs with fast localized spectral filtering. In Annu. Conf. Neural Inform. Process. Syst. 2016, Barcelona, Spain, 5-10 Dec. 2016. NIPS Foundation.
286
+ M. Eickenberg, G. Exarchakis, M. Hirn, and S. Mallat. Solid harmonic wavelet scattering: Predicting quantum molecular energy from invariant descriptors of 3d electronic densities. In Annu. Conf. Neural Inform. Process. Syst. 2017, Long Beach, CA, 4-9 Dec. 2017. NIPS Foundation.
287
+ F. Gama, A. G. Marques, G. Leus, and A. Ribeiro. Convolutional neural network architectures for signals supported on graphs. IEEE Trans. Signal Process., 67(4):1034–1049, Feb. 2019.
288
+ M. Gavish, B. Nadler, and R. R. Coifman. Multiscale wavelets on trees, graphs and high dimensional data: Theory and applications to semi supervised learning. In 27th Int. Conf. Mach. Learning, Haifa, Israel, 21-24 June 2010.
289
+ J. Gilmer, S. S. Schoenholz, P. F. Riley, O. Vinyals, and G. E. Dahl. Neural message passing for quantum chemistry. In 34th Int. Conf. Mach. Learning, Sydney, Australia, 6-11 Aug. 2017.
290
+ S. Gunasekar, J. Lee, D. Soudry, and N. Srebro. Characterizing implicit bias in terms of optimization geometry. In 35th Int. Conf. Mach. Learning, number 80, pp. 1832–1841, Stockholm, Sweden, 10-15 July 2018.
291
+ D. K. Hammond, P. Vandergheynst, and R. Gribonval. Wavelets on graphs via spectral graph theory. Appl. Comput. Harmonic Anal., 30(2):129–150, March 2011.
292
+ M. Henaff, J. Bruna, and Y. LeCun. Deep convolutional networks on graph-structured data. arXiv:1506.051631v1 [cs.LG], 16 June 2015. URL http://arxiv.org/abs/1506. 05163.
293
+ W. Huang, L. Goldsberry, N. F. Wymbs, S. T. Grafton, D. S. Bassett, and A. Ribeiro. Graph frequency analysis of brain signals. IEEE J. Select. Topics Signal Process., 10(7):1189–1203, Oct. 2016.
294
+ W. Huang, A. G. Marques, and A. Ribeiro. Matrix completion via graph signal processing. In 43rd IEEE Int. Conf. Acoust., Speech and Signal Process., Calgary, AB, 15-20 Apr. 2018. IEEE.
295
+ M. O. Jackson. Social and Economic Networks. Princeton University Press, Princeton, NJ, 2008.
296
+ T. N. Kipf and M. Welling. Semi-supervised classification with graph convolutional networks. In 5th Int. Conf. Learning Representations, Toulon, France, 24-26 Apr. 2017. Assoc. Comput. Linguistics.
297
+ I. Kostrikov, J. Bruna, D. Panozzo, and D. Zorin. Surface networks. arXiv:1705.10819v1 [stat.ML], 30 May 2017. URL http://arxiv.org/abs/1705.10819.
298
+ Y. LeCun, K. Kavukcuoglu, and C. Farabet. Convolutional networks and applications in vision. In 2010 IEEE Int. Symp. Circuits and Syst., Paris, France, 30 May-2 June 2010. IEEE.
299
+ Y. LeCun, Y. Bengio, and G. Hinton. Deep learning. Nature, 521(7553):85–117, 2015.
300
+ R. Levie, F. Monti, X. Bresson, and M. M. Bronstein. Cayleynets: Graph convolutional neural networks with complex rational spectral filters. IEEE Trans. Signal Process., 67(1):97–109, Jan. 2019.
301
+ S. Mallat. Group invariant scattering. Communications on Pure and Applied Mathematics, 65(10): 1331–1398, 2012.
302
+ J. McAuley and J. Leskovec. Learning to discover social circles in Ego networks. In 26th Annu. Conf. Neural Inform. Process. Syst., Stateline, TX, 3-8 Dec. 2012. NIPS Foundation.
303
+ B. Nadler, S. Lafon, I. Kevrekidis, and R. R. Coifman. Diffusion maps, spectral clustering and eigenfunctions of fokker-planck operators. In Annu. Conf. Neural Inform. Process. Syst. 2006, Vancouver, BC, 4-9 Dec. 2006. NIPS Foundation.
304
+ E. Oyallon and S. Mallat. Deep roto-translation scattering for object classification. In IEEE Comput. Soc. Conf. Comput. Vision and Pattern Recognition 2015, Boston, MA, 7-12 June 2015. IEEE Comput. Soc.
305
+ R. Rustamov and L. J. Guibas. Wavelets on graphs via deep learning. In Annu. Conf. Neural Inform. Process. Syst. 2013, Lake Tahoe, NV, 5-10 Dec. 2013. NIPS Foundation.
306
+ S. Segarra, M. Eisen, and A. Ribeiro. Authorship attribution through function word adjacency networks. IEEE Trans. Signal Process., 63(20):5464–5478, Oct. 2015.
307
+ L. Sifre and S. Mallat. Rotation, scaling and deformation invariant scattering for texture discrimination. In IEEE Comput. Soc. Conf. Comput. Vision and Pattern Recognition 2013, Portland, OR, 23-28 June 2013. IEEE Comput. Soc.
308
+ C. Wei, J. D. Lee, Q. Liu, and T. Ma. On the margin theory of feedforward neural networks. arXiv:1810.05369v1 [stat.ML], 12 Oct. 2018. URL http://arxiv.org/abs/ 1810.05369.
309
+ T. Wiatowski and H. Bolcskei. A mathematical theory of deep convolutional neural networks for ¨ feature extraction. IEEE Trans. Inf. Theory, 64(3):1845–1866, 2018.
310
+ D. Zou and G. Lerman. Graph convolutional neural networks via scattering. arXiv:1804.00099v1 [cs.IT], 31 March 2018. URL http://arxiv.org/abs/1804.00099.
311
+
312
+ # A PROOF OF PROPOSITION 4.1
313
+
314
+ Since all operators $\psi _ { j }$ are polynomials of the diffusion $T$ , they all diagonalise in the same basis. Let $T = V \Lambda V ^ { \mathsf { T } }$ , where $V ^ { \mathsf { T } } V = I$ contains the eigenvectors of $T$ and $\Lambda = \operatorname { d i a g } ( \lambda _ { 0 } , . . . , \lambda _ { n - 1 } )$ its eigenvalues. The frame bounds $C _ { 1 } , C _ { 2 }$ are obtained by evaluating $\| \Psi \mathbf { x } \| ^ { 2 }$ for $\mathbf x = \mathbf v _ { i }$ , $i = 1 , \ldots , n -$ 1, since $\mathbf { v } _ { 0 }$ corresponds to the square-root degree vector and $\mathbf { x }$ is by assumption orthogonal to $\mathbf { v } _ { 0 }$ .
315
+
316
+ We verify that the spectrum of $\psi _ { j }$ is given by $( p _ { j } ( \lambda _ { 0 } ) , \dots , p _ { j } ( \lambda _ { n - 1 } ) )$ , where $p _ { j } ( x ) = x ^ { 2 ^ { j - 1 } } - x ^ { 2 ^ { j } }$ for $j > 0$ and $p _ { 0 } ( x ) = 1 - x$ . Denote by $\begin{array} { r } { Q _ { J } ( x ) = \sum _ { j = 0 } ^ { J - 1 } p _ { j } ( x ) ^ { 2 } } \end{array}$ . It follows from the definition that $\| \Psi \mathbf { v } _ { i } \| ^ { 2 } = Q _ { J } ( \lambda _ { i } )$ for $i = 1 , \ldots , n - 1$ and therefore
317
+
318
+ $$
319
+ C _ { 1 } = \operatorname * { m i n } _ { x \in ( 0 , \beta ) } Q _ { J } ( x ) , C _ { 2 } = \operatorname * { m a x } _ { x \in ( 0 , \beta ) } Q _ { J } ( x ) .
320
+ $$
321
+
322
+ We check that $\begin{array} { r } { C _ { 1 } \geq \operatorname* { m i n } _ { x \in ( 0 , \beta ) } p _ { 0 } ( x ) ^ { 2 } = ( 1 - \beta ) ^ { 2 } } \end{array}$ and $C _ { 2 } = Q _ { J } ( 0 ) = 1$ . Indeed, denote by $\begin{array} { r } { Q ( x ) = \sum _ { j = 0 } ^ { \infty } p _ { j } ( x ) ^ { 2 } } \end{array}$ . One easily verifies that $Q ( x )$ is continuous in $[ 0 , 1 )$ since it is bounded by a geometric series. Also, observe that $\begin{array} { r } { Q ( x ) = ( 1 - x ) ^ { 2 } + \sum _ { j > 0 } ( x ^ { 2 ^ { j - 1 } } - x ^ { 2 ^ { j } } ) ^ { 2 } } \end{array}$ satisfies the recurrence
323
+
324
+ $$
325
+ Q ( x ^ { 2 } ) = Q ( x ) + 2 x ( 1 - x ) ^ { 2 } \geq Q ( x )
326
+ $$
327
+
328
+ since $x \in [ 0 , 1 )$ . By continuity it thus follows that
329
+
330
+ $$
331
+ \operatorname* { s u p } _ { x \in [ 0 , 1 ) } Q _ { J } ( x ) \leq \operatorname* { s u p } _ { x \in [ 0 , 1 ) } Q ( x ) = \operatorname* { l i m } _ { x \to 0 } Q ( x ) = Q ( 0 ) = 1 \boxed { \Omega } .
332
+ $$
333
+
334
+ # B PROOF OF LEMMA 5.1
335
+
336
+ By definition $\| \Psi _ { G } - \Psi _ { G ^ { \prime } } \| ^ { 2 } = \| [ \Psi _ { G } - \Psi _ { G ^ { \prime } } ] ^ { * } [ \Psi _ { G } - \Psi _ { G ^ { \prime } } ] \|$ and
337
+
338
+ $$
339
+ [ \Psi _ { G } - \Psi _ { G ^ { \prime } } ] ^ { * } [ \Psi _ { G } - \Psi _ { G ^ { \prime } } ] = \sum _ { j = 0 } ^ { J _ { n } - 1 } ( \psi _ { j } ( G ) - \psi _ { j } ( G ^ { \prime } ) ) ^ { * } ( \psi _ { j } ( G ) - \psi _ { j } ( G ^ { \prime } ) ) \ : .
340
+ $$
341
+
342
+ Since $T _ { G }$ and $T _ { G ^ { \prime } }$ are self-adjoint, so are $\psi _ { j } ( G )$ and $\psi _ { j } ( G ^ { \prime } )$ . From the triangular inequality, we thus obtain
343
+
344
+ $$
345
+ \| \Psi _ { G } - \Psi _ { G ^ { \prime } } \| ^ { 2 } \leq \sum _ { j } \| \psi _ { j } ( G ) - \psi _ { j } ( G ^ { \prime } ) \| ^ { 2 } .
346
+ $$
347
+
348
+ Denote by $\mathbf { v }$ the eigenvector associated with $\lambda _ { 0 } = 1$ , $\textstyle [ \mathbf { v } ] _ { i } = ( d _ { i } / \sum _ { j = 1 } ^ { n } d _ { j } ) ^ { 1 / 2 }$ . Since $\beta < 1$ , we can write $T = \mathbf { v } \mathbf { v } ^ { \mathsf { T } } + { \overline { { T } } }$ with $\| \overline { { T } } \| < 1$ and $\mathbf { v } \in \mathrm { N u l l } ( \overline { { T } } )$ . It follows by induction that $T ^ { r } = \mathbf { v } \mathbf { v } ^ { \mathsf { T } } + { \overline { { T } } } ^ { r }$ , and hence
349
+
350
+ $$
351
+ \psi _ { j } ( G ) = T _ { G } ^ { 2 ^ { j - 1 } } - T _ { G } ^ { 2 ^ { j } } = \overline { { { T } } } _ { G } ^ { 2 ^ { j - 1 } } - \overline { { { T } } } _ { G } ^ { 2 ^ { j } } \ ,
352
+ $$
353
+
354
+ and equivalently for $G ^ { \prime }$ , resulting in
355
+
356
+ $$
357
+ \| \psi _ { j } ( G ) - \psi _ { j } ( G ^ { \prime } ) \| ^ { 2 } \leq 2 \left( \| \overline { { T } } _ { G } ^ { 2 ^ { j - 1 } } - \overline { { T } } _ { G ^ { \prime } } ^ { 2 ^ { j - 1 } } \| ^ { 2 } + \| \overline { { T } } _ { G } ^ { 2 ^ { j } } - \overline { { T } } _ { G ^ { \prime } } ^ { 2 ^ { j } } \| ^ { 2 } \right) ,
358
+ $$
359
+
360
+ and thus
361
+
362
+ $$
363
+ \| \Psi _ { G } - \Psi _ { G ^ { \prime } } \| ^ { 2 } \leq 4 \sum _ { j } \| \overline { { T } } _ { G } ^ { 2 ^ { j } } - \overline { { T } } _ { G ^ { \prime } } ^ { 2 ^ { j } } \| ^ { 2 } .
364
+ $$
365
+
366
+ Let us show that for matrices $A$ and $B$ such that $\beta = \operatorname* { m a x } ( \| A \| , \| B \| ) < 1$ and $r \in \mathbb { N }$ , one has
367
+
368
+ $$
369
+ \| A ^ { r } - B ^ { r } \| \leq r \beta ^ { r - 1 } \| A - B \| .
370
+ $$
371
+
372
+ Indeed, by noting $g ( t ) = ( t B + ( 1 - t ) A ) ^ { r }$ , we have
373
+
374
+ $$
375
+ \| A ^ { r } - B ^ { r } \| = \| g ( 1 ) - g ( 0 ) \| = \left\| \int _ { 0 } ^ { 1 } g ^ { \prime } ( t ) d t \right\| \leq \int _ { 0 } ^ { 1 } \| g ^ { \prime } ( t ) \| d t \leq \operatorname* { s u p } _ { t \in ( 0 , 1 ) } \| g ^ { \prime } ( t ) \| .
376
+ $$
377
+
378
+ By noting $A _ { t } = t B + ( 1 - t ) A$ we verify that
379
+
380
+ $$
381
+ g ^ { \prime } ( t ) = \sum _ { l = 0 } ^ { r - 1 } A _ { t } ^ { l } ( B - A ) A _ { t } ^ { r - l - 1 } ,
382
+ $$
383
+
384
+ which results in $\| g ^ { \prime } ( t ) \| \leq r \beta ^ { r - 1 } \| B - A \|$ , proving (23).
385
+
386
+ By plugging (23) into (22) we thus obtain
387
+
388
+ $$
389
+ \begin{array} { r c l } { \| \Psi _ { G } - \Psi _ { G ^ { \prime } } \| ^ { 2 } } & { \leq } & { 4 \| \overline { { T } } _ { G } - \overline { { T } } _ { G ^ { \prime } } \| ^ { 2 } \displaystyle \sum _ { j } 2 ^ { 2 j } \beta ^ { 2 ^ { j + 1 } } } \\ & & { \leq } & { 4 \| \overline { { T } } _ { G } - \overline { { T } } _ { G ^ { \prime } } \| ^ { 2 } \displaystyle \sum _ { t } t ^ { 2 } ( \beta ^ { 2 } ) ^ { t } } \\ & & { \leq } & { 4 \| \overline { { T } } _ { G } - \overline { { T } } _ { G ^ { \prime } } \| ^ { 2 } \displaystyle \frac { \beta ^ { 2 } ( 1 + \beta ^ { 2 } ) } { ( 1 - \beta ^ { 2 } ) ^ { 3 } } , } \end{array}
390
+ $$
391
+
392
+ which yields $\begin{array} { r } { \| \Psi _ { G } - \Psi _ { G ^ { \prime } } \| \leq 2 \| \overline { T } _ { G } - \overline { T } _ { G ^ { \prime } } \| \sqrt { \frac { \beta ^ { 2 } ( 1 + \beta ^ { 2 } ) } { ( 1 - \beta ^ { 2 } ) ^ { 3 } } } } \end{array}$ Finally, we observe that $\| \overline { { T } } _ { G } - \overline { { T } } _ { G ^ { \prime } } \| =$ $\| T _ { G } - T _ { G ^ { \prime } } \|$ , which proves (12) as claimed. $\sqsubset$
393
+
394
+ # C PROOF OF LEMMA 5.2
395
+
396
+ Without loss of generality, assume that the node assignment that minimizes $\| T _ { G } - \Pi T _ { G ^ { \prime } } \Pi \| ^ { \mathsf { T } }$ is the identity. We need to bound the leading eigenvectors of two symmetric matrices $T _ { G }$ and $T _ { G ^ { \prime } }$ with a spectral gap. As before, let $T _ { G } = \mathbf { v } \mathbf { \bar { v } } ^ { \mathsf { T } } + \overline { { T } } _ { G }$ and $T _ { G ^ { \prime } } = \bar { { \bf v } ^ { \prime } } ( { \bf v } ^ { \prime } ) ^ { \sf T } + \overline { { T } } _ { G ^ { \prime } }$ . Let $\alpha = \langle { \bf v } , { \bf v } ^ { \prime } \rangle \geq 0$ since both are non-negative vectors. Denote by $E = T _ { G } - T _ { G ^ { \prime } }$ and $\overline { { { E } } } \ : = \ : \overline { { { T } } } _ { G } \ : - \ : \overline { { { T } } } _ { G ^ { \prime } }$ . Then $E = \mathbf { v } \mathbf { v } ^ { \mathsf { T } } - \mathbf { v } ^ { \prime } ( \mathbf { v } ^ { \prime } ) ^ { \mathsf { T } } + \mathbf { \overline { { E } } }$ . Hence $E \mathbf { v } = \mathbf { v } - \mathbf { v } ^ { \prime } { \overset { \cdot } { \alpha } } - { \overline { { T } } } _ { G ^ { \prime } } ( \mathbf { v } - \alpha \mathbf { v } ^ { \prime } )$ , so
397
+
398
+ $$
399
+ ( { \bf I } - { \overline { { T } } } _ { G ^ { \prime } } ) ( { \bf v } - { \bf v } ^ { \prime } \alpha ) = E { \bf v }
400
+ $$
401
+
402
+ Since $\| E \| \leq \mathrm { d } ( G , G ^ { \prime } )$ and $\| \overline { { T } } _ { G ^ { \prime } } \| < \beta ^ { \prime }$ , we have
403
+
404
+ $$
405
+ ( 1 - \alpha ) ( 1 - \beta ^ { \prime } ) \leq \| ( { \bf I } - \overline { { T } } _ { G ^ { \prime } } ) ( { \bf v } - { \bf v } ^ { \prime } \alpha ) \| \leq \mathrm { d } ( G , G ^ { \prime } ) ,
406
+ $$
407
+
408
+ so
409
+
410
+ $$
411
+ 1 - \alpha \leq \frac { \mathrm { d } ( G , G ^ { \prime } ) } { 1 - \beta ^ { \prime } } .
412
+ $$
413
+
414
+ Finally, since $\| \mathbf { v } - \mathbf { v } ^ { \prime } \| = \sqrt { 2 - 2 \alpha }$ , we have
415
+
416
+ $$
417
+ \| \mathbf { v } - \mathbf { v } ^ { \prime } \| ^ { 2 } \leq 2 \frac { \mathrm { d } ( G , G ^ { \prime } ) } { 1 - \beta ^ { \prime } } .
418
+ $$
419
+
420
+ Since we are free to swap the role of $\mathbf { v }$ and $\mathbf { v } ^ { \prime }$ , the result follows.
421
+
422
+ # D PROOF OF THEOREM 5.3
423
+
424
+ First, note that $\rho _ { G } = \rho _ { G ^ { \prime } } = \rho$ since it is a pointwise nonlinearity (an absolute value), and is independent of the graph topology. Now, let’s start with $k = 0$ . In this case, we get $\| U _ { G } \mathbf { x } - U _ { G ^ { \prime } } \mathbf { x } \|$ which is immediately bounded by Lemma 5.2 satisfying equation 15.
425
+
426
+ For $k = 1$ we have
427
+
428
+ $$
429
+ \begin{array} { r } { \left\| { U _ { G } \rho \Psi _ { G } \mathbf { x } - U _ { G ^ { \prime } } \rho \Psi _ { G ^ { \prime } } \mathbf { x } } \right\| = \left\| { U _ { G } \rho \Psi _ { G } \mathbf { x } - U _ { G ^ { \prime } } \rho \Psi _ { G } \mathbf { x } + U _ { G ^ { \prime } } \rho \Psi _ { G } \mathbf { x } - U _ { G ^ { \prime } } \rho \Psi _ { G ^ { \prime } } \mathbf { x } } \right\| } \\ { \leq \left\| { ( U _ { G } - U _ { G ^ { \prime } } ) \rho \Psi _ { G } \mathbf { x } } \right\| + \left\| { U _ { G ^ { \prime } } \rho ( ( \Psi _ { G } - \Psi _ { G ^ { \prime } } ) \mathbf { x } ) } \right\| } \end{array}
430
+ $$
431
+
432
+ where the triangular inequality of the norm was used, together with the fact that $\| \rho \mathbf { u } - \rho \mathbf { u } ^ { \prime } \| \leq$ $\| \rho ( \boldsymbol { \mathbf { u } } - \boldsymbol { \mathbf { u } } ^ { \prime } ) \|$ for any real vector $\mathbf { u }$ since $\rho$ is the pointwise absolute value. Using the submultiplicativity of the operator norm, we get
433
+
434
+ $$
435
+ \begin{array} { r } { \| U _ { G } \rho \Psi _ { G } \mathbf { x } - U _ { G ^ { \prime } } \rho \Psi _ { G ^ { \prime } } \mathbf { x } \| \leq \| U _ { G } - U _ { G ^ { \prime } } \| \| \rho \| \| \Psi _ { G } \| \| \mathbf { x } \| + \| U _ { G ^ { \prime } } \| \| \rho \| \| \Psi _ { G } - \Psi _ { G ^ { \prime } } \| \| \mathbf { x } \| . } \end{array}
436
+ $$
437
+
438
+ From Lemmas 5.1 and 5.2 we have that $\| \Psi _ { G } - \Psi _ { G ^ { \prime } } \| \leq \varepsilon _ { \Psi }$ and $\left\| U _ { G } - U _ { G ^ { \prime } } \right\| \le \varepsilon _ { U }$ , and from Proposition 4.1 that $\| \Psi _ { G } \| \leq 1$ . Note also that $\| U _ { G ^ { \prime } } \| = \| U _ { G } \| = 1$ and that $\| \rho \| = 1$ . This yields
439
+
440
+ $$
441
+ \left\| { U _ { G } \rho \Psi _ { G } \mathbf { x } - U _ { G ^ { \prime } } \rho \Psi _ { G ^ { \prime } } \mathbf { x } } \right\| \leq \varepsilon _ { U } \left\| { \mathbf { x } } \right\| + \varepsilon _ { \Psi } \left\| { \mathbf { x } } \right\| .
442
+ $$
443
+
444
+ satisfying equation 15 for $k = 1$ .
445
+
446
+ For $k = 2$ , we observe that
447
+
448
+ $$
449
+ \begin{array} { r l } & { \left\| { U _ { G } \rho \Psi _ { G } \rho \Psi _ { G } \mathbf x - U _ { G ^ { \prime } } \rho \Psi _ { G ^ { \prime } } \rho \Psi _ { G ^ { \prime } } \mathbf x } \right\| } \\ & { \quad = \left\| { U _ { G } \rho \Psi _ { G } \rho \Psi _ { G } \mathbf x - U _ { G ^ { \prime } } \rho \Psi _ { G } \rho \Psi _ { G } \mathbf x + U _ { G ^ { \prime } } \rho \Psi _ { G } \rho \Psi _ { G } \mathbf x - U _ { G ^ { \prime } } \rho \Psi _ { G ^ { \prime } } \rho \Psi _ { G ^ { \prime } } \mathbf x } \right\| } \\ & { \quad \leq \left\| { ( U _ { G } - U _ { G ^ { \prime } } ) \rho \Psi _ { G } \rho \Psi _ { G } \mathbf x } \right\| + \left\| { U _ { G ^ { \prime } } \left( \rho \Psi _ { G } \rho \Psi _ { G } \mathbf x - \rho \Psi _ { G ^ { \prime } } \rho \Psi _ { G ^ { \prime } } \mathbf x \right) } \right\| } \end{array}
450
+ $$
451
+
452
+ The first term is bounded in a straightforward fashion by $\| ( U _ { G } - U _ { G ^ { \prime } } ) \rho \Psi _ { G } \rho \Psi _ { G } \mathbf { x } \| \leq \varepsilon _ { U } \| \mathbf { x } \|$ in analogy to the development for $k = 1$ . Since $\| U _ { G ^ { \prime } } \| = 1$ , for the second term, we focus on
453
+
454
+ $$
455
+ \left\| \rho \Psi _ { G } \rho \Psi _ { G } \mathbf { x } - \rho \Psi _ { G ^ { \prime } } \rho \Psi _ { G ^ { \prime } } \mathbf { x } \right\| = \left\| \rho \Psi _ { G } \rho \Psi _ { G } \mathbf { x } - \rho \Psi _ { G } \rho \Psi _ { G ^ { \prime } } \mathbf { x } + \rho \Psi _ { G } \rho \Psi _ { G ^ { \prime } } \mathbf { x } - \rho \Psi _ { G ^ { \prime } } \rho \Psi _ { G ^ { \prime } } \mathbf { x } \right\|
456
+ $$
457
+
458
+ $$
459
+ \begin{array} { r l } { } & { { } \leq \vert \vert \rho \Psi _ { G } \rho \Psi _ { G } \mathbf { x } - \rho \Psi _ { G } \rho \Psi _ { G ^ { \prime } } \mathbf { x } \vert \vert + \vert \vert \rho \Psi _ { G } \rho \Psi _ { G ^ { \prime } } \mathbf { x } - \rho \Psi _ { G ^ { \prime } } \rho \Psi _ { G ^ { \prime } } \mathbf { x } \vert \vert } \end{array}
460
+ $$
461
+
462
+ We note that, in the first term in equation 33, the first layer induces an error, but after that, the processing is through the same filter banks. So we are basically interested in bounding the propagation of the error induced in the first layer. Applying twice the fact that $\| \rho ( \mathbf { u } ) - \rho ( \mathbf { u } ^ { \prime } ) \| \leq \| \rho ( \bar { \mathbf { u } } - \mathbf { u } ^ { \prime } ) \|$ we get
463
+
464
+ $$
465
+ \begin{array} { r } { \left| \left| \rho \Psi _ { G } \rho \Psi _ { G } \mathbf { x } - \rho \Psi _ { G } \rho \Psi _ { G ^ { \prime } } \mathbf { x } \right| \right| \leq \left| \left| \rho \big ( \Psi _ { G } \big ( \rho \Psi _ { G } \mathbf { x } - \rho \Psi _ { G ^ { \prime } } \mathbf { x } \big ) \big ) \right| \right| \leq \left| \left| \rho \big ( \Psi _ { G } \rho \big ( \big ( \Psi _ { G } - \rho \Psi _ { G ^ { \prime } } \big ) \mathbf { x } \big ) \big ) \right| \right| . } \end{array}
466
+ $$
467
+
468
+ And following with submultiplicativity of the operator norm,
469
+
470
+ $$
471
+ \left\| \rho \Psi _ { G } \rho \Psi _ { G } \mathbf { x } - \rho \Psi _ { G } \rho \Psi _ { G ^ { \prime } } \mathbf { x } \right\| \leq \varepsilon \Psi \left\| \mathbf { x } \right\| .
472
+ $$
473
+
474
+ For the second term in equation 33, we see that the first layer applied is the same in both, namely $\rho \Psi _ { G ^ { \prime } }$ so there is no error induced. Therefore, we are interested in the error obtained after the first layer, which is precisely the same error obtained for $k = 1$ . Therefore,
475
+
476
+ $$
477
+ \begin{array} { r } { \left\| \rho \Psi _ { G } \rho \Psi _ { G ^ { \prime } } \mathbf { x } - \rho \Psi _ { G ^ { \prime } } \rho \Psi _ { G ^ { \prime } } \mathbf { x } \right\| = \left\| \rho \Psi _ { G } \mathbf { x } - \rho \Psi _ { G ^ { \prime } } \mathbf { x } \right\| \leq \varepsilon _ { \Psi } \left\| \mathbf { x } \right\| . } \end{array}
478
+ $$
479
+
480
+ Plugging equation 35 and equation 36 back in equation 31 we get
481
+
482
+ $$
483
+ \begin{array} { r } { \left\| { U _ { G } \rho \Psi _ { G } \rho \Psi _ { G } \mathbf x - U _ { G ^ { \prime } } \rho \Psi _ { G ^ { \prime } } \rho \Psi _ { G ^ { \prime } } \mathbf x } \right\| \leq \varepsilon _ { U } \| \mathbf x \| + \varepsilon _ { \Psi } \| \mathbf x \| + \varepsilon _ { \Psi } \| \mathbf x \| } \end{array}
484
+ $$
485
+
486
+ satisfying equation 15 for $k = 2$ .
487
+
488
+ For general $k$ we see that we will have a first term that is the error induced by the mismatch on the low pass filter that amounts to $\varepsilon _ { U }$ , a second term that accounts for the propagation through $\left( k - 1 \right)$ equal layers of an initial error, yielding $\varepsilon \Psi$ , and a final third term that is the error induced by the previous layer, $( k - 1 ) \varepsilon _ { \Psi }$ . More formally, assume that equation 15 holds for $k - 1$ , implying that
489
+
490
+ $$
491
+ \| ( \rho \Psi _ { G } ) ^ { k - 1 } \mathbf { x } - ( \rho \Psi _ { G ^ { \prime } } ) ^ { k - 1 } \mathbf { x } \| \leq ( k - 1 ) \varepsilon _ { \Psi } \| \mathbf { x } \|
492
+ $$
493
+
494
+ Then, for $k$ , we can write
495
+
496
+ $$
497
+ \begin{array} { r } { \| U _ { G } ( \rho \Psi _ { G } ) ^ { k } \mathbf { x } - U _ { G ^ { \prime } } ( \rho \Psi _ { G ^ { \prime } } ) ^ { k } \mathbf { x } \| \leq \| ( U _ { G } - U _ { G ^ { \prime } } ) ( \rho \Psi _ { G } ) ^ { k } \mathbf { x } \| + \| U _ { G ^ { \prime } } ( ( \rho \Psi _ { G } ) ^ { k } \mathbf { x } - ( \rho \Psi _ { G ^ { \prime } } ) ^ { k } \mathbf { x } ) \| } \end{array}
498
+ $$
499
+
500
+ Again, the first term we bound it in a straightforward manner using submultiplicativity of the operator norm
501
+
502
+ $$
503
+ \begin{array} { r } { \| ( U _ { G } - U _ { G ^ { \prime } } ) ( \rho \Psi _ { G } ) ^ { k } \mathbf { x } \| \leq \varepsilon _ { U } \| \mathbf { x } \| . } \end{array}
504
+ $$
505
+
506
+ For the second term, since $\| U _ { G ^ { \prime } } \| = 1$ we focus on
507
+
508
+ $$
509
+ \left| \left| \left( \rho \Psi _ { G } \right) ^ { k } \mathbf { x } - ( \rho \Psi _ { G ^ { \prime } } ) ^ { k } \mathbf { x } \right| \right| = \left| \left| \left( \rho \Psi _ { G } \right) ^ { k } \mathbf { x } - ( \rho \Psi _ { G } ) ^ { k - 1 } \rho \Psi _ { G ^ { \prime } } \mathbf { x } + ( \rho \Psi _ { G } ) ^ { k - 1 } \rho \Psi _ { G ^ { \prime } } \mathbf { x } - ( \rho \Psi _ { G ^ { \prime } } ) ^ { k } \mathbf { x } \right| \right|
510
+ $$
511
+
512
+ $$
513
+ \begin{array} { r l } & { \leq \| ( \rho \Psi _ { G } ) ^ { k - 1 } \rho \Psi _ { G } \mathbf { x } - ( \rho \Psi _ { G } ) ^ { k - 1 } \rho \Psi _ { G ^ { \prime } } \mathbf { x } \| + \| ( \rho \Psi _ { G } ) ^ { k - 1 } \rho \Psi _ { G ^ { \prime } } \mathbf { x } - ( \rho \Psi _ { G ^ { \prime } } ) ^ { k - 1 } \rho \Psi _ { G ^ { \prime } } \mathbf { x } \| } \end{array}
514
+ $$
515
+
516
+ The first term in equation 42 computes the propagation in the initial error caused by the first layer. Then, repeatedly applying $\| \rho ( \mathbf { u } ) - \rho ( \mathbf { u } ^ { \prime } ) \| \leq \| \rho ( \mathbf { u } - \mathbf { u } ^ { \prime } ) \|$ in analogy with $k = 2$ and using submultiplicativity, we get
517
+
518
+ $$
519
+ \left\| ( \rho \Psi _ { G } ) ^ { k - 1 } \rho \Psi _ { G } \mathbf { x } - ( \rho \Psi _ { G } ) ^ { k - 1 } \rho \Psi _ { G ^ { \prime } } \mathbf { x } \right\| \leq \varepsilon _ { \Psi } \| \mathbf { x } \| .
520
+ $$
521
+
522
+ The second term in equation 42 is the bounded by equation 38, since the first layer is exactly the same in this second term. Then, combining equation 43 with equation 38, yields
523
+
524
+ $$
525
+ \begin{array} { r } { \| ( \rho \Psi _ { G } ) ^ { k } \mathbf { x } - ( \rho \Psi _ { G ^ { \prime } } ) ^ { k } \mathbf { x } \| \leq \varepsilon _ { \Psi } + ( k - 1 ) \varepsilon _ { \Psi } \| \mathbf { x } \| = k \varepsilon _ { \Psi } \| \mathbf { x } \| . } \end{array}
526
+ $$
527
+
528
+ Overall, we get
529
+
530
+ $$
531
+ \| U _ { G } ( \rho \Psi _ { G } ) ^ { k } \mathbf { x } - U _ { G ^ { \prime } } ( \rho \Psi _ { G ^ { \prime } } ) ^ { k } \mathbf { x } \| \leq \varepsilon _ { U } \| \mathbf { x } \| + \varepsilon _ { \Psi } \| \mathbf { x } \|
532
+ $$
533
+
534
+ which satisfies equation 15 for $k$ . Finally, since this holds for $k = 2$ , the proof is completed by induction. $\sqsubset$
535
+
536
+ # E PROOF OF COROLLARY 5.4
537
+
538
+ From Theorem 5.3, we have
539
+
540
+ $$
541
+ \| U _ { G } ( \rho _ { G } \Psi _ { G } ) ^ { k } - U _ { G ^ { \prime } } ( \rho _ { G ^ { \prime } } \Psi _ { G ^ { \prime } } ) ^ { k } \| \leq \left( \frac { 2 } { 1 - \beta _ { - } } \mathrm { d } ^ { s } ( G , G ^ { \prime } ) \right) ^ { 1 / 2 } + k \sqrt { \frac { \beta _ { + } ^ { 2 } ( 1 + \beta _ { + } ^ { 2 } ) } { ( 1 - \beta _ { + } ^ { 2 } ) ^ { 3 } } } \mathrm { d } ( G , G ^ { \prime } )
542
+ $$
543
+
544
+ and, by definition (Bruna & Mallat, 2013, Sec. 3.1),
545
+
546
+ $$
547
+ \| \Phi _ { G } ( \mathbf { x } ) \| ^ { 2 } = \sum _ { k = 0 } ^ { m - 1 } \| U _ { G } ( \rho _ { G } \Psi _ { G } ) ^ { k } \mathbf { x } \| ^ { 2 }
548
+ $$
549
+
550
+ so that
551
+
552
+ $$
553
+ \| \Phi _ { G } ( \mathbf { x } ) - \Phi _ { G ^ { \prime } } ( \mathbf { x } ) \| ^ { 2 } = \sum _ { k = 0 } ^ { m - 1 } \| U _ { G } ( \rho _ { G } \Psi _ { G } ) ^ { k } \mathbf { x } - U _ { G ^ { \prime } } ( \rho _ { G ^ { \prime } } \Psi _ { G ^ { \prime } } ) ^ { k } \mathbf { x } \| ^ { 2 }
554
+ $$
555
+
556
+ Then, applying the inequality of Theorem 5.3, we get
557
+
558
+ $$
559
+ \| \Phi _ { G } - \Phi _ { G ^ { \prime } } \| ^ { 2 } \leq \sum _ { k = 0 } ^ { m - 1 } \left[ \left( \frac { 2 } { 1 - \beta _ { - } } \mathrm { d } ( G , G ^ { \prime } ) \right) ^ { 1 / 2 } + k \sqrt { \frac { \beta _ { + } ^ { 2 } ( 1 + \beta _ { + } ^ { 2 } ) } { ( 1 - \beta _ { + } ^ { 2 } ) ^ { 3 } } } \mathrm { d } ( G , G ^ { \prime } ) \right] ^ { 2 }
560
+ $$
561
+
562
+ Now, considering each term, such that
563
+
564
+ $$
565
+ \begin{array} { r l } & { \displaystyle \| \Phi _ { G } - \Phi _ { G ^ { \prime } } \| ^ { 2 } \leq \sum _ { k = 0 } ^ { m - 1 } \left( \frac { 2 } { 1 - \beta _ { - } } \mathrm { d } ( G , G ^ { \prime } ) \right) + \sum _ { k = 0 } ^ { m - 1 } k ^ { 2 } \frac { \beta _ { + } ^ { 2 } \left( 1 + \beta _ { + } ^ { 2 } \right) } { ( 1 - \beta _ { + } ^ { 2 } ) ^ { 3 } } \mathrm { d } ^ { 2 } ( G , G ^ { \prime } ) } \\ & { \qquad + \displaystyle \sum _ { k = 0 } ^ { m - 1 } 2 ^ { 3 / 2 } k \sqrt { \frac { \beta _ { + } ^ { 2 } \left( 1 + \beta _ { + } ^ { 2 } \right) } { ( 1 - \beta _ { - } ) ( 1 - \beta _ { + } ^ { 2 } ) ^ { 3 } } } \mathrm { d } ^ { 3 / 2 } ( G , G ^ { \prime } ) } \end{array}
566
+ $$
567
+
568
+ we observe that the second and third term vanish for $\mathrm { d } ( G , G ^ { \prime } ) \ll 1$ , leaving only the first term, yielding
569
+
570
+ $$
571
+ \lVert \Phi _ { G } - \Phi _ { G ^ { \prime } } \rVert ^ { 2 } \lesssim m \left( \frac { 2 } { 1 - \beta _ { - } } \mathrm { d } ( G , G ^ { \prime } ) \right) .
572
+ $$
573
+
574
+ Finally, this leads to the corollary result
575
+
576
+ $$
577
+ \| \Phi _ { G } ( \mathbf { x } ) - \Phi _ { G } ( \mathbf { x } ) \| \lesssim m ^ { 1 / 2 } \mathrm { d } ^ { 1 / 2 } ( G , G ^ { \prime } ) \| \mathbf { x } \| \mathrm { i f } d ( G , G ^ { \prime } ) \ll 1
578
+ $$
579
+
580
+ completing the proof.
581
+
582
+ # F PROOF OF COROLLARY 5.5
583
+
584
+ Let us denote by $e _ { j } = \| x _ { G } ^ { ( j ) } - x _ { G ^ { \prime } } ^ { ( j ) } \|$ . From (17), from the triangle inequality we verify that
585
+
586
+ $$
587
+ e _ { j + 1 } \leq a _ { j } e _ { j } + b _ { j } \mathrm { ~ , w i t h }
588
+ $$
589
+
590
+ $$
591
+ a _ { j } = \lVert { \boldsymbol { \theta } } _ { 1 } ^ { ( j ) } \rVert + \lVert { \boldsymbol { \theta } } _ { 2 } ^ { ( j ) } \rVert , b _ { j } = \beta ^ { 2 ^ { j - 1 } } \mathrm { d } ( G , G ^ { \prime } ) \lVert { \boldsymbol { x } } _ { G ^ { \prime } } ^ { ( j ) } \rVert :
592
+ $$
593
+
594
+ It follows that
595
+
596
+ $$
597
+ e _ { J + 1 } \leq \sum _ { j \leq J } \left( \prod _ { i = j + 1 } ^ { J } a _ { i } \right) b _ { j } \leq \left( \prod _ { j = 1 } ^ { J } ( 1 + a _ { j } ) \right) \left( \sum _ { j = 1 } ^ { J } b _ { j } \right) ~ ,
598
+ $$
599
+
600
+ and since
601
+
602
+ $$
603
+ b _ { j } = \beta ^ { 2 ^ { j - 1 } } \mathrm { d } ( G , G ^ { \prime } ) \| x _ { G ^ { \prime } } ^ { ( j ) } \| \leq \beta ^ { 2 ^ { j - 1 } } \mathrm { d } ( G , G ^ { \prime } ) \| x \| \left( \prod _ { j = 1 } ^ { J } ( 1 + a _ { j } ) \right) ,
604
+ $$
605
+
606
+ we obtain
607
+
608
+ $$
609
+ e _ { J + 1 } \leq \left( \prod _ { j = 1 } ^ { J } ( 1 + a _ { j } ) \right) ^ { 2 } \mathrm { d } ( G , G ^ { \prime } ) \| x \| \sum _ { j } \beta ^ { 2 ^ { j - 1 } } \leq \left( \prod _ { j = 1 } ^ { J } ( 1 + a _ { j } ) \right) ^ { 2 } \mathrm { d } ( G , G ^ { \prime } ) \| x \| \frac { 1 } { 1 - \beta } ,
610
+ $$
611
+
612
+ as desired.
md/train/FrIDgjDOH1u/FrIDgjDOH1u.md ADDED
@@ -0,0 +1,281 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Scaling Vision with Sparse Mixture of Experts
2
+
3
+ Carlos Riquelme ∗ Google Brain
4
+
5
+ Joan Puigcerver \* Google Brain
6
+
7
+ Basil Mustafa \* Google Brain
8
+
9
+ Maxim Neumann Google Brain
10
+
11
+ Rodolphe Jenatton Google Brain
12
+
13
+ André Susano Pinto Google Brain
14
+
15
+ Daniel Keysers Google Brain
16
+
17
+ Neil Houlsby Google Brain
18
+
19
+ # Abstract
20
+
21
+ Sparsely-gated Mixture of Experts networks (MoEs) have demonstrated excellent scalability in Natural Language Processing. In Computer Vision, however, almost all performant networks are “dense”, that is, every input is processed by every parameter. We present a Vision MoE (V-MoE), a sparse version of the Vision Transformer, that is scalable and competitive with the largest dense networks. When applied to image recognition, V-MoE matches the performance of state-ofthe-art networks, while requiring as little as half of the compute at inference time. Further, we propose an extension to the routing algorithm that can prioritize subsets of each input across the entire batch, leading to adaptive per-image compute. This allows V-MoE to trade-off performance and compute smoothly at test-time. Finally, we demonstrate the potential of V-MoE to scale vision models, and train a 15B parameter model that attains $9 0 . 3 5 \%$ on ImageNet.
22
+
23
+ # 1 Introduction
24
+
25
+ Deep learning historically shows that increasing network capacity and dataset size generally improves performance. In computer vision, large models pre-trained on large datasets often achieve the state of the art [57, 50, 36, 20, 3]. This approach has had even more success in Natural Language Processing (NLP), where large pre-trained models are ubiquitous, and perform very well on many tasks [48, 18]. Text Transformers [61] are the largest models to date, some with over 100B parameters [9]. However, training and serving such models is expensive [56, 46]. This is partially because these deep networks are typically “dense”– every example is processed using every parameter –thus, scale comes at high computational cost. In contrast, conditional computation [5] aims to increase model capacity while keeping the training and inference cost roughly constant by applying only a subset of parameters to each example. In NLP, sparse Mixture of Experts (MoEs) are gaining popularity [54, 39, 22], enabling training and inference with fewer resources while unlocking trillion parameter models.
26
+
27
+ In this work, we explore conditional computation for vision at scale. We introduce the Vision MoE (V-MoE), a sparse variant of the recent Vision Transformer (ViT) architecture [20] for image classification. The V-MoE replaces a subset of the dense feedforward layers in ViT with sparse MoE layers, where each image patch is “routed” to a subset of “experts” (MLPs). Due to unique failure modes and non-differentiability, routing in deep sparse models is challenging. We explore various design choices, and present an effective recipe for the pre-training and transfer of V-MoE, notably outperforming their dense counterparts. We further show that V-MoE models are remarkably flexible. The performance vs. inference-cost trade-off of already trained models can be smoothly adjusted during inference by modulating the sparsity level with respect to the input and/or the model weights. Also, we open-source our implementation and a number of V-MoE models trained on ImageNet-21k.2
28
+
29
+ ![](images/248567e4274ec5c9f1a7fffd719389cf4c09bbe4388e9bb269069f3eda3ebd0c.jpg)
30
+ Figure 1: Overview of the architecture. V-MoE is composed of $L$ ViT blocks. In some, we replace the MLP with a sparsely activated mixture of MLPs. Each MLP (the expert) is stored on a separate device, and processes a fixed number of tokens. The communication of these tokens between devices = expert uses a capacity ratio C = 43 : the sparse MoE layer receives 12 tokens per device, but each is shown in this example, which depicts the case when $k = 1$ expert is selected per token. Here each expert has capacity for 16 ( $\textstyle \frac { 1 6 \cdot 1 } { 1 2 } = \frac { 4 } { 3 }$ ; see Section 2.4). Non-expert components of V-MoE such as routers, attention layers and normal MLP blocks are replicated identically across devices.
31
+
32
+ With V-MoE, we can scale to model sizes of 15B parameters, the largest vision models to date. We match the performance of state-of-the-art dense models, while requiring fewer time to train. Alternatively, V-MoE can match the cost of ViT while achieving better performance. To help control this tradeoff, we propose Batch Prioritized Routing, a routing algorithm that repurposes model sparsity to skip the computation of some patches, reducing compute on uninformative image regions.
33
+
34
+ We summarize our main contributions as follows:
35
+
36
+ Vision models at scale. We present the Vision Mixture of Experts, a distributed sparsely-activated Transformer model for vision. We train models with up to $2 4 \mathrm { M o E }$ layers, 32 experts per layer, and almost 15B parameters. We show that these models can be stably trained, seamlessly used for transfer, and successfully fine-tuned with as few as 1 000 datapoints. Moreover, our largest model achieves $9 0 . 3 5 \%$ test accuracy on ImageNet when fine-tuned.
37
+
38
+ Performance and inference. We show V-MoEs strongly outperform their dense counterparts on upstream, few-shot and full fine-tuning metrics in absolute terms. Moreover, at inference time, the V-MoE models can be adjusted to either (i) match the largest dense model’s performance while using as little as half the compute, or actual runtime, or (ii) significantly outperform it at the same cost.
39
+
40
+ Batch Prioritized Routing. We propose a new priority-based routing algorithm that allows V-MoEs to discard the least useful patches. Thus, we devote less compute to each image. In particular, we show V-MoEs match the performance of the dense models while saving $20 \%$ of the training FLOPs. Analysis. We provide some visualization of the routing decisions, revealing patterns and conclusions which helped motivate design decisions and may further improve understanding in the field.
41
+
42
+ # 2 The Vision Mixture of Experts
43
+
44
+ We first describe MoEs and sparse MoEs. We then present how we apply this methodology to vision, before explaining our design choices for the routing algorithm and the implementation of V-MoEs.
45
+
46
+ # 2.1 Conditional Computation with MoEs
47
+
48
+ Conditional computation aims at activating different subsets of a network for different inputs [5]. A mixture-of-experts model is a specific instantiation whereby different model “experts” are responsible for different regions of the input space [31].
49
+
50
+ We follow the setting of [54], who present for deep learning a mixture of experts layer with $E$ experts as $\begin{array} { r } { \mathrm { M o E } ( \mathbf { x } ) = \sum _ { i = 1 } ^ { E } g ( \mathbf { x } ) _ { i } e _ { i } ( \mathbf { x } ) } \end{array}$ where $\mathbf { x } \in \mathbb { R } ^ { D }$ is the input to the layer, $\boldsymbol { e } _ { i } : \mathbb { R } ^ { \boldsymbol { \bar { D } } } \mapsto \mathbb { R } ^ { D }$ the function computed by expert $i$ , and $g : \mathbb { R } ^ { D } \mapsto \mathbb { R } ^ { E }$ is the “routing” function which prescribes the input-conditioned weight for the experts. Both $e _ { i }$ and $g$ are parameterized by neural networks. As defined, this is still a dense network. However, if $g$ is sparse, i.e., restricted to assign only $k \ll E$ non-zero weights, then unused experts need not be computed. This unlocks super-linear scaling of the number of model parameters with respect to inference and training compute.
51
+
52
+ # 2.2 MoEs for Vision
53
+
54
+ We explore the application of sparsity to vision in the context of the Vision Transformer (ViT) [20]. ViT has been shown to scale well in the transfer learning setting, attaining better accuracies than CNNs with less pre-training compute. ViT processes images as a sequence of patches. An input image is first divided into a grid of equal-sized patches. These are linearly projected to the Transformer’s [61] hidden size. After adding positional embeddings, the patch embeddings (tokens) are processed by a Transformer, which consists predominately of alternating self-attention and MLP layers.
55
+
56
+ The MLPs have two layers and a GeLU [29] non-linearity: $\mathrm { M L P } ( \mathbf { x } ) = \mathbf { W } _ { \mathrm { 2 } } \ \sigma _ { \mathrm { g e l u } } ( \mathbf { W } _ { \mathrm { 1 } } \mathbf { x } )$ . For Vision MoE, we replace a subset of these with MoE layers, where each expert is an MLP; see Figure 1. The experts have the same architecture $e _ { i } ( { \bf x } ) = \mathrm { M L P } _ { \theta _ { i } } ( { \bf x } )$ but with different weights $\theta _ { i } = \left( \mathbf { W } _ { 1 } ^ { i } , \mathbf { W } _ { 2 } ^ { i } \right)$ . =This follows a similar design pattern as the M4 machine translation model [39].
57
+
58
+ # 2.3 Routing
59
+
60
+ For each MoE layer in V-MoE, we use the routing function $g ( \mathbf { x } ) \mathbf { \Psi } = \mathrm { T O P } _ { k }$ softmax $\left( \mathbf { W } \mathbf { x } + \epsilon \right)$ , where $\mathrm { T O P } _ { k }$ is an operation that sets all elements of the vector to zero except the elements with the largest $k$ values, and $\epsilon$ is sampled independently $\epsilon \sim \mathcal { N } ( 0 , \frac { 1 } { E ^ { 2 } } )$ entry-wise. In practice, we use $k = 1$ or $k = 2$ . In the context of the Vision Transformer, $\mathbf { x }$ =is a representation of an image token at some =layer of the network. Therefore, V-MoE routes patch representations, not entire images.
61
+
62
+ The difference between previous formulations [54] is that we apply $\mathrm { T O P } _ { k }$ after the softmax over experts weights [39], instead of before. This allows us to train with $k = 1$ (otherwise gradients with respect to routings are zero almost everywhere) and also performs better for $k > 1$ (see Appendix A).
63
+
64
+ Finally, we add a small amount of noise with standard deviation $\frac { 1 } { E }$ to the activations $\mathbf { W } \mathbf { x }$ . We empirically found this performed well but that the setup was robust to this parameter. The noise typically altered routing decisions ${ \sim } 1 5 \%$ of the time in earlier layers, and ${ \sim } 2 { - } 3 \%$ in deeper layers.
65
+
66
+ # 2.4 Expert’s Buffer Capacity
67
+
68
+ During training, sparse models may favor only a small set of experts [26, 52]. This common failure mode can cause two problems. First, statistical inefficiency: in the limit of collapse to a single expert, the model is no more powerful than a dense model. Second, computational inefficiency: imbalanced assignment of items to experts may lead to a poor hardware utilization.
69
+
70
+ To combat imbalance and simplify our implementation, we fix the buffer capacity of each expert (i.e. the number of tokens that each expert processes), and train our model with auxiliary losses that encourage load balancing. This is essentially the same approach as followed by [54, 39, 22]. In our case, we use slight variants of two of the auxiliary losses proposed in [54], as described in Appendix A.
71
+
72
+ We define the buffer capacity of an expert $( B _ { e } )$ as a function of the number of images in the batch number of experts $( N )$ , the number of tokens per image $( E )$ , and the capacity ratio $( P )$ , the number of selected experts per token $( C )$ : $B _ { e } =$ round $\textstyle \left( { \frac { k N P C } { E } } \right)$ . $( k )$ , the total
73
+
74
+ If the router assigns more than $B _ { e }$ tokens to a given expert, only $B _ { e }$ of them are processed. The remaining tokens are not entirely ‘lost’ as their information is preserved by residual connections (the top diagram of Figure 1). Also, if $k > 1$ , several experts try to process each token. Tokens are never >fully discarded. If an expert is assigned fewer than $B _ { e }$ tokens, the rest of its buffer is zero-padded.
75
+
76
+ We use the capacity ratio to adjust the capacity of the experts. With $C > 1$ , a slack capacity is added to account for a potential routing imbalance. This is typically useful for fine-tuning when the new data might come from a very different distribution than during upstream training. With $C < 1$ , the router is forced to ignore some assignments. In Section 4 we propose a new algorithm that takes advantage of setting $C \ll 1$ to discard the least useful tokens and save compute during inference.
77
+
78
+ # 3 Transfer Learning
79
+
80
+ In this section, we first present training different variants of V-MoE on a large dataset (Section 3.2) in order to be used for Transfer Learning afterwards. The ability to easily adapt our massive models to new tasks, using a small amount of data from the new task, is extremely valuable: it allows to amortize the cost of pre-training across multiple tasks. We consider two different approaches to Transfer Learning: linear few-shot learning on fixed representations and full fine-tuning of the model.
81
+
82
+ # 3.1 Models
83
+
84
+ We build V-MoE on different variants of ViT [20]: ViT-S(mall), ViT-B(ase), ViT-L(arge) and ViTH(uge), the hyperparameters of which are described in Appendix B.5. There are three additional major design decisions that affect the cost (and potentially the quality) of our model:
85
+
86
+ Number of MoE layers. Following [39], we place the MoEs on every other layer (we refer to these as V-MoE Every-2). In addition, we experimented with using fewer MoE layers, by placing them on the last- $\boldsymbol { n }$ even blocks (thus we dub these V-MoE Last-n). In Appendix E.1 we observe that, although using fewer MoE layers decreases the number of parameters of the model, it has typically little impact on quality and can speed-up the models significantly, since less communication overhead is incurred.
87
+
88
+ Number of selected experts $k$ : The cost of our model does not depend on the total number of experts but the number of selected ones per token. Concurrent works in NLP fix $k = 1$ [22] or $k = 2$ [54, 39]. In our case, we use by default $k = 2$ (see Figure 10 in Appendix B for the exploration of different values of $k$ ), while we found the total number of experts $E = 3 2$ to be the sweet spot in our setting.
89
+
90
+ Buffer capacity $C$ : As mentioned in Section 2.4, we use a fixed buffer capacity. While this is typically regarded as a downside or engineering difficulty to implement these models, we can adjust the capacity ratio to control different trade-offs. We can intentionally set it to a low ratio to save compute, using Batch Prioritized Routing (see Section 4). During upstream training, we set $C = 1 . 0 5$ by default to give a small amount of slack without increasing the cost noticeably.
91
+
92
+ Note that for a given trained model, the latter two— $k$ and $C$ —can be adjusted without further training, whereas the positioning and quantity of expert layers is effectively fixed to match pre-training.
93
+
94
+ # 3.2 Data
95
+
96
+ We pre-train our models on JFT-300M [57], a semi-automatically noisy-labeled dataset. It has $\sim 3 0 5 \mathrm { M }$ training and 50 000 validation images, organised in a hierarchy of 18 291 classes (average 1.89 labels per image). We deduplicate it with respect to all our validation/test sets as in previous efforts [36].3
97
+
98
+ Our few-shot experiments on ImageNet (i.e. ILSVRC2012) use only 1, 5, or 10 shots per class to adapt the upstream model, evaluating the resulting model on the validation set.
99
+
100
+ We also fine-tuned the pre-trained models on the full training set (ca. 1M images). We report performance in a similar regime for four other datasets in Appendix B.5. Lastly, we explore the ability to fine-tune our large models in the low-data regime by evaluating them on the Visual Task Adaptation Benchmark (VTAB) [69], a diverse suite of 19 tasks with only 1 000 data points per task. As well as natural image classification, VTAB includes specialized tasks (e.g. medical or satellite imagery) and structured tasks (e.g. counting or assessing rotation/distance).
101
+
102
+ # 3.3 Upstream results
103
+
104
+ JFT is a multilabel dataset, so we measure model performance via precision $@ 1$ (see Appendix B.6 for details). Note that as in previous works [20], hyperparameters were tuned for transfer performance, and JFT precision could be improved at the expense of downstream tasks e.g. by reducing weight decay. Figure 2a shows the quality of different V-MoE and ViT variants with respect to total training compute and time. It shows models that select $k = 2$ experts and place MoEs in the last $n$ even blocks $\hslash = 5$ for V-MoE-H, $n = 2$ otherwise), but the best results are achieved by V-MoE-H/14 Every-2 (see Table 2, 14 is the patch size). L/16’s are trained for 7 or 14 epochs. See Appendix B.5 for all results.
105
+
106
+ ![](images/c9583ef8573f88b5ab52bb6cdc466f3a72778204fe31d121cb2429ff9c12592a.jpg)
107
+ Figure 2: JFT-300M Precision $@ 1$ and ImageNet 5-shot accuracy. Colors represent different ViT variants, markers represent either standard ViT or V-MoEs on the last $n$ even blocks. The lines represent the Pareto frontier of ViT (dashed) and V-MoE (solid) variants.
108
+
109
+ ![](images/40e9744cbeb03d4891d930be558dc399a68ae80031ccc224b2837d477dced43f.jpg)
110
+ Figure 3: ImageNet Fine-Tuning Accuracy. Colors represent different VIT variants, markers represent either standard ViT or V-MoEs on the last $n$ even blocks. Lines show the Pareto frontier of VIT (dashed) and V-MoE (solid).
111
+
112
+ Table 1: VTAB. Scores and $9 5 \%$ confidence intervals for ViT and V-MoE.
113
+
114
+ <table><tr><td>ViT</td><td>V-MoE</td></tr><tr><td>L/16 76.3±0.5</td><td>77.2±0.4</td></tr><tr><td>H/14 77.6±0.2</td><td>77.8±0.4</td></tr></table>
115
+
116
+ Expert models provide notable gains across all model sizes, for only a mild increase in FLOPs, establishing a new Pareto frontier (gray lines). Alternatively, we can match or improve performance of ViT models at lower cost (e.g. V-MoE-L/16 improves upon ViT-H/14). Similar conclusions hold for training time, which includes communication overhead of dispatching data across devices.
117
+
118
+ # 3.4 Linear few-shot results
119
+
120
+ We evaluate the quality of the representations learned using few-shot linear transfer. Given training examples from the new dataset $\{ ( X , Y ) _ { i } \}$ , we use the pre-trained model $\mathcal { M }$ to extract a fixed representation $\mathcal { M } ( x _ { i } )$ of each image. We fit a linear regression model mapping $\mathcal { M } ( x _ { i } )$ to the one-hot encoding of the target labels $Y _ { i }$ , following [20] (see [27, Chapter 5] for background).
121
+
122
+ Figure 2b shows that the upstream gains are preserved under 5-shot ImageNet evaluation, considering both compute and time; in other words, the quality of the representations learned by V-MoE also outperforms ViT models when looking at a new task. Table 2 further shows the results on $\{ 1 , 1 0 \}$ -shot for some selected models, and the full detailed results are available in Appendix B.5.
123
+
124
+ # 3.5 Full fine-tuning results
125
+
126
+ The typically most performant approach for Transfer Learning [19] consists of replacing the upstream classification head with a new task-specific one and fine-tuning the whole model. Though one may expect that massive models like V-MoEs require special handling for fine-tuning, we broadly follow the standard fine-tuning protocol for Vision Transformers. We use the auxiliary loss during fine-tuning as well, although we observe that it is often not needed in this step, as the router is already well trained. We explore the two sets of tasks considered therein:
127
+
128
+ ![](images/50ec35f7ecf28e9c0130e04ba518b414285354dcdb6207d834c1ac8587a7979a.jpg)
129
+ Figure 4: White patches are discarded tokens in the first layer of experts, for different capacities, using Batch Prioritized Routing (Section 4.1) with a V-MoE-H/14. See Appendix D for more examples.
130
+
131
+ Full data. We follow the setup of [20], except that we apply a dropout rate of 0.1 on the expert MLPs (as done in [22]), and we halve the number of fine-tuning steps for all datasets other than ImageNet. Figure 3 shows the results on ImageNet (averaged over three runs). Here, V-MoE also performs better than dense counterparts, though we suspect the fine-tuning protocol could be further improved and tailored to the sparse models. See Table 8 for all details, including results on other datasets.
132
+
133
+ Low-data regime. On the VTAB benchmark, we use a similar setup and hyperparameter budget as [20] (but fine-tune with half the schedule length). Table 1 shows that, while performance is similar for V-MoE-H/14, experts provide significant gains at the ViT-L/16 level, indicating that despite the large size of these models, they can still be fine-tuned with small amounts of data and no further tricks.
134
+
135
+ # 3.6 Scaling up V-MoE
136
+
137
+ Finally, we test how well V-MoE can scale vision models to a very large number of parameters, while continuing to improve performance. For this, we increase the size of the model and use a larger pre-training dataset: JFT-3B is a larger version of JFT-300M, it contains almost 3B images and is noisily annotated with 30k classes. Inspired by [68], we apply the changes detailed in Appendix B.3, and train a 48-block V-MoE model, with every-2 expert placement (32 experts and $k = 2$ ), resulting in a model with 14.7B parameters, which we denote by V-MoE-15B.
138
+
139
+ We successfully train V-MoE-15B, which is, as far as we are aware, the largest vision model to date. It has an impressive $8 2 . 7 8 \%$ accuracy on 5-shot ImageNet and $9 0 . 3 5 \%$ when fully fine-tuned, as shown in Appendix B.5, which also includes more details about the model. Training this model required $1 6 . 8 \mathrm { k }$ TPUv3-core-days. To contextualize this result, the current state of the art on ImageNet is Meta Pseudo-Labelling (MPL) [49]. MPL trains an EfficientNet-based model on unlabelled JFT-300M using ImageNet pseudo-labelling, achieving $9 0 . 2 \%$ while requiring $2 2 . 5 \mathrm { k }$ TPUv3-core-days.
140
+
141
+ # 4 Skipping Tokens with Batch Prioritized Routing
142
+
143
+ We present a new routing algorithm that allows the model to prioritize important tokens (corresp. patches). By simultaneously reducing the capacity of each expert, we can discard the least useful tokens. Intuitively, not every patch is equally important to classify a given image, e.g., most background patches can be dropped to let the model only focus on the ones with the relevant entities.
144
+
145
+ # 4.1 From Vanilla Routing to Batch Prioritized Routing
146
+
147
+ With the notation from Section 2, the routing function $\mathbf { X } \in \mathbb { R } ^ { N \cdot P \times D }$ . A batch contains $N$ images composed of $P$ $g$ is applied row-wise to a batch of inputs tokens each; each row of $\mathbf { X }$ corresponds to the $D$ -dimensional representation of a particular token of an image. Accordingly, $g ( \mathbf { X } ) _ { t , i } \in \mathbb { R }$ denotes the routing weight for the $t$ -th token and the $i$ -th expert.
148
+
149
+ ![](images/29e4a2dc24e77688a20381ca0a9a9204e095cf85146fd91910e17ceb4adf02f7.jpg)
150
+ Figure 5: Reducing compute with priority routing. Performance vs. inference FLOPs for large models. V-MoEs with the original vanilla routing are represented by $\bullet$ , while $\mid$ shows V-MoEs where BPR and a mix of $C \in \{ 0 . 6 , 0 . 7 , 0 . 8 \}$ and $k \in \{ 1 , 2 \}$ are used to reduce compute. ViT models shown as $\mathbf { x }$ .
151
+
152
+ ![](images/a7de5765086bcdc5f0b366171e8b6331b7af94a05b53a7eba6ce847b523b20bc.jpg)
153
+ Figure 6: Priority routing works where vanilla fails. Performance vs. inference capacity ratio for a V-MoE-H/14 model with $k = 2$ . Even for large $C$ ’s BPR outperforms vanilla; at low $C$ the difference is stark. BPR is competitive with dense by processing only $1 5 { - } 3 0 \%$ of the tokens.
154
+
155
+ In all routing algorithms considered, for $i < j$ , every TOP- $i$ assignment has priority over any TOP- $j$ <assignment. The router first tries to dispatch all $i ^ { \mathrm { { t h } } }$ expert choices before assigning any $j ^ { \mathrm { t h } }$ choice4.
156
+
157
+ Given the TOP- $\cdot i$ position, the default—or vanilla—routing, as used in [54, 39, 22], assigns tokens to experts as follows. It sequentially goes over the rows of $g ( \mathbf { X } )$ and assigns each token to its TOP- $i$ expert when the expert’s buffer is not full. As a result, priority is given to tokens depending on the rank of their corresponding row. While images in a batch are randomly ordered, tokens within an image follow a pre-defined fixed order. The algorithm is detailed in Algorithm 1 of Appendix C.
158
+
159
+ Batch Prioritized Routing (BPR). To favour the “most important” tokens, we propose to compute a priority score $s ( \mathbf { x } )$ on each token, and sort $g ( \mathbf { X } )$ accordingly before proceeding with the allocation. We sort tokens based on their maximum routing weight, formally $s ( \mathbf { \bar { X } } ) _ { t } = \operatorname* { m a x } _ { i } g ( \mathbf { X } ) _ { t , i }$ . The sum of TOP- $k$ weights, i.e. $s ( \mathbf { X } ) _ { t } = \sum _ { i } g ( \mathbf { X } ) _ { t , i }$ =, worked equally well. These two simple approaches =outperformed other options we explored, e.g., directly parameterising and learning the function $s$ .
160
+
161
+ We reuse the router outputs as a proxy for the priority of allocation. Our experiments show this preserves the performant predictive behaviour of the model, even though the router outputs primarily encode how well tokens and experts can be paired, not the token’s “importance” for the final classification task. Figure 4 visualizes token prioritisation with Batch Prioritized Routing for increasingly small capacities. Since all tokens across all images in the batch $\mathbf { X }$ compete with each other, different images may receive different amounts of compute. We summarize BPR in Algorithm 2, in Appendix C.
162
+
163
+ # 4.2 Skip tokens with low capacity $C$
164
+
165
+ Batch Prioritized Routing opens the door to reducing the buffer size by smartly selecting which tokens to favor. This can have a dramatic impact in the computational cost of the overall sparse model. We discuss now inference and training results with $C$ defined in Section 2.4 in the regime $C \ll 1$ .
166
+
167
+ At inference time. Prioritized routing is agnostic to how the model was originally trained. Figure 6 shows the effect of reducing compute at inference time by using BPR versus vanilla routing, on a V-MoE-H/14 model trained using vanilla routing. The difference in performance between both methods is remarkable —especially for $C \leq 0 . 5$ , where the model truly starts fully dropping tokens, as $k = 2$ . Also, BPR allows the model to be competitive with the dense one even at quite low capacities. =As shown in Figure 5 for V-MoE-L/16 and V-MoE-H/14, Batch Prioritized Routing and low $C$ allow V-MoE to smoothly trade-off performance and FLOPS at inference time, quite a unique model feature. More concretely, Table 10 shows V-MoE models can beat the dense VIT-H performance by using less than half the FLOPs and less than $60 \%$ of the runtime. Conversely, we can match the inference FLOPs cost and preserve a one-point accuracy gain in ImageNet/5shot and almost three-point in JFT precision at one (Table 11). Dense models generally require less runtime for the same amount of FLOPs due to the data transfer involved in the V-MoE implementation.
168
+
169
+ ![](images/640deb97f79b2375225dd1090af5f85b4d407bb4a860255dc9270e4de0ca5a73.jpg)
170
+ Figure 7: Deeper routing decisions correlate with image classes. We show $4 ~ \mathrm { M o E }$ layers of a V-MoE-H/14. The $x$ -axis corresponds to the 32 experts in a layer. The $y$ -axis are the 1 000 ImageNet classes; orderings for both axes are different across plots. For each pair (expert $e$ , class $c$ ) we show the average routing weight for the tokens corresponding to all images with class $c$ for that particular expert $e$ . Figure 29 includes all the remaining layers; see Appendix E.2 for details.
171
+
172
+ At training time. Batch Prioritized Routing can also be leveraged during training. In Appendix C we show how expert models with max-weight routing can match the dense performance while saving around $20 \%$ of the total training FLOPs, and strongly outperform vanilla with a similar FLOP budget.
173
+
174
+ # 5 Model Analysis
175
+
176
+ Although large-scale sparse MoEs have led to strong performance [22, 39, 54], little is known and understood about how the internals of those complex models work. We argue that such exploratory experiments can inform the design of new algorithms. In this section, we provide the first such analysis at this scale, which guided the development of the algorithms presented in the paper.
177
+
178
+ Specialized experts. Intuitively, routers should learn to distribute images across experts based on their similarity. For instance, if the model had three experts, and the task mainly involved three categories—say animals, cars, and buildings—one would expect an expert to specialize in each of those. We test this intuition, with some obvious caveats: (a) experts are placed at several network depths, (b) $k$ experts are combined, and (c) routing happens at the token rather than the image level.
179
+
180
+ Figure 7 illustrates how many images of a given ImageNet class use each expert. The plots were produced by running a fine-tuned V-MoE-H Every-2 model. Interestingly, we saw similar patterns with the upstream model without fine-tuning. Experts specialize in discriminating between small sets of classes (those primarily routed through the expert). In earlier MoE layers we do not observe this. Experts may instead focus on aspects common to all classes (background, basic shapes, colours) - for example, Figure 30 (Appendix E) shows correlations with patch location in earlier layers.
181
+
182
+ The value of routers. After training a sparse MoE, it is natural to study the usefulness of the learned routers, in the light of several pitfalls. For example, the routers may just act as a load balancer if experts end up learning very similar functions, or the routers may simply choose poor assignments. In Appendix E.1, we replace, after training, one router at a time with a uniformly random router. The models are robust to early routing changes while more sensitive to the decisions in the last layers.
183
+
184
+ Routing weights distributions. We analyse the router outputs in Appendix E.3, and observe the distribution of selected weights varies wildly across different mixture of experts layers.
185
+
186
+ Changing $k$ at inference time. We have observed expert models are remarkably flexible. Somewhat surprisingly, sparse models are fairly robust to mismatches between their training and inference configurations. In Appendix E.4, we explore the effect of training with some original value of $k$ while applying the model at inference time with a different $\boldsymbol { k } ^ { \prime } \neq \boldsymbol { k }$ . This can be handy to control (decrease ≠or increase) the amount of FLOPs per input in a particular production system.
187
+
188
+ # 6 Related work
189
+
190
+ Conditional Computation. To grow the number of model parameters without proportionally increasing the computational cost, conditional computation [5, 15, 12] only activates some relevant parts of the model in an input-dependent fashion, like in decision trees [7]. In deep learning, the activation of portions of the model can use stochastic neurons [6] or reinforcement learning [4, 17, 53].
191
+
192
+ Mixture of Experts. MoEs [31, 34, 10, 66] combine the outputs of sub-models known as experts via a router in an input-dependent way. MoEs have successfully used this form of conditional computation in a range of applications [23, 30, 58, 55, 67]. An input can select either all experts [21] or only a sparse mixture thereof as in recent massive language models [54, 39, 22].
193
+
194
+ MoEs for Language. MoEs have recently scaled language models up to trillions of parameters. Our approach is inspired by [54] who proposed a top- $k$ gating in LSTMs, with auxiliary losses ensuring the expert balance [26]. [39] further scaled up this approach for transformers, showing strong gains for neural machine translation. With over one trillion parameters and one expert per input, [22] sped up pre-training compared to a dense baseline [50] while showing gains thanks to transfer and distillation. [40] alternatively enforced a balanced routing by solving a linear assignment problem.
195
+
196
+ MoEs for Vision. For computer vision, previous work on MoEs [21, 2, 25, 1, 63, 47, 64] focused on architectures whose scale is considerably smaller than that of both language models and our model. In DeepMoE [63], the “experts” are the channels of convolutional layers that are adaptively selected by a multi-headed sparse gate. This is similar to [64] where the kernels of convolutional layers are activated on a per-example basis. Other approaches use shallow MoEs, learning a single router, either disjointly [25] or jointly [2], together with CNNs playing the role of experts. [1] further have a cost-aware procedure to bias the assignments of inputs across the experts. Unlike shallow MoEs, we operate with up to several tens of routing decisions per token along the depth of the model. Scaling up routing depth was marked as a major challenge in [51], which we successfully tackle in our work.
197
+
198
+ # 7 Conclusions
199
+
200
+ We have employed sparse conditional computation to train some of the largest vision models to date, showing significant improvements in representation learning and transfer learning. Alongside V-MoE, we have proposed Batch Prioritized Routing, which allows successful repurposing of model sparsity to introduce sparsity with respect to the inputs. This can be done without further adapting the model, allowing the re-use of trained models with sparse conditional computation.
201
+
202
+ This has interesting connotations for recent work in NLP using sparse models; recent analysis shows model sparsity is the most promising way to reduce model $\mathrm { C O } _ { 2 }$ emissions [46] and that $90 \%$ of the footprint stems from inference costs — we present an algorithm which takes the most efficient models and makes them even more efficient without any further model adaptation.
203
+
204
+ This is just the beginning of conditional computation at scale for vision; extensions include scaling up the expert count, reducing dependency on data and improving transfer of the representations produced by sparse models. Directions relating to heterogeneous expert architectures and conditional variable-length routes should also be fruitful. We expect increasing importance of sparse model scaling, especially in data rich domains such as large scale multimodal or video modeling.
205
+
206
+ # Acknowledgments and Disclosure of Funding
207
+
208
+ We thank Alex Kolesnikov, Lucas Beyer and Xiaohua Zhai for providing continuous help and details about scaling ViT models; Alexey Dosovitskiy, who provided some of the pre-trained ViT models; Ilya Tolstikhin, who suggested placing experts only in the last layers; Josip Djolonga for his early review of the manuscript; Dmitry Lepikhin for providing details about the original GShard implementation; Barret Zoph and Liam Fedus for insightful comments and feedback; James Bradbury, Blake Hechtman and the rest of JAX and TPU team who helped us running our models efficiently, and many others from Google Brain for their support.
209
+
210
+ # References
211
+
212
+ [1] A. Abbas and Y. Andreopoulos. Biased mixtures of experts: Enabling computer vision inference under data transfer limitations. IEEE Trans. Image Processing, 29:7656–7667, 2020.
213
+ [2] K. Ahmed, M. H. Baig, and L. Torresani. Network of experts for large-scale image categorization. In ECCV, 2016.
214
+ [3] A. Arnab, M. Dehghani, G. Heigold, C. Sun, M. Luciˇ c, and C. Schmid. ViViT: A video vision ´ transformer. arXiv preprint arXiv:2103.15691, 2021.
215
+ [4] E. Bengio, P.-L. Bacon, J. Pineau, and D. Precup. Conditional computation in neural networks for faster models. arXiv preprint arXiv:1511.06297, 2015.
216
+ [5] Y. Bengio. Deep learning of representations: Looking forward. In International Conference on Statistical Language and Speech Processing, pages 1–37, 2013.
217
+ [6] Y. Bengio, N. Léonard, and A. Courville. Estimating or propagating gradients through stochastic neurons for conditional computation. arXiv preprint arXiv:1308.3432, 2013.
218
+ [7] L. Breiman, J. Friedman, C. J. Stone, and R. A. Olshen. Classification and regression trees. CRC press, 1984.
219
+ [8] A. Brock, S. De, S. L. Smith, and K. Simonyan. High-performance large-scale image recognition without normalization. arXiv preprint arXiv:2102.06171, 2021.
220
+ [9] T. B. Brown, B. Mann, N. Ryder, M. Subbiah, J. Kaplan, P. Dhariwal, A. Neelakantan, P. Shyam, G. Sastry, A. Askell, et al. Language models are few-shot learners. arXiv preprint arXiv:2005.14165, 2020.
221
+ [10] K. Chen, L. Xu, and H. Chi. Improved learning algorithms for mixture of experts in multiclass classification. Neural networks, 12(9):1229–1252, 1999.
222
+ [11] G. Cheng, J. Han, and X. Lu. Remote sensing image scene classification: Benchmark and state of the art. Proceedings of the IEEE, 105(10):1865–1883, Oct 2017.
223
+ [12] K. Cho and Y. Bengio. Exponentially increasing the capacity-to-computation ratio for conditional computation in deep learning. arXiv preprint arXiv:1406.7362, 2014.
224
+ [13] M. Cimpoi, S. Maji, I. Kokkinos, S. Mohamed, and A. Vedaldi. Describing textures in the wild. In Computer Vision and Pattern Recognition (CVPR), 2014.
225
+ [14] E. D. Cubuk, B. Zoph, J. Shlens, and Q. Le. Randaugment: Practical automated data augmentation with a reduced search space. In H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin, editors, Advances in Neural Information Processing Systems, 2020.
226
+ [15] A. Davis and I. Arel. Low-rank approximations for conditional feedforward computation in deep neural networks. arXiv preprint arXiv:1312.4461, 2013.
227
+ [16] J. Deng, W. Dong, R. Socher, L.-J. Li, K. Li, and L. Fei-Fei. ImageNet: A large-scale hierarchical image database. In CVPR, 2009.
228
+ [17] L. Denoyer and P. Gallinari. Deep sequential neural network. arXiv preprint arXiv:1410.0510, 2014.
229
+ [18] J. Devlin, M.-W. Chang, K. Lee, and K. Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In NAACL, 2019.
230
+ [19] G. S. Dhillon, P. Chaudhari, A. Ravichandran, and S. Soatto. A baseline for few-shot image classification. In ICLR, 2020.
231
+ [20] A. Dosovitskiy, L. Beyer, A. Kolesnikov, D. Weissenborn, X. Zhai, T. Unterthiner, M. Dehghani, M. Minderer, G. Heigold, S. Gelly, J. Uszkoreit, and N. Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. In ICLR, 2021.
232
+ [21] D. Eigen, M. Ranzato, and I. Sutskever. Learning factored representations in a deep mixture of experts. arXiv preprint arXiv:1312.4314, 2013.
233
+ [22] W. Fedus, B. Zoph, and N. Shazeer. Switch transformers: Scaling to trillion parameter models with simple and efficient sparsity. arXiv preprint arXiv:2101.03961, 2021.
234
+ [23] D. M. Gavrila and S. Munder. Multi-cue pedestrian detection and tracking from a moving vehicle. International journal of computer vision, 73(1):41–59, 2007.
235
+ [24] A. Geiger, P. Lenz, and R. Urtasun. Are we ready for autonomous driving? The KITTI vision benchmark suite. In Computer Vision and Pattern Recognition (CVPR), 2012.
236
+ [25] S. Gross, M. Ranzato, and A. Szlam. Hard mixtures of experts for large scale weakly supervised vision. In CVPR, 2017.
237
+ [26] J. V. Hansen. Combining predictors: comparison of five meta machine learning methods. Information Sciences, 119(1-2):91–105, 1999.
238
+ [27] T. Hastie, R. Tibshirani, and J. Friedman. The elements of statistical learning: data mining, inference, and prediction. Springer, 2017.
239
+ [28] P. Helber, B. Bischke, A. Dengel, and D. Borth. EuroSAT: A novel dataset and deep learning benchmark for land use and land cover classification. IEEE Journal of Selected Topics in Applied Earth Observations and Remote Sensing, 12(7):2217–2226, 2019.
240
+ [29] D. Hendrycks and K. Gimpel. Gaussian error linear units (gelus). arXiv preprint arXiv:1606.08415, 2016.
241
+ [30] Y. H. Hu, S. Palreddy, and W. J. Tompkins. A patient-adaptable ECG beat classifier using a mixture of experts approach. IEEE Trans. Biomedical Engineering, 44(9):891–900, 1997.
242
+ [31] R. A. Jacobs, M. I. Jordan, S. J. Nowlan, and G. E. Hinton. Adaptive mixtures of local experts. Neural Computation, 3(1):79–87, 1991.
243
+ [32] Z. Jiang, Q. Hou, L. Yuan, D. Zhou, X. Jin, A. Wang, and J. Feng. Token labeling: Training a $8 5 . 5 \%$ top-1 accuracy vision transformer with 56m parameters on imagenet. arXiv preprint arXiv:2104.10858, 2021.
244
+ [33] J. Johnson, B. Hariharan, L. van der Maaten, F.-F. Li, C. Lawrence Zitnick, and R. Girshick. CLEVR: A diagnostic dataset for compositional language and elementary visual reasoning. In Computer Vision and Pattern Recognition (CVPR), 2017.
245
+ [34] M. I. Jordan and R. A. Jacobs. Hierarchical mixtures of experts and the EM algorithm. Neural computation, 6(2):181–214, 1994.
246
+ [35] Kaggle and EyePacs. Kaggle diabetic retinopathy detection, 2015.
247
+ [36] A. Kolesnikov, L. Beyer, X. Zhai, J. Puigcerver, J. Yung, S. Gelly, and N. Houlsby. Big transfer (BiT): General visual representation learning. In ECCV, 2020.
248
+ [37] A. Krizhevsky. Learning multiple layers of features from tiny images. Technical report, University of Toronto, 2009.
249
+ [38] Y. LeCun, F. J. Huang, and L. Bottou. Learning methods for generic object recognition with invariance to pose and lighting. In Computer Vision and Pattern Recognition (CVPR), 2004.
250
+ [39] D. Lepikhin, H. Lee, Y. Xu, D. Chen, O. Firat, Y. Huang, M. Krikun, N. Shazeer, and Z. Chen. GShard: Scaling giant models with conditional computation and automatic sharding. In ICLR, 2021.
251
+ [40] M. Lewis, S. Bhosale, T. Dettmers, N. Goyal, and L. Zettlemoyer. Base layers: Simplifying training of large, sparse models. arXiv preprint arXiv:2103.16716, 2021.
252
+ [41] F.-F. Li, R. Fergus, and P. Perona. Learning generative visual models from few training examples: An incremental Bayesian approach tested on 101 object categories. Computer Vision and Pattern Recognition Workshop, 2004.
253
+ [42] L. Matthey, I. Higgins, D. Hassabis, and A. Lerchner. dSprites: Disentanglement testing sprites dataset, 2017.
254
+ [43] Y. Netzer, T. Wang, A. Coates, A. Bissacco, and A. Y. Ng. Reading digits in natural images with unsupervised feature learning. In NIPS Workshop on Deep Learning and Unsupervised Feature Learning 2011, 2011.
255
+ [44] M.-E. Nilsback and A. Zisserman. Automated flower classification over a large number of classes. In Sixth Indian Conf. on Computer Vision, Graphics & Image Processing, 2008.
256
+ [45] O. M. Parkhi, A. Vedaldi, A. Zisserman, and C. Jawahar. Cats and dogs. In CVPR, 2012.
257
+ [46] D. Patterson, J. Gonzalez, Q. Le, C. Liang, L.-M. Munguia, D. Rothchild, D. So, M. Texier, and J. Dean. Carbon emissions and large neural network training. arXiv preprint arXiv:2104.10350, 2021.
258
+ [47] S. Pavlitskaya, C. Hubschneider, M. Weber, R. Moritz, F. Huger, P. Schlicht, and M. Zollner. Using mixture of expert models to gain insights into semantic segmentation. In CVPR Workshops, 2020.
259
+ [48] M. E. Peters, M. Neumann, M. Iyyer, M. Gardner, C. Clark, K. Lee, and L. Zettlemoyer. Deep contextualized word representations. In NAACL, 2018.
260
+ [49] H. Pham, Z. Dai, Q. Xie, M.-T. Luong, and Q. V. Le. Meta pseudo labels. arXiv preprint arXiv:2003.10580, 2020.
261
+ [50] C. Raffel, N. Shazeer, A. Roberts, K. Lee, S. Narang, M. Matena, Y. Zhou, W. Li, and P. J. Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. arXiv preprint arXiv:1910.10683, 2019.
262
+ [51] P. Ramachandran and Q. V. Le. Diversity and depth in per-example routing models. In ICLR, 2018.
263
+ [52] C. Rosenbaum, I. Cases, M. Riemer, and T. Klinger. Routing networks and the challenges of modular and compositional computation. arXiv preprint arXiv:1904.12774, 2019.
264
+ [53] C. Rosenbaum, T. Klinger, and M. Riemer. Routing networks: Adaptive selection of non-linear functions for multi-task learning. arXiv preprint arXiv:1711.01239, 2017.
265
+ [54] N. Shazeer, A. Mirhoseini, K. Maziarz, A. Davis, Q. Le, G. Hinton, and J. Dean. Outrageously large neural networks: The sparsely-gated mixture-of-experts layer. In ICLR, 2017.
266
+ [55] C. Sminchisescu, A. Kanaujia, Z. Li, and D. Metaxas. Learning to reconstruct 3D human motion from Bayesian mixtures of experts. A probabilistic discriminative approach. Dept. Comput. Sci., Univ. Toronto, Tech. Rep. CSRG-502, 2004.
267
+ [56] E. Strubell, A. Ganesh, and A. McCallum. Energy and policy considerations for deep learning in NLP. arXiv preprint arXiv:1906.02243, 2019.
268
+ [57] C. Sun, A. Shrivastava, S. Singh, and A. Gupta. Revisiting unreasonable effectiveness of data in deep learning era. In ICCV, 2017.
269
+ [58] J. Tani and S. Nolfi. Learning to perceive the world as articulated: an approach for hierarchical learning in sensory-motor systems. Neural Networks, 12(7-8):1131–1141, 1999.
270
+ [59] H. Touvron, M. Cord, M. Douze, F. Massa, A. Sablayrolles, and H. Jégou. Training data-efficient image transformers & distillation through attention. arXiv preprint arXiv:2012.12877, 2020.
271
+ [60] H. Touvron, M. Cord, A. Sablayrolles, G. Synnaeve, and H. Jégou. Going deeper with image transformers. arXiv preprint arXiv:2103.17239, 2021.
272
+ [61] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, L. Kaiser, and I. Polosukhin. Attention is all you need. In NeurIPS, 2017.
273
+ [62] B. S. Veeling, J. Linmans, J. Winkens, T. Cohen, and M. Welling. Rotation equivariant CNNs for digital pathology. In Medical Image Computing and Computer Assisted Intervention (MICCAI), 2018.
274
+ [63] X. Wang, F. Yu, L. Dunlap, Y.-A. Ma, R. Wang, A. Mirhoseini, T. Darrell, and J. E. Gonzalez. Deep mixture of experts via shallow embedding. In Uncertainty in Artificial Intelligence, 2020.
275
+ [64] B. Yang, G. Bender, Q. V. Le, and J. Ngiam. Condconv: Conditionally parameterized convolutions for efficient inference. arXiv preprint arXiv:1904.04971, 2019.
276
+ [65] L. Yuan, Y. Chen, T. Wang, W. Yu, Y. Shi, F. E. Tay, J. Feng, and S. Yan. Tokens-to-token vit: Training vision transformers from scratch on imagenet. arXiv preprint arXiv:2101.11986, 2021.
277
+ [66] S. E. Yuksel, J. N. Wilson, and P. D. Gader. Twenty years of mixture of experts. IEEE transactions on neural networks and learning systems, 23(8):1177–1193, 2012.
278
+ [67] A. J. Zeevi, R. Meir, and R. J. Adler. Time series prediction using mixtures of experts. In NeurIPS, 1997.
279
+ [68] X. Zhai, A. Kolesnikov, N. Houlsby, and L. Beyer. Scaling vision transformers, 2021.
280
+ [69] X. Zhai, J. Puigcerver, A. Kolesnikov, P. Ruyssen, C. Riquelme, M. Lucic, J. Djolonga, A. S. Pinto, M. Neumann, A. Dosovitskiy, L. Beyer, O. Bachem, M. Tschannen, M. Michalski, O. Bousquet, S. Gelly, and N. Houlsby. A large-scale study of representation learning with the visual task adaptation benchmark. arXiv preprint arXiv:1910.04867, 2019.
281
+ [70] X. Zhai, J. Puigcerver, A. Kolesnikov, P. Ruyssen, C. Riquelme, M. Lucic, J. Djolonga, A. S. Pinto, M. Neumann, A. Dosovitskiy, et al. A large-scale study of representation learning with the visual task adaptation benchmark. arXiv preprint arXiv:1910.04867, 2019.
md/train/Goz-qsH1F14/Goz-qsH1F14.md ADDED
@@ -0,0 +1,288 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Adaptive Machine Unlearning
2
+
3
+ Varun Gupta1, Christopher Jung1, Seth Neel2, Aaron Roth1, Saeed Sharifi-Malvajerdi1, and Chris Waites3
4
+
5
+ 1University of Pennsylvania 2Harvard University 3Stanford University
6
+
7
+ # Abstract
8
+
9
+ Data deletion algorithms aim to remove the influence of deleted data points from trained models at a cheaper computational cost than fully retraining those models. However, for sequences of deletions, most prior work in the non-convex setting gives valid guarantees only for sequences that are chosen independently of the models that are published. If people choose to delete their data as a function of the published models (because they don’t like what the models reveal about them, for example), then the update sequence is adaptive. In this paper, we give a general reduction from deletion guarantees against adaptive sequences to deletion guarantees against non-adaptive sequences, using differential privacy and its connection to max information. Combined with ideas from prior work which give guarantees for non-adaptive deletion sequences, this leads to extremely flexible algorithms able to handle arbitrary model classes and training methodologies, giving strong provable deletion guarantees for adaptive deletion sequences. We show in theory how prior work for non-convex models fails against adaptive deletion sequences, and use this intuition to design a practical attack against the SISA algorithm of Bourtoule et al. [2021] on CIFAR-10, MNIST, Fashion-MNIST.
10
+
11
+ # 1 Introduction
12
+
13
+ Businesses like Facebook and Google depend on training sophisticated models on user data. Increasingly—in part because of regulations like the European Union’s General Data Protection Act and the California Consumer Privacy Act—these organizations are receiving requests to delete the data of particular users. But what should that mean? It is straightforward to delete a customer’s data from a database and stop using it to train future models. But what about models that have already been trained using an individual’s data? These are not necessarily safe; it is known that individual training data can be exfiltrated from models trained in standard ways via model inversion attacks [Shokri et al., 2017, Veale et al., 2018, Fredrikson et al., 2015]. Regulators are still grappling with when a trained model should be considered to contain personal data of individuals in the training set and the potential legal implications. In 2020 draft guidance, the U.K.’s Information Commissioner’s Office addressed how to comply with data deletion requests as they pertain to ML models:
14
+
15
+ If the request is for rectification or erasure of the data, this may not be possible without re-training the model...or deleting the model altogether [ICO, 2020].
16
+
17
+ Fully retraining the model every time a deletion request is received can be prohibitive in terms of both time and money—especially for large models and frequent deletion requests. The problem of data deletion (also known as machine unlearning) is to find an algorithmic middle ground between the compliant but impractical baseline of retraining, and the potentially illegal standard of doing nothing. We iteratively update models as deletion requests come in, with the twin goals of having computational cost that is substantially less than the cost of full retraining, and the guarantee that the models we produce are (almost) indistinguishable from the models that would have resulted from full retraining.
18
+
19
+ After an initial model is deployed deletion requests arrive over time as users make decisions about whether to delete their data. It is easy to see how these decisions may be adaptive with respect to the models. For example, security researchers may publish a new model inversion attack that identifies a specific subset of people in the training data, thus leading to increased deletion requests for people in that subset. In this paper we give the first machine unlearning algorithms that both have rigorous deletion guarantees against these kind of adaptive deletion sequence, and can accommodate arbitrary non-convex models like deep neural networks without requiring pretraining on non-user data.
20
+
21
+ # 1.1 Main Results
22
+
23
+ The deletion guarantees proven for several prior methods crucially rely on the implicit assumption that the points that are deleted are independent of the randomness used to train the models. However this assumption fails unless the sequence of deletion requests is chosen independently of the information that the model provider has made public. This is a very strong assumption, because users may wish to delete their data exactly because of what deployed models reveal about them.
24
+
25
+ We give a generic reduction. We show that if:
26
+
27
+ 1. A data deletion algorithm $\mathcal { R } _ { A }$ for a learning algorithm $\mathcal { A }$ has deletion guarantees for oblivious sequences of deletion requests (as those from past work do), and 2. Information about the internal randomness of $\mathcal { R } _ { A }$ is revealed only in a manner that satisfies differential privacy, then
28
+
29
+ $( \mathcal { A } , \mathcal { R } _ { \mathcal { A } } )$ also satisfies data deletion guarantees against an adaptive sequence of deletion requests, that can depend in arbitrary ways on the information that the model provider has made public.
30
+
31
+ In Section 3, we motivate our main result with a theoretical example which illustrates that past method’s lack of guarantees for adaptive sequences is not simply a failure of analysis, but an actual failure of these methods to satisfy deletion guarantees for adaptive deletion sequences. As an exemplar, we use a variant of SISA from Bourtoule et al. [2021] that satisfies perfect deletion guarantees for non-adaptive deletion sequences and exhibit adaptive deletion sequences that strongly separate the resulting distribution on models compared to the retraining baseline.
32
+
33
+ The generic reduction found in Section 4 can be used to give adaptive data deletion mechanisms for a wide variety of problems by leveraging past work on deletion algorithms for non-adaptive sequences, and a line of work on differentially private aggregation [Papernot et al., 2018, Dwork and Feldman, 2018]. Since prior deletion algorithms themselves tend to use existing learning algorithms in a black-box way, the entire pipeline is modular and easy to bolt-on to existing methods. In Section 5, we show how this can be accomplished by using a variant of the SISA framework of Bourtoule et al. [2021] together with a differentially private aggregation method.
34
+
35
+ In Section 6, we complement our main result with a set of experimental results on CIFAR-10, MNIST, and Fashion-MNIST that demonstrate differential privacy may be useful in giving adaptive guarantees beyond the statement of our theorems. Specifically we show that small amounts of noise addition (insufficient for our theorems to apply) already serve to break the adaptive deletion strategies that we use to falsify the adaptive deletion guarantees in our experiments described in Section 3 and do so at minimal expense in model accuracy.
36
+
37
+ # 1.2 Related Work
38
+
39
+ Data deletion was introduced by Cao and Yang [2015]; we adopt the randomized formulation of Ginart et al. [2019]. Ginart et al. [2019] anticipate the problem of deletion requests that might be correlated with internal state of the algorithm, and define (and propose as a study for future work) robust data deletion which is a data deletion guarantee that holds for adversaries with knowledge of the internal state. Our insight is that we can provide deletion guarantees against adaptive sequences by instead obscuring the internal state of the algorithm using techniques from differential privacy.
40
+
41
+ We are the first to explicitly consider the problem of adaptive sequences of deletion requests, but some techniques from past work do have deletion guarantees that extend to adaptive sequences. Deterministic methods and methods that depend only on randomness that is sampled after the deletion request are already robust to adaptive deletion. This includes techniques that find an approximately optimal solution to a strongly convex problem and then perturb the solution to obscure the optimizer within a small radius e.g. Guo et al. [2019], Neel et al. [2021], Sekhari et al. [2021]. It also includes the approach of Golatkar et al. [2020a,b] which pre-trains a nonconvex model on data that will never be deleted and then does convex fine-tuning on user data on top of that. Techniques whose deletion guarantees depend on randomness sampled at training in general do not have guarantees against adaptive deletions. This includes algorithms given in Ginart et al. [2019], Bourtoule et al. [2021], Neel et al. [2021] — the SISA framework of Bourtoule et al. [2021] being of particular interest as it is agnostic to the class of models and training methodology, and so is extremely flexible.
42
+
43
+ Differential privacy has been used as a mitigation for adaptivity since the work of Dwork et al. [2015c,a]. In machine learning, it has been used to mitigate the bias of adaptive data gathering strategies as used in bandit learning algorithms [Neel and Roth, 2018]. The application that is most similar to our work is Hassidim et al. [2020], which uses differential privacy of the internal randomness of an algorithm (as we do) to reduce streaming algorithms with guarantees against adaptive adversarial streams to streaming algorithms with guarantees against oblivious adversaries. Our techniques differ; while Hassidim et al. [2020] reduce to the so-called “transfer theorem for linear and low sensitivity queries” developed over a series of works Dwork et al. [2015c], Bassily et al. [2021], Jung et al. [2020], we use a more general connection between differential privacy and “max-information” established in Dwork et al. [2015b], Rogers et al. [2016].
44
+
45
+ # 2 Preliminaries
46
+
47
+ Let $\mathcal { Z }$ be the data domain. A dataset $D$ is a multi-set of elements from $\mathcal { Z }$ . We consider update requests of two types: deletion and addition. These update requests are formally defined below, similar to how they are defined in [Neel et al., 2021].
48
+
49
+ Definition 2.1 (Update Operations and Sequences). An update $u$ is a pair $( z , \bullet )$ where $z \in { \mathcal { Z } }$ is $a$ datapoint and $\bullet \in \mathcal { T } = \{ ^ { \prime } \mathbf { a d d } ^ { \prime } , ^ { \prime } \mathbf { d e l e t e } ^ { \prime } \}$ determines the type of the update. An update sequence $U$ is a sequence $( u ^ { 1 } , u ^ { 2 } , \ldots )$ where $u ^ { t } \in \mathcal { Z } \times \mathcal { T }$ for all $t$ . Given a dataset $D$ and an update $u = ( z , \bullet )$ , the update operation is defined as:
50
+
51
+ $$
52
+ D \circ u \triangleq { \left\{ { D \cup \{ z \} } \quad i f \bullet = { ' } { \mathsf { a d d } } ^ { \prime } \right.} _ { D \setminus \{ z \} } _ { i f \bullet = { ' } { \mathsf { d e l e t e } } ^ { \prime } }
53
+ $$
54
+
55
+ Given an update sequence $U = ( u ^ { 1 } , u ^ { 2 } , \ldots ) ;$ , we have $D \circ U \triangleq ( ( ( D \circ u ^ { 1 } ) \circ u ^ { 2 } ) \circ \ldots ) .$ .
56
+
57
+ We use $\Theta$ to denote the space of models. A learning or training algorithm is a mapping $\mathcal { A } : \mathcal { Z } ^ { * } \to \Theta ^ { * }$ that maps a dataset $D \in { \mathcal { Z } } ^ { * }$ to a collection of models $\theta \in \Theta ^ { * }$ . An unlearning or update algorithm for $\mathcal { A }$ is a mapping $\mathcal { R } _ { A } : \mathcal { Z } ^ { * } \times ( \mathcal { Z } \times \mathcal { T } ) \times \mathcal { S } \to \Theta ^ { * }$ which takes in a data set $D \in { \mathcal { Z } } ^ { * }$ , an update request $u \in \mathcal { Z } \times \mathcal { T }$ , and some current state for the algorithms $s \in S$ (the domain $s$ can be arbitrary), and outputs an updated collection of models $\theta ^ { \prime } \in \Theta ^ { * }$ . In this paper we consider a setting in which a stream of update requests arrive in sequence. We note that in this sequential framework, the update algorithm $\mathcal { R } _ { A }$ also updates the state of the algorithm after each update request is processed; however, for notational economy, we do not explicitly write the updated state as an output of the algorithm.
58
+
59
+ At each round, we provide access to the models through a mapping $f _ { \mathrm { p u b l i s h } } ^ { t } : \Theta ^ { * } \to \Psi$ that takes in the collection of models and outputs some object $\psi \in \Psi$ . A published object $\psi \in \Psi$ can, for instance, be the aggregate predictions of the learned models on a data set, or, some aggregation of the models. To model adaptively chosen update sequences, we define an arbitrary “update requester” who interacts with the learning and unlearning algorithms $( \mathcal { A } , \mathcal { R } _ { \mathcal { A } } )$ through the publishing function $f _ { \mathrm { p u b l i s h } }$ in rounds to generate a sequence of updates. The update requester is denoted by UpdReq and defined in Definition 2.2, and the interaction between the algorithms and the update requester is described in Algorithm 1.
60
+
61
+ Throughout we will use $u ^ { t }$ to denote the update request at round $t$ . We will use $D ^ { t }$ to denote the data set at round $t$ : $D ^ { 0 }$ is the initial training data set and for all $t \geq 1$ , $D ^ { t } = D ^ { t - 1 } \circ u ^ { t }$ . We will use $\theta ^ { t }$ to denote the learned models at round $t$ : $\theta ^ { 0 }$ is generated by the initial training algorithm $\mathcal { A }$ , and $\theta ^ { t }$ for $t \geq 1$ denotes the updated models at round $t$ generated by the update algorithm $\mathcal { R } _ { A }$ . $\psi ^ { t }$ denotes the published object at round $t$ : $\psi ^ { t } = f _ { \mathrm { p u b l i s h } } ^ { t } ( \theta ^ { t } )$ .
62
+
63
+ Algorithm 1: Interaction between $( \mathcal { A } , \mathcal { R } _ { \mathcal { A } } )$ and UpdReq
64
+
65
+ <table><tr><td></td><td>1: Input: Data set D</td></tr><tr><td>2:</td><td>Let D°← D.</td></tr><tr><td>3:</td><td>Train 0° ← A(D).</td></tr><tr><td>4:</td><td>Publish y0←pubish(00).</td></tr><tr><td>5:</td><td> Save the initial state so.</td></tr><tr><td>6:</td><td>for t = 1,2,... do</td></tr><tr><td>7:</td><td> The update requester requests a new update, given the history of interaction:</td></tr><tr><td>8:</td><td>ut←UpdReq(o,u¹,1,u², ,ut-1,γt-1).</td></tr><tr><td>9:</td><td>The algorithms update, given ut:</td></tr><tr><td>10:</td><td>Update the models 0t ← RA (Dt-1,ut,st-1).</td></tr><tr><td>11:</td><td>Publish bt ← fpubish (0t).</td></tr><tr><td>12:</td><td>Save the updated state st .</td></tr><tr><td>13:</td><td>Update the data set Dt ← Dt-1 o ut .</td></tr></table>
66
+
67
+ Definition 2.2 (Update Requester (UpdReq)). The update sequence is generated by an update requester which is modeled by a (possibly randomized) mapping UpdReq : $\Psi ^ { * } \times ( \mathcal { Z } \times \mathcal { T } ) ^ { * } ( \mathcal { Z } \times \mathcal { T } )$ that takes as input the history of interaction between herself and the algorithms, and outputs a new update for the current round. Given an update requester UpdReq, algorithms $( \mathcal { A } , \mathcal { R } _ { \mathcal { A } } )$ and publishing functions $\{ f _ { p u b l i s h } ^ { t } \} _ { t }$ , the update sequence $U = \{ u ^ { t } \} _ { t }$ can be written as
68
+
69
+ $$
70
+ \boldsymbol { u } ^ { 1 } = \mathrm { U p d R e q } \left( \boldsymbol { \psi } ^ { 0 } \right) , \boldsymbol { u } ^ { 2 } = \mathrm { U p d R e q } \left( \boldsymbol { \psi } ^ { 0 } , \boldsymbol { u } ^ { 1 } , \boldsymbol { \psi } ^ { 1 } \right) , \boldsymbol { \cdot } , \boldsymbol { \cdot } , \boldsymbol { u } ^ { t } = \mathrm { U p d R e q } \left( \boldsymbol { \psi } ^ { 0 } , \boldsymbol { u } ^ { 1 } , \boldsymbol { \psi } ^ { 1 } , \boldsymbol { \cdot } , \boldsymbol { \cdot } , \boldsymbol { u } ^ { t - 1 } , \boldsymbol { \psi } ^ { t - 1 } \right)
71
+ $$
72
+
73
+ We say an update requester UpdReq is nonadaptive if it is independent of the published objects, i.e., if there exists a mapping UpdR $\mathfrak { s q } ^ { \prime } : ( \mathcal { Z } \times \mathcal { T } ) ^ { \ast } ( \mathcal { Z } \times \mathcal { T } )$ such that for all $t \geq 1$ ,
74
+
75
+ $$
76
+ u ^ { t } = \mathtt { U p d R e q } \left( \psi ^ { 0 } , u ^ { 1 } , \psi ^ { 1 } , u ^ { 2 } , \ldots , u ^ { t - 1 } , \psi ^ { t - 1 } \right) = \mathtt { U p d R e q } ^ { \prime } \left( u ^ { 1 } , u ^ { 2 } , \ldots , u ^ { t - 1 } \right)
77
+ $$
78
+
79
+ This is equivalent to saying that the update sequence is fixed before the interaction occurs.
80
+
81
+ Following [Ginart et al., 2019], we propose the following definition for an unlearning algorithm in the sequential update setting ([Ginart et al., 2019] gives a definition for a single deletion request, whereas here we define a natural extension for an arbitrarily long sequence of deletions, as well as additions, that can be chosen adaptively.). Informally, we require that at every round, and for all possible update requesters, with high probability over the draw of the update sequence, no subset of models resulting from deletion occurs with substantially higher probability than it would have under full retraining.
82
+
83
+ Definition 2.3 $( \alpha , \beta , \gamma )$ -unlearning). We say that $\mathcal { R } _ { A }$ is an $( \alpha , \beta , \gamma )$ -unlearning algorithm for $\mathcal { A }$ if for all datasets $D = D ^ { 0 }$ and all update requesters UpdReq, the following condition holds: For every update step $t \geq 1$ , with probability at least $1 - \gamma$ over the draw of the update sequence $u ^ { \le t } \overset { \cdot } { = } \hat { ( } u ^ { 1 } , \ldots , \overset { \cdot } { u } ^ { t } )$ from UpdReq,
84
+
85
+ $$
86
+ \begin{array} { r } { \forall E \subseteq \Theta ^ { * } : \quad \operatorname* { P r } \left[ \mathcal { R } _ { { \cal A } } \left( D ^ { t - 1 } , u ^ { t } , s ^ { t - 1 } \right) \in E \middle | u ^ { \leq t } \right] \leq e ^ { \alpha } \cdot \operatorname* { P r } \left[ { \cal A } \left( D ^ { t } \right) \in E \right] + \beta } \end{array}
87
+ $$
88
+
89
+ We say $\mathcal { R } _ { A }$ is a nonadaptive $( \alpha , \beta , \gamma )$ -unlearning algorithm for $\mathcal { A }$ if the above condition holds for any nonadaptive UpdReq.
90
+
91
+ Remark 2.1. Our definition of unlearning is reminiscent of differential privacy, but following [Ginart et al., 2019], we ask only for $a$ one-sided guarantee: that the probability of any event under the unlearning scheme is not too much larger than the probability of the same event under full retraining, but not vice versa. The reason is that we do not want there to be events that can substantially increase an observer’s confidence that we did not engage in full retraining, but we do not object to observers who strongly update their beliefs that we did engage in full retraining. Our events $E$ are defined directly over the sets of models in $\Theta ^ { * }$ output by $\mathcal { A }$ and $\mathcal { R } _ { A }$ — note that because of information processing inequalities, this is only stronger than defining events $E$ over the observable outcome space $\Psi$ .
92
+
93
+ # 2.1 Differential Privacy and Max-Information
94
+
95
+ Differential privacy will be a key tool in our results. Let $\mathcal { X }$ denote an arbitrary data domain. We use $x \in \mathcal { X }$ to denote an individual element of $\mathcal { X }$ , and $X \in \mathcal { X } ^ { \ast }$ to denote a collection of elements from $\mathcal { X }$ — which we call a data set. We say two data sets $X , X ^ { \prime } \in { \mathcal { X } } ^ { * }$ are neighboring if they differ in at most one element. We say an algorithm $M : \mathcal { X } ^ { n } \mathcal { O }$ is differentially private if its output distributions on neighboring data sets are close, formalized below.
96
+
97
+ Definition 2.4 (Differential Privacy (DP) [Dwork et al., 2006b,a]). An algorithm $M : \mathcal { X } ^ { m } \mathcal { O }$ is $( \epsilon , \delta )$ -differentially private, if for every neighboring $X$ and $X ^ { \prime }$ , and for every $O \subseteq { \mathcal { O } }$ , we have $\mathrm { P r } \left[ M ( X ) \in O \right] \leq e ^ { \epsilon } \mathrm { P r } \left[ M ( \dot { X } ^ { \prime } ) \in O \right] + \delta$ .
98
+
99
+ We remark at the outset that the “datasets” to which we will eventually ask for differential privacy with respect to will not be the datasets on which our learning algorithms are trained, but will instead be collections of random bits parameterizing our randomized algorithms.
100
+
101
+ Differentially private algorithms are robust to data-independent post-processing:
102
+
103
+ Lemma 2.1 (Post-processing preserves DP [Dwork et al., 2006b]). If $M : \mathcal { X } ^ { m } \mathcal { O }$ is $( \epsilon , \delta )$ - differentially private, then for all $f : \mathcal { O } \mathcal { R }$ , we have $f \circ M : \mathcal { X } ^ { m } \mathcal { R }$ defined by $f \circ M ( X ) =$ $f ( M ( X ) )$ is $( \epsilon , \delta )$ -differentially private.
104
+
105
+ The max-information between two jointly distributed random variables measures how close their joint distribution is to the product of their corresponding marginal distributions.
106
+
107
+ Definition 2.5 (Max-Information [Dwork et al., 2015b]). Let $X$ and $Y$ be jointly distributed random variables over the domain $( \mathcal { X } , \mathcal { Y } )$ . The $\beta$ -approximate max-information between $X$ and $Y$ is:
108
+
109
+ $$
110
+ I _ { \infty } ^ { \beta } ( X ; Y ) = \log \operatorname* { s u p } _ { \substack { E \subseteq ( \mathcal { X } , \mathcal { Y } ) , \operatorname* { P r } [ ( X , Y ) \in E ] > \beta } } \frac { \operatorname* { P r } [ ( X , Y ) \in E ] - \beta } { \operatorname* { P r } [ ( X \otimes Y ) \in E ] }
111
+ $$
112
+
113
+ where $( X \otimes Y )$ represents the product distribution of $X$ and $Y$ .
114
+
115
+ The max-information of an algorithm $M$ that takes a dataset $X$ as input and outputs $M ( X )$ , is defined as the max-information between $X$ and $M ( X )$ for the worst case product distribution over $X$ :
116
+
117
+ Definition 2.6 (Max-Information of an Algorithm [Dwork et al., 2015b]). Let $M : \mathcal { X } ^ { m } \mathcal { O }$ be an Algorithm. We say $M$ has $\beta$ -approximate max-information of $k$ , written $T _ { \infty } ^ { \beta } ( M , m ) \leq k$ , if for every distribution $\mathcal { P }$ over $\mathcal { X }$ , we have $I _ { \infty } ^ { \beta } ( X ; M ( X ) ) \le k$ when $X \sim \mathcal { P } ^ { m }$ .
118
+
119
+ In this paper, we will use the fact that differentially private algorithms have bounded max-information:
120
+
121
+ Theorem 2.1 (DP implies bounded max-information [Rogers et al., 2016]). Let $M : \mathcal { X } ^ { m } \mathcal { O }$ be an $( \epsilon , \delta )$ -differentially private algorithm for $0 < \epsilon \le 1 / 2$ and $0 < \delta < \epsilon$ . Then, $I _ { \infty } ^ { \beta } ( M , m ) =$ $O \left( \epsilon ^ { 2 } m + m \sqrt { \delta / \epsilon } \right) f o r \beta = e ^ { - \epsilon ^ { 2 } m } + O \left( m \sqrt { \delta / \epsilon } \right) .$ .
122
+
123
+ # 3 Falsifying Unlearning Guarantees with Adaptivity
124
+
125
+ In this section we demonstrate that the deletion guarantees of algorithms in the SISA framework [Bourtoule et al., 2021] fail for adaptive deletion sequences. We give a clean toy construction which shows algorithms in the SISA framework fail to have nontrivial adaptive deletion guarantees even in the black-box setting when the models within each shard are not made public, only aggregations of their classification outputs. In the Appendix we experimentally evaluate a more realistic instantiation of this construction.
126
+
127
+ The setting we consider directly corresponds to the setting in which our final algorithms operate: what is made public is the aggregate predictions of the ensemble of models, but not the models themselves. For non-adaptive sequences of deletions, distributed algorithms of the sort described in Section 5 have perfect deletion guarantees. We demonstrate via a simple example that these guarantees dramatically fail for adaptive deletion sequences.
128
+
129
+ Suppose we have a dataset consisting of real-valued points with binary labels $\{ ( x _ { i } , y _ { i } ) \} _ { i = 1 } ^ { 2 n }$ , $x _ { i } \in \mathbb { R } ^ { d }$ $y _ { i } \ \stackrel { - } { \in } \ \{ 0 , 1 \}$ in which there are exactly two copies of each distinct training example. Consider a simplistic classification model, resembling a lookup table, which given a point $x _ { i }$ predicts the label $y _ { i }$ if the model has been trained on $( x _ { i } , y _ { i } )$ and a dummy prediction value " $" \perp "$ otherwise:
130
+
131
+ $$
132
+ f _ { \mathcal { D } } ( x _ { i } ) = \left\{ \begin{array} { l l } { y _ { i } } & { \mathrm { i f } \left( x _ { i } , y _ { i } \right) \in \mathcal { D } , } \\ { \perp } & { \mathrm { o t h e r w i s e } } \end{array} \right.
133
+ $$
134
+
135
+ Consider what happens when the training algorithm randomly partitions this dataset into three pieces and trains such a model on each partition. This constructs an ensemble which, at query time, predicts the class with the majority vote. On this dataset, the ensemble will predict the labels of roughly $2 / 3$ of the training points correctly—that is, exactly those points for which the duplicates have fallen into distinct partitions, so that the ensemble gets the majority vote right.
136
+
137
+ We construct an adaptive adversary who chooses to delete exactly those training points that the ensemble correctly classifies (which are those points for whom the duplicates have fallen into distinct shards). The result is that the model resulting from this deletion sequence will misclassify every remaining training point. Full retraining (because it would rerandomize the partition) would again lead to training accuracy of approximately $2 / 3$ . Recalling that our deletion notion requires that the probability of any event under the unlearning scheme is not much larger than the probability of the same event under full retraining, this demonstrates that there are algorithms in the SISA framework — even if the models are not directly exposed — that do not satisfy $( \alpha , \beta , \gamma )$ -deletion guarantees for any nontrivial value of $\alpha$ . We formalize this below:
138
+
139
+ Theorem 3.1. There are learning and unlearning algorithms in the SISA framework $( \mathcal { A } , \mathcal { R } _ { \mathcal { A } } )$ such that for any $\alpha _ { i }$ , and any $\beta , \gamma < 1 / 4$ , $\mathcal { R } _ { A }$ is not an $( \alpha , \beta , \gamma )$ -unlearning algorithm for $\mathcal { A }$ .
140
+
141
+ A proof of this theorem can be found in the appendix.
142
+
143
+ # 4 A Reduction from Adaptive to Nonadaptive Update Requesters
144
+
145
+ In our analysis we imagine without loss of generality that the learning algorithm $\mathcal { A }$ draws an i.i.d. sequence of random variables $r \sim \mathcal { P } ^ { m }$ (that encodes all the randomness to be used over the course of the updates) from some distribution $\mathcal { P }$ , and passes it to the unlearning algorithm $\mathcal { R } _ { A }$ . Note $r$ is drawn once in the initial training, and given $r$ , $\mathcal { A }$ and $\mathcal { R } _ { A }$ become deterministic mappings. We can also view the state $s ^ { t }$ as a deterministic mapping of $r$ , the update requests so far $u ^ { \le t } = ( \bar { u ^ { 1 } } , \dots , u ^ { t } )$ , and the original data set $D ^ { 0 }$ . We write $s ^ { t } = g ^ { t } \bar { ( } D ^ { 0 } , u ^ { \le t } , r \bar { ) }$ for some deterministic mapping $g ^ { t }$ . We can therefore summarize the trajectory of the algorithms $( \mathcal { A } , \mathcal { R } _ { \mathcal { A } } )$ as follows.
146
+
147
+ In this view, the randomness $r$ used by the learning algorithm $\mathcal { A }$ and the subsequent invocations of the unlearning algorithm $\mathcal { R } _ { A }$ is represented as part of the internal state. Past analyses of unlearning algorithms have crucially assumed that $r$ is statistically independent of the updates $( \dot { u } ^ { 1 } , u ^ { 2 } , \dots )$ (which is the case for non-adaptive update requesters, but not for adaptive update requesters). In the following general theorem, we show that if a learning/unlearning pair satisfies unlearning guarantees against non-adaptive update requesters, and the publishing function is differentially private in the internal randomness $r$ , then the resulting algorithms also satisfy unlearning guarantees against adaptive update requesters. Note that what is important is that the publishing algorithms are differentially private in the internal randomness $r$ , not in the datapoints used for training.
148
+
149
+ Theorem 4.1 (A General Theorem). Fix a pair of learning and unlearning algorithms $( \mathcal { A } , \mathcal { R } _ { \mathcal { A } } )$ and the publishing functions $\{ f _ { p u b l i s h } ^ { t } \} _ { t }$ . Suppose for every round $t$ , the sequence of publishing functions $\{ f _ { p u b l i s h } ^ { t ^ { \prime } } \} _ { t ^ { \prime } \leq t }$ is $( \epsilon , \delta )$ -differentially private in $r \sim \mathcal { P } ^ { m }$ , for $0 < \epsilon \le 1 / 2$ and $0 < \delta < \epsilon$ . Suppose $\mathcal { R } _ { A }$ is a non-adaptive $( \alpha , \beta , \gamma )$ -unlearning algorithm for $\mathcal { A }$ . Then $\mathcal { R } _ { A }$ is an $( \alpha ^ { \prime } , \beta ^ { \prime } , \gamma ^ { \prime } )$ -unlearning algorithm for $\mathcal { A }$ for $\alpha ^ { \prime } = \alpha + \epsilon ^ { \prime } , \beta ^ { \prime } = \beta e ^ { \epsilon ^ { \prime } } + \sqrt { \delta ^ { \prime } } , \gamma ^ { \prime } = \gamma + \sqrt { \delta ^ { \prime } }$ where $\epsilon ^ { \prime } = O \left( \epsilon ^ { 2 } m + m \sqrt { \delta / \epsilon } \right)$ and $\delta ^ { \prime } = e ^ { - \epsilon ^ { 2 } m } + O \left( m \sqrt { \delta / \epsilon } \right) .$ .
150
+
151
+ The proof can be found in the Appendix, but at an intuitive level, it proceeds as follows. Because it does not change the joint distribution on update requests and internal state, we can imagine in our analysis that $r$ is redrawn after each update request from its conditional distribution, conditioned on the observed update sequence so far. Because the publishing function is differentially private in $r$ , by the fact that post-processing preserves differential privacy (Lemma 2.1), so is the update sequence. We may therefore apply the max-information bound (Theorem 2.1), which allows us to relate the conditional distribution on $r$ to its original (prior) distribution $\mathcal { P } ^ { m }$ . But resampling $r$ from $\mathcal { P } ^ { m }$ removes the dependence between $r$ and the update sequence, which places us in the non-adaptive case, and allows us to apply the hypothesized unlearning guarantees for nonadaptive update requesters.
152
+
153
+ Algorithm 2: ${ \mathcal { A } } ^ { \mathrm { d i s t r } }$ : Distributed Learning Algorithm
154
+
155
+ <table><tr><td>Input: dataset D = D° of size n Draw the shards: D = Sampler(D°,p), for every i ∈ [k]. Train the models: 0 = Asingle(D),for every i∈ [k]. Save the state: s°= ({D&#x27;}i∈[k],{}iε[k]) // to be used for the 1st update.</td></tr></table>
156
+
157
+ # 5 Distributed Algorithms
158
+
159
+ In this section, we describe a general family of distributed learning and unlearning algorithms that are in the spirit of the “SISA” framework of Bourtoule et al. [2021] (with one crucial modification). At a high level, the SISA framework operates by first randomly dividing the data into $k$ “shards”, and separately training a model on each shard. When a new point is deleted, it is removed from the shards that contained it, and only the models corresponding to those shards are retrained. The flexibility of this methodology is that the models and training procedures used in each shard can be arbitrary, as can the aggregation done at the end to convert the resulting ensemble into predictions: however these choices are instantiated, this framework gives a $( 0 , 0 , 0 )$ -unlearning algorithm against any non-adaptive update requester (Lemma 5.1). Here we show that if the $k$ shards are selected independently of one another, then we can apply our reduction given in the previous section with $m = k$ and obtain algorithms that satisfy deletion guarantees against adaptive update requesters.
160
+
161
+ A distributed learning algorithm $\mathcal { A } ^ { \mathrm { d i s t r } } : \mathcal { Z } ^ { * } \to \Theta ^ { * }$ is described by a single-shard learning algorithm $\mathcal { A } ^ { \mathrm { s i n g l e } } : \mathcal { Z } ^ { * } \to \Theta$ and a routine Sampler, used to select the points in a shard. Sampler, given a dataset $D$ and some probability $p \in [ 0 , 1 ]$ , includes each element of $D$ in the shard with probability $p$
162
+
163
+ Distributed learning algorithm ${ \mathcal { A } } ^ { \mathrm { d i s t r } }$ creates $k$ independent shards from the dataset $D$ of size $n$ by running Sampler $k$ times and training a model with $\bar { \mathcal { A } } ^ { \mathrm { s i n g l e } }$ on each shard $i \in [ k ]$ to form an ensemble of $k$ models. To emphasize that the randomness across shards is independent, we will instantiate $k$ independent samplers $\mathtt { S a m p l e r } _ { i }$ and training algorithms $\mathcal { A } _ { i } ^ { \mathrm { s i n g l e } }$ for each shard $i \in [ k ]$ . We formally describe ${ \mathcal { A } } ^ { \mathrm { d i s t r } }$ in Algorithm 2.
164
+
165
+ The state $s$ of the unlearning algorithm ${ \mathcal { R } } _ { A ^ { \mathrm { d i s t r } } }$ records the $k$ shards $\{ D _ { i } \} _ { i }$ and the ensemble of $k$ models $\{ \theta _ { i } \} _ { i }$ . Thus $\mathcal { S } = \{ \mathcal { Z } ^ { * } \} ^ { k } \times \Theta ^ { k }$ . As an update request $u$ is received, the update function removes the data point from every shard that contains it (for deletion) or adds the new point to each shard with probability $p$ (for addition). In either case, only the models corresponding to shards that have been updated are retrained using $\mathcal { A } ^ { \mathrm { s i n g l e } }$ . We formally describe ${ \mathcal { R } } _ { A ^ { \mathrm { d i s t r } } }$ in Algorithm 3.
166
+
167
+ First, we show that if the update requester is non-adaptive, ${ \mathcal { R } } _ { A ^ { \mathrm { d i s t r } } }$ is a $( 0 , 0 , 0 )$ -unlearning algorithm: Lemma 5.1. $\mathcal { R } _ { \mathcal { A } ^ { d i s t r } }$ is a non-adaptive $( 0 , 0 , 0 )$ -unlearning algorithm for $\mathcal { A } ^ { d i s t r }$ .
168
+
169
+ Now, by combining Lemma 5.1 and our general Theorem 4.1, we can show the following:
170
+
171
+ Theorem 5.1 (Unlearning Guarantees). If for every round $t$ , the sequence of publishing functions $\{ f _ { p u b l i s h } ^ { t ^ { \prime } } \} _ { t ^ { \prime } \leq t }$ is $( \epsilon , \delta )$ -differentially private in the random seeds $r \sim \mathcal { P } ^ { k }$ of the algorithms for $0 < \epsilon \leq 1 / 2$ and $0 < \delta < \epsilon _ { \cdot }$ , then $\mathcal { R } _ { \mathcal { A } ^ { d i s t r } }$ is an $( \alpha , \beta , \gamma )$ -unlearning algorithm for $\mathcal { A } ^ { d i s t r }$ where
172
+
173
+ $$
174
+ \alpha = O \left( \epsilon ^ { 2 } k + k \sqrt { \delta / \epsilon } \right) , \quad \beta = \gamma = O \left( \sqrt { e ^ { - \epsilon ^ { 2 } k } + k \sqrt { \delta / \epsilon } } \right)
175
+ $$
176
+
177
+ Next, we bound the time complexity of our algorithms:
178
+
179
+ Input: dataset $D ^ { t - 1 }$ , update $u ^ { t } = ( z ^ { t } , \bullet ^ { t } )$ , state $s ^ { t - 1 } = ( \{ D _ { i } ^ { t - 1 } \} _ { i \in [ k ] } , \{ \theta _ { i } ^ { t - 1 } \} _ { i \in [ k ] } )$
180
+ if $\bullet ^ { t } = { } ^ { \prime } \mathtt { d e l e t e } ^ { \prime }$ then $S = \left\{ i \in [ k ] : z ^ { t } \in D _ { i } ^ { t - 1 } \right\} / /$ the shards $z ^ { t }$ belongs to.
181
+ else $S = \{ i \in [ k ] : \mathtt { S a m p l e r } _ { i } ( \{ z ^ { t } \} , p ) \neq \{ \} \} / \prime$ the shards $z ^ { t }$ will be added to.
182
+ Update the shards: $D _ { i } ^ { t } = \left\{ { D _ { i } ^ { t - 1 } \circ u } \right.$ t if ot $i \in S$ se , for every $i \in [ k ]$ .
183
+ Update the models: $\theta _ { i } ^ { t } = \Big \{ \mathcal { A } _ { i } ^ { \mathrm { s i n g l e } } ( D _ { i } ^ { t } )$ if ot $i \in S$ se , for every $i \in [ k ]$ .
184
+ Update the state: $s ^ { t } = ( \{ D _ { i } ^ { t } \} _ { i \in [ k ] } , \{ \theta _ { i } ^ { t } \} _ { i \in [ k ] } ) / /$ to be used for the next update.
185
+ Output: {θti }i∈[k]
186
+
187
+ Theorem 5.2 (Run-time Guarantees). Let $p = 1 / k$ . Suppose the publishing functions satisfy the differential privacy requirement of Theorem 5.1. Let $N ^ { t }$ denote the number of times $\mathcal { R } _ { \mathcal { A } } ^ { d i s t r }$ calls $\mathcal { A } ^ { s i n g l e }$ at round $t$ . We have that $N ^ { 0 } = k$ , and for every round $t \geq 1$ : 1) if the update requester is non-adaptive, for every $\xi$ , with probability at least $1 - \xi$ , $N ^ { t } \leq 1 + \sqrt { 2 \log { ( 1 / \xi ) } }$ . 2) if the update requester is adaptive, for every $\xi$ , with probability at least 1 − ξ, $N ^ { t } \leq 1 + \sqrt { 2 \log { ( ( n + t ) / \xi ) } }$ . Furthermore, for $\xi > \delta ^ { \prime }$ , with probability at least $1 - \xi$ , we have
188
+
189
+ $$
190
+ \begin{array} { c } { { N ^ { t } \leq 1 + \operatorname* { m i n } \left\{ \sqrt { 2 \log \left( 2 ( n + t ) / ( \xi - \delta ^ { \prime } ) \right) } , \sqrt { 2 \epsilon ^ { \prime } + 2 \log \left( 2 / ( \xi - \delta ^ { \prime } ) \right) } \right\} } } \\ { { { } } } \\ { { = O \left( \epsilon ^ { 2 } k + k \sqrt { \delta / \epsilon } \right) a n d \delta ^ { \prime } = e ^ { - \epsilon ^ { 2 } k } + O \left( k \sqrt { \delta / \epsilon } \right) } } \end{array}
191
+ $$
192
+
193
+ The proof can be found in the appendix, but at a high level it proceeds as follows. For a deletion request, we must retrain every shard that contains the point to be deleted. For a non-adaptive deletion request, we retrain one shard in expectation and we can obtain a high probability upper bound by using a Hoeffding bound. In the adaptive case, this may no longer be true, but there are two ways to obtain upper bounds that correspond to the two bounds in our Theorem. We can provide a worst-case upper bound on the number of shards that any of the √ $n$ data points belongs to, which incurs a cost of order $\sqrt { \log n }$ . Alternately, we can apply max-information bounds to reduce to the non-adaptive case, using an argument that is similar to our reduction for deletion guarantees.
194
+
195
+ Remark 5.1. We note that there is an alternative algorithm that one might consider, resulting from group differential privacy. If a learning algorithm satisfies $\frac { \epsilon } { k }$ −differential privacy, a valid unlearning procedure is to do nothing for $k$ updates and then fully retrain on the $( k + 1 ) ^ { t h }$ update. This follows from the −differential privacy guarantee the algorithm will have for groups of size $k$ . Our algorithm substantially outperforms this alternative algorithm as well, namely because our privacy parameter degrades much slower than in this group privacy baseline. Our analysis leverages adaptive composition of privacy across the publishing functions which means that privacy degrades with the square root of the number of updates, while it degrades linearly with group privacy. Consequently the group privacy baseline would require a full retraining every $k$ updates, but our algorithm requires a full retraining only every $k ^ { 2 }$ updates.
196
+
197
+ # 5.1 Private Aggregation
198
+
199
+ We briefly describe how we serve prediction requests by privately aggregating the output of the ensemble of models such that the published predictions are differentially private in the random seeds $r$ . At each round $t$ , while $\mathcal { R } _ { \mathcal { A } } ^ { \mathrm { d i s t r } }$ is waiting for the next update request $\hat { u ^ { t + 1 } }$ , we receive prediction requests $x$ and serve predictions $\hat { y }$ . For each prediction request, we privately aggregate the predictions made by the ensemble of models $\{ \theta _ { i } ^ { t } \} _ { i }$ ; Dwork and Feldman [2018] show several ways to privately aggregate predictions (one simple technique is to use the exponential mechanism to approximate the majority vote). Suppose we aggregate the predictions made by the ensemble of models using PrivatePredi $\mathfrak { L } _ { \epsilon ^ { \prime } } ^ { k } : \bar { \Theta } ^ { k } \times \mathcal { X } \stackrel { \left. } { \right. } \mathcal { Y }$ , which takes in an ensemble of $k$ models and a data point, aggregates predictions from the ensemble models, and outputs a label that is $\epsilon ^ { \prime }$ -differentially private in the models. If we receive $l ^ { t }$ many prediction requests $( x _ { 1 } ^ { t } , \ldots , x _ { l ^ { t } } ^ { t } )$ before our next update request $\boldsymbol u ^ { t + 1 }$ , we can write $( \hat { y } _ { 1 } ^ { t } , \dots , \hat { y } _ { l ^ { t } } ^ { t } ) = f _ { \mathrm { p u b l i s h } } ^ { t } ( \{ \theta _ { i } ^ { t } \} _ { i } )$ where $\begin{array} { r } { \hat { y } _ { j } ^ { t } = \mathtt { P r i v a t e P r e d i c t } _ { \epsilon ^ { \prime } } ^ { k } ( \{ \theta _ { i } ^ { t } \} _ { i } , x _ { j } ^ { t } ) . } \end{array}$ .
200
+
201
+ Theorem 5.1, tells us that desired unlearning parameters $( \alpha , \beta , \gamma )$ can be obtained by guaranteeing that the sequence of predictions is $( \epsilon , \delta )$ differentially private in the models (and hence $r$ ), for target parameters $\epsilon , \delta$ . As we serve prediction requests using PrivatePredict $\mathbf { \Sigma } _ { \epsilon ^ { \prime } } ^ { k }$ our privacy loss will accumulate and eventually exhaust our budget of $( \epsilon , \delta )$ -differential privacy. Hence we must track our accumulated privacy loss in the state of our unlearning algorithm, and when it is exhausted, fully retrain using $\bar { \mathcal { A } } ^ { \mathrm { d i s t r } }$ . This resamples $r$ and hence resets our privacy budget. Standard composition theorems (see Dwork and Roth [2014]) show that we exhaust our privacy budget (and need to fully retrain) every time the number of prediction requests made since the last full retraining exceeds $\left\lfloor { \frac { \epsilon ^ { 2 } } { 8 ( \epsilon ^ { \prime } ) ^ { 2 } \ln ( { \frac { 1 } { \delta } } ) } } \right\rfloor$ We formally describe this process denoted as PrivatePredictionInteraction $( \epsilon ^ { \prime } , \epsilon , \delta , k )$ in the appendix and state its unlearning guarantee in Theorem 5.3.
202
+
203
+ Theorem 5.3. The models $\{ \{ \theta _ { i } ^ { t } \} _ { i } \} _ { t }$ in PrivatePredictionInteraction $( \epsilon ^ { \prime } , \epsilon , \delta , k )$ satisfy $( \alpha , \beta , \gamma )$ -unlearning guarantee for $\mathcal { A } ^ { d i s t r }$ where $\begin{array} { r l r } { \alpha } & { { } = } & { O \left( \epsilon ^ { 2 } k + k \sqrt { \delta / \epsilon } \right) } \end{array}$ and $\beta , \gamma \quad = \quad$ $O \left( \sqrt { e ^ { - \epsilon ^ { 2 } k } + k \sqrt { \delta / \epsilon } } \right)$ , $i f 0 < \epsilon \leq 1 / 2$ and $0 < \delta < \epsilon$ .
204
+
205
+ # 6 Evaluation of Unlearning Guarantees
206
+
207
+ In this section we consider the white-box setting in which the models in each shard are made public. SISA continues to have perfect deletion guarantees against non-adaptive deletion sequences in this setting. Experimental results on CIFAR-10 [Krizhevsky and Hinton, 2009], MNIST [Lecun et al., 1998], and Fashion-MNIST [Xiao et al., 2017] show both the failure of SISA to satisfy adaptive deletion guarantees, and give evidence that differential privacy can mitigate this problem well beyond the setting of our theorems while achieving accuracy only modestly worse than SISA. The code for our experiments can be found at https://github.com/ChrisWaites/adaptive-machine-unlearning.
208
+
209
+ We train SISA with an ensemble of convolutional neural networks on several datasets of points with categorical labels. Given a new point at query time, each model in the ensemble votes on the most likely label and aggregates their votes. The models are exposed publicly. This scheme has perfect non-adaptive deletion guarantees.
210
+
211
+ To construct an adaptive deletion sequence to falsify the hypothesis that the scheme has adaptive deletion guarantees, we exploit the observation that neural networks are often overconfident in the correct label for points on which they have been trained. For each training point, we guess that it falls into the shard corresponding to the model that has the highest confidence for the correct label. We then delete points for which we guess that they fall into the first $k / 2$ of the shards, and do not delete any others. After deleting the targeted points, we compute a test statistic: the indicator of whether the average accuracy of the models from the targeted shards is lower than the average accuracy of the models from the non-targeted shards. Under full retraining, by the symmetry of the random partition, the expectation of this test statistic is 0.5. Thus under the null hypothesis that the deletion algorithm satisfies perfect deletion guarantees, the test statistic also has expectation 0.5. Therefore, to the extent that the expectation of the indicator differs from 0.5, we falsify the null hypothesis that SISA has adaptive data deletion guarantees, and larger deviations from 0.5 falsify weaker deletion guarantees.
212
+
213
+ We run this experiment on three datasets (CIFAR-10, MNIST, and Fashion-MNIST), and plot the results in Figure 1. We then repeat the experiment by adding various amounts of noise to the gradients in the model training process to guarantee finite levels of differential privacy (though much weaker privacy guarantees than would be needed to invoke our theorems). We observe that on each dataset, modest amounts of noise are sufficient to break our attack (i.e. $9 5 \%$ confidence intervals for the expectation of our indicator include 0.5, and hence fail to falsify the null hypothesis) while still approaching the accuracy of our models trained without differential privacy. This is also plotted in Figure 1. This gives evidence that differential privacy can improve deletion guarantees in the presence of adaptivity even in regimes beyond which our theory gives nontrivial guarantees.
214
+
215
+ Full experimental details can be found in the appendix.
216
+
217
+ ![](images/44fba5964c6c783ca2ae42a63a10ae0552b68072bfa7bccf8697ae8c62cbba64.jpg)
218
+ Figure 1: The top row and bottom row show experiments with $k = 6$ and $k = 2$ shards respectively. The 3 columns report on 3 datasets. The $x$ axis denotes estimated expectation of our test statistic (the null hypothesis is expectation 0.5). The $y$ axis denotes the accuracy of the ensemble after deletion. Each point is annotated with the noise multiplier used in DP-SGD, the standard deviation of Gaussian noise applied to gradients during training. A label of 0.0 for a point represents the baseline case of no noise (original SISA algorithm). Points are affixed with $9 5 \%$ confidence intervals along both axes (over the randomness of repeating the training/deletion experiment). Horizontal confidence intervals that overlap the line denoting expectation 0.5 fail to reject the null hypothesis that the algorithm has adaptive data deletion guarantees at $p \leq 0 . 0 5$ . We get to this point with a level of noise addition that results in only a modest degradation in ensemble performance compared to SISA.
219
+
220
+ # 7 Conclusion and Discussion
221
+
222
+ We identify an important blindspot in the data deletion literature (the tenuous implicit assumption that deletion requests are independent of previously released models), and provide a very general methodology to reduce adaptive deletion guarantees to oblivious deletion guarantees. Through this reduction we get the first model and training algorithm agnostic methodology that allows for deletion of arbitrary sequences of adaptively chosen points while giving rigorous guarantees. The constants that our theorems inherit from the max information bounds of Rogers et al. [2016] are such that in most realistic settings they will not give useful parameters. But we hope that these constants will be improved in future work, and we give empirical evidence that differential privacy mitigates adaptive deletion “attacks” at very practical levels, beyond the promises of our theoretical results. We note that like for differential privacy, the $( \alpha , \beta , \gamma )$ -deletion guarantees we give in this paper are parameterized, and are not meaningful absent a specification of those parameters. There is a risk with such technologies that they will be used with large values of the parameters that give only very weak guarantees, but will be described publicly in a way that glosses over this issue. We therefore recommend that if adopted in deployed products, deletion guarantees always be discussed in public in a way that is precise about what they promise, including the relevant parameter settings.
223
+
224
+ # Acknowledgements
225
+
226
+ V.G., C.J., A.R., and S.S. were supported in part by NSF grants CCF-1934876 and AF-1763307, and a grant from the Simons Foundation.
227
+
228
+ # References
229
+
230
+ Raef Bassily, Kobbi Nissim, Adam Smith, Thomas Steinke, Uri Stemmer, and Jonathan Ullman. Algorithmic stability for adaptive data analysis. SIAM Journal on Computing, (0):STOC16–377, 2021.
231
+
232
+ Lucas Bourtoule, Varun Chandrasekaran, Christopher Choquette-Choo, Hengrui Jia, Adelin Travers, Baiwu Zhang, David Lie, and Nicolas Papernot. Machine unlearning. In Proceedings of the 42nd IEEE Symposium on Security and Privacy, San Francisco, CA., 2021.
233
+
234
+ 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. URL http://github.com/google/jax.
235
+
236
+ Yinzhi Cao and Junfeng Yang. Towards making systems forget with machine unlearning. In 2015 IEEE Symposium on Security and Privacy, pages 463–480. IEEE, 2015.
237
+
238
+ Cynthia Dwork and Vitaly Feldman. Privacy-preserving prediction. CoRR, abs/1803.10266, 2018. URL http://arxiv.org/abs/1803.10266.
239
+
240
+ Cynthia Dwork and Aaron Roth. The algorithmic foundations of differential privacy. Foundations and Trends® in Theoretical Computer Science, 9(3–4):211–407, 2014.
241
+
242
+ Cynthia Dwork, Krishnaram Kenthapadi, Frank McSherry, Ilya Mironov, and Moni Naor. Our data, ourselves: Privacy via distributed noise generation. In Annual International Conference on the Theory and Applications of Cryptographic Techniques, pages 486–503. Springer, 2006a.
243
+
244
+ Cynthia Dwork, Frank McSherry, Kobbi Nissim, and Adam Smith. Calibrating noise to sensitivity in private data analysis. In Theory of cryptography conference, pages 265–284. Springer, 2006b.
245
+
246
+ Cynthia Dwork, Vitaly Feldman, Moritz Hardt, Toniann Pitassi, Omer Reingold, and Aaron Roth. The reusable holdout: Preserving validity in adaptive data analysis. Science, 349(6248):636–638, 2015a.
247
+
248
+ Cynthia Dwork, Vitaly Feldman, Moritz Hardt, Toniann Pitassi, Omer Reingold, and Aaron Roth. Generalization in adaptive data analysis and holdout reuse. In Proceedings of the 28th International Conference on Neural Information Processing Systems-Volume 2, pages 2350–2358, 2015b.
249
+
250
+ Cynthia Dwork, Vitaly Feldman, Moritz Hardt, Toniann Pitassi, Omer Reingold, and Aaron Leon Roth. Preserving statistical validity in adaptive data analysis. In Proceedings of the forty-seventh annual ACM symposium on Theory of computing, pages 117–126, 2015c.
251
+
252
+ Matt Fredrikson, Somesh Jha, and Thomas Ristenpart. Model inversion attacks that exploit confidence information and basic countermeasures. In Indrajit Ray, Ninghui Li, and Christopher Kruegel, editors, Proceedings of the 22nd ACM SIGSAC Conference on Computer and Communications Security, Denver, CO, USA, October 12-16, 2015, pages 1322–1333. ACM, 2015. doi: 10.1145/ 2810103.2813677. URL https://doi.org/10.1145/2810103.2813677.
253
+
254
+ Antonio Ginart, Melody Y. Guan, Gregory Valiant, and James Zou. Making AI forget you: Data deletion in machine learning. CoRR, abs/1907.05012, 2019. URL http://arxiv.org/abs/ 1907.05012.
255
+
256
+ Aditya Golatkar, Alessandro Achille, Avinash Ravichandran, Marzia Polito, and Stefano Soatto. Mixed-privacy forgetting in deep networks. arXiv preprint arXiv:2012.13431, 2020a.
257
+
258
+ Aditya Golatkar, Alessandro Achille, and Stefano Soatto. Forgetting outside the box: Scrubbing deep networks of information accessible from input-output observations. In European Conference on Computer Vision, pages 383–398. Springer, 2020b.
259
+
260
+ Chuan Guo, Tom Goldstein, Awni Hannun, and Laurens van der Maaten. Certified data removal from machine learning models. arXiv preprint arXiv:1911.03030, 2019.
261
+
262
+ Avinatan Hassidim, Haim Kaplan, Yishay Mansour, Yossi Matias, and Uri Stemmer. Adversarially robust streaming algorithms via differential privacy. In Hugo Larochelle, Marc’Aurelio Ranzato, Raia Hadsell, Maria-Florina Balcan, and Hsuan-Tien Lin, editors, Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020. URL https://proceedings.neurips. cc/paper/2020/hash/0172d289da48c48de8c5ebf3de9f7ee1-Abstract.html.
263
+
264
+ The U.K. Information Commissioner’s Office ICO. Guidance on the ai auditing framework. Draft Consultation, 2020. URL https://ico.org.uk/media/about-the-ico/consultations/ 2617219/guidance-on-the-ai-auditing-framework-draft-for-consultation.pdf.
265
+
266
+ Christopher Jung, Katrina Ligett, Seth Neel, Aaron Roth, Saeed Sharifi-Malvajerdi, and Moshe Shenfeld. A new analysis of differential privacy’s generalization guarantees. In 11th Innovations in Theoretical Computer Science Conference (ITCS 2020), volume 151, page 31. Schloss Dagstuhl– Leibniz-Zentrum fuer Informatik, 2020.
267
+
268
+ Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. 2009.
269
+
270
+ Yann Lecun, Léon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document recognition. In Proceedings of the IEEE, pages 2278–2324, 1998.
271
+
272
+ Seth Neel and Aaron Roth. Mitigating bias in adaptive data gathering via differential privacy. In International Conference on Machine Learning, pages 3720–3729. PMLR, 2018.
273
+
274
+ Seth Neel, Aaron Roth, and Saeed Sharifi-Malvajerdi. Descent-to-delete: Gradient-based methods for machine unlearning. In Algorithmic Learning Theory, pages 931–962. PMLR, 2021.
275
+
276
+ Nicolas Papernot, Shuang Song, Ilya Mironov, Ananth Raghunathan, Kunal Talwar, and Úlfar Erlingsson. Scalable private learning with pate, 2018.
277
+
278
+ Nicolas Papernot, Abhradeep Thakurta, Shuang Song, Steve Chien, and Ulfar Erlingsson. Tempered sigmoid activations for deep learning with differential privacy. The 35th AAAI Conference on Artificial Intelligence, 2021.
279
+
280
+ Ryan Rogers, Aaron Roth, Adam Smith, and Om Thakkar. Max-information, differential privacy, and post-selection hypothesis testing. In 2016 IEEE 57th Annual Symposium on Foundations of Computer Science (FOCS), pages 487–494. IEEE, 2016.
281
+
282
+ Ayush Sekhari, Jayadev Acharya, Gautam Kamath, and Ananda Theertha Suresh. Remember what you want to forget: Algorithms for machine unlearning. arXiv preprint arXiv:2103.03279, 2021.
283
+
284
+ Reza Shokri, Marco Stronati, Congzheng Song, and Vitaly Shmatikov. Membership inference attacks against machine learning models. In 2017 IEEE Symposium on Security and Privacy (SP), pages 3–18. IEEE, 2017.
285
+
286
+ Michael Veale, Reuben Binns, and Lilian Edwards. Algorithms that remember: Model inversion attacks and data protection law. CoRR, abs/1807.04644, 2018. URL http://arxiv.org/abs/ 1807.04644.
287
+
288
+ Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms. 2017.
md/train/H1faSn0qY7/H1faSn0qY7.md ADDED
@@ -0,0 +1,486 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DL2: TRAINING AND QUERYING NEURAL NETWORKS WITH LOGIC
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ We present DL2, a system for training and querying neural networks with logical constraints. DL2 is more expressive than prior work and can capture a richer class of constraints on inputs, outputs and internals of models. Using DL2, one can declaratively specify domain knowledge to be enforced during training or pose queries on the model with the goal of finding inputs that satisfy a given constraint. DL2 works by translating logical constraints into a differentiable loss with desirable mathematical properties, then minimized with standard gradient-based methods. Our evaluation demonstrates that DL2 can express interesting constraints beyond the reach of prior work, leading to improved prediction accuracy.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ With the success of neural networks across a wide range of important application domains, a key challenge that has emerged is that of making neural networks more reliable. Promising directions to address this challenge are incorporating constraints during training (Madry et al., 2017; Minervini et al., 2017) and inspecting already trained networks by posing specific queries (Goodfellow et al., 2014b; Pei et al., 2017; Xu et al., 2018)). While useful, these approaches are described and hardcoded to particular kinds of constraints, making their application to other settings difficult.
12
+
13
+ Inspired by prior work (e.g., Cohen et al. (2017); Fu & Su (2016); Hu et al. (2016); Bach et al. (2017)), we introduce a new method and system, called DL2 (acronym for Deep Learning with Differentiable Logic), which can be used to: (i) query networks for inputs meeting constraints, and (ii) train networks to meet logical specifications, all in a declarative fashion. Our constraint language can express rich combinations of arithmetic comparisons over inputs, neurons and outputs of neural networks using negations, conjunctions, and disjunctions. Thanks to its expressiveness, DL2 enables users to enforce domain knowledge during training or interact with the network in order to learn about its behavior via querying.
14
+
15
+ DL2 works by translating logical constraints into non-negative loss functions with two key properties: (P1) a value where the loss is zero is guaranteed to satisfy the constraints, and (P2) the resulting loss is differentiable almost everywhere. Combined, these properties enable us to solve the problem of querying or training with constraints by minimizing a loss with off-the-shelf optimizers.
16
+
17
+ Training with DL2 To make optimization tractable, we exclude constraints on inputs that capture convex sets and include them as constraints to the optimization goal. We then optimize with projected gradient descent (PGD), shown successful for training with robustness constraints (Madry et al., 2017). The expressiveness of DL2 along with tractable optimization through PGD enables us to train with new, interesting constraints. For example, we can express constraints over probabilities which are not explicitly computed by the network. Consider the following:
18
+
19
+ $$
20
+ \forall x . p _ { p e o p l e } ^ { \theta } ( x ) < \epsilon \lor p _ { p e o p l e } ^ { \theta } ( x ) > 1 - \epsilon
21
+ $$
22
+
23
+ This constraint, in the context of CIFAR-100, says that for any network input $_ { \textbf { \em x } }$ (network is parameterized by $\theta$ ), the probability of people $( p _ { p e o p l e } )$ is either very small or very large. However, CIFAR-100 does not have the class people, and thus we define it as a function of other probabilities, in particular: $p _ { p e o p l e } = p _ { b a b y } + p _ { b o y } + p _ { g i r l } + p _ { m a n } + p _ { w o m a n }$ . We show that with a similar constraint (but with 20 classes), DL2 increases the prediction accuracy of CIFAR-100 networks in the semi-supervised setting, outperforming prior work whose expressiveness is more restricted.
24
+
25
+ DL2 can capture constraints arising in both, classification and regression tasks. For example, GalaxyGAN (Schawinski et al., 2017), a generator of galaxy images, requires the network to respect constraints imposed by the underlying physical systems, e.g., flux: the sum of input pixels should equal the sum of output pixels. Instead of hardcoding such a constraint into the network in an ad hoc way, with DL2, this can now be expressed declaratively: $s u m ( \pmb { x } ) = s u m ( \mathrm { G a l a x y G A N } ( \pmb { x } ) )$ .
26
+
27
+ Global training A prominent feature of DL2 is its ability to train with constraints that place restrictions on inputs outside the training set. Prior work on training with constraints (e.g., $\mathrm { X u }$ et al. (2018)) focus on the given training set to locally train the network to meet the constraints. With DL2, we can, for the first time, query for inputs which are outside the training set, and use them to globally train the network. Previous methods that trained on examples outside the training set were either tailored to a specific task (Madry et al., 2017) or types of networks (Minervini et al., 2017). Our approach splits the task of global training between: (i) the optimizer, which trains the network to meet the constraints for the given inputs, and (ii) the oracle, which provides the optimizer with new inputs that aim to violate the constraints. To illustrate, consider the following Lipshcitz condition:
28
+
29
+ $$
30
+ \forall z ^ { 1 } \in L _ { \infty } ( { \pmb x } ^ { 1 } , { \epsilon } ) , z ^ { 2 } \in L _ { \infty } ( { \pmb x } ^ { 2 } , { \epsilon } ) . | | p ^ { \theta } ( z ^ { 1 } ) - p ^ { \theta } ( z ^ { 2 } ) | | _ { 2 } < L | | z ^ { 1 } - z ^ { 2 } | | _ { 2 }
31
+ $$
32
+
33
+ Here, for two inputs from the training set $( \pmb { x } ^ { 1 } , \pmb { x } ^ { 2 } )$ , any point in their $\epsilon$ -neighborhood $( z ^ { 1 } , z ^ { 2 } )$ must satisfy the condition. This constraint is inspired by recent works (e.g., Gouk et al. (2018); Balan et al. (2017)) which showed that neural networks are more stable if satisfying the Lipschitz condition.
34
+
35
+ Querying with DL2 We also designed an SQL-like language which enables users to interact with the model by posing declarative queries. For example, consider the scenarios studied by a recent work (Song et al., 2018) where authors show how to generate adversarial examples with ACGANs (Odena et al., 2016). The generator is used to create images from a certain class (e.g., 1) which fools a classifier (to classify as, e.g., 7). With DL2, this can be phrased as:
36
+
37
+ fi n d n[100]
38
+ where n i n [-1, 1], c l a s s (M_NN1(M_ACGAN_G(n, 1))) = 7
39
+ r e t u r n M_ACGAN_G(n, 1)
40
+
41
+ ![](images/92fde2c7bf94bd5f1907cf62453797c0c513eec3a29a89bad96f813a6c31a6f8.jpg)
42
+
43
+ This query aims to find an input $ { \mathbf { n } } \in \mathbb { R } ^ { 1 0 0 }$ to the generator satisfying two constraints: its entries are between $- 1$ and 1 (enforcing a domain constraint) and it results in the generator producing an image, which it believes to be classified as 1 (enforced by $\mathbb { M } \_ \mathbb { A } \mathbb { C } \mathbb { G } \mathbb { A } \mathbb { N } \_ \mathbb { G } \left( \mathrm { n } , \quad \mathrm { 1 } \right) ,$ ) but is classified by the network (M_NN1) as 7. DL2 automatically translates this query to a DL2 loss and optimizes it with an off-the-shelf optimizer (L-BFGS-B) to find solutions, in this case, the image to the right. Our language can naturally capture many prior works at the declarative level, including finding neurons responsible for a given prediction (Olah et al., 2018), inputs that differentiate two networks (Pei et al., 2017), and adversarial example generation (e.g., Szegedy et al. (2013)).
44
+
45
+ Main Contributions The DL2 system is based on the following contributions:
46
+
47
+ • An approach for training and querying neural networks with logical constraints based on translating these into a differentiable loss with desirable properties ((P1) and (P2)). • A training procedure which extracts constraints on inputs that capture convex sets and includes them as PGD constraints, making optimization tractable. • A declarative language for posing queries over neural network’s inputs, outputs, and internal neurons. Queries are compiled into a differentiable loss and optimized with L-BFGS-B. An extensive evaluation demonstrating the effectiveness of DL2 in querying and training neural networks. Among other experimental results, we show for the first time, the ability to successfully train networks with constraints on inputs not in the training set.
48
+
49
+ # 2 RELATED WORK
50
+
51
+ Adversarial example generation (Pei et al., 2017; Goodfellow et al., 2014b) can be seen as a fixed query to the network, while adversarial training (Madry et al., 2017) aims to enforce a specific constraint. Most works aiming to train networks with logic impose soft constraints, often through an additional loss (Pathak et al., 2015; Xu et al., 2018); (Marquez-Neila et al., 2017) shows that hard ´ constraints have no empirical advantage over soft constraints. Probabilistic Soft Logic (PSL) (Kimmig et al., 2012) translates logic into continuous functions over [0, 1]. As we show, PSL is not amenable to gradient-based optimization as gradients may easily become zero. Hu et al. (2016) builds on PSL and presents a teacher-student framework which distills rules into the training phase. The idea is to formulate rule satisfaction as a convex problem with a closed-form solution. However, this formulation is restricted to rules over random variables and cannot express rules over probability distributions. In contrast, DL2 can express such constraints, e.g., $p _ { 1 } > p _ { 2 }$ , which requires the network probability for class 1 is greater than for 2. Also, the convexity and the closed-form solution stem from the linearity of the rules in the network’s output, meaning that non-linear constraints (e.g., Lipschitz condition, expressible with DL2) are fundamentally beyond the reach of this method. The work of Xu et al. (2018) is also restricted to constraints over random variables and is intractable for complicated constraints. Fu & Su (2016) reduces the satisfiability of floating-point formulas into numerical optimization, however, their loss is not differentiable and they do not support constraints on distributions. Finally, unlike DL2, no prior work supports constraints for regression tasks.
52
+
53
+ # 3 FROM LOGIC TO A DIFFERENTIABLE LOSS
54
+
55
+ We now present our constraint language and show how to translate constraints into a differentiable loss. To simplify presentation, we treat all tensors as vectors with matching dimensions.
56
+
57
+ Logical Language Our language consists of quantifier-free constraints which can be formed with conjunction $( \wedge )$ , disjunction (∨) and negation $( \neg )$ . Atomic constraints (literals) are comparisons $\Join$ of terms (here $\bowtie \in \{ = , \neq , \leq , < , \geq , > \} )$ ). Comparisons are defined for scalars and applied elementwise on vectors. A term $\pmb { t }$ is: (i) A variable $_ z$ or a constant $^ c$ , representing real-valued vectors; constants can be samples from the dataset. (ii) An expression over terms, including arithmetic expressions or function applications $f \colon { \mathbb { R } } ^ { m } \ \to \ { \mathbb { R } } ^ { n }$ , for $m , n \in \mathbb { Z } ^ { + }$ . Functions can be defined overvariables, constants, and network parameters $\theta ^ { 1 } , \ldots , \theta ^ { l }$ . Functions can be the application of a network with parameters $\theta$ , the application of a specific neuron, or a computation over multiple networks. The only assumption on functions is that they are differentiable (almost everywhere) in the variables and network parameters. We write $\pmb { t } ( z ^ { 1 } , \cdot \cdot . . , z ^ { k } , c ^ { 1 } , \cdot \cdot . . , c ^ { j } , \theta ^ { 1 } , \cdot . . . \theta ^ { l } )$ to emphasize the variables, constants, and network parameters that $\pmb { t }$ can be defined over (that is, $\pmb { t }$ may refer to only a subset of these symbols). We sometimes omit the constants and network parameters (which are also constant) and abbreviate variables by $\bar { z }$ , i.e., we write $\pmb { t } ( \bar { z } )$ . Similarly, we write $\varphi ( \bar { z } )$ to denote a constraint defined over variables $\bar { z }$ . When variables are not important, we write $\varphi$ .
58
+
59
+ Translation into loss Given a formula $\varphi$ , we define the corresponding loss $\mathcal { L } ( \varphi )$ recursively on the structure of $\varphi$ . The obtained loss is non-negative: for any assignment $\bar { x }$ to the variables $\bar { z }$ , we have $\mathcal { L } ( \varphi ) ( \bar { x } ) \in \dot { \mathbb { R } } ^ { \geq 0 }$ . Further, the translation has two properties: (P1) any $\bar { x }$ for which the loss is zero $( \mathcal { L } ( \varphi ) ( \bar { x } ) = 0 )$ ) is a satisfying assignment to $\varphi$ (denoted by ${ \bar { x } } \models \varphi ,$ ) and (P2) the loss is differentiable almost everywhere. This construction avoids pitfalls of other approaches (see Appendix B). We next formally define the translation rules. Formula $\varphi$ is parametrized by $\xi > 0$ which denotes tolerance for strict inequality constraints. Since comparisons are applied element-wise (i.e., on scalars), atomic constraints are transformed into a conjunction of scalar comparisons:
60
+
61
+ $$
62
+ \begin{array} { l l l } { { { \mathcal L } ( t ^ { 1 } \bowtie t ^ { 2 } ) } } & { { : = } } & { { { \mathcal L } \left( \bigwedgesideset { } { ^ n } { ^ n } t _ { i } ^ { 1 } \bowtie t _ { i } ^ { 2 } \right) } } \end{array}
63
+ $$
64
+
65
+ The comparisons $=$ and $\leq$ are translated based on a function $d \colon \mathbb { R } \times \mathbb { R } \to \mathbb { R }$ which is a continuous, differentiable almost everywhere, distance function with $d ( x _ { 1 } , x _ { 2 } ) { \geq } 0$ and $d ( x _ { 1 } , x _ { 2 } ) { = } 0 x _ { 1 } { = } x _ { 2 }$ :
66
+
67
+ $$
68
+ { \mathcal { L } } ( t ^ { 1 } = t ^ { 2 } ) \quad : = \quad d ( t ^ { 1 } , t ^ { 2 } ) ; \qquad { \mathcal { L } } ( t ^ { 1 } \leq t ^ { 2 } ) \quad : = \quad \mathbf { 1 _ { t ^ { 1 } > t ^ { 2 } } } \cdot d ( t ^ { 1 } , t ^ { 2 } )
69
+ $$
70
+
71
+ Here, $\mathbf { 1 } _ { \mathrm { t } ^ { 1 } > \mathrm { t } ^ { 2 } }$ is an indicator function: it is $1$ if $t ^ { 1 } > t ^ { 2 }$ , and 0 otherwise. The function $d$ is a parameter of the translation and in our implementation we use the absolute distance $| t ^ { 1 } - t ^ { 2 } |$ . For the other comparisons, we define the loss as follows: $\mathcal { L } ( t ^ { 1 } < t ^ { 2 } ) = \mathcal { L } ( t ^ { 1 } + \xi \le t ^ { 2 } )$ , $\mathcal { L } ( t ^ { 1 } \neq t ^ { 2 } ) = \mathcal { L } ( t ^ { 1 } <$ $t ^ { 2 } \vee t ^ { 2 } < t ^ { 1 } $ ), and $\mathcal { L } ( t ^ { 1 } > t ^ { 2 } )$ and ${ \mathcal { L } } ( t ^ { 1 } \geq t ^ { 2 } )$ are defined analogously.
72
+
73
+ Conjunctions and disjunctions of formulas $\varphi$ and $\psi$ are translated into loss as follows:
74
+
75
+ $$
76
+ { \mathcal { L } } ( \varphi \wedge \psi ) \ : = \ { \mathcal { L } } ( \varphi ) + { \mathcal { L } } ( \psi ) ; \qquad { \mathcal { L } } ( \varphi \vee \psi ) \ : = \ { \mathcal { L } } ( \varphi ) \cdot { \mathcal { L } } ( \psi )
77
+ $$
78
+
79
+ Note that ${ \mathcal { L } } ( \varphi \wedge \psi ) = 0$ if and only if $\mathcal { L } ( \varphi ) = 0$ and ${ \mathcal { L } } ( \psi ) = 0$ , which by construction is true if $\varphi$ and $\psi$ are satisfied, and similarly ${ \mathcal { L } } ( \varphi \vee \psi ) = 0$ if and only if $\mathcal { L } ( \varphi ) = 0$ or $\mathcal { L } ( \psi ) = 0$ .
80
+
81
+ Translating negations Negations are handled by first eliminating them from the constraint through rewrite rules, and then computing the loss of their equivalent, negation-free constraint. Negations of atomic constraints are rewritten to an equivalent atomic constraint that has no negation (note that $\neq$ is not a negation). For example, the constraint $\neg ( t ^ { 1 } \leq t ^ { 2 } )$ is rewritten to $t ^ { 2 } < \bar { t } ^ { 1 }$ , while negations of conjunctions and disjunctions are rewritten by repeatedly applying De Morgan’s laws: $\neg ( \varphi \land \psi )$ is equivalent to $\neg \varphi \lor \neg \psi$ and $\lnot ( \varphi \lor \psi )$ is equivalent to $\neg \varphi \land \neg \psi$ .
82
+
83
+ With our construction, we get the following theorem:
84
+
85
+ Theorem 1 For all $\bar { x }$ , if ${ \mathcal { L } } ( \varphi ) ( { \bar { x } } ) = 0$ , then $\bar { x }$ satisfies $\varphi$ $( { \bar { x } } \Vdash \varphi )$ . Conversely, for any $\varphi$ , there is a $\delta ( \xi ) \geq 0$ with $\begin{array} { r } { \operatorname* { l i m } _ { \xi \to 0 } \delta ( \xi ) = 0 } \end{array}$ such that for all $\bar { x }$ , ${ \mathcal { L } } ( \varphi ) ( { \bar { x } } ) > \delta ( \xi )$ implies that $\bar { x }$ does not satisfy $\varphi ( { \bar { x } } \not \in \varphi )$ .
86
+
87
+ Essentially, as we make $\xi$ smaller (and $\delta$ approaches 0), we get closer to an if and only if theorem: if $\bar { x }$ makes the loss 0, then we have a satisfying assignment; otherwise, if $\bar { x }$ makes the loss $> \delta$ , then $\bar { x }$ is not a satisfying assignment. We provide the proof of the theorem in Appendix A.
88
+
89
+ # 4 CONSTRAINED NEURAL NETWORKS
90
+
91
+ In this section, we present our method for training neural networks with constraints. We first define the problem, then provide our min-max formulation, and finally, discuss how we solve the problem. We write $[ \varphi ]$ to denote the indicator function that is 1 if the predicate holds and 0 otherwise.
92
+
93
+ Training with constraints To train with a single constraint, we consider the following maximization problem over neural network weights $\theta$ :
94
+
95
+ $$
96
+ \underset { \theta } { \arg \operatorname* { m a x } } \mathbb { E } _ { S ^ { 1 } , \ldots , S ^ { m } \sim \mathcal { D } } \left[ \forall \bar { z } . \varphi ( \bar { z } , \bar { S } , \bar { c } , \theta ) \right] .
97
+ $$
98
+
99
+ Here, $S ^ { 1 } , \ldots , S ^ { m }$ (abbreviated by $\bar { S }$ ) are independently drawn from an underlying distribution $\mathcal { D }$ and $\varphi$ is a constraint over variables $\bar { z }$ , constants $\bar { S }$ and $\bar { c }$ , and network weights $\theta$ . This objective is bounded between 0 and 1, and attains 1 if and only if the probability the network satisfies the constraint $\varphi$ is 1. We extend this definition to multiple constraints, by forming a convex combination of their respective objectives: for $\pmb { w }$ with $\textstyle \sum _ { i = 1 } ^ { t } w _ { i } = 1$ and $w _ { i } > 0$ for all $i$ , we consider
100
+
101
+ $$
102
+ \underset { \theta } { \arg \operatorname* { m a x } } \sum _ { i = 1 } ^ { t } w _ { i } \cdot \mathbb { E } _ { S ^ { 1 } , \ldots , S ^ { m } \sim \mathcal { D } } \left[ \forall \bar { z } . \varphi _ { i } ( \bar { z } , \bar { S } , \bar { c } , \theta ) \right] .
103
+ $$
104
+
105
+ As standard, we train with the empirical objective where instead of the (unknown) distribution $\mathcal { D }$ we use the training set $\tau$ to draw samples.
106
+
107
+ To use our system, the user specifies the constraints $\varphi _ { 1 } , \ldots , \varphi _ { t }$ along with their weights $w _ { 1 } , \ldots , w _ { t }$ .
108
+ In the following, to simplify the presentation, we assume that there is only one constraint.
109
+
110
+ Formulation as min-max optimization We can rephrase training networks with constraints as minimizing the expectation of the maximal violation. The maximal violation is an assignment to the variables $\bar { z }$ which violates the constraint (if it exists). That is, it suffices to solve the problem arg $\begin{array} { r } { \operatorname* { m i n } _ { \theta } \mathbb { E } _ { S ^ { 1 } , . . . S ^ { m } \sim \mathcal { T } } \left( \operatorname* { m a x } _ { z ^ { 1 } , . . . , z ^ { k } } \neg \varphi ( \bar { z } , \bar { S } , \bar { c } , \theta ) \right) } \end{array}$ . Assume that one can compute, for a given $\bar { S }$ and $\theta$ , an optimal solution $\bar { x } _ { \bar { S } , \theta } ^ { * }$ for the inner maximization problem:
111
+
112
+ $$
113
+ \bar { x } _ { \bar { S } , \theta } ^ { * } = \underset { z ^ { 1 } , \ldots , z ^ { k } } { \arg \operatorname* { m a x } } [ \neg \varphi ( \bar { z } , \bar { S } , \bar { c } , \theta ) ] .
114
+ $$
115
+
116
+ Then, we can rephrase the optimization problem in terms of $\bar { x } _ { \bar { S } , \theta } ^ { * }$
117
+
118
+ $$
119
+ \underset { \theta } { \arg \operatorname* { m i n } } \mathbb { E } _ { S ^ { 1 } , \ldots S ^ { m } \sim \mathcal { T } } [ \neg \varphi ( \bar { x } _ { \bar { S } , \theta } ^ { * } , \bar { S } , \bar { c } , \theta ) ] .
120
+ $$
121
+
122
+ The advantage of this formulation is that it splits the problem into two sub-problems and the overall optimization can be seen as a game between an oracle (solving (2)) and an optimizer (solving (3)).
123
+
124
+ Solving the optimization problems We solve (2) and (3) by translating the logical constraints into differentiable loss (as shown in Sec. 3). Inspired by Theorem 1, for the oracle (Eq. (2)), we approximate the inner maximization by a minimization of the translated loss ${ \mathcal { L } } ( \neg \varphi )$ :
125
+
126
+ $$
127
+ \bar { x } _ { \bar { S } , \theta } ^ { * } = \underset { z ^ { 1 } , \ldots , z ^ { k } } { \arg \operatorname* { m i n } } \mathcal { L } ( \lnot \varphi ) ( \bar { z } , \bar { S } , \bar { c } , \theta ) .
128
+ $$
129
+
130
+ Given $\bar { x } _ { \bar { S } , \theta }$ from the oracle, we optimize the following loss using Adam (Kingma & Ba, 2014):
131
+
132
+ $$
133
+ \mathbb { E } _ { S ^ { 1 } , \dots , S ^ { m } \sim \mathcal { T } } \left( \mathcal { L } ( \varphi ) ( \bar { x } _ { \bar { S } , \theta } , \bar { S } , \bar { c } , \theta ) \right) .
134
+ $$
135
+
136
+ Constrained optimization In general, the loss in (4) can sometimes be difficult to optimize. To illustrate, assume that the random samples are input-label pairs $( { \pmb x } , y )$ and consider the constraint:
137
+
138
+ $$
139
+ \varphi ( z , ( \pmb { x } , y ) , \theta ) = | | \pmb { x } - z | | _ { \infty } \leq \epsilon \implies \mathrm { l o g i t } ^ { \theta } ( z ) _ { y } > \delta .
140
+ $$
141
+
142
+ Our translation of this constraint to a differentiable loss produces
143
+
144
+ $$
145
+ \mathcal { L } ( \neg \varphi ) ( z , ( \pmb { x } , y ) , \theta ) = \operatorname* { m a x } ( 0 , | | \pmb { x } - z | | _ { \infty } - \epsilon ) + \operatorname* { m a x } ( 0 , \log \mathrm { i } ^ { \theta } ( z ) _ { y } - \delta ) .
146
+ $$
147
+
148
+ This function is difficult to minimize because the magnitude of the two terms is different. This causes first-order methods to optimize only a single term in an overly greedy manner, as reported by Carlini & Wagner (2017). However, some constraints have a closed-form analytical solution, e.g., the minimization of $\operatorname* { m a x } ( 0 , | | x - z | | _ { \infty } - \epsilon )$ can be solved by projecting into the $L _ { \infty }$ ball. To leverage this, we identify logical constraints which restrict the variables $_ z$ to convex sets that have an efficient algorithm for projection, e.g., line segments, $L _ { 2 }$ , $L _ { \infty }$ or $L _ { 1 }$ balls (Duchi et al., 2008). Note that in general, projection to a convex set is a difficult problem. We exclude such constraints from $\varphi$ and add them as constraints of the optimization. We thus rewrite (4) as:
149
+
150
+ $$
151
+ \bar { x } _ { \bar { S } , \theta } ^ { * } = \underset { z ^ { 1 } \in D _ { 1 } ( \bar { S } ) , \ldots , z ^ { k } \in D _ { k } ( \bar { S } ) } { \arg \operatorname* { m i n } } \mathcal { L } ( \neg \varphi ) ( \bar { z } , \bar { S } , \bar { c } , \theta ) ,
152
+ $$
153
+
154
+ where the $D _ { i }$ denote functions which map random samples to a convex set. To solve (6), we employ Projected Gradient Descent (PGD) which was shown to have strong performance in the case of adversarial training with $L _ { \infty }$ balls (Madry et al., 2017).
155
+
156
+ Training procedure Algorithm 1 shows our training procedure. We first form a mini-batch of random samples from the training set $\tau$ . Then, the oracle finds a solution for (4) using the formulation in (6). This solution is given to the optimizer, which solves (5). Note that if $\varphi$ has no variables $k = 0 ,$ ), the oracle becomes trivial and the loss is computed directly.
157
+
158
+ # Algorithm 1: Training with constraints.
159
+
160
+ input : Training set $\tau$ , network parameters $\theta$ , and a constraint $\varphi ( \bar { z } , \bar { S } , \dot { \bar { c } } , \theta )$
161
+ for epoch $= I$ to nepochs do Sample mini-batch of $m$ -tuples $\bar { S } = \mathsf { \dot { S } } ^ { 1 } , \ldots , S ^ { m } \sim \mathcal { T }$ . Using PGD, compute $\bar { x } \approx \operatorname * { a r g m i n } _ { z ^ { 1 } \in { \cal D } _ { 1 } ( \bar { S } ) , \ldots , z ^ { k } \in { \cal D } _ { k } ( \bar { S } ) } \mathcal { L } ( \neg \varphi ) ( \bar { z } , \bar { S } , \bar { c } , \theta ) .$ . Perform Adam update with $\nabla _ { \theta } \mathcal { L } ( \varphi ) ( \bar { x } , \bar { S } , \bar { c } , \theta )$ .
162
+
163
+ # 5 QUERYING NETWORKS
164
+
165
+ We build on DL2 and design a declarative language for querying networks. Interestingly, the hardcoded questions investigated by prior work can now be phrased as DL2 queries: neurons responsible for a prediction (Olah et al., 2018), inputs that differentiate networks (Pei et al., 2017), and adversarial examples (e.g., Szegedy et al. (2013)). We support the following class of queries:
166
+
167
+ Here, find defines the variables and their shape in parentheses, where defines the constraint (over the fragment described in Sec. 3), init defines initial values for (part or all of) the variables, and return defines a target term to compute at the end of search; if missing, $z ^ { 1 } , \ldots , z ^ { k }$ are returned. Networks (loaded so to be used in the queries) and constants are defined outside the queries. We note that the user can specify tensors in our language (we do not assume these are simplified to vectors). In queries, we write comma $\left( , \right)$ for conjunction $( \wedge )$ ; in for box-constraints and class for constraining the target label, which is interpreted asconstraints over the labels’ probabilities.
168
+
169
+ Examples Fig. 1 shows few interesting queries. The first two are defined over networks trained for CIFAR-10, while the last is for MNIST. The goal of the first query is to find an adversarial example i of shape (32, 32, 3), classified as a truck (class 9) where the distance of i to a given deer image (deer) is between 6 and 24, with respect to the infinity norm. Fig. 1b is similar, but the goal is to find i classified as a deer where a specific neuron is deactivated. The last query’s goal is to find i classified differently by two networks where part of $\dot { \beth }$ is fixed to pixels of the image nine.
170
+
171
+ fi n d i[32, 32, 3] fi n d i[32, 32, 3] fi n d i[28, 28]
172
+ where i i n [0, 255], where i i n [0, 255], where i i n [0, 1], c l a s s ( $\begin{array} { r l r } { \mathrm { ' N N ( \frac { } { } i ) } } \end{array} ) & { { } = } & 9$ , ki - deerk∞ < 25, $\begin{array} { r } { \mathrm { ~ i ~ } [ 0 : 9 , : \mathrm { ~ ] ~ \ = ~ \ n i n e ~ [ ~ } 0 : 9 , : \mathrm { ~ ] ~ } , } \end{array}$ , $\| \dot { \boldsymbol { 1 } } - \mathsf { d e e r } \| _ { \infty } < 2 5 ,$ , NN(i) $\cdot 1 _ { 1 } [ 0 , \ 1 , \ 1 , \ 3 1 ] = 0 ,$ , c l a s s (NN1(i)) $\qquad = \ 8$ , ki - deerk∞ > 5 c l a s s $( \mathrm { N N } \left( \mathrm { i } \right) ) \quad = \quad 4$ c l a s s $( \mathbb { N } \mathbb { N } 2 \left( { \mathrm { ~ i ~ } } \right) \ ) = 9$ (a) Adversarial example. (b) Neuron deactivated. (c) Diffing networks.
173
+
174
+ Figure 1: DL2 queries enable to declaratively search for inputs satisfying constraints over networks.
175
+
176
+ Solving queries As with training, we compile the constraints to a loss, but unlike training, we optimize with L-BFGS-B. While training requires batches of inputs in PGD optimization, querying looks for one assignment, and thus there is more time to employ the more sophisticated, but slower, L-BFGS-B. We discuss further optimizations in Appendix C.
177
+
178
+ # 6 EXPERIMENTAL EVALUATION
179
+
180
+ We now present a thorough experimental evaluation on the effectiveness of DL2 for querying and training neural networks with logical constraints. Our system is implemented in PyTorch (Paszke et al., 2017) and evaluated on an Nvidia GTX 1080 Ti and Intel Core i7-7700K with $4 . 2 0 \mathrm { G H z }$ .
181
+
182
+ # 6.1 TRAINING WITH DL2
183
+
184
+ We evaluated DL2 on various tasks (supervised, semi-supervised and unsupervised learning) across four datasets: MNIST, FASHION (Xiao et al., 2017), CIFAR-10, and CIFAR-100 (Krizhevsky & Hinton, 2009). In all experiments, one of the constraints was cross-entropy (see Sec. 4), to optimize for high prediction accuracy. For each experiment, we describe additional logical constraints.
185
+
186
+ Supervised learning We consider two types of constraints for supervised learning: global constraints, which have ${ \boldsymbol { z } } \mathbf { - S }$ , and training set constraints, where the only variables are from the training set (no z-s). Note that none of prior work applies to global constraints in general. Furthermore, because of limitations of their encoding explained in Sec. 2, they are not able to handle complex training
187
+
188
+ Figure 2: Supervised learning, P/C is prediction/constraint accuracy.
189
+
190
+ <table><tr><td></td><td></td><td colspan="2">MNIST</td><td colspan="2">FASHION</td><td colspan="2">CIFAR-10</td></tr><tr><td></td><td></td><td>Baseline</td><td>DL2</td><td>Baseline</td><td>DL2</td><td>Baseline</td><td>DL2</td></tr><tr><td rowspan="2"></td><td>P</td><td>99.39</td><td>98.61</td><td>90.56</td><td>89.70</td><td>90.98</td><td>87.08</td></tr><tr><td>C</td><td>96.10</td><td>97.30</td><td>95.20</td><td>96.30</td><td>91.10</td><td>93.08</td></tr><tr><td rowspan="2">RobustnessG</td><td>P</td><td>99.38</td><td>99.45</td><td>91.45</td><td>89.41</td><td>90.59</td><td>78.86</td></tr><tr><td>C</td><td>35.02</td><td>92.18</td><td>00.00</td><td>80.20</td><td>07.16</td><td>21.00</td></tr><tr><td rowspan="2">LipschitzT</td><td>P</td><td>99.48</td><td>97.95</td><td>92.10</td><td>87.49</td><td>90.59</td><td>90.24</td></tr><tr><td>C</td><td>07.20</td><td>99.20</td><td>06.40</td><td>99.53</td><td>07.16</td><td>99.60</td></tr><tr><td rowspan="2">LipschitzG</td><td>P</td><td>99.44</td><td>99.24</td><td>92.22</td><td>82.27</td><td>90.51</td><td>87.32</td></tr><tr><td>C</td><td>00.00</td><td>99.90</td><td>00.00</td><td>89.38</td><td>00.00</td><td>99.55</td></tr><tr><td rowspan="2"></td><td>P</td><td>-</td><td>-</td><td>-</td><td>-</td><td>91.52</td><td>90.70</td></tr><tr><td>C</td><td></td><td></td><td></td><td>=</td><td>89.10</td><td>99.60</td></tr><tr><td rowspan="2">C-similarityG</td><td>P</td><td></td><td></td><td></td><td>=</td><td>91.06</td><td>90.30</td></tr><tr><td>C</td><td></td><td></td><td>=</td><td>=</td><td>49.74</td><td>57.31</td></tr><tr><td rowspan="2">Segment</td><td>P</td><td>98.16</td><td>97.44</td><td>88.13</td><td>87.18</td><td>1</td><td>1</td></tr><tr><td>C</td><td>18.97</td><td>37.70</td><td>21.80</td><td>48.18</td><td>-</td><td>-</td></tr></table>
191
+
192
+ set constraints considered in our experiments (e.g., constraints between probability distributions). To ease notation, we write random samples (the $S { \mathrm { - s } }$ ) as $\mathbf { x } ^ { i }$ and $y ^ { i }$ for inputs from the training set $( { \pmb x } ^ { i } )$ and their corresponding label $( y ^ { i } )$ .
193
+
194
+ For local robustness (Szegedy et al., 2013), the training set constraint says that if two inputs from the dataset are close (their distance is less than a given $\epsilon _ { 1 }$ , with respect to $L _ { 2 }$ norm), then the KL divergence of their output probabilities is smaller than $\epsilon _ { 2 }$ :
195
+
196
+ $$
197
+ | | x ^ { 1 } - x ^ { 2 } | | _ { 2 } < \epsilon _ { 1 } \implies K L ( p ^ { \theta } ( x ^ { 1 } ) | | p ^ { \theta } ( x ^ { 2 } ) ) < \epsilon _ { 2 }
198
+ $$
199
+
200
+ (RobustnessT)
201
+
202
+ Second, the global constraint requires that for any input $_ { \textbf { \em x } }$ , whose classification is $y$ , inputs in its $\epsilon$ neighborhood which are valid images (pixels are between 0 and 1), have a high probability for $y$ . For numerical stability, instead of the probability we check that the corresponding logit is larger than a given threshold $\delta$ :
203
+
204
+ $$
205
+ \forall z \in L _ { \infty } ( x , \epsilon ) \cap [ 0 , 1 ] ^ { d } . \log \operatorname { i t } ^ { \theta } ( z ) _ { y } > \delta
206
+ $$
207
+
208
+ Similarly, we have two definitions for the Lipschitz condition. The training set constraint requires that for every two inputs from the training set, the distance between their output probabilities is less than the Lipschitz constant $( L )$ times the distance between the inputs:
209
+
210
+ $$
211
+ | | p ^ { \theta } ( { \pmb x } ^ { 1 } ) - p ^ { \theta } ( { \pmb x } ^ { 2 } ) | | _ { 2 } < L | | { \pmb x } ^ { 1 } - { \pmb x } ^ { 2 } | | _ { 2 }
212
+ $$
213
+
214
+ The global constraint poses the same constraint for valid images in the neighborhood $\scriptstyle { \mathbf { { x } } } ^ { 1 }$ and $\scriptstyle { \pmb x } ^ { 2 }$
215
+
216
+ $$
217
+ \forall z ^ { 1 } \in L _ { \infty } ( { \pmb x } ^ { 1 } , \epsilon ) \cap [ 0 , 1 ] ^ { d } , z ^ { 2 } \in L _ { \infty } ( { \pmb x } ^ { 2 } , \epsilon ) \cap [ 0 , 1 ] ^ { d } . | | p ^ { \theta } ( z ^ { 1 } ) - p ^ { \theta } ( z ^ { 2 } ) | | _ { 2 } < L | | z ^ { 1 } - z ^ { 2 } | | _ { 2 } \cap [ 0 , 1 ] ^ { d } .
218
+ $$
219
+
220
+ (LipschitzG)
221
+
222
+ We also consider a training set constraint called $C$ -similarity, which imposes domain knowledge constraints for CIFAR-10 networks. The constraint requires that inputs classified as a car have a higher probability for the label truck than the probability for dog:
223
+
224
+ $$
225
+ y = \mathrm { c a r } \implies p ^ { \theta } ( { \pmb x } ) _ { \mathrm { t r u c k } } > p ^ { \theta } ( { \pmb x } ) _ { \mathrm { d o g } } + \delta
226
+ $$
227
+
228
+ The global constraint is similar but applied for valid images in the $\epsilon$ -neighborhood of $_ { \textbf { \em x } }$
229
+
230
+ $$
231
+ \forall z \in L _ { \infty } ( \mathbf { x } , \epsilon ) \cap [ 0 , 1 ] ^ { d } . y = \mathrm { c a r } \implies p ^ { \theta } ( z ) _ { \mathrm { t r u c k } } > p ^ { \theta } ( z ) _ { \mathrm { d o g } } + \delta
232
+ $$
233
+
234
+ Finally, we consider a Segment constraint which requires that if an input $_ z$ is on the line between two inputs $\scriptstyle { \boldsymbol { x } } ^ { 1 }$ and $\scriptstyle { \pmb x } ^ { 2 }$ in position $\lambda$ , then its output probabilities are on position $\lambda$ on the line between the output probabilities:
235
+
236
+ $$
237
+ \forall z . ~ z = \lambda \cdot x ^ { 1 } + ( 1 - \lambda ) \cdot x ^ { 2 } \implies - \lambda \cdot \log \mathfrak { i } ^ { \theta } ( z ) _ { y ^ { 1 } } - ( 1 - \lambda ) \cdot \log \mathfrak { i } \mathfrak { t } ^ { \theta } ( z ) _ { y ^ { 2 } } < \delta \quad ( \mathrm { S e g m e n t } ^ { 6 } ) < \delta
238
+ $$
239
+
240
+ Fig. 2 shows the prediction accuracy (P) and the constraint accuracy (C) when training with (i) crossed-entropy only (CE) and (ii) CE and the constraint. Results indicate that DL2 can significantly improve constraint accuracy ( $0 \%$ to $9 9 \%$ for LipschitzG), while prediction accuracy slightly decreases. The decrease is expected in light of a recent work (Tsipras et al. (2018)), which shows that adversarial robustness comes with decrease of prediction accuracy. Since adversarial robustness is a type of DL2 constraint, we suspect that we observe a similar phenomenon here.
241
+
242
+ Semi-supervised learning For semi-supervised learning, we focus on the CIFAR-100 dataset, and split the training set into labeled, unlabeled and validation set in ratio of 20/60/20. In the spirit of the experiments of $\mathrm { X u }$ et al. (2018), we consider the constraint which requires that the probabilities of groups of classes have either very high probability or very low probability. A group consists of classes of a similar type (e.g., the classes baby, boy, girl, man, and woman are part of the people group), and the group’s probability is the sum of ts classes’ probabilities. Formally, our constraint consists of 20 groups and its structure is:
243
+
244
+ <table><tr><td>Method</td><td>Accuracy (%)</td></tr><tr><td>Baseline</td><td>47.03</td></tr><tr><td>Semantic loss</td><td>51.82</td></tr><tr><td>Rule distillation</td><td>45.56</td></tr><tr><td>DL2</td><td>53.48</td></tr></table>
245
+
246
+ $$
247
+ ( p _ { p e o p l e } < \epsilon \lor p _ { p e o p l e } > 1 - \epsilon ) \land . . . \land ( p _ { i n s e c t s } < \epsilon \lor p _ { i n s e c t s } > 1 - \epsilon )
248
+ $$
249
+
250
+ for a small $\epsilon$ . We use this constraint to compare the performance of several approaches. For all approaches, we use the Wide Residual Network (Zagoruyko & Komodakis (2016)) as the network architecture. As a baseline, we train in a purely-supervised fashion, without using the unlabeled data. We also compare to semantic loss (Xu et al., 2018) and rule distillation (Hu et al., 2016). Note that this constraint is restricting the probability distribution and not samples drawn from it which makes other methods inapplicable (as shown in Sec. 2). As these methods cannot encode our constraint, we replace them with a closest approximation (e.g., the exactly-one constraint from Xu et al. (2018) for semantic loss). Details are shown in Appendix D. Fig. 3 shows the prediction accuracy on the test set for all approaches. Results indicate that our approach outperforms all existing works.
251
+
252
+ Unsupervised learning We also consider a regression task in an unsupervised setting, namely training MLP (Multilayer perceptron) to predict the minimum distance from a source to every node in an unweighted graph, $G = ( V , E )$ . One can notice that minimum distance is a function with certain properties (e.g., triangle inequality) which form a logical constraint listed below. Source is denoted as 0.
253
+
254
+ <table><tr><td>Approach</td><td>MSE</td></tr><tr><td>Supervised (regression)</td><td>0.0516</td></tr><tr><td>Unsupervised (baseline)</td><td>0.4938</td></tr><tr><td>Unsupervised (with DL2)</td><td>0.0998</td></tr></table>
255
+
256
+ $$
257
+ \forall v \in G , d ( v ) \geq 0 \land \left( \lor _ { ( v , v ^ { \prime } ) \in E } ( d ( v ) = d ( v ^ { \prime } ) + 1 ) \right) \land \left( \land _ { ( v , v ^ { \prime } ) \in E } ( d ( v ) \leqslant d ( v ^ { \prime } ) + 1 ) \right)
258
+ $$
259
+
260
+ Table 1: Results for queries: $( \# \checkmark )$ number of completed instances (out of 10), $\textcircled { \div } \textcircled { \div }$ is the average running time in seconds, and $\textcircled{5}$ the average running time of successful runs (in seconds).
261
+
262
+ <table><tr><td rowspan="2">Nr.</td><td colspan="3">MNIST</td><td colspan="3">FASHION</td><td colspan="3">CIFAR-10</td><td colspan="3">GTSRB</td><td colspan="3">ImageNet</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><td>?</td><td>#</td><td>?</td><td>+</td></tr><tr><td>1</td><td>10</td><td>0.4</td><td>0.4</td><td>10</td><td>0.4</td><td>0.4</td><td>10</td><td>0.4</td><td>0.4</td><td>10</td><td>0.6</td><td>0.6</td><td>10</td><td>1.6</td><td>1.6</td></tr><tr><td>2</td><td>10</td><td>1.0</td><td>1.0</td><td>10</td><td>1.00</td><td>1.00</td><td>10</td><td>1.2</td><td>1.2</td><td>10</td><td>3.0</td><td>3.0</td><td>10</td><td>80.7</td><td>80.7</td></tr><tr><td>3</td><td>10</td><td>1.0</td><td>1.0</td><td>10</td><td>0.9</td><td>0.9</td><td>10</td><td>3.4</td><td>3.4</td><td>10</td><td>3.1</td><td>3.1</td><td>10</td><td>81.0</td><td>81.0</td></tr><tr><td>4</td><td>10</td><td>1.5</td><td>1.5</td><td>10</td><td>1.6</td><td>1.6</td><td>9</td><td>9.8</td><td>1.9</td><td>0</td><td>120.0</td><td>0.0</td><td>10</td><td>94.4</td><td>94.4</td></tr><tr><td>5</td><td>10</td><td>1.0</td><td>1.0</td><td>10</td><td>1.0</td><td>1.0</td><td>8</td><td>16.5</td><td>1.1</td><td>10</td><td>3.2</td><td>3.2</td><td>10</td><td>80.2</td><td>80.2</td></tr><tr><td>6</td><td>9</td><td>15.7</td><td>4.1</td><td>8</td><td>25.5</td><td>1.9</td><td>9</td><td>5.7</td><td>1.7</td><td>8</td><td>27.4</td><td>4.2</td><td>9</td><td>81.4</td><td>77.2</td></tr><tr><td>7</td><td>10</td><td>1.0</td><td>1.0</td><td>10</td><td>1.0</td><td>1.0</td><td>10</td><td>1.1</td><td>1.1</td><td>10</td><td>3.0</td><td>3.0</td><td>10</td><td>74.0</td><td>74.0</td></tr><tr><td>8</td><td>6</td><td>48.6</td><td>1.0</td><td>6</td><td>51.7</td><td>6.2</td><td>9</td><td>5.9</td><td>1.0</td><td>9</td><td>15.8</td><td>4.2</td><td>10</td><td>78.4</td><td>78.4</td></tr><tr><td>9</td><td>10</td><td>1.4</td><td>1.4</td><td>10</td><td>1.5</td><td>1.5</td><td>8</td><td>10.5</td><td>1.7</td><td>0</td><td>120.0</td><td>0.0</td><td>10</td><td>86.6</td><td>86.6</td></tr><tr><td>10</td><td>10</td><td>1.8</td><td>1.8</td><td>10</td><td>1.7</td><td>1.7</td><td>10</td><td>2.6</td><td>2.6</td><td>0</td><td>120.0</td><td>0.0</td><td>10</td><td>92.2</td><td>92.2</td></tr><tr><td>11</td><td>6</td><td>50.0</td><td>3.3</td><td>7</td><td>42.0</td><td>8.7</td><td>7</td><td>35.0</td><td>17.1</td><td>0</td><td>120.0</td><td>0.0</td><td>8</td><td>96.6</td><td>90.7</td></tr><tr><td>12</td><td>10</td><td>2.0</td><td>2.0</td><td>10</td><td>2.0</td><td>2.0</td><td>9</td><td>28.8</td><td>18.7</td><td>10</td><td>6.2</td><td>6.2</td><td>0</td><td>120.0</td><td>0.0</td></tr><tr><td>13</td><td>5</td><td>63.5</td><td>7.1</td><td>7</td><td>39.3</td><td>4.7</td><td>7</td><td>30.2</td><td>7.6</td><td>9</td><td>21.9</td><td>11.0</td><td>0</td><td>120.0</td><td>0.0</td></tr><tr><td>14</td><td>0</td><td>120.0</td><td>0.0</td><td>0</td><td>120.0</td><td>0.0</td><td>7</td><td>68.21</td><td>46.01</td><td>-</td><td>-</td><td>-</td><td>1</td><td></td><td>-</td></tr><tr><td>15</td><td>3</td><td>79.08</td><td>71.27</td><td>9</td><td>35.02</td><td>25.58</td><td>7</td><td>66.02</td><td>42.88</td><td>1</td><td>-</td><td>-</td><td>-</td><td></td><td>-</td></tr><tr><td>16</td><td>1</td><td>108.2</td><td>2.0</td><td>1</td><td>108.2</td><td>2.0</td><td>8</td><td>34.4</td><td>13.1</td><td>4</td><td>75.6</td><td>9.0</td><td>0</td><td>120.0</td><td>0.0</td></tr><tr><td>17</td><td>10</td><td>2.9</td><td>2.9</td><td>10</td><td>3.2</td><td>3.2</td><td>5</td><td>61.6</td><td>4.0</td><td>0</td><td>120.0</td><td>0.0</td><td>0</td><td>120.0</td><td>0.0</td></tr><tr><td>18</td><td>10</td><td>4.0</td><td>4.0</td><td>10</td><td>4.0</td><td>4.0</td><td>7</td><td>50.6</td><td>24.9</td><td>0</td><td>120.0</td><td>0.0</td><td>0</td><td>120.0</td><td>0.0</td></tr></table>
263
+
264
+ Additionally, we constrain $d ( 0 ) = 0$ . Next, we train the model in an unsupervised fashion with the DL2 loss. In each experiment, we generate random graphs with 15 vertices and split the graphs into training (300), validation (150) and test set (150). As an unsupervised baseline, we consider a model which always predicts $d ( v ) = 1$ . We also train a supervised model with the mean squared error (MSE) loss. Remarkably, our approach was able to obtain an error very close to supervised model, without using any labels at all. This confirms that loss generated by DL2 can be used to guide the network to satisfy even very complex constraints with many nested conjunctions and disjunctions.
265
+
266
+ # 6.2 QUERYING WITH DL2
267
+
268
+ We evaluated DL2 on the task of querying with constraints, implemented in TensorFlow. We considered five image datasets, and for each, we considered at least two classifiers; for some we also considered a generator and a discriminator (trained using GAN (Goodfellow et al., 2014a)). Table 3 (Appendix E) provides statistics on the networks. Our benchmark consists of 18 template queries (Appendix E), which are instantiated with the different networks, classes, and images. Table 1 shows the results (- denotes an inapplicable query). Queries ran with a timeout of 2 minutes. Results indicate that our system often finds solutions. It is unknown whether queries for which it did not find a solution even have a solution. We observe that the success of a query depends on the dataset. For example, queries 9-11 are successful for all datasets but GTSBR. This may be attributed to the robustness of GTSBR networks against the adversarial examples that these queries aim to find. Query 14, which leverages a discriminator to find adversarial examples, is only successful for the CIFAR dataset. A possible explanation can be that discriminators were trained against real images or images created by a generator, and thus the discriminator performs poorly in classifying arbitrary images. Query 15, which leverages the generators, succeeds in all tested datasets, but has only few successes in each. As for overall solving time, our results indicate that, successful executions terminate relatively quickly and that our system scales well to large networks (e.g., for ImageNet).
269
+
270
+ # 7 CONCLUSION
271
+
272
+ We presented DL2, a system for training and querying neural networks. DL2 supports an expressive logical fragment and provides translation rules into a differentiable (almost everywhere) loss, which is zero only for inputs satisfying the constraints. To make training tractable, we handle input constraints which capture convex sets through PGD. We also introduce a declarative language for querying networks which uses the logic and the translated loss. Experimental results indicate that DL2 is effective in both, training and querying neural networks.
273
+
274
+ REFERENCES
275
+ Stephen H. Bach, Matthias Broecheler, Bert Huang, and Lise Getoor. Hinge-loss markov random fields and probabilistic soft logic. Journal of Machine Learning Research, 18:109:1–109:67, 2017. URL http://jmlr.org/papers/v18/15-631.html.
276
+ Radu Balan, Maneesh Singh, and Dongmian Zou. Lipschitz properties for deep convolutional networks. CoRR, abs/1701.05217, 2017.
277
+ Nicholas Carlini and David Wagner. Towards evaluating the robustness of neural networks. In 2017 IEEE Symposium on Security and Privacy (SP), pp. 39–57. IEEE, 2017.
278
+ William W. Cohen, Fan Yang, and Kathryn Mazaitis. Tensorlog: Deep learning meets probabilistic dbs. CoRR, abs/1707.05390, 2017.
279
+ John Duchi, Shai Shalev-Shwartz, Yoram Singer, and Tushar Chandra. Efficient projections onto the l 1-ball for learning in high dimensions. In Proceedings of the 25th international conference on Machine learning, pp. 272–279. ACM, 2008.
280
+ Zhoulai Fu and Zhendong Su. Xsat: a fast floating-point satisfiability solver. In International Conference on Computer Aided Verification, pp. 187–209. Springer, 2016.
281
+ Ian J. Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron C. Courville, and Yoshua Bengio. Generative adversarial nets. In Advances in Neural Information Processing Systems 27: Annual Conference on Neural Information Processing Systems (NIPS), pp. 2672–2680, 2014a.
282
+ Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572, 2014b.
283
+ Henry Gouk, Eibe Frank, Bernhard Pfahringer, and Michael J. Cree. Regularisation of neural networks by enforcing lipschitz continuity. CoRR, abs/1804.04368, 2018.
284
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. pp. 770–778, 2016. doi: 10.1109/CVPR.2016.90. URL https://doi.org/10. 1109/CVPR.2016.90.
285
+ Zhiting Hu, Xuezhe Ma, Zhengzhong Liu, Eduard Hovy, and Eric Xing. Harnessing deep neural networks with logic rules. arXiv preprint arXiv:1603.06318, 2016.
286
+ Angelika Kimmig, Stephen Bach, Matthias Broecheler, Bert Huang, and Lise Getoor. A short introduction to probabilistic soft logic. In Proceedings of the NIPS Workshop on Probabilistic Programming: Foundations and Applications, pp. 1–4, 2012.
287
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
288
+ Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. 2009.
289
+ Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. CoRR, abs/1706.06083, 2017.
290
+ Pablo Marquez-Neila, Mathieu Salzmann, and Pascal Fua. Imposing hard constraints on deep net- ´ works: Promises and limitations. arXiv preprint arXiv:1706.02025, 2017.
291
+ Pasquale Minervini, Thomas Demeester, Tim Rocktaschel, and Sebastian Riedel. Adversarial sets ¨ for regularising neural link predictors. CoRR, abs/1707.07596, 2017. URL http://arxiv. org/abs/1707.07596.
292
+ Augustus Odena, Christopher Olah, and Jonathon Shlens. Conditional image synthesis with auxiliary classifier gans. arXiv preprint arXiv:1610.09585, 2016.
293
+ Chris Olah, Arvind Satyanarayan, Ian Johnson, Shan Carter, Ludwig Schubert, Katherine Ye, and Alexander Mordvintsev. The building blocks of interpretability. Distill, 2018. doi: 10.23915/ distill.00010. https://distill.pub/2018/building-blocks.
294
+
295
+ Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan, Edward Yang, Zachary DeVito, Zeming Lin, Alban Desmaison, Luca Antiga, and Adam Lerer. Automatic differentiation in pytorch. 2017.
296
+
297
+ Deepak Pathak, Philipp Krahenbuhl, and Trevor Darrell. Constrained convolutional neural networks for weakly supervised segmentation. In Proceedings of the IEEE international conference on computer vision, pp. 1796–1804, 2015.
298
+
299
+ Kexin Pei, Yinzhi Cao, Junfeng Yang, and Suman Jana. Deepxplore: Automated whitebox testing of deep learning systems. In Proceedings of the 26th Symposium on Operating Systems Principles, Shanghai, China, October 28-31, 2017, pp. 1–18, 2017. doi: 10.1145/3132747.3132785. URL http://doi.acm.org/10.1145/3132747.3132785.
300
+
301
+ Kevin Schawinski, Ce Zhang, Hantian Zhang, Lucas Fowler, and Gokula Krishnan Santhanam. Galaxygan: Generative adversarial networks for recovery of galaxy features. Astrophysics Source Code Library, 2017.
302
+
303
+ Yang Song, Rui Shu, Nate Kushman, and Stefano Ermon. Generative adversarial examples. CoRR, abs/1805.07894, 2018.
304
+
305
+ Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian J. Goodfellow, and Rob Fergus. Intriguing properties of neural networks. CoRR, abs/1312.6199, 2013.
306
+
307
+ Dimitris Tsipras, Shibani Santurkar, Logan Engstrom, Alexander Turner, and Aleksander Madry. There is no free lunch in adversarial robustness (but there are unexpected benefits). arXiv preprint arXiv:1805.12152, 2018.
308
+
309
+ Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms, 2017.
310
+
311
+ Jingyi Xu, Zilu Zhang, Tal Friedman, Yitao Liang, and Guy Van den Broeck. A semantic loss function for deep learning with symbolic knowledge. 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. 5502–5511, Stockholmsmssan, Stockholm Sweden, 10–15 Jul 2018. PMLR.
312
+
313
+ Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. arXiv preprint arXiv:1605.07146, 2016.
314
+
315
+ # A PROOF OF THEOREM 1
316
+
317
+ A.1 $\mathcal { L } ( \varphi ) ( \bar { x } ) = 0$ IMPLIES SATISFACTION
318
+
319
+ We start by giving a proof for the if direction of the Theorem 1, i.e. if $\mathcal { L } ( \varphi ) ( \bar { x } ) = 0$ , then $\bar { x }$ satisfies $\varphi$ . The proof is by induction on the formula structure (we assume $\varphi$ is negation-free as negations can be eliminated as described in the text).
320
+
321
+ As a base case, we consider formulas consisting of a single atomic constraint.
322
+
323
+ • $\varphi = ( t ^ { 1 } ( \bar { x } ) = t ^ { 2 } ( \bar { x } ) )$ If $d ( t ^ { 1 } ( \bar { x } ) , t ^ { 2 } ( \bar { x } ) ) = 0$ , then by definition $t ^ { 1 } ( \bar { x } ) = t ^ { 2 } ( \bar { x } )$ , and $\varphi$ is satisfied.
324
+ • $\varphi = ( t ^ { 1 } ( \bar { x } ) \leq t ^ { 2 } ( \bar { x } ) )$ If $\mathbf { 1 } _ { \mathrm { t } ^ { 1 } ( \bar { \mathbf { x } } ) > \mathrm { t } ^ { 2 } ( \bar { \mathbf { x } } ) } \cdot d ( t ^ { 1 } ( \bar { x } ) , t ^ { 2 } ( \bar { x } ) ) = 0$ , then by definition $t ^ { 1 } ( \bar { x } ) - t ^ { 2 } ( \bar { x } ) \leq 0 .$ , and $\varphi$ is satisfied.
325
+ • $\varphi = ( t ^ { 1 } ( \bar { x } ) < t ^ { 2 } ( \bar { x } ) )$ If $\mathbf { 1 } _ { \mathrm { t } ^ { 1 } ( \bar { x } ) + \xi > \mathrm { t } ^ { 2 } ( \bar { x } ) } \cdot \dot { d } ( t ^ { 1 } ( \bar { x } ) + \xi , t ^ { 2 } ( \bar { x } ) ) = 0$ , then $t ^ { 1 } ( \bar { x } ) + \xi - t ^ { 2 } ( \bar { x } ) \le 0$ , and since $\xi > 0$ , we get $t ^ { 1 } ( \bar { x } ) < t ^ { 2 } ( \bar { x } )$ . Thus, $\varphi$ is satisfied.
326
+
327
+ As an induction step, we consider combination of formulas using single logical and or logical or operation.
328
+
329
+ • $\varphi \vee \psi$ If $\mathcal { L } ( \varphi ) \cdot \mathcal { L } ( \psi ) = 0$ , then either $\mathcal { L } ( \varphi ) = 0$ or $\mathcal { L } ( \psi ) = 0$ . By the induction hypothesis, either $\varphi$ is satisfied or $\psi$ is satisfied, implying that $\varphi \vee \psi$ is satisfied.
330
+ • $\varphi \wedge \psi$ If $\mathcal { L } ( \varphi ) + \mathcal { L } ( \psi ) = 0$ , then (because $\mathcal { L }$ is non-negative) both $\mathcal { L } ( \varphi ) = 0$ and ${ \mathcal { L } } ( \psi ) = 0$ . By the induction hypothesis, $\varphi$ and $\psi$ are satisfied, implying that $\varphi \wedge \psi$ is satisfied.
331
+
332
+ A.2 ${ \mathcal { L } } ( \varphi ) ( { \bar { x } } ) \geq \delta ( \xi )$ IMPLIES NON-SATISFACTION
333
+
334
+ As all variables come from a bounded set, it is easy to see that for every formula $\varphi$ there exists bound $T ( \varphi )$ such that $\mathcal { L } ( \varphi ) ( \bar { x } ) \leq T ( \varphi )$ . In other words, loss can not be arbitrarily large for a fixed formula $\varphi$ . Given formula $\varphi$ , we will define $N ( \varphi )$ such that the following statement holds:
335
+
336
+ Lemma 1 If $\mathcal { L } ( \varphi ) ( \bar { x } ) > N ( \varphi ) \cdot \xi$ then $\bar { x }$ does not satisfy $\varphi ( { \bar { x } } \not \in \varphi )$ .
337
+
338
+ We prove Lemma 1 by induction on the formula structure. Base case of the induction is logical formula consisting of one atomic expression. In this case it is easy to see that if ${ \mathcal { L } } ( \varphi ) ( { \bar { x } } ) > \xi$ then $\bar { x }$ does not satisfy the formula. This means we can set $N ( \varphi ) = 1$ for such formulas and statement of the theorem holds.
339
+
340
+ We distinguish between two cases:
341
+
342
+ • $\varphi = \varphi _ { 1 } \wedge \varphi _ { 2 }$ In this case we define:
343
+
344
+ $$
345
+ N ( \varphi ) = N ( \varphi _ { 1 } ) + N ( \varphi _ { 2 } )
346
+ $$
347
+
348
+ Let $\bar { x }$ be an assignment which satisfies the formula $\varphi$ . This implies that $\bar { x }$ satisfies both $\varphi _ { 1 }$ and $\varphi _ { 2 }$ . From the assumption of induction we know that $\mathcal { L } ( \varphi _ { 1 } ) ( \bar { x } ) < N ( \varphi _ { 1 } ) \xi$ and $\mathcal { L } ( \varphi _ { 2 } ) ( \bar { x } ) < N ( \varphi _ { 2 } ) \xi$ .
349
+
350
+ Adding these inequalities (and using definitions of $\mathcal { L }$ and $N$ ) we get:
351
+
352
+ $$
353
+ \mathcal { L } ( \varphi ) ( \bar { x } ) = \mathcal { L } ( \varphi _ { 1 } ) ( \bar { x } ) + \mathcal { L } ( \varphi _ { 2 } ) ( \bar { x } ) < N ( \varphi _ { 1 } ) \xi + N ( \varphi _ { 2 } ) \xi = N ( \varphi ) \xi
354
+ $$
355
+
356
+ • $\varphi = \varphi _ { 1 } \vee \varphi _ { 2 }$
357
+
358
+ In this case we define:
359
+
360
+ $$
361
+ N ( \varphi ) = \operatorname* { m a x } \{ N ( \varphi _ { 1 } ) T ( \varphi _ { 2 } ) , N ( \varphi _ { 2 } ) T ( \varphi _ { 1 } ) \}
362
+ $$
363
+
364
+ Let $\bar { x }$ be an assignment which satisfies the formula $\varphi$ . This implies that $\bar { x }$ satisfies one of $\varphi _ { 1 }$ and $\varphi _ { 2 }$ . We can assume (without loss of generality) that $\bar { x }$ satisfies $\varphi _ { 1 }$ . From the
365
+
366
+ assumption of induction we know that $\mathcal { L } ( \varphi _ { 1 } ) ( \bar { x } ) < N ( \varphi _ { 1 } ) \xi$ and also $\mathcal { L } ( \varphi _ { 2 } ) ( \bar { x } ) < T ( \varphi _ { 2 } )$ Multiplying these inequalities (and using definitions of $\mathcal { L }$ and $N$ ) we get:
367
+
368
+ $$
369
+ \mathcal { L } ( \varphi ) ( \bar { x } ) = \mathcal { L } ( \varphi _ { 1 } ) ( \bar { x } ) \cdot \mathcal { L } ( \varphi _ { 2 } ) ( \bar { x } ) < N ( \varphi _ { 1 } ) \xi \cdot T ( \varphi _ { 2 } ) < N ( \varphi ) \xi
370
+ $$
371
+
372
+ Thus, one can choose $\delta ( \xi ) ~ = ~ N ( \varphi ) \xi$ . Then, $\begin{array} { r } { \operatorname* { l i m } _ { \xi \to 0 } \delta ( \xi ) ~ = ~ 0 } \end{array}$ and for every assignment $\bar { x }$ , ${ \mathcal { L } } ( \varphi ) ( { \bar { x } } ) > \delta ( \xi )$ implies that $\bar { x }$ does not satisfy $\varphi ( \bar { x } \not \in \varphi )$ , thus proving the Theorem 1.
373
+
374
+ To illustrate this construction we provide an example formula $\varphi = x ^ { 1 } < 1 \land x ^ { 2 } < 2$ . The loss encoding for this formula is $\mathcal { L } ( \varphi ) = \mathrm { m a x } \{ x ^ { 1 } + \xi - 1 , 0 \} + \mathrm { m a x } \{ x ^ { 2 } + \xi - 2 , 0 \}$ , where $\xi$ is the precision used for strong inequalities. For the given example our inductive proof gives $\delta ( \xi ) = 2 \xi$ . It is not difficult to show that assignments with loss greater than this value do not satisfy the formula. For example, consider $x ^ { 1 } = 1 \overset { \mathbf { \tilde { \mathbf { \alpha } } } } { + } \xi$ and $x ^ { 2 } = 2 + \bar { 3 } \xi$ . In this case $\mathcal { L } ( \varphi ) ( \bar { x } ) = 6 \xi > \dot { \delta } ( \xi ) = 2 \xi$ and the assignment obviously does not satisfy $\varphi$ . But also consider the assignment $x ^ { 1 } = 1 - 0 . 5 \xi$ and $x ^ { 2 } = 2 - 0 . 5 \xi$ . In this case $\mathcal { L } ( \varphi ) ( \bar { x } ) > 0$ and ${ \mathcal { L } } ( \varphi ) ( { \bar { x } } ) = \xi < \delta ( \xi ) \ { \bar { = } } \ 2 \xi$ and the assignment is indeed satisfying.
375
+
376
+ # B COMPARISON OF DL2 WITH PRIOR APPROACHES
377
+
378
+ XSAT (Fu & Su, 2016) also translates logical constraints into numerical loss, but its atomic constraints are translated into non-differentiable loss, making the whole loss non-differentiable. Probabilistic soft logic (e.g., Cohen et al. (2017); Hu et al. (2016)) translates logical constraints into differentiable loss, which ranges between $[ 0 , 1 ]$ . However, using their loss to find satisfying assignments with gradient methods can be futile, as the gradient may be zero. To illustrate, consider the toy example of $\varphi ( z ) : = ( z = { \binom { 1 } { 1 } } )$ . PSL translates this formula into the loss $\mathcal { L } _ { \mathrm { P S L } } ( \varphi ) = \mathrm { m a x } \{ z _ { 0 } + z _ { 1 } - 1 , 0 \}$ (it assumes $z _ { 0 } , z _ { 1 } \in [ 0 , 1 ] \forall$ ). Assuming optimization starts from $\pmb { x } = \left( ^ { 0 . 2 } _ { 0 . 2 } \right)$ (or any pair of numbers such that $z _ { 0 } + z _ { 1 } - 1 \le 0 $ ), the gradient is $\nabla _ { z } \mathcal { L } _ { \mathrm { P S L } } ( \varphi ) ( { \pmb x } ) = ( { \bf \Phi } _ { 0 } ^ { 0 } )$ , which means that the optimization cannot continue from this point, even though $_ { \textbf { \em x } }$ is not a satisfying assignment to $\varphi$ . In contrast, with our translation, we obtain $\mathcal { L } ( \varphi ) ( z ) = | z _ { 0 } - 1 | + | z _ { 1 } - 1 |$ , for which the gradient for the same $_ { \textbf { \em x } }$ is $\nabla _ { z } { \mathcal { L } } ( \varphi ) ( { \pmb x } ) = \left( { \begin{array} { l } { - 1 } \\ { - 1 } \end{array} } \right)$ .
379
+
380
+ # C OPTIMIZATION FOR QUERYING NETWORKS
381
+
382
+ Here we discuss how the loss compilation can be optimized for L-BFGS-B. While our translation is defined for arbitrary large constraints, in general, it is hard to optimize for a loss with many terms. Thus, we mitigate the size of the loss by extracting box constraints out of the expression. The loss is then compiled from remaining constraints. Extracted box constraints are passed to the L-BFGS-B solver which is then used to find the minimum of the loss. This “shifting” enables us to exclude a dominant part of $\varphi$ from the loss, thereby making our loss amenable to optimization. To illustrate the benefit, consider the query in Fig. 1a. Its box constraint, i in [0,255], is a syntactic sugar to a conjunction with $2 \cdot 3 2 \cdot 3 2 \cdot 3 = 6 , 1 4 4$ atomic constraints (two for each variables, i.e., for every index $j$ , we have $i _ { j } \geq 0$ and $i _ { j } \leq 2 5 5 )$ . In contrast, the second constraint consists of 9 atomic constraints (one for each possible class different from 9, as we shortly explain), and the third and fourth constraints are already atomic. If we consider 6, 155 atomic constraints in the loss, finding a solution (with gradient descent) would be slow. For larger inputs (e.g., inputs for ImageNet, whose size is $2 2 4 \cdot 2 2 4 \cdot 3 > 1 5 0 , 0 0 0 )$ , it may not terminate in a reasonable time. By excluding the box constraints from the loss, the obtained loss consists of only 11 terms, making it amenable for gradient optimization. We note that while a solution is not found (and given enough timeout), we restart L-BFGS-B and initialize the variables using MCMC sampling.
383
+
384
+ # D EXPERIMENTS DETAILS
385
+
386
+ Table 2: Hyperparameters used for supervised learning experiment
387
+
388
+ <table><tr><td></td><td colspan="3">MNIST,FASHI</td><td colspan="3">CIFAR-10</td></tr><tr><td></td><td>入</td><td>PGD Iterations</td><td>Params</td><td>入</td><td>PGD Iterations</td><td>Params</td></tr><tr><td>RobustnessT</td><td>0.2</td><td>-</td><td>€1 = 7.8,∈2 = 2.9</td><td>0.04</td><td>1</td><td>€1 = 13.8,∈2 = 0.9</td></tr><tr><td>RobustnessG</td><td>0.2</td><td>50</td><td>€1 = 0.3,δ= 0.52</td><td>0.1</td><td>7</td><td>∈1 = 0.03,δ= 0.52</td></tr><tr><td>LipschitzT</td><td>0.1</td><td>-</td><td>L=0.1</td><td>0.1</td><td>-</td><td>L =1.0</td></tr><tr><td>LipschitzG</td><td>0.2</td><td>50</td><td>L=0.1</td><td>0.1</td><td>5</td><td>L=1.0</td></tr><tr><td>ClassesT</td><td>1</td><td>1</td><td>=</td><td>0.2</td><td>1</td><td>δ=0.01</td></tr><tr><td>ClassesG</td><td>1</td><td>1</td><td>1</td><td>0.2</td><td>10</td><td>δ=0.01</td></tr><tr><td>SegmentG</td><td>0.01</td><td>5</td><td>∈=100</td><td>-</td><td>-</td><td>-</td></tr></table>
389
+
390
+ Here we describe implementation details (including hyperaparameters) used during our experiments.
391
+
392
+ Supervised learning For our experiments with supervised learning we used batch size 128, Adam optimizer with learning rate 0.0001. All other parameters are listed in 2. Additionally, for CIFAR10 experiments we use data augmentation with random cropping and random horizontal flipping. Experiments with Segment constraints are done by first embedding images in 40-dimensional space using PCA. In lower dimensional space it is sensible to consider linear interpolation between images which is not the case otherwise. Note that this experiment is not performed for CIFAR-10 because we do not observe good prediction accuracy with baseline model using lower dimensional embeddings. This is likely because dimensionality of CIFAR-10 images is much higher than MNIST or FASHION.
393
+
394
+ We used ResNet-18 (He et al., 2016) for experiments on CIFAR-10 and convolutional neural network (CNN) with 6 convolutional and 2 linear layers for MNIST and FASHION (trained with batchnorm after each convolutional layer). The layer dimensions of CNN are (1, 32, 5x5) - (32, 32, 5x5) - (32, 64, 3x3) - (64, 64, 3x3) - (64, 128, 3x3) - (128, 128, 1x1) - $1 0 0 ~ \cdot ~ 1 0 ~ $ where (in, out, kernel-size) denotes a convolutional layer and a number denotes a linear layer with corresponding number of neurons.
395
+
396
+ Semi-supervised learning All methods use the same Wide Residual Network model. We use depth 28 and widening factor 10. Neural network is optimized using Adam with learning rate 0.001. We use $\lambda = 0 . 6$ as weighting factor for DL2 loss.
397
+
398
+ For semantic loss experiment we follow the encoding from $\mathrm { X u }$ et al. (2018). Please consult the original work to see how exactly-one constraint is encoded into semantic loss. Since rule distillation does not support our constraint, we use the following approximation (following notation from Hu et al. (2016)):
399
+
400
+ $$
401
+ r _ { l } ( X , Y ) = \sum _ { Y ^ { \prime } \in G ( Y ) } \sigma _ { \theta } ( Y ^ { \prime } )
402
+ $$
403
+
404
+ We denote $G ( Y )$ as set of labels sharing the same group as $Y$ . Note that rule is meant to encourage putting more probability mass into the groups which already have high probability mass. This should result in the entire probability mass collapsed in one group in the end, as we want. We use $\pi _ { t } = \operatorname* { m a x } ( 0 , 1 . 0 - 0 . 9 7 ^ { t } )$ as mixing factor. Other constants used are $C = 1$ and $\lambda = 1$ .
405
+
406
+ In this experiment, we used Wide Residual Networks (Zagoruyko & Komodakis, 2016) with $n { = } 2 8$ and $k { = } 1 0$ (i.e. 28 layers).
407
+
408
+ # Unsupervised learning
409
+
410
+ Our model is the multilayer perceptron with $N ^ { * } N$ input neurons, three hidden layers with 1000 neurons each and an output layer of $\mathbf { N }$ neurons. $N$ is the number of vertices in the graph, in our case 15. The input takes all vertices in the graph and the output is the distance for each node. The network uses ReLU activations and dropout of 0.3 after at each hidden layer. Network is optimized using Adam with learning rate 0.0001.
411
+
412
+ Table 3: The datasets and networks used to evaluate DL2. The reported accuracy is top-1 accuracy and it was either computed by the authors $( ^ { * } )$ , users that implemented the work $( ^ { \# } )$ , or by us (†). Note that for GTSRB the images have dimensions $3 2 \times 3 2 \times 3$ , but the Cs take inputs of $3 2 \times 3 2 ( \times 1 )$ , which are pre-processed grayscale versions.
413
+
414
+ <table><tr><td>Dataset</td><td>Type</td><td>Network</td><td>Architecture</td><td>Accuracy</td></tr><tr><td rowspan="6">MNIST</td><td>C</td><td>M_NN1: [0,1]28×28 ↓ [0,1]10</td><td>Tensorflow Tutorial</td><td>0.992+</td></tr><tr><td>C</td><td>M_NN2:[0,128×28 I [0,1j10</td><td>M_NN1 with an additional layer</td><td>0.990t</td></tr><tr><td>G</td><td>M-G:[-,10,</td><td>DC-GAN</td><td>-</td></tr><tr><td>D</td><td>28×28→[0,1] M_D: [0,1]²</td><td>DC-GAN</td><td>-</td></tr><tr><td>G</td><td>:[-110{,0 M_ACGAN_G:</td><td>AC-GAN</td><td>=</td></tr><tr><td>D</td><td>M_ACGAN[,8[,]</td><td>AC-GAN</td><td>1</td></tr><tr><td rowspan="4">Fashion MNIST</td><td>C</td><td>FM_NN1:[0,1]28×28 I [0,1]10</td><td>Tensorflow Tutorial</td><td>0.917†</td></tr><tr><td>C</td><td>FM_NN2:[0,128×28 I [0,1]10</td><td>FM_NN1 with an additional layer</td><td>0.910t</td></tr><tr><td>G</td><td>FM_G: [-1,1]100 I [0,1]28×28</td><td>DC-GAN</td><td>-</td></tr><tr><td>D</td><td>FMD:[0,128×28 →[0,1]</td><td>DC-GAN</td><td>-</td></tr><tr><td rowspan="5">CIFAR</td><td>C</td><td>C_NN1 : [0,255]32×32×3 →[0,1]10</td><td>4-layer-model</td><td>0.712#</td></tr><tr><td>C</td><td>C_NN2: [0,255] j32×32×3 →[0,1]10</td><td>6-layer-model</td><td>0.756#</td></tr><tr><td>C</td><td>C_VGG : [0,255] j32×32×3 →[0,1]10</td><td>VGG-16-based</td><td>0.935#</td></tr><tr><td>G</td><td>C_G:[-1,1]100 [0,255]32×32×3</td><td>DC-GAN</td><td>-</td></tr><tr><td>D</td><td>C_D :[0,255]32×32x3 →[0,1]</td><td>DC-GAN</td><td>-</td></tr><tr><td rowspan="2">GTSRB</td><td>C</td><td>G_LeNet : [0,1]32×32 →[0,1]43</td><td>based on LeNet</td><td>0.914t</td></tr><tr><td>C</td><td>G-VGG: [0,1]32×32 [0,1]43</td><td>based on VGG</td><td>0.973†</td></tr><tr><td rowspan="3">ImageNet</td><td>C</td><td>I_V16: :[0,255]224×224x3 →[0,1]1000</td><td>VGG-16 from Keras</td><td>0.715*</td></tr><tr><td>C</td><td>I-V19:[0,255] 224×224×3 →[0,1]1000</td><td>VGG-19 from Keras</td><td>0.727*</td></tr><tr><td>C</td><td>[0,25242 I_R50:</td><td>ResNet-50 from Keras</td><td>0.759*</td></tr></table>
415
+
416
+ # E ADDITIONAL DETAILS FOR SECTION 6.2
417
+
418
+ Here we provide statistics on the networks used in the experiments of Sec. 6.2, as well as the query templates.
419
+
420
+ Dataset and networks Our benchmark consists of five image datasets, each with different wellestablished neural networks’ architectures. For each dataset, we consider at least two classifiers, and for some we also consider a generator and a discriminator (trained using GAN Goodfellow et al. (2014a)). We trained most networks ourselves, except for the C_VGG and the ImageNet classifiers, for which the weights were available to download. Table 3 summarizes the networks that we used, their architecture, and accuracy. Each row shows the dataset, the type of the network (classifier, generator, or discriminator), the network signature, and the architecture of the network. For example, the first row describes a classifier that takes as input images of size $2 8 \times 2 8$ pixels, each ranging between 0–1, and returns a probability distribution over ten classes.
421
+
422
+ <table><tr><td colspan="2">Query</td><td></td></tr><tr><td>1</td><td>eval N(var)</td><td>2 find i[shape]</td></tr><tr><td></td><td>3 find i[shape]</td><td>where c(N(i))=C</td></tr><tr><td></td><td>pix_con</td><td>where c(N(i))=C,</td></tr><tr><td></td><td>4 find i[shape] pix_con</td><td>where c(N(i))=C, N(i).p[c]&gt; 0.8,</td></tr><tr><td></td><td>init i=var</td><td>5 find i[shape] where c(N(i))=C</td></tr><tr><td></td><td>6 find i[shape] pix_con, init i=var</td><td>where c(N(i))=C, lli - var|lα &lt; dist</td></tr><tr><td>7</td><td>pix_con init i=var</td><td>find i[shape] where c(N(i))=C,</td></tr><tr><td></td><td>i[nm]=var[nm] init i=var</td><td>8 find i[shape] where c(N(i))=C, i[mask] in range,</td></tr><tr><td></td><td>pix_con, init i=var</td><td>9 find i[shape] where c(N(i))=C, N(i).p[c] &gt; 0.8</td></tr><tr><td>N(i).p[cu]&lt; 0.1</td><td>pix_con,</td><td>10 find i[shape] where c(N(i))=C, N(i).p[c] &gt; 0.8,</td></tr><tr><td></td><td>init i=var 11 find i[shape] pix_con, li-varl/α &lt; dist init i=var</td><td>where c(N(i))=C, N(i).p[c]&gt; 0.8, N(i).p[cu]&lt;0.i,</td></tr></table>
423
+
424
+ <table><tr><td colspan="2">Query</td><td></td></tr><tr><td>12 find i[shape] c(Ni(i))=C1</td><td>where pix_con, C (N2(i))=C2, 13 find i[shape] where pix_con,</td><td></td></tr><tr><td></td><td>C(N2(i))=C, |i - var|lα &lt; dist, c(Ni(i))=Cui init i=var 14 find i[shape]</td><td></td></tr><tr><td></td><td>where c(Ni(i))=C1, C (N2(i))=C2: N1(i).p[C1]&gt; 0.5, N2(i).p[c1]&lt; 0.1, N2(i).p[C2] &gt; 0.5, N1(i).p[C2]&lt;0.1, pix_con,D(i)&lt; 0.1</td><td></td></tr><tr><td>15 find i[100]</td><td>where i in[-1,1], C(N1(G(i)))=C1, Ni(G(i)).p[c1]&gt; 0.3, C(N2(G(i)))=C2, N2(G(i)).p[C2]&gt; 0.3 16 find i[shape]</td><td></td></tr><tr><td></td><td>where c(Ni(i))=Cv c(N2(i))=C, i[mask] in range, i[nm]=var[nm] init i=var 17 find i[shape]</td><td></td></tr><tr><td>pix_con</td><td>where c(Ni(i))=C1, c(N2(i))=C2: Ni(i).p[c1]&gt; 0.5, Ni(i).p[c2]&lt; 0.1,</td><td></td></tr><tr><td>pix_con</td><td>18 find i[shape] where c(Ni(i))=C1, c(N2(i))=C2: N1(i).p[c1]&gt; 0.6, Ni(i).p[c2]&lt; 0.1, N2(i).p[C2] &gt; 0.6, N2(i).p[c1]&lt;0.1,</td><td></td></tr></table>
425
+
426
+ # F ADDITIONAL EXPERIMENTS
427
+
428
+ Here we provide further experiments to investigate scalability and run-time behavior of DL. For all experiments we use the same hyperparameters as in Section 6.2, but ran experiments I and II on a laptop CPU and experiment III on the same GPU setup as in Section 6.2 and increased the timeout to $3 0 0 \mathrm { s }$ .
429
+
430
+ ![](images/dc7817c0a51e38f40b31e7a40a4de4815742cb1c2518a49f6e8776163dcbe84f.jpg)
431
+
432
+ (a) Run-time for experiment 1. Runs up to $2 ^ { 1 3 }$ vari- (b) Run-time for experiment 2. All runs up to $c =$ ables are between $0 . 1 - 0 . 2 \mathrm { ~ s ~ }$ and don’t show in- 5000 take around $0 . 1 5 \ : \mathrm { s }$ .
433
+ crease with number of variables. Afterwards growth
434
+ is linear.
435
+
436
+ Figure 6: Experimental results for Experiments 1 and 2. Results are average over 10 runs with different random seed. All runs succeed.
437
+
438
+ Experiment I: Number of variables To study the run-time behavior in the number of variables we consider a simple toy query
439
+
440
+ f i n d i[c]
441
+ w h e r e 1000 < sum(i), sum(i) < 1001
442
+ r e t u r n i
443
+
444
+ for different integers $c$ . We execute this query for a wide range of $c$ values, 10 times each and report the average run-time in Figure 6a. All runs succeeded and found a correct solution. We observe constant run-time behavior for up to $2 ^ { 1 3 }$ variables and linear run-time in the number of variables afterwards.
445
+
446
+ Experiment II: Opposing constrains To study the impact of (almost) opposing constraints we again consider a simple toy query
447
+
448
+ f i n d i[1]
449
+ w h e r e $\mathrm { ~ i ~ } [ 0 ] < - c \lor c < \mathrm { ~ i ~ } [ 0 ]$
450
+ r e t u r n i
451
+
452
+ for an integer $c$ . This query requires optimizing two opposing terms until one of them is fulfilled. The larger $c$ the more opposed the two objectives are and indeed for $c \to \infty$ we would obtain an unsatisfiable objective. Again all runs succeeded and found a correct solution. In Figure 6b we present the average run-time over 10 runs for different $c$ . Up to $c = 5 0 0 0$ the run-time is constant with roughly $0 . 1 5 \ : \mathrm { s }$ .
453
+
454
+ Experiment III: Scaling in the number of constraints To study the scaling of DL2 in the number of constraints consider the following query for an adversarial example:
455
+
456
+ For this experiment we consider the query:
457
+
458
+ FIND p[28, 28] WHERE c l a s s (M_NN1(clamp(p + M_nine, 0, 1))) = c RETURN i, clamp(p $^ +$ M_nine, 0, 1)
459
+
460
+ The query looks for an adversarial perturbation $p$ to a given image of a nine (M_nine) such that the resulting image gets classifies as class $c$ . The query returns the found perturbation and the resulting image. The clamp(I, a, b) operation takes an input I and cuts off all it’s values such that they are between $a$ and $b$ .
461
+
462
+ Additionally we impose constraints the rows and columns of the image. For a row $i$ we want to enforce that the values of the perturbation vector are increasing from left to right:
463
+
464
+ <table><tr><td colspan="8">Row constraints</td></tr><tr><td>k [s] #</td><td>0 1.01 9</td><td>1 2.63 9</td><td>3 5.77 9 Column</td><td>5 9.63 9 constraints</td><td>10 19.77 9</td><td>20 44.61 9</td><td>28 84.49 9</td></tr><tr><td>k [s] #</td><td>0 0.89 9</td><td>1 2.68 9 Row</td><td>3 5.73 9 &amp; Column constraints</td><td>5 9.30 9</td><td>10 18.46 9</td><td>20 42.03 9</td><td>28 125.92 9</td></tr><tr><td>k [s] #√</td><td>0 0.87</td><td>1 4.19</td><td>3 11.04</td><td>5 17.74</td><td>10 44.04</td><td>20 163.57</td><td>28 243.72</td></tr></table>
465
+
466
+ Table 4: Run times for additional constraints on adversarial perturbation. #✓is the number of successful runs out of 9 and $\textcircled{2}$ s the average run time over the successful runs in seconds. $k$ row or column constraints corresponds to 27 individual constraints in DL2 each. So the right most column adds 756 constraints for the first two settings and 1512 for the last.
467
+
468
+ $$
469
+ \begin{array} { r } { \texttt { p } [ \texttt { i } , \texttt { 0 } ] \texttt { < p } [ \texttt { i } , \texttt { 1 } ] , \texttt { p } [ \texttt { i } , \texttt { 1 } ] \texttt { < p } [ \texttt { i } , \texttt { 2 } ] , \texttt { p } [ \texttt { i } , \texttt { 2 } ] \texttt { < p } [ \texttt { i } , \texttt { 3 } ] , \texttt { \ldots } [ \texttt { i } , \texttt { i } ] . } \end{array}
470
+ $$
471
+
472
+ For one row this yields 27 constraints. Further we consider a similar constraint for a column $j$ , where we want the values to increase from to to bottom:
473
+
474
+ $$
475
+ \begin{array} { r } { \texttt { p } [ 0 , \texttt { \textbf { j } } ] \ < \texttt { p } [ 1 , \texttt { \textbf { j } } ] , \texttt { p } [ 1 , \texttt { \textbf { j } } ] \ < \texttt { p } [ 2 , \texttt { \textbf { j } } ] , \texttt { p } [ 2 , \texttt { \textbf { j } } ] \ < \texttt { p } [ 3 , \texttt { \textbf { j } } ] \ \dots . } \end{array}
476
+ $$
477
+
478
+ We apply these constraints on the first $k$ rows and columns of the image independently and jointly. For different $k$ we execute the query over all possible target classes $\bar { c } \in \{ 0 , \bar { \ldots } , 8 \}$ and report the average time in Table 4. The run-time is mostly linear for $k$ up to 20 but then jumps as we increase it to 28. The reason for this is likely that with many more constraints the solution spare grows sparer and sparser and it becomes hard to find an assignment. We observe that all queries, but for 5 in the case with $k = 2 8$ row and column constraints, could be solved. These 5 queries hit the $3 0 0 \mathrm { ~ s ~ }$ timeout. Figure 7 shows a resulting image.
479
+
480
+ ![](images/6bda7a762c324e9dc161f99d6fe1132f29bc264a0bc72e8fbdd10bb7eaecb9aa.jpg)
481
+ (b) The resulting image.
482
+
483
+ ![](images/e65de3bc926cd73596eb3a18d6f3d7db7adc78b92955c17fcf2ff4a117fea173.jpg)
484
+ Figure 7: Found results for the full 28 row & column constraints and target class 6.
485
+
486
+ (a) The found perturbation $p$ , scaled such that $- 0 . 3$ corresponds to black and 0.3 to white.
md/train/H1lVvgHKDr/H1lVvgHKDr.md ADDED
@@ -0,0 +1,243 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # KNOWLEDGE TRANSFER VIA STUDENT-TEACHER COLLABORATION
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Accompanying with the flourish development in various fields, deep neural networks, however, are still facing with the plight of high computational costs and storage. One way to compress these heavy models is knowledge transfer (KT), in which a light student network is trained through absorbing the knowledge from a powerful teacher network. In this paper, we propose a novel knowledge transfer method which employs a Student-Teacher Collaboration (STC) network during the knowledge transfer process. This is done by connecting the front part of the student network to the back part of the teacher network as the STC network. The back part of the teacher network takes the intermediate representation from the front part of the student network as input to make the prediction. The difference between the prediction from the collaboration network and the output tensor from the teacher network is taken into account of the loss during the train process. Through back propagation, the teacher network provides guidance to the student network in a gradient signal manner. In this way, our method takes advantage of the knowledge from the entire teacher network, who instructs the student network in learning process. Through plentiful experiments, it is proved that our STC method outperforms other KT methods with conventional strategy.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Deep neural networks have produced breakthrough results in various fields, such as computer vision (Krizhevsky et al., 2012; He et al., 2016) and natural language processing (Mikolov et al., 2010) in recent years. Through a mass of studies (Neyshabur et al., 2017; Canziani et al., 2016; Novak et al., 2018), researchers have proved that a DNN with larger capacity will have a better generalizability, which leads to a better performance. However, larger capacity will also cause heavier computational costs and storage, making these powerful models difficult to meet real-time requirements on embedded systems.
12
+
13
+ One way to compress these heavy models is knowledge transfer (KT). As can be seen in Figure 1(a), KT is a method to improve the performance of a light student network by absorbing the knowledge from a strong teacher network. In the early studies of KT such as knowledge distillation (KD) (Hinton et al., 2015), researchers took advantage of the output vector from teacher networks, converted it into “soft target” and trained the student network with the soft target and the ground-truth. KD can only be applied in classification task since the “soft target” is produced by the softmax function with temperature T. In recent studies, many methods focused on the intermediate representation of the teacher network, in which the feature map (Romero et al., 2015), attention map (Zagoruyko & Komodakis, 2016a) or the factor (Kim et al., 2018) extracted from student network are induced to mimic the corresponding one from teacher network by minimizing the difference between them. Figure 1(b) and Figure 1(c) are the overview of AT and FT. As can be seen, the role of the teacher network in these two methods is simply to provide an intermediate representation for imitation while does not give extra help during the training process. Moreover, due to divergence of the structure between the student and teacher networks, the student network usually cannot generate the same intermediate representation as the teacher network. In this case, an intermediate representation with the smallest difference does not equal to an accurate prediction.
14
+
15
+ ![](images/206032eee583c8289e602d20a96d66e95d1232ad882a298c7b22d17a51ba7b6c.jpg)
16
+ Figure 1: Overview of the proposed student-teacher collaboration method compared with other methods. (a) Student and teacher network. (b) Attention transfer (c) Factor transfer (d) Studentteacher collaboration. Different from the previous methods, we employ a collaboration network which is a connection of the front part of the student network and the back part of the teacher network. The difference between the predictions from the collaboration network and the teacher network is taken into account of loss during the training process. It can be clearly seen that our STC method additionally utilizes the knowledge from the top part of the teacher network.
17
+
18
+ To address the above problems, we propose a novel knowledge transfer method as illustrated in Figure 1(d). Different from the previous methods, we employ a collaboration network which is a connection of the front part of the student network and the back part of the teacher network during the training process. Specifically, we select a set of corresponding layers from the student and teacher networks. The front part and the back part of the selected layers of student and teacher networks are called student sub-network and teacher sub-network respectively. The teacher sub-network takes the intermediate representation from the student sub-network as input to make the prediction. Unlike KD using the soft target, in our method, the output tensor from the teacher network is directly treated as the target of the collaboration network. In this manner, our method can be applied to different tasks. During the training process, the difference between the predictions from the collaboration network and the teacher network is taken into account of the loss. Through back propagation, the gradient signal in the back part of the teacher network can be transferred to the student network and supervises the training process. In this way, teacher network in our method instructs student network on how to get the “answer”, rather than just give an intermediate representation for mimicking as in previous methods. It can be clearly seen from Figure 1 that our method additionally utilizes the knowledge from the teacher sub-network, compared with the previous methods. It is worth noting that the collaboration network is only used during the training process, the student network with the original structure is used for prediction during the inference time.
19
+
20
+ Our contributions can be summarized as follows:
21
+
22
+ • We propose a novel knowledge transfer method, additionally utilizing the knowledge from the back part of the teacher network by employing a collaboration network structure. To the best of our knowledge, the training strategy of insturcting the student network with a collaboration network has never been used.
23
+ • The teacher network in our method instructs student network on how to get the right “answer”, rather than just give an intermediate representation for mimicking as in previous methods.
24
+ • We take the output tensor from the teacher network as the target of the collaboration network, which brings good generalizability to our method on different tasks.
25
+ • We experimentally show that our method outperforms other methods with conventional strategy on various datasets in different tasks.
26
+
27
+ # 2 RELATED WORKS
28
+
29
+ To reduce the model size as well as the computational costs of deep neural networks, a variety of methods have been proposed. These methods can be summarized into five categories: network pruning, parameter quantization, tensor decomposition, efficient architecture design and knowledge transfer. Network pruning is a way to reduce the redundancy in the neural networks(LeCun et al., 1990). Han et al. (2015) pruned the network by removing the unimportant connections. Later network pruning methods operate at channel or filter levels(Han et al., 2015; Yamamoto & Maeno, 2018; Liu et al., 2018; He et al., 2017). Parameter quantization aims at compressing the model by reducing the number of bits occupied by the weights or neurons. In Gupta et al. (2015), Vanhoucke et al. (2011), Zhuang et al. and Rastegari et al. (2016), authors trained convolutional neural networks using 16-bit, 8-bit, 4-bit and 1-bit weights respectively. Han et al. (2016) optimized the model combined with network pruning, quantization and huffman coding. Tensor decomposition compresses the networks by decomposing dense convolutional kernels with low-rank approximations, including CP-decomposition(Lebedev et al., 2014), Tucker decomposition(Kim et al., 2016) and tensor ring decomposition(Zhao et al., 2016). Efficient network architecture design is an interesting approach to accelerate the model, such as SqueezeNet (Iandola et al., 2017), Mobilenet (Howard et al., 2017), ShuffleNet (Zhang et al., 2018) and Xception (Chollet, 2017).
30
+
31
+ In addition to the above four strategies that will partially change the components of the network, knowledge transfer is another way to compress the model by improving the performance of a lighter student network with the knowledge from a stronger teacher network. To the best of our knowledge, the earliest work of knowledge transfer is Bucilua et al. (2006), which to train a small model with data labeled by an ensemble of large model. Li et al. (2014) took the KL divergence between the posterior probabilities produced by the softmax operation from student and teacher model as loss function for knowledge transfer. Hinton et al. (2015) proposed a method called knowledge distillation (KD), converting the posterior probabilities extracted from teacher network into “soft targets”. In Fitnets (Romero et al., 2015), they regarded the feature map extracted from the teacher network as hints, and trained the student network by mimicking the corresponding feature maps of student and teacher networks. Attention transfer (AT) (Zagoruyko & Komodakis, 2016a) computed the summations of the feature map across the channel to generate the attention map and trained the student network by minimizing the difference between the attention map of corresponding blocks. Factor transfer (FT) (Kim et al., 2018) employed a paraphraser and a translator to translate the knowledge in the feature maps into factors. The student network is optimized by minimizing the $l _ { 2 }$ loss between student and teacher factors. In Ding et al. (2019), authors compressed the CNN-DBLSTM model on OCR task with Tucker decomposition and the knowledge in the teacher’s BLSTM and inner product layers. There are also studies on knowledge transfer utilizing the adversarial networks, such as $\mathrm { X u }$ et al., Belagiannis et al. (2018) and Wang et al. (2018).
32
+
33
+ # 3 METHOD
34
+
35
+ An eminent teacher should not only give a referenced answer to a student, but also teach student how to get the answer. Analogously, during the training process of the student network, a teacher network should teach the student network how to make the right prediction to play a role as an eminent teacher. In this section, we will firstly explain some concerns in the previous knowledge transfer methods and then describe our method in detail to explain how the teacher network instructs the student network’s learning process in our method.
36
+
37
+ # 3.1 CONCERNS IN THE PREVIOUS METHODS
38
+
39
+ Previous knowledge transfer methods, such as AT (Zagoruyko & Komodakis, 2016a) and FT (Kim et al., 2018), train the student network by minimizing the difference between the intermediate representations extracted from the corresponding layers of student and teacher networks. However, this training strategy contains the following problems.
40
+
41
+ The first problem is that the teacher network in the previous methods simply provided an intermediate representation for imitation but did not teach student network how to get it. Therefore, the guidance from teacher network is limited in the previous methods. Another problem is the intermediate representation from teacher network is treated as the target in these method. However, due to the divergence of the structure between the student and teacher networks, the student network usually cannot generate the same intermediate representation as the teacher network. In this case, an intermediate representation with the smallest difference does not equal to an accurate prediction. What’s more, the intermediate representation is extracted from the hidden layer of the network, so the knowledge in the subsequent layers of the teacher network cannot be utilized.
42
+
43
+ ![](images/809b017244274bca8c289f8970d78c5d7ecdb7492118a537cb9b1768c4460671.jpg)
44
+ Figure 2: Training process of the proposed student-teacher collaboration method. We take the output tensor from the teacher network as the target of the collaboration network. The student network is trained with the collaboration loss and the classification loss. During the training process, the weights of the teacher network and teacher sub-network are fixed, only the weights of student network are updated.
45
+
46
+ # 3.2 STUDENT-TEACHER COLLABORATION
47
+
48
+ To address the above problems, we proposed a novel training strategy for knowledge transfer in our method which is insturcting the student network with a collaboration network during the training process. As illustrated in Figure 2, our method consists of three steps. Firstly, we forward propagate a pretrained teacher network $\tau$ with the input data $\pmb { I }$ to get the target $O _ { t }$ . Secondly, we connect all the front part of a selected layer of the student network which we called student sub-network to the corresponding layer1 of the teacher network as a collaboration network. The subsequent layers of the teacher network which we called teacher sub-network takes the intermediate representation from the student sub-network as input to produce the prediction $O _ { c }$ . The forward propagation of the collaboration network can be formulated as:
49
+
50
+ $$
51
+ O _ { c } = \mathcal { T } _ { s u b } ( x _ { s } ^ { l _ { s } } ) = \mathcal { T } _ { s u b } \circ f ( w _ { s } ^ { l _ { s } } x _ { s } ^ { l _ { s } - 1 } )
52
+ $$
53
+
54
+ where $c$ and $s$ are the symbol for collaboration and student network respectively. $\tau _ { s u b }$ denotes the calculations of the teacher sub-network. $f$ denotes the activation function. $l , x$ and $w$ denotes the layer number, intermediate representation and weights of the network respectively. Biases are omitted for simplifying notations.
55
+
56
+ After forward propagate the collaboration network, we compute the difference between the predictions from the collaboration network and the teacher network as the STC loss $\pmb { L } _ { S T C }$ . The back propagation of STC loss can be formulated as:
57
+
58
+ $$
59
+ \frac { \partial { \cal L } _ { S T C } ( { \cal O } _ { c } , { \cal O } _ { t } ) } { \partial w ^ { l _ { s } } } = \frac { \partial { \cal L } _ { S T C } ( { \cal O } _ { c } , { \cal O } _ { t } ) } { \partial { \cal O } _ { c } } \frac { \partial { \cal O } _ { c } } { \partial x _ { s } ^ { l _ { s } } } \frac { \partial x _ { s } ^ { l _ { s } } } { \partial w _ { s } ^ { l _ { s } } }
60
+ $$
61
+
62
+ where $O _ { t }$ denotes the output tensor from teacher network. Biases are omitted for simplifying notations.
63
+
64
+ As can be seen in Eq. 2, the teacher network instructs the training process of the student network in a gradient signal manner. To be specific, the gradient signal of the teacher sub-network $\frac { \partial O _ { c } } { \partial { \pmb x } _ { s } ^ { l _ { s } } }$ plays a role of weight parameters in the backward propagation formula, which indicates that the teacher network provides guidance to the student network on which element in the weights $\mathbf { \Delta } w ^ { l _ { s } }$ should be paid more attention to during the training process. Since we directly take the output tensor of the teacher network as the target of the collaboration network, this training strategy is more accurate than minimizing the difference between the intermediate representations as previous methods did. Moreover, it can be clearly seen from Figure 2 that our method additionally utilizes the back part of the teacher network, which will bring more knowledge for student network during the training process.
65
+
66
+ There are also optional selections of target in our method, which are soft target as in Hinton et al. (2015) and the ground-truth target. However, since there is no knowledge of the teacher network in the ground-truth target, it is not a good choice for our method. As for the soft target, it can only be applied to classification task, because it is generated by the softmax function with temperature T. We will demonstrate the experimental results of different selections of the target in Sec. 4.
67
+
68
+ # 3.3 LOSS FUNCTION
69
+
70
+ The loss function $\mathbf { { L } } _ { t o t a l }$ for training student network in classification task can be separated into two items, i.e. the classification loss $\scriptstyle { L _ { C F } }$ and the student-teacher collaboration (STC) loss $L _ { S T C }$ :
71
+
72
+ $$
73
+ \begin{array} { r l } & { \pmb { L } _ { t o t a l } = \alpha \pmb { L } _ { S T C } + ( 1 - \alpha ) \pmb { L } _ { C F } } \\ & { \pmb { L } _ { S T C } = \pmb { \mathcal { C } } ( \pmb { T } _ { s u b } \circ \pmb { S } _ { l _ { s } } ( \pmb { I } ) - \pmb { \mathcal { T } } ( \pmb { I } ) ) } \\ & { \qquad \pmb { L } _ { C F } = \pmb { \mathcal { C } } ( \pmb { S } ( \pmb { I } ) , \pmb { G } ) } \end{array}
74
+ $$
75
+
76
+ where $c$ denotes the cross entropy loss, $\pmb { S } _ { l _ { s } }$ denotes the front part calculations of the student network and $G$ denotes the ground-truth label respectively.
77
+
78
+ We train the student network by minimizing the weighted sum of two loss as shown in Eq. 3, where weight $\alpha$ is a hyper-parameter. Specifically, the STC loss is the cross-entropy between the predictions from collaboration and teacher networks, the classification loss is the cross-entropy between the prediction from student network and ground-truth. During the training process, the weights of the teacher sub-network are fixed, only the weights of the student network are updated.
79
+
80
+ For other types of tasks, the training process can be achieved by replacing the cross-entropy loss with the corresponding loss, such as smooth- $\mathbf { \cdot L } _ { 1 }$ loss for bounding-box regression (Girshick, 2015).
81
+
82
+ # 3.4 INTEGRATING WITH KD
83
+
84
+ Knowledge distillation (KD) Hinton et al. (2015) trains the student network with the soft target from teacher network. The definition of soft target is $p = s o f t m a x ( \frac { o } { T } )$ , where $o$ is the output tensor of teacher logits (pre-softmax activations) and $T$ is a temperature. Since KD takes no additional storage and computational costs during training, it can be integrated with other knowledge transfer methods, such as AT Zagoruyko & Komodakis (2016a) and FT Kim et al. (2018) in the classification task. However, these methods result in performance degradation when integrating with KD in some cases, because of the fact that mimicking the intermediate representations does not equal to a good prediction of student network.
85
+
86
+ In contrast, our method takes the output tensor from teacher network as the target, which is consistent with KD. During experiments, our method shows good synergy integrating with KD, thus further improves the performance of student network. We will demonstrate these results in Sec. 4.
87
+
88
+ # 4 EXPERIMENTS
89
+
90
+ In this section, we demonstrate the performance of proposed STC method in classification task on CIFAR-10 (Krizhevsky et al., 2014), CIFAR-100 (Krizhevsky et al., 2009), ImageNet LSVRC 2012 (Deng et al., 2009) datasets and object detection task on PASCAL VOC 2007 (Everingham & Winn, 2006) dataset. Firstly, we evaluate the STC performance integrated with or without KD (Hinton et al., 2015) of various student and teacher models on CIFAR-10, CIFAR-100 and ImageNet
91
+
92
+ Table 1: Top-1 classification error $( \% )$ on CIFAR-10 dataset. The first 7 columns are from manuscript of Kim et al. (2018).
93
+
94
+ <table><tr><td>Student</td><td>Teacher</td><td>KD</td><td>AT</td><td>+KD</td><td>FT +KD</td><td>STC</td><td>+KD</td></tr><tr><td>ResNet-20 (7.78)</td><td>ResNet-56 (6.36)</td><td>7.19</td><td>7.13</td><td>6.89</td><td>6.85</td><td>7.04</td><td>6.53 6.3</td></tr><tr><td>ResNet-20 (7.78)</td><td>WRN-40-1 (6.52)</td><td>7.09</td><td>7.34</td><td>7.00</td><td>6.85</td><td>6.95</td><td>6.30 6.22</td></tr><tr><td>VGG-13 (5.99)</td><td>WRN-46-4 (4.22)</td><td>5.71</td><td>5.54</td><td>5.30</td><td>4.84</td><td>4.65</td><td>4.82 4.63</td></tr><tr><td>WRN-16-1 (8.62)</td><td>WRN-16-2 (5.99)</td><td>7.64</td><td>8.10</td><td>7.52</td><td>7.64</td><td>7.59</td><td>7.15 7.05</td></tr></table>
95
+
96
+ Table 2: Top-1 classification error $( \% )$ on CIFAR-100 dataset. The first 7 columns are from manuscript of Kim et al. (2018).
97
+
98
+ <table><tr><td>Student</td><td>Teacher</td><td>KD</td><td>AT</td><td>+KD</td><td>FT</td><td>+KD STC</td><td>+KD</td></tr><tr><td>ResNet-20 (31.24)</td><td>ResNet-110 (26.99)</td><td>33.14</td><td>31.04</td><td>34.78</td><td>29.08</td><td>32.19 28.75</td><td>28.53</td></tr><tr><td>ResNet-56 (28.04)</td><td>ResNet-110 (26.99)</td><td>27.96</td><td>27.28</td><td>28.01</td><td>25.62</td><td>26.93 25.33</td><td>24.92</td></tr></table>
99
+
100
+ ILSVRC2012 datasets, compared with AT (Zagoruyko & Komodakis, 2016a) and FT (Kim et al., 2018). Secondly, we evaluate our method on PASCAL VOC 2007 dataset for object detection task compared with FT to show the generalizability of our method. Finally, we illustrate the result of different types of target on CIFAR-10 dataset.
101
+
102
+ # 4.1 CIFAR
103
+
104
+ CIFAR-10 and CIFAR-100 both are the basic image classification datasets and are used to evaluate the performance in many knowledge transfer methods (Zagoruyko & Komodakis, 2016a; Kim et al., 2018; Huang & Wang, 2017). For these two sets, we train the student network for 500 epochs with a mini-batch size of 128 and weight decay of $1 0 ^ { - 4 }$ . The learning rate starts from 0.1 and is divided by 10 at 150, 300 and 400 epochs. $\alpha$ is set to 0.3 on CIFAR-10 and 0.5 on CIFAR100 empirically. For data augmentation, we following the policy in He et al. (2016). In order to make the experimental results more convincing, we use the same student and teacher networks as FT (Kim et al., 2018) did, including ResNet (He et al., 2016), Wide ResNet (WRN) (Zagoruyko & Komodakis, 2016b) and VGG (Simonyan & Zisserman, 2014). For CIFAR-10, the corresponding student and teacher networks are 1) ResNet-20 and ResNet-56, which have same width (number of channels) and different depth (number of layers). 2) ResNet-20 and WRN-40-1, which have different width and depth. 3) WRN-16-1 and WRN-16-2, which have same depth and different width. 4) VGG-13 and WRN-46-4, where residual block exists in WRN but not in VGG. For CIFAR-100, the corresponding student and teacher networks are 1) ResNet-56 and ResNet-110. 2) Resnet-20 and ResNet-110. For cases that the intermediate representation from the student sub-network has different number of channels with the teacher sub-network, a simple convolutional layer is employed to transform the dimension.
105
+
106
+ In Table 1 and Table 2, “Student” column shows the type of student network and the number in parentheses is the performance of student network trained from scratch. “Teacher” column provides the type of teacher network and the performance of pretrained teacher network by our implementation. $" + \mathrm { K D } ^ { \prime \prime }$ column provides the performance of the corresponding method combined with KD.
107
+
108
+ Performance on CIFAR-10 is shown in Table 1, for all the cases our STC method outperforms other knowledge transfer methods no matter with or without KD. We can find another result that AT and our method show good synergy when integrating with KD on CIFAR-10 dataset, while FT has conflicts with KD in some cases.
109
+
110
+ As shown in Table 2, on CIFAR-100 dataset, our method achieves the best performance among all the methods in both cases of integrated with or without KD. Different from CIFAR-10 dataset, after combining with KD, both AT and FT have an obvious performance degradation on CIFAR-100. This is because the data of CIFAR-100 are more complex than CIFAR-10 and the teacher network (ResNet-110) is deeper than that of CIFAR-10. In this case, the knowledge from the teacher subnetwork is vital for the student network.
111
+
112
+ # 4.2 IMAGENET
113
+
114
+ To demonstrate the performance of our method on large dataset, we choose ResNet-18 as student network and ResNet-34 as teacher network training on ImageNet ILSVRC2012 dataset, which consists of 1.2 million training images and 50 thousand validation images. We optimize the student network with a mini-batch size of 512 and weight decay of $1 0 ^ { - 4 }$ on 4 GPUs. The $\alpha$ are set to 0.5 empirically. The learning rate starts from 0.1 and is divided by 10 when the error plateaus. A $2 2 4 \times 2 2 4$ crop is randomly sampled from an image or its horizontal flip for data augmentation. We evaluate the performance of KD, AT, FT and proposed method STC. Top-1 and Top-5 error rates as shown in Table 3.
115
+
116
+ As can be seen, our STC method consistently outperforms other methods on both Top-1 and Top5 error rates on ImageNet dataset. KD method suffers from the gap of depths between teacher and student network, leads to an even worse performance than training the student from scratch. KT and AT, again, show the conflicts when combined with KD, since they target at mimicking the intermediate representation but not the prediction. In contrast, our STC method improve the performance of student network by $1 . 3 6 \%$ Top-1 error rate without KD and $1 . 6 1 \%$ Top-1 error rate combined with KD, consistently shows good synergy integrated with KD.
117
+
118
+ Table 3: Top-1 and Top-5 classification error $( \% )$ on ImageNet ILSVRC2012 dataset. Pretrained student and teacher network are from PyTorch (Paszke et al., 2017) model zoo. Other statistics are gathered from our implementations.
119
+
120
+ <table><tr><td rowspan=1 colspan=1>error(%)</td><td rowspan=1 colspan=1>Student</td><td rowspan=1 colspan=1>Teacher</td><td rowspan=1 colspan=1>KD</td><td rowspan=1 colspan=1>AT+KD</td><td rowspan=1 colspan=1>FT+KD</td><td rowspan=1 colspan=1>STC +KD</td></tr><tr><td rowspan=1 colspan=1>Top-1</td><td rowspan=1 colspan=1>ResNet-18 (30.24)</td><td rowspan=1 colspan=1>ResNet-34 (26.69)</td><td rowspan=1 colspan=1>33.77</td><td rowspan=1 colspan=1>29.5232.80</td><td rowspan=1 colspan=1>29.0830.30</td><td rowspan=1 colspan=1>28.88 28.63</td></tr><tr><td rowspan=1 colspan=1>Top-5</td><td rowspan=1 colspan=1>ResNet-18 (10.92)</td><td rowspan=1 colspan=1>ResNet-34 (8.58)</td><td rowspan=1 colspan=1>12.29</td><td rowspan=1 colspan=1>9.9511.89</td><td rowspan=1 colspan=1>9.7510.47</td><td rowspan=1 colspan=1>9.669.54</td></tr></table>
121
+
122
+ # 4.3 PASCAL VOC 2007
123
+
124
+ To verify the generalizability of our method on different tasks, we evaluate the performance of our method on PASCAL VOC 2007 detection dataset. We use Faster-RCNN (Ren et al., 2015) pipeline for evaluation as Kim et al. (2018) did, which are VGG-16 backbone for student network and ResNet-101 backbone for teacher network specifically. We train the student network for 15 epochs with a mini-batch size of 16. The learning rate starts from 0.01 and is divided by 10 at 6 and 11 epochs. The $\alpha$ are set to 0.5 empirically. Since the proposal boxes from RPN module in teacher and student network are of different spatial positions, we extract the RPN and detector module of the teacher network as the teacher sub-network and the backbone of student network as student sub-network, which can be seen in Figure 3.
125
+
126
+ ![](images/2c41b13a1b5199c7d9922e2e19e3458db4a06fc579e6106a287e69a3f7765d5c.jpg)
127
+ Figure 3: STC method on object detection task. We take the backbone of the student network as student sub-network and RPN, ROI pooling, detector module of teacher network as teacher subnetwork.
128
+
129
+ Table 4 is the performance of our method compared with FT on PASCAL VOC 2007 dataset. As can be seen, the mAP of the student network is promoted by $1 . 6 \%$ in our method, while that in FT is $0 . 8 \%$ . This result proves that our method can be applied to various tasks and is superior to the previous methods.
130
+
131
+ Table 4: Mean average precision $( \% )$ on PASCAL VOC 2007 dataset. Both student and teacher network follow the Faster-RCNN pipeline. The backbone of student and teacher networks are VGG16 and ResNet-101 respectively.
132
+
133
+ <table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>Student</td><td rowspan=1 colspan=1>Teacher</td><td rowspan=1 colspan=1>mAP</td></tr><tr><td rowspan=1 colspan=1>FT</td><td rowspan=1 colspan=1>VGG-16 backbone(69.4)</td><td rowspan=1 colspan=1>ResNet-101 backbone (75.2)</td><td rowspan=1 colspan=1>70.3</td></tr><tr><td rowspan=1 colspan=1>STC</td><td rowspan=1 colspan=1>VGG-16 backbone(69.4)</td><td rowspan=1 colspan=1>ResNet-101backbone (75.2)</td><td rowspan=1 colspan=1>71.0</td></tr></table>
134
+
135
+ # 4.4 ABLATION STUDY
136
+
137
+ In this paragraph, we evaluate the performance of different selections of the target in our method on CIFAR-10 dataset, using the same student and teacher network as Sec. 4.1.
138
+
139
+ The performance of various target can be seen in Table 5. In Table 5, “output tensor (t)” and “soft target (t)” denote the output tensor and the soft target are generated from the teacher networks. “ground-truth (d)” denotes the ground-truth target is from the dataset. For the generating of the soft target, we follow the fashion in Hinton et al. (2015).
140
+
141
+ As can be seen, the selection of ground-truth target gets the worst results among all the cases. This is because the ground-truth target does not contain knowledge in the teacher network, so there is limited help in improving the performance of the student network.
142
+
143
+ For the selection of soft target, even though it can get about the same performance, it can only be employed on classification task, because the soft target is produced by the softmax function with temperature T. Considering the generalizability of our method on different tasks, we choose the output tensor from teacher network as the target.
144
+
145
+ Table 5: Top-1 classification error $\% )$ of different selections of the target on CIFAR-10 dataset.
146
+
147
+ <table><tr><td rowspan=1 colspan=1>Student</td><td rowspan=1 colspan=1>Teacher</td><td rowspan=1 colspan=1>output tensor (t)</td><td rowspan=1 colspan=1>soft target (t)</td><td rowspan=1 colspan=1> ground-truth (d)</td></tr><tr><td rowspan=1 colspan=1>ResNet-20 (7.78)</td><td rowspan=1 colspan=1>ResNet-56 (6.39)</td><td rowspan=1 colspan=1>6.53</td><td rowspan=1 colspan=1>6.59</td><td rowspan=1 colspan=1>6.78</td></tr><tr><td rowspan=1 colspan=1>ResNet-20 (7.78)</td><td rowspan=1 colspan=1>WRN-40-1(6.84)</td><td rowspan=1 colspan=1>6.30</td><td rowspan=1 colspan=1>6.55</td><td rowspan=1 colspan=1>6.83</td></tr><tr><td rowspan=1 colspan=1>VGG-13 (5.99)</td><td rowspan=1 colspan=1>WRN-46-4 (4.44)</td><td rowspan=1 colspan=1>4.82</td><td rowspan=1 colspan=1>4.80</td><td rowspan=1 colspan=1>5.17</td></tr><tr><td rowspan=1 colspan=1>WRN-16-1 (8.62)</td><td rowspan=1 colspan=1>WRN-16-2 (6.27)</td><td rowspan=1 colspan=1>7.15</td><td rowspan=1 colspan=1>7.39</td><td rowspan=1 colspan=1>8.01</td></tr></table>
148
+
149
+ # 5 CONCLUSION
150
+
151
+ In this paper, we proposed a novel knowledge transfer method called student-teacher collaboration (STC). Different from previous methods, our method employs a collaboration network by connecting the front part of the student network and the back part of the teacher network during the training process. We take the difference between the output predictions from the collaboration network and the teacher network into account of the loss to train the student network. Through back propagation, the knowledge of the teacher sub-network can be additionally utilized in a gradient signal manner. Specifically, the teacher network provides guidance to the student network on which element in the weights should be paid more attention to during the training process.
152
+
153
+ Through plentiful experiments, it is proved that our STC method outperforms previous knowledge transfer methods on various datasets and has good generalizability on different tasks. What’s more, our method has good synergy integrated with KD to further improve the performance of the student network, while other methods result in accuracy degradation in some cases.
154
+
155
+ To the best of our knowledge, the training strategy which is insturcting the student network with a collaboration network has never been used in other knowledge transfer methods. We believe that this novel idea will further promote the development of knowledge transfer.
156
+
157
+ # REFERENCES
158
+
159
+ Vasileios Belagiannis, Azade Farshad, and Fabio Galasso. Adversarial network compression. 03 2018.
160
+
161
+ Cristian Bucilua, Rich Caruana, and Alexandru Niculescu-Mizil. Model compression. In Proceedings of the 12th ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 535–541. ACM, 2006.
162
+
163
+ Alfredo Canziani, Adam Paszke, and Eugenio Culurciello. An analysis of deep neural network models for practical applications. arXiv preprint arXiv:1605.07678, 2016.
164
+
165
+ Francois Chollet. Xception: Deep learning with depthwise separable convolutions. computer vision and pattern recognition, pp. 1800–1807, 2017.
166
+
167
+ Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pp. 248–255. Ieee, 2009.
168
+
169
+ Haisong Ding, Kai Chen, and Qiang Huo. Compressing cnn-dblstm models for ocr with teacherstudent learning and tucker decomposition. Pattern Recognition, 96, 07 2019. doi: 10.1016/j. patcog.2019.07.002.
170
+
171
+ Mark Everingham and John Winn. The pascal visual object classes challenge 2007 (voc2007) development kit. International Journal of Computer Vision, 111(1):98–136, 2006.
172
+
173
+ Ross Girshick. Fast r-cnn. In Proceedings of the IEEE international conference on computer vision, pp. 1440–1448, 2015.
174
+
175
+ Suyog Gupta, Ankur Agrawal, Kailash Gopalakrishnan, and Pritish Narayanan. Deep learning with limited numerical precision. Computer Science, 2015.
176
+
177
+ S. Han, J. Pool, J. Tran, and W. J. Dally. Learning both weights and connections for efficient neural networks. neural information processing systems, pp. 1135–1143, 2015.
178
+
179
+ S. Han, H. Mao, and W. J. Dally. Deep compression: Compressing deep neural networks with pruning, trained quantization and huffman coding. international conference on learning representations, 2016.
180
+
181
+ K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016.
182
+
183
+ Yihui He, Xiangyu Zhang, and Jian Sun. Channel pruning for accelerating very deep neural networks. In The IEEE International Conference on Computer Vision (ICCV), Oct 2017.
184
+
185
+ Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015.
186
+
187
+ 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: Computer Vision and Pattern Recognition, 2017.
188
+
189
+ Zehao Huang and Naiyan Wang. Like what you like: Knowledge distill via neuron selectivity transfer. arXiv preprint arXiv:1707.01219, 2017.
190
+
191
+ Forrest N Iandola, Song Han, Matthew W Moskewicz, Khalid Ashraf, William J Dally, and Kurt Keutzer. Squeezenet: Alexnet-level accuracy with 50x fewer parameters and $\mathrm { i 0 . 5 m b }$ model size. arXiv: Computer Vision and Pattern Recognition, 2017.
192
+
193
+ Jangho Kim, Seounguk Park, and Nojun Kwak. Paraphrasing complex network: Network compression via factor transfer. neural information processing systems, pp. 2760–2769, 2018.
194
+
195
+ Yong-Deok Kim, Eunhyeok Park, Sungjoo Yoo, Taelim Choi, Lu Yang, and Dongjun Shin. Compression of deep convolutional neural networks for fast and low power mobile applications. 05 2016.
196
+
197
+ Alex Krizhevsky, Vinod Nair, and Geoffrey Hinton. Cifar-10 and cifar-100 datasets. URl: https://www. cs. toronto. edu/kriz/cifar. html, 6, 2009.
198
+
199
+ 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.
200
+
201
+ Alex Krizhevsky, Vinod Nair, and Geoffrey Hinton. The cifar-10 dataset. online: http://www. cs. toronto. edu/kriz/cifar. html, 55, 2014.
202
+
203
+ Vadim Lebedev, Yaroslav Ganin, Maksim Rakhuba, Ivan Oseledets, and Victor Lempitsky. Speeding-up convolutional neural networks using fine-tuned cp-decomposition, 2014. URL http://arxiv.org/abs/1412.6553. cite arxiv:1412.6553.
204
+
205
+ Y. LeCun, J. S. Denker, and S. A. Solla. Optimal brain damage. In Advances in neural information processing systems, pp. 598–605, 1990.
206
+
207
+ J. Li, R. Zhao, J.-T Huang, and Y. Gong. Learning small-size dnn with output-distribution-based criteria. Proceedings of the Annual Conference of the International Speech Communication Association, INTERSPEECH, pp. 1910–1914, 01 2014.
208
+
209
+ Zhenhua Liu, Jizheng Xu, Xiulian Peng, and Ruiqin Xiong. Frequency-domain dynamic pruning for convolutional neural networks. In Advances in Neural Information Processing Systems, pp. 1043–1053, 2018.
210
+
211
+ Toma´s Mikolov, Martin Karafi ˇ at, Luk ´ a´s Burget, Jan ˇ Cernock ˇ y, and Sanjeev Khudanpur. Recurrent\` neural network based language model. In Eleventh annual conference of the international speech communication association, 2010.
212
+
213
+ Behnam Neyshabur, Srinadh Bhojanapalli, David McAllester, and Nati Srebro. Exploring generalization in deep learning. In Advances in Neural Information Processing Systems, pp. 5947–5956, 2017.
214
+
215
+ Roman Novak, Yasaman Bahri, Daniel A Abolafia, Jeffrey Pennington, and Jascha SohlDickstein. Sensitivity and generalization in neural networks: an empirical study. arXiv preprint arXiv:1802.08760, 2018.
216
+
217
+ Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan, Edward Yang, Zachary DeVito, Zeming Lin, Alban Desmaison, Luca Antiga, and Adam Lerer. Automatic differentiation in pytorch. 2017.
218
+
219
+ M. Rastegari, V. Ordonez, J. Redmon, and A. Farhadi. Xnor-net: Imagenet classification using binary convolutional neural networks. In European Conference on Computer Vision, pp. 525– 542. Springer, 2016.
220
+
221
+ Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster r-cnn: Towards real-time object detection with region proposal networks. In Advances in neural information processing systems, pp. 91–99, 2015.
222
+
223
+ Adriana Romero, Nicolas Ballas, Samira Ebrahimi Kahou, Antoine Chassang, Carlo Gatta, and Yoshua Bengio. Fitnets: Hints for thin deep nets. international conference on learning representations, 2015.
224
+
225
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
226
+
227
+ V. Vanhoucke, A. Senior, and M.Z. Mao. Improving the speed of neural networks on cpus. 2011.
228
+
229
+ Xiaojie Wang, Rui Zhang, Yu Sun, and Jianzhong Qi. Kdgan: Knowledge distillation with generative adversarial networks. In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi, and R. Garnett (eds.), Advances in Neural Information Processing Systems 31, pp. 775–786. Curran Associates, Inc., 2018. URL http://papers.nips.cc/paper/ 7358-kdgan-knowledge-distillation-with-generative-adversarial-networks. pdf.
230
+
231
+ Zheng Xu, Yen-Chang Hsu, and Jiawei Huang. Training shallow and thin networks for acceleration via knowledge distillation with conditional adversarial networks.
232
+
233
+ Kohei Yamamoto and Kurato Maeno. Pcas: Pruning channels with attention statistics. 2018.
234
+
235
+ Sergey Zagoruyko and Nikos Komodakis. Paying more attention to attention: Improving the performance of convolutional neural networks via attention transfer. arXiv preprint arXiv:1612.03928, 2016a.
236
+
237
+ Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. arXiv preprint arXiv:1605.07146, 2016b.
238
+
239
+ Xiangyu Zhang, Xinyu Zhou, Mengxiao Lin, and Jian Sun. Shufflenet: An extremely efficient convolutional neural network for mobile devices. computer vision and pattern recognition, pp. 6848–6856, 2018.
240
+
241
+ Qibin Zhao, Guoxu Zhou, Shengli Xie, Liqing Zhang, and Andrzej Cichocki. Tensor ring decomposition. 06 2016.
242
+
243
+ Bohan Zhuang, Chunhua Shen, Mingkui Tan, Lingqiao Liu, and Ian Reid. Towards effective lowbitwidth convolutional neural networks.
md/train/H1ldNoC9tX/H1ldNoC9tX.md ADDED
@@ -0,0 +1,519 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CLASSIFICATION FROM POSITIVE, UNLABELED AND BIASED NEGATIVE DATA
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Positive-unlabeled (PU) learning addresses the problem of learning a binary classifier from positive (P) and unlabeled (U) data. It is often applied to situations where negative (N) data are difficult to be fully labeled. However, collecting a non-representative $\mathbf { N }$ set that contains only a small portion of all possible N data can be much easier in many practical situations. This paper studies a novel classification framework which incorporates such biased N (bN) data in PU learning. The fact that the training N data are biased also makes our work very different from those of standard semi-supervised learning. We provide an empirical risk minimization-based method to address this PUbN classification problem. Our approach can be regarded as a variant of traditional example-reweighting algorithms, with the weight of each example computed through a preliminary step that draws inspiration from PU learning. We also derive an estimation error bound for the proposed method. Experimental results demonstrate the effectiveness of our algorithm in not only PUbN learning scenarios but also ordinary PU leaning scenarios on several benchmark datasets.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ In conventional binary classification, examples are labeled as either positive (P) or negative (N), and we train a classifier on these labeled examples. On the contrary, positive-unlabeled (PU) learning addresses the problem of learning a classifier from P and unlabeled (U) data, without need of explicitly identifying N data (Elkan & Noto, 2008; Ward et al., 2009).
12
+
13
+ PU learning finds its usefulness in many real-world problems. For example, in one-class remote sensing classification (Li et al., 2011), we seek to extract a specific land-cover class from an image. While it is easy to label examples of this specific land-cover class of interest, examples not belonging to this class are too diverse to be exhaustively annotated. The same problem arises in text classification, as it is difficult or even impossible to compile a set of N samples that provides a comprehensive characterization of everything that is not in the P class (Liu et al., 2003; Fung et al., 2006). Besides, PU learning has also been applied to other domains such as outlier detection (Hido et al., 2008; Scott & Blanchard, 2009), medical diagnosis (Zuluaga et al., 2011), or time series classification (Nguyen et al., 2011).
14
+
15
+ By carefully examining the above examples, we find out that the most difficult step is often to collect a fully representative N set, whereas only labeling a small portion of all possible N data is relatively easy. Therefore, in this paper, we propose to study the problem of learning from P, U and biased N (bN) data, which we name PUbN learning hereinafter. We suppose that in addition to $\mathrm { \bf P }$ and U data, we also gather a set of bN samples, governed by a distribution distinct from the true $\mathbf { N }$ distribution. As described previously, this can be viewed as an extension of PU learning, but such bias may also occur naturally in some real-world scenarios. For instance, let us presume that we would like to judge whether a subject is affected by a particular disease based on the result of a physical examination. While the data collected from the patients represent rather well the $\mathrm { \bf P }$ distribution, healthy subjects that request the examination are in general highly biased with respect to the whole healthy subject population.
16
+
17
+ We are not the first to be interested in learning with bN data. In fact, both Li et al. (2010) and Fei & Liu (2015) attempted to solve similar problems in the context of text classification. Li et al. (2010) simply discarded negative samples and performed ordinary PU classification. It was also mentioned in the paper that bN data could be harmful. Fei & Liu (2015) adapted another strategy. The authors considered even gathering unbiased U data is difficult and learned the classifier from only $\mathrm { \bf P }$ and bN data. However, their method is specific to text classification because it relies on the use of effective similarity measures to evaluate similarity between documents. Therefore, our work differs from these two in that the classifier is trained simultaneously on P, U and bN data, without resorting to domain-specific knowledge. The presence of U data allows us to address the problem from a statistical viewpoint, and thus the proposed method can be applied to any PUbN learning problem in principle.
18
+
19
+ In this paper, we develop an empirical risk minimization-based algorithm that combines both PU learning and importance weighting to solve the PUbN classification problem, We first estimate the probability that an example is sampled into the P or the bN set. Based on this estimate, we regard bN and U data as N examples with instance-dependent weights. In particular, we assign larger weights to U examples that we believe to appear less often in the $\mathrm { \bf P }$ and bN sets. P data are treated as $\mathrm { \bf P }$ examples with unity weight but also as $_ \mathrm { N }$ examples with usually small or zero weight whose actual value depends on the same estimate.
20
+
21
+ The contributions of the paper are three-fold:
22
+
23
+ 1. We formulate the PUbN learning problem as an extension of PU learning and propose an empirical risk minimization-based method to address the problem. We also theoretically establish an estimation error bound for the proposed method.
24
+ 2. We experimentally demonstrate that the classification performance can be effectively improved thanks to the use of bN data during training. In other words, PUbN learning yields better performance than PU learning.
25
+ 3. Our method can be easily adapted to ordinary PU learning. Experimentally we show that the resulting algorithm allows us to obtain new state-of-the-art results on several PU learning tasks.
26
+
27
+ Relation with Semi-supervised Learning With P, N and U data available for training, our problem setup may seem similar to that of semi-supervised learning (Chapelle et al., 2010; Oliver et al., 2018). Nonetheless, in our case, N data are biased and often represent only a small portion of the whole N distribution. Therefore, most of the existing methods designed for the latter cannot be directly applied to the PUbN classification problem. Furthermore, our focus is on deducing a risk estimator using the three sets of data, whereas in semi-supervised learning the main concern is often how U data can be utilized for regularization (Grandvalet & Bengio, 2005; Belkin et al., 2006; Laine & Aila, 2017; Miyato et al., 2016). The two should be compatible and we believe adding such regularization to our algorithm can be beneficial in many cases.
28
+
29
+ Relation with Dataset Shift PUbN learning can also be viewed as a special case of dataset shift1 (Quionero-Candela et al., 2009) if we consider that $\mathrm { \bf P }$ and bN data are drawn from the training distribution while U data are drawn from the test distribution. Covariate shift (Shimodaira, 2000; Sugiyama & Kawanabe, 2012) is another special case of dataset shift that has been studied intensively. In the covariate shift problem setting, training and test distributions have the same class conditional distribution and only differ in the marginal distribution of the independent variable. One popular approach to tackle this problem is to reweight each training example according to the ratio of the test density to the training density (Huang et al., 2007; Sugiyama et al., 2008). Nevertheless, simply training a classifier on a reweighted version of the labeled set is not sufficient in our case since there may be examples with zero probability to be labeled. It is also important to notice that the problem of PUbN learning is intrinsically different from that of covariate shift and neither of the two is a special case of the other.
30
+
31
+ # 2 PROBLEM SETTING
32
+
33
+ In this section, we briefly review the formulations of PN, PU and PNU classification and introduce the problem of learning from P, U and bN data.
34
+
35
+ # 2.1 STANDARD BINARY CLASSIFICATION
36
+
37
+ Let $\pmb { x } \in \mathbb { R } ^ { d }$ and $y \in \{ + 1 , - 1 \}$ be random variables following an unknown probability distribution with density $p ( { \pmb x } , { \pmb y } )$ . Let $g : \bar { \mathbb { R } ^ { d } } \mathbb { R }$ be an arbitrary decision function for binary classification and $\ell : \mathbb { R } \to \mathbb { R } _ { + }$ be a loss function of margin $y g ( { \pmb x } )$ that usually takes a small value for a large margin. The goal of binary classification is to find $g$ that minimizes the classification risk:
38
+
39
+ $$
40
+ R ( g ) = \mathbb { E } _ { ( \pmb { x } , y ) \sim p ( \pmb { x } , y ) } [ \ell ( y g ( \pmb { x } ) ) ] ,
41
+ $$
42
+
43
+ where $\mathbb { E } _ { ( \pmb { x } , y ) \sim p ( \pmb { x } , y ) } [ \cdot ]$ denotes the expectation over the joint distribution $p ( { \pmb x } , { \pmb y } )$ . When we care about classification accuracy, $\ell$ is the zero-one loss $\ell _ { 0 1 } ( z ) = ( 1 - \mathrm { s i g n } ( z ) ) / 2$ . However, for ease of optimization, $\ell _ { 0 1 }$ is often substituted with a surrogate loss such as the sigmoid loss $\ell _ { \mathrm { s i g } } ( z ) =$ $1 / ( 1 + \exp ( z ) )$ or the logistic loss $\ell _ { \mathrm { l o g } } ( z ) = \ln ( 1 + \exp ( - z ) )$ during learning.
44
+
45
+ In standard supervised learning scenarios (PN classification), we are given $\mathrm { \bf P }$ and N data that are sampled independently from $p ( \pmb { x } \mid \pmb { y } = + 1 )$ and $p ( \pmb { x } \mid \pmb { y } = - 1 )$ as $\mathbf { \mathcal { X } } _ { \mathrm { P } } = \{ \mathbf { x } _ { i } ^ { \mathrm { P } } \} _ { i = 1 } ^ { n _ { \mathrm { P } } }$ and $\mathcal { X } _ { \mathrm { N } } ~ =$ $\{ \pmb { x } _ { i } ^ { \mathrm { N } } \} _ { i = 1 } ^ { n _ { \mathrm { N } } }$ . Let us denote by $R _ { \mathrm { P } } ^ { + } ( g ) = \mathbb { E } _ { x \sim p ( x | y = + 1 ) } [ \ell ( g ( \pmb { x } ) ) ]$ , $R _ { \mathrm { N } } ^ { - } ( g ) = \mathbb { E } _ { { \pmb x } \sim p ( { \pmb x } | y = - 1 ) } [ \ell ( - g ( { \pmb x } ) ) ]$ partial risks and $\pi = p ( y = 1 )$ the $\mathrm { \bf P }$ prior. We have the equality $R ( g ) = \pi R _ { \mathrm { P } } ^ { + } ( g ) + ( 1 - \pi ) R _ { \mathrm { N } } ^ { - } ( g )$ . The classification risk (1) can then be empirically approximated from data by
46
+
47
+ $$
48
+ \hat { R } _ { \mathrm { P N } } ( g ) = \pi \hat { R } _ { \mathrm { P } } ^ { + } ( g ) + ( 1 - \pi ) \hat { R } _ { \mathrm { N } } ^ { - } ( g ) ,
49
+ $$
50
+
51
+ where $\begin{array} { r } { \hat { R } _ { \mathrm { P } } ^ { + } ( g ) = \frac { 1 } { n _ { \mathrm { P } } } \sum _ { i = 1 } ^ { n _ { \mathrm { P } } } \ell ( g ( \pmb { x } _ { i } ^ { \mathrm { P } } ) ) } \end{array}$ and $\begin{array} { r } { \hat { R } _ { \mathrm { N } } ^ { - } ( g ) = \frac { 1 } { n _ { \mathrm { N } } } \sum _ { i = 1 } ^ { n _ { \mathrm { N } } } \ell ( - g ( \mathbf { x } _ { i } ^ { \mathrm { N } } ) ) } \end{array}$ . By minimizing $\hat { R } _ { \mathrm { P N } } ( g )$ we obtain the ordinary empirical risk minimizer $\hat { g } _ { \mathrm { P N } }$ .
52
+
53
+ # 2.2 PU CLASSIFICATION
54
+
55
+ In PU classification, instead of $_ \mathrm { N }$ data $\mathcal { X } _ { \mathrm { N } }$ we have only access to $\mathcal { X } _ { \mathrm { U } } = \{ x _ { i } ^ { \mathrm { U } } \} _ { i = 1 } ^ { n _ { \mathrm { U } } } \sim p ( \pmb { x } )$ a set of U samples drawn from the marginal density . Several effective algorithms have been designed to address this problem. Liu et al. (2002) proposed the S-EM approach that first identifies reliable N data in the $\mathrm { U }$ set and then runs the Expectation-Maximization (EM) algorithm to build the final classifier. The biased support vector machine (Biased SVM) introduced in Liu et al. (2003) regards U samples as $\mathbf { N }$ samples with smaller weights. Mordelet & Vert (2014) solved the PU problem by aggregating classifiers trained to discriminate $\mathrm { \bf P }$ data from a small random subsample of $\mathrm { U }$ data.
56
+
57
+ More recently, attention has been paid on the unbiased risk estimator proposed in du Plessis et al. (2014) and du Plessis et al. (2015). The key idea is to use the following equality:
58
+
59
+ $$
60
+ ( 1 - \pi ) R _ { \mathrm { N } } ^ { - } ( g ) = R _ { \mathrm { U } } ^ { - } ( g ) - \pi R _ { \mathrm { P } } ^ { - } ( g ) ,
61
+ $$
62
+
63
+ where $R _ { \mathrm { U } } ^ { - } ( g ) = \mathbb { E } _ { x \sim p ( \mathbf { x } ) } [ \ell ( - g ( \pmb { x } ) ) ]$ and $R _ { \mathrm { P } } ^ { - } ( g ) = \mathbb { E } _ { x \sim p ( x | y = + 1 ) } [ \ell ( - g ( \pmb { x } ) ) ]$ . This equality is acquired by exploiting the fact $p ( \pmb { x } ) = \pi p ( \pmb { x } \mid y = + 1 ) + ( 1 - \pi ) p ( \pmb { x } \mid y = - 1 )$ . As a result, we can approximate the classification risk (1) by
64
+
65
+ $$
66
+ \hat { R } _ { \mathrm { P U } } ( g ) = \pi \hat { R } _ { \mathrm { P } } ^ { + } ( g ) - \pi \hat { R } _ { \mathrm { P } } ^ { - } ( g ) + \hat { R } _ { \mathrm { U } } ^ { - } ( g ) ,
67
+ $$
68
+
69
+ where $\begin{array} { r } { \hat { R } _ { \mathrm { P } } ^ { - } ( g ) \ = \ \frac { 1 } { n _ { \mathrm { P } } } \sum _ { i = 1 } ^ { n _ { \mathrm { P } } } \ell ( - g ( \mathbf { x } _ { i } ^ { \mathrm { P } } ) ) } \end{array}$ and $\begin{array} { r } { \hat { R } _ { \mathrm { U } } ^ { - } ( g ) \ = \ \frac { 1 } { n _ { \mathrm { U } } } \sum _ { i = 1 } ^ { n _ { \mathrm { U } } } \ell ( - g ( \mathbf { x } _ { i } ^ { \mathrm { U } } ) ) } \end{array}$ . We then minimize $\hat { R } _ { \mathrm { P U } } ( g )$ to obtain another empirical risk minimizer $\hat { g } _ { \mathrm { { P U } } }$ . Note that as the loss is always positive, the classification risk (1) that $\hat { R } _ { \mathrm { P U } } ( g )$ approximates is also positive. However, Kiryo et al. (2017) pointed out that when the model of $g$ is too flexible, that is, when the function class $\mathcal { G }$ is too large, $\hat { R } _ { \mathrm { P U } } ( \hat { g } _ { \mathrm { P U } } )$ indeed goes negative and the model seriously overfits the training data. To alleviate overfitting, the authors observed that $R _ { \mathrm { U } } ^ { - } ( g ) - \pi R _ { \mathrm { P } } ^ { - } ( g ) = ( 1 - \pi ) R _ { \mathrm { N } } ^ { - } ( g ) \geq 0$ and proposed the non-negative risk estimator for PU learning:
70
+
71
+ $$
72
+ \tilde { R } _ { \mathrm { P U } } ( g ) = \pi \hat { R } _ { \mathrm { P } } ^ { + } ( g ) + \operatorname* { m a x } \{ 0 , \hat { R } _ { \mathrm { U } } ^ { - } ( g ) - \pi \hat { R } _ { \mathrm { P } } ^ { - } ( g ) \} .
73
+ $$
74
+
75
+ In terms of implementation, stochastic optimization was used and when $r = \hat { R } _ { \mathrm { U } } ^ { - } ( g ) - \pi \hat { R } _ { \mathrm { P } } ^ { - } ( g )$ becomes negative for a mini-batch, they performed a step of gradient ascent along $\nabla r$ to make the mini-batch less overfitted.
76
+
77
+ # 2.3 PNU CLASSIFICATION
78
+
79
+ In semi-supervised learning (PNU classification), P, N and U data are all available. An abundance of works have been dedicated to solving this problem. Here we in particular introduce the PNU risk estimator proposed in Sakai et al. (2017). By directly leveraging U data for risk estimation, it is the most comparable to our method. The PNU risk is simply defined as a linear combination of PN and PU/NU risks. Let us just consider the case where PN and PU risks are combined, then for some $\gamma \in [ 0 , 1 ]$ , the PNU risk estimator is expressed as
80
+
81
+ $$
82
+ \begin{array} { r l } & { \hat { R } _ { \mathrm { P N U } } ^ { \gamma } ( g ) = \gamma \hat { R } _ { \mathrm { P N } } ( g ) + ( 1 - \gamma ) \hat { R } _ { \mathrm { P U } } ( g ) } \\ & { \qquad = \pi \hat { R } _ { \mathrm { P } } ^ { + } ( g ) + \gamma ( 1 - \pi ) \hat { R } _ { \mathrm { N } } ^ { - } ( g ) + ( 1 - \gamma ) ( \hat { R } _ { \mathrm { U } } ^ { - } ( g ) - \pi \hat { R } _ { \mathrm { P } } ^ { - } ( g ) ) . } \end{array}
83
+ $$
84
+
85
+ We can again consider the non-negative correction by forcing the term $\gamma ( 1 - \pi ) \hat { R } _ { \mathrm { N } } ^ { - } ( g ) + ( 1 -$ $\gamma ) ( \hat { R } _ { \mathrm { U } } ^ { - } ( g ) - \pi \hat { R } _ { \mathrm { P } } ^ { - } ( g ) )$ to be non-negative. In the rest of the paper, we refer to the resulting algorithm as non-negative PNU (nnPNU) learning (see Appendix D.4 for an alternative definition of nnPNU and the corresponding results).
86
+
87
+ # 2.4 PUBN CLASSIFICATION
88
+
89
+ In this paper, we study the problem of PUbN learning. It differs from usual semi-supervised learning in the fact that labeled $\mathbf { N }$ data are not fully representative of the underlying $_ \mathrm { N }$ distribution $p ( \pmb { x } \mid \pmb { y } =$ $^ { - 1 ) }$ . To take this point into account, we introduce a latent random variable $s$ and consider the joint distribution $p ( { \pmb x } , { \pmb y } , s )$ with constraint $p ( s = + 1 \mid x , y = + 1 ) = 1$ . Equivalently, $p ( y = { \bar { - 1 } } \ |$ $\pmb { x } , s = - 1 ) = 1$ . Let $\rho = p ( y = - 1 , s = + 1 )$ . Both $\pi$ and $\rho$ are assumed known throughout the paper. In practice they often need to be estimated from data (Jain et al., 2016; Ramaswamy et al., 2016; du Plessis et al., 2017). In place of ordinary $\mathbf { N }$ data we collect a set of bN samples
90
+
91
+ $$
92
+ \begin{array} { r } { \mathcal { X } _ { \mathrm { b N } } = \{ \pmb { x } _ { i } ^ { \mathrm { b N } } \} _ { i = 1 } ^ { n _ { \mathrm { b N } } } \sim p ( \pmb { x } | y = - 1 , s = + 1 ) . } \end{array}
93
+ $$
94
+
95
+ The goal remains the same: we would like to minimize the classification risk (1).
96
+
97
+ # 3 METHOD
98
+
99
+ In this section, we propose a risk estimator for PUbN classification and establish an estimation error bound for the proposed method. Finally we show how our method can be applied to PU learning as a special case when no bN data are available.
100
+
101
+ # 3.1 RISK ESTIMATOR
102
+
103
+ Let $R _ { \mathrm { b N } } ^ { - } ( g ) = \mathbb { E } _ { x \sim p ( x | y = - 1 , s = + 1 ) } [ \ell ( - g ( \pmb { x } ) ) ]$ and $R _ { s = - 1 } ^ { - } ( g ) = \mathbb { E } _ { x \sim p ( \pmb { x } | s = - 1 ) } [ \ell ( - g ( \pmb { x } ) ) ]$ . Since p( ${ \pmb x } ) = p ( { \pmb x } , y = + 1 ) + p ( { \pmb x } , y = - 1 , { \pmb s } = + 1 ) + p ( { \pmb x } , { \pmb s } = - 1 )$ , we have
104
+
105
+ $$
106
+ R ( g ) = \pi R _ { \mathrm { p } } ^ { + } ( g ) + \rho R _ { \mathrm { b N } } ^ { - } ( g ) + ( 1 - \pi - \rho ) R _ { s = - 1 } ^ { - } ( g ) .
107
+ $$
108
+
109
+ The firswriting $\begin{array} { r } { \hat { R } _ { \mathrm { P } } ^ { + } ( g ) = \frac { 1 } { n _ { \mathrm { P } } } \sum _ { i = 1 } ^ { n _ { \mathrm { P } } } \ell ( g ( \pmb { x } _ { i } ^ { \mathrm { P } } ) ) } \end{array}$ side and $\begin{array} { r } { \hat { R } _ { \mathrm { b N } } ^ { - } ( g ) = \frac { 1 } { n _ { \mathrm { b N } } } \sum _ { i = 1 } ^ { n _ { \mathrm { b N } } } \ell ( - g ( \mathbf { x } _ { i } ^ { \mathrm { b N } } ) ) } \end{array}$ ed directly from data by. We therefore focus on the third term $\bar { R } _ { s = - 1 } ^ { - } ( g ) : = ( 1 - \pi - \rho ) R _ { s = - 1 } ^ { - } ( g )$ . Our approach is mainly based on the following theorem. We relegate all proofs to the appendix.
110
+
111
+ Theorem 1. Let $\sigma ( { \pmb x } ) = p ( s = + 1 \mid { \pmb x } )$ . For all $\eta \in [ 0 , 1 ]$ and $h : \mathbb { R } ^ { d } [ 0 , 1 ]$ satisfying the condition $h ( { \pmb x } ) > \eta \Rightarrow \sigma ( { \pmb x } ) > 0$ , the risk $\bar { R } _ { s = - 1 } ^ { - } ( g )$ can be expressed as
112
+
113
+ $$
114
+ \begin{array} { r l } & { \bar { R } _ { s = - 1 } ^ { - } ( g ) = \mathbb { E } _ { { \pmb x } \sim p ( { \pmb x } ) } [ \mathbb { 1 } _ { h ( { \pmb x } ) \leq \eta } \ell ( - g ( { \pmb x } ) ) ( 1 - \sigma ( { \pmb x } ) ) ] } \\ & { \qquad + \pi \mathbb { E } _ { { \pmb x } \sim p ( { \pmb x } \mid y = + 1 ) } \left[ \mathbb { 1 } _ { h ( { \pmb x } ) > \eta } \ell ( - g ( { \pmb x } ) ) \frac { 1 - \sigma ( { \pmb x } ) } { \sigma ( { \pmb x } ) } \right] } \\ & { \qquad + \rho \mathbb { E } _ { { \pmb x } \sim p ( { \pmb x } \mid s = + 1 , y = - 1 ) } \left[ \mathbb { 1 } _ { h ( { \pmb x } ) > \eta } \ell ( - g ( { \pmb x } ) ) \frac { 1 - \sigma ( { \pmb x } ) } { \sigma ( { \pmb x } ) } \right] . } \end{array}
115
+ $$
116
+
117
+ In the theorem, $\bar { R } _ { s = - 1 } ^ { - } ( g )$ is decomposed into three terms, and when the expectation is substituted with the average over training samples, these three terms are approximated respectively using data from $\mathcal { X } _ { \mathrm { U } } , \mathcal { X } _ { \mathrm { P } }$ and $\mathcal { X } _ { \mathrm { b N } }$ . The choice of $h$ and $\eta$ is thus very crucial because it determines what each of the three terms tries to capture in practice. Ideally, we would like $h$ to be an approximation of $\sigma$ . Then, for $_ { \textbf { \em x } }$ such that $h ( { \pmb x } )$ is close to 1, $\sigma ( { \pmb x } )$ is close to 1, so the last two terms on the righthand side of the equation can be reasonably evaluated using $\mathcal { X } _ { \mathrm { P } }$ and $\mathcal { X } _ { \mathrm { b N } }$ (i.e., samples drawn from $p ( { \pmb x } \mid s = + 1 )$ ). On the contrary, if $h ( { \pmb x } )$ is small, $\sigma ( { \pmb x } )$ is small and such samples can be hardly found in $\mathcal { X } _ { \mathrm { P } }$ or $\mathcal { X } _ { \mathrm { b N } }$ . Consequently the first term appeared in the decomposition is approximated with the help of $\mathcal { X } _ { \mathrm { U } }$ . Finally, in the empirical risk minimization paradigm, $\eta$ becomes a hyperparameter that controls how important U data is against $\mathrm { \bf P }$ and bN data when we evaluate $\bar { R } _ { s = - 1 } ^ { - } ( \bar { g } )$ . The larger $\eta$ is, the more attention we would pay to $\mathrm { U }$ data.
118
+
119
+ One may be curious about why we do not simply approximate the whole risk using only $\mathrm { U }$ samples, that is, set $\eta$ to 1. There are two main reasons. On one hand, if we have a very small U set, which means $n _ { \mathrm { U } } ~ \ll ~ n _ { \mathrm { P } }$ and $n _ { \mathrm { U } } ~ \ll ~ n _ { \mathrm { b N } }$ , approximating a part of the risk with labeled samples should help us reduce the estimation error. This may seem unrealistic but sometimes unbiased $\mathrm { U }$ samples can also be difficult to collect (Ishida et al., 2018). On the other hand, more importantly, we have empirically observed that when the model of $g$ is highly flexible, even a sample regarded as $\mathbf { N }$ with small weight gets classified as $\mathbf { N }$ in the latter stage of training and performance of the resulting classifier can thus be severely degraded. Introducing $\eta$ alleviates this problem by avoiding treating all $\mathrm { U }$ data as $\mathbf { N }$ samples.
120
+
121
+ As $\sigma$ is not available in reality, we propose to replace $\sigma$ by its estimate $\hat { \sigma }$ in (6). We further substitute $h$ with the same estimate and obtain the following expression:
122
+
123
+ $$
124
+ \begin{array} { r l } & { \bar { R } _ { s = - 1 , \eta , \hat { \sigma } } ^ { - } ( g ) = \mathbb { E } _ { { \pmb x } \sim p ( { \pmb x } ) } [ \mathbb { 1 } _ { \hat { \sigma } ( { \pmb x } ) \leq \eta } \ell ( - g ( { \pmb x } ) ) ( 1 - \hat { \sigma } ( { \pmb x } ) ) ] } \\ & { \qquad + \pi \mathbb { E } _ { { \pmb x } \sim p ( { \pmb x } \mid { \pmb y } = + 1 ) } \left[ \mathbb { 1 } _ { \hat { \sigma } ( { \pmb x } ) > \eta } \ell ( - g ( { \pmb x } ) ) \frac { 1 - \hat { \sigma } ( { \pmb x } ) } { \hat { \sigma } ( { \pmb x } ) } \right] } \\ & { \qquad + \rho \mathbb { E } _ { { \pmb x } \sim p ( { \pmb x } \mid { s = + 1 , \pmb y } = - 1 ) } \left[ \mathbb { 1 } _ { \hat { \sigma } ( { \pmb x } ) > \eta } \ell ( - g ( { \pmb x } ) ) \frac { 1 - \hat { \sigma } ( { \pmb x } ) } { \hat { \sigma } ( { \pmb x } ) } \right] . } \end{array}
125
+ $$
126
+
127
+ We notice that $\bar { R } _ { s = - 1 , \eta , \hat { \sigma } }$ depends both on $\eta$ and $\hat { \sigma }$ . It can be directly approximated from data by
128
+
129
+ $$
130
+ \begin{array} { r l } & { \hat { R } _ { s = - 1 , \eta , \hat { \sigma } } ( g ) = \displaystyle \frac { 1 } { n _ { \mathrm { U } } } \sum _ { i = 1 } ^ { n _ { \mathrm { U } } } \Big [ \mathbb { 1 } _ { \hat { \sigma } ( \mathbf { x } _ { i } ^ { \mathrm { U } } ) \leq \eta } \ell ( - g ( \mathbf { x } _ { i } ^ { \mathrm { U } } ) ) ( 1 - \hat { \sigma } ( \mathbf { x } _ { i } ^ { \mathrm { U } } ) ) \Big ] } \\ & { \quad \quad \quad \quad \quad + \displaystyle \frac { \pi } { n _ { \mathrm { P } } } \sum _ { i = 1 } ^ { n _ { \mathrm { P } } } \bigg [ \mathbb { 1 } _ { \hat { \sigma } ( \mathbf { x } _ { i } ^ { \mathrm { P } } ) > \eta } \ell ( - g ( \mathbf { x } _ { i } ^ { \mathrm { P } } ) ) \frac { 1 - \hat { \sigma } ( \mathbf { x } _ { i } ^ { \mathrm { P } } ) } { \hat { \sigma } ( \mathbf { x } _ { i } ^ { \mathrm { P } } ) } \bigg ] } \\ & { \quad \quad \quad \quad \quad + \displaystyle \frac { \rho } { n _ { \mathrm { b N } } } \sum _ { i = 1 } ^ { n _ { \mathrm { b N } } } \bigg [ \mathbb { 1 } _ { \hat { \sigma } ( \mathbf { x } _ { i } ^ { \mathrm { b N } } ) > \eta } \ell ( - g ( \mathbf { x } _ { i } ^ { \mathrm { b N } } ) ) \frac { 1 - \hat { \sigma } ( \mathbf { x } _ { i } ^ { \mathrm { b N } } ) } { \hat { \sigma } ( \mathbf { x } _ { i } ^ { \mathrm { b N } } ) } ) \bigg ] . } \end{array}
131
+ $$
132
+
133
+ We are now able to derive the empirical version of Equation (5) as
134
+
135
+ $$
136
+ \begin{array} { r } { \hat { R } _ { \mathrm { P U b N } , \eta , \hat { \sigma } } ( g ) = \pi \hat { R } _ { \mathrm { P } } ^ { + } ( g ) + \rho \hat { R } _ { \mathrm { b N } } ^ { - } ( g ) + \hat { \bar { R } } _ { s = - 1 , \eta , \hat { \sigma } } ^ { - } ( g ) . } \end{array}
137
+ $$
138
+
139
+ Estimating $\sigma$ If we regard $s$ as a class label, the problem of estimating $\sigma$ is then equivalent to training a probabilistic classifier separating the classes with $s = + 1$ and $s = - 1$ . Observing that ( $\begin{array} { r } { \pi + \bar { \rho } ) \mathbb { E } _ { \alpha \sim p ( x | s = + 1 ) } ^ { - } [ \ell ( \epsilon g ( x ) ) ] = \bar { \pi } \mathbb { E } _ { \alpha \sim p ( x | y = + 1 ) } [ \ell ( \epsilon g ( x ) ) ] + \rho \mathbb { E } _ { \alpha \sim p ( x | y = - 1 , s = + 1 ) } [ \ell ( \epsilon g ( x ) ) ] } \end{array}$ for $\epsilon \in \{ + 1 , - 1 \}$ , it is straightforward to apply nnPU learning with availability of $\mathcal { X } _ { \mathrm { P } }$ , $\mathcal { X } _ { \mathrm { b N } }$ and $\mathcal { X } _ { \mathrm { U } }$ to minimize $\mathbb { E } _ { ( \pmb { x } , s ) \sim p ( \pmb { x } , s ) } [ \ell ( s g ( \pmb { x } ) ) ]$ . In other words, here we regard $\mathcal { X } _ { \mathrm { P } }$ and $\mathcal { X } _ { \mathrm { b N } }$ as $\mathrm { \bf P }$ and $\mathcal { X } _ { \mathrm { U } }$ as U, and attempt to solve a PU learning problem by applying nnPU. Since we are interested in the classposterior probabilities, we minimize the risk with respect to the logistic loss and apply the sigmoid function to the output of the model to get $\hat { \sigma } ( { \pmb x } )$ . However, the above risk estimator accepts any reasonable $\hat { \sigma }$ and we are not limited to using nnPU for computing $\hat { \sigma }$ . For example, the least-squares fitting approach proposed in Kanamori et al. (2009) for direct density ratio estimation can also be adapted to solving the problem.
140
+
141
+ # 3.2 ESTIMATION ERROR BOUND
142
+
143
+ Here we establish an estimation error bound for the proposed method. Let $\mathcal { G }$ be the function class from which we find a function. The Rademacher complexity of $\mathcal { G }$ for the samples of size $n$ drawn from $q ( { \pmb x } )$ is defined as
144
+
145
+ $$
146
+ \mathfrak { R } _ { n , q } ( \mathcal { G } ) = \mathbb { E } _ { \mathcal { X } \sim q ^ { n } } \mathbb { E } _ { \theta } \left[ \operatorname* { s u p } _ { g \in \mathcal { G } } \frac { 1 } { n } \sum _ { x _ { i } \in \mathcal { X } } \theta _ { i } g ( \pmb { x } _ { i } ) \right] ,
147
+ $$
148
+
149
+ where $\mathcal { X } ~ = ~ \{ \pmb { x } _ { 1 } , \ldots , \pmb { x } _ { n } \}$ and $\theta ~ = ~ \{ \theta _ { 1 } , \ldots , \theta _ { n } \}$ with each $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ drawn from $q ( { \pmb x } )$ and $\theta _ { i }$ as a Rademacher variable (Mohri et al., 2012). In the following we will assume that $\mathfrak { R } _ { n , q } ( \mathcal { G } )$ vanishes asymptotically as $n \to \infty$ . This holds for most of the common choices of $\mathcal { G }$ if proper regularization is considered (Bartlett & Mendelson, 2002; Golowich et al., 2018). Assume additionally the existence of $C _ { g } > 0$ such that $\mathrm { s u p } _ { g \in { \mathcal { G } } } \| g \| _ { \infty } \leq C _ { g }$ as well as $C _ { \ell } > 0$ such that $\begin{array} { r } { \operatorname* { s u p } _ { | z | \leq C _ { g } } \hat { \ell } ( z ) \leq C _ { \ell } } \end{array}$ . We also assume that $\ell$ is Lipschitz continuous on the interval $[ - C _ { g } , C _ { g } ]$ with a Lipschitz constant $L _ { \ell }$ .
150
+
151
+ Theorem 2. Let $\begin{array} { r l r } { g ^ { * } } & { { } = } & { \arg \operatorname* { m i n } _ { g \in { \mathcal G } } R ( g ) } \end{array}$ be the true risk minimizer and $\begin{array} { r l } { \hat { g } _ { \mathrm { P U b N } , \eta , \hat { \sigma } } } & { { } = } \end{array}$ a $\begin{array} { r } { \operatorname { r g m i n } _ { g \in \mathcal { G } } \hat { R } _ { \mathrm { P U b N } , \eta , \hat { \sigma } } ( g ) } \end{array}$ be the PUbN empirical risk minimizer. We suppose that $\hat { \sigma }$ is a fixed function independent of data used to compute $\hat { R } _ { \mathrm { P U b N } , \eta , \hat { \sigma } } ( g )$ and $\eta \in ( 0 , 1 ]$ . Denote by $p _ { \mathrm { P } } ( { \pmb x } ) = p ( { \pmb x } \mid$ $y = + 1$ ) and $p _ { \mathrm { b N } } ( { \pmb x } ) = p ( { \pmb x } \mid y = - 1 , s = + 1 )$ the $P$ and bN marginals. Let $\zeta = p ( \boldsymbol { \hat { \sigma } } ( \pmb { x } ) \leq \eta )$ and $\epsilon = \mathbb { E } _ { { \pmb x } \sim p ( { \pmb x } ) } [ | \hat { \sigma } ( { \pmb x } ) - \sigma ( { \pmb x } ) | ^ { 2 } ]$ . Then for any $\delta > 0$ , with probability at least $1 - \delta$ ,
152
+
153
+ $$
154
+ \begin{array} { r l } & { R ( \hat { g } _ { \mathrm { P U b N } , \eta , \hat { \sigma } } ) - R ( g ^ { * } ) } \\ & { \quad \le 4 L _ { l } \mathfrak R _ { n _ { \mathrm { U } } , p } ( \mathcal { G } ) + \frac { 4 \pi L _ { l } } \eta \mathfrak R _ { n _ { \mathrm { P } } , p _ { \mathrm { P } } } ( \mathcal { G } ) + \frac { 4 \rho L _ { l } } \eta \mathfrak R _ { n _ { \mathrm { b N } } , p _ { \mathrm { b N } } } ( \mathcal { G } ) } \\ & { \qquad + 2 C _ { l } \sqrt { \frac { \ln ( 6 / \delta ) } { 2 n _ { \mathrm { U } } } } + \frac { 2 \pi C _ { l } } \eta \sqrt { \frac { \ln ( 6 / \delta ) } { 2 n _ { \mathrm { P } } } } + \frac { 2 \rho C _ { l } } \eta \sqrt { \frac { \ln ( 6 / \delta ) } { 2 n _ { \mathrm { b N } } } } + 2 C _ { l } \sqrt { \zeta } \epsilon + \frac { 2 C _ { l } } \eta \sqrt { ( 1 - \zeta ) } \epsilon . } \end{array}
155
+ $$
156
+
157
+ Theorem 2 shows that as $n _ { \mathrm { P } } \infty$ , $n _ { \mathrm { b N } } \infty$ and $n _ { \mathrm { U } } \infty$ , we have $R ( \hat { g } _ { \mathrm { P U b N } , \eta , \hat { \sigma } } ) - R ( g ^ { * } ) $ $2 C _ { l } \sqrt { \zeta \epsilon } + 2 ( C _ { l } / \eta ) \sqrt { ( 1 - \zeta ) \epsilon }$ . Furthermore, if there is $C _ { \mathcal { G } } ~ > ~ 0$ such that $\Re _ { n , q } ( { \mathcal { G } } ) \leq C \varsigma / \sqrt { n }$ 2, the convergence rate is $\mathcal { O } _ { p } ( 1 / \sqrt { n _ { \mathrm { P } } } + 1 / \sqrt { n _ { \mathrm { b N } } } + 1 / \sqrt { n _ { \mathrm { U } } } )$ , where $\mathcal { O } _ { p }$ denotes the order in probability. As for $\epsilon$ , knowing that $\hat { \sigma }$ is also estimated from data in practice 3, apparently its value depends on both the estimation algorithm and the number of samples that are involved in the estimation process. For example, in our approach we applied nnPU with the logistic loss to obtain $\hat { \sigma }$ , so the excess risk can be written as $\mathbb { E } _ { { \pmb x } \sim p ( { \pmb x } ) } \mathrm { K L } ( { \bf \bar { \sigma } } ( { \pmb x } ) | | { \hat { \sigma } } ( { \pmb x } ) )$ , where by abuse of notation $\operatorname { K L } ( p | | q ) = p \ln ( p / q ) + ( 1 - p ) \ln ( ( 1 - p ) / ( 1 - q ) )$ denotes the KL divergence between two Bernouilli distributions with parameters respectively $p$ and $q$ . It is known that $\epsilon = \mathbb { E } _ { { \pmb x } \sim p ( { \pmb x } ) } [ | \hat { \sigma } ( { \pmb x } ) - \sigma ( { \pmb x } ) | ^ { 2 } ] \leq$ $( 1 / 2 ) \mathbb { E } _ { \pmb { x } \sim p ( \pmb { x } ) } \mathrm { K L } ( \sigma ( \pmb { x } ) | | \hat { \sigma } ( \pmb { x } ) )$ (Zhang, 2004). The excess risk itself can be decomposed into the sum of the estimation error and the approximation error. Kiryo et al. (2017) showed that under mild assumptions the estimation error part converges to zero when the sample size increases to infinity in nnPU learning. It is however impossible to get rid of the approximation error part which is fixed once we fix the function class $\mathcal { G }$ . To circumvent this problem, we can either resort to kernel-based methods with universal kernels (Zhang, 2004) or simply enlarge the function class when we get more samples.
158
+
159
+ # 3.3 PU LEARNING REVISITED
160
+
161
+ In PU learning scenarios, we only have $\mathrm { \bf P }$ and $\mathrm { U }$ data and bN data are not available. Nevertheless, if we let $y$ play the role of $s$ and ignore all the terms related to bN data, our algorithm is naturally applicable to PU learning. Let us name the resulting algorithm PUbN\N, then
162
+
163
+ $$
164
+ \hat { R } _ { \mathrm { P U b N } \setminus \mathbb { N } , \eta , \hat { \sigma } } ( g ) = \pi \hat { R } _ { \mathrm { P } } ^ { + } ( g ) + \hat { \bar { R } } _ { y = - 1 , \eta , \hat { \sigma } } ^ { - } ( g ) ,
165
+ $$
166
+
167
+ where $\hat { \sigma }$ is an estimate of $p ( y = + 1 \mid x )$ and
168
+
169
+ $$
170
+ \begin{array} { r } { \bar { R } _ { y = - 1 , \eta , \hat { \sigma } } ^ { - } ( g ) = \mathbb { E } _ { x \sim p ( x ) } \bigl [ \mathbb { I } _ { \hat { \sigma } ( x ) \leq \eta } \ell ( - g ( \pmb { x } ) ) ( 1 - \hat { \sigma } ( \pmb { x } ) ) \bigr ] + \pi \mathbb { E } _ { x \sim p ( x \mid y = + 1 ) } \left[ \mathbb { I } _ { \hat { \sigma } ( \pmb { x } ) > \eta } \ell ( - g ( \pmb { x } ) ) \frac { 1 - \hat { \sigma } ( \pmb { x } ) } { \hat { \sigma } ( \pmb { x } ) } \right] . } \end{array}
171
+ $$
172
+
173
+ PUbN\N can be viewed as a variant of the traditional two-step approach in PU learning which first identifies possible $\mathbf { N }$ data in $\mathrm { U }$ data and then perform ordinary PN classification to distinguish P data from the identified $_ \mathrm { N }$ data. However, being based on state-of-the-art nnPU learning, our method is more promising than other similar algorithms. Moreover, by explicitly considering the posterior $p ( y = \bar { + } 1 \mid x )$ , we attempt to correct the bias induced by the fact of only taking into account confident negative samples. The benefit of using an unbiased risk estimator is that the resulting algorithm is always statistically consistent, i.e., the estimation error converges in probability to zero as the number of samples grows to infinity.
174
+
175
+ # 4 EXPERIMENTS
176
+
177
+ In this section, we experimentally investigate the proposed method and compare its performance against several baseline methods.
178
+
179
+ # 4.1 BASIC SETUP
180
+
181
+ We focus on training neural networks with stochastic optimization. For simplicity, in an experiment, $\hat { \sigma }$ and $g$ always use the same model and are trained for the same number of epochs. All models are learned using AMSGrad (Reddi et al., 2018) as the optimizer and the logistic loss as the surrogate loss unless otherwise specified. To determine the value of $\eta$ , we introduce another hyperparameter $\tau$ and choose $\eta$ such that $\# \{ x \in \mathcal { X } _ { \mathrm { U } } \mid \hat { \sigma } ( x ) \leq \eta \} = \tau ( 1 - \pi - \rho ) n _ { \mathrm { U } }$ . In all the experiments, an additional validation set, equally composed of P, U and bN data, is sampled for both hyperparameter tuning and choosing the model parameters with the lowest validation loss among those obtained after every epoch. Regarding the computation of the validation loss, we use the PU risk estimator (2) with the sigmoid loss for $g$ and an empirical approximation of $\mathbb { E } _ { { \pmb x } \sim p ( { \pmb x } ) } [ | \hat { \sigma } ( { \pmb x } ) - \sigma ( { \pmb x } ) | ^ { 2 } ] - \mathbb { E } _ { { \pmb x } \sim p ( { \pmb x } ) } [ \sigma ( { \pmb x } ) ^ { 2 } ]$ for $\hat { \sigma }$ (see Appendix B).
182
+
183
+ # 4.2 EFFECTIVENESS OF THE ALGORITHM
184
+
185
+ We assess the performance of the proposed method on three benchmark datasets: MNIST, CIFAR-10 and 20 Newsgroups. Experimental details are given in Appendix C. In particular, since all the three datasets are originally designed for multiclass classification, we group different categories together to form a binary classification problem.
186
+
187
+ Baselines. When $\mathcal { X } _ { \mathrm { b N } }$ is given, two baseline methods are considered. The first one is nnPNU adapted from (4). In the second method, named as $\mathrm { P U } \to \mathrm { P N }$ , we train two binary classifiers: one is learned with nnPU while we regard $s$ as the class label, and the other is learned from $\mathcal { X } _ { \mathrm { P } }$ and $\mathcal { X } _ { \mathrm { b N } }$ to separate $\mathrm { \bf P }$ samples from bN samples. A sample is classified in the $\mathrm { \bf P }$ class only if it is so classified by the two classifiers. When $\mathcal { X } _ { \mathrm { b N } }$ is not available, nnPU is compared with the proposed PUbN\N.
188
+
189
+ Sampling bN Data To sample $\mathcal { X } _ { \mathrm { b N } }$ , we suppose that the bias of N data is caused by a latent prior probability change (Sugiyama & Storkey, 2007; Hu et al., 2018) in the $\mathbf { N }$ class. Let $z \in \mathcal { Z } : =$
190
+
191
+ Table 1: Mean and standard deviation of misclassification rates over 10 trials for MNIST, CIFAR-10 and 20 Newsgroups under different choices of $\mathrm { \bf P }$ class and bN data sampling strategies. For a same learning task, different methods are compared using the same 10 random samplings. Underlines denote that with the use of bN data the method leads to an improvement of performance according to the $5 \%$ t-test. Boldface indicates the best method in each task.
192
+
193
+ † Biased N data uniformly sampled from the indicated latent categories.
194
+
195
+ ⋆ Probabilities that a sample of $\mathcal { X } _ { \mathrm { b N } }$ belongs to the latent categories [1, 3, 5, 7, 9] / [bird, cat, deer, dog, frog, horse] / [sci., soc., talk.] are [0.03, 0.15, 0.3, 0.02, 0.5] / [0.1, 0.02, 0.2, 0.08, 0.2, 0.4] / [0.1, 0.5, 0.4].
196
+
197
+ <table><tr><td>Dataset</td><td>P</td><td>biased N</td><td>p</td><td>nnPU/nnPNU</td><td>PUbN(\N)</td><td>PU→PN</td></tr><tr><td rowspan="3">MNIST</td><td rowspan="3">2,4,6,8,10</td><td>Not given</td><td>NA</td><td>5.76 ± 1.04</td><td>4.64±0.62</td><td>NA</td></tr><tr><td>1,3,5</td><td>0.3</td><td>5.33 ± 0.97</td><td>4.05 ± 0.27</td><td>4.00 ±0.30</td></tr><tr><td>9&gt;5&gt;others *</td><td>0.2</td><td>4.60 ± 0.65</td><td>3.91 ± 0.66</td><td>3.77 ± 0.31</td></tr><tr><td rowspan="3">CIFAR-10</td><td rowspan="3">Airplane, automobile, ship, truck</td><td>Not given</td><td>NA</td><td>12.02 ± 0.65</td><td>10.70 ± 0.57</td><td>NA</td></tr><tr><td>Cat, dog, horse † Horse &gt; deer</td><td>0.3</td><td>10.25 ± 0.38</td><td>9.71 ± 0.51</td><td>10.37 ± 0.65</td></tr><tr><td>= frog &gt; others *</td><td>0.25</td><td>9.98 ± 0.53</td><td>9.92 ±0.42</td><td>10.17 ± 0.35</td></tr><tr><td rowspan="3">CIFAR-10</td><td rowspan="3">Cat, deer, dog, horse</td><td>Not given</td><td>NA</td><td>23.78 ± 1.04</td><td>21.13 ±0.90</td><td>NA</td></tr><tr><td>Bird,frogt</td><td>0.2</td><td>22.00 ± 0.53</td><td>18.83± 0.71</td><td>19.88 ± 0.62</td></tr><tr><td>Car, truck t</td><td>0.2</td><td>22.00±0.74</td><td>20.19 ± 1.06</td><td>21.83 ± 1.36</td></tr><tr><td rowspan="4">20 Newsgroups</td><td rowspan="4">alt., comp., misc., rec.</td><td>Not given</td><td>NA</td><td>14.67 ± 0.87</td><td>13.30 ± 0.53</td><td>NA</td></tr><tr><td>sci.t</td><td>0.21</td><td>14.69 ± 0.46</td><td>13.10±0.90</td><td>13.58 ± 0.97</td></tr><tr><td>talk.t</td><td>0.17</td><td>14.38 ± 0.74</td><td>12.61 ± 0.75</td><td>13.76 ± 0.66</td></tr><tr><td>soc. &gt; talk. &gt; sci.*</td><td>0.1</td><td>14.41 ± 0.76</td><td>12.18± 0.59</td><td>12.92 ± 0.51</td></tr></table>
198
+
199
+ $\{ 1 , \ldots , S \}$ be some latent variable which we call a latent category, where $S$ is a constant. It is assumed
200
+
201
+ $$
202
+ \begin{array} { c } { { p ( { \pmb x } \mid z , y = - 1 ) = p ( { \pmb x } \mid z , y = - 1 , s = + 1 ) , } } \\ { { p ( z \mid y = - 1 ) \not = p ( z \mid y = - 1 , s = + 1 ) . } } \end{array}
203
+ $$
204
+
205
+ In the experiments, the latent categories are the original class labels of the datasets. Concrete definitions of $\mathcal { X } _ { \mathrm { b N } }$ with experimental results are summarized in Table 1.
206
+
207
+ Results. Overall, our proposed method consistently achieves the best or comparable performance in all the scenarios, including those of standard PU learning. Additionally, using bN data can effectively help improving classification performance. However, the choice of algorithm is essential. Both nnPNU and the naive $\mathrm { P U } \to \mathrm { P N }$ are able to leverage bN data to enhance classification accuracy in only relatively few tasks. In the contrast, the proposed PUbN successfully reduce the misclassification error most of the time.
208
+
209
+ Clearly, the performance gain that we can benefit from the availability of bN data is case-dependent. On CIFAR-10, the greatest improvement is achieved when we regard mammals (i.e. cat, deer, dog and horse) as $\mathrm { \bf P }$ class and drawn samples from latent categories bird and frog as labeled negative data. This is not surprising because birds and frogs are more similar to mammals than vehicles, which makes the classification harder specifically for samples from these two latent categories. By explicitly labeling these samples as $_ \mathrm { N }$ data, we allow the classifier to make better predictions for these difficult samples.
210
+
211
+ # 4.3 THE PRESENCE OF BN DATA HELPS: AN ILLUSTRATION
212
+
213
+ Through experiments we have demonstrated that the presence of bN data effectively helps learning a better classifier. Here we would like to provide some intuition for the reason behind this. Let us consider the MNIST learning task where $\mathcal { X } _ { \mathrm { b N } }$ is uniformly sampled from the latent categories 1, 3 and 5. We project the representations learned by the classifier (i.e., the activation values of the last layer of the neural network) into a 2D plane using PCA for both nnPU and PUbN algorithms.
214
+
215
+ ![](images/040b3ac911910187bc1797c52cc052648df1ec84ffcf693f2a44712308124cfb.jpg)
216
+ Figure 1: PCA embeddings of the representations learned by the nnPU and PUbN classifiers for 500 samples from the test set in the MNIST learning task where $\mathcal { X } _ { \mathrm { b n } }$ is uniformly sampled from latent categories 1, 3 and 5.
217
+
218
+ The results are shown in Figure 1. Since for both nnPU and PUbN classifiers, the first two principal components account around $90 \%$ of variance, we believe that this figure depicts fairly well the learned representations. Thanks to the use of bN data, in the high-level feature space 1, 3, 5 and P data are further pushed away when we employ the proposed PUbN learning algorithm, and we are always able to separate 7, 9 from P to some extent. This explains the better performance which is achieved by PUbN learning and the benefit of incorporating bN data into the learning process.
219
+
220
+ # 5 CONCLUSION
221
+
222
+ This paper studied the PUbN classification problem, where a binary classifier is trained on P, U and bN data. The proposed method is a two-step approach inspired from both PU learning and importance weighting. The key idea is to attribute appropriate weights to each example to evaluate the classification risk using the three sets of data. We theoretically established an estimation error bound for the proposed risk estimator and experimentally showed that our approach successfully leveraged bN data to improve the classification performance on several real-world datasets. A variant of our algorithm was able to achieve state-of-the-art results in PU learning.
223
+
224
+ # REFERENCES
225
+
226
+ P. L. Bartlett and S. Mendelson. Rademacher and gaussian complexities: Risk bounds and structural results. Journal of Machine Learning Research, 3(Nov):463–482, 2002.
227
+ M. Belkin, P. Niyogi, and V. Sindhwani. Manifold regularization: A geometric framework for learning from labeled and unlabeled examples. Journal of Machine Learning Research, 7(Nov): 2399–2434, 2006.
228
+ O. Chapelle, B. Schlkopf, and A. Zien. Semi-Supervised Learning. The MIT Press, 1st edition, 2010.
229
+ M. du Plessis, G. Niu, and M. Sugiyama. Convex formulation for learning from positive and unlabeled data. In International Conference on Machine Learning (ICML), pp. 1386–1394, 2015.
230
+ M. C. du Plessis, G. Niu, and M. Sugiyama. Analysis of learning from positive and unlabeled data. In Advances in Neural Information Processing Systems (NIPS), pp. 703–711, 2014.
231
+ M. C. du Plessis, G. Niu, and M. Sugiyama. Class-prior estimation for learning from positive and unlabeled data. Maching Learning, 106(4):463–492, April 2017. ISSN 0885-6125.
232
+ C. Elkan and K. Noto. Learning classifiers from only positive and unlabeled data. In KDD, 2008.
233
+ G. Fei and B. Liu. Social media text classification under negative covariate shift. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pp. 2347–2356, 2015.
234
+
235
+ G. P. C. Fung, J. X. Yu, H. Lu, and P. S. Yu. Text classification without negative examples revisit. IEEE transactions on Knowledge and Data Engineering, 18(1):6–20, 2006.
236
+
237
+ N. Golowich, A. Rakhlin, and O. Shamir. Size-independent sample complexity of neural networks. In Conference On Learning Theory, pp. 297–299, 2018.
238
+
239
+ Y. Grandvalet and Y. Bengio. Semi-supervised learning by entropy minimization. In Advances in Neural Information Processing Systems (NIPS), pp. 529–536, 2005.
240
+
241
+ K. He, X. Zhang, S. Ren, and J. Sun. Identity mappings in deep residual networks. In European Conference on Computer Vision (ECCV), pp. 630–645. Springer, 2016.
242
+
243
+ J. J. Heckman. Sample selection bias as a specification error. Econometrica, 47(1):153–161, 1979.
244
+
245
+ S. Hido, Y. Tsuboi, H. Kashima, M. Sugiyama, and T. Kanamori. Inlier-based outlier detection via direct density ratio estimation. In Proceedings of IEEE International Conference on Data Mining (ICDM), pp. 223–232. IEEE, 2008.
246
+
247
+ W. Hu, G. Niu, I. Sato, and M. Sugiyama. Does distributionally robust supervised learning give robust classifiers? In International Conference on Machine Learning (ICML), pp. 2034–2042, 2018.
248
+
249
+ J. Huang, A. Gretton, K. M. Borgwardt, B. Scholkopf, and A. J. Smola. Correcting sample selection ¨ bias by unlabeled data. In Advances in Neural Information Processing Systems (NIPS), pp. 601– 608, 2007.
250
+
251
+ T. Ishida, G. Niu, and M. Sugiyama. Binary classification from positive-confidence data. arXiv preprint arXiv:1710.07138, 2018.
252
+
253
+ S. Jain, M. White, and P. Radivojac. Estimating the class prior and posterior from noisy positives and unlabeled data. In Advances in Neural Information Processing Systems (NIPS), pp. 2693–2701, 2016.
254
+
255
+ T. Kanamori, S. Hido, and M. Sugiyama. A least-squares approach to direct importance estimation. Journal of Machine Learning Research, 10:1391–1445, 2009.
256
+
257
+ R. Kiryo, G. Niu, M. C. du Plessis, and M. Sugiyama. Positive-unlabeled learning with non-negative risk estimator. In Advances in Neural Information Processing Systems (NIPS), pp. 1675–1685, 2017.
258
+
259
+ S. Laine and T. Aila. Temporal ensembling for semi-supervised learning. In International Conference on Learning Representations (ICLR), 2017.
260
+
261
+ W. Li, Q. Guo, and C. Elkan. A positive and unlabeled learning algorithm for one-class classification of remote-sensing data. IEEE Transactions on Geoscience and Remote Sensing, 49(2):717–725, 2011.
262
+
263
+ X.-L. Li, B. Liu, and S.-K. Ng. Negative training data can be harmful to text classification. In Proceedings of the 2010 Conference on Empirical Methods in Natural Language Processing, pp. 218–228, 2010.
264
+
265
+ B. Liu, W. S. Lee, P. S. Yu, and X. Li. Partially supervised classification of text documents. In International Conference on Machine Learning (ICML), volume 2, pp. 387–394, 2002.
266
+
267
+ B. Liu, Y. Dai, X. Li, W. S. Lee, and P. S. Yu. Building text classifiers using positive and unlabeled examples. In Proceedings of IEEE International Conference on Data Mining (ICDM), pp. 179– 186. IEEE, 2003.
268
+
269
+ T. Miyato, S.-i. Maeda, M. Koyama, K. Nakae, and S. Ishii. Distributional smoothing with virtual adversairal training. In International Conference on Learning Representations (ICLR), 2016.
270
+
271
+ M. Mohri, A. Rostamizadeh, and A. Talwalkar. Foundations of machine learning. MIT press, 2012.
272
+
273
+ F. Mordelet and J.-P. Vert. A bagging svm to learn from positive and unlabeled examples. Pattern Recognition Letters, 37:201–209, 2014.
274
+
275
+ M. N. Nguyen, X.-L. Li, and S.-K. Ng. Positive unlabeled leaning for time series classification. In IJCAI, volume 11, pp. 1421–1426, 2011.
276
+ A. Oliver, A. Odena, C. Raffel, E. D. Cubuk, and I. J. Goodfellow. Realistic evaluation of deep semi-supervised learning algorithms. arXiv preprint arXiv:1804.09170, 2018.
277
+ M. E. Peters, M. Neumann, M. Iyyer, M. Gardner, C. Clark, K. Lee, and L. Zettlemoyer. Deep contextualized word representations. In Proc. of NAACL, 2018.
278
+ J. Quionero-Candela, M. Sugiyama, A. Schwaighofer, and N. D. Lawrence. Dataset shift in machine learning. 2009.
279
+ H. Ramaswamy, C. Scott, and A. Tewari. Mixture proportion estimation via kernel embeddings of distributions. In International Conference on Machine Learning (ICML), pp. 2052–2060, 2016.
280
+ S. J. Reddi, S. Kale, and S. Kumar. On the convergence of adam and beyond. In International Conference on Learning Representations (ICLR), 2018.
281
+ A. Ruckl ¨ e, S. Eger, M. Peyrard, and I. Gurevych. Concatenated -mean word embeddings as universal ´ cross-lingual sentence representations. arXiv preprint arXiv:1803.01400, 2018.
282
+ T. Sakai, M. C. d. du Plessis, G. Niu, and M. Sugiyama. Semi-supervised classification based on classification from positive and unlabeled data. In International Conference on Machine Learning (ICML), volume 70, pp. 2998–3006, 2017.
283
+ C. Scott and G. Blanchard. Novelty detection: Unlabeled data definitely help. In Artificial Intelligence and Statistics, pp. 464–471, 2009.
284
+ S. Shalev-Shwartz and S. Ben-David. Understanding Machine Learning: From Theory to Algorithms. Cambridge University Press, 2014.
285
+ H. Shimodaira. Improving predictive inference under covariate shift by weighting the log-likelihood function. Journal of statistical planning and inference, 90(2):227–244, 2000.
286
+ M. Sugiyama and M. Kawanabe. Machine Learning in Non-Stationary Environments: Introduction to Covariate Shift Adaptation. MIT Press, Cambridge, Massachusetts, USA, 2012.
287
+ M. Sugiyama and A. J. Storkey. Mixture regression for covariate shift. In Advances in Neural Information Processing Systems (NIPS), pp. 1337–1344, 2007.
288
+ M. Sugiyama, S. Nakajima, H. Kashima, P. V. Buenau, and M. Kawanabe. Direct importance estimation with model selection and its application to covariate shift adaptation. In Advances in Neural Information Processing Systems (NIPS), pp. 1433–1440, 2008.
289
+ G. A. Ward, T. J. Hastie, S. T. Barry, J. Elith, and J. R. Leathwick. Presence-only data and the em algorithm. Biometrics, 65 2:554–63, 2009.
290
+ B. Zadrozny. Learning and evaluating classifiers under sample selection bias. In International Conference on Machine learning (ICML), pp. 903–910, 2004.
291
+ T. Zhang. Statistical behavior and consistency of classification methods based on convex risk minimization. Annals of Statistics, pp. 56–85, 2004.
292
+ M. Zuluaga, D. Hush, E. J F Delgado Leyton, M. Hernandez Hoyos, and M. Orkisz. Learning from only positive and unlabeled data to detect lesions in vascular ct images. In Medical image computing and computer-assisted intervention – MICCAI 2011, volume LNCS 6893, pp. 9–16, 2011.
293
+
294
+ APPENDIX
295
+
296
+ A PROOFS
297
+
298
+ # A.1 PROOF OF THEOREM 1
299
+
300
+ We notice that $( 1 - \pi - \rho ) p ( { \pmb x } \mid s = - 1 ) = p ( { \pmb x } , s = - 1 )$ and that when $h ( \pmb { x } ) > \eta$ , we have $p ( s = + 1 \mid \pmb { x } ) = \sigma ( \pmb { x } ) > 0$ , which allows us to write $p ( s = - 1 \mid x ) = ( p ( s = - 1 \mid x ) / p ( s =$ $+ 1 \mid { \pmb x } ) ) p ( s = + 1 \mid { \pmb x } )$ . We can thus decompose $\bar { R } _ { s = - 1 } ^ { - } ( \bar { g } )$ as following:
301
+
302
+ $$
303
+ \begin{array} { r l } { { \bar { R } _ { s = - 1 } ^ { - } ( g ) = \int \ell ( - g ( x ) ) p ( x , s = - 1 ) d x } } \\ & { = \int 1 _ { h ( x ) \leq \eta } \ell ( - g ( x ) ) p ( x , s = - 1 ) d x } \\ & { \quad + \int 1 _ { h ( x ) > \eta } \ell ( - g ( x ) ) p ( x , s = - 1 ) d x } \\ & { = \int 1 _ { h ( x ) \leq \eta } \ell ( - g ( x ) ) \frac { p ( x , s = - 1 ) } { p ( x ) } p ( x ) d x } \\ & { \quad + \int 1 _ { h ( x ) > \eta } \ell ( - g ( x ) ) \frac { p ( x , s = - 1 ) } { p ( x , s = + 1 ) } p ( x , s = + 1 ) d x . } \end{array}
304
+ $$
305
+
306
+ By writing $p ( { \pmb x } , s = - 1 ) = p ( s = - 1 \mid { \pmb x } ) p ( { \pmb x } ) = ( 1 - \sigma ( { \pmb x } ) ) p ( { \pmb x } )$ and $p ( \pmb { x } , s = + 1 ) = p ( s =$ $+ 1 \mid x ) p ( x ) = \sigma ( { \pmb x } ) p ( { \pmb x } )$ , we have
307
+
308
+ $$
309
+ \begin{array} { l } { \displaystyle \bar { R } _ { s = - 1 } ^ { - } ( g ) = \int \mathbb { 1 } _ { h ( \pmb { x } ) \leq \eta } \ell ( - g ( \pmb { x } ) ) ( 1 - \sigma ( \pmb { x } ) ) p ( \pmb { x } ) d x } \\ { \displaystyle \qquad + \int \mathbb { 1 } _ { h ( \pmb { x } ) > \eta } \ell ( - g ( \pmb { x } ) ) \frac { 1 - \sigma ( \pmb { x } ) } { \sigma ( \pmb { x } ) } p ( \pmb { x } , s = + 1 ) d x . } \end{array}
310
+ $$
311
+
312
+ We obtain Equation (6) after replacing $p ( \pmb { x } , s = + 1 )$ by $\pi p ( x \mid y = + 1 ) + \rho p ( x \mid y = - 1 , s = + 1 )$ .
313
+
314
+ # A.2 PROOF OF THEOREM 2
315
+
316
+ For $\hat { \sigma }$ and $\eta$ given, let us define
317
+
318
+ $$
319
+ R _ { \mathrm { P U b N } , \eta , \hat { \sigma } } ( g ) = \pi R _ { \mathrm { P } } ^ { + } ( g ) + \rho R _ { \mathrm { b N } } ^ { - } ( g ) + \bar { R } _ { s = - 1 , \eta , \hat { \sigma } } ^ { - } ( g ) .
320
+ $$
321
+
322
+ The following lemma establishes the uniform deviation bound from $\hat { R } _ { \mathrm { P U b N } , \eta , \hat { \sigma } }$ to $R _ { \mathrm { P U b N } , \eta , \hat { \sigma } }$
323
+
324
+ Lemma 1. Let $\hat { \sigma } : \mathbb { R } ^ { d } [ 0 , 1 ]$ be a fixed function independent of data used to compute $\hat { R } _ { \mathrm { P U b N } , \eta , \hat { \sigma } }$ and $\eta \in ( 0 , 1 ]$ . For any $\delta > 0$ , with probability at least $1 - \delta$ ,
325
+
326
+ $$
327
+ \begin{array} { l } { \displaystyle \operatorname* { s u p } _ { g \in \mathcal { G } } \vert \hat { R } _ { \mathrm { P U b N } , \eta , \hat { \sigma } } ^ { - } ( g ) - R _ { \mathrm { P U b N } , \eta , \hat { \sigma } } ( g ) \vert } \\ { \displaystyle \quad \leq 2 L _ { l } \mathfrak { R } _ { n _ { \mathrm { U } } , p } ( \mathcal { G } ) + \frac { 2 \pi L _ { l } } { \eta } \mathfrak { R } _ { n _ { \mathrm { P } } , p _ { \mathrm { P } } } ( \mathcal { G } ) + \frac { 2 \rho L _ { l } } { \eta } \mathfrak { R } _ { n _ { \mathrm { b N } } , p _ { \mathrm { b N } } } ( \mathcal { G } ) } \\ { \displaystyle \quad + C _ { l } \sqrt { \frac { \ln ( 6 / \delta ) } { 2 n _ { \mathrm { U } } } } + \frac { \pi C _ { l } } { \eta } \sqrt { \frac { \ln ( 6 / \delta ) } { 2 n _ { \mathrm { P } } } } + \frac { \rho C _ { l } } { \eta } \sqrt { \frac { \ln ( 6 / \delta ) } { 2 n _ { \mathrm { b N } } } } . } \end{array}
328
+ $$
329
+
330
+ Proof. For ease of notation, let
331
+
332
+ $$
333
+ R _ { \mathrm { P } } ( g ) = \mathbb { E } _ { { \pmb x } \sim p _ { \mathrm { P } } ( { \pmb x } ) } \left[ \ell ( g ( { \pmb x } ) ) + \mathbb { 1 } _ { \hat { \sigma } ( { \pmb x } ) > \eta } \ell ( - g ( { \pmb x } ) ) \frac { 1 - \hat { \sigma } ( { \pmb x } ) } { \hat { \sigma } ( { \pmb x } ) } \right] ,
334
+ $$
335
+
336
+ $$
337
+ R _ { \mathrm { b N } } ( g ) = \mathbb { E } _ { { \pmb x } \sim p _ { \mathrm { b N } } ( \pmb x ) } \left[ \ell ( - g ( { \pmb x } ) ) ( 1 + \mathbb { 1 } _ { \hat { \sigma } ( { \pmb x } ) > \eta } \frac { 1 - \hat { \sigma } ( { \pmb x } ) } { \hat { \sigma } ( { \pmb x } ) } ) \right] ,
338
+ $$
339
+
340
+ $$
341
+ R _ { \mathrm { U } } ( g ) = \mathbb { E } _ { { \pmb x } \sim p ( { \pmb x } ) } \left[ \mathbb { 1 } _ { \hat { \pmb \sigma } ( { \pmb x } ) \leq \eta } \ell ( - g ( { \pmb x } ) ) ( 1 - \hat { \pmb \sigma } ( { \pmb x } ) ) \right] ,
342
+ $$
343
+
344
+ $$
345
+ \hat { R } _ { \mathrm { P } } ( g ) = \frac { 1 } { n _ { \mathrm { P } } } \sum _ { i = 1 } ^ { n _ { \mathrm { P } } } \left[ \ell ( g ( \pmb { x } _ { i } ^ { \mathrm { P } } ) ) + \mathbb { 1 } _ { \hat { \sigma } ( \pmb { x } _ { i } ^ { \mathrm { P } } ) > \eta } \ell ( - g ( \pmb { x } _ { i } ^ { \mathrm { P } } ) ) \frac { 1 - \hat { \sigma } ( \pmb { x } _ { i } ^ { \mathrm { P } } ) } { \hat { \sigma } ( \pmb { x } _ { i } ^ { \mathrm { P } } ) } \right] ,
346
+ $$
347
+
348
+ $$
349
+ \hat { R } _ { \mathrm { b N } } ( g ) = \frac { 1 } { n _ { \mathrm { b N } } } \sum _ { i = 1 } ^ { n _ { \mathrm { b N } } } \left[ \ell ( - g ( \boldsymbol x _ { i } ^ { \mathrm { b N } } ) ) ( 1 + \mathbb I _ { \hat { \sigma } ( \boldsymbol x _ { i } ^ { \mathrm { b N } } ) > \eta } \frac { 1 - \hat { \sigma } ( \boldsymbol x _ { i } ^ { \mathrm { b N } } ) } { \hat { \sigma } ( \boldsymbol x _ { i } ^ { \mathrm { b N } } ) } ) \right] ,
350
+ $$
351
+
352
+ $$
353
+ \hat { R } _ { \mathrm { U } } ( g ) = \frac { 1 } { n _ { \mathrm { U } } } \sum _ { i = 1 } ^ { n _ { \mathrm { U } } } \left[ \mathbb { 1 } _ { \hat { \sigma } ( \mathbf { x } _ { i } ^ { \mathrm { U } } ) \leq \eta } \ell ( - g ( \mathbf { x } _ { i } ^ { \mathrm { U } } ) ) ( 1 - \hat { \sigma } ( \mathbf { x } _ { i } ^ { \mathrm { U } } ) ) \right] .
354
+ $$
355
+
356
+ From the sub-additivity of the supremum operator, we have
357
+
358
+ $$
359
+ \begin{array} { r l } { { \operatorname* { s u p } _ { g \in \mathcal { G } } | \hat { R } _ { \mathrm { P U b N } , \eta , \hat { \sigma } } ^ { - } ( g ) - R _ { \mathrm { P U b N } , \eta , \hat { \sigma } } ( g ) | } \quad } & { } \\ & { \leq \pi \operatorname* { s u p } _ { g \in \mathcal { G } } | \hat { R } _ { \mathrm { P } } ( g ) - R _ { \mathrm { P } } ( g ) | + \rho \operatorname* { s u p } _ { g \in \mathcal { G } } | \hat { R } _ { \mathrm { b N } } ( g ) - R _ { \mathrm { b N } } ( g ) | + \operatorname* { s u p } _ { g \in \mathcal { G } } | \hat { R } _ { \mathrm { U } } ( g ) - R _ { \mathrm { U } } ( g ) | . } \end{array}
360
+ $$
361
+
362
+ As a consequence, to conclude the proof, it suffices to prove that with probability at least $1 - \delta / 3$ , the following bounds hold separately:
363
+
364
+ $$
365
+ \begin{array} { r l r } { \displaystyle \operatorname* { s u p } _ { g \in \mathcal { G } } \vert \hat { R } _ { \mathrm { P } } ( g ) - R _ { \mathrm { P } } ( g ) \vert \le \frac { 2 L _ { l } } { \eta } \mathfrak { R } _ { n _ { \mathrm { P } } , p _ { \mathrm { P } } } ( \mathcal { G } ) + \frac { C _ { l } } { \eta } \sqrt { \frac { \ln ( 6 / \delta ) } { 2 n _ { \mathrm { P } } } } , } & \\ { \displaystyle \operatorname* { s u p } _ { g \in \mathcal { G } } \vert \hat { R } _ { \mathfrak { h } \mathrm { N } } ( g ) - R _ { \mathfrak { h } \mathrm { N } } ( g ) \vert \le \frac { 2 L _ { l } } { \eta } \mathfrak { R } _ { n _ { \mathrm { b N } } , p _ { \mathrm { b N } } } ( \mathcal { G } ) + \frac { C _ { l } } { \eta } \sqrt { \frac { \ln ( 6 / \delta ) } { 2 n _ { \mathrm { b N } } } } , } & \\ { \displaystyle \operatorname* { s u p } _ { g \in \mathcal { G } } \vert \hat { R } _ { \mathrm { U } } ( g ) - R _ { \mathrm { U } } ( g ) \vert \le 2 L _ { l } \mathfrak { R } _ { n _ { \mathrm { U } } , p } ( \mathcal { G } ) + C _ { l } \sqrt { \frac { \ln ( 6 / \delta ) } { 2 n _ { \mathrm { U } } } } . } & \end{array}
366
+ $$
367
+
368
+ Below we prove (8). (9) and (10) are proven similarly.
369
+
370
+ Let $\phi _ { \pmb { x } } : \mathbb { R } \mathbb { R } _ { + }$ be the function defined by $\phi _ { \pmb { x } } : z \mapsto \ell ( z ) + \mathbb { 1 } _ { \hat { \sigma } ( \pmb { x } ) > \eta } \ell ( - z ) ( ( 1 - \hat { \sigma } ( \pmb { x } ) ) / \hat { \sigma } ( \pmb { x } ) )$ . For $\pmb { x } \in \mathbb { R } ^ { d } , g \in \mathcal { G }$ , since $\ell ( g ( \pmb { x } ) ) \in [ 0 , C _ { l } ]$ , $\ell ( - g ( \pmb { x } ) ) \in [ 0 , C _ { l } ]$ and $\mathbb { 1 } _ { \hat { \sigma } ( \pmb { x } ) > \eta } ( ( 1 - \hat { \sigma } ( \pmb { x } ) ) / \hat { \sigma } ( \pmb { x } ) ) \in$ $[ 0 , ( 1 - \eta ) / \eta ]$ , we always have $\phi _ { \pmb { x } } ( g ( \pmb { x } ) ) \in [ 0 , C _ { l } / \eta ]$ . Following the proof of Theorem 3.1 in Mohri et al. (2012), it is then straightforward to show that with probability at least $1 - \delta / 3$ , it holds that
371
+
372
+ $$
373
+ \operatorname* { s u p } _ { g \in \mathcal { G } } | \hat { R } _ { \mathrm { P } } ( g ) - R _ { \mathrm { P } } ( g ) | \leq 2 \mathbb { E } _ { \mathcal { X } _ { \mathrm { P } } \sim p _ { \mathrm { P } } ^ { n _ { \mathrm { P } } } } \mathbb { E } _ { \theta } \left[ \operatorname* { s u p } _ { g \in \mathcal { G } } \frac { 1 } { n _ { \mathrm { P } } } \sum _ { i = 1 } ^ { n _ { \mathrm { P } } } \theta _ { i } \phi _ { { \pmb x } _ { i } } ( g ( { \pmb x } _ { i } ) ) \right] + \frac { C _ { l } } { \eta } \sqrt { \frac { \ln ( 6 / \delta ) } { 2 n _ { \mathrm { P } } } } ,
374
+ $$
375
+
376
+ where $\boldsymbol { \theta } = \{ \theta _ { 1 } , \ldots , \theta _ { n _ { \mathrm { P } } } \}$ and each $\theta _ { i }$ is a Rademacher variable.
377
+
378
+ Also notice that for all $_ { \textbf { \em x } }$ , $\phi _ { \pmb { x } }$ is a $( L _ { l } / \eta )$ -Lipschitz function on the interval $[ - C _ { g } , C _ { g } ]$ . By using a modified version of Talagrad’s concentration lemma (specifically, Lemma 26.9 in Shalev-Shwartz & Ben-David (2014)), we can show that, when the set $\mathcal { X } _ { \mathrm { P } }$ is fixed, we have
379
+
380
+ $$
381
+ \mathbb { E } _ { \theta } \left[ \operatorname* { s u p } _ { g \in \mathcal { G } } \frac { 1 } { n _ { \mathrm { P } } } \sum _ { i = 1 } ^ { n _ { \mathrm { P } } } \theta _ { i } \phi _ { { \pmb x } _ { i } } ( g ( { \pmb x } _ { i } ) ) \right] \le \frac { L _ { l } } { \eta } \mathbb { E } _ { \theta } \left[ \operatorname* { s u p } _ { g \in \mathcal { G } } \frac { 1 } { n _ { \mathrm { P } } } \sum _ { i = 1 } ^ { n _ { \mathrm { P } } } \theta _ { i } g ( \pmb x _ { i } ) \right] .
382
+ $$
383
+
384
+ After taking expectation over $\mathcal { X } _ { \mathrm { P } } \sim p _ { \mathrm { P } } ^ { n _ { \mathrm { p } } }$ , we obtain the Equation (8).
385
+
386
+ However, what we really want to minimize is the true risk $R ( g )$ . Therefore, we also need to bound the difference between $R _ { \mathrm { P U b N } , \eta , \hat { \sigma } } ( g )$ and $R ( g )$ , or equivalently, the difference between $\bar { R } _ { s = - 1 , \eta , \hat { \sigma } } ^ { - } ( g )$ and $\bar { R } _ { s = - 1 } ^ { - } ( g )$ .
387
+
388
+ Lemma 2. Let $\hat { \sigma } : \mathbb { R } ^ { d } [ 0 , 1 ]$ , $\eta \in ( 0 , 1 ]$ , $\zeta = p ( \hat { \sigma } \leq \eta )$ and $\epsilon = \mathbb { E } _ { { \pmb x } \sim p ( { \pmb x } ) } [ | \hat { \sigma } ( { \pmb x } ) - \sigma ( { \pmb x } ) | ^ { 2 } ]$ . For all $g \in { \mathcal { G } }$ , it holds that
389
+
390
+ $$
391
+ | \bar { R } _ { s = - 1 , \eta , \hat { \sigma } } ^ { - } ( g ) - \bar { R } _ { s = - 1 } ^ { - } ( g ) | \leq C _ { l } \sqrt { \zeta \epsilon } + \frac { C _ { l } } { \eta } \sqrt { ( 1 - \zeta ) \epsilon } .
392
+ $$
393
+
394
+ Proof. One one hand, we have
395
+
396
+ $$
397
+ \begin{array} { r } { \bar { R } _ { s = - 1 } ^ { - } ( g ) = \underbrace { \int \mathbb { 1 } _ { \hat { \sigma } ( \pmb { x } ) \leq \eta } \ell ( - g ( \pmb { x } ) ) ( 1 - \sigma ( \pmb { x } ) ) p ( \pmb { x } ) d \pmb { x } } _ { A _ { 1 } } } \\ { + \underbrace { \int \mathbb { 1 } _ { \hat { \sigma } ( \pmb { x } ) > \eta } \ell ( - g ( \pmb { x } ) ) ( 1 - \sigma ( \pmb { x } ) ) p ( \pmb { x } ) d \pmb { x } } _ { B _ { 1 } } . } \end{array}
398
+ $$
399
+
400
+ On the other hand, we can express $\bar { R } _ { s = - 1 , \eta , \hat { \sigma } } ^ { - } ( g )$ as
401
+
402
+ $$
403
+ \begin{array} { r l } & { \bar { R } _ { s = - 1 , \eta , \hat { \sigma } } ^ { - } ( g ) = \displaystyle \int \mathbb { 1 } _ { \hat { \sigma } ( \mathbf x ) \leq \eta } \ell ( - g ( \mathbf x ) ) ( 1 - \hat { \sigma } ( \mathbf x ) ) p ( \mathbf x ) d x } \\ & { \quad \quad \quad \quad + \displaystyle \int \mathbb { 1 } _ { \hat { \sigma } ( \mathbf x ) > \eta } \ell ( - g ( \mathbf x ) ) \frac { 1 - \hat { \sigma } ( \mathbf x ) } { \hat { \sigma } ( \mathbf x ) } p ( \mathbf x , s = + 1 ) d x . } \\ & { \quad \quad \quad \quad = \displaystyle \int \mathbb { 1 } _ { \hat { \sigma } ( \mathbf x ) \leq \eta } \ell ( - g ( \mathbf x ) ) ( 1 - \hat { \sigma } ( \mathbf x ) ) p ( \mathbf x ) d x } \\ & { \quad \quad \quad \quad + \displaystyle \int \mathbb { 1 } _ { \hat { \sigma } ( \mathbf x ) > \eta } \ell ( - g ( \mathbf x ) ) ( 1 - \hat { \sigma } ( \mathbf x ) ) \frac { \sigma ( \mathbf x ) } { \hat { \sigma } ( \mathbf x ) } p ( \mathbf x ) d x . } \end{array}
404
+ $$
405
+
406
+ The last equality follows from the fact $p ( { \pmb x } , s \ = \ + 1 ) \ = \ \sigma ( { \pmb x } ) p ( { \pmb x } )$ . As $\vert \bar { R } _ { s = - 1 , \eta , \hat { \sigma } } ^ { - } ( g ) ~ -$ $\bar { R } _ { s = - 1 } ^ { - } ( g ) | \leq | A _ { 1 } - A _ { 2 } | + | B _ { 1 } - B _ { 2 } |$ , it is sufficient to derive bounds for $\left| A _ { 1 } - A _ { 2 } \right|$ and $\left| B _ { 1 } - B _ { 2 } \right|$ separately. For $\left| B _ { 1 } - B _ { 2 } \right|$ , we write
407
+
408
+ $$
409
+ \begin{array} { l } { \displaystyle | B _ { 1 } - B _ { 2 } | \le \int \mathbb { 1 } _ { \hat { \sigma } ( { \pmb x } ) > \eta } \ell ( - g ( { \pmb x } ) ) \frac { \hat { \sigma } ( { \pmb x } ) - \sigma ( { \pmb x } ) | } { \hat { \sigma } ( { \pmb x } ) } p ( { \pmb x } ) d { \pmb x } } \\ { \displaystyle \qquad \le \frac { C _ { l } } { \eta } \int \mathbb { 1 } _ { \hat { \sigma } ( { \pmb x } ) > \eta } | \hat { \sigma } ( { \pmb x } ) - \sigma ( { \pmb x } ) | p ( { \pmb x } ) d { \pmb x } } \\ { \displaystyle \qquad \le \frac { C _ { l } } { \eta } \left( \int \mathbb { 1 } _ { \hat { \sigma } ( { \pmb x } ) > \eta } ^ { 2 } p ( { \pmb x } ) d { \ b x } \right) ^ { \frac { 1 } { 2 } } \left( \int | \hat { \sigma } ( { \pmb x } ) - \sigma ( { \pmb x } ) | ^ { 2 } p ( { \pmb x } ) d { \ b x } \right) ^ { \frac { 1 } { 2 } } } \\ { \displaystyle \qquad = \frac { C _ { l } } { \eta } \sqrt { ( 1 - \zeta ) \epsilon } } \end{array}
410
+ $$
411
+
412
+ From the second to the third line we use the Cauchy-Schwarz inequality. $| A _ { 1 } - A _ { 2 } | \le C _ { l } \sqrt { \zeta \epsilon }$ can be proven similarly, which concludes the proof. □
413
+
414
+ Combining lemma 1 and lemma 2, we know that with probability at least $1 - \delta$ , the following holds:
415
+
416
+ $$
417
+ \begin{array} { r l } & { \underset { g \in \mathcal { G } } { \operatorname* { s u p } } | \hat { R } _ { \mathrm { P U b N } , \eta , \hat { \sigma } } ^ { - } ( g ) - R ( g ) | } \\ & { \leq 2 L _ { l } \mathfrak { R } _ { n _ { \mathrm { U } } , p } ( \mathcal { G } ) + \frac { 2 \pi L _ { l } } { \eta } \mathfrak { R } _ { n _ { \mathrm { P } } , p _ { \mathrm { P } } } ( \mathcal { G } ) + \frac { 2 \rho L _ { l } } { \eta } \mathfrak { R } _ { n _ { \mathrm { b N } } , p _ { \mathrm { b N } } } ( \mathcal { G } ) } \\ & { \quad + C _ { l } \sqrt { \frac { \ln ( 6 / \delta ) } { 2 n _ { \mathrm { U } } } } + \frac { \pi C _ { l } } { \eta } \sqrt { \frac { \ln ( 6 / \delta ) } { 2 n _ { \mathrm { P } } } } + \frac { \rho C _ { l } } { \eta } \sqrt { \frac { \ln ( 6 / \delta ) } { 2 n _ { \mathrm { b N } } } } + C _ { l } \sqrt { \zeta \epsilon } + \frac { C _ { l } } { \eta } \sqrt { ( 1 - \zeta ) \epsilon } . } \end{array}
418
+ $$
419
+
420
+ Finally, with probability at least $1 - \delta$ ,
421
+
422
+ $$
423
+ \begin{array} { r l } & { R ( \hat { g } \mathrm { P r u N } _ { , \eta , \delta } ) - R ( g ^ { * } ) } \\ & { \quad = ( R ( \hat { g } _ { \mathrm { P U W N } , \eta , \delta } ) - \hat { R } _ { \mathrm { P U B N } , \eta , \delta } ^ { - 1 } ( \hat { g } _ { \mathrm { P U W N } , \eta , \delta } ) ) } \\ & { \quad \quad + ( \hat { R } _ { \mathrm { P U B N } , \eta , \delta } ^ { - 1 } ( \hat { g } _ { \mathrm { P U W N } , \eta , \delta } ) - \hat { R } _ { \mathrm { P U B N } , \eta , \delta } ^ { - 1 } ( g ^ { * } ) ) + ( \hat { R } _ { \mathrm { P U B N } , \eta , \delta } ^ { - 1 } ( g ^ { * } ) - R ( g ^ { * } ) ) } \\ & { \quad \le \operatorname* { s u p } _ { \delta \in \widetilde { G } } \left| \hat { R } _ { \mathrm { P U B N } , \eta , \delta } ^ { - 1 } ( g ) - R ( g ) \right| + 0 + \operatorname* { s u p } _ { \delta \in \widetilde { G } } \left| \hat { R } _ { \mathrm { P U B N } , \eta , \delta } ^ { - 1 } ( g ) - R ( g ) \right| } \\ & { \quad \le 4 L _ { L } \mathfrak { P r } _ { \Omega , \eta , \delta } ( g ) + \frac { 4 \pi L } { \eta } _ { \mathfrak { R } _ { \eta } , \eta , \mathrm { P r } , \eta } ( g ) + \frac { 4 \mu L } { \eta } _ { \mathcal { I } } \mathfrak { P r } _ { \mathfrak { R U N } , \eta , \mathrm { P r } , \eta } ( g ) } \\ & { \quad \quad + 2 C _ { L } \sqrt { \frac { \ln ( 6 / \delta ) } { 2 \eta _ { \mathfrak { I U } } } } + \frac { 2 \pi C _ { L } } { \eta } \sqrt { \frac { \ln ( 6 / \delta ) } { 2 \eta _ { \mathfrak { p } } } } + \frac { 2 \mu C _ { L } } { \eta } \sqrt { \frac { \ln ( 6 / \delta ) } { 2 \eta _ { \mathfrak { p } } } } + 2 C _ { L } \sqrt { \zeta _ { \epsilon } } + \frac { 2 C _ { L } } { \eta } \sqrt { ( 1 - \zeta ) \epsilon } . } \end{array}
424
+ $$
425
+
426
+ The first inequality uses the definition of $\hat { g } _ { \mathrm { P U b N } , \eta , \hat { \sigma } }$ .
427
+
428
+ # B VALIDATION LOSS FOR ESTIMATION OF $\sigma$
429
+
430
+ In terms of validation we want to choose the model for $\hat { \sigma }$ such that $J _ { 0 } ( \widehat { \sigma } ) = \mathbb { E } _ { \pmb { x } \sim p ( \pmb { x } ) } [ | \widehat { \sigma } ( \pmb { x } ) - \sigma ( \pmb { x } ) | ^ { 2 } ]$ is minimized. Since $\sigma ( { \pmb x } ) p ( { \pmb x } ) = p ( { \pmb x } , s = + 1 )$ , we have
431
+
432
+ $$
433
+ \begin{array} { l } { { \displaystyle { J _ { 0 } ( \hat { \sigma } ) = \int ( \hat { \sigma } ( { \pmb x } ) - \sigma ( { \pmb x } ) ) ^ { 2 } p ( { \pmb x } ) d x } } } \\ { { \displaystyle ~ = \int \hat { \sigma } ( { \pmb x } ) ^ { 2 } p ( { \pmb x } ) d x - 2 \int \hat { \sigma } ( { \pmb x } ) p ( { \pmb x } , s = + 1 ) d x + \int \sigma ( { \pmb x } ) ^ { 2 } p ( { \pmb x } ) d x . } } \end{array}
434
+ $$
435
+
436
+ The last term does not depend on $\hat { \sigma }$ and can be ignored if we want to identify $\hat { \sigma }$ achieving the smallest $J ( \hat { \sigma } )$ . We denote by $J ( \hat { \sigma } )$ the sum of the first two terms. The middle term can be further expanded using
437
+
438
+ $$
439
+ \int { \hat { \sigma } } ( x ) p ( \mathbf { x } , s = + 1 ) d x = \pi \int { \hat { \sigma } } ( x ) p ( \mathbf { x } \mid y = + 1 ) d x + \rho \int { \hat { \sigma } } ( \mathbf { x } ) p ( \mathbf { x } \mid y = - 1 , s = + 1 ) d x .
440
+ $$
441
+
442
+ The validation loss of an estimation $\hat { \sigma }$ is then defined as
443
+
444
+ $$
445
+ \hat { J } ( \hat { \sigma } ) = \frac { 1 } { n _ { \mathrm { U } } } \sum _ { i = 1 } ^ { n _ { \mathrm { U } } } \hat { \sigma } ( \pmb { x } _ { i } ^ { \mathrm { U } } ) ^ { 2 } - \frac { 2 \pi } { n _ { \mathrm { P } } } \sum _ { i = 1 } ^ { n _ { \mathrm { P } } } \hat { \sigma } ( \pmb { x } _ { i } ^ { \mathrm { P } } ) - \frac { 2 \rho } { n _ { \mathrm { b N } } } \sum _ { i = 1 } ^ { n _ { \mathrm { b N } } } \hat { \sigma } ( \pmb { x } _ { i } ^ { \mathrm { b N } } ) .
446
+ $$
447
+
448
+ It is also possible to minimize this value directly to acquire $\hat { \sigma }$ . In our experiments we decide to learn $\hat { \sigma }$ by nnPU for a better comparison between different methods.
449
+
450
+ # C DETAILED EXPERIMENTAL SETTING
451
+
452
+ # C.1 FROM MULTICLASS TO BINARY CLASS
453
+
454
+ In the experiments we work on multiclass classification datasets. Therefore it is necessary to define the $\mathrm { \bf P }$ and $\mathbf { N }$ classes ourselves. MNIST is processed in such a way that pair numbers 0, 2, 4, 6, 8 form the P class and impair numbers 1, 3, 5, 7, 9 form the N class. Accordingly, $\pi = 0 . 4 9$ . For CIFAR-10, we consider two definitions of the P class. The first one corresponds to a quite natural task that aims to distinguish vehicles from animals. Airplane, automobile, ship and truck are therefore defined to be the $\mathrm { \bf P }$ class while the $\mathbf { N }$ class is formed by bird, cat, deer, dog, frog and horse. For the sake of diversity, we also study another task in which we attempt to distinguish the mammals from the non-mammals. The $\mathrm { \bf P }$ class is then formed by cat, deer, dog, and horse while the N class consists of the other six classes. We have $\pi = 0 . 4$ in the two cases. As for 20 Newsgroups, alt., comp., misc. and rec. make up the $\mathrm { \bf P }$ class whereas sci., soc. and talk. make up the N class. This gives $\pi = 0 . 5 6$ .
455
+
456
+ # C.2 TRAINING, VALIDATION AND TEST SET
457
+
458
+ For the three datasets, we use the standard test examples as a held-out test set. The test set size is thus of 10000 for MNIST and CIFAR-10, and 7528 for 20 Newsgroups. Regarding the training set, we sample 500, 500 and 6000 P, bN and U training examples for MNIST and 20 Newsgroups, and 1000, 1000 and $1 0 0 0 0 \mathrm { P } ,$ bN and U training examples for CIFAR-10. The validation set is always five times smaller than the training set.
459
+
460
+ # C.3 20 NEWSGROUPS PREPROCESSING
461
+
462
+ The original 20 Newsgroups dataset contains raw text data and needs to be preprocessed into text feature vectors for classification. In our experiments we borrow the pre-trained ELMo word embedding (Peters et al., 2018) from https://allennlp.org/elmo. The used 5.5B model was, according to the website, trained on a dataset of 5.5B tokens consisting of Wikipedia (1.9B) and all of the monolingual news crawl data from WMT 2008-2012 (3.6B). For each word, we concatenate the features from the three layers of the ELMo model, and for each document, as suggested in Ruckl ¨ e et al. ´ (2018), we concatenate the average, minimum, and maximum computed along the word dimension. This results in a 9216-dimensional feature vector for a single document.
463
+
464
+ # C.4 MODELS AND HYPERPARAMETERS
465
+
466
+ MNIST For MNIST, we use a standard ConvNet with ReLU. This model contains two 5x5 convolutional layers and one fully-connected layer, with each convolutional layer followed by a $2 \mathrm { x } 2 \mathrm { m a x }$ pooling. The channel sizes are 5-10-40. The model is trained for 100 epochs with a weight decay of $\mathrm { \dot { 1 } 0 ^ { - 4 } }$ . Each minibatch is made up of 10 P, 10 bN (if available) and $1 2 0 \mathrm { U }$ samples. The learning rate $\alpha \in \{ 1 0 ^ { - 2 } , 1 0 ^ { - 3 } \}$ and $\tau \in \{ 0 . 5 , 0 . 7 , 0 . 9 \}$ , $\gamma \in \{ 0 . 1 , 0 . 3 , 0 . 5 , 0 . 7 , 0 . 9 \}$ are selected with validation data.
467
+
468
+ CIFAR-10 For CIFAR-10, we train PreAct ResNet-18 (He et al., 2016) for 200 epochs and the learning rate is divided by 10 after 80 epochs and 120 epochs. This is a common practice and similar adjustment can be found in He et al. (2016). The weight decay is set to $1 0 ^ { - 4 }$ . The minibatch size is $1 / 1 0 0$ of the number of training samples, and the initial learning rate is chosen from $\lbrace 1 0 ^ { - 2 } , 1 0 ^ { - 3 } \rbrace$ . We also have $\tau \in \{ 0 . 5 , 0 . 7 , 0 . 9 \}$ and $\gamma \in \{ 0 . 1 , 0 . 3 , 0 . 5 , 0 . 7 , 0 . 9 \}$ .
469
+
470
+ 20 Newsgroups For 20 Newsgroups, with the extracted features, we simply train a multilayer perceptron with two hidden layers of 300 neurons for 50 epochs. We use basically the same hyperparameters as for MNIST except that the learning rate $\alpha$ is selected from $\{ 5 \cdot 1 0 ^ { - 3 } , 1 0 ^ { - 3 } , 5 \cdot \mathrm { i } \mathrm { \dot { 0 } ^ { - 4 } } \}$ .
471
+
472
+ # D ADDITIONAL EXPERIMENTS
473
+
474
+ # D.1 WHY DOES PUBN\N OUTPERFORM NNPU ?
475
+
476
+ Our method, specifically designed for PUbN learning, naturally outperforms other baseline methods in this problem. Nonetheless, Table 1 equally shows that the proposed method when applied to PU learning, achieves significantly better performance than the state-of-the-art nnPU algorithm. Here we numerically investigate the reason behind this phenomenon.
477
+
478
+ Besides nnPU and PUbN\N, we compare with unbiased PU (uPU) learning (2). Both uPU and nnPU are learned with the sigmoid loss, learning rate $1 0 ^ { - 3 }$ for MNIST, initial learning rate $1 0 ^ { - 4 }$ for CIFAR-10, and learning rate $\mathrm { \bar { 1 0 } ^ { - 4 } }$ for 20 Newsgroups. This is because uPU learning is unstable with the logistic loss. The other parts of the experiments remain unchanged. On the test sets we compute the false positive rates, false negative rates and misclassification errors for the three methods and plot them in Figure 2. We first notice that PUbN\N still outperforms nnPU trained with the sigmoid loss. In fact, the final performance of the nnPU classifier does not change much when we replace the logistic loss with the sigmoid loss.
479
+
480
+ ![](images/d541efdb0152b9c786f9dedbc000a3b265230519f60ba8a3ce4233398a9818f3.jpg)
481
+ Figure 2: Comparison of uPU, nnPU and PUbN\N over the four PU learning tasks. For each task, means and standard deviations are computed based on the same 10 random samplings. Dashed lines indicate the corresponding values of the final classifiers (recall that at the end we select the model with the lowest validation loss out of all epochs).
482
+
483
+ In Kiryo et al. (2017), the authors observed that uPU overfits training data with the risk going to negative. In other words, a large portion of U samples are classified to the N class. This is confirmed in our experiments by an increase of false negative rate and decrease of false positive rate. nnPU remedies the problem by introducing the non-negative risk estimator (3). While the non-negative correction successfully prevents false negative rate from going up, it also causes more $_ \mathrm { N }$ samples to be classified as P compared to uPU. However, since the gain in terms of false negative rate is enormous, at the end nnPU achieves a lower misclassification error. By further identifying possible N samples after nnPU learning, we expect that our algorithm can yield lower false positive rate than nnPU without misclassifying too many $\mathrm { \bf P }$ samples as $_ \mathrm { N }$ as in the case of uPU. Figure 2 suggests that this is effectively the case. In particular, we observe that on MNIST, our method achieves the same false positive rate than uPU whereas its false negative rate is comparable to nnPU.
484
+
485
+ # D.2 INFLUENCE OF $\eta$ AND $\rho$
486
+
487
+ In the proposed algorithm we introduce $\eta$ to control how $\bar { R } _ { s = - 1 } ( g )$ is approximated from data and assume that $\rho = p ( y = - 1 , s = + 1 )$ is given. Here we conduct experiments to see how our method is affected by these two factors. To assess the influence of $\eta$ , from Table 1 we pick four learning tasks and we choose $\tau$ from $\{ 0 . 5 , 0 . 7 , 0 . 9 , 2 \}$ while all the other hyperparameters are fixed. Similarly to simulate the case where $\rho$ is misspecified, we replace it by $\rho ^ { \dagger } \mathbf { \bar { \rho } } \in \mathbf { \bar { \{ 0 . 8 \rho , \rho , 1 . 2 \rho \} } }$ in our learning method and run experiments with all hyperparameters being fixed to a certain value. However, we still use the true $\rho$ to compute $\eta$ from $\tau$ to ensure that we always use the same number of $\mathrm { U }$ samples in the second step of the algorithm independent of the choice of $\rho ^ { \prime }$ .
488
+
489
+ The results are reported in Table 2 and Table 3. We can see that the performance of the algorithm is sensitive to the choice of $\tau$ . With larger value of $\tau$ , more $\mathrm { U }$ data are treated as $\mathbf { N }$ data in PUbN learning, and consequently it often leads to higher false negative rate and lower false positive rate. The trade-off between these two measures is a classic problem in binary classification. In particular, when $\tau = 2$ , a lot more U samples are involved in the computation of the PUbN risk (7), but this does not allow the classifier to achieve a better performance. We also observe that there is a positive correlation between the misclassification rate and the validation loss, which confirms that the optimal value of $\eta$ can be chosen without need of unbiased $\mathbf { N }$ data.
490
+
491
+ Table 3 shows that in general slight misspecification of $\rho$ does not cause obvious degradation of the classification performance. In fact, misspecification of $\rho$ mainly affect the weights of each sample when we compute $\hat { R } _ { \mathrm { P U b N } , \eta , \hat { \sigma } }$ (due to the direct presence of $\rho$ in (7) and influence on estimating $\sigma _ { \cdot }$ ). However, as long as the variation of these weights remain in a reasonable range, the learning algorithm should yield classifiers with similar performances.
492
+
493
+ # D.3 ESTIMATING $\sigma$ FROM SEPARATE DATA
494
+
495
+ Theorem 2 suggests that $\hat { \sigma }$ should be independent from the data used to compute $\hat { R } _ { \mathrm { P U b N } , \eta , \hat { \sigma } }$ . Therefore, here we investigate the performance of our algorithm when $\hat { \sigma }$ and $g$ are optimized using different sets of data. We sample two training sets and two validation sets in such a way that they are all disjoint. The size of a single training set and a single validation set is as indicated in Appendix C.2, except for 20 Newsgroups we reduce the number of examples in a single set by half. We then use different pairs of training and validation sets to learn $\hat { \sigma }$ and $g$ . For 20 Newsgroups we also conduct standard experiments where $\hat { \sigma }$ and $g$ are learned on the same data, whereas for MNIST and CIFAR-10 we resort to Table 1.
496
+
497
+ The results are presented in Table 4. Estimating $\sigma$ from separate data does not seem to benefit much the final classification performance, despite the fact that it requires collecting twice more samples. In fact, $\hat { \bar { \cal R } } _ { s = - 1 , \eta , \hat { \sigma } } ^ { - } ( g )$ is a good approximation of $\bar { R } _ { s = - 1 , \eta , \hat { \sigma } } ^ { - } ( g )$ as long as the function $\hat { \sigma }$ is smooth enough and does not possess abrupt changes between data points. With the use of non-negative correction, validation data and L2 regularization, the resulting $\hat { \sigma }$ does not overfit training data so this should always be the case. As a consequence, even if $\hat { \sigma }$ and $g$ are learned on the same data, we are still able to achieve small generalization error with sufficient number of samples.
498
+
499
+ # D.4 ALTERNATIVE DEFINITION OF NNPNU
500
+
501
+ In subsection 2.3, we define the nnPNU algorithm by forcing the estimator of the whole $_ \mathrm { N }$ partial risk to be positive. However, notice that the term $\gamma ( 1 - \pi ) \hat { R } _ { \mathrm { N } } ^ { - } ( g )$ is always positive and the chances are that including it simply makes non-negative correction weaker and is thus harmful to the final classification performance. Therefore, here we consider an alternative definition of nnPNU where we only force the term $( 1 - \gamma ) ( \hat { R } _ { \mathrm { U } } ^ { - } ( g ) - \pi \hat { R } _ { \mathrm { P } } ^ { - } ( g ) )$ to be positive. We plug the resulting algorithm in the experiments of subsection 4.2 and summarize the results in Table 5 in which we denote the alternative version of nnPNU by $\mathrm { n n P U + P N }$ since it uses the same non-negative correction as nnPU. The table indicates that neither of the two definitions of nnPNU consistently outperforms the other.
502
+
503
+ Table 2: Results on four different PUbN learning tasks when we vary the value of $\tau$ (and accordingly, $\eta$ ). Reported are means of false positive rates (FPR), false negative rates (FNR), misclassification rates (Error), and validation losses (VLoss) over 10 trials.
504
+
505
+ <table><tr><td>Dataset</td><td>P</td><td>biased N</td><td>T</td><td>FPR</td><td>FNR</td><td>Error</td><td>VLosS</td></tr><tr><td rowspan="4">MNIST</td><td rowspan="4">2,4,6,8,10</td><td rowspan="4">1,3,5</td><td>0.5</td><td>4.79</td><td>4.32</td><td>4.56</td><td>10.11</td></tr><tr><td>0.7</td><td>3.32</td><td>4.81</td><td>4.05</td><td>9.15</td></tr><tr><td>0.9</td><td>3.29</td><td>4.40</td><td>3.83</td><td>9.30</td></tr><tr><td>2</td><td>3.38</td><td>5.32</td><td>4.33</td><td>10.68</td></tr><tr><td rowspan="4">CIFAR-10</td><td rowspan="4">Airplane, automobile, ship, truck</td><td rowspan="4">Horse &gt; deer = frog &gt; others</td><td>0.5</td><td>8.31</td><td>12.35</td><td>9.92</td><td>12.50</td></tr><tr><td>0.7</td><td>8.23</td><td>13.15</td><td>10.20</td><td>12.62</td></tr><tr><td>0.9</td><td>7.54</td><td>14.68</td><td>10.40</td><td>13.08</td></tr><tr><td>2</td><td>6.23</td><td>20.29</td><td>11.85</td><td>13.64</td></tr><tr><td rowspan="4">CIFAR-10</td><td rowspan="4">Cat, deer, dog, horse</td><td rowspan="4">Bird, frog</td><td>0.5</td><td>14.45</td><td>27.57</td><td>19.70</td><td>22.08</td></tr><tr><td>0.7</td><td>13.20</td><td>27.27</td><td>18.83</td><td>20.72</td></tr><tr><td>0.9</td><td>13.00</td><td>32.61</td><td>20.84</td><td>23.78</td></tr><tr><td>2</td><td>11.67</td><td>31.49</td><td>19.60</td><td>22.52</td></tr><tr><td rowspan="4">20 Newsgroups</td><td rowspan="4">alt., comp., misc., rec.</td><td rowspan="4">soc.&gt; talk.&gt; sci.</td><td>0.5</td><td>11.28</td><td>12.90</td><td>12.18</td><td>16.04</td></tr><tr><td>0.7</td><td>11.40</td><td>13.58</td><td>12.62</td><td>16.64</td></tr><tr><td>0.9</td><td>10.09</td><td>16.70</td><td>13.79</td><td>16.90</td></tr><tr><td>2</td><td>10.34</td><td>20.55</td><td>16.06</td><td>20.99</td></tr></table>
506
+
507
+ Table 3: Mean and standard deviation of misclassification rates over 10 trials on different PUbN learning tasks when we replace $\rho$ by $\rho ^ { \prime } \in \{ 0 . 8 \rho , \rho , 1 . 2 \rho \}$ . Underlines indicate significant degradation of performance according to the $5 \%$ t-test.
508
+
509
+ <table><tr><td rowspan="2">Dataset</td><td rowspan="2">P</td><td rowspan="2">biased N</td><td colspan="3">p/p</td></tr><tr><td>0.8</td><td>1</td><td>1.2</td></tr><tr><td rowspan="2">MNIST</td><td rowspan="2">2,4,6,8,10</td><td>1,3,5</td><td>4.10 ± 0.39</td><td>4.05 ± 0.27</td><td>4.14 ± 0.45</td></tr><tr><td>9 &gt;5&gt;others</td><td>3.85 ± 0.55</td><td>3.91 ± 0.66</td><td>3.94± 0.54</td></tr><tr><td rowspan="2">CIFAR-10</td><td rowspan="2">Airplane, automobile, ship, truck</td><td>Cat, dog, horse</td><td>10.23 ± 0.59</td><td>9.71 ± 0.51</td><td>10.32 ± 0.57</td></tr><tr><td>Horse V deer = frog &gt; others</td><td>10.18 ± 0.40</td><td>9.92 ± 0.42</td><td>10.05 ± 0.59</td></tr><tr><td rowspan="2">CIFAR-10</td><td rowspan="2">Cat, deer, dog, horse</td><td>Bird, frog</td><td>18.94 ± 0.50</td><td>18.83 ± 0.71</td><td>19.06 ± 0.80</td></tr><tr><td>Car, truck</td><td>20.39 ± 1.24</td><td>20.19 ± 1.06</td><td>19.92 ± 0.89</td></tr><tr><td rowspan="3">20 Newsgroups</td><td rowspan="3">alt., comp., misc., rec.</td><td>sci.</td><td>13.49 ± 0.61</td><td>13.10 ±0.90</td><td>13.31 ± 1.05</td></tr><tr><td>talk.</td><td>12.64 ± 0.69</td><td>12.61 ± 0.75</td><td>13.77 ± 0.85</td></tr><tr><td>soc. &gt; talk.&gt; sci.</td><td>12.90 ± 0.79</td><td>12.18 ± 0.59</td><td>12.74 ± 0.35</td></tr></table>
510
+
511
+ It also ensures that there is always a clear superiority of our proposed PUbN algorithm compared to nnPNU despite its possible variant that is considered here.
512
+
513
+ Table 4: Mean and standard deviation of misclassification rates over 10 trials on different PUbN learning tasks with $\hat { \sigma }$ and $g$ trained using either the same or different sets of data.
514
+
515
+ <table><tr><td rowspan="2">Dataset</td><td rowspan="2">P</td><td rowspan="2">biased N</td><td colspan="2">Data for and g</td></tr><tr><td>Same</td><td>Different</td></tr><tr><td>MNIST</td><td>2,4,6,8,10</td><td>1,3,5 9 &gt;5&gt;others</td><td>4.05 ± 0.27 3.91 ± 0.66</td><td>3.71 ± 0.45 4.06 ± 0.36</td></tr><tr><td>CIFAR-10</td><td>Airplane, automobile, ship, truck</td><td>Cat, dog, horse Horse V deer = frog &gt; others</td><td>9.71 ± 0.51 9.92 ± 0.42</td><td>10.00 ± 0.51 9.66 ± 0.46</td></tr><tr><td>CIFAR-10</td><td>Cat, deer, dog, horse</td><td>Bird, frog Car, truck</td><td>18.83 ± 0.71 20.19 ± 1.06</td><td>18.52 ± 0.70</td></tr><tr><td>20 Newsgroups</td><td>alt., comp., misc., rec.</td><td>sci. talk. soc. &gt; talk. &gt; sci.</td><td>15.61 ± 1.50 17.14 ± 1.87</td><td>19.98 ± 0.93 16.60 ± 2.38 15.80 ± 0.95</td></tr></table>
516
+
517
+ Table 5: Mean and standard deviation of misclassification rates over 10 trials on different PUbN learning tasks for the two possible definitions of the nnPNU algorithm.
518
+
519
+ <table><tr><td>Dataset</td><td>P</td><td>biased N</td><td>nnPNU</td><td>nnPU + PN</td></tr><tr><td>MNIST</td><td>2,4,6, 8, 10</td><td>1,3,5 9 &gt;5&gt; others</td><td>5.33 ± 0.97 4.60 ± 0.65</td><td>5.68± 0.78 5.10 ± 1.54</td></tr><tr><td>CIFAR-10</td><td>Airplane, automobile, ship, truck</td><td>Cat, dog, horse Horse V deer = frog &gt; others</td><td>10.25 ± 0.38 9.98 ± 0.53</td><td>10.87 ± 0.62 10.77 ± 0.65</td></tr><tr><td>CIFAR-10</td><td>Cat, deer, dog, horse</td><td>Bird, frog Car, truck</td><td>22.00 ± 0.53 22.00 ± 0.74</td><td>21.41 ± 1.01 21.80 ± 0.74</td></tr><tr><td>20 Newsgroups</td><td>alt., comp., misc., rec.</td><td>sci. talk. soc. &gt; talk.&gt; sci.</td><td>14.69 ± 0.46 14.38 ± 0.74 14.41 ± 0.70</td><td>14.50 ± 1.32 14.71 ± 1.01 13.66 ± 0.72</td></tr></table>
md/train/H1xipsA5K7/H1xipsA5K7.md ADDED
The diff for this file is too large to render. See raw diff
 
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/HJeRkh05Km/HJeRkh05Km.md ADDED
@@ -0,0 +1,294 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # VISUAL SEMANTIC NAVIGATION USING SCENE PRIORS
2
+
3
+ Wei Yang1, Xiaolong Wang2, Ali Farhadi4,5, Abhinav Gupta2,3, Roozbeh Mottaghi5 1 The Chinese University of Hong Kong 2 Carnegie Mellon University 3 Facebook AI Research 4 University of Washington 5 Allen Institute for AI
4
+
5
+ ![](images/db7d2da001c9a1d9b7e1da8619686d0e4d5bec0baf0cfc67a499d5b53445191a.jpg)
6
+ Figure 1: Our goal is to use scene priors to improve navigation in unseen scenes and towards novel objects. (a) There is no mug in the field of view of the agent, but the likely location for finding a mug is the cabinet near the coffee machine. (b) The agent has not seen a mango before, but it infers that the most likely location for finding a mango is the fridge since similar objects such as apple appear there as well. The most likely locations are shown with the orange box.
7
+
8
+ # ABSTRACT
9
+
10
+ How do humans navigate to target objects in novel scenes? Do we use the semantic/functional priors we have built over years to efficiently search and navigate? For example, to search for mugs, we search cabinets near the coffee machine and for fruits we try the fridge. In this work, we focus on incorporating semantic priors in the task of semantic navigation. We propose to use Graph Convolutional Networks for incorporating the prior knowledge into a deep reinforcement learning framework. The agent uses the features from the knowledge graph to predict the actions. For evaluation, we use the AI2-THOR framework. Our experiments show how semantic knowledge improves performance significantly. More importantly, we show improvement in generalization to unseen scenes and/or objects.
11
+
12
+ # 1 INTRODUCTION
13
+
14
+ Consider the kitchen scene shown in Figure 1(a) and the task of finding an object such as a mug. Even though we have never seen this particular kitchen before and no mug is visible in the scene, we can still infer the likely locations to find the mug and create an exploration plan accordingly. For example, in Figure 1(a), we can infer that since there is a coffee machine, the mug is most likely in the cabinet near the coffee machine. How do we do that? We infer that mugs are usually used for coffee. And since there is a coffee machine, the mug is likely to be near the machine due to functional efficiency. We argue that humans use strong priors about the functional and semantic structure of the world to develop such efficient navigation strategies. And how do we learn such functional/semantic priors? Our prior experience and exploration of tens of kitchens help us to learn these priors.
15
+
16
+ But these priors are not just used for navigating to known objects but also to completely unknown and unseen objects. For example, let us assume you have never seen a mango before and someone gives you a task of finding a mango in a new kitchen you have never seen before (let’s say Figure 1(b)). How would you do it? Assuming you have searched for fruits like apples and grapes before, and you know mango is also a fruit; so a similar exploration strategy might apply. Therefore, in Figure 1(b), you are more likely to navigate to the fridge to search for a mango. Therefore, we use the semantic/functional priors to navigate to unseen objects as well.
17
+
18
+ Inspired by these observations, in this paper, we explore how to exploit semantic priors for the task of semantic and goal-oriented navigation. In our visual navigation task, the environment, the path to the target, the target location, or the exact appearance of the target object can be unknown. The prior knowledge about the semantic/functional structure of the world helps to improve the navigation. We propose to use Graph Convolutional Networks (GCNs) (Kipf & Welling, 2017) to incorporate the prior knowledge into a Deep Reinforcement Learning framework. The knowledge of the agent is encoded in a graph. GCNs allow arbitrary structured graphs to be encoded in an efficient way. The knowledge is updated according to the current observation of the agent, which is specific to the current environment, and the knowledge at the previous time step or the prior knowledge. The prior knowledge is obtained from large-scale datasets designed for scene understanding. Our model is based on the actor-critic model (Mnih et al., 2016) that is augmented by the knowledge graph and object visibility information.
19
+
20
+ To evaluate our model, we use the AI2-THOR framework (Kolve et al., 2017), which provides near photo-realistic customizable environments. The agent can take navigation actions in these environments and observe the changes as a result of those actions. AI2-THOR includes various objects that can be arranged in many different configurations. The agent location is randomized as well at each episode of training or testing. Our experiments show that the semantic prior improves the performance of the baseline RL models significantly. Furthermore, we show the results of the model on the challenging setting where the scene and/or the object are new to the agent.
21
+
22
+ Our contributions are summarized as follows: (1) We integrate a deep reinforcement learning model with knowledge graphs. This allows the agent to encode any form of knowledge that can be represented by graph structures. (2) We show that semantic prior knowledge can significantly improve the navigation performance. (3) By considering the prior information and the semantics of the target objects, we improve generalization to unseen environments and novel target objects.
23
+
24
+ # 2 RELATED WORK
25
+
26
+ Semantic and goal-oriented navigation is one of the most prominent tasks that intelligent species perform in their daily life. There are several challenges involved in visual navigation. First, the environment might be unknown to the agent. In this situation, the agent requires to explore the environment to have a better understanding of that environment. The second challenge is about the visibility of target objects. The target object might not be visible when the agent starts the navigation or it might go out of the field of view during navigation. Hence, the agent needs to learn an efficient search strategy to find the target object. The third challenge is related to planning. The object might be visible but planning a reasonable path towards the object is another issue that the agent needs to deal with. There have been several efforts in the past to tackle these challenges which we describe below.
27
+
28
+ Geometry-based navigation. Navigation methods can be divided into two main categories of geometry-based and learning-based. Most of the traditional navigation approaches fall into the former category, where it is assumed that either the map of the environment is known a priori, e.g., Matthies & Shafer (1987); Borenstein & Koren (1991); Meng & Kak (1993); Kim & Nevatia (1999) or a map is built on the fly e.g., Thrun (1998); Feder et al. (1999); Jones & Soatto (2011); Siagian et al. (2014). Our work is different from these approaches since we do not rely on a map for our navigation and we leverage semantic prior knowledge to reduce the required exploration time.
29
+
30
+ Learning-based navigation. Recent success of deep learning and reinforcement learning has made learning-based navigation approaches more popular. Zhu et al. (2017) propose a deep RL-based navigation approach, where they provide the picture of the target object. In contrast, we only provide semantic labels to the agent, so we can show generalization to unseen scenes. Gupta et al. (2017) propose a mapper and planner to output navigation actions. Mirowski et al. (2017) also propose a navigation framework that optimizes a loss for auxiliary tasks such as depth prediction and loop closure classification. Sadeghi & Levine (2017) propose an RL-based approach for collision avoidance. Brahmbhatt & Hays (2017) explore a CNN-based approach for navigating in cities using local observations of the streets. Wu & Tian (2017) combine deep RL with curriculum learning in a first-person shooting game setting. Savinov et al. (2018) introduce a topological landmark-based memory for navigation. Kahn et al. (2018) propose a method based on model-free and model-based RL to learn navigation policies using a few samples. Mousavian et al. (2018) use object detection and semantic segmentation to better navigate in unseen environments. Chen et al. (2015) directly map the input image to an action in an autonomous driving setting. There is also a large body of work that address visually grounded navigation instructions e.g., Anderson et al. (2018b); Chaplot et al. (2018); Hermann et al. (2017); Yu et al. (2018); Misra et al. (2017); Mei et al. (2016). In contrast to all these approaches, we incorporate semantic and functional priors to improve navigation performance and better generalize to unseen scenes and objects.
31
+
32
+ Context and scene prior. Contextual reasoning has been studied extensively in the computer vision literature (Torralba et al., 2003; Hoiem et al., 2005; Rabinovich et al., 2005; Divvala et al., 2009; Desai et al., 2009; Marszalek et al., 2009; Malisiewicz & Efros, 2009; Mottaghi et al., 2014; Zhu et al., 2015; Shrivastava & Gupta, 2016). However, contextual information is mainly used for static settings such as object detection, semantic segmentation or action recognition. We use contextual reasoning for an interactive navigation task, where the agent updates its belief based on the current observation and the prior knowledge as it moves in the environment. Object relationships have been used for tasks such as image retrieval (Johnson et al., 2015), visual relation detection (Zhang et al., 2017), referring expressions (Nagaraja et al., 2016; Hu et al., 2017), and visual question answering (Johnson et al., 2017).
33
+
34
+ Knowledge graphs. There are recent works that use knowledge graphs for computer vision problems. A knowledge graph is used by Marino et al. (2017) for image classification, by Li et al. (2017) for situation recognition and by Wang et al. (2018) for zero-shot recognition. We use knowledge graphs in an RL setting for the interactive task of visual navigation.
35
+
36
+ Reasoning about unknown environments or objects. Various works have explored zero-shot reasoning in the context of reinforcement learning. Yu et al. (2018) address the problem of learning language in a 2D maze, where they can handle unseen word combinations or new sentences that contain unseen words. Harrison et al. (2017); Higgins et al. (2017) study zero-shot policy transfer in the scenarios that the dynamics or the states of the target domain is different from those of the source domain. Pathak et al. (2018) propose a zero-shot imitation learning approach where the expert demonstration for a particular task is never seen. Oh et al. (2017) address generalization of RL to unseen instructions and longer instructions. Our problem is different since we address navigation to novel objects or navigating in unseen scenes using scene priors.
37
+
38
+ # 3 VISUAL SEMANTIC NAVIGATION
39
+
40
+ In this section, we first define the task of visual semantic navigation. We then describe the formulation using deep reinforcement learning and the baseline model for the task.
41
+
42
+ # 3.1 TASK DEFINITION
43
+
44
+ Our goal is to navigate from a random starting location in a scene to a specified target object category given only egocentric RGB perception of the agent. The target object category is specified by a semantic label, thus we call our task visual semantic navigation. The task is considered successful if an instance of the target object category is visible. By “visible”, we mean the target object is in the field of view and within a threshold of distance.
45
+
46
+ # 3.2 THE BASELINE MODEL
47
+
48
+ We formulate the visual semantic navigation using a deep reinforcement learning framework. Given a semantic task objective $g$ , the agent perceives a state $s _ { t }$ (i.e., the egocentric RGB image from the current location and orientation) at the time step $t$ and samples an action $a _ { t }$ from the set of possible actions $\mathcal { A }$ according to its policy $\pi$ . We approximate the policy by a deep policy network $\pi ( \cdot ; \theta )$ :
49
+
50
+ $$
51
+ a _ { t } \sim \pi ( \phi ( s _ { t } ; u ) , \psi ( g ; v ) ; \theta ) ,
52
+ $$
53
+
54
+ ![](images/18ddf835a05881d267abcdd22f7f41104bb2f3eeede453ab7d3bdd0ec04fe5ff.jpg)
55
+ Figure 2: Overview of the architecture. Our model to incorporate semantic knowledge into semantic navigation. Specifically, we learn a policy network that decides an action based on the visual features of the current state, the semantic target category feature and the features extracted from the knowledge graph. We extract features from the parts of the knowledge graph that are activated.
56
+
57
+ where $u , v$ , and $\theta$ are the parameters for the network. Since the visual state and the semantic objective are from different modalities, we design two branches of subnetworks $\phi ( \cdot ; u )$ and $\psi ( \cdot ; v )$ to map these two inputs into a joint visual-semantic feature embedding.
58
+
59
+ Visual network. As illustrated in Figure 2 (top), the visual network takes $2 2 4 \times 2 2 4$ RGB images as input and generates a 512-d feature vector as output. The backbone of the visual branch is ResNet50 (He et al., 2016) pre-trained on ImageNet. Specifically, we extract the 2048-d feature after the global average pooling of ResNet-50. To account for the history of the actions taken by the agent, we concatenate the features of the current frame and three past observations, which results in a 8192-d feature vector. We then add a fully connected layer and a ReLU layer to map the concatenated image feature into the 512-d visual-semantic feature.
60
+
61
+ Semantic network. The semantic task objective is described by an object category, e.g., Microwave or Television. We use fastText (Joulin et al., 2016) to compute a 100-d embedding for each word. Then we map the word embedding into a 512-d feature by a fully connected layer and ReLU, as illustrated in Figure 2 (middle).
62
+
63
+ Actor-Critic policy network. We employ the Asynchronous Advantage Actor-Critic (A3C) (Mnih et al., 2016) model to predict the policy at each time step. The input of our A3C model is the joint representation of the current state and the semantic task objective, which is a 1024-d feature vector made by concatenating the outputs of the visual network and the semantic network. The A3C model generates two outputs, i.e., the policy and the value. We sample the action from the predicted policy.
64
+
65
+ Our implementation of the A3C model consists of three layers: the input, the hidden layer, and the outputs. The hidden layer is a fully connected layer followed by the ReLU activation layer which maps the fused input into a 512-d latent space. Then the $| { \cal A } |$ dimensional policy and the value are generated by two branches of network, as shown in Figure 2. Unlike previous work (e.g., Zhu et al. (2017)) which uses different policy networks for different scenes, we use a single policy network for different scene examples. This makes our model more compact and generalizable.
66
+
67
+ Reward. We consider a reward to minimize the trajectory length to the targets: If any object instance from the target object category is reached within a certain number of steps, the agent receives a large positive reward 10.0. Otherwise, we penalize each step with a small negative reward -0.01. The design of the reward function is also affected by the types of actions $\mathcal { A }$ . In our experiments, we ablate two sets of actions $\mathcal { A }$ with or without the stop action. In the setting without the stop action, the agent will receive the positive reward if the environment notifies it when it reaches the target, which also ends an episode of training. In the setting with the stop action, the episode is terminated when the stop action is executed, and the positive reward will be provided only if the agent is within the threshold of distance from the target (1 meter in our experiments) and facing the target. This makes the task much more challenging.
68
+
69
+ ![](images/84f6b507c7d4337107b30bd248faf33b2ec5e3752b2f2033ccf289176aa6ab1e.jpg)
70
+ Figure 3: Scene priors. We extract relationships between objects from the Visual Genome (Krishna et al., 2017) dataset. The relationships for two example object categories are illustrated.
71
+
72
+ # 4 GENERALIZATION WITH GRAPH CONVOLUTIONAL NETWORKS
73
+
74
+ Our goal in this paper is to incorporate semantic knowledge into a Reinforcement Learning framework. To this end, we incorporate semantic knowledge in the form of graph representation and use Graph Convolutional Networks (GCNs) (Kipf & Welling, 2017) to compute relational features on the graph. GCNs allow us to incorporate prior knowledge and dynamically update it as the agent receives information specific to the current environment.
75
+
76
+ We first briefly describe how we build a semantic knowledge graph to represent the priors. We then provide the background for GCNs. Finally, we delve into the details of how we incorporate GCNs for the task of visual semantic navigation and how it helps generalization to unseen scenes and novel object categories.
77
+
78
+ # 4.1 KNOWLEDGE GRAPH CONSTRUCTION
79
+
80
+ Our knowledge graph for visual navigation provides two main advantages: (1) It encodes spatial relationships between different object categories. (2) It provides the spatial and visual relationships between the known objects and novel categories in cases that we have not seen any visual examples of the novel categories.
81
+
82
+ We denote our knowledge graph by $G = ( V , E )$ , where $V$ and $E$ denote the nodes and the edges between nodes, respectively. Specifically, each node $v \in V$ denotes an object category, and each edge $e \in E$ denotes a relationship between a pair of object categories.
83
+
84
+ We use the Visual Genome (Krishna et al., 2017) dataset as a source to build the knowledge graph. Visual Genome consists of over 100K natural images. Each image is annotated with objects, attributes and the relationships between objects. Since there is no predefined object category list, the annotators are free to label any objects in the image, which results in very diverse object categories.
85
+
86
+ In our experiments, we build the knowledge graph by including all object categories that appear in the AI2-THOR environment. Each object category is represented as a node in the graph. We count the occurrence of object-to-object relationships in the Visual Genome dataset. Two nodes are connected with an edge only when the occurrence frequency of any relationship is more than three. Some examples of the mined relationships are shown in Figure 3.
87
+
88
+ # 4.2 INCORPORATING SEMANTIC KNOWLEDGE INTO ACTOR-CRITIC MODEL
89
+
90
+ The baseline policy model decides the action using the current state and target object features. However, we want the policy network to incorporate semantic knowledge of the world when planning the actions. How do we represent the semantic knowledge? More importantly, how do we extract semantic knowledge in the context of the current environment and state?
91
+
92
+ Our core idea is that the graph structure represents how the information propagates between different nodes. We initialize each node based on the current state (input scene image) and then perform information propagation to compute a semantic knowledge vector that is passed as another feature vector to the policy function. For information propagation, we use the recently proposed Graph Convolutional Network (GCN) (Kipf & Welling, 2017).
93
+
94
+ ![](images/1f2532148928edef404e9384660793c46dea3f02fd7532fb00f266aab3ee305f.jpg)
95
+ Figure 4: Graph Convolutional Networks. Each node denotes an object category and is initialized based on the the current state (image) and the word vector. We use three layers of GCN to perform information propagation. The first two layers output 1024-d latent features, and the last layer generates a single value for each node, which results in a $| V |$ dimensional semantic knowledge vector that is passed to the policy model.
96
+
97
+ # 4.2.1 GRAPH CONVOLUTIONAL NETWORK (GCN)
98
+
99
+ The GCNs are the extension of the Convolution Neural Networks to graph structures, where the goal is to learn a function representation for a given graph $G = ( V , E )$ . The input to each node $v$ is a feature vector $x _ { v }$ . We summarize the inputs of all nodes as a matrix $X = [ x _ { 1 } , \cdot \cdot \cdot , x _ { | V | } ] \in R ^ { | V | \times D }$ , where $D$ denotes the dimension of the input feature. The graph structure is represented as a binary adjacency matrix $A$ . We perform normalization on $A$ following (Kipf & Welling, 2017) and obtain $\widehat { A }$ . The GCN outputs a node-level representation $Z = [ z _ { 1 } , \cdots , z _ { | V | } ] \in R ^ { | V | \times F } ,$ . Let $f ( \cdot )$ denote the ReLU activation function, we have
100
+
101
+ $$
102
+ H ^ { ( l + 1 ) } = f ( \widehat { A } H ^ { ( l ) } W ^ { ( l ) } )
103
+ $$
104
+
105
+ with $H ^ { ( 0 ) } = X$ and $H ^ { ( L ) } = Z$ , where $W ^ { ( l ) }$ is the parameter for the $l$ -th layer and $L$ is the number of GCN layers.
106
+
107
+ # 4.2.2 GCN FOR NAVIGATION
108
+
109
+ In our visual semantic navigation task, the input of each node is designed as a joint representation of both the semantic cues (e.g., the word embedding) and the visual cues (e.g., the image classification score depending on the current state $s _ { t }$ ). Specifically, the word embedding is generated by fastText (Joulin et al., 2016) and the classification score is generated by a ResNet-50 (He et al., 2016) pretrained on the 1000-class ImageNet dataset. Note that the classification score is obtained based on the frame of the current state and we have different word embeddings for different graph nodes. These two representations are first mapped to 512-d features by two different fully connected layers respectively. We then concatenate these two features and form a 1024-d joint representation for each graph node.
110
+
111
+ As illustrated in Figure 4, we use three layers of GCN, the first two layers output 1024 dimensional latent features, the last layer outputs a single value for each node which results in a $| V |$ dimensional feature vector. This feature vector is basically an encoding of semantic prior in the context of the current scene and environment.
112
+
113
+ Finally, we map this feature vector into the 512-d feature embedding and concatenate it with the features generated from the visual and semantic branches (1024-d embedding), which results in a 1536-d feature vector. As illustrated in Figure 2, the joint feature is further fed into the policy network for policy prediction.
114
+
115
+ # 5 EXPERIMENTS
116
+
117
+ In this section, we provide the results of navigation using GCNs. We evaluate our model in scenarios where the scenes are unseen and/or the target objects are novel to the agent. We also provide ablation results that show the knowledge graph is useful.
118
+
119
+ # 5.1 EVALUATION FRAMEWORK
120
+
121
+ We evaluate our method in the interactive environments of AI2-THOR (Kolve et al., 2017). AI2- THOR provides 120 scenes covering four different room categories: kitchens, living rooms, bedrooms, and bathrooms. Each room category consists of 30 rooms with diverse appearance and configurations. We randomly split the scenes into three splits for each room category, i.e., 20 training rooms, 5 validation rooms, and 5 testing rooms.
122
+
123
+ <table><tr><td colspan="2"></td><td>Kitchen</td><td>Living room</td><td>Bedroom</td><td>Bathroom</td><td>Avg.</td></tr><tr><td rowspan="3">Seen scenes, Known objects</td><td>Random</td><td>2.4/3.5</td><td>1.1/1.7</td><td>1.8/2.7</td><td>3.2/4.8</td><td>2.1/3.1</td></tr><tr><td>A3C</td><td>38.5 /51.0</td><td>9.7 /15.1</td><td>6.8 / 11.5</td><td>69.1/81.0</td><td>31.1/39.6</td></tr><tr><td>Ours</td><td>58.6 / 72.7</td><td>12.4 / 18.6</td><td>41.6 / 52.4</td><td>71.3 /83.0</td><td>46.0 / 56.7</td></tr><tr><td rowspan="3">Seen scenes, Novel objects</td><td>Random</td><td>0.9/1.3</td><td>0.8/1.2</td><td>2.3/3.4</td><td>1.4/2.1</td><td>1.4/2.0</td></tr><tr><td>A3C</td><td>2.1 /4.9</td><td>3.2 /4.8</td><td>0.5 / 1.7</td><td>17.1 / 28.5</td><td>5.7 /9.9</td></tr><tr><td>Ours</td><td>3.2 / 6.1</td><td>9.8 / 16.2</td><td>6.2 / 8.6</td><td>24.7 / 37.3</td><td>11.0 / 17.1</td></tr><tr><td rowspan="3">Unseen scenes, Known objects</td><td>Random</td><td>4.1/5.9</td><td>0.9/1.3</td><td>1.6/2.4</td><td>4.2/6.2</td><td>2.7/3.9</td></tr><tr><td>A3C</td><td>11.5 / 18.8</td><td>0.5 / 2.5</td><td>2.2/3.8</td><td>8.6/18.7</td><td>5.7 / 10.4</td></tr><tr><td>Ours</td><td>12.7 / 20.5</td><td>1.0 / 4.0</td><td>4.5 / 11.0</td><td>8.7 / 21.1</td><td>6.7 / 13.4</td></tr><tr><td>Unseen scenes,</td><td>Random</td><td>2.0/2.8</td><td>0.6/1.0</td><td>2.0/2.8</td><td>2.7/3.9</td><td>1.8 /2.6</td></tr><tr><td>Novel objects</td><td>A3C Ours</td><td>2.2 /7.5 3.3 / 12.7</td><td>2.5 /4.4 2.8 / 5.3</td><td>1.3 /4.4 2.0 / 6.3</td><td>3.4 /9.3 4.1 / 12.2</td><td>2.4 / 5.9 3.1/ 8.5</td></tr></table>
124
+
125
+ Table 1: Results using termination (stop) action. SPL / Success rate $( \% )$ is shown. We compare against a random baseline and A3C (Mnih et al., 2016).
126
+
127
+ There are 87 object categories within AI2-THOR that are common among the scenes. However, some of the objects are not visible without interaction. For example, spoons were not visible since they always appeared in closed drawers during random initialization of the scenes so we did not use spoon among our categories. Therefore, we have $| V | = 5 3$ categories based on their visibility at random initialization of the scenes. To test the generalization ability of our method on novel objects, we split the 53 object categories into known and novel sets. Only the known set of object categories are used in training. The full split of object categories is shown in Appendix A. We only use navigation commands of AI2-THOR for our experiments. These actions include: move forward, move back, rotate right, rotate left, and stop.
128
+
129
+ We evaluate the models based on two metrics: Success Rate and the Success weighted by Path Length (SPL) metric recently proposed by Anderson et al. (2018a). Success Rate is defined as the ratio of the number of times the agent successfully navigates to the target and the total number of episodes. $S P L$ is a better metric which is a function considering both Success Rate and the path length to reach the goal from the starting point. It is defined as $\begin{array} { r } { \frac { \bar { 1 } } { N } \sum _ { i = 1 } ^ { N } S _ { i } \frac { L _ { i } } { \operatorname* { m a x } \left( P _ { i } , L _ { i } \right) } } \end{array}$ , where $N$ is the number of episodes, $S _ { i }$ is a binary indicator of success in episode $i$ , $P _ { i }$ represents path length and $L _ { i }$ is the shortest path distance (provided by the environment for evaluation) in episode $i$ .
130
+
131
+ # 5.2 RESULTS
132
+
133
+ We train each of the models three times with different random initializations. We show the training curves in Appendix B, where we plot the curves with error bands representing the standard deviation. The curves show that our proposed model converges in fewer training episodes compared to baseline and achieves better Success Rate as well as $S P L$ , which shows the effectiveness of scene priors.
134
+
135
+ For evaluation, we run 250 episodes for each scene, where the initial location and orientation of the agent is randomized. The target object is randomly sampled for each episode. We select the models which perform best on the validation set for all methods and evaluate them on the test set.
136
+
137
+ We compare the performance of the following models: (1) Random walk, which is the simplest baseline for navigation. The agent randomly samples an action from the action space at each step. (2) A3C (Mnih et al., 2016), which refers to the baseline model presented in Section 3.2. It is a state-of-the-art deep reinforcement learning model. (3) Ours, which is our proposed model. Each node of the first layer of GCNs is fed by a joint representation of the word embedding and the image classification scores extracted by ResNet-50, which depends on the current observed image.
138
+
139
+ We analyze the generalization ability of our method for unseen scenes and novel objects. Specifically, there are three experimental settings: 1) test on seen scenes with novel object categories as the navigation target; 2) test on unseen scenes with known object categories; and 3) test on unseen scenes with novel object categories. Table 1 shows the results for these different settings. In addition to the above settings, we also provide the results for seen scenes and known objects in the first row of the table. Note that most previous work (e.g., Zhu et al. (2017)) assume the environment notifies the agent when it reaches the target, and the agent does not have any idea if it has reached the target or not. In contrast, we consider the stop action and expect the agent to issue this action when it reaches the target. As mentioned in Section 3.2, this makes the learning challenging. In Table 2, we report the results for the simpler case where we remove the “stop” action from the list of actions.
140
+
141
+ <table><tr><td colspan="2"></td><td>Kitchen</td><td>Living room</td><td>Bedroom</td><td>Bathroom</td><td>Avg.</td></tr><tr><td rowspan="2">Seen scenes,</td><td>Random</td><td>17.9/33.1</td><td>12.1/30.5</td><td>16.8 / 51.2</td><td>24.5 /34.6</td><td>17.8/37.3</td></tr><tr><td>A3C</td><td>79.9 / 86.7</td><td>38.8 /57.6</td><td>87.8 /89.5</td><td>93.7 /96.6</td><td>75.0 / 82.5</td></tr><tr><td>Known objects</td><td>Ours</td><td>83.5 / 88.2</td><td>46.4 /64.4</td><td>90.6 /92.7</td><td>93.6 /96.5</td><td>78.5 / 85.5</td></tr><tr><td rowspan="2"> Seen scenes,</td><td>Random</td><td>10.0/23.1</td><td>8.0/18.5</td><td>17.3/35.2</td><td>11.2/32.2</td><td>11.6/ 27.2</td></tr><tr><td>A3C</td><td>20.2 /38.8</td><td>24.2 /46.5</td><td>23.5 / 35.8</td><td>50.2 / 74.6</td><td>29.5 /48.9</td></tr><tr><td rowspan="2">Novel objects Unseen scenes,</td><td>Ours</td><td>22.9 / 53.6</td><td>39.5 / 66.5</td><td>26.1 / 38.9</td><td>50.5 / 78.6</td><td>34.7 / 59.4</td></tr><tr><td>Random</td><td>27.3/45.2</td><td>5.6/16.6</td><td>13.1/ 34.5</td><td>36.0/49.1</td><td>20.5/36.3</td></tr><tr><td rowspan="2">Known objects</td><td>A3C</td><td>39.5 / 56.2</td><td>12.0 / 31.8</td><td>22.5 /49.2</td><td>47.4 / 60.2</td><td>30.3 / 49.3</td></tr><tr><td>Ours</td><td>46.2 / 62.5</td><td>13.8 / 40.6</td><td>26.5 / 58.6</td><td>51.5 / 65.8</td><td>34.5 / 56.9</td></tr><tr><td rowspan="2">Unseen scenes,</td><td>Random</td><td>21.3/44.3</td><td>3.3/22.9</td><td>25.8/47.8</td><td>25.5/48.9</td><td>19.0/41.0</td></tr><tr><td>A3C</td><td>26.1 /56.3</td><td>9.4 / 25.1</td><td>28.2 /54.0</td><td>33.8 /90.7</td><td>24.4 / 56.5</td></tr><tr><td>Novel objects</td><td>Ours</td><td>38.5 / 62.5</td><td>13.7 / 40.3</td><td>30.1 / 63.1</td><td>39.2 / 93.6</td><td>30.4 / 64.9</td></tr></table>
142
+
143
+ Table 2: Results without termination (stop) action. SPL / Success rate $( \% )$ is shown. We compare against a random baseline and A3C. This scenario is simpler than the case shown in Table 1.
144
+
145
+ Our method that incorporates the knowledge graph outperforms the baselines in terms of both success rate and SPL. We observe a higher performance for the case that we do not use a stop action (Table 2), which is expected. The scenario in which both scenes and target objects are novel is quite challenging, and the performance degrades drastically for both A3C and our method. However, the performance is significantly better than random. The bathroom scenes are typically small so there is not much difference between the performance of our method and the baseline. Note that more than half of the object categories are not among ImageNet categories. Also, note that “Unseen scenes, Novel objects” is not necessarily the hardest case. For instance, in “Seen scenes, Novel objects”, the appearance of the object and the mapping between the name and the object appearance are still unknown. We also observe overfitting to known scenes and objects (refer to “Seen scenes, Known objects”). So the results of different cases are not directly comparable, and it depends on the structure of the scenes and the configuration of objects. We show some qualitative examples in Appendix D, and the implementation details are provided in Appendix C.
146
+
147
+ Generalization Across Scene Types. We evaluate generalization across scene types as well. The idea is that we train the model on one scene type and evaluate it on a different scene type. The result is close to random in the scenario with the termination action. This is expected since there are very few common objects among different scene categories. The result for the simpler case of without the termination action is shown in Table 3.
148
+
149
+ <table><tr><td rowspan=2 colspan=2></td><td rowspan=1 colspan=4>Test type</td></tr><tr><td rowspan=1 colspan=1>Kitchen</td><td rowspan=1 colspan=1>Living room</td><td rowspan=1 colspan=1>Bedroom</td><td rowspan=1 colspan=1>Bathroom</td></tr><tr><td rowspan=4 colspan=1>Traintype</td><td rowspan=1 colspan=1>Kitchen</td><td rowspan=1 colspan=1>38.5/62.5</td><td rowspan=1 colspan=1>4.5/8.1</td><td rowspan=1 colspan=1>28.2/52.4</td><td rowspan=1 colspan=1>31.7/66.7</td></tr><tr><td rowspan=1 colspan=1>Living room</td><td rowspan=1 colspan=1>22.6/ 52.1</td><td rowspan=1 colspan=1>13.7/40.3</td><td rowspan=1 colspan=1>27.0/48.0</td><td rowspan=1 colspan=1>26.9/60.1</td></tr><tr><td rowspan=1 colspan=1>Bedroom</td><td rowspan=1 colspan=1>29.5/58.4</td><td rowspan=1 colspan=1>10.4 /30.1</td><td rowspan=1 colspan=1>30.1/ 63.1</td><td rowspan=1 colspan=1>28.0 /55.1</td></tr><tr><td rowspan=1 colspan=1>Bathroom</td><td rowspan=1 colspan=1>35.4/71.9</td><td rowspan=1 colspan=1>5.9/17.9</td><td rowspan=1 colspan=1>24.1/35.8</td><td rowspan=1 colspan=1>39.2/93.6</td></tr></table>
150
+
151
+ Table 3: Results of generalization across scene types. SPL / Success rate $( \% )$ is shown.
152
+
153
+ Ablations on Knowledge Graph. We perform evaluations on how the performance is affected by changing the knowledge graph in our model. The experiment is performed with the kitchen scenes without the “stop” action. We first remove different fractions of object nodes or relations from the graph and re-train the models. As shown in Table 4, the SPL performance drops as more information is removed from the knowledge graph. We also train our model with a fully-connected graph which leads to the SPL of 32.5 and the model with a random graph leads to the SPL of $3 0 . 1 \pm 0 . 6$ (we repeated this experiment three times). The performance of these two cases is worse than the performance of the model with a proper knowledge graph (38.5).
154
+
155
+ Table 4: Results of removing objects and relations in the knowledge graph.
156
+
157
+ <table><tr><td rowspan=1 colspan=1>Drop %</td><td rowspan=1 colspan=1>0%</td><td rowspan=1 colspan=1>20%</td><td rowspan=1 colspan=1>40%</td><td rowspan=1 colspan=1>60%</td><td rowspan=1 colspan=1>80%</td></tr><tr><td rowspan=1 colspan=1>ObjectsRelations</td><td rowspan=1 colspan=1>38.538.5</td><td rowspan=1 colspan=1>34.836.7</td><td rowspan=1 colspan=1>33.735.0</td><td rowspan=1 colspan=1>33.534.2</td><td rowspan=1 colspan=1>31.131.5</td></tr></table>
158
+
159
+ We have tried using the edge types (“on”, “next to”, etc.), but the results is not better than the case that we ignore the edge types. That is probably due to the lack of training data for each type separately. We have also tried training only one model for all scene categories, but the performance is lower.
160
+
161
+ Computation Cost. It is worth mentioning that the GCN module in our model increases only 0.12 GFLOPs computation compared to the baseline $A 3 C$ $\sim 4$ GFLOPs), which is marginal.
162
+
163
+ # 6 CONCLUSIONS
164
+
165
+ We propose an approach to integrate semantic and functional priors with a deep reinforcement learning model for the task of navigation. We use Graph Convolutional Networks to encode the prior knowledge and to update the knowledge according to the observations from the current scene. Our experiments show that prior knowledge improves generalization to unseen scenes and targets.
166
+
167
+ The current formulation of the problem does not include a long-term memory so in the future we plan to integrate memory to learn more complex exploration strategies. Incorporating higher-order relationships between objects and scenes is another future direction that we consider.
168
+
169
+ Acknowledgements: This research is partly sponsored by Google Focused Award and the ARO under Grant Number W911NF-18-1-0019. Abhinav was supported in part by Okawa Foundation. The views and conclusions contained in this document are those of the authors and should not be interpreted as representing the official policies, either expressed or implied, of the ARO or the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints for Government purposes notwithstanding any copyright notation herein.
170
+
171
+ # REFERENCES
172
+
173
+ 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, Dandelion Mane, Rajat Monga, Sherry Moore, Derek Murray, Chris Olah, Mike Schuster, ´ Jonathon Shlens, Benoit Steiner, Ilya Sutskever, Kunal Talwar, Paul Tucker, Vincent Vanhoucke, Vijay Vasudevan, Fernanda Viegas, Oriol Vinyals, Pete Warden, Martin Wattenberg, Martin Wicke, Yuan Yu, ´ and Xiaoqiang Zheng. TensorFlow: Large-scale machine learning on heterogeneous systems, 2015. URL https://www.tensorflow.org/. Software available from tensorflow.org.
174
+ Peter Anderson, Angel X. Chang, Devendra Singh Chaplot, Alexey Dosovitskiy, Saurabh Gupta, Vladlen Koltun, Jana Kosecka, Jitendra Malik, Roozbeh Mottaghi, Manolis Savva, and Amir Roshan Zamir. On evaluation of embodied navigation agents. arXiv, 2018a.
175
+ Peter Anderson, Qi Wu, Damien Teney, Jake Bruce, Mark Johnson, Niko Sunderhauf, Ian Reid, Stephen Gould, ¨ and Anton van den Hengel. Vision-and-language navigation: Interpreting visually-grounded navigation instructions in real environments. In CVPR, 2018b.
176
+ Johann Borenstein and Yoram Koren. The vector field histogram and fast obstacle-avoidance for mobile robots. IEEE Trans. on Robotics and Automation, 1991.
177
+ Samarth Brahmbhatt and James Hays. Deepnav: Learning to navigate large cities. In CVPR, 2017.
178
+ Devendra Singh Chaplot, Kanthashree Mysore Sathyendra, Rama Kumar Pasumarthi, Dheeraj Rajagopal, and Ruslan Salakhutdinov. Gated-attention architectures for task-oriented language grounding. In AAAI, 2018.
179
+ Chenyi Chen, Ary Seff, Alain L. Kornhauser, and Jianxiong Xiao. Deepdriving: Learning affordance for direct perception in autonomous driving. In ICCV, 2015.
180
+ Chaitanya Desai, Deva Ramanan, and Charless. Fowlkes. Discriminative models for multi-class object layout. In ICCV, 2009.
181
+ Santosh Kumar Divvala, Derek Hoiem, James Hays, Alexei A. Efros, and Martial Hebert. An empirical study of context in object detection. In CVPR, 2009.
182
+ Hans Jacob S. Feder, John J. Leonard, and Christopher M. Smith. Adaptive mobile robot navigation and mapping. Intl. J. of Robotics Research, 1999.
183
+ Saurabh Gupta, James Davidson, Sergey Levine, Rahul Sukthankar, and Jitendra Malik. Cognitive mapping and planning for visual navigation. In CVPR, 2017.
184
+ James Harrison, Animesh Garg, Boris Ivanovic, Yuke Zhu, Silvio Savarese, Li Fei-Fei, and Marco Pavone. AdaPT: Zero-shot adaptive policy transfer for stochastic dynamical systems. In ISRR, 2017.
185
+
186
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016.
187
+
188
+ 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, 2017.
189
+
190
+ Irina Higgins, Arka Pal, Andrei Rusu, Loic Matthey, Christopher Burgess, Alexander Pritzel, Matthew Botvinick, Charles Blundell, and Alexander Lerchner. Darla: Improving zero-shot transfer in reinforcement learning. In ICML, 2017.
191
+
192
+ Derek Hoiem, Alexei A. Efros, and Martial Hebert. Geometric context from a single image. In ICCV, 2005.
193
+
194
+ Ronghang Hu, Marcus Rohrbach, Jacob Andreas, Trevor Darrell, and Kate Saenko. Modeling relationships in referential expressions with compositional modular networks. In CVPR, 2017.
195
+
196
+ Justin Johnson, Ranjay Krishna, Michael Stark, Jia Li, Michael Bernstein, and Li Fei-Fei. Image retrieval using scene graphs. In CVPR, 2015.
197
+
198
+ Justin Johnson, Bharath Hariharan, Laurens van der Maaten, Li Fei-Fei, C Lawrence Zitnick, and Ross Girshick. CLEVR: A diagnostic dataset for compositional language and elementary visual reasoning. In CVPR, 2017.
199
+
200
+ Eagle S. Jones and Stefano Soatto. Visual-inertial navigation, mapping and localization: A scalable real-time causal approach. Intl. J. of Robotics Research, 2011.
201
+
202
+ Armand Joulin, Edouard Grave, Piotr Bojanowski, and Tomas Mikolov. Bag of tricks for efficient text classification. arXiv, 2016.
203
+
204
+ Gregory Kahn, Adam Villaflor, Bosen Ding, Pieter Abbeel, and Sergey Levine. Self-supervised deep reinforcement learning with generalized computation graphs for robot navigation. In ICRA, 2018.
205
+
206
+ Dongsung Kim and Ramakant Nevatia. Symbolic navigation with a generic map. Autonomous Robots, 1999.
207
+
208
+ Thomas N. Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. In ICLR, 2017.
209
+
210
+ Eric Kolve, Roozbeh Mottaghi, Daniel Gordon, Yuke Zhu, Abhinav Gupta, and Ali Farhadi. AI2-THOR: An Interactive 3D Environment for Visual AI. arXiv, 2017.
211
+
212
+ Ranjay Krishna, Yuke Zhu, Oliver Groth, Justin Johnson, Kenji Hata, Joshua Kravitz, Stephanie Chen, Yannis Kalantidis, Li-Jia Li, David A Shamma, et al. Visual genome: Connecting language and vision using crowdsourced dense image annotations. IJCV, 2017.
213
+
214
+ Ruiyu Li, Makarand Tapaswi, Renjie Liao, Jiaya Jia, Raquel Urtasun, and Sanja Fidler. Situation recognition with graph neural networks. In ICCV, 2017.
215
+
216
+ Tomasz Malisiewicz and Alexei A. Efros. Beyond categories: The visual memex model for reasoning about object relationships. In NIPS, 2009.
217
+
218
+ Kenneth Marino, Ruslan Salakhutdinov, and Abhinav Gupta. The more you know: Using knowledge graphs for image classification. In CVPR, 2017.
219
+
220
+ Marcin Marszalek, Ivan Laptev, and Cordelia Schmid. Actions in context. In CVPR, 2009.
221
+
222
+ Larry H. Matthies and Steven A. Shafer. Error modeling in stereo navigation. IEEE J. Robotics and Automation, 1987.
223
+
224
+ Hongyuan Mei, Mohit Bansal, and Matthew R. Walter. Listen, attend, and walk: Neural mapping of navigational instructions to action sequences. In AAAI, 2016.
225
+
226
+ Min Meng and Avinash C. Kak. Neuro-nav: A neural network based architecture for vision-guided mobile robot navigation using non-metrical models of the environment. In ICRA, 1993.
227
+
228
+ Piotr Mirowski, Razvan Pascanu, Fabio Viola, Hubert Soyer, Andrew J. Ballard, Andrea Banino, Misha Denil, Ross Goroshin, Laurent Sifre, Koray Kavukcuoglu, Dharshan Kumaran, and Raia Hadsell. Learning to navigate in complex environments. In ICLR, 2017.
229
+
230
+ Dipendra Kumar Misra, John Langford, and Yoav Artzi. Mapping instructions and visual observations to actions with reinforcement learning. In EMNLP, 2017.
231
+
232
+ 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 ICML, 2016.
233
+
234
+ Roozbeh Mottaghi, Xianjie Chen, Xiaobai Liu, Nam-Gyu Cho, Seong-Whan Lee, Sanja Fidler, Raquel Urtasun, and Alan Yuille. The role of context for object detection and semantic segmentation in the wild. In CVPR, 2014.
235
+
236
+ Arsalan Mousavian, Alexander Toshev, Marek Fiser, Jana Kosecka, and James Davidson. Visual representations for semantic target driven navigation. In ECCV Workshop on Visual Learning and Embodied Agents in Simulation Environments, 2018.
237
+
238
+ Varun K. Nagaraja, Vlad I. Morariu, and Larry S. Davis. Modeling context between objects for referring expression understanding. In ECCV, 2016.
239
+
240
+ Junhyuk Oh, Satinder Singh, Honglak Lee, and Pushmeet Kohli. Zero-shot task generalization with multi-task deep reinforcement learning. In ICML, 2017.
241
+
242
+ Deepak Pathak, Parsa Mahmoudieh, Guanghao Luo, Pulkit Agrawal, Dian Chen, Fred Shentu, Evan Shelhamer, Jitendra Malik, Alexei A. Efros, and Trevor Darrell. Zero-shot visual imitation. In ICLR, 2018.
243
+
244
+ Andrew Rabinovich, Andrea Vedaldi, Carolina Galleguillos, Eric Wiewiora, and Serge Belongie. Objects in context. In ICCV, 2005.
245
+
246
+ Fereshteh Sadeghi and Sergey Levine. CAD2RL: real single-image flight without a single real image. In RSS, 2017.
247
+
248
+ Nikolay Savinov, Alexey Dosovitskiy, and Vladlen Koltun. Semi-parametric topological memory for navigation. In ICLR, 2018.
249
+
250
+ Abhinav Shrivastava and Abhinav Gupta. Contextual priming and feedback for faster r-cnn. In ECCV, 2016.
251
+
252
+ Christian Siagian, Chin-Kai Chang, and Laurent Itti. Autonomous mobile robot localization and navigation using a hierarchical map representation primarily guided by vision. J. Field Robotics, 2014.
253
+
254
+ Sebastian Thrun. Learning metric-topological maps for indoor mobile robot navigation. Artificial Intelligence, 1998.
255
+
256
+ Tijmen Tieleman and Geoffrey Hinton. RMSprop gradient optimization. URL http://www.cs.toronto. edu/˜tijmen/csc321/slides/lecture_slides_lec6.pdf.
257
+
258
+ Antonio Torralba, Kevin P. Murphy, William T. Freeman, and Mark A. Rubin. Context-based vision system for place and object recognition. In CVPR, 2003.
259
+
260
+ Xiaolong Wang, Yufei Ye, and Abhinav Gupta. Zero-shot recognition via semantic embeddings and knowledge graphs. In CVPR, 2018.
261
+
262
+ Yuxin Wu and Yuandong Tian. Training agent for first-person shooter game with actor-critic curriculum learning. In ICLR, 2017.
263
+
264
+ Haonan Yu, Haichao Zhang, and Wei Xu. Interactive grounded language acquisition and generalization in a 2d world. In ICLR, 2018.
265
+
266
+ Hanwang Zhang, Zawlin Kyaw, Shih-Fu Chang, and Tat-Seng Chua. Visual translation embedding network for visual relation detection. In CVPR, 2017.
267
+
268
+ Yuke Zhu, Roozbeh Mottaghi, Eric Kolve, Joseph J Lim, Abhinav Gupta, Li Fei-Fei, and Ali Farhadi. Targetdriven visual navigation in indoor scenes using deep reinforcement learning. In ICRA, 2017.
269
+
270
+ Yukun Zhu, Raquel Urtasun, Ruslan Salakhutdinov, and Sanja Fidler. segdeepm: Exploiting segmentation and context in deep neural networks for object detection. In CVPR, 2015.
271
+
272
+ # APPENDIX A NAVIGATION TARGETS
273
+
274
+ In Table 5, we show the object categories that are used as our navigation targets. The split of train and test categories is provided as well.
275
+
276
+ <table><tr><td rowspan=1 colspan=1>Room type</td><td rowspan=1 colspan=1>Train objects</td><td rowspan=1 colspan=1>Test objects</td></tr><tr><td rowspan=1 colspan=1>Kitchen</td><td rowspan=1 colspan=1>HousePlant, StoveKnob,Sink, TableTop,Potato,Bread,Tomato,Knife,Cabinet, Fridge, Container, ButterKnife,Lettuce,Pan, Bowl, CoffeeMachine, StoveBurner,Plate</td><td rowspan=1 colspan=1>Mug,Apple,Microwave,Toaster</td></tr><tr><td rowspan=1 colspan=1>Living room</td><td rowspan=1 colspan=1>Television,HousePlant,Chair,TableTop,Box,Cloth,Newspaper, KeyChain,WateringCan,PaintingHanger</td><td rowspan=1 colspan=1>Painting,Statue</td></tr><tr><td rowspan=1 colspan=1>Bedroom</td><td rowspan=1 colspan=1>Painting,HousePlant, CellPhone,LightSwitch, Candle,TableTop,Bed, Lamp, Statue,Book, CreditCard,Key-Chain, Bowl, Pen,Box, Pencil,Blinds,Laptop,Alarm-Clock</td><td rowspan=1 colspan=1>Television,Mirror, Cabi-net</td></tr><tr><td rowspan=1 colspan=1>Bathroom</td><td rowspan=1 colspan=1>SprayBottle,Painting, Candle, LightSwitch, Sink, Cab-inet,TowelHolder,Watch,ToiletPaper,ShowerDoor,SoapBottle</td><td rowspan=1 colspan=1>SoapBar,Towel</td></tr></table>
277
+
278
+ Table 5: Training and testing split of object categories for each scene type in the AI2-THOR.
279
+
280
+ # APPENDIX B TRAINING CURVES
281
+
282
+ We show the training curves in Figure 5. We compare our method with the baseline A3C. All the models are trained 3 times with different initializations. We compute the model performance with Success Rate and $S P L$ every 10 million iterations during training. We use the error band to represent the standard deviation. The curves show our model converges faster than the A3C baseline and obtain better performance in both metrics, which indicates the effectiveness of the scene priors.
283
+
284
+ ![](images/ab74b398c9a6c3af39d24431a836b6ee4e63a3a6235965d4c9b29043e53a006f.jpg)
285
+ Figure 5: Learning curves. The top row shows success rate and the bottom row shows SPL.
286
+
287
+ # APPENDIX C IMPLEMENTATION DETAILS
288
+
289
+ Our method is implemented in Tensorflow (Abadi et al., 2015) and the actor-critic policy network is trained with a single NVIDIA GeForce GTX Titan X GPU with 20 threads for 10 million frames for experiments without stop action, and for 25 million frames for experiments with stop action. The initial learning rate is set empirically as $7 e \mathrm { ~ - ~ } 4$ , and is decreased linearly as the training progresses. The network parameters are optimized by the RMSProp optimizer (Tieleman & Hinton). The maximum number of steps is set to 100 for kitchen, bedroom and bathroom, and to 200 for living room due to the larger exploration space. Since there is almost no overlap between object categories within different room types, we train separate models for each room type.
290
+
291
+ # APPENDIX D QUALITATIVE RESULTS
292
+
293
+ ![](images/a655395377b04900bdf2b9f6bd673d9880454c4785fc532037d286c108141623.jpg)
294
+ Figure 6: Qualitative results. Examples of last eight frames and the corresponding actions $a _ { t }$ predicted from our model on unseen scenes with novel target objects.
md/train/HJxiMAVtPH/HJxiMAVtPH.md ADDED
@@ -0,0 +1,444 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MULTI-SCALE ATTRIBUTED NODE EMBEDDING
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ We present network embedding algorithms that capture information about a node from the local distribution over node attributes around it, as observed over random walks following an approach similar to Skip-gram. Observations from neighborhoods of different sizes are either pooled (AE) or encoded distinctly in a multiscale approach (MUSAE). Capturing attribute-neighborhood relationships over multiple scales is useful for a diverse range of applications, including latent feature identification across disconnected networks with similar attributes. We prove theoretically that matrices of node-feature pointwise mutual information are implicitly factorized by the embeddings. Experiments show that our algorithms are robust, computationally efficient and outperform comparable models on social, web and citation network datasets.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Node embedding is a fundamental technique in network analysis that serves as a precursor to numerous downstream machine learning and optimisation tasks, e.g. community detection, network visualization and link prediction (Perozzi et al., 2014; Grover & Leskovec, 2016; Tang et al., 2015). Several recent network embedding methods, such as Deepwalk (Perozzi et al., 2014), Node2Vec (Grover & Leskovec, 2016) and Walklets (Perozzi et al., 2017), achieve impressive performance by learning the network structure following an approach similar to Word2Vec Skip-gram (Mikolov et al., 2013b), originally designed for word embedding. In these works, sequences of neighboring nodes are generated from random walks over a network, and representations are distilled from extracted node-node proximity statistics that capture local neighbourhood information.
12
+
13
+ When the nodes of a network have attributes (or features), their embeddings can be used to capture information about the attributes in their local neighbourhood. For a social network, attributes might represent a person’s interests, habits, history or preferences. The pattern of node attributes are often similar in a neighborhood, and conversely, nodes with similar attributes are more likely to be connected. This property is known as homophily. Attributed network embedding methods (Yang et al., 2015; Huang et al., 2017; Liao et al., 2018) leverage this additional information to supplement that of node neighbourhood structure, benefiting many applications, e.g. recommender systems, node classification and link prediction (Yang et al., 2018; Yang & Yang, 2018; Zhang et al., 2018).
14
+
15
+ The neighborhood of a node can be considered at different path lengths, or scales. In a social network, near neighbors may correspond to classmates, whereas nodes separated by greater scales may be in different cities or countries. Attributes of neighbors at different scales can be considered separately (multi-scale) or pooled in some way (e.g. weighted average). Figure 1a shows how the attribute distribution over neighbourhoods at different scales can indicate nodes with similar network roles even if they are distant in the network, or even in different networks. Methods that take attributes of nearby nodes into account generalizes those that do not, e.g. Perozzi et al. (2017), for which feature vectors can be considered standard basis vectors.
16
+
17
+ Many embedding methods correspond to matrix factorization, indeed some attributed embedding methods (e.g. Yang et al. (2018)) explicitly factorize a matrix of link-attribute information. Embeddings learned using Skip-gram are known to factorize a matrix of pointwise mutual information (PMI) of co-occurrences between each word and local context words (Levy & Goldberg, 2014). Related network embedding methods (Perozzi et al., 2014; Grover & Leskovec, 2016; Tang et al., 2015; Qiu et al., 2018) also implicitly factorize PMI matrices based on the probability of encountering each (context) node on a random walk from each starting node (Qiu et al., 2018).
18
+
19
+ ![](images/48677a020d8f7cb70bf5353f945499885191d8b9c0c0039f39c2f3eafaf1fb50.jpg)
20
+ Figure 1: Phenomena affecting and inspiring the design of the multi-scale attributed network embedding procedure. In Figure 1a attributed nodes D and G have the same feature set and their nearest neighbours also exhibit equivalent sets of features, whereas features at higher order neighbourhoods differ. Figure 1b shows that as the order of neighbourhoods considered $( r )$ increases, the product of the adjacency matrix power and the feature matrix becomes less sparse. This suggests that an implicit decomposition method would be computationally beneficial.
21
+
22
+ Our key contributions are:
23
+
24
+ 1. to introduce the first Skip-gram style embedding algorithms that consider attribute distributions over local neighborhoods, both pooled $( A E )$ and multi-scale (MUSAE), and their counterparts that attribute distinct features to each node (AE-EGO and MUSAE-EGO);
25
+ 2. to theoretically prove that their embeddings approximately factorize PMI matrices based on the product of an adjacency matrix power and node-feature matrix;
26
+ 3. to show that popular network embedding methods DeepWalk (Perozzi et al., 2014) and Walklets (Perozzi et al., 2017) are special cases of our $A E$ and MUSAE;
27
+ 4. we show empirically that $A E$ and MUSAE embeddings enable strong performance at regression, classification, and link prediction tasks for real-world networks (e.g. Wikipedia and Facebook), are computationally scalable and enable transfer learning between networks.
28
+
29
+ We provide reference implementations of $A E$ and MUSAE, together with the datasets used for evaluation at https://github.com/iclr2020/MUSAE.
30
+
31
+ # 2 RELATED WORK
32
+
33
+ Efficient unsupervised learning of node embeddings for large networks has seen unprecedented development in recent years. The current paradigm focuses on learning latent space representations of nodes such that those that share neighbors (Perozzi et al., 2014; Tang et al., 2015; Grover & Leskovec, 2016; Perozzi et al., 2017), structural roles (Ribeiro et al., 2017; Ahmed et al., 2018) or attributes are located close together in the embedding space. Our work falls under the last of these categories as our goal is to learn similar latent representations for nodes with similar sets of features in their neighborhoods, both on a pooled and multi-scale basis.
34
+
35
+ Neighborhood preserving node embedding procedures place nodes with common first, second and higher order neighbors within close proximity in the embedding space. Recent works in the neighborhood preserving node embedding literature were inspired by the Skip-gram model (Mikolov et al., 2013a;b), which generates word embeddings by implicitly factorizing a shifted pointwise mutual information (PMI) matrix (Levy & Goldberg, 2014) obtained from a text corpus. This procedure inspired DeepWalk (Perozzi et al., 2014), a method which generates truncated random walks over a graph to obtain a “corpus” from which the Skip-gram model generates neighborhood preserving node embeddings. In doing so, DeepWalk implicitly factorizes a PMI matrix, which can be shown, based on the underlying first-order Markov process, to correspond to the mean of a set of normalized adjacency matrix powers up to a given order (Qiu et al., 2018). Such pooling of matrices can be suboptimal since neighbors over increasing path lengths (or scales) are treated equally or according to fixed weightings (Mikolov et al., 2013a; Grover & Leskovec, 2016); whereas it has been found that an optimal weighting may be task or dataset specific (Abu-El-Haija et al., 2018). In contrast, multi-scale node embedding methods such as LINE (Tang et al., 2015), GraRep (Cao et al., 2015) and Walklets (Perozzi et al., 2017) separately learn lower-dimensional node embedding components from each adjacency matrix power and concatenate them to form the full node representation. Such un-pooled representations, comprising distinct but less information at each scale, are found to give higher performance in a number of downstream settings, without increasing the overall number of free parameters (Perozzi et al., 2017).
36
+
37
+ Attributed node embedding procedures refine ideas from neighborhood based node embeddings to also incorporate node attributes (equivalently, features or labels) (Yang et al., 2015; Liao et al., 2018; Huang et al., 2017; Yang et al., 2018; Yang & Yang, 2018). Similarities between both a node’s neighborhood structure and features contribute to determining pairwise proximity in the node embedding space. These models follow quite different strategies to obtain such representations. The most elemental procedure, TADW (Yang et al., 2015), decomposes a convex combination of normalized adjacency matrix powers into a matrix product that includes the feature matrix. Several other models, such as SINE (Zhang et al., 2018) and ASNE (Liao et al., 2018), implicitly factorize a matrix formed by concatenating the feature and adjacency matrices. Other approaches such as TENE (Yang & Yang, 2018), formulate the attributed node embedding task as a joint non-negative matrix factorization problem in which node representations obtained from sub-tasks are used to regularize one another. AANE (Huang et al., 2017) uses a similar network structure based regularization approach, in which a node feature similarity matrix is decomposed using the alternating direction method of multipliers. The method most similar to our own is BANE (Yang et al., 2018), in which the product of a normalized adjacency matrix power and a feature matrix is explicitly factorized to obtain attributed node embeddings. Many other methods exist, but do not consider the attributes of higher order neighborhoods (Yang et al., 2015; Liao et al., 2018; Huang et al., 2017; Zhang et al., 2018; Yang & Yang, 2018).
38
+
39
+ The relationship between our pooled $( A E )$ and multi-scale (MUSAE) attributed node embedding methods mirrors that between graph convolutional neural networks (GCNNs) and multi-scale GCNNs. Widely used graph convolutional layers, such as GCN (Kipf & Welling, 2017), GraphSage (Hamilton et al., 2017), GAT (Velickovi ˇ c et al., 2018), ´ APPNP (Klicpera et al., 2019), SGCONV (Wu et al., 2019) and ClusterGCN (Chiang et al., 2019), create latent node representations that pool node attributes from arbitrary order neighborhoods, which are then inseparable and unrecoverable. In contrast, MixHop (Abu-El-Haija et al., 2019) learns latent features for each proximity.
40
+
41
+ # 3 ATTRIBUTED EMBEDDING MODELS
42
+
43
+ We now define algorithms to learn node embeddings using the attributes of nearby nodes, that allows both node and attribute embeddings to be learned jointly. The aim is to learn similar embeddings for nodes that occur in neighbourhoods of similar attributes; and similar embeddings for attributes that often occur in similar neighbourhoods of nodes. Let $\mathcal { G } = ( \mathbb { V } , \mathbb { L } )$ be an undirected graph of interest where $\mathbb { V }$ and $\mathbb { L }$ are the sets of vertices and edges (or links) respectively; and let $\mathbb { F }$ be the set of all possible node features (i.e. attributes). We define $\mathbb { F } _ { v } \subseteq \mathbb { F }$ as the subset of features belonging to each node $v \in \mathbb { V }$ . An embedding of nodes is a mapping $g : \mathbb { V } \to \mathbb { R } ^ { d }$ that assigns a $d$ -dimensional representation g(v) (or simply gv) to each node v and is fully described by a matrix G ∈ R|V|×d. Similarly, an embedding of the features (to the same latent space) is a mapping $h : \mathbb { F } \mathbb { R } ^ { d }$ with embeddings denoted $h ( f )$ (or simply $h _ { f }$ ), and is fully described by a matrix $H \in \mathbb { R } ^ { | \mathbb { F } | \times d }$ .
44
+
45
+ # 3.1 ATTRIBUTED EMBEDDING
46
+
47
+ The Attributed Embedding $( A E )$ procedure is described by Algorithm 1. We sample $n$ nodes $w _ { 1 }$ , from which to start attributed random walks on $\mathcal { G }$ , with probability proportional to their degree (Line 2). From each starting node, a node sequence of length $l$ is sampled over $\mathcal { G }$ (Line 3), where sampling follows a first order random walk. For a given window size $t$ , we iterate over each of the first $l - t$ nodes of the sequence termed source nodes $w _ { j }$ (Line 4). For each source node, we consider the following $t$ nodes as target nodes (Line 5). For each target node $w _ { j + r }$ , we add the tuple $( w _ { j } , f )$ to the corpus $\mathbb { D }$ for each target feature $f \in \mathbb { F } _ { w _ { j + r } }$ (Lines 6 and 7). We also consider features of the source node $f \in \mathbb { F } _ { w _ { j } }$ , adding each $( w _ { j + r } , f )$ tuple to $\mathbb { D }$ (Lines 9 and 10). Running Skip-gram on $\mathbb { D }$ with $b$ negative samples (Line 15) generates the $d$ -dimensional node and feature embeddings.
48
+
49
+ ![](images/5f32723907d908ceddcb50e661263027238853f60ac19b086cf962287d09c203.jpg)
50
+
51
+ Algorithm 1: AE sampling and training procedure
52
+
53
+ ![](images/2219f4c86a904424a36bcee79fa0eb65a9bce83b09386146883a812a80917658.jpg)
54
+ Algorithm 2: MUSAE sampling and training procedure
55
+
56
+ # 3.2 MULTI-SCALE ATTRIBUTED EMBEDDING
57
+
58
+ The $A E$ method (Algorithm 1) pools feature sets of neighborhoods at different proximities. Inspired by the performance of (unattributed) multi-scale node embeddings, we adapt the $A E$ algorithm to give multi-scale attributed node embeddings (MUSAE). The embedding component of a node $v \in \mathbb { V }$ for a specific proximity $r \in \{ 1 , . . . , t \}$ is given by a mapping $g ^ { r } : \mathbb { V } \overset { } { } \mathbb { R } ^ { d / t }$ (assuming $t$ divides $d )$ . Similarly, the embedding component of feature $f \in \mathbb { F }$ at proximity $r$ is given by a mapping $h ^ { r } : \mathbb { F } \mathbb { R } ^ { \dot { d } / t }$ . Concatenating gives a $d$ -dimensional embedding for each node and feature.
59
+
60
+ The Multi-Scale Attributed Embedding procedure is described by Algorithm 2. We again sample $n$ starting nodes $w _ { 1 }$ with a probability proportional to node degree (Line 2) and, for each, sample a node sequence of length $l$ over $\mathcal { G }$ (Line 3) according to either a first or second order random walk. For a given window size $t$ , we iterate over the first $l - t$ (source) nodes $w _ { j }$ of the sequence (Line 4) and for each source node we iterate through the $t$ (target) nodes $w _ { j + r }$ that follow (Line 5). We again consider each target node feature $f \in \mathbb { F } _ { w _ { j + r } }$ , but now add tuples $( w _ { j } , f )$ to a sub-corpus $\mathbb { D } _ { \stackrel { r } { \to } }$ (Lines 6 and 7). We add tuples $( w _ { j + r } , f )$ to another sub-corpus $\mathbb { D } _ { \mathcal { L } }$ for each source node feature $\dot { \boldsymbol { f } } \in \mathbb { F } _ { w _ { j } }$ (Lines 9 and 10). Running Skip-gram on each sub-corpus $\mathbb { D } _ { r } ^ { } = \mathbb { D } _ { \hat { \neq } } \cup \mathbb { D } _ { \hat { \varepsilon } }$ with $b$ negative samples (Line 16) output $t$ $\textstyle { \left( { \frac { d } { t } } \right) }$ -dimensional node and feature embeddings that are concatenated.
61
+
62
+ # 4 ATTRIBUTED EMBEDDING AS IMPLICIT MATRIX FACTORIZATION
63
+
64
+ Levy & Goldberg (2014) showed that the loss function of Skip-gram with negative sampling (SGNS) is minimized if the embedding matrices factorize a matrix of pointwise mutual information (PMI) of word co-occurrence statistics. Specifically, for a word dictionary $\mathbb { V }$ with $| \mathbb { V } | = n$ , SGNS (with $b$ negative samples) outputs two embedding matrices $W , C \in \mathbb { R } ^ { d \times n }$ such that $\forall w , c \in \mathbb { V }$ :
65
+
66
+ $$
67
+ \begin{array} { r } { \pmb { w } _ { w } ^ { \top } \pmb { c } _ { c } \approx \mathrm { l o g } \left( \frac { \# ( w , c ) | \mathbb { D } | } { \# ( w ) \# ( c ) } \right) - \mathrm { l o g } b , } \end{array}
68
+ $$
69
+
70
+ where $\# ( w , c ) , \# ( w ) , \# ( c )$ denote counts of word-context pair $( w , c )$ , $w$ and $c$ over a corpus $\mathbb { D }$ ; and word embeddings ${ \pmb w } _ { \pmb w }$ , $\pmb { c } _ { c } \in \mathbb { R } ^ { d }$ are columns of $W$ and $C$ corresponding to $w$ and $c$ respectively. Considering $\frac { \# ( w ) } { | { \mathbb D } | }$ , $\frac { \# ( c ) } { | { \mathbb D } | }$ , $\scriptstyle { \frac { \# ( w , c ) } { | \mathbb { D } | } }$ as empirical estimates of $p ( w )$ , $p ( c )$ and $p ( w , c )$ respectively shows:
71
+
72
+ $$
73
+ \mathbf { } W ^ { \top } C \approx [ \operatorname { P M I } ( w , c ) - \log b ] _ { w , c \in \mathbb { V } } \ ,
74
+ $$
75
+
76
+ i.e. an approximate low-rank factorization of a shifted PMI matrix (low rank since typically $d \ll n$ ).
77
+
78
+ Qiu et al. (2018) extended this result to node embedding models that apply SGNS to a “corpus” generated from random walks over the graph. In the case of DeepWalk where random walks are first-order Markov, the joint probability distributions over nodes at different stages of a random walk can be expressed in closed form. A closed form then follows for the factorized PMI matrix. We show that $A E$ and MUSAE implicitly perform analogous matrix factorizations.
79
+
80
+ Notation: $A \in \mathbb { R } ^ { n \times n }$ denotes the adjacency matrix and $D \in \mathbb { R } ^ { n \times n }$ the diagonal degree matrix of a graph $\mathcal { G }$ , i.e. $\begin{array} { r } { D _ { w , w } = \deg ( w ) = \sum _ { v } A _ { w , v } } \end{array}$ . We denote the volume of $\mathcal { G }$ by $\begin{array} { r } { c = \sum _ { v , w } A _ { v , w } } \end{array}$ . We define the binary attribute matrix $\pmb { F } \in \{ 0 , 1 \} ^ { | \mathbb { V } | \times | \mathbb { F } | }$ by $\pmb { F } _ { w , f } = \mathbf { 1 } _ { f \in \mathbb { F } _ { w } }$ , $\forall w \in \mathbb { V } , f \in \mathbb { F }$ . For ease of notation, we let $P { = } D ^ { - 1 } A$ and $\scriptstyle E = d i a g ( \mathbf { 1 } ^ { \top } D F )$ , where diag indicates a diagonal matrix.
81
+
82
+ Interpretation: Assuming $\mathcal { G }$ is ergodic: $\begin{array} { r } { p ( w ) = \frac { d e g ( w ) } { c } , w \in \mathbb { V } } \end{array}$ is the stationary distribution over nodes, i.e. $c ^ { - 1 } D = d i a g ( p ( w ) )$ ; and $c ^ { - 1 } { \cal A }$ is the stationary joint distribution over consecutive nodes $p ( w _ { j } , w _ { j + 1 } )$ . $F _ { w , f }$ can be considered a Bernoulli parameter describing the probability $p ( f | w )$ of observing a feature $f$ at a node $w$ and so $c ^ { - 1 } D F$ describes the stationary joint distribution $p ( f , w _ { j } )$ over nodes and features. Accordingly, $_ { P }$ is the matrix of conditional distributions $p ( w _ { j + 1 } | w _ { j } )$ ; and $\pmb { \cal E }$ is a diagonal matrix proportional to the probability of observing each feature at the stationary distribution $p ( f )$ (note that $p ( f )$ need not sum to 1, whereas $p ( w )$ necessarily must).
83
+
84
+ # 4.1 MULTI-SCALE CASE (MUSAE)
85
+
86
+ We know that the SGNS aspect of MUSAE (Algorithm 2, Line 17) is minimized when the learned embeddings grv , hrf satisfy grw>hrf ≈ log #(w,f )r|Dr|#(w)r#(f )r  − log b ∀w ∈ V, f ∈ F. Our aim is to express this factorization in terms of known properties of the graph $\mathcal { G }$ and its features.
87
+
88
+ Lemma 1. The empirical statistics of node-feature pairs obtained from random walks give unbiased estimates of joint probabilities of observing feature $f \in \mathbb { F } r$ steps $( i )$ after; or $( i i )$ before node $v \in \mathbb { V }$ , as given by:
89
+
90
+ $$
91
+ p l i m \frac { \# ( w , f ) _ { \vec { r } } } { | \mathbb { D } _ { \vec { r } } | } = c ^ { - 1 } ( D P ^ { r } F ) _ { w , f } \qquad \underbrace { p l i m \frac { \# ( w , f ) _ { \vec { r } } } { | \mathbb { D } _ { \vec { r } } | } } _ { l \to \infty } = c ^ { - 1 } ( F ^ { \top } D P ^ { r } ) _ { f , w }
92
+ $$
93
+
94
+ Proof. See Appendix.
95
+
96
+ Lemma 2. Empirical statistics of node-feature pairs obtained from random walks give unbiased estimates of joint probabilities of observing feature $f \in \mathbb { F } r$ steps either side of node $v \in \mathbb { V } ,$ , given by:
97
+
98
+ $$
99
+ \begin{array} { r l } & { p l i m \frac { \# ( w , f ) _ { r } } { | \mathbb { D } _ { r } | } = c ^ { - 1 } ( D P ^ { r } F ) _ { w , f } \ , } \\ & { l \infty } \end{array}
100
+ $$
101
+
102
+ Proof. See Appendix.
103
+
104
+ Marginalizing gives unbiased estimates of stationary probability distributions of nodes and features:
105
+
106
+ $$
107
+ \operatorname* { p l i m } _ { l \to \infty } \frac { \# ( w ) } { | \mathbb { D } _ { r } | } = \frac { d e g ( w ) } { c } = c ^ { - 1 } D _ { w , w } \qquad \mathrm { a n d } \qquad \operatorname* { p l i m } _ { l \to \infty } \frac { \# ( f ) } { | \mathbb { D } _ { r } | } = \sum _ { w | f \in \mathbb { R } _ { w } } \frac { d e g ( w ) } { c } = c ^ { - 1 } E _ { f , f }
108
+ $$
109
+
110
+ Theorem 1. MUSAE embeddings approximately factorize the node-feature PMI matrix:
111
+
112
+ $$
113
+ \begin{array} { r } { l o g \left( c P ^ { r } F E ^ { - 1 } \right) - \log b , \quad f o r r = 1 , \ldots , t . } \end{array}
114
+ $$
115
+
116
+ Proof.
117
+
118
+ $$
119
+ \begin{array} { r l } & { \frac { \# ( w , f ) _ { r } | \mathbb { D } _ { r } | } { \# ( f ) _ { r } \# ( w ) _ { r } } = \big ( \frac { \# ( w , f ) _ { r } } { | \mathbb { D } _ { r } | } \big ) / \big ( \frac { \# ( f ) _ { r } } { | \mathbb { D } _ { r } | } \frac { \# ( w ) _ { r } } { | \mathbb { D } _ { r } | } \big ) } \\ & { \xrightarrow { p } \big ( ( c D ^ { - 1 } ) ( c ^ { - 1 } D P ^ { r } F ) ( c E ^ { - 1 } ) \big ) _ { w , f } } \\ & { = c ( P ^ { r } F E ^ { - 1 } ) _ { w , f } } \end{array}
120
+ $$
121
+
122
+ # 4.2 POOLED CASE (AE)
123
+
124
+ Lemma 3. The empirical statistics of node-feature pairs learned by the AE algorithm give unbiased estimates of mean joint probabilities over different path lengths as follows:
125
+
126
+ $$
127
+ \underset { l \infty } { \underbrace { p l i m } } \frac { \# ( w , f ) } { | \mathbb { D } | } = \frac { c } { t } \big ( D ( \sum _ { r = 1 } ^ { t } \pmb { P } ^ { r } ) \pmb { F } \big ) _ { w , f }
128
+ $$
129
+
130
+ Proof. By construction, $\begin{array} { r } { \left| \mathbb { D } \right| { = } \sum _ { r } \left| \mathbb { D } _ { r } \right| } \end{array}$ , #(w, f ) = Pr # $( w , f ) _ { r }$ , $| \mathbb { D } _ { r } | = | \mathbb { D } _ { s } | \forall r , s \in \{ 1 , \ldots , t \}$ and so $| \mathbb { D } _ { s } | = t ^ { - 1 } | \mathbb { D } |$ . Combining with Lemma 2, the result follows.
131
+
132
+ Theorem 2. AE embeddings approximately factorize the pooled node-feature matrix:
133
+
134
+ $$
135
+ \log \Big ( \frac { c } { t } \big ( \sum _ { r = 1 } ^ { t } \pmb { P } ^ { r } \big ) \pmb { F } E ^ { - 1 } \Big ) - \log b .
136
+ $$
137
+
138
+ Proof. The proof is analogous to the proof of Theorem 1.
139
+
140
+ Remark 1. DeepWalk is a corner case of $A E$ with $\pmb { F } \mathrm { = } \pmb { I } _ { \vert \mathbb { V } \vert }$
141
+
142
+ That is, DeepWalk is equivalent to $A E$ if each node has a single unique feature. Thus ${ \pmb { { \cal E } } } =$ $d i a g ( { \bf 1 } ^ { \top } D I ) = D$ and, by Theorem 2, DeepWalk’s embeddings factorize $\begin{array} { r } { \log \left( \frac { c } { t } ( \sum _ { r = 1 } ^ { t } \mathbf { P } ^ { r } ) \mathbf { D } ^ { - 1 } \right) - } \end{array}$ $\log b$ , as previously noted by Qiu et al. (2018).
143
+
144
+ Remark 2. Walklets is a corner case of MUSAE with ${ \pmb F } = { \pmb I } _ { | \mathbb { V } | }$
145
+
146
+ Thus, for $r = 1 , \ldots , t$ , the embeddings of Walklets factorise $\log \left( c \mathbf { P } ^ { r } \mathbf { D } ^ { - 1 } \right) - \log b$ .
147
+
148
+ Remark 3. Appending an identity matrix $\pmb { I }$ to the feature matrices $\pmb { F }$ of $A E$ and MUSAE (denoted $[ F ; I ] )$ adds a unique feature to each node. The resulting algorithms, named AE-EGO and MUSAE$E G O$ , learn embeddings that, respectively, approximately factorize the node-feature PMI matrices:
149
+
150
+ $$
151
+ \partial g \left( c P ^ { r } \left[ F ; I \right] E ^ { - 1 } \right) - \log b , \forall r \in \{ 1 , . . . , t \} ; \qquad a n d \qquad \log \left( \frac { c } { t } ( \sum _ { r = 1 } ^ { t } P ^ { r } ) \left[ F ; I \right] E ^ { - 1 } \right) - \log b .
152
+ $$
153
+
154
+ # 4.3 COMPLEXITY ANALYSIS
155
+
156
+ Under the assumption of a constant number of features per source node and first-order attributed random walk sampling, the corpus generation has a runtime complexity of $\mathcal { O } ( n l t x / y )$ , where $\begin{array} { r } { \boldsymbol { x } = \sum _ { v \in \mathbb { V } } \left| \mathbb { F } _ { v } \right| } \end{array}$ the total number of features across all nodes (including repetition) and $\dot { \boldsymbol y } = | \mathbb { V } |$ the number of nodes. Using negative sampling, the optimization runtime of a single asynchronous gradient descent epoch on $A E$ and the joint optimization runtime of MUSAE embeddings is described by $\mathcal { O } ( b d n l t x / y )$ . If one does $p$ truncated walks from each source node, the corpus generation complexity is $\mathcal { O } ( p y l t x )$ and the model optimization runtime is $\mathcal { O } ( b d p y l t x )$ . Our later runtime experiments in Section 5 will underpin optimization runtime complexity discussed above.
157
+
158
+ Corpus generation has a memory complexity of $\mathcal { O } ( n l t x / y )$ while the same when generating $p$ truncated walks per node has a memory complexity of $\mathcal { O } ( p y l t x )$ . Storing the parameters of an $A E$ embedding has a memory complexity of $\mathcal { O } ( y d )$ and MUSAE embeddings also use $\mathcal { O } ( y d )$ memory.
159
+
160
+ # 5 EXPERIMENTAL EVALUATION
161
+
162
+ In order to evaluate the quality of created representations we test the embeddings on supervised downstream tasks such as node classification, transfer learning across networks, regression, and link prediction. Finally, we investigate how changes in the input size affect the runtime. For doing so we utilize social networks and web graphs that we collected from Facebook, Github, Twitch and Wikipedia. The data sources, collection procedures and the datasets themselves are described with great detail in Appendix B. In addition we tested our methods on citation networks widely used for model evaluation (Shchur et al., 2018). Across all experiments we use the same hyperparameter settings of our own model, competing unsupervised methods and graph neural networks – these are respectively listed in Appendices C, E and F.
163
+
164
+ # 5.1 NODE CLASSIFICATION
165
+
166
+ We evaluate the node classification performance in two separate scenarios. In the first we do $k$ -shot learning by using the attributed embedding vectors with logistic regression to predict labels on the Facebook, Github and Twitch Portugal graphs. In the second we test the predictive performance under a fixed size train-test split to compare against various embedding methods and competitive neural network architectures.
167
+
168
+ # 5.1.1 K-SHOT LEARNING
169
+
170
+ In this experiment we take $k$ randomly selected samples per class, and use the attributed node embeddings to train a logistic regression model with $l _ { 2 }$ regularization and predict the labels on the remaining vertices. We repeated the above procedure with seeded splits 100 times to obtain robust comparable results (Shchur et al., 2018). From these we calculated the average of micro averaged $F _ { 1 }$ scores to compare our own methods with other unsupervised node embedding procedures. We varied $k$ in order to show the efficacy of the methods – what are the gains when the training set size is increased. These results are plotted in Figure 2 for Facebook, Github and Twitch Portugal networks.
171
+
172
+ Based on these plots it is evident that MUSAE and $A E$ embeddings have little gains in terms of micro $F _ { 1 }$ score when additional data points are added to the training set when $k$ is larger than 12. This implies that our method is data efficient. Moreover, $M U S A E – E G O$ and $A E / E G O$ have a slight performance advantage, which means that including the nodes in the attributed random walks helps when a small amount of labeled data is available in the downstream task.
173
+
174
+ ![](images/960f0646ea755a113ddd6498bdae77ee4f7feb13b449bfd3648dd269fd3e8d5e.jpg)
175
+ Figure 2: Node classification $k$ -shot learning performance as a function of training samples per class evaluated by average micro $F _ { 1 }$ scores calculated from a 100 seeded train-test splits.
176
+
177
+ # 5.1.2 FIXED RATIO TRAIN-TEST SPLITS
178
+
179
+ In this series of experiments we created a 100 seeded train test splits of nodes $80 \%$ train - $20 \%$ test) and calculated weighted, micro and macro averaged $F _ { 1 }$ scores on the test set to compare our methods to various embedding and graph neural network methods. Across procedures the same random seeds were used to obtain the train-test split this way the performances are directly comparable. We attached these results on the Facebook, Github and Twitch Portugal graphs as Table 6 of Appendix G. In each column red denotes the best performing unsupervised embedding model and blue corresponds to the strongest supervised neural model. We also attached additional supporting results using the same experimental setting with the unsupervised methods on the Cora, Citeseer, and Pubmed graphs as Table 5 of Appendix G.
180
+
181
+ In terms of micro $F _ { 1 }$ score our strongest method outperforms on the Facebook and GitHub networks the best unsupervised method by $1 . 0 1 \%$ and $0 . 4 7 \%$ respectively. On the Twitch Portugal network the relative micro $F _ { 1 }$ advantage of ASNE over our best method is $1 . 0 2 \%$ . Supervised node embedding methods outperform our and other unsupervised methods on every dataset for most metrics. In terms of micro $F _ { 1 }$ this relative advantage over our best performing model variant is the largest with $4 . 6 7 \%$ on the Facebook network, and only $0 . 1 1 \%$ on Twitch Portugal.
182
+
183
+ One can make four general observations based on our results (i) multi-scale representations can help with the classification tasks compared to pooled ones; (ii) the addition of the nodes in the ego augmented models to the feature sets does not help the performance when a large amount of labeled training data is available; (iii) based on the standard errors supervised neural models do not necessarily have a significant advantage over unsupervised methods (see the results on the Github and Twitch datasets); (iv) attributed node embedding methods that only consider first-order neighbourhoods have a poor performance.
184
+
185
+ # 5.2 TRANSFER LEARNING ON TWITCH SOCIAL NETWORKS
186
+
187
+ Neighbourhood based methods such as DeepWalk (Perozzi et al., 2014) are transductive and the function used to create the embedding cannot map nodes that are not connected to the original graph to the latent space. However, vanilla MUSAE and $A E$ are inductive and can easily map nodes to the embedding space if the attributes across the source and target graph are shared. This also means that supervised models trained on the embedding of a source graph are transferable. Importantly those attributed embedding methods such as AANE or ASNE that explicitly use the graph are unable to do this transfer.
188
+
189
+ ![](images/baa0230987e2e9aec4062b89fd1537ea63700e2beea5a0bd5e8a0678f720174d.jpg)
190
+ Figure 3: Mean micro $F _ { 1 }$ scores and standard errors calculated from 10 transfer learning runs with MUSAE and $A E$ on the Twitch graphs using Germany, England and Spain as target for the transfer. The blue reference line denotes the test performance on the target dataset in a non transfer learning scenario (standard hyperparameter settings and split ratio). The red reference line denotes the performance of random guesses.
191
+
192
+ Using the disjoint Twitch country level social networks (inter country edges are not present) we did a transfer learning experiment. First, we learn an embedding function given the social network from a country with the standard parameter settings. Second, we train regularized logistic regression on the embedding to predict whether the Twitch user streams explicit content. Third, using the embedding function we map the target graph to the embedding space. Fourth, we use the logistic model to predict the node labels on the target graph. We evaluate the performance by the micro $F _ { 1 }$ score based on 10 experimental repetitions. These averages with standard error bars are plotted for the Twitch Germany, England and Spain datasets as target graphs on Figure 3. We added additional results with France, Portugal and Russia being the target country in Appendix H as Table 5.
193
+
194
+ These results support that MUSAE and $A E$ create features that are transferable across graphs that share vertex features. For example, based on a comparison to non transfer-learning results we find that the transfer between the German and English user graphs is effective in terms of micro $F _ { 1 }$ score. Transfer from English users to German ones considerably improves performance, and the other way around there is a little gain. We also see that the upstream and downstream models that we trained on graphs with more vertices transfer well while transfer to the small ones is generally poor – most of the times worse than random guessing. There is no clear evidence that either $M U S A E$ or $A E$ gives better results on this specific problem.
195
+
196
+ # 5.3 REGRESSION ON WIKIPEDIA GRAPHS
197
+
198
+ We created embeddings of the Wikipedia webgraphs with all of our methods and the unsupervised baselines. Using a $80 \%$ train - $20 \%$ test split we predict the log of average traffic for each page using an elastic net model. The hyperparameters of the downstream model are available in Appendix D. In Table 7 of Appendix I we report average test $R ^ { 2 }$ and standard error of the predictive performance over 100 seeded train-test splits. Our key observation are: (i) that MUSAE outperforms all benchmark neighbourhood preserving and attributed node embedding methods, with the strongest MUSAE variant outperforming the best baseline between $2 . 0 5 \%$ and $1 0 . 0 3 \%$ (test $R ^ { 2 }$ ); (ii) that MUSAE significantly outperforms $A E$ by between $2 . 4 9 \%$ and $2 1 . 6 4 \%$ (test $R ^ { 2 }$ ); and (iii) the benefit of using the vertices as features (ego augmented model) can improve the performance of embeddings, but appears to be dataset specific phenomenon.
199
+
200
+ # 5.4 LINK PREDICTION ON WEB GRAPHS AND SOCIAL NETWORKS
201
+
202
+ The final series of experiments dedicated to the representation quality is about link prediction. We carried out an attenuated graph embedding trial to predict the removed edges from the graph. First, we randomly removed $50 \%$ of edges while the connectivity of the graph was not changed. Second, an embedding is created from the attenuated graph. Third, we calculate features for the removed edges and the same number of randomly selected pairs of nodes (negative candidates) with binary operators to create $d$ -dimensional edge features. We use the binary operators applied by Grover & Leskovec (2016). Specifically, we calculated the average, element-wise product, element-wise $l _ { 1 }$ norm and the element-wise $l _ { 2 }$ norm of vectors. Finally, we created a 100 seeded $80 \%$ train - $20 \%$ test splits and used logistic regression to predict whether an edge exists.
203
+
204
+ We compared to attributed and neighbourhood based embedding methods and average AUC scores are presented in Tables 8 and 9 of Appendix J. Our results show that Walklets (Perozzi et al., 2017) the multi-scale neighbourhood based embedding method materially outperforms every other method on most of the datasets and attributed embedding methods generally do poorly in terms of AUC compared to neighbourhood based ones.
205
+
206
+ # 5.5 SCALABILITY
207
+
208
+ In order to show the efficacy of our algorithms we run a series of experiments on synthetic graphs where we are able to manipulate the input size. Specifically, we look at the effect of changing the number of vertices and features per vertex. Our detailed experimental setup was as follows. Each point in Figure 4 is the mean runtime obtained from 100 experimental runs on Erdos-Renyi graphs. The base graph that we manipulated had $2 ^ { 1 1 }$ nodes, $2 ^ { 3 }$ edges and the same number of unique features per node uniformly selected from a feature set of $2 ^ { 1 1 }$ . Our experimental settings were the same as the ones described in Appendix C except for the number of epochs. We only did a single training epoch with asynchronous gradient descent on each graph. We tested the runtime with 1, 2 and 4 cores and included a dashed line as the linear runtime reference in each subfigure.
209
+
210
+ ![](images/8ae8b93535530c8b82a007aceb6d02feed799bf2387bff665cc2454cabf87765.jpg)
211
+ Figure 4: Optimization time as a function of average feature count / number of vertices.
212
+
213
+ We observe that doubling the average number of features per vertex doubles the runtime of $A E$ and MUSAE. Moreover, the number of cores used during the optimization does not decrease the runtime when the number of unique features per vertex compared to the cardinality of the feature set is large. When we look at the change in the vertex set size we also see a linear behaviour. Doubling the input size simply results in a doubled optimization runtime. In addition, if one interpolates linearly from these results it comes that a network with 1 million nodes, 8 edges per node, 8 unique features per node can be embedded with MUSAE on commodity hardware in less than 5 hours. This interpolation assumes that the standard parameter settings proposed in Appendix C and 4 cores were used for optimization.
214
+
215
+ # 6 DISCUSSION AND CONCLUSION
216
+
217
+ We investigated attributed node embedding and proposes efficient pooled $( A E )$ and multi-scale (MUSAE) attributed node embedding algorithms with linear runtime. We proved that these algorithms implicitly factorize probability matrices of features appearing in the neighbourhood of nodes. Two widely used neighbourhood preserving node embedding methods Perozzi et al. (2014; 2017) are in fact simplified cases of our models. On several datasets (Wikipedia, Facebook, Github, and citation networks) we found that representations learned by our methods, in particular MUSAE, outperform neighbourhood based node embedding methods (Perozzi et al. (2014); Grover & Leskovec (2016)), multi-scale algorithms (Tang et al. (2015); Perozzi et al. (2017)) and recently proposed attributed node embedding procedures (Yang et al. (2015); Liao et al. (2018); Huang et al. (2017); Yang et al. (2018); Yang & Yang (2018)).
218
+
219
+ Our proposed embedding models are differentiated from other methods in that they encode feature information from higher order neighborhoods. The most similar previous model BANE (Yang et al., 2018) encodes node attributes from higher order neighbourhoods but has non-linear runtime complexity and the product of adjacency matrix power and feature matrix is decomposed explicitly.
220
+
221
+ # REFERENCES
222
+
223
+ Sami Abu-El-Haija, Bryan Perozzi, Rami Al-Rfou, and Alexander A Alemi. Watch your step: Learning node embeddings via graph attention. In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi, and R. Garnett (eds.), Advances in Neural Information Processing Systems 31, pp. 9198–9208. 2018.
224
+
225
+ Sami Abu-El-Haija, Bryan Perozzi, Amol Kapoor, Nazanin Alipourfard, Kristina Lerman, Hrayr Harutyunyan, Greg Ver Steeg, and Aram Galstyan. MixHop: Higher-order graph convolutional architectures via sparsified neighborhood mixing. In Proceedings of the 36th International Conference on Machine Learning (ICML), pp. 21–29, 2019.
226
+
227
+ Nesreen K Ahmed, Ryan Rossi, John Boaz Lee, Xiangnan Kong, Theodore L Willke, Rong Zhou, and Hoda Eldardiry. Learning role-based graph embeddings. arXiv preprint arXiv:1802.02896, 2018.
228
+
229
+ Shaosheng Cao, Wei Lu, and Qiongkai Xu. Grarep: Learning graph representations with global structural information. In Proceedings of the 24th ACM International on Conference on Information and Knowledge Management, pp. 891–900, 2015.
230
+
231
+ Wei-Lin Chiang, Xuanqing Liu, Si Si, Yang Li, Samy Bengio, and Cho-Jui Hsieh. Cluster-gcn: An efficient algorithm for training deep and large graph convolutional networks. In Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery &#38; Data Mining (KDD), pp. 257–266, 2019.
232
+
233
+ Matthias Fey and Jan E. Lenssen. Fast graph representation learning with PyTorch Geometric. In ICLR Workshop on Representation Learning on Graphs and Manifolds, 2019.
234
+
235
+ Aditya Grover and Jure Leskovec. node2vec: Scalable feature learning for networks. In Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, 2016.
236
+
237
+ Will Hamilton, Zhitao Ying, and Jure Leskovec. Inductive representation learning on large graphs. In Advances in Neural Information Processing Systems (NIPS) 30, pp. 1024–1034. Curran Associates, Inc., 2017.
238
+
239
+ Xiao Huang, Jundong Li, and Xia Hu. Accelerated attributed network embedding. In Proceedings of the 2017 SIAM International Conference on Data Mining, pp. 633–641. SIAM, 2017.
240
+
241
+ George Karypis and Vipin Kumar. A fast and high quality multilevel scheme for partitioning irregular graphs. SIAM Journal on scientific Computing, 20(1):359–392, 1998.
242
+
243
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations (ICLR), 2015.
244
+
245
+ Thomas N. Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. In International Conference on Learning Representations (ICLR), 2017.
246
+
247
+ Johannes Klicpera, Aleksandar Bojchevski, and Stephan Gunnemann. Predict then propagate: ¨ Graph neural networks meet personalized pagerank. In International Conference on Learning Representations (ICLR), 2019.
248
+
249
+ Omer Levy and Yoav Goldberg. Neural word embedding as implicit matrix factorization. In Advances in neural information processing systems, pp. 2177–2185, 2014.
250
+
251
+ Lizi Liao, Xiangnan He, Hanwang Zhang, and Tat-Seng Chua. Attributed social network embedding. IEEE Transactions on Knowledge and Data Engineering, 30(12):2257–2270, 2018.
252
+
253
+ Tomas Mikolov, Kai Chen, Greg Corrado, and Jeffrey Dean. Efficient estimation of word representations in vector space. 2013a.
254
+
255
+ Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg S Corrado, and Jeff Dean. Distributed representations of words and phrases and their compositionality. In Advances in neural information processing systems, pp. 3111–3119, 2013b.
256
+
257
+ Vinod Nair and Geoffrey E Hinton. Rectified linear units improve restricted boltzmann machines. In Proceedings of the 27th International Conference on Machine Learning (ICML), pp. 807–814, 2010.
258
+
259
+ Fabian Pedregosa, Gael Varoquaux, Alexandre Gramfort, Vincent Michel, Bertrand Thirion, Olivier ¨ Grisel, Mathieu Blondel, Peter Prettenhofer, Ron Weiss, Vincent Dubourg, et al. Scikit-learn: Machine learning in python. Journal of machine learning research, 12(Oct):2825–2830, 2011.
260
+
261
+ 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., 2014.
262
+
263
+ Bryan Perozzi, Vivek Kulkarni, Haochen Chen, and Steven Skiena. Don’t walk, skip!: Online learning of multi-scale network embeddings. In Proceedings of the 2017 IEEE/ACM International Conference on Advances in Social Networks Analysis and Mining 2017, pp. 258–265, 2017.
264
+
265
+ Jiezhong Qiu, Yuxiao Dong, Hao Ma, Jian Li, Kuansan Wang, and Jie Tang. Network embedding as matrix factorization: Unifying deepwalk, line, pte, and node2vec. In Proceedings of the Eleventh ACM International Conference on Web Search and Data Mining, pp. 459–467, 2018.
266
+
267
+ Leonardo F.R. Ribeiro, Pedro H.P. Saverese, and Daniel R. Figueiredo. Struc2vec: Learning node representations from structural identity. In Proceedings of the 23rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, KDD ’17, pp. 385–394, 2017.
268
+
269
+ Oleksandr Shchur, Maximilian Mumme, Aleksandar Bojchevski, and Stephan Gunnemann. Pitfalls ¨ of graph neural network evaluation. Relational Representation Learning Workshop, NeurIPS 2018, 2018.
270
+
271
+ Jian Tang, Meng Qu, Mingzhe Wang, Ming Zhang, Jun Yan, and Qiaozhu Mei. Line: Large-scale information network embedding. In Proceedings of the 24th International Conference on World Wide Web, pp. 1067–1077, 2015.
272
+
273
+ Petar Velickovi ˇ c, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Li ´ o, and Yoshua \` Bengio. Graph attention networks. In International Conference on Learning Representations (ICLR), 2018.
274
+
275
+ Felix Wu, Amauri Souza, Tianyi Zhang, Christopher Fifty, Tao Yu, and Kilian Weinberger. Simplifying graph convolutional networks. In Proceedings of the 36th International Conference on Machine Learning (ICML), pp. 6861–6871, 2019.
276
+
277
+ Cheng Yang, Zhiyuan Liu, Deli Zhao, Maosong Sun, and Edward Y Chang. Network representation learning with rich text information. In IJCAI, pp. 2111–2117, 2015.
278
+
279
+ Hong Yang, Shirui Pan, Peng Zhang, Ling Chen, Defu Lian, and Chengqi Zhang. Binarized attributed network embedding. In 2018 IEEE International Conference on Data Mining (ICDM), pp. 1476–1481. IEEE, 2018.
280
+
281
+ Shuang Yang and Bo Yang. Enhanced network embedding with text information. In 2018 24th International Conference on Pattern Recognition (ICPR), pp. 326–331. IEEE, 2018.
282
+
283
+ Daokun Zhang, Jie Yin, Xingquan Zhu, and Chengqi Zhang. Sine: Scalable incomplete network embedding. In 2018 IEEE International Conference on Data Mining (ICDM), pp. 737–746. IEEE, 2018.
284
+
285
+ # A PROOFS
286
+
287
+ Lemma 1. The empirical statistics of node-feature pairs obtained from random walks give unbiased estimates of joint probabilities of observing feature $f \in \mathbb { F } r$ steps $( i )$ after; or (ii) before node $v \in \mathbb { V }$ , as given by:
288
+
289
+ $$
290
+ p l i m \frac { \# ( w , f ) _ { \vec { r } } } { | \mathfrak { D } _ { \vec { r } } | } = c ^ { - 1 } ( D P ^ { r } F ) _ { w , f } \qquad \underbrace { p l i m \frac { \# ( w , f ) _ { \vec { r } } } { | \mathfrak { D } _ { \vec { r } } | } } _ { l \to \infty } = c ^ { - 1 } ( F ^ { \top } D P ^ { r } ) _ { f , w }
291
+ $$
292
+
293
+ Proof. The proof is analogous to that given for Theorem 2.1 in Qiu et al. (2018). We show that the computed statistics correspond to sequences of random variables with finite expectation, bounded variance and covariances that tend to zero as the separation between variables within the sequence tends to infinity. The Weak Law of Large Numbers (S.N.Bernstein) then guarantees that the sample mean converges to the expectation of the random variable. We first consider the special case $n = 1$ , i.e. we have a single sequence $w _ { 1 } , . . . , w _ { l }$ generated by a random walk (see Algorithm 1). For a particular node-feature pair $( w , f )$ , we let $Y _ { i }$ , $i \in \{ 1 , . . . , l - t \}$ , be the indicator function for the event $w _ { i } = w$ and $f \in \mathbb { F } _ { i + r }$ . Thus, we have:
294
+
295
+ $$
296
+ \begin{array} { r } { \frac { \# ( w , f ) _ { \vec { r } } } { | \mathbb { D } _ { \vec { r } } | } = \frac { 1 } { l - t } \displaystyle \sum _ { i = 1 } ^ { l - t } Y _ { i } , } \end{array}
297
+ $$
298
+
299
+ the sample average of the $Y _ { i } \mathrm { s }$ . We also have:
300
+
301
+ $$
302
+ \begin{array} { r } { \mathbb { E } [ Y _ { i } ] = \frac { d e g ( w ) } { c } ( P ^ { r } F ) _ { w , f } = \frac { 1 } { c } ( D P ^ { r } F ) _ { w , f } } \end{array}
303
+ $$
304
+
305
+ $$
306
+ \mathbb { E } [ Y _ { i } Y _ { j } ] = \operatorname { P r o b } [ w _ { i } = w , f \in \mathbb { F } _ { i + r } , w _ { j } = w , f \in \mathbb { F } _ { j + r } ]
307
+ $$
308
+
309
+ $$
310
+ \begin{array} { r l } & { = \underbrace { \frac { d e g \left( w \right) } { c } } _ { p \left( w _ { i } = w \right) } \underbrace { P _ { : w } ^ { r } } _ { p \left( w _ { i + r } | w _ { i } = w \right) } \underbrace { d i a g ( F _ { : f } ) } _ { p \left( f \in \mathbb { R } _ { i + r } | w _ { i + r } \right) } \underbrace { P _ { : w } ^ { j - \left( i + r \right) } } _ { p \left( w _ { j } = w | w _ { i + r } \right) } \underbrace { P _ { w : } ^ { r } F _ { : f } } _ { p \left( f \in \mathbb { R } _ { j + r } | w _ { j } = w \right) } } \\ & { \qquad p \left( w _ { j } = w , f \in \mathbb { R } _ { i + r } | w _ { i } = w \right) } \end{array}
311
+ $$
312
+
313
+ for $j > i + r$ . This allows us to compute the covariance:
314
+
315
+ $$
316
+ \begin{array} { r l } & { \mathrm { { C o v } } ( Y _ { i } , Y _ { j } ) = \mathbb { E } [ Y _ { i } Y _ { j } ] - \mathbb { E } [ Y _ { i } ] \mathbb { E } [ Y _ { j } ] } \\ & { \quad = \frac { d e g ( w ) } { c } P _ { w : } ^ { r } d i a g ( F _ { : f } ) \underbrace { ( P _ { : w } ^ { j - ( i + r ) } - \frac { d e g ( w ) } { c } \underline { { 1 } } ) } _ { \mathrm { t e n d s t o 0 a s } j - i \infty } P _ { w : } ^ { r } F _ { : f } , } \end{array}
317
+ $$
318
+
319
+ where $\underline { { 1 } }$ is a vector of ones. The difference term (indicated) tends to zero as $j - i \infty$ since then $p ( w _ { j } \ = \ w | w _ { i + r } )$ tends to the stationary distribution $\begin{array} { r } { p ( w ) ~ = ~ \frac { d e g ( w ) } { c } } \end{array}$ , regardless of $w _ { i + r }$ . Thus, applying the Weak Law of Large Numbers, the sample average converges in probability to the expected value, i.e.:
320
+
321
+ $$
322
+ \frac { \# ( w , f ) _ { \vec { r } } } { | \mathbb { D } _ { \vec { r } } | } = \frac { 1 } { l - t } \sum _ { i = 1 } ^ { l - t } Y _ { i } \overset { p } { } \frac { 1 } { l - t } \sum _ { i = 1 } ^ { l - t } \mathbb { E } [ Y _ { i } ] = \frac { 1 } { c } ( D P ^ { r } F ) _ { w , f }
323
+ $$
324
+
325
+ A similar argument applies to $\frac { \# ( w , f ) _ { \overleftarrow { r } } } { | \mathbb { D } _ { \overleftarrow { r } } | }$ , with expectation term $\scriptstyle { \frac { 1 } { c } } ( F ^ { \top } D P ^ { r } ) _ { f , w }$ . In both cases, the argument readily extends to the general setting where $n > 1$ with suitably defined indicator functions for each of the $n$ random walks (see Qiu et al. (2018)). □
326
+
327
+ Lemma 2. Empirical statistics of node-feature pairs obtained from random walks give unbiased estimates of joint probabilities of observing feature $f \in \mathbb { F } r$ steps either side of node $v \in \mathbb { V } ,$ , given by:
328
+
329
+ $$
330
+ \underset { l \infty } { \underbrace { p l i m } } ^ { \# ( w , f ) _ { r } } = c ^ { - 1 } ( D P ^ { r } F ) _ { w , f } \ ,
331
+ $$
332
+
333
+ Proof.
334
+
335
+ $$
336
+ \begin{array} { r l } & { \frac { \dot { \phi } ( w , f ) _ { \mathrm { r } } } { | \mathbb { D } _ { \mathrm { r } } | } = \frac { \dot { \mathcal { H } } ( w , f ) _ { \frac { \pi } { \gamma } } } { | \mathbb { D } _ { \mathrm { r } } | } + \frac { \dot { \mathcal { H } } ( w , f ) _ { \frac { \pi } { \gamma } } } { | \mathbb { D } _ { \mathrm { r } } | } } \\ & { \phantom { \frac { \dot { \phi } ( w , f ) _ { \frac { \pi } { \gamma } } } { | \mathbb { D } _ { \mathrm { r } } | } } = \frac { 1 } { 2 } \Big ( \frac { \dot { \mathcal { H } } ( w , f ) _ { \frac { \pi } { \gamma } } } { | \mathbb { D } _ { \frac { \pi } { \gamma } } | } + \frac { \dot { \mathcal { H } } ( w , f ) _ { \frac { \pi } { \gamma } } } { | \mathbb { D } _ { \frac { \pi } { \gamma } } | } \Big ) } \\ & { \phantom { \frac { \dot { \phi } ( w , f ) _ { \frac { \pi } { \gamma } } } { | \mathbb { D } _ { \frac { \gamma } { \gamma } } | } } \frac { 1 } { \rho } \Big ( \frac { 1 } { c } ( D P ^ { \mathrm { r } } F ) _ { w , f } + \frac { 1 } { c } ( F ^ { \top } D P ^ { \mathrm { r } } ) _ { f , w } \Big ) } \\ & { \phantom { \frac { \dot { \phi } ( w , f ) _ { \frac { \pi } { \gamma } } } { | \mathbb { D } _ { \mathrm { r } } | } } = \frac { 1 } { 2 c } \big ( D P ^ { \mathrm { r } } F + P ^ { \mathrm { r } \top } D F \big ) _ { w , f } } \\ & { \phantom { \frac { \dot { \phi } ( w , f ) _ { \frac { \pi } { \gamma } } } { | \mathbb { D } _ { \frac { \pi } { \gamma } } | } } = \frac { 1 } { 2 c } \Big ( ( D P ^ { \mathrm { r } } + ( A ^ { \top } D ^ { - 1 } ) ^ { \top } D ) F \Big ) _ { w , f } } \\ & \phantom { \frac { \dot { \Theta } ( w , f ) _ { \frac { \pi } { \gamma } } } { | \mathbb { D } _ { \frac { \pi } { \gamma } } | } } \\ & \phantom { \frac { \dot { \Theta } ( w , f ) _ { \mathcal { H } } } } = \frac { 1 } { 2 c } \big ( ( D P ^ \end{array}
337
+ $$
338
+
339
+ The final step follows by symmetry of $\pmb { A }$ , indicating how the Lemma can be extended to directed graphs. □
340
+
341
+ # B DATASETS AND DESCRIPTIVE STATISTICS
342
+
343
+ Our method was evaluated on a variety of social networks and web page-page graphs that we collected from openly available API services. In Table 1 we described the graphs with widely used statistics with respect to size, diameter, and level of clustering. We also included the average number of features per vertex and unique feature count in the last columns. These datasets are available with the source code of MUSAE and $A E$ at https://github.com/iclr2020/MUSAE.
344
+
345
+ Table 1: Descriptive statistics of the networks used in our experimental evaluation.
346
+
347
+ <table><tr><td>Dataset</td><td>Nodes</td><td>Edges</td><td>Diameter</td><td>Clustering Coefficient</td><td>Density</td><td>Average Feature</td><td>Unique Features</td></tr><tr><td>Facebook Page-Page</td><td>22,470</td><td>171,002</td><td>15</td><td>0.232</td><td>0.001</td><td>14.000</td><td>4,714</td></tr><tr><td>GitHubWeb-ML</td><td>37,700</td><td>289,003</td><td>7</td><td>0.013</td><td>0.001</td><td>18.312</td><td>4,005</td></tr><tr><td>Wikipedia Chameleon</td><td>2,277</td><td>31,421</td><td>11</td><td>0.314</td><td>0.012</td><td>21.547</td><td>3,132</td></tr><tr><td>Wikipedia Crocodile</td><td>11,631</td><td>170,918</td><td>11</td><td>0.026</td><td>0.003</td><td>75.161</td><td>13,183</td></tr><tr><td>Wikipedia Squirrel</td><td>5,201</td><td>198,493</td><td>10</td><td>0.348</td><td>0.015</td><td>26.474</td><td>3,148</td></tr><tr><td>Twitch DE</td><td>9,498</td><td>153,138</td><td>7</td><td>0.047</td><td>0.003</td><td>20.397</td><td>2,545</td></tr><tr><td>Twitch EN</td><td>7,126</td><td>35,324</td><td>10</td><td>0.042</td><td>0.002</td><td>20.799</td><td>2,545</td></tr><tr><td>Twitch ES</td><td>4,648</td><td>59,382</td><td>9</td><td>0.084</td><td>0.006</td><td>19.391</td><td>2,545</td></tr><tr><td>Twitch FR</td><td>6,549</td><td>112.666</td><td>7</td><td>0.054</td><td>0.005</td><td>19.758</td><td>2,545</td></tr><tr><td>Twitch PT</td><td>1,912</td><td>31,299</td><td>7</td><td>0.131</td><td>0.017</td><td>19.944</td><td>2,545</td></tr><tr><td>Twitch RU</td><td>4,385</td><td>37,304</td><td>9</td><td>0.049</td><td>0.004</td><td>20.635</td><td>2,545</td></tr></table>
348
+
349
+ # B.1 FACEBOOK PAGE-PAGE DATASET
350
+
351
+ This webgraph is a page-page graph of verified Facebook sites. Nodes represent official Facebook pages while the links are mutual likes between sites. Node features are extracted from the site descriptions that the page owners created to summarize the purpose of the site. This graph was collected through the Facebook Graph API in November 2017 and restricted to pages from 4 categories which are defined by Facebook. These categories are: politicians, governmental organizations, television shows and companies. As one can see in Table 1 it is a highly clustered graph with a large diameter. The task related to this dataset is multi-class node classification for the 4 site categories.
352
+
353
+ # B.2 GITHUB WEB AND MACHINE LEARNING DEVELOPERS DATASET
354
+
355
+ The largest graph used for evaluation is a social network of GitHub developers which we collected from the public API in June 2019. Nodes are developers who have starred at least 10 repositories and edges are mutual follower relationships between them. The vertex features are extracted based on the location, repositories starred, employer and e-mail address. The task related to the graph is binary node classification – one has to predict whether the GitHub user is a web or a machine learning developer. This target feature was derived from the job title of each user. As the descriptive statistics show in Table 1 this is the largest graph that we use for evaluation with the highest sparsity.
356
+
357
+ # B.3 WIKIPEDIA DATASETS
358
+
359
+ The datasets that we use to perform node level regression are Wikipedia page-page networks collected on three specific topics: chameleons, crocodiles and squirrels. In these networks nodes are articles from the English Wikipedia collected in December 2018, edges are mutual links that exist between pairs of sites. Node features describe the presence of nouns appearing in the articles. For each node we also have the average monthly traffic between October 2017 and November 2018. In the regression tasks used for embedding evaluation the logarithm of average traffic is the target variable. Table 1 shows that these networks are heterogeneous in terms of size, density, and clustering.
360
+
361
+ # B.4 TWITCH DATASETS
362
+
363
+ These datasets used for node classification and transfer learning are Twitch user-user networks of gamers who stream in a certain language. Nodes are the users themselves and the links are mutual friendships between them. Vertex features are extracted based on the games played and liked, location and streaming habits. Datasets share the same set of node features, this makes transfer learning across networks possible. These social networks were collected in May 2018. The supervised task related to these networks is binary node classification – one has to predict whether a streamer uses explicit language.
364
+
365
+ # C STANDARD HYPERPARAMETER SETTINGS OF OUR EMBEDDING MODELS
366
+
367
+ In MUSAE and $A E$ models we have a set of parameters that we use for model evaluation. Our parameter settings listed in Table 2 are quite similar to the widely used general settings of random walk sampled implicit factorization machines (Perozzi et al., 2014; Grover & Leskovec, 2016; Ribeiro et al., 2017; Perozzi et al., 2017). Each of our models is augmented with a Doc2Vec (Mikolov et al., 2013a;b) embedding of node features – this is done such way that the overall dimension is still 128.
368
+
369
+ Table 2: Standard hyperparameter settings of the AE and MUSAE embeddings.
370
+
371
+ <table><tr><td>Parameter</td><td>Value</td><td>Notation</td></tr><tr><td>Dimensions</td><td>128</td><td>d</td></tr><tr><td>Walk length</td><td>80</td><td>1</td></tr><tr><td>Number of walks per node</td><td>10</td><td>p</td></tr><tr><td>Number of epochs</td><td>5</td><td>k</td></tr><tr><td>Window size</td><td>3</td><td>t</td></tr><tr><td>Initial learning rate</td><td>0.05</td><td>Qmax</td></tr><tr><td>Final learning rate</td><td>0.025</td><td>αmin</td></tr><tr><td>Negative samples</td><td>5</td><td>b</td></tr></table>
372
+
373
+ # D HYPERPARAMETER SETTINGS OF THE DOWNSTREAM MODELS
374
+
375
+ The downstream tasks uses logistic and elastic net regression from Scikit-learn (Pedregosa et al., 2011) for node level classification, regression and link prediction. For the evaluation of every embedding model we use the standard settings of the library except for the regularization and norm mixing parameters. These are described in Table 3.
376
+
377
+ # E HYPERPARAMETER SETTINGS OF COMPETING UNSUPERVISED EMBEDDING METHODS
378
+
379
+ Our purpose was a fair evaluation compared to other node embedding procedures. Because of this each we tried to use hyperparameter settings that give similar expressive power to the competing methods with respect to target matrix approximation (Perozzi et al., 2014; Grover & Leskovec, 2016; Perozzi et al., 2017) and number of dimensions.
380
+
381
+ Table 3: Standard hyperparameter settings of the downstream logistic and elastic net regression models that use the embeddings for classification, link prediction and regression.
382
+
383
+ <table><tr><td>Parameter</td><td>Value</td><td>Notation</td></tr><tr><td>Regularization coefficient</td><td>0.01</td><td>入</td></tr><tr><td>Norm mixing parameter</td><td>0.5</td><td>Y</td></tr></table>
384
+
385
+ • DeepWalk (Perozzi et al., 2014): We used the hyperparameter settings described in Table 2. While the original DeepWalk model uses hierarchical softmax to speed up calculations we used a negative sampling based implementation. This way DeepWalk can be seen as a special case of Node2Vec (Grover & Leskovec, 2016) when the second-order random walks are equivalent to the firs-order walks.
386
+ • $L I N E _ { 2 }$ (Tang et al., 2015): We created 64 dimensional embeddings based on first and second order proximity and concatenated these together for the downstream tasks. Other hyperparameters are taken from the original work.
387
+ • Node2Vec (Grover & Leskovec, 2016): Except for the in-out and return parameters that control the second-order random walk behavior we used the hyperparameter settings described in Table 2. These behavior control parameters were tuned with grid search from the $\{ 4 , 2 , 1 , 0 . 5 , 0 . 2 5 \}$ set using a train-validation split of $8 0 \% - 2 0 \%$ within the training set itself.
388
+ • Walklets (Perozzi et al., 2017): We used the hyperparameters described in Table 2 except for window size. We set a window size of 4 with individual embedding sizes of 32. This way the overall number of dimensions of the representation remained the same.
389
+ • The attributed node embedding methods AANE, ASNE, BANE, TADW, TENE all use the hyperparameters described in the respective papers except for the dimension. We parametrized these methods such way that each of the final embeddings used in the downstream tasks is 128 dimensional.
390
+
391
+ # F HYPERPARAMETER SETTINGS OF COMPETING GRAPH NEURAL NETWORKS
392
+
393
+ Each model was optimized with the Adam optimizer (Kingma & Ba, 2015) with the standard moving average parameters and the model implementations are sparsity aware modifications based on PyTorch Geometric (Fey & Lenssen, 2019). We needed these modifications in order to accommodate the large number of vertex features – see the last column in Table 1. Except for the $G A T$ model (Velickoviˇ c et al., 2018) we used ReLU intermediate activation functions (Nair & Hinton, 2010)´ with a softmax unit in the final layer for classification. The hyperparameters used for the training and regularization of the neural models are listed in Table 4.
394
+
395
+ Table 4: Hyperparameter settings used for training the graph neural network baselines.
396
+
397
+ <table><tr><td>Parameter</td><td>Value</td></tr><tr><td>Epochs</td><td>200</td></tr><tr><td>Learning rate</td><td>0.01</td></tr><tr><td>Dropout</td><td>0.5</td></tr><tr><td>l2 Weight regularization</td><td>0.001</td></tr><tr><td>Depth Filters per layer</td><td>2 32</td></tr></table>
398
+
399
+ Except for the APPNP model each baseline uses information up to 2-hop neighbourhoods. The model specific settings when we needed to deviate from the basic settings which are listed in Table 4 were as follows:
400
+
401
+ • Classical GCN (Kipf & Welling, 2017): We used the standard parameter settings described in this section.
402
+
403
+ • GraphSAGE (Hamilton et al., 2017): We utilized a graph convolutional aggregator on the sampled neighbourhoods, samples of 40 nodes per source, and standard settings.
404
+ • GAT (Velickovi ˇ c et al., 2018): The negative slope parameter of the leaky ReLU function ´ was 0.2, we applied a single attention head, and used the standard hyperparameter settings.
405
+ • MixHop (Abu-El-Haija et al., 2019): We took advantage of the $0 ^ { t h }$ , $1 ^ { s t }$ and $2 ^ { n d }$ powers of the normalized adjacency matrix with 32 dimensional convolutional filters for creating the first hidden representations. This was fed to a feed-forward layer to classify the nodes.
406
+ • ClusterGCN (Chiang et al., 2019): Just as Chiang et al. (2019) did, we used the METIS procedure (Karypis & Kumar, 1998). We clustered the graphs into disjoint clusters, and the number of clusters was the same as the number of node classes (e.g. in case of the Facebook page-page network we created 4 clusters). For training we used the earlier described setup.
407
+ • APPNP (Klicpera et al., 2019): The top level feed-forward layer had 32 hidden neurons, the teleport probability was set as 0.2 and we used 20 steps for approximate personalized pagerank calculation.
408
+ • SGCONV (Wu et al., 2019): We used the $2 ^ { n d }$ power of the normalized adjacency matrix for training the classifier.
409
+
410
+ # G CLASSIFICATION PERFORMANCE
411
+
412
+ Table 5: Node classification test performance evaluated by weighted, micro and macro $F _ { 1 }$ scores calculated from 10 seeded train-test splits. We included standard errors of the scores and used $80 \%$ of nodes for training / $20 \%$ of nodes for testing. Red numbers denote the best performing node embedding method.
413
+ Datasets
414
+
415
+ <table><tr><td rowspan="2"></td><td colspan="3">Cora</td><td colspan="3">Citeseer</td><td colspan="3">Pubmed</td></tr><tr><td>Weighted</td><td>Micro</td><td>Macro</td><td>Weighted</td><td>Micro</td><td>Macro</td><td>Weighted</td><td>Micro</td><td>Macro</td></tr><tr><td>DeepWalk</td><td>0.832 ±0.003</td><td>0.833 ±0.004</td><td>0.823 ±0.004</td><td>0.597 ±0.007</td><td>0.603 ±0.007</td><td>0.560 ±0.006</td><td>0.801 ±0.001</td><td>0.802 ±0.001</td><td>0.789 ±0.002</td></tr><tr><td>LINE2</td><td>0.775 ±0.004</td><td>0.777 ±0.004</td><td>0.768 ±0.005</td><td>0.529 ±0.006</td><td>0.542 ±0.006</td><td>0.486 ±0.005</td><td>0.798 ±0.001</td><td>0.799 ±0.001</td><td>0.785 ±0.001</td></tr><tr><td>Node2Vec</td><td>0.840 ±0.003</td><td>0.840 ±0.003</td><td>0.826 ±0.003</td><td>0.616 ±0.005</td><td>0.622 ±0.005</td><td>0.581 ±0.005</td><td>0.809 ±0.002</td><td>0.810 ±0.002</td><td>0.797 ±0.002</td></tr><tr><td>Walklets</td><td>0.843 ±0.003</td><td>0.843 ±0.003</td><td>0.827 ±0.003</td><td>0.624 ±0.005</td><td>0.630 ±0.006</td><td>0.590 ±0.005</td><td>0.815 ±0.001</td><td>0.815 ±0.001</td><td>0.804 ±0.002</td></tr><tr><td>TADW</td><td>0.819 ±0.004</td><td>0.819 ±0.004</td><td>0.804 ±0.005</td><td>0.725 ±0.004</td><td>0.734 ±0.004</td><td>0.685 ±0.004</td><td>0.862 ±0.002</td><td>0.862 ±0.002</td><td>0.863 ±0.002</td></tr><tr><td>AANE</td><td>0.793 ±0.006</td><td>0.793 ±0.006</td><td>0.777 ±0.006</td><td>0.728 ±0.005</td><td>0.733 ±0.004</td><td>0.693 ±0.005</td><td>0.867 ±0.001</td><td>0.867 ±0.001</td><td>0.867 ±0.002</td></tr><tr><td>ASNE</td><td>0.831 ±0.003</td><td>0.830 ±0.003</td><td>0.812 ±0.004</td><td>0.713 ±0.004</td><td>0.718 ±0.004</td><td>0.677 ±0.004</td><td>0.846 ±0.002</td><td>0.846 ±0.002</td><td>0.843 ±0.002</td></tr><tr><td>BANE</td><td>0.807 ±0.005</td><td>0.807 ±0.005</td><td>0.787 ±0.005</td><td>0.707 ±0.003</td><td>0.713 ±0.003</td><td>0.670 ±0.004</td><td>0.823 ±0.002</td><td>0.823 ±0.002</td><td>0.822 ±0.002</td></tr><tr><td>TENE</td><td>0.829 ±0.005</td><td>0.829 ±0.005</td><td>0.815 ±0.004</td><td>0.664 ±0.004</td><td>0.681 ±0.003</td><td>0.611 ±0.002</td><td>0.842 ±0.001</td><td>0.842 ±0.001</td><td>0.843 ±0.002</td></tr><tr><td>AE</td><td>0.835 ±0.005</td><td>0.835 ±0.005</td><td>0.815 ±0.006</td><td>0.730 ±0.005</td><td>0.739 ±0.005</td><td>0.688 ±0.006</td><td>0.839 ±0.002</td><td>0.839 ±0.002</td><td>0.840 ±0.002</td></tr><tr><td>AE-EGO</td><td>0.835 ±0.005</td><td>0.835 ±0.006</td><td>0.816 ±0.005</td><td>0.729 ±0.004</td><td>0.739 ±0.005</td><td>0.690 ±0.007</td><td>0.840 ±0.002</td><td>0.840 ±0.003</td><td>0.839 ±0.002</td></tr><tr><td>MUSAE</td><td>0.848 ±0.004</td><td>0.848 ±0.004</td><td>0.832 ±0.005</td><td>0.737 ±0.004</td><td>0.742 ±0.004</td><td>0.706 ±0.004</td><td>0.853 ±0.001</td><td>0.853 ±0.001</td><td>0.854 ±0.002</td></tr><tr><td>MUSAE-EGO</td><td>0.849 ±0.004</td><td>0.849 ±0.004</td><td>0.833 ±0.004</td><td>0.736 ±0.004</td><td>0.741 ±0.004</td><td>0.706 ±0.004</td><td>0.850 ±0.002</td><td>0.851 ±0.002</td><td>0.850 ±0.002</td></tr></table>
416
+
417
+ Table 6: Node classification test performance evaluated by weighted, micro and macro $F _ { 1 }$ scores calculated from 10 seeded train-test splits. We included standard errors of the scores and used $80 \%$ of nodes for training / $20 \%$ of nodes for testing. Red numbers denote the best performing node embedding method and blue ones denote the best performing supervised graph neural network.
418
+
419
+ <table><tr><td rowspan="3"></td><td colspan="9">Datasets</td></tr><tr><td colspan="3">Facebook Page-Page</td><td colspan="3">GitHubWebML</td><td colspan="3">TwitchPortugal</td></tr><tr><td>Weighted</td><td>Micro</td><td>Macro</td><td>Weighted</td><td>Micro</td><td>Macro</td><td>Weighted</td><td>Micro</td><td>Macro</td></tr><tr><td>DeepWalk</td><td>0.861 ±0.001</td><td>0.863 ±0.001</td><td>0.848 ±0.001</td><td>0.852 ±0.001</td><td>0.858 ±0.001</td><td>0.801 ±0.002</td><td>0.650 ±0.008</td><td>0.672 ±0.007</td><td>0.594 ±0.009</td></tr><tr><td>LINE2</td><td>0.874 ±0.001</td><td>0.875 ±0.001</td><td>0.862 ±0.001</td><td>0.852 ±0.001</td><td>0.858 ±0.001</td><td>0.800 ±0.002</td><td>0.636 ±0.006</td><td>0.670 ±0.005</td><td>0.571 ±0.005</td></tr><tr><td>Node2Vec</td><td>0.889 ±0.001</td><td>0.890 ±0.001</td><td>0.880 ±0.001</td><td>0.853 ±0.001</td><td>0.859 ±0.001</td><td>0.802 ±0.001</td><td>0.665 ±0.004</td><td>0.686 ±0.004</td><td>0.612 ±0.004</td></tr><tr><td>Walklets</td><td>0.886 ±0.001</td><td>0.887 ±0.001</td><td>0.875 ±0.001</td><td>0.854 ±0.001</td><td>0.860 ±0.001</td><td>0.804 ±0.002</td><td>0.652 ±0.006</td><td>0.671 ±0.006</td><td>0.599 ±0.005</td></tr><tr><td>TADW</td><td>0.760 ±0.002</td><td>0.765 ±0.002</td><td>0.740 ±0.003</td><td>0.650 ±0.001</td><td>0.748 ±0.001</td><td>0.528 ±0.007</td><td>0.459 ±0.001</td><td>0.659 ±0.005</td><td>0.406 ±0.003</td></tr><tr><td>AANE</td><td>0.793 ±0.001</td><td>0.796 ±0.001</td><td>0.775 ±0.001</td><td>0.848 ±0.001</td><td>0.856 ±0.001</td><td>0.794 ±0.002</td><td>0.636 ±0.006</td><td>0.661 ±0.006</td><td>0.577 ±0.006</td></tr><tr><td>ASNE</td><td>0.794 ±0.001</td><td>0.797 ±0.001</td><td>0.776 ±0.001</td><td>0.829 ±0.001</td><td>0.839 ±0.001</td><td>0.766 ±0.002</td><td>0.670 ±0.006</td><td>0.685 ±0.006</td><td>0.620 ±0.006</td></tr><tr><td>BANE</td><td>0.868 ±0.001</td><td>0.868 ±0.001</td><td>0.859 ±0.002</td><td>0.711 ±0.001</td><td>0.762 ±0.001</td><td>0.576 ±0.001</td><td>0.644 ±0.006</td><td>0.664 ±0.006</td><td>0.587 ±0.006</td></tr><tr><td>TENE</td><td>0.724 ±0.002</td><td>0.731 ±0.002</td><td>0.699 ±0.002</td><td>0.842 ±0.001</td><td>0.850 ±0.001</td><td>0.785 ±0.002</td><td>0.613 ±0.005</td><td>0.664 ±0.006</td><td>0.536 ±0.006</td></tr><tr><td>AE</td><td>0.887 ±0.001</td><td>0.888 ±0.001</td><td>0.879 ±0.001</td><td>0.858 ±0.001</td><td>0.863 ±0.001</td><td>0.807 ±0.001</td><td>0.653 ±0.005</td><td>0.672 ±0.004</td><td>0.598 ±0.006</td></tr><tr><td>AE-EGO</td><td>0.898 ±0.001</td><td>0.899 ±0.001</td><td>0.890 ±0.001</td><td>0.857 ±0.001</td><td>0.863 ±0.001</td><td>0.807 ±0.002</td><td>0.652 ±0.007</td><td>0.671 ±0.007</td><td>0.599 ±0.009</td></tr><tr><td>MUSAE MUSAE-EGO</td><td>0.886 ±0.001</td><td>0.887 ±0.001</td><td>0.877 ±0.001</td><td>0.859 ±0.001</td><td>0.864 ±0.001</td><td>0.810 ±0.001</td><td>0.654 ±0.006</td><td>0.672 ±0.006</td><td>0.600 ±0.007</td></tr><tr><td></td><td>0.893 ±0.001</td><td>0.894 ±0.001</td><td>0.884 ±0.001</td><td>0.859 ±0.001</td><td>0.864 ±0.001</td><td>0.810 ±0.001</td><td>0.655 ±0.003</td><td>0.671 ±0.002</td><td>0.604 ±0.003</td></tr><tr><td>GCN</td><td>0.931 ±0.001</td><td>0.932 ±0.001 0.814</td><td>0.928 ±0.001</td><td>0.859 ±0.001</td><td>0.865 ±0.001</td><td>0.809 ±0.002</td><td>0.650 ±0.013</td><td>0.695 ±0.007</td><td>0.577 ±0.02</td></tr><tr><td>GraphSAGE</td><td>0.812 ±0.002</td><td>±0.002</td><td>0.795 ±0.002</td><td>0.848 ±0.001</td><td>0.854 ±0.001</td><td>0.794 ±0.002</td><td>0.618 ±0.003</td><td>0.631 ±0.004</td><td>0.563 ±0.005</td></tr><tr><td>GAT</td><td>0.918 ±0.001</td><td>0.919 ±0.001</td><td>0.912 ±0.001</td><td>0.856 ±0.001</td><td>0.864 ±0.001</td><td>0.803 ±0.002</td><td>0.648 ±0.008</td><td>0.678 ±0.007</td><td>0.588 ±0.009</td></tr><tr><td>MixHop</td><td>0.940 ±0.001</td><td>0.941 ±0.002</td><td>0.937 ±0.001</td><td>0.847 ±0.000</td><td>0.85 ±0.001</td><td>0.800 ±0.001</td><td>0.626 ±0.003</td><td>0.630 ±0.004</td><td>0.576 ±0.003</td></tr><tr><td>ClusterGCN</td><td>0.937 ±0.001</td><td>0.937 ±0.001</td><td>0.934 ±0.001</td><td>0.855 ±0.001</td><td>0.859 ±0.001</td><td>0.807 ±0.001</td><td>0.647 ±0.004</td><td>0.654 ±0.004</td><td>0.602 ±0.005</td></tr><tr><td>APPNP</td><td>0.938 ±0.001</td><td>0.938 ±0.001</td><td>0.935 ±0.001</td><td>0.860 ±0.002</td><td>0.868 ±0.001</td><td>0.811 ±0.002</td><td>0.683 ±0.009</td><td>0.702 ±0.012</td><td>0.623 ±0.010</td></tr><tr><td>SGCONV</td><td>0.832 ±0.002</td><td>0.836 ±0.002</td><td>0.812 ±0.002</td><td>0.816 ±0.001</td><td>0.829 ±0.001</td><td>0.747 ±0.002</td><td>0.652 ±0.003</td><td>0.663 ±0.003</td><td>0.604 ±0.004</td></tr></table>
420
+
421
+ ![](images/4ff29e8d31b08590ecff7928dcd81173a0c9d41a22847307925d0f8f77d3f17f.jpg)
422
+ H ADDITIONAL TRANSFER LEARNING RESULTS ON THE TWITCH GRAPHS
423
+ Figure 5: Mean micro $F _ { 1 }$ scores and standard errors calculated from 10 transfer learning runs with $M U S A E$ and $A E$ on the Twitch graphs using France, Portugal and Russia as targets for the transfer. The blue reference line denotes the test performance on the target dataset in a non transfer learning scenario (standard hyperparameter settings and split ratio). The red reference line denotes the performance of random guesses.
424
+
425
+ # I REGRESSION RESULTS ON WIKIPEDIA PAGE-PAGE GRAPHS
426
+
427
+ Table 7: Average test $R ^ { 2 }$ values and standard errors on the Wikipedia traffic prediction tasks. Red numbers denote the best results on each page-page network.
428
+
429
+ Datasets
430
+
431
+ <table><tr><td rowspan="2">Method</td><td colspan="3">Datasets</td></tr><tr><td>Wikipedia Chameleons</td><td>Wikipedia Crocodiles</td><td>Wikipedia Squirrels</td></tr><tr><td>DeepWalk</td><td>0.375 ±0.004</td><td>0.553 ±0.001</td><td>0.170 ±0.002</td></tr><tr><td>LINE2</td><td>0.381 ±0.003</td><td>0.586 ±0.001</td><td>0.232 ±0.002</td></tr><tr><td>Node2Vec</td><td>0.414 ±0.003</td><td>0.574 ±0.001</td><td>0.174 ±0.002</td></tr><tr><td>Walklets</td><td>0.426 ±0.003</td><td>0.625 ±0.001</td><td>0.249 ±0.002</td></tr><tr><td>TADW</td><td>0.527 ±0.003</td><td>0.636 ±0.001</td><td>0.271</td></tr><tr><td>AANE</td><td>0.598 ±0.007</td><td>0.732</td><td>±0.002 0.287</td></tr><tr><td>ASNE</td><td>0.440 ±0.009</td><td>±0.002 0.572</td><td>±0.002 0.229</td></tr><tr><td>BANE</td><td>0.464 ±0.003</td><td>±0.003 0.617</td><td>±0.005 0.168</td></tr><tr><td>TENE</td><td>0.494</td><td>±0.001 0.701</td><td>±0.002 0.321</td></tr><tr><td>AE</td><td>±0.02 0.642</td><td>±0.003 0.743</td><td>±0.007 0.291</td></tr><tr><td>AE-EGO</td><td>±0.006 0.644</td><td>±0.003 0.732</td><td>±0.006 0.283</td></tr><tr><td>MUSAE</td><td>±0.009 0.658</td><td>±0.002 0.736</td><td>±0.006 0.338</td></tr><tr><td>MUSAE-EGO</td><td>±0.004 0.653 ±0.011</td><td>±0.003 0.747 ±0.003</td><td>±0.007 0.354 ±0.009</td></tr></table>
432
+
433
+ # J LINK PREDICTION RESULTS ON SOCIAL AND WEB NETWORKS
434
+
435
+ Table 8: Link prediction results - average AUC on the test set using attributed embeddings and logistic regression. We created 100 seeded splits $80 \%$ training - $20 \%$ test). Standard errors of AUC are included below. Red denotes the best performing embedding model considering both neighbourhood based and attributed methods. We used 4 element-wise operators to create features.
436
+
437
+ Datasets
438
+
439
+ <table><tr><td rowspan="2">Operator</td><td rowspan="2">Method</td><td rowspan="2">Facebook Page-Page</td><td rowspan="2">GitHub Web-ML</td><td rowspan="2">Twitch Spain</td><td rowspan="2">Twitch</td><td rowspan="2">Wikipedia Chameleons</td><td rowspan="2">Wikipedia Crocodiles</td></tr><tr><td>Germany</td></tr><tr><td rowspan="4">Average</td><td>DeepWalk</td><td>0.526 ±0.006</td><td>0.550 ±0.004</td><td>0.568 ±0.009</td><td>0.575 ±0.005</td><td>0.635 ±0.002</td><td>0.661 ±0.007</td></tr><tr><td>LINE2</td><td>0.517 ±0.007</td><td>0.551 ±0.003</td><td>0.540 ±0.011</td><td>0.544 ±0.004</td><td>0.627 ±0.001</td><td>0.708 ±0.004</td></tr><tr><td>Node2Vec</td><td>0.534 ±0.005</td><td>0.573 ±0.003</td><td>0.575 ±0.012</td><td>0.584 ±0.006</td><td>0.641 ±0.009</td><td>0.669 ±0.007</td></tr><tr><td>Walklets</td><td>0.518 ±0.008</td><td>0.552 ±0.003</td><td>0.541 ±0.006</td><td>0.545 ±0.004</td><td>0.635 ±0.015</td><td>0.716 ±0.003</td></tr><tr><td rowspan="4">Hadamard</td><td>DeepWalk</td><td>0.981 ±0.001</td><td>0.799 ±0.001</td><td>0.781 ±0.002</td><td>0.750 ±0.003</td><td>0.974 ±0.002</td><td>0.966 ±0.001</td></tr><tr><td>LINE2</td><td>0.979 ±0.001</td><td>0.899 ±0.001</td><td>0.843 ±0.003</td><td>0.755 ±0.001</td><td>0.939 ±0.003</td><td>0.938 ±0.001</td></tr><tr><td>Node2Vec</td><td>0.982 ±0.001</td><td>0.822 ±0.001</td><td>0.810 ±0.005</td><td>0.780 ±0.003</td><td>0.979 ±0.001</td><td>0.973</td></tr><tr><td>Walklets</td><td>0.984 ±0.001</td><td>0.925 ±0.001</td><td>0.873 ±0.003</td><td>0.819 ±0.001</td><td>0.966 ±0.004</td><td>±0.001 0.980 ±0.001</td></tr><tr><td rowspan="4">lNorm</td><td>DeepWalk</td><td>0.921 ±0.001</td><td>0.658 ±0.001</td><td>0.723 ±0.004</td><td>0.711 ±0.002</td><td>0.950 ±0.002</td><td>0.896 ±0.001</td></tr><tr><td>LINE2</td><td>0.924 ±0.001</td><td>0.913</td><td>0.882</td><td>0.855</td><td>0.922</td><td>0.930</td></tr><tr><td>Node2Vec</td><td>0.928</td><td>±0.002 0.725</td><td>±0.002 0.761</td><td>±0.001 0.745</td><td>±0.003 0.953</td><td>±0.001 0.913</td></tr><tr><td>Walklets</td><td>±0.001 0.980</td><td>±0.001 0.932</td><td>±0.004 0.898</td><td>±0.001 0.870</td><td>±0.003 0.961</td><td>±0.001 0.976</td></tr><tr><td rowspan="4">l2 Norm</td><td>DeepWalk</td><td>±0.001 0.922</td><td>±0.001 0.663</td><td>±0.002 0.731</td><td>±0.001 0.717</td><td>±0.004 0.951</td><td>±0.001 0.899</td></tr><tr><td>LINE2</td><td>±0.001 0.924</td><td>±0.001 0.910</td><td>±0.004 0.880</td><td>±0.002 0.855</td><td>±0.002 0.925</td><td>±0.002 0.936</td></tr><tr><td>Node2Vec</td><td>±0.001 0.929</td><td>±0.001 0.731</td><td>±0.002 0.768</td><td>±0.001 0.750</td><td>±0.003 0.954</td><td>±0.001 0.920</td></tr><tr><td>Walklets</td><td>±0.002 0.981 ±0.001</td><td>±0.001 0.930 ±0.001</td><td>±0.007 0.897 ±0.002</td><td>±0.001 0.870 ±0.002</td><td>±0.002 0.960 ±0.005</td><td>±0.001 0.978 ±0.001</td></tr></table>
440
+
441
+ Table 9: Link prediction results - average AUC on the test set using neighbourhood based embeddings and logistic regression. We created 100 seeded splits ( $80 \%$ training - $20 \%$ test). Standard errors of AUC are included below. Red denotes the best performing embedding model considering both neighbourhood based and attributed methods. We used 4 element-wise operators to create features.
442
+
443
+
444
+ <table><tr><td rowspan="2">Operator Method</td><td rowspan="2">GitHub</td><td colspan="5">Datasets</td></tr><tr><td>Facebook Page-Page</td><td>Web-ML</td><td>Twitch Twitch Spain Germany</td><td>Wikipedia Chameleons</td><td>Wikipedia Crocodiles</td></tr><tr><td rowspan="10">Average</td><td>TADW</td><td>0.517 ±0.004</td><td>0.553 ±0.004</td><td>0.541 ±0.007</td><td>0.556 ±0.008</td><td>0.573 ±0.012</td><td>0.625 ±0.006</td></tr><tr><td>AANE</td><td>0.523 ±0.003</td><td>0.539 ±0.003</td><td>0.536 ±0.001</td><td>0.554 ±0.004</td><td>0.552 ±0.013</td><td>0.577 ±0.005</td></tr><tr><td>ASNE</td><td>0.547 ±0.005</td><td>0.596 ±0.002</td><td>0.562 ±0.007</td><td>0.579 ±0.005</td><td>0.650 ±0.005</td><td>0.723 ±0.004</td></tr><tr><td>BANE</td><td>0.625 ±0.003</td><td>0.630</td><td>0.616</td><td>0.634</td><td>0.617</td><td>0.671 ±0.003</td></tr><tr><td>TENE</td><td>0.547 ±0.004</td><td>±0.002 0.515</td><td>±0.001 0.532</td><td>±0.003 0.555</td><td>±0.011 0.555</td><td>0.644 ±0.003</td></tr><tr><td>AE</td><td>0.572 ±0.006</td><td>±0.004 0.719</td><td>±0.011 0.679</td><td>±0.006 0.723</td><td>±0.011 0.669</td><td>0.834</td></tr><tr><td>MUSAE</td><td>0.642</td><td>±0.002 0.780</td><td>±0.006 0.733</td><td>±0.003 0.771</td><td>±0.007 0.810</td><td>±0.002 0.899</td></tr><tr><td>AE-EGO</td><td>±0.003 0.514 ±0.007</td><td>±0.001 0.546</td><td>±0.004 0.523</td><td>±0.002 0.545</td><td>±0.006 0.563</td><td>±0.001 0.660</td></tr><tr><td>MUSAE-EGO</td><td>0.511 ±0.005</td><td>±0.005 0.542 ±0.003</td><td>±0.011 0.533</td><td>±0.007 0.546</td><td>±0.011 0.622</td><td>±0.006 0.699</td></tr><tr><td>TADW</td><td>0.973</td><td>0.915</td><td>±0.005 0.886</td><td>±0.008 0.884</td><td>±0.008 0.964</td><td>±0.003 0.967</td></tr><tr><td rowspan="7">Hadamard</td><td>AANE</td><td>±0.001 0.911</td><td>±0.001 0.772</td><td>±0.003 0.833</td><td>±0.001 0.811</td><td>±0.002 0.917</td><td>±0.001 0.892</td></tr><tr><td>ASNE</td><td>±0.002 0.973</td><td>±0.002 0.912</td><td>±0.003 0.883</td><td>±0.002 0.866</td><td>±0.005 0.945</td><td>±0.005 0.940</td></tr><tr><td>BANE</td><td>±0.001 0.653</td><td>±0.001 0.664</td><td>±0.003 0.659</td><td>±0.002 0.816</td><td>±0.005 0.578</td><td>±0.001 0.738</td></tr><tr><td>TENE</td><td>±0.002 0.735</td><td>±0.003 0.878</td><td>±0.009 0.722</td><td>±0.002 0.748</td><td>±0.014 0.883</td><td>±0.002 0.872</td></tr><tr><td>AE</td><td>±0.012 0.926</td><td>±0.009 0.814</td><td>±0.007 0.743</td><td>±0.003 0.702</td><td>±0.003</td><td>±0.015</td></tr><tr><td>MUSAE</td><td>±0.001 0.945</td><td>±0.002 0.917</td><td>±0.003 0.871</td><td>±0.003 0.863</td><td>0.939 ±0.002 0.950</td><td>0.949 ±0.001 0.968</td></tr><tr><td>AE-EGO</td><td>±0.001 0.928</td><td>±0.002 0.786</td><td>±0.005 0.727</td><td>±0.002 0.687</td><td>±0.005 0.935</td><td>±0.001 0.939</td></tr><tr><td rowspan="10"></td><td>MUSAE-EGO</td><td>±0.001 0.938 ±0.001</td><td>±0.002 0.911 ±0.002</td><td>±0.006 0.881 ±0.003</td><td>±0.003 0.859</td><td>±0.002 0.952</td><td>±0.001 0.969 ±0.001</td></tr><tr><td>TADW</td><td>0.971 ±0.001</td><td>0.909</td><td>0.882</td><td>±0.001 0.881</td><td>±0.007 0.959</td><td>0.962</td></tr><tr><td>AANE</td><td>0.866 ±0.002</td><td>±0.002 0.720</td><td>±0.003 0.771</td><td>±0.001 0.768</td><td>±0.002 0.944</td><td>±0.001 0.913</td></tr><tr><td>ASNE</td><td>0.815 ±0.002</td><td>±0.001 0.866 ±0.001</td><td>±0.004 0.836 ±0.002</td><td>±0.001 0.849</td><td>±0.002 0.869</td><td>±0.001 0.874 ±0.001</td></tr><tr><td>BANE</td><td>0.653 ±0.002</td><td>0.664 ±0.003</td><td>0.658 ±0.009</td><td>±0.001 0.816</td><td>±0.001 0.578</td><td>0.74 ±0.002</td></tr><tr><td>TENE</td><td>0.940 ±0.001</td><td>0.942 ±0.001</td><td>0.857 ±0.004</td><td>±0.002 0.837 ±0.001</td><td>±0.014 0.945 ±0.003</td><td>0.927 ±0.001</td></tr><tr><td>AE</td><td>0.968 ±0.001</td><td>0.889 ±0.001</td><td>0.871 ±0.001</td><td>0.870 ±0.002</td><td>0.955 ±0.002</td><td>0.952 ±0.002</td></tr><tr><td>MUSAE</td><td>0.973 ±0.001</td><td>0.908 ±0.001</td><td>0.885 ±0.002</td><td>0.879 ±0.002</td><td>0.956 ±0.003</td><td>0.967 ±0.001</td></tr><tr><td>AE-EGO</td><td>0.973 ±0.001</td><td>0.891 ±0.001</td><td>0.872 ±0.002</td><td>0.872 ±0.002</td><td>0.953 ±0.002</td><td>0.955 ±0.001</td></tr><tr><td>MUSAE-EGO</td><td>0.977 ±0.001</td><td>0.911 ±0.001</td><td>0.891 ±0.002</td><td>0.884 ±0.002</td><td>0.955 ±0.003</td><td>0.963 ±0.001</td></tr><tr><td rowspan="8">l2 Norm</td><td>TADW</td><td>0.972 ±0.001</td><td>0.913 ±0.001</td><td>0.883 ±0.003</td><td>0.879 ±0.001</td><td>0.961 ±0.002</td><td>0.964 ±0.001</td></tr><tr><td>AANE</td><td>0.877 ±0.001</td><td>0.732 ±0.001</td><td>0.779 ±0.003</td><td>0.774 ±0.002</td><td>0.941 ±0.005</td><td>0.901 ±0.002</td></tr><tr><td>ASNE</td><td>0.806 ±0.004</td><td>0.872 ±0.001</td><td>0.839 ±0.003</td><td>0.852 ±0.002</td><td>0.875 ±0.006</td><td>0.880 ±0.001</td></tr><tr><td>BANE</td><td>0.653 ±0.002</td><td>0.664 ±0.003</td><td>0.659 ±0.009</td><td>.0.816 ±0.0002</td><td>0.578 ±0.014</td><td>0.738 ±0.002</td></tr><tr><td>TENE</td><td>0.893 ±0.001</td><td>0.884 ±0.016</td><td>0.826 ±0.009</td><td>0.797 ±0.005</td><td>0.930 ±0.003</td><td>0.863 ±0.013</td></tr><tr><td>AE</td><td>0.968 ±0.001</td><td>0.881 ±0.001</td><td>0.872 ±0.001</td><td>0.867 ±0.002</td><td>0.954 ±0.003</td><td>0.953 ±0.001</td></tr><tr><td>MUSAE</td><td>0.973 ±0.001</td><td>0.905 ±0.001</td><td>0.884 ±0.002</td><td>0.877 ±0.002</td><td>0.952 ±0.005</td><td>0.965 ±0.001</td></tr><tr><td>AE-EGO</td><td>0.973 ±0.001</td><td>0.884 ±0.001</td><td>0.873 ±0.001</td><td>0.871 ±0.002</td><td>0.952 ±0.003</td><td>0.956 ±0.001</td></tr><tr><td></td><td>MUSAE-EGO</td><td>0.977 ±0.001</td><td>0.907 ±0.001</td><td>0.891 ±0.003</td><td>0.881 ±0.002</td><td>0.951 ±0.006</td><td>0.961 ±0.001</td></tr></table>
md/train/Hk0olMdZOIU/Hk0olMdZOIU.md ADDED
@@ -0,0 +1,275 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Federated Reconstruction: Partially Local Federated Learning
2
+
3
+ Karan Singhal Google Research karansinghal@google.com
4
+
5
+ Hakim Sidahmed Google Research hsidahmed@google.com
6
+
7
+ Zachary Garrett Google Research zachgarrett@google.com
8
+
9
+ Shanshan Wu Google Research shanshanw@google.com
10
+
11
+ Keith Rush Google Research krush@google.com
12
+
13
+ Sushant Prakash Google Research sush@google.com
14
+
15
+ # Abstract
16
+
17
+ Personalization methods in federated learning aim to balance the benefits of federated and local training for data availability, communication cost, and robustness to client heterogeneity. Approaches that require clients to communicate all model parameters can be undesirable due to privacy and communication constraints. Other approaches require always-available or stateful clients, impractical in large-scale cross-device settings. We introduce Federated Reconstruction, the first modelagnostic framework for partially local federated learning suitable for training and inference at scale. We motivate the framework via a connection to model-agnostic meta learning, empirically demonstrate its performance over existing approaches for collaborative filtering and next word prediction, and release an open-source library for evaluating approaches in this setting. We also describe the successful deployment of this approach at scale for federated collaborative filtering in a mobile keyboard application.
18
+
19
+ # 1 Introduction
20
+
21
+ Federated learning is a machine learning setting in which distributed clients solve a learning objective on sensitive data via communication with a coordinating server [44]. Typically, clients collaborate to train a single global model under an objective that combines heterogeneous local client objectives. For example, clients may collaborate to train a next word prediction model for a mobile keyboard application without sharing sensitive typing data with other clients or a centralized server [28]. This paradigm has been scaled to production and deployed in cross-device settings [3, 28, 56] and cross-silo settings [11, 13].
22
+
23
+ However, training a fully global federated model may not always be ideal due to heterogeneity in clients’ data distributions. Yu et al. [58] show that global models can perform worse than purely local (non-federated) models for many clients (e.g., those with many training examples). Moreover, in some settings privacy constraints completely prohibit fully global federated training. For instance, for models with user-specific embeddings, such as matrix factorization models for collaborative filtering [37], naively training a global federated model involves sending updates to user embeddings on the server, directly revealing potentially sensitive individual preferences [21, 47].
24
+
25
+ To address this, we explore partially local federated learning. In this setting, models are partitioned into global $g$ and local parameters $l$ such that local parameters never leave client devices. This enables training on sensitive user-specific parameters as in the collaborative filtering setting, and we show it can also improve robustness to client data heterogeneity and communication cost for other settings, since we are effectively interpolating between local and federated training. Previous works have looked at similar settings [4, 41]. Importantly, these approaches cannot realistically be applied at scale in cross-device settings because they assume clients are stateful or always-available: in practice, clients are sampled from an enormous population with unreliable availability, so approaches that rely on repeated sampling of the same stateful clients are impractical (Kairouz et al. [34] [Table 1]). Other work has demonstrated that stateful federated algorithms in partial participation regimes can perform worse than stateless algorithms due to the state becoming "stale" [48]. Previous methods also do not enable inference on new clients unseen during training, preventing real-world deployment.
26
+
27
+ ![](images/198f287e0066fe3a366e49d5054ddefa5e7b6055fb3e871faa1242b2d6d6a1c0.jpg)
28
+ Figure 1: Schematic of Federated Reconstruction. Model variables are partitioned into global and local variables. For every round $t$ , each participating client $i$ is sent the current global variables, uses them to reconstruct its own local variables, and then updates its copy of the global variables. The server aggregates updates to only the global variables across clients.
29
+
30
+ These limitations motivate a new method for partially local federated learning, balancing the benefits of federated aggregation and local training. This approach should be:
31
+
32
+ 1. Model-agnostic: works with any model.
33
+ 2. Scalable: compatible with large-scale cross-device training with partial participation.
34
+ 3. Practical for inference: new clients can perform inference.
35
+ 4. Fast: clients can quickly adapt local parameters to their personal data.
36
+
37
+ In this work, we propose combining federated training of global parameters with reconstruction of local parameters (see Figure 1). We show that our method relaxes the statefulness requirement of previous work and enables fast personalization for unseen clients without additional communication, even for models without user-specific embeddings.
38
+
39
+ Our contributions: We make the following key contributions:
40
+
41
+ • Introduce a model-agnostic framework for training partially local and partially global models, satisfying the above criteria. We propose a practical algorithm instantiating this framework (FEDRECON).
42
+ Justify the algorithm via a connection to model-agnostic meta learning (see Section 4.2), showing that FEDRECON naturally leads to fast reconstruction at test time (see Table 1).
43
+ Demonstrate FEDRECON’s empirical performance over existing approaches for applications in collaborative filtering and next word prediction, showing that our method outperforms standard centralized and federated training in performance on unseen clients (see Table 1), enables fast adaptation to clients’ personal data (see Figure 3), and matches the performance of other federated personalization techniques with less communication (see Figure 2).
44
+ • Release an open-source library for evaluating algorithms across tasks in this setting.
45
+ • Describe the successful deployment of this approach at scale for collaborative filtering in a real-world mobile keyboard application (see Section 7).
46
+
47
+ # 2 Related Work
48
+
49
+ Previous works have explored personalization of federated models via finetuning [52, 58], meta learning / bi-level optimization [10, 16, 18, 33], and model interpolation [14, 27, 43]. Some works aim to improve training convergence with heterogeneous client gradient updates [35, 39], while others address client resource heterogeneity [15, 49]. All of these approaches require communicating all client parameters during training, which can be unreasonable due to privacy and communication constraints for some models (discussed further in Section 3), which motivates methods that aggregate only part of a model as in our work.
50
+
51
+ Arivazhagan et al. [4] and Liang et al. [41] aggregate part of a model, but these approaches do not meet the criteria from Section 1. Similar to other works proposing local parameters [22, 31, 40], both approaches require clients to maintain local models across rounds, which is problematic when sampling clients from large populations (criterion 2). Arivazhagan et al. [4] assumes that all clients are available for training at all times and do not propose a method for performing inference on new clients (criterion 3). Liang et al. [41] requires new inference clients to be able to ensemble the outputs of all other clients’ local models to evaluate on new data, which is unrealistic in practice due to communication and privacy constraints (criterion 3). These constraints are crucial: with previous methods most clients do not have a practical way to perform inference. Previous methods were also proposed for specific model types (criterion 1): Arivazhagan et al. [4] explores personalization layers after shared base layers and Liang et al. [41] learns personal representations of local data. Finally, as we discuss in Section 4.2, our method optimizes a meta learning objective for training global parameters that lead to fast reconstruction (criterion 4).
52
+
53
+ Federated Collaborative Filtering: We evaluate our approach on collaborative filtering [37] in Section 5.1.1. Prior work has explored federated matrix factorization: Ammad-Ud-Din et al. [2] avoids sending the user matrix to the server by storing it locally, aggregating only the item matrix globally. Chai et al. [9] applies homomorphic encryption to aggregation of the item matrix. Flanagan et al. [20] studies federated collaborative filtering as a multi-view learning problem. Each approach requires clients to maintain state, unlike our method. Ammad-Ud-Din et al. [2] and Chai et al. [9] also do not address the problem of inference on unseen users.
54
+
55
+ Federated Meta Learning: Our approach is motivated by a connection to meta learning, described in Section 4.2. Other federated learning works have also established connections to meta learning: Jiang et al. [33] observed that training a global federated model that can be easily personalized via finetuning can be studied in the model-agnostic meta learning (MAML) framework [19], and FEDAVG is performing the distributed version of the REPTILE meta learning algorithm presented by Nichol et al. [46]. Chen et al. [10], Fallah et al. [18], and Lin et al. [42] apply the MAML algorithm and variants in federated settings. Khodak et al. [36] aims to improve upon these methods by learning client similarities adaptively. These methods do not address the partially local federated learning setting, where some parameters are not aggregated globally.
56
+
57
+ # 3 Partially Local Federated Learning
58
+
59
+ Typically, federated learning of a global model optimizes:
60
+
61
+ $$
62
+ \operatorname* { m i n } _ { \mathbf { x } \in \mathbb { R } ^ { d } } F ( \mathbf { x } ) = \mathbb { E } _ { i \sim \mathcal { P } } [ f _ { i } ( \mathbf { x } ) ]
63
+ $$
64
+
65
+ where $f _ { i } ( \mathbf { x } ) = \mathbb { E } _ { \xi \in \mathcal { D } _ { i } } [ f _ { i } ( \mathbf { x } , \boldsymbol { \xi } ) ]$ is the local objective for client $i , \textbf { x }$ is the $d$ -dimensional model parameter vector, $\mathcal { P }$ is the distribution of clients, and $\xi$ is a data sample drawn from client $i$ ’s data $\mathcal { D } _ { i }$ . In practical cross-device settings, $f _ { i } ( \mathbf { x } )$ may be highly heterogeneous for different $i$ , and the number of available clients may be large and constantly changing due to partial availability. Only a relatively small fraction of clients may be sampled for training.
66
+
67
+ To motivate partially local federated learning, we begin by considering models that can be partitioned into user-specific parameters and non-user-specific parameters. An example is matrix factorization in the collaborative filtering setting [30, 37]: in this scenario, a ratings matrix $R \in \mathbb { R } ^ { U \times I }$ representing user preferences is factorized into a user matrix $P \in \mathbb { R } ^ { U \times K }$ and an items matrix $Q \in \bar { \mathbb { R } ^ { I \times K } }$ such that $\dot { \boldsymbol { R } } \approx \boldsymbol { P } \boldsymbol { Q } ^ { \top }$ , where $U$ is the number of users and $I$ is the number of items. For each user $u$ , this approach yields a $K$ -dimensional user-specific embedding $P _ { u }$ .
68
+
69
+ To train this type of model in the federated setting, we cannot naively use the popular FEDAVG algorithm [44] or other (personalized) algorithms that involving aggregation of all model parameters. A simple application of global learning algorithms might require every client to be sent every other client’s personal parameters, which is clearly unreasonable for both privacy and communication. A more sophisticated approach might be to have each client communicate only their own personal parameters with the server. In this case, the server still has access to individual user parameters, which in this setting can be trivially used to recover sensitive user-item affinities, negating the privacy benefit of not centralizing the data (again unreasonable).
70
+
71
+ Algorithm 1 Federated Reconstruction Training
72
+
73
+ <table><tr><td colspan="2">Input: set of global parameters G,set of local parameters L,dataset split function S,reconstruction algorithm R, client update algorithm U</td></tr><tr><td>Server executes:</td><td></td></tr><tr><td>g(0)← (initialize G) for each round t do</td><td>ClientUpdate:</td></tr><tr><td>S(t) ← (randomly sample m clients)</td><td>(Di,s,Di,q) ← S(Di)</td></tr><tr><td>for each client i ∈ S(t) in parallel do</td><td>(t) ←R(Di,s,L,g(t))</td></tr><tr><td>(△,ni)←ClientUpdate(i,g(t)</td><td>(t) ←U(Di,q,l gi</td></tr><tr><td>end for</td><td>△(t) ↑gi (t) g(t)</td></tr><tr><td>n = ∑ies(t) ni</td><td>ni←|Di,ql</td></tr><tr><td>g(t+1) ←g(t)+ns∑i∈s(t) n end for</td><td>return △(t, n to the server</td></tr></table>
74
+
75
+ Thus a practical federated learning algorithm for this setting should be partially local: it should enable clients to train a subset of parameters entirely on-device. However, approaches that involve stateful clients storing their local parameters across rounds are undesirable in large-scale cross-device settings since clients are unlikely to be sampled repeatedly, causing state to be infrequently available and become stale, degrading performance (Reddi et al. [48] [Sec. 5.1]). Additionally, since only a fraction of clients participate in training, all other clients will be left without trained local parameters, preventing them from performing inference using the model. In a large population setting with hundreds of millions of clients as described in Section 7, this can mean $9 9 \% +$ of clients do not have a complete model, preventing practical deployment. Thus an algorithm for this setting ideally should not depend on stateful clients and should provide a way to perform inference on unseen clients.
76
+
77
+ Though we have motivated partially local federated learning via a setting that contains privacysensitive user-specific parameters, we will later show that this paradigm can also improve robustness to heterogeneity in $f _ { i } ( \mathbf { x } )$ and reduce communication cost, even for models without user-specific parameters. In this case, the partition between local and global parameters is determined by the use-case and communication limitations. As an example, in Section 5.1.2 we motivate a next word prediction use-case, where having a partially local model can be useful for handling diverse client inputs while reducing communication.
78
+
79
+ Achieving partially local federated learning in a practical cross-device setting with large, changing client distribution $\mathcal { P }$ and stateless clients is one of the key contributions of our work.
80
+
81
+ # 4 Federated Reconstruction
82
+
83
+ We now introduce the Federated Reconstruction framework. One of the key insights of our approach is that we can relax the requirement for clients to maintain local parameters across rounds by reconstructing local parameters whenever needed, running a reconstruction algorithm $R$ to recover them. Once a client is finished participating in a round, it can discard its reconstructed local parameters. An overview is presented in Figure 1.
84
+
85
+ Federated Reconstruction training is presented in Algorithm 1. Training proceeds as follows: for each round $t$ , the server sends the current global parameters $g ^ { ( t ) }$ to each selected client. Selected clients split their local data $\mathcal { D } _ { i }$ into a support set $\mathcal { D } _ { i , s }$ and a query set $\mathcal { D } _ { i , q }$ . Each client uses its support set $\mathcal { D } _ { i , s }$ and $g ^ { ( t ) }$ as inputs to reconstruction algorithm $R$ to produce its local parameters $l _ { i } ^ { ( t ) }$ . Then each client then uses its query set $\mathcal { D } _ { i , q }$ , its local parameters $l _ { i } ^ { ( t ) }$ , and the global parameters $g ^ { ( t ) }$ as inputs to update algorithm $U$ to produce updated global parameters $g _ { i } ^ { ( t ) }$ . Finally, the server aggregates updates to global parameters across clients. We describe key steps in further detail below.
86
+
87
+ Dataset Split Step: Clients apply a dataset split function $S$ to their datasets $\mathcal { D } _ { i }$ to produce a support set $\mathcal { D } _ { i , s }$ used for reconstruction and a query set $\mathcal { D } _ { i , q }$ used for updating global parameters. Typically these sets are disjoint to maximize the meta-generalization ability of the model (see Section 4.2), but in Appendix D we show that this assumption may be relaxed if clients don’t have sufficient data to partition.
88
+
89
+ Client Reconstruction Step: Reconstruction of local parameters is performed by algorithm $R$ . Though this algorithm can take other forms, in this work we instantiate $R$ as performing $k _ { r }$ local gradient descent steps on initialized local parameters with the global parameters frozen, using the support set $\mathcal { D } _ { i , s }$ . We show in Section 4.2 this naturally optimizes a well-motivated meta learning objective. Interestingly, this approach is related to gradient-based alternating minimization, a historically successful method for training factored models [26, 32].
90
+
91
+ A potential concern with reconstruction is that this may lead to additional client computation cost compared to storing local parameters on clients. However, since clients are unlikely to be reached repeatedly by large-scale cross-device training, in practice this cost is similar to the cost of initializing these local parameters and training them with stateful clients. Additionally, reconstruction provides a natural way for new clients unseen during training to produce their own partially local models offline (see Section 4.1)–without this step, the vast majority of clients would not be able to use the model. Finally, in Section 4.2 we argue and in Section 5.2 we empirically demonstrate that with our approach just one local gradient descent step can yield successful reconstruction because global parameters are being trained for fast reconstruction of local parameters.
92
+
93
+ Client Update Step: Client updates of global parameters are performed by update algorithm $U$ . In this work we instantiate $U$ as performing $k _ { u }$ local gradient descent steps on the global parameters, using the query set $\mathcal { D } _ { i , q }$ .
94
+
95
+ Server Update Step: We build on the generalized FEDAVG formulation proposed by Reddi et al. [48], treating aggregated global parameter updates as an "antigradient" that can be input into different server optimizers (SGD is shown in Algorithm 1). Note that the server update operates on a weighted average of client updates as in McMahan et al. [44], weighted by $n _ { i } = | \mathcal { D } _ { i , q } |$ .
96
+
97
+ We refer to the instantiation of this framework outlined here as FEDRECON below. We address frequently asked questions about FEDRECON and partially local federated learning in Appendix A.
98
+
99
+ # 4.1 Evaluation and Inference
100
+
101
+ To make predictions with global variables $g$ learned using Algorithm 1, clients can naturally reconstruct their local models just as they do during training, by using $R , g$ , and $\mathcal { D } _ { i , s }$ to produce local parameters $l$ . Then $g$ and $l$ combined make up a fully trained partially local model, which can be evaluated on $\mathcal { D } _ { i , q }$ . We refer to this evaluation approach as RECONEVAL below. Note that this can be applied to clients unseen during training (most clients in large-scale settings), enabling inference for these clients.2
102
+
103
+ Reconstruction for inference is performed offline, independently of any federated process, so clients can perform reconstruction once and store local parameters for repeated use, optionally refreshing them periodically if they have new local data.
104
+
105
+ # 4.2 Connection to Meta Learning
106
+
107
+ Our framework is naturally motivated via meta learning. Given that RECONEVAL involves clients doing (gradient-based) reconstruction using global parameters, we ask: Can we train global parameters conducive to fast reconstruction of local parameters?
108
+
109
+ We can easily formulate this question in the language of model-agnostic meta learning [19]. The heterogeneous client distribution $\mathcal { P }$ corresponds to the heterogeneous distribution of tasks; each round (episode) we sample a batch of clients in the hope of meta-generalizing to unseen clients. Each client has a support dataset for reconstruction and a query dataset for global parameter updates. Our meta-parameters are $g$ and our task-specific parameters are $l _ { i }$ for client $i$ . We want to find $g$ minimizing the objective:
110
+
111
+ $$
112
+ \operatorname { \mathbb { E } } _ { i \sim \mathcal { P } } f _ { i } ( g \parallel l _ { i } ) = \operatorname { \mathbb { E } } _ { i \sim \mathcal { P } } f _ { i } ( g \parallel R ( \mathcal { D } _ { i , s } , \mathcal { L } , g ) ]
113
+ $$
114
+
115
+ where ${ \boldsymbol { g } } \parallel l _ { i }$ denotes the concatenation of $g$ and $l _ { i }$ and $f _ { i } ( g \parallel l _ { i } ) = \mathbb { E } _ { \xi \in \mathcal { D } _ { i , q } } [ f _ { i } ( g \parallel l _ { i } , \xi ) ] ,$ .
116
+
117
+ In Appendix B we show that the instantiation of our framework where $R$ performs $k _ { r } \geq 1$ steps of gradient descent on initialized local parameters using $\mathcal { D } _ { i , s }$ and $U$ performs $k _ { u } = 1$ step of gradient descent using $\mathcal { D } _ { i , q }$ is already minimizing the first-order terms in this objective (i.e., this version of FEDRECON is performing first-order meta learning). Intuitively, reconstruction corresponds to the MAML “inner loop” and the global parameter update corresponds to the “outer loop”; we test the same way we train (via reconstruction), a common pattern in meta learning.
118
+
119
+ Thus FEDRECON trains global parameters $g$ for fast reconstruction of local parameters $l$ , enabling partially local federated learning without requiring clients to maintain state. In Section 5.2 we observe that our method empirically produces $g$ more conducive to fast, performant reconstruction on unseen clients than standard centralized or federated training (e.g., see SERVER $^ +$ RECONEVAL vs. FEDRECON in Table 1). We see in Figure 3 that just one reconstruction step is sufficient to recover the majority of performance.
120
+
121
+ # 5 Experimental Evaluation
122
+
123
+ # 5.1 Tasks and Methods
124
+
125
+ We next describe experiments validating FEDRECON on matrix factorization and next word prediction. We aim to determine whether reconstruction can enable practical partially local federated learning with fast personalization for new clients, including in settings without user-specific embeddings.
126
+
127
+ # 5.1.1 Matrix Factorization
128
+
129
+ We evaluate on federated matrix factorization using the popular MovieLens 1M collaborative filtering dataset [29]. We perform two kinds of evaluation:
130
+
131
+ 1. STANDARDEVAL on seen users, those users who participated in at least one round of federated training. We split each user’s ratings into $80 \%$ train, $10 \%$ validation, and $10 \%$ test by timestamp. We train on all users’ train ratings, and report results on users test ratings.
132
+ 2. RECONEVAL on unseen users, those users who did not participate at all during federated training. We split the users randomly into $80 \%$ train, $10 \%$ validation, and $10 \%$ test; we train with the train users and report results on test users.
133
+
134
+ The model learns $P$ and $Q$ such that $R \approx P Q ^ { \top }$ as discussed in Section 3, with embedding dimensionality $K = 5 0$ . We apply FEDRECON with local user embeddings $P _ { u }$ and global item matrix $Q$ . We report root-mean-square-error (RMSE) and rating prediction accuracy. We compare centralized training, FEDAVG, and FEDRECON in Table 1. See also Appendix C.1 for more details on the dataset, model, and hyperparameter choices.
135
+
136
+ # 5.1.2 Next Word Prediction
137
+
138
+ We also aim to determine whether Federated Reconstruction can be successfully applied in settings without user-specific embeddings to improve robustness to client heterogeneity and communication cost, since our approach is agnostic to which parameters are chosen as local/global. We apply FEDRECON to next word prediction because the task provides a natural motivation for personalization: different clients often have highly heterogeneous data, e.g., if they use different slang, but language models typically have a fixed vocabulary. We propose improving the ability of a language model to capture diverse inputs using local out-of-vocabulary (OOV) embeddings. OOV embeddings are a common application of the hashing trick [54] in deep learning; combining them with FEDRECON enables language models to effectively allow for personal input vocabularies for different clients. For example, if client $i$ frequently uses OOV token $t _ { i }$ and client $j$ uses OOV token $t _ { j }$ , each client’s corresponding local OOV embedding can learn to reflect this (even if the OOV embeddings collide). So adding local OOV embeddings with the core global vocabulary fixed can lead to improved personalization without more communication per round; we will also show that we can reduce the size of the core model (reducing communication) and get further benefits.
139
+
140
+ We perform next word prediction with the federated Stack Overflow dataset introduced in TensorFlow [51]. We use an LSTM model and process data similarly to Reddi et al. [48], comparing to their best
141
+
142
+ Table 1: Movielens matrix factorization root-mean-square-error (lower is better) and rating prediction accuracy (higher is better). STANDARDEVAL is on seen users, RECONEVAL is on held-out users. Results within $2 \%$ of best for each metric are in bold.
143
+
144
+ <table><tr><td></td><td>RMSE↓</td><td>ACCURACY↑</td></tr><tr><td>CENTRALIZED+STANDARDEVAL</td><td>.923</td><td>43.2</td></tr><tr><td>CENTRALIZED+RECONEVAL</td><td>1.36</td><td>40.8</td></tr><tr><td>FEDAVG + STANDARD EVAL</td><td>.939</td><td>41.5</td></tr><tr><td>FEDAVG +RECONEVAL</td><td>.934</td><td>40.0</td></tr><tr><td>FEDRECON(OURS)</td><td>.907</td><td>43.3</td></tr></table>
145
+
146
+ Table 2: Stack Overflow next word prediction accuracy and communication per round, per client. FEDYOGI and OOV/FULL FINETUNING require communication of all model parameters, FEDRECON does not (see Figure 2). Results within $2 \%$ of best for each vocabulary size are in bold.
147
+
148
+ <table><tr><td>VOCAB. SIZE</td><td>1K</td><td>5K</td><td>10K</td><td>COMMUNICATION</td></tr><tr><td>FEDYOGI</td><td>24.3</td><td>26.3</td><td>26.7</td><td>2|+2lg|</td></tr><tr><td>FEDRECON (100V)</td><td>24.1</td><td>26.2</td><td>26.4</td><td>2|gl</td></tr><tr><td>FEDRECON (500 OOV)</td><td>29.6</td><td>28.1</td><td>27.7</td><td>21g</td></tr><tr><td>OOV FINETUNING (500 OOV)</td><td>30.0</td><td>28.1</td><td>27.9</td><td>2|+2lgl</td></tr><tr><td>FULL FINETUNING (500 OOV)</td><td>30.8</td><td>29.2</td><td>28.8</td><td>2||+2|gl</td></tr><tr><td>FEDRECON+FINETUNE (50O OOV)</td><td>30.7</td><td>28.9</td><td>28.6</td><td>2lgl</td></tr></table>
149
+
150
+ FEDYOGI result. To demonstrate that reconstruction can be used to reduce model size, we describe experiments with vocabulary sizes [1000, 5000, 10,000]. See Appendix C.2 for details on the dataset, model, and hyperparameter choices.
151
+
152
+ # 5.2 Results and Discussion
153
+
154
+ In Tables 1 and 2 we present results for matrix factorization and next word prediction for FEDRECON and baselines. We call out several key comparisons below; more results can be found in Appendix D.
155
+
156
+ For the MovieLens task FEDRECON is able to match the performance of CENTRALIZED $^ +$ STANDARD EVAL despite performing a more difficult task: as described in Section 5.1.1, FEDRECON is using RECONEVAL to evaluate on held-out users, reconstructing user embeddings for them and then evaluating. As is typical for server-trained matrix factorization models, CENTRALIZED $^ +$ STANDARD EVAL is only being evaluated on held-out ratings for seen users. Note that we would not be able to evaluate on unseen users since they do not have trained user embeddings (randomly initializing them produces garbage results). If we reconstruct user embeddings for unseen users and then evaluate as in CENTRALIZED $^ +$ RECONEVAL (we argue this is a fairer comparison with FEDRECON), we see that performance is significantly worse than FEDRECON and server-evaluation on seen users. One interesting finding was that the results of this seemed to vary widely across different users, with some users reconstructing embeddings no better than random initialization, while most others reconstructed better embeddings.3 We see a similar result with FEDAVG for the MovieLens task, where FEDAVG with standard evaluation on seen users4 performs a bit worse than CENTRALIZED $^ +$ STANDARD EVAL, and performance for RECONEVAL on unseen users is significantly worse than FEDRECON. This indicates that FEDRECON is doing a better job of training global parameters so they can reconstruct local parameters than other approaches, as motivated in Section 4.2. Moreover, FEDRECON is doing this despite not having direct access to the data or the user-specific parameters–enabling this approach in settings where centralized training or FEDAVG is impossible.
157
+
158
+ ![](images/b19182c05c8df5addd5db9b1ac7dcee1ce46b13bd43fdb0e428aec068a457fed.jpg)
159
+ Figure 2: Accuracy as a function of total parameters communicated across all clients for FEDRECON and baselines for Stack Overflow next word prediction.
160
+
161
+ ![](images/a4fdd7a9d62f3174f7d48dfb6dac275bfe3b9e0619ab1ff8919635a024bd7164.jpg)
162
+ Figure 3: Accuracy compared to base FEDRECON when varying the number of reconstruction steps for local parameters (left plot) and client update steps for global parameters (right plot).
163
+
164
+ In the first section of the Stack Overflow results in Table 2, we compare FEDYOGI (an adaptive variant of FEDAVG introduced by Reddi et al. [48]) with FEDRECON, showing that enabling FEDRECON with 500 local OOV embeddings significantly boosts accuracy for every vocabulary size. Interestingly, we observe that accuracy actually improves for smaller vocabulary sizes for FEDRECON $( 5 0 0 \mathrm { O O V } )$ , whereas the reverse holds for FEDYOGI and FEDRECON (1 OOV). We posit that this is because decreasing the vocabulary size effectively increases the amount of "training data" available for the local part of the model, since OOV embeddings are only used (and trained) when tokens are out-ofvocabulary; this is useful only when the local part of the model has sufficient capacity via the number of OOV embeddings. This hypothesis is consistent with vocabulary coverage: a 10K vocabulary covers $8 6 . 9 \%$ of the tokens in the dataset, a 5K vocabulary covers $8 0 . 1 \%$ , and a 1K vocabulary covers $4 9 . 2 \%$ ; we see that difference in results for FEDRECON $( 5 0 0 \mathrm { O O V } )$ is greater between 1K and 5K than between 5K and 10K. We caution that reducing vocabulary size may be undesirable in some cases: reducing the size of the vocabulary also restricts the output tokens of the model.
165
+
166
+ Comparing with Finetuning: In Table 2 we compare FEDRECON with FINETUNING [52, 58] to study whether reconstruction can provide similar benefits as global personalization methods. In our implementation we train a fully global model using FEDYOGI, perform local gradient steps to finetune part of the model using the support set, and then evaluate on the query set (same sets as used for FEDRECON). For OOV FINETUNING, the OOV parameters only are finetuned using the support set (comparable to FEDRECON), and for FULL FINETUNING all parameters are finetuned. Comparing FEDRECON $( 5 0 0 \ \mathrm { O O V } )$ and OOV FINETUNING, we see that reconstructing local embeddings performs similarly to finetuning pre-trained OOV embeddings, despite FEDRECON not communicating the local parameters $l$ to the server. FULL FINETUNING from Table 2 achieves better accuracy since all parameters are finetuned. To compare this fairly with reconstruction, we perform FEDRECON $^ +$ FINETUNE, where the support set is used first to reconstruct local parameters and then to finetune global parameters before evaluation. We also see that we can get comparable results, indicating that reconstruction can enable personalization on (potentially privacy-sensitive) local parameters while reducing communication. See Figure 2 for a comparison of different approaches by the total number of parameters communicated–we see an advantage for FEDRECON, particularly for lower total communication.
167
+
168
+ Varying Reconstruction Steps: In Section 4.2 we described a connection between our framework and MAML [19], which has been a successful paradigm for fast adaptation to tasks with few steps. In Figure 3 we perform FEDRECON for varying numbers of reconstruction steps $k _ { r } \in [ 0 , 1 , 2 , 5 , 1 0 ]$ and plot the accuracy as a fraction of accuracy across tasks from Tables 1 and 2. We see that for zero reconstruction steps (an ablation skipping reconstruction), MovieLens accuracy is 0.0, as expected (all user embeddings are randomly initialized). Relative accuracy for Stack Overflow NWP settings remains above $90 \%$ , suggesting that for this task clients can still perform inference with a FEDRECON-trained model even without any data to reconstruct. Importantly, just one reconstruction step is required to recover the majority of remaining performance across both tasks, indicating that FEDRECON learns global parameters conducive to fast reconstruction.
169
+
170
+ Varying Client Update Steps: In Section 4.2 we showed that gradient-based FEDRECON, involving $k _ { r } \geq 1$ reconstruction steps and $k _ { u } = 1$ client update steps, is minimizing a first-order meta learning objective for training global parameters that yield good reconstructions. In Figure 3 we perform FEDRECON with $k _ { u } \in [ 1 , 2 , 5 , 1 0 ]$ and compute relative accuracy as a fraction of accuracy across tasks from Tables 1 and 2. For each experiment we run for a fixed number of rounds. We see that 1 step recovers almost all of the accuracy and adding more steps gradually increases accuracy further. Interestingly, we observe that for $k _ { u } = 1$ training proceeds significantly slower than for other values such that performance is still slightly increasing after the fixed number of rounds. This is analogous to the difference between FEDAVG and FEDSGD [44]. While FEDSGD is optimizing the original learning objective, FEDAVG often achieves similar performance in significantly fewer rounds by adding multiple gradient steps on aggregated parameters.
171
+
172
+ We present further baselines and ablations in Appendix D.
173
+
174
+ # 6 Open-Source Library
175
+
176
+ We are releasing a code framework for expressing and evaluating practical partially local federated models built on the popular TensorFlow Federated library [50]. The code is released under Apache License 2.0. In addition to allowing for easy reproduction of our experiments, the framework provides a flexible, well-documented interface for researchers and modelers to run simulations in this setting with models and tasks of their choice. Users can take any existing Keras model and plug it into this framework with just a few lines of code. We provide libraries for training and evaluation for MovieLens matrix factorization and Stack Overflow next word prediction, which can be easily extended for new tasks. We hope that the release of this framework spurs further research and lowers the barrier to more practical applications.
177
+
178
+ # 7 Deployment in a Mobile Keyboard Application
179
+
180
+ A key differentiator of our method is that it scales to practical training and inference in cross-device settings with large populations. To validate this, we deployed FEDRECON to a mobile keyboard application with hundreds of millions of federated learning clients. We used a system similar to Bonawitz et al. [7] to deploy FEDRECON for training. Note that the system does not support stateful clients given the issues with large-scale stateful training described in Section 4, so a stateless approach was necessary for deployment.
181
+
182
+ Users of the mobile keyboard application often use expressions (GIFs, stickers) to communicate with others in e.g., chat applications. Different users are highly heterogeneous in the style of expressions they use, which makes the problem a natural fit for collaborative filtering to predict new expressions a user might want to share. We trained matrix factorization models as described in Section 5.1.1, where the number of items ranged from hundreds to tens of thousands depending on the type of expression.
183
+
184
+ Training in production brought challenges due to data sparsity. Depending on the task, some clients had very few examples, if e.g., they didn’t commonly share stickers via the keyboard application. To ensure clients with just one example weren’t just adding noise to the training process by participating, we oversampled clients and filtered out the contributions of clients without at least some number of examples. We reused examples between the support and query sets as described in Appendix D to ensure all examples were used for both reconstruction and global updates.
185
+
186
+ Another practical challenge we faced was orthogonal to our method and commonly faced in realworld federated learning applications: heterogeneity in client resources and availability meant that some participating clients would drop out before sending updates to the server. We found that the simple strategy of oversampling clients and neglecting updates from dropped-out clients appeared to perform well, but we believe studying the fairness implications of this is a valuable area for future work.
187
+
188
+ After successful training, the resulting model was deployed for inference in predicting potential new expressions a user might share, which led to an increase of $2 9 . 3 \%$ in click-through-rate for expression recommendations. We hope that this successful deployment of FEDRECON demonstrates the practicality of our approach and leads the way for further real-world applications.
189
+
190
+ # 8 Conclusion
191
+
192
+ We introduced Federated Reconstruction, a model-agnostic framework for fast partially local federated learning suitable for training and inference at scale. We justified FEDRECON via a connection to meta learning and empirically validated the algorithm for collaborative filtering and next message prediction, showing that it can improve performance on unseen clients and enable fast personalization with less communication. We also released an open-source library for partially local federated learning and described a successful production deployment. Future work may explore the optimal balance of local and global parameters and the application of differential privacy to global parameters (see Appendix E).
193
+
194
+ # Acknowledgments and Disclosure of Funding
195
+
196
+ We thank Brendan McMahan, Lin Ning, Zachary Charles, Warren Morningstar, Daniel Ramage, Jakub Konecnˇ ý, Blaise Agüera y Arcas, and Jay Yagnik from Google Research for their helpful comments and discussions. We also thank Wei Li, Matt Newton, and Yang Lu for their collaboration towards deployment.
197
+
198
+ # References
199
+
200
+ [1] Martin Abadi, Andy Chu, Ian Goodfellow, H Brendan McMahan, Ilya Mironov, Kunal Talwar, and Li Zhang. 2016. Deep learning with differential privacy. In Proceedings of the 2016 ACM SIGSAC Conference on Computer and Communications Security. 308–318.
201
+ [2] Muhammad Ammad-Ud-Din, Elena Ivannikova, Suleiman A Khan, Were Oyomno, Qiang Fu, Kuan Eeik Tan, and Adrian Flanagan. 2019. Federated Collaborative Filtering for PrivacyPreserving Personalized Recommendation System. arXiv preprint arXiv:1901.09888 (2019).
202
+ [3] Apple. 2019. Designing for Privacy (video and slide deck). Apple WWDC, https: //developer.apple.com/videos/play/wwdc2019/708.
203
+ [4] Manoj Ghuhan Arivazhagan, Vinay Aggarwal, Aaditya Kumar Singh, and Sunav Choudhary. 2019. Federated learning with personalization layers. arXiv preprint arXiv:1912.00818 (2019).
204
+ [5] Raef Bassily, Vitaly Feldman, Kunal Talwar, and Abhradeep Thakurta. 2019. Private Stochastic Convex Optimization with Optimal Rates. CoRR abs/1908.09970 (2019). arXiv:1908.09970 http://arxiv.org/abs/1908.09970
205
+ [6] Raef Bassily, Adam D. Smith, and Abhradeep Thakurta. 2014. Private Empirical Risk Minimization, Revisited. CoRR abs/1405.7085 (2014). arXiv:1405.7085 http://arxiv.org/ abs/1405.7085
206
+ [7] Keith Bonawitz, Hubert Eichner, Wolfgang Grieskamp, Dzmitry Huba, Alex Ingerman, Vladimir Ivanov, Chloe Kiddon, Jakub Konecnˇ y, Stefano Mazzocchi, H Brendan McMahan, et al \` . 2019. Towards federated learning at scale: System design. arXiv preprint arXiv:1902.01046 (2019).
207
+ [8] Keith Bonawitz, Vladimir Ivanov, Ben Kreuter, Antonio Marcedone, H Brendan McMahan, Sarvar Patel, Daniel Ramage, Aaron Segal, and Karn Seth. 2017. Practical secure aggregation for privacy-preserving machine learning. In Proceedings of the 2017 ACM SIGSAC Conference on Computer and Communications Security. 1175–1191.
208
+ [9] Di Chai, Leye Wang, Kai Chen, and Qiang Yang. 2020. Secure federated matrix factorization. IEEE Intelligent Systems (2020).
209
+ [10] Fei Chen, Mi Luo, Zhenhua Dong, Zhenguo Li, and Xiuqiang He. 2018. Federated metalearning with fast convergence and efficient communication. arXiv preprint arXiv:1802.07876 (2018).
210
+ [11] NVIDIA Clara. 2019. The Clara Training Framework Authors. https://developer. nvidia.com/clara
211
+ [12] Creative Commons. 2002. Attribution-ShareAlike 3.0 Unported. https:// creativecommons.org/licenses/by-sa/3.0/
212
+ [13] Walter de Brouwer. 2019. The Federated Future is ready for shipping. https://doc.ai/ blog/federated-future-ready-shipping/.
213
+ [14] Yuyang Deng, Mohammad Mahdi Kamani, and Mehrdad Mahdavi. 2020. Adaptive Personalized Federated Learning. arXiv preprint arXiv:2003.13461 (2020).
214
+ [15] Enmao Diao, Jie Ding, and Vahid Tarokh. 2020. HeteroFL: Computation and communication efficient federated learning for heterogeneous clients. arXiv preprint arXiv:2010.01264 (2020).
215
+ [16] Canh T Dinh, Nguyen H Tran, and Tuan Dung Nguyen. 2020. Personalized federated learning with Moreau envelopes. arXiv preprint arXiv:2006.08848 (2020).
216
+ [17] Cynthia Dwork, Aaron Roth, et al. 2014. The algorithmic foundations of differential privacy. Foundations and Trends in Theoretical Computer Science 9, 3-4 (2014), 211–407.
217
+ [18] Alireza Fallah, Aryan Mokhtari, and Asuman Ozdaglar. 2020. Personalized federated learning: A meta-learning approach. arXiv preprint arXiv:2002.07948 (2020).
218
+ [19] Chelsea Finn, Pieter Abbeel, and Sergey Levine. 2017. Model-agnostic meta-learning for fast adaptation of deep networks. arXiv preprint arXiv:1703.03400 (2017).
219
+ [20] Adrian Flanagan, Were Oyomno, Alexander Grigorievskiy, Kuan Eeik Tan, Suleiman A Khan, and Muhammad Ammad-Ud-Din. 2020. Federated Multi-view Matrix Factorization for Personalized Recommendations. arXiv preprint arXiv:2004.04256 (2020).
220
+ [21] Dashan Gao, Ben Tan, Ce Ju, Vincent W Zheng, and Qiang Yang. 2020. Privacy Threats Against Federated Matrix Factorization. arXiv preprint arXiv:2007.01587 (2020).
221
+ [22] Suyu Ge, Fangzhao Wu, Chuhan Wu, Tao Qi, Yongfeng Huang, and Xing Xie. 2020. Fedner: Privacy-preserving medical named entity recognition with federated learning. arXiv preprint arXiv:2003.09288 (2020).
222
+ [23] Jonas Geiping, Hartmut Bauermeister, Hannah Dröge, and Michael Moeller. 2020. Inverting Gradients–How easy is it to break privacy in federated learning? arXiv preprint arXiv:2003.14053 (2020).
223
+ [24] Robin C Geyer, Tassilo Klein, and Moin Nabi. 2017. Differentially private federated learning: A client level perspective. arXiv preprint arXiv:1712.07557 (2017).
224
+ [25] GroupLens. 2015. MovieLens 1M License. https://files.grouplens.org/datasets/ movielens/ml-1m-README.txt
225
+ [26] Asela Gunawardana, William Byrne, and Michael I Jordan. 2005. Convergence Theorems for Generalized Alternating Minimization Procedures. Journal of machine learning research 6, 12 (2005).
226
+ [27] Filip Hanzely and Peter Richtárik. 2020. Federated learning of a mixture of global and local models. arXiv preprint arXiv:2002.05516 (2020).
227
+ [28] Andrew Hard, Kanishka Rao, Rajiv Mathews, Swaroop Ramaswamy, Françoise Beaufays, Sean Augenstein, Hubert Eichner, Chloé Kiddon, and Daniel Ramage. 2018. Federated learning for mobile keyboard prediction. arXiv preprint arXiv:1811.03604 (2018).
228
+ [29] F Maxwell Harper and Joseph A Konstan. 2015. The movielens datasets: History and context. Acm transactions on interactive intelligent systems (tiis) 5, 4 (2015), 1–19.
229
+
230
+ [30] Yifan Hu, Yehuda Koren, and Chris Volinsky. 2008. Collaborative filtering for implicit feedback datasets. In 2008 Eighth IEEE International Conference on Data Mining. Ieee, 263–272.
231
+
232
+ [31] Yutao Huang, Lingyang Chu, Zirui Zhou, Lanjun Wang, Jiangchuan Liu, Jian Pei, and Yong Zhang. 2021. Personalized cross-silo federated learning on non-iid data. In Proceedings of the AAAI Conference on Artificial Intelligence, Vol. 35. 7865–7873.
233
+
234
+ [32] Prateek Jain, Praneeth Netrapalli, and Sujay Sanghavi. 2013. Low-rank matrix completion using alternating minimization. In Proceedings of the forty-fifth annual ACM symposium on Theory of computing. 665–674.
235
+
236
+ [33] Yihan Jiang, Jakub Konecnˇ y, Keith Rush, and Sreeram Kannan. 2019. Improving federated \` learning personalization via model agnostic meta learning. arXiv preprint arXiv:1909.12488 (2019).
237
+
238
+ [34] Peter Kairouz, H Brendan McMahan, Brendan Avent, Aurélien Bellet, Mehdi Bennis, Arjun Nitin Bhagoji, Keith Bonawitz, Zachary Charles, Graham Cormode, Rachel Cummings, et al. 2019. Advances and open problems in federated learning. arXiv preprint arXiv:1912.04977 (2019).
239
+
240
+ [35] Sai Praneeth Karimireddy, Satyen Kale, Mehryar Mohri, Sashank Reddi, Sebastian Stich, and Ananda Theertha Suresh. 2020. Scaffold: Stochastic controlled averaging for federated learning. In International Conference on Machine Learning. PMLR, 5132–5143.
241
+
242
+ [36] Mikhail Khodak, Maria-Florina F Balcan, and Ameet S Talwalkar. 2019. Adaptive gradientbased meta-learning methods. In Advances in Neural Information Processing Systems. 5917– 5928.
243
+
244
+ [37] Yehuda Koren, Robert Bell, and Chris Volinsky. 2009. Matrix factorization techniques for recommender systems. Computer 42, 8 (2009), 30–37.
245
+
246
+ [38] Tian Li, Anit Kumar Sahu, Ameet Talwalkar, and Virginia Smith. 2020. Federated learning: Challenges, methods, and future directions. IEEE Signal Processing Magazine 37, 3 (2020), 50–60.
247
+
248
+ [39] Tian Li, Anit Kumar Sahu, Manzil Zaheer, Maziar Sanjabi, Ameet Talwalkar, and Virginia Smith. 2018. Federated optimization in heterogeneous networks. arXiv preprint arXiv:1812.06127 (2018).
249
+
250
+ [40] Xiaoxiao Li, Meirui Jiang, Xiaofei Zhang, Michael Kamp, and Qi Dou. 2021. Fedbn: Federated learning on non-iid features via local batch normalization. arXiv preprint arXiv:2102.07623 (2021).
251
+
252
+ [41] Paul Pu Liang, Terrance Liu, Liu Ziyin, Ruslan Salakhutdinov, and Louis-Philippe Morency. 2020. Think locally, act globally: Federated learning with local and global representations. arXiv preprint arXiv:2001.01523 (2020).
253
+
254
+ [42] Yujie Lin, Pengjie Ren, Zhumin Chen, Zhaochun Ren, Dongxiao Yu, Jun Ma, Maarten de Rijke, and Xiuzhen Cheng. 2020. Meta Matrix Factorization for Federated Rating Predictions. In Proceedings of the 43rd International ACM SIGIR Conference on Research and Development in Information Retrieval. 981–990.
255
+
256
+ [43] Yishay Mansour, Mehryar Mohri, Jae Ro, and Ananda Theertha Suresh. 2020. Three approaches for personalization with applications to federated learning. arXiv preprint arXiv:2002.10619 (2020).
257
+
258
+ [44] Brendan McMahan, Eider Moore, Daniel Ramage, Seth Hampson, and Blaise Aguera y Arcas. 2017. Communication-efficient learning of deep networks from decentralized data. In Artificial Intelligence and Statistics. PMLR, 1273–1282.
259
+
260
+ [45] H Brendan McMahan, Daniel Ramage, Kunal Talwar, and Li Zhang. 2017. Learning differentially private recurrent language models. arXiv preprint arXiv:1710.06963 (2017).
261
+
262
+ [46] Alex Nichol, Joshua Achiam, and John Schulman. 2018. On first-order meta-learning algorithms. arXiv preprint arXiv:1803.02999 (2018).
263
+ [47] Valeria Nikolaenko, Stratis Ioannidis, Udi Weinsberg, Marc Joye, Nina Taft, and Dan Boneh. 2013. Privacy-preserving matrix factorization. In Proceedings of the 2013 ACM SIGSAC conference on Computer & communications security. 801–812.
264
+ [48] Sashank Reddi, Zachary Charles, Manzil Zaheer, Zachary Garrett, Keith Rush, Jakub Konecnˇ y,\` Sanjiv Kumar, and H Brendan McMahan. 2020. Adaptive Federated Optimization. arXiv preprint arXiv:2003.00295 (2020).
265
+ [49] Virginia Smith, Chao-Kai Chiang, Maziar Sanjabi, and Ameet Talwalkar. 2017. Federated multi-task learning. arXiv preprint arXiv:1705.10467 (2017).
266
+ [50] TensorFlow. 2019. TensorFlow Federated. https://www.tensorflow.org/federated
267
+ [51] TensorFlow. 2019. TensorFlow Federated Stack Overflow Dataset. https: //www.tensorflow.org/federated/api_docs/python/tff/simulation/datasets/ stackoverflow/load_data
268
+ [52] Kangkang Wang, Rajiv Mathews, Chloé Kiddon, Hubert Eichner, Françoise Beaufays, and Daniel Ramage. 2019. Federated evaluation of on-device personalization. arXiv preprint arXiv:1910.10252 (2019).
269
+ [53] Wenqi Wei, Ling Liu, Margaret Loper, Ka-Ho Chow, Mehmet Emre Gursoy, Stacey Truex, and Yanzhao Wu. 2020. A framework for evaluating gradient leakage attacks in federated learning. arXiv preprint arXiv:2004.10397 (2020).
270
+ [54] Kilian Weinberger, Anirban Dasgupta, John Langford, Alex Smola, and Josh Attenberg. 2009. Feature hashing for large scale multitask learning. In Proceedings of the 26th annual international conference on machine learning. 1113–1120.
271
+ [55] Xi Wu, Arun Kumar, Kamalika Chaudhuri, Somesh Jha, and Jeffrey F. Naughton. 2016. Differentially Private Stochastic Gradient Descent for in-RDBMS Analytics. CoRR abs/1606.04722 (2016). arXiv:1606.04722 http://arxiv.org/abs/1606.04722
272
+ [56] Timothy Yang, Galen Andrew, Hubert Eichner, Haicheng Sun, Wei Li, Nicholas Kong, Daniel Ramage, and Françoise Beaufays. 2018. Applied federated learning: Improving google keyboard query suggestions. arXiv preprint arXiv:1812.02903 (2018).
273
+ [57] Hongxu Yin, Arun Mallya, Arash Vahdat, Jose M Alvarez, Jan Kautz, and Pavlo Molchanov. 2021. See through Gradients: Image Batch Recovery via GradInversion. arXiv preprint arXiv:2104.07586 (2021).
274
+ [58] Tao Yu, Eugene Bagdasaryan, and Vitaly Shmatikov. 2020. Salvaging federated learning by local adaptation. arXiv preprint arXiv:2002.04758 (2020).
275
+ [59] Ligeng Zhu and Song Han. 2020. Deep leakage from gradients. In Federated Learning. Springer, 17–31.
md/train/HkCsm6lRb/HkCsm6lRb.md ADDED
@@ -0,0 +1,425 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GENERATIVE MODELS OF VISUALLY GROUNDED IMAGINATION
2
+
3
+ Ramakrishna Vedantam∗ Georgia Tech vrama@gatech.edu
4
+
5
+ Ian Fischer
6
+ Google Inc.
7
+ iansf@google.com Jonathan Huang
8
+ Google Inc.
9
+ jonathanhuang@google.com
10
+
11
+ Kevin Murphy Google Inc. kpmurphy@google.com
12
+
13
+ # ABSTRACT
14
+
15
+ It is easy for people to imagine what a man with pink hair looks like, even if they have never seen such a person before. We call the ability to create images of novel semantic concepts visually grounded imagination. In this paper, we show how we can modify variational auto-encoders to perform this task. Our method uses a novel training objective, and a novel product-of-experts inference network, which can handle partially specified (abstract) concepts in a principled and efficient way. We also propose a set of easy-to-compute evaluation metrics that capture our intuitive notions of what it means to have good visual imagination, namely correctness, coverage, and compositionality (the $3 \ : C ' s$ ). Finally, we perform a detailed comparison of our method with two existing joint image-attribute VAE methods (the JMVAE method of Suzuki et al. (2017) and the BiVCCA method of Wang et al. (2016b)) by applying them to two datasets: the MNIST-with-attributes dataset (which we introduce here), and the CelebA dataset (Liu et al., 2015).
16
+
17
+ # 1 INTRODUCTION
18
+
19
+ Consider the following two-party communication game: a speaker thinks of a visual concept $C$ , such as “men with black hair”, and then generates a description $\mathbf { y }$ of this concept, which she sends to a listener; the listener interprets the description y, by creating an internal representation $\mathbf { z }$ , which captures its “meaning”. We can think of $\mathbf { z }$ as representing a set of “mental images” which depict the concept $C$ . To test whether the listener has correctly “understood” the concept, we ask him to draw a set of real images $S = \{ \mathbf { x } _ { s } : s = 1 : S \}$ , which depict the concept $C$ . He then sends these back to the speaker, who checks to see if the images correctly match the concept $C$ . We call this process visually grounded imagination.
20
+
21
+ In this paper, we represent concept descriptions in terms of a fixed length vector of discrete attributes $\mathcal { A }$ . This allows us to specify an exponentially large set of concepts using a compact, combinatorial representation. In particular, by specifying different subsets of attributes, we can generate concepts at different levels of granularity or abstraction. We can arrange these concepts into a compositional abstraction hierarchy, as shown in Figure 1. This is a directed acyclic graph (DAG) in which nodes represent concepts, and an edge from a node to its parent is added whenever we drop one of the attributes from the child’s concept definition. Note that we dont make any assumptions about the order in which the attributes are dropped (that is, dropping the attribute “smiling” is just as valid as dropping “female” in Figure 1). Thus, the tree shown in the figure is just a subset extracted from the full DAG of concepts, shown for illustration purposes.
22
+
23
+ We can describe a concept by creating the attribute vector $\mathbf { y } _ { \mathcal { O } }$ , in which we only specify the value of the attributes in the subset $\mathcal { O } \subseteq A$ ; the remaining attributes are unspecified, and are assumed to take all possible legal values. For example, consider the following concepts, in order of increasing abstraction: $C _ { m s b } =$ (male, smiling, blackhair), $C _ { * s b } = ( *$ , smiling, blackhair), and $C _ { * * b } = ( * , * , \mathrm { b l a c k h a i r } )$ , where the attributes are gender, smiling or not, and hair color, and $^ *$ represents “don’t care”. A good model should be able to generate images from different levels of the abstraction hierarchy, as shown in Figure 1. (This is in contrast to most prior work on conditional generative models of images, which assume that all attributes are fully specified, which corresponds to sampling only from leaf nodes in the hierarchy.)
24
+
25
+ ![](images/df5ae9ce9cf733cf7373f02ab07cee5213fc9e1882dff1aa502a1f29fdf95c60.jpg)
26
+ Figure 1: A compositional abstraction hierarchy for faces, derived from 3 attributes: hair color, smiling or not, and gender. We show a set of sample images generated by our model, when trained on CelebA, for different nodes in this hierarchy.
27
+
28
+ In Section 2, we show how we can extend the variational autoencoder (VAE) framework of Kingma & Welling (2014) to create models which can perform this task. The first extension is to modify the model to the “multi-modal” setting where we have both an image, x, and an attribute vector, y. More precisely, we assume a joint generative model of the form $\begin{array} { r } { p ( \mathbf { x } , \mathbf { y } , \mathbf { z } ) = p ( \mathbf { z } ) p ( \mathbf { x } | \mathbf { z } ) p ( \mathbf { y } | \mathbf { z } ) } \end{array}$ , where $p ( \mathbf { z } )$ is the prior over the latent variable $\mathbf { z }$ , $p ( \mathbf { x } | \mathbf { z } )$ is our image decoder, and $p ( \mathbf { y } \vert \mathbf { z } )$ is our description decoder. We additionally assume that the description decoder factorizes over the specified attributes in the description, so $\begin{array} { r } { p ( \mathbf { \dot { y } } _ { \mathcal { O } } | \mathbf { z } ) = \prod _ { k \in \mathcal { O } } p ( y _ { k } | \mathbf { z } ) } \end{array}$ .
29
+
30
+ We further extend the VAE by devising a novel objective function, which we call the TELBO, for training the model from paired data, $\bar { \cal D } \bar { \bf \Delta } = \{ ( { \bf x } _ { n } , { \bf y } _ { n } ) \}$ . However, at test time, we will allow unpaired data (either just a description or just an image). Hence we fit three inference networks: $q ( \mathbf { z } | \mathbf { x } , \mathbf { y } )$ , $q ( \mathbf { z } | \mathbf { x } )$ and $q ( \mathbf { z } | \mathbf { y } )$ . This way we can embed an image or a description into the same shared latent space (using $q ( \mathbf { z } | \mathbf { x } )$ and $q ( \mathbf { z } | \mathbf { y } )$ , respectively); this lets us “translate” images into descriptions or vice versa, by computing $\begin{array} { r } { p ( \mathbf { y } | \mathbf { x } ) = \int d \mathbf { z } \ p ( \mathbf { y } | \mathbf { z } ) q ( \mathbf { z } | \mathbf { x } ) } \end{array}$ and $\begin{array} { r } { p ( \mathbf { x } | \mathbf { y } ) = \int d \mathbf { z } \ p ( \mathbf { x } | \mathbf { z } ) q ( \mathbf { z } | \mathbf { y } ) } \end{array}$ .
31
+
32
+ To handle abstract concepts (i.e., partially observed attribute vectors), we use a method based on the product of experts (POE) (Hinton, 2002). In particular, our inference network for attributes has the form $\begin{array} { r } { q ( \mathbf { z } | \mathbf { y } _ { \mathcal { O } } ) \propto p ( \mathbf { z } ) \prod _ { k \in \mathcal { O } } q ( \mathbf { z } | \mathbf { y } _ { k } ) } \end{array}$ . If no attributes are specified, the posterior is equal to the prior. As we condition on more attributes, the posterior becomes narrower, which corresponds to specifying a more precise concept. This enables us to generate a more diverse set of images to represent abstract concepts, and a less diverse set of images to represent concrete concepts, as we show below.
33
+
34
+ Section 3 discusses how to evaluate the performance of our method in an objective way. Specifically, we first “ground” the description by generating a set of images, $\begin{array} { r } { \mathcal { S } ( \mathbf { y } _ { \mathcal { O } } ) = \{ \mathbf { x } ^ { s } \sim p ( \mathbf { x } | \mathbf { y } _ { \mathcal { O } } ) : s = 1 : } \end{array}$ $S \}$ . We then check that all the sampled images in $\scriptstyle { S ( \mathbf { y } _ { \mathcal { O } } ) }$ are consistent with the specified attributes $\mathbf { y } _ { \mathcal { O } }$ (we call this correctness). We also check that the set of images “spans” the extension of the concept, by exhibiting suitable diversity (c.f. (Young et al., 2014)). Concretely, we check that the attributes that were not specified (e.g., gender in $C _ { * s b }$ above) vary across the different images; we call this coverage. Finally, we want the set of images to have high correctness and coverage even if the concept $\mathbf { y } _ { \mathcal { O } }$ has a combination of attribute values that have not been seen in training. For example, if we train on $C _ { m s b } =$ (male, smiling, blackhair), and ${ C _ { f n b } = }$ (female, notsmiling, blackhair), we should be able to test on $C _ { m n b } =$ (male, notsmiling, blackhair), and $C _ { f s b } =$ (female, smiling, blackhair). We will call this property compositionality. Being able to generate plausible images in response to truly compositionally novel queries is the essence of imagination. Together, we call these criteria the 3 C’s of visual imagination.
35
+
36
+ Section 5 reports experimental results on two different datasets. The first dataset is a modified version of MNIST, which we call MNIST-with-attributes (or MNIST-A), in which we “render” modified versions of a single MNIST digit on a $6 4 \mathrm { x } 6 4$ canvas, varying its location, orientation and size. The second dataset is CelebA (Liu et al., 2015), which consists of over $2 0 0 \mathrm { k }$ face images, annotated with 40 binary attributes. We show that our method outperforms previous methods on these datasets.
37
+
38
+ The contributions of this paper are threefold. First, we present a novel extension to VAEs in the multimodal setting, introducing a principled new training objective (the TELBO), and deriving an interpretation of a previously proposed objective (JMVAE) (Wang et al., 2016a) as a valid alternative in Appendix A.1. Second, we present a novel way to handle missing data in inference networks based on a product of experts. Third, we present novel criteria (the 3 C’s) for evaluating conditional generative models of images, that extends prior work by considering the notion of visual abstraction and imagination.
39
+
40
+ # 2 METHODS
41
+
42
+ We start by describing standard VAEs, to introduce notation. We then discuss our extensions to handle the multimodal and the missing input settings.
43
+
44
+ Standard VAEs. A variational autoencoder (Kingma & Welling, 2014) is a latent variable model of the form $p _ { \pmb { \theta } } ( \mathbf { x } , \mathbf { z } ) = p _ { \pmb { \theta } } ( \mathbf { z } ) p _ { \pmb { \theta } } ( \mathbf { x } | \mathbf { z } )$ , where $p _ { \pmb { \theta } } ( \mathbf { z } )$ is the prior (we assume it is Gaussian, $p _ { \pmb { \theta } } ( \mathbf { z } ) =$ $\mathcal { N } ( \mathbf { z } | \mathbf { 0 } , \mathbf { I } )$ , although this assumption can be relaxed), and $p _ { \pmb { \theta } } ( \mathbf { x } | \mathbf { z } )$ is the likelihood (sometimes called the decoder), usually represented by a neural network. To perform approximate posterior inference, we fit an inference network (sometimes called the encoder) of the form $q _ { \phi } ( \mathbf { z } | \mathbf { x } )$ , so as to maximize $\mathcal { L } ( \pmb \theta , \phi ) = \mathbb { E } _ { \hat { p } ( \mathbf { x } ) } [ \mathrm { e l b o } ( \mathbf { x } , \pmb \theta , \phi ) ]$ , where $\begin{array} { r } { \hat { p } ( \mathbf x ) = \frac { 1 } { N } \sum _ { n = 1 } ^ { N } \delta _ { \mathbf x _ { n } } ( \mathbf x ) } \end{array}$ is the empirical distribution, and ELBO is the evidence lower bound:
45
+
46
+ $$
47
+ \mathrm { e l b o } _ { \lambda , \beta } ( \mathbf { x } , \pmb { \theta } , \phi ) = \mathbb { E } _ { q _ { \phi } ( \mathbf { z } | \mathbf { x } , \phi ) } \left[ \lambda \log p _ { \theta } ( \mathbf { x } | \mathbf { z } ) \right] - \beta \mathrm { K L } ( q _ { \phi } ( \mathbf { z } | \mathbf { x } ) , p _ { \theta } ( \mathbf { z } ) )
48
+ $$
49
+
50
+ Here $\mathrm { K L } ( p , q )$ is the Kullback Leibler divergence between distributions $p$ and $q$ . By default, $\beta =$ $\lambda = 1$ , in which case we will just write $\mathrm { e l b o } ( { \bf x } , \pmb { \theta } , \phi )$ . However, by using $\beta > 1$ we can encourage the posterior to be closer to the factorial prior $p ( \mathbf { z } ) = \mathcal { N } ( \mathbf { z } | \mathbf { 0 } , \mathbf { I } )$ , which encouarges the latent factors to be “disentangled”, as proved in Achille $\&$ Soatto (2017); this is known as the $\beta$ -VAE trick (Higgins et al., 2017a). And allowing $\lambda > 1$ will be useful later, when we have multiple modalities.
51
+
52
+ Joint VAEs and the TELBO. We extend the VAE to model images and attributes by defining the joint distribution $\begin{array} { r } { p _ { \pmb { \theta } } ( \mathbf { x } , \mathbf { y } , \mathbf { z } ) = p _ { \pmb { \theta } } ( \mathbf { z } ) p _ { \pmb { \theta } } ( \mathbf { x } | \mathbf { z } ) p _ { \pmb { \theta } } ( \mathbf { y } | \mathbf { z } ) } \end{array}$ , where $p _ { \pmb { \theta } } ( \mathbf { x } | \mathbf { z } )$ is the image decoder (we use the DCGAN architecture from Radford et al. (2016)), and $p _ { \pmb { \theta } } ( \mathbf { y } | \mathbf { z } )$ is an MLP for the attribute vector. The corresponding training objective which we want to maximize becomes ${ \mathcal { L } } ( \theta , \phi ) =$ $\mathbb { E } _ { \hat { p } ( \mathbf { x } , \mathbf { y } ) } \left[ \mathrm { e l b o } ( \mathbf { x } , \mathbf { y } , \pmb { \theta } , \phi ) \right]$ , where $\begin{array} { r } { \hat { p } ( \mathbf x , \mathbf y ) = \frac { 1 } { N } \sum _ { n = 1 } ^ { N } \delta _ { \mathbf x _ { n } } ( \mathbf x ) \delta _ { \mathbf y _ { n } } ( \mathbf y _ { n } ) } \end{array}$ is the empirical distribution derived from paired data, and the joint ELBO is given by
53
+
54
+ $$
55
+ \begin{array} { r l r } & { } & { \mathrm { e l b o } _ { \lambda _ { x } , \lambda _ { y } , \beta } ( { \bf x } , { \bf y } , \pmb { \theta } _ { x } , \pmb { \theta } _ { y } , \phi ) = \mathbb { E } _ { q _ { \phi } ( { \bf z } | { \bf x } , { \bf y } ) } \left[ \lambda _ { x } \log p _ { \pmb { \theta } _ { x } } ( { \bf x } | { \bf z } ) + \lambda _ { y } \log p _ { \pmb { \theta } _ { y } } ( { \bf y } | { \bf z } ) \right] \quad } \\ & { } & { - \beta \mathrm { K L } ( q _ { \phi } ( { \bf z } | { \bf x } , { \bf y } ) , p _ { \theta } ( { \bf z } ) ) } \end{array}
56
+ $$
57
+
58
+ We call this the JVAE (joint VAE) model. We usually set $\beta = 1$ , but set $\lambda _ { y } / \lambda _ { x } > 1$ to to scale up the likelihood from the low dimensional attribute vector, $p _ { \pmb { \theta } } ( \mathbf { y } | \mathbf { z } )$ , to match the likelihood from the high dimensional image, $p _ { \pmb { \theta } } ( \mathbf { x } | \mathbf { z } )$ .
59
+
60
+ Having fit the joint model above, we can proceed to train unpaired inference networks $q _ { \phi _ { x } } ( \mathbf { z } | \mathbf { x } )$ and $q _ { \phi _ { y } } ( \mathbf { z } | \mathbf { y } )$ , so we can embed images and attributes into the same shared latent space. Keeping the $p$ family fixed from the joint model, a natural objective to fit, say, $q _ { \phi _ { x } } ( \mathbf { z } | \mathbf { x } )$ is to maximize the following:1
61
+
62
+ $$
63
+ \begin{array} { r l } & { \mathcal { L } ( \phi _ { x } | \theta ) = - \mathbb { E } _ { \hat { p } ( \mathbf { x } ) } \left[ \mathrm { K L } ( q _ { \phi _ { x } } ( \mathbf { z } | \mathbf { x } ) , p _ { \theta _ { x } } ( \mathbf { z } | \mathbf { x } ) ) \right] } \\ & { \quad \quad \quad = \displaystyle \int \int d \mathbf { x } d \mathbf { z } \hat { p } ( \mathbf { x } ) q _ { \phi _ { x } } ( \mathbf { z } | \mathbf { x } ) \left[ - \log q _ { \phi _ { x } } ( \mathbf { z } | \mathbf { x } ) - \log p _ { \theta _ { x } } ( \mathbf { x } ) + \log p _ { \theta _ { x } } ( \mathbf { x } | \mathbf { z } ) + \log p _ { \theta } ( \mathbf { z } ) \right] } \\ & { \quad \quad \quad = \mathbb { E } _ { \hat { p } ( \mathbf { x } ) } \left[ \mathrm { e l b o } ( \mathbf { x } , \theta _ { x } , \phi _ { x } ) \right] - \mathbb { E } _ { \hat { p } ( \mathbf { x } ) } \left[ \log p _ { \theta _ { x } } ( \mathbf { x } ) \right] } \end{array}
64
+ $$
65
+
66
+ ![](images/3626395a8ff14eb60506a0ca4184450c7060dd974d57a894b45710f69c9fe7d6.jpg)
67
+ Figure 2: Illustration of the product of experts inference network. Each expert votes for a part of latent space implied by its observed attribute. The final posterior is the intersection of these regions. When all attributes are observed, the posterior will be a narrowly defined Gaussian, but when some attributes are missing, the posterior will be broader. Right: we illustrate how inclusion of the “universal expert” $p ( \mathbf { z } )$ in the product ensures that the posterior is always well-conditioned (close to spherical), even when we are missing some attributes.
68
+
69
+ where the last term is constant wrt $\phi _ { x }$ and the model family $p$ , and hence can be dropped. We can use a similar method to fit $q _ { \phi _ { y } } ( \mathbf { z } | \mathbf { y } )$ . Combining these gives the following triple ELBO (TELBO) objective:
70
+
71
+ $$
72
+ \begin{array} { r l } & { { \mathcal { L } } ( \theta _ { x } , \theta _ { y } , \phi , \phi _ { x } , \phi _ { y } ) = \mathbf { E } _ { \hat { p } ( \mathbf { x } , \mathbf { y } ) } \left[ \mathrm { e l b o } _ { 1 , \lambda , 1 } ( \mathbf { x } , \mathbf { y } , \theta _ { x } , \theta _ { y } , \phi ) \right. } \\ & { ~ \left. ~ + \mathrm { e l b o } _ { 1 , 1 } ( \mathbf { x } , \theta _ { x } , \phi _ { x } ) + \mathrm { e l b o } _ { \gamma , 1 } ( \mathbf { y } , \theta _ { y } , \phi _ { y } ) \right] } \end{array}
73
+ $$
74
+
75
+ where $\lambda$ and $\gamma$ scale the log likelihood terms $\log p ( \mathbf { y } | \mathbf { z } )$ ; we set these parameters using a validation set. Since we are training the generative model only on aligned data, and simply retrofitting inference networks, we freeze the $p _ { \pmb { \theta } _ { x } } ( \mathbf { x } | \mathbf { z } )$ and $p _ { \pmb { \theta } _ { y } } ( \mathbf { y } | \mathbf { z } )$ terms when training the last two ELBO terms above, and just optimize $q _ { \phi _ { x } } ( \mathbf { z } | \mathbf { x } )$ and $q _ { \phi _ { y } } ( \mathbf { z } | \mathbf { y } )$ terms. This enables us to optimize all terms in Equation (2) jointly. Alternatively, we can first fit the joint model, and then fit the unimodal inference networks.2 In Section 4, we compare this to other methods for training joint VAEs that have been proposed in the literature.
76
+
77
+ Handling missing attributes. In order to handle missing attributes at test time, we use a product of experts model, where each attribute instantiates an expert. We are motivated by prior work (Williams & Nash, 2018) which shows that for a linear factor analysis model, the posterior distribution $p ( \mathbf { z } | \mathbf { y } )$ is a product of $K$ -dimensional Gaussians, one for each visible dimension. Since our model is just a nonlinear extension of factor analysis, we choose the form of the approximate posterior of our inference network, $q ( \mathbf { z } | \mathbf { y } )$ , to be a product of Gaussians, one for each visible feature: $\begin{array} { r } { q ( \mathbf { z } | \mathbf { y } _ { \mathcal { O } } ) \propto p ( \mathbf { z } ) \prod _ { k \in \mathcal { O } } q ( \mathbf { z } | y _ { k } ) } \end{array}$ , where $q ( \mathbf { z } | y _ { k } ) { \overset { \cdot } { = } } { \mathcal { N } } ( \mathbf { z } | \mu _ { k } ( y _ { k } ) , \mathbf { C } _ { k } ( y _ { k } ) )$ is the kth Gaussian “expert”, and $p ( \mathbf { z } ) = \mathcal { N } ( \mathbf { z } | \boldsymbol { \mu } _ { 0 } = \mathbf { 0 } , \mathbf { C } _ { 0 } = \mathbf { I } )$ is the prior. A similar model was concurrently proposed in Bouchacourt et al. (2018) to perform inference for a set of images. Unlike the product of experts model in (Hinton, 2002), our model multiplies Gaussians, not Bernoullis, so the product has a closed form solution namely $q ( \mathbf { z } | \mathbf { y } _ { \mathcal { O } } ) = \mathcal { N } ( \mathbf { z } | \mu , \mathbf { C } )$ , where $\begin{array} { r } { \mathbf { C } ^ { - 1 } = \sum _ { k } \mathbf { C } _ { k } ^ { - 1 } } \end{array}$ and $\begin{array} { r } { \pmb { \mu } = \mathbf { C } ( \sum _ { k } \mathbf { C } _ { k } ^ { - 1 } \pmb { \mu } _ { k } ) } \end{array}$ , and the sum is over all the observed attributes. Intuitively, y imposes an increasing number of constraints on $\mathbf { z }$ as more of it is observed, as explained in Williams & Agakov (2002). In our setting, if we do not observe any attributes, the posterior reduces to the prior. As we observe more attributes, the posterior becomes narrower, since the (positive definite) precision matrices, $\mathbf { C } ^ { - 1 }$ add up, reflecting the increased specificity of the concept being specified, as illustrated in Figure 2 (middle) (see also Williams & Agakov (2002)). We always include the prior term, $p ( \mathbf { z } )$ , in the product, since without it, the posterior $q _ { \phi _ { y } } ( \mathbf { z } | \mathbf { y } _ { \mathcal { O } } )$ may not be well-conditioned when we are missing attributes, as illustrated in Figure 2 (right). For more implementation-level details on the model architectures, see Appendix A.4.
78
+
79
+ # 3 EVALUATION METRICS: THE 3C’S OF VISUAL IMAGINATION
80
+
81
+ To evaluate the quality of a set of generated images, $S ( \mathbf { y } _ { \mathcal { O } } ) = \{ \mathbf { x } _ { s } \sim p ( \mathbf { x } | \mathbf { y } _ { \mathcal { O } } ) : s = 1 : S \}$ , we apply a multi-label classifier to each image, to convert it to a predicted attribute vector, $\hat { \mathbf { y } } ( \mathbf x )$ . This attribute classifier is trained on a large dataset of images and attributes, and is held constant across all methods that are being evaluated. It plays the role of a human observer. This is similar in spirit to generative adversarial networks (Goodfellow et al., 2014), that declare a generated image to be good enough if a binary classifier cannot distinguish it from a real image. (Both approaches avoid the problems mentioned in Theis et al. (2016) related to evaluating generative image models in terms of their likelihood.) However, the attribute classifier checks not only that the images look realistic, but also that they have the desired attributes.
82
+
83
+ To quantify this, we define the correctness as the fraction of attributes for each generated image that match those specified in the concept’s description: correctness $( \bar { s } , \mathbf { y } \bar { \omega } ) \ =$ $\begin{array} { r } { \frac { 1 } { | \mathcal { S } | } \sum _ { \mathbf { x } \in \mathcal { S } } \overset { 1 } { \underset { | \mathcal { O } | } { \mid } } \sum _ { k \in \mathcal { O } } \mathbb { I } ( \hat { y } ( \mathbf { x } ) _ { k } = \overset { \cdot } { y } _ { k } ) } \end{array}$ . However, we also want to measure the diversity of values for the unspecified or missing attributes, $\mathcal { M } = \mathcal { A } \backslash \mathcal { O }$ . We do this by comparing $q _ { k }$ , the empirical distribution over values for attribute $k$ induced by the generated set $s$ , to $p _ { k }$ , the true distribution for this attribute induced by the training set. We measure the difference between these distributions using the Jensen-Shannon divergence, since it is symmetric and satisfies $0 \leq \mathrm { J S } ( p , q ) \leq 1$ . We then define the coverage as follows: $\begin{array} { r } { \mathbf { \bar { c o v e r a g e } } ( S , \mathbf { y } _ { \mathcal { O } } ) \mathbf { \bar { = } } \frac { 1 } { | \mathcal { M } | } \sum _ { k \in \mathcal { M } } ( 1 - \mathbf { J } \mathbf { S } ( p _ { k } ^ { - } , q _ { k } ) ) } \end{array}$ . If desired, we can combine correctness and coverage into a single number, by computing the JS divergence between $p _ { k }$ and $q _ { k }$ for all attributes, where, for observed attributes, $p _ { k }$ is a delta function and $q _ { k }$ is the empirical distribution (we call this JS-overall). This gives us a convenient way to pick hyperparameters. However, for analysis, we find it helpful to report correctness and coverage separately.
84
+
85
+ Note that our metric is different from the inception score proposed in Salimans et al. (2016). That is defined as follows: inception $\underline { { \mathbf { \Pi } } } = \exp \left( \mathbb { E } _ { \hat { p } ( \mathbf { x } ) } \left[ \dot { \mathrm { K L } } ( p ( y | \mathbf { x } ) , \dot { p } ( y \dot { ) } ) \right] \right)$ , where $y$ is a class label. Expanding the term inside the exponential, we get
86
+
87
+ $$
88
+ \sum _ { \mathbf { x } } p ( \mathbf { x } ) \left[ \sum _ { y } p ( y | \mathbf { x } ) \log p ( y | \mathbf { x } ) \right] - \sum _ { \mathbf { x } } \sum _ { y } p ( \mathbf { x } , y ) \log p ( y ) = \mathbb { E } _ { \hat { p } ( \mathbf { x } ) } \left[ - H ( y | \mathbf { x } ) \right] + H ( y )
89
+ $$
90
+
91
+ A high inception score means that the distribution $p ( y | \mathbf { x } )$ has low entropy, so the generated images match some class, but that the marginal $p ( y )$ has high entropy, so the images are diverse. However, the inception score was created to evaluate unconditional generative models of images, so it does not check if the generated images are consistent with the concept $\mathbf { y } _ { \mathcal { O } }$ , and the degree of diversity does not vary in response to the level of abstraction of the concept.
92
+
93
+ Finally, we can assess how well the model understands compositionality, by checking correctness of its generated images in response to test concepts $\mathbf { y } _ { \mathcal { O } }$ that differ in at least one attribute from the training concepts. We call this a compositional split of the data. This is much harder than a standard iid split, since we are asking the model to predict the effects of novel combinations of attributes, which it has not seen before (and which might actually be impossible). Note that abstraction is different from compositionality – in abstraction we are asking the model to predict the effects of dropping certain attributes instead of predicting novel combinations of attributes.
94
+
95
+ # 4 RELATED WORK
96
+
97
+ In this section, we briefly mention some of the most closely related prior work.
98
+
99
+ Conditional models. Many conditional generative image models of the form $p ( \mathbf { y } \vert \mathbf { x } )$ have been proposed recently, where y can be a class label (e.g., (Radford et al., 2016)), a vector of attributes (e.g., (Yan et al., 2016)), a sentence (e.g., (Reed et al., 2016)), another image (e.g., (Isola et al., 2017)), etc. Such models are usually based on VAEs or GANs. However, we are more interested in learning a shared latent space from either descriptions y or images x, which means we need to use a joint, symmetric, model.
100
+
101
+ Joint models. Several papers use the same joint VAE model as us, but they differ in how it is trained. In particular, the BiVCCA objective of Wang et al. (2016b) has the form ${ \mathcal { L } } ( \theta , \phi ) =$
102
+
103
+ $\mathbb { E } _ { \hat { p } ( \mathbf { x } , \mathbf { y } ) } \left[ J ( \mathbf { x } , \mathbf { y } , \pmb { \theta } , \phi ) \right]$ , where
104
+
105
+ $$
106
+ \begin{array} { r } { J ( \mathbf { x } , \mathbf { y } , \pmb { \theta } , \phi ) = \mu \left( E _ { q _ { \phi _ { x } } ( \mathbf { z } | \mathbf { x } ) } [ \log p \pmb { \theta } _ { x } ( \mathbf { x } | \mathbf { z } ) + \lambda \log p \pmb { \theta } _ { y } ( \mathbf { y } | \mathbf { z } ) ] - \mathrm { K L } ( q _ { \phi _ { x } } ( \mathbf { z } | \mathbf { x } ) , p \pmb { \theta } ( \mathbf { z } ) ) \right) } \\ { + ( 1 - \mu ) \left( E _ { q _ { \phi _ { y } } ( \mathbf { z } | \mathbf { y } ) } [ \log p \pmb { \theta } _ { x } ( \mathbf { x } | \mathbf { z } ) + \lambda \log p \pmb { \theta } _ { y } ( \mathbf { y } | \mathbf { z } ) ] - \mathrm { K L } ( q _ { \phi _ { y } } ( \mathbf { z } | \mathbf { y } ) , p \pmb { \theta } ( \mathbf { z } ) ) \right) } \end{array}
107
+ $$
108
+
109
+ This method results in the model generating the mean image corresponding to each concept, due to the $E _ { q _ { \phi _ { y } } ( \mathbf { z } | \mathbf { y } ) } \log p _ { \theta } ( \mathbf { x } , \mathbf { y } | \mathbf { z } )$ term, which requires that $\mathbf { z }$ ’s sampled from $q _ { \phi _ { y } } ( \mathbf { z } | \mathbf { y } _ { n } )$ be good at generating all the different ${ \bf x } _ { n }$ ’s which co-occur with ${ \bf y } _ { n }$ . We show this empirically in Section 5. This problem can be partially compensated for by increasing $\mu$ , but that reduces the $\operatorname { K L } ( q _ { \phi } ( \mathbf { z } | \mathbf { y } ) , p _ { \theta } ( \mathbf { z } ) )$ penalty, which is required to ensure $q _ { \phi _ { y } } ( \mathbf { z } | \mathbf { y } )$ is a broad distribution with good coverage of the concept.
110
+
111
+ The JMVAE objective of Suzuki et al. (2017) has the form $\mathcal { L } ( \pmb { \theta } , \phi ) = \mathbb { E } _ { \hat { p } ( \mathbf { x } , \mathbf { y } ) } \left[ J ( \mathbf { x } , \mathbf { y } , \pmb { \theta } , \phi ) \right]$ , where
112
+
113
+ $$
114
+ I ( \mathbf { x } , \mathbf { y } , \boldsymbol { \theta } , \boldsymbol { \phi } ) = \mathrm { e l b o } _ { 1 , \boldsymbol { \lambda } , 1 } ( \mathbf { x } , \mathbf { y } , \boldsymbol { \theta } , \boldsymbol { \phi } ) - \alpha \left[ \mathrm { K L } ( q _ { \boldsymbol { \phi } } ( \mathbf { z } | \mathbf { x } , \mathbf { y } ) , q _ { \boldsymbol { \phi } _ { y } } ( \mathbf { z } | \mathbf { y } ) ) + \mathrm { K L } ( q _ { \boldsymbol { \phi } } ( \mathbf { z } | \mathbf { x } , \mathbf { y } ) , q _ { \boldsymbol { \phi } _ { x } } ( \mathbf { z } | \mathbf { x } ) ) \right]
115
+ $$
116
+
117
+ At first glance, forcing $q _ { \phi } ( \mathbf { z } | \mathbf { y } )$ to be close to $q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { y } )$ seems undesirable, since the latter will typically be close to a delta function, since there is little posterior uncertainty in $\mathbf { z }$ once we see the image x. However, in Appendix A.1, we use results from Hoffman $\&$ Johnson (2016) to show that $\mathbb { E } _ { \hat { p } ( \mathbf { x } , \mathbf { y } ) } \left[ \mathrm { K L } ( q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { y } ) , q _ { \phi _ { y } } ( \mathbf { z } | \mathbf { y } ) ) \right]$ can be written in terms of $\operatorname { K L } ( q _ { \phi } ^ { \mathrm { a v g } } ( \mathbf { z } | \mathbf { y } ) , q _ { \phi _ { y } } ( \mathbf { z } | \mathbf { y } ) )$ , where $q _ { \phi } ^ { \mathrm { a v g } } ( \mathbf { z } | \mathbf { y } ) = \mathbf { \bar { \mathbb { E } } } _ { \hat { p } ( \mathbf { x } | \mathbf { y } ) } \left[ q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { y } ) \right]$ is the aggregated posterior over $\mathbf { z }$ induced by all images $\mathbf { x }$ which are associated with description $\mathbf { y }$ . This ensures that $q _ { \phi _ { y } } ( \mathbf { z } | \mathbf { y } )$ will cover the embeddings of all the images associated with concept $\mathbf { y }$ . However, since there is no $\mathrm { K L } ( q _ { \phi _ { y } } ( \mathbf { z } | \mathbf { y } ) , p _ { \pmb { \theta } } ( \mathbf { z } ) )$ term, the diversity of the samples is slightly reduced for novel concepts compared to TELBO, as we show empirically in Section 5. On the flip side, the benefit of using the aggregated posterior to fit the $q ( \mathbf { z } | \mathbf { y } )$ inference network is that one can expect sharper images, as this ensures we will sample $\mathbf { z } \sim q ( \mathbf { z } | \mathbf { y } )$ which have been seen by the image decoder $p _ { \pmb { \theta } } ( \mathbf { x } | \mathbf { z } )$ during joint training. If the aggregated posterior does not exactly match the prior (which is known to happen in VAE-type models, see Hoffman & Johnson (2016)) then regularizing with respect to the prior (as TELBO does) can generate samples in parts of space not seen by the image decoder, which can potentially lead to less “correct” samples. Again, our empirical findings in Section 5 confirm this tradeoff between correctness and coverage implicit in choices of TELBO vs. JMVAE.
118
+
119
+ The SCAN method of Higgins et al. (2017b) first fits a standard $\beta$ -VAE model (Higgins et al., 2017a) on unlabeled images (or rather, features derived from images using a pre-trained denoising autoencoder) by maximizing $\mathcal { L } ( \pmb { \theta } _ { x } , \pmb { \phi } _ { x } ) = \mathbb { E } _ { \hat { p } ( \mathbf { x } ) }$ $[ \mathrm { e l b o } _ { 1 , \beta _ { x } } ( \mathbf { x } , \pmb { \theta } _ { x } , \phi _ { x } ) ]$ . They then fit a second VAE by maximizing $\mathcal { L } ( \pmb { \theta } _ { y } , \pmb { \phi } _ { y } ) = \mathbb { E } _ { \hat { p } ( \mathbf { x } , \mathbf { y } ) } \left[ J ( \mathbf { x } , \mathbf { y } , \pmb { \theta } _ { y } , \phi _ { y } , \phi _ { x } ) \right]$ , where
120
+
121
+ $$
122
+ J ( \mathbf { x } , \mathbf { y } , \pmb { \theta } _ { y } , \phi _ { y } , \phi _ { x } ) = \mathrm { { e l b o } } _ { 1 , \beta _ { y } } ( \mathbf { y } , \pmb { \theta } _ { y } , \phi _ { y } ) - \alpha \mathrm { { K L } } ( q _ { \phi _ { x } } ( \mathbf { z } | \mathbf { x } ) , q _ { \phi _ { y } } ( \mathbf { z } | \mathbf { y } ) )
123
+ $$
124
+
125
+ This is very similar to JMVAE, since $q _ { \phi _ { x } } ( \mathbf { z } | \mathbf { x } ) \approx q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { y } )$ , when $\displaystyle ( \mathbf { x } , \mathbf { y } )$ is a matching pair of images and labels. An important difference, however, is that SCAN treats the attribute vectors $\mathbf { y }$ as atomic symbols; this has the advantage that there is no need to handle missing inputs, but the disadvantage that they cannot infer the meaning of unseen attribute combinations at test time, unless they are “taught” them by having them paired with images. Also, they rely on $\beta _ { x } > 1$ as a way to get compositionality, assuming that a disentangled latent space will suffice. However, in Appendix A.3, we show that unsupervised learning of the latent space given images alone can result in poor results when some of the attributes in the compositional concept hierarchy are non-visual, such as parity of an MNIST digit. Our approach always takes the labels into consideration when learning the latent space, permitting well-organized latent spaces even in the presence of non-visual concepts (c.f. the difference between PCA and LDA).
126
+
127
+ Handling missing inputs. Conditional generative models of images, of the form $p ( \mathbf { x } | \mathbf { y } )$ , have problems with missing input attributes, as do inference networks $q ( \mathbf { z } | \mathbf { y } )$ for VAEs. Hoffman (2017) uses MCMC to fit a latent Gaussian model, which can in principle handle missing data; however, he initializes the Markov chain with the posterior mode computed by an inference network, which cannot easily handle missing inputs. One approach we can use, if we have a joint model, is to estimate or impute the missing values, as follows: $\hat { \mathbf { y } } = \arg \operatorname* { m a x } _ { \mathbf { y } _ { \mathcal { M } } } p ( \mathbf { y } _ { \mathcal { M } } | \mathbf { y } _ { \mathcal { O } } )$ , where $p ( \mathbf { y } _ { \mathcal { M } } , \mathbf { y } _ { \mathcal { O } } )$ models dependencies between attributes. We can then sample images using $p ( \mathbf { x } | \hat { \mathbf { y } } )$ . This approach was used in Yan et al. (2016) to handle the case where some of the pixels being passed into an inference network were not observed. However, conditioning on an imputed value will give different results from not conditioning on the missing inputs; only the latter will increase the posterior uncertainty in order to correctly represent less precise concepts with broader support.
128
+
129
+ Gaussian embeddings. There are many papers that embed images and text into points in a vector space. However, we want to represent concepts of different levels of abstraction, and therefore want to map images and text to regions of latent space. There are some prior works that use Gaussian embeddings for words (Vilnis & McCallum, 2015; Athiwaratkun & Wilson, 2017), sometimes in conjunction with images (Mukherjee & Hospedales, 2016; Ren et al., 2016). Our method differs from these approaches in several ways. First, we maximize the likelihood of $\displaystyle ( \mathbf { x } , \mathbf { y } )$ pairs, whereas the above methods learn a Gaussian embedding using a contrastive loss. Second, our PoE formulation ensures that the covariance of the posterior $q ( \mathbf { z } | \mathbf { y } _ { \mathcal { O } } )$ is adaptive to the data that we condition on. In particular, it becomes narrower as we observe more attributes (because the precision matrices sum up), which is a property not shared by other embedding methods.
130
+
131
+ Abstraction and compositionality. Young et al. (2014) represent the extension of a concept (described by a noun phrase) in terms of a set of images whose captions match the phrase. By contrast, we use a parametric probability distribution in a latent space that can generate new images. Vendrov et al. (2016) use order embeddings, where they explicitly learn subsumption-like relationships by learning a space that respects a partial order. In contrast, we reason about generality of concepts via the uncertainty induced by their latent representation. There has been some work on compositionality in the language/vision literature (see e.g., Atzmon et al. (2016); Johnson et al. (2017); Agrawal et al. (2017)), but none of these papers use generative models, which is arguably a much more stringent test of whether a model has truly “understood” the meaning of the components which are being composed.
132
+
133
+ # 5 EXPERIMENTAL RESULTS
134
+
135
+ In this section, we fit the JVAE model to two different datasets (MNIST-A and CelebA), using the TELBO objective, as well as BiVCCA and JMVAE. We measure the quality of the resulting model using the 3 C’s, and show that our method of handling missing data behaves in a qualitatively reasonable way.
136
+
137
+ # 5.1 MNIST-A
138
+
139
+ Dataset. In this section, we report results on the MNIST-A dataset. This is created by modifying the original MNIST dataset as follows. We first create a compositional concept hierarchy using 4 discrete attributes, corresponding to class label (10 values), location (4 values), orientation (3 values), and size (2 values). Thus there are $1 0 { \times } 2 { \times } 3 { \times } 4 = 2 4 0$ unique concepts in total. We then sample $\sim 2 9 0$ example images of each concept, and create both an iid and compositional split of the data. See Appendix A.2 for details.
140
+
141
+ Models and algorithms. We train the JVAE model on this dataset using TELBO, BiVCCA and JMVAE objectives. We use Adam (Kingma & Ba, 2015) for optimization, with a learning rate of 0.0001, and a minibatch size of 64. We train all models for 250,000 steps (we generally found that the models do not tend to overfit in our experiments). Our models typically take around a day to train on NVIDIA Titan X GPUs. For the image models, $p ( \mathbf { x } | \mathbf { z } )$ and $q ( \mathbf { z } | \mathbf { x } )$ , we use the DCGAN architecture from Radford et al. (2016). Our generated images are of size $6 4 \times 6 4$ , as in Radford et al. (2016). For the attribute models, $p ( y _ { k } | \mathbf { z } )$ and $q ( \mathbf { z } | y _ { k } )$ , we use MLPs. For the joint inference network, $q ( \mathbf { z } | \mathbf { x } , \mathbf { y } )$ , we use a CNN combined with an MLP. We use $d = 1 0$ latent dimensions for all models. We choose the hyperparameters for each method so as to maximize JS-overall, which is an overall measure of correctness and coverage (see Section 3) on a validation set of attribute queries. See Appendix A.4 for further details on the model architectures.
142
+
143
+ Evaluation. To measure correctness and coverage, we first train the observation classifier on the full iid dataset, where it gets to an accuracy of $9 1 . 1 8 \%$ for class label, $9 0 . 5 6 \%$ for scale, $9 2 . 2 3 \%$ for orientation, and $100 \%$ for location. Consequently, it is a reliable way to assess the quality of samples from various generative models (see Appendix A.5 for details). We then compute correctness and coverage on the iid dataset, and coverage on the comp dataset.
144
+
145
+ ![](images/216614ff4d58de7325957c620c11d08b9ac4d0b78fb017fed0bf9166d2831af1.jpg)
146
+ Query: 0, small, clockwise, top-right
147
+ Figure 3: Samples from attribute vectors seen at training time, generated by the 3 different models. We plot the posterior mean of each pixel, $\mathbb { E } \left[ \mathbf { x } | \mathbf { z } _ { s } \right]$ , where $\mathbf { z } _ { s } \sim \hat { q } _ { \phi _ { y } } ( \mathbf { z } | \mathbf { y } )$ . The caption at the top of each little image is the predicted attribute values. The border of the generated image is red if any of the attributes are predicted incorrectly. (The observation classifier is fed sampled images, not the mean image that we are showing here.)
148
+
149
+ Familiar concrete concepts. We start by assessing the quality of the models in the simplest setting, which is where the test concepts are fully specified (i.e., all attributes are known), and the concepts have been seen before in the training set (i.e., we are using the iid split). Figure 4a shows the correctness scores for the three methods. (Since the test concepts are fully grounded, coverage is not well defined, since there are no missing attributes.) We see that TELBO has a correctness of $8 2 . 0 8 \%$ , which is close to that of JMVAE $( 8 5 . 1 5 \% )$ ; both methods significantly outperform BiVCCA $( 6 7 . 3 8 \% )$ . To gain more insight, Figure 3 shows some samples from each of these methods for a leaf concept chosen at random. We see that the images generated by BiVCCA are very blurry, for reasons we discussed in Section 4. Note that these blurry images are correctly detected by the attribute classifier.3 We also see that the JMVAE samples all look good (in this example). Most of the samples from TELBO are also good, although there is one error (correctly detected by the attribute classifier).
150
+
151
+ <table><tr><td>Method</td><td>#Attributes</td><td>Coverage (%)</td><td>Correctness (%)</td></tr><tr><td colspan="4">iid split</td></tr><tr><td>TELBO</td><td rowspan="3">4</td><td></td><td>82.08±0.56</td></tr><tr><td>JMVAE</td><td></td><td>85.15 ±0.26</td></tr><tr><td>BiVCCA</td><td></td><td>67.38 ±0.69</td></tr><tr><td>TELBO</td><td rowspan="3">3</td><td>91.14 ± 0.53</td><td>81.63 ± 0.38</td></tr><tr><td>JMVAE</td><td>88.52 ± 0.37</td><td>82.00 ±0.37</td></tr><tr><td>BiVCCA</td><td>85.28 ±0.68</td><td>70.68 ± 0.87</td></tr><tr><td>TELBO</td><td rowspan="3">2</td><td>90.32 ± 0.57</td><td>82.03 ± 1.37</td></tr><tr><td>JMVAE</td><td>87.89 ±0.69</td><td>81.02 ± 1.05</td></tr><tr><td>BiVCCA</td><td>85.09 ±0.76</td><td>72.33 ± 2.31</td></tr><tr><td>TELBO</td><td rowspan="3">1</td><td>90.94 ±0.19</td><td>83.67 ± 1.70</td></tr><tr><td>JMVAE</td><td>88.70 ±0.35</td><td>81.58 ± 1.78</td></tr><tr><td>BiVCCA</td><td>85.53 ± 0.27</td><td>68.36 ± 2.21</td></tr><tr><td colspan="5">Compositional split</td></tr><tr><td>TELBO</td><td rowspan="3">4</td><td></td><td>75.61 ± 1.43</td></tr><tr><td>JMVAE</td><td></td><td>76.86 ± 1.30</td></tr><tr><td>BiVCCA</td><td></td><td>68.58 ± 1.02</td></tr></table>
152
+
153
+ ![](images/67115530c872ea1da2927de9b0adb176a254c84c012a930b88a6d53d578942b5.jpg)
154
+ (b) Mean images generated by TELBO and JMVAE in response to queries at different levels of abstraction, starting from abstract (top) to refined (bottom).
155
+
156
+ (a) Evaluation of different approaches on the test set. Higher numbers are better. We report standard deviation across 5 splits of the test set.
157
+
158
+ Figure 4: (a) We show quantitaive results on the 3C’s on MNIST-A. (b) Qualitative results on MNIST-A for various queries. For refined/fully specified queries, we can see that both TELBO and JMVAE produce good correctness, i.e., the images produced follow constraints placed by the specified attributes. When the attribute ‘orientation’ is unspecified, we see that TELBO produces upright and counter clockwise digits, while JMVAE produces clockwise and upright digits. Finally, when we leave the digit unspecified (top), we see that TELBO appears to generate a more diverse set of digits (9, 3, 8, 6) while JMVAE produces 0 and 3.
159
+
160
+ Novel abstract concepts. Next we assess the quality of the models when the test concepts are abstract, i.e., one or more attributes are not specified. (Note that the model was never trained on such abstract concepts.) Figure 4a shows that the correctness scores for JMVAE seems to drop somewhat (from about $85 \%$ to about $8 1 . 5 \%$ ), although it remains steady for TELBO and BiVCCA. We also see that the coverage of TELBO is higher than the other methods, due to the use of the $\mathrm { K L } ( q _ { \phi _ { y } } ( \mathbf { z } | \mathbf { y } ) , p _ { \pmb { \theta } } ( \mathbf { z } ) )$ regularizer, as we discussed in Section 4. Figure 4b illustrates how the methods respond to concepts of different levels of abstraction. The samples from the TELBO seem to be more diverse, which is consistent with the numbers in Figure 4a.
161
+
162
+ Compositionally novel concrete concepts. Finally we assess the quality of the models when the test concepts are fully specified, but have not been seen before (i.e., we are using the comp split). Figure 4a shows some quantitative results. We see that the correctness for TELBO and JMVAE has dropped from about $82 \%$ to about $7 5 \%$ , since this task is much harder, and requires “strong generalization”. However, as before, we see that both TELBO and JMVAE outperform BiVCCA, which has a correctness of about $69 \%$ . See Appendix A.7 qualitative results and more details.
163
+
164
+ # 5.2 CELEBA
165
+
166
+ In this section, we report results on the CelebA dataset (Liu et al., 2015). In particular, we use the version that was used in Perarnau et al. (2016), which selects 18 visually distinctive attributes, and generate images of size $6 4 \times 6 4$ ; see Appendix A.8 for more details on the CelebA dataset and Appendix A.4 for details of the model architectures. Figure 5 shows some sample qualitative results. On the top left, we show some images which were generated by the three methods given the concept shown in the left column. TELBO and JMVAE generate realistic and diverse images. That is, the generated images are generally of males, with mouth slightly open and smiling attributes present in the images. On the other hand, BiVCCA just generates the mean image. On the bottom left, we show what happens when we drop some attributes, thus specifying more abstract concepts. We see that when we drop the gender, we get a mixture of both male and female images for both TELBO and JMVAE. Going further, when we drop the “smiling” attribute, we see that the samples now comprise of people who are smiling as well as not smiling, and we see a mixture of genders in the samples. Further, while we see a greater diversity in the samples, we also notice a slight drop in image quality (presumably because none of the approaches has seen supervision with just ‘abstract’ concepts). See Appendix A.9 for more qualitative examples on CelebA. On the top right, we show some examples of visual imagination, where we ask the models to generate images from the concept “bald female”, which does not occur in the training set.4 (We omit the results from BiVCCA, which are uniformly poor.) We see that both TELBO and JMVAE can sometimes do a fairly reasonable job (although these are admittedly cherry picked results). Finally, the bottom right illustrates an interesting bias in the dataset: if we ask the model to generate images where we do not specify the value of the eyeglasses attribute, nearly all of the samples fail to included glasses, since the prior probability of this attribute is rare (about $6 \%$ ).
167
+
168
+ # 6 CONCEPT NAMING WITH IMAGINATION MODELS
169
+
170
+ In this section, we demonstrate initial results which show that our imagination models can be used for concept naming, where the task is to assign a label to a set of images illustrating the concept depicted by the images. A similar problem has been studied in previous work such as Tenenbaum (1999) and Jia et al. (2013). Tenenbaum (1999) studies a set naming problem with integers (instead of images), and show that construct a likelihood function given a hypothesis set that can capture notions of the minimal/smallest hypothesis that explains the observed samples in the set. Jia et al. (2013) extend this approach to concept-naming on images, incorporating perceptual uncertainty (in recognizing the contents of an image) using a confusion matrix weighted likelihood term. While this approach first extracts labels for each image and then performs concept naming, here we test how well our generative model itself is able to generalize to concept naming without ever performing explicit classification on the images.
171
+
172
+ ![](images/b6b6e00f19c0762479d47d8ed6c0293c054705b7c21da5444678f934722760b6.jpg)
173
+ Figure 5: Sample CelebA results. Left: we show the attributes specified to be present or absent when generating images. Middle: we show 10 samples each generated from TELBO, JMVAE and BiVCCA. We see that TELBO and JMVAE genreate better samples than BiVCCA which collapses to the mean. Middle, bottom: We show five samples from TELBO and JMVAE in response to queries with unspecified attributes, and see that both approaches generate a mix in the samples, generalizing meaningfully across unspecified attributes.
174
+
175
+ In more detail, the problem setup in concept naming is as follows: we are given as input a set $\mathcal { X }$ of images, each of which corresponds to a concept in the compositional abstraction hierarchy Figure 1. The task is to assign a label $\mathbf { y } \in \mathcal { V }$ to the set of images. One of the key challenges in concept learning is to understand “how far” to generalize in the concept hierarchy given a limited number of positive examples (Tenenbaum, 1999). That is, given a small set of images with 7 in the top-left corner and bottom-right corner, one must infer that the concept is “7” as opposed to “7, top-left”. In other words, we wish to find the least common ancestor (in the concept hierarchy) corresponding to all the images in the set, given any number of images in the set, so that we can be consistent with the set. We consider two heuristic solutions to this problem:
176
+
177
+ 1. Concept-NB: In this approach we compute arg maxy $p ( \mathbf { y } | \boldsymbol { \mathcal { X } } )$ , where $p ( \mathbf { y } | \boldsymbol { \mathcal { X } } )$ is computed using the naive bayes assumption:
178
+
179
+ $$
180
+ p ( \mathbf { y } | \mathcal { X } ) \propto p ( \mathbf { y } ) \Pi _ { \mathbf { x } _ { n } \in \mathcal { X } } p ( \mathbf { x } _ { n } | \mathbf { y } ) = p ( \mathbf { y } ) \Pi _ { \mathbf { x } _ { n } \in \mathcal { X } } \int d \mathbf { z } _ { n } p ( \mathbf { x } _ { n } | \mathbf { z } _ { n } ) q ( \mathbf { z } _ { n } | \mathbf { y } )
181
+ $$
182
+
183
+ where $p ( y )$ is chosen to be uniform across all concepts, and the integrals are approximated using Monte Carlo.
184
+
185
+ 2. Concept-Latent: In this approach, instead of working in the observed space, we work in the latent space. That is, we pick a $\mathrm { r g m i n } _ { \mathbf { y } } \mathrm { K L } ( q ( \mathbf { z } | \mathcal { X } ) | \bar { q ( \mathbf { z } | \mathbf { y } ) } )$ , where $q ( \mathbf { z } | \mathcal { X } )$ is approximated using $\bar { \sum _ { \mathbf { x } \in \mathcal { X } } q ( \mathbf { z } | \mathbf { x } ) }$ , which is a mixture of gaussians. The KL divergence can be computed analytically by considering the first two moments of the gaussian mixture5.
186
+
187
+ # 6.1 EXPERIMENTAL SETUP
188
+
189
+ We use the MNIST-A dataset for the concept naming studies. We consider the fully specified attribute labels in the MNIST-A hierarchy, and consider differrent patterns of missingness (corresponding to different nodes in the abstraction hirearchy) by dropping attributes. Specifically, we ignore the case where no attribute is specified, and consider a uniform distribution over the rest of the $\mathsf { \bar { ( 2 ^ { 4 } - 1 = 1 5 ) } }$ ) patterns of missingness. Now, for each fully specified attribute pattern in the iid split of MNIST-A, we sample four missingness patterns and repeat across all fully specified attributes to form a bank of 960 candidate names that a model must choose. We randomly select three subsets of 100 candidate names (and the corresponding images) to form the query set for concept naming, namely tuples of $( \mathbf { y } , { \mathcal { X } } )$ . Specifically, given all the images in the eval set for a concept $\mathbf { y }$ , we form $\mathcal { X }$ using a randomly sampled subset of 5 images. We report the accuracy metric, measuring how often the selected concept for a set $\mathcal { X }$ matches the ground truth concept, across three different splits of 100 datapoints.
190
+
191
+ Table 1: Accuracy of Imagination models on Concept Naming. Higher is better.
192
+
193
+ <table><tr><td>Approach</td><td>Concept-Latent (%)</td><td>Concept-NB (%)</td></tr><tr><td>TELBO</td><td>35.66 ± 2.05</td><td>17.66 ± 1.70</td></tr><tr><td>JMVAE</td><td>54.66 ± 4.92</td><td>13.33 ± 2.05</td></tr><tr><td>BiVCCA</td><td>28.00 ± 4.54</td><td>18.00 ± 1.40</td></tr><tr><td>Random</td><td>0.28±0.00</td><td>0.28±0.00</td></tr><tr><td>Most Frequent</td><td>6.33 ± 1.88</td><td>6.33 ± 1.88</td></tr></table>
194
+
195
+ ![](images/d8dbbd7899942a27afafc0400945fd04332ca9dcd37f0361b8f6a7b42039a005.jpg)
196
+ Figure 6: A qualitative illustration of some of the examples from concept naming models. Top-left: an example of a sample that is correctly named by a Concept-NB model. However, the Concept-NB model is not that strong and often gets simple concepts such as digits incorrect, making mistakes between 6 and 0, for example (bottom-left). This is likely because the only way in which the Concept-NB approach reasons about the set is not via a "meaningful" low dimensional latent variable but via a sampling distribution on a high dimensional space of images. The Concept-Latent model is able to do better on the same set of images, and classify the set as the concept “6”. Finally, we show a failure case of the model where it incorrectly classifies the digits as being large (there is a small digit in the set), and ignores the fact that all of the digits are in the top-left.
197
+
198
+ # 6.2 RESULTS
199
+
200
+ We evaluate the best versions of TELBO, JMVAE, and BiVCCA on the iid split of MNIST-A for concept naming (Table 1). In general, we find that Concept-NB approaches perform significantly worse than Concept-Latent approaches. For example, the best Concept-NB approach (using TELBO/BiVCCA objective) gets to an accuracy of around $1 8 \%$ , while Concept-Latent using JMVAE gets to $5 4 . 6 6 \pm 4 . 9 2 \%$ . In general, these numbers are better than a random chance baseline which would get to $0 . 2 8 \%$ (picking one of 348 effective options, after collating the 960 candidate names based on missingness patterns), while picking the most frequent (ground truth) fully-specified y depicted across an image set gets to $6 . 3 \bar { 3 } \pm 1 . \bar { 8 } 8 \%$ . Figure 6 shows some qualitative examples from Concept-NB as well as Concept-Latent models for concept / set classification. We observe that the Concept-Latent models are much more powerful than using Concept-NB in terms of naming the concept based on few positive examples from the support set.
201
+
202
+ # 7 CONCLUSIONS AND FUTURE WORK
203
+
204
+ We have shown how to create generative models which can “imagine” compositionally novel concrete and abstract visual concepts. In the future we would like to explore richer forms of description, beyond attribute vectors, such as natural language text, as well as compositional descriptions of scenes, which will require dealing with a variable number of objects.
205
+
206
+ # ACKNOWLEDGMENTS
207
+
208
+ We would like to thank Hernan Moraldo for his help in writing the JVAE library, Alex Alemi for valuable insights on TELBO and JMVAE, and Sergio Guadarrama and Harsh Satija for numerous discussions around the project. Finally we would like to thank Devi Parikh for advice on the CelebA experiments, and Stefan Lee and Yash Goyal for feedback on an initial version of this draft.
209
+
210
+ # REFERENCES
211
+
212
+ Alessandro Achille and Stefano Soatto. On the emergence of invariance and disentangling in deep representations. arXiv, 5 June 2017. URL http://arxiv.org/abs/1706.01350.
213
+
214
+ A. Agrawal, A. Kembhavi, D. Batra, and D. Parikh. C-VQA: A Compositional Split of the Visual Question Answering (VQA) v1.0 Dataset. ArXiv, 2017.
215
+
216
+ Ben Athiwaratkun and Andrew Gordon Wilson. Multimodal word distributions. In Proc. ACL, 2017.
217
+
218
+ Yuval Atzmon, Jonathan Berant, Vahid Kezami, Amir Globerson, and Gal Chechik. Learning to generalize to new compositions in image understanding. ArXiv, 27 2016.
219
+
220
+ Diane Bouchacourt, Ryota Tomioka, and Sebastian Nowozin. Multi-Level variational autoencoder: Learning disentangled representations from grouped observations. In AAAI, 2018. URL https://www.microsoft.com/en-us/research/wp-content/uploads/ 2017/11/bouchacourt2018mlvae.pdf.
221
+
222
+ Ian J Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial networks. In NIPS, 2014.
223
+
224
+ Irina Higgins, Loic Matthey, Arka Pal, Christopher Burgess, Xavier Glorot, Matthew Botvinick, Shakir Mohamed, and Alexander Lerchner. beta-VAE: Learning basic visual concepts with a constrained variational framework. In ICLR, 2017a.
225
+
226
+ Irina Higgins, Nicolas Sonnerat, Loic Matthey, Arka Pal, Christopher P Burgess, Matthew Botvinick, Demis Hassabis, and Alexander Lerchner. SCAN: Learning abstract hierarchical compositional visual concepts. Arxiv, 11 July 2017b.
227
+
228
+ Geoffrey E Hinton. Training products of experts by minimizing contrastive divergence. Neural Comput., 14(8):1771–1800, August 2002.
229
+
230
+ M D Hoffman and Johnson. Elbo surgery: yet another way to carve up the variational evidence lower bound. In NIPS Workshop on Advances in Approximate Bayesian Inference, 2016.
231
+
232
+ Matthew D Hoffman. Learning deep latent gaussian models with markov chain monte carlo. In ICML, pp. 1510–1519, 2017. URL http://proceedings.mlr.press/v70/hoffman17a/ hoffman17a.pdf.
233
+
234
+ Phillip Isola, Jun-Yan Zhu, Tinghui Zhou, and Alexei A Efros. Image-to-Image translation with conditional adversarial networks. In CVPR, 2017.
235
+
236
+ Yangqing Jia, Joshua T Abbott, Joseph L Austerweil, Thomas Griffiths, and Trevor Darrell. Visual concept learning: Combining machine vision and bayesian generalization on concept hierarchies. In NIPS, 2013.
237
+
238
+ Justin Johnson, Bharath Hariharan, Laurens van der Maaten, Li Fei-Fei, C Lawrence Zitnick, and Ross Girshick. CLEVR: A diagnostic dataset for compositional language and elementary visual reasoning. In CVPR, 2017.
239
+
240
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR, 2015.
241
+
242
+ Diederik P Kingma and Max Welling. Auto-encoding variational Bayes. In ICLR, 2014.
243
+
244
+ Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaoou Tang. Deep learning face attributes in the wild. In Intl. Conf. on Computer Vision, 2015.
245
+
246
+ Tanmoy Mukherjee and Timothy Hospedales. Gaussian visual-linguistic embedding for zero-shot recognition. In Proc. Empirical Methods in Natural Language Processing, 2016.
247
+
248
+ Guim Perarnau, Joost van de Weijer, Bogdan Raducanu, and Jose M Álvarez. Invertible conditional GANs for image editing. In NIPS Workshop on Adversarial Training, 2016.
249
+
250
+ Yunchen Pu, Zhe Gan, Ricardo Henao, Xin Yuan, Chunyuan Li, Andrew Stevens, and Lawrence Carin. Variational autoencoder for deep learning of images, labels and captions. In NIPS, pp. 2352–2360, 2016.
251
+
252
+ Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. In ICLR, 2016. URL http://arxiv.org/ abs/1511.06434.
253
+
254
+ Scott Reed, Zeynep Akata, Xinchen Yan, Lajanugen Logeswaran, Bernt Schiele, and Honglak Lee. Generative adversarial text-to-image synthesis. In ICML, 2016.
255
+
256
+ Zhou Ren, Hailin Jin, Zhe Lin, Chen Fang, and Alan Yuille. Joint Image-Text Representation by Gaussian Visual-Semantic Embedding. In Proc. ACM conf. on Multimedia, 2016.
257
+
258
+ Ruslan Salakhutdinov and Iain Murray. On the quantitative analysis of deep belief networks. In ICML, 2008.
259
+
260
+ Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training GANs. arXiv, 2016.
261
+
262
+ Damian Scarf, Harlene Hayne, and Michael Colombo. Pigeons on par with primates in numerical competence. Science, 334(6063):1664, 23 December 2011. URL http://dx.doi.org/10. 1126/science.1213357.
263
+
264
+ Masahiro Suzuki, Kotaro Nakayama, and Yutaka Matsuo. Joint multimodal learning with deep generative models. In ICLR Workshop, 2017.
265
+
266
+ J. Tenenbaum. A Bayesian framework for concept learning. PhD thesis, MIT, 1999.
267
+
268
+ Lucas Theis, Aäron van den Oord, and Matthias Bethge. A note on the evaluation of generative models. In ICLR, 2016.
269
+
270
+ Ivan Vendrov, Ryan Kiros, Sanja Fidler, and Raquel Urtasun. Order-Embeddings of images and language. In ICLR, 2016.
271
+
272
+ Luke Vilnis and Andrew McCallum. Word Representations via Gaussian Embedding. In ICLR, 2015.
273
+
274
+ Weiran Wang, Honglak Lee, and Karen Livescu. Deep variational canonical correlation analysis. arXiv [cs.LG], 11 2016a. URL https://arxiv.org/abs/1610.03454.
275
+
276
+ Weiran Wang, Honglak Lee, and Karen Livescu. Deep variational canonical correlation analysis. arXiv, 2016b.
277
+
278
+ C K I Williams and F V Agakov. Products of gaussians and probabilistic minor component analysis. Neural Computation, 14(5):1169–1182, May 2002.
279
+
280
+ Christopher K I Williams and Charlie Nash. Autoencoders and probabilistic inference with missing data: An exact solution for the factor analysis case. January 2018.
281
+
282
+ Xinchen Yan, Jimei Yang, Kihyuk Sohn, and Honglak Lee. Attribute2Image: Conditional image generation from visual attributes. In ECCV, 2016.
283
+
284
+ Peter Young, Alice Lai, Micah Hodosh, and Julia Hockenmaier. From image descriptions to visual denotations: New similarity metrics for semantic inference over event descriptions. Trans. Assoc. Comp. Ling., pp. 67–78, Feb 2014.
285
+
286
+ # A APPENDIX
287
+
288
+ A.1 ANALYSIS OF JMVAE OBJECTIVE
289
+
290
+ The JMVAE objective of (Suzuki et al., 2017) has the form
291
+
292
+ $$
293
+ J ( \mathbf { x } , \mathbf { y } , \theta , \phi ) = \operatorname { e l b o } ( \mathbf { x } , \mathbf { y } , \theta , \phi ) - \alpha \left[ \mathrm { K L } ( q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { y } ) , q _ { \phi _ { y } } ( \mathbf { z } | \mathbf { y } ) ) + \mathrm { K L } ( q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { y } ) , q _ { \phi _ { x } } ( \mathbf { z } | \mathbf { x } ) ) \right]
294
+ $$
295
+
296
+ Let us focus on the $\mathrm { K L } ( q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { y } ) | q _ { \phi _ { y } } ( \mathbf { z } | \mathbf { y } ) )$ term. Let $\mathcal { V }$ be the set of unique labels (attribute vectors) in the training set, $\mathcal { X } _ { i }$ be the indices of the images associated with label $\mathbf { y } _ { i }$ , and let $N _ { i } = | \mathcal { X } _ { i } |$ be the size of that set. Then we can write
297
+
298
+ $$
299
+ \mathbb { E } _ { \hat { p } ( \mathbf { x } , \mathbf { y } ) } \left[ \mathrm { K L } ( q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { y } ) | q _ { \phi _ { y } } ( \mathbf { z } | \mathbf { y } ) ) \right] = \frac { 1 } { | \mathcal { y } | } \sum _ { i \in \mathcal { Y } } \frac { 1 } { N _ { i } } \sum _ { n \in \mathbf { X } _ { i } } \mathrm { K L } ( q _ { \phi } ( \mathbf { z } | \mathbf { x } _ { n } , \mathbf { y } _ { i } ) , q _ { \phi _ { y } } ( \mathbf { z } | \mathbf { y } _ { i } ) )
300
+ $$
301
+
302
+ As explained in (Hoffman & Johnson, 2016), we can rewrite this by treating the index $n \in$ $\{ 1 , \cdots , N _ { i } \}$ as a random variable, with prior $q ( n | \mathbf { y } _ { i } ) = 1 / N _ { i }$ . Also, let us define the likelihood $q ( \mathbf { z } | n , \mathbf { y } _ { i } ) \stackrel { - } { = } q _ { \phi } ( \mathbf { z } | \mathbf { x } _ { n } , \mathbf { y } _ { i } )$ . Using this notation, we can show that the above average KL becomes
303
+
304
+ $$
305
+ \frac { 1 } { | \mathcal { D } | } \sum _ { i \in \mathcal { Y } } \Big \{ \mathrm { K L } ( q _ { \phi } ^ { \mathrm { a v g } } ( \mathbf { z } | \mathbf { y } _ { i } ) | q _ { \phi _ { y } } ( \mathbf { z } | \mathbf { y } _ { i } ) ) + \log N _ { i } - \mathbb { E } _ { q _ { \phi _ { y } } ( \mathbf { z } | \mathbf { y } _ { i } ) } \left[ \mathbb { H } ( q ( n | \mathbf { z } , \mathbf { y } _ { i } ) ) \right] \Big \}
306
+ $$
307
+
308
+ where
309
+
310
+ $$
311
+ q _ { \phi } ^ { \mathrm { a v g } } ( \mathbf { z } | \mathbf { y } _ { i } ) = \frac { 1 } { N _ { i } } \sum _ { n \in \mathcal { X } _ { i } } q _ { \phi } ( \mathbf { z } | \mathbf { x } _ { n } , \mathbf { y } _ { i } )
312
+ $$
313
+
314
+ is the average of the posteriors for that concept, and $q ( n | \mathbf { z } , \mathbf { y } _ { i } )$ is the posterior over the indices for all the possible examples from the set $\mathcal { X } _ { i }$ , given that the latent code is $\mathbf { z }$ and the description is $\mathbf { y } _ { i }$ .
315
+
316
+ The $\operatorname { K L } ( q _ { \phi } ^ { \mathrm { a v g } } ( \mathbf { z } | \mathbf { y } _ { i } ) | q _ { \phi _ { y } } ( \mathbf { z } | \mathbf { y } _ { i } ) )$ term in Equation (4) tells us that JMVAE encourages the inference network for descriptions, $q _ { \phi _ { y } } ( \mathbf { z } | \mathbf { y } _ { i } )$ , to be close to the average of the posteriors induced by each of the images ${ \bf x } _ { n }$ associated with $\mathbf { y } _ { i }$ . Since each $q _ { \phi } ( \mathbf { z } | \mathbf { x } _ { n } , \mathbf { y } _ { i } )$ is close to a delta function (since there is little posterior uncertainty when conditioning on an image), we are essentially requiring that $q _ { \phi } ( \mathbf { z } | \mathbf { y } _ { i } )$ cover the embeddings of each of these images.
317
+
318
+ # A.2 DETAILS ON THE MNIST-A DATASET
319
+
320
+ We created the MNIST-A dataset as follows. Given an image in the original MNIST dataset, we first sample a discrete scale label (big or small), an orientation label (clockwise, upright, and anticlockwise), and a location label (top-left, top-right, bottom-left, bottom-right).
321
+
322
+ Next, we converted this vector of discrete attributes into a vector of continuous transformation parameters, using the procedure described below:
323
+
324
+ • Scale: For big, we sample scale values from a Gaussian centered at 0.9 with a standard deviation of 0.1, while for small we sample from a Gaussian centered at 0.6 with a standard deviation of 0.1. In all cases, we reject and draw a sample again if we get values outside the range [0.4, 1.0], to avoid artifacts from upsampling or problems with illegible (small) digits. Orientation: For the clockwise label, we sample the amount of rotation to apply for a digit from a Gaussian centered at $+ 4 5$ degrees, with a standard deviation of 10 degrees. For anti-clockwise, we use a Gaussian at -45 degrees, with a standard deviation of 10 degrees. For upright, we set the rotation to be 0 degrees always. Location: For location, we place Gaussians at the centers of the four quadrants in the image, and then apply an offset of image_size/16 to shift the centers a bit towards the corresponding corners. We then use a standard deviation of image_size/16 and sample locations for centers of the digits. We reject and draw the sample again if we find that the location for the center would place the extremities of the digit outside of the canvas.
325
+
326
+ Finally, we generate the image as follows. We first take an empty black canvas of size $6 4 \times 6 4$ , rotate the original $2 8 \times 2 8$ MNIST image, and then scale and translate the image and paste it on the canvas. (We use bicubic interpolation for scaling and resizing the images.) Finally, we use the method of (Salakhutdinov & Murray, 2008) to binarize the images. See Figure 7 for example images generated in this way.
327
+
328
+ We repeat the above process of sampling labels, and applying corresponding transformations, to generate images 10 times for each image in the original MNIST dataset. Each trial samples labels from a uniform categorical distribution over the sample space for the corresponding attribute. Thus, we get a new MNIST-A dataset with 700,000 images from the original MNIST dataset of 70,000 images. We split the images into a train, val and test set of $85 \%$ , $5 \%$ , and $10 \%$ of the data respectively to create the IID split. To create the compositional split, we split the $1 0 { \times } 2 { \times } 3 { \times } 4 = 2 4 0$ possible label combinations by the sample train/val/test split, giving us splits of the dataset with non-overlapping label combinations.
329
+
330
+ ![](images/33f8b05ab8fce936e7f3835a7b292e98cde56931f9c9e1a8753bb9a2c64cf1a8.jpg)
331
+ Figure 7: Example binary images from our MNIST-A dataset.
332
+
333
+ # A.3 $\beta$ -VAE vs.JOINT VAE
334
+
335
+ ![](images/0af5e0e3d9ed36265cfe96b0d79354e35c4e4ec83bd117cfc12e8cf76c61b051.jpg)
336
+ Figure 8: Visualization of the benefit of semantic annotations for learning a good latent space. Each small digit is a single sample generated from $p ( x | z )$ from the corresponding point $z$ in latent space. (a) $\beta$ -VAE fit to images without annotations. The color of a point $z$ is inferred from looking at the attributes of the training image that maps to this point of space using $q ( z | x )$ . Note that the red region (corresponding to the concept of large and even digits) is almost non existent. (b) Joint-VAE fit to images with annotations. The color of a point $z$ is inferred from $p ( y | z )$ .
337
+
338
+ $\beta$ -VAE Higgins et al. (2017a) is an approach that aims to learn disentangled latent spaces. It does this by modifying the ELBO objective, so that it scales the $\mathrm { K L } ( q ( \mathbf { z } | \mathbf { x } ) , p ( \mathbf { z } ) )$ term by a factor $\beta > 1$ . This gives rise to disentangled spaces since the prior $p ( \mathbf { z } ) = \mathcal { N } ( \mathbf { z } | \mathbf { 0 } , \mathbf { I } )$ is factorized (see (Achille & Soatto, 2017) for details). However, to learn latent spaces that correspond to high level concepts, this is not sufficient: we need to use labeled data as well.
339
+
340
+ To illustrate this, we set up an experiment where we learn a 2d latent space for standard MNIST digit images, but where we replace the label with two binary attributes: parity (odd vs.even) and magnitude (value $< 5$ or $> = 5$ ). We call this dataset MNIST-2bit.
341
+
342
+ In Figure 8(a), we show the results of fitting a 2d $\beta$ -VAE model (Higgins et al., 2017a) to the images in MNIST-2bit, ignoring the attributes. We perform a hyperparameter sweep over $\beta$ , and pick the one that gives the best looking latent space (this corresponds to a value of $\beta = 1 0$ ). At each point $z$ in the latent 2d space, we show a single image sampled from $p ( x | z )$ . To derive the colors for each point in latent space, we proceed as follows: we embed each training image $x$ (with label $y ( x ) )$ into latent space, by computing $\hat { z } ( x ) = E _ { q ( z | x ) } [ z ]$ . We then associate label $y ( x )$ with this point in space. To derive the label for an arbitrary point $z$ , we lookup the closest embedded training image (using $\ell _ { 2 }$ distance in $z$ space), and use its corresponding label. We see that the latent space is useful for autoencoding (since the generated images look good), but it does not capture the relevant semantic properties of parity and magnitude. In fact, we argue that there is no way of forcing the model to learn a latent space that captures such high level conceptual properties from images alone.
343
+
344
+ In Figure 8(b), we show the results of fitting a joint VAE model to MNIST-2bit, by optimizing $\mathrm { e l b o } ( x , y )$ on images and attributes (i.e., we do not include the uni-modality $\operatorname { e l b o } ( x )$ and $\operatorname { e l b o } ( y )$ terms in this experiment.) Now the color codes are derived from $p ( y | z )$ rather than using nearest neighbor retrieval. We see that the latent space autoencodes well, and also captures the 4 relevant types of concepts. In particular, the regions are all convex and linearly seperable, which facilitates the learning of a good imagination function $q ( z | y )$ , interpolation, retrieval, and other latent-space tasks.
345
+
346
+ A skeptic might complain that we have created an arbitrary partitioning of the data, that is unrelated to the appearance of the objects, and that learning such concepts is therefore “unnatural”. But consider an agent interacting with an environment by touching digits on a screen. Suppose the amount of reward they get depends on whether the digit that they touch is small or big, or odd or even. In such an environment, it would be very useful for the agent to structure its internal representation to capture the concepts of magnitude and parity, rather than in terms of low level visual similarity. (In fact, (Scarf et al., 2011) showed that pigeons can learn simple numerical concepts, such as magnitude, by rewarding them for doing exactly this!) Language can be considered as the realization of such concepts, which enables agents to share useful information about their common environments more easily.
347
+
348
+ # A.4 DETAILS OF THE NEURAL NETWORK ARCHITECTURES
349
+
350
+ As explained in the main paper, we fit the joint graphical model $p ( x , y , z ) = p ( z ) p ( x | z ) p ( y | z )$ with inference networks $q ( z | x , y )$ , $q ( z | x )$ , and $q ( z | y )$ . Thus, our overall model is made up of three encoders (denoted with $q$ ) and two decoders (denoted with $p$ ). Across all models we use the exponential linear unit (ELU) which is a leaky non-linearity often used to train VAEs. We explain the architectures in more detail below.
351
+
352
+ # MNIST-A model architecture
353
+
354
+ • Image decoder, $p ( x | z )$ : Our architecture for the image decoder exactly follows the standard DCGAN architecture from (Radford et al., 2016), where the input to the model is the latent state of the VAE.
355
+
356
+ • Label decoder, $p ( y | z )$ : Our label decoder assumes a factorized output space $p ( y | z ) =$ $\textstyle \prod _ { k \in { \mathcal { A } } } p ( y _ { k } | z )$ , where $y _ { k }$ is each individual attribute. We parameterize each $p ( y _ { k } | z )$ with a two-layer MLP with 128 hidden units each. We apply a small amount of $\ell _ { 2 }$ regularization to the weight matrices.
357
+
358
+ • Image and Label encoder, $q ( z | x , y )$ : Our architecture (Figure 9) for the image-label encoder first separately processes the images and the labels, and then concatenates them downstream in the network and then passes the concatenated features through a multi-layered perceptron. More specifically, we have convolutional layers which process image into 32, 64, 128, 16 feature maps with strides $1 , 2 , 2 , 2$ in the corresponding layers. We use batch normalization in the convolutional layers before applying the ELU non-linearity. On the label encoder side, we first encode the each attribute label into a 32d continuous vector and then pass each individual attribute vector through a 2-layered MLP with 512 hidden dimensions each. For example, for MNIST-A we have 4 attributes, which gives us 4 vectors of 512d. We then concatenate these vectors and pass it through a two layer MLP. Finally we concatenate this label feature with the image feature after the convolutional layers (after flattening the conv-features) and then pass the result through a 2 layer MLP to predict the mean $( \mu )$ and standard deviation $( \sigma )$ for the latent space gaussian. Following standard practice, we predict $\log \sigma$ for the standard deviation in order to get values which are positive.
359
+
360
+ # µ
361
+
362
+ ![](images/3c8666b4b928e365d467fb0e5f9ee430477aaa538630478bba8cd6275380d78a.jpg)
363
+ Figure 9: Architecture for the $q ( z | x , y )$ network in our JVAE models for MNIST-A. Images are ( $6 4 \times 6 4 \times 1 )$ , class has 10 possible values, scale has 2 possible values, orientation has 3 possible values, and location has 4 possible values.
364
+
365
+ • Image encoder, $q ( z | x )$ : The image encoder (Figure 10a) uses the same architecture to process the image as the image feature extractor in $q ( z | x , y )$ network described above. After the conv-features, we pass the result through a 3-layer MLP to get the latent state mean and standard deviation vectors following the procedure described above.
366
+
367
+ • Label encoder, $q ( z | y )$ : The label encoder (Figure 10b) part of the architecture uses the same design choices to process the labels as the label encoder part in the $q ( z | x , y )$ network. After obtaining the concatenated label feature vectors, we pass the result through a 4-layered MLP with 512 hidden dimensions each and then finally obtain the mean $( \mu )$ and $\log \sigma$ values for each dimension in the latent state of the VAE.
368
+
369
+ MNIST-A Observation Classifier Model We next describe the architecuture of the observation classifier we use for evaluating the 3C’s on the MNIST-A dataset. The observation classifier is a convolutional neural network, with the first convolutional layer with filters of size $5 \times 5$ , and 32 channels, followed by a $2 \times 2$ pooling layer applied with a stride of 2. This is followed by another convolutional layer with $5 \times 5$ filter size and 64 output channels. This is followed by another $2 \times 2$ pooling layer of stride 2. After this, the network has four heads (corresponding to each attribute), each of which is an MLP with a single hidden layer (of size 1024), with dropout applied to the activations. The final layer of the MLP outputs the logits for classifying each attribute into the corresponding categorical labels associated with it. We train this model from scratch on the MNIST-A dataset using stochastic gradient descent, batch size of 64 and a learning rate of $1 0 ^ { - 4 }$ .
370
+
371
+ CelebA model architecture Our design choices for CelebA closely mirror the models we built for MNIST-A. One primary difference is that we use a latent dimensionality of 18 in our CelebA experiments which matches the number of attributes we model. Meanwhile, the architectures of the image encoder, image decoder (i.e.DCGAN), are exactly identical to what is described above for MNIST-A execept that encoders take as input a 3-channel RGB image, while decoders produce a
372
+
373
+ ![](images/9e12d7fa6e49bc69072418dfb93ff708face4629172583c460b31e4c20242522.jpg)
374
+ Figure 10: Archtectures for the single input inference networks for MNIST-A.
375
+
376
+ 3-channel output. We replace the Bernoulli likelihood with Quantized Normal likelihood (which is basically gaussian likelihood with uniform noise).
377
+
378
+ In terms of the label encoder $q ( z | y )$ , we follow Figure 10b quite closely, except that we get as input 18 categorical (embedded) class labels as input, and we process the labels through a single hidden layer before concatenation and two hidden layers post concatenation (as opposed to two and four used in Figure 10b).
379
+
380
+ Finally, the joint encoder $q ( z | x , y )$ , is again based heavily on Figure 9 where we feed as input 18 labels as opposed to 4, process them through a single layer mlp of 512d, concatenate them, and then pass the result through a two hidden layer mlp of $5 1 2 \mathrm { d }$ . At this point we concatenate the result with the image feature through the image feature head in Figure 9. Finally, we process the feature through another 512d single hidden layer mlp to produce the $\mu , \sigma$ values.
381
+
382
+ # A.5 OUTPUTS OF OBSERVATION CLASSIFIER ON GENERATED IMAGES
383
+
384
+ Figure 11 shows some images sampled from our TELBO model trained on MNIST-A. It also shows the attributes that are predicted by the attribute classifier. We see that the classifier often produces reasonable results that we as humans would also agree with. Thus, it acts as a reasonable proxy for humans classifying the labels for the generated images.
385
+
386
+ # A.6 HYPERPARAMTER CHOICES FOR TELBO, JMVAE, BIVCCA ON MNIST-A
387
+
388
+ We discuss more hyperparameter choices for the different objectives and how they impact performance on the MNIST-A dataset. Across all the objectives we set $\lambda _ { x } { = } 1$ , and vary $\lambda _ { y }$ . In addition, we also discuss how the private hyperparamter choices for each loss, $\gamma$ for TELBO, $\alpha$ for JMVAE, as in Wang et al. (2016a)) and $\mu$ for BiVCCA affect performance. We use the JS-overall metric for picking hyperparameters, as explained in the main paper.
389
+
390
+ ![](images/cde83191ec4daa6010cc90c7a347bfde0d62bb6512dfca0f4e7d11dc7eb652b3.jpg)
391
+ Figure 11: Randomly sampled images from the TELBO model when fed randomly sampled concepts from the iid training set. We also show the outputs of the observation classifier for the images. Note that we visualize mean images above (since they tend to be more human interpretable) but the classifier is fed samples from the model. Figure best viewed by zooming in.
392
+
393
+ Query: 6, small, clockwise, bottom-right
394
+
395
+ ![](images/fefa3f8d74de211cd7f7d83aeb79bb43beef5def80d74fb90dfdbd1002ae226b.jpg)
396
+ Figure 12: Compositional generalization on MNIST-A. Models are given the unseen compositional query shown at the top and each of the three columns shows the mean of the image distribution generated by the models. Images marked with a red box are those that the observation classifier detected as being incorrect. We also show the classification result from the observation classifier on top of each image. We see that TELBO and JMVAE both do really well, while BiVCCA is substantially poorer.
397
+
398
+ 1. Effect of $\lambda _ { y }$ : We search for $\lambda _ { y }$ values in the set $\{ 1 , 5 0 , 1 0 0 \}$ for all objectives. In general, we find the setting of $\lambda _ { y }$ in the elbo terms to be critical for good performance (especially on correctness). For example, at $\lambda _ { y } { = } 1$ , we find that correctness numbers for the best performing TELBO model drop to 60.47 $( \pm 0 . 3 4 )$ (from 82.08 $( \pm 0 . 5 6 )$ at $\lambda _ { y } = 5 0$ ) on the validation set for iid queries. Similar trends can be observed for the JMVAE and BiVCCA objectives as well (with $\lambda _ { y } = 1 0$ being the best setting for BiVCCA, $\lambda _ { y } = 5 0$ for JMVAE). We have seen qualitative evidence which shows that the likelihood scaling for $\lambda _ { y }$ affects how disentangled the latent space is along the specified attributes. When the latent space is not grouped or organized as per high-level attributes (see Figure 8 for example), the posterior distribution for a given concept is multimodal, which is hard for a gaussian inference network $q ( \mathbf { z } | \mathbf { y } )$ to capture. This leads to poor correctness values.
399
+
400
+ 2. Effect of $\gamma$ : In addition to the $\lambda _ { y }$ scaling term which is common across all objectives, TELBO has a $\gamma$ scaling factor which controls how we scale the $\log p ( y | z )$ term in the $\mathrm { e l b o } _ { \gamma , 1 } ( \mathbf { y } , \pmb { \theta } _ { y } , \phi _ { y } )$ term. We sweep values of $\{ 1 , 5 0 , 1 0 0 \}$ for this parameter. In general, we find that the effect of this term is smaller on the performance than the $\lambda _ { y }$ term. Based on the setting of this parameter, we find that, for example, the correctness values for fully specified queries change from 82.08 $( \pm 0 . 5 6 )$ at $\gamma { = } 5 0$ to 80.27 $( \pm 0 . 3 8 )$ at $\gamma { = } 1$ on validation set for iid queries.
401
+
402
+ 3. Effect of $\alpha$ : We generally find that $\alpha { = } 1 . 0$ works best for JMVAE across the different choices explored in Wang et al. (2016a), namely, $\{ 0 . 0 1 , 0 . 1 , 1 . 0 \}$ . For example, decreasing the value of $\alpha$ to 0.1 or 0.01 reduces correctness for fully sepcified queries from 85.63 $( \pm 0 . 2 9 )$ t o 77.58 $( \pm 0 . 2 3 )$ at 0.1 and 74.57 $( \pm 0 . 4 4 )$ at 0.01 respectively on the validation set for iid queries.
403
+
404
+ 4. Effect of $\mu$ : For BiVCCA, we ran a search for $\mu$ over $\{ 0 . 3 , 0 . 5 , 0 . 7 \}$ , running each training experiment four times, and picked the best hyperparameter choice across the runs. We found that $\mu { = } 0 . 7$ was the best value, however the performance difference across different choices was not very large. Intuitively, higher values of $\mu$ should lead to improved performance compared to lower values of $\mu$ . This is because lower values of $\mu$ mean that we put more weight on the elbo term with a $q ( \mathbf { z } | \mathbf { x } )$ inference network than the one with a $q ( \mathbf { z } | \mathbf { y } )$ inference network, which results in sharper samples.
405
+
406
+ # A.7 COMPOSITIONAL GENRALIZATION ON MNIST-A: QUALITATIVE RESULTS AND DETAILS
407
+
408
+ We next show some examples of compositional generalization on MNIST-A on a validation set of queries. For the compositinal experiments we reused the parameters of the best models on the iid splits for all the models, and trained the models for $\sim 1 6 0 K$ iterations. All other design choices were the same. Figure 12 shows some qualitative results.
409
+
410
+ ![](images/8cf44736649a82d0dee93d3dd6407bf1e6b14acd4091e65573ebad1c27c4069d.jpg)
411
+
412
+ Figure 13: Set of all 9 images labelled as bald ${ } = 1$ and $\mathtt { m a l e = 0 }$ in the CelebA dataset. We can see that in all the cases the labels are inaccurate for the image, probably due to annotator error.
413
+
414
+ ![](images/88f1a8db5dd48aabca30b221c9b09a1011be7beaee7d5f327fd0b1494f8e613a.jpg)
415
+ Figure 14: TELBO creates more diverse images than JMVAE. At the top we show the set of attributes which are present and absent in the input query. Below, we show the results of generation with all the attributes specified, drawing 10 samples each. We see that both TELBO and JMVAE create accurate images satisfying the constraints. Note that the concept “male” is set to “absent” in the query, which in CelebA means that “female” is present. Next, we unspecify whether the image should contain a male or a female. We see that in this setting, TELBO has a better mixing of male and female images (fourth, sixth, eighth and ninth images in the third row are male), than JMVAE which just produces a single male image (the ninth image in the fourth row).
416
+
417
+ # A.8 DETAILS ON CELEBA
418
+
419
+ CelebA consists of 202,599 face colored images and 40 attribute binary vectors. We use the version of this dataset that was used in (Perarnau et al., 2016); this uses a subset of 18 visually distinctive attributes, and preprocesses each image so they are aligned, cropped, and scaled down to $6 4 \times 6 4$ . We use the official train and test partitions, 182K for training and 20K for testing. Note that this is an iid split, so the attribute vectors in the test set all occur in the training set, even though the images and people are unique. In total, the original dataset with 40 attributes specified a set of 96486 unique visual concepts, while our dataset of 18 attributes spans 3690 different visual concepts.
420
+
421
+ In Section 5.2, we claim that our generations of “Bald” and “Female” images are from a compositionally novel concept. Our claim comes with a minor caveat/clarification: the concept $\mathtt { b a l d } { = } 1$ and $\mathtt { m a l e = 0 }$ does occur in 9 training examples, but they are all incorrect labelings, as shown in Figure 13! Further, we see that the images generated from our model (shown in Figure 5) are qualitatively very different from any of the images here, showing that the model has not memorized these examples.
422
+
423
+ # A.9 MORE RESULTS ON CELEBA
424
+
425
+ Finally, we show further qualitative examples of performance on the CelebA dataset. We focus on the TELBO and JMVAE objectives here, since BiVCCA generally produces poor samples (see Figure 5). Figure 14 (middle) shows some example generations for the concept specified by the attributes (top). We see that both TELBO and JMVAE produce correct images when provided the full attribute queries (first two rows). However, when we stop specifying attribute “male” or “not male” (female), we see that TELBO provides more diverse samples, spanning both male and female (compared to JMVAE). This ties into the explanation in Appendix A.1, where we show how one can interpret JMVAE as optimizing for the $\bar { \mathrm { K L } } ( q _ { \phi } ^ { \mathrm { a v g } } ( \mathbf { z } | \mathbf { y } _ { i } ) | \bar { q } _ { \phi _ { y } } ( \mathbf { z } | \mathbf { y } _ { i } ) )$ to fit the unimodal inference network $q _ { \phi _ { y } } ( \mathbf { z } | \mathbf { y } _ { i } )$ . Since JMVAE only reasons about the “aggregate” posterior as opposed to the prior (which TELBO reasons about), it has the tendency to generate less diverse samples when shown unseen concepts.
md/train/HkNDsiC9KQ/HkNDsiC9KQ.md ADDED
@@ -0,0 +1,702 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # META-LEARNING UPDATE RULES FOR UNSUPERVISED REPRESENTATION LEARNING
2
+
3
+ Luke Metz
4
+ Google Brain
5
+ lmetz@google.com
6
+
7
+ Niru Maheswaranathan Google Brain nirum@google.com
8
+
9
+ Brian Cheung University of California, Berkeley bcheung@berkeley.edu
10
+
11
+ Jascha Sohl-Dickstein Google Brain jaschasd@google.com
12
+
13
+ # ABSTRACT
14
+
15
+ A major goal of unsupervised learning is to discover data representations that are useful for subsequent tasks, without access to supervised labels during training. Typically, this involves minimizing a surrogate objective, such as the negative log likelihood of a generative model, with the hope that representations useful for subsequent tasks will arise as a side effect. In this work, we propose instead to directly target later desired tasks by meta-learning an unsupervised learning rule which leads to representations useful for those tasks. Specifically, we target semi-supervised classification performance, and we meta-learn an algorithm – an unsupervised weight update rule – that produces representations useful for this task. Additionally, we constrain our unsupervised update rule to a be a biologically-motivated, neuron-local function, which enables it to generalize to different neural network architectures, datasets, and data modalities. We show that the meta-learned update rule produces useful features and sometimes outperforms existing unsupervised learning techniques. We further show that the meta-learned unsupervised update rule generalizes to train networks with different widths, depths, and nonlinearities. It also generalizes to train on data with randomly permuted input dimensions and even generalizes from image datasets to a text task.
16
+
17
+ # 1 INTRODUCTION
18
+
19
+ Supervised learning has proven extremely effective for many problems where large amounts of labeled training data are available. There is a common hope that unsupervised learning will prove similarly powerful in situations where labels are expensive, impractical to collect, or where the prediction target is unknown during training. Unsupervised learning however has yet to fulfill this promise. One explanation for this failure is that unsupervised representation learning algorithms are typically mismatched to the target task. Ideally, learned representations should linearly expose high level attributes of data (e.g. object identity) and perform well in semi-supervised settings. Many current unsupervised objectives, however, optimize for objectives such as log-likelihood of a generative model or reconstruction error, producing useful representations only as a side effect.
20
+
21
+ Unsupervised representation learning seems uniquely suited for meta-learning (Hochreiter et al., 2001; Schmidhuber, 1995). Unlike most tasks where meta-learning is applied, unsupervised learning does not define an explicit objective, which makes it impossible to phrase the task as a standard optimization problem. It is possible, however, to directly express a meta-objective that captures the quality of representations produced by an unsupervised update rule by evaluating the usefulness of the representation for candidate tasks. In this work, we propose to meta-learn an unsupervised update rule by meta-training on a meta-objective that directly optimizes the utility of the unsupervised representation. Unlike hand-designed unsupervised learning rules, this meta-objective directly targets the usefulness of a representation generated from unlabeled data for later supervised tasks.
22
+
23
+ By recasting unsupervised representation learning as meta-learning, we treat the creation of the unsupervised update rule as a transfer learning problem. Instead of learning transferable features, we learn a transferable learning rule which does not require access to labels and generalizes across both data domains and neural network architectures. Although we focus on the meta-objective of semi-supervised classification here, in principle a learning rule could be optimized to generate representations for any subsequent task.
24
+
25
+ # 2 RELATED WORK
26
+
27
+ # 2.1 UNSUPERVISED REPRESENTATION LEARNING
28
+
29
+ Unsupervised learning is a topic of broad and diverse interest. Here we briefly review several techniques that can lead to a useful latent representation of a dataset. In contrast to our work, each method imposes a manually defined training algorithm or loss function whereas we learn the algorithm that creates useful representations as determined by a meta-objective.
30
+
31
+ Autoencoders (Hinton and Salakhutdinov, 2006) work by first compressing and optimizing reconstruction loss. Extensions have been made to de-noise data (Vincent et al., 2008; 2010), as well as compress information in an information theoretic way (Kingma and Welling, 2013). Le et al. (2011) further explored scaling up these unsupervised methods to large image datasets.
32
+
33
+ Generative adversarial networks (Goodfellow et al., 2014) take another approach to unsupervised feature learning. Instead of a loss function, an explicit min-max optimization is defined to learn a generative model of a data distribution. Recent work has shown that this training procedure can learn unsupervised features useful for few shot learning (Radford et al., 2015; Donahue et al., 2016; Dumoulin et al., 2016).
34
+
35
+ Other techniques rely on self-supervision where labels are easily generated to create a non-trivial ‘supervised’ loss. Domain knowledge of the input is often necessary to define these losses. Noroozi and Favaro (2016) use unscrambling jigsaw-like crops of an image. Techniques used by Misra et al. (2016) and Sermanet et al. (2017) rely on using temporal ordering from videos.
36
+
37
+ Another approach to unsupervised learning relies on feature space design such as clustering. Coates and $\mathrm { N g }$ (2012) showed that $\mathbf { k }$ -means can be used for feature learning. Xie et al. (2016) jointly learn features and cluster assignments. Bojanowski and Joulin (2017) develop a scalable technique to cluster by predicting noise. Other techniques such as Schmidhuber (1992), Hochreiter and Schmidhuber (1999), and Olshausen and Field (1997) define various desirable properties about the latent representation of the input, such as predictability, complexity of encoding mapping, independence, or sparsity, and optimize to achieve these properties.
38
+
39
+ # 2.2 META LEARNING
40
+
41
+ Most meta-learning algorithms consist of two levels of learning, or ‘loops’ of computation: an inner loop, where some form of learning occurs (e.g. an optimization process), and an outer loop or metatraining loop, which optimizes some aspect of the inner loop, parameterized by meta-parameters. The performance of the inner loop computation for a given set of meta-parameters is quantified by a meta-objective. Meta-training is then the process of adjusting the meta-parameters so that the inner loop performs well on this meta-objective. Meta-learning approaches differ by the computation performed in the inner loop, the domain, the choice of meta-parameters, and the method of optimizing the outer loop.
42
+
43
+ Some of the earliest work in meta-learning includes work by Schmidhuber (1987), which explores a variety of meta-learning and self-referential algorithms. Similarly to our algorithm, Bengio et al. (1990; 1992) propose to learn a neuron local learning rule, though their approach differs in task and problem formulation. Additionally, Runarsson and Jonsson (2000) meta-learn supervised learning rules which mix local and global network information. A number of papers propose meta-learning for few shot learning (Vinyals et al., 2016; Ravi and Larochelle, 2016; Mishra et al., 2017; Finn et al., 2017; Snell et al., 2017), though these do not take advantage of unlabeled data. Others make use of both labeled and unlabeld data (Ren et al., 2018). Hsu et al. (2018) uses a task created with no supervision to then train few-shot detectors. Garg (2018) use meta-learning for unsupervised learning, primarily in the context of clustering and with a small number of meta-parameters.
44
+
45
+ ![](images/b50ee206ceae1b452c441605a1b9b74f8d00191282dc432c22601c90d718ddeb.jpg)
46
+ Figure 1: Left: Schematic for meta-learning an unsupervised learning algorithm. The inner loop computation consists of iteratively applying the UnsupervisedUpdate to a base model. During metatraining the UnsupervisedUpdate (parameterized by $\theta$ ) is itself updated by gradient descent on the MetaObjective. Right: Schematic of the base model and UnsupervisedUpdate. Unlabeled input data, $x _ { 0 }$ , is passed through the base model, which is parameterised by $W$ and colored green. The goal of the UnsupervisedUpdate is to modify $W$ to achieve a top layer representation $x ^ { \overset { \triangledown } { L } }$ which performs well at few-shot learning. In order to train the base model, information is propagated backwards by the UnsupervisedUpdate in a manner analogous to backprop. Unlike in backprop however, the backward weights $V$ are decoupled from the forward weights $W$ . Additionally, unlike backprop, there is no explicit error signal as there is no loss. Instead at each layer, and for each neuron, a learning signal is injected by a meta-learned MLP parameterized by $\theta$ , with hidden state $h$ . Weight updates are again analogous to those in backprop, and depend on the hidden state of the pre- and postsynaptic neurons for each weight.
47
+
48
+ To allow easy comparison against other existing approaches, we present a more extensive survey of previous work in meta-learning in table form in Table 1, highlighting differences in choice of task, structure of the meta-learning problem, choice of meta-architecture, and choice of domain.
49
+
50
+ To our knowledge, we are the first meta-learning approach to tackle the problem of unsupervised representation learning, where the inner loop consists of unsupervised learning. This contrasts with transfer learning, where a neural network is instead trained on a similar dataset, and then fine tuned or otherwise post-processed on the target dataset. We additionally believe we are the first representation meta-learning approach to generalize across input data modalities as well as datasets, the first to generalize across permutation of the input dimensions, and the first to generalize across neural network architectures (e.g. layer width, network depth, activation function).
51
+
52
+ # 3 MODEL DESIGN
53
+
54
+ We consider a multilayer perceptron (MLP) with parameters $\phi _ { t }$ as the base model. The inner loop of our meta-learning process trains this base model via iterative application of our learned update rule. See Figure 1 for a schematic illustration and Appendix A for a more detailed diagram.
55
+
56
+ In standard supervised learning, the ‘learned’ optimizer is stochastic gradient descent (SGD). A supervised loss $l \left( x , y \right)$ is associated with this model, where $x$ is a minibatch of inputs, and $y$ are the corresponding labels. The parameters $\phi _ { t }$ of the base model are then updated iteratively by performing SGD using the gradient ∂l(x,y)∂φ . This supervised update rule can be written as $\phi _ { t + 1 } = \mathsf { S }$ upervisedUpdate $( \phi _ { t } , x _ { t } , y _ { t } ; \theta )$ , where $t$ denotes the inner-loop iteration or step. Here $\theta$ are the meta-parameters of the optimizer, which consist of hyper-parameters such as learning rate and momentum.
57
+
58
+ In this work, our learned update is a parametric function which does not depend on label information, $\phi _ { t + 1 } =$ UnsupervisedUpdate $( \phi _ { t } , x _ { t } ; \theta )$ . This form of the update rule is general, it encompasses many unsupervised learning algorithms and all methods in Section 2.1.
59
+
60
+ In traditional learning algorithms, expert knowledge or a simple hyper-parameter search determines $\theta$ , which consists of a handful of meta-parameters such as learning rate and regularization constants. In contrast, our update rule will have orders of magnitude more meta-parameters, including the weights of a neural network. We train these meta-parameters by performing SGD on the sum of the MetaObjective over the course of (inner loop) training in order to find optimal parameters $\theta ^ { * }$ ,
61
+
62
+ Table 1: A comparison of published meta-learning approaches.
63
+
64
+ <table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>Inner loop updates</td><td rowspan=1 colspan=3>Outer loop updates, meta-parameters objective optimizer</td><td rowspan=1 colspan=1>Generalizes to</td></tr><tr><td rowspan=1 colspan=1>Hyper parameter optimizationJones (2001); Snoek et al. (2012);Bergstra et al. (2011); Bergstraand Bengio (2012)</td><td rowspan=1 colspan=1>many steps of optimization</td><td rowspan=1 colspan=1>optimizationhyper-parameters</td><td rowspan=1 colspan=1>training orvalidationset loss</td><td rowspan=1 colspan=1>Baysianmethods,randomsearch, etc</td><td rowspan=1 colspan=1>test data from afixed dataset</td></tr><tr><td rowspan=1 colspan=1>Neural architecture search Stanleyand Miikkulainen (2002); Zophand Le (2017); Baker et al. (2017);Zoph et al. (2018); Real et al.(2017)</td><td rowspan=1 colspan=1>supervised SGD trainingusing meta-learnedarchitecture</td><td rowspan=1 colspan=1>architecture</td><td rowspan=1 colspan=1>validationset loss</td><td rowspan=1 colspan=1>RL orevolution</td><td rowspan=1 colspan=1>test loss withinsimilar datasets</td></tr><tr><td rowspan=1 colspan=1>Task-specific optimizer (eg forquadratic function identification)(Hochreiter et al., 2001)</td><td rowspan=1 colspan=1>adjustment of model weightsby an LSTM</td><td rowspan=1 colspan=1>LSTM weights</td><td rowspan=1 colspan=1>task loss</td><td rowspan=1 colspan=1>SGD</td><td rowspan=1 colspan=1>similar domaintasks</td></tr><tr><td rowspan=1 colspan=1>Learned optimizers Jones (2001);Maclaurin et al. (2015);Andrychowicz et al. (2016); Chenet al. (2016); Li and Malik (2017);Wichrowska et al. (2017); Belloet al. (2017)</td><td rowspan=1 colspan=1>many steps of optimization ofa fixed loss function</td><td rowspan=1 colspan=1>parametricoptimizer</td><td rowspan=1 colspan=1>average orfinal loss</td><td rowspan=1 colspan=1>SGD orRL</td><td rowspan=1 colspan=1>new lossfunctions(mixed success)</td></tr><tr><td rowspan=1 colspan=1>Prototypical networks Snell et al.(2017)</td><td rowspan=1 colspan=1>apply a feature extractor to abatch of data and use softnearest neighbors to computeclass probabilities</td><td rowspan=1 colspan=1>weights of thefeatureextractor</td><td rowspan=1 colspan=1>few shotperformance</td><td rowspan=1 colspan=1>SGD</td><td rowspan=1 colspan=1>new imageclasses withinsimilar dataset</td></tr><tr><td rowspan=1 colspan=1>MAML Finn et al. (2017)</td><td rowspan=1 colspan=1>one step of SGD on trainingloss starting from ameta-learned network</td><td rowspan=1 colspan=1>initial weightsof neuralnetwork</td><td rowspan=1 colspan=1>reward ortraining loss</td><td rowspan=1 colspan=1>SGD</td><td rowspan=1 colspan=1>new goals,similar taskregimes withsame inputdomain</td></tr><tr><td rowspan=1 colspan=1>Evolved Policy GradientHouthooft et al. (2018)</td><td rowspan=1 colspan=1>performing gradient descenton a learned loss</td><td rowspan=1 colspan=1>parameters of alearned lossfunction</td><td rowspan=1 colspan=1>reward</td><td rowspan=1 colspan=1>EvolutionaryStrategies</td><td rowspan=1 colspan=1>newenvironmentconfigurations,both in and notin meta-trainingdistribution.</td></tr><tr><td rowspan=1 colspan=1>Few shot learning (Vinyals et al.,2016; Ravi and Larochelle, 2016;Mishra et al., 2017)</td><td rowspan=1 colspan=1>application of a recurrentmodel, e.g. LSTM, Wavenet.</td><td rowspan=1 colspan=1>recurrent modelweights</td><td rowspan=1 colspan=1>test loss ontrainingtasks</td><td rowspan=1 colspan=1>SGD</td><td rowspan=1 colspan=1>new imageclasses within similar dataset.</td></tr><tr><td rowspan=1 colspan=1>Meta-unsupervised learning forclustering Garg (2018)</td><td rowspan=1 colspan=1>run clustering algorithm orevaluate binary similarityfunction</td><td rowspan=1 colspan=1>clusteringalgorithm + hy-perparameters,binarysimilarityfunction</td><td rowspan=1 colspan=1>empiricalrisk mini-mization</td><td rowspan=1 colspan=1>varied</td><td rowspan=1 colspan=1>new clusteringor similaritymeasurementtasks</td></tr><tr><td rowspan=1 colspan=1>Learning synaptic learning rules(Bengio et al.,1990;1992)</td><td rowspan=1 colspan=1>run a synapse-local learningrule</td><td rowspan=1 colspan=1>parametriclearning rule</td><td rowspan=1 colspan=1>supervisedloss,or similarity tobiologically-motivatednetwork</td><td rowspan=1 colspan=1>gradientdescent, simulatedannealing,geneticalgorithms</td><td rowspan=1 colspan=1>similar domaintasks</td></tr><tr><td rowspan=1 colspan=1>Our work- metalearning forunsupervised representationlearning</td><td rowspan=1 colspan=1>many applications of an unsupervised update rule</td><td rowspan=1 colspan=1>parametricupdate rule</td><td rowspan=1 colspan=1>few shotclassifica- tion afterunsuper-visedpre-training</td><td rowspan=1 colspan=1>SGD</td><td rowspan=1 colspan=1>new basemodels (width,depth,nonlinearity),new datasets,new datamodalities</td></tr></table>
65
+
66
+ $$
67
+ \theta ^ { * } = \underset { \theta } { \operatorname { a r g m i n } } \mathbb { E } _ { \mathrm { t a s k } } \left[ \sum _ { t } \mathrm { M e t a O b j e c t i v e } ( \phi _ { t } ) \right] ,
68
+ $$
69
+
70
+ that minimize the meta-objective over a distribution of training tasks. Note that $\phi _ { t }$ is a function of $\theta$ since $\theta$ affects the optimization trajectory.
71
+
72
+ In the following sections, we briefly review the main components of this model: the base model, the UnsupervisedUpdate, and the MetaObjective. See the Appendix for a complete specification. Additionally, code and meta-trained parameters $\theta$ for our meta-learned UnsupervisedUpdate is available1.
73
+
74
+ # 3.1 BASE MODEL
75
+
76
+ Our base model consists of a standard fully connected multi-layer perceptron (MLP), with batch normalization (Ioffe and Szegedy, 2015), and ReLU nonlinearities. We chose this as opposed to a convolutional model to limit the inductive bias of convolutions in favor of learned behavior from the UnsupervisedUpdate. We call the pre-nonlinearity activations $z ^ { 1 } , \cdots , z ^ { L }$ , and post-nonlinearity activations $x ^ { 0 } , \cdots , \overset { \cdot } { x } ^ { L }$ , where $L$ is the total number of layers, and $x ^ { 0 } \equiv x$ is the network input (raw data). The parameters are $\phi = \left\{ W ^ { 1 } , b ^ { 1 } , V ^ { 1 } , \cdot \cdot \cdot , W ^ { L } , \dot { b ^ { L } } , V ^ { L } \right\}$ , where $W ^ { l }$ and $b ^ { l }$ are the weights and biases (applied after batch norm) for layer $l$ , and $V ^ { l }$ are the corresponding weights used in the backward pass.
77
+
78
+ # 3.2 LEARNED UPDATE RULE
79
+
80
+ We wish for our update rule to generalize across architectures with different widths, depths, or even network topologies. To achieve this, we design our update rule to be neuron-local, so that updates are a function of pre- and post- synaptic neurons in the base model, and are defined for any base model architecture. This has the added benefit that it makes the weight updates more similar to synaptic updates in biological neurons, which depend almost exclusively on local pre- and post-synaptic neuronal activity (Whittington and Bogacz, 2017). In practice, we relax this constraint and incorporate some cross neuron information to decorrelate neurons (see Appendix G.5 for more information).
81
+
82
+ To build these updates, each neuron $i$ in every layer $l$ in the base model has an MLP, referred to as an update network, associated with it, with output $h _ { b } ^ { l } i = \mathrm { M L P } \left( x _ { b } ^ { l } i , z _ { b } i ^ { l } , V ^ { l + 1 } , \delta ^ { l + 1 } ; \boldsymbol { \theta } \right)$ where $b$ indexes the training minibatch. The inputs to the MLP are the feedforward activations $( x ^ { l } \ \& \ z ^ { l } )$ defined above, and feedback weights and an error signal $V ^ { l }$ and $\delta ^ { l }$ , respectively) which are defined below.
83
+
84
+ All update networks share meta-parameters $\theta$ . Evaluating the statistics of unit activation over a batch of data has proven helpful in supervised learning (Ioffe and Szegedy, 2015). It has similarly proven helpful in hand-designed unsupervised learning rules, such as sparse coding and clustering. We therefore allow $h _ { b i } ^ { l }$ to accumulate statistics across examples in each training minibatch.
85
+
86
+ During an unsupervised training step, the base model is first run in a standard feed-forward fashion, populating $x _ { b i } ^ { l } , z _ { b i } ^ { l }$ . As in supervised learning, an error signal $\delta _ { b i } ^ { l }$ is then propagated backwards through the network. Unlike in supervised backprop, however, this error signal is generated by the corresponding update network for each unit. It is read out by linear projection of the per-neuron hidden state $h$ , $\delta _ { b i } ^ { \bar { l } } = \operatorname* { l i n } \left( h _ { b i } ^ { l } \right)$ , and propogated backward using a set of learned ‘backward weights’ $( V ^ { l } ) ^ { T }$ , rather than the transpose of the forward weights $( W ^ { l } ) ^ { T }$ as would be the case in backprop (diagrammed in Figure 1). This is done to be more biologically plausible (Lillicrap et al., 2016).
87
+
88
+ Again as in supervised learning, the weight updates $( \Delta W ^ { l } )$ are a product of pre- and post-synaptic signals. Unlike in supervised learning however, these signals are generated using the per-neuron update networks: $\Delta W _ { i j } ^ { l } = \operatorname { f u n c } \left( h _ { b i } ^ { l } , h _ { b j } ^ { l - 1 } , W _ { i j } \right)$ . The full weight update (which involves normalization and decorrelation across neurons) is defined in Appendix G.5.
89
+
90
+ # 3.3 META-OBJECTIVE
91
+
92
+ The meta-objective determines the quality of the unsupervised representations. In order to meta-train via SGD, this loss must be differentiable. The meta-objective we use in this work is based on fitting a linear regression to labeled examples with a small number of data points. In order to encourage the learning of features that generalize well, we estimate the linear regression weights on one minibatch $\{ x _ { a } , y _ { a } \}$ of $K$ data points, and evaluate the classification performance on a second minibatch $\{ x _ { b } , y _ { b } \}$ also with $K$ datapoints,
93
+
94
+ $$
95
+ \hat { v } = \mathop { \mathrm { a r g m i n } } _ { v } \left( \left\| y _ { a } - v ^ { T } x _ { a } ^ { L } \right\| ^ { 2 } + \lambda \left\| v \right\| ^ { 2 } \right) , \qquad \operatorname { M e t a O b j e c t i v e } ( \cdot ; \phi ) = \operatorname { C o s D i s t } \left( y _ { b } , \hat { v } ^ { T } x _ { b } ^ { L } \right) ,
96
+ $$
97
+
98
+ where $x _ { a } ^ { L }$ , $x _ { b } ^ { L }$ are features extracted from the base model on data $x _ { a } , x _ { b }$ , respectively. The target labels $y _ { a } , y _ { b }$ consist of one hot encoded labels and potentially also regression targets from data augmentation (e.g. rotation angle, see Section 4.2). We found that using a cosine distance, CosDist, rather than unnormalized squared error improved stability. Note this meta-objective is only used during meta-training and not used when applying the learned update rule. The inner loop computation is performed without labels via the UnsupervisedUpdate.
99
+
100
+ # 4 TRAINING THE UPDATE RULE
101
+
102
+ # 4.1 APPROXIMATE GRADIENT BASED TRAINING
103
+
104
+ We choose to meta-optimize via SGD as opposed to reinforcement learning or other black box methods, due to the superior convergence properties of SGD in high dimensions, and the high dimensional nature of $\theta$ . Training and computing derivatives through long recurrent computation of this form is notoriously difficult (Pascanu et al., 2013). To improve stability and reduce the computational cost we approximate the gradients $\frac { \partial [ \mathrm { M e t a O b j e c t i v e } ] } { \partial \theta }$ via truncated backprop through time (Shaban et al., 2018). Many additional design choices were also crucial to achieving stability and convergence in meta-learning, including the use of batch norm, and restricting the norm of the UnsupervisedUpdate update step (a full discussion of these and other choices is in Appendix B).
105
+
106
+ # 4.2 META-TRAINING DISTRIBUTION AND GENERALIZATION
107
+
108
+ Generalization in our learned optimizer comes from both the form of the UnsupervisedUpdate (Section 3.2), and from the meta-training distribution. Our meta-training distribution is composed of both datasets and base model architectures.
109
+
110
+ We construct a set of training tasks consisting of CIFAR10 (Krizhevsky and Hinton, 2009) and multi-class classification from subsets of classes from Imagenet (Russakovsky et al., 2015) as well as from a dataset consisting of rendered fonts (Appendix H.1.1). We find that increased training dataset variation actually improves the meta-optimization process. To reduce computation we restrict the input data to 16x16 pixels or less during meta-training, and resize all datasets accordingly. For evaluation, we use MNIST (LeCun et al., 1998), Fashion MNIST (Xiao et al., 2017), IMDB (Maas et al., 2011), and a hold-out set of Imagenet classes. We additionally sample the base model architecture. We sample number of layers uniformly between 2-5 and the number of units per layer logarithmically between 64 to 512.
111
+
112
+ As part of preprocessing, we permute all inputs along the feature dimension, so that the UnsupervisedUpdate must learn a permutation invariant learning rule. Unlike other work, we focus explicitly on learning a learning algorithm as opposed to the discovery of fixed feature extractors that generalize across similar tasks. This makes the learning task much harder, as the UnsupervisedUpdate has to discover the relationship between pixels based solely on their joint statistics, and cannot “cheat” and memorize pixel identity. To provide further dataset variation, we additionally augment the data with shifts, rotations, and noise. We add these augmentation coefficients as additional regression targets for the meta-objective–e.g. rotate the image and predict the rotation angle as well as the image class. For additional details, see Appendix H.1.1.
113
+
114
+ # 4.3 DISTRIBUTED IMPLEMENTATION
115
+
116
+ We implement the above models in distributed TensorFlow (Abadi et al., 2016). Training uses 512 workers, each of which performs a sequence of partial unrolls of the inner loop UnsupervisedUpdate, and computes gradients of the meta-objective asynchronously. Training takes ${ \sim } 8$ days, and consists of ${ \sim } 2 0 0$ thousand updates to $\theta$ with minibatch size 256. Additional details are in Appendix C.
117
+
118
+ # 5 EXPERIMENTAL RESULTS
119
+
120
+ First, we examine limitations of existing unsupervised and meta learning methods. Then, we show meta-training and generalization properties of our learned optimizer and finally we conclude by visualizing how our learned update rule works. For details of the experimental setup, see Appendix H.
121
+
122
+ # 5.1 OBJECTIVE FUNCTION MISMATCH AND EXISTING META-LEARNING METHODS
123
+
124
+ To illustrate the negative consequences of objective function mismatch in unsupervised learnin algorithms, we train a variational autoencoder on 16x16 CIFAR10. Over the course of training we evaluate classification performance from few shot classification using the learned latent representations. Training curves can be seen in Figure 2. Despite continuing to improve the VAE objective throughout training (not shown here), the classification accuracy decreases sharply later in training.
125
+
126
+ To demonstrate the reduced generalization that results from learning transferable features rather than an update algorithm, we train a prototypical network (Snell et al., 2017) with and without the input shuffling described in Section 4.2. As the prototypical network primarily learns transferrable features, performance is significantly hampered by input shuffling. Results are in Figure 2.
127
+
128
+ ![](images/2b37ce4a17b45d805bcff92a941340738840c1956f0fa8666d739b0147ca1293.jpg)
129
+ Figure 2: Left: Standard unsupervised learning approaches suffer from objective function missmatch. Continuing to optimize a variational auto-encoder (VAE) hurts few-shot accuracy after some number of steps (dashed line). Right: Prototypical networks transfer features rather than a learning algorithm, and perform poorly if tasks don’t have consistent data structure. Training a prototypical network with a fully connected architecture (same as our base model) on a MiniImagenet 10-way classification task with either intact inputs (light purple) or by permuting the pixels before every training and testing task (dark purple). Performance with permuted inputs is greatly reduced (gray line). Our performance is invariant to pixel permutation.
130
+
131
+ # 5.2 META-OPTIMIZATION
132
+
133
+ While training, we monitor a rolling average of the meta-objective averaged across all datasets, model architectures, and the number of unrolling steps performed. In Figure 3 the training loss is continuing to decrease after 200 hours of training, which suggests that the approximate training techniques still produce effective learning. In addition to this global number, we measure performance obtained by rolling out the UnsupervisedUpdate on various meta-training and meta-testing datasets. We see that on held out image datasets, such as MNIST and Fashion Mnist, the evaluation loss is still decreasing. However, for datasets in a different domain, such as IMDB sentiment prediction (Maas et al., 2011), we start to see meta-overfitting. For all remaining experimental results, unless otherwise stated, we use meta-parameters, $\theta$ , for the UnsupervisedUpdate resulting from 200 hours of meta-training.
134
+
135
+ ![](images/4867ff6da60f438e88a3403959524d0dfd6002923319c6c5f60589cf00c063d5.jpg)
136
+ Figure 3: Training curves for the training and evaluation task distributions. Our train set consists of MiniImagenet, Alphabet, and MiniCIFAR. Our test sets are Mini Imagenet Test, Tiny Fashion MNIST, Tiny MNIST and IMDB. Error bars denote standard deviation of evaluations with a fixed window of samples evaluated from a single model. Dashed line at 200 hours indicates model used for remaining experiments unless otherwise stated. For a bigger version of this figure, see Appendix E.
137
+
138
+ # 5.3 GENERALIZATION
139
+
140
+ The goal of this work is to learn a general purpose unsupervised representation learning algorithm. As such, this algorithm must be able to generalize across a wide range of scenarios, including tasks that are not sampled i.i.d. from the meta-training distribution. In the following sections, we explore a subset of the factors we seek to generalize over.
141
+
142
+ # Generalizing over datasets and domains
143
+
144
+ In Figure 4, we compare performance on few shot classification with 10 examples per class. We evaluate test performance on holdout datasets of MNIST and Fashion MNIST at 2 resolutions: $1 4 \times 1 4$ and $2 8 \times 2 8$ (larger than any dataset experienced in meta-training). On the same base model architecture, our learned UnsupervisedUpdate leads to performance better than a variational autoencoder, supervised learning on the labeled examples, and random initialization with trained readout layer.
145
+
146
+ ![](images/7d4093599bb4fc9baeb1fb0b53c97b54a95613c9faf7c02ba404cfec35493ba2.jpg)
147
+ Figure 4: Left: The learned UnsupervisedUpdate generalizes to unseen datasets. Our learned update rule produces representations more suitable for few shot classification than those from random initialization or a variational autoecoder and outperforms fully supervised learning on the same labeled examples. Error bars show standard error. Right: Early in meta-training (purple), the UnsupervisedUpdate is able to learn useful features on a 2 way text classification data set, IMDB, despite being meta-trained only from image datasets. Later in meta-training (red) performance drops due to the domain mismatch. We show inner-loop training, consisting of $5 \mathrm { k }$ applications of the UnsupervisedUpdate evaluating the MetaObjective each iteration. Error bars show standard error across 10 runs.
148
+
149
+ To further explore generalization limits, we test our learned optimizer on data from a vastly different domain. We train on a binary text classification dataset: IMDB movie reviews (Maas et al., 2011), encoded by computing a bag of words with 1K words. We evaluate using a model 30 hours and 200 hours into meta-training (see Figure 4). Despite being trained exclusively on image datasets, the 30 hour learned optimizer improves upon the random initialization by almost $10 \%$ . When meta-training for longer, however, the learned optimizer “meta-overfits” to the image domain resulting in poor performance. This performance is quite low in an absolute sense, for this task. Nevertheless, we find this result very exciting as we are unaware of any work showing this kind of transfer of learned rules from images to text.
150
+
151
+ # Generalizing over network architectures
152
+
153
+ We train models of varying depths and unit counts with our learned optimizer and compare results at different points in training (Figure 5). We find that despite only training on networks with 2 to 5 layers and 64 to 512 units per layer, the learned rule generalizes to 11 layers and 10,000 units per layer.
154
+
155
+ ![](images/0358763d92821a64c1bdbc3d7d779ffc0efaa968cf1e1bef6ea96a26b66c7bab.jpg)
156
+ Figure 5: Left: The learned UnsupervisedUpdate is capable of optimizing base models with hidden sizes and depths outside the meta-training regime. As we increase the number of units per layer, the learned model can make use of this additional capacity despite never having experienced it during meta-training. Right: The learned UnsupervisedUpdate generalizes across many different activation functions not seen in training. We show accuracy over the course of training on 14x14 MNIST.
157
+
158
+ Next we look at generalization over different activation functions. We apply our learned optimizer on base models with a variety of different activation functions. Performance evaluated at different points in training (Figure 5). Despite training only on ReLU activations, our learned optimizer is able to improve on random initializations in all cases. For certain activations, leaky ReLU (Maas et al., 2013) and Swish (Ramachandran et al., 2017), there is little to no decrease in performance. Another interesting case is the step activation function. These activations are traditionally challenging to train as there is no useful gradient signal. Despite this, our learned UnsupervisedUpdate is capable of optimizing as it does not use base model gradients, and achieves performance double that of random initialization.
159
+
160
+ # 5.4 HOW IT LEARNS AND HOW IT LEARNS TO LEARN
161
+
162
+ To analyze how our learned optimizer functions, we analyze the first layer filters over the course of meta-training. Despite the permutation invariant nature of our data (enforced by shuffling input image pixels before each unsupervised training run), the base model learns features such as those shown in Figure 6, which appear template-like for MNIST, and local-feature-like for CIFAR10. Early in training, there are coarse features, and a lot of noise. As the meta-training progresses, more interesting and local features emerge.
163
+
164
+ In an effort to understand what our algorithm learns to do, we fed it data from the two moons dataset. We find that despite being a 2D dataset, dissimilar from the image datasets used in meta-training, the learned model is still capable of manipulating and partially separating the data manifold in a purely unsupervised manner (Figure 6). We also find that almost all the variance in the embedding space is dominated by a few dimensions. As a comparison, we do the same analysis on MNIST. In this setting, the explained variance is spread out over more of the principal components. This makes sense as the generative process contains many more latent dimensions – at least enough to express the 10 digits.
165
+
166
+ ![](images/8873921da0c28140ef3833c2aa553707914e06a20424f2ffafda085c0db008b4.jpg)
167
+ Figure 6: Left: From left to right we show first layer base model receptive fields produced by our learned UnsupervisedUpdate rule over the course of meta-training. Each pane consists of first layer filters extracted from $\phi$ after $1 0 \mathrm { k }$ applications of UnsupervisedUpdate on MNIST (top) and CIFAR10 (bottom). For MNIST, the optimizer learns image-template-like features. For CIFAR10, low frequency features evolve into higher frequency and more spatially localized features. For more filters, see Appendix D. Center: Visualization of learned representations before (left) and after (right) training a base model with our learned UnsupervisedUpdate for two moons (top) and MNIST (bottom). The UnsupervisedUpdate is capable of manipulating the data manifold, without access to labels, to separate the data classes. Visualization shows a projection of the 32-dimensional representation of the base network onto the top three principal components. Right: Cumulative variance explained using principal components analysis (PCA) on the learned representations. The representation for two moons data (red) is much lower dimensional than MNIST (blue), although both occupy a fraction of the full 32-dimensional space.
168
+
169
+ # 6 DISCUSSION
170
+
171
+ In this work we meta-learn an unsupervised representation learning update rule. We show performance that matches or exceeds existing unsupervised learning on held out tasks. Additionally, the update rule can train models of varying widths, depths, and activation functions. More broadly, we demonstrate an application of meta-learning for learning complex optimization tasks where no objective is explicitly defined. Analogously to how increased data and compute have powered supervised learning, we believe this work is a proof of principle that the same can be done with algorithm design–replacing hand designed techniques with architectures designed for learning and learned from data via metalearning.
172
+
173
+ # ACKNOWLEDGMENTS
174
+
175
+ We would like to thank Samy Bengio, David Dohan, Keren Gu, Gamaleldin Elsayed, C. Daniel Freeman, Sam Greydanus, Nando de Freitas, Ross Goroshin, Ishaan Gulrajani, Eric Jang, Hugo Larochelle, Jeremy Nixon, Esteban Real, Suharsh Sivakumar, Pavel Sountsov, Alex Toshev, George Tucker, Hoang Trieu Trinh, Olga Wichrowska, Lechao Xiao, Zongheng Yang, Jiaqi Zhai and the rest of the Google Brain team for extremely helpful conversations and feedback on this work.
176
+
177
+ # REFERENCES
178
+
179
+ Sepp Hochreiter, A Steven Younger, and Peter R Conwell. Learning to learn using gradient descent. In International Conference on Artificial Neural Networks, pages 87–94. Springer, 2001.
180
+
181
+ Juergen Schmidhuber. On learning how to learn learning strategies. 1995.
182
+
183
+ Geoffrey E Hinton and Ruslan R Salakhutdinov. Reducing the dimensionality of data with neural networks. science, 313(5786):504–507, 2006.
184
+
185
+ Pascal Vincent, Hugo Larochelle, Yoshua Bengio, and Pierre-Antoine Manzagol. Extracting and composing robust features with denoising autoencoders. In Proceedings of the 25th international conference on Machine learning, pages 1096–1103. ACM, 2008.
186
+
187
+ Pascal Vincent, Hugo Larochelle, Isabelle Lajoie, Yoshua Bengio, and Pierre-Antoine Manzagol. Stacked denoising autoencoders: Learning useful representations in a deep network with a local denoising criterion. Journal of Machine Learning Research, 11(Dec):3371–3408, 2010.
188
+
189
+ Diederik P Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013.
190
+
191
+ Quoc V Le, Marc’Aurelio Ranzato, Rajat Monga, Matthieu Devin, Kai Chen, Greg S Corrado, Jeff Dean, and Andrew Y Ng. Building high-level features using large scale unsupervised learning. arXiv preprint arXiv:1112.6209, 2011.
192
+
193
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In Advances in neural information processing systems, pages 2672–2680, 2014.
194
+
195
+ Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. arXiv preprint arXiv:1511.06434, 2015.
196
+
197
+ Jeff Donahue, Philipp Krähenbühl, and Trevor Darrell. Adversarial feature learning. arXiv preprint arXiv:1605.09782, 2016.
198
+
199
+ Vincent Dumoulin, Ishmael Belghazi, Ben Poole, Alex Lamb, Martin Arjovsky, Olivier Mastropietro, and Aaron Courville. Adversarially learned inference. arXiv preprint arXiv:1606.00704, 2016.
200
+
201
+ Mehdi Noroozi and Paolo Favaro. Unsupervised learning of visual representations by solving jigsaw puzzles. In European Conference on Computer Vision, pages 69–84. Springer, 2016.
202
+
203
+ Ishan Misra, C Lawrence Zitnick, and Martial Hebert. Shuffle and learn: unsupervised learning using temporal order verification. In European Conference on Computer Vision, pages 527–544. Springer, 2016.
204
+
205
+ Pierre Sermanet, Corey Lynch, Jasmine Hsu, and Sergey Levine. Time-contrastive networks: Self-supervised learning from multi-view observation. arXiv preprint arXiv:1704.06888, 2017.
206
+
207
+ Adam Coates and Andrew Y Ng. Learning feature representations with k-means. In Neural networks: Tricks of the trade, pages 561–580. Springer, 2012.
208
+
209
+ Junyuan Xie, Ross Girshick, and Ali Farhadi. Unsupervised deep embedding for clustering analysis. In International conference on machine learning, pages 478–487, 2016.
210
+
211
+ Piotr Bojanowski and Armand Joulin. Unsupervised learning by predicting noise. arXiv preprint arXiv:1704.05310, 2017.
212
+
213
+ Jürgen Schmidhuber. Learning factorial codes by predictability minimization. Neural Computation, 4(6): 863–879, 1992.
214
+
215
+ Sepp Hochreiter and Jürgen Schmidhuber. Feature extraction through lococode. Neural Computation, 11(3): 679–714, 1999.
216
+
217
+ Bruno A Olshausen and David J Field. Sparse coding with an overcomplete basis set: A strategy employed by v1? Vision research, 37(23):3311–3325, 1997.
218
+
219
+ Jürgen Schmidhuber. Evolutionary principles in self-referential learning, or on learning how to learn: the meta-meta-... hook. PhD thesis, Technische Universität München, 1987.
220
+
221
+ Yoshua Bengio, Samy Bengio, and Jocelyn Cloutier. Learning a synaptic learning rule. Université de Montréal, Département d’informatique et de recherche opérationnelle, 1990.
222
+
223
+ Samy Bengio, Yoshua Bengio, Jocelyn Cloutier, and Jan Gecsei. On the optimization of a synaptic learning rule. In Preprints Conf. Optimality in Artificial and Biological Neural Networks, pages 6–8. Univ. of Texas, 1992.
224
+
225
+ Thomas Philip Runarsson and Magnus Thor Jonsson. Evolution and design of distributed learning rules. In Combinations of Evolutionary Computation and Neural Networks, 2000 IEEE Symposium on, pages 59–63. IEEE, 2000.
226
+
227
+ Oriol Vinyals, Charles Blundell, Tim Lillicrap, koray kavukcuoglu, and Daan Wierstra. Matching networks for one shot learning. In D. D. Lee, M. Sugiyama, U. V. Luxburg, I. Guyon, and R. Garnett, editors, Advances in Neural Information Processing Systems 29, pages 3630–3638. Curran Associates, Inc., 2016. URL http:// papers.nips.cc/paper/6385-matching-networks-for-one-shot-learning.pdf.
228
+
229
+ Sachin Ravi and Hugo Larochelle. Optimization as a model for few-shot learning. International Conference on Learning Representations, 2016.
230
+
231
+ Nikhil Mishra, Mostafa Rohaninejad, Xi Chen, and Pieter Abbeel. Meta-learning with temporal convolutions. arXiv preprint arXiv:1707.03141, 2017.
232
+
233
+ Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In Doina Precup and Yee Whye Teh, editors, Proceedings of the 34th International Conference on Machine Learning, volume 70 of Proceedings of Machine Learning Research, pages 1126–1135, International Convention Centre, Sydney, Australia, 06–11 Aug 2017. PMLR. URL http://proceedings.mlr. press/v70/finn17a.html.
234
+
235
+ Jake Snell, Kevin Swersky, and Richard Zemel. Prototypical networks for few-shot learning. In Advances in Neural Information Processing Systems, pages 4080–4090, 2017.
236
+
237
+ Mengye Ren, Eleni Triantafillou, Sachin Ravi, Jake Snell, Kevin Swersky, Joshua B Tenenbaum, Hugo Larochelle, and Richard S Zemel. Meta-learning for semi-supervised few-shot classification. arXiv preprint arXiv:1803.00676, 2018.
238
+
239
+ Kyle Hsu, Sergey Levine, and Chelsea Finn. Unsupervised learning via meta-learning. arXiv preprint arXiv:1810.02334, 2018.
240
+
241
+ Vikas Garg. Supervising unsupervised learning. In Advances in Neural Information Processing Systems, pages 4996–5006, 2018.
242
+
243
+ Donald R Jones. A taxonomy of global optimization methods based on response surfaces. Journal of global optimization, 21(4):345–383, 2001.
244
+
245
+ Jasper Snoek, Hugo Larochelle, and Ryan P Adams. Practical bayesian optimization of machine learning algorithms. In Advances in neural information processing systems, pages 2951–2959, 2012.
246
+
247
+ James S Bergstra, Rémi Bardenet, Yoshua Bengio, and Balázs Kégl. Algorithms for hyper-parameter optimization. In Advances in neural information processing systems, pages 2546–2554, 2011.
248
+
249
+ James Bergstra and Yoshua Bengio. Random search for hyper-parameter optimization. Journal of Machine Learning Research, 13(Feb):281–305, 2012.
250
+
251
+ Kenneth O Stanley and Risto Miikkulainen. Evolving neural networks through augmenting topologies. Evolutionary computation, 10(2):99–127, 2002.
252
+
253
+ Barret Zoph and Quoc V. Le. Neural architecture search with reinforcement learning. International Conference on Learning Representations, 2017. URL https://arxiv.org/abs/1611.01578.
254
+
255
+ Bowen Baker, Otkrist Gupta, Nikhil Naik, and Ramesh Raskar. Designing neural network architectures using reinforcement learning. International Conference on Learning Representations, 2017.
256
+
257
+ Barret Zoph, Vijay Vasudevan, Jonathon Shlens, and Quoc V Le. Learning transferable architectures for scalable image recognition. Proceedings of the IEEE conference on computer vision and pattern recognition, 2018.
258
+
259
+ Esteban Real, Sherry Moore, Andrew Selle, Saurabh Saxena, Yutaka Leon Suematsu, Quoc Le, and Alex Kurakin. Large-scale evolution of image classifiers. arXiv preprint arXiv:1703.01041, 2017.
260
+
261
+ Dougal Maclaurin, David Duvenaud, and Ryan Adams. Gradient-based hyperparameter optimization through reversible learning. In International Conference on Machine Learning, pages 2113–2122, 2015.
262
+
263
+ 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, pages 3981–3989, 2016.
264
+
265
+ Yutian Chen, Matthew W Hoffman, Sergio Gómez Colmenarejo, Misha Denil, Timothy P Lillicrap, Matt Botvinick, and Nando de Freitas. Learning to learn without gradient descent by gradient descent. arXiv preprint arXiv:1611.03824, 2016.
266
+
267
+ Ke Li and Jitendra Malik. Learning to optimize. International Conference on Learning Representations, 2017.
268
+
269
+ Olga Wichrowska, Niru Maheswaranathan, Matthew W Hoffman, Sergio Gomez Colmenarejo, Misha Denil, Nando de Freitas, and Jascha Sohl-Dickstein. Learned optimizers that scale and generalize. International Conference on Machine Learning, 2017.
270
+
271
+ Irwan Bello, Barret Zoph, Vijay Vasudevan, and Quoc Le. Neural optimizer search with reinforcement learning. 2017. URL https://arxiv.org/pdf/1709.07417.pdf.
272
+
273
+ Rein Houthooft, Richard Y Chen, Phillip Isola, Bradly C Stadie, Filip Wolski, Jonathan Ho, and Pieter Abbeel. Evolved policy gradients. arXiv preprint arXiv:1802.04821, 2018.
274
+
275
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In Francis Bach and David Blei, editors, Proceedings of the 32nd International Conference on Machine Learning, volume 37 of Proceedings of Machine Learning Research, pages 448–456, Lille, France, 07–09 Jul 2015. PMLR. URL http://proceedings.mlr.press/v37/ioffe15. html.
276
+
277
+ James CR Whittington and Rafal Bogacz. An approximation of the error backpropagation algorithm in a predictive coding network with local hebbian synaptic plasticity. Neural computation, 29(5):1229–1262, 2017.
278
+
279
+ Timothy P Lillicrap, Daniel Cownden, Douglas B Tweed, and Colin J Akerman. Random synaptic feedback weights support error backpropagation for deep learning. Nature communications, 7:13276, 2016.
280
+
281
+ Razvan Pascanu, Tomas Mikolov, and Yoshua Bengio. On the difficulty of training recurrent neural networks. In International Conference on Machine Learning, pages 1310–1318, 2013.
282
+
283
+ Amirreza Shaban, Ching-An Cheng, Nathan Hatch, and Byron Boots. Truncated back-propagation for bilevel optimization. arXiv preprint arXiv:1810.10667, 2018.
284
+
285
+ Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. 2009.
286
+
287
+ 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.
288
+
289
+ Yann LeCun, Léon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
290
+
291
+ Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms, 2017.
292
+
293
+ Andrew L. Maas, Raymond E. Daly, Peter T. Pham, Dan Huang, Andrew Y. Ng, and Christopher Potts. Learning word vectors for sentiment analysis. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies, pages 142–150, Portland, Oregon, USA, June 2011. Association for Computational Linguistics. URL http://www.aclweb.org/anthology/ P11-1015.
294
+
295
+ 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 OSDI, volume 16, pages 265–283, 2016.
296
+
297
+ Andrew L Maas, Awni Y Hannun, and Andrew Y Ng. Rectifier nonlinearities improve neural network acoustic models. In Proc. icml, volume 30, page 3, 2013.
298
+
299
+ Prajit Ramachandran, Barret Zoph, and Quoc Le. Searching for activation functions. 2017.
300
+
301
+ Razvan Pascanu, Tomas Mikolov, and Yoshua Bengio. Understanding the exploding gradient problem. CoRR, abs/1211.5063, 2012.
302
+
303
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
304
+
305
+ Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Alex Graves, Ioannis Antonoglou, Daan Wierstra, and Martin Riedmiller. Playing atari with deep reinforcement learning. arXiv preprint arXiv:1312.5602, 2013.
306
+
307
+ Barak Pearlmutter. An investigation of the gradient descent process in neural networks. PhD thesis, Carnegie Mellon University Pittsburgh, PA, 1996.
308
+
309
+ Samuel S Schoenholz, Justin Gilmer, Surya Ganguli, and Jascha Sohl-Dickstein. Deep information propagation. arXiv preprint arXiv:1611.01232, 2016.
310
+
311
+ # A MORE DETAILED SYSTEM DIAGRAM
312
+
313
+ ![](images/8ea1ecceab9cf8adc41c04d35a7ac8cf9a24672d8a07be0bc27843a805858ca3.jpg)
314
+ Figure App.1: Schematic for meta-learning an unsupervised learning algorithm. We show the hierarchical nature of both the meta-training procedure and update rule. a) Meta-training, where the meta-parameters, $\theta$ , are updated via our meta-optimizer (SGD). b) The gradients of the MetaObjective with respect to $\theta$ are computed by backpropagation through the unrolled application of the UnsupervisedUpdate. c) UnsupervisedUpdate updates the base model parameters $( \phi )$ using a minibatch of unlabeled data. d) Each application of UnsupervisedUpdate involves computing a forward and “backward” pass through the base model. The base model itself is a fully connected network producing hidden states $x ^ { l }$ for each layer $l$ . The “backward” pass through the base model uses an error signal from the layer above, $\delta$ , which is generated by a meta-learned function. e.) The weight updates $\Delta \phi$ are computed using a convolutional network, using $\delta$ and $x$ from the pre- and post-synaptic neurons, along with several other terms discussed in the text.
315
+
316
+ # B STABILIZING GRADIENT BASED META-LEARNING TRAINING
317
+
318
+ Training and computing derivatives through recurrent computation of this form is notoriously difficult Pascanu et al. (2013). Training parameters of recurrent systems in general can lead to chaos. We used the usual techniques such as gradient clipping (Pascanu et al., 2012), small learning rates, and adaptive learning rate methods (in our case Adam (Kingma and Ba, 2014)), but in practice this was not enough to train most UnsupervisedUpdate architectures. In this section we address other techniques needed for stable convergence.
319
+
320
+ When training with truncated backprop the problem shifts from pure optimization to something more like optimizing on a Markov Decision Process where the state space is the base-model weights, $\phi$ , and the ‘policy’ is the learned optimizer. While traversing these states, the policy is constantly meta-optimized and changing, thus changing the distribution of states the optimizer reaches. This type of non-i.i.d training has been discussed at great length with respect to on and off-policy RL training algorithms (Mnih et al., 2013). Other works cast optimizer meta-learning as RL (Li and Malik, 2017) for this very reason, at a large cost in terms of gradient variance. In this work, we partially address this issue by training a large number of workers in parallel, to always maintain a diverse set of states when computing gradients.
321
+
322
+ For similar reasons, the number of steps per truncation, and the total number of unsupervised training steps, are both sampled in an attempt to limit the bias introduced by truncation.
323
+
324
+ We found restricting the maximum inner loop step size to be crucial for stability. Pearlmutter (1996) studied the effect of learning rates with respect to the stability of optimization and showed that as the learning rate increases gradients become chaotic. This effect was later demonstrated with respect to neural network training in Maclaurin et al. (2015). If learning rates are not constrained, we found that they rapidly grew and entered this chaotic regime.
325
+
326
+ Another technique we found useful in addressing these problems is the use of batch norm in both the base model and in the UnsupervisedUpdate rule. Multi-layer perceptron training traditionally requires very precise weight initialization for learning to occur. Poorly scaled initialization can make learning impossible (Schoenholz et al., 2016). When applying a learned optimizer, especially early in meta-training of the learned optimizer, it is very easy for the learned optimizer to cause high variance weights in the base model, after which recovery is difficult. Batch norm helps solve this issues by making more of the weight space usable.
327
+
328
+ # C DISTRIBUTED IMPLEMENTATION
329
+
330
+ We implement the described models in distributed Tensorflow (Abadi et al., 2016). We construct a cluster of 512 workers, each of which computes gradients of the meta-objective asynchronously. Each worker trains on one task by first sampling a dataset, architecture, and a number of training steps. Next, each worker samples $k$ unrolling steps, does $k$ applications of the UnsupervisedUpdate $( \cdot ; \theta )$ , computes the MetaObjective on each new state, computes $\frac { \partial [ \mathrm { M e t a O b j e c t i v e } ] } { \partial \theta }$ and sends this gradient to a parameter server. The final base-model state, $\phi$ , is then used as the starting point for the next unroll until the specified number of steps is reached. These gradients from different workers are batched and $\theta$ is updated with asynchronous SGD. By batching gradients as workers complete unrolls, we eliminate most gradient staleness while retaining the compute efficiency of asynchronous workers, especially given heterogeneous workloads which arise from dataset and model size variation. An overview of our training can be seen in algorithm F. Due to the small base models and the sequential nature of our compute workloads, we use multi core CPUs as opposed to GPUs. Training occurs over the course of ${ \sim } 8$ days with ${ \sim } 2 0 0$ thousand updates to $\theta$ with minibatch size 256.
331
+
332
+ # D MORE FILTERS OVER META-TRAINING
333
+
334
+ ![](images/6c675c6e5ca107e5dc5da59233b00e68ebbf7517c641a5ce1cb7c1b8dd9acded.jpg)
335
+ Figure App.2: More filters extracted over the course of meta-training. Note, due to implementation reasons, the columns do not represent the same point / same iteration of $\theta$ . Each filter is extracted after 10k inner loop optimization steps, at $\phi _ { 1 0 k }$ . From top to bottom we show: MNIST, Tiny MNIST, Alphabet, CIFAR10, and Mini CIFAR10. Filters shift from noise at initialization to more local features later in meta-training.
336
+
337
+ ![](images/3d06b921126814b10830d2cac494666ceed453bf1c3ee4ef9ec50fb7d704861a.jpg)
338
+ Figure App.3: Training curves for the meta-training and meta-evaluation task distributions. Our meta-train set consists of Mini Imagenet, Alphabet, and MiniCIFAR10. Our meta-test sets are Mini Imagenet Test, Tiny Fashion MNIST, Tiny MNIST and IMDB. Error bars denote standard deviation of evaluations with a fixed window of samples evaluated from a single model.
339
+
340
+ # F LEARNING ALGORITHM
341
+
342
+ Initialize UnsupervisedUpdates parameters, $\theta _ { 0 }$ .
343
+ Initialize meta-training step count $v 0$ .
344
+ Initialize shared gradient state $s$
345
+ Initialize $R$ to be max meta-training steps.
346
+ while $r < R$ on 512 workers in parallel do Sample supervised task, $\mathcal { D }$ Sample base model $f ( \cdot ; \phi )$ and initialize $\phi _ { 0 }$ randomly Sample $K$ truncated iterations Initialize learner iteration count: $t \gets 0$ for $k = 1$ to $K$ do Sample $U$ unroll iterations for $u = 0$ to $U$ do Sample data, $x$ , from $\mathcal { D }$ $\partial _ { t + u + 1 } = \mathrm { U n s u p e r v i s e d U p d a t e } ( x , \phi _ { t + u } ; \theta _ { r } )$ end for Initialize MetaObjective accumulator $J \gets 0$ for $u = 1$ to $U$ do for $m = 1$ to $M$ (number of MetaObjective evaluations per iteration) do Sample 2 batches of data, $_ { x , x ^ { \prime } }$ , and labels, $y , y ^ { \prime }$ from $\mathcal { D }$ for both training and testing. $\begin{array} { r } { J = \stackrel { \bullet } { J } + \frac { 1 } { U M } } \end{array}$ MetaObjective $( x , y , x ^ { \prime } , y ^ { \prime } , \phi _ { t + u } )$ end for end for Compute $\frac { \partial J } { \partial \theta _ { r } }$ for the last $U$ steps and store in $s$ Update current unroll iteration: $t t + U$ if size of $s >$ meta-batch-size then Take averaged batch of gradients $G$ from $s$ $\begin{array} { r l } & { \theta _ { r + 1 } = \theta _ { r } - \mathrm { A d a m U p } \mathbf { \breve { d a t e } } ( G ) } \\ & { r r + 1 } \end{array}$ end if end for
347
+ end while
348
+
349
+ # G MODEL SPECIFICATION
350
+
351
+ In this section we describe the details of our base model and learned optimizer. First, we describe the inner loop, and then we describe the meta-training procedure in more depth.
352
+
353
+ In the following sections, $\lambda _ { n a m e }$ denotes a hyper-parameter for the learned update rule.
354
+
355
+ The design goals of this system are stated in the text body. At the time of writing, we were unaware of any similar systems, so as such the space of possible architectures was massive. Future work consists of simplifying and improving abstractions around algorithmic components.
356
+
357
+ An open source implementation of the UnsupervisedUpdate can be found at https: //github.com/tensorflow/models/tree/master/research/learning_ unsupervised_learning.
358
+
359
+ # G.1 INNER LOOP
360
+
361
+ The inner loop computation consists of iterative application of the UnsupervisedUpdate on a Base Model parameterized by $\phi$ ,
362
+
363
+ $$
364
+ \phi _ { t + 1 } = \mathrm { U n s u p e r v i s e d U p d a t e } ( \cdot , \phi _ { t } ; \theta ) ,
365
+ $$
366
+
367
+ where $\phi$ consists of forward weights, $W ^ { l }$ , biases, $b ^ { l }$ , parameterizing a multi-layer perceptron as well as backward weights, $V ^ { l }$ used by UnsupervisedUpdate when inner-loop training.
368
+
369
+ This computation can be broken down further as a forward pass on an unlabeled batch of data,
370
+
371
+ $$
372
+ x ^ { 0 } \sim \mathcal { D }
373
+ $$
374
+
375
+ $$
376
+ \{ x ^ { 1 } . . x ^ { L } , z ^ { 1 } . . z ^ { L } \} = f ( x ^ { 0 } ; \phi _ { t } ) ,
377
+ $$
378
+
379
+ where $z ^ { l }$ , and $x ^ { l }$ are the pre- and post-activations on layer $l$ , and $x ^ { 0 }$ is input data. We then compute weight updates:
380
+
381
+ $$
382
+ \{ ( \Delta W ^ { 1 \cdots L } ) _ { t } , ( \Delta b ^ { 1 \cdots L } ) _ { t } , ( \Delta V ^ { 1 \cdots L } ) _ { t } \} = \mathrm { C o m p u t e D e l t a W e i g h t } ( x ^ { 0 } \cdot \cdot x ^ { L } , z ^ { 1 } \cdot \cdot \cdot z ^ { L } , \phi _ { t } ; \theta ) _ { i } ,
383
+ $$
384
+
385
+ Finally, the next set of $\phi$ forward weights $( W ^ { l } )$ , biases $( b ^ { l } )$ , and backward weights $( V ^ { l } )$ , are computed. We use an SGD like update but with the addition of a decay term. Equivalently, this can be seen as setting the weights and biases to an exponential moving average of the $\Delta W ^ { l } , \dot { \Delta } V ^ { l }$ , and $\Delta b ^ { l }$ terms.
386
+
387
+ $$
388
+ \begin{array} { r l } & { W _ { t + 1 } ^ { l } = W _ { t } ^ { l } ( 1 - \lambda _ { \phi l r } ) + \Delta W ^ { l } \lambda _ { \phi l r } } \\ & { V _ { t + 1 } ^ { l } = V _ { t } ^ { l } ( 1 - \lambda _ { \phi l r } ) + \Delta V ^ { l } \lambda _ { \phi l r } } \\ & { b _ { t + 1 } ^ { l } = b _ { t } ^ { l } ( 1 - \lambda _ { \phi l r } ) + \Delta b ^ { l } \lambda _ { \phi l r } } \end{array}
389
+ $$
390
+
391
+ We use $\lambda _ { \phi l r } = 3 e - 4$ in our work. $\Delta W ^ { l } , \Delta V ^ { l } , \Delta b ^ { l }$ are computed via meta-learned functions (parameterized by $\theta$ ).
392
+
393
+ In the following sections, we describe the functional form of the base model, $f$ , as well as the functional form of ComputeDeltaWeight $( \cdot ; \theta )$ .
394
+
395
+ # G.2 BASE MODEL
396
+
397
+ The base model, the model our learned update rule is training, is an $L$ layer multi layer perception with batch norm. We define $\phi$ as this model’s parameters, consisting of weights $( \hat W ^ { l } )$ and biases $( b ^ { l } )$ as well as the backward weights $( V ^ { l } )$ used only during inner-loop training (applications of UnsupervisedUpdate). We define $\bar { N } ^ { 1 } . . N ^ { L }$ to be the sizes of the layers of the base model and $N ^ { 0 }$ to be the size of the input data.
398
+
399
+ $$
400
+ \phi = \{ W ^ { 1 } . . W ^ { L } , V ^ { 1 } . . V ^ { L } , b ^ { 1 } . . b ^ { L } \} ,
401
+ $$
402
+
403
+ where
404
+
405
+ $$
406
+ \begin{array} { c } { { W ^ { l } \in \mathbb R ^ { N ^ { l - 1 } , N ^ { l } } } } \\ { { V ^ { l } \in \mathbb R ^ { N ^ { l - 1 } , N ^ { l } } } } \\ { { b ^ { l } \in \mathbb R ^ { N ^ { l } } } } \end{array}
407
+ $$
408
+
409
+ where $N ^ { l }$ is the hidden size of the network, $N ^ { 0 }$ is the input size of data, and $N ^ { L }$ is the size of the output embedding. In this work, we fix the output layer: $N ^ { L } = 3 2$ and vary the remaining the intermediate $N ^ { 1 . . \bar { ( } L - 1 ) }$ hidden sizes.
410
+
411
+ The forward computation parameterized by $\phi$ , consumes batches of unlabeled data from a dataset $\mathcal { D }$
412
+
413
+ $$
414
+ \begin{array} { r l } & { x ^ { 0 } \sim \mathcal { D } , x ^ { 0 } \in \mathbb { R } ^ { B , N ^ { 0 } } } \\ & { z ^ { l } = \mathrm { B a t c h N o r m } \left( x ^ { l - 1 } W ^ { l } \right) + b ^ { l } } \\ & { x ^ { l } = \mathrm { R e L U } ( { \mathrm { z } } ^ { 1 } ) } \end{array}
415
+ $$
416
+
417
+ for $l = 1 . . L$ .
418
+
419
+ We define $f ( x ; \phi )$ as a function that returns the set of internal pre- and post-activation function hidden states as well as ${ \hat { f } } ( x ; \phi )$ as the function returning the final hidden state:
420
+
421
+ $$
422
+ \begin{array} { l } { { f ( x , \phi ) = \{ z ^ { 1 } . . . z ^ { L } , x ^ { 0 } . . . x ^ { L } , \phi \} } } \\ { { \hat { f } ( x , \phi ) = x ^ { L } } } \end{array}
423
+ $$
424
+
425
+ # G.3 METAOBJECTIVE
426
+
427
+ We define the MetaObjective to be a few shot linear regression. To increase stability and avoid undesirable loss landscapes, we additionally center, as well as normalize the predicted target before doing the loss computation. The full computation is as follows:
428
+
429
+ MetaObjective(x, y, x0, y0, φ) :: (RB,N 0 , RB,N classes , $\begin{array} { r } { \left. ( x , y , x ^ { \prime } , y ^ { \prime } , \phi ) : \boldsymbol { : } ( \mathbb { R } ^ { B , N ^ { 0 } } , \mathbb { R } ^ { B , N ^ { c l a s s e s } } , \mathbb { R } ^ { B , N ^ { 0 } } , \mathbb { R } ^ { B , N ^ { c l a s s e s } } , \Phi ) \right. \mathbb { R } ^ { 1 } , } \end{array}$ (A where $N ^ { c l a s s e s }$ is the number of classes, and $y , y ^ { \prime }$ are one hot encoded labels.
430
+
431
+ First, the inputs are converted to embeddings with the base model,
432
+
433
+ $$
434
+ x ^ { L } = \hat { f } ( x ; \phi )
435
+ $$
436
+
437
+ $$
438
+ \boldsymbol { x } ^ { \prime L } = \boldsymbol { \hat { f } } ( \boldsymbol { x } ^ { \prime } ; \boldsymbol { \phi } )
439
+ $$
440
+
441
+ Next, we center and normalize the prediction targets. We show this for $y$ , but $y ^ { \prime }$ is processed identically.
442
+
443
+ $$
444
+ \begin{array} { c c c } { \displaystyle \bar { y } = \frac { 1 } { B N ^ { c l a s s e s } } \sum _ { i } ^ { B } { \sum _ { j } ^ { c l a s s e s } y _ { i j } } } \\ { \displaystyle \hat { y } _ { i j } = \frac { y _ { i j } - \bar { y } } { \sqrt { \frac { 1 } { N ^ { c l a s s e s } } \sum _ { a } ^ { N ^ { c l a s s e s } } { \left\| \bar { y } _ { i a } \right\| _ { 2 } ^ { 2 } } } } } \end{array}
445
+ $$
446
+
447
+ We then solve for the linear regression weights in closed form with features: $x ^ { L }$ and targets: $\hat { y }$ . We account for a bias by concatenating a $1$ ’s vector to the features.
448
+
449
+ $$
450
+ \begin{array} { l } { A = [ x ^ { L } ; \mathbb { 1 } ] } \\ { C = \left( ( A ^ { t } A ) + I \lambda _ { \mathrm { r i d g e } } \right) ^ { - 1 } A ^ { T } \hat { y } } \end{array}
451
+ $$
452
+
453
+ We then use these inferred regression weights $C$ to make a prediction on the second batch of data, normalize the resulting prediction, and compute a final loss,
454
+
455
+ $$
456
+ \begin{array} { c } { \displaystyle p = C [ { \boldsymbol { x } ^ { \prime } } ^ { L } ; \mathbb { 1 } ] } \\ { \displaystyle \hat { p } _ { b i } = \frac { p _ { b i } } { \left\| p _ { b } \right\| _ { 2 } } } \\ { \displaystyle \mathrm { M e t a O b j e c t i v e ( \cdot ) } = \frac { 1 } { B } \sum _ { b } ^ { B } \left\| \hat { p } _ { b } - \hat { y } _ { b } \right\| _ { 2 } ^ { 2 } . } \end{array}
457
+ $$
458
+
459
+ Note that due to the normalization of predictions and targets, this corresponds to a cosine distance (up to an offset and multiplicative factor).
460
+
461
+ # G.4 UNSUPERVISEDUPDATE
462
+
463
+ The learned update rule is parameterized by $\theta$ . In the following section, we denote all instances of $\theta$ with a subscript to be separate named learnable parameters of the UnsupervisedUpdate. $\theta$ is shared across all instantiations of the unsupervised learning rule (shared across layers). It is this weight sharing that lets us generalize across different network architectures.
464
+
465
+ The computation is split into a few main components: first, there is the forward pass, defined in $f ( x ; \phi )$ . Next, there is a “backward” pass, which operates on the hidden states in a reverse order to propagate an error signal $\delta ^ { l }$ back down the network. In this process, a hidden state $h ^ { l }$ is created for each layer. These h are tensors with a batch, neuron and feature index: $h ^ { l } \in \mathbb { R } ^ { B , N ^ { l } , \lambda _ { h d i m s } }$ where $\lambda _ { h d i m s } = 6 4$ . Weight updates to $W ^ { l }$ and $b ^ { l }$ are then readout from these $h ^ { l }$ and other signals found both locally, and in aggregate along both batch and neuron.
466
+
467
+ # G.4.1 BACKWARD ERROR PROPAGATION
468
+
469
+ In backprop, there exists a single scalar error signal that gets backpropagated back down the network. In our work, this error signal does not exist as there is no loss being optimized. Instead we have a learned top-down signal, $\dot { d } ^ { L }$ , at the top of the network. Because we are no longer restricted to the form of backprop, we make this quantity a vector for each unit in the network, rather than a scalar,
470
+
471
+ $$
472
+ \begin{array} { c } { x ^ { 0 } \sim \mathcal { D } , x ^ { 0 } \in \mathbb { R } ^ { B , N _ { x } } } \\ { \{ z ^ { 1 } . . . z ^ { L } , x ^ { 0 } . . . x ^ { L } , \phi \} = f ( x ; \phi ) } \\ { d ^ { L } = \mathrm { T o p D } ( x ^ { L } ; \theta _ { t o p D } ) } \end{array}
473
+ $$
474
+
475
+ where $d ^ { l } \in \mathbb { R } ^ { B , N ^ { l } , \lambda _ { d e l t a d i m s } }$ . In this work we set $\lambda _ { d e l t a d i m s } = 3 2 $ . The architecture of TopD is a neural network that operates along every dimension of $x ^ { L }$ . The specification can be found in G.7.
476
+
477
+ We structure our error propagation similarly to the structure of the backpropagated error signal in a standard MLP with contributions to the error at every layer in the network,
478
+
479
+ $$
480
+ \delta _ { i j d } ^ { l } = d _ { i j d } ^ { l } \odot \sigma \big ( z _ { i j d } ^ { l } \big ) + \sum _ { k } ^ { \lambda _ { h d i m s } } \big ( \theta _ { e r r o r P r o p W } \big ) _ { k d } h _ { i j k } ^ { l } + \big ( \theta _ { e r r o r P r o p B } \big ) _ { d }
481
+ $$
482
+
483
+ where $\delta ^ { l }$ has the same shape as $d ^ { l }$ , and $\theta _ { e r r o r P r o p W } \ \in \ \mathbb { R } ^ { \lambda _ { h d i m s } , \lambda _ { d e l t a d i m s } }$ and $\theta _ { e r r o r P r o p B } \ \in$ $\mathbb { R } ^ { \lambda _ { d e l t a d i m s } }$ . Note both $\theta _ { e r r o r P r o p W }$ and $\theta _ { e r r o r P r o p B }$ are shared for all layers $l$ .
484
+
485
+ In a similar way to backprop, we move this signal down the network via multiplying by a backward weight matrix $( \dot { V } ^ { l } )$ . We do not use the previous weight matrix transpose as done in backprop, instead we learn a separate set of weights that are not tied to the forward weights and updated along with the forward weights as described in G.5. Additionally, we normalize the signal to have fixed second moment,
486
+
487
+ $$
488
+ \begin{array} { l } { { \displaystyle { \tilde { d } } _ { i m d } ^ { l } = \sum _ { j } ^ { N ^ { l + 1 } } \delta _ { i j d } ^ { l + 1 } ( V ^ { l + 1 } ) _ { m j } } } \\ { { \displaystyle { \tilde { d } } _ { i m d } ^ { l } = \hat { d } _ { i m d } ^ { l } \left( \frac { 1 } { \lambda _ { d e l t a d i m s } } \sum _ { a } ^ { \lambda _ { d e l t a d i m s } } \tilde { d } _ { i m a } ^ { l } \right) ^ { - \frac { 1 } { 2 } } } } \end{array}
489
+ $$
490
+
491
+ The internal $h ^ { l } \in \mathbb { R } ^ { B , N ^ { l } , \lambda _ { h d i m s } }$ vectors are computed via:
492
+
493
+ $$
494
+ h ^ { l } = \mathrm { C o m p u t e H } \left( d ^ { l } , x ^ { l } , z ^ { l } ; \theta _ { c o m p u t e H } \right)
495
+ $$
496
+
497
+ The architecture of ComputeH is a neural network that operates on every dimension of all the inputs. It can be found in G.8. These definitions are recursive, and are computed in order: $h ^ { L } , h ^ { L - 1 } \cdot \cdot \cdot h ^ { 1 ^ { \prime } } , h ^ { 0 }$ . With these computed, weight updates can be read out (Section G.5). When the corresponding symbols are not defined (e.g. $z ^ { 0 }$ ) a zeros tensor with the correct shape is used instead.
498
+
499
+ # G.5 WEIGHT UPDATES
500
+
501
+ The following is the implementation of ComputeDeltaWeight $( x ^ { 0 } \cdot \cdot \cdot x ^ { L } , z ^ { 1 } \cdot \cdot \cdot z ^ { L } , \phi ; \theta )$
502
+
503
+ For a given layer, $l$ , our weight updates are a mixture of multiple low rank readouts from $h ^ { l }$ and $h ^ { l - 1 }$ . These terms are then added together with a learnable weight, in $\theta$ to form a final update. The final update is then normalized mixed with the previous weights. We update both the forward, $W ^ { l }$ , and the backward, $V ^ { l }$ , using the same update rule parameters $\theta$ . We show the forward weight update rule here, and drop the backward for brevity.
504
+
505
+ For convenience, we define a low rank readout function LowRR that takes $h ^ { l }$ like tensors, and outputs a single lower rank tensor.
506
+
507
+ $$
508
+ \begin{array} { r l } & { \mathrm { L o w R R } ( h ^ { a } , h ^ { b } ; \Theta ) : : } \\ & { \quad \quad \quad ( \mathbb { R } ^ { B , N ^ { a } , \lambda _ { h d i m s } } , \mathbb { R } ^ { B , N ^ { b } , \lambda _ { h d i m s } } ) \mathbb { R } ^ { N ^ { \prime \prime } , N ^ { b } } } \end{array}
509
+ $$
510
+
511
+ Here, $\Theta$ , is a placehoder for the parameters of the given readout. LowRR is defined as:
512
+
513
+ $$
514
+ \begin{array} { l } { { \displaystyle \Theta = \{ P ^ { a } , P ^ { b } \} ~ \mathrm { w h e r e } ~ P ^ { a } \in \mathbb { R } ^ { \lambda _ { h d m s } , \lambda _ { g r a d c } } } } \\ { { \displaystyle r _ { i j p } ^ { a } = \sum _ { k } h _ { i j k } ^ { a } P _ { k p } ^ { a } } } \\ { { \displaystyle r _ { i j p } ^ { b } = \sum _ { k } h _ { i j k } ^ { b } P _ { k p } ^ { b } } } \\ { { \displaystyle \mathrm { L o w R R } ( \cdot ) _ { j p } = \sum _ { i } ^ { B } \sum _ { k } r _ { i j k } ^ { a d c } r _ { i j k } ^ { b } r _ { i j k } ^ { a } \frac { 1 } { B \lambda _ { h d i m s } } } } \end{array}
515
+ $$
516
+
517
+ where $\lambda _ { g r a d c } = 4$ and is the rank of the readout matrix (per batch element).
518
+
519
+ # G.5.1 LOCAL TERMS
520
+
521
+ This sequence of terms allow the weight to be adjusted as a function of state in the pre- and postsynaptic neurons. They should be viewed as a basis function representation of the way in which the weight changes as a function of pre- and post-synaptic neurons, and the current weight value. We express each of these contributions to the weight update as a sequence of weight update planes, with the ith plane written $\Delta W _ { i } ^ { l } \in \mathbb { R } ^ { N ^ { l - 1 } \times N ^ { l } }$ . Each of these planes will be linearly summed, with coefficients generated as described in Equation App.57, in order to generate the eventual weight update.
522
+
523
+ $$
524
+ \begin{array} { l } { \displaystyle { \hat { W } ^ { l } = \frac { W ^ { l } } { \sqrt { \frac { 1 } { N ^ { 1 - 1 } } \sum _ { i } ^ { N ^ { l - 1 } } \left( W ^ { l } \right) _ { i } ^ { 2 } } } } } \\ { { \displaystyle \Delta W _ { 1 } ^ { 1 } = \bar { W } ^ { l } } } \\ { { \displaystyle \Delta W _ { 2 } ^ { l } = \langle \bar { W } ^ { l } \rangle ^ { 2 } s i g n ( \hat { W } ^ { l } ) } } \\ { { \displaystyle \Delta W _ { 3 } ^ { 1 } = \mathrm { l o w } [ \mathrm { R } ( h ^ { l - 1 } , h ^ { l } ; g _ { z e e e } ) ] } } \\ { { \displaystyle \Delta W _ { 4 } ^ { 1 } = \mathrm { e x p } ( - \langle \bar { W } _ { b } ^ { l } \rangle ^ { 2 } ) \odot \mathrm { L o w R R } ( h ^ { l - 1 } , h ^ { l } ; \theta _ { b f r b f } ) } } \\ { { \displaystyle \Delta W _ { 5 } ^ { 1 } = W _ { b } ^ { 1 } \odot \mathrm { L o w R R } ( h ^ { l - 1 } , h ^ { l } ; \theta _ { l i r s t } ) } } \\ { { \displaystyle \Delta W _ { 6 } ^ { 1 } = \frac { 1 } { B } \frac { B } { b } \left( x _ { b } ^ { l - 1 } - \frac { 1 } { B } \frac { B } { b ^ { 1 } } x _ { b } ^ { l - 1 } \right) ^ { T } \left( x _ { b } ^ { l } - \frac { 1 } { B } \frac { B } { b ^ { 1 } } x _ { b } ^ { l } \right) ^ { T } } } \end{array}
525
+ $$
526
+
527
+ # G.5.2 DECORRELATION TERMS
528
+
529
+ Additional weight update planes are designed to aid units in remaining decorrelated from each other’s activity, and in decorrelating their receptive fields. Without terms like this, a common failure mode
530
+
531
+ is for many units in a layer to develop near-identical representations. Here, $S _ { i } ^ { l }$ indicates a scratch matrix associated with weight update plane $i$ and layer $l$ .
532
+
533
+ $$
534
+ \begin{array} { r l } & { \quad S _ { T } ^ { \prime } = \frac { 1 } { \sqrt { N ^ { 3 } - 1 } } \operatorname { L o n e r B E } ( h , \hat { u } ^ { - 1 } , h ^ { - 1 } , \theta _ { 0 \le t \le m \le N \le n } ) } \\ & { \quad \Delta N _ { T } ^ { \prime } = \frac { 1 } { \sqrt { N ^ { 3 } - 1 } } [ ( S _ { T } ^ { \prime } + ( S _ { T } ^ { \prime } ) ^ { T } ) \Phi ( 1 - T ) ] W ^ { T } } \\ & { \quad S _ { T } ^ { \prime } = \frac { 1 } { \sqrt { N ^ { 3 } - 1 } } \operatorname { L o n e r B E } ( h ^ { - 1 } , h ^ { - 1 } , \theta _ { 0 \le t \le m \le N \le n } ) } \\ & { \quad \Delta N _ { t } ^ { \prime } = \frac { 1 } { \sqrt { N ^ { 3 } - 1 } } [ ( S _ { T } ^ { \prime } + ( S _ { T } ^ { \prime } ) ^ { T } ) \Phi ( 1 - T ) ] ( \sqrt { N ^ { 3 } + ( \theta _ { T } ^ { \prime } ) ^ { T } } - 1 ) } \\ & { \quad \quad S _ { T } ^ { \prime } = \frac { 1 } { \sqrt { N ^ { 3 } - 1 } } \operatorname { L o n e r B R } ( h , \hat { u } ^ { \prime } , h _ { 0 \le t \le T \le s } ) \operatorname { a n d } } \\ & { \quad \Delta N _ { t } ^ { \prime } = \frac { 1 } { \sqrt { N ^ { 3 } - 1 } } \operatorname { L o n e r B e r } ( h , \hat { u } ^ { \prime } , h _ { 0 \le t \le T \le s } ) \operatorname { a n d } } \\ & { \quad \Delta N _ { t } ^ { \prime } = \frac { 1 } { \sqrt { N ^ { 3 } - 1 } } \operatorname { L o n e r B } ( h ^ { - 1 } , \theta _ { 0 \le t \le s } ) \operatorname { a n d } } \\ & { \quad \quad S _ { T } ^ { \prime } = \frac { 1 } { \sqrt { N ^ { 3 } - 1 } } \operatorname { L o n e r B } ( h ^ { - 1 } , h ^ { - 1 } , \theta _ { 0 \le t \le s } ) \operatorname { a n d } } \\ & \quad \quad \Delta N _ { t } ^ { \prime } = \frac { 1 } { \sqrt { N ^ { 3 } - 1 } } ( \int _ { 0 } ^ { 1 } ( S _ { T } ^ { \prime } + ( S _ { T } ^ { \prime } ) ^ { T } ) \Phi ( 1 - ( S _ { T } ^ \end{array}
535
+ $$
536
+
537
+ # G.6 APPLICATION OF THE WEIGHT TERMS IN THE OPTIMIZER
538
+
539
+ We then normalize, re-weight, and merge each of these weight update planes into a single term, which will be used in the weight update step,
540
+
541
+ $$
542
+ \begin{array} { c } { \displaystyle \Delta \tilde { W } _ { i } ^ { l } = \frac { \Delta W _ { i } ^ { l } } { \sqrt { 1 + \frac { 1 } { N ^ { l - 1 } N ^ { l } } \sum _ { m } ^ { N ^ { l - 1 } } \sum _ { n } ^ { N ^ { l } } \left( \Delta W _ { i m n } ^ { l } \right) ^ { 2 } } } } \\ { \displaystyle ( \Delta W _ { m e r g e } ^ { l } ) _ { j k } = \frac { 1 } { B } \sum _ { i } ^ { B } ( \theta _ { m e r g e W } ) _ { i } \Delta \tilde { W } _ { i j k } ^ { l } , } \end{array}
543
+ $$
544
+
545
+ where $\theta _ { m e r g e W } \in \mathbb { R } ^ { 1 0 }$ (as we have 10 input planes).
546
+
547
+ To prevent pathologies during training, we perform two post processing steps to prevent the learned optimizer from cheating, and increasing its effective learning rate, leading to instability. We only allow updates which do not decrease the weight matrix magnitude,
548
+
549
+ $$
550
+ \Delta W _ { o r t h } ^ { l } = \Delta W _ { m e r g e } ^ { l } - \hat { W } ^ { l } \mathrm { R e L U } ( \Delta W _ { m e r g e } \cdot \hat { W } ^ { l } ) ,
551
+ $$
552
+
553
+ where $\hat { W } ^ { l }$ is $W ^ { l }$ scaled to have unit norm, and we normalize the length of the update,
554
+
555
+ $$
556
+ \Delta W _ { f i n a l } ^ { l } = \frac { \Delta W _ { o r t h } ^ { l } } { \sqrt { 1 + \frac { 1 } { N ^ { l - 1 } N ^ { l } } \sum _ { m } ^ { N ^ { l - 1 } } \sum _ { n } ^ { N ^ { l } } \left( \Delta W _ { o r t h } ^ { l } \right) _ { m n } ^ { 2 } } }
557
+ $$
558
+
559
+ To compute changes in the biases, we do a readout from $h ^ { l }$ . We put some constraints on this update to prevent the biases from pushing all units into the linear regime, and minimizing learning. We found this to be a possible pathology.
560
+
561
+ $$
562
+ \begin{array} { r } { \displaystyle \Delta b _ { b a s e } ^ { l } = \frac { 1 } { B } \sum _ { i } ^ { B } { \displaystyle \sum _ { k } ^ { \lambda _ { h d i m s } } { ( \theta _ { B r e a d o u t } ) _ { k } h _ { i j k } ^ { l } } } } \\ { \displaystyle \Delta b _ { c o n s t r a i n e d } ^ { l } = \Delta b _ { b a s e } ^ { l } - \mathrm { R e L U } \left( - \frac { 1 } { N ^ { l } } \sum _ { i } ^ { N ^ { l } } { \left( \Delta b _ { b a s e } ^ { l } \right) _ { i } } \right) , } \end{array}
563
+ $$
564
+
565
+ where $\theta _ { B r e a d o u t } \in \mathbb { R } ^ { \lambda _ { h d i m s } }$ .
566
+
567
+ We then normalize the update via the second moment:
568
+
569
+ $$
570
+ \Delta b _ { f i n a l } ^ { l } = \frac { \Delta b _ { c o n s t r a i n e d } ^ { l } } { \frac { 1 } { N ^ { l } } \sum _ { i } ^ { N ^ { l } } ( \Delta b _ { c o n s t r a i n e d } ^ { l } ) _ { i } ^ { 2 } }
571
+ $$
572
+
573
+ Finally, we define ComputeDeltaWeight as all layer’s forward weight updates, and backward weight updates, and bias updates.
574
+
575
+ $$
576
+ \mathrm { C o m p u t e D e l t a W e i g h t } ( x ^ { 0 } \cdot \cdot \cdot x ^ { L } , z ^ { 1 } \cdot \cdot \cdot z ^ { L } , \phi _ { t } ; \theta ) = ( \Delta W _ { f i n a l } ^ { 1 \cdot \perp L } , \Delta b _ { f i n a l } ^ { 1 \cdot \perp L } , \Delta V _ { f i n a l } ^ { 1 \cdot \perp L } )
577
+ $$
578
+
579
+ # G.7 TopD
580
+
581
+ This function performs various convolutions over the batch dimension and data dimension. For ease of notation, we use $m$ as an intermediate variable. Additionally, we drop all convolution and batch norm parameterizations. They are all separate elements of $\theta _ { t o p D }$ . We define two 1D convolution operators that act on rank 3 tensors: ConvBatch which performs convolutions over the zeroth index, and ConvUnit which performs convolutions along the firs index. We define the $S$ argument to be size of hidden units, and the $K$ argument to be the kernel size of the 1D convolutions. Additionally, we set the second argument of BatchNorm to be the axis normalized over.
582
+
583
+ $$
584
+ \mathrm { T o p D } ( x ^ { L } ; \theta _ { t o p D } ) : : \mathbb { R } ^ { B , N ^ { L } } \mathbb { R } ^ { B , N ^ { L } , \lambda _ { d e l t a d i m s } }
585
+ $$
586
+
587
+ First, we reshape to add another dimension to the end of $x ^ { L }$ , in pseudocode:
588
+
589
+ $$
590
+ m _ { 0 } = [ x ^ { L } ]
591
+ $$
592
+
593
+ Next, a convolution is performed on the batch dimension with a batch norm and a ReLU non linearity.
594
+ This starts to pull information from around the batch into these channels.
595
+
596
+ $$
597
+ \begin{array} { r l } & { m _ { 1 } = \mathrm { { C o n v B a t c h } } \left( { m _ { 0 } , S = \lambda _ { t o p d e l t a s i z e } , K = 5 } \right) } \\ & { m _ { 2 } = \mathrm { { R e L U } } \left( { \mathrm { B a t c h N o r m } \left( { m _ { 1 } , \mathord { \left[ 0 , 1 \right] } } } \righ\right)t) } \end{array}
598
+ $$
599
+
600
+ We set $\lambda _ { t o p d e l t a s i z e } = 6 4$ . Next, a series of unit convolutions (convolutions over the last dimension) are performed. These act as compute over information composed from the nearby elements of the batch. These unit dimensions effectively rewrite the batch dimension. This restricts the model to operate on a fixed size batch.
601
+
602
+ $$
603
+ \begin{array} { r l } & { m _ { 3 } = \mathrm { C o n v U n i t } \left( m _ { 2 } , S = B , K = 3 \right) } \\ & { m _ { 4 } = \mathrm { R e L U } \left( \mathrm { B a t c h N o r m } \left( m _ { 3 } , [ 0 , 1 ] \right) \right) } \\ & { m _ { 5 } = \mathrm { C o n v U n i t } \left( m _ { 4 } , S = B , K = 3 \right) } \\ & { m _ { 6 } = \mathrm { R e L U } \left( \mathrm { B a t c h N o r m } \left( m _ { 5 } , [ 0 , 1 ] \right) \right) } \end{array}
604
+ $$
605
+
606
+ Next a series of 1D convolutions are performed over the batch dimension for more compute capacity.
607
+
608
+ $$
609
+ \begin{array} { r l } & { m _ { 7 } = \mathrm { C o n v B a t c h } \left( m _ { 6 } , S = \lambda _ { t o p d e l t a s i z e } , K = 3 \right) } \\ & { m _ { 8 } = \mathrm { R e L U } \left( \mathrm { B a t c h N o r m } \left( m _ { 7 } , \left[ 0 , 1 \right] \right) \right) } \\ & { m _ { 9 } = \mathrm { C o n v B a t c h } \left( m _ { 8 } , S = \lambda _ { t o p d e l t a s i z e } , K = 3 \right) } \\ & { m _ { 1 0 } = \mathrm { R e L U } \left( \mathrm { B a t c h N o r m } \left( m _ { 9 } , \left[ 0 , 1 \right] \right) \right) } \end{array}
610
+ $$
611
+
612
+ Finally, we convert the representations to the desired dimensions and output.
613
+
614
+ $$
615
+ \begin{array} { c } { { m _ { 1 1 } = \mathrm { C o n v B a t c h } \left( m _ { 1 0 } , S = \lambda _ { d e l t a d i m s } , K = 3 \right) } } \\ { { { \mathrm { T o p D } \left( x ^ { L } ; \theta _ { t o p D } \right) = m _ { 1 1 } } } } \end{array}
616
+ $$
617
+
618
+ # G.8 ComputeH
619
+
620
+ This is the main computation performed while transfering signals down the network and the output is directly used for weight updates. It is defined as:
621
+
622
+ $$
623
+ \begin{array} { r l } & { \mathrm { C o m p u t e H } \left( d ^ { l } , x ^ { l } , z ^ { l } , W ^ { l } , W ^ { l + 1 } , b ^ { l } ; \theta _ { c o m p u t e H } \right) : : } \\ & { \left( \mathbb { R } ^ { B , N ^ { l } , \lambda _ { d e l t a d i m s } } , \mathbb { R } ^ { B , N ^ { l } } , \mathbb { R } ^ { B , N ^ { l } } , \mathbb { R } ^ { N ^ { l - 1 } , N ^ { l } } , \mathbb { R } ^ { N ^ { 1 } , N ^ { l + 1 } } , \mathbb { R } ^ { N ^ { l } } \right) \to \left( \mathbb { R } ^ { B , N ^ { l } , \lambda _ { h d i m s } } \right) } \end{array}
624
+ $$
625
+
626
+ The outputs of the base model, $( x ^ { l } , z ^ { l } )$ , plus an additional positional embeddings are stacked then concatenated with $d$ , to form a tensor in $\mathbb { R } ^ { B , N ^ { l } , ( 4 + \lambda _ { d e l t a d i m s } ) }$ :
627
+
628
+ $$
629
+ \begin{array} { r l } & { \displaystyle ( { p ^ { 0 } } ) _ { i j } = \sin ( \frac { 2 j \pi } { N ^ { l } } ) } \\ & { \displaystyle ( { p ^ { 1 } } ) _ { i j } = \cos ( \frac { 2 j \pi } { N ^ { l } } ) } \\ & { \quad \quad m _ { 0 } = [ x ^ { l } , z ^ { l } , p ^ { 0 } , p ^ { 1 } ] \mathrm { w h e r e } m _ { 0 } \in \mathbb R ^ { B , N ^ { l } , 4 } } \\ & { \quad m _ { 1 } = [ m _ { 0 } ; d ^ { l } ] } \end{array}
630
+ $$
631
+
632
+ Statistics across the batch and unit dimensions, 0 and 1, are computed. We define a Statsi function bellow. We have 2 instances for both the zeroth and the first index, shown bellow is the zeroth index and the first is omitted.
633
+
634
+ $$
635
+ \begin{array} { c } { { \mathrm { \normalfont ~ \hat { s t a n s } _ \bot ( ~ } w ) : \displaystyle \mathbb { R } ^ { R ^ { 0 } } \cdot \mathbb { R } ^ { t } \to \mathbb { R } ^ { R ^ { 1 } } \to \mathbb { R } ^ { R ^ { 1 } } \times } } \\ { { \mathrm { \normalfont ~ \hat { \rho } ( s _ { 1 } ) } _ { \lambda } = \displaystyle \frac { 1 } { K ^ { 0 } } \sum _ { i = 1 } ^ { K ^ { 0 } } \mathrm { a l s } ( w _ { i i } ) } } \\ { { \mathrm { \normalfont ~ \hat { \rho } ( s _ { 2 } ) } _ { j } = \displaystyle \sqrt { \frac { 1 } { K ^ { 0 } } \sum _ { j ^ { \prime } } ^ { R ^ { 0 } } ( w _ { j i } ) ^ { 2 } } } } \\ { { \mathrm { \normalfont ~ \hat { \rho } ( s _ { j } ) } _ { j } = \displaystyle \frac { 1 } { K ^ { 0 } } \sum _ { j ^ { \prime } } ^ { R ^ { 0 } } w _ { i j } } } \\ { { \mathrm { \normalfont ~ \hat { \rho } ( s _ { j } ) } _ { j ^ { \prime } } = \displaystyle \frac { 1 } { K ^ { 0 } } \sum _ { i = 1 } ^ { K ^ { 0 } } ( s _ { j i } ) _ { i ^ { \prime } } } } \\ { { \mathrm { \normalfont ~ \hat { \rho } ( s _ { j } ) } _ { j ^ { \prime } } = \displaystyle \sqrt { \frac { 1 } { K ^ { 0 } } \sum _ { j ^ { \prime } } ^ { R ^ { 0 } } ( s _ { j i } ) _ { i ^ { \prime } } - w _ { i j } ) ^ { 2 } } } } \\ { { \mathrm { \normalfont ~ \hat { \rho } ( a t { s } _ { 1 } ) } _ { i ^ { \prime } } , } } \end{array}
636
+ $$
637
+
638
+ We the compute statistics of the weight matrix below, and above. We tile the statistics to the appropriate dimensions and concatenate with normalized inputs as well as with the bias (also tiled appropriately).
639
+
640
+ $$
641
+ \begin{array} { r l r } { { ( s _ { 0 } ) _ { i j k } = ( \mathrm { S t a t s } _ { 0 } ( W ^ { l } , 0 ) ) _ { j } } } \\ & { ( s _ { 1 } ) _ { i j k } = ( \mathrm { S t a t s } _ { 1 } ( W ^ { l + 1 } , 1 ) ) _ { i } } \\ & { } & { m _ { 2 } = \mathrm { B a t c h N o r m } ( m _ { 1 } , [ 0 , 1 ] ) } \\ & { } & { \hat { b } _ { i j k } = b _ { j } ^ { l } \mathrm { ~ w h e r e ~ } \hat { b } \in \mathbb { R } ^ { B , N ^ { l } , 1 } } \\ & { } & { m _ { 3 } = [ s _ { 0 } ; s _ { 1 } ; m _ { 2 } ; \hat { b } ] \mathrm { ~ w h e r e ~ } m _ { 3 } \in \mathbb { R } ^ { B , N ^ { l } , 4 + 4 + ( 4 + \lambda _ { d e l t a d i m s } ) + 1 } } \end{array}
642
+ $$
643
+
644
+ With the inputs prepared, we next perform a series of convolutions on batch and unit dimensions, (0, 1).
645
+
646
+ $$
647
+ \begin{array} { r l } & { m _ { 4 } = \mathrm { C o n v B a t c h } \left( m _ { 3 } , S = \lambda _ { c o m p u t e h s i z e } , K = 3 \right) } \\ & { m _ { 5 } = \mathrm { R e L U } \left( \mathrm { B a t c h N o r m } \left( m _ { 4 } , \left[ 0 , 1 \right] \right) \right) } \\ & { m _ { 6 } = \mathrm { C o n v U n i t } \left( m _ { 5 } , S = \lambda _ { c o m p u t e h s i z e } , K = 3 \right) } \\ & { m _ { 7 } = \mathrm { R e L U } \left( \mathrm { B a t c h N o r m } \left( m _ { 6 } , \left[ 0 , 1 \right] \right) \right) } \\ & { m _ { 8 } = \mathrm { C o n v B a t c h } \left( m _ { 7 } , S = \lambda _ { c o m p u t e h s i z e } , K = 3 \right) } \\ & { m _ { 9 } = \mathrm { R e L U } \left( \mathrm { B a t c h N o r m } \left( m _ { 8 } , \left[ 0 , 1 \right] \right) \right) } \\ & { m _ { 1 0 } = \mathrm { C o n v U n i t } \left( m _ { 9 } , S = \lambda _ { c o m p u t e h s i z e } , K = 3 \right) } \\ & { m _ { 1 1 } = \mathrm { R e L U } \left( \mathrm { B a t c h N o r m } \left( m _ { 1 0 } , \left[ 0 , 1 \right] \right) \right) } \end{array}
648
+ $$
649
+
650
+ The result is then output.
651
+
652
+ $$
653
+ \mathrm { C o m p u t e H } \left( \cdot ; \theta _ { c o m p u t e H } \right) = m _ { 1 1 }
654
+ $$
655
+
656
+ We set $\lambda _ { c o m p u t e h s i z e } = 6 4$ which is the inner computation size.
657
+
658
+ # H EXPERIMENTAL DETAILS
659
+
660
+ # H.1 META TRAINING
661
+
662
+ # H.1.1 TRAINING DATA DISTRIBUTION
663
+
664
+ We trained on a data distribution consisting of tasks sampled uniformly over the following datasets. Half of our training tasks where constructed off of a dataset consisting of 1000 font rendered characters. We resized these to 14x14 black and white images. We call this the glyph dataset. "Alphabet" is an example of such a dataset consisting of alphabet characters. We used a mixture 10, 13, 14, 17, 20, and 30 way classification problems randomly sampled, as well as sampling from three 10-way classification problems sampled from specific types of images: letters of the alphabet, math symbols, and currency symbols. For half of the random sampling and all of the specialized selection we apply additional augmentation. This augmentation consists of random rotations (up to 360 degrees) and shifts up to $+ { - } 5$ pixels in the x and y directions. The parameters of the augmentation were inserted into the regression target of the MetaObjective as a curriculum of sorts and to provide diverse training signal.
665
+
666
+ In addition to the the glyph set, we additionally used Cifar10, resized to 16x16, as well as 10, 15, 20, and 25 way classification problems from imagenet. Once again we resized to 16x16 for compute reasons.
667
+
668
+ With a dataset selected, we apply additional augmentation with some probability consisting of the following augmentations. A per task dropout mask (fixed mask across all images in that task). A per example dropout mask (a random mask per image). A permutation sampled from a fixed number of pre created permutations per class. A per image random shift in the x direction each of image. All of these additional augmentations help with larger domain transfer.
669
+
670
+ # H.2 META-OPTIMIZATION
671
+
672
+ We employ Adam (Kingma and Ba, 2014) as our meta-optimizer. We use a learning rate schedule of 3e-4 for the first $1 0 0 \mathrm { k }$ steps, then 1e-4 for next 50k steps, then 2e-5 for remainder of meta-training. We use gradient clipping of norm 5 on minibatchs of size 256.
673
+
674
+ We compute our meta-objective by averaging 5 evaluation of the linear regression. We use a ridge penalty of 0.1 for all this work.
675
+
676
+ When computing truncated gradients, we initially sample the number of unrolled applications of the UnsupervisedUpdate in a uniform distribution of [2,4]. This is the number of steps gradients are backpropogated through. Over the course of 50k meta-training steps we uniformly increase this to [8,15]. This increases meta-training speed and stability as large unrolls early in training can be unstable and don’t seem to provide any value.
677
+
678
+ For sampling the number of truncated steps (number of times the above unrolls are performed), we use a shifted normal distribution – a normal distribution with the same mean and standard deviation. We chose this based on the expected distribution of the training step, $\phi$ iteration number, across the cluster of workers. We initially set the standard deviation low, 20, but slowly increased it over the course of 5000 steps to $2 0 \mathrm { k }$ steps. This slow increase also improved stability and training speed.
679
+
680
+ # H.3 EXPERIMENTAL SETUP
681
+
682
+ For each experimental figure, we document the details.
683
+
684
+ # H.3.1 OBJECTIVE FUNCTION MISMATCH
685
+
686
+ The VAE we used consists of 3 layers, size 128, with ReLU activations and batch norm between each layer. We then learn a projection to mean and log std of size 32. We sample, and use the inverse architecture to decode back to images. We use a quantized normal distribution (once again parameterized as mean and log std) as a posterior. We train with Adam with a learning rate of 1e-4. To isolate the effects of objective function mismatch and overfitting, we both train on the unlabeled training set and evaluate on the labeled training set instead of a validation set.
687
+
688
+ # H.3.2 GENERALIZATION: DATASET AND DOMAIN
689
+
690
+ We use a 4 layer, size 128 unit architecture with a 32 layer embedding for all models. We select performance at $1 0 0 \mathrm { k }$ training steps for the VAE, and 3k for our learned optimizer.
691
+
692
+ Our supervised learning baseline consists of the same architecture for the base model but with an additional layer that outputs log probabilities. We train with cross entropy loss on a dataset consisting of only 10 examples per class (to match the other numbers). Surprisingly, the noise from batch norm acts as a regularizer, and allowing us to avoid needing a complex early stopping scheme as test set performance simply plateaus over the course of 10k steps. We train with Adam with a learning rate of 3e-3, selected via a grid over learning rate on test set performance. In this setting, having a true validation set would dramatically lower the amount of labeled data available (only 100 labeled examples) and using the test set only aids in the this baseline’s performance.
693
+
694
+ For the IMDB experiments, we tokenized and selected the top 1K words with an additional set of tokens for unknown, sentence start, and sentence end. Our encoding consisted of a 1 if the word is present, otherwise 0. We used the same 4 layer, 128 hidden unit MLP with an addition layer outputting a 32 dimensional embedding.
695
+
696
+ # H.3.3 GENERALIZATION: NETWORK ARCHITECTURE
697
+
698
+ We used ReLU activations and 4 layers of size 128 with an additional layer to 32 units unless otherwise specified by the specific experiment.
699
+
700
+ # H.3.4 EXISTING META LEARNING MODELS
701
+
702
+ We trained prototypical networks (Snell et al., 2017) on either intact or shuffled mini-Imagenet images. For shuffled images, we generated a fixed random permutation for the inputs independently for every instantiation of the base network (or ’episode’ in the meta-learning literature (Vinyals et al., 2016; Ravi and Larochelle, 2016)). The purpose of shuffling was to demonstrate the inductive bias of this type of meta-learning, namely that they do not generalize across data domain. Note that the base network trained was the same fully connected architecture like that used in this paper (3 layers, size 128, with ReLU activations and batch normalization between layers). Though the original paper used a convolutional architecture, here we swapped it with the fully connected architecture because the tied weights in a convolutional model do not make sense with shuffled pixels.
md/train/HkXWCMbRW/HkXWCMbRW.md ADDED
@@ -0,0 +1,363 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TOWARDS IMAGE UNDERSTANDING FROM DEEP COMPRESSION WITHOUT DECODING
2
+
3
+ Robert Torfason ETH Zurich, Merantix robertto@ethz.ch
4
+
5
+ Fabian Mentzer ETH Zurich mentzerf@vision.ee.ethz.ch
6
+
7
+ Eirikur Agustsson ETH Zurich aeirikur@vision.ee.ethz.ch
8
+
9
+ Michael Tschannen ETH Zurich michaelt@nari.ee.ethz.ch
10
+
11
+ Radu Timofte ETH Zurich, Merantix radu.timofte@vision.ee.ethz.ch
12
+
13
+ Luc Van Gool ETH Zurich, KU Leuven vangool@vision.ee.ethz.ch
14
+
15
+ # ABSTRACT
16
+
17
+ Motivated by recent work on deep neural network (DNN)-based image compression methods showing potential improvements in image quality, savings in storage, and bandwidth reduction, we propose to perform image understanding tasks such as classification and segmentation directly on the compressed representations produced by these compression methods. Since the encoders and decoders in DNN-based compression methods are neural networks with feature-maps as internal representations of the images, we directly integrate these with architectures for image understanding. This bypasses decoding of the compressed representation into RGB space and reduces computational cost. Our study shows that accuracies comparable to networks that operate on compressed RGB images can be achieved while reducing the computational complexity up to $2 \times$ . Furthermore, we show that synergies are obtained by jointly training compression networks with classification networks on the compressed representations, improving image quality, classification accuracy, and segmentation performance. We find that inference from compressed representations is particularly advantageous compared to inference from compressed RGB images for aggressive compression rates.
18
+
19
+ # 1 INTRODUCTION
20
+
21
+ Neural network-based image compression methods have recently emerged as an active area of research. These methods leverage common neural network architectures such as convolutional autoencoders (Balle et al., 2016; Theis et al., 2017; Rippel & Bourdev, 2017; Agustsson et al., 2017; ´ Li et al., 2017) or recurrent neural networks (Toderici et al., 2015; 2016; Johnston et al., 2017) to compress and reconstruct RGB images, and were shown to outperform JPEG2000 (Taubman & Marcellin, 2001) and even BPG (Bellard) on perceptual metrics such as structural similarity
22
+
23
+ ![](images/a46ded1bba554031b9e35011c7c2a8243894d381244e6fbe2cddba63bc2d7784.jpg)
24
+ 0.3 bits per pixel
25
+
26
+ Figure 1: We do inference on the learned compressed representation (middle), without decoding.
27
+
28
+ index (SSIM) (Wang et al. (2004)) and multi-scale structural similarity index (MS-SSIM) (Wang et al. (2003)). In essence, these approaches encode an image $x$ to some feature-map (compressed representation), which is subsequently quantized to a set of symbols $z$ . These symbols are then (losslessly) compressed to a bitstream, from which a decoder reconstructs an image $\hat { x }$ of the same dimensions as $x$ (see Fig. 1 and Fig. 2 (a)).
29
+
30
+ Besides their outstanding compression performance, learned compression algorithms can—in contrast to engineered compression algorithms—easily be adapted to specific target domains such as stereo images, medical images, or aerial images, leading to even better compression rates on the target domain. In this paper, we explore another promising advantage of learned compression algorithms compared to engineered ones, namely the amenability of the compressed representation they produce to learning and inference without reconstruction (see Fig. 2). Specifically, instead of reconstructing an RGB image from the (quantized) compressed representation and feeding it to a network for inference (e.g., classification or segmentation), one uses a modified network that bypasses reconstruction of the RGB image.
31
+
32
+ The rationale behind this approach is that the neural network architectures commonly used for learned compression (in particular the encoders) are similar to the ones commonly used for inference, and learned image encoders are hence, in principle, capable of extracting features relevant for inference tasks. The encoder might learn features relevant for inference purely by training on the compression task, and can be forced to learn these features by training on the compression and inference tasks jointly.
33
+
34
+ ![](images/f865b99c8c8cee1a2b786d8fbb4cbc9781e46a7b3b487c565e8e366fba6dc086.jpg)
35
+ Figure 2: We perform inference of some variable $\hat { y }$ from the compressed representation $z$ instead of the decoded RGB $\hat { x }$ . The grey blocks denote encoders/decoders of a learned compression network and the white block an inference network.
36
+
37
+ The advantage of learning an encoder for image compression which produces compressed representation containing features relevant for inference is obvious in scenarios where images are transmitted (e.g. from a mobile device) before processing (e.g. in the cloud), as it saves reconstruction of the RGB image as well as part of the feature extraction and hence speeds up processing. A typical use case is a cloud photo storage application where every image is processed immediately upon upload for indexing and search purposes.
38
+
39
+ Our contributions can be summarized as follows:
40
+
41
+ • We consider two diverse computer vision tasks from compressed image representations, namely image classification and semantic segmentation. Specifically, we use the image compression autoencoder described in (Theis et al., 2017), and adapt ResNet (He et al., 2015) as well as DeepLab (Chen et al., 2016) for inference from the compressed representations.
42
+ • We show that image classification from compressed representations is essentially as accurate as from the decompressed images (after re-training on decompressed images), while requiring $1 . 5 \times -$ $2 \times$ fewer operations than reconstructing the image and applying the original classifier.
43
+ • Further results indicate that semantic segmentation from compressed representations is as accurate as from decompressed images at moderate compression rate, while being more accurate at aggressive compression rates. This suggests that learned compression algorithms might learn semantic features at these aggressive rates or improve localization. Segmentation from compressed representation requires significantly fewer operations than segmentation from decompressed images.
44
+ • When jointly training for image compression and classification, we observe an increase in SSIM and MS-SSIM and, at the same time, an improved segmentation and classification accuracy.
45
+ • Our method only requires minor changes in the original image compression and classfication/segmentation networks, and slight changes in the corresponding training procedures.
46
+
47
+ The remainder of the paper is organized as follows. We give an overview over related work in Section 2. In Section 3, we introduce the deep compression architecture we use and in Section 4 we propose a variant of ResNet (He et al., 2015) amenable to compressed representations. We present and evaluate our methods for image classification and semantic segmentation from compressed representations in Sections 4 and 5, respectively, along with baselines on compressed RGB images. In Section 6, we then address joint training of image compression and classification from compressed representations. Finally, we discuss our findings in Section 7.
48
+
49
+ # 2 RELATED WORK
50
+
51
+ In the literature there are a few examples of learning from features extracted from images compressed by engineered codecs. Classification of compressed hyperspectral images was studied in (Hahn et al., 2014; Aghagolzadeh & Radha, 2015). Recently, Fu & Guimaraes (2016) proposed an algorithm based on Discrete Cosine Transform (DCT) to compress the images before feeding them to a neural net for reportedly a 2 to $1 0 \times$ speed up of the training with minor image classification accuracy loss. Javed et al. (2017) provide a critical review on document image analysis techniques directly in the compressed domain. To our knowledge, inference from compressed representations produced by learned image compression algorithms has not been considered before.
52
+
53
+ In the context of video analysis, different approaches for inference directly from compressed video (obtained using engineered codecs) were proposed, see (Babu et al., 2016) for an overview. The temporal structure of compressed video streams naturally lends itself to feature extraction for many inference tasks. Examples include video classification (Biswas & Babu, 2013; Chadha et al., 2017) and action recognition (Yeo et al., 2008; Kantorov & Laptev, 2014).
54
+
55
+ We propose a method that does inference on top of a learned feature representation and hence has a direct relation to unsupervised feature learning using autoencoders. Hinton & Salakhutdinov (2006) proposed a dimensionality reduction scheme using autoencoders to learn robust image features that can be used for classification and regression. A more robust dimensionality reduction was proposed by Vincent et al. (2008) and Rifai et al. (2011) by using denoising autoencoders and by penalizing the Jacobian of the learned representation, respectively, for more robust/stable features. Masci et al. (2011) proposed convolutional autoencoders to learn hierarchical features.
56
+
57
+ Finally, compression artifacts from both learned and engineered compression algorithms will compromise the performance of inference algorithms. The effect of JPEG compression artifacts on image classification using neural networks was studied in (Dodge & Karam, 2016).
58
+
59
+ # 3 LEARNED DEEPLY COMPRESSED REPRESENTATION
60
+
61
+ # 3.1 DEEP COMPRESSION ARCHITECTURE
62
+
63
+ For image compression, we use the convolutional autoencoder proposed in (Theis et al., 2017) and a variant of the training procedure described in (Agustsson et al., 2017), using scalar quantization. We refer to Appendix A.1 for more details. We note here that the encoder of the convolutional autoencoder produces a compressed representation (feature map) of dimensions $w / 8 \times h / 8 \times C$ , where $w$ and $h$ are the spatial dimensions of the input image, and the number of channels $C$ is a hyperparameter related to the rate $R$ . For input RGB images with spatial dimensions $2 2 4 \times 2 2 4$ the computational complexity of the encoder and the decoder is $3 . 5 6 \cdot 1 0 ^ { 9 }$ and $2 . 8 5 \cdot 1 0 ^ { 9 }$ FLOPs, respectively.
64
+
65
+ Quantizing the compressed representation imposes a distortion $D$ on $\hat { x }$ w.r.t. $x$ , i.e., it increases the reconstruction error. This is traded for a decrease in entropy of the quantized compressed representation $z$ which leads to a decrease of the length of the bitstream as measured by the rate $R$ . Thus, to train the image compression network, we minimize the classical rate-distortion trade-off $D + \beta R$ . As a metric for $D$ , we use the mean squared error (MSE) between $x$ and $\hat { x }$ and we estimate $R$ using $H ( q )$ . $H ( q )$ is the entropy of the probability distribution over the symbols and is estimated using a histogram of the probability distribution (see (Agustsson et al., 2017) for details). We control the trade-off between MSE and the entropy by adjusting $\beta$ . For each $\beta$ we get an operating point where the images have a certain bit rate, as measured by bits per pixel (bpp), and corresponding MSE. To better control the bpp, we introduce the target entropy $H _ { t }$ to formulate our loss:
66
+
67
+ $$
68
+ \mathcal { L } _ { c } = \mathbf { M S E } ( \boldsymbol { x } , \hat { \boldsymbol { x } } ) + \beta \operatorname* { m a x } \left( H ( \boldsymbol { q } ) - H _ { t } , 0 \right)
69
+ $$
70
+
71
+ We train compression networks for three different bpp operating points by adjusting the compression network hyperparameters. We obtain three operating points at 0.0983 bpp, 0.330 bpp and 0.635 $\mathsf { b p p } ^ { 1 }$ . On the ILSVRC2012 data, these operating points outperform JPEG and the newer JPEG2000 on the perceptual metrics SSIM and MS-SSIM. Appendix A.2 shows plots comparing the operating points to JPEG and JPEG2000 for different similarity metrics and discusses the metrics themselves.
72
+
73
+ A visualization of the learned compression can be seen in Fig. 1, where we show an RGB-image along with the visualization of the corresponding compressed representation (showing a subset of the channels). For more visualizations of the compressed representations see Appendix A.2.
74
+
75
+ # 4 IMAGE CLASSIFICATION FROM COMPRESSED REPRESENTATIONS
76
+
77
+ # 4.1 RESNET FOR RGB IMAGES
78
+
79
+ For image classification from RGB images we use the ResNet-50 (V1) architecture (He et al., 2015). It is composed of so-called bottleneck residual units where each unit has the same computational cost regardless of the spatial dimension of the input tensor (with the exception of blocks that subsample spatially, and the root-block). The network is fully convolutional and its structure can be seen in Table 1 for inputs with spatial dimension $2 2 4 \times 2 2 4$ .
80
+
81
+ Following the architectural recipe of He et al. (2015), we adjust the number of 14x14 (conv4 x) blocks to obtain ResNet-71, an intermediate architecture between ResNet-50 and ResNet-101 (see Table 1).
82
+
83
+ # 4.2 RESNET FOR COMPRESSED REPRESENTATIONS
84
+
85
+ For input images with spatial dimension $2 2 4 \times 2 2 4$ , the encoder of the compression network outputs a compressed representation with dimensions $2 8 \times 2 8 \times C$ , where $C$ is the number of channels. We propose a simple variant of the ResNet architecture to use this compressed representation as input. We refer to this variant as cResNet- $k$ , where c stands for “compressed representation” and $k$ is the number of convolutional layers in the network. These networks are constructed by simply “cutting off” the front of the regular (RGB) ResNet. We simply remove the root-block and the residual layers that have a larger spatial dimension than $2 8 \times 2 8$ . To adjust the number of layers $k$ , we again follow the architectural recipe of He et al. (2015) and only adjust the number of $1 4 \times 1 4$ $\bf { \tau } ( o n v 4 . x )$ residual blocks.
86
+
87
+ Employing this method, we get 3 different architectures: (i) cResNet-39 is ResNet-50 with the first 11 layers removed as described above, significantly reducing computational cost; (ii) cResNet-51 and (iii) cResNet-72 are then obtained by adding $1 4 \times 1 4$ residual blocks to match the computational cost of ResNet-50 and ResNet-71, respectively (see last column of Table 1).
88
+
89
+ A description of these architectures and their computational complexity is given in Table 1 for inputs with spatial dimension $2 8 \times 2 8$ .
90
+
91
+ Table 1: Structure of the ResNet and the cResNet architectures in terms of of residual block types, their number, and their associated spatial dimension. Numbers are reported for ResNet-networks with RGB images of spatial dimensions $2 2 4 \times 2 2 4$ as input, and for cResNet-networks with compressed representations of spatial dimensions $2 8 \times 2 8$ as inputs. For a detailed description of the blocks see Appendix A.3
92
+
93
+ <table><tr><td>Network</td><td></td><td></td><td>root conv2_x conv3_x conv4_x conv5_x FLOPs 56 × 56 28× 2814×147×7[×109]</td><td></td><td></td><td></td></tr><tr><td>ResNet-50</td><td>yes</td><td>3</td><td>4</td><td>6</td><td>3</td><td>3.86</td></tr><tr><td>ResNet-71</td><td>yes</td><td>3</td><td>4</td><td>13</td><td>3</td><td>5.38</td></tr><tr><td>cResNet-39</td><td>no</td><td>none</td><td>4</td><td>6</td><td>3</td><td>2.95</td></tr><tr><td>cResNet-51</td><td>no</td><td>none</td><td>4</td><td>10</td><td>3</td><td>3.83</td></tr><tr><td>cResNet-72</td><td>no</td><td>none</td><td>4</td><td>17</td><td>3</td><td>5.36</td></tr></table>
94
+
95
+ 1We obtain the bpp of an operating point by averaging the bpp of all images in the validation set.
96
+
97
+ # 4.3 BENCHMARK
98
+
99
+ We use the ImageNet dataset from the Large Scale Visual Recognition Challenge 2012 (ILSVRC2012) (Russakovsky et al., 2014) to train our image classification networks and our compression network. It consists of 1.28 million training images and $5 0 \mathrm { k }$ validation images. These images are distributed across 1000 diverse classes. For image classification we report top-1 classification accuracy and top-5 classification accuracy on the validation set on $2 2 4 \times 2 2 4$ center crops for RGB images and $2 8 \times 2 8$ center crops for the compressed representation.
100
+
101
+ # 4.4 TRAINING PROCEDURE
102
+
103
+ Given a trained compression network, we keep the compression network fixed while training the classification network, both when starting from compressed representations and from reconstructed compressed RGB images. For the compressed representations, we feed the output of the fixed encoder (the compressed representation) as input to the cResNets (decoder is not needed). When training on the reconstructed compressed RGB images, we feed the output of the fixed encoderdecoder (RGB image) to the ResNet. This is done for each operating point reported in Section 3.1.
104
+
105
+ For training we use the standard hyperparameters and a slightly modified pre-processing procedure from He et al. (2015), described in detail in in Appendix A.4. To speed up training we decay the learning rate at a $3 . 7 5 \times$ faster speed than in He et al. (2015).
106
+
107
+ # 4.5 CLASSIFICATION RESULTS
108
+
109
+ ![](images/2cfe3168b00a0ff67e1045a6568a68e71c067476d334d8d99aaa5dea260e76f2.jpg)
110
+ Figure 3: Top-5 accuracy on the validation set for different architectures and input types at each operating point. Results are shown for ResNet-50 (where reconstructed/decoded RGB images are used as input) and for cResNet-51 and cResNet-39 (where compressed representations are used as input).
111
+
112
+ In Table 2 and in Fig. 3 the results for the classification accuracy of the different architectures at each operating point is listed, both classifying from the compressed representation and the corresponding reconstructed compressed RGB images.
113
+
114
+ Fig. 3 shows validation curves for ResNet-50, cResNet-51, and cResNet-39. For the 2 classification architectures with the same computational complexity (ResNet-50 and cResNet-51), the validation curves at the 0.635 bpp compression operating point almost coincide, with ResNet-50 performing slightly better. As the rate (bpp) gets smaller this performance gap gets smaller. Table 2 shows the classification results when the different architectures have converged. At the 0.635 bpp operating point, ResNet-50 only performs $0 . 5 \%$ better in top-5 accuracy than cResNet-51, while for the 0.0983 bpp operating point this difference is only $0 . 3 \%$ .
115
+
116
+ Using the same pre-processing and the same learning rate schedule but starting from the original uncompressed RGB images yields $8 9 . 9 6 \%$ top-5 accuracy. The top-5 accuracy obtained from the compressed representation at the 0.635 bpp compression operating point, $8 7 . 8 \bar { 5 } \%$ , is even competitive with that obtained for the original images at a significantly lower storage cost. Specifically, at 0.635 bpp the ImageNet dataset requires 24.8 GB of storage space instead of $1 4 4 \mathrm { G B }$ for the original version, a reduction by a factor $5 . 8 \times$ .
117
+
118
+ Table 2: Image classification accuracies after 28 epochs for the $3 . 7 5 \times$ training rate schedule employed and image segmentation performance for the Deeplab training rate schedule. For each operating point the inputs to ResNet-networks are reconstructed/decoded RGB images and inputs to cResNet-networks are compressed representations. For comparison we show the results with the same training settings, but starting from the original RGB images, in the top row.
119
+
120
+ <table><tr><td colspan="4">bpp Network architecture Top 5 acc.[%] Top1acc.[%] mIoU[%]</td></tr><tr><td></td><td>Resnet-50</td><td>89.96 71.06</td><td>65.75</td></tr><tr><td rowspan="3">509.3</td><td>ResNet-50</td><td>88.34 68.26</td><td>62.97</td></tr><tr><td>cResNet-51</td><td>87.85 67.68</td><td>62.86</td></tr><tr><td>cResNet-39 87.47</td><td>67.17</td><td>61.85</td></tr><tr><td rowspan="3">0050</td><td>ResNet-50</td><td>86.25 65.18</td><td>60.75</td></tr><tr><td>cResNet-51</td><td>85.87 64.78</td><td>61.12</td></tr><tr><td>cResNet-39</td><td>85.46 64.14</td><td>60.78</td></tr><tr><td rowspan="6">£8600</td><td>ResNet-50</td><td>78.52 55.30</td><td>52.97</td></tr><tr><td>cResNet-51</td><td>78.20 55.18</td><td>54.62</td></tr><tr><td>cResNet-39</td><td>77.65 54.31</td><td>53.51</td></tr><tr><td>ResNet-71</td><td>79.28 56.23</td><td>54.55</td></tr><tr><td>cResNet-72</td><td>79.02 55.82</td><td>55.78</td></tr><tr><td></td><td></td><td></td></tr></table>
121
+
122
+ To show the computational gains, we plot the top-5 classification accuracy as a function of computational complexity for the 0.0983 bpp compression operating point in Fig. 6. This is done by classification using different architectures that each has an associated computational complexity. The top-5 accuracy of each of these architectures is then plotted as a function of their computational complexity. For the compressed representation we do this for the architectures cResNet-39, cResNet-51 and cResNet-72. For the reconstructed compressed RGB images we used the ResNet-50 and the ResNet-71 architectures.
123
+
124
+ Looking at a fixed computational cost, the reconstructed compressed RGB images perform about $0 . 2 5 \%$ better. Looking at a fixed classification cost, inference from the compressed representation costs about $0 . 6 \cdot 1 0 ^ { 9 }$ FLOPs more. However when accounting for the decoding cost at a fixed classification performance, inference from the reconstructed compressed RGB images costs $2 . 2 \cdot 1 0 ^ { 9 }$ FLOPs more than inference from the compressed representation.
125
+
126
+ # 5 SEMANTIC SEGMENTATION FROM COMPRESSED REPRESENTATIONS
127
+
128
+ # 5.1 DEEP METHOD
129
+
130
+ For semantic segmentation we use the ResNet-based Deeplab architecture (Chen et al., 2016) and our implementation is adapted using the codes from DeepLab-ResNet-TensorFlow2. The cResNet and ResNet image classification architectures from Sections 4.1 and 4.2, are re-purposed with atrous convolutions, where the filters are upsampled instead of downsampling the feature maps. This is done to increase their receptive field and to prevent aggressive subsampling of the feature maps, as described in (Chen et al., 2016). For segmentation the ResNet architecture is restructured such that the output feature map has $8 \times$ smaller spatial dimension than the original RGB image (instead subsampling by a factor $3 2 \times$ like for classification). When using the cResNets the output feature map has the same spatial dimensions as the input compressed representation (instead of subsampling $4 \times$ like for classification). This results in comparable sized feature maps for both the compressed representation and the reconstructed RGB images. Finally the last 1000-way classification layer of these classification architectures is replaced by an atrous spatial pyramid pooling (ASPP) with four parallel branches with rates $\{ 6 , 1 2 , 1 \bar { 8 } , 2 4 \}$ , which provides the final pixel-wise classification.
131
+
132
+ # 5.2 BENCHMARK
133
+
134
+ The PASCAL VOC-2012 dataset (Everingham et al. (2015)) for semantic segmentation was used for image segmentation tasks. It has 20 object foreground classes and 1 background class. The dataset consists of 1464 training and 1449 validation images. In every image, each pixel is annotated with one of the $2 0 + 1$ classes. The original dataset is furthermore augmented with extra annotations provided by Hariharan et al. (2011), so the final dataset has 10,582 images for training and 1449 images for validation. All performance is measured on pixelwise intersection-over-union (IoU) averaged over all the classes, or mean-intersection-over-union (mIoU) on the validation set.
135
+
136
+ # 5.3 TRAINING PROCEDURE
137
+
138
+ The cResNet/ResNet networks are pre-trained on the ImageNet dataset using the procedure described in Section 4.4 on the image classification task, the encoder and decoder are fixed as in Section 4.4. The architectures are then adapted with dilated convolutions, cResNet-d/ResNet-d, and finetuned on the semantic segmentation task.
139
+
140
+ For the training of the segmentation architecture we use the same settings as in Chen et al. (2016) with a slightly modified pre-processing procedure as described in Appendix A.5.
141
+
142
+ # 5.4 SEGMENTATION RESULTS
143
+
144
+ ![](images/9f0702481e57bc235bd172c7669ced5c132247161a090e6a17bd9e2229ca7196.jpg)
145
+ Figure 4: mIoU performance on the validation set for different architectures and input types at each operating point. Results shown for ResNet-50-d (where reconstructed/decoded RGB images are used as input), and for cResNet-51-d and cResNet-39-d (where compressed representations are used as input).
146
+
147
+ Table 2 and Fig. 4 list the results of the different architectures for semantic segmentation at each operating point, both for segmentation from the compressed representation and the corresponding reconstructed compressed RGB images. Unlike classification, for semantic segmentation ResNet50-d and cResNet-51-d perform equally well at the 0.635 bpp compression operating point. For the 0.330 bpp operating point, segmentation from the compressed representation performs slightly better, $0 . 3 \hat { 7 } \%$ , and at the 0.0983 bpp operating point segmentation from the compressed representation performs considerably better than for the reconstructed compressed RGB images, by $1 . { \bar { 6 } } 5 \%$ .
148
+
149
+ Fig. 5 shows the predicted segmentation visually for both the cResNet-51-d and the ResNet-50-d architecture at each operating point. Along with the segmentation it also shows the original uncompressed RGB image and the reconstructed compressed RGB image. These images highlight the challenging nature of these segmentation tasks, but they can nevertheless be performed using the compressed representation. They also clearly indicate that the compression affects the segmentation, as lowering the rate (bpp) progressively removes details in the image. Comparing the segmentation from the reconstructed RGB images to the segmentation from the compressed representation visually, they perform similar. More visual examples are shown in Appendix A.6.
150
+
151
+ In Fig. 6 we report the mIoU validation performance as a function of computational complexity for the 0.0983 bpp compression operating point. This is done in the same way as in Section 4, using different architectures with different computational complexity, but for segmentation. Here, even without accounting for the decoding cost of the reconstructed images, the compressed representation performs better. At a fixed computational cost, segmentation from the compressed representation gives about $0 . 7 \%$ better mIoU. And at a fixed mIoU the computational cost is about $3 . 3 \cdot 1 0 ^ { 9 }$ FLOPs lower for compressed representations. Accounting for the decoding costs this difference becomes $6 . 1 \cdot 1 0 ^ { 9 }$ FLOPs. due to the nature of the dilated convolutions and the increased feature map size the relative computational gains for segmentation are not as pronounced as for classification.
152
+
153
+ ![](images/e44de8ef63de2b87e55484cf04da4b14cd64fc6226bd5a4b8c283fc7eba37528.jpg)
154
+ Figure 5: Top: Reconstructed/decoded RGB images at different compression operating points. Middle: Predicted segmentation mask starting from reconstructed/decoded RGB images using ResNet50-d architecture. Bottom: Predicted segmentation mask starting from compressed representation using cResNet-51-d architecture. Left: Original RGB image and the ground truth segmentation mask.
155
+
156
+ # 6 JOINT TRAINING FOR COMPRESSION AND IMAGE CLASSIFICATION
157
+
158
+ # 6.1 FORMULATION
159
+
160
+ To train for compression and classification jointly, we combine the compression network and the cResNet-51 architecture. An overview of the setup can be seen in Fig. 2 b) where all parts, encoder, decoder, and inference network, are trained at the same time. The compressed representation is fed to the decoder to optimize for mean-squared reconstruction error and to a cResNet-51 network to optimize for classification using a cross-entropy loss. The combined loss function takes the form
161
+
162
+ $$
163
+ \mathcal { L } _ { c } = \gamma \left( \mathbf { M S E } ( x , \hat { x } ) + \beta \operatorname* { m a x } { \left( H ( q ) - H _ { t } , 0 \right) } \right) + \ell _ { c e } ( y , \hat { y } ) ,
164
+ $$
165
+
166
+ where the loss terms for the compression network, $\mathbf { M S E } ( x , \hat { x } ) + \beta \operatorname* { m a x } \left( H ( q ) - H _ { t } , 0 \right)$ , are the same as in training for compression only (see Eq. 1). $\ell _ { c e }$ is the cross-entropy loss for classification. $\gamma$ controls the trade-off between the compression loss and the classification loss.
167
+
168
+ When training the cResNet-51 networks for image classification as described in Section 4.4 the compression network is fixed (after having been previously trained as described in Section 3.1). When doing joint training, we first initialize the compression network and the classification network from a trained state obtained as described in Section 3 and 4. After initialization the networks are both finetuned jointly. We initialize from a trained state and our learning rate schedule is short and does not perturb the weights too much from their initial state so we call this finetuning. For a detailed description of hyperparameters used and the training schedule see Appendix A.8.
169
+
170
+ To control that the change in classification accuracy is not only due to (1) a better compression operating point or (2) the fact that the cResNet is trained longer, we do the following. We obtain a new operating point by finetuning the compression network only using the schedule described above. We then train a cResNet-51 on top of this new operating point from scratch. Finally, keeping the compression network fixed at the new operating point, we train the cResNet-51 for 9 epochs according to the training schedule above. This procedure controls (1) and (2), and we use it to compare to the joint finetuning.
171
+
172
+ ![](images/0b6d7e4230a132d4e546da6ed279ec3b78f5fed058d84a9dacd39fe1c8329f06.jpg)
173
+ Figure 6: Inference performance at the 0.0983 bpp operating point at different computational complexities, for both compressed representations and RGB images. We report the computational cost of the inference networks only and for reconstructed RGB images we also show the inference cost along with the decoding cost. For runtime benchmarks see Appendix A.9
174
+
175
+ ![](images/a9f9653f60d8aaba38d537e5dbeeee5571c30a23309af55d4fd2db0e36d3e0d2.jpg)
176
+ Figure 7: Showing how classification and segmentation performance improves by finetuning (ft.) the compression network only and the compression network and the classification network jointly. The dots show how the performance “moves up” from the baseline performance when finetuning. The baseline is obtained using fixed compression operating points.
177
+
178
+ To obtain segmentation results we take the jointly trained network, fix the compression operating point and adopt the jointly finetuned classification network for segmentation (cResNet-51-d). It is then trained the same way as in Section 5.3. The difference to Section 5.3 is therefore only the pre-trained network.
179
+
180
+ # 6.2 JOINT TRAINING RESULTS
181
+
182
+ First, we observe that training the compression and segmentation networks jointly as described in Section 6.1 does not affect the compression performance significantly. In more detail, joint training increases the compression performance on the perceptual metrics MS-SSIM and SSIM by a small amount and decreases the PSNR slightly (high is good for all these metrics), see Appendix A.7.
183
+
184
+ In Fig. 7 we show how the classification and segmentation metrics change when finetuning the networks (using cResNet-51). It can be seen that the classification and segmentation results “move up” from the baseline through finetuning. By finetuning the compression network only, we get a slight improvement in performance for the classification task but almost no improvements for the segmentation task. However, when training jointly the improvement for classification are larger and we get a significant improvement for segmentation. It is interesting to note that for the 0.635 bpp operating point the classification performance is similar for training the network jointly and training the compression network only, but when using these operating points for segmentation the difference is considerable.
185
+
186
+ Considering the 0.0983 bpp operating point and looking at the improvements in terms of computational complexity shown in Fig. 6, we see that training the networks jointly, compared to the training only the compression network, we improve classification by $2 \%$ , a performance gain which would require an additional $7 5 \%$ of computational complexity of cResNet-51. In a similar way, the segmentation performance after training the networks jointly is $1 . 7 \%$ better in mIoU than training only the compression network. Translating this to computational complexity using Fig. 6, to get this performance by adding layers to the netowork would require an additional $4 0 \%$ of computational complexity of cResNet-51.
187
+
188
+ # 7 DISCUSSION
189
+
190
+ We proposed and explored inference when starting directly from learned compressed representations without the need to decode, for two fundamental computer vision tasks: classification and semantic segmentation of images.
191
+
192
+ In our experiments we departed from a very recent state-of-the-art deep compression architecture proposed by Theis et al. (2017) and showed that the obtained compressed representations can be easily fed to variants of standard state-of-the-art DNN architectures while achieving comparable performance to the unmodified DNN architectures working on the decoded/reconstructed RGB images (see Fig. 6). In particular, only minor changes in the training procedures and hyperparameters of the original compression and classification/segmentation networks were necessary to obtain our results.
193
+
194
+ The main strong points of the proposed method for image understanding from deep compression without decoding are the following:
195
+
196
+ Runtime Our approach saves decoding time and also DNN inference time as the DNN adapted models can be of smaller depth than those using the decoded RGB images for comparable performance.
197
+
198
+ Memory Removing the need for reconstructing the image is a feat with large potential for real-time memory constrained applications which use specialized hardware such as in the automotive industry. Complementary, we have the benefit of shallower DNN models and aggressive compression rates (low bpp) with good performance.
199
+
200
+ Robustness The approach was successfully validated for image classification and semantic segmentation with minimal changes in the specialized DNN models, which make us to believe that the approach can be extended to most of the related image understanding tasks, such as object detection or structure-from-motion.
201
+
202
+ Synergy The joint training of compression and inference DNN models led to synergistic improvements in both compression quality and classification/segmentation accuracy.
203
+
204
+ Performance According to our experiments and the top performance achieved, compressed representations are a promising alternative to the largely common use of decoded images as starting point in image understanding tasks.
205
+
206
+ At the same time the approach has a couple of shortcomings:
207
+
208
+ Complexity In comparison with the current standard compression methods (such as JPEG, JPEG2000) the deep encoder we used and the learning process have higher time and memory complexities. However, research on deep compression is in its infancy while techniques such as JPEG are matured. Recently, Rippel & Bourdev (2017) have shown that deep compression algorithms can achieve the same or higher (de)compression speeds as standard compression algorithms on GPUs. As more and more devices are being equipped with dedicated deep learning hardware, deep compression could become commonplace.
209
+
210
+ Performance The proposed approach is particularly suited for aggressive compression rates (low bpp) and wherever the memory constraints and storage are critical. Medium and low bpp compression rates are also the regime where deep compression algorithms considerably outperform standard ones.
211
+
212
+ Extending our method for learning from compressed representation to other computer vision tasks is an interesting direction for future work. Furthermore, gaining a better understanding of the features/compressed representations learned by image compression networks might lead to interesting applications in the context of unsupervised/semisupervised learning.
213
+
214
+ # ACKNOWLEDGMENTS
215
+
216
+ This work was partly supported by ETH Zurich General Fund (OK) and by NVIDIA through a hardware grant.
217
+
218
+ # REFERENCES
219
+
220
+ Mohammad Aghagolzadeh and Hayder Radha. On hyperspectral classification in the compressed domain. arXiv preprint arXiv:1508.00282, 2015.
221
+
222
+ Eirikur Agustsson, Fabian Mentzer, Michael Tschannen, Lukas Cavigelli, Radu Timofte, Luca Benini, and Luc Van Gool. Soft-to-hard vector quantization for end-to-end learned compression of images and neural networks. CoRR, abs/1704.00648, 2017.
223
+
224
+ R Venkatesh Babu, Manu Tom, and Paras Wadekar. A survey on compressed domain video analysis techniques. Multimedia Tools and Applications, 75(2):1043–1078, 2016.
225
+
226
+ Johannes Balle, Valero Laparra, and Eero P Simoncelli. End-to-end optimization of nonlinear trans- ´ form codes for perceptual quality. arXiv preprint arXiv:1607.05006, 2016.
227
+
228
+ Fabrice Bellard. BPG Image format. https://bellard.org/bpg/.
229
+
230
+ Sovan Biswas and R Venkatesh Babu. H. 264 compressed video classification using histogram of oriented motion vectors (homv). In Acoustics, Speech and Signal Processing (ICASSP), 2013 IEEE International Conference on, pp. 2040–2044. IEEE, 2013.
231
+
232
+ Aaron Chadha, Alhabib Abbas, and Yiannis Andreopoulos. Video classification with cnns: Using the codec as a spatio-temporal activity sensor. arXiv preprint arXiv:1710.05112, 2017.
233
+
234
+ Liang-Chieh Chen, George Papandreou, Iasonas Kokkinos, Kevin Murphy, and Alan L. Yuille. Deeplab: Semantic image segmentation with deep convolutional nets, atrous convolution, and fully connected crfs. CoRR, abs/1606.00915, 2016. URL http://arxiv.org/abs/1606. 00915.
235
+
236
+ Samuel Dodge and Lina Karam. Understanding how image quality affects deep neural networks. In Quality of Multimedia Experience (QoMEX), 2016 Eighth International Conference on, pp. 1–6. IEEE, 2016.
237
+
238
+ Mark Everingham, S. M. Eslami, Luc Gool, Christopher K. Williams, John Winn, and Andrew Zisserman. The pascal visual object classes challenge: A retrospective. Int. J. Comput. Vision, 111(1):98–136, January 2015. ISSN 0920-5691. doi: 10.1007/s11263-014-0733-5. URL http: //dx.doi.org/10.1007/s11263-014-0733-5.
239
+
240
+ Dan Fu and Gabriel Guimaraes. Using compression to speed up image classification in artificial neural networks. 2016.
241
+
242
+ Priya Goyal, Piotr Dollar, Ross B. Girshick, Pieter Noordhuis, Lukasz Wesolowski, Aapo Kyrola, ´ Andrew Tulloch, Yangqing Jia, and Kaiming He. Accurate, large minibatch SGD: training imagenet in 1 hour. CoRR, abs/1706.02677, 2017. URL http://arxiv.org/abs/1706. 02677.
243
+
244
+ Jurgen Hahn, Simon Rosenkranz, and Abdelhak M Zoubir. Adaptive compressed classification for hyperspectral imagery. In Acoustics, Speech and Signal Processing (ICASSP), 2014 IEEE International Conference on, pp. 1020–1024. IEEE, 2014.
245
+
246
+ B. Hariharan, P. Arbelez, L. Bourdev, S. Maji, and J. Malik. Semantic contours from inverse detectors. In 2011 International Conference on Computer Vision, pp. 991–998, Nov 2011. doi: 10.1109/ICCV.2011.6126343.
247
+
248
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. CoRR, abs/1512.03385, 2015. URL http://arxiv.org/abs/1512.03385.
249
+
250
+ Geoffrey Hinton and Ruslan Salakhutdinov. Reducing the dimensionality of data with neural networks. Science, 313(5786):504 – 507, 2006.
251
+
252
+ Mohammed Javed, P Nagabhushan, and Bidyut B Chaudhuri. A review on document image analysis techniques directly in the compressed domain. Artificial Intelligence Review, pp. 1–30, 2017.
253
+
254
+ Nick Johnston, Damien Vincent, David Minnen, Michele Covell, Saurabh Singh, Troy Chinen, Sung Jin Hwang, Joel Shor, and George Toderici. Improved lossy image compression with priming and spatially adaptive bit rates for recurrent networks. arXiv preprint arXiv:1703.10114, 2017.
255
+
256
+ Vadim Kantorov and Ivan Laptev. Efficient feature extraction, encoding and classification for action recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2593–2600, 2014.
257
+
258
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. CoRR, abs/1412.6980, 2014.
259
+
260
+ Mu Li, Wangmeng Zuo, Shuhang Gu, Debin Zhao, and David Zhang. Learning convolutional networks for content-weighted image compression. arXiv preprint arXiv:1703.10553, 2017.
261
+
262
+ Jonathan Masci, Ueli Meier, Dan Cires¸an, and Jurgen Schmidhuber. ¨ Stacked Convolutional AutoEncoders for Hierarchical Feature Extraction, pp. 52–59. Springer Berlin Heidelberg, Berlin, Heidelberg, 2011. ISBN 978-3-642-21735-7. doi: 10.1007/978-3-642-21735-7 7. URL https: //doi.org/10.1007/978-3-642-21735-7_7.
263
+
264
+ Salah Rifai, Pascal Vincent, Xavier Muller, Xavier Glorot, and Yoshua Bengio. Contractive autoencoders: Explicit invariance during feature extraction. In ICML, pp. 833–840. Omnipress, 2011.
265
+
266
+ Oren Rippel and Lubomir Bourdev. Real-time adaptive image compression. arXiv preprint arXiv:1705.05823, 2017.
267
+
268
+ Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael S. Bernstein, Alexander C. Berg, and Fei-Fei Li. Imagenet large scale visual recognition challenge. CoRR, abs/1409.0575, 2014.
269
+
270
+ David S. Taubman and Michael W. Marcellin. JPEG 2000: Image Compression Fundamentals, Standards and Practice. Kluwer Academic Publishers, Norwell, MA, USA, 2001. ISBN 079237519X.
271
+
272
+ Lucas Theis, Wenzhe Shi, Andrew Cunningham, and Ferenc Huszar. Lossy image compression with compressive autoencoders. In ICLR 2017, 2017.
273
+
274
+ George Toderici, Sean M O’Malley, Sung Jin Hwang, Damien Vincent, David Minnen, Shumeet Baluja, Michele Covell, and Rahul Sukthankar. Variable rate image compression with recurrent neural networks. arXiv preprint arXiv:1511.06085, 2015.
275
+
276
+ George Toderici, Damien Vincent, Nick Johnston, Sung Jin Hwang, David Minnen, Joel Shor, and Michele Covell. Full resolution image compression with recurrent neural networks. arXiv preprint arXiv:1608.05148, 2016.
277
+
278
+ Pascal Vincent, Hugo Larochelle, Yoshua Bengio, and Pierre-Antoine Manzagol. Extracting and composing robust features with denoising autoencoders. In Proceedings of the 25th International Conference on Machine Learning, ICML $^ { \ ' 0 8 }$ , pp. 1096–1103, New York, NY, USA, 2008. ACM. ISBN 978-1-60558-205-4. doi: 10.1145/1390156.1390294. URL http://doi.acm.org/ 10.1145/1390156.1390294.
279
+
280
+ Z. Wang, E. P. Simoncelli, and A. C. Bovik. Multiscale structural similarity for image quality assessment. In Asilomar Conference on Signals, Systems Computers, 2003, volume 2, pp. 1398– 1402 Vol.2, Nov 2003.
281
+
282
+ Zhou Wang, A. C. Bovik, H. R. Sheikh, and E. P. Simoncelli. Image quality assessment: from error visibility to structural similarity. IEEE Transactions on Image Processing, 13(4):600–612, April 2004.
283
+
284
+ Chuohao Yeo, Parvez Ahammad, Kannan Ramchandran, and S Shankar Sastry. High-speed action recognition and localization in compressed domain videos. IEEE Transactions on Circuits and Systems for Video Technology, 18(8):1006–1015, 2008.
285
+
286
+ # A APPENDIX
287
+
288
+ # A.1 COMPRESSION ARCHITECTURE AND TRAINING PROCEDURE
289
+
290
+ The compression network is an autoencoder that takes an input image $x$ and outputs $\hat { x }$ as the approximation to the input (see Fig. 2 (a)). The encoder has the following structure: It starts with 2 convolutional layers with spatial subsampling by a factor of 2, followed by 3 residual units, and a final convolutional layer with spatial subsampling by a factor of 2. This results in a $w / 8 \times h / 8 \times C$ - dimensional representation, where $w$ and $h$ are the spatial dimensions of $x$ , and the number of channels $C$ is a hyperparameter related to the rate $R$ . This representation is then quantized to a discrete set of symbols, forming a compressed representation, $z$ .
291
+
292
+ To get the reconstruction $\hat { x }$ , the compressed representation is fed into the decoder, which mirrors the encoder, but uses upsampling and deconvolutions instead of subsampling and convolutions.
293
+
294
+ To handle the non-differentiability of the quantization step during training, Agustsson et al. (2017) employ a differentiable (soft) approximation of quantization and anneal it to the actual (hard) quantization during training to prevent inversion of the soft quantization approximation. Here, we replace this procedure by a different quantization step, $\bar { Q }$ , which behaves like $\hat { Q }$ in the forward pass but like $\bar { Q }$ in the backward pass (using the notation of (Agustsson et al., 2017)). Note that this is similar to the approach of Theis et al. (2017), who use rounding to integer in forward pass, and the identity function in the backward pass. Like annealing, $\bar { Q }$ prevents inversion of the soft quantization approximation, but facilitates joint training of the autoencoder for image compression with an inference task (see Section 6). Additionally, we chose to use scalar instead of vector quantization (i.e., $p _ { h } = p _ { w } = 1$ in the notation of Agustsson et al. (2017)) to further simplify joint training of compression and inference tasks. This means that each entry of the feature-map is quantized individually.
295
+
296
+ We train compression networks for three different bpp operating points by choosing different values for $\beta$ , $H _ { t }$ and $C$ . In theory, changing $H _ { t }$ and $\beta$ is enough to change the resulting average bpp of the network, but we found it beneficial to also change $C$ . We obtain three operating points at $0 . 0 9 8 3 \mathrm { b p p }$ $C = 8$ ), 0.330 bpp $C = 1 6$ ) and 0.635 bpp $\bar { ( C = 3 2 ) } ^ { \bar { 1 } }$ 3. We use the Adam optimizer (Kingma & Ba, 2014) with learning rates of $1 e ^ { - 3 }$ , $1 e ^ { - 5 }$ , and $1 e ^ { - 3 }$ for the 0.0983, 0.330 and 0.635 bpp operating points, respectively. We train on the images from the ILSVRC2012 dataset (see Section 4.3), using a batch size of 30. We train each operating point for $6 0 0 \mathrm { k }$ iterations. Fig. 8 depicts the performance of our deep compression models vs. standard JPEG and JPEG2000 compression on ILSVRC2012 data.
297
+
298
+ # A.2 IMAGE COMPRESSION METRICS, PERFORMANCE AND VISUALIZATION
299
+
300
+ We use the following metrics to report performance of our image compression networks: PSNR (Peak Signal-to-Noise Ratio) is a standard measure, depending monotonically on mean squared error4. SSIM (Structural Similarity Index, Wang et al. (2004)) and MS-SSIM (Multi-Scale SSIM, Wang et al. (2003)) are metrics proposed to better measure the similarity of images as perceived by humans.
301
+
302
+ Fig. 8 depicts the performance of our deep compression models vs. standard JPEG and JPEG2000 methods on ILSVRC2012 data on MS-SSIM, SSIM and PSNR. Higher values are always better.
303
+
304
+ The compressed representations learned in the compression network are visualized in Fig. 9. The original RGB-image is shown along with compressed versions of the RGB image which reconstructed from the compressed representation. In the interest of space we only visualize 4 channels of the compressed representation for each image, even though each operating point has more than 4 channels. We choose the 4 channels with the highest entropy. These visualizations indicate how the networks compress an image, as the rate (bpp) gets lower the entropy cost of the network forces the compressed representation to use fewer quantization centers, as can clearly be seen in Fig. 9. For the most aggressive compression, the channel maps use only 2 centers for the compressed representation.
305
+
306
+ ![](images/859abf6a299d301cccda746d3082845ef6ed56891c1015e200fa4ac5e7291e80.jpg)
307
+ Figure 8: MS-SSIM, SSIM and PSNR as a function of rate in bpp. Shown for JPEG 2000, JPEG and the reported Deep Compression operating points. Higher is better.
308
+
309
+ ![](images/a96509f9f3f74b994d4a70b4e885475b1161b7f2addcccce9508950a1afb942e.jpg)
310
+ Figure 9: For each operating point we show the reconstructed/decoded image along with the 4 highest entropy channels of the compressed representation. The original RGB image is shown on the left for comparison. The channels of the compressed representation look like quantized downscaled versions of the original image, which motivates doing inference based on them instead of the reconstructed RGB images.
311
+
312
+ # A.3 ARCHITECTURE TABLE
313
+
314
+ Table 3 is a more detailed version of Table 1 and shows the detailed structure of the networks used, with the dimensions of the convolutions inside the network shown along with all layers.
315
+
316
+ Table 3: Structure of the ResNet and the cResNet architectures. The numbers reported are for ResNet-networks where the inputs are RGB images with a spatial dimensions $2 2 4 \times 2 2 4$ and for cResNet-networks where the inputs are compressed representations with spatial dimensions $2 8 \times 2 8$ . Building blocks are shown in brackets, with the numbers of blocks stacked. Downsampling is performed by conv3 1, conv4 1, and conv5 1 with a stride of 2.
317
+
318
+ <table><tr><td rowspan=1 colspan=2></td><td rowspan=1 colspan=6>RGB</td><td rowspan=1 colspan=9>Compressed representation</td></tr><tr><td rowspan=1 colspan=1>layer name</td><td rowspan=1 colspan=1>output size</td><td rowspan=1 colspan=6>ResNet-71 ResNet-50</td><td rowspan=1 colspan=3>cResNet-72</td><td rowspan=1 colspan=3>cResNet-51</td><td rowspan=1 colspan=3>cResNet-39</td></tr><tr><td rowspan=2 colspan=1>conv2_x</td><td rowspan=2 colspan=1>56×56</td><td rowspan=1 colspan=6>3x3 max pool, stride 2</td><td rowspan=1 colspan=3></td><td rowspan=2 colspan=3>None</td><td rowspan=2 colspan=3>None</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1×1,643×3,641×1,256</td><td rowspan=1 colspan=1>×3</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1×1,643×3,641×1,256</td><td rowspan=1 colspan=1>×3</td><td rowspan=1 colspan=3>None</td></tr><tr><td rowspan=1 colspan=1>conv3_x</td><td rowspan=1 colspan=1>28×28</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1×1,1283×3,1281×1,512</td><td rowspan=1 colspan=1>×4</td><td></td><td rowspan=1 colspan=1>1×1,1283×3,1281×1,512</td><td rowspan=1 colspan=1>×4</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1×1,1283×3,1281×1,512</td><td rowspan=1 colspan=1>×4</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1×1,1283×3,1281×1,512</td><td rowspan=1 colspan=1>×4</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1×1,1283×3,1281×1,512</td><td rowspan=1 colspan=1>×4</td></tr><tr><td rowspan=1 colspan=1>conv4_x</td><td rowspan=1 colspan=1>14×14</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1×1,2563×3,2561×1,1024</td><td rowspan=1 colspan=1>×13</td><td></td><td rowspan=1 colspan=1>1×1,2563×3,2561×1,1024</td><td rowspan=1 colspan=1>×6</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1×1,2563×3,2561×1,1024</td><td rowspan=1 colspan=1>×17</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1×1,25633,2561×1,1024</td><td rowspan=1 colspan=1>×10</td><td></td><td rowspan=1 colspan=1>1×1,2563×3,2561×1,1024</td><td rowspan=1 colspan=1>×6</td></tr><tr><td rowspan=1 colspan=1>conv5_x</td><td rowspan=1 colspan=1>7×7</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1×1,5123×3,5121×1,2048</td><td rowspan=1 colspan=1>×3</td><td></td><td rowspan=1 colspan=1>1×1,5123×3,5121×1,2048</td><td rowspan=1 colspan=1>×3</td><td></td><td rowspan=1 colspan=1>1×1,5123×3,5121×1,2048</td><td rowspan=1 colspan=1>×3</td><td></td><td rowspan=1 colspan=1>1×1,5123×3,5121×1,2048</td><td rowspan=1 colspan=1>×3</td><td></td><td rowspan=1 colspan=1>1×1,5123x3,5121×1,2048</td><td rowspan=1 colspan=1>×3</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1x1</td><td rowspan=1 colspan=15>average pool,1000-d fc,softmax</td></tr><tr><td rowspan=1 colspan=2>FLOPs</td><td rowspan=1 colspan=15>5.38×109 3.86×109 5.36×109 3.83×109 2.95×109</td></tr></table>
319
+
320
+ # A.4 TRAINING CLASSIFICATION
321
+
322
+ We use the ResNet implementation from the Slim library in TensorFlow5 with modifications for the custom architectures. For a fair comparison when using different settings we train all classifications networks from scratch in our experiments. For the training we use a batch size 64 and employ the linear scaling rule from Goyal et al. (2017) and use the learning rate 0.025. We employ the same learning rate schedule as in (He et al., 2015), but for faster training iterations we decay the learning rate $3 . 7 5 \times$ faster. We use a constant learning rate that is divided by a factor of 10 at 8, 16, and 24 epochs and we train for a total of 28 epochs.
323
+
324
+ A stochastic gradient descent (SGD) optimizer is used with momentum 0.9. We use weight decay of 0.0001. For pre-processing we do random-mirroring of inputs, random-cropping of inputs $( 2 2 4 \times 2 2 4$ for RGB images, $2 8 \times 2 8$ for compressed representations) and center the images using per channel mean over the ImageNet dataset.
325
+
326
+ # A.5 TRAINING SEGMENTATION
327
+
328
+ For the training of the segmentation architecture we use the same settings as in Chen et al. (2016) with a slightly modified pre-processing procedure. We use batch size 10 and perform $2 0 \mathrm { k }$ iterations for training using SGD optimizer with momentum 0.9. The initial learning rate is 0.001 (0.01 for final classification layer) and the learning rate policy is as follows: at each step the initial learning rate is multiplied by $\begin{array} { r } { ( 1 - \frac { \mathrm { i t e r } } { \mathrm { m a x } \mathrm { . i t e r } } ) ^ { 0 . 9 } } \end{array}$ . We use a weight decay of 0.0005. For preprocessing we do random-mirroring of inputs, random-cropping of inputs $3 2 0 \times 3 2 0$ for RGB images, $4 0 \times 4 0$ for the compressed representation) and center the images using per channel mean over the dataset.
329
+
330
+ # A.6 SEGMENTATION VISUALIZATION
331
+
332
+ Fig. 10 shows visual results of segmentation from compressed representation and reconstructed RGB images as in Fig. 5. The performance is visually similar for all operating points except for the 0.0983 bpp operating point in Fig. 10 where the reconstructed RGB image fails to capture the back part of the train, while the compressed representation manages to capture that aspect of the image in the segmentation.
333
+
334
+ ![](images/5186cfc93b465645268f23be69c4820caea0415191593ba5bbb96daf9dbec0e4.jpg)
335
+ Figure 10: Top: Reconstructed/decoded RGB images at different compression operating points. Middle: Predicted segmentation mask starting from reconstructed/decoded RGB images using ResNet-50-d architecture. Bottom: Predicted segmentation mask starting from compressed representation using cResNet-51-d architecture. Left: Original RGB image and the ground truth segmentation mask.
336
+
337
+ # A.7 IMAGE COMPRESSION METRICS FOR JOINT TRAINING
338
+
339
+ In Fig. 11 the compression metric results of finetuning the whole joint network (joint ft.), are compared to finetuning only the compression network (compression ft.). In both cases the same learning rate schedule is used, namely the one described in Section 6.1 Each image shows 4 distinct points along with a baseline for JPEG-2000. These 4 points are:
340
+
341
+ • joint-1: The joint ft. operating point at the beginning of the finetuning • joint-2: The joint ft. operating point at the end of finetuning • compression-1: the compression ft. operating point at the beginning of the finetuning • compression-2: the compression ft. operating point at the end of finetuning
342
+
343
+ joint-1 and compression-1 are the same because both joint ft. and compression ft. are initialized from the same starting point. An arrow then shows how the operating point for the joint training moves from joint-1 to joint-2 after finetuning. In the same manner an arrow shows how point compression-1 moves to compression-2 after finetuning.
344
+
345
+ Fig. 11 shows how the points move in the rate-vs.- $\{ \mathrm { M S S S I M , S S I M , P S N R } \}$ plane. When training, hitting an exact target bpp is difficult due to the noisy nature of the entropy loss. Therefore the points in Fig. 11 do not only move along the y-axis (MS-SSIM, SSIM or PSNR) but also move along the $\mathbf { X }$ -axis (rate). We show the final results for both joint ft. and compression ft. at the same bpp for a fair comparison.
346
+
347
+ As is evident from Fig. 11 this finetuning procedure improves the image compression metrics in all cases, i.e., they converge at a higher value for a lower bpp. We re-iterate, for all metrics higher values are better. However for SSIM and MS-SSIM the joint ft. improves more than the compression ft. For PSNR, however, the joint ft. improves less than the compression ft. The same effect is consistent for both 0.0983 and the 0.635 bpp operating points.
348
+
349
+ ![](images/258b2d891be1bcf0db85ad493f6d29cc3bf166846a470538b8621f4eb5a4e43c.jpg)
350
+ Figure 11: Showing how the selected metrics move from the original compression operating point to a different point after finetuning. We show this change when finetuning the compression network only, and then when finetuning the compression network and the classification architecture jointly. Top: 0.635 bpp operating point Bottom: 0.0983 bpp operating point.
351
+
352
+ # A.8 JOINT TRAINING TRAINING AND HYPERPARAMETERS
353
+
354
+ For joint training we set the hyperparameters in Eq. 2 to $\gamma = 0 . 0 0 1$ , $\beta = 1 5 0$ and $H _ { t } = 1 . 2 6 5$ for the 0.635 bpp operating point and $\gamma = 0 . 0 0 1$ , $\beta = 6 0 0$ and $H _ { t } = 0 . 8$ for the 0.0983 bpp operating point.
355
+
356
+ The learning rate schedule is similar to the one used in the image classification setting. It starts with an initial learning rate of 0.0025 that is divided by 10 every 3 epochs using a SGD optimizer with momentum 0.9. The joint network is then trained for a total of 9 epochs.
357
+
358
+ # A.9 RUNTIMES BENCHMARKS
359
+
360
+ In Fig. 12 we show the average runtimes (per image) for different setups. This complements Fig. 6 where we showed the theoretical computations for each setup. All benchmarks were run on a GeForce Titan X GPU in TensorFlow v1.3. We used batch size 256 for classification and batch size 20 for segmentation. For RGB images we used the image spatial dimension $2 2 4 \times 2 2 4$ and for the compressed representations we used spatial dimension $2 8 \times 2 8$ (corresponding to a $2 2 4 \times 2 2 4$ input image to the compression network).
361
+
362
+ ![](images/915029c679a8f77270ea6bbeebfdf47015a5949094dbe1d6c9094d62d2a656ae.jpg)
363
+ Figure 12: Inference performance at the 0.0983 bpp operating point for different architectures, for both compressed representations and reconstructed RGB images. We report the computational runtime (per image) of the inference networks only and for the reconstructed RGB images we also show the runtime for the inference network along with the decoding runtime.
md/train/HyxPx3R9tm/HyxPx3R9tm.md ADDED
@@ -0,0 +1,529 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # VARIATIONAL DISCRIMINATOR BOTTLENECK: IMPROVING IMITATION LEARNING, INVERSE RL, AND GANS BY CONSTRAINING INFORMATION FLOW
2
+
3
+ Xue Bin Peng & Angjoo Kanazawa & Sam Toyer & Pieter Abbeel & Sergey Levine
4
+
5
+ University of California, Berkeley {xbpeng,kanazawa,sdt,pabbeel,svlevine}@berkeley.edu
6
+
7
+ # ABSTRACT
8
+
9
+ Adversarial learning methods have been proposed for a wide range of applications, but the training of adversarial models can be notoriously unstable. Effectively balancing the performance of the generator and discriminator is critical, since a discriminator that achieves very high accuracy will produce relatively uninformative gradients. In this work, we propose a simple and general technique to constrain information flow in the discriminator by means of an information bottleneck. By enforcing a constraint on the mutual information between the observations and the discriminator’s internal representation, we can effectively modulate the discriminator’s accuracy and maintain useful and informative gradients. We demonstrate that our proposed variational discriminator bottleneck (VDB) leads to significant improvements across three distinct application areas for adversarial learning algorithms. Our primary evaluation studies the applicability of the VDB to imitation learning of dynamic continuous control skills, such as running. We show that our method can learn such skills directly from raw video demonstrations, substantially outperforming prior adversarial imitation learning methods. The VDB can also be combined with adversarial inverse reinforcement learning to learn parsimonious reward functions that can be transferred and re-optimized in new settings. Finally, we demonstrate that VDB can train GANs more effectively for image generation, improving upon a number of prior stabilization methods. (Video1)
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Adversarial learning methods provide a promising approach to modeling distributions over highdimensional data with complex internal correlation structures. These methods generally use a discriminator to supervise the training of a generator in order to produce samples that are indistinguishable from the data. A particular instantiation is generative adversarial networks, which can be used for high-fidelity generation of images (Goodfellow et al., 2014; Karras et al., 2017) and other highdimensional data (Vondrick et al., 2016; Xie et al., 2018; Donahue et al., 2018). Adversarial methods can also be used to learn reward functions in the framework of inverse reinforcement learning (Finn et al., 2016a; Fu et al., 2017), or to directly imitate demonstrations (Ho & Ermon, 2016). However, they suffer from major optimization challenges, one of which is balancing the performance of the generator and discriminator. A discriminator that achieves very high accuracy can produce relatively uninformative gradients, but a weak discriminator can also hamper the generator’s ability to learn. These challenges have led to widespread interest in a variety of stabilization methods for adversarial learning algorithms (Arjovsky et al., 2017; Kodali et al., 2017; Berthelot et al., 2017).
14
+
15
+ In this work, we propose a simple regularization technique for adversarial learning, which constrains the information flow from the inputs to the discriminator using a variational approximation to the information bottleneck. By enforcing a constraint on the mutual information between the input observations and the discriminator’s internal representation, we can encourage the discriminator to learn a representation that has heavy overlap between the data and the generator’s distribution, thereby effectively modulating the discriminator’s accuracy and maintaining useful and informative gradients for the generator. Our approach to stabilizing adversarial learning can be viewed as an adaptive variant of instance noise (Salimans et al., 2016; Sønderby et al., 2016; Arjovsky & Bottou, 2017). However, we show that the adaptive nature of this method is critical. Constraining the mutual information between the discriminator’s internal representation and the input allows the regularizer to directly limit the discriminator’s accuracy, which automates the choice of noise magnitude and applies this noise to a compressed representation of the input that is specifically optimized to model the most discerning differences between the generator and data distributions.
16
+
17
+ ![](images/79dae658a21f3a99bd5d512bd39e4ed96a241605dc27ac431de015f01936586c.jpg)
18
+ Figure 1: Our method is general and can be applied to a broad range of adversarial learning tasks. Left: Motion imitation with adversarial imitation learning. Middle: Image generation. Right: Learning transferable reward functions through adversarial inverse reinforcement learning.
19
+
20
+ The main contribution of this work is the variational discriminator bottleneck (VDB), an adaptive stochastic regularization method for adversarial learning that substantially improves performance across a range of different application domains, examples of which are available in Figure 1. Our method can be easily applied to a variety of tasks and architectures. First, we evaluate our method on a suite of challenging imitation tasks, including learning highly acrobatic skills from mocap data with a simulated humanoid character. Our method also enables characters to learn dynamic continuous control skills directly from raw video demonstrations, and drastically improves upon previous work that uses adversarial imitation learning. We further evaluate the effectiveness of the technique for inverse reinforcement learning, which recovers a reward function from demonstrations in order to train future policies. Finally, we apply our framework to image generation using generative adversarial networks, where employing VDB improves the performance in many cases.
21
+
22
+ # 2 RELATED WORK
23
+
24
+ Recent years have seen an explosion of adversarial learning techniques, spurred by the success of generative adversarial networks (GANs) (Goodfellow et al., 2014). A GAN framework is commonly composed of a discriminator and a generator, where the discriminator’s objective is to classify samples as real or fake, while the generator’s objective is to produce samples that fool the discriminator. Similar frameworks have also been proposed for inverse reinforcement learning (IRL) (Finn et al., 2016b) and imitation learning (Ho & Ermon, 2016). The training of adversarial models can be extremely unstable, with one of the most prevalent challenges being balancing the interplay between the discriminator and the generator (Berthelot et al., 2017). The discriminator can often overpower the generator, easily differentiating between real and fake samples, thus providing the generator with uninformative gradients for improvement (Che et al., 2016). Alternative loss functions have been proposed to mitigate this problem (Mao et al., 2016; Zhao et al., 2016; Arjovsky et al., 2017). Regularizers have been incorporated to improve stability and convergence, such as gradient penalties (Kodali et al., 2017; Gulrajani et al., 2017a; Mescheder et al., 2018), reconstruction loss (Che et al., 2016), and a myriad of other heuristics (Sønderby et al., 2016; Salimans et al., 2016; Arjovsky & Bottou, 2017; Berthelot et al., 2017). Task-specific architectural designs can also substantially improve performance (Radford et al., 2015; Karras et al., 2017). Similarly, our method also aims to regularize the discriminator in order to improve the feedback provided to the generator. But instead of explicit regularization of gradients or architecture-specific constraints, we apply a general information bottleneck to the discriminator, which previous works have shown to encourage networks to ignore irrelevant cues (Achille & Soatto, 2017). We hypothesize that this then allows the generator to focus on improving the most discerning differences between real and fake samples.
25
+
26
+ Adversarial techniques have also been applied to inverse reinforcement learning (Fu et al., 2017), where a reward function is recovered from demonstrations, which can then be used to train policies to reproduce a desired skill. Finn et al. (2016a) showed an equivalence between maximum entropy IRL and GANs. Similar techniques have been developed for adversarial imitation learning (Ho & Ermon, 2016; Merel et al., 2017), where agents learn to imitate demonstrations without explicitly recovering a reward function. One advantage of adversarial methods is that by leveraging a discriminator in place of a reward function, they can be applied to imitate skills where reward functions can be difficult to engineer. However, the performance of policies trained through adversarial methods still falls short of those produced by manually designed reward functions, when such reward functions are available (Rajeswaran et al., 2017; Peng et al., 2018). We show that our method can significantly improve upon previous works that use adversarial techniques, and produces results of comparable quality to those from state-of-the-art approaches that utilize manually engineered reward functions.
27
+
28
+ Our variational discriminator bottleneck is based on the information bottleneck (Tishby & Zaslavsky, 2015), a technique for regularizing internal representations to minimize the mutual information with the input. Intuitively, a compressed representation can improve generalization by ignoring irrelevant distractors present in the original input. The information bottleneck can be instantiated in practical deep models by leveraging a variational bound and the reparameterization trick, inspired by a similar approach in variational autoencoders (VAE) (Kingma & Welling, 2013). The resulting variational information bottleneck approximates this compression effect in deep networks (Alemi et al., 2016; Achille & Soatto, 2017). A similar bottleneck has also been applied to learn disentangled representations (Higgins et al., 2017). Building on the success of VAEs and GANs, a number of efforts have been made to combine the two. Makhzani et al. (2016) used adversarial discriminators during the training of VAEs to encourage the marginal distribution of the latent encoding to be similar to the prior distribution, similar techniques include Mescheder et al. (2017) and Chen et al. (2018). Conversely, Larsen et al. (2016) modeled the generator of a GAN using a VAE. Zhao et al. (2016) used an autoencoder instead of a VAE to model the discriminator, but does not enforce an information bottleneck on the encoding. While instance noise is widely used in modern architectures (Salimans et al., 2016; Sønderby et al., 2016; Arjovsky & Bottou, 2017), we show that explicitly enforcing an information bottleneck leads to improved performance over simply adding noise for a variety of applications.
29
+
30
+ # 3 PRELIMINARIES
31
+
32
+ In this section, we provide a review of the variational information bottleneck proposed by Alemi et al. (2016) in the context of supervised learning. Our variational discriminator bottleneck is based on the same principle, and can be instantiated in the context of GANs, inverse RL, and imitation learning. Given a dataset $\left\{ \mathbf { x } _ { i } , \mathbf { y } _ { i } \right\}$ , with features $\mathbf { x } _ { i }$ and labels $\mathbf { y } _ { i }$ , the standard maximum likelihood estimate $q ( \mathbf { y } _ { i } | \mathbf { x } _ { i } )$ can be determined according to
33
+
34
+ $$
35
+ \operatorname* { m i n } _ { \boldsymbol { q } } \quad \mathbb { E } _ { \mathbf { x } , \mathbf { y } \sim p ( \mathbf { x } , \mathbf { y } ) } \left[ - \log q ( \mathbf { y } | \mathbf { x } ) \right] .
36
+ $$
37
+
38
+ Unfortunately, this estimate is prone to overfitting, and the resulting model can often exploit idiosyncrasies in the data (Krizhevsky et al., 2012; Srivastava et al., 2014). Alemi et al. (2016) proposed regularizing the model using an information bottleneck to encourage the model to focus only on the most discriminative features. The bottleneck can be incorporated by first introducing an encoder $E ( { \bf z } | { \bf x } )$ that maps the features $\mathbf { x }$ to a latent distribution over $Z$ , and then enforcing an upper bound $I _ { c }$ on the mutual information between the encoding and the original features $I ( X , Z )$ . This results in the following regularized objective $J ( \boldsymbol { q } , E )$
39
+
40
+ $$
41
+ \begin{array} { r l } { J ( q , E ) = \underset { q , E } { \mathrm { m i n } } } & { \mathbb { E } _ { \mathbf { x } , \mathbf { y } \sim p ( \mathbf { x } , \mathbf { y } ) } \left[ \mathbb { E } _ { \mathbf { z } \sim E ( \mathbf { z } \mid \mathbf { x } ) } \left[ - \log q ( \mathbf { y } \vert \mathbf { z } ) \right] \right] } \\ { \mathrm { s . t . } } & { I ( X , Z ) \le I _ { c } . } \end{array}
42
+ $$
43
+
44
+ Note that the model $q ( \mathbf { y } \vert \mathbf { z } )$ now maps samples from the latent distribution $\mathbf { z }$ to the label $\mathbf { y }$ . The mutual information is defined according to
45
+
46
+ $$
47
+ I ( X , Z ) = \int p ( \mathbf { x } , \mathbf { z } ) \log { \frac { p ( \mathbf { x } , \mathbf { z } ) } { p ( \mathbf { x } ) p ( \mathbf { z } ) } } \ d \mathbf { x } \ d \mathbf { z } \ = \int p ( \mathbf { x } ) E ( \mathbf { z } | \mathbf { x } ) \log { \frac { E ( \mathbf { z } | \mathbf { x } ) } { p ( \mathbf { z } ) } } \ d \mathbf { x } \ d \mathbf { z } \ ,
48
+ $$
49
+
50
+ where $p ( \mathbf { x } )$ is the distribution given by the dataset. Computing the marginal distribution $\begin{array} { r } { p ( \mathbf { z } ) = \int E ( \mathbf { z } | \mathbf { x } ) p ( \mathbf { x } ) d \mathbf { x } } \end{array}$ can be challenging. Instead, a variational lower bound can be obtained by using an approximation $r ( \mathbf { z } )$ of the marginal. Since KL $[ p ( \mathbf { z } ) | | r ( \mathbf { z } ) ] \geq 0$ , $\begin{array} { r } { \int p ( \mathbf { z } ) \log p ( \mathbf { z } ) d \mathbf { z } \geq } \end{array}$ $\begin{array} { r } { \int p ( \mathbf { z } ) \log r ( \mathbf { z } ) d \mathbf { z } } \end{array}$ , an upper bound on $I ( X , Z )$ can be obtained via the KL divergence,
51
+
52
+ $$
53
+ I ( X , Z ) \leq \int p ( \mathbf { x } ) E ( \mathbf { z } | \mathbf { x } ) \log { \frac { E ( \mathbf { z } | \mathbf { x } ) } { r ( \mathbf { z } ) } } d \mathbf { x } d \mathbf { z } = \mathbb { E } _ { \mathbf { x } \sim p ( \mathbf { x } ) } \left[ \mathrm { K L } \left[ E ( \mathbf { z } | \mathbf { x } ) | | r ( \mathbf { z } ) \right] \right] .
54
+ $$
55
+
56
+ ![](images/b3e8e858d6dcdf4c97bb70738e3b1c011f0ac9d11f19000401897e1000d8ecdd.jpg)
57
+ Figure 2: Left: Overview of the variational discriminator bottleneck. The encoder first maps samples $\mathbf { x }$ to a latent distribution $E ( { \bf z } | { \bf x } )$ . The discriminator is then trained to classify samples $\mathbf { z }$ from the latent distribution. An information bottleneck $I ( X , Z ) \leq I _ { c }$ is applied to $Z$ . Right: Visualization of discriminators trained to differentiate two Gaussians with different KL bounds $I _ { c }$ .
58
+
59
+ This provides an upper bound on the regularized objective $\tilde { J } ( q , E ) \ge J ( q , E )$ ,
60
+
61
+ $$
62
+ \begin{array} { r l } { \tilde { J } ( q , E ) = \underset { q , E } { \mathrm { m i n } } } & { \mathbb { E } _ { \mathbf { x } , \mathbf { y } \sim p ( \mathbf { x } , \mathbf { y } ) } \left[ \mathbb { E } _ { \mathbf { z } \sim E ( \mathbf { z } \mid \mathbf { x } ) } \left[ - \log q ( \mathbf { y } \vert \mathbf { z } ) \right] \right] } \\ { \mathrm { s . t . } } & { \mathbb { E } _ { \mathbf { x } \sim p ( \mathbf { x } ) } \left[ \mathrm { K L } \left[ E ( \mathbf { z } \vert \mathbf { x } ) \vert \vert r ( \mathbf { z } ) \right] \right] \leq I _ { c } . } \end{array}
63
+ $$
64
+
65
+ To solve this problem, the constraint can be subsumed into the objective with a coefficient $\beta$
66
+
67
+ $$
68
+ \begin{array} { r l } { \underset { \boldsymbol { q } , E } { \mathop { \operatorname* { m i n } } } } & { \mathbb { E } _ { \mathbf { x } , \mathbf { y } \sim p ( \mathbf { x } , \mathbf { y } ) } \left[ \mathbb { E } _ { \mathbf { z } \sim E ( \mathbf { z } | \mathbf { x } ) } \left[ - \log q ( \mathbf { y } | \mathbf { z } ) \right] \right] + \beta \left( \mathbb { E } _ { \mathbf { x } \sim p ( \mathbf { x } ) } \left[ \mathrm { K L } \left[ E ( \mathbf { z } | \mathbf { x } ) | | r ( \mathbf { z } ) \right] \right] - I _ { c } \right) . } \end{array}
69
+ $$
70
+
71
+ Alemi et al. (2016) evaluated the method on supervised learning tasks, and showed that models trained with a VIB can be less prone to overfitting and more robust to adversarial examples.
72
+
73
+ # 4 VARIATIONAL DISCRIMINATOR BOTTLENECK
74
+
75
+ To outline our method, we first consider a standard GAN framework consisting of a discriminator $D$ and a generator $G$ , where the goal of the discriminator is to distinguish between samples from the target distribution $p ^ { * } ( \mathbf { x } )$ and samples from the generator $G ( \mathbf { x } )$ ,
76
+
77
+ $$
78
+ \begin{array} { r l } { \underset { G } { \mathop { \operatorname* { m a x } } } \underset { D } { \mathop { \operatorname* { m i n } } } } & { \mathbb { E } _ { \mathbf { x } \sim p ^ { * } ( \mathbf { x } ) } \left[ - \log \left( D ( \mathbf { x } ) \right) \right] + \mathbb { E } _ { \mathbf { x } \sim G ( \mathbf { x } ) } \left[ - \log \left( 1 - D ( \mathbf { x } ) \right) \right] . } \end{array}
79
+ $$
80
+
81
+ We incorporate a variational information bottleneck by introducing an encoder $E$ into the discriminator that maps a sample $\mathbf { x }$ to a stochastic encoding $\mathbf { z } \sim E ( \mathbf { z } | \mathbf { x } )$ , and then apply a constraint $I _ { c }$ on the mutual information $I ( X , Z )$ between the original features and the encoding. $D$ is then trained to classify samples drawn from the encoder distribution. A schematic illustration of the framework is available in Figure 2. The regularized objective $J ( D , E )$ for the discriminator is given by
82
+
83
+ $$
84
+ \begin{array} { r l } { J ( D , E ) = \underset { D , E } { \operatorname* { m i n } } } & { \mathbb { E } _ { x \sim p ^ { * } ( \mathbf { x } ) } \left[ \mathbb { E } _ { \mathbf { z } \sim E ( \mathbf { z } \mid \mathbf { x } ) } \left[ - \log \left( D ( \mathbf { z } ) \right) \right] \right] + \mathbb { E } _ { \mathbf { x } \sim G ( \mathbf { x } ) } \left[ \mathbb { E } _ { \mathbf { z } \sim E ( \mathbf { z } \mid \mathbf { x } ) } \left[ - \log \left( 1 - D ( \mathbf { z } ) \right) \right] \right] } \\ { \mathrm { s . t . } } & { \mathbb { E } _ { \mathbf { x } \sim \tilde { p } ( \mathbf { x } ) } \left[ \mathrm { K L } \left[ E ( \mathbf { z } | \mathbf { x } ) | | r ( \mathbf { z } ) \right] \right] \leq I _ { c } , } \end{array}
85
+ $$
86
+
87
+ with $\tilde { p } = { \textstyle \frac { 1 } { 2 } } p ^ { * } + { \textstyle \frac { 1 } { 2 } } G$ being a mixture of the target distribution and the generator. We refer to this regularizer as the variational discriminator bottleneck (VDB). To optimize this objective, we can introduce a Lagrange multiplier $\beta$ ,
88
+
89
+ $$
90
+ \begin{array} { r l } { I ( D , E ) = \underset { D , E } { \mathrm { m i n } } \underset { \beta \geq 0 } { \mathrm { m a x } } } & { \mathbb { E } _ { \mathbf { x } \sim p ^ { * } ( \mathbf { x } ) } \left[ \mathbb { E } _ { \mathbf { z } \sim E ( \mathbf { z } \mid \mathbf { x } ) } \left[ - \log \left( D ( \mathbf { z } ) \right) \right] \right] + \mathbb { E } _ { \mathbf { x } \sim G ( \mathbf { x } ) } \left[ \mathbb { E } _ { \mathbf { z } \sim E ( \mathbf { z } \mid \mathbf { x } ) } \left[ - \log \left( 1 - D ( \mathbf { z } ) \right) \right] \right. } \\ & { \left. + \beta \left( \mathbb { E } _ { \mathbf { x } \sim \tilde { p } ( \mathbf { x } ) } \left[ \mathrm { K L } \left[ E ( \mathbf { z } | \mathbf { x } ) \right| | r ( \mathbf { z } ) \right] \right] - I _ { c } \right) . } \end{array}
91
+ $$
92
+
93
+ As we will discuss in Section 4.1 and demonstrate in our experiments, enforcing a specific mutual information budget between $\mathbf { x }$ and $\mathbf { z }$ is critical for good performance. We therefore adaptively update $\beta$ via dual gradient descent to enforce a specific constraint $I _ { c }$ on the mutual information,
94
+
95
+ $$
96
+ \begin{array} { r l } & { D , E \gets \arg \operatorname* { m i n } _ { D , E } \mathcal { L } ( D , E , \beta ) } \\ & { \beta \gets \operatorname* { m a x } \big ( 0 , \beta + \alpha _ { \beta } \big ( \mathbb { E } _ { \mathbf { x } \sim \tilde { p } ( \mathbf { x } ) } [ \mathrm { K L } [ E ( \mathbf { z } | \mathbf { x } ) | | r ( \mathbf { z } ) ] ] - I _ { c } \big ) \big ) , } \end{array}
97
+ $$
98
+
99
+ where $\mathcal { L } ( D , E , \beta )$ is the Lagrangian
100
+
101
+ $$
102
+ \begin{array} { r l } & { \mathcal { L } ( D , E , \beta ) = \mathbb { E } _ { \mathbf { x } \sim p ^ { * } ( \mathbf { x } ) } [ \mathbb { E } _ { \mathbf { z } \sim E ( \mathbf { z } | \mathbf { x } ) } [ - \log ( D ( \mathbf { z } ) ) ] ] + \mathbb { E } _ { \mathbf { x } \sim G ( \mathbf { x } ) } [ \mathbb { E } _ { \mathbf { z } \sim E ( \mathbf { z } | \mathbf { x } ) } [ - \log ( 1 - D ( \mathbf { z } ) ) ] ] } \\ & { \quad \quad \quad \quad + \beta ( \mathbb { E } _ { \mathbf { x } \sim \hat { p } ( \mathbf { x } ) } [ \mathrm { K L } [ E ( \mathbf { z } | \mathbf { x } ) | | r ( \mathbf { z } ) ] ] - I _ { c } ) , } \end{array}
103
+ $$
104
+
105
+ and $\alpha _ { \beta }$ is the stepsize for the dual variable in dual gradient descent (Boyd & Vandenberghe, 2004). In practice, we perform only one gradient step on $D$ and $E$ , followed by an update to $\beta$ . We refer to a GAN that incorporates a VDB as a variational generative adversarial network (VGAN).
106
+
107
+ In our experiments, the prior $r ( \mathbf { z } ) = \mathcal { N } ( 0 , I )$ is modeled with a standard Gaussian. The encoder $E ( \mathbf { z } | \mathbf { x } ) \overset { - } { = } \mathcal { N } ( \mu _ { E } ( \mathbf { x } ) , \boldsymbol { \Sigma } _ { E } ^ { - } ( \mathbf { x } ) )$ models a Gaussian distribution in the latent variables $Z$ , with mean $\mu _ { E } ( { \bf x } )$ and diagonal covariance matrix $\Sigma _ { E } ( { \bf x } )$ . When computing the KL loss, each batch of data contains an equal number of samples from $p ^ { * } ( x )$ and $G ( x )$ . We use a simplified objective for the generator,
108
+
109
+ $$
110
+ \operatorname* { m a x } _ { G } ~ \mathbb { E } _ { \mathbf { x } \sim G ( \mathbf { x } ) } \left[ - \log \left( 1 - D ( \mu _ { E } ( \mathbf { x } ) ) \right) \right] .
111
+ $$
112
+
113
+ where the $\mathrm { K L }$ penalty is excluded from the generator’s objective. Instead of computing the expectation over $Z$ , we found that approximating the expectation by evaluating $D$ at the mean $\mu _ { E } ( { \bf x } )$ of the encoder’s distribution was sufficient for our tasks. The discriminator is modeled with a single linear unit followed by a sigmoid $D ( \mathbf { z } ) = \sigma ( \mathbf { w } _ { D } ^ { T } \mathbf { z } + \mathbf { b } _ { D } )$ , with weights $\mathbf { w } _ { D }$ and bias $\mathbf { b } _ { D }$ .
114
+
115
+ # 4.1 DISCUSSION AND ANALYSIS
116
+
117
+ To interpret the effects of the VDB, we consider the results presented by Arjovsky & Bottou (2017), which show that for two distributions with disjoint support, the optimal discriminator can perfectly classify all samples and its gradients will be zero almost everywhere. Thus, as the discriminator converges to the optimum, the gradients for the generator vanishes accordingly. To address this issue, Arjovsky & Bottou (2017) proposed applying continuous noise to the discriminator inputs, thereby ensuring that the distributions have continuous support everywhere. In practice, if the original distributions are sufficiently distant from each other, the added noise will have negligible effects. As shown by Mescheder et al. (2017), the optimal choice for the variance of the noise to ensure convergence can be quite delicate. In our method, by first using a learned encoder to map the inputs to an embedding and then applying an information bottleneck on the embedding, we can dynamically adjust the variance of the noise such that the distributions not only share support in the embedding space, but also have significant overlap. Since the minimum amount of information required for binary classification is 1 bit, by selecting an information constraint $I _ { c } < 1 $ , the discriminator is prevented from from perfectly differentiating between the distributions. To illustrate the effects of the VDB, we consider a simple task of training a discriminator to differentiate between two Gaussian distributions. Figure 2 visualizes the decision boundaries learned with different bounds $I _ { c }$ on the mutual information. Without a VDB, the discriminator learns a sharp decision boundary, resulting in vanishing gradients for much of the space. But as $I _ { c }$ decreases and the bound tightens, the decision boundary is smoothed, providing more informative gradients that can be leveraged by the generator.
118
+
119
+ Taking this analysis further, we can extend Theorem 3.2 from Arjovsky & Bottou (2017) to analyze the VDB, and show that the gradient of the generator will be non-degenerate for a small enough constraint $I _ { c }$ , under some additional simplifying assumptions. The result in Arjovsky & Bottou (2017) states that the gradient consists of vectors that point toward samples on the data manifold, multiplied by coefficients that depend on the noise. However, these coefficients may be arbitrarily small if the generated samples are far from real samples, and the noise is not large enough. This can still cause the generator gradient to vanish. In the case of the VDB, the constraint ensures that these coefficients are always bounded below. Due to space constraints, this result is presented in Appendix A.
120
+
121
+ # 4.2 VAIL: VARIATIONAL ADVERSARIAL IMITATION LEARNING
122
+
123
+ To extend the VDB to imitation learning, we start with the generative adversarial imitation learning (GAIL) framework (Ho & Ermon, 2016), where the discriminator’s objective is to differentiate between the state distribution induced by a target policy $\pi ^ { * } ( \mathbf { s } )$ and the state distribution of the agent’s policy $\pi ( \mathbf { s } )$ ,
124
+
125
+ $$
126
+ \operatorname* { m a x } _ { \pi } \operatorname* { m i n } _ { D } \quad \mathbb { E } _ { \mathbf { s } \sim \pi ^ { * } ( \mathbf { s } ) } \left[ - \log \left( D ( \mathbf { s } ) \right) \right] + \mathbb { E } _ { \mathbf { s } \sim \pi ( \mathbf { s } ) } \left[ - \log \left( 1 - D ( \mathbf { s } ) \right) \right] .
127
+ $$
128
+
129
+ ![](images/30d57dddd51de39696f83d45f9cb8ba9fe5f6258906497db5bb38f50fa1a90ca.jpg)
130
+ Figure 3: Simulated humanoid performing various skills. VAIL is able to closely imitate a broad range of skills from mocap data.
131
+
132
+ The discriminator is trained to maximize the likelihood assigned to states from the target policy, while minimizing the likelihood assigned to states from the agent’s policy. The discriminator also serves as the reward function for the agent, which encourages the policy to visit states that, to the discriminator, appear indistinguishable from the demonstrations. Similar to the GAN framework, we can incorporate a VDB into the discriminator,
133
+
134
+ $$
135
+ \begin{array} { r l } & { I ( D , E ) = \underset { D , E } { \mathrm { m i n } } \underset { \beta \geq 0 } { \mathrm { m a x } } \mathbb { E } _ { \mathbf { s } \sim \pi ^ { * } ( \mathbf { s } ) } [ \mathbb { E } _ { \mathbf { z } \sim E ( \mathbf { z } \mid \mathbf { s } ) } [ - \log ( D ( \mathbf { z } ) ) ] ] + \mathbb { E } _ { \mathbf { s } \sim \pi ( \mathbf { s } ) } [ \mathbb { E } _ { \mathbf { z } \sim E ( \mathbf { z } \mid \mathbf { s } ) } [ - \log ( 1 - D ( \mathbf { z } ) ) ] ] } \\ & { \qquad + \beta ( \mathbb { E } _ { \mathbf { s } \sim \pi ( \mathbf { s } ) } [ \mathrm { K L } [ E ( \mathbf { z } \mid \mathbf { s } ) ] \mid \mid r ( \mathbf { z } ) ] ] - I _ { c } ) . } \end{array}
136
+ $$
137
+
138
+ where $\tilde { \pi } = { \textstyle \frac { 1 } { 2 } } \pi ^ { * } + { \textstyle \frac { 1 } { 2 } } \pi$ represents a mixture of the target policy and the agent’s policy. The reward for $\pi$ is then specified by the discriminator $r _ { t } = - \mathrm { l o g } \bar { ( 1 - D ( \mu _ { E } ( \mathbf { s } ) ) ) }$ . We refer to this method as variational adversarial imitation learning (VAIL).
139
+
140
+ # 4.3 VAIRL: VARIATIONAL ADVERSARIAL INVERSE REINFORCEMENT LEARNING
141
+
142
+ The VDB can also be applied to adversarial inverse reinforcement learning (Fu et al., 2017) to yield a new algorithm which we call variational adversarial inverse reinforcement learning (VAIRL). AIRL operates in a similar manner to GAIL, but with a discriminator of the form
143
+
144
+ $$
145
+ D ( { \bf s } , { \bf a } , { \bf s } ^ { \prime } ) = \frac { \exp \left( f ( { \bf s } , { \bf a } , { \bf s } ^ { \prime } ) \right) } { \exp \left( f ( { \bf s } , { \bf a } , { \bf s } ^ { \prime } ) \right) + \pi ( { \bf a } | { \bf s } ) } ,
146
+ $$
147
+
148
+ where $f ( \mathbf { s } , \mathbf { a } , \mathbf { s } ^ { \prime } ) = g ( \mathbf { s } , \mathbf { a } ) + \gamma h ( \mathbf { s } ^ { \prime } ) - h ( \mathbf { s } )$ , with $g$ and $h$ being learned functions. Under certain restrictions on the environment, Fu et al. show that if $g ( \mathbf { s } , \mathbf { a } )$ is defined to depend only on the current state s, the optimal $g ( \mathbf { s } )$ recovers the expert’s true reward function $r ^ { * } ( \mathbf { s } )$ up to a constant $g ^ { * } ( \mathbf { s } ) =$ $r ^ { * } ( \mathbf { s } ) + \mathrm { c o n s i }$ . In this case, the learned reward can be re-used to train policies in environments with different dynamics, and will yield the same policy as if the policy was trained under the expert’s true reward. In contrast, GAIL’s discriminator typically cannot be re-optimized in this way $\mathrm { F u }$ et al., 2017). In VAIRL, we introduce stochastic encoders $E _ { g } ( \mathbf { z } _ { g } | \mathbf { s } ) , E _ { h } ( \mathbf { z } _ { h } | \mathbf { s } )$ , and $g ( \mathbf { z } _ { g } ) , h ( \mathbf { z } _ { h } )$ are modified to be functions of the encoding. We can reformulate Equation 13 as
149
+
150
+ $$
151
+ D ( { \bf s } , { \bf a } , { \bf z } ) = \frac { \exp \left( f ( { \bf z } _ { g } , { \bf z } _ { h } , { \bf z } _ { h } ^ { \prime } ) \right) } { \exp \left( f ( { \bf z } _ { g } , { \bf z } _ { h } , { \bf z } _ { h } ^ { \prime } ) \right) + \pi ( { \bf a } | { \bf s } ) } ,
152
+ $$
153
+
154
+ for ${ \bf z } = ( { \bf z } _ { g } , { \bf z } _ { h } , { \bf z } _ { h } ^ { \prime } )$ and $f ( \mathbf { z } _ { g } , \mathbf { z } _ { h } , \mathbf { z } _ { h } ^ { \prime } ) = D _ { g } ( \mathbf { z } _ { g } ) + \gamma D _ { h } ( \mathbf { z } _ { h } ^ { \prime } ) - D _ { h } ( \mathbf { z } _ { h } )$ . We then obtain a modified objective of the form
155
+
156
+ $$
157
+ \begin{array} { r l } { J ( D , E ) = \underset { D , E } { \mathrm { m i n } } \underset { \beta \geq 0 } { \mathrm { m a x } } } & { \mathbb { E } _ { \mathbf { s } , \mathbf { s } ^ { \prime } \sim \pi ^ { * } ( \mathbf { s } , \mathbf { s } ^ { \prime } ) } \left[ \mathbb { E } _ { \mathbf { z } \sim E ( \mathbf { z } \mid \mathbf { s } , \mathbf { s } ^ { \prime } ) } \left[ - \log \left( D ( \mathbf { s } , \mathbf { a } , \mathbf { z } ) \right) \right] \right] } \\ & { + \mathbb { E } _ { \mathbf { s } , \mathbf { s } ^ { \prime } \sim \pi ( \mathbf { s } , \mathbf { s } ^ { \prime } ) } \left[ \mathbb { E } _ { \mathbf { z } \sim E ( \mathbf { z } \mid \mathbf { s } , \mathbf { s } ^ { \prime } ) } \left[ - \log \left( 1 - D ( \mathbf { s } , \mathbf { a } , \mathbf { z } ) \right) \right] \right] } \\ & { + \beta \left( \mathbb { E } _ { \mathbf { s } , \mathbf { s } ^ { \prime } \sim \pi ( \mathbf { s } , \mathbf { s } ^ { \prime } ) } \left[ \mathrm { K L } \left[ E ( \mathbf { z } \mid \mathbf { s } , \mathbf { s } ^ { \prime } ) | | r ( \mathbf { z } ) \right] \right] - I _ { c } \right) , } \end{array}
158
+ $$
159
+
160
+ where $\pi ( s , s ^ { \prime } )$ denotes the joint distribution of successive states from a policy, and $E ( \mathbf { z } | \mathbf { s } , \mathbf { s } ^ { \prime } ) =$ $E _ { g } ( \mathbf { z } _ { g } | \mathbf { s } ) { \cdot } E _ { h } ( \mathbf { z } _ { h } | \mathbf { s } ) { \cdot } E _ { h } ( \mathbf { z } _ { h } ^ { \prime } | \bar { \mathbf { s } } ^ { \prime } )$ .
161
+
162
+ ![](images/f8345f9a0288395a6d57696ed487a1c948855dd61361b99c00b0067aa21d534b.jpg)
163
+ Figure 4: Learning curves comparing VAIL to other methods for motion imitation. Performance is measured using the average joint rotation error between the simulated character and the reference motion. Each method is evaluated with 3 random seeds.
164
+
165
+ <table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>Backflip</td><td rowspan=1 colspan=1>Cartwheel</td><td rowspan=1 colspan=1>Dance</td><td rowspan=1 colspan=1>Run</td><td rowspan=1 colspan=1>Spinkick</td></tr><tr><td rowspan=1 colspan=1>BC</td><td rowspan=1 colspan=1>3.01</td><td rowspan=1 colspan=1>2.88</td><td rowspan=1 colspan=1>2.93</td><td rowspan=1 colspan=1>2.63</td><td rowspan=1 colspan=1>2.88</td></tr><tr><td rowspan=1 colspan=1>Merel et al., 2017</td><td rowspan=1 colspan=1>1.33 ± 0.03</td><td rowspan=1 colspan=1>1.47 ± 0.12</td><td rowspan=1 colspan=1>2.61 ± 0.30</td><td rowspan=1 colspan=1>0.52 ± 0.04</td><td rowspan=1 colspan=1>1.82 ± 0.35</td></tr><tr><td rowspan=1 colspan=1>GAIL</td><td rowspan=1 colspan=1>0.74±0.15</td><td rowspan=1 colspan=1>0.84± 0.05</td><td rowspan=1 colspan=1>1.31 ± 0.16</td><td rowspan=1 colspan=1>0.17±0.03</td><td rowspan=1 colspan=1>1.07 ± 0.03</td></tr><tr><td rowspan=1 colspan=1>GAIL -noise</td><td rowspan=1 colspan=1>0.42±0.02</td><td rowspan=1 colspan=1>0.92±0.07</td><td rowspan=1 colspan=1>0.96±0.08</td><td rowspan=1 colspan=1>0.21±0.05</td><td rowspan=1 colspan=1>0.95±0.14</td></tr><tr><td rowspan=1 colspan=1>GAIL - noise z</td><td rowspan=1 colspan=1>0.67±0.12</td><td rowspan=1 colspan=1>0.72± 0.04</td><td rowspan=1 colspan=1>1.14 ± 0.08</td><td rowspan=1 colspan=1>0.14±0.03</td><td rowspan=1 colspan=1>0.64±0.09</td></tr><tr><td rowspan=1 colspan=1>GAIL - GP</td><td rowspan=1 colspan=1>0.62±0.09</td><td rowspan=1 colspan=1>0.69 ±0.05</td><td rowspan=1 colspan=1>0.80± 0.32</td><td rowspan=1 colspan=1>0.12 ± 0.02</td><td rowspan=1 colspan=1>0.64± 0.04</td></tr><tr><td rowspan=1 colspan=1>VAIL (ours)</td><td rowspan=1 colspan=1>0.36±0.13</td><td rowspan=1 colspan=1>0.40±0.08</td><td rowspan=1 colspan=1>0.40±0.21</td><td rowspan=1 colspan=1>0.13±0.01</td><td rowspan=1 colspan=1>0.34± 0.05</td></tr><tr><td rowspan=1 colspan=1>VAIL - GP (ours)</td><td rowspan=1 colspan=1>0.46±0.17</td><td rowspan=1 colspan=1>0.31 ± 0.02</td><td rowspan=1 colspan=1>0.15±0.01</td><td rowspan=1 colspan=1>0.10±0.01</td><td rowspan=1 colspan=1>0.31 ± 0.02</td></tr><tr><td rowspan=1 colspan=1>Peng et al., 2018</td><td rowspan=1 colspan=1>0.26</td><td rowspan=1 colspan=1>0.21</td><td rowspan=1 colspan=1>0.20</td><td rowspan=1 colspan=1>0.14</td><td rowspan=1 colspan=1>0.19</td></tr></table>
166
+
167
+ Table 1: Average joint rotation error (radians) on humanoid motion imitation tasks. VAIL outperforms the other methods for all skills evaluated, except for policies trained using the manuallydesigned reward function from (Peng et al., 2018).
168
+
169
+ # 5 EXPERIMENTS
170
+
171
+ We evaluate our method on adversarial learning problems in imitation learning, inverse reinforcement learning, and image generation. In the case of imitation learning, we show that the VDB enables agents to learn complex motion skills from a single demonstration, including visual demonstrations provided in the form of video clips. We also show that the VDB improves the performance of inverse RL methods. Inverse RL aims to reconstruct a reward function from a set demonstrations, which can then used to perform the task in new environments, in contrast to imitation learning, which aims to recover a policy directly. Our method is also not limited to control tasks, and we demonstrate its effectiveness for unconditional image generation.
172
+
173
+ # 5.1 VAIL: VARIATIONAL ADVERSARIAL IMITATION LEARNING
174
+
175
+ The goal of the motion imitation tasks is to train a simulated character to mimic demonstrations provided by mocap clips recorded from human actors. Each mocap clip provides a sequence of target states $\big \{ \mathbf { s } _ { 0 } ^ { * } , \mathbf { s } _ { 1 } ^ { * } , . . . , \mathbf { s } _ { T } ^ { * } \big \}$ that the character should track at each timestep. We use a similar experimental setup as Peng et al. (2018), with a 34 degrees-of-freedom humanoid character. We found that the discriminator architecture can greatly affect the performance on complex skills. The particular architecture we employ differs substantially from those used in prior work (Merel et al., 2017), details of which are available in Appendix C. The encoding $Z$ is 128D and an information constraint of $I _ { c } = 0 . 5$ is applied for all skills, with a dual stepsize of $\alpha _ { \beta } = 1 0 ^ { - 5 }$ . All policies are trained using PPO (Schulman et al., 2017).
176
+
177
+ The motions learned by the policies are best seen in the supplementary video. Snapshots of the character’s motions are shown in Figure 3. Each skill is learned from a single demonstration. VAIL is able to closely reproduce a variety of skills, including those that involve highly dynamics flips and complex contacts. We compare VAIL to a number of other techniques, including state-only GAIL (Ho & Ermon, 2016), GAIL with instance noise applied to the discriminator inputs (GAIL - noise), GAIL with instance noise applied to the last hidden layer (GAIL - noise z), and GAIL with a gradient penalty applied to the discriminator (GAIL - GP) (Mescheder et al., 2018). Since the VDB helps to prevent vanishing gradients, while GP mitigates exploding gradients, the two techniques can be seen as being complementary. Therefore, we also train a model that combines both VAIL and GP (VAIL -
178
+
179
+ ![](images/7497cb73e50bbfbd813c2ffce4161f7254aec761aabb16358d90c1638d8e73f8.jpg)
180
+ Figure 5: Left: Snapshots of the video demonstration and the simulated character trained with VAIL. The policy learns to run by directly imitating the video. Right: Saliency maps that visualize the magnitude of the discriminator’s gradient with respect to all channels of the RGB input images from both the demonstration and the simulation. Pixel values are normalized between [0, 1].
181
+
182
+ ![](images/5f2f5cf0687f611bc03d408752373a1aaf35da53c395f876a101449a9d723a44.jpg)
183
+ Figure 6: Left: Learning curves comparing policies for the video imitation task trained using a pixel-wise loss as the reward, GAIL, and VAIL. Only VAIL successfully learns to run from a video demonstration. Middle: Effect of training with fixed values of $\beta$ and adaptive $\beta$ $I _ { c } = 0 . 5$ ). Right:. KL loss over the course of training with adaptive $\beta$ . The dual gradient descent update for $\beta$ effectively enforces the VDB constraint $I _ { c }$ .
184
+
185
+ GP). Implementation details for combining the VDB and GP are available in Appendix B. Learning curves for the various methods are shown in Figure 10 and Table 1 summarizes the performance of the final policies. Performance is measured in terms of the average joint rotation error between the simulated character and the reference motion. We also include a reimplementation of the method described by Merel et al. (2017). For the purpose of our experiments, GAIL denotes policies trained using our particular architecture but without a VDB, and Merel et al. (2017) denotes policies trained using an architecture that closely mirror those from previous work. Furthermore, we include comparisons to policies trained using the handcrafted reward from Peng et al. (2018), as well as policies trained via behavioral cloning (BC). Since mocap data does not provide expert actions, we use the policies from Peng et al. (2018) as oracles to provide state-action demonstrations, which are then used to train the BC policies via supervised learning. Each BC policy is trained with $1 0 \mathrm { k }$ samples from the oracle policies, while all other policies are trained from just a single demonstration, the equivalent of approximately 100 samples.
186
+
187
+ VAIL consistently outperforms previous adversarial methods, and VAIL - GP achieves the best performance overall. Simply adding instance noise to the inputs (Salimans et al., 2016) or hidden layer without the KL constraint (Sønderby et al., 2016) leads to worse performance, since the network can learn a latent representation that renders the effects of the noise negligible. Though training with the handcrafted reward still outperforms the adversarial methods, VAIL demonstrates comparable performance to the handcrafted reward without manual reward or feature engineering, and produces motions that closely resemble the original demonstrations. The method from Merel et al. (2017) was able to imitate simple skills such as running, but was unable to reproduce more acrobatic skills such as the backflip and spinkick. In the case of running, our implementation produces more natural gaits than the results reported in Merel et al. (2017). Behavioral cloning is unable to reproduce any of the skills, despite being provided with substantially more demonstration data than the other methods.
188
+
189
+ Video Imitation: While our method achieves substantially better results on motion imitation when compared to prior work, previous methods can still produce reasonable behaviors. However, if the demonstrations are provided in terms of the raw pixels from video clips, instead of mocap data, the imitation task becomes substantially harder. The goal of the agent is therefore to directly imitate the skill depicted in the video. This is also a setting where manually engineering rewards is impractical, since simple losses like pixel distance do not provide a semantically meaningful measure of similarity. Figure 6 compares learning curves of policies trained with VAIL, GAIL, and policies trained using a reward function defined by the average pixel-wise difference between the frame $M _ { t } ^ { * }$ from the video demonstration and a rendered image $M _ { t }$ of the agent at each timestep $t$ , $\begin{array} { r } { r _ { t } = 1 - \frac { 1 } { 3 \times 6 4 ^ { 2 } } | | M _ { t } ^ { * } - M _ { t } | | ^ { 2 } } \end{array}$ . Each frame is represented by a $6 4 \times 6 4$ RGB image.
190
+
191
+ ![](images/9a3768a8c49373d423021d089034c2c03922c0410f3b165f6f1fe6e355dafe56.jpg)
192
+ Figure 7: Left: C-Maze and S-Maze. When trained on the training maze on the left, AIRL learns a reward that overfits to the training task, and which cannot be transferred to the mirrored maze on the right. In contrast, VAIRL learns a smoother reward function that enables more-reliable transfer. Right: Performance on flipped test versions of our two training mazes. We report mean return ( $\pm$ std. dev.) over five runs, and the mean return for the expert used to generate demonstrations.
193
+
194
+ <table><tr><td rowspan=2 colspan=1>Method</td><td rowspan=1 colspan=2>Transferenvironments</td></tr><tr><td rowspan=1 colspan=1>C-maze</td><td rowspan=1 colspan=1>S-maze</td></tr><tr><td rowspan=1 colspan=1>GAIL</td><td rowspan=1 colspan=1>-24.6±7.2</td><td rowspan=1 colspan=1>1.0±1.3</td></tr><tr><td rowspan=1 colspan=1>VAIL</td><td rowspan=1 colspan=1>-65.6±18.9</td><td rowspan=1 colspan=1>20.8±39.7</td></tr><tr><td rowspan=1 colspan=1>AIRL</td><td rowspan=1 colspan=1>-15.3±7.8</td><td rowspan=1 colspan=1>-0.2±0.1</td></tr><tr><td rowspan=1 colspan=1>AIRL - GP</td><td rowspan=1 colspan=1>-9.14±0.4</td><td rowspan=1 colspan=1>-0.14±0.3</td></tr><tr><td rowspan=1 colspan=1>VAIRL (β = 0)</td><td rowspan=1 colspan=1>-25.5±7.2</td><td rowspan=1 colspan=1>62.3±33.2</td></tr><tr><td rowspan=1 colspan=1>VAIRL (ours)</td><td rowspan=1 colspan=1>-10.0±2.2</td><td rowspan=1 colspan=1>74.0±38.7</td></tr><tr><td rowspan=1 colspan=1>VAIRL - GP (ours)</td><td rowspan=1 colspan=1>-9.18±0.4</td><td rowspan=1 colspan=1>156.5±5.6</td></tr><tr><td rowspan=1 colspan=1>TRPO expert</td><td rowspan=1 colspan=1>-5.1</td><td rowspan=1 colspan=1>153.2</td></tr></table>
195
+
196
+ Both GAIL and the pixel-loss are unable to learn the running gait. VAIL is the only method that successfully learns to imitate the skill from the video demonstration. Snapshots of the video demonstration and the simulated motion is available in Figure 5. To further investigate the effects of the VDB, we visualize the gradient of the discriminator with respect to images from the video demonstration and simulation. Saliency maps for discriminators trained with VAIL and GAIL are available in Figure 5. The VAIL discriminator learns to attend to spatially coherent image patches around the character, while the GAIL discriminator exhibits less structure. The magnitude of the gradients from VAIL also tend to be significantly larger than those from GAIL, which may suggests that VAIL is able to mitigate the problem of vanishing gradients present in GAIL.
197
+
198
+ Adaptive Constraint: To evaluate the effects of the adaptive $\beta$ updates, we compare policies trained with different fixed values of $\beta$ and policies where $\beta$ is updated adaptively to enforce a desired information constraint $I _ { c } = 0 . 5$ . Figure 6 illustrates the learning curves and the KL loss over the course of training. When $\beta$ is too small, performance reverts to that achieved by GAIL. Large values of $\beta$ help to smooth the discriminator landscape and improve learning speed during the early stages of training, but converges to a worse performance. Policies trained using dual gradient descent to adaptively update $\beta$ consistently achieves the best performance overall.
199
+
200
+ # 5.2 VAIRL: VARIATIONAL ADVERSARIAL INVERSE REINFORCEMENT LEARNING
201
+
202
+ Next, we use VAIRL to recover reward functions from demonstrations. Unlike the discriminator learned by VAIL, the reward function recovered by VAIRL can be re-optimized to train new policies from scratch in the same environment. In some cases, it can also be used to transfer similar behaviour to different environments. In Figure 7, we show the results of applying VAIRL to the C-maze from Fu et al. (2017), and a more complex S-maze; the simple 2D observation spaces of these tasks make it easy to interpret the recovered reward functions. In both mazes, the expert is trained to navigate from a start position at the bottom of the maze to a fixed target position at the top. We use each method to obtain an imitation policy and to approximate the expert’s reward on the original maze. The recovered reward is then used to train a new policy to solve a left–right flipped version of the training maze. On the C-maze, we found that plain AIRL—without a gradient penalty— would sometimes overfit and fail to transfer to the new environment, as evidenced by the reward visualization in Figure 7 (left) and the higher return variance in Figure 7 (right). In contrast, by incorporating a VDB into AIRL, VAIRL learns a substantially smoother reward function that is more suitable for transfer. Furthermore, we found that in the S-maze with two internal walls, AIRL was too unstable to acquire a meaningful reward function. This was true even with the use of a gradient penalty. In contrast, VAIRL was able to learn a reasonable reward in most cases without a gradient penalty, and its performance improved even further with the addition of a gradient penalty. To evaluate the effects of the VDB, we observe that the performance of VAIRL drops on both tasks when the KL constraint is disabled $\mathcal { B } = 0$ ), suggesting that the improvements from the VDB cannot be attributed entirely to the noise introduced by the sampling process for z. Further details of these experiments and illustrations of the recovered reward functions are available in Appendix D.
203
+
204
+ ![](images/c86c34eae7b7dab70e64c321c0f81908e190aa387a041d3cc2f92e4b2ee908cc.jpg)
205
+
206
+ ![](images/78b0c0503897ba4746233494cfd31890b086ca770f3439471530fef4c520776d.jpg)
207
+ Figure 8: Comparison of VGAN and other methods on CIFAR-10, with performance evaluated using the Frechet Inception Distance (FID). ´
208
+ Figure 9: VGAN samples on CIFAR-10, CelebA $1 2 8 \times 1 2 8$ , and CelebAHQ $1 0 2 4 \times 1 0 2 4$ .
209
+
210
+ # 5.3 VGAN: VARIATIONAL GENERATIVE ADVERSARIAL NETWORKS
211
+
212
+ Finally, we apply the VDB to image generation with generative adversarial networks, which we refer to as VGAN. Experiment are conducted on CIFAR-10 (Krizhevsky et al.), CelebA (Liu et al. (2015)), and CelebAHQ (Karras et al., 2018) datasets. We compare our approach to recent stabilization techniques: WGAN-GP (Gulrajani et al., 2017b), instance noise (Sønderby et al., 2016; Arjovsky & Bottou, 2017), spectral normalization (SN) (Miyato et al., 2018), and gradient penalty (GP) (Mescheder et al., 2018), as well as the original GAN (Goodfellow et al., 2014) on CIFAR10. To measure performance, we report the Frechet Inception Distance (FID) (Heusel et al., 2017), ´ which has been shown to be more consistent with human evaluation. All methods are implemented using the same base model, built on the resnet architecture of Mescheder et al. (2018). Aside from tuning the KL constraint $I _ { c }$ for VGAN, no additional hyperparameter optimization was performed to modify the settings provided by Mescheder et al. (2018). The performance of the various methods on CIFAR-10 are shown in Figure 8. While vanilla GAN and instance noise are prone to diverging as training progresses, VGAN remains stable. Note that instance noise can be seen as a non-adaptive version of VGAN without constraints on $I _ { c }$ . This experiment again highlights that there is a significant improvement from imposing the information bottleneck over simply adding instance noise. Combining both VDB and gradient penalty (VGAN - GP) achieves the best performance overall with an FID of 18.1. We also experimented with combining the VDB with SN, but this combination is prone to diverging. See Figure 9 for samples of images generated with our approach. Please refer to Appendix E for experimental details and more results.
213
+
214
+ # 6 CONCLUSION
215
+
216
+ We present the variational discriminator bottleneck, a general regularization technique for adversarial learning. Our experiments show that the VDB is broadly applicable to a variety of domains, and yields significant improvements over previous techniques on a number of challenging tasks. While our experiments have produced promising results for video imitation, the results have been primarily with videos of synthetic scenes. We believe that extending the technique to imitating realworld videos is an exciting direction. Another exciting direction for future work is a more in-depth theoretical analysis of the method, to derive convergence and stability results or conditions.
217
+
218
+ # ACKNOWLEDGEMENTS
219
+
220
+ We would like to thank the anonymous reviewers for their helpful feedback, and AWS and NVIDIA for providing computational resources. This research was funded by an NSERC Postgraduate Scholarship, a Berkeley Fellowship for Graduate Study, BAIR, Huawei, and ONR PECASE N000141612723.
221
+
222
+ # REFERENCES
223
+
224
+ Alessandro Achille and Stefano Soatto. Information dropout: Learning optimal representations through noisy computation. IEEE Transactions on Pattern Analysis & Machine Intelligence, 40 (12):2897–2905, 2017. ISSN 0162-8828. doi: 10.1109/TPAMI.2017.2784440.
225
+
226
+ Alexander A. Alemi, Ian Fischer, Joshua V. Dillon, and Kevin Murphy. Deep variational information bottleneck. CoRR, abs/1612.00410, 2016. URL http://arxiv.org/abs/1612.00410.
227
+
228
+ Mart´ın Arjovsky and Leon Bottou. Towards principled methods for training generative adversarial ´ networks. CoRR, abs/1701.04862, 2017. URL http://arxiv.org/abs/1701.04862.
229
+
230
+ Martin Arjovsky, Soumith Chintala, and Leon Bottou. Wasserstein generative adversarial networks. ´ In Doina Precup and Yee Whye Teh (eds.), Proceedings of the 34th International Conference on Machine Learning, volume 70 of Proceedings of Machine Learning Research, pp. 214–223, International Convention Centre, Sydney, Australia, 06–11 Aug 2017. PMLR. URL http:// proceedings.mlr.press/v70/arjovsky17a.html.
231
+
232
+ David Berthelot, Tom Schumm, and Luke Metz. BEGAN: boundary equilibrium generative adversarial networks. CoRR, abs/1703.10717, 2017. URL http://arxiv.org/abs/1703. 10717.
233
+
234
+ Stephen Boyd and Lieven Vandenberghe. Convex Optimization. Cambridge University Press, New York, NY, USA, 2004. ISBN 0521833787.
235
+
236
+ Bullet. Bullet physics library, 2015. http://bulletphysics.org.
237
+
238
+ Tong Che, Yanran Li, Athul Paul Jacob, Yoshua Bengio, and Wenjie Li. Mode regularized generative adversarial networks. CoRR, abs/1612.02136, 2016. URL http://arxiv.org/abs/1612. 02136.
239
+
240
+ Liqun Chen, Shuyang Dai, Yunchen Pu, Erjin Zhou, Chunyuan Li, Qinliang Su, Changyou Chen, and Lawrence Carin. Symmetric variational autoencoder and connections to adversarial learning. In Amos Storkey and Fernando Perez-Cruz (eds.), Proceedings of the Twenty-First International Conference on Artificial Intelligence and Statistics, volume 84 of Proceedings of Machine Learning Research, pp. 661–669, Playa Blanca, Lanzarote, Canary Islands, 09–11 Apr 2018. PMLR. URL http://proceedings.mlr.press/v84/chen18b.html.
241
+
242
+ Chris Donahue, Julian McAuley, and Miller Puckette. Synthesizing audio with generative adversarial networks. CoRR, abs/1802.04208, 2018. URL http://arxiv.org/abs/1802.04208.
243
+
244
+ Chelsea Finn, Paul F. Christiano, Pieter Abbeel, and Sergey Levine. A connection between generative adversarial networks, inverse reinforcement learning, and energy-based models. CoRR, abs/1611.03852, 2016a. URL http://arxiv.org/abs/1611.03852.
245
+
246
+ 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, 2016b. URL http://jmlr.org/proceedings/papers/v48/finn16.html.
247
+
248
+ Justin Fu, Katie Luo, and Sergey Levine. Learning robust rewards with adversarial inverse reinforcement learning. CoRR, abs/1710.11248, 2017. URL http://arxiv.org/abs/1710. 11248.
249
+
250
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In Z. Ghahramani, M. Welling, C. Cortes, N. D. Lawrence, and K. Q. Weinberger (eds.), Advances in Neural Information Processing Systems 27, pp. 2672–2680. Curran Associates, Inc., 2014. URL http://papers. nips.cc/paper/5423-generative-adversarial-nets.pdf.
251
+
252
+ Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, Vincent Dumoulin, and Aaron C Courville. Improved training of wasserstein gans. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett (eds.), Advances in Neural Information Processing Systems 30, pp. 5767–5777. Curran Associates, Inc., 2017a. URL http://papers.nips.cc/paper/ 7159-improved-training-of-wasserstein-gans.pdf.
253
+
254
+ 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. 5767–5777, 2017b.
255
+
256
+ Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. Gans trained by a two time-scale update rule converge to a local nash equilibrium. In Advances in Neural Information Processing Systems, pp. 6626–6637, 2017.
257
+
258
+ Irina Higgins, Loic Matthey, Arka Pal, Christopher Burgess, Xavier Glorot, Matthew Botvinick, Shakir Mohamed, and Alexander Lerchner. $\beta$ -VAE: Learning basic visual concepts with a constrained variational framework. In ICLR, 2017.
259
+
260
+ Geoffrey Hinton, Nitish Srivastava, and Kevin Swersky. Neural networks for machine learning lecture 6a overview of mini-batch gradient descent.
261
+
262
+ Jonathan Ho and Stefano Ermon. Generative adversarial imitation learning. In Advances in Neural Information Processing Systems 29, pp. 4565–4573. Curran Associates, Inc., 2016.
263
+
264
+ Daniel Holden, Taku Komura, and Jun Saito. Phase-functioned neural networks for character control. ACM Trans. Graph., 36(4):42:1–42:13, July 2017. ISSN 0730-0301. doi: 10.1145/3072959. 3073663. URL http://doi.acm.org/10.1145/3072959.3073663.
265
+
266
+ Tero Karras, Timo Aila, Samuli Laine, and Jaakko Lehtinen. Progressive growing of gans for improved quality, stability, and variation. CoRR, abs/1710.10196, 2017. URL http://arxiv. org/abs/1710.10196.
267
+
268
+ Tero Karras, Timo Aila, Samuli Laine, and Jaakko Lehtinen. Progressive growing of GANs for improved quality, stability, and variation. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id ${ . } = { }$ Hk99zCeAb.
269
+
270
+ Diederik P. Kingma and Max Welling. Auto-encoding variational bayes. CoRR, abs/1312.6114, 2013. URL http://dblp.uni-trier.de/db/journals/corr/corr1312.html# KingmaW13.
271
+
272
+ Naveen Kodali, Jacob D. Abernethy, James Hays, and Zsolt Kira. How to train your DRAGAN. CoRR, abs/1705.07215, 2017. URL http://arxiv.org/abs/1705.07215.
273
+
274
+ Alex Krizhevsky, Vinod Nair, and Geoffrey Hinton. Cifar-10 (canadian institute for advanced research). URL http://www.cs.toronto.edu/˜kriz/cifar.html.
275
+
276
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In F. Pereira, C. J. C. Burges, L. Bottou, and K. Q. Weinberger (eds.), Advances in Neural Information Processing Systems 25, pp. 1097– 1105. Curran Associates, Inc., 2012. URL http://papers.nips.cc/paper/ 4824-imagenet-classification-with-deep-convolutional-neural-networks. pdf.
277
+
278
+ Anders Boesen Lindbo Larsen, Sren Kaae Snderby, Hugo Larochelle, and Ole Winther. Autoencoding beyond pixels using a learned similarity metric. 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. 1558–1566, New York, New York, USA, 20– 22 Jun 2016. PMLR. URL http://proceedings.mlr.press/v48/larsen16.html.
279
+
280
+ Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaoou Tang. Deep learning face attributes in the wild. In Proceedings of the IEEE International Conference on Computer Vision, pp. 3730–3738, 2015.
281
+
282
+ Mario Lucic, Karol Kurach, Marcin Michalski, Sylvain Gelly, and Olivier Bousquet. Are gans created equal? a large-scale study. arXiv preprint arXiv:1711.10337, 2017.
283
+
284
+ Alireza Makhzani, Jonathon Shlens, Navdeep Jaitly, and Ian Goodfellow. Adversarial autoencoders. In International Conference on Learning Representations, 2016. URL http://arxiv.org/ abs/1511.05644.
285
+
286
+ Xudong Mao, Qing Li, Haoran Xie, Raymond Y. K. Lau, and Zhen Wang. Multi-class generative adversarial networks with the L2 loss function. CoRR, abs/1611.04076, 2016. URL http: //arxiv.org/abs/1611.04076.
287
+
288
+ 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. URL http://arxiv.org/abs/1707.02201.
289
+
290
+ Lars Mescheder, Andreas Geiger, and Sebastian Nowozin. Which training methods for GANs do actually converge? In Jennifer Dy and Andreas Krause (eds.), Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pp. 3481–3490, Stockholmsmssan, Stockholm Sweden, 10–15 Jul 2018. PMLR. URL http://proceedings.mlr.press/v80/mescheder18a.html.
291
+
292
+ Lars M. Mescheder, Sebastian Nowozin, and Andreas Geiger. Adversarial variational bayes: Unifying variational autoencoders and generative adversarial networks. CoRR, abs/1701.04722, 2017. URL http://arxiv.org/abs/1701.04722.
293
+
294
+ Takeru Miyato, Toshiki Kataoka, Masanori Koyama, and Yuichi Yoshida. Spectral normalization for generative adversarial networks. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id $=$ B1QRgziT-.
295
+
296
+ Xue Bin Peng, Pieter Abbeel, Sergey Levine, and Michiel van de Panne. Deepmimic: Exampleguided deep reinforcement learning of physics-based character skills. ACM Trans. Graph., 37 (4):143:1–143:14, July 2018. ISSN 0730-0301. doi: 10.1145/3197517.3201311. URL http: //doi.acm.org/10.1145/3197517.3201311.
297
+
298
+ Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. CoRR, abs/1511.06434, 2015. URL http:// arxiv.org/abs/1511.06434.
299
+
300
+ 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. URL http://arxiv.org/abs/1709. 10087.
301
+
302
+ Tim Salimans, Ian J. Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. CoRR, abs/1606.03498, 2016. URL http://arxiv. org/abs/1606.03498.
303
+
304
+ John Schulman, Sergey Levine, Pieter Abbeel, Michael Jordan, and Philipp Moritz. Trust region policy optimization. In International Conference on Machine Learning, 2015.
305
+
306
+ John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. CoRR, abs/1707.06347, 2017. URL http://arxiv.org/abs/ 1707.06347.
307
+
308
+ Casper Kaae Sønderby, Jose Caballero, Lucas Theis, Wenzhe Shi, and Ferenc Huszar. Amor- ´ tised MAP inference for image super-resolution. CoRR, abs/1610.04490, 2016. URL http: //arxiv.org/abs/1610.04490.
309
+
310
+ Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: A simple way to prevent neural networks from overfitting. J. Mach. Learn. Res., 15 (1):1929–1958, January 2014. ISSN 1532-4435. URL http://dl.acm.org/citation. cfm?id=2627435.2670313.
311
+
312
+ Naftali Tishby and Noga Zaslavsky. Deep learning and the information bottleneck principle. CoRR, abs/1503.02406, 2015. URL http://arxiv.org/abs/1503.02406.
313
+
314
+ Carl Vondrick, Hamed Pirsiavash, and Antonio Torralba. Generating videos with scene dynamics. CoRR, abs/1609.02612, 2016. URL http://arxiv.org/abs/1609.02612.
315
+
316
+ You Xie, Erik Franz, Mengyu Chu, and Nils Thuerey. tempogan: A temporally coherent, volumetric gan for super-resolution fluid flow. ACM Transactions on Graphics (TOG), 37(4):95, 2018.
317
+
318
+ Junbo Jake Zhao, Michael Mathieu, and Yann LeCun. Energy-based generative adversarial network.¨ CoRR, abs/1609.03126, 2016. URL http://arxiv.org/abs/1609.03126.
319
+
320
+ SUPPLEMENTARY MATERIAL
321
+
322
+ # A ANALYSIS AND PROOFS
323
+
324
+ In this appendix, we show that the gradient of the generator when the discriminator is augmented with the VDB is non-degenerate, under some mild additional assumptions. First, we assume a pointwise constraint of the form $\mathrm { K L } [ E ( \mathbf { z } | \mathbf { x } ) \| r ( \mathbf { z } ) ] \leq I _ { c }$ for all $\mathbf { x }$ . In reality, we use an average KL constraint, since we found it to be more convenient to optimize, though a pointwise constraint is also possible to enforce by using the largest constraint violation to increment $\beta$ . We could likely also extend the analysis to the average constraint, though we leave this to future work. The main theorem can then be stated as follows:
325
+
326
+ Theorem A.1. Let $g ( \mathbf { u } )$ denote the generator’s mapping from a noise vector $\mathbf { u } \sim p ( \mathbf { u } )$ to a point in $X$ . Given the generator distribution $G ( \mathbf { x } )$ and data distribution $p ^ { * } ( \mathbf { x } )$ , a VDB with an encoder $E ( \mathbf { z } | \mathbf { x } ) = \mathcal { N } ( \mu _ { E } ( \mathbf { x } ) , \Sigma )$ , and $\mathrm { K L } [ E ( \mathbf { z } | \mathbf { x } ) \| r ( \mathbf { z } ) ] \leq I _ { c } ,$ the gradient passed to the generator has the form
327
+
328
+ $$
329
+ \begin{array} { l } { \nabla _ { g } \mathbb { E } _ { { \mathbf { u } } \sim p ( { \mathbf { u } } ) } \left[ \log \left( 1 - D ^ { * } ( \mu _ { E } ( g ( { \mathbf { u } } ) ) ) \right) \right] } \\ { = \mathbb { E } _ { { \mathbf { u } } \sim p ( { \mathbf { u } } ) } \left[ a ( { \mathbf { u } } ) \int E ( \mu _ { E } ( g ( { \mathbf { u } } ) ) | { \mathbf { x } } ) \nabla _ { g } | | \mu _ { E } ( g ( { \mathbf { u } } ) ) - \mu _ { E } ( { \mathbf { x } } ) | | ^ { 2 } d p ^ { * } ( { \mathbf { x } } ) \right. } \\ { \left. - b ( { \mathbf { u } } ) \int E ( \mu _ { E } ( g ( { \mathbf { u } } ) ) | { \mathbf { x } } ) \nabla _ { g } | | \mu _ { E } ( g ( { \mathbf { u } } ) ) - \mu _ { E } ( { \mathbf { x } } ) | | ^ { 2 } d G ( { \mathbf { x } } ) \right] } \end{array}
330
+ $$
331
+
332
+ where $D ^ { * } ( \mathbf { z } )$ is the optimal discriminator, $a ( \mathbf { x } )$ and $b ( \mathbf { x } )$ are positive functions, and we always have $E ( \mu _ { E } ( g ( \mathbf { u } ) ) | \mathbf { x } ) > C ( I _ { c } )$ , where $C ( I _ { c } )$ is a continuous monotonic function, and $C ( I _ { c } ) \delta > 0$ as $I _ { c } \to 0$ .
333
+
334
+ Analysis for an encoder with an input-dependent variance $\Sigma ( \mathbf { x } )$ is also possible, but more involved. We’ll further assume below for notational simplicity that $\Sigma$ is diagonal with diagonal values $\sigma ^ { 2 }$ . This assumption is not required, but substantially simplifies the linear algebra. Analogously to Theorem 3.2 from Arjovsky & Bottou (2017), this theorem states that the gradient of the generator points in the direction of points in the data distribution, and away from points in the generator distribution. However, going beyond the theorem in Arjovsky & Bottou (2017), this result states that the coefficients on these vectors, given by $E ( \mu _ { E } ( g ( \mathbf { u } ) ) | \mathbf { x } )$ , are always bounded below by a value that approaches a positive constant $\delta$ as we decrease $I _ { c }$ , meaning that the gradient does not vanish. The proof of the first part of this theorem is essentially identical to the proof presented by Arjovsky & Bottou (2017), but accounting for the fact that the noise is now injected into the latent space of the VDB, rather than being added directly to $\mathbf { x }$ . This result assumes that $E ( { \bf z } | { \bf x } )$ has a learned but input-independent variance $\Sigma = \sigma ^ { 2 } I$ , though the proof can be repeated for an input-dependent or non-diagonal $\Sigma$ :
335
+
336
+ Proof. Overloading $p ^ { * } ( \mathbf { x } )$ and $G ( \mathbf { x } )$ , let $p ^ { * } ( \mathbf { z } )$ and $G ( \mathbf { z } )$ be the distribution of embeddings $\mathbf { z }$ under the real data and generator respectively. $p ^ { * } ( \mathbf { z } )$ is then given by
337
+
338
+ $$
339
+ p ^ { * } ( \mathbf { z } ) = \mathbb { E } _ { \mathbf { x } \sim p ^ { * } ( \mathbf { x } ) } \left[ E ( \mathbf { z } | \mathbf { x } ) \right] = \int E ( \mathbf { z } | \mathbf { x } ) d p ^ { * } ( \mathbf { x } ) ,
340
+ $$
341
+
342
+ and similarly for $G ( z )$
343
+
344
+ $$
345
+ G ( \mathbf { z } ) = \mathbb { E } _ { \mathbf { x } \sim G ( \mathbf { x } ) } \left[ E ( \mathbf { z } | \mathbf { x } ) \right] = \int E ( \mathbf { z } | \mathbf { x } ) d G ( \mathbf { x } ) ,
346
+ $$
347
+
348
+ From Arjovsky $\&$ Bottou (2017), the optimal discriminator between $p ^ { * } ( \mathbf { z } )$ and $G ( \mathbf { z } )$ is
349
+
350
+ $$
351
+ D ^ { * } ( \mathbf { z } ) = \frac { p ^ { * } ( \mathbf { z } ) } { p ^ { * } ( \mathbf { z } ) + G ( \mathbf { z } ) }
352
+ $$
353
+
354
+ The gradient passed to the generator then has the form
355
+
356
+ $$
357
+ \begin{array} { r l } & { \nabla _ { g } \mathbb { E } _ { \mathbf { u } \sim p ( \mathbf { u } ) } \left[ \log \left( 1 - D ^ { * } ( \mu _ { E } ( g ( \mathbf { u } ) ) ) \right) \right] } \\ & { \qquad = \mathbb { E } _ { \mathbf { u } \sim p ( \mathbf { u } ) } \left[ \nabla _ { g } \log \left( G ( \mu _ { E } ( g ( \mathbf { u } ) ) ) \right) - \nabla _ { g } \log \left( p ^ { * } ( \mu _ { E } ( g ( \mathbf { u } ) ) ) + G ( \mu _ { E } ( g ( \mathbf { u } ) ) ) \right) \right] } \\ & { \qquad = \mathbb { E } _ { \mathbf { u } \sim p ( \mathbf { u } ) } \left[ \frac { \nabla _ { g } G ( \mu _ { E } ( g ( \mathbf { u } ) ) ) } { G ( \mu _ { E } ( g ( \mathbf { u } ) ) ) } - \frac { \nabla _ { g } p ^ { * } ( \mu _ { E } ( g ( \mathbf { u } ) ) ) + \nabla _ { g } G ( \mu _ { E } ( g ( \mathbf { u } ) ) ) } { p ^ { * } ( \mu _ { E } ( g ( \mathbf { u } ) ) ) + G ( \mu _ { E } ( g ( \mathbf { u } ) ) ) } \right] } \\ & { \qquad = \mathbb { E } _ { \mathbf { u } \sim p ( \mathbf { u } ) } \left[ \frac { 1 } { p ^ { * } ( \mu _ { E } ( g ( \mathbf { u } ) ) ) + G ( \mu _ { E } ( g ( \mathbf { u } ) ) ) } \nabla _ { g } \left[ - p ^ { * } ( \mu _ { E } ( g ( \mathbf { u } ) ) ) \right] \right. } \\ & { \qquad \left. - \frac { 1 } { p ^ { * } ( \mu _ { E } ( g ( \mathbf { u } ) ) ) + G ( \mu _ { E } ( g ( \mathbf { u } ) ) ) } \frac { p ^ { * } ( \mu _ { E } ( g ( \mathbf { u } ) ) ) } { G ( \mu _ { E } ( g ( \mathbf { u } ) ) ) } \nabla _ { g } \left[ - G ( \mu _ { E } ( g ( \mathbf { u } ) ) ) \right] \right] . } \end{array}
358
+ $$
359
+
360
+ Let
361
+
362
+ $$
363
+ \begin{array} { l } { { \displaystyle a ( { \bf u } ) = \frac { 1 } { 2 \sigma ^ { 2 } } \frac { 1 } { p ^ { * } \left( \mu _ { E } ( g ( { \bf u } ) ) \right) + G \left( \mu _ { E } ( g ( { \bf u } ) ) \right) } \ ~ } } \\ { { \displaystyle b ( { \bf u } ) = \frac { 1 } { 2 \sigma ^ { 2 } } \frac { 1 } { p ^ { * } \left( \mu _ { E } ( g ( { \bf u } ) ) \right) + G \left( \mu _ { E } ( g ( { \bf u } ) ) \right) } \frac { p ^ { * } \left( \mu _ { E } ( g ( { \bf u } ) ) \right) } { G \left( \mu _ { E } ( g ( { \bf u } ) ) \right) } . } } \end{array}
364
+ $$
365
+
366
+ We then have
367
+
368
+ $$
369
+ \begin{array} { r l } & { \varepsilon _ { \mathrm { S P } } ^ { ( \varepsilon ) } ( \varepsilon ) \{ 2 \sigma ^ { 2 } ( \varepsilon ) ( \varepsilon ) ( \eta ) \} } \\ & { \quad - \varepsilon _ { \mathrm { S P } } ( \varepsilon ) \varepsilon _ { \mathrm { P } } ^ { ( \varepsilon ) } ( \varepsilon ) \{ 2 \sigma ^ { 2 } ( \varepsilon ) ( \eta ) \} = \int _ { - \varepsilon } ^ { \varepsilon } \gamma _ { \varepsilon } \varepsilon _ { \mathrm { P } } ( \varepsilon ) ( \varepsilon ) ( \eta ) - 2 \eta ^ { \varepsilon } \varepsilon _ { \mathrm { P } } ( \varepsilon ) ( \eta ) \int _ { - \varepsilon } ^ { \varepsilon } \varepsilon _ { \mathrm { P } } ( \varepsilon ) ( \varepsilon ) ( \eta ) \int _ { - \varepsilon } ^ { \varepsilon } \varepsilon _ { \mathrm { P } } ( \varepsilon ) ( \varepsilon ) ( \eta ) } \\ & { \quad - \varepsilon _ { \mathrm { P } } ( \varepsilon ) \varepsilon _ { \mathrm { P } } ^ { ( \varepsilon ) } ( \varepsilon ) \{ 2 \sigma ( \varepsilon ) ( \eta ) \} - \varepsilon _ { \mathrm { P } } ^ { ( \varepsilon ) } \varepsilon _ { \mathrm { P } } ( \varepsilon ) ( \eta ) \varepsilon _ { \mathrm { P } } ( \varepsilon ) ( \eta ) } \\ & { \quad - \varepsilon _ { \mathrm { P } } ( \varepsilon ) \varepsilon _ { \mathrm { P } } ^ { ( \varepsilon ) } ( \varepsilon ) \{ 2 \sigma ( \varepsilon ) ( \eta ) \} } \\ & { \quad - \varepsilon _ { \mathrm { S P } } ( \varepsilon ) \varepsilon _ { \mathrm { P } } ^ { ( \varepsilon ) } ( \varepsilon ) \{ 2 \sigma ^ { 2 } ( \varepsilon ) ( \eta ) \} \int _ { - \varepsilon } ^ { \varepsilon } \varepsilon _ { \mathrm { P } } ^ { \varepsilon } \varepsilon _ { \mathrm { P } } ^ { ( \varepsilon ) } ( \varepsilon ) \{ 2 \sigma ( \varepsilon ) ( \eta ) \} } \\ & \quad - \varepsilon _ { \mathrm { P } } ( \varepsilon ) \varepsilon _ { \mathrm { P } } ^ { ( \varepsilon ) } ( \varepsilon ) \{ 2 \sigma ^ { 2 } ( \eta ) \} + \varepsilon _ { \mathrm { P } } ^ { ( \varepsilon ) } \varepsilon _ { \mathrm { P } } ^ { ( \varepsilon ) } ( \varepsilon _ { \mathrm { P } } ^ { ( \varepsilon ) } ( \varepsilon _ { \mathrm { P } } ^ { ( \varepsilon ) } ) - \mu _ \ \end{array}
370
+ $$
371
+
372
+ Similar to the result from Arjovsky & Bottou (2017), the gradient of the generator drives the generator’s samples in the embedding space $\mu _ { E } ( g ( { \bf u } ) )$ towards embeddings of the points from the dataset $\mu _ { E } ( { \bf x } )$ weighted by their likelihood $E ( \mu _ { E } ( g ( \mathbf { u } ) ) | \mathbf { x } )$ under the real data. For an arbitrary encoder $E$ , real and fake samples in the embedding may be far apart. As such, the coefficients $E ( \mu _ { E } ( g ( \mathbf { u } ) ) | \mathbf { x } )$ can be arbitrarily small, thereby resulting in vanishing gradients for the generator.
373
+
374
+ The second part of the theorem states that $C ( I _ { c } )$ is a continuous monotonic function, and $C ( I _ { c } ) \delta > 0$ as $I _ { c } \to 0$ . This is the main result, and relies on the fact that $\mathrm { K L } [ E ( \mathbf { z } | \mathbf { x } ) | | r ( \mathbf { z } ) ] \leq I _ { c }$ . The intuition behind this result is that, for any two inputs $\mathbf { x }$ and $\mathbf { y }$ , their encoded distributions $E ( { \bf z } | { \bf x } )$ and $E ( \mathbf { z } | \mathbf { y } )$ have means that cannot be more than some distance apart, and that distance shrinks with $I _ { c }$ . This allows us to bound $E ( \mu _ { E } ( \mathbf { y } ) ) | \mathbf { x } )$ below by $C ( I _ { c } )$ , which ensures that the coefficients on the vectors in the theorem above are always at least as large as $C ( I _ { c } )$ .
375
+
376
+ Proof. Let $r ( \mathbf { z } ) = \mathcal { N } ( 0 , I )$ be the prior distribution and suppose the $\mathrm { K L }$ divergence for all $\mathbf { x }$ in the dataset and all $g ( \mathbf { u } )$ generated by the generator are bounded by $I _ { c }$
377
+
378
+ $$
379
+ \begin{array} { r l } & { \mathrm { K L } \left[ E ( \mathbf { z } | \mathbf { x } ) | | r ( \mathbf { z } ) \right] \leq I _ { c } , \quad \forall \mathbf { x } , \ \mathbf { x } \sim p ^ { * } ( \mathbf { x } ) } \\ & { \mathrm { K L } \left[ E ( \mathbf { z } | g ( \mathbf { u } ) ) | | r ( \mathbf { z } ) \right] \leq I _ { c } , \quad \forall \mathbf { u } , \ \mathbf { u } \sim p ( \mathbf { u } ) . } \end{array}
380
+ $$
381
+
382
+ From the definition of the KL-divergence we can bound the length of all embedding vectors,
383
+
384
+ $$
385
+ \begin{array} { r } { \mathrm { K L } \left[ E ( \mathbf { z } | \mathbf { x } ) | | r ( \mathbf { z } ) \right] = \displaystyle \frac { 1 } { 2 } \left( K \sigma ^ { 2 } + \mu _ { E } ( \mathbf { x } ) ^ { T } \mu _ { E } ( \mathbf { x } ) - K - K \log \sigma ^ { 2 } \right) \leq I _ { c } } \\ { | | \mu _ { E } ( \mathbf { x } ) | | ^ { 2 } \leq 2 I _ { c } - K \sigma ^ { 2 } + K + K \log \sigma ^ { 2 } , } \end{array}
386
+ $$
387
+
388
+ and similarly for $| | \mu _ { E } ( g ( \mathbf { u } ) ) | | ^ { 2 }$ , with $K$ denoting the dimension of $Z$ . A lower bound on $E ( \mu _ { E } ( g ( \mathbf { u } ) ) | \mathbf { x } )$ , where $\mathbf { u } \sim p ( \mathbf { u } )$ and $\mathbf { x } \sim p ^ { * } ( \mathbf { x } )$ , can then be determined by
389
+
390
+ $$
391
+ \begin{array} { l } { { \displaystyle { E ( \mu _ { E } ( g ( { \bf u } ) ) \vert { \bf x } ) } ) = - \frac { 1 } { 2 \sigma ^ { 2 } } \left( \mu _ { E } ( g ( { \bf u } ) ) - \mu _ { E } ( { \bf x } ) \right) ^ { T } \left( \mu _ { E } ( g ( { \bf u } ) ) - \mu _ { E } ( { \bf x } ) \right) - \frac { K } { 2 } \log \sigma ^ { 2 } - \frac { K } { 2 } \log 2 \pi } } \\ { { \displaystyle \approx \vert \vert \mu _ { E } ( { \bf x } ) \vert \vert ^ { 2 } , \vert \vert \mu _ { E } ( g ( { \bf u } ) ) \vert \vert ^ { 2 } \le 2 I _ { c } - K \sigma ^ { 2 } + K + K \log \sigma ^ { 2 } , \ ~ } } \\ { { \displaystyle \qquad \vert \vert \mu _ { E } ( g ( { \bf u } ) ) - \mu _ { E } ( { \bf x } ) \vert \vert ^ { 2 } \le 8 I _ { c } - 4 K \sigma ^ { 2 } + 4 K + 4 K \log \sigma ^ { 2 } , } } \end{array}
392
+ $$
393
+
394
+ and it follows that
395
+
396
+ $$
397
+ - \frac { 1 } { 2 \sigma ^ { 2 } } \left( \mu _ { E } ( g ( { \bf u } ) ) - \mu _ { E } ( { \bf x } ) \right) ^ { T } \left( \mu _ { E } ( g ( { \bf u } ) ) - \mu _ { E } ( { \bf x } ) \right) \ge - 4 \sigma ^ { - 2 } I _ { c } + 2 K - 2 K \sigma ^ { - 2 } - 2 K \sigma ^ { - 2 } \log \sigma ^ { - 2 } .
398
+ $$
399
+
400
+ The likelihood is therefore bounded below by
401
+
402
+ $$
403
+ \begin{array} { c } { { \displaystyle \log \left( E ( \mu _ { E } ( g ( \mathbf { u } ) ) | \mathbf { x } ) \right) \geq - 4 \sigma ^ { - 2 } I _ { c } + 2 K - 2 K \sigma ^ { - 2 } - 2 K \sigma ^ { - 2 } \log { \sigma ^ { - 2 } } - \frac { K } { 2 } \log { \sigma ^ { 2 } } - \frac { K } { 2 } \log { 2 \pi } } } \\ { { \displaystyle \mathrm { S i n c e - } \sigma ^ { - 2 } - \sigma ^ { - 2 } \log { \sigma ^ { - 2 } } \geq - 1 , \hfill } } \\ { { \displaystyle \log \left( E ( \mu _ { E } ( g ( \mathbf { u } ) ) | \mathbf { x } ) \right) \geq - 4 \sigma ^ { - 2 } I _ { c } - \frac { K } { 2 } \log { \sigma ^ { 2 } } - \frac { K } { 2 } \log { 2 \pi } } } \end{array}
404
+ $$
405
+
406
+ From the KL constraint, we can derive a lower bound $\ell ( I _ { c } )$ and an upper bound ${ \cal U } ( I _ { c } )$ on $\sigma ^ { 2 }$ .
407
+
408
+ $$
409
+ \begin{array} { l } { { { \displaystyle { \frac { 1 } { 2 } } \left( K \sigma ^ { 2 } + \mu _ { E } ( { \bf x } ) ^ { T } \mu _ { E } ( { \bf x } ) - K - K \log \sigma ^ { 2 } \right) \le I _ { c } } } } \\ { { \displaystyle { \sigma ^ { 2 } - 1 - \log \sigma ^ { 2 } \le \frac { 2 I _ { c } } { K } } } } \\ { { \displaystyle { \log \sigma ^ { 2 } \ge - \frac { 2 I _ { c } } { K } - 1 } } } \\ { { \displaystyle { \sigma ^ { 2 } \ge \exp \left( - \frac { 2 I _ { c } } { K } - 1 \right) = \ell ( I _ { c } ) } } } \end{array}
410
+ $$
411
+
412
+ For the upper bound, since $\sigma ^ { 2 } - \log \sigma ^ { 2 } > { \textstyle { \frac { 1 } { 2 } } } \sigma ^ { 2 }$ ,
413
+
414
+ $$
415
+ \begin{array} { l } { { \displaystyle { \sigma ^ { 2 } - 1 - \log \sigma ^ { 2 } \leq \frac { 2 I _ { c } } { K } } } } \\ { { \displaystyle { \frac { 1 } { 2 } \sigma ^ { 2 } - 1 < \frac { 2 I _ { c } } { K } } } } \\ { { \displaystyle { \sigma ^ { 2 } < \frac { 4 I _ { c } } { K } + 2 = \mathcal { U } ( I _ { c } ) } } } \end{array}
416
+ $$
417
+
418
+ Substituting $\ell ( I _ { c } )$ and ${ \cal U } ( I _ { c } )$ into Equation 14, we arrive at the following lower bound
419
+
420
+ $$
421
+ E ( \mu _ { E } ( g ( \mathbf { u } ) ) | \mathbf { x } ) > \exp \left( - 4 I _ { c } \exp \left( \frac { 2 I _ { c } } { K } + 1 \right) - \frac { K } { 2 } \log \left( \frac { 4 I _ { c } } { K } + 2 \right) - \frac { K } { 2 } \log 2 \pi \right) = C ( I _ { c } ) .
422
+ $$
423
+
424
+ # B GRADIENT PENALTY
425
+
426
+ To combine VDB with gradient penalty, we use the reparameterization trick to backprop through the encoder when computing the gradient of the discriminator with respect to the inputs.
427
+
428
+ $$
429
+ \begin{array} { r l } { J ( D , E ) = \underset { D , E } { \operatorname* { m i n } } } & { \mathbb { E } _ { x \sim p ^ { * } ( \mathbf { x } ) } \left[ \mathbb { E } _ { \mathbf { z } \sim E ( \mathbf { z } \mid \mathbf { x } ) } \left[ - \log \left( D ( \mathbf { z } ) \right) \right] \right] + \mathbb { E } _ { \mathbf { x } \sim G ( \mathbf { x } ) } \left[ \mathbb { E } _ { \mathbf { z } \sim E ( \mathbf { z } \mid \mathbf { x } ) } \left[ - \log \left( 1 - D ( \mathbf { z } ) \right) \right] \right] } \\ & { \quad + w _ { G P } \mathbb { E } _ { x \sim p ^ { * } ( \mathbf { x } ) } \left[ \mathbb { E } _ { \epsilon \sim \mathcal { N } ( 0 , I ) } \left[ \frac { 1 } { 2 } | | \nabla _ { x } D ( \mu _ { E } ( x ) + \Sigma _ { E } ( x ) \epsilon ) | | ^ { 2 } \right] \right] } \\ { \mathrm { s . t . } \quad } & { \mathbb { E } _ { \mathbf { x } \sim \tilde { p } ( \mathbf { x } ) } \left[ \mathrm { K L } \left[ E ( \mathbf { z } | \mathbf { x } ) | | r ( \mathbf { z } ) \right] \right] \leq I _ { c } , } \end{array}
430
+ $$
431
+
432
+ The coefficient $w _ { G P }$ weights the gradient penalty in the objective, $w _ { G P } = 1 0$ for the image generation, $w _ { G P } = 1$ for motion imitation, and $w _ { G P } = 0 . 1$ (C-maze) or $w _ { G P } = 0 . 0 1$ (S-maze) for the IRL tasks. The gradient penalty is applied only to real samples $p ^ { * } ( x )$ . We have experimented with apply the penalty to both real and fake samples, but found that performance was worse than penalizing only gradients from real samples. This is consistent with the GP implementation from Mescheder et al. (2018).
433
+
434
+ # C IMITATION LEARNING
435
+
436
+ Experimental Setup: The goal of the motion imitation tasks is to train a simulated agent to mimic a demonstration provided in the form of a mocap clip recorded from a human actor. We use a similar experimental setup as Peng et al. (2018), with a 34 degrees-of-freedom humanoid character. The state s consists of features that represent the configuration of the character’s body (link positions and velocities). We also include a phase variable $\phi \in [ 0 , 1 ]$ among the state features, which records the character’s progress along the motion and helps to synchronize the character with the reference motion. With 0 and 1 denoting the start and end of the motion respectively. The action a sampled from the policy $\pi ( \mathbf { a } | \mathbf { s } )$ specifies target poses for PD controller positioned at each joint. Given a state, the policy specifies a Gaussian distribution over the action space $\pi ( \mathbf { a } | \mathbf { s } ) = \mathcal { N } ( \mu ( \mathbf { s } ) , \Sigma )$ , with a state-dependent mean $\mu ( \mathbf { s } )$ and fixed diagonal covariance matrix $\Sigma$ . $\mu ( \mathbf { s } )$ is modeled using a 3- layered fully-connected network with 1024 and 512 hidden units, followed by a linear output layer that specifies the mean of the Gaussian. ReLU activations are used for all hidden layers. The value function is modeled with a similar architecture but with a single linear output unit. The policy is queried at $3 0 H z$ . Physics simulation is performed at $1 . 2 \mathrm { k H z }$ using the Bullet physics engine Bullet (2015).
437
+
438
+ Given the rewards from the discriminator, PPO (Schulman et al., 2017) is used to train the policy, with a stepsize of $2 . 5 \times 1 0 ^ { - 6 }$ for the policy, a stepsize of 0.01 for the value function, and a stepsize of $1 0 ^ { - 5 }$ for the discirminator. Gradient descent with momentum 0.9 is used for all models. The PPO clipping threshold is set to 0.2. When evaluating the performance of the policies, each episode is simulated for a maximum horizon of $2 0 s$ . Early termination is triggered whenever the character’s torso contacts the ground, leaving the policy is a maximum error of $\pi$ radians for all remaining timesteps.
439
+
440
+ Phase-Functioned Discriminator: Unlike the policy and value function, which are modeled with standard fully-connected networks, the discriminator is modeled by a phase-functioned neural network (PFNN) to explicitly model the time-dependency of the reference motion (Holden et al., 2017). While the parameters of a network are generally fixed, the parameters of a PFNN are functions of the phase variable $\phi$ . The parameters $\theta$ of the network for a given $\phi$ is determined by a weighted combination of a set of fixed parameters $\{ \theta _ { 0 } , \theta _ { 1 } , . . . , \theta _ { k } \}$ ,
441
+
442
+ $$
443
+ \theta = \sum _ { i = 0 } ^ { k } w _ { i } ( \phi ) \theta _ { i } ,
444
+ $$
445
+
446
+ where $w _ { i } ( \phi )$ is a phase-dependent weight for $\theta _ { i }$ . In our implementation, we use $k = 5$ sets of parameters and $w _ { i } ( \phi )$ is designed to linearly interpolate between two adjacent sets of parameters for each phase $\phi$ , where each set of parameters $\theta _ { i }$ corresponds to a discrete phase value $\phi _ { i }$ spaced
447
+
448
+ ![](images/d75d7a0543068769a72e9d9e205a9e3d3f0f65701de88a9b90fd8d4a628e0114.jpg)
449
+ Figure 10: Learning curves comparing VAIL to other methods for motion imitation. Performance is measured using the average joint rotation error between the simulated character and the reference motion. Each method is evaluated with 3 random seeds.
450
+
451
+ ![](images/5caec7daf65168a42ba692b0bb339931c433a0f09dde3fe83412da4879b5ec7a.jpg)
452
+ Figure 11: Learning curves comparing VAIL with a discriminator modeled by a phase-functioned neural network (PFNN), to modeling the discriminator with a fully-conneted network that receives the phase-variable $\phi$ as part of the input (no PFNN), and a discriminator modeled with a fullyconnected network but does not receive $\phi$ as an input (no phase).
453
+
454
+ uniformly between $[ 0 , 1 ]$ . For a given value of $\phi$ , the parameters of the discriminator are determined according to
455
+
456
+ $$
457
+ \theta = w _ { i } ( \phi ) \theta _ { i } + w _ { i + 1 } ( \phi ) \theta _ { i + 1 }
458
+ $$
459
+
460
+ where $\theta _ { i }$ and $\theta _ { i + 1 }$ correspond to the phase values $\phi _ { i } ~ \le ~ \phi ~ < ~ \phi _ { i + 1 }$ that form the endpoints of the phase interval that contains $\phi$ . A PFNN is used for all motion imitation experiments, both VAIL and GAIL, except for those that use the approach proposed by Merel et al. (2017), which use standard fully-connected networks for the discriminator. Figure 11 compares the performance of VAIL when the discriminator is modeled with a phase-functioned neural network (with PFNN) to discriminators modeled with standard fully-connected networks. We increased the size of the layers of the fully-connected nets to have a similar number of parameters as a PFNN. We evaluate the performance of fully-connected nets that receive the phase variable $\phi$ as part of the input (no PFNN), and fully-connected nets that do not receive $\phi$ as an input. The phase-functioned discriminator leads to significant performance improvements across all tasks evaluated. Policies trained without a phase variable performs worst overall, suggesting that phase information is critical for performance. All methods perform well on simpler skills, such as running, but the additional phase structure introduced by the PFNN proved to be vital for successful imitation of more complex skills, such as the dance and backflip.
461
+
462
+ Next we compare the accuracy of discriminators trained using different methods. Figure 12 illustrates accuracy of the discriminators over the course of training. Discriminators trained via GAIL quickly overpowers the policy, and learns to accurately differentiate between samples, even when instance noise is applied to the inputs. VAIL without the KL constraint slows the discriminator’s progress, but nonetheless reaches near perfect accuracy with a larger number of samples. Once the KL constraint is enforced, the information bottleneck constrains the performance of the discriminator, converging to approximately $8 0 \%$ accuracy. Figure 12 also visualizes the value of $\beta$ over the course of training for motion imitation tasks, along with the loss of the KL term in the objective. The dual gradient descent update effectively enforces the VDB constraint $I _ { c }$ .
463
+
464
+ ![](images/b6c41654bddeb136cfb4678e2198801a461d01e727e3636d2a6f1dc1cd9fd3ca.jpg)
465
+ Figure 12: Left: Accuracy of the discriminator trained using different methods for imitating the dance skill. Middle:. Value of the dual variable $\beta$ over the course of training. Right: KL loss over the course of training. The dual gradient descent update for $\beta$ effectively enforces the VDB constraint $I _ { c }$ .
466
+
467
+ Video Imitation: In the video imitation tasks, we use a simplified 2D biped character in order to avoid issues that may arise due to depth ambiguity from monocular videos. The biped character has a total of 12 degrees-of-freedom, with similar state and action parameters as the humanoid. The video demonstrations are generated by rendering a reference motion into a sequence of video frames, which are then provided to the agent as a demonstration. The goal of the agent is to imitate the motion depicted in the video, without access to the original reference motion, and the reference motion is used only to evaluate performance.
468
+
469
+ # D INVERSE REINFORCEMENT LEARNING
470
+
471
+ # D.1 EXPERIMENTAL SETUP
472
+
473
+ Environments We evaluate on two maze tasks, as illustrated in Figure 13. The C-maze is taken from Fu et al. (2017): in this maze, the agent starts at a random point within a small fixed distance of the mean start position. The agent has a continuous, 2D action space which allows it to accelerate in the $x$ or $y$ directions, and is able to observe its $x$ and $y$ position, but not its velocity. The ground truth reward is $r _ { t } = - d _ { t } - 1 0 ^ { - 3 } \| a _ { t } \| ^ { 2 }$ , where $d _ { t }$ is the agent’s distance to the goal, and $a _ { t }$ is its action (this action penalty is assumed to be zero in Figure 13). Episodes terminate after 100 steps; for evaluation, we report the undiscounted mean sum of rewards over each episode The S-maze is larger variant of the same environment with an extra wall between the agent and its goal. To make the S-maze easier to solve for the expert, we added further reward shaping to encourage the agent to pass between the gaps between walls. We also increased the maximum control forces relative to the C-maze to enable more rapid exploration. Environments will be released along with the rest of our VAIRL implementations.
474
+
475
+ Hyperparameters Policy networks for all methods were two-layer ReLU MLPs with 32 hidden units per layer. Reward and discriminator networks were similar, but with 32-unit mean and standard deviation layers inserted before the final layer for VDB methods. To generate expert demonstrations, we trained a TRPO (Schulman et al., 2015) agent on the ground truth reward for the training environment for 200 iterations, and saved 107 trajectories from each of the policies corresponding to the five final iterations. TRPO used a batch size of 10,000, a step size of 0.01, and entropy bonus with a coefficient of 0.1 to increase diversity. After generating demonstrations, we trained the IRL and imitation methods on a training maze for 200 iterations; again, our policy optimizer was TRPO with the same hyperparameters used to generate demonstrations. Between each policy update, we did 100 discriminator updates using Adam with a learning rate of $5 \times 1 0 ^ { - 5 }$ and batch size of 32. For the C-maze our VAIRL runs used a target KL of $I _ { C } = 0 . 5$ , while for the more complex S-maze we use a tighter target of $I _ { C } = 0 . 0 5$ . For the test C-maze, we trained new policies against the recovered reward using TRPO with the hyperparameters described above; for the test S-maze, we modified these parameters to use a batch size of 50,000 and learning rate of 0.001 for 400 iterations.
476
+
477
+ ![](images/12bc128902971697948715d483d597b425c86c8befea48689d912e331c19ad9a.jpg)
478
+ Figure 13: Left: The C-maze used for training and its mirror version used for testing. Colour contours show the ground truth reward function that we use to train the expert and evaluate transfer quality, while the red and green dots show the initial and goal positions, respectively. Right: The analogous diagram for the S-maze.
479
+
480
+ # D.2 RECOVERED REWARD FUNCTIONS
481
+
482
+ Figure 14 and 15 show the reward functions recovered by each IRL baseline on the C-maze and S-maze, respectively, along with sample trajectories for policies trained to optimize those rewards. Notice that VAIRL tends to recover smoother reward functions that match the ground truth reward more closely than the baselines. Addition of a gradient penalty enhances this effect for both AIRL and VAIRL. This is especially true in S-maze, where combining a gradient penalty with a variational discriminator bottleneck leads to a smooth reward that gradually increases as the agent nears its goal position at the top of the maze.
483
+
484
+ # E IMAGE GENERATION
485
+
486
+ We provide further experiment on image generation and details of the experimental setup.
487
+
488
+ # E.1 EXPERIMENTAL SETUP:
489
+
490
+ We use the non-saturating objective of Goodfellow et al. (2014) for all models except WGANGP. Following (Lucic et al., 2017), we compute FID on samples of size $1 0 0 0 0 ^ { 2 }$ . We base our implementation on (Mescheder et al., 2018), where we do not use any batch normalization for both the generator and the discriminator. We use RMSprop (Hinton et al.) and a fixed learning rate for all experiments.
491
+
492
+ For convolutional GAN, variational discriminative bottleneck is implemented as a 1x1 convolution on the final embedding space that outputs a Gaussian distribution over $Z$ parametrized with a mean and a diagonal covariance matrix. For all image experiments, we preserve the dimensionality of the latent space. All experiments use adaptive $\beta$ update with a dual stepsize of $\alpha _ { \beta } = 1 0 ^ { - 5 }$ . We will make our code public. Similarly to VGAN, instance noise Sønderby et al. (2016); Arjovsky & Bottou (2017) is added to the final embedding space of the discriminator right before applying the classifier. Instance noise can be interpreted as a non-adaptive VGAN without a information constraint.
493
+
494
+ Architecture: For CIFAR-10, we use a resnet-based architecture adapted from (Mescheder et al., 2018) detailed in Tables 2, 3, and 4. For CelebA and CelebAHQ, we use the same architecture used in (Mescheder et al., 2018).
495
+
496
+ ![](images/7d3bc0d020f3fd296b0a917213f8ec69575561699ec2437043741ab56e1b2aef.jpg)
497
+ Figure 14: Visualizations of recovered reward functions transferred to the mirrored C-maze. Also shown are trajectories executed by policies trained to maximize the corresponding reward in the new environment.
498
+
499
+ ![](images/5caf8907963ae0367361848e6ba59de05031977dd75a83acfbebdb3e3a78005c.jpg)
500
+ Figure 15: Visualizations of recovered reward functions transferred to the mirrored S-maze, like Figure 14.
501
+
502
+ Table 2: CIFAR-10 Generator
503
+
504
+ <table><tr><td rowspan=1 colspan=1>Layer</td><td rowspan=1 colspan=1>Output size</td><td rowspan=1 colspan=1>Filter</td></tr><tr><td rowspan=1 colspan=1>FCReshape</td><td rowspan=1 colspan=1>256·4·4256×4×4</td><td rowspan=1 colspan=1>256→256·4·4</td></tr><tr><td rowspan=1 colspan=1>Resnet-blockUpsample</td><td rowspan=1 colspan=1>128×4×4128×8×8</td><td rowspan=1 colspan=1>256→128</td></tr><tr><td rowspan=1 colspan=1>Resnet-blockUpsample</td><td rowspan=1 colspan=1>64×8×864 × 16 × 16</td><td rowspan=1 colspan=1>128→64</td></tr><tr><td rowspan=1 colspan=1>Resnet-blockUpsample</td><td rowspan=1 colspan=1>32 ×16×1632× 32×32</td><td rowspan=1 colspan=1>64→32</td></tr><tr><td rowspan=1 colspan=1>Resnet-blockConv2D</td><td rowspan=1 colspan=1>32×32×323× 32× 32</td><td rowspan=1 colspan=1>32→32</td></tr></table>
505
+
506
+ Table 3: CIFAR-10 Discriminator
507
+
508
+ <table><tr><td rowspan=1 colspan=1>Layer</td><td rowspan=1 colspan=1>Output size</td><td rowspan=1 colspan=1>Filter</td></tr><tr><td rowspan=1 colspan=1>Conv2D</td><td rowspan=1 colspan=1>32 × 32 × 32</td><td rowspan=1 colspan=1>3→32</td></tr><tr><td rowspan=1 colspan=1>Resnet-blockAvgPool2D</td><td rowspan=1 colspan=1>64×32×3264 ×16 ×16</td><td rowspan=1 colspan=1>32→64</td></tr><tr><td rowspan=1 colspan=1>Resnet-blockAvgPool2D</td><td rowspan=1 colspan=1>128×16×16128×8×8</td><td rowspan=1 colspan=1>64→128</td></tr><tr><td rowspan=1 colspan=1>Resnet-blockAvgPool2D</td><td rowspan=1 colspan=1>256×8×8256×4×4</td><td rowspan=1 colspan=1>128→256</td></tr><tr><td rowspan=1 colspan=1>FC</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>256·4·4→1</td></tr></table>
509
+
510
+ # E.2 RESULTS
511
+
512
+ CIFAR-10: We compare our approach with recent stabilization techniques: WGAN-GP (Gulrajani et al., 2017b), instance noise (Sønderby et al., 2016; Arjovsky & Bottou, 2017), spectral normalization (Miyato et al., 2018), and gradient penalty (Mescheder et al., 2018). We train report the networks at $7 5 0 \mathrm { k }$ iterations. We use $I _ { c } = 0 . 1$ , and a coefficient of $w _ { G P } = 1 0$ for the gradient penalty, which is the same as the value used by the implementation from Mescheder et al. (2018). See Figure 16 for visual comparisons of randomly generated samples.
513
+
514
+ CelebA: On the CelebA (Liu et al., 2015) dataset, we generate images of size $1 2 8 \times 1 2 8$ with $I _ { c } = 0 . 2$ . On this dataset we do not see a big improvement upon the other baselines. This is likely because the architecture has been effectively tuned for this task, reflected by the fact that even the vanilla GAN trains fine on this dataset. All GAN, GP, and VGAN-GP obtain a similar FID scores of 7.64, 7.76, 7.25 respectively. See Figure 17 for more qualitative results with our approach.
515
+
516
+ CelebAHQ: VGAN can also be trained on on CelebAHQ Karras et al. (2018) at 1024 by 1024 resolution directly, without progressive growing (Karras et al., 2018). We use $I _ { c } = 0 . 1$ and train with VGAN-GP. We train on a single Tesla V100, which fits a batch size of 8 in our experiments. Previous approaches (Karras et al., 2018; Mescheder et al., 2018) use a larger batch size and train over multiple GPUs. The model was trained for $3 0 0 \mathrm { k }$ iterations.
517
+
518
+ Table 4: CIFAR-10 Discriminator with VDB
519
+
520
+ <table><tr><td rowspan=1 colspan=1>Layer</td><td rowspan=1 colspan=1>Output size</td><td rowspan=1 colspan=1>Filter</td></tr><tr><td rowspan=1 colspan=1>Conv2D</td><td rowspan=1 colspan=1>32 ×32×32</td><td rowspan=1 colspan=1>3→32</td></tr><tr><td rowspan=1 colspan=1>Resnet-blockAvgPool2D</td><td rowspan=1 colspan=1>64×32×3264×16×16</td><td rowspan=1 colspan=1>32→64</td></tr><tr><td rowspan=1 colspan=1>Resnet-blockAvgPool2D</td><td rowspan=1 colspan=1>128×16×16128×8×8</td><td rowspan=1 colspan=1>64→128</td></tr><tr><td rowspan=1 colspan=1>Resnet-blockAvgPool2D</td><td rowspan=1 colspan=1>256×8×8256×4×4</td><td rowspan=1 colspan=1>128→256</td></tr><tr><td rowspan=1 colspan=1>1×1Conv2D</td><td rowspan=1 colspan=1>2:256×4×4</td><td rowspan=1 colspan=1>256→2:256</td></tr><tr><td rowspan=1 colspan=1>Sampling</td><td rowspan=1 colspan=1>256×4×4</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>FC</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>256·4·4→1</td></tr></table>
521
+
522
+ ![](images/093328ea8485a78bfbb984c256407e8d540314cb0606b17307debb5f2f4316cc.jpg)
523
+ Figure 16: Random results on CIFAR-10 (Krizhevsky et al.): GAN (Goodfellow et al., 2014) FID: 63.6, instance noise (Sønderby et al., 2016; Arjovsky & Bottou, 2017) FID: 30.7, spectral normalization (SN) (Miyato et al., 2018) FID: 23.9, gradient penalty (GP) (Mescheder et al., 2018) FID: 22.6, WGAN-GP Gulrajani et al. (2017b) FID: 19.9, and the proposed VGAN-GP FID: 18.1. The samples produced by VGAN-GP (right) look the most realistic where objects like vehicles may be discerned.
524
+
525
+ ![](images/0f4c1610d1c621991c4b65e2d319bf2da62a7f55619f72224c958e5aeb05677f.jpg)
526
+ Figure 17: Random VGAN samples on CelebA $1 2 8 \times 1 2 8$ at $3 0 0 \mathrm { k }$ iterations.
527
+
528
+ ![](images/82b55f54f72b88903dca2d47813f7ee3a93f22bbf756b31c3c5ed8a68f59a2c8.jpg)
529
+ Figure 18: VGAN samples on CelebA HQ (Karras et al., 2018) $1 0 2 4 \times 1 0 2 4$ resolution at $3 0 0 \mathrm { k }$ iterations. Models are trained from scratch at full resolution, without the progressive scheme proposed by Karras et al. (2017).
md/train/KRODJAa6pzE/KRODJAa6pzE.md ADDED
@@ -0,0 +1,325 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # A Geometric Analysis of Neural Collapse with Unconstrained Features
2
+
3
+ Zhihui Zhu∗ University of Denver zhihui.zhu@du.edu
4
+
5
+ Tianyu Ding Johns Hopkins University tding1@jhu.edu
6
+
7
+ Jinxin Zhou University of Denver jinxin.zhou@du.edu
8
+
9
+ Xiao Li University of Michigan xlxiao@umich.edu
10
+
11
+ Chong You Google Research cyou@google.com
12
+
13
+ Jeremias Sulam Johns Hopkins University jsulam1@jhu.edu
14
+
15
+ Qing Qu University of Michigan qingqu@umich.edu
16
+
17
+ # Abstract
18
+
19
+ We provide the first global optimization landscape analysis of Neural Collapse— an intriguing empirical phenomenon that arises in the last-layer classifiers and features of neural networks during the terminal phase of training. As recently reported in [1], this phenomenon implies that $( i )$ the class means and the last-layer classifiers all collapse to the vertices of a Simplex Equiangular Tight Frame (ETF) up to scaling, and $( i i )$ cross-example within-class variability of last-layer activations collapses to zero. We study the problem based on a simplified unconstrained feature model, which isolates the topmost layers from the classifier of the neural network. In this context, we show that the classical cross-entropy loss with weight decay has a benign global landscape, in the sense that the only global minimizers are the Simplex ETFs while all other critical points are strict saddles whose Hessian exhibit negative curvature directions. Our analysis of the simplified model not only explains what kind of features are learned in the last layer, but also shows why they can be efficiently optimized, matching the empirical observations in practical deep network architectures. These findings provide important practical implications. As an example, our experiments demonstrate that one may set the feature dimension equal to the number of classes and fix the last-layer classifier to be a Simplex ETF for network training, which reduces memory cost by over $20 \%$ on ResNet18 without sacrificing the generalization performance. The source code is available at https://github.com/tding1/Neural-Collapse.
20
+
21
+ # 1 Introduction
22
+
23
+ In the past decade, the revival of deep neural networks (DNN) has led to dramatic success in numerous applications ranging from computer vision, to natural language processing, to scientific discovery and beyond [2–5]. Nevertheless, the practice of deep networks has been shrouded with mystery as our theoretical understanding for the success of deep learning remains elusive. There are many intriguing phenomena, such as implicit algorithmic bias in training [6–10], and good generalization of highly-overparameterized networks [7,11–15], that seem often contradictory to, or cannot be explained by, classical optimization and learning theory.
24
+
25
+ ![](images/58d568516c938ce8b7e39a43a12ebe1ba0a322effb45155b0063448f37e756c1.jpg)
26
+ Figure 1: Illustration of Neural Collapse. Here $\phi _ { \pmb { \theta } } ( \cdot )$ denotes the feature mapping of the network, i.e. the output of the penultimate layer; see (1) for the formal definition.
27
+
28
+ ![](images/5aa337300e21642a50d1bed597247a157936f08ef2cc673f4c352f65a43b4ac1.jpg)
29
+ Figure 2: Illustration of the unconstrained feature model, where the gray box is peeled off so that the representation $^ { h }$ is modeled by a simple decision variable for every training sample.
30
+
31
+ Towards demystifying DNN, recent seminal work [1, 16] empirically discovered an intriguing phenomenon that persists across a range of canonical classification problems during the terminal phase of training. As illustrated in Figure 1, it has been widely observed that last-layer features and classifiers of a trained DNN exhibit simple but elegant mathematical structures:
32
+
33
+ • Variability Collapse: cross-example within-class variability of last-layer features collapses to zero, as the individual features of each class themselves concentrate to their isolated class-means.
34
+ • Convergence to Simplex ETF: the class-means centered at their global mean are not only linearly separable, but are actually maximally distant and located on a sphere centered at the origin up to scaling (i.e., they form a Simplex Equiangular Tight Frame (ETF) – or Simplex ETF, which is formally defined in Definition C.1 in the Appendix).
35
+ • Convergence to Self-duality: the last-layer linear classifiers, living in the dual vector space to that of the class-means, are perfectly matched with their class-means.
36
+ • Simple Decision Rule: the last-layer classifier is behaviorally equivalent to a Nearest Class-Center decision rule.
37
+
38
+ These results suggest that deep networks are learning maximally separable features between classes, and a max-margin classifier in the last layer upon these learned features, touching the ceiling in terms of the performance. This phenomenon is referred to as Neural Collapse (N C) [1], and it persists across a range of canonical classification problems, on different neural network architectures (e.g., VGG [17], ResNet [18], and DenseNet [19]) and on a variety of standard datasets (such as MNIST [20], CIFAR [21], and ImageNet [22]).
39
+
40
+ Fully demystifying the $\mathcal { N C }$ phenomenon in theory can be very challenging. Perhaps the most difficult hurdle lies in the nonconvexity of the optimization problem for training neural networks, which, loosely speaking, stems from the nonlinear interaction across many different layers of neural networks. Towards this goal, a recent line of work [23–29] studied the properties of last-layer classifiers and features based on the assumption of the so-called unconstrained feature model [23] or layer-peeled model [26]. At a high level, the unconstrained feature model takes a top-down approach to the analysis of deep neural networks [23–26, 29–31], wherein the last-layer features are modeled as free optimization variables (hence we call them unconstrained features) along with the last-layer classifiers (see Figure 2 for an illustration); this is in contrast to the conventional bottomup approach that studies the problem starting from the input [32–42].2 The underlying reasoning is that modern deep networks are often highly overparameterized with the capacity of learning any representations [43–46], so that the last-layer features can approximate, or interpolate, any point in the feature space. In this way, the model simplifies the study of last-layer features, enabling us to analyze the interaction between them and the last-layer classifiers.
41
+
42
+ Nonetheless, the simplified unconstrained feature model still leaves us a highly nonconvex training loss to be dealt with. Despite the nonconvexity, recent work [23–28] studied the global minimizers, proving that Simplex ETFs (i.e., $\mathcal { N C } )$ ) are indeed global solutions to the nonconvex loss. In particular, the work [23, 47] studied the training problem with the least-squared loss, proving that the gradient flow converges to $\mathcal { N C }$ solutions with extra assumptions. Another line of work [24–27] considered the commonly used cross-entropy loss for classification, showing that the only global minimizers of the loss function are Simplex ETFs with different constraints on the weights and features.3 However, these results still suffer from several limitations: $( i )$ due to the nonconvex nature, only characterizing optimality conditions is not enough to explain the empirical convergence of iterative algorithms to $\bar { \mathcal { N C } }$ , such as stochastic gradient descent (SGD); (ii) the problem formulations differ from those typically used in practice, which deploy norm regularization (i.e., weight decay) on the weights, rather than enforcing constraints, for the ease of optimization.4
43
+
44
+ Table 1: Comparison of the setup and results under the unconstrained feature model with cross-entropy loss.
45
+
46
+ <table><tr><td></td><td colspan="2">Regularizer</td><td>Bias term</td><td colspan="2">Results</td></tr><tr><td></td><td>Constraint</td><td>Weight decay</td><td></td><td>Global minimizer</td><td>Landscape</td></tr><tr><td>[24-27]</td><td>√</td><td></td><td></td><td>√</td><td></td></tr><tr><td>This paper</td><td></td><td>√</td><td></td><td>√</td><td></td></tr></table>
47
+
48
+ Contributions of This Work. Inspired by these pioneering results [1, 23–26, 29], in this work we take a step further by characterizing the global optimization landscape of the network training loss based on the unconstrained feature model. Our contributions are summarized as follows.
49
+
50
+ • Benign Global Landscape. For the unconstrained feature model, we provide the first result showing that a commonly used, regularized cross-entropy loss is a strict saddle function [49–51]. In other words, every critical point is either a global solution (corresponding to Simplex ETFs) or a strict saddle point5 with negative curvature, so that there is no spurious local minimizer on the optimization landscape. As summarized in Table 1, this is in contrast to previous work [23–26] that only characterizes global minimizers.
51
+ • Efficient, Algorithmic Independent, Global Optimization. The benign global landscape implies that any method that can escape strict saddle points (e.g. stochastic gradient descent) converges to a global solution [52] that exhibits $\mathcal { N C }$ . This result supports our empirical observation, as shown in Section 4.1, that practical overparameterized networks always converge to Simplex ETF solutions with a diverse choice of optimization algorithms.
52
+ • Cost Reduction for Practical Network Training. Moreover, the universality of $\mathcal { N C }$ implies that there is no need of training the last-layer classifiers since the weights can be simply fixed as a Simplex ETF throughout the training process. On the other hand, since $\mathcal { N C }$ happens whenever $d \geq K$ , this implies that we can choose the feature dimension $d$ comparable to the number of classes $K$ , reducing the feature dimension for further computational benefits. In Section 4.3, our experiments demonstrate that such a strategy achieves on par performance with classical training methods, leading to substantial cost reductions on both memory and computation.
53
+
54
+ Our results shed new light on the question raised in the recent paper [53] on the role of the optimization strategy (e.g., stochastic gradient descent) for achieving $\mathcal { N C }$ in training practical deep networks. This question also relates to the recent highly influential work [7] on the implicit algorithmic bias. For multi-class classification problems with linearly separable data, this work [7] showed that linear predictors optimized by gradient descent converge to the max-margin classifiers even without adding any explicit regularization on the cross-entropy loss. Based on this result, a sequence of works [54–61] laid great emphasis on the notion of “inductive bias” of particular optimization algorithms as a reason for the surprising success in training deep learning models.6 In contrast, both our theoretical result on the global landscape for the unconstrained feature model and the empirical evidence on practical deep models demonstrate that $\mathcal { N C }$ in network training is facilitated not only by the choice of the optimization methods, but more importantly, by the choice of loss functions and the power of overparameterization in the network architecture.
55
+
56
+ # 2 The Problem Setup
57
+
58
+ A deep neural network is essentially a nonlinear mapping $\psi ( \cdot ) : \mathbb { R } ^ { D } \mapsto \mathbb { R } ^ { K }$ , which can be modeled by a composition of simple maps: $\psi ( \pmb { x } ) = \psi ^ { L } \circ \cdot \cdot \cdot \circ \psi ^ { 2 } \circ \psi ^ { 1 } ( \pmb { x } )$ for $\textbf { \em x } \in ~ \mathbb { R } ^ { D }$ , where $\psi ^ { \ell } ( \cdot )$ $( 1 \leq \ell \leq L$ ) are called “layers”. Each layer is composed of an affine transform, represented by
59
+
60
+ some weight matrix $W _ { \ell }$ , and bias $b _ { \ell }$ , followed by a simple nonlinear7 activation function $\sigma ( \cdot )$ More precisely, a vanilla $L$ -layer neural network can be written as
61
+
62
+ $$
63
+ \psi _ { \boldsymbol \Theta } ( { \pmb x } ) ~ = ~ { \cal W } _ { L } \underbrace { \sigma \left( { \pmb W } _ { L - 1 } \cdot \cdot \cdot \sigma \left( { \pmb W } _ { 1 } { \pmb x } + b _ { 1 } \right) + b _ { L - 1 } \right) } _ { \phi _ { \boldsymbol \theta } ( { \pmb x } ) } + b _ { L } .
64
+ $$
65
+
66
+ For convenience, we use $\boldsymbol { \Theta } = \left\{ \boldsymbol { W } _ { k } , \boldsymbol { b } _ { k } \right\} _ { k = 1 } ^ { L }$ to denote all the network parameters, and use $\theta =$ $\left\{ W _ { k } , b _ { k } \right\} _ { k = 1 } ^ { L - 1 }$ to denote the network parameters up to the last layer. The output of the penultimate layer, denoted by $\phi _ { \pmb { \theta } } ( \pmb { x } )$ , is usually referred to as the representation or feature of the input $_ { \textbf { \em x } }$ learned from the network. In this way, the function implemented by a neural network classifier can also be expressed as a linear classifier acting upon $\phi _ { \pmb { \theta } } ( \bar { \pmb { x } } )$ .
67
+
68
+ The goal of deep learning is to fit the parameters $\Theta$ so that the output of the model on an input samples $_ { \textbf { \em x } }$ approximates the corresponding output $\textbf { { y } }$ , i.e. so that $\psi _ { \Theta } ( { \pmb x } ) \approx { \pmb y }$ , in expectation over a distribution of input-output pairs, $\mathcal { D }$ . This can be achieved by optimizing an appropriate loss function $\mathcal { L } ( \psi _ { \Theta } ( { \pmb x } ) , { \pmb y } )$ which quantifies this approximation. In this work, we focus on multi-class classification tasks (say, with $K$ classes), where the class label of a sample $_ { \textbf { \em x } }$ is given by a one-hot vector $\boldsymbol { y } \in \mathbb { R } ^ { K }$ representing its membership to one of the $K$ classes. In this setting, cross-entropy is one of the most popular choices for the loss function. Naturally, the distribution $\mathcal { D }$ is unknown, but we have access to training samples that are drawn i.i.d. from $\mathcal { D }$ . In this way, one can minimize the empirical risk over these samples by optimizing the following problem
69
+
70
+ $$
71
+ \operatorname* { m i n } _ { \Theta } \sum _ { k = 1 } ^ { K } \sum _ { i = 1 } ^ { n _ { k } } \mathcal { L } _ { \mathrm { C E } } \left( \psi _ { \Theta } ( x _ { k , i } ) , y _ { k } \right) + \frac { \lambda } { 2 } \left. \Theta \right. _ { F } ^ { 2 } ,
72
+ $$
73
+
74
+ where $\boldsymbol { y } _ { k } \in \mathbb { R } ^ { K }$ is a one-hot vector with only the $k$ th entry equal to unity $( 1 \leq k \leq K )$ ), $\{ n _ { k } \} _ { k = 1 } ^ { K }$ are the numbers of training samples in each class, and $\lambda > 0$ is the regularization parameter (or weight decay penalty), and $\mathcal { L } _ { \mathrm { C E } } ( \cdot , \cdot )$ is the cross-entropy loss. As introduced in Section 1, recent work [1] showed that the features learned by minimizing the above objective showcase the $\mathcal { N C }$ phenomenon: their within-class variability vanishes, and the features converge to a Simplex ETF.
75
+
76
+ # 2.1 Problem Formulation Based on Unconstrained Feature Models
77
+
78
+ In deep network models, the nonlinearity and interaction between a large number of layers results in tremendous challenges for analyzing this learning problem. Since modern networks are often highly overparameterized to approximate any continuous function and the characterization of $\mathcal { N C }$ only involves the last-layer features $\phi _ { \pmb { \theta } } ( \pmb { x } )$ , a natural idea to simplify the analysis is to treat these features as free optimization variables $\pmb { h } = \phi _ { \pmb { \theta } } ( \pmb { x } ) \in \mathbb { R } ^ { d }$ , which motivates the name unconstrained feature model8 [23] (see Figure 2 for an illustration). In this way, we can rewrite the network output as $\psi _ { \Theta } ( { \pmb x } ) = W _ { L } { \pmb h } + b _ { L }$ .
79
+
80
+ For simplicity, we consider the setting where the number of training samples in each class is balanced (i.e., $n _ { k } ~ = ~ n$ for all $k \in [ K ] : = \mathbf { \check { \{ 1 , 2 , . . . , K \} } }$ . We also write $\dot { \pmb { W } } = \pmb { W } _ { L }$ and $b = b _ { L }$ for conciseness. Based on the unconstrained feature model, we consider a slight variant of (2), given by
81
+
82
+ $$
83
+ \operatorname* { m i n } _ { W , H , b } f ( W , H , b ) : = \frac { 1 } { K n } \sum _ { k = 1 } ^ { K } \sum _ { i = 1 } ^ { n } \mathcal { L } _ { \mathrm { C E } } \left( W h _ { k , i } + b , y _ { k } \right) + \frac { \lambda _ { W } } { 2 } \left\| W \right\| _ { F } ^ { 2 } + \frac { \lambda _ { H } } { 2 } \left\| H \right\| _ { F } ^ { 2 } + \frac { \lambda _ { b } } { 2 } \left\| b \right\| _ { 2 } ^ { 2 } ,
84
+ $$
85
+
86
+ with $W \in \mathbb { R } ^ { K \times d }$ , $H = [ h _ { 1 , 1 } \cdot \cdot \cdot h _ { K , n } ] \in \mathbb { R } ^ { d \times N }$ (here, we denote $N = n K$ ), $\pmb { b } \in \mathbb { R } ^ { K }$ , and $\lambda _ { W } , \lambda _ { H } , \lambda _ { b } > 0$ are the penalty parameters for the weight decay.
87
+
88
+ As summarized in Table 1, similar optimization problems have been considered in [24–26]. In contrast to these, our problem formulation here (3), with bias and weight decay, is closer to the loss used in practice for training neural networks; existing work [24–26] considered constrained9 variants of (3) and without the bias term, which can be implemented but seldom used in practice due to the difficulty of optimization. In the following, we briefly discuss the differences between our simplification and practical settings for training neural networks.
89
+
90
+ • Weight Decay on $W$ and $\pmb { H }$ . One simplification of our formulation is in the weight decay. In practice, weight decay is usually imposed on the network parameters $\Theta$ , while we enforce weight decay on the last layer’s classifier, $W$ , and features, $\pmb { H }$ . However, this idealization is reasonable since the energy of the features (i.e., $\| \pmb { H } \| _ { F } )$ can indeed be upper bounded by the energy of the weights at every layer if the inputs are bounded (which holds in practice), implying that the norm of $\pmb { H }$ is implicitly penalized by penalizing $\Theta$ . Our experiments in the Appendix demonstrate that both approaches exhibit similar $\scriptstyle { \bar { \mathcal { N C } } }$ phenomena and comparable performance in practice.
91
+
92
+ • Treating the Last-layer Features as Optimization Variables. One may question that “peeling off” the $L - 1$ layers might oversimplify the problem. Nonetheless, this simplification (which is also adopted in [23–26]) is based on the fact that neural networks with sufficient overparameterization can approximate any function – in Section 4.2, we numerically demonstrate that $\mathcal { N C }$ persists even when we train overparametrized networks on randomly generated labels. Moreover, as we shall see in the following sections, both our theory and experiments demonstrate that our simplification preserves the core properties of last-layer classifiers and features during training – the $\mathcal { N C }$ phenomenon. More specifically, in Section 3 we show that Simplex ETFs are the only global minimizers to our simplified loss function (3), and the loss function is a strict saddle function with no other spurious local minimizers so that it can be optimized efficiently to global optimality.
93
+
94
+ # 3 Main Theoretical Results
95
+
96
+ In this section, we present our study on global optimality conditions as well as the optimization landscape of the nonconvex loss in (3).
97
+
98
+ Theorem 3.1 (Global Optimality Conditions) Assume that the feature dimension $d$ is no smaller than the number of classes $K$ , i.e. $d \geq K - 1$ , and the number of training samples in each class is balanced, $n = n _ { 1 } = \cdot \cdot \cdot = n _ { K }$ . Then any global minimizer $( W ^ { \star } , H ^ { \star } , b ^ { \star } )$ of $f$ in (3) satisfies
99
+
100
+ $$
101
+ \begin{array} { r l } & { w ^ { \star } : = \big \| w ^ { \star 1 } \big \| _ { 2 } = \big \| w ^ { \star 2 } \big \| _ { 2 } = \cdots = \big \| w ^ { \star K } \big \| _ { 2 } , \quad a n d \quad b ^ { \star } = b ^ { \star } \mathbf { 1 } , } \\ & { h _ { k , i } ^ { \star } = \sqrt { \frac { \lambda _ { W } } { \lambda _ { H } n } } w ^ { \star k } , \quad \forall \ : k \in [ K ] , \ : i \in [ n ] , \quad a n d \quad \overline { { h } } _ { i } ^ { \star } : = \frac { 1 } { K } \displaystyle \sum _ { j = 1 } ^ { K } h _ { j , i } ^ { \star } = \mathbf { 0 } , \quad \forall \ : i \in [ n ] , } \end{array}
102
+ $$
103
+
104
+ where either $b ^ { \star } = 0$ or $\lambda _ { b } = 0$ , and the matrix $W ^ { \star \top } \in \mathbb { R } ^ { d \times K }$ forms a $K$ -Simplex ETF (defined in Definition C.1) up to some scaling, in the sense that the normalized matrix $\begin{array} { r } { M : = \frac { 1 } { w ^ { \star } } W ^ { \star \top } } \end{array}$ satisfies
105
+
106
+ $$
107
+ M ^ { \top } M = \frac { K } { K - 1 } \left( { \cal I } _ { K } - \frac { 1 } { K } { \bf 1 } _ { K } { \bf 1 } _ { K } ^ { \top } \right) .
108
+ $$
109
+
110
+ At a high level, our proof (in Appendix D) finds lower bounds for the loss in (3) and studies the conditions for the lower bounds to be achieved, similar to [24, 26]. As can be seen in this result, any global solution of the loss function (3) exhibits $\mathcal { N C }$ in the sense that the variability of output features $\bar { \{ h _ { k , i } ^ { \star } \} } _ { i = 1 } ^ { n }$ of each class $k$ $( 1 \leq k \leq K )$ collapses to zero, and any pair of features $( h _ { k _ { 1 } , i } ^ { \star } , h _ { k _ { 2 } , j } ^ { \star } )$ from different classes $\boldsymbol { k } _ { 1 } \neq \boldsymbol { k } _ { 2 }$ are maximally separated. Similar results have been obtained in [24–26], which considered different problem formulations, as we have discussed in Section 2.1.
111
+
112
+ • Relationship between Class Number $K$ and Feature Dimension $d$ . The requirement that $d \geq$ $K - 1$ is necessary for Theorem 3.1 to hold, simply because $K$ vectors in $\mathbb { R } ^ { d }$ cannot form a $K$ - Simplex ETF if $K > d + 1$ . However, the relationship $d \geq K$ is often true in practice. In general, and in overparameterized models in particular, the feature dimension, $d$ , is significantly larger than the number of classes, $K$ . For example, the dimension of the features of a ResNet [18] is typically set to $d = 5 1 2$ for CIFAR10 [21], a dataset with $K = 1 0$ classes. This dimension grows to $d = 2 0 4 8$ for ImageNet [22], a dataset with $K = 1 0 0 0$ classes.
113
+
114
+ • Interpretations on the Bias Term $b ^ { \star }$ . In contrast to previous works [24–26], we consider the bias term in the unconstrained feature model (3). Our result indicates that a collapsing phenomenon also exists in the bias term $b ^ { \star }$ , in the sense that all the elements of $b ^ { \star }$ are identical. When the features $\pmb { H }$ are completely unconstrained, our result implies that removing the bias term $^ { b }$ has no influence on the performance of the classifier. However, it should be noted that the ReLU unit is often applied at the end of the penultimate layer, so that $\pmb { H }$ should be constrained to be nonnegative, ${ \pmb { H } } \geq \mathbf { 0 }$ . In such cases, $\overline { { \pmb { h } } } _ { i } ^ { \star }$ will no longer be zero, and neither will $b ^ { \star }$ . Here, the bias term $b ^ { \star }$ will compensate for the global mean of the features, so that the globally-centered features still form a Simplex ETF [1].10
115
+
116
+ # 3.1 Characterizations of the Benign Global Landscape for (3)
117
+
118
+ The global optimality condition in Theorem 3.1 does not necessarily mean that we can achieve these global solutions efficiently, as the problem is still nonconvex. We now investigate the global optimization landscape of (3) by characterizing all of its critical points. Our next result implies that the training loss is a strict saddle function, and every critical point is either a global minimizer or a strict saddle point that can be escaped using negative curvatures. As a consequence, this implies that the global solutions of the training problem in (3) can be efficiently found from random initializations.
119
+
120
+ Theorem 3.2 (No Spurious Local Minima and Strict Saddle Property) Assume that the feature dimension is larger than the number of classes, $d > K$ , and the number of training samples in each class is balanced $n = n _ { 1 } = \cdot \cdot \cdot = n _ { K }$ . Then the function $f ( W , H , b )$ in (3) is a strict saddle function with no spurious local minimum, in the sense that
121
+
122
+ • Any local minimizer of (3) is a global minimizer of the form shown in Theorem 3.1.
123
+
124
+ • Any critical point $( W , H , b )$ of (3) that is not a local minimizer is a strict saddle with negative curvature, i.e. the Hessian $\nabla ^ { 2 } f ( W , H , b )$ , at this critical point, is non-degenerate and has at least one negative eigenvalue, i.e. $\exists i : \lambda _ { i } \left( \nabla ^ { 2 } f ( W , H , b ) \right) < 0 .$ .
125
+
126
+ In a nutshell, our proof relies on connecting the original nonconvex optimization problem (3) to its corresponding low-rank convex counterpart, so that we can obtain the global optimality conditions for (3) based on the latter. With this, we can then characterize the properties of all critical points based on the optimality conditions. We defer all details of this proof to Appendix D.
127
+
128
+ Existing results [24–26] have only studied the global minimizers of the original problem, which has limited implication for optimization. In contrast, Theorem 3.2 characterizes the properties for all critical points of the function in (3). As a consequence of this result, many first-order and secondorder optimization methods [69] optimizing $( W , H , b )$ are guaranteed to converge to a global solution of (3). In particular, the result in [49, 52] ensures that (stochastic) gradient descent with random initialization, the de facto optimization algorithm used in deep learning, almost surely escapes strict saddles and converges to a second-order critical point – which happens to be a global minimizer of form showed in Theorem 3.1 for our problem (3).
129
+
130
+ • Constructing the Negative Curvature Direction for Strict Saddles. One of the major difficulties in our proof is to construct the negative curvature direction for strict saddle points. Here, we exploit the fact that the feature dimension $d$ is larger than the number of classes $K$ , and construct the negative curvature direction within the null space of $W \in \mathbb { R } ^ { K \times d }$ . This is also the main reason for the requirement $d > K$ in Theorem 3.2, but we conjecture the results also hold for $d = K$ and could be proved with more sophisticated analysis, which is left as future work.
131
+
132
+ • Relationship to Low-Rank Matrix Recovery. As discussed in Appendix A, it has been recently shown that the strict saddle property holds for a wide range of nonconvex problems in machine learning [70–83], including low-rank matrix recovery [78, 80, 84–87]. As we know that $\Vert Z \Vert _ { * } =$ $\begin{array} { r } { \operatorname* { m i n } _ { Z = W H } \left. \frac { 1 } { 2 } ( \| W \| _ { F } ^ { 2 } + \| H \| _ { F } ^ { 2 } ) \right. } \end{array}$ (see [32] for a proof), our formulation in (3) is closely related to low-rank matrix problems [78,80,84–87] with the Burer-Moneirto factorization approach [88], by viewing $W$ and $\pmb { H }$ as two factors of a matrix $Z = W H$ . The differences lie in the loss functions and statistical properties of the problem.11 Thus, our result establishes a connection between the study of low-rank matrix factorization and neural networks under the unconstrained feature model.
133
+
134
+ • Comparison to Existing Landscape Analysis on Neural Network. Section 1 provided a comprehensive discussion on the relationship between our result and previous works on landscape analysis for deep neural networks. Although the unconstrained feature model can be viewed as a two-layer linear network with input being the columns of an identity matrix, as preluded in Section 1, our result has much broader implications than the previous results [33,34,37,38,40,41,89]. First, our problem formulation (3) is closer to practical settings for classification tasks, which considers the widely adopted cross-entropy loss while including weight decay and a bias term, while most existing results [33,34,37,38,40,41,89] either do not incorporate any regularization and bias, or focus on the squared loss for the regression problem. More importantly, our result characterizes the precise form of the global solutions (i.e., N C) for the last layer features and classifiers, and shows that they can be efficiently achieved. Moreover, convincing numerical results in [1] and the next section demonstrate that the global solutions do appear and can be achieved by practical networks on various standard image datasets. Our study of last-layer features could have profound implications for studying generalization and robustness of the deep networks.
135
+
136
+ # 4 Experiments
137
+
138
+ In this section, we run extensive experiments not only verifying our theoretical results on modern neural networks, but also demonstrating the potential practical benefits of understanding $\mathcal { N C }$ . More specifically, while Theorem 3.2 holds true for the simplified unconstrained feature model, in Section 4.1 we run experiments on practical network architectures and show that our analysis of simplified models captures the gist of $\mathcal { N C }$ . In particular, we demonstrate that this depends on the geometry of the problem rather than the algorithmic bias, by showing that different types of optimization algorithms all achieve $\mathcal { N C }$ during the terminal phase of training. In Section 4.2, we verify the validity of the simplification based on the unconstrained feature model. Moreover, the universality of $\Dot { \mathcal { N } } \mathcal { C }$ implies that there is no need for training the last-layer classifiers since the weights can be simply fixed as a Simplex ETF throughout the training process. In Section 4.3, we demonstrate that such a strategy achieves essentially the same generalization performance as classical training algorithms, while improving on memory and computation. We begin by describing the basic experimental setup, including the network architectures, evaluation datasets, training procedures, and metrics for measuring $\mathcal { N C }$ .
139
+
140
+ Setup of Network Architectures, Dataset, and Training. In Section 4.1 and Section 4.2, we train a ResNet18 architecture [18] on CIFAR10 [21] for image classification using the cross-entropy loss (2). Due to limited space, we present all the results on MNIST [90] in the Appendix. As is standard, images are normalized (channel-wise) by their mean and standard deviation. We include no data augmentation in this section, as our focus is to study the behavior associated with $\mathcal { N C }$ instead of obtaining state-of-the-art performance. We train the network for 200 epochs with three distinct optimizers: two first-order methods (SGD and Adam) and one second-order method (LBFGS [69]). In particular, we use SGD with momentum 0.9, Adam with $\beta _ { 1 } = 0 . 9 , \beta _ { 2 } = 0 . 9 9 9$ , and LBFGS with a memory size of 10. The initial learning rates for SGD and Adam are set to 0.05 and 0.001, respectively, and decreased by a factor of 10 for every 40 epochs. For LBFGS, we use an initial learning rate of 0.1 and employ a strong Wolfe line-search strategy for subsequent iterations. Except otherwise specified, the weight decay is set to $5 \times 1 0 ^ { - 4 }$ for all the experiments.
141
+
142
+ Metrics for Measuring $\mathcal { N C }$ During Network Training. We measure $\mathcal { N C }$ for the learned lastlayer classifiers and features based on the properties presented in Section 1. Some of the metrics are similar to those presented in [1]. We first measure the within-class variability collapse by measuring the magnitude of the between-class covariance $\pmb { \Sigma } _ { B } \in \mathbb { R } ^ { d \times d }$ compared to the within-class covariance $\pmb { \Sigma } _ { W } \in \mathbb { R } ^ { d \times d }$ of the learned features via $\begin{array} { r } { \mathcal { N C } _ { 1 } : = \frac { 1 } { K } \operatorname { t r a c e } ( \Sigma _ { W } \Sigma _ { B } ^ { \dag } ) } \end{array}$ , where $\Sigma _ { B } ^ { \dagger }$ denotes the pseudo inverse of $\Sigma _ { B }$ . For the learned classifier $W \in \mathbb { R } ^ { K \times d }$ , we quantify its closeness to a Simplex ETF up to scaling by $\begin{array} { r } { \mathcal { N C } _ { 2 } : = \left. \frac { W W ^ { \top } } { \Vert W W ^ { \top } \Vert _ { F } } - \frac { 1 } { \sqrt { K - 1 } } \left( I _ { K } - \frac { 1 } { K } \mathbf { 1 } _ { K } \mathbf { 1 } _ { K } ^ { \top } \right) \right. _ { F } } \end{array}$ , where we rescale the ETF in (5) so that $\begin{array} { r } { \frac { 1 } { \sqrt { K - 1 } } ( \pmb { I } _ { K } - \frac { 1 } { K } \pmb { 1 } _ { K } \pmb { 1 } _ { K } ^ { \top } ) } \end{array}$ has unit energy (in Frobenius norm). It should be noted that our metric $\mathcal { N C } _ { 2 }$ combines two metrics used in [1] to quantify to what extent the classifier approaches equiangularity and maximal-angle equiangularity. We then measure the duality between the classifiers $W$ and the centered class-means $\overline { { H } }$ by $\begin{array} { r } { \mathcal { N C } _ { 3 } : = \big \| \frac { W \overline { { H } } } { \| W \overline { { H } } \| _ { F } } - \frac { 1 } { \sqrt { K - 1 } } ( I _ { K } - \frac { 1 } { K } \mathbf { 1 } _ { K } \mathbf { 1 } _ { K } ^ { \top } ) \big \| _ { F } . } \end{array}$ .
143
+
144
+ ![](images/630bf6511fd24ab12df2433e156883b20280cf2acf2c512a7f943e46ced34386.jpg)
145
+
146
+ ![](images/6a5d001916f9c8e92702ad655b9577e484f940f20979e26d06f276fbcf317998.jpg)
147
+ Figure 3: Illustration of $\mathcal { N C }$ across different training algorithms with ResNet18 on CIFAR10. From the left to the right, the plots show the four metrics, $\mathcal { N C } _ { 1 } , \mathcal { N C } _ { 2 } , \mathcal { N C } _ { 3 }$ , and $\mathcal { N C } _ { 4 }$ , respectively.
148
+ Figure 4: Training results of ResNet18 with various feature width on CIFAR10 with completely random label. From the left to the right: $\mathcal { N C } _ { 1 }$ , $\mathcal { N C } _ { 2 }$ , $\mathcal { N C } _ { 3 }$ , and the misclassification percentage of training samples.
149
+
150
+ In many cases, the global mean $_ { h _ { G } }$ of the features might not be zero,12 and the bias term $^ { b }$ would compensate for the global mean $h _ { G }$ . Thus, we capture this collapsing phenomenon by measuring $\mathcal { N C } _ { 4 } : = \| b + W h _ { G } \| _ { 2 }$ . The detailed descriptions of the four metrics are given in Appendix B.
151
+
152
+ # 4.1 The Prevalence of $\mathcal { N C }$ Across Different Optimization Algorithms
153
+
154
+ We show different types of training methods (e.g., SGD, Adam, and LBFGS) all achieve $\mathcal { N C }$ during the terminal phase of training. Figure 3 shows the evolution of the four metrics $\mathcal { N C } _ { 1 } , \mathcal { N C } _ { 2 } , \mathcal { N C } _ { 3 }$ , and $\mathcal { N C } _ { 4 }$ , for measuring $\mathcal { N } \bar { \mathcal { C } }$ as training progresses. We consistently observe that all four metrics collapse to zero, trained by different types of algorithms. This implies that $\mathcal { N C }$ occurs regardless of the choice of training methods. The last-layer features learned by the network are always maximally linearly separable, and correspondingly the last-layer classifier is a perfect linear classifier for the features. See Appendix for the testing performance of the networks learned by different algorithms.
155
+
156
+ # 4.2 The Validity of (3) Based on Unconstrained Feature Models for N C
157
+
158
+ The premise of our global landscape analysis of (3) for studying $\mathcal { N C }$ in deep neural networks is based upon the unconstrained feature model introduced in Section 2.1, which simplifies the network by synthesizing the first $L - 1$ layers as a universal approximator that generates a simple decision variable for each training sample. Here, we demonstrate through experiments that such a simplification is reasonable for overparameterized networks, in the sense that they are sufficient for characterizing $\mathcal { N C }$ in practical network training. In particular, we demonstrate that overparameterization is crucial for $\bar { \mathcal { N } } \mathcal { C }$ phenomenon during network training, while the input plays minimal influence. To that goal, we modify the training dataset CIFAR10 by replacing all the correct label for each training sample with a random counterpart.13 We report the corresponding $\mathcal { N C }$ behaviors in Figure 4, which shows how training misclassification rate and $\mathcal { N C }$ evolve over epochs of training for networks with different widths14. As the network is sufficiently large, it has enough capacity to memorize the training data and achieves zero training error, which is consistent with the observations in [11]. Moreover, we find from Figure 4 that the training accuracy is highly correlated with $\mathcal { N C }$ in the sense that a larger network (i.e., larger width) tends to exhibit severe $\mathcal { \bar { N } } \mathcal { C }$ and achieves smaller training error. In other words, while the emerging consensus is that the network can interpolate any training data, our results show that such interpolation happens in a particular way – the features are maximally separated, followed by a max-margin linear classifier. In Appendix B, we also report experiments on weight decay imposed on the features $\pmb { H }$ , as in (3).
159
+
160
+ ![](images/613c8c9c91329940b5b69f3a33df39c3a2009834008eee4b12582e2af9c26d6b.jpg)
161
+ Figure 5: Comparison of the performances of ResNet 50 with learned vs. fixed last-layer classifiers on CIFAR10. From left to right): $\mathcal { N C } _ { 1 }$ , $\mathcal { N C } _ { 3 }$ , Training Accuracy, Testing Accuracy.
162
+
163
+ # 4.3 Insights from $\mathcal { N C }$ for Improving Network Designs
164
+
165
+ Finally, we conduct exploratory experiments to demonstrate the practical benefits of $\mathcal { N C }$ phenomenon. The universality of $\mathcal { N C }$ implies that the final classifier (i.e. the $L$ -th layer) of a neural network always converges to a Simplex ETF, which is fully determined up to an arbitrary rotation and happens when $K \leq d$ . Thus, based on these understandings, we show that we can substantially improve the computational cost by modifying the architecture without the sacrificing performance, by $( i )$ fixing the last-layer classifier as a Simplex $\mathrm { E T F ^ { 1 5 } }$ , and $( i i )$ reducing the feature dimension $d = K$ . Here, to demonstrate our method can achieve state-of-the-art performance, we do include data augmentation in the training of our ResNet50 model [91] on CIFAR10, achieving around $9 5 \%$ test accuracy. See Appendix B for the results on MNIST and CIFAR10 with ResNet18.
166
+
167
+ Fixing the Last-layer Classifier as a Simplex ETF. Figure 5 presents a comparison of learned and fixed classifiers in terms of within-class variation collapse $( \mathcal { N C } _ { 1 } )$ , self-duality $( \mathcal { N C } _ { 3 } )$ , training accuracy, and test accuracy. These results imply that the fixed classifier exhibits the same withinclass variation collapse for the features $\pmb { H }$ , and achieves the same classification accuracy as the fully-trained classifier. On the other hand, fixing the classifier can reduce the number of parameters and the computational complexity for training. The number of parameters in the classifier can be significant for tasks with a large number of classes and large feature dimensions. For example, for ImageNet, a dataset with $K = 1 0 0 0$ classes, fixing the classifier can reduce $8 . 0 1 \%$ , $1 1 . 7 6 \%$ , and $5 2 . 5 6 \%$ of total learning parameters for ResNet50, DenseNet169 [19], and ShuffleNet [92], respectively. We note that our result also provides a theoretical justification for the work in [93] that fixes the classifier as orthonormal matrices. Indeed, these are close to simplex ETFs, particularly when the number of classes is large.
168
+
169
+ Feature Dimension Reduction for $\pmb { H } \in \mathbb { R } ^ { d \times n K }$ by Choosing $d = K$ .16 In many classification problems, the practice of deep learning typically uses a feature dimension $d$ that is much larger than the number of classes $K$ . In contrast, $\mathcal { N C }$ implies that there is no need to choose a $d$ that is much larger than the number of classes $K$ . Reducing the dimension $d$ can lead to substantial reductions in memory and computation cost. As shown in Figure 5, we also train all the weights of ResNet50 on CIFAR10 using SGD with $d = K$ . The results demonstrate that $\mathcal { N C }$ persists even when we choose $d = K$ , and the network achieves on-par performance with networks of large $d$ , in terms of training and test accuracy. This implies that when the number of classes $K$ is small, we can choose a small feature dimension $d = K$ (or $d \gtrsim K )$ instead of using a large universal $d$ to reduce the computation and memory costs for training. By setting $d = K$ , this reduces the amount of parameters and hence the memory cost in ResNet18 and ResNet50 by $2 0 . 7 0 \%$ and $4 . 4 5 \%$ respectively.
170
+
171
+ # 5 Conclusion
172
+
173
+ In this work, we have provided an in-depth analysis to demystify the $\mathcal { N C }$ phenomenon, which appears during the terminal phase of training deep networks in classification problems. Based on the unconstrained feature model [24–26], we proved that Simplex ETFs are the only global minimizers of the cross-entropy training loss with weight decay and bias. Moreover, we showed that the loss function is a strict saddle function with respect to the last-layer features and classifiers, with no other spurious local minimizers. In contrast to existing landscape analyses for deep neural networks, which mostly focus on the optimization perspective, our simplified analysis not only characterizes the features that are learned in the last layer, but also explains why they can be efficiently optimized. This provides support for empirical observations in practical deep network architectures. Moreover, the study of last-layer features could have profound implications for optimization, generalization, and robustness of broad interests, which are the subjects of future work. It is also of interest to extend the current study to the case where $d < K$ , which is the case in contrastive learning [94, 95] and many applications, such as recommendation systems [96] and document retrieval [97].
174
+
175
+ # Acknowledgment
176
+
177
+ ZZ acknowledges support from NSF grant CCF 2008460. XL and QQ acknowledge support from NSF grant DMS 2009752. JS acknowledges support from NSF grant CCF 2007649. We would like to thank Qinqing Zheng (Facebook AI Research), Vardan Papyan (U. Toronto), and Felix Yu (Google Research) for timely pointing us to some important references and valuable feedback on the final draft. We thank Christina Baek (UC Berkeley) and Sam Buchanan (Columbia U.) for fruitful discussions during various stages of the work. We also thank Zhexin Wu (U. Michigan) for proofreading and pointing out several typos in the draft, and the four anonymous reviewers for their constructive comments.
178
+
179
+ # References
180
+
181
+ [1] Vardan Papyan, XY Han, and David L Donoho. Prevalence of neural collapse during the terminal phase of deep learning training. Proceedings of the National Academy of Sciences, 117(40):24652–24663, 2020.
182
+ [2] Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems, pages 1097–1105, 2012.
183
+ [3] Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep learning. nature, 521(7553):436–444, 2015.
184
+ [4] Ian Goodfellow, Yoshua Bengio, Aaron Courville, and Yoshua Bengio. Deep learning, volume 1. MIT press Cambridge, 2016.
185
+ [5] Andrew W Senior, Richard Evans, John Jumper, James Kirkpatrick, Laurent Sifre, Tim Green, Chongli Qin, Augustin Zˇ ´ıdek, Alexander WR Nelson, Alex Bridgland, et al. Improved protein structure prediction using potentials from deep learning. Nature, 577(7792):706–710, 2020.
186
+ [6] Behnam Neyshabur, Ryota Tomioka, and Nathan Srebro. In search of the real inductive bias: On the role of implicit regularization in deep learning. arXiv preprint arXiv:1412.6614, 2014.
187
+ [7] Daniel Soudry, Elad Hoffer, Mor Shpigel Nacson, Suriya Gunasekar, and Nathan Srebro. The implicit bias of gradient descent on separable data. The Journal of Machine Learning Research, 19(1):2822– 2878, 2018.
188
+ [8] Sanjeev Arora, Nadav Cohen, Wei Hu, and Yuping Luo. Implicit regularization in deep matrix factorization. Advances in Neural Information Processing Systems, 32, 2019.
189
+ [9] Edward Moroshko, Blake E Woodworth, Suriya Gunasekar, Jason D Lee, Nati Srebro, and Daniel Soudry. Implicit bias in deep linear classification: Initialization scale vs training accuracy. Advances in Neural Information Processing Systems, 33, 2020.
190
+ [10] Noam Razin and Nadav Cohen. Implicit regularization in deep learning may not be explainable by norms. Advances in Neural Information Processing Systems, 33, 2020.
191
+ [11] Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. arXiv preprint arXiv:1611.03530, 2016.
192
+ [12] Mikhail Belkin, Daniel Hsu, Siyuan Ma, and Soumik Mandal. Reconciling modern machine-learning practice and the classical bias–variance trade-off. Proceedings of the National Academy of Sciences, 116(32):15849–15854, 2019.
193
+ [13] Song Mei and Andrea Montanari. The generalization error of random features regression: Precise asymptotics and double descent curve. arXiv preprint arXiv:1908.05355, 2019.
194
+ [14] Preetum Nakkiran, Gal Kaplun, Yamini Bansal, Tristan Yang, Boaz Barak, and Ilya Sutskever. Deep double descent: Where bigger models and more data hurt. arXiv preprint arXiv:1912.02292, 2019.
195
+ [15] Zitong Yang, Yaodong Yu, Chong You, Jacob Steinhardt, and Yi Ma. Rethinking bias-variance tradeoff for generalization of neural networks. In International Conference on Machine Learning, pages 10767–10777. PMLR, 2020.
196
+ [16] Vardan Papyan. Traces of class/cross-class structure pervade deep learning spectra. Journal of Machine Learning Research, 21(252):1–64, 2020.
197
+ [17] Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
198
+ [18] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770–778, 2016.
199
+ [19] Gao Huang, Zhuang Liu, Laurens Van Der Maaten, and Kilian Q Weinberger. Densely connected convolutional networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 4700–4708, 2017.
200
+ [20] Yann LeCun, Corinna Cortes, and CJ Burges. Mnist handwritten digit database. at&t labs, 2010.
201
+ [21] Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009.
202
+ [22] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pages 248–255. Ieee, 2009.
203
+ [23] Dustin G Mixon, Hans Parshall, and Jianzong Pi. Neural collapse with unconstrained features. arXiv preprint arXiv:2011.11619, 2020.
204
+ [24] Jianfeng Lu and Stefan Steinerberger. Neural collapse with cross-entropy loss. arXiv preprint arXiv:2012.08465, 2020.
205
+ [25] E Weinan and Stephan Wojtowytsch. On the emergence of tetrahedral symmetry in the final and penultimate layers of neural network classifiers. arXiv preprint arXiv:2012.05420, 2020.
206
+ [26] Cong Fang, Hangfeng He, Qi Long, and Weijie J Su. Layer-peeled model: Toward understanding welltrained deep neural networks. arXiv preprint arXiv:2101.12699, 2021.
207
+ [27] Florian Graf, Christoph Hofer, Marc Niethammer, and Roland Kwitt. Dissecting supervised constrastive learning. In International Conference on Machine Learning, pages 3821–3830. PMLR, 2021.
208
+ [28] Tolga Ergen and Mert Pilanci. Revealing the structure of deep neural networks via convex duality. In International Conference on Machine Learning, pages 3004–3014. PMLR, 2021.
209
+ [29] John Zarka, Florentin Guth, and Stephane Mallat. Separation and concentration in deep networks. ´ arXiv preprint arXiv:2012.10424, 2020.
210
+ [30] Yaodong Yu, Kwan Ho Ryan Chan, Chong You, Chaobing Song, and Yi Ma. Learning diverse and discriminative representations via the principle of maximal coding rate reduction. arXiv preprint arXiv:2006.08558, 2020.
211
+ [31] Kwan Ho Ryan Chan, Yaodong Yu, Chong You, Haozhi Qi, John Wright, and Yi Ma. Deep networks from the principle of rate reduction. arXiv preprint arXiv:2010.14765, 2020.
212
+ [32] Benjamin D Haeffele and Rene Vidal. Global optimality in tensor factorization, deep learning, and ´ beyond. arXiv preprint arXiv:1506.07540, 2015.
213
+ [33] Pierre Baldi and Kurt Hornik. Neural networks and principal component analysis: Learning from examples without local minima. Neural networks, 2(1):53–58, 1989.
214
+ [34] Kenji Kawaguchi. Deep learning without poor local minima. Advances in neural information processing systems, 29:586–594, 2016.
215
+ [35] Itay Safran and Ohad Shamir. Spurious local minima are common in two-layer relu neural networks. In International Conference on Machine Learning, pages 4433–4441. PMLR, 2018.
216
+ [36] Chulhee Yun, Suvrit Sra, and Ali Jadbabaie. Small nonlinearities in activation functions create bad local minima in neural networks. In International Conference on Learning Representations, 2018.
217
+ [37] Thomas Laurent and James Brecht. Deep linear networks with arbitrary loss: All local minima are global. In International conference on machine learning, pages 2902–2907. PMLR, 2018.
218
+ [38] Maher Nouiehed and Meisam Razaviyayn. Learning deep models: Critical points and local openness. arXiv preprint arXiv:1803.02968, 2018.
219
+ [39] Shiyu Liang, Ruoyu Sun, Jason D Lee, and R Srikant. Adding one neuron can eliminate all bad local minima. Advances in Neural Information Processing Systems, 2018:4350–4360, 2018.
220
+ [40] Zhihui Zhu, Daniel Soudry, Yonina C Eldar, and Michael B Wakin. The global optimization geometry of shallow linear neural networks. Journal of Mathematical Imaging and Vision, pages 1–14, 2019.
221
+ [41] Chulhee Yun, Suvrit Sra, and Ali Jadbabaie. Global optimality conditions for deep neural networks. In International Conference on Learning Representations, 2018.
222
+ [42] Mo Zhou, Rong Ge, and Chi Jin. A local convergence theory for mildly over-parameterized two-layer neural network. arXiv preprint arXiv:2102.02410, 2021.
223
+ [43] G Cybenko. Approximation by superposition of sigmoidal functions. Mathematics of Control, Signals and Systems, 2(4):303–314, 1989.
224
+ [44] Kurt Hornik. Approximation capabilities of multilayer feedforward networks. Neural networks, 4(2):251–257, 1991.
225
+ [45] Zhou Lu, Hongming Pu, Feicheng Wang, Zhiqiang Hu, and Liwei Wang. The expressive power of neural networks: a view from the width. In Proceedings of the 31st International Conference on Neural Information Processing Systems, pages 6232–6240, 2017.
226
+ [46] Uri Shaham, Alexander Cloninger, and Ronald R Coifman. Provable approximation properties for deep neural networks. Applied and Computational Harmonic Analysis, 44(3):537–557, 2018.
227
+ [47] XY Han, Vardan Papyan, and David L Donoho. Neural collapse under mse loss: Proximity to and dynamics on the central path. arXiv preprint arXiv:2106.02073, 2021.
228
+ [48] Wenlong Ji, Yiping Lu, Yiliang Zhang, Zhun Deng, and Weijie J Su. An unconstrained layer-peeled perspective on neural collapse. arXiv preprint arXiv:2110.02796, 2021.
229
+ [49] Rong Ge, Furong Huang, Chi Jin, and Yang Yuan. Escaping from saddle points—online stochastic gradient for tensor decomposition. In Proceedings of The 28th Conference on Learning Theory, pages 797–842, 2015.
230
+ [50] Ju Sun, Qing Qu, and John Wright. When are nonconvex problems not scary? arXiv preprint arXiv:1510.06096, 2015.
231
+ [51] Yuqian Zhang, Qing Qu, and John Wright. From symmetry to geometry: Tractable nonconvex problems. arXiv preprint arXiv:2007.06753, 2020.
232
+ [52] Jason D Lee, Max Simchowitz, Michael I Jordan, and Benjamin Recht. Gradient descent only converges to minimizers. In Conference on learning theory, pages 1246–1257. PMLR, 2016.
233
+ [53] Michael Elad, Dror Simon, and Aviad Aberdam. Another step toward demystifying deep neural networks. Proceedings of the National Academy of Sciences, 117(44):27070–27072, 2020.
234
+ [54] Suriya Gunasekar, Jason Lee, Daniel Soudry, and Nathan Srebro. Implicit bias of gradient descent on linear convolutional networks. In Advances in Neural Information Processing Systems, 2018.
235
+ [55] Gauthier Gidel, Francis Bach, and Simon Lacoste-Julien. Implicit regularization of discrete gradient dynamics in linear neural networks. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alche-Buc, ´ E. Fox, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 32, 2019.
236
+ [56] Mor Shpigel Nacson, Jason Lee, Suriya Gunasekar, Pedro Henrique Pamplona Savarese, Nathan Srebro, and Daniel Soudry. Convergence of gradient descent on separable data. In The 22nd International Conference on Artificial Intelligence and Statistics, pages 3420–3428. PMLR, 2019.
237
+ [57] Ziwei Ji, Miroslav Dud´ık, Robert E Schapire, and Matus Telgarsky. Gradient descent follows the regularization path for general losses. In Conference on Learning Theory, pages 2109–2136. PMLR, 2020.
238
+ [58] Kaifeng Lyu and Jian Li. Gradient descent maximizes the margin of homogeneous neural networks. In International Conference on Learning Representations, 2019.
239
+ [59] Ohad Shamir. Gradient methods never overfit on separable data. Journal of Machine Learning Research, 22(85):1–20, 2021.
240
+ [60] Meena Jagadeesan, Ilya Razenshteyn, and Suriya Gunasekar. Inductive bias of multi-channel linear convolutional networks with bounded weight norm. arXiv preprint arXiv:2102.12238, 2021.
241
+ [61] Chong You, Zhihui Zhu, Qing Qu, and Yi Ma. Robust recovery via implicit bias of discrepant learning rates for double over-parameterization. In H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin, editors, Advances in Neural Information Processing Systems, volume 33, pages 17733–17744. Curran Associates, Inc., 2020.
242
+ [62] John Duchi, Elad Hazan, and Yoram Singer. Adaptive subgradient methods for online learning and stochastic optimization. Journal of machine learning research, 12(7), 2011.
243
+ [63] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
244
+ [64] Mor Shpigel Nacson, Nathan Srebro, and Daniel Soudry. Stochastic gradient descent on separable data: Exact convergence with a fixed learning rate. In The 22nd International Conference on Artificial Intelligence and Statistics, pages 3051–3059. PMLR, 2019.
245
+ [65] Qian Qian and Xiaoyuan Qian. The implicit bias of adagrad on separable data. arXiv preprint arXiv:1906.03559, 2019.
246
+ [66] Suriya Gunasekar, Jason Lee, Daniel Soudry, and Nathan Srebro. Characterizing implicit bias in terms of optimization geometry. In International Conference on Machine Learning, pages 1832–1841. PMLR, 2018.
247
+ [67] Vinod Nair and Geoffrey Hinton. Rectified linear units improve restricted boltzmann machines. volume 27, pages 807–814, 2010.
248
+ [68] Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In ICML, pages 448–456, 2015.
249
+ [69] Leon Bottou, Frank E Curtis, and Jorge Nocedal. Optimization methods for large-scale machine learning. ´ Siam Review, 60(2):223–311, 2018.
250
+ [70] Qing Qu, Ju Sun, and John Wright. Finding a sparse vector in a subspace: Linear sparsity using alternating directions. In Advances in Neural Information Processing Systems, pages 3401–3409, 2014.
251
+ [71] Tuo Zhao, Zhaoran Wang, and Han Liu. A nonconvex optimization framework for low rank matrix estimation. In Advances in Neural Information Processing Systems, pages 559–567, 2015.
252
+ [72] Ju Sun, Qing Qu, and John Wright. Complete dictionary recovery over the sphere I: Overview and the geometric picture. IEEE Transactions on Information Theory, 63(2):853–884, 2016.
253
+ [73] Ju Sun, Qing Qu, and John Wright. Complete dictionary recovery over the sphere II: Recovery by Riemannian trust−region method. IEEE Transactions on Information Theory, 63(2):853–884, 2017.
254
+ [74] Qiuwei Li, Zhihui Zhu, and Gongguo Tang. The non-convex geometry of low-rank matrix optimization. Information and Inference: A Journal of the IMA, 8(1):51–96, 2018.
255
+ [75] Qing Qu, Yuqian Zhang, Yonina Eldar, and John Wright. Convolutional phase retrieval. In Advances in Neural Information Processing Systems, pages 6086–6096, 2017.
256
+ [76] Ju Sun, Qing Qu, and John Wright. A geometric analysis of phase retrieval. Foundations of Computational Mathematics, 18(5):1131–1198, 2018.
257
+ [77] Zhihui Zhu, Qiuwei Li, Gongguo Tang, and Michael B Wakin. Global optimality in low-rank matrix optimization. IEEE Transactions on Signal Processing, 66(13):3614–3628, 2018.
258
+ [78] Xingguo Li, Junwei Lu, Raman Arora, Jarvis Haupt, Han Liu, Zhaoran Wang, and Tuo Zhao. Symmetry, saddle points, and global optimization landscape of nonconvex matrix factorization. IEEE Transactions on Information Theory, 65(6):3489–3514, 2019.
259
+ [79] Zhihui Zhu, Qiuwei Li, Xinshuo Yang, Gongguo Tang, and Michael B Wakin. Distributed low-rank matrix factorization with exact consensus. In Advances in Neural Information Processing Systems, pages 8422–8432, 2019.
260
+ [80] Yuejie Chi, Yue M Lu, and Yuxin Chen. Nonconvex optimization meets low-rank matrix factorization: An overview. IEEE Transactions on Signal Processing, 67(20):5239–5269, 2019.
261
+ [81] Qing Qu, Yuexiang Zhai, Xiao Li, Yuqian Zhang, and Zhihui Zhu. Geometric analysis of nonconvex optimization landscapes for overcomplete learning. In International Conference on Learning Representations, 2020.
262
+ [82] Qing Qu, Zhihui Zhu, Xiao Li, Manolis C. Tsakiris, John Wright, and Rene Vidal. Finding the sparsest ´ vectors in a subspace: Theory, algorithms, and applications. arXiv preprint arXiv:2001.06970, 2020.
263
+ [83] Qing Qu, Xiao Li, and Zhihui Zhu. Exact recovery of multichannel sparse blind deconvolution via gradient descent. SIAM Journal on Imaging Sciences, 13(3):1630–1652, 2020.
264
+ [84] Rong Ge, Jason D Lee, and Tengyu Ma. Matrix completion has no spurious local minimum. arXiv preprint arXiv:1605.07272, 2016.
265
+ [85] Srinadh Bhojanapalli, Behnam Neyshabur, and Nathan Srebro. Global optimality of local search for low rank matrix recovery. In Proceedings of the 30th International Conference on Neural Information Processing Systems, pages 3880–3888, 2016.
266
+ [86] Rong Ge, Chi Jin, and Yi Zheng. No spurious local minima in nonconvex low rank problems: A unified geometric analysis. In International Conference on Machine Learning, pages 1233–1242. PMLR, 2017.
267
+ [87] Qiuwei Li, Zhihui Zhu, and Gongguo Tang. The non-convex geometry of low-rank matrix optimization. Information and Inference: A Journal of the IMA, 8(1):51–96, 2019.
268
+ [88] Samuel Burer and Renato DC Monteiro. A nonlinear programming algorithm for solving semidefinite programs via low-rank factorization. Mathematical Programming, 95(2):329–357, 2003.
269
+ [89] Daniel Kunin, Jonathan Bloom, Aleksandrina Goeva, and Cotton Seed. Loss landscapes of regularized linear autoencoders. In International Conference on Machine Learning, pages 3560–3569. PMLR, 2019.
270
+ [90] Yann LeCun. The mnist database of handwritten digits. http://yann. lecun. com/exdb/mnist/, 1998.
271
+ [91] kuang Liu, Wei Yang, Yang Peiwen, and Felipe Ducau. Train cifar10 with pytorch. https://github.com/kuangliu/pytorch-cifar/blob/master/models/resnet.py.
272
+ [92] Xiangyu Zhang, Xinyu Zhou, Mengxiao Lin, and Jian Sun. Shufflenet: An extremely efficient convolutional neural network for mobile devices. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 6848–6856, 2018. [93] Elad Hoffer, Itay Hubara, and Daniel Soudry. Fix your classifier: the marginal value of training the last weight layer. In International Conference on Learning Representations, 2018. [94] Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. arXiv preprint arXiv:2002.05709, 2020. [95] Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross Girshick. Momentum contrast for unsupervised visual representation learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 9729–9738, 2020. [96] Paul Covington, Jay Adams, and Emre Sargin. Deep neural networks for youtube recommendations. In Proceedings of the 10th ACM conference on recommender systems, pages 191–198, 2016. [97] Wei-Cheng Chang, X Yu Felix, Yin-Wen Chang, Yiming Yang, and Sanjiv Kumar. Pre-training tasks for embedding-based large-scale retrieval. In International Conference on Learning Representations, 2019. [98] Ruo-Yu Sun. Optimization for deep learning: An overview. Journal of the Operations Research Society of China, 8(2):249–294, 2020. [99] Ruoyu Sun, Dawei Li, Shiyu Liang, Tian Ding, and Rayadurgam Srikant. The global landscape of neural networks: An overview. IEEE Signal Processing Magazine, 37(5):95–108, 2020.
273
+ [100] Zeyuan Allen-Zhu, Yuanzhi Li, and Zhao Song. A convergence theory for deep learning via overparameterization. In International Conference on Machine Learning, pages 242–252, 2019.
274
+ [101] Simon Du, Jason Lee, Haochuan Li, Liwei Wang, and Xiyu Zhai. Gradient descent finds global minima of deep neural networks. In International Conference on Machine Learning, pages 1675–1685, 2019.
275
+ [102] Arthur Jacot, Clement Hongler, and Franck Gabriel. Neural tangent kernel: Convergence and general- ´ ization in neural networks. In NeurIPS, 2018.
276
+ [103] Difan Zou, Yuan Cao, Dongruo Zhou, and Quanquan Gu. Gradient descent optimizes overparameterized deep relu networks. Machine Learning, 109(3):467–492, 2020.
277
+ [104] Andrea Montanari and Yiqiao Zhong. The interpolation phase transition in neural networks: Memorization and generalization under lazy training. arXiv preprint arXiv:2007.12826, 2020.
278
+ [105] Sam Buchanan, Dar Gilboa, and John Wright. Deep networks and the multiple manifold problem. arXiv preprint arXiv:2008.11245, 2020.
279
+ [106] Lena ´ ¨ıc Chizat, Edouard Oyallon, and Francis Bach. On lazy training in differentiable programming. Advances in Neural Information Processing Systems, 32:2937–2947, 2019.
280
+ [107] Marina Danilova, Pavel Dvurechensky, Alexander Gasnikov, Eduard Gorbunov, Sergey Guminov, Dmitry Kamzolov, and Innokentiy Shibaev. Recent theoretical advances in non-convex optimization. arXiv preprint arXiv:2012.06188, 2020.
281
+ [108] Chi Jin, Praneeth Netrapalli, Rong Ge, Sham M. Kakade, and Michael I. Jordan. On nonconvex optimization for machine learning: Gradients, stochasticity, and saddle points. J. ACM, 68(2), February 2021.
282
+ [109] Yenson Lau, Qing Qu, Han-Wen Kuo, Pengcheng Zhou, Yuqian Zhang, and John Wright. Short and sparse deconvolution — a geometric approach. In International Conference on Learning Representations, 2020.
283
+ [110] Han-Wen Kuo, Yenson Lau, Yuqian Zhang, and John Wright. Geometry and symmetry in short-andsparse deconvolution. In International Conference on Machine Learning, pages 3570–3580. PMLR, 2019.
284
+ [111] Yuqian Zhang, Han-Wen Kuo, and John Wright. Structured local optima in sparse blind deconvolution. IEEE Transactions on Information Theory, 66(1):419–452, 2019.
285
+ [112] Raghu Bollapragada, Jorge Nocedal, Dheevatsa Mudigere, Hao-Jun Shi, and Ping Tak Peter Tang. A progressive batching l-bfgs method for machine learning. In International Conference on Machine Learning, pages 620–629. PMLR, 2018.
286
+ [113] Yi Ren and Donald Goldfarb. Kronecker-factored quasi-newton methods for convolutional neural networks. arXiv preprint arXiv:2102.06737, 2021.
287
+ [114] Roger A Horn and Charles R Johnson. Matrix analysis. Cambridge University Press, 2012.
288
+ [115] Carlo Ciliberto, Dimitris Stamos, and Massimiliano Pontil. Reexamining low rank matrix factorization for trace norm regularization. arXiv preprint arXiv:1706.08934, 2017.
289
+ [116] G Alistair Watson. Characterization of the subdifferential of some matrix norms. Linear algebra and its applications, 170:33–45, 1992.
290
+ [117] Benjamin Recht, Maryam Fazel, and Pablo A Parrilo. Guaranteed minimum-rank solutions of linear matrix equations via nuclear norm minimization. SIAM Review, 52(3):471–501, 2010.
291
+
292
+ # Checklist
293
+
294
+ 1. For all authors...
295
+
296
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
297
+ (b) Did you describe the limitations of your work? [Yes] In the abstract, introduction, main results, and conclusion, we explicitly stat that our results are about unconstrained feature model.
298
+ (c) Did you discuss any potential negative societal impacts of your work? [N/A] This paper mainly focuses on understanding the neural collapse phenomena observed in practical neural networks. Based on this understanding, we propose to fix the last layer classifier as a Simplex ETF. So no potential negative societal impact is expected of this work.
299
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
300
+
301
+ 2. If you are including theoretical results...
302
+
303
+ (a) Did you state the full set of assumptions of all theoretical results? [Yes] We explicitly mention the assumptions in Theorem 3.1 and Theorem 3.2.
304
+ (b) Did you include complete proofs of all theoretical results? [Yes] We include all the proofs in the Appendix.
305
+
306
+ 3. If you ran experiments...
307
+
308
+ (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] See Section 4 and Appendix.
309
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Section 4 and Appendix.
310
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] All the results are reported in terms of learning curves and each figure includes many plots, so error bars are not reported. Bud we do run the experiments multiple times, and observe very similar performance in terms of $\mathcal { N C }$ , testing accuracy, etc.
311
+ (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See Appendix B.
312
+
313
+ . If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
314
+
315
+ (a) If your work uses existing assets, did you cite the creators? [Yes] We cite them in Section 4.
316
+ (b) Did you mention the license of the assets? [Yes] This is mentioned in Appendix B.
317
+ (c) Did you include any new assets either in the supplemental material or as a URL? [N/A]
318
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [Yes] This is discussed in Appendix B.
319
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
320
+
321
+ 5. If you used crowdsourcing or conducted research with human subjects...
322
+
323
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
324
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
325
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
md/train/P42rXLGZQ07/P42rXLGZQ07.md ADDED
@@ -0,0 +1,422 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DIRECT EVOLUTIONARY OPTIMIZATION OF VARIATIONAL AUTOENCODERS WITH BINARY LATENTS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Discrete latent variables are considered important to model the generation process of real world data, which has motivated research on Variational Autoencoders (VAEs) with discrete latents. However, standard VAE training is not possible in this case, which has motivated different strategies to manipulate discrete distributions in order to train discrete VAEs similarly to conventional ones. Here we ask if it is also possible to keep the discrete nature of the latents fully intact by applying a direct discrete optimization for the encoding model. The studied approach is consequently strongly diverting from standard VAE training by altogether sidestepping absolute standard VAE mechanisms such as sampling approximation, reparameterization trick and amortization. Discrete optimization is realized in a variational setting using truncated posteriors in conjunction with evolutionary algorithms (using a recently suggested approach). For VAEs with binary latents, we first show how such a discrete variational method (A) ties into gradient ascent for network weights and (B) uses the decoder network to select latent states for training. More conventional amortized training is, as may be expected, more efficient than direct discrete optimization, and applicable to large neural networks. However, we here find direct optimization to be efficiently scalable to hundreds of latent variables using smaller networks. More importantly, we find the effectiveness of direct optimization to be highly competitive in ‘zero-shot’ learning (where high effectiveness for small networks is required). In contrast to large supervised neural networks, the here investigated VAEs can, e.g., denoise a single image without previous training on clean data and/or training on large image datasets. More generally, the studied approach shows that training of VAEs is indeed possible without sampling-based approximation and reparameterization, which may be interesting for the analysis of VAE-training in general. In the regime of few data, direct optimization, furthermore, makes VAEs competitive for denoising where they have previously been outperformed by non-generative approaches.
8
+
9
+ # 1 INTRODUCTION AND RELATED WORK
10
+
11
+ Variational autoencoders (Kingma & Welling, 2014; Rezende et al., 2014) are prominent and very actively researched models for unsupervised learning. VAEs, in their many different variations, have successfully been applied to a large number of tasks including semi-supervised learning (e.g. Maaløe et al., 2016), anomaly detection (e.g. An & Cho, 2015; Kiran et al., 2018), sentence interpolation (Bowman et al., 2016), music interpolation (Roberts et al., 2018) and drug response prediction (Rampasek et al., 2017). The success of VAEs rests on a series of methods that enable the derivation of scalable training algorithms to optimize their model parameters (discussed further below). A desired feature when applying VAEs to a given problem is that their latent variables (i.e., the encoder output variables) correspond to meaningful properties of the data, ideally to those latent causes that have originally generated the data. However, many real-world datasets suggest the use of discrete latents as they often describe the data generation process more naturally. For instance, the presence or absence of objects in images is best described by binary latents (e.g. Jojic & Frey, 2001). Discrete latents are also a popular choice in modeling sounds; for instance, describing piano sounds may naturally involve binary latents: keys are pressed or not (e.g. Titsias & Lazaro-Gredilla, ´ 2011; Goodfellow et al., 2013; Sheikh et al., 2014). The success of standard forms of VAEs has
12
+
13
+ consequently spurred research on novel formulations that feature discrete latents (e.g. Rolfe, 2016;
14
+ Khoshaman & Amin, 2018; Roy et al., 2018; Sadeghi et al., 2019; Vahdat et al., 2019).
15
+
16
+ The objective of VAE training is the optimization of a generative data model which parameterizes a given data distribution. Typically we seek model parameters $\Theta$ of a VAE that maximize the data log-likelihood, $\begin{array} { r } { \mathrm { L } ( \Theta ) = \sum _ { n } \log \left( p _ { \Theta } ( \vec { x } ^ { ( n ) } ) \right) } \end{array}$ , where we denote by $\vec { x } ^ { ( 1 : N ) }$ a set of $N$ observed data points, and where $p _ { \Theta } ( \vec { x } )$ denotes the modeled data distribution. Like conventional autoencoders (e.g., Bengio et al., 2007), VAEs use a deep neural network (DNN) to generate (or decode) observables $\vec { x }$ from a latent code $\vec { z }$ . Unlike conventional autoencoders, however, the generation of data $\vec { x }$ is not deterministic but it takes the form of a probabilistic generative model.
17
+
18
+ For VAEs with binary latent variables, as they will be of interest here, we consider the following VAE generative model:
19
+
20
+ $$
21
+ \begin{array} { r } { p _ { \Theta } ( \vec { z } ) = \mathrm { B e r n } ( \vec { z } ; \vec { \pi } ) = \prod _ { h } \big ( \pi _ { h } ^ { z _ { h } } ( 1 - \pi _ { h } ) ^ { ( 1 - z _ { h } ) } \big ) , \qquad p _ { \Theta } ( \vec { x } \mid \vec { z } ) = \mathcal { N } \big ( \vec { x } ; \vec { \mu } ( \vec { z } ; W ) , \sigma ^ { 2 } \mathbb { I } \big ) , } \end{array}
22
+ $$
23
+
24
+ where $\vec { z } \in \{ 0 , 1 \} ^ { H }$ is a binary code and the non-linear function $\vec { \mu } ( \vec { z } ; W )$ is a DNN that outputs the mean of the Gaussian distribution. $p _ { \Theta } ( \vec { x } \vert \vec { z } )$ is commonly referred to as decoder. The set of model parameters is $\Theta = \{ \vec { \pi } , W , \sigma ^ { 2 } \}$ , where $W$ incorporates DNN weights and biases. We assume homoscedasticity of the Gaussian distribution, but note that there is no obstacle to generalizing the model by inserting a DNN non-linearity that outputs a correlation matrix. Similarly, the algorithm could easily be generalized to different noise distributions should the task at hand call for it. For the purpose of this work, however, we will focus on as elementary as possible VAEs, with the form shown in Eqn. (1).
25
+
26
+ Given standard or binary-latent VAEs, essentially all learning algorithms seek to approximately maximize the log-likelihood using the following series of methods (we elaborate in the appendix):
27
+
28
+ (A) Instead of the log-likelihood, a variational lower-bound (a.k.a. ELBO) is optimized.
29
+ (B) VAE posteriors are approximated by an encoding model, that is a specific distribution (often Gaussian) parameterized by one or more DNNs.
30
+ (C) The variational parameters of the encoder are optimized using gradient ascent on the lower bound, where the gradient is evaluated based on sampling and reparameterization trick to obtain sufficiently low-variance and yet efficiently computable estimates.
31
+ (D) Using samples from the encoder, the parameters of the decoder are optimized using gradient ascent on the variational lower bound.
32
+
33
+ Optimization procedures for VAEs with discrete latents follow the same steps (Points A to D). However, discrete or binary latents pose substantial further obstacles in learning, mainly due to the fact that backpropagation through discrete variables is generally not possible (Rolfe, 2016; Bengio et al., 2013). In order to maintain the general VAE framework for encoder optimization, different groups have therefore suggested different possible solutions: work by Rolfe (2016), for instance, extends VAEs with discrete latents by auxiliary continuous latents such that gradients can still be computed. Work on the concrete distribution (Maddison et al., 2016) or Gumbel-softmax distribution (Jang et al., 2016) proposes newly defined continuous distributions that contain discrete distributions as limit cases. Work by Lorberbom et al. (2019) merges the Gumbel-Max reparameterization with the use of direct loss minimization for gradient estimation, enabling efficient training on structured latent spaces. Finally, work by van den Oord et al. (2017), and Roy et al. (2018) combines VAEs with a vector quantization (VQ) stage in the latent layer. Latents become discrete through quantization but gradients for learning are adapted from latent values before they are processed by the VQ stage. All methods have the goal of treating discrete distributions such that standard VAE training as developed for continuous latents can still be applied. These techniques interact during training with the standard methods (Points A-D) already in place for VAE optimization. Furthermore, they add further types of design decisions and hyper-parameters, for example parameters for annealing from softened discrete distributions to the (hard) original distributions for discrete latents.
34
+
35
+ For discrete VAEs, it may consequently be a desirable goal to investigate alternative, more direct optimization procedures that do not require a softening of discrete distributions or the use of other indirect solutions. Such a direct approach is challenging, however, because once DNNs are used to define the encoding model (Point B) standard tricks to estimate gradients (Point C) seem unavoidable. A direct optimization procedure, as is investigated here, consequently has to substantially change VAE training. For the data model (1) we will maintain the variational setting and a decoding model with DNNs as non-linearity (Points A and D). However, we will not use an encoder model parameterized by DNNs (Point B). Instead, the variational bound will be increased w.r.t. the encoder model by using a discrete optimization approach. The procedure does not require gradients to be computed for the encoder such that discrete latents are addressed without the use of reparameterization trick and sampling approximations.
36
+
37
+ # 2 TRUNCATED VARIATIONAL OPTIMIZATION
38
+
39
+ Let us consider the variational lower bound of the likelihood. If we denote by $q _ { \Phi } ^ { ( n ) } ( { \vec { z } } )$ the variational distributions with parameters $\boldsymbol { \Phi } ^ { ( n ) }$ , and by $\begin{array} { r } { \left. h ( \vec { z } ) \right. _ { q _ { \Phi } ^ { ( n ) } } = \sum _ { \vec { z } } q _ { \Phi } ^ { ( n ) } ( \vec { z } ) h ( \vec { z } ) } \end{array}$ expectation values w.r.t. to $q _ { \Phi } ^ { ( n ) } ( { \vec { z } } )$ , then the lower bound can be written as:
40
+
41
+ $$
42
+ \begin{array} { r } { \mathcal { F } ( \Phi , \Theta ) = \sum _ { n } \big \langle \log \big ( p _ { \Theta } ( \vec { x } ^ { ( n ) } \vert \vec { z } ) p _ { \Theta } ( \vec { z } ) \big ) \big \rangle _ { q _ { \Phi } ^ { ( n ) } } - \sum _ { n } \big \langle \log \big ( q _ { \Phi } ^ { ( n ) } ( \vec { z } ) \big ) \big \rangle _ { q _ { \Phi } ^ { ( n ) } } , } \end{array}
43
+ $$
44
+
45
+ The general challenge for the maximization of $\mathcal { F } ( \Phi , \Theta )$ is the optimization of the encoding model $q _ { \Phi } ^ { ( n ) }$ . VAEs with discrete latents add to this challenge the problem of taking gradients w.r.t. discrete latents. If we seek to avoid derivatives w.r.t. discrete variables, we have to define an alternative encoding model $q _ { \Phi } ^ { ( n ) }$ but such an encoding has to remain sufficiently efficient. Considering prior work on generative models with discrete latents, variational distributions based on truncated posteriors offer themselves as such an alternative (Lucke & Sahani, 2008). Truncated posterior approxima- ¨ tions have been shown to be functionally competitive (e.g. Sheikh et al., 2014; Hughes & Sudderth, 2016; Shelton et al., 2017), and they are able to efficiently train also very large scale models with hundreds or thousands of latents (e.g. Shelton et al., 2011; Sheikh & Lucke, 2016; Forster & L ¨ ucke, ¨ 2018). However, the important question for training discrete VAEs is if or how truncated variational distributions can be used in gradient-based optimization of neural network parameters. We here, for the first time, address this question noting that all previous approaches relied on closed-form (or pseudo-closed form) parameter update equations in an expectation-maximization learning paradigm.
46
+
47
+ Optimization of the Decoding Model. In order to optimize the parameters $W$ of the decoder DNN $\vec { \mu } ( \vec { z } , W )$ , the gradient of the variational bound (2) w.r.t. $W$ has to be computed. We consequently need, for any VAE, a sufficiently precise and efficient approximation of the expectation value w.r.t. the encoder $q _ { \Phi } ^ { ( n ) } ( \vec { z } )$ . Gradient estimation is of central importance for deep unsupervised learning, and approaches, e.g., for variance reduction of estimators have played an important role and are dedicated solely to this purpose (e.g., Williams, 1992). Reparameterization finally emerged as a key method because it allowed for sufficiently low-variance estimation of gradients based, e.g., on Gaussian middle-layer units (Kingma & Welling, 2014; Rezende et al., 2014).
48
+
49
+ For discrete VAEs, however, reparameterization requires the introduction of additional manipulations of discrete distributions that we here seek to fully avoid.
50
+
51
+ Instead of using reparameterization or variance reduction, we will compute gradients based on truncated posterior as variational distributions. A truncated posterior has the following form:
52
+
53
+ $$
54
+ \begin{array} { r l } { q _ { \Phi } ^ { ( n ) } ( \vec { z } ) : = } & { \frac { p _ { \Theta } ( \vec { z } | \vec { x } ^ { ( n ) } ) } { \sum _ { \vec { z } ^ { \prime } \in \Phi ^ { ( n ) } } p _ { \Theta } \left( \vec { z } ^ { \prime } | \vec { x } ^ { ( n ) } \right) } = \frac { p _ { \Theta } ( \vec { x } ^ { ( n ) } | \vec { z } ) p _ { \Theta } ( \vec { z } ) } { \sum _ { \vec { z } ^ { \prime } \in \Phi ^ { ( n ) } } p _ { \Theta } ( \vec { x } ^ { ( n ) } | \vec { z } ^ { \prime } ) p _ { \Theta } \left( \vec { z } ^ { \prime } \right) } \mathrm { i f } \vec { z } \in \Phi ^ { ( n ) } , } \end{array}
55
+ $$
56
+
57
+ where for all $\vec { z } \not \in \boldsymbol { \Phi } ^ { ( n ) }$ the probability $q _ { \Phi } ^ { ( n ) } ( \vec { z } )$ equals zero. That is, a variational distribution q(n)Φ (\~z) is proportional to the true posteriors in a subset $\boldsymbol { \Phi } ^ { ( n ) }$ , which acts as its variational parameter.
58
+
59
+ We can now compute the gradient of (2) w.r.t. the decoder weights $W$ which results in:
60
+
61
+ $$
62
+ \vec { \nabla } _ { W } \mathcal { F } ( \Phi , \Theta ) = - \frac { 1 } { 2 \sigma ^ { 2 } } \sum _ { n } \sum _ { \vec { z } \in \Phi ^ { ( n ) } } q _ { \Phi } ^ { ( n ) } ( \vec { z } ) ~ \vec { \nabla } _ { W } \| \vec { x } ^ { ( n ) } - \vec { \mu } ( \vec { z } , W ) \| ^ { 2 } .
63
+ $$
64
+
65
+ The right-hand-side has salient similarities to the standard gradient ascent for VAE decoders. Especially the familiar gradient of the mean squared error (MSE) shows that, e.g., standard automatic differentiation tools can be applied. However, the decisive difference are the weighting factors $q _ { \Phi } ^ { ( n ) } ( \vec { z } )$ . Considering (3), in order to compute the weighting factors we require all $\vec { z } \in \boldsymbol { \Phi } ^ { ( n ) }$ to be passed through the decoder DNN. As all states of Φ(n) anyway have to be passed through the decoder for the MSE term of (4), the overall computational complexity is not higher than an estimation of the gradient with samples instead of states in $\boldsymbol { \Phi } ^ { ( n ) }$ (we elaborate in Appendix A).
66
+
67
+ To complete the decoder optimization, update equations for variance $\sigma ^ { 2 }$ and prior parameters $\vec { \pi }$ can be computed in closed-form (compare, e.g., Shelton et al., 2011) and are given by:
68
+
69
+ $$
70
+ \begin{array} { r } { \sigma ^ { 2 , \mathrm { n e w } } = \frac { 1 } { D N } \displaystyle \sum _ { n } \displaystyle \sum _ { \vec { z } \in \Phi ^ { ( n ) } } q _ { \Phi } ^ { ( n ) } ( \vec { z } ) \| \vec { x } ^ { ( n ) } - \vec { \mu } ( \vec { z } , W ) \| ^ { 2 } , \qquad \vec { \pi } ^ { \mathrm { n e w } } = \frac { 1 } { N } \displaystyle \sum _ { n } \displaystyle \sum _ { \vec { z } \in \Phi ^ { ( n ) } } q _ { \Phi } ^ { ( n ) } ( \vec { z } ) \vec { z } , } \end{array}
71
+ $$
72
+
73
+ where $N$ is the number of samples in the training dataset and $D$ is the number of observables.
74
+
75
+ Optimization of the Encoding Model. After having established that the decoder can be optimized efficiently and by using standard DNN methods, the important question is if the encoder can be trained efficiently. Encoder optimization is usually based on a reformulation of the variational bound (2) given by:
76
+
77
+ $$
78
+ \begin{array} { r } { \mathcal { F } ( \Phi , \Theta ) = \sum _ { n } \big \langle \log \big ( p _ { \Theta } ( \vec { x } ^ { ( n ) } \mid \vec { z } ) \big ) \big \rangle _ { q _ { \Phi } ^ { ( n ) } } - \sum _ { n } D _ { \mathrm { K L } } \big ( q _ { \Phi } ^ { ( n ) } ( \vec { z } ) , p _ { \Theta } ( \vec { z } ) \big ) . } \end{array}
79
+ $$
80
+
81
+ Centrally for this work, truncated posteriors allow a specific alternative reformulation of the bound that enables efficient optimization. The reformulation recombines the entropy term of the original form (2) with the first expectation value into a single term, and is given by (see Lucke, 2019, for ¨ details):
82
+
83
+ $$
84
+ \mathcal { F } ( \Phi , \Theta ) = \sum _ { n } \log \big ( \sum _ { \vec { z } \in \Phi ^ { ( n ) } } p _ { \Theta } ( \vec { x } ^ { ( n ) } | \vec { z } ) p _ { \Theta } ( \vec { z } ) \big ) .
85
+ $$
86
+
87
+ Thanks to the simplified form of the bound, the variational parameters $\boldsymbol { \Phi } ^ { ( n ) }$ of the encoding model can now be sought using direct discrete optimization procedures. More concretely, because of the specific form (7), pairwise comparisons of joint probabilities are sufficient to maximize the lower bound: if we update the set $\Phi ^ { ( { \bar { n } } ) }$ for a given $\vec { x } ^ { ( n ) }$ by replacing a state $\vec { z } ^ { \mathrm { o l d } } \in \boldsymbol { \Phi } ^ { ( n ) }$ with a state $\vec { z } ^ { \mathrm { n e w } } \not \in \boldsymbol { \Phi } ^ { ( n ) }$ , then $\mathcal { F } ( \Phi , \Theta )$ increases if and only if:
88
+
89
+ $$
90
+ \log \left( p _ { \Theta } ( \vec { x } ^ { ( n ) } , \vec { z } ^ { \mathrm { n e w } } ) \right) > \log \left( p _ { \Theta } ( \vec { x } ^ { ( n ) } , \vec { z } ^ { \mathrm { o l d } } ) \right) .
91
+ $$
92
+
93
+ To obtain intuition for the pairwise comparison, consider its form when inserting the binary VAE (1) into the left- and right-hand sides. Eliding terms that do not depend on $\vec { z }$ we obtain:
94
+
95
+ $$
96
+ \begin{array} { r } { \widetilde { \log p } _ { \Theta } ( \vec { x } , \vec { z } ) = - \| \vec { x } - \vec { \mu } ( \vec { z } , W ) \| ^ { 2 } - 2 \sigma ^ { 2 } \sum _ { h } \widetilde { \pi } _ { h } z _ { h } } \end{array}
97
+ $$
98
+
99
+ where $\tilde { \pi } _ { h } = \log \left( ( 1 - \pi _ { h } ) / \pi _ { h } \right)$ . The expression assumes an even more familiar form if we restrict ourselves for a moment to sparse priors $\pi < { \frac { 1 } { 2 } }$ , i.e., $\tilde { \pi } > 0$ . Criterion (8) then becomes:
100
+
101
+ $$
102
+ \begin{array} { r } { \| \vec { x } ^ { ( n ) } - \vec { \mu } ( \vec { z } ^ { \mathrm { n e w } } , W ) \| ^ { 2 } + 2 \sigma ^ { 2 } \tilde { \pi } | \vec { z } ^ { \mathrm { n e w } } | ~ < ~ \| \vec { x } ^ { ( n ) } - \vec { \mu } ( \vec { z } ^ { \mathrm { o l d } } , W ) \| ^ { 2 } + 2 \sigma ^ { 2 } \tilde { \pi } | \vec { z } ^ { \mathrm { o l d } } | } \end{array}
103
+ $$
104
+
105
+ where $\begin{array} { r } { | \vec { z } | = \sum _ { h = 1 } ^ { H } z _ { h } } \end{array}$ . Such functions are routinely encountered in sparse coding or compressive sensing (Eldar & Kutyniok, 2012): for each set $\boldsymbol { \Phi } ^ { ( n ) }$ we seek those states $\vec { z }$ that are reconstructing $\vec { x } ^ { ( n ) }$ well while being sparse $\vec { z }$ with few non-zero bits). For VAEs, $\vec { \mu } ( \vec { z } ^ { \mathrm { n e w } } , W )$ is a DNN and as such much more flexible in matching the distribution of observables $\vec { x }$ than can be expected from linear mappings. Furthermore, criteria like (10) usually emerge for maximum a-posteriori (MAP) training in sparse coding (Olshausen & Field, 1996). In contrast, we here seek a population of states $\vec { z }$ in $\Phi ^ { ( n ) }$ for each data point. It is a consequence of the reformulated lower bound (7) that it remains optimal to evaluate joint probabilities (as for MAP) although the constructed population of states $\boldsymbol { \Phi } ^ { ( n ) }$ can capture (unlike MAP training) a rich posterior structure.
106
+
107
+ But how can new states ${ \vec { z } } ^ { \mathrm { n e w } }$ that optimize $\boldsymbol { \Phi } ^ { ( n ) }$ be found efficiently in high-dimensional latent spaces? Random search and search by sampling has recently been explored for elementary generative models (Lucke et al., 2018). Here we will follow another recent suggestion (Guiraud et al., ¨ 2018) and make use of a search based on evolutionary algorithms (EAs). In this setting we interpret sets $\boldsymbol { \Phi } ^ { ( n ) }$ as populations of binary genomes $\vec { z }$ and base the fitness function on Eqn. (9).
108
+
109
+ Concretely, using $\boldsymbol { \Phi } ^ { ( n ) }$ as initial parent pool, we apply the following genetic operators in sequence: firstly, parent selection picks $N _ { p }$ states from the parent pool. In our numerical experiments we used
110
+
111
+ A.Parent selectionB.MutationC.New population
112
+
113
+ ![](images/9ac5796e15c2abf03775e735e88196f8ed4ac0a48e8267479695a7378d10fa67.jpg)
114
+ Figure 1: The optimization process of the variational parameters $\Phi ^ { ( n ) }$ using evolutionary search. A. Some states are selected as parents. B. Each child undergoes mutation. C. Children are merged with the original population and the least fit are discarded.
115
+
116
+ fitness-proportional parent selection, for which we add an offset (constant w.r.t. $\vec { z }$ ) to the fitness values in order to make them strictly non-negative. Each of the children undergoes mutation: one or more bits are flipped to further increase offspring diversity. In our experiments we perform random uniform selection of the bits to flip. Crossover could also be employed to increase offspring diversity. We repeat the procedure using the children generated this way as the parent pool, giving birth to multiple generations of candidate states. Finally, we update $\boldsymbol { \Phi } ^ { ( n ) }$ by substituting individuals with low fitness with candidates with higher fitness. The whole procedure can be seen as an evolutionary algorithm with perfect memory or very strong elitism (individuals with higher fitness never drop out of the gene pool). Note that the improvement of the variational lower bound depends on generating as many as possible different children with high fitness over the course of training.
117
+
118
+ We point out that the EAs optimize each $\boldsymbol { \Phi } ^ { ( n ) }$ independently, so this technique can be applied to large datasets in conjunction with stochastic or batch gradient descent on the model parameters $\Theta$ : it does not require to keep the full dataset (or all sets $\boldsymbol { \Phi } ^ { ( n ) }$ ) in memory at a given time. Fig 1 shows how EAs produce new states that are used to update each set $\boldsymbol { \Phi } ^ { ( n ) }$ . The full training procedure for binary VAEs is summarized in Algorithm 1.
119
+
120
+ # Algorithm 1 Training Truncated Variational Autoencoders
121
+
122
+ Initialize model parameters $\Theta = \{ W , \vec { \pi } , \sigma ^ { 2 } \}$
123
+ Initialize each Φ(n) with $S$ distinct latent states
124
+ repeat for all batches in dataset do for sample $_ n$ in batch do $\Phi ^ { n e w } = \Phi ^ { ^ { ( n ) } }$ for all generations do Φnew mutation (crossover (selection $( \Phi ^ { n e w } ) )$ ) $\boldsymbol { \Phi } ^ { ( n ) } = \boldsymbol { \Phi } ^ { ( n ) } \cup \boldsymbol { \Phi } ^ { n e w }$ end for Truncate $\boldsymbol { \Phi } ^ { ( n ) }$ to $S$ fittest elements based on (9) end for Use Adam to update $W$ using objective (4) end for Use (5) to update $\vec { \pi }$ , $\sigma ^ { 2 }$
125
+ until parameters $\Theta$ have sufficiently converged
126
+
127
+ ![](images/2bc6269339c0e4affc63a21c98617219d8cf4f53bbc0d2971dd59f7f4f440ed2.jpg)
128
+ Figure 2: Graphical representation of the model architecture used in numerical experiments.
129
+
130
+ # 3 NUMERICAL EXPERIMENTS
131
+
132
+ Having defined the training procedure, we numerically investigated its properties. After first verifying that the procedure can recover generating parameters using ground-truth data (see Appendix B), we conducted experiments to address the following two standard questions:
133
+
134
+ (1) How efficient, i.e. how scalable, is the direct discrete optimization of binary VAEs? (2) How effective is the procedure, i.e., how well does it perform for a given VAE model?
135
+
136
+ In all numerical experiments, the training of the DNN parameters based on (4) is performed with mini-batches, the Adam optimizer (Kingma & Ba, 2014) and decaying or cyclical learning rate scheduling (Smith, 2017). Xavier/Glorot initialization (Glorot $\&$ Bengio, 2010) is used for the DNN weights, while biases are always zero-initialized. Parameters $\vec { \pi }$ and $\sigma ^ { 2 }$ are updated via Eqn. (5) and initialized to $\textstyle { \frac { 1 } { H } }$ $H$ is the size of $\vec { \pi }$ ) and 0.01 respectively. Hyper-parameter optimization was conducted manually and, for the more complex datasets, it also made use of black box Bayesian optimization based on Gaussian Processes (Nogueira, 2019). We will refer to the binary VAE trained with the method described above as Truncated Variational Autoencoder (TVAE) as the use of truncated posteriors is the main distinguishing feature.
137
+
138
+ <table><tr><td></td><td>g=15</td><td>g=25</td><td>g=50</td></tr><tr><td>MTMKL</td><td>34.29</td><td>31.88</td><td>28.08</td></tr><tr><td>GSC</td><td>32.68</td><td>31.10</td><td>28.02</td></tr><tr><td>VAR-BSC</td><td>32.25</td><td>31.15</td><td>28.62</td></tr><tr><td>TVAE</td><td>34.27 ± .02</td><td>32.65 ± .06</td><td>29.61± .02</td></tr></table>
139
+
140
+ Scalability and improvement on linear models. Let us first numerically investigate scalability properties of TVAE especially in comparison with linear models. After verifying parameter recovery for ground-truth data (see Appendix B), we used natural data in the form of image patches as an intermediately large scale and natural dataset. Concretely, we used 100,000 whitened image patches of $1 6 \times 1 6$ pixels extracted from a standard image database (van Hateren & van der Schaaf, 1998) and pre-processed as in Guiraud et al. (2018).
141
+
142
+ ![](images/a89cb8777ccb03c1af036831a57ce347819b931b4fcc37a3ff12df3f99e95270.jpg)
143
+ Table 1: Denoising performance in PSNR (dB) for the ‘house’ image under controlled conditions $\scriptstyle { \mathcal { D } } = 8 \times 8$ , $H { = } 6 4$ for all algorithms).
144
+
145
+ The simplest possible VAEs would use linear mappings for the decoder $\vec { \mu } ( \vec { z } , W )$ . For standard Gaussian latents, a linear VAE can recover probabilistic PCA solutions (e.g. Lucas et al., 2019). For Bernoulli latents, we would recover binary sparse coding (Haft et al., 2004; Shelton et al., 2011) solutions. We therefore start training (using $H = 3 0 0$ latents) with a linear VAE. After 100 epochs the weights of the linear mapping were used to initialize the bottom layer of a deeper decoder network with three layers of 300, 300 and $1 6 \times 1 6 = 2 5 6$ units. The weights of the deeper layers were simply initialized to the identity matrix. Furthermore, prior and variance were optimized. The described setup guarantees a common starting point for linear and non-linear VAEs such that the difference provided by deeper decoder DNNs can be highlighted. Fig. 3 shows the variational bounds during learning of the linear VAE compared to the non-linear VAE for a typical experiment. The non-linear VAE can be observed to quickly and significantly optimize the lower bound beyond a linear VAE. We will later (when we are not interested in comparisons to linear VAEs) simply optimize the weights of non-linear TVAE directly as we did not observed an advantage by first optimizing a linear VAE.
146
+
147
+ ![](images/be5972d41617605cdac7f1e82da43139d1803097042d0f2204b119824795367a.jpg)
148
+ Figure 3: ELBO gain of TVAE compared to linear VAE with binary latents (on $1 6 \times 1 6$ image patches).
149
+ Figure 4: TVAE denoising of house image with noise level $\sigma ~ = ~ 5 0$ . The denoised image has $\mathrm { P S N R } { = } 3 0 . 0 3$ , the best of the runs of Tab. 2.
150
+
151
+ Compared to shallow linear models, we observed a similar efficiency and scalability of TVAE. The main additional computational costs are given by passing the latent states through the a full decoder DNN instead of just through a linear mapping. The sets of states used could be kept small, at size $S = | \boldsymbol \Phi ^ { ^ { ( n ) } } | = 6 \dot { 4 }$ , such that $N \times ( | \Phi ^ { ( n ) } | + | \bar { \Phi _ { \mathrm { n e w } } ^ { ( n ) } } | )$ states had to be evaluated for each epoch. This compares to $N \times M$ states that would be used for standard VAE training (given $M$ samples are drawn per data point). Differently to standard VAE training the $\boldsymbol { \Phi } ^ { ( n ) }$ have to be remembered across iterations. For very large datasets, the additional $\mathcal { O } ( N \times | \Phi ^ { ( n ) } | \times H )$ memory demand can be distributed over compute nodes, however. To further investigate scalability, we went to up to $H { = } 1 0 0 0$ latent variables (while using 100 units in the DNN middle layer). TVAE training time remained in line with the theoretical linear scaling with $H$ while the variational bound further increased.
152
+
153
+ Effectiveness: Image Denoising. As we have observed, scaling to large latent spaces does not pose a problem for the presented approach. It is clear, however, that memory and computational cost
154
+
155
+ Table 2: Denoising performance in PSNR (dB) for the ‘house’ image for different algorithms with different optimized hyper-parameters. The top category only requires the noisy image. The middle requires additional information such as noise level (KSVD, WNNM, BM3D) or additional noisy images with matched noise level $( \mathrm { n } 2 \mathrm { v } ^ { \dag } )$ . The bottom requires large clean datasets.
156
+
157
+ <table><tr><td></td><td>g=15</td><td>g=25</td><td>g=50</td></tr><tr><td>N2v*</td><td>32.05</td><td>29.20</td><td>25.42</td></tr><tr><td>MTMKL</td><td>34.29</td><td>31.88</td><td>28.08</td></tr><tr><td>GSC</td><td>33.78</td><td>32.01</td><td>28.35</td></tr><tr><td>S5C</td><td>33.50</td><td>32.08</td><td>28.35</td></tr><tr><td>VAR-BSC</td><td>33.50</td><td>32.32</td><td>28.91</td></tr><tr><td>TVAE</td><td>34.27± .02</td><td>32.65±.06</td><td>29.98 ± .05</td></tr><tr><td>N2vt</td><td>33.91</td><td>32.10</td><td>28.94</td></tr><tr><td>KSVD</td><td>34.32</td><td>32.15</td><td>27.95</td></tr><tr><td>WNNM</td><td>35.13</td><td>33.22</td><td>30.33</td></tr><tr><td>BM3D</td><td>34.94</td><td>32.86</td><td>29.37</td></tr><tr><td>EPLL</td><td>34.17</td><td>32.17</td><td>29.12</td></tr><tr><td>BDGAN</td><td>34.57</td><td>33.28</td><td>30.61</td></tr><tr><td>DPDNN</td><td>35.40</td><td>33.54</td><td>31.04</td></tr></table>
158
+
159
+ increase with the number of data points. Above, we processed 100, 000 data points which is still feasible for the small DNNs used. However, larger DNNs increase computational load significantly because $N \times ( | \Phi ^ { ( n ) } | + | \Phi _ { \mathrm { n e w } } ^ { ( n ) } | )$ latent states have to be passed through the decoder. Furthermore, larger DNNs require more data points to not overfit which further increases computational load of our $N$ -dependent method. In many applications, there is, however, anyway relatively few data available which makes the application of large DNNs prohibitive. One example is the task of ‘zeroshot’ denoising, i.e., denoising of an image when only the image itself is available. Learning without clean data recently became very popular. The task is currently addressed using approaches based on standard feed-forward DNNs whose training objectives have been altered to allow for training on noisy images (e.g. Lehtinen et al., 2018; Krull et al., 2019). Deep generative models are, on the other hand, more naturally suited for training on noisy data as their learning objective can be used directly. Shocher et al. (2018) also argue that smaller DNNs are sufficient for the ‘zero-shot’ setting. Because of its recent popularity and suitability for approaches with smaller DNNs, we consequently focus on ‘zero-shot’ denoising. As a very significant additional benefit, the task allows for directly comparing the VAE approach to a large range of other approaches that have recently been suggested. Most notably we can compare to non-deep generative models, large feed-forward DNNs (Zhu et al., 2019; Dong et al., 2019) and DNNs dedicated to learning from noisy data (Lehtinen et al., 2018; Krull et al., 2019).
160
+
161
+ The one denoising benchmark that offers the broadest possible comparison to other methods is probably the ‘house’ image (Fig. 4 left). The standard benchmark settings for ‘house’ make use of additive Gaussian white noise with standard deviations $\sigma \in \{ 1 5 , 2 5 , 5 0 \}$ . First, consider the comparison in Tab. 1 where all models used the same patch size of $D = 8 \times 8$ pixels and $H = 6 4$ latent variables (Appendix B for details). Tab. 1 lists the different approaches in terms of the standard measure of peak signal-to-noise ratio (PSNR). Values for MTMKL (Titsias & Lazaro-Gredilla, ´ 2011), GSC (Sheikh et al., 2014) and S5C (Sheikh & Lucke, 2016) were taken from the respective ¨ original publications (which all established new state-of-the-art results when first published). As can be observed, TVAE significantly improves performance for high noise levels. TVAE is able to learn the best data representation for denoising and represents the state-of-the-art in this controlled setting (i.e., fixed $D$ and $H$ ). The decoder DNN of TVAE provides the decisive performance advantage: TVAE significantly improves performance compared to the linear Binary Sparse Coding (var-BSC, Henniges et al., 2010; Shelton et al., 2011), confirming that the high lower bounds of TVAE on natural images translate into improved performance on a concrete benchmark. For $\sigma = 2 5$ and $\sigma = 5 0$ , TVAE also significantly improves on MTMKL, GSC, and S5C. These three approaches are based on a spike-and-slab sparse coding model (also compare Goodfellow et al., 2012). Despite the less flexible Bernoulli prior, the decoder DNN of TVAE provides the highest PSNR values for high noise levels.
162
+
163
+ In order to further extend our comparison, in the last experiment we considered the denoising task without controlling for equal conditions. Concretely, we allowed for any approach that performs denoising on the benchmark including approaches that are trained on large image datasets and/or use different patch sizes (including multi-scale and whole image processing). Note that different approaches may employ very different sets of hyper-parameters that can be optimized for denoising performance: for sparse coding approaches, hyper-parameters include patch and dictionary sizes; for DNN approaches they include all network and training scheme hyper-parameters. By allowing for comparison in this less controlled setting, we can include a number of recent approaches including large DNNs trained on clean data and training schemes specifically targeted to noisy training data. Tab. 2 shows the denoising performance for the three noise levels we investigated, with results for other algorithms taken from their corresponding original publications unless specified otherwise. For WNNM and EPLL we cite values from Zhang et al. (2017). The results reported for noise2void (n2v, Krull et al., 2019) were produced specifically for this work (see Appendix B).
164
+
165
+ Note that the best performing approaches in Tab. 2 cannot be trained on noisy data: EPLL (Zoran & Weiss, 2011), BDGAN (Zhu et al., 2019) and DPDNN (Dong et al., 2019) all make use of clean training data (typically hundreds of thousands of data points or more). For denoising, EPLL also requires the ground-truth noise level of the test image. Ground-truth noise level information is also required by KSVD (Elad & Aharon, 2006) and WNNM (Gu et al., 2014). As noisy data is very frequently occurring, removing the requirement of clean data has been of considerable interest with, e.g., approaches like noise2noise (n2n, Lehtinen et al., 2018) and noise2void being very actively discussed currently. The n2n approach can achieve denoising performance on noisy training data which is almost as high as the performance of a given DNN when trained on clean data. It would thus outperform all approaches in Tab. 2 except for the bottom three. However, n2n requires different noise realizations of the very same underlying image. noise2void aims to remove this artificial assumption. Considering Tab. 2, PSNR values of TVAE were consistently higher than those of $\mathbf { n } 2 \mathbf { v }$ even if $\mathrm { n } 2 \mathrm { v }$ was trained on external data with matched-noise level $( { \bf n } 2 { \bf v } ^ { \dagger }$ in Tab. 2). Performance of TVAE is $0 . 2 \mathrm { d B }$ lower than BM3D for $\sigma = 2 5$ and $0 . 6 \mathrm { d B }$ higher for $\sigma = 5 0$ , which makes it, for large noise levels, the state-of-the-art on this benchmark in the ‘zero-shot’ setting (i.e., the setting n2n and $\mathrm { n } 2 \mathrm { v }$ aim to address).
166
+
167
+ # 4 DISCUSSION
168
+
169
+ We investigated a novel way to train VAEs with binary latents. In order to avoid derivatives w.r.t. stochastic discrete latents, we here changed the standard training setup substantially. Updates of the decoder DNN now involve a weighted sum over states (4) and the encoder DNN is replaced by a discrete evolutionary optimization. The direct optimization of the encoder replaces methods that are usually considered indispensable for the training of VAEs: sampling approximation and reparameterization trick. Furthermore, the here investigated encoding model does not use a joint mapping for all datapoints to latent space, i.e., the approach is not amortized. While amortization can be advantageous as information can be shared across datapoints, disadvantages in terms of less tight lower bounds have also been pointed out (e.g. Kim et al., 2018; Cremer et al., 2018). Related to this point, standard VAE training usually involves factored Gaussian approximations of VAE posteriors which can introduce biases (e.g., discussion by Vertes & Sahani, 2018). The investigation ´ of alternatives may therefore, more generally, shed further light on the consequences of specific approximation choices used to define VAE encoders.
170
+
171
+ The price we pay for not using amortization is efficiency: we optimize variational parameters for each data point which is, of course, more costly. However, direct optimization can scale VAEs to large latent spaces if smaller DNNs are used. When the use of large DNNs is anyway prohibitive because of limited data, the here studied approach can play out its effectiveness. For the recently popular task of ‘zero-shot’ denoising, we observed state-of-the-art results in a domain where VAEs have not been reported to be competitive before. The competitive performance is presumably due to the approach not being subject to an amortization gap as well as not being based on factored variational distributions.
172
+
173
+ Our conclusion is consequently that direct discrete optimization can serve as an alternative for training discrete VAEs. In a sense, the approach can be considered as a brute-force optimization which is slower than conventional amortized training but more effective for scales at which it can be applied. To our knowledge, the approach is also the first training method for VAEs that is not using samplingbased gradient estimates, and the first which makes VAEs competitive for ‘zero-shot’ denoising.
174
+
175
+ # REFERENCES
176
+
177
+ Jinwon An and Sungzoon Cho. Variational autoencoder based anomaly detection using reconstruction probability. Special Lecture on IE, 2(1), 2015.
178
+
179
+ Yoshua Bengio, Pascal Lamblin, Dan Popovici, and Hugo Larochelle. Greedy layer-wise training of deep networks. In Advances in neural information processing systems, pp. 153–160, 2007.
180
+
181
+ Yoshua Bengio, Nicholas Leonard, and Aaron Courville. Estimating or propagating gradients ´ through stochastic neurons for conditional computation, 2013.
182
+
183
+ Manuel Blum, Robert W Floyd, Vaughan Pratt, Ronald L Rivest, and Robert E Tarjan. Time bounds for selection. Journal of computer and system sciences, 7(4):448–461, 1973.
184
+
185
+ Samuel Bowman, Luke Vilnis, Oriol Vinyals, Andrew M Dai, Rafal Jozefowicz, and Samy Bengio. Generating sentences from a continuous space. In Proceedings of the Twentieth Conference on Computational Natural Language Learning (CoNLL)., 2016.
186
+
187
+ Harold C Burger, Christian J Schuler, and Stefan Harmeling. Image denoising: Can plain neural networks compete with bm3d? In 2012 IEEE conference on computer vision and pattern recognition, pp. 2392–2399. IEEE, 2012.
188
+
189
+ Subhajit Chaudhury and Hiya Roy. Can fully convolutional networks perform well for general image restoration problems? In International Conference on Machine Vision Applications, pp. 254–257, 2017.
190
+
191
+ Chris Cremer, Xuechen Li, and David Duvenaud. Inference suboptimality in variational autoencoders. In International Conference on Machine Learning, pp. 1078–1086, 2018.
192
+
193
+ W. Dong, P. Wang, W. Yin, G. Shi, F. Wu, and X. Lu. Denoising Prior Driven Deep Neural Network for Image Restoration. TPAMI, 2019.
194
+
195
+ M. Elad and M.l Aharon. Image Denoising Via Sparse and Redundant Representations Over Learned Dictionaries. IEEE Transactions on Image Processing, 15(12):3736–3745, 2006.
196
+
197
+ Yonina C Eldar and Gitta Kutyniok. Compressed sensing: theory and applications. Cambridge university press, 2012.
198
+
199
+ Dennis Forster and Jorg L ¨ ucke. Can clustering scale sublinearly with its clusters? A variational EM ¨ acceleration of GMMs and k-means. In AISTATS, pp. 124–132, 2018.
200
+
201
+ 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.
202
+
203
+ I. J. Goodfellow, A. Courville, and Y. Bengio. Scaling up spike-and-slab models for unsupervised feature learning. TPAMI, 35(8):1902–1914, 2013.
204
+
205
+ Ian Goodfellow, Aaron C. Courville, and Yoshua Bengio. Large-Scale Feature Learning With Spikeand-Slab Sparse Coding. In ICML, 2012.
206
+
207
+ Shuhang Gu, Lei Zhang, Wangmeng Zuo, and Xiangchu Feng. Weighted Nuclear Norm Minimization with Application to Image Denoising. In CVPR, pp. 2862–2869. IEEE, 2014.
208
+
209
+ E. Guiraud, J. Drefs, and J. Lucke. Evolutionary Expectation Maximization. In ¨ GECCO, 2018.
210
+
211
+ M. Haft, R. Hofman, and V. Tresp. Generative binary codes. Formal Pattern Analysis & Applications, 6:269–84, 2004.
212
+
213
+ M. Henniges, G. Puertas, J. Bornschein, J. Eggert, and J. Lucke. Binary Sparse Coding. In ¨ LVA/ICA, pp. 450–57. Springer, 2010.
214
+
215
+ Michael C Hughes and Erik B Sudderth. Fast Learning of Clusters and Topics via Sparse Posteriors. arXiv preprint arXiv:1609.07521, 2016.
216
+
217
+ Ryuji Imamura, Tatsuki Itasaka, and Masahiro Okuda. Zero-Shot Hyperspectral Image Denoising With Separable Image Prior. In IEEE International Conference on Computer Vision Workshop, 2019.
218
+
219
+ Eric Jang, Shixiang Gu, and Ben Poole. Categorical reparameterization with gumbel-softmax, 2016.
220
+
221
+ N. Jojic and B. Frey. Learning flexible sprites in video layers. In IEEE Conference on Computer Vision and Pattern Recognition, 2001.
222
+
223
+ Amir H Khoshaman and Mohammad Amin. Gumbolt: extending gumbel trick to boltzmann priors. In Advances in Neural Information Processing Systems, pp. 4061–4070, 2018.
224
+
225
+ Yoon Kim, Sam Wiseman, Andrew Miller, David Sontag, and Alexander Rush. Semi-amortized variational autoencoders. In International Conference on Machine Learning, pp. 2678–2687, 2018.
226
+
227
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
228
+
229
+ Diederik P Kingma and Max Welling. Auto-Encoding Variational Bayes. In ICLR, 2014.
230
+
231
+ B Kiran, Dilip Thomas, and Ranjith Parakkal. An overview of deep learning based methods for unsupervised and semi-supervised anomaly detection in videos. Journal of Imaging, 4(2):36, 2018.
232
+
233
+ Alexander Krull, Tim-Oliver Buchholz, and Florian Jug. Noise2void-learning denoising from single noisy images. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2129–2137, 2019.
234
+
235
+ Jaakko Lehtinen, Jacob Munkberg, Jon Hasselgren, Samuli Laine, Tero Karras, Miika Aittala, and Timo Aila. Noise2Noise: Learning image restoration without clean data. In ICML, volume 80, pp. 2965–2974, 2018.
236
+
237
+ Guy Lorberbom, Andreea Gane, Tommi Jaakkola, and Tamir Hazan. Direct optimization through arg max for discrete variational auto-encoder. In Advances in Neural Information Processing Systems, pp. 6203–6214, 2019.
238
+
239
+ James Lucas, George Tucker, Roger B Grosse, and Mohammad Norouzi. Don’t blame the elbo! a linear vae perspective on posterior collapse. In Advances in Neural Information Processing Systems, pp. 9408–9418, 2019.
240
+
241
+ J. Lucke and M. Sahani. Maximal causes for non-linear component extraction. ¨ Journal of Machine Learning Research, 9:1227–67, 2008.
242
+
243
+ Jorg L ¨ ucke. Truncated Variational Expectation Maximization. ¨ arXiv preprint, arXiv:1610.03113, 2019.
244
+
245
+ Jorg L ¨ ucke, Zhenwen Dai, and Georgios Exarchakis. Truncated Variational Sampling for “Black ¨ Box” Optimization of Generative Models. In LVA/ICA, pp. 467–478, 2018.
246
+
247
+ Lars Maaløe, Casper Kaae Sønderby, Søren Kaae Sønderby, and Ole Winther. Auxiliary deep generative models. In 33rd International Conference on Machine Learning (ICML 2016), 2016.
248
+
249
+ Chris J. Maddison, Andriy Mnih, and Yee Whye Teh. The concrete distribution: A continuous relaxation of discrete random variables, 2016.
250
+
251
+ Xiaojiao Mao, Chunhua Shen, and Yu-Bin Yang. Image Restoration Using Very Deep Convolutional Encoder-Decoder Networks with Symmetric Skip Connections. In NIPS, pp. 2802–2810, 2016.
252
+
253
+ D. Martin, C. Fowlkes, D. Tal, and J. Malik. A database of human segmented natural images and its application to evaluating segmentation algorithms and measuring ecological statistics. In Proc. 8th Int’l Conf. Computer Vision, volume 2, pp. 416–423, July 2001.
254
+
255
+ Fernando M. F. Nogueira. Bayesian optimization package. github.com/fmfn/BayesianOptimization, 2019.
256
+
257
+ B. Olshausen and D. Field. Emergence of simple-cell receptive field properties by learning a sparse code for natural images. Nature, 381:607–9, 1996.
258
+
259
+ Ladislav Rampasek, Daniel Hidru, Petr Smirnov, Benjamin Haibe-Kains, and Anna Goldenberg. Dr.vae: Drug response variational autoencoder, 2017.
260
+
261
+ Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. ICML proceedings, 2014.
262
+
263
+ Adam Roberts, Jesse Engel, Colin Raffel, Curtis Hawthorne, and Douglas Eck. A hierarchical latent vector model for learning long-term structure in music, 2018.
264
+
265
+ Jason Tyler Rolfe. Discrete variational autoencoders, 2016.
266
+
267
+ Aurko Roy, Ashish Vaswani, Arvind Neelakantan, and Niki Parmar. Theory and experiments on vector quantized autoencoders. arXiv preprint arXiv:1805.11063, 2018.
268
+
269
+ Hossein Sadeghi, Evgeny Andriyash, Walter Vinci, Lorenzo Buffoni, and Mohammad H Amin. Pixelvae $^ { + + }$ : Improved pixelvae with discrete prior. arXiv preprint arXiv:1908.09948, 2019.
270
+
271
+ A.-S. Sheikh and J. Lucke. Select-and-Sample for Spike-and-Slab Sparse Coding. In ¨ NIPS, 2016.
272
+
273
+ Abdul-Saboor Sheikh, Jacquelyn A. Shelton, and Jorg L ¨ ucke. A Truncated EM Approach for Spike- ¨ and-Slab Sparse Coding. Journal of Machine Learning Research, 15:2653–2687, 2014.
274
+
275
+ J. A. Shelton, J. Bornschein, A.-S. Sheikh, P. Berkes, and J. Lucke. Select and Sample – A Model ¨ of Efficient Neural Inference and Learning. NIPS, 24:2618–2626, 2011.
276
+
277
+ Jacquelyn A Shelton, Jan Gasthaus, Zhenwen Dai, Jorg L ¨ ucke, and Arthur Gretton. GP-Select: ¨ Accelerating EM Using Adaptive Subspace Preselection. Neural Computation, 29(8):2177–2202, 2017.
278
+
279
+ Assaf Shocher, Nadav Cohen, and Michal Irani. “Zero-Shot” Super-Resolution using Deep Internal Learning. In CVPR, pp. 3118–3126. IEEE, 2018.
280
+
281
+ Leslie N Smith. Cyclical learning rates for training neural networks. In 2017 IEEE Winter Conference on Applications of Computer Vision (WACV), pp. 464–472. IEEE, 2017.
282
+
283
+ Michalis K. Titsias and Miguel Lazaro-Gredilla. Spike and Slab Variational Inference for Multi-Task ´ and Multiple Kernel Learning. In NIPS, 2011.
284
+
285
+ Arash Vahdat, Evgeny Andriyash, and William G Macready. Learning undirected posteriors by backpropagation through mcmc updates. arXiv preprint arXiv:1901.03440, 2019.
286
+
287
+ Aaron van den Oord, Oriol Vinyals, et al. Neural discrete representation learning. In Advances in Neural Information Processing Systems, pp. 6306–6315, 2017.
288
+
289
+ J. H. van Hateren and A. van der Schaaf. Independent component filters of natural images compared with simple cells in primary visual cortex. Proceedings of the Royal Society of London. Series B: Biological Sciences, 265:359–66, 1998.
290
+
291
+ Eszter Vertes and Maneesh Sahani. Flexible and accurate inference and learning for deep generative ´ models. In NIPS, 2018.
292
+
293
+ Ronald J. Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine Learning, 8(3):229–256, May 1992. ISSN 1573-0565. doi: 10.1007/BF00992696. URL https://doi.org/10.1007/BF00992696.
294
+
295
+ Kai Zhang, Wangmeng Zuo, Yunjin Chen, Deyu Meng, and Lei Zhang. Beyond a Gaussian Denoiser: Residual Learning of Deep CNN for Image Denoising. IEEE Transactions on Image Processing, 26(7):3142–3155, 2017.
296
+
297
+ Kai Zhang, Wangmeng Zuo, and Lei Zhang. FFDNet: Toward a fast and flexible solution for CNN based image denoising. IEEE Transactions on Image Processing, 2018.
298
+
299
+ Shipeng Zhu, Guili Xu, Yuehua Cheng, Xiaodong Han, and Zhengsheng Wang. BDGAN: Image Blind Denoising Using Generative Adversarial Networks. In Chinese Conference on Pattern Recognition and Computer Vision, pp. 241–252, 2019.
300
+
301
+ Daniel Zoran and Yair Weiss. From Learning Models of Natural Image Patches to Whole Image Restoration. In IEEE International Conference on Computer Vision, pp. 479–486, 2011.
302
+
303
+ # A DETAILS OF ENCODER AND DECODER OPTIMIZATION
304
+
305
+ ![](images/2b7855043a370020906d659795f7c6fcd5c7b6e3f849b7fdfc411ca3e69fc1bf.jpg)
306
+ Figure 5: From left to right: generic VAE decoding model, continuous-latent VAE model with Gaussian noise and the binary-latent VAE model of Eqn. (1), in plate notation.
307
+
308
+ See Fig. 5 for a graphical comparison between the decoding models of a vanilla VAE and the binary VAE considered here (1). Fig. 6 graphically illustrates different steps to optimize standard VAEs, and additional steps suggested by different contributions in order to optimize discrete VAEs.
309
+
310
+ For the optimization of the binary VAE (1), consider the original form of the lower bound, Eqn. (2). When taking derivatives of $\mathcal { F } ( \Phi , \Theta )$ w.r.t. $\Theta$ we can ignore the entropy term1. For the binary VAE model of Eqn. (1) the gradient of the lower bound w.r.t. $W$ is then given by:
311
+
312
+ $$
313
+ \begin{array} { r c l } { { \displaystyle \vec { \nabla } _ { W } \mathcal { F } ( \Phi , \Theta ) } } & { { = } } & { { \displaystyle \sum _ { n } \vec { \nabla } _ { W } \big \langle \log \big ( p _ { \Theta } ( \vec { x } ^ { ( n ) } \mid \vec { z } ) p _ { \Theta } ( \vec { z } ) \big ) \big \rangle _ { q _ { \Phi } ^ { ( n ) } } } } \\ { { } } & { { = } } & { { \displaystyle \sum _ { n } \vec { \nabla } _ { W } \big \langle \log \big ( p _ { \Theta } ( \vec { x } ^ { ( n ) } \mid \vec { z } ) \big ) \big \rangle _ { q _ { \Phi } ^ { ( n ) } } = \displaystyle \sum _ { n } \vec { \nabla } _ { W } \big \langle \log \big ( \mathcal { N } ( \vec { x } ^ { ( n ) } ; \vec { \mu } ( \vec { z } , W ) , \sigma ^ { 2 } \mathbb { I } \big ) \big \rangle _ { q _ { \Phi } ^ { ( n ) } } } } \\ { { } } & { { = } } & { { \displaystyle - \frac { 1 } { 2 \sigma ^ { 2 } } \sum _ { n } \vec { \nabla } _ { W } \sum _ { \vec { z } \in \Phi ^ { ( n ) } } q _ { \Phi } ^ { ( n ) } ( \vec { z } ) \| \vec { x } ^ { ( n ) } - \vec { \mu } ( \vec { z } , W ) \| ^ { 2 } } } \\ { { } } & { { = } } & { { \displaystyle - \frac { 1 } { 2 \sigma ^ { 2 } } \sum _ { n } \sum _ { \vec { z } \in \Phi ^ { ( n ) } } q _ { \Phi } ^ { ( n ) } ( \vec { z } ) \vec { \nabla } _ { W } \| \vec { x } ^ { ( n ) } - \vec { \mu } ( \vec { z } , W ) \| ^ { 2 } , } } \end{array}
314
+ $$
315
+
316
+ where the weighting factors $q _ { \Phi } ^ { ( n ) } ( { \vec { z } } )$ are by using (3) and (1) given by:
317
+
318
+ $$
319
+ \begin{array} { r c l } { { q _ { \Phi } ^ { ( n ) } ( \vec { z } ) } } & { { = } } & { { \displaystyle \frac { p _ { \Theta } ( \vec { x } ^ { ( n ) } \mid \vec { z } ) p _ { \Theta } ( \vec { z } ) } { \sum _ { \vec { z } ^ { \prime } \in \Phi ^ { ( n ) } } p _ { \Theta } ( \vec { x } ^ { ( n ) } \mid \vec { z } ^ { \prime } ) p _ { \Theta } ( \vec { z } ^ { \prime } ) } } } \\ { { } } & { { = } } & { { \displaystyle \frac { \exp \big ( - \frac { 1 } { 2 \sigma ^ { 2 } } \| \vec { x } ^ { ( n ) } - \vec { \mu } ( \vec { z } , W ) \| ^ { 2 } - \tilde { \vec { \pi } } ^ { T } \vec { z } \big ) } { \sum _ { \vec { z } ^ { \prime } \in \Phi ^ { ( n ) } } \exp \big ( - \frac { 1 } { 2 \sigma ^ { 2 } } \| \vec { x } ^ { ( n ) } - \vec { \mu } ( \vec { z } ^ { \prime } , W ) \| ^ { 2 } - \tilde { \vec { \pi } } ^ { T } \vec { z } ^ { \prime } \big ) } } } \end{array}
320
+ $$
321
+
322
+ for all of the $\vec { z } \in \boldsymbol { \Phi } ^ { ( n ) }$ , rs ere , th $\begin{array} { r } { \tilde { \pi } _ { h } = \log \left( \frac { 1 - \pi _ { h } } { \pi _ { h } } \right) } \end{array}$ . Note that the ated as constan $q _ { \Phi } ^ { ( n ) } ( \vec { z } )$ are evaluated at theor the gradient w.r.t. rent values. $\Theta$ $W$
323
+
324
+ It may be interesting to compare the gradient estimate (11) to the gradient estimate of conventional VAE training. For this consider a standard encoder given by an amortized variational distribution which we shall denote by $\tilde { q } _ { \Phi } ^ { ( n ) } ( \vec { z } )$ . The distribution $\tilde { q } _ { \Phi } ^ { ( n ) } ( \vec { z } )$ could be a Gaussian whose mean and variance are set by passing data point $\vec { x } ^ { ( n ) }$ through encoder DNNs. For discrete VAEs, $\tilde { q } _ { \Phi } ^ { ( n ) } ( \vec { z } )$ can be thought of as an analog discrete distribution. If we now take gradients of (6) w.r.t. $W$ and estimate using samples from $\tilde { q } _ { \Phi } ^ { ( n ) } ( \vec { z } )$ , we obtain the familiar form:
325
+
326
+ $$
327
+ \begin{array} { r c l } { \displaystyle \vec { \nabla } _ { W } \mathcal { F } ( \Phi , \Theta ) } & { = } & { \displaystyle \sum _ { n } \vec { \nabla } _ { W } \Big \langle \log \big ( p _ { \Theta } ( \vec { x } ^ { ( n ) } \mid \vec { z } ) p _ { \Theta } ( \vec { z } ) \big ) \Big \rangle _ { \vec { q } _ { \Phi } ^ { ( n ) } } } \\ & { = } & { \displaystyle \sum _ { n } \vec { \nabla } _ { W } \Big \langle \log \big ( \mathcal { N } ( \vec { x } ^ { ( n ) } ; \vec { \mu } ( \vec { z } , W ) , \sigma ^ { 2 } \mathbb { I } ) \big \rangle _ { \vec { q } _ { \Phi } ^ { ( n ) } } } \\ & { \approx } & { \displaystyle - \frac { 1 } { 2 \sigma ^ { 2 } } \sum _ { n } \frac { 1 } { M } \sum _ { m = 1 } ^ { M } \vec { \nabla } _ { W } \| \vec { x } ^ { ( n ) } - \vec { \mu } ( \vec { z } ^ { ( m ) } , W ) \| ^ { 2 } , \mathrm { ~ w h e r e ~ } \vec { z } ^ { ( m ) } \sim \tilde { q } _ { \Phi } ^ { ( n ) } ( \vec { z } ) } \end{array}
328
+ $$
329
+
330
+ We can slightly rewrite this expression to obtain:
331
+
332
+ $$
333
+ \vec { \nabla } _ { W } \mathcal { F } ( \Phi , \Theta ) ~ \approx ~ - \frac { 1 } { 2 \sigma ^ { 2 } } \sum _ { n } \sum _ { \vec { z } \sim \tilde { q } _ { \Phi } ^ { ( n ) } } \left( \frac { 1 } { M } \right) \vec { \nabla } _ { W } \| \vec { x } ^ { ( n ) } - \vec { \mu } ( \vec { z } , W ) \| ^ { 2 } ,
334
+ $$
335
+
336
+ If we now compare with the gradient using the truncated approximation $q _ { \Phi } ^ { ( n ) } ( { \vec { z } } )$
337
+
338
+ $$
339
+ \vec { \nabla } _ { W } \mathcal { F } ( \Phi , \Theta ) = - \frac { 1 } { 2 \sigma ^ { 2 } } \sum _ { n } \sum _ { \vec { z } \in \Phi ^ { ( n ) } } q _ { \Phi } ^ { ( n ) } ( \vec { z } ) \vec { \nabla } _ { W } \| \vec { x } ^ { ( n ) } - \vec { \mu } ( \vec { z } , W ) \| ^ { 2 } ,
340
+ $$
341
+
342
+ one can discuss analogous roles played by the subsets $\boldsymbol { \Phi } ^ { ( n ) }$ (the variational parameters of q(n)Φ (\~z)) and by a standard encoder $\tilde { q } _ { \Phi } ^ { ( n ) }$ . The states in a subset Φ(n) are used to estimate the gradient similar to the samples from a standard encoder $\tilde { q } _ { \Phi } ^ { ( n ) } ( \vec { z } )$ . The size of $\boldsymbol { \Phi } ^ { ( n ) }$ can consequently be thought of as analog to the number of samples used in a conventional estimation of the gradient. Standard VAE training estimates the gradient by weighting all samples equally (with $( 1 / M )$ ) and the gradient direction is approximated using sufficiently many samples drawn from the current $\tilde { q } _ { \Phi } ^ { ( n ) } ( \vec { z } )$ . In contrast, truncated gradient estimation uses the states in $\boldsymbol { \Phi } ^ { ( n ) }$ , and the gradient is computed using a weighted summation with weights $q _ { \Phi } ^ { ( n ) } ( \vec { z } )$ . These weights are computed by passing the states $\vec { z }$ through the decoder network. The gradient is then, notably, not a stochastic estimation but exact: gradient ascent is guaranteed (for small steps) to always monotonically increase the variational lower bound.
343
+
344
+ Computational Complexity. To add to the discussion of computational complexity of TVAE compared to standard VAE training, consider again Eqns. 13 and 14. If as many samples $M$ are used, per data point, as there are states in each $\boldsymbol { \Phi } ^ { ( n ) }$ , then both sums have the same number of summands. The evaluation of the gradients of the mean square error (MSE) is consequently precisely the same for both approaches. The additional weighting factors $q _ { \Phi } ^ { ( n ) } ( \vec { z } )$ have to be computed for TVAE. However, the weighting factors just represent a small overhead because the evaluation of the decoder DNN for the states in $\boldsymbol { \Phi } ^ { ( n ) }$ is a computation that can be reused from the updates of $\boldsymbol { \Phi } ^ { ( n ) }$
345
+
346
+ The main computational differences are in the updates of Φ(n) compared to the update of encoder DNNs for conventional VAEs. Once the parameters $\Theta = ( W , \sigma ^ { 2 } , { \bar { \vec { \pi } } } )$ are updated using (14), new states for $\boldsymbol { \Phi } ^ { ( n ) }$ have to be sought based on criterion (9). In practice and for each $n$ , we generate $M ^ { \prime }$ new states according to the applied evolutionary procedure. To select the best states we have to pass all these $M ^ { \prime }$ new states through the decoder DNN to evaluate (9). Furthermore, we have to pass all M states already in Φ(n) through the DNN to re-evaluate (9) because the parameters $\Theta$ have changed. In summary, we do require $\mathcal { O } ( N \times \left( M + M ^ { \prime } \right) )$ passes through the decoder DNN. Selecting the $M$ best states from the $( M + M ^ { \prime } )$ states does not add complexity as this can be done in $\mathcal { O } ( M + M ^ { \prime } )$ for each $n$ (Blum et al., 1973). The EA does add to the computational load but parent selection and mutation only add a constant offset for each of the considered states.
347
+
348
+ For comparison with standard VAEs, if we use $M$ samples of an encoder $\tilde { q } _ { \Phi } ^ { ( n ) } ( \vec { z } )$ , we require $\mathcal { O } ( M \times$ ) passes through the decoder DNN to update the parameters according to (13). For the encoder update, one requires $N \times { \tilde { M } }$ passes through encoder and decoder DNN to estimate the gradient w.r.t. the encoder weights (if we draw $\tilde { M }$ samples for each data point from a conventional encoder distribution $\tilde { q } _ { \Phi } ^ { ( n ) } ( \vec { z } )$ . The additional overhead to actually draw the samples is usually negligible.
349
+
350
+ Hence, the computational complexity of TVAE training is comparable if $M \approx M ^ { \prime } \approx \tilde { M }$ . However, conventional VAE training is amortized, i.e., the update of encoder weights uses information from all data points $n$ . In contrast, TVAE training is not amortized, i.e., the $\boldsymbol { \Phi } ^ { ( n ) }$ are updated per data point. The advantage of amortization is that in practice, weights of a conventional encoder can converge faster or (alternatively) less samples $\tilde { M }$ are required. Considering the observed runtimes, more efficient conventional VAE training can presumably in large parts attributed to faster convergence using amortization. Furthermore, the used number of samples $M$ for conventional VAE training is usually smaller than best working sizes of Φ(n) (we used, e.g., |Φ(n) | $| { \Phi } ^ { ^ { ( n ) } } | = 6 4$ and $| { \boldsymbol { \Phi } } ^ { ( n ) } | = 2 0 0$ for denoising, see Tab. 3); and the required storage of $\boldsymbol { \Phi } ^ { ( n ) }$ results in overhead computations. On the other hand, amortization also has disadvantages (e.g. Kim et al., 2018; Cremer et al., 2018). The competitive performance for denoising may consequently be attributed at least in part to TVAE not being subject to an amortization gap.
351
+
352
+ ![](images/28fcf2926d4d74e4346e81bf3b7039d35652023639a4ede0fe18b3fa6a2251ca.jpg)
353
+ Figure 6: Standard series of methods applied to optimize the encoding model of VAEs. Left: methods applied for encoding models of standard VAEs. Middle: additional methods applied to maintain the standard procedure of encoding model optimization also for discrete latent variables. Right: alternative approach to optimize the VAE encoding model using direct discrete optimization.
354
+
355
+ # B DETAILS ON THE NUMERICAL EXPERIMENTS
356
+
357
+ # B.1 VERIFICATION ON GROUND-TRUTH DATA
358
+
359
+ We first evaluated TVAE training on artificial datasets with known ground-truth parameters and loglikelihood, in order to verify the correct functioning of the algorithm and to investigate possible local optima effects. The dataset consisted of $5 0 0 4 \mathrm { x } 4$ images generated by linear superposition of vertical and horizontal bars, with a small amount of Gaussian noise. The DNN’s input and middle layers had 8 units each. The $\Phi ^ { ( n ) }$ variational sets consisted of 64 hidden states each. Fig. 7 shows the evolution of the run that achieved the highest ELBO value out of ten. All parameters were correctly recovered, and the ELBO value was consistent with actual ground-truth log-likelihood.
360
+
361
+ Such a simple test, however, can also be solved by linear models. In order to demonstrate that TVAEs can solve non-linear problems, taking advantage of the neural network non-linearity embedded in the generative model, we introduced correlations between pairs of bars: the bars combinations shown in the first two datapoints from the left in Fig. 8 were discouraged from appearing together. We employed the same evolutionary scheme and again we selected the run with highest peak ELBO value out of ten. The model correctly learns that certain combinations of bars are much more unlikely than others, and correctly estimates their likelihood.
362
+
363
+ ![](images/2a6b04221e9ae44435f5a6d9105878e4322c3702f6543e98f05d8e32a9dce63d.jpg)
364
+ Figure 7: TVAE training on simple bars data: noiseless output of the TVAE’s DNN for the 8 possible one-hot input vectors over several training epochs. Generating parameters are in the last row.
365
+
366
+ ![](images/18ac5c6b9ab26009afa724c2a4f8213b294d061feb31af9d3055cb0d8f1edbce.jpg)
367
+ Figure 8: Correlated bars test. The plot shows the ratio between inferred and ground-truth loglikelihoods $\log p _ { \Theta } ( \vec { x } )$ of datapoints with interesting bar combinations. The inferred values are reported below the datapoints themselves.
368
+
369
+ Fig. 9 offers some more insight into the correlated bars test experiment described. The left section of the figure shows the generative parameters for the dataset used: $W _ { 0 }$ is the $8 \mathrm { x } 8$ weight matrix of the top-to-middle layer: this makes it so that the activation of the first latent variable inhibits activation of the second, and activation of the last latent variable inhibits activation of the last. Concretely, this results in a dataset where these specific bars combinations are discouraged from appearing. The weights $W _ { 1 }$ , visualized as $8 4 \mathrm { x } 4$ matrices, generate the actual bars. $\sigma ^ { 2 }$ was set to 0.01 and the dataset contained an average of two superimposing bars per datapoint $\pi _ { h } = 2 / 8$ for each $h$ ).
370
+
371
+ The middle section of the figure shows the ELBO values (averages over all batches for each epoch) as training progresses. The cyclic learning rate schedule is responsible for the oscillatory behavior.
372
+
373
+ The right section shows some example datapoints together with samples from the trained TVAE model that reached the highest ELBO value out of the ten runs.
374
+
375
+ ![](images/dc0cbe1af3b8b15e73702eaecae44249051888aa76aa16c38dc8063e30376cb5.jpg)
376
+ Figure 9: From left to right: generative parameters for the correlated bars test; ELBO values over epochs for 10 runs; example datapoints and samples from the generative model.
377
+
378
+ # B.2 DENOISING
379
+
380
+ Given a trained TVAE with parameters $\Theta$ , we estimated the value of a pixel in a single patch as $x _ { d } ^ { \mathrm { e s t } } = \langle x _ { d } \rangle _ { p \Theta ( x _ { d } | \vec { x } ) }$ . When using $\begin{array} { r } { p _ { \Theta } ( x _ { d } \mid \vec { x } ) = \sum _ { \{ \vec { z } \} } p _ { \Theta } ( x _ { d } \mid \vec { z } ) p _ { \Theta } ( \vec { z } \mid \vec { x } ) } \end{array}$ we obtain:
381
+
382
+ $$
383
+ x _ { d } ^ { \mathrm { e s t } } = \Big \langle \langle x _ { d } \rangle _ { p _ { \Theta } ( x _ { d } | \vec { z } ) } \Big \rangle _ { p _ { \Theta } ( \vec { z } | \vec { x } ) } = \langle \mu _ { d } ( \vec { z } ) \rangle _ { p _ { \Theta } ( \vec { z } | \vec { x } ) } .
384
+ $$
385
+
386
+ The expectation value on the right-hand-side of Eqn. (15) is then approximated based on the encoding parameters $\boldsymbol { \Phi } ^ { ( n ) }$ using truncated posteriors. Finally, we took a weighted average of the estimates of a pixel value in different patches (see, e.g., Burger et al., 2012) in order to generate the pixel values of the full denoised image.
387
+
388
+ In Tab. 3 we list the exact hyper-parameters used to obtain the PSNR values reported. In parentheses, the parameters for the run on data with noise level $\sigma = 5 0$ and unconstrained hyper-parameters are given, when they differ from the other experiments.
389
+
390
+ Table 3: Hyper-parameters for the denoising experiments on the house image.
391
+
392
+ <table><tr><td>Neural network units Input (H) 64 (512) Middle 64 (512)</td></tr><tr><td>Output (D) 64 (144) Cyclic Learning Rates</td></tr><tr><td>Min 1.r. 0.0001</td></tr><tr><td>Max l.r. 0.01 (0.05)</td></tr><tr><td>Epochs/cycle 20 Batch size 32</td></tr><tr><td>Evolutionaryparameters</td></tr><tr><td>Parents 10 (5) Children 9 (4) Generations 4(1)</td></tr></table>
393
+
394
+ Table 4: Denoising performance of $\mathbf { n } 2 \mathbf { v }$ in PSNR (dB) for the ‘house’ image with AWG noise. For comparison, we additionally list the performance of TVAE (numbers copied from Tab. 2). PSNR values for $\mathrm { n } 2 \mathrm { v } ^ { \star }$ are obtained by training only on the noisy image (i.e., in the same setting as used for MTMKL, GSC, var-BSC and TVAE in Tab. 2. More training data improves performance for $\mathbf { n } 2 \mathbf { v } .$ . PSNR values for $\mathrm { n } 2 \mathrm { \bar { v } } ^ { \dagger }$ show performance if additional training data in the form of noisy images with AWG noise $\sigma = 2 5$ is used. Further improvements (especially for high noise) are obtained if the $\mathrm { n } 2 \mathrm { v }$ network is trained on training data with a noise level that matches the noise of the test set $\mathrm { ( s e e \ n 2 v ^ { \ddagger } ) }$ ). For instance, we used for $\mathrm { n } 2 \mathrm { v } ^ { \ddag }$ training data with $\sigma = 5 0$ to denoise the ‘house’ with $\sigma = 5 0$ . See text for further details.
395
+
396
+ <table><tr><td></td><td>0=15</td><td>g=25</td><td>q=50</td></tr><tr><td>n2v*</td><td>32.05</td><td>29.20</td><td>25.42</td></tr><tr><td>n2vt</td><td>32.93</td><td>32.10</td><td>20.96</td></tr><tr><td>n2vt</td><td>33.91</td><td>32.10</td><td>28.94</td></tr><tr><td>TVAE</td><td>34.27 ± .02</td><td>32.65 ± .06</td><td>29.98 ± .05</td></tr></table>
397
+
398
+ To evaluate the performance on standard denoising benchmarks, we first compared TVAE to related probabilistic sparse coding approaches such as MTMKL, GSC and var-BSC (Tab. 1). MTMKL and GSC use the data model of spike-and-slab sparse coding and for training mean-field and truncated posterior approximations with pre-selection are used, respectively. Compared to MTMKL and GSC, var-BSC uses a less complex data model and a training scheme also based on evolutionary optimization (Guiraud et al., 2018). The denoising performance observed in the scenario with controlled conditions (Tab. 1) shows that for high noise level $( \sigma = 5 0 $ ), var-BSC achieves higher PSNR values than MTMKL and GSC although the method uses a simpler data model. This observation demonstrates the effectiveness of the evolutionary training method used by var-BSC. However, PSNR values for TVAE are significantly higher due to the higher flexibility in modeling the data distribution provided by the used DNN.
399
+
400
+ In a second step, Tab. 2 compared the performance of TVAE with respect to different denoising approaches including deterministic sparse coding (KSVD), a mixture model approach (EPLL), a non-local image processing method (WNNM) and state-of-the-art denoising methods based on deep neural networks (BDGAN and DPDNN). These approaches can be distinguished, e.g., by the amount of employed training data and by the requirement for clean data.
401
+
402
+ TVAE as well as MTMKL, GSC and var-BSC do not require clean images for training. Furthermore, all these approaches can be trained if only the single noisy image is available (‘zero-shot’ learning; compare, e.g., Shocher et al., 2018; Imamura et al., 2019). Instead, EPLL, BDGAN and DPDNN use clean training data (typically tens or hundreds of thousands of data points are collected for training).
403
+
404
+ Approaches such as noise2noise $\mathtt { n 2 n }$ Lehtinen et al., 2018) and noise2void (n2v Krull et al., 2019) occupy a middle ground: they can be trained on noisy data but they typically require much larger amounts of data than, e.g., TVAE or MTMKL. In the original n2v publication, for instance, 400 (noisy) $1 8 0 \times 1 8 0$ BSD (Martin et al., 2001) images were used to create a training dataset (this procedure also involved data augmentation; compare Krull et al. 2019). For our comparison with results of Tab. 2, we used the standard, publicly available code for $\mathbf { n } 2 \mathbf { v }$ together with the default training set $\sigma = 2 5$ ) employed in the original n2v publication. We then applied the trained $\mathbf { n } 2 \mathbf { v }$ network to denoise the ‘house’ image with $\sigma = 2 5$ . The resulting PSNR value was $3 2 . 1 0 d B$ which is $0 . 7 6 d B$ lower than the PSNR value for BM3D $( 3 2 . 8 6 d B )$ . The difference is consistent with an on average $0 . 8 8 d B$ lower performance of $\mathbf { n } 2 \mathbf { v }$ compared to BM3D on the BSD68 test set (see Krull et al., 2019). The same network can also be used to denoise an image with lower or higher noise level. The $\mathbf { n } 2 \mathbf { v }$ network trained on $\sigma = 2 5$ does, for instance, result in PSNR values of $3 2 . 9 3 d B$ for the ‘house’ image with $\sigma = 1 5$ and in $2 0 . 9 6 d B$ for the ‘house’ image with $\sigma = 5 0$ (see $n 2 v ^ { \dagger }$ in Tab. 4). Especially for high noise levels performance can be much improved, however, if the n2v network is trained using images with the same noise level as the test image. In order to do so, we followed the procedure described in the $\mathbf { n } 2 \mathbf { v }$ publication while adapting the noise level of $\sigma = 1 5$ in one case and $\sigma = 5 0$ for the other case. Trained on a dataset with matched noise, we then denoised the ‘house’ image with $\sigma = 1 5$ in the one, and $\sigma = 5 0$ in the other case (results listed as $\mathrm { n } 2 \mathrm { v } ^ { \ddag }$ in Tab. 4). The PSNR values obtained for ‘house’ in this matched-noise-level scenario are much higher compared to the scenario with unmatched noise level (e.g., for $\sigma = 5 0$ the PSNR improvement is approximately 8 dB). The much lower performance for mismatched noise for $\mathbf { n } 2 \mathbf { v }$ is in this respect consistent with observations for standard DNN denoising for which training with the ground-truth noise level has been pointed out as important for performance (Chaudhury & Roy, 2017; Zhang et al., 2018).
405
+
406
+ The $\mathrm { n } 2 \mathrm { v }$ approach can avoid having to know the exact noise level, e.g., if it is trained on just the single noisy image. In a last experiment, we hence investigated this ‘zero-shot’ denoising feature of n2v and applied the algorithm to denoise the ‘house’ image while using the same noisy image for training that we seek to denoise (we took the publicly available code of $\mathrm { n } 2 \mathrm { v }$ as an example and manually adjusted hyperparameters as follows: we set the ”Percentage of pixel to manipulate per patch” to a value of 0.4, as ”Number of training epochs” we used 400 and we set the ”Number of parameter update steps per epoch” to 33). The obtained PSNR values are listed as $\mathrm { n } 2 \mathrm { v } ^ { \ast }$ in Tab. 4.
407
+
408
+ From Tab. 4 it can be observed, that for all considered training settings of $\mathrm { n } 2 \mathrm { v }$ and all noise levels, PSNR values of TVAE are consistently higher than those of $\mathbf { n } 2 \mathbf { v }$ even if $\mathrm { n } 2 \mathrm { v }$ is trained on external data with matched-noise level. Additional parameter tuning may improve performance of $\mathrm { n } 2 \mathrm { v } ^ { \ast }$ to a certain extent but PSNRs are in general much lower than $\mathrm { \hat { n } } 2 \mathrm { v } ^ { \ddag }$ . While we followed for $\mathrm { n } 2 \mathrm { v } ^ { \ddag }$ the standard hyperparameter setting of the original paper/code publication of $\mathbf { n } 2 \mathbf { v }$ (Krull et al., 2019), we cannot exclude further improvements with parameter fine tuning for the ‘house’ benchmark. However, we remark that the difference of $\mathrm { n } 2 \mathrm { v } ^ { \ddag }$ and BM3D for the ‘house’ benchmark is on the very same range as the differences between n2v and BM3D as reported on the BSD data set in the original n2v publication. The stronger performing BM3D is according to denoising performance the preferable comparison and as such included in Tab. 2. In terms of efficiency, the $\mathrm { n } 2 \mathrm { v }$ approach is in general (once trained) faster than BM3D as well as TVAE, however.
409
+
410
+ PSNR values of noise2noise $( \mathtt { n 2 n } )$ are usually very closely aligned with PSNR values achievable by feed-forward DNNs. More concretely, $\mathfrak { n } 2 \mathfrak { n }$ uses, for instance, a RED30 network (Mao et al., 2016) which achieves 31.07 dB PSNR on the BSD300 data set if trained on clean data. If directly trained on noisy data, RED30 achieves 31.06 dB (Lehtinen et al., 2018). n2n is thus strongly performing in terms of PSNR. The caveat of n2n compared to n2v is, however, that the noisy data n2n uses is rather artificial. The pairs of images n2n is trained on consist of two different noise realization of the same underlying clean image. For real data, such a setting is only approximately occurring at most, which has motivated the n2v approach.
411
+
412
+ Like n2v, BDGAN and DPDNN are optimized for specific noise levels (specific standard deviations are used to generate the noisy training examples). EPLL is trained exclusively on clean image patches; for denoising, the algorithm requires the ground-truth noise level of the test image as input parameter. Ground-truth noise level information is also required by KSVD and WNNM.
413
+
414
+ Like all approaches in the top category of Tab. 2, TVAE does not require ground-truth noise level information, nor clean images, nor large amounts of training data. For the ‘zero-shot’ setting, TVAE is consequently the best performing system on the ‘house’ benchmark. Such a high performance is notably achieved using a basic DNN and relatively small patch sizes of $D = 8 \times 8$ (for $\sigma = 1 5$ and $\sigma = 2 5$ ) or $D = 1 2 \times 1 2$ (for $\sigma = 5 0$ ). All feed-forward DNNs for denoising use much larger patches (e.g., n2v use $6 4 \times 6 4$ ). That a competitive denoising performance can be achieved for small patches, in general, argues in favor for VAE approaches to denoising. Indeed, TVAE even comes close to state-of-the-art approaches (BDGAN and DPDNN) that use very intricate DNN architectures and large amounts of clean training data. We believe that such results underline the potential of the here investigated approach although the novelty of the approach is the focus rather than extensive benchmarking.
415
+
416
+ On the other hand, an important limitation of TVAE is its computational demand. For our experiments on the ‘house’ image with noise level $\sigma = 5 0$ in Tab. 2 we used $N = 6 0 0 2 5$ patches of $D = 1 2 \times 1 2$ pixels, which amounts to all possible non-overlapping square patches of that size that can be extracted from the image. For training and denoising we used a TVAE with $H = 5 1 2$ latent variables, sizes of $| { \Phi } ^ { ( n ) } | = 6 4 $ , and 512 units in the DNN middle layer of the decoder. TVAE training required 49 seconds per training epoch when executing on a single NVIDIA Titan $\mathrm { X p }$ GPU and $2 . 5 \mathrm { G B }$ of GPU memory. We ran for 500 epochs which required between seven and eight hours on the single GPU. We did not observe significant changes in variational bound values or in denoising performance after 500 epochs in any of the experiments we conducted for Tabs 1 and 2. Runtime complexity increased linear with the number of data points $N$ , with the dimensionality of the data $D$ , with the number of the latents $H$ , and with the size of the DNN used. Runtimes also increased approximately proportional w.r.t. the size of $\boldsymbol { \Phi } ^ { ( n ) }$ . Empirically we observed a sublinear scaling with |Φ(n) | presumably because of significant overhead computations: for example, increasing from $| { \boldsymbol { \Phi } } ^ { ( n ) } | = 6 4$ to $| { \Phi } ^ { ( n ) } | = 1 2 8$ (while keeping all other parameters as above) computational time increases from 49 seconds per training epoch to 75 seconds.
417
+
418
+ For noise levels $\sigma = 1 5$ and $\sigma = 2 5$ in Tab. 2 we used smaller patch sizes $( D = 8 \times 8 )$ ) and fewer stochastic latents $H = 6 4$ ) but larger $\boldsymbol { \Phi } ^ { ( n ) }$ (i.e., $| { \Phi } ^ { ( n ) } | = 2 0 \bar { 0 } )$ . In general, if the patch size $D$ is increased, more structure has to be captured. This can be done either by increasing the size of the stochastic latents $H$ or by using larger DNNs. Both, in turn, requires more training data in order to estimate the increased number of parameters. In the current setup, the sizes of $D$ which are currently feasible are comparably small. The denoising performance based on small patches is, however, notably very high.
419
+
420
+ For comparison, n2v uses up to $D = 6 4 \times 6 4$ and also all other feed-forward DNN approaches use significantly larger patch sizes than TVAE (and the other approaches in category 1). Still, n2v can be trained efficiently on large patches requiring approximately 19 hours on a NVIDIA Tesla K80 GPU for training on approximately $3 \mathrm { k }$ noisy images of shape $1 8 0 \mathrm { x } 1 8 0$ and seconds for the denoising of one 256x256 image. The higher computational demand of TVAE is also the reason why averaging across databases with many images (such as BSD68) or applications to large single images quickly becomes infeasible. As a novel approach, TVAE is, however, far from being fully optimized algorithmically compared to large feed-forward approaches, and there is certainly further potential to improve training efficiency.
421
+
422
+ While denoising is, in general, well suited for deep generative models, performance for standard image denoising is by far not as common as such results for standard DNNs (which may also be related to efficiency aspects). An exception is a recent GAN approach (BDGAN; Zhu et al., 2019). VAEs are often evaluated using binarized MNIST with approximate log-likelihoods for comparison; that benchmark, however, is not consistent with the Gaussian noise model used here and does not allow a direct comparison with feed-forward DNNs which are the state-of-the-art.
md/train/Pz_dcqfcKW8/Pz_dcqfcKW8.md ADDED
@@ -0,0 +1,274 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DUAL-MODE ASR: UNIFY AND IMPROVE STREAMING ASR WITH FULL-CONTEXT MODELING
2
+
3
+ Jiahui $\mathbf { Y u } ^ { 1 }$ Wei Han1† Anmol Gulati1† Chung-Cheng Chiu1 Bo Li2 Tara N. Sainath2 Yonghui Wu1 Ruoming Pang1
4
+
5
+ 1Google Brain 2Google LLC {jiahuiyu, rpang}@google.com
6
+
7
+ # ABSTRACT
8
+
9
+ Streaming automatic speech recognition (ASR) aims to emit each hypothesized word as quickly and accurately as possible, while full-context ASR waits for the completion of a full speech utterance before emitting completed hypotheses. In this work, we propose a unified framework, Dual-mode ASR, to train a single end-to-end ASR model with shared weights for both streaming and full-context speech recognition. We show that the latency and accuracy of streaming ASR significantly benefit from weight sharing and joint training of full-context ASR, especially with inplace knowledge distillation during the training. The Dual-mode ASR framework can be applied to recent state-of-the-art convolution-based and transformer-based ASR networks. We present extensive experiments with two state-of-the-art ASR networks, ContextNet and Conformer, on two datasets, a widely used public dataset LibriSpeech and a large-scale dataset MultiDomain. Experiments and ablation studies demonstrate that Dual-mode ASR not only simplifies the workflow of training and deploying streaming and full-context ASR models, but also significantly improves both emission latency and recognition accuracy of streaming ASR. With Dual-mode ASR, we achieve new state-of-the-art streaming ASR results on both LibriSpeech and MultiDomain in terms of accuracy and latency.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ “Ok Google. Hey Siri. Hi Alexa.” have featured a massive boom of smart speakers in recent years, unveiling a trend towards ubiquitous and ambient Artificial Intelligence (AI) for better daily lives. As the communication bridge between human and machine, low-latency streaming ASR (a.k.a., online ASR) is of central importance, whose goal is to emit each hypothesized word as quickly and accurately as possible on the fly as they are spoken. On the other hand, there are some scenarios where full-context ASR (a.k.a., offline ASR) is sufficient, for example, offline video captioning on video-sharing platforms. While low-latency streaming ASR is generally preferred in most of the speech recognition scenarios, it often has worse prediction accuracy as measured in Word Error Rate (WER), due to the lack of future context compared with full-context ASR. Improving both WER and emission latency has been shown to be highly challenging (He et al., 2019; Li et al., 2020a; Sainath et al., 2020) in streaming ASR systems.
14
+
15
+ Since the acoustic, pronunciation, and language model (AM, PM, and LM) of a conventional ASR system have been evolved into a single end-to-end (E2E) all-neural network, modern streaming and full-context ASR models share most of the neural architectures and training recipes in common, such as, Mel-spectrogram inputs, data augmentations, neural network meta-architectures, training objectives, model regularization techniques and decoding methods. The most significant difference is that streaming ASR encoders are auto-regressive models, with the prediction of the current timestep conditioned on previous ones (no future context is permitted). Specifically, let $x$ and $y$ be the input and output sequence, $t$ as frame index, $T$ as total length of frames. Streaming ASR encoders model the output $y _ { t }$ as a function of input $x _ { 1 : t }$ while full-context ASR encoders model the output $y _ { t }$ as a function of input $x _ { 1 : T }$ . Streaming ASR encoders can be built with uni-directional LSTMs, causal convolution and left-context attention layers in streaming ASR encoders (Chiu & Raffel, 2018; Fan et al., 2018; Han et al., 2020; Gulati et al., 2020; Huang et al., 2020; Moritz et al., 2020; Miao et al., 2020; Tsunoo et al., 2020; Zhang et al., 2020; Yeh et al., 2019). Recurrent Neural Network Transducers (RNN-T) (Graves, 2012) are commonly used as the decoder in both streaming and fullcontext models, which predicts the token of the current input frame based on all previous tokens using uni-directional recurrent layers. Figure 1 illustrates a simplified example of the similarity and difference between streaming and full-context ASR models with E2E neural networks.
16
+
17
+ ![](images/d1f34c27d36c1a06c1d05b32cf8f7d91905338b9c64253cb7fcd9d2936456a44.jpg)
18
+ Figure 1: A simplified illustration of the similarity and difference between Streaming ASR and Fullcontext ASR networks. Modern end-to-end streaming and full-context ASR models share most of the neural architectures and training recipes in common, with the most significant difference in the ASR encoder (highlighted). Streaming ASR encoders are auto-regressive models, with each prediction of the current timestep conditioned on previous ones (no future context). We show examples of feed-forward layer, convolution layer and self-attention layer in the encoder of streaming and full-context ASR respectively. With Dual-mode ASR, we unify them without parameters overhead.
19
+
20
+ Albeit the similarities, streaming and full-context ASR models are usually developed, trained, and deployed separately. In this work, we propose Dual-mode ASR, a framework to unify streaming and full-context speech recognition networks with shared weights. Dual-mode ASR comes with many immediate benefits, including reduced model download and storage on devices and simplified development and deployment workflows. To accomplish this goal, we first introduce Dual-mode Encoders, which can run in both streaming mode and full-context mode. Dual-mode encoders are designed to reuse the same set of model weights for both modes with zero or near-zero parameters overhead. We propose the design principles of a dual-mode encoder and show examples on how to design dual-mode convolution, dual-mode pooling, and dual-mode attention layers. We also investigate into different training algorithms for Dual-mode ASR, specifically, randomly sampled training and joint training. We show that joint training significantly outperforms randomly sampled training in terms of model quality and training stability. Moreover, motivated by Inplace Knowledge Distillation (Yu & Huang, 2019b) in which a large model is used to supervise a small model, we propose to distill knowledge from the full-context mode (teacher) into the streaming mode (student) on the fly during the training within the same Dual-mode ASR model, by encouraging consistency of the predicted token probabilities.
21
+
22
+ We demonstrate that the emission latency and prediction accuracy of streaming ASR significantly benefit from weight sharing and joint training of its full-context mode, especially with inplace knowledge distillation during the training. We present extensive experiments with two state-of-theart ASR networks, convolution-based ContextNet (Han et al., 2020) and conv-transformer hybrid Conformer (Gulati et al., 2020), on two datasets, a widely used public dataset LibriSpeech (Panayotov et al., 2015) (970 hours of English reading speech) and a large-scale dataset MultiDomain (Narayanan et al., 2018) (413,000 hours speech of a mixture across multiple domains including Voice Search, Farfield Speech, YouTube and Meetings). For each proposed technique, we also present ablation study and analysis to demonstrate and understand the effectiveness. With Dual-mode ASR, we achieve new state-of-the-art streaming ASR results on both LibriSpeech and MultiDomain in terms of accuracy and latency.
23
+
24
+ # 2 RELATED WORK
25
+
26
+ Streaming ASR Networks. There has been a growing interest in building streaming ASR systems based on E2E Recurrent Neural Network Transducers (RNN-T) (Graves, 2012). Compared with sequence-to-sequence models (Chorowski et al., 2014; 2015; Chorowski & Jaitly, 2016; Bahdanau et al., 2016; Chan et al., 2016), RNN-T models are naturally streamable and have shown great potentials for low-latency streaming ASR (Chang et al., 2019; He et al., 2019; Tsunoo et al., 2019; Sainath et al., 2019; Shen et al., 2019; Li et al., 2020a;b; Sainath et al., 2020; Huang et al., 2020; Moritz et al., 2020; Narayanan et al., 2020). In this work, we mainly focus on RNN-T based models. He et al. specifically studied how to optimize the RNN-T streaming ASR model for mobile devices, and proposed a bag of techniques including using layer normalization and large batch size to stabilize training; using word-piece targets (Wu et al., 2016); using a time-reduction layer to speed up training and inference; quantizing network parameters to reduce memory footprint and speed up computation; applying shallow-fusion to bias towards user-specific context. To support streaming modeling in E2E ASR models, various efforts have also been made by modifying attention-based models such as monotonic attention (Raffel et al., 2017; Chiu & Raffel, 2017; Fan et al., 2018; Arivazhagan et al., 2019), GMM attention (Graves, 2013; Chiu et al., 2019), triggered attention (TA) (Moritz et al., 2019), Scout Network (Wang et al., 2020), and approaches that segment encoder output into non-overlapping chunks (Jaitly et al., 2016; Tsunoo et al., 2020). Tsunoo et al. also applied knowledge distillation from the non-streaming model to the streaming model, but their streaming and non-streaming models do not share weights and are trained separately.
27
+
28
+ To improve the latency of RNN-T streaming models, Li et al. investigated additional early and late penalties on Endpointer prediction (Chang et al., 2019) to reduce the emission latency, and employed the minimum word error rate (MWER) training (Prabhavalkar et al., 2018) to remedy accuracy degradation. Sainath et al. further proposed to improve quality by using two-pass models (Sainath et al., 2019), i.e., a second-pass LAS-based rescore model on top of the hypotheses from first-pass RNN-T streaming output. More recently, Li et al. proposed parallel rescoring by replacing LSTMs with Transformers (Vaswani et al., 2017) in rescoring models. Chang et al. further proposed Prefetching to reduce system latency by submitting partial recognition results for subsequent processing such as obtaining assistant server responses or second-pass rescoring before the recognition result is finalized. Unlike these approaches, our work explores the unification of streaming and fullcontext ASR networks, thus can be generally applied as an add-on technique without requiring extra runtime support during inference.
29
+
30
+ Weight Sharing for Multi-tasking. Sharing model weights of a deep neural network for multiple tasks has been widely explored in the literature to reduce overall model sizes. In the broadest sense, tasks can refer to different objectives or same objective but different settings, ranging from natural language processing and speech recognition to computer vision and reinforcement learning. In speech recognition, Kannan et al. employed a single ASR network for multilingual ASR, and showed accuracy improvements over monolingual ASR systems. Wu et al. proposed dynamic sparsity neural networks (DSNN) for speech recognition on mobile devices with resource constraints. A single trained DSNN (Wu et al., 2020) can transform into multiple networks of different sparsities for adaptive inference in real-time. Chang et al. trained a single RNN-T model with LSTMs (Hochreiter & Schmidhuber, 1997) for Joint Endpointing (i.e., predicting both recognition tokens and the end of an utterance transcription) in streaming ASR systems. Moreover, Watanabe et al. proposed a hybrid CTC and attention architecture for ASR based on multi-objective learning to eliminate the use of linguistic resources.
31
+
32
+ Another related research work in Computer Vision is Slimmable Neural Networks (Yu et al., 2018; Yu & Huang, 2019a;b; Yu et al., 2020). Yu et al. proposed an approach to train a single neural network running at different widths, permitting instant and adaptive accuracy efficiency trade-offs at runtime. We also adapt the training rules introduced in slimmable networks, that is, using independent normalization layers for different sub-networks (tasks) as conditional parameters and using the prediction of teacher network to supervise student network as inplace distillation during the training. Unlike slimmable networks in which a large model is used to supervise a small model, we propose to distill the knowledge from full-context mode (teacher) into streaming mode (student) on the fly within the same Dual-mode ASR model.
33
+
34
+ Knowledge Distillation. Hinton et al. explored a simple method to “transfer” knowledge from a teacher neural network to a student neural network by enforcing their predictions to be close measured by KL-divergence, $\ell _ { 1 }$ or $\ell _ { 2 }$ distance. It is shown that such distillation method is effective to compress neural networks (Yu & Huang, 2019b), accelerate training (Chen et al., 2015), improve robustness (Carlini & Wagner, 2017; Papernot et al., 2016), estimate model uncertainty (Blundell et al., 2015) and transfer learned domain to other domains (Tzeng et al., 2015).
35
+
36
+ # 3 DUAL-MODE ASR
37
+
38
+ Most neural sequence transduction networks for ASR have an encoder-decoder structure (Graves, 2012; Sainath et al., 2020; He et al., 2019; Li et al., 2020a), as shown in Figure 1. Without loss of generality, here we discuss how to design Dual-mode ASR networks under the most commonly used RNN-T model (Graves, 2012). In RNN-T models, we first extract mel-spectrogram feature from input speech waveform. The Mel-spectrogram feature is then fed into a neural-net encoder, which usually consists of feed-forward layers, RNN/LSTM layers, convolution layers, attention layers, pooling (time-reduction) layers, and residual or dense connections. In neural-net encoders, streaming ASR model requires all components to be auto-regressive, whereas full-context ASR model has no such requirement. The ASR decoder then predicts the token of current frame based on the output from the encoder and previous predicted tokens (inference) or target tokens (training with teacher forcing (Williams & Zipser, 1989)). The decoder is commonly an auto-regressive model in both streaming and full-context ASR models, thus is fully shared in Dual-mode ASR. The prediction from decoder is finally used either in decoding algorithm during inference (e.g., beam search) or learning algorithm during training (e.g., RNN-T loss).
39
+
40
+ As discussed above and shown in Figure 1, it becomes clear that the major difference between streaming and full-context ASR models is in the neural-net encoder. In the following, we will first discuss the design principles of dual-mode encoder to support both streaming and full-context ASR. We provide examples including dual-mode convolution, dual-mode average pooling, and dual-mode attention layers, which are widely used in the state-of-the-art ASR networks ContextNet (Han et al., 2020) and Conformer (Gulati et al., 2020). We will then discuss the training algorithm of Dual-mode ASR networks including joint training and inplace knowledge distillation.
41
+
42
+ # 3.1 DUAL-MODE ENCODER
43
+
44
+ Unifying streaming and full-context ASR models requires two design principles of Dual-mode Encoder:
45
+
46
+ 1. Each layer in a dual-mode encoder should be either dual-mode or streaming (a.k.a., causal). Since streaming encoder has to be auto-regressive which prohibits any future context, any full-context (a.k.a., non-causal) layer violates this constraint.
47
+ 2. The design of a dual-mode layer should not introduce significant amount of additional parameters, compared with its streaming model. We aim at supporting full-context ASR on top of the streaming model with near-zero parameters overhead.
48
+
49
+ We show examples below by applying the above two design principles to ContextNet (Han et al., 2020) and Conformer (Gulati et al., 2020), in which the encoders are composed of pointwise operators (feed-forward net, residual connections, activation layers, striding, dropout, etc.), convolution, average pooling, self-attention and normalization layers.
50
+
51
+ Pointwise operators are naturally dual-mode layers. Neural network layers that connect input and output neurons within each timestep (no across-connections among different timesteps) are often referred as pointwise operators (Chollet, 2017), including feed-forward layers (a.k.a., fullyconnected layers or $1 \times 1$ convolution layers), activation layers (e.g., ReLU, Swish (Ramachandran et al., 2017)), residual and dense connections (He et al., 2016; Huang et al., 2017), striding layers, dropout layers (Srivastava et al., 2014) and element-wise multiplications. As there is no information propagation through time, pointwise operators are naturally dual-mode layers and can be directly used in Dual-mode ASR encoders.
52
+
53
+ ![](images/f0ab9aa67a0046df1f58ffff9f82dde0ba719a2847b80d942aac195b112a5175.jpg)
54
+ Figure 2: Dual-mode convolution and average pooling layer for Dual-mode ASR.
55
+
56
+ Dual-mode Convolution. Convolution layers, however, convolve feature across its neighbor timesteps within a fixed window (e.g., kernel size is 3, 5, or larger), and has been widely used in sequence modeling (Gehring et al., 2017; Han et al., 2020; Gulati et al., 2020). In conv-based streaming ASR models, causal convolution layers (Oord et al., 2016) are used where the convolution window is biased to the left (self-included). As shown in Figure 2 on the left, to support both streaming and full-context modes with shared weights, we first construct a normal symmetric convolution of kernel size $k$ which will be applied in full-context mode. Then we mimic the causal convolution of kernel size $( k + 1 ) / 2$ by constructing a Boolean mask and multiplying with the fullcontext convolution kernel before applying the actual convolution of streaming mode in Dual-mode ASR encoders.
57
+
58
+ The design of dual-mode convolution introduces $( k - 1 ) / 2$ additional parameters to support fullcontext convolution $( k )$ compared with streaming convolution $( ( k + 1 ) / 2 )$ . However, we note that in convolution-based models, these temporal-wise convolution layers only take a tiny amount of total model size and most of the weights are on $1 \times 1$ convolution layers which are fully shared pointwise operators. For example, in ContextNet (Han et al., 2020), temporal-wise convolution has less than $1 \%$ of total model size, thus parameters overhead is negligible.
59
+
60
+ Dual-mode Average Pooling. Squeeze-and-excitation (Hu et al., 2018) (SE) modules are used in ContextNet to enhance the global context encoding. Each SE module is a sequential stack of average pooling (through time) layer, feed-forward layer, activation layer, another feed-forward layer and elementwise multiplication. To support both modes, dual-mode average pooling layer is used as shown in Figure 2 on the right. Dual-mode average pooling layer is parameter-free thus does not introduce additional model parameters. It also trains in parallel in streaming mode, easily implemented with “cumsum” function in both TensorFlow and PyTorch.
61
+
62
+ Dual-mode Self-attention. Self-attention (a.k.a. intra-attention) is an attention mechanism weighting different positions of a single sequence in order to compute a representation of the same sequence. It is heavily used in Conformer (Gulati et al., 2020) ASR networks. The attention layer itself is parameter-free (projection layers before attention are fully shared), and is composed of matrix multiplication of the key and the query, followed by softmax over keys, before another matrix multiplication with the value. As shown in Figure 3, in dual-mode attention layer, the softmax is performed on the left context only in streaming mode (rectangle with solid line), compared with the full-context mode (rectangle with dash line). We find this simple form of dual-mode self-attention works well in practice.
63
+
64
+ ![](images/4f528f18a6c4aa9e2a4f6bb67f082a371fc76eca55334f921678afdf1c5f1264.jpg)
65
+ Figure 3: Dual-mode self-attention layer.
66
+
67
+ # Algorithm 1 Pseudocode of training Dual-mode ASR networks.
68
+
69
+ # Requires: data_loader; context manager with support of mode switching by network.mode(); dual_mode_network with support of running both modes under context manager;
70
+ for x, y in data_loader: # Load a minibatch of speech input x and text label y. with dual_mode_network.mode(’fullcontext’): # Switch context to ’fullcontext’ mode. # Compute full-context prediction given speech input x and text label y. fullcontext_pred $=$ dual_mode_network.forward_encoder_decoder(x, y) # Compute RNN-T loss of full-context mode. fullcontext_loss $=$ rnnt_loss(fullcontext_pred, y)
71
+
72
+ with dual_mode_network.mode(’streaming’): # Switch context to ’streaming’ mode. # Compute streaming prediction given speech input x and text label y. streaming_pred $=$ dual_mode_network.forward_encoder_decoder(x, y) # Compute RNN-T loss of streaming mode. streaming_loss $=$ rnnt_loss(streaming_pred, y)
73
+
74
+ # Add inplace knowledge distillation loss (full-context prediction as teacher). distill_loss $=$ inplace_distill_loss(streaming_pred, stop_gradient(fullcontext_pred)
75
+
76
+ # Compute total loss as a sum of full-context, streaming and distillation losses. loss $=$ fullcontext_loss $^ +$ streaming_loss $^ +$ distill_loss
77
+ loss.backward() # Update weights.
78
+
79
+ Dual-mode Normalization. Moreover, following Yu et al. (2018), we also find the normalization statistics like means and variances are different in streaming and full-context modes. Thus, for normalization layers including BatchNorm (Ioffe & Szegedy, 2015) and LayerNorm (Ba et al., 2016) in Dual-mode ContextNet and Dual-mode Conformer, we instantiate two separate norm layers dedicated to streaming and full-context mode respectively.
80
+
81
+ # 3.2 TRAINING DUAL-MODE ASR NETWORKS
82
+
83
+ The training algorithm of Dual-mode ASR networks is outlined in Algorithm 1. In this section, we discuss two important training techniques: joint training and inplace knowledge distillation.
84
+
85
+ Joint Training. To train Dual-mode ASR networks, given a batch of data in each training iteration, we can either randomly sample one from two modes to train, or train both modes and aggregate their losses. In the former approach, referred as randomly sampled training, we can control the importance of streaming and full-context modes by setting different sampling probabilities during training. In the latter approach, referred as joint training, importance can also be controlled by assigning different loss weights to balance streaming and full-context modes. Empirically we find joint training leads to better model qualities overall thus is adopted in all of our experiments. We will show an ablation study comparing randomly sampled training and joint training. In all of our experiments, we treat streaming and full-context mode to be equally important by assigning equal importance during training.
86
+
87
+ Inplace Knowledge Distillation. Additionally we propose to distill knowledge from the full-context mode (teacher) into the streaming mode (student) on the fly within the same Dual-mode ASR model, by encouraging consistency of the predicted token probabilities. Since in each iteration we always compute predictions of both modes, the teacher prediction comes for free (no additional computation or memory cost), as shown in Algorithm 1. We use the efficient knowledge distillation introduced by Panchapagesan et al., which is based on the KL-divergence between full-context and streaming over the probability of three parts: $P _ { l a b e l }$ , $P _ { b l a n k }$ and $1 - P _ { l a b e l } - P _ { b l a n k }$ . We note that the prediction of full-context mode (teacher) usually has lower latency (since it has no incentive to delay its output), thus we can control the target emission latency of streaming mode (student) by shifting the prediction of full-context mode, before applying distillation loss. We do a small-scale hyper-parameter sweep from -2 to 2 frames to shift for ContextNet and Conformer in our experiments.
88
+
89
+ # 4 EXPERIMENTS
90
+
91
+ # 4.1 MAIN RESULT
92
+
93
+ Measuring Latency. Latency measurement is itself challenging for streaming ASR systems. Motivated by Prefetching (Chang et al., 2020) technique, we measure latency as the difference of two timestamps: 1) when the last token is emitted in the finalized recognition result; 2) the end of the speech when a user finishes speaking. We find this is especially descriptive of user experience in real-world ASR applications like Voice Search. ASR models that capture stronger contexts can emit the full hypothesis even before they are spoken, leading to a negative latency. Moreover, instead of naively averaging latency over all utterances, we report both median and 90th percentile of all utterances in test set, denoted as Latency $\textcircled{6} 5 \mathbf { 0 }$ and Latency $@ 9 0$ , to better characterize latency by excluding outlier utterances. To evaluate the model quality, we report WER only for full-context models and both WER and latency for streaming models (full-context latency is meaningless).
94
+
95
+ Datasets. We conduct our experiments on two datasets: a public widely used dataset LibriSpeech (Panayotov et al., 2015) (1,000 hours of English reading speech) and a large-scale dataset MultiDomain (413,000 hours speech, 287 million utterances of a mixture across multiple domains including Voice Search, YouTube, and Meetings). Table 1 summarizes the information and statistics of two datasets. For LibriSpeech, we report our evaluation results on TestClean and TestOther (noisy) sets and compare with other published baselines. For MultiDomain, we report our evaluation results on Voice Search test set and compare with our reproduced baselines. For fair comparisons, on each dataset we train and report our models and baselines with the same settings (number of training iterations, hyper-parameters, optimizer, regularization, etc.). We note that these hyper-parameters are inherited from previous work Han et al. (2020); Gulati et al. (2020) and not specifically tuned for our dual-mode models.
96
+
97
+ Table 1: Summary of datasets we used in our experiments.
98
+
99
+ <table><tr><td>Dataset Name</td><td>#Hours</td><td># Utterances</td><td>Speech Domain</td></tr><tr><td>LibriSpeech (Panayotov et al., 2015)</td><td>~970</td><td>~ 281,000</td><td>Single domain of English reading speech.</td></tr><tr><td>MultiDomain (Narayanan et al., 2018)</td><td>~ 413,000</td><td>~ 287,000,000</td><td>Multiple domains including: Voice Search, Farfield Speech, YouTube and Meetings.</td></tr></table>
100
+
101
+ ASR Networks. We use two recent state-of-the-art ASR networks to demonstrate the effectiveness of our proposed methods, ContextNet (Han et al., 2020) and Conformer (Gulati et al., 2020). The encoder of ContextNet is based on depthwise-separable convolution (Chollet, 2017) and squeezeand-excitation modules (Hu et al., 2018). In depthwise-separable convolution of Dual-mode ContextNet, the weights of $1 \times 1$ convolutions are fully shared between streaming and full-context mode, whereas for temporal-wise convolution we follow the design of Dual-mode Convolution proposed in Section 3.1. Note that in ContextNet, temporal-wise convolutions only take less than $1 \%$ of the model size thus the parameters overhead of full-context mode is negligible compared with steaming mode. In squeeze-and-excitation modules, we use dual-mode average pooling layers (Section 3.1) to support both streaming and full-context mode without additional parameters.
102
+
103
+ Conformer (Gulati et al., 2020) combines convolution and transformer to model both local and global dependencies of speech sequences in a parameter-efficient way. In Dual-mode Conformer, we replace all convolution and transformer layers with their dual-mode correspondents (Section 3.1). Moreover, for normalization layers including BatchNorm (Ioffe & Szegedy, 2015) and LayerNorm (Ba et al., 2016) in Dual-mode ContextNet and Dual-mode Conformer, we instantiate two separate norm layers for streaming and full-context mode respectively.
104
+
105
+ Training Details and Results. We train our models exactly following our baselines ContextNet (Han et al., 2020) and Conformer (Gulati et al., 2020), using Adam optimizer (Kingma & Ba, 2014), SpecAugment (Park et al., 2019) and a transformer learning rate schedule (Vaswani et al., 2017) with warm-up (Goyal et al., 2017). Our main results are summarized in Table 2 and Table 3. We also add a streaming ContextNet Look-ahead baseline (6 frames, 10ms per frame, totally 60ms look-ahead latency) in Table 3 by padding additional frames at the end of the input utterances. As shown in the tables, the streaming mode in Dual-mode ASR models has significantly better latency and similar or higher WER results, surpassing other baselines including conventional models, LSTM-based transducers (Sainath et al., 2020), transformer-transducers (Zhang et al., 2020) and some others.
106
+
107
+ Table 2: Summary of our results on MultiDomain dataset (Narayanan et al., 2018). We report WER on Voice Search test set. Compared with standalone ContextNet and Conformer models, Dual-mode ASR models have slightly higher accuracy and much better streaming latency. ASR models that capture stronger contexts can emit the full hypothesis even slightly before they are spoken, leading to a negative latency.
108
+
109
+ <table><tr><td>Method</td><td>Mode</td><td># Params (M)</td><td>VS Test WER(%)</td><td>Latency @50 (ms)</td><td>Latency @90 (ms)</td></tr><tr><td>ContextNet Conformer</td><td>Full-context Full-context</td><td>133 142</td><td>5.1 5.2</td><td></td><td></td></tr><tr><td>LSTM (Sainath et al., 2020) ContextNet (Han et al.,2020)</td><td>Streaming Streaming</td><td>179 133</td><td>6.4 6.1</td><td>190 160</td><td>350 310</td></tr><tr><td>Conformer (Gulati et al., 2020) Dual-mode ContextNet</td><td>Streaming Full-context</td><td>142 133</td><td>6.1 4.9</td><td>160</td><td>300</td></tr><tr><td>Dual-mode Conformer</td><td>Streaming Full-context Streaming</td><td>142</td><td>6.0 (-0.1) 5.0 6.0 (-0.1)</td><td>10 (-150) -50 (-210)</td><td>220 (-90) 130 (-170)</td></tr></table>
110
+
111
+ Table 3: Summary of our results on Librispeech dataset (Panayotov et al., 2015). We report WER on TestClean and TestOther (noisy) set. Compared with standalone ContextNet and Conformer models, Dual-mode ASR models have both higher accuracy in average and better streaming latency.
112
+
113
+ <table><tr><td>Method</td><td>Mode</td><td># Params (M)</td><td>Test Clean/Other WER(%)</td><td></td><td>Latency@50 (ms)</td><td>Latency @90 (ms)</td></tr><tr><td>LSTM-LAS</td><td>Full-context</td><td>360</td><td>2.6 /</td><td>6.0</td><td></td><td></td></tr><tr><td>QuartzNet-CTC</td><td>Full-context</td><td>19</td><td>3.9 /</td><td>11.3</td><td></td><td></td></tr><tr><td>Transformer</td><td>Full-context</td><td>29</td><td>3.1 /</td><td>7.3</td><td></td><td></td></tr><tr><td>Transformer</td><td>Full-context</td><td>139</td><td>2.4 /</td><td>5.6</td><td></td><td></td></tr><tr><td>ContextNet</td><td>Full-context</td><td>31.4</td><td>2.4 /</td><td>5.4</td><td></td><td></td></tr><tr><td>Conformer</td><td>Full-context</td><td>30.7</td><td>2.3 /</td><td>5.0</td><td></td><td></td></tr><tr><td>Transformer</td><td>Streaming</td><td>18.9</td><td>5.0 /</td><td>11.6</td><td>80</td><td>190</td></tr><tr><td>ContextNet</td><td>Streaming</td><td>31.4</td><td>4.5 /</td><td>10.0</td><td>70</td><td>270</td></tr><tr><td>Conformer</td><td>Streaming</td><td>30.7</td><td>4.6</td><td>9.9</td><td>140</td><td>280</td></tr><tr><td>ContextNet Look-ahead</td><td>Streaming</td><td>31.4</td><td>4.1 /</td><td>9.0</td><td>150</td><td>420</td></tr><tr><td>Dual-mode Transformer</td><td>Full-context Streaming</td><td>29</td><td>3.1 4.4 (-0.6)</td><td>/7.9 ) / 11.5 (-0.1)</td><td>-50 (-130)</td><td>30 (-160)</td></tr><tr><td>Dual-mode ContextNet</td><td>Full-context Streaming Full-context</td><td>31.8</td><td>2.3 / 5.3 3.9 (-0.6) / 8.5 (-1.5) 2.5 / 5.9</td><td></td><td>40 (-30)</td><td>160 (-110)</td></tr><tr><td>Dual-mode Conformer</td><td>Streaming</td><td>30.7</td><td>3.7 (-0.9) /</td><td>/9.2 (-0.7)</td><td>10 (-130)</td><td>90 (-190)</td></tr></table>
114
+
115
+ # 4.2 ABLATION STUDY
116
+
117
+ In this section, we perform various ablation studies to support and understand the effectiveness of each technique in Dual-mode ASR. We train Dual-mode ContextNet on LibriSpeech training set with exactly same settings and report WER, Latency $\textcircled { a } 5 0$ and Latency $@ 9 0$ on TestOther set of streaming mode. We specifically study three techniques and their combinations including weight sharing, joint training and inplace knowledge distillation during the training.
118
+
119
+ During the training we distill knowledge from full-context mode (teacher) into streaming mode (student) on the fly within the same dual-mode model. Inplace distillation during the training comes for free as shown in training Algorithm 1. But what if we simply share weights and jointly train them without distillation? As shown in the second row of Table 4, the model without inplace distillation during the training has worse results compared to the baseline.
120
+
121
+ Given a batch of data for each training iteration, we train both modes and aggregate their losses. We also show results of randomly sampled training in the third row of Table 4, which leads to even worse performance. Note that with randomly sampled training, we cannot apply inplace distillation easily either because in each training iteration there is only one prediction from either streaming mode or full-context mode.
122
+
123
+ Weight sharing reduces the model size which is one of the major motivation of Dual-mode ASR. However, what if we simply train two individual models and use knowledge distillation with fullcontext model as the teacher? As shown in the last row of Table 4, the results are better than other ablation but still worse than the Dual-mode ASR baseline. It might indicate that weight sharing itself encourages learning better deep representation for streaming ASR. Weight sharing has been shown empirically to improve Multilingual ASR (Kannan et al., 2019), Model Pruning (Wu et al., 2020), Endpointing (Hochreiter & Schmidhuber, 1997) and some Computer Vision problems (Yu et al., 2018) and this intriguing property need to be studied in more details as a future work.
124
+
125
+ Table 4: Ablation studies of weight sharing, joint training and inplace distillation. We report WER on TestOther (noisy) set (Panayotov et al., 2015) using ContextNet with same training settings.
126
+
127
+ <table><tr><td>Weight Sharing</td><td>Joint Training</td><td>Inplace Distillation</td><td>TestOther WER(%)</td><td>Latency@50 (ms)</td><td>Latency @90 (ms)</td></tr><tr><td></td><td></td><td>r</td><td>8.5</td><td>40</td><td>160</td></tr><tr><td>&lt;</td><td></td><td>×</td><td>10.2 (+1.7)</td><td>120 (+80)</td><td>310 (+150)</td></tr><tr><td>厂</td><td>×</td><td>×</td><td>10.6 (+2.1)</td><td>90 (+50)</td><td>290 (+130)</td></tr><tr><td>×</td><td></td><td>?</td><td>9.9 (+1.4)</td><td>50 (+10)</td><td>210 (+50)</td></tr></table>
128
+
129
+ Further, we visualize the emission lattices of dual-mode ASR models trained with and without inplace knowledge distillation. We randomly sampled two audio sequences on LibriSpeech TestOther set and plotted their emission lattices of streaming mode in Figure 4. X-axis represents the speech input frames while Y-axis represents the text output labels (tokens). Figure 4 shows that with knowledge distillation from full-context mode in Dual-mode ASR, streaming mode emits faster and has much less latency, which is very critical for product datasets like MultiDomain presented in our work.
130
+
131
+ ![](images/2790e3f68de9406341cefca41a790dd745ff79ccd9bab20b7914a7f7f1c84193.jpg)
132
+ Figure 4: Two speech-text pair comparison of Dual-model ASR models trained with and without inplace distillation by visualization of their streaming emission lattices. $\mathbf { X }$ -axis represents the speech input frames while Y-axis represents the text output labels (tokens). Inplace distillation significantly reduces emission latency of streaming mode in Dual-mode ASR models which is critical in realworld applications.
133
+
134
+ # 5 CONCLUSION
135
+
136
+ In this work, we have proposed a unified framework, Dual-mode ASR, to unify and improve streaming ASR by joint full-context modeling. We hope our exploration will inspire streaming models in other fields such as simultaneous machine translation and video processing.
137
+
138
+ # REFERENCES
139
+
140
+ Naveen Arivazhagan, Colin Cherry, Wolfgang Macherey, Chung-Cheng Chiu, Semih Yavuz, Ruoming Pang, Wei Li, and Colin Raffel. Monotonic infinite lookback attention for simultaneous machine translation. In ACL, 2019.
141
+
142
+ Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016.
143
+
144
+ Dzmitry Bahdanau, Jan Chorowski, Dmitriy Serdyuk, Philemon Brakel, and Yoshua Bengio. Endto-end attention-based large vocabulary speech recognition. In 2016 IEEE international conference on acoustics, speech and signal processing (ICASSP), pp. 4945–4949. IEEE, 2016.
145
+
146
+ Charles Blundell, Julien Cornebise, Koray Kavukcuoglu, and Daan Wierstra. Weight uncertainty in neural networks. arXiv preprint arXiv:1505.05424, 2015.
147
+
148
+ Nicholas Carlini and David Wagner. Towards evaluating the robustness of neural networks. In 2017 ieee symposium on security and privacy (sp), pp. 39–57. IEEE, 2017.
149
+
150
+ William Chan, Navdeep Jaitly, Quoc Le, and Oriol Vinyals. Listen, attend and spell: A neural network for large vocabulary conversational speech recognition. In 2016 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 4960–4964. IEEE, 2016.
151
+
152
+ Shuo-Yiin Chang, Rohit Prabhavalkar, Yanzhang He, Tara N Sainath, and Gabor Simko. Joint endpointing and decoding with end-to-end models. In ICASSP 2019-2019 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 5626–5630. IEEE, 2019.
153
+
154
+ Shuo-Yiin Chang, Bo Li, David Rybach, Yanzhang He, Wei Li, Tara Sainath, and Trevor Strohman. Low latency speech recognition using end-to-end prefetching. In Interspeech. ISCA, 2020.
155
+
156
+ Tianqi Chen, Ian Goodfellow, and Jonathon Shlens. Net2net: Accelerating learning via knowledge transfer. arXiv preprint arXiv:1511.05641, 2015.
157
+
158
+ Chung-Cheng Chiu and Colin Raffel. Monotonic chunkwise attention. arXiv preprint arXiv:1712.05382, 2017.
159
+
160
+ Chung-Cheng Chiu and Colin Raffel. Monotonic chunkwise attention. In International Conference on Learning Representations, 2018.
161
+
162
+ Chung-Cheng Chiu, Wei Han, Yu Zhang, Ruoming Pang, Sergey Kishchenko, Patrick Nguyen, Arun Narayanan, Hank Liao, Shuyuan Zhang, Anjuli Kannan, Rohit Prabhavalkar, Zhifeng Chen, Tara Sainath, and Yonghui Wu. A comparison of end-to-end models for long-form speech recognition. In ASRU, 2019.
163
+
164
+ Franc¸ois Chollet. Xception: Deep learning with depthwise separable convolutions. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1251–1258, 2017.
165
+
166
+ Jan Chorowski and Navdeep Jaitly. Towards better decoding and language model integration in sequence to sequence models. arXiv preprint arXiv:1612.02695, 2016.
167
+
168
+ Jan Chorowski, Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. End-to-end continuous speech recognition using attention-based recurrent nn: First results. arXiv preprint arXiv:1412.1602, 2014.
169
+
170
+ Jan K Chorowski, Dzmitry Bahdanau, Dmitriy Serdyuk, Kyunghyun Cho, and Yoshua Bengio. Attention-based models for speech recognition. In Advances in neural information processing systems, pp. 577–585, 2015.
171
+
172
+ Ruchao Fan, Pan Zhou, Wei Chen, Jia Jia, and Gang Liu. An online attention-based model for speech recognition. arXiv preprint arXiv:1811.05247, 2018.
173
+
174
+ Jonas Gehring, Michael Auli, David Grangier, Denis Yarats, and Yann N Dauphin. Convolutional sequence to sequence learning. arXiv preprint arXiv:1705.03122, 2017.
175
+
176
+ 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.
177
+
178
+ Alex Graves. Sequence transduction with recurrent neural networks. arXiv preprint arXiv:1211.3711, 2012.
179
+
180
+ Alex Graves. Generating sequences with recurrent neural networks, 2013.
181
+
182
+ Anmol Gulati, James Qin, Chung-Cheng Chiu, Niki Parmar, Yu Zhang, Jiahui Yu, Wei Han, Shibo Wang, Zhengdong Zhang, Yonghui Wu, et al. Conformer: Convolution-augmented transformer for speech recognition. arXiv preprint arXiv:2005.08100, 2020.
183
+
184
+ Wei Han, Zhengdong Zhang, Yu Zhang, Jiahui Yu, Chung-Cheng Chiu, James Qin, Anmol Gulati, Ruoming Pang, and Yonghui Wu. Contextnet: Improving convolutional neural networks for automatic speech recognition with global context. arXiv preprint arXiv:2005.03191, 2020.
185
+
186
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016.
187
+
188
+ Yanzhang He, Tara N Sainath, Rohit Prabhavalkar, Ian McGraw, Raziel Alvarez, Ding Zhao, David Rybach, Anjuli Kannan, Yonghui Wu, Ruoming Pang, et al. Streaming end-to-end speech recognition for mobile devices. In ICASSP 2019-2019 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 6381–6385. IEEE, 2019.
189
+
190
+ Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015.
191
+
192
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997.
193
+
194
+ Jie Hu, Li Shen, and Gang Sun. Squeeze-and-excitation networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 7132–7141, 2018.
195
+
196
+ Gao Huang, Zhuang Liu, Laurens Van Der Maaten, and Kilian Q Weinberger. Densely connected convolutional networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 4700–4708, 2017.
197
+
198
+ Wenyong Huang, Wenchao Hu, Yu Ting Yeung, and Xiao Chen. Conv-transformer transducer: Low latency, low frame rate, streamable end-to-end speech recognition. arXiv preprint arXiv:2008.05750, 2020.
199
+
200
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. arXiv preprint arXiv:1502.03167, 2015.
201
+
202
+ Navdeep Jaitly, Quoc V Le, Oriol Vinyals, Ilya Sutskever, David Sussillo, and Samy Bengio. An online sequence-to-sequence model using partial conditioning. In Advances in Neural Information Processing Systems 29, pp. 5067–5075, 2016.
203
+
204
+ Anjuli Kannan, Arindrima Datta, Tara N Sainath, Eugene Weinstein, Bhuvana Ramabhadran, Yonghui Wu, Ankur Bapna, Zhifeng Chen, and Seungji Lee. Large-scale multilingual speech recognition with a streaming end-to-end model. arXiv preprint arXiv:1909.05330, 2019.
205
+
206
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
207
+
208
+ Bo Li, Shuo-yiin Chang, Tara N Sainath, Ruoming Pang, Yanzhang He, Trevor Strohman, and Yonghui Wu. Towards fast and accurate streaming end-to-end asr. In ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 6069–6073. IEEE, 2020a.
209
+
210
+ Wei Li, James Qin, Chung-Cheng Chiu, Ruoming Pang, and Yanzhang He. Parallel rescoring with transformer for streaming on-device speech recognition. arXiv preprint arXiv:2008.13093, 2020b.
211
+
212
+ Haoran Miao, Gaofeng Cheng, Changfeng Gao, Pengyuan Zhang, and Yonghong Yan. Transformerbased online ctc/attention end-to-end speech recognition architecture. In ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 6084– 6088. IEEE, 2020.
213
+
214
+ Niko Moritz, Takaaki Hori, and Jonathan Le Roux. Triggered attention for end-to-end speech recognition. In ICASSP 2019-2019 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 5666–5670. IEEE, 2019.
215
+
216
+ Niko Moritz, Takaaki Hori, and Jonathan Le. Streaming automatic speech recognition with the transformer model. In ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 6074–6078. IEEE, 2020.
217
+
218
+ Arun Narayanan, Ananya Misra, Khe Chai Sim, Golan Pundak, Anshuman Tripathi, Mohamed Elfeky, Parisa Haghani, Trevor Strohman, and Michiel Bacchiani. Toward domain-invariant speech recognition via large scale training. In 2018 IEEE Spoken Language Technology Workshop (SLT), pp. 441–447. IEEE, 2018.
219
+
220
+ Arun Narayanan, Tara N Sainath, Ruoming Pang, Jiahui Yu, Chung-Cheng Chiu, Rohit Prabhavalkar, Ehsan Variani, and Trevor Strohman. Cascaded encoders for unifying streaming and non-streaming asr. arXiv preprint arXiv:2010.14606, 2020.
221
+
222
+ Aaron van den Oord, Sander Dieleman, Heiga Zen, Karen Simonyan, Oriol Vinyals, Alex Graves, Nal Kalchbrenner, Andrew Senior, and Koray Kavukcuoglu. Wavenet: A generative model for raw audio. arXiv preprint arXiv:1609.03499, 2016.
223
+
224
+ Vassil Panayotov, Guoguo Chen, Daniel Povey, and Sanjeev Khudanpur. Librispeech: an asr corpus based on public domain audio books. In 2015 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 5206–5210. IEEE, 2015.
225
+
226
+ Sankaran Panchapagesan, Daniel S Park, Chung-Cheng Chiu, Yuan Shangguan, Qiao Liang, and Alexander Gruenstein. Efficient knowledge distillation for rnn-transducer models. arXiv preprint arXiv:2011.06110, 2020.
227
+
228
+ Nicolas Papernot, Patrick McDaniel, Xi Wu, Somesh Jha, and Ananthram Swami. Distillation as a defense to adversarial perturbations against deep neural networks. In 2016 IEEE Symposium on Security and Privacy (SP), pp. 582–597. IEEE, 2016.
229
+
230
+ Daniel S Park, William Chan, Yu Zhang, Chung-Cheng Chiu, Barret Zoph, Ekin D Cubuk, and Quoc V Le. Specaugment: A simple data augmentation method for automatic speech recognition. arXiv preprint arXiv:1904.08779, 2019.
231
+
232
+ Rohit Prabhavalkar, Tara N Sainath, Yonghui Wu, Patrick Nguyen, Zhifeng Chen, Chung-Cheng Chiu, and Anjuli Kannan. Minimum word error rate training for attention-based sequence-tosequence models. In 2018 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 4839–4843. IEEE, 2018.
233
+
234
+ C. Raffel, M. Luong, P. J. Liu, R.J. Weiss, and D. Eck. Online and Linear-Time Attention by Enforcing Monotonic Alignments. In Proc. ICML, 2017.
235
+
236
+ Prajit Ramachandran, Barret Zoph, and Quoc V Le. Searching for activation functions. arXiv preprint arXiv:1710.05941, 2017.
237
+
238
+ Tara N Sainath, Ruoming Pang, David Rybach, Yanzhang He, Rohit Prabhavalkar, Wei Li, Mirko´ Visontai, Qiao Liang, Trevor Strohman, Yonghui Wu, et al. Two-pass end-to-end speech recognition. arXiv preprint arXiv:1908.10992, 2019.
239
+
240
+ Tara N Sainath, Yanzhang He, Bo Li, Arun Narayanan, Ruoming Pang, Antoine Bruguier, Shuoyiin Chang, Wei Li, Raziel Alvarez, Zhifeng Chen, et al. A streaming on-device end-to-end model surpassing server-side conventional model quality and latency. In ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 6059–6063. IEEE, 2020.
241
+
242
+ Jonathan Shen, Patrick Nguyen, Yonghui Wu, Zhifeng Chen, Mia X Chen, Ye Jia, Anjuli Kannan, Tara Sainath, Yuan Cao, Chung-Cheng Chiu, et al. Lingvo: a modular and scalable framework for sequence-to-sequence modeling. arXiv preprint arXiv:1902.08295, 2019.
243
+
244
+ Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. The journal of machine learning research, 15(1):1929–1958, 2014.
245
+
246
+ Emiru Tsunoo, Yosuke Kashiwagi, Toshiyuki Kumakura, and Shinji Watanabe. Towards online end-to-end transformer automatic speech recognition. arXiv preprint arXiv:1910.11871, 2019.
247
+
248
+ Emiru Tsunoo, Yosuke Kashiwagi, and Shinji Watanabe. Streaming transformer asr with blockwise synchronous inference. arXiv preprint arXiv:2006.14941, 2020.
249
+
250
+ Eric Tzeng, Judy Hoffman, Trevor Darrell, and Kate Saenko. Simultaneous deep transfer across domains and tasks. In Proceedings of the IEEE International Conference on Computer Vision, pp. 4068–4076, 2015.
251
+
252
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in neural information processing systems, pp. 5998–6008, 2017.
253
+
254
+ Chengyi Wang, Yu Wu, Shujie Liu, Jinyu Li, Liang Lu, Guoli Ye, and Ming Zhou. Low latency end-to-end streaming speech recognition with a scout network. arXiv preprint arXiv:2003.10369, 2020.
255
+
256
+ Shinji Watanabe, Takaaki Hori, Suyoun Kim, John R Hershey, and Tomoki Hayashi. Hybrid ctc/attention architecture for end-to-end speech recognition. IEEE Journal of Selected Topics in Signal Processing, 11(8):1240–1253, 2017.
257
+
258
+ Ronald J Williams and David Zipser. A learning algorithm for continually running fully recurrent neural networks. Neural computation, 1(2):270–280, 1989.
259
+
260
+ 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.
261
+
262
+ Zhaofeng Wu, Ding Zhao, Qiao Liang, Jiahui Yu, Anmol Gulati, and Ruoming Pang. Dynamic sparsity neural networks for automatic speech recognition. arXiv preprint arXiv:2005.10627, 2020.
263
+
264
+ Ching-Feng Yeh, Jay Mahadeokar, Kaustubh Kalgaonkar, Yongqiang Wang, Duc Le, Mahaveer Jain, Kjell Schubert, Christian Fuegen, and Michael L Seltzer. Transformer-transducer: End-toend speech recognition with self-attention. arXiv preprint arXiv:1910.12977, 2019.
265
+
266
+ Jiahui Yu and Thomas Huang. Autoslim: Towards one-shot architecture search for channel numbers. arXiv preprint arXiv:1903.11728, 2019a.
267
+
268
+ Jiahui Yu and Thomas S Huang. Universally slimmable networks and improved training techniques. In Proceedings of the IEEE International Conference on Computer Vision, pp. 1803–1811, 2019b.
269
+
270
+ Jiahui Yu, Linjie Yang, Ning Xu, Jianchao Yang, and Thomas Huang. Slimmable neural networks. In International Conference on Learning Representations, 2018.
271
+
272
+ Jiahui Yu, Pengchong Jin, Hanxiao Liu, Gabriel Bender, Pieter-Jan Kindermans, Mingxing Tan, Thomas Huang, Xiaodan Song, Ruoming Pang, and Quoc Le. Bignas: Scaling up neural architecture search with big single-stage models. arXiv preprint arXiv:2003.11142, 2020.
273
+
274
+ Qian Zhang, Han Lu, Hasim Sak, Anshuman Tripathi, Erik McDermott, Stephen Koo, and Shankar Kumar. Transformer transducer: A streamable speech recognition model with transformer encoders and rnn-t loss. In ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 7829–7833. IEEE, 2020.
md/train/QtTKTdVrFBB/QtTKTdVrFBB.md ADDED
@@ -0,0 +1,537 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # RANDOM FEATURE ATTENTION
2
+
3
+ Hao Peng♠∗ Nikolaos Pappas♠ Dani Yogatama♣ Roy Schwartz♥ Noah A. Smith♠♦ Lingpeng $\mathbf { K o n g } ^ { \bullet \ast }$
4
+
5
+ ♠Paul G. Allen School of Computer Science & Engineering, University of Washington
6
+ ♣DeepMind ♦Allen Institute for Artificial Intelligence
7
+ ♥School of Computer Science & Engineering, Hebrew University of Jerusalem
8
+ ♦Department of Computer Science , The University of Hong Kong
9
+ {hapeng,npappas,nasmith}@cs.washington.edu
10
+ dyogatama@google.com, roys@cs.huji.ac.il, lpk@cs.hku.hk
11
+
12
+ # ABSTRACT
13
+
14
+ Transformers are state-of-the-art models for a variety of sequence modeling tasks. At their core is an attention function which models pairwise interactions between the inputs at every timestep. While attention is powerful, it does not scale efficiently to long sequences due to its quadratic time and space complexity in the sequence length. We propose RFA, a linear time and space attention that uses random feature methods to approximate the softmax function, and explore its application in transformers. RFA can be used as a drop-in replacement for conventional softmax attention and offers a straightforward way of learning with recency bias through an optional gating mechanism. Experiments on language modeling and machine translation demonstrate that RFA achieves similar or better performance compared to strong transformer baselines. In the machine translation experiment, RFA decodes twice as fast as a vanilla transformer. Compared to existing efficient transformer variants, RFA is competitive in terms of both accuracy and efficiency on three long text classification datasets. Our analysis shows that RFA’s efficiency gains are especially notable on long sequences, suggesting that RFA will be particularly useful in tasks that require working with large inputs, fast decoding speed, or low memory footprints.
15
+
16
+ # 1 INTRODUCTION
17
+
18
+ Transformer architectures (Vaswani et al., 2017) have achieved tremendous success on a variety of sequence modeling tasks (Ott et al., 2018; Radford et al., 2018; Parmar et al., 2018; Devlin et al., 2019; Parisotto et al., 2020, inter alia). Under the hood, the key component is attention (Bahdanau et al., 2015), which models pairwise interactions of the inputs, regardless of their distances from each other. This comes with quadratic time and memory costs, making the transformers computationally expensive, especially for long sequences. A large body of research has been devoted to improving their time and memory efficiency (Tay et al., 2020c). Although better asymptotic complexity and prominent gains for long sequences have been achieved (Lee et al., 2019; Child et al., 2019; Beltagy et al., 2020, inter alia), in practice, many existing approaches are less well-suited for moderatelength ones: the additional computation steps required by some approaches can overshadow the time and memory they save (Kitaev et al., 2020; Wang et al., 2020; Roy et al., 2020, inter alia).
19
+
20
+ This work proposes random feature attention (RFA), an efficient attention variant that scales linearly in sequence length in terms of time and space, and achieves practical gains for both long and moderate length sequences. RFA builds on a kernel perspective of softmax (Rawat et al., 2019). Using the well-established random feature maps (Rahimi & Recht, 2007; Avron et al., 2016; $\ S 2$ ), RFA approximates the dot-then-exponentiate function with a kernel trick (Hofmann et al., 2008): $\exp ( \mathbf { x } \cdot \mathbf { y } ) \approx \phi ( \mathbf { x } ) \cdot \phi ( \mathbf { y } )$ . Inspired by its connections to gated recurrent neural networks (Hochreiter & Schmidhuber, 1997; Cho et al., 2014) and fast weights (Schmidhuber, 1992), we further augment RFA with an optional gating mechanism, offering a straightforward way of learning with recency bias when locality is desired.
21
+
22
+ RFA and its gated variant (§3) can be used as a drop-in substitute for the canonical softmax attention, and increase the number of parameters by less than $0 . 1 \%$ . We explore its applications in transformers on language modeling, machine translation, and long text classification $( \ S 4 )$ . Our experiments show that RFA achieves comparable performance to vanilla transformer baselines in all tasks, while outperforming a recent related approach (Katharopoulos et al., 2020). The gating mechanism proves particularly useful in language modeling: the gated variant of RFA outperforms the transformer baseline on WikiText-103. RFA shines in decoding, even for shorter sequences. In our head-to-head comparison on machine translation benchmarks, RFA decodes around $2 \times$ faster than a transformer baseline, without accuracy loss. Comparisons to several recent efficient transformer variants on three long text classification datasets show that RFA is competitive in terms of both accuracy and efficiency. Our analysis (§5) shows that more significant time and memory efficiency improvements can be achieved for longer sequences: $1 2 \times$ decoding speedup with less than $10 \%$ of the memory for 2,048-length outputs.
23
+
24
+ # 2 BACKGROUND
25
+
26
+ # 2.1 ATTENTION IN SEQUENCE MODELING
27
+
28
+ The attention mechanism (Bahdanau et al., 2015) has been widely used in many sequence modeling tasks. Its dot-product variant is the key building block for the state-of-the-art transformer architectures (Vaswani et al., 2017). Let $\{ \mathbf { q } _ { t } \} _ { t = 1 } ^ { N }$ denote a sequence of $N$ query vectors, that attend to sequences of $M$ key and value vectors. At each timestep, the attention linearly combines the values weighted by the outputs of a softmax:
29
+
30
+ $$
31
+ \mathrm { a t t n } \left( \mathbf { q } _ { t } , \{ \mathbf { k } _ { i } \} , \{ \mathbf { v } _ { i } \} \right) = \sum _ { i } \frac { \exp \left( \mathbf { q } _ { t } \cdot \mathbf { k } _ { i } / \tau \right) } { \sum _ { j } \exp \left( \mathbf { q } _ { t } \cdot \mathbf { k } _ { j } / \tau \right) } \mathbf { v } _ { i } ^ { \top } .
32
+ $$
33
+
34
+ $\tau$ is the temperature hyperparameter determining how “flat” the softmax is (Hinton et al., 2015).1
35
+
36
+ Calculating attention for a single query takes $\mathcal { O } ( M )$ time and space. For the full sequence of $N$ queries the space amounts to $\mathcal { O } ( M N )$ . When the computation cannot be parallelized across the queries, e.g., in autoregressive decoding, the time complexity is quadratic in the sequence length.
37
+
38
+ # 2.2 RANDOM FEATURE METHODS
39
+
40
+ The theoretical backbone of this work is the unbiased estimation of the Gaussian kernel by Rahimi & Recht (2007). Based on Bochner’s theorem (Bochner, 1955), Rahimi & Recht (2007) proposed random Fourier features to approximate a desired shift-invariant kernel. The method nonlinearly transforms a pair of vectors $\mathbf { x }$ and $\mathbf { y }$ using a random feature map $\phi$ ; the inner product between $\phi ( \mathbf { x } )$ and $\phi ( \mathbf { y } )$ approximates the kernel evaluation on $\mathbf { x }$ and $\mathbf { y }$ . More precisely:
41
+
42
+ Theorem 1 (Rahimi & Recht, 2007). Let $\phi : \mathbb { R } ^ { d } \mathbb { R } ^ { 2 D }$ be a nonlinear transformation:
43
+
44
+ $$
45
+ \phi \left( \mathbf { x } \right) = \sqrt { 1 / D } \left[ \sin \left( \mathbf { w } _ { 1 } \cdot \mathbf { x } \right) , \ldots , \sin \left( \mathbf { w } _ { D } \cdot \mathbf { x } \right) , \cos \left( \mathbf { w } _ { 1 } \cdot \mathbf { x } \right) , \ldots , \cos \left( \mathbf { w } _ { D } \cdot \mathbf { x } \right) \right] ^ { \top } .
46
+ $$
47
+
48
+ When $d$ -dimensional random vectors $\mathbf { w } _ { i }$ are independently sampled from ${ \mathcal { N } } ( \mathbf { 0 } , \sigma ^ { 2 } \mathbf { I } _ { d } )$ ,
49
+
50
+ $$
51
+ \begin{array} { r } { \mathbb { E } _ { \mathbf { w } _ { i } } \left[ \boldsymbol { \phi } \left( \mathbf { x } \right) \cdot \boldsymbol { \phi } \left( \mathbf { y } \right) \right] = \exp \left( - \left. \mathbf { x } - \mathbf { y } \right. ^ { 2 } / 2 \sigma ^ { 2 } \right) . } \end{array}
52
+ $$
53
+
54
+ Variance of the estimation is inversely proportional to $D$ (Appendix A.2; Yu et al., 2016).
55
+
56
+ Random feature methods proved successful in speeding up kernel methods (Oliva et al., 2015; Avron et al., 2017; Sun, 2019, inter alia), and more recently are used to efficiently approximate softmax (Rawat et al., 2019). In $\ S 3 . 1$ , we use it to derive an unbiased estimate to $\exp ( \langle \cdot , \cdot \rangle )$ and then an efficient approximation to softmax attention.
57
+
58
+ # 3 MODEL
59
+
60
+ This section presents RFA (§3.1) and its gated variant (§3.2). In $\ S 3 . 3$ we lay out several design choices and relate RFA to prior works. We close by practically analyzing RFA’s complexity (§3.4).
61
+
62
+ ![](images/0d535292e517f3771ab39035611d103e996be4cd8db4d50b5f5422680310085b.jpg)
63
+ Figure 1: Computation graphs for softmax attention (left) and random feature attention (right). Here, we assume cross attention with source length $M$ and target length $N$ .
64
+
65
+ # 3.1 RANDOM FEATURE ATTENTION
66
+
67
+ RFA builds on an unbiased estimate to $\exp ( \langle \cdot , \cdot \rangle )$ from Theorem 1, which we begin with:
68
+
69
+ $$
70
+ \begin{array} { r l } & { \exp \left( \mathbf { x } \cdot \mathbf { y } / \sigma ^ { 2 } \right) = \exp \left( \left\| \mathbf { x } \right\| ^ { 2 } / 2 \sigma ^ { 2 } + \left\| \mathbf { y } \right\| ^ { 2 } / 2 \sigma ^ { 2 } \right) \exp \left( - \left\| \mathbf { x } - \mathbf { y } \right\| ^ { 2 } / 2 \sigma ^ { 2 } \right) } \\ & { \qquad \approx \exp \left( \left\| \mathbf { x } \right\| ^ { 2 } / 2 \sigma ^ { 2 } + \left\| \mathbf { y } \right\| ^ { 2 } / 2 \sigma ^ { 2 } \right) \phi \left( \mathbf { x } \right) \cdot \phi \left( \mathbf { y } \right) . } \end{array}
71
+ $$
72
+
73
+ The last line does not have any nonlinear interaction between $\phi ( \mathbf { x } )$ and $\phi ( \mathbf { y } )$ , allowing for a linear time/space approximation to attention. For clarity we assume the query and keys are unit vectors.2
74
+
75
+ $$
76
+ \begin{array} { l } { { \displaystyle \mathrm { a t t n } \left( { \bf q } _ { t } , \left\{ { \bf k } _ { i } \right\} , \left\{ { \bf v } _ { i } \right\} \right) = \sum _ { i } \frac { \exp \left( { \bf q } _ { t } \cdot { \bf k } _ { i } / \sigma ^ { 2 } \right) } { \sum _ { j } \exp \left( { \bf q } _ { t } \cdot { \bf k } _ { j } / \sigma ^ { 2 } \right) } { \bf v } _ { i } ^ { \top } } \ ~ } \\ { \displaystyle ~ \approx \sum _ { i } \frac { \phi \left( { \bf q } _ { t } \right) ^ { \top } \phi \left( { \bf k } _ { i } \right) { \bf v } _ { i } ^ { \top } } { \sum _ { j } \phi \left( { \bf q } _ { t } \right) \cdot \phi \left( { \bf k } _ { j } \right) } \ ~ } \\ { \displaystyle ~ = \frac { \phi \left( { \bf q } _ { t } \right) ^ { \top } \sum _ { i } \phi \left( { \bf k } _ { i } \right) \otimes { \bf v } _ { i } } { \phi \left( { \bf q } _ { t } \right) \cdot \sum _ { j } \phi \left( { \bf k } _ { j } \right) } = { \bf R F A } \left( { \bf q } _ { t } , \left\{ { \bf k } _ { i } \right\} , \left\{ { \bf v } _ { i } \right\} \right) . } \end{array}
77
+ $$
78
+
79
+ $\otimes$ denotes the outer product between vectors, and $\sigma ^ { 2 }$ corresponds to the temperature term $\tau$ in Eq. 1.
80
+
81
+ RFA can be used as a drop-in-replacement for softmax-attention.
82
+
83
+ (a) The input is revealed in full to cross attention and encoder self-attention. Here RFA calculates attention using Eq. 5.
84
+ (b) In causal attention RFA attends only to the prefix.3 This allows for a recurrent computation. Tuple $( \mathbf { S } _ { t } \in \mathbb { R } ^ { 2 D \times d } , \mathbf { z } _ { t } \in \dot { \mathbb { R } } ^ { 2 D } )$ is used as the “hidden state” at time step $t$ to keep track of the history, similar to those in RNNs. Then $\mathrm { R F A } ( \mathbf { q } _ { t } , \{ \mathbf { k } _ { i } \} _ { i \leq t } , \{ \mathbf { v } _ { i } \} _ { i \leq t } ) =$ $\phi ( \mathbf { q } _ { t } ) ^ { \top } \mathbf { S } _ { t } / ( \phi ( \mathbf { q } _ { t } ) \cdot \mathbf { z } _ { t } )$ , where
85
+
86
+ $$
87
+ \mathbf { S } _ { t } = \mathbf { S } _ { t - 1 } + \phi \left( \mathbf { k } _ { t } \right) \otimes \mathbf { v } _ { t } , \quad \mathbf { z } _ { t } = \mathbf { z } _ { t - 1 } + \phi \left( \mathbf { k } _ { t } \right) .
88
+ $$
89
+
90
+ $2 D$ denotes the size of $\phi ( \cdot )$ . Appendix A.1 summarizes the computation procedure of RFA, and Figure 1 compares it against the softmax attention. Appendix A.3 derives causal RFA in detail.
91
+
92
+ Analogously to the softmax attention, RFA has its multiheaded variant (Vaswani et al., 2017). In our experiments we use causal RFA in a transformer language model (§4.1), and both cross and causal RFA in the decoder of a sequence-to-sequence machine translation model.
93
+
94
+ # 3.2 RFA-GATE: LEARNING WITH RECENCY BIAS
95
+
96
+ The canonical softmax attention does not have any explicit modeling of distance or locality. In learning problems where such inductive bias is crucial (Ba et al., 2016; Parmar et al., 2018; Miconi et al., 2018; Li et al., 2019, inter alia), transformers heavily rely on positional encodings. Answering to this, many approaches have been proposed, e.g., learning the attention spans (Sukhbaatar et al.,
97
+
98
+ 2019; Wu et al., 2020), and enhancing the attention computation with recurrent (Hao et al., 2019;
99
+ Chen et al., 2019) or convolutional (Wu et al., 2019; Mohamed et al., 2019) components.
100
+
101
+ RFA faces the same issue, but its causal attention variant (Eq. 6) offers a straightforward way of learning with recency bias. We draw inspiration from its connections to RNNs, and augment RFA with a learned gating mechanism (Hochreiter & Schmidhuber, 1997; Cho et al., 2014; Peng et al., 2018, inter alia):
102
+
103
+ $$
104
+ \begin{array} { r l } & { g _ { t } = \mathrm { s i g m o i d } ( \mathbf { w } _ { g } \cdot \mathbf { x } _ { t } + b _ { g } ) , } \\ & { \mathbf { S } _ { t } = g _ { t } \mathbf { S } _ { t - 1 } + \left( 1 - g _ { t } \right) \phi \left( \mathbf { k } _ { t } \right) \otimes \mathbf { v } _ { t } , } \\ & { \mathbf { z } _ { t } = g _ { t } \mathbf { z } _ { t - 1 } + \left( 1 - g _ { t } \right) \phi \left( \mathbf { k } _ { t } \right) . } \end{array}
105
+ $$
106
+
107
+ ${ \bf w } _ { g }$ and $b _ { g }$ are learned parameters, and $\mathbf { x } _ { t }$ is the input representation at timestep $t$ .4 By multiplying the learned scalar gates $0 ~ < ~ g _ { t } ~ < ~ 1$ against the hidden state $( \mathbf { S } _ { t } , \mathbf { z } _ { t } )$ , history is exponentially decayed, favoring more recent context.
108
+
109
+ The gating mechanism shows another benefit of RFA: it would be otherwise more difficult to build similar techniques into the softmax attention, where there is no clear sense of “recurrence” (Appendix A.5). It proves useful in our language modeling experiments $( \ S 4 . 1 )$ .
110
+
111
+ # 3.3 DISCUSSION
112
+
113
+ On query and key norms, and learned random feature variance. Eq. 5 assumes both the query and keys are of norm-1. It therefore approximates a softmax attention that normalizes the queries and keys before multiplying them, and then scales the logits by dividing them by $\sigma ^ { 2 }$ . Empirically, this normalization step scales down the logits (Vaswani et al., 2017) and enforces that $- 1 \overset { \cdot } { \leq } \mathbf { q } ^ { \intercal } \dot { \mathbf { k } } \leq 1$ . In consequence, the softmax outputs would be “flattened” if not for $\sigma$ , which can be set a priori as a hyperparameter (Yu et al., 2016; Avron et al., 2017; Sun, 2019, inter alia). Here we instead learn it from data with the reparameterization trick (Kingma & Welling, 2014):
114
+
115
+ $$
116
+ \widetilde { \mathbf { w } } _ { i } \sim { \mathcal { N } } ( \mathbf { 0 } , \mathbf { I } _ { d } ) , \quad \mathbf { w } _ { i } = \pmb { \sigma } \circ \widetilde { \mathbf { w } } _ { i } .
117
+ $$
118
+
119
+ $\mathbf { I } _ { d }$ is the $d \times d$ identity matrix, and $\circ$ denotes elementwise product between vectors. $d$ -dimensional vector $\sigma$ is learned, but random vectors $\widetilde { \mathbf { w } } _ { i }$ are not.5
120
+
121
+ This norm-1 constraint is never mandatory. Rather, we employ it for notation clarity and easier implementation. In preliminary experiments we find it has little impact on the performance when $\sigma$ is set properly or learned from data. Eq. 12 in Appendix A presents RFA without imposing it.
122
+
123
+ Going beyond the Gaussian kernel. More broadly, random feature methods can be applied to a family of shift-invariant kernels, with the Gaussian kernel being one of them. In the same family, the order-1 arc-cosine kernel (Cho & Saul, 2009) can be approximated with feature map: $\phi _ { \mathrm { a r c c o s } } ( \mathbf { x } ) = \sqrt { 1 / D } [ \mathrm { R e L U } ( \mathbf { w } _ { 1 } \cdot \mathbf { x } ) , \dots , \mathrm { R e L U } ( \mathbf { w } _ { D } \cdot \mathbf { x } ) ] ^ { \top }$ (Alber et al., 2017).6 In our experiments, the Gaussian and arc-cosine variants achieve similar performance. This supplements the exploration of alternatives to softmax in attention (Tsai et al., 2019; Gao et al., 2019).
124
+
125
+ Relations to prior work. Katharopoulos et al. (2020) inspire the causal attention variant of RFA. They use a feature map based on the exponential linear unit activation (Clevert et al., 2016): $\mathrm { e l u } ( \cdot ) + 1$ . It significantly underperforms both the baseline and RFA in our controlled experiments, showing the importance of a properly-chosen feature map. Random feature approximation of attention is also explored by a concurrent work (Choromanski et al., 2021), with applications in masked language modeling for proteins. They propose positive random features to approximate softmax, aiming for a lower variance in critical regions. RFA instead normalizes the queries and keys before random projection to reduce variance. Going beyond both, RFA establishes the benefits of random feature methods as a more universal substitute for softmax across all attention variants, facilitating its applications in, e.g., sequence-to-sequence learning.
126
+
127
+ There are interesting connections between gated RFA and fast weights (Schmidhuber, 1992; 1993; Ba et al., 2016; Miconi et al., 2018, inter alia). Emphasizing recent patterns, they learn a temporal memory to store history similarly to Eqs. 7. The main difference is that RFA additionally normalizes the output using $\phi ( { \bf q } _ { t } ) \cdot { \bf z }$ as in Eq. 6, a by-product of approximating softmax’s partition function. It is intriguing to study the role of this normalization term, which we leave to future work.
128
+
129
+ # 3.4 COMPLEXITY ANALYSIS
130
+
131
+ Time. Scaling linearly in the sequence lengths, RFA needs less computation (in terms of number of operations) for long sequences. This implies speedup wherever the quadratic-time softmax attention cannot be fully-parallelized across time steps. More specifically:
132
+
133
+ • Significant speedup can be expected in autoregressive decoding, both conditional (e.g., machine translation) and unconditional (e.g., sampling from a language model). For example, $1 . 9 \times$ speedup is achieved in our machine translation experiments (§4.2); and more for longer sequences (e.g., $1 2 \times$ for 2,048-length ones; §5). Some applications (e.g., language modeling, text classification) reveal inputs to the model in full.7 When there are enough threads to parallelize softmax attention across time steps, hardly any speedup from RFA can be achieved; when there are not, typically for very long sequences $( > 1 , 0 0 0 )$ , substantial speed gain is possible. For example, RFA does not achieve any speedup when working with 512-length context $( \ S 4 . 1 )$ , but achieves a $5 . 3 \times$ speedup with 4,000-length context $( \ S 4 . 2 )$ .
134
+
135
+ Memory. Asymptotically, RFA has a better memory efficiency than its softmax counterpart (linear vs. quadratic). To reach a more practical conclusion, we include in our analysis the cost of the feature maps. $\phi$ ’s memory overhead largely depends on its size $D$ . For example, let’s consider the cross attention of a decoder. RFA uses $\mathcal { O } ( 4 D + 2 D d )$ space to store ${ \big . } \phi ( \mathbf { q } _ { t } ) , \sum _ { i } ^ { \cdot } \phi ( \mathbf { k } _ { i } ) \otimes \mathbf { v } _ { i }$ , and $\textstyle \sum _ { i } \phi ( \mathbf { k } _ { i } )$ (Eq. 5; line 12 of Algo. 2).8 In contrast, softmax cross attention stores the encoder outputs with $\mathcal O ( M d )$ memory, with $M$ being the source length. In this case RFA has a lower memory overhead when $2 D \ll M$ . Typically $D$ should be no less than $d$ in order for reasonable approximation (Yu et al., 2016); In a transformer model, $d$ is the size of an attention head, which is usually around 64 or 128 (Vaswani et al., 2017; Ott et al., 2018). This suggests that RFA can achieve significant memory saving with longer sequences, which is supported by our empirical analysis in $\ S 5$ . Further, using moderate sized feature maps is also desirable, so that its overhead does not overshadow the time and memory RFA saves. We experiment with $D$ at $d$ and $2 d$ ; the benefit of using $D > 2 d$ is marginal.
136
+
137
+ Appendix A.6 discusses the time and space complexity in more detail, and Appendix C.2 studies the effect of random feature size on performance.
138
+
139
+ # 4 EXPERIMENTS
140
+
141
+ We evaluate RFA on language modeling, machine translation, and long text classification.
142
+
143
+ # 4.1 LANGUAGE MODELING
144
+
145
+ Setting. We experiment with WikiText-103 (Merity et al., 2017). It is based on English Wikipedia. Table 5 in Appendix B summarizes some of its statistics. We compare the following models:
146
+
147
+ • BASE is our implementation of the strong transformer-based language model by Baevski & Auli (2019).
148
+ RFA builds on BASE, but replaces the softmax attention with random feature attention. We experiment with both Gaussian and arc-cosine kernel variants.
149
+ • RFA-GATE additionally learns a sigmoid gate on top of RFA (§3.2). It also has a Gaussian kernel variant and a arc-cosine kernel one.9
150
+ $\phi _ { \mathrm { e l u } }$ is a baseline to RFA. Instead of the random feature methods it uses the $\mathrm { e l u } ( \cdot ) + 1$ feature map, as in Katharopoulos et al. (2020).
151
+
152
+ To ensure fair comparisons, we use comparable implementations, tuning, and training procedure. All models use a 512 block size during both training and evaluation, i.e., they read as input a segment of 512 consecutive tokens, without access to the context from previous mini-batches. RFA variants use 64-dimensional random feature maps. We experiment with two model size settings, small (around 38M parameters) and big (around 242M parameters); they are described in Appendix B.1 along with other implementation details.
153
+
154
+ Table 1: Language model perplexity (lower is better) on the WikiText-103 development and test sets. Bolded numbers outperform BASE.
155
+
156
+ <table><tr><td></td><td colspan="2">Small</td><td colspan="2">Big</td></tr><tr><td>Model</td><td>Dev.</td><td>Test</td><td>Dev.</td><td>Test</td></tr><tr><td>BASE</td><td>33.0</td><td>34.5</td><td>24.5</td><td>26.2</td></tr><tr><td>Φelu (Katharopoulos et al., 2020)</td><td>38.4</td><td>40.1</td><td>28.7</td><td>30.2</td></tr><tr><td>RFA-Gaussian</td><td>33.6</td><td>35.7</td><td>25.8</td><td>27.5</td></tr><tr><td>RFA-arccos</td><td>36.0</td><td>37.7</td><td>26.4</td><td>28.1</td></tr><tr><td>RFA-GATE-Gaussian</td><td>31.3</td><td>32.7</td><td>23.2</td><td>25.0</td></tr><tr><td>RFA-GATE-arCCOS</td><td>32.8</td><td>34.0</td><td>24.8</td><td>26.3</td></tr><tr><td>RFA-GATE-Gaussian-Stateful</td><td>29.4</td><td>30.5</td><td>22.0</td><td>23.5</td></tr></table>
157
+
158
+ Results. Table 1 compares the models’ performance in perplexity on WikiText-103 development and test data. Both kernel variants of RFA, without gating, outperform $\phi _ { \mathrm { e l u } }$ by more than 2.4 and 2.1 test perplexity for the small and big model respectively, confirming the benefits from using random feature approximation.10 Yet both underperform BASE, with RFA-Gaussian having a smaller gap. Comparing RFA against its gated variants, a more than 1.8 perplexity improvement can be attributed to the gating mechanism; and the gap is larger for small models. Notably, RFA-GATE-Gaussian outperforms BASE under both size settings by at least 1.2 perplexity. In general, RFA models with Gaussian feature maps outperform their arc-cosine counterparts.11 From the analysis in $\ S 3 . 4$ we would not expect speedup by RFA models, nor do we see any in the experiments.12
159
+
160
+ Closing this section, we explore a “stateful” variant of RFA-GATE-Gaussian. It passes the last hidden state $( \mathbf { S } _ { t } , \mathbf { z } _ { t } )$ to the next mini-batch during both training and evaluation, a technique commonly used in RNN language models (Merity et al., 2018). This is a consequence of RFA’s RNN-style computation, and is less straightforward to be applicable in the vanilla transformer models.13 From the last row of Table 1 we see that this brings a more than 1.5 test perplexity improvement.
161
+
162
+ # 4.2 MACHINE TRANSLATION
163
+
164
+ Datasets. We experiment with three standard machine translation datasets.
165
+
166
+ • WMT14 EN-DE and EN-FR (Bojar et al., 2014). Our data split and preprocessing follow those of Vaswani et al. (2017). We share the source and target vocabularies within each language pair, with 32,768 byte pair encoding types (BPE; Sennrich et al., 2016). • IWSLT14 DE-EN (Cettolo et al., 2014) is based on TED talks. The preprocessing follows Edunov et al. (2018). Separate vocabularies of 9K/7K BPE types are used for the source and target.
167
+
168
+ Table 5 in Appendix B summarizes some statistics of the datasets.
169
+
170
+ Setting. We compare the RFA variants described in $\ S 4 . 1$ . They build on a BASE model that is our implementation of the base-sized transformer (Vaswani et al., 2017). All RFA models apply random feature attention in decoder cross and causal attention, but use softmax attention in encoders. This setting yields the greatest decoding time and memory savings (§3.4). We use 128/64 for $D$ in cross/causal attention. RFA-GATE learns sigmoid gates in the decoder causal attention. The $\phi _ { \mathrm { e l u } }$ baseline uses the same setting and applies feature map in both decoder cross and causal attention, but not in the encoders. Further details are described in Appendix B.2.
171
+
172
+ <table><tr><td></td><td colspan="2">WMT14</td><td>IWSLT14</td><td></td></tr><tr><td>Model</td><td>EN-DE</td><td>EN-FR</td><td>DE-EN</td><td>Speed</td></tr><tr><td>BASE</td><td>28.1</td><td>39.0</td><td>34.6</td><td>1.0×</td></tr><tr><td>Φelu (Katharopoulos et al., 2020)</td><td>21.3</td><td>34.0</td><td>29.9</td><td>2.0×</td></tr><tr><td>RFA-Gaussian</td><td>28.0</td><td>39.2</td><td>34.5</td><td>1.8×</td></tr><tr><td>RFA-arccos</td><td>28.1</td><td>38.9</td><td>34.4</td><td>1.9×</td></tr><tr><td>RFA-GATE-Gaussian</td><td>28.1</td><td>39.0</td><td>34.6</td><td>1.8×</td></tr><tr><td>RFA-GATE-arccOS</td><td>28.2</td><td>39.2</td><td>34.4</td><td>1.9×</td></tr></table>
173
+
174
+ Table 2: Machine translation test set BLEU. The decoding speed (last column) is relative to BASE.
175
+ All models are tested on a single TPU v2 accelerator, with batch size 32.
176
+
177
+ Results. Table 2 compares the models’ test set BLEU on three machine translation datasets. Overall both Gaussian and arc-cosine variants of RFA achieve similar performance to BASE on all three datasets, significantly outperforming Katharopoulos et al. (2020). Differently from the trends in the language modeling experiments, here the gating mechanism does not lead to substantial gains. Notably, all RFA variants decode more than $1 . 8 \times$ faster than BASE.
178
+
179
+ # 4.3 LONG TEXT CLASSIFICATION
180
+
181
+ We further evaluate RFA’s accuracy and efficiency when used as text encoders on three NLP tasks from the recently proposed Long Range Arena benchmark (Tay et al., 2021), designed to evaluate efficient Transformer variants on tasks that require processing long sequences.14
182
+
183
+ Experimental setting and datasets. We compare RFA against baselines on the following datasets:
184
+
185
+ • ListOps (LO; Nangia & Bowman, 2018) aims to diagnose the capability of modelling hierarchically structured data. Given a sequence of operations on single-digit integers, the model predicts the solution, also a single-digit integer. It is formulated as a 10-way classification. We follow Tay et al. (2021) and consider sequences with 500–2,000 symbols. Character-level text classification with the IMDb movie review dataset (Maas et al., 2011). This is a binary sentiment classification task. Character-level document retrieval with the ACL Anthology Network (AAN; Radev et al., 2009) dataset. The model classifies whether there is a citation between a pair of papers.
186
+
187
+ To ensure fair comparisons, we implement RFA on top of the transformer baseline by Tay et al. (2021), and closely follow their preprocessing, data split, model size, and training procedure. Speed and memory are evaluated on the IMDb dataset. For our RFA model, we use $D = 6 4$ for the IMDb dataset, and $D = 1 2 8$ for others. We refer the readers to Tay et al. (2021) for further details.
188
+
189
+ Results. From Table 3 we can see that RFA outperforms the transformer baseline on two out of the three datasets, achieving the best performance on IMDb with $66 \%$ accuracy. Averaging across three datasets, RFA outperforms the transformer by $0 . 3 \%$ accuracy, second only to Zaheer et al. (2020) with a $0 . 1 \%$ accuracy gap. In terms of time and memory efficiency, RFA is among the strongest. RFA speeds up over the transformer by $1 . 1 \mathrm { - } 5 . 3 \times$ , varying by sequence length. Importantly, compared to the only two baselines that perform comparably to the baseline transformer model (Tay et al., 2020a; Zaheer et al., 2020), RFA has a clear advantage in both speed and memory efficiency, and is the only model that is competitive in both accuracy and efficiency.
190
+
191
+ <table><tr><td></td><td colspan="4"> Accuracy</td><td colspan="4">Speed</td><td colspan="4">Memory</td></tr><tr><td>Model</td><td>LO</td><td>IMDb</td><td>AAN</td><td>Avg.</td><td>1K</td><td>2K</td><td>3K</td><td>4K</td><td>1K</td><td>2K</td><td>3K</td><td>4K</td></tr><tr><td>Transformer</td><td>36.4</td><td>64.3</td><td>57.5</td><td>52.7</td><td>1.0</td><td>1.0</td><td>1.0</td><td>1.0</td><td>1.00</td><td>1.00</td><td>1.00</td><td>1.00</td></tr><tr><td>Wang et al. (2020)</td><td>35.7</td><td>53.9</td><td>52.3</td><td>47.3</td><td>1.2</td><td>1.9</td><td>3.7</td><td>5.5</td><td>0.44</td><td>0.21</td><td>0.18</td><td>0.10</td></tr><tr><td>Kitaev et al. (2020)</td><td>37.3</td><td>56.1</td><td>53.4</td><td>48.9</td><td>0.5</td><td>0.4</td><td>0.7</td><td>0.8</td><td>0.56</td><td>0.37</td><td>0.28</td><td>0.24</td></tr><tr><td>Tay et al. (2020b)</td><td>17.1</td><td>63.6</td><td>59.6</td><td>46.8</td><td>1.1</td><td>1.6</td><td>2.9</td><td>3.8</td><td>0.55</td><td>0.31</td><td>0.20</td><td>0.16</td></tr><tr><td>Tay et al. (2020a)</td><td>37.0</td><td>61.7</td><td>54.7</td><td>51.1</td><td>1.1</td><td>1.2</td><td>2.9</td><td>1.4</td><td>0.76</td><td>0.75</td><td>0.74</td><td>0.74</td></tr><tr><td>Zaheer et al. (2020)</td><td>36.0</td><td>64.0</td><td>59.3</td><td>53.1</td><td>0.9</td><td>0.8</td><td>1.2</td><td>1.1</td><td>0.90</td><td>0.56</td><td>0.40</td><td>0.30</td></tr><tr><td>Katharopoulos et al. (2020)</td><td>16.1</td><td>65.9</td><td>53.1</td><td>45.0</td><td>1.1</td><td>1.9</td><td>3.7</td><td>5.6</td><td>0.44</td><td>0.22</td><td>0.14</td><td>0.11</td></tr><tr><td>Choromanski et al. (2021)</td><td>18.0</td><td>65.4</td><td>53.8</td><td>45.7</td><td>1.2</td><td>1.9</td><td>3.8</td><td>5.7</td><td>0.44</td><td>0.22</td><td>0.15</td><td>0.11</td></tr><tr><td>RFA-Gaussian (This work)</td><td>36.8</td><td>66.0</td><td>56.1</td><td>53.0</td><td>1.1</td><td>1.7</td><td>3.4</td><td>5.3</td><td>0.53</td><td>0.30</td><td>0.21</td><td>0.16</td></tr></table>
192
+
193
+ Table 3: Accuracy (higher is better) of different models on LO, IMDb, and AAN, along with their speed (higher is better) and peak memory consumption (lower is better) varying sequence lengths (1–4K). Speed and memory are evaluated on the IMDb dataset and relative to the transformer’s. Bold font indicates the best performance in each column, and underlined numbers outperform the transformer in accuracy. Transformer’s and previous works’ numbers are due to Tay et al. (2021).
194
+
195
+ ![](images/ec809e0b61a4811c98a04afbe3fe359f3a073d5781fc6ef25a3c180f9a4d16ae.jpg)
196
+ Figure 2: Conditional decoding speed (left) and memory overhead (right) varying the output lengths. All models are tested on a single TPU v2 accelerator, with greedy decoding and batch size 16.
197
+
198
+ # 5 ANALYSIS
199
+
200
+ Decoding time and memory varying by sequence length. $\ S 3 . 4$ shows that RFA can potentially achieve more significant speedup and memory saving for longer sequences, which we now explore.
201
+
202
+ We use a simulation conditional generation experiment on to compare RFA’s sequence-to-sequence decoding speed and memory overhead against the baseline’s. Here we assume the input and output sequences are of the same length. The compared models are of the same size as those described in $\ S 4 . 2$ , with 6-layer encoders and decoders. Other hyperparameters are summarized in Appendix B.2. All models are tested using greedy decoding with the same batch size of 16, on a TPU v2 accelerator.
203
+
204
+ From Figures 2 (a) and (b) we observe clear trends. Varying the lengths, both RFA variants achieve consistent decoding speed with nearly-constant memory overhead. In contrast, the baseline decodes slower for longer sequences, taking an increasing amount of memory. Notably, for 2,048-length sequences, RFA decodes around $1 2 \times$ faster than the baseline while using less than $10 \%$ of the memory. RFA-arccos slightly outperforms RFA-Gaussian in terms of speed and memory efficiency. This is because when using the same $D$ (as we do here), the $\phi _ { \mathrm { a r c c o s } }$ is half the size of $\phi _ { \mathrm { G a u s s i a n } }$ . These results suggest that RFA can be particularly useful in sequence-to-sequence tasks with longer sequences, e.g., document-level machine translation (Miculicich et al., 2018).
205
+
206
+ Figure 3 in Appendix C.1 compares the speed and memory consumption in unconditional decoding (e.g., sampling from a language model). The overall trends are similar to those in Figure 2.
207
+
208
+ Notes on decoding speed. With a lower memory overhead, RFA can use a larger batch size than the baseline. As noted by Katharopoulos et al. (2020) and Kasai et al. (2021), if we had used minibatches as large as the hardware allows, RFA could have achieved a more significant speed gain. Nonetheless, we control for batch size even though it is not the most favorable setting for RFA, since the conclusion translates better to common applications where one generates a single sequence at a time (e.g., instantaneous machine translation). For the softmax attention baseline, we follow Ott et al. (2018) and cache previously computed query/key/value representations, which significantly improves its decoding speed (over not caching).
209
+
210
+ Further analysis results. RFA achieves comparable performance to softmax attention. Appendix C.3 empirically shows that this cannot be attributed to RFA learning a good approximation to softmax: when we train with one attention but evaluate with the other, the performance is hardly better than randomly-initialized untrained models. Yet, an RFA model initialized from a pretrained softmax transformer achieves decent training loss after a moderate amount of finetuning steps (Appendix C.4). This suggests some potential applications, e.g., transferring knowledge from a pretrained transformer (e.g., GPT-3; Brown et al., 2020) to an RFA model that is more efficient to sample from.
211
+
212
+ # 6 RELATED WORK
213
+
214
+ One common motivation across the following studies, that is shared by this work and the research we have already discussed, is to scale transformers to long sequences. Note that there are plenty orthogonal choices for improving efficiency such as weight sharing (Dehghani et al., 2019), quantization (Shen et al., 2020), knowledge distillation (Sanh et al., 2020), and adapters (Houlsby et al., 2019). For a detailed overview we refer the reader to Tay et al. (2020c).
215
+
216
+ Sparse attention patterns. The idea behind these methods is to limit the reception field of attention computation. It motivates earlier attempts in improving attention’s efficiency, and still receives lots of interest. The sparse patterns can be set a priori (Liu et al., 2018; Qiu et al., 2020; Ho et al., 2020; You et al., 2020, inter alia) or learned from data (Sukhbaatar et al., 2019; Roy et al., 2020, inter alia). For most of these approaches, it is yet to be empirically verified that they are suitable for large-scale sequence-to-sequence learning; few of them have recorded decoding speed benefits.
217
+
218
+ Compressed context. Wang et al. (2020) compress the context along the timesteps so that the effective sequence length for attention computation is reduced. Another line of work aims to store past context into a memory module with limited size (Lee et al., 2019; Ainslie et al., 2020; Rae et al., 2020, inter alia), so that accessing longer history only moderately increases the overhead. Reminiscent of RNN language models, RFA attends beyond a fixed context window through a stateful computation, without increasing time or memory overhead.
219
+
220
+ # 7 CONCLUSION
221
+
222
+ We presented random feature attention (RFA). It views the softmax attention through the lens of kernel methods, and approximates it with random feature methods. With an optional gating mechanism, RFA provides a straightforward way of learning with recency bias. RFA’s time and space complexity is linear in the sequence length. We use RFA as a drop-in substitute for softmax attention in transformer models. On language modeling, machine translation, and long text classification benchmarks, RFA achieves comparable or better performance than strong baselines. In the machine translation experiment, RFA decodes twice as fast. Further time and memory efficiency improvements can be achieved for longer sequences.
223
+
224
+ # ACKNOWLEDGMENTS
225
+
226
+ We would like to thank Phil Blunsom, Chris Dyer, Nando de Freitas, Jungo Kasai, Adhiguna Kuncoro, Dianqi Li, Ofir Press, Lianhui Qin, Swabha Swayamdipta, Sam Thomson, the language team at DeepMind and the ARK group at the University of Washington for their helpful feedback. We also thank Tay Yi for helping run the Long Range Arena experiments, Richard Tanburn for the advice on implementations, and the anonymous reviewers for their thoughtful comments. This work was supported in part by NSF grant 1562364 and a Google Fellowship. Nikolaos Pappas was supported by the Swiss National Science Foundation under grant number P400P2 183911 “UNISON.”
227
+
228
+ # REFERENCES
229
+
230
+ Joshua Ainslie, Santiago Ontanon, Chris Alberti, Vaclav Cvicek, Zachary Fisher, Philip Pham, Anirudh Ravula, Sumit Sanghai, Qifan Wang, and Li Yang. ETC: Encoding long and structured inputs in transformers. In Proc. of EMNLP, 2020.
231
+
232
+ Maximilian Alber, Pieter-Jan Kindermans, Kristof Schutt, Klaus-Robert M ¨ uller, and Fei Sha. An ¨ empirical study on the properties of random bases for kernel methods. In Proc. of NeurIPS, 2017.
233
+
234
+ Haim Avron, Vikas Sindhwani, Jiyan Yang, and Michael W. Mahoney. Quasi-Monte Carlo feature maps for shift-invariant kernels. Journal of Machine Learning Research, 17(120):1–38, 2016.
235
+
236
+ Haim Avron, L. Kenneth Clarkson, and P. David and Woodruff. Faster kernel ridge regression using sketching and preconditioning. SIAM J. Matrix Analysis Applications, 2017.
237
+
238
+ Jimmy Ba, Geoffrey E Hinton, Volodymyr Mnih, Joel Z Leibo, and Catalin Ionescu. Using fast weights to attend to the recent past. In Proc. of NeurIPS, 2016.
239
+
240
+ Alexei Baevski and Michael Auli. Adaptive input representations for neural language modeling. In Proc. of ICLR, 2019.
241
+
242
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In Proc. of ICLR, 2015.
243
+
244
+ Iz Beltagy, Matthew E. Peters, and Arman Cohan. Longformer: The long-document transformer. arXiv: 2004.05150, 2020.
245
+
246
+ S. Bochner. Harmonic Analysis and the Theory of Probability. University of California Press, 1955.
247
+
248
+ Ondˇrej Bojar, Christian Buck, Christian Federmann, Barry Haddow, Philipp Koehn, Johannes Leveling, Christof Monz, Pavel Pecina, Matt Post, Herve Saint-Amand, Radu Soricut, Lucia Specia, and Ales Tamchyna. Findings of the 2014 workshop on statistical machine translation. In ˇ Proc. of WMT, 2014.
249
+
250
+ Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. arXiv: 2005.14165, 2020.
251
+
252
+ Mauro Cettolo, Jan Niehues, Sebastian Stuker, Luisa Bentivogli, and Marcello Federico. Report on ¨ the 11th IWSLT evaluation campaign. In Proc. of IWSLT, 2014.
253
+
254
+ Kehai Chen, Rui Wang, Masao Utiyama, and Eiichiro Sumita. Recurrent positional embedding for neural machine translation. In Proc. of EMNLP, 2019.
255
+
256
+ Rewon Child, Scott Gray, Alec Radford, and Ilya Sutskever. Generating long sequences with sparse transformers. arXiv: 1904.10509, 2019.
257
+
258
+ 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. In Proc. of EMNLP, 2014.
259
+
260
+ Youngmin Cho and Lawrence K. Saul. Kernel methods for deep learning. In Proc. of NeurIPS, 2009.
261
+
262
+ Krzysztof Marcin Choromanski, Valerii Likhosherstov, David Dohan, Xingyou Song, Andreea Gane, Tamas Sarlos, Peter Hawkins, Jared Quincy Davis, Afroz Mohiuddin, Lukasz Kaiser, David Benjamin Belanger, Lucy J Colwell, and Adrian Weller. Rethinking attention with performers. In Proc. of ICLR, 2021.
263
+
264
+ Djork-Arne Clevert, Thomas Unterthiner, and Sepp Hochreiter. Fast and accurate deep network´ learning by exponential linear units (ELUs). In Proc. of ICLR, 2016.
265
+
266
+ Zihang Dai, Zhilin Yang, Yiming Yang, Jaime Carbonell, Quoc Le, and Ruslan Salakhutdinov. Transformer-XL: Attentive language models beyond a fixed-length context. In Proc. of ACL, 2019.
267
+
268
+ Mostafa Dehghani, Stephan Gouws, Oriol Vinyals, Jakob Uszkoreit, and Lukasz Kaiser. Universal transformers. In Proc. of ICLR, 2019.
269
+
270
+ Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proc. of NAACL, 2019.
271
+
272
+ Sergey Edunov, Myle Ott, Michael Auli, David Grangier, and Marc’Aurelio Ranzato. Classical structured prediction losses for sequence to sequence learning. In Proc. of NAACL, 2018.
273
+
274
+ Yingbo Gao, Christian Herold, Weiyue Wang, and Hermann Ney. Exploring kernel functions in the softmax layer for contextual word classification. In International Workshop on Spoken Language Translation, 2019.
275
+
276
+ Jie Hao, Xing Wang, Baosong Yang, Longyue Wang, Jinfeng Zhang, and Zhaopeng Tu. Modeling recurrence for transformer. In Proc. of NAACL, 2019.
277
+
278
+ Geoffrey Hinton, Oriol Vinyals, and Jeffrey Dean. Distilling the knowledge in a neural network. In NeurIPs Deep Learning and Representation Learning Workshop, 2015.
279
+
280
+ Jonathan Ho, Nal Kalchbrenner, Dirk Weissenborn, and Tim Salimans. Axial attention in multidimensional transformers. arXiv: 1912.12180, 2020.
281
+
282
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural Computation, 9(8): 1735–1780, 1997.
283
+
284
+ Thomas Hofmann, Bernhard Scholkopf, and Alexander J. Smola. Kernel methods in machine learn- ¨ ing. Annals of Statistics, 36(3):1171–1220, 2008.
285
+
286
+ Neil Houlsby, Andrei Giurgiu, Stanislaw Jastrzebski, Bruna Morrone, Quentin De Laroussilhe, Andrea Gesmundo, Mona Attariyan, and Sylvain Gelly. Parameter-efficient transfer learning for NLP. In Proc. of ICML, 2019.
287
+
288
+ Jungo Kasai, Nikolaos Pappas, Hao Peng, James Cross, and Noah A. Smith. Deep encoder, shallow decoder: Reevaluating the speed-quality tradeoff in machine translation. In Proc. of ICLR, 2021.
289
+
290
+ Angelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas, and Francois Fleuret. Transformers are rnns: Fast autoregressive transformers with linear attention. In Proc. of ICML, 2020.
291
+
292
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In Proc. of ICLR, 2015.
293
+
294
+ Diederik P. Kingma and Max Welling. Auto-encoding variational bayes. In Proc. of ICLR, 2014.
295
+
296
+ Nikita Kitaev, Lukasz Kaiser, and Anselm Levskaya. Reformer: The efficient transformer. In Proc. of ICLR, 2020.
297
+
298
+ Juho Lee, Yoonho Lee, Jungtaek Kim, Adam Kosiorek, Seungjin Choi, and Yee Whye Teh. Set transformer: A framework for attention-based permutation-invariant neural networks. In Proc. of ICML, 2019.
299
+
300
+ Shiyang Li, Xiaoyong Jin, Yao Xuan, Xiyou Zhou, Wenhu Chen, Yu-Xiang Wang, and Xifeng Yan. Enhancing the locality and breaking the memory bottleneck of transformer on time series forecasting. In Proc. of NeurIPS, 2019.
301
+
302
+ Peter J. Liu, Mohammad Saleh, Etienne Pot, Ben Goodrich, Ryan Sepassi, Lukasz Kaiser, and Noam Shazeer. Generating wikipedia by summarizing long sequences. In Proc. of ICLR, 2018.
303
+
304
+ Andrew L. Maas, Raymond E. Daly, Peter T. Pham, Dan Huang, Andrew Y. Ng, and Christopher Potts. Learning word vectors for sentiment analysis. In Proc. of ACL, 2011.
305
+
306
+ Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer sentinel mixture models. In Proc. of ICLR, 2017.
307
+
308
+ Stephen Merity, Nitish Shirish Keskar, and Richard Socher. Regularizing and Optimizing LSTM Language Models. In Proc. of ICLR, 2018.
309
+
310
+ Thomas Miconi, Kenneth Stanley, and Jeff Clune. Differentiable plasticity: training plastic neural networks with backpropagation. In Proc. of ICML, 2018.
311
+
312
+ Lesly Miculicich, Dhananjay Ram, Nikolaos Pappas, and James Henderson. Document-level neural machine translation with hierarchical attention networks. In Proc. of EMNLP, 2018.
313
+
314
+ Abdelrahman Mohamed, Dmytro Okhonko, and Luke Zettlemoyer. Transformers with convolutional context for ASR. arXiv: 1904.11660, 2019.
315
+
316
+ Nikita Nangia and Samuel Bowman. ListOps: A diagnostic dataset for latent tree learning. In Proc. of NAACL Student Research Workshop, 2018.
317
+
318
+ Junier Oliva, William Neiswanger, Barnabas Poczos, Eric Xing, Hy Trac, Shirley Ho, and Jeff Schneider. Fast function to function regression. In Proc. of AISTATS, 2015.
319
+
320
+ Myle Ott, Sergey Edunov, David Grangier, and Michael Auli. Scaling neural machine translation. In Proc. of WMT, 2018.
321
+
322
+ Emilio Parisotto, H. Francis Song, Jack W. Rae, Razvan Pascanu, Caglar Gulcehre, Siddhant M. Jayakumar, Max Jaderberg, Raphael Lopez Kaufman, Aidan Clark, Seb Noury, Matthew M. Botvinick, Nicolas Heess, and Raia Hadsell. Stabilizing transformers for reinforcement learning. In Proc. of ICML, 2020.
323
+
324
+ Niki Parmar, Ashish Vaswani, Jakob Uszkoreit, Lukasz Kaiser, Noam Shazeer, Alexander $\mathrm { K u }$ , and Dustin Tran. Image transformer. In Proc. of ICML, 2018.
325
+
326
+ Hao Peng, Roy Schwartz, Sam Thomson, and Noah A. Smith. Rational recurrences. In Proc. of EMNLP, 2018.
327
+
328
+ Hao Peng, Roy Schwartz, Dianqi Li, and Noah A. Smith. A mixture of $h - 1$ heads is better than $h$ heads. In Proc. of ACL, 2020.
329
+
330
+ Matt Post. A call for clarity in reporting BLEU scores. In Proc. of WMT, 2018.
331
+
332
+ Jiezhong Qiu, Hao Ma, Omer Levy, Wen-tau Yih, Sinong Wang, and Jie Tang. Blockwise selfattention for long document understanding. In Findings of EMNLP, 2020.
333
+
334
+ Dragomir R. Radev, Pradeep Muthukrishnan, and Vahed Qazvinian. The ACL Anthology network. In Proc. of the Workshop on Text and Citation Analysis for Scholarly Digital Libraries, 2009.
335
+
336
+ Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners, 2018.
337
+
338
+ Jack W. Rae, Anna Potapenko, Siddhant M. Jayakumar, Chloe Hillier, and Timothy P. Lillicrap. Compressive transformers for long-range sequence modelling. In Proc. of ICLR, 2020.
339
+
340
+ Ali Rahimi and Benjamin Recht. Random features for large-scale kernel machines. In Proc. of NeurIPS, 2007.
341
+
342
+ Ankit Singh Rawat, Jiecao Chen, Felix Xinnan X Yu, Ananda Theertha Suresh, and Sanjiv Kumar. Sampled softmax with random Fourier features. In Proc. of NeurIPS, 2019.
343
+
344
+ Aurko Roy, Mohammad Taghi Saffar, David Grangier, and Ashish Vaswani. Efficient content-based sparse attention with routing transformers. arXiv: 2003.05997, 2020.
345
+
346
+ Victor Sanh, Lysandre Debut, Julien Chaumond, and Thomas Wolf. DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter. arXiv: 1910.01108, 2020.
347
+
348
+ J. Schmidhuber. Learning to control fast-weight memories: An alternative to dynamic recurrent networks. Neural Computation, 4(1):131–139, 1992.
349
+ J. Schmidhuber. Reducing the ratio between learning complexity and number of time varying variables in fully recurrent nets. In Proc. of ICANN, 1993.
350
+ Rico Sennrich, Barry Haddow, and Alexandra Birch. Neural machine translation of rare words with subword units. In Proc. of ACL, 2016.
351
+ Sheng Shen, Zhen Dong, Jiayu Ye, Linjian Ma, Zhewei Yao, Amir Gholami, Michael W. Mahoney, and Kurt Keutzer. Q-BERT: Hessian based ultra low precision quantization of BERT. In Proc. of AAAI, 2020.
352
+ Sainbayar Sukhbaatar, Edouard Grave, Piotr Bojanowski, and Armand Joulin. Adaptive attention span in transformers. In Proc. of ACL, 2019.
353
+ Yitong Sun. Random Features Methods in Supervised Learning. PhD thesis, The University of Michigan, 2019.
354
+ Yi Tay, Dara Bahri, Donald Metzler, Da-Cheng Juan, Zhe Zhao, and Che Zheng. Synthesizer: Rethinking self-attention in transformer models. arXiv: 2005.00743, 2020a.
355
+ Yi Tay, Dara Bahri, Liu Yang, Don Metzler, and Da-Cheng Juan. Sparse sinkhorn attention. In Proc. of ICML, 2020b.
356
+ Yi Tay, Mostafa Dehghani, Dara Bahri, and Donald Metzler. Efficient transformers: A survey. arXiv: 2009.06732, 2020c.
357
+ Yi Tay, Mostafa Dehghani, Samira Abnar, Yikang Shen, Dara Bahri, Philip Pham, Jinfeng Rao, Liu Yang, Sebastian Ruder, and Donald Metzler. Long range arena: A benchmark for efficient transformers. In Proc. of ICLR, 2021.
358
+ Yao-Hung Hubert Tsai, Shaojie Bai, Makoto Yamada, Louis-Philippe Morency, and Ruslan Salakhutdinov. Transformer dissection: An unified understanding for transformer’s attention via the lens of kernel. In Proc. of EMNLP, 2019.
359
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Ł ukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Proc. of NeurIPS, 2017.
360
+ Sinong Wang, Belinda Z. Li, Madian Khabsa, Han Fang, and Hao Ma. Linformer: Self-attention with linear complexity. arXiv: 2006.04768, 2020.
361
+ Ronald J. Williams and David Zipser. A learning algorithm for continually running fully recurrent neural networks. Neural Computation, 1:270–280, 1989.
362
+ Felix Wu, Angela Fan, Alexei Baevski, Yann Dauphin, and Michael Auli. Pay less attention with lightweight and dynamic convolutions. In Proc. of ICLR, 2019.
363
+ Zhanghao Wu, Zhijian Liu, Ji Lin, Yujun Lin, and Song Han. Lite transformer with long-short range attention. In Proc. of ICLR, 2020.
364
+ Weiqiu You, Simeng Sun, and Mohit Iyyer. Hard-coded Gaussian attention for neural machine translation. In Proc. of ACL, 2020.
365
+ Felix Xinnan X Yu, Ananda Theertha Suresh, Krzysztof M Choromanski, Daniel N Holtmann-Rice, and Sanjiv Kumar. Orthogonal random features. In Proc. of NeurIPS, 2016.
366
+ Manzil Zaheer, Guru Guruganesh, Avinava Dubey, Joshua Ainslie, Chris Alberti, Santiago Ontanon, Philip Pham, Anirudh Ravula, Qifan Wang, Li Yang, and Amr Ahmed. Big bird: Transformers for longer sequences. arXiv: 2007.14062, 2020.
367
+
368
+ # Appendices
369
+
370
+ A RANDOM FEATURE ATTENTION IN MORE DETAIL
371
+
372
+ A.1 DETAILED COMPUTATION PROCEDURE
373
+
374
+ Algorithms 1 and 2 describe causal and cross random feature attention’s computation procedures.
375
+
376
+ # Algorithm 1 Causal random feature attention.
377
+
378
+ 1: procedure RFA-CAUSAL( $\{ \mathbf { q } _ { i } \} _ { i = 1 } ^ { N }$ , {ki}Ni=1, {vi}Ni=1)
379
+ 2: $\vartriangleright \mathbf { S }$ is a $D \times d$ matrix
380
+ 3: $\vartriangleright$ is a $D$ -dimensional vector
381
+ 4: S, $\mathbf { z } \gets \mathbf { 0 }$ , 0
382
+ 5: for $i = 1$ to $N$ do
383
+ 6: $\widetilde { \mathbf { q } } _ { i }$ , $\bar { \mathbf { k } } _ { i } \phi ( \mathbf { q } _ { i } )$ , $\phi ( \mathbf { k } _ { i } )$ . Random feature maps
384
+ 7: S ← S + ki ⊗ vi
385
+ 8: z z + ki
386
+ 9: h>i ← q>i S/(qi · z)
387
+ 10: 11: end foreturn $\{ { \bf h } _ { i } \} _ { i = 1 } ^ { N }$
388
+ 12: end procedure
389
+
390
+ # Algorithm 2 Cross random feature attention.
391
+
392
+ 1: procedure RFA-CROSS( $\{ \mathbf { q } _ { i } \} _ { i = 1 } ^ { N }$ , {ki}Mi=1, {vi}Mi=1)
393
+ 2: $\vartriangleright \mathbf { S }$ is a $D \times d$ matrix
394
+ 3: $\vartriangleright$ is a $D$ -dimensional vector
395
+ 4: S, $\mathbf z \gets \mathbf 0$ , 0
396
+ 5: for $i = 1$ to $M$ do
397
+ 6: $\begin{array} { r l } & { \widetilde { \mathbf { k } } _ { i } \gets \phi ( \mathbf { k } _ { i } ) \quad \mathrm { ~ \ u ~ { ~ p ~ R ~ } ~ } } \\ & { \mathbf { S } \gets \mathbf { S } + \widetilde { \mathbf { k } } _ { i } \otimes \mathbf { v } _ { i } ^ { \top } } \\ & { \mathbf { z } \gets \mathbf { z } + \widetilde { \mathbf { k } } _ { i } } \end{array}$ andom feature map
398
+ 7:
399
+ 8:
400
+ 9: end for
401
+ 10: for $i = 1$ to $N$ do
402
+ 11: qi ← φ(qi) . Random feature map
403
+ 12: $\mathbf { h } _ { i } ^ { \top } \widetilde { \mathbf { q } } _ { i } ^ { \top } \mathbf { S } / ( \widetilde { \mathbf { q } } _ { i } \cdot \mathbf { z } )$
404
+ 13: 14: return end for $\{ { \bf h } _ { i } \} _ { i = 1 } ^ { N }$
405
+ 15: end procedure
406
+
407
+ # A.2 VARIANCE OF RANDOM FOURIER FEATURES
408
+
409
+ The following result is due to $\mathrm { Y u }$ et al. (2016). Using the same notation as in $\ S 2 . 2$
410
+
411
+ $$
412
+ \mathrm { V a r } ( \phi \left( \mathbf { x } \right) \cdot \phi \left( \mathbf { y } \right) ) = \frac { 1 } { 2 D } \left( 1 - e ^ { - z ^ { 2 } } \right) ^ { 2 } ,
413
+ $$
414
+
415
+ where $z = \| \mathbf x - \mathbf y \| / \sigma$ .
416
+
417
+ # A.3 DERIVATION OF CAUSAL RFA
418
+
419
+ This section presents a detailed derivation of causal RFA as in $\ S 3 . 1$ . Following Eq. 5 but changing the attended keys and values to the prefix:
420
+
421
+ $$
422
+ \operatorname { R F A } ( \mathbf { q } _ { t } , \{ \mathbf { k } _ { i } \} _ { i \leq t } , \{ \mathbf { v } _ { i } \} _ { i \leq t } ) = \frac { \phi \left( \mathbf { q } _ { t } \right) ^ { \top } \sum _ { i \leq t } \phi \left( \mathbf { k } _ { i } \right) \otimes \mathbf { v } _ { i } } { \phi \left( \mathbf { q } _ { t } \right) \cdot \sum _ { j \leq t } \phi \left( \mathbf { k } _ { j } \right) }
423
+ $$
424
+
425
+ Let $\begin{array} { r } { \mathbf { S } _ { t } \triangleq \sum _ { i \leq t } \phi ( \mathbf { k } _ { i } ) \otimes \mathbf { v } _ { i } } \end{array}$ , and $\begin{array} { r } { \mathbf { z } _ { t } \triangleq \sum _ { i \leq t } \phi ( \mathbf { k } _ { i } ) } \end{array}$ ; both can be calculated recurrently. Assuming $\mathbf { S } _ { 0 } = \mathbf { 0 }$ and ${ \bf z } _ { 0 } = { \bf 0 }$ :
426
+
427
+ $$
428
+ \mathbf { S } _ { t } = \mathbf { S } _ { t - 1 } + \phi \left( \mathbf { k } _ { t } \right) \otimes \mathbf { v } _ { t } , \quad \mathbf { z } _ { t } = \mathbf { z } _ { t - 1 } + \phi \left( \mathbf { k } _ { t } \right) , \quad t \geq 1 .
429
+ $$
430
+
431
+ This completes the derivation of causal RFA as in $\ S 3 . 1$ .
432
+
433
+ # A.4 RFA WITHOUT NORM-1 CONSTRAINTS
434
+
435
+ $\ S 3 . 1$ assumes that the queries and keys are unit vectors. This norm-1 constraint is not a must. Here we present a RFA without imposing this constraint. Let $C ( \mathbf { x } ) = \exp ( \left\| \mathbf { x } \right\| ^ { 2 } / 2 \sigma ^ { 2 } )$ . From Eq. 4 we have attn $\left( \mathbf { q } _ { t } , \{ \mathbf { k } _ { i } \} , \{ \mathbf { v } _ { i } \} \right) =$
436
+
437
+ $$
438
+ \begin{array} { r l r } & { } & { \sum _ { i } \frac { \exp \big ( \mathbf { q } _ { t } \cdot \mathbf { k } _ { i } / \sigma ^ { 2 } \big ) } { \sum _ { j } \exp \big ( \mathbf { q } _ { t } \cdot \mathbf { k } _ { j } / \sigma ^ { 2 } \big ) } \mathbf { v } _ { i } ^ { \top } \approx \displaystyle \sum _ { i } \frac { C \left( \mathbf { q } _ { t } \right) C \left( \mathbf { k } _ { i } \right) \phi \left( \mathbf { q } _ { t } \right) ^ { \top } \phi \left( \mathbf { k } _ { i } \right) \mathbf { v } _ { i } ^ { \top } } { \sum _ { j } C \left( \mathbf { q } _ { t } \right) C \left( \mathbf { k } _ { j } \right) \phi \left( \mathbf { q } _ { t } \right) \cdot \phi \left( \mathbf { k } _ { j } \right) } } \\ & { } & { \qquad = \frac { \phi \left( \mathbf { q } _ { t } \right) ^ { \top } \sum _ { i } C \left( \mathbf { k } _ { i } \right) \phi \left( \mathbf { k } _ { i } \right) \otimes \mathbf { v } _ { i } } { \phi \left( \mathbf { q } _ { t } \right) \cdot \sum _ { j } C \left( \mathbf { k } _ { j } \right) \phi \left( \mathbf { k } _ { j } \right) } . } \end{array}
439
+ $$
440
+
441
+ The specific attention computation is similar to those in $\ S 3 . 1$ . In sum, lifting the norm-1 constraint brings an additional scalar term $C ( \cdot )$ .
442
+
443
+ # A.5 RELATING RFA-GATE TO SOFTMAX ATTENTION
444
+
445
+ Drawing inspiration from gated RNNs, $\ S 3 . 2$ introduces a gated variant of RFA. Now we study its “softmax counterpart.”
446
+
447
+ $$
448
+ \begin{array} { l } { { \displaystyle { \widetilde { \bf { k } } } _ { i } = { \bf { k } } _ { i } { \bf { \Gamma } } ( 1 - g _ { i } ) \prod _ { j = i + 1 } ^ { t } g _ { j } , \quad { \widetilde { \bf { v } } } _ { i } = { \bf { v } } _ { i } { \bf { \Gamma } } ( 1 - g _ { i } ) \prod _ { j = i + 1 } ^ { t } g _ { j } , \quad i = 1 , \dots , t } } \\ { { \displaystyle { \bf { h } } _ { t } = \mathrm { a t t n } ( { \bf { q } } _ { t } , \{ { \widetilde { \bf { k } } } _ { i } \} _ { i \le t } , \{ { \widetilde { \bf { v } } } _ { i } \} _ { i \le t } ) } . } \end{array}
449
+ $$
450
+
451
+ $\mathbf { h } _ { t }$ is the output at timestep $t$ and is used for onward computation.
452
+
453
+ At each step, all prefix keys and values are decayed by a gate value before calculating the attention. This implies that the attention computation for $\mathbf { q } _ { t + 1 }$ cannot start until that of $\mathbf { q } _ { t }$ is finished. Combined with the linear complexity of softmax normalization, this amounts to quadratic time in sequence length, even for language modeling training.
454
+
455
+ The above model is less intuitive and more expensive in practice, without the RFA perspective. This shows that RFA brings some benefits in developing new attention models.
456
+
457
+ # A.6 DETAILED COMPLEXITY ANALYSIS
458
+
459
+ Table 4 considers a sequence-to-sequence model, and breaks down the comparisons to training (with teacher forcing; Williams & Zipser, 1989) and autoregressive decoding. Here we assume enough threads to fully parallelize softmax attention across timesteps when the inputs are revealed to the model in full. RFA has a lower space complexity, since it never explicitly populates the attention matrices. As for time, RFA trains in linear time, and so does the softmax attention: in teacher-forcing training a standard transformer decoder parallelizes the attention computation across time steps. The trend of the time comparison differs during decoding: when only one output token is produced at a time, RFA decodes linearly in the output length, while softmax attention decodes quadratically.
460
+
461
+ <table><tr><td></td><td></td><td colspan="3">Time Complexity</td><td colspan="3"> Space Complexity</td></tr><tr><td>Setting</td><td>Model</td><td>Encoder</td><td>Cross</td><td>Causal</td><td>Encoder</td><td>Cross</td><td>Causal</td></tr><tr><td>Training w/</td><td>softmax</td><td>O(M)</td><td>O(M)</td><td>O(N)</td><td>O(M2)</td><td>O(MN)</td><td>O(N2)</td></tr><tr><td>teacher forcing</td><td>RFA</td><td>(M)</td><td>O(M)</td><td>O(N)</td><td>O(M)</td><td>O(M + N)</td><td>O(N)</td></tr><tr><td>Decoding</td><td>softmax RFA</td><td>O(M) O(M)</td><td>O(MN) O(M + N)</td><td>O(N2) O(N)</td><td>O(M2) O(M)</td><td>O(MN) O(M + N)</td><td>O(N2) O(N)</td></tr></table>
462
+
463
+ Table 4: Time and space complexity comparisons between RFA and its softmax counterpart in a sequence-to-sequence attentive model, assuming an infinite amount of available threads. $M$ and $N$ denote the lengths of the source and target sequences respectively. Teacher forcing training (Williams & Zipser, 1989) and autoregressive decoding are assumed. Blue color indicates the cases where RFA asymptotically outperforms softmax attention.
464
+
465
+ <table><tr><td>Data</td><td>Train</td><td>Dev.</td><td>Test</td><td>Vocab.</td></tr><tr><td>WikiText-103</td><td>103M</td><td>218K</td><td>246K</td><td>268K</td></tr><tr><td>WMT14 EN-DE</td><td>4.5M</td><td>3K</td><td>3K</td><td>32K</td></tr><tr><td>WMT14EN-FR</td><td>4.5M</td><td>3K</td><td>3K</td><td>32K</td></tr><tr><td>IWSLT14 DE-EN</td><td>160K</td><td>7K</td><td>7K</td><td>9K/7K</td></tr></table>
466
+
467
+ Table 5: Some statistics for the datasets. WikiText-103 split sizes are in number of tokens, while others are in number of instances.
468
+
469
+ # B EXPERIMENTAL DETAILS
470
+
471
+ Table 5 summarizes some statistics of the datasets used in our experiments. Our implementation is based on JAX.15
472
+ Table 6: WMT14 EN-DE development set performance varying the number of random matrices to sample from during training. No beam search or checkpoint averaging is used.
473
+
474
+ <table><tr><td># Random Matrices</td><td>1</td><td>50</td><td>100</td><td>200</td></tr><tr><td>BLEU</td><td>24.0</td><td>25.7</td><td>25.8</td><td>25.8</td></tr></table>
475
+
476
+ During training, we sample a different random projection matrix for each attention head. Preliminary experiments suggest this performs better than using the same random projection throughout training (Table 6). Our conjecture is that this helps keep the attention heads from “over committing” to any particular random projection (Peng et al., 2020). To avoid the overhead of sampling from Gaussian during training, we do this in an offline manner. I.e., before training we construct a pool of random matrices (typically 200), at each training step we draw from the pool. At test time each attention head uses the same random projection, since no accuracy benefit is observed by using different ones for different test instances.
477
+
478
+ # B.1 LANGUAGE MODELING
479
+
480
+ We compare the models using two model size settings, summarized in Table 7. We use the fixed sinusoidal position embeddings by Vaswani et al. (2017). All models are trained for up to 150K gradient steps using the Adam optimizer (Kingma & Ba, 2015). No $\ell _ { 2 }$ -regularization is used. We apply early stopping based on development set perplexity. All models are trained using 16 TPU v3 accelerators, and tested using a single TPU v2 accelerator.
481
+
482
+ Table 7: Hyperparameters used in the language modeling experiments.
483
+
484
+ <table><tr><td>Hyperprams.</td><td>Small</td><td>Big</td></tr><tr><td>#Layers</td><td>6</td><td>16</td></tr><tr><td>#Heads</td><td>8</td><td>16</td></tr><tr><td>Embedding Size</td><td>512</td><td>1024</td></tr><tr><td>Head Size</td><td>64</td><td>64</td></tr><tr><td>FFN Size</td><td>2048</td><td>4096</td></tr><tr><td>Batch Size</td><td>64</td><td>64</td></tr><tr><td>Learning Rate</td><td>[1 × 10-4,2.5 × 10-4,5 × 10-4]</td><td></td></tr><tr><td>Warmup Steps</td><td>6000</td><td>6000</td></tr><tr><td>Gradient Clipping Norm</td><td>0.25</td><td>0.25</td></tr><tr><td>Dropout</td><td>[0.05, 0.1]</td><td>[0.2, 0.25, 0.3]</td></tr><tr><td>Random Feature Map Size</td><td>64</td><td>64</td></tr></table>
485
+
486
+ # B.2 MACHINE TRANSLATION
487
+
488
+ WMT14. We use the fixed sinusoidal position embeddings by Vaswani et al. (2017). For both EN-DE and EN-FR experiments, we train the models using the Adam (with $\beta _ { 1 } = 0 . 1$ , $\beta _ { 2 } = 0 . 9 8$ , and $\epsilon = 1 0 ^ { - 9 }$ ) optimizer for up to 350K gradient steps. We use a batch size of 1,024 instances for EN-DE, while 4,096 for the much larger EN-FR dataset. The learning rate follows that by Vaswani et al. (2017). Early stopping is applied based on development set BLEU. No $\ell _ { 2 }$ regularization or gradient clipping is used. All models are trained using 16 TPU v3 accelerators, and tested using a single TPU v2 accelerator. Following standard practice, we average 10 most recent checkpoints at test time. We evaluate the models using SacreBLEU (Post, 2018).16 A beam search with beam size 4 and length penalty 0.6 is used. Other hyperparameters are summarized in Table 8.
489
+
490
+ Table 8: Hyperparameters used in the machine translation experiments.
491
+
492
+ <table><tr><td>Hyperprams.</td><td>WMT14</td><td>IWSLT14</td></tr><tr><td>#Layers</td><td>6</td><td>6</td></tr><tr><td>#Heads</td><td>8</td><td>8</td></tr><tr><td>Embedding Size</td><td>512</td><td>512</td></tr><tr><td>Head Size</td><td>64</td><td>64</td></tr><tr><td>FFN Size</td><td>2048</td><td>2048</td></tr><tr><td>Warmup Steps</td><td>6000</td><td>4000</td></tr><tr><td>Dropout</td><td>0.1</td><td>0.3</td></tr><tr><td>Cross Attention Feature Map</td><td>128</td><td>128</td></tr><tr><td>Causal Attention Feature Map</td><td>64</td><td>64</td></tr></table>
493
+
494
+ # C MORE ANALYSIS RESULTS
495
+
496
+ C.1 MORE RESULTS ON DECODING SPEED AND MEMORY OVERHEAD
497
+
498
+ Figure 3 compares the RFA’s unconditional decoding speed and memory against the softmax attention. The setting is the same as that in $\ S 5$ except that here the models do not have an encoder. This experiment aims to simulate the applications such as sampling from a language model.
499
+
500
+ # C.2 EFFECT OF RANDOM FEATURE SIZE
501
+
502
+ This section studies how the size of $\phi ( \cdot )$ affects the performance. Table 9 summarize RFAGaussian’s performance on WMT14 EN-DE development set. The model and training are the same as that used in $\ S 4 . 2$ except random feature size. Recall from $\ S 2 . 2$ that the size of $\bar { \phi } ( \cdot )$ is $2 D$ for
503
+
504
+ ![](images/8ba8039098d69ff3af8f038cc96c9a4ddfc21cdc6f0a5599ccf828e4b8cb716f.jpg)
505
+ Figure 3: Unconditional decoding speed (left) and memory overhead (right) varying the output lengths. All models are tested on a single TPU v2 accelerator, with greedy decoding and batch size 16.
506
+
507
+ RFA-Gaussian. When the size of $\phi ( \cdot )$ is too small (32 or 64 for cross attention, 32 for causal attention), training does not converge. We observe accuracy improvements by using random features sufficiently large (256 for cross attention and 128 for causal attention); going beyond that, the benefit is marginal.
508
+
509
+ <table><tr><td>Size</td><td>32</td><td>64</td><td>128</td><td>256</td><td>512</td></tr><tr><td>BLEU</td><td>N/A</td><td>N/A</td><td>24.9</td><td>25.8</td><td>26.0</td></tr></table>
510
+
511
+ <table><tr><td> Size</td><td>32</td><td>64</td><td>128</td><td>256</td><td>512</td></tr><tr><td>BLEU</td><td>N/A</td><td>25.3</td><td>25.8</td><td>25.8</td><td>25.6</td></tr></table>
512
+
513
+ (a) Varying cross attention $\phi$ sizes while fixing that of causal attention to be 128.
514
+
515
+ (b) Varying causal attention $\phi$ sizes while fixing that of cross attention to be 256.
516
+
517
+ Table 9: WMT14 EN-DE development set performance of RFA-Gaussian (the size of $\phi$ is $2 D$ ; $\ S 2 . 2 )$ varying the random feature sizes. N/A indicates training does not converge. No beam search or checkpoint averaging is used.
518
+
519
+ # C.3 TRAIN AND EVALUATE WITH DIFFERENT ATTENTION FUNCTIONS
520
+
521
+ RFA achieves comparable performance to its softmax counterpart. Does this imply that it learns a good approximation to the softmax attention? To answer this question, we consider:
522
+
523
+ (i) an RFA-Gaussian model initialized from a pretrained softmax-transformer;
524
+ (ii) a softmax-transformer initialized from a pretrained an RFA-Gaussian model.
525
+
526
+ If RFA’s good performance can be attributed to learning a good approximation to softmax, both, without finetunining, should perform similarly to the pretrained models. However, this is not the case on IWSLT14 DE-EN. Both pretrained models achieve more than 35.2 development set BLEU. In contrast, (i) and (ii) respectively get 2.3 and 1.1 BLEU without finetuning, hardly beating a randomly-initialized untrained model. This result aligns with the observation by Choromanski et al. (2021), and suggests that it is not the case that RFA performs well because it learns to imitate softmax attention’s outputs.
527
+
528
+ # C.4 KNOWLEDGE TRANSFER FROM SOFTMAX ATTENTION TO RFA
529
+
530
+ We first supplement the observation in Appendix C.3 by finetuning (i) on the same pretraining data. Figure 4 plots the learning curves. It takes RFA roughly 1,500 steps to reach similar training loss to the pretrained model. As a baseline, “RFA Reset” resets the multihead attention parameters (i.e., those for query, key, value, and output projections) to randomly initialized ones. Its learning curve is similar to that of (i), suggesting that the pretrained multihead attention parameters are no more useful to RFA than randomly initialized ones. To further confirm this observation, “softmax Reset”
531
+
532
+ ![](images/2f8ac521472a4c205709445602ef16f36e10549c9955d330925e4a7a740f110e.jpg)
533
+ Figure 4: Finetuning an RFA-Gaussian model with its parameters initialized from a pretrained softmax-transformer. “Reset” indicates resetting the multihead attention parameters to randomlyinitialized ones. The dashed line indicates the training loss of the pretrained model.
534
+
535
+ resets the multihead attention parameters without changing the attention functions. It converges to the pretraining loss in less than 200 steps.
536
+
537
+ Takeaway. From the above results on IWSLT14, pretrained knowledge in a softmax transformer cannot be directly transferred to an RFA model. However, from Figure 4 and a much larger-scale experiment by Choromanski et al. (2021), we do observe that RFA can recover the pretraining loss, and the computation cost of finetuning is much less than training a model from scratch. This suggests some potential applications. For example, one might be able to initialize an RFA language model from a softmax transformer pretrained on large-scale data (e.g., GPT-3; Brown et al., 2020), and finetune it at a low cost. The outcome would be an RFA model retaining most of the pretraining knowledge, but is much faster and more memory-friendly to sample from. We leave such exploration to future work.
md/train/RovX-uQ1Hua/RovX-uQ1Hua.md ADDED
@@ -0,0 +1,453 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TEXT GENERATION BY LEARNING FROM DEMONSTRATIONS
2
+
3
+ Richard Yuanzhe Pang 1
4
+
5
+ yzpang@nyu.edu
6
+
7
+ He He 1,2 hehe@cs.nyu.edu
8
+
9
+ 1 Courant Institute of Mathematical Sciences, New York University, New York, NY 10011, USA
10
+ 2 Center for Data Science, New York University, New York, NY 10011, USA
11
+
12
+ # ABSTRACT
13
+
14
+ Current approaches to text generation largely rely on autoregressive models and maximum likelihood estimation. This paradigm leads to (i) diverse but low-quality samples due to mismatched learning objective and evaluation metric (likelihood vs. quality) and (ii) exposure bias due to mismatched history distributions (gold vs. model-generated). To alleviate these problems, we frame text generation as an offline reinforcement learning (RL) problem with expert demonstrations (i.e., the reference), where the goal is to maximize quality given model-generated histories. We propose GOLD (generation by off-policy learning from demonstrations): an easy-to-optimize algorithm that learns from the demonstrations by importance weighting. Intuitively, GOLD upweights confident tokens and downweights unconfident ones in the reference during training, avoiding optimization issues faced by prior RL approaches that rely on online data collection. According to both automatic and human evaluation, models trained by GOLD outperform those trained by MLE and policy gradient on summarization, question generation, and machine translation. Further, our models are less sensitive to decoding algorithms and alleviate exposure bias.
15
+
16
+ # 1 INTRODUCTION
17
+
18
+ A dominant approach to text generation is to use autoregressive models learned by maximum likelihood estimation (MLE) on supervised data. However, this approach introduces two well-known discrepancies between training and evaluation objectives that lead to undesired generations. First, the training loss is negative log-likelihood, whereas the evaluation is based on human judgment of the output quality. Under model misspecification, MLE tends to over-generalize, assigning large probability mass to both high-quality and low-quality sequences (Huszar, 2015; Simon et al., 2019). ´ Therefore, in practice, we must carefully select the decoding algorithms to produce high-quality outputs.
19
+
20
+ Second, during training, the autoregressive model conditions on the gold history/prefix; however, at inference time it conditions on model-generated history. This is known as the exposure bias problem (Ranzato et al., 2016; Bengio et al., 2015). In the worst case, one incorrect prediction can produce a low-probability prefix under the gold data distribution, and errors compound in each of the following steps (Ross et al., 2011). In practice, prior work has observed problems such as repetition and hallucination partly due to exposure bias (Holtzman et al., 2020; Wang & Sennrich, 2020).
21
+
22
+ We aim to bridge the gap between training and evaluation in this paper. To match training and evaluation objectives, ideally we should maximize output quality given model-generated histories. This corresponds to the reinforcement learning (RL) objective: maximizing the expected reward (quality) over trajectories (sequences) induced by the policy (model). However, optimizing this objective is notoriously difficult. Prior RL approaches mainly focus on fine-tuning a learned model to optimize sequence-level metrics such as BLEU (Papineni et al., 2002), but empirically it remains unclear if RL is beneficial to text generation (Wu et al., 2018; Choshen et al., 2020). Note that many challenges in RL arise from exploring an exponentially large space of sequences, with sparse rewards only on those close to the reference. We thus propose to learn from only the reference sequences without interaction (i.e., the offline setting). Specifically, we use off-policy policy gradient with importance weighting (Hastings, 1970; Hachiya et al., 2009; Parshakova et al., 2019), where training examples with higher probability under the model are weighted higher. Further, our reward functions approximate human judgment of the output quality by estimating how likely a human would have generated a sequence. We call our algorithm GOLD (Generation by Off-policy Learning from Demonstrations).
23
+
24
+ Results on news summarization, question generation, and machine translation show that GOLD leads to better model performance than MLE and RL fine-tuning by both task metrics and human-rated quality. Further, our analysis shows that GOLD learns high-precision models that are less sensitive to decoding algorithms. In addition, it alleviates exposure bias: the output quality does not degrade much as generation length increases.
25
+
26
+ # 2 FROM MLE TO RL FRAMEWORK
27
+
28
+ MLE training. Given a context $_ { \textbf { \em x } }$ such as a document, we want to generate a sequence of tokens $\pmb { y } = ( y _ { 0 } , \dots , y _ { T } )$ , where $y _ { i }$ comes from a vocabulary $\nu$ . The generator is modeled by a conditional probability distribution parametrized by $\theta$ : $\begin{array} { r } { p _ { \theta } ( \pmb { y } \mid x ) = \prod _ { t = 0 } ^ { T } p _ { \theta } ( y _ { t } \mid \pmb { y } _ { 0 : t - 1 } , \pmb { x } ) } \end{array}$ , where ${ \bf { \sigma } } _ { { \bf { y } } _ { 0 : } { t - 1 } }$ denotes the prefix $y _ { 0 } , \ldots , y _ { t - 1 }$ . Let $p _ { \mathrm { h u m a n } } ( \pmb { y } \mid \pmb { x } )$ denote the data-generating distribution. Using MLE, the loss function is
29
+
30
+ $$
31
+ \mathcal { L } ( \theta ) = - \mathbb { E } _ { y \sim p _ { \mathrm { h u m a n } } } \left[ \sum _ { t = 0 } ^ { T } \log p _ { \theta } ( y _ { t } \mid y _ { 0 : t - 1 } , \boldsymbol { x } ) \right] .
32
+ $$
33
+
34
+ At inference time, we generate tokens sequentially according to $p _ { \theta }$
35
+
36
+ Evaluation. In practice, the quality of an output often relies on task-specific metrics such as fluency, correctness, and interestingness. Here for generality we consider perceptual quality (Huszar, 2015; ´ Hashimoto et al., 2019) which measures how likely a human would have generated the output given the context, i.e., $p _ { \mathrm { h u m a n } } ( \pmb { y } \mid \pmb { x } )$ . Thus the evaluation metric is
37
+
38
+ $$
39
+ \mathbb { E } _ { { \pmb y } \sim p _ { \theta } } \left[ \sum _ { t = 0 } ^ { T } \log p _ { \mathrm { h u m a n } } ( y _ { t } \mid \pmb y _ { 0 : t - 1 } , \pmb x ) \right] .
40
+ $$
41
+
42
+ Comparing (1) and (2), we see that the training objective encourages high recall: the model must put probability mass on all human-generated sequences. In contrast, the evaluation metric encourages high precision: all outputs from the model must be of high quality. Unfortunately, directly optimizing the evaluation metric is impossible because $p _ { \mathrm { h u m a n } }$ is unknown and the expectation is difficult to estimate. We therefore develop a training objective that closely approximates (2) in the RL framework.
43
+
44
+ RL formulation. Let’s consider generation as a sequential decision-making process. At each time step $t$ , the policy $\pi _ { \theta }$ takes an action $a _ { t } \in \mathcal V$ , transits to the next state $s _ { t + 1 } = ( \pmb { y } _ { 0 : t } , \pmb { x } )$ , and receives a reward $r _ { t }$ . The policy corresponds to the generation model: $\pi _ { \boldsymbol { \theta } } ( a _ { t } \mid s _ { t } ) = p _ { \boldsymbol { \theta } } ( a _ { t } \mid \pmb { y } _ { 0 : t - 1 } , \pmb { x } )$ . We can thus represent a sequence as a trajectory $\tau = ( s _ { 0 } , a _ { 0 } , r _ { 0 } , \ldots , s _ { T } , a _ { T } , r _ { T } )$ . The set of trajectories derived from the training data is called demonstrations which show the desired behavior of a policy. The RL objective is to maximize J(θ) = Eτ∼πθ $J ( \theta ) = \mathbb { E } _ { \tau \sim \pi _ { \theta } } \left[ \sum _ { t = 0 } ^ { T } \gamma ^ { t } r _ { t } \right]$ , where $\gamma \in ( 0 , 1 ]$ is the discount factor, and $\pi _ { \boldsymbol { \theta } } ( \tau )$ denotes the distribution of $\tau$ induced by $\pi _ { \theta }$ . If we knew oracle rewards $r _ { t } = p _ { \mathrm { h u m a n } } ( a _ { t } \mid s _ { t } )$ , then this objective would be exactly the evaluation metric we want to optimize. Next, we describe how to optimize $J ( \theta )$ with reward functions that approximate $p _ { \mathrm { h u m a n } }$ .
45
+
46
+ # 3 APPROACH
47
+
48
+ # 3.1 OFF-POLICY POLICY GRADIENT
49
+
50
+ Policy gradient. A straightforward way to optimize $J ( \theta )$ is policy gradient (PG) (Williams, 1992; Sutton et al., 2000). The gradient is given by
51
+
52
+ $$
53
+ \nabla _ { \theta } J ( \theta ) = \mathbb { E } _ { \tau \sim \pi _ { \theta } } \left[ \sum _ { t } \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } \mid s _ { t } ) \hat { Q } ( s _ { t } , a _ { t } ) \right] ,
54
+ $$
55
+
56
+ where Qˆ(st, at) = PTt0=t γ is the estimated return from state $s _ { t }$ . The expectation is estimated by Monte Carlo samples from $\pi _ { \theta }$ . In text generation, the return $\hat { Q } ( s _ { t } , a _ { t } )$ is often a sequence-level reward such as BLEU. In practice, the policy is likely to get stuck in a region of zero reward during training, generating gibberish without receiving any learning signal (Li et al., 2018; Keneshloo et al., 2019). A common remedy is to initialize the policy with the MLE solution and/or interleave with MLE gradient update during PG. However, this would bias the parameters towards the MLE solution, thus often leads to marginal gains in practice (Wu et al., 2018; Choshen et al., 2020).
57
+
58
+ Offline learning. To avoid zero-reward regions, we would like to reduce interaction with the environment and stay close to the demonstrated trajectories. In the extreme case, the policy is learned solely from the static demonstrations without additional interaction with the environment, which is referred to as the offline setting. While it is in general a more challenging problem, we argue that the offline setting is appropriate for text generation (Serban et al., 2017; Jaques et al., 2019). First, the environment dynamics is known: once a token is generated, we deterministically transition to the next state with the additional token appended to the prefix; no interaction is needed to learn the environment. Second, while exploration may lead to high-quality sequences different from the reference, we lack a good reward function to identify them (Novikova et al., 2017; Aharoni & Goldberg, 2018; Clark et al., 2019). Therefore, the benefit of exploration in text generation is limited.
59
+
60
+ In the offline setting, we cannot estimate the expected return of $\pi _ { \theta }$ by sampling trajectories from it, and must use trajectories from a different behavioral policy $\pi _ { b }$ , known as off-policy learning in RL. A common technique to estimate expectations under one distribution $\pi _ { \theta }$ given samples from a different distribution $\pi _ { b }$ is importance sampling, which leads to the following unbiased estimator of the gradient (Precup et al., 2000):
61
+
62
+ $$
63
+ \mathbb { E } _ { \tau \sim \pi _ { b } } \left[ \sum _ { t } w _ { t } \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } \mid s _ { t } ) \hat { Q } ( s _ { t } , a _ { t } ) \right] ,
64
+ $$
65
+
66
+ with importance weights wt = Qtt0=0 πθ(at0 |st0 )πb(at0 |st0 ) .
67
+
68
+ Approximations. Computing the importance weights above requires multiplying per-action importance weight over multiple time steps. In practice, we have found that it is sensitive to optimization hyperparameters and takes longer to converge. Therefore, we use the per-action approximation: $\begin{array} { r } { w _ { t } \approx \frac { \pi _ { \theta } ( a _ { t } | s _ { t } ) } { \pi _ { b } ( a _ { t } | s _ { t } ) } } \end{array}$ . This corresponds to optimizing the expected return under the off-policy state distribution induced by $\pi _ { b }$ and the on-policy action distribution of $\pi _ { \theta }$ . Although this estimator is biased, empirically it has been shown to reduce variance and work reasonably well if $\pi _ { b }$ and $\pi _ { \theta }$ are close (Serban et al., 2017; Levine et al., 2020). Another obstacle is that we do not know $\pi _ { b }$ which produced the demonstrations $\mathcal { D } = \{ ( \boldsymbol { { \mathbf { x } } ^ { ( i ) } } , \boldsymbol { { \mathbf { y } } ^ { ( i ) } } ) \} _ { i = 1 } ^ { N }$ . One option is to estimate $\pi _ { b }$ on $\mathcal { D }$ . Here we take a simpler approach that uses the empirical distribution: $\pi _ { b } ( \tau ) \approx 1 / N$ for $\tau \in \mathcal { D }$ and 0 otherwise. As a result, the denominator in $w _ { t }$ is a constant and can be ignored in optimization. Our final approximated gradient has the form:
69
+
70
+ $$
71
+ \nabla _ { \theta } J ( \theta ) \approx \sum _ { i = 1 } ^ { N } \sum _ { t = 0 } ^ { T } \pi _ { \theta } ( a _ { t } ^ { i } \mid s _ { t } ^ { i } ) \nabla _ { \theta } \log \pi _ { \theta } ( a _ { t } ^ { i } \mid s _ { t } ^ { i } ) \hat { Q } ( s _ { t } ^ { i } , a _ { t } ^ { i } ) ,
72
+ $$
73
+
74
+ where the superscript $i$ represents the $i$ th trajectory. Compared with the MLE gradient: $\begin{array} { r } { \sum _ { i = 1 } ^ { N } \sum _ { t = 0 } ^ { T } \bar { \nabla _ { \theta } } \log \bar { \pi _ { \theta } } ( a _ { t } ^ { i } \mathbf { \pi } | \mathbf { \pi } \bar { s } _ { t } ^ { i } ) } \end{array}$ , our gradient (4) upweights actions with high return and actions preferred by the current policy $\pi _ { \theta }$ . Intuitively, it encourages the learning algorithm to focus on “easy” examples (high likelihood under the model) which improves precision.
75
+
76
+ # 3.2 REWARD
77
+
78
+ Let $R$ be the reward function such that $r _ { t } = R ( s _ { t } , a _ { t } )$ . To optimize the perceptual quality of a sequence (see (2)), we want $R ( s , a )$ to approximate $p _ { \mathrm { h u m a n } } ( a \mid s )$ , i.e., how likely humans would have generated $a$ given $s$ . In general, it is hard to develop a reliable reward function for text generation tasks because it must work well for a large set of possible generations. In the offline setting, however, we can restrict the domain of $R$ to state-action pairs on the demonstrations. Next, we propose three reward functions.
79
+
80
+ $\delta$ -reward. An obvious choice is a sequence-level reward, which considers all demonstrations to be equally good and assigns zero reward to any other outputs. Formally,
81
+
82
+ $$
83
+ R _ { \delta } { \left( s _ { t } , a _ { t } \right) } \stackrel { \mathrm { d e f } } { = } \left\{ \begin{array} { l l } { 1 , } & { \mathrm { i f } t = T \mathrm { a n d } \left( s _ { 0 : T } , a _ { 0 : T } \right) \in \mathcal { D } } \\ { 0 , } & { \mathrm { o t h e r w i s e } } \end{array} \right.
84
+ $$
85
+
86
+ where a reward of one is received in the terminal state for any trajectory in the demonstrations.
87
+
88
+ Estimated $p _ { \mathbf { h u m a n } }$ . In text generation tasks, an input often has many correct outputs and the reference may be an uncommon output that contains rare words or has complex syntax. To account for different likelihood of the references, we estimate the probability of each reference by minimizing ${ \mathrm { K L } } \left( p _ { \mathrm { h u m a n } } \| q \right)$ , where $q ( a \mid s )$ approximates $p _ { \mathrm { h u m a n } } ( a \mid s )$ . This is equivalent to finding the MLE solution (denoted by $p _ { \mathrm { M L E } }$ ).1 Importantly, $p _ { \mathrm { M L E } }$ is a reasonable approximation to $p _ { \mathrm { h u m a n } }$ when restricted to the demonstrations. It is not a good reward function in general, however; it can assign large probability mass to low-quality outputs. Given the estimated perceptual quality $p _ { \mathrm { M L E } } ( a \mid s )$ , we define two reward functions. Our first reward function corresponds to a product of probabilities when summed over the trajectory:
89
+
90
+ $$
91
+ R _ { p } ( s , a ) \ { \stackrel { \mathrm { d e f } } { = } } \ \log p _ { \mathrm { M L E } } ( a \mid s ) .
92
+ $$
93
+
94
+ Assuming $\gamma = 1$ , the return at time step $t$ is $\begin{array} { r } { \hat { Q } _ { t } ( s _ { t } , a _ { t } ) = \sum _ { t ^ { \prime } = t } ^ { T } \log p _ { \mathrm { M L E } } ( a _ { t } \mid s _ { t } ) } \end{array}$ . Thus a sequence has high reward only if every word has high likelihood under $p _ { \mathrm { M L E } }$ . To allow for partial credits even if bad actions are taken at certain steps, we define another reward function corresponding to the sum of probabilities:
95
+
96
+ $$
97
+ R _ { s } ( s , a ) \stackrel { \mathrm { d e f } } { = } p _ { \mathrm { M L E } } ( a \mid s ) .
98
+ $$
99
+
100
+ The return subsequent $\begin{array} { r } { \hat { Q } ( s _ { t } , a _ { t } ) = \sum _ { t ^ { \prime } = t } ^ { T } p _ { \mathrm { M L E } } ( a _ { t } \mid s _ { t } ) } \end{array}$ , thus the policy can recover from bad decisions if the
101
+
102
+ # 3.3 THE GOLD ALGORITHM
103
+
104
+ Our full algorithm based on off-policy PG is shown in Algorithm 1. For importance weights $\pi _ { \theta } ( a \mid s )$ 1 , to avoid drastic changes, we initialize $\pi _ { \theta }$ 2 with the MLE solution. In addition, we 3 compute the importance weights by a weighting policy $\tilde { \pi } _ { \boldsymbol { \theta } }$ that synchronizes with $\pi _ { \theta }$ 4 periodically 5 so that the weights do not change frequently between updates. We also lower-bound the importance weight by a small number $u$ .
105
+
106
+ # Algorithm 1: GOLD
107
+
108
+ $\pi _ { \theta } p _ { \mathrm { M L E } }$ , $\tilde { \pi } _ { \boldsymbol { \theta } } \gets p _ { \mathrm { M L E } }$
109
+ for $s t e p = 1 , 2 , \ldots , M \mathbf { d }$ o Sample a minibatch $B = \{ ( \pmb { x } ^ { i } , \pmb { y } ^ { i } ) \} _ { i = 1 } ^ { | B | }$ foreach $( s _ { t } ^ { i } , a _ { t } ^ { i } )$ do Compute importance weights $\operatorname* { m a x } ( u , \tilde { \pi } _ { \theta } )$ , and compute returns $\hat { Q } ( s _ { t } ^ { i } , a _ { t } ^ { i } ) - b$ Update $\theta$ by (4) using gradient descent if step $\% k = 0$ then $\tilde { \pi } _ { \boldsymbol { \theta } } \gets \pi _ { \boldsymbol { \theta } }$
110
+
111
+ 6 Another source of variance comes from policy 7 gradients. Since our return is computed from a 8 sum or product of probabilities ((6) and (7)), we truncate the future trajectory after five steps. We
112
+
113
+ Return: $\pi _ { \theta }$
114
+
115
+ follow the common practice to subtract a baseline $b$ from the return to reduce variance; moreover, to avoid negative reward on the demonstrations (after subtracting baseline), we lower-bound $p _ { \mathrm { M L E } }$ in (6) and (7) by a small number $c$ . In practice, GOLD is easy to implement; further, given an existing $p _ { \mathrm { M L E } }$ , the GOLD-training stage usually takes less time than MLE. The code is available.2.
116
+
117
+ # 4 EXPERIMENTS
118
+
119
+ # 4.1 SETUP
120
+
121
+ We chose four text generation tasks: (1) question generation (NQG; Zhou et al., 2017): given a passage and a short span of the passage, the goal is to generate a question that can be answered by the span; (2) summarization (CNN/DM; Hermann et al., 2015); (3) extreme summarization (XSum; Narayan et al., 2018): the references are more abstractive than CNN/DM summaries; (4) machine translation (IWSLT14 De-En; Cettolo et al., 2014). See Appendix A.1 for the size and the source of the datasets. We evaluate NQG and summarization by both automatic metrics, i.e., corpus-level BLEU-4 (Papineni et al., 2002) and ROUGE-1/2/L (Lin, 2004) respectively, as well as human ratings.
122
+
123
+ We experiment with three variants of GOLD: GOLD- $\delta$ , GOLD- $p _ { \cdot }$ , GOLD- $s$ , which uses the $\delta$ -reward and the two estimated rewards $R _ { p }$ and $R _ { s }$ ), respectively. Our baseline learning algorithm is standard MLE, and we compare with on-policy RL training using policy gradient in Section 4.3. We describe models for each task at the beginning of Section 4.2.
124
+
125
+ For GOLD training, we use the baseline $b = - 6 0$ for GOLD- $p$ and $b = 0$ for GOLD- $s$ . To lower bound the return such that it is non-negative on demonstrated trajectories, we tune the lower bound $c$ of $p _ { \mathrm { M L E } }$ in $\{ 0 , 0 . 0 1 , 0 . 0 5 , 0 . 1 \}$ in (6) and (7). Furthermore, to reduce variance for importance weights, we lower bound them by $u \in \{ 0 , 0 . 1 , 0 . 1 5 , 0 . 2 \}$ . All hyperparameters are tuned on the dev set. See Appendix A.3 for more reproduciblility details.
126
+
127
+ # 4.2 RESULTS AND ANALYSIS
128
+
129
+ Table 1: BLEU/ROUGE $( \uparrow )$ and perplexity (↓) using standard models on test sets. GOLD achieves better metric scores despite high heldout perplexity. Experiments are run using a fixed random seed (12); attempted three random seeds (1, 12, 123) and all BLEU/R-2 scores are within 0.1 points of the reported. Refer to Table 3 for transformer results.
130
+
131
+ <table><tr><td rowspan="3">MLE</td><td>NQG (NQG++ net)</td><td></td><td>CNN/DM (pointer generator network)</td></tr><tr><td>BLEU↑</td><td>ppl↓</td><td>R-1↑R-2↑R-L↑ ppl↓</td></tr><tr><td>14.23 14.96</td><td>29.25</td><td>39.00 17.10 36.07 20.11</td></tr><tr><td>GOLD-δ GOLD-p</td><td>15.93</td><td>110.58 148.84</td><td>39.02 217.16 35.98 133.10</td></tr><tr><td>GOLD-s</td><td>16.10</td><td>158.45</td><td>39.20 17.31 36.23 143.58 39.95 17.81 36.81 29.80</td></tr></table>
132
+
133
+ Table 2: Dev set results of standard models using different decoding algorithms. $b$ : beam size. We report the average of 3 runs for top- $k$ sampling. Models trained by GOLD are less sensitive to decoding algorithms.
134
+
135
+ <table><tr><td>MLE</td><td>NQG (BLEU)</td><td>CNN/DM (ROUGE-2)</td></tr><tr><td></td><td>GOLD-s MLE</td><td>GOLD-s</td></tr><tr><td>greedy</td><td>14.13 16.06</td><td>17.40 18.51</td></tr><tr><td>beam search (b = 3) beam search (b = 5)</td><td>14.19 15.84</td><td>17.65 18.44</td></tr><tr><td>top-k samp. (k = 5) 11.27</td><td>14.07 15.74 15.41</td><td>17.63 18.25</td></tr><tr><td>top-k samp.(k = 20) 10.08</td><td>15.38</td><td>13.06 17.02</td></tr><tr><td></td><td></td><td>11.23 16.57</td></tr></table>
136
+
137
+ GOLD improves both standard and transformer models. Recall that one of our main motivations is that MLE tends to over-generalize under model misspecification, i.e., high recall but low precision. One may wonder whether this problem can be fixed by better modeling. Therefore, we evaluated GOLD with both standard high-performing models and state-of-the-art pretrained model. For standard models, we chose two representative seq2seq-based models, $\mathrm { N Q G + + }$ (Zhou et al., 2017) and the pointer-generator model (See et al., 2017) for NQG and CNN/DM respectively.3 Table 1 shows that GOLD is better than MLE in terms of BLEU and ROUGE. In particular, we find that using estimated rewards is superior to the $\delta$ -reward, showing the benefits of accounting for varying quality of the references. We thus consider only GOLD- $p$ and GOLD- $s$ in the rest of the experiments. For transformer models (Vaswani et al., 2017), we used the pretrained BART (Lewis et al., 2020) for NQG, CNN/DM, and XSum; we used standard transformer for IWSLT14 De-En. Table 3 shows that GOLD achieves better scores than MLE across all tasks, including near-SOTA on CNN/DM (R-2 $9 5 \%$ confidence interval: 21.84-22.33) and good performance on XSum (R-2 $9 5 \%$ CI: 22.25-22.92).
138
+
139
+ We further crowdsourced human evaluation by pairwise comparison4 between MLE-trained and GOLD- $s$ -trained model outputs. Each pair of comparison is repeated three times (by three different workers) and we take the majority answer. For each dataset, the evaluations are done by at least 15 different workers. For NQG, we showed workers the entire input and the questions generated by two models, and we ask workers to select the better one (with a third “tie” option). For summarization, we ask workers to select the generation closer in meaning to the reference without showing the article. More details are in Appendix C. Table 5 shows that workers prefer outputs from models trained by GOLD more often than those trained by MLE.
140
+
141
+ ![](images/e92e11fdb06818d7b7a8bb4e55fd3db1d239a8f9767b57e5302be8f9723cfdd6.jpg)
142
+ Figure 1: Histograms of token-level NLL loss using standard models on NQG and CNN/DM dev sets. MLE learns high-recall models whose loss distribution is spread out; GOLD learns high-precision models whose loss distribution is concentrated on near-zero losses.
143
+
144
+ Table 3: Results using transformer models on test sets. The advantage of GOLD is maintained on advanced models based on transformers and pretraining.
145
+ Table 4: BLEU/ROUGE $( \uparrow )$ on test sets, using standard models finetuned with on-policy objectives. On-policy objectives marginally improve upon both MLE and GOLD baselines. Starred (\*) models have MLE baselines ${ > } 0 . 1$ difference to our MLE R-2. δR-2: R-2 for the model minus R-2 for the corresponding MLE. PG: standard policy gradient; PPO: proximal policy optimization.
146
+
147
+ <table><tr><td rowspan="2">reward</td><td rowspan="2"></td><td>NQG</td><td colspan="2">CNN/DM</td></tr><tr><td>BLEU</td><td>R-2</td><td>8R-2</td></tr><tr><td colspan="2">Off-policy (this paper)</td><td></td><td></td><td></td></tr><tr><td>MLE</td><td></td><td>14.23</td><td>17.10</td><td></td></tr><tr><td>GOLD-s</td><td>Rs (Section 3.2); the only task-independent reward in this table</td><td>16.10</td><td>17.81</td><td>0.71</td></tr><tr><td>On-policy</td><td></td><td></td><td></td><td></td></tr><tr><td>MLE+PG</td><td>BLEU or R-2</td><td>14.55</td><td>17.35</td><td>0.25</td></tr><tr><td>MLE+PPO</td><td>human preferences (Ziegler et al., 2019)</td><td>1</td><td>17.61</td><td>0.62</td></tr><tr><td>MLE+PG(*)</td><td>R-L + saliency + summary-entailment (Pasunuru &amp; Bansal, 2018)</td><td></td><td>18.00</td><td>0.67</td></tr><tr><td>MLE+PG(*)</td><td>question-answering score (Scialom et al., 2019)</td><td></td><td></td><td>17.66 -0.12</td></tr><tr><td>GOLD+PG</td><td>BLEU or R-2</td><td>16.38</td><td>18.14</td><td>1.04</td></tr></table>
148
+
149
+ GOLD encourages high-precision models. One interesting observation from Table 1 and Table 3 is that compared to MLE, GOLD leads to much higher held-out perplexities, while achieving better metric scores. Since both are evaluated against the reference, one would expect high perplexity to correlate with low metric scores. To better understand the behavior of GOLD, we examine the distributions of token-level negative log-likelihood (NLL) loss (a monotonic transformation of perplexity) in Figure 1. We see that the loss distribution of GOLD (compared to MLE) concentrates on near-zero losses (Figures 1a and 1c) with a long tail of large losses (Figures 1b and 1d), hence high perplexity. In contrast, MLE has much fewer near-zero losses and fewer large losses, suggesting it tries to generate all tokens; i.e., MLE encourages recall, as discussed in Section 2. We conclude that GOLD achieves better metric scores by focusing on easy-to-learn tokens at the expense of lower recall with respect to the reference.
150
+
151
+ Table 5: Human comparisons on 200 randomly selected test examples for each task. Win: $\%$ generations from GOLD-trained BART that are better than from MLE-trained BART, given the same source.
152
+
153
+ <table><tr><td>NQG (BART)</td><td>CNN/DM (BART)</td><td>XSum (BART)</td></tr><tr><td>win lose tied</td><td>win lose tied</td><td>win lose tied</td></tr><tr><td>38.0 28.5 33.5</td><td>37.5 24.5 38.0</td><td>35.0 21.5 43.5</td></tr></table>
154
+
155
+ ![](images/8c897f2c9f9a62b12a2b640eb8eb3419a26a0c6a584dec60d0e98b58a6c60e2d.jpg)
156
+ Figure 2: Left: Avg human ratings vs. generation length, on $7 3 6 ~ \mathrm { N Q G }$ samples. (Colored regions: $9 5 \%$ confidence interval.) Each data point has $\geq 3 0$ annotations. The quality of long generations from MLE-trained model drops heavily, but stays stable across lengths for GOLD- $s$ generations. Right: Avg NLL loss of tth token given the gold prefix tokens vs. time-step $t$ , on NQG dev set. Without exposure bias, NLL loss stays stable across lengths.
157
+
158
+ Another advantage of high-precision models is that they do not rely much on decoding algorithms to sample high-quality outputs from the learned distribution. From a RL perspective, the policy already considers future rewards when making local decisions, thus beam search is not necessary. As a result, we see in Table 2 that GOLD achieves similar performance with both argmax decoding and top- $k$ sampling. In contrast, MLE suffers significantly from sampling, which suggests that it learns a high-recall but low-precision model.
159
+
160
+ GOLD alleviates exposure bias. GOLD suffers less from exposure bias because it trains on the state/history distribution induced by the model instead of the reference data. Here, we empirically quantify the exposure bias problem in learned models. If there is exposure bias, then the output quality is expected to degrade as output length increases, as the history is more likely to deviate from the reference distribution with accumulated generation steps. To evaluate quality, we sampled 736 generations of different lengths from standard models trained by both MLE and GOLD on NQG. Given the paragraph, words to query on, and the generated questions, we then asked workers to rate the generations from 1 (worst) to 4 (best). Figure 2 (left) shows that the output quality of the MLE-trained model degrades when the sequence length is over 14 words, whereas the quality of the GOLD-s-trained model stays relatively stable across all lengths.5 Qualitatively, we observe frequent degenerations (Holtzman et al., 2020; Welleck et al., 2020a) including repetitions and hallucinations within a sentence generated by MLE-trained model, as shown in Table 6. In contrast, Figure 2 (right) shows the NLL loss conditioned on gold histories on NQG dev set.6 We can see that without exposure bias, NLL loss does not vary much as the length increases. Therefore, we conclude that the big performance drop for long generations using MLE is mainly due to exposure bias and GOLD does not suffer from the problem.
161
+
162
+ Table 6: NQG generations using standard models. Words to query on are bolded. Long generations from MLE-trained model often result in repetition or hallucination. More examples in appendix.
163
+
164
+ <table><tr><td>Input MLE</td><td>that projectwasentitledthefactoryprojecttoreferenceandywarholandtocreateafactorytocompletelydigitiethecolection. what was the name of the project that was not digitize to digitize ?</td></tr><tr><td>Input</td><td>GOLD what was the name of the project that was to reference andy warhol ? braddock(withgeorge washingtonasoneof hisaides)ledabout1,50amytroopsand provincial militiaonanexpeditioninjune</td></tr><tr><td>MLE</td><td>1755 to take fort duquesne . what was the name of the aid of george washington university ?</td></tr><tr><td></td><td>GOLD who led about 1,5oO army troops and provincial militia on an expedition ?</td></tr></table>
165
+
166
+ # 4.3 COMPARISON WITH ON-POLICY TRAINING
167
+
168
+ While offline RL is generally more challenging due to lack of interaction with the environment, we argue that the benefit from interaction is limited in text generation (Section 3.1) and overweighed by the optimization challenges. In this section, we investigate the effect of on-policy training using task metrics as rewards. Specifically, we pre-train the model using MLE and then fine-tune it using PG. To avoid degenerate solutions, we interleave MLE and PG updates evenly during fine-tuning. Similarly, we fine-tune GOLD-initialized models using PG. For on-policy fine-tuning, we use BLEU and ROUGE-2 as rewards for NQG and CNN/DM respectively.7 Table 4 shows that additional on-policy training improves both MLE and GOLD marginally. However, MLE with PG is still worse than GOLD. Further, one of the best-performing on-policy methods using a similarly competitive pretrained transformer model (Ziegler et al., 2019) also shows limited improvements over supervised baseline on CNN/DM, despite having better reward functions (domain-specific human preference annotations). Overall, the benefit from on-policy training is unclear in our experiments.8 Please refer to the appendix for more details.
169
+
170
+ # 4.4 DISCUSSION ON GENERATION DIVERSITY
171
+
172
+ The objective of GOLD is to produce high-precision text at the cost of recall: There are references that the model cannot generate with high probability, which is reflected by the high held-out perplexity in Table 1 and Table 3. One may wonder what the impact of GOLD on text “diversity” is. This issue warrants more discussion, but for text generation, “diversity” may stand for the following.
173
+
174
+ (1) Diversity as in the ability to generate a number of different correct generations given one context. This is often discussed in the context of mode collapse, which is an important problem for image generation and unconditional text generation (e.g., continuation from a prompt). However, for many conditional NLG tasks, while there are multiple correct outputs, producing one good generation is often sufficient in practice, e.g., question generation, summarization, machine translation, image captioning, text style transfer, and even chit-chat dialogues (unless users expect the bots to say different things in the same context every time). One exception is creative writing tasks where we would like to have multiple novel generations given the same context, e.g., generating from a language model (Caccia et al., 2020). In these cases, GOLD may not be able to provide a variety of high-quality generations given one context, although it would still produce different outputs given different contexts. Another potential failure mode is that in open-ended dialogues, if one common response has large probability under true data distribution, then GOLD may lead to a distribution concentrated on this mode. In this case, additional inductive bias is needed to separate good modes from bad ones, e.g., additional reward on specificity of the response. On the other hand, while MLE-trained models have good recall and we can potentially sample many different outputs with a high temperature, or large $k$ in top- $k$ sampling, or large $p$ in top- $p$ sampling,9 there are only a few high-quality ones. Our conjecture is that there may not be enough data to cover all modes, and in fact high-likelihood outputs from MLE-trained models are often degenerate (Stahlberg & Byrne, 2019; Cohen & Beck, 2019; Holtzman et al., 2020).
175
+
176
+ In sum, given the trade-off between diversity and quality, we argue that generating a single highquality output is a reasonable goal for most conditional text generation tasks, and we leave the question of generating both diverse and high-quality outputs to future work.
177
+
178
+ (2) Diversity as in the linguistic complexity of the output, given the input. First, we compare GOLD and MLE by measuring the complexity of the output using the number of unique n-grams and did not find significant difference. For example, GOLD’s number of unique 1/2/3/4/5-grams for XSum (using BART) is 18846/18835/18103/17639/17258, MLE’s is 19071/19053/18349/17875/17531, and gold-standard target numbers are 23674/23661/22869/22280/21822. In addition, for question generation and summarization, we measure the complexity of the output by abstractivness, i.e., the proportion of n-gram overlaps between the input and the generation. For XSum (using BART), the proportion of 1/2/3/4/5-gram overlap for MLE is $0 . 7 5 / 0 . 2 7 / 0 . 1 0 / 0 . 0 5 3 / 0 . 0 3 1$ and for GOLD: 0.73/0.24/0.087/0.039/0.021; the trend mostly holds for NQG and CNN/DM as well. In sum, we conclude that GOLD and MLE are comparable in producing complex or novel outputs.
179
+
180
+ (3) Diversity as in the coverage of the true data distribution. This definition is related to (1). This diversity is the “recall” intuitively, and can be measured by NLL loss or perplexity, which will be sacrificed. In our case, the consequence is that the model tends to ignore difficult gold examples (Figure 1), which in text generation, may sometimes be noise or outliers. Empirically for a large number of text generation tasks, paying less attention to such examples did not cause mode collapse in our case.
181
+
182
+ # 5 RELATED WORK
183
+
184
+ Exposure bias. In structured prediction, there is a flurry of works addressing exposure bias since Bengio et al. (2015). Most works focus on learning global sequence scores instead of locally normalized scores using either variants of beam search (Wiseman & Rush, 2016; Andor et al., 2016; Goyal et al., 2018) or energy networks (Belanger & McCallum, 2016; Tu et al., 2020). These training algorithms are often complex and costly. Exposure bias is well studied in imitation learning (Daume´ et al., 2009; Ross et al., 2011) and learning-to-search has been applied to RNNs to incorporate losses of sequences deviating from references (Leblond et al., 2018), but they require annotations or cost functions on non-reference sequences which may not be available for text generation.
185
+
186
+ Objectives beyond MLE. Policy gradient-based algorithms and their variants have been used extensively in text generation to optimize sequence-level metrics (Ranzato et al., 2016; Shen et al., 2016; Norouzi et al., 2016; Pasunuru & Bansal, 2018). In addition, off-policy RL is commonly used in dialogue where online interaction with users is expensive (Serban et al., 2017; Jaques et al., 2019). The main difference is that we take advantage of the demonstrations and design generic reward functions for generation tasks. There is another line of work using policy gradient to optimize reward from a discriminator that differentiates good vs. bad generations (Yu et al., 2017; Li et al., 2017; Lu et al., 2019). However, these approaches often underperform MLE in practice (Tevet et al., 2019) due to optimization challenges. Recently, a concurrent work, Kang & Hashimoto (2020), proposed truncated log-loss which both optimizes distinguishability and enjoys efficient optimization.
187
+
188
+ High-precision text generation. It is noticed early in neural text generation that MLE tends to produce high-recall models that over-generalize. Previously, high-quality outputs are selected mainly through decoding (e.g., beam search, low-temperature sampling, truncated sampling). Recently, there is an increasing amount of work on discouraging implausible samples during training, e.g., using negative sampling (Welleck et al., 2020b), self-training on high-quality samples (Kedzie & McKeown, 2019), and confidence-oriented decoding with calibration (Tian et al., 2020). In contrast, we tackle the fundamental problem of mismatched objectives and propose a general learning framework.
189
+
190
+ # 6 CONCLUSION
191
+
192
+ We provide an efficient algorithm that addresses the two train/test discrepancies in MLE training for text generation: likelihood as learning objective vs. quality as evaluation metric; gold history in training vs. model-generated history in inference. We have demonstrated that off-policy RL is a promising framework for text generation, with matched train/test objectives and optimization advantages like MLE. We believe more advanced off-policy learning techniques (e.g., proximity constraints) can be easily integrated into text generation and further improve performance.
193
+
194
+ # ACKNOWLEDGEMENTS
195
+
196
+ The authors thank Kyunghyun Cho, Tatsunori Hashimoto, Graham Neubig, Ethan Perez, Karl Stratos, Clara Vania, and Alex Warstadt (alphabetical order) for helpful discussions, and the anonymous reviewers for helpful feedback. This work was supported by Samsung Advanced Institute of Technology (Next Generation Deep Learning: From Pattern Recognition to AI) and Samsung Research (Improving Deep Learning Using Latent Structure).
197
+
198
+ # REFERENCES
199
+
200
+ Roee Aharoni and Yoav Goldberg. Split and rephrase: Better evaluation and stronger baselines. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pp. 719–724, Melbourne, Australia, July 2018. Association for Computational Linguistics. doi: 10.18653/v1/P18-2114. URL https://www.aclweb.org/anthology/ P18-2114.
201
+
202
+ Daniel Andor, Chris Alberti, David Weiss, Aliaksei Severyn, Alessandro Presta, Kuzman Ganchev, Slav Petrov, and Michael Collins. Globally normalized transition-based neural networks. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 2442–2452, Berlin, Germany, August 2016. Association for Computational Linguistics. doi: 10.18653/v1/P16-1231. URL https://www.aclweb.org/anthology/ P16-1231.
203
+
204
+ David Belanger and Andrew McCallum. Structured prediction energy networks. 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. 983–992, New York, New York, USA, 20–22 Jun 2016. PMLR. URL http://proceedings.mlr.press/ v48/belanger16.html.
205
+
206
+ Samy Bengio, Oriol Vinyals, Navdeep Jaitly, and Noam Shazeer. Scheduled sampling for sequence prediction with recurrent neural networks. In Advances in Neural Information Processing Systems, pp. 1171–1179, 2015.
207
+
208
+ Massimo Caccia, Lucas Caccia, William Fedus, Hugo Larochelle, Joelle Pineau, and Laurent Charlin. Language gans falling short. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ BJgza6VtPB.
209
+
210
+ Mauro Cettolo, Jan Niehues, Sebastian Stuker, Luisa Bentivogli, and Marcello Federico. Report on ¨ the 11th IWSLT evaluation campaign. In Proceedings of the International Workshop on Spoken Language Translation, volume 57, Hanoi, Vietnam, 2014.
211
+
212
+ Jaemin Cho, Minjoon Seo, and Hannaneh Hajishirzi. Mixture content selection for diverse sequence generation. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLPIJCNLP), pp. 3121–3131, Hong Kong, China, November 2019. Association for Computational Linguistics. doi: 10.18653/v1/D19-1308. URL https://www.aclweb.org/anthology/ D19-1308.
213
+
214
+ 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. doi: 10.3115/v1/D14-1179. URL https://www.aclweb. org/anthology/D14-1179.
215
+
216
+ Leshem Choshen, Lior Fox, Zohar Aizenbud, and Omri Abend. On the weaknesses of reinforcement learning for neural machine translation. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id ${ . } = { }$ H1eCw3EKvH.
217
+
218
+ Elizabeth Clark, Asli Celikyilmaz, and Noah A. Smith. Sentence mover’s similarity: Automatic evaluation for multi-sentence texts. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 2748–2760, Florence, Italy, July 2019. Association for Computational Linguistics. doi: 10.18653/v1/P19-1264. URL https://www.aclweb.org/ anthology/P19-1264.
219
+
220
+ Eldan Cohen and Christopher Beck. Empirical analysis of beam search performance degradation in neural sequence models. volume 97 of Proceedings of Machine Learning Research, pp. 1290–1299, Long Beach, California, USA, 09–15 Jun 2019. PMLR. URL http://proceedings.mlr. press/v97/cohen19a.html.
221
+
222
+ Hal Daume, John Langford, and Daniel Marcu. Search-based structured prediction. ´ Machine learning, 75(3):297–325, 2009.
223
+
224
+ Kartik Goyal, Graham Neubig, Chris Dyer, and Taylor Berg-Kirkpatrick. A continuous relaxation of beam search for end-to-end training of neural sequence models. In Thirty-Second AAAI Conference on Artificial Intelligence, 2018.
225
+
226
+ Hirotaka Hachiya, Takayuki Akiyama, Masashi Sugiayma, and Jan Peters. Adaptive importance sampling for value function approximation in off-policy reinforcement learning. Neural Networks, 22(10):1399–1410, 2009.
227
+
228
+ Tatsunori Hashimoto, Hugh Zhang, and Percy Liang. Unifying human and statistical evaluation for natural language generation. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pp. 1689–1701, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics. doi: 10.18653/v1/N19-1169. URL https://www.aclweb.org/ anthology/N19-1169.
229
+
230
+ W. K. Hastings. Monte carlo sampling methods using markov chains and their applications. Biometrika, 57(1):97–109, 1970. ISSN 00063444. URL http://www.jstor.org/stable/ 2334940.
231
+
232
+ Karl Moritz Hermann, Tomas Kocisky, Edward Grefenstette, Lasse Espeholt, Will Kay, Mustafa Suleyman, and Phil Blunsom. Teaching machines to read and comprehend. In Advances in Neural Information Processing Systems, pp. 1693–1701, 2015.
233
+
234
+ 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 https://doi.org/10.1162/neco.1997.9.8.1735.
235
+
236
+ Ari Holtzman, Jan Buys, Li Du, Maxwell Forbes, and Yejin Choi. The curious case of neural text degeneration. In International Conference on Learning Representations, 2020.
237
+
238
+ Ferenc Huszar. How (not) to train your generative model: Scheduled sampling, likelihood, adversary? ´ arXiv preprint arXiv:1511.05101, 2015.
239
+
240
+ Natasha Jaques, Asma Ghandeharioun, Judy Hanwen Shen, Craig Ferguson, Agata Lapedriza, Noah Jones, Shixiang Gu, and Rosalind Picard. Way off-policy batch deep reinforcement learning of implicit human preferences in dialog. arXiv preprint arXiv:1907.00456, 2019.
241
+
242
+ Daniel Kang and Tatsunori Hashimoto. Improved natural language generation via loss truncation. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 718–731, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020. acl-main.66. URL https://www.aclweb.org/anthology/2020.acl-main.66.
243
+
244
+ Chris Kedzie and Kathleen McKeown. A good sample is hard to find: Noise injection sampling and self-training for neural language generation models. In Proceedings of the 12th International Conference on Natural Language Generation, pp. 584–593, 2019.
245
+
246
+ Yaser Keneshloo, Tian Shi, Naren Ramakrishnan, and Chandan K Reddy. Deep reinforcement learning for sequence-to-sequence models. IEEE Transactions on Neural Networks and Learning Systems, 2019.
247
+
248
+ Remi Leblond, Jean-Baptiste Alayrac, Anton Osokin, and Simon Lacoste-Julien. SEARNN: Training ´ RNNs with global-local losses. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id $=$ HkUR_y-RZ.
249
+
250
+ Sergey Levine, Aviral Kumar, George Tucker, and Justin Fu. Offline reinforcement learning: Tutorial, review, and perspectives on open problems. arXiv preprint arXiv:2005.01643, 2020.
251
+
252
+ Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Veselin Stoyanov, and Luke Zettlemoyer. BART: Denoising sequence-to-sequence pre-training for natural language generation, translation, and comprehension. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, Seattle, USA, July 2020. Association for Computational Linguistics.
253
+
254
+ Jiwei Li, Will Monroe, Tianlin Shi, Sebastien Jean, Alan Ritter, and Dan Jurafsky. Adversarial ´ learning for neural dialogue generation. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pp. 2157–2169, Copenhagen, Denmark, September 2017. Association for Computational Linguistics. doi: 10.18653/v1/D17-1230. URL https: //www.aclweb.org/anthology/D17-1230.
255
+
256
+ Zichao Li, Xin Jiang, Lifeng Shang, and Hang Li. Paraphrase generation with deep reinforcement learning. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 3865–3878, Brussels, Belgium, October-November 2018. Association for Computational Linguistics. doi: 10.18653/v1/D18-1421. URL https://www.aclweb.org/ anthology/D18-1421.
257
+
258
+ Chin-Yew Lin. ROUGE: A package for automatic evaluation of summaries. In Text Summarization Branches Out, pp. 74–81, Barcelona, Spain, July 2004. Association for Computational Linguistics. URL https://www.aclweb.org/anthology/W04-1013.
259
+
260
+ Sidi Lu, Lantao Yu, Siyuan Feng, Yaoming Zhu, and Weinan Zhang. CoT: Cooperative training for generative modeling of discrete data. 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. 4164–4172, Long Beach, California, USA, 09–15 Jun 2019. PMLR. URL http://proceedings.mlr.press/v97/lu19d.html.
261
+
262
+ Kenton Murray and David Chiang. Correcting length bias in neural machine translation. In Proceedings of the Third Conference on Machine Translation: Research Papers, pp. 212–223, Belgium, Brussels, October 2018. Association for Computational Linguistics. doi: 10.18653/v1/W18-6322. URL https://www.aclweb.org/anthology/W18-6322.
263
+
264
+ Shashi Narayan, Shay B. Cohen, and Mirella Lapata. Don’t give me the details, just the summary! topic-aware convolutional neural networks for extreme summarization. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 1797–1807, Brussels, Belgium, October-November 2018. Association for Computational Linguistics. doi: 10.18653/v1/ D18-1206. URL https://www.aclweb.org/anthology/D18-1206.
265
+
266
+ Mohammad Norouzi, Samy Bengio, zhifeng Chen, Navdeep Jaitly, Mike Schuster, Yonghui Wu, and Dale Schuurmans. Reward augmented maximum likelihood for neural structured prediction. In D. Lee, M. Sugiyama, U. Luxburg, I. Guyon, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 29, pp. 1723–1731. Curran Associates, Inc., 2016. URL https://proceedings.neurips.cc/paper/2016/file/ 2f885d0fbe2e131bfc9d98363e55d1d4-Paper.pdf.
267
+
268
+ Jekaterina Novikova, Ondˇrej Dusek, Amanda Cercas Curry, and Verena Rieser. Why we need ˇ new evaluation metrics for NLG. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pp. 2241–2252, Copenhagen, Denmark, September 2017. Association for Computational Linguistics. doi: 10.18653/v1/D17-1238. URL https://www.aclweb.org/anthology/D17-1238.
269
+
270
+ Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. Bleu: a method for automatic evaluation of machine translation. In Proceedings of the 40th Annual Meeting of the Association for Computational Linguistics, pp. 311–318, Philadelphia, Pennsylvania, USA, July 2002. Association for Computational Linguistics. doi: 10.3115/1073083.1073135. URL https://www.aclweb. org/anthology/P02-1040.
271
+
272
+ Tetiana Parshakova, Jean-Marc Andreoli, and Marc Dymetman. Distributional reinforcement learning for energy-based sequential models. arXiv preprint arXiv:1912.08517, 2019.
273
+
274
+ Ramakanth Pasunuru and Mohit Bansal. Multi-reward reinforced summarization with saliency and entailment. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 2 (Short Papers), pp. 646–653, New Orleans, Louisiana, June 2018. Association for Computational Linguistics. doi: 10.18653/v1/N18-2102. URL https://www.aclweb.org/anthology/N18-2102.
275
+
276
+ Doina Precup, Richard S. Sutton, and Satinder Singh. Eligibility traces for off-policy policy evaluation. Computer Science Department Faculty Publication Series, UMass Amherst, 2000.
277
+
278
+ Weizhen Qi, Yu Yan, Yeyun Gong, Dayiheng Liu, Nan Duan, Jiusheng Chen, Ruofei Zhang, and Ming Zhou. ProphetNet: Predicting future n-gram for sequence-to-SequencePre-training. In Findings of the Association for Computational Linguistics: EMNLP 2020, pp. 2401–2410, Online, November 2020. Association for Computational Linguistics. URL https://www.aclweb. org/anthology/2020.findings-emnlp.217.
279
+
280
+ Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. Journal of Machine Learning Research, 21(140):1–67, 2020.
281
+
282
+ Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. SQuAD: $^ { 1 0 0 , 0 0 0 + }$ questions for machine comprehension of text. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pp. 2383–2392, Austin, Texas, November 2016. Association for Computational Linguistics. doi: 10.18653/v1/D16-1264. URL https://www.aclweb.org/ anthology/D16-1264.
283
+
284
+ Marc’Aurelio Ranzato, Sumit Chopra, Michael Auli, and Wojciech Zaremba. Sequence level training with recurrent neural networks. In International Conference on Learning Representations, San Juan, Puerto Rico, May 2-4, 2016, Conference Track Proceedings, 2016.
285
+
286
+ Stephane 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.
287
+
288
+ Thomas Scialom, Sylvain Lamprier, Benjamin Piwowarski, and Jacopo Staiano. Answers unite! unsupervised metrics for reinforced summarization models. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pp. 3246–3256, Hong Kong, China, November 2019. Association for Computational Linguistics. doi: 10.18653/v1/D19-1320. URL https://www.aclweb.org/anthology/D19-1320.
289
+
290
+ Abigail See, Peter J. Liu, and Christopher D. Manning. Get to the point: Summarization with pointer-generator networks. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1073–1083, Vancouver, Canada, July 2017. Association for Computational Linguistics. doi: 10.18653/v1/P17-1099. URL https: //www.aclweb.org/anthology/P17-1099.
291
+
292
+ Iulian V Serban, Chinnadhurai Sankar, Mathieu Germain, Saizheng Zhang, Zhouhan Lin, Sandeep Subramanian, Taesup Kim, Michael Pieper, Sarath Chandar, Nan Rosemary Ke, et al. A deep reinforcement learning chatbot. arXiv preprint arXiv:1709.02349, 2017.
293
+
294
+ Shiqi Shen, Yong Cheng, Zhongjun He, Wei He, Hua Wu, Maosong Sun, and Yang Liu. Minimum risk training for neural machine translation. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1683–1692, Berlin, Germany, August 2016. Association for Computational Linguistics. doi: 10.18653/v1/P16-1159. URL https://www.aclweb.org/anthology/P16-1159.
295
+
296
+ Loic Simon, Ryan Webster, and Julien Rabin. Revisiting precision recall definition for generative modeling. 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. 5799–5808, Long Beach, California, USA, 09–15 Jun 2019. PMLR. URL http: //proceedings.mlr.press/v97/simon19a.html.
297
+
298
+ Felix Stahlberg and Bill Byrne. On NMT search errors and model errors: Cat got your tongue? In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pp. 3356–3362, Hong Kong, China, November 2019. Association for Computational Linguistics. doi: 10.18653/v1/D19-1331. URL https://www.aclweb.org/anthology/D19-1331.
299
+
300
+ Richard S Sutton, David A McAllester, Satinder P Singh, and Yishay Mansour. Policy gradient methods for reinforcement learning with function approximation. In Advances in neural information processing systems, pp. 1057–1063, 2000.
301
+
302
+ Guy Tevet, Gavriel Habib, Vered Shwartz, and Jonathan Berant. Evaluating text GANs as language models. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pp. 2241–2247, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics. doi: 10.18653/v1/N19-1233. URL https://www.aclweb.org/anthology/N19-1233.
303
+
304
+ Ran Tian, Shashi Narayan, Thibault Sellam, and Ankur P. Parikh. Sticking to the facts: Confident decoding for faithful data-to-text generation, 2020. URL https://openreview.net/forum? id $=$ HkxU2pNYPH.
305
+
306
+ Lifu Tu, Richard Yuanzhe Pang, and Kevin Gimpel. Improving joint training of inference networks and structured prediction energy networks. In Proceedings of the Fourth Workshop on Structured Prediction for NLP, pp. 62–73, Online, November 2020. Association for Computational Linguistics. URL https://www.aclweb.org/anthology/2020.spnlp-1.8.
307
+
308
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in Neural Information Processing Systems, pp. 5998–6008, 2017.
309
+
310
+ Chaojun Wang and Rico Sennrich. On exposure bias, hallucination and domain shift in neural machine translation. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 3544–3552, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.326. URL https://www.aclweb.org/anthology/2020. acl-main.326.
311
+
312
+ Sean Welleck, Ilia Kulikov, Jaedeok Kim, Richard Yuanzhe Pang, and Kyunghyun Cho. Consistency of a recurrent language model with respect to incomplete decoding. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 5553–5568, Online, November 2020a. Association for Computational Linguistics. URL https://www. aclweb.org/anthology/2020.emnlp-main.448.
313
+
314
+ Sean Welleck, Ilia Kulikov, Stephen Roller, Emily Dinan, Kyunghyun Cho, and Jason Weston. Neural text generation with unlikelihood training. In International Conference on Learning Representations, 2020b. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ SJeYe0NtvH.
315
+
316
+ Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3-4):229–256, 1992.
317
+
318
+ Sam Wiseman and Alexander M. Rush. Sequence-to-sequence learning as beam-search optimization. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pp. 1296–1306, Austin, Texas, November 2016. Association for Computational Linguistics. doi: 10.18653/v1/D16-1137. URL https://www.aclweb.org/anthology/D16-1137.
319
+
320
+ Lijun Wu, Fei Tian, Tao Qin, Jianhuang Lai, and Tie-Yan Liu. A study of reinforcement learning for neural machine translation. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 3612–3621, Brussels, Belgium, October-November 2018. Association for Computational Linguistics. doi: 10.18653/v1/D18-1397. URL https://www. aclweb.org/anthology/D18-1397.
321
+
322
+ Lantao Yu, Weinan Zhang, Jun Wang, and Yong Yu. Seqgan: Sequence generative adversarial nets with policy gradient. In Thirty-First AAAI Conference on Artificial Intelligence, 2017.
323
+
324
+ Jingqing Zhang, Yao Zhao, Mohammad Saleh, and Peter J. Liu. Pegasus: Pre-training with extracted gap-sentences for abstractive summarization. In Proceedings of the 37th International Conference on Machine Learning, Proceedings of Machine Learning Research. PMLR, 2020.
325
+
326
+ Qingyu Zhou, Nan Yang, Furu Wei, Chuanqi Tan, Hangbo Bao, and Ming Zhou. Neural question generation from text: A preliminary study. In National CCF Conference on Natural Language Processing and Chinese Computing, pp. 662–671. Springer, 2017.
327
+
328
+ Daniel M Ziegler, Nisan Stiennon, Jeffrey Wu, Tom B Brown, Alec Radford, Dario Amodei, Paul Christiano, and Geoffrey Irving. Fine-tuning language models from human preferences. arXiv preprint arXiv:1909.08593, 2019.
329
+
330
+ # A PRACTICAL SETUP AND IMPLEMENTATION
331
+
332
+ # A.1 TASKS AND DATASETS
333
+
334
+ (1) Natural question generation (NQG; Zhou et al., 2017) based on the SQuAD QA dataset (Rajpurkar et al., 2016): Given a text passage and a short span of the passage, the goal is to generate a question that can be answered by the span. (2) CNN/DailyMail summarization (CNN/DM): Given a piece of news, generate a few sentences of summary. We use the entity-non-anonymized version of CNN/DM dataset, following See et al. (2017). The target summaries tend to be extractive, meaning there tends to be heavy text-span overlaps between the source article and the target summary. (3) Extreme summarization (XSum; Narayan et al., 2018) is based on BBC news. The target summaries are highly abstractive. Past extractive strategies that work well for CNN/DM may not work well for XSum. (4) IWSLT14 German to English machine translation (IWSLT14 De-En; Cettolo et al., 2014) is a popular machine translation benchmark. Machine translation is different from the above three tasks, given that intuitively, the space of high-quality generation is smaller.
335
+
336
+ More details on datasets. We first provide the number of examples in each dataset. The train/dev/test split for NQG is 86229/8913/8919; the split for CNN/DM is 287227/13368/11490; the split for XSum is 204045/11332/11334; the split for IWSLT14 De-En is 160239/7283/6750.
337
+
338
+ To download and preprocess the NQG data, we follow the following instructions: https:// github.com/clovaai/FocusSeq2Seq; to download and preprocess the summarization data, we follow the following instructions: https://github.com/pytorch/fairseq/blob/ master/examples/bart/README.summarization.md; to download and preprocess the IWSLT14 De-En data, we follow the following instructions: https://github.com/pytorch/ fairseq/tree/master/examples/translation. More information can be found in our codebase.
339
+
340
+ # A.2 MODEL ARCHITECTURES
341
+
342
+ We use two sets of architectures for our experiments.
343
+
344
+ Standard architectures. For NQG, we use the model $\mathrm { N Q G + + }$ (Zhou et al., 2017), a seq2seqwith-attention model based on GRU (Cho et al., 2014), and for summarization we use pointer generator network (See et al., 2017), a seq2seq-with-attention model based on LSTM (Hochreiter & Schmidhuber, 1997). Specifically, we use 2 layers for both the encoder and the decoder, for both tasks. Other hyperparameters are based on the following implementation: https://github. com/clovaai/FocusSeq2Seq.
345
+
346
+ Transformer architectures. For NQG, CNN/DM, and XSum, we also experiment with one of the top-performing models, BART (Lewis et al., 2020). Our experiments are based on the pretrained BART model provided by original authors10: it has 12 encoder layers and 12 decoder layers, and it is pretrained on around 3.3 billion words of Wikipedia articles and books. We use the model to investigate if our methods work with models with stronger capabilities. For IWSLT14 De-En, we use a moderate-size standard transformer architecture (encoder/decoder embedding dimension 512, 4 encoder attention heads, 6 encoder layers, 4 decoder attention heads, 6 decoder layers), a top-performing architecture in machine translation.
347
+
348
+ # A.3 MORE ON REPRODUCIBILITY
349
+
350
+ The codebase is released. The link to the code is posted on the following website: yzpang.me.
351
+
352
+ Hyperparameters and training details on standard architectures. This paragraph corresponds to results in Table 1. We use a learning rate of 5e-4. For NQG, we use a batch size of 32; for CNN/DM we use a batch size of 16. We train using a single Nvidia GTX 1080 Ti (memory: 12 GB) GPU.
353
+
354
+ As discussed in Section 3.3 and Section 4.1, we tune the lower bound of $p _ { \mathrm { M L E } }$ in $\{ 0 , 0 . 0 1 , 0 . 0 5 , 0 . 1 \}$ For NQG models, the lower bound of 0.1 produces best performance. For CNN/DM using GOLD- $p$ the lower bound is 0.01; for CNN/DM using GOLD- $s$ , the lower bound is 0.
355
+
356
+ Recall that as discussed in Section 3.3, the weighting policy $\tilde { \pi } _ { \boldsymbol { \theta } }$ synchronizes with actual policy $\pi _ { \theta }$ once every $k$ steps so as to stabilize training. We tune $k \in \{ 1 5 0 0 , 2 6 9 1 \}$ (where 2691 steps corresponds to 1 epoch) for NQG and found that $k = 1 5 0 0$ works better for all NQG models. We tune $\bar { k ^ { \prime } } \in \{ 1 5 0 0 , 3 \bar { 0 } 0 0 , 5 0 0 0 \}$ for CNN/DM; we found that $k = 1 5 0 0$ works best for GOLD- $\delta$ and GOLD- $p$ , and $k = 5 0 0 0$ works best for GOLD- $s$ . Note that in practice, we do not observe big gaps when using other $k$ ’s in the set. For standard models, implementation is based on Cho et al. (2019). In all experiments, we evaluate once every epoch, and we do validation on the entire dev set, using task-specific metrics (BLEU/ROUGE-2), following Cho et al. (2019) and standard practice in machine translation.
357
+
358
+ Hyperparameters and training details on transformer models. This paragraph corresponds to results in Table 3. For transformer models, we use Nvidia P40 GPUs (memory: 24 GB each). For NQG, CNN/DM, and XSum based on BART, we use 4 GPUs to train. For IWSLT14 De-En, we use 1 GPU. Note that fairseq defines batch size in terms of number of tokens instead of number of sequences. For NQG, we use 512 tokens as batch size (for each of the four GPUs); for CNN/DM and XSum, we use 1024 tokens as batch size (for each of the four GPUs); for IWSLT14 De-En, we use 4096 tokens as batch size.
359
+
360
+ We use a learning rate of 2e-5 for NQG, CNN/DM, and XSum; 3e-4 for IWSLT14 De-En.
361
+
362
+ Recall that as discussed in Section 3.3, the weighting policy $\tilde { \pi } _ { \boldsymbol { \theta } }$ synchronizes with actual policy $\pi _ { \theta }$ once every $k$ steps so as to stabilize training. Here, $k = 1 0 0 0$ for NQG; $k = 5 0 0 0$ for CNN/DM, XSum, IWSLT14 De-En. As discussed in Section 3.3 and Section 4.1, the lower bound of $p _ { \mathrm { M L E } }$ is set to be 0.01 for GOLD- $p$ and 0.1 for GOLD- $s$ . For all other parameters that are not specific to GOLD, we use the default fairseq summarization parameters (which can be found through footnote 10).
363
+
364
+ For hyperparameter $u$ as discussed in Section 4.1, for NQG and CNN/DM, $u = 0 . 1$ ; for XSum, $u = 0 . 1 5$ ; for IWSLT14 De-EN, $u = 0 . 2$ .
365
+
366
+ As indicated, the hyperparameters were only tuned in a small set of possible values. More careful tuning may result in slightly better performances.
367
+
368
+ Number of parameters in each model. For standard models, we use $\mathrm { N Q G + + }$ for NQG, and it has 10372565 parameters. We use pointer generator for CNN/DM, and it has 19965705 parameters. For transformer models, the BART model for NQG, CNN/DM, and XSum all have 406290432 parameters; the transformer model used for IWSLT14 De-En has 39469056 parameters.
369
+
370
+ Average runtime. For standard models, based on the above models and the computing infrastructures, each epoch of NQG takes around 10 minutes to train and achieves best performance within 20 epochs. Each epoch of CNN/DM takes about 2 hours to train and achieves best performance within 15 epochs. For transformer models, each epoch of NQG takes around 5 minutes to train and achieves best dev performance within 5 epochs; each epoch of CNN/DM takes around 11 hours to train and achieves best dev performances within 5 epochs; each epoch of XSum takes around 8 hours to train; each epoch of IWSLT14 De-En takes around 3 minutes to train and achieves best performances within 100 epochs (as expected, given the large batch size11). Note that our transformer models are trained on P40s given hardware constraints; if the transformer models are trained on V100 GPUs, for example, the training time per epoch will likely be much shorter.
371
+
372
+ # A.4 MORE DISCUSSION ON APPROXIMATIONS
373
+
374
+ Recall that we truncated the future trajectory after five steps. In other words, the number of current+future steps is upper-bounded at six. Effectively, we are using a discount factor of 0.83.12
375
+
376
+ Given that the $Q$ -value corresponds to future return, we attempted using different strategies. (1) Using the entire future trajectory, and (2) using a fixed number of future steps. We attempted (1) on NQG using the standard models (tuned discount factor in $\{ 1 , 0 . 9 , 0 . 8 , 0 . 7 , \bar { 0 . 5 } \} )$ and found that $\{ 0 . 8 , 0 . 7 \}$ usually performs best, resulting in similar performance but longer training time, compared to the current 5-future-step approach. We attempted (2) using the number of future steps in $\{ 1 , 2 , 3 , 5 , 7 , 1 0 \}$ and found that using $\{ \bar { 5 } , 7 , 1 0 \}$ leads to similar results, which are slightly better compared to $\{ 1 , 2 , 3 \}$ . One benefit is that given a fixed number of future steps, we found that using easy-to-tune constant baselines work well, and training time is also much shorter.
377
+
378
+ # A.5 DETAILS ON ON-POLICY EXPERIMENTS
379
+
380
+ For the $\mathsf { M L E { + } P G }$ baseline, we used the REINFORCE algorithm with sequence-level rewards (BLEU for NQG and ROUGE-2 for summarization). We attempted two versions of the baselines: (i) constant baselines searched in $\{ 0 , 0 . 0 1 , 0 . 0 5 , 0 . 1 , 0 . 1 5 \}$ for BLEU (NQG) and ROUGE-2 (CNN/DM), as well as (ii) baselines computed by the average BLEU/ROUGE-2 over the last 100 steps, minus $\{ 0 , 0 . 0 5 \}$
381
+
382
+ In terms of training warmup choices, We tried two versions of the training algorithm. (a) We initialized with MLE and trained with PG losses interpolated with MLE losses, given we found that the training process would become very unstable without interpolation. (b) We also attempted the following: we intialized the model at random and used MIXER (Ranzato et al., 2016). However, we failed to find improvements compared to (a), under our architecture. A relevant work Choshen et al. (2020) showed that properly tuned on-policy RL may not work for text generation in some cases.
383
+
384
+ We also tried MIXER with the learned baseline for NQG, which is estimated by a simple linear regressor that takes RNN hidden states as inputs, according to Ranzato et al. (2016). After some tuning, we achieved only slight improvements in NQG (BLEU 14.71). One advantage of GOLD is that our algorithm does not rely on learning baselines which could have a big impact on performance of on-policy algorithms; in fact, all baselines are constants in this paper.
385
+
386
+ Note that for $\mathrm { G O L D + P G }$ models, we only attempted constant baselines; better tuning of baselines could potentially lead to stronger performance.
387
+
388
+ # B MORE ON RESULTS
389
+
390
+ # B.1 LEAD-3 BASELINES FOR SUMMARIZATION
391
+
392
+ The lead-3 baseline (using first 3 sentences as summaries) is a popular strong baseline in summarization literature. The ROUGE-1/2/L scores of the lead-3 baselines are as follows: 40.42/17.62/36.67 for CNN/DM; 16.30/1.60/11.95 for XSum. Our performance using transformer models beat these baselines by a large margin.
393
+
394
+ # B.2 PERFORMANCE WITH TRANSFORMER ARCHITECTURES
395
+
396
+ We experiment using transformer architectures, as shown in Table 3; we also experiment on two more tasks (compared to using standard architectures): XSum and IWSLT14 De-En. We achieve SOTA/near-SOTA result (according to automatic metrics which have inherent limitations) on CNN/DM: at the time of writing, our results (45.40/22.01/42.25 using GOLD- $p$ or 44.82/22.09/41.81 using GOLD- $s$ ) are higher than 44.17/21.47/41.11 (PEGASUS; Zhang et al., 2020) and 44.20/21.17/41.30 (ProphetNet; Qi et al., 2020), both slightly higher than BART. Note the PEGASUS CNN/DM result is pretrained on 1.5B news articles (around 3.8 terabyte), whereas BART is pretrained on 3.3B words (around 0.16 tetrabyte). Our XSum results are also higher than PEGASUS (45.20/22.06/36.99) trained on Colossal Clean Crawled Corpus (C4; Raffel et al., 2020), but lower than the PEGASUS result using the publicly-unavailable 1.5B-article 3.8 terabyte HugeNews (Zhang et al., 2020) as pretrained corpus. We hypothesize that if our models are applied onto their architectures instead of pointer generator networks or BART, we would similarly get non-trivial improvements.
397
+
398
+ We also achieve 0.81 point of BLEU improvement on IWSLT14 De-En; GOLD- $s$ performs better than the existing approaches that do not use knowledge distillation or data augmentation, as far as the authors are aware.
399
+
400
+ ![](images/dd1f691d832970e1a5437c218424b527ced2fdc01356c250eaae382fbff3bfbf.jpg)
401
+ Figure 3: Exposure bias related figures on NQG dev set. Vertical axis: avg unsmoothed sentence-level BLEU. Horizontal axis: sentence length. The colored regions represent $9 5 \%$ confidence interval obtained using standard bootstrapping. Subfigures (a) and (c) show BLEU on randomly shuffled targets (from dev set); BLEU does not appear to punish long sentences. Note the scale of the vertial axes. Subfigures (b) and (d) show BLEU vs. generation length; BLEU on generations from MLEtrained model decreases by length, but BLEU on generations from GOLD-trained model appears to stay relatively stable.
402
+
403
+ # B.3 MORE ON EXPOSURE BIAS
404
+
405
+ With exposure bias. Recall that in Section 4.2, we used human evaluation (a score of 1 or 2 or 3 or 4) to approximate the output quality, and we found that the MLE-trained model degrades significantly when the generation length is long, whereas the quality of the GOLD- $s$ -trained model stays relatively stable across lengths.
406
+
407
+ Here, we use BLEU to approximate the quality of NQG generations, and we show that BLEU does not bias toward long sentences. Figure 3 shows the average sentence-level BLEU by sequence length.13
408
+
409
+ Specifically, Figures 3a and 3c show the BLEU on randomly shuffled targets (from dev set), which show that longer sentences do not appear to punish BLEU scores. Figures 3b and 3d show the BLEU by sentence length, on model generations. We see that MLE’s BLEU decreases by length but GOLD- $s$ ’s BLEU appears to stay relatively stable. We thus see some evidence that MLE is generating worse sentences as sentence gets longer.
410
+
411
+ If there is no exposure bias. In the main text, we used the NLL loss vs. length plot to demonstrate that without exposure bias, the loss does not vary much across length, so the MLE performance drop in Figure 2 (left) is mainly due to exposure bias. Here, we provide another way to analyze the case without exposure bias.
412
+
413
+ Figure 4 shows the token prediction accuracy conditioned on gold histories on NQG dev set. Note that for each example, we let $t _ { x } = L _ { x } - 5$ , where $L _ { x }$ is the length of reference sentence $_ { \textbf { \em x } }$ . We can see that without exposure bias, prediction accuracy does not vary much as the length increases. Therefore, we conclude that the big performance drop for long generations using MLE is mainly due to exposure bias and GOLD suffers less from the problem.
414
+
415
+ # B.4 EXAMPLES
416
+
417
+ Table 7 and Table 8 show the example generations based on the transformer models.
418
+
419
+ ![](images/fa4e8fe4ce15ec33216f4647bcab7ecffe93857fa5202e1b7e03bb38933b386f.jpg)
420
+ Figure 4: Accuracy of correct predictions of tth token given all prefix reference tokens on NQG dev set. Colored regions represents $9 5 \%$ confidence interval obtained using standard bootstrapping. Without exposure bias, token prediction accuracy stays relatively stable across lengths.
421
+
422
+ Table 7: NQG and CNN/DM examples based on transformer models. For NQG, words to query on are bolded.
423
+
424
+ <table><tr><td>task</td><td>objective example</td><td></td></tr><tr><td>NQG</td><td>input MLE</td><td>Some members of this community emigrated to the United States in the 1890s . when did some members of the portuguese-american community emigrate to the us ? GOLD-s when did some members of the community emigrate to the us ? reference in what era did some members of this community emigrate to the us ?</td></tr><tr><td>NQG</td><td>input MLE</td><td>Competition amongst workers tends to drive down wages due to the expendable nature of the worker in relation to his or her particular job . what is one of the reasons that causes wages to be lower ?</td></tr><tr><td>NQG</td><td>GOLD-s reference input</td><td>why do wages go down when there is competition amongst workers ? why does competition among workers drive down wages ? During the mid-eocene,it is believed that the drainage basin of the Amazon was split along the middle of the continent by the Purus Arch .</td></tr><tr><td></td><td>MLE GOLD-s</td><td>when was the purus arch formed ? when was the drainage basin of the amazon split ? reference in which point did the drainage basin of the amazon split ?</td></tr><tr><td>CNN/DM input</td><td></td><td>[omitted due to length and copyright issues,but the original news article can be retrieved by searching the reference online]</td></tr><tr><td></td><td>MLE</td><td>There are nearly 5,Ooo“gems”scattered across the country,ranging from museums to</td></tr><tr><td></td><td></td><td>archaeological areas and monuments. Italy boasts the highest number of UNESCO World</td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td>Heritage sites in the world. Several of which risk crumbling to the ground due to neglect</td></tr><tr><td></td><td>GOLD-s</td><td>and lack of public resources. Italy boasts the highest number of UNESCO World Heritage sites in the world.The</td></tr><tr><td></td><td></td><td>Basilica of Assisi,where St. Frances’tomb lies,is badly in need of a restyle.Italy</td></tr><tr><td></td><td></td><td>doesn&#x27;t know how to exploit this treasure,says Francesco Toti reference Italy boasts the highest number of UNESCO World Heritage sites in the world .Italy</td></tr><tr><td></td><td></td><td>doesn&#x27;t know how to exploit treasures,and appears not to care about them, writes Silvia Marchetti .</td></tr><tr><td></td><td>CNN/DM input</td><td>[omitted due to length and copyright issues,but the original news article can be retrieved</td></tr><tr><td></td><td></td><td>by searching the reference online] President Obama has argued with progressive potentate Elizabeth Warren, calling her</td></tr><tr><td></td><td>MLE</td><td></td></tr><tr><td></td><td></td><td>&quot;wrong&quot;on trade policy.What everyone does next will be critical for the 2Ol6 elections</td></tr><tr><td></td><td></td><td>and the future of Democratic politics.Warren has publicly criticized &quot;fast track&quot;trade</td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td>authority that would allow the White House to negotiate massive,multination trade deals.</td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td>GOLD-s President Obama has argued with the progressive potentate Elizabeth Warren,calling her</td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td>&quot;wrong”on trade policy. Julian Zelizer: If Hillary Clinton wants to prove she&#x27;sa real</td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td>populist, now is her chance to be even more clear about her position on the TPP deal .</td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td>Sen.Elizabeth Warren has publicly criticized so-called &quot;fast track” trade authority</td></tr><tr><td></td><td>reference</td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td>Sally Kohn:Why does President Obama call her wrong,and why is Hillary Clinton</td></tr></table>
425
+
426
+ Table 8: XSum and IWSLT14 De-En examples based on transformer models.
427
+
428
+ <table><tr><td>task</td><td colspan="2">objective example</td></tr><tr><td>XSum</td><td>input</td><td>[omitted due to length and copyright issues,but the original news article can be retrieved by searching the reference online]</td></tr><tr><td></td><td>MLE</td><td>The Isle of Wight father&#x27;s decision not to pay a fine for taking his seven-year-old daughter on holiday during term time caused“a huge amount of confusion”,a senior MP has said.</td></tr><tr><td></td><td></td><td>GOLD-s The High Court ruling that a father could not be prosecuted for taking his seven- year-old daughter on a term-time holiday to Disney World caused“a huge amount</td></tr><tr><td></td><td></td><td>of confusion&quot;,MPs have said. reference A High Court ruling backing a parent who refused to pay a fine for taking his child on holiday in term time will cause“huge confusion&quot;,an MP has said.</td></tr><tr><td>XSum</td><td>input</td><td>[omited due to length and copyright issues,but the original news article can be retrieved by searching the reference online]</td></tr><tr><td></td><td>MLE</td><td>Flood defences at a Denbighshire beach could be strengthened to reduce the risk of them being breached.</td></tr><tr><td></td><td>GOLD-s</td><td>A new dune system could be built to protect a Denbighshire beach from flooding. eNew sand dunes may be created to reduce the risk of flooding on a beach on the</td></tr><tr><td></td><td>reference</td><td>Denbighshire and Flintshire border.</td></tr><tr><td>XSum</td><td>input</td><td>[omitted due to length and copyright issues,but the original news article can be retrieved by searching the reference online]</td></tr><tr><td></td><td>MLE</td><td>Fleetwood&#x27;s League One play-off hopes suffered a blow as they were held to a goalless draw by League One strugglers Doncaster.</td></tr><tr><td></td><td>GOLD-s</td><td>Fleetwood and Blackburn played out a goalless draw in League One.</td></tr><tr><td></td><td>reference</td><td>Fleetwood Town dropped into the League One relegation places as they had to settle for a point after a stalemate with Doncaster.</td></tr><tr><td>IWSLT14 De-En input</td><td></td><td>ich hab da so ne kognitive rückkopplung,du hast was projiziert,was du sehen mochtest.</td></tr><tr><td></td><td>MLE</td><td>i&#x27;ve been doing this with cognitive feedback,you&#x27;ve been prospecting what you want to see.</td></tr><tr><td></td><td>GOLD-S</td><td>i&#x27;ve got cognitive feedback, you&#x27;ve proved what you want to see.</td></tr><tr><td></td><td>reference</td><td>eihave this cognitive feedback,you projected something you want to see.</td></tr><tr><td>IWSLT14 De-En input</td><td></td><td>es sind also alle werkzeuge vorhanden,und die einzige sache,die uns limitiert, ist unsere vorstellungskraft.</td></tr><tr><td></td><td>MLE</td><td>so there are all the tools available,and the only thing that&#x27;s licensed to us is our imagination</td></tr><tr><td></td><td>GOLD-sS</td><td>so there are all the tools there,and the only thing that limited us is our imagination.</td></tr><tr><td>IWSLT14 De-En input</td><td></td><td>reference so all the tools are out there,and the only thing that limits us is our imagination. unser organismus hat eine groBartige methode erfunden, um solche unangenehmen</td></tr><tr><td></td><td></td><td>gefuhle wie neid einfach zum verschwinden zu bringen.</td></tr><tr><td></td><td>MLE</td><td>our organism has invented a great way to get such uncomfortable emotions as neither of us to disappear.</td></tr><tr><td></td><td>GOLD-s (</td><td>our organism invented a great way to make such uncomfortable emotions like</td></tr><tr><td></td><td></td><td>envy easy to disappear. reference our organism has come up with an excellent method to make unpleasant feelings</td></tr></table>
429
+
430
+ # C HUMAN EVALUATIONS
431
+
432
+ # C.1 PAIRWISE COMPARISON
433
+
434
+ Our goal is to enable high-quality generations that do not necessarily result in gold references. Given that corpus-level BLEU/ROUGE score is only a popular approximation of generation quality, we first conduct human ratings to confirm the hypothesis that our approaches are generating better sequences. For NQG, for each unit of human evaluation, we present the source paragraph, the words to ask the question on, the question generated by MLE-trained model, as well as the question generated by GOLD- $s$ -trained model. We ask the human evaluators the general question: which generated question is better? Figure 5 shows one example interface of pairwise comparisons.
435
+
436
+ Using NQG dev set, on standard models, of the 183 pairs of comparison we conducted human evaluations on, 42 $( 2 3 . 0 \% )$ MLE-questions are better, 81 $( 4 4 . 3 \% )$ GOLD- $s$ -questions are better, and 60 $( 3 2 . 8 \% )$ are tied. We also evaluate on models based on BART, shown in Table 5 in the main text.
437
+
438
+ For summarization tasks, given that it is infeasible to get high-quality annotations if we let workers read the entire news article14, we only did the following: given the reference summary, a summary generated from MLE model, and a summary generated from our model, we asked workers to compare which generated summary is closer in meaning to the reference summary. Figure 6 shows one example interface of the mentioned pairwise comparison for summarization. See Table 5 for results.
439
+
440
+ ![](images/508b394336eb57064eb55dbbb2a5c0271f433e8441f893c0b91bfa6101b78fff.jpg)
441
+ Figure 5: Interface for NQG pairwise comparisons, using Amazon Mechanical Turk.
442
+
443
+ ![](images/4ceccb7b61e871c328779f695151fb40ae1f71835cea3f374036ea859cbcb55a.jpg)
444
+ Figure 6: Interface for summarization pairwise comparisons, using Amazon Mechanical Turk.
445
+
446
+ # C.2 NQG RATING
447
+
448
+ NQG rating was conducted to examine if longer sentences (generated by MLE-trained model) will result in worse human ratings, and if GOLD alleviates the problem. In Figure 2 (left), to reduce variance, we group length by buckets of two (e.g., [7, 8], [9, 10], [11, 12], etc.). Furthermore, we sampled 736 annotations such that each bucket would contain at least 30 sentences (for human evaluation) for each of MLE and GOLD-s. We also shown the $9 5 \%$ confidence interval using standard bootstrapping, in Figure 2 (left).
449
+
450
+ ![](images/f400593e7cbe60106a0423dfcce0a50fd9c164c1356fe0fbd7525fe27fcbc8fe.jpg)
451
+ Figure 7: Interface for NQG human ratings, using Amazon Mechanical Turk.
452
+
453
+ Given the paragraph, words to query on, and the generations, we ask workers to rate the generations. Figure 7 shows an example interface of NQG human ratings. We ask workers to consider both the correctness of the generation (i.e., if the question is asking about the specified words using facts) and the quality of the generation (i.e., if the generation is fluent and coherent). We ask workers to rate from 1 to 4, where 1 means very bad, 2 means slightly below average, 3 means slightly above average, and 4 means very good.
md/train/SJ1nzBeA-/SJ1nzBeA-.md ADDED
@@ -0,0 +1,330 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MULTI-TASK LEARNING FOR DOCUMENT RANKING AND QUERY SUGGESTION
2
+
3
+ Wasi Uddin Ahmad & Kai-Wei Chang
4
+
5
+ Department of Computer Science University of California, Los Angeles {wasiahmad,kwchang}@cs.ucla.edu
6
+
7
+ Hongning Wang Department of Computer Science University of Virginia hw5x@virginia.edu
8
+
9
+ # ABSTRACT
10
+
11
+ We propose a multi-task learning framework to jointly learn document ranking and query suggestion for web search. It consists of two major components, a document ranker and a query recommender. Document ranker combines current query and session information and compares the combined representation with document representation to rank the documents. Query recommender tracks users’ query reformulation sequence considering all previous in-session queries using a sequence to sequence approach. As both tasks are driven by the users’ underlying search intent, we perform joint learning of these two components through session recurrence, which encodes search context and intent. Extensive comparisons against state-of-the-art document ranking and query suggestion algorithms are performed on the public AOL search log, and the promising results endorse the effectiveness of the joint learning framework.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ Understanding users’ information need is the key to optimize a search engine for providing relevant search results. Search engine logs have been extensively used to mine users’ search intent, reflected in their search result click preferences and query reformulations (Baeza-Yates et al., 2004; Croft et al., 2010). Typically, user query logs are partitioned into search sessions, i.e., sequences of queries and clicks issued by the same user and within a short time interval. Search sessions provide useful contextual information about user intent and help to narrow down ambiguity while ranking documents for the current query and predicting next query that users will submit, a.k.a. contextawareness (Jiang et al., 2014). Since both a user’s click behavior and query reformulation are driven by the underlying search intent, we argue that jointly modeling both tasks can benefit each other.
16
+
17
+ In this work, we propose a joint learning framework, called multi-task neural session relevance framework (M-NSRF), to predict users’ result clicks and future queries in search sessions. We model search context within a session via a recurrent latent state in a deep neural network (Collobert & Weston, 2008; Liu et al., 2015), which governs the generation of result clicks in the current query and formation of next query. By sharing the latent states across the tasks of document ranking and query suggestion, we learn the representations of queries, documents and user intent carrying over the whole session jointly, i.e., multi-task learning. This multi-task learning framework is flexible and can be incorporated with existing approaches for representing query and documents.
18
+
19
+ The general workflow of M-NSRF is illustrated in Figure 1. Given a sequence of queries from the same search session, e.g., “cheap furniture” and “craig list virginia”, M-NSRF is trained to predict both the result clicks under the current query and the next query “cheap furniture for sale.” It is evident that in this search session the user kept reformulating the queries because his/her information need has not been met by the result clicks in the previously submitted queries, reflected in the added and removed query terms. And such revisions suggest what he/she might want to click next. As a result, the modeling of result clicks and query reformulations mutually reinforce each other to reveal users’ underlying search intent. In M-NSRF, we model user search intent as a session-level recurrent state, the learning of which is aided by both document ranking and query prediction tasks.
20
+
21
+ We evaluate the effectiveness of the proposed framework using the publicly available AOL search log and compare with several well-known classical retrieval models, as well as various neural retrieval models specifically designed for ad-hoc retrieval. We also compare M-NSRF with several baseline models for the query prediction task. The empirical results show that by leveraging information in both tasks, the proposed approach outperforms existing models significantly on ad-hoc document retrieval task and exhibits competitive performance in query suggestion.
22
+
23
+ ![](images/a9ef5193be3a238f5aa45bb7d710b1d9d8cd61450f8192781d008424c2eef408.jpg)
24
+ Figure 1: General workflow of the proposed multi-task neural session relevance framework. The framework is trained on search sessions to jointly predict next query and rank corresponding documents. The model encodes the current query in the session, “craig list virginia”, updates corresponding session-level recurrent state, maximizes the probability of the next query, “cheap furniture for sale” (i.e., the task of query suggestion), encodes the candidate documents for the following query and minimizes loss for clicked documents (i.e., the task of document ranking).
25
+
26
+ To summarize, the key contributions of this work include:
27
+
28
+ 1. We propose a novel multi-task neural session relevance model that is jointly trained on document ranking and query suggestion tasks by utilizing in-session queries and clicks in a holistic way.
29
+ 2. We provide detailed experiment analysis, and release the implementation1 and the data processing tool to facilitate future research.
30
+
31
+ # 2 RELATED WORK AND BACKGROUND
32
+
33
+ Ad-hoc Retrieval. Traditional retrieval models such as query likelihood (Ponte & Croft, 1998) and BM25 (Robertson et al., 2009) are based on exact matching of query and document words with a variety of smoothing, weighting and normalization techniques. Recently, deep neural network based approaches demonstrate strong advance in ad-hoc retrieval. Existing neural ranking models fall into two categories: representation focused (Huang et al., 2013; Gao et al., 2014) and interaction focused (Guo et al., 2016b). The earlier focus of neural ranking models was mainly on representation based models (Hu et al., 2014; Shen et al., 2014), in which the query and documents are first embedded into continuous vectors, and the ranking is calculated based on their embeddings’ similarity. The interaction focused neural models (Hu et al., 2014; Pang et al., 2016; Guo et al., 2016a), on the other hand, learn query-document matching patterns from word-level interactions. Both the interaction and representation focused models can be combined for further improvements (Mitra et al., 2017). Similarly, Jaech et al. (2017) captures both local relevance matching and global topicality signals when computing relevance of a document to a query. Our work falls into the representation focused approach to form query and document representations and jointly models the two tasks through session representation learning.
34
+
35
+ Query Suggestion. In general, query suggestion algorithms define various distance metrics between queries to find the most similar ones as suggestions for one another (Wen et al., 2001; Baeza-Yates et al., 2004). The closest work to ours is the end-to-end hierarchical recurrent encoder-decoder architecture (HRED-qs) (Sordoni et al., 2015), which ranks candidates for context-aware query suggestion. Our proposed framework differs from HRED-qs as it integrates another important type of user search behavior, i.e., result clicks, into the joint modeling, which provides additional contextual information for query suggestion. Mitra & Craswell (2015) proposed a candidate generation approach for rare prefixes using frequently observed query suffixes and suggested a neural model to generate ranking features along with n-gram features. Similarly, a large pool of previous works investigated task or context-aware approaches (Cao et al., 2008; He et al., 2009; Feild & Allan, 2013; Chen et al., 2017; Garigliotti & Balog, 2017) for query suggestion.
36
+
37
+ Multi-task Learning. The goal of multi-task learning is to improve generalization on the target task by leveraging the domain-specific information contained in the training signals of related tasks (Caruana, 1998). Multi-task learning in combination with deep neural networks has been successfully used in many application scenarios, including natural language processing (Collobert & Weston, 2008; Liu et al., 2016a;b; Peng & Dredze, 2017; Peng et al., 2017), speech recognition (Deng et al., 2013; Thanda & Venkatesan, 2017) and computer vision (Girshick, 2015). However, it has been less explored in the information retrieval domain. Liu et al. (2015) proposed a multi-task deep neural approach to combine query classification and document ranking, and reported improvement on both the tasks. Bai et al. (2009) used multi-task learning in learning to rank for web search. We propose to jointly learn document ranking and query suggestion via multi-task learning to better capture latent intent embedded in users’ search behaviors.
38
+
39
+ # 3 MULTI-TASK NEURAL SESSION RELEVANCE FRAMEWORK
40
+
41
+ We define a session to be a sequence of queries, $Q = \{ Q _ { 1 } , \ldots , Q _ { n } \}$ , submitted by a user in a short time interval in a chronological order to satisfy a specific search intent. Every query $Q _ { i }$ in a session is associated with a set of related documents $\boldsymbol { D } \doteq \{ D _ { 1 } , \ldots , D _ { m } \}$ which need to be ranked by its relevance to the query, and $o = \{ o _ { 1 } , \ldots , o _ { m } \}$ is the set of relevance labels for each document in $D$ . In typical search engine logs, $o _ { j }$ is usually approximated via user clicks, e.g., $o _ { j } = 1$ if and only if the document $D _ { j }$ is clicked. A query $Q _ { i }$ and a document $D _ { j }$ consist of a sequence of words, i.e., $Q _ { i } = \{ w _ { i } ^ { 1 } , . . . , \bar { w } _ { i } ^ { q } \}$ and ${ D } _ { j } = \{ w _ { j } ^ { 1 } , . . . , w _ { j } ^ { d } \}$ , where $q = | Q _ { i } |$ and $d = | D _ { j } |$ are the query and document lengths respectively. $V$ is the size of vocabulary constructed over queries and relevant documents.
42
+
43
+ The document ranking refers to the task of ordering the retrieved results with respect to their relevance to the given query under the users’ search intent. Accurate modeling of relevance between a document and a query is the key in this task. In this work, we model ranking of related documents as a pointwise classification problem where the goal is to predict the relevance label between a query and a document. But our developed solution can be extended to pairwise or list-wise ranking models (Liu et al., 2009). On the other hand, query suggestion refers to the task of predicting next query $Q _ { i }$ based on previous queries $Q _ { 1 } \ldots Q _ { i - 1 }$ by users in the same session, so as to help them explore the search space. The key challenge is to maintain the semantic consistency between the suggested queries and users’ original queries, with respect to their search intent.
44
+
45
+ Traditional IR approaches consider document ranking and query suggestion tasks separately (Huang et al., 2013; Shen et al., 2014; Sordoni et al., 2015), although both the tasks are driven by users’ underlying search intent. In contrast, M-NSRF is designed to jointly learn a document ranker and a query recommender by modeling shared search context embedding in a session. Based on the latent session state inferred from all the previous queries and clicks in the same session, the document ranker is trained to predict user clicks from the candidate documents for the current query and the query recommender is trained in a sequence to sequence fashion (Sutskever et al., 2014) to predict the user’s next query. The process is repeated sequentially for all the queries in the same session. The detailed architecture of the proposed multi-task neural session relevance framework (M-NSRF) is provided in Appendix A. In the following, we discuss each component of M-NSRF.
46
+
47
+ # 3.1 DOCUMENT RANKER
48
+
49
+ Ranking the retrieved documents for an input query requires encoding the query and documents into a shared representation space. In addition to the search intent carried by the current query, search context, which is reflected in the previously submitted queries in the same session, should also be accounted in ranking the documents. In M-NSRF, we model the latent user search intent in a sequence of queries via a series of session recurrent states. As a result, the document ranker component in M-NSRF consists of a query encoder, a document encoder, a session encoder and a ranker. The ranker sub-component combines the latent representations of query and session and match them with document representations to generate the ranking score of documents, based on which the documents are ordered. The technical details of each constituent element are given as follows.
50
+
51
+ Query Encoder. The query encoder encodes a query into a vector. To encode a sequence of words, various approaches have been studied. We follow (Conneau et al., 2017) to adopt a bidirectional LSTM with max pooling (BiLSTM-max), due to its superior practical performance. Considering query as a sequence of words $Q _ { i } = \{ w _ { i } ^ { 1 } , \ldots , w _ { i } ^ { q } \}$ , the encoder composed of forward and backward LSTM reads the sequence in two opposite directions,
52
+
53
+ $$
54
+ \vec { h } _ { t } = L S T M _ { t } ( \vec { h } _ { t - 1 } , w _ { i } ^ { t } ) , \quad \overleftarrow { h } _ { t } = L S T M _ { t } ( \overleftarrow { h } _ { t + 1 } , w _ { i } ^ { t } ) , \quad h _ { t } = [ \overrightarrow { h } _ { t } , \overleftarrow { h } _ { t } ]
55
+ $$
56
+
57
+ where $h _ { t } \in R ^ { 2 d }$ is the query-level recurrent state, $d$ is the dimensionality of the LSTM hidden unit initialized to a zero vector. To form a fixed-size vector representation of variable length queries, maximum value is selected over each dimension of the hidden units,
58
+
59
+ $$
60
+ Q _ { i , k } = \operatorname* { m a x } _ { q } \ h _ { k , q } , \ k = 1 , \ldots , d
61
+ $$
62
+
63
+ where $Q _ { i , k }$ is the $k$ -th element of the latent vector $Q _ { i }$ .
64
+
65
+ Document Encoder. The goal of the document encoder is to encode documents into continuous vectors. We use the same BiLSTM-max technique that is utilized in encoding queries as the document encoder. The only difference is in the dimensionality of the LSTM hidden units. In general, because a document (body or title) is longer than a query, we consider dense vector of a larger size as the continuous representations of the documents.
66
+
67
+ Session Encoder. The session encoder generates a representation to encode the queries that the system has received so far. Unlike query and document encoders that can read the complete encoded queries and documents, the session encoder does not have information from the future queries. Therefore, we use a unidirectional LSTM (Hochreiter & Schmidhuber, 1997) for session encoding. The session encoder takes the sequence of query representations $Q _ { 1 } , . . . , Q _ { n }$ as input and computes the sequence of session-level recurrent states.
68
+
69
+ $$
70
+ S _ { i } = L S T M _ { i } ( S _ { i - 1 } , Q _ { i } ) ,
71
+ $$
72
+
73
+ where $S _ { i } \in R ^ { d }$ is the session-level recurrent state initialized to a zero vector. As a result, each query in the session has its session-level recurrent state, summarizing the user’s information need that has been processed up to query $Q _ { i }$ .
74
+
75
+ Ranker. We first concatenate the current query representation $Q _ { i }$ with previous session-level recurrent state $S _ { i - 1 }$ via a non-linear transformation. This combined representation reflects the search intent reflected in the current query and the past ones in the same session. Then we compute the ranking score of document $D _ { j }$ under the query as its probability of being relevant via a sigmoid function (with binary relevance labels),
76
+
77
+ $$
78
+ P ( D _ { j } | Q _ { i } , S _ { i - 1 } ) = \sigma \big ( D _ { j } ^ { T } \operatorname { t a n h } ( W _ { r } [ Q _ { i } , S _ { i - 1 } ] + b _ { r } ) \big ) , \ j = 1 , \dots , m
79
+ $$
80
+
81
+ where $W _ { r } \in \textit { R } ^ { ( d _ { q } + d _ { s } ) \times d _ { d } }$ , $b _ { r } ~ \in ~ R ^ { d _ { d } }$ , and $d _ { q } , \ d _ { s }$ and $d _ { d }$ are the dimensionality of the query encoder, session encoder and document encoder hidden units and $\sigma$ is the sigmoid function. A list of retrieved documents can therefore be ordered by this ranking score.
82
+
83
+ # 3.2 QUERY RECOMMENDER
84
+
85
+ Query recommender suggests related queries to users by inferring the underlying search intent through utilizing in-session previous queries embedded in latent vectors. Following Sutskever et al. (2014) and Bahdanau et al. (2015), the query recommender in M-NSRF predicts users’ next query in a sequence to sequence manner. Basically the query recommender module estimates the probability of the next query $\mathbf { \ddot { \cal Q } } _ { i } = \{ w _ { i } ^ { 1 } , \dots , w _ { i } ^ { q } \}$ , given all the previous queries up to position $i - 1$ in a session as follows,
86
+
87
+ $$
88
+ P ( Q _ { i } | Q _ { 1 : i - 1 } ) = \prod _ { t = 1 } ^ { q } P ( w _ { i } ^ { t } | w _ { i } ^ { 1 : t - 1 } , Q _ { 1 : i - 1 } )
89
+ $$
90
+
91
+ We use LSTM as a basic building block for the query recommender. Information about all the previous queries represented through a session vector $S _ { i }$ is passed to the query recommender. To this end, the recurrent state of the query recommender is initialized with a non-linear transformation of $S _ { i }$ , $h _ { 0 } = \operatorname { t a n h } ( W _ { q } S _ { i } + b _ { q } )$ , where $h _ { 0 } ~ \in ~ R ^ { d }$ is the initial recurrent state. Then the query recommender’s recurrence is computed by $h _ { t } = L S T M _ { t } ( h _ { t - 1 } , w _ { i } ^ { t } )$ , where $h _ { t - 1 }$ is the previous hidden state, $w _ { i } ^ { t - 1 }$ is the previous query term. Finally, each recurrent state is mapped to a probability distribution over the vocabulary of size $V$ using a combination of linear transformation and the softmax function. Word with the highest probability is chosen as the next word in sequence.
92
+
93
+ $$
94
+ P ( w | w _ { i } ^ { 1 : t - 1 } , Q _ { 1 : i - 1 } ) = g ( W _ { p } h _ { t } + b ) ,
95
+ $$
96
+
97
+ where $g$ is the softmax function that outputs a vector to represent the distribution of next words, where the probability assigned to the $j$ -th element is defined as $\begin{array} { r } { g ( z ) _ { j } = \frac { e ^ { z _ { j } } } { \sum _ { k = 1 } ^ { K } e ^ { z _ { k } } } } \end{array}$ e j PKk=1 ezk , j = 1, ..., K .
98
+
99
+ Query Suggestion. In the decoding phase, similar to (Sordoni et al., 2015), we use greedy decoding algorithm for suggesting next query. Given a sequence of queries up to position $i - 1$ , a suggested query $Q _ { i }$ is:
100
+
101
+ $$
102
+ Q ^ { * } = \arg \operatorname* { m a x } _ { Q ^ { \prime } \in \mathcal { Q } } P ( Q ^ { \prime } | Q _ { 1 : i - 1 } )
103
+ $$
104
+
105
+ where $\mathcal { Q }$ is the space of all possible queries. To generate $Q ^ { * } = \{ w ^ { 1 } , \ldots , w ^ { q } \}$ , we use a greedy approach like in (Sordoni et al., 2015) where $\begin{array} { r } { w ^ { t } = \arg \operatorname* { m a x } _ { w } P ( w | w ^ { 1 : t - 1 } , Q _ { 1 : i - 1 } ) } \end{array}$ To provide query suggestions of variable lengths, we use standard word-level decoding techniques. We iteratively consider the best prefix $w _ { 1 : t }$ up to length $t$ and extend it by sampling the most probable word given the distribution in Eq. (2). The process ends when we obtain a well-formed query containing the special end-of-query token.
106
+
107
+ # 3.3 LEARNING END-TO-END
108
+
109
+ Within a session, M-NSRF ranks documents in a set of candidates and predicts next query given the current query sequence. Therefore, the training objective of M-NSRF consists of two terms. The first term is the binary cross entropy loss from the document ranker,
110
+
111
+ $$
112
+ \mathcal { L } _ { 1 } \equiv - \frac { 1 } { m } \sum _ { j } ^ { m } o _ { j } \times \log \ P ( D _ { j } | Q _ { i } ) + ( 1 - o _ { j } ) \times \log ( 1 - P ( D _ { j } | Q _ { i } ) )
113
+ $$
114
+
115
+ where $o _ { j }$ represents binary click label for $D _ { j }$ . The second term is the regularized negative loglikelihood loss from the query suggestion model,
116
+
117
+ $$
118
+ \mathcal { L } _ { 2 } \equiv - \sum _ { t } ^ { q } \log P ( w _ { i } ^ { t } | w _ { i } ^ { 1 : i - 1 } , Q _ { 1 : i - 1 } ) + L _ { R } ,
119
+ $$
120
+
121
+ where $\begin{array} { r } { \mathcal { L } _ { R } \equiv - \lambda \sum _ { w \in V } P ( w | w _ { i } ^ { 1 : t - 1 } , Q _ { 1 : i - 1 } ) \log P ( w | w _ { i } ^ { 1 : t - 1 } , Q _ { 1 : i - 1 } ) } \end{array}$ is the regularization term to avoid the distribution of words in Eq. (2) from being highly skewed, and $\lambda$ is a hyper-parameter to control the regularization term. The final objective is the summation of $L _ { 1 }$ and $L _ { 2 }$ over all the queries.2
122
+
123
+ Note that the document ranker and query recommender share the same document, query, and session encoders, and the training of M-NSRF can be done in an online manner using the following procedure. In the forward pass, M-NSRF computes the query and corresponding document encodings, updates session-level recurrent states, click probability for each candidate document and the log-likelihood of each query in the session given the previous ones. In the backward pass, the gradients are computed and the parameters are updated based on the ADAM update rule (Kingma & Ba, 2014). Details of implementation can be found in Section 4.2
124
+
125
+ # 3.4 GENERALIZING M-NSRF FOR NEURAL IR MODELS
126
+
127
+ The proposed multi-task learning framework is general and the query encoder, document encoder, document ranker, and query recommender can be replaced by other designed architecture. In general, any neural query suggestion model working in the sequence to sequence fashion can be readily incorporated with the proposed multi-task learning framework. Similarly, most neural IR models that built on the notion of learning query and document representations in a latent space for relevance modeling can be Incorporated in our framework as well. However, due to distinctive nature of different neural IR models, careful study is required while adding context-awareness into the final architecture.
128
+
129
+ In this paper, we take the Match-Tensor model (Jaech et al., 2017), a recently proposed neural relevance model for document ranking as an example and extend it to a multi-task Match-Tensor (M-Match-Tensor) model by incorporating the query recommender component within our proposed multi-task learning framework. Different from NSRF, which embeds queries and documents into vectors, Match-Tensor learns a contextual representation for each word in the queries and documents. Therefore, documents and queries are represented as matrices. The document ranker in Match-Tensor then computes the relevant score based on the following formulation:
130
+
131
+ $$
132
+ P ( D _ { j } | Q _ { i } ) = \sigma \big ( W _ { r } C ( Q _ { i } , D _ { j } ) + b _ { r } \big ) , i = 1 , \ldots , m
133
+ $$
134
+
135
+ where $C$ represents a sequence of convolutional operation (Lawrence et al., 1997) and max-pooling on the $2 d$ product of the query and document vectors. The detailed architecture of the M-MatchTensor model (M-Match-Tensor) is provided in Appendix B. To incorporate the match-tensor in our mulit-task learning framework, we can replace the document encoder, query encoder, and the document ranker in M-NSRF with the ones specified in the Match-Tensor model. However, as the computations involve in the document ranker is substantial, we do not increase the computational complexity further by adding session recurrence in the document ranking. The query decoding component in M-Match-Tensor is identical to M-NSRF. In the experiment, we will show that multitask Match-Tensor achieves better performance than Match-Tensor in document ranking task.
136
+
137
+ # 4 EXPERIMENTS
138
+
139
+ # 4.1 DATA SETS AND EVALUATION METHODOLOGY
140
+
141
+ We conduct our experiments on the publicly available AOL search log (Pass et al., 2006). The queries in this dataset were sampled between 1 March, 2006 and 31 May, 2006. In total there are 16,946,938 queries submitted by 657,426 unique users. We removed all non-alphanumeric characters from the queries, applied word segmentation and lowercasing. We followed (Jansen Bernard et al., 2007) to define a session by a 30-minute window of inactive time, and filtered sessions by their lengths (minimum 2, maximum 10). We only kept the most frequent $| V | = 1 0 0 k$ words and mapped all other words to an $< u n k >$ token when constructing the vocabulary. We randomly selected 1,032,459 sessions for training, 129,053 sessions for development and 91,108 sessions for testing, with no overlapping. In total, there are 2,987,486 queries for training, 287,138 for development, and 259,117 for testing. The average length of the queries and documents (only the title field) are 3.15 and 6.77 respectively. In our experiments, we set maximum allowable length of query and document to 10 and 20 respectively.
142
+
143
+ In the document ranking task, we need to rank the most relevant (e.g., most clickable) document on top. We used three standard ranking metrics, mean average precision (MAP), mean reciprocal rank (MRR) and normalized discounted cumulative gain (NDCG) metric computed at positions one, three, five and ten, to measure the performance. Since AOL search log only contains clicked documents, we constructed the ranking candidates by the top ranked documents by BM25 (Robertson et al., 2009). Each query in the test set consists of 50 candidate documents including the clicked ones. However, to reduce the training time and memory use, each query in training and development set only contains 5 candidates.
144
+
145
+ In the query suggestion task, we need to suggest the most semantically related query to users. As we do not have user feedback on the suggested queries, we treated the users’ next submitted query as ground-truth (Sordoni et al., 2015), and used the BLEU scores (Papineni et al., 2002) as the evaluation metric, which is a popularly used metric in machine translation and text generation tasks. In addition, following (Santos et al., 2013; Sordoni et al., 2015), we evaluated the query suggestion quality by mean reciprocal rank (MRR), i.e., to test if the algorithm can rank the users’ next query on top of its recommendation list. In this set of experiments, given a set of candidate queries, query suggestion models give a likelihood score of generating the candidates. We follow Sordoni et al. (2015) for dataset split and generate candidates using a co-occurrence based suggestion model. Like Sordoni et al. (2015), we give the anchor queries (second last query of a session) as an input to the query suggestion model and evaluates the rank of the next query among the candidates.
146
+
147
+ # 4.2 BASELINES AND IMPLEMENTATION DETAILS
148
+
149
+ Document Ranking Baselines. We compared M-NSRF and M-Match Tensor with word-based baselines and neural network-based baselines. Word-based baselines include query likelihood model based on Dirichlet smoothing (QL) (Ponte & Croft, 1998) and BM25 (Robertson et al., 2009). In addition, following (Mitra et al., 2016), we investigated the ranking performance of a simple word embedding-based model using GloVe word embeddings (Pennington et al., 2014). To compare with neural models, we consider baselines broadly categorized in representation-focused, interactionfocused and a combination of both. Representation-focused neural baselines include: DSSM (Huang et al., 2013), CLSM (Shen et al., 2014), ARC-I (Hu et al., 2014) and interaction-focused baselines include: ARC-II (Hu et al., 2014) and DRMM (Guo et al., 2016a). A combination of representation and interaction focused models include: DUET (Mitra et al., 2017) and Match Tensor (Jaech et al., 2017). Details of these models are provided in Appendix C. We implemented all the baseline models in PyTorch.
150
+
151
+ Table 1: Comparison of document ranking models over the AOL search log.
152
+
153
+ <table><tr><td rowspan=2 colspan=1>Model Type</td><td rowspan=2 colspan=1>Model Name</td><td rowspan=2 colspan=1>MAP</td><td rowspan=2 colspan=1>MRR</td><td rowspan=1 colspan=4>NDCG</td></tr><tr><td rowspan=1 colspan=1>@1</td><td rowspan=1 colspan=1>@3</td><td rowspan=1 colspan=1>@5</td><td rowspan=1 colspan=1>@10</td></tr><tr><td rowspan=2 colspan=1>TraditionalIR-models</td><td rowspan=2 colspan=1>BM25QL</td><td rowspan=2 colspan=1>0.1640.139</td><td rowspan=1 colspan=1>0.172</td><td rowspan=1 colspan=1>0.121</td><td rowspan=1 colspan=1>0.136</td><td rowspan=1 colspan=1>0.141</td><td rowspan=1 colspan=1>0.156</td></tr><tr><td rowspan=1 colspan=1>0.146</td><td rowspan=1 colspan=1>0.088</td><td rowspan=1 colspan=1>0.108</td><td rowspan=1 colspan=1>0.122</td><td rowspan=1 colspan=1>0.133</td></tr><tr><td rowspan=1 colspan=1>Embedding-based</td><td rowspan=1 colspan=1>ESM</td><td rowspan=1 colspan=1>0.214</td><td rowspan=1 colspan=1>0.179</td><td rowspan=1 colspan=1>0.118</td><td rowspan=1 colspan=1>0.127</td><td rowspan=1 colspan=1>0.139</td><td rowspan=1 colspan=1>0.158</td></tr><tr><td rowspan=2 colspan=1>RepresentationFocused</td><td rowspan=2 colspan=1>DSSMCLSMARC-I</td><td rowspan=2 colspan=1>0.2630.4650.383</td><td rowspan=2 colspan=1>0.2870.5050.413</td><td rowspan=1 colspan=1>0.152</td><td rowspan=2 colspan=1>0.2060.4410.343</td><td rowspan=2 colspan=1>0.2480.4820.404</td><td rowspan=2 colspan=1>0.3150.5230.467</td></tr><tr><td rowspan=1 colspan=1>0.3690.238</td></tr><tr><td rowspan=1 colspan=1>InteractionFocused</td><td rowspan=1 colspan=1>DRMMARC-II</td><td rowspan=1 colspan=1>0.2770.423</td><td rowspan=1 colspan=1>0.3160.455</td><td rowspan=1 colspan=1>0.2210.294</td><td rowspan=1 colspan=1>0.2420.386</td><td rowspan=1 colspan=1>0.2670.442</td><td rowspan=1 colspan=1>0.3040.501</td></tr><tr><td rowspan=1 colspan=1>Representation andInteraction Focused</td><td rowspan=1 colspan=1>DUETMatch-Tensor</td><td rowspan=1 colspan=1>0.2720.613</td><td rowspan=1 colspan=1>0.3010.621</td><td rowspan=1 colspan=1>0.1520.568</td><td rowspan=1 colspan=1>0.2120.572</td><td rowspan=1 colspan=1>0.2630.596</td><td rowspan=1 colspan=1>0.3410.618</td></tr><tr><td rowspan=1 colspan=1>Neural Session Model(this paper)</td><td rowspan=1 colspan=1>NSRF</td><td rowspan=1 colspan=1>0.553</td><td rowspan=1 colspan=1>0.568</td><td rowspan=1 colspan=1>0.481</td><td rowspan=1 colspan=1>0.526</td><td rowspan=1 colspan=1>0.555</td><td rowspan=1 colspan=1>0.574</td></tr><tr><td rowspan=1 colspan=1>Multi-task Model(this paper)</td><td rowspan=1 colspan=1>M-NSRFM-Match-Tensor</td><td rowspan=1 colspan=1>0.5810.621</td><td rowspan=1 colspan=1>0.6030.634</td><td rowspan=1 colspan=1>0.5230.572</td><td rowspan=1 colspan=1>0.5680.578</td><td rowspan=1 colspan=1>0.5830.602</td><td rowspan=1 colspan=1>0.6140.632</td></tr></table>
154
+
155
+ Query Suggestion Baselines. To evaluate the performance on query suggestion task, we consider three baseline methods including Seq2seq model proposed by Bahdanau et al. (2015), Seq2seq with global attention mechanism (Luong et al., 2015) and HRED-qs (Sordoni et al., 2015). Details of these models are provided in appendix D. We implemented all three baselines in PyTorch and optimized using negative log-likelihood loss as in Eq. (3).
156
+
157
+ Implementation Details of M-NSRF. The model was trained end-to-end and we used mini-batch SGD with Adam (Kingma & Ba, 2014) for optimization. with the two momentum parameters set to 0.9 and 0.999 respectively. We use 300-dimensional word vectors trained with GloVe (Pennington et al., 2014) on 840 billion of tokens to initialize the word embeddings. Out-of-vocabulary words were randomly initialized by sampling values from a zero-mean unit-variance normal distribution. All training used a mini-batch size of 32 to fit in single GPU memory. Learning rate was fixed to 0.001. We used dropout (0.20) (Srivastava et al., 2014) and early stopping with a patience of 5 epochs for regularization. We set $\lambda = 0 . 1$ for entropy regularization in Eq. (3). M-NSRF is implemented in PyTorch and it runs on a single GPU (TITAN X) with roughly a runtime of 90 minutes per epoch. In general, M-NSRF runs up to 20 epochs and we select the model that achieves the minimum loss on the development set.
158
+
159
+ # 4.3 EVALUATION RESULTS
160
+
161
+ Document Ranking Quality. Table 1 shows the performance of NSRF, M-NSRF, M-Match-Tensor and other baseline models. NSRF significantly outperforms all the baselines except the MatchTensor model. However, the model size of NSRF is much smaller than Match-Tensor. With multitask learning, both M-NSRF and M-Match-Tensor outperform NSRF and Match-Tensor, respectively. To study the advantage of multi-task learning on our proposed approach, we trained M-NSRF only on document ranking task (noted as NSRF in Table 1) and observed significant performance drop which endorses the mutual benefit of joint learning of these two tasks via multi-task learning.
162
+
163
+ Existing neural ranking models, like DRMM and DUET architecture, achieved sub-optimal performance in our experiments. We believe because of the simple architecture of DRMM with few hundreds of parameters, the model fell behind to show competitive performance on the evaluation dataset. On the other hand, we believe that the use of smaller number of top character $n$ -graphs (in our case, 5000) by the DUET architecture limits its effectiveness in modeling representation and interaction focused features to compute matching quality between query and document. We have to note that, some negative results have been reported for document title-based ad-hoc retrieval tasks (Guo et al., 2016a); and thus in our future work, we plan to investigate M-NSRF and all baseline models’ performance with document body content considered.
164
+
165
+ Table 2: Examples of next query suggested by M-NSRF given all previous queries in a session.
166
+
167
+ <table><tr><td>Previous session queries Next user query Suggested next query</td><td>types of weapons of mass destruction, weapons of mass destruc- tion, nuclear weapons biological weapons destructive nuclear weapons</td></tr><tr><td>Previous session queries Next user query Suggested next query</td><td>resume template,resume template free,resume word perfect template free, wordperfect com wordperfect resume templates free free microsoft word templates</td></tr></table>
168
+
169
+ Table 3: Comparison of different query suggestion models.
170
+
171
+ <table><tr><td rowspan=2 colspan=1>Model Name</td><td rowspan=1 colspan=4>BLEU</td><td rowspan=2 colspan=1>MRR²</td></tr><tr><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></tr><tr><td rowspan=1 colspan=1>Seq2seq</td><td rowspan=1 colspan=1>24.5</td><td rowspan=1 colspan=1>9.7</td><td rowspan=1 colspan=1>4.5</td><td rowspan=1 colspan=1>1.9</td><td rowspan=1 colspan=1>0.229</td></tr><tr><td rowspan=1 colspan=1>Seq2seq with attention</td><td rowspan=1 colspan=1>28.1</td><td rowspan=1 colspan=1>15.7</td><td rowspan=1 colspan=1>10.4</td><td rowspan=1 colspan=1>8.5</td><td rowspan=1 colspan=1>0.252</td></tr><tr><td rowspan=1 colspan=1>HRED-qsHRED-qs w/ entropy regularizer</td><td rowspan=1 colspan=1>26.427.6</td><td rowspan=1 colspan=1>13.615.1</td><td rowspan=1 colspan=1>7.99.2</td><td rowspan=1 colspan=1>5.86.7</td><td rowspan=1 colspan=1>0.2310.233</td></tr><tr><td rowspan=2 colspan=1>M-NSRFM-NSRF w/ entropy regularizer</td><td rowspan=2 colspan=1>26.828.6</td><td rowspan=1 colspan=1>14.1</td><td rowspan=1 colspan=1>8.4</td><td rowspan=1 colspan=1>6.1</td><td rowspan=2 colspan=1>0.2350.238</td></tr><tr><td rowspan=1 colspan=1>16.7</td><td rowspan=1 colspan=1>10.2</td><td rowspan=1 colspan=1>8.3</td></tr></table>
172
+
173
+ Query Suggestion Accuracy. Examples of the predicted queries by M-NSRF given preceding queries from the same session is presented in Table 2 (more examples are provided in Appendix E). The quantitative comparison results in this task between our proposed framework and baseline models are presented in Table 3. While M-NSRF and HRED-qs consider information from all preceding queries in the same session, the other two baselines only consider the current query to predict the next one. Table 3 shows that M-NSRF outperformed seq2seq and HRED-qs baselines in all measured BLUE scores, and MRR; but the Seq2seq with attention baseline performed better than M-NSRF in terms of BLEU-3, BLEU-4 and $\mathbf { M R R } ^ { 3 }$ .
174
+
175
+ We investigated the advantage of attention mechanism in this particular task and found it performs well when there is a considerable overlap between the input and output queries. Specifically, in more than $2 5 \%$ of the test sessions, the input queries and their next queries are exactly the same; and the attention mechanism encourages the model to repeat words from the input query. When we restrict the experiment on test sessions that have no overlap between the input and its next query, the Seq2seq with attention baseline encountered significant performance drop, while M-NSRF provided improved performance compared to all baselines (approx. $5 \%$ , $10 \%$ and $1 \%$ improvement in terms of MRR over Seq2seq, Seq2seq with attention and HRED-qs model). The major reason for this improvement is that our model leverages the global session information and is therefore not restricted by the input query and is able to generate related but totally new queries (as shown in Appendix E).
176
+
177
+ We also observed that entropy-based regularization helped M-NSRF in predicting the next query, as shown in Table 3 that M-NSRF without regularization achieved worse performance in all measured BLUE scores. We further investigated the utility of regularization for the baselines. We found significant $( \sim 1 . 2 \% )$ improvement for the HRED-qs, but the performance improvement for the seq2seq and seq2seq with attention mechanism is rather marginal $( \sim 0 . 2 \% )$ . However, the regularization technique does not introduce any significant difference to the ranking based evaluation.
178
+
179
+ Table 4: Ablation study for performance analysis of M-NSRF. Statistical significances are compared with NSRF’s full model and presented in bold-faced. $\dagger$ indicates M-NSRF is trained to learn word embeddings, no pre-trained embeddings were used.
180
+
181
+ <table><tr><td rowspan=1 colspan=1>NSRF Variant</td><td rowspan=1 colspan=1>MAP</td><td rowspan=1 colspan=1>NDCG@1</td><td rowspan=1 colspan=1>NDCG@3</td><td rowspan=1 colspan=1>NDCG@10</td></tr><tr><td rowspan=1 colspan=1>Full model</td><td rowspan=1 colspan=1>0.581</td><td rowspan=1 colspan=1>0.523</td><td rowspan=1 colspan=1>0.568</td><td rowspan=1 colspan=1>0.614</td></tr><tr><td rowspan=2 colspan=1>Fixed embeddingsLearned embeddingst</td><td rowspan=1 colspan=1>0.252 (-0.329)</td><td rowspan=1 colspan=1>0.182 (-0.341)</td><td rowspan=1 colspan=1>0.216(-0.352)</td><td rowspan=1 colspan=1>0.289(-0.325)</td></tr><tr><td rowspan=1 colspan=1>0.302 (-0.279)</td><td rowspan=1 colspan=1>0.222 (-0.301)</td><td rowspan=1 colspan=1>0.261(-0.307)</td><td rowspan=1 colspan=1>0.297 (-0.317)</td></tr><tr><td rowspan=1 colspan=1>Mean-poolBiLSTM-last</td><td rowspan=1 colspan=1>0.576(-0.005)0.563 (-0.018)</td><td rowspan=1 colspan=1>0.515 (-0.008)0.505 (-0.018)</td><td rowspan=1 colspan=1>0.561(-0.007)0.541(-0.027)</td><td rowspan=1 colspan=1>0.608(-0.006)0.594(-0.020)</td></tr><tr><td rowspan=1 colspan=1>M-NRF</td><td rowspan=1 colspan=1>0.553 (-0.028)</td><td rowspan=1 colspan=1>0.494 (-0.029)</td><td rowspan=1 colspan=1>0.544 (-0.024)</td><td rowspan=1 colspan=1>0.582 (-0.032)</td></tr><tr><td rowspan=1 colspan=1>GloVe 6B 50dGloVe 6B 100dGloVe 6B 200d</td><td rowspan=1 colspan=1>0.247 (-0.324)0.312 (-0.269)0.378 (-0.203)</td><td rowspan=1 colspan=1>0.196(-0.329)0.241 (-0.282)0.356(-0.167)</td><td rowspan=1 colspan=1>0.232 (-0.336)0.273 (-0.295)0.447 (-0.121)</td><td rowspan=1 colspan=1>0.296(-0.348)0.306(-0.308)0.498 (-0.116)</td></tr><tr><td rowspan=2 colspan=1>Q128D256S512Q512D1024S2048</td><td rowspan=2 colspan=1>0.562 (-0.019)0.586 (+0.005)</td><td rowspan=1 colspan=1>0.507 (-0.016)</td><td rowspan=1 colspan=1>0.544 (-0.024)</td><td rowspan=1 colspan=1>0.582 (-0.032)</td></tr><tr><td rowspan=1 colspan=1>0.528 (+0.005)</td><td rowspan=1 colspan=1>0.571 (+0.003)</td><td rowspan=1 colspan=1>0.617 (+0.003)</td></tr></table>
182
+
183
+ Comparing to HRED-qs, we conclude multi-task learning also helps M-NSRF achieve improved performance in query suggestion task, as the baseline employs a very similar model as ours for query suggestion. The comparison with Seq2seq with attention suggests adding attention over session information is a promising direction to further improve query suggestions quality as it emphasizes the information carried by the immediately previous query. We will pursue this in our future work.
184
+
185
+ # 4.4 ABLATION STUDY ON M-NSRF
186
+
187
+ We conducted experiments to better understand the effectiveness of different components in the MNSRF. We also analyzed the impact of word embeddings and hidden units dimension in M-NSRF’s performance. Our findings are presented in Table 4.
188
+
189
+ Impact of Different Model Components. To study the effect of different model components, we compared the full M-NSRF with several simpler versions of the model. At first, we turned off training for word embeddings and found a significant decrease in performance. In our training dataset, we have roughly $\vert O O V \vert = 2 6 k$ out-of-vocabulary words and thus, training the word embeddings turned out to be very important on this data set. Also, we investigated the role of pre-trained word embeddings (ex., GloVe embeddings) and found significant performance decrease $( 2 7 . 9 \%$ drop in MAP) if we train M-NSRF without any pre-trained word embeddings. Hence, we can conclude that the use of pre-trained word embeddings and training them further is important to achieve better performance in M-NSRF. Second, we investigated the advantages of using max-pooling over mean-pooling and considering the last hidden recurrent state for query and document representation. We observed that max-pooling and mean-pooling provide almost the same performance while biLSTM-last approach lags slightly. To further analyze the features identified by the query and document encoders using the max-pooling technique, we followed the idea of visualization proposed in (Conneau et al., 2017). We provide an example in Figure 2 where document $^ { l }$ is clicked by the user (a positive example) and document 2, 3 is retrieved by BM25 but not clicked (negative examples). We observed that the query and document encoders identified distinct features (e.g., the word priceline in the first document’s title is most important) which help differentiate between clicked and unclicked documents.
190
+
191
+ In another variant of M-NSRF, we did not use the session recurrent state when computing relevance score for the candidate documents to examine the influence of previous queries from the same session on the ranking performance. We refer to this variant of M-NSRF as multi-task neural relevance model (M-NRF). From Table 4 we can find that without session information the performance drops by $2 . 8 \%$ in terms of MAP. We further investigated and found the session information helps particularly for longer sessions (session length $> 5$ ). In our evaluation dataset, we have roughly 5000 sessions of length greater than 5 (91 thousands in total).
192
+
193
+ Impact of Dimensionality. We further study the impact of dimensionality of the word embeddings, query, document and session latent vectors. In M-NSRF, we set the dimension of query, document and session latent vectors to 256, 512 and 1024 respectively. As shown in Table 4, decreasing the dimensions of latent vectors, decreases the performance; while increasing the dimensions further, does not affect the performance significantly. We also experimented with different dimensions of pre-trained word embeddings (50d, 100d and 200d GloVe (Pennington et al., 2014) embeddings). Word embeddings of different dimensions provide different granularity of semantic similarity; with lower dimensionality, the similarity between word embeddings might be coarse and thus hard to capture matching between two text sequences. In our experiment, we found 300 dimension for embeddings works significantly better than other dimensionality on this data set.
194
+
195
+ ![](images/4792b6954c35a387bbd976dc8f77d0b640e5d417b101e7d7027427a8517f7987.jpg)
196
+ Figure 2: Example showing query and document term importance identified by M-NSRF while ranking candidate documents for the given query.
197
+
198
+ # 5 CONCLUSIONS
199
+
200
+ Existing deep neural models for ad-hoc retrieval often omit session information and are only trained on individual query-document pairs. In this work, we propose a context-aware multi-task neural session relevance framework which works in a sequence to sequence fashion, and show that sharing session-level latent recurrent states across document ranking and query suggestion tasks benefits each other. Our experiments and analysis not only demonstrate the effectiveness of the proposed framework, but also provide useful intuitions about the advantages of multi-task learning involving deep neural networks for two different information retrieval tasks.
201
+
202
+ As our future work, we would like to leverage the content from document body and click sequence to update M-NSRF (especially the session-level recurrent states) so that we can further explore the potential of the proposed framework for ad-hoc retrieval. As attention mechanism shows promise in improving query suggestion performance, we also also explore it in our multi-task learning setting. In addition, a broad research direction is to go beyond session boundaries to model users’ long-term search goals to enhance personalized search results and query suggestions.
203
+
204
+ Acknowledgement. This work was supported in part by National Science Foundation Grant IIS1760523, IIS-1553568, IIS-1618948, and the NVIDIA Hardware Grant.
205
+
206
+ # REFERENCES
207
+
208
+ Ricardo A Baeza-Yates, Carlos A Hurtado, Marcelo Mendoza, et al. Query recommendation using query logs in search engines. In EDBT workshops, volume 3268, pp. 588–596. Springer, 2004.
209
+
210
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. International Conference on Learning Representations, 2015.
211
+
212
+ Jing Bai, Ke Zhou, Guirong Xue, Hongyuan Zha, Gordon Sun, Belle Tseng, Zhaohui Zheng, and Yi Chang. Multi-task learning for learning to rank in web search. In Proceedings of the 18th ACM International on Conference on Information and Knowledge Management, pp. 1549–1552. ACM, 2009.
213
+
214
+ Huanhuan Cao, Daxin Jiang, Jian Pei, Qi He, Zhen Liao, Enhong Chen, and Hang Li. Context-aware query suggestion by mining click-through and session data. In Proceedings of the 14th ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 875–883. ACM, 2008.
215
+
216
+ Rich Caruana. Multitask learning. In Learning to learn, pp. 95–133. Springer, 1998.
217
+
218
+ Wanyu Chen, Fei Cai, Honghui Chen, and Maarten de Rijke. Personalized query suggestion diversification. Proceedings of the 37th ACM SIGIR conference on Research and development in information retrieval, 2017.
219
+
220
+ Ronan Collobert and Jason Weston. A unified architecture for natural language processing: Deep neural networks with multitask learning. In Proceedings of the 25th international conference on Machine learning, pp. 160–167. ACM, 2008.
221
+
222
+ Alexis Conneau, Douwe Kiela, Holger Schwenk, Lo¨ıc Barrault, and Antoine Bordes. Supervised learning of universal sentence representations from natural language inference data. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pp. 670–680. Association for Computational Linguistics, 2017.
223
+
224
+ W Bruce Croft, Donald Metzler, and Trevor Strohman. Search engines: Information retrieval in practice, volume 283. Addison-Wesley Reading, 2010.
225
+
226
+ Li Deng, Geoffrey Hinton, and Brian Kingsbury. New types of deep neural network learning for speech recognition and related applications: An overview. In Acoustics, Speech and Signal Processing (ICASSP), 2013 IEEE International Conference on, pp. 8599–8603. IEEE, 2013.
227
+
228
+ Henry Feild and James Allan. Task-aware query recommendation. In Proceedings of the 36th ACM SIGIR conference on Research and development in information retrieval, pp. 83–92. ACM, 2013.
229
+
230
+ Jianfeng Gao, Li Deng, Michael Gamon, Xiaodong He, and Patrick Pantel. Modeling interestingness with deep neural networks, June 13 2014. US Patent App. 14/304,863.
231
+
232
+ Dario Garigliotti and Krisztian Balog. Generating query suggestions to support task-based search. In Proceedings of the 40th ACM SIGIR conference on Research and development in information retrieval, pp. 1153–1156. ACM, 2017.
233
+
234
+ Ross Girshick. Fast r-cnn. In Proceedings of the IEEE international conference on computer vision, pp. 1440– 1448, 2015.
235
+
236
+ Jiafeng Guo, Yixing Fan, Qingyao Ai, and W Bruce Croft. A deep relevance matching model for ad-hoc retrieval. In Proceedings of the 25th ACM International on Conference on Information and Knowledge Management, pp. 55–64. ACM, 2016a.
237
+
238
+ Jiafeng Guo, Yixing Fan, Qingyao Ai, and W Bruce Croft. Semantic matching by non-linear word transportation for information retrieval. In Proceedings of the 25th ACM International on Conference on Information and Knowledge Management, pp. 701–710. ACM, 2016b.
239
+
240
+ Qi He, Daxin Jiang, Zhen Liao, Steven CH Hoi, Kuiyu Chang, Ee-Peng Lim, and Hang Li. Web query recommendation via sequential query prediction. In Data Engineering, 2009. ICDE’09. IEEE 25th International Conference on, pp. 1443–1454. IEEE, 2009.
241
+
242
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8):1735–1780, 1997.
243
+
244
+ 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, pp. 2042– 2050, 2014.
245
+
246
+ Po-Sen Huang, Xiaodong He, Jianfeng Gao, Li Deng, Alex Acero, and Larry Heck. Learning deep structured semantic models for web search using clickthrough data. Proceedings of the 22nd ACM International on Conference on Information and Knowledge Management, pp. 2333–2338, 2013.
247
+
248
+ Aaron Jaech, Hetunandan Kamisetty, Eric Ringger, and Charlie Clarke. Match-tensor: a deep relevance model for search. arXiv preprint arXiv:1701.07795, 2017.
249
+
250
+ J Jansen Bernard, Amanda Spink, Chris Blakely, and Sherry Koshman. Defining a session on web search engines: Research articles. Journal of the American Society for Information Science and Technology, 58(6): 862–871, 2007.
251
+
252
+ Jyun-Yu Jiang, Yen-Yu Ke, Pao-Yu Chien, and Pu-Jen Cheng. Learning user reformulation behavior for query auto-completion. In Proceedings of the 37th ACM SIGIR conference on Research and development in information retrieval, pp. 445–454. ACM, 2014.
253
+
254
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
255
+
256
+ Steve Lawrence, C Lee Giles, Ah Chung Tsoi, and Andrew D Back. Face recognition: A convolutional neuralnetwork approach. IEEE transactions on neural networks, 8(1):98–113, 1997.
257
+
258
+ Pengfei Liu, Xipeng Qiu, and Xuanjing Huang. Deep multi-task learning with shared memory for text classification. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pp. 118–127, 2016a.
259
+
260
+ Pengfei Liu, Xipeng Qiu, and Xuanjing Huang. Recurrent neural network for text classification with multi-task learning. Proceedings of the Twenty-Fifth International Joint Conference on Artificial Intelligence, 2016b.
261
+
262
+ Tie-Yan Liu et al. Learning to rank for information retrieval. Foundations and Trends $\textsuperscript { \textregistered }$ in Information Retrieval, 3(3):225–331, 2009.
263
+
264
+ Xiaodong Liu, Jianfeng Gao, Xiaodong He, Li Deng, Kevin Duh, and Ye-Yi Wang. Representation learning using multi-task deep neural networks for semantic classification and information retrieval. In Proceedings of the 2015 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 912–921, 2015.
265
+
266
+ Thang Luong, Hieu Pham, and Christopher D. Manning. Effective approaches to attention-based neural machine translation. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pp. 1412–1421, 2015.
267
+
268
+ Bhaskar Mitra and Nick Craswell. Query auto-completion for rare prefixes. In Proceedings of the 24th ACM International on Conference on Information and Knowledge Management, pp. 1755–1758. ACM, 2015.
269
+
270
+ Bhaskar Mitra, Eric Nalisnick, Nick Craswell, and Rich Caruana. A dual embedding space model for document ranking. arXiv preprint arXiv:1602.01137, 2016.
271
+
272
+ Bhaskar Mitra, Fernando Diaz, and Nick Craswell. Learning to match using local and distributed representations of text for web search. pp. 1291–1299. International World Wide Web Conferences Steering Committee, 2017.
273
+
274
+ Liang Pang, Yanyan Lan, Jiafeng Guo, Jun Xu, Shengxian Wan, and Xueqi Cheng. Text matching as image recognition. Association for the Advancement of Artificial Intelligence, pp. 2793–2799, 2016.
275
+
276
+ Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. Bleu: a method for automatic evaluation of machine translation. In Proceedings of the 40th annual meeting on association for computational linguistics, pp. 311–318. Association for Computational Linguistics, 2002.
277
+
278
+ Greg Pass, Abdur Chowdhury, and Cayley Torgeson. A picture of search. In InfoScale, volume 152, pp. 1, 2006.
279
+
280
+ Nanyun Peng and Mark Dredze. Multi-task domain adaptation for sequence tagging. In Proceedings of the 2nd Workshop on Representation Learning for NLP, pp. 91–100, 2017.
281
+
282
+ Nanyun Peng, Hoifung Poon, Chris Quirk, Kristina Toutanova, and Wen-tau Yih. Cross-sentence n-ary relation extraction with graph lstms. Transactions of the Association for Computational Linguistics, 5:101–115, 2017.
283
+
284
+ Jeffrey Pennington, Richard Socher, and Christopher Manning. Glove: Global vectors for word representation. Proceedings of the 2014 conference on empirical methods in natural language processing (EMNLP), pp. 1532–1543, 2014.
285
+
286
+ Jay M Ponte and W Bruce Croft. A language modeling approach to information retrieval. In Proceedings of the 21st ACM SIGIR conference on Research and development in information retrieval, pp. 275–281. ACM, 1998.
287
+
288
+ Stephen Robertson, Hugo Zaragoza, et al. The probabilistic relevance framework: Bm25 and beyond. Foundations and Trends $\textsuperscript { \textregistered }$ in Information Retrieval, 3(4):333–389, 2009.
289
+
290
+ Rodrygo LT Santos, Craig Macdonald, and Iadh Ounis. Learning to rank query suggestions for adhoc and diversity search. Information Retrieval, 16(4):429–451, 2013.
291
+
292
+ Yelong Shen, Xiaodong He, Jianfeng Gao, Li Deng, and Gregoire Mesnil. A latent semantic model with´ convolutional-pooling structure for information retrieval. In Proceedings of the 23rd ACM International on Conference on Information and Knowledge Management, pp. 101–110. ACM, 2014.
293
+
294
+ Alessandro Sordoni, Yoshua Bengio, Hossein Vahabi, Christina Lioma, Jakob Grue Simonsen, and Jian-Yun Nie. A hierarchical recurrent encoder-decoder for generative context-aware query suggestion. Proceedings of the 24th ACM International on Conference on Information and Knowledge Management, pp. 553–562, 2015.
295
+
296
+ 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.
297
+
298
+ 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.
299
+
300
+ Abhinav Thanda and Shankar M Venkatesan. Multi-task learning of deep neural networks for audio visual automatic speech recognition. arXiv preprint arXiv:1701.02477, 2017.
301
+
302
+ Ji-Rong Wen, Jian-Yun Nie, and Hong-Jiang Zhang. Clustering user queries of a search engine. In Proceedings of the 10th international conference on World Wide Web, pp. 162–168. acm, 2001.
303
+
304
+ # A MULTITASK NEURAL SESSION RELEVANCE FRAMEWORK
305
+
306
+ ![](images/83c46148e4e6af4c9d203864f201eaf5920e678a89b0c13d367bcdc4a99f8beb.jpg)
307
+ Figure 3: Architecture of the Multi-task Neural Session Relevance Framework (M-NSRF). M-NSRF uses bi-LSTM with max pooling to form query and document representations and use LSTM to gather session-level information. These recurrent states (current query representation and sessionlevel recurrent state, which summarizes all previous queries) are used by query decoder and document ranker for predicting next query and computing relevance scores.
308
+
309
+ # B MULTITASK MATCH-TENSOR ARCHITECTURE
310
+
311
+ ![](images/fd777dc795cce8647616e23db141d0ddd6ab1bc7d9e4204093caf79b2101c00e.jpg)
312
+ Figure 4: Architecture of the Multi-task Match-Tensor Model (M-Match-Tensor).
313
+
314
+ # C DOCUMENT RANKING BASELINES
315
+
316
+ Deep semantic similarity model, DSSM (Huang et al., 2013) maps words to letter tri-grams using a word-hashing technique and uses a feed-forward neural network to build representations for both query and document. Similarity, convolutional latent semantic model, CLSM (Shen et al., 2014) uses word-hashing technique and uses convolutional neural networks (CNN) to build query and document representations. To compute relevance between query and document, both DSSM and
317
+
318
+ CLSM uses cosine similarity. ARC-I (Hu et al., 2014) uses CNN to form query and document representations and employs a multi-layer perceptron to compute relevance score. In our implementation, we used 128 convolution filters of size 1, 2 and 256 filters of size 3.
319
+
320
+ ARC-II (Hu et al., 2014) was proposed by focusing on learning hierarchical matching patterns from local interactions using a CNN. To keep the ARC-II model simple, we use two layers of 2d convolution and max-pooling each and two-layer feed forward neural network to compute relevance score. DRMM (Guo et al., 2016a) aims to perform term matching over histogram-based features ignoring the actual position of matches. In DRMM, histogram-based features are computed using exact term matching and pretrained word embeddings based cosine similarities. In principal, the histogram counts the number of word pairs at different similarity levels. The counts are combined by a feed forward network to produce final ranking scores.
321
+
322
+ The DUET (Mitra et al., 2017) model composed of a local and distributed model where the distributed model projects the query and the document text into an embedding space before matching, while the local model operates over an interaction matrix comparing every query term to every document term. Similarly, Match-Tensor (Jaech et al., 2017) model incorporates both immediate and larger contexts in a given document when comparing document to a query.
323
+
324
+ # D QUERY SUGGESTION BASELINES
325
+
326
+ Seq2seq model proposed by Bahdanau et al. (2015) is a general neural network architecture that can be applied to the task where both input and output consist of a sequence of tokens. This method have been shown successful in machine translation and sequential tagging. Because different input tokens may contribute to each output token differently, attention mechanism which learns a weight between each input-output token pair can further improve the Seq2seq model. In this paper, we consider a Seq2seq with global attention method proposed by Luong et al. (2015), which is suitable for short text such as web queries. HRED-qs suggested by Sordoni et al. (2015) is very close to our work which proposed to use a hierarhical recurrent encoder-decoder approach by considering session information for context-aware query suggestion.
327
+
328
+ # E MORE EXAMPLES OF QUERY SUGGESTION BY M-NSRF
329
+
330
+ <table><tr><td rowspan=1 colspan=1>Previous session queriesNext user querySuggested next query</td><td rowspan=1 colspan=1>discount pet supplies, homes for rent smyrna georgiahomes for rent atlanta georgiapet friendly rentals in georgia</td></tr><tr><td rowspan=1 colspan=1>Previous session queriesNext user querySuggested next query</td><td rowspan=1 colspan=1>language aptitude test, foreign language aptitude testamerican idolamerican language association</td></tr><tr><td rowspan=1 colspan=1>Previous session queriesNext user query Suggested next query</td><td rowspan=1 colspan=1>saturday night fever, saturday night fever nj bandnew jersey cover bandsaturday night live</td></tr><tr><td rowspan=1 colspan=1>Previous session queriesNext user querySuggested next query</td><td rowspan=1 colspan=1>pregnancy, abortion, abortion clinicstampa abortionabortionclinics in florida</td></tr><tr><td rowspan=1 colspan=1>Previous session queriesNext user querySuggested next query</td><td rowspan=1 colspan=1> ncaa basketball, ncaa basketball trees, ncaa mens basketball bracket,sportscentermens ncaa basketball oddsespn</td></tr><tr><td rowspan=1 colspan=1>Previous session queriesNext user querySuggested next query</td><td rowspan=1 colspan=1>childhood autism rating scale, childhood autism rating scale free,autism screening questionnairepervasive developmental disorderhow to do questionnaire</td></tr></table>
md/train/SJgwzCEKwH/SJgwzCEKwH.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/SJlpYJBKvH/SJlpYJBKvH.md ADDED
@@ -0,0 +1,401 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MEASURING THE RELIABILITY OF REINFORCEMENT LEARNING ALGORITHMS
2
+
3
+ Stephanie C.Y. Chan,1∗ Samuel Fishman,1 John Canny,1, 2 Anoop Korattikara,1
4
+ & Sergio Guadarrama1
5
+ 1Google Research 2Berkeley EECS
6
+ {scychan,sfishman,canny,kbanoop,sguada}@google.com
7
+
8
+ # ABSTRACT
9
+
10
+ Lack of reliability is a well-known issue for reinforcement learning (RL) algorithms. This problem has gained increasing attention in recent years, and efforts to improve it have grown substantially. To aid RL researchers and production users with the evaluation and improvement of reliability, we propose a set of metrics that quantitatively measure different aspects of reliability. In this work, we focus on variability and risk, both during training and after learning (on a fixed policy). We designed these metrics to be general-purpose, and we also designed complementary statistical tests to enable rigorous comparisons on these metrics. In this paper, we first describe the desired properties of the metrics and their design, the aspects of reliability that they measure, and their applicability to different scenarios. We then describe the statistical tests and make additional practical recommendations for reporting results. The metrics and accompanying statistical tools have been made available as an open-source library.1 We apply our metrics to a set of common RL algorithms and environments, compare them, and analyze the results.
11
+
12
+ # 1 INTRODUCTION
13
+
14
+ Reinforcement learning (RL) algorithms, especially Deep RL algorithms, tend to be highly variable in performance and considerably sensitive to a range of different factors, including implementation details, hyper-parameters, choice of environments, and even random seeds (Henderson et al., 2017). This variability hinders reproducible research, and can be costly or even dangerous for real-world applications. Furthermore, it impedes scientific progress in the field when practitioners cannot reliably evaluate or predict the performance of any particular algorithm, compare different algorithms, or even compare different implementations of the same algorithm.
15
+
16
+ Recently, Henderson et al. (2017) has performed a detailed analysis of reliability for several policy gradient algorithms, while Duan et al. (2016) has benchmarked average performance of different continuous-control algorithms. In other related work, Colas et al. (2018) have provided a detailed analysis on power analyses for mean performance in RL, and Colas et al. (2019) provide a comprehensive primer on statistical testing for mean and median performance in RL.
17
+
18
+ In this work, we aim to devise a set of metrics that measure reliability of RL algorithms. Our analysis distinguishes between several typical modes to evaluate RL performance: "evaluation during training", which is computed over the course of training, vs. "evaluation after learning", which is evaluated on a fixed policy after it has been trained. These metrics are also designed to measure different aspects of reliability, e.g. reproducibility (variability across training runs and variability across rollouts of a fixed policy) or stability (variability within training runs). Additionally, the metrics capture multiple aspects of variability – dispersion (the width of a distribution), and risk (the heaviness and extremity of the lower tail of a distribution).
19
+
20
+ Standardized measures of reliability can benefit the field of RL by allowing RL practitioners to compare algorithms in a rigorous and consistent way. This in turn allows the field to measure progress, and also informs the selection of algorithms for both research and production environments. By measuring various aspects of reliability, we can also identify particular strengths and weaknesses of algorithms, allowing users to pinpoint specific areas of improvement.
21
+
22
+ In this paper, in addition to describing these reliability metrics, we also present practical recommendations for statistical tests to compare metric results and how to report the results more generally. As examples, we apply these metrics to a set of algorithms and environments (discrete and continuous, off-policy and on-policy). We have released the code used in this paper as an open-source Python package to ease the adoption of these metrics and their complementary statistics.
23
+
24
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Dispersion (D)</td><td rowspan=1 colspan=1>Risk (R)</td></tr><tr><td rowspan=2 colspan=1>DUURNNTTIIINNN</td><td rowspan=1 colspan=1>Across Time (T)(within trainingruns)</td><td rowspan=1 colspan=1>IQR* within windows,afterdetrending</td><td rowspan=1 colspan=1>Short-term: CVaR† onfirst-order differencesLong-term: CVaR† onDrawdown</td></tr><tr><td rowspan=1 colspan=1>Across Runs (R)</td><td rowspan=1 colspan=1>IQR* across training runs,after low-pass filtering.</td><td rowspan=1 colspan=1>CVaR† across runs</td></tr><tr><td rowspan=1 colspan=1>LIIANINNTIEEH</td><td rowspan=1 colspan=1>Across rollouts ona Fixed Policy (F)</td><td rowspan=1 colspan=1>IQR* across rollouts for afixed policy</td><td rowspan=1 colspan=1>CVaR† across rollouts for afixed policy</td></tr></table>
25
+
26
+ Table 1: Summary of our proposed reliability metrics. For evaluation DURING TRAINING, which measures reliability over the course of training an algorithm, the inputs to the metrics are the performance curves of an algorithm, evaluated at regular intervals during a single training run (or on a set of training runs). For evaluation AFTER LEARNING, which measures reliability of an alreadytrained policy, the inputs to the metrics are the performance scores of a set of rollouts of that fixed policy. $^ { * } \mathrm { I Q R }$ : inter-quartile range. ${ \dag } \mathrm { C V a R }$ : conditional value at risk.
27
+
28
+ # 2 RELIABILITY METRICS
29
+
30
+ We target three different axes of variability, and two different measures of variability along each axis. We denote each of these by a letter, and each metric as a combination of an axis $^ +$ a measure, e.g. "DR" for "Dispersion Across Runs". See Table 1 for a summary. Please see Appendix A for more detailed definitions of the terms used here.
31
+
32
+ # 2.1 AXES OF VARIABILITY
33
+
34
+ Our metrics target the following three axes of variability. The first two capture reliability "during training", while the last captures reliability of a fixed policy "after learning".
35
+
36
+ During training: Across Time (T) In the setting of evaluation during training, one desirable property for an RL algorithm is to be stable "across time" within each training run. In general, smooth monotonic improvement is preferable to noisy fluctuations around a positive trend, or unpredictable swings in performance.
37
+
38
+ This type of stability is important for several reasons. During learning, especially when deployed for real applications, it can be costly or even dangerous for an algorithm to have unpredictable levels of performance. Even in cases where bouts of poor performance do not directly cause harm, e.g. if training in simulation, high instability implies that algorithms have to be check-pointed and evaluated more frequently in order to catch the peak performance of the algorithm, which can be expensive. Furthermore, while training, it can be a waste of computational resources to train an unstable algorithm that tends to forget previously learned behaviors.
39
+
40
+ During training: Across Runs (R) During training, RL algorithms should have easily and consistently reproducible performances across multiple training runs. Depending on the components that we allow to vary across training runs, this variability can encapsulate the algorithm’s sensitivity to a variety of factors, such as: random seed and initialization of the optimization, random seed and initialization of the environment, implementation details, and hyper-parameter settings. Depending on the goals of the analysis, these factors can be held constant or allowed to vary, in order to disentangle the contribution of each factor to variability in training performance. High variability on any of these dimensions leads to unpredictable performance, and also requires a large search in order to find a model with good performance.
41
+
42
+ After learning: Across rollouts of a fixed policy (F) When evaluating a fixed policy, a natural concern is the variability in performance across multiple rollouts of that fixed policy. Each rollout may be specified e.g. in terms of a number of actions, environment steps, or episodes. Generally, this metric measures sensitivity to both stochasticity from the environment and stochasticity from the training procedure (the optimization). Practitioners may sometimes wish to keep one or the other constant if it is important to disentangle the two factors (e.g. holding constant the random seed of the environment while allowing the random seed controlling optimization to vary across rollouts).
43
+
44
+ # 2.2 MEASURES OF VARIABILITY
45
+
46
+ For each axis of variability, we have two kinds of measures: dispersion and risk.
47
+
48
+ Dispersion Dispersion is the width of the distribution. To measure dispersion, we use "robust statistics" such as the Inter-quartile range (IQR) (i.e. the difference between the 75th and 25th percentiles) and the Median absolute deviation from the median (MAD), which are more robust statistics and don’t require assuming normality of the distributions. 2 We prefer to use IQR over MAD, because it is more appropriate for asymmetric distributions (Rousseeuw & Croux, 1993).
49
+
50
+ Risk In many cases, we are concerned about the worst-case scenarios. Therefore, we define risk as the heaviness and extent of the lower tail of the distribution. This is complementary to measures of dispersion like IQR, which cuts off the tails of the distribution. To measure risk, we use the Conditional Value at Risk (CVaR), also known as “expected shortfall". CVaR measures the expected loss in the worst-case scenarios, defined by some quantile $\alpha$ . It is computed as the expected value in the left-most tail of a distribution (Acerbi & Tasche, 2002). We use the following definition for the CVaR of a random variable $X$ for a given quantile $\alpha$ :
51
+
52
+ $$
53
+ \mathrm { C V a R } _ { \alpha } ( X ) = \operatorname { \mathbb { E } } \left[ X | X \leq V a R _ { \alpha } ( X ) \right]
54
+ $$
55
+
56
+ where $\alpha \in ( 0 , 1 )$ and the $V a R _ { \alpha }$ (Value at Risk) is just the $\alpha$ -quantile of the distribution of $X$ . Originally developed in finance, CVaR has also seen recent adoption in Safe RL as an additional component of the objective function by applying it to the cumulative returns within an episode, e.g. Bäuerle & Ott (2011); Chow & Ghavamzadeh (2014); Tamar et al. (2015). In this work, we apply CVaR to the dimensions of reliability described in Section 2.1.
57
+
58
+ # 2.3 DESIDERATA
59
+
60
+ In designing our metrics and statistical tests, we required that they fulfill the following criteria:
61
+
62
+ • A minimal number of configuration parameters – to facilitate standardization as well as to minimize “researcher degrees of freedom" (where flexibility may allow users to tune settings to produce more favorable results, leading to an inflated rate of false positives) (Simmons et al., 2011). • Robust statistics, when possible. Robust statistics are less sensitive to outliers and have more reliable performance for a wider range of distributions. Robust statistics are especially important when applied to training performance, which tends to be highly non-Gaussian, making metrics such as variance and standard deviation inappropriate. For example, training performance is often bi-modal, with a concentration of points near the starting level and another concentration at the level of asymptotic performance.
63
+
64
+ • Invariance to sampling frequency – results should not be biased by the frequency at which an algorithm was evaluated during training. See Section 2.5 for further discussion.
65
+
66
+ • Enable meaningful statistical comparisons on the metrics, while making minimal assumptions about the distribution of the results. We thus designed statistical procedures that are non-parametric (Section 4).
67
+
68
+ # OpenAI Gym -- During Training
69
+
70
+ ![](images/8622396b34b55c3757bd48070b2e4afc29379a1358f8c5009ffb3f46074ccc82.jpg)
71
+ Figure 1: Reliability metrics and median performance for continuous control RL algorithms (DDPG, TD3, SAC, REINFORCE, and PPO) tested on OpenAI Gym environments. Rank 1 always indicates "best" reliability, e.g. lowest IQR across runs. Error bars are $9 5 \%$ bootstrap confidence intervals (# bootstraps $= 1 { , } 0 0 0 \rangle$ ). Significant pairwise differences in ranking between pairs of algorithms are indicated by black horizontal lines above the colored bars. ( $\langle \alpha = 0 . 0 5$ with Benjamini-Yekutieli correction, permutation test with # permutations $= 1 { , } 0 0 0 $ ). Note that the best algorithms by median performance are not always the best algorithms on reliability.
72
+
73
+ # 2.4 METRIC DEFINITIONS
74
+
75
+ Dispersion across Time (DT): IQR across Time To measure dispersion across time (DT), we wished to isolate higher-frequency variability, rather than capturing longer-term trends. We did not want our metrics to be influenced by positive trends of improvement during training, which are in fact desirable sources of variation in the training performance. Therefore, we apply detrending before computing dispersion metrics. For detrending, we used differencing (i.e. $y _ { t } \prime = y _ { t } - y _ { t - 1 } )$ .3 The final measure consisted of inter-quartile range (IQR) within a sliding window along the detrended training curve.
76
+
77
+ ![](images/c0f6add0daab1e92929de06c0d271ddac8d145b41450b22d233810e7f438292d.jpg)
78
+ Figure 2: Reliability metrics and median performance for four DQN-variants (C51, DQN: Deep Q-network, IQ: Implicit Quantiles, and RBW: Rainbow) tested on 60 Atari games. Rank 1 always indicates "best" reliability, e.g. lowest IQR across runs. Significant pairwise differences in ranking between pairs of algorithms are indicated by black lines above the colored circles. $\alpha = 0 . 0 5$ with Benjamini-Yekutieli correction, permutation test with # permutations $= 1 { , } 0 0 0 $ ). Note that the best algorithms by median performance are not always the best algorithms on reliability. Error bars are $9 5 \%$ bootstrap confidence intervals (# bootstraps $= 1 { , } 0 0 0 $ ).
79
+
80
+ Short-term Risk across Time (SRT): CVaR on Differences For this measure, we wish to measure the most extreme short-term drop over time. To do this, we apply CVaR to the changes in performance from one evaluation point to the next. I.e., in Eq. 1, $X$ represents the differences from one evaluation time-point to the next. We first compute the time-point to time-point differences on each training run. These differences are normalized by the distance between time-points, to ensure invariance to evaluation frequency (see Section 2.5). Then, we obtain the distribution of these differences, and find the $\alpha$ -quantile. Finally, we compute the expected value of the distribution below the $\alpha$ -quantile. This gives us the worst-case expected drop in performance during training, from one point of evaluation to the next.
81
+
82
+ Long-term Risk across Time (LRT): CVaR on Drawdown For this measure, we would also like to be able to capture whether an algorithm has the potential to lose a lot of performance relative to its peak, even if on a longer timescale, e.g. over an accumulation of small drops. For this measure, we apply CVaR to the Drawdown. The Drawdown at time $T$ is the drop in performance relative to the highest peak so far, and is another measure borrowed from economics (Chekhlov et al., 2005). I.e. Drawdown $\mathbf { \Psi } _ { T } = R _ { T } - \operatorname* { m a x } _ { t < - T } R _ { t }$ . Like the SRT metric, the LRT can capture unusually large short-term drops in performance, but can also capture unusually large drops that occur over longer timescales.
83
+
84
+ Dispersion across Runs (DR): IQR across Runs Unlike the rest of the metrics described here, the dispersion across training runs has previously been used to characterize performance (e.g. Duan et al. (2016); Islam et al. (2017); Bellemare et al. (2017); Fortunato et al. (2017); Nagarajan et al. (2018)). This is usually measured by taking the variance or standard deviation across training runs at a set of evaluation points. We build on the existing practice by recommending first performing low-pass filtering of the training data, to filter out high-frequency variability within runs (this is instead measured using Dispersion across Time, DT). We also replace variance or standard deviation with robust statistics like IQR.
85
+
86
+ Risk across Runs (RR): CVaR across Runs In order to measure Risk across Runs (RR), we apply CVaR to the final performance of all the training runs. This gives a measure of the expected performance of the worst runs.
87
+
88
+ Dispersion across Fixed-Policy Rollouts (DF): IQR across Rollouts When evaluating a fixed policy, we are interested in variability in performance when the same policy is rolled out multiple times. To compute this metric, we simply compute the IQR on the performance of the rollouts.
89
+
90
+ Risk across Fixed-Policy Rollouts (RF): CVaR across Rollouts This metric is similar to DF, except that we apply CVaR on the rollout performances.
91
+
92
+ # 2.5 INVARIANCE TO FREQUENCY OF EVALUATION
93
+
94
+ Different experiments and different tasks may produce evaluations at different frequencies during training. Therefore, the reliability metrics should be unbiased by the choice of evaluation frequency. As long as there are no cyclical patterns in performance, the frequency of evaluation will not bias any of the metrics except Long-Term Risk across Time (LRT). For all other metrics, changes in the frequency of evaluation will simply lead to more or less noisy estimates of these metrics. For LRT, comparisons should only be made if the frequency of evaluation is held constant across experiments.
95
+
96
+ # 3 RECOMMENDATIONS FOR REPORTING METRICS AND PARAMETERS
97
+
98
+ Whether evaluating an algorithm for practical use or for research, we recommend evaluating all of the reliability metrics described above. Each metric measures a different aspect of reliability, and can help pinpoint specific strengths and weaknesses of the algorithm. Evaluating the metrics is easy with the open-source Python package that we have released.
99
+
100
+ Reporting parameters. Even given our purposeful efforts to minimize the number of parameters in the reliability metrics, a few remain to be specified by the user that can affect the results, namely: window size (for Dispersion across Time), frequency threshold for low-pass and high-pass filtering (Dispersion across Time, Dispersion across Runs), evaluation frequency (only for Long-term Risk across Time), and length of training runs. Therefore, when reporting these metrics, these parameters need to be clearly specified, and must also be held constant across experiments for meaningful comparisons. The same is true for any other parameters that affect evaluation, e.g., the number of roll-outs per evaluation, the parameters of the environment, whether on-line or off-line evaluation is used, and the random seeds chosen.
101
+
102
+ Collapsing across evaluation points. Some of the in-training reliability metrics (Dispersion across Runs, Risk across Runs, and Dispersion across Time) need to be evaluated at multiple evaluation points along the training runs. If it is useful to obtain a small number of values to summarize each metric, we recommend dividing the training run into "time frames" (e.g. beginning, middle, and end), and collapsing across all evaluation points within each time frame.
103
+
104
+ Normalization by performance. Different algorithms can have vastly different ranges of performance even on the same task, and variability in performance tends to scale with actual performance. Thus, we normalize our metrics in post-processing by a measure of the range of performance for each algorithm. For "during training" reliability, we recommend normalizing by the median range of performance, which we define as the $p _ { P _ { 9 } 5 } - p _ { t = 0 }$ , where $p _ { P { 5 } }$ is the 95th percentile and $p _ { t = 0 }$ is the starting performance. For "after learning" reliability, the range of performance may not be available, in which case we use the median performance directly.
105
+
106
+ Ranking the algorithms. Because different environments have different ranges and distributions of reward, we must be careful when aggregating across environments or comparing between environments. Thus, if the analysis involves more than one environment, the per-environment median results for the algorithms are first converted to rankings, by ranking all algorithms within each task. To summarize the performance of a single algorithm across multiple tasks, we compute the mean ranking across tasks.
107
+
108
+ Per-environment analysis. The same algorithm can have different patterns of reliability for different environments. Therefore, we recommend inspecting reliability metrics on a per-environment basis, as well as aggregating across environments as described above.
109
+
110
+ # 4 CONFIDENCE INTERVALS AND STATISTICAL SIGNIFICANCE TESTS FOR COMPARISON
111
+
112
+ # 4.1 CONFIDENCE INTERVALS
113
+
114
+ We assume that the metric values have been converted to mean rankings, as explained in Section 3. To obtain confidence intervals on the mean rankings for each algorithm, we apply bootstrap sampling on the runs, by resampling runs with replacement (Efron & Tibshirani, 1986).
115
+
116
+ For metrics that are evaluated per-run (e.g. Dispersion across Time), we can resample the metric values directly, and then recompute the mean rankings on each resampling to obtain a distribution over the rankings; this allow us to compute confidence intervals. For metrics that are evaluated across-runs, we need to resample the runs themselves, then evaluate the metrics on each resampling, before recomputing the mean rankings to obtain a distribution on the mean rankings.
117
+
118
+ # 4.2 SIGNIFICANCE TESTS FOR COMPARING ALGORITHMS
119
+
120
+ Commonly, we would like to compare algorithms evaluated on a fixed set of environments. To determine whether any two algorithms have statistically significant differences in their metric rankings, we perform an exact permutation test on each pair of algorithms. Such tests allow us to compute a $\mathsf { p }$ -value for the null hypothesis (probability that the methods are in fact indistinguishable on the reliability metric).
121
+
122
+ We designed our permutation tests based on the null hypothesis that runs are exchangeable across the two algorithms being compared. In brief, let $A$ and $B$ be sets of performance measurements for algorithms $a$ and $b$ . Let $M e t r i c ( X )$ be a reliability metric, e.g. the inter-quartile range across runs, computed on a set of measurements $X$ . MetricRanking $( X )$ is the mean ranking across tasks on $X$ , compared to the other algorithms being considered. We compute test statistic
123
+
124
+ $$
125
+ s _ { M e t r i c R a n k i n g } ( A , B ) = M e t r i c R a n k i n g ( A ) - M e t r i c R a n k i n g ( B ) .
126
+ $$
127
+
128
+ Next we compute the distribution for $\AA ^ { S } M e t r i c R a n k i n g$ under the null hypothesis that the methods are equivalent, i.e. that performance measurements should have the same distribution for $a$ and $b$ . We do this by computing random partitions $A ^ { \prime } , B ^ { \prime }$ of $\{ A \cup B \}$ , and computing the test statistic $s _ { M e t r i c R a n k i n g } ( A ^ { \prime } , B ^ { \prime } )$ on each partition. This yields a distribution for sMetricRanking (for sufficiently many samples), and the $\mathsf { p }$ -value can be computed from the percentile value of $s _ { M e t r i c R a n k i n g } ( A , B )$ in this distribution. As with the confidence intervals, a different procedure is required for per-run vs across-run metrics. Please see Appendix C for diagrams illustrating the permutation test procedures.
129
+
130
+ When performing pairwise comparisons between algorithms, it is critical to include corrections for multiple comparisons. This is because the probability of incorrect inferences increases with a greater number of simultaneous comparisons. We recommend using the Benjamini-Yekutieli method, which controls the false discovery rate (FDR), i.e., the proportion of rejected null hypotheses that are false.4
131
+
132
+ # 4.3 REPORTING ON STATISTICAL TESTS
133
+
134
+ It is important to report the details of any statistical tests performed, e.g. which test was used, the significance threshold, and the type of multiple-comparisons correction used.
135
+
136
+ # 5 ANALYSIS OF RELIABILITY FOR COMMON ALGORITHMS AND ENVIRONMENTS
137
+
138
+ In this section, we provide examples of applying the reliability metrics to a number of RL algorithms and environments, following the recommendations described above.
139
+
140
+ # 5.1 CONTINUOUS CONTROL ALGORITHMS ON OPENAI GYM
141
+
142
+ We applied the reliability metrics to algorithms tested on seven continuous control environments from the Open-AI Gym (Greg Brockman et al., 2016) run on the MuJoCo physics simulator (Todorov et al., 2012). We tested REINFORCE (Sutton et al., 2000), DDPG (Lillicrap et al., 2015), PPO (Schulman et al., 2017), TD3 (Fujimoto et al., 2018), and SAC (Haarnoja et al., 2018) on the following Gym environments: Ant-v2, HalfCheetah-v2, Humanoid-v2, Reacher-v2, Swimmer-v2, and Walker2d-v2. We used the implementations of DDPG, TD3, and SAC from the TF-Agents library (Guadarrama et al., 2018). Each algorithm was run on each environment for 30 independent training runs.
143
+
144
+ We used a black-box optimizer (Golovin et al., 2017) to tune selected hyperparameters on a per-task basis, optimizing for final performance. The remaining hyperparameters were defined as stated in the corresponding original papers. See Appendix E for details of the hyperparameter search space and the final set of hyperparameters. During training, we evaluated the policies at a frequency of 1000 training steps. Each algorithm was run for a total of two million environment steps. For the “online” evaluations we used the generated training curves, averaging returns over recent training episodes collected using the exploration policy as it evolves. The raw training curves are shown in Appendix D. For evaluations after learning on a fixed policy, we took the last checkpoint from each training run as the fixed policy for evaluation. Each of these policies was then evaluated for 30 roll-outs, where each roll-out was defined as 1000 environment steps.
145
+
146
+ # 5.2 DISCRETE CONTROL: DQN VARIANTS ON ATARI
147
+
148
+ We also applied the reliability metrics to the RL algorithms and training data released as part of the Dopamine package (Castro et al., 2018). The data comprise the training runs of four RL algorithms, each applied to 60 Atari games. The RL algorithms are: DQN (Mnih et al., 2015), Implicit Quantile (IQN) (Dabney et al., 2018), C51 (Bellemare et al., 2017), and a variant of Rainbow implementing the three most important components (Hessel & Modayil, 2018). The algorithms were trained on each game for 5 training runs. Hyper-parameters follow the original papers, but were modified as necessary to follow Rainbow (Hessel & Modayil, 2018), to ensure apples-to-apples comparison. See Appendix E for the hyperparameters.
149
+
150
+ During training, the algorithms were evaluated in an “online” fashion every 1 million frames, averaging across the training episodes as recommended for evaluations on the ALE (Machado et al., 2018). Each training run consisted of approximately 200 million Atari frames (rounding to the nearest episode boundary every 1 million frames).5 For evaluations after learning on a fixed policy (“after learning”), we took the last checkpoint from each training run as the fixed policies for evaluation. We then evaluated each of these policies for 125,000 environment steps.
151
+
152
+ 5.3 PARAMETERS FOR RELIABILITY METRICS, CONFIDENCE INTERVALS, AND STATISTICAL TESTS
153
+
154
+ For the MuJoCo environments, we applied a sliding window of 100000 training steps for Dispersion across Time. For the Atari experiments, we used a sliding window size of 25 on top of the evaluations for the Dispersion across Time. For metrics with multiple evaluation points, we divided each training run into 3 time frames and averaged the metric rankings within each time frame. Because the results were extremely similar for all three time frames, we here report just for the final time frames.
155
+
156
+ Statistical tests for comparing algorithms were performed according to the recommendations in Section 4. We used pairwise permutation tests using 10,000 permutations per test, with a significance threshold of 0.05 and Benjamini-Yekutieli multiple-comparisons correction.
157
+
158
+ # 5.4 MEDIAN PERFORMANCE
159
+
160
+ The median performance of an algorithm is not a reliability metric, but it is interesting to see side-byside with the reliability metrics. For analyzing median performance for the DQN variants, we used the normalization scheme of (Mnih et al., 2015), where an algorithm’s performance is normalized against a lower baseline (e.g. the performance of a random policy) and an upper baseline (e.g. the performance of a human): $\begin{array} { r } { \bar { P _ { \mathrm { n o r m a l i z e d } } } = \frac { P - B _ { \mathrm { l o w e r } } } { B _ { \mathrm { u p p e r } } - B _ { \mathrm { l o w e r } } } } \end{array}$ . Median performance was not normalized for the continuous control algorithms.
161
+
162
+ # 5.5 RESULTS
163
+
164
+ The reliability metric rankings are shown in Fig. 1 for the MuJoCo results. We see that, according to Median Performance during training, SAC and TD3 have the best performance and perform similarly well, while REINFORCE performs the worst. However, SAC outperforms TD3 on all reliability metrics during training. Furthermore, both SAC and TD3 perform relatively poorly on all reliability metrics after learning, despite performing best on median performance.
165
+
166
+ The reliability metric rankings are shown in Fig. 2 for the Atari results. Here we see a similar result that, even though Rainbow performs significantly better than IQN in Median Performance, IQN performs numerically or significantly better than Rainbow on many of the reliability metrics.
167
+
168
+ The differing patterns in these metrics demonstrates that reliability is a separate dimension that needs to be inspected separately from mean or median performance – two algorithms may have similar median performance but may nonetheless significantly differ in reliability, as with SAC and TD3 above. Additionally, these results demonstrate that reliability along one axis does not necessarily correlate with reliability on other axes, demonstrating the value of evaluating these different dimensions so that algorithms can be compared and selected based on the requirements of the problem at hand.
169
+
170
+ To see metric results evaluated on a per-environment basis, please refer to Appendix F. Rank order of algorithms was often relatively consistent across the different environments evaluated. However, different environments did display different patterns across algorithms. For example, even though SAC showed the same or better Dispersion across Runs for most of the MuJoCo environments evaluated, it did show slightly worse Dispersion across Runs for the HalfCheetah environment (Fig 7a). This kind of result emphasizes the importance of inspecting reliability (and other performance metrics) on a per-environment basis, and also of evaluating reliability and performance on the environment of interest, if possible.
171
+
172
+ # 6 CONCLUSION
173
+
174
+ We have presented a number of metrics, designed to measure different aspects of reliability of RL algorithms. We motivated the design goals and choices made in constructing these metrics, and also presented practical recommendations for the measurement of reliability for RL. Additionally, we presented examples of applying these metrics to common RL algorithms and environments, and showed that these metrics can reveal strengths and weaknesses of an algorithm that are obscured when we only inspect mean or median performance.
175
+
176
+ # ACKNOWLEDGMENTS
177
+
178
+ Many thanks to the following people for helpful discussions during the formulation of these metrics and the writing of the paper: Mohammad Ghavamzadeh, Yinlam Chow, Danijar Hafner, Rohan Anil, Archit Sharma, Vikas Sindhwani, Krzysztof Choromanski, Joelle Pineau, Hal Varian, Shyue-Ming Loh, and Tim Hesterberg. Thanks also to Toby Boyd for his assistance in the open-sourcing process, Oscar Ramirez for code reviews, and Pablo Castro for his help with running experiments using the Dopamine baselines data.
179
+
180
+ # REFERENCES
181
+
182
+ Carlo Acerbi and Dirk Tasche. Expected Shortfall: A Natural Coherent Alternative to Value at Risk. Economic Notes, 31(2):379–388, July 2002. ISSN 0391-5026, 1468-0300. doi: 10.1111/ 1468-0300.00091. URL http://doi.wiley.com/10.1111/1468-0300.00091.
183
+
184
+ Marc G. Bellemare, Will Dabney, and Rémi Munos. A Distributional Perspective on Reinforcement Learning. arXiv:1707.06887 [cs, stat], July 2017. URL http://arxiv.org/abs/1707. 06887. arXiv: 1707.06887.
185
+
186
+ Nicole Bäuerle and Jonathan Ott. Markov Decision Processes with Average-Value-at-Risk criteria. Mathematical Methods of Operations Research, 74(3):361–379, December 2011. ISSN 1432-2994, 1432-5217. doi: 10.1007/s00186-011-0367-0. URL http://link.springer.com/10. 1007/s00186-011-0367-0.
187
+
188
+ Pablo Samuel Castro, Subhodeep Moitra, Carles Gelada, Saurabh Kumar, and Marc G. Bellemare. Dopamine: A research framework for deep reinforcement learning. CoRR, abs/1812.06110, 2018. URL http://arxiv.org/abs/1812.06110.
189
+
190
+ Alexei Chekhlov, Stanislav Uryasev, and Michael Zabarankin. Drawdown measure in portfolio optimization. International Journal of Theoretical and Applied Finance, 8(1):46, 2005.
191
+
192
+ Yinlam Chow and Mohammad Ghavamzadeh. Algorithms for CVaR Optimization in MDPs. Advances in Neural Information Processing Systems, pp. 9, 2014.
193
+
194
+ Cédric Colas, Olivier Sigaud, and Pierre-Yves Oudeyer. How Many Random Seeds? Statistical Power Analysis in Deep Reinforcement Learning Experiments. arXiv:1806.08295 [cs, stat], June 2018. URL http://arxiv.org/abs/1806.08295. arXiv: 1806.08295.
195
+
196
+ Cédric Colas, Olivier Sigaud, and Pierre-Yves Oudeyer. A Hitchhiker’s Guide to Statistical Comparisons of Reinforcement Learning Algorithms. arXiv:1904.06979 [cs, stat], April 2019. URL http://arxiv.org/abs/1904.06979. arXiv: 1904.06979.
197
+
198
+ Will Dabney, Georg Ostrovski, David Silver, and Rémi Munos. Implicit Quantile Networks for Distributional Reinforcement Learning. Thirty-fith International Conference on Machine Learning, pp. 10, 2018.
199
+
200
+ Yan Duan, Xi Chen, Rein Houthooft, John Schulman, and Pieter Abbeel. Benchmarking Deep Reinforcement Learning for Continuous Control. In International Conference on Machine Learning, pp. 1329–1338, June 2016. URL http://proceedings.mlr.press/v48/duan16.html.
201
+
202
+ B. Efron and R. Tibshirani. Bootstrap Methods for Standard Errors, Confidence Intervals, and Other Measures of Statistical Accuracy. Statistical Science, 1(1):54–75, February 1986. ISSN 0883-4237, 2168-8745. doi: 10.1214/ss/1177013815. URL http://projecteuclid.org/euclid. ss/1177013815.
203
+
204
+ Meire Fortunato, Mohammad Gheshlaghi Azar, Bilal Piot, Jacob Menick, Ian Osband, Alex Graves, Vlad Mnih, Remi Munos, Demis Hassabis, Olivier Pietquin, Charles Blundell, and Shane Legg. Noisy Networks for Exploration. arXiv:1706.10295 [cs, stat], June 2017. URL http://arxiv. org/abs/1706.10295. arXiv: 1706.10295.
205
+
206
+ Scott Fujimoto, Herke van Hoof, and David Meger. Addressing Function Approximation Error in Actor-Critic Methods. arXiv:1802.09477 [cs, stat], February 2018. URL http://arxiv. org/abs/1802.09477. arXiv: 1802.09477.
207
+
208
+ 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 - KDD ’17, pp. 1487–1495, Halifax, NS, Canada, 2017. ACM Press. ISBN 978-1-4503-4887-4. doi: 10.1145/3097983. 3098043. URL http://dl.acm.org/citation.cfm?doid ${ . } = { }$ 3097983.3098043.
209
+
210
+ Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. OpenAI Gym, 2016.
211
+
212
+ Sergio Guadarrama, Anoop Korattikara, Pablo Castro Oscar Ramirez, Ethan Holly, Sam Fishman, Ke Wang, Chris Harris Ekaterina Gonina, Vincent Vanhoucke, and Eugene Brevdo. TF-Agents: A library for reinforcement learning in tensorflow. https://github.com/tensorflow/ agents, 2018. URL https://github.com/tensorflow/agents. [Online; accessed 30-November-2018].
213
+
214
+ Tuomas Haarnoja, Aurick Zhou, Pieter Abbeel, and Sergey Levine. Soft Actor-Critic: Off-Policy Maximum Entropy Deep Reinforcement Learning with a Stochastic Actor. arXiv:1801.01290 [cs, stat], January 2018. URL http://arxiv.org/abs/1801.01290. arXiv: 1801.01290.
215
+
216
+ James D. Hamilton. Time Series Analysis. Princeton University Press, 1994.
217
+
218
+ Peter Henderson, Riashat Islam, Philip Bachman, Joelle Pineau, Doina Precup, and David Meger. Deep Reinforcement Learning that Matters. arXiv:1709.06560 [cs, stat], September 2017. URL http://arxiv.org/abs/1709.06560. arXiv: 1709.06560.
219
+
220
+ Matteo Hessel and Joseph Modayil. Rainbow: Combining Improvements in Deep Reinforcement Learning. AAAI, pp. 8, 2018.
221
+
222
+ Riashat Islam, Peter Henderson, Maziar Gomrokchi, and Doina Precup. Reproducibility of Benchmarked Deep Reinforcement Learning Tasks for Continuous Control. arXiv:1708.04133 [cs], August 2017. URL http://arxiv.org/abs/1708.04133. arXiv: 1708.04133.
223
+
224
+ Timothy P. Lillicrap, Jonathan J. Hunt, Alexander Pritzel, Nicolas Heess, Tom Erez, Yuval Tassa, David Silver, and Daan Wierstra. Continuous control with deep reinforcement learning. arXiv:1509.02971 [cs, stat], September 2015. URL http://arxiv.org/abs/1509. 02971. arXiv: 1509.02971.
225
+
226
+ Marlos C. Machado, Marc G. Bellemare, Erik Talvitie, Joel Veness, Matthew Hausknecht, and Michael Bowling. Revisiting the Arcade Learning Environment: Evaluation Protocols and Open Problems for General Agents. Journal of Artificial Intelligence Research, 61:523–562, March 2018. ISSN 1076-9757. doi: 10.1613/jair.5699. URL https://www.jair.org/index. php/jair/article/view/11182.
227
+
228
+ Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A. Rusu, Joel Veness, Marc G. Bellemare, Alex Graves, Martin Riedmiller, Andreas K. Fidjeland, Georg Ostrovski, Stig Petersen, Charles Beattie, Amir Sadik, Ioannis Antonoglou, Helen King, Dharshan Kumaran, Daan Wierstra, Shane Legg, and Demis Hassabis. Human-level control through deep reinforcement learning. Nature, 518(7540):529–533, February 2015. ISSN 1476-4687. doi: 10.1038/nature14236. URL https://www.nature.com/articles/nature14236/.
229
+
230
+ Prabhat Nagarajan, Garrett Warnell, and Peter Stone. Deterministic Implementations for Reproducibility in Deep Reinforcement Learning. arXiv:1809.05676 [cs], September 2018. URL http://arxiv.org/abs/1809.05676. arXiv: 1809.05676.
231
+
232
+ Charles R Nelson and Charles I Plosser. Trends and random walks in macroeconomic time series. Journal of Monetary Economics, 10:139–162, 1982.
233
+
234
+ Peter J. Rousseeuw and Christophe Croux. Alternatives to the MedianAbsolute Deviation. Journal of the American Statistical Association, 1993.
235
+
236
+ Said E. Said and David A. Dickey. Testing for unit roots in autoregressive-moving average models of unknown order. Biometrika, 71(3):599–607, 1984.
237
+
238
+ John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal Policy Optimization Algorithms. arXiv:1707.06347 [cs], July 2017. URL http://arxiv.org/ abs/1707.06347. arXiv: 1707.06347.
239
+
240
+ Joseph P. Simmons, Leif D. Nelson, and Uri Simonsohn. False-Positive Psychology: Undisclosed Flexibility in Data Collection and Analysis Allows Presenting Anything as Significant. Psychological Science, 22(11):1359–1366, November 2011. ISSN 0956-7976, 1467-9280. doi: 10.1177/0956797611417632. URL http://journals.sagepub.com/doi/10.1177/ 0956797611417632.
241
+
242
+ Richard S Sutton, David A McAllester, Satinder P Singh, and Yishay Mansour. Policy Gradient Methods for Reinforcement Learning with Function Approximation. In NIPS’99 Proceedings of the 12th International Conference on Neural Information Processing Systems, pp. 7, 2000.
243
+
244
+ Aviv Tamar, Yonatan Glassner, and Shie Mannor. Optimizing the CVaR via Sampling. Proceedings of the Twenty-Ninth AAAI Conference on Artificial Intelligence, pp. 7, 2015.
245
+
246
+ Emanuel Todorov, Tom Erez, and Yuval Tassa. MuJoCo: A physics engine for model-based control. In 2012 IEEE/RSJ International Conference on Intelligent Robots and Systems, pp. 5026–5033, Vilamoura-Algarve, Portugal, October 2012. IEEE. ISBN 978-1-4673-1736-8 978-1-4673-1737-5 978-1-4673-1735-1. doi: 10.1109/IROS.2012.6386109. URL http://ieeexplore.ieee. org/document/6386109/.
247
+
248
+ # A ASSUMPTIONS AND DEFINITIONS
249
+
250
+ Reinforcement Learning algorithms vary widely in design, and our metrics are based on certain notions that should span the gamut of RL algorithms.
251
+
252
+ Policy A policy $\pi _ { \Theta } ( a _ { i } | s _ { i } )$ is a distribution over actions $a _ { i }$ given a current (input) state $s _ { i }$ . We assume policies are parameterized by a parameter $\Theta$ .
253
+ Agent An agent is defined as a distribution over policies (or equivalently a distribution over parameters $\Theta$ ). In many cases, an agent will be a single policy but for population-based RL methods, the agent is a discrete set of policies.
254
+ Window A window is a collection of states over which the agent is assumed to have small variation. A window could be a sequence of consecutive time steps for a sequential RL algorithm, or a collection of states at the same training step of a distributed RL algorithm with a parameter server (all agents share $\Theta$ ).
255
+ Performance The performance of an agent is the mean or median per-epoch reward from running that agent. If the agent is a single policy, then the performance $p ( \pi _ { \Theta } )$ is the mean or median per-epoch reward for that agent. If the agent is a distribution $D ( \Theta )$ of policies, then the performance is the median of $p ( \pi _ { \Theta } )$ with $\Theta \sim D$ .
256
+ Training Run A training run is a sequence of updates to the agent $D ( \Theta )$ from running a reinforcement learning algorithm. It leads to a trained agent $D _ { f i n a l } ( \Theta )$ . Multiple training runs share no information with each other.
257
+
258
+ We cannot directly measure performance since it is a statistic across an infinite sample of evaluation runs of an agent. Instead we use windows to compute sample medians to approximate performance.
259
+
260
+ # B DETRENDING BY DIFFERENCING
261
+
262
+ Typically, de-trending can be performed in two main ways (Nelson & Plosser, 1982; Hamilton, 1994).
263
+ Differencing (i.e. $y _ { t } \prime = y _ { t } - y _ { t - 1 } )$ is more appropriate for difference-stationary (DS) processes (e.g.
264
+ a random walk: $y _ { t } = y _ { t - 1 } + b + \epsilon _ { t } )$ , where the shocks $\epsilon _ { t }$ accumulate over time. For trend-stationary (TS) processes, which are characterized by stationary fluctuations around a deterministic trend, e.g.
265
+ $y _ { t } = a + b * t + \epsilon _ { t }$ , it is more appropriate to fit and subtract that trend.
266
+
267
+ We performed an analysis of real training runs and verified that the data are indeed approximately DS, and that differencing does indeed remove the majority of time-dependent structure. For this analysis we used the training runs on Atari as described in 5.2. Before differencing, the Augmented Dickey-Fuller test (ADF test, also known as a difference-stationarity test; Said E. Said & David A. Dickey (1984)) rejects the null hypothesis of a unit root on only $72 \%$ of the runs; after differencing, the ADF test rejects the null hypothesis on $92 \%$ of the runs (p-value threshold 0.05). For the ADF test, the rejection of a unit root (of the autoregressive lag polynomial) implies the alternate hypothesis, which is that the time series is trend-stationary.
268
+
269
+ Therefore, our training curves are better characterized as an accumulation of shocks, i.e. as DS processes, rather than as mean-reverting TS processes. They are not actually purely DS because the shocks $\epsilon _ { t }$ are not stationary over time, but because we compute standard deviation within sliding windows, we can capture the non-stationarity and change in variability over time. Thus, we chose to detrend using differencing.
270
+
271
+ As a further note in favor of detrending by differencing, it is useful to observe that many measures of variability are defined relative to the central tendency of the data, e.g. the median absolute deviation $\mathbf { M A D } = \mathbf { m e d i a n } ( | X _ { i } - \widetilde { X } | )$ where $\widetilde { X }$ is the median of $X$ . On the raw data (without differencing), the MAD would be defined relative to $\widetilde { X }$ as median performance, so that any improvements in performance are included in that computation of variability. On the other hand, if we compute MAD on the 1st-order differences, we are using a $\widetilde { X }$ that represents the median change in performance, which is a more reasonable baseline to compute variability against, when we are in fact concerned with the variability of those changes.
272
+
273
+ A final benefit of differencing is that it is parameter-free.
274
+
275
+ # C ILLUSTRATIONS OF PERMUTATION TEST PROCEDURES
276
+
277
+ We illustrate the procedure for computing permutation tests to compare pairs of algorithms on a specified metric, in Figs. 3 (for per-run metrics) and 4 (for across-run metrics).
278
+
279
+ # D RAW TRAINING CURVES FOR OPENAI MUJOCO TASKS
280
+
281
+ In Figure 5, we show the raw training curves for the TF-Agents implementations of continuouscontrol algorithms, applied to the OpenAI MuJoCo tasks. These are compared against baselines from the literature, where available (DDPG and TD3: Fujimoto et al. (2018), PPO: Schulman et al. (2017), SAC: Haarnoja et al. (2018))
282
+
283
+ # E HYPERPARAMETER SETTINGS
284
+
285
+ For the continuous control experiments, hyperparameters were chosen on a per-environment basis according to the black-box optimization algorithm described in Golovin et al. (2017). The hyperparameter search space is shown in Table 2.
286
+
287
+ For the discrete control experiments, hyperparameter selection is described in (Castro et al., 2018). Hyperparameters are shown in Table 8, duplicated for reference from https://github.com/google/dopamine/tree/master/baselines.
288
+
289
+ # Comparing algorithms on per-run metrics
290
+
291
+ Raw values e.g. 3 runs per (task, algo)
292
+
293
+ <table><tr><td rowspan=3 colspan=1>algoAalgoBalgoc</td><td rowspan=1 colspan=1>-1,-7,3</td><td rowspan=1 colspan=1>2.5,7,3</td><td rowspan=1 colspan=1>77,90,4</td></tr><tr><td rowspan=1 colspan=1>-4,2,0</td><td rowspan=1 colspan=1>1.9,0.3,4</td><td rowspan=1 colspan=1>5,32,15</td></tr><tr><td rowspan=1 colspan=1>3,2,4</td><td rowspan=1 colspan=1>6,10,5</td><td rowspan=1 colspan=1>52,64,3</td></tr></table>
294
+
295
+ task1 task2 task3
296
+
297
+ Evaluate per-run metrics for each run
298
+
299
+ # Metric values
300
+
301
+ ![](images/ed3269eab6188f2e31d92a52dd7ac6c371b0a746169bfb37b1a85a217fa685dd.jpg)
302
+ Figure 3: Diagram illustrating the computation of the permutation tests for per-run metrics (Dispersion across Time, Short-term Risk across Time, Long-term Risk across Time). In this example, we are comparing Algorithm A and Algorithm B, and there are only 3 algorithms, 3 tasks, and 3 runs per (task, algo) pair. To compute the difference in average rankings for two algorithms, follow the gray arrows. To compute a null distribution of difference in average rankings (by permuting the runs), follow the blue arrows a number of times (e.g. 1,000 times). Once the null distribution has been computed, the actual value of the difference can be compared with the null distribution to obtain a p-value.
303
+
304
+ ![](images/0c3f8dfbd4924b0d62b579477d339c12c77e7fa8904b822078909fc4e05deb56.jpg)
305
+ Comparing algorithms on across-run metrics
306
+ Figure 4: Diagram illustrating the computation of the permutation tests for across-run or acrossrollout metrics (Dispersion across Runs, Risk Across Runs, Dispersion across Fixed-policy rollouts, Risk across Fixed-Policy rollouts). In this example, we are comparing Algorithm A and Algorithm B, and there are only 3 algorithms, 3 tasks, and 3 runs per (task, algo) pair. To compute the difference in average rankings for two algorithms, follow the gray arrows. To compute a null distribution of difference in average rankings (by permuting the runs), follow the blue arrows a number of times (e.g. 1,000 times). Once the null distribution has been computed, the actual value of the difference can be compared with the null distribution to obtain a p-value.
307
+
308
+ ![](images/e662db76af853665422b459608b40a07e165e5e3654a2f6ed6d7dd410136c4b9.jpg)
309
+ Figure 5: Raw training curves for OpenAI MuJoCo tasks. The $\mathbf { X }$ -axes indicate environment steps, and the y-axes indicate average per-episode return. Dotted lines indicate baseline performance from the literature, where available.
310
+
311
+ Table 2: Hyperparameter search space for continuous control algorithms.
312
+
313
+ <table><tr><td rowspan=1 colspan=1>Algorithm</td><td rowspan=1 colspan=1>Hyperparameter</td><td rowspan=1 colspan=1>Search min</td><td rowspan=1 colspan=1>Search max</td></tr><tr><td rowspan=1 colspan=1>SAC</td><td rowspan=1 colspan=1>actor learning rateα learning ratecritic learning rate target update T</td><td rowspan=1 colspan=1>0.0000010.0000010.0000010.00001</td><td rowspan=1 colspan=1>0.0010.0010.0011.0</td></tr><tr><td rowspan=1 colspan=1>TD3</td><td rowspan=1 colspan=1>actor learning ratecritic learning ratetarget update T</td><td rowspan=1 colspan=1>0.0000010.0000010.00001</td><td rowspan=1 colspan=1>0.0010.0011.0</td></tr><tr><td rowspan=1 colspan=1>PPO</td><td rowspan=1 colspan=1>learning rate</td><td rowspan=1 colspan=1>0.000001</td><td rowspan=1 colspan=1>0.001</td></tr><tr><td rowspan=1 colspan=1>DDPG</td><td rowspan=1 colspan=1>actor learning ratecritic learning ratetarget update T</td><td rowspan=1 colspan=1>0.0000010.0000010.00001</td><td rowspan=1 colspan=1>0.0010.0011.0</td></tr><tr><td rowspan=1 colspan=1>REINFORCE</td><td rowspan=1 colspan=1>learning rate# episodes before each train step</td><td rowspan=1 colspan=1>0.0000011.0</td><td rowspan=1 colspan=1>0.00110</td></tr></table>
314
+
315
+ Table 3: Final hyperparameters for SAC.
316
+
317
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>actor learning rate</td><td rowspan=1 colspan=1>α learning rate</td><td rowspan=1 colspan=1>critic learning rate</td><td rowspan=1 colspan=1>target update T</td></tr><tr><td rowspan=1 colspan=1>Ant-v2</td><td rowspan=1 colspan=1>0.000006</td><td rowspan=1 colspan=1>0.000009</td><td rowspan=1 colspan=1>0.0009</td><td rowspan=4 colspan=1>0.00020.020.80.00002</td></tr><tr><td rowspan=1 colspan=1>HalfCheetah-v2</td><td rowspan=1 colspan=1>0.0001</td><td rowspan=1 colspan=1>0.000005</td><td rowspan=1 colspan=1>0.0004</td></tr><tr><td rowspan=1 colspan=1>Humanoid-v2</td><td rowspan=1 colspan=1>0.0003</td><td rowspan=1 colspan=1>0.0008</td><td rowspan=1 colspan=1>0.0006</td></tr><tr><td rowspan=1 colspan=1>Reacher-v2</td><td rowspan=1 colspan=1>0.00001</td><td rowspan=1 colspan=1>0.000002</td><td rowspan=1 colspan=1>0.0005</td></tr><tr><td rowspan=1 colspan=1>Swimmer-v2</td><td rowspan=1 colspan=1>0.000004</td><td rowspan=1 colspan=1>0.000009</td><td rowspan=1 colspan=1>0.0002</td><td rowspan=2 colspan=1>0.0090.01</td></tr><tr><td rowspan=1 colspan=1>Walker2d-v2</td><td rowspan=1 colspan=1>0.0002</td><td rowspan=1 colspan=1>0.0009</td><td rowspan=1 colspan=1>0.0008</td></tr></table>
318
+
319
+ Table 4: Final hyperparameters for TD3.
320
+
321
+ <table><tr><td></td><td>actor learning rate</td><td>critic learning rate</td><td>target update T</td></tr><tr><td>Ant-v2</td><td>0.000001</td><td>0.0002</td><td>0.0003</td></tr><tr><td>HalfCheetah-v2</td><td>0.0003</td><td>0.0005</td><td>0.02</td></tr><tr><td>Humanoid-v2</td><td>0.0001</td><td>0.0001</td><td>0.0002</td></tr><tr><td>Reacher-v2</td><td>0.000001</td><td>0.00003</td><td>0.00003</td></tr><tr><td>Swimmer-v2</td><td>0.0004</td><td>0.0002</td><td>0.01</td></tr><tr><td>Walker2d-v2</td><td>0.00006</td><td>0.00009</td><td>0.001</td></tr></table>
322
+
323
+ Table 5: Final hyperparameters for PPO.
324
+
325
+ <table><tr><td></td><td>learning rate</td></tr><tr><td>Ant-v2</td><td>0.0008</td></tr><tr><td>HalfCheetah-v2</td><td>0.0008</td></tr><tr><td>Humanoid-v2</td><td>0.0008</td></tr><tr><td>Reacher-v2</td><td>0.00002</td></tr><tr><td>Swimmer-v2</td><td>0.0004</td></tr><tr><td>Walker2d-v2</td><td>0.0002</td></tr></table>
326
+
327
+ Table 6: Final hyperparameters for DDPG.
328
+
329
+ <table><tr><td rowspan=1 colspan=2></td><td rowspan=1 colspan=1>actor learning rate</td><td rowspan=1 colspan=1>critic learning rate</td><td rowspan=1 colspan=1>target update T</td></tr><tr><td rowspan=1 colspan=2>Ant-v2</td><td rowspan=1 colspan=1>0.00003</td><td rowspan=1 colspan=1>0.0004</td><td rowspan=3 colspan=1>0.00020.020.01</td></tr><tr><td rowspan=5 colspan=2>HalfCheetah-v2Humanoid-v2Reacher-v2Swimmer-v2Walker2d-v2</td><td rowspan=1 colspan=1>0.00006</td><td rowspan=1 colspan=1>0.0005</td></tr><tr><td rowspan=2 colspan=1>0.000060.00005</td><td rowspan=1 colspan=1>0.00009</td><td rowspan=1 colspan=1>0</td></tr><tr><td rowspan=1 colspan=1>0.0005</td><td rowspan=1 colspan=1>0.005</td></tr><tr><td rowspan=1 colspan=1>Swimmer-v2</td><td rowspan=1 colspan=1>0.0005</td><td rowspan=1 colspan=1>0.0003</td><td rowspan=2 colspan=1>0.0040.03</td></tr><tr><td rowspan=1 colspan=1>0.0003</td><td rowspan=1 colspan=1>0.0004</td></tr></table>
330
+
331
+ Table 7: Final hyperparameters for REINFORCE.
332
+
333
+ <table><tr><td></td><td>learning rate</td><td># episodes before each train step</td></tr><tr><td>Ant-v2</td><td>0.00002</td><td>9</td></tr><tr><td>HalfCheetah-v2</td><td>0.0004</td><td>7</td></tr><tr><td>Humanoid-v2</td><td>0.0005</td><td>2</td></tr><tr><td>Reacher-v2</td><td>0.000004</td><td>6</td></tr><tr><td>Swimmer-v2</td><td>0.000005</td><td>3</td></tr><tr><td>Walker2d-v2</td><td>0.0001</td><td>6</td></tr></table>
334
+
335
+ Table 8: Hyperparameters for discrete control algorithms.
336
+
337
+ <table><tr><td rowspan=1 colspan=1>Training ∈</td><td rowspan=1 colspan=1>Evaluation ∈</td><td rowspan=1 colspan=1>∈ decay schedule</td><td rowspan=1 colspan=1>Min. history to start learning</td><td rowspan=1 colspan=1>Target network update frequency</td></tr><tr><td rowspan=1 colspan=1>0.01</td><td rowspan=1 colspan=1>0.001</td><td rowspan=1 colspan=1>1,000,000 frames</td><td rowspan=1 colspan=1>80,000 frames</td><td rowspan=1 colspan=1>32,000 frames</td></tr></table>
338
+
339
+ # F PER-TASK METRIC RESULTS
340
+
341
+ Metric results are shown on a per-task basis in Figs. 6 to 8 for the OpenAI Gym MuJoCo tasks, and Figs. 9 to 23 for the Atari environments. Note that because we are no longer aggregating across tasks in this analysis, we do not need to convert the metric values to rankings.
342
+
343
+ ![](images/cec1c2995b0125b3db4f8df11a4260096c8a000b0b3d95b44278ab1b9e5a0d6f.jpg)
344
+
345
+ ![](images/cb3bb96377fa9630024aa345d04c53765bfdfe2cb4eda6f7dd7e5356d693d3aa.jpg)
346
+ (a) Dispersion across Time. Better reliability is indicated by less positive values. The x-axes indicate the number of environment steps.
347
+ Figure 6: Across-time reliability metrics for continuous control RL algorithms tested on OpenAI Gym environments, evaluated on a per-environment basis.
348
+
349
+ ![](images/176a0dc0ee915ad20c06b815fb91fe0bab25cfb83b45b0fe5cc642cefe3955f5.jpg)
350
+ (c) Median performance during training. Better performance is indicated by more positive values.
351
+ Figure 7: Across-run reliability metrics and median performance for continuous control RL algorithms tested on OpenAI Gym environments, evaluated on a per-environment basis. The $\mathbf { X }$ -axes indicate the number of environment steps.
352
+
353
+ ![](images/c40b95c7c205c5fa8f147f115ced50722e925bc3c1fd7d76aa073d1f78f7df76.jpg)
354
+ (c) Median performance on Fixed-policy rollouts. Better performance is indicated by more positive values.
355
+
356
+ Figure 8: Reliability metrics and median performance on fixed-policy rollouts for continuous control RL algorithms tested on OpenAI Gym environments, evaluated on a per-environment basis.
357
+
358
+ ![](images/aecca9879d7a6eaeb66ab7aa37b8318cd8e92c32be8e7f68a12c2b7d1e6c00a6.jpg)
359
+ Figure 9: Dispersion across Time for DQN-variants tested on 60 Atari games, evaluated on a perenvironment basis (page 1). Better reliability is indicated by less positive values. The $\mathbf { X }$ -axes indicate millions of Atari frames.
360
+
361
+ ![](images/822d810b075264d2abade575dd47ea5f30457fd848733f1d4b4451a50f5ce8ad.jpg)
362
+ Figure 10: Dispersion across Time for DQN-variants tested on 60 Atari games, evaluated on a per-environment basis (page 2). Better reliability is indicated by less positive values. The $\mathbf { X }$ -axes indicate millions of Atari frames.
363
+
364
+ ![](images/1f628d73d292181bde29ff809254d6e8e95df2e47c007b1318b6344eb3e43d30.jpg)
365
+ Figure 11: Dispersion across Time for DQN-variants tested on 60 Atari games, evaluated on a per-environment basis (page 3). Better reliability is indicated by less positive values. The $\mathbf { X }$ -axes indicate millions of Atari frames.
366
+
367
+ ![](images/2f88232d4df466e1c963b90d94c96ff0f02b9b2e41799e72dcac78a7a7285712.jpg)
368
+ Figure 12: Short-term Risk across Time for DQN-variants tested on 60 Atari games, evaluated on a per-environment basis (page 1). Better reliability is indicated by less positive values. The $\mathbf { X }$ -axes indicate millions of Atari frames.
369
+
370
+ ![](images/6354ac16a00c441f4c100baa19bb1b82659cbab0f2c53e861f2ffd30202d7768.jpg)
371
+ Figure 13: Short-term Risk across Time for DQN-variants tested on 60 Atari games, evaluated on a per-environment basis (page 2). Better reliability is indicated by less positive values. The x-axes indicate millions of Atari frames.
372
+
373
+ ![](images/5eb59c4fe59ae9b38d5cd99e70adf1cb02b43e32d5a5e79990f7e628d54ae522.jpg)
374
+ Figure 14: Short-term Risk across Time for DQN-variants tested on 60 Atari games, evaluated on a per-environment basis (page 3). Better reliability is indicated by less positive values. The $\mathbf { X }$ -axes indicate millions of Atari frames.
375
+
376
+ ![](images/d257c73a7b2407b4d0eca08dce88d44ddb4e831dcea84141a1274f7b59d56a3a.jpg)
377
+ Figure 15: Long-term Risk across Time for DQN-variants tested on 60 Atari games, evaluated on a per-environment basis (page 1). Better reliability is indicated by less positive values. The $\mathbf { X }$ -axes indicate millions of Atari frames.
378
+
379
+ ![](images/412394c5e0322f1262d4d6db43375b80ab6e47074095e1c73e13b84fda1d07ff.jpg)
380
+ Figure 16: Long-term Risk across Time for DQN-variants tested on 60 Atari games, evaluated on a per-environment basis (page 2). Better reliability is indicated by less positive values. The $\mathbf { X }$ -axes indicate millions of Atari frames.
381
+
382
+ ![](images/44621f204f2db53c785fee2331ad5872eecdeca5e8bf9a8a22ab2a0e5b99fdc5.jpg)
383
+ Figure 17: Long-term Risk across Time for DQN-variants tested on 60 Atari games, evaluated on a per-environment basis (page 3). Better reliability is indicated by less positive values. The $\mathbf { X }$ -axes indicate millions of Atari frames.
384
+
385
+ ![](images/a7285425bea4ff7598ae9aa4c469ba5dbac3d5bdd86205c7b3b3bb44803dfcb4.jpg)
386
+ Figure 18: Dispersion across Fixed-policy Rollouts for DQN-variants tested on 60 Atari games, evaluated on a per-environment basis (page 1). Better reliability is indicated by less positive values. The $\mathbf { X }$ -axes indicate millions of Atari frames.
387
+
388
+ ![](images/a3e1dc133f7c697d388b698368423059823c7edf8a45302a893cb1b9442a93c0.jpg)
389
+ Figure 19: Dispersion across Fixed-policy Rollouts for DQN-variants tested on 60 Atari games, evaluated on a per-environment basis (page 2). Better reliability is indicated by less positive values. The $\mathbf { X }$ -axes indicate millions of Atari frames.
390
+
391
+ ![](images/5c46d632e8a936307828e2173f3cd2a21a3f456f7a995f9309167561e62ca3dd.jpg)
392
+ Figure 20: Dispersion across Fixed-policy Rollouts for DQN-variants tested on 60 Atari games, evaluated on a per-environment basis (page 3). Better reliability is indicated by less positive values. The $\mathbf { X }$ -axes indicate millions of Atari frames.
393
+
394
+ ![](images/1ec713a7e3857947eb886dda91a755fcf04bbb19f257dcbd0fe0006eb86e994f.jpg)
395
+ Figure 21: Risk across Fixed-policy Rollouts for DQN-variants tested on 60 Atari games, evaluated on a per-environment basis (page 1). Better reliability is indicated by more positive values. The $\mathbf { X }$ -axes indicate millions of Atari frames.
396
+
397
+ ![](images/5f9797ed72410b53b95f2527f66c4b43207fee4b1c4a188e5e076fe304274334.jpg)
398
+ Figure 22: Risk across Fixed-policy Rollouts for DQN-variants tested on 60 Atari games, evaluated on a per-environment basis (page 2). Better reliability is indicated by more positive values. The $\mathbf { X }$ -axes indicate millions of Atari frames.
399
+
400
+ ![](images/98295ad14c1dcd95ebc855f8b7b1383bc4d44bd032bd9359f801674f9cb32ed1.jpg)
401
+ Figure 23: Risk across Fixed-policy Rollouts for DQN-variants tested on 60 Atari games, evaluated on a per-environment basis (page 3). Better reliability is indicated by more positive values. The $\mathbf { X }$ -axes indicate millions of Atari frames.
md/train/SUyxNGzUsH/SUyxNGzUsH.md ADDED
@@ -0,0 +1,386 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # VILNMN: A NEURAL MODULE NETWORK APPROACHTO VIDEO-GROUNDED LANGUAGE TASKS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Neural module networks (NMN) have achieved success in image-grounded tasks such as Visual Question Answering (VQA) on synthetic images. However, very limited work on NMN has been studied in the video-grounded language tasks. These tasks extend the complexity of traditional visual tasks with the additional visual temporal variance. Motivated by recent NMN approaches on image-grounded tasks, we introduce Visio-Linguistic Neural Module Network (VilNMN) to model the information retrieval process in video-grounded language tasks as a pipeline of neural modules. VilNMN first decomposes all language components to explicitly resolve any entity references and detect corresponding action-based inputs from the question. The detected entities and actions are used as parameters to instantiate neural module networks and extract visual cues from the video. Our experiments show that VilNMN can achieve promising performance on two video-grounded language tasks: video QA and video-grounded dialogues.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Vision-language tasks have been studied to build intelligent systems that can perceive information from multiple modalities, such as images, videos, and text. Extended from imaged-grounded tasks, e.g. (Antol et al., 2015), recently Jang et al. (2017); Lei et al. (2018) propose to use video as the grounding features. This modification poses a significant challenge to previous image-based models with the additional temporal variance through video frames. Recently Alamri et al. (2019) further develop video-grounded language research into the dialogue domain. In the proposed task, videogrounded dialogues, the dialogue agent is required to answer questions about a video over multiple dialogue turns. Using Figure 1 as an example, to answer questions correctly, a dialogue agent has to resolve references in dialogue context, e.g. “he” and “it”, and identify the original entity, e.g. “a boy" and “a backpack". In addition, the dialogue agent also needs to identify the actions of these entities, e.g. “carrying a backpack” to retrieve information along the temporal dimension of the video.
12
+
13
+ Current state-of-the-art approaches to video-grounded language tasks, e.g. (Le et al., 2019b; Fan et al., 2019) have achieved remarkable performance through the use of deep neural networks to retrieve grounding video signals based on language inputs. However, these approaches often assume the reasoning structure, including resolving references of entities and detecting the corresponding actions to retrieve visual cues, is implicitly learned. An explicit reasoning structure becomes more beneficial as the tasks complicates in two scenarios: video with complex spatial and temporal dynamics, and language inputs with sophisticated semantic dependencies, e.g. questions positioned in a dialogue context. In these cases, it becomes challenging to interpret model outputs, assess model reasoning capability, and identify errors in neural network models.
14
+
15
+ Similar challenges have been observed in image-grounded tasks in which deep neural networks often exhibit shallow understanding capability as they simply exploit superficial visual cues (Agrawal et al., 2016; Goyal et al., 2017; Feng et al., 2018; Serrano & Smith, 2019). Andreas et al. (2016b) propose neural model networks (NMNs) by decomposing a question into sub-sequences called program and assembling a network of neural operations. Motivated by this line of research, we propose an NMN approach to video-grounded language tasks. Our approach benefits from integrating neural networks with a compositional reasoning structure to exploit low-level information signals in video. An example of the reasoning structure can be seen on the right side of Figure 1.
16
+
17
+ ![](images/08dfa3054943d0f06eb58bf4e0e2e48e82ee934f1926997c0219cf2c8c6783ea.jpg)
18
+ Figure 1: A sample video-grounded dialogue: Inputs are question, dialogue history, video with caption, visual and audio input, and the output is the answer to the question. On the right side, we demonstrate an example symbolic reasoning process a dialogue agent can perform to extract textual and visual clues for the answer.
19
+
20
+ We propose Visio-Linguistic Neural Module Network (VilNMN) for video-grounded language tasks. VilNMN leverages entity-based dialogue representations as inputs to neural operations on spatial and temporal-level visual features. Previous approaches exploit question-level and token-level representations to extract question-dependent information from video (Jang et al., 2017; Fan et al., 2019; Le et al., 2019b). In complex videos with many entities or actions, these approaches might not be optimal to locate the right features. To exploit object-level features, VilNMN is trained to identify relevant entities first, and then to extract the temporal steps using detected actions of these entities.
21
+
22
+ VilNMN is also trained to resolve any co-references in language inputs, e.g. questions in a dialogue context, to identify the original entities. Previous approaches to video-grounded dialogues often obtain question global representations in relation to dialogue context. These approaches might be suitable to represent general semantics in open-domain or chit-chat dialogues (Serban et al., 2016; Li et al., 2016) but they are not ideal to detect fine-grained entity-based information as the dialogue context evolves over time.
23
+
24
+ In summary, we introduce a neural module network approach to video-grounded language tasks through a reasoning pipeline with entity and action representations applied on the spatio-temporal dynamics of video. To cater to complex semantic inputs in language inputs, e.g. dialogues, our approach also allows models to resolve entity references to incorporate question representations with fine-grained entity information. In our evaluation, we achieve competitive performance on the large-scale benchmark Audio-visual Scene-aware Dialogues (AVSD) (Alamri et al., 2019). We also adapt VilNMN for video QA and obtain the state-of-the-art on the TGIF-QA benchmark (Jang et al., 2017) across all tasks. Our experiments and ablation analysis indicate a potential direction to develop compositional and interpretable neural models for video-grounded language tasks.
25
+
26
+ # 2 RELATED WORK
27
+
28
+ Video QA has been a proxy for evaluating a model’s understanding capability of language and video and the task is treated as a visual information retrieval task. Jang et al. (2017); Gao et al. (2018); Jiang et al. (2020) propose to learn attention guided by question global representation to retrieve spatial-level and temporal-level visual features. Li et al. (2019); Fan et al. (2019); Jiang & Han (2020) model interaction between all pairs of question token-level representations and temporal-level features of input video. Extended from video QA, video-grounded dialogue is an emerging task that combines dialogue response generation and video-language understanding research. Nguyen et al. (2018); Hori et al. (2019); Hori et al. (2019); Sanabria et al. (2019); Le et al. (2019a;b) extend traditional QA models by adding dialogue history neural encoders. Kumar et al. (2019) enhances dialogue features with topic-level representations to express the general topic in each dialogue. Sanabria et al. (2019) considers the task as a video summary task and concatenates question and dialogue history into a single sequence and proposes to transfer parameter weights from a large-scale video summary model. Different from prior work, we dissect the question sequence and explicitly detect and decode any entities and their references. Our models also benefit from the additional insights on how models learn to use component linguistic inputs for extraction of visual information.
29
+
30
+ ![](images/c1042d57aa0064953fc1ccfac4878bbe8349871223ee844ed91ddeaf1edb3ed5.jpg)
31
+ Figure 2: VilNMN includes 4 major components: (1) encoders that encode dialogue and video components into continuous vector representations; (2) question parsers that parse question of the current dialogue turn into compositional programs for dialogue and video understanding; (3) an inventory of neural modules that operate on dialogue and video input components; and (4) a response decoder that generates natural language sequence using dialogue-based and video-based execution outputs.
32
+
33
+ Extending from the line of research on neural semantic parsing (Jia & Liang, 2016; Liang et al., 2017), Andreas et al. (2016b;a) introduce NMNs to address visual QA by decomposing questions into linguistic sub-structures, known as programs, to instantiate a network of neural modules. NMN models have achieved significant success in synthetic image domains where complex reasoning process is required (Johnson et al., 2017b; Hu et al., 2018; Han et al., 2019). Our work is related to the recent work that extends NMN models to real data domains. For instance, Kottur et al. (2018); Jiang & Bansal (2019); Gupta et al. (2020) extend NMNs to visual dialogues and reading comprehension tasks. In this paper, we introduce a new approach that exploits NMN to learn dependencies between the lexical composition in language inputs and the spatio-temporal dynamics in videos. This is not present in prior NMN models which are designed to apply on a two-dimensional image input without temporal variance. In video represented as sequence of images, each represented by object-level features, applying prior NMN models require aggregating frame-level features, e.g. through average pooling, resulting in potential loss of information. An alternative solution is a late-fusion method in which an NMN model performs reasoning structure programs on sampled video frames only. An object tracking mechanism or attention mechanism is then used to fuse the output representations. Instead, we propose to construct a reasoning structure with multi-step interaction between the space-time information in video with entity-action detected in text.
34
+
35
+ # 3 METHOD
36
+
37
+ In this section, we present the design of our model, called Visio-Linguistic Neural Module Networks (VilNMN). An overview of the model can be seen in Figure 2. The input to the model consists of a dialogue $\mathcal { D }$ which is grounded on a video $\nu$ . The input components include the question of current dialogue turn $\mathcal { Q }$ , dialogue history $\mathcal { H }$ , and the features of input video, including visual and audio input. The output is a dialogue response, denoted as $\mathcal { R }$ . Each text input component is a sequence of words $w _ { 1 } , . . . , \bar { w } _ { m } \in \mathbb { V } ^ { i n }$ , the input vocabulary. Similarly, the output response $\mathcal { R }$ is a sequence of tokens $w _ { 1 } , . . . , w _ { n } \in \mathbb { V } ^ { o u t }$ , the output vocabulary.
38
+
39
+ To learn compositional programs, we follow Johnson et al. (2017a); Hu et al. (2017) and consider program generation as a sequence-to-sequence task. Different from prior approaches, our models are trained to fully generate the parameters of component modules in text. This approach is appropriate as reasoning programs in real data domains such as current video-grounded dialogues are usually shorter than those for synthetic data (Johnson et al., 2017a) and thus, program generation takes less computational cost. However, module parameters, i.e. entities and actions, contain much higher semantic variance than synthetic data, and our approach facilitates better transparency and interpretability. We adopt a simple template $\mathrm { \langle \langle p a r a m _ { 1 } \rangle \langle m o d u l e _ { 1 } \rangle \langle p a r a m _ { 2 } \rangle \langle m o d u l e _ { 2 } \rangle . }$ .” as the target sequence. The resulting target sequences for dialogue and video understanding programs are sequences $\mathcal { P } _ { \mathrm { d i a l } }$ and $\mathcal { P } _ { \mathrm { v i d } }$ respectively.
40
+
41
+ Table 1: Description of the modules and their functionalities. We denote $P$ as the parameter to instantiate each module, $H$ as the dialogue history, $Q$ as the question of the current dialogue turn, and $V$ as video input.
42
+
43
+ <table><tr><td>Module</td><td>Input</td><td>Output</td><td>Description</td></tr><tr><td>find</td><td>P,H</td><td>Hent</td><td>Forrelated entities in question,select the relevant tokens from dialogue history</td></tr><tr><td>summarize</td><td>Hent,Q</td><td>Qctx</td><td>Based on contextual entity representations,summarise the question semantics</td></tr><tr><td>where</td><td>P,V</td><td>Vent</td><td>Select the relevant spatial position corresponding to original (resolved) entities</td></tr><tr><td>when</td><td>P,Vent</td><td>Vent+act</td><td>Select the relevant entity-aware temporal steps corresponding to the action parameter</td></tr><tr><td>describe</td><td>P,Vent+act</td><td>Vctx Vctx</td><td>Select visual entity-action features based on non-binary question types</td></tr><tr><td>exist</td><td>Q,Vent+act</td><td></td><td>Select visual entity-action features based on binary (yes/no) question types</td></tr></table>
44
+
45
+ # 3.1 ENCODERS
46
+
47
+ Text Encoder. A text encoder is shared to encode text inputs, including dialogue history, questions, and captions. The text encoder converts each text sequence $\mathcal { X } = w _ { 1 } , . . . , w _ { m }$ into a sequence of embeddings $\boldsymbol { X } \in \mathbb { R } ^ { m \times d }$ . We use a trainable embedding matrix to map token indices to vector representations of $d$ dimensions through a mapping function $\phi$ . These vectors are then integrated with ordering information of tokens through a positional encoding function with layer normalization (Ba et al., 2016; Vaswani et al., 2017). The embedding and positional representations are combined through element-wise summation. The encoded dialogue history and question of the current turn are defined as $H = \operatorname { N o r m } ( \phi ( \mathcal { H } ) + \operatorname { P E } ( \mathcal { H } ) ) \in \mathbb { R } ^ { L _ { \mathrm { H } } \times d }$ and $Q = \dot { \mathrm { N o r m } } ( \dot { \phi ( \mathcal { Q } ) } + \mathrm { P E } ( \mathcal { Q } ) ) \in \mathbb { R } ^ { L _ { \mathrm { Q } } \times d }$ .
48
+
49
+ To decode program and response sequences auto-repressively, a special token “_sos” is concatenated as the first token $w _ { 0 }$ . The decoded token $w _ { 1 }$ is then appended to $w _ { 0 }$ as input to decode $w _ { 2 }$ and so on. Similarly to input source sequences, at decoding time step $j$ , the input target sequence is encoded to obtain representations for dialogue understanding program $P _ { \mathrm { d i a l } } | _ { 0 } ^ { j - 1 }$ , video understanding program $P _ { \mathrm { v i d } } | _ { 0 } ^ { j - 1 }$ , and system response $R | _ { 0 } ^ { j - 1 }$ . We combine vocabulary of input and output sequences and share the embedding matrix $E \in \mathbb { R } ^ { | \mathbb { V } | \times d }$ where $\mathbb { V } = \mathbb { V } ^ { i n } \cap \mathbb { V } ^ { o u t }$ .
50
+
51
+ Video Encoder. To encode video input, we use pre-trained models to extract visual features and audio features. We denote $F$ as the sampled video frames or video clips. For object-level visual features, we denote $O$ as the maximum number of objects considered in each frame. The resulting output from a pretrained object detection model is $Z _ { \mathrm { o b j } } \in \mathbb { R } ^ { F \times O \times d _ { \mathrm { v i s } } }$ . We concatenate each object representation with the corresponding coordinates projected to $d _ { \mathrm { v i s } }$ dimensions. We also make use of a CNN-based pre-trained model to obtain features of temporal dimension $Z _ { \mathrm { c n n } } \in \mathbb { R } ^ { F \times d _ { \mathrm { v i s } } }$ . The audio feature is obtained through a pretrained audio model, $\boldsymbol { Z _ { \mathrm { a u d } } ^ { \star } } \in \mathbb { R } ^ { F \times d _ { \mathrm { a u d } } }$ . We passed all video features through a linear transformation layer with ReLU activation to the same embedding dimension $d$ .
52
+
53
+ # 3.2 NEURAL MODULES
54
+
55
+ We introduce neural modules that are used to assemble an executable program constructed by the generated sequence from question parsers. We provide an overview of neural modules in Table 1 and demonstrate dialogue understanding and video understanding modules in Figure 3 and 4 respectively. Each module parameter, e.g. “a backpack”, is extracted from the parsed program. For each parameter, we denote $P \in \mathbb { R } ^ { d }$ as the average pooling of component token embeddings.
56
+
57
+ find $( \pmb { \mathbb { P } } , \pmb { \mathbb { H } } ) \to \pmb { \mathbb { H } } _ { \mathrm { e n t } }$ . This module handles entity tracing by obtaining a distribution over tokens in dialogue history. We use an entity-to-dialogue-history attention mechanism applied from an entity $P _ { i }$ to all tokens in dialogue history. Any neural network that learn to generate attention between two tensors is applicable .e.g. (Bahdanau et al., 2015; Vaswani et al., 2017). The attention matrix normalized by softmax, $A _ { \mathrm { f i n d , i } } \in \mathbb { R } ^ { L _ { \mathrm { H } } }$ , is used to compute the weighted sum of dialogue history token representations. The output is combined with entity embedding $P _ { i }$ to obtain contextual entity representation $H _ { \mathrm { e n t , i } } \in \mathbb { R } ^ { d }$ .
58
+
59
+ summarize $( \mathbf { \delta H } _ { \mathrm { e n t } } , \mathbf { \delta Q } ) \to \mathbf { \delta Q } _ { \mathrm { c t x } }$ . For each contextual entity representation $H _ { \mathrm { e n t , i } }$ , $i = 1 , . . . , N _ { \mathrm { e n t } }$ , it is projected to $L _ { \mathrm { Q } }$ dimensions and is combined with question token embeddings through elementwise summation to obtain entity-aware question representation $Q _ { \mathrm { e n t , i } } \in \mathbb { R } ^ { L _ { \mathrm { Q } } \times d }$ . It is fed to a one-dimensional CNN with max pooling layer (Kim, 2014) to obtain a contextual entity-aware question representation. We denote the final output as $Q _ { \mathrm { c t x } } \in \mathbb { R } ^ { N _ { \mathrm { e n t } } \times d }$ .
60
+
61
+ While previous models usually focus on global or token-level dependencies (Hori et al., 2019; Le et al., 2019b) to encode question features, our modules compress fine-grained question representations at entity level. Specifically, find and summarize modules can generate entity-dependent local and global representations of question semantics. We show that our modularized approach can achieve better performance and transparency than traditional approaches to encode dialogue context (Serban et al., 2016; Vaswani et al., 2017) (Section 4).
62
+
63
+ ![](images/f85b6a3de3efb5d106598bd63ca55e04399de8753853806ee05d04fae2725123.jpg)
64
+ Figure 3: find and summarize neural modules for dialogue understanding
65
+
66
+ where $( \pmb { \mathrm { p } } , \pmb { \mathrm { v } } ) \pmb { \mathrm { v } } _ { \mathrm { e n t } }$ . Similar to the find module, this module handle entity-based attention to the video input. However, the entity representation $P$ in this case is parameterized by the original entity in dialogue rather than in question (See Section 3.3 for more description). Each entity $P _ { i }$ is stacked to match the number of sampled video frames/clips $F$ . An attention network is used to obtain entity-to-object attention matrix $A _ { \mathrm { w h e r e , i } } ^ { \bullet } \in \mathbb { R } ^ { F \times O }$ . The attended feature are compressed through weighted sum pooling along the spatial dimension, resulting in $V _ { \mathrm { e n t , i } } \in \mathbb { R } ^ { F \times d }$ , $i = 1 , . . . , N _ { \mathrm { e n t } }$ .
67
+
68
+ when $( \mathbb { P } , \pmb { \nabla } _ { \mathrm { e n t } } ) \pmb { \nabla } _ { \mathrm { e n t + a c t } }$ . This module follows a similar architecture as the where module. However, the action parameter $P _ { i }$ is stacked to match $N _ { \mathrm { e n t } }$ dimensions. The attention matrix $A _ { \mathrm { w h e n , i } } \in \mathbb { R } ^ { F }$ is then used to compute the visual entity-action representations through weighted sum along the temporal dimension. We denote the output for all actions $P _ { i }$ as $V _ { \mathrm { e n t + a c t } } \in \mathbb { R } ^ { N _ { \mathrm { e n t } } \times N _ { \mathrm { a c t } } \times d }$ describe $( \mathbb { P } , \nabla _ { \mathrm { e n t + a c t } } ) \to \mathbf { \nabla } \mathbf { V } _ { \mathrm { c t x } }$ . This module is a linear transformation to compute $V _ { \mathrm { c t x } } ~ =$ ${ W _ { \mathrm { d e s c } } } ^ { T } [ V _ { \mathrm { e n t + a c t } } ; P _ { \mathrm { s t a c k } } ] \in \mathbb { R } ^ { N _ { \mathrm { e n t } } \times N _ { \mathrm { a c t } } \times d }$ where $W _ { \mathrm { d e s c } } \in \mathrm { R } ^ { 2 d \times d }$ , $P _ { \mathrm { s t a c k } }$ is the stacked representations of parameter embedding $P$ to $N _ { \mathrm { e n t } } \times N _ { \mathrm { a c t } }$ dimensions, and $[ ; ]$ is the concatenation operation.
69
+
70
+ The exist module is a special case of describe module where the parameter $P$ is the average pooled question embeddings. The above where module is applied to object-level features. For temporal-based features such as CNN-based and audio features, the same neural operation is applied along the temporal dimension. Each resulting entity-aware output is then incorporated to frame-level features through element-wise summation (Please refer to Appendix A.1).
71
+
72
+ ![](images/fccd4959bc59d2dd1c8e856c9749101d47a87e9632762e7aba9a6f87cfbf6d66.jpg)
73
+ Figure 4: where and when neural modules for video understanding
74
+
75
+ An advantage of our architecture is that it separates dialogue and video understanding. We adopt a transparent approach to solve linguistic entity references during the dialogue understanding phase. The resolved entities are fed to the video understanding phase to learn entity-action dynamics in video. We show that our approach is robust when dialogue evolves to many turns and video extends over time (Please see Section 4 and Appendix C).
76
+
77
+ # 3.3 DECODERS
78
+
79
+ Question parsers. The parsers decompose questions into sub-sequences to construct compositional reasoning programs for dialogue and video understanding. Each parser is an attention-based Transformer decoder. Given the encoded question $Q$ , to decode program for dialogue understanding, the contextual signals are integrated through 2 attention layers: one attention on previously generated tokens, and the other on question tokens.
80
+
81
+ To generate programs for video understanding, the contextual signals are learned and incorporated in a similar manner. However, to exploit dialogue contextual cues, the execution output of dialogue understanding neural modules $Q _ { \mathrm { c t x } }$ (See Section 3.2) is incorporated to each vector in $P _ { \mathrm { v i d } }$ through an additional attention layer. This layer integrates the entity-dependent contextual representations from $Q _ { \mathrm { c t x } }$ to explicitly decode the original entities for video understanding programs.
82
+
83
+ Response Decoder. System response is decoded by incorporating the dialogue context and video context outputs from the corresponding reasoning programs to target token representations. We follows a vanilla Transformer decoder architecture (Le et al., 2019b), which consists of 3 attention layers: self-attention to attend on existing tokens, attention to $Q _ { \mathrm { c t x } }$ from dialogue understanding program execution, and attention to $V _ { \mathrm { c t x } }$ from video understanding program execution.
84
+
85
+ Optimization. We use the standard cross-entropy losses for prediction of dialogue and video understanding programs and output responses. We optimize models by joint training to minimize: $\begin{array} { r } { \mathcal { L } = \alpha \mathcal { L } _ { \mathrm { d i a l } } + \beta \mathcal { L } _ { \mathrm { v i d } } + \mathcal { L } _ { \mathrm { r e s } } = \alpha \sum _ { j } - \log ( \mathbf { P } _ { \mathrm { d i a l } } ( \mathcal { P } _ { \mathrm { d i a l } , \mathbf { j } } ) ) + \beta \sum _ { l } - \log ( \mathbf { P } _ { \mathrm { v i d e o } } ( \mathcal { P } _ { \mathrm { v i d e o } , 1 } ) ) + \sum _ { n } - \log ( \mathbf { P } _ { \mathrm { r e s } } ( \mathcal { R } _ { \mathrm { n } } ) ) } \end{array}$ where $\mathbf { P }$ is the probability distribution of an output token. The probability is computed by passing output representations from the parsers and decoder to a linear layer $\dot { W } \in \mathbb { R } ^ { d \times V }$ with softmax activation. We share the parameters between $W$ and embedding matrix $E$ . The hyper-parameters $\alpha \geq 0$ and $\beta \geq$ are fine-tuned during training.
86
+
87
+ # 4 EXPERIMENTS
88
+
89
+ Datasets. We use the AVSD benchmark from the $7 ^ { t h }$ Dialogue System Technology Challenge (DSTC7) (Hori et al., 2019). In the experiments with AVSD, we consider two settings: one with video summary and one without video summary as input. In the setting with video summary, the summary is concatenated to the dialogue history before the first dialogue turn. We also adapt VilNMN to the video QA benchmark TGIF-QA (Jang et al., 2017). Different from AVSD, TGIF-QA contains a diverse set of tasks, which address different visual aspects in video.
90
+
91
+ Training Procedure. We follow prior approaches (Hu et al., 2017; 2018; Kottur et al., 2018) by obtaining the annotations of the programs through a language parser (Hu et al., 2016) and a reference resolution model (Clark & Manning, 2016). During training, we directly use these soft labels of programs and the given ground-truth responses to train the models. The labels are augmented with label smoothing technique (Szegedy et al., 2016). During inference time, we generate all programs and responses from given dialogues and videos. We run beam search to enumerate programs for dialogue and video understanding and dialogue responses. (Please see Appendix B for more details).
92
+
93
+ AVSD Results. We evaluate model performance by the objective metrics based on word overlapping, including BLEU (Papineni et al., 2002), METEOR (Banerjee & Lavie, 2005), ROUGE-L (Lin, 2004), and CIDEr (Vedantam et al., 2015), between each generated response and 6 reference gold responses. As seen in Table 2, our models outperform most of existing approaches. In particular, the performance of our model in the setting without video summary input is comparable to the GPT-based RLM (Li et al., 2020) with much smaller model size. The Student-Teacher baseline (Hori et al., 2019) specifically focuses on the performance gap between models with and without textual signals from video summary through a dual network of expert and student models. Instead, VilNMN reduces this performance gap through efficiently extracting relevant visual/audio information based on fine-grained entity and action signals. We also found that VilNMN applied on object-level features is competitive to the model applied on CNN-based features. The flexibility of VilNMN neural programs can also be seen in the experiment when the video understanding program is applied on the caption input as a visual feature.
94
+
95
+ Ablation Analysis. We experiment with several variants of VilMNM (either NMN or non-NMNbased) in the setting with CNN based features and video summary input As can be seen in Table 3, our approach to video and dialogue understanding through compositional reasoning programs exhibits better performance than non-compositional approaches. Compared to the approaches that directly process frame-level features in videos (Row B) or token-level features in dialogues (Row C, D), our full VilNMN (Row A) considers entity-level and action-level information extraction and thus, avoids unnecessary and possibly noisy extraction. Compared to the approaches that obtain dialogue contextual cues through a hierarchical encoding architecture (Row E, F) such as (Serban et al., 2016; Hori et al., 2019), VilNMN directly addresses the challenge of entity references in dialogues. As mentioned, we hypothesize that the hierarchical encoding architecture is more appropriate for less entity-sensitive dialogues such as chit-chat and open-domain dialogues. Please see Appendix C for additional analysis of performance breakdown by dialogue turns and video lengths.
96
+
97
+ Table 2: AVSD test results: The visual features are: I (I3D), ResNeXt-101 (RX), Faster-RCNN (FR), C (caption as a video input). The audio features are: VGGish (V), AclNet (A). Xon PT denotes models using pretrained weights and/or additional finetuning. Best and second best results are bold and underlined respectively.
98
+
99
+ <table><tr><td>Model</td><td>PT</td><td>Visual</td><td>Audio</td><td>BLEU4</td><td>METEOR</td><td>ROUGE-L</td><td>CIDEr</td></tr><tr><td colspan="6">Audio/Visual only (without Video Summary/Caption)</td><td></td><td></td></tr><tr><td>Baseline (Hori et al.,2019)</td><td></td><td>I</td><td>■</td><td>0.305</td><td>0.217</td><td>0.481</td><td>0.733</td></tr><tr><td>Baseline (Hori et al.,2019)</td><td></td><td>I</td><td>V</td><td>0.309</td><td>0.215</td><td>0.487</td><td>0.746</td></tr><tr><td>Baseline+GRU+Attn.(Le et al.,2019a)</td><td></td><td>I</td><td>V</td><td>0.315</td><td>0.239</td><td>0.509</td><td>0.848</td></tr><tr><td>FGA (Schwartz et al.,2019)</td><td></td><td>I</td><td>V</td><td></td><td></td><td></td><td>0.806</td></tr><tr><td>JMAN (Chu et al., 2020)</td><td></td><td>I</td><td>-</td><td>0.309</td><td>0.240</td><td>0.520</td><td>0.890</td></tr><tr><td>Student-Teacher (Hori et al.,2019)</td><td></td><td>I</td><td>V</td><td>0.371</td><td>0.248</td><td>0.527</td><td>0.966</td></tr><tr><td>MTN (Le et al.,2019b)</td><td></td><td>I</td><td>-</td><td>0.343</td><td>0.247</td><td>0.520</td><td>0.936</td></tr><tr><td>MTN (Le et al., 2019b)</td><td></td><td>I</td><td>V</td><td>0.368</td><td>0.259</td><td>0.537</td><td>0.964</td></tr><tr><td>MSTN (Lee et al.,2020)</td><td></td><td>I</td><td>V</td><td>0.379</td><td>0.261</td><td>0.548</td><td>1.028</td></tr><tr><td>RLM-GPT2 (Li et al., 2020)</td><td>√</td><td>I</td><td>V</td><td>0.402</td><td>0.254</td><td>0.544</td><td>1.052</td></tr><tr><td>VilNMN</td><td>=</td><td>I</td><td>-</td><td>0.397</td><td>0.262</td><td>0.550</td><td>1.059</td></tr><tr><td>VilNMN</td><td></td><td>FR</td><td>■</td><td>0.388</td><td>0.259</td><td>0.549</td><td>1.040</td></tr><tr><td>VilNMN</td><td></td><td>-</td><td>V</td><td>0.381</td><td>0.252</td><td>0.534</td><td>1.004</td></tr><tr><td>VilNMN</td><td></td><td>I</td><td>V</td><td>0.396</td><td>0.263</td><td>0.549</td><td>1.059</td></tr><tr><td colspan="6">Audio/Visual only (with Video Summary/Caption)</td><td></td><td></td></tr><tr><td>TopicEmb (Kumar et al.,2019)</td><td></td><td>I</td><td>A</td><td>0.329</td><td>0.223</td><td>0.488</td><td>0.762</td></tr><tr><td>Baseline+GRU+Attn.(Le et al.,2019a)</td><td></td><td>I</td><td>V</td><td>0.310</td><td>0.242</td><td>0.515</td><td>0.856</td></tr><tr><td>JMAN (Chu et al., 2020)</td><td></td><td>I</td><td>-</td><td>0.334</td><td>0.239</td><td>0.533</td><td>0.941</td></tr><tr><td>FA+HRED (Nguyen et al., 2018)</td><td>=</td><td>I</td><td>V</td><td>0.360</td><td>0.249</td><td>0.544</td><td>0.997</td></tr><tr><td>VideoSum (Sanabria etal.,2019)</td><td>=</td><td>RX</td><td>-</td><td>0.394</td><td>0.267</td><td>0.563</td><td>1.094</td></tr><tr><td>VideoSum+How2 (Sanabria et al.,2019)</td><td>√</td><td>RX</td><td>-</td><td>0.387</td><td>0.266</td><td>0.564</td><td>1.087</td></tr><tr><td>MSTN (Lee et al.,2020)</td><td></td><td>I</td><td>V</td><td>0.377</td><td>0.275</td><td>0.566</td><td>1.115</td></tr><tr><td>Student-Teacher (Hori et al.,2019)</td><td></td><td>I</td><td>V</td><td>0.405</td><td>0.273</td><td>0.566</td><td>1.118</td></tr><tr><td>MTN (Le et al.,2019b)</td><td></td><td>I</td><td>-</td><td>0.392</td><td>0.269</td><td>0.559</td><td>1.066</td></tr><tr><td>MTN (Le et al.,2019b)</td><td></td><td>I</td><td>V</td><td>0.410</td><td>0.274</td><td>0.569</td><td>1.129</td></tr><tr><td>VGD-GPT2 (Le &amp; Hoi,2020)</td><td>√</td><td>I</td><td>V</td><td>0.436</td><td>0.282</td><td>0.579</td><td>1.194</td></tr><tr><td>RLM-GPT2 (Li et al., 2020)</td><td>√</td><td>I</td><td>V</td><td>0.459</td><td>0.294</td><td>0.606</td><td>1.308</td></tr><tr><td>VilNMN</td><td>■</td><td>I</td><td>1</td><td>0.421</td><td>0.277</td><td>0.574</td><td>1.171</td></tr><tr><td>VilNMN</td><td></td><td>FR</td><td>-</td><td>0.421</td><td>0.275</td><td>0.571</td><td>1.148</td></tr><tr><td>VilNMN</td><td></td><td>I</td><td>V</td><td>0.421</td><td>0.277</td><td>0.573</td><td>1.167</td></tr><tr><td>VilNMN</td><td></td><td>I+C</td><td>V</td><td>0.429</td><td>0.278</td><td>0.578</td><td>1.188</td></tr></table>
100
+
101
+ Table 3: Ablation analysis of VilNMN with different model variants on the test split of the AVSD benchmark
102
+
103
+ <table><tr><td>#</td><td>ModelVariant</td><td>BLEU4</td><td>CIDEr</td></tr><tr><td>A</td><td>FullVilNMN</td><td>0.421</td><td>1.171</td></tr><tr><td>B</td><td>No video NMNs; + vanilla text-→video attention</td><td>0.415</td><td>1.159</td></tr><tr><td>C</td><td>→No dial.NMNs;+ response-→history attention</td><td>0.412</td><td>1.151</td></tr><tr><td>D</td><td>→No dial.NMNs;+ response-→concat(history+question) attention</td><td>0.411</td><td>1.133</td></tr><tr><td>E</td><td>No dial.NMNs;+ HREDLsTM(history) + question attn.</td><td>0.414</td><td>1.153</td></tr><tr><td>F</td><td>→No dial.NMNs; + HREDGRU(history) + question attn.</td><td>0.415</td><td>1.138</td></tr></table>
104
+
105
+ Intepretability. A difference of VilNMN from previous approaches to video-grounded dialogues is the model interpretability based on the predicted dialogue and video programs. From Figure 5, we observe that in cases where predicted dialogue programs and video program match or are close to the gold labels, the model can generate generally correct responses. In cases of wrong predicted responses, we can further look at how the model understands the questions based on predicted programs. In the $3 ^ { r d }$ turn of example 1, the output response is missing a minor detail as compared to the label response because the video program fails to capture the parameter “rooftop”. These subtle yet important details can determine whether output responses can fully address user queries. Similarly, in example 2, the model answers the question “what room” instead of question about “an object”. For additional qualitative analysis, please see Appendix D.
106
+
107
+ TGIF-QA Results. In TGIF-QA experiments, we report the result using the L2 loss in Count task and accuracy in other tasks. From Table 4, VilNMN outperforms all baseline models in all tasks by a large margin. Compared to AVSD experiments, the TGIF-QA experiments emphasize video understanding ability of the models, removing the requirement for dialogue understanding and natural language generation. This is demonstrated through higher performance gaps between VilNMN with generated programs and soft label programs as compared to ones in AVSD experiments. We also observe that an attention layer attending to question is important during the response decoding phase in TGIF-QA as there is no dialogue context $Q _ { \mathrm { c t x } }$ in Video QA tasks.
108
+
109
+ ![](images/b76cdb81c535fa60c73e2ed0fbce53a5355fe5d0af1cb511403543cd18aa93a9.jpg)
110
+
111
+ <table><tr><td rowspan=1 colspan=1>Turn</td><td rowspan=1 colspan=1>Question</td><td rowspan=1 colspan=1>Dialogue NMN</td><td rowspan=1 colspan=1>Video NMN</td><td rowspan=1 colspan=1>Response</td></tr><tr><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>...what are theydoing in the scene ?are they on arooftop?</td><td rowspan=1 colspan=1>Predicted:find(they),find(the scene)→summarize()×Gold: find(they)→summarize()</td><td rowspan=1 colspan=1>Predicted: where(two men in thevideo),where(the scene)→when(doing inthe scene)→describe(what)Gold:where(two men),where (rooftop)→when(doing in the scene)-describe(what)</td><td rowspan=1 colspan=1>Predicted: one is washinga chair and the other istaking picturesXGold: yes,on a secondfloor roof deck ,one man iswashing a chair,anotherman is either filming ortaking pictures</td></tr><tr><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>does he sit in thechair after washingit?</td><td rowspan=1 colspan=1>Predicted:find (he),find(the chair)→summarize()Gold: find(he),find(the chair)→summarize()</td><td rowspan=1 colspan=1>Predicted: where(one man in the video),where(a chair)→ when(sit in the chairafter washing it)-exist()Gold:where(one man),where(a chair)→when(sit in the chair after washingit)-exist()</td><td rowspan=1 colspan=1>Predicted: no, he does notsit in the chair√Gold: no he does not,thereis a pipe with water runningall over</td></tr></table>
112
+
113
+ ![](images/b2ce15a7da399a54da904703872d8a7d046bcc27067064f947a84577c92b87c0.jpg)
114
+
115
+ ![](images/181282280ef506314f5ed0b0226febd77d1a2bd127b0b5c7121f865b44526cc7.jpg)
116
+
117
+ Figure 5: Intepretability of model outputs from a dialogue in the test split of the AVSD benchmark.
118
+ Table 4: Experiment results on the TGIF-QA benchmark. The visual features are: ResNet-152 (R), C3D (C), Flow CNN from two-stream model (F), VGG (V), ResNeXt-101 (RX).
119
+
120
+ <table><tr><td>Model</td><td>Visual</td><td>Count (Loss)</td><td>Action (Acc)</td><td>Transition (Acc)</td><td>FrameQA (Acc)</td></tr><tr><td>VIS(avg) (Ren et al.,2015a)</td><td>R</td><td>4.80</td><td>0.488</td><td>0.348</td><td>0.350</td></tr><tr><td>MCB (aggr) (Fukui et al.,2016)</td><td>R</td><td>5.17</td><td>0.589</td><td>0.243</td><td>0.257</td></tr><tr><td>Yu et al. (Yu et al., 2017)</td><td>R</td><td>5.13</td><td>0.561</td><td>0.640</td><td>0.396</td></tr><tr><td>ST-VQA (t) (Gao et al., 2018)</td><td>R+F</td><td>4.32</td><td>0.629</td><td>0.694</td><td>0.495</td></tr><tr><td>Co-Mem (Gao et al.,2018)</td><td>R+F</td><td>4.10</td><td>0.682</td><td>0.743</td><td>0.515</td></tr><tr><td>PSAC (Li et al.,2019)</td><td>R</td><td>4.27</td><td>0.704</td><td>0.769</td><td>0.557</td></tr><tr><td>HME (Fan et al.,2019)</td><td>R+C</td><td>4.02</td><td>0.739</td><td>0.778</td><td>0.538</td></tr><tr><td>STA (Gao et al.,2019)</td><td>R</td><td>4.25</td><td>0.723</td><td>0.790</td><td>0.566</td></tr><tr><td>CRN+MAC (Le et al.,2019c)</td><td>R</td><td>4.23</td><td>0.713</td><td>0.787</td><td>0.592</td></tr><tr><td>MQL (Lei et al., 2020)</td><td>V</td><td>-</td><td>-</td><td>-</td><td>0.598</td></tr><tr><td>QueST (Jiang et al.,2020)</td><td>R</td><td>4.19</td><td>0.759</td><td>0.810</td><td>0.597</td></tr><tr><td>HGA (Jiang &amp; Han,2020)</td><td>R+C</td><td>4.09</td><td>0.754</td><td>0.810</td><td>0.551</td></tr><tr><td>GCN (Huang et al., 2020)</td><td>R+C</td><td>3.95</td><td>0.743</td><td>0.811</td><td>0.563</td></tr><tr><td>HCRN (Le et al.,2020)</td><td>R+RX</td><td>3.82</td><td>0.750</td><td>0.814</td><td>0.559</td></tr><tr><td>VilNMN</td><td>R</td><td>2.65</td><td>0.845</td><td>0.887</td><td>0.747</td></tr><tr><td>→soft label programs</td><td>R</td><td>1.90</td><td>0.857</td><td>0.898</td><td>0.780</td></tr><tr><td>→- res-to-question attn.</td><td>R</td><td>3.28</td><td>0.801</td><td>0.776</td><td>0.679</td></tr></table>
121
+
122
+ # 5 CONCLUSION
123
+
124
+ While conventional neural network approaches have achieved notable successes in video-grounded dialogues and video QA, they often rely on superficial pattern learning principles between contextual cues from questions/dialogues and videos. In this work, we introduce Visio-Linguistic Neural Module Network (VilNMN). VilNMN consists of dialogue and video understanding neural modules, each of which performs entity and action-level operations on language and video components. Our comprehensive experiments on AVSD and TGIF-QA benchmarks show that our models can achieve competitive performance while promoting a compositional and interpretable learning approach.
125
+
126
+ # REFERENCES
127
+
128
+ Aishwarya Agrawal, Dhruv Batra, and Devi Parikh. Analyzing the behavior of visual question answering models. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pp. 1955–1960, Austin, Texas, November 2016. Association for Computational Linguistics. doi: 10.18653/v1/D16-1203. URL https://www.aclweb.org/anthology/D16-1203.
129
+
130
+ Huda Alamri, Vincent Cartillier, Abhishek Das, Jue Wang, Stefan Lee, Peter Anderson, Irfan Essa, Devi Parikh, Dhruv Batra, Anoop Cherian, Tim K. Marks, and Chiori Hori. Audio-visual sceneaware dialog. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2019.
131
+
132
+ Jacob Andreas, Marcus Rohrbach, Trevor Darrell, and Dan Klein. Learning to compose neural networks for question answering. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 1545–1554, San Diego, California, June 2016a. Association for Computational Linguistics. doi: 10.18653/v1/N16-1181. URL https://www.aclweb.org/anthology/N16-1181.
133
+
134
+ Jacob Andreas, Marcus Rohrbach, Trevor Darrell, and Dan Klein. Neural module networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 39–48, 2016b.
135
+
136
+ Stanislaw Antol, Aishwarya Agrawal, Jiasen Lu, Margaret Mitchell, Dhruv Batra, C Lawrence Zitnick, and Devi Parikh. Vqa: Visual question answering. In Proceedings of the IEEE international conference on computer vision, pp. 2425–2433, 2015.
137
+
138
+ Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016.
139
+
140
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In Yoshua Bengio and Yann LeCun (eds.), 3rd International Conference on Learning Representations, ICLR 2015, San Diego, CA, USA, May 7-9, 2015, Conference Track Proceedings, 2015. URL http://arxiv.org/abs/1409.0473.
141
+
142
+ Satanjeev Banerjee and Alon Lavie. Meteor: An automatic metric for mt evaluation with improved correlation with human judgments. In Proceedings of the acl workshop on intrinsic and extrinsic evaluation measures for machine translation and/or summarization, pp. 65–72, 2005.
143
+
144
+ Joao Carreira and Andrew Zisserman. Quo vadis, action recognition? a new model and the kinetics dataset. In proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 6299–6308, 2017.
145
+
146
+ Yun-Wei Chu, Kuan-Yen Lin, Chao-Chun Hsu, and Lun-Wei Ku. Multi-step joint-modality attention network for scene-aware dialogue system. DSTC Workshop @ AAAI, 2020.
147
+
148
+ Kevin Clark and Christopher D. Manning. Deep reinforcement learning for mention-ranking coreference models. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pp. 2256–2262, Austin, Texas, November 2016. Association for Computational Linguistics. doi: 10.18653/v1/D16-1245. URL https://www.aclweb.org/anthology/ D16-1245.
149
+
150
+ Mostafa Dehghani, Stephan Gouws, Oriol Vinyals, Jakob Uszkoreit, and Lukasz Kaiser. Universal transformers. In International Conference on Learning Representations, 2019. URL https: //openreview.net/forum?id ${ . } =$ HyzdRiR9Y7.
151
+
152
+ Chenyou Fan, Xiaofan Zhang, Shu Zhang, Wensheng Wang, Chi Zhang, and Heng Huang. Heterogeneous memory enhanced multimodal attention model for video question answering. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1999–2007, 2019.
153
+
154
+ Shi Feng, Eric Wallace, Alvin Grissom II, Mohit Iyyer, Pedro Rodriguez, and Jordan Boyd-Graber. Pathologies of neural models make interpretations difficult. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 3719–3728, Brussels, Belgium, October-November 2018. Association for Computational Linguistics. doi: 10.18653/v1/D18-1407. URL https://www.aclweb.org/anthology/D18-1407.
155
+
156
+ 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 Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pp. 457–468, Austin, Texas, November 2016. Association for Computational Linguistics. doi: 10.18653/v1/D16-1044. URL https://www.aclweb.org/anthology/D16-1044.
157
+
158
+ Jiyang Gao, Runzhou Ge, Kan Chen, and Ram Nevatia. Motion-appearance co-memory networks for video question answering. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 6576–6585, 2018.
159
+
160
+ Lianli Gao, Pengpeng Zeng, Jingkuan Song, Yuan-Fang Li, Wu Liu, Tao Mei, and Heng Tao Shen. Structured two-stream attention network for video question answering. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pp. 6391–6398, 2019.
161
+
162
+ 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.
163
+
164
+ Yash Goyal, Tejas Khot, Douglas Summers-Stay, Dhruv Batra, and Devi Parikh. Making the v in vqa matter: Elevating the role of image understanding in visual question answering. In CVPR, volume 1, pp. 3, 2017.
165
+
166
+ Nitish Gupta, Kevin Lin, Dan Roth, Sameer Singh, and Matt Gardner. Neural module networks for reasoning over text. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ SygWvAVFPr.
167
+
168
+ Chi Han, Jiayuan Mao, Chuang Gan, Josh Tenenbaum, and Jiajun Wu. Visual concept-metaconcept learning. In Advances in Neural Information Processing Systems, pp. 5002–5013, 2019.
169
+
170
+ 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.
171
+
172
+ Shawn Hershey, Sourish Chaudhuri, Daniel PW Ellis, Jort F Gemmeke, Aren Jansen, R Channing Moore, Manoj Plakal, Devin Platt, Rif A Saurous, Bryan Seybold, et al. Cnn architectures for large-scale audio classification. In Acoustics, Speech and Signal Processing (ICASSP), 2017 IEEE International Conference on, pp. 131–135. IEEE, 2017.
173
+
174
+ C. Hori, H. Alamri, J. Wang, G. Wichern, T. Hori, A. Cherian, T. K. Marks, V. Cartillier, R. G. Lopes, A. Das, I. Essa, D. Batra, and D. Parikh. End-to-end audio visual scene-aware dialog using multimodal attention-based video features. In ICASSP 2019 - 2019 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 2352–2356, May 2019. doi: 10.1109/ICASSP.2019.8682583.
175
+
176
+ Chiori Hori, Anoop Cherian, Tim K Marks, and Takaaki Hori. Joint student-teacher learning for audio-visual scene-aware dialog. Proc. Interspeech 2019, pp. 1886–1890, 2019.
177
+
178
+ Ronghang Hu, Huazhe Xu, Marcus Rohrbach, Jiashi Feng, Kate Saenko, and Trevor Darrell. Natural language object retrieval. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4555–4564, 2016.
179
+
180
+ Ronghang Hu, Jacob Andreas, Marcus Rohrbach, Trevor Darrell, and Kate Saenko. Learning to reason: End-to-end module networks for visual question answering. In Proceedings of the IEEE International Conference on Computer Vision, pp. 804–813, 2017.
181
+
182
+ Ronghang Hu, Jacob Andreas, Trevor Darrell, and Kate Saenko. Explainable neural computation via stack neural module networks. In Proceedings of the European conference on computer vision (ECCV), pp. 53–69, 2018.
183
+
184
+ Deng Huang, Peihao Chen, Runhao Zeng, Qing Du, Mingkui Tan, and Chuang Gan. Location-aware graph convolutional networks for video question answering. In The AAAI Conference on Artificial Intelligence (AAAI), volume 1, 2020.
185
+
186
+ Yunseok Jang, Yale Song, Youngjae Yu, Youngjin Kim, and Gunhee Kim. Tgif-qa: Toward spatiotemporal reasoning in visual question answering. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2758–2766, 2017.
187
+
188
+ Robin Jia and Percy Liang. Data recombination for neural semantic parsing. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 12–22, Berlin, Germany, August 2016. Association for Computational Linguistics. doi: 10.18653/v1/P16-1002. URL https://www.aclweb.org/anthology/P16-1002.
189
+
190
+ Jianwen Jiang, Ziqiang Chen, Haojie Lin, Xibin Zhao, and Yue Gao. Divide and conquer: Questionguided spatio-temporal contextual attention for video question answering. In The AAAI Conference on Artificial Intelligence (AAAI), 2020.
191
+
192
+ Pin Jiang and Yahong Han. Reasoning with heterogeneous graph alignment for video question answering. In The AAAI Conference on Artificial Intelligence (AAAI), 2020.
193
+
194
+ Yichen Jiang and Mohit Bansal. Self-assembling modular networks for interpretable multi-hop reasoning. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLPIJCNLP), pp. 4474–4484, Hong Kong, China, November 2019. Association for Computational Linguistics. doi: 10.18653/v1/D19-1455. URL https://www.aclweb.org/anthology/ D19-1455.
195
+
196
+ Justin Johnson, Bharath Hariharan, Laurens van der Maaten, Li Fei-Fei, C Lawrence Zitnick, and Ross Girshick. Clevr: A diagnostic dataset for compositional language and elementary visual reasoning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2901–2910, 2017a.
197
+
198
+ Justin Johnson, Bharath Hariharan, Laurens Van Der Maaten, Judy Hoffman, Li Fei-Fei, C Lawrence Zitnick, and Ross Girshick. Inferring and executing programs for visual reasoning. In Proceedings of the IEEE International Conference on Computer Vision, pp. 2989–2998, 2017b.
199
+
200
+ Yoon Kim. Convolutional neural networks for sentence classification. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 1746–1751, Doha, Qatar, October 2014. Association for Computational Linguistics. doi: 10.3115/v1/D14-1181. URL https://www.aclweb.org/anthology/D14-1181.
201
+
202
+ Diederick P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations (ICLR), 2015.
203
+
204
+ Satwik Kottur, José MF Moura, Devi Parikh, Dhruv Batra, and Marcus Rohrbach. Visual coreference resolution in visual dialog using neural module networks. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 153–169, 2018.
205
+
206
+ Shachi H Kumar, Eda Okur, Saurav Sahay, Jonathan Huang, and Lama Nachman. Leveraging topics and audio features with multimodal attention for audio visual scene-aware dialog. arXiv preprint arXiv:1912.10131, 2019.
207
+
208
+ Hung Le and Steven C.H. Hoi. Video-grounded dialogues with pretrained generation language models. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 5842–5848, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020. acl-main.518. URL https://www.aclweb.org/anthology/2020.acl-main.518.
209
+
210
+ Hung Le, S Hoi, Doyen Sahoo, and N Chen. End-to-end multimodal dialog systems with hierarchical multimodal attention on video features. In DSTC7 at AAAI2019 workshop, 2019a.
211
+
212
+ Hung Le, Doyen Sahoo, Nancy Chen, and Steven Hoi. Multimodal transformer networks for end-to-end video-grounded dialogue systems. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 5612–5623, Florence, Italy, July 2019b. Association for Computational Linguistics. doi: 10.18653/v1/P19-1564. URL https://www.aclweb. org/anthology/P19-1564.
213
+
214
+ Thao Minh Le, Vuong Le, Svetha Venkatesh, and Truyen Tran. Learning to reason with relational video representation for question answering. arXiv preprint arXiv:1907.04553, 2019c.
215
+
216
+ Thao Minh Le, Vuong Le, Svetha Venkatesh, and Truyen Tran. Hierarchical conditional relation networks for video question answering. arXiv preprint arXiv:2002.10698, 2020.
217
+
218
+ Hwanhee Lee, Seunghyun Yoon, Franck Dernoncourt, Doo Soon Kim, Trung Bui, and Kyomin Jung. Dstc8-avsd: Multimodal semantic transformer network with retrieval style word generator. DSTC Workshop @ AAAI 2020, 2020.
219
+
220
+ Chenyi Lei, Lei Wu, Dong Liu, Zhao Li, Guoxin Wang, Haihong Tang, and Houqiang Li. Multiquestion learning for visual question answering. In The AAAI Conference on Artificial Intelligence (AAAI), 2020.
221
+
222
+ Jie Lei, Licheng Yu, Mohit Bansal, and Tamara Berg. TVQA: Localized, compositional video question answering. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 1369–1379, Brussels, Belgium, October-November 2018. Association for Computational Linguistics. doi: 10.18653/v1/D18-1167. URL https://www.aclweb. org/anthology/D18-1167.
223
+
224
+ Jiwei Li, Michel Galley, Chris Brockett, Georgios Spithourakis, Jianfeng Gao, and Bill Dolan. A persona-based neural conversation model. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 994–1003, Berlin, Germany, August 2016. Association for Computational Linguistics. doi: 10.18653/v1/P16-1094. URL https://www.aclweb.org/anthology/P16-1094.
225
+
226
+ Xiangpeng Li, Jingkuan Song, Lianli Gao, Xianglong Liu, Wenbing Huang, Xiangnan He, and Chuang Gan. Beyond rnns: Positional self-attention with co-attention for video question answering. In The 33rd AAAI Conference on Artificial Intelligence, volume 8, 2019.
227
+
228
+ Zekang Li, Zongjia Li, Jinchao Zhang, Yang Feng, Cheng Niu, and Jie Zhou. Bridging text and video: A universal multimodal transformer for video-audio scene-aware dialog. arXiv preprint arXiv:2002.00163, 2020.
229
+
230
+ Chen Liang, Jonathan Berant, Quoc Le, Kenneth D. Forbus, and Ni Lao. Neural symbolic machines: Learning semantic parsers on Freebase with weak supervision. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 23–33, Vancouver, Canada, July 2017. Association for Computational Linguistics. doi: 10.18653/v1/P17-1003. URL https://www.aclweb.org/anthology/P17-1003.
231
+
232
+ Chin-Yew Lin. Rouge: A package for automatic evaluation of summaries. Text Summarization Branches Out, 2004.
233
+
234
+ Dat Tien Nguyen, Shikhar Sharma, Hannes Schulz, and Layla El Asri. From film to video: Multi-turn question answering with multi-modal context. In AAAI 2019 Dialog System Technology Challenge (DSTC7) Workshop, December 2018.
235
+
236
+ Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. Bleu: a method for automatic evaluation of machine translation. In Proceedings of the 40th annual meeting on association for computational linguistics, pp. 311–318. Association for Computational Linguistics, 2002.
237
+
238
+ Mengye Ren, Ryan Kiros, and Richard Zemel. Exploring models and data for image question answering. In Advances in neural information processing systems, pp. 2953–2961, 2015a.
239
+
240
+ Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster R-CNN: Towards real-time object detection with region proposal networks. In Advances in Neural Information Processing Systems (NIPS), 2015b.
241
+
242
+ Ramon Sanabria, Shruti Palaskar, and Florian Metze. Cmu sinbad’s submission for the dstc7 avsd challenge. In DSTC7 at AAAI2019 workshop, volume 6, 2019.
243
+
244
+ Idan Schwartz, Seunghak Yu, Tamir Hazan, and Alexander G Schwing. Factor graph attention. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2039–2048, 2019.
245
+
246
+ Iulian V Serban, Alessandro Sordoni, Yoshua Bengio, Aaron Courville, and Joelle Pineau. Building end-to-end dialogue systems using generative hierarchical neural network models. In Thirtieth AAAI Conference on Artificial Intelligence, 2016.
247
+
248
+ Sofia Serrano and Noah A. Smith. Is attention interpretable? In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 2931–2951, Florence, Italy, July 2019. Association for Computational Linguistics. doi: 10.18653/v1/P19-1282. URL https: //www.aclweb.org/anthology/P19-1282.
249
+
250
+ Gunnar A Sigurdsson, Gül Varol, Xiaolong Wang, Ali Farhadi, Ivan Laptev, and Abhinav Gupta. Hollywood in homes: Crowdsourcing data collection for activity understanding. In European Conference on Computer Vision, pp. 510–526. Springer, 2016.
251
+
252
+ Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. The Journal of Machine Learning Research, 15(1):1929–1958, 2014.
253
+
254
+ Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2818–2826, 2016.
255
+
256
+ 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.
257
+
258
+ Ramakrishna Vedantam, C Lawrence Zitnick, and Devi Parikh. Cider: Consensus-based image description evaluation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 4566–4575, 2015.
259
+
260
+ Youngjae Yu, Hyungjin Ko, Jongwook Choi, and Gunhee Kim. End-to-end concept word detection for video captioning, retrieval, and question answering. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 3165–3173, 2017.
261
+
262
+ # A ADDITIONAL MODEL DETAILS
263
+
264
+ # A.1 NEURAL MODULES ON TEMPORAL FEATURES
265
+
266
+ To adapt our neural modules to temporal features, we apply the same neural architectures in all modules except for the where module. In object-level features, this module operates on object-based or spatial-based level. We can apply this module to temporal-based features similarly simply by not stacking the parameter and pooling the attended features along the temporal dimension. For an entity parameter $P _ { i }$ , the attention matrix in this case is an entity-to-temporal-step matrix $A _ { \mathrm { w h e r e , i } } \in \mathbb { R } ^ { \tilde { F } }$ and the resulting pooled feature is $V _ { \mathrm { e n t , i } } \in \mathbb { R } ^ { d }$ . Before feeding this representation to a when module, we incorporate each $V _ { \mathrm { e n t , i } }$ into feature of each temporal step through an MLP layer and element-wise summation, resulting in overview of the where $V _ { \mathrm { e n t , i } } ^ { s t a c k } \in \mathbb { R } ^ { \mathrm { F } \times d }$ where poral $F$ is the number of sampled video frames/clips. Antures can be seen in Figure 6.
267
+
268
+ ![](images/00f0a2cc042a838be019c96ec5a63325ec1007abd58e16de83f1037dc0c8f8c8.jpg)
269
+ Figure 6: Adaptation of the where module to temporal-based features
270
+
271
+ We adapt this module in a similar manner to other temporal-level features such as audio and textual features such as video caption. We keep the same architecture in the when module. We denote the resulting output from the when module for all actions $P _ { i }$ is $V _ { \mathrm { a c t } } \in \mathbb { R } ^ { N _ { \mathrm { a c t } } \times d }$ . We concatenate this to the output from the previous where module $V _ { \mathrm { e n t } }$ to obtain $V _ { \mathrm { e n t + a c t } } \in \mathbb { R } ^ { ( N _ { \mathrm { e n t } } + N _ { \mathrm { a c t } } ) \times d }$ . This is used as input to the describe or exist module.
272
+
273
+ # A.2 QUESTION PARSER
274
+
275
+ The parsers decompose questions into sub-sequences to construct compositional reasoning programs for dialogue and video understanding. Each parser is an attention-based Transformer decoder. The Transformer attention is a multi-head attention on query, key, and value tensors, denoted as Attention(Query, Key, Value). For each token in the Query sequence , the distribution over tokens in the Key sequence is used to obtain the weighted sum of the corresponding representations in the Value sequence.
276
+
277
+ $$
278
+ { \mathrm { A t t e n t i o n } } ( Q u e r y , K e y , V a l u e ) = { \mathrm { s o f t m a x } } ( { \frac { Q u e r y K e y ^ { T } } { \sqrt { d _ { k e y } } } } ) V a l u e \in \mathbb { R } ^ { L _ { \mathrm { q u e r y } } \times d _ { \mathrm { q u e r y } } }
279
+ $$
280
+
281
+ Each attention is followed by a feed-forward network applied on each position identically. We exploit the multi-head and feed-forward architecture, which show good performance in NLP tasks such as NMT and QA (Vaswani et al., 2017; Dehghani et al., 2019), to efficiently incorporate contextual cues from dialogue components to parse question into reasoning programs. Given the encoded question $Q$ , to decode program for dialogue understanding, the contextual signals are integrated through 2 attention layers: one attention on previously generated tokens, and the other on question tokens. At time step $j$ , we denote the output from an attention layer as $A _ { \mathrm { d i a l , j } }$ .
282
+
283
+ $$
284
+ \begin{array} { r l } & { A _ { \mathrm { d i a l } } ^ { ( 1 ) } = \mathrm { A t t e n t i o n } ( P _ { \mathrm { d i a l } } | _ { 0 } ^ { j - 1 } , P _ { \mathrm { d i a l } } | _ { 0 } ^ { j - 1 } , P _ { \mathrm { d i a l } } | _ { 0 } ^ { j - 1 } ) \in \mathbb { R } ^ { j \times d } } \\ & { A _ { \mathrm { d i a l } } ^ { ( 2 ) } = \mathrm { A t t e n t i o n } ( A _ { \mathrm { d i a l } } ^ { ( 1 ) } , Q , Q ) \in \mathbb { R } ^ { j \times d } } \end{array}
285
+ $$
286
+
287
+ Similarly, to generate programs for video understanding, the contextual signals are learned and incorporated in a similar manner. However, to exploit dialogue contextual cues, the execution output of dialogue understanding neural modules $Q _ { \mathrm { c t x } }$ is incorporated to each vector in $P _ { \mathrm { d i a l } }$ through an additional attention layer. This layer integrates the resolved entity information to decode the original entities for video understanding. It is equivalent to a reasoning process that converts the question from its original multi-turn semantics to single-turn semantics.
288
+
289
+ $$
290
+ { \cal A } _ { \mathrm { v i d } } ^ { ( 3 ) } = \mathrm { A t t e n t i o n } ( A _ { \mathrm { v i d } } ^ { ( 2 ) } , Q _ { \mathrm { c t x } } , Q _ { \mathrm { c t x } } ) \in \mathbb { R } ^ { j \times d }
291
+ $$
292
+
293
+ # A.3 NON-NMN MODELS
294
+
295
+ For ablation analysis, we evaluate several variants of VilNMN, based on the following categories:
296
+
297
+ To test the contribution of our NMN approach for video understanding, we remove the parser for video understanding program and related neural modules and replace them with pure neural network architecture (Model $B$ ). Specifically, we remove neural modules where, when, describe, and exist. We then directly use video feature embeddings $V$ as $V _ { \mathrm { c t x } }$ as input to the original attention layer in response decoder similarly to (Hori et al., 2019; Sanabria et al., 2019).
298
+
299
+ $$
300
+ A _ { \mathrm { r e s } } ^ { ( 3 ) } = \mathrm { A t t e n t i o n } ( A _ { \mathrm { r e s } } ^ { ( 2 ) } , V , V ) \in \mathbb { R } ^ { j \times d }
301
+ $$
302
+
303
+ To further test the contribution of NMN architecture for dialogue understanding, we similarly remove the question parser for dialogue understanding program and neural modules find and describe. We then directly use the dialogue history embeddings $H$ and question embeddings $Q$ as inputs to the response decoder in two different ways. First, we replace the original attention on dialogue context $Q _ { \mathrm { c t x } }$ with two attention layers to attend on dialogue history and question sequentially (Model $C$ ). As noted by Le et al. (2019b), question input contains much more relevant signals than dialogue history and attention operation should be separated from the one on dialogue history.
304
+
305
+ $$
306
+ \begin{array} { r } { A _ { \mathrm { r e s } } ^ { ( 2 a ) } = \mathrm { A t t e n t i o n } ( A _ { \mathrm { r e s } } ^ { ( 1 ) } , H , H ) \in \mathbb { R } ^ { j \times d } } \\ { A _ { \mathrm { r e s } } ^ { ( 2 b ) } = \mathrm { A t t e n t i o n } ( A _ { \mathrm { r e s } } ^ { ( 2 a ) } , Q , Q ) \in \mathbb { R } ^ { j \times d } } \end{array}
307
+ $$
308
+
309
+ Alternatively, we simply concatenate dialogue and question embeddings similarly to (Hori et al., 2019; Sanabria et al., 2019) and use it as input to the original attention layer (Model $D$ ).
310
+
311
+ $$
312
+ A _ { \mathrm { r e s } } ^ { ( 2 ) } = \mathrm { A t t e n t i o n } ( A _ { \mathrm { r e s } } ^ { ( 1 ) } , [ H ; Q ] , [ H ; Q ] ) \in \mathbb { R } ^ { j \times d }
313
+ $$
314
+
315
+ To use more sophisticated neural models for dialogue understanding, we further adopt the hierarchical encoding architecture with question attention (Li et al., 2016; Serban et al., 2016; Hori et al., 2019). Each dialogue turn $\mathcal { H } _ { t }$ , including a pair of human utterance and system response, is processed separately by a word-level RNN such as LSTM (Model $E$ ) or GRU (Model $F$ ). A sentence-level RNN is used to sequentially process the last hidden states obtained previously turn by turn. The output in each recurrent step is fed to an attention layer such as (Bahdanau et al., 2015; Vaswani et al., 2017) to obtain question-aware representations of dialogue history.
316
+
317
+ $$
318
+ \begin{array} { r l } & { H _ { t } ^ { \mathrm { w o r d } } = \mathrm { R N N } ( H _ { t } ) \in \mathbb { R } ^ { d } } \\ & { H _ { t } ^ { \mathrm { s e n t } } = \mathrm { R N N } ( H _ { t } ^ { \mathrm { w o r d } } ) \in \mathbb { R } ^ { d } } \\ & { \qquad H = [ H _ { t } ^ { \mathrm { s e n t } } ] | _ { t = 1 } ^ { T - 1 } \in \mathbb { R } ^ { d \times ( T - 1 ) } } \\ & { Q _ { \mathrm { c t x } } = \mathrm { A t t e n t i o n } ( Q , H , H ) \in \mathbb { R } ^ { L _ { Q } \times d } } \end{array}
319
+ $$
320
+
321
+ where $T$ is the current dialogue turn. The output is treated as $Q _ { \mathrm { c t x } }$ and is fed to the corresponding attention layer in the response decoder.
322
+
323
+ # B ADDITIONAL EXPERIMENT DETAILS
324
+
325
+ # B.1 DATASETS
326
+
327
+ We use the AVSD benchmark from DSTC7 (Hori et al., 2019) which consists of dialogues grounded on the Charades videos (Sigurdsson et al., 2016). Each dialogue contains up to 10 dialogue turns, each turn consists of a question and expected response about a given video. For visual features, we use the 3D CNN based features from a pretrained I3D model (Carreira & Zisserman, 2017) and object-level features from a pretrained FasterRNN model (Ren et al., 2015b). The audio features are obtained from a pretrained VGGish model (Hershey et al., 2017). In the experiments with AVSD, we consider two settings: one with video summary and one without video summary as input. In the setting with video summary, the summary is concatenated to the dialogue history before the first dialogue turn. We also adapt VilNMN to the video QA benchmark TGIF-QA (Jang et al., 2017). Different from AVSD, TGIF-QA contains a diverse set of QA tasks:
328
+
329
+ • Count: open-ended task which counts the number of repetitions of an action • Action: multiple-choice (MC) task which asks about a certain action occurring for a fixed number of times • Transition: MC task which emphasizes temporal transition in video • Frame: open-ended task which can be answered from visual contents of one of video frames
330
+
331
+ For the TGIF-QA benchmark, we use the extracted features from a pretrained ResNet model (He et al., 2016).
332
+
333
+ Table 5: Summary of DSTC7 AVSD and TGIF-QA benchmark
334
+
335
+ <table><tr><td colspan="2">#</td><td>Train</td><td>Val.</td><td>Test</td></tr><tr><td rowspan="3">AVSD</td><td>Dialogs</td><td>7,659</td><td>1,787</td><td>1,710</td></tr><tr><td>Turns</td><td>153,180</td><td>35,740</td><td>13,490</td></tr><tr><td>Words</td><td>1,450,754</td><td>339,006</td><td>110,252</td></tr><tr><td rowspan="4">TGIFQA</td><td>Count QA</td><td>24,159</td><td>2,684</td><td>3,554</td></tr><tr><td>Action QA</td><td>18,428</td><td>2,047</td><td>2,274</td></tr><tr><td>Trans. QA</td><td>47,434</td><td>5,270</td><td>6,232</td></tr><tr><td>Frame QA</td><td>35,453</td><td>3,939</td><td>13,691</td></tr></table>
336
+
337
+ # B.2 TRAINING DETAILS
338
+
339
+ We use a training batch size of 32 and embedding dimension $d = 1 2 8$ in all experiments. Where Transformer attention is used, we fix the number of attention heads to 8 in all attention layers. In neural modules with MLP layers, the MLP network is fixed to 2 linear layers with a ReLU activation in between. In neural modules with CNN, we adopt a vanilla CNN architecture for text classification (without the last MLP layer) where the number of input channels is 1, the kernel sizes are $\{ 3 , 4 , 5 \}$ , and the number of output channels is $d$ . We initialize models with uniform distribution (Glorot & Bengio, 2010). During training, we adopt the Adam optimizer (Kingma & Ba, 2015) and a decaying learning rate Vaswani et al. (2017) where we fix the warm-up steps to 15K training steps. We employ dropout (Srivastava et al., 2014) of 0.2 at all networks except the last linear layers of question parsers and response decoder. We train models up to 50 epochs and select the best models based on the average loss per epoch in the validation set.
340
+
341
+ # C ADDITIONAL RESULTS
342
+
343
+ To evaluate model robustness, we report the relative performance by calculating the difference of CIDEr in experimental settings against the most basic setting. Specifically, we compare against performance of output responses in the first dialogue turn position (i.e. $2 ^ { n \dot { d } } – 1 0 ^ { t h }$ turn vs. the $1 ^ { s t }$ turn), or responses grounded on the shortest video length range (video ranges are intervals of $0 – 1 0 ^ { t h }$ , $1 0 \ – 2 0 ^ { t h }$ percentile and so on). We report the results of the model variants A, B, and E (See the Ablation Analysis section in the main paper and Appendix A.3 for model description). First, as can be seen in Figure 7, for various dialogue turn positions, we observe that the original VilNMN (model A) suffers less than model E when dialogues extend over time up the $8 ^ { t h }$ turn. This explains the contribution of dialogue understanding modules in solving entities even when the dialogues grow longer. Secondly, as compared to model B, we observe that the Full VilNMN (model A) is less affected as the videos grounding the dialogues grow longer. The difference is clear when the video length increases up to 33 seconds.
344
+
345
+ We also report the absolute scores and compare model variants. In Table 6a, we compare model variants B and E. We observe that model B generally performs better than model E in overall, especially in higher turn positions, i.e. from the $4 ^ { t h }$ turn to $8 ^ { t h }$ turn. Interestingly, we note some mixed results in very low turn position, i.e. the $2 ^ { n d }$ and $3 ^ { r d }$ turn, and very high turn position, i.e. the $1 0 ^ { t h }$ turn. Potentially, in very high turn position, the neural based approach such as hierarchical RNN can better capture the global dependencies within dialogue context than the entity-based compositional NMN method.
346
+
347
+ In Table 6b, we compare model variants A and B. We note that the performance gap between model A and B is quite distinct, with 7/10 cases of video ranges in which model A outperforms. However, similarly to our prior observations in experiments by dialogue turn, in lower ranges (i.e. 1-23 seconds) and higher ranges (37-75 seconds), model A performs not as well as model B. There are additional factors that we will need to examine further to explain the results, such as the complexity of the questions for these short and long-range videos. Potentially, our question parser for video understanding program needs more sophisticated composition method to retrieve information from these video ranges.
348
+
349
+ ![](images/398de27efc81f7e3642d1abc7c7b4de47175198fb1e45e3f27e2fc1e430a106c.jpg)
350
+ Figure 7: Performance of model variants A, B, and E, by dialogue turn position and video length. The performance is calculated relatively to performance of the most basic setting, i.e. responses of the first dialogue turn $\Delta \mathrm { C I D E r _ { t u r n \_ i } } = \mathrm { C I D E r _ { t u r n \_ i } } - \mathrm { C I D E r _ { t u r n \_ 1 } }$ , or responses grounding on the lowest video range (0 to 23 seconds) $\Delta \mathrm { C I D E r _ { r a n g e \mathrm { _ i } } } = \mathrm { C I D E r _ { r a n g e \mathrm { _ i } } } - \mathrm { C I D E r _ { 0 - 2 3 } }$ .
351
+
352
+ Table 6: Performance breakdown in BLEU4 and CIDEr
353
+ (a) by dialogue turn between model variants B and E.
354
+
355
+ <table><tr><td colspan="3">BLEU4</td><td colspan="2">CIDEr</td></tr><tr><td>turn position</td><td>Model B</td><td>Model E</td><td>Model B</td><td>Model E</td></tr><tr><td>1</td><td>0.579</td><td>0.587</td><td>1.623</td><td>1.650</td></tr><tr><td>2</td><td>0.429</td><td>0.430</td><td>1.155</td><td>1.142</td></tr><tr><td>3</td><td>0.275</td><td>0.289</td><td>0.867</td><td>0.846</td></tr><tr><td>4</td><td>0.309</td><td>0.305</td><td>0.859</td><td>0.855</td></tr><tr><td>5</td><td>0.355</td><td>0.335</td><td>1.088</td><td>1.023</td></tr><tr><td>6</td><td>0.357</td><td>0.329</td><td>1.044</td><td>0.950</td></tr><tr><td>7</td><td>0.342</td><td>0.325</td><td>0.896</td><td>0.847</td></tr><tr><td>8</td><td>0.361</td><td>0.332</td><td>1.025</td><td>0.973</td></tr><tr><td>9</td><td>0.383</td><td>0.431</td><td>1.043</td><td>1.182</td></tr><tr><td>10</td><td>0.395</td><td>0.371</td><td>0.931</td><td>0.977</td></tr></table>
356
+
357
+ (b) by video length range (in seconds) between model variants A and B.
358
+
359
+ <table><tr><td colspan="3">BLEU4</td><td colspan="2">CIDEr</td></tr><tr><td>video range (seconds)</td><td>Model A</td><td>Model B</td><td>Model A</td><td>Model B</td></tr><tr><td>1-23</td><td>0.432</td><td>0.447</td><td>1.298</td><td>1.355</td></tr><tr><td>23-28</td><td>0.436</td><td>0.433</td><td>1.264</td><td>1.165</td></tr><tr><td>28-30</td><td>0.398</td><td>0.376</td><td>1.203</td><td>1.164</td></tr><tr><td>30-30.6</td><td>0.441</td><td>0.418</td><td>1.220</td><td>1.202</td></tr><tr><td>30.6-31</td><td>0.413</td><td>0.411</td><td>1.250</td><td>1.166</td></tr><tr><td>31-31.6</td><td>0.439</td><td>0.451</td><td>1.249</td><td>1.295</td></tr><tr><td>31.6-32</td><td>0.430</td><td>0.419</td><td>1.217</td><td>1.192</td></tr><tr><td>32-33</td><td>0.468</td><td>0.445</td><td>1.343</td><td>1.237</td></tr><tr><td>33-37</td><td>0.388</td><td>0.381</td><td>1.149</td><td>1.124</td></tr><tr><td>37-75</td><td>0.356</td><td>0.365</td><td>0.910</td><td>0.962</td></tr></table>
360
+
361
+ # D QUALITATIVE ANALYSIS
362
+
363
+ We extract the predicted programs and responses for some example dialogues in Figure 8, 9, 10, and 11 and report our observations:
364
+
365
+ • We observe that when the predicted programs are correct, the output responses generally match the ground-truth (See the $1 ^ { s t }$ and $2 ^ { n d }$ turn in Figure 8, and the $1 ^ { s t }$ and $4 ^ { { \bar { t } } h }$ turn in Figure 10) or close to the ground-truth responses ( $1 ^ { s t }$ turn in Figure 9).
366
+ • When the output responses do not match the ground truth, we can understand the model mistakes by interpreting the predicted programs. For example, in the $3 ^ { r d }$ turn in Figure 8, the output response describes a room because the predicted video program focuses on the entity “what room” instead of the entity “an object” in the question. Another example is the $3 ^ { \dot { r } d }$ turn in Figure 10 where the entity “rooftop” is missing in the video program. These mismatches can deviate the information retrieved from the video during video program execution, leading to wrong output responses with wrong visual contents.
367
+ We also note that in some cases, one or both of the predicted programs are incorrect, but the predicted responses still match the ground-truth responses. This might be explained as the predicted module parameters are not exactly the same as the ground truth but they are close enough (e.g. $4 ^ { t h }$ turn in Figure 8). Sometimes, our model predicted programs that are more appropriate than the ground truth. For example, in the $2 ^ { { \bar { n } } d }$ turn in Figure 9, the program is added with a where module parameterized by the entity “the shopping bag” which was solved from the reference “them” mentioned in the question.
368
+ • We observe that for complex questions that involve more than one queries (e.g. the $3 ^ { r d }$ turn in Figure 10), it becomes more challenging to decode an appropriate video understanding program and generate responses that can address all queries.
369
+ • In Figure 11, we demonstrate some output examples of VilNMN and compare with two baselines: Baseline (Hori et al., 2019) and MTN (Le et al., 2019b). We noted that VilNMN can include important entities relevant to the current dialogue turn to construct output responses while other models might miss some entity details, e.g. “them/dishes” in example A and “the magazine” in example B. These small yet important details can determine the correctness of dialogue responses.
370
+
371
+ ![](images/5e39bc95a0ceb8e3fb3d5469b7dd1efdd1618424facc2e40e32d72bd986dd909.jpg)
372
+
373
+ ![](images/4418977275529630c424ae9a011e6eb6302163738aca0446dbfdcd78de7e81e8.jpg)
374
+
375
+ ![](images/5ae7eb0ce394e9a325452d0eab7ff74705e152d97186a68063a0e73b0f9fe07c.jpg)
376
+
377
+ ![](images/d13d1be16d3744b012c2f4f68213120b43ec9510bcc6defd08e26fb98b5bceec.jpg)
378
+
379
+ ![](images/bcaefdb7909d644203e7c3e16b22b646729f276040913b46cc890612139a86e9.jpg)
380
+
381
+ Figure 10: Example output programs and responses from a dialogue in the test split of the AVSD benchmark.
382
+
383
+ <table><tr><td rowspan=1 colspan=1>Turn</td><td rowspan=1 colspan=1>Question</td><td rowspan=1 colspan=1>Dialogue UnderstandingProgram</td><td rowspan=1 colspan=1>Video UnderstandingProgram</td><td rowspan=1 colspan=1>Response</td></tr><tr><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>hi how many peopleare in the video fromstart to finish ?</td><td rowspan=1 colspan=1>Predicted: summari ze()Gold: summarize ()</td><td rowspan=1 colspan=1>Predicted: describe (how manypeople)Gold:describe (how manypeople)</td><td rowspan=1 colspan=1>Predicted: there are twopeople in the video.Gold: hello,there aretwo men</td></tr><tr><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>are they carrying ona conversationbetween themselves?</td><td rowspan=1 colspan=1>Predicted:find(they)→summarize()Gold:find(they),find(themselves)→summarize()</td><td rowspan=1 colspan=1>Predicted: where(two men in the←video)→when(carrying on aconversation betweenthemselves)-exist()Gold:where(two men)→ when(carrying a conversationbetween themselves)-exist()</td><td rowspan=1 colspan=1>Predicted: yes,they arecarrying a conversation×Gold: no,backgroundnoise is birdsong andshuffling noises</td></tr><tr><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>what are they doingin the scene ?arethey on a rooftop ?</td><td rowspan=1 colspan=1>Predicted: find(they),find(the scene)→summarize() ×Gold: find(they)→summarize()</td><td rowspan=1 colspan=1>Predicted:where(two men in thevideo),where(the scene)→when(doing in the scene)→describe(what) ×Gold: where(two men),where(rooftop)→when(doingin the scene)-describe(what)</td><td rowspan=1 colspan=1>Predicted: one iswashing a chair and theother is taking pictures×Gold: yes,on a secondfloor roof deck ,oneman is washing a chair,another man is eitherfilming or taking pictures</td></tr><tr><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>does he sit in thechair after washingit?</td><td rowspan=1 colspan=1>Predicted: find(he),find(the chair)→summarize()Gold: find (he),find(the chair)→summarize()</td><td rowspan=1 colspan=1>Predicted: where(one man in thevideo),where(a chair)→when(sit in the chair afterwashing it)→exist()Gold:where(one man),where(achair)→ when(sit in thechair after washing it)→exist()</td><td rowspan=1 colspan=1>Predicted: no,he doesnot sit in the chairGold: no he does not,there is a pipe withwater running all over</td></tr></table>
384
+
385
+ ![](images/b020b5ccf752b45a137b3877cf43d0b9573cdb8ca1bd4a82fc366971a6c29af8.jpg)
386
+ Figure 11: Intepretability of example outputs from VilNMN and baselines models (Hori et al., 2019; Le et al., 2019b)
md/train/SkE6PjC9KX/SkE6PjC9KX.md ADDED
@@ -0,0 +1,298 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ATTENTIVE NEURAL PROCESSES
2
+
3
+ Hyunjik $\mathbf { K i m ^ { 1 , 2 * } }$ , Andriy ${ \bf { M } } { \bf { n i h } } ^ { 1 }$ , Jonathan Schwarz1, Marta Garnelo1, Ali Eslami1,
4
+ Dan Rosenbaum1, Oriol Vinyals1, Yee Whye Teh1,2
5
+ DeepMind1, University of Oxford2
6
+
7
+ # ABSTRACT
8
+
9
+ Neural Processes (NPs) (Garnelo et al., 2018a;b) approach regression by learning to map a context set of observed input-output pairs to a distribution over regression functions. Each function models the distribution of the output given an input, conditioned on the context. NPs have the benefit of fitting observed data efficiently with linear complexity in the number of context input-output pairs, and can learn a wide family of conditional distributions; they learn predictive distributions conditioned on context sets of arbitrary size. Nonetheless, we show that NPs suffer a fundamental drawback of underfitting, giving inaccurate predictions at the inputs of the observed data they condition on. We address this issue by incorporating attention into NPs, allowing each input location to attend to the relevant context points for the prediction. We show that this greatly improves the accuracy of predictions, results in noticeably faster training, and expands the range of functions that can be modelled.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Regression tasks are usually cast as modelling the distribution of a vector-valued output $\textbf { { y } }$ given a vector-valued input $_ { \textbf { \em x } }$ via a deterministic function, such as a neural network, taking $_ { \textbf { \em x } }$ as an input. In this setting, the model is trained on a dataset of input-output pairs, and predictions of the outputs are independent of each other given the inputs. An alternative approach to regression involves using the training data to compute a distribution over functions that map inputs to outputs, and using draws from that distribution to make predictions on test inputs. This approach allows for reasoning about multiple functions consistent with the data, and can capture the co-variability in outputs given inputs. In the Bayesian machine learning literature, non-parametric models such as Gaussian Processes (GPs) are popular choices of this approach.
14
+
15
+ Neural Processes (NPs) (Garnelo et al., 2018a;b) offer an efficient method to modelling a distribution over regression functions, with prediction complexity linear in the context set size. Once trained, they can predict the distribution of an arbitrary target output conditioned on a set of context inputoutput pairs of an arbitrary size. This flexibility of NPs enables them to model data that can be interpreted as being generated from a stochastic process. It is important to note however that NPs and GPs have different training regimes. NPs are trained on samples from multiple realisations of a stochastic process (i.e. trained on many different functions), whereas GPs are usually trained on observations from one realisation of the stochastic process (a single function). Hence a direct comparison between the two is usually not plausible.
16
+
17
+ Despite their many appealing properties, one substantial weakness of NPs is that they tend to underfit the context set. This manifests in the 1D curve fitting example on the left half of Figure 1 as inaccurate predictive means and overestimated variances at the input locations of the context set. The right half of the figure shows this phenomenon when predicting the bottom half of a face image from its top half: although the prediction is globally coherent, the model’s reconstruction of the top-half is far from perfect. In an NP, the encoder aggregates the context set to a fixed-length latent summary via a permutation invariant function, and the decoder maps the latent and target input to the target output. We hypothesise that the underfitting behaviour is because the mean-aggregation step in the encoder acts as a bottleneck: since taking the mean across context representations gives the same weight to each context point, it is difficult for the decoder to learn which context points provide relevant information for a given target prediction. In theory, increasing the dimensionality of the representation could address this issue, but we show in Section 4 that in practice, this is not sufficient.
18
+
19
+ ![](images/ba54f692bcc35600ad5cde87d8bae38ca586a2197e4f891cbf69108e1052b875.jpg)
20
+ Figure 1: Comparison of predictions given by a fully trained NP and Attentive NP (ANP) in 1D function regression (left) / 2D image regression (right). The contexts (crosses/top half pixels) are used to predict the target outputs $y$ -values of all $x \in [ - 2 , 2 ] / \mathrm { a l l }$ pixels in image). The ANP predictions are noticeably more accurate than for NP at the context points.
21
+
22
+ To address this issue, we draw inspiration from GPs, which also define a family of conditional distributions for regression. In GPs, the kernel can be interpreted as a measure of similarity among two points in the input domain, and shows which context points $( { \pmb x } _ { i } , { \pmb y } _ { i } )$ are relevant for a given query $^ { \mathbf { \delta x } }$ . Hence when $^ { \mathbf { \delta x } }$ is close to some $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ , its $y$ -value prediction $^ { \pmb { y } _ { \ast } }$ is necessarily close to $\mathbf { \nabla } _ { \mathbf { \boldsymbol { y } } _ { i } }$ (assuming small likelihood noise), and there is no risk of underfitting. We implement a similar mechanism in NPs using differentiable attention that learns to attend to the contexts relevant to the given target, while preserving the permutation invariance in the contexts. We evaluate the resulting Attentive Neural Processes (ANPs) on 1D function regression and on 2D image regression. Our results show that ANPs greatly improve upon NPs in terms of reconstruction of contexts as well as speed of training, both against iterations and wall clock time. We also demonstrate that ANPs show enhanced expressiveness relative to the NP and is able to model a wider range of functions.
23
+
24
+ # 2 BACKGROUND
25
+
26
+ # 2.1 NEURAL PROCESSES
27
+
28
+ The NP is a model for regression functions that map an input $\pmb { x } _ { i } \in \mathbb { R } ^ { d _ { x } }$ to an output $\boldsymbol { y } _ { i } \in \mathbb { R } ^ { d _ { y } }$ . In particular, the NP defines a (infinite) family of conditional distributions, where one may condition on an arbitrary number of observed contexts $( \pmb { x } _ { C } , \pmb { y } _ { C } ) : = ( \pmb { x } _ { i } , \pmb { y } _ { i } ) _ { i \in C }$ to model an arbitrary number of targets $( { \pmb x } _ { T } , { \pmb y } _ { T } ) : = ( { \pmb x } _ { i } , { \pmb y } _ { i } ) _ { i \in T }$ in a way that is invariant to ordering of the contexts and ordering of the targets. The model is defined for arbitrary $C$ and $T$ but in practice we use $C \subset T$ . The deterministic NP models these conditional distributions as:
29
+
30
+ $$
31
+ p ( { \pmb y } _ { T } | { \pmb x } _ { T } , { \pmb x } _ { C } , { \pmb y } _ { C } ) : = p ( { \pmb y } _ { T } | { \pmb x } _ { T } , { \pmb r } _ { C } )
32
+ $$
33
+
34
+ with $r _ { C } : = r ( \pmb { x } _ { C } , \pmb { y } _ { C } ) \in \mathbb { R } ^ { d }$ where $r$ is a deterministic function that aggregates $( \pmb { x } _ { C } , \pmb { y } _ { C } )$ into a finite dimensional representation with permutation invariance in $C$ . In practice, each context $( { \pmb x } , { \pmb y } )$ pair is passed through an MLP to form a representation of each pair, and these are aggregated by taking the mean to form $r _ { C }$ . The likelihood $p ( { \pmb y } _ { T } | { \pmb x } _ { T } , { \pmb r } _ { C } )$ is modelled by a Gaussian factorised across the targets $( { \pmb x } _ { i } , { \pmb y } _ { i } ) _ { i \in T }$ with mean and variance given by passing $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ and $\mathbf { \Delta } _ { \mathbf { \left. r _ { C } \right. } }$ through an MLP. The unconditional distribution $p ( { \pmb y } _ { T } | { \pmb x } _ { T } )$ (when $C = \varnothing$ ) is defined by letting $r _ { \emptyset }$ be a fixed vector.
35
+
36
+ The latent variable version of the NP model includes a global latent $_ z$ to account for uncertainty in the predictions of $\mathbf { \pmb { y } } _ { T }$ for a given observed $( \pmb { x } _ { C } , \pmb { y } _ { C } )$ . It is incorporated into the model via a latent path that complements the deterministic path described above. Here $_ { z }$ is modelled by a factorised Gaussian parametrised by $\pmb { s } _ { C } : = \pmb { s } ( \pmb { x } _ { C } , \pmb { y } _ { C } )$ , with $s$ being a function of the same properties as $r$
37
+
38
+ $$
39
+ p ( \pmb { y } _ { T } | \pmb { x } _ { T } , \pmb { x } _ { C } , \pmb { y } _ { C } ) : = \int p ( \pmb { y } _ { T } | \pmb { x } _ { T } , \pmb { r } _ { C } , z ) q ( z | \pmb { s } _ { C } ) d z
40
+ $$
41
+
42
+ with $q ( z | s _ { \emptyset } ) : = p ( z )$ , the prior on $_ z$ . The likelihood is referred to as the decoder, and $q , r , s$ form the encoder. See Figure 2 for diagrams of these models.
43
+
44
+ The motivation for having a global latent is to model different realisations of the data generating stochastic process — each sample of $_ z$ would correspond to one realisation of the stochastic process. One can define the model using either just the deterministic path, just the latent path, or both. In this
45
+
46
+ work we investigate the case of using both paths, which gives the most expressive model and also gives a sensible setup for incorporating attention, as we will show later in Section 3.
47
+
48
+ The parameters of the encoder and decoder are learned by maximising the following ELBO
49
+
50
+ $$
51
+ \log p ( y _ { T } | x _ { T } , x _ { C } , y _ { C } ) \geq \mathbb { E } _ { q ( z | s _ { T } ) } [ \log p ( y _ { T } | x _ { T } , r _ { C } , z ) ] - D _ { \mathrm { K L } } ( q ( z | s _ { T } ) | | q ( z | s _ { C } ) )
52
+ $$
53
+
54
+ for a random subset of contexts $C$ and targets $T$ via the reparametrisation trick (Kingma & Welling, 2014; Rezende et al., 2014). In other words, the NP learns to reconstruct targets, regularised by a KL term that encourages the summary of the contexts to be not too far from the summary of the targets. This is sensible since we are assuming that the contexts and targets come from the same realisation of the data-generating stochastic process, and especially so if targets contain contexts. At each training iteration, the number of contexts and targets are also chosen randomly (as well as being randomly sampled from the training data), so that the NP can learn a wide family of conditional distributions.
55
+
56
+ NPs have many desirable properties, namely (i) Scalability: computation scales linearly at $O ( n { + } m )$ for $n$ contexts and $m$ targets at train and prediction time. (ii) Flexibility: defines a very wide family of distributions, where one can condition on an arbitrary number of contexts to predict an arbitrary number of targets. (iii) Permutation invariance: the predictions of the targets are order invariant in the contexts. However these advantages come at the cost of not satisfying consistency in the contexts. For example, if $\mathbf { \boldsymbol { \mathsf { y } } } _ { 1 : m }$ is generated given some context set, then its distribution need not match the distribution you would obtain if $\pmb { y } _ { 1 : n }$ is generated first, appended to the context set then ${ \pmb y } _ { n + 1 : m }$ is generated. However maximum-likelihood learning can be interpreted as minimising the KL between the (consistent) conditional distributions of the data-generating stochastic process and the corresponding conditional distributions of the NP. Hence we could view the NP as approximating the conditionals of the consistent data-generating stochastic process.
57
+
58
+ # 2.2 ATTENTION
59
+
60
+ Given a set of key-value pairs $( k _ { i } , v _ { i } ) _ { i \in \mathbb { Z } }$ and a query $q$ , an attention mechanism computes weights of each key with respect to the query, and aggregates the values with these weights to form the value corresponding to the query. In other words, the query attends to the key-value pairs. The queried values are invariant to the ordering of the key-value pairs; this permutation invariance property of attention is key in its application to NPs. The idea of using a differentiable addressing mechanism that can be learned from the data has been applied successfully in various areas of Deep Learning, namely handwriting generation and recognition (Graves, 2012) and neural machine translation (Bahdanau et al., 2015). More recently, there has been work employing self-attention (where keys and queries are identical) to give expressive sequence-to-sequence mappings in natural language processing (Vaswani et al., 2017) and image modelling (Parmar et al., 2018).
61
+
62
+ We give some examples of attention mechanisms which are used in the paper. Suppose we have $n$ key-value pairs arranged as matrices $K \in \mathbb { R } ^ { n \times d _ { k } }$ , $V \in \mathbb { R } ^ { n \times d _ { v } }$ , and $m$ queries $Q \in \mathbb { R } ^ { m \times d _ { k } }$ . Simple forms of attention based on locality (weighting keys according to distance from query) are given by various stationary kernels. For example, the (normalised) Laplace kernel gives the queried values as
63
+
64
+ $$
65
+ \mathbf { L a p l a c e } ( Q , K , V ) : = W V \in \mathbb { R } ^ { m \times d _ { v } } , \qquad W _ { i } : = \mathrm { s o f t m a x } ( ( - | | Q _ { i } , - K _ { j } . | | _ { 1 } ) _ { j = 1 } ^ { n } ) \in \mathbb { R } ^ { n }
66
+ $$
67
+
68
+ Similarly (scaled) dot-product attention uses the dot-product between the query and keys as a measure of similarity, and weights the keys according to the values
69
+
70
+ $$
71
+ \mathbf { D o t P r o d u c t } ( Q , K , V ) : = \operatorname { s o f t m a x } ( Q K ^ { \top } / \sqrt { d _ { k } } ) V \in \mathbb { R } ^ { m \times d _ { v } }
72
+ $$
73
+
74
+ The use of dot-product attention allows the query values to be computed with two matrix multiplications and a softmax, allowing for use of highly optimised matrix multiplication code.
75
+
76
+ multihead attention (Vaswani et al., 2017) is a parametrised extension where for each head, the keys, values and queries are linearly transformed, then dot-product attention is applied to give headspecific values. These values are concatenated and linearly transformed to produce the final values:
77
+
78
+ $$
79
+ \begin{array} { r l } & { \mathbf { M u l t i H e a d } ( Q , K , V ) : = \mathrm { c o n c a t } ( \mathrm { h e a d } _ { 1 } , \dots , \mathrm { h e a d } _ { H } ) W \in \mathbb { R } ^ { m \times d _ { v } } } \\ & { \qquad \mathrm { w h e r e ~ h e a d } _ { h } : = \mathrm { D o t P r o d u c t } ( Q W _ { h } ^ { Q } , K W _ { h } ^ { K } , V W _ { h } ^ { V } ) \in \mathbb { R } ^ { m \times d _ { v } } } \end{array}
80
+ $$
81
+
82
+ This multihead architecture allows the query to attend to different keys for each head and tends to give smoother query-values than dot-product attention (c.f. Section 4).
83
+
84
+ # 3 ATTENTIVE NEURAL PROCESSES
85
+
86
+ ![](images/be70b3d915e9d80198e52c93260a723933b03c9d3d58fc0220b12c7fcb48d6cf.jpg)
87
+ Figure 2: Model architecture for the NP (left) and Attentive NP (right)
88
+
89
+ Figure 2 describes how attention is incorporated into NP to give the Attentive NP (ANP). In summary, self-attention is applied to the context points to compute representations of each $( { \pmb x } , { \pmb y } )$ pair, and the target input attends to these context representations (cross-attention) to predict the target output. In detail, the representation of each context pair $( { \pmb x } _ { i } , { \pmb y } _ { i } ) _ { i \in C }$ before the mean-aggregation step is computed by a self-attention mechanism, in both the deterministic and latent path. The intuition for the self-attention is to model interactions between the context points. For example, if many context points overlap, then the query need not attend to all of these points, but only give high weight to one or a few. The self-attention will help obtain richer representations of the context points that encode these types of relations between the context points. We model higher order interactions by simply stacking the self-attention, as is done in Vaswani et al. (2017).
90
+
91
+ In the deterministic path, the mean-aggregation of the context representations that produces $\mathbf { \Delta } _ { \mathbf { \left. r _ { C } \right. } }$ is replaced by a cross-attention mechanism, where each target query $^ { \mathbf { x } } { } ^ { \mathrm { ~ } }$ attends to the context $\scriptstyle { \mathbf { { \mathit { x } } } } _ { C } : =$ $( { \bar { \pmb { x } } } _ { i } ) _ { i \in C }$ to produce a query-specific representation $\pmb { r } _ { * } : = r ^ { * } ( \pmb { x } _ { C } , \pmb { y } _ { C } , \pmb { x } _ { * } )$ . This is precisely where the model allows each query to attend more closely to the context points that it deems relevant for the prediction. The reason we do not have an analogous mechanism in the latent path is that we would like to preserve the global latent, that induces dependencies between the target predictions. The interpretation of the latent path is that $_ z$ gives rise to correlations in the marginal distribution of the target predictions $\mathbf { \pmb { y } } _ { T }$ , modelling the global structure of the stochastic process realisation, whereas the deterministic path models the fine-grained local structure.
92
+
93
+ The decoder remains the same, except we replace the shared context representation $\mathbf { \Delta } _ { \mathbf { \left. r _ { C } \right. } }$ with the query-specific representation $\mathbf { \Delta } _ { \mathbf { r } _ { * } }$ . Note that permutation invariance in the contexts is preserved with the attention mechanism. If we use uniform attention (all contexts given the same weight) throughout, we recover the NP. ANP is trained using the same loss (3) as the original NP, also using Gaussian likelihood $p ( \pmb { y } _ { i } | \pmb { x } _ { i } , r ^ { * } ( \pmb { x } _ { C } , \pmb { y } _ { C } , \pmb { x } _ { i } ) , z )$ and diagonal Gaussian $q ( \boldsymbol { z } | \boldsymbol { s } _ { C } )$ .
94
+
95
+ The added expressivity and resulting accuracy of the NP with attention comes at a cost. The computational complexity is raised from $\bar { O } ( n + m ) $ to $O ( n ( n + m ) )$ , since we apply self-attention across the contexts and for every target point we compute weights for all contexts. However most of the computation for the (self-)attention is done via matrix multiplication (c.f. Section 2.2), and so can be done in parallel across the contexts and across the targets. In practice, the training time for ANPs remains comparable to NPs, and in fact we show that ANPs learn significantly faster than NPs not only in terms of training iterations but also in wall-clock time, despite being slower at prediction time (c.f. Section 4).
96
+
97
+ # 4 EXPERIMENTAL RESULTS
98
+
99
+ Note that the (A)NP learns a stochastic process, so should be trained on multiple functions that are realisations of the stochastic process. At each training iteration, we draw a batch of realisations from the data generating stochastic process, and select random points on these realisations to be the targets and a subset to be the contexts to optimise the loss in Equation (3). We use the same decoder architecture for all experiments, and 8 heads for multihead. See Appendix A for architectural details.
100
+
101
+ ![](images/8805bccfaf2156eb10fc3567a04022b03d867dfe5ee24067f4304d47926b47fb.jpg)
102
+ Figure 3: Qualitative and quantitative results of different attention mechanisms for 1D GP function regression with random kernel hyperparameters. Left: moving average of context reconstruction error (top) and target negative log likelihood (NLL) given contexts (bottom) plotted against training iterations (left) and wall clock time (right). $d$ denotes the bottleneck size i.e. hidden layer size of all MLPs and the dimensionality of $r$ and $z$ . Right: predictive mean and variance of different attention mechanisms given the same context. Best viewed in colour.
103
+
104
+ 1D Function regression on synthetic GP data We first explore the (A)NPs trained on data that is generated from a Gaussian Process with a squared-exponential kernel and small likelihood noise1. We emphasise that (A)NPs need not be trained on GP data or data generated from a known stochastic process, and this is just an illustrative example. We explore two settings: one where the hyperparameters of the kernel are fixed throughout training, and another where they vary randomly at each training iteration. The number of contexts $( n )$ and number of targets $( m )$ are chosen randomly at each iteration $( n \sim U [ 3 , 1 0 0 ]$ , $m \sim n + U [ 0 , 1 0 0 - n ] )$ . Each $x$ -value is drawn uniformly at random in $[ - 2 , 2 ]$ . For this simple 1D data, we do not use self-attention and just explore the use of cross-attention in the deterministic path (c.f. Figure 2). Thus we use the same encoder/decoder architecture for NP and ANP, except for the cross-attention. See Appendix B for experimental details.
105
+
106
+ Figure 3 (left) shows context reconstruction error $\begin{array} { r } { \frac { 1 } { | C | } \sum _ { i \in C } \mathbb { E } _ { q ( z | s _ { C } ) } [ \log p ( \pmb { y } _ { i } | \pmb { x } _ { i } , r ^ { * } ( \pmb { x } _ { C } , \pmb { y } _ { C } , \pmb { x } _ { i } ) , z ) ] } \end{array}$ and NLL of targets given contexts $\begin{array} { r } { \frac { 1 } { | T | } \sum _ { i \in T } \mathbb { E } _ { q ( z | s _ { C } ) } [ \log p ( \pmb { y } _ { i } | \pmb { x } _ { i } , r ^ { * } ( \pmb { x } _ { C } , \pmb { y } _ { C } , \pmb { x } _ { i } ) , z ) ] } \end{array}$ for the different attention mechanisms, trained on a GP with random kernel hyperparameters. ANP shows a much more rapid decrease in reconstruction error and lower values at convergence compared to the NP, especially for dot product and multihead attention. This holds not only against training iteration but also against wall clock time, so learning is fast despite the added computational cost of attention. The right column plots show that the computation times of Laplace and dot-product ANP are similar to the NP for the same value of $d$ , and multihead ANP takes around twice the time. We also show how the size of the bottleneck $( d )$ in the deterministic and latent paths of the NP affects the underfitting behaviour of NPs. The figure shows that raising $d$ does help achieve better reconstructions, but there appears to be a limit in how much reconstructions can improve. Beyond a certain value of $d$ , the learning for the NP becomes too slow, and the value of reconstruction error at convergence is still higher than that achieved by multihead ANP with $10 \%$ of the wall-clock time. Hence using ANPs has significant benefits over simply raising the bottleneck size in NPs.
107
+
108
+ In Figure 3 (right) we visualise the learned conditional distribution for a qualitative comparison of the attention mechanisms. The context is drawn from the GP with the hyperparameter values that give the most fluctuation. Note that the predictive mean of the NP underfits the context, and tries to explain the data by learning a large likelihood noise. Laplace shows similar behaviour, whereas dotproduct attention gives predictive means that accurately predict almost all context points. Note that Laplace attention is parameter-free (keys and queries are the x-coordinates) whereas for dot-product attention we have set the keys and queries to be parameterised representations of the x-values (output of learned MLP that takes $\mathbf { X } ^ { \prime }$ -coordinates as inputs). So the dot-product similarities are computed in a learned representation space, whereas for Laplace attention the similarities are computed based on L1 distance in the $\mathbf { X }$ -coordinate domain, hence it is expected that dot-product attention outperforms Laplace attention. However dot-product attention displays non-smooth predictions, shown more (a) Reconstructions of full CelebA image from a varying number of random context points for NP (left) and Stacked Multihead ANP (right).
109
+
110
+ ![](images/9aae810eb2780d7beb0bdfb1b682c13682a2b3ac1fdd73d66b794ca0d962c69e.jpg)
111
+
112
+ ![](images/d0c19bab9627523cd98792461e1b139dcfed710249f95b8d040dad5392fe199b.jpg)
113
+ (b) Context NLL (top) and unseen target NLL given contexts (bottom).
114
+
115
+ ![](images/2a77a83787ef0d15fe250b575d0f3bb0a92ce7fef4ab4dcee671f0ecc1b8649e.jpg)
116
+ Figure 4: Qualitative and quantitative results on test set for 2D CelebA function regression.
117
+ Figure 5: Reconstruction of full image from top half. The CelebA results use the same models (with the same parameter values) as Figure 4a.
118
+
119
+ clearly in the predictive standard deviations (c.f. Appendix C for an explanation). The multiple heads in multihead attention appear to help smooth out the interpolations, giving good reconstruction of the contexts as well as prediction of the targets, while preserving increased predictive uncertainty away from the contexts as in a GP. The results for (A)NP trained on fixed GP kernel hyperparameters are similar (c.f. Appendix C), except that the NP underfits to a lesser degree because of the reduced variety of sample curves (functions) in the data. This difference in performance for the two kernel hyperparameter settings provides evidence of how the ANP is more expressive than the NP and can learn a wider range of functions.
120
+
121
+ Using the trained (A)NPs we tackle a toy Bayesian Optimisation (BO) problem, where the task is to find the minimum of test functions drawn from a GP prior. This is a proof-of-concept experiment showing the utility of being able to sample entire functions from the (A)NP and having accurate context reconstructions. See Appendix C for the details and an analysis of results.
122
+
123
+ 2D Function regression on image data Image data can also be interpreted as being generated from a stochastic process (since there are dependencies between pixel values), and predicting the pixel values can be cast as a regression problem mapping a 2D pixel location $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ to its pixel intensity $\mathbf { \nabla } _ { \mathbf { \psi } _ { 3 } } \mathbf { \psi } _ { 2 } \qquad \mathbf { \psi } _ { 3 } \mathbf { \psi } _ { 4 } \qquad \mathbf { \psi } _ { 3 } \mathbf { \psi } _ { 4 } \qquad \mathbf { \psi } _ { 3 } \mathbf { \psi } _ { 4 } \mathbf { \psi } _ { 3 } \qquad \mathbf { \psi } _ { 4 } \mathbf { \psi } _ { 4 } \mathbf { \psi } _ { 3 } \mathbf { \psi } _ { 4 } \mathbf { \psi } _ { 4 } \mathbf { \psi } _ { 3 } \qquad \mathbf { \psi } _ { 3 } \mathbf { \psi } _ { 4 } \mathbf { \psi } _ { 4 } \mathbf { \psi } _ { 3 } \mathbf { \psi } _ { 4 } \mathbf { \psi } _ { 4 }$ $\mathbf { \Lambda } \in \mathbb { R } ^ { 1 }$ for greyscale, $\in \mathbb { R } ^ { 3 }$ for RGB). Each image corresponds to one realisation of the process sampled on a fixed 2 dimensional grid. We train the ANP on MNIST (LeCun et al., 1998) and $3 2 \times 3 2$ CelebA (Liu et al., 2015) using the standard train/test split with up to 200 context/target points at training. For this application we explore the use of self-attentional layers in the encoder, stacking them as is done in Parmar et al. (2018). See Appendix D for experimental details.
124
+
125
+ On both datasets we show results of three different models: NP, ANP with multihead cross-attention in the deterministic path (Multihead ANP), and ANP with both multihead attention in the deterministic path and two layers of stacked self-attention in both the deterministic and latent paths (Stacked Multihead ANP). Figure 4a shows predictions of the full image (i.e. full target) with a varying number of random context pixels, from 10 to 1024 (full image) for a randomly selected image (see Appendix E for other images). For each we generate predictions that correspond to the mean of $p ( \bar { \pmb { y } } _ { T } | \pmb { x } _ { T } , \pmb { r } _ { C } , z )$ for three different samples of $\bar { z } \sim q ( z | s _ { C } )$ . The NP (left) gives reasonable predictions with a fair amount of diversity for fewer contexts, but the reconstructions of the whole image are not accurate, compared to Stacked Multihead ANP (right) where the reconstructions are indistinguishable from the original. The use of attention also helps achieve crisper inpaintings when the target pixels are filled in, enhancing the ANP’s ability to model less smooth 2D functions compared to the NP. The diversity in faces and digits obtained with different values of $_ { z }$ is apparent the different samples, providing evidence for the claim that $_ { z }$ can model global structure of the image, with one sample corresponding to one realisation of the data generating stochastic process. Similar conclusions hold for MNIST (see Appendix E) and for the full image prediction using the top half as context in Figure 5. In the latter task, note that the model has never been trained on more than 200 context points, yet it manages to generalise to when the context is of size 512 (half the image).
126
+
127
+ ![](images/31f7034be116e24c1905201fe39547e6a1000932ab40174555f34fb1ac32309a.jpg)
128
+ Figure 6: Mapping between different resolutions by the same model (with the same parameter values) as Stacked Multihead ANP in Figures 4a, 5b. The two rightmost columns show the results of baseline methods, namely linear and cubic interpolation to $2 5 6 \times 2 5 6$ .
129
+
130
+ Figure 4b verifies quantitatively that both Multihead and Stacked Multihead ANP give a much improved context reconstruction error compared to the NP. Similarly the NLL for the target points (that are not included in the context) is improved with multihead crossattention, showing small gains with stacked self-attention. However qualitatively, there are noticeable gains in crispness and global coherence when using stacked self-attention (see Appendix E). In Figure 7 we visualise each head of Multihead ANP for CelebA. We let the target pixel (cross) attend to all pixels, and see where each head of the attention focuses on. We colour-code the pixels with the top 20 weights per head, with intensity proportional to the attention weight. We can see that each head has different roles: the cyan head only looks at the target pixel and nothing else; the red head looks at a few pixels nearby; the green head looks at a larger region nearby; the yellow looks at the pixels on the column of the target; the orange looks at some band of the image; the purple head (interestingly) looks at the other side of the image, trying to exploit the symmetry of faces. We observe consistent behaviour in these heads for other target pixels (see Figure 16 of Appendix E).
131
+
132
+ ![](images/2fbb03c971104c2f9e6974bb1eb842001d5d27ad25d86c826990bc5fd9e119d5.jpg)
133
+ Figure 7: Pixels attended to by each head of multihead attention in Multihead ANP given a target pixel. Each head is given a different colour and the target pixel is marked with a cross.
134
+
135
+ One other illustrative application of (A)NPs trained on images is that one can map images from one resolution to another, even if the model has only been trained on one resolution. Because the two dimensional $_ { \textbf { \em x } }$ (pixel locations) are modelled as real values that live in a continuous space, the model can predict the $\textbf { { y } }$ (pixel intensities) of any point in this space, and not just the grid of points that it was trained on. Hence using one grid as the context and a finer grid as the target, the model can map a given resolution to a higher resolution. This could, however, be problematic for NPs whose reconstructions can be inaccurate, so the prediction of the target resolution can look very different to the original image (see Figure 19 of Appendix E). The reconstructions of ANPs may be accurate enough to give reliable mappings between different resolutions. We show results for such mappings given by the same Stacked Multihead ANP (the same model used to produce Figures 4a, 5b) in Figure 6. On the left, we see that the ANP (trained on $3 2 \times 3 2$ images) is capable of mapping low resolutions $4 \times 4$ or $8 \times 8$ ) to fairly realistic $3 2 \times 3 2$ target outputs with some diversity for different values of $_ z$ (more diversity for the $4 \times 4$ contexts as expected). Perhaps this performance is to be expected since the model has been trained on data that has $3 2 \times 3 2$ resolution. The same model allows us to map to even higher resolutions, namely from the original $3 2 \times 3 2$ images to $2 5 6 \times 2 5 6$ , displayed on the right of the figure. We see that even though the model has never seen any images beyond the original resolution, the model learns a fairly realistic high resolution image with sharper edges compared to the baseline interpolation methods. Moreover, there is some evidence that it learns an internal representation of the appearance of faces, when for example it learns to fill in the eye even when the original image is too coarse to separate the iris (coloured part) from the sclera (white part) (e.g. top row image), a feature that is not possible with simple interpolation. See Figure 19 in Appendix E for larger versions of the images.
136
+
137
+ For each of MNIST and CelebA, all qualitative plots in this section were given from the same model (with the same parameter values) for each attention mechanism, learned by optimising the loss in Equation (3) over random context pixels and random target pixels at each iteration. It is important to note that we do not claim the ANP to be a replacement of state of the art algorithms of image inpainting or super-resolution, and rather we show these image applications to highlight the flexibility of the ANP in modelling a wide family of conditional distributions.
138
+
139
+ # 5 RELATED WORK
140
+
141
+ The work related to NPs in the domain of Gaussian Processes, Meta-Learning, conditional latent variable models and Bayesian Learning have been discussed extensively in the original works of Garnelo et al. (2018a;b), hence we focus on works that are particularly relevant for ANPs.
142
+
143
+ Gaussian Processes (GPs) Returning to our motivation for using attention in NPs, there is a clear parallel between GP kernels and attention, in that they both give a measure of similarity between two points in the same domain. The use of attention in an embedding space that we explore is related to Deep Kernel Learning (Wilson et al., 2016) where a GP is applied to learned representations of data. Here, however, learning is still done in a GP framework by maximising the marginal likelihood. We reiterate that the training regimes of GPs and NPs are different, so a direct comparison between the methods is difficult. One possibility for comparison is to learn the GP via the training regime of NPs, namely updating the kernel hyperparameters at each iteration via one gradient step of the marginal likelihood on the mini-batch of data. However, this would still have a $\mathsf { \bar { O } } ( n ^ { 3 } )$ computational cost in the naive setting and may require kernel approximations. In general, the predictive uncertainties of GPs depend heavily on the choice of the kernel, whereas NPs learn predictive uncertainties directly from the data. Despite these drawbacks, GPs have the benefit of being consistent stochastic processes, and the covariance between the predictions at different $x$ -values and the marginal variance of each prediction can be expressed exactly in closed form, a feature that the current formulation of (A)NPs do not have. Variational Implicit Processes (VIP) (Ma et al., 2018) are also related to NPs, where VIP defines a stochastic process using the same decoder setup with a finite dimensional $_ { z }$ . Here, however, the process and its posterior given observed data are both approximated by a GP and learned via a generalisation of the Wake-Sleep algorithm (Hinton et al., 1995).
144
+
145
+ Meta-Learning (A)NPs can be seen as models that do few-shot learning, although this is not the focus of our work. Given input-output pairs drawn from a new function at test time, one can reason about this function by looking at the predictive distribution conditioning on these input-output pairs. There is a plethora of works in few-shot classification, of which Vinyals et al. (2016); Snell et al. (2017); Santoro et al. (2016) use attention to locate the relevant observed image/prototype given a query image. Attention has also been used for tasks in Meta-RL such as continuous control and visual navigation (Mishra et al., 2018). Few-shot density estimation using attention has also been explored extensively in numerous works (Rezende et al., 2016; Reed et al., 2017; Bornschein et al., 2017; Bartunov & Vetrov, 2018). Especially relevant are the Neural Statistician (Edwards & Storkey, 2017) and the Variational Homoencoder (Hewitt et al., 2018) who have a similar permutation invariant encoder (that outputs summaries of a data set), but use local latents on top of a global latent. For ANPs, we look at the less-explored regression setting. The authors of Vfunc (Bachman et al., 2018) also explore regression on a toy 1D domain, using a similar setup to NPs but optimising an approximation to the entropy of the latent function, without any attention mechanisms. Multitask learning has also been tackled in the GP literature by various works (Teh et al., 2005; Bonilla et al., 2008; Alvarez et al., 2012; Dai et al., 2017).
146
+
147
+ Generative Query Networks (Eslami et al., 2018; Kumar et al., 2018) are models for spatial prediction that render a frame of a scene given a viewpoint. Their model corresponds to a special case of NPs where the $_ { \textbf { \em x } }$ are viewpoints and the $\textbf { { y } }$ are frames of a scene. Rosenbaum et al. (2018) apply the GQN to the task of 3D localisation with an attention mechanism, but attention is applied to patches of context frames $( y )$ instead of a parametric representation of viewpoints $( { \pmb x } )$ . Note that in our work the targets attend to the contexts via the $_ { \textbf { \em x } }$ .
148
+
149
+ # 6 CONCLUSION AND DISCUSSION
150
+
151
+ We have proposed ANPs, which augment NPs with attention to resolve the fundamental problem of underfitting. We have shown that this greatly improves the accuracy of predictions in terms of context and target NLL, results in faster training, and expands the range of functions that can be modelled. There is a wide scope of future work for ANPs. Regarding model architecture, one way of incorporating cross-attention into the latent path and modelling the dependencies across the resulting local latents is to also have a global latent, much like the setup of the Neural Statistician but translated to the regression setting. An interesting further application would be to train ANPs on text data, enabling them to fill in the blanks in a stochastic manner. For the image application, the Image Transformer (ImT) (Parmar et al., 2018) has some interesting connections with ANPs: its local self-attention used to predict consecutive pixel blocks from previous blocks has parallels with how our model attends to context pixels to predict target pixels. Replacing the MLP in the decoder of the ANP with self-attention across the target pixels, we have a model that closely resembles an ImT defined on arbitrary orderings of pixels. This is in contrast to the original ImT, which presumes a fixed ordering and is trained autoregressively. We plan to equip ANPs with self-attention in the decoder, and see how far their expressiveness can be extended. In this setup, however, the targets will affect each other’s predictions, so the ordering and grouping of the targets will become important.
152
+
153
+ # ACKNOWLEDGMENTS
154
+
155
+ We would like to thank Ali Razavi for his advice on implementing multihead attention, and Michael Figurnov for helpful discussion.
156
+
157
+ # REFERENCES
158
+
159
+ Mauricio A Alvarez, Lorenzo Rosasco, Neil D Lawrence, et al. Kernels for vector-valued functions: A review. Foundations and Trends $\textsuperscript { \textregistered }$ in Machine Learning, 4(3):195–266, 2012.
160
+
161
+ Philip Bachman, Riashat Islam, Alessandro Sordoni, and Zafarali Ahmed. Vfunc: a deep generative model for functions. arXiv preprint arXiv:1807.04106, 2018.
162
+
163
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In ICLR, 2015.
164
+
165
+ Sergey Bartunov and Dmitry P Vetrov. Fast adaptation in generative models with generative matching networks. In AISTATS, 2018.
166
+
167
+ Edwin V Bonilla, Kian M Chai, and Christopher Williams. Multi-task gaussian process prediction. In NIPS, 2008.
168
+
169
+ Jorg Bornschein, Andriy Mnih, Daniel Zoran, and Danilo Jimenez Rezende. Variational memory ¨ addressing in generative models. In NIPS, 2017.
170
+
171
+ Zhenwen Dai, Mauricio A Alvarez, and Neil Lawrence. Efficient modeling of latent information in ´ supervised learning using gaussian processes. In NIPS, 2017.
172
+
173
+ Harrison Edwards and Amos Storkey. Towards a neural statistician. In ICLR, 2017.
174
+
175
+ SM Ali Eslami, Danilo Jimenez Rezende, Frederic Besse, Fabio Viola, Ari S Morcos, Marta Garnelo, Avraham Ruderman, Andrei A Rusu, Ivo Danihelka, Karol Gregor, et al. Neural scene representation and rendering. Science, 360(6394):1204–1210, 2018.
176
+
177
+ Marta Garnelo, Dan Rosenbaum, Christopher Maddison, Tiago Ramalho, David Saxton, Murray Shanahan, Yee Whye Teh, Danilo Rezende, and SM Ali Eslami. Conditional neural processes. In ICML, 2018a.
178
+
179
+ Marta Garnelo, Jonathan Schwarz, Dan Rosenbaum, Fabio Viola, Danilo J Rezende, SM Eslami, and Yee Whye Teh. Neural processes. In ICML Workshop on Theoretical Foundations and Applications of Deep Generative Models, 2018b.
180
+
181
+ Alex Graves. Supervised sequence labelling with recurrent neural networks. Springer, 2012.
182
+
183
+ Luke B Hewitt, Maxwell I Nye, Andreea Gane, Tommi Jaakkola, and Joshua B Tenenbaum. The variational homoencoder: Learning to learn high capacity generative models from few examples. In UAI, 2018.
184
+
185
+ Geoffrey E Hinton, Peter Dayan, Brendan J Frey, and Radford M Neal. The” wake-sleep” algorithm for unsupervised neural networks. Science, 268(5214):1158–1161, 1995.
186
+
187
+ D. P. Kingma and J. Ba. Adam: A method for stochastic optimization. In ICLR, 2015.
188
+
189
+ Diederik P Kingma and Max Welling. Auto-encoding variational bayes. In ICLR, 2014.
190
+
191
+ Ananya Kumar, SM Eslami, Danilo J Rezende, Marta Garnelo, Fabio Viola, Edward Lockhart, and Murray Shanahan. Consistent generative query networks. arXiv preprint arXiv:1807.02033, 2018.
192
+
193
+ Yann LeCun, Leon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to ´ document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
194
+
195
+ Z. Liu, P. Luo, X. Wang, and X. Tang. Deep learning face attributes in the wild. In Proceedings of the IEEE International Conference on Computer Vision, pp. 3730–3738, 2015.
196
+
197
+ Chao Ma, Yingzhen Li, and Jose Miguel Hern ´ andez-Lobato. Variational implicit processes. ´ arXiv preprint arXiv:1806.02390, 2018.
198
+
199
+ Nikhil Mishra, Mostafa Rohaninejad, Xi Chen, and Pieter Abbeel. A simple neural attentive metalearner. In ICLR, 2018.
200
+
201
+ Niki Parmar, Ashish Vaswani, Jakob Uszkoreit, Łukasz Kaiser, Noam Shazeer, and Alexander Ku. Image transformer. In ICML, 2018.
202
+
203
+ Scott Reed, Yutian Chen, Thomas Paine, Aaron van den Oord, SM Eslami, Danilo Rezende, Oriol ¨ Vinyals, and Nando de Freitas. Few-shot autoregressive density estimation: Towards learning to learn distributions. arXiv preprint arXiv:1710.10304, 2017.
204
+
205
+ Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. In ICML, pp. 1278–1286, 2014.
206
+
207
+ Danilo Jimenez Rezende, Shakir Mohamed, Ivo Danihelka, Karol Gregor, and Daan Wierstra. Oneshot generalization in deep generative models. arXiv preprint arXiv:1603.05106, 2016.
208
+
209
+ Dan Rosenbaum, Frederic Besse, Fabio Viola, Danilo J Rezende, and SM Eslami. Learning models for visual 3d localization with implicit mapping. arXiv preprint arXiv:1807.03149, 2018.
210
+
211
+ Adam Santoro, Sergey Bartunov, Matthew Botvinick, Daan Wierstra, and Timothy Lillicrap. Oneshot learning with memory-augmented neural networks. arXiv preprint arXiv:1605.06065, 2016.
212
+
213
+ Jake Snell, Kevin Swersky, and Richard Zemel. Prototypical networks for few-shot learning. In NIPS, 2017.
214
+
215
+ Yee Whye Teh, Matthias Seeger, and Michael Jordan. Semiparametric latent factor models. In AISTATS, 2005.
216
+
217
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In NIPS, 2017.
218
+
219
+ Oriol Vinyals, Charles Blundell, Tim Lillicrap, Daan Wierstra, et al. Matching networks for one shot learning. In NIPS, 2016.
220
+
221
+ Andrew Gordon Wilson, Zhiting Hu, Ruslan Salakhutdinov, and Eric P Xing. Deep kernel learning. In Artificial Intelligence and Statistics, pp. 370–378, 2016.
222
+
223
+ # APPENDIX
224
+
225
+ # A ARCHITECTURAL DETAILS FOR (A)NP
226
+
227
+ We show the architectural details of the NP and the Multihead ANP models used for the 1D and 2D regression experiments below in Figure 8. All MLPs have relu non-linearities except the final layer, which has no non-linearity. The latent path outputs $\mu _ { z } , \omega _ { z } \in \mathbb { R } ^ { d }$ , which parameterises $q ( z | \dot { s _ { C } } ) = N ( z | \mu _ { z } , 0 . 1 + 0 . 9 \sigma ( \omega _ { z } ) )$ where $\sigma$ is the sigmoid function. Similarly the decoder outputs $\mu _ { y } , \omega _ { y }$ , which parameterises $p ( \check { \pmb { y } } _ { i } | \mathbf { z } , \mathbf { x } _ { C } , \pmb { y } _ { C } , \pmb { x } _ { i } ) = \mathcal { N } ( \pmb { y } _ { i } | \mu _ { y } , 0 . 1 + 0 . 9 f ( \omega _ { y } ) )$ where $f$ is the softplus function.
228
+
229
+ The 1D regression experiments use the basic formulation of multihead cross-attention (denoted M ultihead1) in Figure 8, whereas the 2D regression experiments uses a form of multihead crossattention used in the Image Transformer (Parmar et al., 2018). The only difference is that we do not use dropout, to limit the stochasticity of the model to the latent $z$ .
230
+
231
+ Self-attention uses the same architecture as cross-attention but with $k _ { i } = v _ { i }$ , $q = k _ { j }$ for each $j \in C$ , to output $| C |$ representations given $| C |$ input representations. Since the self-attention module has the same number of inputs and outputs, it can be stacked. We stack 2 layers of self-attention for Stacked Multihead ANP in the 2D Image regression experiments. Stacking more layers did not lead to noticeable gains qualitatively and quantitatively.
232
+
233
+ # B EXPERIMENTAL DETAILS OF 1D FUNCTION REGRESSION EXPERIMENT
234
+
235
+ For the squared exponential kernel of the data generating GP, we use a length scale $l = 0 . 6$ and kernel scale $\sigma _ { f } ^ { 2 } = \mathrm { \bar { 1 } }$ for the fixed kernel hyperparameter experiments. For the random kernel hyperparameter case, we sample $l \sim U [ 0 . 1 , 0 . 6 ]$ , $\sigma _ { f } \sim U [ 0 . 1 , 1 ]$ . For both, the likelihood noise is $\sigma _ { n } = 0 . 0 2$ . We use a batch size of 16 — in the fixed hyperparameter setting, we draw 16 curves from a GP with these hyperparameters, and in the random hyperparameter setting, we sample 16 random values of hyperparameters and draw a curve from GPs with each of these hyperparameters. We use the Adam Optimiser (Kingma & Ba, 2015) with a fixed learning rate of 5e-5 and Tensorflow defaults for the other hyperparameters. We use one sample of $q ( z | \mathbf { \mathit { s } } _ { C } )$ to form a MC estimate of the loss in Equation (3) during training and evaluation.
236
+
237
+ For NP, $d$ is varied between $\{ 1 2 8 , 2 5 6 , 5 1 2 , 1 0 2 4 \}$ whereas for ANP we always use $d = 1 2 8$ .
238
+
239
+ ![](images/8cf6eafd11824217a59e31319e0e8dec929cdfc6a5a2e934999ca93095b32568.jpg)
240
+ Figure 8: The model architecture for NP and ANP for both 1D and 2D regression.
241
+
242
+ # C ADDITIONAL FIGURES FOR 1D REGRESSION ON GP DATA
243
+
244
+ ![](images/21a7bfa76c05b01245d704f5574832eab8a49f6f8d18829dba783e77e31bd953.jpg)
245
+ Figure 9: Same as right of Figure 3 but also comparing against the oracle GP from which context was drawn.
246
+
247
+ In Figure 9 we also compare the trained (A)NP models against the oracle GP from which the contexts were drawn. We see that the predictions Multihead ANP is notably closer to that of the oracle GP than the NP, but still underestimates the predictive variance. One possible explanation for this is that variational inference (used for learning the ANP) usually leads to underestimates of predictive variance. It would be interesting to investigate how this issue can be addressed.
248
+
249
+ ![](images/e8424775eaa265e1b44fe1b2a4c1bf534e70de9b55d46acd462f9dd68107c120.jpg)
250
+ Figure 10: Same as Figure 3 but for fixed kernel hyperparameters.
251
+
252
+ The right of Figure 10 shows the conditional distributions for fixed kernel hyperparameters (with contexts drawn from the GP with these kernel hyperparameters), with highly non-smooth behaviour for dot-product attention as with the random kernel hyperparameter case. This behaviour seems to arise when the dot-product attention collapses to the local minimum of learning to be a nearest neighbour predictor (with one entry of the softmax becoming saturated), hence giving good reconstructions but poor interpolations between context points.
253
+
254
+ ![](images/e1d944521282fff47edf9afec80b595c135a710e7bd7d3d10e1f694f45a4d603.jpg)
255
+ Figure 11: KL term in NP loss throughout training for data generated from a GP with fixed (left) and random (right) kernel hyperparameters, using the same colour scheme as Figure 10.
256
+
257
+ Figure 11 shows how the KL term in the (A)NP loss differs between training on the fixed kernel hyperparameter GP data and on the random kernel hyperparameter GP data. In the fixed hyperparameter case, the KL for multihead ANP quickly goes to 0, indicating that the model deems the deterministic path sufficient to make accurate predictions. However in the random hyperparameter case, there is added variation in the data, hence the attention gives a non-zero KL and uses the latents to model the uncertainty in the realisation of the stochastic process given some context points. In other words, given a context set, the model believes that there are multiple realisations of the stochastic process that can explain these contexts well, hence uses the latents to model this variation.
258
+
259
+ ![](images/0ee4c67b8ede6dd2fa6e6dbdb2aeee44dfdeeb7504d69cfebe1f20e561cd29de.jpg)
260
+ Figure 12: Simple and cumulative regret for BO.
261
+
262
+ Using the same (A)NPs trained on the 1D GP data, we tackle the BO problem of finding the minimum of test functions drawn from a GP prior. We compare ANPs trained with different attention mechanisms to an oracle GP for which we set the kernel hyperparameters to their true value. (A)NPs can be used for BO by considering all previous function evaluations as context points, thus obtaining an informed surrogate of the target function. While other choices are possible, we use Thompson sampling to drawing a simple function from the surrogate and acting according to its minimal predicted value. We show results averaged over 100 test functions in Figure 12. We can see that the simple regret (the difference between the predicted and true minimum) is consistently smallest for a NP with multihead attention, approaching the oracle GP. Among the NPs, the slope of the cumulative regret (simple regret summed up to given iteration) decreases most rapidly for multihead, indicating that previous function evaluations are being put to good use for subsequent predictions of the function minimum. The reason that the cumulative regret is initially lower than the oracle GP is a consequence of under-exploration, due to the uncertainties of ANP away from the context being smaller than that of the oracle GP.
263
+
264
+ # D EXPERIMENTAL DETAILS OF 2D IMAGE REGRESSION EXPERIMENT
265
+
266
+ Analogous to the 1D experiments, we take random pixels of a given image at training as targets, and select a subset of this as contexts, again choosing the number of contexts and targets randomly $\mathrm { \Delta } n \sim U [ 3 , 2 0 0 ]$ , $m \sim n + U [ 0 , 2 0 0 - \bar { n } ] )$ . The $_ { \textbf { \em x } }$ are rescaled to $[ - 1 , 1 ]$ and the $\textbf { { y } }$ are rescaled to $[ - 0 . 5 , 0 . 5 ]$ . We use a batch size of 16 for both MNIST and CelebA, i.e. use 16 randomly selected images for each batch. We use a learning rate of 5e-5 and 4e-5 respectively for MNIST and CelebA using the Adam optimiser with Tensorflow defaults for the other hyperparameters. The stacked self-attention architecture is the same as in the Image Transformer (Parmar et al., 2018), except that we do not use Dropout to restrict the stochasticity of the model to the global latent $_ z$ , and do not use positional embeddings of the pixels. We use the same architecture for both Mnist and CelebA, and highlight that little tuning has been done regarding the architectural hyperparameters. We again use one sample of $q ( \boldsymbol { z } | \boldsymbol { s } _ { C } )$ to form a MC estimate of the loss in Equation (3) during training and evaluation.
267
+
268
+ # E ADDITIONAL FIGURES FOR 2D IMAGE REGRESSION ON MNIST AND CELEBA
269
+
270
+ We can see visually that the NP overestimates the predictive variance by looking at the plot of the standard deviation (bottom row) of Figure 13a. We see that the original NP shows noticeable uncertainty around the edges of the reconstruction for all context sets, whereas for the NP with attention, the uncertainty is reduced significantly as you increase the number of contexts until it almost disappears for the full context.
271
+
272
+ ![](images/949bac79d4cddf0a8c5099f1f1156af3cfcea2a1919ca9f872c00c6e9af89d59.jpg)
273
+ (b) Same as Figure 4b but for MNIST.
274
+
275
+ (a) Same as Figure 4a but for MNIST.
276
+
277
+ ![](images/28eab2cdc533d57564d926bf752144c5c69d007c242554d1a75deeeaa608b8af.jpg)
278
+ Figure 13: Qualitative and quantitative results of different attention mechanisms on test set for 2D MNIST function regression.
279
+
280
+ ![](images/4e47e791cd12a926ebc2e0d7d9f86ef163f653dd9268b3723fecc066a504185c.jpg)
281
+ Figure 14: More MNIST reconstruction of full image from top half.499th export - 5e6 iter, xid=1650728, num_contexts=200, lr=5e-4
282
+ Figure 15: More CelebA reconstruction of full image from top half.
283
+
284
+ From Figures 14 and 15 we see that Stacked Multihead ANP improves results significantly over Multihead ANP, giving sharper images with better global coherence even in the case where the face isn’t axis-aligned (see Figure 15a).
285
+
286
+ Note that in Figure 7, the contexts contain the target, relying on the cyan head would be enough to give an accurate prediction, but the different roles of these heads also hold in the case where the target is disjoint from the context. This is shown in Figure 16 where the context is disjoint from the target. Here all heads become useful for the target prediction.
287
+
288
+ ![](images/c1ca98b476ba0edb8716ab6204cf13514d1468c0603f38bc6b88a6881cf98dd7.jpg)
289
+ Figure 16: Visualisation of pixels attended by each head of multihead attention in the NP given a target pixel and a separate context of 100 random pixels. Each head is given a different colour (consistent with the colours in Figure 7 and the target pixel is marked by a cross.
290
+
291
+ ![](images/4f96913df6f84f7596017ea6090da7387f53f286daf6efa445a107920678ff8c.jpg)
292
+ Figure 17: Same as Figure 4a but for a different image.
293
+
294
+ ![](images/779adeb3f18e4efcc71266c32815e77ce550a7c399631f49dc312aabd8143e42.jpg)
295
+ Figure 18: Same as Figure 4a but for a different image.
296
+
297
+ ![](images/8df6ea84c309649d04e7d3c77526511cc065c016c2daa79ab93190f291dc161f.jpg)
298
+ Figure 19: Mapping from $3 2 \times 3 2$ to $2 5 6 \times 2 5 6$ for different images.
md/train/SkeXehR9t7/SkeXehR9t7.md ADDED
@@ -0,0 +1,335 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GRAPH2SEQ: GRAPH TO SEQUENCE LEARNING WITH ATTENTION-BASED NEURAL NETWORKS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ The celebrated Sequence to Sequence learning (Seq2Seq) technique and its numerous variants achieve excellent performance on many tasks. However, many machine learning tasks have inputs naturally represented as graphs; existing Seq2Seq models face a significant challenge in achieving accurate conversion from graph form to the appropriate sequence. To address this challenge, we introduce a general end-to-end graph-to-sequence neural encoder-decoder architecture that maps an input graph to a sequence of vectors and uses an attention-based LSTM method to decode the target sequence from these vectors. Our method first generates the node and graph embeddings using an improved graph-based neural network with a novel aggregation strategy to incorporate edge direction information in the node embeddings. We further introduce an attention mechanism that aligns node embeddings and the decoding sequence to better cope with large graphs. Experimental results on bAbI, Shortest Path, and Natural Language Generation tasks demonstrate that our model achieves state-of-the-art performance and significantly outperforms existing graph neural networks, Seq2Seq, and Tree2Seq models; using the proposed bi-directional node embedding aggregation strategy, the model can converge rapidly to the optimal performance.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ The celebrated Sequence to Sequence learning (Seq2Seq) technique and its numerous variants achieve excellent performance on many tasks such as Neural Machine Translation (Bahdanau et al., 2014; Gehring et al., 2017), Natural Language Generation (NLG) (Song et al., 2017) and Speech Recognition(Zhang et al., 2017). Most of the proposed Seq2Seq models can be viewed as a family of encoder-decoders (Sutskever et al., 2014; Cho et al., 2014; Bahdanau et al., 2014), where an encoder reads and encodes a source input in the form of sequences into a continuous vector representation of fixed dimension, and a decoder takes the encoded vectors and outputs a target sequence. Many other enhancements including Bidirectional Recurrent Neural Networks (Bi-RNN) (Schuster & Paliwal, 1997) or Bidirectional Long Short-Term Memory Networks (Bi-LSTM) (Graves & Schmidhuber, 2005) as encoder, and attention mechanism (Bahdanau et al., 2014; Luong et al., 2015), have been proposed to further improve its practical performance for general or domain-specific applications.
12
+
13
+ Despite their flexibility and expressive power, a significant limitation with the Seq2Seq models is that they can only be applied to problems whose inputs are represented as sequences. However, the sequences are probably the simplest structured data, and many important problems are best expressed with a more complex structure such as graphs that have more capacity to encode complicated pair-wise relationships in the data. For example, one task in NLG applications is to translate a graph-structured semantic representation such as Abstract Meaning Representation to a text expressing its meaning (Banarescu et al., 2013). In addition, path planning for a mobile robot (Hu & Yang, 2004) and path finding for question answering in bAbI task (Li et al., 2015) can also be cast as graph-to-sequence problems.
14
+
15
+ On the other hand, even if the raw inputs are originally expressed in a sequence form, it can still benefit from the enhanced inputs with additional information (to formulate graph inputs). For example, for semantic parsing tasks (text-to-AMR or text-to-SQL), they have been shown better performance by augmenting the original sentence sequences with other structural information such as dependency parsing trees (Pust et al., 2015). Intuitively, the ideal solution for graph-to-sequence tasks is to build a more powerful encoder which is able to learn the input representation regardless of its inherent structure.
16
+
17
+ To cope with graph-to-sequence problems, a simple and straightforward approach is to directly convert more complex structured graph data into sequences (Iyer et al., 2016; Gomez-Bombarelli´ et al., 2016; Liu et al., 2017), and apply sequence models to the resulting sequences. However, the Seq2Seq model often fails to perform as well as hoped on these problems, in part because it inevitably suffers significant information loss due to the conversion of complex structured data into a sequence, especially when the input data is naturally represented as graphs. Recently, a line of research efforts have been devoted to incorporate additional information by extracting syntactic information such as the phrase structure of a source sentence (Tree2seq) (Eriguchi et al., 2016), by utilizing attention mechanisms for input sets (Set2seq)(Vinyals et al., 2015a), and by encoding sentences recursively as trees (Socher et al., 2010; Tai et al., 2015). Although these methods achieve promising results on certain classes of problems, most of the presented techniques largely depend on the underlying application and may not be able to generalize to a broad class of problems in a general way.
18
+
19
+ To address this issue, we propose Graph2Seq, a novel attention-based neural network architecture for graph-to-sequence learning. The Graph2Seq model follows the conventional encoder-decoder approach with two main components, a graph encoder and a sequence decoder. The proposed graph encoder aims to learn expressive node embeddings and then to reassemble them into the corresponding graph embeddings. To this end, inspired by a recent graph representation learning method (Hamilton et al., 2017a), we propose an inductive graph-based neural network to learn node embeddings from node attributes through aggregation of neighborhood information for directed and undirected graphs, which explores two distinct aggregators on each node to yield two representations that are concatenated to form the final node embedding. In addition, we further design an attention-based RNN sequence decoder that takes the graph embedding as its initial hidden state and outputs a target prediction by learning to align and translate jointly based on the context vectors associated with the corresponding nodes and all previous predictions. Our code and data are available at https://github.com/anonymous/Graph2Seq.
20
+
21
+ Graph2Seq is simple yet general and is highly extensible where its two building blocks, graph encoder and sequence decoder, can be replaced by other models such as Graph Convolutional (Attention) Networks (Kipf & Welling, 2016; Velickovic et al., 2017) or their extensions (Schlichtkrull et al., 2017), and LSTM (Hochreiter & Schmidhuber, 1997). We highlight three main contributions of this paper as follows:
22
+
23
+ • We propose a new attention-based neural networks paradigm to elegantly address graphto-sequence learning problems that learns a mapping between graph-structured inputs to sequence outputs, which current Seq2Seq and Tree2Seq may be inadequate to handle. We propose a novel graph encoder to learn a bi-directional node embeddings for directed and undirected graphs with node attributes by employing various aggregation strategies, and to learn graph-level embedding by exploiting two different graph embedding techniques. Equally importantly, we present an attention mechanism to learn the alignments between nodes and sequence elements to better cope with large graphs. Experimental results show that our model achieves state-of-the-art performance on three recently introduced graph-to-sequence tasks and significantly outperforms existing graph neural networks, Seq2Seq, and Tree2Seq models.
24
+
25
+ # 2 RELATED WORK
26
+
27
+ Our model draws inspiration from the research fields of graph representation learning, neural networks on graphs, and neural encoder-decoder models.
28
+
29
+ Graph Representation Learning. Graph representation learning has been proven extremely useful for a broad range of the graph-based analysis and prediction tasks (Hamilton et al., 2017b; Goyal & Ferrara, 2017). The main goal for graph representation learning is to learn a mapping that embeds nodes as points in a low-dimensional vector space. These representation learning approaches can be roughly categorized into two classes including matrix factorization-based algorithms and random-walk based methods. A line of research learn the embeddings of graph nodes through matrix factorization (Roweis & Saul, 2000; Belkin & Niyogi, 2002; Ahmed et al., 2013; Cao et al., 2015; Ou et al., 2016). These methods directly train embeddings for individual nodes of training and testing data jointly and thus inherently transductive. Another family of work is the use of random walk-based methods to learn low-dimensional embeddings of nodes by exploring neighborhood information for a single large-scale graph (Duran & Niepert, 2017; Hamilton et al., 2017a; Tang et al., 2015; Grover & Leskovec, 2016; Perozzi et al., 2014; Velickovic et al., 2017).
30
+
31
+ GraphSAGE (Hamilton et al., 2017a) is such a technique that learns node embeddings through aggregation from a node local neighborhood using node attributes or degrees for inductive learning, which has better capability to generate node embeddings for previously unseen data. Our graph encoder is an extension to GraphSAGE with two major distinctions. First, we non-trivially generalize it to cope with both directed and undirected graphs by splitting original node into forward nodes (a node directs to) and backward nodes (direct to a node) according to edge direction and applying two distinct aggregation functions to these types of nodes. Second, we exploit two different schemes (pooling-based and supernode-based) to reassemble the learned node embeddings to generate graph embedding, which is not studied in GraphSAGE. We show the advantages of our graph encoder over GraphSAGE in our experiments.
32
+
33
+ Neural Networks on Graphs. Over the past few years, there has been a surge of approaches that seek to learn the representations of graph nodes, or entire (sub)graphs, based on Graph Neural Networks (GNN) that extend well-known network architectures including RNN and CNN to graph data (Gori et al., 2005; Scarselli et al., 2009; Li et al., 2015; Bruna et al., 2013; Duvenaud et al., 2015; Niepert et al., 2016; Defferrard et al., 2016; Yang et al., 2016; Kipf & Welling, 2016; Chen et al., 2018). A line of research is the neural networks that operate on graphs as a form of RNN (Gori et al., 2005; Scarselli et al., 2009), and recently extended by Li et al. (Li et al., 2015) by introducing modern practices of RNN (using of GRU updates) in the original GNN framework. Another important stream of work that has recently drawn fast increasing interest is graph convolutional networks (GCN) built on spectral graph theory, introduced by Bruna et al. (2013) and then extended by Defferrard et al. (2016) with fast localized convolution. Most of these approaches cannot scale to large graphs, which is improved by using a localized first-order approximation of spectral graph convolution (Kipf & Welling, 2016) and further equipping with important sampling for deriving a fast GCN (Chen et al., 2018).
34
+
35
+ The closely relevant work to our graph encoder is GCN (Kipf & Welling, 2016), which is designed for semi-supervised learning in transductive setting that requires full graph Laplacian to be given during training and is typically applicable to a single large undirected graph. An extension of GCN can be shown to be mathematically related to one variant of our graph encoder on undirected graphs. We compare the difference between our graph encoder and GCN in our experiments. Another relevant work is gated graph sequence neural networks (GGS-NNs) (Li et al., 2015). Although it is also designed for outputting a sequence, it is essentially a prediction model that learns to predict a sequence embedded in graph while our approach is a generative model that learns a mapping between graph inputs and sequence outputs. A good analogy that can be drawn between our proposed Graph2Seq and GGS-NNs is the relationship between convolutional Seq2Seq and RNN.
36
+
37
+ Neural Encoder-Decoder Models. One of the most successful encoder-decoder architectures is the sequence to sequence learning (Sutskever et al., 2014; Cho et al., 2014; Bahdanau et al., 2014; Luong et al., 2015; Gehring et al., 2017), which are originally proposed for machine translation. Recently, the classical Seq2Seq model and its variants have been applied to several applications in which these models can perform mappings from objects to sequences, including mapping from an image to a sentence (Vinyals et al., 2015c), models for computation map from problem statements of a python program to their solutions (the answers to the program) (Zaremba & Sutskever, 2014), the traveling salesman problem for the set of points (Vinyals et al., 2015b) and deep generative model for molecules generation from existing known molecules in drug discovery. It is easy to see that the objects that are mapped to sequences in the listed examples are often naturally represented in graphs rather than sequences.
38
+
39
+ Recently, many research efforts and the key contributions have been made to address the limitations of Seq2Seq when dealing with more complex data, that leverage external information using specialized neural models attached to underlying targeted applications, including Tree2Seq (Eriguchi et al., 2016), Set2Seq (Vinyals et al., 2015a), Recursive Neural Networks (Socher et al., 2010), and Tree
40
+
41
+ ![](images/ebaaeb200039f192b3d48bb9edba8682351d9f9f7c8d4576d5af3eab617c0a45.jpg)
42
+ Figure 1: The framework of Graph2Seq model.
43
+
44
+ Structured LSTM (Tai et al., 2015). Due to more recent advances in graph representations and graph convolutional networks, a number of research has investigated to utilize various GNN to improve the performance over the Seq2Seq models in the domains of machine translation and graph generation (Bastings et al., 2017; Simonovsky & Komodakis, 2018; Li et al., 2018). There are several distinctions between these work and ours. First, our model is the first general-purpose encoderdecoder architecture for graph-to-sequence learning that is applicable to different applications while the aforementioned research has to utilize domain-specific information. Second, we design our own graph embedding techniques for our graph decoder while most of other work directly apply existing GNN to their problems.
45
+
46
+ # 3 GRAPH-TO-SEQUENCE MODEL
47
+
48
+ As shown in Figure 1, our graph-to-sequence model includes a graph encoder, a sequence decoder, and a node attention mechanism. Following the conventional encoder-decoder architecture, the graph encoder first generates node embeddings, and then constructs graph embeddings based on the learned node embeddings. Finally, the sequence decoder takes both the graph embeddings and node embeddings as input and employs attention over the node embeddings whilst generating sequences. In this section, we first introduce the node-embedding generation algorithm which derives the bi-directional node embeddings by aggregating information from both forward and backward neighborhoods of a node in a graph. Upon these node embeddings, we propose two methods for generating graph embeddings capturing the whole-graph information.
49
+
50
+ # 3.1 NODE EMBEDDING GENERATION
51
+
52
+ Inspired by Hamilton et al. (2017a), we design a new inductive node embedding algorithm that generates bi-directional node embeddings by aggregating information from a node local forward and backward neighborhood within $K$ hops for both directed and undirected graphs. In order to make it more clear, we take the embedding generation process for node $v \in \mathcal V$ as an example to explain our node embedding generation algorithm:1
53
+
54
+ 1) We first transform node $v$ ’s text attribute to a feature vector, $\mathbf { a } _ { v }$ , by looking up the embedding matrix $\mathbf { W } _ { e }$ . Note that for some tasks where $v$ ’s text attribute may be a word sequence, one neural network layer, such as an LSTM layer, could be additionally used to generate $\mathbf { a } _ { v }$ .
55
+ 2) We categorize the neighbors of $v$ into forward neighbors, $\mathcal { N } _ { \vdash } ( v )$ , and backward neighbors, $\mathcal { N } _ { - 1 } ( v )$ , according to the edge direction. In particular, $\mathcal { N } _ { \vdash } ( v )$ returns the nodes that $v$ directs to and $\mathcal { N } _ { \mathbb { - } } ( v )$ returns the nodes that direct to $v$ ;
56
+ 3) We aggregate the forward representations of $v$ ’s forward neighbors $\{ \mathbf { h } _ { u \vdash } ^ { k - 1 } , \forall u \in \mathcal { N } _ { \vdash } ( v ) \}$ into a single vector, $\mathbf { h } _ { \mathcal { N } _ { \mathrm { i } } ( v ) } ^ { k }$ , where $k { \in } \{ 1 , . . . , K \}$ is the iteration index. In our experiments, we find that the aggregator choice, AGGREGAT $\mathbb { E } _ { k } ^ { \vdash }$ , may heavily affect the overall performance and we will discuss it later. Notice that at iteration $k$ , this aggregator only uses the representations generated
57
+
58
+ at $k - 1$ . The initial forward representation of each node is its feature vector calculated in step (1);
59
+
60
+ 4) We concatenate $v$ ’s current forward representation, hk−1v\` , with the newly generated neighborhood vector, $\mathbf { h } _ { \mathcal { N } _ { \mathrm { i } } ( v ) } ^ { k }$ . This concatenated vector is fed into a fully connected layer with nonlinear activation function $\sigma$ , which updates the forward representation of $v$ , $\mathbf { h } _ { v \vdash } ^ { k }$ , to be used at the next iteration;
61
+ 5) We update the backward representation of $v$ , $\mathbf { h } _ { v - 1 } ^ { k }$ , using the similar procedure as introduced in step (3) and (4) except that operating on the backward representations instead of the forward representations;
62
+ 6) We repeat steps $( 3 ) { \sim } ( 5 )$ $K$ times, and the concatenation of the final forward and backward representation is used as the final bi-directional representation of $v$ . Since the neighbor information from different hops may have different impact on the node embedding, we learn a distinct aggregator at each iteration.
63
+
64
+ Aggregator Architectures. Since a node neighbors have no natural ordering, the aggregator function should be invariant to permutations of its inputs, ensuring that our neural network model can be trained and applied to arbitrarily ordered node-neighborhood feature sets. In practice, we examined the following three aggregator functions:
65
+
66
+ Mean aggregator: This aggregator function takes the element-wise mean of the vectors in $\{ \mathbf { h } _ { u \vdash } ^ { k - 1 }$ $\forall u \in \mathcal { N } _ { \vdash } ( v ) \}$ and $\{ \mathbf h _ { u \dash } ^ { k - 1 } , \forall u \in \mathcal { N } _ { \sf \tilde { \sf { M } } } ( v ) \}$ .
67
+
68
+ LSTM aggregator: Similar to (Hamilton et al., 2017a), we also examined a more complex aggregator based on an Long Short Term Memory (LSTM) architecture. Note that LSTMs are not inherently symmetric since they process their inputs sequentially. We use LSTMs to operate on unordered sets by simply applying them to a single random permutation of the node neighbors.
69
+
70
+ Pooling aggregator: In this aggregator, each neighbor’s vector is fed through a fully-connected neural network, and an element-wise max-pooling operation is applied:
71
+
72
+ $$
73
+ \mathtt { A G G R E G A T E } _ { k } ^ { \vdash } = \operatorname* { m a x } ( \{ \sigma ( \mathbf { W } _ { p o o l } \mathbf { h } _ { u \vdash } ^ { k } + \mathbf { b } ) , u \in \mathcal { N } _ { \vdash } ( v ) \} )
74
+ $$
75
+
76
+ $$
77
+ \mathtt { A G G R E G A T E } _ { k } ^ { - 1 } = \operatorname* { m a x } ( \{ \sigma ( \mathbf { W } _ { p o o l } \mathbf { h } _ { u } ^ { k } + \mathbf { b } ) , u \in \mathcal { N } _ { + } ( v ) \} )
78
+ $$
79
+
80
+ where max denotes the element-wise max operator, and $\sigma$ is a nonlinear activation function. By applying max-pooling, the model can capture different information across the neighborhood set.
81
+
82
+ # 3.2 GRAPH EMBEDDING GENERATION
83
+
84
+ Most existing works of graph convolution neural networks focus more on node embeddings rather than graph embeddings since their focus is on the node-wise classification task. However, graph embeddings that convey the entire graph information are essential to the downstream decoder. In this work, we introduce two approaches (i.e., Pooling-based and Node-based) to generate these graph embeddings from the node embeddings.
85
+
86
+ Pooling-based Graph Embedding. In this approach, we investigated three pooling techniques: max-pooling, min-pooling and average-pooling. In our experiments, we fed the node embeddings to a fully-connected neural network and applied each pooling method element-wise. We found no significant performance difference across the three different pooling approaches; we thus adopt the max-pooling method as our default pooling approach.
87
+
88
+ Node-based Graph Embedding. In this approach, we add one super node, $v _ { s }$ , into the input graph, and all other nodes in the graph direct to $v _ { s }$ . We use the aforementioned node embedding generation algorithm to generate the embedding of $v _ { s }$ by aggregating the embeddings of the neighbor nodes. The embedding of $v _ { s }$ that captures the information of all nodes is regarded as the graph embedding.
89
+
90
+ # 3.3 ATTENTION BASED DECODER
91
+
92
+ The sequence decoder is a Recurrent Neural Network (RNN) that predicts the next token $y _ { i }$ , given all the previous words $y _ { < i } = y _ { 1 } , . . . , y _ { i - 1 }$ , the RNN hidden state $s _ { i }$ for time $i$ , and a context vector $c _ { i }$ that directs attention to the encoder side. In particular, the context vector $c _ { i }$ depends on a set of node representations $( \mathbf { z } _ { 1 } , . . . , \mathbf { z } _ { \mathcal { V } } )$ which the graph encoder maps the input graph to. Each node representation $\mathbf { z } _ { i }$ contains information about the whole graph with a strong focus on the parts surrounding the $i$ -th node of the input graph. The context vector $c _ { i }$ is computed as a weighted sum of these node representations and the weight $\alpha _ { i j }$ of each node representation is computed by:
93
+
94
+ $$
95
+ c _ { i } = \sum _ { j = 1 } ^ { \nu } \alpha _ { i j } h _ { j } , w h e r e \alpha _ { i j } = \frac { \exp ( e _ { i j } ) } { \sum _ { k = 1 } ^ { \nu } \exp ( e _ { i k } ) } , e _ { i j } = a ( s _ { i - 1 } , h _ { j } )
96
+ $$
97
+
98
+ where $a$ is an alignment model which scores how well the input node around position $j$ and the output at position $i$ match. The score is based on the RNN hidden state $s _ { i - 1 }$ and the $j$ -th node representation of the input graph. We parameterize the alignment model $a$ as a feed-forward neural network which is jointly trained with other components of the proposed system. Our model is jointly trained to maximize the conditional log-probability of the correct description given a source graph. In the inference phase, we use the beam search to generate a sequence with the beam size $= 5$ .
99
+
100
+ # 4 EXPERIMENTS
101
+
102
+ We conduct experiments to demonstrate the effectiveness and efficiency of the proposed method. Following the experimental settings in (Li et al., 2015), we firstly compare its performance with classical LSTM, GGS-NN, and GCN based methods on two selected tasks including bAbI Task 19 and the Shortest Path Task. We then compare Graph2Seq against other Seq2Seq based methods on a real-world application - Natural Language Generation Task. Note that the parameters of all baselines are set based on performance on the development set.
103
+
104
+ Experimental Settings. Our proposed model is trained using the Adam optimizer (Kingma & Ba, 2014), with mini-batch size 30. The learning rate is set to 0.001. We apply the dropout strategy (Srivastava et al., 2014) with a ratio of 0.5 at the decoder layer to avoid overfitting. Gradients are clipped when their norm is bigger than 20. For the graph encoder, the default hop size $K$ is set to 6, the size of node initial feature vector is set to 40, the non-linearity function $\sigma$ is ReLU (Glorot et al., 2011), the parameters of aggregators are randomly initialized. The decoder has 1 layer and hidden state size is 80. Since Graph2Seq with mean aggregator and pooling-based graph embeddings generally performs better than other configurations (we defer this discussion to Sec. 4.4), we use this setting as our default model in the following sections.
105
+
106
+ # 4.1 BABI TASK 19
107
+
108
+ Setup. The bAbI artificial intelligence (AI) tasks (Weston et al., 2015) are designed to test reasoning capabilities that an AI system possesses. Among these tasks, Task 19 (Path Finding) is arguably the most challenging task (see, e.g., (Sukhbaatar et al., 2015) which reports an accuracy of less than $20 \%$ for all methods that do not use strong supervision). We apply the transformation procedure introduced in (Li et al., 2015) to transform the description as a graph as shown in Figure 2. The left part shows an instance of bAbI task 19: given a set of sentences describing the relative geographical positions for a pair of objects $o _ { 1 }$ and $O _ { 2 }$ , we aim to find the geographical path between $o _ { 1 }$ and $O _ { 2 }$ . The question is then treated as finding the shortest path between two nodes, $N _ { o _ { 1 } }$ and $N _ { o _ { 2 } }$ , which represent $o _ { 1 }$ and $o _ { 2 }$ in the graph. To tackle this problem with Graph2Seq, we annotate $N _ { o 1 }$ with text attribute START and $N _ { o _ { 2 } }$ with text attribute END. For other nodes, we assign their IDs in the graph as their text attributes. It is worth noting that, in our model, the START and END tokens are node features whose vector representations are first randomly initialized and then learned by the model later. In contrast, in GGS-NN, the vector representations of staring and end nodes are set as one-hot vectors, which is specially designed for the shortest path task.
109
+
110
+ To aggregate the edge information into the node embedding, for each edge, we additionally add a node representing this edge into the graph and assign the edge’s text as its text attribute. We generate 1000 training examples, 1000 development examples and 1000 test examples where each example is a graph-path pair. We use a standard LSTM model (Hochreiter & Schmidhuber, 1997) and GGSNN (Li et al., 2015) as our baselines. Since GCN (Kipf & Welling, 2016) itself cannot output a sequence, we also create a baseline that combines GCN with our sequence decoder.
111
+
112
+ Results. From Table 1, we can see that the LSTM model fails on this task while our model makes perfect predictions, which underlines the importance of the use of graph encoder to directly encode a graph instead of using sequence model on the converted inputs from a graph. Comparing to GGSNN that uses carefully designed initial embeddings for different types of nodes such as START and END, our model uses a purely end-to-end approach which generates the initial node feature vectors based on random initialization of the embeddings for words in text attributes. However, we still significantly outperform GGS-NN, demonstrating the expressive power of our graph encoder that considers information flows in both forward and backward directions. We observe similar results when comparing our whole Graph2Seq model to GCN with our decoder, which mainly because the current form of GCN (Kipf & Welling, 2016) is designed for undirected graph and thus may have information loss when converting directed graph to undirected one as suggested in (Kipf & Welling, 2016).
113
+
114
+ ![](images/1370f2f841b9d50938c5699f1849be49ed5aeed0b7aad098d1e077d942319ec7.jpg)
115
+ Figure 2: Path Finding Example.
116
+
117
+ Table 1: Results of our model and baselines on bAbI and Shortest Directed Path tasks.
118
+
119
+ <table><tr><td colspan="2">bAbIT19</td><td>SP-S</td><td>SP-L</td></tr><tr><td>LSTM</td><td>25.2%</td><td>8.1%</td><td>2.2%</td></tr><tr><td>GGS-NN</td><td>98.1%</td><td>100.0%</td><td>95.2%</td></tr><tr><td>GCN</td><td>97.4%</td><td>100.0%</td><td>96.5%</td></tr><tr><td>Graph2Seq</td><td>99.9%</td><td>100.0%</td><td>99.3%</td></tr></table>
120
+
121
+ # 4.2 SHORTEST PATH TASK
122
+
123
+ Setup. We further evaluate our model on the Shortest Path (SP) Task whose goal is to find the shortest directed path between two nodes in a graph, introduced in (Li et al., 2015). For this task, we created datasets by generating random graphs, and choosing pairs random nodes A and B which are connected by a unique shortest directed path. Since we can control the size of generated graphs, we can easily test the performance changes of each model when increasing the size of graphs as well. Two such datasets, SP-S and SP-L, were created, containing Small (node size ${ : = } 5$ ) and Large graphs (node size $= 1 0 0$ ), respectively. We restricted the length of the generated shortest paths for SP-S to be at least 2 and at least 4 for SP-L. For each dataset, we used 1000 training examples and 1000 development examples for parameter tuning, and evaluated on 1000 test examples. We choose the same baselines as introduced in the previous section.
124
+
125
+ Results. Table 1 shows that the LSTM model still fails on both of these two datasets. Our Graph2Seq model achieves comparable performance with GGS-NN that both models could achieve $100 \%$ accuracy on the SP-S dataset while achieves much better on larger graphs on the SP-L dataset. This is because our graph encoder is more expressive in learning the graph structural information with our dual-direction aggregators, which is the key to maintaining good performance when the graph size grows larger, while the performance of GGS-NN significantly degrades due to hardness of capturing the long-range dependence in a graph with large size. Compared to GCN, it achieves better performance than GGS-NN but still much lower than our Graph2Seq, in part because of both the poor effectiveness of graph encoder and incapability of handling with directed graph.
126
+
127
+ # 4.3 NATURAL LANGUAGE GENERATION TASK
128
+
129
+ Setup. We finally evaluate our model on a real-world application - Natural Language Generation (NLG) task where we translate a structured semantic representation—in this case a structured query language (SQL) query—to a natural language description expressing its meaning. As indicated in (Spiliopoulou & Hatzopoulos, 1992), the structure of SQL query is essentially a graph. Thus we naturally cast this task as an application of the graph-to-sequence model which takes a graph representing the semantic structure as input and outputs a sequence. Figure 3 illustrates the process of translation of an SQL query to a corresponding natural language description via our Graph2Seq model.2
130
+
131
+ We use the BLEU-4 score to evaluate our model on the WikiSQL dataset (Zhong et al., 2017), a corpus of 87,726 hand-annotated instances of natural language questions, SQL queries, and SQL tables. WikiSQL was created as the benchmark dataset for the table-based question answering task (for which the state-of-the-art performance is $8 2 . 6 \%$ execution accuracy (Yu et al., 2018)); here we reverse the use of the dataset, treating the SQL query as the input and having the goal of generating the correct English question. These WikiSQL SQL queries are split into training, development and test sets, which contain 61297 queries, 9145 queries and 17284 queries, respectively.
132
+
133
+ ![](images/e1b982306e2189b2ef8604f085cdfdf87df55cd954e87b67cf907e7e1ad3180b.jpg)
134
+ Figure 3: A running example of the NLG task.
135
+
136
+ Table 2: Results on WikiSQL.
137
+
138
+ <table><tr><td></td><td>BLEU-4</td></tr><tr><td>Seq2Seq</td><td>20.91</td></tr><tr><td>Seq2Seq + Copy</td><td>24.12</td></tr><tr><td>Tree2Seq</td><td>26.67</td></tr><tr><td>Graph2Seq-NGE</td><td>34.28</td></tr><tr><td>Graph2Seq-PGE</td><td>38.97</td></tr></table>
139
+
140
+ Since the SQL-to-Text task can be cast as ”machine translation” type of problems, we implemented several baselines to address this task. The first one is an attention-based sequence-to-sequence (Seq2Seq) model proposed by (Bahdanau et al., 2014); the second one additionally introduces the copy mechanism in the decoder side (Gu et al., 2016); the third one is a tree-to-sequence (Tree2Seq) model proposed by (Eriguchi et al., 2016) as our baseline. To apply these baselines, we convert an SQL query to a sequence or a tree using some templates which we discuss in detail in the Appendix.
141
+
142
+ Results. From Table 2, we can see that our Graph2Seq model performs significantly better than the Seq2Seq and Tree2Seq baselines. This result is expected since the structure of SQL query is essentially a graph despite its expressions in sequence and a graph encoder is able to capture much more information directly in graph. Tree2Seq achieves better performance compared to Seq2Seq since its tree-based encoder explicitly takes the syntactic structure of a SQL query into consideration. Two variants of the Graph2Seq models can substantially outperform Tree2Seq, which demonstrates that a general graph to sequence model that is independent of different structural information in complex data is very useful. Interestingly, we also observe that Graph2Seq-PGE (pooling-based graph embedding) performs better than Graph2Seq-NGE (node-based graph embedding). One potential reason is that the node-based graph embedding method artificially added a super node in graph which changes the original graph topology and brings unnecessary noise into the graph.
143
+
144
+ 4.4 IMPACTS OF AGGREGATOR, HOP SIZE AND ATTENTION MECHANISM ON GARPH2SEQ MODEL
145
+
146
+ Setup. We now investigate the impact of the aggregator and the hop size on the Graph2Seq model. Following the previous SP task, we further create three synthetic dataset $\mathbf { \eta } ^ { 3 } : \mathbf { i } )$ $\mathbf { S D P } _ { D A G }$ whose graphs are directed acyclic graphs (DAGs); ii) $\mathbf { S D P } _ { D C G }$ whose graphs are directed cyclic graphs (DCGs) that always contain cycles; iii) $\mathbf { S D P } _ { S E Q }$ whose graphs are essentially sequential lines. For each dataset, we randomly generated 10000 graphs with the graph size 100 and split them as 8000/1000/1000 for the training/development/test set. For each graph, we generated an SDP query by choosing two random nodes with the constraints that there should be a unique shortest path connecting these two nodes, and that its length should be at least 4.
147
+
148
+ We create six variants of the Graph2Seq model coupling with different aggregation strategies in the node embedding generation. The first three (Graph2Seq-MA, -LA, -PA) use the Mean Aggregator, LSTM Aggregator and Pooling Aggregator to aggregate node neighbor information, respectively. Unlike these three models that aggregate the information of both forward and backward nodes, the other two models (Graph2Seq-MA-F, -MA-B) only consider one-way information aggregating the information from the forward nodes or the information from the backward nodes with the mean aggregator, respectively. We use the path accuracy to evaluate these models. The hop size is set to 10.
149
+
150
+ Impacts of the Aggregator. Table 3 shows that on the $\mathrm { S D P } _ { S E Q }$ dataset, both Graph2Seq-MA and Graph2Seq-PA achieve the best performance. On more complicated structured data, such as $\mathrm { S D P } _ { D A G }$ and $\operatorname { S D P } _ { D C G }$ , Graph2Seq-MA (our default model) also performs better than other variants. We can also see that Graph2Seq-MA performs better than Graph2Seq-MA-F and Graph2SeqMA-B on $\mathrm { S D P } _ { D A G }$ and $\mathrm { S D P } _ { S E Q }$ since it captures more information from both directions to learn better node embeddings. However, Graph2Seq-MA-F and Graph2Seq-MA-B achieve comparable performance to Graph2Seq-MA on $\operatorname { S D P } _ { D C G }$ . This is because in almost $9 5 \%$ of the graphs, $90 \%$ of the nodes could reach each other by traversing the graph for a given hop size, which dramatically restores its information loss.
151
+
152
+ Table 3: Shortest path accuracy on three synthetic SDP datasets.
153
+
154
+ <table><tr><td>Method</td><td>SDPDAG</td><td>SDPDCG</td><td>SDPsEQ</td></tr><tr><td>G2S-MA</td><td>99.8%</td><td>99.2%</td><td>100%</td></tr><tr><td>G2S-LA</td><td>91.7%</td><td>90.9%</td><td>99.9%</td></tr><tr><td>G2S-PA</td><td>96.7%</td><td>98.4%</td><td>100%</td></tr><tr><td>G2S-MA-F</td><td>78.8%</td><td>98.7%</td><td>70.2%</td></tr><tr><td>G2S-MA-B</td><td>80.1%</td><td>99.1%</td><td>68.6%</td></tr></table>
155
+
156
+ ![](images/1817fe4bc4b840990b8107e2387bb08026cbe14dc5508663d86d7a3ee41be37e.jpg)
157
+ Figure 4: Test Results on $\mathrm { S D P _ { 1 0 0 0 } }$
158
+
159
+ Impact of Hop Size. To study the impact of the hop size, we create a $\operatorname { S D P } _ { D C G }$ dataset, $\mathrm { S D P _ { 1 0 0 0 } }$ and results are shown in Figure 4. We see that the performance of all variants of Graph2Seq converges to its optimal performance when increasing the number of hop size. Specifically, Graph2Seq-MA achieves significantly better performance than its counterparts considering only one direction propagation, especially when the hop size is small. As the hop size increases, the performance differences diminish. This is the desired property since Graph2Seq-MA can use much smaller hop size (about the half) to achieve the same performance of Graph2Seq-MA-F or Graph2Seq-MA-B with a larger size. This is particularly useful for large graphs where increasing hop size may need considerable computing resources and long run-time. We also compare Graph2Seq with GCN, where the hop size means the number of layers in the settings of GCN. Surprisingly, even Graph2Seq-MA-F or Graph2Seq-MA-B can significantly outperform GCN with the same hope size despite its rough equivalence between these two architectures. It again illustrates the importance of the methods that could take into account both directed and undirected graphs. For additional experimental results on the impact of hop size for graphs of different sizes, please refer to the Table 4 in Appendix C.
160
+
161
+ Impact of Attention Mechanism. To investigate the impact of attention mechanism to the Graph2Seq model, we still evaluate our model on $\mathrm { S D P } _ { D A G }$ , $\operatorname { S D P } _ { D C G }$ and $\mathrm { S D P } _ { S E Q }$ datasets but without considering the attention strategy. As shown in Table 4, we find that the attention strategy significantly improves the performance of all variants of Graph2Seq by at least $1 4 . 9 \%$ . This result is expected since for larger graphs it is more difficult for the encoder to compress all necessary information into a fixed-length vector; as intended, applying the attention mechanism in decoding enabled our proposed Graph2Seq model to successfully handle large graphs.
162
+
163
+ # 5 CONCLUSION
164
+
165
+ In this paper, we study the graph-to-sequence problem, introducing a new general and flexible Graph2Seq model that follows the encoder-decoder architecture. We showed that, using our proposed bi-directional node embedding aggregation strategy, the graph encoder could successfully learn representations for three representative classes of directed graph, i.e., directed acyclic graphs, directed cyclic graphs and sequence-styled graphs. Experimental results on three tasks demonstrate that our model significantly outperforms existing graph neural networks, Seq2Seq, and Tree2Seq baselines on both synthetic and real application datasets. We also showed that introducing an attention mechanism over node representation into the decoding substantially enhances the ability of our model to produce correct target sequences from large graphs. Since much symbolic data is represented as graphs and many tasks express their desired outputs as sequences, we expect Graph2Seq to be broadly applicable to unify symbolic AI and beyond.
166
+
167
+ # REFERENCES
168
+
169
+ Amr Ahmed, Nino Shervashidze, Shravan Narayanamurthy, Vanja Josifovski, and Alexander J Smola. Distributed large-scale natural graph factorization. In Proceedings of the 22nd international conference on World Wide Web, pp. 37–48. ACM, 2013.
170
+
171
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. arXiv preprint arXiv:1409.0473, 2014.
172
+
173
+ Laura Banarescu, Claire Bonial, Shu Cai, Madalina Georgescu, Kira Griffitt, Ulf Hermjakob, Kevin Knight, Philipp Koehn, Martha Palmer, and Nathan Schneider. Abstract meaning representation for sembanking. In Proceedings of the 7th Linguistic Annotation Workshop and Interoperability with Discourse, pp. 178–186, 2013.
174
+
175
+ Joost Bastings, Ivan Titov, Wilker Aziz, Diego Marcheggiani, and Khalil Sima’an. Graph convolutional encoders for syntax-aware neural machine translation. arXiv preprint arXiv:1704.04675, 2017.
176
+
177
+ Mikhail Belkin and Partha Niyogi. Laplacian eigenmaps and spectral techniques for embedding and clustering. In Advances in neural information processing systems, pp. 585–591, 2002.
178
+
179
+ Joan Bruna, Wojciech Zaremba, Arthur Szlam, and Yann LeCun. Spectral networks and locally connected networks on graphs. arXiv preprint arXiv:1312.6203, 2013.
180
+
181
+ Shaosheng Cao, Wei Lu, and Qiongkai Xu. Grarep: Learning graph representations with global structural information. In Proceedings of the 24th ACM International on Conference on Information and Knowledge Management, pp. 891–900. ACM, 2015.
182
+
183
+ Jie Chen, Tengfei Ma, and Cao Xiao. Fastgcn: Fast learning with graph convolutional networks via importance sampling. arXiv preprint arXiv:1801.10247, 2018.
184
+
185
+ 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.
186
+
187
+ Michael Defferrard, Xavier Bresson, and Pierre Vandergheynst. Convolutional neural networks¨ on graphs with fast localized spectral filtering. In Advances in Neural Information Processing Systems, pp. 3844–3852, 2016.
188
+
189
+ Alberto G Duran and Mathias Niepert. Learning graph representations with embedding propagation. arXiv preprint arXiv:1710.03059, 2017.
190
+
191
+ 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.
192
+
193
+ Akiko Eriguchi, Kazuma Hashimoto, and Yoshimasa Tsuruoka. Tree-to-sequence attentional neural machine translation. arXiv preprint arXiv:1603.06075, 2016.
194
+
195
+ Jonas Gehring, Michael Auli, David Grangier, Denis Yarats, and Yann N Dauphin. Convolutional sequence to sequence learning. arXiv preprint arXiv:1705.03122, 2017.
196
+
197
+ Xavier Glorot, Antoine Bordes, and Yoshua Bengio. Deep sparse rectifier neural networks. In Proceedings of the Fourteenth International Conference on Artificial Intelligence and Statistics, AISTATS 2011, Fort Lauderdale, USA, April 11-13, 2011, pp. 315–323, 2011.
198
+
199
+ Rafael Gomez-Bombarelli, Jennifer N Wei, David Duvenaud, Jos ´ e Miguel Hern ´ andez-Lobato, ´ Benjam´ın Sanchez-Lengeling, Dennis Sheberla, Jorge Aguilera-Iparraguirre, Timothy D Hirzel, ´ Ryan P Adams, and Alan Aspuru-Guzik. Automatic chemical design using a data-driven contin- ´ uous representation of molecules. ACS Central Science, 2016.
200
+
201
+ Marco Gori, Gabriele Monfardini, and Franco Scarselli. A new model for learning in graph domains. In Neural Networks, 2005. IJCNN’05. Proceedings. 2005 IEEE International Joint Conference on, volume 2, pp. 729–734. IEEE, 2005.
202
+
203
+ Palash Goyal and Emilio Ferrara. Graph embedding techniques, applications, and performance: A survey. arXiv preprint arXiv:1705.02801, 2017.
204
+
205
+ Alex Graves and Jurgen Schmidhuber. Framewise phoneme classification with bidirectional lstm ¨ and other neural network architectures. Neural Networks, 18(5-6):602–610, 2005.
206
+
207
+ Aditya Grover and Jure Leskovec. node2vec: Scalable feature learning for networks. In Proceedings of the 22nd ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 855–864. ACM, 2016.
208
+
209
+ Jiatao Gu, Zhengdong Lu, Hang Li, and Victor OK Li. Incorporating copying mechanism in sequence-to-sequence learning. arXiv preprint arXiv:1603.06393, 2016.
210
+
211
+ William L Hamilton, Rex Ying, and Jure Leskovec. Inductive representation learning on large graphs. arXiv preprint arXiv:1706.02216, 2017a.
212
+
213
+ William L Hamilton, Rex Ying, and Jure Leskovec. Representation learning on graphs: Methods and applications. arXiv preprint arXiv:1709.05584, 2017b.
214
+
215
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997.
216
+
217
+ Yanrong Hu and Simon X Yang. A knowledge based genetic algorithm for path planning of a mobile robot. In Robotics and Automation, 2004. Proceedings. ICRA’04. 2004 IEEE International Conference on, volume 5, pp. 4350–4355. IEEE, 2004.
218
+
219
+ Srinivasan Iyer, Ioannis Konstas, Alvin Cheung, and Luke Zettlemoyer. Summarizing source code using a neural attention model. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), volume 1, pp. 2073–2083, 2016.
220
+
221
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. CoRR, abs/1412.6980, 2014.
222
+
223
+ Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. arXiv preprint arXiv:1609.02907, 2016.
224
+
225
+ Yujia Li, Daniel Tarlow, Marc Brockschmidt, and Richard Zemel. Gated graph sequence neural networks. arXiv preprint arXiv:1511.05493, 2015.
226
+
227
+ Yujia Li, Oriol Vinyals, Chris Dyer, Razvan Pascanu, and Peter Battaglia. Learning deep generative models of graphs. arXiv preprint arXiv:1803.03324, 2018.
228
+
229
+ Bowen Liu, Bharath Ramsundar, Prasad Kawthekar, Jade Shi, Joseph Gomes, Quang Luu Nguyen, Stephen Ho, Jack Sloane, Paul Wender, and Vijay Pande. Retrosynthetic reaction prediction using neural sequence-to-sequence models. ACS central science, 3(10):1103–1113, 2017.
230
+
231
+ Minh-Thang Luong, Hieu Pham, and Christopher D Manning. Effective approaches to attentionbased neural machine translation. arXiv preprint arXiv:1508.04025, 2015.
232
+
233
+ Mathias Niepert, Mohamed Ahmed, and Konstantin Kutzkov. Learning convolutional neural networks for graphs. In International Conference on Machine Learning, pp. 2014–2023, 2016.
234
+
235
+ Mingdong Ou, Peng Cui, Jian Pei, Ziwei Zhang, and Wenwu Zhu. Asymmetric transitivity preserving graph embedding. In Proceedings of the 22nd ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 1105–1114. ACM, 2016.
236
+
237
+ 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.
238
+
239
+ Michael Pust, Ulf Hermjakob, Kevin Knight, Daniel Marcu, and Jonathan May. Parsing english into abstract meaning representation using syntax-based machine translation. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pp. 1143–1154, 2015.
240
+
241
+ Sam T Roweis and Lawrence K Saul. Nonlinear dimensionality reduction by locally linear embedding. science, 290(5500):2323–2326, 2000.
242
+
243
+ 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.
244
+
245
+ Michael Schlichtkrull, Thomas N Kipf, Peter Bloem, Rianne van den Berg, Ivan Titov, and Max Welling. Modeling relational data with graph convolutional networks. arXiv preprint arXiv:1703.06103, 2017.
246
+
247
+ Mike Schuster and Kuldip K Paliwal. Bidirectional recurrent neural networks. IEEE Transactions on Signal Processing, 45(11):2673–2681, 1997.
248
+
249
+ Martin Simonovsky and Nikos Komodakis. Graphvae: Towards generation of small graphs using variational autoencoders. arXiv preprint arXiv:1802.03480, 2018.
250
+
251
+ Richard Socher, Christopher D Manning, and Andrew Y Ng. Learning continuous phrase representations and syntactic parsing with recursive neural networks. In Proceedings of the NIPS-2010 Deep Learning and Unsupervised Feature Learning Workshop, volume 2010, pp. 1–9, 2010.
252
+
253
+ Linfeng Song, Xiaochang Peng, Yue Zhang, Zhiguo Wang, and Daniel Gildea. Amr-to-text generation with synchronous node replacement grammar. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics, ACL 2017, Vancouver, Canada, July 30 - August 4, Volume 2: Short Papers, pp. 7–13, 2017.
254
+
255
+ Myra Spiliopoulou and Michael Hatzopoulos. Translation of SQL queries into a graph structure: query transformations and pre-optimization issues in a pipeline multiprocessor environment. Inf. Syst., 17(2):161–170, 1992. doi: 10.1016/0306-4379(92)90010-K. URL https://doi.org/ 10.1016/0306-4379(92)90010-K.
256
+
257
+ 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.
258
+
259
+ Sainbayar Sukhbaatar, Arthur Szlam, Jason Weston, and Rob Fergus. End-to-end memory networks. In Advances in Neural Information Processing Systems 28: Annual Conference on Neural Information Processing Systems 2015, December 7-12, 2015, Montreal, Quebec, Canada, pp. 2440–2448, 2015.
260
+
261
+ Ilya Sutskever, Oriol Vinyals, and Quoc V. Le. Sequence to sequence learning with neural networks. In Advances in Neural Information Processing Systems 27: Annual Conference on Neural Information Processing Systems 2014, December 8-13 2014, Montreal, Quebec, Canada, pp. 3104–3112, 2014.
262
+
263
+ Kai Sheng Tai, Richard Socher, and Christopher D Manning. Improved semantic representations from tree-structured long short-term memory networks. arXiv preprint arXiv:1503.00075, 2015.
264
+
265
+ Jian Tang, Meng Qu, Mingzhe Wang, Ming Zhang, Jun Yan, and Qiaozhu Mei. Line: Largescale information network embedding. In Proceedings of the 24th International Conference on World Wide Web, pp. 1067–1077. International World Wide Web Conferences Steering Committee, 2015.
266
+
267
+ Petar Velickovic, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua Bengio. Graph attention networks. arXiv preprint arXiv:1710.10903, 1(2), 2017.
268
+
269
+ Oriol Vinyals, Samy Bengio, and Manjunath Kudlur. Order matters: Sequence to sequence for sets. arXiv preprint arXiv:1511.06391, 2015a.
270
+
271
+ Oriol Vinyals, Meire Fortunato, and Navdeep Jaitly. Pointer networks. In Advances in Neural Information Processing Systems, pp. 2692–2700, 2015b.
272
+
273
+ Oriol Vinyals, Alexander Toshev, Samy Bengio, and Dumitru Erhan. Show and tell: A neural image caption generator. In Computer Vision and Pattern Recognition (CVPR), 2015 IEEE Conference on, pp. 3156–3164. IEEE, 2015c.
274
+
275
+ Jason Weston, Antoine Bordes, Sumit Chopra, and Tomas Mikolov. Towards ai-complete question answering: A set of prerequisite toy tasks. CoRR, abs/1502.05698, 2015. URL http: //arxiv.org/abs/1502.05698.
276
+
277
+ Zhilin Yang, William W Cohen, and Ruslan Salakhutdinov. Revisiting semi-supervised learning with graph embeddings. arXiv preprint arXiv:1603.08861, 2016.
278
+
279
+ Tao Yu, Zifan Li, Zilin Zhang, Rui Zhang, and Dragomir Radev. Typesql: Knowledge-based typeaware neural text-to-sql generation. arXiv preprint arXiv:1804.09769, 2018.
280
+
281
+ Wojciech Zaremba and Ilya Sutskever. Learning to execute. arXiv preprint arXiv:1410.4615, 2014.
282
+
283
+ Yu Zhang, William Chan, and Navdeep Jaitly. Very deep convolutional networks for end-to-end speech recognition. In Acoustics, Speech and Signal Processing (ICASSP), 2017 IEEE International Conference on, pp. 4845–4849. IEEE, 2017.
284
+
285
+ Victor Zhong, Caiming Xiong, and Richard Socher. Seq2sql: Generating structured queries from natural language using reinforcement learning. CoRR, abs/1709.00103, 2017.
286
+
287
+ # A PSEUDO-CODE OF THE GRAPH-TO-SEQUENCE ALGORITHM
288
+
289
+ # Algorithm 1 Node embedding generation algorithm
290
+
291
+ Input: Graph $\mathcal G ( \nu , \mathcal { E } )$ ; node initial feature vector $\mathbf { a } _ { v }$ , $\forall v \in \mathcal { V }$ ; hops $K$ ; weight matrices $\mathbf { W } ^ { k }$ , $\forall k \in$ $\{ 1 , . . . , K \}$ ; non-linearity $\sigma$ ; aggregator functions AGGREGAT $\boldsymbol { \mathrm { E } } _ { k } ^ { \vdash }$ , AGGREGATE $\mathbf { \Pi } _ { k } ^ { - 1 }$ , $\forall k \in \{ 1 , . . . , K \}$ ; neighborhood functions $\mathcal { N } _ { \vdash }$ , $\mathcal { N } _ { + }$ Output: Vector representations $\mathbf { Z } _ { v }$ for all $v \in \mathcal V$ 1: $\mathbf { h } _ { v \vdash } ^ { 0 } \mathbf { a } _ { v }$ , $\forall v \in \mathcal { V }$ 2: $\mathbf { h } _ { v - 1 } ^ { 0 } \mathbf { a } _ { v }$ , $\forall v \in \mathcal { V }$ 3: for all $k = 1 . . . K$ do 4: for all $v \in \mathcal V$ do 5: $\mathbf { h } _ { \mathcal { N } _ { \mathrm { i } } ( v ) } ^ { k } \mathrm { A G G R E G A T E } _ { k } ^ { } ( \{ \mathbf { h } _ { u } ^ { k - 1 } , \forall u \in \mathcal { N } _ { \mathrm { i } } ( v ) \} )$ 6: hkv $\mathbf { \Sigma } _ { \vdash } \sigma ( \mathbf { W } ^ { k } \cdot \mathsf { C O N C A T } ( \mathbf { h } _ { v \vdash } ^ { k - 1 } , \mathbf { h } _ { \mathcal { N } _ { \vdash } ( v ) } ^ { k } ) )$ 7: $\begin{array} { r } { \mathbf { h } _ { \mathcal { N } _ { \mathrm { - } } ( v ) } ^ { k } \mathtt { A G G R E G A T E } _ { k } ^ { \mathtt { - } } ( \{ \mathbf { h } _ { u \mathrm { - } } ^ { k - 1 } , \forall u \in \mathcal { N } _ { \mathrm { + } } ( v ) \} ) } \end{array}$ 8: $\mathbf { h } _ { v - 1 } ^ { k } \sigma$ ( Wk· CONCAT(hk−1va , hkNa(v))) 9: end for 10: end for 11: $\mathbf { z } _ { v } \gets \mathrm { C O N C A T } ( \mathbf { h } _ { v \mid - } ^ { K } , \mathbf { h } _ { v } ^ { K } ) , \forall v \in \mathcal { V }$
292
+
293
+ Algorithm 1 describes the embedding generation process where the entire graph $\mathcal { G } = ( \nu , \mathcal { E } )$ and initial feature vectors for all nodes $\mathbf { a } _ { v }$ , $\forall v \in \mathcal { V }$ , are provided as input. Here $k$ denotes the current hop in the outer loop. The $\mathbf { h } _ { v \vdash } ^ { k }$ denotes node $v$ ’s forward representation which aggregates the information of nodes in $\mathcal { N } _ { \vdash } ( v )$ . Similarly, the $\mathbf { h } _ { v - 1 } ^ { k }$ denotes node $v$ ’s backward representation which is generated by aggregating the information of nodes in $\mathcal { N } _ { + } ( v )$ . Each step in the outer loop of Algorithm 1 proceeds as follows. First, each node $v \in \mathcal V$ in a graph aggregates the forward representations of the nodes in its immediate neighborhood, $\{ \mathbf { h } _ { u \vdash } ^ { k - 1 } , \forall u \in \mathcal { N } _ { \vdash } ( v ) \}$ , into a single vector, $\mathbf { h } _ { \mathcal { N } _ { \mathrm { i } } ( v ) } ^ { k }$ (line 5). Note that this aggregation step depends on the representations generated at the previous iteration of the outer loop, $k - 1$ , and the $k = 0$ forward representations are defined as the input node feature vector. After arepresentation, $\mathbf { h } _ { v \vdash } ^ { k - 1 }$ ting the neighboring feature vectors, we con, with the aggregated neighborhood vector, $\mathbf { h } _ { \mathcal { N } _ { \mathrm { i } } ( v ) } ^ { k }$ e the node current forward. Then this concatenated vector is fed through a fully connected layer with nonlinear activation function $\sigma$ , which updates the forward representation of the current node to be used at the next step of the algorithm (line 6). We apply similar process to generate the backward representations of the nodes (line 7, 8). Finally, the representation of each node $\mathbf { z } _ { v }$ is the concatenation of the forward representation (i.e., $\mathbf { h } _ { v \vdash } ^ { K }$ ) and the backward representation (i.e., $\mathbf { h } _ { v - 1 } ^ { K } )$ ) at the last iteration $K$ .
294
+
295
+ # B STRUCTURED REPRESENTATION OF THE SQL QUERY
296
+
297
+ To apply Graph2Seq, Seq2Seq and Tree2Seq models on the natural language generation task, we need to convert the SQL query to a graph, sequence and tree, respectively. In this section, we describe these representations of the SQL query.
298
+
299
+ # B.1 SEQUENCE REPRESENTATION
300
+
301
+ We apply a simple template to construct the SQL query sequence: “SELECT $^ +$ <aggregation function $> + <$ Split Symbol> $^ +$ <selected column $> +$ WHERE $^ +$ <condition0> + <Split Symbol> $+ < c o n d i t i o n _ { 1 } > + \ldots ^ { , }$ .
302
+
303
+ # B.2 TREE REPRESENTATION
304
+
305
+ We apply the SQL Parser tool4 to convert an SQL query to a tree which is illustrated in Figure 5. Specifically, the root of this tree has two child nodes, namely SELECT LIST and WHERE CLAUSE. The child nodes of SELECT LIST node are the selected columns in the SQL query. The WHERE CLAUSE node has all occurred logical operators in the SQL query as its children. The children of a logical operator node are the columns on which this operator works.
306
+
307
+ ![](images/eb8d2b13f2328e3820937294be1002f5a4119c02166be8b388932b414836e1da.jpg)
308
+
309
+ ![](images/0029468fc6ebd6581a56a75657d1bd9af1818c0efd325d0be6abc310b7c0e97f.jpg)
310
+ Figure 5: Tree representation of the SQL query. SQL query
311
+ Figure 6: Graph representation of the SQL query.
312
+
313
+ # B.3 GRAPH REPRESENTATION
314
+
315
+ We use the following method to transform the SQL query to a graph:
316
+
317
+ SELECT Clause. For the SELECT clause such as “SELECT company”, we first create a node assigned with text attribute select. This SELECT node connects with column nodes whose text attributes are the selected column names such as company. For the SQL queries that contain aggregation functions such as count or max, we add one aggregation node which is connected with the column node—their text attributes are the aggregation function names.
318
+
319
+ WHERE Clause. The WHERE clause usually contains more than one condition. For each condition, we use the same process as for the SELECT clause to create nodes. For example, in Figure 6, we create node assets and ${ > } v a l _ { 0 }$ for the first condition, the node sales and ${ > } v a l _ { 0 }$ for the second condition. We then integrate the constraint nodes that have the same text attribute (e.g., ${ > } v a l _ { 0 }$ in Figure 6). For a logical operator such as AND, OR and NOT, we create a node that connects with all column nodes that the operator works on (e.g., AND in Figure 6). These logical operator nodes then connect with SELECT node.
320
+
321
+ # C MORE RESULTS ON THE IMPACT OF HOP SIZE
322
+
323
+ In Algorithm 1, we can see that there are three key factors in the node embedding generation. The first factor is the aggregator choice which determines how information from neighborhood nodes is combined. The other two are the hop size $( K )$ and the neighborhood function $( \mathcal { N } _ { \vdash } ( v ) , \mathcal { N } _ { \dashv } ( v ) )$ , which together determine which neighbor nodes should be aggregated to generate each node embedding. To study the impact of the hop size in our model, we create two $\operatorname { S D P } _ { D C G }$ datasets, $\mathrm { S D P _ { 1 0 0 } }$ and $\mathrm { S D P _ { 1 0 0 0 } }$ , where each graph has 100 nodes or 1000 nodes, respectively. Both of these two datasets contain 8000 training examples, 1000 dev examples and 1000 test examples. We evaluated three models, Graph2Seq-MA-F, Graph2Seq-MA-B and Graph2Seq-MA, on these two datasets; results are listed in Table 4.
324
+
325
+ Table 4: Test Results on $\mathrm { { S D P } _ { 1 0 0 } }$ and $\mathrm { S D P _ { 1 0 0 0 } }$
326
+
327
+ <table><tr><td colspan="5">SDP100</td></tr><tr><td>Hop Size</td><td>Graph2Seq-MA-F</td><td>Graph2Seq-MA-B</td><td>Graph2Seq-MA</td><td>GCN(Kipf &amp;Welling,2016)+ our decoder</td></tr><tr><td>1</td><td>50.1%</td><td>52.0%</td><td>76.3%</td><td>70.2%</td></tr><tr><td>3</td><td>73.2%</td><td>76.7%</td><td>95.4%</td><td>90.1%</td></tr><tr><td>4</td><td>84.7%</td><td>85.2%</td><td>99.2%</td><td>94.7%</td></tr><tr><td>5</td><td>93.2%</td><td>94.5%</td><td>99.4%</td><td>94.9%</td></tr><tr><td>7</td><td>98.9%</td><td>99.1%</td><td>99.4%</td><td>94.3%</td></tr><tr><td>10</td><td>98.9%</td><td>99.1%</td><td>99.4%</td><td>94.3%</td></tr><tr><td rowspan="3">10</td><td>w/o attention</td><td>w/o attention</td><td>w/oattention</td><td>w/o attention</td></tr><tr><td>85.8%</td><td>86.3%</td><td>89.6%</td><td>83.1%</td></tr><tr><td></td><td></td><td>SDP1000</td><td></td></tr><tr><td>Hop Size</td><td>Graph2Seq-MA-F</td><td>Graph2Seq-MA-B</td><td>Graph2Seq-MA</td><td>GCN(Kipf&amp;Welling,2016)+our decoder</td></tr><tr><td>10</td><td>34.7%</td><td>33.2%</td><td>50.4%</td><td>45.7%</td></tr><tr><td>35</td><td>68.2%</td><td>70.6%</td><td>82.5%</td><td>66.3%</td></tr><tr><td>45</td><td>79.0%</td><td>82.1%</td><td>96.5%</td><td>89.0%</td></tr><tr><td>75</td><td>88.3%</td><td>89.9%</td><td>96.4%</td><td>89.2%</td></tr><tr><td>85</td><td>95.9%</td><td>96.0%</td><td>96.5%</td><td>88.8%</td></tr><tr><td>100</td><td>95.8%</td><td>96.0%</td><td>96.5%</td><td>88.6%</td></tr><tr><td>100</td><td>w/o attention 78.3%</td><td>w/o attention 78.2%</td><td>w/o attention 81.6%</td><td>w/o attention 72.4%</td></tr></table>
328
+
329
+ We see that Graph2Seq-MA-F and Graph2Seq-MA-B could show significant performance improvements with increasing the hop size. Specifically, on the $\mathrm { S D P _ { 1 0 0 } }$ dataset, Graph2Seq-MA-F and Graph2Seq-MA-B achieve their best performance when the hop size reaches 7; further increases do not improve the overall performance. A similar situation is also observed on the $\mathrm { S D P _ { 1 0 0 0 } }$ dataset; performance converges at the hop size of 85. Interestingly, the average diameters of the graphs in the two datasets are 6.8 and 80.2, respectively, suggesting that the ideal hop size for best Graph2SeqMA-F performance should be the graph diameter. This should not be surprising; if the hop size equals the graph diameter, each node is guaranteed to aggregate the information of all reachable nodes on the graph within its embedding. Note that in the experiments on $\mathrm { S D P _ { 1 0 0 0 } }$ , in the $X$ $( X \ ; 1 0 )$ hop, we always use the aggregator in the $I O$ -th hop, because introducing too many aggregators (i.e., parameters) may make the model over-fitting.
330
+
331
+ Like Graph2Seq-MA-F, Graph2Seq-MA also benefited from increasing the hop size. However, on both datasets, Graph2Seq-MA could reach peak performance at a smaller hop size than Graph2SeqMA-F. For example, on the $\mathrm { S D P _ { 1 0 0 } }$ dataset, Graph2Seq-MA achieves $9 9 . 2 \%$ accuracy once the hop size is greater than 4 while Graph2Seq-MA-F requires a hop size greater than 7 to achieve comparable accuracy; similar observations hold for the $\mathrm { S D P _ { 1 0 0 0 } }$ dataset. Moreover, we can see that the minimum required hop size that Graph2Seq-MA could achieve its best performance is approximately the average radii (c.f. diameter) of the graphs, which are 3.4 and 40.1, respectively. Recall that the main difference between Graph2Seq-MA and Graph2Seq-MA-F (or Graph2Seq-MA-B) lies in whether the system aggregates information propagated from backward nodes; the performance difference indicates that by incorporating forward and backward nodes’ information, it is possible for the model to achieve the best performance by traversing less of the graph. This is useful in practice, especially for large graphs where increasing hop size may consume considerable computing resources and run-time.
332
+
333
+ Table 4 also makes clear the utility of the attention strategy; the performance of both Graph2SeqMA-F and Graph2Seq-MA decreases by at least $9 . 8 \%$ on $\mathrm { S D P _ { 1 0 0 } }$ and $1 4 . 9 \%$ on $\mathrm { S D P _ { 1 0 0 0 } }$ . This result is expected, since for larger graphs it is more difficult for the encoder to compress all necessary information into a fixed-length vector; as intended, applying the attention mechanism in decoding enabled our proposed Graph2Seq model to handle large graphs successfully.
334
+
335
+ As shown in Algorithm 1, the neighborhood function takes a given node as input and returns its directly connected neighbor nodes, which are then fed to the node embedding generator. Intuitively, to obtain a better representation of a node, this function should return all its neighbor nodes in the graph. However, this may result in high training times on large graphs. To address this, (Hamilton et al., 2017a) proposes a sampling method which randomly selects a fixed number of neighbor nodes from which to aggregate information at each hop. We use this sampling method to manage the neighbor node size at each aggregation step.
md/train/Wj4ODo0uyCF/Wj4ODo0uyCF.md ADDED
@@ -0,0 +1,325 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SHARE OR NOT?LEARNING TO SCHEDULE LANGUAGE-SPECIFIC CA-PACITY FOR MULTILINGUAL TRANSLATION
2
+
3
+ Biao Zhang1∗, Ankur Bapna2, Rico Sennrich $^ { 3 , 1 }$ , Orhan Firat2
4
+
5
+ 1 School of Informatics, University of Edinburgh
6
+ 2 Google Research
7
+ 3 Department of Computational Linguistics, University of Zurich
8
+ b.zhang@ed.ac.uk,ankurbpn@google.com,sennrich@cl.uzh.ch,orhanf@google.com
9
+
10
+ # ABSTRACT
11
+
12
+ Using a mix of shared and language-specific (LS) parameters has shown promise in multilingual neural machine translation (MNMT), but the question of when and where LS capacity matters most is still under-studied. We offer such a study by proposing conditional language-specific routing (CLSR). CLSR employs hard binary gates conditioned on token representations to dynamically select LS or shared paths. By manipulating these gates, it can schedule LS capacity across sub-layers in MNMT subject to the guidance of translation signals and budget constraints. Moreover, CLSR can easily scale up to massively multilingual settings. Experiments with Transformer on OPUS-100 and WMT datasets show that: 1) MNMT is sensitive to both the amount and the position of LS modeling: distributing $10 \% { - } 3 0 \%$ LS computation to the top and/or bottom encoder/decoder layers delivers the best performance; and 2) one-to-many translation benefits more from CLSR compared to many-to-one translation, particularly with unbalanced training data. Our study further verifies the trade-off between the shared capacity and LS capacity for multilingual translation. We corroborate our analysis by confirming the soundness of our findings as foundation of our improved multilingual Transformers. Source code and models are available at https://github.com/bzhangGo/zero/tree/iclr2021_clsr.
13
+
14
+ # 1 INTRODUCTION
15
+
16
+ Model architecture design injects inductive biases to neural network layouts, allowing a learning algorithm to favor certain representations over others, independent of the observed data (Mitchell, 1980). In multilingual neural machine translation (MNMT), where the learning objective is commonly cast as a multi-task learning problem (Firat et al., 2016a; Ha et al., 2016; Johnson et al., 2017), the inductive bias researchers usually study is deciding on which components of the neural network to share between tasks (languages), and which components to leave specific to the task or language. These components can be entire layer stacks, individual layers or even some sub-layers (Sachan & Neubig, 2018; Blackwood et al., 2018; Wang et al., 2019; Zhu et al., 2020). Noticeably, the search space of which parameters to share and at which granularity grows rapidly, as we make neural networks large or increase the number of tasks (languages). This rapid expansion of the search space prevents us from exhaustively exploring the choice of sharing patterns in MNMT.
17
+
18
+ The incapability of full-space exploration motivates methods relying on heuristics (Sachan & Neubig, 2018), that lack flexibility when more languages are covered, or meta-learning (Platanios et al., 2018), that are often hard to scale. These limitations hinder their generalization to large-scale multilingual models, which is the very focus of our study. In large scale multilingual models, also known as massively multilingual models (Aharoni et al., 2019; Arivazhagan et al., 2019; Zhang et al., 2020b), hundreds of languages with varying amounts of training data, difficulty and linguistic properties are jointly trained together in a multi-task setup. While the joint training enables positive transfer across languages, it also introduces task-interference between dissimilar languages (Arivazhagan et al., 2019; Wang et al., 2020a;b) and a capacity bottleneck emerges due to the increased number of languages and data (Huang et al., 2019; Zhang et al., 2020b).
19
+
20
+ ![](images/48ef0216307472aad4ef89de009a63daf40bfa38ac633ea254cc9598b31449cc.jpg)
21
+ Figure 1: The model architecture used for our experiments. We introduce a CLSR layer after every transformer sub-layer in the encoder and the decoder. The gating layer learns to route every input through either the LS projection layer, or a shared projection layer. We analyze the outputs of the gating layers to develop a MNMT architecture with LS projections.
22
+
23
+ In this paper we adopt an end-to-end data driven approach (conditional language-specific routing, or CLSR) which permits directly probing a large section of the search space. We let the network learn the sharing structure from the data itself, by learning to route between language-specific (LS) or shared pathways. These two routes determine the mode of operation for the network: when the LS branch is selected, the model is given access to a set of LS layers (implemented as simple projections per language) and when the shared branch is chosen, the computation is routed to a layer that is used by all languages. By guiding the (gating) decision process with token level activation information, the network flexibly learns to alternate between the two modes and naturally lends itself to a conditional computation approach for multilingual processing (Bengio et al., 2013; Davis & Arel, 2013; Bapna et al., 2020). The gate states are optimized towards maximizing translation quality, but regularized with a budget constraint to control the amount of LS capacity1. Reducing the available budget results in fewer gates routing through the LS paths, enforcing CLSR to identify the most crucial sub-layers which allows us to observe and study the importance of each sub-layer for multilingual processing. Our approach is visually depicted in Figure 1.
24
+
25
+ We verify our proposal on WMT and the massively multilingual OPUS-100 dataset, with models building on the Transformer architecture (Vaswani et al., 2017). We explore target-specific and source-specific modeling for one-to-many2 and many-to-one translation, respectively. To measure the degree of each sub-layer’s tendency to be language-specific, we propose LSScore metric. Our results show that CLSR successfully navigates the trade-offs in LS modeling, outperforming several strong baselines. Our main findings are summarized below:
26
+
27
+ • Both the amount and the position of LS layers matter for MNMT. The best performance is achieved by distributing $10 \% { - } 3 0 \%$ LS computation to the top and/or bottom encoder/decoder layers. Feed-forward sub-layers utilize more LS capacity compared to other sub-layers on one-tomany translation. One-to-many translation benefits more from CLSR (with target LS parameters) compared to many-to-one translation (with source LS parameters), particularly when the training data is imbalanced.
28
+ • The induced sharing pattern learned by CLSR is highly similar across languages.
29
+
30
+ • We can use the learned patterns to hard-code better parameter sharing strategies for multilingual Transformers.
31
+
32
+ # 2 RELATED WORK
33
+
34
+ Our work closely relates to language-specific (LS) modeling for multilingual NMT and conditional computation for sequential data which we will recap both here. Early research on MNMT focused on improving shared capacity for separate bilingual models to enhance cross-lingual transfer. These efforts included sharing encoders for one-to-many translation (Dong et al., 2015), sharing decoders for many-to-one translation (Zoph & Knight, 2016; Lee et al., 2017) and sharing sub-layers (attention) for many-to-many translation (Firat et al., 2016a;b). These studies corroborated the feasibility of accommodating multiple languages with shared NMT sub-components, motivating researchers to explore universal MNMT. Ha et al. (2016) and Johnson et al. (2017) proposed such an implementation that performs multilingual translation with a single monolithic NMT model where the entire network is shared across languages, thanks to a target language token informing the model which language to translate into. Although this paradigm shows great scalability (Aharoni et al., 2019), the language token alone affords little flexibility in handling language diversity with a rigid share-all layout. Follow-up studies thus resort to LS modeling in an attempt to seek a better trade-off between sharing and not sharing. Methods in this category involve specializing neural attentions (Blackwood et al., 2018; Sachan & Neubig, 2018; Wang et al., 2019), broadening encoder outputs and normalizations (Zhang et al., 2020b), decoupling multilingual encoders and/or decoders (Vázquez et al., 2019; Escolano et al., 2020), using a fixed mix of LS and shared parameters (Wang et al., 2018), inserting lightweight adapters (Bapna & Firat, 2019) and separately modeling languages for different clusters (Tan et al., 2019), to name a few. Nevertheless, these methods heavily depend on heuristics, providing little evidence about how to optimally distribute LS capacity across the model.
35
+
36
+ By contrast, our proposed CLSR forces the model to learn LS behaviour. It can be treated as a simplified differentiable neural architecture search (NAS) model (Liu et al., 2019) with a search space defined by the presence/absence of LS projections after every transformer sub-layer. However, in contrast with NAS, we utilize conditional computation (Bengio et al., 2013) to make the choice of executing the shared or LS path conditional on the input representations. This allows us to compare and contrast the choice of LS vs shared paths on different inputs and languages. Conditional computation has previously been successfully applied to adapt the amount of computation to the input in recurrent models (Graves, 2016) and transformers (Dehghani et al., 2019; Elbayad et al., 2020), or to significantly scale up model capacity by utilizing sparsely-gated Mixture-of-Experts layers (Shazeer et al., 2017; Lepikhin et al., 2020). Zhang et al. (2020a) applied conditional computation to sparsify encoder outputs in sequence-to-sequence models in order to reduce attention costs, while Bapna et al. (2020) introduced conditional execution of Transformer sub-layers to control the amount of computation expended by the model at inference. Sukhbaatar et al. (2019) learn parameters that limit the attention spans, in order to make the attention operation more efficient, while Fan et al. (2020) utilize structured dropout to prune transformer layers at inference. Ruder et al. (2019) propose the sluice network that learns the inter-task (shared) sub-spaces on top of task-specific models. By contrast, CLSR starts with a totally shared model, and learns how to inject task-specific projections into it, which scales more easily to massively multilingual settings. Different from previous studies, we explore conditional computation as an analysis tool to understand the ideal arrangement of LS capacity for MNMT. Utilizing conditional computation to search for better LS sharing patterns in multilingual translation, to the best of our knowledge, has never been investigated before.
37
+
38
+ # 3 BACKGROUND: MNMT
39
+
40
+ Given a source sentence $X ^ { \prime } = \{ x _ { 1 } , x _ { 2 } , \ldots , x _ { I } \}$ and its target translation $Y = \{ y _ { 1 } , y _ { 2 } , \dots , y _ { J } \}$ , we follow Johnson et al. (2017) to reuse standard bilingual NMT models for multilingual translation by altering the source input with a language token lang, i.e. changing $X ^ { \prime }$ to $\begin{array} { r l } { X } & { { } = } \end{array}$ $\{ l a n g , x _ { 1 } , x _ { 2 } , \ldots , x _ { I } \}$ . Note that lang denotes the target language in one-to-many translation but source language in many-to-one translation.
41
+
42
+ We model translation from $X$ to $Y$ with Transformer (Vaswani et al., 2017). Transformer relies on the following residual-normalization structure (He et al., 2015; Ba et al., 2016) to smooth information flow and avoid gradient vanishing and explosion:
43
+
44
+ $$
45
+ \begin{array} { r } { { \bf z } ^ { l + 1 } = \mathrm { L N } \left( { \bf z } ^ { l } + f \left( { \bf z } ^ { l } \right) \right) , } \end{array}
46
+ $$
47
+
48
+ where $l$ denotes layer depth and $\mathrm { L N } ( \cdot )$ is layer normalization (Ba et al., 2016). Function $f ( \cdot )$ represents the basic building block in Transformer, such as attention network or feed-forward network. The encoder in Transformer is a stack of $L$ identical layers, with each layer involving a self-attention sub-layer (SAN) and a feed-forward sub-layer (FFN). The decoder uses a similar structure except for an extra cross-attention sub-layer (CAN) inserted in-between the above two sub-layers.
49
+
50
+ # 4 CONDITIONAL LANGUAGE-SPECIFIC ROUTING (CLSR)
51
+
52
+ The success of MNMT comes at the cost of expressivity and model’s ability to capture languagespecific characteristics. It has been empirically shown that the language signals from language indicator tokens alone are not sufficient (Arivazhagan et al., 2019), making architectures dedicated to LS modeling a necessity (Blackwood et al., 2018; Sachan & Neubig, 2018; Zhang et al., 2020b). Nevertheless, the question when and where LS modeling matters most in MNMT still remains to be answered. To this end, we propose conditional language-specific routing (CLSR) which specializes $f ( \cdot )$ and changes the formulation in Equation 1 as follows:
53
+
54
+ $$
55
+ \begin{array} { r } { \mathbf { z } ^ { l + 1 } = \mathrm { L N } \left( \mathbf { z } ^ { l } + \mathrm { C L S R } \left( f \left( \mathbf { z } ^ { l } \right) \right) \right) . } \end{array}
56
+ $$
57
+
58
+ CLSR learns a hard binary (scalar-valued) gate $g ( \cdot )$ for each input token based on its hidden representation $\mathbf { z } ^ { l } \in \mathbb { R } ^ { d }$ . These gates endow each sub-layer in Transformer with the capability of routing information selectively through either LS path $\mathbf { h } ^ { l a \bar { n } g }$ or shared path $\mathbf { h } ^ { s h a r e d }$ :
59
+
60
+ $$
61
+ \begin{array} { r l r } & { } & { \mathrm { C L S R } \left( f \left( \mathbf { z } ^ { l } \right) \right) = g ( \mathbf { z } ^ { l } ) \mathbf { h } ^ { l a n g } + ( 1 - g ( \mathbf { z } ^ { l } ) ) \mathbf { h } ^ { s h a r e d } , } \\ & { } & { \mathrm { w i t h } \quad \mathbf { h } ^ { l a n g } = f \left( \mathbf { z } ^ { l } \right) \mathbf { W } ^ { l a n g } , \quad \mathbf { h } ^ { s h a r e d } = f \left( \mathbf { z } ^ { l } \right) \mathbf { W } ^ { s h a r e d } , } \end{array}
62
+ $$
63
+
64
+ where ${ \bf W } ^ { s h a r e d }$ is a weight matrix shared across languages, while parameter ${ \bf W } ^ { l a n g }$ is only used for modeling language lang which endows NMT with source or target LS modeling capacity.3 Intuitively, a closed gate, corresponding to shared capacity, encourages maximal cross-lingual information transfer; an open gate, corresponding to LS capacity instead, improves language awareness for translation albeit it blocks knowledge transfer. CLSR balances between the two modes as controlled by the gates.
65
+
66
+ Following Bapna et al. (2020), we parameterize the gate $g ( \cdot )$ with a two-layer feed-forward network $G ( \cdot )$ , and inject zero-mean Gaussian noise during training to discretize it (Chiu & Raffel, 2018) :
67
+
68
+ $$
69
+ g ( \mathbf { z } ^ { l } ) = \sigma \left( G ( \mathbf { z } ^ { l } ) + \alpha ( t ) \mathcal { N } ( 0 , 1 ) \right) , \quad G ( \mathbf { z } ^ { l } ) = \mathrm { R e l u } \left( \mathbf { z } ^ { l } \mathbf { W } _ { 1 } + \mathbf { b } \right) \mathbf { w } _ { 2 } ,
70
+ $$
71
+
72
+ where $\sigma ( \cdot )$ is the logistic-sigmoid function, $d _ { g }$ is the gating feed-forward hidden dimension, and $\mathbf { W } _ { 1 } \in \mathbb { R } ^ { d \times d _ { g } }$ , $\mathbf { w } _ { 2 } \in \mathbb { R } ^ { d _ { g } }$ are trainable parameters. $\alpha$ is linearly increased along with training steps $t$ . In this way, the gating parameters can be optimized with accurate gradients when $\alpha$ is small at the beginning so as to measure the degree to which each position in each sub-layer benefits from LS modeling. As training progresses, $\alpha$ grows larger, forcing the gating network to emit hard outputs. At inference time, we discretize the gate based on a simple decision rule: $g ( \mathbf { z } ^ { l } ) = \delta \left( G ( \mathbf { z } ^ { l } ) \dot { \geq } 0 \right)$ , where $\delta ( \cdot )$ is a Dirac measure.
73
+
74
+ We train the gates based on the standard maximum likelihood objective, along with an additional budget regularization term that enables control over the amount of LS capacity used for translation. Let the set of all CLSR layers in the encoder be $\mathcal { M } _ { e n c }$ and the decoder be $\mathcal { M } _ { d e c }$ . Then the amount of LS computation utilized by a sentence pair $( X , Y )$ is given by $\begin{array} { r } { G _ { ( X , Y ) } = \sum _ { x \in X } \sum _ { m \in \mathcal { M } _ { e n c } } g _ { m } ( x ) + } \end{array}$ $\begin{array} { r } { \sum _ { y \in Y } \sum _ { m \in \mathcal { M } _ { d e c } } g _ { m } ( y ) } \end{array}$ . Given a budget constraint $p \in [ 0 , 1 ]$ and a batch of sentence pairs, $\boldsymbol { B }$ , the training loss function of CLSR is formulated below:
75
+
76
+ $$
77
+ \mathcal { L } \left( \mathcal { B } \right) = \sum _ { \left( X , Y \right) \in \mathcal { B } } \mathrm { M L E } \left( X , Y \right) + \left| \frac { \sum _ { \left( X , Y \right) \in \mathcal { B } } G _ { \left( X , Y \right) } } { \sum _ { \left( X , Y \right) \in \mathcal { B } } \left( \left| X \right| \left| \mathcal { M } _ { e n c } \right| + \left| Y \right| \left| \mathcal { M } _ { d e c } \right| \right) } - p \right| ,
78
+ $$
79
+
80
+ Intuitively, the budget constraint tries to regulate the amount of LS computation available to all tokens in the batch as a fraction $p$ of the total LS computation in the model. Given that we make a binary decision for every input for every CLSR layer, this corresponds to a search space of $\mathcal { O } ( 2 ^ { | \boldsymbol { X } | | \mathcal { M } _ { e n c } | + | \boldsymbol { Y } | | \mathcal { M } _ { d e c } | } )$ . This gating space not only grows with respect to the model depth and sub-layer types, but also is highly input dependent. This dependency makes it difficult to search the entire space using heuristic methods (Blackwood et al., 2018).
81
+
82
+ The constraint in Equation 6 is imposed upon the aggregated gates. As a consequence, the model can learn to trade-off LS capacity for certain layers and inputs for others. Decreasing the budget encourages gate closure, such that the LS path is chosen only in the critical sub-layers. Thus, a properly learned gating function reveals the activations of LS paths and helps gain insights into the model behavior.
83
+
84
+ # 5 EXPERIMENTS
85
+
86
+ Data and Evaluation We report results on two benchmarks: OPUS-100 (Zhang et al., 2020b) and WMT-14 (Barrault et al., 2019). OPUS-100 is a massively multilingual dataset collected from OPUS (Tiedemann, 2012), including 100 languages in total with 99 languages to-and-from English.4 It consists of 55M training sentence pairs with up to 1M samples per language pair, and covers 94 dev/test language pairs, each with 2000 samples at most. WMT-14 is another multilingual Englishcentric dataset composed of 13 widely-used WMT benchmarks following Siddhant et al. (2020) but excluding Kazakh and Gujarati due to their poor parallel resource. Compared to OPUS-100, WMT14 involves much fewer languages but its training data distribution is highly skewed across diverse language pairs, ranging from 0.2M (En-Tr) to 60M (En-Cs) training examples, thus posing severe challenges. We show more details about the train, dev and test data for WMT-14 in Appendix A.
87
+
88
+ We apply byte pair encoding (BPE) algorithm (Sennrich et al., 2016) using SentencePiece (Kudo & Richardson, 2018) to preprocess multilingual sentences with a vocabulary size of 64K. We use BLEU (Papineni et al., 2002), offered by SacreBLEU (Post, 2018)5, for translation evaluation. Following Zhang et al. (2020b), we split the 94 test language pairs in OPUS-100 into three groups based on their training data size to ease model evaluation: high resource $( { > } 0 . 9 \mathrm { M }$ , 45 languages), low resource $\mathrm { \check { \ z o } } . 1 \mathrm { { M } }$ , 26 languages) and medium resource (others, 28 languages). Similarly, we split the 13 test language pairs in WMT-14 as follows: High $\mathrm { ^ { \circ } } > 1 0 \mathrm { M } ,$ 5), Low $( < 1 \mathbf { M } , 5 )$ and Med (others, 3).
89
+
90
+ We perform experiments for one-to-many translation (O2M) and many-to-one translation (M2O). In addition to using the original training data as is, we also report results with a temperature-based strategy to balance the training data distribution by over-sampling low-resource languages with a temperature of $T = 5$ (Arivazhagan et al., 2019).
91
+
92
+ We report average BLEU, and also show win ratio (Zhang et al., 2020b, WR), informing the proportion of language pairs on which our method beats our baseline. To evaluate how often each sub-layer is LS, we introduce a new metric, LSScore, formulated as follows:
93
+
94
+ $$
95
+ \mathrm { L S S c o r e } _ { f } ( l , p ) = \frac { 1 } { | \mathcal { P } | } \sum _ { p \in \mathcal { P } } \tilde { g } _ { l , f } ^ { p } - p ,
96
+ $$
97
+
98
+ where $\tilde { g } _ { l , f } ^ { p }$ denotes the gating value averaged over all test tokens for the $l$ -th sub-layer $f ( \cdot )$ trained under a budget of $p$ . Recall that we pose the budget constraint to the summed gate value instead of each individual gate, as in Equation 6. This gives CLSR the freedom to close more gates in some language-insensitive sub-layers (i.e. $\tilde { g } _ { l , f } ^ { p } < p )$ ) while preserve more for the others (i.e. $\tilde { g } _ { l , f } ^ { p } > p \}$ ). A larger LSScore, $> 0$ in particular, indicates that this sub-layer utilizes more LS modeling.
99
+
100
+ Model Settings We adapt Transformer base for our experiments: $L = 6$ , $d = 5 1 2$ , 8 attention heads with FFN middle size of 2048. Dropout of rate 0.1 is applied to residual connections and attention weights. We optimize parameters using Adam (Kingma & Ba, 2015) $( \beta _ { 1 } = 0 . 9 , \beta _ { 2 } = 0 . 9 8 )$ with label smoothing of 0.1. Learning rate is scheduled according to the inverse square root of running steps with a warmup step of 4K (Vaswani et al., 2017). We limit training sequence length to 100, and train all models with a batch size of 1920. We set the maximum running step to 500K and 600K for OPUS-100 and WMT-14, respectively. We perform beam search decoding with beam size of 4 and length penalty of 0.6. We average the last 5 checkpoints for evaluation. For CLSR, we set $d _ { g }$ to 128, and linearly increase $\alpha$ from 0 to 5 along training steps (Bapna et al., 2020).6 We vary the budget $p$ in the range of $\mathcal { P } = \{ 0 . 0 , 0 . 1 , 0 . 3 , 0 . 5 , 0 . 7 , 0 . 9 , 1 . 0 \}$ to study its impact on model performance.
101
+
102
+ # 5.1 RESULTS ON OPUS-100
103
+
104
+ ![](images/d2a4a0cfc5c5e4d57097054b4a1cf00373ea5cd2e06a37c43c6992dfe4d9f2ad.jpg)
105
+ Figure 2: Average BLEU 2(a),2(b) and win ratio 2(c),2(d) over all test language pairs for O2M and M2O on OPUS-100 when varying the budget $p$ . Baseline: multilingual baseline on the original training data; Oversample: oversampling low-resource data with a temperature of 5.
106
+
107
+ On the trade-off between shared and language-specific capacity. Using more LS modeling fails to deliver increasingly better translation performance, as shown in Figure 2(a) and 2(b) when $p$ approaches 1.0. At the point of full LS capacity for Transformer, i.e. $p = 1 . 0$ , CLSR even underperforms its corresponding multilingual baseline by a large margin of 1.0-2.0 BLEU on M2O, Figure 2(b). Similarly, sharing all model parameters across language pairs, $p 0 . 0$ , also yields suboptimal performance with either original or oversampled training data. CLSR achieves its best translation quality at $p = 0 . 3$ $( + 2 . 0 / 3 . 0 $ BLEU) and $p = 0 . 1$ $\left( + 0 . 5 / 1 . 5 \right)$ BLEU) for O2M and M2O, respectively. The win ratio curves in Figure 2(c) and 2(d) further confirm the robustness of these quality improvements, where properly scheduling LS capacity outperforms the baselines on $> \sim \bar { 8 0 \% }$ language pairs. These results clearly show the trade-off between these two kinds of capacity.
108
+
109
+ When does language-specific capacity matter for multilingual translation? Results in Figure 2 show that O2M favors more LS modeling and benefits more from it compared to M2O $p = 0 . 3$ vs. $p = 0 . 1$ , and $+ 3 . 0$ vs. $+ 1 . 5$ BLEU on the original training data). We conjecture that translations on M2O share the same target language (English), so information can be easily transferred through shared modeling; by contrast, MNMT has to handle languages of diverse typological features for O2M, demanding stronger capacity delivered to each translation direction. Results in Figure 2 also show that CLSR yields more aggressive improvements on the original training data, compared to the oversampled counterpart $( + 3 . 0$ vs. $+ 2 . 0$ BLEU on O2M and $+ 1 . 5$ vs. $+ 0 . 5$ BLEU on M2O). Finegrained analysis on each resource group, as shown in Figure 7 (Appendix B), reveals that CLSR yields more improvements for low-resource translation where the oversampling strategy partially offsets these improvements.
110
+
111
+ Where should we add language-specific capacity in multilingual Transformer? Figure 2 suggests that CLSR uses $10 { - } 3 0 \%$ LS capacity to reach its best performance. We next study how CLSR schedules this capacity across all Transformer sub-layers, in order to determine the ideal arrangement of LS layers for translation. Figure 3 shows the results. Regardless of layer types, CLSR schedules more LS capacity to the top and/or bottom encoder/decoder layers rather than the middle ones. We find that more LS capacity is allocated to feed-forward sub-layers for O2M (both encoder Figure 3(a) and decoder Figure 3(b)), while the cross-attention sub-layers use more LS capacity for M2O (decoder, Figure 3(d)). Regarding the encoder for M2O, we observe no significant LSScore
112
+
113
+ ![](images/8b0b70c0ddb0fbf187da80d96add82990d9931ea1f8f63b23db107417a5f2bf4.jpg)
114
+
115
+ Figure 3: LSScore of encoder and decoder sub-layers for O2M 3(a), 3(b) and M2O 3(c), 3(d) on OPUS-100. The solid lines correspond to models trained on the original data, while the dashed lines are on the oversampled data. We also include a red, dotted line to indicate the LSScore of 0.
116
+
117
+ <table><tr><td rowspan="2">Data Setting</td><td rowspan="2">Model</td><td colspan="5">02M</td><td colspan="5">M20</td></tr><tr><td>High</td><td>Med</td><td>Low</td><td>All</td><td>WR</td><td>High</td><td>Med</td><td>Low</td><td>All</td><td>WR</td></tr><tr><td rowspan="8">Original</td><td>Baseline</td><td>21.39</td><td>22.36</td><td>18.02</td><td>20.93</td><td>1</td><td>28.55</td><td>30.10</td><td>29.71</td><td>29.27</td><td>-</td></tr><tr><td>LS</td><td>+0.75</td><td>+1.83</td><td>+3.96</td><td>+1.79</td><td>94.68</td><td>-0.54</td><td>-0.16</td><td>-0.46</td><td>-0.41</td><td>32.98</td></tr><tr><td>CLSR-S</td><td>+0.06</td><td>-0.09</td><td>-0.34</td><td>-0.08</td><td>41.49</td><td>-0.14</td><td>-0.06</td><td>+0.02</td><td>-0.08</td><td>37.23</td></tr><tr><td>CLSR-L</td><td>+0.39</td><td>+1.54</td><td>+4.37</td><td>+1.62</td><td>84.04</td><td>-1.13</td><td>-0.47</td><td>-0.46</td><td>-0.78</td><td>21.28</td></tr><tr><td>CLSR*</td><td>+1.45</td><td>+2.83</td><td>+6.40</td><td>+2.97</td><td>95.74</td><td>+0.65</td><td>+1.52</td><td>+3.79</td><td>+1.61</td><td>96.81</td></tr><tr><td>Top-Bottom</td><td>+1.27</td><td>+2.71</td><td>+6.60</td><td>+2.89</td><td>96.81</td><td>+0.38</td><td>+1.16</td><td>+3.06</td><td>+1.21</td><td>78.72</td></tr><tr><td>Dedicated</td><td>+1.35</td><td>+2.75</td><td>+6.46</td><td>+2.90</td><td>97.87</td><td>+0.61</td><td>+1.50</td><td>+2.85</td><td>+1.38</td><td>89.36</td></tr><tr><td>Baseline</td><td>19.95</td><td>24.22</td><td>25.27</td><td>22.41</td><td></td><td>26.98</td><td>30.69</td><td>34.26</td><td></td><td></td></tr><tr><td rowspan="7">Over Sample</td><td></td><td></td><td></td><td></td><td></td><td>- 90.43</td><td></td><td></td><td></td><td>29.71</td><td>- 12.77</td></tr><tr><td>LS CLSR-S</td><td>+0.99 +0.02</td><td>+1.30 +0.13</td><td>+0.94</td><td>+1.07</td><td></td><td>-0.55</td><td>-0.61</td><td>-3.96</td><td>-1.33</td><td></td></tr><tr><td></td><td></td><td></td><td>+0.30</td><td>+0.11</td><td>44.68</td><td>-0.04</td><td>+0.06</td><td>-0.84</td><td>-0.19</td><td>35.11</td></tr><tr><td>CLSR-L CLSR*</td><td>+0.62 +1.76</td><td>+0.60 +2.04</td><td>+0.34</td><td>+0.55</td><td>69.15</td><td>-1.02 +0.82</td><td>-1.11 +0.84</td><td>-4.56</td><td>-1.84</td><td>7.45</td></tr><tr><td></td><td></td><td></td><td>+1.94</td><td>+1.89</td><td>93.62</td><td></td><td></td><td>-0.13</td><td>+0.62</td><td>76.60</td></tr><tr><td>Top-Bottom</td><td>+1.73</td><td>+1.91</td><td>+1.83</td><td>+1.81</td><td>96.81</td><td>+0.83</td><td>+1.05</td><td>-1.36</td><td>+0.41</td><td>73.40</td></tr><tr><td>Dedicated</td><td>+1.79</td><td>+2.03</td><td>+2.07</td><td>+1.92</td><td>94.68</td><td>+0.99</td><td>+0.92</td><td>-0.88</td><td>+0.55</td><td>77.66</td></tr></table>
118
+
119
+ Table 1: Translation quality for O2M and M2O on OPUS-100 with the original and oversampled training data. We list average $\mathrm { B L E U \uparrow }$ for High, Med, Low and All language groups, as well as $\mathrm { W R \uparrow }$ over all language pairs. Baseline: the vanilla multilingual baseline; $L S ^ { \circ }$ : the LS model proposed by Zhang et al. (2020b); CLSR-S: CLSR but always using shared modeling, i.e. $g ( \mathbf { z } ^ { l } ) = 0$ for all inputs; CLSR- $L i$ CLSR but always using LS modeling, i.e. $g ( \mathbf { z } ^ { l } ) = 1$ for all inputs; $C L S R ^ { \star }$ : the best CLSR model; Top-Bottom: applying LS modeling only to the top and bottom Transformer layers; Dedicated: dedicated model that allocates LS modeling based on LSScore distribution. Best results are highlighted in bold.
120
+
121
+ difference among different sub-layers as in Figure 3(c). Overall, CLSR tends to make the “M” side more LS, i.e. the encoder side of M2O (Figure 3(c)) and the decoder side of O2M (Figure 3(b)).
122
+
123
+ Does CLSR schedule language-specific capacity based on linguistic similarity? It is intriguing to explore how the capacity scheduled by CLSR is actualized, especially whether CLSR learns to organize LS capacity according to linguistic characteristics or not. The heatmap in Figure 6, Appendix B shows that the LSScore distribution over different sub-layers (y-axis) has only subtle difference across different language pairs $\mathbf { \dot { x } }$ -axis). This suggests that the capacity schedule has little to do with linguistic characteristics. More results in other settings are given in Figure 6, Appendix B, which reflect similar observation. In short, CLSR allocates LS capacity to specific sub-layers rather than specific languages. This could be ascribed to the design of CLSR. CLSR shares the gating parameters and the budget, $p$ , across all languages, which might impose some inductive bias discouraging its LS behavior. Besides, the structure of the gating in CLSR (Eq. 5) might fail to offer enough flexibility for controlling the gates in different ways across languages and layers. We leave further study of LS gating to future work.
124
+
125
+ On detailed results and comparison to other baselines. Table 1 summarizes our results.7 Although $\mathbf { L } \mathbf { S } ^ { \circ }$ (Zhang et al., 2020b) improves O2M, it fails to surpass the vanilla Baseline on M2O, indicating that the position of its LS layer, i.e. on top of the encoder outputs, is sub-optimal for many-to-one translation. Compared to $\mathrm { L } S ^ { \circ }$ , CLSR-S uses no LS modeling while CLSR-L injects LS projection into each sub-layer, both of which delivers inferior performance on O2M (against $\mathrm { L } S ^ { \circ }$ and Baseline) and M2O (against Baseline), echoing our findings from Figure 2. By contrast, $\mathrm { C L S R ^ { \star } }$ , which uses an optimized budget p, yields promising results, beating Baseline on O2M and M2O, underlining the importance of seeking balances between sharing and not sharing.
126
+
127
+ Can we use these insights to improve multilingual Transformer? We answer this question by transferring our findings from Figure 3 into the following two Transformer variants: one enhances the top and bottom encoder/decoder layers with LS projections (Top-Bottom), while the other makes high-LSScore sub-layers LS (Dedicated).8 Results of these experiments, in Table 1, demonstrate that incorporating our findings into Transformer helps to improve translation performance. The dedicated model in particular recovers and even surpasses the performance of $\mathrm { C L S R ^ { \star } }$ .
128
+
129
+ # 5.2 RESULTS ON WMT-14
130
+
131
+ ![](images/675732851a77b0dc34442686e981ca028adc66a962216572267a459a1c0ce30b.jpg)
132
+ Figure 4: Average BLEU 4(a),4(b) and win ratio 4(c),4(d) over all test language pairs for O2M and M2O on WMT-14 when varying the budget $p$ .
133
+
134
+ <table><tr><td rowspan="2">Data Setting</td><td rowspan="2">Model</td><td colspan="5">02M</td><td colspan="5">M20</td></tr><tr><td>High</td><td>Med</td><td>Low</td><td>All</td><td>WR</td><td>High</td><td>Med</td><td>Low</td><td>All</td><td>WR</td></tr><tr><td rowspan="8">Original</td><td>Baseline</td><td>27.24</td><td>16.27</td><td>8.72</td><td>17.58</td><td>1</td><td>30.64</td><td>24.37</td><td>18.66</td><td>24.58</td><td>1</td></tr><tr><td>LS</td><td>+0.06</td><td>+0.66</td><td>+1.68</td><td>+0.83</td><td>84.62</td><td>-0.06</td><td>-0.37</td><td>-0.92</td><td>-0.46</td><td>23.08</td></tr><tr><td>CLSR-S</td><td>+0.00</td><td>+0.16</td><td>+0.20</td><td>+0.12</td><td>53.85</td><td>+0.04</td><td>+0.16</td><td>+0.28</td><td>+0.17</td><td>69.23</td></tr><tr><td>CLSR-L</td><td>-0.52</td><td>+0.43</td><td>+2.06</td><td>+0.70</td><td>61.54</td><td>-0.82</td><td>-0.50</td><td>+0.00</td><td>-0.43</td><td>15.38</td></tr><tr><td>CLSR*</td><td>+0.46</td><td>+1.46</td><td>+3.10</td><td>+1.71</td><td>100.0</td><td>+0.12</td><td>+0.73</td><td>+1.52</td><td>+0.80</td><td>84.62</td></tr><tr><td>Top-Bottom</td><td>+0.10</td><td>+0.96</td><td>+2.78</td><td>+1.34</td><td>84.62</td><td>-0.08</td><td>+0.70</td><td>+1.26</td><td>+0.62</td><td>61.54</td></tr><tr><td>Dedicated</td><td>+0.26</td><td>+1.00</td><td>+2.98</td><td>+1.48</td><td>92.31</td><td>+0.04</td><td>+0.86</td><td>+1.90</td><td>+0.95</td><td>84.62</td></tr><tr><td>Baseline</td><td>26.10</td><td>19.00</td><td>15.52</td><td>20.39</td><td></td><td>29.96</td><td>26.33</td><td>23.56</td><td>26.66</td><td></td></tr><tr><td rowspan="7">Over Sample</td><td>LS</td><td>+0.30</td><td></td><td></td><td></td><td>1</td><td></td><td></td><td></td><td></td><td>- 00.00</td></tr><tr><td>CLSR-S</td><td>-0.12</td><td>+0.60</td><td>+0.26</td><td>+0.36</td><td>84.62</td><td>-0.44</td><td>-0.56</td><td>-0.80</td><td>-0.61</td><td></td></tr><tr><td>CLSR-L</td><td>-0.56</td><td>+0.03</td><td>+0.04</td><td>-0.02</td><td>46.15</td><td>+0.06</td><td>+0.04</td><td>-0.26</td><td>-0.07</td><td>46.15</td></tr><tr><td>CLSR*</td><td>+0.50</td><td>-0.10 +0.67</td><td>-0.32 +0.64</td><td>-0.36 +0.59</td><td>7.69 100.0</td><td>-0.90 +0.26</td><td>-1.00 +0.30</td><td>-1.24 +0.50</td><td>-1.05 +0.36</td><td>00.00</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>100.0</td></tr><tr><td>Top-Bottom</td><td>+0.12</td><td>+0.40</td><td>+0.56</td><td>+0.36</td><td>84.62</td><td>-0.08</td><td>+0.00</td><td>-0.50</td><td>-0.22</td><td>30.77</td></tr><tr><td>Dedicated</td><td>+0.46</td><td>+0.57</td><td>+0.66</td><td>+0.56</td><td>100.0</td><td>+0.16</td><td>+0.17</td><td>+0.22</td><td>+0.19</td><td>84.62</td></tr></table>
135
+
136
+ Table 2: Translation quality for O2M and M2O on WMT-14 with the original and oversampled training data.
137
+
138
+ Figure 4 shows the capacity trade-off on WMT-14, reconfirming the ability of CLSR. One noticeable difference is that the relative improvements become smaller. We ascribe this to the smaller number of language pairs in WMT-14, where the effect of introducing LS capacity into the model is smaller compared to the massively multilingual setting (Arivazhagan et al., 2019). Table 2 shows similar results as Table 1, where $\mathrm { C L S R ^ { \star } }$ outperforms both fully-shared (CLSR-S) and fully-LS (CLSRL) baselines, and both Top-Bottom and Dedicated improve multilingual translation compared to Baseline (except for M2O with oversampling). More results are given in Appendix C. Our results demonstrate that the CLSR approach generalizes to different datasets, with varying number of languages and resource sizes. We provide additional experiments ablating different elements on CLSR in Table 7, Appendix E.
139
+
140
+ # 6 CONCLUSION AND FUTURE WORK
141
+
142
+ Share or not? This is an open question when developing MNMT models. In this paper, we attempt to answer this question by proposing conditional language-specific routing (CLSR). Our empirical results demonstrate that CLSR learns to balance between shared and LS paths across all NMT sublayers, improving the quality of multilingual translation. Our analysis on OPUS-100 and WMT-14 suggest that both the position and the amount of LS capacity greatly affects MNMT. Scheduling $10 \% { - } 3 0 \%$ LS layers to the top and/or bottom encoder/decoder layers reaches CLSR’s peak performance. We also demonstrate how our findings can be leveraged to design a multilingual Transformer with an optimal sharing pattern. We believe that our work improves our understanding on the tradeoff between sharing and not sharing, paving the way for better multilingual models.
143
+
144
+ In the future, we plan to extend our study to many-to-many translation as well as larger-capacity models. We also plan to adapt CLSR to other multilingual multi-task learning settings to better handle knowledge transfer among different tasks, especially for cross-lingual downstream transfer.
145
+
146
+ # ACKNOWLEDGEMENTS
147
+
148
+ We would like to thank Yuan Cao for his valuable feedback. We would also like to thank the Google Translate team for their constructive discussions and comments. We thank the reviewers for their insightful comments. Rico Sennrich has received funding from the Swiss National Science Foundation (project no. 176727).
149
+
150
+ # REFERENCES
151
+
152
+ Roee Aharoni, Melvin Johnson, and Orhan Firat. Massively multilingual neural machine translation. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pp. 3874–3884, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics. doi: 10.18653/v1/N19-1388. URL https://www.aclweb.org/anthology/ N19-1388.
153
+
154
+ Naveen Arivazhagan, Ankur Bapna, Orhan Firat, Dmitry Lepikhin, Melvin Johnson, Maxim Krikun, Mia Xu Chen, Yuan Cao, George Foster, Colin Cherry, Wolfgang Macherey, Zhifeng Chen, and Yonghui Wu. Massively multilingual neural machine translation in the wild: Findings and challenges. CoRR, abs/1907.05019, 2019. URL http://arxiv.org/abs/1907.05019.
155
+
156
+ Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016.
157
+
158
+ Ankur Bapna and Orhan Firat. Simple, scalable adaptation for neural machine translation. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pp. 1538–1548, Hong Kong, China, November 2019. Association for Computational Linguistics. doi: 10.18653/v1/D19-1165. URL https://www.aclweb.org/anthology/D19-1165.
159
+
160
+ Ankur Bapna, Naveen Arivazhagan, and Orhan Firat. Controlling computation versus quality for neural sequence models. arXiv preprint arXiv:2002.07106, 2020.
161
+
162
+ Loïc Barrault, Ondˇrej Bojar, Marta R. Costa-jussà, Christian Federmann, Mark Fishel, Yvette Graham, Barry Haddow, Matthias Huck, Philipp Koehn, Shervin Malmasi, Christof Monz, Mathias Müller, Santanu Pal, Matt Post, and Marcos Zampieri. Findings of the 2019 conference on machine translation (WMT19). In Proceedings of the Fourth Conference on Machine Translation (Volume 2: Shared Task Papers, Day 1), pp. 1–61, Florence, Italy, August 2019. Association for Computational Linguistics. doi: 10.18653/v1/W19-5301. URL https://www.aclweb.org/anthology/W19-5301.
163
+
164
+ Yoshua Bengio, Nicholas Léonard, and Aaron Courville. Estimating or propagating gradients through stochastic neurons for conditional computation. arXiv preprint arXiv:1308.3432, 2013.
165
+
166
+ Graeme Blackwood, Miguel Ballesteros, and Todd Ward. Multilingual neural machine translation with task-specific attention. In Proceedings of the 27th International Conference on Computational Linguistics, pp. 3112–3122, Santa Fe, New Mexico, USA, August 2018. Association for Computational Linguistics. URL https://www.aclweb.org/anthology/C18-1263.
167
+
168
+ Chung-Cheng Chiu and Colin Raffel. Monotonic chunkwise attention. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id= Hko85plCW.
169
+
170
+ Andrew Davis and Itamar Arel. Low-rank approximations for conditional feedforward computation in deep neural networks, 2013.
171
+
172
+ Mostafa Dehghani, Stephan Gouws, Oriol Vinyals, Jakob Uszkoreit, and Lukasz Kaiser. Universal transformers. In International Conference on Learning Representations, 2019. URL https: //openreview.net/forum?id $=$ HyzdRiR9Y7.
173
+
174
+ Daxiang Dong, Hua Wu, Wei He, Dianhai Yu, and Haifeng Wang. Multi-task learning for multiple language translation. In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pp. 1723–1732, Beijing, China, July 2015. Association for Computational Linguistics. doi: 10.3115/v1/P15-1166. URL https://www.aclweb.org/ anthology/P15-1166.
175
+
176
+ Maha Elbayad, Jiatao Gu, Edouard Grave, and Michael Auli. Depth-adaptive transformer. In International Conference on Learning Representations, 2020. URL https://openreview. net/forum?id ${ . } = { }$ SJg7KhVKPH.
177
+
178
+ Carlos Escolano, Marta R Costa-jussà, José AR Fonollosa, and Mikel Artetxe. Multilingual machine translation: Closing the gap between shared and language-specific encoder-decoders. arXiv preprint arXiv:2004.06575, 2020.
179
+
180
+ Angela Fan, Edouard Grave, and Armand Joulin. Reducing transformer depth on demand with structured dropout. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ SylO2yStDr.
181
+
182
+ Orhan Firat, Kyunghyun Cho, and Yoshua Bengio. Multi-way, multilingual neural machine translation with a shared attention mechanism. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 866–875, San Diego, California, June 2016a. Association for Computational Linguistics. doi: 10.18653/v1/N16-1101. URL https://www.aclweb.org/anthology/ N16-1101.
183
+
184
+ Orhan Firat, Baskaran Sankaran, Yaser Al-onaizan, Fatos T. Yarman Vural, and Kyunghyun Cho. Zero-resource translation with multi-lingual neural machine translation. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pp. 268–277, Austin, Texas, November 2016b. Association for Computational Linguistics. doi: 10.18653/ v1/D16-1026. URL https://www.aclweb.org/anthology/D16-1026.
185
+
186
+ Alex Graves. Adaptive computation time for recurrent neural networks. arXiv preprint arXiv:1603.08983, 2016.
187
+
188
+ Thanh-Le Ha, Jan Niehues, and Alexander Waibel. Toward multilingual neural machine translation with universal encoder and decoder. In Proceedings of the 13th International Workshop on Spoken Language Translation (IWSLT), Seattle, USA, December 8-9 2016.
189
+
190
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. CoRR, abs/1512.03385, 2015. URL http://arxiv.org/abs/1512.03385.
191
+
192
+ Yanping Huang, Youlong Cheng, Ankur Bapna, Orhan Firat, Dehao Chen, Mia Chen, HyoukJoong Lee, Jiquan Ngiam, Quoc V Le, Yonghui Wu, et al. Gpipe: Efficient training of giant neural networks using pipeline parallelism. In Advances in neural information processing systems, pp. 103–112, 2019.
193
+
194
+ Melvin Johnson, Mike Schuster, Quoc V. Le, Maxim Krikun, Yonghui Wu, Zhifeng Chen, Nikhil Thorat, Fernanda Viégas, Martin Wattenberg, Greg Corrado, Macduff Hughes, and Jeffrey Dean. Google’s multilingual neural machine translation system: Enabling zero-shot translation. Transactions of the Association for Computational Linguistics, 5:339–351, 2017. doi: 10.1162/tacl_a_00065. URL https://www.aclweb.org/anthology/Q17-1024.
195
+
196
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations, 2015.
197
+
198
+ Taku Kudo and John Richardson. SentencePiece: A simple and language independent subword tokenizer and detokenizer for neural text processing. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pp. 66–71, Brussels, Belgium, November 2018. Association for Computational Linguistics. doi: 10.18653/v1/D18-2012. URL https://www.aclweb.org/anthology/D18-2012.
199
+
200
+ Jason Lee, Kyunghyun Cho, and Thomas Hofmann. Fully character-level neural machine translation without explicit segmentation. Transactions of the Association for Computational Linguistics, 5:365–378, 2017. doi: 10.1162/tacl_a_00067. URL https://www.aclweb.org/ anthology/Q17-1026.
201
+
202
+ Dmitry Lepikhin, HyoukJoong Lee, Yuanzhong Xu, Dehao Chen, Orhan Firat, Yanping Huang, Maxim Krikun, Noam Shazeer, and Zhifeng Chen. Gshard: Scaling giant models with conditional computation and automatic sharding. arXiv preprint arXiv:2006.16668, 2020.
203
+
204
+ Hanxiao Liu, Karen Simonyan, and Yiming Yang. DARTS: Differentiable architecture search. In International Conference on Learning Representations, 2019. URL https://openreview. net/forum?id ${ . } = { }$ S1eYHoC5FX.
205
+
206
+ Tom M Mitchell. The need for biases in learning generalizations. Department of Computer Science, Laboratory for Computer Science Research . . . , 1980.
207
+
208
+ Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. Bleu: a method for automatic evaluation of machine translation. In Proceedings of the 40th Annual Meeting of the Association for Computational Linguistics, pp. 311–318, Philadelphia, Pennsylvania, USA, July 2002. Association for Computational Linguistics. doi: 10.3115/1073083.1073135. URL https: //www.aclweb.org/anthology/P02-1040.
209
+
210
+ Emmanouil Antonios Platanios, Mrinmaya Sachan, Graham Neubig, and Tom Mitchell. Contextual parameter generation for universal neural machine translation. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 425–435, Brussels, Belgium, October-November 2018. Association for Computational Linguistics. doi: 10.18653/v1/ D18-1039. URL https://www.aclweb.org/anthology/D18-1039.
211
+
212
+ Matt Post. A call for clarity in reporting BLEU scores. In Proceedings of the Third Conference on Machine Translation: Research Papers, pp. 186–191, Belgium, Brussels, October 2018. Association for Computational Linguistics. URL https://www.aclweb.org/anthology/ W18-6319.
213
+
214
+ Sebastian Ruder, Joachim Bingel, Isabelle Augenstein, and Anders Søgaard. Latent multi-task architecture learning. Proceedings of the AAAI Conference on Artificial Intelligence, 33(01): 4822–4829, Jul. 2019. doi: 10.1609/aaai.v33i01.33014822. URL https://ojs.aaai.org/ index.php/AAAI/article/view/4410.
215
+
216
+ Devendra Sachan and Graham Neubig. Parameter sharing methods for multilingual self-attentional translation models. In Proceedings of the Third Conference on Machine Translation: Research Papers, pp. 261–271, Brussels, Belgium, October 2018. Association for Computational Linguistics. doi: 10.18653/v1/W18-6327. URL https://www.aclweb.org/anthology/ W18-6327.
217
+
218
+ 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, Berlin, Germany, August 2016. Association for Computational Linguistics. doi: 10.18653/v1/P16-1162. URL https://www.aclweb. org/anthology/P16-1162.
219
+
220
+ Noam Shazeer, Azalia Mirhoseini, Krzysztof Maziarz, Andy Davis, Quoc Le, Geoffrey Hinton, and Jeff Dean. Outrageously large neural networks: The sparsely-gated mixture-of-experts layer. arXiv preprint arXiv:1701.06538, 2017.
221
+
222
+ Aditya Siddhant, Ankur Bapna, Yuan Cao, Orhan Firat, Mia Chen, Sneha Kudugunta, Naveen Arivazhagan, and Yonghui Wu. Leveraging monolingual data with self-supervision for multilingual neural machine translation. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 2827–2835, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.252. URL https://www.aclweb.org/ anthology/2020.acl-main.252.
223
+
224
+ Sainbayar Sukhbaatar, Edouard Grave, Piotr Bojanowski, and Armand Joulin. Adaptive attention span in transformers. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 331–335, Florence, Italy, July 2019. Association for Computational Linguistics. doi: 10.18653/v1/P19-1032. URL https://www.aclweb.org/anthology/ P19-1032.
225
+
226
+ Xu Tan, Jiale Chen, Di He, Yingce Xia, Tao QIN, and Tie-Yan Liu. Multilingual neural machine translation with language clustering. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pp. 963–973, Hong Kong, China, November 2019. Association for Computational Linguistics. doi: 10.18653/v1/D19-1089. URL https://www.aclweb.org/anthology/D19-1089.
227
+
228
+ Jörg Tiedemann. Parallel data, tools and interfaces in opus. In Nicoletta Calzolari (Conference Chair), Khalid Choukri, Thierry Declerck, Mehmet Ugur Dogan, Bente Maegaard, Joseph Mariani, Jan Odijk, and Stelios Piperidis (eds.), Proceedings of the Eight International Conference on Language Resources and Evaluation (LREC’12), Istanbul, Turkey, may 2012. European Language Resources Association (ELRA). ISBN 978-2-9517408-7-7.
229
+
230
+ 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.
231
+
232
+ Raúl Vázquez, Alessandro Raganato, Jörg Tiedemann, and Mathias Creutz. Multilingual NMT with a language-independent attention bridge. In Proceedings of the 4th Workshop on Representation Learning for NLP (RepL4NLP-2019), pp. 33–39, Florence, Italy, August 2019. Association for Computational Linguistics. doi: 10.18653/v1/W19-4305. URL https://www.aclweb. org/anthology/W19-4305.
233
+
234
+ Xinyi Wang, Yulia Tsvetkov, and Graham Neubig. Balancing training for multilingual neural machine translation. arXiv preprint arXiv:2004.06748, 2020a.
235
+
236
+ Yining Wang, Jiajun Zhang, Feifei Zhai, Jingfang Xu, and Chengqing Zong. Three strategies to improve one-to-many multilingual translation. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 2955–2960, Brussels, Belgium, OctoberNovember 2018. Association for Computational Linguistics. doi: 10.18653/v1/D18-1326. URL https://www.aclweb.org/anthology/D18-1326.
237
+
238
+ Yining Wang, Long Zhou, Jiajun Zhang, Feifei Zhai, Jingfang Xu, and Chengqing Zong. A compact and language-sensitive multilingual translation method. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 1213–1223, Florence, Italy, July 2019. Association for Computational Linguistics. doi: 10.18653/v1/P19-1117. URL https://www.aclweb.org/anthology/P19-1117.
239
+
240
+ Zirui Wang, Zachary C. Lipton, and Yulia Tsvetkov. On negative interference in multilingual models: Findings and a meta-learning treatment. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 4438–4450, Online, November 2020b. Association for Computational Linguistics. doi: 10.18653/v1/2020.emnlp-main.359. URL https://www.aclweb.org/anthology/2020.emnlp-main.359.
241
+
242
+ Biao Zhang, Ivan Titov, and Rico Sennrich. On sparsifying encoder outputs in sequence-to-sequence models. arXiv preprint arXiv:2004.11854, 2020a.
243
+
244
+ Biao Zhang, Philip Williams, Ivan Titov, and Rico Sennrich. Improving massively multilingual neural machine translation and zero-shot translation. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 1628–1639, Online, July 2020b. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.148. URL https://www. aclweb.org/anthology/2020.acl-main.148.
245
+
246
+ Changfeng Zhu, Heng Yu, Shanbo Cheng, and Weihua Luo. Language-aware interlingua for multilingual neural machine translation. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 1650–1655, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.150. URL https://www.aclweb.org/ anthology/2020.acl-main.150.
247
+
248
+ Barret Zoph and Kevin Knight. Multi-source neural translation. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 30–34, San Diego, California, June 2016. Association for Computational Linguistics. doi: 10.18653/v1/N16-1004. URL https://www.aclweb.org/ anthology/N16-1004.
249
+
250
+ # A DATASET DETAILS
251
+
252
+ Table 3: Statistics of train, dev and test data for WMT-14.
253
+
254
+ <table><tr><td rowspan="2">Language Pair</td><td colspan="3">Data Sources</td><td colspan="3"># Samples</td></tr><tr><td>Train</td><td>Dev</td><td>Test</td><td>Train</td><td>Dev</td><td>Test</td></tr><tr><td>En-Cs</td><td>WMT19</td><td>WMT17</td><td>WMT18</td><td>64336053</td><td>3005</td><td>2983</td></tr><tr><td>En-Fr</td><td>WMT15</td><td>WMT13</td><td>WMT14</td><td>40449146</td><td>3000</td><td>3003</td></tr><tr><td>En-Ru</td><td>WMT19</td><td>WMT18</td><td>WMT19</td><td>38492126</td><td>3000</td><td>2000</td></tr><tr><td>En-Zh</td><td>WMT19</td><td>WMT18</td><td>WMT19</td><td>25986436</td><td>3981</td><td>2000</td></tr><tr><td>En-Es</td><td>WMT13</td><td>WMT13</td><td>WMT13</td><td>15182374</td><td>3004</td><td>3000</td></tr><tr><td>En-Fi</td><td>WMT19</td><td>WMT18</td><td>WMT19</td><td>6587448</td><td>3000</td><td>1996</td></tr><tr><td>En-De</td><td>WMT14</td><td>WMT13</td><td>WMT14</td><td>4508785</td><td>3000</td><td>3003</td></tr><tr><td>En-Et</td><td>WMT18</td><td>WMT18</td><td>WMT18</td><td>2175873</td><td>2000</td><td>2000</td></tr><tr><td>En-Lv</td><td>WMT17</td><td>WMT17</td><td>WMT17</td><td>637599</td><td>2003</td><td>2001</td></tr><tr><td>En-Lt</td><td>WMT19</td><td>WMT19</td><td>WMT19</td><td>635146</td><td>2000</td><td>1000</td></tr><tr><td>En-Ro</td><td>WMT16</td><td>WMT16</td><td>WMT16</td><td>610320</td><td>1999</td><td>1999</td></tr><tr><td>En-Hi</td><td>WMT14</td><td>WMT14</td><td>WMT14</td><td>313748</td><td>520</td><td>2507</td></tr><tr><td>En-Tr</td><td>WMT18</td><td>WMT17</td><td>WMT18</td><td>205756</td><td>3007</td><td>3000</td></tr></table>
255
+
256
+ ![](images/1924802c247d32926e0bb3d29dcea2def3fda6a46aa4f485e39ebc92d2d84eb9.jpg)
257
+ Figure 5: Training data distribution over language pairs for OPUS-100 and WMT-14.
258
+ Table 3 lists the statistics for WMT-14. We collect these datasets following Siddhant et al. (2020). Figure 5 shows the training data distribution. Training data in WMT-14 is more imbalanced across different language pairs compared to OPUS-100.
259
+
260
+ # B MORE RESULTS ON OPUS-100
261
+
262
+ Table 4: Selected sub-layers by Dedicated on OPUS-100. SAN/CAN: self-/cross-attention; FFN: feed-forward.
263
+ Figure 7 shows the translation performance of CLSR on each resource group when varying the budget $p$ . We find that LS modeling greatly improves translation on low-resource settings, although
264
+
265
+ <table><tr><td rowspan="3">Data Setting</td><td colspan="4">Encoder</td><td colspan="6">Decoder</td></tr><tr><td colspan="2">Bottom</td><td colspan="2">Top</td><td colspan="3">Bottom</td><td colspan="3">Top</td></tr><tr><td>SAN</td><td>FFN</td><td>SAN</td><td>FFN</td><td>SAN</td><td>CAN</td><td>FFN</td><td>SAN</td><td>CAN</td><td>FFN</td></tr><tr><td>Original, O2M</td><td>:</td><td>√</td><td></td><td>√</td><td>√</td><td></td><td>√</td><td>√</td><td>·</td><td>√</td></tr><tr><td>Original, M20</td><td></td><td>√</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>√</td></tr><tr><td>Oversample, O2M</td><td></td><td></td><td></td><td>√</td><td>√</td><td></td><td></td><td>√</td><td>√</td><td>√</td></tr><tr><td>Oversample, M20</td><td>√</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
266
+
267
+ Figure 6: Heatmap of LSScore distribution on OPUS-100 trained w/ and w/o oversampling. X-axis denotes language pairs ranked by training data size, and y-axis denotes encoder (enc) and decoder (dec) sub-layers with a format of “enc/dec.layer types.layer index”. Darker color indicates a larger LSScore.
268
+
269
+ ![](images/f5bc27a61534262293534ce0ea0ceb3fdba9cf1e259ae5d8951506f9d373cba1.jpg)
270
+
271
+ (a) Oversample, M2O
272
+
273
+ ![](images/56b461988efebfb43d69da3cf9a8bb7985b251d4d5bdc048d2db115b72d1ed0c.jpg)
274
+
275
+ ![](images/37d295ce4354b2b675d759b163c651d4bc55b55ed62f7cf47deada87defa8c83.jpg)
276
+
277
+ (d) Original, M2O
278
+
279
+ this improvement is partially offset by the oversampling strategy. We observe that the success of oversampling is built on top of sacrificing quality on high-resource languages, where CLSR largely narrows or even closes the performance gap against the multilingual baseline trained on the original
280
+
281
+ ![](images/cccc314c3a7e3af4ea3b308028ce66780034863340fd07ae1f616c8f1721e83b.jpg)
282
+ Figure 7: Impact of the budget $p$ on average test BLEU for High/Med/Low-resource languages on OPUS-100.
283
+
284
+ data. In addition, we find no significant difference in term of the trade-off curve across resource groups compared to Figure 2.
285
+
286
+ Figure 6 shows the heatmaps for LSScore distribution. Regardless of translation directions (O2M or M2O) and data settings (Original or Oversample), there is no clear linguistic pattern behind these heatmaps. The learning of CLSR is not linguistic driven.
287
+
288
+ # C MORE RESULTS ON WMT-14
289
+
290
+ Table 5: Selected sub-layers by Dedicated on WMT-14.
291
+
292
+ <table><tr><td rowspan="3">Data Setting</td><td colspan="4">Encoder</td><td colspan="6">Decoder</td></tr><tr><td colspan="2">Bottom</td><td colspan="2">Top</td><td colspan="3">Bottom</td><td colspan="3">Top</td></tr><tr><td>SAN</td><td>FFN</td><td>SAN</td><td>FFN</td><td>SAN</td><td>CAN</td><td>FFN</td><td>SAN</td><td>CAN</td><td>FFN</td></tr><tr><td>Original, O2M Original, M20</td><td></td><td>·</td><td></td><td>√</td><td>·</td><td></td><td>√</td><td>·</td><td>√</td><td>√</td></tr><tr><td></td><td>√</td><td></td><td></td><td></td><td></td><td>√</td><td></td><td></td><td></td><td>√</td></tr><tr><td>Oversample, O2M</td><td></td><td>√</td><td></td><td>1</td><td>√</td><td>·</td><td></td><td>、</td><td>专</td><td>·</td></tr><tr><td>Oversample, M20</td><td>√</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
293
+
294
+ We show more results on WMT-14 here. Both heatmaps in Figure 9 and fine-grained trade-off curves in Figure 8 show a very similar story to the one on OPUS-100. In terms of LSScore distribution in Figure 10(d), we also have similar observation except that the cross-attention sub-layer in the decoder on M2O shows no clear LS preference.
295
+
296
+ These results suggest the high generalization of CLSR to different data settings.
297
+
298
+ ![](images/20911aad6951714ef7b7028b56356b7fe989778ac2495d8320106b9f442884d5.jpg)
299
+ Figure 8: Impact of the budget $p$ on average test BLEU for High/Med/Low-resource languages on WMT-14.
300
+
301
+ ![](images/229ecac8453e228c87d02ddf975425331c98d3f2ced9da2fc0d79aeedcec6f98.jpg)
302
+ Figure 9: Heatmap of LSScore distribution on WMT-14.
303
+
304
+ ![](images/ee3f70090470dcd42c99f6aefa855e6eeb9975441070c96a09f8855f4538bd14.jpg)
305
+ Figure 10: LSScore of encoder and decoder sub-layers for O2M 10(a), 10(b) and M2O 10(c), 10(d) on WMT14.
306
+
307
+ Table 6: Number of parameters for each model on OPUS-100 and WMT-14.
308
+
309
+ <table><tr><td rowspan="2">Model</td><td colspan="2">OPUS-100</td><td colspan="2">WMT-14</td></tr><tr><td>02M</td><td>M20</td><td>02M</td><td>M20</td></tr><tr><td>Baseline</td><td colspan="2">99M</td><td colspan="2">106M</td></tr><tr><td>LS</td><td colspan="2">129M</td><td colspan="2">111M</td></tr><tr><td>CLSR-S</td><td colspan="2">102M</td><td colspan="2">109M</td></tr><tr><td>CLSR-L</td><td colspan="2">148M</td><td colspan="2">111M</td></tr><tr><td>CLSR*</td><td colspan="2">157M</td><td colspan="2">121M</td></tr><tr><td></td><td colspan="2">153M</td><td colspan="2"></td></tr><tr><td>Top-Bottom Dedicated (Original)</td><td>153M</td><td>154M</td><td>116M 117M</td><td>117M</td></tr><tr><td>Dedicated (Oversample)</td><td>154M</td><td>155M</td><td>117M</td><td>117M</td></tr></table>
310
+
311
+ # D MODEL PARAMETERS
312
+
313
+ We list model parameters in Table 6. Note that the source/target vocabulary for O2M is the same as the target/source vocabulary for M2O, thus models for O2M and M2O have the same number of trainable parameters except for Dedicated where the network structure differs.
314
+
315
+ # E ABLATION STUDY
316
+
317
+ We provide two variants of CLSR for ablation. The first one examines whether CLSR could induce an optimal budget automatically by eschewing the budget constraint in Eq. 6 (CLSR w/o $p$ ); the second one further replaces the hard gating network with a vanilla soft gating network (CLSR-Gate).
318
+
319
+ Table 7 summarizes the translation results. Without the regularization term, CLSR w/o $p$ yields an average gating value of 0.37/0.16 and 0.39/0.19 for O2M/M2O on OPUS-100 and WMT-14, respectively9, resonating with our finding that O2M requires more LS capacity compared to M2O. Compared to $\mathrm { C L S R ^ { \star } }$ , CLSR w/o $p$ produces more open gates, achieving comparable but overall worse performance in all data settings. This highlights the importance of the added regularization term, where without such regularization the model is likely spending extra learning cycles to automatically optimize for the budget as with CLSR w/o $p$ . This in return hints at the importance of optimization routines (learning) which we held constant in this study.
320
+
321
+ By contrast, switching to soft gating network, CLSR-Gate gains translation quality in most settings, although the quality gains are mostly less than 0.1 compared to $\mathrm { C L S R ^ { \star } }$ . Note that, CLSR-Gate relies on continuous gates, indicating a much higher flexibility in balancing parameter sharing patterns. However, we also notice that CLSR-Gate performs worse on M2O, even fails to beat the vanilla Baseline (All) on the oversampled WMT-14. Unlike CLSR-Gate, $\mathrm { C L S R ^ { \star } }$ uses hard binary gates which eases capacity analysis and achieves consistent improvements across data settings.
322
+
323
+ Table 7: Translation quality for O2M and M2O on OPUS-100 and WMT-14 with the original and oversampled training data. CLSR-Gate: CLSR with $g ( \mathbf { z } ^ { l } )$ a normal soft gating network; CLSR w/o $p$ : CLSR trained without budget constraint.
324
+
325
+ <table><tr><td rowspan="2">Data Setting</td><td rowspan="2">Model</td><td rowspan="2">#Param</td><td colspan="5">02M</td><td colspan="5">M20</td></tr><tr><td>High</td><td>Med</td><td>Low</td><td>All</td><td>WR</td><td>High</td><td>Med</td><td>Low</td><td>All</td><td>WR</td></tr><tr><td colspan="10">OPUS-100</td><td></td><td></td><td></td></tr><tr><td rowspan="4">Original</td><td>Baseline CLSR*</td><td>99M 157M</td><td>21.39 +1.45</td><td>22.36 +2.83</td><td>18.02 +6.40</td><td>20.93 +2.97</td><td>- 95.74</td><td>28.55 +0.65</td><td>30.10 +1.52</td><td>29.71 +3.79</td><td>29.27 +1.61</td><td>- 96.81</td></tr><tr><td>CLSR w/o p</td><td>157M</td><td>+1.37</td><td>+2.77</td><td>+6.28</td><td>+2.88</td><td>96.81</td><td>+0.53</td><td>+1.27</td><td>+3.17</td><td>+1.34</td><td>90.43</td></tr><tr><td>CLSR-Gate Baseline</td><td>157M</td><td>+1.55</td><td>+3.13</td><td>+6.21</td><td>+3.06</td><td>97.87</td><td>+0.74</td><td>+1.62</td><td>+2.87</td><td>+1.48</td><td>93.62</td></tr><tr><td>CLSR* CLSR w/o p</td><td>99M 157M 157M</td><td>19.95 +1.76 +1.72</td><td>24.22 +2.04 +1.92</td><td>25.27 +1.94 +2.06</td><td>22.41 +1.89 +1.86</td><td>- 93.62 97.87</td><td>26.98 +0.82 +0.73</td><td>30.69 +0.84 +0.56</td><td>34.26 -0.13 -1.10</td><td>29.71 +0.62 +0.27</td><td>- 76.60 71.28</td></tr><tr><td>WMT-14</td><td>CLSR-Gate</td><td>157M</td><td>+2.00</td><td>+2.24</td><td>+2.35</td><td>+2.15</td><td>97.87</td><td>+1.12</td><td>+1.28</td><td>-1.04</td><td>+0.68</td><td>79.79</td></tr><tr><td rowspan="4">Original</td><td>Baseline</td><td>106M</td><td>27.24</td><td>16.27</td><td>8.72</td><td>17.58</td><td></td><td>30.64</td><td>24.37</td><td>18.66</td><td>24.58</td><td></td></tr><tr><td>CLSR*</td><td>121M</td><td>+0.46</td><td>+1.46</td><td>+3.10</td><td>+1.71</td><td>100.0</td><td>+0.12</td><td>+0.73</td><td>+1.52</td><td>+0.80</td><td>84.62</td></tr><tr><td>CLSR w/o p CLSR-Gate</td><td>121M</td><td>+0.32</td><td>+1.23</td><td>+3.00</td><td>+1.57</td><td>100.0</td><td>-0.04</td><td>+0.56</td><td>+1.72</td><td>+0.78</td><td>76.92</td></tr><tr><td>Baseline</td><td>121M</td><td>+0.46</td><td>+1.43</td><td>+3.14</td><td>+1.72</td><td>100.0</td><td>+0.02</td><td>+0.73</td><td>+1.68</td><td>+0.83</td><td>84.62</td></tr><tr><td rowspan="4">Over Sample</td><td>CLSR*</td><td>106M 121M</td><td>26.10 +0.50</td><td>19.00 +0.67</td><td>15.52 +0.64</td><td>20.39</td><td>=</td><td>29.96 +0.26</td><td>26.33</td><td>23.56 +0.50</td><td>26.66 +0.36</td><td>-</td></tr><tr><td>CLSR w/o p</td><td></td><td></td><td></td><td></td><td>+0.59</td><td>100.0</td><td></td><td>+0.30</td><td></td><td></td><td>100.0</td></tr><tr><td>CLSR-Gate</td><td>121M</td><td>+0.48</td><td>+0.63</td><td>+0.66</td><td>+0.59</td><td>100.0</td><td>+0.02</td><td>+0.24</td><td>-0.12</td><td>+0.02</td><td>38.46</td></tr><tr><td></td><td>121M</td><td>+0.52</td><td>+0.77</td><td>+0.78</td><td>+0.68</td><td>100.0</td><td>+0.14</td><td>+0.30</td><td>-0.64</td><td>-0.12</td><td>61.54</td></tr></table>
md/train/ZKbZ4mebI9l/ZKbZ4mebI9l.md ADDED
@@ -0,0 +1,340 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Reconstruction for Powerful Graph Representations
2
+
3
+ Leonardo Cotta Purdue University cotta@purdue.edu
4
+
5
+ Christopher Morris Mila – Quebec AI Institute, McGill University chris@christophermorris.info
6
+
7
+ Bruno Ribeiro Purdue University ribeiro@cs.purdue.edu
8
+
9
+ # Abstract
10
+
11
+ Graph neural networks (GNNs) have limited expressive power, failing to represent many graph classes correctly. While more expressive graph representation learning (GRL) alternatives can distinguish some of these classes, they are significantly harder to implement, may not scale well, and have not been shown to outperform well-tuned GNNs in real-world tasks. Thus, devising simple, scalable, and expressive GRL architectures that also achieve real-world improvements remains an open challenge. In this work, we show the extent to which graph reconstruction—reconstructing a graph from its subgraphs—can mitigate the theoretical and practical problems currently faced by GRL architectures. First, we leverage graph reconstruction to build two new classes of expressive graph representations. Secondly, we show how graph reconstruction boosts the expressive power of any GNN architecture while being a (provably) powerful inductive bias for invariances to vertex removals. Empirically, we show how reconstruction can boost GNN’s expressive power—while maintaining its invariance to permutations of the vertices—by solving seven graph property tasks not solvable by the original GNN. Further, we demonstrate how it boosts state-of-the-art GNN’s performance across nine real-world benchmark datasets.
12
+
13
+ # 1 Introduction
14
+
15
+ Supervised machine learning for graph-structured data, i.e., graph classification and regression, is ubiquitous across application domains ranging from chemistry and bioinformatics [8, 94] to image [89], and social network analysis [33]. Consequently, machine learning on graphs is an active research area with numerous proposed approaches—notably GNNs [21, 42, 45] being the most representative case of GRL methods.
16
+
17
+ Arguably, GRL’s most interesting results arise from a cross-over between graph theory and representation learning. For instance, the representational limits of GNNs are upper-bounded by a simple heuristic for the graph isomorphism problem [78, 105], the 1-dimensional Weisfeiler-Leman algorithm (1- WL) [44, 73, 75, 101, 102], which might miss crucial structural information in the data [5]. Further works show how GNNs cannot approximate graph properties such as diameter, radius, girth, and subgraph counts [25, 38], inspiring architectures [6, 66, 77, 78] based on the more powerful $\kappa$ -dimensional Weisfeiler-Leman algorithm ( $\kappa$ -WL) [44].1 On the other hand, despite the limited expressiveness of GNNs, they still can overfit the training data, offering limited generalization performance [105]. Hence, devising GRL architectures that are simultaneously sufficiently expressive and avoid overfitting remains an open problem.
18
+
19
+ An under-explored connection between graph theory and GRL is graph reconstruction, which studies graphs and graph properties uniquely determined by their subgraphs. In this direction, both the pioneering work of Shawe-Taylor [88] and the more recent work of Bouritsas et al. [18], show that assuming the reconstruction conjecture (see Conjecture 1) holds, their models are most-expressive representations (universal approximators) of graphs. Unfortunately, Shawe-Taylor’s computational graph grows exponentially with the number of vertices, and Bouritsas et al.’s full representation power requires performing multiple graph isomorphism tests on potentially large graphs (with $n - 1$ vertices). Moreover, these methods were not inspired by the more general subject of graph reconstruction; instead, they rely on the reconstruction conjecture to prove their architecture’s expressive powers.
20
+
21
+ Contributions. In this work, we directly connect graph reconstruction to GRL. We first show how the $k$ -reconstruction of graphs—reconstruction from induced $k$ -vertex subgraphs—induces a natural class of expressive GRL architectures for supervised learning with graphs, denoted $k$ -Reconstruction Neural Networks. We then show how several existing works have their expressive power limited by $k$ -reconstruction. Further, we show how the reconstruction conjecture’s insights lead to a provably most expressive representation of graphs. Unlike Shawe-Taylor [88] and Bouritsas et al. [18], which, for graph tasks, require fixed-size unattributed graphs and multiple (large) graph isomorphism tests, respectively, our method represents bounded-size graphs with vertex attributes and does not rely on isomorphism tests.
22
+
23
+ To make our models scalable, we propose $k$ -Reconstruction GNNs, a general tool for boosting the expressive power and performance of GNNs with graph reconstruction. Theoretically, we characterize their expressive power showing that $k$ -Reconstruction GNNs can distinguish graph classes that the 1-WL and 2-WL cannot, such as cycle graphs and strongly regular graphs, respectively. Further, to explain gains in real-world tasks, we show how reconstruction can act as a lower-variance risk estimator when the graph-generating distribution is invariant to vertex removals. Empirically, we show that reconstruction enhances GNNs’ expressive power, making them solve multiple synthetic graph property tasks in the literature not solvable by the original GNN. On real-world datasets, we show that the increase in expressive power coupled with the lower-variance risk estimator boosts GNNs’ performance up to $2 5 \%$ . Our combined theoretical and empirical results make another important connection between graph theory and GRL.
24
+
25
+ # 1.1 Related work
26
+
27
+ We review related work from GNNs, their limitations, data augmentation, and the reconstruction conjecture in the following. See Appendix A for a more detailed discussion.
28
+
29
+ GNNs. Notable instances of this architecture include, e.g., [31, 47, 97], and the spectral approaches proposed in, e.g., [19, 30, 56, 72]—all of which descend from early work in [10, 57, 69, 70, 71, 87, 90]. Aligned with the field’s recent rise in popularity, there exists a plethora of surveys on recent advances in GNN methods. Some of the most recent ones include [21, 104, 114].
30
+
31
+ Limits of GNNs. Recently, connections to Weisfeiler-Leman type algorithms have been shown [9, 27, 39, 40, 64, 66, 77, 78, 105]. Specifically, the authors of [78, 105] show how the 1-WL limits the expressive power of any possible GNN architecture. Morris et al. [78] introduce $\kappa$ -dimensional GNNs which rely on a more expressive message-passing scheme between subgraphs of cardinality $\kappa$ . Later, this was refined in [6, 66] and in [76] by deriving models equivalent to the more powerful $\kappa$ -dimensional Weisfeiler-Leman algorithm. Chen et al. [27] connect the theory of universal approximation of permutation-invariant functions and graph isomorphism testing, further introducing a variation of the 2- WL. Recently, a large body of work propose enhancements to GNNs, e.g., see [3, 11, 14, 18, 80, 98, 109], making them more powerful than the 1-WL; see [75] for a survey and see Appendix A for a in-depth discussion. For clarity, throughout this work, we will use the term GNNs to denote the class of message-passing architectures limited by the 1-WL algorithm, where the class of distinguishable graphs is well understood [5].
32
+
33
+ Data augmentation, generalization and subgraph-based inductive biases. There exist few works proposing data augmentation for GNNs for graph classification. Kong et al. [59] introduces a simple feature perturbation framework to achieve this, while Rong et al. [85], Feng et al. [34] focus on vertex-level tasks. Garg et al. [38] study the generalization abilities of GNNs showing bounds on the Rademacher complexity, while Liao et al. [62] offer a refined analysis within the PAC-Bayes framework. Recently, Bouritsas et al. [18] proposed to use subgraph counts as vertex and edge features in GNNs.
34
+
35
+ ![](images/dca081efcdea705c93b7b98b692adfc66ee28516f8f4a81b121c6c24cf78495d.jpg)
36
+ Figure 1: A graph $G$ and its deck ${ \mathcal { D } } _ { n - 1 } ( G )$ , faded out vertices are not part of each card in the deck.
37
+
38
+ Although the authors show an increase in expressiveness, the extent, e.g., which graph classes their model can distinguish, is still mostly unclear. Moreover, Yehudai et al. [107] investigate GNNs’ ability to generalize to larger graphs. Concurrently, Bevilacqua et al. [12] show how subgraph densities can be used to build size-invariant graph representations. However, the performance of such models in in-distribution tasks, their expressiveness, and scalability remain unclear. Finally, Yuan et al. [111] show how GNNs’ decisions can be explained by (often large) subgraphs, further motivating our use of graph reconstruction as a powerful inductive bias for GRL.
39
+
40
+ Reconstruction conjecture. The reconstruction conjecture is a longstanding open problem in graph theory, which has been solved in many particular settings. Such results come in two flavors. Either proving that graphs from a specific class are reconstructible or determining which graph functions are reconstructible. Known results of the former are, for instance, that regular graphs, disconnected graphs, and trees are reconstructible [16, 53]. In particular, we highlight that outerplanar graphs, which account for most molecule graphs, are known to be reconstructible [41]. For a comprehensive review of graph reconstruction results, see Bondy [16].
41
+
42
+ # 2 Preliminaries
43
+
44
+ Here, we introduce notation and give an overview of the main results in graph reconstruction theory [16, 43], including the reconstruction conjecture [96], which forms the basis of the models in this work.
45
+
46
+ Notation and definitions. As usual, let $[ n ] = \left\{ 1 , \dots , n \right\} \subset \mathbb { N }$ for $n \geq 1$ , and let $\mathbb { f } \dots \mathbb { Y }$ denote a multiset. In an abuse of notation, for a set $X$ with $x$ in $X$ , we denote by $X - x$ the set $X { \bar { \backslash } } \left\{ x \right\}$ . We also assume elementary definitions from graph theory, such as graphs, directed graphs, vertices, edges, neighbors, trees, isomorphism, et cetera; see Appendix B. The vertex and the edge set of a graph $G$ are denoted by $V ( G )$ and $E ( G )$ , respectively. The size of a graph $G$ is equal to its number of vertices. Unless indicated otherwise, we use $n : = | V ( G ) |$ . If not otherwise stated, we assume that vertices and edges are annoted with attributes, i.e., real-valued vectors.
47
+
48
+ We denote the set of all finite and simple graphs by $\mathcal { G }$ . The subset of $\mathcal { G }$ without edge attributes (or edge directions) is denoted ${ \mathfrak { G } } \subset { \mathcal { G } }$ . We write $G \simeq H$ if the graphs $G$ and $H$ are isomorphic. Further, we denote the isomorphism type, i.e., the equivalence class of the isomorphism relation, of a graph $G$ a s ${ \mathcal { T } } ( G )$ . Let $S \subseteq V ( G )$ , then $G [ S ]$ is the induced subgraph with edge set $E ( G ) [ S ] = \{ S ^ { \tilde { 2 } } \cap ^ { } E ( G ) \}$ We will refer to induced subgraphs simply as subgraphs in this work.
49
+
50
+ Let $\Re$ be a family of graph representations, such that for $d \ge 1$ , $r$ in $\Re$ , $r \colon \mathcal { G } \mathbb { R } ^ { d }$ , assigns a $d$ -dimensional representation vector $r ( G )$ for a graph $G$ in $\mathcal { G }$ . We say $\Re$ can distinguish a graph $G$ if there exists $r$ in $\Re$ that assigns a unique representation to the isomorphism type of $G$ , i.e., $r ( G ) = r ( H )$ if and only if $G \simeq H$ . Further, we say $\Re$ distinguishes a pair of non-isomorphic graphs $G$ and $H$ if there exists some $r$ in $\Re$ such that $r ( G ) \neq r ( H )$ . Moreover, we write $\Re _ { 1 } \preceq \Re _ { 2 }$ if $\Re _ { 2 }$ distinguishes between all graphs $\Re _ { 1 }$ does, and $\Re _ { 1 } \equiv \Re _ { 2 }$ if both directions hold. The corresponding strict relation is denoted by $\prec$ . Finally, we say $\Re$ is a most-expressive representation of a class of graphs if it distinguishes all non-isomorphic graphs in that class.
51
+
52
+ Graph reconstruction. Intuitively, the reconstruction conjecture states that an undirected edgeunattributed graph can be fully recovered up to its isomorphism type given the multiset of its vertexdeleted subgraphs’ isomorphism types. This multiset of subgraphs is usually referred to as the deck of the graph, see Figure 1 for an illustration. Formally, for a graph $G$ , we define its deck as ${ \mathcal { D } } _ { n - 1 } ( G ) = \left\{ \left\{ { G } [ V ( G ) - v ] ) \colon v \in V ( G ) \right\} \right\}$ . We often call an element in ${ \mathcal { D } } _ { n - 1 } ( G )$ a card. We define the graph reconstruction problem as follows.
53
+
54
+ Definition 1. Let $G$ and $H$ be graphs, then $H$ is a reconstruction of $G$ if $H$ and $G$ have the same deck, denoted $H \sim G$ . $A$ graph $G$ is reconstructible if every reconstruction of $G$ is isomorphic to $G _ { : }$ , i.e., $H \sim G$ implies $H \simeq G$ .
55
+
56
+ Similarly, we define function reconstruction, which relates functions that map two graphs to the same value if they have the same deck.
57
+
58
+ Definition 2. Let $f \colon { \mathcal { G } } { \mathcal { V } }$ be a function, then $f$ is reconstructible if $f ( G ) = f ( H )$ for all graphs in $\{ ( H , G ) \in \mathcal { G } ^ { 2 } : H \sim G \}$ , i.e., $G \sim H$ implies ${ \dot { f } } ( G ) = f ( H )$ .
59
+
60
+ We can now state the reconstruction conjecture, which in short says that every $G$ in $\mathfrak { G }$ with $| V | \geq 3$ is reconstructible.
61
+
62
+ Conjecture 1 (Kelly [52], Ulam [96]). Let $H$ and $G$ in $\mathfrak { G }$ be two finite, undirected, simple graphs with at least three vertices. If $H$ is a reconstruction of $G$ , then $H$ and $G$ are isomorphic.
63
+
64
+ We note here that the reconstruction conjecture does not hold for directed graphs, hypergraphs, and infinite graphs [16, 92, 93]. In particular, edge directions can be seen as edge attributes. Thus, the reconstruction conjecture does not hold for the class $\mathcal { G }$ . In contrast, the conjecture has been proved for practical-relevant graph classes, such as disconnected graphs, regular graphs, trees, and outerplanar graphs [16]. Further, computational searches show that graphs with up to eleven vertices are reconstructible [68]. Finally, many graph properties are known to be reconstructible, such as every size subgraph count, degree sequence, number of edges, and the characteristic polynomial [16].
65
+
66
+ Graph $k$ -reconstruction. Kelly et al. [53] generalized graph reconstruction, considering the multiset of subgraphs of size $k$ instead of $n - 1$ , which we denote ${ \mathcal { D } } _ { k } ( G ) = \{ \{ { \mathcal { T } } ( H ) \colon H \in S ^ { ( k ) } ( G ) \} \}$ , where $\mathcal { S } ^ { ( k ) }$ is the set of all $\binom { n } { k }$ $k$ -size subsets of $V$ . We often call an element in $\mathcal { D } _ { k } ( G )$ a $k$ -card. From the $k$ -deck definition, it is easy to extend the concept of graph and function reconstruction, cf. Definitions 1 and 2, to graph and function $k$ -reconstruction.
67
+
68
+ Definition 3. Let $G$ and $H$ be graphs, then $H$ is a $k$ -reconstruction of $G$ if $H$ and $G$ have the same $k$ -deck, denoted $H \sim _ { k } G .$ . A graph $G$ is $k$ -reconstructible if every $k$ -reconstruction of $G$ is isomorphic to $G$ , i.e., $H \sim _ { k } G$ implies $H \simeq G$ .
69
+
70
+ Accordingly, we define $k$ -function reconstruction as follows.
71
+
72
+ Definition 4. Let $f \colon { \mathcal { G } } { \mathcal { V } }$ be a function, then $f$ is $k$ -reconstructible if $f ( G ) = f ( H )$ for all graphs in $\{ ( H , G ) \in \mathcal { G } ^ { 2 } : H \sim _ { k } G \}$ , i.e., $G \sim _ { k } H$ implies $f ( G ) = f ( H )$ .
73
+
74
+ Results for $k$ -reconstruction usually state the least $k$ as a function of $n$ such that all graphs $G$ in $\mathcal { G }$ (or some subset) are $k$ -reconstructible [84]. There exist extensive partial results in this direction, mostly describing $k$ -reconstructibility (as a function of $n$ ) for a particular family of graphs, such as trees, disconnected graphs, complete multipartite graphs, and paths, see [84, 60]. More concretely, Nydl \` [83], Spinoza and West [91] showed graphs with $2 k$ vertices that are not $k$ -reconstructible. In practice, these results imply that for some fixed $k$ there will be graphs with not many more vertices than $k$ that are not $k$ -reconstructible. Further, $k$ -reconstructible graph functions such as degree sequence and connectedness have been studied in [65, 91] depending on the size of $k$ . In Appendix C, we discuss further such results.
75
+
76
+ # 3 Reconstruction Neural Networks
77
+
78
+ Building on the previous section, we propose two neural architectures based on graph $k$ -reconstruction and graph reconstruction. First, we look at $k$ -Reconstruction Neural Networks, the most natural way to use graph $k$ -reconstruction. Secondly, we look at Full Reconstruction Neural Networks, where we leverage the Reconstruction Conjecture to build a most-expressive representation for the class of graphs of bounded size and unattributed edges.
79
+
80
+ $k$ -Reconstruction Neural Networks. Intuitively, the key idea of $k$ -Reconstruction Neural Networks is that of learning a joint representation based on subgraphs induced by $k$ vertices. Formally, let $f _ { \mathbf { W } } \colon \cup _ { m = 1 } ^ { \infty } \mathbb { R } ^ { m \times \breve { d } } \overline { { \mathbb { R } } } ^ { t }$ be a (row-wise) permutation-invariant function and $\mathcal { G } _ { k } = \{ G \in \mathcal { G } \colon | V ( \dot { G } ) | =$ $k \}$ be the set of graphs with exactly $k$ vertices. Further, let $h ^ { ( k ) }$ : $\mathcal { G } _ { k } \mathbb { R } ^ { 1 \times d }$ be a graph representation function such that two graphs $G$ and $H$ on $k$ vertices are mapped to the same vectorial representation if and only if they are isomorphic, i.e., $h ^ { ( k ) } ( G ) = h ^ { ( k ) } ( H ) \ \stackrel { \quad \cdot \cdot } { \longleftrightarrow } \ G \simeq H$ for all $G$ and $H$ in $\mathcal { G } _ { k }$ . We define $k$ -Reconstruction Neural Networks over $\mathcal { G }$ as a function with parameters $\mathbf { W }$ in the form
81
+
82
+ $$
83
+ r _ { \mathbf { W } } ^ { ( k ) } ( G ) = f _ { \mathbf { W } } \Big ( \mathrm { C o n c A T } \big ( \{ h ^ { ( k ) } ( G [ S ] ) \colon S \in \mathcal { S } ^ { ( k ) } \} \big ) \Big ) ,
84
+ $$
85
+
86
+ where $\mathcal { S } ^ { ( k ) }$ is the set of all $k$ -size subsets of $V ( G )$ for some $3 \leq k \leq n$ , and CONCAT denotes row-wise concatenation of a multi-set of vectors in some arbitrary order. Note that $h ^ { ( k ) }$ might also be a function with learnable parameters. In that case, we require it to be most-expressive for $\mathcal { G } _ { k }$ . The following results characterize the expressive power of the above architecture.
87
+
88
+ Proposition 1. Let fW be a universal approximator of multisets [112, 100, 79]. Then, $r _ { \mathbf { W } } ^ { ( k ) }$ can approximate a function if and only if the function is -reconstructible.
89
+
90
+ Moreover, we can observe the following.
91
+
92
+ Observation 1 (Nydl [84], Kostochka and West [60]) \` . For any graph $G$ in $\mathcal { G }$ , its $k$ -deck $\mathcal { D } _ { k } ( G )$ determines its $\left( k - 1 \right)$ -deck ${ \mathcal { D } } _ { k - 1 } ( G )$ .
93
+
94
+ From Observation 1, we can derive a hierarchy in the expressive power of $k$ -Reconstruction Neural Networks with respect to the subgraph size $k$ . That is, $r _ { \mathbf { W } } ^ { ( 3 ) } \preceq r _ { \mathbf { W } } ^ { ( 4 ) } \preceq \cdots \preceq r _ { \mathbf { W } } ^ { ( n - 2 ) } \preceq r _ { \mathbf { W } } ^ { ( n - 1 ) }$
95
+
96
+ In Appendix D, we show how many existing architectures have their expressive power limited by $k$ -reconstruction. We also refer to Appendix $\mathrm { D }$ for the proofs, a discussion on the model’s computational complexity, approximation methods, and relation to existing work.
97
+
98
+ Full Reconstruction Neural Networks. Here, we propose a recursive scheme based on the reconstruction conjecture to build a most-expressive representation for graphs. Intuitively, Full Reconstruction Neural Networks recursively compute subgraph representations based on smaller subgraph representations. Formally, let ${ \mathfrak { G } } _ { \leq n ^ { * } } ^ { \dagger } : = \{ G \in { \mathfrak { G } } \colon | V ( G ) | \leq n ^ { * } \}$ be the class of undirected graphs with unattributed edges and maximum size $n ^ { * }$ . Further, let $f _ { \mathbf { W } } ^ { ( k ) } \colon \cup _ { m = 1 } ^ { \infty } \mathbb { R } ^ { m \times d } \mathbb { R } ^ { t }$ be a (row-wise) permutation invariant function and let $h _ { \{ i , j \} }$ be a most-expressive representation of the two-vertex subgraph induced by vertices $i$ and $j$ . We can now define the representation $r ( G [ V ( G ) ] )$ of a graph $G$ in ${ \mathfrak { G } } _ { \leq n ^ { * } } ^ { \dagger }$ in a recursive fashion as
99
+
100
+ $$
101
+ r ( G [ S ] ) = \left\{ \begin{array} { l l } { f _ { \mathbf { W } } ^ { ( | S | ) } \left( \mathbf { C o n c a r } ( \left\{ \left\{ r ( G [ S - v ] ) \colon v \in S \right\} \right\} ) \right) , \mathrm { ~ i f ~ } 3 \leq | S | \leq n } \\ { h _ { S } ( G [ S ] ) , \quad \quad \quad \quad \quad \quad \mathrm { i f ~ } | S | = 2 . } \end{array} \right.
102
+ $$
103
+
104
+ Again, CONCAT is row-wise concatenation in some arbitrary order. Note that in practice, it is easier to build the subgraph representations in a bottom-up fashion. First, use two-vertex subgraph representations to compute all three-vertex subgraph representations. Then, perform this inductively until we arrive at a single whole-graph representation. In Appendix E, we prove the expressive power of Full Reconstruction Neural Networks, i.e., we show how if the reconstruction conjecture holds, it is a most-expressive representation of undirected edge-unattributed graphs. Finally, we show its quadratic number of parameters, exponential computational complexity, and relation to existing work.
105
+
106
+ # 4 Reconstruction Graph Neural Networks
107
+
108
+ Although Full Reconstruction Neural Networks provide a most-expressive representation for undirected, unattributed-edge graphs, they are impractical due to their computational cost. Similarly, $k$ -Reconstruction Neural Networks are not scalable since increasing their expressive power requires computing most-expressive representations of larger $k$ -size subgraphs. Hence, to circumvent the computational cost, we replace the most-expressive representations of subgraphs from $k$ -Reconstruction Neural Networks with GNN representations, resulting in what we name $k$ -Reconstruction GNNs. This change allows for scaling the model to larger subgraph sizes, such as $n - 1 , n - 2 , . . .$ , et cetera.
109
+
110
+ Since, in the general case, graph reconstruction assumes most-expressive representations of subgraphs, it cannot capture $k$ -Reconstruction GNNs’ expressive power directly. Hence, we provide a theoretical characterization of the expressive power of $k$ -Reconstruction GNNs by coupling graph reconstruction and the GNN expressive power characterization based on the 1-WL algorithm. Nevertheless, in Appendix F.2, we devise conditions under which $k$ -Reconstruction GNNs have the same power as $k$ -Reconstruction Neural Networks. Finally, we show how graph reconstruction can act as a (provably) powerful inductive bias for invariances to vertex removals, which boosts the performance of GNNs even in tasks where all graphs are already distinguishable by them (see Appendix G). We refer to Appendix F for a discussion on the model’s relation to existing work.
111
+
112
+ Formally, let $f _ { \mathbf { W } } \colon \cup _ { m = 1 } ^ { \infty } \mathbb { R } ^ { m \times d } \to \mathbb { R } ^ { t }$ be a (row-wise) permutation invariant function and $h _ { \mathbf { W } } ^ { \mathrm { G N N } } \colon \mathcal { G } \to$ $\mathbb { R } ^ { 1 \times d }$ a GNN representation. Then, for $3 \leq k < | V ( G ) |$ , a $k$ -Reconstruction GNN takes the form
113
+
114
+ $$
115
+ r _ { \mathbf { W } } ^ { ( k , \mathrm { G N N } ) } ( G ) = f _ { \mathbf { W } _ { 1 } } \Big ( \mathrm { C O N C A T } \big ( \{ \{ h _ { \mathbf { W } _ { 2 } } ^ { \mathrm { G N N } } ( G [ S ] ) : S \in \mathcal { S } ^ { ( k ) } \} \} \big ) \Big ) ,
116
+ $$
117
+
118
+ with parameters $\mathbf { W } = \{ \mathbf { W } _ { 1 } , \mathbf { W } _ { 2 } \}$ , where $\mathcal { S } ^ { ( k ) }$ is the set of all $k$ -size subsets of $V ( G )$ , and CONCAT is row-wise concatenation in some arbitrary order.
119
+
120
+ Approximating r(k,GNN)W . By design, k-Reconstruction GNNs require computing GNN representations for all -vertex subgraphs, which might not be feasible for large graphs or datasets. To address this, we discuss a direction to circumvent computing all subgraphs, i.e., approximating $r _ { \mathbf { W } } ^ { ( k , \mathrm { G N N } ) }$ by sampling. One possible choice for $f _ { \mathbf { W } }$ is Deep Sets [112], which we use for the experiments in Section 5, where the representation is a sum decomposition taking the form $r _ { \mathbf { W } } ^ { ( k , \mathrm { G N N } ) } ( G ) =$ $\begin{array} { r } { \rho _ { \mathbf { W } _ { 1 } } \bigg ( \sum _ { S \in { \cal S } ^ { ( k ) } } \phi _ { \mathbf { W } _ { 2 } } \Big ( h _ { \mathbf { W } _ { 3 } } ^ { \mathrm { G N N } } ( G [ S ] ) \Big ) \bigg ) } \end{array}$ , where $\rho _ { \mathbf { W } _ { 1 } }$ and $\phi \mathbf { w } _ { 2 }$ are permutation sensitive functions, such as feed-forward networks. We can learn the $k$ -Reconstruction GNN model over a training dataset ${ \mathcal D } ^ { ( \mathrm { t r } ) } : = \{ ( G _ { i } , y _ { i } ) \} _ { i = 1 } ^ { N ^ { ( \mathrm { t r } ) } }$ and a loss function $l$ by minimizing the empirical risk
121
+
122
+ $$
123
+ \widehat { \mathcal { R } } _ { k } ( \mathcal { D } ^ { ( \mathrm { t r } ) } ; \mathbf { W } _ { 1 } , \mathbf { W } _ { 2 } , \mathbf { W } _ { 3 } ) = \frac { 1 } { N ^ { \mathrm { t r } } } \sum _ { i = 1 } ^ { N ^ { \mathrm { t r } } } l \big ( r _ { \mathbf { W } } ^ { ( k , \mathrm { G N N } ) } ( G _ { i } ) , y _ { i } \big ) .
124
+ $$
125
+
126
+ Equation (1) is impractical for all but the smallest graphs, since $r _ { \mathbf { W } } ^ { ( k , \mathrm { G N N } ) }$ s a sum overusing a samall k-vertex induced subgraphs S(k) of G. Hence, we approximate r(k,GW $r _ { \mathbf { W } } ^ { ( k , \mathrm { G N N } ) }$ S (k)B ${ \mathcal S } _ { B } ^ { ( k ) } ~ \subset ~ { \mathcal S } ^ { ( k ) }$ at every gradient step, i.e.. Due to non-linearities in $\widehat { r } _ { \mathbf { W } } ^ { ( k , \mathrm { G N N } ) } ( G ) \ =$ $\begin{array} { r } { \rho _ { \mathbf { W } _ { 1 } } \Big ( | S ^ { ( k ) } | / | S _ { B } ^ { ( k ) } | \sum _ { S \in S _ { B } ^ { ( k ) } } \phi _ { \mathbf { W } _ { 2 } } \big ( h _ { \mathbf { W } _ { 3 } } ^ { \mathrm { ( G N N ) } } ( G [ S ] ) \big ) \Big ) } \end{array}$ $\rho _ { \mathbf { W } _ { 1 } }$ $l$ ging $\widehat { r } _ { \mathbf { W } } ^ { ( k , \mathrm { G N N } ) }$ B into Equatio (1) does not provide us with an unbiased estimate of $\widehat { \mathcal { R } } _ { k }$ . However, if i. $l ( \rho _ { \mathbf { W } _ { 1 } } ( a ) , y )$ $a$ per upper bound of our loss,. In practice, many models e., 1/N tr PN tri=1 l $\begin{array} { r } { 1 / N ^ { \mathrm { t r } } \sum _ { i = 1 } ^ { N ^ { \mathrm { t r } } } l \big ( r _ { \mathbf { W } } ^ { ( k , \mathrm { G N N } ) } ( G _ { i } ) , y _ { i } \big ) \leq 1 / N ^ { \mathrm { t r } } \sum _ { i = 1 } ^ { N ^ { \mathrm { t r } } } l \big ( \widehat { r } _ { \mathbf { W } } ^ { ( k , \mathrm { G N N } ) } ( G _ { i } ) , y _ { i } \big ) . } \end{array}$ tr1 lr (k,GNN)W (Gi), yi brely on this approximation and provide scalable and reliable training procedures, cf. [48, 79, 80, 112].
127
+
128
+ # 4.1 Expressive power
129
+
130
+ Now, we analyze the expressive power of $k$ -Reconstruction GNNs. It is clear that $k$ -Reconstruction GNNs $\preceq k$ -Reconstruction Neural Networks, however the relationship between $k$ -Reconstruction GNNs and GNNs is not that straightforward. At first, one expects that there exists a well-defined hierarchy—such as the one in $k$ -Reconstruction Neural Networks (see Observation 1)—between GNNs, $( n - 1 )$ -Reconstruction GNNs, $( n - 2 )$ -Reconstruction GNNs, and so on. However, there is no such hierarchy, as we see next.
131
+
132
+ Are GNNs more expressive than $k$ -Reconstruction GNNs? It is well-known that GNNs cannot distinguish regular graphs [5, 78]. By leveraging the fact that regular graphs are reconstructible [53], we show that cycles and circular skip link (CSL) graphs—two classes of regular graphs—can indeed be distinguished by $k$ -Reconstruction GNNs, implying that $k$ -Reconstruction GNNs are not less expressive than GNNs. We start by showing that $k$ -Reconstruction GNNs can distinguish the class of cycle graphs.
133
+
134
+ Theorem 1 ( $k$ -Reconstruction GNNs can distinguish cycles). Let $G \in \mathfrak { G }$ be a cycle graph with $n$ vertices and $k : = n - \ell .$ . An $( n - \ell )$ -Reconstruction GNN assigns a unique representation to $G$ if $\begin{array} { r } { i ) \ell < ( 1 + o ( 1 ) ) \left( \frac { 2 \log n } { \log \log n } \right) ^ { 1 / 2 } } \end{array}$ 2 and ii) $\begin{array} { r } { \begin{array} { r } { n \geq ( \ell - \log \ell + 1 ) \biggl ( \frac { e + e \log \ell + e + 1 } { ( \ell - 1 ) \log \ell - 1 } \biggr ) + 1 h o l d . } \end{array} } \end{array}$
135
+
136
+ The following results shows that $k$ -Reconstruction GNNs can distinguish the class of CSL graphs.
137
+
138
+ Theorem 2 $k$ -Reconstruction GNNs can distinguish CSL graphs). Let $G , H \in \mathfrak { S }$ be two nonisomorphic circular skip link (CSL) graphs (a class of 4-regular graphs, cf. [23, 80]). Then, $( n - 1 )$ Reconstruction GNNs can distinguish $G$ and $H$ .
139
+
140
+ Hence, if the conditions in Theorem 1 hold, GNNs $\not \simeq ( n - \ell )$ -Reconstruction GNNs. Figure 2 (cf. Appendix F) depicts how $k$ -Reconstruction GNNs can distinguish a graph that GNNs cannot. The process essentially breaks the local symmetries that make GNNs struggle by removing one (or a few) vertices from the graph. By doing so, we arrive at distinguishable subgraphs. Since we can reconstruct the original graph with its unique subgraph representations, we can identify it. See Appendix F for the complete proofs of Theorems 1 and 2.
141
+
142
+ Are GNNs less expressive than $k$ -Reconstruction GNNs? We now show that GNNs can distinguish graphs that $k$ -Reconstruction GNNs with small $k$ cannot. We start with Proposition 2 stating that there exist some graphs that GNNs can distinguish which $k$ -Reconstruction GNNs with small $k$ cannot.
143
+
144
+ Proposition 2. $G N N s \Zt k$ -Reconstruction GNNs for $k \leq \lceil n / 2 \rceil$ .
145
+
146
+ On the other hand, the analysis is more interesting for larger subgraph sizes, e.g., $n - 1$ , where there are no known examples of (undirected, edge-unattributed) non-reconstructible graphs. There are graphs distinguishable by GNNs with at least one subgraph not distinguishable by them; see Appendix F. However, the analysis is whether the multiset of all subgraphs’ representations can distinguish the original graph. Since we could not find any counter-examples, we conjecture that every graph distinguishable by a GNN is also distinguishable by a $k$ -Reconstruction GNN with $k = n - 1$ or possibly more generally with any $k$ close enough to $n$ . In Appendix F, we state and discuss the conjecture, which we name WL reconstruction conjecture. If true, the conjecture implies GNNs $\prec$ $( n - 1 )$ -Reconstruction GNNs. Moreover, if we use the original GNN representation together with $k$ -Reconstruction GNNs, Theorems 1 and 2 imply that the resulting model is strictly more powerful than the original GNN.
147
+
148
+ # Are $k$ -Reconstruction GNNs less expressive than higher-order ( $\kappa$ -WL) GNNs?
149
+
150
+ Recently a line of work, e.g., [6, 67, 76], explored higher-order GNNs aligning with the $\kappa$ -WL hierarchy. Such architectures have, in principle, the same power as the $\kappa$ -WL algorithm in distinguishing nonisomorphic graphs. Hence, one might wonder how $k$ -Reconstruction GNNs stack up to $\kappa$ -WL-based algorithms. The following result shows that pairs of non-isomorphic graphs exist that a $( n - 2 )$ - Reconstruction GNN can distinguish but the 2-WL cannot.
151
+
152
+ Proposition 3. Let 2-GNNs be neural architectures with the same expressiveness as the 2-WL algorithm.
153
+ Then, $( n - 2 )$ -Reconstruction $G N N \ne 2 \ – G N N s \equiv 2 \ – W L .$ .
154
+
155
+ As a result of Proposition 3, using a $( n - 2 )$ -Reconstruction GNN representation together with a 2-GNN increases the original 2-GNN’s expressive power.
156
+
157
+ # 4.2 Reconstruction as a powerful extra invariance for general graphs
158
+
159
+ An essential feature of modern machine learning models is capturing invariances of the problem of interest [63]. It reduces degrees of freedom while allowing for better generalization [13, 63]. GRL is predicated on invariance to vertex permutations, i.e., assigning the same representation to isomorphic graphs. But are there other invariances that could improve the generalization error?
160
+
161
+ $k$ -reconstruction is an extra invariance. Let $P ( G , Y )$ be the joint probability of observing a graph $G$ with label $Y$ . Any $k$ -reconstruction-based model, such as $k$ -Reconstruction Neural Networks and $k$ -Reconstruction GNNs, by definition assumes $P ( G , Y )$ to be invariant to the $k$ -deck, i.e., $P ( G , Y ) = P ( H , Y )$ if ${ \mathcal { D } } _ { k } ( G ) { \dot { } } = { \mathcal { D } } _ { k } ( H )$ . Hence, our neural architectures for $k$ -Reconstruction Neural Networks and $k$ -Reconstruction GNNs directly define this extra invariance beyond permutation invariance. How we do know it is an extra invariance and not a consequence of permutation invariance? It does not hold on directed graphs [93], where permutation invariance still holds.
162
+
163
+ Hereditary property variance reduction. We now show that the invariance imposed by $k$ - reconstruction helps in tasks based on hereditary properties [17]. A graph property $\mu ( G )$ is called hereditary if it is invariant to vertex removals, i.e. $\mu ( G ) = \mu ( G [ V ( G ) - v ] )$ for every $v \in V ( G )$ and $G \in { \mathcal { G } }$ . By induction the property is invariant to every size subgraph, i.e., ${ \dot { \mu } } ( G ) = \mu ( G [ S ] )$ for every $S \in { \mathcal { S } } ^ { ( k ) } , k \in [ n ]$ where $\mathcal { S } ^ { ( k ) }$ is the set of all $k$ -size subsets of $V ( G )$ . Here, the property is invariant to any given subgraph. For example, every subgraph of a planar graph is also planar, every subgraph of an acyclic graph is also acyclic, any subgraph of a $j$ -colorable graph is also $j$ -colorable. A more practically interesting (weaker) invariance would be invariance to a few vertex removals. Next we define $\delta$ -hereditary properties (a special case of a $\preceq$ -hereditary property). In short, a property is $\delta$ -hereditary if it is a hereditary property for graphs with more than $\delta$ vertices.
164
+
165
+ Definition 5 $\delta$ -hereditary property). $A$ graph property $\mu \colon \mathcal G \ \ \mathcal { y }$ is said to be $\delta$ -hereditary $i f$ $\mu ( G ) = \mu ( G [ V ( G ) - v ] )$ , $\forall v \in V ( G ) , G \in \{ H \in { \mathcal { G } } : | V ( H ) | > \delta \}$ . That is, $\mu$ is uniform in $G$ and all subgraphs of $G$ with more than $\delta$ vertices.
166
+
167
+ Consider the task of predicting $Y | G : = \mu ( G )$ . Theorem 3 shows that $k$ -Reconstruction GNNs is an invariance that reduces the variance of the empirical risk associated with $\delta$ -hereditary property tasks. See Appendix $\mathrm { F }$ for the proof.
168
+
169
+ Theorem 3 ( $k$ -Reconstruction GNNs for variance reduction of $\delta$ -hereditary tasks). Let $P ( G , Y )$ be a $\delta$ -hereditary distribution, i.e., $Y : = \mu ( G )$ where $\mu$ is a $\delta$ -hereditary property. Further, let $P ( G , Y ) = 0$ for all $G \in { \mathcal { G } }$ with $| V ( G ) | \ge \delta + \ell , \ell > 0$ . Then, for $k$ -Reconstruction GNNs taking the form $\begin{array} { r } { \rho _ { \mathbf { W } _ { 1 } } \biggl ( 1 / | \mathcal { S } ^ { ( k ) } | \sum _ { S \in \mathcal { S } ^ { ( k ) } } \phi _ { \mathbf { W } _ { 2 } } \Bigl ( h _ { \mathbf { W } _ { 3 } } ^ { G N N } ( G [ S ] ) \Bigr ) \biggr ) } \end{array}$ , i $f l ( \rho \mathbf { w } _ { 1 } ( a ) , y )$ is convex in $a$ , we have
170
+
171
+ $$
172
+ \begin{array} { r } { V a r [ \widehat { \mathcal { R } } _ { k } ] \leq V a r [ \widehat { \mathcal { R } } _ { G N N } ] , } \end{array}
173
+ $$
174
+
175
+ where $\widehat { \mathcal { R } } _ { k }$ is the empirical risk of $k$ -Reconstruction GNNs with $k : = n - \ell$ (cf. Equation (1)) and $\widehat { \mathcal { R } } _ { G N N }$ is the empirical risk of GNNs.
176
+
177
+ # 5 Experimental Evaluation
178
+
179
+ In this section, we investigate the benefits of $k$ -Reconstruction GNNs against GNN baselines on both synthetic and real-world tasks. Concretely, we address the following questions:
180
+
181
+ Q1. Does the increase in expressive power from reconstruction (cf. Section 4.1) make $k$ -Reconstruction GNNs solve graph property tasks not originally solvable by GNNs?
182
+
183
+ Q2. Can reconstruction boost the original GNNs performance on real-world tasks? If so, why
184
+
185
+ Q3. What is the influence of the subgraph size in both graph property and real-world tasks?
186
+
187
+ Synthetic graph property datasets. For Q1 and Q3, we chose the synthetic graph property tasks in Table 1, for which GNNs are provably incapable to solve due to their limited expressive power [38, 81]. The tasks are CSL [32], where we classify CSL graphs, the cycle detection tasks 4 CYCLES, 6 CYCLES and 8 CYCLES [98] and the multi-task regression from Corso et al. [28], where we want to determine whether a graph is connected, its diameter, and its spectral radius. See Appendix H for datasets statistics.
188
+
189
+ Real-world datasets. To address Q2 and Q3, we evaluated $k$ -Reconstruction GNNs on a diverse set of large-scale, standard benchmark instances [49, 74]. Specifically, we used the ZINC (10K) [32], ALCHEMY (10K) [23], OGBG-MOLFREESOLV, OGBG-MOLESOL, and OGBG-MOLLIPO [49] regression datasets. For the case of graph classification, we used OGBG-MOLHIV, OGBG-MOLPCBA, OGBG-TOX21, and OGBG-TOXCAST [49]. See Appendix $_ \mathrm { H }$ for datasets statistics.
190
+
191
+ Neural architectures. We used the GIN [106], GCN [56], and the PNA [28] architectures as GNN baselines. We always replicated the exact architectures from the original paper, building on the respective PyTorch Geometric implementation [35]. For the OGBG regression datasets, we noticed how using a jumping knowledge layer yields better validation and test results for GIN and GCN. Thus we made this small change. For each of these three architectures, we implemented $k$ -Reconstruction GNNs for $k$ in $\{ n - 1 , \bar { n } - 2 , n - 3 , \lceil n / 2 \rceil \}$ using a Deep Sets function [112] over the exact same original GNN architecture. For more details, see Appendix G.
192
+
193
+ Experimental setup. To establish fair comparisons, we retain all hyperparameters and training procedures from the original GNNs to train the corresponding $k$ -Reconstruction GNNs. Tables 1 and 2 and Table 6 in Appendix I present results with the same number of runs as previous work [28, 32, 49, 77, 98], i.e., five for all datasets execpt the OGBG datasets, where we use ten runs. For more details, such as the number of subgraphs sampled for each $k$ -Reconstruction GNN and each dataset, see Appendix G.
194
+
195
+ Non-GNN baselines. For the graph property tasks, original work used vertex identifiers or Laplacian embeddings to make GNNs solve them. This trick is effective for the tasks but violates an important premise of graph representations, invariance to vertex permutations. To illustrate this line of work, we compare against Positional GIN, which uses Laplacian embeddings [32] for the CSL task and vertex identifiers for the others [98, 28]. To compare against other methods that like $k$ -Reconstruction GNNs are invariant to vertex permutations and increase the expressive power of GNNs, we compare against Ring-GNNs [27] and (3-WL) PPGNs [66]. For real-world tasks, Table 6 in Appendix I shows the results from GRL alternatives that incorporate higher-order representations in different ways, LRP [27], GSN [18], $\delta$ -2-LGNN [77], and SMP [98].
196
+
197
+ All results are fully reproducible from the source and are available at https://github.com/ PurdueMINDS/reconstruction-gnns.
198
+
199
+ # Results and discussion.
200
+
201
+ A1 (Graph property tasks). Table 1 confirms Theorem 2, where the increase in expressive power from reconstruction allows $k$ -Reconstruction GNNs to distinguish CSL graphs, a task that GNNs cannot solve. Here, $k$ -Reconstruction GNNs boost the accuracy of standard GNNs between $1 0 \times$ and $2 0 \times$ Theorem 2 only guarantees GNN expressiveness boosting for $( n - 1 )$ -Reconstruction, but our empirical results also show benefits for $k$ -Reconstruction with $k \leq n - 2$ . Table 1 also confirms Theorem 1, where $k$ -Reconstruction GNNs provide significant accuracy boosts on all cycle detection tasks (4 CYCLES, 6 CYCLES and 8 CYCLES). See Appendix J.1, for a detailed discussion on results for CONNECTIVITY, DIAMETER, and SPECTRAL RADIUS, which also show boostings.
202
+
203
+ Table 1: Synthetic graph property tasks. We highlight in green $k$ -Reconstruction GNNs boosting the original GNN architecture. †: Std. not reported in original work. +: Laplacian embeddings used as positional features. ∗: Vertex identifiers used as positional features.
204
+
205
+ <table><tr><td></td><td>CSL</td><td>4 CYCLES</td><td>6 CYCLES</td><td>CONNECTIVITY</td><td colspan="4">Multi-task</td><td rowspan="2">Invariant to vertex permutations?</td></tr><tr><td></td><td></td><td>(Accuracy %%)↑</td><td>(Accuracy % %) ↑</td><td>(Accuracy %)↑</td><td>8 CYCLES (Accuracy %)↑</td><td>(logMSE)↓</td><td>DIAMETER (logMSE)↓</td><td>SPECTRAL RADIUS (logMSE)↓</td></tr><tr><td>(n-1)</td><td>GIN (orig.)</td><td>4.66 ± 4.00</td><td>93.0t</td><td>92.7t</td><td>92.5t</td><td>-3.419 ± 0.320</td><td>0.588 ± 0.354</td><td>-2.130 ± 1.396</td><td></td></tr><tr><td></td><td></td><td>88.66 ± 22.66</td><td>95.17 ± 4.91</td><td>97.35 ± 0.74</td><td>94.69 ± 2.34</td><td>-3.575 ± 0.395</td><td>-0.195 ± 0.714</td><td>-2.732 ± 0.793</td><td></td></tr><tr><td>Reeooor</td><td>(n-2)</td><td>78.66 ± 22.17</td><td>94.06±5.10</td><td>97.50±0.72</td><td>95.04 ± 2.69</td><td>-3.799 ± 0.187</td><td>-0.207 ± 0.381</td><td>-2.344 ± 0.569</td><td></td></tr><tr><td></td><td>(n-3)</td><td>73.33 ± 16.19</td><td>96.61 ± 1.40</td><td>97.84 ± 1.37</td><td>94.48 ± 2.13</td><td>-3.779 ± 0.064</td><td>0.105 ±0.225</td><td>-1.908 ± 0.860</td><td>&lt;&lt;&lt;&lt;</td></tr><tr><td>[n/2]</td><td></td><td>40.66 ± 9.04</td><td>75.13 ± 0.26</td><td>63.28 ± 0.59</td><td>63.53 ± 1.14</td><td>-3.765 ± 0.083</td><td>0.564 ± 0.025</td><td>-2.130 ± 0.166</td><td></td></tr><tr><td></td><td>GCN(orig.)</td><td>6.66 ± 2.10</td><td>98.336 ± 0.24</td><td>95.73 ± 2.72</td><td>87.14 ± 12.73</td><td>-3.781 ± 0.075</td><td>0.087 ± 0.186</td><td>-2.204 ± 0.362</td><td></td></tr><tr><td></td><td>(n-1)</td><td>100.00 ±0.00</td><td>99.00 ±0.10</td><td>97.63 ± 0.19</td><td>94.99 ± 2.31</td><td>-4.039 ± 0.101</td><td>-1.175 ± 0.425</td><td>-3.625 ± 0.536</td><td></td></tr><tr><td></td><td>(n-2)</td><td>100.00±0.00</td><td>98.77 ±0.61</td><td>97.89 ± 0.69</td><td>97.82 ± 1.10</td><td>-3.970 ± 0.059</td><td>-0.577 ± 0.135</td><td>-3.397 ± 0.273</td><td></td></tr><tr><td>Reeeoss</td><td>(n-3)</td><td>96.00 ±6.46</td><td>99.11 ± 0.19</td><td>98.31 ± 0.52</td><td>97.18 ± 0.58</td><td>-3.995 ± 0.031</td><td>-0.333 ± 0.117</td><td>-3.105 ± 0.286</td><td></td></tr><tr><td>[n/2]</td><td></td><td>49.33 ± 7.42</td><td>75.19 ± 0.19</td><td>66.04 ± 0.59</td><td>63.66 ± 0.51</td><td>-3.693 ± 0.063</td><td>0.8518 ± 0.016</td><td>-1.838 ± 0.054</td><td></td></tr><tr><td>PNA (orig.)</td><td></td><td>10.00 ± 2.98</td><td>81.59 ± 19.86</td><td>95.57 ± 0.36</td><td>84.81 ± 16.48</td><td>-3.794 ± 0.155</td><td>-0.605 ± 0.097</td><td>-3.610 ± 0.137</td><td></td></tr><tr><td>(n-1)</td><td></td><td>100.00 ±0.00</td><td>97.88 ± 2.19</td><td>99.18 ±0.20</td><td>98.92 ± 0.72</td><td>-3.904 ± 0.001</td><td>-0.765 ± 0.032</td><td>-3.954 ±0.118</td><td></td></tr><tr><td>Rreeoor (n-2)</td><td></td><td>95.33 ± 7.77</td><td>99.12 ± 0.28</td><td>99.10 ± 0.57</td><td>99.22 ± 0.27</td><td>-3.781 ± 0.085</td><td>-0.090 ± 0.135</td><td>-3.478 ± 0.206</td><td></td></tr><tr><td>(n-3)</td><td></td><td>95.33 ± 5.81</td><td>89.36 ± 0.22 75.34 ±0.18</td><td>99.34 ± 0.26</td><td>93.92 ± 8.15 64.01 ± 0.30</td><td>-3.710 ± 0.209 -2.977 ± 0.065</td><td>0.042 ± 0.047</td><td>-3.311 ± 0.067</td><td>√</td></tr><tr><td>[n/2]</td><td></td><td>42.66 ± 11.03</td><td></td><td>65.58 ± 0.95</td><td></td><td></td><td>1.445 ± 0.037</td><td>-1.073 ± 0.075</td><td></td></tr><tr><td>Positional GIN Ring-GNN</td><td></td><td>99.33+ ± 1.33</td><td>88.3†</td><td>96.1†</td><td>95.3t</td><td>-1.61t</td><td>-2.17</td><td>-2.66t</td><td>x&lt;ν</td></tr><tr><td></td><td></td><td>10.00 ± 0.00</td><td>99.9†</td><td>100.0†</td><td>71.4</td><td></td><td></td><td>二</td><td></td></tr><tr><td></td><td>PPGN (3-WL)</td><td>97.80 ± 10.91</td><td>99.8†</td><td>87.1†</td><td>76.5†</td><td>二</td><td>二</td><td></td><td></td></tr></table>
206
+
207
+ Table 2: OGBG molecule graph classification and regression tasks. We highlight in green $k$ -Reconstruction GNNs boosting the original GNN architecture.
208
+
209
+ <table><tr><td rowspan=1 colspan=12>OGBG-MOLTOX21 OGBG-MOLTOXCAST OGBG-MOLFREESOLV OGBG-MOLESOL 0GBG-MOLLIPO OGBG-MOLPCBA(ROC-AUC %)↑ (ROC-AUC %) ↑ (RSMSE)↓ (RSMSE)↓ (RSMSE)↓ (AP%)↑</td></tr><tr><td></td><td rowspan=1 colspan=1>GIN (orig.)</td><td rowspan=1 colspan=1>74.91 ± 0.51</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>63.41 ± 0.74</td><td rowspan=1 colspan=7>2.411 ± 0.123 1.111 ± 0.038 0.754 ± 0.010 21.16 ± 0.28</td></tr><tr><td></td><td rowspan=1 colspan=1>(n-1)</td><td rowspan=1 colspan=1>75.15 ± 1.40</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>63.95 ± 0.53</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>2.283 ± 0.279</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1.026 ± 0.033</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>0.716± 0.020</td><td rowspan=1 colspan=1>23.60 ± 0.02</td></tr><tr><td></td><td rowspan=1 colspan=1>(n-2)</td><td rowspan=1 colspan=1>76.84 ± 0.62</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>65.36 ± 0.49</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>2.117 ± 0.181</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1.006 ± 0.030</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>0.736± 0.025</td><td rowspan=1 colspan=1>23.25 ± 0.00</td></tr><tr><td></td><td rowspan=1 colspan=1>(n-3)</td><td rowspan=1 colspan=1>76.78 ± 0.64</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>64.84 ± 0.71</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>2.370 ± 0.326</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1.055 ± 0.031</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>0.738 ± 0.018</td><td rowspan=1 colspan=1>23.33 ± 0.09</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>[n/2]</td><td rowspan=1 colspan=1>74.40 ± 0.75</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>62.29 ± 0.28</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>2.531 ± 0.206</td><td rowspan=1 colspan=2>1.343 ± 0.053</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>0.842 ± 0.020</td><td rowspan=1 colspan=1>13.50 ± 0.32</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>GCN (orig.)</td><td rowspan=1 colspan=1>75.29 ± 0.69</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>63.54 ± 0.42</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>2.417 ± 0.178</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=2>1.106 ± 0.036</td><td rowspan=1 colspan=1>0.793 ± 0.040</td><td rowspan=1 colspan=1>20.20 ± 0.24</td></tr><tr><td rowspan=1 colspan=1>上</td><td rowspan=1 colspan=1>(n-1)</td><td rowspan=1 colspan=1>76.46 ± 0.77</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>64.51 ± 0.60</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>2.524 ± 0.300</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1.096 ± 0.045</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>0.760 ± 0.015</td><td rowspan=1 colspan=1>21.25 ± 0.25</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>(n-2)</td><td rowspan=1 colspan=1>75.58 ± 0.99</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>64.38 ± 0.39</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>2.467 ± 0.231</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1.086 ± 0.048</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>0.766 ± 0.025</td><td rowspan=1 colspan=1>20.10 ± 0.08</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>(n-3)</td><td rowspan=1 colspan=1>75.88 ± 0.73</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>64.70 ±0.81</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>2.345 ± 0.261</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1.114 ± 0.047</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>0.754 ± 0.021</td><td rowspan=1 colspan=1>19.04 ± 0.03</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>[n/2]</td><td rowspan=1 colspan=1>74.03 ± 0.63</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>62.80 ± 0.77</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>2.599 ± 0.161</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=2>1.372 ± 0.048</td><td rowspan=1 colspan=1>0.835± 0.020</td><td rowspan=1 colspan=1>11.69 ± 1.41</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>PNA (orig.)</td><td rowspan=1 colspan=1>74.28 ± 0.52</td><td rowspan=1 colspan=2>62.69 ± 0.63</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>2.192 ± 0.125</td><td rowspan=1 colspan=3>1.140 ± 0.032</td><td rowspan=1 colspan=1>0.759 ± 0.017</td><td rowspan=1 colspan=1>25.45 ± 0.04</td></tr><tr><td></td><td rowspan=1 colspan=1>(n-1)</td><td rowspan=1 colspan=1>73.64 ± 0.74</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>64.14 ±0.76</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>2.341 ± 0.070</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1.723 ± 0.145</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>0.743 ± 0.015</td><td rowspan=1 colspan=1>23.11 ± 0.05</td></tr><tr><td></td><td rowspan=1 colspan=1>(n-2)</td><td rowspan=1 colspan=1>74.89 ± 0.29</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>65.22 ± 0.47</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>2.298 ± 0.115</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1.392 ± 0.272</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>0.794 ± 0.065</td><td rowspan=1 colspan=1>22.10±0.03</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>(n-3)</td><td rowspan=1 colspan=1>75.10 ± 0.73</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>65.03 ± 0.58</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>2.133 ± 0.086</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1.360 ± 0.163</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>0.785 ± 0.041</td><td rowspan=1 colspan=1>20.05 ± 0.15</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>[n/2]</td><td rowspan=1 colspan=1>73.71 ± 0.61</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>61.25 ± 0.49</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>2.185 ± 0.231</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1.157 ± 0.056</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>0.843 ± 0.018</td><td rowspan=1 colspan=1>12.33 ± 1.20</td></tr></table>
210
+
211
+ A2 (Real-world tasks). Table 2 and Table 6 in Appendix I show that applying $k$ -reconstruction to GNNs significantly boosts their performance across all eight real-world tasks. In particular, in Table 2, we see a boost of up to $5 \%$ while achieving the best results in five out of six datasets. The $( n - 2 )$ -reconstruction applied to GIN gives the best results in the OGBG tasks, with the exception of OGBG-MOLLIPO and OGBG-MOLPCBA where $( n - 1 )$ -reconstruction performs better. The only settings where we did not get any boost were PNA for OGBG-MOLESOL and OGBG-MOLPCBA. Table 6 in Appendix I also shows consistent boost in GNNs’ performance of up to $2 5 \%$ in other datasets. On ZINC, $k$ -Reconstruction yields better results than the higher-order alternatives LRP and $\delta$ -2-LGNN. While GSN gives the best ZINC results, we note that GSN requires application-specific features. In OGBG-MOLHIV, $k$ -reconstruction is able to boost both GIN and GCN. The results in Appendix G show that nearly $1 0 0 \%$ of the graphs in our real-world datasets are distinguishable by the 1-WL algorithm, thus we can conclude that traditional GNNs are expressive enough for all our real-world tasks. Hence, real-world boosts of reconstruction over GNNs can be attributed to the gains from invariances to vertex removals (cf. Section 4.2) rather than the boost in expressive power (cf. Section 4.1).
212
+
213
+ A3 (Subgraph sizes). Overall we observe that removing one vertex $k = n - 1 )$ ) is enough to improve the performance of GNNs in most experiments. At the other extreme end of vertex removals, $k = \lceil n / 2 \rceil$ , there is a significant loss in expressiveness compared to the original GNN. In most real-world tasks, Table 2 and Table 6 in Appendix I show a variety of performance boosts also with $k \in \{ n { - } 2 , n { - } 3 \}$ For GCN and PNA in OGBG-MOLESOL, specifically, we only see $k$ -Reconstruction boosts over smaller subgraphs such as $n - 3$ , which might be due to the task’s need of more invariance to vertex removals (cf.
214
+
215
+ Section 4.2). In the graph property tasks (Table 1), we see significant boosts also for $k \in \{ n { - } 2 , n { - } 3 \}$ in all models across most tasks, except PNA. However, as in real-world tasks the extreme case of small subgraphs $k = \lceil n / 2 \rceil$ significantly harms the ability to solve tasks with $k$ -Reconstruction GNNs.
216
+
217
+ # 6 Conclusions
218
+
219
+ Our work connected graph $( k - )$ reconstruction and modern GRL. We first showed how such connection results in two natural expressive graph representation classes. To make our models practical, we combined insights from graph reconstruction and GNNs, resulting in $k$ -Reconstruction GNNs. Our theory shows that reconstruction boosts the expressiveness of GNNs and has a lower-variance risk estimator in distributions invariant to vertex removals. Empirically, we showed how the theoretical gains of $k$ -Reconstruction GNNs translate into practice, solving graph property tasks not originally solvable by GNNs and boosting their performance on real-world tasks.
220
+
221
+ # Acknowledgements
222
+
223
+ This work was funded in part by the National Science Foundation (NSF) awards CAREER IIS-1943364 and CCF-1918483. Any opinions, findings and conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of the sponsors. Christopher Morris is funded by the German Academic Exchange Service (DAAD) through a DAAD IFI postdoctoral scholarship (57515245). We want to thank our reviewers, who gave excellent suggestions to improve the paper.
224
+
225
+ # References
226
+
227
+ [1] Abboud, R., Ceylan, ˙I. ˙I., Grohe, M., and Lukasiewicz, T. (2020). The surprising power of graph neural networks with random node initialization. CoRR, abs/2010.01179.
228
+ [2] Abu-El-Haija, S., Perozzi, B., Kapoor, A., Alipourfard, N., Lerman, K., Harutyunyan, H., Steeg, G. V., and Galstyan, A. (2019). Mixhop: Higher-order graph convolutional architectures via sparsified neighborhood mixing. In International Conference on Machine Learning, pages 21–29.
229
+ [3] Albooyeh, M., Bertolini, D., and Ravanbakhsh, S. (2019). Incidence networks for geometric deep learning. CoRR, abs/1905.11460.
230
+ [4] Anderson, B. M., Hy, T., and Kondor, R. (2019). Cormorant: Covariant molecular neural networks. In Advances in Neural Information Processing Systems, pages 14510–14519.
231
+ [5] Arvind, V., Köbler, J., Rattan, G., and Verbitsky, O. (2015). On the power of color refinement. In International Symposium on Fundamentals of Computation Theory, pages 339–350.
232
+ [6] Azizian, W. and Lelarge, M. (2020). Characterizing the expressive power of invariant and equivariant graph neural networks. arXiv preprint arXiv:2006.15646.
233
+ [7] Babai, L. (2016). Graph isomorphism in quasipolynomial time. In ACM SIGACT Symposium on Theory of Computing, pages 684–697.
234
+ [8] Barabasi, A.-L. and Oltvai, Z. N. (2004). Network biology: Understanding the cell’s functional organization. Nature Reviews Genetics, 5(2):101–113.
235
+ [9] Barceló, P., Kostylev, E. V., Monet, M., Pérez, J., Reutter, J. L., and Silva, J. P. (2020). The logical expressiveness of graph neural networks. In International Conference on Learning Representations.
236
+ [10] Baskin, I. I., Palyulin, V. A., and Zefirov, N. S. (1997). A neural device for searching direct correlations between structures and properties of chemical compounds. Journal of Chemical Information and Computer Sciences, 37(4):715–721.
237
+ [11] Beaini, D., Passaro, S., Létourneau, V., Hamilton, W. L., Corso, G., and Liò, P. (2020). Directional graph networks. CoRR, abs/2010.02863.
238
+ [12] Bevilacqua, B., Zhou, Y., and Ribeiro, B. (2021). Size-invariant graph representations for graph classification extrapolations. arXiv preprint arXiv:2103.05045.
239
+ [13] Bloem-Reddy, B. and Teh, Y. W. (2020). Probabilistic symmetries and invariant neural networks. Journal of Machine Learning Research, 21(90):1–61.
240
+ [14] Bodnar, C., Frasca, F., Wang, Y. G., Otter, N., Montúfar, G., Lio, P., and Bronstein, M. (2021). Weisfeiler and lehman go topological: Message passing simplicial networks. arXiv preprint arXiv:2103.03212.
241
+ [15] Bollobás, B. (1990). Almost every graph has reconstruction number three. Journal of Graph Theory, 14(1):1–4.
242
+ [16] Bondy, J. A. (1991). A graph reconstructor’s manual. Surveys in combinatorics, 166:221–252.
243
+ [17] Borowiecki, M., Broere, I., Frick, M., Mihok, P., and Semanišin, G. (1997). A survey of hereditary properties of graphs. Discussiones Mathematicae Graph Theory, 17(1):5–50.
244
+ [18] Bouritsas, G., Frasca, F., Zafeiriou, S., and Bronstein, M. M. (2020). Improving graph neural network expressivity via subgraph isomorphism counting. CoRR, abs/2006.09252.
245
+ [19] Bruna, J., Zaremba, W., Szlam, A., and LeCun, Y. (2014). Spectral networks and deep locally connected networks on graphs. In International Conference on Learning Representation.
246
+ [20] Cangea, C., Velickovic, P., Jovanovic, N., Kipf, T., and Liò, P. (2018). Towards sparse hierarchical graph classifiers. CoRR, abs/1811.01287.
247
+ [21] Chami, I., Abu-El-Haija, S., Perozzi, B., Ré, C., and Murphy, K. (2020). Machine learning on graphs: A model and comprehensive taxonomy. CoRR, abs/2005.03675.
248
+ [22] Chami, I., Ying, Z., Ré, C., and Leskovec, J. (2019). Hyperbolic graph convolutional neural networks. In Advances in Neural Information Processing Systems, pages 4869–4880.
249
+ [23] Chen, G., Chen, P., Hsieh, C., Lee, C., Liao, B., Liao, R., Liu, W., Qiu, J., Sun, Q., Tang, J., Zemel, R. S., and Zhang, S. (2019a). Alchemy: A quantum chemistry dataset for benchmarking AI models. CoRR, abs/1906.09427.
250
+ [24] Chen, S., Dobriban, E., and Lee, J. H. (2019b). Invariance reduces variance: Understanding data augmentation in deep learning and beyond. arXiv preprint arXiv:1907.10905.
251
+ [25] Chen, Z., Chen, L., Villar, S., and Bruna, J. (2020a). Can graph neural networks count substructures? In Advances in Neural Information Processing Systems.
252
+ [26] Chen, Z., Chen, L., Villar, S., and Bruna, J. (2020b). Can graph neural networks count substructures? CoRR, abs/2002.04025.
253
+ [27] Chen, Z., Villar, S., Chen, L., and Bruna, J. (2019c). On the equivalence between graph isomorphism testing and function approximation with GNNs. In Advances in Neural Information Processing Systems, pages 15868–15876.
254
+ [28] Corso, G., Cavalleri, L., Beaini, D., Liò, P., and Velickovic, P. (2020). Principal neighbourhood aggregation for graph nets. In Advances in Neural Information Processing Systems.
255
+ [29] Dasoulas, G., Santos, L. D., Scaman, K., and Virmaux, A. (2020). Coloring graph neural networks for node disambiguation. In International Joint Conference on Artificial Intelligence, pages 2126–2132.
256
+ [30] Defferrard, M., X., B., and Vandergheynst, P. (2016). Convolutional neural networks on graphs with fast localized spectral filtering. In Advances in Neural Information Processing Systems, pages 3844–3852.
257
+ [31] Duvenaud, D. K., Maclaurin, D., Iparraguirre, J., Bombarell, R., Hirzel, T., Aspuru-Guzik, A., and Adams, R. P. (2015). Convolutional networks on graphs for learning molecular fingerprints. In Advances in Neural Information Processing Systems, pages 2224–2232.
258
+ [32] Dwivedi, V. P., Joshi, C. K., Laurent, T., Bengio, Y., and Bresson, X. (2020). Benchmarking graph neural networks. CoRR, abs/2003.00982.
259
+ [33] Easley, D. and Kleinberg, J. (2010). Networks, Crowds, and Markets: Reasoning About a Highly Connected World. Cambridge University Press.
260
+ [34] Feng, W., Zhang, J., Dong, Y., Han, Y., Luan, H., Xu, Q., Yang, Q., Kharlamov, E., and Tang, J. (2020). Graph random neural networks for semi-supervised learning on graphs. In Advances in Neural Information Processing Systems.
261
+ [35] Fey, M. and Lenssen, J. E. (2019). Fast graph representation learning with PyTorch Geometric. CoRR, abs/1903.02428.
262
+ [36] Flam-Shepherd, D., Wu, T., Friederich, P., and Aspuru-Guzik, A. (2020). Neural message passing on high order paths. CoRR, abs/2002.10413.
263
+ [37] Gao, H. and Ji, S. (2019). Graph U-Nets. In International Conference on Machine Learning, pages 2083–2092.
264
+ [38] Garg, V. K., Jegelka, S., and Jaakkola, T. S. (2020). Generalization and representational limits of graph neural networks. In International Conference on Machine Learning, pages 3419–3430.
265
+ [39] Geerts, F. (2020). The expressive power of kth-order invariant graph networks. CoRR, abs/2007.12035.
266
+ [40] Geerts, F., Mazowiecki, F., and Pérez, G. A. (2020). Let’s agree to degree: Comparing graph convolutional networks in the message-passing framework. CoRR, abs/2004.02593.
267
+ [41] Giles, W. B. (1974). The reconstruction of outerplanar graphs. Journal of Combinatorial Theory, Series B, 16(3):215 – 226.
268
+ [42] Gilmer, J., Schoenholz, S. S., Riley, P. F., Vinyals, O., and Dahl, G. E. (2017). Neural message passing for quantum chemistry. In International Conference on Machine Learning.
269
+ [43] Godsil, C. (1993). Algebraic combinatorics, volume 6. CRC Press.
270
+ [44] Grohe, M. (2017). Descriptive Complexity, Canonisation, and Definable Graph Structure Theory. Lecture Notes in Logic. Cambridge University Press.
271
+ [45] Grohe, M. (2020). Word2vec, Node2vec, Graph2vec, X2vec: Towards a theory of vector embeddings of structured data. CoRR, abs/2003.12590.
272
+ [46] Grohe, M. and Neuen, D. (2020). Recent advances on the graph isomorphism problem. CoRR, abs/2011.01366.
273
+ [47] Hamilton, W. L., Ying, R., and Leskovec, J. (2017). Inductive representation learning on large graphs. In Advances in Neural Information Processing Systems, pages 1025–1035.
274
+ [48] Hinton, G. E., Srivastava, N., Krizhevsky, A., Sutskever, I., and Salakhutdinov, R. R. (2012). Improving neural networks by preventing co-adaptation of feature detectors. CoRR, abs/1207.0580.
275
+ [49] Hu, W., Fey, M., Zitnik, M., Dong, Y., Ren, H., Liu, B., Catasta, M., and Leskovec, J. (2020). Open graph benchmark: Datasets for machine learning on graphs. In Advances in Neural Information Processing Systems.
276
+ [50] Jin, Y., Song, G., and Shi, C. (2019). GraLSP: Graph neural networks with local structural patterns. CoRR, abs/1911.07675.
277
+ [51] Junttila, T. and Kaski, P. (2007). Engineering an efficient canonical labeling tool for large and sparse graphs. In Workshop on Algorithm Engineering and Experiments, pages 135–149.
278
+ [52] Kelly, P. J. (1942). On isometric transformations. PhD thesis, University of Wisconsin-Madison.
279
+ [53] Kelly, P. J. et al. (1957). A congruence theorem for trees. Pacific Journal of Mathematics, 7(1):961–968.
280
+ [54] Keriven, N. and Peyré, G. (2019). Universal invariant and equivariant graph neural networks. In Advances in Neural Information Processing Systems, pages 7090–7099.
281
+ [55] Kiefer, S., Schweitzer, P., and Selman, E. (2015). Graphs identified by logics with counting. In International Symposium on Mathematical Foundations of Computer Science, pages 319–330.
282
+ [56] Kipf, T. N. and Welling, M. (2017). Semi-supervised classification with graph convolutional networks. In International Conference on Learning Representation.
283
+ [57] Kireev, D. B. (1995). Chemnet: A novel neural network based method for graph/property mapping. Journal of Chemical Information and Computer Sciences, 35(2):175–180.
284
+ [58] Klicpera, J., Groß, J., and Günnemann, S. (2020). Directional message passing for molecular graphs. In International Conference on Learning Representations.
285
+ [59] Kong, K., Li, G., Ding, M., Wu, Z., Zhu, C., Ghanem, B., Taylor, G., and Goldstein, T. (2020). FLAG: adversarial data augmentation for graph neural networks. CoRR, abs/2010.09891.
286
+ [60] Kostochka, A. V. and West, D. B. (2020). On reconstruction of n-vertex graphs from the multiset of (n-\`)-vertex induced subgraphs. IEEE Transactions on Information Theory, PP:1–1.
287
+ [61] Li, P., Wang, Y., Wang, H., and Leskovec, J. (2020). Distance encoding: Design provably more powerful neural networks for graph representation learning. Advances in Neural Information Processing Systems.
288
+ [62] Liao, R., Urtasun, R., and Zemel, R. S. (2020). A PAC-bayesian approach to generalization bounds for graph neural networks. CoRR, abs/2012.07690.
289
+ [63] Lyle, C., van der Wilk, M., Kwiatkowska, M., Gal, Y., and Bloem-Reddy, B. (2020). On the benefits of invariance in neural networks. arXiv preprint arXiv:2005.00178.
290
+ [64] Maehara, T. and NT, H. (2019). A simple proof of the universality of invariant/equivariant graph neural networks. CoRR, abs/1910.03802.
291
+ [65] Manvel, B. (1974). Some basic observations on kelly’s conjecture for graphs. Discrete Mathematics, 8(2):181–185.
292
+ [66] Maron, H., Ben-Hamu, H., Serviansky, H., and Lipman, Y. (2019a). Provably powerful graph networks. In Advances in Neural Information Processing Systems, pages 2153–2164.
293
+ [67] Maron, H., Fetaya, E., Segol, N., and Lipman, Y. (2019b). On the universality of invariant networks. In International Conference on Machine Learning, volume 97, pages 4363–4371. PMLR.
294
+ [68] McKay, B. D. (1997). Small graphs are reconstructible. Australasian Journal of Combinatorics, 15:123–126.
295
+ [69] Merkwirth, C. and Lengauer, T. (2005). Automatic generation of complementary descriptors with molecular graph networks. Journal of Chemical Information and Modeling, 45(5):1159–1168.
296
+ [70] Micheli, A. (2009). Neural network for graphs: A contextual constructive approach. IEEE Transactions on Neural Networks, 20(3):498–511.
297
+ [71] Micheli, A. and Sestito, A. S. (2005). A new neural network model for contextual processing of graphs. In Italian Workshop on Neural Nets Neural Nets and International Workshop on Natural and Artificial Immune Systems, volume 3931 of Lecture Notes in Computer Science, pages 10–17. Springer.
298
+ [72] Monti, F., Boscaini, D., Masci, J., Rodolà, E., Svoboda, J., and Bronstein, M. M. (2017). Geometric deep learning on graphs and manifolds using mixture model CNNs. In IEEE Conference on Computer Vision and Pattern Recognition, pages 5425–5434.
299
+ [73] Morris, C. (2021). The power of the weisfeiler-leman algorithm for machine learning with graphs. In International Joint Conference on Artificial Intelligence, page TBD.
300
+ [74] Morris, C., Kriege, N. M., Bause, F., Kersting, K., Mutzel, P., and Neumann, M. (2020a). TUDataset: A collection of benchmark datasets for learning with graphs. CoRR, abs/2007.08663.
301
+ [75] Morris, C., L., Y., Maron, H., Rieck, B., Kriege, N. M., Grohe, M., Fey, M., and Borgwardt, K. (2021). Weisfeiler and leman learning: The story so far. CoRR, abs/2112.09992.
302
+ [76] Morris, C. and Mutzel, P. (2019). Towards a practical $k$ -dimensional Weisfeiler-Leman algorithm. CoRR, abs/1904.01543.
303
+ [77] Morris, C., Rattan, G., and Mutzel, P. (2020b). Weisfeiler and leman go sparse: Towards higher-order graph embeddings. In Advances in Neural Information Processing Systems.
304
+ [78] Morris, C., Ritzert, M., Fey, M., Hamilton, W. L., Lenssen, J. E., Rattan, G., and Grohe, M. (2019). Weisfeiler and Leman go neural: Higher-order graph neural networks. In AAAI Conference on Artificial Intelligence, pages 4602–4609.
305
+ [79] Murphy, R. L., Srinivasan, B., Rao, V., and Ribeiro, B. (2019a). Janossy pooling: Learning deep permutationinvariant functions for variable-size inputs. International Conference on Learning Representations.
306
+ [80] Murphy, R. L., Srinivasan, B., Rao, V., and Ribeiro, B. (2019b). Relational pooling for graph representations. In International Conference on Machine Learning, pages 4663–4673.
307
+ [81] Murphy, R. L., Srinivasan, B., Rao, V. A., and Ribeiro, B. (2019c). Relational pooling for graph representations. In International Conference on Machine Learning, pages 4663–4673.
308
+ [82] Niepert, M., Ahmed, M., and Kutzkov, K. (2016). Learning convolutional neural networks for graphs. In International Conference on Machine Learning, pages 2014–2023.
309
+ [83] Nydl, V. (1981). Finite graphs and digraphs which are not reconstructible from their cardinality restricted \` subgraphs. Commentationes Mathematicae Universitatis Carolinae, 22(2):281–287.
310
+ [84] Nydl, V. (2001). Graph reconstruction from subgraphs. \` Discrete Mathematics, 235(1-3):335–341.
311
+ [85] Rong, Y., Huang, W., Xu, T., and Huang, J. (2020). DropEdge: Towards deep graph convolutional networks on node classification. In International Conference on Learning Representations.
312
+ [86] Sato, R., Yamada, M., and Kashima, H. (2020). Random features strengthen graph neural networks. CoRR, abs/2002.03155.
313
+ [87] Scarselli, F., Gori, M., Tsoi, A. C., Hagenbuchner, M., and Monfardini, G. (2009). The graph neural network model. IEEE Transactions on Neural Networks, 20(1):61–80.
314
+ [88] Shawe-Taylor, J. (1993). Symmetries and discriminability in feedforward network architectures. IEEE Transactions on Neural Networks, 4(5):816–826.
315
+ [89] Simonovsky, M. and Komodakis, N. (2017). Dynamic edge-conditioned filters in convolutional neural networks on graphs. In IEEE Conference on Computer Vision and Pattern Recognition, pages 29–38.
316
+ [90] Sperduti, A. and Starita, A. (1997). Supervised neural networks for the classification of structures. IEEE Transactions on Neural Networks, 8(2):714–35.
317
+ [91] Spinoza, H. and West, D. B. (2019). Reconstruction from the deck of-vertex induced subgraphs. Journal of Graph Theory, 90(4):497–522.
318
+ [92] Stockmeyer, P. K. (1977). The falsity of the reconstruction conjecture for tournaments. Journal of Graph Theory, 1(1):19–25.
319
+ [93] Stockmeyer, P. K. (1981). A census of non-reconstructable digraphs, i: Six related families. Journal of Combinatorial Theory, Series B, 31(2):232–239.
320
+ [94] Stokes, J., Yang, K., Swanson, K., Jin, W., Cubillos-Ruiz, A., Donghia, N., MacNair, C., French, S., Carfrae, L., Bloom-Ackerman, Z., Tran, V., Chiappino-Pepe, A., Badran, A., Andrews, I., Chory, E., Church, G., Brown, E., Jaakkola, T., Barzilay, R., and Collins, J. (2020). A deep learning approach to antibiotic discovery. Cell, 180:688–702.e13.
321
+ [95] Taylor, R. (1990). Reconstructing degree sequences from k-vertex-deleted subgraphs. Discrete mathematics, 79(2):207–213.
322
+ [96] Ulam, S. M. (1960). A collection of mathematical problems, volume 8. Interscience Publishers.
323
+ [97] Velickovic, P., Cucurull, G., Casanova, A., Romero, A., Liò, P., and Bengio, Y. (2018). Graph attention networks. In International Conference on Learning Representations.
324
+ [98] Vignac, C., Loukas, A., and Frossard, P. (2020). Building powerful and equivariant graph neural networks with structural message-passing. In Advances in Neural Information Processing Systems.
325
+ [99] Vinyals, O., Bengio, S., and Kudlur, M. (2015). Order matters: Sequence to sequence for sets. arXiv preprint arXiv:1511.06391.
326
+ [100] Wagstaff, E., Fuchs, F., Engelcke, M., Posner, I., and Osborne, M. A. (2019). On the limitations of representing functions on sets. International Conference on Machine Learning, pages 6487–6494.
327
+ [101] Weisfeiler, B. (1976). On Construction and Identification of Graphs. Lecture Notes in Mathematics, Vol. 558. Springer.
328
+ [102] Weisfeiler, B. and Leman., A. (1968). The reduction of a graph to canonical form and the algebra which appears therein. Nauchno-Technicheskaya Informatsia, 2(9):12–16. English translation by G. Ryabov is available at https://www.iti.zcu.cz/wl2018/pdf/wl_paper_translation.pdf.
329
+ [103] Wu, Z., Pan, S., Chen, F., Long, G., Zhang, C., and Yu, P. S. (2019). A comprehensive survey on graph neural networks. CoRR, abs/1901.00596.
330
+ [104] Wu, Z., Ramsundar, B., Feinberg, E. N., Gomes, J., Geniesse, C., Pappu, A. S., Leswing, K., and Pande, V. (2018). MoleculeNet: A benchmark for molecular machine learning. Chemical Science, 9:513–530.
331
+ [105] Xu, K., Hu, W., Leskovec, J., and Jegelka, S. (2019). How powerful are graph neural networks? In International Conference on Learning Representations.
332
+ [106] Xu, K., Li, C., Tian, Y., Sonobe, T., Kawarabayashi, K., and Jegelka, S. (2018). Representation learning on graphs with jumping knowledge networks. In International Conference on Machine Learning, pages 5453–5462.
333
+ [107] Yehudai, G., Fetaya, E., Meirom, E. A., Chechik, G., and Maron, H. (2020). On size generalization in graph neural networks. CoRR, abs/2010.08853.
334
+ [108] Ying, R., You, J., Morris, C., Ren, X., Hamilton, W. L., and Leskovec, J. (2018). Hierarchical graph representation learning with differentiable pooling. In Advances in Neural Information Processing Systems, pages 4800–4810.
335
+ [109] You, J., Gomes-Selman, J., Ying, R., and Leskovec, J. (2021). Identity-aware graph neural networks. arXiv preprint arXiv:2101.10320.
336
+ [110] You, J., Ying, R., and Leskovec, J. (2019). Position-aware graph neural networks. In International Conference on Machine Learning, pages 7134–7143.
337
+ [111] Yuan, H., Yu, H., Wang, J., Li, K., and Ji, S. (2021). On explainability of graph neural networks via subgraph explorations. arXiv preprint arXiv:2102.05152.
338
+ [112] Zaheer, M., Kottur, S., Ravanbakhsh, S., Poczos, B., Salakhutdinov, R. R., and Smola, A. J. (2017). Deep sets. In Advances in neural information processing systems, pages 3391–3401.
339
+ [113] Zhang, M., Cui, Z., Neumann, M., and Yixin, C. (2018). An end-to-end deep learning architecture for graph classification. In AAAI Conference on Artificial Intelligence, pages 4428–4435.
340
+ [114] Zhou, J., Cui, G., Zhang, Z., Yang, C., Liu, Z., Wang, L., Li, C., and Sun, M. (2018). Graph neural networks: A review of methods and applications. CoRR, abs/1812.08434.
md/train/_b8l7rVPe8z/_b8l7rVPe8z.md ADDED
@@ -0,0 +1,392 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # RELEVANCE ATTACK ON DETECTORS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ This paper focuses on high-transferable adversarial attacks on detectors, which are hard to attack in a black-box manner, because of their multiple-output characteristics and the diversity across architectures. To pursue a high attack transferability, one plausible way is to find a common property across detectors, which facilitates the discovery of common weaknesses. We are the first to suggest that the relevance map for detectors is such a property. Based on it, we design a Relevance Attack on Detectors (RAD), which achieves a state-of-the-art transferability, exceeding existing results by above $20 \%$ . On MS COCO, the detection mAPs for all 8 black-box architectures are more than halved and the segmentation mAPs are also significantly influenced. Given the great transferability of RAD, we generate the first adversarial dataset for object detection, i.e., Adversarial Objects in COntext (AOCO), which helps to quickly evaluate and improve the robustness of detectors.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Adversarial attacks (Szegedy et al. (2014); Goodfellow et al. (2015); Carlini & Wagner (2017); M ˛adry et al. (2017); Baluja & Fischer (2017); Su et al. (2019)) have revealed the fragility of Deep Neural Networks (DNNs) by fooling them with elaborately-crafted imperceptible perturbations. Among them, the black-box attack, i.e., attacking without knowledge of their inner structure and weights, is much harder, more aggressive and closer to real-world scenarios. For classifiers, there exist some promising black-box attacks (Papernot et al. (2016); Brendel et al. (2018); Dong et al. (2018); Xie et al. (2019); Lin et al. (2020); Chen et al. (2020)). It is also severe to attack object detection (Zhang & Wang (2019)) in a black-box manner, e.g., hiding certain objects from unknown detectors (Thys et al. (2019)). By that, life-concerning systems based on detection such as autonomous driving and security surveillance would be greatly influence.
12
+
13
+ To the best of our knowledge, no existing attack is specifically designed for black-box transferability in detectors, because they have multiple-outputs and a high diversity across architectures. In such situations, adversarial samples do not transfer well (Su et al. (2018)), and most attacks only decrease mAP of black-box detectors by 5 to $10 \%$ (Xie et al. (2017); Li et al. (2018c;b)). To overcome this, we propose one plausible way to find common properties across detectors, which facilitates the discovery of common weaknesses. Based on them, the designed attack can threaten variable victims.
14
+
15
+ In this paper, we adopt the relevance map as a common property, on which different detectors have similar interpretable results, as shown in Fig. 1. Based on relevance maps, we design a Relevance Attack on Detectors (RAD). RAD focuses on suppressing the relevance map rather than directly attacking the prediction as in existing works (Xie et al. (2017); Li et al. (2018c;a)). Because the relevance maps are quite similar across models, those of black-box models are influenced and misled as well in attack, leading to the great transferability. Although some works have adopted the relevance map as an indicator or reference of success attacks (Dong et al. (2019); Zhang & Zhu (2019); Chen et al. (2020); Wu et al. (2020a)), there is no work to directly attack the relevance maps of detectors to the best of our knowledge.
16
+
17
+ In our comprehensive evaluation, RAD achieves the state-of-the-art transferability on 8 black-box models for COCO) dataset (Lin et al. (2014)), nearly halving the detection mAP. Interestingly, the adversarial samples of RAD also greatly influence the performance of instance segmentation, even only detectors are attacked. Given the high transferability of RAD, we create Adversarial Objects in COntext (AOCO), the first adversarial dataset for object detection. AOCO contains 10K samples that significantly decrease the performance of black-box models for detection and segmentation. AOCO may serve as a benchmark to test the robustness of a DNN or improve it by adversarial training.
18
+
19
+ ![](images/532cf52146221673a00f7d8064e690df7110aa3752fa5b8559f71cea00249ecd.jpg)
20
+ Figure 1: Relevance maps for models with different architectures. Three models not only predict the “stop sign” right, but also share similar relevance maps.
21
+
22
+ # CONTRIBUTIONS
23
+
24
+ • We propose a novel attack framework on relevance maps for detectors. We extend network visualization methods to detectors, find out the most suitable nodes to attack by relevance maps, and explore on the best update techniques to increase the transferability. • We evaluate RAD comprehensively and find its state-of-the-art transferability, which exceeds existing results by above $20 \%$ . Detection mAPs are more than halved, invalidating the stateof-the-art detectors to a large extent. By RAD, we create the first adversarial dataset for object detection, i.e., AOCO. As a potential benchmark, AOCO is generated from COCO and contains 10K high-transferable samples. AOCO helps to quickly evaluate and improve the robustness of detectors.
25
+
26
+ # 2 RELATED WORK
27
+
28
+ Since (Szegedy et al. (2014)), there have been lots of promising adversarial attacks (Goodfellow et al. (2015); Carlini & Wagner (2017); M ˛adry et al. (2017)). Generally, they fix the network weights and change the input slightly to optimize the attack loss. The network then predicts incorrectly on adversarial samples with a high confidence. (Papernot et al. (2016; 2017)) find that adversarial samples crafted by attacking a white-box surrogate model may transfer to other black-box models as well. Input modification (Xie et al. (2019); Dong et al. (2019); Lin et al. (2020)) or other optimization ways (Dong et al. (2018); Lin et al. (2020)) are validated to be effective in enhancing the transferability.
29
+
30
+ (Xie et al. (2017)) extends adversarial attacks to detectors. It proposes to attack on densely generated bounding boxes. After that, losses about localization and classification are designed (Li et al. (2018c)) for attacking detectors. (Lu et al. (2017)) and (Li et al. (2018a)) propose to attack detectors in a restricted area. Existing works achieve good results in white-box scenarios, but are not specifically designed for transferability. The adversarial impact on black-box models is quite limited, i.e., a 5 to $10 \%$ decrease from the original mAP, even when two models only differ in backbone (Xie et al. (2017); Li et al. (2018c;b)). (Wang et al. (2020)) discusses black-box attacks towards detectors based on queries rather than the transferability as we do. The performance is satisfactory, but it requires over 30K queries, which is easy to be discovered by the model owner. Besides, physical attacks on white-box detectors are also feasible (Huang et al. (2020); Wu et al. (2020b); Xu et al. (2020)).
31
+
32
+ For the great transferability, we propose to attack on relevance maps, which are calculated by network visualization methods (Zeiler & Fergus (2014); Selvaraju et al. (2017); Shrikumar et al. (2017)). They are originally developed to interpret how DNNs predict and help users gain trust on them. Specifically, they display how the input contributes to a certain node output in a pixel-wise manner. Typical works include Layer-wise Relevance Propagation (LRP) (Bach et al. (2015)), Contrastive LRP (Gu et al. (2018)) and Softmax Gradient LRP (SGLRP) (Iwana et al. (2019)). These methods encourage the reference of relevance maps in attack (Dong et al. (2019); Zhang & Zhu (2019); Chen et al. (2020); Wu et al. (2020a)), and also inspire us. However, none of them attack on relevance maps for detectors.
33
+
34
+ RAD differs from (Ghorbani et al. (2019); Zhang et al. (2020)) in the goal. RAD misleads detectors by suppressing relevance maps. In contrast, (Ghorbani et al. (2019)) misleads the relevance maps while keeping the prediction unchanged. (Zhang et al. (2020)) also misleads DNNs, but it keeps the relevance maps unchanged.
35
+
36
+ # 3 RELEVANCE ATTACK ON DETECTORS
37
+
38
+ We propose an attack specifically designed for black-box transferability, named Relevance Attack on Detectors (RAD). RAD suppresses multi-node relevance maps for several bounding boxes. Since the relevance map is commonly shared by different detectors as shown in Fig. 1, attacking on it in the white-box surrogate model achieves a high transferability towards black-box models. In this section, we first provide a high-level overview of RAD, and analyze the potential reasons of its transferability. Then we thoroughly discuss three crucial concrete issues in RAD.
39
+
40
+ • In Section 3.3, we specify the calculation of relevance maps for detectors, where current visualization methods are not applicable.
41
+ • In Section 3.4, we introduce the proper nodes to attack by RAD.
42
+ • In Section 3.5, we explore on the suitable techniques to update samples in RAD.
43
+
44
+ # 3.1 WHAT IS RAD?
45
+
46
+ We present the framework of RAD in Fig. 2. Initialized by the original sample $x _ { 0 }$ , the adversarial sample $x _ { k }$ in the $k ^ { \mathrm { { t h } } }$ iteration is forward propagated in the surrogate model, getting the prediction $f ( x _ { k } )$ . Current attacks generally suppress the prediction values of all attacked output nodes in $T$ . In contrast, RAD suppresses the corresponding relevance map $h ( \boldsymbol { x } _ { k } , T )$ . To restrain that, gradients of $h ( \boldsymbol { x } _ { k } , T )$ back propagate to $x _ { k }$ , which is then modified to $x _ { k + 1 }$ .
47
+
48
+ ![](images/d176c9609254b18a9a20a0467bc55eedcff17b807a627c6824363aab7ff06f3a.jpg)
49
+ Figure 2: Framework of RAD. $x _ { k }$ is the sample in iteration $k$ and $f ( x _ { k } )$ is the network prediction for it. $h ( \boldsymbol { x } _ { k } , T )$ stands for the relevance map for all attacked nodes in $T$ . RAD works by repeating processes denoted by “black”, “red” and “blue” arrows in turn.
50
+
51
+ It is notable that RAD is a complete framework to attack detectors, and its each component requires a special design. Besides the calculation of relevance maps of detectors, other components in RAD, e.g., the attacked nodes or the update techniques, also need a customized analysis. The reason is that no existing work directly attacks the relevance of detectors, and the experience in attacking predictions is not totally applicable here. For example, (Zhang & Wang (2019)) emphasizes classification loss and localization loss equally, but the former is validated to be significantly better in attacking the relevance in Section 3.4.
52
+
53
+ # 3.2 WHY RAD TRANSFERS?
54
+
55
+ RAD’s transferability comes from the attack goal: changing the common properties, i.e., the relevance maps. As shown in Fig. 3, the relevance maps are clear and structured for the original sample in both detectors. After RAD, the relevance maps are induced to be meaningless without a correct focus, leading to wrong predictions, i.e., no or false detection. Because relevance maps transfer well across models, those for black-box detectors are also significantly influenced, causing a great performance drop, which is illustrated visually in Section 4.2.
56
+
57
+ ![](images/249f41e82d757b53efe52a9a203cba6c688813a5d70a898f39c29cb9afebf958.jpg)
58
+ Figure 3: RAD’s transferability origins from the change of relevance maps. The image contains a person and a skateboard. By attacking on relevance maps, both surrogate models make extremely confusing predictions.
59
+
60
+ RAD also attacks quite “precisely”, i.e., the perturbation pattern is significantly focused on distinct areas and has a clear structure as shown in Fig. 4. That is to say, RAD accurately locates the most discriminating parts of a sample and concentrates the perturbation on them, leading to a great transferability when the perturbations is equally bounded.
61
+
62
+ ![](images/63ab5ec8395fab7e9a3955a560451309ecf40525acdc32dadc207a0abe714629.jpg)
63
+ Figure 4: The original image and the adversarial perturbations $\times 5$ in magnitude for demonstration) generated by Dfool (Lu et al. (2017)), DAG (Xie et al. (2017)), and RAD (from left to right)
64
+
65
+ 3.3 WHAT IS THE RELEVANCE MAPS FOR DETECTORS?
66
+
67
+ We analyze the potential of RAD above, below we make it feasible by addressing three crucial issues.
68
+ To conduct the relevance attack, we first need to know the relevance maps for detectors.
69
+
70
+ Currently, there have been lots of methods to calculate the relevance maps for classifiers as described in Section 2, but none of them are suitable for detectors. We take SGLRP (Iwana et al. (2019)) as an example to explain this and then to modify, because it excels in discriminating ability against irrelevant regions of a certain target node.
71
+
72
+ SGLRP visualizes how the input contributes to one output node in a pixel-wise way by backpropagating the relevance from the output to the input based on Deep Taylor Decomposition (DTD) as illustrated in Appendix A. $R ^ { ( L ) }$ is the initial relevance in the output layer $L$ and its $n ^ { \mathrm { t h } }$ component is calculated as
73
+
74
+ $$
75
+ R _ { n } ^ { ( L ) } = { \left\{ \begin{array} { l l } { y _ { n } \left( 1 - y _ { n } \right) } & { n = t , } \\ { - y _ { n } y _ { t } } & { n \neq t , } \end{array} \right. }
76
+ $$
77
+
78
+ where $y _ { n }$ is the predicted probability of class $n$ , and $y _ { t }$ is that for the single-node target $t$ . The pixel-wise relevance map $h ( x , t )$ for the single-node target $t$ is calculated by back propagating the relevance $R$ from the final layer to the input following rules specified in (Iwana et al. (2019)).
79
+
80
+ In detectors, we need the pixel-wise contributions from the input to $m$ bounding boxes. This multi-node relevance map could not be directly calculated by (1), so we naturally modify SGLRP as
81
+
82
+ $$
83
+ R _ { n } ^ { ( L ) } = \left\{ \begin{array} { l l } { y _ { n } \left( 1 - y _ { n } \right) } & { n \in T , } \\ { - \frac { 1 } { m } y _ { n } \sum _ { i = 1 } ^ { m } y _ { t _ { i } } } & { n \notin T , } \end{array} \right.
84
+ $$
85
+
86
+ where $y _ { t _ { i } }$ is the predicted probabilities for one target node $t _ { i }$ . $T$ is the set containing all target nodes $\{ t _ { 1 } , t _ { 2 } , . . . , t _ { m } \}$ . With iNNvestigate Library (Alber et al. (2019)) to implement Multi-Node SGLRP and Deep Learning platforms supporting auto-gradient, the gradients from RAD loss $L _ { \mathrm { R A D } } ( x ) = h ( x , T )$ to sample $x$ could be obtained according to the calculation rules of relevance maps in Appendix A.
87
+
88
+ We illustrate the difference between SGLRP and our Multi-Node SGLRP in Fig. 5. SGLRP only displays the relevance map for one bounding box, e.g., “TV”, “chair” and “bottle”. Multi- Node SGLRP, in contrast, visualizes the overall relevance.
89
+
90
+ ![](images/a45412ecf81682fd77f346e329b0e1b5ce65e40a7e142423efbe4588b2d04216.jpg)
91
+ Figure 5: Difference between relevance maps from SGLRP and Multi-Node SGLRP. The relevance maps are for YOLOv3 (Redmon & Farhadi (2018)).
92
+
93
+ # 3.4 WHERE TO ATTACK?
94
+
95
+ Besides the calculation of relevance maps, it is also important to choose a proper node set $T$ to attack.
96
+ Specifically, we need to select certain bounding boxes and the corresponding output nodes for RAD.
97
+
98
+ Heuristically, the most “obvious” bounding boxes are desired to be eliminated, so we select the bounding boxes with the highest confidence, following (Xie et al. (2017)). Concretely, it is feasible to statically choose $m$ bounding boxes to attack in each iteration, or dynamically attack all bounding boxes whose confidence exceeds a threshold. In our evaluation, the two strategies differ a little in performance and are not sensitive to hyper-parameter as demonstrated in Appendix C. This shows that RAD does not require a sophisticated tuning of parameters, which is user-friendly. In our following experiments, we statically attack $m = 2 0$ nodes.
99
+
100
+ After selecting bounding boxes, we could attack their size, leading them to shrink; or their localization, leading them to shift; or their confidence, leading them to be misclassified. To adopt the best strategy, we conduct a toy experiment by attacking YOLOv3 (Redmon & Farhadi (2018)), denoted as M2 and other models are specified in Appendix B. Given the results in Table 1, the classification loss induces a better black-box transferability. This may because detectors generally include a pre-trained classification as the feature extractor, and relevance maps are believed to be an indicator of success attacks (Dong et al. (2019); Zhang & Zhu (2019)).
101
+
102
+ Table 1: Detection mAP in RAD with different attacked nodes
103
+
104
+ <table><tr><td>Strategy</td><td>M1</td><td>M2</td><td>M3</td><td>M4</td><td>M5</td><td>M6</td><td>M7</td><td>M8</td><td>M9</td></tr><tr><td>No Attack</td><td>29.3</td><td>33.4</td><td>38.1</td><td>40.7</td><td>42.1</td><td>42.5</td><td>45.7</td><td>46.9</td><td>53.9</td></tr><tr><td>Size</td><td>26.0</td><td>14.7</td><td>31.9</td><td>32.5</td><td>35.6</td><td>35.4</td><td>38.6</td><td>40.0</td><td>47.8</td></tr><tr><td>Localization</td><td>22.8</td><td>6.4</td><td>27.4</td><td>28.1</td><td>31.7</td><td>30.8</td><td>34.4</td><td>35.9</td><td>45.1</td></tr><tr><td>Classification</td><td>18.1</td><td>1.2</td><td>19.9</td><td>20.5</td><td>24.3</td><td>22.6</td><td>26.4</td><td>28.2</td><td>39.9</td></tr></table>
105
+
106
+ # 3.5 HOW TO UPDATE?
107
+
108
+ By the relevance map $h ( x , T )$ for certain attacked nodes $T$ , we are able to attack, i.e., update the original sample to become adversarial with the guidance of the attack gradients $g ( x )$ as
109
+
110
+ $$
111
+ g ( x ) = \frac { \partial L _ { \mathrm { R A D } } ( x ) } { \partial x } = \frac { \partial h ( x , T ) } { \partial x } .
112
+ $$
113
+
114
+ Some update techniques are validated to be effective for enhancing the transferability in classification. For example, Scale-Invariant (SI) (Lin et al. (2020)) proposes to average the attack gradients by scale copies of the samples as
115
+
116
+ $$
117
+ g _ { \mathrm { s i } } ( x ) = \frac { 1 } { k } \sum _ { i = 0 } ^ { k } g ( x / 2 ^ { i } ) .
118
+ $$
119
+
120
+ Besides SI, Diverse Input (DI) (Xie et al. (2019)), Translation-Invariant (TI) (Dong et al. (2019)) are also promising in classification. We are curious about whether they also work well in object detection. To explore on this, we adopt these techniques in RAD as the setting suggested by their designers (see Appendix E). From the results in Table 2, we discover that SI is quite effective, further decreasing the mAP from the baseline to a large extent. Accordingly, we adopt (4) to update the sample in RAD.
121
+
122
+ Table 2: Detection mAP in RAD with different update techniques
123
+
124
+ <table><tr><td>Technique</td><td>M1</td><td>M2</td><td>M3</td><td>M4</td><td>M5</td><td>M6</td><td>M7</td><td>M8</td><td>M9</td></tr><tr><td>None</td><td>18.1</td><td>1.2</td><td>19.9</td><td>20.5</td><td>24.3</td><td>22.6</td><td>26.4</td><td>28.2</td><td>39.9</td></tr><tr><td>DI</td><td>18.1</td><td>1.0</td><td>19.9</td><td>20.5</td><td>23.9</td><td>22.4</td><td>26.3</td><td>27.9</td><td>39.6</td></tr><tr><td>TI</td><td>17.0</td><td>2.4</td><td>20.8</td><td>20.8</td><td>25.2</td><td>23.0</td><td>27.9</td><td>29.7</td><td>41.5</td></tr><tr><td>SI</td><td>14.6</td><td>0.7</td><td>16.3</td><td>17.0</td><td>20.4</td><td>19.1</td><td>22.3</td><td>23.8</td><td>35.0</td></tr></table>
125
+
126
+ With the calculated gradient, we update the sample as
127
+
128
+ $$
129
+ x _ { k + 1 } = \mathrm { c l i p } _ { \varepsilon } \left( x _ { k } - \alpha \frac { g _ { \mathrm { s i } } ( x _ { k } ) } { | | g _ { \mathrm { s i } } ( x _ { k } ) | | _ { 1 } / N } \right) ,
130
+ $$
131
+
132
+ where $\alpha$ stands for the step length. $x$ is $\ell _ { \infty }$ -norm bounded by $\varepsilon$ from the original sample in each iteration as in (Xie et al. (2019); Dong et al. (2019); Lin et al. (2020)). Gradient $g ( x )$ is normalized by its average $\ell _ { 1 }$ -norm,i.e., $| | g ( x ) | | _ { 1 } / N$ to prevent numerical errors and control the degree of perturbations. $N$ is the dimension of the image, i.e., $N = h e i g h t \times w i d t h \times c h a n n e l .$ Division by $N$ is necessary because $\ell _ { 1 }$ -norm sums all components of the tensor $x$ , which is too large as a normalization factor. We do not adopt the mainstream sign method because it is not suitable to generate small perturbations as shown in other attacks in detectors (Xie et al. (2017)).
133
+
134
+ # 4 EXPERIMENTS
135
+
136
+ In this section, we evaluate the performance of RAD, especially its transferability. The results are presented numerically and visually. In comprehensive evaluation, RAD achieves a great transferability in across models and even across tasks.
137
+
138
+ # 4.1 SETUP
139
+
140
+ Our experiments are based on Keras (Chollet et al. (2015)), Tensorflow (Abadi et al. (2015)) and PyTorch (Paszke et al. (2019)) in 4 NVIDIA GeForce RTX 2080Ti GPUs. Library iNNvestigate (Alber et al. (2019)) is used to implement Multi-Node SGLRP.
141
+
142
+ We conduct experiments on MS COCO 2017 dataset (Lin et al. (2014)), which is a large-scale benchmark for object detection, instance segmentation and image captioning. For a fair evaluation, we generate adversarial samples from all 5K samples in its validation set and test several black-box models on their mAP, a standard criteria in many works (He et al. (2017); Chen et al. (2019a)).
143
+
144
+ All attacks are conducted with the step length $\alpha = 2$ for 10 iterations and the perturbation is $\ell _ { \infty }$ - bounded in $\varepsilon = 1 6$ to guarantee the imperceptibility as in (Dong et al. (2019)). To validate that the mAP drop comes from the attack instead of resizing or perturbation, we add large Gaussian noises $( \sigma = 9$ ) to the resized images, and report it as “Ablation”.
145
+
146
+ We choose 8 typical detectors ranging from the first end-to-end detector to recent ones for attack and test. The variety of model guarantees the validity of results. We specify their information in Appendix B and the corresponding pre-processing in Appendix E.
147
+
148
+ # 4.2 VISUAL RESULTS OF RAD
149
+
150
+ We visualize several predictions on the same adversarial sample by black-box models in Fig. 6 to intuitively illustrate the transferability of RAD. The objects in the image, e.g., the laptop and keyboard, are quite large and obvious to detect. However, with a small perturbation from RAD, 5 black-box models all fail to detect the laptop, keyboard and mouse. Surprisingly, 4 of them even detect a non-existent “bed”, which is neither relevant nor similar in the image. The attack process of RAD is analyzed in Appendix F.
151
+
152
+ ![](images/f3ddcdba9a9215b81c2eaf82d628a1c96039b1c11d3762d6ba4245add204ea1f.jpg)
153
+ Figure 6: RAD has a great transferability. The same adversarial sample generated by attacking Mask R-CNN fools all 5 black-box detectors.
154
+
155
+ # 4.3 RAD’S TRANSFERABILITY IN OBJECT DETECTION
156
+
157
+ To evaluate the in-domain transferability of detection attacks and cross-domain transferability of classification attacks, we test the detection mAP of 8 models in COCO adversarial samples generated in the same setting.
158
+
159
+ For detection attacks, adversarial samples are crafted by attacking surrogate model M2 (YOLOv3 Redmon & Farhadi (2018)). Results of attacking other surrogates are reported in Appendix D. For classification attacks, we use the model output on the clean sample as the label. By several state-of-the-art attacks on surrogate classifiers (InceptionV3 Szegedy et al. (2016) here as in Xie et al. (2019); Dong et al. (2019)), the adversarial samples are generated and tested the mAP as the transferability towards detectors. Details of implementation are described in Appendix E.
160
+
161
+ We present the results in Table 3. Among the classification attacks and detection ones, cross-domain attack (Naseer et al. (2019)) is effective, but RAD is more aggressive. RAD enjoys a state-of-theart transferability towards most black-box models, outperforming other methods for above $20 \%$ . The detection mAPs are more than halved, making state-of-the-art detectors worse than the early single-shot detector (SSD Liu et al. (2016), M1).
162
+
163
+ Table 3: Detection mAP in different attacks
164
+
165
+ <table><tr><td></td><td>Method</td><td>M1</td><td>M2</td><td>M3</td><td>M4</td><td>M5</td><td>M6</td><td>M7</td><td>M8</td><td>M9</td></tr><tr><td>Reference</td><td>No Attack Ablation</td><td>29.3 24.9</td><td>33.4 31.4</td><td>38.1 31.2</td><td>40.7 31.6</td><td>42.1 35.0</td><td>42.5 34.3</td><td>45.7 37.5</td><td>46.9 38.8</td><td>53.9 48.6</td></tr><tr><td rowspan="4">Classification Attack</td><td>PGD SI-PGD</td><td>26.4 27.5</td><td>30.4 31.6</td><td>34.4 36.1</td><td>35.4 37.1</td><td>38.4</td><td>38.3</td><td>41.7</td><td>43.1</td><td>51.1</td></tr><tr><td>MI-DI-PGD</td><td>22.9</td><td>26.2</td><td></td><td></td><td>40.0</td><td>40.1</td><td>43.5</td><td>44.8</td><td>52.4</td></tr><tr><td>MI-TI-PGD</td><td></td><td></td><td>29.3</td><td>30.0</td><td>33.2</td><td>32.1</td><td>36.0</td><td>37.5</td><td>48.0</td></tr><tr><td>CD-painting</td><td>20.1 16.4</td><td>23.7 20.8</td><td>24.9 21.3</td><td>25.4 22.8</td><td>30.1 26.6</td><td>27.4 24.5</td><td>32.8 28.9</td><td>34.5 29.5</td><td>47.1 42.3</td></tr><tr><td rowspan="3">Detection Attack</td><td>CD-comics</td><td>16.6</td><td>21.6</td><td>21.7</td><td>22.7</td><td>26.8</td><td>24.3</td><td>29.1</td><td>42.3</td><td>43.7</td></tr><tr><td>Dfool</td><td>23.3</td><td>2.5</td><td>29.2</td><td>29.8</td><td>33.3</td><td>32.9</td><td>36.5</td><td>38.0</td><td>47.5</td></tr><tr><td>Loc DAG</td><td>21.9 20.8</td><td>0.2</td><td>25.8</td><td>26.6</td><td>29.8</td><td>29.4</td><td>33.2</td><td>33.2</td><td>45.2</td></tr><tr><td>Ours</td><td>RAD</td><td>14.6</td><td>0.6 0.7</td><td>22.8 16.3</td><td>23.4 17.0</td><td>26.8 20.4</td><td>25.6 19.1</td><td>28.9 22.3</td><td>31.0 23.8</td><td>40.6 35.0</td></tr></table>
166
+
167
+ The influence of $\varepsilon$ on detection mAP in RAD are displayed in Fig. 7. With the $\ell _ { \infty }$ bound increases, the resulting mAP greatly decreases for all black-box models especially for $\varepsilon$ from 8 to 12.
168
+
169
+ ![](images/a2da1b2cd3f09b13287065c5673de5c813feaeb1b97bca2660057b3e05804b22.jpg)
170
+ Figure 7: The influence of $\varepsilon$ on detection mAP in RAD
171
+
172
+ # 4.4 RAD’S TRANSFERABILITY TO INSTANCE SEGMENTATION
173
+
174
+ Detection and segmentation are similar in some aspects, so they could be implemented in one network (He et al. (2017); Cai & Vasconcelos (2018); Chen et al. (2019a)). Also, adversarial samples for object detection tend to transfer to instance segmentation (Xie et al. (2017)). Accordingly, we evaluate this cross-task transferability by RAD on surrogate detectors YOLOv3 (Redmon & Farhadi (2018), M2), RetinaNet (Lin et al. (2017), M3) and Mask R-CNN (He et al. (2017), M5). From the results in Table 4, we find that RAD also greatly hurts the performance of instance segmentation, leading to a drop on mAP of over $70 \%$ . This inspire the segmentation attackers to indirectly attack detectors.
175
+
176
+ Table 4: Segmentation mAP of RAD
177
+
178
+ <table><tr><td></td><td colspan="2">mAP</td><td colspan="2">mAP50</td><td colspan="2"></td><td colspan="2">mAP75</td><td></td></tr><tr><td> Surrogate</td><td>M5</td><td>M7</td><td>M8</td><td>M5</td><td>M7</td><td>M8</td><td>M5</td><td>M7</td><td>M8</td></tr><tr><td>None</td><td>38.0</td><td>39.4</td><td>40.8</td><td>60.6</td><td>61.3</td><td>63.3</td><td>40.9</td><td>42.9</td><td>44.1</td></tr><tr><td>Ablation</td><td>31.0</td><td>31.9</td><td>33.5</td><td>51.2</td><td>51.0</td><td>53.7</td><td>32.4</td><td>34.3</td><td>35.4</td></tr><tr><td>M2</td><td>17.9</td><td>18.6</td><td>20.3</td><td>31.6</td><td>31.7</td><td>34.5</td><td>18.0</td><td>18.9</td><td>20.7</td></tr><tr><td>M3</td><td>11.6</td><td>11.9</td><td>12.9</td><td>19.2</td><td>19.1</td><td>20.7</td><td>12.1</td><td>12.6</td><td>13.7</td></tr><tr><td>M5</td><td>1.2</td><td>11.1</td><td>11.8</td><td>2.4</td><td>17.9</td><td>18.9</td><td>1.0</td><td>11.9</td><td>12.6</td></tr></table>
179
+
180
+ # 5 ADVERSARIAL OBJECTS IN CONTEXT
181
+
182
+ Given the great transferability of RAD, we create Adversarial Objects in COntext (AOCO), the first adversarial dataset for object detection. AOCO dataset serves as a potential benchmark to evaluate the robustness of detectors, which will be beneficial to network designers. It will also be useful for adversarial training, as the most effective practice to improve the robustness of DNNs Zhang et al. (2019); Tramèr et al. (2018). Notice that there is no other adversarial dataset for detection at all. This is not because the dataset is useless, but due to the low transferability of attack methods such that the examples are detector-dependent. Now we have achieved high transferability and can then make such an adversarial dataset publicly available.
183
+
184
+ AOCO is generated from the full COCO 2017 validation set (Lin et al. (2014)) with $5 \mathrm { k }$ samples. It contains 5K adversarial samples for evaluating object detection (AOCO detection) and 5K for instance segmentation (AOCO segmentation). All 10K samples in AOCO are crafted by RAD. The surrogate model we attack is YOLOv3 for AOCO detection and Mask R-CNN for AOCO segmentation given the results in Table 3 and Table 4.
185
+
186
+ We measure the perturbation $\Delta x$ in AOCO by Root Mean Squared Error (RMSE) as in (Xie et al. (2017); Liu et al. (2017)). It is calculated as $\sqrt { \textstyle \sum _ { i } ( \Delta x _ { i } ) ^ { 2 } / N }$ in a pixel-wise way, and $N$ is the size of the image. Performance of AOCO is reported in Table 5. The RMSE in AOCO is lower than that in (Wu et al. (2019)), and the perturbation is quite imperceptible. Details and samples of AOCO are presented in Appendix G.
187
+
188
+ Table 5: Detection mAP and segmentation mAP on COCO and AOCO
189
+
190
+ <table><tr><td></td><td>RMSE</td><td>M1</td><td>M2</td><td>M3</td><td>M4</td><td>M5</td><td>M6</td><td>M7</td><td>M8</td><td>M9</td></tr><tr><td>COCO detection AOCO detection</td><td>0.000 6.469</td><td>29.3 14.6</td><td>33.4 0.7</td><td>38.1 16.3</td><td>40.7 17</td><td>42.1 20.4</td><td>42.5 19.1</td><td>45.7 22.3</td><td>46.9 23.8</td><td>53.9 35.0</td></tr><tr><td>COCO segmentation</td><td>0.000</td><td>N</td><td></td><td></td><td></td><td>38.0</td><td></td><td>39.4</td><td>40.8</td><td>\\</td></tr><tr><td> AOCO segmentation</td><td>6.606</td><td></td><td>广</td><td>广</td><td>\\</td><td>1.2</td><td>一</td><td>11.1</td><td>11.8</td><td></td></tr></table>
191
+
192
+ # 6 CONCLUSION
193
+
194
+ To pursue a high transferability, this paper proposes Relevance Attack on Detectors (RAD), which works by suppressing the multi-node relevance, a common property across detectors calculated by our Multi-Node SGLRP. We also thoroughly discuss where to attack and the how to update in attacking relevance maps. RAD achieves a state-of-the-art transferability towards 8 diverse black-box models, exceeding existing results by above $20 \%$ , and also significantly hurts the instance segmentation. Given the great transferability of RAD, we generate the first adversarial dataset for object detection, i.e., Adversarial Objects in COntext (AOCO), which helps to quickly evaluate and improve the robustness of detectors. Also, attacking other common properties is promising for a good transferability.
195
+
196
+ # REFERENCES
197
+
198
+ 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, Dandelion 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.
199
+
200
+ Maximilian Alber, Sebastian Lapuschkin, Philipp Seegerer, Miriam Hägele, Kristof T Schütt, Gré- goire Montavon, Wojciech Samek, Klaus-Robert Müller, Sven Dähne, and Pieter-Jan Kindermans. innvestigate neural networks. Journal of Machine Learning Research, 20(93):1–8, 2019.
201
+
202
+ Sebastian Bach, Alexander Binder, Grégoire Montavon, Frederick Klauschen, Klaus-Robert Müller, and Wojciech Samek. On pixel-wise explanations for non-linear classifier decisions by layer-wise relevance propagation. PloS one, 10(7), 2015.
203
+
204
+ Shumeet Baluja and Ian Fischer. Adversarial transformation networks: Learning to generate adversarial examples. arXiv preprint arXiv:1703.09387, 2017.
205
+
206
+ Wieland Brendel, Jonas Rauber, and Matthias Bethge. Decision-based adversarial attacks: Reliable attacks against black-box machine learning models. In 6th International Conference on Learning Representations, ICLR 2018, Vancouver, BC, Canada, April 30 - May 3, 2018, Conference Track Proceedings, 2018.
207
+
208
+ Zhaowei Cai and Nuno Vasconcelos. Cascade r-cnn: Delving into high quality object detection. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 6154–6162, 2018.
209
+
210
+ Nicholas Carlini and David Wagner. Towards evaluating the robustness of neural networks. In 2017 IEEE Symposium on Security and Privacy $( S P )$ , pp. 39–57. IEEE, 2017.
211
+
212
+ Kai Chen, Jiangmiao Pang, Jiaqi Wang, Yu Xiong, Xiaoxiao Li, Shuyang Sun, Wansen Feng, Ziwei Liu, Jianping Shi, Wanli Ouyang, et al. Hybrid task cascade for instance segmentation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4974–4983, 2019a.
213
+
214
+ Kai Chen, Jiaqi Wang, Jiangmiao Pang, Yuhang Cao, Yu Xiong, Xiaoxiao Li, Shuyang Sun, Wansen Feng, Ziwei Liu, Jiarui Xu, et al. Mmdetection: Open mmlab detection toolbox and benchmark. arXiv preprint arXiv:1906.07155, 2019b.
215
+
216
+ Sizhe Chen, Zhengbao He, Chengjin Sun, and Xiaolin Huang. Universal adversarial attack on attention and the resulting dataset damagenet. arXiv preprint arXiv:2001.06325, 2020.
217
+
218
+ François Chollet et al. Keras. https://keras.io, 2015.
219
+
220
+ Yinpeng Dong, Fangzhou Liao, Tianyu Pang, Hang Su, Jun Zhu, Xiaolin Hu, and Jianguo Li. Boosting adversarial attacks with momentum. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 9185–9193, 2018.
221
+
222
+ Yinpeng Dong, Tianyu Pang, Hang Su, and Jun Zhu. Evading defenses to transferable adversarial examples by translation-invariant attacks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4312–4321, 2019.
223
+
224
+ Amirata Ghorbani, Abubakar Abid, and James Zou. Interpretation of neural networks is fragile. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pp. 3681–3688, 2019.
225
+
226
+ Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. STAT, 1050:20, 2015.
227
+
228
+ Jindong Gu, Yinchong Yang, and Volker Tresp. Understanding individual decisions of cnns via contrastive backpropagation. In Asian Conference on Computer Vision, pp. 119–134. Springer, 2018.
229
+
230
+ Kaiming He, Georgia Gkioxari, Piotr Dollár, and Ross Girshick. Mask r-cnn. In Proceedings of the IEEE international conference on computer vision, pp. 2961–2969, 2017.
231
+
232
+ Lifeng Huang, Chengying Gao, Yuyin Zhou, Cihang Xie, Alan L Yuille, Changqing Zou, and Ning Liu. Universal physical camouflage attacks on object detectors. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 720–729, 2020.
233
+
234
+ Brian Kenji Iwana, Ryohei Kuroki, and Seiichi Uchida. Explaining convolutional neural networks using softmax gradient layer-wise relevance propagation. In 2019 IEEE/CVF International Conference on Computer Vision Workshops, ICCV Workshops 2019, Seoul, Korea (South), October 27-28, 2019, 2019.
235
+
236
+ Yuezun Li, Xian Bian, and Siwei Lyu. Attacking object detectors via imperceptible patches on background. CoRR, abs/1809.05966, 2018a.
237
+
238
+ Yuezun Li, Xiao Bian, Ming-Ching Chang, and Siwei Lyu. Exploring the vulnerability of single shot module in object detectors via imperceptible background patches. In 30th British Machine Vision Conference 2019, BMVC 2019, Cardiff, UK, September 9-12, 2019, 2018b.
239
+
240
+ Yuezun Li, Daniel Tian, Xiao Bian, Siwei Lyu, et al. Robust adversarial perturbation on deep proposal-based models. 2018c.
241
+
242
+ Jiadong Lin, Chuanbiao Song, Kun He, Liwei Wang, and John E Hopcroft. Nesterov accelerated gradient and scale invariance for adversarial attacks. In 8th International Conference on Learning Representations, ICLR, 2020.
243
+
244
+ 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 European Conference on Computer Vision, pp. 740–755. Springer, 2014.
245
+
246
+ Tsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He, and Piotr Dollár. Focal loss for dense object detection. In Proceedings of the IEEE international conference on computer vision, pp. 2980–2988, 2017.
247
+
248
+ Wei Liu, Dragomir Anguelov, Dumitru Erhan, Christian Szegedy, Scott Reed, Cheng-Yang Fu, and Alexander C Berg. Ssd: Single shot multibox detector. In European Conference on Computer Vision, pp. 21–37. Springer, 2016.
249
+
250
+ Yanpei Liu, Xinyun Chen, Chang Liu, and Dawn Song. Delving into transferable adversarial examples and black-box attacks. In Proceedings of 5th International Conference on Learning Representations, 2017.
251
+
252
+ Jiajun Lu, Hussein Sibai, and Evan Fabry. Adversarial examples that fool detectors. arXiv preprint arXiv:1712.02494, 2017.
253
+
254
+ Aleksander M ˛adry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. STAT, 1050:9, 2017.
255
+
256
+ Muhammad Muzammal Naseer, Salman H Khan, Muhammad Haris Khan, Fahad Shahbaz Khan, and Fatih Porikli. Cross-domain transferability of adversarial perturbations. In Advances in Neural Information Processing Systems, pp. 12905–12915, 2019.
257
+
258
+ Nicolas Papernot, Patrick McDaniel, and Ian Goodfellow. Transferability in machine learning: from phenomena to black-box attacks using adversarial samples. arXiv preprint arXiv:1605.07277, 2016.
259
+
260
+ Nicolas Papernot, Patrick McDaniel, Ian Goodfellow, Somesh Jha, Z Berkay Celik, and Ananthram Swami. Practical black-box attacks against machine learning. In Proceedings of the 2017 ACM on Asia Conference on Computer and Communications Security, pp. 506–519. ACM, 2017.
261
+
262
+ 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. In Advances in Neural Information Processing Systems, pp. 8024–8035, 2019.
263
+
264
+ Joseph Redmon and Ali Farhadi. Yolov3: An incremental improvement. arXiv preprint arXiv:1804.02767, 2018.
265
+
266
+ Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster r-cnn: Towards real-time object detection with region proposal networks. In Advances in Neural Information Processing Systems, pp. 91–99, 2015.
267
+
268
+ Ramprasaath R Selvaraju, Michael Cogswell, Abhishek Das, Ramakrishna Vedantam, Devi Parikh, and Dhruv Batra. Grad-cam: Visual explanations from deep networks via gradient-based localization. In Proceedings of the IEEE International Conference on Computer Vision, pp. 618–626, 2017.
269
+
270
+ Avanti Shrikumar, Peyton Greenside, and Anshul Kundaje. Learning important features through propagating activation differences. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 3145–3153. JMLR. org, 2017.
271
+
272
+ Dong Su, Huan Zhang, Hongge Chen, Jinfeng Yi, Pin-Yu Chen, and Yupeng Gao. Is robustness the cost of accuracy?–a comprehensive study on the robustness of 18 deep image classification models. In Proceedings of the European Conference on Computer Vision (ECCV), 2018.
273
+
274
+ Jiawei Su, Danilo Vasconcellos Vargas, and Kouichi Sakurai. One pixel attack for fooling deep neural networks. IEEE Transactions on Evolutionary Computation, 2019.
275
+
276
+ Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian J. Goodfellow, and Rob Fergus. Intriguing properties of neural networks. In 2nd International Conference on Learning Representations, ICLR 2014, Banff, AB, Canada, April 14-16, 2014, Conference Track Proceedings, 2014.
277
+
278
+ Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2818–2826, 2016.
279
+
280
+ Mingxing Tan, Ruoming Pang, and Quoc V Le. Efficientdet: Scalable and efficient object detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10781–10790, 2020.
281
+
282
+ Simen Thys, Wiebe Van Ranst, and Toon Goedemé. Fooling automated surveillance cameras: adversarial patches to attack person detection. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition Workshops, 2019.
283
+
284
+ Florian Tramèr, Alexey Kurakin, Nicolas Papernot, Ian J. Goodfellow, Dan Boneh, and Patrick D. McDaniel. Ensemble adversarial training: Attacks and defenses. In 6th International Conference on Learning Representations, ICLR 2018, Vancouver, BC, Canada, April 30 - May 3, 2018, Conference Track Proceedings, 2018.
285
+
286
+ Yajie Wang, Yu-an Tan, Wenjiao Zhang, Yuhang Zhao, and Xiaohui Kuang. An adversarial attack on dnn-based black-box object detectors. Journal of Network and Computer Applications, pp. 102634, 2020.
287
+
288
+ Dongxian Wu, Yisen Wang, Shutao Xia, James Bailey, and Xingjun Ma. Skip connections matter: On the transferability of adversarial examples generated with resnets. In Proceedings of the International Conference on Learning Representations, 2019.
289
+
290
+ Weibin Wu, Yuxin Su, Xixian Chen, Shenglin Zhao, Irwin King, Michael R Lyu, and Yu-Wing Tai. Boosting the transferability of adversarial samples via attention. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 1161–1170, 2020a.
291
+
292
+ Zuxuan Wu, Ser-Nam Lim, Larry S Davis, and Tom Goldstein. Making an invisibility cloak: Real world adversarial attacks on object detectors. In European Conference on Computer Vision, pp. 1–17. Springer, 2020b.
293
+
294
+ Cihang Xie, Jianyu Wang, Zhishuai Zhang, Yuyin Zhou, Lingxi Xie, and Alan Yuille. Adversarial examples for semantic segmentation and object detection. In Proceedings of the IEEE International Conference on Computer Vision, pp. 1369–1378, 2017.
295
+
296
+ Cihang Xie, Zhishuai Zhang, Yuyin Zhou, Song Bai, Jianyu Wang, Zhou Ren, and Alan L Yuille. Improving transferability of adversarial examples with input diversity. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2730–2739, 2019.
297
+
298
+ Kaidi Xu, Gaoyuan Zhang, Sijia Liu, Quanfu Fan, Mengshu Sun, Hongge Chen, Pin-Yu Chen, Yanzhi Wang, and Xue Lin. Adversarial t-shirt! evading person detectors in a physical world. In European Conference on Computer Vision, pp. 665–681. Springer, 2020.
299
+
300
+ Matthew D Zeiler and Rob Fergus. Visualizing and understanding convolutional networks. In European Conference on Computer Vision, pp. 818–833. Springer, 2014.
301
+
302
+ Dinghuai Zhang, Tianyuan Zhang, Yiping Lu, Zhanxing Zhu, and Bin Dong. You only propagate once: Painless adversarial training using maximal principle. arXiv preprint arXiv:1905.00877, 2019.
303
+
304
+ Haichao Zhang and Jianyu Wang. Towards adversarially robust object detection. In Proceedings of the IEEE International Conference on Computer Vision, pp. 421–430, 2019.
305
+
306
+ Tianyuan Zhang and Zhanxing Zhu. Interpreting adversarially trained convolutional neural networks. In Proceedings of the 36th International Conference on Machine Learning, ICML 2019, 9-15 June 2019, Long Beach, California, USA, pp. 7502–7511, 2019.
307
+
308
+ Xinyang Zhang, Ningfei Wang, Hua Shen, Shouling Ji, Xiapu Luo, and Ting Wang. Interpretable deep learning under fire. In 29th {USENIX} Security Symposium ({USENIX} Security 20), 2020.
309
+
310
+ # A RELEVANCE BACK-PROPAGATION RULES (DTD)
311
+
312
+ DTD-based network visualization methods, such as LRP, CLRP and SGLRP, back-propagate the relevance from the output layer to the input layer according to the rules specified in this section. Their only difference is the relevance in the initial output layer $\bar { R } _ { n } ^ { ( L ) }$ .
313
+
314
+ For each layer $l$ in a DNN with $L$ layers in total, suppose layer $l$ has $N$ nodes and layer $l + 1$ has $M$ nodes, the relevance $R _ { n } ^ { ( L ) }$ at node $n$ in layer $l$ is defined recursively by
315
+
316
+ $$
317
+ R _ { n } ^ { ( l ) } = \sum _ { m } \frac { a _ { n } ^ { ( l ) } w _ { n , m } ^ { + ( l ) } } { \sum _ { n ^ { \prime } } a _ { n ^ { \prime } } ^ { ( l ) } w _ { n ^ { \prime } , m } ^ { + ( l ) } } R _ { m } ^ { ( l + 1 ) } ,
318
+ $$
319
+
320
+ for nodes with definite positive values (such as after ReLU), and
321
+
322
+ $$
323
+ R _ { n } ^ { ( l ) } = \sum _ { m } \frac { z _ { n } ^ { ( l ) } w _ { n , m } ^ { ( l ) } - b _ { n } ^ { ( l ) } w _ { n , m } ^ { + ( l ) } - h _ { n } ^ { ( l ) } w _ { n , m } ^ { - ( l ) } } { \sum _ { n ^ { \prime } } z _ { n ^ { \prime } } ^ { ( l ) } w _ { n ^ { \prime } , m } ^ { ( l ) } - b _ { n ^ { \prime } } ^ { ( l ) } w _ { n ^ { \prime } , m } ^ { + ( l ) } - h _ { n ^ { \prime } } ^ { ( l ) } w _ { n ^ { \prime } , m } ^ { - ( l ) } } R _ { m } ^ { ( l + 1 ) } ,
324
+ $$
325
+
326
+ for nodes that may have negative values. In the formulas above, $a _ { n } ^ { ( l ) }$ is the post-activation output of node in layer $l$ and $z _ { n } ^ { ( l ) }$ is the pre-activation one. The range $[ b _ { n } ^ { ( l ) } , h _ { n } ^ { ( l ) } ]$ stands for the minimum and maximum of $z _ { n } ^ { ( l ) }$ . Finally, $w _ { n , m } ^ { + ( l ) } = \operatorname* { m a x } \left( w _ { n , m , 0 } ^ { ( l ) } \right)$ and $w _ { n , m } ^ { - ( l ) } = \operatorname* { m i n } \left( w _ { n , m , 0 } ^ { ( l ) } \right)$ .
327
+
328
+ According to the propagation rules above as mentioned in (Iwana et al. (2019)), we could naturally obtain the attack gradients as
329
+
330
+ $$
331
+ \frac { \partial R _ { m } ^ { ( l + 1 ) } } { \partial R _ { n } ^ { ( l ) } } = \left\{ \begin{array} { l l } { \big ( \sum _ { m } \frac { a _ { n } ^ { ( l ) } w _ { n , m } ^ { + ( l ) } } { \sum _ { n ^ { \prime } } a _ { n ^ { \prime } } ^ { ( l ) } w _ { n ^ { \prime } , m } ^ { + ( l ) } } \big ) ^ { - 1 } , \mathrm { f o r ~ n o d e s ~ w i t h ~ d e f i n i t e ~ p o s i t i v e ~ v a l u e s } } \\ { \big ( \sum _ { m } \frac { z _ { n } ^ { ( l ) } w _ { n , m } ^ { ( l ) } - b _ { n } ^ { ( l ) } w _ { n , m } ^ { + ( l ) } - h _ { n } ^ { ( l ) } w _ { n , m } ^ { - ( l ) } } { \sum _ { n ^ { \prime } } z _ { n ^ { \prime } } ^ { ( l ) } w _ { n ^ { \prime } , m } ^ { ( l ) } - b _ { n ^ { \prime } } ^ { ( l ) } w _ { n ^ { \prime } , m } ^ { + ( l ) } - h _ { n ^ { \prime } } ^ { ( l ) } w _ { n ^ { \prime } , m } ^ { - ( l ) } } \big ) ^ { - 1 } , \mathrm { o t h e r w i s e } } \end{array} \right. .
332
+ $$
333
+
334
+ # B MODEL INFORMATION
335
+
336
+ Table 6 presents the models’ information from our evaluation and MMdetection (Chen et al. (2019b)).
337
+
338
+ Table 6: Model backbone and mAPs
339
+
340
+ <table><tr><td>ID</td><td>Model</td><td>Backbone</td><td>mAP</td></tr><tr><td>M1</td><td>SSD512 (Liu et al. (2016))</td><td>VGG16</td><td>29.3</td></tr><tr><td>M2</td><td>YOLOv3 (Redmon &amp; Farhadi (2018))</td><td>Darknet</td><td>33.4</td></tr><tr><td>M3</td><td>RetinaNet (Lin et al. (2017))</td><td>ResNet-101</td><td>38.1</td></tr><tr><td>M4</td><td>Faster R-CNN (Ren et al. (2015))</td><td>ResNeXt-101-64*4d</td><td>40.7</td></tr><tr><td>M5</td><td>Mask R-CNN (He et al. (2017))</td><td>ResNeXt-101-64*4d</td><td>42.1</td></tr><tr><td>M6</td><td>Cascade RCNN (Cai &amp; Vasconcelos (2018))</td><td>ResNet-101</td><td>42.5</td></tr><tr><td>M7</td><td>Cascade Mask R-CNN (Cai &amp; Vasconcelos (2018))</td><td>ResNeXt-101-64*4d</td><td>45.7</td></tr><tr><td>M8</td><td>Hyrbrid Task Cascade (Chen et al. (2019a))</td><td>ResNeXt-101-64*4d</td><td>46.9</td></tr><tr><td>M9</td><td>EfficientDet (Tan et al. (2020))</td><td>EfficientNet+BiFPN</td><td>53.9</td></tr></table>
341
+
342
+ # C INFLUENCE OF HYPER-PARAMETERS IN NODE SELECTION
343
+
344
+ Performance of RAD is not sensitive to hyper-parameter, no matter the strategy to select bounding boxes is dynamic or static as Table 7. Attackers are not bothered to tune them carefully. The parameter for dynamic strategy refers to the pre-softmax confidence threshold to select a bounding box. The parameter for static strategy refers to the fixed number of selected bounding boxes in each iteration.
345
+
346
+ # D RAD ON MORE SURROGATES
347
+
348
+ The results on attacking more surrogates by RAD are reported in Table 8.
349
+
350
+ Table 7: Detection mAP in different hyper-parameters in RAD
351
+
352
+ <table><tr><td>Strategy</td><td>Parameter</td><td>M1</td><td>M2</td><td>M3</td><td>M4</td><td>M5</td><td>M6</td><td>M7</td><td>M8</td><td>M9</td></tr><tr><td rowspan="3">Dynamic</td><td>-1</td><td>18.3</td><td>1.2</td><td>20.0</td><td>20.6</td><td>24.3</td><td>22.8</td><td>26.7</td><td>28.3</td><td>40.0</td></tr><tr><td>-2</td><td>18.2</td><td>1.2</td><td>20.1</td><td>20.7</td><td>24.2</td><td>22.8</td><td>26.6</td><td>28.0</td><td>39.8</td></tr><tr><td>-3</td><td>18.4</td><td>1.3</td><td>20.3</td><td>20.8</td><td>24.3</td><td>22.9</td><td>26.7</td><td>28.5</td><td>40.2</td></tr><tr><td rowspan="3">Static</td><td>10</td><td>18.2</td><td>1.1</td><td>19.9</td><td>20.5</td><td>24.2</td><td>22.8</td><td>26.2</td><td>28.0</td><td>39.8</td></tr><tr><td>20</td><td>18.1</td><td>1.2</td><td>19.9</td><td>20.5</td><td>24.3</td><td>22.6</td><td>26.4</td><td>28.2</td><td>39.9</td></tr><tr><td>30</td><td>18.2</td><td>1.3</td><td>20.1</td><td>20.7</td><td>24.3</td><td>22.8</td><td>26.0</td><td>27.9</td><td>40.1</td></tr></table>
353
+
354
+ Table 8: Detection mAP of RAD on different surrogates
355
+
356
+ <table><tr><td> Surrogate</td><td>M1</td><td>M2</td><td>M3</td><td>M4</td><td>M5</td><td>M6</td><td>M7</td><td>M8</td><td>M9</td></tr><tr><td>YOLOv3</td><td>14.6</td><td>0.7</td><td>16.3</td><td>17.0</td><td>20.4</td><td>19.1</td><td>22.3</td><td>23.8</td><td>35.0</td></tr><tr><td>Mask R-CNN</td><td>20.4</td><td>24.2</td><td>25.7</td><td>26.5</td><td>1.1</td><td>28.9</td><td>33.1</td><td>34.9</td><td>45.4</td></tr><tr><td>RetinaNet</td><td>20.7</td><td>6.1</td><td>2.3</td><td>25.7</td><td>29.3</td><td>28.2</td><td>31.7</td><td>33.8</td><td>44.1</td></tr></table>
357
+
358
+ # E IMPLEMENTATION DETAILS
359
+
360
+ # E.1 PRE-PROCESSING
361
+
362
+ To pre-process, we resize the image with its long side as 416 for YOLOv3 or RetinaNet and 448 for Mask R-CNN, and then zero-pad it to a square. The resolution is kept relatively the same for a fair evaluation. Images are normalized to [0,1] in YOLOv3 or subtracted by the mean of COCO training set in RetinaNet and Mask R-CNN. Accordingly, samples in AOCO detection have the long side 416 and that for AOCO segmentation is 448.
363
+
364
+ # E.2 TRANSFER-ENHANCING UPDATE TECHNIQUES
365
+
366
+ DI (Xie et al. (2019)) transforms the image for 4 times with probability $p$ $\mathbf { \boldsymbol { p } } = 1$ for better transferability as suggested) and averaging the gradients. The transformation is to resize the image to $0 . 9 \times$ its size and randomly padding the outer areas with white pixels. SI (Lin et al. (2020)) divides the sample numerically by the power 2 for 4 times and averages the 4 obtained gradients. TI (Dong et al. (2019)) translates the image to calculate the augmented gradients. To implement it efficiently, it adopts a kernel to simulate the averaging of gradients. We choose the kernel size 15 as suggested. MI (Dong et al. (2018)) uses momentum optimization (parameter $\mu = 1$ as suggested) for a better transferability and a faster attack. Cross-domain attack (Naseer et al. (2019)) uses extra datasets (paintings, denoted as CD-paintings, and comics, denoted as CD-comics) to train a perturbation generator with the relative loss. The adopted surrogate model is also InceptionV3 for consistency. All perturbations are resized to fit the sample size.
367
+
368
+ # E.3 DETECTION ATTACKS
369
+
370
+ For DAG (Xie et al. (2017)), we follow the setting of generating dense proposals. The classification probabilities of 3000 bounding boxes with highest confidence are attacked. But we alter its optimization to (5) because its original update produces quite small perturbation, leading to a poor transferability, which is unfair for comparison. Dfool (Lu et al. (2017)) suppresses the classification confidence for the original bounding boxes, which is the same in our experiment. Localization loss is shown to be useful in (Zhang & Wang (2019)), and here we suppress the width and height of the original bounding boxes.
371
+
372
+ # F VISUAL RESULTS OF RAD PROCESS
373
+
374
+ By RAD, the relevance map is attacked to be meaningless and loss its focus. In Fig. 8, the initial prediction is correct and the relevance map is clear. RAD constantly misleads the relevance map to be unstructured without outline of objects. Finally, all bounding boxes vanish.
375
+
376
+ ![](images/95ea87cc03ebb9e5d0232975306185915289b6e281665271ac23ef4ee01c0c56.jpg)
377
+ Figure 8: Transition of prediction and relevance map in RAD (from top to bottom and left to right).
378
+
379
+ # G MORE ABOUT AOCO
380
+
381
+ We report the mAP50 and mAP75 of AOCO in Table 9 and Table 10. We show in Fig. 9 the visual comparative results.
382
+
383
+ Table 9: Detection mAP50 and segmentation mAP50 on COCO and AOCO
384
+
385
+ <table><tr><td></td><td>M1</td><td>M2</td><td>M3</td><td>M4</td><td>M5</td><td>M6</td><td>M7</td><td>M8</td><td>M9</td></tr><tr><td>COCO detection AOCO detection</td><td>49.2 26.7</td><td>56.4 1.6</td><td>58.1 27.6</td><td>62.0 29.1</td><td>63.8 34.5</td><td>60.7 29.9</td><td>64.1 34.3</td><td>66.0 37.4</td><td>74.3 51.7</td></tr><tr><td>COCO segmentation</td><td></td><td></td><td>人</td><td>一</td><td>60.6</td><td>一</td><td>61.3</td><td>63.3</td><td>一</td></tr><tr><td>AOCO segmentation</td><td></td><td></td><td></td><td></td><td>2.4</td><td>一</td><td>17.9</td><td>18.9</td><td>一</td></tr></table>
386
+
387
+ Table 10: Detection mAP75 and segmentation mAP75 on COCO and AOCO
388
+
389
+ <table><tr><td></td><td>M1</td><td>M2</td><td>M3</td><td>M4</td><td>M5</td><td>M6</td><td>M7</td><td>M8</td><td>M9</td></tr><tr><td>COCO detection AOCO detection</td><td>30.8 14.2</td><td>35.8 0.6</td><td>40.6 16.5</td><td>44.6 17.1</td><td>46.3 20.8</td><td>46.3 19.9</td><td>50.0 23.3</td><td>51.2 24.6</td><td>59.9 37.4</td></tr><tr><td>COCO segmentation</td><td></td><td></td><td>/</td><td>/</td><td>40.9</td><td>一</td><td>42.9</td><td>44.1</td><td>一</td></tr><tr><td>AOCO segmentation</td><td></td><td></td><td></td><td></td><td>1.0</td><td>/</td><td>11.9</td><td>12.6</td><td></td></tr></table>
390
+
391
+ ![](images/93f75b8037c78908db07fd96e74d56484522f7c49490b9643c1b77d5e76d509b.jpg)
392
+ Figure 9: Detection and segmentation results in COCO and AOCO by YOLOv3 and Mask R-CNN. For COCO, both networks predict correctly. For AOCO segmentation results, the top image contains two big masks for “chair” and “potted plan”; the second image contains one false mask for “sports ball”; the bottom image contains “dog” in green, “car” in purple and “elephant” in red.
md/train/cu7IUiOhujH/cu7IUiOhujH.md ADDED
@@ -0,0 +1,283 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SUPERVISED CONTRASTIVE LEARNING FOR PRE-TRAINED LANGUAGE MODEL FINE-TUNING
2
+
3
+ Beliz Gunel†∗, Jingfei $\mathbf { D } \mathbf { u } ^ { \ddag }$ , Alexis Conneau‡, Ves Stoyanov‡ †Stanford University, $^ \ddag$ Facebook AI
4
+
5
+ # ABSTRACT
6
+
7
+ State-of-the-art natural language understanding classification models follow twostages: pre-training a large language model on an auxiliary task, and then finetuning the model on a task-specific labeled dataset using cross-entropy loss. However, the cross-entropy loss has several shortcomings that can lead to sub-optimal generalization and instability. Driven by the intuition that good generalization requires capturing the similarity between examples in one class and contrasting them with examples in other classes, we propose a supervised contrastive learning (SCL) objective for the fine-tuning stage. Combined with cross-entropy, our proposed SCL loss obtains significant improvements over a strong RoBERTa-Large baseline on multiple datasets of the GLUE benchmark in few-shot learning settings, without requiring specialized architecture, data augmentations, memory banks, or additional unsupervised data. Our proposed fine-tuning objective leads to models that are more robust to different levels of noise in the fine-tuning training data, and can generalize better to related tasks with limited labeled data.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ State-of-the-art for most existing natural language processing (NLP) classification tasks is achieved by models that are first pre-trained on auxiliary language modeling tasks and then fine-tuned on the task of interest with cross-entropy loss (Radford et al., 2019; Howard & Ruder, 2018; Liu et al., 2019; Devlin et al., 2019). Although ubiquitous, the cross-entropy loss – the KL-divergence between one-hot vectors of labels and the distribution of model’s output logits – has several shortcomings. Cross entropy loss leads to poor generalization performance (Liu et al., 2016; Cao et al., 2019), and it lacks robustness to noisy labels (Zhang & Sabuncu, 2018; Sukhbaatar et al., 2015) or adversarial examples (Elsayed et al., 2018; Nar et al., 2019). Effective alternatives have been proposed to modify the reference label distributions through label smoothing (Szegedy et al., 2016; Muller et al., 2019), ¨ Mixup (Zhang et al., 2018), CutMix (Yun et al., 2019), knowledge distillation (Hinton et al., 2015) or self-training (Yalniz et al., 2019; Xie et al., 2020).
12
+
13
+ Fine-tuning using cross entropy loss in NLP also tends to be unstable across different runs (Zhang et al., 2020; Dodge et al., 2020), especially when supervised data is limited, a scenario in which pre-training is particularly helpful. To tackle the issue of unstable fine-tuning and poor generalization, recent works propose local smoothness-inducing regularizers (Jiang et al., 2020) and regularization methods inspired by the trust region theory (Aghajanyan et al., 2020) to prevent representation collapse. Empirical evidence suggests that fine-tuning for more iterations, reinitializing top few layers (Zhang et al., 2020), and using debiased Adam optimizer during fine-tuning (Mosbach et al., 2020) can make the fine-tuning stage more stable.
14
+
15
+ Inspired by the learning strategy that humans utilize when given a few examples, we seek to find the commonalities between the examples of each class and contrast them with examples from other classes. We hypothesize that a similarity-based loss will be able to hone in on the important dimensions of the multidimensional hidden representations hence lead to better few-shot learning results and be more stable while fine-tuning pre-trained language models. We propose a novel objective for fine-tuning that includes a supervised contrastive learning (SCL) term that pushes the examples from the same class close and the examples from different classes further apart. The SCL term is similar to the contrastive objectives used in self-supervised representation learning across image, speech, and video domains. (Sohn, 2016; Oord et al., 2018; Wu et al., 2018; Bachman et al., 2019; Henaff et al., 2019; Baevski et al., 2020; Conneau et al., 2020; Tian et al., 2020; Hjelm et al., ´ 2019; Han et al., 2019; He et al., 2020; Misra & Maaten, 2020; Chen et al., 2020a;b). Unlike these methods, however, we use a contrastive objective for supervised learning of the final task, instead of contrasting different augmented views of examples.
16
+
17
+ In few-shot learning settings (20, 100, 1000 labeled examples), the addition of the SCL term to the finetuning objective significantly improves the performance on several natural language understanding classification tasks from the popular GLUE benchmark (Wang et al., 2019) over the very strong baseline of fine-tuning RoBERTa-Large with cross-entropy loss only. Furthermore, pre-trained language models fine-tuned with our proposed objective are not only robust to noise in the fine-tuning training data, but can also exhibit improved generalization to related tasks with limited labeled task data. Our approach does not require any specialized network architectures (Bachman et al., 2019; Henaff et al., 2019), memory banks (Wu et al., 2018; Tian et al., 2020; Misra & Maaten, 2020), data ´ augmentation of any kind, or additional unsupervised data. To the best of our knowledge, our work is the first to successfully integrate a supervised contrastive learning objective for fine-tuning pre-trained language models. We empirically demonstrate that the new objective has desirable properties across several different settings. Our contributions in this work are listed in the following:
18
+
19
+ • We propose a novel objective for fine-tuning pre-trained language models that includes a supervised contrastive learning term, as described in Section 2.
20
+
21
+ • We obtain strong improvements in the few-shot learning settings (20, 100, 1000 labeled examples) as shown in Table 2, leading up to 10.7 points improvement on a subset of GLUE benchmark tasks (SST-2, QNLI, MNLI) for the 20 labeled example few-shot setting, over a very strong baseline – RoBERTa-Large fine-tuned with cross-entropy loss.
22
+
23
+ • We demonstrate that our proposed fine-tuning objective is more robust, in comparison to RoBERTa-Large fine-tuned with cross-entropy loss, across augmented noisy training datasets (used to fine-tune the models for the task of interest) with varying noise levels as shown in Table 3 – leading up to 7 points improvement on a subset of GLUE benchmark tasks (SST-2, QNLI, MNLI) across augmented noisy training datasets. We use a backtranslation model to construct the augmented noisy training datasets of varying noise levels (controlled by the temperature parameter), as described in detail in Section 4.2.
24
+
25
+ • We show that the task-models fine-tuned with our proposed objective have improved generalizability to related tasks despite having limited availability of labeled task data (Table 7). This led to a 2.9 point improvement on Amazon-2 over the task model fine-tuned with cross-entropy loss only. Moreover, it considerably reduced the variance across few-shot training samples, when transferred from the source SST-2 sentiment analysis task model.
26
+
27
+ # 2 APPROACH
28
+
29
+ We propose a novel objective that includes a supervised contrastive learning term for fine-tuning pre-trained language models. The loss is meant to capture the similarities between examples of the same class and contrast them with the examples from other classes.
30
+
31
+ For a multi-class classification problem with C classes, we work with a batch of training examples of size N, $\{ x _ { i } , y _ { i } \} _ { i = 1 , \dots N }$ . $\Phi ( \cdot ) \in \mathbf { R } ^ { d }$ denotes an encoder that outputs the $l _ { 2 }$ normalized final encoder hidden layer before the softmax projection; $N _ { y _ { i } }$ is the total number of examples in the batch that have the same label as $y _ { i }$ ; $\tau > 0$ is an adjustable scalar temperature parameter that controls the separation of classes; $y _ { i , c }$ denotes the label and $\hat { y } _ { i , c }$ denotes the model output for the probability of the ith example belonging to the class $\mathrm { c }$ ; $\lambda$ is a scalar weighting hyperparameter that we tune for each downstream task and setting. The overall loss is then given in the following:
32
+
33
+ $$
34
+ \begin{array} { l } { { \displaystyle { \mathcal { L } } = ( 1 - \lambda ) { \mathcal { L } } _ { C E } + \lambda { \mathcal { L } } _ { S C L } } } \\ { { \displaystyle { \mathcal { L } } _ { C E } = - \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \sum _ { c = 1 } ^ { C } y _ { i , c } \cdot l o g \hat { y } _ { i , c } } } \\ { { \displaystyle { \mathcal { L } } _ { S C L } = \sum _ { i = 1 } ^ { N } - \frac { 1 } { N _ { y _ { i } } - 1 } \sum _ { j = 1 } ^ { N } \mathbf { 1 } _ { i \neq j } \mathbf { 1 } _ { y _ { i } = y _ { j } } \log \frac { \exp { \left( \Phi ( x _ { i } ) \cdot \Phi ( x _ { j } ) / \tau \right) } } { \sum _ { k = 1 } ^ { N } \mathbf { 1 } _ { i \neq k } \exp { \left( \Phi ( x _ { i } ) \cdot \Phi ( x _ { k } ) / \tau \right) } } } } \end{array}
35
+ $$
36
+
37
+ The overall loss is a weighted average of CE and the proposed SCL loss, as given in the equation (1). The canonical definition of the multi-class CE loss that we use is given in equation (2). The novel SCL loss is given in the equation (3).
38
+
39
+ This loss can be applied using a variety of encoders $\Phi ( \cdot ) \in \mathbf { R } ^ { d }$ – for example a ResNet for a computer vision application or a pre-trained language model such as BERT for an NLP application. In this work, we focus on fine-tuning pre-trained language models for single sentence and sentence-pair classification settings. For single sentence classification, each example $x _ { i }$ consists of sequence of tokens prepended with the special $[ C L S ]$ token $\boldsymbol { x } _ { i } = [ [ C L S ] , t _ { 1 } , t _ { 2 } , \ldots , t _ { L } , [ E O S ] ]$ . The length of sequence $\mathrm { L }$ is constrained such that $L < L _ { \operatorname* { m a x } }$ . Similarly, for sentence-pair classification tasks, each example $x _ { i }$ is a concatenation of two sequences of tokens $[ t _ { 1 } , t _ { 2 } , \dots t _ { L } ]$ and $[ s _ { 1 } , s _ { 2 } , \ldots , s _ { M } ]$ corresponding to the sentences with special tokens delimiting them: $x _ { i } =$ $[ [ C L S ] , t _ { 1 } , t _ { 2 } , \ldots , { \dot { t } } _ { L } , [ S E P ] , s _ { 1 } , s _ { 2 } , \ldots , s _ { M } , [ E O S ] ]$ . The length of concatenated sequences is constrained such that $L + M < L _ { \mathrm { m a x } }$ . In both cases, $\Phi ( x _ { i } ) \in \mathbf { R } ^ { d }$ uses the embedding of $[ C L S ]$ token as the representation for example $x _ { i }$ . These choices follow standard practices for fine-tuning pre-trained language models for classification (Devlin et al., 2019; Liu et al., 2019).
40
+
41
+ ![](images/c9a8a1dce5fa66838468183bbcb2d27b4d98f5b31ccbe51fd45a5a661dda426f.jpg)
42
+ Figure 1: Our proposed objective includes a cross-entropy term (CE) and a supervised contrastive learning (SCL) term, and it is formulated to push examples from the same class close and examples from different classes further apart. We show examples from the SST-2 sentiment analysis dataset from the GLUE benchmark, where class A (shown in red) is negative movie reviews and class B (shown in blue) is positive movie reviews. Although we show a binary classification case for simplicity, the loss is generally applicable to any multi-class classification setting.
43
+
44
+ Empirical observations show that both $l _ { 2 }$ normalization of the encoded embedding representations and an adjustable scalar temperature parameter $\tau$ improve performance. Lower temperature increases the influence of examples that are harder to separate, effectively creating harder negatives. Using hard negatives has been previously shown to improve performance in the context of margin-based loss formulations such as triplet loss (Schroff et al., 2015). The empirical behavior of the adjustable temperature parameter is consistent with the observations of previous work related to supervised contrastive learning. (Chen et al., 2020a; Khosla et al., 2020).
45
+
46
+ Relationship to Self-Supervised Contrastive Learning Self-supervised contrastive learning has shown success in learning powerful representations, particularly in the computer vision domain. (Chen et al., 2020a; He et al., 2020; Tian et al., 2020; Mnih & Kavukcuoglu, 2013; Gutmann & Hyvarinen, ¨ 2012; Kolesnikov et al., 2019) Self-supervised learning methods do not require any labeled data; instead they sample a mini batch from unsupervised data and create positive and negative examples from these samples using strong data augmentation techniques such as AutoAugment (Cubuk et al., 2019) or RandAugment (Cubuk et al., 2020) for computer vision. Positive examples are constructed by applying data augmentation to the same example (cropping, flipping, etc. for an image), and negative examples are simply all the other examples in the sampled mini batch. Intuitively, selfsupervised contrastive objectives are learning representations that are invariant to different views of positive pairs; while maximizing the distance between negative pairs. The distance metric used is often the inner product or the Euclidean distance between vector representations of the examples.
47
+
48
+ For a batch of size N, self-supervised contrastive loss is defined as:
49
+
50
+ $$
51
+ \mathcal { L } _ { s e l f } = \sum _ { i = 1 } ^ { 2 N } - \log \frac { \exp { ( \Phi ( x _ { 2 i - 1 } ^ { \prime } ) \cdot \Phi ( x _ { 2 i } ^ { \prime } ) / \tau ) } } { \sum _ { k = 1 } ^ { 2 N } \mathbf { 1 } _ { i \neq k } \exp { ( \Phi ( x _ { i } ^ { \prime } ) \cdot \Phi ( x _ { k } ^ { \prime } ) / \tau ) } }
52
+ $$
53
+
54
+ where $\Phi ( \cdot ) \in \mathbf { R } ^ { d }$ denotes an encoder that outputs the $l _ { 2 }$ normalized final encoder hidden layer before the softmax projection; $\tau > 0$ is a scalar temperature parameter. $\mathbf { A }$ is defined as a data augmentation block that generates two randomly generated augmented examples, $x _ { 2 i } ^ { \prime }$ and $x _ { 2 i - 1 } ^ { \prime }$ from the original example $x _ { i }$ : $\mathbf { A } ( \{ x _ { i } , y _ { i } \} _ { i = 1 , \dots N } ) \doteq \bar { \{ x _ { i } ^ { \prime } , y _ { i } ^ { \prime } \} } _ { i = 1 , \dots 2 N }$ . As an example, A can be RandAugment for a computer vision application; or it could be a back-translation model for an NLP application.
55
+
56
+ # 3 RELATED WORK
57
+
58
+ Traditional Machine Learning and Theoretical Understanding Several works have analyzed the shortcomings of the widely adopted cross-entropy loss, demonstrating that it leads to poor generalization performance due to poor margins (Liu et al., 2016; Cao et al., 2019), and lack of robustness to noisy labels (Zhang & Sabuncu, 2018; Sukhbaatar et al., 2015) or adversarial examples (Elsayed et al., 2018; Nar et al., 2019). On the other hand, there has been a body of work that has explored the performance difference for classifiers trained with discriminative (i.e., optimizing for $p ( y | x )$ , where y is the label and $\mathbf { X }$ is the input) losses such as cross-entropy loss and generative losses (i.e. optimizing for $p ( x | y ) \big )$ ). $\mathrm { N g }$ & Jordan (2001) show that classifiers trained with generative losses can outperform their counterparts trained with discriminative losses in the context of Logistic Regression and Naive Bayes. Raina et al. (2003) show that a hybrid discriminative and generative objective outperforms both solely discriminative and generative approaches. In the context of contrastive learning, Saunshi et al. (2019) propose a theoretical framework for analyzing contrastive learning algorithms through hypothesizing that semantically similar points are sampled from the same latent class, which allows showing formal guarantees on the quality of learned representations.
59
+
60
+ Contrastive Learning There has been several recent investigations for the use of contrastive objectives for self-supervised, semi-supervised, and supervised learning methods, primarily in the computer vision domain. Chen et al. (2020a) propose a framework for contrastive learning of visual representations without specialized architectures or a memory bank, and show state-of-the-art results on ImageNet ILSVRC-2012 (Russakovsky et al., 2015) – outperforming previous methods for self-supervised, semi-supervised and transfer learning. Similarly, Khosla et al. (2020) propose a supervised contrastive loss that outperforms cross entropy loss and gets state-of-the-art results on ImageNet on both ResNet-50 and ResNet-200 (He et al., 2016) with AutoAugment (Cubuk et al., 2019) data augmentation. They also show increased robustness on the ImageNet-C dataset (Hendrycks & Dietterich, 2019), and demonstrate that supervised contrastive loss is less sensitive to different hyperparameter settings for optimizers or data augmentations compared to the cross-entropy loss. Liu & Abbeel (2020) propose a hybrid discriminative-generative training of energy-based models where they approximate the generative term with a contrastive loss using large batch sizes and show improved classification accuracy of WideResNet-28-10 (Zagoruyko & Komodakis, 2016) on CIFAR-10 and CIFAR-100 (Krizhevsky, 2009) datasets, outperforming state-of-the-art discriminative and generative classifiers. They also demonstrate improved performance for WideResNet-28-10 on robustness, out-of-distribution detection, and calibration, compared to other state-of-the-art generative and hybrid models. Finally, Fang & Xie (2020) propose pre-training language models using a self-supervised contrastive learning objective at the sentence level using back-translation as the augmentation method, followed by fine-tuning by predicting whether two augmented sentences originate from the same sentence – demonstrating improvements over fine-tuning BERT on a subset of GLUE benchmark tasks.
61
+
62
+ Stability and Robustness of Fine-tuning Pre-trained Language Models There has been recent works on analyzing the stability and robustness of fine-tuning pre-trained language models, since they have been shown to overfit to the labeled task data while fine-tuning and hence fail to generalize to unseen data when there is limited labeled data for the task (Aghajanyan et al., 2020). To improve the generalization performance, Jiang et al. (2020) propose a local smoothness-inducing regularizer to manage the complexity of the model and a Bregman proximal point optimization method, an instance of trust-region methods, to prevent aggressive updating of the model during fine-tuning. They show state-of-the-art performance on GLUE, SNLI (Bowman et al., 2015), SciTail (Khot et al., 2018), and ANLI (Nie et al., 2020) natural language understanding benchmarks. Similarly, Aghajanyan et al. (2020) propose a regularized fine-tuning procedure inspired by trust-region theory that replaces adversarial objectives with parametric noise sampled from normal or uniform distribution in order to prevent representation collapse during fine-tuning for better generalization performance, without hurting the performance. They show improved performance on a range of natural language understanding and generation tasks including DailyMail/CNN (Hermann et al., 2015), Gigaword (Napoles et al., 2012), Reddit TIFU (Kim et al., 2019), and the GLUE benchmark. There has also been some empirical analysis that suggests fine-tuning for more epochs, reinitializing top few layers (Zhang et al., 2020) instead of only the classification head, and using debiased Adam optimizer instead of BERTAdam (Devlin et al., 2019) during fine-tuning (Mosbach et al., 2020) can make the fine-tuning procedure more stable across different runs.
63
+
64
+ # 4 EXPERIMENTAL SETUP
65
+
66
+ # 4.1 DATASETS AND TRAINING DETAILS
67
+
68
+ We use datasets from the GLUE natural language understanding benchmark (Wang et al., 2019) for evaluation. We include both single sentence classification tasks and sentence-pair classification tasks to test whether our hypothesis is generally applicable across tasks. We summarize each dataset based on their main task, domain, number of training examples, and number of classes in Table 1.
69
+
70
+ In our few-shot learning experiments, we sample half of the original validation set of the GLUE benchmark and use it as our test set, and sample ${ \sim } 5 0 0$ examples for our validation set from the original GLUE validation set, both taking the label distribution of the original validation set into account. For each task, we want the validation set to be small enough to avoid easy overfitting on the validation set, and big enough to avoid high-variance when early-stopping at various epochs for the few-shot learning experiments. For full dataset experiments, such as the ones shown in Table 5, Table 6, Table 8, and Table 9, we sample a validation set from the original training set of the GLUE benchmark based on the size of the original validation set of GLUE, and report our test results on the original validation set of GLUE.
71
+
72
+ We run each experiment with 10 different seeds, and report the average test accuracy, standard deviation, along with p-values with respect to the baseline. We pick the best hyperparameter combination based on the average validation accuracy across 10 seeds. For few-shot learning experiments, such as the ones shown in Table 2, Table 3, and Table 10, we sample 10 different training set samples based on the total number of examples $N$ specified from the original training set of the GLUE benchmark, taking the label distribution of the original training set into account. We report the average and the standard deviation of the test accuracies of the top 3 models based on their validation accuracies out of 10 random training set samples. Best hyperparameter combination is picked based on the average validation accuracy of the top 3 models. The reason why we focus on the top 3 models for this setting is that we would like to reduce the variance across training set samples.
73
+
74
+ We use fairseq Ott et al. (2019) library and the open-source RoBERTa-Large model for all of our experiments. During all the fine-tuning runs, we use Adam optimizer with a learning rate of 1e-5, batch size of 16 (unless specified otherwise), and dropout rate of 0.1. For each experiment that includes the SCL term, we conduct a grid-based hyperparameter sweep for $\lambda \in \{ 0 . 1 , 0 . 3 , 0 . 5 , 0 . 7 , 0 . 9 , 1 . 0 \}$ and $\tau \in \{ 0 . 1 , 0 . 3 , 0 . 5 , 0 . 7 \}$ . We observe that models with best test accuracies across all experimental settings overwhelmingly use the hyperparameter combination $\tau = 0 . 3$ and $\lambda = 0 . 9$ .
75
+
76
+ Table 1: GLUE Benchmark datasets used for evaluation.
77
+
78
+ <table><tr><td>Dataset</td><td>Task</td><td>Domain</td><td>#Train</td><td>#Classes</td></tr><tr><td>SST-2</td><td>sentiment analysis</td><td>movie reviews</td><td>67k</td><td>22222</td></tr><tr><td>CoLA</td><td> grammatical correctness</td><td>linguistic publications</td><td>8.5k</td><td></td></tr><tr><td>MRPC</td><td>paraphrase</td><td>news</td><td>3.7k</td><td></td></tr><tr><td>RTE</td><td>textual entailment</td><td>news/Wikipedia</td><td>2.5k</td><td></td></tr><tr><td>QNLI</td><td>question answering/textual entailment</td><td>Wikipedia</td><td>105k</td><td></td></tr><tr><td>MNLI</td><td>textual entailment</td><td>multi-domain</td><td>393k</td><td>3</td></tr></table>
79
+
80
+ # 4.2 CONSTRUCTING AUGMENTED NOISY TRAINING DATASETS
81
+
82
+ Machine learning researchers or practitioners often do not know how noisy their datasets are, as input examples might be corrupted or ground truth labeling might not be perfect. Therefore, it is preferable to use robust training objectives that can get more information out of datasets of different noise levels, even where there is limited amount of labeled data. We construct augmented noisy training datasets (used to fine-tune the pre-trained language models for the task of interest) of different noise levels using a back-translation model (Edunov et al., 2018), where we increase the temperature parameter to create more noisy examples. Back-translation refers to the procedure of translating an example in language A into language B and then translating it back to language A, and it is a commonly used data augmentation procedure for NLP applications, as the new examples obtained through back-translation provide targeted inductive bias to the model while preserving the meaning of the original example. Specifically, we use WMT’18 English-German and German-English translation models, use random sampling to get more diverse examples, and employ and augmentation ratio of 1:3 for supervised examples:augmented examples. We observe that employing random sampling with a tunable temperature parameter is critical to get diverse paraphrases for the supervised examples, consistent with the previous work (Edunov et al., 2018; Xie et al., 2019), since commonly used beam search results in very regular sentences that do not provide diversity to the existing data distribution. We keep the validation and test sets same with the experiments shown in Table 2.
83
+
84
+ # 5 ANALYSIS AND RESULTS
85
+
86
+ # 5.1 GLUE BENCHMARK FEW-SHOT LEARNING RESULTS
87
+
88
+ We proposed adding the SCL term inspired by the learning strategy of humans when they are given few examples. In Table 2, we report our few-shot learning results on SST-2, QNLI, and MNLI from the GLUE benchmark with 20, 100, 1000 labeled training examples. Details of the experimental setup are explained in Section 4. We use a very strong baseline of fine-tuning RoBERTa-Large with cross-entropy loss. We observe that the SCL term improves performance over the baseline significantly across all datasets and data regimes, leading to 10.7 points improvement on QNLI, 3.4 points improvement on MNLI, and 2.2 points improvement on SST-2, where we have 20 labeled examples for fine-tuning. This shows that our proposed objective is effective both for binary single sentence classification such as sentiment analysis; and sentence pair classification tasks such as textual entailment and paraphrasing – when we are given only few labeled examples for the task. We see that as we increase the number of labeled examples, performance improvement over the baseline decreases, leading to 1.9 points improvement on MNLI for 100 examples and 0.6 points improvement on QNLI for 1000 examples. We also would like to acknowledge that improvements over the baseline when $_ { \mathrm { N = 1 0 0 0 } }$ on both SST-2 and MNLI are not statistically significant. In addition, we conduct an ablation study where we investigate the importance of $l _ { 2 }$ normalization and temperature scaling where we replace SCL loss with CE loss but keep the $l _ { 2 }$ normalization and temperature scaling, as shown in Table 10 in the Appendix under the method name $\mathrm { C E + C E }$ .
89
+
90
+ In Figure 2, we show tSNE plots of the learned representations of the CLS embeddings on SST-2 test set when RoBERTa-Large is fine-tuned with 20 labeled examples, comparing CE with and without the SCL term. We can clearly see that the SCL term enforces more compact clustering of examples with the same label; while the distribution of the embeddings learned with CE is close to random. We include a more detailed comparison for CE and CE+SCL showing learned representations of examples as tSNE plots, where we have 20, 100 labeled examples and full dataset respectively for fine-tuning in Figure 3 in the Appendix.
91
+
92
+ <table><tr><td>Model</td><td>Loss</td><td>N</td><td>SST-2</td><td>QNLI</td><td>MNLI</td></tr><tr><td>RoBERTaLarge</td><td>CE</td><td>20</td><td>85.9±2.1</td><td>65.0±2.0</td><td>39.3±2.5</td></tr><tr><td>RoBERTaLarge</td><td>CE + SCL</td><td>20</td><td>88.1±3.3</td><td>75.7±4.8</td><td>42.7±4.6</td></tr><tr><td></td><td>p-value</td><td></td><td>5e-10</td><td>1e-46</td><td>1e-8</td></tr><tr><td>RoBERTaLarge</td><td>CE</td><td>100</td><td>91.1±1.3</td><td>81.9±0.4</td><td>59.2±2.1</td></tr><tr><td>RoBERTaLarge</td><td>CE + SCL</td><td>100</td><td>92.8±1.3</td><td>82.5±0.4</td><td>61.1±3.0</td></tr><tr><td></td><td>p-value</td><td></td><td>3e-17</td><td>1e-20</td><td>2e-4</td></tr><tr><td>RoBERTaLarge</td><td>CE</td><td>1000</td><td>94.0±0.6</td><td>89.2±0.6</td><td>81.4±0.2</td></tr><tr><td>RoBERTaLarge</td><td>CE + SCL</td><td>1000</td><td>94.1±0.5</td><td>89.8±0.4</td><td>81.5±0.2</td></tr><tr><td></td><td>p-value</td><td></td><td>0.6</td><td>1e-12</td><td>0.5</td></tr></table>
93
+
94
+ Table 2: Few-shot learning test results on the GLUE benchmark where we have N=20,100,1000 labeled examples for training. Reported results are the mean and the standard deviation of the test accuracies of the top 3 models based on validation accuracy out of 10 random training set samples, along with p-values for each experiment.
95
+
96
+ ![](images/f3661127f4770d2fbd5ad633fd0de29cb54a2e99d93a2834788a814b1cc3c7e2.jpg)
97
+ Figure 2: tSNE plots of the learned CLS embeddings on the SST-2 test set in the few-shot learning setting of having 20 labeled examples to fine-tune on – comparing RoBERTa-Large fine-tuned with CE only (left) and with our proposed objective $\mathrm { C E } { + } \mathrm { S C L }$ (right) for the SST-2 sentiment analysis task. Blue: positive examples; red: negative examples.
98
+
99
+ # 5.2 ROBUSTNESS ACROSS AUGMENTED NOISY TRAINING DATASETS
100
+
101
+ In Table 3, we report our results on augmented noisy training sets with varying levels of noise. We have 100 labeled examples for fine-tuning for each task, and we augment their training sets with noisy examples using a back-translation model, as described in detail in Section 4.2. Note that we use the back-translation model to simulate training datasets of varying noise levels and not as a method to boost model performance. Experimental setup follows what is described in Section 4 for few-shot learning experiments. T is the temperature for the back-translation model used to augment the training sets, and higher temperature corresponds to more noise in the augmented training set.
102
+
103
+ We observe consistent improvements over the RoBERTa-Large baseline with our proposed objective across all datasets across all noise levels, with 0.4 points improvement on SST-2, 2.5 points improvement on QNLI, and 7 points improvement on MNLI on average across augmented training sets. The improvement is particularly significant for inference tasks (QNLI, MNLI) when the noise levels are higher (higher temperature), leading to 7.7 points improvement on MNLI when $\mathrm { T } { = } 0 . 7$ , and 4.2 points improvement on QNLI when $\mathrm { T } { = } 0 . 9$ . We show some samples of the augmented examples used in this robustness experiment in Table 4. For $\mathrm { T } { = } 0 . 3$ , examples mostly stay the same with minor changes in their phrasing, while for $\mathrm { T } { = } 0 . 9$ , some grammatical mistakes and factual errors are introduced.
104
+
105
+ Table 3: Results on the GLUE benchmark for robustness across noisy augmented training sets. Average shows the average performance across augmented training sets.
106
+
107
+ <table><tr><td>Dataset</td><td>Loss</td><td>Original</td><td>T=0.3</td><td>T=0.5</td><td>T=0.7</td><td>T=0.9</td><td>Average</td></tr><tr><td>SST-2</td><td>CE</td><td>91.1±1.3</td><td>92.0±1.3</td><td>91.4±1.0</td><td>91.7±1.3</td><td>90.0±0.5</td><td>91.3±1.2</td></tr><tr><td>SST-2</td><td>CE + SCL</td><td>92.8±1.3</td><td>92.6±0.9</td><td>91.5±1.0</td><td>91.2±0.6</td><td>91.5±1.0</td><td>91.7±1.0</td></tr><tr><td>QNLI</td><td>CE</td><td>81.9±0.4</td><td>81.1±2.3</td><td>80.0±2.9</td><td>78.9±3.7</td><td>75.9±4.0</td><td>79.0±3.5</td></tr><tr><td>QNLI</td><td>CE + SCL</td><td>82.5±0.4</td><td>82.7±1.9</td><td>81.9±2.5</td><td>81.3±0.6</td><td>80.1±2.5</td><td>81.5±2.0</td></tr><tr><td>MNLI</td><td>CE</td><td>59.2±2.1</td><td>54.0±1.1</td><td>55.3±2.4</td><td>54.6±2.2</td><td>47.0±1.8</td><td>52.7±3.9</td></tr><tr><td>MNLI</td><td>CE + SCL</td><td>61.1±3.0</td><td>61.2±2.3</td><td>62.1±0.9</td><td>62.3±1.1</td><td>53.0±2.1</td><td>59.7±4.3</td></tr></table>
108
+
109
+ Table 4: Sample of augmented examples with different noise levels for the robustness experiment shown in Table 3. Higher temperature (T) corresponds to more noise in the augmented training set.
110
+
111
+ <table><tr><td>Dataset</td><td>Type</td><td>Sentence</td></tr><tr><td>SST-2 SST-2</td><td>Original Augmented (T=0.3)</td><td>As possibly the best actor working in movies today. As perhaps the best actor who now stars in films.</td></tr><tr><td>SST-2 SST-2</td><td>Original Augmented (T=0.9)</td><td>The young stars are too cute; the story and ensuing complications are too manipulative. The babies are too cute,the image and complications that follow too manipulative.</td></tr><tr><td>QNLI QNLI</td><td>Original Augmented (T=0.3)</td><td>Brain tissue is naturally soft, but can be stiffened with what liquid? Brain tissue is omitted naturally, but with what fluid it can be stiffened?</td></tr><tr><td>QNLI QNLI</td><td>Original Augmented (T=0.9)</td><td>In March 1968,CBS and Sony formed CBS/Sony Records,a Japanese business joint venture. CBS was founded by CBS and Sony Records in March 1962,a Japanese company.</td></tr><tr><td>MNLI MNLI</td><td>Original Augmented (T=0.3)</td><td>However,the link did not transfer the user to a comment box particular to the rule at issue.</td></tr><tr><td>MNLI MNLI</td><td>Original Augmented (T=0.9)</td><td>However,the link did not send the user to a comment field specifically for the rule. Tenants could not enter the apartment complex due to a dangerous chemical spill. Tenants were banned from entering the medical property because of a blood positive substance.</td></tr></table>
112
+
113
+ # 5.3 GLUE BENCHMARK FULL DATASET RESULTS
114
+
115
+ In Table 5, we report results using our proposed objective on six downstream tasks from the GLUE benchmark. We use a very strong baseline of fine-tuning RoBERTa-Large with cross-entropy loss, which is currently the standard practice for the state-of-the-art NLP classification models. Details of the experimental setup are explained in Section 4.
116
+
117
+ We observe that adding the SCL term to the objective improves the performance over the RoBERTaLarge baseline that lead to 3.1 points improvement on MRPC, 3.5 points improvement on QNLI, and an average improvement of 1.2 points across all 6 datasets. We conduct these experiments to investigate the effect of the SCL term in high-data regimes, as we observe that it’s effective in few-shot learning settings. We acknowledge that only MRPC and QNLI results are statistically significant, and we report the results on the other datasets as a finding for the sake of completeness.
118
+
119
+ We hypothesize larger batch sizes lead to better performance, but we leave that for future work as that requires additional engineering effort. We show evidence for this hypothesis in our ablation studies that we show in Table 6, where we conduct the full dataset experiments for $\mathrm { C E } { + } \mathrm { S C L }$ with the same experimental setup described here for Table 5 on SST-2, CoLA, QNLI, and MNLI for batch sizes 16, 64, and 256 using RoBERTa-Base. We observe that as we increase the batch size, performance improves significantly across all datasets. Specifically, we observe 0.3 points improvement on SST-2, 0.8 points improvement on CoLA, 0.4 points improvement on QNLI, and 1.3 points improvement on MNLI, when we increase the batch size from 16 to 256 for $\mathrm { C E } { + } \mathrm { S C L }$ . We also investigate the effect of SCL term in the overall training speed, and we measure that with average updates per second metric, shown in Table 6. For batch size 16, the batch size we use throughout the paper across all experimental settings, effect of SCL is negligible – decreasing average updates per second from 15.9 to 15.08. As we increase the batch size, effect of SCL to training speed becomes more significant – decreasing average updates per second from 2.46 to 1.54 for batch size 256. In addition, we conduct an ablation study where we investigate the importance of $l _ { 2 }$ normalization and temperature scaling where we replace SCL loss with CE loss but keep the normalization and scaling (denoted as $\mathrm { C E + C E }$ ) both for full dataset results in Table 8, and for batch size ablation in Table 9 in the Appendix.
120
+
121
+ Table 5: Test results on the validation set of GLUE benchmark. We compare fine-tuning RoBERTaLarge with CE with and without SCL. Best hyperparameter configuration picked based on average validation accuracy. We report average accuracy across 10 seeds for the model with best hyperparameter configuration, its standard deviation, and p-values.
122
+
123
+ <table><tr><td>Model</td><td>Loss</td><td>SST-2</td><td>CoLA</td><td>MRPC</td><td>RTE</td><td>QNLI</td><td>MNLI</td><td>Avg</td></tr><tr><td>RoBERTaLarge</td><td>CE CE + SCL</td><td>96.0±0.4 96.3±0.4</td><td>86.0±0.5 86.1±0.8</td><td>86.4±2.4 89.5±0.9</td><td>85.5±1.8 85.7±0.5</td><td>90.4±0.8</td><td>88.4±1</td><td>88.8</td></tr><tr><td>RoBERTaLarge</td><td></td><td></td><td></td><td></td><td></td><td>93.9±0.7</td><td>88.6±0.7</td><td>90</td></tr><tr><td></td><td></td><td>0.07</td><td>0.63</td><td>0.01</td><td>0.06</td><td>0.01</td><td>0.16</td><td></td></tr><tr><td></td><td>p-value</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
124
+
125
+ Table 6: Ablation study on performance and training speed shown as average updates per second (Avg ups/sec) for fine-tuning RoBERTa-Base with respect to the batch size (Bsz).
126
+
127
+ <table><tr><td>Model</td><td>Loss</td><td>Bsz</td><td>SST-2</td><td>CoLA</td><td>QNLI</td><td>MNLI</td><td> Avg ups/sec</td></tr><tr><td rowspan="2">RoBERTaBase RoBERTaBase</td><td>CE</td><td>16</td><td>94.1±0.5</td><td>83.3±0.7</td><td>88.2±0.8</td><td>84±0.6</td><td>15.9</td></tr><tr><td>CE + SCL</td><td>16</td><td>94.9±0.6</td><td>83.7±0.9</td><td>92.5±0.4</td><td>85.3±0.5</td><td>15.08</td></tr><tr><td rowspan="2">RoBERTaBase RoBERTaBase</td><td>CE</td><td>64</td><td>94.2±0.4</td><td>83.3±0.5</td><td>89.2±0.5</td><td>84±0.4</td><td>8.43</td></tr><tr><td>CE + SCL</td><td>64</td><td>94.7±0.2</td><td>83.8±0.6</td><td>92.6±0.5</td><td>85.7±0.7</td><td>7.44</td></tr><tr><td rowspan="2">RoBERTaBase RoBERTaBase</td><td>CE</td><td>256</td><td>94.1±0.4</td><td>84±0.5</td><td>90±0.7</td><td>84.4±0.6</td><td>2.46</td></tr><tr><td>CE + SCL</td><td>256</td><td>95.2±0.3</td><td>84.5±0.5</td><td>92.9±0.3</td><td>86.6±0.6</td><td>1.54</td></tr></table>
128
+
129
+ # 5.4 GENERALIZATION ABILITY OF TASK MODELS
130
+
131
+ In this experiment, we first fine-tune RoBERTa-Large on SST-2 using its full training set and get a task model with and without SCL term. Then, we transfer this task model to two related single sentence sentiment analysis binary classification tasks for the movie reviews domain – Amazon-2 and Yelp-2 (Zhang et al., 2015). For both, we sample 20 labeled examples for each class, and follow the few-shot learning experimental setup described in Section 4. In Table 7, we demonstrate that using the SCL term for both source (SST-2) and target domains (Amazon-2, Yelp-2) lead to better generalization ability, with 2.9 points improvement on Amazon-2 and 0.4 points improvement on Yelp-2 along with significant reduction in variance across training set samples.
132
+
133
+ <table><tr><td>Model</td><td>Loss</td><td>N</td><td>Amazon-2</td><td>Yelp-2</td></tr><tr><td>RoBERTaLarge</td><td>CE</td><td>40</td><td>87.4±6.4</td><td>90.8±2.2</td></tr><tr><td>RoBERTaLarge</td><td>CE + SCL</td><td>40</td><td>90.3±0.6</td><td>91.2±0.4</td></tr></table>
134
+
135
+ Table 7: Generalization of the SST-2 task model (fine-tuned using the full training set) to related tasks (Amazon-2, Yelp-2) where there are 20 labeled examples for each class.
136
+
137
+ # 6 CONCLUSION
138
+
139
+ We propose a supervised contrastive learning objective for fine-tuning pre-trained language models and demonstrate significant improvements over a strong RoBERTa-Large baseline on multiple datasets of the GLUE benchmark in the few-shot learning settings. We also show that our proposed objective leads to models that are more robust to different levels of noise in the training data and can generalize better to related tasks with limited labeled task data. Currently, data augmentation methods in NLP and their effects on the downstream tasks are neither as effective nor as well understood as their counterparts in the computer vision domain. In future work, we plan to study principled and automated data augmentation techniques for NLP that would allow extending our supervised contrastive learning objective to both semi-supervised and self-supervised learning settings.
140
+
141
+ # REFERENCES
142
+
143
+ Armen Aghajanyan, Akshat Shrivastava, Anchit Gupta, Naman Goyal, Luke Zettlemoyer, and Sonal Gupta. Better fine-tuning by reducing representational collapse. ArXiv, abs/2008.03156, 2020.
144
+
145
+ Philip Bachman, R. Devon Hjelm, and William Buchwalter. Learning representations by maximizing mutual information across views. In NeurIPS, 2019.
146
+
147
+ Alexei Baevski, Henry Zhou, Abdelrahman Mohamed, and Michael Auli. wav2vec 2.0: A framework for self-supervised learning of speech representations. In NeurIPS, 2020.
148
+
149
+ Samuel R. Bowman, Gabor Angeli, Christopher Potts, and Christopher D. Manning. A large annotated corpus for learning natural language inference. In EMNLP, 2015.
150
+
151
+ Kaidi Cao, Colin Wei, Adrien Gaidon, N. Arechiga, and Tengyu Ma. Learning imbalanced datasets ´ with label-distribution-aware margin loss. In NeurIPS, 2019.
152
+
153
+ Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey E. Hinton. A simple framework for contrastive learning of visual representations. In ICML, 2020a.
154
+
155
+ Ting Chen, Simon Kornblith, Kevin Swersky, Mohammad Norouzi, and Geoffrey E. Hinton. Big self-supervised models are strong semi-supervised learners. In NeurIPS, 2020b.
156
+
157
+ Alexis Conneau, Alexei Baevski, Ronan Collobert, Abdelrahman Mohamed, and Michael Auli. Unsupervised cross-lingual representation learning for speech recognition. arXiv preprint arXiv:2006.13979, 2020.
158
+
159
+ E. Cubuk, Barret Zoph, Dandelion Mane, V. Vasudevan, and Quoc V. Le. Autoaugment: Learning ´ augmentation strategies from data. 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 113–123, 2019.
160
+
161
+ E. D. Cubuk, Barret Zoph, Jonathon Shlens, and Quoc V. Le. Randaugment: Practical automated data augmentation with a reduced search space. 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops (CVPRW), pp. 3008–3017, 2020.
162
+
163
+ J. Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. In NAACL-HLT, 2019.
164
+
165
+ Jesse Dodge, Gabriel Ilharco, Roy Schwartz, Ali Farhadi, Hannaneh Hajishirzi, and Noah A. Smith. Fine-tuning pretrained language models: Weight initializations, data orders, and early stopping. ArXiv, abs/2002.06305, 2020.
166
+
167
+ Sergey Edunov, Myle Ott, Michael Auli, and David Grangier. Understanding back-translation at scale. In EMNLP, 2018.
168
+
169
+ Gamaleldin F. Elsayed, Dilip Krishnan, Hossein Mobahi, Kevin Regan, and Samy Bengio. Large margin deep networks for classification. In NeurIPS, 2018.
170
+
171
+ Hongchao Fang and Pengtao Xie. Cert: Contrastive self-supervised learning for language understanding. ArXiv, abs/2005.12766, 2020.
172
+
173
+ M. Gutmann and A. Hyvarinen. Noise-contrastive estimation of unnormalized statistical models, ¨ with applications to natural image statistics. J. Mach. Learn. Res., 13:307–361, 2012.
174
+
175
+ Tengda Han, Weidi Xie, and Andrew Zisserman. Video representation learning by dense predictive coding. 2019 IEEE/CVF International Conference on Computer Vision Workshop (ICCVW), pp. 1483–1492, 2019.
176
+
177
+ Kaiming He, X. 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.
178
+
179
+ Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross B. Girshick. Momentum contrast for unsupervised visual representation learning. 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 9726–9735, 2020.
180
+
181
+ Olivier J. Henaff, A. Srinivas, J. Fauw, Ali Razavi, C. Doersch, S. Eslami, and A. Oord. Data-efficient ´ image recognition with contrastive predictive coding. ArXiv, abs/1905.09272, 2019.
182
+
183
+ Dan Hendrycks and Thomas G. Dietterich. Benchmarking neural network robustness to common corruptions and perturbations. In ICLR, 2019.
184
+
185
+ K. Hermann, Tomas Kocisk ´ y, Edward Grefenstette, Lasse Espeholt, W. Kay, Mustafa Suleyman, and ´ P. Blunsom. Teaching machines to read and comprehend. In NeurIPS, 2015.
186
+
187
+ Geoffrey E. Hinton, Oriol Vinyals, and J. Dean. Distilling the knowledge in a neural network. In NeurIPS Deep Learning and Representation Learning Workshop, 2015.
188
+
189
+ R. Devon Hjelm, A. Fedorov, Samuel Lavoie-Marchildon, Karan Grewal, Adam Trischler, and Yoshua Bengio. Learning deep representations by mutual information estimation and maximization. In ICLR, 2019.
190
+
191
+ Jeremy Howard and Sebastian Ruder. Universal language model fine-tuning for text classification. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), volume 1, pp. 328–339, 2018.
192
+
193
+ Haoming Jiang, Pengcheng He, Weizhu Chen, Xiaodong Liu, Jianfeng Gao, and Tuo Zhao. Smart: Robust and efficient fine-tuning for pre-trained natural language models through principled regularized optimization. In ACL, 2020.
194
+
195
+ Prannay Khosla, Piotr Teterwak, Chen Wang, Aaron Sarna, Yonglong Tian, Phillip Isola, Aaron Maschinot, Ce Liu, and Dilip Krishnan. Supervised contrastive learning. In NeurIPS, 2020.
196
+
197
+ Tushar Khot, A. Sabharwal, and Peter Clark. Scitail: A textual entailment dataset from science question answering. In AAAI, 2018.
198
+
199
+ Byeongchang Kim, Hyunwoo Kim, and Gunhee Kim. Abstractive summarization of reddit posts with multi-level memory networks. In NAACL-HLT, 2019.
200
+
201
+ A. Kolesnikov, Xiaohua Zhai, and Lucas Beyer. Revisiting self-supervised visual representation learning. 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 1920–1929, 2019.
202
+
203
+ A. Krizhevsky. Learning multiple layers of features from tiny images. 2009.
204
+
205
+ Hao Liu and P. Abbeel. Hybrid discriminative-generative training via contrastive learning. ArXiv, abs/2007.09070, 2020.
206
+
207
+ Weiyang Liu, Yandong Wen, Zhiding Yu, and Meng Yang. Large-margin softmax loss for convolutional neural networks. In ICML, 2016.
208
+
209
+ Y. Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, M. Lewis, Luke Zettlemoyer, and Veselin Stoyanov. Roberta: A robustly optimized bert pretraining approach. ArXiv, abs/1907.11692, 2019.
210
+
211
+ I. Misra and L. V. D. Maaten. Self-supervised learning of pretext-invariant representations. 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 6706–6716, 2020.
212
+
213
+ A. Mnih and K. Kavukcuoglu. Learning word embeddings efficiently with noise-contrastive estimation. In NeurIPS, 2013.
214
+
215
+ Marius Mosbach, Maksym Andriushchenko, and Dietrich Klakow. On the stability of fine-tuning bert: Misconceptions, explanations, and strong baselines. ArXiv, abs/2006.04884, 2020.
216
+
217
+ R. Muller, Simon Kornblith, and Geoffrey E. Hinton. When does label smoothing help? In ¨ NeurIPS, 2019.
218
+
219
+ Courtney Napoles, Matthew R. Gormley, and Benjamin Van Durme. Annotated gigaword. In AKBC-WEKEX@NAACL-HLT, 2012.
220
+
221
+ K. Nar, O. Ocal, S. Sastry, and K. Ramchandran. Cross-entropy loss and low-rank features have responsibility for adversarial examples. ArXiv, abs/1901.08360, 2019.
222
+
223
+ Andrew Y. $\mathrm { N g }$ and Michael I. Jordan. On discriminative vs. generative classifiers: A comparison of logistic regression and naive bayes. In NeurIPS, 2001.
224
+
225
+ Yixin Nie, Adina Williams, Emily Dinan, Mohit Bansal, J. Weston, and Douwe Kiela. Adversarial nli: A new benchmark for natural language understanding. 2020.
226
+
227
+ A. Oord, Y. Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. ArXiv, abs/1807.03748, 2018.
228
+
229
+ Myle Ott, Sergey Edunov, Alexei Baevski, Angela Fan, Sam Gross, Nathan Ng, David Grangier, and Michael Auli. fairseq: A fast, extensible toolkit for sequence modeling. In Proceedings of NAACL-HLT 2019: Demonstrations, 2019.
230
+
231
+ A. Radford, Jeffrey Wu, R. Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. 2019.
232
+
233
+ Rajat Raina, Yirong Shen, Andrew Y. Ng, and Andrew McCallum. Classification with hybrid generative/discriminative models. In NeurIPS, 2003.
234
+
235
+ Olga Russakovsky, J. Deng, H. Su, J. Krause, S. Satheesh, S. Ma, Zhiheng Huang, A. Karpathy, A. Khosla, M. Bernstein, A. Berg, and Li Fei-Fei. Imagenet large scale visual recognition challenge. International Journal of Computer Vision, 115:211–252, 2015.
236
+
237
+ Nikunj Saunshi, Orestis Plevrakis, Sanjeev Arora, Mikhail Khodak, and Hrishikesh Khandeparkar. A theoretical analysis of contrastive unsupervised representation learning. volume 97 of Proceedings of Machine Learning Research, pp. 5628–5637, Long Beach, California, USA, 09–15 Jun 2019. PMLR. URL http://proceedings.mlr.press/v97/saunshi19a.html.
238
+
239
+ Florian Schroff, D. Kalenichenko, and J. Philbin. Facenet: A unified embedding for face recognition and clustering. 2015 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 815–823, 2015.
240
+
241
+ Kihyuk Sohn. Improved deep metric learning with multi-class n-pair loss objective. In NeurIPS, 2016.
242
+
243
+ Sainbayar Sukhbaatar, Joan Bruna, Manohar Paluri, Lubomir D. Bourdev, and Rob Fergus. Training convolutional networks with noisy labels. In ICLR, 2015.
244
+
245
+ Christian Szegedy, V. Vanhoucke, S. Ioffe, Jon Shlens, and Z. Wojna. Rethinking the inception architecture for computer vision. 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 2818–2826, 2016.
246
+
247
+ Yonglong Tian, Dilip Krishnan, and Phillip Isola. Contrastive multiview coding. In ECCV, 2020.
248
+
249
+ Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R. Bowman. GLUE: A multi-task benchmark and analysis platform for natural language understanding. In ICLR, 2019. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ rJ4km2R5t7.
250
+
251
+ Zhirong Wu, Yuanjun Xiong, S. Yu, and D. Lin. Unsupervised feature learning via non-parametric instance discrimination. 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 3733–3742, 2018.
252
+
253
+ Qizhe Xie, Zihang Dai, Eduard H. Hovy, Minh-Thang Luong, and Quoc V. Le. Unsupervised data augmentation for consistency training. arXiv: Learning, 2019.
254
+
255
+ Qizhe Xie, Minh-Thang Luong, Eduard Hovy, and Quoc V Le. Self-training with noisy student improves imagenet classification. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10687–10698, 2020.
256
+
257
+ I Zeki Yalniz, Herve J´ egou, Kan Chen, Manohar Paluri, and Dhruv Mahajan. Billion-scale semi-´ supervised learning for image classification. arXiv preprint arXiv:1905.00546, 2019.
258
+
259
+ Sangdoo Yun, Dongyoon Han, Seong Joon Oh, Sanghyuk Chun, Junsuk Choe, and Youngjoon Yoo. Cutmix: Regularization strategy to train strong classifiers with localizable features. 2019 IEEE/CVF International Conference on Computer Vision (ICCV), pp. 6022–6031, 2019.
260
+
261
+ Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. ArXiv, abs/1605.07146, 2016.
262
+
263
+ Hongyi Zhang, M. Cisse, Yann Dauphin, and David Lopez-Paz. mixup: Beyond empirical risk ´ minimization. In ICLR, 2018.
264
+ Tianyi Zhang, Felix Wu, Arzoo Katiyar, Kilian Q. Weinberger, and Yoav Artzi. Revisiting few-sample bert fine-tuning. ArXiv, abs/2006.05987, 2020.
265
+ X. Zhang, J. Zhao, and Y. LeCun. Character-level convolutional networks for text classification. In NeurIPS, 2015.
266
+ Zhilu Zhang and Mert R. Sabuncu. Generalized cross entropy loss for training deep neural networks with noisy labels. In NeurIPS, 2018.
267
+
268
+ # A APPENDIX
269
+
270
+ ![](images/6e75b94ec232e0ffa95cbebbe421d190008d9112a54af371c50af8c773e93650.jpg)
271
+ Figure 3: tSNE plots of learned CLS embedding on SST-2 test set where we have 20, 100 labeled examples, and full dataset respectively, comparing CE with and without SCL term. Blue: positive examples; red: negative examples.
272
+
273
+ <table><tr><td>Model</td><td>Loss</td><td>SST-2</td><td>CoLA</td><td>MRPC</td><td>RTE</td><td>QNLI</td><td>MNLI</td><td>Avg</td></tr><tr><td>RoBERTaLarge</td><td>CE</td><td>96.0±0.4</td><td>86.0±0.5</td><td>86.4±2.4</td><td>85.5±1.8</td><td>90.4±0.8</td><td>88.4±1</td><td>88.8</td></tr><tr><td>RoBERTaLarge</td><td>CE + SCL p-value</td><td>96.3±0.4 0.07</td><td>86.1±0.8 0.63</td><td>89.5±0.9 0.01</td><td>85.7±0.5 0.06</td><td>93.9±0.7 0.01</td><td>88.6±0.7 0.16</td><td>90</td></tr><tr><td>RoBERTaLarge</td><td>CE +CE p-value</td><td>96±0.4 0.39</td><td>86.3±0.4 0.13</td><td>89±1 0.01</td><td>84.9±1 0.1</td><td>93.9±0.8 0.01</td><td>89±1 0.12</td><td>89.9</td></tr><tr><td>RoBERTaLarge</td><td>Khosla et al. (2020) p-value</td><td>96±0.3 0.4</td><td>86.7±1 0.42</td><td>89.3±1.2 0.01</td><td>85.2±1 0.22</td><td>92.4±0.7 0.01</td><td>88.8±0.9 0.13</td><td>89.7</td></tr></table>
274
+
275
+ Table 8: Test results on the validation set of GLUE benchmark. We compare fine-tuning RoBERTaLarge with CE with and without SCL, $\mathrm { C E + C E }$ and the two-stage method of Khosla et al. (2020). Best hyperparameter configuration is picked based on the average validation accuracy. We report average accuracy across 10 seeds for the model with the best hyperparameter configuration, its standard deviation, and p-values. $\mathrm { C E + C E }$ refers to the case where we replace SCL loss with the CE loss but keep l2 normalization and temperature scaling.
276
+
277
+ Table 9: Ablation on performance and fine-tuning speed shown as average updates per second (Avg ups/sec) for fine-tuning RoBERTa-Base with respect to the batch size (Bsz). $\mathrm { C E + C E }$ refers to the case where we replace SCL loss with the CE loss but keep l2 normalization and temperature scaling.
278
+
279
+ <table><tr><td>Model</td><td>Loss</td><td>Bsz</td><td>SST-2</td><td>CoLA</td><td>QNLI</td><td>MNLI</td><td>Avg ups/sec</td></tr><tr><td>RoBERTaBase</td><td>CE</td><td>16</td><td>94.1±0.5</td><td>83.3±0.7</td><td>88.2±0.8</td><td>84±0.6</td><td>15.9</td></tr><tr><td>RoBERTaBase</td><td>CE + SCL</td><td>16</td><td>94.9±0.6</td><td>83.7±0.9</td><td>92.5±0.4</td><td>85.3±0.5</td><td>15.08</td></tr><tr><td>RoBERTaBase</td><td>CE+CE</td><td>16</td><td>94.8±0.7</td><td>83.6±0.4</td><td>91.6±0.5</td><td>85±0.3</td><td>15.25</td></tr><tr><td>RoBERTaBase</td><td>CE</td><td>64</td><td>94.2±0.4</td><td>83.3±0.5</td><td>89.2±0.5</td><td>84±0.4</td><td>8.43</td></tr><tr><td>RoBERTaBase</td><td>CE + SCL</td><td>64</td><td>94.7±0.2</td><td>83.8±0.6</td><td>92.6±0.5</td><td>85.7±0.7</td><td>7.44</td></tr><tr><td>RoBERTaBase</td><td>CE+CE</td><td>64</td><td>94.6±0.7</td><td>83.5±0.6</td><td>92.1±0.8</td><td>85±0.8</td><td>7.64</td></tr><tr><td>RoBERTaBase</td><td>CE</td><td>256</td><td>94.1±0.4</td><td>84±0.5</td><td>90±0.7</td><td>84.4±0.6</td><td>2.46</td></tr><tr><td>RoBERTaBase</td><td>CE + SCL</td><td>256</td><td>95.2±0.3</td><td>84.5±0.5</td><td>92.9±0.3</td><td>86.6±0.6</td><td>1.54</td></tr><tr><td>RoBERTaBase</td><td>CE+CE</td><td>256</td><td>94.3±0.5</td><td>83.5±0.3</td><td>91.9±0.4</td><td>84.6±0.8</td><td>1.77</td></tr></table>
280
+
281
+ <table><tr><td>Model</td><td>Loss</td><td>N</td><td>SST-2</td><td>QNLI</td><td>MNLI</td></tr><tr><td>RoBERTaLarge</td><td>CE</td><td>20</td><td>85.9±2.1</td><td>65.0±2.0</td><td>39.3±2.5</td></tr><tr><td>RoBERTaLarge</td><td>CE + SCL p-value</td><td>20</td><td>88.1±3.3 5e-10</td><td>75.7±4.8 1e-46</td><td>42.7±4.6 1e-8</td></tr><tr><td>RoBERTaLarge</td><td>CE + CE p-value</td><td>20</td><td>86.5±2.2 0.03</td><td>75.1±3.5 4e-68</td><td>40.8±3.7 3e-4</td></tr><tr><td>RoBERTaLarge</td><td>CE</td><td>100</td><td>91.1±1.3</td><td>81.9±0.4</td><td>59.2±2.1</td></tr><tr><td>RoBERTaLarge</td><td>CE + SCL p-value</td><td>100</td><td>92.8±1.3 3e-17</td><td>82.5±0.4 1e-20</td><td>61.1±3.0 2e-4</td></tr><tr><td>RoBERTaLarge</td><td>CE+CE p-value</td><td>100</td><td>91.7±0.5 1e-4</td><td>81.7±0.5 3e-4</td><td>56±4.0 2e-8</td></tr><tr><td>RoBERTaLarge</td><td>CE</td><td>1000</td><td>94.0±0.6</td><td>89.2±0.6</td><td>81.4±0.2</td></tr><tr><td>RoBERTaLarge</td><td>CE + SCL p-value</td><td>1000</td><td>94.1±0.5 0.6</td><td>89.8±0.4 1e-12</td><td>81.5±0.2 0.5</td></tr><tr><td>RoBERTaLarge</td><td>CE + CE p-value</td><td>1000</td><td>94±0.7 0.78</td><td>89.3±1 0.06</td><td>81.2±0.2 0.12</td></tr></table>
282
+
283
+ Table 10: Few-shot learning test results on the GLUE benchmark where we have N=20,100,1000 labeled examples for fine-tuning. Reported results are the mean and the standard deviation of the test accuracies of the top 3 models based on the validation accuracy out of 10 random training set samples, along with $\mathsf { p } \cdot$ -values for each experiment. $\mathrm { C E + C E }$ refers to the case where we replace SCL loss with the CE loss but keep l2 normalization and temperature scaling.
md/train/g-wu9TMPODo/g-wu9TMPODo.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/iAX0l6Cz8ub/iAX0l6Cz8ub.md ADDED
@@ -0,0 +1,590 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GEOMETRY-AWARE INSTANCE-REWEIGHTED ADVER-SARIAL TRAINING
2
+
3
+ Jingfeng Zhang1,2 Jianing Zhu3 Gang Niu1 Bo Han3,1
4
+ Masashi Sugiyama1,4 Mohan Kankanhalli2
5
+ 1RIKEN Center for Advanced Intelligence Project, Tokyo, Japan
6
+ 2National University of Singapore, Singapore
7
+ 3Hong Kong Baptist University, Hong Kong SAR, China
8
+ 4The University of Tokyo, Tokyo, Japan
9
+
10
+ jingfeng.zhang@riken.jp, csjnzhu@comp.hkbu.edu.hk gang.niu@riken.jp, bhanml@comp.hkbu.edu.hk sugi@k.u-tokyo.ac.jp, mohan@comp.nus.edu.sg
11
+
12
+ # ABSTRACT
13
+
14
+ In adversarial machine learning, there was a common belief that robustness and accuracy hurt each other. The belief was challenged by recent studies where we can maintain the robustness and improve the accuracy. However, the other direction, we can keep the accuracy and improve the robustness, is conceptually and practically more interesting, since robust accuracy should be lower than standard accuracy for any model. In this paper, we show this direction is also promising. Firstly, we find even over-parameterized deep networks may still have insufficient model capacity, because adversarial training has an overwhelming smoothing effect. Secondly, given limited model capacity, we argue adversarial data should have unequal importance: geometrically speaking, a natural data point closer to/farther from the class boundary is less/more robust, and the corresponding adversarial data point should be assigned with larger/smaller weight. Finally, to implement the idea, we propose geometry-aware instance-reweighted adversarial training, where the weights are based on how difficult it is to attack a natural data point. Experiments show that our proposal boosts the robustness of standard adversarial training; combining two directions, we improve both robustness and accuracy of standard adversarial training.
15
+
16
+ # 1 INTRODUCTION
17
+
18
+ Crafted adversarial data can easily fool the standard-trained deep models by adding humanimperceptible noise to the natural data, which leads to the security issue in applications such as medicine, finance, and autonomous driving (Szegedy et al., 2014; Nguyen et al., 2015). To mitigate this issue, many adversarial training methods employ the most adversarial data maximizing the loss for updating the current model such as standard adversarial training (AT) (Madry et al., 2018), TRADES (Zhang et al., 2019), robust self-training (RST) (Carmon et al., 2019), and MART (Wang et al., 2020b). The adversarial training methods seek to train an adversarially robust deep model whose predictions are locally invariant to a small neighborhood of its inputs (Papernot et al., 2016). By leveraging adversarial data to smooth the small neighborhood, the adversarial training methods acquire adversarial robustness against adversarial data but often lead to the undesirable degradation of standard accuracy on natural data (Madry et al., 2018; Zhang et al., 2019).
19
+
20
+ Thus, there have been debates on whether there exists a trade-off between robustness and accuracy. For example, some argued an inevitable trade-off: Tsipras et al. (2019) showed fundamentally different representations learned by a standard-trained model and an adversarial-trained model; Zhang et al. (2019) and Wang et al. (2020a) proposed adversarial training methods that can trade off standard accuracy for adversarial robustness. On the other hand, some argued that there is no such the trade-off: Raghunathan et al. (2020) showed infinite data could eliminate this trade-off; Yang et al. (2020) showed benchmark image datasets are class-separated.
21
+
22
+ ![](images/a243a447c40e0492c7a4c20451b1f7a4eca6fb5c7ed937b4fc861042d49d998b.jpg)
23
+ Figure 1: The illustration of GAIRAT. GAIRAT explicitly gives larger weights on the losses of adversarial data (larger red), whose natural counterparts are closer to the decision boundary (lighter blue). GAIRAT explicitly gives smaller weights on the losses of adversarial data (smaller red), whose natural counterparts are farther away from the decision boundary (darker blue). The examples of two toy datasets and the CIFAR-10 dataset refer to Figure 3.
24
+
25
+ Recently, emerging adversarial training methods have empirically challenged this trade-off. For example, Zhang et al. (2020b) proposed the friendly adversarial training method (FAT), employing friendly adversarial data minimizing the loss given that some wrongly-predicted adversarial data have been found. Yang et al. (2020) introduced dropout (Srivastava et al., 2014) into existing AT, RST, and TRADES methods. Both methods can improve the accuracy while maintaining the robustness. However, the other direction—whether we can improve the robustness while keeping the accuracy—remains unsolved and is more interesting.
26
+
27
+ In this paper, we show this direction is also achievable. Firstly, we show over-parameterized deep networks may still have insufficient model capacity, because adversarial training has an overwhelming smoothing effect. Fitting adversarial data is demanding for a tremendous model capacity: It requires a large number of trainable parameters or long-enough training epochs to reach near-zero error on the adversarial training data (see Figure 2). The over-parameterized models that fit natural data entirely in the standard training (Zhang et al., 2017) are still far from enough for fitting adversarial data. Compared with standard training fitting the natural data points, adversarial training smooths the neighborhoods of natural data, so that adversarial data consume significantly more model capacity than natural data. Thus, adversarial training methods should carefully utilize the limited model capacity to fit the neighborhoods of the important data that aid to fine-tune the decision boundary. Therefore, it may be unwise to give equal weights to all adversarial data.
28
+
29
+ Secondly, data along with their adversarial variants are not equally important. Some data are geometrically far away from the class boundary. They are relatively guarded. Their adversarial variants are hard to be misclassified. On the other hand, some data are close to the class boundary. They are relatively attackable. Their adversarial variants are easily misclassified (see Figure 3). As the adversarial training progresses, the adversarially robust model engenders an increasing number of guarded training data and a decreasing number of attackable training data. Given limited model capacity, treating all data equally may cause the vast number of adversarial variants of the guarded data to overwhelm the model, leading to the undesirable robust overfitting (Rice et al., 2020). Thus, it may be pessimistic to treat all data equally in adversarial training.
30
+
31
+ To ameliorate this pessimism, we propose a heuristic method, i.e., geometry-aware instancereweighted adversarial training (GAIRAT). As shown in Figure 1, GAIRAT treats data differently. Specifically, for updating the current model, GAIRAT gives larger/smaller weight to the loss of an adversarial variant of attackable/guarded data point which is more/less important in fine-tuning the decision boundary. An attackable/guarded data point has a small/large geometric distance, i.e., its distance from the decision boundary. We approximate its geometric distance by the least number of iterations $\kappa$ that projected gradient descent method (Madry et al., 2018) requires to generate a misclassified adversarial variant (see the details in Section 3.3). GAIRAT explicitly assigns instancedependent weight to the loss of its adversarial variant based on the least iteration number $\kappa$ .
32
+
33
+ Our contributions are as follows. (a) In adversarial training, we identify the pessimism in treating all data equally, which is due to the insufficient model capacity and the unequal nature of different data (in Section 3.1). (b) We propose a new adversarial training method, i.e., GAIRAT (its learning objective in Section 3.2 and its realization in Section 3.3). GAIRAT is a general method: Besides standard AT (Madry et al., 2018), the existing adversarial training methods such as FAT (Zhang et al., 2020b) and TRADES (Zhang et al., 2019) can be modified to GAIR-FAT and GAIR-TRADES (in Appendices B.1 and B.2, respectively). (c) Empirically, our GAIRAT can relieve the issue of robust overfitting (Rice et al., 2020), meanwhile leading to the improved robustness with zero or little degradation of accuracy (in Section 4.1 and Appendix C.1). Besides, we use Wide ResNets (Zagoruyko & Komodakis, 2016) to corroborate the efficacy of our geometry-aware instance-reweighted methods: Our GAIRAT significantly boosts the robustness of standard AT; combined with FAT, our GAIRFAT improves both the robustness and accuracy of standard AT (in Section 4.2). Consequently, we conjecture no inevitable trade-off between robustness and accuracy.
34
+
35
+ ![](images/a192d76cc019de17374fff10e8afd6aaf41f873f9cfe956ab015fb6274a8d197.jpg)
36
+ Figure 2: We plot standard training error (Natural) and adversarial training error (PGD-10) over the training epochs of the standard AT on CIFAR-10 dataset. Left panel: AT on different sizes of network. The red line represents standard test accuracy by standard training (ST). Right panel: AT on ResNet-18 under different perturbation bounds $\epsilon _ { \mathrm { t r a i n } }$ .
37
+
38
+ # 2 ADVERSARIAL TRAINING
39
+
40
+ In this section, we review adversarial training methods (Madry et al., 2018; Zhang et al., 2020b).
41
+
42
+ # 2.1 LEARNING OBJECTIVE
43
+
44
+ Let $( \mathcal { X } , d _ { \infty } )$ denote the input feature space $\mathcal { X }$ with the infinity distance metric $d _ { \operatorname* { i n f } } ( x , x ^ { \prime } ) = \| x -$ $x ^ { \prime } \| _ { \infty }$ , and $\dot { B } _ { \epsilon } [ x ] = \{ x ^ { \prime } \in \bar { \mathcal { X } } \mid d _ { \operatorname* { i n f } } ( x , \bar { x ^ { \prime } } ) \leq \epsilon \}$ be the closed ball of radius $\epsilon > 0$ centered at $x$ in $\mathcal { X }$ . Dataset $S = \{ ( x _ { i } , y _ { i } ) \} _ { i = 1 } ^ { n }$ , where $x _ { i } \in \mathcal X$ and $y _ { i } \in \mathcal { Y } = \{ 0 , 1 , . . . , C - 1 \}$ .
45
+
46
+ The objective function of standard adversarial training (AT) (Madry et al., 2018) is
47
+
48
+ $$
49
+ \operatorname* { m i n } _ { f _ { \theta } \in \mathcal { F } } \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \ell ( f _ { \theta } ( \tilde { x } _ { i } ) , y _ { i } ) ,
50
+ $$
51
+
52
+ where
53
+
54
+ $$
55
+ \begin{array} { r } { \tilde { x } _ { i } = \arg \operatorname* { m a x } _ { \tilde { x } \in \mathcal { B } _ { \epsilon } [ x _ { i } ] } \ell ( f _ { \theta } ( \tilde { x } ) , y _ { i } ) , } \end{array}
56
+ $$
57
+
58
+ where $\tilde { x }$ is the most adversarial data within the $\epsilon$ -ball centered at $x$ , $f _ { \theta } ( \cdot ) : \mathcal { X } \mathbb { R } ^ { C }$ is a score function, and the loss function $\ell : \mathbb { R } ^ { C } \times \mathcal { V } \mathbb { R }$ is a composition of a base loss $\ell _ { \mathbf { B } } : \Delta ^ { C - 1 } \times \mathcal { Y } \mathbb { R }$ (e.g., the cross-entropy loss) and an inverse link function $\ell _ { \mathrm { L } } : \mathbb { R } ^ { C } \to \Delta ^ { C - 1 }$ (e.g., the soft-max activation), in which $\sum C - 1$ is the corresponding probability simplex—in other words, $\ell ( f _ { \theta } ( \cdot ) , y ) =$ $\ell _ { \mathrm { B } } ( \ell _ { \mathrm { L } } ( f _ { \theta } ( \cdot ) ) , y )$ . AT employs the most adversarial data generated according to Eq. (2) for updating the current model.
59
+
60
+ The objective function of friendly adversarial training (FAT) (Zhang et al., 2020b) is
61
+
62
+ $$
63
+ \tilde { x } _ { i } = \underset { \tilde { x } \in \mathcal { B } _ { \epsilon } [ x _ { i } ] } { \arg \operatorname* { m i n } } \ell ( f _ { \theta } ( \tilde { x } ) , y _ { i } ) \mathrm { ~ s . t . ~ } \ell ( f _ { \theta } ( \tilde { x } ) , y _ { i } ) - \operatorname* { m i n } _ { y \in \mathcal { Y } } \ell ( f _ { \theta } ( \tilde { x } ) , y ) \geq \rho .
64
+ $$
65
+
66
+ Note that the outer minimization remains the same as Eq. (1), and the operator arg max is replaced by arg min. $\rho$ is a margin of loss values (i.e., the misclassification confidence). The constraint of Eq. (3) firstly ensures $\tilde { x }$ is misclassified, and secondly ensures for $\tilde { x }$ the wrong prediction is better than the desired prediction $y _ { i }$ by at least $\rho$ in terms of the loss value. Among all such $\tilde { x }$ satisfying the constraint, Eq. (3) selects the one minimizing $\ell ( f _ { \theta } ( \tilde { x } ) , y _ { i } )$ by a violation of the value $\rho$ . There are no constraints on ${ \tilde { x } } _ { i }$ if $\tilde { x } _ { i }$ is correctly classified. FAT employs the friendly adversarial data generated according to Eq. (3) for updating the current model.
67
+
68
+ ![](images/3810bd9401f9ce396447a8f469962649a02c6d132d8ad62848f5e49ef15ed1de.jpg)
69
+ Figure 3: More attackable data (lighter red and blue) are closer to the class boundary; more guarded data (darker red and blue) are farther away from the class boundary. Left panel: Two toy examples. Right panel: The model’s output distribution of two randomly selected classes from the CIFAR-10 dataset. The degree of robustness (denoted by the color gradient) of a data point is calculated based on the least number of iterations $\kappa$ that PGD needs to find its misclassified adversarial variant.
70
+
71
+ # 2.2 REALIZATIONS
72
+
73
+ AT and FAT’s objective functions imply the optimization of adversarially robust networks, with one step generating adversarial data and one step minimizing loss on the generated adversarial data w.r.t. the model parameters $\theta$ .
74
+
75
+ The projected gradient descent method (PGD) (Madry et al., 2018) is the most common approximation method for searching adversarial data. Given a starting point $x ^ { ( 0 ) } \in \mathcal { X }$ and step size $\alpha > 0$ , PGD works as follows:
76
+
77
+ $$
78
+ \begin{array} { r } { \boldsymbol { x } ^ { ( t + 1 ) } = \Pi _ { \mathcal { B } [ \boldsymbol { x } ^ { ( 0 ) } ] } \big ( \boldsymbol { x } ^ { ( t ) } + \alpha \mathrm { s i g n } ( \nabla _ { \boldsymbol { x } ^ { ( t ) } } \ell \big ( f _ { \theta } ( \boldsymbol { x } ^ { ( t ) } ) , \boldsymbol { y } ) ) \big ) , t \in \mathbb { N } } \end{array}
79
+ $$
80
+
81
+ until a certain stopping criterion is satisfied. $\ell$ is the loss function; $x ^ { ( 0 ) }$ refers to natural data or natural data perturbed by a small Gaussian or uniformly random noise; $y$ is the corresponding label for natural data; $x ^ { ( t ) }$ is adversarial data at step $t$ ; and $\Pi _ { B _ { \epsilon } [ x _ { 0 } ] } ( \cdot )$ is the projection function that projects the adversarial data back into the $\epsilon$ -ball centered at $x ^ { ( 0 ) }$ if necessary.
82
+
83
+ There are different stopping criteria between AT and FAT. AT employs a fixed number of iterations $K$ , namely, the PGD- $K$ algorithm (Madry et al., 2018), which is commonly used in many adversarial training methods such as CAT (Cai et al., 2018), DAT (Wang et al., 2019), TRADES (Zhang et al., 2019), and MART (Wang et al., 2020b). On the other hand, FAT employs the misclassification-aware criterion. For example, Zhang et al. (2020b) proposed the early-stopped PGD- $K \tau$ algorithm $\tau \leq$ $K$ ; $K$ is the fixed and maximally allowed iteration number): Once the PGD- $K \tau$ finds the current model misclassifying the adversarial data, it stops the iterations immediately $\mathit { \Omega } ^ { ' \tau } = 0 \mathit { \Omega } _ { . }$ ) or slides a few more steps $( \tau > 0 )$ ). This misclassification-aware criterion is used in the emerging adversarial training methods such as MMA (Ding et al., 2020), FAT (Zhang et al., 2020b), ATES (Sitawarin et al., 2020), and Customized AT (Cheng et al., 2020).
84
+
85
+ AT can enhance the robustness against adversarial data but, unfortunately, degrades the standard accuracy on the natural data significantly (Madry et al., 2018). On the other hand, FAT has better standard accuracy with near-zero or little degradation of robustness (Zhang et al., 2020b).
86
+
87
+ Nevertheless, both AT and FAT treat the generated adversarial data equally for updating the model parameters, which is not necessary and sometimes even pessimistic. In the next sections, we introduce our method GAIRAT, which is compatible with existing methods such as AT, FAT, and TRADES. Consequently, GAIRAT can significantly enhance robustness with little or even zero degradation of standard accuracy.
88
+
89
+ # 3 GEOMETRY-AWARE INSTANCE-REWEIGHTED ADVERSARIAL TRAINING
90
+
91
+ In this section, we propose geometry-aware instance-reweighted adversarial training (GAIRAT) and its learning objective as well as its algorithmic realization.
92
+
93
+ # 3.1 MOTIVATIONS OF GAIRAT
94
+
95
+ Model capacity is often insufficient in adversarial training. In the standard training, the overparameterized networks, e.g., ResNet-18 and even larger ResNet-50, have more than enough model capacity, which can easily fit the natural training data entirely (Zhang et al., 2017). However, the left panel of Figure 2 shows that the model capacity of those over-parameterized networks is not enough for fitting the adversarial data. Under the computational budget of 100 epochs, the networks hardly reach zero error on the adversarial training data. Besides, adversarial training error only decreases by a small constant factor with the significant increase of the model’s parameters. Even worse, a slightly larger perturbation bound $\epsilon _ { \mathrm { t r a i n } }$ significantly uncovers this insufficiency of the model capacity (right panel): Adversarial training error significantly increases with slightly larger $\epsilon _ { \mathrm { t r a i n } }$ . Surprisingly, the standard training error on natural data hardly reaches zero with $\epsilon _ { \mathrm { t r a i n } } = 1 6 / 2 5 5$ .
96
+
97
+ Adversarial training methods employ the adversarial data to reduce the sensitivity of the model’s output w.r.t. small changes of the natural data (Papernot et al., 2016). During the training process, adversarial data are generated on the fly and are adaptively changed based on the current model to smooth the natural data’s local neighborhoods. The volume of this surrounding is exponentially $( | 1 + \epsilon _ { \mathrm { t r a i n } } | ^ { | \mathcal { X } | } )$ large w.r.t. the input dimension $| \mathcal { X } |$ , even if $\epsilon _ { \mathrm { t r a i n } }$ is small. Thus, this smoothness consumes significant model capacity. In adversarial training, we should carefully leverage the limited model capacity by fitting the important data and by ignoring the unimportant data.
98
+
99
+ More attackable/guarded data are closer to/farther away from the class boundary. We can measure the importance of the data by their robustness against adversarial attacks. Figure 3 shows that the robustness (more attackable or more guarded) of the data is closely related to their geometric distance from the decision boundary. From the geometry perspective, more attackable data are closer to the class boundary whose adversarial variants are more important to fine-tune the decision boundary for enhancing robustness.
100
+
101
+ Appendix A contains experimental details of Figures 2 and 3 and more motivation figures.
102
+
103
+ # 3.2 LEARNING OBJECTIVE OF GAIRAT
104
+
105
+ Let $\omega ( x , y )$ be the geometry-aware weight assignment function on the loss of adversarial variant $\tilde { x }$ . The inner optimization for generating $\tilde { x }$ still follows Eq. (2) or Eq. (3). The outer minimization is
106
+
107
+ $$
108
+ \operatorname* { m i n } _ { f _ { \theta } \in \mathcal { F } } \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \omega ( x _ { i } , y _ { i } ) \ell ( f _ { \theta } ( \tilde { x } _ { i } ) , y _ { i } ) .
109
+ $$
110
+
111
+ The constraint firstly ensures that $y _ { i } = \arg \operatorname* { m a x } _ { i } f _ { \theta } ( x _ { i } )$ and secondly ensures that $\omega ( x _ { i } , y _ { i } )$ is a non-increasing function w.r.t. the geometric distance, i.e., the distance from data $x _ { i }$ to the decision boundary, in which $\omega ( x _ { i } , y _ { i } ) \ge 0$ and $\begin{array} { r } { \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \omega ( x _ { i } , y _ { i } ) = 1 } \end{array}$ .
112
+
113
+ There are no constraints when $y _ { i } \neq \arg \operatorname* { m a x } _ { i } f _ { \theta } ( x _ { i } ) :$ for those $x$ significantly far away from the decision boundary, we may discard them (outliers); for those $x$ close to the decision boundary, we may assign them large weights. In this paper, we do not consider outliers, and therefore we assign large weight to the losses of adversarial data, whose natural counterparts are misclassified. Figure 1 provides an illustrative schematic of the learning objective of GAIRAT.
114
+
115
+ A burn-in period may be introduced, i.e., during the initial period of the training epochs, $\omega ( x _ { i } , y _ { i } ) =$ 1 regardless of the geometric distance of input $( x _ { i } , y _ { i } )$ , because the geometric distance is less informative initially, when the classifier is not properly learned.
116
+
117
+ # 3.3 REALIZATION OF GAIRAT
118
+
119
+ The learning objective Eq. (5) implies the optimization of an adversarially robust network, with one step generating adversarial data and then reweighting loss on them according to the geometric distance of their natural counterparts, and one step minimizing the reweighted loss w.r.t. the model parameters $\theta$ .
120
+
121
+ We approximate the geometric distance of a data point $( x , y )$ by the least iteration numbers $\kappa ( x , y )$ that the PGD method needs to generate a adversarial variant $\tilde { x }$ to fool the current network, given the
122
+
123
+ Input: data $x \in \mathcal { X }$ , label $y \in \mathcal { V }$ , model $f$ , loss function $\ell$ , maximum PGD step $K$ , perturbation
124
+ bound $\epsilon$ , step size $\alpha$
125
+ Output: adversarial data $\tilde { x }$ and geometry value $\kappa ( x , y )$
126
+ $\tilde { x } \gets x$ ; $\kappa ( x , y ) \gets 0$
127
+ while $K > 0$ do if arg maxi $f ( \tilde { x } ) = y$ then $\kappa ( x , y ) \gets \kappa ( x , y ) + 1$ end if $\begin{array} { r l } & { \tilde { x } \gets \Pi _ { \mathcal { B } [ x , \epsilon ] } \big ( \alpha \mathrm { s i g n } ( \nabla _ { \tilde { x } } \ell ( f ( \tilde { x } ) , y ) ) + \tilde { x } \big ) } \\ & { K \gets K - 1 } \end{array}$
128
+ end while
129
+
130
+ # Algorithm 2 Geometry-aware instance-dependent adversarial training (GAIRAT)
131
+
132
+ Input: network $f _ { \theta }$ , training dataset $S = \{ ( x _ { i } , y _ { i } ) \} _ { i = 1 } ^ { n }$ , learning rate $\eta$ , number of epochs $T$ ,
133
+ batch size $m$ , number of batches $M$
134
+ Output: adversarially robust network $f _ { \theta }$
135
+ for epoch $= 1$ , . . . , $T$ do for mini-batch $\mathbf { \Psi } = 1 , \dots , M$ do Sample a mini-batch $\{ ( x _ { i } , y _ { i } ) \} _ { i = 1 } ^ { m }$ from $S$ for $i = 1 , \ldots , m$ (in parallel) do Obtain adversarial data ${ \tilde { x } } _ { i }$ of $x _ { i }$ and geometry value $\kappa ( x _ { i } , y _ { i } )$ by Algorithm 1 Calculate $\omega ( x _ { i } , y _ { i } )$ according to geometry value $\kappa ( x _ { i } , y _ { i } )$ by Eq. 6 end for $\begin{array} { r l } & { \theta \theta - \eta \nabla _ { \theta } \bigg \{ \sum _ { i = 1 } ^ { m } \frac { \omega ( x _ { i } , y _ { i } ) } { \sum _ { j = 1 } ^ { m } \omega ( x _ { j } , y _ { j } ) } \ell \big ( f _ { \theta } ( \tilde { x } _ { i } ) , y _ { i } \big ) \bigg \} } \end{array}$ end for
136
+ end for
137
+
138
+ maximally allowed iteration number $K$ and step size $\alpha$ . Thus, the geometric distance is approximated by $\kappa$ (precisely by $\kappa \times \alpha ,$ ). Thus, the value of the weight function $\omega$ should be non-increasing w.r.t. $\kappa$ . We name $\kappa ( x , y )$ the geometry value of data $( x , y )$ .
139
+
140
+ How to calculate the optimal $\omega$ is still an open question; therefore, we heuristically design different non-increasing functions $\omega$ . We give one example here and discuss more examples in Appendix C.3 and Section 4.1.
141
+
142
+ $$
143
+ w ( x , y ) = \frac { ( 1 + \operatorname { t a n h } ( \lambda + 5 \times ( 1 - 2 \times \kappa ( x , y ) / K ) ) ) } { 2 } ,
144
+ $$
145
+
146
+ where $\kappa / K \in [ 0 , 1 ]$ , $K \in \mathbb { N } ^ { + }$ , and $\lambda \in \mathbb { R }$ . If $\lambda = + \infty$ , GAIRAT recovers the standard AT (Madry et al., 2018), assigning equal weights to the losses of adversarial data.
147
+
148
+ Algorithm 1 is a geometry-aware PGD method (GA-PGD), which returns both the most adversarial data and the geometry value of its natural counterpart. Algorithm 2 is geometry-aware instancedependent adversarial training (GAIRAT). GAIRAT leverages Algorithms 1 for obtaining the adversarial data and the geometry value. For each mini-batch, GAIRAT reweighs the loss of adversarial data $( \tilde { x } _ { i } , y _ { i } )$ according to the geometry value of their natural counterparts $( x _ { i } , y _ { i } )$ , and then updates the model parameters by minimizing the sum of the reweighted loss.
149
+
150
+ GAIRAT is a general method. Indeed, FAT (Zhang et al., 2020b) and TRADES (Zhang et al., 2019) can be modified to GAIR-FAT and GAIR-TRADES (see Appendices B.1 and B.2, respectively).
151
+
152
+ Comparisons with SVM. The abstract concept of GAIRAT has appeared previously. For example, in the support vector machine (SVM), support vectors near the decision boundary are particularly useful in influencing the decision boundary (Hearst et al., 1998). For learning models, the magnitude of the loss function (e.g., the hinge loss and the logistic loss) can naturally capture different data’s geometric distance from the decision boundary. For updating the model, the loss function treats data differently by incurring large losses on important attackable (close to the decision boundary) or misclassified data and incurring zero or very small losses on unimportant guarded (far away from the decision boundary) data.
153
+
154
+ However, in adversarial training, it is critical to explicitly assign different weights on top of losses on different adversarial data due to the blocking effect: The model trained on the adversarial data that maximize the loss learns to prevent generating large-loss adversarial data. This blocking effect makes the magnitude of the loss less capable of distinguishing important adversarial data from unimportant ones for updating the model parameters, compared with the role of loss on measuring the natural data’s importance in standard training. Our GAIRAT breaks this blocking effect by explicitly extracting data’s geometric information to distinguish the different importance.
155
+
156
+ Comparisons with AdaBoost and focal loss. The idea of instance-dependent weighting has been studied in the literature. Besides robust estimator (e.g., M-estimator (Boos & Stefanski, 2013)) for learning under outliers (e.g., label-noised data), hard data mining is another branch where our GAIRAT belongs. Boosting algorithms such as AdaBoost (Freund & Schapire, 1997) select harder examples to train subsequent classifiers. Focal loss (Lin et al., 2017) is specially designed loss function for mining hard data and misclassified data. However, the previous hard data mining methods leverage the data’s losses for measuring the hardness; by comparison, our GAIRAT measures the hardness by how difficulty the natural data are attacked (i.e., geometry value $\kappa$ ). This new measurement $\kappa$ sheds new lights on measuring the data’s hardness (Zhu et al., 2021).
157
+
158
+ Comparisons with related adversarial training methods. Some existing adversarial training methods also “treat adversarial data differently”, but in different ways to our GAIRAT. For example, CAT (Cai et al., 2018), MMA (Ding et al., 2020), and DAT (Wang et al., 2019) methods generate the differently adversarial data for updating model over the training process. CAT utilized the adversarial data with different PGD iterations $K$ . DAT utilized the adversarial data with different convergence qualities. MMA leveraged adversarial data with instance-dependent perturbation bounds $\epsilon$ . Different from those existing methods, our GAIRAT treat adversarial data differently by explicitly assigning different weights on their losses, which can break the blocking effect.
159
+
160
+ Note that the learning objective of MART (Wang et al., 2020b) also explicitly assigns weights, not directly on the adversarial loss but KL divergence loss (see details in Section C.7). The KL divergence loss helps to strengthen the smoothness within the norm ball of natural data, which is also used in VAT (Miyato et al., 2016) and TRADES (Zhang et al., 2019). Differently from MART, our GAIRAT explicitly assigns weights on the adversarial loss. Therefore, we can easily modify MART to GAIR-MART (see experimental comparisons in Section C.7). Besides, MART assigns weights based on the model’s prediction confidence on the natural data; GAIRAT assigns weights based on how easy the natural data can be attacked (geometry value $\kappa$ ).
161
+
162
+ Comparisons with the geometric studies of DNN. Researchers in adversarial robustness employed the first-order or second-order derivatives w.r.t. input data to explore the DNN’s geometric properties (Fawzi et al., 2017; Kanbak et al., 2018; Fawzi et al., 2018; Qin et al., 2019; MoosaviDezfooli et al., 2019). Instead, we have a complementary but different argument: Data points themselves are geometrically different regardless of DNN. The geometry value $\kappa$ in adversarial training (AT) is an approximated measurement of data’s geometric properties due to the AT’s smoothing effect (Zhu et al., 2021).
163
+
164
+ # 4 EXPERIMENTS
165
+
166
+ In this section, we empirically justify the efficacy of GAIRAT. Section 4.1 shows that GAIRAT can relieve the undesirable robust overfitting (Rice et al., 2020) of the minimax-based adversarial training (Madry et al., 2018). Note that some concurrent studies (Chen et al., 2021a;b) provided various adversarial training strategies, which can also mitigate the issue of robust overfitting. In Section 4.2, we benchmark our GAIRAT and GAIR-FAT using Wide ResNets and compare them with AT and FAT.
167
+
168
+ In our experiments, we consider $| | \tilde { x } - x | | _ { \infty } \leq \epsilon$ with the same $\epsilon$ in both training and evaluations. All images of CIFAR-10 (Krizhevsky, 2009) and SVHN (Netzer et al., 2011) are normalized into [0, 1].
169
+
170
+ ![](images/11c91c9199ddeb0a8a8709de8dff08b5faf51a169575993e55eb5ebaccb2aec2.jpg)
171
+ Figure 4: Comparisons of AT $\omega _ { 1 }$ , red lines) and GAIRAT $\omega _ { 2 }$ , blue lines and $\omega _ { 3 }$ , yellow lines) using ResNet-18 on the CIFAR-10 dataset. Upper-left panel shows different weight assignment functions $\omega$ w.r.t. the geometry value $\kappa$ . Bottom-left panel reports the training statistic of the standard AT and calculates the median (dark red circle) and mean (light red cross) of geometry values of all training data at each epoch. Upper-middle and upper-right panels report standard training/test errors and robust training/test errors, respectively. Bottom-middle and bottom-right panels report the loss flatness w.r.t. friendly adversarial test data and most adversarial test data, respectively.
172
+
173
+ # 4.1 GAIRAT RELIEVES ROBUST OVERFITTING
174
+
175
+ In Figure 4, we conduct the standard AT (all red lines) using ResNet-18 (He et al., 2016) on CIFAR10 dataset. For generating the most adversarial data for updating the model, the perturbation bound $\epsilon = 8 / 2 5 5$ ; the PGD steps number $K = 1 0$ with step size $\alpha = 2 / 2 5 5$ , which keeps the same as Rice et al. (2020). We train ResNet-18 using SGD with 0.9 momentum for 100 epochs with the initial learning rate of 0.1 divided by 10 at Epoch 30 and 60, respectively. At each training epoch, we collect the training statistics, i.e., the geometry value $\kappa ( x , y )$ of each training data, standard/robust training and test error, the flatness of loss w.r.t. adversarial test data. The detailed descriptions of those statistics and the evaluations are in the Appendix C.1.
176
+
177
+ Bottom-left panel of Figure 4 shows geometry value $\kappa$ of training data of standard AT. Over the training progression, there is an increasing number of guarded training data with a sudden leap when the learning rate decays to 0.01 at Epoch 30. After Epoch 30, the model steadily engenders a increasing number of guarded data whose adversarial variants are correctly classified. Learning from those correctly classified adversarial data (large portion) will reinforce the existing knowledge and spare little focus on wrongly predicted adversarial data (small portion), thus leading to the robust overfitting. The robust overfitting is manifested by red (dashed and solid) lines in upper-middle and upper-right and bottom-middle and bottom-right panels.
178
+
179
+ To avoid the large portion of guarded data overwhelming the learning from the rare attackable data, our GAIRAT explicitly give small weights to the losses of adversarial variants of the guarded data. Blue $\left( \omega _ { 2 } \right)$ and yellow $\left( \omega _ { 3 } \right)$ lines in upper-left panel give two types of weight assignment functions that assign instance-dependent weight on the loss based on the geometry value $\kappa$ . In GAIRAT, the model is forced to give enough focus on those rare attackable data.
180
+
181
+ In GAIRAT, the initial 30 epochs is burn-in period, and we introduce the instance-dependent weight assignment $\omega$ from Epoch 31 onward (both blue and yellow lines in Figure 4). The rest of hyperparameters keeps the same as AT (red lines). From the upper-right panel, GAIRAT (both yellow and blue lines) achieves smaller error on adversarial test data and larger error on training adversarial data, compared with standard AT (red lines). Therefore, our GAIRAT can relieve the issue of the robust overfitting.
182
+
183
+ Besides, Appendix C contains more experiments such as different learning rate schedules, different choices of weight assignment functions $\omega$ , different lengths of burn-in period, a different dataset (SVHN) and different networks (Small CNN and VGG), which all justify the efficacy of our GAIRAT. Notably, in Appendix C.6, we show the effects of GAIR-FAT on improving FAT.
184
+
185
+ # 4.2 PERFORMANCE EVALUATION ON WIDE RESNETS
186
+
187
+ Table 1: Test accuracy of WRN-32-10 on CIFAR-10 dataset
188
+
189
+ <table><tr><td rowspan="2">Defense</td><td colspan="6">Best checkpoint</td><td colspan="6">Last checkpoint</td></tr><tr><td>Natural</td><td>Diff.</td><td>PGD-20</td><td>Diff.</td><td>PGD+</td><td>Diff.</td><td>Natural</td><td>Diff.</td><td>PGD-20</td><td>Diff.</td><td>PGD+</td><td>Diff. </td></tr><tr><td>AT</td><td>86.92±0.24</td><td>-</td><td>51.96±0.21</td><td>-</td><td>51.28 ±0.23</td><td>-</td><td>86.62 ±0.22</td><td>-</td><td>46.73±0.08</td><td>-</td><td>46.08±0.07</td><td>-</td></tr><tr><td>FAT</td><td>89.16 ± 0.15</td><td>+2.24</td><td>51.24±0.14</td><td>-0.72</td><td>46.14± 0.19</td><td>-5.14</td><td>88.18±0.19</td><td>+1.56</td><td>46.79±0.34</td><td>+0.06</td><td>45.80±0.16</td><td>-0.28</td></tr><tr><td> GAIRAT</td><td>85.75±0.23</td><td>-1.17</td><td>57.81±0.54</td><td>+5.85</td><td>55.61±0.61</td><td>+4.33</td><td>85.49±0.25</td><td>-1.13</td><td>53.76±0.49</td><td>+7.03</td><td>50.32±0.48</td><td>+4.24</td></tr><tr><td>GAIR-FAT</td><td>88.59±0.12</td><td>+1.67</td><td>56.21±0.52</td><td>+4.25</td><td>53.50±0.60</td><td>+2.22</td><td>88.44±0.10</td><td>+1.82</td><td>50.64±0.56</td><td>+3.91</td><td>47.51 ± 0.51</td><td>+1.43</td></tr></table>
190
+
191
+ We employ the large-capacity network, i.e., Wide ResNet (Zagoruyko & Komodakis, 2016), on the CIFAR-10 dataset. In Table 1, we compare the performance of the standard AT (Madry et al., 2018), FAT (Zhang et al., 2020b), GAIRAT and GAIR-FAT. We use WRN-32-10 that keeps the same as Madry et al. (2018). We compare different methods on the best checkpoint model (suggested by Rice et al. (2020)) and the last checkpoint model (used by Madry et al. (2018)), respectively. Note that results in Zhang et al. (2020b) only compare the last checkpoint between AT and FAT; instead, we also include the best checkpoint comparisons. We evaluate the robust models based on the three evaluation metrics, i.e., standard test accuracy on natural data (Natural), robust test accuracy on adversarial data generated by PGD-20 and $\mathrm { P G D + }$ . $\mathrm { P G D + }$ is PGD with five random starts, and each start has 40 steps with step size 0.01, which keeps the same as Carmon et al. (2019) $( \mathrm { P G D + }$ has $4 0 \times 5 = 2 0 0$ iterations for each test data). We run AT, FAT, GAIRAT, and GAIR-FAT five repeated trials with different random seeds. Table 1 reports the medians and standard deviations of the results. Besides, we treat the results of AT as the baseline and report the difference (Diff.) of the test accuracies. The detailed training settings and evaluations are in Appendix C.8. Besides, we also compare TRADES and GAIR-TRADES using WRN-34-10, which is in the Appendix C.9.
192
+
193
+ Compared with standard AT, our GAIRAT significantly boosts adversarial robustness with little degradation of accuracy, which challenges the inherent trade-off. Besides, FAT also challenges the inherent trade-off instead by improving accuracy with little degradation of robustness. Combining two directions, i.e., GAIR-FAT, we can improve both robustness and accuracy of standard AT. Therefore, Table 1 affirmatively confirms the efficacy of our geometry-aware instance-reweighted methods in significantly improving adversarial training.
194
+
195
+ # 5 CONCLUSION AND FUTURE WORK
196
+
197
+ This paper has proposed a novel adversarial training method, i.e., geometry-aware instancereweighted adversarial training (GAIRAT). GAIRAT gives more (less) weights to loss of the adversarial data whose natural counterparts are closer to (farther away from) the decision boundary. Under the limited model capacity and the inherent inequality of the data, GAIRAT sheds new lights on improving the adversarial training.
198
+
199
+ GAIRAT training under the PGD attacks can defend PGD attacks very well, but indeed, it cannot perform equally well on all existing attacks (Chen et al., 2021a). From the philosophical perspective, we cannot expect defenses under one specific attack can defend all existing attacks, which echoes the previous finding that “it is essential to include adversarial data produced by all known attacks, as the defensive training is non-adaptive (Papernot et al., 2016).” Incorporating all attacks in GAIRAT yet preserving the efficiency is an interesting future direction. Besides, it still an open question to design the optimal weight assignment function $\omega$ in Eq. 5 or to design a proper network structure suitable to adversarial training. Furthermore, there is still a large room to apply adversarial training techniques into other domains such as pre-training (Hendrycks et al., 2019; Chen et al., 2020; Jiang et al., 2020; Salman et al., 2020), noisy labels (Zhu et al., 2021) and so on.
200
+
201
+ # ACKNOWLEDGMENT
202
+
203
+ JZ, GN, and MS were supported by JST AIP Acceleration Research Grant Number JPMJCR20U3, Japan. MS was also supported by the Institute for AI and Beyond, UTokyo. JNZ and BH were supported by the HKBU CSD Departmental Incentive Scheme. BH was supported by the RGC Early Career Scheme No. 22200720 and NSFC Young Scientists Fund No. 62006202. MK was supported by the National Research Foundation, Singapore under its Strategic Capability Research Centres Funding Initiative.
204
+
205
+ # REFERENCES
206
+
207
+ Mislav Balunovic and Martin Vechev. Adversarial training and provable defenses: Bridging the gap. In ICLR, 2020.
208
+
209
+ Denni D. Boos and L. A. Stefanski. M-Estimation (Estimating Equations), pp. 297–337. Springer New York, New York, NY, 2013.
210
+
211
+ Qi-Zhi Cai, Chang Liu, and Dawn Song. Curriculum adversarial training. In IJCAI, 2018.
212
+
213
+ Nicholas Carlini and David A. Wagner. Towards evaluating the robustness of neural networks. In Symposium on Security and Privacy (SP), 2017.
214
+
215
+ Yair Carmon, Aditi Raghunathan, Ludwig Schmidt, Percy Liang, and John C. Duchi. Unlabeled data improves adversarial robustness. In NeurIPS, 2019.
216
+
217
+ Chen Chen, Jingfeng Zhang, Xilie Xu, Tianlei Hu, Gang Niu, Gang Chen, and Masashi Sugiyama. Guided interpolation for adversarial training. arXiv:2102.07327, 2021a.
218
+
219
+ Tianlong Chen, Sijia Liu, Shiyu Chang, Yu Cheng, Lisa Amini, and Zhangyang Wang. Adversarial robustness: From self-supervised pre-training to fine-tuning. In CVPR, 2020.
220
+
221
+ Tianlong Chen, Zhenyu Zhang, Sijia Liu, Shiyu Chang, and Zhangyang Wang. Robust overfitting may be mitigated by properly learned smoothening. In ICLR, 2021b.
222
+
223
+ Minhao Cheng, Qi Lei, Pin-Yu Chen, Inderjit Dhillon, and Cho-Jui Hsieh. Cat: Customized adversarial training for improved robustness. arXiv:2002.06789, 2020.
224
+
225
+ Jeremy M. Cohen, Elan Rosenfeld, and J. Zico Kolter. Certified adversarial robustness via randomized smoothing. In ICML, 2019.
226
+
227
+ Francesco Croce and Matthias Hein. Reliable evaluation of adversarial robustness with an ensemble of diverse parameter-free attacks. In ICML, 2020.
228
+
229
+ Gavin Weiguang Ding, Yash Sharma, Kry Yik Chau Lui, and Ruitong Huang. Mma training: Direct input space margin maximization through adversarial training. In ICLR, 2020.
230
+
231
+ Alhussein Fawzi, Seyed-Mohsen Moosavi-Dezfooli, and Pascal Frossard. The robustness of deep networks: A geometrical perspective. IEEE Signal Processing Magazine, 34(6):50–62, 2017.
232
+
233
+ Alhussein Fawzi, Seyed-Mohsen Moosavi-Dezfooli, Pascal Frossard, and Stefano Soatto. Empirical study of the topology and geometry of deep networks. In CVPR, 2018.
234
+
235
+ Yoav Freund and Robert E Schapire. A decision-theoretic generalization of on-line learning and an application to boosting. Journal of computer and system sciences, 55(1):119–139, 1997.
236
+
237
+ Sven Gowal, Chongli Qin, Jonathan Uesato, Timothy Mann, and Pushmeet Kohli. Uncovering the limits of adversarial training against norm-bounded adversarial examples. arXiv:2010.03593, 2020.
238
+
239
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016.
240
+
241
+ Marti A. Hearst, Susan T Dumais, Edgar Osuna, John Platt, and Bernhard Scholkopf. Support vector machines. IEEE Intelligent Systems and their applications, 13(4):18–28, 1998.
242
+
243
+ Dan Hendrycks, Kimin Lee, and Mantas Mazeika. Using pre-training can improve model robustness and uncertainty. In ICML, 2019.
244
+
245
+ Ziyu Jiang, Tianlong Chen, Ting Chen, and Zhangyang Wang. Robust pre-training by adversarial contrastive learning. In NeurIPS, 2020.
246
+
247
+ Can Kanbak, Seyed-Mohsen Moosavi-Dezfooli, and Pascal Frossard. Geometric robustness of deep networks: analysis and improvement. In CVPR, 2018.
248
+
249
+ Alex Krizhevsky. Learning multiple layers of features from tiny images. Technical report, 2009.
250
+
251
+ Tsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He, and Piotr Dollar. Focal loss for dense object ´ detection. In ICCV, 2017.
252
+
253
+ Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. In ICLR, 2018.
254
+
255
+ Takeru Miyato, Shin-ichi Maeda, Masanori Koyama, Ken Nakae, and Shin Ishii. Distributional smoothing by virtual adversarial examples. In ICLR, 2016.
256
+
257
+ Seyed-Mohsen Moosavi-Dezfooli, Alhussein Fawzi, Jonathan Uesato, and Pascal Frossard. Robustness via curvature regularization, and vice versa. In CVPR, 2019.
258
+
259
+ 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.
260
+
261
+ Anh Nguyen, Jason Yosinski, and Jeff Clune. Deep neural networks are easily fooled: High confidence predictions for unrecognizable images. In CVPR, 2015.
262
+
263
+ Nicolas Papernot, Patrick McDaniel, Arunesh Sinha, and Michael Wellman. Towards the science of security and privacy in machine learning. arXiv:1611.03814, 2016.
264
+
265
+ Chongli Qin, James Martens, Sven Gowal, Dilip Krishnan, Krishnamurthy Dvijotham, Alhussein Fawzi, Soham De, Robert Stanforth, and Pushmeet Kohli. Adversarial robustness through local linearization. In NeurIPS, 2019.
266
+
267
+ Aditi Raghunathan, Sang Michael Xie, Fanny Yang, John Duchi, and Percy Liang. Understanding and mitigating the tradeoff between robustness and accuracy. In ICML, 2020.
268
+
269
+ Leslie Rice, Eric Wong, and J Zico Kolter. Overfitting in adversarially robust deep learning. In ICML, 2020.
270
+
271
+ Hadi Salman, Andrew Ilyas, Logan Engstrom, Ashish Kapoor, and Aleksander Madry. Do adversarially robust imagenet models transfer better? In NeurIPS, 2020.
272
+
273
+ Vikash Sehwag, Shiqi Wang, Prateek Mittal, and Suman Jana. Hydra: Pruning adversarially robust neural networks. NeurIPS, 2020.
274
+
275
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In ICLR, 2015.
276
+
277
+ Chawin Sitawarin, Supriyo Chakraborty, and David Wagner. Improving adversarial robustness through progressive hardening. arXiv:2003.09347, 2020.
278
+
279
+ Nitish Srivastava, Geoffrey E. Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. J. Mach. Learn. Res., 15(1): 1929–1958, 2014.
280
+
281
+ Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. In ICLR, 2014.
282
+
283
+ Antonio Torralba, Rob Fergus, and William T Freeman. 80 million tiny images: A large data set for nonparametric object and scene recognition. IEEE transactions on pattern analysis and machine intelligence, 30(11):1958–1970, 2008.
284
+
285
+ Dimitris Tsipras, Shibani Santurkar, Logan Engstrom, Alexander Turner, and Aleksander Madry. Robustness may be at odds with accuracy. In ICLR, 2019.
286
+
287
+ Yusuke Tsuzuku, Issei Sato, and Masashi Sugiyama. Lipschitz-Margin training: Scalable certification of perturbation invariance for deep neural networks. In NeurIPS, 2018.
288
+
289
+ Haotao Wang, Tianlong Chen, Shupeng Gui, Ting-Kuei Hu, Ji Liu, and Zhangyang Wang. Oncefor-all adversarial training: In-situ tradeoff between robustness and accuracy for free. In NeurIPS 2020, 2020a.
290
+
291
+ Yisen Wang, Xingjun Ma, James Bailey, Jinfeng Yi, Bowen Zhou, and Quanquan Gu. On the convergence and robustness of adversarial training. In ICML, 2019.
292
+
293
+ Yisen Wang, Difan Zou, Jinfeng Yi, James Bailey, Xingjun Ma, and Quanquan Gu. Improving adversarial robustness requires revisiting misclassified examples. In ICLR, 2020b.
294
+
295
+ Eric Wong and J. Zico Kolter. Provable defenses against adversarial examples via the convex outer adversarial polytope. In ICML, 2018.
296
+
297
+ Dongxian Wu, Shu-Tao Xia, and Yisen Wang. Adversarial weight perturbation helps robust generalization. NeurIPS, 33, 2020.
298
+
299
+ Yao-Yuan Yang, Cyrus Rashtchian, Hongyang Zhang, Russ R. Salakhutdinov, and Kamalika Chaudhuri. A closer look at accuracy vs. robustness. In NeurIPS, 2020.
300
+
301
+ Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. arXiv:1605.07146, 2016.
302
+
303
+ Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. In ICLR, 2017.
304
+
305
+ Hongyang Zhang, Yaodong Yu, Jiantao Jiao, Eric P. Xing, Laurent El Ghaoui, and Michael I. Jordan. Theoretically principled trade-off between robustness and accuracy. In ICML, 2019.
306
+
307
+ Huan Zhang, Hongge Chen, Chaowei Xiao, Sven Gowal, Robert Stanforth, Bo Li, Duane Boning, and Cho-Jui Hsieh. Towards stable and efficient training of verifiably robust neural networks. In ICLR, 2020a.
308
+
309
+ Jingfeng Zhang, Xilie Xu, Bo Han, Gang Niu, Lizhen Cui, Masashi Sugiyama, and Mohan Kankanhalli. Attacks which do not kill training make adversarial learning stronger. In ICML, 2020b.
310
+
311
+ Jianing Zhu, Jingfeng Zhang, Bo Han, Tongliang Liu, Gang Niu, Hongxia Yang, Mohan Kankanhalli, and Masashi Sugiyama. Understanding the interaction of adversarial training with noisy labels. arXiv:2102.03482, 2021.
312
+
313
+ ![](images/10abe6c06b11558243d668a36527194623749422deddfd65a43a1993699ad0c4.jpg)
314
+ Figure 5: We plot standard training error (the left two panels) and adversarial training error (the right two panels) over the training epochs of the standard AT on CIFAR-10 dataset. Top two panels: standard AT on different sizes of network. Bottom two panels: standard AT on ResNet-18 under different perturbation bound $\epsilon _ { \mathrm { t r a i n } }$ .
315
+
316
+ # A MOTIVATIONS OF GAIRAT
317
+
318
+ We show that model capacity is often insufficient in adversarial training, especially when $\epsilon _ { \mathrm { t r a i n } }$ is large; therefore, the model capacity should be carefully preserved for fitting important data.
319
+
320
+ In this section, we give experimental details of Figure 2 and provide complementary experiments in Figures 5 and 6. In the left panel of Figure 2 and top two panels of Figure 5, we use standard AT to train different sizes of network under the perturbation bound $\epsilon _ { \mathrm { t r a i n } } ~ = ~ 8 / 2 5 5$ on CIFAR10 dataset. In the right panel of Figure 2 and two bottom panels of Figure 5, we fix the size of network and use ResNet-18; we conduct standard AT under different values of perturbation bound $\epsilon _ { \mathrm { t r a i n } } \in [ 1 / 2 5 5 , 1 6 / 2 5 5 ]$ . The solid lines show the standard training error on natural data and the dash lines show the robust training error on adversarial training data.
321
+
322
+ Training details We train all the different networks for 100 epochs using SGD with 0.9 momentum. The initial learning rate is 0.1, reduced to 0.01, 0.001 at Epoch 30, and 60, respectively. The weight decay is 0.0005. For generating the most adversarial data for updating the model, we use the PGD-10 attack. The PGD steps number $K = 1 0$ and the step size $\alpha = \epsilon / 4$ . There is a random start, i.e., uniformly random perturbations $( [ - \epsilon _ { \mathrm { t r a i n } } , + \epsilon _ { \mathrm { t r a i n } } ] )$ added to natural data before PGD perturbations for generating PGD-10 training data. We report the standard training error on the natural training data and the robust training error on the adversarial training data that are generated by the PGD-10 attack.
323
+
324
+ We also conduct the experiments on the SVHN dataset in Figure 6. The training setting keeps the same as that of CIFAR-10 experiments except using 0.01 as the initial learning rate, reduced to 0.001, 0.0001 at Epoch 30, and 60, respectively. We find standard AT always fails when the perturbation bound is larger than $\epsilon = 1 6 / 2 5 5$ for the SVHN dataset due to the severe cross-over mixture issue (Zhang et al., 2020b); therefore, we do not report its results.
325
+
326
+ ![](images/f3b9e76b0ba8c32a51b098c87f479526d23c06297ebf1483e251b723d9f2afbe.jpg)
327
+ Figure 6: We plot standard training error (the left two panels) and adversarial training error (the right two panels) over the training epochs of the standard AT on SVHN dataset. Top two panels: AT on different sizes of network. Bottom two panels: AT on ResNet-18 under different perturbation bound $\epsilon _ { \mathrm { t r a i n } }$ .
328
+
329
+ Next, we show that more attackable (more important) data are closer to the decision boundary; more guarded (less important) data are farther away from the decision boundary.
330
+
331
+ In Figures 7 and 8, we plot 2-d visualizations of the output distributions of a robust ResNet-18 on CIFAR-10 dataset. We take the robust ResNet-18 at the checkpoint of Epoch 30 (red line in Figure 9) as our base model here. For each class in the CIFAR-10 dataset, we randomly sample 1000 training datapoints for visualization. For each data point, we compute its the least number of iterations $\kappa$ that PGD requires to find its misclassified adversarial variant. For PGD, we set the perturbation bound $\epsilon = 0 . 0 3 1$ , the step size $\alpha = 0 . 3 1 / 4$ , and the maximum PGD steps $K = 1 0$ . Then, each data point has its unique robustness attribution, i.e., value $\kappa$ . We take those data as the input of the robust ResNet and output 10-dimensional logits, and then, we use principal components analysis (PCA) to project 10-dimensional logits into 2-dimension for visualization. The color gradient denotes the degree of the robustness of each data point. The more attackable data have lighter colors (red or blue), and the more guarded data has darker colors (red or blue).
332
+
333
+ From Figures 7 and 8, we find that the attackable data in general are geometrically close to the decision boundary while the guarded data in general are geometrically far away from the decision boundary. It is also very interesting to observe that not all classes are well separated. For example, Cat-Dog is less separable than Cat-Ship in second row of Figure 8.
334
+
335
+ ![](images/36fa10f3c54b30969f18d3d450cec1f80f5c8d6b7607bb466d0c93d3df1ec9d1.jpg)
336
+ Figure 7: Part A 2-d visualizations of the model’s output distribution of natural training data from two separated classes from CIFAR-10 dataset. The degree of the robustness (denoted by the color gradient) of a datum is calculated based on the least number of iterations $\kappa$ that PGD requires to find its misclassified adversarial variant. The light blue and light red points represent attackable data which are close to the class boundary; the dark blue and dark red points represent the guarded data which are far away from the decision boundary. (Top colorbars corresponds to the value $\kappa$ )
337
+
338
+ ![](images/7dc57567c4c687ff3118e640cecb2b322fa8d826115e58f48816487c47e33f2c.jpg)
339
+ Figure 8: Part B - 2-d visualizations of the model’s output distribution on CIFAR-10 dataset.
340
+
341
+ # B ALGORITHMS
342
+
343
+ B.1 GEOMETRY-AWARE INSTANCE-REWEIGHTED FRIENDLY ADVERSARIAL TRAINING(GAIR-FAT)
344
+
345
+ Algorithm 3 Geometry-aware early stopped PGD- $K \tau$
346
+
347
+ Input: data $x \in \mathcal { X }$ , label $y \in \mathcal { V }$ , model $f$ , loss function $\ell$ , maximum PGD step $K$ , step $\tau$ ,
348
+ perturbation bound $\epsilon$ , step size $\alpha$
349
+ Output: friendly adversarial data $\tilde { x }$ and geometry value $\kappa ( x , y )$
350
+ $\tilde { x } \gets x$ ; $\kappa ( x , y ) \dot { } 0$
351
+ while $K > 0$ do if arg maxi $f ( \tilde { x } ) \neq y$ and $\tau = 0$ then break else if arg maxi $f ( \tilde { x } ) \neq y$ then $\tau \tau - 1$ else $\kappa ( x , y ) \gets \kappa ( x , y ) + 1$ end if $\begin{array} { r l } & { \tilde { x } \gets \Pi _ { \mathcal { B } [ x , \epsilon ] } \big ( \alpha \mathrm { s i g n } ( \nabla _ { \tilde { x } } \ell ( f ( \tilde { x } ) , y ) ) + \tilde { x } \big ) } \\ & { K \gets K - 1 } \end{array}$
352
+ end while
353
+
354
+ GAIRAT is a general method, and the friendly adversarial training (Zhang et al., 2020b) can be easily modified to a geometry-aware instance-reweighted version, i.e. GAIR-FAT.
355
+
356
+ GAIR-FAT utilizes Algorithm 3 to generate friendly adversarial data $( \tilde { x } , y )$ and the corresponding geometry value $\kappa ( x , y )$ , and then utilizes Algorithm 2 to update the model parameters.
357
+
358
+ # B.2 GEOMETRY-AWARE INSTANCE-REWEIGHTED TRADES (GAIR-TRADES)
359
+
360
+ # Algorithm 4 Geometry-aware PGD for TRADES
361
+
362
+ Input: data $x \in \mathcal { X }$ , label $y \in \mathcal { V }$ , model $f$ , loss function $\ell _ { K L }$ , maximum PGD step $K$ , perturbation
363
+ bound $\epsilon$ , step size $\alpha$
364
+ Output: adversarial data $\tilde { x }$ and geometry value $\kappa ( x , y )$
365
+ $\tilde { x } \gets \bar { x } + \xi \mathcal { N } ( \mathbf { 0 } , \mathbf { I } )$ ; $\kappa ( x , y ) \gets \bar { 0 }$
366
+ while $K > 0$ do if arg maxi $f ( \tilde { x } ) = y$ then $\kappa ( x , y ) \gets \kappa ( x , y ) + 1$ end if $\begin{array} { r l } & { \tilde { x } \Pi _ { B [ x , \epsilon ] } \big ( \alpha \mathrm { s i g n } ( \nabla _ { \tilde { x } } \ell _ { K L } ( f ( \tilde { x } ) , f ( x ) ) + \tilde { x } \big ) } \\ & { K K - 1 } \end{array}$
367
+ end while
368
+
369
+ # Algorithm 5 Geometry-aware instance-reweighted TRADES (GAIR-TRADES)
370
+
371
+ Input: network $f _ { \theta }$ , training dataset $S = \{ ( x _ { i } , y _ { i } ) \} _ { i = 1 } ^ { n }$ , learning rate $\eta$ , number of epochs $T$ batch size $m$ , number of batches $M$
372
+
373
+ Output: adversarially robust network $f _ { \theta }$
374
+ for epoch $= 1$ , . . . , $T$ do for mini-batch $\mathbf { \Psi } = 1 , \dots , M$ do Sample a mini-batch $\{ ( x _ { i } , y _ { i } ) \} _ { i = 1 } ^ { m }$ from $S$ for $i = 1 , \ldots , m$ (in parallel) do Obtain adversarial data $\tilde { x _ { i } }$ of $x _ { i }$ and geometry value $\kappa ( x _ { i } , y _ { i } )$ by Algorithm 4 Calculate $\omega ( x _ { i } , y _ { i } )$ according to geometry value $\kappa ( x _ { i } , y _ { i } )$ by Eq. (6) end for Calculate the normalized ωi = $\begin{array} { r } { \omega _ { i } = \frac { \omega \left( x _ { i } , y _ { i } \right) } { \sum _ { j = 1 } ^ { m } \omega \left( x _ { j } , y _ { j } \right) } } \end{array}$ for each data $\begin{array} { r } { \theta \theta - \eta \nabla _ { \theta } \sum _ { i = 1 } ^ { m } \{ \omega _ { i } \ell _ { C E } \big ( f _ { \theta } ( x _ { i } ) , y _ { i } \big ) + \beta \ell _ { K L } \big ( f _ { \theta } ( \tilde { x } _ { i } ) , f _ { \theta } ( x _ { i } ) \big ) \} } \end{array}$ end for
375
+ end for
376
+
377
+ We modify TRADES (Zhang et al., 2019) to a GAIRAT version, i.e. GAIR-TRADES (Algorithms 4 and 5). Different from GAIRAT and GAIR-FAT, GAIR-TRADES employs Algorithm 4 to generate adversarial data $( \tilde { x } , y )$ and the corresponding geometry value $\kappa ( x , y )$ , and then utilizes both natural data and their adversarial variants to update the model parameters (Algorithm 5). Note that TRADES utilizes virtual adversarial data (Miyato et al., 2016) for updating the current model. The generated virtual adversarial data do not require any label information; therefore, their supervision signals heavily rely on their natural counterparts. Thus, in GAIR-TRADES, the instance-reweighting function $\omega$ applies to the loss of their natural data.
378
+
379
+ In Algorithm 4, $\mathcal { N } ( \mathbf { 0 } , \mathbf { I } )$ generates a random unit vector. $\xi$ is a small constant. $\ell _ { K L }$ is KullbackLeibler loss. In Algorithm 5, $\beta > 0$ is a regularization parameter for TRADES. $\ell _ { C E }$ is cross-entropy loss. $\ell _ { K L }$ is Kullback-Leibler loss, which keeps the same as Zhang et al. (2019).
380
+
381
+ ![](images/863905d8514e1524e710e78b80a9c9d9af2b4931d7a3da12d7c7f67cf260bea4.jpg)
382
+ Figure 9: Illustration of the reasons for the issue of robust overfitting.
383
+
384
+ # C EXTENSIVE EXPERIMENTS
385
+
386
+ # C.1 GAIRAT RELIEVES ROBUST OVERFITTING
387
+
388
+ In this section, we give the detailed descriptions of Figure 4 and provide more analysis and complementary experiments using the SVHN dataset in Figure 10.
389
+
390
+ In Figure 4, red lines (solid and dashed lines) refer to standard adversarial training (AT) (Madry et al., 2018). Blue and yellow lines (solid and dashed) refer to our geometry-aware instance-reweighted adversarial training (GAIRAT). Blue lines represent that GAIRAT utilizes the decreasing $\omega$ for assigning instance-dependent weights (corresponding to the blue line in the bottom-left panel); yellow lines represent that GAIRAT utilizes the non-increasing piece-wise $\omega$ for assigning instancedependent weights (corresponding to the yellow line in the bottom-left panel). In the upper-left panel of Figure 4, we calculate the mean and median of geometry values $\kappa ( x , y )$ of all 50K training data at each epoch. Geometry value $\kappa ( x , y )$ of data $( x , y )$ refers to the least number of PGD steps that PGD methods need to generate a misclassified adversarial variant. Note that when the natural data is misclassified without any adversarial perturbations, the geometry value $\kappa ( x , y ) = 0$ . The bottom-left panel calculates the instance-dependent weight $\omega$ for the loss of adversarial data based on the geometry value $\kappa$ .
391
+
392
+ In the upper-middle panel of Figure 4, the solid lines represent the standard training error on the natural training data; the dashed lines represent the standard test error on the natural test data.
393
+
394
+ In the upper-right panel of Figure 4, the solid lines represent the robust training error on the adversarial training data; the dashed lines represent the robust test error on the adversarial test data. The adversarial training/test data are generated by PGD-20 attack with random start. Random start refers to the uniformly random perturbation of $[ - \epsilon , \epsilon ]$ added to the natural data before PGD perturbations. The step size $\dot { \alpha } = 2 / 2 5 5$ , which is the same as Wang et al. (2019).
395
+
396
+ In the bottom-middle and bottom-right panels of Figure 4, we calculate the flatness of the adversarial loss $\ell ( f _ { \theta } ( \tilde { x } ) , \tilde { x } ) )$ w.r.t. the adversarial data $\tilde { x }$ . In the bottom-middle panel, adversarial data refer to the friendly adversarial test data that are generated by early-stopped PGD-20-0 (Zhang et al., 2020b). The maximum PGD step number is 20; $\tau = 0$ means the immediate stop once the wrongly predicted adversarial test data are found. We use friendly adversarial test data to approximate the points on decision boundary of the robust model $f _ { \theta }$ . The flatness of the decision boundary is approximated by average of $| | \nabla _ { \widetilde { \widetilde { x } } } \ell | |$ across all 10K adversarial test data. We give the flatness value at each training epoch (higher flatness value refers to higher curved decision boundary, see Figure 9).
397
+
398
+ ![](images/7cc825930a80fdf2c0971ed7b36edb66a4a03262811e48d48d03665d46d39cb5.jpg)
399
+ Figure 10: Comparisons of AT ( $\omega _ { 1 }$ , red lines) and GAIRAT ${ \bf \Pi } _ { \omega _ { 2 } }$ , blue lines and $\omega _ { 3 }$ , yellow lines) using ResNet-18 on SVHN dataset. Upper-left panel shows different instance-dependent weight assignment functions $\omega$ w.r.t. the geometry value $\kappa$ . Bottom-left panel reports the standard AT training statistic and calculates the median (dark red circle) and mean (light red cross) of geometry values of all training data at each epoch. Upper-middle and upper-right panels report natural training/test errors and robust training/test errors, respectively. Bottom-middle and bottom-right panels report the loss flatness w.r.t. friendly adversarial test data and most adversarial test data, respectively.
400
+
401
+ For completeness, the bottom-right panel uses the most adversarial test data that are generated by PGD-20 (Madry et al., 2018).
402
+
403
+ The magnitude of the norm of gradients, i.e., $| | \nabla _ { \tilde { x } } \ell | |$ , is a reasonable metric for measuring the magnitude of curvatures of the decision boundary. Moosavi-Dezfooli et al. (2019) show the magnitude of the norm of gradients upper bound the largest eigenvalues of the hessian matrix of loss w.r.t. input $x$ , thus measuring the curvature of the decision boundary. Besides, Moosavi-Dezfooli et al. (2019) even show that the low curvatures can lead to the enhanced robustness, which echoes our results in Figure 4.
404
+
405
+ The flatness values (red lines) increases abruptly at smaller learning rates (0.01, 0.001) at Epoch 30 and Epoch 60. It shows that when we begin to use adversarial data to fine-tune the decision boundary of the robust model, the decision boundary becomes more tortuous around the adversarial data (see Figure 9). This leads to the severe overfitting issue.
406
+
407
+ Similar to Figure 4, we compare GAIRAT and AT using the SVHN dataset, which can be found in Figure 10. Experiments on the SVHN dataset corroborate the reasons for issue of the robust overfitting and justify the efficacy of our GAIRAT. The training and evaluation settings keep the same as Figure 4 except the initial rate of 0.01 divided by 10 at Epoch 30 and 60 respectively.
408
+
409
+ # C.2 DIFFERENT LEARNING RATE SCHEDULES
410
+
411
+ In Figure 11, we compare our GAIRAT and AT using different learning rate schedules. Under the different learning rate schedules, our GAIRAT can relieve the undesirable issue of the robust overfitting, thus enhancing the adversarial robustness. To make the fair comparisons with Rice et al. (2020), we use the pre-activation ResNet-18 (He et al., 2016). We conduct standard adversarial training (AT) using SGD with 0.9 momentum for 200 epochs on CIFAR-10 dataset. The different learning rate schedules are in the top panel in Figure 11. The perturbation bound $\epsilon = 8 / 2 5 5$ , the
412
+
413
+ ![](images/3d299bb68987582d7229301758e347dcaf08d4b570cccd1eccf642b0d6945a40.jpg)
414
+ Figure 11: The training results of standard AT and GAIRAT using pre-activation ResNet-18 under different learning rate schedules on CIFAR-10 dataset. The top panel reports the different learning rate schedules. The four middle panels report the robust test error on adversarial data generated by PGD-20. The four bottom panels report the standard test error on natural data. The red lines represent AT’s results under different learning rate schedules. The brown, green, blue and orange lines represent GAIRAT’s results of different learning rate schedules.
415
+
416
+ PGD steps number $K = 1 0$ and the step size $\alpha = 2 / 2 5 5$ . The training setting keeps the same as Rice et al. $( 2 0 2 0 ) ^ { 1 }$ .
417
+
418
+ GAIRAT has the same training configurations (including all hyperparamter settings) including the 100 epochs burn-in period, after which, GAIRAT begins to introduce geometry-aware instancereweighted loss. We use the weight assignment function $\omega$ from Eq. (6) with $\lambda = - 1$ .
419
+
420
+ At each training epoch, we evaluate each checkpoint using CIFAR-10 test data. In the middle panels of Figure 11, we report robust test error on the adversarial test data. The adversarial test data are generated by PGD-20 attack with the perturbation bound $\epsilon = 8 / 2 5 5$ and step size $\alpha = 2 / 2 5 5$ . The PGD attack has a random start, i.e, the uniformly random perturbations of $[ - \epsilon , \epsilon ]$ are added to the natural data before PGD iterations, which keeps the same as Wang et al. (2019); Zhang et al. (2020b). Note that different from Rice et al. (2020) using PGD-10, we use PGD-20 because under the computational budget, PGD-20 is a more informative metric for the robustness evaluation. In the bottom panels of Figure 11, we report the standard test error on the natural data.
421
+
422
+ Figure 11 shows that under different learning rate schedules, our GAIRAT can relieve the issue of robust overfitting, thus enhancing the adversarial robustness with little degradation of accuracy.
423
+
424
+ # C.3 DIFFERENT WEIGHT ASSIGNMENT FUNCTIONS $\omega$
425
+
426
+ The weight assignment functions $\omega$ should be non-increasing w.r.t. the geometry value $\kappa$ . In Figure 12, besides tanh-type Eq. (6) (blue line), we compare different types of weight assignment functions. The purple lines represent a linearly decreasing function, i.e.,
427
+
428
+ $$
429
+ w ( x , y ) = 1 - \frac { \kappa ( x , y ) } { K + 1 } .
430
+ $$
431
+
432
+ ![](images/50f83f401b492792de3e867601fa5eabbd659f5873789c4ea0377ac5c3cdd668.jpg)
433
+ Figure 12: Comparisons of GAIRAT with different weight assignment functions on CIFAR-10 dataset. When GAIRAT takes constant $\omega = 1$ over the training epochs, GAIRAT recovers the standard adversarial training (AT) (red lines).
434
+
435
+ The green lines represent a sigmoid-type decreasing function, i.e.,
436
+
437
+ $$
438
+ w ( x , y ) = \sigma ( \lambda + 5 \times ( 1 - 2 \times \kappa ( x , y ) / K ) ) ,
439
+ $$
440
+
441
+ where $\begin{array} { r } { \sigma ( x ) = \frac { 1 } { 1 + e ^ { - x } } } \end{array}$ .
442
+
443
+ Figure 12 shows that compared with AT, GAIRAT with different weight assignment functions have similar degradation of standard test accuracy on natural data, but GAIRAT with the tanh-type decreasing function (Eq. (6)) has the better robustness accuracy. Thus, we further explore the Eq. (6) with different $\lambda$ in Figure 13.
444
+
445
+ ![](images/07485c7f6ec6d8c660352febc3cc4fc7fadd3d400272b777973fe400bea0380b.jpg)
446
+ Figure 13: Comparisons of GARAT using the tanh-type weight assignment function (Eq. (6)) with different $\lambda$ on CIFAR-10 dataset.
447
+
448
+ In Figure 13, when $\lambda = + \infty$ , GAIRAT recovers the standard AT, assigning equal weights to the losses of the adversarial data. Smaller $\lambda$ corresponds to the weight assignment function $\omega$ , assigning relatively smaller weight to the loss of the adversarial data of the guarded data and assigning relatively larger weight to the loss of the adversarial data of the attackable data, which enhance the robustness more. With the same logic, larger $\lambda$ corresponds to the weight assignment function $\omega$ , assigning relatively larger weight to the loss of the adversarial data of the guarded data and assigning relatively smaller weight to the loss of the adversarial data of the attackable data, which enhances the robustness less. The guarded data need more PGD steps $\kappa$ to fool the current model; the attackable data need less PGD steps $\kappa$ to fool the current model.
449
+
450
+ The results in Figure 13 justify the above logic. GAIRAT with smaller $\lambda$ (lighter blue lines) has better adversarial robustness with bigger degradation of standard test accuracy. On the other hand GAIRAT with larger $\lambda$ (darker blue lines) has relatively worse adversarial robustness with minor degradation of standard test accuracy. Nevertheless, our GAIRAT (light and dark lines) has better robustness than AT (red lines).
451
+
452
+ Training and evaluation details We training ResNet-18 using SGD with 0.9 momentum for 100 epochs. The initial learning rate is 0.1 divided by 10 at Epoch 30 and 60 respectively. The weight decay $= 0 . 0 0 0 5$ . The perturbation bound $\epsilon = 0 . 0 3 1$ ; the PGD step size $\alpha = 0 . 0 0 7$ , and PGD step numbers $K = 1 0$ . For evaluations, we obtain standard test accuracy for natural test data and robust test accuracy for adversarial test data. The adversarial test data are generated by PGD-20 attack with the same perturbation bound $\epsilon = 0 . 0 3 1$ and the step size $\alpha = 0 . 0 3 1 / 4$ , which keeps the same as Wang et al. (2019). All PGD generation have a random start, i.e, the uniformly random perturbation of $[ - \epsilon , \epsilon ]$ added to the natural data before PGD iterations.
453
+
454
+ Note that the robustness reflected by PGD-20 test data is quite high. However, when we use other attacks such as $\mathbf { C } \& \mathbf { W }$ attack (Carlini & Wagner, 2017) for evaluation, both blue and red lines will degrade the robustness to around $4 0 \%$ . We believe this degradation is due to the mismatch between PGD-adversarial training and C&W attacks, which is the common deflect of the empirical defense (Tsuzuku et al., 2018; Wong & Kolter, 2018; Cohen et al., 2019; Balunovic & Vechev, 2020; Zhang et al., 2020a). We leave this for future work.
455
+
456
+ ![](images/cf2c104bcf57f1fccd8a386d650266c305a9bc48fbd39595c8fe60abbe608511.jpg)
457
+ Figure 14: Comparisons of GARAT using the tanh-type weight assignment function (Eq. (6)) with different $\lambda$ on SVHN dataset.
458
+
459
+ In Figure 14, we also conduct experiments of GAIRAT using Eq. (6) with different $\lambda$ and AT using ResNet-18 on SVHN dataset. The training and evaluation settings keep the same as Figure 13 except the initial rate of 0.01 divided by 10 at Epoch 30 and 60 respectively.
460
+
461
+ Interestingly, AT (red lines) on SVHN dataset has not only the issue of robust overfitting, but also the issue of natural overfitting: The standard test accuracy has slight degradation over the training epochs. By contrast, our GAIRAT (blue lines) can relieve the undesirable robust overfitting, thus enhancing both robustness and accuracy.
462
+
463
+ # C.4 DIFFERENT LENGTHS OF BURN-IN PERIOD
464
+
465
+ ![](images/b33f95bf3331631adfb22291b4acf1ab3b6b076f0b08378af960908fedbc3f2e.jpg)
466
+ Figure 15: Comparisons of GAIRAT (blue lines) with different lengths of the burn-in period on CIFAR-10 dataset. The longer GAIRAT has the burn-in period, the more alike GAIRAT becomes standard AT (red lines). AT can be seen as GAIRAT with 100 epochs burn-in period. Darker blue lines represent shorter lengths of burn-in period; lighter blue lines represent longer lengths of burn-in period.
467
+
468
+ In Figure 15, we conduct experiments of GAIRAT under different lengths of the burn-in period using ResNet-18 on CIFAR-10 dataset. The training and evaluations details are the same as Appendix C.3 except the different lengths of burn-in period in the training.
469
+
470
+ Figure 15 shows that compared with AT (red lines), GAIRAT with a shorter length of burn-in period (darker blue lines) can significantly enhance robustness but suffers a little degradation of accuracy. On the other hand, GAIRAT with a longer length of burn-in period (lighter blue lines) slightly enhance robustness with zero degradation of accuracy.
471
+
472
+ ![](images/0414f0d2c7a9c3e6c7978e6b01eee374ac9097c13a34afeebe1156dd29ea2ee6.jpg)
473
+ Figure 16: Comparisons of different networks (VGG-13, Small CNN and ResNet-18) which GAIRAT and AT use on CIFAR-10 dataset.
474
+
475
+ In Figure 16, besides ResNet-18, we apply our GAIRAT to Small CNN (6 convolutional layers and 2 fully-connected layers) on CIFAR-10 dataset. Training and evaluation settings keeps the same as the Appendix C.3; we use 30 epochs burn-in period and Eq. (6) as the weight assignment function.
476
+
477
+ Figure 16 shows that larger network ResNet-18 has better performance than Small CNN in terms of both robustness and accuracy. Interestingly, Small CNN has less severe issue of the robust overfitting. Nevertheless, our GAIRAT are still quite effective in relieving the robust overfitting and thus enhancing robustness in the smaller network.
478
+
479
+ In Figure 16, we also compare our GAIRAT with AT using VGG-13 (Simonyan & Zisserman, 2015) on CIFAR-10 dataset. Under the same training and evaluation settings as Small CNN, results of VGG-13 once again demonstrate the efficacy of our GAIRAT.
480
+
481
+ # C.6 GEOMETRY-AWARE INSTANCE DEPENDENT FAT (GAIR-FAT)
482
+
483
+ In this section, we show that GAIR-FAT can enhance friendly adversarial training (FAT). Our geometry-aware instance-reweighted method is a general method. Besides AT, we can easily modify friendly adversarial training (FAT) (Zhang et al., 2020b) to GAIR-FAT (See Algorithm 3 in the Appendix B.1).
484
+
485
+ In Figure 17, we compare FAT and GAIR-FAT using ResNet-18 on CIFAR-10 dataset. The training and evaluation settings keeps the same as Appendix C.3 except that GAIR-FAT and FAT has an extra hyperparameter $\tau$ . In Figures 17, the $\tau$ begins from 0 and increases by 3 at Epoch 40 and 70 respectively. The burn-in period is 70 epochs. In Figure 17, we use Eq. (6) with different $\lambda$ as GAIR-FAT’s weight assignment function.
486
+
487
+ Different from AT, FAT has slower progress in enhancing the adversarial robustness over the training epochs, so FAT can naturally resist undesirable robust overfitting. However, once the robust test accuracy reaches plateau, FAT still suffers a slight robust overfitting issue (red line in the right panel). By contrast, when we introduce our instance dependent loss from Epoch 70, GAIR-FAT (light and dark blue lines) can get further enhanced robustness with near-zero degradation of accuracy.
488
+
489
+ ![](images/515d2d8738d643d6f27a683cdb7d1d8089b5b582632a624409bfa3b43208ed58.jpg)
490
+ Figure 17: We compare FAT and GAIR-FAT using ResNet-18 on CIFAR-10 dataset using tanh-type weight assignment function with different $\lambda$ .
491
+
492
+ ![](images/66deb3e9496e551aa4748871ffb79f7df24971264e204611dd05d6d6bb55bb9d.jpg)
493
+ Figure 18: Comparisons of GAIR-FAT and FAT under different schedules of dynamical $\tau$ using ResNet-18 on CIFAR-10 dataset. $( \tau { : } 0 \ – 1 \ – 2 )$ refers to $\tau$ starting from 0 and increasing by 1 at Epoch 40 and 70, respectively. $( \tau ; ~ 0 { - } 2 – 4 )$ refers to $\tau$ starting from 0 and increasing by 2 at Epoch 40 and 70, respectively. $\tau$ : 0-3-6) refers to $\tau$ starting from 0 and increasing by 3 at Epoch 40 and 70, respectively.
494
+
495
+ Note that different from the FAT used by Zhang et al. (2020b) increasing $\tau$ from 0 to 2 over the training epochs, we increase the $\tau$ from 0 to 6. As shown in Figure 18, we find out FAT with smaller $\tau$ (e.g., 1-3) does not suffer the issue of the robust overfitting, since the FAT with smaller $\tau$ has the slower progress in increasing the robustness over the training epochs. This slow progress leads to the slow increase of the portion of guarded data, which is less likely to overwhelm the learning from the attackable data. Thus, our geometry-aware instance dependent loss applied on FAT with smaller $\tau$ does not offer extra benefits, and it does not have damage as well.
496
+
497
+ ![](images/4a37f3ce12a98d513c81b3bba21ae3b26521a1334dd73e70c351b9ab7dc00dd5.jpg)
498
+ Figure 19: We compare MMA, MART and GAIR-MART with different weight assginment functions using ResNet-18 on CIFAR-10.
499
+
500
+ In this section, we compare our method with MMA (Ding et al., 2020) and MART (Wang et al., 2020b). To be specific, we easily modify MART to a GAIRAT version, i.e., GAIR-MART. The learning objective of MART is Eq. (9); the learning objective of our GAIR-MART is Eq. (10).
501
+
502
+ The learning objective of MART is
503
+
504
+ $$
505
+ \ell _ { m a r g i n } ( p ( \tilde { x } , \theta ) , y ) + \beta \ell _ { K L } ( p ( \tilde { x } , \theta ) , p ( x , \theta ) ) \cdot ( 1 - p _ { y } ( x , \theta ) ) ;
506
+ $$
507
+
508
+ our learning objective of of GAIR-MART is
509
+
510
+ $$
511
+ \ell _ { G A I R _ { m a r g i n } } ( p ( \tilde { x } , \theta ) , y ) + \beta \ell _ { K L } ( p ( \tilde { x } , \theta ) , p ( x , \theta ) ) \cdot ( 1 - p _ { y } ( x , \theta ) ) ,
512
+ $$
513
+
514
+ where $\ell _ { m a r g i n } = - \log ( p _ { y } ( \tilde { x } , \theta ) ) - \log ( 1 - \operatorname* { m a x } _ { k \neq y } p _ { k } ( \tilde { x } , \theta ) )$ and $p _ { k } ( x , \theta )$ is probability (softmax on logits) of $x$ belonging to class $k$ . To be specific, the first term $- \log ( p _ { y } ( \tilde { x } , \theta ) )$ is commonly used CE loss and the second term $- \log ( 1 - \operatorname* { m a x } _ { k \neq y } p _ { k } ( \tilde { x } , \theta ) )$ is a margin term used to improve the decision margin of the classifier. More detailed analysis about the learning objective can be found in (Wang et al., 2020b). In Eq. (9) and Eq. (10), $x$ is natural training data, $\tilde { x }$ is adversarial training data generated by CE loss, and $\beta > 0$ is a regularization parameter for MART. In Eq. (10), $\ell _ { G A I R _ { m a r g i n } } = - \log ( p _ { y } ( \tilde { x } , \theta ) ) \cdot \omega - \log ( 1 - \operatorname* { m a x } _ { k \neq y } p _ { k } ( \tilde { x } , \theta ) )$ and $\omega$ refers to our weight assignment function.
515
+
516
+ For MMA and MART, the training settings keep the same as the 2 and 3. For fair comparisons, GAIR-MART keeps the same training configurations as MART except that we use the weight assignment function $\omega$ (Eq.(6)) to introduce geometry-aware instance-reweighted loss from Epoch 75 onward. We train ResNet-18 on CIFAR-10 dataset for 120 epochs. For MMA, the learning rate is 0.3 from Iteration 0 to 20000, 0.09 from Iteration 20000 to 30000, 0.03 from Iteration 30000 to 40000, and 0.009 after Iteration 40000, where the Iteration refers to training with one mini-batch of data; For MART and GAIR-MART, the learning rate is 0.01 divided by 10 at Epoch 75, 90, and 100 respectively. For evaluations, we obtain standard test accuracy for natural test data and robust test accuracy for PGD-20 adversarial test data with the same settings as Appendix C.3.
517
+
518
+ Figure 19 shows GAIR-MART performs better than MART and MMA. The results demonstrate the efficacy of our GAIRAT method on improving robustness without the degradation of standard accuracy.
519
+
520
+ Reweighing KL loss The learning objective of MART explicitly assigns weights, not directly on the adversarial loss but KL divergence loss. We ask what if you replace their reweighting scheme $( 1 - p _ { y } ( x , \theta ) )$ with our $\omega$ . The learning objective is
521
+
522
+ $$
523
+ \ell _ { m a r g i n } ( p ( \tilde { x } , \theta ) , y ) + \beta \ell _ { K L } ( p ( \tilde { x } , \theta ) , p ( x , \theta ) ) \cdot \omega .
524
+ $$
525
+
526
+ Figure 20 reports the results: It does not have much effect on adding the geometry-aware instancedependent weight to the regularization part, i.e., KL divergence loss .
527
+
528
+ ![](images/4f5fe36f676be850362c6401458eebd535af9307643ca69a76294a04978a9736.jpg)
529
+ Figure 20: Comparison of MART and GAIR-MART training ResNet-18 with Eq. (11) on CIFAR-10 dataset.
530
+
531
+ # C.8 PERFORMANCE EVALUATION ON WIDE RESNET (WRN-32-10)
532
+
533
+ In Table 1, we compare our GAIRAT, GAIR-FAT with standard AT and FAT. CIFAR-10 dataset is normalized into [0,1]: Each pixel is scaled by 1/255. We perform the standard CIFAR-10 data augmentation: a random 4 pixel crop followed by a random horizontal flip. In AT, we train WRN32-10 for 120 epochs using SGD with 0.9 momentum. The initial learning rate is 0.1 reduced to 0.01, 0.001 and 0.0005 at epoch 60, 90 and 110. The weight decay is 0.0002. For generating the adversarial data for updating the model, the perturbation bound $\epsilon _ { \mathrm { t r a i n } } = 0 . 0 3 1$ , the PGD step is fixed to 10, and the step size is fixed to 0.007. The training settings come from FAT’s Github. 4 In GAIRAT, we choose 60 epochs burn-in period and then use Eq. (6) with $\lambda = 0$ as the weight assignment function; the rest keeps the same as AT. The hyperparameter $\tau$ of FAT and begins from 0 and increases by 3 at Epoch 40 and 70 respectively; the rest keeps the same as AT. In GAIR-FAT, we choose 60 epochs burn-in period and then use Eq. (6) with $\lambda = 0$ as the weight assignment function; the rest keeps the same as FAT.
534
+
535
+ As suggested by results of the experiments in Section 4.1, the robust test accuracy usually gets significantly boosted when the learning rate is firstly reduced to 0.01. Thus, we save the model checkpoints at Epochs 59-100 for evaluations, among which, the best checkpoint is selected based on the PGD-20 attack since $\mathrm { P G D + }$ is extremely computationally expensive. We also save the last checkpoint at Epoch 120 for evaluations. We run AT, FAT, GAIRAT and GAIR-FAT with 5 repeated times with different random seeds.
536
+
537
+ As for the evaluations, we test the checkpoint using three metrics: standard test accuracy on natural data (Natural), robust test accuracy on adversarial data generated by PGD-20 and $\mathrm { P G D + }$ . PGD20 follows the same setting of the PGD-20 used by Wang et al. $( 2 0 1 9 ) ^ { 5 }$ . $\mathrm { P G D + }$ is the same as $P G _ { o u r s }$ used by Carmon et al. $( 2 0 1 9 ) ^ { 6 }$ . The adversarial attacks have the same perturbation bound $\epsilon _ { t e s t } = 0 . 0 3 1$ . For PGD-20, the step number is 20, and the step size $\alpha = \bar { \epsilon } _ { t e s t } / 4$ . There is a random start, i.e., uniformly random perturbations $( [ - \epsilon _ { t e s t } , + \epsilon _ { t e s t } ] )$ added to natural data before PGD perturbations. For $\mathrm { P G D + }$ , the step number is 40, and the step size $\alpha = 0 . 0 1$ . There are 5 random starts for each natural test data. Therefore, for each natural test data, we have $4 0 \times 5 = 2 0 0$ PGD iterations for the robustness evaluation.
538
+
539
+ In Table 1, the best checkpoint is chosen among the model checkpoints at Epochs 59-100 (selected based on the robust accuracy on PGD-20 test data). In practice, we can use a hold-out validation set to determine the best checkpoint, since (Rice et al., 2020) found the validation curve over epochs matches the test curves over epochs. The last checkpoint is the model checkpoint at Epoch 120. Our experiments find that GAIRAT reaches the best robustness at Epoch 90 (three trails) and 92 (two trails), and AT reaches the best robustness at Epoch 60 (five trails). FAT reaches the best robustness at Epoch 60 (four trails) and 61 (one trail). GAIR-FAT reaches the best robustness at around Epoch 90 (five trails). We report the median test accuracy and its standard deviation over 5 repeated trails.
540
+
541
+ PGD attacks with different iterations In Table 1, each defense method has five trails with five different random seeds; therefore, each defense method has ten models (five last checkpoints and five best checkpoints). In Figure 21, for each defense, we randomly choose one last-checkpoint and one best-checkpoint and evaluate them using PGD-10, PGD-20, PGD-40, PGD-60, PGD-80, and PGD-100. All the PGD attacks use the same $\epsilon _ { t e s t } = 0 . 0 3 1$ and the step size $\alpha = ( 2 . 5 \cdot \epsilon _ { t e s t } ) / 1 0 0$ . We ensure that we can reach the boundary of the $\epsilon$ -ball from any starting point within it and still allow for movement on the boundary, which is suggested by Madry et al. (2018). The results show the PGD attacks have converged with more iterations.
542
+
543
+ ![](images/8b207fdf6b87a8ac20d2b80fe08db94dbcef722a72c5e4ae4de4d96644bc15b5.jpg)
544
+ Figure 21: Comparison of PGD attacks with different PGD iterations on CIFAR-10 dataset.
545
+
546
+ # C.9 PERFORMANCE EVALUATION ON WIDE RESNET (GAIR-TRADES)
547
+
548
+ Table 2: Test accuracy of TRADES and GAIR-TRADES (WRN-34-10) on CIFAR-10 dataset
549
+
550
+ <table><tr><td rowspan="2">Defense</td><td colspan="3">Best checkpoint</td><td colspan="3">Last checkpoint</td></tr><tr><td>Natural</td><td>PGD-20</td><td>PGD+</td><td>Natural</td><td>PGD-20</td><td>PGD+</td></tr><tr><td>TRADES (β= 6)</td><td>84.88±0.35</td><td>56.43± 0.24</td><td>54.33±0.38</td><td>85.66±0.33</td><td>53.31± 0.25</td><td>50.11± 0.25</td></tr><tr><td>GAIR-TRADES (β = 6)</td><td>86.99 ± 0.31</td><td>63.32 ± 0.50</td><td>56.77 ± 0.87</td><td>86.86 ± 0.26</td><td>60.65 ± 1.00</td><td>52.70± 0.93</td></tr></table>
551
+
552
+ In Table 2, we compare our GAIR-TRADES with TRADES. CIFAR-10 dataset normalization and augmentations keep the same as Appendix C.8. Instead, we use WRN-34-10, which keeps the same as Zhang et al. (2020b). We train WRN-34-10 for 100 epochs using SGD with 0.9 momentum. The initial learning rate is 0.1 reduced to 0.01 and 0.01 at epoch 75 and 90. The weight decay is 0.0002. For generating the adversarial data for updating the model, the perturbation bound $\epsilon _ { \mathrm { t r a i n } } = 0 . 0 3 1$ , the PGD step is fixed to 10, and the step size is fixed to 0.007. Since TRADES has a trade-off parameter $\beta$ , for fair comparison, our GAIR-TRADES uses the same $\beta = 6$ . In GAIR-TRADES, we choose 75 epochs burn-in period and then use Eq. (6) with $\lambda = - 1$ as the weight assignment function. We run TRADES and GAIR-TRADES five repeated trails with different random seeds.
553
+
554
+ The evaluations are the same as Appendix C.8 except the step size $\alpha = 0 . 0 0 3$ for PGD-20 attack, which keeps the same as Zhang et al. $( 2 0 2 0 \mathrm { b } ) ^ { 7 }$ .
555
+
556
+ In Table 2, the best checkpoint is chosen among the model checkpoints at Epochs 75-100 (w.r.t. the PGD-20 robustness). The last checkpoint is evaluated based on the model checkpoint at Epoch 100. Our experiments find that GAIR-TRADES reaches the best robustness at Epoch 90 (three trails), 96 (one trail) and 98 (one trail), and TRADES reaches the best robustness at Epoch 76 (three trail), 77 (one trails) and 79 (one trail). We report the median test accuracy and its standard deviation over 5 repeated trails.
557
+
558
+ Table 2 shows that our GAIR-TRADES can have both improved accuracy and robustness.
559
+
560
+ # C.10 BENCHMARKING ROBUSTNESS WITH ADDITIONAL UNLABELED (U) DATA
561
+
562
+ In this section, we verify the efficacy of our GAIRAT method by utilizing additional 500K U data pre-processed by Carmon et al. (2019) for CIFAR-10 dataset.
563
+
564
+ Carmon et al. (2019) scratched additional U data from 80 Million Tiny Images (Torralba et al., 2008); then, they used standard training to obtain a classifier to give pseudo labels to those U data.
565
+
566
+ Among those U data, they selected 500K U data (with pseudo labels). Combining 50K labeled CIFAR-10’s training data and pseudo-labeled 500K U data, they propose a robust training method named RST which utilized the learning objective function of TRADES, i.e.,
567
+
568
+ $$
569
+ \ell _ { C E } ( f _ { \theta } ( x ) , y ) + \beta \ell _ { K L } ( f _ { \theta } ( \tilde { x } ) , f _ { \theta } ( x ) ) ,
570
+ $$
571
+
572
+ where $\tilde { x }$ is generated by PGD-10 attack with CE loss.
573
+
574
+ Based on the RST method, we introduce our instance-reweighting mechanism, i.e., our GAIR-RST. To be specific, we change the learning objective function to
575
+
576
+ $$
577
+ \ell _ { C E } ( f _ { \theta } ( x ) , y ) + \beta \left\{ \omega \ell _ { K L } ( f _ { \theta } ( \tilde { x } ) , f _ { \theta } ( x ) ) + ( 1 - \omega ) \ell _ { K L } ( f _ { \theta } ( \tilde { x } _ { C W } ) , f _ { \theta } ( x ) ) \right\} ,
578
+ $$
579
+
580
+ where the ${ \tilde { x } } _ { C W }$ refers to the adversarial data generated by $\mathbf { C } \& \mathbf { W }$ attack (Carlini & Wagner, 2017) and $\omega$ is the as Eq. (6).
581
+
582
+ Table 3: Evaluations using standard WRN-28-10
583
+
584
+ <table><tr><td>Method/Paper</td><td>Natural</td><td>AA</td></tr><tr><td>Gowal et al. . (2020)</td><td>89.48</td><td>62.60</td></tr><tr><td>Wu et al. (2020)</td><td>88.25</td><td>60.04</td></tr><tr><td>GAIR-RST (Ours)</td><td>89.36</td><td>59.64</td></tr><tr><td>Carmon et al. (2019)</td><td>89.69</td><td>59.53</td></tr><tr><td>Sehwag et al. (2020)</td><td>88.98</td><td>57.14</td></tr><tr><td>Wang et al. (2020b)</td><td>87.50</td><td>56.29</td></tr><tr><td>Hendrycks et al. (2019)</td><td>87.11</td><td>54.92</td></tr></table>
585
+
586
+ The results of other methods are reported at AA’s GitHub
587
+
588
+ In Table 3, we compare the performance of our GAIR-RST with other methods that use WRN-28- 10 under auto attacks (AA) (Croce & Hein, 2020). All the methods utilized the same set of U data which are from RST’s GitHub8 and the results are reported on the leaderboard of AA’s GitHub9. Our GAIR-RST use the same training settings (e.g., learning rate schedule, $\epsilon _ { t r a i n } = 0 . 0 3 1 )$ as RST. The evaluations are on the full set of the AA in (Croce & Hein, 2020) with $\epsilon _ { t e s t } = 0 . 0 3 1$ , which keeps the same as training.
589
+
590
+ The results show our geometry-aware instance-reweighted method can facilitate a competitive model by utilizing additional U data.
md/train/j7u7cJDBo8p/j7u7cJDBo8p.md ADDED
@@ -0,0 +1,250 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Referring Transformer: A One-step Approach to Multi-task Visual Grounding
2
+
3
+ Muchen Li1,2 muchenli@cs.ubc.ca
4
+
5
+ Leonid Sigal1,2,3,4 lsigal@cs.ubc.ca
6
+
7
+ 1Department of Computer Science, University of British Columbia
8
+ 2Vector Institute for AI 3CIFAR AI Chair 4NSERC CRC Chair
9
+
10
+ # Abstract
11
+
12
+ As an important step towards visual reasoning, visual grounding (e.g., phrase localization, referring expression comprehension / segmentation) has been widely explored. Previous approaches to referring expression comprehension (REC) or segmentation (RES) either suffer from limited performance, due to a two-stage setup, or require the designing of complex task-specific one-stage architectures. In this paper, we propose a simple one-stage multi-task framework for visual grounding tasks. Specifically, we leverage a transformer architecture, where two modalities are fused in a visual-lingual encoder. In the decoder, the model learns to generate contextualized lingual queries which are then decoded and used to directly regress the bounding box and produce a segmentation mask for the corresponding referred regions. With this simple but highly contextualized model, we outperform state-of-the-art methods by a large margin on both REC and RES tasks. We also show that a simple pre-training schedule (on an external dataset) further improves the performance. Extensive experiments and ablations illustrate that our model benefits greatly from contextualized information and multi-task training.
13
+
14
+ # 1 Introduction
15
+
16
+ Multi-modal grounding1 tasks (e.g., phrase localization [1, 3, 9, 41, 48], referring expression comprehension [17, 19, 24, 26, 29, 30, 37, 51, 52, 55, 56] and segmentation [6, 18, 20, 21, 29, 38, 53, 56]) aim to generalize traditional object detection and segmentation to localization of regions (rectangular or at a pixel level) in images that correspond to free-form linguistic expressions. These tasks have emerged as core problems in vision and ML due to the breadth of applications that can make use of such techniques, spanning image captioning, visual question answering, visual reasoning and others.
17
+
18
+ The majority of multi-modal grounding architectures, to date, take the form of two-stage approaches, inspired by Faster RCNN [44] and others, which first generate a set of image region proposals and then associate/ground one, or more, of these regions to a phrase by considering how well the content matches the query phrase. Context among the regions and multiple query phrases, which often come parsed from a single sentence, has also been considered in various ways (e.g., using LSTM stacks [9], graph neural networks [1] and others). More recent variants leverage pre-trained multi-modal Transformers (e.g., ViLBERT [33, 34]) to fine-tune to the grounding tasks. Such models have an added benefit of being able to learn sophisticated cross-modal feature representations from external large-scale data, which further improve the performance. However, a significant limitation of all such two-stage methods is their inability to condition the proposal mechanism on the query phrase itself, which inherently limits the upper bound of performance (see Table 3 in [51]).
19
+
20
+ To address these limitations, more recently, a number of one-stage approaches have been introduced [22, 36, 51, 52]. Most of these take inspiration from Yolo [43] and the variants, and rely on more integrated visual-linguistic fusion and a dense anchoring mechanism to directly predict the grounding regions. While this alleviates the need for a proposal stage, it instead requires somewhat ad hoc anchor definitions, often obtained by clustering of labeled regions, and also limits ability to contextualize grounding decisions as each query phrase is effectively processed independently. Finally, little attention in the literature has been given to leveraging relationship among the REC and RES tasks.
21
+
22
+ In this work we propose an end-to-end one-stage architecture, inspired by the recent DETR [2] detection framework, which is capable of simultaneous language grounding at both a boundingbox and segmentation level, without requiring dense anchor definitions. This model also enables contextualized reasoning by taking into account the entire image, all referring query phrases of interest and (optionally) lingual context (e.g., a sentence from which referring phrases are parsed). Specifically, we leverage a transfomer architecture, with a visual-lingual encoder, to encode image and lingual context, and a two-headed (detection and segmentation) custom contextualized tranformer decoder. The contextualized decoder takes as input learned contextualized phrase queries and decodes them directly to bounding boxes and segmentation masks. Implicit 1-to-1 correspondence between input referring phrases and resulting outputs also enables a more direct formulation of the loss without requiring Hungarian matching. With this simple model we outperform state-of-the-art methods by a large margin on both REC and RES tasks. We also show that a simple pre-training schedule (on an external dataset) further improves the performance. Extensive experiments and ablations illustrate that our model benefit greatly from the contextualized information and the multi-task training.
23
+
24
+ Contributions. Our contributions are: (1) We propose a simple and general one-stage transformerbased architecture for referring expression comprehension and segmentation. The core of this model is the novel transformer decoder that leverages contextualized phrase queries and is able to directly decode those, subject to contextualized image embeddings, into corresponding image regions and segments; (2) Our approach is unique in enabling simultaneous REC and RES using a single trained model (the only other method capable of this is [36]); showing that such multi-task learning leads to improvements on both tasks; (3) As with other transformer-based architectures, we show that pre-training can further improve the performance and both vanila and pre-trained models outperform state-of-the-art on both tasks by significant margins (up to $8 . 5 \%$ on RefCOCO dataset for REC and $1 9 . 4 \%$ for RES). We also thoroughly validate our design in detailed ablations.
25
+
26
+ # 2 Related works
27
+
28
+ Referring Expression Comprehension (REC). REC focuses on producing an image bounding box tightly encompassing a language query. Previous two-staged works [17, 19, 29, 30, 56] reformulate this as a ranking task with a set of candidate regions predicted from a pre-trained proposal mechanism. Despite achieving great success, the performance of two-staged methods is capped by the speed and accuracy of region proposals in the first stage. More recently, one-stage approaches [26, 51, 52] have been used to alleviate the aforementioned limitations. Yang et al. [51, 52] proposed to fuse query information with visual features and pick the bounding box with maximum activation scores from YOLOv3 [43]. Yang et al. [50] explore language structure guided propagation in the context of one stage grounding. Liao et al. [26] utilizes CenterNet [11] to perform correlation filtering for region center localization. However, such methods either require manually tuned anchor boxes or suffer from semantic loss due to modality misalignment. In contrast, our model learns to better align modalities using a cross-modal transformer and directly decode bounding boxes for each query.
29
+
30
+ Referring Expression Segmentation (RES). Similar to REC, RES, proposed in [18], aims to predict segmentation masks to better describe the shape of the referred region. A typical solution for referring expression segmentation is to fuse multi-modal information with a segmentation network (e.g., [16, 31]) and train it to output the segmented masks [18, 29, 38, 53, 56]. More recent approaches focus on designing module to enable better multi-modal interactions, e.g., progressive multi-scale fusion used in [21] and cross-modal attention block used in [20]. Since localization information matters in predicting instance segmentations (as noted in Mask RCNN [16]), very recent work [22] aims to explicitly localize object before doing segmentation. Despite the relatively high performance being achieved in RES, existing approaches still struggle to determine the correct referent region and tend to output noisy segmentation results with an irregular shape, while our model is able to produce segmentations with fine-grained shapes even on challenging scenarios with occlusions or shadows.
31
+
32
+ Multi-task Learning for REC and RES. Multi-task learning is widely applied in object detection and segmentation [2, 16], often, by leveraging shared backbone and task-specific heads. Building on this idea, Luo et al. [36] proposed a multi-task collaborative network (MCN) to jointly address REC and RES. They introduce consistency energy maximization loss that constrains the feature activation map in REC and RES to be similar. While our model is also set up to learn REC and RES tasks jointly, we argue that an explicit constraint tends to downplay the quality of the final predicted mask since the feature map from the REC branch can blur out fine-grained region shape information needed by the RES branch (see Figure 2). Hence, we use an implicit constraint where tasks head of REC and RES are trained to output corresponding bounding box and mask from the same joint multi-modal representation. We illustrate that our model can benefit from multi-task supervision, leading to more accurate results as compared to single-task variants.
33
+
34
+ Pretrained Multi-modal Transformers. Transformer-based pretrained models [5, 12, 33, 47, 54] have recently showed strong potential in multi-modal understanding. LXMERT [47] and ViLBERT [33] use two stream transformers with cross-attention transformer layers on top for multimodal fusion. More recent works, [5, 12] advocate a single-stream design to fuse two modalities earlier. The success of the aforementioned models can largely be attributed to the cross-modal representations obtained by multi-task pretraining on a large amount of aligned image-text pairs. Despite state-of-the-art performance of such models on the downstream REC task, these models, fundamentally, are still a form of a two-stage pipeline where image features are extracted using pretrained detectors or proposal mechanisms. We focus on a one-stage architecture variant that allows visual and lingual features to be aligned at the early stages. Although the focus of our work is not to design a better pretraining scheme, we show that our model can outperform the existing state-of-the-art with proper pretraining.
35
+
36
+ Transformer-based Detectors. More recently, DETR [2] and its variants [13, 58], were proposed to enable end-to-end object detection. DETR reformulates detection as a set prediction tasks and uses transformers to decode learnable queries to bounding boxes. Despite state-of-art performance, DETR is disadvantaged by its optimization difficulty and, usually, extra-long training time. While adopting a similar pipeline, our model focus on aligning different modalities to generate contextualized expression-specific referring queries. We also design our model to get rid of Hungarian matching loss by leveraging one-to-one correspondences between predicted bounding boxes and referring expressions, which leads to faster convergence for our model.
37
+
38
+ # 3 Approach
39
+
40
+ Given an image $\mathcal { T }$ and a set of query phrases $\mathcal { Q } _ { p } = \{ \mathbf { p } _ { i } \} _ { i = 1 , \dots , M }$ , that we assume to come from an (optional) contextual text source2 $\mathcal { Q }$ , our goal is to predict a set of bounding boxes $B = \{ \mathbf { b } _ { i } \} _ { i = 1 , \dots , M }$ and corresponding segmentation masks ${ \cal S } = \{ { \bf s } _ { i } \} _ { i = 1 , \dots , M }$ , one for each query phrase $i$ that localizes that phrase in the image. Note, $M$ is the number of phrases / referring expressions for a given image $\mathcal { T }$ and is typically between 1 and 16 for the Flick $3 0 \mathrm { k }$ [41] dataset.
41
+
42
+ As shown in Figure 1, our referring transformer is composed of four components. Given an image(con)text pair, $< { \mathcal { T } } , { \mathcal { Q } } >$ , a cross-modal encoder generates joint image-text embeddings for each visual and textual token – feature columns and word embeddings respectively. Query phrases $\mathcal { Q } _ { p }$ and image-text embeddings are then fed into a query encoder which produces query phrase embeddings. The decoder jointly reasons across all these query phrase embeddings and decodes multi-task feature, which is then sent to the detection and segmentation head to produce a set of boxes $\boldsymbol { B }$ and masks $s$ The result is a one-staged end-to-end model that solves the REC and RES tasks at the same time. We will now introduce constituent architectural components for the four stages briefly described above.
43
+
44
+ # 3.1 Feature Extraction
45
+
46
+ Visual & Text Backbone. Starting from an initial image $\mathcal { T } \in \mathbb { R } ^ { 3 \times H _ { 0 } \times W _ { 0 } }$ , we adopt the widely used ResNet [15] to generate its low-resolution feature map $\mathbf { f } _ { I } \in \mathbb { R } ^ { C _ { i } \times H W }$ . For the corresponding expression or sentence, we use the uncased base of BERT [8] to obtain the representation $\mathbf { f } _ { Q } \in$ $\mathbb { R } ^ { C _ { t } \times N }$ , while $N$ is the length of the input context sentence.
47
+
48
+ ![](images/e40ae0a0b3ed22270911f094dd1b90cc0e55acb591f3e2843ed7485181a3033e.jpg)
49
+ Figure 1: Referring Transformer. An overview of the proposed architecture is shown in (a). For an image and (con)text input, a visual-lingual encoder is used to refine image features, extracted from a convolutional backbone, and lingual features, extracted by a BERT. A query encoder and decoder produce features for REC and RES heads, given multi-modal features and query phrases. The detailed structure of the query encoder and decoder is shown in (b). Colored squares denote embeddings for corresponding query phrases.
50
+
51
+ Visual-Lingual Encoder. The visual-lingual encoder is designed to fuse information from multimodal sources. For cross-modality encoding, we use a transformer encoder based model, which is composed of 6 transformer encoder layers. Specifically, given both image and text features, multi-layer perceptrons are applied first to project different modalities to a joint embedding space with a hidden dimension of $C$ . To provide transformer encoders with positional information, we follow [2, 8] to add cosine positional embedding $P _ { i m g }$ for image features and learnable positional embedding $P _ { t e x t }$ for text features. We then concatenate the projected features into a single sequence $\mathbf { f } ~ \in ~ \mathbb { R } ^ { C \times ( H W + N ) }$ . To distinguish between modalities, we also deign a learnable modal label embedding $E _ { l a b e l } : \{ E _ { i m g } , E _ { t e x t } ^ { - } \}$ which is added to the original sequences. The visual-lingual encoder then takes a sequence as input, and $\{ P _ { i m g } , P _ { t e x t } , E _ { l a b e l } \}$ are fed into each encoder layer. The encoder output is a multi-modal feature sequence $\mathbf { f } _ { v l } \in \mathbb { R } ^ { C \times ( H W + N ) }$ .
52
+
53
+ # 3.2 Query Encoder and Decoder
54
+
55
+ The query encoder and decoder aims to encode / decode query phrases, conditioned on visual-lingual features from the encoder, into an output bounding box and segmentation. In this stage, we first generate embeddings corresponding to each query phrase. These query phrase embeddings are then fed into the decoder together with the visual-lingual features from the encoder to generate outputs.
56
+
57
+ Encoding Query Phrases. To enable the decoder to generate the desired output (bounding box and/or segmentation) the queries must encode several bits of crucial information. Mainly, (1) encoding of the query phrases, (2) image encoding and (3) phrase-specific optional (con)text information. For phrase encoding in (1) we use a BERT model with pooling heads which share weights with (con)text encoder; this results in the phrase feature vector $\mathbf { f _ { p } } _ { i } \in \mathbb { R } ^ { C }$ for the $i$ -th referring phrase. We note that because we use visual-lingual encoder, (2) and (3) are jointly encoded in multi-modal features $\mathbf { f } _ { v l }$ described in Section 3.1 above. However, $\mathbf { f } _ { v l }$ is phrase-agnostic encoding of the image and (con)text. To generate phrase-specific context, given a phrase $\mathbf { p } _ { i }$ , average pooling is used to extract the phrase-specific context information $\mathbf { f } _ { c } ( \mathbf { p } _ { i } )$ from the visual-lingual feature sequence as follows:
58
+
59
+ $$
60
+ \mathbf { f } _ { c } ( \mathbf { p } _ { i } ) = \frac { \sum \mathbf { f } _ { v l } [ l _ { \mathbf { p } _ { i } } : r _ { \mathbf { p } _ { i } } ] } { r _ { \mathbf { p } _ { i } } - l _ { \mathbf { p } _ { i } } }
61
+ $$
62
+
63
+ where $l _ { \mathbf { p } _ { i } }$ and $r _ { \mathbf { p } _ { i } }$ denotes the left and right bounds of phrase $\mathbf { p } _ { i }$ in the original (con)text sentence. Finally, given phrase encoding $\mathbf { f _ { p } } _ { i }$ and phrase-specific context $\mathbf { f } _ { c } ( \mathbf { p } _ { i } )$ we construct our phrase queries
64
+
65
+ using a multi-later perceptron:
66
+
67
+ $$
68
+ \widehat { Q _ { { \bf p } i } } = \mathtt { M L P } \left( [ { \bf f } _ { c } ( { \bf p } _ { i } ) ; { \bf f _ { p } } _ { i } ] \right) + E _ { p } ,
69
+ $$
70
+
71
+ where $E _ { p } \in \mathbb { R } ^ { C }$ is a learnable embedding which serves as a bias to the formed query.
72
+
73
+ Decoding. In the decoder, self attention layers are used to enable information flow in a dense connected graph of phrase queries. This allows phrase queries to contextualize and refine each other; the inspiration for this step is taken from [1]. After that, a cross attention layer decodes visual-lingual information given the updated phrase query and feature sequence from the encoder. The design of our decoder is similar to the transformer decoder, except attention is non-causal.
74
+
75
+ # 3.3 Multi-task training
76
+
77
+ In this section, we demonstrate how the decoded phrase-specific query features can be naturally used to train multiple heads for different referring tasks (regression for REC and segmentation for RES).
78
+
79
+ Referring Comprehension/Detection (REC). For referring detection tasks, the final output is computed by a simple two-layer perceptron over the decoded phrase-specific query features. We let the detection head directly output center coordinates $\tilde { \mathbf { b } } = ( x , y , h , w )$ for the referred image. To supervise the training, we use a weighted sum of an L1 loss and a Generalized IOU loss [45]:
80
+
81
+ $$
82
+ \begin{array} { r } { \mathcal { L } _ { d e t } = \lambda _ { i o u } \mathcal { L } _ { i o u } ( \mathbf { b } , \tilde { \mathbf { b } } ) + \lambda _ { L 1 } | | \mathbf { b } - \tilde { \mathbf { b } } | | _ { 1 } . } \end{array}
83
+ $$
84
+
85
+ The $\lambda _ { i o u }$ and $\lambda _ { L 1 }$ control the relative weighting of the two losses in the REC objective.
86
+
87
+ Referring Segmentation (RES). Following previous work [2], we design an FPN-like architecture to predict a referring segmentation mask for each phrase expression. Attention masks from the decoder and image features from the visual-lingual encoder are concatenated as the FPN input, while features from different stages of image backbones are used as skip connections to refine the final output. The last linear layer project the upsampled feature to a single channel heatmap and a sigmoid function is used to map the feature to mask scores $\tilde { \mathbf { s } } \in \mathbb { R } ^ { H _ { 0 } / 4 \times W _ { 0 } / 4 }$ . The loss for training RES task is:
88
+
89
+ $$
90
+ \begin{array} { r } { \mathcal { L } _ { s e g } = \lambda _ { f o c a l } \mathcal { L } _ { f o c a l } ( \mathbf { s } , \tilde { \mathbf { s } } ) + \lambda _ { d i c e } \mathcal { L } _ { d i c e } ( \mathbf { s } , \tilde { \mathbf { s } } ) . } \end{array}
91
+ $$
92
+
93
+ Here $\mathcal { L } _ { f o c a l }$ is the focal loss for classifying pixels used in [28], $\mathcal { L } _ { d i c e }$ is the DICE/F-1 loss proposed in [39]; $\lambda _ { f o c a l }$ and $\lambda _ { d i c e }$ are hyper-parameters controlling the relative importance of the two losses.
94
+
95
+ Joint Training. While it is possible to train referring segmentation and referring detection tasks separately, we find that joint training is highly beneficial. Therefore the combined training loss which we optimize is $\mathcal { L } = \mathcal { L } _ { s e g } + \mathcal { L } _ { d e t }$ .
96
+
97
+ Pretraining the Transformer. Transformers are generally data hungry and requires a lot of data to train [5, 33]. Although in this paper we do not use a large pretraining model and a lot of data. We found that simple pretraining strategy on the region description splits of Visual-Genome dataset [25] makes our model achieve comparable and even better performance against some of state-of-the-art pretrained models. Interestingly, we found that although there is no ground truth segmentation provided in Visual-Genome, the RES task can still benefit greatly from pretrained models, likely due to the fine-tuned multi-task representation.
98
+
99
+ # 4 Experiments
100
+
101
+ # 4.1 Datasets
102
+
103
+ RefCOCO/RefCOCO $^ +$ /RefCOCOg (REC&RES). RefCOCO, RefCOCO $^ +$ [55] and RefCOCOg [40] are collections of images and referred objects from MSCOCO [27]. On RefCOCO and Ref$\mathrm { C O C O + }$ we follow the split used in [55] and report scores on the validation, testA and testB splits. On RefCOCOg, we use the RefCOCO-umd splits proposed in [40].
104
+
105
+ Flickr30k Entities (REC). Flickr30k Entities [41] contains 31,783 images and $1 5 8 \mathrm { k }$ caption sentences with 427k annotated phrase. We use splits from [41, 42]. Bounding boxes and phrase annotations are consistent with the previous one-stage approaches [51, 52] for fair comparisons.
106
+
107
+ ReferIt (REC). The ReferItGame dataset [24] contains 20,000 images. We follow setup in [3] for splitting train, validation and test set; resulting in 54k, 6k and 6k referring expressions respectively.
108
+
109
+ Table 1: Comparison on REC task. Performance on RefCOCO/RefCOCO+/RefCOCOg datasets [55] is reported. Ours∗ denotes that pretraining is used. RN50 and RN101 refer to ResNet50 and ResNet101 [15] respectively; DN53 refers to DarkNet53 [43] backbone.
110
+
111
+ <table><tr><td rowspan="2">Models</td><td rowspan="2">Visual Features</td><td rowspan="2">Pretrain Images</td><td rowspan="2">Multi- task</td><td colspan="3">RefCOCO</td><td colspan="3">RefCOCO+</td><td rowspan="2">RefCOCOg</td></tr><tr><td>val</td><td>testA</td><td>testB</td><td>val</td><td>testA</td><td>testB val-u</td></tr><tr><td>Two-stage:</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>test-u</td></tr><tr><td>CMN[19]</td><td>VGG16</td><td>None</td><td>×</td><td>-</td><td>71.03</td><td>65.77</td><td>-</td><td>54.32</td><td>47.76</td><td>-</td><td>-</td></tr><tr><td>RvG-Tree [17]</td><td>RN101</td><td>None</td><td>×</td><td>75.06</td><td>78.61</td><td>69.85</td><td>63.51</td><td>67.45</td><td>56.66</td><td>66.95</td><td>66.51</td></tr><tr><td>CM-Att-Erase [30]</td><td>RN101</td><td>None</td><td>×</td><td>78.35</td><td>83.14</td><td>71.32</td><td>68.09</td><td>73.65</td><td>58.03</td><td>67.99</td><td>68.67</td></tr><tr><td>MAttNet [56]</td><td>RN101</td><td>None</td><td>√</td><td>76.65</td><td>81.14</td><td>69.99</td><td>65.33</td><td>71.62</td><td>56.02</td><td>66.58</td><td>67.27</td></tr><tr><td>NMTree [29]</td><td>RN101</td><td>None</td><td>√</td><td>76.41</td><td>81.21</td><td>70.09</td><td>66.46</td><td>72.02</td><td>57.52</td><td>65.87</td><td>66.44</td></tr><tr><td>One-stage:</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>RCCF[26]</td><td>DLA34</td><td>None</td><td>×</td><td>-</td><td>81.06</td><td>71.85</td><td>-</td><td>70.35</td><td>56.32</td><td>-</td><td>65.73</td></tr><tr><td>SSG [4]</td><td>DN53</td><td>None</td><td>×</td><td>=</td><td>76.51</td><td>67.50</td><td>-</td><td>62.14</td><td>49.27</td><td>58.80</td><td>-</td></tr><tr><td>FAOA [51]</td><td>DN53</td><td>None</td><td>×</td><td>72.54</td><td>74.35</td><td>68.50</td><td>56.81</td><td>60.23</td><td>49.60</td><td>61.33</td><td>60.36</td></tr><tr><td>ReSC-Large [52]</td><td>DN53</td><td>None</td><td>×</td><td>77.63</td><td>80.45</td><td>72.30</td><td>63.59</td><td>68.36</td><td>56.81</td><td>67.30</td><td>67.20</td></tr><tr><td>MCN[36]</td><td>DN53</td><td>None</td><td>√</td><td>80.08</td><td>82.29</td><td>74.98</td><td>67.16</td><td>72.86</td><td>57.31</td><td>66.46</td><td>66.01</td></tr><tr><td>Ours</td><td>RN50</td><td>None</td><td>√</td><td>81.82</td><td>85.33</td><td>76.31</td><td>71.13</td><td>75.58</td><td>61.91</td><td>69.32</td><td>69.10</td></tr><tr><td>Ours</td><td>RN101</td><td>None</td><td>√</td><td>82.23</td><td>85.59</td><td>76.57</td><td>71.58</td><td>75.96</td><td>62.16</td><td>69.41</td><td>69.40</td></tr><tr><td>Pretrained:</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>VilBERT[33]</td><td>RN101</td><td>3.3M</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td>RN101</td><td></td><td>×</td><td>-</td><td>=</td><td>-</td><td>72.34</td><td>78.52</td><td>62.61</td><td>1</td><td>-</td></tr><tr><td>ERNIE-ViL_L[54]</td><td>RN101</td><td>4.3M 4.6M</td><td>×</td><td>=</td><td></td><td></td><td>75.89</td><td>82.37</td><td>66.91</td><td></td><td></td></tr><tr><td>UNTIER_L[5]</td><td>RN101</td><td>4.6M</td><td>×</td><td>81.41</td><td>87.04</td><td>74.17</td><td>75.90</td><td>81.45</td><td>66.70</td><td>74.86</td><td>75.77</td></tr><tr><td>VILLA_L[12]</td><td>RN50</td><td></td><td>×</td><td>82.39</td><td>87.48</td><td>74.84</td><td>76.17</td><td>81.54</td><td>66.84</td><td>76.18</td><td>76.71</td></tr><tr><td>Ours*</td><td></td><td>100k</td><td>√</td><td>85.43</td><td>87.48</td><td>79.86</td><td>76.40</td><td>81.35</td><td>66.59</td><td>78.43</td><td>77.86</td></tr><tr><td>Ours*</td><td>RN101</td><td>100k</td><td>√</td><td>85.65</td><td>88.73</td><td>81.16</td><td>77.55</td><td>82.26</td><td>68.99</td><td>79.25</td><td>80.01</td></tr></table>
112
+
113
+ # 4.2 Implementing Details
114
+
115
+ We train our model with AdamW [32]. The initial learning rate is set to 1e-4 while the learning rate of image backbone and context encoder is set to 1e-5. We initialized weights in the transformer encoder and decoder with Xavier initialization [14]. For image backbone, we experiment with the popular ResNet-50 and ResNet-101 networks [15] where weights are initialized from corresponding ImageNet-pretrained models. For the context encoder and phrase encoder, we use an uncased version of BERT model [8] with weights initialized from pretrained checkpoints provided by HuggingFace [49]. For data augmentation, we scale images such that the longest side is 640 pixels and follow [51] to do random intensity saturation and affine transforms. We remove the random horizontal flip augmentation used in previous work [51] since we notice it causes semantic ambiguity on RefCOCO, likely due to relative location (e.g., left of/right of) specific queries in the dataset.
116
+
117
+ On Flickr30k dataset, we set the maxium length of context sentence to 90 and maximum number of referring phrases to 16. On the ReferIt and the RefCOCO dataset, only phrase expressions are provided and the task aims to predict a single bounding box for each of the expressions. In those cases, the context sentence is taken as the referring phrase expression itself. We set the maximum length of context sentence on these two datasets to 40. To fairly compare with pretrained methods, we use region description split in the VisualGenome [25] to pretrain our model. The dataset contains approximately $1 0 0 \mathrm { k }$ images and we remove the images that appear in Flickr30k Entities and RefCOCO/RefCOCOg/RefCOCO+’s validation and test set to avoid potential test data leak. For all the pretrained methods, we train the model on pretraining dataset for 6 epoches. We find that longer pretraining schedule gives better performance, but since the focus of this paper is not on pretraining methods, we stick to shorter pretraining schedules to save computational resources. All experiments are conducted using 4 Nvidia 2080TI GPU with batch size as 32. For all the results given, we run experiments several times with random seeds and the error bars are within $\pm 0 . 5 \%$ .
118
+
119
+ # 4.3 Quantitative Analysis
120
+
121
+ Evaluation Metrics. For referring expression comprehension (REC), consistent with prior works, we use precision as the evaluation metric. We mark a referring detection as correct when the intersection-over-union (IoU) between the predicted bounding box and ground truth is larger than 0.5. For referring expression segmentation (RES), we reported the Mean IoU (MIoU) between the predicted segmentation mask and ground truth mask.
122
+
123
+ REC and RES on RefCOCO/RefCOCO $+$ /RefCOCOg. Our model addresses REC and RES tasks jointly. We compare their respective performances with the state-of-the-art in Table 1 and 2.
124
+
125
+ Table 2: Comparison on RES tasks. Performance on RefCOCO/RefCOCO $+$ /RefCOCOg datasets [55] is reported. Ours∗ denotes that pretraining is used. RN50 abd RN101 refer to ResNet50 and ResNet101 [15] respectively; DN53 refers to DarkNet53 [43] backbone.
126
+
127
+ <table><tr><td rowspan="2">Methods</td><td rowspan="2">Backbone</td><td colspan="3">RefCOCO</td><td colspan="3">RefCOCO+</td><td colspan="2">RefCOCOg</td><td rowspan="2">Inference time(ms)</td></tr><tr><td>val</td><td>testA</td><td>testB</td><td>val</td><td>testA</td><td>testB</td><td>val</td><td>test</td></tr><tr><td>DMN [38]</td><td>RN101</td><td>49.78</td><td>54.83</td><td>45.13</td><td>38.88</td><td>44.22</td><td>32.29</td><td>-</td><td>-</td><td>-</td></tr><tr><td>MAttNet [56]</td><td>RN101</td><td>56.51</td><td>62.37</td><td>51.70</td><td>46.67</td><td>52.39</td><td>40.08</td><td>47.64</td><td>48.61</td><td>378</td></tr><tr><td>NMTree [29]</td><td>RN101</td><td>56.59</td><td>63.02</td><td>52.06</td><td>47.40</td><td>53.01</td><td>41.56</td><td>46.59</td><td>47.88</td><td>1</td></tr><tr><td>Lang2seg [6]</td><td>RN101</td><td>58.90</td><td>61.77</td><td>53.81</td><td>-</td><td>-</td><td>-</td><td>46.37</td><td>46.95</td><td></td></tr><tr><td>BCAM[20]</td><td>RN101</td><td>61.35</td><td>63.37</td><td>59.57</td><td>48.57</td><td>52.87</td><td>42.13</td><td>-</td><td>=</td><td></td></tr><tr><td>CMPC[21]</td><td>RN101</td><td>61.36</td><td>64.53</td><td>59.64</td><td>49.56</td><td>53.44</td><td>43.23</td><td>=</td><td>=</td><td>=</td></tr><tr><td>MCN+ASNLS [36]</td><td>DN53</td><td>62.44</td><td>64.20</td><td>59.71</td><td>50.62</td><td>54.99</td><td>44.69</td><td>49.22</td><td>49.40</td><td>56</td></tr><tr><td>CGAN [35]</td><td>DN53</td><td>64.86</td><td>68.04</td><td>62.07</td><td>51.03</td><td>55.51</td><td>44.06</td><td>51.01</td><td>51.69</td><td>-</td></tr><tr><td>LTS [22]</td><td>DN53</td><td>65.43</td><td>67.76</td><td>63.08</td><td>54.21</td><td>58.32</td><td>48.02</td><td>54.40</td><td>54.25</td><td>1</td></tr><tr><td>Ours</td><td>RN50</td><td>69.94</td><td>72.80</td><td>66.13</td><td>60.9</td><td>65.20</td><td>53.45</td><td>57.69</td><td>58.37</td><td>38</td></tr><tr><td>Ours</td><td>RN101</td><td>70.56</td><td>73.49</td><td>66.57</td><td>61.08</td><td>64.69</td><td>52.73</td><td>58.73</td><td>58.51</td><td>41</td></tr><tr><td>Ours*</td><td>RN50</td><td>73.61</td><td>75.22</td><td>69.80</td><td>65.30</td><td>69.69</td><td>56.98</td><td>65.70</td><td>65.41</td><td>38</td></tr><tr><td>Ours*</td><td>RN101</td><td>74.34</td><td>76.77</td><td>70.87</td><td>66.75</td><td>70.58</td><td>59.40</td><td>66.63</td><td>67.39</td><td>41</td></tr></table>
128
+
129
+ ![](images/ae52ea765ab73627d130406f12ccbc83f1847c53fe2d5875520aa3f4dee6d22d.jpg)
130
+ Figure 2: Qualitative Evaluation. In (a) comparison to MCN [36] on REC is shown; orange, blue and red bounding boxes correspond to outputs from MCN, our model and the ground truth. In (b) similar comparison on RES is made. The attention map is drawn from the last layer of the decoder. We add mosaic to all human face to protect personal information.
131
+
132
+ In Table 1, the model is first compared with previous one-stage and two-stage approaches for REC. Without bells and whistles, we observe a consistent performance boost of $+ 2 . 7 \% / + 4 \% / + 2 . 1 \%$ on RefCOCO, $+ 6 . 6 \% / + 4 . 3 \% / + 8 . 5 \%$ on $\operatorname { R e f C O C O + }$ and $+ 4 . 4 \% / + 5 . 1 \%$ on RefCOCOg. To compare with pretrained BERT methods, we use the pretraining strategy discussed in Section 3.3. As results show, our model achieves comprehensive advantage and shows distinct improvement on some splits, even compared to advance BERT models that use $4 0 \times$ more data in pretraining. Table 2 illustrates results on RES task in terms of MIoU score. It can be seen that our model achieves the best performance; substantially better than the state-of-art. We further observe that pretraining on the REC task gives a huge performance boost to the RES task, even when no segmentation mask is used in pre-training. Multi-task training enables the model to leverage performance boost in one task to improve the other.
133
+
134
+ We show the inference time for our model in Table 2. Our model can directly decode all query phrases in an image in parallel, allowing it to reach real-time performance. Importantly, note the corresponding scores for our model in Table 1 and Table 2 are based on the output of a single multitask model that predicts referring detection box and segmentation mask simultaneously. The only related work that shares this property is the MCN [36], which has substantially inferior performance.
135
+
136
+ Table 3: Comparison with State-of-The-Art Methods. Table illustrates performance on the test set of ReferItGame [24] and Flickr30K Entities [41] datasets in terms of top-1 accuracy $( \% )$ .
137
+
138
+ <table><tr><td>Models</td><td>Backbone</td><td>ReferItGame test</td><td>Flickr30K test</td><td>Inference time on Flickr30k(ms)</td></tr><tr><td colspan="5">Two-stage</td></tr><tr><td>MAttNet [56]</td><td>RN101</td><td>29.04</td><td>-</td><td>320</td></tr><tr><td>Similarity Net [48]</td><td>RN101</td><td>34.54</td><td>60.89</td><td>184</td></tr><tr><td>CITE [42]</td><td>RN101</td><td>35.07</td><td>61.33</td><td>196</td></tr><tr><td>DDPN[57]</td><td>RN101</td><td>63.00</td><td>73.30</td><td>-</td></tr><tr><td colspan="5">One-stage</td></tr><tr><td>SSG[4]</td><td>DN53</td><td>54.24</td><td>-</td><td>25</td></tr><tr><td>ZSGNet [46]</td><td>RN50</td><td>58.63</td><td>58.63</td><td>-</td></tr><tr><td>FAOA [51]</td><td>DN53</td><td>60.67</td><td>68.71</td><td>23</td></tr><tr><td>RCCF[26]</td><td>DLA34</td><td>63.79</td><td>-</td><td>25</td></tr><tr><td>ReSC-Large [52]</td><td>DN53</td><td>64.60</td><td>69.28</td><td>36</td></tr><tr><td>Ours</td><td>RN50</td><td>70.81</td><td>78.13</td><td>37(14)</td></tr><tr><td>Ours</td><td>RN101</td><td>71.42</td><td>78.66</td><td>40(15)</td></tr><tr><td>Ours*</td><td>RN50</td><td>75.49</td><td>79.46</td><td>37(14)</td></tr><tr><td>Ours*</td><td>RN101</td><td>76.18</td><td>81.18</td><td>40(15)</td></tr></table>
139
+
140
+ REC on Flickr30k-Entities. For Flickr30k dataset, previous one-stage works [51, 52] extract short phrases from sentences and treated them as separate referring expression comprehension tasks. We argue that in this setting, queries are mostly short phrases and therefore cannot well reflect the model’s ability to comprehend them in context. In contrast, our model, given an image and a caption (con)text sentence, aims to predict bounding boxes for all referred entities in the sentence. Doing so gives several advantages: 1. We are able to contextualize referring expressions given all other referring expressions and (con)text provided by the sentence. 2. Locations for all phrases can be inferred in one forward pass of the network, which saves a lot of computation as compared to previous one-stage approaches [51, 52] that process one phrase at a time. Note that our task formulation is consistent with some two-stage models [1, 9], but is unique for a one stage approach.
141
+
142
+ In Table 3 we compare our results with state-of-the-art methods. Without pretraining, we obtain a huge performance boost compared to both previous one-stage $( + 1 3 . 5 4 \% )$ and two-stage $( + 7 . 3 1 \% )$ state-of-the art methods. By using pretrained models, we observe that our model tends to generalize better on the test set and gives even better performance. We also provide comparison of inference time both per image and (per-expression), since our model can amortize inference across expressions. Per-expression, our inference time is substantially lower than all prior methods.
143
+
144
+ REC on ReferIt. Since ReferIt is a relative small dataset, we use a slightly smaller model which contains 3 cross attention layers in the query decoder. The results are shown in Table 3. Our model is able to perform better, by a large margin, than even the latest one-stage methods. We also observe a consistent boost brought by pretraining.
145
+
146
+ # 4.4 Qualitative Analysis
147
+
148
+ In Figure 2, we show our qualitative comparison with previous state-of-the-art multi-task model – MCN [36]. The first two rows of Figure 2(a) show failure cases of MCN that can be better handled by our model. We observe that MCN appears to fail because it neglects some attributes in referring expression (e.g., "yellow drink" and "blue striped shirt"), while our model is able to better model the query and pay attention to object attributes. In the last row, we shows several failure cases of our model. For the first case, the query requires the model to have the ability to recognize number $" 4 4 "$ . For the second and third case, there is visual ambiguity to identify the nearest glass to the bowl or to determine which bear(brown or white) has the longest leg.
149
+
150
+ In Figure 2(b), we show qualitative comparison in terms of referred segmentation mask. Compared to MCN, our model is able to output more detailed object shape and finer outlines. Moreover, our model shows the ability to handle shadows (e.g., the right bottom of the donut) and occlusions (e.g., the man occluded by another man’s arm) and predict smoother segmentation mask. We also give a result on a challenging case in the last row, where the texture boundary of the two giraffe is hard to distinguish. Despite imperfections, our model is still able to focus on the giraffe’s head in the foreground and performs much better than MCN. Part of our model’s ability to generate fine-grained mask can be explained by better localization ability brought by the REC task, in which case the RES head can focus on tuning the shape and boundary of the mask.
151
+
152
+ Table 4: Ablation studies. Table on the top ablates our multi-task and pretraining schehme on $\operatorname { R e f C O C O } / + / \mathrm { g }$ validation set. Table on the bottom ablates on core components of our model.
153
+
154
+ <table><tr><td>REC</td><td>RES Pretrain</td><td>REC Acc↑</td><td>RESMiou↑</td><td>IE</td></tr><tr><td>√</td><td>√</td><td>81.08 /70.02/68.15</td><td>66.03/58.39/54.61 =</td><td>23.52%</td></tr><tr><td>√</td><td>√</td><td>81.82 / 71.13 /69.32</td><td>69.94 / 60.90 / 57.69</td><td>4.73%</td></tr><tr><td>√</td><td>√</td><td>85.01/75.46/77.96</td><td>=</td><td></td></tr><tr><td>√</td><td>√ √</td><td>85.43 / 76.40 / 78.43</td><td>73.61 / 65.30 / 65.70</td><td>4.48%</td></tr></table>
155
+
156
+ Table 5: Results on RefCOCO $^ +$ Dataset with Different Input Resolutions. Our methods correspond to the RN50 model without pretraining.
157
+
158
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Flickr30k</td></tr><tr><td rowspan=1 colspan=1>Model component-w/o Query Decoder-w/o Context Encoder</td><td rowspan=1 colspan=1>49.3873.68</td></tr><tr><td rowspan=1 colspan=1>Query Encoder-w/o Context&amp;Phrase Feature-w/o Context Feature-w/o Phrase Feature</td><td rowspan=1 colspan=1>42.0576.6477.02</td></tr><tr><td rowspan=1 colspan=1>Full model</td><td rowspan=1 colspan=1>78.13</td></tr></table>
159
+
160
+ <table><tr><td rowspan="2">Models</td><td rowspan="2">Resolution</td><td colspan="3">REC(prec@0.5)</td><td colspan="3">RES(MIoU)</td></tr><tr><td>val</td><td>testA</td><td>testB</td><td>val</td><td>testA</td><td>testB</td></tr><tr><td>FAOA [51]</td><td>256× 256</td><td>56.81</td><td>60.23</td><td>49.60</td><td>-</td><td>-</td><td>-</td></tr><tr><td>ReSC-Large [52]</td><td>256× 256</td><td>63.59</td><td>68.36</td><td>56.81</td><td>-</td><td>-</td><td>1</td></tr><tr><td>CMPC[21]</td><td>320×320</td><td>1</td><td>-</td><td>1</td><td>49.56</td><td>53.44</td><td>43.23</td></tr><tr><td>LTS [22]</td><td>416× 416</td><td>-</td><td>=</td><td>=</td><td>54.21</td><td>58.32</td><td>48.02</td></tr><tr><td>MCN [36]</td><td>416× 416</td><td>67.16</td><td>72.86</td><td>57.31</td><td>50.62</td><td>54.99</td><td>44.69</td></tr><tr><td>Ours</td><td>256× 256</td><td>70.05</td><td>73.29</td><td>61.48</td><td>58.26</td><td>61.09</td><td>52.20</td></tr><tr><td>Ours</td><td>320×320</td><td>70.03</td><td>73.23</td><td>61.52</td><td>58.42</td><td>61.48</td><td>52.34</td></tr><tr><td>Ours</td><td>416× 416</td><td>71.50</td><td>75.87</td><td>61.71</td><td>61.00</td><td>64.48</td><td>52.44</td></tr><tr><td>Ours</td><td>640× 640</td><td>71.58</td><td>75.96</td><td>62.16</td><td>61.08</td><td>64.69</td><td>52.73</td></tr></table>
161
+
162
+ # 4.5 Ablation Studies
163
+
164
+ We first consider the importance of the multi-task setup in Table 4 (top). Results indicate that multi-task training consistently boosts both REC and RES performance on Refcoco $/ + / \mathrm { g }$ datasets by a considerable margin. More specifically, we observe that REC loss helps the transformer to better locate the referred object and converge faster in early stages of training. At the same time, RES loss aids the model with more fine-grained information on the shape of the referred region, which helps to further enhance the accuracy. IE here is Inconsistency Error metric originally used in [36] to measure the prediction conflict between the REC and RES task. We can see that joint training of RES and REC greatly reduce the inconsistency between the two tasks. Note that our model also has a much lower multi-task inconsistency compared to MCN [36], with a corresponding IE score of $7 . 5 4 \% ( - 4 0 \% )$ . This shows that our model can do better collaborative learning.
165
+
166
+ Next, we validate the design of our network architecture. We report our scores on the Flickr30k test sets. In Table 4 (bottom), we ablate the model’s major components and features used to form the query. Without (w/o) context encoder indicates that we directly use learnable embedding to encode text; w/o Query Decoder means that we directly use the average pooled feature from the encoder to predict a single referred output. We can see that the context encoder plays an important role in providing good textual representation for further multi-modal fusion. Query encoders are also quite important without which we also observe a big performance drop. For the ablation on query features, we observe that both context feature and phrase features are crucial without which the performance will decrease considerably. The table also showed that the network will not work without guidance of both context and phrase features since we cannot establish a correspondence between multiple queries and outputs in such a case.
167
+
168
+ In RES and REC tasks, the size of input image is a matter of trade off between performance and speed, which is largely effected by the network architecture. Despite that our model is designed to be able to process $6 4 0 \times 6 4 0$ images at real time speed, we also test our model at different input resolution for reference, as showed in Table 5. Note that for resolution 256 and 320, we adjust strides in the final stage of ResNet to keep the number of visual features sent into visual-lingual encoder roughly the same.
169
+
170
+ Table 6: Comparison with Concurrent Work. Performance on RefCOCO/RefCOCO $\left| + \right.$ /RefCOCOg datasets [55]. Ours∗ denotes that pretraining is used. All methods use ResNet101 image backbone.
171
+
172
+ <table><tr><td rowspan="2">Models</td><td rowspan="2">Visual Features</td><td rowspan="2">Pretrain Images</td><td rowspan="2">Multi- task</td><td colspan="3">RefCOCO</td><td colspan="3">RefCOCO+</td><td rowspan="2">RefC0COg</td></tr><tr><td>val</td><td>testA</td><td>testB</td><td>testA</td><td>testB</td><td>val-u</td></tr><tr><td>One-stage:</td><td></td><td></td><td></td><td></td><td></td><td></td><td>val</td><td></td><td></td><td></td><td>test-u</td></tr><tr><td>VGTR [10]</td><td>Bi-LSTM</td><td>None</td><td>×</td><td>79.20</td><td>82.32</td><td>73.78</td><td>63.91</td><td>70.09</td><td>56.51</td><td>65.73</td><td>67.23</td></tr><tr><td>TransVG [7]</td><td>BERT</td><td>None</td><td>×</td><td>81.02</td><td>82.72</td><td>78.35</td><td>64.82</td><td>70.70</td><td>56.94</td><td>68.67</td><td>67.73</td></tr><tr><td>Ours</td><td>BERT</td><td>None</td><td>√</td><td>82.23</td><td>85.59</td><td>76.57</td><td>71.58</td><td>75.96</td><td>62.16</td><td>69.41</td><td>69.40</td></tr><tr><td>Pretrained:</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>MDETR [23] Ours*</td><td>RoBERTa BERT</td><td>200k 100k</td><td>√</td><td>86.75 85.65</td><td>89.58 88.73</td><td>81.41 81.16</td><td>79.52 77.55</td><td>84.09 82.26</td><td>70.62 68.99</td><td>81.64 79.25</td><td>80.89 80.01</td></tr></table>
173
+
174
+ # 4.6 Comparison with Contemporaneous Work
175
+
176
+ Concurrent and independent to us, very recently, there are some closely related works that use transformers for visual referring tasks [7, 10, 23]. We will briefly discuss some of the differences.
177
+
178
+ To begin, [7, 10] focus on REC, while our approach is formulated in multi-task setting and solves both REC and RES tasks simultaneously. In addition, our model is faster and is capable of grounding multiple contextualized phrases, while [7, 10] follow previous one-stage approaches and are only able to infer a single expression at a time; leading, in our case, to more accurate results. MDETR [23] leverages contrastive loss and soft token loss to help better match bounding boxes to phrases. In contrast, our method adopts a simple and straightforward method to pre-match bounding boxes to phrases using a one-to-one matching; this leads to simpler learning objective.
179
+
180
+ We provide quantitative comparison on REC task with these approaches, based on their reported numbers in Table 6. Compared to [7, 10], our model performs substantially better in all, with an exception of RefCOCO testB (where [7] is marginally better), datasets and splits. The biggest improvements can be seen on $\operatorname { R e f C O C O + }$ , where our model is $1 0 . 4 \%$ better (or 6.76 points better), than the closest concurrent work of [7], on the Val split; similar sizable improvements are illustrated on other splits, e.g., $9 . 2 \%$ on $\operatorname { R e f C O C O + }$ testB. In addition, our approach is considerably faster in runtime, since our model is able to handle multiple queries simultaneously (unlike [7, 10]). Compared to [23], in a pretrained model setting, we see that our model performs similarly on RefCOCO and marginally worse on $\operatorname { R e f C O C O + }$ and $\operatorname { R e f C O C O g }$ . This difference can perhaps be attributed to two factors: (1) larger pretrain dataset and longer triaining schedule. (As reported in [23], MDETR takes 224 GPU days to pretrain, while the pretraining for our model is roughly 28 GPU days) (2) using more sophisticated language model (RoBERTa for [23] vs. BERT for us). Limited experiments in Supplemental Material show that indeed, the use of RoBERTa leads to certain improvements. In addition, we setup our method in multi-task setting to solve RES and REC task at the same time, so our formulation while perhaps marginally inferior on REC is more general overall.
181
+
182
+ # 5 Conclusions and Future Work
183
+
184
+ In this work, we present Referring Transformer, a one-step approach to referring expression comprehension (REC) and segmentation (RES). We jointly train our model for RES and REC tasks while enabling contextualized multi-expression references. Our models outperform state-of-the-art by a large margin on five / three datasets for REC / RES respectively, while achieving real-time runtime.
185
+
186
+ One limitation for our model is that we follow the setup in previous works [51, 52] and assume that each expression refers to only one region. In the future, we plan to explore learning to predict multiple regions for each referring entity if necessary. Large-scale multi-task pretraining has been demonstrated to be very effective for ViLBEERT and other similar architectures; this is complementary to our focus in this paper, and we expect such strategies to further improve the performance.
187
+
188
+ # 6 Acknowledgments and Disclosure of Funding
189
+
190
+ This work was funded, in part, by the Vector Institute for AI, Canada CIFAR AI Chair, NSERC CRC, NSERC Discovery and Discovery Accelerator Grants. Resources used in preparing this research were provided, in part, by the Province of Ontario, the Government of Canada through CIFAR, and companies sponsoring the Vector Institute www.vectorinstitute.ai/#partners. Additional hardware support was provided by John R. Evans Leaders Fund CFI grant and Compute Canada under the Resource Allocation Competition award.
191
+
192
+ References
193
+ [1] M. Bajaj, L. Wang, and L. Sigal. G3raphground: Graph-based language grounding. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pages 4281–4290, 2019.
194
+ [2] N. Carion, F. Massa, G. Synnaeve, N. Usunier, A. Kirillov, and S. Zagoruyko. End-to-end object detection with transformers. In European Conference on Computer Vision (ECCV), pages 213–229, 2020.
195
+ [3] K. Chen, R. Kovvuri, and R. Nevatia. Query-guided regression network with context policy for phrase grounding. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pages 824–832, 2017.
196
+ [4] X. Chen, L. Ma, J. Chen, Z. Jie, W. Liu, and J. Luo. Real-time referring expression comprehension by single-stage grounding network. arXiv preprint arXiv:1812.03426, 2018.
197
+ [5] Y.-C. Chen, L. Li, L. Yu, A. El Kholy, F. Ahmed, Z. Gan, Y. Cheng, and J. Liu. Uniter: Universal image-text representation learning. In European Conference on Computer Vision (ECCV), pages 104–120, 2020.
198
+ [6] Y. W. Chen, Y. H. Tsai, T. Wang, Y. Y. Lin, and M. H. Yang. Referring expression object segmentation with caption-aware consistency. In Proceedings of the British Machine Vision Conference (BMVC), 2019.
199
+ [7] J. Deng, Z. Yang, T. Chen, W. Zhou, and H. Li. TransVG: End-to-end visual grounding with transformers. arXiv preprint arXiv:2104.08541, 2021.
200
+ [8] J. Devlin, M.-W. Chang, K. Lee, and K. Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171–4186, 2019.
201
+ [9] P. Dogan, L. Sigal, and M. Gross. Neural sequential phrase grounding (seqground). In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 4175–4184, 2019.
202
+ [10] Y. Du, Z. Fu, Q. Liu, and Y. Wang. Visual grounding with transformers. arXiv preprint arXiv:2105.04281, 2021.
203
+ [11] K. Duan, S. Bai, L. Xie, H. Qi, Q. Huang, and Q. Tian. Centernet: Keypoint triplets for object detection. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pages 6569–6578, 2019.
204
+ [12] Z. Gan, Y.-C. Chen, L. Li, C. Zhu, Y. Cheng, and J. Liu. Large-scale adversarial training for vision-andlanguage representation learning. In Proceedings of the International Conference on Neural Information Processing Systems (NeurIPS), 2020.
205
+ [13] P. Gao, M. Zheng, X. Wang, J. Dai, and H. Li. Fast convergence of detr with spatially modulated co-attention. arXiv preprint arXiv:2101.07448, 2021.
206
+ [14] X. Glorot and Y. Bengio. Understanding the difficulty of training deep feedforward neural networks. In Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, pages 249–256, 2010.
207
+ [15] K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 770–778, 2016.
208
+ [16] K. He, G. Gkioxari, P. Dollár, and R. Girshick. Mask r-cnn. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pages 2961–2969, 2017.
209
+ [17] R. Hong, D. Liu, X. Mo, X. He, and H. Zhang. Learning to compose and reason with language tree structures for visual grounding. IEEE Transactions on Pattern Analysis and Machine Intelligence (TPAMI), 2019.
210
+ [18] R. Hu, M. Rohrbach, and T. Darrell. Segmentation from natural language expressions. In European Conference on Computer Vision (ECCV), pages 108–124, 2016.
211
+ [19] R. Hu, M. Rohrbach, J. Andreas, T. Darrell, and K. Saenko. Modeling relationships in referential expressions with compositional modular networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 1115–1124, 2017.
212
+ [20] Z. Hu, G. Feng, J. Sun, L. Zhang, and H. Lu. Bi-directional relationship inferring network for referring image segmentation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2020.
213
+ [21] S. Huang, T. Hui, S. Liu, G. Li, Y. Wei, J. Han, L. Liu, and B. Li. Referring image segmentation via cross-modal progressive comprehension. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2020.
214
+ [22] Y. Jing, T. Kong, W. Wang, L. Wang, L. Li, and T. Tan. Locate then segment: A strong pipeline for referring image segmentation. arXiv preprint arXiv:2103.16284, 2021.
215
+ [23] A. Kamath, M. Singh, Y. LeCun, I. Misra, G. Synnaeve, and N. Carion. MDETR–modulated detection for end-to-end multi-modal understanding. arXiv preprint arXiv:2104.12763, 2021.
216
+ [24] S. Kazemzadeh, V. Ordonez, M. Matten, and T. Berg. Referitgame: Referring to objects in photographs of natural scenes. In Proceedings of the Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 787–798, 2014.
217
+ [25] R. Krishna, Y. Zhu, O. Groth, J. Johnson, K. Hata, J. Kravitz, S. Chen, Y. Kalantidis, L.-J. Li, D. A. Shamma, et al. Visual genome: Connecting language and vision using crowdsourced dense image annotations. International Journal of Computer Vision (IJCV), 123(1):32–73, 2017.
218
+ [26] Y. Liao, S. Liu, G. Li, F. Wang, Y. Chen, C. Qian, and B. Li. A real-time cross-modality correlation filtering method for referring expression comprehension. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2020.
219
+ [27] T.-Y. Lin, M. Maire, S. Belongie, J. Hays, P. Perona, D. Ramanan, P. Dollár, and C. L. Zitnick. Microsoft coco: Common objects in context. In European Conference on Computer Vision (ECCV), pages 740–755, 2014.
220
+ [28] T.-Y. Lin, P. Goyal, R. Girshick, K. He, and P. Dollár. Focal loss for dense object detection. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pages 2980–2988, 2017.
221
+ [29] D. Liu, H. Zhang, F. Wu, and Z.-J. Zha. Learning to assemble neural module tree networks for visual grounding. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pages 4673–4682, 2019.
222
+ [30] X. Liu, Z. Wang, J. Shao, X. Wang, and H. Li. Improving referring expression grounding with crossmodal attention-guided erasing. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 1950–1959, 2019.
223
+ [31] J. Long, E. Shelhamer, and T. Darrell. Fully convolutional networks for semantic segmentation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 3431– 3440, 2015.
224
+ [32] I. Loshchilov and F. Hutter. Decoupled weight decay regularization. In International Conference on Learning Representations (ICLR), 2019.
225
+ [33] J. Lu, D. Batra, D. Parikh, and S. Lee. ViLBERT: Pretraining task-agnostic visiolinguistic representations for vision-and-language tasks. In Proceedings of the International Conference on Neural Information Processing Systems (NeurIPS), pages 13–23, 2019.
226
+ [34] J. Lu, V. Goswami, M. Rohrbach, D. Parikh, and S. Lee. 12-in-1: Multi-task vision and language representation learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 10437–10446, 2020.
227
+ [35] G. Luo, Y. Zhou, R. Ji, X. Sun, J. Su, C.-W. Lin, and Q. Tian. Cascade grouped attention network for referring expression segmentation. In ACM International Conference on Multimedia, 2020.
228
+ [36] G. Luo, Y. Zhou, X. Sun, L. Cao, C. Wu, C. Deng, and R. Ji. Multi-task collaborative network for joint referring expression comprehension and segmentation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2020.
229
+ [37] J. Mao, J. Huang, A. Toshev, O. Camburu, A. L. Yuille, and K. Murphy. Generation and comprehension of unambiguous object descriptions. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 11–20, 2016.
230
+ [38] E. Margffoy-Tuay, J. C. Pérez, E. Botero, and P. Arbeláez. Dynamic multimodal instance segmentation guided by natural language queries. In European Conference on Computer Vision (ECCV), 2018.
231
+ [39] F. Milletari, N. Navab, and S.-A. Ahmadi. V-net: Fully convolutional neural networks for volumetric medical image segmentation. In International Conference on 3D Vision (3DV), pages 565–571, 2016.
232
+ [40] V. K. Nagaraja, V. I. Morariu, and L. S. Davis. Modeling context between objects for referring expression understanding. In European Conference on Computer Vision (ECCV), pages 792–807, 2016.
233
+ [41] B. A. Plummer, L. Wang, C. M. Cervantes, J. C. Caicedo, J. Hockenmaier, and S. Lazebnik. Flickr30k entities: Collecting region-to-phrase correspondences for richer image-to-sentence models. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pages 2641–2649, 2015.
234
+ [42] B. A. Plummer, P. Kordas, M. H. Kiapour, S. Zheng, R. Piramuthu, and S. Lazebnik. Conditional image-text embedding networks. In European Conference on Computer Vision (ECCV), pages 249–264, 2018.
235
+ [43] J. Redmon and A. Farhadi. Yolov3: An incremental improvement. arXiv preprint arXiv:1804.02767, 2018.
236
+ [44] S. Ren, K. He, R. Girshick, and J. Sun. Faster r-cnn: Towards real-time object detection with region proposal networks. IEEE Transactions on Pattern Analysis and Machine Intelligence (TPAMI), 39(6): 1137–1149, 2017.
237
+ [45] H. Rezatofighi, N. Tsoi, J. Gwak, A. Sadeghian, I. Reid, and S. Savarese. Generalized intersection over union: A metric and a loss for bounding box regression. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 658–666, 2019.
238
+ [46] A. Sadhu, K. Chen, and R. Nevatia. Zero-shot grounding of objects from natural language queries. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pages 4694–4703, 2019.
239
+ [47] H. Tan and M. Bansal. Lxmert: Learning cross-modality encoder representations from transformers. Proceedings of the Conference on Empirical Methods in Natural Language Processing (EMNLP), 2019.
240
+ [48] L. Wang, Y. Li, J. Huang, and S. Lazebnik. Learning two-branch neural networks for image-text matching tasks. IEEE Transactions on Pattern Analysis and Machine Intelligence (TPAMI), 41(2):394–407, 2018.
241
+ [49] T. Wolf, L. Debut, V. Sanh, J. Chaumond, C. Delangue, A. Moi, P. Cistac, T. Rault, R. Louf, M. Funtowicz, J. Davison, S. Shleifer, P. von Platen, C. Ma, Y. Jernite, J. Plu, C. Xu, T. L. Scao, S. Gugger, M. Drame, Q. Lhoest, and A. M. Rush. Transformers: State-of-the-art natural language processing. In Proceedings of the Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 38–45, 2020.
242
+ [50] S. Yang, G. Li, and Y. Yu. Propagating over phrase relations for one-stage visual grounding. In European Conference on Computer Vision, pages 589–605. Springer, 2020.
243
+ [51] Z. Yang, B. Gong, L. Wang, W. Huang, D. Yu, and J. Luo. A fast and accurate one-stage approach to visual grounding. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pages 4683–4693, 2019.
244
+ [52] Z. Yang, T. Chen, L. Wang, and J. Luo. Improving one-stage visual grounding by recursive sub-query construction. In European Conference on Computer Vision (ECCV), 2020.
245
+ [53] L. Ye, M. Rochan, Z. Liu, and Y. Wang. Cross-modal self-attention network for referring image segmentation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2019.
246
+ [54] F. Yu, J. Tang, W. Yin, Y. Sun, H. Tian, H. Wu, and H. Wang. Ernie-vil: Knowledge enhanced visionlanguage representations through scene graph. arXiv preprint arXiv:2006.16934, 2020.
247
+ [55] L. Yu, P. Poirson, S. Yang, A. C. Berg, and T. L. Berg. Modeling context in referring expressions. In European Conference on Computer Vision (ECCV), pages 69–85, 2016.
248
+ [56] L. Yu, Z. Lin, X. Shen, J. Yang, X. Lu, M. Bansal, and T. L. Berg. Mattnet: Modular attention network for referring expression comprehension. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 1307–1315, 2018.
249
+ [57] Z. Yu, J. Yu, C. Xiang, Z. Zhao, Q. Tian, and D. Tao. Rethinking diversified and discriminative proposal generation for visual grounding. International Joint Conference on Artificial Intelligence (IJCAI), 2018.
250
+ [58] X. Zhu, W. Su, L. Lu, B. Li, X. Wang, and J. Dai. Deformable detr: Deformable transformers for end-to-end object detection. In International Conference on Learning Representations (ICLR), 2021.
md/train/lR4aaWCQgB/lR4aaWCQgB.md ADDED
@@ -0,0 +1,294 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Implicit MLE: Backpropagating Through Discrete Exponential Family Distributions
2
+
3
+ Mathias Niepert NEC Laboratories Europe mathias.niepert@neclab.eu
4
+
5
+ Pasquale Minervini University College London p.minervini@ucl.ac.uk
6
+
7
+ Luca Franceschi Istituto Italiano di Tecnologia University College London ucablfr@ucl.ac.uk
8
+
9
+ # Abstract
10
+
11
+ Combining discrete probability distributions and combinatorial optimization problems with neural network components has numerous applications but poses several challenges. We propose Implicit Maximum Likelihood Estimation (I-MLE), a framework for end-to-end learning of models combining discrete exponential family distributions and differentiable neural components. I-MLE is widely applicable as it only requires the ability to compute the most probable states and does not rely on smooth relaxations. The framework encompasses several approaches such as perturbation-based implicit differentiation and recent methods to differentiate through black-box combinatorial solvers. We introduce a novel class of noise distributions for approximating marginals via perturb-and-MAP. Moreover, we show that I-MLE simplifies to maximum likelihood estimation when used in some recently studied learning settings that involve combinatorial solvers. Experiments on several datasets suggest that I-MLE is competitive with and often outperforms existing approaches which rely on problem-specific relaxations.
12
+
13
+ # 1 Introduction
14
+
15
+ While deep neural networks excel at perceptual tasks, they tend to generalize poorly whenever the problem at hand requires some level of symbolic manipulation or reasoning, or exhibit some (known) algorithmic structure. Logic, relations, and explanations, as well as decision processes, frequently find natural abstractions in discrete structures, ill-captured by the continuous mappings of standard neural nets. Several application domains, ranging from relational and explainable ML to discrete decision-making [Mišic and Perakis, 2020], could benefit from general-purpose learning algorithms ´ whose inductive biases are more amenable to integrating symbolic and neural computation. Motivated by these considerations, there is a growing interest in end-to-end learnable models incorporating discrete components that allow, e.g., to sample from discrete latent distributions [Jang et al., 2017, Paulus et al., 2020] or solve combinatorial optimization problems [Poganciˇ c et al., 2019, Mandi et al., ´ 2020]. Discrete energy-based models (EBMs) [LeCun et al., 2006] and discrete world models [Hafner et al., 2020] are additional examples of neural network based models that require the ability to backpropagate through discrete probability distributions.
16
+
17
+ For complex discrete distributions, it is intractable to compute the exact gradients of the expected loss. For combinatorial optimization problems, the loss is discontinuous, and the gradients are zero almost everywhere. The standard approach revolves around problem-specific smooth relaxations, which allow one to fall back to (stochastic) backpropagation. These strategies, however, require tailor-made relaxations, presuppose access to the constraints and are, therefore, not always feasible nor tractable for large state spaces. Moreover, reverting to discrete outputs at test time may cause unexpected behavior. In other situations, discrete outputs are required at training time because one has to make one of a number of discrete choices, such as accessing discrete memory or deciding on an action in a game.
18
+
19
+ With this paper, we take a step towards the vision of general-purpose algorithms for hybrid learning systems. Specifically, we consider settings where the discrete component(s), embedded in a larger computational graph, are discrete random variables from the constrained exponential family1. Grounded in concepts from Maximum Likelihood Estimation (MLE) and perturbation-based implicit differentiation, we propose Implicit Maximum Likelihood Estimation (I-MLE). To approximate the gradients of the discrete distributions’ parameters, I-MLE computes, at each update step, a target distribution $q$ that depends on the loss incurred from the discrete output in the forward pass. In the backward pass, we approximate maximum likelihood gradients by treating $q$ as the empirical distribution. We propose ways to derive target distributions and introduce a novel family of noise perturbations well-suited for approximating marginals via perturb-and-MAP. I-MLE is general-purpose as it only requires the ability to compute most probable states and not faithful samples or probabilistic inference. In summary, we make the following contributions:
20
+
21
+ 1. We propose implicit maximum likelihood estimation (I-MLE) as a framework for computing gradients with respect to the parameters of discrete exponential family distributions; 2. We show that this framework is useful for backpropagating gradients through both discrete probability distributions and discrete combinatorial optimization problems; 3. I-MLE requires two ingredients: a family of target distribution $q$ and a method to sample from complex discrete distributions. We propose two families of target distributions and a family of noise-distributions for Gumbel-max (perturb-and-MAP) based sampling. 4. We show that I-MLE simplifies to explicit maximum-likelihood learning when used in some recently studied learning settings involving combinatorial optimization solvers. 5. Extensive experimental results suggest that I-MLE is flexible and competitive compared to the straight-through and relaxation-based estimators.
22
+
23
+ Instances of the I-MLE framework can be easily integrated into modern deep learning pipelines, allowing one to readily utilize several types of discrete layers with minimal effort. We provide implementations and Python notebooks at https://github.com/nec-research/tf-imle
24
+
25
+ # 2 Problem Statement and Motivation
26
+
27
+ We consider models described by the equations
28
+
29
+ $$
30
+ \pmb \theta = h _ { v } ( \pmb x ) , \quad z \sim p ( z ; \pmb \theta ) , \quad \pmb y = f _ { \pmb u } ( z ) ,
31
+ $$
32
+
33
+ where $\mathbf { \boldsymbol { x } } \in \mathcal { X }$ and $\pmb { y } \in \mathcal { V }$ denote feature inputs and target outputs, $h _ { v } : \mathcal { X } \to \Theta$ and $f _ { u } : \mathcal { Z } \to \mathcal { V }$ are smooth parameterized maps, and $p ( z ; \pmb \theta )$ is a discrete probability distribution.
34
+
35
+ ![](images/eabd7667464ba4e46678b486e4a28c97dec1d9e003f2a0291f040bff469565d0.jpg)
36
+ Figure 1: Illustration of the addressed learning problem. $_ { z }$ is the discrete (latent) structure.
37
+
38
+ Given a set of examples $\boldsymbol { \mathcal { D } } ~ = ~ \{ ( \hat { \mathbf { x } } _ { j } , \hat { \mathbf { y } } _ { j } ) \} _ { j = 1 } ^ { N }$ , we are concerned with learning the parameters $\boldsymbol { \omega } = ( \pmb { v } , \pmb { u } )$ of (1) by finding approximate solutions of $\begin{array} { r } { \operatorname* { m i n } _ { \omega } \sum _ { j } L ( \hat { { \bf x } } _ { j } , \hat { { \bf y } } _ { j } ; \omega ) / N } \end{array}$ . The training error $L$ is typically defined as:
39
+
40
+ $$
41
+ L ( \hat { x } , \hat { y } ; \omega ) = \mathbb { E } _ { \hat { z } \sim p ( z ; \hat { \theta } ) } \left[ \ell ( f _ { u } ( \hat { z } ) , \hat { y } ) \right] \quad \mathrm { w i t h } \quad \hat { \theta } = h _ { v } ( \hat { x } ) ,
42
+ $$
43
+
44
+ where $\ell : \mathcal { V } \times \mathcal { V } \mathbb { R } ^ { + }$ is a point-wise loss function. Fig. 1 illustrates the setting. For example, an interesting instance of (1) and (2) arises in learning to explain user reviews [Chen et al., 2018] where the task is to infer a target sentiment score (e.g. w.r.t. the quality of a product) from a review while also providing a concise explanation of the predicted score by selecting a subset of exactly $k$ words (cf. Example 2). In Section 6, we present experiments precisely in this setting. As anticipated in the introduction, we restrict the discussion to instances in which $p ( z ; \pmb \theta )$ belongs to the (constrained) discrete exponential family, which we now formally introduce.
45
+
46
+ Let $z$ be a vector of discrete random variables over a state space $\mathcal { Z }$ and let $\mathcal { C } \subseteq \mathcal { Z }$ be the set of states that satisfy a given set of linear constraints.2 Let $\pmb { \theta } \in \Theta \subseteq \mathbb { R } ^ { m }$ be a real-valued parameter vector.
47
+
48
+ The probability mass function (PMF) of a discrete constrained exponential family r.v. is:
49
+
50
+ $$
51
+ p ( z ; \pmb { \theta } ) = \left\{ \begin{array} { l l } { \exp \big ( \langle z , \pmb { \theta } \rangle / \tau - A ( \pmb { \theta } ) \big ) } & { \mathrm { i f } z \in \mathcal { C } , } \\ { 0 } & { \mathrm { o t h e r w i s e } . } \end{array} \right.
52
+ $$
53
+
54
+ Here, $\langle \cdot , \cdot \rangle$ is the inner product and $\tau$ the temperature, which, if not mentioned otherwise, is assumed to be 1. $A ( \pmb \theta )$ is the log-partition function defined as $\begin{array} { r } { A ( \pmb { \theta } ) = \log \left( \sum _ { z \in \mathcal { C } } \exp \left( \langle z , \pmb { \theta } \rangle / \tau \right) \right) } \end{array}$ . We call $\langle z , \theta \rangle$ the weight of the state $_ z$ . The marginals (expected value, mean) of the r.v.s $\mathbf { Z }$ are defined as $\mu ( \pmb \theta ) : = \mathbb { E } _ { \hat { z } \sim p ( z ; \pmb \theta ) } [ \hat { z } ]$ . Finally, the most probable or Maximum A-Posteriori (MAP) states are defined as ${ \mathrm { M A P } } ( \pmb { \theta } ) : = \arg \operatorname* { m a x } _ { z \in \mathcal { C } } ~ \langle z , \pmb { \theta } \rangle$ . The family of probability distributions we define here captures a broad range of settings and subsumes probability distributions such as positive Markov random fields and statistical relational formalisms [Wainwright and Jordan, 2008, Raedt et al., 2016]. We now discuss some examples which we will use in the experiments. Crucially, in Example 3 we establish the link between the constrained exponential family and integer linear programming (ILP) identifying the ILP cost coefficients with the distribution’s parameters $\pmb \theta$ .
55
+
56
+ Example 1 (Categorical Variables). An m-way (one-hot) categorical variable corresponds to $p ( z ; \pmb { \theta } ) = \mathrm { e x p } \left( \langle z , \pmb { \theta } \rangle - A ( \pmb { \theta } ) \right)$ , subject to the constraint $\langle z , \mathbf { 1 } \rangle = 1$ , where 1 is a vector of ones.
57
+
58
+ As ${ \mathcal C } = \{ { \bf e } _ { i } \} _ { i = 1 } ^ { m }$ , where $\mathbf { e } _ { i }$ is the $i$ -th vector of the canonical base, the parameters of the above distribution coincide with the weights, which are often called logits in this context. The marginals $\pmb { \mu }$ coincide with the PMF and can be expressed through a closed-form smooth function of $\pmb \theta$ : the softmax. This facilitates a natural relaxation that involves using $\mu ( \theta )$ in place of $_ z$ [Jang et al., 2017]. The convenient properties of the categorical distribution, however, quickly disappear even for slightly more complex distributions, as the following example shows.
59
+
60
+ Example 2 $k$ -subset Selection). Assume we want to sample binary $m$ -dimensional vectors with $k$ ones. This amounts to replacing the constraint in Example 1 by the constraint $\langle z , \mathbf { 1 } \rangle = k$ .
61
+
62
+ Here, a closed-form expression for the marginals does not exist: sampling from this distribution requires computing the ${ \bf \dot { \rho } } ( { m } ) = O ( m ^ { k } )$ weights (if $k \leq m / 2$ ). Computing MAP states instead takes time linear in $m$ .
63
+
64
+ Example 3 (Integer Linear Programs). Consider the combinatorial optimization problem given by the integer linear program arg $\scriptstyle \operatorname* { m i n } _ { z \in { \mathcal { C } } } \langle z , c \rangle$ , where $\mathcal { C }$ is an integral polytope and $c \in \mathbb { R } ^ { m }$ is $a$ vector of cost coefficients, and let $z ^ { * } ( \bar { \boldsymbol { c } } )$ be the set of its solutions. We can associate to the ILP the family (indexed by $\tau > 0$ ) of probability distributions $p ( z ; \pmb \theta )$ from (3), with $\mathcal { C }$ the ILP polytope and $\pmb \theta = - \pmb \ c$ . Then, for every $\tau > 0$ , the solutions of the $I L P$ correspond to the MAP states: $\mathrm { M A P } ( \pmb { \theta } ) = \arg \operatorname* { m a x } _ { \pmb { z } \in \mathcal { C } } \langle \pmb { z } , \pmb { \theta } \rangle = \pmb { z } ^ { \ast } ( \pmb { c } )$ and for $\tau 0$ one has that $\operatorname* { P r } ( \mathbf { Z } \in z ^ { * } ( c ) ) 1$ .
65
+
66
+ Many problems of practical interest can be expressed as ILPs, such as finding shortest paths, planning and scheduling problems, and inference in propositional logic.
67
+
68
+ # 3 The Implicit Maximum Likelihood Estimator
69
+
70
+ In this section, we develop and motivate a family of general-purpose gradient estimators for Eq. (2) that respect the structure of $\mathcal { C }$ . 3 Let $( \hat { \pmb x } , \hat { \pmb y } ) \in \hat { \mathcal { D } }$ be a training example and $\hat { z } \sim p ( z ; h _ { v } ( \hat { { \pmb x } } ) )$ . The gradient of $L$ w.r.t. $\textbf { \em u }$ is given by $\nabla _ { u } L ( \hat { \pmb x } , \hat { \pmb y } ; \omega ) = \mathbb { E } _ { \hat { z } } [ \partial _ { u } f _ { \pmb u } ( \hat { z } ) ^ { \top } \nabla _ { \pmb y } \ell ( \pmb y , \hat { \pmb y } ) ]$ with $\pmb { y } = f _ { \pmb { u } } ( \hat { \pmb z } )$ , which may be estimated by drawing one or more samples from $p$ . Regarding $\nabla _ { v } L$ , one has
71
+
72
+ $$
73
+ \begin{array} { r } { \nabla _ { v } L ( \hat { x } , \hat { y } ; \omega ) = \partial _ { v } h _ { v } ( \hat { x } ) ^ { \intercal } \nabla _ { \theta } L ( \hat { x } , \hat { y } ; \omega ) , } \end{array}
74
+ $$
75
+
76
+ where the major challenge is to compute $\nabla _ { \boldsymbol { \theta } } L$ . A standard approach is to employ the score function estimator (SFE) which typically suffers from high variance. Whenever a pathwise derivative estimator (PDE) is available it is usually the preferred choice [Schulman et al., 2015]. In our setting, however, the PDE is not readily applicable since $_ { z }$ is discrete and, therefore, every (exact) reparameterization path would be discontinuous. Various authors developed (biased) adaptations of the PDE for discrete r.v.s (see Section 5). These involve either smooth approximations of $p ( z ; \pmb \theta )$ or approximations of the derivative of the reparameterization map. Our proposal departs from these two routes and instead involves the formulation of an implicit maximum likelihood estimation problem. In a nutshell, I-MLE is a (biased) estimator that replaces $\nabla _ { \boldsymbol { \theta } } L$ in Eq. (4) with $\hat { \nabla } _ { \boldsymbol { \theta } } \mathcal { L }$ , where $\mathcal { L }$ is an implicitly defined MLE objective and $\hat { \nabla }$ is an estimator of the gradient.
77
+
78
+ <table><tr><td colspan="2">Algorithm1 Instance of I-MLE with perturbation-based implicit differentiation.</td></tr><tr><td>function FORWARDPASS(0) Il Sample from the noise distribution p(e)</td><td>function BACKWARDPASS(Vzl(fu(z),y), λ) load 0,∈,and from the forward pass</td></tr><tr><td>∈~ ρ(∈) l/ Compute a MAP state of perturbed 0 = MAP(0+∈) save 0,∈,and z for the backward pass</td><td>/l Compute target distribution parameters 0&#x27;=θ-λ∀zl(fu(z),y) lSingle sampleI-MLE gradient estimate ∀θL(θ,θ&#x27;)= ≥-MAP(0&#x27;+∈)</td></tr></table>
79
+
80
+ We now focus on deriving the (implicit) MLE objective $\mathcal { L }$ . Let us assume we can, for any given $\hat { y }$ construct an exponential family distribution $q ( z ; \pmb \theta ^ { \prime } )$ that, ideally, is such that
81
+
82
+ $$
83
+ \begin{array} { r } { \mathbb { E } _ { \hat { z } \sim q ( z ; \theta ^ { \prime } ) } \left[ \ell \big ( f _ { u } \big ( \hat { z } \big ) , \hat { y } \big ) \right] \leq \mathbb { E } _ { \hat { z } \sim p ( z ; \theta ) } \left[ \ell \big ( f _ { u } \big ( \hat { z } \big ) , \hat { y } \big ) \right] . } \end{array}
84
+ $$
85
+
86
+ We will call $q$ the target distribution. The idea is that, by making $p$ more similar to $q$ we can (iteratively) reduce the model loss $L ( \hat { \mathbfcal x } , \hat { \pmb y } ; \omega )$ . To this purpose, we define $\mathcal { L }$ as the MLE objective4 between the model distribution $p$ with parameters $\pmb \theta$ and the target distribution $q$ with parameters $\pmb { \theta } ^ { \prime }$ :
87
+
88
+ $$
89
+ \mathcal { L } ( \pmb { \theta } , \pmb { \theta } ^ { \prime } ) : = - \mathbb { E } _ { \hat { z } \sim q ( z ; \pmb { \theta } ^ { \prime } ) } [ \log p ( \hat { z } ; \pmb { \theta } ) ] = \mathbb { E } _ { \hat { z } \sim q ( z ; \pmb { \theta } ^ { \prime } ) } [ A ( \pmb { \theta } ) - \langle \hat { z } , \pmb { \theta } \rangle ]
90
+ $$
91
+
92
+ Now, exploiting the fact that $\nabla _ { \pmb { \theta } } A ( \pmb { \theta } ) = \pmb { \mu } ( \pmb { \theta } )$ , we can compute the gradient of $\mathcal { L }$ as
93
+
94
+ $$
95
+ \nabla _ { \pmb { \theta } } \mathcal { L } ( \pmb { \theta } , \pmb { \theta } ^ { \prime } ) = \pmb { \mu } ( \pmb { \theta } ) - \mathbb { E } _ { \hat { z } \sim q ( z ; \pmb { \theta } ^ { \prime } ) } [ \hat { z } ] = \pmb { \mu } ( \pmb { \theta } ) - \pmb { \mu } ( \pmb { \theta } ^ { \prime } ) ,
96
+ $$
97
+
98
+ that is , the difference between the marginals of the current distribution $p$ and the marginals of the target distribution $q$ , also equivalent to the gradient of the KL divergence between $p$ and $q$ .
99
+
100
+ We will not use Eq. (7) directly, as computing the marginals is, in general, a #P-hard problem and scales poorly with the dimensionality $m$ . MAP states are typically less expensive to compute (e.g. see Example 2) and are often used directly to approximate ${ \bf \dot { \mu } } ( \pmb { \theta } ) ^ { \dot { 5 } }$ or to compute perturb-andMAP approximations, where $\mu ( \pmb \theta ) \approx \mathbb { E } _ { \epsilon \sim \rho ( \epsilon ) } \dot { \mathsf { M A P } } ( \bar { \pmb \theta } + \epsilon )$ where $\epsilon \sim \rho ( \epsilon )$ is an appropriate noise distribution with domain $\mathbb { R } ^ { m }$ . In this work we follow – and explore in more detail in Section $3 . 2 \textrm { - }$ the latter approach (also referred to as the Gumbel-max trick [cf. Papandreou and Yuille, 2011]), a strategy that retains most of the computational advantages of the pure MAP approximation but may be less crude. Henceforth, we only assume access to an algorithm to compute MAP states (such as a standard ILP solver in the case of Example 3) and rephrase Eq. (1) as
101
+
102
+ $$
103
+ \theta = h _ { \boldsymbol { v } } ( \boldsymbol { x } ) , \quad \boldsymbol { z } = \mathtt { M A P } ( \theta + \epsilon ) \mathrm { ~ w i t h ~ } \epsilon \sim p ( \epsilon ) , \quad \boldsymbol { y } = f _ { \boldsymbol { u } } ( \boldsymbol { z } ) .
104
+ $$
105
+
106
+ With Eq. (8) in place, the general expression for the I-MLE estimator is $\widehat { \nabla } _ { \boldsymbol { v } } L ( \boldsymbol { x } , \boldsymbol { y } ; \omega ) \ =$ $\partial _ { v } h _ { v } ( \hat { { \pmb x } } ) ^ { \top } \widehat { \nabla } _ { \theta } \mathcal { L } ( \pmb \theta , \pmb \theta ^ { \prime } )$ with $\pmb { \theta } = h _ { v } ( \hat { \pmb { x } } )$ where, for $S \in \mathbb { N } ^ { + }$ :
107
+
108
+ $$
109
+ \widehat { \nabla } _ { \theta } \mathcal { L } ( \theta , \theta ^ { \prime } ) = \frac { 1 } { S } \sum _ { i = 1 } ^ { S } [ \mathtt { M A P } ( \theta + \epsilon _ { i } ) - \mathtt { M A P } ( \theta ^ { \prime } + \epsilon _ { i } ) ] , \mathrm { ~ w i t h ~ } \epsilon _ { i } \sim \rho ( \epsilon ) \mathrm { ~ f o r ~ } i \in \{ 1 , \dots , S \} .
110
+ $$
111
+
112
+ If the states of both the distributions $p$ and $q$ are binary vectors, $\hat { \nabla } _ { \pmb { \theta } } \mathcal { L } ( \pmb { \theta } , \pmb { \theta } ^ { \prime } ) \in [ - 1 , 1 ] ^ { m }$ and when $S = 1 \widehat { \nabla } _ { \theta } \mathcal { L } ( \theta , \pmb { \theta } ^ { \prime } ) \in \{ - 1 , 0 , 1 \} ^ { m }$ . In the following, we discuss the problem of constructing families of target distributions $q$ . We will also analyze under what assumptions the inequality of Eq. (5) holds.
113
+
114
+ # 3.1 Target Distributions via Perturbation-based Implicit Differentiation
115
+
116
+ The efficacy of the I-MLE estimator hinges on a proper choice of $q$ , a hyperparameter of our framework. In this section we derive and motivate a class of general-purpose target distributions, rooted in perturbation-based implicit differentiation (PID):
117
+
118
+ $$
119
+ q ( z ; \theta ^ { \prime } ) = p ( z ; \theta - \lambda \nabla _ { z } \ell ( f _ { u } ( \overline { { z } } ) , \hat { y } ) ) \mathrm { ~ w i t h ~ } \overline { { z } } = \mathtt { M A P } ( \theta + \epsilon ) \mathrm { ~ a n d ~ } \epsilon \sim \rho ( \epsilon ) ,
120
+ $$
121
+
122
+ where $\pmb { \theta } = h _ { v } ( \hat { \pmb { x } } )$ , $( \hat { \pmb x } , \hat { \pmb y } ) \in \mathcal { D }$ is a data point, and $\lambda > 0$ is a hyperparameter that controls the perturbation intensity.
123
+
124
+ To motivate Eq. (10), consider the setting where the inputs to $f$ are the marginals of $p ( z ; \pmb \theta )$ (rather than discrete perturb-and-MAP samples as in Eq. (8)), that is, $\begin{array} { r } { \pmb { y } = f _ { \pmb { u } } ( \pmb { \mu } ( \pmb { \theta } ) ) } \end{array}$ with $\pmb { \theta } = h _ { v } ( \hat { \pmb { x } } )$ , and redefine the training error $L$ of Eq. (2) accordingly. A seminal result by Domke [2010] shows that, in this case, we can obtain $\nabla _ { \boldsymbol { \theta } } L$ by perturbation-based differentiation as:
125
+
126
+ $$
127
+ \nabla _ { \pmb \theta } L ( \hat { \pmb x } , \hat { \pmb y } ; \omega ) = \operatorname* { l i m } _ { \lambda 0 } \{ \frac { 1 } { \lambda } [ \pmb \mu ( \pmb \theta ) - \pmb \mu ( \pmb \theta - \lambda \nabla _ { \pmb \mu } L ( \hat { \pmb x } , \hat { \pmb y } ; \omega ) ) ] \} ,
128
+ $$
129
+
130
+ where $\nabla _ { \mu } L = \partial _ { \mu } f _ { u } ( \pmb { \mu } ) ^ { \intercal } \nabla _ { \pmb { y } } \ell ( \pmb { y } , \pmb { \hat { y } } )$ . The expression inside the limit may be interpreted as the gradient of an implicit MLE objective (see Eq. (7)) between the distribution $p$ with (current) parameters $\pmb { \theta }$ and $p$ with parameters perturbed in the negative direction of the downstream gradient $\nabla _ { \mu } L$ . Now, we can adapt (11) to our setting of Eq. (8) by resorting to the straight-through estimator (STE) assumption [Bengio et al., 2013]. Here, the STE assumption translates into reparameterizing $_ z$ as a function of $\pmb { \mu }$ and approximating $\partial _ { \mu } z \approx I$ . Then, $\nabla _ { \mu } \bar { L } = \partial _ { \mu } z ^ { \intercal } \nabla _ { z } L \approx \nabla _ { z } \bar { L }$ and we approximate Eq. (11) as:
131
+
132
+ $$
133
+ \nabla _ { \pmb { \theta } } L ( \hat { \pmb x } , \hat { \pmb y } ; \omega ) \approx \frac { 1 } { \lambda } \left[ \mu ( \pmb { \theta } ) - \mu \left( \pmb { \theta } - \lambda \nabla _ { z } L ( \hat { \pmb x } , \hat { \pmb y } ; \omega ) \right) \right] = \frac { 1 } { \lambda } \nabla _ { \pmb { \theta } } \mathcal { L } ( \pmb { \theta } , \pmb { \theta } - \lambda \nabla _ { z } L ( \hat { \pmb x } , \hat { \pmb y } ; \omega ) ) ,
134
+ $$
135
+
136
+ for some $\lambda > 0$ . From Eq. (12) we derive (10) by taking a single sample estimator of $\nabla _ { z } L$ (with perturb-and-MAP sampling) and by incorporating the constant $1 / \lambda$ into a global learning rate. IMLE with PID target distributions may be seen as a way to generalize the STE to more complex distributions. Instead of using the gradients $\nabla _ { z } L$ to backpropagate directly, I-MLE uses them to construct a target distribution $q$ . With that, it defines an implicit maximum likelihood objective, whose gradient (estimator) propagates the supervisory signal upstream, critically, taking the constraints into account. When using Eq. (10) with $\bar { \rho } ( \epsilon ) = \bar { \delta } _ { 0 } ( \bar { \epsilon } ) ^ { 6 }$ , the I-MLE estimator also recovers a recently proposed gradient estimation rule to differentiate through black-box combinatorial optimization problems [Poganciˇ c et al., 2019]. ´ I-MLE unifies existing gradient estimation rules in one framework. Algorithm 1 shows the pseudo-code of the algorithm implementing Eq. (9) for $S = 1$ , using the PID target distribution of Eq. (10). The simplicity of the code also demonstrates that instances of I-MLE can easily be implemented as a layer.
137
+
138
+ We will resume the discussion about target distributions in Section 4, where we analyze more closely the setup of Example 3. Next, we focus on the perturb-and-MAP strategies and derive a class of noise distributions that is particularly apt to the settings we consider in this work.
139
+
140
+ # 3.2 A Novel Family of Perturb-and-MAP Noise Distributions
141
+
142
+ When $p$ is a complex high-dimensional distribution, obtaining Monte Carlo estimates of the gradient in Eq. (7) requires approximate sampling. In this paper, we rely on perturbation-based sampling, also known as perturb and MAP [Papandreou and Yuille, 2011]. In this Section we propose a novel way to design tailored noise perturbations. While the proposed family of noise distributions works with I-MLE, the results of this section are of independent interest and can also be used in other (relaxed) perturb-and-MAP based gradient estimators [e.g. Paulus et al., 2020]. First, we start by revisiting a classic result by Papandreou and Yuille [2011] which theoretically motivates the perturb-and-MAP approach (also known as the Gumbel-max trick), which we generalize here to consider also the temperature parameter $\tau$ .
143
+
144
+ Proposition 1. Let $p ( z ; \pmb \theta )$ be a discrete exponential family distribution with integer polytope $\mathcal { C }$ and temperature $\tau$ , and let $\langle z , \theta \rangle$ be the unnormalized weight of each $z \in { \mathcal { C } }$ . Moreover, let $\tilde { \pmb { \theta } }$ be such that, for all $z \in { \mathcal { C } }$ , $\langle z , \tilde { \theta } \rangle = \langle z , \theta \rangle + \epsilon ( z )$ with each $\epsilon ( z )$ sampled i.i.d. from $\mathrm { G u m b e l } ( 0 , \tau )$ . Then we have that $\operatorname* { P r } ( \mathbb { M } \mathrm { A P } ( \tilde { \pmb { \theta } } ) = z ) = p ( z ; \pmb { \theta } )$ .
145
+
146
+ All proofs can be found in Appendix B. The proposition states that if we can perturb the weights $\langle z , \theta \rangle$ of each $z \in { \mathcal { C } }$ with independent $\mathrm { G u m b e l } ( 0 , \tau )$ noise, then obtaining MAP states from the perturbed model is equivalent to sampling from $p ( z ; \pmb \theta )$ at temperature7 $\tau$ . For complex exponential distributions, perturbing the weights $\langle z , \theta \rangle$ for each state $z \in { \mathcal { C } }$ is at least as expensive as computing the marginals exactly. Hence, one usually resorts to local perturbations of each $[ \pmb \theta ] _ { i }$ (the $i$ -th entry of the vector $\pmb \theta$ ) with Gumbel noise. Fortunately, we can prove that, for a large class of distributions, it is possible to design more suitable local perturbations. First, we show that, for any $\kappa \in \mathbb { N } ^ { + }$ , a Gumbel distribution can be written as a finite sum of $\kappa$ i.i.d. (implicitly defined) random variables.
147
+
148
+ Lemma 1. Let $X \sim \mathrm { G u m b e l } ( 0 , \tau )$ and let $\kappa \in \mathbb { N } ^ { + }$ . Define the Sum-of-Gamma distribution as
149
+
150
+ $$
151
+ \mathrm { S o G } ( \kappa , \tau , s ) : = \frac { \tau } { \kappa } \left\{ \sum _ { i = 1 } ^ { s } \left\{ \mathrm { G a m m a } ( 1 / \kappa , \kappa / i ) \right\} - \log ( s ) \right\} ,
152
+ $$
153
+
154
+ where $s \in \mathbb { N } ^ { + }$ and ${ \mathrm { G a m m a } } ( \alpha , \beta )$ is the Gamma distribution with shape $\alpha$ and scale $\beta$ , and let $\begin{array} { r } { \mathrm { S o G } ( \kappa , \tau ) : = \operatorname* { l i m } _ { s \to \infty } \mathrm { S o G } ( \kappa , \tau , s ) } \end{array}$ . Then we have that $\begin{array} { r } { X \sim \sum _ { j = 1 } ^ { \kappa } \epsilon _ { j } } \end{array}$ , with $\epsilon _ { j } \sim \mathrm { S o G } ( \kappa , \tau )$ .
155
+
156
+ Based on Lemma 1, we can show that for exponential family distributions where every $z \in { \mathcal { C } }$ has exactly $k$ non-zero entries we can design perturbations of $\langle z , \theta \rangle$ following a Gumbel distribution.
157
+
158
+ Theorem 1. Let $p ( z ; \pmb \theta )$ be a discrete exponential family distribution with integer polytope $\mathcal { C }$ and temperature $\tau$ . Assume that if $z \in { \mathcal { C } }$ then $\langle z , \mathbf { 1 } \rangle = k$ for some constant $k \in \mathbb { N } ^ { + }$ . Let $\tilde { \pmb { \theta } }$ be the perturbation obtained by $[ \tilde { \pmb { \theta } } ] _ { j } = [ \pmb { \theta } ] _ { j } + \epsilon _ { j }$ with $\epsilon _ { j } \sim \mathrm { S o G } ( k , \tau )$ from Eq. (13). Then, $\forall z \in { \mathcal { C } }$ we have that $\langle z , \tilde { \theta } \rangle = \langle z , \theta \rangle + \dot { \epsilon } ( z )$ , with $\epsilon ( z ) \sim \mathrm { G u m b e l } ( 0 , \tau )$ .
159
+
160
+ Many problems such as $k$ -subset selection, traveling salesman, spanning tree, and graph matching strictly satisfy the assumption of Theorem 1. We can, however, also apply the strategy in cases where the variance of $\langle \mathbf { Z } , \mathbf { 1 } \rangle$ is small (e.g. shortest weighted path). The Sum-of-Gamma perturbations provide a more fine-grained approach to noise perturbations. For $\tau = \kappa = 1$ , we obtain the standard Gumbel perturbations. In contrast to the standard Gumbel $( 0 , 1 )$ noise, the pro
161
+
162
+ ![](images/e0b58c90a6c30b14ce39e4e93af1d1b872b0db4b9e733cfa46a52fd2587d1609.jpg)
163
+ Figure 2: Histograms for 10k samples where each sample is (left) the sum of $5 ~ \epsilon _ { j } \sim \bar { \mathrm { G u m b e l } } ( 0 , 1 )$ or (right) the sum of $5 \epsilon _ { j } \sim \mathrm { S o G } ( 5 , 1 , 1 0 )$ .
164
+
165
+ posed local Sum-of-Gamma perturbations result in weights’ perturbations that follow the Gumbel distribution. Fig. 2 shows histograms of $1 0 \mathrm { k }$ samples, where each sample is either the sum of 5 samples from $\mathrm { G u m b e l } ( 0 , 1 )$ (the standard approach) or the sum of $k = 5$ samples from $\begin{array} { r } { \mathrm { S o G ( 5 , 1 , 1 0 ) } = \frac { 1 } { 5 } \sum _ { i = 1 } ^ { 1 0 } \{ \mathrm { G a m m a } ( 1 / 5 , 5 / i ) - \log ( 1 0 ) \} } \end{array}$ . While we still cannot sample faithfully from $p ( z ; \pmb \theta )$ as the perturbations are not independent, we can counteract the problem of partially dependent perturbations by increasing the temperature $\tau$ and, therefore, the variance of the noise distribution. We explore and verify the importance of tuning $\tau$ empirically. In the appendix, we also show that the infinite series from Lemma 1 can be well approximated by a finite sum using convergence results for the Euler-Mascheroni series [Mortici, 2010].
166
+
167
+ # 4 Target Distributions for Combinatorial Optimization Problems
168
+
169
+ In this section, we explore the setting where the discrete computational component arises from a combinatorial optimization (CO) problem, specifically an integer linear program (ILP). Many authors have recently considered the setup where the CO component occupies the last layer of the model defined by Eq. (1) (where $f _ { u }$ is the identity) and the supervision is available in terms of examples of either optimal solutions [e.g. Poganciˇ c et al., 2019] or optimal cost coefficients (conditioned on ´ the inputs) [e.g. Elmachtoub and Grigas, 2020]. We have seen in Example 3 that we can naturally associate to each ILP a probability distribution (see Eq. (3)) with $\pmb { \theta }$ given by the negative cost coefficients $^ c$ of the ILP and $\mathcal { C }$ the integral polytope. Letting $\tau 0$ is equivalent to taking the MAP in the forward pass. Furthermore, in Section 3.1 we showed that the I-MLE framework subsumes a recently propose method by Poganciˇ c et al. [2019]. Here, instead, we show that, for a certain choice ´ of the target distribution, I-MLE estimates the gradient of an explicit maximum likelihood learning loss $\mathcal { L }$ where the data distribution is ascribed to either (examples of) optimal solutions or optimal cost coefficients.
170
+
171
+ Let $q ( z ; \pmb \theta ^ { \prime } )$ be the distribution $p ( z ; \pmb \theta ^ { \prime } )$ , with parameters
172
+
173
+ $$
174
+ [ \pmb { \theta } ^ { \prime } ] _ { i } : = \left\{ \begin{array} { l l } { [ \pmb { \theta } ] _ { i } } & { \mathrm { ~ i f ~ } [ \nabla _ { z } L ] _ { i } = 0 } \\ { - [ \nabla _ { z } L ] _ { i } } & { \mathrm { ~ o t h e r w i s e . } } \end{array} \right.
175
+ $$
176
+
177
+ In the first CO setting, we observe training data $\mathcal { D } = \{ ( \hat { \pmb x } _ { j } , \hat { \pmb y } _ { j } ) \} _ { j = 1 } ^ { N }$ where $\hat { y } _ { j } \in \mathcal { C }$ and the loss $\ell$ measures a distance between a discrete $\hat { z } _ { j } \sim p ( z ; \pmb { \theta } _ { j } )$ with $\bar { \theta _ { j } } = h _ { v } ( \hat { \pmb x } )$ and a given optimal solution of the ILP $\hat { y } _ { j }$ . An example is the Hamming loss $\ell _ { H }$ [Poganciˇ c et al., 2019] defined as ´ $\ell _ { H } ( z , y ) = z \circ ( { \bf 1 } - \bar { y } ) + y \circ ( { \bf 1 } - z )$ , where $\circ$ denotes the Hadamard (or entry-wise) product.
178
+
179
+ Fact 1. If one uses $\ell _ { H }$ , then I-MLE with the target distribution of Eq. (14) and $\rho ( \epsilon ) = \delta _ { 0 }$ is equivalent to the perceptron-rule estimator of the MLE objective between $p ( z ; h _ { v } ( \hat { { \bf x } } _ { j } ) )$ and $\hat { y } _ { j }$ .
180
+
181
+ It follows that the method by Poganciˇ c et al. [2019] returns, for a large enough ´ $\lambda$ , the maximumlikelihood gradients (scaled by $1 / \lambda$ ) approximated by the perceptron rule. The proofs are given in Appendix B.
182
+
183
+ In the second CO setting, we observe training data $\mathcal D = \{ ( \hat { \pmb x } _ { j } , \hat { \pmb c } _ { j } ) \} _ { j = 1 } ^ { N }$ , where ${ \hat { \mathbf { c } } } _ { j }$ is the optimal cost conditioned on input $\hat { \mathbf { \Omega } } _ { \hat { \mathbf { \Omega } } } ^ { \hat { \mathbf { \Omega } } } ( \hat { \mathbf { \Omega } } _ { \hat { \mathbf { \Omega } } } ^ { \hat { \mathbf { \Omega } } } )$ . Here, various authors [e.g. Elmachtoub and Grigas, 2020, Mandi et al., 2020, Mandi and Guns, 2020] use as point-wise loss the regret $\ell _ { R } ( \pmb \theta , \pmb c ) = \pmb c ^ { \top } \left( \pmb z ( \pmb \theta ) - \hat { \pmb z } ^ { * } ( \pmb c ) \right)$ where $z ( \theta )$ is a state sampled from $p ( z ; \pmb \theta )$ (possibly with temperature $\tau 0$ , that is, a MAP state) and $\hat { z } ^ { \ast } ( \acute { c } ) \in z ^ { \ast } ( c )$ is an optimal state for $^ c$ .
184
+
185
+ Fact 2. If one uses $\ell _ { R }$ then I-MLE with the target distribution of Eq. (14) is equivalent to the perturb-and-MAP estimator of the MLE objective between $p ( z ; h _ { v } ( \hat { { \bf x } } _ { j } ) )$ and $p ( z ; - \hat { \pmb { c } } _ { j } )$ .
186
+
187
+ This last result also implies that when using the target distribution $q$ from (14) in conjunction with the regret, I-MLE performs maximum-likelihood learning minimizing the KL divergence between the current distribution and the distribution whose parameters are the optimal cost.
188
+
189
+ Moreover, both facts imply that, when sampling from the MAP states of the distribution $q$ defined by Eq. (14), we have that $\bar { \ell } ( \hat { \hat { z } } , \hat { y } ) = 0$ for $\hat { z } \in \mathsf { M A P } ( \theta ^ { \prime } )$ . Therefore, $\ell ( \hat { z } , \hat { y } ) = 0 \leq { \mathbb E } _ { \hat { z } \sim p ( z ; \pmb { \theta } ) } \left[ \ell ( ( \hat { z } , \hat { y } ) \right]$ meaning that the inequality of Eq. (5) is satisfied for $\tau 0$ .
190
+
191
+ # 5 Related Work
192
+
193
+ Several papers address the gradient estimation problem for discrete r.v.s, many resorting to relaxations. Maddison et al. [2017], Jang et al. [2017] propose the Gumbel-softmax distribution to relax categorical r.v.s; Paulus et al. [2020] study extensions to more complex probability distributions. The concrete distribution (the Gumbel-softmax distribution) is only directly applicable to categorical variables. For more complex distributions, one has to come up with tailor-made relaxations or use the straightthrough or score function estimators (see for instance Kim et al. [2016], Grover et al. [2019]). In our experiments, we compare with the Gumbel-softmax estimator in Figure 4 (left and right). We show that the $k$ -subset VAE trained with I-MLE achieves loss values that are similar to those of the categorical (1-subset) VAE trained with the Gumbel-softmax gradient estimator. Tucker et al. [2017], Grathwohl et al. [2018] develop parameterized control variates (the former was named REBAR) based on continuous relaxations for the score-function estimator. In contrast, we focus explicitly on problems where only discrete samples are used during training. Moreover, REBAR is tailored to categorical distributions. I-MLE is intended for models with complex distributions (e.g. those with with many constraints).
194
+
195
+ Approaches that do not rely on relaxations are specific to certain distributions [Bengio et al., 2013, Franceschi et al., 2019, Liu et al., 2019] or assume knowledge of $\mathcal { C }$ [Kool et al., 2020]. We provide a general-purpose framework that does not require access to the linear constraints and the corresponding integer polytope $\mathcal { C }$ . Experiments in the next section show that while I-MLE only requires a MAP solver, it is competitive and sometimes outperforms tailor-made relaxations. SparseMAP [Niculae et al., 2018] is an approach to structured prediction and latent variables, replacing the exponential distribution (specifically, the softmax) with a sparser distribution. Similar to our work, it only presupposes the availability of a MAP oracle. LP-SparseMAP [Niculae and Martins, 2020] is an extension that uses a relaxation of the optimization problem rather than a MAP solver. Sparsity can also be exploited for efficient marginal inference in latent variable models [Correia et al., 2020].
196
+
197
+ A series of works about differentiating through CO problems [Wilder et al., 2019, Elmachtoub and Grigas, 2020, Ferber et al., 2020, Mandi and Guns, 2020] relax ILPs by adding $L ^ { 1 }$ , $L ^ { 2 }$ or log-barrier regularization terms and differentiate through the KKT conditions deriving from the application of the cutting plane or the interior-point methods. These approaches are conceptually linked to techniques for differentiating through smooth programs [Amos and Kolter, 2017, Donti et al., 2017,
198
+
199
+ Agrawal et al., 2019, Chen et al., 2020, Domke, 2012, Franceschi et al., 2018] that arise not only in modelling but also in hyperparameter optimization and meta-learning. Poganciˇ c et al. [2019], ´ Rolínek et al. [2020], Berthet et al. [2020] propose methods that are not tied to a specific ILP solver. As we saw above, the former two, originally derived from a continuous interpolation argument, may be interpreted as special instantiations of I-MLE. The latter addresses the theory of perturbed optimizers and discusses perturb and MAP in the context of the Fenchel-Young loss. All the COrelated works assume that either optimal costs or solutions are given as training data, while I-MLE may be also applied in the absence of such supervision by making use of implicitly generated target distributions. Other authors focus on devising differentiable relaxations for specific CO problems such as SAT [Evans and Grefenstette, 2018] or MaxSAT [Wang et al., 2019]. Machine learning intersects with CO also in other contexts, e.g. in learning heuristics to improve the performances of CO solvers or differentiable models such as GNNs to “replace” them; see Bengio et al. [2020] and references therein.
200
+
201
+ Direct Loss Minimization [DLM, McAllester et al., 2010, Song et al., 2016] is also related to our work, but the assumption there is that examples of optimal states $\hat { z }$ are given. Lorberbom et al. [2019] extend the DLM framework to discrete VAEs using coupled perturbations. Their approach is tailored to VAEs and not general-purpose. Under a methodological viewpoint, I-MLE inherits from classical MLE [Wainwright and Jordan, 2008] and perturb-and-MAP [Papandreou and Yuille, 2011]. The theory of perturb-and-MAP was used to derive general-purpose upper bounds for log-partition functions [Hazan and Jaakkola, 2012, Shpakova and Bach, 2016].
202
+
203
+ # 6 Experiments
204
+
205
+ The set of experiments can be divided into three parts. First, we analyze and compare the behavior of I-MLE with (i) the score function and (ii) the straight-through estimator using a toy problem. Second, we explore the latent variable setting where both $h _ { v }$ and $f _ { u }$ in Eq. (1) are neural networks and the optimal structure is not available during training. Finally, we address the problem of differentiating through black-box combinatorial optimization problems, where we use the target distribution derived in Section 4. More experimental details for available in the appendix.
206
+
207
+ Synthetic Experiments. We conducted a series of experiments with a tractable 5-subset distribution (see Example 2) where $\mathbf { z } \in \{ 0 , 1 \} ^ { 1 0 }$ . We set the loss to $L ( \pmb \theta ) = \mathbb { E } _ { \hat { z } \sim p ( \mathbf { z } ; \pmb \theta ) } [ \| \hat { z } - \mathbf b \| ^ { 2 } ]$ , where $\mathbf { b }$ is a fixed vector sampled from $\mathcal { N } ( 0 , \bf { I } )$ . In Fig. 3 (Top), we plot optimization curves with means and standard deviations, comparing the proposed estimator with the straight-through (STE) and the score function (SFE) estimators. 8 For STE and I-MLE, we use Perturb-and-MAP (PaM) with Gumbel and $\operatorname { S o G } ( 1 , 5 , 1 0 )$ noise, respectively. The SFE uses faithful samples and exact marginals (which is feasible only when $m$ is very small) and converges much more slowly than the other methods, while the STE converges to worse solutions than those found using I-MLE. Fig. 3 (Bottom) shows the benefits of using SoG rather than Gumbel perturbations with I-MLE. While the best configurations for both are comparable, SoG noise achieves in average (over 100 runs) strictly better final values of $L$ for more than $5 0 \%$ of the tested configurations (varying $\lambda$ from Eq. (10) and the learning rate) and exhibit smaller variance (see Fig. 6). Additional details and results in Appendix C.1.
208
+
209
+ Learning to Explain. The BEERADVOCATE dataset [McAuley et al., 2012] consists of free-text reviews and ratings for 4 different aspects of beer: appearance, aroma, palate, and taste. Each sentence in the test set has annotations providing the words that best describe the various aspects. Following the experimental setup of recent work [Paulus et al., 2020], we address the problem introduced by the L2X paper [Chen et al., 2018] of learning a distribution over $k$ -subsets of words that best explain a given aspect rating. The complexity of the MAP problem for the $k$ -subset distribution is linear in $k$ . sThe training set has $8 0 \mathrm { k }$ reviews for the aspect APPEARANCE and 70k reviews for all other aspects. Since the original dataset [McAuley et al., 2012] did not provide separate validation and test sets, we compute 10 different evenly sized validation/test splits of the 10k held out set and compute mean and standard deviation over 10 models, each trained on one split. Subset precision was computed using a subset of 993 annotated reviews. We use pre-trained word embeddings from Lei et al. [2016]. Prior work used non-standard neural networks for which an implementation is not available [Paulus et al., 2020]. Instead, we used the neural network from the L2X paper with 4 convolutional and one dense layer. This neural network outputs the parameters $\pmb \theta$ of the distribution $p ( z ; \pmb \theta )$ over $k$ -hot binary latent masks with $k \in \{ 5 , 1 0 , 1 5 \}$ . We compare to relaxation-based baselines L2X [Chen et al., 2018] and SoftSub [Xie and Ermon, 2019]. We also compare the straight-through estimator (STE) with Sum-of-Gamma (SoG) perturbations. We used the standard hyperparameter settings of Chen et al. [2018] and choose the temperature parameter $t \in \{ 0 . 1 , 0 . 5 , \mathrm { i } . 0 , \bar { 2 } . 0 \}$ . For I-MLE we choose $\lambda \in { \overline { { \{ 1 0 ^ { 1 } , 1 0 ^ { 2 } , 1 0 ^ { 3 } \} } } }$ , while for both I-MLE and STE we choose $\tau \in \{ k , 2 k , 3 k \}$ based on the validation MSE. We used the standard Adam settings. We trained separate models for each aspect using MSE as point-wise loss $\ell$ .
210
+
211
+ ![](images/48f76f7e8f24241085c07798fd126bbd8e641743cdf4ba3d708da522f0e223be.jpg)
212
+ Figure 3: Top: Gradient-based optimization of $L$ with various estimators. Bottom: Mean difference of the final value of $L$ between I-MLE with SoG or Gumbel $\rho ( \epsilon )$ varying $\lambda$ and the learning rate (blue $=$ better SoG).
213
+
214
+ <table><tr><td rowspan="2">Method</td><td colspan="2">Test MSE</td><td colspan="2">Subset Precision</td></tr><tr><td>Mean</td><td>Std. Dev.</td><td>Mean</td><td> Std. Dev.</td></tr><tr><td colspan="5">k=10</td></tr><tr><td>L2X (t = 0.1)</td><td>6.68</td><td>1.08</td><td>26.65</td><td>9.39</td></tr><tr><td>SoftSub (t = 0.5)</td><td>2.67</td><td>0.14</td><td>44.44</td><td>2.27</td></tr><tr><td>STE(T = 30)</td><td>4.44</td><td>0.09</td><td>38.93</td><td>0.14</td></tr><tr><td>I-MLE MAP</td><td>4.08</td><td>0.91</td><td>14.55</td><td>0.04</td></tr><tr><td>I-MLEGumbel</td><td>2.68</td><td>0.10</td><td>39.28</td><td>2.62</td></tr><tr><td>I-MLE(τ = 30)</td><td>2.71</td><td>0.10</td><td>47.98</td><td>2.26</td></tr><tr><td colspan="5">k=5</td></tr><tr><td>L2X (t = 0.1)</td><td>5.75</td><td>0.30</td><td>33.63</td><td>6.91</td></tr><tr><td>SoftSub (t = 0.5)</td><td>2.57</td><td>0.12</td><td>54.06</td><td>6.29</td></tr><tr><td>I-MLE(T = 5)</td><td>2.62</td><td>0.05</td><td>54.76</td><td>2.50</td></tr><tr><td colspan="5">k =15</td></tr><tr><td>L2X (t = 0.1)</td><td>7.71</td><td>0.64</td><td>23.49</td><td>10.93</td></tr><tr><td>SoftSub (t = 0.5)</td><td>2.52</td><td>0.07</td><td>37.78</td><td>1.71</td></tr><tr><td>I-MLE(T = 30)</td><td>2.91</td><td>0.18</td><td>39.56</td><td>2.07</td></tr></table>
215
+
216
+ Table 1: Detailed results for the aspect AROMA. Test MSE and subset precision, both $\times 1 0 0$ , for $k \mathbf { \hat { \in } } \left\{ 5 , 1 0 , 1 5 \right\}$ .
217
+
218
+ Table 1 lists detailed results for the aspect AROMA. I-MLE’s MSE values are competitive with those of the best baseline, and its subset precision is significantly higher than all other methods (for $\tau = 3 0$ ). Using only MAP as the approximation of the marginals leads to poor results. This shows that using the tailored perturbations with tuned temperature is crucial to achieve state of the art results. The Sum-of-Gamma perturbation introduced in this paper outperforms the standard local Gumbel perturbations. More details and results can be found in the appendix.
219
+
220
+ Discrete Variational Auto-Encoder. We evaluate various perturbation strategies for a discrete $k$ -subset Variational Auto-Encoder (VAE) and compare them to the straight-through estimator (STE) and the Gumbel-softmax trick. The latent variables model a probability distribution over $k$ -subsets of (or top- $k$ assignments too) binary vectors of length 20. The special case of $k = 1$ is equivalent to a categorical variable with 20 categories. For $k > 1$ , we use I-MLE using the class of PID target distributions of Eq. (10) and compare various perturb-and-MAP noise sampling strategies. The experimental setup is similar to those used in prior work on the Gumbel softmax tricks [Jang et al., 2017]. The loss is the sum of the reconstruction losses (binary cross-entropy loss on output pixels) and the KL divergence between the marginals of the variables and the uniform distribution. The encoding and decoding functions of the VAE consist of three dense layers (encoding: $5 1 2 - 2 5 6 - 2 0 { \mathrm { x } } 2 0$ ; decoding: 256-512-784). We do not use temperature annealing. Using Eq. (9) with $S = 1$ , we use either $\mathrm { G u m b e l } ( 0 , 1 )$ perturbations (the standard approach)9 or Sum-of-Gamma (SoG) perturbations at a temperature of $\tau = 1 0$ . We run 100 epochs and record the loss on the test data. The difference in training time is negligible. Fig. 4 shows that using the SoG noise distribution is beneficial. The test loss using the SoG perturbations is lower despite the perturbations having higher variance and, therefore, samples of the model being more diverse. This shows that using perturbations of the weights that follow a proper Gumbel distribution is indeed beneficial. I-MLE significantly outperforms the
221
+
222
+ ![](images/baf320b362e8112a6ab5e186b2f2316b789ce54dfcc1d6006e125d5608329658.jpg)
223
+ Figure 4: Plots of the sum of the binary reconstruction loss and the KL divergence as a function of the number of epochs (lower is better). (Left) Discrete 10-subset VAE trained with I-MLE with $\lambda = 1 0$ (I-MLE). (Center) Discrete 10-subset VAE trained with the straight-through estimator (STE). (Right) Discrete 1-subset VAE using the Gumbel softmax trick (GSMT). The down-up-down artifact is due to temperature annealing. Sum-of-Gamma (SoG) perturbations have the lowest test loss for the 10-subset VAEs. For $\bar { \lambda } = 1 0$ and SoG perturbations, the test loss is similar to that of the categorical (1-subset) VAE trained with the Gumbel softmax trick.
224
+
225
+ STE, which does not work in this setting and is competitive with the Gumbel-Softmax trick for the 1-subset (categorical) distribution where marginals can be computed in closed form.
226
+
227
+ Differentiating through Combinatorial Solvers. In these experiments, proposed by Poganciˇ c´ et al. [2019], the training datasets consists of 10,000 examples of randomly generated images of terrain maps from the Warcraft II tile set [Guyomarch, 2017]. Each example has an underlying $K \times K$ grid whose cells represent terrains
228
+
229
+ Table 2: Results for the Warcraft shortest path task. Reported is the accuracy, i.e. percentage of paths with the optimal costs. Standard deviations are over five runs.
230
+
231
+ <table><tr><td>K</td><td>I-MLE (μ-μ)</td><td>I-MLE (M-M)</td><td>BB</td><td>DPO</td></tr><tr><td>12</td><td>97.2 ± 0.5</td><td>95.2± 0.3</td><td>95.2 ± 0.7</td><td>94.8 ± 0.3</td></tr><tr><td>18</td><td>95.8±0.7</td><td>94.4± 0.5</td><td>94.7 ± 0.4</td><td>92.3± 0.8</td></tr><tr><td>24</td><td>94.3 ± 1.0</td><td>93.2 ± 0.2</td><td>93.8 ± 0.3</td><td>91.5 ± 0.4</td></tr><tr><td>30</td><td>93.6 ± 0.4</td><td>93.7 ± 0.6</td><td>93.6 ± 0.5</td><td>91.5 ± 0.8</td></tr></table>
232
+
233
+ with a fixed cost. The shortest (minimum cost) path between the top-left and bottom-right cell in the grid is encoded as an indicator matrix and serves as the target output. An image of the terrain map is presented to a CNN, which produces a $K \times K$ matrix of vertex costs. These costs are then given to Dijkstra’s algorithm (the MAP solver) to compute the shortest path. We closely follow the evaluation protocol of Poganciˇ c et al. [2019]. We considered two instantiations of ´ I-MLE: one derived from Fact 1 (M-M in Table 2) using $\ell _ { H }$ and one derived from Fact 2 $( \pmb { \mu } \mathbf { - } \pmb { \mu } )$ using $\ell _ { R }$ , with $\rho ( \epsilon ) = \mathrm { S o G } ( k , 1 , 1 0 )$ where $k$ is the empirical mean of the path lengths (different for each grid size $K _ { \cdot }$ ). We compare with the method proposed by Poganciˇ c et al. [2019]´ $( \mathrm { B B } ^ { 1 0 } )$ and Berthet et al. [2020] (DPO). The results are listed in Table 2. I-MLE obtains results comparable to (BB) with M-M and is more accurate with $\pmb { \mu } \mathbf { - } \pmb { \mu }$ . We believe that the $\pmb { \mu } \mathbf { - } \pmb { \mu }$ advantage may be partially due to an implicit form of data augmentation since we know from Fact 2 that, by using I-MLE, we obtain samples from the distribution whose parameters are the optimal cost. Training dynamics, showing faster convergence of I-MLE $( \pmb { \mu } \mathbf { - } \pmb { \mu } )$ , and additional details are available in Table 4.
234
+
235
+ # 7 Conclusions
236
+
237
+ I-MLE is an efficient, simple-to-implement, and general-purpose framework for learning hybrid models. I-MLE is competitive with relaxation-based approaches for discrete latent-variable models and with approaches to backpropagate through CO solvers. Moreover, we showed empirically that I-MLE outperforms the straight-through estimator. A limitation of the work is its dependency on computing MAP states which is, in general, an NP-hard problem (although for many interesting cases there are efficient algorithms). Future work includes devising target distributions when $\nabla _ { z } L$ is not available, studying the properties (including the bias) of the proposed estimator, developing adaptive strategies for $\tau$ and $\lambda$ , and integrating and testing I-MLE in several challenging application domains.
238
+
239
+ # References
240
+
241
+ A. Agrawal, B. Amos, S. Barratt, S. Boyd, S. Diamond, and Z. Kolter. Differentiable convex optimization layers. arXiv preprint arXiv:1910.12430, 2019.
242
+ B. Amos and J. Z. Kolter. Optnet: Differentiable optimization as a layer in neural networks. In International Conference on Machine Learning, pages 136–145. PMLR, 2017.
243
+ Y. Bengio, N. Léonard, and A. Courville. Estimating or propagating gradients through stochastic neurons for conditional computation. arXiv preprint arXiv:1308.3432, 2013.
244
+ Y. Bengio, A. Lodi, and A. Prouvost. Machine learning for combinatorial optimization: a methodological tour d’horizon. European Journal of Operational Research, 2020.
245
+ Q. Berthet, M. Blondel, O. Teboul, M. Cuturi, J. Vert, and F. R. Bach. Learning with differentiable pertubed optimizers. In NeurIPS, 2020.
246
+ J. Chen, L. Song, M. Wainwright, and M. Jordan. Learning to explain: An information-theoretic perspective on model interpretation. In International Conference on Machine Learning, pages 883–892. PMLR, 2018.
247
+ X. Chen, Y. Zhang, C. Reisinger, and L. Song. Understanding deep architecture with reasoning layer. Advances in Neural Information Processing Systems, 33, 2020.
248
+ G. M. Correia, V. Niculae, W. Aziz, and A. F. Martins. Efficient marginalization of discrete and structured latent variables via sparsity. Advances in Neural Information Processing Systems, 2020.
249
+ J. Domke. Implicit differentiation by perturbation. In Advances in Neural Information Processing Systems 23, pages 523–531. 2010.
250
+ J. Domke. Generic methods for optimization-based modeling. In Artificial Intelligence and Statistics, pages 318–326. PMLR, 2012.
251
+ P. L. Donti, B. Amos, and J. Z. Kolter. Task-based end-to-end model learning in stochastic optimization. Advances in Neural Information Processing Systems, 2017.
252
+ A. N. Elmachtoub and P. Grigas. Smart “predict, then optimize", 2020.
253
+ R. Evans and E. Grefenstette. Learning explanatory rules from noisy data. Journal of Artificial Intelligence Research, 61:1–64, 2018.
254
+ A. Ferber, B. Wilder, B. Dilkina, and M. Tambe. Mipaal: Mixed integer program as a layer. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 1504–1511, 2020.
255
+ L. Franceschi, P. Frasconi, S. Salzo, R. Grazzi, and M. Pontil. Bilevel programming for hyperparameter optimization and meta-learning. In International Conference on Machine Learning, pages 1568–1577. PMLR, 2018.
256
+ L. Franceschi, M. Niepert, M. Pontil, and X. He. Learning discrete structures for graph neural networks. In International conference on machine learning, pages 1972–1982. PMLR, 2019.
257
+ W. Grathwohl, D. Choi, Y. Wu, G. Roeder, and D. Duvenaud. Backpropagation through the void: Optimizing control variates for black-box gradient estimation. ICLR, 2018.
258
+ A. Grover, E. Wang, A. Zweig, and S. Ermon. Stochastic optimization of sorting networks via continuous relaxations. arXiv preprint arXiv:1903.08850, 2019.
259
+ J. Guyomarch. Warcraft II Open-Source Map Editor. http://github.com/war2/war2edit, 2017.
260
+ D. Hafner, T. Lillicrap, M. Norouzi, and J. Ba. Mastering atari with discrete world models. arXiv preprint arXiv:2010.02193, 2020.
261
+ T. Hazan and T. Jaakkola. On the partition function and random maximum a-posteriori perturbations. In Proceedings of the 29th International Coference on International Conference on Machine Learning, pages 1667–1674, 2012.
262
+ K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In CVPR, pages 770–778. IEEE Computer Society, 2016.
263
+ E. Jang, S. Gu, and B. Poole. Categorical reparameterization with gumbel-softmax. ICLR, 2017.
264
+ N. L. Johnson and N. Balakrishnan. Advances in the theory and practice of statistics, 1998.
265
+ C. Kim, A. Sabharwal, and S. Ermon. Exact sampling with integer linear programs and random perturbations. In Thirtieth AAAI Conference on Artificial Intelligence, 2016.
266
+ W. Kool, H. van Hoof, and M. Welling. Estimating gradients for discrete random variables by sampling without replacement. ICLR, 2020.
267
+ Y. LeCun, S. Chopra, R. Hadsell, M. Ranzato, and F. Huang. A tutorial on energy-based learning. Predicting structured data, 1(0), 2006.
268
+ T. Lei, R. Barzilay, and T. Jaakkola. Rationalizing neural predictions. In EMNLP, 2016.
269
+ R. Liu, J. Regier, N. Tripuraneni, M. Jordan, and J. Mcauliffe. Rao-blackwellized stochastic gradients for discrete distributions. In International Conference on Machine Learning, pages 4023–4031. PMLR, 2019.
270
+ G. Lorberbom, A. Gane, T. Jaakkola, and T. Hazan. Direct optimization through argmax for discrete variational auto-encoder. In Advances in Neural Information Processing Systems, pages 6203–6214, 2019.
271
+ C. J. Maddison, A. Mnih, and Y. W. Teh. The concrete distribution: A continuous relaxation of discrete random variables. ICLR, 2017.
272
+ J. Mandi and T. Guns. Interior point solving for lp-based prediction+optimisation. In Advances in Neural Information Processing Systems, 2020.
273
+ J. Mandi, E. Demirovic, P. J. Stuckey, and T. Guns. Smart predict-and-optimize for hard combina- ´ torial optimization problems. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 1603–1610, 2020.
274
+ D. A. McAllester, T. Hazan, and J. Keshet. Direct loss minimization for structured prediction. In Advances in Neural Information Processing Systems, volume 1, page 3, 2010.
275
+ J. McAuley, J. Leskovec, and D. Jurafsky. Learning attitudes and attributes from multi-aspect reviews. 2012 IEEE 12th International Conference on Data Mining, pages 1020–1025, 2012.
276
+ V. V. Mišic and G. Perakis. Data analytics in operations management: A review. ´ Manufacturing & Service Operations Management, 22(1):158–169, 2020.
277
+ C. Mortici. Fast convergences towards Euler-Mascheroni constant. Computational & Applied Mathematics, 29, 00 2010.
278
+ K. P. Murphy. Machine learning: a probabilistic perspective. MIT press, 2012.
279
+ V. Niculae and A. F. T. Martins. Lp-sparsemap: Differentiable relaxed optimization for sparse structured prediction. In ICML, 2020.
280
+ V. Niculae, A. F. T. Martins, M. Blondel, and C. Cardie. Sparsemap: Differentiable sparse structured inference. In ICML, 2018.
281
+ G. Papandreou and A. L. Yuille. Perturb-and-map random fields: Using discrete optimization to learn and sample from energy models. In 2011 International Conference on Computer Vision, pages 193–200, 2011.
282
+ M. B. Paulus, D. Choi, D. Tarlow, A. Krause, and C. J. Maddison. Gradient estimation with stochastic softmax tricks. arXiv preprint arXiv:2006.08063, 2020.
283
+ M. V. Poganciˇ c, A. Paulus, V. Musil, G. Martius, and M. Rolinek. Differentiation of blackbox ´ combinatorial solvers. In International Conference on Learning Representations, 2019.
284
+ L. D. Raedt, K. Kersting, S. Natarajan, and D. Poole. Statistical relational artificial intelligence: Logic, probability, and computation. Synthesis Lectures on Artificial Intelligence and Machine Learning, 10(2):1–189, 2016.
285
+ M. Rolínek, P. Swoboda, D. Zietlow, A. Paulus, V. Musil, and G. Martius. Deep graph matching via blackbox differentiation of combinatorial solvers. In ECCV, 2020.
286
+ J. Schulman, N. Heess, T. Weber, and P. Abbeel. Gradient estimation using stochastic computation graphs. In Proceedings of the 28th International Conference on Neural Information Processing Systems-Volume 2, pages 3528–3536, 2015.
287
+ T. Shpakova and F. Bach. Parameter learning for log-supermodular distributions. In Advances in Neural Information Processing Systems, volume 29, pages 3234–3242, 2016.
288
+ Y. Song, A. Schwing, R. Urtasun, et al. Training deep neural networks via direct loss minimization. In International Conference on Machine Learning, pages 2169–2177, 2016.
289
+ G. Tucker, A. Mnih, C. J. Maddison, D. Lawson, and J. Sohl-Dickstein. Rebar: Low-variance, unbiased gradient estimates for discrete latent variable models. Advances in Neural Information Processing Systems, 2017.
290
+ M. J. Wainwright and M. I. Jordan. Graphical models, exponential families, and variational inference. Now Publishers Inc, 2008.
291
+ P.-W. Wang, P. Donti, B. Wilder, and Z. Kolter. Satnet: Bridging deep learning and logical reasoning using a differentiable satisfiability solver. In International Conference on Machine Learning, pages 6545–6554. PMLR, 2019.
292
+ B. Wilder, B. Dilkina, and M. Tambe. Melding the data-decisions pipeline: Decision-focused learning for combinatorial optimization. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 1658–1665, 2019.
293
+ Xi’an. Which pdf of x leads to a gumbel distribution of the finite-size average of $\mathbf { \boldsymbol { x } } \mathrm { ? }$ Cross Validated, 2016. URL https://stats.stackexchange.com/q/214875. URL:https://stats.stackexchange.com/q/214875 (version: 2016-05-27).
294
+ S. M. Xie and S. Ermon. Reparameterizable subset sampling via continuous relaxations. In IJCAI, 2019.
md/train/r1l1myStwr/r1l1myStwr.md ADDED
@@ -0,0 +1,528 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CONTINUOUS META-LEARNING WITHOUT TASKS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Meta-learning is a promising strategy for learning to efficiently learn within new tasks, using data gathered from a distribution of tasks. However, the meta-learning literature thus far has focused on the task segmented setting, where at train-time, offline data is assumed to be split according to the underlying task, and at test-time, the algorithms are optimized to learn in a single task. In this work, we enable the application of generic meta-learning algorithms to settings where this task segmentation is unavailable, such as continual online learning with a time-varying task. We present meta-learning via online changepoint analysis (MOCA), an approach which augments a meta-learning algorithm with a differentiable Bayesian changepoint detection scheme. The framework allows both training and testing directly on time series data without segmenting it into discrete tasks. We demonstrate the utility of this approach on a nonlinear meta-regression benchmark as well as two meta-image-classification benchmarks.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Meta-learning methods have recently shown promise as an effective strategy for enabling efficient few-shot learning in complex domains from image classification to nonlinear regression (Finn et al., 2017; Snell et al., 2017). These methods leverage an offline meta-training phase, in which they use data from a distribution of tasks to optimize learning performance on new tasks. These algorithms have focused on settings with task segmentation, where the learning agent knows when tasks change. At meta-train time, these algorithms assume access to a meta-dataset of datasets from individual tasks, and at meta-test time, the learner is evaluated on a single task. However, there are many applications where task segmentation is unavailable, which have thus far been under-addressed in the meta-learning literature. For example, consider a robot which must learn to adapt to a changing environment. The robot may switch from one environment to another during the course of deployment, and these task switches may not be directly observed. Furthermore, using an existing time series from interaction to craft a meta-dataset may require a difficult or expensive process of detecting switches in task.
12
+
13
+ In this work, we aim to enable meta-learning in task-unsegmented settings, operating directly on time series in which the latent task undergoes discrete, unobserved switches, rather than requiring a pre-segmented meta-dataset. Equivalently, this problem can be viewed from the perspective of continual learning, in that we apply the meta-learning approach to the standard online learning problem statement wherein an agent must sequentially make predictions and learn with a potentially varying latent data generating process. To accomplish this, we integrate a Bayesian changepoint estimation scheme with existing meta-learning approaches, allowing the algorithm to reason about whether or not the task has changed in a time series. Thus, we enable a standard meta-learning algorithm, which is designed for the task segmented setting, to be both trained and tested directly on time series data without the need for task segmentation.
14
+
15
+ Contributions. The primary contribution of this work is an algorithmic framework for task unsegmented meta-learning which we refer to as meta-learning via online changepoint analysis (MOCA). MOCA wraps arbitrary meta-learning algorithms in a differentiable changepoint estimation algorithm, enabling application of meta-learning algorithms directly to problems in the continuous learning setting. By backpropagating through the changepoint estimation framework, MOCA learns both a rapidly adaptive underlying predictive model (in the form of the meta-learning model), as well as an effective changepoint detection algorithm. MOCA is a generic framework which can be paired with many existing meta-learning algorithms. We demonstrate the performance of MOCA on both regression and classification settings with unobserved task switches.
16
+
17
+ # 2 PROBLEM STATEMENT
18
+
19
+ Our goal is to apply meta-learning tools to the problem of task-unsegmented continual learning, in which an agent is presented sequentially with input $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ , asked to make a (probabilistic) prediction $p ( \hat { y } _ { t } \mid x _ { t } )$ , and is then given the true label ${ \mathbf { } } _ { \mathbf { } } \mathbf { \mathbf { } } _ { \mathbf { } } \mathbf { \mathbf { } } _ { \mathbf { } } \mathbf { \mathbf { } } _ { \mathbf { } } \mathbf { \mathbf { } } _ { \mathbf { } } \mathbf { \mathbf { } } _ { \mathbf { } } \mathbf { \mathbf { } } _ { \mathbf { } } \mathbf { \mathbf { } } _ { \mathbf { } } \mathbf { \Xi } _ { \mathbf { } } \mathbf { \Lambda } _ { \mathbf { } } \mathbf { \Lambda } _ { \mathbf { } } \textbf { } _ { \mathbf { } } \textbf { } \textbf { } _ { \mathrm { } }$ , and can thus ideally improve its predictions by learning from the labeled examples. Following the terminology of meta-learning, we assume that these data are drawn from a distribution according to some latent task $\mathcal { T } _ { t }$ , $p ( \pmb { x } _ { t } , \mathbf { \bar { y } } _ { t } \mid \mathcal { T } _ { t } ) = p ( \pmb { x } _ { t } \mid$ $\mathcal { T } _ { t } ) p ( \pmb { y } _ { t } \mid \pmb { x } _ { t } , \mathcal { T } _ { t } )$ . We will write $x , y \sim \ T _ { t }$ as shorthand for $\boldsymbol { x } , \boldsymbol { y } \sim p ( \boldsymbol { x } , \boldsymbol { y } \mid \mathcal { T } _ { t } )$ . We assume a distribution over tasks, which we write $p ( \mathcal { T } )$ , and that the initial task $\mathcal { T } _ { 1 } \sim p ( \mathcal { T } )$ . At each timestep, the task is re-sampled from $p ( \tau )$ with some probability $\lambda$ (which we refer to as the hazard rate), or remains the same.
20
+
21
+ Our goal is to optimize a learning agent to perform well in this setting. Let $p _ { \pmb { \theta } } ( \hat { \pmb { y } } _ { t } \mid \pmb { x } _ { 1 : t } , \pmb { y } _ { 1 : t - 1 } )$ by the agent’s prediction for ${ \mathbf { } } _ { \pmb { y } _ { t } }$ given input $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ and the past labeled examples. We will evaluate the learner’s performance through a negative log likelihood loss, and our objective is as follows:
22
+
23
+ $$
24
+ \begin{array} { r l } { \underset { \theta } { \mathrm { m i n } } } & { \mathbb { E } \left[ \displaystyle \sum _ { t = 1 } ^ { \infty } - \log p _ { \theta } ( y _ { t } \mid x _ { 1 : t } , y _ { 1 : t - 1 } ) \right] } \\ { \mathrm { s u b j e c t ~ t o } } & { x _ { t } , y _ { t } \sim \mathcal { T } _ { t } , \quad \mathcal { T } _ { t } = \left\{ \mathcal { T } _ { t , \mathrm { n e w } } \right. \mathrm { ~ w . p . ~ } 1 - \lambda } \\ & { \mathcal { T } _ { 1 } \sim p ( \mathcal { T } ) , \quad \mathcal { T } _ { t , \mathrm { n e w } } \sim p ( \mathcal { T } ) } \end{array}
25
+ $$
26
+
27
+ We assume that we have access to a representative time series generated in the same manner from the same distribution of tasks, and use this time series to optimize $\pmb \theta$ in an offline, meta-training phase. Critically, however, in stark contrast to standard meta-learning approaches, we do not assume access to task segmentation, i.e. that this offline data is pre-grouped by latent parameter $\tau$ . Moreover, we highlight that we consider the case of individual data points provided sequentially, in contrast to the common $^ { 6 6 } k$ -shot, $n$ -way” problem setting prevalent in few-shot learning (especially classification). Our setting may easily be extended to the setting in which multiple data points are observed simultaneously.
28
+
29
+ # 3 PRELIMINARIES
30
+
31
+ # 3.1 META-LEARNING
32
+
33
+ We begin by presenting a unified perspective on meta-learning in the task-segmented setting, which allows straightforward presentation of the algorithms used in this work as well as generalization to the task-unsegmented case. The core idea of meta-learning is to directly optimize the few-shot learning performance of a machine learning model over a distribution of learning tasks, rather than just a single task, with the goal of this learning performance generalizing to other tasks from this distribution.
34
+
35
+ A meta-learning method consists of two phases: meta-training and online adaptation. Let $\pmb { \theta }$ be the parameters of this model learned via meta-training. During online adaptation, the model uses context data $\mathcal { D } _ { t } = ( \boldsymbol { \mathbf { \mathit { x } } } _ { 1 : t } , \boldsymbol { \mathbf { \mathit { y } } } _ { 1 : t } )$ from within one task to compute statistics
36
+
37
+ $$
38
+ \eta _ { t } = f _ { \theta } ( \mathcal { D } _ { t } )
39
+ $$
40
+
41
+ where $f$ is a function parameterized by $\pmb { \theta }$ . For example, in MAML (Finn et al., 2017), the statistics are the neural network weights after gradient updates computed using $\mathcal { D } _ { t }$ . In neural processes (Garnelo et al., 2018), the statistics are the aggregated context parameters computed via encoding and aggregating the context data. For recurrent network-based meta-learning algorithms, these statistics correspond to the hidden state of the network. For a simple nearest-neighbors model, $\eta$ may simply be the context data. The model then performs predictions by using these statistics to define a conditional distribution on $\textbf { { y } }$ given new inputs $_ { \textbf { \em x } }$ ,
42
+
43
+ $$
44
+ \textbf { \textit { y } } | \textbf { \textit { x } } , \mathcal { D } _ { t } \sim p _ { \boldsymbol { \theta } } ( \textbf { \textit { y } } | \textbf { \textit { x } } , \eta _ { t } ) .
45
+ $$
46
+
47
+ Adopting a Bayesian perspective, we refer to $p _ { \pmb { \theta } } ( \pmb { y } \mid \pmb { x } , \pmb { \eta } _ { t } )$ as the posterior predictive distribution.
48
+
49
+ The performance of this model on this task can be evaluated by considering how well this posterior predictive distribution matches the true task data distribution,
50
+
51
+ $$
52
+ \mathcal { L } ( \mathcal { D } _ { t } , \pmb { \theta } ) = D ( p ( \pmb { y } \mid \pmb { x } , \mathcal { T } _ { i } ) | | p _ { \pmb { \theta } } ( \pmb { y } \mid \pmb { x } , f _ { \pmb { \theta } } ( \mathcal { D } _ { t } ) ) )
53
+ $$
54
+
55
+ where $D$ is a measure of the dissimilarity of the two distributions, e.g. the KL divergence, for which this objective becomes standard negative log likelihood minimization.
56
+
57
+ Meta-learning optimizes the parameters $\pmb \theta$ such that the model performs well across a distribution of tasks,
58
+
59
+ $$
60
+ \operatorname* { m i n } _ { \pmb { \theta } } \ \mathbb { E } _ { \mathcal { T } _ { i } \sim p ( \mathcal { T } ) } \left[ \mathbb { E } _ { \mathcal { D } _ { t } \sim \mathcal { T } _ { i } } \left[ \mathcal { L } ( \mathcal { D } _ { t } , \pmb { \theta } ) \right] \right] .
61
+ $$
62
+
63
+ Across most meta-learning algorithms, including all of those referenced above, both the update rule and the prediction function are chosen to be differentiable operations, such that the parameters can be optimized via stochastic gradient descent. Given a dataset pre-segmented into groups of data from individual tasks, standard meta-learning algorithms operate via first sampling a group for which $\tau$ is fixed, treating part of that group as the context data $\mathcal { D } _ { t } ^ { \mathrm { ~ \scriptsize ~ 1 ~ } }$ and sampling from the remainder to obtain test points $( { \pmb x } , { \pmb y } ) $ from the same task. While this strategy can be very effective and produce expressive models that are capable of few-shot learning in complex domains, it relies on task segmentation which in many settings, especially continual learning, is not easily available.
64
+
65
+ # 3.2 BAYESIAN ONLINE CHANGEPOINT DETECTION
66
+
67
+ To enable meta-learning without task segmentation, we extend prior work in changepoint detection. Specifically, we build on Bayesian online changepoint detection (Adams & MacKay, 2007), an approach for detecting changepoints (i.e. task switches) originally presented in a streaming unconditional density estimation context, which we review here.
68
+
69
+ BOCPD operates by maintaining a belief distribution over run lengths, i.e. how many of the past data points ${ \mathbf { } } _ { \mathbf { } } \mathbf { \mathbf { } } _ { \mathbf { } } \mathbf { \mathbf { } } _ { \mathbf { } } \mathbf { \mathbf { } } _ { \mathbf { } } \mathbf { \mathbf { } } _ { \mathbf { } } \mathbf { \mathbf { } } _ { \mathbf { } } \mathbf { \mathbf { } } _ { \mathbf { } } \mathbf { \mathbf { } } _ { \mathbf { } } \mathbf { \Xi } _ { \mathbf { } } \mathbf { \Lambda } _ { \mathbf { } } \mathbf { \Lambda } _ { \mathbf { } } \textbf { } _ { \mathbf { } } \textbf { } \textbf { } _ { \mathrm { } }$ correspond to the current task. At time $t$ , run length of $r _ { t } = \tau$ indicates that the task has switched $\tau$ timesteps ago, i.e. $\mathcal { D } _ { - \tau } = \pmb { y } _ { t - \tau : t }$ are all drawn from a shared task $\tau$ . A belief that $r _ { t } = 0$ implies that there has been a task switch, and that the current datapoint ${ \mathbf { } } _ { \mathbf { } } \mathbf { \psi } _ { \mathbf { } } \mathbf { _ { } } \mathbf { \psi } _ { \mathbf { } } \mathbf { _ { } } \mathbf { \psi } _ { \mathbf { } } \mathbf { _ { } } \mathbf { \psi } _ { \mathbf { } } \mathbf { _ { } } \mathbf { \psi } _ { \mathbf { } } \mathbf { _ { } } \mathbf { \psi } _ { \mathbf { } } \mathbf { _ { } } \mathbf { \psi } _ { \mathbf { } \psi } \mathbf { _ { } } \textbf { } \psi _ { } \psi _ { } \left. \textbf { } \psi _ { } \mathbf { } \psi _ { } \textbf { } \right.$ was drawn from a new task $\bar { \mathcal { T } } ^ { \prime } \sim p ( \mathcal { T } )$ . We denote this belief distribution at time $t$ as $b _ { t } ( r _ { t } ) \bar { ( r _ { t } ) } = p ( r _ { t } \mid \pmb { y } _ { 1 : t - 1 } )$ .
70
+
71
+ Given $r _ { t }$ , we know the past $r _ { t }$ data points all correspond to the same task, and thus the density $p ( \pmb { y } _ { t } \ | \ \pmb { y } _ { 1 : t - 1 } , r _ { t } )$ corresponds to the posterior predictive density after conditioning on the past $r _ { t }$ data points. We can reason about the overall posterior predictive by marginalizing over the run length $r _ { t }$ according to $b _ { t } ( \boldsymbol { r } _ { t } )$ ,
72
+
73
+ $$
74
+ p ( { \pmb y } _ { t } \mid { \pmb y } _ { 1 : t - 1 } ) = \sum _ { r _ { t } = 0 } ^ { t - 1 } p ( { \pmb y } _ { t } \mid { \pmb y } _ { 1 : t - 1 } , r _ { t } ) b _ { t } ( r _ { t } ) ,
75
+ $$
76
+
77
+ where $p ( \mathbf { \mathscr { y } } _ { t } \mid \mathbf { \mathscr { y } } _ { 1 : t - 1 } , r _ { t } )$ is referred to as the underlying predictive model (UPM). BOCPD recursively computes posterior predictive densities for each value of $r _ { t } \in \{ 0 , \ldots , t - 1 \}$ , and then evaluates new datapoints $\mathbf { \pmb { y } } _ { t + 1 }$ under these posterior predictive densities to update the belief distribution $b ( r _ { t } )$ . In this work, we extend this approach of Adams & MacKay (2007) beyond Bayesian unconditional density estimation to apply to general meta-learning models operating in the conditional density estimation setting, and derive these update rules in more detail for our context.
78
+
79
+ # 4 META-LEARNING VIA ONLINE CHANGEPOINT ANALYSIS
80
+
81
+ MOCA uses Bayesian changepoint detection to enable the application of meta-learning algorithms to settings without task segmentation, both at train and test time. Specifically, we extend BOCPD to derive a recursive Bayesian filtering algorithm for run length in the conditional and joint density estimation setting, and leverage a base meta-learning algorithm with parameters $\pmb \theta$ to provide an underlying predictive model when conditioned on a run length. In the following subsections, we first derive MOCA’s Bayesian filtering updates, and then outline how the full framework can be used to both train and evaluate meta-learning models on time series without task segmentation.
82
+
83
+ # 4.1 BAYESIAN RUN-LENGTH FILTERING
84
+
85
+ As in BOCPD, MOCA maintains a belief over possible run lengths $r _ { t }$ . Throughout this paper, we use $b _ { t }$ to refer to the updated belief before observing data at that timestep, $( \pmb { x } _ { t } , \bar { \pmb { y } } _ { t } )$ . Note that $b _ { t }$ is a discrete distribution with support over $r _ { t } \in \{ 0 , . . . , \bar { t } - 1 \}$ .
86
+
87
+ At time $t$ , the agent first observes the input $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ , then makes a prediction $p ( { \pmb y } _ { t } \mid { \pmb x } _ { 1 : t } , { \pmb y } _ { 1 : t - 1 } )$ , and subsequently observes ${ \mathbf { } } _ { \pmb { y } _ { t } }$ . Generally, the latent task can influence both the marginal distribution of the input, $p \big ( { \pmb x } _ { t } \ | \ x _ { 1 : t - 1 } , { \pmb y } _ { 1 : t - 1 } \big )$ as well as the conditional distribution $p ( { \pmb y } _ { t } \mid { \bar { \pmb x } } _ { 1 : t } , { \pmb y } _ { 1 : t - 1 } )$ . Thus, the agent can update its belief over run lengths once after observing the input $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ , and again after observing the label ${ \mathbf { } } _ { \pmb { y } _ { t } }$ . We will use $b _ { t } ( r _ { t } \mid \bar { \mathbf { x } _ { t } } ) = p ( r _ { t } \mid \mathbf { x } _ { 1 : t } , \pmb { y } _ { 1 : t - 1 } )$ to represent the updated belief over run length after observing only $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ , and $b _ { t } ( r _ { t } \mid \pmb { x } _ { t } , \pmb { y } _ { t } ) = p ( r _ { t } \mid \pmb { x } _ { 1 : t } , \pmb { y } _ { 1 : t } )$ to represent the fully updated belief over $r _ { t }$ after observing $\mathbf { \mathscr { y } } _ { t }$ . Finally, we will propagate this forward in time according to our assumptions on task dynamics to compute $\bar { b } _ { t + 1 } ( r _ { t + 1 } )$ , which is used in the subsequent timestep.
88
+
89
+ To derive the Bayesian update rules, we start by noting that the updated posterior is proportional to the joint density,
90
+
91
+ $$
92
+ \begin{array} { r l } & { b _ { t } ( r _ { t } \mid \pmb { x _ { t } } ) = p ( r _ { t } \mid \pmb { x _ { 1 : t } } , \pmb { y _ { 1 : t - 1 } } ) = Z ^ { - 1 } p ( r _ { t } , \pmb { x _ { t } } \mid \pmb { x _ { 1 : t - 1 } } , \pmb { y _ { 1 : t - 1 } } ) } \\ & { \qquad = Z ^ { - 1 } p ( \pmb { x _ { t } } \mid \pmb { x _ { 1 : t - 1 } } , \pmb { y _ { 1 : t - 1 } } , r _ { t } ) p ( r _ { t } \mid \pmb { x _ { 1 : t - 1 } } , \pmb { y _ { 1 : t - 1 } } ) } \\ & { \qquad = Z ^ { - 1 } p _ { \theta } ( \pmb { x _ { t } } \mid \pmb { \eta _ { t - 1 } } [ r _ { t } ] ) b _ { t } ( r _ { t } ) } \end{array}
93
+ $$
94
+
95
+ where the normalization constant $Z$ can be computed by summing over the finite support of $b _ { t - 1 } ( r _ { t } )$ . Importantly, this update requires $p _ { \pmb { \theta } } ( \mathbf { x } _ { t } \mid \mathbf { \eta } _ { \pmb { \eta } _ { t - 1 } } \mathbf { \bar { \phi } } _ { [ r _ { t } ] } )$ , the base meta-learning algorithm’s posterior predictive density over the inputs. Within classification, this density is available for generative models, and thus a generative approach is favorable to a discriminative approach within MOCA. In regression, it is uncommon to estimate the distribution of the independent variable. We take the same approach in this work and assume that $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ is independent of the task for regression problems, in which case $b _ { t } ( r _ { t } \mid \mathbf { x } _ { t } ) = b _ { t } ( r _ { t } )$ .
96
+
97
+ Next, upon observing ${ \mathbf { } } _ { \mathbf { } } \mathbf { \mathbf { } } _ { \mathbf { } } \mathbf { \mathbf { } } _ { \mathbf { } } \mathbf { \mathbf { } } _ { \mathbf { } } \mathbf { \mathbf { } } _ { \mathbf { } } \mathbf { \mathbf { } } _ { \mathbf { } } \mathbf { \mathbf { } } _ { \mathbf { } } \mathbf { \mathbf { } } _ { \mathbf { } } \mathbf { \Xi } _ { \mathbf { } } \mathbf { \Lambda } _ { \mathbf { } } \mathbf { \Lambda } _ { \mathbf { } } \textbf { } _ { \mathbf { } } \textbf { } \textbf { } _ { \mathrm { } }$ , we can similarly factor the belief over run lengths for the next timestep,
98
+
99
+ $$
100
+ b _ { t } ( r _ { t } \mid \mathbf { x } _ { t } , \pmb { y } _ { t } ) = Z ^ { - 1 } p _ { \theta } ( \pmb { y } _ { t } \mid \mathbf { x } _ { t } , \pmb { \eta } _ { t - 1 } [ r _ { t } ] ) b _ { t } ( r _ { t } \mid \pmb { x } _ { t } ) .
101
+ $$
102
+
103
+ Again, the normalization constant can be computed via a sum over the support of
104
+
105
+ Finally, we must propagate this belief forward in time to obtain $b _ { t + 1 } ( r _ { t + 1 } )$ :
106
+
107
+ $$
108
+ \begin{array} { l } { { b _ { t + 1 } ( r _ { t + 1 } ) = p ( r _ { t + 1 } \mid x _ { 1 : t } , y _ { 1 : t } ) = \displaystyle \sum _ { r _ { t } } p ( r _ { t + 1 } , r _ { t } \mid x _ { 1 : t } , y _ { 1 : t } ) } } \\ { { \ = \displaystyle \sum _ { r _ { t } } p ( r _ { t + 1 } \mid r _ { t } , x _ { 1 : t } , y _ { 1 : t } ) p ( r _ { t } \mid x _ { 1 : t } , y _ { 1 : t } ) = \displaystyle \sum _ { r _ { t } } p ( r _ { t + 1 } \mid r _ { t } ) b _ { t } ( r _ { t } \mid x _ { t } , y _ { t } ) . } } \end{array}
109
+ $$
110
+
111
+ where we have exploited the assumption that the changes in task, and hence the evolution of run length $r _ { t }$ , happen independently of the data generation process. The conditional run-length distribution $p ( r _ { t + 1 } \mid r _ { t } )$ is defined by our model of task evolution.
112
+
113
+ Recall that we assume that the task switches with fixed probability $\lambda$ , the hazard rate. Thus, for all $r _ { t } , p ( r _ { t + 1 } = 0 \mid r _ { t } ) = \lambda$ , implying
114
+
115
+ $$
116
+ b _ { t + 1 } ( r _ { t + 1 } = 0 ) = \sum _ { r _ { t } } \lambda b _ { t } ( r _ { t } \mid { x } _ { t } , y _ { t } ) = \lambda .
117
+ $$
118
+
119
+ Conditioned on the task remaining the same, $r _ { t + 1 } = k > 0$ and $r _ { t } = k - 1$ . Thus, $p ( r _ { t + 1 } = k \ |$ $r _ { t } ) = ( 1 - \lambda ) \mathbb { 1 } \{ r _ { t } = k - 1 \}$ implying
120
+
121
+ $$
122
+ b _ { t + 1 } ( r _ { t + 1 } = k ) = ( 1 - \lambda ) b _ { t } ( r _ { t } = k - 1 \mid x _ { t } , y _ { t } ) .
123
+ $$
124
+
125
+ Equations (5) and (6) together define $b _ { t + 1 }$ over its support $r _ { t + 1 } \in \{ 0 , \ldots , t \}$
126
+
127
+ # 4.2 META LEARNING WITHOUT TASK SEGMENTATION
128
+
129
+ By taking a Bayesian filtering approach to changepoint detection, we avoid hard assignments of changepoints and instead perform a soft selection over run lengths. In this way, MOCA is able to backpropagate through the changepoint detection and directly optimize the underlying predictive model, which may be any meta-learning model that admits a probabilistic interpretation.
130
+
131
+ MOCA processes a time series sequentially. We initialize $b _ { 1 } ( r _ { 1 } = 0 ) = 1$ , and initialize the posterior statistics for $\eta _ { 0 } [ r _ { 1 } = 0 ]$ as specified by the parameters $\pmb \theta$ of the meta learning algorithm. Then, at timestep $t$ , we first observe inputs $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ and update our belief over run length accordingly, computing $b _ { t } ( \boldsymbol { r } _ { t } \mid \mathbf { \hat { x } } _ { t } )$ according to (3). Next, we marginalize over this belief to make a probabilistic prediction for the label $\mathbf { \mathscr { y } } _ { t }$ ,
132
+
133
+ $$
134
+ p _ { \theta } \big ( \hat { y } _ { t } \mid x _ { 1 : t } , y _ { 1 : t - 1 } \big ) = \sum _ { r _ { t } = 0 } ^ { t - 1 } b _ { t } \big ( r _ { t } \mid x _ { t } \big ) p _ { \theta } \big ( \hat { y } _ { t } \mid x _ { t } , \eta _ { t - 1 } [ r _ { t } ] \big )
135
+ $$
136
+
137
+ We then observe the true label ${ \mathbf { } } _ { \mathbf { } } \mathbf { \mathbf { } } _ { \mathbf { } } \mathbf { \mathbf { } } _ { \mathbf { } } \mathbf { \mathbf { } } _ { \mathbf { } } \mathbf { \mathbf { } } _ { \mathbf { } } \mathbf { \mathbf { } } _ { \mathbf { } } \mathbf { \mathbf { } } _ { \mathbf { } } \mathbf { \mathbf { } } _ { \mathbf { } } \mathbf { \Xi } _ { \mathbf { } } \mathbf { \Lambda } _ { \mathbf { } } \mathbf { \Lambda } _ { \mathbf { } } \textbf { } _ { \mathbf { } } \textbf { } \textbf { } _ { \mathrm { } }$ and incur the corresponding negative log likelihood loss. We can then use this observation to update both the belief over run length, computing $\boldsymbol { b } _ { t } \left( \boldsymbol { r } _ { t } ~ | ~ \boldsymbol { x } _ { t } , \boldsymbol { y } _ { t } \right)$
138
+
139
+ # Algorithm 1 Meta-Learning via Online Changepoint Analysis: Training
140
+
141
+ Require: Training data $\pmb { x } _ { 1 : n } , \pmb { y } _ { 1 : n }$ , number of training iterations $N$ , initial model parameters $\pmb { \theta }$
142
+ 1: for $i = 1$ to $N$ do
143
+ 2: Sample training batch $\pmb { x } _ { 1 : T } , \pmb { y } _ { 1 : T }$ from the full timeseries.
144
+ 3: Initialize belief over run length $b _ { 1 } ( r _ { 1 } = 0 ) = 1$
145
+ 4: Initialize posterior statistics $\eta _ { 0 } [ r = 0 ]$ according to $\pmb \theta$
146
+ 5: for $t = 1$ to $T$ do
147
+ 6: Observe $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$
148
+ 7: Compute $b _ { t } ( \boldsymbol { r } _ { t } \mid \boldsymbol { x } _ { t } )$ according to (3)
149
+ 8: Predict $p _ { \pmb { \theta } } \big ( \hat { \pmb { y } } _ { t } \mid \pmb { x } _ { 1 : t } , \pmb { y } _ { 1 : t - 1 } \big )$ according to (7)
150
+ 9: Observe yt
151
+ 10: Incur NLL loss $\ell _ { t } = - \log p _ { \pmb { \theta } } ( \pmb { y } _ { t } \mid \pmb { x } _ { 1 : t } , \pmb { y } _ { 1 : t - 1 } )$
152
+ 11: Compute updated posteriors $\eta _ { t } [ r _ { t } ]$ for all $r _ { t }$ according to (8)
153
+ 12: Compute $\hat { b _ { t } } ( r _ { t } \mid \boldsymbol { x } _ { t } ^ { \prime } , \boldsymbol { y } _ { t } )$ according to (4)
154
+ 13: Compute updated belief over run length $b _ { t + 1 }$ according to (6) and (5)
155
+ 14: 15: end forCompute $\begin{array} { r } { \nabla _ { \pmb { \theta } } \sum _ { t = k } ^ { k + T } \ell _ { t } } \end{array}$ and perform gradient descent update to $\pmb \theta$
156
+ 16: end for
157
+
158
+ according to (4), as well as update the posterior statistics for all the run lengths using the labeled example. A recursive update rule for $\eta$ allows these parameters to be computed efficiently using the past values of $\eta$
159
+
160
+ $$
161
+ \pmb { \eta } _ { t } [ r ] = h ( \pmb { x } _ { t } , \pmb { y } _ { t } , \pmb { \eta } _ { t - 1 } [ r - 1 ] ) \quad \forall \ r = 1 , \dots , t .
162
+ $$
163
+
164
+ While MOCA could be used with an algorithm which didn’t admit such a recursive update rule, this would require storing data online and running the non-recursive posterior computation (2) on $\mathcal { D } _ { - r _ { t } }$ for every $r _ { t }$ , which involves $t$ operations using datasets of sizes from 0 to $t$ , and thus can be an $O ( t ^ { 2 } )$ operation. In contrast, the recursive updates involve $t$ operations involving just the latest datapoint, yielding $O ( t )$ complexity. Finally, we propagate the belief over run length forward in time according to (5) and (6) to obtain $\bar { b _ { t } } ( r _ { t + 1 } )$ to be ready to process the next data point.
165
+
166
+ Since all these operations are differentiable, given a training time series in which there are task switches $\pmb { x } _ { 1 : n } , \pmb { y } _ { 1 : n }$ , we can run this procedure, sum the NLL losses incurred at each step, and use backpropagation within a standard deep learning framework to optimize the parameters of the base learning algorithm $\pmb \theta$ . Algorithm 1 outlines this training procedure. In practice, we sample shorter time-series of length $T$ from the training data to ease computational requirements during training; we discuss implications of this in the appendix. If available, a user can input various levels of knowledge on task segmentation by manually updating $b ( r _ { t } )$ at any time; further details on this task semi-segmented use case are provided in the appendix.
167
+
168
+ # 5 MAKING YOUR MOCA: MODEL INSTANTIATIONS
169
+
170
+ Thus far, we have presented MOCA at an abstract level, highlighting the fact that it can be used with any meta-learning model that admits the probabilistic interpretation as an underlying predictive model. However, there are several practical considerations in the choice of meta-learning algorithm which can influence the computational efficiency and overall performance of MOCA. For the experiments in this paper, we leverage two meta-learning algorithms which offer a clean Bayesian learning interpretation, relatively low-dimensional posterior statistics, recursive updates for these statistics, and computationally efficient likelihood evaluation under the posterior predictive. For regression experiments, we use ALPaCA (Harrison et al., 2018); for classification experiments, we use a novel algorithm based on similar Bayesian updates which we refer to as PCOC, for probabilistic clustering for online classification. For completeness, we offer a high level overview of these algorithms and show how they fit into the MOCA framework in the following subsections.
171
+
172
+ # 5.1 ALPACA: BAYESIAN META-LEARNING FOR REGRESSION
173
+
174
+ ALPaCA (Harrison et al., 2018) is a meta-learning approach for which the base learning model is Bayesian linear regression in a learned feature space $\pmb { y } \mid \pmb { x } \sim \mathcal { N } ( K ^ { T } \phi ( \pmb { x } , \pmb { w } ) , \Sigma _ { \epsilon } )$ where $\phi ( { \pmb x } , { \pmb w } )$ is a feed-forward neural network with weights $\pmb { w }$ mapping inputs $_ { \textbf { \em x } }$ to a $n _ { \phi }$ -dimensional feature space. ALPaCA maintains a matrix-normal distribution over $K$ , and thus, assuming Gaussian likelihood, results in a matrix-normal posterior distribution over $K$ . This posterior inference may be performed exactly, and computed recursively. The matrix-normal distribution on the last layer results in a Gaussian posterior predictive density.
175
+
176
+ We fix the prior $K \sim \mathcal { M N } ( \bar { K } _ { 0 } , \Sigma _ { \epsilon } , \Lambda _ { 0 } ^ { - 1 } )$ . In this matrix-normal prior, $\bar { K } _ { 0 } \in \mathbb { R } ^ { n _ { \phi } \times n _ { y } }$ is the prior mean and $\Lambda _ { 0 }$ is a $n _ { \phi } \times n _ { \phi }$ precision matrix (inverse of the covariance). Given this prior and data model, the posterior may be recursively computed as follows. First, we define $Q _ { t } = \Lambda _ { t } ^ { - 1 } \bar { K } _ { t }$ . Then, the one step posterior update is
177
+
178
+ $$
179
+ \Lambda _ { t + 1 } ^ { - 1 } = \Lambda _ { t } ^ { - 1 } - \frac { \overset { \cdot } { ( } \Lambda _ { t } ^ { - 1 } \phi ( { \pmb x } _ { t + 1 } ) ) ( \Lambda _ { t } ^ { - 1 } \phi ( { \pmb x } _ { t + 1 } ) ) ^ { T } } { 1 + \phi ^ { T } ( { \pmb x } _ { t + 1 } ) \Lambda _ { t } ^ { - 1 } \phi ( { \pmb x } _ { t + 1 } ) } \qquad Q _ { t + 1 } = y _ { t + 1 } \phi ^ { T } ( { \pmb x } _ { t + 1 } ) + Q _ { t }
180
+ $$
181
+
182
+ and the posterior predictive distribution is
183
+
184
+ $$
185
+ p _ { \theta } ^ { \ i } ( \hat { y } _ { t + 1 } \mid x _ { 1 : t + 1 } ^ { \ i } , y _ { 1 : t } ) = \mathcal N ( ( \Lambda _ { t } ^ { - 1 } Q _ { t } ) ^ { T } \phi ( x _ { t + 1 } ) , ( 1 + \phi ^ { T } ( x _ { t + 1 } ) \Lambda _ { t } ^ { - 1 } \phi ( x _ { t + 1 } ) ) \Sigma _ { \epsilon } ) .
186
+ $$
187
+
188
+ In summary, ALPaCA is a meta learning model for which the posterior statistics are $\begin{array} { r l } { \eta _ { t } } & { { } = } \end{array}$ $\{ Q _ { t } , \Lambda _ { t } ^ { - 1 } \}$ , and the recursive update rule $h ( x , y , \eta )$ is given by (9). The parameters that are meta-learned are the prior statistics, the feature network weights, and the noise covariance: $\theta =$ $\{ \bar { K } _ { 0 } , \Lambda _ { 0 } , { w } , \Sigma _ { \epsilon } \}$ . Note that, as is typical in regression, $\mathrm { { A L P a C A } }$ only models the conditional density $p ( \pmb { y } \mid \pmb { x } )$ , implicitly assuming that $p ( { \pmb x } )$ is independent of the underlying task.
189
+
190
+ # 5.2 PCOC: BAYESIAN META-LEARNING FOR CLASSIFICATION
191
+
192
+ In the classification setting, one can obtain a similar Bayesian meta-learning algorithm by performing Gaussian discriminant analysis in a learned feature space. This is a novel approach to metalearning for classification which we term probabilistic clustering for online classification (PCOC, pronounced “peacock”). We present a concise description of this algorithm here but defer to the appendix for a more detailed discussion.
193
+
194
+ In PCOC we process labeled input/class pairs $\left( { { \pmb x } _ { t } , y _ { t } } \right)$ by encoding the input through an embedding network $\pmb { z } _ { t } = \dot { \phi } ( \pmb { x } _ { t } ; \pmb { w } )$ , and performing Bayesian density estimation for every class. Specifically, we assume a Categorical-Gaussian generative model in this embedding space, and impose the conjugate Dirichlet prior over the class probabilities and a Gaussian prior over the mean for each class,
195
+
196
+ $$
197
+ y _ { t } \sim \mathrm { C a t } ( p _ { 1 } , . . . . , \mathbf { \hat { { p } } } _ { n _ { y } } )
198
+ $$
199
+
200
+ $$
201
+ p _ { 1 } , . . . , p _ { n _ { y } } \sim \mathrm { D i r } ( \pmb { \alpha } _ { 0 } ) .
202
+ $$
203
+
204
+ $$
205
+ z _ { t } \mid y _ { t } \sim \mathcal { N } ( \bar { z } _ { y _ { t } } , \Sigma _ { \epsilon , y _ { t } } ) ,
206
+ $$
207
+
208
+ $$
209
+ \tau _ { y _ { t } } \sim \mathcal { N } ( \mu _ { y _ { t } , 0 } , \Lambda _ { y _ { t } , 0 } ^ { - 1 } ) .
210
+ $$
211
+
212
+ Given labeled context data $( x _ { t } , y _ { t } )$ , the algorithm updates its belief over the Gaussian mean for the corresponding class, as well as its belief over the probability of each class. As with ALPaCA, these posterior computations can be performed through closed form recursive updates. Defining $\begin{array} { r } { \pmb q _ { i , t } = \Lambda _ { i , t } \pmb { \mu } _ { i , t } } \end{array}$ , we have
213
+
214
+ $$
215
+ \begin{array} { r } { { } _ { - 1 } + \mathbf { 1 } _ { y _ { t } } \qquad q _ { y _ { t } , t } = q _ { y _ { t } , t - 1 } + \Sigma _ { \epsilon , y _ { t } } \phi ( { \pmb x } _ { t } ) \qquad \Lambda _ { y _ { t } , t } = \Lambda _ { y _ { t } , t - 1 } + \Sigma _ { \epsilon , y _ { t } } \phi ( { \pmb x } _ { t } ) \qquad } \end{array}
216
+ $$
217
+
218
+ where ${ \bf 1 } _ { i }$ denotes a one-hot vector with a one at index $i$ . Terms not related to class $y _ { t }$ are left unchanged in this recursive update. Given this set of posterior parameters $\pmb { \eta } _ { t } = \{ \pmb { \alpha } _ { t } , \pmb { q } _ { 1 : J , t } , \pmb { \Lambda } _ { 1 : J , t } \}$ , the posterior predictive density in the embedding space can be computed as
219
+
220
+ $$
221
+ \dot { p ( y ) } = { \alpha _ { y , t } } / ( \sum _ { i = 1 } ^ { J } { { \alpha _ { i , t } } } ) \qquad \qquad \mathrm p ( z , y ) = p ( y ) \mathcal N ( z ; \Lambda _ { y , t } ^ { - 1 } q _ { y , t } , \Lambda _ { y , t } ^ { - 1 } + \Sigma _ { \epsilon , y } )
222
+ $$
223
+
224
+ where $\mathcal { N } ( z ; \mu , \Sigma )$ denotes the Gaussian pdf with mean $\mu$ and covariance $\Sigma$ evaluated at $_ z$ . Applying Bayes rule, the posterior predictive on $y _ { t + 1 }$ given ${ \pmb x } _ { t + 1 }$ is
225
+
226
+ $$
227
+ p ( y _ { t + 1 } = j \mid x _ { 1 : t + 1 } , y _ { 1 : t } ) = \frac { p ( z = \phi ( x _ { t } ) , y = j ) } { \sum _ { i = 1 } ^ { J } p ( z = \phi ( x _ { t } ) , y = i ) } .
228
+ $$
229
+
230
+ This generative modeling approach also allows computing $p ( z _ { t + 1 } \mid \eta _ { t } )$ by simply marginalizing out $y$ from the joint density of $\bar { p ( } z , y )$ ,
231
+
232
+ $$
233
+ p ( \boldsymbol { z } _ { t + 1 } \mid \boldsymbol { \eta } _ { t } ) = \sum _ { y = 1 } ^ { J } p ( y ) \mathcal { N } ( \boldsymbol { z } _ { t + 1 } ; \boldsymbol { \mu } _ { t } , \boldsymbol { \Lambda } _ { y , t } ^ { - 1 } + \boldsymbol { \Sigma } _ { \epsilon , y } )
234
+ $$
235
+
236
+ As this only depends on the input $_ { \textbf { \em x } }$ , we can use this likelihood within MOCA to update the run length belief upon seeing $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ and before predicting $\hat { y } _ { t }$ .
237
+
238
+ In summary, PCOC performs Bayesian Gaussian discriminant analysis for online classification, and meta-learns the parameters $\pmb { \theta } = \{ \pmb { \alpha } _ { 0 } , \pmb { q } _ { 1 : J , 0 } , \pmb { \Lambda } _ { 1 : J , 0 } , \pmb { w } , \Sigma _ { \epsilon , 1 : J } \}$ for efficient few-shot online classification. In practice, we assume that all the covariances are diagonal to limit memory footprint of the posterior parameters. PCOC can be thought of a Bayesian analogue of prototypical networks (Snell et al., 2017). Further details regarding PCOC can be found in the appendix.
239
+
240
+ # 6 RELATED WORK
241
+
242
+ Online Learning, Continuous Learning, and Concept Drift Adaptation. A substantial literature exists on online, continual and lifelong learning (Hazan, 2016; Chen & Liu, 2016). While these terms are often used interchangeably and inconsistently, they all roughly correspond to the problem of learning within a streaming series of tasks, wherein it is desirable to re-use information from previous tasks while avoiding negative transfer French (1999); Thrun & Pratt (2012). Typically, continual learning assumes access to task segmentation information, whereas online learning does not (Aljundi et al., 2019). Regularization approaches (Kirkpatrick et al., 2017; Hazan, 2016; Li & Hoiem, 2017) have been shown to be an effective method for avoiding forgetting in continual learning. By augmenting the loss function for a new task with a penalty for deviation from the parameters learned for previous tasks, the regularizing effects of a prior are mimicked; in contrast we explicitly learn a prior over task weights that is meta-trained to be rapidly adaptive. Thus, MOCA is capable of avoiding substantial negative transfer by detecting task change, and rapidly adapting to new tasks. Aljundi et al. (2019) loosen the assumption of task segmentation in continual learning and operate in a similar setting to that addressed herein, but their work still focuses on learning a single set of parameters that perform well on all tasks; in contrast, we operate in the meta-learning setting, aiming to learn parameters that accelerate online adaptation within a task.
243
+
244
+ Meta-Learning for Continuous and Online Learning. While continual learning techniques have mitigated forgetting in changing problem settings, large learning models have been slow to adapt to new tasks, due in part to the propensity of neural network models to overfit to small amounts of data. In response to this, there has been substantial interest in applying ideas from meta-learning to continual learning to enable rapid adaptation to new tasks. Indeed, some modern meta-learning models such as MAML (Finn et al., 2017) may be interpreted as regularization methods (Grant et al., 2018), wherein the regularization term is explicitly learned for fast adaptation. In the streaming data setting, several works (Nagabandi et al., 2019a; He et al., 2019) use a sliding window approach, wherein a small amount of recent data is used for conditioning. By not explicitly detecting task change and choosing the window length in response, these models risk suffering from negative transfer. Indeed, MOCA may be interpreted as an adaptive sliding window model, that actively infers the optimal window length. Nagabandi et al. (2019b) and Jerfel et al. (2019) aim to detect task changes via combining mean estimation of the dependent variable with MAML models. However, these models are both less expressive than MOCA (which maintains a full Bayesian posterior) and are not capable of task-unsegmented training. Instead, these models require pre-training with a meta-dataset that is segmented by task, limiting their applicability relative to MOCA.
245
+
246
+ Empirical Bayes for Changepoint Models. The Bayesian online changepoint framework of Adams & MacKay (2007) (which we leverage in this paper) and the similar, simultaneous work of Fearnhead & Liu (2007) have generated a substantial body of follow-on work since their publication. Due to the simplicity of these algorithms—in particular, the ability to compute closed-form posteriors as opposed to being forced to turn to approximate methods such as MCMC—many practical modifications and extensions have been developed. Of particular relevance are two works that investigate empirical Bayes for the underlying predictive model, which is a similar problem to that addressed herein. In particular, Paquet (2007) develop a forward-backward algorithm that allows closed-form max likelihood estimation of the prior for simple distributions via EM. Turner et al. (2009) derive general-purpose gradients for hyperparameter optimization within the BOCPD model. This approach is similar to our work, although we use neural network meta-learning models and rely on automatic differentiation for gradient computation.
247
+
248
+ # 7 EXPERIMENTAL RESULTS
249
+
250
+ We investigate the performance of MOCA in three problem settings: one in regression and two in classification. Our primary goal is to characterize the impact on performance of using MOCA to move from the standard task-segmented meta-learning setting to the task-unsegmented case. To this end, we investigate the performance of MOCA versus an “oracle” model that uses the same base meta-learning algorithm, but has access to exact task segmentation at train and test time. We additionally compare against baseline sliding window models of various window lengths, which again use the same meta-learning algorithm, but always condition on the last $n$ data points. These baselines are a competitive approach to learning in time-varying data streams (Gama et al., 2014) and have been used effectively for meta-learning in time-varying settings (see e.g. Nagabandi et al. (2019a)). Finally, we compare to a “train on everything” model, which only learns a prior and does not adapt online, corresponding to a standard supervised learning approach. Many problems that are currently addressed with standard supervised learning in fact have underlying temporal structure that is ignored, and thus this baseline model is a valuable point of comparison.
251
+
252
+ ![](images/cbdcafd29dedb12ebdc784ef282b741636583c254046810a514bcf193edabcfb.jpg)
253
+ Figure 1: The performance of MOCA on the sinusoid regression problem. Right: The belief over run length versus time. The intensity of each point in the plot corresponds to the belief in run length at the associated time. The red lines show the true changepoints. Left: Visualizations of the posterior predictive density corresponding to the blue dotted lines in the figure on the right. The red line denotes the current function (task), and red points denote samples from that function. Green points denote data from previous tasks, where more faint points are older. a) A visualization of the posterior at an arbitrary time. b) The visualization of the posterior for a case in which MOCA did not successfully detect the changepoint. In this case, it is because the pre- and postchange function (corresponding to figure a and b) are highly similar. c) An instance of a multimodal posterior. d) The changepoint is initially missed due to the data generated from the post-change function being highly likely under the previous posterior. e) After an unlikely data point, the model increases its uncertainty as the changepoint is detected.
254
+
255
+ In addition, we investigate in isolation the effects of task-segmentation information when provided at train-time and at test-time. To characterize the impact of test time segmentation, we train an oracle model and at test time, remove task segmentation and replace it with MOCA’s run length estimation. We then compare this to the oracle model tested with segmentation, so the only difference is availability of test-time segmentation. Similarly, to characterize the impact of train time segmentation, we provide a model trained using MOCA with task segmentation at test time and compare this to a the same MOCA model when tested without segmentation. Finally, we investigate the performance of MOCA under partial task segmentation. Due to space constraints, we defer this to the appendix. For sinusoid experiments, confidence intervals at $9 5 \%$ for three different models (trained with different random seeds). For Rainbow MNIST and miniImageNet, confidence intervals are $9 5 \%$ for five different models.
256
+
257
+ # 7.1 SINUSOID REGRESSION
258
+
259
+ To characterize MOCA in the regression setting, we investigate the performance on a switching sinusoid problem adapted from (Finn et al., 2017), in which a task change corresponds to a resampled sinusoid phase and amplitude. Qualitative results are visualized for the sinusoid in Fig. 1, as well as a visualization of the belief over run length at each time. Qualitatively, MOCA is capable of accurate and calibrated posterior inference with only a handful of data points, and is capable of identifying task change extremely rapidly. Typically, it identifies task change in one timestep, if the generated data does not happen to have high likelihood under the previous task as in Fig. 1d. Performance of MOCA versus baselines is presented in Fig. 2 for all problem domains. For sinusoid (left), MOCA achieves performance close to the oracle model and substantially outperforms the sliding window approaches for all hazard rates.
260
+
261
+ ![](images/a936a53d2e2578ab9e7206767e8c79bc465c2c78781cf95516130a74ef315f61.jpg)
262
+ Figure 2: Performance of MOCA versus baselines in sinusoid regression (left; lower is better), Rainbow MNIST (center; higher is better), and miniImageNet (right; higher is better), versus hazard rate. Note that for both problems, MOCA always outperforms the baselines and the performance degrades only slightly from the performance of the oracle. In contrast, sliding window methods result in severely degraded performance.
263
+
264
+ Fig. 3 shows the performance of MOCA when augmented with task segmentation at test time (violet), compared to unsegmented (blue), as well as the oracle model without test segmentation (teal) compared to with test segmentation (grey). We find that as the hazard rate increases, both the value of segmentation in training and value of segmentation at test time increases steadily. Because our regression version of MOCA is not performing density estimation for the independent variable, it is not able to detect a changepoint before incurring the loss associated with an incorrect prediction. Thus, for high changepoints, considerable loss is incurred, increasing the value of task segmentation. Interestingly and counter-intuitively, the model trained with MOCA outperforms the model trained with oracle supervision, when both are given oracle supervision at test time. The MOCA training results in a small “curriculum” effect due to the non-zero weight on placed on the prior for every training iteration; in comparison, for the oracle model, a missed prediction with a highly concentrated yet incorrect posterior occasionally results in a very large loss than may destabilize training. When the oracle model is trained with a small belief weight on the prior (even down to e.g. $1 0 ^ { - 1 6 ^ { \circ } }$ ), the performance matches the MOCA model. This suggests that MOCA may be beneficial in training by acting as a form of curriculum.
265
+
266
+ # 7.2 RAINBOW MNIST
267
+
268
+ In the classification setting, we apply MOCA to the Rainbow MNIST dataset of Finn et al. (2019). In this dataset, MNIST digits have been perturbed via a color transformation, rotation, and scaling, and each task corresponds to a unique combination of these transformations. MOCA approaches oracle performance for most hazard rates, likely due in part to the fact that task change can usually be detected via a change in digit color. Seven colors were used, and thus with probability $6 / \dot { 7 }$ , MOCA has a very strong indicator of task change.
269
+
270
+ In Fig. 3, the relative effect of the MOCA train and test is visible. For high hazard rates, as expected, MOCA at test time performs slightly worse than the oracle model. The majority of performance degradation is thus due to MOCA training. Performance degradation due to MOCA training is largest for this experiment, compared to the sinusoid and miniImageNet. Because the changing digit color results in a relatively clear indicator of changepoints, and MOCA performs a belief update based on both the image and the label, MOCA performs comparably to the oracle model at test time.
271
+
272
+ # 7.3 MINIIMAGENET
273
+
274
+ Finally, we investigate the performance of MOCA on the miniImageNet benchmark task (Vinyals et al., 2016). This dataset consists of 100 ImageNet categories (Deng et al., 2009), each with 600 RGB images of resolution $8 4 \times 8 4$ . In our continual learning setting, we associate each class with a semantic label that is consistent between tasks. Specifically, we split the miniImageNet dataset in to five approximately balanced high level classes, which we refer to as super-classes, as five-way classification is standard for miniImageNet (Vinyals et al., 2016; Snell et al., 2017). For example, one super-class is dog breeds, while another is food, kitchen and clothing items; details are provided in the appendix. Then, a new task corresponds to sampling a new class within each super-class, and the problem is to classify an image as belonging to a specific super-class. This enables knowledge re-use between classes, and corresponds to a continual learning scenario in which each super-class experiences distributional shift. Note that this is somewhat different from the typical task in few-shot learning, where classes have no a priori semantic meaning.
275
+
276
+ ![](images/41c889573642666c4a4b69c8b63f158a775748a3a46c1ee0d0be44ecb1625130.jpg)
277
+ Figure 3: Performance change from augmenting a model trained with MOCA with task supervision at test time (violet) and from using changepoint estimation at test time for a model trained with task-supervision (teal), for sinusoid (left), Rainbow MNIST (center), and miniImageNet (right).
278
+
279
+ Fig. 2 shows that MOCA outperforms baselines for all hazard rates. Fig. 3 shows that, in contrast to the Rainbow MNIST experiment, there is a large and constant (with respect to hazard rate) performance decrease moving from oracle to MOCA at test time. Interestingly, one would expect the performance decrease with respect to hazard rate to be attributable primarily to lack of task segmentation at test time—in fact, it appears that the trend is primarily a consequence of MOCA training. This also holds for the Rainbow MNIST experiments. This is likely a consequence of the limited amount of data, as the trend is not apparent for the sinusoid experiment.
280
+
281
+ # 8 DISCUSSION AND CONCLUSIONS
282
+
283
+ Future Work. While MOCA addresses a continual learning problem setting, we have not formulated MOCA as an online learning algorithm. Specifically, MOCA meta-trains on an offline timeseries, and keeps the parameters $\pmb \theta$ fixed online, whereas an online learning algorithm would not have this train/test distinction, and would consider updating $\pmb { \theta }$ continuously (Hazan, 2016). However, in order to do this with MOCA, we would need to keep a running buffer of all data observed so far and to use as training data to update $\pmb \theta$ , which may be expensive in real-world domains where large volumes of data (e.g. high definition video from a large collection of cameras on an autonomous vehicle). Extending MOCA toward either strictly online training or a scheme to maintain an efficient replay buffer (Mnih et al., 2013; Vitter, 1985), is a promising direction of future work. Indeed, it may be possible to use MOCA’s changepoint analysis to inform which data to save.
284
+
285
+ Beyond the continual learning extension, data efficiency may be improved by re-using information from previous tasks or modeling task evolution dynamics. Previous work (Nagabandi et al., 2019b; Jerfel et al., 2019; Knoblauch & Damoulas, 2018) has addressed the case in which tasks reoccur in both meta-learning and the BOCPD framework, and thus knowledge (in the form of a posterior estimate) may be re-used. In this work, we address the case in which tasks are sampled i.i.d. from a (typically continuous) distribution, and thus knowledge re-use is often impractical or adds marginal value. Broadly, moving beyond the assumption of i.i.d. tasks to task having associated dynamics (Al-Shedivat et al., 2018) represents a promising future direction.
286
+
287
+ Conclusions. MOCA enables the application of existing meta-learning algorithms to problems without task segmentation, such as the problem setting of continual learning. We find that by leveraging a Bayesian perspective on meta-learning algorithms and augmenting these algorithms with a Bayesian changepoint detection scheme to automatically detect task switches within time-series, we can achieve similar predictive performance when compared to the standard task-segmented metalearning setting, without the often prohibitive requirement of supervised task segmentation.
288
+
289
+ # REFERENCES
290
+
291
+ Ryan Prescott Adams and David JC MacKay. Bayesian online changepoint detection. arXiv:0710.3742, 2007.
292
+
293
+ Maruan Al-Shedivat, Trapit Bansal, Yuri Burda, Ilya Sutskever, Igor Mordatch, and Pieter Abbeel. Continuous adaptation via meta-learning in nonstationary and competitive environments. International Conference on Learning Representations (ICLR), 2018.
294
+
295
+ Rahaf Aljundi, Klaas Kelchtermans, and Tinne Tuytelaars. Task-free continual learning. IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2019.
296
+
297
+ Kelsey R Allen, Evan Shelhamer, Hanul Shin, and Joshua B Tenenbaum. Infinite mixture prototypes for few-shot learning. International Conference on Machine Learning (ICML), 2019.
298
+
299
+ Wei-Yu Chen, Yen-Cheng Liu, Zsolt Kira, Yu-Chiang Frank Wang, and Jia-Bin Huang. A closer look at few-shot classification. International Conference on Learning Representations (ICLR), 2019.
300
+
301
+ Zhiyuan Chen and Bing Liu. Lifelong machine learning. Synthesis Lectures on Artificial Intelligence and Machine Learning, 2016.
302
+
303
+ J. Deng, W. Dong, R. Socher, L.-J. Li, K. Li, and L. Fei-Fei. ImageNet: A Large-Scale Hierarchical Image Database. IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2009.
304
+
305
+ Bradley Efron and Carl Morris. Stein’s estimation rule and its competitorsan empirical Bayes approach. Journal of the American Statistical Association, 1973.
306
+
307
+ Paul Fearnhead and Zhen Liu. On-line inference for multiple changepoint problems. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 2007.
308
+
309
+ Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. International Conference on Machine Learning (ICML), 2017.
310
+
311
+ Chelsea Finn, Aravind Rajeswaran, Sham Kakade, and Sergey Levine. Online meta-learning. International Conference on Machine Learning (ICML), 2019.
312
+
313
+ Robert M French. Catastrophic forgetting in connectionist networks. Trends in cognitive sciences, 1999.
314
+
315
+ Joao Gama, Indr ˜ e˙ Zliobait ˇ e, Albert Bifet, Mykola Pechenizkiy, and Abdelhamid Bouchachia. A ˙ survey on concept drift adaptation. ACM computing surveys (CSUR), 2014.
316
+
317
+ Marta Garnelo, Jonathan Schwarz, Dan Rosenbaum, Fabio Viola, Danilo J. Rezende, S.M. Ali Eslami, and Yee Whye Teh. Neural processes. International Conference on Machine Learning (ICML), 2018.
318
+
319
+ Erin Grant, Chelsea Finn, Sergey Levine, Trevor Darrell, and Thomas Griffiths. Recasting gradientbased meta-learning as hierarchical Bayes. International Conference on Learning Representations (ICLR), 2018.
320
+
321
+ James Harrison, Apoorva Sharma, and Marco Pavone. Meta-learning priors for efficient online Bayesian regression. Workshop on the Algorithmic Foundations of Robotics (WAFR), 2018.
322
+
323
+ Elad Hazan. Introduction to online convex optimization. Foundations and Trends $\textsuperscript { \textregistered }$ in Optimization, 2016.
324
+
325
+ Xu He, Jakub Sygnowski, Alexandre Galashov, Andrei A Rusu, Yee Whye Teh, and Razvan Pascanu. Task agnostic continual learning via meta learning. arXiv preprint arXiv:1906.05201, 2019.
326
+
327
+ Khurram Javed and Martha White. Meta-learning representations for continual learning. Neural Information Processing Systems (NeurIPS), 2019.
328
+
329
+ Ghassen Jerfel, Erin Grant, Thomas L Griffiths, and Katherine Heller. Online gradient-based mixtures for transfer modulation in meta-learning. Neural Information Processing Systems (NeurIPS), 2019.
330
+
331
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. International Conference on Learning Representations (ICLR), 2015.
332
+
333
+ James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska, et al. Overcoming catastrophic forgetting in neural networks. Proceedings of the national academy of sciences, 2017.
334
+
335
+ Jeremias Knoblauch and Theodoros Damoulas. Spatio-temporal bayesian on-line changepoint detection with model selection. International Conference on Machine Learning (ICML), 2018.
336
+
337
+ Zhizhong Li and Derek Hoiem. Learning without forgetting. IEEE Transactions on Pattern Analysis & Machine Intelligence, 2017.
338
+
339
+ Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Alex Graves, Ioannis Antonoglou, Daan Wierstra, and Martin Riedmiller. Playing atari with deep reinforcement learning. Neural Information Processing Systems (NeurIPS), 2013.
340
+
341
+ Kevin P Murphy. Machine Learning: A Probabilistic Perspective. MIT Press, 2012.
342
+
343
+ Anusha Nagabandi, Ignasi Clavera, Simin Liu, Ronald S Fearing, Pieter Abbeel, Sergey Levine, and Chelsea Finn. Learning to adapt in dynamic, real-world environments through metareinforcement learning. International Conference on Learning Representations (ICLR), 2019a.
344
+
345
+ Anusha Nagabandi, Chelsea Finn, and Sergey Levine. Deep online learning via meta-learning: Continual adaptation for model-based RL. arXiv:1812.07671, 2019b.
346
+
347
+ Ulrich Paquet. Empirical Bayesian change point detection. Graphical Models, 2007.
348
+
349
+ Mengye Ren, Eleni Triantafillou, Sachin Ravi, Jake Snell, Kevin Swersky, Joshua B Tenenbaum, Hugo Larochelle, and Richard S Zemel. Meta-learning for semi-supervised few-shot classification. International Conference on Learning Representations (ICLR), 2018.
350
+
351
+ Y Saatci, R Turner, and CE Rasmussen. Gaussian process change point models. International Conference on Machine Learning (ICML), 2010.
352
+
353
+ Jake Snell, Kevin Swersky, and Richard Zemel. Prototypical networks for few-shot learning. Neural Information Processing Systems (NeurIPS), 2017.
354
+
355
+ Charles Stein. Inadmissibility of the usual estimator for the mean of a multivariate normal distribution. Third Berkeley symposium on Mathematical statistics and Probability, 1956.
356
+
357
+ Sebastian Thrun and Lorien Pratt. Learning to learn. Springer, 2012.
358
+
359
+ Ryan Turner, Yunus Saatci, and Carl Edward Rasmussen. Adaptive sequential Bayesian change point detection. NeurIPS Workshop on Nonparametric Bayes, 2009.
360
+
361
+ Oriol Vinyals, Charles Blundell, Timothy Lillicrap, Daan Wierstra, et al. Matching networks for one shot learning. Neural Information Processing Systems (NeurIPS), 2016.
362
+
363
+ Jeffrey S Vitter. Random sampling with a reservoir. ACM Transactions on Mathematical Software (TOMS), 1985.
364
+
365
+ Robert C Wilson, Matthew R Nassar, and Joshua I Gold. Bayesian online learning of the hazard rate in change-point problems. Neural Computation, 2010.
366
+
367
+ ![](images/276ccca49fb4031d4a4f325cebcfd12b2c1736c9879b8592f38b2b07731916cf.jpg)
368
+ Figure 4: Performance versus the training horizon $( T )$ for the sinusoid with hazard 0.01. The lowest hazard was used to increase the effects of the short training horizon. A minor decrease in performance is visible for very small training horizons (around 20), but flattens off around 100 and above. It is expected that these diminishing marginal returns will occur for all systems and hazard rates.
369
+
370
+ # A BATCH TRAINING MOCA
371
+
372
+ In practice, we sample batches of length $T$ from the full training time series, and train on these components. While this artificially increases the observed hazard rate (as a result of the initial belief over run length being 0 with probability 1), it substantially reduces the computational burden of training. Because MOCA maintains a posterior for each possible run length, computational requirements grow linearly with $T$ . Iterating over the whole training time series without any hypothesis pruning can be prohibitively expensive. While a variety of different pruning methods within BOCPD have been proposed (Wilson et al., 2010; Saatci et al., 2010), we require a pruning method which does not break model differentiability. Note that at test-time, we no longer require differentiability and so previously developed pruning methods may be applied.
373
+
374
+ Empirically, we observe diminishing marginal returns when training on longer sequences. Fig. 4 shows the performance of MOCA for varying training sequence lengths $( T )$ . In all experiments presented in the body of the paper, we use $\dot { T } = 1 0 0$ . As discussed, small $T$ values artificially inflate the observed hazard rate, so we expect to see performance improve with larger $T$ values. Fig. 4 shows that this effect results in diminishing marginal returns, with little performance improvement beyond $T = 1 0 0$ . Longer training sequences lead to increased computation per iteration (as MOCA is linear in the runlength), as well as an increased memory burden (especially during training, when the computation graph must be retained by automatic differentiation frameworks). Thus, we believe it is best to train on the shortest possible sequences, and propose $T = 1 / \lambda$ (where $\lambda$ is the hazard rate) as a rough rule of thumb.
375
+
376
+ # B PROBABILISTIC CLUSTERING FOR ONLINE CLASSIFICATION
377
+
378
+ In this section we present in more detail probabilistic clustering for online classification (PCOC, pronounced “peacock”), a framework for Bayesian meta-learning for classification. PCOC extends embedding-based meta-learning algorithms (e.g. Snell et al. (2017); Vinyals et al. (2016); Allen et al. (2019); Ren et al. (2018)) to enable expressive posterior distributions (which are useful for use within the MOCA framework). However, PCOC is a valuable meta-learning algorithm outside of the MOCA framework, with many features of note for downstream applications.
379
+
380
+ PCOC maps each data point, $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ , through an embedding function1 $\phi : \mathbb { R } ^ { n _ { x } } \mathbb { R } ^ { n _ { \phi } }$ . We choose a neural network with weights $\pmb { w }$ for the embedding function. We assume a generative model within the embedding space. We will assume that each class is sampled from a task dependant categorical distribution with class probabilities $p _ { 1 } , . . . , p _ { n _ { y } }$ . We will assume that for each class $j$ , $z = \phi ( { \bar { x } } )$ (for $\scriptstyle { \mathbf { { \mathit { x } } } } _ { k }$ with $y _ { k } = j $ ) follows a Gaussian distribution with mean $\bar { z } _ { j }$ and variance $\Sigma _ { j }$ . This assumption is a standard generative modelling assumption corresponding to a Gaussian mixture model (Murphy, 2012). As such, our classification strategy will be based on Gaussian discriminant analysis (GDA, also referred to as quadratic discriminant analysis).
381
+
382
+ Given this Categorical-Gaussian generative model, we will fix a conjugate Dirichlet prior on class probabilities and a Gaussian prior on the class conditional mean:
383
+
384
+ $$
385
+ p _ { 1 } , \dots , p _ { n _ { y } } \sim \mathrm { D i r } ( \alpha _ { 0 } ) \qquad \quad \bar { z } _ { j } \sim \mathcal { N } ( \mu _ { j , 0 } , \Lambda _ { j , 0 } ^ { - 1 } ) \ \forall j
386
+ $$
387
+
388
+ Algorithm 2 Probabilistic Clustering for Online Classification
389
+
390
+ <table><tr><td colspan="2">Require:Meta-dataset D 1: Randomly initialize weights of 𝜙,Dirichlet priors, prior mean and variance of each class</td></tr><tr><td colspan="2">2: while not converged do for all D ∈D do</td></tr><tr><td>3:</td><td></td></tr><tr><td>4:</td><td>Split D into conditioning data {x1:k, y1:k} and evaluation data {xk+1:T, yk+1:T}</td></tr><tr><td>5:</td><td>Compute μj,k,△j,k and posterior Dirichlet concentration parameters for each class j</td></tr><tr><td>6:</td><td>Evaluate probability of evaluation data under posterior densities (Eq. 16)</td></tr><tr><td>7: 8:</td><td>end for</td></tr><tr><td>9: end while</td><td>Update network weights and prior terms based on maximum likelihood of evaluation data</td></tr></table>
391
+
392
+ This choice of conjugate prior and generative model means that the posterior distributions on $q$ and $\bar { z } _ { j }$ remain Dirichlet and Gaussian respectively, and that the parameters of this posterior can be computed analytically.
393
+
394
+ The posterior parameters at time $t$ after observing $k _ { j }$ samples of class $j$ are
395
+
396
+ $$
397
+ \begin{array} { l } { { \Lambda _ { j , t } = \Lambda _ { j , 0 } + k _ { j } \Sigma _ { \epsilon , j } ^ { - 1 } , } } \\ { { \displaystyle \mu _ { j , t } = \Lambda _ { j , t } ^ { - 1 } \big ( k _ { j } \Sigma _ { \epsilon , j } ^ { - 1 } \bar { \phi } _ { j , t } + \Lambda _ { j , 0 } \mu _ { j , 0 } \big ) , } } \\ { { \displaystyle \alpha _ { t } = \sum _ { j = 1 } ^ { J } k _ { j } \mathbf { 1 } _ { j } . } } \end{array}
398
+ $$
399
+
400
+ where $\bar { \phi } _ { j , t }$ is the sample mean of the embedded points corresponding to class $j$ . These can also be computed recursively, as outlined in the main paper in equation (11).
401
+
402
+ Given these posteriors, the posterior predictive distribution for class $j$ is Gaussian:
403
+
404
+ $$
405
+ p ( \boldsymbol { z } _ { t + 1 } \mid \boldsymbol { y } _ { t + 1 } = j , \boldsymbol { x } _ { 1 : t } , \boldsymbol { y } _ { 1 : t } ) = \mathcal { N } ( \boldsymbol { z } _ { t + 1 } ; \boldsymbol { \mu } _ { j , t } , \Lambda _ { j , t } ^ { - 1 } + \Sigma _ { \epsilon , j } )
406
+ $$
407
+
408
+ Given this within-class posterior predictive, we can now consider the posterior predictive over classes. Note that, by Bayes rule,
409
+
410
+ $$
411
+ p ( y _ { t + 1 } = j \mid x _ { t + 1 } , x _ { 1 : t } , y _ { 1 : t } ) = { \frac { p ( x _ { t + 1 } \mid y _ { t + 1 } = j , x _ { 1 : t } , y _ { 1 : t } ) p ( y _ { t + 1 } = j \mid x _ { 1 : t } , y _ { 1 : t } ) } { \sum _ { i } p ( x _ { t + 1 } \mid y _ { t + 1 } = i , x _ { 1 : t } , y _ { 1 : t } ) p ( y _ { t + 1 } = i \mid x _ { 1 : t } , y _ { 1 : t } ) } } .
412
+ $$
413
+
414
+ Because we have a finite number of classes, computing the partition function in the denominator is tractable. The posterior Dirichlet probabilities take the form
415
+
416
+ $$
417
+ p ( \pmb { y } _ { t + 1 } = j \mid \pmb { x } _ { 1 : t } , \pmb { y } _ { 1 : t } ) = p ( \pmb { y } _ { t + 1 } = j \mid \pmb { y } _ { 1 : t } ) = \frac { \alpha _ { j , t } } { \sum _ { i } \alpha _ { i , t } } ,
418
+ $$
419
+
420
+ and we choose to meta-learn the Dirichlet prior $\pmb { \alpha } _ { 0 }$ . In the general meta-classification setting, each label has a task-dependent probability (the classes are not necessarily balanced, as is typically assumed in e.g. 1 shot and 5 shot benchmarks). As such, online estimation of the posterior allows us to infer the class probabilities within one task, and the Dirichlet priors allow us to meta-learn a belief over label probabilities between tasks. In addition to learning priors on imbalanced classes, this approach allows our model to encode confidence in the class probabilities. For example, for small $\alpha _ { j , 0 }$ ’s, the model will be highly sensitive to the empirical class counts within one task, whereas for large $\alpha _ { j , 0 }$ ’s, the empirical counts within one task will have a relatively small effect.
421
+
422
+ # B.1 PCOC FOR EPISODIC META-CLASSIFICATION
423
+
424
+ The standard episodic meta-classification benchmarks are typically of the form of $k$ -shot (corresponding to the number of context data points observed for each class), and $n$ -way (corresponding to the number of classes) (Snell et al., 2017; Finn et al., 2017; Vinyals et al., 2016). This setting is based on association between the context data and the test data; the labels do not have a priori semantic value. For example, a meta-classification problem is identical if two class labels are exchanged. This property results in simplifications for the PCOC model. Maintaining a prior over each class individually is no longer logical, as two classes with different priors could have their labels switched with no change in the problem. Therefore, in this setting, we maintain a shared prior for the mean of all classes.
425
+
426
+ This generic prior over data is useful for modified problem statements. Consider a setting in which we do not a priori know the number of classes. In this case, in which data is being provided sequentially, we wish to report if the data provided at time $t$ corresponds to a previously unobserved class. Replacing the Dirichlet prior with a Chinese restaurant process (as in e.g. Nagabandi et al. (2019b); Allen et al. (2019)) would enable a few-shot meta-classification model with a potentially expandable number of classes. Moreover, a better calibrated confidence in outputs is available, which is useful for downstream tasks.
427
+
428
+ # B.2 PCOC FOR STREAMING META-CLASSIFICATION
429
+
430
+ We will now discuss modifications to the PCOC framework for the streaming setting. We will discuss two cases:
431
+
432
+ 1. The set of labels is known a priori (and labels have semantic value—i.e. reporting class $j$ has specific meaning beyond indicating that a data point belongs to the same class as other data points of class $j$ ).
433
+ 2. The set of labels is not known in advance, and thus our streaming meta-classification algorithm must be able to predict when a class is previously unseen.
434
+
435
+ In this paper we consider the first case. In this setting, we may directly apply PCOC as described above. Importantly, this setting allows “zero-shot” classification, which is critical in the MOCA framework, as we have distinct, semantically meaningful priors for each class mean. In the second case, the set of labels would necessarily need to be expanded over time, for which a non-parametric model may be used as described above. There are several versions of this problem statement, which is more similar to a “lifelong learning” setting, and we defer them to future work.
436
+
437
+ # B.3 DISCUSSION
438
+
439
+ PCOC extends a line of work on meta-classification based on prototypical networks (Snell et al., 2017). This framework maps the context data to an embedding space, after which it computes the centroid for each class. For a new data point, it models the probability of belonging to each class as the softmax of the distances between the embedded point and the class centroids, for some distance metric. For Euclidean distances (which the authors focus on), this corresponds to performing frequentist estimation of class means, under the assumption that the variance matrix for each class is the identity matrix2. Indeed, this corresponds to the cheapest-to-evaluate simplification of PCOC. Ren et al. (2018) propose adding a class-dependent length scale (which is a scalar), which corresponds to meta-learning a frequentist estimate of the variance for each class. Moreover, it corresponds to assuming a variance that takes the form of a scaled identity matrix. Indeed, assuming diagonality of the covariance matrix results in substantial performance improvement as the matrix inverse may be performed element-wise. This reduces the numerical complexity of this operation in the (frequently high-dimensional) embedding space from cubic to linear. However, in our implementation of MOCA, we assume diagonal covariances throughtout, resulting in comparable computational complexity to the different flavors of prototypical networks. If one were to use dense covariances, the computational performance decreases substantially (due to the necessity of matrix inversions), especially in high dimensional embedding spaces.
440
+
441
+ In contrast to this previous work, PCOC has several desirable features. First, both Snell et al. (2017) and Ren et al. (2018) make the implicit assumption that the classes are balanced, whereas we perform online estimation of class probabilities via Dirichlet posterior inference. Beyond this, our approach is explicitly Bayesian, and we maintain priors over the parameters that we estimate online. This is critical for utilization in the MOCA framework. Existence of these priors allows “zero-shot” learning—it enables a model to classify incoming data to a certain class, even if no data belonging to that class has been observed within the current task. Finally, because the posteriors concentrate (the predictive variance decreases as more data is observed), we may better estimate when a change in the task has occurred. We also note that maximum likelihood estimation of Gaussian means is dominated by the James-Stein estimator (Stein, 1956), which shrinks the least squares estimator toward some prior. Moreover, the James-Stein estimator paired with empirical Bayesian estimation of the prior—which is the basis for Bayesian meta-learning approaches such as ALPaCA and PCOC—has been shown to be a very effective estimator in this problem setting (Efron & Morris, 1973).
442
+
443
+ ![](images/453bca4c24121084e82d962ffd2e96d186e1d9b10719cfaaab02d38607d804f6.jpg)
444
+ Figure 5: Test negative log likelihood of MOCA on the sinusoid problem with partial task segmentation. The partial segmentation during training results in negligible performance increase, while partial supervision at test time uniformly improves performance. Note that each column corresponds to one trained model, and thus the randomly varying performance across train supervision rates may be explained by simply results of minor differences in individual models.
445
+
446
+ # C MOCA WITH PARTIAL TASK SEGMENTATION
447
+
448
+ Since MOCA explicitly reasons about a belief over run-lengths, it can operate anywhere in the spectrum of the task-unsegmented case as presented so far, to the fully task-segmented setting of standard meta-learning. At every time step $t$ , the user can override the belief $\bar { b } _ { t } ( \boldsymbol { r } _ { t } )$ to provide a degree of supervision. At known changepoints, for example, the user can override $b _ { t } ( \boldsymbol { r } _ { t } )$ to have all its mass on $r _ { t } = 0$ . If the task is known not to change at the given time, the user can set the hazard probability to 0 when updating the belief for the next timestep. If a user applies both of these overrides, it amounts to effectively sidestepping the Bayesian reasoning over changepoints and revealing this information to the meta-learning algorithm. If the user only applies the former, the user effectively indicates to the algorithm when known changepoints occur, but the algorithm is free to propagate this belief forward in time according to the update rules, and detect further changepoints that were not known to the user. Finally, the Bayesian framework allows a supervisor to provide their belief over a changepoint, which may not have probability mass entirely at $r _ { t } = 0$ . Thus, MOCA flexibly incorporates any type of task supervision available to a system designer.
449
+
450
+ Fig. 5 shows the performance of partial task segmentation at both train and test for the sinusoid problem, for the hazard rate 0.2. This problem was chosen as the results were highly repeatable and thus the trend is more readily observed. Here, we label a changepoint with some probability, which we refer to as the supervision rate. We do not provide supervision for any non-changepoint timesteps, and thus a supervision rate of 1 corresponds to labeling every changepoint but is not equivalent to the oracle. Specifically, the model may still have false positive changepoints, but is incapable of false negatives. This figure shows that the performance monotonically improves with increasing train supervision rate, but is largely invariant under varying train supervision. This performance improvement agrees with Fig. 3, which shows that for the sinusoid problem, performance is improved by full online segmentation. Indeed, these results show that training with MOCA results in models with comparable test performance to those with supervised changepoints, and thus there is little marginal value to task segmentation during training.
451
+
452
+ # D COMPUTATIONAL PERFORMANCE
453
+
454
+ Fig. 6 shows the computational performance at test time on the sinusoid problem. Note that the right hand side of the curve shows a linear trend that is expected from the growing run length belief vector. However, even for 25000 iterations, the execution time is approximately 7ms for one iteration. These experiments were performed on an Nvidia Titan Xp GPU. Interestingly, on the left hand side of the curve, the time per iteration is effectively constant until the number of iterations approaches approximately 4500. Based on our code profiling, we hypothesize that this is an artifact of overhead in matrix multiplication computations done on the GPU.
455
+
456
+ ![](images/a756b359b6de1248ab77ccc57a5f59c9e235605ba807a6eed39f36b981d2179e.jpg)
457
+ Figure 6: Time per iteration versus iteration number at test time. Note that the right hand side of the curve shows the expected linear complexity expected of MOCA. Note that for these experiments, no hypothesis pruning was performed, and thus at test time performance could be constant time as opposed to linear. This figure shows $9 5 \%$ confidence intervals for 10 trials, but the repeatability of the computation time is consistent enough that they are not visible.
458
+
459
+ # E EXPERIMENTAL DETAILS
460
+
461
+ # E.1 SINUSOID
462
+
463
+ To test the performance of the MOCA framework combined with ALPaCA for the regression setting, we investigate a switching sinusoid regression problem. The standard sinusoid regression problem, in which randomly sampled phase and amplitude constitute a task, is a standard benchmark in metalearning (Finn et al., 2017). Moreover, a switching sinusoid problem is a popular benchmark in continuous learning (He et al., 2019; Javed & White, 2019). Each task consists of a randomly sampled phase in the range $[ 0 , \pi ]$ and amplitude in [0.1, 5]. This task was investigated for varying hazard rates. For the experiments in this paper, samples from the sinusoid had additive zero-mean Gaussian noise of variance 0.05.
464
+
465
+ # E.2 RAINBOW MNIST
466
+
467
+ The Rainbow MNIST dataset (introduced in Finn et al. (2019)) contains 56 different color/scale/rotation transformations of the MNIST dataset, where one transformation constitutes a task. We split this dataset into a train set of 49 transformations and a test set of 7. For hyperparameter optimization, we split the train set into a training set of 42 transformations and a validation of 7. However, because the dataset represents a fairly small amount of tasks (relative to the sinusoid problem, which has infinite), after hyperparameters were set we trained on all 49 tasks. We found this notably improved performance. Note that the same approach was used in Snell et al. (2017).
468
+
469
+ # E.3 MINIIMAGENET
470
+
471
+ We use the miniImageNet dataset of Vinyals et al. (2016), a standard benchmark in few-shot learning. However, the standard few-shot learning problem does not require data points to be assigned to a certain class label. Instead, given context data, the goal is to associated the test data with the correct context data. We argue that this problem setting is implausible for the continual learning setting: while observing a data stream, you are also inferring the set of possible labels. Moreover, after a task change, there is no context data to associate a new point with. Therefore we instead assume a known set of classes. We group the 100 classes of miniImageNet in to five super-classes, and perform five-way classification given these. These super-classes vary in intra-class diversity of sub-classes: for example, one of the super-class is entirely composed of sub-classes that are breeds of dogs, while another corresponds to buildings, furniture, and household objects. Thus, the strength of the prior information for each super-class varies. Moreover, the intra-class similarities are quite weak, and thus generalization from the train set to the test set is difficult and few-shot learning is still necessary and beneficial. The super-classes are detailed in table ??.
472
+
473
+ The super-classes are roughly balanced in terms of number of classes contained. Each task correspond to sampling a class from within each super-class, which was fixed for the duration of that task. Each super-class was sampled with equal probability.
474
+
475
+ # E.4 BASELINES
476
+
477
+ Three baselines were used, described below:
478
+
479
+ Table 1: Our super-class groupings for miniImageNet experiments.
480
+
481
+ <table><tr><td>Class</td><td>Description</td><td>Train/Val/Test</td><td>Synsets</td></tr><tr><td rowspan="5">1</td><td rowspan="5">Non-dog animals</td><td>Train</td><td>n01532829,n01558993,n01704323,n01749939,</td></tr><tr><td></td><td>n01770081,n01843383,n01910747, n02074367, n02165456,n02457408,n02606052, n04275548</td></tr><tr><td>Validation</td><td>n01855672,n02138441,n02174001</td></tr><tr><td>Test</td><td>n01930112, n01981276, n02129165, n02219486,</td></tr><tr><td></td><td>n02443484</td></tr><tr><td rowspan="5">2</td><td rowspan="5">Dogs, foxes, wolves</td><td>Train</td><td>n02089867,n02091831, n02101006, n02105505,</td></tr><tr><td></td><td>n02108089,n02108551, n02108915,n02111277,</td></tr><tr><td></td><td>n02113712,n02120079</td></tr><tr><td>Validation Test</td><td>n02091244,n02114548 n02099601,n02110063,n02110341,n02116738</td></tr><tr><td></td><td></td></tr><tr><td rowspan="5">3</td><td rowspan="5">Vehicles, musical instruments, nature/outdoors</td><td>Train</td><td>n02687172,n02966193,n03017168,n03838899,</td></tr><tr><td></td><td>n03854065,n04251144, n04389033, n04509417, n04515003,n04612504,n09246464,n13054560</td></tr><tr><td>Validation</td><td>n02950826,n02981792, n03417042, n03584254,</td></tr><tr><td></td><td>n03773504,n09256479</td></tr><tr><td>Test</td><td>n03272010,n04146614</td></tr><tr><td rowspan="5">4</td><td rowspan="5">Food, kitchen equipment, clothing</td><td>Train</td><td>n02747177,n02795169, n02823428, n03047690,</td></tr><tr><td></td><td>n03062245,n03207743,n03337140,n03400231,</td></tr><tr><td></td><td>n03476684,n03527444,n03676483,n04596742,</td></tr><tr><td></td><td>n07584110,n07697537,n07747607,n13133613</td></tr><tr><td>Validation</td><td>n03770439,n03980874</td></tr><tr><td rowspan="7"></td><td rowspan="7">Building, furniture, household</td><td>Test</td><td>n03146219,n03775546,n04522168,n07613480</td></tr><tr><td>Train</td><td></td></tr><tr><td></td><td>n03220513, n03347037, n03888605,n03908618,</td></tr><tr><td></td><td>n03924679,n03998194,n04067472,n04243546,</td></tr><tr><td></td><td>n04258138,n04296562,n04435653,n04443257, n04604644, n06794110</td></tr><tr><td>Validation</td><td>n02971356,n03075370,n03535780</td></tr><tr><td>Test</td><td>n02871525,n03127925,n03544143, n04149813,</td></tr></table>
482
+
483
+ • Train on Everything: This baseline consists of ignoring task variation and treating the training timeseries as one dataset. Note that many datasets contain latent temporal information that is ignored, and so this approach is effectively common practice.
484
+
485
+ Oracle: In this baseline, the same ALPaCA and PCOC models were used as in MOCA, but with exact knowledge of the task switch times. Note that within a regret setting, one typically compares to the best achievable performance. The oracle actually outperforms the best achieveable performance in this problem setting, as it takes at least one data point (and the associated prediction, on which loss is incurred) to become aware of the task variation.
486
+
487
+ • Sliding Window: The sliding window approach is commonly used within problems that exhibit time variation, both within meta-learning (Nagabandi et al., 2019a) and continual learning (He et al., 2019; Gama et al., 2014). In this approach, the last $n$ data points are used for conditioning, under the expectation that the most recent data is the most predictive of the observations in the near future. Typically, some form of validation is used to choose the window length, $n$ . As MOCA is performing a form of adaptive windowing, it should ideally outperform any fixed window length. We compare to three window lengths $( n = 5 , 1 0 , 5 0 )$ , each of which are well-suited to part of the range of hazard rates that we consider.
488
+
489
+ # E.5 TRAINING DETAILS
490
+
491
+ Sinusoid. A standard feedforward network consisting of two hidden layers of 128 units was used with ReLU nonlinearities. These layers were followed by a 32 units layer and another tanh nonlinearity. Finally, the output layer (for which we learn a prior) was of size ${ \dot { 3 } } 2 \times 1$ . The same architecture was used for all baselines. This is the same architecture for sinusoid regression as was used in Harrison et al. (2018) (with the exception of using ReLU nonlinearities instead of all tanh nonlinearities). The following parameters were used for training:
492
+
493
+ • Optimizer: Adam (Kingma & Ba, 2015)
494
+
495
+ • Learning rate: 0.02
496
+ • Batch size: 50
497
+ • Batch length: 100
498
+ • Train iterations: 7500
499
+
500
+ Batch length here corresponds to the number of timesteps in each training batch. Note that longer batch lengths are necessary to achieve good performance on low hazard rates, as short batch lengths artificially increase the hazard rate as a result of the assumption that each batch begins with a new task. The learning rate was decayed every 1000 training iterations.
501
+
502
+ We allowed the noise variance to be learned by the model. This, counter-intuitively, resulted in a substantial performance improvement over a fixed (accurate) noise variance. This is due to a curriculum effect, where the model early one increases the noise variance and learns roughly accurate features, followed by slowly decreasing the noise variance to the correct value.
503
+
504
+ Rainbow MNIST. In our experiments, we used the same architecture as was used as in Snell et al. (2017); Vinyals et al. (2016). It is often unclear in recent work on few-shot learning whether performance improvements are due to improvements in the meta-learning scheme or the network architecture used (although these things are not easily disentangled). As such, the architecture we use in this experiment provides fair comparison to previous few-shot learning work. This architecture consists of four blocks of $6 4 3 \times 3$ convolution filters, followed by a batchnorm, ReLU nonlinearity and $2 \times 2$ max pool. On the last conv black, we removed the batchnorm and the nonlinearity. For the $2 8 \times 2 8$ Rainbow MNIST dataset, this encoder leads to a 64 dimensional embedding space. For the “train on everything” baseline, we used the same architecture followed by a fully connected layer and a softmax. This architecture is standard for image classification and has a comparable number of parameters to our model.
505
+
506
+ We used a diagonal covariance factorization within PCOC, substantially reducing the number of terms in the covariance matrix for each class and improving the performance of the model (due to the necessary inversion of the posterior predictive covariance). We learned a prior mean and variance for each class, as well as a noise covariance for each class (again, diagonal). We also fixed the Dirichlet priors to be large, effectively imbuing the model with the knowledge that the classes were balanced. The following parameters were used for training:
507
+
508
+ • Optimizer: Adam
509
+ • Learning rate: 0.02
510
+ • Batch size: 10
511
+ • Batch length: 100
512
+ • Train iterations: 5000
513
+
514
+ The learning rate was decayed every 1500 training iterations.
515
+
516
+ miniImageNet. Finally, for miniImageNet, we used six convolution blocks, each as previous described. This resulted in a 64 dimensional embedding space. We initially attempted to use the same four-conv backbone as for Rainbow MNIST, but the resulting 1600 dimensional embedding space had unreasonable memory requirements for batches lengths of 100. Again, for the “train on everything” baseline, we used the same architectures with one fully connected layer followed by a softmax. The following parameters were used for training:
517
+
518
+ • Optimizer: Adam
519
+ • Learning rate: 0.002
520
+ • Batch size: 10
521
+ • Batch length: 100
522
+ • Train iterations: 3000
523
+
524
+ The learning rate was decayed every 1000 training iterations. We used the validation set to monitor performance, and as in Chen et al. (2019), we used the highest validation accuracy iteration for test. We also performed data augmentation as in Chen et al. (2019) by adding random reflections and color jitter to the training data.
525
+
526
+ # E.6 TEST DETAILS.
527
+
528
+ For all problems, a test horizon of 400 was used. Again, the longest possible test horizon was used to avoid artificial distortion of the test hazard rate. Both both problems, a batch of 200 evaluations was performed, and all confidence intervals correspond to $9 5 \%$ .
md/train/rJY3vK9eg/rJY3vK9eg.md ADDED
@@ -0,0 +1,397 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # NEURAL COMBINATORIAL OPTIMIZATION WITH REINFORCEMENT LEARNING
2
+
3
+ Irwan Bello∗, Hieu Pham∗, Quoc V. Le, Mohammad Norouzi, Samy Bengi Google Brain {ibello,hyhieu,qvl,mnorouzi,bengio}@google.com
4
+
5
+ # ABSTRACT
6
+
7
+ This paper presents a framework to tackle combinatorial optimization problems using neural networks and reinforcement learning. We focus on the traveling salesman problem (TSP) and train a recurrent neural network that, given a set of city coordinates, predicts a distribution over different city permutations. Using negative tour length as the reward signal, we optimize the parameters of the recurrent neural network using a policy gradient method. We compare learning the network parameters on a set of training graphs against learning them on individual test graphs. Without much engineering and heuristic designing, Neural Combinatorial Optimization achieves close to optimal results on 2D Euclidean graphs with up to 100 nodes. Applied to the KnapSack, another NP-hard problem, the same method obtains optimal solutions for instances with up to 200 items. These results, albeit still far from state-of-the-art, give insights into how neural networks can be used as a general tool for tackling combinatorial optimization problems.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Combinatorial optimization is a fundamental problem in computer science. A canonical example is the traveling salesman problem (TSP), where given a graph, one needs to search the space of permutations to find an optimal sequence of nodes with minimal total edge weights (tour length). The TSP and its variants have myriad applications in planning, manufacturing, genetics, etc. (see (Applegate et al., 2011) for an overview).
12
+
13
+ Finding the optimal TSP solution is NP-hard, even in the two-dimensional Euclidean case (Papadimitriou, 1977), where the nodes are 2D points and edge weights are Euclidean distances between pairs of points. In practice, TSP solvers rely on handcrafted heuristics that guide their search procedures to find competitive (and in many cases optimal) tours efficiently. Even though these heuristics work well on TSP, once the problem statement changes slightly, they need to be revised. In contrast, machine learning methods have the potential to be applicable across many optimization tasks by automatically discovering their own heuristics based on the training data, thus requiring less handengineering than solvers that are optimized for one task only.
14
+
15
+ While most successful machine learning techniques fall into the family of supervised learning, where a mapping from training inputs to outputs is learned, supervised learning is not applicable to most combinatorial optimization problems because one does not have access to optimal labels. However, one can compare the quality of a set of solutions using a verifier, and provide some reward feedbacks to a learning algorithm. Hence, we follow the reinforcement learning (RL) paradigm to tackle combinatorial optimization. We empirically demonstrate that, even when using optimal solutions as labeled data to optimize a supervised mapping, the generalization is rather poor compared to an RL agent that explores different tours and observes their corresponding rewards.
16
+
17
+ We propose Neural Combinatorial Optimization, a framework to tackle combinatorial optimization problems using reinforcement learning and neural networks. We consider two approaches based on policy gradients (Williams, 1992). The first approach, called RL pretraining, uses a training set to optimize a recurrent neural network (RNN) that parameterizes a stochastic policy over solutions, using the expected reward as objective. At test time, the policy is fixed, and one performs inference by greedy decoding or sampling. The second approach, called active search, involves no pretraining. It starts from a random policy and iteratively optimizes the RNN parameters on a single test instance, again using the expected reward objective, while keeping track of the best solution sampled during the search. We find that combining RL pretraining and active search works best in practice.
18
+
19
+ ![](images/1ff035637247f258db525f5d1f250cf5f2bbb4ac3018e402f402b8331eb07fd5.jpg)
20
+ Figure 1: Tour length ratios of LK-H (Helsgaun, 2000) local search and our best method (RL pretraining-Active Search) against optimality, guaranteed by Concorde (Applegate et al., 2006). Generic local search, obtained via Googles vehicle routing problem solver (Google, 2016), applies a set of heuristics starting from the (Christofides, 1976) solution. Note that our method is five orders of magnitude slower than LK-H and Concorde.
21
+
22
+ On 2D Euclidean graphs with up to 100 nodes, Neural Combinatorial Optimization significantly outperforms the supervised learning approach to the TSP (Vinyals et al., 2015b) and obtains close to optimal results when allowed more computation time (see Figure 1). We illustrate the flexibility of the method by also applying it to the KnapSack problem, for which we get optimal results for instances with up to 200 items. Our results, while still inferior to the state-of-the-art in many dimensions (such as speed, scale and performance), give insights into how neural networks can be used as a general tool for tackling combinatorial optimization problems, especially those that are difficult to design heuristics for.
23
+
24
+ # 2 PREVIOUS WORK
25
+
26
+ The Traveling Salesman Problem is a well studied combinatorial optimization problem and many exact or approximate algorithms have been proposed for both Euclidean and non-Euclidean graphs. Christofides (1976) proposes a heuristic algorithm that involves computing a minimum-spanning tree and a minimum-weight perfect matching. The algorithm has polynomial running time and returns solutions that are guaranteed to be within a factor of $1 . 5 \times$ to optimality in the metric instance of the TSP.
27
+
28
+ The best known exact dynamic programming algorithm for TSP has a complexity of $\Theta ( 2 ^ { n } n ^ { 2 } )$ , making it infeasible to scale up to large instances, say with 40 points. Nevertheless, state of the art TSP solvers, thanks to carefully handcrafted heuristics that describe how to navigate the space of feasible solutions in an efficient manner, can solve symmetric TSP instances with thousands of nodes. Concorde (Applegate et al., 2006), widely accepted as one of the best exact TSP solvers, makes use of cutting plane algorithms (Dantzig et al., 1954; Padberg & Rinaldi, 1990; Applegate et al., 2003), iteratively solving linear programming relaxations of the TSP, in conjunction with a branch-and-bound approach that prunes parts of the search space that provably will not contain an optimal solution. Similarly, the Lin-Kernighan-Helsgaun heuristic (Helsgaun, 2000), inspired from the Lin-Kernighan heuristic (Lin & Kernighan, 1973), is a state of the art approximate search heuristic for the symmetric TSP and has been shown to solve instances with hundreds of nodes to optimality.
29
+
30
+ More generic solvers, such as Google’s vehicle routing problem solver (Google, 2016) that tackles a superset of the TSP, typically rely on a combination of local search algorithms and metaheuristics. Local search algorithms apply a specified set of local move operators on candidate solutions, based on hand-engineered heuristics such as 2-opt (Johnson, 1990), to navigate from solution to solution in the search space. A metaheuristic is then applied to propose uphill moves and escape local optima. A popular choice of metaheuristic for the TSP and its variants is guided local search (Voudouris & Tsang, 1999), which moves out of a local minimum by penalizing particular solution features that it considers should not occur in a good solution.
31
+
32
+ The difficulty in applying existing search heuristics to newly encountered problems - or even new instances of a similar problem - is a well-known challenge that stems from the No Free Lunch theorem (Wolpert & Macready, 1997). Because all search algorithms have the same performance when averaged over all problems, one must appropriately rely on a prior over problems when selecting a search algorithm to guarantee performance. This challenge has fostered interest in raising the level of generality at which optimization systems operate (Burke et al., 2003) and is the underlying motivation behind hyper-heuristics, defined as ”search method[s] or learning mechanism[s] for selecting or generating heuristics to solve computation search problems”. Hyper-heuristics aim to be easier to use than problem specific methods by partially abstracting away the knowledge intensive process of selecting heuristics given a combinatorial problem and have been shown to successfully combine human-defined heuristics in superior ways across many tasks (see (Burke et al., 2013) for a survey). However, hyper-heuristics operate on the search space of heuristics, rather than the search space of solutions, therefore still initially relying on human created heuristics.
33
+
34
+ The application of neural networks to combinatorial optimization has a distinguished history, where the majority of research focuses on the Traveling Salesman Problem (Smith, 1999). One of the earliest proposals is the use of Hopfield networks (Hopfield & Tank, 1985) for the TSP. The authors modify the network’s energy function to make it equivalent to TSP objective and use Lagrange multipliers to penalize the violations of the problem’s constraints. A limitation of this approach is that it is sensitive to hyperparameters and parameter initialization as analyzed by (Wilson & Pawley, 1988). Overcoming this limitation is central to the subsequent work in the field, especially by (Aiyer et al., 1990; Gee, 1993). Parallel to the development of Hopfield networks is the work on using deformable template models to solve TSP. Perhaps most prominent is the invention of Elastic Nets as a means to solve TSP (Durbin, 1987), and the application of Self Organizing Map to TSP (Fort, 1988; Angeniol et al., 1988; Kohonen, 1990). Addressing the limitations of deformable template models is central to the following work in this area (Burke, 1994; Favata & Walker, 1991; Vakhutinsky & Golden, 1995). Even though these neural networks have many appealing properties, they are still limited as research work. When being carefully benchmarked, they have not yielded satisfying results compared to algorithmic methods (Sarwar & Bhatti, 2012; La Maire & Mladenov, 2012). Perhaps due to the negative results, this research direction is largely overlooked since the turn of the century.
35
+
36
+ Motivated by the recent advancements in sequence-to-sequence learning (Sutskever et al., 2014), neural networks are again the subject of study for optimization in various domains (Yutian et al., 2016), including discrete ones (Zoph & Le, 2016). In particular, the TSP is revisited in the introduction of Pointer Networks (Vinyals et al., 2015b), where a recurrent network with non-parametric softmaxes is trained in a supervised manner to predict the sequence of visited cities. Despite architecural improvements, their models were trained using supervised signals given by an approximate solver.
37
+
38
+ # 3 NEURAL NETWORK ARCHITECTURE FOR TSP
39
+
40
+ We focus on the 2D Euclidean TSP in this paper. Given an input graph, represented as a sequence of $n$ cities in a two dimensional space $s = \{ \mathbf { \bar { x } } _ { i } \} _ { i = 1 } ^ { n }$ where each $\bar { \mathbf { x } } _ { i } \in \mathbb { R } ^ { 2 }$ , we are concerned with finding a permutation of the points $\pi$ , termed a tour, that visits each city once and has the minimum total length. We define the length of a tour defined by a permutation $\pi$ as
41
+
42
+ $$
43
+ L ( \pi \mid s ) = \left\| \mathbf { x } _ { \pi ( n ) } - \mathbf { x } _ { \pi ( 1 ) } \right\| _ { 2 } + \sum _ { i = 1 } ^ { n - 1 } \left\| \mathbf { x } _ { \pi ( i ) } - \mathbf { x } _ { \pi ( i + 1 ) } \right\| _ { 2 } ,
44
+ $$
45
+
46
+ where $\lVert \cdot \rVert _ { 2 }$ denotes $\ell _ { 2 }$ norm.
47
+
48
+ We aim to learn the parameters of a stochastic policy $p ( \pi \mid s )$ that given an input set of points $s$ assigns high probabilities to short tours and low probabilities to long tours. Our neural network
49
+
50
+ ![](images/617f6b30f93ad3f6b942335c7b275ae2f57b67551499b6e623f271e6b3996445.jpg)
51
+ Figure 2: A pointer network architecture introduced by (Vinyals et al., 2015b).
52
+
53
+ architecture uses the chain rule to factorize the probability of a tour as
54
+
55
+ $$
56
+ p ( \pi \mid s ) = \prod _ { i = 1 } ^ { n } p \left( \pi ( i ) \mid \pi ( < i ) , s \right) ,
57
+ $$
58
+
59
+ and then uses individual softmax modules to represent each term on the RHS of (2).
60
+
61
+ We are inspired by previous work (Sutskever et al., 2014) that makes use of the same factorization based on the chain rule to address sequence to sequence problems like machine translation. One can use a vanilla sequence to sequence model to address the TSP where the output vocabulary is $\{ 1 , 2 , \ldots , n \}$ . However, there are two major issues with this approach: (1) networks trained in this fashion cannot generalize to inputs with more than $n$ cities. (2) one needs to have access to groundtruth output permutations to optimize the parameters with conditional log-likelihood. We address both isssues in this paper.
62
+
63
+ For generalization beyond a pre-specified graph size, we follow the approach of (Vinyals et al., 2015b), which makes use of a set of non-parameteric softmax modules, resembling the attention mechanism from (Bahdanau et al., 2015). This approach, named pointer network, allows the model to effectively point to a specific position in the input sequence rather than predicting an index value from a fixed-size vocabulary. We employ the pointer network architecture, depicted in Figure 2, as our policy model to parameterize $p ( \pi \mid s )$ .
64
+
65
+ # 3.1 ARCHITECTURE DETAILS
66
+
67
+ Our pointer network comprises two recurrent neural network (RNN) modules, encoder and decoder, both of which consist of Long Short-Term Memory (LSTM) cells (Hochreiter & Schmidhuber, 1997). The encoder network reads the input sequence $s$ , one city at a time, and transforms it into a sequence of latent memory states $\{ e n c _ { i } \} _ { i = 1 } ^ { n }$ where $e n c _ { i } \in \mathbb { R } ^ { d }$ . The input to the encoder network at time step $i$ is a $d$ -dimensional embedding of a 2D point $\mathbf { x } _ { i }$ , which is obtained via a linear transformation of $\mathbf { x } _ { i }$ shared across all input steps. The decoder network also maintains its latent memory states $\{ d e c _ { i } \} _ { i = 1 } ^ { n }$ where $d e c _ { i } \in \mathbb { R } ^ { d }$ and, at each step $i$ , uses a pointing mechanism to produce a distribution over the next city to visit in the tour. Once the next city is selected, it is passed as the input to the next decoder step. The input of the first decoder step (denoted by $\langle g \rangle$ in Figure 2) is a d-dimensional vector treated as a trainable parameter of our neural network.
68
+
69
+ Our attention function, formally defined in Appendix A.1, takes as input a query vector $q = d e c _ { i } \in$ $\mathbb { R } ^ { d }$ and a set of reference vectors $r e f = \{ e n c _ { 1 } , \ldots , e n c _ { k } \}$ where $e n c _ { i } \in \bar { \mathbb { R } } ^ { d }$ , and predicts a distribution $A ( r e f , q )$ over the set of $k$ references. This probability distribution represents the degree to which the model is pointing to reference $r _ { i }$ upon seeing query $q$ .
70
+
71
+ Vinyals et al. (2015a) also suggest including some additional computation steps, named glimpses, to aggregate the contributions of different parts of the input sequence, very much like (Bahdanau et al., 2015). We discuss this approach in details in Appendix A.1. In our experiments, we find that utilizing one glimpse in the pointing mechanism yields performance gains at an insignificant cost latency.
72
+
73
+ # Algorithm 1 Actor-critic training
74
+
75
+ 1: procedure TRAIN(training set $S$ , number of training steps $T$ , batch size $B$ )
76
+ 2: Initialize pointer network params $\theta$
77
+ 3: Initialize critic network params $\theta _ { v }$
78
+ 4: for $t = 1$ to $T$ do
79
+ 5: $s _ { i } \sim \operatorname { S A M P L E I N P U T } ( S )$ for $i \in \{ 1 , \ldots , B \}$
80
+ 6: $\pi _ { i } \sim$ SAMPLESOLUTION $\left( \boldsymbol { p } _ { \boldsymbol { \theta } } ( . | \boldsymbol { s } _ { i } ) \right)$ for $i \in \{ 1 , \ldots , B \}$
81
+ 7: $b _ { i } b _ { \theta _ { v } } ( s _ { i } )$ for $i \in \{ 1 , \ldots , B \}$
82
+ 8: $\begin{array} { r } { g _ { \theta } \frac { 1 } { B } \sum _ { i = 1 } ^ { B } ( L ( \pi _ { i } | s _ { i } ) - b _ { i } ) \nabla _ { \theta } \log p _ { \theta } ( \pi _ { i } | s _ { i } ) } \end{array}$
83
+ 9: $\begin{array} { r } { \mathcal { L } _ { v } \frac { 1 } { B } \sum _ { i = 1 } ^ { B } \| b _ { i } - L ( \pi _ { i } ) \| _ { 2 } ^ { 2 } } \end{array}$
84
+ 10: θ ← ADAM(θ, gθ)
85
+ 11: $\boldsymbol { \theta } _ { v } \gets \mathrm { A D A M } ( \theta _ { v } , \nabla { \theta } _ { v } \mathcal { L } _ { v } )$
86
+ 12: end for
87
+ 13: return θ
88
+ 14: end procedure
89
+
90
+ # 4 OPTIMIZATION WITH POLICY GRADIENTS
91
+
92
+ Vinyals et al. (2015b) proposes training a pointer network using a supervised loss function comprising conditional log-likelihood, which factors into a cross entropy objective between the network’s output probabilities and the targets provided by a TSP solver. Learning from examples in such a way is undesirable for NP-hard problems because (1) the performance of the model is tied to the quality of the supervised labels, (2) getting high-quality labeled data is expensive and may be infeasible for new problem statements, (3) one cares about finding a competitive solution more than replicating the results of another algorithm.
93
+
94
+ By contrast, we believe Reinforcement Learning (RL) provides an appropriate paradigm for training neural networks for combinatorial optimization, especially because these problems have relatively simple reward mechanisms that could be even used at test time. We hence propose to use model-free policy-based Reinforcement Learning to optimize the parameters of a pointer network denoted $\pmb \theta$ . Our training objective is the expected tour length which, given an input graph $s$ , is defined as
95
+
96
+ $$
97
+ J ( \pmb \theta \mid s ) = \mathbb { E } _ { \pi \sim p _ { \theta } ( . \mid s ) } L ( \pi \mid s ) .
98
+ $$
99
+
100
+ During training, our graphs are drawn from a distribution $s$ , and the total training objective involves sampling from the distribution of graphs, i.e. $J ( \pmb \theta ) = \mathbb { E } _ { s \sim S } J ( \pmb \theta \mid s )$ .
101
+
102
+ We resort to policy gradient methods and stochastic gradient descent to optimize the parameters. The gradient of (3) is formulated using the well-known REINFORCE algorithm (Williams, 1992):
103
+
104
+ $$
105
+ \nabla _ { \theta } J ( \theta \mid s ) = \mathbb { E } _ { \pi \sim p _ { \theta } ( . \mid s ) } \Big [ \big ( L ( \pi \mid s ) - b ( s ) \big ) \nabla _ { \theta } \log p _ { \theta } ( \pi \mid s ) \Big ] ,
106
+ $$
107
+
108
+ where $b ( s )$ denotes a baseline function that does not depend on $\pi$ and estimates the expected tour length to reduce the variance of the gradients.
109
+
110
+ By drawing $B$ i.i.d. sample graphs $s _ { 1 } , s _ { 2 } , \ldots , s _ { B } \sim \mathcal { S }$ and sampling a single tour per graph, i.e. $\pi _ { i } \sim p _ { \theta } ( . \mid s _ { i } )$ , the gradient in (4) is approximated with Monte Carlo sampling as follows:
111
+
112
+ $$
113
+ \nabla _ { \theta } J ( \theta ) \approx \frac { 1 } { B } \sum _ { i = 1 } ^ { B } \Big ( L ( \pi _ { i } | s _ { i } ) - b ( s _ { i } ) \Big ) \nabla _ { \theta } \log p _ { \theta } ( \pi _ { i } \mid s _ { i } ) .
114
+ $$
115
+
116
+ A simple and popular choice of the baseline $b ( s )$ is an exponential moving average of the rewards obtained by the network over time to account for the fact that the policy improves with training. While this choice of baseline proved sufficient to improve upon the Christofides algorithm, it suffers from not being able to differentiate between different input graphs. In particular, the optimal tour $\pi ^ { * }$ for a difficult graph $s$ may be still discouraged if $L ( \pi ^ { * } | s ) > b$ because $b$ is shared across all instances in the batch.
117
+
118
+ Using a parametric baseline to estimate the expected tour length $\mathbb { E } _ { \pi \sim p _ { \theta } ( . | s ) } L ( \pi \mid s )$ typically improves learning. Therefore, we introduce an auxiliary network, called a critic and parameterized
119
+
120
+ # Algorithm 2 Active Search
121
+
122
+ 1: procedure ACTIVESEARCH(input s, $\theta$ , number of candidates K, B,
123
+ 2: π ← RANDOMSOLUTION()
124
+ 3: Lπ ← L(π | s)
125
+ 4: n ← d KB e
126
+ 5: for t = 1 . . . n do
127
+ 6: πi ∼ SAMPLESOLUTION(pθ(. | s)) for $i \in \{ 1 , \ldots , B \}$
128
+ 7: j ← ARGMIN(L(π1 | s) . . . L(πB | s))
129
+ 8: Lj ← L(πj | s)
130
+ 9: if Lj < Lπ then
131
+ 10: π ← πj
132
+ 11: Lπ ← Lj
133
+ 12: 13: 14: $\begin{array} { r l } & { \overset { \vartriangle } { \boldsymbol { g } _ { \theta } } \frac { 1 } { B } \sum _ { i = 1 } ^ { B } ( L ( \pi _ { i } \mid \boldsymbol { s } ) - b ) \nabla _ { \theta } \log p _ { \theta } ( \pi _ { i } \mid \boldsymbol { s } ) } \\ & { \overset { \theta \boldsymbol { \mathrm { A D A M } } } { \boldsymbol { b } } + ( 1 - \alpha ) \times ( \frac { 1 } { B } \sum _ { i = 1 } ^ { B } b _ { i } ) } \\ & { \overset { \boldsymbol { b } } { \underset { } { \boldsymbol { b } } } \alpha \times \boldsymbol { b } + ( 1 - \alpha ) \times ( \frac { 1 } { B } \sum _ { i = 1 } ^ { B } b _ { i } ) } \end{array}$
134
+ 15:
135
+ 16: end for
136
+ 17: return $\pi$
137
+ 18: end procedure
138
+
139
+ by $\theta _ { v }$ , to learn the expected tour length found by our current policy $p _ { \theta }$ given an input sequence $s$ The critic is trained with stochastic gradient descent on a mean squared error objective between its predictions $b _ { \theta _ { v } } \left( s \right)$ and the actual tour lengths sampled by the most recent policy. The additional objective is formulated as
140
+
141
+ $$
142
+ \mathcal { L } ( \theta _ { v } ) = \frac { 1 } { B } \sum _ { i = 1 } ^ { B } \left. b _ { \theta _ { v } } ( s _ { i } ) - L ( \pi _ { i } \mid s _ { i } ) \right. _ { 2 } ^ { 2 } .
143
+ $$
144
+
145
+ Critic’s architecture for TSP. We now explain how our critic maps an input sequence $s$ into a baseline prediction $b _ { \theta _ { v } } \left( s \right)$ . Our critic comprises three neural network modules: 1) an LSTM encoder, 2) an LSTM process block and 3) a 2-layer ReLU neural network decoder. Its encoder has the same architecture as that of our pointer network’s encoder and encodes an input sequence $s$ into a sequence of latent memory states and a hidden state $h$ . The process block, similarly to (Vinyals et al., 2015a), then performs $\mathrm { \bf P }$ steps of computation over the hidden state $h$ . Each processing step updates this hidden state by glimpsing at the memory states as described in Appendix A.1 and feeds the output of the glimpse function as input to the next processing step. At the end of the process block, the obtained hidden state is then decoded into a baseline prediction (i.e a single scalar) by two fully connected layers with respectively d and 1 unit(s).
146
+
147
+ Our training algorithm, described in Algorithm 1, is closely related to the asynchronous advantage actor-critic (A3C) proposed in (Mnih et al., 2016), as the difference between the sampled tour lengths and the critic’s predictions is an unbiased estimate of the advantage function. We perform our updates asynchronously across multiple workers, but each worker also handles a mini-batch of graphs for better gradient estimates.
148
+
149
+ # 4.1 SEARCH STRATEGIES
150
+
151
+ As evaluating a tour length is inexpensive, our TSP agent can easily simulate a search procedure at inference time by considering multiple candidate solutions per graph and selecting the best. This inference process resembles how solvers search over a large set of feasible solutions. In this paper, we consider two search strategies detailed below, which we refer to as sampling and active search.
152
+
153
+ Sampling. Our first approach is simply to sample multiple candidate tours from our stochastic policy $p _ { \theta } ( . | s )$ and select the shortest one. In contrast to heuristic solvers, we do not enforce our model to sample different tours during the process. However, we can control the diversity of the sampled tours with a temperature hyperparameter when sampling from our non-parametric softmax (see Appendix A.2). This sampling process yields significant improvements over greedy decoding, which always selects the index with the largest probability. We also considered perturbing the pointing mechanism with random noise and greedily decoding from the obtained modified policy, similarly to (Cho, 2016), but this proves less effective than sampling in our experiments.
154
+
155
+ Table 1: Different learning configurations.
156
+
157
+ <table><tr><td rowspan=1 colspan=1>Configuration</td><td rowspan=1 colspan=1>Learn ontraining data</td><td rowspan=1 colspan=1>Samplingon test set</td><td rowspan=1 colspan=1>Refiningon test set</td></tr><tr><td rowspan=1 colspan=1>RL pretraining-Greedy</td><td rowspan=1 colspan=1>Yes</td><td rowspan=1 colspan=1>No</td><td rowspan=1 colspan=1>No</td></tr><tr><td rowspan=1 colspan=1>Active Search (AS)</td><td rowspan=1 colspan=1>No</td><td rowspan=1 colspan=1>Yes</td><td rowspan=1 colspan=1>Yes</td></tr><tr><td rowspan=1 colspan=1>RL pretraining-Sampling</td><td rowspan=1 colspan=1>Yes</td><td rowspan=1 colspan=1>Yes</td><td rowspan=1 colspan=1>No</td></tr><tr><td rowspan=1 colspan=1>RL pretraining-Active Search</td><td rowspan=1 colspan=1>Yes</td><td rowspan=1 colspan=1>Yes</td><td rowspan=1 colspan=1>Yes</td></tr></table>
158
+
159
+ Active Search. Rather than sampling with a fixed model and ignoring the reward information obtained from the sampled solutions, one can refine the parameters of the stochastic policy $p _ { \theta }$ during inference to minimize $\mathbb { E } _ { \pi \sim p _ { \theta } ( . | s ) } L ( \pi \mid s )$ on a single test input $s$ . This approach proves especially competitive when starting from a trained model. Remarkably, it also produces satisfying solutions when starting from an untrained model. We refer to these two approaches as $R L$ pretraining-Active Search and Active Search because the model actively updates its parameters while searching for candidate solutions on a single test instance.
160
+
161
+ Active Search applies policy gradients similarly to Algorithm 1 but draws Monte Carlo samples over candidate solutions $\pi _ { 1 } \ldots \pi _ { B } \sim p _ { \theta } ( \cdot | s ) $ for a single test input. It resorts to an exponential moving average baseline, rather than a critic, as there is no need to differentiate between inputs. Our Active Search training algorithm is presented in Algorithm 2. We note that while RL training does not require supervision, it still requires training data and hence generalization depends on the training data distribution. In contrast, Active Search is distribution independent. Finally, since we encode a set of cities as a sequence, we randomly shuffle the input sequence before feeding it to our pointer network. This increases the stochasticity of the sampling procedure and leads to large improvements in Active Search.
162
+
163
+ # 5 EXPERIMENTS
164
+
165
+ We conduct experiments to investigate the behavior of the proposed Neural Combinatorial Optimization methods. We consider three benchmark tasks, Euclidean TSP20, 50 and 100, for which we generate a test set of 1, 000 graphs. Points are drawn uniformly at random in the unit square $[ 0 , 1 ] ^ { 2 }$ .
166
+
167
+ # 5.1 EXPERIMENTAL DETAILS
168
+
169
+ Across all experiments, we use mini-batches of 128 sequences, LSTM cells with 128 hidden units, and embed the two coordinates of each point in a 128-dimensional space. We train our models with the Adam optimizer (Kingma & Ba, 2014) and use an initial learning rate of $1 0 ^ { - 3 }$ for TSP20 and TSP50 and $\mathrm { \dot { 1 } 0 ^ { - 4 } }$ for TSP100 that we decay every 5000 steps by a factor of 0.96. We initialize our parameters uniformly at random within $[ - 0 . 0 8 , 0 . 0 8 ]$ and clip the $L 2$ norm of our gradients to 1.0. We use up to one attention glimpse. When searching, the mini-batches either consist of replications of the test sequence or its permutations. The baseline decay is set to $\alpha = 0 . 9 9$ in Active Search. Our model and training code in Tensorflow (Abadi et al., 2016) will be made availabe soon. Table 1 summarizes the configurations and different search strategies used in the experiments. The variations of our method, experimental procedure and results are as follows.
170
+
171
+ Supervised Learning. In addition to the described baselines, we implement and train a pointer network with supervised learning, similarly to (Vinyals et al., 2015b). While our supervised data consists of one million optimal tours, we find that our supervised learning results are not as good as those reported in by (Vinyals et al., 2015b). We suspect that learning from optimal tours is harder for supervised pointer networks due to subtle features that the model cannot figure out only by looking at given supervised targets. We thus refer to the results in (Vinyals et al., 2015b) for TSP20 and TSP50 and report our results on TSP100, all of which are suboptimal compared to other approaches.
172
+
173
+ Table 2: Average tour lengths (lower is better). Results marked (†) are from (Vinyals et al., 2015b).
174
+
175
+ <table><tr><td rowspan="2">Task</td><td rowspan="2">Supervised Learning</td><td colspan="4">RL pretraining</td><td rowspan="2">AS</td><td rowspan="2">Christo -fides</td><td rowspan="2">OR Tools’ local search</td><td rowspan="2">Optimal</td></tr><tr><td>greedy</td><td>greedy@16</td><td>sampling</td><td>AS</td></tr><tr><td>TSP20</td><td>3.88()</td><td>3.89</td><td>1</td><td>3.82</td><td>3.82</td><td>3.96</td><td>4.30</td><td>3.85</td><td>3.82</td></tr><tr><td>TSP50</td><td>6.09(t)</td><td>5.95</td><td>5.80</td><td>5.70</td><td>5.70</td><td>5.87</td><td>6.62</td><td>5.80</td><td>5.68</td></tr><tr><td>TSP100</td><td>10.81</td><td>8.30</td><td>7.97</td><td>7.88</td><td>7.83</td><td>8.19</td><td>9.18</td><td>7.99</td><td>7.77</td></tr></table>
176
+
177
+ RL pretraining. For the RL experiments, we generate training mini-batches of inputs on the fly and update the model parameters with the Actor Critic Algorithm 1. We use a validation set of 10, 000 randomly generated instances for hyper-parameters tuning. Our critic consists of an encoder network which has the same architecture as that of the policy network, but followed by 3 processing steps and 2 fully connected layers. We find that clipping the logits to $[ - 1 0 , 1 0 ]$ with a tanh(·) activation function, as described in Appendix A.2, helps with exploration and yields marginal performance gains. The simplest search strategy using an RL pretrained model is greedy decoding, i.e. selecting the city with the largest probability at each decoding step. We also experiment with decoding greedily from a set of 16 pretrained models at inference time. For each graph, the tour found by each individual model is collected and the shortest tour is chosen. We refer to those approaches as RL pretraining-greedy and RL pretraining-greedy $@ l 6$ .
178
+
179
+ RL pretraining-Sampling. For each test instance, we sample $1 , 2 8 0 , 0 0 0$ candidate solutions from a pretrained model and keep track of the shortest tour. A grid search over the temperature hyperparameter found respective temperatures of 2.0, 2.2 and 1.5 to yield the best results for TSP20, TSP50 and TSP100. We refer to the tuned temperature hyperparameter as $T ^ { * }$ . Since sampling does not require parameter udpates and is entirely parallelizable, we use a larger batch size for speed purposes.
180
+
181
+ RL pretraining-Active Search. For each test instance, we initialize the model parameters from a pretrained RL model and run Active Search for up to 10, 000 training steps with a batch size of 128, sampling a total of 1, 280, 000 candidate solutions. We set the learning rate to a hundredth of the initial learning rate the TSP agent was trained on (i.e. $1 0 ^ { - 5 }$ for TSP20/TSP50 and $1 0 ^ { - 6 }$ for TSP100).
182
+
183
+ Active Search. We allow the model to train much longer to account for the fact that it starts from scratch. For each test graph, we run Active Search for 100, 000 training steps on TSP20/TSP50 and 200, 000 training steps on TSP100.
184
+
185
+ # 5.2 RESULTS AND ANALYSES
186
+
187
+ We compare our methods against 3 different baselines of increasing performance and complexity: 1) Christofides, 2) the vehicle routing solver from OR-Tools (Google, 2016) and 3) optimality. Christofides solutions are obtained in polynomial time and guaranteed to be within a 1.5 ratio of optimality. OR-Tools improves over Christofides’ solutions with simple local search operators, including 2-opt (Johnson, 1990) and a version of the Lin-Kernighan heuristic (Lin & Kernighan, 1973), stopping when it reaches a local minimum. In order to escape poor local optima, ORTools’ local search can also be run in conjunction with different metaheuristics, such as simulated annealing (Kirkpatrick et al., 1983), tabu search (Glover & Laguna, 2013) or guided local search (Voudouris & Tsang, 1999). OR-Tools’ vehicle routing solver can tackle a superset of the TSP and operates at a higher level of generality than solvers that are highly specific to the TSP. While not state-of-the art for the TSP, it is a common choice for general routing problems and provides a reasonable baseline between the simplicity of the most basic local search operators and the sophistication of the strongest solvers. Optimal solutions are obtained via Concorde (Applegate et al., 2006) and LK-H’s local search (Helsgaun, 2012; 2000). While only Concorde provably solves instances to optimality, we empirically find that LK-H also achieves optimal solutions on all of our test sets after 50 trials per graph (which is the default parameter setting).
188
+
189
+ We report the average tour lengths of our approaches on TSP20, TSP50, and TSP100 in Table 2. Notably, results demonstrate that training with RL significantly improves over supervised learning (Vinyals et al., 2015b). All our methods comfortably surpass Christofides’ heuristic, including RL pretraining-Greedy which also does not rely on search. Table 3 compares the running times of our greedy methods to the aforementioned baselines, with our methods running on a single Nvidia Tesla K80 GPU, Concorde and LK-H running on an Intel Xeon CPU E5-1650 v3 3.50GHz CPU and ORTool on an Intel Haswell CPU. We find that both greedy approaches are time-efficient but still quite far from optimality.
190
+
191
+ Table 3: Running times in seconds (s) of greedy methods compared to OR Tool’s local search and solvers that find the optimal solutions. Time is measured over the entire test set and averaged. LK-H was run for 50 trials per graph (the default parameter setting). It is likely that optimal solutions were found in fewer trials, resulting in shorter running times.
192
+
193
+ <table><tr><td rowspan="2">Task</td><td colspan="2">RL pretraining</td><td rowspan="2">OR-Tools&#x27; local search</td><td colspan="2">Optimal</td></tr><tr><td>greedy</td><td>greedy@16</td><td>Concorde</td><td>LK-H</td></tr><tr><td>TSP50</td><td>0.003s</td><td>0.04s</td><td>0.02s</td><td>0.05s</td><td>0.14s</td></tr><tr><td>TSP100</td><td>0.01s</td><td>0.15s</td><td>0.10s</td><td>0.22s</td><td>0.88s</td></tr></table>
194
+
195
+ Table 4: Average tour lengths of RL pretraining-Sampling and RL pretraining-Active Search as they sample more solutions. Corresponding running times on a single Tesla K80 GPU are in parantheses.
196
+
197
+ <table><tr><td rowspan="2">Task</td><td rowspan="2"># Solutions</td><td colspan="3">RL pretraining</td></tr><tr><td>Sampling T =1</td><td>Sampling T =T*</td><td>Active Search</td></tr><tr><td>TSP50</td><td>128 1,280 12,800</td><td>5.80 (3.4s) 5.77 (3.4s) 5.75 (13.8s)</td><td>5.80 (3.4s) 5.75 (3.4s) 5.73 (13.8s)</td><td>5.80 (0.5s) 5.76 (5s) 5.74 (50s)</td></tr><tr><td></td><td>128.000 1,280,000 128</td><td>5.73 (110s) 5.72 (1080s) 8.05 (10.3s) 8.00 (10.3s)</td><td>5.71 (110s) 5.70 (1080s) 8.09 (10.3s) 8.00 (10.3s)</td><td>5.72 (500s) 5.70 (5000s) 8.04 (1.2s)</td></tr><tr><td>TSP100</td><td>1,280 12,800 128,000 1,280,000</td><td>7.95 (31s) 7.92 (265s) 7.89 (2640s)</td><td>7.95 (31s) 7.91 (265s) 7.88 (2640s)</td><td>7.98 (12s) 7.92 (120s) 7.87 (1200s) 7.83 (12000s)</td></tr></table>
198
+
199
+ Searching at inference time proves crucial to get closer to optimality but comes at the expense of longer running times. Fortunately, the search from RL pretraining-Sampling and RL pretrainingActive Search can be stopped early with a small performance tradeoff in terms of the final objective. This can be seen in Table 4, where we show their performances and corresponding running times as a function of how many solutions they consider.
200
+
201
+ We also find that many of our RL pretraining methods outperform OR-Tools’ local search, including RL pretraining-Greedy $@ 1 6$ which runs similarly fast. Table 6 in Appendix A.3 presents the performance of the metaheuristics as they consider more solutions and the corresponding running times. In our experiments, Neural Combinatorial proves superior than Simulated Annealing but is slightly less competitive that Tabu Search and much less so than Guided Local Search.
202
+
203
+ We present a more detailed comparison of our methods in Figure 3, where we sort the ratios to optimality of our different learning configurations. RL pretraining-Sampling and RL pretrainingActive Search are the most competitive Neural Combinatorial Optimization methods and recover the optimal solution in a significant number of our test cases. We find that for small solution spaces, RL pretraining-Sampling, with a finetuned softmax temperature, outperforms RL pretraining-Active Search with the latter sometimes orienting the search towards suboptimal regions of the solution space (see TSP50 results in Table 4 and Figure 3). Furthermore, RL pretraining-Sampling benefits from being fully parallelizable and runs faster than RL pretraining-Active Search. However, for larger solution spaces, RL-pretraining Active Search proves superior both when controlling for the number of sampled solutions or the running time. Interestingly, Active Search - which starts from an untrained model - also produces competitive tours but requires a considerable amount of time (respectively 7 and 25 hours per instance of TSP50/TSP100). Finally, we show randomly picked example tours found by our methods in Figure 4 in Appendix A.4.
204
+
205
+ ![](images/2fbc96e10b80d35ec853e691c0d69a285dbaa6933ef81b6a838aea1d234ce2bc.jpg)
206
+ Figure 3: Sorted tour length ratios to optimality
207
+
208
+ # 6 GENERALIZATION TO OTHER PROBLEMS
209
+
210
+ In this section, we discuss how to apply Neural Combinatorial Optimization to other problems than the TSP. In Neural Combinatorial Optimization, the model architecture is tied to the given combinatorial optimization problem. Examples of useful networks include the pointer network, when the output is a permutation or a truncated permutation or a subset of the input, and the classical seq2seq model for other kinds of structured outputs. For combinatorial problems that require to assign labels to elements of the input, such as graph coloring, it is also possible to combine a pointer module and a softmax module to simultaneously point and assign at decoding time. Given a model that encodes an instance of a given combinatorial optimization task and repeatedly branches into subtrees to construct a solution, the training procedures described in Section 4 can then be applied by adapting the reward function depending on the optimization problem being considered.
211
+
212
+ Additionally, one also needs to ensure the feasibility of the obtained solutions. For certain combinatorial problems, it is straightforward to know exactly which branches do not lead to any feasible solutions at decoding time. We can then simply manually assign them a zero probability when decoding, similarly to how we enforce our model to not point at the same city twice in our pointing mechanism (see Appendix A.1). However, for many combinatorial problems, coming up with a feasible solution can be a challenge in itself. Consider, for example, the Travelling Salesman Problem with Time Windows, where the travelling salesman has the additional constraint of visiting each city during a specific time window. It might be that most branches being considered early in the tour do not lead to any solution that respects all time windows. In such cases, knowing exactly which branches are feasible requires searching their subtrees, a time-consuming process that is not much easier than directly searching for the optimal solution unless using problem-specific heuristics.
213
+
214
+ Rather than explicitly constraining the model to only sample feasible solutions, one can also let the model learn to respect the problem’s constraints. A simple approach, to be verified experimentally in future work, consists in augmenting the objective function with a term that penalizes solutions for violating the problem’s constraints, similarly to penalty methods in constrained optimization. While this does not guarantee that the model consistently samples feasible solutions at inference time, this is not necessarily problematic as we can simply ignore infeasible solutions and resample from the model (for RL pretraining-Sampling and RL-pretraining Active Search). It is also conceivable to combine both approaches by assigning zero probabilities to branches that are easily identifiable as infeasible while still penalizing infeasible solutions once they are entirely constructed.
215
+
216
+ # 6.1 KNAPSACK EXAMPLE
217
+
218
+ As an example of the flexibility of Neural Combinatorial Optimization, we consider the KnapSack problem, another intensively studied problem in computer science. Given a set of $n$ items $i = 1 . . . n$ each with weight $w _ { i }$ and value $v _ { i }$ and a maximum weight capacity of $W$ , the 0-1 KnapSack problem consists in maximizing the sum of the values of items present in the knapsack so that the sum of the weights is less than or equal to the knapsack capacity:
219
+
220
+ $$
221
+ \begin{array} { r l } { \underset { S \subseteq \{ 1 , 2 , \ldots , n \} } { \mathrm { m a x } } } & { \displaystyle \sum _ { i \in S } v _ { i } } \\ { \mathrm { s u b j e c t ~ t o } } & { \displaystyle \sum _ { i \in S } w _ { i } \leq W } \end{array}
222
+ $$
223
+
224
+ With $w _ { i }$ , $v _ { i }$ and $W$ taking real values, the problem is NP-hard (Kellerer et al., 2004). A naive heuristic is to take the items ordered by their weight-to-value ratios until they fill up the weight capacity. Two simple heuristics are ExpKnap, which employs branch-and-bound with Linear Programming bounds (Pisinger, 1995), and MinKnap, which uses dynamic programming with enumerative bounds (Pisinger, 1997). Exact solutions can also be obtained by quantizing the weights to high precisions and then performing dynamic programming with pseudo-polynomial complexity (Bertsimas & Demir, 2002).
225
+
226
+ We apply the pointer network and encode each KnapSack instance as a sequence of 2D vectors $( w _ { i } , v _ { i } )$ . At decoding time, the pointer network points to items to include in the knapsack and stops when the total weight of the items collected so far exceeds the weight capacity. We generate three datasets, KNAP50, KNAP100 and KNAP200, of a thousand instances with items’ weights and values drawn uniformly at random in [0, 1]. Without loss of generality (since we can scale the items’ weights), we set the capacities to 12.5 for KNAP50 and 25 for KNAP100 and KNAP200. We present the performances of RL pretraining-Greedy and Active Search (which we run for 5, 000 training steps) in Table 5 and compare them to the following baselines: 1) random search (which we let sample as many feasible solutions seen by Active Search), 2) the greedy value-to-weight ratio heuristic, 3) MinKnap, 4) ExpKnap, 5) OR-Tools’ KnapSack solver (Google, 2016) and 6) optimality (which we obtained by quantizing the weights to high precisions and using dynamic programming).
227
+
228
+ Table 5: Results of RL pretraining-Greedy and Active Search on KnapSack (higher is better).
229
+
230
+ <table><tr><td>Task</td><td>RL pretraining greedy</td><td>Active Search</td><td>Random Search</td><td>Greedy</td><td>MinKnap / ExpKnap /OR-Tools</td><td>Optimal</td></tr><tr><td>KNAP50</td><td>19.86</td><td>20.07</td><td>17.91</td><td>19.24</td><td>20.07</td><td>20.07</td></tr><tr><td>KNAP100</td><td>40.27</td><td>40.50</td><td>33.23</td><td>38.53</td><td>40.50</td><td>40.50</td></tr><tr><td>KNAP200</td><td>57.10</td><td>57.45</td><td>35.95</td><td>55.42</td><td>57.45</td><td>57.45</td></tr></table>
231
+
232
+ # 7 CONCLUSION
233
+
234
+ This paper presents Neural Combinatorial Optimization, a framework to tackle combinatorial optimization with reinforcement learning and neural networks. We focus on the traveling salesman problem (TSP) and present a set of results for each variation of the framework. Experiments demonstrate that Neural Combinatorial Optimization achieves close to optimal results on 2D Euclidean graphs with up to 100 nodes. Our results, while still far from the strongest solvers (especially those which are optimized for one problem), provide an interesting research avenue for using neural networks as a general tool for tackling combinatorial optimization problems.
235
+
236
+ # ACKNOWLEDGMENTS
237
+
238
+ The authors would like to thank Vincent Furnon, Mustafa Ispir, Lukasz Kaiser, Oriol Vinyals, Barret Zoph, the Google Brain team and the anonymous ICLR reviewers for insightful comments and discussion.
239
+
240
+ # REFERENCES
241
+
242
+ 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. arXiv preprint arXiv:1605.08695, 2016.
243
+
244
+ Sreeram V. B. Aiyer, Mahesan Niranjan, and Frank Fallside. A theoretical investigation into the performance of the Hopfield model. IEEE Transactions on Neural Networks, 1(2):204–215, 1990.
245
+
246
+ Bernard Angeniol, Gael De La Croix Vaubois, and Jean-Yves Le Texier. Self-organizing feature maps and the Travelling Salesman Problem. Neural Networks, 1(4):289–293, 1988.
247
+
248
+ David Applegate, Robert Bixby, Vasek Chv ˇ atal, and William Cook. Implementing the dantzig- ´ fulkerson-johnson algorithm for large traveling salesman problems. Mathematical programming, 2003.
249
+
250
+ David L Applegate, Robert E Bixby, Vasek Chvatal, and William J Cook. Concorde tsp solver, 2006. URL www.math.uwaterloo.ca/tsp/concorde.
251
+
252
+ David L Applegate, Robert E Bixby, Vasek Chvatal, and William J Cook. The traveling salesman problem: a computational study. Princeton university press, 2011.
253
+
254
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In ICLR, 2015.
255
+
256
+ Dimitris Bertsimas and Ramazan Demir. An approximate dynamic programming approach to multidimensional knapsack problems. Management Science, 48(4):550–565, 2002.
257
+
258
+ Edmund Burke, Graham Kendall, Jim Newall, Emma Hart, Peter Ross, and Sonia Schulenburg. Hyperheuristics: An emerging direction in modern search technology. Springer, 2003.
259
+
260
+ Edmund K. Burke, Michel Gendreau, Matthew R. Hyde, Graham Kendall, Gabriela Ochoa, Ender zcan, and Rong Qu. Hyper-heuristics: a survey of the state of the art. JORS, 64(12):1695–1724, 2013.
261
+
262
+ Laura I. Burke. Neural methods for the Traveling Salesman Problem: insights from operations research. Neural Networks, 7(4):681–690, 1994.
263
+
264
+ Kyunghyun Cho. Noisy parallel approximate decoding for conditional recurrent language model. arXiv preprint arXiv:1605.03835, 2016.
265
+
266
+ Nicos Christofides. Worst-case analysis of a new heuristic for the Travelling Salesman Problem. In Report 388. Graduate School of Industrial Administration, CMU, 1976.
267
+
268
+ George Dantzig, Ray Fulkerson, and Selmer Johnson. Solution of a large-scale traveling-salesman problem. Journal of the operations research society of America, 1954.
269
+
270
+ Richard Durbin. An analogue approach to the Travelling Salesman. Nature, 326:16, 1987.
271
+
272
+ Favio Favata and Richard Walker. A study of the application of Kohonen-type neural networks to the travelling salesman problem. Biological Cybernetics, 64(6):463–468, 1991.
273
+
274
+ J. C. Fort. Solving a combinatorial problem via self-organizing process: an application of the Kohonen algorithm to the traveling salesman problem. Biological Cybernetics, 59(1):33–40, 1988.
275
+
276
+ Andrew Howard Gee. Problem solving with optimization networks. PhD thesis, Citeseer, 1993.
277
+
278
+ Fred Glover and Manuel Laguna. Tabu Search. Springer, 2013.
279
+
280
+ Google. Or-tools, google optimization tools, 2016. URL https://developers.google. com/optimization.
281
+
282
+ Keld Helsgaun. An effective implementation of the Lin-Kernighan traveling salesman. European Journal of Operational Research, 126:106–130, 2000.
283
+
284
+ Keld Helsgaun. LK-H, 2012. URL http://akira.ruc.dk/˜keld/research/LKH/.
285
+
286
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. Neural Computations, 1997.
287
+
288
+ John J. Hopfield and David W. Tank. ”Neural” computation of decisions in optimization problems. Biological Cybernetics, 52(3):141–152, 1985.
289
+
290
+ DS Johnson. Local search and the traveling salesman problem. In Proceedings of 17th International Colloquium on Automata Languages and Programming, Lecture Notes in Computer Science,(Springer-Verlag, Berlin, 1990), pp. 443–460, 1990.
291
+
292
+ Hans Kellerer, Ulrich Pferschy, and David Pisinger. Knapsack Problems. Springer-Verlag Berlin Heidelberg, 2004.
293
+
294
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR, 2014.
295
+
296
+ S. Kirkpatrick, C. D. Gelatt, and M. P. Vecchi. Optimization by simulated annealing. SCIENCE, 220, 1983.
297
+
298
+ Teuvo Kohonen. The self-organizing map. Proceedings of the IEEE, 78(9):1464–1480, 1990.
299
+
300
+ Bert F. J. La Maire and Valeri M. Mladenov. Comparison of neural networks for solving the Travelling Salesman Problem. In NEUREL, pp. 21–24. IEEE, 2012.
301
+
302
+ S. Lin and B. W. Kernighan. An effective heuristic algorithm for the traveling-salesman problem. Operations Research, 21(2):498–516, 1973.
303
+
304
+ Volodymyr Mnih, Adri Puigdomnech Badia, Mehdi Mirza, Alex Graves, Timothy P. Lillicrap, Tim Harley, David Silver, and Koray Kavukcuoglu. Asynchronous methods for deep reinforcement learning. arXiv preprint arXiv:1605.03835, 2016.
305
+
306
+ Manfred Padberg and Giovanni Rinaldi. A branch-and-cut algorithm for the resolution of largescale symmetric traveling salesman problems. Society for Industrial and Applied Mathematics, 33:60–100, 1990.
307
+
308
+ Christos H. Papadimitriou. The Euclidean Travelling Salesman Problem is NP-complete. Theoretical Computer Science, 4(3):237–244, 1977.
309
+
310
+ David Pisinger. An expanding-core algorithm for the exact 0-1 knapsack problem european journal of operational research. European Journal of Operational Research, pp. 175–187, 1995.
311
+
312
+ David Pisinger. A minimal algorithm for the 0-1 knapsack problem. Operations Research, pp. 758–767, 1997.
313
+
314
+ Farah Sarwar and Abdul Aziz Bhatti. Critical analysis of Hopfield’s neural network model for TSP and its comparison with heuristic algorithm for shortest path computation. In IBCAST, 2012.
315
+
316
+ Kate A. Smith. Neural networks for combinatorial optimization: a review of more than a decade of research. INFORMS Journal on Computing, 1999.
317
+
318
+ 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.
319
+
320
+ Andrew I. Vakhutinsky and Bruce L. Golden. A hierarchical strategy for solving traveling salesman problems using elastic nets. Journal of Heuristics, 1(1):67–76, 1995.
321
+
322
+ Oriol Vinyals, Samy Bengio, and Manjunath Kudlur. Order matters: Sequence to sequence for sets. arXiv preprint arXiv:1511.06391, 2015a.
323
+
324
+ Oriol Vinyals, Meire Fortunato, and Navdeep Jaitly. Pointer networks. In Advances in Neural Information Processing Systems, pp. 2692–2700, 2015b.
325
+
326
+ Christos Voudouris and Edward Tsang. Guided local search and its application to the traveling salesman problem. European journal of operational research, 1999.
327
+
328
+ Ronald Williams. Simple statistical gradient following algorithms for connectionnist reinforcement learning. In Machine Learning, 1992.
329
+
330
+ G. V. Wilson and G. S. Pawley. On the stability of the travelling salesman problem algorithm of hopfield and tank. Biological Cybernetics, 58(1):63–70, 1988.
331
+
332
+ D. H. Wolpert and W. G. Macready. No free lunch theorems for optimization. Transactions on Evolutionary Computation, 1(1):67–82, April 1997.
333
+
334
+ Chen Yutian, Hoffman Matthew W., Colmenarejo Sergio Gomez, Denil Misha, Lillicrap Timothy P., and de Freitas Nando. Learning to learn for global optimization of black box functions. arXiv preprint arXiv:1611.03824, 2016.
335
+
336
+ Barret Zoph and Quoc Le. Neural architecture search with reinforcement learning. arXiv preprint arXiv:1611.01578, 2016.
337
+
338
+ # A APPENDIX
339
+
340
+ # A.1 POINTING AND ATTENDING
341
+
342
+ Pointing mechanism: Its computations are parameterized by two attention matrices $W _ { r e f } , W _ { q } \in$ $\mathbb { R } ^ { d \times d }$ and an attention vector $v \in \mathbb { R } ^ { d }$ as follows:
343
+
344
+ $$
345
+ \begin{array} { r l } & { { u _ { i } } = \left\{ \begin{array} { l l } { { v ^ { \top } } \cdot \operatorname { t a n h } \left( { W _ { r e f } } \cdot { r _ { i } } + { W _ { q } } \cdot q \right) } & { \mathrm { i f ~ } i \ne \pi ( j ) \mathrm { ~ f o r ~ a l l ~ } j < i } \\ { - \infty } & { \mathrm { o t h e r w i s e } } \end{array} \right. \mathrm { f o r ~ } i = 1 , 2 , . . . , k } \\ & { A ( r e f , q ; W _ { r e f } , W _ { q } , v ) \stackrel { \mathrm { d e f } } { = } s o f t m a x ( u ) . } \end{array}
346
+ $$
347
+
348
+ Our pointer network, at decoder step $j$ , then assigns the probability of visiting the next point $\pi ( j )$ of the tour as follows:
349
+
350
+ $$
351
+ p ( \pi ( j ) | \pi ( < j ) , s ) \stackrel { \mathrm { d e f } } { = } A ( e n c _ { 1 : n } , d e c _ { j } ) .
352
+ $$
353
+
354
+ Setting the logits of cities that already appeared in the tour to $- \infty$ , as shown in Equation 8, ensures that our model only points at cities that have yet to be visited and hence outputs valid TSP tours.
355
+
356
+ Attending mechanism: Specifically, our glimpse function $G ( r e f , q )$ takes the same inputs as the attention function $A$ and is parameterized by $\bar { W } _ { r e f } ^ { g } , W _ { q } ^ { g } \in \mathbb { R } ^ { \bar { d } \times \bar { d } }$ and $v ^ { g } \in \mathbb { R } ^ { d }$ . It performs the following computations:
357
+
358
+ $$
359
+ \begin{array} { l } { { \displaystyle p = A ( r e f , q ; W _ { r e f } ^ { g } , W _ { q } ^ { g } , v ^ { g } ) } } \\ { { \displaystyle G ( r e f , q ; W _ { r e f } ^ { g } , W _ { q } ^ { g } , v ^ { g } ) \stackrel { \mathrm { d e f } } { = } \sum _ { i = 1 } ^ { k } r _ { i } p _ { i } . } } \end{array}
360
+ $$
361
+
362
+ The glimpse function $G$ essentially computes a linear combination of the reference vectors weighted by the attention probabilities. It can also be applied multiple times on the same reference set $r e f$ :
363
+
364
+ $$
365
+ \begin{array} { l } { g _ { 0 } \stackrel { \mathrm { d e f } } { = } q } \\ { g _ { l } \stackrel { \mathrm { d e f } } { = } G ( r e f , g _ { l - 1 } ; W _ { r e f } ^ { g } , W _ { q } ^ { g } , v ^ { g } ) } \end{array}
366
+ $$
367
+
368
+ Finally, the ultimate $g _ { l }$ vector is passed to the attention function $A ( r e f , g _ { l } ; W _ { r e f } , W _ { q } , v )$ to produce the probabilities of the pointing mechanism. We observed empirically that glimpsing more than once with the same parameters made the model less likely to learn and barely improved the results.
369
+
370
+ # A.2 IMPROVING EXPLORATION
371
+
372
+ Softmax temperature: We modify Equation 9 as follows:
373
+
374
+ $$
375
+ A ( r e f , q , T ; W _ { r e f } , W _ { q } , v ) \stackrel { \mathrm { d e f } } { = } s o f t m a x ( u / T ) ,
376
+ $$
377
+
378
+ where $T$ is a temperature hyperparameter set to $T = 1$ during training. When $T > 1$ , the distribution represented by $A ( r e f , q )$ becomes less steep, hence preventing the model from being overconfident.
379
+
380
+ Logit clipping: We modify Equation 9 as follows:
381
+
382
+ $$
383
+ A ( r e f , q ; W _ { r e f } , W _ { q } , v ) \stackrel { \mathrm { d e f } } { = } s o f t m a x ( C \operatorname { t a n h } ( u ) ) ,
384
+ $$
385
+
386
+ where $C$ is a hyperparameter that controls the range of the logits and hence the entropy of $A ( r e f , q )$
387
+
388
+ # A.3 OR TOOL’S METAHEURISTICS BASELINES FOR TSP
389
+
390
+ Table 6: Performance of OR-Tools’ metaheuristics as they consider more solutions. Corresponding running times in seconds (s) on a single Intel Haswell CPU are in parantheses.
391
+
392
+ <table><tr><td rowspan=1 colspan=1>Task</td><td rowspan=1 colspan=1>#Solutions</td><td rowspan=1 colspan=1>Simulated Annealing</td><td rowspan=1 colspan=1>Tabu Search</td><td rowspan=1 colspan=1>Guided Local Search</td></tr><tr><td rowspan=4 colspan=1>TSP50</td><td rowspan=4 colspan=1>11281,28012,800128.0001,280,000</td><td rowspan=2 colspan=1>6.62 (0.03s)5.81 (0.24s)</td><td rowspan=1 colspan=1>6.62 (0.03s)</td><td rowspan=4 colspan=1>6.62 (0.03s)5.76 (0.5s)5.69 (5s)5.68 (48s)5.68 (450s)5.68 (4530s)</td></tr><tr><td rowspan=1 colspan=1>5.79 (3.4s)</td></tr><tr><td rowspan=2 colspan=1>5.81 (4.2s)5.81 (44s)5.81 (460s)5.81 (3960s)</td><td rowspan=1 colspan=1>5.73 (36s)5.69 (330s)</td></tr><tr><td rowspan=1 colspan=1>5.68 (3200s)5.68 (29650s)</td></tr><tr><td rowspan=2 colspan=1>TSP100</td><td rowspan=2 colspan=1>11281,28012,800128.0001,280,000</td><td rowspan=2 colspan=1>9.18 (0.07s)8.00 (0.67s)7.99 (15.7s)7.99 (166s)7.99 (1650s)7.99 (15810s)</td><td rowspan=1 colspan=1>9.18 (0.07s)7.99 (15.3s)</td><td rowspan=2 colspan=1>9.18 (0.07s)7.94 (1.44s)7.84 (18.4s)7.77 (182s)7.77 (1740s)7.77 (16150s)</td></tr><tr><td rowspan=1 colspan=1>7.93 (255s)7.84 (2460s)7.79 (22740s)7.78 (208230s)</td></tr></table>
393
+
394
+ # A.4 SAMPLE TOURS
395
+
396
+ ![](images/cf80da1b4bfc812d8683181d0df5aa70e02d9a19ab9a78d326884784f5fcf757.jpg)
397
+ Figure 4: Sample tours. Top: TSP50; Bottom: TSP100.
md/train/rkA1f3NpZ/rkA1f3NpZ.md ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ENSEMBLE METHODS AS A DEFENSE TO ADVERSARIAL PERTURBATIONS AGAINST DEEP NEURAL NETWORKS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Deep learning has become the state of the art approach in many machine learning problems such as classification. It has recently been shown that deep learning is highly vulnerable to adversarial perturbations. Taking the camera systems of self-driving cars as an example, small adversarial perturbations can cause the system to make errors in important tasks, such as classifying traffic signs or detecting pedestrians. Hence, in order to use deep learning without safety concerns a proper defense strategy is required. We propose to use ensemble methods as a defense strategy against adversarial perturbations. We find that an attack leading one model to misclassify does not imply the same for other networks performing the same task. This makes ensemble methods an attractive defense strategy against adversarial attacks. We empirically show for the MNIST and the CIFAR-10 data sets that ensemble methods not only improve the accuracy of neural networks on test data but also increase their robustness against adversarial perturbations.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ In recent years, deep neural networks (DNNs) led to significant improvements in many areas ranging from computer vision (Krizhevsky et al., 2012; LeCun et al., 2015) to speech recognition (Hinton et al., 2012; Dahl et al., 2012). Some applications that can be solved with DNNs are sensitive from the security perspective, for example camera systems of self driving cars for detecting traffic signs or pedestrians (Papernot et al., 2016b; Sermanet & LeCun, 2011). Recently, it has been shown that DNNs can be highly vulnerable to adversaries (Szegedy et al., 2013; Goodfellow et al., 2014; Papernot et al., 2016a;b). The adversary produces some kind of noise on the input of the system to mislead its output behavior, producing undesirable outcomes or misclassification. Adversarial perturbations are carefully chosen in order to be hard, if not impossible, to be detected by the human eye (see figure 1). Attacks occur after the training of the DNN is completed. Furthermore, it has been shown that the exact structure of the DNN does not need to be known in order to mislead the system as one can send inputs to the unknown system in order to record its outputs to train a new DNN that imitates its behavior (Papernot et al., 2016b). Hence, in this manuscript it is assumed that the DNN and all its parameters are fully known to the adversary.
12
+
13
+ There are many methods on how to attack neural networks appearing in the literature. Some of the most well-known ones are the Fast Gradient Sign Method (Goodfellow et al., 2014) and its iterative extension (Kurakin et al., 2016), DeepFool (Moosavi-Dezfooli et al., 2016), Jacobian-Based Saliency Map Attack (Papernot et al., 2016c), and the L-BFGS Attack (Szegedy et al., 2013). This shows the need of building neural networks that are themselves robust against any kind of adversarial perturbations.
14
+
15
+ Novel methods on defending against adversarial attacks are appearing more and more frequently in the literature. Some of those defense methods are to train the network with different kinds of adversarially perturbated training data (Goodfellow et al., 2014; Papernot et al., 2016c), the use of distillation to reduce the effectiveness of the perturbation (Papernot et al., 2016d) or to apply denoising autoencoders to preprocess the data used by the DNN (Gu & Rigazio, 2014). It also has been noted that adversarial attacks can be detected (Metzen et al., 2017; Feinman et al., 2017), but these detection systems are again vulnerable to adversarial attacks. To our knowledge, there is no method that can reliably defend or detect all kinds of adversarial attacks.
16
+
17
+ ![](images/9127e1674e35706ff747ebc18841ec99f6de0fdc31a8d2546cb04ce3a3c7f351.jpg)
18
+ Figure 1: The first line shows original and correctly classified MNIST test data images. In the second line are the corresponding adversarial BIM attacks on a single classifier ( $\epsilon = 0 . 2$ , $\alpha = 0 . 0 2 5$ , $n = 8$ ) which predicts (from left to right): 6, 8, 1, 5, 9, 3, 0, 2, 2, and 4. Analogously, the third line corresponds to correctly predicted examples of the CIFAR-10 test data set. In the bottom line are the corresponding adversarial BIM attacks on a single classifier $\epsilon = 0 . 0 2$ , $\alpha = 0 . 0 0 2 5$ , $n = 8$ ) which predicts (from left to right): deer, cat, deer, ship, bird, deer, deer, frog, automobile, and automobile.
19
+
20
+ In this manuscript, ensemble methods are used to obtain a classification system that is more robust against adversarial perturbations. The term ensemble method refers to constructing a set of classifiers used to classify new data points by the weighted or unweighted average of their predictions. Many ensemble methods have been introduced in the literature such as Bayesian averaging, Bagging (Breiman, 1996) and boosting (Dietterich et al., 2000). These methods frequently win machine learning competitions, for example the Netflix prize (Koren, 2009). Initial results on using ensembles of classifiers in adversarial context can be found in (Abbasi & Gagne, 2017; He et al., 2017). ´ However, to the best of our knowledge this is the first manuscript that empirically evaluates the robustness of ensemble methods to adversarial perturbations.
21
+
22
+ One advantage of using ensemble methods as defense against adversarial perturbations is that they also increase the accuracy on unperturbed test data. This is not the case in general for other defense methods (see Table 4). However, in most applications a perturbated input can be considered as exception. Hence, it is desirable to obtain a state of the art result on unperturbed test data while making the model more robust against adversarial attacks. Another advantage is that ensemble methods can easily be combined with other defense mechanisms to improve the robustness against adversarial perturbations further (see Table 4). However, the advantages come at a cost of an increase of computational complexity and memory requirements which are proportional to the number of classifiers in the ensemble.
23
+
24
+ This paper is organized as follows: In section 2, some methods for producing adversarial perturbations are briefly introduced. Section 3 describes the defense strategy proposed in this manuscript. In section 4, the previous methods are tested on the MNIST and CIFAR-10 data sets and are compared to other defense strategies appearing in the literature. Finally, in section 5 the conclusions are presented.
25
+
26
+ # 2 ADVERSARIAL ATTACK
27
+
28
+ In this section, two methods for producing adversarial attacks shall be briefly described. In the following, let $\theta$ be the parameters of a model, $x$ the input of the model and $y$ the output value associated with the input value $x$ . Further, let $J ( \theta , x , y )$ be the cost function used to train the DNN.
29
+
30
+ # FAST GRADIENT SIGN METHOD
31
+
32
+ The fast gradient sign method (FGSM) by Goodfellow et al. (2014) simply adds some small perturbations of size $\epsilon > 0$ to the input $x$ ,
33
+
34
+ $$
35
+ x _ { \mathrm { F G S M } } = x + \epsilon \mathrm { s i g n } [ \nabla _ { x } J ( \theta , x , y ) ] ,
36
+ $$
37
+
38
+ where the gradient $\nabla _ { x } J ( \theta , x , y )$ can be computed using backpropagation. This relatively cheap and simple adversarial perturbation performs well on many DNNs. It is believed that this behavior is due to linear elements such as ReLUs or maxout networks in the DNNs (Goodfellow et al., 2014).
39
+
40
+ # BASIC ITERATIVE METHOD
41
+
42
+ The basic iterative method (BIM) by Kurakin et al. (2016) is an iterative extension of FGSM. The idea is to choose $\epsilon \geq \alpha > 0$ and then apply some perturbations similar to FGSM to the input $x$ and repeat the process $n$ times:
43
+
44
+ $$
45
+ \begin{array} { r l } & { x _ { 0 } = x , } \\ & { x _ { i } = \mathrm { c l i p } _ { x , \epsilon } \left( x _ { i - 1 } + \alpha \mathrm { s i g n } [ \nabla _ { x _ { i - 1 } } J ( \theta , x _ { i - 1 } , y ) ] \right) , } \\ & { x _ { \mathrm { B I M } } = x _ { n } . } \end{array}
46
+ $$
47
+
48
+ Here, $\mathrm { c l i p } _ { x , \epsilon } ( \cdot )$ refers to clipping the values of the adversarial sample so that they remain within an $\epsilon$ -neighborhood of $x$ .
49
+
50
+ # 3 ENSEMBLE METHODS
51
+
52
+ Ensemble methods are widely used to improve classifiers in supervised learning (Dietterich et al., 2000). The idea is to construct a set of classifiers that is used to classify a new data point by the weighted or unweighted average of their predictions. In order for an ensemble to outperform a single classifier it must be both accurate and diverse (Hansen & Salamon, 1990). A classifier is said to be accurate if it is better than random guessing, and a set of classifiers is said to be diverse if different classifiers make different errors on new data points.
53
+
54
+ As expected, when performing adversarial perturbations on new data points different classifiers perform quite differently on these points. Hence, we conclude that diversity on adversarial perturbations is given. Furthermore, for adversarial perturbations with small $\epsilon > 0$ , the vast majority of classifiers was accurate. In other words, for any small $\epsilon > 0$ , we could not find an adversarial attack that would turn the majority of classifiers into non-accurate classifiers.
55
+
56
+ In section 4, the following ensemble methods are used. Note that random initialization of the model parameters is used in all methods.
57
+
58
+ (i) The first method is to train multiple classifiers with the same network architecture but with random initial weights. This results in quite diverse classifiers with different final weights (Kolen & Pollack, 1991).
59
+ (ii) The second method is to train multiple classifiers with different but similar network architectures to ensure obtaining a set of even more diverse classifiers. That is, extra filters are used in one classifier or an extra convolution layer is added to another classifier.
60
+ (iii) Third, Bagging (Breiman, 1996) is used on the training data. The term Bagging is derived from bootstrap aggregation and it consists of drawing $m$ samples with replacement from the training data set of $m$ data points. Each of these new data sets is called a bootstrap replicate. At average each of them contains $6 3 . 2 \%$ of the training data, where many data points are repeated in the bootstrap replicates. A different bootstrap replicate is used as training data for each classifier in the ensemble.
61
+ (iv) The last method is to add some small Gaussian noise to the training data so that all classifiers are trained on similar but different training sets. Note that adding Gaussian noise to the training data also makes each classifier somewhat more robust against adversarial perturbations.
62
+
63
+ Once an ensemble of classifiers is trained, it predicts by letting each classifier vote for a label. More specifically, the predicted value is chosen to be the label that maximizes the average of the output probabilities from the classifiers in the ensemble.
64
+
65
+ In order to attack a network with the methods from section 2 the gradient $\nabla _ { x } J ( \theta , x , y )$ must be computed. However, obtaining the gradient for an ensemble requires to calculate the gradient of each of its classifiers. Nevertheless, the following two methods are used to estimate the gradient of an ensemble, which are referred to as Grad. 1 and Grad. 2 for the rest of this manuscript:
66
+
67
+ Grad. 1 Use $\nabla _ { x } J ( \theta _ { i } , x , y )$ of the $i$ -th classifier. This is clearly not the correct gradient for an ensemble. But the question is whether an attack with this gradient can already mislead all classifiers in the ensemble in a similar manner.
68
+ Grad. 2 Compute the average of the gradients $\begin{array} { r } { \frac { 1 } { n } \sum _ { i } \nabla _ { x } J ( \theta _ { i } , x , y ) \ } \end{array}$ from all classifiers in the ensemble.
69
+
70
+ A comparison of the effects of these two gradients for attacking ensembles can be found in section 4.
71
+
72
+ # 4 EXPERIMENTS
73
+
74
+ In this section the ensemble methods from section 3 are empirically evaluated on the MNIST (LeCun et al., 1998) and the CIFAR-10 (Krizhevsky & Hinton, 2009) data sets which are scaled to the unit interval. All experiments have been performed on ensembles of 10 classifiers. Note that this choice has been done for comparability. That is, in some cases the best performance was already reached with ensembles of less classifiers while in others more classifiers might improve the results.
75
+
76
+ A summary of the experimental results can be found in Table 2 and the corresponding visualization in Figure 2. A comparison of ensembles with other defense methods and a combination of those with ensembles can be found in Table 4. In the following all FGSM perturbations are done with $\epsilon = 0 . 3$ on MNIST and with $\epsilon = 0 . 0 3$ on CIFAR-10. Furthermore, all BIM perturbations are done with $\epsilon = 0 . 2$ , $\alpha = 0 . 0 2 5$ and $n = 8$ iterations on MNIST and with $\epsilon = 0 . 0 2$ , $\alpha = 0 . 0 0 2 5$ and $n = 8$ on CIFAR-10. The abbreviations in Table 2 and in Figure 2 shall be interpreted in the following way: Rand. Ini. refers to random initialization of the weights of the neural network, Mix. Mod. means that the network architecture was slightly different for each classifier in an ensemble, Bagging refers to classifiers trained on bootstrap replicates of the training data, and Gauss noise implies that small Gaussian noise has been added to the training data. Each ensemble is attacked with FGSM and BIM based on the gradients from Grad. 1 and Grad. 2. In Table 2, the term Single refers to evaluating a single classifier.
77
+
78
+ # MNIST
79
+
80
+ The MNIST data set consists of 60,000 training and 10,000 test data samples of black and white encoded handwritten digits. The objective is to classify these digits in the range from 0 to 9. A selection of images from the data set and some adversarial perturbations can be found in the top two rows of figure 1. In the experiments, the network architecture in Table 1 is used and it is trained with 10 epochs. All results from the experiments are summarized in Table 2.
81
+
82
+ On unperturbed test data the classification accuracy is roughly $9 9 \%$ . The difference between single classifiers and ensembles is below one percent throughout. The ensembles slightly outperform the single classifiers in all cases.
83
+
84
+ Table 1: MNIST Network Architecture
85
+
86
+ <table><tr><td>Layer Type</td><td>Parameters</td></tr><tr><td>Relu Convolutional</td><td>32 filters (3×3)</td></tr><tr><td>Relu Convolutional</td><td>32 filters (3×3)</td></tr><tr><td>Max Pooling</td><td>2×2</td></tr><tr><td>Relu Fully Connected</td><td>128 units</td></tr><tr><td>Dropout</td><td>0.5</td></tr><tr><td>Relu Fully Connected</td><td>10 units</td></tr><tr><td>Softmax</td><td>10 units</td></tr></table>
87
+
88
+ Table 2: Experimental results on the MNIST and the CIFAR-10 data sets
89
+ MNIST Accuracy
90
+
91
+ <table><tr><td colspan="2">Test Data</td><td colspan="2">No Attack</td><td colspan="2">Grad. 1</td><td>Grad. 2</td></tr><tr><td>Type</td><td>Method</td><td>Single</td><td>Ensemble</td><td>Single</td><td>Ensemble</td><td>Ensemble</td></tr><tr><td rowspan="4">FGSM</td><td>Rand. Ini.</td><td>0.9912</td><td>0.9942</td><td>0.3791</td><td>0.6100</td><td>0.4517</td></tr><tr><td>Mix. Mod.</td><td>0.9918</td><td>0.9942</td><td>0.3522</td><td>0.5681</td><td>0.4609</td></tr><tr><td>Bagging</td><td>0.9900</td><td>0.9927</td><td>0.4045</td><td>0.6738</td><td>0.5716</td></tr><tr><td>Gauss Noise</td><td>0.9898</td><td>0.9920</td><td>0.5587</td><td>0.7816</td><td>0.7043</td></tr><tr><td rowspan="4">BIM</td><td>Rand. Ini.</td><td>0.9912</td><td>0.9942</td><td>0.0906</td><td>0.6518</td><td>0.8875</td></tr><tr><td>Mix.Mod.</td><td>0.9918</td><td>0.9942</td><td>0.0582</td><td>0.6656</td><td>0.9076</td></tr><tr><td>Bagging</td><td>0.9900</td><td>0.9927</td><td>0.1110</td><td>0.7068</td><td>0.9233</td></tr><tr><td>Gauss Noise</td><td>0.9898</td><td>0.9920</td><td>0.5429</td><td>0.9152</td><td>0.9768</td></tr></table>
92
+
93
+ CIFAR-10 Accuracy
94
+
95
+ <table><tr><td colspan="2">Test Data</td><td colspan="2">No Attack</td><td colspan="2">Grad. 1</td><td>Grad. 2</td></tr><tr><td>Type</td><td>Method</td><td>Single</td><td>Ensemble</td><td>Single</td><td>Ensemble</td><td>Ensemble</td></tr><tr><td rowspan="4">FGSM</td><td>Rand. Ini.</td><td>0.7984</td><td>0.8448</td><td>0.1778</td><td>0.4538</td><td>0.3302</td></tr><tr><td>Mix. Mod.</td><td>0.7898</td><td>0.8400</td><td>0.1643</td><td>0.4339</td><td>0.3140</td></tr><tr><td>Bagging</td><td>0.7815</td><td>0.8415</td><td>0.1822</td><td>0.4788</td><td>0.3571</td></tr><tr><td>Gauss Noise</td><td>0.7160</td><td>0.7687</td><td>0.2966</td><td>0.6097</td><td>0.4707</td></tr><tr><td rowspan="4">BIM</td><td>Rand. Ini.</td><td>0.7984</td><td>0.8448</td><td>0.1192</td><td>0.5232</td><td>0.6826</td></tr><tr><td>Mix. Mod.</td><td>0.7898</td><td>0.8400</td><td>0.1139</td><td>0.5259</td><td>0.6768</td></tr><tr><td>Bagging</td><td>0.7815</td><td>0.8415</td><td>0.1280</td><td>0.5615</td><td>0.7166</td></tr><tr><td>Gauss Noise</td><td>0.7160</td><td>0.7687</td><td>0.3076</td><td>0.6735</td><td>0.7277</td></tr></table>
96
+
97
+ This picture changes dramatically if the networks are attacked by one of the methods described in section 2. Using the FGSM attack with gradients from Grad. 1 on a single classifier, the classification rate drops down to a range of roughly $3 5 \% { - } 5 6 \%$ . The ensembles perform significantly better by producing an accuracy of $5 7 \% - 7 8 \%$ . Evaluating the same with gradients from Grad. 2 it turns out that ensemble methods still obtain an accuracy of $45 \% - 7 0 \%$ . The higher accuracy of Grad. 1 is expected since in contrast to Grad. 2 it computes the gradients with respect to just one classifier. Nevertheless, the ensembles outperform single classifiers in each case by approximately $7 \% - 2 2 \%$ .
98
+
99
+ The decrease of the accuracy is even more extreme for single classifiers if the BIM method is used. Here, the accuracy can be as low as around $6 \%$ and only the classifiers trained with Gaussian noise significantly exceed the $10 \%$ . The accuracy of the ensemble methods against attacks using Grad. 1 is considerably higher with $6 5 \% { - } 9 2 \%$ . Furthermore, ensembles are even more robust against BIM attacks based on Grad. 2 with a correct classification rate of $89 \% - 9 8 \%$ . It is surprising that BIM attacks using Grad. 1 are more successful than those using Grad. 2, because Grad. 1 only attacks a single classifier in the ensemble. Concluding, the ensemble methods outperform single classifiers significantly by $3 7 \% 8 5 \%$ on BIM attacks.
100
+
101
+ Focusing on the different defense strategies, we observe that using random initialization of the network weights as well as using several networks of similar architectures for an ensemble generally improves the robustness against adversarial attacks considerably in comparison with single classifiers. Bagging outperforms both of the previous methods on adversarial perturbations, but performs slightly worse on unperturbed test data. Using ensembles with small Gaussian noise on the training data results in the best defense mechanism against adversarial attacks. This may be due to the fact that using additive noise on the training data already makes every single classifier in the ensemble more robust against adversarial perturbations. On the down-side, adding Gaussian noise to the training data performs worst from all considered ensemble methods on test data. However, such an ensemble still performs better than all single classifiers on MNIST.
102
+
103
+ ![](images/d1c4ae0569cb52f4202724269f5dffd84f378a5db113a84d8cc0257b4219ef28.jpg)
104
+ Figure 2: Visual comparisons of the accuracies presented in Table 2. Compared are the MNIST (top row) and CIFAR-10 (bottom row) data sets on the FGSM (left column) and the BIM (right column) attacks. Grad. 1 Single refers to attacks based on Grad. 1 on single classifiers, Grad. 1 Ensemble refers to attacks based on Grad. 1 on ensembles, Grad. 2 Ensemble refers to attacks based on Grad. 2 on ensemble classifiers, No Attack Single refers to single classifier on unperturbed data, and finally No Attack Ensemble refers to ensemble classifiers on unperturbed data.
105
+
106
+ # CIFAR-10
107
+
108
+ The CIFAR-10 data set consists of 50,000 training and 10,000 test data samples of three-color component encoded images of ten mutually exclusive classes: airplane, automobile, bird, cat, deer, dog, frog, horse, ship, and truck. A selection of images from the data set and some adversarial perturbations can be found in the two bottom rows of figure 1. In all experiments the network architecture described in Table 3 is used and the networks are trained with 25 epochs.
109
+
110
+ In general, the observations on the MNIST data set are confirmed by the experiments on CIFAR10. Since the latter data set is more demanding to classify, the overall classification rate is already lower in the attack-free case, where single classifiers reach an accuracy of roughly $7 2 \% - 8 0 \%$ , while ensembles show a higher accuracy of $7 7 \% - 8 4 \%$ . Note that there are network architectures in the literature that outperform our classifiers considerably on test data (Graham, 2014).
111
+
112
+ The FGSM attacks on single classifiers using method Grad. 1 show a drop-down of the accuracy to $1 6 \% - 3 0 \%$ . In contrast, ensembles are significantly better reaching accuracies of $4 3 \% - 6 1 \%$ when attacked using Grad. 1 and $3 1 \% - 4 7 \%$ when attacked with Grad. 2.
113
+
114
+ Table 3: CIFAR-10 Network Architecture
115
+
116
+ <table><tr><td>Layer Type</td><td>Parameters</td></tr><tr><td>Relu Convolutional Relu Convolutional Max Pooling Dropout</td><td>32 filters (3×3) 32 filters (3×3) 2×2 0.2</td></tr><tr><td>Relu Convolutional Relu Convolutional Max Pooling Dropout Relu Convolutional</td><td>64 filters (3×3) 64 filters (3×3) 2×2 0.3</td></tr><tr><td>Relu Convolutional</td><td>128 filters (3×3)</td></tr><tr><td></td><td>128 filters (3×3)</td></tr><tr><td>Max Pooling Dropout Relu Fully Connected Dropout Relu Fully Connected Softmax</td><td>2×2 0.4 512 units 0.5 10 units</td></tr></table>
117
+
118
+ When using BIM attacks accuracies for single classifiers lie between $11 \%$ and $31 \%$ . Again, the ensemble methods outperform the single classifiers reaching accuracies of $5 2 \% - 6 7 \%$ when attacked using Grad. 1 and $6 8 \% - 7 3 \%$ when attacked with Grad. 2.
119
+
120
+ The same observations as on the MNIST data set can be made on the CIFAR-10 data set. All ensemble methods outperform single classifiers when comparing their robustness against adversarial perturbations. FGSM attacks on an ensemble using Grad. 2 outperform those using Grad. 1, as expected. Similar to the MNIST experiments, when using BIM attacks, ensembles are surprisingly more robust against gradient attacks from Grad. 2 than against gradient attacks from Grad. 1. The reason for this might be that the gradient portion from different classifiers using Grad. 2 in the ensemble try to reach a different local maximum and block each other in the following iterations.
121
+
122
+ As already observed on the MNIST data set, Bagging performs better than random initialization and than using similar but different network architectures. Again, adding small Gaussian noise on the training data performs best on adversarial perturbations but relatively poor on real test data on CIFAR-10.
123
+
124
+ # COMPARISON WITH OTHER METHODS
125
+
126
+ In this section, we compare the previous results with two of the most popular defense methods: adversarial training (Goodfellow et al., 2014; Papernot et al., 2016c) and defensive distillation (Papernot et al., 2016d). Furthermore, we show the positive effects of combining those methods with ensembles. For simplicity, we only consider the gradient Grad. 2 whenever an ensemble is attacked. The results are summarized in Table 4. Here, the content shall be interpreted in the following way: Bagging refers to ensembles trained with bagging, Adv. Train. to adversarial training, Def. Dist. to defensive distillation, the operator $^ +$ to combinations of the previous methods, bold text to the best performance of the first three methods, and the asterisk to the best method including combinations of defensive strategies.
127
+
128
+ Adversarial training (AT) is a method that uses FGSM as regularizer of the original cost function:
129
+
130
+ $$
131
+ J _ { A T } ( \theta , x , y ) = \rho J ( \theta , x , y ) + ( 1 - \rho ) J ( \theta , x + \epsilon \operatorname { s i g n } ( \nabla _ { x } J ( \theta , x , y ) ) , y ) ,
132
+ $$
133
+
134
+ where $\rho \in [ 0 , 1 ]$ . This method iteratively increases the robustness against adversarial perturbations.
135
+ In our experiments, we use $\rho = { \textstyle { \frac { 1 } { 2 } } }$ as proposed in Goodfellow et al. (2014).
136
+
137
+ Table 4: Accuracies of different defense mechanisms
138
+
139
+ <table><tr><td></td><td colspan="3">MNIST</td><td colspan="3">CIFAR-10</td></tr><tr><td>Methods</td><td>No Attack</td><td>FGSM</td><td>BIM</td><td>No Attack</td><td>FGSM</td><td>BIM</td></tr><tr><td>Bagging</td><td>0.9927*</td><td>0.5716</td><td>0.9233</td><td>0.8415*</td><td>0.3571</td><td>0.7166*</td></tr><tr><td>Adv.Train.</td><td>0.9902</td><td>0.3586</td><td>0.5420</td><td>0.7712</td><td>0.1778</td><td>0.3107</td></tr><tr><td>Def. Dist.</td><td>0.9840</td><td>0.0798</td><td>0.3829</td><td>0.7140</td><td>0.1828</td><td>0.3635</td></tr><tr><td>Bagging + Adv. Train.</td><td>0.9927*</td><td>0.8703*</td><td>0.9840*</td><td>0.8320</td><td>0.5010*</td><td>0.7017</td></tr><tr><td>Bagging + Def. Dist.</td><td>0.9875</td><td>0.0954</td><td>0.4514</td><td>0.7323</td><td>0.1839</td><td>0.4569</td></tr></table>
140
+
141
+ In defensive distillation a teacher model $F$ is trained on a training data set $X$ . Then smoothed labels at temperature $T$ are computed by
142
+
143
+ $$
144
+ F ^ { T } ( X ) = \left[ \frac { \exp ( F _ { i } ( X ) / T ) } { \sum _ { i = 1 } ^ { N } \exp ( F _ { i } ( X ) / T ) } \right] _ { i \in \{ 1 , \ldots , N \} } ,
145
+ $$
146
+
147
+ where $F _ { i } ( X )$ refers to the probability of the $i$ -th out of $N$ possible classes. A distilled network is a network that is trained on the training data $X$ using the smoothed labels $F ^ { T } ( X )$ . In the following, we use $T = 1 0$ based on the experimental results in Papernot et al. (2016d).
148
+
149
+ We found that single networks trained with adversarial training or defensive distillation have a lower accuracy than ensembles trained with bagging (see the top three rows in Table 4). This is not only the case on the considered attacked data but also on unperturbated test data. Combining ensembles with adversarial training can improve the robustness against adversarial perturbations further, while a combination with defensive distillation does not reveal the same tendency (see the two bottom rows in Table 4). We emphasize that already the standard ensemble method does not only outperform both adversarial training and defensive distillation throughout but also has the overall highest accuracy on unperturbated test data.
150
+
151
+ # 5 CONCLUSION
152
+
153
+ With the rise of deep learning as the state-of-the-art approach for many classification tasks, researchers noted that neural networks are highly vulnerable to adversarial perturbations. This is particularly problematic when neural networks are used in security sensitive applications such as autonomous driving. Hence, with the development of more efficient attack methods against neural networks it is desirable to obtain neural networks that are themselves robust against adversarial attacks.
154
+
155
+ In this manuscript, it is shown that several ensemble methods such as random initialization or Bagging do not only increase the accuracy on the test data, but also make the classifiers considerably more robust against certain adversarial attacks. We consider ensemble methods as sole defense methods, but more robust classifiers can be obtained by combining ensemble methods with other defense mechanisms such as adversarial training. Although only having tested simple attack scenarios, it can be expected that ensemble methods may improve the robustness against other adversarial attacks.
156
+
157
+ # REFERENCES
158
+
159
+ Mahdieh Abbasi and Christian Gagne. Robustness to adversarial examples through an ensemble of ´ specialists. arXiv preprint arXiv:1702.06856, 2017.
160
+
161
+ Leo Breiman. Bagging predictors. Machine learning, 24(2):123–140, 1996.
162
+
163
+ George E Dahl, Dong Yu, Li Deng, and Alex Acero. Context-dependent pre-trained deep neural networks for large-vocabulary speech recognition. IEEE Transactions on audio, speech, and language processing, 20(1):30–42, 2012.
164
+
165
+ Thomas G Dietterich et al. Ensemble methods in machine learning. Multiple classifier systems, 1857:1–15, 2000.
166
+
167
+ Reuben Feinman, Ryan R Curtin, Saurabh Shintre, and Andrew B Gardner. Detecting adversarial samples from artifacts. arXiv preprint arXiv:1703.00410, 2017.
168
+
169
+ Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572, 2014.
170
+
171
+ Benjamin Graham. Fractional max-pooling. arXiv preprint arXiv:1412.6071, 2014.
172
+
173
+ Shixiang Gu and Luca Rigazio. Towards deep neural network architectures robust to adversarial examples. arXiv preprint arXiv:1412.5068, 2014.
174
+
175
+ Lars Kai Hansen and Peter Salamon. Neural network ensembles. IEEE transactions on pattern analysis and machine intelligence, 12(10):993–1001, 1990.
176
+
177
+ Warren He, James Wei, Xinyun Chen, Nicholas Carlini, and Dawn Song. Adversarial example defenses: Ensembles of weak defenses are not strong. arXiv preprint arXiv:1706.04701, 2017.
178
+
179
+ 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.
180
+
181
+ John F Kolen and Jordan B Pollack. Back propagation is sensitive to initial conditions. In Advances in neural information processing systems, pp. 860–867, 1991.
182
+
183
+ Yehuda Koren. The bellkor solution to the netflix grand prize. Netflix prize documentation, 81:1–10, 2009.
184
+
185
+ Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. Technical report, University of Toronto, 2009.
186
+
187
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems, pp. 1097–1105, 2012.
188
+
189
+ Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial examples in the physical world. arXiv preprint arXiv:1607.02533, 2016.
190
+
191
+ 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.
192
+
193
+ Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep learning. Nature, 521(7553):436–444, 2015.
194
+
195
+ Jan Hendrik Metzen, Tim Genewein, Volker Fischer, and Bastian Bischoff. On detecting adversarial perturbations. arXiv preprint arXiv:1702.04267, 2017.
196
+
197
+ Seyed-Mohsen Moosavi-Dezfooli, Alhussein Fawzi, and Pascal Frossard. Deepfool: a simple and accurate method to fool deep neural networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2574–2582, 2016.
198
+
199
+ Nicolas Papernot, Ian Goodfellow, Ryan Sheatsley, Reuben Feinman, and Patrick McDaniel. cleverhans v1. 0.0: an adversarial machine learning library. arXiv preprint arXiv:1610.00768, 2016a.
200
+
201
+ Nicolas Papernot, Patrick McDaniel, Ian Goodfellow, Somesh Jha, Z Berkay Celik, and Ananthram Swami. Practical black-box attacks against deep learning systems using adversarial examples. arXiv preprint arXiv:1602.02697, 2016b.
202
+
203
+ 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, 2016c.
204
+
205
+ Nicolas Papernot, Patrick McDaniel, Xi Wu, Somesh Jha, and Ananthram Swami. Distillation as a defense to adversarial perturbations against deep neural networks. In Security and Privacy (SP), 2016 IEEE Symposium on, pp. 582–597. IEEE, 2016d.
206
+
207
+ Pierre Sermanet and Yann LeCun. Traffic sign recognition with multi-scale convolutional networks. In Neural Networks (IJCNN), The 2011 International Joint Conference on, pp. 2809–2813. IEEE, 2011.
208
+
209
+ 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.
md/train/rkaT3zWCZ/rkaT3zWCZ.md ADDED
@@ -0,0 +1,339 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # BUILDING GENERALIZABLE AGENTS WITH A REALISTIC AND RICH 3D ENVIRONMENT
2
+
3
+ Yi Wu
4
+ UC Berkeley
5
+ jxwuyi@gmail.com
6
+
7
+ Yuxin Wu & Georgia Gkioxari & Yuandong Tian Facebook AI Research {yuxinwu,gkioxari,yuandong}@fb.com
8
+
9
+ # ABSTRACT
10
+
11
+ Teaching an agent to navigate in an unseen 3D environment is a challenging task, even in the event of simulated environments. To generalize to unseen environments, an agent needs to be robust to low-level variations (e.g. color, texture, object changes), and also high-level variations (e.g. layout changes of the environment). To improve overall generalization, all types of variations in the environment have to be taken under consideration via different level of data augmentation steps. To this end, we propose House3D, a rich, extensible and efficient environment that contains 45,622 human-designed 3D scenes of visually realistic houses, ranging from single-room studios to multi-storied houses, equipped with a diverse set of fully labeled 3D objects, textures and scene layouts, based on the SUNCG dataset (Song et al., 2017). The diversity in House3D opens the door towards scene-level augmentation, while the label-rich nature of House3D enables us to inject pixel- & task-level augmentations such as domain randomization (Tobin et al., 2017) and multi-task training. Using a subset of houses in House3D, we show that reinforcement learning agents trained with an enhancement of different levels of augmentations perform much better in unseen environments than our baselines with raw RGB input by over $8 \%$ in terms of navigation success rate. House3D is publicly available at http://github.com/facebookresearch/House3D.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ Recently, deep reinforcement learning has shown its strength on multiple games, such as Atari (Mnih et al., 2015) and Go (Silver et al., 2016), vastly overpowering human performance. Via the various reinforcement learning frameworks, different aspects of intelligence can be learned, including 3D understanding (DeepMind Lab (Beattie et al., 2016) and Malmo (Johnson et al., 2016)), real-time strategy decision (TorchCraft (Synnaeve et al., 2016) and ELF (Tian et al., 2017)), fast reaction (Atari (Bellemare et al., 2013)), long-term planning (Go, Chess), language and communications (ParlAI (Miller et al., 2017) and (Das et al., 2017b)).
16
+
17
+ A prominent issue in reinforcement learning is generalizability. Commonly, agents trained on a specific environment and for a specific task become highly specialized and fail to perform well on new environments. In the past, there have been efforts to address this issue. In particular, pixellevel variations are applied to the observation signals in order to increase the agent’s robustness to unseen environments (Beattie et al., 2016; Higgins et al., 2017; Tobin et al., 2017). Parametrized environments with varying levels of difficulty are used to yield scene variations but with similar visual observations (Pathak et al., 2017). Transfer learning is applied to similar tasks but with different rewards (Finn et al., 2017b).
18
+
19
+ Nevertheless, the aforementioned techniques study the problem in simplified environments which lack the diversity, richness and perception challenges of the real world. To this end, we propose a substantially more diverse environment, House3D, to train and test our agents. House3D is a virtual 3D environment consisting of thousands of indoor scenes equipped with a diverse set of scene types, layouts and objects. An overview of House3D is shown in Figure 1a. House3D leverages the SUNCG dataset (Song et al., 2017) which contains 45K human-designed real-world 3D house models, ranging from single studios to houses with gardens, in which objects are fully labeled with categories. We convert the SUNCG dataset to an environment, House3D, which is efficient and extensible for various tasks. In House3D, an agent can freely explore the space while perceiving a large number of objects under various visual appearances.
20
+
21
+ ![](images/82f8173d69c81105594cb3383044abb3a1c9c9a6d48e0e296a2d2e76cd8ff85f.jpg)
22
+ Figure 1: An overview of House3D environment and RoomNav task. (a) We build an efficient and interactive environment upon the SUNCG dataset (Song et al., 2017) that contains 45K diverse indoor scenes, ranging from studios to two-storied houses with swimming pools and fitness rooms. All 3D objects are fully labeled into over 80 categories. Observations of agents in the environment have multiple modalities, including RGB images, Depth, Segmentation masks (from object category), top-down 2D view, etc. (b) We focus on the task of targeted navigation. Given a high-level description of a room concept, the agent explores the environment to reach the target room.
23
+
24
+ Based on House3D, we design a task called RoomNav: an agent starts at a random location in a house and is asked to navigate to a destination specified by a high-level semantic concept (e.g. kitchen), following simple rules (e.g. no object penetration), as shown in Figure 1b. We use gated-CNN and gated-LSTM policies trained with standard deep reinforcement learning methods, i.e. A3C (Mnih et al., 2016) and DDPG (Lillicrap et al., 2015), and report success rate on unseen environments over 5 concepts. We show that in order to achieve strong generalization capability, all-levels of augmentations are needed: pixel-level augmentation by domain randomization (Tobin et al., 2017) enhances the agent’s robustness to color variations; object-level augmentation forces the agent to learn multiple concepts (20 in number) simultaneously, and scene-level augmentation, where a diverse set of environments is used, enforce generalizability across diverse scenes, mitigating overfitting to particular scenes. Our final gated-LSTM agent achieves a success rate of $3 5 . { \bar { 8 } } \%$ on 50 unseen environments, $10 \%$ better than the baseline method $( 2 5 . 7 \% )$ .
25
+
26
+ The remaining of the paper is structured as follows. Section 2 summarizes relevant work. Section 3 describes our environment, House3D, in detail and section 4 describes the task, RoomNav. Section 5 describes our gated models and the applied algorithms to tackle RoomNav. Finally, experimental results are shown in Section 6.
27
+
28
+ # 2 RELATED WORK
29
+
30
+ Environments: Table 1 shows the comparison between House3D and most relevant prior works. There are other simulated environments which focus on different domains, such as OpenAI Gym (Brockman et al., 2016), ParlAI (Miller et al., 2017) for language communication as well as some strategic game environments (Synnaeve et al., 2016; Tian et al., 2017; Vinyals et al., 2017), etc. Most of these environments are pertinent to one particular aspect of intelligence, such as dialogue or a single type of game, which makes it hard to facilitate the study of more comprehensive problems. On the contrary, we focus on building a platform that intersects with multiple research directions, such as object and scene understanding, 3D navigation, embodied question answering (Das et al., 2017a), while allowing users to customize the level of complexity to their needs.
31
+
32
+ Table 1: A summary of popular environments. The attributes include 3D: 3D nature of the rendered objects, Realistic: resemblance to the real-world, Large-scale: a large set of environments, Fast: fast rendering speed and Customizable: flexibility to be customized to other applications.
33
+
34
+ <table><tr><td rowspan=1 colspan=1>Environment</td><td rowspan=1 colspan=1>3D</td><td rowspan=1 colspan=1>Realistic</td><td rowspan=1 colspan=1>Large-scale</td><td rowspan=1 colspan=1>Fast</td><td rowspan=1 colspan=1>Customizable</td></tr><tr><td rowspan=1 colspan=1>Atari (Bellemare et al., 2013)</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></tr><tr><td rowspan=1 colspan=1>OpenAI Universe (Shi et al., 2017)</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></tr><tr><td rowspan=1 colspan=1>Malmo (Johnson et al., 2016)</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></tr><tr><td rowspan=1 colspan=1>DeepMind Lab (Beattie et al., 2016)</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></tr><tr><td rowspan=1 colspan=1>VizDoom (Kempka et al., 2016)</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></tr><tr><td rowspan=1 colspan=1>AI2-THOR (Zhu et al., 2017)</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></tr><tr><td rowspan=1 colspan=1>Stanford2D-3D (Armeni et al., 2016)</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></tr><tr><td rowspan=1 colspan=1>Matterport3D (Chang et al.,2017)</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></tr><tr><td rowspan=1 colspan=1>House3D</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></tr></table>
35
+
36
+ We build on SUNCG (Song et al., 2017), a dataset that consists of thousands of diverse synthetic indoor scenes equipped with a variety of objects and layouts. Its visual diversity and rich content opens the path to the study of semantic generalization for reinforcement learning agents. Our platform decouples high-performance rendering from data I/O, and thus can use other publicly available 3D scene datasets as well. This includes Al2-THOR (Zhu et al., 2017), SceneNet RGB-D (McCormac et al., 2017), Stanford 3D (Armeni et al., 2016), Matterport 3D (Chang et al., 2017) and so on.
37
+
38
+ Concurrent works (Brodeur et al., 2017; Savva et al., 2017) also introduce similar platforms as House3D, indicating the interest for large-scale interactive and realistic 3D environments.
39
+
40
+ 3D Navigation: There has been a prominent line of work on the task of navigation in real 3D scenes (Leonard & Durrant-Whyte, 1992). Classical approaches decompose the task into two subtasks by building a 3D map of the scene using SLAM and then planning in this map (Fox et al., 2005). More recently, end-to-end learning methods were introduced to predict robotic actions from raw pixel data (Levine et al., 2016). Some of the most recent works on navigation show the effectiveness of end-to-end learning. Gupta et al. (2017) learn to navigate via mapping and planning using shortest path supervision. Sadeghi & Levine (2017) teach an agent to fly using solely simulated data and deploy it in the real world. Dhiraj et al. (2017) collect a dataset of drones crashing into objects and train self-supervised agents on this data to avoid obstacles.
41
+
42
+ A number of recent works also use deep reinforcement learning for navigation in simulated 3D scenes. Mirowski et al. (2016); Jaderberg et al. (2016) improve an agent’s navigation ability in mazes by introducing auxiliary tasks. Parisotto & Salakhutdinov (2017) propose a new architecture which stores information of the environment on a 2D map. Karl Moritz Hermann & PhilBlunsom (2017) focus on the task of language grounding by navigating simple 3D scenes. However, these works only evaluate the agent’s generalization ability on pixel-level variations or small mazes. We argue that a much richer environment is crucial for evaluating semantic-level generalization.
43
+
44
+ Gated Modules: In our work, we focus on the task of RoomNav, where the goal is communicated to the agent as a high-level instruction selected from a set of predefined concepts. To modulate the behavior of the agent in RoomNav, we encode the instruction as an embedding vector which gates the visual signal. The idea of gated attention has been used in the past for language grounding (Chaplot et al., 2017), and transfer learning by language grounding (Narasimhan et al., 2017). Similar to those works, we use concept grounding as an attention mechanism. We believe that our gated reinforcement learning models serve as a strong baseline for the task of semantic based navigation in House3D. Furthermore, our empirical results allow us to draw conclusions on the models’ efficacy when training agents in a large-scale, diverse dataset with an emphasis on generalization.
45
+
46
+ Generalization: There is a recent trend in reinforcement learning focusing on the problem of generalization, ranging from learning to plan (Tamar et al., 2016), meta-learning (Duan et al., 2016; Finn et al., 2017a) to zero-shot learning (Andreas et al., 2016; Oh et al., 2017; Higgins et al., 2017).
47
+
48
+ However, these works either focus on over-simplified tasks or test on environments which are only slightly varied from the training ones. In contrast, we use a more diverse set of environments, each containing visually and structurally different observations, and show that the agent can work well in unseen scenes.
49
+
50
+ In this work, we show improved generalization performance in complex 3D scenes when using depth and segmentation masks on top of the raw visual input. This observation is similar to other works which use a diverse set of input modalities (Mirowski et al., 2016; Tai & Liu, 2016). Our result suggests that it can be possible to decouple real-world robotics from recognition via a vision API provided by an object detection or semantic segmentation system trained on the targeted real scenes. This opens the door towards bridging the gap between simulated environment and real-world (Tobin et al., 2017; Rusu et al., 2016; Christiano et al., 2016).
51
+
52
+ # 3 HOUSE3D: AN EXTENSIBLE ENVIRONMENT OF 45K 3D HOUSES
53
+
54
+ We propose House3D, an environment which closely resembles the real world and is rich in content and structure. An overview of House3D is shown in Figure 1a. House3D is developed to provide an efficient and flexible environment of thousands of indoor scenes and facilitates a variety of tasks, e.g. navigation, visual understanding, language grounding, concept learning etc. The environment along with a python API for easy use is available at http://github.com/facebookresearch/ House3D.
55
+
56
+ # 3.1 DATASET
57
+
58
+ The 3D scenes in House3D are sourced from the SUNCG dataset (Song et al., 2017), which consists of 45,622 human-designed 3D scenes ranging from single-room studios to multi-floor houses. The SUNCG dataset was designed to encourage research on large-scale 3D object recognition problems and thus carries a variety of objects, scene layouts and structures. On average, there are 8.9 rooms and 1.3 floors per scene There is a diverse set of room and object types in each scene. In total, there are over 20 different room types, such as bedroom, living room, kitchen, bathroom etc., with over 80 different object categories. In total, the SUNCG dataset contains 404,508 different rooms and 5,697,217 object instances drawn from 2644 unique object meshes.
59
+
60
+ # 3.2 ANNOTATIONS
61
+
62
+ Each scene in SUNCG is fully annotated with 3D coordinates and its room and object types (e.g. bedroom, shoe cabinet, etc). This allows for a detailed mapping from each 3D location to an object instance (or None at free space) and the room type.
63
+
64
+ At every time step an agent has access to the following signals: a) the visual RGB signal of its current first person view, b) semantic/instance segmentation masks for all the objects visible in its current view, and c) depth information. For different tasks, these signals might serve for different purposes, e.g., as a feature plane or an auxiliary target. Based on the existing annotations, House3D offers more information, e.g., top-down 2D occupancy maps, connectivity analysis and shortest paths between two points.
65
+
66
+ # 3.3 RENDERER
67
+
68
+ To build a realistic 3D environment, we develop a renderer for the SUNCG scenes. The renderer is based on OpenGL, it can run on both Linux and MacOS, and provides RGB images, semantic segmentation masks, instance segmentation masks and depth maps.
69
+
70
+ As highlighted above, the environment needs to be efficient in order to be used for large-scale reinforcement learning. On a NVIDIA Tesla M40 GPU, our implementation can render $1 2 0 \times 9 0$ -sized frames at over 600 fps, while multiple renderers can run in parallel on one or more GPUs. When rendering multiple houses simultaneously, one M40 GPU can be fully utilized to render at a total of 1800 fps. The default simple physics adds a small overhead to the rendering. The high throughput of our implementation enables efficient learning for a variety of interactive tasks, such as on-policy reinforcement learning.
71
+
72
+ # 3.4 INTERACTION
73
+
74
+ In House3D, an agent can live in any location within a 3D scene, as long as it does not collide with object instances (including walls) within a small range, i.e. robot’s radius. Doors, gates and arches are considered passage ways, meaning that an agent can walk through those structures freely. These default design choices add negligible run-time overhead. Note that more complex interaction rules can be incorporated (e.g. manipulation) within House3D using our flexible API, which we leave for future work.
75
+
76
+ # 4 ROOMNAV: A BENCHMARK TASK FOR CONCEPT-DRIVEN NAVIGATION
77
+
78
+ Consider the task of concept-driven navigation as shown in Figure 1b. A human may give a high level instruction to the robot, for example, “Go to the kitchen”, so that one can later ask the robot to turn on the oven. The robot needs to behave appropriately conditioned on the house it is located in and the goal, e.g. the semantic concept “kitchen”. In addition, we want the agent to generalize, i.e. to perform well in unseen environments, that is new houses with different layouts and furniture locations.
79
+
80
+ To study the aforementioned abilities of an agent, we develop a benchmark task, Concept-Driven Navigation (RoomNav), based on House3D. We define the goal to be of the form $^ { 6 6 } \mathrm { g o }$ to $\mathrm { \nabla { X ^ { \prime } { } ^ { * } } }$ , where X denotes a pre-defined room type or object type, which is a semantic concept that an agent needs to interpret from a variety of scenes of distinct visual appearances. To ensure fast experimentation cycles, we perform experiments on a subset of House3D. We manually select 270 houses suitable for a navigation task and split them into a small set (20 houses), a large set (200 houses) and a test set (50 houses), where the test set is used to evaluate the generalization of the trained agents.
81
+
82
+ Task Formulation: Suppose we have a set of episodic environments $\mathcal { E } ~ = ~ \{ E _ { 1 } , . . , E _ { n } \}$ and a set of semantic concepts $\bar { \mathcal { T } } = \{ I _ { 1 } , . . , I _ { m } \}$ . During each episode, the agent is interacting with one environment $E \in { \mathcal { E } }$ and is given a concept $I \in \mathcal { T }$ . In the beginning of an episode, the agent is randomly placed somewhere in $E$ . At each time step $t$ , the agent receives a visual signal $X _ { t }$ from $E$ via its first person view sensor. Let $s _ { t } = \{ X _ { 1 } , . . , X _ { t } , I \}$ denote the state of the agent at time $t$ . The agent needs to propose an action $a _ { t }$ to navigate and rotate its sensor given $s _ { t }$ . The environment returns a reward signal $r _ { t }$ and terminates when the agent succeeds in finding the destination, or reaches a maximum number of steps.
83
+
84
+ The objective of this task is to learn an optimal policy $\pi ( \boldsymbol { a } _ { t } | \boldsymbol { s } _ { t } , I )$ that leads to the target defined by $I$ . We train the agent on a set ${ \mathcal { E } } _ { \operatorname { t r a i n } }$ . We evaluate the policy on a disjoint set of environments ${ \mathcal { E } } _ { \mathrm { t e s t } }$ ( $\mathcal { E } _ { \mathrm { t e s t } } \cap \mathcal { E } _ { \mathrm { t r a i n } } = \emptyset ,$ ). For more details see the Appendix.
85
+
86
+ Environment Statistics: The selected 270 houses are manually verified for navigation; they are well connected, contain desired concepts, and are large enough for exploration. We split them into 3 disjoint sets, denoted by $\mathcal { E } _ { s m a l l }$ , $\mathcal { E } _ { l a r g e }$ and $\mathcal { E } _ { t e s t }$ respectively. For the semantic concepts, we select the five most common room types: kitchen, living room, dining room, bedroom and bathroom. Note that this set can be extended to include objects or even subareas within rooms.
87
+
88
+ Observations: We utilize three different kinds of visual input signals for $X _ { t }$ , including (1) raw pixel values; (2) semantic segmentation mask of the pixel input; and (3) depth information, and experiment with different combinations of them. We encode each concept $I$ as a one-hot vector representation.
89
+
90
+ Action Space: Similar to existing navigation works, we define a fixed set of actions, here 12 in number including different scales of rotations and movements. Due to the complexity of the indoor scenes, we also explore a continuous action space similar to (Lowe et al., 2017), which in effect allows the agent to move with different velocities. For more details see the Appendix. In all cases, if the agent hits an obstacle it remains still.
91
+
92
+ Success Measure and Reward Function: To declare success, we want to ensure that the agent identifies the target room by its unique properties (e.g. presence of appropriate objects in the room such as pan and knives for kitchen and bed for bedroom) instead of merely reaching there by luck. An episode is considered successful if both of the following two criteria are satisfied: (1) the agent is located inside the target room; (2) the agent consecutively sees a designated object category associated with that target room type for at least 2 time steps. We assume that an agent sees an object if there are at least $4 \%$ of pixels in $X _ { t }$ belonging to that object.
93
+
94
+ For the reward function, ideally two signals suffice to reflect the task requirement: (1) a collision penalty when hitting obstacles; and (2) a success reward when completing the task. However, these basic signals make it too difficult for an RL agent to learn, as the positive reward is too sparse. To provide additional supervision during training, we resort to an informative reward shaping: we compute the approximate shortest distance from the target room to each location in the house and adopt the difference of shortest distances between the agent’s movement as an additional reward signal. Note that our ultimate goal is to learn a policy that could generalize to unseen houses. Our strong reward shaping supervises the agent at training and is not available to the agent at test time. We empirically observe that stronger reward shaping leads to better performances on both training and testing.
95
+
96
+ # 5 GATED-ATTENTION NETWORKS FOR MULTI-TARGET LEARNING
97
+
98
+ The RoomNav task can be considered as a multi-target learning problem: the policy needs to condition on both the input $s _ { t }$ and the target concept $I$ . For policy representations which incorporate the target $I$ , we propose two baseline models with a gated-attention architecture, similar to Dhingra et al. (2016) and Chaplot et al. (2017): a gated-CNN network for continuous actions and a gatedLSTM network for discrete actions. We train the gated-CNN policy using the deep deterministic policy gradient (DDPG) (Lillicrap et al., 2015), while the gated-LSTM policy is trained using the asynchronous advantage actor-critic algorithm (A3C) (Mnih et al., 2016).
99
+
100
+ ![](images/a75289ae7bf516017b287610ca208e9db5d32947bd34b698e6fa707f328db54e.jpg)
101
+ Figure 2: Overview of our proposed models. Bottom part demonstrates the gated-LSTM model for discrete action while the top part shows the gated-CNN model for continuous action. The “Gated Fusion” module denotes the gated-attention architecture.
102
+
103
+ # 5.1 DDPG WITH GATED-CNN POLICY
104
+
105
+ # 5.1.1 DEEP DETERMINISTIC POLICY GRADIENT
106
+
107
+ Suppose we have a deterministic policy $\mu ( s _ { t } | \boldsymbol { \theta } )$ (actor) and the Q-function $Q ( s _ { t } , a | \theta )$ (critic) both parametrized by $\theta$ . DDPG optimizes the policy $\mu ( s _ { t } | \boldsymbol { \theta } )$ by maximizing $\begin{array} { r l r } { L _ { \mu } ( \theta ) } & { { } = } & { \bar { \mathbb { E } _ { s _ { t } } } \left[ Q ( s _ { t } , \mu ( s _ { t } | \theta ) | \theta ) \right] } \end{array}$ , and updates the $\mathrm { Q }$ -function by minimizing $\begin{array} { r l } { L _ { Q } ( \theta ) } & { { } = } \end{array}$ $\mathbb { E } \left[ ( Q ( s _ { t } , a _ { t } | \theta ) - \gamma Q ( s _ { t + 1 } , \mu ( s _ { t + 1 } | \theta ) | \theta ) - r _ { t } ) ^ { 2 } \right]$ .
108
+
109
+ Here, we use a shared network for both actor and critic with the final loss function $L _ { \mathrm { D D P G } } ( \theta ) =$ $- L _ { \mu } ( \theta ) + \alpha _ { \mathrm { D D P G } } L _ { Q } ( \theta )$ , where $\alpha _ { \mathrm { D D P G } }$ is a constant balancing the two objectives.
110
+
111
+ # 5.1.2 GATED-CNN FOR CONTINUOUS POLICY
112
+
113
+ State Encoding: Given state $s _ { t }$ , we first stack the most recent $k$ frames $\begin{array} { r l } { X } & { { } = } \end{array}$ $[ X _ { t } , X _ { t - 1 } , \ldots , X _ { t - k + 1 } ]$ channel-wise and apply a convolutional neural network to derive an image representation $x ~ = ~ f _ { \mathrm { c n n } } ( X | \theta ) ~ \in ~ \mathbb { R } ^ { d _ { X } }$ . We convert the target $I$ into an embedding vector $\dot { y ^ { \cdot } } = \bar { f } _ { \mathrm { e m b e d } } ( I | \theta ) \in \mathbb { R } ^ { d _ { I } }$ . Subsequently, we apply a fusion module $M ( x , y | \theta )$ to derive the final encoding $h _ { s } = M ( x , y | \theta )$ .
114
+
115
+ Gated-Attention for Feature Fusion: For the fusion module $M ( x , y | \theta )$ , the straightforward version is concatenation, namely $M _ { \mathrm { c a t } } ( x , y | \cdot ) = [ x , y ]$ . In our case, $x$ is always a high-dimensional feature vector (i.e., image feature) while $y$ is a simple low-dimensional conditioning vector (e.g., instruction). Thus, simple concatenation may result in optimization difficulties. For this reason, we propose to use a gated-attention mechanism. Suppose $x \in \mathbb { R } ^ { d _ { x } }$ and $\boldsymbol { y } \in \mathbb { R } ^ { d _ { \boldsymbol { y } } }$ where $d _ { y } ~ < ~ d _ { x }$ . First, we transform $y$ to $y ^ { \prime } \in \mathbb { R } ^ { d _ { X } }$ via an MLP, namely $y ^ { \prime } ~ = ~ f _ { \mathrm { m l p } } ( y | \theta )$ , and then perform a Hadamard (pointwise) product between $x$ and sigmoid $( y ^ { \prime } )$ , which leads to our final gated fusion module $M ( x , y | \theta ) = x \odot$ sigmoid $\left( f _ { \mathrm { m l p } } ( y | \theta ) \right)$ . This gated fusion module could also be interpreted as an attention mechanism over the feature vector which could help better shape the feature representation.
116
+
117
+ Policy Representation: For the policy, we apply a MLP layer on the state representation $h _ { s }$ , followed by a softmax operator (for bounded velocity) to produce the continuous action. Moreover, in order to produce a stochastic policy for both better exploration and higher robustness, we apply the Gumbel-Softmax trick (Jang et al., 2016), resulting in the final policy $\mu ( s _ { t } | \theta ) =$ Gumbel-Softmax ${ \bf \zeta } ^ { \prime } f _ { \mathrm { m l p } } ( h _ { s } | \boldsymbol { \theta } ) )$ . Note that since we add randomness to $\mu ( s _ { t } | \boldsymbol { \theta } )$ , our DDPG formulation can also be interpreted as the SVG(0) algorithm (Heess et al., 2015).
118
+
119
+ Q-function: The Q-function $Q ( s , a )$ conditions on both state $s$ and action $a$ . We again apply a gated fusion module to the feature vector $x$ and the action vector $a$ to derive a hidden representation $h _ { Q } = M ( x , a | \theta )$ . We eventually apply another MLP to $h _ { Q }$ to produce the final value $Q ( s , a )$ .
120
+
121
+ A model demonstration is shown in the top part of Fig. 2, where each block has its own parameters.
122
+
123
+ 5.2 A3C WITH GATED-LSTM POLICY
124
+
125
+ # 5.2.1 ASYNCHRONOUS ADVANTAGE ACTOR-CRITIC
126
+
127
+ Suppose we have a discrete policy $\pi ( \boldsymbol { a } ; \boldsymbol { s } | \boldsymbol { \theta } )$ and a value function $v ( s | \theta )$ . A3C optimizes the policy by minimizing the loss function $\begin{array} { r } { L _ { \mathrm { p g } } ( \theta ) = - \mathbb { E } _ { s _ { t } , a _ { t } , r _ { t } } \left[ \sum _ { t = 1 } ^ { T } ( R _ { t } - v ( s _ { t } ) ) \log \pi ( a _ { t } ; s _ { t } | \theta ) \right] } \end{array}$ , where $R _ { t }$ is the discounted accumulative reward defined by $\begin{array} { r } { R _ { t } = \sum _ { i = 0 } ^ { T - t } \gamma ^ { i } r _ { t + i } + v ( s _ { T + 1 } ) } \end{array}$ . The value function is updated by minimizing the loss $L _ { v } ( \theta ) = \mathbb { E } _ { s _ { t } , r _ { t } } [ ( R _ { t } - v ( s _ { t } ) ) ^ { 2 } ]$ .
128
+
129
+ Finally the overall loss function for A3C is $L _ { \mathrm { A 3 C } } ( \theta ) = L _ { \mathrm { p g } } ( \theta ) + \alpha _ { \mathrm { A 3 C } } L _ { v } ( \theta )$ where $\alpha _ { \mathrm { A } 3 \mathrm { C } }$ is a constant coefficient.
130
+
131
+ # 5.2.2 GATED-LSTM NETWORK FOR DISCRETE POLICY
132
+
133
+ State Encoding: Given state $s _ { t }$ , we first apply a CNN module to extract image feature $x _ { t }$ for each input frame $X _ { t }$ . For the target, we apply a gated fusion module to derive a state representation $h _ { t } = { \bar { M } } ( x _ { t } , I | \theta )$ at each time step $t$ . Then, we concatenate $h _ { t }$ with the target $I$ and the result is fed into the LSTM module (Hochreiter & Schmidhuber, 1997) to obtain a sequence of LSTM outputs $\{ o _ { t } \} _ { t }$ , so that the LSTM module has direct access to the target other than the attended visual feature.
134
+
135
+ Policy and Value Function: For each time step $t$ , we concatenate the state vector $h _ { t }$ with the output of the LSTM $o _ { t }$ to obtain a joint hidden vector $h _ { \mathrm { j o i n t } } = [ h _ { t } , o _ { t } ]$ . Then we apply two MLPs to $h _ { \mathrm { j o i n t } }$ to obtain the policy distribution $\pi ( a ; s _ { t } | \theta )$ as well as the value function $v ( s _ { t } | \theta )$ .
136
+
137
+ A visualization of the model is in the bottom part of Fig. 2. The parameters of CNN modules are shared across time.
138
+
139
+ # 6 EXPERIMENTAL RESULTS
140
+
141
+ We report experimental results for our models on the task of RoomNav. We first compare models with discrete and continuous action spaces with different input modalities. Then we explain our observations and show that techniques targeting different levels of augmentation improve the success rate of navigation in the test set. Moreover, these techniques are complementary to each other.
142
+
143
+ Setup. We train our baseline models on multiple experimental settings. We use two training datasets. The small set $\mathcal { E } _ { \mathrm { s m a l l } }$ contains 20 houses and the large set $\mathcal { E } _ { \mathrm { l a r g e } }$ contains 200 houses. A held-out dataset ${ \mathcal { E } } _ { \mathrm { t e s t } }$ is used for test, which contains 50 houses.
144
+
145
+ We mainly focus on success rate on the test set, i.e, how the agent generalizes. For reference, we also report the training performance. The agent fails if it failed to find the concept within 100 steps1. All success rate evaluations use a fixed random seed for a fair comparison. For each model, we run 2000 evaluation episodes on $\mathcal { E } _ { \mathrm { s m a l l } }$ and ${ \mathcal { E } } _ { \mathrm { t e s t } }$ , and 5000 evaluation episodes on $\mathcal { E } _ { \mathrm { l a r g e } }$ to measure overall success rates.
146
+
147
+ We use gated-CNN and gated-LSTM to denote the networks with gated-attention, and concat-CNN and concat-LSTM for models with simple concatenation. We also experiment with different visual signals to the agents, including RGB image (RGB Only), RGB image with depth information $( \mathrm { R G B + D e p t h } _ { \it . }$ ) and semantics mask with depth information (Mask+Depth). The input image resolution is $1 2 0 \times 9 0$ to preserve image details.
148
+
149
+ During each simulated episode, we randomly select a house from the environment set and randomly pick an applicable target from the house to instruct the agent. During training, we add an entropy bonus term for both models2 in addition to the original loss function. For evaluation, we keep the final model for DDPG due to its stable learning curve, while for A3C, we take the model with the highest training success rate. We use Pytorch (Paszke et al., 2017) and Adam (Kingma & Ba, 2014). See Appendix for more experiment details.
150
+
151
+ ![](images/2a7e99e411b4b1ed123690d80271e22c9fd61e30671c238b5ca0408323ae7085.jpg)
152
+ Figure 3: Overall performance of various models trained on (a) ${ \mathcal { E } } _ { \mathrm { s m a l l } }$ (20 houses) with different input signals: RGB Only, RGB $+$ Depth and Mask+Depth; (b) $\mathcal { E } _ { \mathrm { l a r g e } }$ (200 houses) with input signals: RGB $+$ Depth and Mask $^ +$ Depth. In each group, the bars from left to right correspond to gated-LSTM, concat-LSTM, gated-CNN, concat-CNN and random policy respectively.
153
+
154
+ ![](images/831f27bb070ec5c13732af2eab2e624097384a20c5e000ea1853f551e7d1aa7d.jpg)
155
+ Figure 4: Pixel-level Augmentation: Test performances of various models trained with different input signals, including RGB $^ +$ Depth on $\mathcal { E } _ { \mathrm { s m a l l } }$ , RGB with Domain Randomization on ${ \mathcal { E } } _ { \mathrm { s m a l l } }$ , Mask+Depth on $\mathcal { E } _ { \mathrm { s m a l l } }$ , Mask $^ +$ Depth on $\mathcal { E } _ { \mathrm { l a r g e } }$ . In each group, the bars represent gated-LSTM, concat-LSTM, gated-CNN and concat-CNN from left to right.
156
+
157
+ 6.1 BASELINES: MODELS WITH RGB SIGNALS ON $\mathcal { E } _ { \mathrm { S M A L L } }$
158
+
159
+ As shown in the bottom part of Fig. 3a, on $\mathcal { E } _ { \mathrm { s m a l l } }$ , the test success rate for models trained on RGB features is unsatisfactory. We observe obvious overfitting behavior: the test performance is drastically worse than training. In particular, the gated-LSTM models achieve even lower success rate than concat-LSTM models, despite the fact that they have much better training performance. In this case, the learning algorithm picks up spurious color patterns in the environments as the guidance towards the goal, which is inapplicable to unseen environments.
160
+
161
+ In both training and test, we find that depth information improves the performance thus we use it in the following experiments and omit Depth for conciseness.
162
+
163
+ # 6.2 TECHNIQUES FOR DIFFERENT LEVELS OF AUGMENTATION
164
+
165
+ Augmentation is a standard technique to improve generalization. However, for complicated tasks, augmentation needs to be taken care at different levels. In this section, we categorize augmentation techniques into 3 levels: (1) pixel-level augmentation: changing the colors and textures; (2) tasklevel augmentation: joint learning for multiple tasks; (3) scene-level augmentation: training on more environments. We analyze the generalization performance with all techniques and conclude that these techniques are complementary and that the best test performance is obtained by combining these techniques together.
166
+
167
+ Pixel-level Augmentation: We use domain randomization (Tobin et al., 2017), by reassigning each object in the scene a random color but keeping the textures. This breaks the spurious color correlations and pushes the agent to learn a better representation.
168
+
169
+ We explore domain randomization by generating an additional 180 houses with random object coloring from $\mathcal { E } _ { \mathrm { s m a l l } }$ , which leads to a total of 200 houses. We evaluate the test success rate of various models under different training settings, e.g., RGB, RGB with domain randomization (D.R.) or mask signal. The results are shown in Fig. 4. Interestingly, we noticed that domain randomization yields very similar performance as mask signal on $\mathcal { E } _ { \mathrm { s m a l l } }$ .
170
+
171
+ One shortcoming of domain randomization is that it requires substantially more training samples and thus suffers from high sample complexity. Thanks to the rich labels in House3D, we instead could use segmentation mask as an input feature plane, which encodes semantic information and is independent of the object color. This helps train generalizable agent with much fewer training samples. On the other hand, an agent trained with domain randomization can operate with RGB input only, without segmentation mask output from a vision subsystem. In the current context, we simply assume adopting segmentation mask input as the technique for pixel-level augmentation.
172
+
173
+ Task-level Augmentation: We explore task-level augmentation by adding related auxiliary targets during training (Fig. 5). Specifically, in addition to the 5 room types as auxiliary targets, we selected
174
+
175
+ ![](images/47a1cf4d0faa2df7ea6030a18f3c8112a74d0651fb7a73afe7ce8a6d479d18e6.jpg)
176
+ Figure 5: Task-Level Augmentation: Test performances of LSTM models trained with and without auxiliary targets on both ${ \mathcal { E } } _ { \mathrm { s m a l l } }$ and $\mathcal { E } _ { \mathrm { l a r g e } }$ . In each group, the bars represent gated-LSTM $+ \mathrm { \ R G B }$ , concat-LSTM $^ +$ RGB, gated-LSTM $^ +$ Mask and concat-LSTM $^ +$ Mask from left to right.
177
+
178
+ 15 object concepts (e.g., chair, table, cabinet, etc. See a full list of object concepts in appendix.).
179
+ We train A3C agents with different input signals on ${ \mathcal { E } } _ { \mathrm { s m a l l } }$ and evaluate their test performances.
180
+
181
+ We found that auxiliary targets significantly reduce overfitting and increases the generalizability of models with RGB inputs. Because of this effect, gated attention model, which has high model capacity, becomes much more effective on RGB signal when trained with more targets. On the other hand, with mask input, the agent does not need to learn to differentiate the objects, therefore auxiliary targets do not help that much for more complicated models like gated attention models.
182
+
183
+ Scene-level Augmentation: We could further boost the generalization performance by augmenting the training set with more diverse set of houses, i.e, $\mathcal { E } _ { \mathrm { l a r g e } }$ that contain 200 different houses. This is also a benefit from House3D.
184
+
185
+ For visual signals, we focus on feature combinations like “RGB $^ +$ Depth” and “M $\mathrm { a s k + D e }$ pth”. Note that for training efficiency, segmentation mask is a surrogate feature to approximate ${ } ^ { 6 6 } { \mathrm { R G B } } +$ domain randomization” as it shows similar results in the small set. Both train and test results are summarized in Fig. 3b.
186
+
187
+ On a semantically diverse dataset $\mathcal { E } _ { \mathrm { l a r g e } }$ , the overfitting issue is largely resolved. We see drops in the training performance and improve on the generalization. After training on a large number of environments, every model now has a much smaller gap between its training and test performance. This is in particularly true for the models using RGB signal, which suffers from overfitting issues on ${ \mathcal { E } } _ { \mathrm { s m a l l } }$ . Notably, on large dataset, LSTM models generally perform better than CNN models due to its high model capacity.
188
+
189
+ In addition, similar behavior was also observed during our experiments with techniques for pixellevel augmentation (Fig. 4) and task-level augmentation (Fig. 5). In all the experiments, all the models consistently achieves better generalization performances when trained on $\mathcal { E } _ { \mathrm { l a r g e } }$ , which again emphasizes the benefits of House3D.
190
+
191
+ The overall best success rate is achieved by gated-attention architecture with semantic signals. It is better than both RGB channels by over $8 \%$ and the counterpart trained on ${ \mathcal { E } } _ { \mathrm { s m a l l } }$ in terms of generalization metric. This means that pixel-level augmentation (e.g., domain randomization and/or segmentation mask) and scene-level augmentation (e.g., using diverse dataset) can improve the performance. Moreover, their effects are complementary.
192
+
193
+ A diverse environment like $\mathcal { E } _ { \mathrm { l a r g e } }$ also enables the model of larger capacity to work better. For example, LSTMs considerably outperform the simpler reactive models, i.e., CNNs with recent 5 frames as state input. We believe this is due to the larger scale and the high complexity of the training set, which makes it almost impossible for an agent to “remember” the optimal actions for every scenario. Instead, an agent needs to develop high-level abstractions (e.g., high-level exploration strategy, memory, etc). These are helpful induction biases that could lead to a more generalizable model.
194
+
195
+ Lastly, we also analyze the detailed success rate with respect to each target room in appendix.
196
+
197
+ # 7 CONCLUSION
198
+
199
+ In this paper, we propose a new environment, House3D, which contains 45K houses with a diverse set of objects and natural layouts resembling the real-world.
200
+
201
+ In House3D, we teach an agent to accomplish semantic goals. We define RoomNav, in which an agent needs to understand a given semantic concept, interpret the comprehensive visual signal, navigate to the target, and most importantly, succeed in a new unseen environment. We note that generalization to unseen environments was rarely studied in previous works.
202
+
203
+ To this end, we quantify the effect of various levels of augmentations, all facilitated by House3D by the means of domain randomization, multi-target training and the diversity of the environment. We resort to well established RL techniques equipped with gating to encode the task at hand. The final performance on unseen environments is much higher than baseline methods by over $8 \%$ . We hope House3D as well as our training techniques can benefit the whole RL community for building generalizable agents.
204
+
205
+ # REFERENCES
206
+
207
+ Jacob Andreas, Dan Klein, and Sergey Levine. Modular multitask reinforcement learning with policy sketches. arXiv preprint arXiv:1611.01796, 2016.
208
+ Iro Armeni, Ozan Sener, Amir R. Zamir, Helen Jiang, Ioannis Brilakis, Martin Fischer, and Silvio Savarese. 3D semantic parsing of large-scale indoor spaces. CVPR, 2016.
209
+ Charles Beattie, Joel Z Leibo, Denis Teplyashin, Tom Ward, Marcus Wainwright, Heinrich Kuttler, Andrew ¨ Lefrancq, Simon Green, V´ıctor Valdes, Amir Sadik, et al. Deepmind lab. ´ arXiv preprint arXiv:1612.03801, 2016.
210
+ Marc G Bellemare, Yavar Naddaf, Joel Veness, and Michael Bowling. The arcade learning environment: An evaluation platform for general agents. J. Artif. Intell. Res.(JAIR), 47:253–279, 2013.
211
+ Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. OpenAI gym. arXiv preprint arXiv:1606.01540, 2016.
212
+ Simon Brodeur, Ethan Perez, Ankesh Anand, Florian Golemo, Luca Celotti, Florian Strub Strub, Jean Rouat, Hugo Larochelle, and Aaron Courville Courville. HoME: a household multimodal environment. arXiv 1711.11017, 2017.
213
+ Angel Chang, Angela Dai, Thomas Funkhouser, Maciej Halber, Matthias Niessner, Manolis Savva, Shuran Song, Andy Zeng, and Yinda Zhang. Matterport3d: Learning from RGB-D data in indoor environments. International Conference on 3D Vision (3DV), 2017.
214
+ Devendra Singh Chaplot, Kanthashree Mysore Sathyendra, Rama Kumar Pasumarthi, Dheeraj Rajagopal, and Ruslan Salakhutdinov. Gated-attention architectures for task-oriented language grounding. arXiv preprint arXiv:1706.07230, 2017.
215
+ Paul Christiano, Zain Shah, Igor Mordatch, Jonas Schneider, Trevor Blackwell, Joshua Tobin, Pieter Abbeel, and Wojciech Zaremba. Transfer from simulation to real world through learning deep inverse dynamics model. arXiv preprint arXiv:1610.03518, 2016.
216
+ Abhishek Das, Samyak Datta, Georgia Gkioxari, Stefan Lee, Devi Parikh, and Dhruv Batra. Embodied Question Answering. arXiv preprint arXiv:1711.11543, 2017a.
217
+ Abhishek Das, Satwik Kottur, Stefan Lee, Jos M.F. Moura, and Dhruv Batra. Learning cooperative visual dialog agents with deep reinforcement learning. ICCV, 2017b.
218
+ Bhuwan Dhingra, Hanxiao Liu, Zhilin Yang, William W Cohen, and Ruslan Salakhutdinov. Gated-attention readers for text comprehension. arXiv preprint arXiv:1606.01549, 2016.
219
+ Gandhi Dhiraj, Pinto Lerrel, and Gupta Abhinav. Learning to fly by crashing. IROS, 2017.
220
+ Yan Duan, John Schulman, Xi Chen, Peter L Bartlett, Ilya Sutskever, and Pieter Abbeel. RL2: Fast reinforcement learning via slow reinforcement learning. arXiv preprint arXiv:1611.02779, 2016.
221
+ Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. arXiv preprint arXiv:1703.03400, 2017a.
222
+
223
+ Chelsea Finn, Tianhe Yu, Justin Fu, Pieter Abbeel, and Sergey Levine. Generalizing skills with semi-supervised reinforcement learning. ICLR, 2017b.
224
+
225
+ Dieter Fox, Sebastian Thrun, and Wolfram Burgard. Probabilistic Robotics. MIT press, 2005.
226
+
227
+ Saurabh Gupta, James Davidson, Sergey Levine, Rahul Sukthankar, and Jitendra Malik. Cognitive mapping and planning for visual navigation. CVPR, 2017.
228
+
229
+ Nicolas Heess, Gregory Wayne, David Silver, Tim Lillicrap, Tom Erez, and Yuval Tassa. Learning continuous control policies by stochastic value gradients. In Advances in Neural Information Processing Systems, pp. 2944–2952, 2015.
230
+
231
+ Irina Higgins, Arka Pal, Andrei A Rusu, Loic Matthey, Christopher P Burgess, Alexander Pritzel, Matthew Botvinick, Charles Blundell, and Alexander Lerchner. Darla: Improving zero-shot transfer in reinforcement learning. arXiv preprint arXiv:1707.08475, 2017.
232
+
233
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8):1735–1780, 1997.
234
+
235
+ 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.
236
+
237
+ Eric Jang, Shixiang Gu, and Ben Poole. Categorical reparameterization with Gumbel-Softmax. arXiv preprint arXiv:1611.01144, 2016.
238
+
239
+ Matthew Johnson, Katja Hofmann, Tim Hutton, and David Bignell. The Malmo platform for artificial intelligence experimentation. In IJCAI, pp. 4246–4247, 2016.
240
+
241
+ Simon Green Fumin Wang Ryan Faulkner Hubert Soyer David Szepesvari Wojciech Marian Czarnecki Max Jaderberg Denis Teplyashin Marcus Wainwright Chris Apps Demis Hassabis Karl Moritz Hermann, Felix Hill and PhilBlunsom. Grounded language learning in a simulated 3d world. In arXiv 1706.06551. 2017.
242
+
243
+ Michał Kempka, Marek Wydmuch, Grzegorz Runc, Jakub Toczek, and Wojciech Jaskowski. Vizdoom: A ´ doom-based AI research platform for visual reinforcement learning. In Computational Intelligence and Games (CIG), 2016 IEEE Conference on, pp. 1–8. IEEE, 2016.
244
+
245
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
246
+
247
+ John J. Leonard and Hugh F. Durrant-Whyte. Directed Sonar Sensing for Mobile Robot Navigation. Kluwer Academic Publishers, Norwell, MA, USA, 1992. ISBN 0792392426.
248
+
249
+ Sergey Levine, Chelsea Finn, Trevor Darrell, and Pieter Abbeel. End-to-end training of deep visuomotor policies. JMLR, 2016.
250
+
251
+ Timothy P Lillicrap, Jonathan J Hunt, Alexander Pritzel, Nicolas Heess, Tom Erez, Yuval Tassa, David Silver, and Daan Wierstra. Continuous control with deep reinforcement learning. arXiv preprint arXiv:1509.02971, 2015.
252
+
253
+ Ryan Lowe, Yi Wu, Aviv Tamar, Jean Harb, Pieter Abbeel, and Igor Mordatch. Multi-agent actor-critic for mixed cooperative-competitive environments. arXiv preprint arXiv:1706.02275, 2017.
254
+
255
+ John McCormac, Ankur Handa, Stefan Leutenegger, and Andrew J Davison. SceneNet RGB-D: Can 5m synthetic images beat generic ImageNet pre-training on indoor segmentation? In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2678–2687, 2017.
256
+
257
+ Alexander H Miller, Will Feng, Adam Fisch, Jiasen Lu, Dhruv Batra, Antoine Bordes, Devi Parikh, and Jason Weston. Parlai: A dialog research software platform. arXiv preprint arXiv:1705.06476, 2017.
258
+
259
+ Piotr Mirowski, Razvan Pascanu, Fabio Viola, Hubert Soyer, Andy Ballard, Andrea Banino, Misha Denil, Ross Goroshin, Laurent Sifre, Koray Kavukcuoglu, et al. Learning to navigate in complex environments. arXiv preprint arXiv:1611.03673, 2016.
260
+
261
+ 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.
262
+
263
+ 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.
264
+ Karthik Narasimhan, Regina Barzilay, and Tommi Jaakkola. Deep transfer in reinforcement learning by language grounding. arXiv preprint arXiv:1708.00133, 2017.
265
+ Junhyuk Oh, Satinder Singh, Honglak Lee, and Pushmeet Kohli. Zero-shot task generalization with multi-task deep reinforcement learning. arXiv preprint arXiv:1706.05064, 2017.
266
+ Emilio Parisotto and Ruslan Salakhutdinov. Neural map: Structured memory for deep reinforcement learning. arXiv preprint arXiv:1702.08360, 2017.
267
+ Adam Paszke, Sam Gross, and Soumith Chintala. Pytorch, 2017. URL http://pytorch.org/.
268
+ Deepak Pathak, Pulkit Agrawal, Alexei A. Efros, and Trevor Darrell. Curiosity-driven exploration by selfsupervised prediction. ICML, 2017.
269
+ Andrei A Rusu, Matej Vecerik, Thomas Rothorl, Nicolas Heess, Razvan Pascanu, and Raia Hadsell. Sim-to-real ¨ robot learning from pixels with progressive nets. arXiv preprint arXiv:1610.04286, 2016.
270
+ Fereshteh Sadeghi and Sergey Levine. CAD2RL: Real single-image flight without a single real image. RSS, 2017.
271
+ Manolis Savva, Angel X. Chang, Alexey Dosovitskiy, Thomas Funkhouser, and Vladlen Koltun. MINOS: Multimodal indoor simulator for navigation in complex environments. arXiv:1712.03931, 2017.
272
+ Tianlin Shi, Andrej Karpathy, Linxi Fan, Jonathan Hernandez, and Percy Liang. World of Bits: An opendomain platform for web-based agents. In International Conference on Machine Learning, pp. 3135–3144, 2017.
273
+ 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.
274
+ Shuran Song, Fisher Yu, Andy Zeng, Angel X Chang, Manolis Savva, and Thomas Funkhouser. Semantic scene completion from a single depth image. CVPR, 2017.
275
+ Gabriel Synnaeve, Nantas Nardelli, Alex Auvolat, Soumith Chintala, Timothee Lacroix, Zeming Lin, Florian ´ Richoux, and Nicolas Usunier. Torchcraft: a library for machine learning research on real-time strategy games. arXiv preprint arXiv:1611.00625, 2016.
276
+ Lei Tai and Ming Liu. Towards cognitive exploration through deep reinforcement learning for mobile robots. arXiv preprint arXiv:1610.01733, 2016.
277
+ Aviv Tamar, Yi Wu, Garrett Thomas, Sergey Levine, and Pieter Abbeel. Value iteration networks. In Advances in Neural Information Processing Systems, pp. 2154–2162, 2016.
278
+ Yuandong Tian, Qucheng Gong, Wenling Shang, Yuxin Wu, and Larry Zitnick. ELF: An extensive, lightweight and flexible research platform for real-time strategy games. arXiv preprint arXiv:1707.01067, 2017.
279
+ Josh Tobin, Rachel Fong, Alex Ray, Jonas Schneider, Wojciech Zaremba, and Pieter Abbeel. Domain randomization for transferring deep neural networks from simulation to the real world. arXiv preprint arXiv:1703.06907, 2017.
280
+ Oriol Vinyals, Timo Ewalds, Sergey Bartunov, Petko Georgiev, Alexander Sasha Vezhnevets, Michelle Yeo, Alireza Makhzani, Heinrich Kuttler, John Agapiou, Julian Schrittwieser, et al. Starcraft ii: A new challenge ¨ for reinforcement learning. arXiv preprint arXiv:1708.04782, 2017.
281
+ Yuke Zhu, Roozbeh Mottaghi, Eric Kolve, Joseph J Lim, Abhinav Gupta, Li Fei-Fei, and Ali Farhadi. Targetdriven visual navigation in indoor scenes using deep reinforcement learning. In Robotics and Automation (ICRA), 2017 IEEE International Conference on, pp. 3357–3364. IEEE, 2017.
282
+
283
+ Table 2: Statistics of the selected environment sets for RoomNav. RoomType% denotes the percentage of houses containing at least one target room of type RoomType.
284
+
285
+ <table><tr><td></td><td>3</td><td>avg.#targets</td><td>kitchen%</td><td>dining room %</td><td> living room%</td><td>bedroom%</td><td>bathroom%</td></tr><tr><td>Esmall</td><td>20</td><td>3.9</td><td>0.95</td><td>0.60</td><td>0.60</td><td>0.95</td><td>0.80</td></tr><tr><td>Elarge</td><td>200</td><td>3.7</td><td>1.00</td><td>0.35</td><td>0.63</td><td>0.94</td><td>0.80</td></tr><tr><td>Etest</td><td>50</td><td>3.7</td><td>1.00</td><td>0.48</td><td>0.58</td><td>0.94</td><td>0.70</td></tr></table>
286
+
287
+ <table><tr><td></td><td>test succ.</td><td>kitchen%</td><td>dining room %</td><td>living room%</td><td>bedroom%</td><td>bathroom%</td></tr><tr><td> gated-LSTM</td><td>35.8</td><td>37.9</td><td>50.4</td><td>48.0</td><td>33.5</td><td>21.2</td></tr><tr><td>gated-CNN</td><td>29.7</td><td>31.6</td><td>42.5</td><td>54.3</td><td>27.6</td><td>17.4</td></tr></table>
288
+
289
+ Table 3: Detailed test success rates for gated-CNN model and gated-LSTM model with “Mask+Depth” as input signal across different instruction concepts.
290
+
291
+ # A ROOMNAV TASK DETAILS
292
+
293
+ # A.1 STATISTICS OF SELECTED HOUSE SETS
294
+
295
+ We show the statistics of the selected three set of houses in Table 2.
296
+
297
+ In addition to these 5 houses, we also pick another 15 object concepts in our mid-level generalization experiment as auxiliary targets. The object concepts are: shower, sofa, toilet, bed, plant, television, table-and-chair, chair, table, kitchen-set, bathtub, vehicle, pool, kitchen-cabinet, curtain.
298
+
299
+ Detailed Specifications: The location information of an agent can be represented by 4 real numbers: the 3D location $( x , y , z )$ and the rotation degree $\rho$ of its first person view sensor, which indicates the front direction of the agent. Note that in RoomNav, the agent is not allowed to change its height $z$ , hence the overall degree of freedom is 3.
300
+
301
+ An action can be in the form of a triple $\boldsymbol { a } = ( \delta _ { x } , \delta _ { y } , \delta _ { \rho } )$ . After taking the action $a$ , the agent will move to a new 3D location $( x + \delta _ { x } , y + \delta _ { y } , z )$ with a new rotation $\rho + \delta _ { \rho }$ . The physics in House3D will detect collisions with objects under action $a$ and in RoomNav, the agent will remain still in case of a collision. We also restrict the velocity of the agent such that $| \delta _ { x } | , | \delta _ { y } | \leq 0 . 5$ and $| \delta _ { \rho } | \leq 3 0$ to ensure a smooth movement.
302
+
303
+ Continuous Action: A continuous action $a$ consists of two parts $a = [ m , r ]$ where $m = ( m _ { 1 } , \dots , m _ { 4 } )$ is for movement and $r = ( r _ { 1 } , r _ { 2 } )$ is for rotation. Since the velocity of the agent should be bounded, we require $m$ , $r$ to be a valid probability distribution. Suppose the original location of robot is $( x , y , z )$ and the angle of camera is $\rho$ , then after executing $a$ , the new 3D location will be $( x + ( m _ { 1 } - m _ { 2 } ) * 0 . 5 , y + ( m _ { 3 } - m _ { 4 } ) * 0 . 5 , z )$ and the new angle is $\rho + \left( r _ { 1 } - r _ { 2 } \right) * 3 0$ .
304
+
305
+ Discrete Action: We define 12 different action triples in the form of $a _ { i } = ( \delta _ { x } , \delta _ { y } , \delta _ { \rho } )$ satisfying the velocity constraints. There are 8 actions for movement: left, forward, right with two scales and two diagonal directions; and 4 actions for rotation: clockwise and counter-clockwise with two scales. In the discrete action setting, we do not allow the agent to move and rotate simultaneously.
306
+
307
+ Reward Details: In addition to the reward shaping of difference of shortest distances, we have the following rewards. When hitting an obstacle, the agent receives a penalty of 0.3. In the case of success, the winning reward is $+ 1 0$ . In order to encourage exploration (or to prevent eternal rotation), we add a time penalty of 0.1 to the agent for each time step outside the target room. Note that since we restrict the velocity of the agent, the difference of shortest path after an action will be no more than $0 . 5 \times \sqrt { 2 } \approx 0 . 7$ .
308
+
309
+ # B EXPERIMENT DETAILS
310
+
311
+ # B.1 NETWORK ARCHITECTURES
312
+
313
+ We apply a batch normalization layer after each layer in the CNN module. The activation function used is ReLU. The embedding dimension of concept instruction is 25.
314
+
315
+ Gated-CNN: In the CNN part, we have 4 convolution layers of 64, 64, 128, 128 channels perspective and with kernel size 5 and stride 2, as well as a fully-connected layer of 512 units. We use a linear layer to transform the concept embedding to a 512-dimension vector for gated fusion. The MLP for policy has two hidden layers of 128 and 64 units, and the MLP for Q-function has a single hidden layer of 64 units.
316
+
317
+ Gated-LSTM: In the CNN module, we have 4 convolution layers of 64, 64, 128, 128 channels each and with kernel size 5 and stride 2, as well as a fully-connected layer of 256 units. We use a linear layer to convert the concept embedding to a 256-dimension vector. The LSTM module has 256 hidden dimensions. The MLP module for policy contains two layers of 128 and 64 hidden units, and the MLP for value function has two hidden layers of 64 and 32 units.
318
+
319
+ # B.2 TRAINING PARAMETERS
320
+
321
+ We normalize each channel of the input frame to $[ 0 , 1 ]$ before feeding it into the neural network. Each of the training procedures includes a weight decay of $1 0 ^ { \div 5 }$ and a discounted factor $\gamma = 0 . 9 5$ .
322
+
323
+ DDPG: We stack $k = 5$ recent frames and use learning rate $1 0 ^ { 4 }$ with batch size 128. We choose $\alpha _ { \mathrm { D D P G } } = 1 0 0$ for all the settings except for the case with input signal of $\mathrm { \mathrm { } ^ { 6 6 } R G B + I }$ Depth” on $\mathcal { E } _ { \mathrm { l a r g e } }$ , where we choose $\alpha _ { \mathrm { D D P G } } =$ 10. We use an entropy bonus term with coefficient 0.001 on $\mathcal { E } _ { \mathrm { s m a l l } }$ and 0.01 on $\mathcal { E } _ { \mathrm { l a r g e } }$ . We use exponential average to update the target network with rate 0.001. A training update is performed every 10 time steps. The replay buffer size is $7 \times \mathrm { \overline { { 1 0 } } ^ { 5 } }$ . We run training for 80000 episodes in all. We use a linear exploration strategy in the first 30000 episodes.
324
+
325
+ A3C: We clip the reward to the range $[ - 1 , 1 ]$ and use a learning rate $1 e - 3$ with batch size 64. We launch 120 processes on ${ \mathcal { E } } _ { \mathrm { s m a l l } }$ and 200 on $\mathcal { E } _ { \mathrm { l a r g e } }$ . During training we estimate the discounted accumulative rewards and back-propagate through time for every 30 time steps unrolled. We perform a gradient clipping of 1.0 and decay the learning rate by a factor of 1.5 when the difference of KL-divergence becomes larger than 0.01. For training on $\mathcal { E } _ { \mathrm { s m a l l } }$ , we use a entropy bonus term with coefficient 0.1; while on $\mathcal { E } _ { \mathrm { l a r g e } }$ , the coefficient is 0.05. αA3C is 1.0. We perform $1 0 ^ { 5 }$ training updates and keep the best model with the highest training success rate.
326
+
327
+ # B.3 GENERALIZATION OVER DIFFERENT CONCEPTS
328
+
329
+ We illustrate in Table 3 the detailed test success rates of our models trained on ${ \mathcal { E } } _ { \operatorname { t r a i n } }$ with respect to each of the 5 concepts. Note that both models have similar behaviour across concepts. In particular, “dining room” and “living room” are the easiest while “bathroom” is the hardest. We suspect that this is because dining room and living room are often with large room space and have the best connectivity to other places. By contrast, bathroom is often very small and harder to find in big houses.
330
+
331
+ Lastly, we also experiment with adding auxiliary tasks of predicting the current room type during training. We found this does not help the training performance nor the test performance. We believe it is because our reward shaping has already provided strong supervision signals.
332
+
333
+ # B.4 AVERAGE STEPS TOWARDS SUCCESS
334
+
335
+ We also measure the number of steps required for an agent in RoomNav. For all the successful episodes, we evaluate the averaged number of steps towards the final target. The numbers are shown in Table 4. A random agent can only succeed when it’s initially spawned very close to the target, and therefore have very small number of steps towards target. Our trained agents, on the other hand, can explore in the environment and reach the target after resonable number of steps. Generally, our DDPG models takes fewer steps than our A3C models thanks to their continuous action space. But in all the settings, the number of steps required for a success is still far less than 100, namely the horizon length.
336
+
337
+ <table><tr><td></td><td>random</td><td>concat-LSTM</td><td>gated-LSTM</td><td>concat-CNN</td><td>gated-CNN</td></tr><tr><td colspan="6">Avg. #steps towards targets on &amp;small with different input signals</td></tr><tr><td>RGB+Depth (train)</td><td>14.2</td><td>35.9</td><td>41.0</td><td>31.7</td><td>33.8</td></tr><tr><td>RGB+Depth (test)</td><td>13.3</td><td>27.1</td><td>29.8</td><td>26.1</td><td>25.3</td></tr><tr><td>Mask+Depth (train)</td><td>14.2</td><td>38.4</td><td>40.9</td><td>34.9</td><td>36.6</td></tr><tr><td>Mask+Depth (test)</td><td>13.3</td><td>31.9</td><td>34.3</td><td>26.2</td><td>30.4</td></tr><tr><td colspan="6">Avg. #steps towards targets on Elarge with different input signals</td></tr><tr><td>RGB+Depth (train)</td><td>16.0</td><td>36.4</td><td>35.6</td><td>31.0</td><td>32.4</td></tr><tr><td>RGB+Depth (test)</td><td>13.3</td><td>34.0</td><td>33.8</td><td>24.4</td><td>25.7</td></tr><tr><td>Mask+Depth (train)</td><td>16.0</td><td>40.1</td><td>38.8</td><td>34.6</td><td>36.2</td></tr><tr><td>Mask+Depth (test)</td><td>13.3</td><td>34.8</td><td>34.3</td><td>30.6</td><td>30.9</td></tr></table>
338
+
339
+ Table 4: Averaged number of steps towards the target in all success trials for all the evaluated models with various input signals and different environments.
md/train/rkcQFMZRb/rkcQFMZRb.md ADDED
@@ -0,0 +1,445 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # VARIATIONAL IMAGE COMPRESSION WITH A SCALE HYPERPRIOR
2
+
3
+ Johannes Ballé∗ jballe@google.com
4
+
5
+ David Minnen∗ dminnen@google.com
6
+
7
+ Saurabh Singh∗ saurabhsingh@google.com
8
+
9
+ Sung Jin Hwang∗ sjhwang@google.com
10
+
11
+ Nick Johnston∗nickj@google.com
12
+
13
+ ∗Google Mountain View, CA 94043, USA
14
+
15
+ # ABSTRACT
16
+
17
+ We describe an end-to-end trainable model for image compression based on variational autoencoders. The model incorporates a hyperprior to effectively capture spatial dependencies in the latent representation. This hyperprior relates to side information, a concept universal to virtually all modern image codecs, but largely unexplored in image compression using artificial neural networks (ANNs). Unlike existing autoencoder compression methods, our model trains a complex prior jointly with the underlying autoencoder. We demonstrate that this model leads to state-of-the-art image compression when measuring visual quality using the popular MS-SSIM index, and yields rate–distortion performance surpassing published ANN-based methods when evaluated using a more traditional metric based on squared error (PSNR). Furthermore, we provide a qualitative comparison of models trained for different distortion metrics.
18
+
19
+ # 1 INTRODUCTION
20
+
21
+ Recent machine learning methods for lossy image compression have generated significant interest in both the machine learning and image processing communities (e.g., Ballé et al., 2017; Theis et al., 2017; Toderici et al., 2017; Rippel and Bourdev, 2017). Like all lossy compression methods, they operate on a simple principle: an image, typically modeled as a vector of pixel intensities $_ { \textbf { \em x } }$ , is quantized, reducing the amount of information required to store or transmit it, but introducing error at the same time. Typically, it is not the pixel intensitites that are quantized directly. Rather, an alternative (latent) representation of the image is found, a vector in some other space $\textbf { { y } }$ , and quantization takes place in this representation, yielding a discrete-valued vector $\hat { y }$ . Because it is discrete, it can be losslessly compressed using entropy coding methods, such as arithmetic coding (Rissanen and Langdon, 1981), to create a bitstream which is sent over the channel. Entropy coding relies on a prior probability model of the quantized representation, which is known to both encoder and decoder (the entropy model).
22
+
23
+ In the class of ANN-based methods for image compression mentioned above, the entropy model used to compress the latent representation is typically represented as a joint, or even fully factorized, distribution $p _ { \hat { \pmb { y } } } ( \hat { \pmb { y } } )$ . Note that we need to distinguish between the actual marginal distribution of the latent representation $m ( \hat { \pmb y } )$ , and the entropy model $p _ { \hat { \pmb { y } } } ( \hat { \pmb { y } } )$ . While the entropy model is typically assumed to have some parametric form, with parameters fitted to the data, the marginal is an unknown distribution arising from both the distribution of images that are encoded, and the method which is used to infer the alternative representation $\textbf { { y } }$ . The smallest average code length an encoder–decoder pair can achieve, using $p _ { \hat { \mathbf { \it y } } }$ as their shared entropy model, is given by the Shannon cross entropy between the two distributions:
24
+
25
+ $$
26
+ R = \mathbb { E } _ { \hat { \pmb { y } } \sim m } [ - \log _ { 2 } p _ { \hat { \pmb { y } } } ( \hat { \pmb { y } } ) ] .
27
+ $$
28
+
29
+ Note that this entropy is minimized if the model distribution is identical to the marginal. This implies that, for instance, using a fully factorized entropy model, when statistical dependencies exist in the actual distribution of the latent representation, will lead to suboptimal compression performance.
30
+
31
+ One way conventional compression methods increase their compression performance is by transmitting side information: additional bits of information sent from the encoder to the decoder, which signal modifications to the entropy model intended to reduce the mismatch. This is feasible because the marginal for a particular image typically varies significantly from the marginal for the ensemble of images the compression model was designed for. In this scheme, the hope is that the amount of side information sent is smaller, on average, than the reduction of code length achieved in eq. (1) by matching $p _ { \hat { \mathbf { \it y } } }$ more closely to the marginal for a particular image. For instance, JPEG (1992) models images as independent fixed-size blocks of $8 \times 8$ pixels. However, some image structure, such as large homogeneous regions, can be more efficiently represented by considering larger blocks at a time. For this reason, more recent methods such as HEVC (2013) partition an image into variablesize blocks, convey the partition structure to the decoder as side information, and then compress the block representations using that partitioning. That is, the entropy model for JPEG is always factorized into groups of 64 elements, whereas the factorization is variable for HEVC. The HEVC decoder needs to decode the side information first, so that it can use the correct entropy model to decode the block representations. Since the encoder is free to select a partitioning that optimizes the entropy model for each image, this scheme can be used to achieve more efficient compression.
32
+
33
+ ![](images/62379532d85e57e76a7f106e13482a843d2413edc5754907416a7826696126f7.jpg)
34
+ Figure 1: Left: representation of a transform coding model as a generative Bayesian model, and a corresponding variational inference model. Nodes represent random variables or parameters, and arrows indicate conditional dependence between them. Right: diagram showing the operational structure of the compression model. Arrows indicate the flow of data, and boxes represent transformations of the data. Boxes labeled $\textit { u } | \textit { Q }$ represent either addition of uniform noise applied during training (producing vectors labeled with a tilde), or quantization and arithmetic coding/decoding during testing (producing vectors labeled with a hat).
35
+
36
+ In conventional compression methods, the structure of this side information is hand-designed. In contrast, the model we present in this paper essentially learns a latent representation of the entropy model, in the same way that the underlying compression model learns a representation of the image. Because our model is optimized end-to-end, it minimizes the total expected code length by learning to balance the amount of side information with the expected improvement of the entropy model. This is done by expressing the problem formally in terms of variational autoencoders (VAEs), probabilistic generative models augmented with approximate inference models (Kingma and Welling, 2014). Ballé et al. (2017) and Theis et al. (2017) previously noted that some autoencoder-based compression methods are formally equivalent to VAEs, where the entropy model, as described above, corresponds to the prior on the latent representation. Here, we use this formalism to show that side information can be viewed as a prior on the parameters of the entropy model, making them hyperpriors of the latent representation.
37
+
38
+ Specifically, we extend the model presented in Ballé et al. (2017), which has a fully factorized prior, with a hyperprior that captures the fact that spatially neighboring elements of the latent representation tend to vary together in their scales. We demonstrate that the extended model leads to state-ofthe-art image compression performance when measured using the MS-SSIM quality index (Wang, Simoncelli, et al., 2003). Furthermore, it provides significantly better rate–distortion performance compared to other ANN-based methods when measured using peak signal-to-noise ratio (PSNR), a metric based on mean squared error. Finally, we present a qualitative comparison of the effects of training the same model class using different distortion losses.
39
+
40
+ # 2 COMPRESSION WITH VARIATIONAL MODELS
41
+
42
+ In the transform coding approach to image compression (Goyal, 2001), the encoder transforms the image vector $_ { \textbf { \em x } }$ using a parametric analysis transform $g _ { a } ( { \pmb x } ; \phi _ { g } )$ into a latent representation $\textbf { { y } }$ , which is then quantized to form $\hat { y }$ . Because $\hat { y }$ is discrete-valued, it can be losslessly compressed using entropy coding techniques such as arithmetic coding (Rissanen and Langdon, 1981) and transmitted as a sequence of bits. On the other side, the decoder recovers $\hat { y }$ from the compressed signal, and subjects it to a parametric synthesis transform $g _ { s } ( \hat { y } ; \pmb { \theta } _ { g } )$ to recover the reconstructed image $\hat { \pmb x }$ . In the context of this paper, we think of the transforms $g _ { a }$ and $g _ { s }$ as generic parameterized functions, such as artificial neural networks (ANNs), rather than linear transforms as in traditional compression methods. The parameters $\theta _ { g }$ and $\phi _ { g }$ then encapsulate the weights of the neurons, etc. (refer to section 4 for details).
43
+
44
+ ![](images/5a42160c527f00e0710d3a9ed49d63128467312382b9e89b4ef63ed65a246462.jpg)
45
+ Figure 2: Left: an image from the Kodak dataset. Middle left: visualization of a subset of the latent representation $\textbf { { y } }$ of that image, learned by our factorized-prior model. Note that there is clearly visible structure around edges and textured regions, indicating that a dependency structure exists in the marginal which is not represented in the factorized prior. Middle right: standard deviations $\hat { \pmb { \sigma } }$ of the latents as predicted by the model augmented with a hyperprior. Right: latents $\textbf { { y } }$ divided elementwise by their standard deviation. Note how this reduces the apparent structure, indicating that the structure is captured by the new prior.
46
+
47
+ The quantization introduces error, which is tolerated in the context of lossy compression, giving rise to a rate–distortion optimization problem. Rate is the expected code length (bit rate) of the compressed representation: assuming the entropy coding technique is operating efficiently, this can again be written as a cross entropy:
48
+
49
+ $$
50
+ R = \mathbb { E } _ { { \pmb x } \sim p _ { \pmb x } } \left[ - \log _ { 2 } p _ { \hat { \pmb y } } \big ( Q ( g _ { a } ( { \pmb x } ; \phi _ { g } ) ) \big ) \right] ,
51
+ $$
52
+
53
+ where $Q$ represents the quantization function, and $p _ { \hat { \pmb { y } } }$ is the entropy model, as described in the introduction. In this context, the marginal distribution of the latent representation arises from the (unknown) image distribution $p _ { \pmb { x } }$ and the properties of the analysis transform. Distortion is the expected difference between the reconstruction $\hat { \pmb x }$ and the original image $_ { \textbf { \em x } }$ , as measured by a norm or perceptual metric. The coarseness of the quantization, or alternatively, the warping of the representation implied by the analysis and synthesis transforms, affects both rate and distortion, leading to a trade-off, where a higher rate allows for a lower distortion, and vice versa. Various compression methods can be viewed as minimizing a weighted sum of these two quantities. Formally, we can parameterize the problem by $\lambda$ , a weight on the distortion term. Different applications require different trade-offs, and hence different values of $\lambda$ .
54
+
55
+ In order to be able to use gradient descent methods to optimize the performance of the model over the parameters of the transforms $\wp _ { g }$ and $\phi _ { g , \ l }$ ), the problem needs to be relaxed, because due to the quantization, gradients with respect to $\phi _ { g }$ are zero almost everywhere. Approximations that have been investigated include substituting the gradient of the quantizer (Theis et al., 2017), and substituting additive uniform noise for the quantizer itself during training (Ballé et al., 2016b). Here, we follow the latter method, which switches back to actual quantization when applying the model as a compression method. We denote the quantities derived from this approximation with a tilde, as opposed to a hat; for instance, $\tilde { y }$ represents the “noisy” representation, and $\hat { y }$ the quantized representation.
56
+
57
+ The optimization problem can be formally represented as a variational autoencoder (Kingma and Welling, 2014); that is, a probabilistic generative model of the image combined with an approximate inference model (figure 1). The synthesis transform is linked to the generative model (“generating” a reconstructed image from the latent representation), and the analysis transform to the inference model (“inferring” the latent representation from the source image). In variational inference, the goal is to approximate the true posterior $p _ { \tilde { \pmb { y } } | \pmb { x } } ( \tilde { \pmb { y } } \mid \pmb { x } )$ , which is assumed intractable, with a parametric variational density $q ( \tilde { \textbf { \mathscr { y } } } \mid x )$ by minimizing the expectation of their Kullback–Leibler (KL) divergence over the data distribution $p _ { \pmb { x } }$ :
58
+
59
+ $$
60
+ \mathbb { E } _ { \alpha \sim p _ { \alpha } } D _ { \mathrm { K L } } [ q \mathbin { \lVert } p _ { \tilde { y } \rVert x } ] = \mathbb { E } _ { \alpha \sim p _ { \alpha } } \mathbb { E } _ { \tilde { y } \sim q } \left[ \log q ( \tilde { y } + \overbrace { x } ) ^ { * } \underbrace { \log p _ { \alpha | \tilde { y } } ( x \mathbin { \lvert } \tilde { y } ) } _ { \mathrm { V o } \mathbin { \lvert } \tilde { y } \rvert } \underbrace { - \log p _ { \tilde { y } } ( \tilde { y } ) } _ { \mathrm { V o } \mathbin { \lvert } \tilde { y } \rvert } \right] + \mathrm { c o n s t . }
61
+ $$
62
+
63
+ By matching the parametric density functions to the transform coding framework, we can appreciate that the minimization of the $\mathrm { K L }$ divergence is equivalent to optimizing the compression model for rate–distortion performance. We have indicated here that the first term will evaluate to zero, and the second and third term correspond to the weighted distortion and the bit rate, respectively. Let’s take a closer look at each of the terms.
64
+
65
+ First, the mechanism of “inference” is computing the the analysis transform of the image and adding uniform noise (as a stand-in for quantization), thus:
66
+
67
+ $$
68
+ \begin{array} { l l l } { q ( \pmb { \tilde { y } } \mid \pmb { x } , \phi _ { g } ) } & { = } & { \displaystyle \prod _ { i } { \mathcal U } \big ( \tilde { y } _ { i } \mid y _ { i } - \frac { 1 } { 2 } , y _ { i } + \frac { 1 } { 2 } \big ) } \end{array}
69
+ $$
70
+
71
+ where $\mathcal { U }$ denotes a uniform distribution centered on $y _ { i }$ . Since the width of the uniform distribution is constant (equal to one), the first term in the KL divergence technically evaluates to zero, and can be dropped from the loss function.
72
+
73
+ For the sake of argument, assume for a moment that the likelihood is given by:
74
+
75
+ $$
76
+ \begin{array} { r l r } { p _ { x | \tilde { y } } ( x \mid \tilde { y } , \pmb { \theta } _ { g } ) } & { = } & { \mathcal { N } \big ( x \mid \tilde { x } , ( 2 \lambda ) ^ { - 1 } \mathbf { 1 } \big ) } \\ & { } & { \mathrm { w i t h } \tilde { x } = g _ { s } ( \tilde { y } ; \pmb { \theta } _ { g } ) . } \end{array}
77
+ $$
78
+
79
+ The log likelihood then works out to be the squared difference between $_ { \textbf { \em x } }$ and $\tilde { \pmb x }$ , the output of the synthesis transform, weighted by $\lambda$ . Minimizing the second term in the KL divergence is thus equivalent to minimizing the expected distortion of the reconstructed image. A squared error loss is equivalent to choosing a Gaussian distribution; other distortion metrics may have an equivalent distribution, but this is not guaranteed, as not all metrics necessarily correspond to a normalized density function.
80
+
81
+ The third term in the KL divergence is easily seen to be identical to the cross entropy between the marginal $m ( \tilde { \pmb { y } } ) = \mathbb { E } _ { { \pmb { x } } \sim p _ { \pmb { x } } } q ( \tilde { \pmb { y } } \mid { \pmb x } )$ and the prior $p _ { \tilde { \pmb { y } } } ( \tilde { \pmb { y } } )$ . It reflects the cost of encoding $\tilde { y }$ , as produced by the inference model, assuming $p _ { \tilde { \mathbf { \mathcal { Y } } } }$ as the entropy model. Note that this term represents a differential cross entropy, as opposed to a Shannon (discrete) entropy as in eq. (2), due to the uniform noise approximation. Under the given assumptions, however, they are close approximations of each other (for an empirical evaluation of this approximation, see Ballé et al., 2017). Similarly to Ballé et al. (2017), we model the prior using a non-parametric, fully factorized density model (refer to appendix 6.1 for details):
82
+
83
+ $$
84
+ p _ { \tilde { \pmb { y } } | \psi } ( \tilde { \pmb { y } } \mid \psi ) = \prod _ { i } \left( p _ { y _ { i } | \psi ^ { ( i ) } } \left( \psi ^ { ( i ) } \right) * \mathcal { U } \left( - \textstyle \frac { 1 } { 2 } , \textstyle \frac { 1 } { 2 } \right) \right) ( \tilde { y } _ { i } )
85
+ $$
86
+
87
+ where the vectors $\psi ^ { ( i ) }$ encapsulate the parameters of each univariate distribution $p _ { y _ { i } | \psi ^ { ( i ) } }$ (we denote all these parameters collectively as $\psi$ ). Note that we convolve each non-parametric density with a standard uniform density. This is to enable a better match of the prior to the marginal – for more details, see appendix 6.2. As a shorthand, we refer to this case as the factorized-prior model.
88
+
89
+ The center panel in figure 2 visualizes a subset of the quantized responses $( \hat { y } )$ of a compression model trained in this way. Visually, it is clear that the choice of a factorized distribution is a stark simplification: non-zero responses are highly clustered in areas of high contrast; i.e., around edges, or within textured regions. This implies a probabilistic coupling between the responses, which is not represented in models with a fully factorized prior. We would expect a better model fit and, consequently, a better compression performance, if the model captured these dependencies. Introducing a hyperprior is an elegant way of achieving this.
90
+
91
+ ![](images/57f01f04f349fbee0c0c36fc2c01503e2d9f08b8341b433f11ce2de67276d55e.jpg)
92
+ Figure 3: As in figure 1, but extended with a hyperprior.
93
+
94
+ # 3 INTRODUCTION OF A SCALE HYPERPRIOR
95
+
96
+ As evident from the center panel of figure 2, there are significant spatial dependencies among the elements of $\hat { y }$ . Notably, their scales appear coupled spatially. A standard way to model dependencies between a set of target variables is to introduce latent variables conditioned on which the target variables are assumed to be independent (Bishop, 1999). We introduce an additional set of random variables $\tilde { z }$ to capture the spatial dependencies and propose to extend the model as follows (figure 3).
97
+
98
+ Each element $\tilde { y } _ { i }$ is now modeled as a zero-mean Gaussian with its own standard deviation $\sigma _ { i }$ , where the standard deviations are predicted by applying a parametric transform $h _ { s }$ to $\tilde { z }$ (as above, we convolve each Gaussian density with a standard uniform; see appendix 6.2):
99
+
100
+ $$
101
+ p _ { \tilde { \pmb { y } } | \tilde { \pmb { z } } } ( \tilde { \pmb { y } } \mid \tilde { \pmb { z } } , \pmb { \theta } _ { h } ) = \prod _ { i } \Bigl ( \mathcal { N } \bigl ( 0 , \tilde { \sigma } _ { i } ^ { 2 } \bigr ) \ast \mathcal { U } \bigl ( - \textstyle { \frac { 1 } { 2 } } , \frac { 1 } { 2 } \bigr ) \Bigr ) ( \tilde { y } _ { i } )
102
+ $$
103
+
104
+ We extend the inference model simply by stacking another parametric transform $h _ { a }$ on top of $\textbf { { y } }$ , effectively creating a single joint factorized variational posterior, as follows:
105
+
106
+ $$
107
+ \begin{array} { l c l } { { q ( \tilde { y } , \tilde { z } \mid x , \phi _ { g } , \phi _ { h } ) } } & { { = } } & { { \displaystyle { \prod _ { i } \mathcal U \big ( \tilde { y } _ { i } \mid y _ { i } - \frac { 1 } { 2 } , y _ { i } + \frac { 1 } { 2 } \big ) \cdot \prod _ { j } \mathcal U \big ( \tilde { z } _ { j } \mid z _ { j } - \frac { 1 } { 2 } , z _ { j } + \frac { 1 } { 2 } \big ) } } } \\ { { } } & { { } } & { { \mathrm { w i t h } ~ y = g _ { a } ( { \bf x } ; \phi _ { g } ) , z = h _ { a } ( y ; \phi _ { h } ) . } } \end{array}
108
+ $$
109
+
110
+ This follows the intuition that the responses $\textbf { { y } }$ should be sufficient to estimate the spatial distribution of the standard deviations. As we have no prior beliefs about the hyperprior, we now model $\tilde { z }$ using the non-parametric, fully factorized density model previously used for $\tilde { y }$ (appendix 6.1):
111
+
112
+ $$
113
+ \begin{array} { r c l } { p _ { \tilde { z } | \psi } ( \tilde { z } \mid \psi ) } & { = } & { \displaystyle \prod _ { i } \left( p _ { z _ { i } | \psi ^ { ( i ) } } \left( \psi ^ { ( i ) } \right) * \mathcal { U } \left( - \frac { 1 } { 2 } , \frac { 1 } { 2 } \right) \right) ( \tilde { z } _ { i } ) , } \end{array}
114
+ $$
115
+
116
+ where the vectors $\psi ^ { ( i ) }$ encapsulate the parameters of each univariate distribution $p _ { z _ { i } | \psi ^ { ( i ) } }$ (collectively denoted as $\psi$ ). The loss function of this model works out to be:
117
+
118
+ $$
119
+ \begin{array} { r l } & { \mathbb { E } _ { \alpha \sim p _ { \alpha } } D _ { \mathrm { K L } } \big [ q \bigm \lVert p _ { \tilde { y } , \tilde { z } | x } \big ] = \mathbb { E } _ { \alpha \sim p _ { \alpha } } \mathbb { E } _ { \tilde { y } , \tilde { z } \sim q } \Big [ \log q ( \tilde { y } , \tilde { z } \mid x ) - \log p _ { \alpha | \tilde { y } } ( x \mid \tilde { y } ) } \\ & { \qquad \quad - \log p _ { \tilde { y } | \tilde { z } } ( \tilde { y } \mid \tilde { z } ) - \log p _ { \tilde { z } } ( \tilde { z } ) \Big ] + \mathrm { c o n s t . } } \end{array}
120
+ $$
121
+
122
+ Again, the first term is zero, since $q$ is a product of uniform densities of unit width. The second term (the likelihood) encapsulates the distortion, as before. The third and fourth term represent the cross entropies encoding $\tilde { y }$ and $\tilde { z }$ , respectively. In analogy to traditional transform coding, the fourth term can be seen as representing side information.
123
+
124
+ The right-hand panel in figure 3 illustrates how the model is used as a compression method. The encoder subjects the input image $_ { \textbf { \em x } }$ to $g _ { a }$ , yielding the responses $\textbf { { y } }$ with spatially varying standard deviations. The responses are fed into $h _ { a }$ , summarizing the distribution of standard deviations in $z , \ z$ is then quantized, compressed, and transmitted as side information. The encoder then uses the quantized vector $\hat { z }$ to estimate $\hat { \pmb { \sigma } }$ , the spatial distribution of standard deviations, and uses it to compress and transmit the quantized image representation $\hat { y }$ . The decoder first recovers $\hat { z }$ from the compressed signal. It then uses $h _ { s }$ to obtain $\hat { \pmb { \sigma } }$ , which provides it with the correct probability estimates to successfully recover $\hat { y }$ as well. It then feeds $\hat { y }$ into $g _ { s }$ to obtain the reconstructed image.
125
+
126
+ ![](images/bc8f3d3ee2b18a7d430f906edf28c59b3aa32b8dce5c09930528dd55ce2b696e.jpg)
127
+ Figure 4: Network architecture of the hyperprior model. The left side shows an image autoencoder architecture, the right side corresponds to the autoencoder implementing the hyperprior. The factorized-prior model uses the identical architecture for the analysis and synthesis transforms $g _ { a }$ and $g _ { s }$ . Q represents quantization, and AE, AD represent arithmetic encoder and arithmetic decoder, respectively. Convolution parameters are denoted as: number of filters $\times$ kernel support height $\times$ kernel support width / down- or upsampling stride, where $\uparrow$ indicates upsampling and $\downarrow$ downsampling. $N$ and $M$ were chosen dependent on $\lambda$ , with $N = 1 2 8$ and $M = 1 9 2$ for the 5 lower values, and $N = 1 9 2$ and $M = 3 2 0$ for the 3 higher values.
128
+
129
+ # 4 EXPERIMENTS
130
+
131
+ To compare the compression performance of our proposed models, we conducted a number of experiments using the Tensorflow framework.
132
+
133
+ # 4.1 EXPERIMENTAL SETUP
134
+
135
+ We set up the transforms $g _ { a } , g _ { s } , h _ { a }$ , and $h _ { s }$ as alternating compositions of linear and nonlinear functions, as is common in artificial neural networks (figure 4). Specifically, $g _ { a }$ and $g _ { s }$ are composed of convolutions and GDN/IGDN nonlinearities, which implement local divisive normalization, a type of transformation that has been shown to be particularly suitable for density modeling and compression of images (Ballé et al., 2016a; Ballé et al., 2017).1 $h _ { a }$ and $h _ { s }$ are composed of convolutions and rectifiers (rectified linear units). To make the hyperprior model and the factorized-prior model comparable, we chose identical architectures for $g _ { a }$ and $g _ { s }$ , as shown in figure 4.
136
+
137
+ To maintain translation invariance across the model, all elements of $_ z$ with the same channel index are assumed to follow the same univariate distribution. This allows the model to be used with arbitrary image sizes. Arithmetic coding is implemented using a simple non-adaptive binary arithmetic coder. Each element of $\hat { y }$ and $\hat { z }$ is independently converted to its representation as a binary integer and arithmetically encoded from the most significant to the least significant bit. Since the spatial distribution of standard deviations $( \hat { \sigma } )$ is known to the decoder by the time decoding of $\hat { y }$ is attempted, the arithmetic coder does not need to handle conditional dependencies. It also does not need to be separately trained, since the binary probabilities needed for encoding are a direct function of the probability mass functions of $\hat { y }$ and $\hat { z }$ , and the probability mass functions in turn are direct functions of their “noisy” counterparts $\tilde { y } , \tilde { z }$ by design (Ballé et al., 2017). This is particulary important for $\hat { y }$ . Since the prior is conditioned on $\hat { \pmb { \sigma } }$ , the probability mass functions $p _ { \hat { y } _ { i } }$ need to be constructed “on the fly” during decoding of an image:
138
+
139
+ $$
140
+ p _ { \hat { y } _ { i } } ( \hat { y } _ { i } \mid \hat { \sigma } _ { i } ) = p _ { \tilde { y } _ { i } } ( \hat { y } _ { i } \mid \hat { \sigma } _ { i } ) = \left( \mathcal { N } ( 0 , \hat { \sigma } _ { i } ) \ast \mathcal { U } \big ( - \textstyle \frac { 1 } { 2 } , \textstyle \frac { 1 } { 2 } \big ) \right) ( \hat { y } _ { i } ) = \int _ { \hat { y } _ { i } - 1 / 2 } ^ { \hat { y } _ { i } + 1 / 2 } \mathcal { N } ( y \mid 0 , \hat { \sigma } _ { i } ) \mathrm { d } y ,
141
+ $$
142
+
143
+ which can be evaluated in closed form.
144
+
145
+ The models were trained on a body of color JPEG images with heights/widths between 3000 and 5000 pixels, comprising approximately 1 million images scraped from the world wide web. Images with excessive saturation were screened out to reduce the number of non-photographic images. To reduce existing compression artifacts, the images were further downsampled by a randomized factor, such that the minimum of their height and width equaled between 640 and 1200 pixels. Then, randomly placed $2 5 6 \times 2 5 6$ pixel crops of these downsampled images were extracted. Minibatches of 8 of these crops at a time were used to perform stochastic gradient descent using the Adam algorithm (Kingma and Ba, 2015) with a learning rate of $1 0 ^ { - 4 }$ . Common machine learning techniques such as batch normalization or learning rate decay were found to have no beneficial effect (this may be due to the local normalization properties of GDN, which contain global normalization as a special case).
146
+
147
+ With this setup, we trained a total of 32 separate models: half of the models with a hyperprior and half without; half of the models with mean squared error as the distortion metric (as described in the previous section), and half on the MS-SSIM distortion index (Wang, Simoncelli, et al., 2003); finally, each of these combinations with 8 different values of $\lambda$ in order to cover a range of rate– distortion tradeoffs.
148
+
149
+ # 4.2 EXPERIMENTAL RESULTS
150
+
151
+ We evaluate the compression performance of all models on the publicly available Kodak dataset (Eastman Kodak, 1993). Summarized rate–distortion curves are shown in figure 5. Results for individual images, as well as summarized comparisons to a wider range of existing methods are provided in appendices 6.5 and 6.7. We quantify image distortion using peak signal-to-noise ratio (PSNR) and MS-SSIM. Each curve represents the rate–distortion tradeoffs for a given set of models, across different values of $\lambda$ . Since MS-SSIM yields values between 0 (worst) and 1 (best), and most of the compared methods achieve values well above 0.9, we converted the quantity to decibels in order to improve legibility.
152
+
153
+ Interestingly, but maybe not surprisingly, results differ substantially depending on which distortion metric is used in the loss function during training. When measuring distortion in PSNR (figure 5, top), both our models perform poorly if they have been optimized for MS-SSIM. However, when optimized for squared error, the model with the factorized prior outperforms existing conventional codecs such as JPEG, as well as other ANN-based methods which have been trained for squared error (Theis et al., 2017; Ballé et al., 2017). Note that other published ANN-based methods not shown here underperform compared to the ones that are shown, or have not made their data available to us. Our factorized prior model does not outperform BPG (Bellard, 2014), an encapsulation of HEVC (2013) targeted at still image compression. When training our hyperprior model for squared error, we get close to BPG performance, with better results at higher bit rates than lower ones, but still substantially outperforming all published ANN-based methods.
154
+
155
+ When measuring distortion using MS-SSIM (figure 5, bottom), conventional codecs such as JPEG and BPG end up at the lower end of the performance ranking. This is not surprising, since these methods have been optimized for squared error (with hand-selected constraints intended to ensure that squared error optimization doesn’t go against visual quality). To the best of our knowledge, the state of the art for compression performance in terms of MS-SSIM is Rippel and Bourdev (2017). Surprisingly, it is matched (with better performance at high bit rates, and slightly worse performance at low bit rates) by our factorized prior model, even though their model is conceptually much more complex (due to its multiscale architecture, GAN loss, and context-adaptive entropy model). The hyperprior model adds further gains across all rate–distortion tradeoffs, consistently surpassing the state of the art.
156
+
157
+ With the results differing so heavily depending on which training loss is used, one has to wonder if there are any qualitative differences in the image reconstructions. When comparing images compressed to similar bit rates by models optimized with an MS-SSIM distortion loss compared to a squared loss, we find that the overall fidelity in terms of how much detail is preserved appears similar. However, the spatial distribution of detail changes substantially. MS-SSIM, like its predecessor SSIM (Wang, Bovik, et al., 2004), is a metric designed to model human visual contrast perception. Compared to squared loss, it has the effect of attenuating the error in image regions with high contrast, and boosting the error in regions with low contrast, because the human visibility threshold varies with local contrast. This behavior yields good results for images containing textures with different local contrast (refer to examples provided in appendix 6.7). However, more frequently than expected, it can also produce results inconsistent with human expectations: for the image we show in figure 6, the compression model trained for MS-SSIM assigns more detail to the grass (low contrast), and removes detail from the text on the side of the airplane (high contrast). Because semantic relevance is often assigned to high-contrast areas (such as text, or salient objects), the squared-error optimized models produce subjectively better reconstructions in these cases. It is important to note that neither distortion metric is sophisticated enough to capture image semantics, which makes the choice of distortion loss a difficult one.
158
+
159
+ ![](images/9bba06d8d3bf6f4189fef638bdf634fa1defbfd77c80d22d9e7145b7919fc4fe.jpg)
160
+ Figure 5: Rate–distortion curves aggregated over the Kodak dataset. The top plot shows peak signalto-noise ratios as a function of bit rate $( 1 0 \log _ { 1 0 } { \frac { 2 5 5 ^ { 2 } } { d } }$ , with $d$ representing mean squared error), the bottom plot shows MS-SSIM values converted to decibels $( - 1 0 \log _ { 1 0 } ( 1 - d )$ , where $d$ is the MSSSIM value in the range between zero and one). We observe that matching the training loss to the metric used for evaluation is crucial to optimize performance. Our hyperprior model trained on squared error outperforms all other ANN-based methods in terms of PSNR, and approximates HEVC performance. In terms of MS-SSIM, the hyperprior model consistently outperforms conventional codecs as well as Rippel and Bourdev (2017), the current state-of-the-art model for that metric. Note that the PSNR plot aggregates curves over equal values of $\lambda$ , and the MS-SSIM plot aggregates over equal rates (with interpolation), in order to provide a fair comparison to both stateof-the-art methods. Refer to figures 11 and 12 in the appendix for full-page RD curves that include a wider range of compression methods.
161
+
162
+ ![](images/b943f199a5549dbccce4bbf79fe8e3e181aad0a6adde121033afea362bfdaa2b.jpg)
163
+ Figure 6: The visual artifacts generated at low bit rates depend on the training loss. The top figure (0.1864 bpp, $\mathrm { P S N R } { = } 2 7 . 9 9$ , MS-SSIM=0.9803) was generated by the hyperprior model using an MS-SSIM loss, while the bottom figure (0.1932 bpp, PSNR $= 3 2 . 2 6$ , MS-SSIM=0.9713) was trained using squared loss.
164
+
165
+ ![](images/2539de1bb4279ef0a0ea6c58e7aaafa41ad061f234f8407c0f8c9cffb9625ef3.jpg)
166
+ Figure 7: Amount of side information (encoding $\hat { z }$ ) as a function of total bit rate (encoding $\hat { y }$ and $\hat { z }$ ), for the hyperprior model optimized for squared error, averaged over the Kodak set, and normalized per pixel. Only a small fraction of the total bit rate is used for encoding $\hat { z }$ .
167
+
168
+ Prior work on ANN-based image compression has shown that extending the transform coding concept from linear to nonlinear transforms fundamentally improves the qualitative nature of compression artifacts (Ballé et al., 2017). It appears that nonlinear transforms with higher computational capacity adapt better to the statistics of natural images, imitating properties of the data distribution better than linear transforms. When comparing image reconstructions visually between models with or without the hyperprior, we find no changes to the qualitative nature of the artifacts. Rather, the hyperprior model simply tends to produce image reconstructions with improved detail and a lower bit rate than the corresponding model with a factorized prior.
169
+
170
+ Figure 7 shows how much of the total bit rate the hyperprior model uses as side information. The amount of side information grows with the total bit rate, but stays far below 0.1 bpp, even for the highest total bit rates. Still, the resulting improvement of the prior enables the performance gains over the factorized-prior model shown in figure 5. Note that the architecture of the models does not explicitly constrain the bit rates in any way. The illustrated trade-off in allocating bits for encoding $\hat { z }$ vs. $\hat { y }$ is simply the result of optimizing the loss function given in eq. (10).
171
+
172
+ # 5 DISCUSSION
173
+
174
+ We implement a variational image compression model, conceptually identical to the model presented by Ballé et al. (2017), and augment it with a more powerful entropy model by introducing a hyperprior on the local scale parameters of the latent representation. The hyperprior is trained end-to-end with the rest of the model.
175
+
176
+ Like all recent image compression methods based on ANNs, our method can be directly optimized for distortion losses that are more complex than pixel-wise losses such as mean squared error. As one of the first studies in this emerging field, we examine the effect of optimizing for one of the most popular perceptual metrics, MS-SSIM, and compare it to optimizing for squared loss. Note that Ballé et al. (2016b) compare models trained for different metrics, but their results are limited by the choice of transforms. Figure 6 demonstrates that the results can show significant variation in terms of visual quality, depending on image content, which implies that unless human rating experiments are conducted to provide more reliable data, it is wise to compare methods based on more than a single type of metric.
177
+
178
+ Santurkar et al. (2017) formulate their compression method in a hybrid VAE-GAN framework, adopting a stepwise training scheme where a decoder is first trained using an adversarial loss. It is then fixed, and an encoder is trained to minimize the reconstruction error. Rippel and Bourdev (2017) also employ an adversarial approach, but use a weighted combination of an MS-SSIM and an adversarial loss. Baig and Torresani (2017) propose a compression scheme based on colorization, where color channels are predicted from the the luminance channel by making use of some model specific side information. The luminance channel is compressed using a traditional method. The proposed method exhibits significant color distortions at low bit rates, and is limited by the compression method used for the luminance channel.
179
+
180
+ An early exploration of hierarchical generative models for compression of small images is found in Gregor et al. (2016). However, the aspect of quantization is not thoroughly considered, and hence, no actual compression method is designed. Theis et al. (2017) approach the problem of generating gradient descent directions for quantization functions by replacing their (unhelpful) gradient with the identity function, and derive a differentiable upper bound for the discrete rate term. Ballé et al. (2016b) instead replace the quantizer with additive uniform noise during training, and the discrete rate term with a differential entropy. While this method doesn’t offer a bound for the approximation, it establishes a direct relationship between the discrete and continuous prior distributions $p _ { \hat { \mathbf { \it y } } }$ and $p _ { \tilde { \mathbf { \mathcal { Y } } } }$ , which enables direct evaluation of the discrete prior as a function of the latents $\hat { z }$ as in eq. (11), and hence makes use of a hyperprior feasible in practice. The quality of the approximation is verified empirically by Ballé et al. (2017).
181
+
182
+ Wainwright and Simoncelli (2000) observe that linear filter responses (i.e., wavelet coefficients obtained by filtering an image) follow heavy-tailed marginal distributions, but can be represented as conditionally Gaussian when groups of neighboring coefficients are linked by a common scale multiplier. That is, the distributions of the filter responses can be modeled as Gaussian scale mixtures. Lyu and Simoncelli (2009) extend this model from spatially localized groups of wavelet coefficients to a global image model. Our model can be seen as a further extension of this, where the filter responses are replaced with responses of a nonlinear transform, and an approximate inference model is added. Theis et al. (2017) directly use Gaussian scale mixtures, but in the form of a fully factorized prior. In the presented form, our variational model is perhaps most closely related to ladder VAEs (Sønderby et al., 2016). However, we choose different parametric forms to accommodate the approximation of the quantization and entropy coding process.
183
+
184
+ In classical transform coding methods, compression researchers have exploited statistical dependency in the latent variables (e.g., DCT or wavelet coefficients) by carefully hand-engineering entropy codes modeling the dependencies in the quantized regime (Taubman and Marcellin, 2002). This presents a much more difficult engineering problem than relying on a fully factorized entropy model; transitioning to nonlinear transforms whose parameters are determined through training (and thus may be different for each re-training) only complicates the problem. Toderici et al. (2017) model images directly with a binarized latent representation, which technically removes the need for a separate entropy coding step. However, this corresponds to a very inflexible entropy model (a uniform prior on a binary representation, with no trainable parameters). The model apparently compensates for this by using higher capacity transforms (e.g., based on recurrent networks). Johnston et al. (2017) improve the method by designing an adaptive entropy model. However, this entropy model is not included in the rate term while training the transforms, and hence no feedback (in terms of gradients) is returned from the entropy model back to the transforms during training. This breaks the paradigm of end-to-end optimization, and may stand in the way of better compression performance. Similarly, Rippel and Bourdev (2017) use a hand-designed energy function without trainable parameters as the prior for training the autoencoder, and design an adaptive entropy model post hoc. The fact that our factorized prior model matches the performance of their method, when optimized on the same metric, may point towards this disconnect. Ágústsson et al. (2017) extend the fully-factorized prior model by proposing to do vector quantization over small subtensors of the latent representation, which effectively relaxes the factorization. They train their method end-to-end.
185
+
186
+ All of the models presented here make use of GDN, a type of nonlinearity implementing local normalization. As part of a Gaussianizing transformation, GDN has been shown to be more efficient, in terms of number of parameters, at removing statistical dependencies in image data, than pointwise nonlinearities (Ballé et al., 2016a). Furthermore, there has been a long history of generative models, starting with independent component analysis (Cardoso, 2003), which can successfully recover factorized representations just by maximizing likelihood assuming a fully factorized prior. Despite these facts, we observe that significant dependencies between neighboring elements remain in the latent representation of our compression models (figure 2), even though we took care not to impose constraints on the transforms which might reduce their capacity to factorize the representation (refer to appendix 6.3 for details). We attribute this to the fact that the rate–distortion loss, unlike a maximum likelihood loss, trades off the rate term against expected distortion. It is easy to see that for increasing values of $\lambda$ , the rate term containing the factorized prior becomes less and less important. Hence, it is questionable whether rate–distortion optimality implies full independence of the representation, at least for arbitrary values of $\lambda$ .
187
+
188
+ Regardless of this, the fact that the hyperprior models consistently outperform models with a factorized prior illustrate that it is important for any compression method to reduce mismatch between the prior and the marginal, as in eq. (2). Our model, when trained on the appropriate loss, has the capacity to surpass the state of the art on MS-SSIM, but does not quite reach the performance of a heavily optimized traditional method such as BPG on PSNR (while outperforming all other methods based on ANNs). This discrepancy may indicate that methods based on ANNs have not yet reached the expressive power of traditional methods. As such, the introduction of a hyperprior – or, in traditional terms, side information – is an elegant way of introducing more flexible priors, and a big step in the right direction.
189
+
190
+ # REFERENCES
191
+
192
+ Ágústsson, Eiríkur Þór et al. (2017). “Soft-to-Hard Vector Quantization for End-to-End Learning Compressible Representations”. In: Advances in Neural Information Processing Systems 30, pp. 1141–1151.
193
+ Asuni, N. and A. Giachetti (2014). “TESTIMAGES: A large-scale archive for testing visual devices and basic image processing algorithms”. In: Proc. of STAG: Smart Tools and Apps for Graphics.
194
+ Baig, Mohammad Haris and Lorenzo Torresani (2017). “Multiple hypothesis colorization and its application to image compression”. In: Computer Vision and Image Understanding 164. DOI: 10.1016/j.cviu.2017.01.010.
195
+ Ballé, Johannes, Valero Laparra, and Eero P. Simoncelli (2016a). “Density Modeling of Images Using a Generalized Normalization Transformation”. In: arXiv e-prints. Presented at the 4th Int. Conf. on Learning Representations. arXiv: 1511.06281. (2016b). “End-to-end optimization of nonlinear transform codes for perceptual quality”. In: Picture Coding Symposium (PCS), 2016. DOI: 10.1109/PCS.2016.7906310. arXiv: 1607. 05006. (2017). “End-to-end Optimized Image Compression”. In: arXiv e-prints. Presented at the 5th Int. Conf. on Learning Representations. arXiv: 1611.01704.
196
+ Bellard, Fabrice (2014). BPG Image Format. Accessed: 2017-01-30. URL: http://bellard. org/bpg/.
197
+ Bishop, Christopher M. (1999). “Latent variable models”. In: Learning in Graphical Models. MIT Press, pp. 371–403.
198
+ Cardoso, Jean-François (2003). “Dependence, Correlation and Gaussianity in Independent Component Analysis”. In: Journal of Machine Learning Research 4, pp. 1177–1203.
199
+ Eastman Kodak (1993). Kodak Lossless True Color Image Suite (PhotoCD PCD0992). URL: http: //r0k.us/graphics/kodak/.
200
+ Goyal, Vivek K. (2001). “Theoretical Foundations of Transform Coding”. In: IEEE Signal Processing Magazine 18.5. DOI: 10.1109/79.952802.
201
+ Gregor, Karol et al. (2016). “Towards Conceptual Compression”. In: Advances in Neural Information Processing Systems 29, pp. 3549–3557.
202
+ HEVC (2013). ITU-R Rec. H.265 & ISO/IEC 23008-2: High Efficiency Video Coding.
203
+ JPEG (1992). ITU-R Rec. T.81 & ISO/IEC 10918-1: Digital compression and coding of continuoustone still images.
204
+ Johnston, Nick et al. (2017). “Improved Lossy Image Compression with Priming and Spatially Adaptive Bit Rates for Recurrent Networks”. In: arXiv e-prints. arXiv: 1703.10114.
205
+ Kingma, Diederik P. and Jimmy Ba (2015). “Adam: A Method for Stochastic Optimization”. In: arXiv e-prints. Presented at the 3rd Int. Conf. on Learning Representations. arXiv: 1412.6980.
206
+ Kingma, Diederik P. and Max Welling (2014). “Auto-Encoding Variational Bayes”. In: arXiv eprints. Presented at the 2nd Int. Conf. on Learning Representations. arXiv: 1312.6114.
207
+ Lyu, Siwei and Eero P. Simoncelli (2009). “Modeling Multiscale Subbands of Photographic Images with Fields of Gaussian Scale Mixtures”. In: IEEE Transactions on Pattern Analysis and Machine Intelligence 31.4. DOI: 10.1109/TPAMI.2008.107.
208
+ Rippel, Oren and Lubomir Bourdev (2017). “Real-Time Adaptive Image Compression”. In: Proc. of Machine Learning Research. Vol. 70, pp. 2922–2930.
209
+ Rissanen, Jorma and Glen G. Langdon Jr. (1981). “Universal modeling and coding”. In: IEEE Transactions on Information Theory 27.1. DOI: 10.1109/TIT.1981.1056282.
210
+ Santurkar, Shibani, David Budden, and Nir Shavit (2017). “Generative Compression”. In: arXiv e-prints. arXiv: 1703.01467.
211
+ Sønderby, Casper Kaae et al. (2016). “Ladder variational autoencoders”. In: Advances in Neural Information Processing Systems 29, pp. 3738–3746.
212
+ Taubman, David S. and Michael W. Marcellin (2002). JPEG 2000 – Image Compression Fundamentals, Standards and Practice. Kluwer.
213
+ Theis, Lucas et al. (2017). “Lossy Image Compression with Compressive Autoencoders”. In: arXiv e-prints. Presented at the 5th Int. Conf. on Learning Representations. arXiv: 1703.00395.
214
+ Toderici, George et al. (2017). “Full Resolution Image Compression with Recurrent Neural Networks”. In: 2017 IEEE Conf. on Computer Vision and Pattern Recognition (CVPR). DOI: 10. 1109/CVPR.2017.577. arXiv: 1608.05148.
215
+ Wainwright, Martin J. and Eero P. Simoncelli (2000). “Scale Mixtures of Gaussians and the Statistics of Natural Images”. In: Advances in Neural Information Processing Systems 12, pp. 855–861.
216
+ Wang, Zhou, Alan Conrad Bovik, et al. (2004). “Image Quality Assessment: From Error Visibility to Structural Similarity”. In: IEEE Transactions on Image Processing 13.4. DOI: 10.1109/TIP. 2003.819861.
217
+ Wang, Zhou, Eero P. Simoncelli, and Alan Conrad Bovik (2003). “Multi-Scale Structural Similarity for Image Quality Assessment”. In: Conf. Rec. of the 37th Asilomar Conf. on Signals, Systems and Computers. DOI: 10.1109/ACSSC.2003.1292216.
218
+
219
+ ![](images/ef184845470904371ac9821e99ee774ae6b93ce12ab8dbc360fc4306ff515671.jpg)
220
+ Figure 8: A fit of the non-parametric model $p$ (with $K = 3$ ) to a Gaussian mixture distribution. Gray plots illustrate convergence of the model. The non-parametric model is able to produce a good fit to the ground truth density.
221
+
222
+ # 6 APPENDIX
223
+
224
+ # 6.1 UNIVARIATE NON-PARAMETRIC DENSITY MODEL
225
+
226
+ Ballé et al. (2017) use a non-parametric piecewise linear density model to represent each factor of the fully factorized prior. By increasing the number of samples per unit interval, it can in principle be used to model any univariate density with arbitrary precision. However, it has two practical problems: The range of values with non-zero probability must be finite and known ahead of time, and its implementation is non-trivial with existing automatic differentiation frameworks, both due to numerical issues with normalizing the density and the fact that it typically relies on discrete operations such as array indexing. For the compression models presented in this paper, we instead use the following model based on the cumulative.
227
+
228
+ We define a density $p : \mathbb { R } \to \mathbb { R } ^ { + }$ using its cumulative $c : \mathbb { R } [ 0 , 1 ]$ by satisfying the following constraints:
229
+
230
+ $$
231
+ c ( - \infty ) = 0 ; \quad c ( \infty ) = 1 ; \quad p ( x ) = \frac { \partial c ( x ) } { \partial x } \geq 0
232
+ $$
233
+
234
+ Note that the monotonicity constraint of the cumulative is established by requiring the density function $p$ to be non-negative. Suppose the cumulative is a composition of functions. Then the density can be written using the chain rule of calculus:
235
+
236
+ $$
237
+ \begin{array} { l } { { c = f _ { K } \circ f _ { K - 1 } \cdot \cdot \cdot f _ { 1 } } } \\ { { p = f _ { K } ^ { \prime } \cdot f _ { K - 1 } ^ { \prime } \cdot \cdot \cdot f _ { 1 } ^ { \prime } } } \end{array}
238
+ $$
239
+
240
+ where we write the derivative of $f _ { k }$ as $f _ { k } ^ { \prime }$ . We’ll allow the $f _ { k }$ to be vector functions:
241
+
242
+ $$
243
+ f _ { k } : \mathbb { R } ^ { d _ { k } } \mathbb { R } ^ { r _ { k } }
244
+ $$
245
+
246
+ In general, the $f _ { k } ^ { \prime }$ are Jacobian matrices, and the dots are matrix multiplications. To ensure $p ( x )$ is univariate, the domain of $f _ { 1 }$ and the range of $f _ { K }$ need to be one dimensional $d _ { 1 } = r _ { K } = 1$ ).
247
+
248
+ To guarantee that $p ( x )$ is a density, we just need $f _ { K }$ to map to the range between 0 and 1, and ensure that $p ( x ) \geq 0$ . To do that, we require all the Jacobian elements to be non-negative. Then the matrix product computing $p ( x )$ is non-negative as well, and we have defined a valid density.
249
+
250
+ An effective choice of $f _ { k }$ is the following (as a shorthand, we define tanh, sigmoid, and softplus as elementwise functions, when applied to vectors or matrices):
251
+
252
+ $$
253
+ \begin{array} { r l } & { f _ { k } ( { \pmb x } ) = g _ { k } \big ( { \pmb H } ^ { ( k ) } { \pmb x } + { \pmb b } ^ { ( k ) } \big ) \qquad { \qquad } { 1 \leq k < K } } \\ & { f _ { K } ( { \pmb x } ) = \mathrm { s i g m o i d } \big ( { \pmb H } ^ { ( K ) } { \pmb x } + { \pmb b } ^ { ( K ) } \big ) } \end{array}
254
+ $$
255
+
256
+ where $H ^ { ( k ) }$ are matrices, $\smash { \boldsymbol { b } ^ { ( k ) } }$ are vectors, and $g _ { k }$ are nonlinearities defined as
257
+
258
+ $$
259
+ g _ { k } ( { \pmb x } ) = { \pmb x } + { \pmb a } ^ { ( k ) } \odot \operatorname { t a n h } ( { \pmb x } )
260
+ $$
261
+
262
+ where $\mathbf { \pmb { a } } ^ { ( k ) }$ is a vector and $\odot$ denotes elementwise multiplication. The rationale behind this particular nonlinearity is that it allows to expand or contract the space near $x = 0$ . $\mathbf { \pmb { a } } ^ { ( k ) }$ controls the rate of expansion (when positive) or contraction (when negative). If $\mathbf { \pmb { a } } ^ { ( k ) }$ were fixed to a positive value, “peaks” in the density would become easier to model than “troughs”.
263
+
264
+ The derivatives work out as follows:
265
+
266
+ $$
267
+ \begin{array} { r l r } & { f _ { k } ^ { \prime } ( \pmb { x } ) = \mathrm { d i a g } g _ { k } ^ { \prime } \big ( \pmb { H } ^ { ( k ) } \pmb { x } + \pmb { b } ^ { ( k ) } \big ) \cdot \pmb { H } ^ { ( k ) } \qquad } & { 1 \leq k < K , \mathrm { w i t h } } \\ & { g _ { k } ^ { \prime } ( \pmb { x } ) = 1 + \pmb { a } ^ { ( k ) } \odot \mathrm { t a n h } ^ { \prime } ( \pmb { x } ) } & { \mathrm { a n d } } \\ & { f _ { K } ^ { \prime } ( \pmb { x } ) = \mathrm { s i g m o i d } ^ { \prime } \big ( \pmb { H } ^ { ( K ) } \pmb { x } + \pmb { b } ^ { ( K ) } \big ) \cdot \pmb { H } ^ { ( K ) } } & \end{array}
268
+ $$
269
+
270
+ For the derivatives to be non-negative, we need to constrain $H ^ { ( k ) }$ to have all non-negative elements, and the elements of $\mathbf { \pmb { a } } ^ { ( k ) }$ to be lower bounded by $- 1$ . This is easily done by reparameterization:
271
+
272
+ $$
273
+ \begin{array} { r l } & { H ^ { ( k ) } = \mathrm { s o f t p l u s } \big ( \hat { H } ^ { ( k ) } \big ) } \\ & { a ^ { ( k ) } = \mathrm { t a n h } \big ( \hat { \mathbf { a } } ^ { ( k ) } \big ) } \end{array}
274
+ $$
275
+
276
+ where the quantities with the hat are the actual parameters. A plot of a fit of this model to a “toy” mixture density is provided in figure 8. As a special case, setting $K = 1$ yields a logistic distribution:
277
+
278
+ $$
279
+ \begin{array} { l c l } { { c ( x ) = \displaystyle \mathrm { s i g m o i d } \big ( h x + b \big ) } } \\ { { p ( x ) = \displaystyle \frac { h } { 2 } \cdot \displaystyle \frac { 1 } { 1 + \cosh ( h x + b ) } } } \end{array}
280
+ $$
281
+
282
+ It may seem odd to define a density function as an explicit derivative; however, in an automatic differentiation framework, this operation is very easy to implement, and the resulting density function is normalized by construction. We have found the model to fit well to arbitrary densities, and perform just as well as the piecewise linear model in the context of compression models. For all experiments in this paper, we used $K = 4$ , with the dimensionalities $r _ { 1 } = r _ { 2 } = r _ { 3 } = 3$ . Each univariate density model is associated with its own set of parameters $\mathbf { \pmb { a } } ^ { ( k ) }$ , $\smash { \pmb { b } ^ { ( k ) } }$ , $H ^ { ( k ) }$ (which, together, form $\psi ^ { ( i ) } .$ ).
283
+
284
+ # 6.2 MODELING PRIORS WITH ADDED UNIFORM NOISE
285
+
286
+ We model both the prior $p _ { \tilde { y } | \tilde { z } }$ and the hyperprior $p _ { \tilde { z } }$ using densities that are convolved with a standard uniform density function. This is to ensure that the priors have enough flexibility to match the variational posterior $q$ . To see this, consider that in some cases, it is beneficial in terms of rate– distortion performance for the model to “disable” part of the latent representation, leading to a lower effective dimensionality than the model architecture has been set up for. For simplicity of notation, let’s assume that the variational posterior and the prior have just one dimension which has collapsed. In this case, $g _ { a }$ converges to always producing a constant value for the corresponding dimensions:
287
+
288
+ $$
289
+ y = g _ { a } ( \pmb { x } ) = c , { \mathrm { ~ i n d e p e n d e n t ~ o f ~ } } \pmb { x } .
290
+ $$
291
+
292
+ When this happens, the marginal distribution of that element during training is a uniform density centered on $c$ , due to the added uniform noise, and the variational posterior matches it exactly:
293
+
294
+ $$
295
+ \begin{array} { r } { m ( \tilde { y } ) = q ( \tilde { y } \mid \pmb { x } ) = \mathcal { U } \big ( \tilde { y } \mid c - \frac { 1 } { 2 } , c + \frac { 1 } { 2 } \big ) . } \end{array}
296
+ $$
297
+
298
+ The cross entropy of this element is given by:
299
+
300
+ $$
301
+ \mathbb { E } _ { \tilde { y } \sim m } [ - \log _ { 2 } p _ { \tilde { y } } ] .
302
+ $$
303
+
304
+ This entropy should evaluate to zero bits, as the quantized representation is deterministic (and hence, no information needs to be transmitted). For the cross entropy to evaluate to zero, however, the prior needs to be flexible enough to assume the shape of the posterior – a unit-width uniform density.
305
+
306
+ ![](images/2c8bde32ca90ab541312aa54bc84525b8f5ea205f4c6e7e36daf9a7118b12720.jpg)
307
+ Figure 9: Fitting the density model described in the previous section to a uniform distribution, with and without convolving the model with a uniform density. Gray plots illustrate convergence of the model. While $p$ itself assumes smoothness and thus fails to find an adequate fit to the uniform with its steep edges, the augmented model fits almost perfectly.
308
+
309
+ Due to its infinitely steep edges, the uniform distribution is a corner case for not only the Gaussian density model, but also the non-parametric model described in appendix 6.1. To fix this, we incorporate the added noise directly into the prior/hyperprior by convolving the underlying density model $p$ with a standard uniform:
310
+
311
+ $$
312
+ \begin{array} { l } { { \displaystyle p _ { \tilde { y } } ( \tilde { y } ) = \left( p * \mathcal { U } \big ( - \frac 1 2 , \frac 1 2 \big ) \right) ( \tilde { y } ) } } \\ { { \displaystyle \qquad = \int _ { - \infty } ^ { \infty } p ( y ) \mathcal { U } \big ( \tilde { y } - y \mid - \frac 1 2 , \frac 1 2 \big ) \mathrm { d } y } } \\ { { \displaystyle \qquad = \int _ { \tilde { y } - \frac 1 2 } ^ { \tilde { y } + \frac 1 2 } p ( y ) \mathrm { d } y } } \\ { { \displaystyle \qquad = c \big ( \tilde { y } + \frac 1 2 \big ) - c \big ( \tilde { y } - \frac 1 2 \big ) , } } \end{array}
313
+ $$
314
+
315
+ where $c$ is the cumulative of the underlying density model. Now, whatever the underlying density $p$ is, letting its scale go towards zero makes $p _ { \tilde { y } }$ approach a unit-width uniform density. Since the non-parametric model is defined via its cumulative, and the cumulative of a Gaussian is available in most computational frameworks, this solution is easy to implement in practice.
316
+
317
+ # 6.3 MODEL CAPACITY
318
+
319
+ Our results seem to indicate that a certain degree of statistical dependency in the latent image representation $\textbf { { y } }$ is preferred by the rate–distortion objective, and that the hyperprior model performs better by embracing this. However, it is possible that dependencies remain simply because the analysis
320
+
321
+ ![](images/c64d6cbefcdb3d0e8cb85432862fe7e7859fb8767d271d28084f8a5b9b5e6fa2.jpg)
322
+ Figure 10: Rate–distortion curves for factorized-prior models only differing in their transform capacity (number of filters at each transform layer $N$ ). Note that performance gains with increased number of filters stagnates as a $\lambda$ -dependent saturation point is reached. For example, moving from 64 to 128 filters makes a significant difference at $0 . 5 \mathrm { b p p }$ , while moving from 128 to 192 only yields a negligible gain, and there is no benefit in going up to 256.
323
+
324
+ <table><tr><td rowspan="2">CPU N</td><td colspan="2">Kodak</td><td colspan="2">Tecnick</td><td rowspan="2">GPU N</td><td colspan="2">Kodak</td><td colspan="2">Tecnick</td></tr><tr><td>encode</td><td>decode</td><td>encode</td><td>decode</td><td>encode</td><td>decode</td><td>encode</td><td>decode</td></tr><tr><td>128</td><td>331.54</td><td>334.21</td><td>1003.73</td><td>1085.56</td><td>128</td><td>242.12</td><td>338.09</td><td>491.88</td><td>799.16</td></tr><tr><td>192</td><td>551.22</td><td>576.34</td><td>1852.10</td><td>1971.85</td><td>192</td><td>310.01</td><td>385.64</td><td>630.02</td><td>1018.35</td></tr></table>
325
+
326
+ Table 1: Average encoding and decoding runtimes for the proposed model in milliseconds.
327
+
328
+ and synthesis transforms $g _ { a }$ and $g _ { s }$ do not have enough capacity to factorize the image representation, or because the training algorithm did not succeed in finding the global optimum. Although it is impossible to fully control for this, we attempted to minimize the chances that capacity limitations in the transforms lead to the wrong conclusions, by carefully selecting the number of filters across layers of the transforms (as given by $N$ and $M$ in figure 4).
329
+
330
+ We established in previous experiments that, for a given $\lambda$ , there exist a certain number of filters per layer at which performance saturates, and no gains can be achieved by further increasing it (figure 10; note that for these experiments, we set $N = M$ ). The optimal number of filters increases with $\lambda$ , indicating that models with higher bit rates require higher transform capacities. Based on these previous experiments, we attempted to choose values close to the point of saturation, or a little higher, in order to control for capacity limitations while minimizing training time. Additionally, we found that allowing a somewhat wider bottleneck $M > N$ helps to achieve comparable performance with overall lower $N$ , and we used this when choosing the model architectures.
331
+
332
+ # 6.4 COMPUTATIONAL COMPLEXITY
333
+
334
+ Table 1 lists encoding and decoding times of our method for a Python and TensorFlow implementation, for CPU as well as GPU and different number of filters per layer $( N )$ , averaged over the Kodak and Tecnick datasets. Note that no performance optimization was attempted. In particular, we did not optimize the metaparameter choices (number of filters, layers, etc.) for computational complexity. Rather, we chose the number of filters high enough to rule out bottlenecks in the transforms, as described in the previous section. Only the arithmetic coding was implemented as a customized operator in $\mathrm { C } { + } { + }$ . Thus, these measurements represent proof that the method is feasible, but their utility for meaningful comparisons with other methods is limited. The average increase in runtime for the hyperprior model compared to the factorized-prior model was between $20 \%$ and $50 \%$ .
335
+
336
+ # 6.5 PERFORMANCE COMPARISONS FOR THE KODAK IMAGE SET
337
+
338
+ The plots in figures 11 and 12 show the same results as figure 5, but provide comparisons to a wider array of compression methods. Note that the method to aggregate rate–distortion points across images differs between the PSNR and MS-SSIM plots: in the latter, we interpolate the RD curves for each image (as shown in appendix 6.7) using cubic splines at a predefined set of bit rates, and then average across equal bit rates. In the former, no interpolation was used, averaging rate and distortion measurements across equal values of $\lambda$ . As noted by Ballé et al. (2017), directly comparing RD curves with different methods of aggregation can give misleading results. Because of this, we match our aggregation method to the data available for the current state of the art ( $\lambda$ -aggregation for HEVC and PSNR, and rate aggregation for Rippel and Bourdev (2017) and MS-SSIM). Ultimately, a comparison based on individual images, as provided in section 6.7, should be considered more reliable; however, data on individual images for Rippel and Bourdev (2017) has not been available.
339
+
340
+ # 6.6 PERFORMANCE COMPARISONS FOR THE TECNICK IMAGE SET
341
+
342
+ For the sake of completeness, the plots in figures 13 and 14 show results over the Tecnick dataset (Asuni and Giachetti, 2014). Rate and distortion measurements were averaged across equal values of $\lambda$ for both PSNR and MS-SSIM plots.
343
+
344
+ ![](images/addd1687d84ad59b013b7f3ef4e3ed06197f4e0d6d5cdfd602f3e6087c4b9109.jpg)
345
+ Figure 11: Rate–distortion curves for PSNR covering a wide range of conventional and ANN-based compression methods. We see that our hyperprior model (blue squares) outperforms most conventional codecs (JPEG, JPEG 2000, and WebP) as well as all ANN-based methods by a wide margin.
346
+
347
+ ![](images/7ceda6b5ea97a5e8ccb6105783242918557d087f6c30bf2780b1584a782c149e.jpg)
348
+ RD curves averaged over Kodak (MS-SSIM)
349
+ Figure 12: Rate–distortion curves for MS-SSIM covering a wide range of conventional and ANNbased compression methods. When trained on MS-SSIM, our hyperprior model outperforms Rippel and Bourdev (2017), the current state of the art, consistently across all bit rates. Note that even when trained using squared loss, our hyperprior model (blue squares) yields higher MS-SSIM scores than all of the conventional methods.
350
+
351
+ ![](images/259db6d79b3dc85c0e03c63f6ab720569e143ab77cb06559b66ee9f73973a366.jpg)
352
+ Figure 13: Rate–distortion curves for PSNR covering a wide range of conventional and ANN-based compression methods. Results are qualitatively similar to the results on Kodak.
353
+
354
+ ![](images/85c91e46fe60f6047327d98c79ac7dbd2c2815dc9bf40a69048fc3ff42465adb.jpg)
355
+ Figure 14: Rate–distortion curves for MS-SSIM covering a wide range of conventional and ANNbased compression methods. Results are qualitatively similar to the results on Kodak.
356
+
357
+ ![](images/2125d3052bce5d53f58c23b2dd171c00453715f6e4a769299e6faada7d91ab5e.jpg)
358
+ Figure 15: Results for Kodak image 01: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
359
+
360
+ ![](images/f6fcedb41fc98a4a528e0f6b64070da91c22639772bd88815a2703caf8c4adec.jpg)
361
+ Kodak image 2
362
+
363
+ ![](images/9e0b10a6f72043ac6262bdc1a5f6a1ba1af97820ff541a169a6cd735c1b0b249.jpg)
364
+ Figure 16: Results for Kodak image 02: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
365
+
366
+ ![](images/934473a0c9a6fab061e4bb6fbb231d383aefa38ff3837101c791cd0333ad3bec.jpg)
367
+ Figure 17: Results for Kodak image 03: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
368
+
369
+ ![](images/5e99f81706f6c67fd84ef7b7c861df0c86ae2d31e9b3cf7e709950f7780ef5fb.jpg)
370
+ Figure 18: Results for Kodak image 04: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
371
+
372
+ ![](images/655bc93bbba9fd7aa5447ef20827ffaddbe5eaf195c292bbae6b29305828097a.jpg)
373
+ Figure 19: Results for Kodak image 05: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
374
+
375
+ ![](images/5ccd2c2dce17086b58c265506b77d28131db643980af0331422c4b3eec232ea6.jpg)
376
+
377
+ ![](images/a90e5c729474911f3b94cd3a360df857b626ba34240010f3936ffaf3ec4e074c.jpg)
378
+
379
+ Figure 20: Results for Kodak image 06: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
380
+
381
+ ![](images/908dd44854899aad26d7bc7cf68287e5a5bd28bd11e45d7c6b8bfa17057f273a.jpg)
382
+ Figure 21: Results for Kodak image 07: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
383
+
384
+ ![](images/21c355e093d019b8b386ebf535e8cf34423d5cc8cade6b94e102ce4c8800a674.jpg)
385
+ Figure 22: Results for Kodak image 08: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
386
+
387
+ ![](images/0ea360199e671d860dacf371e27670183e34eb26ee508d6cd2e77ad0c1e91514.jpg)
388
+ Figure 23: Results for Kodak image 09: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
389
+
390
+ ![](images/7f569d58bcd92de1429b406e3be5654b15dc41436f3f36674139584a60d930ad.jpg)
391
+ Figure 24: Results for Kodak image 10: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
392
+
393
+ ![](images/13f362a00878dd53c87eef57b2433814bbc9a4d8d54524ba87aa8216cf9b9303.jpg)
394
+
395
+ ![](images/ce39c7fad4f1033c9e1aed2877e67ac98a3b381e75195f41050353d03e4a55b4.jpg)
396
+ Kodak image 11
397
+ Figure 25: Results for Kodak image 11: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
398
+
399
+ ![](images/aba4fb15169e58a0402c71691cda47fa0e0b6f79b54d3b29dd1f1b5b281ec0f9.jpg)
400
+ Figure 26: Results for Kodak image 12: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
401
+
402
+ ![](images/29494d651f08b98be128027047f6132db917057a0a1b1bfd10d439f7d90c98b5.jpg)
403
+
404
+ ![](images/05090187fcc36b5c6a94f9186c46b190291e8a84d63aa220a808d7189320c218.jpg)
405
+
406
+ Figure 27: Results for Kodak image 13: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
407
+
408
+ ![](images/ba1e76a0d560ffd510faff8d2cf2fe56c614529f5cc4b321a7ce9f3f1719b24c.jpg)
409
+ Figure 28: Results for Kodak image 14: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
410
+
411
+ ![](images/55f1352f77bd14ff1aa4d31509a8ab91bcbf6b2446e2f52764b129bad21f9d98.jpg)
412
+ Figure 29: Results for Kodak image 15: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
413
+
414
+ ![](images/e2b7e53fc5c2625cccd8577194c64f99b374e2e97e53c489f12678a9d16d4fa3.jpg)
415
+ Figure 30: Results for Kodak image 16: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
416
+
417
+ ![](images/980e7a12be1960b526edc4bae4553fe7b2129b97fc2dcbf8c10bc139f59ca82e.jpg)
418
+ Figure 31: Results for Kodak image 17: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
419
+
420
+ ![](images/7bc6a2685ba2a0bf2e674779116a50088d3bd61efd598c4cc1c6b1533bdd2342.jpg)
421
+
422
+ Figure 32: Results for Kodak image 18: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
423
+
424
+ ![](images/e70efe640c0ce96529662f05603337c153dfd73be1ca4a4b0614386959127d52.jpg)
425
+ Figure 33: Results for Kodak image 19: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
426
+
427
+ ![](images/8fba7ab7bbcb783fc90121e2987aba5d98266766591f39746de485d0f9c72146.jpg)
428
+ Figure 34: Results for Kodak image 20: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
429
+
430
+ ![](images/e4bbe5c6ab3fcd2a054038ed8d0d9e06f1328e0dccde0eb53da7e604f2d80767.jpg)
431
+
432
+ ![](images/8f749c550d92b46a7c76bd7130313a46112faa12e6ffd2cbca3eda0bb563b95c.jpg)
433
+ Figure 35: Results for Kodak image 21: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
434
+
435
+ ![](images/5cc8925495c68a5de8ced70b834ea0c005c64a01ca4e593b36094273ce079da2.jpg)
436
+
437
+ ![](images/be949666dcf2c8f0c7d31add7a2ae88b1f299d91effea55fcf9df14ab97ec9d7.jpg)
438
+ Kodak image 22
439
+ Figure 36: Results for Kodak image 22: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
440
+
441
+ ![](images/fb8f1f2e51cb1b62950b8baaa4e4341626ac2a14c3b652da38b32218a5110b54.jpg)
442
+ Figure 37: Results for Kodak image 23: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
443
+
444
+ ![](images/838de1f6f4a675ba31e0b1020aa45dee8bc1e28a0006086d8c0c3aa1730eb017.jpg)
445
+ Figure 38: Results for Kodak image 24: PSNR and MS-SSIM rate-distortion curves (top), and example reconstructions for the hyperprior model optimized for squared error (bottom left) and MS-SSIM (bottom right). Images correspond to third rate–distortion point from the left of the blue curves (square and disc markers, respectively). Best viewed on a computer screen.
md/train/rkl6As0cF7/rkl6As0cF7.md ADDED
@@ -0,0 +1,576 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PROBABILISTIC RECURSIVE REASONING FOR MULTI-AGENT REINFORCEMENT LEARNING
2
+
3
+ Ying $\mathbf { W e n } ^ { \ S * }$ , Yaodong Yang§∗, Rui Luo§, Jun Wang§, Wei Pan\
4
+
5
+ §University College London, \Delft University of Technology {ying.wen,yaodong.yang,rui.luo,jun.wang}@cs.ucl.ac.uk {wei.pan}@tudelft.nl
6
+
7
+ # ABSTRACT
8
+
9
+ Humans are capable of attributing latent mental contents such as beliefs, or intentions to others. The social skill is critical in everyday life to reason about the potential consequences of their behaviors so as to plan ahead. It is known that humans use this reasoning ability recursively, i.e. considering what others believe about their own beliefs. In this paper, we start from level-1 recursion and introduce a probabilistic recursive reasoning (PR2) framework for multi-agent reinforcement learning. Our hypothesis is that it is beneficial for each agent to account for how the opponents would react to its future behaviors. Under the PR2 framework, we adopt variational Bayes methods to approximate the opponents’ conditional policy, to which each agent finds the best response and then improve their own policy. We develop decentralized-training-decentralized-execution algorithms, PR2-Q and PR2-Actor-Critic, that are proved to converge in the self-play scenario when there is one Nash equilibrium. Our methods are tested on both the matrix game and the differential game, which have a non-trivial equilibrium where common gradient-based methods fail to converge. Our experiments show that it is critical to reason about how the opponents believe about what the agent believes. We expect our work to contribute a new idea of modeling the opponents to the multi-agent reinforcement learning community.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ In the long journey of creating artificial intelligent (AI) that mimics human intelligence, a hallmark of an AI agent is its capabilities of understanding and interacting with other agents (Lake et al., 2017). At the cognitive level, the real-world intelligent entities (e.g. rats, humans) are born to be able to reason about various properties of interests of others (Tolman, 1948; Pfeiffer & Foster, 2013). Those interests usually indicates unobservable mental state including desires, beliefs, and intentions (Premack & Woodruff, 1978; Gopnik & Wellman, 1992). In everyday life, people use this inborn ability to reason about others’ behaviors (Gordon, 1986), plan effective interactions (Gallese & Goldman, 1998), or match with the folk psychology (Dennett, 1991). It is known that people can use this reasoning ability recursively; that is, they engage in considering what others believe about their own beliefs. A number of human social behaviors have been profiled by the recursion reasoning ability (Pynadath & Marsella, 2005). Behavioral game theorist and experimental psychologist believe that reasoning recursively is a tool of human cognition that is equipped with evolutionary advantage (Camerer et al., 2004; 2015; Goodie et al., 2012; Robalino & Robson, 2012).
14
+
15
+ Traditional approach of constructing the models of other agents, also known as opponent modeling, has a rich history in the multi-agent learning (Shoham et al., 2007; Albrecht & Stone, 2018). Even though equipped with modern machine learning methods that could enrich the representation of the opponent’s behaviors (He et al., 2016), those algorithms tend to only work either under limited types of scenarios (e.g. mean-field games (Yang et al., 2018)), pre-defined opponent strategies (e.g. Tit-fot-Tat in iterated Prisoner’s Dilemma (Foerster et al., 2018)), or in cases where opponents are assumed to constantly return to the same strategy (Da Silva et al., 2006). Recently, a promising methodology from game theory – recursive reasoning – has become popular in opponent modeling (Gmytrasiewicz & Durfee, 2000; Camerer et al., 2004; Gmytrasiewicz & Doshi, 2005; De Weerd et al., 2013b). Similar to the way of thinking from humans, recursive reasoning refers to the belief reasoning process where each agent considers the reasoning process of other agents, based on which it expects to make better decisions. Importantly, it allows an opponent to reason about the modeling agent rather than being a fixed type; the process can therefore be nested in a form as "I believe that you believe that I believe ...". Despite some initial trails (Gmytrasiewicz & Doshi, 2005; Von Der Osten et al., 2017), there has been little work that tries to adopt this idea into the multi-agent deep reinforcement learning (DRL) setting. One main reason is that computing the optimal policy is prohibitively expensive (Doshi & Gmytrasiewicz, 2006; Seuken & Zilberstein, 2008).
16
+
17
+ In this paper, we introduce a probabilistic recursive reasoning (PR2) framework for multi-agent DRL tasks. Unlike previous work on opponent modeling, each agent here is to consider how the opponents would react to its potential behaviors, before it tries to find the best response for its own decision making. By employing variational Bayes methods to model the uncertainty of opponents’ conditional policies, we develop decentralized-training-decentralized-execution algorithms, PR2-Q and PR2-Actor-Critic, and prove the convergence in the self-play scenario when there is only one Nash equilibrium. Our methods are tested on the matrix game and the differential game. The games come with a non-trivial equilibrium where conventional gradient-based methods find challenging. We compare against multiple strong baselines. The results justify the unique value provided by agent’s recursive reasoning capability throughout the learning. We expect our work to offer a new angel on incorporating conditional opponent modeling into the multi-agent DRL context.
18
+
19
+ # 2 RELATED WORK
20
+
21
+ Game theorists take initiatives in modeling the recursive reasoning procedures (Harsanyi, 1962; 1967). Since then, alternative approaches, including logics-based models (Bolander & Andersen, 2011; Muise et al., 2015) or graphical models (Doshi et al., 2009; Gal & Pfeffer, 2003; 2008), have been adopted. Recently, the idea of Theory of Mind (ToM) (Goldman et al., 2012) from cognitive science becomes popular. An example of ToM is the "Recursive Modeling Method" (RMM) (Gmytrasiewicz et al., 1991; Gmytrasiewicz & Durfee, 1995; 2000), which incorporates the agent’s uncertainty about opponent’s exact model, payoff, and recursion depth. However, these methods follow the decisiontheoretic approaches, and are studied in the limited context of one-shot games. The environment is relatively simple and the opponents are not RL agents.
22
+
23
+ The Interactive POMDP (I-POMDP) (Gmytrasiewicz & Doshi, 2005) implements the idea of ToM to tackle the multi-agent RL problems. It extends the partially observed MDP (Sondik, 1971) by introducing an extra space of models of other agents into the MDP; as such, an agent can build belief models about how it believes other agents know and believe. Despite the added flexibility, I-POMDP has limitations in its solvability (Seuken & Zilberstein, 2008). Solving I-POMDP with $N$ models in each recursive level with $K$ maximum level equals to solving $\Theta \big ( N ^ { \bar { K } } \big )$ PODMPs. Such inherent complexity requires high precision on the approximation solution methods, including particle filtering (Doshi & Gmytrasiewicz, 2009), value iteration (Doshi & Perez, 2008), or policy iteration (Sonu & Doshi, 2015). Out work is different from I-POMDP in that we do not adjust the MDP; instead, we provide a probabilistic framework to implement the recursive reason in the MDP. We approximate the opponent’s conditional policy through variational Bayes methods. The induced PR2-Q and PR2-AC algorithms are model-free and can practically be used as the replacement to other multi-agent RL algorithms such as MADDPG (Lowe et al., 2017).
24
+
25
+ Our work can also be tied into the study of opponent modeling (OM) Albrecht & Stone (2018). OM is all about shaping the anticipated movements of the other agents. Traditional OM can be regarded as level-0 recursive reasoning in that OM methods model how the opponent behaves based on the history, but not how the opponent would behave based on what I would behave. In general, OM methods have two major limitations. One is that OM tends to work with a pre-defined target of opponents; for example, fictitious play (Brown, 1951) and joint-action learners (Claus & Boutilier, 1998) require opponents play stationary strategies, Nash-Q (Hu & Wellman, 2003) require all agents play towards the Nash equilibrium, so do Correlated $Q$ -learning (Greenwald et al., 2003), Minimax-Q (Littman, 1994), and Friend-or-foe Q (Littman, 2001). These algorithms become invalid if the opponents change their types of policy. The other major limitation is that OM algorithms require to know the exact (Nash) equilibrium policy of the opponent during training. Typical examples include the series of WoLF models (Bowling, 2005; Bowling & Veloso, 2001a; 2002) or the Nash-Q learning $\mathrm { \Delta H u }$ & Wellman, 2003), both of which require the Nash Equilibrium at each stage game to update the Q-function. By contrast, our proposed methods, PR2-Q & PR2-AC, do not need to pre-define the type of the opponents. Neither do our methods require to know the equilibrium beforehand.
26
+
27
+ ![](images/17e63043b3bdf70e5410597f4bb5df1c91379beda7cf43bdf580df6b2ba2973b.jpg)
28
+ Figure 1: Probabilistic recursive reasoning framework. PR2 decouples the connections between agents by Eq. 3. $\textcircled{1}$ : agent $i$ takes the best response after considering all the potential consequences of opponents’ actions given its own action $a ^ { i }$ . $\textcircled{2}$ : how agent $i$ behaves in the environment serves as the prior for the opponents to learn how their actions would affect $a ^ { i }$ . $\textcircled{3}$ : similar to $\textcircled{1}$ , opponents take the best response to agent $i$ . $\textcircled{4}$ : similar to $\textcircled{2}$ , opponents’ actions are the prior knowledge to agent $i$ on estimating how $a ^ { i }$ will affect the opponents. Looping from step 1 to 4 forms recursive reasoning.
29
+
30
+ Despite the recent success of applying deep RL algorithms on the single-agent discrete (Mnih et al., 2015) and continuous (Lillicrap et al., 2015) control problems, it is still challenging to transfer these methods into the multi-agent RL context. The reason is because learning independently while ignoring the others in the environment will simply break the theoretical guarantee of convergence (Tuyls & Weiss, 2012). A modern framework is to maintain a centralized critic (i.e. $Q$ -network) during training, e.g. MADDPG (Lowe et al., 2017), BiCNet (Peng et al., 2017), and multi-agent soft $Q$ -learning (Wei et al., 2018); however, they require strong assumptions that the parameters of agent policies are fully observable, letting alone the centralized $Q$ -network potentially prohibits the algorithms from scaling up. By contrast, our approach employs decentralized training with no need to maintain a central critic; neither does it require to know the exact opponents’ policies.
31
+
32
+ # 3 PRELIMINARIES
33
+
34
+ For an $n$ -agent stochastic game (Shapley, 1953), we define a tuple $( \mathcal { S } , \mathcal { A } ^ { 1 } , . . . , \mathcal { A } ^ { n } , r ^ { 1 } , . . . , r ^ { n } , p , \gamma )$ , where S denotes the state space, $p$ ,is the distribution of the initial state, $\gamma$ , . . . , , , . . . , , , γis the discount factor for future rewards, $\mathcal { A } ^ { i }$ and $r ^ { i } \stackrel { - } { = } r ^ { i } ( \stackrel { - } { s } , a ^ { i } , a ^ { - i } )$ γ are the action space and the reward function for agent $i \in \{ 1 , . . . , n \}$ , respectively. Agent $i$ , chooses its action $a ^ { i } \in \mathcal { A } ^ { i }$ according to the policy $\pi _ { \theta ^ { i } } ^ { i } ( { \stackrel { \smile } { a } } ^ { i } | s )$ , . . . ,parameterized by $\theta ^ { i }$ conditioning on some given state $s \in \mathcal S$ πθ. Let us define the joint policy as the θcollection of all agents’ policies $\pi _ { \theta }$ with $\theta$ representing the joint parameter. It is convenient to πθ θinterpret the joint policy from the perspective of agent $i$ such that ${ \bf \dot { \pi } } _ { \theta } = ( \pi _ { \theta ^ { i } } ^ { i } ( a ^ { i } | s ) , \pi _ { \theta ^ { - i } } ^ { - i } ( a ^ { - i } | s ) )$ , where $a ^ { - i } = ( a ^ { j } ) _ { j \neq i }$ , $\theta ^ { - i } = ( \theta ^ { j } ) _ { j \neq i }$ , and $\pi _ { \theta ^ { - i } } ^ { - i } ( a ^ { - i } | s )$ πθ πθ , πθis a compact representation of the joint policy θ θof all complementary agents of $i$ πθ. At each stage of the game, actions are taken simultaneously. Each agent is presumed to pursue the maximal cumulative reward (Sutton et al., 1998), expressed as
35
+
36
+ $$
37
+ \operatorname* { m a x } \ \eta ^ { i } ( \pi _ { \theta } ) = \mathbb { E } \left[ \sum _ { t = 1 } ^ { \infty } \gamma ^ { t } r ^ { i } ( s _ { t } , a _ { t } ^ { i } , a _ { t } ^ { - i } ) \right] ,
38
+ $$
39
+
40
+ with $\left( a _ { t } ^ { i } , a _ { t } ^ { - i } \right)$ sample from $( \pi _ { \theta ^ { i } } ^ { i } , \pi _ { \theta ^ { - i } } ^ { - i } )$ . Correspondingly, for the game with (infinite) time horizon, , πwe can define the state-action $Q$ , πθ-function by $\begin{array} { r } { Q _ { \pi _ { \theta } } ^ { i } ( s _ { t } , a _ { t } ^ { i } , a _ { t } ^ { - i } ) = \mathbb { E } \left[ \sum _ { l = 0 } ^ { \infty } \gamma ^ { l } r ^ { i } ( s _ { t + l } , a _ { t + l } ^ { i } , a _ { t + l } ^ { - i } ) \right] } \end{array}$
41
+
42
+ # 3.1 NON-CORRELATED FACTORIZATION ON THE JOINT POLICY
43
+
44
+ In the multi-agent learning tasks, each agent can only control its own action; however, the resulting reward value depends on other agents’ actions. The $Q$ -function of each agent, $Q _ { \pi _ { \theta } } ^ { i }$ , is subject to the joint policy $\pi _ { \theta }$ πθconsisting of all agents’ policies. One common approach is to decouple the joint πθpolicy assuming conditional independence of actions from different agents (Albrecht & Stone, 2018):
45
+
46
+ $$
47
+ \pi _ { \theta } ( a ^ { i } , a ^ { - i } | s ) = \pi _ { \theta ^ { i } } ^ { i } ( a ^ { i } | s ) \pi _ { \theta ^ { - i } } ^ { - i } ( a ^ { - i } | s ) .
48
+ $$
49
+
50
+ The study regarding the topic of “centralized training with decentralized execution” in the deep RL domain, including MADDPG (Lowe et al., 2017), COMA (Foerster et al., 2017), MF-AC (Yang et al.,
51
+
52
+ 2018), Multi-Agent Soft- $Q$ (Wei et al., 2018), and LOLA (Foerster et al., 2018), can be classified into this category (see more clarifications in Appendix B). Although the non-correlated factorization of the joint policy simplifies the algorithm, this simplication is vulnerable because it ignores the agents’ connections, e.g. impacts of one agent’s action on other agents, and the subsequent reactions from other agents. One might argue that during training, the joint $Q$ -function should potentially guide each agent to learn to consider and act for the mutual interests of all the agents; nonetheless, a counter-example is that the non-correlated policy could not even solve the simplest two-player zero-sum differential game where two agents act in $x$ and $y$ with the reward functions defined by $( x y , - x y )$ . In fact, by following Eq. 2, both agents are reinforced to trace a cyclic trajectory that ,never converge to the equilibrium (Mescheder et al., 2017).
53
+
54
+ It is worth clarifying that the idea of non-correlated policy is still markedly different from the independent learning (IL). IL is a naive method that completely ignore other agents’ behaviors. The objective of agent $i$ is simplified to $\eta ^ { i } ( \pi _ { \theta ^ { i } } )$ , depending only on $i$ ’s own policy $\pi _ { \theta ^ { i } }$ compared to Eq. 1. η πθ πθAs Lowe et al. (2017) has pointed out, in IL, the probability of taking a gradient step in the correct direction decreases exponentially with the increasing number of agents, letting alone the major issue of the non-stationary environment due to the independence assumption (Tuyls & Weiss, 2012).
55
+
56
+ # 4 MULTI-AGENT PROBABILISTIC RECURSIVE REASONING
57
+
58
+ In the previous section, we have shown the weakness of the learning algorithms that build on the noncorrelated factorization on the joint policy. Here we introduce the probabilistic recursive reasoning approach that aims to capture how the opponents believe about what the agent believes. Under such setting, we devise a new multi-agent policy gradient theorem. We start from assuming the true opponent conditional policy $\pi _ { \theta ^ { - i } } ^ { - i }$ is given, and then move onward to the practical case where it is πθapproximated through variational inference.
59
+
60
+ # 4.1 PROBABILISTIC RECURSIVE REASONING
61
+
62
+ The issue on the non-correlated factorization is that it fails to help each agent to consider the consequence of its action on others, which could lead to the ill-posed behaviors in the multi-agent learning tasks. On the contrary, people explicitly attribute contents such as beliefs, desires, and intentions to others in daily life. It is known that human beings are capable of using this ability recursively to make decisions. Inspired by this, here we integrate the concept of recursive reasoning into the joint policy modeling, and propose the new probabilistic recursive reasoning (PR2) framework. Specifically, we employ the nested process of belief reasoning where each agent simulates the reasoning process of other agents, thinking about how its action would affect others, and then make actions based on such predictions. The process can be nested in a form as ${ } " \mathrm { I }$ believe [that you believe (that I believe)]". Here we start from considering the level-1 recursion, as psychologist have found that humans tend to reason on average at one or two level of recursion (Camerer et al., 2004), and levels higher than two do not provide significant benefits (De Weerd et al., 2013a;b; de Weerd et al., 2017). Based on this, we re-formulate the joint policy by
63
+
64
+ $$
65
+ \pi _ { \theta } ( a ^ { i } , a ^ { - i } | s ) = \underbrace { \pi _ { \theta ^ { i } } ^ { i } ( a ^ { i } | s ) \pi _ { \theta ^ { - i } } ^ { - i } ( a ^ { - i } | s , a ^ { i } ) } _ { \mathrm { A g e n t } i ^ { \ast } \mathrm { s p e r s p e c t i v e } } = \underbrace { \pi _ { \theta ^ { - i } } ^ { - i } ( a ^ { - i } | s ) \pi _ { \theta ^ { i } } ^ { i } ( a ^ { i } | s , a ^ { - i } ) } _ { \mathrm { T h e ~ o p p o n e n t s ' ~ p e r s p e c t i v e } } .
66
+ $$
67
+
68
+ Similar ways of decomposition can also be found in dual learning (Xia et al., 2017) on machine translation. From the perspective of agent $i$ , the first equality in Eq. 3 indicates that the joint policy can be essentially decomposed into two parts. The conditional part $\pi _ { \theta ^ { - i } } ^ { - i } ( a ^ { - i } | s , a ^ { i } )$ represents what πθ ,actions would be taken by the opponents given the fact that the opponents know the current state of environment and agent $i$ ’s action; this is based on what agent $i$ believes other opponents might think about itself. Note that the way of thinking developed by agent $i$ regarding how others would consider of itself is also shaped by opponents’ original policy $\dot { \pi } _ { \theta ^ { - i } } ^ { - i } ( a ^ { - i } | s )$ , as this is also how the opponents πθactually act in the environment. Taking into account different potential actions that agent $i$ thinks the opponents would take, agent $i$ uses the marginal policy $\pi _ { \theta ^ { i } } ^ { i } ( a ^ { i } | s )$ to find the best response. To this end, a level-1 recursive procedure is established: $a ^ { i } a ^ { - i } a ^ { i }$ . The same inference logic can be applied to the opponents from their perspectives, as shown in the second equality of Eq. 3.
69
+
70
+ Albeit intuitive, Eq. 3 may not be practical due to the requirement on the full knowledge regarding the actual conditional policy $\pi _ { \theta ^ { - i } } ^ { - i } \big ( a ^ { - i } | s , a ^ { i } \big )$ . A natural solution is that one approximates the actual policy via a best-fit model from a family of distributions. We denote this family as $\rho _ { \phi ^ { - i } } ^ { - i } ( a ^ { - i } | s , a ^ { i } )$ with learnable parameter $\phi ^ { - i }$ φ. PR2 is probabilistic as it considers the uncertainty of modeling $\pi _ { \theta ^ { - i } } ^ { - i } ( a ^ { - i } | s , a ^ { i } )$ φ. The reasoning structure is now established as shown in Fig. 1. With the recursive πθ ,joint policy defined in Eq. 3, the $n$ -agent learning task can therefore be formulated as
71
+
72
+ ![](images/87be3a2046761db8099ba965d62a5b3bf462bfd55f5a96fb7e87b94dd105dce0.jpg)
73
+ Figure 2: Diagram of multi-agent PR2 learning algorithms. It conducts decentralized training with decentralized execution. The light grey areas on two sides indicate decentralized execution for each agent. White areas give the decentralized learning procedures. All agents share the interaction experiences in the environment represented by dark area in the middle.
74
+
75
+ $$
76
+ \begin{array} { r l } & { \underset { \theta ^ { i } , \phi ^ { - i } } { \arg \operatorname* { m a x } } \ \eta ^ { i } \left( \pi _ { \theta ^ { i } } ^ { i } ( a ^ { i } \vert s ) \rho _ { \phi ^ { - i } } ^ { - i } ( a ^ { - i } \vert s , a ^ { i } ) \right) , } \\ & { \underset { \theta ^ { - i } , \phi ^ { i } } { \arg \operatorname* { m a x } } \ \eta ^ { - i } \left( \pi _ { \theta ^ { - i } } ^ { - i } ( a ^ { - i } \vert s ) \rho _ { \phi ^ { i } } ^ { i } ( a ^ { i } \vert s , a ^ { - i } ) \right) . } \end{array}
77
+ $$
78
+
79
+ With the new learning protocol defined in Eq. 4 and 5, each agent now learns its own policy as well as the approximated conditional policy of other agents given its own actions. In such a way, both the agent and the opponents can keep track of the joint policy by $\pi _ { \theta ^ { i } } ^ { i } \left( a ^ { i } | s \right) \rho _ { \phi ^ { - i } } ^ { - i } \left( a ^ { - i } | s , a ^ { i } \right) \xrightarrow { }$ $\pi _ { \theta } ( a ^ { i } , a ^ { - i } | s ) \gets \pi _ { \theta ^ { - i } } ^ { - i } ( a ^ { - i } | s ) \rho _ { \phi ^ { i } } ^ { i } ( a ^ { i } | s , a ^ { - i } )$ . Once converged, the resulting approximate satistfies: $\pi _ { \theta } ( a ^ { i } , a ^ { - i } | s ) = \pi _ { \theta ^ { i } } ^ { i } ( a ^ { i } | s ) \rho _ { \phi ^ { - i } } ^ { - i } ( a ^ { - i } | s , a ^ { i } ) = \pi _ { \theta ^ { - i } } ^ { - i } ( a ^ { - i } | s ) \rho _ { \phi ^ { i } } ^ { i } ( a ^ { i } | s , a ^ { - i } ) ,$ , according to Eq. 3.
80
+
81
+ # 4.2 PROBABILISTIC RECURSIVE REASONING POLICY GRADIENT
82
+
83
+ Given the true opponent policy $\pi _ { \theta ^ { - i } } ^ { - i }$ and that each agent tries to maximize its cumulative return in πθthe stochastic game with the objective defined in Eq. 1, we establish the policy gradient theorem by accounting for the PR2 joint policy decomposition in Eq. 3.
84
+
85
+ Proposition 1. In a stochastic game, under the recursive reasoning framework defined by Eq. 3, the update for the multi-agent recursive reasoning policy gradient method can be derived as follows:
86
+
87
+ $$
88
+ \nabla _ { \theta ^ { i } } \eta ^ { i } = \mathbb { E } _ { s \sim p , a ^ { i } \sim \pi ^ { i } } \left[ \nabla _ { \theta ^ { i } } \log \pi _ { \theta ^ { i } } ^ { i } ( a ^ { i } | s ) \int _ { a ^ { - i } } \pi _ { \theta ^ { - i } } ^ { - i } ( a ^ { - i } | s , a ^ { i } ) Q ^ { i } ( s , a ^ { i } , a ^ { - i } ) \mathrm { d } a ^ { - i } \right] .
89
+ $$
90
+
91
+ # Proof. See Appendix B.2. 
92
+
93
+ Proposition 1 states that each agent should improve its policy toward the direction of the best response after it takes into account all kinds of possibilities of how other agents would react if that action is taken. The term of $\pi _ { \theta ^ { - i } } ^ { - i } ( a ^ { - i } | s , a ^ { i } )$ can be regarded as the posterior estimation of agent $i$ ’s belief θabout how the opponents would respond to his action $a ^ { i }$ , given opponents’ true policy $\pi _ { \theta ^ { - i } } ^ { - i } ( a ^ { - i } | s )$ πθserving as the prior. Note that compared to the direction of policy update in the conventional multiagent policy gradient theorem (Wei et al., 2018), $\begin{array} { r } { \int _ { a ^ { - i } } \pi _ { \theta ^ { - i } } ^ { - i } \mathring { ( } a ^ { - i } \mathring { | } s ) \mathring { Q ^ { i } } ( s , a ^ { i } , a ^ { - i } ) \mathrm { d } a ^ { - i } } \end{array}$ , the direction of the gradient update in PR2 is guided by the term $\begin{array} { r } { \int _ { a ^ { - i } } \pi _ { \theta ^ { - i } } ^ { - i } \big ( a ^ { - i } | s , a ^ { i } \big ) Q ^ { i } \big ( s , a ^ { i } , a ^ { - i } \big ) \mathrm { d } a ^ { - i } } \end{array}$ .
94
+
95
+ In practice, agent $i$ might not have access to the opponents’ actual policy parameters $\theta ^ { - i }$ , it is often needed to approximate $\pi _ { \theta ^ { - i } } ^ { - i } ( a ^ { - i } | s , a ^ { i } )$ by $\rho _ { \phi ^ { - i } } ^ { - i } ( a ^ { - i } | s , a ^ { i } )$ θ, thereby we propose Proposition 2.
96
+
97
+ Proposition 2. In a stochastic game, under the recursive reasoning framework defined by Eq. 3, with the opponent policy approximated by $\rho _ { \phi ^ { - i } } ^ { - i } \left( a ^ { - i } | s , a ^ { i } \right)$ , the update for the multi-agent recursive φreasoning policy gradient method can be formulated as follows:
98
+
99
+ $$
100
+ \begin{array} { r l } & { \nabla _ { \theta ^ { i } } \eta ^ { i } = \mathbb { E } _ { s \sim p , a ^ { i } \sim \pi ^ { i } } \left[ \nabla _ { \theta ^ { i } } \log \pi _ { \theta ^ { i } } ^ { i } ( a ^ { i } | s ) \cdot \mathbb { E } _ { a ^ { - i } \sim \rho _ { \phi ^ { - i } } ^ { - i } } \left[ \frac { \pi _ { \theta ^ { - i } } ^ { - i } ( a ^ { - i } | s , a ^ { i } ) } { \rho _ { \phi ^ { - i } } ^ { - i } ( a ^ { - i } | s , a ^ { i } ) } Q ^ { i } ( s , a ^ { i } , a ^ { - i } ) \right] \right] . } \end{array}
101
+ $$
102
+
103
+ Proof. Substituting the approximated model $\rho _ { \phi ^ { - i } } ^ { - i } ( a ^ { - i } | s , a ^ { i } )$ for the true policy $\pi _ { \theta - i } ^ { - i }$ in Eq. 6. 
104
+
105
+ Proposition 2 raises an important point: the difference between decentralized training (algorithms that do not require the opponents’ policies) with centralized learning (algorithms that require the opponents’ policies) can in fact be quantified by a term of importance weights, similar to the connection between on-policy and off-policy methods. If we find a best-fit approximation such that $\rho _ { \phi ^ { - i } } ^ { - i } ( a ^ { - i } | s , a ^ { i } ) \to \pi _ { \theta ^ { - i } } ^ { - i } \bar { ( } a ^ { - i } | \bar { s } , a ^ { i } )$ , then Eq.7 collapses into Eq. 6.
106
+
107
+ Based on Proposition 2, we could provide multi-agent PR2 learning algorithm. As illustrated in Fig. 2, it is a decentralized-training-with-decentralized-execution algorithm. In this setting, agents share the experiences in the environment including state and historical joint actions, while each agent receive its rewards privately. Our method does not require the knowledge of other agents’ policy parameters. We list the pseudo-code of PR2-AC and PR2-Q in Appendix A. Finally, one last piece missing is how to find the best-fit approximation of $\rho _ { \phi ^ { - i } } ^ { - i } ( a ^ { - i } | s , a ^ { i } )$ .
108
+
109
+ # 4.3 VARIATIONAL INFERENCE ON OPPONENT CONDITIONAL POLICY
110
+
111
+ We adopt an optimization-based approximation to infer the unobservable $\rho _ { \phi ^ { - i } } ^ { - i } ( a ^ { - i } | s , a ^ { i } )$ via variational inference (Jordan et al., 1999). We first define the trajectory $\tau$ φup to time $t$ including the experiences of $t$ consecutive time stages, i.e. $\tau = [ ( s _ { 1 } , a _ { 1 } ^ { i } , a _ { 1 } ^ { - i } ) , \dot { \mathrm { ~ . ~ . ~ . ~ } } , ( \dot { s _ { t } } , a _ { t } ^ { i } , \dot { a } _ { t } ^ { - i } ) ]$ . In the probabilistic τ , ,reinforcement learning (Levine, 2018), the probability of $\tau$ , . . . , , ,being generated can be derived as
112
+
113
+ $$
114
+ p ( \tau ) = \left[ p ( s _ { 1 } ) \prod _ { t = 1 } ^ { T } p ( s _ { t + 1 } | s _ { t } , a _ { t } ^ { i } , a _ { t } ^ { - i } ) \right] \exp \left( \sum _ { t = 1 } ^ { T } r ^ { i } ( s _ { t } , a _ { t } , a _ { t } ^ { - i } ) \right) .
115
+ $$
116
+
117
+ Assuming the dynamics is fixed (i.e. the agent can not influence the environment transition probability), our goal is then to find the best approximation of $\pi _ { \theta ^ { i } } ^ { i } ( a _ { t } ^ { i } | s _ { t } ) \rho _ { \phi ^ { - i } } ^ { - i } ( a _ { t } ^ { - i } | s _ { t } , a _ { t } ^ { i } )$ such that the induced trajectory distribution $\hat { p } ( \tau )$ θ φ can match with the true trajectory probability $p ( \tau )$ :
118
+
119
+ $$
120
+ \hat { p } ( \tau ) = p ( s _ { 1 } ) \prod _ { t = 1 } ^ { T } p ( s _ { t + 1 } | s _ { t } , a _ { t } ^ { i } , a _ { t } ^ { - i } ) \pi _ { \theta ^ { i } } ^ { i } ( a _ { t } ^ { i } | s _ { t } ) \rho _ { \theta ^ { - i } } ^ { - i } ( a _ { t } ^ { - i } | s _ { t } , a _ { t } ^ { i } ) .
121
+ $$
122
+
123
+ In other words, we can optimize the opponents’ policy $\rho _ { \phi ^ { - i } } ^ { - i }$ via minimizing the $K L$ -divergence, i.e.
124
+
125
+ $$
126
+ \begin{array} { l } { \displaystyle D _ { \mathrm { K L } } ( \hat { p } ( \tau ) \| p ( \tau ) ) = - \mathbb { E } _ { \tau \sim \hat { p } ( \tau ) } \big [ \log p ( \tau ) - \log \hat { p } ( \tau ) \big ] } \\ { \displaystyle \qquad = - \sum _ { t = 1 } ^ { t - T } E _ { \tau \sim \hat { p } ( \tau ) } \left[ r ^ { i } \left( s _ { t } , a _ { t } ^ { i } , a _ { t } ^ { - i } \right) + \mathcal { H } \left( \pi _ { \theta ^ { i } } ^ { i } \left( a _ { t } ^ { i } | s _ { t } \right) \rho _ { \phi ^ { - i } } ^ { - i } \left( a ^ { - i } | s _ { t } , a _ { t } ^ { i } \right) \right) \right] . } \end{array}
127
+ $$
128
+
129
+ Besides the reward term, the objective introduces an additional term of the conditional entropy on the joint policy $\mathcal { H } \left( \pi _ { \theta ^ { i } } ^ { i } \left( a _ { t } ^ { i } \vert s _ { t } \right) \rho _ { \phi ^ { - i } } ^ { - i } \left( a ^ { - i } \vert s _ { t } , a _ { t } ^ { i } \right) \right)$ that potentially promotes the explorations for both the agent $i$ θ φ’s best response and the opponents’ conditional policy. Note that the entropy here is conditioning not only on the state $s _ { t }$ but also on agent $i$ ’s action. Minimizing Eq. 10 gives us:
130
+
131
+ Theorem 1. The optimal $Q$ -function for agent i that satisfies minimizing Eq. 10 is formulated as:
132
+
133
+ $$
134
+ Q _ { \pi _ { \theta } } ^ { i } ( s , a ^ { i } ) = \log \int _ { a ^ { - i } } \exp ( \boldsymbol { Q } _ { \pi _ { \theta } } ^ { i } ( s , a ^ { i } , a ^ { - i } ) ) \mathrm { d } a ^ { - i } .
135
+ $$
136
+
137
+ And the corresponding optimal opponent conditional policy reads:
138
+
139
+ $$
140
+ \rho _ { \phi ^ { - i } } ^ { - i } ( a ^ { - i } | s , a ^ { i } ) = { \frac { 1 } { Z } } \exp ( { \mathcal { Q } } _ { \pi _ { \theta } } ^ { i } ( s , a ^ { i } , a ^ { - i } ) - { \mathcal { Q } } _ { \pi _ { \theta } } ^ { i } ( s , a ^ { i } ) )
141
+ $$
142
+
143
+ Proof. See Appendix C. 
144
+
145
+ ![](images/404263110f079e45e78d9803c8fb76709f564762c09af7bd89d099270c34f449.jpg)
146
+ Figure 3: Learning paths on the iterated matrix game. a: IGA. b-d: PR2-Q.
147
+
148
+ Theorem 1 states that the learning of $\rho _ { \phi ^ { - i } } ^ { - i } \left( a ^ { - i } | s , a ^ { i } \right)$ can be further converted to minimizing the $K L$ φ-divergence between the estimated policy $\rho _ { \phi ^ { - i } } ^ { - i }$ and the advantage function: $D _ { \mathrm { K L } } \left( \rho _ { \phi ^ { - i } } ^ { - i } ( a ^ { - i } | s , a ^ { i } ) \| \exp ( Q ^ { i } ( s , a ^ { i } , a ^ { - i } ) - Q ^ { i } ( s , a ^ { i } ) ) \right)$ . We can obtain a solution to Eq. 12 by mainφtaining two $Q$ -functions, and then iteratively update them. We prove the convergence under self-play when there is one equilibrium. This leads to a fixed-point iteration that resembles value iteration.
149
+
150
+ Theorem 2. In a symmetric game with only one equilibrium, and the equilibrium meets one of the conditions: 1) the global optimum, i.e. $\mathbb { E } _ { \pi _ { * } } \left[ \hat { Q } _ { t } ^ { i } ( s ) \right] \ : \geq \ : \mathbb { E } _ { \pi } \left[ Q _ { t } ^ { i } ( s ) \right] ;$ ; 2) a saddle point, i.e. $\mathbb { E } _ { \pi _ { * } } \left[ Q _ { t } ^ { i } ( s ) \right] \geq \mathbb { E } _ { \pi ^ { i } } \mathbb { E } _ { \pi _ { * } ^ { - i } } \left[ Q _ { t } ^ { i } ( s ) \right] o r \mathbb { E } _ { \pi _ { * } } \left[ Q _ { t } ^ { i } ( s ) \right] \geq \mathbb { E } _ { \pi _ { * } ^ { i } } \bar { \mathbb { E } } _ { \pi ^ { - i } } \left[ Q _ { t } ^ { i } ( s ) \right] ,$ ; where $Q _ { * }$ and $\pi _ { * }$ are the π π π π π π πequilibrium value function and policy, respectively. The PR2 soft value iteration operator defined by:
151
+
152
+ $$
153
+ \mathcal { T Q } ^ { i } ( s , a ^ { i } , a ^ { - i } ) \triangleq r ^ { i } ( s , a ^ { i } , a ^ { - i } ) + \gamma \mathbb { E } _ { s ^ { \prime } , a ^ { i \prime } \sim p _ { s } , \pi ^ { i } } \left[ \log \int _ { a ^ { - i \prime } } \exp ( \mathcal { Q } ^ { i } ( s ^ { \prime } , a ^ { i \prime } , a ^ { - i \prime } ) ) \mathrm { d } a ^ { - i \prime } \right] ,
154
+ $$
155
+
156
+ is a contraction mapping.
157
+
158
+ Proof. See Appendix D. 
159
+
160
+ # 4.4 SAMPLING IN CONTINUOUS ACTION SPACE
161
+
162
+ In continuous controls, getting the actions from the opponent policy $\rho _ { \phi ^ { - i } } ^ { - i } \left( a ^ { - i } | s , a ^ { i } \right)$ is challenging. ρφ ,In this work, we follow Haarnoja et al. (2017) to adopt the amortized Stein Variational Gradient Descent (SVGD) (Liu & Wang, 2016; Wang & Liu, 2016) in sampling from the soft Q-function. Compared to MCMC, Amortized SVGD is a computationally-efficient way to estimate $\rho _ { \phi ^ { - i } } ^ { - i } \left( a ^ { - i } | s , a ^ { i } \right)$ . Thanks to SVGD, agent $i$ ρφ ,is able to reason about potential consequences of opponent bavhaviors $\begin{array} { r } { \int _ { a ^ { - i } } \pi _ { \theta ^ { - i } } ^ { - i } \big ( a ^ { - i } | s , a ^ { i } \big ) \breve { Q } ^ { i } \big ( s , a ^ { i } , a ^ { - i } \big ) \mathrm { d } a ^ { - i } } \end{array}$ , and finally find the corresponding best response.
163
+
164
+ # 5 EXPERIMENTS
165
+
166
+ We evaluate the performance of PR2 methods on the iterated matrix games, differential games, and particle world environment. Those games can by design have a non-trivial equilibrium that requires certain levels of intelligent reasonings between agents. We compared our algorithm with a series of baselines. In the matrix game, we compare against IGA (Infinitesimal Gradient Ascent) (Singh et al., 2000). In the differential games, the baselines from multi-agent learning algorithms are MASQL (Multi-Agent Soft-Q) (Wei et al., 2018) and MADDPG (Lowe et al., 2017). We also including independent learning algorithms implemented through DDPG (Lillicrap et al., 2015). To compare against traditional method of opponent modeling, we include one baseline that is based on DDPG but with one additional opponent modeling unit that is trained in an online and supervised way to learn the most recent opponent policy, which is then fed into the critic. Similar approach has been implemented by Rabinowitz et al. (2018) in realizing machine theory of mind. Besides, we applied centralized Symplectic Gradient Adjustment (SGA) (Balduzzi et al., 2018) optimization for DDPG agents (DDPG-SGA), which has recently been found to help converge to a local equilibrium quickly.
167
+
168
+ For the experiment settings, all the policies and $Q$ -functions are parameterized by the MLP with 2 hidden layers, each with 100 units ReLU activation. The sampling network $\xi$ for the $\rho _ { \phi ^ { - i } } ^ { - i }$ in SGVD ξ ρφfollows the standard normal distribution. In the iterated matrix game, we trained all the methods including the baselines for 500 iterations. In the differential game, we trained the agents for 350 iterations with 25 steps per iteration. For the actor-critic methods, we set the exploration noise to 0 1 .in first 1000 steps, and the annealing parameters for PR2-AC and MASQL are set to 0 5 to balance between the exploration and acting as the best response.
169
+
170
+ ![](images/3d07196412fb0aadba22cc270238fa7afb2c8937a06b2201e297e9e817082ee2.jpg)
171
+ PR2-AC.
172
+ Figure 4: Max of Two Quadratic Game.-10.0 -10.0
173
+
174
+ ![](images/3c34b3adcbdcd72ba79c0548a17ab610476381c613852364c1cd98759aa8abdf.jpg)
175
+ Figure 5: The learning path of Agent 1 ( $\mathbf { \dot { X } } - \mathbf { \dot { X } } - \mathbf { \dot { X } }$ -axis) vs. Agent 2 (y-axis).
176
+
177
+ # 5.1 ITERATED MATRIX GAME
178
+
179
+ In the matrix game, the payoffs are defined by: $R ^ { 1 } = \left[ \begin{array} { l l } { 0 } & { 3 } \\ { 1 } & { 2 } \end{array} \right]$ , and R2 $R ^ { 2 } = { \left[ \begin{array} { l l } { 3 } & { 2 } \\ { 0 } & { 1 } \end{array} \right] } .$ These exists the only Nash Equilibrium at (0 5 0 5). This game has been intensively investigated in multi. , .agent studies (Bowling & Veloso, 2001a;b). One reason is that in solving the Nash Equilibrium for this game, simply taking simultaneous gradient steps on both agent’s value functions will present the rotational behaviors on the gradient vector field; this leads to an endlessly iterative change of behaviors. Without considering the consequence of one agent’s action on the other agent beforehand, it is challenging for both players to find the equilibrium. Similar issue has been found on training the GANs (Goodfellow et al., 2014; Mescheder et al., 2017)
180
+
181
+ The results are shown in Fig. 3. As expected, IGA fails to converge to the equilibrium but rotate around the equilibrium point. On the contrary, our method can find precisely the central equilibrium with a fully distributed fashion (see Fig. 3b). The convergence can also be justified by the agents’ policies in Fig. 3c, and the opponent’s policy that is maintained by each agent in Fig. 3d.
182
+
183
+ # 5.2 DIFFERENTIAL GAME
184
+
185
+ We adopt the same differential game, the Max of Two Quadratic Game, as Panait et al. (2006); Wei et al. (2018). The agents have continuous action space of $[ - 1 0 , 1 0 ]$ . Each agent’s reward depends on the joint action following the equations: $r ^ { 1 } \left( a ^ { 1 } , a ^ { 2 } \right) = r ^ { 2 } \left( a ^ { 1 } , a ^ { 2 } \right) = \operatorname* { m a x } \left( f _ { 1 } , f _ { 2 } \right)$ where $\begin{array} { r } { f _ { 1 } = 0 . 8 \times [ - ( \frac { a ^ { 1 } + 5 } { 3 } ) ^ { 2 } - ( \frac { a ^ { 2 } + 5 } { 3 } ) ^ { 2 } ] , f _ { 2 } = 1 . 0 \times [ - ( \frac { a ^ { 1 } - 5 } { 1 } ) ^ { 2 } - ( \frac { a ^ { 2 } - 5 } { 1 } ) ^ { 2 } ] + 1 0 } \end{array}$ , ,. The task poses a great . , . challenge to general gradient-based algorithms because gradient tends to points to the sub-optimal solution. The reward surface is shown in Fig. 4a; there is a local maximum 0 at $( - 5 , - 5 )$ and a global maximum 10 at $( 5 , 5 )$ ,, with a deep valley staying in the middle. If the agents’ policies are initialized to $( 0 , 0 )$ , (the red starred point) that lies within the basin of the left local maximum, the ,gradient based methods would tend to fail to find the global maximum equilibrium point due to the valley blocking the upper right area. The pathology of finding a suboptimal Nash equilibrium is also called relative over-generalization (Wei & Luke, 2016).
186
+
187
+ ![](images/e05881d34e2841a8ecf88373fbad6314a4c1d965270cfa4617b673ac92f116f5.jpg)
188
+ Figure 6: Performance of PR2-AC on the Particle World environment. Each bar shows the $0 - 1$ normalized score for agent in cooperative navigation task and the normalized advantage score (agent reward - adversary reward) in a set of competitive tasks. Higher score is better.
189
+
190
+ We present the results in Fig. 4b, PR2-AC shows superior performance that manages to converge to the global equilibrium, while all the other baselines fall into the local basin on the left, except that the MASQL has small chance to find the optimal point. On top of the convergence result, it is worth noting that as the temperature annealing is required for energy-based RL methods, the learning outcomes of MASQL are extremely sensitive to the way of annealing, i.e. when and how to anneal the temperature to a small value during training is non-trivial. However, our method does not need to tune the the annealing parameter at all because the each agent is acting the best response to the approximated conditional policy, considering all potential consequences of the opponent’s response.
191
+
192
+ Interestingly, by comparing the learning path in Fig. 4a against Fig. 5(a-e) where the scattered blue dots are the exploration trails at the beginning, we can tell that if the PR2-AC model finds the peak point in joint action space, the agents can quickly go through the shortcut out of the local basin in a clever way, while other algorithms just converge to the local equilibrium. This further justifies the effectiveness and benefits of conducting recursive reasoning with opponents. Apart from testing in the self-play setting, we also test the scenario when the opponent type is different. We pair PR2-AC with all four baseline algorithms in Fig. 5(f-i). Similar result can be found, that is, algorithm that has the function of taking into account the opponents (i.e. DDPG_OM & MADDPG) can converge to the local equilibrium even though not global, while DDPG and MASQL completely fails due to the inborn defect from the independent learning methods.
193
+
194
+ # 5.3 PARTICLE WORLD ENVIRONMENTS
195
+
196
+ We further test our method on the multi-state multi-player Particle World Environments (Lowe et al., 2017). This includes four testing scenarios: 1) Cooperative Navigation with 3 agents and 3 landmarks. Agents are collectively rewarded based on the proximity of any agent to each landmark while avoiding collisions; 2) Physical Deception with 1 adversary, 2 good agents, and 2 landmarks. All agents observe the positions of landmarks and other agents. Only one landmark is the true target landmark. Good agents are rewarded based on how close any of them is to the target landmark, and how well they deceive the adversary; 3) Keep-away with 1 agent, 1 adversary, and 1 landmark. Agent is rewarded based on distance to landmark. Adversary is rewarded if it push away the agent from the landmark; 4) Predator-prey with 1 prey agent who moves faster try to run away from 3 adversary predator who move slower but are motivated to catch the prey cooperatively.
197
+
198
+ The PR2 methods are compared against a series of the centralized MARL methods in Fig. 6. Under the fully-cooperative setting (the left plot), PR2AC achieves the best performance over all baselines, even though it is a decentralized algorithm that does not have access to the exact opponent policies. Under the competitive settings where PR2AC rivals against the a set of adversary baselines, we find that PR2AC learners can beat all the baselines, including DDPG, DDPG-OM, and MASQL. The only exception is MADDPG, as it is suggested by the drop-down arrow. PR2AC performs particularly bad on the physical deception task. We believe it is mainly because the centralized critic can access the full knowledge of the exact policies of PR2-AC, but PR2-AC cannot access the models of its opponents in the reversed way; this could place PR2-AC in an inferior position during testing time as its deceptive strategy has been found out by the opponents already during training.
199
+
200
+ # 6 CONCLUSION
201
+
202
+ Inspired by the recursive reasoning capability of human intelligence, in this paper, we introduce a probabilistic recursive reasoning framework for multi-agent RL that follows "I believe that you believe that I believe". We adopt variational Bayes methods to approximate the opponents’ conditional policy, to which each agent finds the best response and then improve their own policy. The training and execution is full decentralized and the resulting algorithms, PR2-Q and PR2-AC, converge in selfplay when there is one Nash equilibrium. Our results on three kinds of testing beds with increasing complexity justify the advantages of learning to reason about the opponents in a recursive manner. In the future, we plan to investigate other approximation methods for the PR2 framework, and test our PR2 algorithm for the coordination task between AI agents such as coordinating autonomous cars before the traffic light.
203
+
204
+ # REFERENCES
205
+
206
+ Stefano V Albrecht and Peter Stone. Autonomous agents modelling other agents: A comprehensive survey and open problems. Artificial Intelligence, 258:66–95, 2018.
207
+
208
+ David Balduzzi, Sebastien Racaniere, James Martens, Jakob Foerster, Karl Tuyls, and Thore Graepel. The mechanics of n-player differentiable games. arXiv preprint arXiv:1802.05642, 2018.
209
+
210
+ Dipyaman Banerjee and Sandip Sen. Reaching pareto-optimality in prisoner’s dilemma using conditional joint action learning. Autonomous Agents and Multi-Agent Systems, 15(1):91–108, 2007.
211
+
212
+ Thomas Bolander and Mikkel Birkegaard Andersen. Epistemic planning for single-and multi-agent systems. Journal of Applied Non-Classical Logics, 21(1):9–34, 2011.
213
+
214
+ Michael Bowling. Convergence and no-regret in multiagent learning. In Advances in neural information processing systems, pp. 209–216, 2005.
215
+
216
+ Michael Bowling and Manuela Veloso. Convergence of gradient dynamics with a variable learning rate. In ICML, pp. 27–34, 2001a.
217
+
218
+ Michael Bowling and Manuela Veloso. Rational and convergent learning in stochastic games. In International joint conference on artificial intelligence, volume 17, pp. 1021–1026. Lawrence Erlbaum Associates Ltd, 2001b.
219
+
220
+ Michael Bowling and Manuela Veloso. Multiagent learning using a variable learning rate. Artificial Intelligence, 136(2):215–250, 2002.
221
+
222
+ George W Brown. Iterative solution of games by fictitious play. Activity analysis of production and allocation, 13(1):374–376, 1951.
223
+
224
+ Colin F Camerer, Teck-Hua Ho, and Juin-Kuan Chong. A cognitive hierarchy model of games. The Quarterly Journal of Economics, 119(3):861–898, 2004.
225
+
226
+ Colin F Camerer, Teck-Hua Ho, and Juin Kuan Chong. A psychological approach to strategic thinking in games. Current Opinion in Behavioral Sciences, 3:157–162, 2015.
227
+
228
+ Caroline Claus and Craig Boutilier. The dynamics of reinforcement learning in cooperative multiagent systems. AAAI/IAAI, 1998:746–752, 1998.
229
+
230
+ Bruno C Da Silva, Eduardo W Basso, Ana LC Bazzan, and Paulo M Engel. Dealing with nonstationary environments using context detection. In Proceedings of the 23rd international conference on Machine learning, pp. 217–224. ACM, 2006.
231
+
232
+ Harmen De Weerd, Rineke Verbrugge, and Bart Verheij. Higher-order theory of mind in negotiations under incomplete information. In International Conference on Principles and Practice of MultiAgent Systems, pp. 101–116. Springer, 2013a.
233
+
234
+ Harmen De Weerd, Rineke Verbrugge, and Bart Verheij. How much does it help to know what she knows you know? an agent-based simulation study. Artificial Intelligence, 199:67–92, 2013b.
235
+
236
+ Harmen de Weerd, Rineke Verbrugge, and Bart Verheij. Negotiating with other minds: the role of recursive theory of mind in negotiation with incomplete information. Autonomous Agents and Multi-Agent Systems, 31(2):250–287, 2017.
237
+
238
+ Daniel C Dennett. Two contrasts: folk craft versus folk science, and belief versus opinion. The future of folk psychology: Intentionality and cognitive science, pp. 135–148, 1991.
239
+
240
+ Prashant Doshi and Piotr J Gmytrasiewicz. On the difficulty of achieving equilibrium in interactive pomdps. In PROCEEDINGS OF THE NATIONAL CONFERENCE ON ARTIFICIAL INTELLIGENCE, volume 21, pp. 1131. Menlo Park, CA; Cambridge, MA; London; AAAI Press; MIT Press; 1999, 2006.
241
+
242
+ Prashant Doshi and Piotr J Gmytrasiewicz. Monte carlo sampling methods for approximating interactive pomdps. Journal of Artificial Intelligence Research, 34:297–337, 2009.
243
+
244
+ Prashant Doshi and Dennis Perez. Generalized point based value iteration for interactive pomdps. In AAAI, pp. 63–68, 2008.
245
+
246
+ Prashant Doshi, Yifeng Zeng, and Qiongyu Chen. Graphical models for interactive pomdps: representations and solutions. Autonomous Agents and Multi-Agent Systems, 18(3):376, 2009.
247
+
248
+ Jakob Foerster, Gregory Farquhar, Triantafyllos Afouras, Nantas Nardelli, and Shimon Whiteson. Counterfactual multi-agent policy gradients. arXiv preprint arXiv:1705.08926, 2017.
249
+
250
+ Jakob Foerster, Richard Y Chen, Maruan Al-Shedivat, Shimon Whiteson, Pieter Abbeel, and Igor Mordatch. Learning with opponent-learning awareness. In Proceedings of the 17th International Conference on Autonomous Agents and MultiAgent Systems, pp. 122–130. International Foundation for Autonomous Agents and Multiagent Systems, 2018.
251
+
252
+ Roy Fox, Ari Pakman, and Naftali Tishby. Taming the noise in reinforcement learning via soft updates. In Proceedings of the Thirty-Second Conference on Uncertainty in Artificial Intelligence, pp. 202–211. AUAI Press, 2016.
253
+
254
+ Ya’akov Gal and Avi Pfeffer. A language for modeling agents’ decision making processes in games. In Proceedings of the second international joint conference on Autonomous agents and multiagent systems, pp. 265–272. ACM, 2003.
255
+
256
+ Ya’akov Gal and Avi Pfeffer. Networks of influence diagrams: a formalism for representing agents’ beliefs and decision-making processes. Journal of Artificial Intelligence Research, 33:109–147, 2008.
257
+
258
+ Vittorio Gallese and Alvin Goldman. Mirror neurons and the simulation theory of mind-reading. Trends in cognitive sciences, 2(12):493–501, 1998.
259
+
260
+ Piotr J Gmytrasiewicz and Prashant Doshi. A framework for sequential planning in multi-agent settings. Journal of Artificial Intelligence Research, 24:49–79, 2005.
261
+
262
+ Piotr J Gmytrasiewicz and Edmund H Durfee. A rigorous, operational formalization of recursive modeling. In ICMAS, pp. 125–132, 1995.
263
+
264
+ Piotr J Gmytrasiewicz and Edmund H Durfee. Rational coordination in multi-agent environments. Autonomous Agents and Multi-Agent Systems, 3(4):319–350, 2000.
265
+
266
+ Piotr J Gmytrasiewicz, Edmund H Durfee, and David K Wehe. A decision-theoretic approach to coordinating multi-agent interactions. In IJCAI, volume 91, pp. 63–68, 1991.
267
+
268
+ Alvin I Goldman et al. Theory of mind. The Oxford handbook of philosophy of cognitive science, pp. 402–424, 2012.
269
+
270
+ 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.
271
+
272
+ Adam S Goodie, Prashant Doshi, and Diana L Young. Levels of theory-of-mind reasoning in competitive games. Journal of Behavioral Decision Making, 25(1):95–108, 2012.
273
+
274
+ Alison Gopnik and Henry M Wellman. Why the child’s theory of mind really is a theory. Mind & Language, 7(1-2):145–171, 1992.
275
+
276
+ Robert M Gordon. Folk psychology as simulation. Mind & Language, 1(2):158–171, 1986.
277
+
278
+ Amy Greenwald, Keith Hall, and Roberto Serrano. Correlated q-learning. In ICML, volume 3, pp. 242–249, 2003.
279
+
280
+ Tuomas Haarnoja, Haoran Tang, Pieter Abbeel, and Sergey Levine. Reinforcement learning with deep energy-based policies. arXiv preprint arXiv:1702.08165, 2017.
281
+
282
+ John C Harsanyi. Bargaining in ignorance of the opponent’s utility function. Journal of Conflict Resolution, 6(1):29–38, 1962.
283
+
284
+ John C Harsanyi. Games with incomplete information played by bayesian players, i–iii part i. the basic model. Management science, 14(3):159–182, 1967.
285
+
286
+ He He, Jordan Boyd-Graber, Kevin Kwok, and Hal Daumé III. Opponent modeling in deep reinforcement learning. In International Conference on Machine Learning, pp. 1804–1813, 2016.
287
+
288
+ Junling Hu and Michael P Wellman. Nash q-learning for general-sum stochastic games. Journal of machine learning research, 4(Nov):1039–1069, 2003.
289
+
290
+ Michael I Jordan, Zoubin Ghahramani, Tommi S Jaakkola, and Lawrence K Saul. An introduction to variational methods for graphical models. Machine learning, 37(2):183–233, 1999.
291
+
292
+ Brenden M Lake, Tomer D Ullman, Joshua B Tenenbaum, and Samuel J Gershman. Building machines that learn and think like people. Behavioral and Brain Sciences, 40, 2017.
293
+
294
+ Sergey Levine. Reinforcement learning and control as probabilistic inference: Tutorial and review. arXiv preprint arXiv:1805.00909, 2018.
295
+
296
+ Timothy P Lillicrap, Jonathan J Hunt, Alexander Pritzel, Nicolas Heess, Tom Erez, Yuval Tassa, David Silver, and Daan Wierstra. Continuous control with deep reinforcement learning. arXiv preprint arXiv:1509.02971, 2015.
297
+
298
+ Michael L Littman. Markov games as a framework for multi-agent reinforcement learning. In Machine Learning Proceedings 1994, pp. 157–163. Elsevier, 1994.
299
+
300
+ Michael L Littman. Friend-or-foe q-learning in general-sum games. In ICML, volume 1, pp. 322–328, 2001.
301
+
302
+ Qiang Liu and Dilin Wang. Stein variational gradient descent: A general purpose bayesian inference algorithm. In Advances In Neural Information Processing Systems, pp. 2378–2386, 2016.
303
+
304
+ Ryan Lowe, Yi Wu, Aviv Tamar, Jean Harb, OpenAI Pieter Abbeel, and Igor Mordatch. Multi-agent actor-critic for mixed cooperative-competitive environments. In Advances in Neural Information Processing Systems, pp. 6379–6390, 2017.
305
+
306
+ Lars Mescheder, Sebastian Nowozin, and Andreas Geiger. The numerics of gans. In Advances in Neural Information Processing Systems, pp. 1825–1835, 2017.
307
+
308
+ Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 518(7540):529, 2015.
309
+
310
+ Christian J Muise, Vaishak Belle, Paolo Felli, Sheila A McIlraith, Tim Miller, Adrian R Pearce, and Liz Sonenberg. Planning over multi-agent epistemic states: A classical planning approach. In AAAI, pp. 3327–3334, 2015.
311
+
312
+ Liviu Panait, Sean Luke, and R Paul Wiegand. Biasing coevolutionary search for optimal multiagent behaviors. IEEE Transactions on Evolutionary Computation, 10(6):629–645, 2006.
313
+
314
+ Peng Peng, Ying Wen, Yaodong Yang, Quan Yuan, Zhenkun Tang, Haitao Long, and Jun Wang. Multiagent bidirectionally-coordinated nets: Emergence of human-level coordination in learning to play starcraft combat games. arXiv preprint arXiv:1703.10069, 2017.
315
+
316
+ Brad E Pfeiffer and David J Foster. Hippocampal place-cell sequences depict future paths to remembered goals. Nature, 497(7447):74, 2013.
317
+
318
+ David Premack and Guy Woodruff. Does the chimpanzee have a theory of mind? Behavioral and brain sciences, 1(4):515–526, 1978.
319
+
320
+ David V Pynadath and Stacy C Marsella. Psychsim: Modeling theory of mind with decision-theoretic agents. In IJCAI, volume 5, pp. 1181–1186, 2005.
321
+
322
+ Neil C Rabinowitz, Frank Perbet, H Francis Song, Chiyuan Zhang, SM Eslami, and Matthew Botvinick. Machine theory of mind. arXiv preprint arXiv:1802.07740, 2018.
323
+
324
+ Nikolaus Robalino and Arthur Robson. The economic approach to ’theory of mind’. Phil. Trans. R. Soc. B, 367(1599):2224–2233, 2012.
325
+
326
+ Sven Seuken and Shlomo Zilberstein. Formal models and algorithms for decentralized decision making under uncertainty. Autonomous Agents and Multi-Agent Systems, 17(2):190–250, 2008.
327
+
328
+ Lloyd S Shapley. Stochastic games. Proceedings of the national academy of sciences, 39(10): 1095–1100, 1953.
329
+
330
+ Yoav Shoham, Rob Powers, Trond Grenager, et al. If multi-agent learning is the answer, what is the question? Artificial Intelligence, 171(7):365–377, 2007.
331
+
332
+ Satinder Singh, Michael Kearns, and Yishay Mansour. Nash convergence of gradient dynamics in general-sum games. In Proceedings of the Sixteenth conference on Uncertainty in artificial intelligence, pp. 541–548. Morgan Kaufmann Publishers Inc., 2000.
333
+
334
+ Edward Jay Sondik. The optimal control of partially observable markov processes. Technical report, STANFORD UNIV CALIF STANFORD ELECTRONICS LABS, 1971.
335
+
336
+ Ekhlas Sonu and Prashant Doshi. Scalable solutions of interactive pomdps using generalized and bounded policy iteration. Autonomous Agents and Multi-Agent Systems, 29(3):455–494, 2015.
337
+
338
+ Richard S Sutton, Andrew G Barto, et al. Reinforcement learning: An introduction. MIT press, 1998.
339
+
340
+ Richard S Sutton, David A McAllester, Satinder P Singh, and Yishay Mansour. Policy gradient methods for reinforcement learning with function approximation. In Advances in neural information processing systems, pp. 1057–1063, 2000.
341
+
342
+ Edward C Tolman. Cognitive maps in rats and men. Psychological review, 55(4):189, 1948.
343
+
344
+ Karl Tuyls and Gerhard Weiss. Multiagent learning: Basics, challenges, and prospects. Ai Magazine, 33(3):41, 2012.
345
+
346
+ Friedrich Burkhard Von Der Osten, Michael Kirley, and Tim Miller. The minds of many: opponent modelling in a stochastic game. In Proceedings of the 25th International Joint Conference on Artificial Intelligence (IJCAI), AAAI Press, pp. 3845–3851, 2017.
347
+
348
+ Dilin Wang and Qiang Liu. Learning to draw samples: With application to amortized mle for generative adversarial learning. arXiv preprint arXiv:1611.01722, 2016.
349
+
350
+ Ermo Wei and Sean Luke. Lenient learning in independent-learner stochastic cooperative games. The Journal of Machine Learning Research, 17(1):2914–2955, 2016.
351
+
352
+ Ermo Wei, Drew Wicke, David Freelan, and Sean Luke. Multiagent soft q-learning. AAAI, 2018.
353
+
354
+ Yingce Xia, Tao Qin, Wei Chen, Jiang Bian, Nenghai Yu, and Tie-Yan Liu. Dual supervised learning. arXiv preprint arXiv:1707.00415, 2017.
355
+
356
+ Yaodong Yang, Rui Luo, Minne Li, Ming Zhou, Weinan Zhang, and Jun Wang. Mean field multiagent reinforcement learning. 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. 5571–5580, Stockholmsmassan, Stockholm Sweden, 10–15 Jul 2018. PMLR.
357
+
358
+ # APPENDIX
359
+
360
+ A DECENTRALIZED MULTI-AGENT PROBABILISTIC RECURSIVE REASONING ALGORITHMS
361
+
362
+ Algorithm 1 gives the step by step learning procedures for PR2-AC algorithm.
363
+
364
+ <table><tr><td colspan="2">Algorithm 1: Multi-Agent Probabilistic Recursive Reasoning Actor Critic (PR2-AC).</td></tr><tr><td colspan="2">Result: Policy:πi, Opponent Recursive Reasoning: p-i(a-i |s,ai). 1 Initialize parameters 0i,Φ-i,ωi for each agent i,and the random process N for action exploration</td></tr><tr><td colspan="2">2 Assign target parameters of joint action Q-function: ωi ← ωi,and target policy parameter: 0i ←</td></tr><tr><td colspan="2">3 Di← empty replay buffer for each agent.</td></tr><tr><td colspan="2"></td></tr><tr><td colspan="2">4 for each episode do 5</td></tr><tr><td colspan="2">Initialize random process N for action exploration.</td></tr><tr><td colspan="2">6 for each step t do</td></tr><tr><td colspan="2">Given the current s,for each agent i, select action ai = μii(s) + Nt; 7</td></tr><tr><td colspan="2">Take the joint action (ai,a-i) and observe own reward ri and new state s&#x27;; 8</td></tr><tr><td colspan="2">9 Add the tuple (s,ai,a-i,ri,s&#x27;) in corresponding replay buffer Di;</td></tr><tr><td colspan="2">10 s↑s&#x27;; 11 for each agent i do</td></tr><tr><td colspan="2">12</td></tr><tr><td colspan="2">Sample a random mini-batch {(s,aj,aji,rj,sj)}=0 from D&#x27;; Get a&#x27; = μi for each state sj ; 13</td></tr><tr><td colspan="2">Sample{(s,)foreach&#x27; ad; 14 Sety²=+Y∑=Qu(s&#x27;,a,);</td></tr><tr><td colspan="2">15</td></tr><tr><td colspan="2">Update the critic by minizingthelos(ω)=∑(y-Qu(sj,))²; 16 17 Update the actor using the sampled policy gradient:</td></tr><tr><td colspan="2"></td></tr><tr><td colspan="2">N M 1 eip(sj)Va 1 eini Q(sj,a,aj); N M j=0 k=0 18 19</td></tr><tr><td colspan="2">Compute 4p−i using empirical estimation:</td></tr><tr><td colspan="2">△(-s,a)[((s))Q²(s)</td></tr><tr><td colspan="2">+(a(s))],</td></tr><tr><td colspan="2">where κ is a kernel function;</td></tr><tr><td colspan="2">20 21 Compute empirical gradient V$-i Jp-i ;</td></tr><tr><td colspan="2">Update $-i according to V-i Jp-i; 22</td></tr><tr><td colspan="2">23 end 24 Update target network parameters for each agent i:</td></tr><tr><td colspan="2">25 θ²&#x27;←20i+(1-λ)θi&#x27;;</td></tr><tr><td colspan="2"></td></tr><tr><td colspan="2">w←λw²+(1-1)ωi&#x27;;</td></tr><tr><td colspan="2">end 27 end</td></tr></table>
365
+
366
+ The Algorithm 2 shows the variant of Decentralized Multi-Agent Probabilistic Recursive Reasoning. We can simply approximate the $\rho ^ { - i } ( a ^ { - i } | s , a ^ { i } )$ by counting: $\bar { \rho ^ { - i } } ( a ^ { - i } | s , a ^ { i } ) = C ( a ^ { i } , a ^ { - i } , s ) / C ( a ^ { i } , s )$ ρ ,in tabular if the state-action space is small, where $C$ ρ , , , / ,is the counting function. It this case, an agent
367
+
368
+ # Algorithm 2: Multi-Agent Probabilistic Recursive Reasoning $Q$ -Learning (PR2-Q).
369
+
370
+ x Result: Policy: $\pi ^ { i }$ , Opponent Recursive Reasoning: $\rho ^ { - i } ( a ^ { - i } | s , a ^ { i } )$ .
371
+
372
+ 2 Initialize $\mathcal { Q } ^ { i } ( s , a ^ { i } , a ^ { - i } )$ arbitrarily, set $\alpha$ ρas the learning rate, $\gamma$ ,as discount factor; , ,3 while not converge do
373
+
374
+ Given the current $s$ , calculate the opponent best response $\rho ^ { - i } ( a ^ { - i } | s , a ^ { i } )$ according to:
375
+
376
+ $$
377
+ \rho ^ { - i } ( a ^ { - i } | s , a ^ { i } ) = \frac { 1 } { Z } \exp ( { \cal Q } ^ { i } ( s , a ^ { i } , a ^ { - i } ) - { \cal Q } ^ { i } ( s , a ^ { i } ) )
378
+ $$
379
+
380
+ Select and sample action $a ^ { i }$ based on the Recursive Reasoning $\rho ^ { - i } ( a ^ { - i } | s , a ^ { i } )$ ;
381
+
382
+ $$
383
+ \mathrm { s o f t m a x } ( \int _ { a ^ { - i } } \rho ^ { - i } ( a ^ { - i } | s , a ^ { i } ) Q ^ { i } ( s , a ^ { i } , a ^ { - i } ) )
384
+ $$
385
+
386
+ Observing joint-action $( a ^ { i } , a ^ { - i } )$ , reward $r ^ { i }$ , and next state $s ^ { \prime }$ ;
387
+
388
+ $$
389
+ \begin{array} { c } { { Q ^ { i } ( s , a ^ { i } , a ^ { - i } ) \xleftarrow { } { } \textstyle \left( 1 - \alpha \right) Q ^ { i } ( s , a ^ { i } , a ^ { - i } ) + \alpha ( r ^ { i } + \gamma V ^ { i } ( s ^ { \prime } ) ) } } \\ { { Q ^ { i } ( s , a ^ { i } ) \xleftarrow { } { } \textstyle \left( 1 - \alpha \right) Q ^ { i } ( s , a ^ { i } ) + \alpha ( r ^ { i } + \gamma V ^ { i } ( s ^ { \prime } ) ) } } \end{array}
390
+ $$
391
+
392
+ where,
393
+
394
+ $$
395
+ V ^ { i } ( s ) = \operatorname* { m a x } _ { a ^ { i } } \int _ { a ^ { - i } } \rho ^ { - i } ( a ^ { - i } | s , a ^ { i } ) Q ^ { i } ( s , a ^ { i } , a ^ { - i } )
396
+ $$
397
+
398
+ 10 end
399
+
400
+ only needs to learn a joint action $Q$ -function, and if the game is static, our method would degenerate to Conditional Joint Action Learning (CJAL) (Banerjee & Sen, 2007).
401
+
402
+ B MULTI-AGENT POLICY GRADIENT
403
+
404
+ # B.1 MULTI-AGENT NON-CORRELATED POLICY GRADIENT
405
+
406
+ Since $\pi _ { \theta } \left( a ^ { i } , a ^ { - i } | s \right) = \pi _ { \theta ^ { i } } ^ { i } \left( a ^ { i } \right) \pi _ { \theta ^ { - i } } ^ { - i } \left( a ^ { - i } | , a ^ { i } \right) = \pi _ { \theta ^ { - i } } ^ { - i } \left( a ^ { - i } | s \right) \pi _ { \theta ^ { i } } ^ { i } \left( a ^ { i } | s , a ^ { - i } \right) , \pi _ { \theta } \left( a ^ { i } , a ^ { - i } | s \right) = \pi _ { \theta ^ { - i } } ^ { i } \left( a ^ { - i } | s \right) \pi _ { \theta ^ { i } } ^ { i } \left( a ^ { i } | s , a ^ { - i } \right) .$ can be πθ ,factorized as $\pi _ { \theta ^ { i } } ^ { i } ( a ^ { i } | s ) \pi _ { \theta ^ { - i } } ^ { - i } ( a ^ { - i } | s )$ if $a ^ { i }$ ,and $a ^ { - i }$ πθ πθ , πθ ,are non-correlated. We follow the policy gradient πθ πθformulation (Sutton et al., 2000; Wei et al., 2018) using Leibniz integral rule and Fubini’s theorem which can give us Multi-Agent Non-correlated Policy Gradient:
407
+
408
+ $$
409
+ \begin{array} { r l } & { \eta ^ { i } = \displaystyle \int _ { s } \int _ { a ^ { i } } \int _ { a ^ { - i } } \pi ( a ^ { i } , a ^ { - i } | s ) { \mathcal Q } ^ { i } ( s , a ^ { i } , a ^ { - i } ) \mathrm { d } a ^ { - i } \mathrm { d } a ^ { i } \mathrm { d } s } \\ & { \quad = \displaystyle \int _ { s } \int _ { a ^ { i } } \int _ { a ^ { - i } } \pi ^ { i } ( a ^ { i } | s ) \pi ^ { - i } ( a ^ { - i } | s ) { \mathcal Q } ^ { i } ( s , a ^ { i } , a ^ { - i } ) \mathrm { d } a ^ { - i } \mathrm { d } a ^ { i } \mathrm { d } s } \\ & { \quad = \displaystyle \int _ { s } \int _ { a ^ { i } } \pi ^ { i } ( a ^ { i } | s ) \int _ { a ^ { - i } } \pi ^ { - i } ( a ^ { - i } | s ) { \mathcal Q } ^ { i } ( s , a ^ { i } , a ^ { - i } ) \mathrm { d } a ^ { - i } \mathrm { d } a ^ { i } \mathrm { d } s . } \end{array}
410
+ $$
411
+
412
+ Suppose the $\pi ^ { i } ( a ^ { i } )$ is parameterized by $\theta ^ { i }$ , and we apply the gradient over the $\eta ^ { i }$ :
413
+
414
+ $$
415
+ \begin{array} { r l } & { \nabla _ { \theta ^ { i } } \eta ^ { i } = \displaystyle \int _ { s } \int _ { a ^ { i } } \nabla _ { \theta ^ { i } } \pi _ { \theta _ { i } } ^ { i } ( a ^ { i } | s ) \int _ { a ^ { - i } } \pi ^ { - i } ( a ^ { - i } | s ) Q ^ { i } ( s , a ^ { i } , a ^ { - i } ) \mathrm { d } a ^ { - i } \mathrm { d } a ^ { i } \mathrm { d } s } \\ & { \quad \quad \quad = \mathbb { E } _ { s \sim p , a ^ { i } \sim \pi ^ { i } } [ \nabla _ { \theta ^ { i } } \log \pi ^ { i } ( a ^ { i } | s ) \int _ { a ^ { - i } } \pi ^ { - i } ( a ^ { - i } | s ) Q ^ { i } ( s , a ^ { i } , a ^ { - i } ) \mathrm { d } a ^ { - i } ] . } \end{array}
416
+ $$
417
+
418
+ In practice, off-policy is more data-efficient. In MADDPG (Lowe et al., 2017) and COMA (Foerster et al., 2017), the replay buffer is introduced in a centralized deterministic actor-critic method for off-policy training. They apply batch sampling to the centralized critic which gives the joint-action $Q$ -values:
419
+
420
+ $$
421
+ \nabla _ { \theta ^ { i } } \eta ^ { i } = \mathbb { E } _ { s , a ^ { i } , a ^ { - i } \sim D } [ \nabla _ { \theta ^ { i } } \mu _ { \theta ^ { i } } ^ { i } ( a ^ { i } | s ) \nabla _ { a ^ { i } } Q ^ { i } ( s , a ^ { i } , a ^ { - i } ) | _ { a ^ { i } = \mu ^ { i } ( s ) } ] .
422
+ $$
423
+
424
+ # B.2 MULTI-AGENT RECURSIVE REASONING POLICY GRADIENT
425
+
426
+ Proposition 1. In a stochastic game, under the recursive reasoning framework defined by Eq. 3, the update rule for the multi-agent recursive reasoning policy gradient method can be devised as follows:
427
+
428
+ $$
429
+ \nabla _ { \theta ^ { i } } \eta ^ { i } = \mathbb { E } _ { s \sim p , a ^ { i } \sim \pi ^ { i } } \left[ \nabla _ { \theta ^ { i } } \log \pi _ { \theta ^ { i } } ^ { i } ( a ^ { i } | s ) \int _ { a ^ { - i } } \pi _ { \theta ^ { - i } } ^ { - i } ( a ^ { - i } | s , a ^ { i } ) Q ^ { i } ( s , a ^ { i } , a ^ { - i } ) \mathrm { d } a ^ { - i } \right] .
430
+ $$
431
+
432
+ Proof: As following.
433
+
434
+ If we apply the chain rule to factorize the joint policy to: $\pi _ { \theta } ( a ^ { i } , a ^ { - i } | s ) = \pi _ { \theta ^ { i } } ^ { i } ( a ^ { i } | s ) \pi _ { \theta ^ { - i } } ^ { - i } ( a ^ { - i } | s , a ^ { i } ) .$ πθ ,Then, we can have multi-agent recursive reasoning objective function as:
435
+
436
+ $$
437
+ \begin{array} { r l } & { \eta ^ { i } = \displaystyle \int _ { s } \int _ { a ^ { i } } \int _ { a ^ { - i } } \pi ( a ^ { i } , a ^ { - i } | s ) { \mathcal Q } ^ { i } ( a ^ { i } , a ^ { - i } ) \mathrm { d } a ^ { - i } \mathrm { d } a ^ { i } \mathrm { d } s } \\ & { \quad = \displaystyle \int _ { s } \int _ { a ^ { i } } \pi ^ { i } ( a ^ { i } | s ) \int _ { a ^ { - i } } \pi ^ { - i } ( a ^ { - i } | s , a ^ { i } ) { \mathcal Q } ^ { i } ( s , a ^ { i } , a ^ { - i } ) \mathrm { d } a ^ { - i } \mathrm { d } a ^ { i } \mathrm { d } s . } \end{array}
438
+ $$
439
+
440
+ Compare to Eq. 14, $a ^ { - i }$ in Eq. 18 is additionally conditioned on $a ^ { i }$ . We introduce agent $i ^ { \prime }$ a action $a ^ { i }$ into other agents’s policies, leading to $\pi ^ { - i } \dot { ( } a ^ { - i } | s , a ^ { i } )$ . We now compute the policy gradient π ,analytically. Following the single agent Policy Gradient Theorem with Leibniz integral rule and Fubini’s theorem, we get the multi-Agent Recursive Reasoning Policy Gradient:
441
+
442
+ $$
443
+ \nabla _ { \theta ^ { i } } \eta ^ { i } = \mathbb E _ { s \sim p , a ^ { i } \sim \pi ^ { i } } \big [ \nabla _ { \theta ^ { i } } \log \pi ^ { i } ( a ^ { i } | s ) \int _ { a ^ { - i } } \pi ^ { - i } ( a ^ { - i } | s , a ^ { i } ) Q ^ { i } ( s , a ^ { i } , a ^ { - i } ) \mathrm { d } a ^ { - i } \big ] .
444
+ $$
445
+
446
+ However, in practice, the agent may not get access to other agents’ policies. We need to infer the other agents’ policies. We let $\rho _ { \phi _ { - i } } ^ { - i } ( \stackrel { \bullet } { a } ^ { - i } | s , \stackrel { \smile } { a } ^ { i } )$ denotes the parameterized opponent conditional policy of agent $i$ φto approximate other agents policies, i.e, $\pi ^ { - i } ( a ^ { - i } | s , a ^ { i } )$ . Then we have Decentralized πMulti-Agent Recursive Reasoning Policy Gradient comes as:
447
+
448
+ $$
449
+ \begin{array} { r l } & { \nabla _ { \theta ^ { i } } \eta ^ { i } \approx \mathbb E _ { s \sim p , a ^ { i } \sim \pi ^ { i } } \bigl [ \nabla _ { \theta ^ { i } } \log \pi _ { \theta ^ { i } } ^ { i } \bigl ( a ^ { i } | s \bigr ) \int _ { a ^ { - i } } \rho _ { \phi _ { - i } } ^ { - i } \bigl ( a ^ { - i } | s , a ^ { i } \bigr ) Q ^ { i } ( s , a ^ { i } , a ^ { - i } ) \mathrm { d } a ^ { - i } \bigr ] } \\ & { \qquad = \mathbb E _ { s \sim p , a ^ { i } \sim \pi ^ { i } } \bigl [ \nabla _ { \theta ^ { i } } \log \pi _ { \theta ^ { i } } ^ { i } \bigl ( a ^ { i } | s \bigr ) Q _ { \rho _ { \theta _ { - i } } ^ { - i } } ^ { i } \bigr ( s , a ^ { i } \bigr ) \bigr ] . } \end{array}
450
+ $$
451
+
452
+ In Eq. 20, the gradient for agent $i$ is scaled by $\begin{array} { r } { Q _ { \rho _ { \phi _ { - i } } ^ { - i } } ^ { i } \left( s , a ^ { i } \right) = \int _ { a ^ { - i } } \rho _ { \phi _ { - i } } ^ { - i } ( a ^ { - i } | s , a ^ { i } ) Q ^ { i } ( s , a ^ { i } , a ^ { - i } ) \mathrm { d } a ^ { - i } . } \end{array}$ The trajectories generated by updated policy would help to train $\rho _ { \phi _ { - i } } ^ { - i } ( a ^ { - i } | s , a ^ { i } )$ and $\mathcal { Q } ^ { i } ( s , a ^ { i } , a ^ { - i } )$ . φThese steps form a Expectation-Maximization style learning procedures: first, fix $\rho _ { \phi _ { - i } } ^ { - i }$ and $\mathcal { Q } ^ { i } ( s , a ^ { i } , a ^ { - i } )$ to improve $\pi _ { \theta ^ { i } } ^ { i } ( a ^ { i } | s )$ ; then, improve $\rho _ { \phi _ { - i } } ^ { - i }$ and $\mathcal { Q } ^ { i } ( s , a ^ { i } , a ^ { - i } )$ φ by the trajectories generated by $\pi _ { \theta ^ { i } } ^ { i } ( a ^ { i } | s )$ θ φ. Furthermore, since PR2 method do not require opponents’ actual private policies, πθDecentralized Multi-Agent Recursive Reasoning Policy Gradient can be decoupled from other agents’ on-policies or target policies. In other words, the training can be conducted in an off-policy fashion by sampling mini-batches from the memory buffer $D$ with the help of the learned $\hat { \rho } _ { \phi _ { - i } } ^ { - i } ( \stackrel { . } { a } ^ { - i } | s , a ^ { i } )$ from $\mathcal { Q } ^ { i } ( s , a ^ { i } , a ^ { - i } )$ . 
453
+
454
+ C OPPONENT CONDITIONAL POLICY INFERENCE VIA OPTIMAL TRAJECTORY
455
+
456
+ Theorem 1. The optimal $Q$ -function for agent i that satisfies minimizing Eq. 10 is formulated as:
457
+
458
+ $$
459
+ Q _ { \pi _ { \theta } } ^ { i } ( s , a ^ { i } ) = \log \int _ { a ^ { - i } } \exp ( \boldsymbol { Q } _ { \pi _ { \theta } } ^ { i } ( s , a ^ { i } , a ^ { - i } ) ) \mathrm { d } a ^ { - i } .
460
+ $$
461
+
462
+ And the corresponding optimal opponent conditional policy reads:
463
+
464
+ $$
465
+ \rho _ { \phi ^ { - i } } ^ { - i } ( a ^ { - i } | s , a ^ { i } ) = { \frac { 1 } { Z } } \exp ( { \mathcal { Q } } _ { \pi _ { \theta } } ^ { i } ( s , a ^ { i } , a ^ { - i } ) - { \mathcal { Q } } _ { \pi _ { \theta } } ^ { i } ( s , a ^ { i } ) )
466
+ $$
467
+
468
+ Proof. As following.
469
+
470
+ Follow the proof in Levine (2018); Haarnoja et al. (2017), we first give the overall distribution by:
471
+
472
+ $$
473
+ p ( \tau ) = [ p ( s _ { 1 } ) \prod _ { t = 1 } ^ { T } p ( s _ { t + 1 } | s _ { t } , a _ { t } ^ { i } , a _ { t } ^ { - i } ) ] \exp ( \sum _ { t = 1 } ^ { T } r ^ { i } ( s _ { t } , a _ { t } , a _ { t } ^ { - i } ) ) .
474
+ $$
475
+
476
+ We can adopt an optimization-based approach to approximate the opponent conditional policy, in which case the goal is to fit an approximation $\pi ( a _ { t } ^ { i } , \tilde { a _ { t } ^ { - i } } | s _ { t } ) \approx \pi ^ { i } ( a _ { t } ^ { i } | \tilde { s _ { t } } ) \rho ^ { - i } ( a _ { t } ^ { - i } | s _ { t } , a _ { t } ^ { i } )$ such that the trajectory distribution,
477
+
478
+ $$
479
+ \hat { p } ( \tau ) = p ( s _ { 1 } ) \prod _ { t = 1 } ^ { T } p ( s _ { t + 1 } | s _ { t } , a _ { t } ^ { i } , a _ { t } ^ { - i } ) \pi _ { \theta ^ { i } } ^ { i } ( a _ { t } ^ { i } | s _ { t } ) \rho _ { \theta ^ { - i } } ^ { - i } ( a _ { t } ^ { - i } | s _ { t } , a _ { t } ^ { i } ) ,
480
+ $$
481
+
482
+ has high likelihood to be observed. In the case of exact inference, as derived in the previous section, $D _ { \mathrm { K L } } ( \bar { \hat { p } } ( \tau ) \lVert p ( \tau ) ) = 0$ . We can therefore view the inference process as minimizing the $K L$ -divergence:
483
+
484
+ $$
485
+ D _ { \mathrm { K L } } \big ( \hat { p } ( \tau ) \lVert p ( \tau ) \big ) = - \mathbb { E } _ { \tau \sim \hat { p } ( \tau ) } [ \log p ( \tau ) - \log \hat { p } ( \tau ) ] .
486
+ $$
487
+
488
+ Negating both sides and substituting, we get:
489
+
490
+ $$
491
+ \begin{array} { r l } { - D _ { \mathrm { K L } } ( \hat { \rho } ( \tau ) \| p ( \tau ) ) = } & { \mathbb { E } _ { \tau \sim \hat { \phi } ( \tau ) } \| \mathrm { B o g } ( p ( s _ { \tau } ) ) + \displaystyle \sum _ { t = 1 } ^ { T } ( \log p ( \hat { x } _ { t + 1 } | s _ { t } , a _ { t } , a _ { t } ^ { - t } ) + r ^ { t } ( s _ { t } , a _ { t } ^ { t } , a _ { t } ^ { - t } ) ) } \\ & { - \log p ( s _ { \tau } ) - \displaystyle \sum _ { t = 1 } ^ { T } ( \log p ( s _ { t + 1 } | s _ { t } , a _ { t } ^ { t } , a _ { t } ^ { - t } ) + \log \pi ( a _ { t } ^ { t } , a _ { t } ^ { - t } | s _ { t } ) ) \| } \\ & { - \displaystyle \sum _ { t = 1 } ^ { T } ( \log p ( s _ { t + 1 } | s _ { t } , a _ { t } ^ { t } , a _ { t } ^ { - t } ) + \log \pi ( a _ { t } ^ { t } , a _ { t } ^ { t } | s _ { t } ) ) } \\ & { = \mathbb { E } _ { \tau \sim \hat { \phi } ( \tau ) } \| \displaystyle \sum _ { t = 1 } ^ { T } r ^ { t } ( s _ { t } , a _ { t } ^ { t } , a _ { t } ^ { - t } ) - \log \pi ( a _ { t } ^ { t } , a _ { t } ^ { - t } | s _ { t } ) \| } \\ & { = \displaystyle \sum _ { t = 1 } ^ { T } \mathbb { E } _ { \tau \to t } \frac { 1 } { ( s _ { t } , a _ { t } ^ { t } , a _ { t } ^ { t - 1 } ) \sim \hat { \phi } ( s _ { t + 1 } , a _ { t } ^ { t - t } ) } \| r ^ { t } ( s _ { t } , a _ { t } ^ { t } , a _ { t } ^ { - t } ) - \log \pi ( a _ { t } ^ { t } , a _ { t } ^ { - t } | s _ { t } ) \| } \\ & - \displaystyle \sum _ { t = 1 } ^ { T } \mathbb { E } _ { \tau \to t } \frac { 1 } { ( s _ { t } , a _ { t } ^ { t } , a _ { t } ^ { t } , r ^ { t } ) \sim \hat { \phi } ( s _ { t + 1 } , a _ { t } ^ { t } , a _ { t } ^ { t - t } ) \| } \\ & - \displaystyle \sum _ { t = 1 } ^ { T } \mathbb { E } \end{array}
492
+ $$
493
+
494
+ where $\mathcal { H }$ is the entropy term. In the recursive case, we can rewrite the objective as follows:
495
+
496
+ $$
497
+ Q ^ { i } ( s , a ^ { i } ) = \log \int _ { a ^ { - i } } \exp ( Q ^ { i } ( s , a ^ { i } , a ^ { - i } ) ) \mathrm { d } a ^ { - i } .
498
+ $$
499
+
500
+ This corresponds to a standard bellman backup with a soft maximization for the value function. choosing optimal opponent recursive reasoning policy
501
+
502
+ $$
503
+ \rho ^ { - i } ( a ^ { - i } | s , a ^ { i } ) = \frac { 1 } { Z } \exp ( { \cal Q } ^ { i } ( s , a ^ { i } , a ^ { - i } ) - { \cal Q } ^ { i } ( s , a ^ { i } ) ) .
504
+ $$
505
+
506
+ Then we can have the objective function:
507
+
508
+ $$
509
+ \begin{array} { r l } & { J ^ { i } \big ( \phi ^ { - i } \big ) = \displaystyle \sum _ { t = 1 } ^ { T } \mathbb { E } _ { ( s _ { t } , a _ { t } ^ { i } , a _ { t } ^ { - i } ) \sim \hat { p } ( s _ { t } , a _ { t } ^ { i } , a _ { t } ^ { - i } ) } \big [ r ^ { i } ( s _ { t } , a _ { t } ^ { i } , a _ { t } ^ { - i } ) } \\ & { \qquad + \mathcal { H } \big ( \rho _ { \phi ^ { - i } } ^ { - i } ( a _ { t } ^ { - i } | s _ { t } , a _ { t } ^ { i } ) \big ) + \mathcal { H } \big ( \pi _ { \theta ^ { i } } ^ { i } ( a _ { t } ^ { i } | s _ { t } ) \big ) \big ] . } \end{array}
510
+ $$
511
+
512
+ Then the gradient is then given by:
513
+
514
+ $$
515
+ \begin{array} { r l } & { \nabla _ { \phi ^ { - i } } J ^ { i } ( \phi ^ { - i } ) = \displaystyle \sum _ { t = 1 } ^ { T } \mathbb { E } _ { ( s _ { t } , a _ { t } ^ { i } , a _ { t } ^ { - i } ) \sim p ( s _ { t } , a _ { t } ^ { i } , a _ { t } ^ { - i } ) } [ \nabla _ { \phi ^ { - i } } \log \rho _ { \phi ^ { - i } } ^ { - i } ( a _ { t } ^ { - i } | s _ { t } , a _ { t } ^ { i } ) ( \displaystyle \sum _ { t ^ { \prime } = t } ^ { T } r ^ { i } ( s _ { t ^ { \prime } } , a _ { t ^ { \prime } } ^ { i } , a _ { t ^ { \prime } } ^ { - i } ) ] } \\ & { \qquad + \nabla _ { \phi ^ { - i } } \displaystyle \sum _ { t = 1 } ^ { T } \mathbb { E } _ { ( s _ { t } , a _ { t } ^ { i } , a _ { t } ^ { - i } ) \sim p ( s _ { t } , a _ { t } ^ { i } , a _ { t } ^ { - i } ) } [ \mathcal { H } ( \rho _ { \phi ^ { - i } } ^ { - i } ( a _ { t } ^ { - i } | s _ { t } , a _ { t } ^ { i } ) ) + \mathcal { H } ( \pi _ { \theta ^ { i } } ^ { i } ( a _ { t } ^ { i } | s _ { t } ) ) ] . } \end{array}
516
+ $$
517
+
518
+ The gradient of the entropy terms is given by:
519
+
520
+ $$
521
+ \begin{array} { r l } & { \nabla _ { \phi ^ { - i } } \mathcal { H } ( \rho _ { \phi ^ { - i } } ^ { - i } ) = - \nabla _ { \phi } \mathbb { E } _ { ( s _ { t } , a _ { t } ^ { i } ) \sim p ( s _ { t } , a _ { t } ^ { i } , a _ { t } ^ { - i } ) } [ \mathbb { E } _ { a _ { t } ^ { - i } \sim \rho _ { \phi ^ { - i } } ^ { - i } ( a _ { t } ^ { - i } \mid s _ { t } , a _ { t } ^ { i } ) } [ \log \rho _ { \phi ^ { - i } } ^ { - i } ( a _ { t } ^ { - i } | s _ { t } , a _ { t } ^ { i } ) ] ] } \\ & { \qquad = - \mathbb { E } _ { ( s _ { t } , a _ { t } ^ { i } , a _ { t } ^ { - i } ) \sim p ( s _ { t } , a _ { t } ^ { i } , a _ { t } ^ { - i } ) } [ \nabla _ { \phi } \log \rho _ { \phi ^ { - i } } ^ { - i } ( a _ { t } ^ { - i } | s _ { t } , a _ { t } ^ { i } ) ( 1 + \log \rho _ { \phi ^ { - i } } ^ { - i } ( a _ { t } ^ { - i } | s _ { t } , a _ { t } ^ { i } ) ] . } \end{array}
522
+ $$
523
+
524
+ We can do the same for $\nabla _ { \phi ^ { - i } } \mathcal { H } ( \pi _ { \theta ^ { i } } ^ { i } )$ , and substitute these back we have:
525
+
526
+ $$
527
+ \begin{array} { r l r } & { } & { \nabla _ { \phi ^ { - i } } J ^ { i } \big ( \phi ^ { - i } \big ) = \displaystyle \sum _ { t = 1 } ^ { T } \mathbb { E } _ { ( s _ { t } , a _ { t } ^ { i } , a _ { t } ^ { - i } ) \sim p ( s _ { t } , a _ { t } ^ { i } , a _ { t } ^ { - i } ) } [ \nabla _ { \phi ^ { - i } } \log \rho _ { \phi ^ { - i } } ^ { - i } ( a _ { t } ^ { - i } | s _ { t } , a _ { t } ^ { i } ) } \\ & { } & { \displaystyle ( \sum _ { t ^ { \prime } = t } ^ { T } r ^ { i } \big ( s _ { t ^ { \prime } } , a _ { t ^ { \prime } } ^ { i } , a _ { t ^ { \prime } } ^ { - i } \big ) - \log \rho _ { \phi ^ { - i } } ^ { - i } ( a _ { t ^ { \prime } } ^ { - i } | s _ { t } , a _ { t ^ { \prime } } ^ { i } ) - \log \pi _ { \theta ^ { i } } ^ { i } ( a _ { t } ^ { i } | s _ { t } ) - 1 ) ] . } \end{array}
528
+ $$
529
+
530
+ The $- 1$ comes from the derivative of the entropy terms, and replacing $- 1$ with a state and self-action dependent baseline $b ( s _ { t ^ { \prime } } , a _ { t ^ { \prime } } ^ { i } )$ we can obtain the approximated gradient for $\phi$ :
531
+
532
+ $$
533
+ \begin{array} { r l } & { \begin{array} { r l } & { c _ { \nu , k } ^ { \prime \prime } ( s ^ { - 1 } ) = \displaystyle \sum _ { i = 1 } ^ { N } \mathbb { E } _ { \nu \leq i \leq j \leq j \leq N < 0 , \nu \leq i \leq i \leq 2 , j \geq 1 } \mathbb { E } _ { \nu \leq i \leq j \leq i \leq \nu } \mathbb { E } _ { \nu \leq i \leq i \leq \nu } \mathbb { E } _ { \nu \leq i \leq i \leq \nu } \mathbb { E } _ { \nu \leq i \leq i \leq \nu } \mathbb { E } _ { \nu \leq i \leq i \leq \nu } \mathbb { E } _ { \nu \leq i \leq \nu } } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \quad \quad \quad \quad \quad \quad \quad \quad } \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \\ & & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \\ & & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & & \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \end{array} \end{array}
534
+ $$
535
+
536
+ $$
537
+ \begin{array} { r l r } { = \sum _ { t = 1 } ^ { T } \mathbb { E } _ { ( s _ { t } , a _ { t } ^ { i } , a _ { t } ^ { - i } ) \sim p ( s _ { t } , a _ { t } ^ { i } , a _ { t } ^ { - i } ) } [ ( \nabla _ { \phi ^ { - i } } \mathcal { Q } _ { t } ^ { i } ( s _ { t } , a _ { t } ^ { i } , a _ { t } ^ { - i } ) - \nabla _ { \phi ^ { - i } } \mathcal { Q } _ { t } ^ { i } ( s _ { t } , a _ { t } ^ { i } ) ) } \\ & { } & { ( \hat { \mathcal { Q } } _ { t } ^ { i } ( s _ { t } , a _ { t } ^ { i } , a _ { t } ^ { - i } ) - \mathcal { Q } _ { t } ^ { i } ( s _ { t } , a _ { t } ^ { i } , a _ { t } ^ { - i } ) ) ] , } \end{array}
538
+ $$
539
+
540
+ where $\hat { Q } _ { t } ^ { i } \big ( s _ { t } , a _ { t } ^ { i } , a _ { t } ^ { - i } \big )$ is is an empirical estimate of the $Q$ -value of the policy. 
541
+
542
+ D SOFT BELLMAN EQUATION AND SOFT VALUE ITERATION
543
+
544
+ Theorem 2. In a symmetric game with only one equilibrium, and the equilibrium meets one of the conditions: 1) the global optimum, i.e. $\mathbb { E } _ { \pi _ { * } } \left[ \hat { \boldsymbol { Q } } _ { t } ^ { i } ( s ) \right] \geq \mathbb { E } _ { \pi } \left[ \boldsymbol { Q } _ { t } ^ { i } ( s ) \right] ; 2 )$ a saddle point, i.e.
545
+
546
+ $\mathbb { E } _ { \pi _ { * } } \left[ \boldsymbol { Q } _ { t } ^ { i } ( s ) \right] \geq \mathbb { E } _ { \pi ^ { i } } \mathbb { E } _ { \pi _ { * } ^ { - i } } \left[ \boldsymbol { Q } _ { t } ^ { i } ( s ) \right]$ or $\mathbb { E } _ { \pi _ { * } }$ $\tau _ { * } \left[ Q _ { t } ^ { i } ( s ) \right] \ \geq \ \mathbb { E } _ { \pi _ { * } ^ { i } } \mathbb { E } _ { \pi ^ { - i } } \left[ Q _ { t } ^ { i } ( s ) \right]$ ; where $Q _ { * }$ and $\pi _ { * }$ are the π π π π π π πequilibrium value function and policy, respectively. The PR2 soft value iteration operator defined by:
547
+
548
+ $$
549
+ \mathcal { T Q } ^ { i } ( s , a ^ { i } , a ^ { - i } ) \triangleq r ^ { i } ( s , a ^ { i } , a ^ { - i } ) + \gamma \mathbb { E } _ { s ^ { \prime } , a ^ { i \prime } \sim p _ { s } , \pi ^ { i } } \left[ \log \int _ { a ^ { - i \prime } } \exp ( \mathcal { Q } ^ { i } ( s ^ { \prime } , a ^ { i \prime } , a ^ { - i \prime } ) ) \mathrm { d } a ^ { - i \prime } \right] ,
550
+ $$
551
+
552
+ is a contraction mapping.
553
+
554
+ Proof. As following:
555
+
556
+ Based on Eq. 11 & 12 in Theorem 1, we can have the PR2 soft value iteration rules shown as:
557
+
558
+ $$
559
+ \begin{array} { r l } & { \textstyle \int _ { \pi } ^ { i } ( s , a ^ { i } , a ^ { - i } ) = r ^ { i } ( s , a ^ { i } , a ^ { - i } ) + \gamma \mathbb { E } _ { s ^ { \prime } \sim p _ { s } } [ \mathcal { H } ( \pi ^ { i } ( a ^ { i } \vert s ) \pi ^ { - i } ( a ^ { - i } \vert s , a ^ { i } ) ) + \mathbb { E } _ { a ^ { - i \prime } \sim \pi ^ { - i } ( \cdot \vert s ^ { \prime } , a ^ { i \prime } ) } \big [ Q _ { \pi } ^ { i } ( s ^ { \prime } , a ^ { i \prime } , a } \\ & { \textstyle \qquad = r ^ { i } ( s , a ^ { i } , a ^ { - i } ) + \gamma \mathbb { E } _ { s ^ { \prime } \sim p _ { s } } [ Q _ { \pi } ^ { i } ( s ^ { \prime } , a ^ { i \prime } ) ] . } \end{array}
560
+ $$
561
+
562
+ Correspondingly, we define the soft value iteration operator $\mathcal { T }$ :
563
+
564
+ $$
565
+ \mathcal { T Q } ^ { i } ( s , a ^ { i } , a ^ { - i } ) \triangleq r ^ { i } ( s , a ^ { i } , a ^ { - i } ) + \gamma \mathbb { E } _ { s ^ { \prime } , a ^ { i \prime } \sim p _ { s } , \pi ^ { i } } \left[ \log \int _ { a ^ { - i \prime } } \exp ( \mathcal { Q } ^ { i } ( s ^ { \prime } , a ^ { i \prime } , a ^ { - i \prime } ) ) \mathrm { d } a ^ { - i \prime } \right] .
566
+ $$
567
+
568
+ In a symmetric game with either one global equilibrium or saddle equilibrium, it has been shown by Yang et al. (2018) (see condition $1 \& 2$ in Theorem 1) that the payoff at the equilibrium point is unique. This validates applying the similar idea in proving the contraction mapping of soft-value iteration operator in the single agent case (see Lemma 1 in Fox et al. (2016)). We include it here to stay self-contained.
569
+
570
+ We first define a norm on $Q$ -values as $\begin{array} { r } { \| Q _ { 1 } ^ { i } - Q _ { 2 } ^ { i } \| \triangleq \operatorname* { m a x } _ { s , a ^ { i } , a ^ { - i } } | Q _ { 1 } ^ { i } ( s , a ^ { i } , a ^ { - i } ) - Q _ { 2 } ^ { i } ( s , a ^ { i } , a ^ { - i } ) | . } \end{array}$ Suppose $\varepsilon = \lVert Q _ { 1 } ^ { i } - Q _ { 2 } ^ { i } \rVert$ , then
571
+
572
+ $$
573
+ \begin{array} { l } { \log \displaystyle \int _ { a ^ { - i \prime } } \exp ( Q _ { 1 } ^ { i } ( s ^ { \prime } , a ^ { i \prime } , a ^ { - i \prime } ) ) \mathrm { d } a ^ { - i \prime } \leq \log \displaystyle \int _ { a ^ { - i \prime } } \exp ( Q _ { 2 } ^ { i } ( s ^ { \prime } , a ^ { i \prime } , a ^ { - i \prime } ) + \varepsilon ) \mathrm { d } a ^ { - i \prime } } \\ { = \log \displaystyle \int _ { a ^ { - i \prime } } \exp ( \varepsilon ) \exp ( Q _ { 2 } ^ { i } ( s ^ { \prime } , a ^ { i \prime } , a ^ { - i \prime } ) ) \mathrm { d } a ^ { - i \prime } } \\ { = \varepsilon + \log \displaystyle \int _ { a ^ { - i \prime } } \exp ( Q _ { 2 } ^ { i } ( s ^ { \prime } , a ^ { i \prime } , a ^ { - i \prime } ) ) \mathrm { d } a ^ { - i \prime } } \end{array}
574
+ $$
575
+
576
+ Similarly, $\begin{array} { r } { \log \int _ { a ^ { - i \prime } } \exp \bigl ( Q _ { 1 } ^ { i } \bigl ( s ^ { \prime } , a ^ { i \prime } , a ^ { - i \prime } \bigr ) \bigr ) \mathrm { d } a ^ { - i \prime } \leq - \varepsilon + \log \int _ { a ^ { - i \prime } } \exp \bigl ( Q _ { 2 } ^ { i } \bigl ( s ^ { \prime } , a ^ { i \prime } , a ^ { - i \prime } \bigr ) \bigr ) \mathrm { d } a ^ { - i \prime } } \end{array}$ . Therefore $\lVert \mathcal { I } Q _ { 1 } ^ { i } - \mathcal { T } Q _ { 2 } ^ { i } \rVert \leq \gamma \varepsilon = \gamma \lVert Q _ { 1 } ^ { i } - Q _ { 2 } ^ { i } \rVert$ . 
md/train/ryH20GbRW/ryH20GbRW.md ADDED
@@ -0,0 +1,350 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # RELATIONAL NEURAL EXPECTATION MAXIMIZATION: UNSUPERVISED DISCOVERY OF OBJECTS AND THEIR INTERACTIONS
2
+
3
+ Sjoerd van Steenkiste Swiss AI Lab IDSIA, SUPSI, USI Lugano, Switzerland sjoerd@idsia.ch
4
+
5
+ Michael Chang
6
+ UC Berkeley
7
+ Berkeley, United States
8
+ mbchang@berkeley.edu
9
+ Klaus Greff
10
+ Swiss AI Lab IDSIA, SUPSI, USI
11
+ Lugano, Switzerland
12
+ klaus@idsia.ch
13
+
14
+ Jürgen Schmidhuber Swiss AI Lab IDSIA, SUPSI, USI Lugano, Switzerland juergen@idsia.ch
15
+
16
+ # ABSTRACT
17
+
18
+ Common-sense physical reasoning is an essential ingredient for any intelligent agent operating in the real-world. For example, it can be used to simulate the environment, or to infer the state of parts of the world that are currently unobserved. In order to match real-world conditions this causal knowledge must be learned without access to supervised data. To address this problem we present a novel method that learns to discover objects and model their physical interactions from raw visual images in a purely unsupervised fashion. It incorporates prior knowledge about the compositional nature of human perception to factor interactions between object-pairs and learn efficiently. On videos of bouncing balls we show the superior modelling capabilities of our method compared to other unsupervised neural approaches that do not incorporate such prior knowledge. We demonstrate its ability to handle occlusion and show that it can extrapolate learned knowledge to scenes with different numbers of objects.
19
+
20
+ # 1 INTRODUCTION
21
+
22
+ Humans rely on common-sense physical reasoning to solve many everyday physics-related tasks (Lake et al., 2016). For example, it enables them to foresee the consequences of their actions (simulation), or to infer the state of parts of the world that are currently unobserved. This causal understanding is an essential ingredient for any intelligent agent that is to operate within the world.
23
+
24
+ Common-sense physical reasoning is facilitated by the discovery and representation of objects (a core domain of human cognition (Spelke & Kinzler, 2007)) that serve as primitives of a compositional system. They allow humans to decompose a complex visual scene into distinct parts, describe relations between them and reason about their dynamics as well as the consequences of their interactions (Battaglia et al., 2013; Lake et al., 2016; Ullman et al., 2017).
25
+
26
+ The most successful machine learning approaches to common-sense physical reasoning incorporate such prior knowledge in their design. They maintain explicit object representations, which allow for general physical dynamics to be learned between object pairs in a compositional manner (Battaglia et al., 2016; Chang et al., 2016; Watters et al., 2017). However, in these approaches learning is supervised, as it relies on object-representations from external sources (e.g. a physics simulator) that are typically unavailable in real-world scenarios.
27
+
28
+ Neural approaches that learn to directly model motion or physical interactions in pixel space offer an alternative solution (Srivastava et al., 2015; Sutskever et al., 2009). However, while unsupervised, these methods suffer from a lack compositionality at the representational level of objects. This prevents such end-to-end neural approaches from efficiently learning functions that operate on multiple entities and generalize in a human-like way (c.f. Battaglia et al. (2013); Lake et al. (2016); Santoro et al. (2017), but see Perez et al. (2017)).
29
+
30
+ In this work we propose Relational N-EM (R-NEM), a novel approach to common-sense physical reasoning that learns physical interactions between objects from raw visual images in a purely unsupervised fashion. At its core is Neural Expectation Maximization (N-EM; Greff et al., 2017), a method that allows for the discovery of compositional object-representations, yet is unable to model interactions between objects. Therefore, we endow N-EM with a relational mechanism inspired by previous work (Battaglia et al., 2016; Chang et al., 2016; Santoro et al., 2017), enabling it to factor interactions between object-pairs, learn efficiently, and generalize to visual scenes with a varying number of objects without re-training.
31
+
32
+ # 2 METHOD
33
+
34
+ Our goal is to learn common-sense physical reasoning in a purely unsupervised fashion directly from visual observations. We have argued that in order to solve this problem we need to exploit the compositional structure of a visual scene. Conventional unsupervised representation learning approaches (eg. VAEs Kingma & Welling (2013); GANs Goodfellow et al. (2014)) learn a single distributed representation that superimposes information about the input, without imposing any structure regarding objects or other low-level primitives. These monolithic representations can not factorize physical interactions between pairs of objects and therefore lack an essential inductive bias to learn these efficiently. Hence, we require an alternative approach that can discover objects representations as primitives of a visual scene in an unsupervised fashion.
35
+
36
+ One such approach is Neural Expectation Maximization (N-EM; Greff et al. (2017)), which learns a separate distributed representation for each object described in terms of the same features through an iterative process of perceptual grouping and representation learning. The compositional nature of these representations enable us to formulate Relational N-EM (R-NEM): a novel unsupervised approach to common-sense physical reasoning that combines N-EM (Section 2.1) with an interaction function that models relations between objects efficiently (Section 2.2).
37
+
38
+ # 2.1 NEURAL EXPECTATION MAXIMIZATION
39
+
40
+ Neural Expectation Maximization (N-EM; Greff et al. (2017)) is a differentiable clustering method that learns a representation of a visual scene composed of primitive object representations. These representations adhere to many useful properties of a symbolic representation of objects, and can therefore be used as primitives of a compositional system (Hummel et al., 2004). They are described in the same format and each contain only information about the object in the visual scene that they correspond to. Together, they form a representation of a visual scene composed of objects that is learned in an unsupervised way, which therefore serves as a starting point for our approach.
41
+
42
+ The goal of N-EM is to group pixels in the input that belong to the same object (perceptual grouping) and capture this information efficiently in a distributed representation $\pmb { \theta } _ { k }$ for each object. At a high-level, the idea is that if we were to have access to the family of distributions $\bar { P } ( \boldsymbol { x } | \boldsymbol { \theta } _ { k } )$ (a statistical model of images given object representations $\theta _ { k }$ ) then we can formalize our objective as inference in a mixture of these distributions. By using Expectation Maximization (EM; Dempster et al., 1977) to compute a Maximum Likelihood Estimate (MLE) of the parameters of this mixture $( \pmb \theta _ { 1 } , \dots , \pmb \theta _ { K } )$ , we obtain a grouping (clustering) of the pixels to each object (component) and their corresponding representation. In reality we do not have access to $P ( \pmb { x } | \pmb { \theta } _ { k } )$ , which N-EM learns instead by parameterizing the mixture with a neural network and back-propagating through the iterations of the unrolled generalized EM procedure.
43
+
44
+ Following Greff et al. (2017), we model each image $\pmb { x } \in \mathbb { R } ^ { D }$ as a spatial mixture of $K$ components parameterized by vectors $\pmb { \theta } _ { 1 } , \dots , \pmb { \theta } _ { K } \in \mathbb { R } ^ { M }$ . A neural network $f _ { \phi }$ is used to transform these representations $\pmb { \theta } _ { k }$ into parameters $\psi _ { i , k } = f _ { \phi } ( \pmb { \theta } _ { k } ) _ { i }$ for separate pixel-wise distributions. A set of binary latent variables $\mathcal { Z } \in [ 0 , 1 ] ^ { D \times K }$ encodes the unknown true pixel assignments, such that $z _ { i , k } = 1$ iff pixel $i$ was generated by component $k$ . The full likelihood for $_ { \textbf { \em x } }$ given $\pmb \theta = ( \pmb \theta _ { 1 } , \dots , \pmb \theta _ { K } )$
45
+
46
+ ![](images/9a3fcaea80c1a330b3ce6569723944bda2b34e3ea7c2c9ae8bec8cbb1fe41915.jpg)
47
+ Figure 1: Illustration of the different computational aspects of R-NEM when applied to a sequence of images of bouncing balls. Note that $\gamma , \psi$ at the Representations level correspond to the $\gamma$ ( $E$ -step), $\psi$ (Group Reconstructions) from the previous time-step. Different colors correspond to different cluster components (object representations).The right side shows a computational overview of $\mathrm { \Upsilon ^ { \mathrm { R - N E M } } }$ , a function that computes the pair-wise interactions between the object representations.
48
+
49
+ is given by:
50
+
51
+ $$
52
+ P ( \mathbf { x } | \theta ) = \prod _ { i = 1 } ^ { D } \sum _ { z _ { i } } P ( x _ { i } , z _ { i } | \psi _ { i } ) = \prod _ { i = 1 } ^ { D } \sum _ { k = 1 } ^ { K } P ( z _ { i , k } = 1 ) P ( x _ { i } | \psi _ { i , k } , z _ { i , k } = 1 ) .
53
+ $$
54
+
55
+ If $f _ { \phi }$ has learned a statistical model of images given object representations $\pmb { \theta } _ { k }$ , then we can compute the object representations for a given image $_ { \textbf { \em x } }$ by maximizing $P ( { \pmb x } | \pmb \theta )$ . Marginalization over $_ { z }$ complicates this process, thus we use generalized EM to maximize the following lowerbound instead:
56
+
57
+ $$
58
+ \mathcal { Q } ( \pmb { \theta } , \pmb { \theta } ^ { \mathrm { o l d } } ) = \sum _ { \mathbf { z } } P ( \mathbf { z } | \pmb { x } , \psi ^ { \mathrm { o l d } } ) \log P ( \pmb { x } , \mathbf { z } | \psi ) .
59
+ $$
60
+
61
+ Each iteration of generalized EM consists of two steps: the $E$ -step computes a new estimate of the posterior probability distribution over the latent variables $\gamma _ { i , k } : = P ( z _ { i , k } = 1 | x _ { i } , \psi _ { i } ^ { \mathrm { o l d } } )$ given $\pmb { \theta } ^ { \mathrm { o l d } }$ from the previous iteration. It yields a new soft-assignment of the pixels to the components (clusters), based on how accurately they model $_ { \textbf { \em x } }$ . The generalized $M .$ -step updates $\pmb { \theta } ^ { \mathrm { o l d } }$ by taking a gradient ascent step on (2), using the previously computed soft-assignments: $\pmb { \theta } _ { k } ^ { \mathrm { n e w } } = \pmb { \theta } _ { k } ^ { \mathrm { o l d } } + \eta \cdot \bar { \partial \mathcal { Q } } / \bar { \partial } \pmb { \theta } _ { k }$ .1
62
+
63
+ The unrolled computational graph of the generalized EM steps is differentiable, which provides a means to train $f _ { \phi }$ to implement a statistical model of images given object representations. Using back-propagation through time (eg. Werbos (1988); Williams (1989)) we train $f _ { \phi }$ to minimize the following loss:
64
+
65
+ $$
66
+ L ( \pmb { x } ) = - \sum _ { i = 1 } ^ { D } \sum _ { k = 1 } ^ { K } \underbrace { \gamma _ { i , k } \log P ( x _ { i } , z _ { i , k } | \psi _ { i , k } ) } _ { \mathrm { i n t r a - l u s t e r ~ l o s s } } - \underbrace { ( 1 - \gamma _ { i , k } ) D _ { K L } [ P ( x _ { i } ) | | P ( x _ { i } | \psi _ { i , k } , z _ { i , k } ) ] } _ { \mathrm { i n t e r - c l u s t e r ~ l o s s } } .
67
+ $$
68
+
69
+ The intra-cluster term is identical to (2), which credits each component for accurately representing pixels that have been assigned to it. The inter-cluster term ensures that each representation only captures the information about the pixels that have been assigned to it.
70
+
71
+ A more powerful variant of N-EM can be obtained (RNN-EM) by substituting the generalized M-step with a recurrent neural network having hidden state $\pmb { \theta } _ { k }$ . In this case, the entirety of $f _ { \phi }$ consists of a recurrent encoder-decoder architecture that receives $\gamma _ { k } ( \pmb { x } - \pmb { \psi } _ { k } )$ as input at each step.
72
+
73
+ The learning objective in (3) is prone to trivial solutions in case of overcapacity, which could prevent the network from modelling the statistical regularities in the data that correspond to objects. By adding noise to the input image or reducing $\pmb \theta$ in dimensionality we can guide learning to avert this. Moreover, in the case of RNN-EM one can evaluate (3) at the following time-step (predictive coding) to encourage learning of object representations and their corresponding dynamics. One intuitive interpretation of using denoising or next-step prediction as part of the training objective is to guide the network to learn about essential properties of objects, in this case those that correspond to the Gestalt Principles of prägnanz and common fate (Hatfield & Epstein, 1985).
74
+
75
+ # 2.2 RELATIONAL NEURAL EXPECTATION MAXIMIZATION
76
+
77
+ RNN-EM (unlike N-EM) is able to capture the dynamics of individual objects through a parametrized recurrent connection that operates on the object representation $\theta _ { k }$ across consecutive time-steps. However, the relations and interactions that take place between objects can not be captured in this way. In order to overcome this shortcoming we propose Relational $N .$ -EM (R-NEM), which adds relational structure to the recurrence to model interactions between objects without violating key properties of the learned object representations.
78
+
79
+ Consider a generalized form of the standard RNN-EM dynamics equation, which computes the object representation $\pmb { \theta } _ { k }$ at time $t$ as a function of all object representations $\pmb \theta : = [ \pmb \theta _ { 1 } , \dots , \pmb \theta _ { K } ]$ at the previous time-step through an interaction function $\Upsilon$ :
80
+
81
+ $$
82
+ \pmb { \theta } _ { k } ^ { ( t ) } = \mathrm { R N N } ( \tilde { \pmb { x } } ^ { ( t ) } , \Upsilon _ { k } ( \pmb { \theta } ^ { ( t - 1 ) } ) ) : = \sigma ( \pmb { W } \cdot \tilde { \pmb { x } } ^ { ( t ) } + \pmb { R } \cdot \Upsilon _ { k } ( \pmb { \theta } ^ { ( t - 1 ) } ) ) .
83
+ $$
84
+
85
+ Here $W , R$ are weight matrices, $\sigma$ is the sigmoid activation function, and $\tilde { \mathbf { \mathbf { x } } } ^ { ( t ) }$ is the input to the recurrent model at time $t$ (possibly transformed by an encoder). When $\Upsilon _ { k } ^ { \mathrm { R N N - E M } } ( \pmb { \theta } ) : = \pmb { \theta } _ { k }$ , this dynamics model coincides with a standard RNN update rule, thereby recovering the original RNN-EM formulation.
86
+
87
+ The inductive bias incorporated in $\Upsilon$ reflects the modeling assumptions about the interactions between objects in the environment, and therefore the nature of $\pmb { \theta } _ { k }$ ’s interdependence. If $\Upsilon$ incorporates the assumption that no interaction takes place between objects, then the $\pmb { \theta } _ { k }$ ’s are fully independent and we recover $\Upsilon ^ { \mathrm { R N N - E M } }$ . On the other hand, if we do assume that interactions among objects take place, but assume very little about the structure of the interdependence between the $\pmb { \theta } _ { k }$ ’s, then we forfeit useful properties of $\pmb { \theta } _ { k }$ such as compositionality. For example, if $\Upsilon : = \mathrm { M L P } ( \theta )$ we can no longer extrapolate learned knowledge to environments with more or fewer than $K$ objects and lose overall data efficiency (Santoro et al., 2017). Instead, we can make efficient use of compositionality among the learned object representations $\theta _ { k }$ to incorporate general but guiding constraints on how these may influence one another (Battaglia et al., 2016; Chang et al., 2016). In doing so we constrain $\Upsilon$ to capture interdependence between $\pmb { \theta } _ { k }$ ’s in a compositional manner that enables physical dynamics to be learned efficiently, and allow for learned dynamics to be extrapolated to a variable number of objects.
88
+
89
+ We propose a parametrized interaction function $\mathrm { \Upsilon ^ { \mathrm { R - N E M } } }$ that incorporates these modeling assumptions and updates $\pmb { \theta } _ { k }$ based on the pairwise effects of the objects $i \neq k$ on $k$ :
90
+
91
+ $$
92
+ \begin{array} { l } { { \Upsilon _ { k } ^ { \mathrm { R - N E M } } ( \theta ) = [ \hat { \theta } _ { k } ; E _ { k } ] \mathrm { w i t h } \hat { \theta } _ { k } = \mathrm { M L P } ^ { e n c } ( \theta _ { k } ) , E _ { k } = \displaystyle \sum _ { i \neq k } \alpha _ { k , i } \cdot e _ { k , i } } } \\ { { \alpha _ { k , i } = \mathrm { M L P } ^ { a t t } ( \xi _ { k , i } ) , e _ { k , i } = \mathrm { M L P } ^ { e f f } ( \xi _ { k , i } ) , \xi _ { k , i } = \mathrm { M L P } ^ { e m b } ( [ \hat { \theta } _ { k } ; \hat { \theta } _ { i } ] ) } } \end{array}
93
+ $$
94
+
95
+ where $[ \cdot ; \cdot ]$ is the concatenation operator and $\mathbf { M L P ^ { ( \cdot ) } }$ corresponds to a multi-layer perceptron. First, each $\theta _ { i }$ is transformed using ${ \bf M L P } ^ { e n c }$ to obtain $\hat { \theta } _ { i }$ , which enables information that is relevant for the object dynamics to be made more explicit in the representation. Next, each pair $( \hat { \theta } _ { k } , \hat { \theta } _ { i } )$ is concatenated and processed by ${ \bf M L P } ^ { e m b }$ , which computes a shared embedding $\xi _ { k , i }$ that encodes the interaction between object $k$ and object $i$ . Notice that we opt for a clear separation between the focus object $k$ and the context object $i$ as in previous work (Chang et al., 2016). From $\xi _ { k , i }$ we compute ${ e } _ { k , i }$ : the effect of object $i$ on object $k$ ; and an attention coefficient $\alpha _ { k , i }$ that encodes whether interaction between object $i$ and object $k$ takes place. These attention coefficients (Bahdanau et al., 2014; Xu et al., 2015) help to select relevant context objects, and can be seen as a more flexible unsupervised replacement of the distance based heuristic that was used in previous work (Chang et al., 2016). Finally, we compute the total effect of $\theta _ { i \neq k }$ on $\pmb { \theta } _ { k }$ as a weighted sum of the effects multiplied by their attention coefficient. A visual overview of $\mathrm { \Upsilon ^ { \mathrm { R - N E M } } }$ can be seen on the right side of Figure 1.
96
+
97
+ # 3 RELATED WORK
98
+
99
+ Machine learning approaches to common-sense physical reasoning can roughly be divided in two groups: symbolic approaches and approaches that perform state-to-state prediction. The former group performs inference over the parameters of a symbolic physics engine (Battaglia et al., 2013; Ullman et al., 2017; Wu et al., 2015), which restricts them to synthetic environments. The latter group employs machine learning methods to make state-to-state predictions, often describing the state of a system as a set of compact object-descriptions that are either used as an input to the system (Battaglia et al., 2016; Chang et al., 2016; Fragkiadaki et al., 2015; Grzeszczuk et al., 1998) or for training purposes (Watters et al., 2017). By incorporating information (eg. position, velocity) about objects these methods have achieved excellent generalization and simulation capabilities. Purely unsupervised approaches for state-to-state prediction (Agrawal et al., 2016; Lerer et al., 2016; Michalski et al., 2014; Sutskever et al., 2009) that use raw visual inputs as state-descriptions have yet to rival these capabilities. Our method is a purely unsupervised state-to-state prediction method that operates in pixel space, taking a first step towards unsupervised learning of common-sense reasoning in real-world environments.
100
+
101
+ The proposed interaction function $\mathrm { \Upsilon ^ { \mathrm { { K } - N E M } } }$ can be seen as a type of Message Passing Neural Network (MPNN; Gilmer et al. (2017)) that incorporates a variant of neighborhood attention (Duan et al., 2017). In light of other recent work (Zaheer et al., 2017) it can be seen as a permutation equivariant set function.
102
+
103
+ R-NEM relies on N-EM (Greff et al., 2017) to discover a compositional object representation from raw visual inputs. A closely related approach to N-EM is the TAG framework (Greff et al., 2016), which utilizes a similar mechanism to perform inference over group representations, but in addition performs inference over the group assignments. In recent work TAG was combined with a recurrent ladder network (Ilin et al., 2017) to obtain a powerful model (RTagger) that can be applied to sequential data. However, the lack of a single compact representation that captures all information about a group (object) makes a compositional treatment of physical interactions more difficult. Other unsupervised approaches rely on attention to group together parts of the visual scene corresponding to objects (Eslami et al., 2016; Gregor et al., 2015). These approaches suffer from a similar problem in that their sequential nature prevents a coherent object representation to take shape.
104
+
105
+ Other related work have also taken steps towards combining the learnability of neural networks with the compositionality of symbolic programs in modeling physics (Battaglia et al., 2016; Chang et al., 2016), playing games (Denil et al., 2017; Kansky et al., 2017), learning algorithms (Bošnjak et al., 2017; Cai et al., 2017; Li et al., 2016; Reed & De Freitas, 2015), visual understanding (Ellis et al., 2017; Johnson et al., 2017), and natural language processing (Andreas et al., 2016; Hu et al., 2017).
106
+
107
+ # 4 EXPERIMENTS
108
+
109
+ In this section we evaluate R-NEM on three different physical reasoning tasks that each vary in their dynamical and visual complexity: bouncing balls with variable mass, bouncing balls with an invisible curtain and the Arcade Learning Environment (Bellemare et al., 2013). We compare R-NEM to other unsupervised neural methods that do not incorporate any inductive biases reflecting real-world dynamics and show that these are indeed beneficial.2
110
+
111
+ All experiments use ADAM (Kingma & Ba, 2014) with default parameters, on 50K train $+ ~ 1 0 \mathrm { K }$ validation $+ \ 1 0 \mathrm { K }$ test sequences and early stopping with a patience of 10 epochs. For each of $\mathbf { M L P } ^ { e n c , e m b , e f f }$ we used a unique single layer neural network with 250 rectified linear units. For $\mathbf { M L P } ^ { a t t }$ we used a two-layer neural network: 100 tanh units followed by a single sigmoid unit. A detailed overview of the experimental setup can be found in Appendix A.
112
+
113
+ ![](images/790e190a35d62c142591a94364df4d41d39508cc80bed1b751ad53ab47f400fe.jpg)
114
+ Figure 2: R-NEM applied to a sequence of 4 bouncing balls. Each column corresponds to a time-step, which coincides with an EM step. At each time-step, R-NEM computes $K = 5$ new representations $\pmb { \theta } _ { k }$ according to (4) (see also Representations in Figure 1) from the input $_ { \textbf { \em x } }$ with added noise (bottom row). From each new $\pmb { \theta } _ { k }$ a group reconstruction $\psi _ { k }$ is produced (rows 2-6 from bottom) that predicts the state of the environment at the next time-step. Attention coefficients are visualized by overlaying a colored reconstruction of a context object on the white reconstruction of the focus object (see Attention in Section 4). Based on the prediction accuracy of $\psi$ , the $E$ -step (see Figure 1) computes new soft-assignments $\gamma$ (row 7 from bottom), visualized by coloring each pixel $i$ according to their distribution over components $\gamma _ { i }$ . Row 8 visualizes the total prediction by the network $( \sum _ { k } \psi _ { k } \cdot \gamma _ { k } )$ and row 9 the ground-truth sequence at the next time-step.
115
+
116
+ ![](images/51bd1e1f7d4957ff347c412912a15d7ed7a93efb783a5724268519fa28884670.jpg)
117
+ Figure 3: Performance of each method on the bouncing balls task. Each method was trained on a dataset with 4 balls, evaluated on a test set with 4 balls (left), and on a test-set with 6-8 balls (middle). The losses are reported relative to the loss of a baseline for each dataset that always predicts the current frame. The ARI score (right) is used to evaluate the degree of compositionality that is achieved.
118
+
119
+ ![](images/84bf21a3293f377f67146f99a183d3557e40b26add2a536ea4a5b989040ef458.jpg)
120
+ Figure 4: Left: Three sequences of 15 time-steps ground-truth (top), R-NEM (middle), RNN (bottom). The last ten time-steps of the sequences produced by R-NEM and RNN are simulated. Right: The BCE loss on the entire test-set for these same time-steps.
121
+
122
+ Bouncing Balls We study the physical reasoning capabilities of R-NEM on the bouncing balls task, a standard environment to evaluate physical reasoning capabilities that exhibits low visual complexity and complex non-linear physical dynamics.3 We train R-NEM on sequences of $6 4 \times 6 4$ binary images over 30 time-steps that contain four bouncing balls with different masses corresponding to their radii. The balls are initialized with random initial positions, masses and velocities. Balls bounce elastically against each other and the image window.
123
+
124
+ Qualitative Evaluation Figure 1 presents a qualitative evaluation of R-NEM on the bouncing balls task. After 10 time-steps it can be observed that the pixels that belong to each of the balls are grouped together and assigned to a unique component (with a saturated color); and that the background (colored grey) has been divided among all components (resulting in a grey coloring). This indicates that the representation $\pmb { \theta } _ { k }$ from which each component produces the group reconstruction $\psi _ { k }$ does indeed only contain information about a unique object, such that together the $\pmb { \theta } _ { k }$ ’s yield a compositional object representation of the scene. The total reconstruction (that combines the group reconstructions and the soft-assignments) displays an accurate reconstruction of the input sequence at the next time-step, indicating that R-NEM has learned to model the dynamics of bouncing balls.
125
+
126
+ Comparison We compare the modelling capabilities of R-NEM to an RNN, LSTM (Gers et al., 1999; Hochreiter & Schmidhuber, 1997) and RNN-EM in terms of the Binomial Cross-Entropy (BCE) loss between the predicted image and the ground-truth image of the last frame,4 as well as the relational BCE that only takes into account objects that currently take part in collision. Unless specified we use $K = 5$ .
127
+
128
+ On a test-set with sequences containing four balls we observe that R-NEM produces markedly lower losses when compared to all other methods (left plot in Figure 3). Moreover, in order to validate that each component captures only a single ball (and thus compositionality is achieved), we report the Adjusted Rand Index (ARI; Hubert $\&$ Arabie (1985)) score between the soft-assignments $\gamma$ and the ground-truth assignment of pixels to objects. In the left column of the ARI plot (right side in Figure 3) we find that R-NEM achieves an ARI score of 0.8, meaning that in roughly $8 0 \%$ of the cases each ball is modeled by a single component. This suggests that a compositional object representation is achieved for most of the sequences. Together these observations are in line with our qualitative evaluation and validate that incorporating real world priors is greatly beneficial (comparing to RNN, LSTM) and that $\mathrm { \Upsilon ^ { \mathrm { { K - N E M } } } }$ enables interactions to be modelled more accurately compared to RNN-EM in terms of the relational BCE.
129
+
130
+ Similar to Greff et al. (2017) we find that further increasing the number of components during training (leaving additional groups empty) increases the quality of the grouping, see R-NEM $K = 8$ in Figure 3. In addition we observe that the loss (in particular the relational BCE) is reduced further, which matches our hypothesis that compositional object representations are greatly beneficial for modelling physical interactions.
131
+
132
+ Extrapolating learned knowledge We use a test-set with sequences containing 6-8 balls to evaluate the ability of each method to extrapolate their learned knowledge about physical interactions between four balls to environments with more balls. We use $K = 8$ when evaluating R-NEM and
133
+
134
+ RNN-EM on this test-set in order to accommodate the increased number of objects. As can be seen from the middle plot in Figure 3, R-NEM again greatly outperforms all other methods. Notice that, since we report the loss relative to a baseline, we roughly factor out the increased complexity of the task. Perfect extrapolation of the learned knowledge would therefore amount to no change in relative performance. In contrast, we observe far worse performance for the LSTM (relative to the baseline) when evaluated on this dataset with extra balls. It suggests that the gating mechanism of the LSTM has allowed it to learn a sophisticated and overly specialized solution for sequences with four balls that does not generalize to a dataset with 6-8 balls.
135
+
136
+ R-NEM and RNN-EM scale markedly better to this dataset than LSTM. Although the RNN similarly suffers to a lesser extend from this type of “overfitting”, this is most likely due its inability to learn a reasonable solution on sequences of four balls to begin with. Hence, we conclude that the superior extrapolation capabilities of RNN-EM and R-NEM are inherent to their ability to factor a scene in terms of permutation invariant object representations (see right side of the right plot in Figure 3).
137
+
138
+ Attention Further insight in the role of the attention mechanism can be gained by visualizing the attention coefficients, as is done in Figure 2. For each component $k$ we draw $\alpha _ { k , i } * \psi _ { i }$ on top of the reconstruction $\psi _ { k }$ , colored according to the color of component $i$ . These correspond to the colored balls (that are for example seen in time-steps 13, 14), which indicate whether component $k$ took information about component $i$ into account when computing the new state (recall (5)). It can be observed that the attention coefficient $\alpha _ { k , i }$ becomes non-zero whenever collision takes place, such that a colored ball lights up in the following time-steps. The attention mechanism learned by R-NEM thus assumes the role of the distance-based heuristic in previous work (Chang et al., 2016), matching our own intuitions of how this mechanism would best be utilized.
139
+
140
+ A quantitative evaluation of the attention mechanism is obtained by comparing R-NEM to a variant of itself that does not incorporate attention ( $R$ -NEM no att). Figure 3 shows that both methods perform equally well on the regular test set (4 balls), but that $R$ -NEM no att performs worse at extrapolating from its learned knowledge (6-8 balls). A likely reason for this behavior is that the range of the sum in (5) changes with $K$ . Thus, when extrapolating to an environment with more balls the total sum may exceed previous boundaries and impede learned dynamics.
141
+
142
+ Simulation Once a scene has been accurately modelled, R-NEM can approximately simulate its dynamics through recursive application of (4) for each $\pmb { \theta } _ { k }$ .5 In Figure 4 we compare the simulation capabilities of R-NEM to RNN-EM and an RNN on the bouncing balls environment.3 On the left it shows for R-NEM and an RNN a sequence with five normal steps followed by 10 simulation steps, as well as the ground-truth sequence. From the last frame in the sequence it can clearly be observed that R-NEM has managed to accurately simulate the environment. Each ball is approximately in the correct place, and the shape of each ball is preserved. The balls simulated by the RNN, on the other hand, deviate substantially from their ground-truth position and their size has increased. In general we find that R-NEM produces mostly very accurate simulations, whereas the RNN consistently fails. Interestingly we found that the cases in which R-NEM frequently fails are those for which a single component models more than one ball. The right side of Figure 4 summarizes the BCE loss for these same time-steps across the entire test-set. Although this is a crude measure of simulation performance (since it does not take into account the identity of the balls), we still observe that R-NEM consistently outperforms RNN-EM and an RNN.
143
+
144
+ Hidden Factors Occlusion is abundant in the real world, and the ability to handle hidden factors is crucial for any physical reasoning system. We therefore evaluate the capability of R-NEM to handle occlusion using a variant of bouncing balls that contain an invisible “curtain.” Figure 5 shows that R-NEM accurately models the sequence and can maintain object states, even when confronted with occlusion.3 For example, note that in step 36 the “blue” ball, is completely occluded and is about to collide with the “orange” ball. In step 38 the ball is accurately predicted to re-appear at the bottom of the curtain (since collision took place) as opposed to the left side of the curtain. This demonstrates that R-NEM has a notion of object permanence and implies that it understands a scene on a level beyond pixels: it assigns persistence and identity to the objects.
145
+
146
+ ![](images/4a0ca27f7f4ee785aa414368ee5c57cef896ec32263293612cff7ea6d214e3d6.jpg)
147
+ Figure 5: R-NEM applied to a sequence of bouncing balls with an invisible curtain. The ground truth sequence is displayed in the top row, followed by the prediction of R-NEM (middle) and the soft-assignments of pixels to components (bottom). R-NEM models objects, as well as its interactions, even when the object is completely occluded (step 36). Only a subset of the steps is shown.
148
+
149
+ ![](images/8e57130e03f513949366dd6810296e3f195a4acc246cffd118529e7c6335c9ae.jpg)
150
+ Figure 6: R-NEM accurately models a sequence of frames obtained by an agent playing Space Invaders. A group no longer corresponds to an object, but instead assumes the role of high-level entities that engage in similar movement patterns.
151
+
152
+ In terms of test-set performance we find that R-NEM (BCE: 46.22, relational BCE: 2.33) outperforms an RNN (BCE: 94.64, relational BCE: 4.14) and an LSTM (BCE: 59.32, relational BCE: 2.72).
153
+
154
+ Space Invaders To test the performance of R-NEM in a visually more challenging environment, we train it on sequences of $8 4 \times 8 4$ binarized images over 25 time-steps of game-play on Space Invaders from the Arcade Learning Environment (Bellemare et al., 2013).6 We use $K = 4$ and also feed the action of the agent to the interaction function. Figure 6 confirms that R-NEM is able to accurately model the environment, even though the visual complexity has increased. Notice that these visual scenes comprise a large numbers of (small) primitive objects that behave similarly. Since we trained R-NEM with four components it is unable to group pixels according to individual objects and is forced to consider a different grouping. We find that R-NEM assigns different groups to every other column of aliens together with the spaceship, and to the three large “shields.” These groupings seem to be based on movement, which to some degree coincides with their semantic roles of the environment. In other examples (not shown) we also found that R-NEM frequently assigns different groups to every other column of the aliens, and to the three large “shields.” Individual bullets and the space ship are less frequently grouped separately, which may have to do with the action-noise of the environment (that controls the movement of the space-ship) and the small size of the bullets at the current resolution that makes them less predictable.
155
+
156
+ # 5 DISCUSSION AND CONCLUSION
157
+
158
+ We have argued that the ability to discover and describe a scene in terms of objects provides an essential ingredient for common-sense physical reasoning. This is supported by converging evidence from cognitive science and developmental psychology that intuitive physics and reasoning capabilities are built upon the ability to perceive objects and their interactions (Spelke, 1988; Ullman et al., 2017). The fact that young infants already exhibit this ability, may even suggest an innate bias towards compositionality (Lake et al., 2016; Munakata et al., 1997; Spelke & Kinzler, 2007). Inspired by these observations we have proposed R-NEM, a method that incorporates inductive biases about the existence of objects and interactions, implemented by its clustering objective and interaction function respectively. The specific nature of the objects, and their dynamics and interactions can then be learned efficiently purely from visual observations.
159
+
160
+ In our experiments we find that R-NEM indeed captures the (physical) dynamics of various environments more accurately than other methods, and that it exhibits improved generalization to environments with different numbers of objects. It can be used as an approximate simulator of the environment, and to predict movement and collisions of objects, even when they are completely occluded. This demonstrates a notion of object permanence and aligns with evidence that young infants seem to infer that occluded objects move in connected paths and continue to maintain objectspecific properties (Spelke, 1990). Moreover, young infants also appear to expect that objects only interact when they come into contact (Spelke, 1990), which is analogous to the behaviour of R-NEM to only attend to other objects when a collision is imminent. In summary, we believe that our method presents an important step towards learning a more human-like model of the world in a completely unsupervised fashion.
161
+
162
+ Current limitations of our approach revolve around grouping and prediction. What aspects of a scene humans group together typically varies as a function of the task in mind. One may perceive a stack of chairs as a whole if the goal is to move them to another room, or as individual chairs if the goal is to count the number of chairs in the stack. In order to facilitate this dynamic grouping one would need to incorporate top-down feedback from an agent into the grouping procedure to deviate from the built-in inductive biases. Another limitation of our approach is the need to incentivize R-NEM to produce useful groupings by injecting noise, or reducing capacity. The former may prevent very small regularities in the input from being detected. Finally the interaction in the E-step among the groups makes it difficult to increase the number of components above ten without causing harmful training instabilities. Due to the multitude of interactions and objectives in R-NEM (and RNN-EM) we find that they are sometimes challenging to train.
163
+
164
+ In terms of prediction we have implicitly assumed that objects in the environment behave according to rules that can be inferred. This poses a challenge when objects deform in a manner that is difficult to predict (as is the case for objects in Space Invaders due to downsampling). However in practice we find that (once pixels have been grouped together) the masking of the input helps each component in quickly adapting its representation to any unforeseen behaviour across consecutive time steps. Perhaps a more severe limitation of R-NEM (and of RNN-EM in general) is that the second loss term of the outer training objective hinders in modelling more complex varying backgrounds, as the background group would have to predict the “pixel prior” for every other group.
165
+
166
+ We argue that the ability to engage in common-sense physical reasoning benefits any intelligent agent that needs to operate in a physical environment, which provides exciting future research opportunities. In future work we intend to investigate how top-down feedback from an agent could be incorporated in R-NEM to facilitate dynamic groupings, but also how the compositional representations produced by R-NEM can benefit a reinforcement learner, for example to learn a modular policy that easily generalizes to novel combinations of known objects. Other interactions between a controller C and a model of the world M (implemented by R-NEM) as posed in Schmidhuber (2015) constitute further research directions.
167
+
168
+ # ACKNOWLEDGEMENTS
169
+
170
+ The authors wish to thank Tom Griffiths and the anonymous reviewers for helpful comments and constructive feedback. This research was supported by the Swiss National Science Foundation grant 200021_165675/1, the EU project “INPUT” (H2020-ICT-2015 grant no. 687795), and the Zeno Karl Schindler Foundation Summerschool Grant. Chang would like to thank Christiane Born, Sarah Craver, Cinzia Daldini, and the MIT MISTI Program for supporting his stay in Switzerland. We are grateful to NVIDIA Corporation for donating us a DGX-1 as part of the Pioneers of AI Research award, and to IBM for donating a “Minsky” machine.
171
+
172
+ # REFERENCES
173
+
174
+ Pulkit Agrawal, Ashvin V Nair, Pieter Abbeel, Jitendra Malik, and Sergey Levine. Learning to poke by poking: Experiential learning of intuitive physics. In Advances in Neural Information Processing Systems, pp. 5074–5082, 2016.
175
+
176
+ Jacob Andreas, Marcus Rohrbach, Trevor Darrell, and Dan Klein. Neural module networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 39–48, 2016.
177
+
178
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. arXiv preprint arXiv:1409.0473, 2014.
179
+
180
+ Peter Battaglia, Razvan Pascanu, Matthew Lai, Danilo Jimenez Rezende, and others. Interaction networks for learning about objects, relations and physics. In Advances in Neural Information Processing Systems, pp. 4502–4510, 2016.
181
+
182
+ Peter W Battaglia, Jessica B Hamrick, and Joshua B Tenenbaum. Simulation as an engine of physical scene understanding. Proceedings of the National Academy of Sciences, 110(45):18327–18332, 2013.
183
+
184
+ Marc G Bellemare, Yavar Naddaf, Joel Veness, and Michael Bowling. The arcade learning environment: An evaluation platform for general agents. J. Artif. Intell. Res.(JAIR), 47:253–279, 2013.
185
+
186
+ Matko Bošnjak, Tim Rocktäschel, Jason Naradowsky, and Sebastian Riedel. Programming with a differentiable forth interpreter. In Proceedings of the 34th International Conference on Machine Learning, pp. 547–556, 2017.
187
+
188
+ Jonathon Cai, Richard Shin, and Dawn Song. Making neural programming architectures generalize via recursion. arXiv preprint arXiv:1704.06611, 2017.
189
+
190
+ Michael B. Chang, Tomer Ullman, Antonio Torralba, and Joshua B. Tenenbaum. A compositional object-based approach to learning physical dynamics. arXiv preprint arXiv:1612.00341, 2016.
191
+
192
+ A. P. Dempster, N. M. Laird, and D. B. Rubin. Maximum likelihood from incomplete data via the EM algorithm. Journal of the royal statistical society., pp. 1–38, 1977.
193
+
194
+ Misha Denil, Sergio Gómez Colmenarejo, Serkan Cabi, David Saxton, and Nando de Freitas. Programmable agents. arXiv preprint arXiv:1706.06383, 2017.
195
+
196
+ Yan Duan, Marcin Andrychowicz, Bradly Stadie, Jonathan Ho, Jonas Schneider, Ilya Sutskever, Pieter Abbeel, and Wojciech Zaremba. One-shot imitation learning. In Advances in Neural Information Processing Systems, pp. 1087–1098, 2017.
197
+
198
+ Kevin Ellis, Daniel Ritchie, Armando Solar-Lezama, and Joshua B. Tenenbaum. Learning to infer graphics programs from hand-drawn images. CoRR, abs/1707.09627, 2017.
199
+
200
+ SM Ali Eslami, Nicolas Heess, Theophane Weber, Yuval Tassa, David Szepesvari, Geoffrey E Hinton, et al. Attend, infer, repeat: Fast scene understanding with generative models. In Advances in Neural Information Processing Systems, pp. 3225–3233, 2016.
201
+
202
+ Katerina Fragkiadaki, Pulkit Agrawal, Sergey Levine, and Jitendra Malik. Learning visual predictive models of physics for playing billiards. arXiv preprint arXiv:1511.07404, 2015.
203
+
204
+ Felix A Gers, Jürgen Schmidhuber, and Fred Cummins. Learning to forget: Continual prediction with LSTM. In Artificial Neural Networks, 1999. ICANN 99. Ninth International Conference on (Conf. Publ. No. 470), volume 2, pp. 850–855, 1999.
205
+
206
+ 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.
207
+
208
+ 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.
209
+
210
+ Klaus Greff, Antti Rasmus, Mathias Berglund, Tele Hao, Harri Valpola, and Juergen Schmidhuber. Tagger: Deep unsupervised perceptual grouping. In Advances in Neural Information Processing Systems, pp. 4484–4492, 2016.
211
+
212
+ Klaus Greff, Sjoerd van Steenkiste, and Jürgen Schmidhuber. Neural expectation maximization. In Advances in Neural Information Processing Systems, pp. 6694–6704, 2017.
213
+
214
+ Karol Gregor, Ivo Danihelka, Alex Graves, Danilo Jimenez Rezende, and Daan Wierstra. Draw: A recurrent neural network for image generation. arXiv preprint arXiv:1502.04623, 2015.
215
+
216
+ Radek Grzeszczuk, Demetri Terzopoulos, and Geoffrey Hinton. Neuroanimator: Fast neural network emulation and control of physics-based models. In Proceedings of the 25th annual conference on Computer graphics and interactive techniques, pp. 9–20. ACM, 1998.
217
+
218
+ Gary Hatfield and William Epstein. The status of the minimum principle in the theoretical analysis of visual perception. Psychological Bulletin, 97(2):155, 1985.
219
+
220
+ Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural computation, 9(8):1735–1780, 1997.
221
+
222
+ Ronghang Hu, Jacob Andreas, Marcus Rohrbach, Trevor Darrell, and Kate Saenko. Learning to reason: End-to-end module networks for visual question answering. arXiv preprint arXiv:1704.05526, 2017.
223
+
224
+ Lawrence Hubert and Phipps Arabie. Comparing partitions. Journal of classification, 2(1):193–218, 1985.
225
+
226
+ John E. Hummel, Keith J. Holyoak, Collin Green, Leonidas AA Doumas, Derek Devnich, Aniket Kittur, and Donald J. Kalar. A solution to the binding problem for compositional connectionism. In Compositional Connectionism in Cognitive Science: Papers from the AAAI Fall Symposium, Ed. SD Levy & R. Gayler, pp. 31–34, 2004.
227
+
228
+ Alexander Ilin, Isabeau Prémont-Schwarz, Tele Hotloo Hao, Antti Rasmus, Rinu Boney, and Harri Valpola. Recurrent Ladder Networks. arXiv:1707.09219 [cs, stat], July 2017.
229
+
230
+ Justin Johnson, Bharath Hariharan, Laurens van der Maaten, Judy Hoffman, Li Fei-Fei, C Lawrence Zitnick, and Ross Girshick. Inferring and executing programs for visual reasoning. arXiv preprint arXiv:1705.03633, 2017.
231
+
232
+ Ken Kansky, Tom Silver, David A Mély, Mohamed Eldawy, Miguel Lázaro-Gredilla, Xinghua Lou, Nimrod Dorfman, Szymon Sidor, Scott Phoenix, and Dileep George. Schema networks: Zero-shot transfer with a generative causal model of intuitive physics. arXiv preprint arXiv:1706.04317, 2017.
233
+
234
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
235
+
236
+ Diederik P Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013.
237
+
238
+ Brenden M. Lake, Tomer D. Ullman, Joshua B. Tenenbaum, and Samuel J. Gershman. Building machines that learn and think like people. Behavioral and Brain Sciences, pp. 1–101, 2016.
239
+
240
+ Adam Lerer, Sam Gross, and Rob Fergus. Learning physical intuition of block towers by example. arXiv preprint arXiv:1603.01312, 2016.
241
+
242
+ Chengtao Li, Daniel Tarlow, Alexander L Gaunt, Marc Brockschmidt, and Nate Kushman. Neural program lattices. 2016.
243
+
244
+ Vincent Michalski, Roland Memisevic, and Kishore Konda. Modeling deep temporal dependencies with recurrent grammar cells"". In Advances in neural information processing systems, pp. 1925–1933, 2014.
245
+
246
+ Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Alex Graves, Ioannis Antonoglou, Daan Wierstra, and Martin Riedmiller. Playing atari with deep reinforcement learning. arXiv preprint arXiv:1312.5602, 2013.
247
+
248
+ Yuko Munakata, James L McClelland, Mark H Johnson, and Robert S Siegler. Rethinking infant knowledge: toward an adaptive process account of successes and failures in object permanence tasks. Psychological review, 104(4):686, 1997.
249
+
250
+ Augustus Odena, Vincent Dumoulin, and Chris Olah. Deconvolution and Checkerboard Artifacts. Distill, 2016. doi: 10.23915/distill.00003.
251
+
252
+ Ethan Perez, Florian Strub, Harm de Vries, Vincent Dumoulin, and Aaron Courville. FiLM: Visual Reasoning with a General Conditioning Layer. arXiv:1709.07871 [cs, stat], September 2017.
253
+
254
+ Scott Reed and Nando De Freitas. Neural programmer-interpreters. arXiv preprint arXiv:1511.06279, 2015.
255
+
256
+ Adam Santoro, David Raposo, David GT Barrett, Mateusz Malinowski, Razvan Pascanu, Peter Battaglia, and Timothy Lillicrap. A simple neural network module for relational reasoning. arXiv preprint arXiv:1706.01427, 2017.
257
+
258
+ Jürgen Schmidhuber. On learning to think: Algorithmic information theory for novel combinations of reinforcement learning controllers and recurrent neural world models. arXiv preprint arXiv:1511.09249, 2015.
259
+
260
+ Elizabeth S Spelke. Where perceiving ends and thinking begins: The apprehension of objects in infancy. 1988.
261
+
262
+ Elizabeth S Spelke. Principles of object perception. Cognitive science, 14(1):29–56, 1990.
263
+
264
+ Elizabeth S. Spelke and Katherine D. Kinzler. Core knowledge. Developmental science, 10(1):89–96, 2007.
265
+
266
+ Nitish Srivastava, Elman Mansimov, and Ruslan Salakhudinov. Unsupervised learning of video representations using lstms. In International Conference on Machine Learning, pp. 843–852, 2015.
267
+
268
+ Ilya Sutskever, Geoffrey E. Hinton, and Graham W. Taylor. The recurrent temporal restricted boltzmann machine. In Advances in Neural Information Processing Systems, pp. 1601–1608, 2009.
269
+
270
+ Tomer D Ullman, Elizabeth Spelke, Peter Battaglia, and Joshua B Tenenbaum. Mind games: Game engines as an architecture for intuitive physics. Trends in Cognitive Sciences, 21(9):649–665, 2017.
271
+
272
+ Nicholas Watters, Andrea Tacchetti, Theophane Weber, Razvan Pascanu, Peter Battaglia, and Daniel Zoran. Visual Interaction Networks. arXiv:1706.01433 [cs], June 2017.
273
+
274
+ Paul J Werbos. Generalization of backpropagation with application to a recurrent gas market model. Neural networks, 1(4):339–356, 1988.
275
+
276
+ Ronald J Williams. Complexity of exact gradient computation algorithms for recurrent neural networks. Technical report, Technical Report Technical Report NU-CCS-89-27, Boston: Northeastern University, College of Computer Science, 1989.
277
+
278
+ Jiajun Wu, Ilker Yildirim, Joseph J Lim, Bill Freeman, and Josh Tenenbaum. Galileo: Perceiving physical object properties by integrating a physics engine with deep learning. In Advances in neural information processing systems, pp. 127–135, 2015.
279
+
280
+ Kelvin Xu, Jimmy Ba, Ryan Kiros, Kyunghyun Cho, Aaron Courville, Ruslan Salakhudinov, Rich Zemel, and Yoshua Bengio. Show, attend and tell: Neural image caption generation with visual attention. In International Conference on Machine Learning, pp. 2048–2057, 2015.
281
+
282
+ Manzil Zaheer, Satwik Kottur, Siamak Ravanbakhsh, Barnabas Poczos, Ruslan R Salakhutdinov, and Alexander J Smola. Deep sets. In Advances in Neural Information Processing Systems, pp. 3394–3404, 2017.
283
+
284
+ # A EXPERIMENT DETAILS
285
+
286
+ In all experiments we train the networks using ADAM (Kingma & Ba, 2014) with default parameters, a batch size of 64 and $5 0 0 0 0 \mathrm { t r a i n } + 1 0 0 0 0$ validation $+ 1 0 0 0 0$ test inputs. The quality of the learned groupings is evaluated by computing the Adjusted Rand Index (ARI; Hubert & Arabie (1985)) with respect to the ground truth, while ignoring the background and overlap regions (as is consistent with earlier work (Greff et al., 2017)). We use early stopping when the validation loss has not improved for 10 epochs.
287
+
288
+ # A.1 BOUNCING BALLS
289
+
290
+ The bouncing balls data is similar to previous work (Sutskever et al., 2009) with a few modifications. The data consists of sequences of $6 4 \times 6 4$ binary images over 30 time-steps and balls are randomly sampled from two types: one ball is six times heavier and 1.25 times larger in radius than the other. The balls are initialized with random initial positions and velocities. Balls bounce elastically against each other and the image window.
291
+
292
+ As in previous work (Greff et al., 2017) we use a convolutional encoder-decoder architecture with a recurrent neural network as bottleneck, that is updated according to (4):
293
+
294
+ 1. $4 \times 4$ conv. 16 ELU. stride 2. layer norm
295
+ 2. $4 \times 4$ conv. 32 ELU. stride 2. layer norm
296
+ 3. $4 \times 4$ conv. 64 ELU. stride 2. layer norm
297
+ 4. fully connected. 512 ELU. layer norm
298
+ 5. recurrent. 250 Sigmoid. layer norm on the output
299
+ 6. fully connected. 512 RELU. layer norm
300
+ 7. fully connected. $8 \times 8 \times 6 4$ RELU. layer norm
301
+ 8. $4 \times 4$ reshape 2 nearest-neighbour, conv. 32 RELU. layer norm
302
+ 9. $4 \times 4$ reshape 2 nearest-neighbour, conv. 16 RELU. layer norm
303
+ 10. $4 \times 4$ reshape 2 nearest-neighbour, conv. 1 Sigmoid
304
+
305
+ Instead of using transposed convolutions (to implement the "de-convolution") we first reshape the image using the default nearest-neighbour interpolation followed by a normal convolution in order to avoid frequency artifacts (Odena et al., 2016). Note that we do not add layer norm on the recurrent connection.
306
+
307
+ At each timestep added bitflip nois $t$ $\gamma _ { : , k } ( \boldsymbol { \psi } _ { : , k } ^ { ( t - 1 ) } - \hat { { \mathbf x } } ^ { ( t ) } )$ as input to the network, where rlier work (Greff et al., 2017) R- $\tilde { \pmb x }$ is the input withM is trained with $\gamma = 0 . 2 )$
308
+ a next-step prediction objective, the prior for each pixel in the data is set to a Bernoulli distribution
309
+ with $p = 0$ , and we prevent conflicting gradient updates by not back-propagating any gradients
310
+ through $\gamma$ .
311
+
312
+ The Interaction Function $\mathbf { \hat { T } } ^ { \mathrm { R - N E M } }$ network is structured as follows:
313
+
314
+ • ${ \bf M L P } ^ { e n c }$ : fully connected. 250 RELU. layer norm
315
+ • ${ \bf M L P } ^ { e m b }$ : fully connected. 250 RELU. layer norm
316
+ • ${ \bf M L P } ^ { e f f }$ : fully connected. 250 RELU. layer norm
317
+ • ${ \bf M L P } ^ { a t t }$ : fully connected. 100 Tanh. layer norm - fully connected. 1 Sigmoid.
318
+
319
+ We experimented with deeper architectures, but were unable to observe significant improvement.
320
+
321
+ Comparison and Extrapolation In the comparison experiment both R-NEM and RNN-EM are trained with $K = 5$ (unless otherwise mentioned), following insights from Greff et al. (2017). On the extrapolation task we adjusted the number of components at test time to $K = 8$ .
322
+
323
+ When comparing to RNN-EM we used $\mathbf { Y } = \mathbf { Y } ^ { \mathrm { R N N - E M } }$ . For comparing to RNN we set $K = 1$ and used $\dot { \mathbf { Y } } = \bar { \mathbf { Y } } ^ { \mathrm { R N N - E M } }$ , yielding a standard recurrent autoencoder that receives at each time-step the difference between the prediction and the noisy ground-truth as input. In case of LSTM, we additionally replace the recurrent layer with an LSTM update. The R-NEM no att model is the same as R-NEM, without $\mathbf { M L P } ^ { a t t }$ , such that $\alpha _ { : , : } = 1$
324
+
325
+ Simulation Since the $\mathrm { E }$ -step relies on the ground-truth, which was not available for simulation, we used a thresholded version of $\operatorname* { m a x } _ { k } \psi$ at 0.1 (such that everything below becomes 0 and everything above becomes 1) as a replacement in stead.
326
+
327
+ Occlusion On the occlusion dataset we used three balls with equal mass. The curtain was spawned at a random location for each sequence. We trained R-NEM with $K = 5$ .
328
+
329
+ # A.2 SPACE INVADERS
330
+
331
+ We used a pre-trained DQN to produce a dataset with sequences of 25 time-steps. The DQN receives a stack of four frames as input and we recorded every first frame of this stack. These frames were first pre-processed as in Mnih et al. (2013) and then thresholded at 0.0001 to obtain binary images.
332
+
333
+ Since the images are $8 4 \times 8 4$ we used a different encoder and decoder, given by:
334
+
335
+ 1. $4 \times 4$ conv. 16 ELU. stride 2. layer norm
336
+ 2. $4 \times 4$ conv. 32 ELU. stride 2. layer norm
337
+ 3. $4 \times 4$ conv. 32 ELU. stride 2. layer norm
338
+ 4. $4 \times 4$ conv. 32 ELU. stride 2. layer norm
339
+ 5. fully connected. 512 ELU. layer norm
340
+ 6. recurrent. 250 Sigmoid. layer norm on the output
341
+ 7. fully connected. 512 RELU. layer norm
342
+ 8. fully connected. $8 \times 8 \times 6 4$ RELU. layer norm
343
+ 9. $4 \times 4$ reshape 2 nearest-neighbour, conv. 32 RELU. layer norm
344
+ 10. $4 \times 4$ reshape 2 nearest-neighbour, conv. 32 RELU. layer norm
345
+ 11. $4 \times 4$ reshape 2 nearest-neighbour, conv. 16 RELU. layer norm
346
+ 12. $4 \times 4$ reshape 2 nearest-neighbour, conv. 1 Sigmoid
347
+
348
+ We used the same architecture for $\Upsilon ^ { \mathrm { R - N E M } }$ , with the only difference that at each time-step we concatenated an embedding of the action produced by the agent to the hidden state. Here we used a single layer MLP with 10 units and a $R e L U$ activation function to compute this embedding.
349
+
350
+ In the Atari experiment we trained with $K = 4$ and reduced the input noise to 0.02, in order to preserve tiny elements such as bullets (that only occupy 1-2 pixels).
md/train/rygBVTVFPB/rygBVTVFPB.md ADDED
@@ -0,0 +1,368 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LEARNING TO DISCRETIZE: SOLVING 1D SCALAR CONSERVATION LAWS VIA DEEP REINFORCEMENT LEARNING
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Conservation laws are considered to be fundamental laws of nature. It has broad application in many fields including physics, chemistry, biology, geology, and engineering. Solving the differential equations associated with conservation laws is a major branch in computational mathematics. Recent success of machine learning, especially deep learning, in areas such as computer vision and natural language processing, has attracted a lot of attention from the community of computational mathematics and inspired many intriguing works in combining machine learning with traditional methods. In this paper, we are the first to view numerical PDE solvers as a MDP and to use (deep) RL to learn new solvers. As a proof of concept, we focus on 1-dimensional scalar conservation laws. We deploy the machinery of deep reinforcement learning to train a policy network that can decide on how the numerical solutions should be approximated in a sequential and spatial-temporal adaptive manner. We will show that the problem of solving conservation laws can be naturally viewed as a sequential decision making process and the numerical schemes learned in such a way can easily enforce long-term accuracy. Furthermore, the learned policy network is carefully designed to determine a good local discrete approximation based on the current state of the solution, which essentially makes the proposed method a meta-learning approach. In other words, the proposed method is capable of learning how to discretize for a given situation mimicking human experts. Finally, we will provide details on how the policy network is trained, how well it performs compared with some state-of-the-art numerical solvers such as WENO schemes, and how well it generalizes. Our code is released anomynously at https://github.com/qwerlanksdf/L2D.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Conservation laws are considered to be one of the fundamental laws of nature, and has broad applications in multiple fields such as physics, chemistry, biology, geology, and engineering. For example, Burger’s equation, a very classic partial differential equation (PDE) in conservation laws, has important applications in fluid mechanics, nonlinear acoustics, gas dynamics, and traffic flow.
12
+
13
+ Solving the differential equations associated with conservation laws has been a major branch of computational mathematics (LeVeque, 1992; 2002), and a lot of effective methods have been proposed, from classic methods such as the upwind scheme, the Lax-Friedrichs scheme, to the advanced ones such as the ENO/WENO schemes (Liu et al., 1994; Shu, 1998), the flux-limiter methods (Jerez Galiano & Uh Zapata, 2010), and etc. In the past few decades, these traditional methods have been proven successful in solving conservation laws. Nonetheless, the design of some of the high-end methods heavily relies on expert knowledge and the coding of these methods can be a laborious process. To ease the usage and potentially improve these traditional algorithms, machine learning, especially deep learning, has been recently incorporated into this field. For example, the ENO scheme requires lots of ‘if/else’ logical judgments when used to solve complicated system of equations or high-dimensional equations. This very much resembles the old-fashioned expert systems. The recent trend in artificial intelligence (AI) is to replace the expert systems by the so-called ‘connectionism’, e.g., deep neural networks, which leads to the recent bloom of AI. Therefore, it is natural and potentially beneficial to introduce deep learning in traditional numerical solvers of conservation laws.
14
+
15
+ # 1.1 RELATED WORKS
16
+
17
+ In the last few years, neural networks (NNs) have been applied to solving ODEs/PDEs or the associated inverse problems. These works can be roughly classified into three categories according to the way that the NN is used.
18
+
19
+ The first type of works propose to harness the representation power of NNs, and are irrelevant to the numerical discretization based methods. For example, Raissi et al. (2017a;b); Yohai Bar-Sinai (2018) treated the NNs as new ansatz to approximate solutions of PDEs. It was later generalized by Wei et al. (2019) to allow randomness in the solution which is trained using policy gradient. More recent works along this line include (Magiera et al., 2019; Michoski et al., 2019; Both et al., 2019). Besides, several works have focused on using NNs to establish direct mappings between the parameters of the PDEs (e.g. the coefficient field or the ground state energy) and their associated solutions (Khoo et al., 2017; Khoo & Ying, 2018; Li et al., 2019; Fan et al., 2018b). Furthermore, Han et al. (2018); Beck et al. (2017) proposed a method to solve very high-dimensional PDEs by converting the PDE to a stochastic control problem and use NNs to approximate the gradient of the solution.
20
+
21
+ The second type of works focus on the connection between deep neural networks (DNNs) and dynamic systems (Weinan, 2017; Chang et al., 2017; Lu et al., 2018; Long et al., 2018b; Chen et al., 2018). These works observed that there are connections between DNNs and dynamic systems (e.g. differential equations or unrolled optimization algorithms) so that we can combine deep learning with traditional tools from applied and computational mathematics to handle challenging tasks in inverse problems (Long et al., 2018b;a; Qin et al., 2018).The main focus of these works, however, is to solve inverse problems, instead of learning numerical discretizations of differential equations. Nonetheless, these methods are closely related to numerical differential equations since learning a proper discretization is often an important auxiliary task for these methods to accurately recover the form of the differential equations.
22
+
23
+ The third type of works, which target at using NNs to learn new numerical schemes, are closely related to our work. However, we note that these works mainly fall in the setting of supervised learning (SL). For example, Discacciati et al. (2019) proposed to integrate NNs into high-order numerical solvers to predict artificial viscosity; Ray & Hesthaven (2018) trained a multilayer perceptron to replace traditional indicators for identifying troubled-cells in high-resolution schemes for conservation laws. These works greatly advanced the development in machine learning based design of numerical schemes for conservation laws. Note that in Discacciati et al. (2019), the authors only utilized the one-step error to train the artificial viscosity networks without taking into account the longterm accuracy of the learned numerical scheme. Ray & Hesthaven (2018) first constructed several functions with known regularities and then used them to train a neural network to predict the location of discontinuity, which was later used to choose a proper slope limiter. Therefore, the training of the NNs is separated from the numerical scheme. Then, a natural question is whether we can learn discretization of differential equations in an end-to-end fashion and the learned discrete scheme also takes long-term accuracy into account. This motivates us to employ reinforcement learning to learn good solvers for conservation laws.
24
+
25
+ # 1.2 OUR APPROACH
26
+
27
+ The main objective of this paper is to design new numerical schemes in an autonomous way. We propose to use reinforcement learning (RL) to aid the process of solving the conservation laws. To our best knowledge, we are the first to regard numerical PDE solvers as a MDP and to use (deep) RL to learn new solvers. We carefully design the proposed RL-based method so that the learned policy can generate high accuracy numerical schemes and can well generalize in varied situations. Details will be given in section 3.
28
+
29
+ Here, we first provide a brief discussion on the benefits of using RL to solve conservation laws (the arguments apply to general evolution PDEs as well):
30
+
31
+ • Most of the numerical solvers of conservation law can be interpreted naturally as a sequential decision making process (e.g., the approximated grid values at the current time instance definitely affects all the future approximations). Thus, it can be easily formulated as a Markov Decision Process (MDP) and solved by RL.
32
+
33
+ • In almost all the RL algorithms, the policy $\pi$ (which is the AI agent who decides on how the $\begin{array} { r } { r ( s _ { 0 } , a _ { 0 } ) + \sum _ { t = 1 } ^ { \infty } \gamma ^ { t } \dot { r } ( s _ { t } , a _ { t } ) } \end{array}$ ated locally) is optimized with regards to the values , which by definition considers the long-term accumula $Q ^ { \pi } ( s _ { 0 } , a _ { 0 } ) =$ error of the learned numerical scheme), thus could naturally guarantee the long-term accuracy of the learned schemes, instead of greedily deciding the local approximation which is the case for most numerical PDEs solvers. Furthermore, it can gracefully handle the cases when the action space is discrete, which is in fact one of the major strength of RL.
34
+
35
+ • By optimizing towards long-term accuracy and effective exploration, we believe that RL has a good potential in improving traditional numerical schemes, especially in parts where no clear design principles exist. For example, although the WENO-5 scheme achieves optimal order of accuracy at smooth regions of the solution (Shu, 1998), the best way of choosing templates near singularities remains unknown. Our belief that RL could shed lights on such parts is later verified in the experiments: the trained RL policy demonstrated new behaviours and is able to select better templates than WENO and hence approximate the solution better than WENO near singularities.
36
+
37
+ • Non-smooth norms such as the infinity norm of the error is often used to evaluate the performance of the learned numerical schemes. As the norm of the error serves as the loss function for the learning algorithms, computing the gradient of the infinity norm can be problematic for supervised learning, while RL does not have such problem since it does not explicitly take gradients of the loss function (i.e. the reward function for RL).
38
+
39
+ • Learning the policy $\pi$ within the RL framework makes the algorithm meta-learning-like (Schmidhuber, 1987; Bengio et al., 1992; Andrychowicz et al., 2016; Li & Malik, 2016; Finn et al., 2017). The learned policy $\pi$ can decide on which local numerical approximation to use by judging from the current state of the solution (e.g. local smoothness, oscillatory patterns, dissipation, etc). This is vastly different from regular (non-meta-) learning where the algorithms directly make inference on the numerical schemes without the aid of an additional network such as $\pi$ . As subtle the difference as it may seem, meta-learning-like methods have been proven effective in various applications such as in image restoration (Jin et al., 2017; Fan et al., 2018a; Zhang et al., 2019). See (Vanschoren, 2018) for a comprehensive survey on meta-learning.
40
+
41
+ • Another purpose of this paper is to raise an awareness of the connection between MDP and numerical PDE solvers, and the general idea of how to use RL to improve PDE solvers or even finding brand new ones. Furthermore, in computational mathematics, a lot of numerical algorithms are sequential, and the computation at each step is expert-designed and usually greedy, e.g., the conjugate gradient method, the fast sweeping method (Zhao, 2005), matching pursuit (Mallat & Zhang, 1993), etc. We hope our work could motivate more researches in combining RL and computational mathematics, and stimulate more exploration on using RL as a tool to tackle the bottleneck problems in computational mathematics.
42
+
43
+ Our paper is organized as follows. In section 2 we briefly review 1-dimensional conservation laws and the WENO schemes. In section 3, we discuss how to formulate the process of numerically solving conservation laws into a Markov Decision Process. Then, we present details on how to train a policy network to mimic human expert in choosing discrete schemes in a spatial-temporary adaptive manner by learning upon WENO. In section 4, we conduct numerical experiments on 1-D conservation laws to demonstrate the performance of our trained policy network. Our experimental results show that the trained policy network indeed learned to adaptively choose good discrete schemes that offer better results than the state-of-the-art WENO scheme which is 5th order accurate in space and 4th order accurate in time. This serves as an evidence that the proposed RL framework has the potential to design high-performance numerical schemes for conservation laws in a data-driven fashion. Furthermore, the learned policy network generalizes well to other situations such as different initial conditions, mesh sizes, temporal discrete schemes, etc. The paper ends with a conclusion in section 5, where possible future research directions are also discussed.
44
+
45
+ # 2 PRELIMINARIES
46
+
47
+ # 2.1 NOTATIONS
48
+
49
+ In this paper, we consider solving the following 1-D conservation laws:
50
+
51
+ $$
52
+ u _ { t } ( x , t ) + f _ { x } ( u ( x , t ) ) = 0 , a \leq x \leq b , t \in [ 0 , T ] , u ( x , 0 ) = u _ { 0 } ( x ) .
53
+ $$
54
+
55
+ For example, $\begin{array} { r } { f = \frac { u ^ { 2 } } { 2 } } \end{array}$ is the famous Burger’s Equation. We discretize the $( x , t )$ -plane by choosing a mesh with spatial size and temporal step size $\Delta t$ , and define the discrete mesh points $( x _ { j } , t _ { n } )$ by
56
+
57
+ $$
58
+ x _ { j } = a + j \Delta x , \ t _ { n } = n \Delta t \quad { \mathrm { w i t h } } \ j = 0 , 1 , . . . , J = { \frac { b - a } { \Delta x } } , \ n = 0 , 1 , . . . , N = \frac { T } { \Delta t } .
59
+ $$
60
+
61
+ We denote $x _ { j + \frac { 1 } { 2 } } = x _ { j } + \Delta x / 2 = a + ( j + \textstyle { \frac { 1 } { 2 } } ) \Delta x$ . The finite difference methods will produce approximations $U _ { j } ^ { n }$ to the solution $u ( x _ { j } , t _ { n } )$ on the given discrete mesh points. We denote pointwise values of the true solution to be $u _ { j } ^ { n } = u ( x _ { j } , t _ { n } )$ , and the true point-wise flux values to be $f _ { j } ^ { n } = f ( u ( x _ { j } , t _ { n } ) )$ .
62
+
63
+ # 2.2 WENO – WEIGHTED ESSENTIALLY NON-OSCILLATORY SCHEMES
64
+
65
+ WENO (Weighted Essentially Non-Oscillatory) (Liu et al., 1994) is a family of high order accurate finite difference schemes for solving hyperbolic conservation laws, and has been successful for many practical problems. The key idea of WENO is a nonlinear adaptive procedure that automatically chooses the smoothest local stencil to reconstruct the numerical flux. Generally, a finite difference method solves Eq.1 by using a conservative approximation to the spatial derivative of the flux:
66
+
67
+ $$
68
+ \frac { d u _ { j } ( t ) } { d t } = - \frac { 1 } { \Delta x } \left( \hat { f } _ { j + \frac { 1 } { 2 } } - \hat { f } _ { j - \frac { 1 } { 2 } } \right) ,
69
+ $$
70
+
71
+ where $u _ { j } ( t )$ is the numerical approximation to the point value $u ( x _ { j } , t )$ and ${ \hat { f } } _ { j + { \frac { 1 } { 2 } } }$ is the numerical flux generated by a numerical flux policy
72
+
73
+ $$
74
+ { \hat { f } } _ { j + \frac { 1 } { 2 } } = { \pi } ^ { f } ( u _ { j - r } , . . . , u _ { j + s } ) ,
75
+ $$
76
+
77
+ which is manually designed. Note that the term “numerical flux policy" is a new terminology that we introduce in this paper, which is exactly the policy we shall learn using RL. In WENO, $\bar { \pi } ^ { f }$ works as follows. Using the physical flux values $\{ f _ { j - 2 } , f _ { j - 1 } , f _ { j } \}$ , we could obtain a $3 ^ { t h }$ order accurate polynomial interpolation $\hat { f } _ { j + \frac { 1 } { 2 } } ^ { - 2 }$ , where the indices $\{ j - 2 , j - 1 , j \}$ is called a ‘stencil’. We could also use the stencil $\hat { f } _ { j + \frac { 1 } { 2 } } ^ { - 1 } , \hat { f } _ { j + \frac { 1 } { 2 } } ^ { 0 }$ an $\{ j - 1 , j , j + 1 \}$ d ˆf 1j+ 12 . The key idea of WENO is to average (with properly designed weights) all , $\{ j , j { + } 1 , j { + } 2 \}$ or to obtain another three interpolants these interpolants to obtain the final reconstruction: $\begin{array} { r } { \hat { f } _ { j + \frac { 1 } { 2 } } = \sum _ { r = - 2 } ^ { 1 } w _ { r } \hat { f } _ { j + 1 / 2 } ^ { r } } \end{array}$ , $\scriptstyle \sum _ { r = - 2 } ^ { 1 } w _ { r } = 1$ .
78
+
79
+ The weight $w _ { i }$ depends on the smoothness of the stencil. A general principal is: the smoother is the stencil, the more accurate is the interpolant and hence the larger is the weight. To ensure convergence, we need the numerical scheme to be consistent and stable (LeVeque, 1992). It is known that WENO schemes as described above are consistent. For stability, upwinding is required in constructing the flux. The most easy way is to use the sign of the Roe speed $\bar { a } _ { j + \frac { 1 } { 2 } } = ( f _ { j + \frac { 1 } { 2 } } - f _ { j - \frac { 1 } { 2 } } ) / ( u _ { j + \frac { 1 } { 2 } } - u _ { j - \frac { 1 } { 2 } } )$ to determine the upwind direction: if $\bar { a } _ { j + \frac { 1 } { 2 } } \geq 0$ , we only average among the three interpolants $\hat { f } _ { j + \frac { 1 } { 2 } } ^ { - 2 }$ , $\hat { f } _ { j + \frac { 1 } { 2 } } ^ { - 1 }$ an d ˆf 0j+ 12 ; if a¯j+ 12 < 0, we use ˆf $\hat { f } _ { j + \frac { 1 } { 2 } } ^ { - 1 } , \hat { f } _ { j + \frac { 1 } { 2 } } ^ { 0 }$ and ˆf 1j + 12 .
80
+
81
+ Some further thoughts. WENO achieves optimal order of accuracy (up to 5) at the smooth region of the solutions (Shu, 1998), while lower order of accuracy at singularities. The key of the WENO method lies in how to compute the weight vector $( w _ { 1 } , w _ { 2 } , w _ { 3 } , w _ { 4 } )$ , which primarily depends on the smoothness of the solution at local stencils. In WENO, such smoothness is characterized by handcrafted formula, and was proven to be successful in many practical problems when coupled with high-order temporal discretization. However, it remains unknown whether there are better ways to combine the stencils so that optimal order of accuracy in smooth regions can be reserved while, at the same time, higher accuracy can be achieved near singularities. Furthermore, estimating the upwind directions is another key component of WENO, which can get quite complicated in high-dimensional situations and requires lots of logical judgments (i.e. “if/else"). Can we ease the (some time painful) coding and improve the estimation at the aid of machine learning?
82
+
83
+ # 3 METHODS
84
+
85
+ In this section we present how to employ reinforcement learning to solve the conservation laws given by Eq.1. To better illustrate our idea, we first show in general how to formulate the process of numerically solving a conservation law into an MDP. We then discuss how to incorporate a policy network with the WENO scheme. Our policy network targets at the following two key aspects of WENO: (1) Can we learn to choose better weights to combine the constructed fluxes? (2) Can we learn to automatically judge the upwind direction, without complicated logical judgments?
86
+
87
+ # 3.1 MDP FORMULATION
88
+
89
+ # Algorithm 1: A Conservation Law Solving Procedure
90
+
91
+ 1 Input: initial values $u _ { 0 } ^ { 0 } , u _ { 1 } ^ { 0 } , . . . , u _ { J } ^ { 0 }$ , flux $f ( u ) , \Delta x , \Delta t$ , evolve time $N$ , left shift $r$ and right shift $s$ .
92
+ 2 Output: $\{ U _ { j } ^ { n } | j = 0 , . . . , J , n = 1 , . . . , N \}$
93
+ 3 $U _ { j } ^ { 0 } = u _ { j } ^ { 0 }$ , $j = 0 , . . . , J$
94
+ 4 for $n = 1$ to $N$ do
95
+ 5 for $\overline { { j = 0 } }$ to $J$ do
96
+ 6 cal flux , e.g., u $\hat { f } _ { j - \frac { 1 } { 2 } } ^ { n } = \pi ^ { f } ( U _ { j - r - 1 } ^ { n - 1 } , U _ { j - r } ^ { n - 1 } , . . . , U _ { j + s - 1 } ^ { n - 1 } )$ U n−1j+s−1) and f $\hat { f } _ { j + \frac { 1 } { 2 } } ^ { n } = \pi ^ { f } ( U _ { j - r } ^ { n - 1 }$ ,
97
+ $U _ { j - r + 1 } ^ { n - 1 } , . . . , U _ { j + s } ^ { n - 1 } )$
98
+ 7 Compute $\begin{array} { r } { \frac { d u _ { j } ( t ) } { d t } = - \frac { 1 } { \Delta x } \big ( \hat { f } _ { { j + \frac { 1 } { 2 } } } ^ { n } - \hat { f } _ { { j - \frac { 1 } { 2 } } } ^ { n } \big ) } \end{array}$
99
+ 8 Compute U nj = πt(U n−1j , duj (t)dt ), e.g., using the Euler scheme U nj = U n−1j + ∆t duj (t)dt
100
+ 9 Return $\{ U _ { j } ^ { n } | j = 0 , . . . , J , n = 1 , . . . , N \}$
101
+
102
+ As shown in Algorithm 1, the procedure of numerically solving a conservation law is naturally a sequential decision making problem. The key of the procedure is the numerical flux policy $\pi ^ { f }$ and the temporal scheme $\pi ^ { t }$ as shown in line 6 and 8 in Algorithm 1. Both policies could be learned using RL. However, in this paper, we mainly focus on using RL to learn the numerical flux policy $\pi ^ { f }$ , while leaving the temporal scheme $\pi ^ { t }$ with traditional numerical schemes such as the Euler scheme or the Runge–Kutta methods. A quick review of RL is given in the appendix.
103
+
104
+ Now, we show how to formulate the above procedure as an MDP and the construction of the state $S$ , action $A$ , reward $r$ and transition dynamics $P$ . Algorithm 2 shows in general how RL is incorporated into the procedure. In Algorithm 2, we use a single RL agent. Specifically, when computing $U _ { j } ^ { n }$ :
105
+
106
+ • The state for the RL agent is $s _ { j } ^ { n } = g _ { s } ( U _ { j - r - 1 } ^ { n - 1 } , . . . , U _ { j + s } ^ { n - 1 } )$ , where $g _ { s }$ is the state function.
107
+
108
+ • In general, the action of the agent is used to determine how the numerical fluxes $\hat { f } _ { j + \frac { 1 } { 2 } } ^ { n }$ and $\hat { f } _ { j - \frac { 1 } { 2 } } ^ { n }$ is computed. In the next subsection, we detail how we incorporate $a _ { j } ^ { n }$ to be the linear weights of the fluxes computed using different stencils in the WENO scheme. • The reward should encourage the agent to generate a scheme that minimizes the error between its approximated value and the true value. Therefore, we define the reward function as $r _ { j } ^ { n } =$ $g _ { r } ( U _ { j - r - 1 } ^ { n } - u _ { j - r - 1 } ^ { n } , \cdot \cdot \cdot , U _ { j + s } ^ { n } - u _ { j + s } ^ { n } )$ , e.g., a simplest choice is $g _ { r } = - | | \cdot | | _ { 2 }$ . • The transition dynamics $P$ is fully deterministic, and depends on the choice of the temporal scheme at line 10 in Algorithm 2. Note that the next state can only be constructed when we have obtained all the point values in the next time step, i.e., n n $s _ { j } ^ { n + 1 } = \stackrel { \cdot } { g _ { s } } ( U _ { j - r - 1 } ^ { n } , . . . , U _ { j + s } ^ { n } )$ does not only depends on action $a _ { j } ^ { n }$ , but also on actions $a _ { j - r - 1 } ^ { n } , . . . , a _ { j + s } ^ { n }$ j−(action $a _ { j } ^ { n }$ j+scan only determine the value $U _ { j } ^ { n } .$ ). This subtlety can be resolved by viewing the process under the framework of multi-agent RL, in which at each mesh point $j$ we use a distinct agent $A _ { j } ^ { R L }$ , and the next state sn+1j = $s _ { j } ^ { n + 1 } = g _ { s } ( U _ { j - r - 1 } ^ { n } , . . . , U _ { j + s } ^ { n } )$ depends on these agents’ joint action $\mathbf { a } _ { \mathbf { j } } ^ { \mathbf { n } } = ( a _ { j - r - 1 } ^ { n } , . . . , a _ { j + s } ^ { n } )$
109
+
110
+ However, it is impractical to train $J$ different agents as $J$ is usually very large, therefore we enforce the agents at different mesh point $j$ to share the same weight, which reduces to case of using just a single agent. The single agent can be viewed as a counterpart of a human designer who decides on the choice of a local scheme based on the current state in traditional numerical methods.
111
+
112
+ # Algorithm 2: General RL Running Procedure
113
+
114
+ <table><tr><td rowspan="11">1 Input: initial values u8,.,u,flux f(u),△x,△t,evolve time N,left shift r, right shift s and RL policy πRL</td><td></td></tr><tr><td>2 Output: {U| j = 0,..,J, n = 1,.., N} U</td></tr><tr><td>=ug,j=0.,..J</td></tr><tr><td>forMany iterationsdo</td></tr><tr><td>Construct initial states s = gs(U𝑗-r-1,.,U}+s) for j =0.,., J</td></tr><tr><td>for n=1 to N do</td></tr><tr><td>forj=OtoJdo</td></tr><tr><td>7 Compute the action a = πRL(s)that determines how j fn and fn is computed</td></tr><tr><td>8 1 1 Jj+ duj(t) f一 Compute 1 fn 9</td></tr><tr><td>dt △x (Jj+ 1 ) +△tduj(t)</td></tr><tr><td>10 Compute the rewardr =gr(U-r-1-u_r-1,,U+s-u+s). , dt dt</td></tr><tr><td>11</td></tr><tr><td>=gs(u−r-1,,+s)forj=0,,J 12</td></tr><tr><td>13 )j=0.</td></tr><tr><td></td></tr></table>
115
+
116
+ 14 Return the well-trained RL policy $\pi ^ { R L }$
117
+
118
+ # 3.2 RL EMPOWERED WENO
119
+
120
+ We now present how to transfer the actions of the RL policy to the weights of WENO fluxes. Instead of directly using $\pi ^ { R L }$ to generate the numerical flux, we use it to produce the weights of numerical fluxes computed using different stencils in WENO. Since the weights are part of the configurations of the WENO scheme, our design of action essentially makes the RL policy a meta-learner, and enables more stable learning and better generalization power than directly generating the fluxes.
121
+
122
+ Specifically, at point $x _ { j }$ (here we drop the time superscript $n$ for simplicity), to compute the numerical flux ${ \hat { f } } _ { j - { \frac { 1 } { 2 } } }$ and ${ \hat { f } } _ { j + { \frac { 1 } { 2 } } }$ , we first construct four fluxes $\{ \hat { f } _ { j - \frac { 1 } { 2 } } ^ { i } \} _ { i = - 2 } ^ { 1 }$ and $\{ \hat { f } _ { j + \frac { 1 } { 2 } } ^ { i } \} _ { i = - 2 } ^ { 1 }$ using four different stencils just as in WENO, and then use the RL policy $\pi ^ { R L }$ to generate the weights of these fluxes:
123
+
124
+ $$
125
+ \pi ^ { R L } ( s _ { j } ) = \left( w _ { j - \frac { 1 } { 2 } } ^ { - 2 } , w _ { j - \frac { 1 } { 2 } } ^ { - 1 } , w _ { j - \frac { 1 } { 2 } } ^ { 0 } , w _ { j - \frac { 1 } { 2 } } ^ { 1 } , w _ { j + \frac { 1 } { 2 } } ^ { - 2 } , w _ { j + \frac { 1 } { 2 } } ^ { - 1 } , w _ { j + \frac { 1 } { 2 } } ^ { 0 } , w _ { j + \frac { 1 } { 2 } } ^ { 1 } \right) .
126
+ $$
127
+
128
+ onstructed by averaging these fluxes: $\begin{array} { r } { \hat { f } _ { j - \frac { 1 } { 2 } } = \sum _ { i = - 2 } ^ { 1 } w _ { j - \frac { 1 } { 2 } } ^ { i } \hat { f } _ { j - \frac { 1 } { 2 } } ^ { i } } \end{array}$ − 12 , and $\begin{array} { r } { \hat { f } _ { j + \frac { 1 } { 2 } } = \sum _ { i = - 2 } ^ { 1 } w _ { j + \frac { 1 } { 2 } } ^ { i } \hat { f } _ { j + \frac { 1 } { 2 } } ^ { i } . } \end{array}$
129
+
130
+ Note that the determination of upwind direction is automatically embedded in the RL policy since it generates four weights at once. For instance, when the roe speed $\bar { a } _ { j + \frac { 1 } { 2 } } \geq 0$ , we expect the $4 ^ { t h }$ weight $w _ { j + \frac { 1 } { 2 } } ^ { 1 } \approx 0$ and when $\bar { a } _ { j + \frac { 1 } { 2 } } < 0$ , we expect $w _ { j + \frac { 1 } { 2 } } ^ { - 2 } \approx 0$ . Note that the upwind direction can be very complicated in a system of equations or in the high-dimensional situations, and using the policy network to automatically embed such a process could save lots of efforts in algorithm design and implementation. Our numerical experiments show that $\pi ^ { R L }$ can indeed automatically determine upwind directions for 1D scalar cases. Although this does not mean that it works for systems and/or in high-dimensions, it shows the potential of the proposed framework and value for further studies.
131
+
132
+ # 4 EXPERIMENTS
133
+
134
+ In this section, we describe training and testing of the proposed RL conservation law solver and compare it with WENO. More comparisons and discussions can be found in the appendix.
135
+
136
+ # 4.1 SETUP
137
+
138
+ In this subsection, we explain the general training setup. We train the RL policy network on the Burger’s equation, whose flux is computed as $\begin{array} { r } { f ( u ) = \frac { 1 } { 2 } u ^ { 2 } } \end{array}$ . In all the experiments, we set the left-shift $r = 2$ and the right shift $s = 3$ . The state function $g _ { s } ( \overline { { \mathscr { s } } } _ { j } ) = g _ { s } ( U _ { j - r - 1 } , . . . , U _ { j + s } )$ will generate two vectors: $s ^ { l } = ( f _ { j - r - 1 } , . . . , f _ { j + s - 1 } , \bar { a } _ { j - \frac { 1 } { 2 } } )$ , and $s ^ { r } = ( f _ { j - r } , . . . , f _ { j + s } , \bar { a } _ { j + \frac { 1 } { 2 } } )$ for computing ${ \hat { f } } _ { j - { \frac { 1 } { 2 } } }$ and ${ \hat { f } } _ { j + { \frac { 1 } { 2 } } }$ respectively. $s _ { l }$ and $s _ { r }$ will be passed into the same policy neural network $\pi _ { \boldsymbol { \theta } } ^ { R L }$ to produce the desired actions, as described in section 3.2. The reward function $g _ { r }$ simply computes the infinity norm, i.e., $g _ { r } ( U _ { j - r - 1 } - u _ { j - r - 1 } , . . . , U _ { j + s } - u _ { j + s } ) = - | | ( U _ { j - r - 1 } - u _ { j - r - 1 } , . . . , \bar { U } _ { j + s } - u _ { j + s } ) | | _ { \infty } .$ . The policy network $\pi _ { \boldsymbol { \theta } } ^ { R L }$ is a feed-forward Multi-layer Perceptron with 6 hidden layers, each has 64 neurons and use Relu (Goodfellow et al., 2016) as the activation function. We use the Deep Deterministic Policy Gradient Algorithm (Lillicrap et al., 2015) to train the RL policy.
139
+
140
+ To guarantee the generalization power of the trained RL agent, we randomly sampled 20 initial conditions in the form $u _ { 0 } ( x ) = { \bigcirc } + b \cdot \operatorname { f u n c } ( c \pi x )$ , where $| \bar { a } | + | b | \leq 3 . 5$ , func $\in \{ s i n , c o s \}$ and $c \in \{ 2 , 4 , 6 \}$ . The goal of generating such kind of initial conditions is to ensure they have similar degree of smoothness and thus similar level of difficulty in learning. The computation domain is $- 1 \leq x \leq 1$ and $0 \leq t \leq 0 . 8$ with $\Delta x = 0 . 0 2$ , $\Delta t = 0 . 0 0 4$ , and evolve steps $N = 2 0 0$ (which ensures the appearance of shocks). When training the RL agent, we use the Euler scheme for temporal discretization. The true solution needed for reward computing is generated using WENO on the same computation domain with $\Delta x = 0 . 0 0 1$ , $\Delta t = 0 . 0 0 0 2$ and the 4th order Runge-Kutta (RK4).
141
+
142
+ In the following, we denote the policy network that generates the weights of the WENO fluxes (as described in section 3.2) as RL-WENO. We randomly generated another different 10 initial conditions in the same form as training for testing.
143
+
144
+ Table 1: Comparison of relative errors $( \times 1 0 ^ { - 2 } )$ of RL-WENO and WENO with standard deviations of the errors among 10 trials in the parenthesis. Temporal discretization: RK4; flux function: $\scriptstyle { \frac { 1 } { 2 } } u ^ { 2 }$ .
145
+
146
+ <table><tr><td rowspan=2 colspan=1>△x△t</td><td rowspan=1 colspan=2>0.02</td><td rowspan=1 colspan=2>0.04</td><td rowspan=1 colspan=2>0.05</td></tr><tr><td rowspan=1 colspan=1>RL-WENO</td><td rowspan=1 colspan=1>WENO</td><td rowspan=1 colspan=1>RL-WENO</td><td rowspan=1 colspan=1>WENO</td><td rowspan=1 colspan=1>RL-WENO</td><td rowspan=1 colspan=1>WENO</td></tr><tr><td rowspan=1 colspan=1>0.002</td><td rowspan=1 colspan=1>5.66 (1.59)</td><td rowspan=1 colspan=1>5.89 (1.74)</td><td rowspan=1 colspan=1>8.76 (2.50)</td><td rowspan=1 colspan=1>9.09 (2.62)</td><td rowspan=1 colspan=1>9.71 (2.42)</td><td rowspan=1 colspan=1>10.24 (2.84)</td></tr><tr><td rowspan=1 colspan=1>0.003</td><td rowspan=1 colspan=1>5.64 (1.54)</td><td rowspan=1 colspan=1>5.86 (1.67)</td><td rowspan=1 colspan=1>8.73 (2.46)</td><td rowspan=1 colspan=1>9.06 (2.58)</td><td rowspan=1 colspan=1>9.75 (2.41)</td><td rowspan=1 colspan=1>10.28 (2.81)</td></tr><tr><td rowspan=1 colspan=1>0.004</td><td rowspan=1 colspan=1>5.63 (1.55)</td><td rowspan=1 colspan=1>5.81 (1.66)</td><td rowspan=1 colspan=1>8.72 (2.46)</td><td rowspan=1 colspan=1>9.05 (2.55)</td><td rowspan=1 colspan=1>9.61 (2.42)</td><td rowspan=1 colspan=1>10.13 (2.84)</td></tr><tr><td rowspan=1 colspan=1>0.005</td><td rowspan=1 colspan=1>5.08 (1.46)</td><td rowspan=1 colspan=1>5.19 (1.58)</td><td rowspan=1 colspan=1>8.29 (2.34)</td><td rowspan=1 colspan=1>8.58 (2.47)</td><td rowspan=1 colspan=1>9.30 (2.26)</td><td rowspan=1 colspan=1>9.78 (2.69)</td></tr><tr><td rowspan=1 colspan=1>0.006</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>8.71 (2.49)</td><td rowspan=1 colspan=1>9.02 (2.61)</td><td rowspan=1 colspan=1>9.72 (2.38)</td><td rowspan=1 colspan=1>10.24 (2.80)</td></tr><tr><td rowspan=1 colspan=1>0.007</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>8.56 (2.49)</td><td rowspan=1 colspan=1>8.84 (2.62)</td><td rowspan=1 colspan=1>9.59 (2.41)</td><td rowspan=1 colspan=1>10.12 (2.80)</td></tr><tr><td rowspan=1 colspan=1>0.008</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>8.68 (2.55)</td><td rowspan=1 colspan=1>8.93 (2.66)</td><td rowspan=1 colspan=1>9.57 (2.49)</td><td rowspan=1 colspan=1>10.06 (2.92)</td></tr></table>
147
+
148
+ Table 2: Comparison of relative errors $( \times 1 0 ^ { - 2 } )$ of RL-WENO and WENO with standard deviations of the errors among 10 trials in the parenthesis. Temporal discretization: RK4; flux function: $\scriptstyle { \frac { 1 } { 1 6 } } u ^ { 4 }$ .
149
+
150
+ <table><tr><td rowspan=2 colspan=1>△x△t</td><td rowspan=1 colspan=2>0.02</td><td rowspan=1 colspan=2>0.04</td><td rowspan=1 colspan=2>0.05</td></tr><tr><td rowspan=1 colspan=1>RL-WENO</td><td rowspan=1 colspan=1>WENO</td><td rowspan=1 colspan=1>RL-WENO</td><td rowspan=1 colspan=1>WENO</td><td rowspan=1 colspan=1>RL-WENO</td><td rowspan=1 colspan=1>WENO</td></tr><tr><td rowspan=1 colspan=1>0.002</td><td rowspan=1 colspan=1>4.85 (1.15)</td><td rowspan=1 colspan=1>5.17 (1.26)</td><td rowspan=1 colspan=1>7.77 (1.95)</td><td rowspan=1 colspan=1>8.05 (2.02)</td><td rowspan=1 colspan=1>8.16 (1.93)</td><td rowspan=1 colspan=1>8.56 (2.19)</td></tr><tr><td rowspan=1 colspan=1>0.003</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>7.79 (1.96)</td><td rowspan=1 colspan=1>8.06 (2.03)</td><td rowspan=1 colspan=1>8.18 (1.92)</td><td rowspan=1 colspan=1>8.59 (2.18)</td></tr><tr><td rowspan=1 colspan=1>0.004</td><td rowspan=1 colspan=1>二</td><td rowspan=1 colspan=1>二</td><td rowspan=1 colspan=1>7.72 (1.93)</td><td rowspan=1 colspan=1>7.98 (2.01)</td><td rowspan=1 colspan=1>8.15 (1.95)</td><td rowspan=1 colspan=1>8.54 (2.20)</td></tr><tr><td rowspan=1 colspan=1>0.005</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.18 (1.94)</td><td rowspan=1 colspan=1>8.55 (2.15)</td></tr></table>
151
+
152
+ # 4.2 RESULTS
153
+
154
+ We compare the performance of RL-WENO and WENO. We also test whether the trained RL policy can generalize to different temporal discretization schemes, mesh sizes and flux functions that are not included in training. Table 1 and Table 2 present the comparison results, where the number shows the relative error (computed as ||U−u||2||u|| with the 2-norm taking over all x) between the approximated solution $U$ and the true solution $u$ , averaged over 250 evolving steps $T = 1 . 0$ ) and 10 random initial values. Numbers in the bracket shows the standard deviation over the 10 initial conditions. Several entries in the table are marked as ‘-’ because the corresponding CFL number is not small enough to guarantee convergence. Recall that training of the RL-WENO was conducted with Euler time discretization, $( \Delta x , \Delta t ) = ( 0 . 0 2 , 0 . 0 0 4 )$ , $T = 0 . 8$ and $\begin{array} { r } { f ( u ) = \frac { 1 } { 2 } u ^ { 2 } } \end{array}$ .
155
+
156
+ Our experimental results show that, compared with the high order accurate WENO (5th order accurate in space and 4th order accurate in time), the linear weights learned by RL not only achieves smaller errors, but also generalizes well to: 1) longer evolving time $T = 0 . 8$ for training and $T = 1 . 0$ for testing); 2) new time discretization schemes (trained on Euler, tested on RK4); 3) new mesh sizes (see Table 1 and Table 2 for results of varied $\Delta x$ and $\Delta t$ ); and 4) a new flux function (trained on $\begin{array} { r } { \dot { f } ( u ) = \frac { 1 } { 2 } u ^ { 2 } } \end{array}$ shown in Table 1, tested on $\scriptstyle { \frac { 1 } { 1 6 } } u ^ { 4 }$ Table 2).
157
+
158
+ Figure 1 shows some examples of the solutions. As one can see, the solutions generated by RL-WENO not only achieve the same accuracy as WENO at smooth regions, but also have clear advantage over WENO near singularities which is particularly challenging for numerical PDE solvers and important in applications. Figure 2 shows that the learned numerical flux policy can indeed correctly determine upwind directions and generate local numerical schemes in an adaptive fashion. More interestingly, Figure 2 further shows that comparing to WENO, RL-WENO seems to be able to select stencils in a different way from it, and eventually leads to a more accurate solution. This shows that the proposed RL framework has the potential to surpass human experts in designing numerical schemes for conservation laws.
159
+
160
+ ![](images/049a25870b4b0bef20a62a255c7558bada01c4e5293c345e5d3239f7fd743a16.jpg)
161
+ Figure 1: First row: solutions of RL-WENO (red), WENO (blue) and exact solutions (green). Second row: zoom-in views corresponding to the first row.
162
+
163
+ ![](images/f0d6377f47d74881b71ddd23684c41d376876f277c4535c3196dd91359330587.jpg)
164
+ Figure 2: This figure compares the weights generated by the learned numerical flux policy πthose of WENO. The weights shown in (a) are {wrj− 12 }1r=−2; while those in (b) are {wrj+ 12 } and . In each of the two plots, the 4 numbers in the upper bracket of each location are the weights of RLWENO and those in the lower bracket are the weights of WENO. The relative errors of RL-WENO and WENO are $8 . 0 \times 1 0 ^ { - 3 }$ and $2 . 5 \times 1 0 ^ { - 2 }$ respectively.
165
+
166
+ # 5 CONCLUSION
167
+
168
+ In this paper, we proposed a general framework to learn how to solve 1-dimensional conservation laws via deep reinforcement learning. We first discussed how the procedure of numerically solving conservation laws can be naturally cast in the form of Markov Decision Process. We then elaborated how to relate notions in numerical schemes of PDEs with those of reinforcement learning. In particular, we introduced a numerical flux policy which was able to decide on how numerical flux should be designed locally based on the current state of the solution. We carefully design the action of our RL policy to make it a meta-learner. Our numerical experiments showed that the proposed RL based solver was able to outperform high order WENO and was well generalized in various cases.
169
+
170
+ As part of the future works, we would like to consider using the numerical flux policy to inference more complicated numerical fluxes with guaranteed consistency and stability. Furthermore, we can use the proposed framework to learn a policy that can generate adaptive grids and the associated numerical schemes. Lastly, we would like consider system of conservation laws in 2nd and 3rd dimensional space.
171
+
172
+ # REFERENCES
173
+
174
+ 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.
175
+
176
+ Christian Beck, E Weinan, and Arnulf Jentzen. Machine learning approximation algorithms for highdimensional fully nonlinear partial differential equations and second-order backward stochastic differential equations. Journal of Nonlinear Science, pp. 1–57, 2017.
177
+
178
+ Samy Bengio, Yoshua Bengio, Jocelyn Cloutier, and Jan Gecsei. On the optimization of a synaptic learning rule. In Preprints Conf. Optimality in Artificial and Biological Neural Networks, pp. 6–8. Univ. of Texas, 1992.
179
+
180
+ Gert-Jan Both, Subham Choudhury, Pierre Sens, and Remy Kusters. Deepmod: Deep learning for model discovery in noisy data. arXiv preprint arXiv:1904.09406, 2019.
181
+
182
+ Bo Chang, Lili Meng, Eldad Haber, Frederick Tung, and David Begert. Multi-level residual networks from dynamical systems view. arXiv preprint arXiv:1710.10348, 2017.
183
+
184
+ Tian Qi Chen, Yulia Rubanova, Jesse Bettencourt, and David K Duvenaud. Neural ordinary differential equations. In Advances in Neural Information Processing Systems, pp. 6571–6583, 2018.
185
+
186
+ Niccolo’ Discacciati, Jan S Hesthaven, and Deep Ray. Controlling oscillations in high-order discontinuous galerkin schemes using artificial viscosity tuned by neural networks. Technical report, 2019.
187
+
188
+ Qingnan Fan, Dongdong Chen, Lu Yuan, Gang Hua, Nenghai Yu, and Baoquan Chen. Decouple learning for parameterized image operators. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 442–458, 2018a.
189
+
190
+ Yuwei Fan, Lin Lin, Lexing Ying, and Leonardo Zepeda-Núnez. A multiscale neural network based on hierarchical matrices. arXiv preprint arXiv:1807.01883, 2018b.
191
+
192
+ Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 1126–1135. JMLR. org, 2017.
193
+
194
+ Ian Goodfellow, Yoshua Bengio, and Aaron Courville. Deep learning. MIT press, 2016.
195
+
196
+ Jiequn Han, Arnulf Jentzen, and E Weinan. Solving high-dimensional partial differential equations using deep learning. Proceedings of the National Academy of Sciences, 115(34):8505–8510, 2018.
197
+
198
+ Silvia Jerez Galiano and Miguel Uh Zapata. A new tvd flux-limiter method for solving nonlinear hyperbolic equations. Journal of Computational and Applied Mathematics, 234(5):1395–1403, 2010.
199
+
200
+ Meiguang Jin, Stefan Roth, and Paolo Favaro. Noise-blind image deblurring. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 3510–3518, 2017.
201
+
202
+ Yuehaw Khoo and Lexing Ying. Switchnet: a neural network model for forward and inverse scattering problems. arXiv preprint arXiv:1810.09675, 2018.
203
+
204
+ Yuehaw Khoo, Jianfeng Lu, and Lexing Ying. Solving parametric pde problems with artificial neural networks. arXiv preprint arXiv:1707.03351, 2017.
205
+
206
+ Randall J LeVeque. Numerical methods for conservation laws, volume 132. Springer, 1992.
207
+
208
+ Randall J LeVeque. Finite volume methods for hyperbolic problems, volume 31. Cambridge university press, 2002.
209
+
210
+ Ke Li and Jitendra Malik. Learning to optimize. arXiv preprint arXiv:1606.01885, 2016.
211
+
212
+ Yingzhou Li, Jianfeng Lu, and Anqi Mao. Variational training of neural network approximations of solution maps for physical models. arXiv preprint arXiv:1905.02789, 2019.
213
+
214
+ Timothy P Lillicrap, Jonathan J Hunt, Alexander Pritzel, Nicolas Heess, Tom Erez, Yuval Tassa, David Silver, and Daan Wierstra. Continuous control with deep reinforcement learning. arXiv preprint arXiv:1509.02971, 2015.
215
+
216
+ Xu-Dong Liu, Stanley Osher, and Tony Chan. Weighted essentially non-oscillatory schemes. Journal of computational physics, 115(1):200–212, 1994.
217
+
218
+ Zichao Long, Yiping Lu, and Bin Dong. Pde-net 2.0: Learning pdes from data with a numericsymbolic hybrid deep network. arXiv preprint arXiv:1812.04426, 2018a.
219
+
220
+ Zichao Long, Yiping Lu, Xianzhong Ma, and Bin Dong. Pde-net: Learning pdes from data. In ICML, 2018b.
221
+
222
+ Yiping Lu, Aoxiao Zhong, Quanzheng Li, and Bin Dong. Beyond finite layer neural networks: Bridging deep architectures and numerical differential equations. In ICML, 2018.
223
+
224
+ Jim Magiera, Deep Ray, Jan S Hesthaven, and Christian Rohde. Constraint-aware neural networks for riemann problems. arXiv preprint arXiv:1904.12794, 2019.
225
+
226
+ Stéphane G Mallat and Zhifeng Zhang. Matching pursuits with time-frequency dictionaries. IEEE Transactions on signal processing, 41(12):3397–3415, 1993.
227
+
228
+ Craig Michoski, Milos Milosavljevic, Todd Oliver, and David Hatch. Solving irregular and dataenriched differential equations using deep neural networks. arXiv preprint arXiv:1905.04351, 2019.
229
+
230
+ 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.
231
+
232
+ Tong Qin, Kailiang Wu, and Dongbin Xiu. Data driven governing equations approximation using deep neural networks. arXiv preprint arXiv:1811.05537, 2018.
233
+
234
+ 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.
235
+
236
+ 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.
237
+
238
+ Deep Ray and Jan S Hesthaven. An artificial neural network as a troubled-cell indicator. Journal of Computational Physics, 367:166–191, 2018.
239
+
240
+ 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.
241
+
242
+ 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.
243
+
244
+ John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
245
+
246
+ Chi-Wang Shu. Essentially non-oscillatory and weighted essentially non-oscillatory schemes for hyperbolic conservation laws. In Advanced numerical approximation of nonlinear hyperbolic equations, pp. 325–432. Springer, 1998.
247
+
248
+ 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.
249
+
250
+ Joaquin Vanschoren. Meta-learning: A survey. arXiv preprint arXiv:1810.03548, 2018.
251
+
252
+ Shiyin Wei, Xiaowei Jin, and Hui Li. General solutions for nonlinear differential equations: a rule-based self-learning approach using deep reinforcement learning. Computational Mechanics, pp. 1–14, 2019.
253
+
254
+ E Weinan. A proposal on machine learning via dynamical systems. Communications in Mathematics and Statistics, 5(1):1–11, 2017.
255
+
256
+ Jason Hickey Michael P. Brenner Yohai Bar-Sinai, Stephan Hoyer. Data-driven discretization: a method for systematic coarse graining of partial differential equations. arXiv preprint arXiv:1808.04930, 2018.
257
+
258
+ Xiaoshuai Zhang, Yiping Lu, Jiaying Liu, and Bin Dong. Dynamically unfolding recurrent restorer: A moving endpoint control method for image restoration. ICLR, 2019.
259
+
260
+ Hongkai Zhao. A fast sweeping method for eikonal equations. Mathematics of computation, 74 (250):603–627, 2005.
261
+
262
+ # A COMPLEMENTARY EXPERIMENTS
263
+
264
+ # A.1 COMPARISON WITH SUPERVISED LEARNING (SL) BASED METHODS
265
+
266
+ We first note that most of the neural network based numerical PDE solvers cited in the introduction requires retraining when the initialization, terminal time, or the form of the PDE is changed; while the proposed RL solver is much less restricted as shown in our numerical experiments. This makes proper comparisons between existing NN-based solvers and our proposed solver very difficult. Therefore, to demonstrate the advantage of our proposed RL PDE solver, we would like to propose a new SL method that does not require retraining when the test setting (e.g. initialization, flux function, etc.) is different from the training.
267
+
268
+ However, as far as we are concerned, it is challenging to design such SL methods without formulating the problem into an MDP. One may think that we can use WENO to generate the weights for the stencil at a particular grid point on a dense grid, and use the weights of WENO generated from the dense grid as the label to train a neural network in the coarse grid. But such setting has a fatal flaw in that the stencils computed in the dense grids are very different from those in the coarse grids, especially near singularities. Therefore, good weights on dense grids might perform very poorly on coarse grids. In other words, simple imitation of WENO on dense grids is not a good idea. One might also argue that instead of learning the weights of the stencils, we could instead generate the discrete operators, sthe numerical fluxes $f _ { j + \frac { 1 } { 2 } } ( u ) , f _ { j - \frac { 1 } { 2 } } ( u ) .$ iscretization of , etc., on a dense $\frac { \partial u _ { j } } { \partial x }$ , or the temporal discretization of d, and then use them as labels to tr $\frac { \partial u _ { j } } { \partial t }$ , neural network in the supervised fashion on a coarse grid. However, the major problem with such design is that there is no guarantee that the learned discrete operators obey the conservation property of the equations, and thus they may also generalize very poorly.
269
+
270
+ After formulating the problem into a MDP, there is indeed one way that we can use back-propagation (BP) instead of RL algorithms to optimize the policy network. Because all the computations on using the stencils to calculate the next-step approximations are differentiable, we can indeed use SL to train the weights. One possible way is to minimize the error (e.g. 2 norm) between the approximated and the true values, where the true value is pre-computed using a more accurate discretization on a fine mesh. The framework to train the SL network is described in Algorithm 3. Note that the framework to train the SL network is essentially the same as that of the proposed RL-WENO (Algorithm 2). The only difference is that we train the SL network using BP and the RL network using DDPG.
271
+
272
+ # Algorithm 3: Using BP instead of RL algorithm to train the policy
273
+
274
+ 1 Input: initial values $u _ { 0 } ^ { 0 } , . . . , u _ { J } ^ { 0 }$ , flux $f ( u ) , \Delta x , \Delta t .$ evolve time $N$ , left shift $r$ , right shift $s$ and a neural network
275
+ πθ
276
+ 2 Output: $\{ U _ { j } ^ { n } | j = 0 , . . . , J , n = 1 , . . . , N \}$
277
+ 3 $U _ { j } ^ { 0 } = u _ { j } ^ { 0 } , j = 0 , . . . , J$
278
+ 4 for Many iterations do
279
+ 5 Construct initial states $s _ { j } ^ { 0 } = g _ { s } ( U _ { j - r - 1 } ^ { 0 } , . . . , U _ { j + s } ^ { 0 } )$ for $j = 0 , . . . , J$
280
+ 6 for $n = 1$ to $N$ do
281
+ 7 for Compute the weights (wn,−2j− 1 , ${ \overline { { j = 0 } } }$ to $J$ do $( w _ { j - \frac { 1 } { 2 } } ^ { n , - 2 } , w _ { j - \frac { 1 } { 2 } } ^ { n , - 1 } , w _ { j - \frac { 1 } { 2 } } ^ { n , 0 } , w _ { j - \frac { 1 } { 2 } } ^ { n , 1 } , w _ { j + \frac { 1 } { 2 } } ^ { n , - 2 } , w _ { j + \frac { 1 } { 2 } } ^ { n , - 1 } , w _ { j + \frac { 1 } { 2 } } ^ { n , 0 } , w _ { j + \frac { 1 } { 2 } } ^ { n , 1 } ) = \pi ^ { \theta } ( s _ { j } ^ { n } )$
282
+ 9 Compute the fluxes $\begin{array} { r } { \hat { f } _ { j - \frac { 1 } { 2 } } ^ { n } = \sum _ { i = - 2 } ^ { 1 } w _ { j - \frac { 1 } { 2 } } ^ { n , i } \hat { f } _ { j - \frac { 1 } { 2 } } ^ { n , i } , \hat { f } _ { j + \frac { 1 } { 2 } } = \sum _ { i = - 2 } ^ { 1 } w _ { j + \frac { 1 } { 2 } } ^ { i } \hat { f } _ { j + \frac { 1 } { 2 } } ^ { n , i } } \end{array}$ f j + 12 , where $\hat { f } _ { j \pm \frac { 1 } { 2 } } ^ { n , i }$ are
283
+ 10 the fluxeCompute $\begin{array} { r } { \frac { d u _ { j } ( t ) } { d t } = - \frac { 1 } { \Delta x } ( \hat { f } _ { { j + \frac { 1 } { 2 } } } ^ { n } - \hat { f } _ { { j - \frac { 1 } { 2 } } } ^ { n } ) } \end{array}$
284
+ 11 Compute U nj = πt(U n−1j , duj (t) ), e.g., the Euler scheme U nj = U n−1j $\begin{array} { r } { U _ { j } ^ { n } = U _ { j } ^ { n - 1 } + \Delta t \frac { d u _ { j } ( t ) } { d t } } \end{array}$
285
+ 12 Compute the loss for $\theta$ :
286
+ $L _ { j } ^ { n } ( \theta ) = | | ( U _ { j - r - 1 } ^ { n } - u _ { j - r - 1 } ^ { n } , \cdot \cdot , U _ { j + s } ^ { n } - u _ { j + s } ^ { n } ) - ( U _ { j - r - 1 } ^ { n } - u _ { j - r - 1 } ^ { n } , \cdot \cdot , U _ { j + s } ^ { n } - u _ { j + s } ^ { n } ) | | _ { 2 } ^ { 2 } .$
287
+ 13 Perform a gradient descent on $\theta$ w.r.t $L _ { j } ^ { n } ( \theta )$
288
+
289
+ Construct the next states $s _ { j } ^ { n + 1 } = g _ { s } ( u _ { j - r - 1 } ^ { n } , . . . , u _ { j + s } ^ { n } )$ for $j = 0 , . . . , J$
290
+
291
+ 15 Return the BP optimized policy $\pi ^ { \theta }$ .
292
+
293
+ However, we argue that the main drawback of using SL (BP) to optimize the stencils in such a way is that it cannot enforce long-term accuracy and thus cannot outperform the proposed RL-WENO. To support such claims, we have added experiments using SL to train the weights of the stencils, and the results are shown in table 3 and 4. The SL policy is trained till it achieves very low loss (i.e., converges) in the training setting. However, as shown in the table, the SL-trained policy does not perform well overall. To improve longer time stability, one may argue that we could design the loss of SL to be the accumulated loss over multiple prediction steps, but in practice as the dynamics of our problem (computations for obtaining multiple step approximations) is highly non-linear, thus the gradient flow through multiple steps can be highly numerically unstable, making it difficult to obtain a decent result.
294
+
295
+ Table 3: Comparison of relative errors $( \times 1 0 ^ { - 2 } )$ of RL-WENO, WENO, and SL-trained policy with standard deviations of the errors among 10 trials in the parenthesis. Temporal discretization: RK4; flux function: $\scriptstyle { \frac { 1 } { 2 } } u ^ { 2 }$ . RL-weno consistently outperforms WENO and SL-trained policy in all test cases.
296
+
297
+ <table><tr><td rowspan=2 colspan=1>△x△t</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>0.02</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>0.04</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>0.05</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>RL-WENO</td><td rowspan=1 colspan=1>SL</td><td rowspan=1 colspan=1>WENO</td><td rowspan=1 colspan=1>RL-WENO</td><td rowspan=1 colspan=1>SL</td><td rowspan=1 colspan=1>WENO</td><td rowspan=1 colspan=1>RL-WENO</td><td rowspan=1 colspan=1>SL</td><td rowspan=1 colspan=1>WENO</td></tr><tr><td rowspan=1 colspan=1>0.002</td><td rowspan=1 colspan=1>5.66 (1.59)</td><td rowspan=1 colspan=1>7.86 (1.23)</td><td rowspan=1 colspan=1>5.89 (1.74)</td><td rowspan=1 colspan=1>8.76 (2.50)</td><td rowspan=1 colspan=1>12.48 (0.78)</td><td rowspan=1 colspan=1>9.09 (2.62)</td><td rowspan=1 colspan=1>9.71 (2.42)</td><td rowspan=1 colspan=1>12.14 (0.44)</td><td rowspan=1 colspan=1>10.24 (2.84)</td></tr><tr><td rowspan=1 colspan=1>0.003</td><td rowspan=1 colspan=1>5.64 (1.54)</td><td rowspan=1 colspan=1>7.77 (1.26)</td><td rowspan=1 colspan=1>5.86 (1.67)</td><td rowspan=1 colspan=1>8.73 (2.46)</td><td rowspan=1 colspan=1>12.44 (0.78)</td><td rowspan=1 colspan=1>9.06 (2.58)</td><td rowspan=1 colspan=1>9.75 (2.41)</td><td rowspan=1 colspan=1>12.13 (0.41)</td><td rowspan=1 colspan=1>10.28 (2.81)</td></tr><tr><td rowspan=1 colspan=1>0.004</td><td rowspan=1 colspan=1>5.63 (1.55)</td><td rowspan=1 colspan=1>7.72 (1.14)</td><td rowspan=1 colspan=1>5.81 (1.66)</td><td rowspan=1 colspan=1>8.72 (2.46)</td><td rowspan=1 colspan=1>12.44 (0.64)</td><td rowspan=1 colspan=1>9.05 (2.55)</td><td rowspan=1 colspan=1>9.61 (2.42)</td><td rowspan=1 colspan=1>12.14 (0.45)</td><td rowspan=1 colspan=1>10.13 (2.84)</td></tr><tr><td rowspan=1 colspan=1>0.005</td><td rowspan=1 colspan=1>5.08 (1.46)</td><td rowspan=1 colspan=1>7.14 (1.37)</td><td rowspan=1 colspan=1>5.19 (1.58)</td><td rowspan=1 colspan=1>8.29 (2.34)</td><td rowspan=1 colspan=1>12.06 (0.86)</td><td rowspan=1 colspan=1>8.58 (2.47)</td><td rowspan=1 colspan=1>9.30 (2.26)</td><td rowspan=1 colspan=1>11.86 (0.38)</td><td rowspan=1 colspan=1>9.78 (2.69)</td></tr><tr><td rowspan=1 colspan=1>0.006</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.71 (2.49)</td><td rowspan=1 colspan=1>12.33 (0.73)</td><td rowspan=1 colspan=1>9.02 (2.61)</td><td rowspan=1 colspan=1>9.72 (2.38)</td><td rowspan=1 colspan=1>12.14 (0.41)</td><td rowspan=1 colspan=1>10.24 (2.80)</td></tr><tr><td rowspan=1 colspan=1>0.007</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.56 (2.49)</td><td rowspan=1 colspan=1>12.29 (0.83)</td><td rowspan=1 colspan=1>8.84 (2.62)</td><td rowspan=1 colspan=1>9.59 (2.41)</td><td rowspan=1 colspan=1>12.06 (0.45)</td><td rowspan=1 colspan=1>10.12 (2.80)</td></tr><tr><td rowspan=1 colspan=1>0.008</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.68 (2.55)</td><td rowspan=1 colspan=1>12.22 (0.70)</td><td rowspan=1 colspan=1>8.93 (2.66)</td><td rowspan=1 colspan=1>9.57 (2.49)</td><td rowspan=1 colspan=1>12.08 (0.46)</td><td rowspan=1 colspan=1>10.06 (2.92)</td></tr></table>
298
+
299
+ <table><tr><td rowspan="2">△x △t</td><td colspan="3">0.02</td><td colspan="3">0.04</td><td colspan="3">0.05</td></tr><tr><td>RL-WENO</td><td>SL</td><td>WENO</td><td>RL-WENO</td><td>SL</td><td>WENO</td><td>RL-WENO</td><td>SL</td><td>WENO</td></tr><tr><td>0.002</td><td>4.85 (1.15)</td><td>5.84 (0.79)</td><td>5.17(1.26)</td><td>7.77 (1.95)</td><td>8.60(1.12)</td><td>8.05 (2.02)</td><td>8.16 (1.93)</td><td>8.42 (1.00)</td><td>8.56(2.19)</td></tr><tr><td>0.003</td><td>-</td><td>-</td><td>-</td><td>7.79 (1.96)</td><td>8.62 (1.12)</td><td>8.06 (2.03)</td><td>7.70 (1.96)</td><td>8.42 (0.98)</td><td>8.59 (2.18)</td></tr><tr><td>0.004</td><td>-</td><td>-</td><td>-</td><td>7.72 (1.93)</td><td>8.55 (1.15)</td><td>7.98 (2.01)</td><td>8.15 (1.95)</td><td>8.41 (1.02)</td><td>8.54 (2.20)</td></tr><tr><td>0.005</td><td>-</td><td>-</td><td>-</td><td>-</td><td></td><td>-</td><td>8.18 (1.94)</td><td>8.40 (1.03)</td><td>8.55 (2.15)</td></tr></table>
300
+
301
+ Table 4: Comparison of relative errors $( \times 1 0 ^ { - 2 } )$ of RL-WENO, WENO, and SL-trained policy with standard deviations of the errors among 10 trials in the parenthesis. Temporal discretization: RK4; flux function: $\scriptstyle { \frac { 1 } { 2 } } u ^ { 4 }$ . RL-weno consistently outperforms WENO and SL-trained policy in all test cases.
302
+
303
+ # A.2 RL-WENO’S PERFORMANCE ON SMOOTH AND SINGULAR REGIONS
304
+
305
+ As mentioned in section 2.2, WENO itself already achieves an optimal order of accuracy in the smooth regions. Since RL-WENO can further improve upon WENO, it must have obtained higher accuracy especially near singularities. Here we provide additional demonstrations on how RL-WENO performs in the smooth/singular regions. We run RL-WENO and WENO on a set of initial conditions, and record the approximation errors at every locations and then separate the errors in the smooth and singular regions for every time step. We then compute the distribution of the errors on the entire spatial-temporal grids with multiple initial conditions. The results are shown in figure 3. In figure 3, the $x$ -axis is the logarithmic (base 10) value of the error and the y-axis is the number of grid points whose error is less than the corresponding value on the $x$ -axis, i.e., the accumulated distribution of the errors. The results show that RL-WENO indeed performs better than WENO near singularities. RL-WENO even achieves better accuracy than WENO in the smooth region when the flux function is 116 u 4 .
306
+
307
+ # A.3 INFERENCE TIME OF RL-WENO AND WENO
308
+
309
+ In this subsection we report the inference time of RL-WENO and WENO. Although the computation complexity of the trained RL policy (a MLP) is higher than that of WENO, we could parallel and accelerate the computations using GPU.
310
+
311
+ Our test is conducted in the following way: for each grid size $\Delta x$ , we fix the initial condition as $u _ { 0 } ( x ) = 1 + c o s ( 6 \pi x )$ , the evolving time $T = 0 . 8$ and the flux function $f = u ^ { 2 }$ . We then use RL-WENO and WENO to solve the problem 20 times, and report the average running time. For completeness, we also report the relative error of RL-WENO and WENO in each of these grid sizes in table 6. Note that the relative error is computed on average of several initial functions, and our RL-WENO policy is only trained on grid $( \Delta \dot { x } , \Delta t ) = ( 0 . 0 2 , \dot { 0 } . 0 0 4 )$ .
312
+
313
+ ![](images/70edbc56bd523eaa94e7feb588b9e798ddd1472b272f4eb5a9500c86b40a60b9.jpg)
314
+ Figure 3: These figures show the total number of grids whose error is under a specific value (i.e. the accumulated distribution function). The $x$ -axis is the error in logarithmic (base 10) scale. (a) and (c) show the distribution in smooth regions, (b) and (d) are near singularities.
315
+
316
+ For RL-WENO, we test it on both CPU and on GPU; For WENO, we test it purely on CPU, with a well-optimized version (e.g., good numpy vectorization in python), and a poor-implemented version (e.g., no vectorization, lots of loops). The CPU used for the tests is a custom Intel CORE i7, and the GPU is a custom NVIDIA GTX 1080. The results are shown in table 5.
317
+
318
+ Table 5: Average inference time (in seconds) for RL-WENO and WENO. Bold numbers are the smallest ones.
319
+
320
+ <table><tr><td>(△x,△t)</td><td>RL-WENO(CPU)</td><td>RL-WENO(GPU)</td><td>WENO-optimized</td><td>WENO-poor</td></tr><tr><td>(0.02, 0.004)</td><td>2.490</td><td>1.650</td><td>0.148</td><td>2.739</td></tr><tr><td>(0.01, 0.002)</td><td>7.720</td><td>1.700</td><td>0.349</td><td>10.778</td></tr><tr><td>(0.005, 0.001)</td><td>26.70</td><td>1.628</td><td>0.921</td><td>44.23</td></tr><tr><td>(0.002,0.0004)</td><td>110.92</td><td>1.611</td><td>1.961</td><td>277.88</td></tr></table>
321
+
322
+ <table><tr><td>(△x,△t)</td><td>RL-WENO error</td><td>WENO error</td></tr><tr><td>(0.02,0.004)</td><td>3.73(0.40)</td><td>4.08(0.23)</td></tr><tr><td>(0.01, 0.002)</td><td>1.86(0.17)</td><td>1.99(0.12)</td></tr><tr><td>(0.005,0.001)</td><td>1.00(0.05)</td><td>0.93(0.01)</td></tr><tr><td>(0.002, 0.0004)</td><td>0.48(0.03)</td><td>0.39(0.02)</td></tr></table>
323
+
324
+ Table 6: Relative error of RL-WENO and WENO $( \times 1 0 ^ { - 2 } )$ on grid sizes tested in table 5. Note RL-WENO is only trained on grid $( \Delta x , \Delta t ) = ( 0 . 0 2 , 0 . 0 0 4 )$
325
+
326
+ From the table we can tell that as $\Delta x$ decreases, i.e., as the grid becomes denser, all methods, except for the RL-WENO (GPU), requires significant more time to finish the computation. The reason that the time cost of the GPU-version of RL-WENO does not grow is that on GPU, we can compute all approximations in the next step (i.e., to compute $( U _ { 0 } ^ { t + 1 } , U _ { 1 } ^ { t + 1 } , . . . , U _ { J } ^ { t + 1 } )$ given $( U _ { 0 } ^ { t } , U _ { 1 } ^ { t } , . . . , U _ { J } ^ { t } )$ , which dominates the computation cost of the algorithm) together in parallel. Thus, the increase of grids does not affect much of the computation time. Therefore, for coarse grid, well-optimized WENO indeed has clear speed advantage over RL-WENO (even on GPU), but on a much denser grid, RL-WENO (GPU) can be faster than well-optimized WENO by leveraging the paralleling nature of the algorithm.
327
+
328
+ # B REVIEW OF REINFORCEMENT LEARNING
329
+
330
+ # B.1 REINFORCEMENT LEARNING
331
+
332
+ Reinforcement Learning (RL) is a general framework for solving sequential decision making problems. Recently, combined with deep neural networks, RL has achieved great success in various tasks such as playing video games from raw screen inputs (Mnih et al., 2015), playing Go (Silver et al., 2016), and robotics control (Schulman et al., 2017). The sequential decision making problem RL tackles is usually formulated as a Markov Decision Process (MDP), which comprises five elements: the state space $S$ , the action space $A$ , the reward $r : S \times A \mathcal { R }$ , the transition probability of the environment $P : S \times A \times S [ 0 , 1 ]$ , and the discounting factor $\gamma$ . The interactions between an RL agent and the environment forms a trajectory $\tau = ( s _ { 0 } , a _ { 0 } , r _ { 0 } , . . . , s _ { T } , a _ { T } , r _ { T } , . . . )$ . The return of $\tau$ is the discounted sum of all its future rewards:
333
+
334
+ $$
335
+ G ( \tau ) = \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } r _ { t }
336
+ $$
337
+
338
+ Similarly, the return of a state-action pair $\left( { { s _ { t } } , { a _ { t } } } \right)$ is:
339
+
340
+ $$
341
+ G ( s _ { t } , a _ { t } ) = \sum _ { l = t } ^ { \infty } \gamma ^ { l - t } r _ { l }
342
+ $$
343
+
344
+ A policy $\pi$ in RL is a probability distribution on the action $A$ given a state $S$ : $\pi : S \times A \to [ 0 , 1 ]$ . We say a trajectory $\tau$ is generated under policy $\pi$ if all the actions along the trajectory is chosen following $\pi$ , i.e., $\tau \sim \pi$ means $a _ { t } \sim \pi ( \cdot | s _ { t } )$ and $s _ { t + 1 } \sim P ( \cdot | s _ { t } , a _ { t } )$ . Given a policy $\pi$ , the value of a state $s$ is defined as the expected return of all the trajectories when the agent starts at $s$ and then follows $\pi$ :
345
+
346
+ $$
347
+ V ^ { \pi } ( s ) = { \cal E } _ { \tau } [ G ( \tau ) | \tau ( s _ { 0 } ) = s , \tau \sim \pi ]
348
+ $$
349
+
350
+ Similarly, the value of a state-action pair is defined as the expected return of all trajectories when the agent starts at $s$ , takes action $a$ , and then follows $\pi$ :
351
+
352
+ $$
353
+ Q ^ { \pi } ( s , a ) = E _ { \tau } [ G ( \tau ) | \tau ( s _ { 0 } ) = s , \tau ( a _ { 0 } ) = a , \tau \sim \pi ]
354
+ $$
355
+
356
+ As aforementioned in introduction, in most RL algorithms the policy $\pi$ is optimized with regards to the values $Q ^ { \pi } ( s , a )$ , thus naturally guarantees the long-term accumulated rewards (in our setting, the long-term accuracy of the learned schemes). Bellman Equation, one of the most important equations in RL, connects the value of a state and the value of its successor state:
357
+
358
+ $$
359
+ \begin{array} { c } { { Q ^ { \pi } ( s , a ) = r ( s , a ) + \gamma E _ { s ^ { \prime } \sim P ( \cdot \vert s , a ) , a ^ { \prime } \sim \pi ( \cdot \vert s ^ { \prime } ) } [ Q ^ { \pi } ( s ^ { \prime } , a ^ { \prime } ) ] } } \\ { { V ^ { \pi } ( s ) = E _ { a \sim \pi ( \cdot \vert s ) , s ^ { \prime } \sim P ( \cdot \vert s ^ { \prime } , a ) } [ r ( s , a ) + \gamma V ^ { \pi } ( s ^ { \prime } ) ] } } \end{array}
360
+ $$
361
+
362
+ The goal of RL is to find a policy $\pi$ to maximize the expected discounted sum of rewards starting from the initial state $s _ { 0 }$ , $J ( \pi ) = E _ { s _ { 0 } \sim \rho } [ V ^ { \pi } ( s _ { 0 } ) ]$ , where $\rho$ is the initial state distribution. If we parameterize $\pi$ using $\theta$ , then we can optimize it using the famous policy gradient theorem:
363
+
364
+ $$
365
+ \frac { d J ( \pi _ { \theta } ) } { d \theta } = E _ { s \sim \rho ^ { \pi _ { \theta } } , a \sim \pi _ { \theta } } [ \nabla _ { \theta } \mathrm { l o g } \pi _ { \theta } ( a | s ) Q ^ { \pi _ { \theta } } ( s , a ) ]
366
+ $$
367
+
368
+ where $\rho ^ { \pi _ { \theta } }$ is the state distribution deduced by the policy $\pi _ { \theta }$ . In this paper we focus on the case where the action space $A$ is continuous, and a lot of mature algorithms has been proposed for such a case, e.g., the Deep Deterministic Policy Gradient (DDPG) (Lillicrap et al., 2015), the Trust Region Policy Optimization algorithm (Schulman et al., 2015), and etc.
md/train/s95BePNvykX/s95BePNvykX.md ADDED
@@ -0,0 +1,255 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Video Instance Segmentation using Inter-Frame Communication Transformers
2
+
3
+ Sukjun Hwang1 Miran Heo1 Seoung Wug Oh2 Seon Joo Kim1 1Yonsei University 2Adobe Research {sj.hwang, miran, seonjookim}@yonsei.ac.kr seoh@adobe.com
4
+
5
+ # Abstract
6
+
7
+ We propose a novel end-to-end solution for video instance segmentation (VIS) based on transformers. Recently, the per-clip pipeline shows superior performance over per-frame methods leveraging richer information from multiple frames. However, previous per-clip models require heavy computation and memory usage to achieve frame-to-frame communications, limiting practicality. In this work, we propose Inter-frame Communication Transformers (IFC), which significantly reduces the overhead for information-passing between frames by efficiently encoding the context within the input clip. Specifically, we propose to utilize concise memory tokens as a means of conveying information as well as summarizing each frame scene. The features of each frame are enriched and correlated with other frames through exchange of information between the precisely encoded memory tokens. We validate our method on the latest benchmark sets and achieved state-of-the-art performance (AP 42.6 on YouTube-VIS 2019 val set using the offline inference) while having a considerably fast runtime (89.4 FPS). Our method can also be applied to near-online inference for processing a video in real-time with only a small delay. The code is available at https://github.com/sukjunhwang/IFC.
8
+
9
+ # 1 Introduction
10
+
11
+ With the growing interest toward the video domain in computer vision, the task of video instance segmentation (VIS) is emerging [1]. Most of the current approaches [1, 2, 3, 4] extend image instance segmentation models [5, 6, 7, 8] and take frame-wise inputs. These per-frame methods extend the concept of temporal tracking by matching frame-wise predictions of high similarities. The models can be easily customized to real-world applications as they run in an online [9] fashion, but they show limitations in dealing with occlusions and motion blur that are common in videos.
12
+
13
+ On the contrary, per-clip models are designed to overcome such challenges by incorporating multiple frames while sacrificing the efficiency. Previous per-clip approaches [10, 11, 12] aggregate information within a clip to generate instance-specific features. As the features are generated per instance, the number of instances in addition to the number of frames has a significant impact on the overall computation. Recently proposed VisTR [11] adapted DETR [13] to the VIS task and reduced the inference time by inserting the entire video, not a clip, to its offline end-to-end network. However, its full self-attention transformers [14] over the space-time inputs involve explosive computations and memories. In this work, we raise the following question: can a per-clip method be efficient while attaining great accuracy?
14
+
15
+ To achieve our goal, we introduce Inter-frame Communication Transformers (IFC) to greatly reduce the computations of the full space-time transformers. Similar to recent works [15, 16, 17] that alleviate the explosive computational growth inherent in attention-based models [14, 18], IFC takes a decomposition strategy utilizing two transformers. The first transformer (Encode-Receive, $\mathcal { E }$ ) encodes each frame independently. To exchange the information between frames, the second transformer (Gather-Communicate, $\mathcal { G }$ ) executes attention between a small number of memory tokens that hold concise information of the clip. The memory tokens are utilized to store the overall context of the clip, for example “a hand over a lizard” in Fig. 1. The concise information assists detecting the lizard that is largely occluded by the hand in the first frame, without employing an expensive pixel-level attention over space and time. The memory tokens are only in charge of the communications between frames, and the features of each frame are enriched and correlated through the memory tokens.
16
+
17
+ We further reduce overheads while taking advantage of per-clip pipelines by concisely representing each instance with a unique convolutional weight [7]. Despite the changes of appearances at different frames, the instances of the same identity share commonalities because the frames originated from the same source video. Therefore, we can effectively capture instance-specific characteristics in a clip with dynamically generated convolutional weights. In companion with the segmentation, we track instances by uniformly applying the weights to all frames in a clip. Moreover, all executions of our spatial decoder are instance-agnostic except for the final layer which applies instance-specific weights. Accordingly, our model is highly efficient and also suitable for scenes with numerous instances.
18
+
19
+ In addition to the efficient modeling, we provide optimizations and an instance tracking algorithm that are designed to be VIS-centric. By the definition of $\mathsf { A P } ^ { \mathtt { V I S } }$ , the VIS task [1] aims to maximize the objective similarity: space-time mask IoU. Inspired by previous works [13, 19, 20], our model is optimized to maximize the similarity between bipartitely matched pairs of ground truth masks and predicted masks. Furthermore, we again adopt the similarity maximization for tracking instances of same identities, which effectively links predicted space-time masks using bipartite matching. As both of our training and inference algorithms are fundamentally designed to address the key challenge of VIS task, our method attains an outstanding accuracy.
20
+
21
+ From these improvements, IFC sets the new state-of-the-art: $4 2 . 6 \%$ AP and more surprisingly, in 89.4 fps. Furthermore, our model also shows great speed-accuracy balance under near-online settings, which leads to a huge practicality. We believe that our model can be a powerful baseline for video instance segmentation approaches that follow the per-clip execution.
22
+
23
+ # 2 Related Work
24
+
25
+ Video instance segmentation The VIS task [1] extends the concept of tracking to the image instance segmentation task. The early solutions [1, 2] follow the per-frame pipeline, which utilize additional tracking head to the models that are mainly designed to solve image instance segmentation. More advanced algorithms that are recently proposed [3, 4] take video characteristics into consideration, which result in improved performance.
26
+
27
+ Per-clip models [10, 11, 12] dedicate computations to extract information from multiple frames for higher accuracy. By exploiting multiple frames, per-clip models can effectively handle typical challenges in video, i.e., motion blurs and occlusions. Our model is designed to be highly efficient while following the per-clip pipeline, which leads to fast and accurate predictions.
28
+
29
+ Transformers Recently, transformers [14] are greatly impacting many tasks in computer vision. After the huge success of DETR [13], which has brought a new paradigm to the object detection task, numerous vision tasks are incorporating transformers [21, 22] in place of CNNs. For classification tasks in both NLP and computer vision, many adopt an extra classification token to the input of transformers [21, 23]. All the input tokens affect each other as the encoders are mainly composed of the self-attention, thus the classification token can be used to determine the class of the overall input. Similarly, DeiT [24] inserts an additional distillation token to transformers, and the novel usage leads to a higher data efficiency. MaX-DeepLab [20] adopted the concept of memory and proposed a novel dual-path transformer for the panoptic segmentation task [25]. By making use of numerous memory tokens to convey information, MaX-DeepLab integrates the transformer and the CNN by making both feedback itself and the other.
30
+
31
+ We further utilize the concept of the memory tokens to the videos. Using Inter-frame Communication Transformers, each frame runs independently while sharing their information with interim communications. The communications lead to higher accuracy while the execution independence between frames accelerates the inference.
32
+
33
+ ![](images/38190ff2e29f8cfb09f1e13cb0bf969f482baa8226d8a40c6907883122649d66.jpg)
34
+ Figure 1: Overview of IFC framework. Our transformer encoder block has two components: 1) Encode-Receive $( \mathcal { E } )$ simultaneously encodes frame tokens and memory tokens. 2) Only memory tokens pass Gather-Communicate $( { \mathcal { G } } )$ to perform communications between frames. The output from the stack of $N _ { E }$ encoder blocks goes into two modules, spatial decoder and transformer decoder, to generate segmentation masks.
35
+
36
+ # 3 Method
37
+
38
+ The proposed method follows a per-clip pipeline which takes a video clip as input and outputs clip-level results. We also introduce Inter-frame Communication Transformers, which can effectively share frame-wise information within a clip with a high efficiency.
39
+
40
+ # 3.1 Model architecture
41
+
42
+ Inspired by DETR [13], our network consists of a CNN backbone and transformer encoder-decoder layers (Fig. 1). The input clip is first independently embedded into a feature map through the backbone. Then, the embedded clip passes through our inter-frame communication encoder blocks that enrich the feature map by allowing information exchange between frames. Next, a set of transformer decoder layers that take the encoder outputs and object queries as inputs predict unique convolutional weights for each instance in the clip. Finally, the masks for each instance across the clip are computed in one shot by convolving the encoded feature map with the unique convolutional weight.
43
+
44
+ Backbone Given an input clip $\{ x _ { i } \} _ { i = 1 } ^ { T } \ \in \ \mathbb { R } ^ { T \times H _ { 0 } \times W _ { 0 } \times 3 }$ , composed of $T$ frames with 3 color channels, the CNN backbone processes the input clip frame-by-frame. As the result, the clip is encoded into a set of low-resolution features, $\bar { \{ f _ { i } ^ { 0 } \} _ { i = 1 } ^ { T } } \in \mathbb { R } ^ { T \times H \times W \times C }$ , where $C$ is the number of channels and $\begin{array} { r } { H , W = \frac { H _ { 0 } } { 3 2 } , \frac { W _ { 0 } } { 3 2 } } \end{array}$ .
45
+
46
+ Inter-Frame Communication Encoder Given an image, humans can effortlessly summarize the scene with only a few words. Also, frames from a same video share a lot of commonalities, the difference between them is sufficiently summarized and communicated even with a small bandwidth. Based on this hypothesis, we propose an inter-frame communication encoder to make the computation to be mostly frame-wise independent with some communications between frames. Specifically, we adopt memory tokens for both summarizing per-frame scenes and the means of communications.
47
+
48
+ Our encoder blocks are composed of two phases of separate transformers: Encode-Receive $( \mathcal { E } )$ and Gather-Communicate $( { \mathcal { G } } )$ . Both Encode-Receive and Gather-Communicate follow the typical transformer encoder architecture [14], which consists of an addition of fixed positional encoding, a multi-head self-attention module, and a feed forward network.
49
+
50
+ Encode-Receive operates in a per-frame manner, taking a frame-level feature map and corresponding memory tokens. Passing through Encode-Receive, we expect two functionalities: (1) image features encode per-frame information to the memory tokens, and (2) image features receive information of different frames that are gathered in the memory tokens. Gather-Communicate operates across frames to form a clip-level knowledge. It takes the memory tokens from each frame as inputs and performs communications between frames. Alternating two phases through multiple layers, the encoder can efficiently learn consensus representations across frames.
51
+
52
+ Table 1: Complexity comparison. Various transformer encoders for space-time input. As the overall FLOPs can vary by the number of detected instances, listed values are measured only at the encoders.
53
+
54
+ <table><tr><td rowspan="3">Communication Type</td><td rowspan="3">Complexity per Layer</td><td colspan="4">FLOPs (G)1</td></tr><tr><td></td><td>360 × 640</td><td></td><td>720×1280</td></tr><tr><td>T=5</td><td>T=36</td><td>T=5</td><td>T=36</td></tr><tr><td>No Comm</td><td>O(C²THW + CT(HW)2)</td><td>5.17</td><td>37.23</td><td>24.62</td><td>177.29</td></tr><tr><td>Full THW</td><td>O(C²THW + C(THW)2)</td><td>6.94</td><td>148.70</td><td>50.63</td><td>1815.38</td></tr><tr><td>Decompose T-HW</td><td>O(C²THW + CT(HW)² + CT²HW)</td><td>8.33</td><td>60.24</td><td>36.73</td><td>265.50</td></tr><tr><td>IFC (M = 8)</td><td>O(C²THW +CT(HW)2)</td><td>5.52</td><td>39.73</td><td>25.05</td><td>180.39</td></tr></table>
55
+
56
+ In more detail, given the frame embedding $\{ f _ { i } ^ { 0 } \} _ { i = 1 } ^ { T }$ , we spatially flatten each feature $\mathbb { R } ^ { H \times W \times C } $ $\mathbb { R } ^ { H W \times C }$ . The initial memory tokens $m ^ { 0 }$ of size $M$ are copied per frame and concatenated to each frame feature as follows:
57
+
58
+ $$
59
+ [ f _ { t } ^ { 0 } , m _ { t } ^ { 0 } ] \in \mathbb { R } ^ { ( H W + M ) \times C } , \qquad t \in \{ 1 , 2 , \cdots , T \} ,
60
+ $$
61
+
62
+ where $[ \cdot , \cdot ]$ indicates a concatenation of two feature vectors. Note that the initial memory tokens $m ^ { 0 }$ are trainable parameters learnt during training.
63
+
64
+ The first phase of IFC is Encode-Receive, which processes frames individually as follows:
65
+
66
+ $$
67
+ [ f _ { t } ^ { l } , \widehat { m } _ { t } ^ { l } ] = \mathcal { E } ^ { l } ( [ f _ { t } ^ { l - 1 } , m _ { t } ^ { l - 1 } ] ) ,
68
+ $$
69
+
70
+ where ${ \mathcal { E } } ^ { l }$ denotes the $l$ -th Encode-Receive layer. With a self-attention computed over the frame pixel locations and the memory tokens, the information of each frame can be passed to the memory tokens and vise-versa.
71
+
72
+ The outputs of Encode-Receive are grouped by memory indices and formulate the inputs for GatherCommunicate layer. The grouping can be understood as a decomposition of memory tokens, and becomes computationally beneficial when the total size of gathered memory tokens increases.
73
+
74
+ $$
75
+ \begin{array} { r l } & { [ m _ { 1 } ^ { l } ( i ) , m _ { 2 } ^ { l } ( i ) , \cdots , m _ { T } ^ { l } ( i ) ] = \mathcal { G } ^ { l } ( [ \widehat { m } _ { 1 } ^ { l } ( i ) , \widehat { m } _ { 2 } ^ { l } ( i ) , \cdots , \widehat { m } _ { T } ^ { l } ( i ) ] ) , \qquad i \in \{ 1 , 2 , \cdots , M \} , } \end{array}
76
+ $$
77
+
78
+ where $\mathcal { G } ^ { l }$ denotes the $l$ -th Gather-Communicate layer. The processed outputs are redistributed to the originated frame and get concatenated as $m _ { t } \overset { \cdot } { = } \left[ m _ { t } ( 1 ) , \overset { \cdot } { m } _ { t } ( 2 ) , \cdot \cdot \cdot , \overset { \cdot } { m } _ { t } ( M ) \right]$ . Unlike EncodeReceive, Gather-Communicate utilizes the attention mechanism to convey the information from different frames over the input clip.
79
+
80
+ Defining the $l$ -th inter-frame encoder block $( \mathrm { I F C } ^ { l } )$ as ${ \mathcal { E } } ^ { l }$ followed by $\mathcal { G } ^ { l }$ , the stack of $N _ { E }$ encoder blocks can be inductively formulated as:
81
+
82
+ $$
83
+ [ f _ { t } ^ { l } , m _ { t } ^ { l } ] = \mathrm { I F C } ^ { l } ( [ f _ { t } ^ { l - 1 } , m _ { t } ^ { l - 1 } ] ) , \qquad 1 \leq l \leq N _ { E } ,
84
+ $$
85
+
86
+ where $\left[ f _ { t } ^ { N _ { E } } , m _ { t } ^ { N _ { E } } \right]$ is the final result. The stacking of multiple encoder layers brings communications between frames, thus each frame can have coincidence to the other, specifying the identities of instances in a given clip.
87
+
88
+ Complexity comparison In Table 1, we analyze the computational complexity of transformer encoder variants applied for video input in terms of the Big-O complexity and FLOPs. The complexity of the original transformer encoder layer [14] is $\mathcal { O } ( C ^ { 2 } N ^ { ' } { + } C N ^ { 2 } )$ , where $N$ is the number of inputs. Without any communication between frames, No Comm, it shows the smallest amount of computation $( { \mathcal O } ( C ^ { 2 } T \dot { H W } + C T ( H W ) ^ { 2 } ) )$ ). As indicated as Full THW in Table 1, the complexity of VisTR [11] that performs a full space-time self-attention is $\mathcal { O } ( C ^ { 2 } ( T H W ) + C ( T H W ) ^ { 2 } )$ thus either a higher resolution or an increase of number of input frames leads to a massive increase in computations. VisTR bypasses the problem by highly reducing the input resolution and utilizing GPUs with tremendous memory capacity. However, as such solutions cannot resolve the fundamental issues, it is impractical to real-world videos. Moreover, VisTR remains as a complete offline strategy because it takes the entire video as an input.
89
+
90
+ An intriguing improvement for the naïve full self-attention would be the decomposition of the attention into space and time axis [16, 17, 26]. In Decompose T-HW, we decompose attention computation into spatial and temporal attention. The complexity of the separation of space-time leads to the sum of the two transformer encoder: $\mathcal { O } ( T ( C ^ { 2 } ( H \bar { W } ) + \bar { C } ( H W ) ^ { 2 } ) )$ and $\mathcal { O } ( H \bar { W } ( C ^ { 2 } T + C T ^ { 2 } ) )$ . In comparison to the full self-attention, the decomposition lowers the computational growth relative to the number of frames.
91
+
92
+ Our encoder, IFC, that communicates between frames using the memory tokens leads to a huge benefit to the total computations adding only a small amount of computation over No Comm while providing sufficient channels for communication. The complexity of each phase in our proposed encoder is: $\mathcal { O } ( C ^ { 2 } T ( H W + M ) + C T ( H W + M ) ^ { 2 } )$ for Encode-Receive and $\mathcal { O } ( C ^ { 2 } T M + \bar { C } \bar { T } ^ { 2 } M )$ for Gather-Communicate respectively. Assuming that $M$ is kept small (e.g., 8), the computation needed for Gather-Communicate can be neglected, while the complexity of Encode-Receive can be approximated to $\mathcal { O } ( C ^ { 2 } T H W + C T ( H W ) ^ { 2 } )$ as shown in Table 1. Finally, with respect to the number of frames of the input, we can expect approximate linear increase rather than the high increase of computation occurred in VisTR.
93
+
94
+ Decoders and output heads As depicted in Fig. 1, the transformer decoder of our model is stacked with $N _ { D }$ layers [14]. Contrary to VisTR, where the number of object queries increases proportionally to the number of frames, our model receives learnt encodings of fixed size $N _ { q }$ for object queries. Also, by utilizing these encodings throughout the entire frames, our model can effectively deal with clips of various lengths. A set of projection matrices are applied to $\{ f _ { t } ^ { N _ { E } } , m _ { t } ^ { N _ { E } } \} _ { t = 1 } ^ { T }$ for the generation of keys and values. The object queries turn into output embeddings by the transformer decoder, and the embeddings are eventually used as an input to the output heads.
95
+
96
+ There are two output heads on top of the transformer decoder, a class head and a segmentation head, each composed of two fully-connected layers. The output embeddings from the transformer decoder are independently inserted to the heads, resulting in $N _ { q }$ predictions per a clip. The class head outputs a class probability distribution of instances $\hat { p } ( c ) \in \mathbb { R } ^ { N _ { q } \times | \mathbb { C } | }$ . Note that the possible classes $\mathbb { C } \ni c$ include no object $\mathcal { D }$ class in addition to the given classes of a dataset.
97
+
98
+ The segmentation head generates $N _ { q }$ conditional convolutional weights $w \in \mathbb { R } ^ { N _ { q } \times C }$ in a manner similar to [7, 20]. For the conditional convolution, the output feature of the encoder reused by undoing the flatten operation. For the upsampling, the encoder feature pa $\{ f _ { t } ^ { N _ { E } } \} _ { t = 1 } ^ { T }$ isgh fpn-style [27] spatial decoder without temporal connections resulting in $T$ feature maps that are $1 / 8$ of the input resolution. Finally, the resulting feature maps $f ^ { \prime }$ are convolved with each convolutional weight to generate a segmentation mask as follows:
99
+
100
+ $$
101
+ \hat { s } _ { i } = \{ f _ { t } ^ { \prime } \circ w _ { i } \} _ { t = 1 } ^ { T } ,
102
+ $$
103
+
104
+ where $w _ { i }$ is $i$ -th convolutional weight, $\circ$ indicate $1 \times 1$ spatial convolution operation, and the result $\hat { s _ { i } }$ is a spatial-temporal object mask in shape of $\mathbb { R } ^ { T \times H ^ { \prime } \times W ^ { \prime } }$ where $\begin{array} { r } { H ^ { \prime } = \frac { H _ { 0 } } { 8 } } \end{array}$ , $\begin{array} { r } { W ^ { \prime } = \frac { W _ { 0 } } { 8 } } \\ { . } \end{array}$ . Note that, for an instance, a common weight is applied throughout the video clip. Our spatial decoder is an instanceagnostic design, which is much more efficient than instance-specific decoders [10, 11, 12, 13] as the number of detected instances increases. Meanwhile, thanks to our segmentation head which specifies and captures the characteristics of an instance, IFC can conduct both segmentation and tracking at once within a clip.
105
+
106
+ # 3.2 Instance matching and loss
107
+
108
+ To train our network, we first assign the ground truth for each instance estimation and then a set of loss function between each the ground truth and prediction pair. For a given input clip, our model generate a fixed-size set of class-labeled masks $\{ \hat { y } _ { i } \} _ { i = 1 } ^ { N _ { q } } = \{ ( \hat { p } _ { i } ( \boldsymbol { c } ) , \hat { s } _ { i } ) \} _ { i = 1 } ^ { N _ { q } }$ . The ground truth set of the clip can be represented as $y _ { i } = ( c _ { i } , s _ { i } )$ ; $c _ { i }$ is the target class label including $\mathcal { D }$ , and $s _ { i }$ is the target mask which is down-sampled to the size of the prediction masks for efficient similarity calculation. One-to-one bipartite matching between the prediction set $\{ \hat { y } _ { i } \} _ { i = 1 } ^ { N _ { q } }$ and the ground truth set $\{ y _ { i } \} _ { i = 1 } ^ { K }$ is performed to find the best assignment of a prediction to a ground truth. The objective can be formally
109
+
110
+ described as:
111
+
112
+ $$
113
+ \hat { \sigma } = \underset { \sigma \in \mathfrak { S } _ { N _ { q } } } { \arg \operatorname* { m a x } } \sum _ { i = 1 } ^ { K } \sin ( y _ { i } , \hat { y } _ { \sigma ( i ) } ) ,
114
+ $$
115
+
116
+ where $\sin ( y _ { i } , \hat { y } _ { \sigma ( i ) } )$ refers a pair-wise similarity over a permutation of $\underset { \_ w } { \sigma } \in \mathfrak { S } _ { N _ { g } }$ . Following prior work [13, 20, 28], the bipartite matching is efficiently computed using Hungarian algorithm [19]. We find that box-based similarity measurement as used in DETR [13] shows weaknesses in matching instances in video clip due to the case of occlusion and disappear-and-reappear. Therefore, we define $\sin ( y _ { i } , \hat { y } _ { \sigma ( i ) } )$ to be mask-based term as $\mathbb { 1 } _ { \{ c _ { i } \neq \infty \} } [ \hat { p } _ { \sigma ( i ) } ( c _ { i } ) + \bar { \lambda } _ { 0 } \mathrm { D I C E } ( s _ { i } , \bar { \hat { s } } _ { \sigma ( i ) } ^ { - } ) ]$ , where DICE denotes dice coefficients [29].
117
+
118
+ Given the optimal assignment $\hat { \sigma }$ , we refer to the $K$ matched predictions and $( N _ { q } - K )$ non-matched predictions as positive and negative pairs respectively. The positive pairs aim to predict the ground truth masks and classes while the negative pairs are optimized to predict the $\mathcal { D }$ class. The final loss is a sum of the losses from positive pairs and negative pairs where each can be computed as follows:
119
+
120
+ $$
121
+ \begin{array} { r l } & { \mathcal { L } _ { p o s } = \displaystyle \sum _ { i = 1 } ^ { K } [ \underbrace { - \log \hat { p } _ { \hat { \sigma } ( i ) } ( c _ { i } ) } _ { \mathrm { C r o s s - e n t r o p y ~ l o s s } } + \lambda _ { 1 } ( \underbrace { 1 - \operatorname { D I C E } \bigl ( s _ { i } , \hat { s } _ { \hat { \sigma } ( i ) } \bigr ) } _ { \mathrm { D i c e ~ l o s s ~ } [ 2 9 ] } ) + \lambda _ { 2 } \underbrace { \operatorname { F O C A L } \bigl ( s _ { i } , \hat { s } _ { \hat { \sigma } ( i ) } \bigr ) } _ { \mathrm { S i g m o i d - f o c a l ~ l o s s ~ } [ 3 0 ] } ] , } \\ & { \quad \quad \quad \quad \quad \quad \mathcal { L } _ { n e g } = \displaystyle \sum _ { i = k + 1 } ^ { N _ { q } } [ - \log \hat { p } _ { \hat { \sigma } ( i ) } ( \emptyset ) ] . } \end{array}
122
+ $$
123
+
124
+ As $( N _ { q } - K )$ is likely to be much greater than $K$ , we down-weight $\mathcal { L } _ { n e g }$ by a factor of 10 to resolve the imbalance, following prior work [13]. The goal of video instance segmentation [1] is to maximize the space-time IoU between a prediction and a ground truth mask. Therefore, our mask-related losses (Dice loss and Sigmoid-focal loss) are spatio-temporally calculated over an entire clip, rather than averaging the losses that are accumulated frame-by-frame.
125
+
126
+ # 3.3 Clip-level instance tracking
127
+
128
+ To infer a video input that is longer than the clip length, we match instances using the predicted masks of overlapping frames. Let $\mathcal { V } _ { I }$ and ${ \mathcal { V } } _ { A }$ be the result sets of clip $I$ and $A$ excluding the $\mathcal { D }$ class. The goal is to perform matching of same identities between pre-collected instance set $\mathcal { V } _ { I }$ and $\mathcal { V } _ { A }$ . We first calculate the matching scores which are space-time soft IoU at intersecting frames between $\mathcal { V } _ { I }$ and $\mathcal { V } _ { A }$ . Then, we find optimal paired indices $\hat { \sigma } _ { S }$ using Hungarian algorithm [19] to the gathered matching score $\mathcal { S } \in [ 0 , \bar { 1 ] } ^ { | \mathcal { N } _ { I } | \times | \bar { \mathcal { V } } _ { A } | }$ . We update $\mathscr { D } _ { I } ( i )$ by concatenating $\mathcal { V } _ { A } ( \hat { \sigma } _ { S } ( i ) )$ if $\bar { \cal S } ( i , \bar { \sigma } s ( i ) )$ is above a certain threshold, and add non-matched prediction sets to $\mathcal { V } _ { I }$ as new instances. Note that a previous per-clip model (MaskProp [10]) also utilizes soft IoU for tracking instances, but the matching scores are computed per-frame and averaged for intersecting frames. Different from MaskProp, using space-time soft IoU leads to an accurate tracking as it can better represent the definition of mask similarities between clips which brings at most $2 \%$ AP increase. The overall tracking pipeline can be effectively implemented in a GPU-friendly manner.
129
+
130
+ # 4 Experiments
131
+
132
+ In this section, we evaluate the proposed method using YouTube-VIS 2019 and 2021 [1]. For every listed score, we report the mean of five runs as the results may vary by each run due to the insufficient number of training and testing set of YouTube-VIS dataset. We demonstrate the effectiveness of our model regarding both accuracy and speed. We further examine how different settings affect the overall performance and efficiency of IFC encoder. Unless specified, all models for measurements used $\bar { N _ { E } } = 3 , \bar { N _ { D } } = 3$ , stride of 1, and ResNet-50.
133
+
134
+ # 4.1 Implementation Details
135
+
136
+ We used detectron2 [33] for our code basis, and hyper-parameters mostly follow the settings of DETR [13] unless specified. We used AdamW [34] optimizer with initial learning rate of $1 0 ^ { - 4 }$ for transformers, and $1 \bar { 0 } ^ { - 5 }$ for backbone. We first pre-train the model for image instance segmentation on COCO [35] by setting our model to $T = 1$ . The pre-train procedure follows the shortened training schedule of DETR [13], which runs 300 epochs with a decay of the learning rate by a factor of 10 at 200 epochs. Using the pre-trained weights, the models are trained on a targeted dataset using the batch size of 16, each clip composed of $T = 5$ frames downscaled to either $3 6 0 \mathrm { p }$ or $4 8 0 \mathrm { p }$ . For the sampling of each clip, a reference frame index $t$ is randomly chosen. The remaining $T - 1$ frame indices are then sampled within an interval of 20. The models are trained for 8 epochs, and decays the learning rate by 10 at 5th epoch.
137
+
138
+ Table 2: Evaluations on various settings.
139
+ (a) AP and FPS on YouTube-VIS 2019 val set. For fairness, FPS is measured on a same machine, using a single RTX 2080Ti GPU. We used the official codes and checkpoints provided by the authors for the measurements. We report the clip settings of [10, 11]. T : window size.
140
+ (b) Accuracy on YTVIS 2021 val set
141
+ (d) Effect of strides
142
+
143
+ <table><tr><td colspan="3">Method (Settings)</td><td>Backbone [31]</td><td>FPS²</td><td>AP</td><td>AP50</td><td>AP75</td><td>AR1</td><td>AR10</td></tr><tr><td rowspan="9">prij.ite</td><td colspan="2">MaskTrack R-CNN[1]</td><td>ResNet-50</td><td>26.1</td><td>30.3</td><td>51.1</td><td>32.6</td><td>31.0</td><td>35.5</td></tr><tr><td colspan="2">MaskTrack R-CNN[1]</td><td>ResNet-101</td><td>=</td><td>31.8</td><td>53.0</td><td>33.6</td><td>33.2</td><td>37.6</td></tr><tr><td colspan="2">SipMask [2]</td><td>ResNet-50</td><td>35.5</td><td>33.7</td><td>54.1</td><td>35.8</td><td>35.4</td><td>40.1</td></tr><tr><td colspan="2">SG-Net [4]</td><td>ResNet-50</td><td>1</td><td>34.8</td><td>56.1</td><td>36.8</td><td>35.8</td><td>40.8</td></tr><tr><td colspan="2">SG-Net [4]</td><td>ResNet-101</td><td>1</td><td>36.3</td><td>57.1</td><td>39.6</td><td>35.9</td><td>43.0</td></tr><tr><td colspan="2">Cross VIS [3]</td><td>ResNet-50</td><td>=</td><td>36.3</td><td>56.8</td><td>38.9</td><td>35.6</td><td>40.7</td></tr><tr><td colspan="2">Cross VIS [3]</td><td>ResNet-101</td><td>1</td><td>36.6</td><td>57.3</td><td>39.7</td><td>36.0</td><td>42.0</td></tr><tr><td colspan="2">STEm-Seg [32]</td><td>ResNet-101</td><td>3.0</td><td>34.6</td><td>55.8</td><td>37.9</td><td>34.4</td><td>41.6</td></tr><tr><td rowspan="7">VisTR[11]</td><td>VisTR[11]</td><td>(T=36)</td><td>ResNet-50</td><td>51.1</td><td>35.6</td><td>56.8</td><td>37.0</td><td>35.2</td><td>40.2</td></tr><tr><td></td><td>(T=36)</td><td>ResNet-101</td><td>43.5</td><td>38.6</td><td>61.3</td><td>42.3</td><td>37.6</td><td>44.2</td></tr><tr><td>MaskProp[10]</td><td>(T=13)</td><td>ResNet-50</td><td>1</td><td>40.0</td><td>1</td><td>42.9</td><td>1</td><td>-</td></tr><tr><td>MaskProp [10]</td><td>(T=13)</td><td>ResNet-101</td><td>1</td><td>42.5</td><td>1</td><td>45.6</td><td>1</td><td>1</td></tr><tr><td>OurSnear-online</td><td>(T=5)</td><td>ResNet-50</td><td>46.5</td><td>39.0</td><td>60.4</td><td>42.7</td><td>41.7</td><td>51.6</td></tr><tr><td>OurSoffline</td><td>(T=36)</td><td>ResNet-50</td><td>107.1</td><td>41.2</td><td>65.1</td><td>44.6</td><td>42.3</td><td>49.6</td></tr><tr><td>OurSoffline</td><td>(T=36)</td><td>ResNet-101</td><td>89.4</td><td>42.6</td><td>66.6</td><td>46.3</td><td>43.5</td><td>51.4</td></tr></table>
144
+
145
+ (c) Bipartite matching
146
+
147
+ <table><tr><td></td><td>AP</td></tr><tr><td>Box-based</td><td>37.5</td></tr><tr><td>Mask-based</td><td>39.6</td></tr></table>
148
+
149
+ <table><tr><td></td><td>AP</td><td>AP50</td><td>AP75</td></tr><tr><td>MaskTrack-RCNN</td><td>28.6</td><td>48.9</td><td>29.6</td></tr><tr><td>SipMask</td><td>31.7</td><td>52.5</td><td>34.0</td></tr><tr><td>CrossVIS</td><td>34.2</td><td>54.4</td><td>37.9</td></tr><tr><td>Ours</td><td>35.2</td><td>57.2</td><td>37.5</td></tr></table>
150
+
151
+ <table><tr><td></td><td>AP</td><td>AP75</td><td>FPS</td></tr><tr><td>T=5</td><td>S=3 S=5</td><td>38.7 42.1</td><td>72.7</td></tr><tr><td>T=10</td><td>39.5</td><td>42.8</td><td>83.0</td></tr><tr><td>T=15 S=8</td><td>39.7</td><td>43.0</td><td>92.5</td></tr><tr><td>T=20 S=10</td><td>40.4</td><td>43.3</td><td>95.7</td></tr></table>
152
+
153
+ During inference, our model takes inputs as follows. Let an input video has $V$ frames, $T$ is the number of frames per clip and $S$ is the stride of clips. We start from inserting a clip of frame indices $[ 1 , T ]$ and sequentially insert clips of $[ 1 + S , T + \bar { S } ] , [ 1 + 2 S , T + 2 S ] , \therefore , [ 1 + n S , T + n S ]$ . It repeats until the end frame index $T + n S$ is equal to or greater than $V$ . If the end frame index of the last clip $T + n S$ is greater than $V$ , we change the frame indices of the last clip to $[ V - T + 1 , V ]$ . The resolution of input videos are downscaled to $3 6 0 \mathrm { p }$ , which follows MaskTrack R-CNN [1].
154
+
155
+ # 4.2 Main Results
156
+
157
+ YouTube-VIS 2019 evaluation results We compare our proposed IFC to the state-of-the-art models in the video instance segmentation task on YouTube-VIS $2 0 1 9 \ \mathtt { v a l }$ in Table 2 (a). We measure the accuracy by AP and our model sets the highest score among all online, near-online, and offline models while presenting the fastest runtime. As mentioned earlier, IFC is highly efficient during the inference thanks to three advantages: (1) memory token-based decomposition for transformer encoder (2) instance-agnostic spatial decoder (3) GPU-friendly instance matching. Moreover, our model does not make use of any heavy modules such as deformable convolutions [36] or cascading networks [37]. Thanks to these advantages, IFC achieves an outstanding runtime, which is faster speed than online models [1, 2].
158
+
159
+ During the inference, our method is able to freely adjust the length of the clip $( T )$ as needed. If the input clip length is set to contain entire video frames, our method becomes an offline method (like
160
+
161
+ ![](images/670bbd204f67e3d539074c5cfb25f24385665e804acb9763ac21417ab8d1c742.jpg)
162
+ Figure 2: Visualization of predictions from VisTR and our model. Instances with the same identity are displayed in the same color.
163
+
164
+ VisTR [11]) that processes the entire video in one shot. As the offline inference can skip matching between clips and maximize the GPU utilization, our method represents surprisingly fast runtime (107.1 FPS). On the other hand, if the application requires instant outputs given a video stream, we can reduce the clip length to make our method near-online. In the near-online scenario with $T = 5$ our system is still able to process a video in real-time (46.5 FPS) with only a small delay.
165
+
166
+ YouTube-VIS 2021 evaluation results The recently introduced dataset YouTube-VIS 2021 is an improved version of YouTube-VIS 2019. The newly added videos in the dataset include higher number of instances and frames. For the new dataset, we use 32 memory tokens. In Table 2 (b), we refer the results reported in [3], which evaluated [1, 2] using official implementations. Again, our model achieves the best performance.
167
+
168
+ Qualitative result comparison We compare some qualitative results predicted by our model and VisTR [11] in Fig. 2. In terms of both tracking accuracy and segmentation quality, IFC yields better results than VisTR.
169
+
170
+ # 4.3 Ablation Study
171
+
172
+ In this section, we provide ablation studies and discuss how different settings impact the overall performance. The experiments are conducted using YouTube-VIS 2019 val set.
173
+
174
+ Box-based and mask-based bipartite matching We observe how the different policies for bipartite matching affect the performance. As our model does is a box-free method, we adjust our model to predict bounding boxes similar to VisTR [11] and conduct bipartite matching [13, 19] using the predicted boxes. The change of optimization from mask-based to box-based brings a noticeable performance drop as shown in Table 2 (c). With the VIS-centric design, the mask-based optimization shows more robustness than box-based optimizations under typical video circumstances such as instances with heavy overlaps and partial occlusions.
175
+
176
+ Differing window strides In addition to the clip length $T$ , we further optimize our runtime placing a stride $S$ between clips, as shown in Table 2 (d). IFC can be used in a near-online manner, which takes clips that are consecutively extracted from a video. The placement of a larger stride reduces temporal intersections, which lessens computational overheads but also causes difficulty in matching instances. By enlarging the stride from $S = 1$ to $S = 3$ , IFC accomplishes approximately $150 \%$ speed improvement with only $0 . 1 \%$ AP drop. The tendency of high speed gain and low accuracy drop persists under various conditions. Therefore, our model can be applied to conditions where the enlargement of strides is necessary, i.e., using devices that are not powerful enough but has to maintain high inference speed.
177
+
178
+ Table 3: Encoder variations. We show how different encoders affect the overall performance.
179
+ (a) Various encoders taking clips of different lengths (see Table 1)
180
+
181
+ <table><tr><td></td><td colspan="3">T=5</td><td colspan="3">T=10</td><td colspan="3">T=15</td><td colspan="3">T=20</td></tr><tr><td></td><td>AP</td><td>AP75</td><td>FPS</td><td>AP</td><td>AP75</td><td>FPS</td><td>AP</td><td>AP75</td><td>FPS</td><td>AP</td><td>AP75</td><td>FPS</td></tr><tr><td>No Comm</td><td>37.4</td><td>39.9</td><td>38.1</td><td>38.8</td><td>41.6</td><td>40.8</td><td>39.3</td><td>41.7</td><td>46.7</td><td>39.6</td><td>41.9</td><td>52.9</td></tr><tr><td>Full THW</td><td>37.2</td><td>40.0</td><td>37.6</td><td>38.8</td><td>41.2</td><td>35.5</td><td>39.8</td><td>42.6</td><td>32.9</td><td>39.7</td><td>42.8</td><td>34.8</td></tr><tr><td>Decomp T-HW</td><td>37.2</td><td>39.8</td><td>35.7</td><td>38.3</td><td>40.9</td><td>37.9</td><td>38.5</td><td>41.5</td><td>42.6</td><td>39.0</td><td>41.9</td><td>49.4</td></tr><tr><td>IFC</td><td>39.0</td><td>42.7</td><td>36.3</td><td>39.6</td><td>43.0</td><td>38.9</td><td>39.8</td><td>43.0</td><td>43.7</td><td>40.4</td><td>43.4</td><td>50.2</td></tr></table>
182
+
183
+ (b) Image instance segmentation on COCO val set
184
+ (c) Number of memory tokens (AP)
185
+ (d) Index-wise memory decomposition
186
+
187
+ <table><tr><td></td><td>T=5</td><td>T=10</td><td>T=15</td><td>T=20</td></tr><tr><td>M=1</td><td>37.6</td><td>39.2</td><td>39.4</td><td>39.4</td></tr><tr><td>M=2</td><td>37.9</td><td>39.2</td><td>39.6</td><td>39.8</td></tr><tr><td>M=4</td><td>38.0</td><td>39.5</td><td>39.7</td><td>39.9</td></tr><tr><td>M=8</td><td>39.0</td><td>39.6</td><td>39.8</td><td>40.4</td></tr><tr><td>M=16</td><td>38.1</td><td>39.1</td><td>39.7</td><td>39.9</td></tr></table>
188
+
189
+ <table><tr><td></td><td>APCOcO</td><td>APOC</td></tr><tr><td>w/o mem</td><td>35.0</td><td>56.6</td></tr><tr><td>w/mem</td><td>35.1</td><td>56.5</td></tr></table>
190
+
191
+ <table><tr><td></td><td>T=5</td><td>T=10</td><td>T=15</td><td>T=20</td></tr><tr><td>Unified</td><td>38.1</td><td>38.9</td><td>39.7</td><td>39.9</td></tr><tr><td>Decomp</td><td>39.0</td><td>39.6</td><td>39.8</td><td>40.4</td></tr></table>
192
+
193
+ Various decomposition strategies of encoders In Table 1, we observed the computational gaps derived from the decomposition of the encoder layers. Extending Table 1, we now investigate the how the decomposition strategies affect the accuracy in Table 3.
194
+
195
+ The models are evaluated with variety of window sizes $( T = 5 , 1 0 , 1 5 , 2 0 )$ as an increase of window size $T$ has pros and cons. When matching predictions from different clips, greater $T$ is advantageous due to an enlargement of temporal intersections between clips. On the contrary, frames in longer clips are likely to be composed of diverse appearances, which disrupt tracking and segmenting instances within a clip. Therefore, the key to the performance enhancement is to cope with the appearance changes by precisely encoding and correlating space-time inputs.
196
+
197
+ As shown in Table 3 (a), the full self-attention [11] surpasses the encoder without communications as the length of clips increase. However, the enlargement of the window size highly slows down the inference speed, and the improvements are marginal that the tremendous computation and memory usage cannot be compensated. The decomposition of space-time maintains comparable speed even if the window is large, but fails to achieve high accuracy.
198
+
199
+ Our model shows fast inference as the only additional computations of IFC are from utilizing a small number of memory tokens. Furthermore, by effectively encoding the space-time inputs with the communications between frames, IFC can take advantages of enlarging the window size, and surpasses other encoders.
200
+
201
+ Memory tokens We also study the effects of utilizing memory tokens. As mentioned, the motivation of using the memory tokens is to build communications between frames. Different from the video instance segmentation task, the image segmentation task is consisted of a single frame. Therefore, the use of the memory tokens does not lead to improvements to the image instance segmentation task as mutual communications cannot be solely made (see Table 3 (b)). Meanwhile, the utilization of the memory tokens achieves great improvements by effectively passing the information between frames. Results in Table 3 (a, c) demonstrate that the use of memory tokens achieves higher accuracy than the encoder without any communications (No comm), which emphasizes the importance of the communications. We evaluate how the size of the memory tokens affect the overall accuracy in Table 3 (c) and set the default size of the tokens $M$ to be 8.
202
+
203
+ In Section 3.1, we demonstrated the formulation of the inputs for Gather-Communicate layer, which groups the outputs of Encode-Receive by memory indices. As aforementioned, the formulation can be considered as a decomposition of memory tokens: insertion to the Gather-Communicate layer by separate $M$ groups each consisting of $T$ tokens. In Table 3 (d), we investigate the impact of inserting the unified $M T$ tokens as a whole. Compared to the unified insertion, the decomposition brings better accuracy as the memories of same indices have more correspondences, which ease the encoders to build attentions in between.
204
+
205
+ ![](images/4b931f85da0d48797b1b4c756cba7dd5676ea7a6fc6286067da15b0c72e1db60.jpg)
206
+ Figure 3: Visualizations of results and attention maps of memory tokens.
207
+
208
+ We choose a memory index attending foreground instances and visualize the attention map in Fig. 3. As shown in the results of the upper clip, we find that the memory token has more interests to instances that are relatively difficult to detect; it more attends the heavily occluded car at the rear. The clip at the bottom is composed of frames with huge motion blurs and appearance changes. With the communications of memory tokens, IFC successfully tracks and segments the rabbit.
209
+
210
+ # 5 Conclusion
211
+
212
+ In this paper, we have proposed a novel video instance segmentation network using Inter-frame Communication Transformers (IFC), which alleviates full space-time attention and successfully builds communications between frames. Finally, our network presents a rapid inference and sets the new state-of-the-art on the YouTube-VIS dataset. For the future work, we plan to integrate temporal information, which indeed would take a step further to the human video understanding.
213
+
214
+ # Acknowledgments
215
+
216
+ This research was grant funded by the Artificial Intelligence Graduate School Program of Yonsei University, under Grant 2020-0-01361, Korea Evaluation Institute of Industrial Technology (KEIT) funded by the Ministry of Trade, Industry and Energy (10073129), and also supported by the Advanced Robotics Laboratory, part of the Future Technology Center at LG Electronics.
217
+
218
+ # References
219
+
220
+ [2] Cao, J., R. M. Anwer, H. Cholakkal, et al. Sipmask: Spatial information preservation for fast image and video instance segmentation. In ECCV. 2020.
221
+ [3] Yang, S., Y. Fang, X. Wang, et al. Crossover learning for fast online video instance segmentation. In ICCV. 2021.
222
+ [4] Liu, D., Y. Cui, W. Tan, et al. Sg-net: Spatial granularity network for one-stage video instance segmentation. In CVPR. 2021.
223
+ [5] He, K., G. Gkioxari, P. Dollar, et al. Mask r-cnn. In ICCV. 2017.
224
+ [6] Bolya, D., C. Zhou, F. Xiao, et al. Yolact: Real-time instance segmentation. In ICCV. 2019.
225
+ [7] Tian, Z., C. Shen, H. Chen. Conditional convolutions for instance segmentation. In ECCV. 2020.
226
+ [8] Chen, H., K. Sun, Z. Tian, et al. Blendmask: Top-down meets bottom-up for instance segmentation. In CVPR. 2020.
227
+ [9] Luo, W., J. Xing, A. Milan, et al. Multiple object tracking: A literature review. Artificial Intelligence, 2020.
228
+ [10] Bertasius, G., L. Torresani. Classifying, segmenting, and tracking object instances in video with mask propagation. In CVPR. 2020.
229
+ [11] Wang, Y., Z. Xu, X. Wang, et al. End-to-end video instance segmentation with transformers. In CVPR. 2020.
230
+ [12] Lin, H., R. Wu, S. Liu, et al. Video instance segmentation with a propose-reduce paradigm. In ICCV. 2021.
231
+ [13] Carion, N., F. Massa, G. Synnaeve, et al. End-to-end object detection with transformers. In ECCV. 2020.
232
+ [14] Vaswani, A., N. Shazeer, N. Parmar, et al. Attention is all you need. In NeurIPS. 2017.
233
+ [15] Wang, H., Y. Zhu, B. Green, et al. Axial-deeplab: Stand-alone axial-attention for panoptic segmentation. In ECCV. 2020.
234
+ [16] Bertasius, G., H. Wang, L. Torresani. Is space-time attention all you need for video understanding? In ICML. 2021.
235
+ [17] Arnab, A., M. Dehghani, G. Heigold, et al. Vivit: A video vision transformer. arXiv preprint arXiv:2103.15691, 2021.
236
+ [18] Wang, X., R. Girshick, A. Gupta, et al. Non-local neural networks. In CVPR. 2018.
237
+ [19] Kuhn, H. W. The hungarian method for the assignment problem. In Naval research logistics quarterly. 1955.
238
+ [20] Wang, H., Y. Zhu, H. Adam, et al. Max-deeplab: End-to-end panoptic segmentation with mask transformers. In CVPR. 2021.
239
+ [21] Dosovitskiy, A., L. Beyer, A. Kolesnikov, et al. An image is worth 16x16 words: Transformers for image recognition at scale. In ICLR. 2021.
240
+ [22] Ranftl, R., A. Bochkovskiy, V. Koltun. Vision transformers for dense prediction. In ICCV. 2021.
241
+ [23] Devlin, J., M.-W. Chang, K. Lee, et al. Bert: Pre-training of deep bidirectional transformers for language understanding. In NAACL. 2019.
242
+ [24] Touvron, H., M. Cord, M. Douze, et al. Training data-efficient image transformers & distillation through attention. In ICML. 2021.
243
+ [25] Kirillov, A., K. He, R. Girshick, et al. Panoptic segmentation. In CVPR. 2019.
244
+ [26] Tran, D., H. Wang, L. Torresani, et al. A closer look at spatiotemporal convolutions for action recognition. In CVPR. 2018.
245
+ [27] Lin, T.-Y., P. Dollar, R. Girshick, et al. Feature pyramid networks for object detection. In CVPR. 2017.
246
+ [28] Stewart, R., M. Andriluka, A. Y. Ng. End-to-end people detection in crowded scenes. In CVPR. 2016.
247
+ [29] Milletari, F., N. Navab, S.-A. Ahmadi. V-net: Fully convolutional neural networks for volumetric medical image segmentation. In 3DV. 2016.
248
+ [30] Lin, T.-Y., P. Goyal, R. Girshick, et al. Focal loss for dense object detection. In ICCV. 2017.
249
+ [31] He, K., X. Zhang, S. Ren, et al. Deep residual learning for image recognition. In CVPR. 2016.
250
+ [32] Athar, A., S. Mahadevan, A. Ošep, et al. Stem-seg: Spatio-temporal embeddings for instance segmentation in videos. In ECCV. 2020.
251
+ [33] Wu, Y., A. Kirillov, F. Massa, et al. Detectron2. https://github.com/facebookresearch/ detectron2, 2019.
252
+ [34] Loshchilov, I., F. Hutter. Decoupled weight decay regularization. In ICLR. 2019.
253
+ [35] Lin, T.-Y., M. Maire, S. Belongie, et al. Microsoft coco: Common objects in context. In ECCV. 2014.
254
+ [36] Dai, J., H. Qi, Y. Xiong, et al. Deformable convolutional networks. In ICCV. 2017.
255
+ [37] Cai, Z., N. Vasconcelos. Cascade r-cnn: Delving into high quality object detection. In CVPR. 2018.
md/train/v_1Soh8QUNc/v_1Soh8QUNc.md ADDED
@@ -0,0 +1,570 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LEARNING ENERGY-BASED MODELS BY DIFFUSION RECOVERY LIKELIHOOD
2
+
3
+ Ruiqi Gao
4
+ UCLA
5
+ ruiqigao@ucla.edu
6
+ Yang Song
7
+ Stanford University
8
+ yangsong@cs.stanford.edu
9
+ Ben Poole
10
+ Google Brain
11
+ pooleb@google.com
12
+ Ying Nian Wu
13
+ UCLA
14
+ ywu@stat.ucla.edu
15
+
16
+ Diederik P. Kingma Google Brain durk@google.com
17
+
18
+ # ABSTRACT
19
+
20
+ While energy-based models (EBMs) exhibit a number of desirable properties, training and sampling on high-dimensional datasets remains challenging. Inspired by recent progress on diffusion probabilistic models, we present a diffusion recovery likelihood method to tractably learn and sample from a sequence of EBMs trained on increasingly noisy versions of a dataset. Each EBM is trained with recovery likelihood, which maximizes the conditional probability of the data at a certain noise level given their noisy versions at a higher noise level. Optimizing recovery likelihood is more tractable than marginal likelihood, as sampling from the conditional distributions is much easier than sampling from the marginal distributions. After training, synthesized images can be generated by the sampling process that initializes from Gaussian white noise distribution and progressively samples the conditional distributions at decreasingly lower noise levels. Our method generates high fidelity samples on various image datasets. On unconditional CIFAR-10 our method achieves FID 9.58 and inception score 8.30, superior to the majority of GANs. Moreover, we demonstrate that unlike previous work on EBMs, our long-run MCMC samples from the conditional distributions do not diverge and still represent realistic images, allowing us to accurately estimate the normalized density of data even for high-dimensional datasets. Our implementation is available at https://github.com/ruiqigao/recovery_likelihood.
21
+
22
+ # 1 INTRODUCTION
23
+
24
+ EBMs (LeCun et al., 2006; Ngiam et al., 2011; Kim & Bengio, 2016; Zhao et al., 2016; Goyal et al., 2017; Xie et al., 2016b; Finn et al., 2016; Gao et al., 2018; Kumar et al., 2019; Nijkamp et al., 2019b; Du & Mordatch, 2019; Grathwohl et al., 2019; Desjardins et al., 2011; Gao et al., 2020; Che et al., 2020; Grathwohl et al., 2020; Qiu et al., 2019; Rhodes et al., 2020) are an appealing class of probabilistic models, which can be viewed as generative versions of discriminators (Jin et al., 2017; Lazarow et al., 2017; Lee et al., 2018; Grathwohl et al., 2020), yet can be learned from unlabeled data. Despite a number of desirable properties, two challenges remain for training EBMs on highdimensional datasets. First, learning EBMs by maximum likelihood requires Markov Chain Monte Carlo (MCMC) to generate samples from the model, which can be extremely expensive. Second, as pointed out in Nijkamp et al. (2019a), the energy potentials learned with non-convergent MCMC do not have a valid steady-state, in the sense that samples from long-run Markov chains can differ greatly from observed samples, making it difficult to evaluate the learned energy potentials.
25
+
26
+ Another line of work, originating from Sohl-Dickstein et al. (2015), is to learn from a diffused version of the data, which are obtained from the original data via a diffusion process that sequentially adds Gaussian white noise. From such diffusion data, one can learn the conditional model of the data at a certain noise level given their noisy versions at the higher noise level of the diffusion process. After learning the sequence of conditional models that invert the diffusion process, one can then generate synthesized images from Gaussian white noise images by ancestral sampling. Building on
27
+
28
+ ![](images/1f93214c96239917587b96ef6d60f476e08b78b6c70cfdc67ee5d8a9b1560597.jpg)
29
+ Figure 1: Generated samples on LSUN $1 2 8 ^ { 2 }$ church outdoor (left), LSUN $1 2 8 ^ { 2 }$ bedroom (center) and CelebA $6 4 ^ { 2 }$ (right).
30
+
31
+ Sohl-Dickstein et al. (2015), Ho et al. (2020) further developed the method, obtaining strong image synthesis results.
32
+
33
+ Inspired by Sohl-Dickstein et al. (2015) and Ho et al. (2020), we propose a diffusion recovery likelihood method to tackle the challenge of training EBMs directly on a dataset by instead learning a sequence of EBMs for the marginal distributions of the diffusion process. The sequence of marginal EBMs are learned with recovery likelihoods that are defined as the conditional distributions that invert the diffusion process. Compared to standard maximum likelihood estimation (MLE) of EBMs, learning marginal EBMs by diffusion recovery likelihood only requires sampling from the conditional distributions, which is much easier than sampling from the marginal distributions. After learning the marginal EBMs, we can generate synthesized images by a sequence of conditional samples initialized from the Gaussian white noise distribution. Unlike Ho et al. (2020) that approximates the reverse process by normal distributions, in our case the conditional distributions are derived from the marginal EBMs, which are more flexible. The framework of recovery likelihood was originally proposed in Bengio et al. (2013). In our work, we adapt it to learning the sequence of marginal EBMs from the diffusion data.
34
+
35
+ Our work is also related to the denoising score matching method of Vincent (2011), which was further developed by Song & Ermon (2019; 2020) for learning from diffusion data. The training objective used for diffusion probabilisitic models is a weighted version of the denoising score matching objective, as revealed by Ho et al. (2020). These methods learn the score functions (the gradients of the energy functions) directly, instead of using the gradients of learned energy functions as in EBMs. On the other hand, Saremi et al. (2018) parametrizes the score function as the gradient of a MLP energy function, and Saremi & Hyvarinen (2019) further unifies denoising score matching and neural empirical Bayes.
36
+
37
+ We demonstrate the efficacy of diffusion recovery likelihood on CIFAR-10, CelebA and LSUN datasets. The generated samples are of high fidelity and comparable to GAN-based methods. On CIFAR-10, we achieve FID 9.58 and inception score 8.30, exceeding existing methods of learning explicit EBMs to a large extent. We also demonstrate that diffusion recovery likelihood outperforms denoising score matching from diffusion data if we naively take the gradients of explicit energy functions as the score functions. More interestingly, by using a thousand diffusion time steps, we demonstrate that even very long MCMC chains from the sequence of conditional distributions produce samples that represent realistic images. With the faithful long-run MCMC samples from the conditional distributions, we can accurately estimate the marginal partition function at zero noise level by importance sampling, and thus evaluate the normalized density of data under the EBM.
38
+
39
+ ![](images/f595d9b6334e2a2328acb027a9a805e1b263b5ad77b7f60eab69eb2fbb00df39.jpg)
40
+ Figure 3: Illustration of diffusion recovery likelihood on 2D checkerboard example. Top: progressively generated samples. Bottom: estimated marginal densities.
41
+
42
+ # 2 BACKGROUND
43
+
44
+ Let $\mathbf { x } \sim p _ { \mathrm { d a t a } } ( \mathbf { x } )$ denote a training example, and $p _ { \theta } ( \mathbf { x } )$ denote a model’s probability density function that aims to approximates $p _ { \mathrm { d a t a } } ( \mathbf { x } )$ . An energy-based model (EBM) is defined as:
45
+
46
+ $$
47
+ p _ { \theta } ( \mathbf { x } ) = \frac { 1 } { Z _ { \theta } } \exp ( f _ { \theta } ( \mathbf { x } ) ) ,
48
+ $$
49
+
50
+ where $\begin{array} { r } { Z _ { \theta } = \int \exp ( f _ { \theta } ( \mathbf { x } ) ) d \mathbf { x } } \end{array}$ is the partition function, which is analytically intractable for highdimensional $\mathbf { x }$ . For images, we parameterize $f _ { \theta } ( \mathbf { x } )$ with a convolutional neural network with a scalar output.
51
+
52
+ The energy-based model in equation 1 can, in principle, be learned through MLE. Specifically, suppose we observe samples $\mathbf { x } _ { i } \sim p _ { \mathrm { d a t a } } ( \mathbf { x } )$ for $i = 1 , 2 , . . . , n$ . The log-likelihood function is
53
+
54
+ $$
55
+ \mathcal { L } ( \theta ) = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \log p _ { \theta } ( \mathbf { x } _ { i } ) \doteq \mathbb { E } _ { \mathbf { x } \sim p _ { \mathrm { d a t a } } } [ \log p _ { \theta } ( \mathbf { x } ) ] .
56
+ $$
57
+
58
+ In MLE, we seek to maximize the log-likelihood function, where the gradient approximately follows (Xie et al., 2016b)
59
+
60
+ $$
61
+ - \frac { \partial } { \partial \theta } D _ { \mathrm { K L } } ( p _ { \mathrm { d a t a } } | | p _ { \theta } ) = \mathbb { E } _ { \mathbf { x } \sim p _ { \mathrm { d a t a } } } \left[ \frac { \partial } { \partial \theta } f _ { \theta } ( \mathbf { x } ) \right] - \mathbb { E } _ { \mathbf { x } \sim p _ { \theta } } \left[ \frac { \partial } { \partial \theta } f _ { \theta } ( \mathbf { x } ) \right] .
62
+ $$
63
+
64
+ The expectations can be approximated by averaging over the observed samples and the synthesized samples drawn from the model distribution $p _ { \theta } ( \mathbf { x } )$ respectively. Generating synthesized samples from $p _ { \theta } ( \mathbf { x } )$ can be done with Markov Chain Monte Carlo (MCMC) such as Langevin dynamics (or Hamiltonian Monte Carlo (Girolami & Calderhead, 2011)), which iterates
65
+
66
+ $$
67
+ \mathbf { x } ^ { \tau + 1 } = \mathbf { x } ^ { \tau } + \frac { \delta ^ { 2 } } { 2 } \nabla _ { \mathbf { x } } f _ { \boldsymbol { \theta } } ( \mathbf { x } ^ { \tau } ) + \delta \boldsymbol { \epsilon } ^ { \tau } ,
68
+ $$
69
+
70
+ where $\tau$ indexes the time, $\delta$ is the step size, and $\epsilon ^ { \tau } \sim$ $\mathcal { N } ( 0 , \pmb { I } )$ . The difficulty lies in the fact that for highdimensional and multi-modal distributions, MCMC sampling can take a long time to converge, and the sampling chains may have difficulty traversing modes. As demonstrated in Figure 2, training EBMs with synthesized samples from non-convergent MCMC results in malformed energy landscapes (Nijkamp et al., 2019b), even if the samples from the model look reasonable.
71
+
72
+ ![](images/8c309204965bf46e85e8e6178113e5007c23fc3280aa37f954404473669e4a3e.jpg)
73
+ Figure 2: Comparison of learning EBMs by diffusion recovery likelihood (Ours) versus marginal likelihood (Short-run).
74
+
75
+ # 3 RECOVERY LIKELIHOOD
76
+
77
+ # 3.1 FROM MARGINAL TO CONDITIONAL
78
+
79
+ Given the difficulty of sampling from the marginal density $p _ { \theta } ( \mathbf { x } )$ , following Bengio et al. (2013), we use the recovery likelihood defined by the density of the
80
+
81
+ observed sample conditional on a noisy sample perturbed by isotropic Gaussian noise. Specifically, let $\tilde { \mathbf { x } } = \mathbf { x } + \sigma \mathbf { \epsilon }$ be the noisy observation of $\mathbf { x }$ , where $\epsilon \sim \mathcal { N } ( 0 , I )$ . Suppose $p _ { \theta } ( \mathbf { x } )$ is defined by the EBM in equation 1, then the conditional EBM can be derived as
82
+
83
+ $$
84
+ p _ { \theta } ( \mathbf { x } | \tilde { \mathbf { x } } ) = \frac { 1 } { \tilde { Z } _ { \theta } ( \tilde { \mathbf { x } } ) } \exp \left( f _ { \theta } ( \mathbf { x } ) - \frac { 1 } { 2 \sigma ^ { 2 } } \| \tilde { \mathbf { x } } - \mathbf { x } \| ^ { 2 } \right) ,
85
+ $$
86
+
87
+ where $\begin{array} { r } { \tilde { Z } _ { \theta } ( \tilde { \mathbf { x } } ) = \int \exp \left( f _ { \theta } ( \mathbf { x } ) - \frac { 1 } { 2 \sigma ^ { 2 } } \| \tilde { \mathbf { x } } - \mathbf { x } \| ^ { 2 } \right) d \mathbf { x } } \end{array}$ is the partition function of this conditional EBM. See Appendix A.1 for the derivation. Compared to $p _ { \theta } ( \mathbf { x } )$ (equation 1), the extra quadratic term $\frac { 1 } { 2 \sigma ^ { 2 } } \left\| \tilde { \mathbf { x } } - \mathbf { x } \right\| ^ { 2 }$ in $p _ { \theta } ( \mathbf { x } | \tilde { \mathbf { x } } )$ constrains the energy landscape to be localized around $\tilde { \mathbf { x } }$ , making the latter less multi-modal and easier to sample from. As we will show later, when $\sigma$ is small, $p _ { \theta } ( \mathbf { x } | \tilde { \mathbf { x } } )$ is approximately a single mode Gaussian distribution, which greatly reduces the burden of MCMC.
88
+
89
+ A more general formulation is $\tilde { \mathbf { x } } = a \mathbf { x } + \sigma \mathbf { \epsilon }$ , where $a$ is a positive constant. In that case, we can let $\mathbf { y } = a \mathbf { x }$ , and treat $\mathbf { y }$ as the observed sample. Assume $\begin{array} { r } { p _ { \theta } ( \mathbf { \hat { y } } ) = \frac { 1 } { Z _ { \theta } } \exp ( f _ { \theta } ( \mathbf { y } ) ) } \end{array}$ , then by change of variable, the density function of $\mathbf { x }$ can be derived as $g _ { \theta } ( \mathbf { x } ) = a p _ { \theta } ( a \mathbf { x } )$ .
90
+
91
+ # 3.2 MAXIMIZING RECOVERY LIKELIHOOD
92
+
93
+ With the conditional EBM, assume we have observed samples $\mathbf { x } _ { i } \sim p _ { \mathrm { d a t a } } ( \mathbf { x } )$ and the corresponding perturbed samples $\tilde { \mathbf { x } } _ { i } = \mathbf { x } _ { i } + \sigma \mathbf { \epsilon } _ { i }$ for $i = 1 , . . . , n$ . We define the recovery log-likelihood function as
94
+
95
+ $$
96
+ \mathcal { I } ( \theta ) = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \log p _ { \theta } \big ( \mathbf { x } _ { i } \big | \tilde { \mathbf { x } } _ { i } \big ) .
97
+ $$
98
+
99
+ The term recovery indicates that we attempt to recover the clean sample $\mathbf { x } _ { i }$ from the noisy sample $\tilde { \mathbf { x } } _ { i }$ . Thus, instead of maximizing $\mathcal { L } ( \boldsymbol { \theta } )$ in equation 2, we can maximize ${ \mathcal { I } } ( \theta )$ , whose distributions are easier to sample from. Specifically, we generate synthesized samples by $K$ steps of Langevin dynamics that iterates
100
+
101
+ $$
102
+ \mathbf { x } ^ { \tau + 1 } = \mathbf { x } ^ { \tau } + \frac { \delta ^ { 2 } } { 2 } ( \nabla _ { \mathbf { x } } f _ { \boldsymbol { \theta } } ( \mathbf { x } ^ { \tau } ) + \frac { 1 } { \sigma ^ { 2 } } ( \tilde { \mathbf { x } } - \mathbf { x } ^ { \tau } ) ) + \delta \epsilon ^ { \tau } .
103
+ $$
104
+
105
+ The model is then updated following the same learning gradients as MLE (equation 3), because the quadratic term $\begin{array} { r l r } { { - \frac { 1 } { 2 \sigma ^ { 2 } } \| \tilde { \mathbf { x } } - \mathbf { x } \| ^ { 2 } } } \end{array}$ is not related to $\theta$ . Following the classical analysis of MLE, we can show that the point estimate given by maximizing recovery likelihood is an unbiased estimator of the true parameters, which means that given enough data, a rich enough model and exact synthesis, maximizing the recovery likelihood learns $\theta$ such that $p _ { \mathrm { d a t a } } ( \mathbf { x } ) = p _ { \theta } ( \mathbf { x } )$ . See Appendix A.2 for a theoretical explanation.
106
+
107
+ # 3.3 NORMAL APPROXIMATION TO CONDITIONAL
108
+
109
+ When the variance of perturbed noise $\sigma ^ { 2 }$ is small, $p _ { \theta } ( \mathbf { x } | \tilde { \mathbf { x } } )$ can be approximated by a normal distribution via a first order Taylor expansion at $\tilde { \bf x }$ . Specifically, the negative conditional energy is
110
+
111
+ $$
112
+ \begin{array} { l } { \displaystyle - \mathcal { E } _ { \theta } ( \mathbf { x } | \tilde { \mathbf { x } } ) = f _ { \theta } ( \mathbf { x } ) - \frac { 1 } { 2 \sigma ^ { 2 } } \| \tilde { \mathbf { x } } - \mathbf { x } \| ^ { 2 } } \\ { \displaystyle \qquad \doteq \ f _ { \theta } ( \tilde { \mathbf { x } } ) + \langle \nabla _ { \mathbf { x } } f _ { \theta } ( \tilde { \mathbf { x } } ) , \mathbf { x } - \tilde { \mathbf { x } } \rangle - \frac { 1 } { 2 \sigma ^ { 2 } } \| \tilde { \mathbf { x } } - \mathbf { x } \| ^ { 2 } } \\ { \displaystyle \qquad = - \frac { 1 } { 2 \sigma ^ { 2 } } \left[ \| \mathbf { x } - ( \tilde { \mathbf { x } } + \sigma ^ { 2 } \nabla _ { \mathbf { x } } f _ { \theta } ( \tilde { \mathbf { x } } ) ) \| ^ { 2 } \right] + c , } \end{array}
113
+ $$
114
+
115
+ where $c$ include terms irrelevant of $\mathbf { x }$ (see Appendix A.3 for a detailed derivation). In the above approximation, we do not perform second order Taylor expansion because $\sigma ^ { 2 }$ is small, and $\lVert \tilde { \mathbf { x } } - \mathbf { \partial }$ $\mathbf { x } \Vert ^ { 2 } / 2 \sigma ^ { 2 }$ will dominate all the second order terms from Taylor expansion. Thus we can approximate $p _ { \theta } ( \mathbf { x } | \tilde { \mathbf { x } } )$ by a Gaussian approximation $\widetilde { p } _ { \boldsymbol { \theta } } ( \mathbf { x } | \widetilde { \mathbf { x } } )$ :
116
+
117
+ $$
118
+ \begin{array} { r } { \widetilde { p } _ { \boldsymbol { \theta } } ( \mathbf { x } | \widetilde { \mathbf { x } } ) = \mathcal { N } \left( \mathbf { x } ; \widetilde { \mathbf { x } } + \sigma ^ { 2 } \nabla _ { \mathbf { x } } f _ { \boldsymbol { \theta } } ( \widetilde { \mathbf { x } } ) , \sigma ^ { 2 } \right) . } \end{array}
119
+ $$
120
+
121
+ We can sample from this distribution using:
122
+
123
+ $$
124
+ \begin{array} { r } { \mathbf { x } _ { \mathrm { g e n } } = \tilde { \mathbf { x } } + \sigma ^ { 2 } \nabla _ { \mathbf { x } } f _ { \theta } ( \tilde { \mathbf { x } } ) + \sigma \epsilon , } \end{array}
125
+ $$
126
+
127
+ where $\epsilon \sim \mathcal { N } ( 0 , I )$ . This resembles a single step of Langevin dynamics, except that $\sigma \epsilon$ is replaced by $\sqrt { 2 } \sigma \epsilon$ in Langevin dynamics. This normal approximation has two traits: (1) it verifies the fact that the conditional density $p _ { \theta } ( \mathbf { x } | \tilde { \mathbf { x } } )$ can be generally easier to sample from when $\sigma$ is small; (2) it provides hints of choosing the step size of Langevin dynamics, as discussed in section 3.5.
128
+
129
+ The normal approximation to the conditional distribution leads to a natural connection to diffusion probabilistic models (Sohl-Dickstein et al., 2015; Ho et al., 2020) and denoising score matching (Vincent, 2011; Song & Ermon, 2019; 2020; Saremi et al., 2018; Saremi $\&$ Hyvarinen, 2019). Specifically, in diffusion probabilistic models, instead of modeling $p _ { \theta } ( x )$ as an energy-based model, it recruits variational inference and directly models the conditional density as
130
+
131
+ $$
132
+ p _ { \theta } ( \mathbf { x } | \tilde { \mathbf { x } } ) \sim \mathcal { N } \left( \tilde { \mathbf { x } } + \sigma ^ { 2 } s _ { \theta } ( \tilde { \mathbf { x } } ) , \sigma ^ { 2 } \right) ,
133
+ $$
134
+
135
+ which is in agreement with the normal approximation (equation 11), with $s _ { \theta } ( \mathbf { x } ) = \nabla _ { \mathbf { x } } f _ { \theta } ( \mathbf { x } )$ . On the other hand, the training objective of denoising score matching is to minimize
136
+
137
+ $$
138
+ \frac { 1 } { 2 \sigma ^ { 2 } } \mathbb { E } _ { p ( \mathbf { x } , \tilde { \mathbf { x } } ) } [ | | \mathbf { x } - ( \tilde { \mathbf { x } } + \sigma ^ { 2 } s _ { \theta } ( \tilde { \mathbf { x } } ) ) | | ^ { 2 } ] ,
139
+ $$
140
+
141
+ where $s _ { \theta } ( \mathbf { x } )$ is the score of the density of $\tilde { \mathbf { x } }$ . This objective is in agreement with the objective of maximizing log-likelihood of the normal approximation (equation 10), except that for normal approximation, $\nabla _ { \mathbf x } f _ { \boldsymbol \theta } ( \cdot )$ is the score of density of $\mathbf { x }$ , instead of $\tilde { \mathbf { x } }$ . However, the difference between the scores of density of $\mathbf { x }$ and $\tilde { \bf x }$ is of $O ( \sigma ^ { 2 } )$ , which is negligible when $\sigma$ is sufficiently small (see Appendix A.4 for details). We can further show that the learning gradient of maximizing log-likelihood of the normal approximation is approximately the same as the learning gradient of maximizing the original recovery log-likelihood with one step of Langevin dynamics (see Appendix A.5). It indicates that the training process of maximizing recovery likelihood agrees with the one of diffusion probabilistic models and denoising score matching when $\sigma$ is small.
142
+
143
+ As the normal approximation is accurate only when $\sigma$ is small, it requires many time steps in the diffusion process for this approximation to work well, which is also reported in Ho et al. (2020) and Song & Ermon (2020). In contrast, the diffusion recovery likelihood framework can be more flexible in choosing the number of time steps and the magnitude of $\sigma$ .
144
+
145
+ # 3.5 DIFFUSION RECOVERY LIKELIHOOD
146
+
147
+ As we discuss, sampling from $p _ { \theta } ( \mathbf { x } | \tilde { \mathbf { x } } )$ becomes simple only when $\sigma$ is small. In the extreme case when $\sigma \infty$ , $p _ { \theta } ( \mathbf { x } | \tilde { \mathbf { x } } )$ converges to the marginal distribution $p _ { \theta } ( \mathbf { x } )$ , which is again highly multimodal and difficult to sample from. To keep $\sigma$ small and meanwhile equip the model with the ability to generate new samples initialized from white noise, inspired by Sohl-Dickstein et al. (2015) and Ho et al. (2020), we propose to learn a sequence of recovery likelihoods, on gradually perturbed observed data based on a diffusion process. Specifically, assume a sequence of perturbed observations $\mathbf { x } _ { 0 } , \mathbf { x } _ { 1 } , . . . , \mathbf { x } _ { T }$ such that
148
+
149
+ $$
150
+ \mathbf { x } _ { 0 } \sim p _ { \mathrm { d a t a } } ( \mathbf { x } ) ; ~ \mathbf { x } _ { t + 1 } = { \sqrt { 1 - \sigma _ { t + 1 } ^ { 2 } } } \mathbf { x } _ { t } + \sigma _ { t + 1 } \epsilon _ { t + 1 } , ~ t = 0 , 1 , . . . T - 1 .
151
+ $$
152
+
153
+ The scaling factor $\sqrt { 1 - \sigma _ { t + 1 } ^ { 2 } }$ ensures that the sequence is a spherical interpolation between the observed sample and Gaussian white noise. Let $\mathbf y _ { t } = \sqrt { 1 - \sigma _ { t + 1 } ^ { 2 } } \mathbf x _ { t }$ , and we assume a sequence of conditional EBMs
154
+
155
+ $$
156
+ p _ { \theta } ( \mathbf { y } _ { t } | \mathbf { x } _ { t + 1 } ) = \frac { 1 } { \tilde { Z } _ { \theta , t } ( \mathbf { x } _ { t + 1 } ) } \exp \left( f _ { \theta } ( \mathbf { y } _ { t } , t ) - \frac { 1 } { 2 \sigma _ { t + 1 } ^ { 2 } } \| \mathbf { x } _ { t + 1 } - \mathbf { y } _ { t } \| ^ { 2 } \right) , t = 0 , 1 , . . . , T - 1 ,
157
+ $$
158
+
159
+ where $f _ { \theta } ( \mathbf { y } _ { t } , t )$ is defined by a neural network conditioned on $t$ .
160
+
161
+ We follow the learning algorithm in section 3.2. A question is how to determine the step size schedule $\delta _ { t }$ of Langevin dynamics. Inspired by the sampling procedure of the normal approximation (equation 12), we set the step size $\delta _ { t } = b \sigma _ { t }$ , where $b < 1$ is a tuned hyperparameter. This schedule turns out to work well in practice. Thus the $K$ steps of Langevin dynamics iterates
162
+
163
+ $$
164
+ \mathbf { y } _ { t } ^ { \tau + 1 } = \mathbf { y } _ { t } ^ { \tau } + \frac { b ^ { 2 } \sigma _ { t } ^ { 2 } } { 2 } ( \nabla _ { \mathbf { y } } f _ { \boldsymbol { \theta } } ( \mathbf { y } _ { t } ^ { \tau } , t ) + \frac { 1 } { \sigma _ { t } ^ { 2 } } ( \mathbf { x } _ { t + 1 } - \mathbf { y } _ { t } ^ { \tau } ) ) + b \sigma _ { t } \epsilon ^ { \tau } .
165
+ $$
166
+
167
+ Algorithm 1 summarizes the training procedure. After training, we initialize the MCMC sampling from Gaussian white noise, and the synthesized sample at each time step serves to initialize the MCMC that samples from the model of the previous time step. See algorithm 2. To show the efficacy of our method, Figures 3 and 2 display several 2D toy examples learned by diffusion recovery likelihood.
168
+
169
+ <table><tr><td>Algorithm1Training</td></tr><tr><td>repeat Sample t ~ Unif({o,...,T-1}).</td></tr><tr><td>Sample pairs (yt, Xt+1).</td></tr><tr><td>Set synthesized sample yt = Xt+1· forT←1toKdo</td></tr><tr><td>Update yt according to equation 17.</td></tr><tr><td>end for Update θ following the gradients</td></tr><tr><td>fo(yt,t)-foyt). until converged.</td></tr></table>
170
+
171
+ <table><tr><td>Algorithm2 Progressive sampling</td><td></td></tr><tr><td>Sample XT ~ N(0, I).</td><td rowspan="3"></td></tr><tr><td>fort←T-1to0do yt =Xt+1·</td></tr><tr><td>forT←1toKdo Update yt according to equation 17.</td></tr><tr><td>end for</td><td rowspan="3"></td></tr><tr><td>xt=yt/√1-²+1</td></tr><tr><td>end for return Xo.</td></tr></table>
172
+
173
+ # 4 EXPERIMENTS
174
+
175
+ To show that diffusion recovery likelihood is flexible for diffusion process of various magnitudes of noise, we test the method under two settings: (1) $T = 6$ , with $K = 3 0$ steps of Langevin dynamic per time step; (2) $T = 1 0 0 0$ , with sampling from normal approximation. (2) resembles the noise schedule of Ho et al. (2020) and the magnitude of noise added at each time step is much smaller compared to (1). For both settings, we set $\sigma _ { t } ^ { 2 }$ to increase linearly. The network structure of $f _ { \boldsymbol { \theta } } ( x , t )$ is based on Wide ResNet (Zagoruyko & Komodakis, 2016) and we remove weight normalization. $t$ is encoded by Transformer sinusoidal position embedding as in (Ho et al., 2020). For (1), we find that adding another scaling factor $c _ { t }$ to the step size $\delta _ { t }$ helps. Architecture and training details are in Appendix B. Henceforth we simply refer the two settings as $T 6$ and $T l k$ .
176
+
177
+ # 4.1 IMAGE GENERATION
178
+
179
+ Figures 1 and 4 display uncurated samples generated from learned models on CIFAR-10, CelebA $6 4 \times 6 4$ , LSUN $6 4 \times 6 4$ and $1 2 8 \times 1 2 8$ datasets under $T 6$ setting. The samples are of high fidelity and comparable to GAN-based methods. Appendix C.5 provides more generated samples. Tables 1 and 3 summarize the quantitative evaluations on CIFAR-10 and CelebA datasets, in terms of Frechet Inception Distance (FID) (Heusel et al., 2017) and inception scores (Salimans et al., 2016). On CIFAR-10, our model achieves FID 9.58 and inception score 8.30, which outperforms existing methods of learning explicit energy-based models to a large extent, and is superior to a majority of GAN-based methods. On CelebA, our model obtains results comparable with the state-of-the-art GAN-based methods, and outperforms score-based methods (Song & Ermon, 2019; 2020). Note that the score-based methods (Song & Ermon, 2019; 2020) and diffusion probabilistic models (Ho et al., 2020) directly parametrize and learn the score of data distribution, whereas our goal is to learn explicit energy-based models.
180
+
181
+ ![](images/fba9e04a553aebc2eef992610a38433ae2cf64697d56d8607f3113272f0d4eeb.jpg)
182
+ Figure 4: Generated samples on unconditional CIFAR-10 (left) and LSUN $6 4 ^ { 2 }$ church outdoor (center) and LSUN $6 4 ^ { 2 }$ bedroom (right).
183
+
184
+ Table 1: FID and inception scores on CIFAR-10.
185
+
186
+ <table><tr><td>Model</td><td>FID↓</td><td>Inception↑</td></tr><tr><td colspan="3">GAN-based</td></tr><tr><td>WGAN-GP (Gulrajani et al., 2017)</td><td>36.4</td><td>7.86 ± .07</td></tr><tr><td>SNGAN (Miyato et al., 2018) SNGAN-DDLS (Che et al.,2020)</td><td>21.7</td><td>8.22 ± .05</td></tr><tr><td>StyleGAN2-ADA (Karras et al., 2020)</td><td>15.42 3.26</td><td>9.09 ± .10 9.74 ± .05</td></tr><tr><td>Score-based</td><td></td><td></td></tr><tr><td colspan="3"></td></tr><tr><td>NCSN (Song &amp; Ermon,2019)</td><td>25.32</td><td>8.87 ± .12</td></tr><tr><td>NCSN-v2 (Song &amp; Ermon,2020)</td><td>10.87</td><td>8.40± .07</td></tr><tr><td>DDPM (Ho et al.,2020)</td><td>3.17</td><td>9.46 ± .11</td></tr><tr><td colspan="3">Explicit EBM-conditional</td></tr><tr><td>CoopNets (Xie et al., 2019)</td><td></td><td>7.30</td></tr><tr><td>EBM-IG (Du &amp; Mordatch,2019)</td><td>37.9</td><td>8.30</td></tr><tr><td>JEM (Grathwohl et al., 2019)</td><td>38.4</td><td>8.76</td></tr><tr><td colspan="3">Explicit EBM</td></tr><tr><td>Muli-grid (Gao et al., 2018)</td><td>40.01</td><td>6.56</td></tr><tr><td>CoopNets (Xie et al.,2016a)</td><td>33.61</td><td>6.55</td></tr><tr><td>EBM-SR (Nijkamp et al.,2019b)</td><td>=</td><td>6.21</td></tr><tr><td>EBM-IG (Du &amp; Mordatch,2019)</td><td>38.2</td><td>6.78</td></tr><tr><td>Ours (T6)</td><td>9.58</td><td>8.30 ± .11</td></tr></table>
187
+
188
+ Table 2: Ablation of training objectives, time steps $T$ and sampling steps $K$ on CIFAR-10. $K = 0$ indicates that we sample from the normal approximation.
189
+
190
+ <table><tr><td>Setting / Objective</td><td>FID↓</td><td>Inception↑</td></tr><tr><td>T= 1,K= 180 T=1000,K=0</td><td>32.12 22.58</td><td>6.72 ± 0.12 7.71 ± 0.08</td></tr><tr><td>T= 1000,K=0(DSM)</td><td>21.76</td><td>7.76 ± 0.11</td></tr><tr><td>T=6,K=10</td><td>-</td><td>1</td></tr><tr><td>T=6,K=30</td><td>9.58</td><td>8.30 ± 0.11</td></tr><tr><td>T=6,K=50</td><td>9.36</td><td>8.46 ± 0.13</td></tr></table>
191
+
192
+ Table 3: FID scores on CelebA $6 4 ^ { 2 }$
193
+
194
+ <table><tr><td rowspan=1 colspan=1>Model FID↓</td></tr><tr><td rowspan=1 colspan=1>QA-GAN (Parimala &amp; Channappayya, 2019) 6.42COCO-GAN (Lin et al., 2019) 4.0</td></tr><tr><td rowspan=1 colspan=1>NVAE (Vahdat &amp; Kautz,2020) 14.74</td></tr><tr><td rowspan=1 colspan=1>NCSN (Song &amp; Ermon,2019) 25.30NCSN-v2 (Song &amp; Ermon,2020) 10.23</td></tr><tr><td rowspan=1 colspan=1>EBM-SR (Nijkamp et al., 2019b) 23.02EBM-Triangle (Han et al.,2020) 24.70Ours (T6) 5.98</td></tr></table>
195
+
196
+ ![](images/d4f1466bea9c432de917393682cbe287526688ee68b72f1279ebc5b3d8df210f.jpg)
197
+ Figure 5: Interpolation results between the leftmost and rightmost generated samples. For top to bottom: LSUN church outdoor $1 2 8 ^ { 2 }$ , LSUN bedroom $1 2 8 ^ { 2 }$ and CelebA $6 4 ^ { 2 }$ .
198
+
199
+ Table 4: Test bits per dimension on CIFAR10. † indicates that we estimate the bit per dimension with the approximated log partition function instead of analytically computing it. See section 4.2.
200
+
201
+ <table><tr><td>Model BPD↓</td></tr><tr><td>DDPM (Ho et al., 2020) 3.70</td></tr><tr><td>Glow (Kingma &amp; Dhariwal,2018) 3.35</td></tr><tr><td>Flow++ (Ho et al.,2019) 3.08</td></tr><tr><td>GPixelCNN(Van den Oord et al., 2016) 3.03</td></tr><tr><td>Sparse Transformer (Child et al.,2019) 2.80</td></tr><tr><td>DistAug (Jun et al.,2020) 2.56</td></tr><tr><td>Ours+ (T1k) 3.18</td></tr></table>
202
+
203
+ ![](images/7d984ae7d9db013d14ef5aadfd936663a33647df768a74ca5d237150d6862eb7.jpg)
204
+ Figure 6: Image inpainting on LSUN church outdoor $1 2 \hat { 8 } ^ { 2 }$ (left) and CelebA $6 \hat { 4 } ^ { 2 }$ (right). With each block, the top row are mask images while the bottom row are inpainted images.
205
+
206
+ Interpolation. As shown in Figure 5, our model is capable of smooth interpolation between two generated samples. Specifically, for two samples $\mathbf { x } _ { 0 } ^ { ( 0 ) }$ and $\mathbf { x } _ { 0 } ^ { ( 1 ) }$ , we do a sphere interpolation between the initial white noise images $\mathbf { x } _ { T } ^ { ( 0 ) }$ and $\mathbf { x } _ { T } ^ { ( 1 ) }$ and the noise terms of Langevin dynamics $\epsilon _ { t , \tau } ^ { ( 0 ) }$ and $\epsilon _ { t , \tau } ^ { ( 1 ) }$ for every sampling step at every time step. More interpolation results can be found in Appendix C.3.
207
+
208
+ Image inpainting. A promising application of energy-based models is to use the learned model as a prior model for image processing, such as image inpainting, denoising and super-resolution (Gao et al., 2018; Du & Mordatch, 2019; Song & Ermon, 2019). In Figure 6, we demonstrate that the learned models by maximizing recovery likelihoods are capable of realistic and semantically meaningful image inpainting. Specifically, given a masked image and the corresponding mask, we first obtain a sequence of perturbed masked images at different noise levels. The inpainting can be easily achieved by running Langevin dynamics progressively on the masked pixels while keeping the observed pixels fixed at decreasingly lower noise levels. Additional image inpainting results can be found in Appendix C.4.
209
+
210
+ Ablation study. Table 2 summarizes the results of ablation study on CIFAR-10. We investigate the effect of changing the numbers of time steps $T$ and sampling steps $K$ . First, to show that it is beneficial to learn by diffusion recovery likelihood, we compare against a baseline approach $( T = 1 , K = 1 8 0 )$ where we use only one time step, so that the recovery likelihood becomes marginal likelihood. The approach is adopted by Nijkamp et al. (2019b) and Du & Mordatch (2019). For fair comparison, we equip the baseline method the same budget of MCMC sampling as our $T 6$ setting (i.e., 180 sampling steps). Our method outperforms this baseline method by a large margin. Also the models are trained more efficiently as the number of sampling steps per iteration is reduced and amortized by time steps.
211
+
212
+ Next, we report the sample quality of setting T1k. We test two training objectives for this setting: (1) maximizing recovery likelihoods $\mathrm { T } = 1 0 0 0$ , $\mathrm { K } = 0 $ ) and (2) maximizing the approximated normal distributions $( \mathrm { T } { = } 1 0 0 0$ , ${ \mathrm { K } } { = } 0$ (DSM)). As mentioned in section 3.4, (2) is equivalent to the training objectives of denoising score matching (Song & Ermon, 2019; 2020) and diffusion probabilistic model (Ho et al., 2020), except that the score functions are taken as the gradients of explicit energy functions. In practice, for a direct comparison, (2) follows the same implementation as in Ho et al. (2020), except that the score function is parametrized as the gradients of the explicit energy function used in our method. (1) and (2) achieve similar sample quality in terms of quantitative metrics, where (2) results in a slightly better FID score yet a slightly worse inception score. This verifies the fact that the training objectives of (1) and (2) are consistent. Both (1) and (2) performs worse than setting T6. A possible explanation is that the sampling error may accumulate with many time steps, so that a more flexible schedule of time steps accompanied with certain amount of sampling steps is preferred.
213
+
214
+ Last, we examine the influence of varying the number of sampling steps while fixing the number of time steps. The training becomes unstable when the number of sampling steps are not enough $( T = 6 , K = 1 0 )$ ), and more sampling steps lead to better sample quality. However, since $K = 5 0$ does not gain significant improvement versus $K = 3 0$ , yet of much higher computational cost, we keep $K = 3 0$ for image generation on all datasets. See Appendix C.1 for a plot of FID scores over iterations.
215
+
216
+ # 4.2 LONG-RUN CHAIN ANALYSIS
217
+
218
+ Besides achieving high quality generation, a perhaps equally important aspect of learning EBMs is to obtain a faithful energy potential. A principle way to check the validity of the learned potential is to perform long-run sampling chains and see if the samples still remain realistic. However, as pointed out in Nijkamp et al. (2019a), almost all existing methods of learning EBMs fail in getting realistic long-run chain samples. In this subsection, we demonstrate that by composing a thousand diffusion time steps $T l k$ setting), we can form steady long-run MCMC chains for the conditional distributions.
219
+
220
+ First we prepare a faithful sampler for conducting long-run sampling. Specifically, after training the model under $T 1 k$ setting by maximizing diffusion recovery likelihood, for each time step, we first sample from the normal approximation and count it as one sampling step, and then use Hamiltonian Monte Carlo (HMC) (Neal et al., 2011) with 2 leapfrog steps to perform the consecutive sampling steps. To obtain a reasonable schedule of sampling step size, for each time step we adaptively adjust the step size of HMC to make the average acceptance rate range in [0.6, 0.9], which is computed over 1000 chains for 100 steps. Figure 7 displays the adjusted step size (left) and acceptance rate (center) over time step. The adjusted step size increases logarithmically. With this step size schedule, we generate long-run chains from the learned sequence of conditional distributions. As shown in Figure 8, images remain realistic for even $1 0 0 k$ sampling steps in total (i.e., 100 sampling steps per time step), resulting in FID 24.89. This score is close to the one computed on samples generated by $1 k$ steps (i.e., sampled from normal approximation), which is 25.12. As a further check, we recruit a No-U-Turn Sampler (Hoffman & Gelman, 2014) with the same step size schedule as HMC to perform long-run sampling, where the samples also remain realistic. See Appendix C.2 for details.
221
+
222
+ ![](images/7578e8e42f4c5f00bef8857d21750372f869c15b5b96b65c5c634473962ad021.jpg)
223
+ Figure 7: Left: Adjusted step size of HMC over time step. Center: Acceptance rate over time step. Right: Estimated log partition function over number of samples with different number of sampling steps per time step. The $\mathbf { X }$ axis is plotted in log scale.
224
+
225
+ More interestingly, given the faithful long-run MCMC samples from the conditional distributions, we can estimate the log ratio of the partition functions of the marginal distributions, and further estimate the partition function of $p _ { \theta } ( \mathbf { y } _ { 0 } )$ . The strategy is based on annealed importance sampling (Neal, 2001). See Appendix A.6 for the implementation details. The right subfigure of Figure 7 depicts the estimated log partition function of $p _ { \theta } ( \mathbf { y } _ { 0 } )$ over the number of MCMC samples used. To verify the estimation strategy and again check the long-run chain samples, we conduct multiple runs using samples generated with different numbers of HMC steps and display the estimation curves. All the curves saturate to values close to each other at the end, indicating the stability of long-run chain samples and the effectiveness of the estimation strategy. With the estimated partition function, by change of variable, we can estimate the normalized density of data as $g _ { \theta } ( \mathbf { x } _ { 0 } ) \stackrel { - } { = } \sqrt { 1 - \sigma _ { 1 } ^ { 2 } } p _ { \theta } ( \sqrt { 1 - \sigma _ { 1 } ^ { 2 } } \mathbf { x } _ { 0 } )$ . We report test bits per dimension on CIFAR-10 in Table 4. Note that the result should be taken with a grain of salt, because the partition function is estimated by samples and as shown in Appendix A.6, it is a stochastic lower bound of the true value, that will converge to the true value when the number of samples grows large.
226
+
227
+ ![](images/6e91a3f30f292c128e9228b0ebd856e645b95546b90c997c87d1d5bafb062e0f.jpg)
228
+ Figure 8: Long-run chain samples from model-T1k with different total amount of HMC steps. From left to right: $1 k$ steps, $1 0 k$ steps and $1 0 0 k$ steps.
229
+
230
+ # 5 CONCLUSION
231
+
232
+ We propose to learn EBMs by diffusion recovery likelihood, a variant of MLE applied to diffusion processes. We achieve high quality image synthesis, and with a thousand noise levels, we obtain faithful long-run MCMC samples that indicate the validity of the learned energy potentials. Since this method can learn EBMs efficiently with small budget of MCMC, we are also interested in scaling it up to higher resolution images and investigating this method in other data modalities in the future.
233
+
234
+ # ACKNOWLEDGEMENT
235
+
236
+ The work was done while Ruiqi Gao and Yang Song were interns at Google Brain during the summer of 2020. The work of Ying Nian Wu is supported by NSF DMS-2015577. We thank Alexander A. Alemi, Jonathan Ho, Tim Salimans and Kevin Murphy for their insightful discussions during the course of this project.
237
+
238
+ # REFERENCES
239
+
240
+ Yoshua Bengio, Li Yao, Guillaume Alain, and Pascal Vincent. Generalized denoising auto-encoders as generative models. In Advances in neural information processing systems, pp. 899–907, 2013.
241
+
242
+ Tong Che, Ruixiang Zhang, Jascha Sohl-Dickstein, Hugo Larochelle, Liam Paull, Yuan Cao, and Yoshua Bengio. Your gan is secretly an energy-based model and you should use discriminator driven latent sampling. arXiv preprint arXiv:2003.06060, 2020.
243
+
244
+ Rewon Child, Scott Gray, Alec Radford, and Ilya Sutskever. Generating long sequences with sparse transformers. arXiv preprint arXiv:1904.10509, 2019.
245
+
246
+ Guillaume Desjardins, Yoshua Bengio, and Aaron C Courville. On tracking the partition function. In Advances in neural information processing systems, pp. 2501–2509, 2011.
247
+
248
+ Yilun Du and Igor Mordatch. Implicit generation and generalization in energy-based models. arXiv preprint arXiv:1903.08689, 2019.
249
+
250
+ Chelsea Finn, Paul Christiano, Pieter Abbeel, and Sergey Levine. A connection between generative adversarial networks, inverse reinforcement learning, and energy-based models. arXiv preprint arXiv:1611.03852, 2016.
251
+
252
+ Ruiqi Gao, Yang Lu, Junpei Zhou, Song-Chun Zhu, and Ying Nian Wu. Learning generative convnets via multi-grid modeling and sampling. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 9155–9164, 2018.
253
+
254
+ Ruiqi Gao, Erik Nijkamp, Diederik P Kingma, Zhen Xu, Andrew M Dai, and Ying Nian Wu. Flow contrastive estimation of energy-based models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 7518–7528, 2020.
255
+
256
+ Mark Girolami and Ben Calderhead. Riemann manifold langevin and hamiltonian monte carlo methods. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 73(2): 123–214, 2011.
257
+
258
+ Anirudh Goyal Alias Parth Goyal, Nan Rosemary Ke, Surya Ganguli, and Yoshua Bengio. Variational walkback: Learning a transition operator as a stochastic recurrent net. In Advances in Neural Information Processing Systems, pp. 4392–4402, 2017.
259
+
260
+ Will Grathwohl, Kuan-Chieh Wang, Jorn-Henrik Jacobsen, David Duvenaud, Mohammad Norouzi, ¨ and Kevin Swersky. Your classifier is secretly an energy based model and you should treat it like one. arXiv preprint arXiv:1912.03263, 2019.
261
+
262
+ Will Grathwohl, Kuan-Chieh Wang, Jorn-Henrik Jacobsen, David Duvenaud, and Richard Zemel. Cutting out the middle-man: Training and evaluating energy-based models without sampling. arXiv preprint arXiv:2002.05616, 2020.
263
+
264
+ Roger B Grosse, Siddharth Ancha, and Daniel M Roy. Measuring the reliability of mcmc inference with bidirectional monte carlo. In Advances in Neural Information Processing Systems, pp. 2451– 2459, 2016.
265
+
266
+ 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. 5767–5777, 2017.
267
+
268
+ Tian Han, Erik Nijkamp, Linqi Zhou, Bo Pang, Song-Chun Zhu, and Ying Nian Wu. Joint training of variational auto-encoder and latent energy-based model. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 7978–7987, 2020.
269
+
270
+ Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. Gans trained by a two time-scale update rule converge to a local nash equilibrium. In Advances in Neural Information Processing Systems, pp. 6626–6637, 2017.
271
+
272
+ Jonathan Ho, Xi Chen, Aravind Srinivas, Yan Duan, and Pieter Abbeel. Flow $^ { + + }$ : Improving flowbased generative models with variational dequantization and architecture design. arXiv preprint arXiv:1902.00275, 2019.
273
+
274
+ Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. arXiv preprint arXiv:2006.11239, 2020.
275
+
276
+ Matthew D Hoffman and Andrew Gelman. The no-u-turn sampler: adaptively setting path lengths in hamiltonian monte carlo. J. Mach. Learn. Res., 15(1):1593–1623, 2014.
277
+
278
+ Long Jin, Justin Lazarow, and Zhuowen Tu. Introspective classification with convolutional nets. In Advances in Neural Information Processing Systems, pp. 823–833, 2017.
279
+
280
+ Heewoo Jun, Rewon Child, Mark Chen, John Schulman, Aditya Ramesh, Alec Radford, and Ilya Sutskever. Distribution augmentation for generative modeling. In Proceedings of Machine Learning and Systems 2020, pp. 10563–10576. 2020.
281
+
282
+ Tero Karras, Miika Aittala, Janne Hellsten, Samuli Laine, Jaakko Lehtinen, and Timo Aila. Training generative adversarial networks with limited data. arXiv preprint arXiv:2006.06676, 2020.
283
+
284
+ Taesup Kim and Yoshua Bengio. Deep directed generative models with energy-based probability estimation. arXiv preprint arXiv:1606.03439, 2016.
285
+
286
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
287
+
288
+ Diederik P Kingma and Prafulla Dhariwal. Glow: Generative flow with invertible 1x1 convolutions. In Advances in Neural Information Processing Systems, pp. 10215–10224, 2018.
289
+
290
+ Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. Technical report, Citeseer, 2009.
291
+
292
+ Rithesh Kumar, Anirudh Goyal, Aaron Courville, and Yoshua Bengio. Maximum entropy generators for energy-based models. arXiv preprint arXiv:1901.08508, 2019.
293
+
294
+ Justin Lazarow, Long Jin, and Zhuowen Tu. Introspective neural networks for generative modeling. In Proceedings of the IEEE International Conference on Computer Vision, pp. 2774–2783, 2017.
295
+
296
+ Yann LeCun, Sumit Chopra, Raia Hadsell, M Ranzato, and F Huang. A tutorial on energy-based learning. Predicting structured data, 1(0), 2006.
297
+
298
+ Kwonjoon Lee, Weijian Xu, Fan Fan, and Zhuowen Tu. Wasserstein introspective neural networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 3702– 3711, 2018.
299
+
300
+ Chieh Hubert Lin, Chia-Che Chang, Yu-Sheng Chen, Da-Cheng Juan, Wei Wei, and Hwann-Tzong Chen. Coco-gan: generation by parts via conditional coordinating. In Proceedings of the IEEE International Conference on Computer Vision, pp. 4512–4521, 2019.
301
+
302
+ Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaoou Tang. Large-scale celebfaces attributes (celeba) dataset. Retrieved August, 15:2018, 2018.
303
+
304
+ Takeru Miyato, Toshiki Kataoka, Masanori Koyama, and Yuichi Yoshida. Spectral normalization for generative adversarial networks. arXiv preprint arXiv:1802.05957, 2018.
305
+
306
+ Radford M Neal. Annealed importance sampling. Statistics and computing, 11(2):125–139, 2001.
307
+
308
+ Radford M Neal et al. Mcmc using hamiltonian dynamics. Handbook of markov chain monte carlo, 2(11):2, 2011.
309
+
310
+ Jiquan Ngiam, Zhenghao Chen, Pang W Koh, and Andrew Y Ng. Learning deep energy models. In Proceedings of the 28th international conference on machine learning (ICML-11), pp. 1105– 1112, 2011.
311
+
312
+ Erik Nijkamp, Mitch Hill, Tian Han, Song-Chun Zhu, and Ying Nian Wu. On the anatomy of mcmcbased maximum likelihood learning of energy-based models. arXiv preprint arXiv:1903.12370, 2019a.
313
+
314
+ Erik Nijkamp, Mitch Hill, Song-Chun Zhu, and Ying Nian Wu. On learning non-convergent shortrun mcmc toward energy-based model. arXiv preprint arXiv:1904.09770, 2019b.
315
+
316
+ KANCHARLA Parimala and Sumohana and Channappayya. Quality aware generative adversarial networks. In Advances in Neural Information Processing Systems, pp. 2948–2958, 2019.
317
+
318
+ Yixuan Qiu, Lingsong Zhang, and Xiao Wang. Unbiased contrastive divergence algorithm for training energy-based latent variable models. In International Conference on Learning Representations, 2019.
319
+
320
+ Benjamin Rhodes, Kai Xu, and Michael U Gutmann. Telescoping density-ratio estimation. Advances in Neural Information Processing Systems, 33, 2020.
321
+
322
+ Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. In Advances in neural information processing systems, pp. 2234–2242, 2016.
323
+
324
+ Saeed Saremi and Aapo Hyvarinen. Neural empirical bayes. Journal of Machine Learning Research, 20:1–23, 2019.
325
+
326
+ Saeed Saremi, Arash Mehrjou, Bernhard Scholkopf, and Aapo Hyv ¨ arinen. Deep energy estimator ¨ networks. arXiv preprint arXiv:1805.08306, 2018.
327
+
328
+ Jascha Sohl-Dickstein, Eric A Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. arXiv preprint arXiv:1503.03585, 2015.
329
+
330
+ Yang Song and Stefano Ermon. Generative modeling by estimating gradients of the data distribution. In Advances in Neural Information Processing Systems, pp. 11918–11930, 2019.
331
+
332
+ Yang Song and Stefano Ermon. Improved techniques for training score-based generative models. arXiv preprint arXiv:2006.09011, 2020.
333
+
334
+ Arash Vahdat and Jan Kautz. Nvae: A deep hierarchical variational autoencoder. Advances in Neural Information Processing Systems, 33, 2020.
335
+
336
+ Aaron Van den Oord, Nal Kalchbrenner, Lasse Espeholt, Oriol Vinyals, Alex Graves, et al. Conditional image generation with pixelcnn decoders. In Advances in neural information processing systems, pp. 4790–4798, 2016.
337
+
338
+ Pascal Vincent. A connection between score matching and denoising autoencoders. Neural computation, 23(7):1661–1674, 2011.
339
+
340
+ Jianwen Xie, Yang Lu, Ruiqi Gao, Song-Chun Zhu, and Ying Nian Wu. Cooperative training of descriptor and generator networks. arXiv preprint arXiv:1609.09408, 2016a.
341
+
342
+ Jianwen Xie, Yang Lu, Song-Chun Zhu, and Yingnian Wu. A theory of generative convnet. In International Conference on Machine Learning, pp. 2635–2644, 2016b.
343
+
344
+ Jianwen Xie, Zilong Zheng, Xiaolin Fang, Song-Chun Zhu, and Ying Nian Wu. Cooperative training of fast thinking initializer and slow thinking solver for multi-modal conditional learning. arXiv preprint arXiv:1902.02812, 2019.
345
+
346
+ Fisher Yu, Ari Seff, Yinda Zhang, Shuran Song, Thomas Funkhouser, and Jianxiong Xiao. Lsun: Construction of a large-scale image dataset using deep learning with humans in the loop. arXiv preprint arXiv:1506.03365, 2015.
347
+
348
+ Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. arXiv preprint arXiv:1605.07146, 2016.
349
+
350
+ Junbo Zhao, Michael Mathieu, and Yann LeCun. Energy-based generative adversarial network. arXiv preprint arXiv:1609.03126, 2016.
351
+
352
+ A EXTENDED DERIVATIONS
353
+
354
+ A.1 DERIVATION OF EQUATION 5
355
+
356
+ Let $\tilde { \mathbf { x } } = \mathbf { x } + \sigma \mathbf { \epsilon }$ , where $\epsilon \sim \mathcal { N } ( 0 , I )$ . Given the marginal distribution of
357
+
358
+ $$
359
+ p _ { \theta } ( \mathbf { x } ) = \frac { 1 } { Z _ { \theta } } \exp ( f _ { \theta } ( \mathbf { x } ) ) ,
360
+ $$
361
+
362
+ We can derive the conditional distribution of $\mathbf { x }$ given $\tilde { \bf x }$ as
363
+
364
+ $$
365
+ \begin{array} { l } { { \displaystyle p _ { \theta } ( { \bf x } | { \bf \tilde { x } } ) = p _ { \theta } ( { \bf x } ) p ( { \tilde { \bf x } } | { \bf x } ) / p ( { \tilde { \bf x } } ) } \ ~ } \\ { { \displaystyle ~ = \frac { 1 } { Z _ { \theta } } \exp ( f _ { \theta } ( { \bf x } ) ) \frac { 1 } { ( 2 \pi \sigma ^ { 2 } ) ^ { \frac { n } { 2 } } } \exp ( - \frac { 1 } { 2 \sigma ^ { 2 } } \| { \tilde { \bf x } } - { \bf x } \| ^ { 2 } ) / p ( { \tilde { \bf x } } ) } \ ~ } \\ { \displaystyle ~ = \frac { 1 } { { \tilde { Z } } _ { \theta } ( { \tilde { \bf x } } ) } \exp \left( f _ { \theta } ( { \bf x } ) - \frac { 1 } { 2 \sigma ^ { 2 } } \| { \tilde { \bf x } } - { \bf x } \| ^ { 2 } \right) , } \end{array}
366
+ $$
367
+
368
+ where we absorb all the terms that are irrelevant of $\mathbf { x }$ as $\tilde { Z } _ { \theta } ( \tilde { \mathbf { x } } )$ .
369
+
370
+ # A.2 THEORETICAL UNDERSTANDING
371
+
372
+ In this subsection, we analyze the asymptotic behavior of maximizing the recovery log-likelihood.
373
+
374
+ For model class $\{ p _ { \theta } ( \mathbf { x } ) , \forall \theta \}$ , suppose there exists $\theta ^ { * }$ such that $p _ { \mathrm { { d a t a } } } ~ = ~ p _ { \theta ^ { * } }$ . According to the classical theory of MLE, let $\widehat { \theta } _ { 0 }$ be the point estimate by MLE. Then we have $\hat { \theta }$ is an unbiased estimator of $\theta ^ { * }$ with asymptotic normality:
375
+
376
+ $$
377
+ \sqrt { n } ( { \hat { \theta } } _ { 0 } - \theta ^ { * } ) \to \mathcal { N } ( 0 , { \mathcal { T } } _ { 0 } ( \theta ^ { * } ) ^ { - 1 } ) ,
378
+ $$
379
+
380
+ where $\begin{array} { r } { \begin{array} { r l } { \mathcal { T } _ { 0 } ( \theta ) = \mathbb { E } _ { \mathbf { x } \sim p _ { \theta } } [ - \nabla _ { \theta } ^ { 2 } \log p _ { \theta } ( \mathbf { x } ) ] } \end{array} } \end{array}$ is the Fisher information, and $n$ is the number of observed samples.
381
+
382
+ Let $\hat { \theta }$ be the point estimate given by maximizing recovery log-likelihood, we can derive a result in parallel to that of MLE:
383
+
384
+ $$
385
+ { \sqrt { n } } ( { \hat { \theta } } - \theta ^ { * } ) \to { \mathcal { N } } ( 0 , { \mathcal { T } } ( \theta ^ { * } ) ^ { - 1 } ) ,
386
+ $$
387
+
388
+ where $\mathcal { T } ( \theta ) = \mathbb { E } _ { p _ { \theta } ( \mathbf { x } , \tilde { \mathbf { x } } ) } [ - \nabla _ { \theta } ^ { 2 } \log p _ { \theta } ( \mathbf { x } | \tilde { \mathbf { x } } ) ]$ . The relationship between $I _ { 0 } ( \theta )$ and $I ( \theta )$ is that
389
+
390
+ $$
391
+ \begin{array} { r } { \mathcal { T } _ { 0 } ( \theta ) = \mathcal { T } ( \theta ) + \mathbb { E } _ { p _ { \theta } ( \mathbf { x } , \tilde { \mathbf { x } } ) } [ - \nabla _ { \theta } ^ { 2 } \log p _ { \theta } ( \tilde { \mathbf { x } } ) ] . } \end{array}
392
+ $$
393
+
394
+ Thus there is loss of information, but $\hat { \theta }$ is still an unbiased estimator of $\theta ^ { * }$ with asymptotic normality.
395
+
396
+ A.3 DETAILED DERIVATION OF NORMAL APPROXIMATION
397
+
398
+ $$
399
+ \begin{array} { l } { \displaystyle - \mathcal { E } _ { \theta } ( { \bf x } | { \tilde { \bf x } } ) = f _ { \theta } ( { \bf x } ) - \frac { 1 } { 2 { \sigma } ^ { 2 } } \| { \tilde { \bf x } } - { \bf x } \| ^ { 2 } } \\ { \displaystyle \doteq f _ { \theta } ( { \tilde { \bf x } } ) + \langle \nabla _ { { \bf x } } f _ { \theta } ( { \tilde { \bf x } } ) , { \bf x } - { \tilde { \bf x } } \rangle - \frac { 1 } { 2 { \sigma } ^ { 2 } } \| { \tilde { \bf x } } - { \bf x } \| ^ { 2 } } \\ { \displaystyle = - \frac { 1 } { 2 { \sigma } ^ { 2 } } \left[ \| { \bf x } \| ^ { 2 } - 2 \langle { \tilde { \bf x } } , { \bf x } \rangle + \| { \tilde { \bf x } } \| ^ { 2 } \right] + \langle \nabla _ { { \bf x } } f _ { \theta } ( { \tilde { \bf x } } ) , { \bf x } \rangle - \langle \nabla _ { { \bf x } } f _ { \theta } ( { \tilde { \bf x } } ) , { \tilde { \bf x } } \rangle + f _ { \theta } ( { \tilde { \bf x } } ) } \\ { \displaystyle = - \frac { 1 } { 2 { \sigma } ^ { 2 } } \left[ \| { \bf x } \| ^ { 2 } - 2 \langle { \tilde { \bf x } } + { \sigma } ^ { 2 } \nabla _ { { \bf x } } f _ { \theta } ( { \tilde { \bf x } } ) , { \bf x } \rangle \right] - \frac { 1 } { 2 { \sigma } ^ { 2 } } \| { \tilde { \bf x } } \| ^ { 2 } - \langle \nabla _ { { \bf x } } f _ { \theta } ( { \tilde { \bf x } } ) , { \tilde { \bf x } } \rangle + f _ { \theta } ( { \tilde { \bf x } } ) } \\ { \displaystyle = - \frac { 1 } { 2 { \sigma } ^ { 2 } } \left[ \| { \bf x } - ( { \tilde { \bf x } } + { \sigma } ^ { 2 } \nabla _ { { \bf x } } f _ { \theta } ( { \tilde { \bf x } } ) ) \| ^ { 2 } \right] + c , } \end{array}
400
+ $$
401
+
402
+ A.4 DIFFERENCE BETWEEN THE SCORES OF $p ( \mathbf { x } )$ AND $p ( \tilde { \mathbf { x } } )$
403
+
404
+ For notation clarity, with $\tilde { \mathbf { x } } = \mathbf { x } + \epsilon$ , we let $\widetilde { p }$ be the distribution of $\tilde { \bf x }$ , and $p$ be the distribution of $\mathbf { x }$ eThen for a smooth testing function with vanishing tails,
405
+
406
+ $$
407
+ \begin{array} { r l } & { \mathbb { E } [ h ( \tilde { \mathbf { x } } ) ] = \mathbb { E } [ h ( \mathbf { x } + \pmb { \epsilon } ) ] } \\ & { \qquad \doteq \mathbb { E } [ h ( \mathbf { x } ) + h ^ { \prime } ( \mathbf { x } ) \pmb { \epsilon } + h ^ { \prime \prime } ( \mathbf { x } ) \pmb { \epsilon } ^ { 2 } / 2 ] } \\ & { \qquad = \mathbb { E } [ h ( \mathbf { x } ) ] + \mathbb { E } [ h ^ { \prime \prime } ( \mathbf { x } ) ] \sigma ^ { 2 } / 2 . } \end{array}
408
+ $$
409
+
410
+ Integral by parts,
411
+
412
+ $$
413
+ \mathbb { E } [ h ^ { \prime \prime } ( { \mathbf x } ) ] = \int h ^ { \prime \prime } ( { \mathbf x } ) p ( { \mathbf x } ) d { \mathbf x } = - \int h ^ { \prime } ( { \mathbf x } ) p ^ { \prime } ( { \mathbf x } ) d { \mathbf x } = \int p ^ { \prime \prime } ( { \mathbf x } ) h ( { \mathbf x } ) d { \mathbf x } .
414
+ $$
415
+
416
+ Thus we have the heat equation
417
+
418
+ $$
419
+ \widetilde { p } ( \mathbf { x } ) = p ( \mathbf { x } ) + p ^ { \prime \prime } ( \mathbf { x } ) \sigma ^ { 2 } / 2 .
420
+ $$
421
+
422
+ The score
423
+
424
+ $$
425
+ \begin{array} { r l } & { \nabla _ { \mathbf x } \log \tilde { p } ( \mathbf x ) = \nabla _ { x } \log p ( \mathbf x ) + \nabla _ { \mathbf x } \log ( 1 + p ^ { \prime \prime } ( \mathbf x ) / p ( \mathbf x ) \sigma ^ { 2 } / 2 ) } \\ & { \qquad \quad \doteq \nabla _ { \mathbf x } \log p ( \mathbf x ) + \nabla _ { \mathbf x } [ p ^ { \prime \prime } ( \mathbf x ) / p ( \mathbf x ) ] \sigma ^ { 2 } / 2 . } \end{array}
426
+ $$
427
+
428
+ Thus the difference between the score of $p$ and $\widetilde { p }$ is of the order $\sigma ^ { 2 }$ , which is negligible when $\sigma ^ { 2 }$ is small.
429
+
430
+ # A.5 LEARNING GRADIENTS OF NORMAL APPROXIMATION AND ORIGINAL RECOVERY LIKELIHOOD
431
+
432
+ In this subsection we demonstrate that the learning gradient of maximizing likelihood of the normal approximation is approximately the same as the gradient of maximizing the original recovery likelihood with one step of Langevin sampling. Specifically, the gradient of the normal approximation of recovery log-likelihood for an observed $\mathbf { x } _ { \mathrm { o b s } }$ is
433
+
434
+ $$
435
+ \nabla _ { \boldsymbol { \theta } } \left( \frac { 1 } { 2 \sigma ^ { 2 } } \left[ \lVert \mathbf { x } _ { \mathrm { o b s } } - ( \tilde { \mathbf { x } } + \sigma ^ { 2 } f _ { \boldsymbol { \theta } } ^ { \prime } ( \tilde { \mathbf { x } } ) ) \rVert ^ { 2 } \right] \right) = \nabla _ { \boldsymbol { \theta } } f _ { \boldsymbol { \theta } } ^ { \prime } ( \tilde { \mathbf { x } } ) ( \mathbf { x } _ { \mathrm { o b s } } - ( \tilde { \mathbf { x } } + \sigma ^ { 2 } f _ { \boldsymbol { \theta } } ^ { \prime } ( \tilde { \mathbf { x } } ) ) .
436
+ $$
437
+
438
+ On the other hand, to maximize the original recovery likelihood, suppose we sample $\mathbf { x } _ { \mathrm { s y n } } \sim$ $p _ { \theta } ( \mathbf { x } | \tilde { \mathbf { x } } )$ , then the gradient ascent of the original recovery log-likelihood is
439
+
440
+ $$
441
+ \nabla _ { \boldsymbol { \theta } } f _ { \boldsymbol { \theta } } ( \mathbf x _ { \mathrm { o b s } } ) - \mathbb { E } [ \nabla _ { \boldsymbol { \theta } } f _ { \boldsymbol { \theta } } ( \mathbf x _ { \mathrm { s y n } } ) ] = h _ { \boldsymbol { \theta } } ( \mathbf x _ { \mathrm { o b s } } ) - \mathbb { E } [ h _ { \boldsymbol { \theta } } ( \mathbf x _ { \mathrm { s y n } } ) ] ,
442
+ $$
443
+
444
+ where $h _ { \theta } ( \mathbf { x } ) = \nabla _ { \theta } f _ { \theta } ( \mathbf { x } )$ . Approximately, if we perform one step of Langevin dynamics from √ $\tilde { \mathbf { x } }$ to obtain $\mathbf { x } _ { \mathrm { s y n } }$ , i.e., $x _ { \mathrm { s y n } } = \tilde { \mathbf { x } } + \sigma ^ { 2 } f _ { \theta } ^ { \prime } ( \tilde { \mathbf { x } } ) + \sqrt { 2 } \sigma e$ , and assume $f _ { \boldsymbol { \theta } } ( \mathbf { x } )$ is locally linear in $\mathbf { x }$ , then
445
+
446
+ $$
447
+ \begin{array} { r l } & { \nabla _ { \theta } f _ { \theta } ( \mathbf { x } _ { \mathrm { o b s } } ) - \mathbb { E } [ \nabla _ { \theta } f _ { \theta } ( \mathbf { x } _ { \mathrm { i n i t } } ) ] } \\ & { = h _ { \theta } ( \mathbf { x } _ { \mathrm { o b s } } ) - \mathbb { E } [ h _ { \theta } ( \tilde { \mathbf { x } } + \sigma ^ { 2 } f _ { \theta } ^ { \prime } ( \tilde { \mathbf { x } } ) + \sigma e ) ] } \\ & { \doteq h _ { \theta } ( \tilde { \mathbf { x } } ) + h _ { \theta } ^ { \prime } ( \tilde { \mathbf { x } } ) ( x _ { \mathrm { o b s } } - \tilde { \mathbf { x } } ) - \mathbb { E } [ h _ { \theta } ( \tilde { \mathbf { x } } ) + h _ { \theta } ^ { \prime } ( \tilde { \mathbf { x } } ) ( \sigma ^ { 2 } f _ { \theta } ^ { \prime } ( \tilde { \mathbf { x } } ) + \sigma e ) ] } \\ & { = h _ { \theta } ^ { \prime } ( \tilde { \mathbf { x } } ) ( \mathbf { x } _ { \mathrm { o b s } } - ( \tilde { \mathbf { x } } + \sigma ^ { 2 } f _ { \theta } ^ { \prime } ( \tilde { \mathbf { x } } ) ) } \\ & { = \nabla _ { \theta } f _ { \theta } ^ { \prime } ( \tilde { \mathbf { x } } ) ( \mathbf { x } _ { \mathrm { o b s } } - ( \tilde { \mathbf { x } } + \sigma ^ { 2 } f _ { \theta } ^ { \prime } ( \tilde { \mathbf { x } } ) ) . } \end{array}
448
+ $$
449
+
450
+ Comparing equations 37 and 43, we see that the two gradients agree with each other.
451
+
452
+ # A.6 ESTIMATING THE PARTITION FUNCTION
453
+
454
+ We can utilize the sequence of learned distributions of $\mathbf { y } _ { t } \left( = \sqrt { 1 - \sigma _ { t + 1 } ^ { 2 } } \mathbf { x } _ { t } \right)$ to estimate the partition function. Specifically, the marginal distribution of $\mathbf { y } _ { t }$ is
455
+
456
+ $$
457
+ p _ { \theta } ( \mathbf { y } _ { t } ) = \frac { 1 } { Z _ { \theta , t } } \exp { ( f _ { \theta } ( \mathbf { y } _ { t } , t ) ) }
458
+ $$
459
+
460
+ We can estimate the ratio of the partition functions at two consecutive time steps using importance sampling
461
+
462
+ $$
463
+ \begin{array} { c l } { \displaystyle \frac { Z _ { \theta , t } } { Z _ { \theta , t + 1 } } = \mathbb { E } _ { p _ { \theta } ( \mathbf { y } _ { t + 1 } ) } \left[ \exp ( f _ { \theta } ( \mathbf { y } , t ) - f _ { \theta } ( \mathbf { y } , t + 1 ) ) \right] } \\ { \displaystyle \doteq \frac { 1 } { M } \sum _ { i = 1 } ^ { M } \left[ \exp ( f _ { \theta } ( \mathbf { y } _ { t + 1 , i } , t ) - f _ { \theta } ( \mathbf { y } _ { t + 1 , i } , t + 1 ) ) \right] , } \end{array}
464
+ $$
465
+
466
+ where $\mathbf { y } _ { t + 1 , i }$ are samples generated by progressive sampling. Starting from $t = T$ , where $p _ { T } ( x )$ follows Gaussian distribution, we can compute $\log Z _ { \theta , t }$ along the reverse path of the diffusion process, until we reach $t = 0$ :
467
+
468
+ $$
469
+ Z _ { \theta , 0 } = Z _ { \theta , T } \prod _ { t = 0 } ^ { T - 1 } { \frac { Z _ { \theta , t } } { Z _ { \theta , t + 1 } } } .
470
+ $$
471
+
472
+ In practice, since the ratio given by MCMC samples can vary across many orders of magnitude, it is more meaningful to estimate
473
+
474
+ $$
475
+ \log Z _ { \theta , 0 } = \log Z _ { \theta , T } + \sum _ { t = 0 } ^ { T - 1 } \log \frac { Z _ { \theta , t } } { Z _ { \theta , t + 1 } } .
476
+ $$
477
+
478
+ Unfortunately, although equation 46 is an unbiased estimator of $Z _ { \theta , t } / Z _ { \theta , t + 1 }$ , the logarithm of this estimator is generally a stochastic lower bound of $\log ( Z _ { \theta , t } / Z _ { \theta , t + 1 } )$ (Grosse et al., 2016). However, as we show below, this bound will gradually converge to an unbiased estimator of $\log ( Z _ { \theta , t } / Z _ { \theta , t + 1 } )$ , as the number of samples becomes large. Specifically, let $A$ be the estimator in equation 46, $\mu$ be the true value of $Z _ { \theta , t } / Z _ { \theta , t + 1 }$ . We have $\mathbb { E } [ A ] = \mu$ , then by second order Taylor expansion,
479
+
480
+ $$
481
+ \begin{array} { l } { \displaystyle \mathbb { E } \big [ \log A \big ] \doteq \mathbb { E } \left[ \log \mu + \frac { 1 } { \mu } ( A - \mu ) - \frac { 1 } { 2 \mu ^ { 2 } } ( A - \mu ) ^ { 2 } \right] } \\ { \displaystyle = \log \mu - \frac { 1 } { 2 \mu ^ { 2 } } \mathrm { V a r } ( A ) . } \end{array}
482
+ $$
483
+
484
+ By law of large number, $\mathrm { V a r } ( A ) \to 0$ as $M \infty$ , and thus $\mathbb { E } [ \log A ] \to \log \mu$ . This is also consistent with the estimation curves in the right subfigure of Figure 7: since $\mathrm { V a r } ( A ) \geq 0$ , the estimation curve increases from below as the number of samples becomes larger. When the curve becomes stable, it indicates the convergence.
485
+
486
+ # B EXPERIMENTAL DETAILS
487
+
488
+ Model architecture. Our network structure is based on Wide ResNet (Zagoruyko & Komodakis, 2016). Table 5 lists the detailed network structures of various resolutions. The number of ResBlocks at every level $N$ is a hyperparameter that we sweep over. The values of $N$ for various datasets are listed in Table 6. Each ResBlock consists of two Conv2D layers. For the second Conv2D layer, we use zero initialization for the weights, and add a trainable channel-wise scaling parameter to the output. We remove the weight normalization, and use leaky ReLU $( \mathrm { s l o p e } = 0 . 2 )$ ) as the activation function in ResBlocks. Spectral normalization (Miyato et al., 2018) is used to regularize parameters in Conv2D layer, ResBlocks and Dense layer. For encoding time step $t$ , we follow the scheme in (Ho et al., 2020). Specifically, the time step $t$ is first transformed into sinusoidal embedding, and then two Dense layers is added. The time embedding is added after the first Conv2D layer of each ResBlock.
489
+
490
+ Training. We use Adam (Kingma & Ba, 2014) optimizer for all the experiments. We find that for high resolution images, using a smaller $\beta _ { 1 }$ in Adam help stabilize training. We use learning rate 0.0001 for all the experiments. For the values of $\beta _ { 1 }$ , batch sizes and the number of training iterations for various datasets, see Table 6.
491
+
492
+ Datasets. We use the following datasets in our experiments: CIFAR-10 (Krizhevsky et al., 2009), CelebA (Liu et al., 2018) and LSUN (Yu et al., 2015). CIFAR-10 is of resolution $3 2 \times 3 2$ , and contains 50, 000 training images and 10, 000 test images. CelebA contains 202,599 face images, of which 162,770 are training images and 19,962 are test images. For processing, we first clip each image to $1 7 8 \times 1 7 8$ and then resize it to $6 4 \times 6 4$ . For LSUN, we use church outdoor and bedroom categories, which contains 126,227 and 3,033,042 training images respectively. Both categories contain 300 test images. For processing, we first crop each image to a square image of the smaller size among the height and weight, and then we resize it to $6 4 \times 6 4$ or $1 2 8 \times 1 2 8$ . For resizing, we set antialias to True. We apply horizontal random flip as data augmentation for all datasets during training.
493
+
494
+ Evaluation metrics. We use FID and inception scores as quantitative evaluation metrics of sample quality. On all the datasets, we calculate FID and inception scores on 50,000 samples using the original code from Salimans et al. (2016) and Heusel et al. (2017).
495
+
496
+ Table 5: Model architectures of various solutions. $N$ is a hyperparameter that we sweep over.
497
+
498
+ <table><tr><td rowspan=1 colspan=1>(a) Resolution 32 × 32</td></tr><tr><td rowspan=1 colspan=1>3 × 3 Conv2D,128</td></tr><tr><td rowspan=1 colspan=1>N ResBlocks,128Downsample 2 × 2</td></tr><tr><td rowspan=1 colspan=1>N ResBlocks,256Downsample 2 × 2</td></tr><tr><td rowspan=1 colspan=1>N ResBlocks,256Downsample 2 × 2</td></tr><tr><td rowspan=1 colspan=1>N ResBlocks,256</td></tr><tr><td rowspan=1 colspan=1>ReLU, global sumDense 1</td></tr></table>
499
+
500
+ <table><tr><td rowspan=1 colspan=1>(b) Resolution 64 × 64</td></tr><tr><td rowspan=1 colspan=1>3 × 3 Conv2D,128</td></tr><tr><td rowspan=1 colspan=1>N ResBlocks, 128Downsample 2 × 2</td></tr><tr><td rowspan=1 colspan=1>N ResBlocks,256Downsample 2 × 2</td></tr><tr><td rowspan=1 colspan=1>N ResBlocks, 256Downsample 2 × 2</td></tr><tr><td rowspan=1 colspan=1>N ResBlocks,256Downsample 2 × 2</td></tr><tr><td rowspan=1 colspan=1>N ResBlocks,512</td></tr><tr><td rowspan=1 colspan=1>ReLU, global sumDense 1</td></tr></table>
501
+
502
+ <table><tr><td rowspan=1 colspan=1>c) Resolution 128 × 128</td></tr><tr><td rowspan=1 colspan=1>3 × 3 Conv2D,128</td></tr><tr><td rowspan=1 colspan=1>N ResBlocks,128Downsample 2× 2</td></tr><tr><td rowspan=1 colspan=1>N ResBlocks, 256Downsample 2 × 2</td></tr><tr><td rowspan=1 colspan=1>N ResBlocks, 256Downsample 2 × 2</td></tr><tr><td rowspan=1 colspan=1>N ResBlocks, 256Downsample 2 × 2</td></tr><tr><td rowspan=1 colspan=1>N ResBlocks, 512Downsample 2 × 2</td></tr><tr><td rowspan=1 colspan=1>N ResBlocks, 512</td></tr><tr><td rowspan=1 colspan=1>ReLU, global sumDense 1</td></tr></table>
503
+
504
+ <table><tr><td>(d) Time embedding (temb)</td></tr><tr><td>sinusoidal embedding</td></tr><tr><td>Dense,leakyReLU</td></tr><tr><td>Dense</td></tr></table>
505
+
506
+ <table><tr><td rowspan=1 colspan=1>(e)ResBlock</td></tr><tr><td rowspan=1 colspan=1>leakyReLU,3×3Conv2D</td></tr><tr><td rowspan=1 colspan=1>+Dense(leakyReLU(temb))</td></tr><tr><td rowspan=1 colspan=1>leakyReLU,3×3Conv2D</td></tr><tr><td rowspan=1 colspan=1>+ input</td></tr></table>
507
+
508
+ Table 6: Hyperparameters of various datasets.
509
+
510
+ <table><tr><td>Dataset</td><td>N</td><td>β1 in Adam</td><td>Batch size</td><td>Training iterations</td></tr><tr><td>CIFAR-10</td><td>8</td><td>0.9</td><td>256</td><td>240k</td></tr><tr><td>CelebA</td><td>6</td><td>0.5</td><td>128</td><td>880k</td></tr><tr><td>LSUN church_outdoor 64²</td><td>2</td><td>0.9</td><td>128</td><td>960k</td></tr><tr><td>LSUN bedroom 64²</td><td>2</td><td>0.9</td><td>128</td><td>760k</td></tr><tr><td>LSUN church_outdoor 1282</td><td>2</td><td>0.5</td><td>64</td><td>840k</td></tr><tr><td>LSUN bedroom 128²</td><td>5</td><td>0.5</td><td>64</td><td>580k</td></tr></table>
511
+
512
+ # C ADDITIONAL EXPERIMENTAL RESULTS
513
+
514
+ # C.1 FID SCORES OVER ITERATIONS
515
+
516
+ Figure 9 demonstrates FID scores computed on 2,500 samples every 15,000 iterations.
517
+
518
+ # C.2 LONG-RUN CHAIN SAMPLING WITH NUTS
519
+
520
+ As a further check, we use a No-U-Turn Sampler (Hoffman & Gelman, 2014) to perform the longrun chain sampling, with the same step size schedule obtained for HMC sampler. Figure 10 displays samples with different number of sampling steps. The samples remain realistic after $1 0 0 k$ sampling steps in total and the FID score remains stable.
521
+
522
+ ![](images/5508a55841a80b48d7284baa8e62c3c3d5b82f0288a7300df61098c89b767fdd.jpg)
523
+ Figure 9: FIDs for different number of Langevin steps.
524
+
525
+ ![](images/3c69cf0a8f1113685ebb77f434813b0c3f69158dabf70771b18888b12b67ab21.jpg)
526
+ Figure 10: Long run chain samples with different total number of NUTS steps.
527
+
528
+ # C.3 ADDITIONAL INTERPOLATION RESULTS
529
+
530
+ ![](images/bf6ffcd348081f7ad9216c3911b5e3b7a663aee9ff67a173ee77bb1083b7bd0f.jpg)
531
+ Figures 11, 12 and 13 display more examples of interpolation between two generated samples on CelebA $6 4 ^ { 2 }$ , LSUN church outdoor $1 2 8 ^ { 2 }$ and LSUN bedroom $1 2 8 ^ { 2 }$ .
532
+ Figure 11: Interpolation results between the leftmost and rightmost generated samples on CelebA $6 4 \times 6 4$ .
533
+
534
+ ![](images/60322126028b5c657acadd3391c9853d6182e6f75ee0f004b984593106b0d538.jpg)
535
+ Figure 12: Interpolation results between the leftmost and rightmost generated samples on LSUN church outdoor $1 2 8 \times 1 2 8$ .
536
+
537
+ ![](images/b9d8a7090cbf440e50a5187066fd2f60038d7514a3ed31d1cca84e685f9ca2a9.jpg)
538
+ Figure 13: Interpolation results between the leftmost and rightmost generated samples on LSUN bedroom $1 2 8 \times 1 2 8$ .
539
+
540
+ # C.4 ADDITIONAL IMAGE INPAINTING RESULTS
541
+
542
+ Figures 14 and 15 show additional examples of image inpainting on CelebA $6 4 ^ { 2 }$ and LSUN church outdoor $1 2 8 ^ { 2 }$ .
543
+
544
+ # C.5 ADDITIONAL UNCURATED SAMPLES
545
+
546
+ Figures 16, 17, 18, 19, 20 and 21 show uncurated samples from the learned models under $T 6$ setting on CIFAR-10, CelebA $6 4 ^ { 2 }$ , LSUN church outdoor $1 2 8 ^ { 2 }$ , LSUN bedroom $1 2 8 ^ { 2 }$ , LSUN church outdoor $6 4 ^ { 2 }$ and LSUN bedroom $6 4 ^ { 2 }$ datasets.
547
+
548
+ ![](images/949dfdc0a8889946a2d957728f9d1d8112a9e4ab7be209c69c427e3eaff96b30.jpg)
549
+ Figure 14: Image inpainting results on CelebA $6 4 \times 6 4$ . Top: masked images, bottom: inpainted images.
550
+
551
+ ![](images/fe47a535a24754292af690af9b3d5695694973b0285d7f2051477d0663eed67b.jpg)
552
+ Figure 15: Image inpainting results on LSUN church outdoor $1 2 8 \times 1 2 8$ . Top: masked images, bottom: inpainted images.
553
+
554
+ ![](images/6243af9ab682989532a93531f7189dfeb9d474b77c2057dae0f70f5a96ba436c.jpg)
555
+ Figure 16: Generated samples on CIFAR-10.
556
+
557
+ ![](images/0c86aedaeca1c13a16871f3e64404f5044d049ec9b31b08286717d21cfb7b328.jpg)
558
+ Figure 17: Generated samples on CelebA $6 4 \times 6 4$ .
559
+
560
+ ![](images/36e9f0713651f0114a02cd8cfc84e2ce944d583d60bc1c98d79548c095c4152a.jpg)
561
+ Figure 18: Generated samples on LSUN church outdoor $1 2 8 \times 1 2 8$ . FID=9.76
562
+
563
+ ![](images/73d43590848e525299de0d042e481374287ba1f147ddf6f0ebcee2a9b45c141c.jpg)
564
+ Figure 19: Generated samples on LSUN bedroom $1 2 8 \times 1 2 8$ . FID=11.27
565
+
566
+ ![](images/29510dc7f4eb3133769becaae4c960dd22512b5c424caaf9a9bacec5a8531a27.jpg)
567
+ Figure 20: Generated samples on LSUN church outdoor $6 4 \times 6 4$ . FID=7.02
568
+
569
+ ![](images/e2afe229e9f1eb3bfef759ecebdd205bd27c8aecbfad7390845c6c697339238b.jpg)
570
+ Figure 21: Generated samples on LSUN bedroom $6 4 \times 6 4$ . FID=8.98